Lines 231-271javascript
231 if (!reason) return void 0;
232 const parts = reason.split(";").filter(
233 (part) => part.startsWith("generatedEvidence=") || part === "generatedVerification=partial" || part === "index=unknown_nonblocking"
235 return parts.length > 0 ? parts.join(";") : void 0;
237function deriveAgentDisplayName(type, task) {
238 const stopWords = /* @__PURE__ */ new Set([
252 const asciiTask = Array.from(task.normalize("NFKD").toLowerCase()).map((char) => char.charCodeAt(0) <= 127 ? char : " ").
253 const tokens = asciiTask.replace(/[^a-z0-9]+/gu, " ").trim().split(/\s+/u).filter((token) => token &&
254 const base = tokens.length > 0 ? tokens.join("-") : `task-${createHash("sha1").update(task).digest("hex").slice(
255 const label = base.endsWith(`-${type}`) ? base : `${base}-${type}`;
256 return truncateAsciiLabel(label, 36);
258function truncateAsciiLabel(value, maxLength) {
259 const cleaned = value.replace(/[^a-z0-9-]/gu, "-").replace(/-{2,}/gu, "-").replace(/^-|-$/gu, "");
260 if (cleaned.length <= maxLength) {
261 return cleaned || "agent";
263 return cleaned.slice(0, maxLength).replace(/-+$/u, "") || "agent";
265function createDurableJobAgents(options, status, runningCap) {
266 const total = Math.max(1, options.requestedAgents);
267 const tasks = createDurableJobAgentTasks(options.goal, total);
268 return Array.from({ length: total }, (_, index) => {
269 const active = false;
270 const agentStatus = status === "running" ? index < runningCap ? "queued" : "sleeping" : status === "created" ? "created" : status;
271 const type = index === 0 ? "planner" : index === 1 ? "worker" : index === 2 ? "verifier" :