wildcrane 0.11.73 → 0.11.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/kanban.mjs +362 -133
- package/package.json +2 -2
package/dist/kanban.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// ai4kanban 0.11.
|
|
2
|
+
// ai4kanban 0.11.75 — built from the CLI's TypeScript sources by cli/scripts/build.mjs.
|
|
3
3
|
// Do not edit: every change belongs in cli/src/, and a build overwrites this file.
|
|
4
4
|
import { createRequire as __ai4kanbanRequire } from 'node:module'
|
|
5
5
|
const require = __ai4kanbanRequire(import.meta.url)
|
|
@@ -59,6 +59,11 @@ function insideRun() {
|
|
|
59
59
|
function runEnv(env2, value) {
|
|
60
60
|
return { ...env2, [RUN_ENV]: value };
|
|
61
61
|
}
|
|
62
|
+
function taskReviewContext() {
|
|
63
|
+
const { AI4KANBAN_TASK_REVIEW: review, AI4KANBAN_REVIEW_STAGES: assigned } = process.env;
|
|
64
|
+
if (!review) return void 0;
|
|
65
|
+
return { review: JSON.parse(review), assigned: assigned ? JSON.parse(assigned) : void 0 };
|
|
66
|
+
}
|
|
62
67
|
var RUN_ENV, SCHEDULED_AGENTS_ENV, SESSION_COST_ENV, STOP_ENV, SESSION_VARS;
|
|
63
68
|
var init_env = __esm({
|
|
64
69
|
"src/lib/agent/env.ts"() {
|
|
@@ -20849,11 +20854,52 @@ function parseReviewPlan(value, previews) {
|
|
|
20849
20854
|
}
|
|
20850
20855
|
return plan;
|
|
20851
20856
|
}
|
|
20857
|
+
function readReviewPlan(plan) {
|
|
20858
|
+
return plan?.map(({ id: id2, after: after2, previews }) => ({ id: id2, after: after2, previews })) ?? null;
|
|
20859
|
+
}
|
|
20860
|
+
function reviewAuthorization(review, assigned, dispatchRevision) {
|
|
20861
|
+
if (review.pending_plan) return { kind: "pending" };
|
|
20862
|
+
const states2 = new Map(review.stages.map((stage) => [stage.id, stage]));
|
|
20863
|
+
const nodes = (review.plan ?? []).filter((node2) => {
|
|
20864
|
+
const stage = states2.get(node2.id);
|
|
20865
|
+
if (!stage || assigned && !assigned.includes(node2.id)) return false;
|
|
20866
|
+
return stage.status === "running" || stage.status === "available" && (dispatchRevision === void 0 || stage.revision <= dispatchRevision);
|
|
20867
|
+
});
|
|
20868
|
+
if (assigned?.some((id2) => !nodes.some((node2) => node2.id === id2))) return { kind: "changed" };
|
|
20869
|
+
if (review.plan === null) return { kind: "plan" };
|
|
20870
|
+
if (review.plan.length === 0) return { kind: "unreviewed" };
|
|
20871
|
+
if (nodes.length) return { kind: "stages", nodes };
|
|
20872
|
+
if (review.plan.every((node2) => states2.get(node2.id)?.status === "approved")) return { kind: "delivery" };
|
|
20873
|
+
return { kind: "waiting" };
|
|
20874
|
+
}
|
|
20875
|
+
function reviewAllows(authorization, action) {
|
|
20876
|
+
return action === "refine" ? authorization.kind === "plan" || authorization.kind === "stages" : authorization.kind === "unreviewed" || authorization.kind === "delivery";
|
|
20877
|
+
}
|
|
20878
|
+
function reviewInstruction(authorization) {
|
|
20879
|
+
switch (authorization.kind) {
|
|
20880
|
+
case "plan":
|
|
20881
|
+
return "Planning only. Propose a review plan; wait for explicit plan approval.";
|
|
20882
|
+
case "pending":
|
|
20883
|
+
return "Wait for the proposed plan decision. Do not start new stages.";
|
|
20884
|
+
case "unreviewed":
|
|
20885
|
+
return "No extra review. Complete the authorized work and Studio delivery checks.";
|
|
20886
|
+
case "stages":
|
|
20887
|
+
return [
|
|
20888
|
+
"Work only on these unlocked stages: " + authorization.nodes.map((node2) => node2.id).join(", "),
|
|
20889
|
+
...authorization.nodes.map((node2) => `- ${node2.id}: ${node2.previews.length ? node2.previews.join(", ") : "card body"}`)
|
|
20890
|
+
].join("\n");
|
|
20891
|
+
case "delivery":
|
|
20892
|
+
return "Stages complete. Follow Studio delivery checks.";
|
|
20893
|
+
case "changed":
|
|
20894
|
+
return "Review authorization changed. Read the task again.";
|
|
20895
|
+
case "waiting":
|
|
20896
|
+
return "Wait for review. Do not execute locked stages.";
|
|
20897
|
+
}
|
|
20898
|
+
}
|
|
20852
20899
|
function reviewBoundary(review, assigned) {
|
|
20853
|
-
const allowed = review.pending_plan ? [] : review.stages.filter((s) => (s.status === "available" || s.status === "running") && (!assigned || assigned.includes(s.id)));
|
|
20854
20900
|
return [
|
|
20855
20901
|
"Task review: " + JSON.stringify(review),
|
|
20856
|
-
|
|
20902
|
+
reviewInstruction(reviewAuthorization(review, assigned)),
|
|
20857
20903
|
"Read akb task review before reporting running/done with its revision. Sync content and assets before done. Revise a stage before changing its approved output. Questions and plan approval never approve outputs."
|
|
20858
20904
|
].join("\n");
|
|
20859
20905
|
}
|
|
@@ -20865,7 +20911,6 @@ var init_review_plan = __esm({
|
|
|
20865
20911
|
id = external_exports.string().trim().min(1).max(100);
|
|
20866
20912
|
reviewNodeSchema = external_exports.object({
|
|
20867
20913
|
id,
|
|
20868
|
-
title: external_exports.string().trim().min(1).max(200),
|
|
20869
20914
|
after: external_exports.array(id).max(50).default([]),
|
|
20870
20915
|
previews: external_exports.array(id).max(50).default([])
|
|
20871
20916
|
}).strict();
|
|
@@ -20932,8 +20977,8 @@ function deferRefresh(session, error62, after2) {
|
|
|
20932
20977
|
const attempt2 = Math.min((readRetry(session)?.attempt ?? 0) + 1, 4);
|
|
20933
20978
|
const seconds = after2?.trim() ? Number(after2) : NaN;
|
|
20934
20979
|
const serverDelay = Number.isFinite(seconds) ? seconds * 1e3 : Date.parse(after2 ?? "") - Date.now();
|
|
20935
|
-
const
|
|
20936
|
-
const retry2 = { key: refreshKey(session), until: Date.now() +
|
|
20980
|
+
const delay3 = Math.max(Math.min(REFRESH_BACKOFF_MS * 2 ** (attempt2 - 1), 3e5), Number.isFinite(serverDelay) ? serverDelay : 0);
|
|
20981
|
+
const retry2 = { key: refreshKey(session), until: Date.now() + delay3, attempt: attempt2, error: error62 };
|
|
20937
20982
|
const temporary = `${retryFile()}.${process.pid}.tmp`;
|
|
20938
20983
|
fs3.writeFileSync(temporary, JSON.stringify(retry2), { mode: 384 });
|
|
20939
20984
|
fs3.renameSync(temporary, retryFile());
|
|
@@ -36765,7 +36810,7 @@ var init_preview_blocks = __esm({
|
|
|
36765
36810
|
});
|
|
36766
36811
|
|
|
36767
36812
|
// src/lib/agent/studio-def.ts
|
|
36768
|
-
function parseStudioFile(id2, source2, from) {
|
|
36813
|
+
function parseStudioFile(id2, source2, from, requirePreviewCopy = false) {
|
|
36769
36814
|
const problems = [];
|
|
36770
36815
|
const fail = (offset, path86, code, message, hint2) => problems.push({ file: from, ...sourcePosition(source2, offset), path: path86, code, message, hint: hint2 });
|
|
36771
36816
|
const result = () => ({ problem: problems.map((p) => `${p.file}:${p.line}:${p.column} ${p.path}: ${p.code} \u2014 ${p.message}. ${p.hint}`).join("\n"), problems });
|
|
@@ -36793,7 +36838,7 @@ function parseStudioFile(id2, source2, from) {
|
|
|
36793
36838
|
const key = error62.params.additionalProperty ?? error62.params.missingProperty;
|
|
36794
36839
|
if (key) parts.push(String(key));
|
|
36795
36840
|
const node2 = parts.length ? document.getIn(parts, true) : document.contents;
|
|
36796
|
-
fail(metaOffset + (node2?.range?.[0] ?? 0), parts.join("."), "studio-schema", `${parts.join(".") || "metadata"} ${error62.message}`, "Use only Studio metadata and previews: {id: {title?, icon?}} with the declared field types.");
|
|
36841
|
+
fail(metaOffset + (node2?.range?.[0] ?? 0), parts.join("."), "studio-schema", `${parts.join(".") || "metadata"} ${error62.message}`, "Use only Studio metadata and previews: {id: {title?, description?, icon?}} with the declared field types.");
|
|
36797
36842
|
}
|
|
36798
36843
|
}
|
|
36799
36844
|
const body = source2.slice(bodyOffset);
|
|
@@ -36803,6 +36848,20 @@ function parseStudioFile(id2, source2, from) {
|
|
|
36803
36848
|
const map3 = raw.previews ?? {};
|
|
36804
36849
|
for (const block of parsed.blocks) if (!Object.hasOwn(map3, block.id)) fail(bodyOffset + block.start, `previews.${block.id}`, "preview-metadata-missing", `Preview ${block.id} has no metadata entry`, "Add the ID under previews, using {} if needed.");
|
|
36805
36850
|
for (const key of Object.keys(map3)) if (!parsed.blocks.some((b) => b.id === key)) fail(metaOffset + (document.getIn(["previews", key], true)?.range?.[0] ?? 0), `previews.${key}`, "preview-body-missing", `Preview ${key} has no body`, "Add its block or remove unused metadata.");
|
|
36851
|
+
if (requirePreviewCopy) for (const block of parsed.blocks) {
|
|
36852
|
+
const metadata = Object.hasOwn(map3, block.id) ? map3[block.id] : void 0;
|
|
36853
|
+
if (!metadata) continue;
|
|
36854
|
+
for (const field2 of ["title", "description"]) for (const lang of ["en", "zh"]) {
|
|
36855
|
+
if (metadata[field2]?.[lang]) continue;
|
|
36856
|
+
fail(
|
|
36857
|
+
bodyOffset + block.start,
|
|
36858
|
+
`previews.${block.id}.${field2}.${lang}`,
|
|
36859
|
+
"preview-display-missing",
|
|
36860
|
+
`Preview ${block.id} needs a ${lang} ${field2}`,
|
|
36861
|
+
"Add non-blank en and zh display text in the Preview metadata."
|
|
36862
|
+
);
|
|
36863
|
+
}
|
|
36864
|
+
}
|
|
36806
36865
|
if (problems.length) return result();
|
|
36807
36866
|
let rules = "", at = 0;
|
|
36808
36867
|
for (const block of parsed.blocks) {
|
|
@@ -36855,7 +36914,7 @@ var init_studio_def = __esm({
|
|
|
36855
36914
|
previews: { type: "object", propertyNames: { pattern: PREVIEW_ID.source }, additionalProperties: {
|
|
36856
36915
|
type: "object",
|
|
36857
36916
|
additionalProperties: false,
|
|
36858
|
-
properties: { title: titles, icon }
|
|
36917
|
+
properties: { title: titles, description: titles, icon }
|
|
36859
36918
|
} }
|
|
36860
36919
|
}
|
|
36861
36920
|
};
|
|
@@ -36897,12 +36956,12 @@ function mcpProblem(text5) {
|
|
|
36897
36956
|
}
|
|
36898
36957
|
return null;
|
|
36899
36958
|
}
|
|
36900
|
-
function checkStudioFiles(value, official = false) {
|
|
36901
|
-
const read5 = inspect(value, official);
|
|
36959
|
+
function checkStudioFiles(value, official = false, allowLegacyPreviewCopy = false) {
|
|
36960
|
+
const read5 = inspect(value, official, allowLegacyPreviewCopy);
|
|
36902
36961
|
const first = read5.problems[0];
|
|
36903
36962
|
return first ? { ok: false, ...first, problems: read5.problems } : { ok: true, def: read5.def, files: read5.files };
|
|
36904
36963
|
}
|
|
36905
|
-
function inspect(value, official) {
|
|
36964
|
+
function inspect(value, official, allowLegacyPreviewCopy = false) {
|
|
36906
36965
|
const problems = [];
|
|
36907
36966
|
const fail = (file2, reason, tooLarge = false) => {
|
|
36908
36967
|
problems.push({ file: file2, reason, ...tooLarge ? { tooLarge } : {} });
|
|
@@ -36947,7 +37006,7 @@ function inspect(value, official) {
|
|
|
36947
37006
|
if (files[`skills/${name}/SKILL.md`] === void 0) fail(`skills/${name}/SKILL.md`, "is missing");
|
|
36948
37007
|
}
|
|
36949
37008
|
const source2 = files[STUDIO_FILE];
|
|
36950
|
-
const read5 = typeof source2 === "string" ? parseStudioFile("studio", source2, STUDIO_FILE) : null;
|
|
37009
|
+
const read5 = typeof source2 === "string" ? parseStudioFile("studio", source2, STUDIO_FILE, !official && !allowLegacyPreviewCopy) : null;
|
|
36951
37010
|
if (!read5) fail(STUDIO_FILE, "is missing");
|
|
36952
37011
|
else if ("problem" in read5) for (const problem of read5.problems) problems.push({ ...problem, reason: problem.message });
|
|
36953
37012
|
if (!read5 || "problem" in read5) return { problems };
|
|
@@ -37532,6 +37591,7 @@ function loadGoals() {
|
|
|
37532
37591
|
if (held4.goals !== void 0 && held4.ideas !== void 0 && JSON.stringify(held4.goals) !== JSON.stringify(held4.ideas)) die("goals and ideas do not match.");
|
|
37533
37592
|
const goals = held4.goals ?? held4.ideas;
|
|
37534
37593
|
if (!Array.isArray(goals)) die("The goals array is missing or invalid.");
|
|
37594
|
+
for (const goal of goals) if (goal.review_plan !== void 0) goal.review_plan = readReviewPlan(goal.review_plan);
|
|
37535
37595
|
return { file: file2, held: { ...held4, studios: held4.studios ?? [], goals } };
|
|
37536
37596
|
}
|
|
37537
37597
|
function studioOf(held4, asked) {
|
|
@@ -41157,6 +41217,16 @@ var init_card_studio_backfill = __esm({
|
|
|
41157
41217
|
}
|
|
41158
41218
|
});
|
|
41159
41219
|
|
|
41220
|
+
// src/lib/agent/wire/codex-background-types.ts
|
|
41221
|
+
function idleStopConfirmed(cleanup, session) {
|
|
41222
|
+
return !!session && cleanup?.status === "confirmed" && !!cleanup.instance && Array.isArray(cleanup.kept) && cleanup.kept.length === 0 && cleanup.idleStop?.threadId === session && typeof cleanup.idleStop.turnId === "string" && !!cleanup.idleStop.turnId;
|
|
41223
|
+
}
|
|
41224
|
+
var init_codex_background_types = __esm({
|
|
41225
|
+
"src/lib/agent/wire/codex-background-types.ts"() {
|
|
41226
|
+
"use strict";
|
|
41227
|
+
}
|
|
41228
|
+
});
|
|
41229
|
+
|
|
41160
41230
|
// src/lib/lock.ts
|
|
41161
41231
|
import { randomUUID } from "node:crypto";
|
|
41162
41232
|
import fs18 from "node:fs";
|
|
@@ -41375,17 +41445,17 @@ function planRetry(failure2, attempt2, now = Date.now(), backoff = backoffMs) {
|
|
|
41375
41445
|
if (!Number.isSafeInteger(attempt2) || attempt2 < 1 || failure2.level === 3) return { pause: "needs-review" };
|
|
41376
41446
|
const of = failure2.level === 1 ? 2 : 4;
|
|
41377
41447
|
if (attempt2 >= of) return { pause: "limit" };
|
|
41378
|
-
const
|
|
41379
|
-
const valid =
|
|
41380
|
-
const wait = valid ?
|
|
41448
|
+
const delay3 = failure2.retryAfterMs;
|
|
41449
|
+
const valid = delay3 !== void 0 && !Number.isNaN(delay3) && delay3 >= 0;
|
|
41450
|
+
const wait = valid ? delay3 : failure2.level === 1 ? 0 : backoff(attempt2 + 1);
|
|
41381
41451
|
if (wait > CAP_MS) return { pause: "wait-too-long" };
|
|
41382
41452
|
return { plan: { at: now + wait, of, failure: failure2 } };
|
|
41383
41453
|
}
|
|
41384
41454
|
function readFailure(raw) {
|
|
41385
41455
|
if (!raw || typeof raw !== "object") return;
|
|
41386
|
-
const { code, level: level2, reason, retryAfterMs: retryAfterMs2 } = raw;
|
|
41456
|
+
const { code, level: level2, reason, source: source2, retryAfterMs: retryAfterMs2 } = raw;
|
|
41387
41457
|
if (typeof code !== "string" || !code || typeof reason !== "string" || level2 !== 1 && level2 !== 2 && level2 !== 3) return;
|
|
41388
|
-
return { code, level: level2, reason, ...typeof retryAfterMs2 === "number" && retryAfterMs2 >= 0 ? { retryAfterMs: retryAfterMs2 } : {} };
|
|
41458
|
+
return { code, level: level2, reason, ...["validation", "provider", "harness", "invariant"].some((value) => value === source2) ? { source: source2 } : {}, ...typeof retryAfterMs2 === "number" && retryAfterMs2 >= 0 ? { retryAfterMs: retryAfterMs2 } : {} };
|
|
41389
41459
|
}
|
|
41390
41460
|
function readRetryPlan(raw, attempt2) {
|
|
41391
41461
|
if (!raw || typeof raw !== "object") return;
|
|
@@ -41413,6 +41483,11 @@ function retryLine(plan, attempt2, now = Date.now()) {
|
|
|
41413
41483
|
const seconds = Math.max(0, Math.ceil((plan.at - now) / 1e3));
|
|
41414
41484
|
return `${plan.failure.reason} \u2014 retrying ${seconds ? `in ${seconds}s` : "now"} (attempt ${attempt2 + 1} of ${plan.of}).`;
|
|
41415
41485
|
}
|
|
41486
|
+
function syncRepairPrompt(reason) {
|
|
41487
|
+
return `The Harness could not synchronize the saved result. Correct the diagnostics below, verify the original result and its attachments, then continue from the saved work. Preserve completed work and archive state. Read the task review before changing an approved output and revise its stage first.
|
|
41488
|
+
|
|
41489
|
+
${reason}`;
|
|
41490
|
+
}
|
|
41416
41491
|
var BASE_MS, CAP_MS;
|
|
41417
41492
|
var init_retry = __esm({
|
|
41418
41493
|
"src/lib/agent/retry.ts"() {
|
|
@@ -41740,8 +41815,8 @@ var init_package = __esm({
|
|
|
41740
41815
|
"package.json"() {
|
|
41741
41816
|
package_default = {
|
|
41742
41817
|
name: "wildcrane",
|
|
41743
|
-
version: "0.11.
|
|
41744
|
-
akbContract:
|
|
41818
|
+
version: "0.11.75",
|
|
41819
|
+
akbContract: 22,
|
|
41745
41820
|
description: "WildCrane's `akb` command \u2014 scaffold the Markdown board under docs/kanban/, put an agent on a card, and carry the flows the agent works by.",
|
|
41746
41821
|
keywords: [
|
|
41747
41822
|
"kanban",
|
|
@@ -43502,6 +43577,7 @@ function executionFailure(error62) {
|
|
|
43502
43577
|
return {
|
|
43503
43578
|
code: NETWORK.has(code) ? "connection_lost" : code === "ENOENT" ? "executable_missing" : "execution_failed",
|
|
43504
43579
|
level: NETWORK.has(code) ? 2 : 3,
|
|
43580
|
+
source: "harness",
|
|
43505
43581
|
reason
|
|
43506
43582
|
};
|
|
43507
43583
|
}
|
|
@@ -43519,17 +43595,19 @@ function providerFailure(error62, reason) {
|
|
|
43519
43595
|
const headers = obj2(info.headers);
|
|
43520
43596
|
const wait = retryAfterMs(headers["retry-after"] ?? headers["Retry-After"]);
|
|
43521
43597
|
const code = info.code ?? info.type;
|
|
43522
|
-
if (code === "session_not_found") return { code, level: 3, reason };
|
|
43598
|
+
if (code === "session_not_found") return { code, source: "provider", level: 3, reason };
|
|
43523
43599
|
if (status === 401 || status === 403 || ["authentication_error", "permission_error", "invalid_request_error"].includes(str2(code))) {
|
|
43524
|
-
return { code: "provider_refused", level: 3, reason };
|
|
43600
|
+
return { code: "provider_refused", source: "provider", level: 3, reason };
|
|
43525
43601
|
}
|
|
43526
|
-
if (code === "rate_limit_error") return { code: "rate_limited", level: 2, reason, retryAfterMs: wait };
|
|
43527
|
-
if (TEMPORARY_HTTP.has(status ?? 0) || code === "overloaded_error") return { code: "service_overloaded", level: 2, reason, retryAfterMs: wait };
|
|
43528
|
-
if (NETWORK.has(str2(code))) return { code: "connection_lost", level: 2, reason, retryAfterMs: wait };
|
|
43529
|
-
return { code: "provider_failed", level: 3, reason };
|
|
43602
|
+
if (code === "rate_limit_error") return { code: "rate_limited", source: "provider", level: 2, reason, retryAfterMs: wait };
|
|
43603
|
+
if (TEMPORARY_HTTP.has(status ?? 0) || code === "overloaded_error") return { code: "service_overloaded", source: "provider", level: 2, reason, retryAfterMs: wait };
|
|
43604
|
+
if (NETWORK.has(str2(code))) return { code: "connection_lost", source: "provider", level: 2, reason, retryAfterMs: wait };
|
|
43605
|
+
return { code: "provider_failed", source: "provider", level: 3, reason };
|
|
43530
43606
|
}
|
|
43531
43607
|
function codexFailure(raw, fallback) {
|
|
43532
43608
|
const error62 = obj2(raw);
|
|
43609
|
+
const failure2 = readFailure(error62.wildcraneFailure);
|
|
43610
|
+
if (failure2?.source === "harness" || failure2?.source === "invariant") return failure2;
|
|
43533
43611
|
const reason = str2(error62.message) || fallback;
|
|
43534
43612
|
const info = error62.codexErrorInfo;
|
|
43535
43613
|
if (info === "serverOverloaded") return providerFailure({ ...error62, type: "overloaded_error" }, reason);
|
|
@@ -43547,6 +43625,7 @@ var ExecutionError, NETWORK, TEMPORARY_HTTP;
|
|
|
43547
43625
|
var init_failures = __esm({
|
|
43548
43626
|
"src/lib/agent/wire/failures.ts"() {
|
|
43549
43627
|
"use strict";
|
|
43628
|
+
init_retry();
|
|
43550
43629
|
init_json();
|
|
43551
43630
|
ExecutionError = class extends Error {
|
|
43552
43631
|
constructor(failure2) {
|
|
@@ -43696,7 +43775,7 @@ function createStreamRenderer() {
|
|
|
43696
43775
|
const turnUsage = usageOf2(ev.usage);
|
|
43697
43776
|
if (turnUsage) usage3 = usage3 ? addUsage(usage3, turnUsage) : turnUsage;
|
|
43698
43777
|
failure2 = ev.is_error === true ? whyItFailed(ev) : void 0;
|
|
43699
|
-
classified = failure2 ? ev.subtype === "error_max_structured_output_retries" ? { code: "validation_failed", level: 1, reason: failure2 } : { ...apiFailure ?? providerFailure(ev.error, failure2), reason: failure2 } : void 0;
|
|
43778
|
+
classified = failure2 ? ev.subtype === "error_max_structured_output_retries" ? { code: "validation_failed", level: 1, source: "validation", reason: failure2 } : { ...apiFailure ?? providerFailure(ev.error, failure2), reason: failure2 } : void 0;
|
|
43700
43779
|
apiFailure = void 0;
|
|
43701
43780
|
if (failure2) events.error(failure2);
|
|
43702
43781
|
turns.push({
|
|
@@ -44807,6 +44886,8 @@ async function oneTurn(io, options) {
|
|
|
44807
44886
|
const phase = (phase2) => io.event?.({ kind: "phase", data: { phase: phase2, at: (/* @__PURE__ */ new Date()).toISOString() } });
|
|
44808
44887
|
let started = false;
|
|
44809
44888
|
let contentAt = 0;
|
|
44889
|
+
let thinkingAt = 0;
|
|
44890
|
+
let thinking = false;
|
|
44810
44891
|
let currentSession = "";
|
|
44811
44892
|
const events = createEventCollector();
|
|
44812
44893
|
const emit = () => {
|
|
@@ -44836,7 +44917,20 @@ async function oneTurn(io, options) {
|
|
|
44836
44917
|
}
|
|
44837
44918
|
if (live && (!obj2(msg.params).sessionId || obj2(msg.params).sessionId === currentSession)) {
|
|
44838
44919
|
const kind = str2(obj2(obj2(msg.params).update).sessionUpdate);
|
|
44839
|
-
if (["agent_message_chunk", "agent_thought_chunk"].includes(kind)
|
|
44920
|
+
if (["agent_message_chunk", "agent_thought_chunk"].includes(kind) && str2(obj2(obj2(obj2(msg.params).update).content).text)) {
|
|
44921
|
+
io.activity?.();
|
|
44922
|
+
if (kind === "agent_thought_chunk") {
|
|
44923
|
+
if (!thinking || Date.now() - thinkingAt >= 1e3) {
|
|
44924
|
+
io.event?.({ kind: "status", data: { state: "thinking", source: "acp" } });
|
|
44925
|
+
thinkingAt = Date.now();
|
|
44926
|
+
}
|
|
44927
|
+
thinking = true;
|
|
44928
|
+
}
|
|
44929
|
+
}
|
|
44930
|
+
if (thinking && ["agent_message_chunk", "tool_call", "plan"].includes(kind)) {
|
|
44931
|
+
thinking = false;
|
|
44932
|
+
io.event?.({ kind: "status", data: { state: "running", source: "acp" } });
|
|
44933
|
+
}
|
|
44840
44934
|
if (!started && ["agent_message_chunk", "tool_call", "plan"].includes(kind)) {
|
|
44841
44935
|
started = true;
|
|
44842
44936
|
phase("started");
|
|
@@ -45349,6 +45443,90 @@ var init_zcode = __esm({
|
|
|
45349
45443
|
}
|
|
45350
45444
|
});
|
|
45351
45445
|
|
|
45446
|
+
// src/lib/agent/idle.ts
|
|
45447
|
+
function createIdleWatchdog(expired, busy = () => false, milliseconds = IDLE_TIMEOUT.milliseconds, now = Date.now) {
|
|
45448
|
+
const calls = /* @__PURE__ */ new Set();
|
|
45449
|
+
const local = /* @__PURE__ */ new Set();
|
|
45450
|
+
const seen = /* @__PURE__ */ new Map();
|
|
45451
|
+
let last = now();
|
|
45452
|
+
let working = false;
|
|
45453
|
+
let closed2 = false;
|
|
45454
|
+
let recoveringAt;
|
|
45455
|
+
let retryUntil = 0;
|
|
45456
|
+
const touch = () => {
|
|
45457
|
+
if (!closed2) {
|
|
45458
|
+
last = now();
|
|
45459
|
+
recoveringAt = void 0;
|
|
45460
|
+
retryUntil = 0;
|
|
45461
|
+
}
|
|
45462
|
+
};
|
|
45463
|
+
const check2 = () => {
|
|
45464
|
+
if (closed2) return;
|
|
45465
|
+
if (retryUntil > now()) return;
|
|
45466
|
+
const active3 = calls.size > 0 || busy();
|
|
45467
|
+
if (active3 || working) last = now();
|
|
45468
|
+
working = active3;
|
|
45469
|
+
if (!active3 && now() - last >= milliseconds) {
|
|
45470
|
+
close();
|
|
45471
|
+
expired();
|
|
45472
|
+
}
|
|
45473
|
+
};
|
|
45474
|
+
const timer = setInterval(check2, Math.min(1e3, milliseconds));
|
|
45475
|
+
timer.unref?.();
|
|
45476
|
+
const close = () => {
|
|
45477
|
+
closed2 = true;
|
|
45478
|
+
clearInterval(timer);
|
|
45479
|
+
calls.clear();
|
|
45480
|
+
local.clear();
|
|
45481
|
+
seen.clear();
|
|
45482
|
+
};
|
|
45483
|
+
return {
|
|
45484
|
+
touch,
|
|
45485
|
+
check: check2,
|
|
45486
|
+
close,
|
|
45487
|
+
event(e) {
|
|
45488
|
+
if (closed2) return;
|
|
45489
|
+
if (e.kind === "status") {
|
|
45490
|
+
if (e.data.state !== "retrying") touch();
|
|
45491
|
+
else {
|
|
45492
|
+
recoveringAt ??= now();
|
|
45493
|
+
retryUntil = Math.min(now() + PROVIDER_RETRY_MS.announcement, recoveringAt + PROVIDER_RETRY_MS.episode);
|
|
45494
|
+
}
|
|
45495
|
+
check2();
|
|
45496
|
+
return;
|
|
45497
|
+
}
|
|
45498
|
+
if (e.kind === "log" || e.kind === "context") return;
|
|
45499
|
+
if (e.kind === "phase" && !e.data.contentAt) return;
|
|
45500
|
+
const key = e.kind === "tool_call" || e.kind === "tool_call_update" ? `${e.kind}:${e.data.toolCallId}` : e.kind;
|
|
45501
|
+
const value = JSON.stringify(e.data);
|
|
45502
|
+
if (seen.get(key) === value) return;
|
|
45503
|
+
seen.set(key, value);
|
|
45504
|
+
if (e.kind === "tool_call" && (e.data.kind === "execute" || e.data.subagent)) local.add(e.data.toolCallId);
|
|
45505
|
+
if (e.kind === "tool_call" || e.kind === "tool_call_update") {
|
|
45506
|
+
const { toolCallId, status } = e.data;
|
|
45507
|
+
if (local.has(toolCallId) && ["in_progress", "running"].includes(status)) calls.add(toolCallId);
|
|
45508
|
+
if (["completed", "failed"].includes(status)) {
|
|
45509
|
+
calls.delete(toolCallId);
|
|
45510
|
+
local.delete(toolCallId);
|
|
45511
|
+
}
|
|
45512
|
+
}
|
|
45513
|
+
touch();
|
|
45514
|
+
check2();
|
|
45515
|
+
}
|
|
45516
|
+
};
|
|
45517
|
+
}
|
|
45518
|
+
var IDLE_MS, IDLE_TIMEOUT, IDLE_ERROR, IDLE_FAILURE, PROVIDER_RETRY_MS;
|
|
45519
|
+
var init_idle = __esm({
|
|
45520
|
+
"src/lib/agent/idle.ts"() {
|
|
45521
|
+
"use strict";
|
|
45522
|
+
IDLE_MS = 5 * 6e4;
|
|
45523
|
+
IDLE_TIMEOUT = { milliseconds: IDLE_MS };
|
|
45524
|
+
IDLE_ERROR = "No response for 5 minutes (idle timeout).";
|
|
45525
|
+
IDLE_FAILURE = { code: "idle_timeout", level: 2, reason: IDLE_ERROR };
|
|
45526
|
+
PROVIDER_RETRY_MS = { announcement: 10 * 6e4, episode: 30 * 6e4 };
|
|
45527
|
+
}
|
|
45528
|
+
});
|
|
45529
|
+
|
|
45352
45530
|
// src/guide/settle-background.md
|
|
45353
45531
|
var settle_background_default;
|
|
45354
45532
|
var init_settle_background = __esm({
|
|
@@ -45558,6 +45736,7 @@ var init_codex_work = __esm({
|
|
|
45558
45736
|
|
|
45559
45737
|
// src/lib/agent/wire/codex.ts
|
|
45560
45738
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
45739
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
45561
45740
|
function createCodexConnection(argv) {
|
|
45562
45741
|
const execAt = argv.indexOf("exec");
|
|
45563
45742
|
if (execAt < 1) return void 0;
|
|
@@ -45610,6 +45789,7 @@ function createCodexClient(options = { images: [] }) {
|
|
|
45610
45789
|
return {
|
|
45611
45790
|
structured: true,
|
|
45612
45791
|
managedProcess: true,
|
|
45792
|
+
idleRecovery: true,
|
|
45613
45793
|
background: () => background,
|
|
45614
45794
|
turn: (io) => run(io, options, (count3) => {
|
|
45615
45795
|
background = count3;
|
|
@@ -45619,11 +45799,26 @@ function createCodexClient(options = { images: [] }) {
|
|
|
45619
45799
|
async function run(io, options, count3) {
|
|
45620
45800
|
const since = Date.now();
|
|
45621
45801
|
const renderer = createCodexStreamRenderer();
|
|
45622
|
-
|
|
45802
|
+
let idling = false;
|
|
45803
|
+
let preparingUntil = Math.min(io.prepareUntil ?? Infinity, Date.now() + CONVERSATION_MS.prepare);
|
|
45623
45804
|
const phase = (phase2) => io.event?.({ kind: "phase", data: { phase: phase2, at: (/* @__PURE__ */ new Date()).toISOString() } });
|
|
45624
45805
|
let submitted = false;
|
|
45625
45806
|
let started = false;
|
|
45626
45807
|
let contentAt = 0;
|
|
45808
|
+
let status;
|
|
45809
|
+
let statusAt = 0;
|
|
45810
|
+
const thinking = () => {
|
|
45811
|
+
if (status !== "thinking" || Date.now() - statusAt >= 1e3) {
|
|
45812
|
+
io.event?.({ kind: "status", data: { state: "thinking", source: "codex" } });
|
|
45813
|
+
statusAt = Date.now();
|
|
45814
|
+
}
|
|
45815
|
+
status = "thinking";
|
|
45816
|
+
};
|
|
45817
|
+
const recovered = () => {
|
|
45818
|
+
if (!status) return;
|
|
45819
|
+
io.event?.({ kind: "status", data: { state: "running", source: "codex" } });
|
|
45820
|
+
status = void 0;
|
|
45821
|
+
};
|
|
45627
45822
|
let startupTimer;
|
|
45628
45823
|
const began = () => {
|
|
45629
45824
|
if (!submitted || started || ended) return;
|
|
@@ -45674,11 +45869,12 @@ async function run(io, options, count3) {
|
|
|
45674
45869
|
clearTimeout(startupTimer);
|
|
45675
45870
|
clearTimeout(settleTimer);
|
|
45676
45871
|
io.signal?.removeEventListener("abort", cancelled);
|
|
45872
|
+
io.idleSignal?.removeEventListener("abort", idle);
|
|
45677
45873
|
count3(0);
|
|
45678
45874
|
io.stdout.off("close", closed2);
|
|
45679
45875
|
io.stdin.off("error", inputFailed);
|
|
45680
45876
|
if (settlement) flushMessages(work.work().some((w) => !w.intentionalStop && !["running", "unknown"].includes(w.status) && presented.get(w.id) !== snapshot2(w)));
|
|
45681
|
-
cleanup.items = work.work().map(({ id: id2, threadId: threadId2, processId, status, disposition }) => ({ id: id2, threadId: threadId2, processId, status, disposition }));
|
|
45877
|
+
cleanup.items = work.work().map(({ id: id2, threadId: threadId2, processId, status: status2, disposition }) => ({ id: id2, threadId: threadId2, processId, status: status2, disposition }));
|
|
45682
45878
|
io.log(renderer.flush());
|
|
45683
45879
|
const usage3 = ownUsage(total, baseline);
|
|
45684
45880
|
const child = childSpend(children, since);
|
|
@@ -45708,10 +45904,32 @@ async function run(io, options, count3) {
|
|
|
45708
45904
|
};
|
|
45709
45905
|
const cancelled = () => {
|
|
45710
45906
|
work.freeze();
|
|
45711
|
-
note("Execution stopped; no further cleanup turn was submitted.");
|
|
45907
|
+
if (submitted || threadId) note("Execution stopped; no further cleanup turn was submitted.");
|
|
45712
45908
|
end2("Codex execution stopped.");
|
|
45713
45909
|
};
|
|
45714
45910
|
io.signal?.addEventListener("abort", cancelled, { once: true });
|
|
45911
|
+
const idle = async () => {
|
|
45912
|
+
if (ended || idling) return;
|
|
45913
|
+
idling = true;
|
|
45914
|
+
const unknownWork = () => [...work.entries.values()].some((item2) => ["running", "unknown", "interrupted"].includes(item2.status));
|
|
45915
|
+
const uncertain = unknownWork();
|
|
45916
|
+
const ownedTurn = currentTurn2;
|
|
45917
|
+
try {
|
|
45918
|
+
if (host2.idleRecovery !== true || !threadId || !ownedTurn || !active3 || settlement) throw Error("Codex did not confirm that this turn can be interrupted for recovery.");
|
|
45919
|
+
const receipt = await bounded(
|
|
45920
|
+
rpc.call("wildcrane/stopForRetry", { threadId, turnId: ownedTurn, instance: host2.instance, lease: host2.lease }),
|
|
45921
|
+
CONVERSATION_MS.prepare,
|
|
45922
|
+
"Codex did not confirm stopping the idle turn."
|
|
45923
|
+
);
|
|
45924
|
+
if (receipt.instance !== host2.instance || receipt.lease !== host2.lease || receipt.threadId !== threadId || receipt.turnId !== ownedTurn) throw Error("Codex returned a different turn or owner.");
|
|
45925
|
+
if (uncertain || unknownWork()) throw Error("Codex has operations with unconfirmed results.");
|
|
45926
|
+
cleanup.idleStop = { threadId, turnId: ownedTurn };
|
|
45927
|
+
} catch (error62) {
|
|
45928
|
+
if (!ended) note(error62 instanceof Error ? error62.message : String(error62));
|
|
45929
|
+
}
|
|
45930
|
+
if (!ended) end2(IDLE_FAILURE.reason, IDLE_FAILURE);
|
|
45931
|
+
};
|
|
45932
|
+
io.idleSignal?.addEventListener("abort", idle, { once: true });
|
|
45715
45933
|
const childUpdates = () => {
|
|
45716
45934
|
for (const w of work.entries.values()) {
|
|
45717
45935
|
if (w.kind !== "agent" || childEvents.get(w.id) === w.status) continue;
|
|
@@ -45925,9 +46143,13 @@ async function run(io, options, count3) {
|
|
|
45925
46143
|
childUpdates();
|
|
45926
46144
|
return;
|
|
45927
46145
|
}
|
|
45928
|
-
if (submitted && /\/delta$/.test(msg.method ?? "") && str2(p.delta)) io.activity?.();
|
|
45929
46146
|
const turnId = str2(p.turnId) || str2(obj2(p.turn).id);
|
|
45930
46147
|
if (historicalTurns.has(turnId) || currentTurn2 && turnId && currentTurn2 !== turnId) return;
|
|
46148
|
+
if (submitted && ["item/agentMessage/delta", "item/plan/delta", "item/reasoning/summaryTextDelta", "item/reasoning/textDelta"].includes(msg.method ?? "") && str2(p.delta)) {
|
|
46149
|
+
if (msg.method?.startsWith("item/reasoning/")) thinking();
|
|
46150
|
+
else recovered();
|
|
46151
|
+
io.activity?.();
|
|
46152
|
+
}
|
|
45931
46153
|
if (msg.method === "turn/started") {
|
|
45932
46154
|
if (!submitted || completedTurns.has(turnId)) return;
|
|
45933
46155
|
currentTurn2 = turnId;
|
|
@@ -45940,7 +46162,10 @@ async function run(io, options, count3) {
|
|
|
45940
46162
|
contentAt = Date.now();
|
|
45941
46163
|
io.event?.({ kind: "phase", data: { phase: "started", at: (/* @__PURE__ */ new Date()).toISOString(), contentAt: new Date(contentAt).toISOString() } });
|
|
45942
46164
|
}
|
|
45943
|
-
if (msg.method === "item/started" || msg.method === "item/completed")
|
|
46165
|
+
if (msg.method === "item/started" || msg.method === "item/completed") {
|
|
46166
|
+
recovered();
|
|
46167
|
+
item(obj2(p.item), msg.method === "item/completed", !completedTurns.has(turnId));
|
|
46168
|
+
}
|
|
45944
46169
|
if (msg.method === "thread/tokenUsage/updated") {
|
|
45945
46170
|
if (!submitted) return;
|
|
45946
46171
|
const token2 = obj2(p.tokenUsage);
|
|
@@ -45958,9 +46183,14 @@ async function run(io, options, count3) {
|
|
|
45958
46183
|
context = { used: (Number(last.inputTokens) || 0) + (Number(last.outputTokens) || 0), ...Number(token2.modelContextWindow) > 0 ? { limit: Number(token2.modelContextWindow) } : {} };
|
|
45959
46184
|
io.gotContext?.(context);
|
|
45960
46185
|
}
|
|
45961
|
-
if (msg.method === "error"
|
|
46186
|
+
if (msg.method === "error") {
|
|
45962
46187
|
const failure2 = codexFailure(p.error, "Codex failed.");
|
|
45963
|
-
|
|
46188
|
+
if (p.willRetry === true && submitted && active3 && !idling) {
|
|
46189
|
+
status = "retrying";
|
|
46190
|
+
io.log(`[Codex recovery] ${failure2.code}: ${failure2.reason}
|
|
46191
|
+
`);
|
|
46192
|
+
io.event?.({ kind: "status", data: { state: "retrying", source: "codex", code: failure2.code } });
|
|
46193
|
+
} else if (p.willRetry !== true) end2(failure2.reason, failure2);
|
|
45964
46194
|
}
|
|
45965
46195
|
if (msg.method === "turn/completed") {
|
|
45966
46196
|
const turn2 = obj2(p.turn);
|
|
@@ -45971,6 +46201,7 @@ async function run(io, options, count3) {
|
|
|
45971
46201
|
work.observe(threadId, raw);
|
|
45972
46202
|
item(raw, true);
|
|
45973
46203
|
}
|
|
46204
|
+
if (idling) return;
|
|
45974
46205
|
if (turn2.status !== "completed") {
|
|
45975
46206
|
const reason = str2(obj2(turn2.error).message) || `Codex turn ${str2(turn2.status)}.`;
|
|
45976
46207
|
const failure2 = turn2.status === "failed" ? codexFailure(turn2.error, reason) : { code: "turn_stopped", level: 3, reason };
|
|
@@ -45991,6 +46222,10 @@ async function run(io, options, count3) {
|
|
|
45991
46222
|
cancelled();
|
|
45992
46223
|
return done;
|
|
45993
46224
|
}
|
|
46225
|
+
if (io.idleSignal?.aborted) {
|
|
46226
|
+
void idle();
|
|
46227
|
+
return done;
|
|
46228
|
+
}
|
|
45994
46229
|
phase("preparing");
|
|
45995
46230
|
const initialized = await bounded(rpc.call("initialize", { clientInfo: { name: "wildcrane", version: "1" }, capabilities: { experimentalApi: true } }), preparingUntil - Date.now(), "Codex initialize timed out.");
|
|
45996
46231
|
host2 = obj2(initialized.wildcrane);
|
|
@@ -45998,11 +46233,31 @@ async function run(io, options, count3) {
|
|
|
45998
46233
|
phase("initialized");
|
|
45999
46234
|
rpc.notify("initialized");
|
|
46000
46235
|
const mode = options.mode ?? (io.resumeId ? "resume" : void 0);
|
|
46001
|
-
const
|
|
46236
|
+
const method = `thread/${mode ?? "start"}`;
|
|
46237
|
+
const params = { cwd: options.cwd ?? io.cwd, ...mode ? { threadId: options.threadId ?? io.resumeId } : {} };
|
|
46238
|
+
let response;
|
|
46239
|
+
let waiting = false;
|
|
46240
|
+
while (!ended && !response) {
|
|
46241
|
+
try {
|
|
46242
|
+
response = await bounded(rpc.call(method, params), preparingUntil - Date.now(), `Codex ${method} timed out.`);
|
|
46243
|
+
} catch (error62) {
|
|
46244
|
+
const failure2 = error62 instanceof RpcError ? codexFailure(error62.data, error62.message) : void 0;
|
|
46245
|
+
if (mode !== "fork" || failure2?.source !== "harness" || failure2.code !== "codex_source_busy") throw error62;
|
|
46246
|
+
if (!waiting) {
|
|
46247
|
+
waiting = true;
|
|
46248
|
+
io.event?.({ kind: "log", data: { text: failure2.reason } });
|
|
46249
|
+
}
|
|
46250
|
+
io.activity?.();
|
|
46251
|
+
await delay(500, void 0, { signal: io.signal });
|
|
46252
|
+
preparingUntil = Date.now() + CONVERSATION_MS.prepare;
|
|
46253
|
+
}
|
|
46254
|
+
}
|
|
46255
|
+
if (ended || !response) return done;
|
|
46002
46256
|
const thread = obj2(response.thread);
|
|
46003
46257
|
for (const turn2 of list2(thread.turns)) historicalTurns.add(str2(turn2.id));
|
|
46004
46258
|
threadId = str2(thread.id);
|
|
46005
46259
|
if (!threadId) throw Error("Codex did not return a thread id.");
|
|
46260
|
+
if (mode === "resume" && threadId !== params.threadId) throw Error("Codex did not return the requested session.");
|
|
46006
46261
|
work.root(threadId, list2(response.retainedThreads).map((t) => str2(t.id)));
|
|
46007
46262
|
for (const terminal of list2(response.retainedTerminals)) retained.set(`terminal:${str2(terminal.threadId)}:${str2(terminal.itemId)}`, str2(terminal.processId));
|
|
46008
46263
|
provider = str2(thread.modelProvider) || void 0;
|
|
@@ -46024,6 +46279,7 @@ var list2;
|
|
|
46024
46279
|
var init_codex = __esm({
|
|
46025
46280
|
"src/lib/agent/wire/codex.ts"() {
|
|
46026
46281
|
"use strict";
|
|
46282
|
+
init_idle();
|
|
46027
46283
|
init_failures();
|
|
46028
46284
|
init_conversation();
|
|
46029
46285
|
init_codex_background();
|
|
@@ -52160,7 +52416,10 @@ async function openResume(id2, options) {
|
|
|
52160
52416
|
if (pending) {
|
|
52161
52417
|
const root2 = prev.agentPid ? { pid: prev.agentPid, since: prev.agentStartedAt ?? prev.startedAt, identity: prev.agentIdentity } : void 0;
|
|
52162
52418
|
const stopped2 = prev.managedProcess ? connectionStopped(root2) : processesStopped(runMark(prev.sessionId, prev.agentStartedAt), root2);
|
|
52163
|
-
|
|
52419
|
+
const session2 = resumeSessionId(prev);
|
|
52420
|
+
if (!stopped2 || !session2 || prev.managedProcess && pending.failure.code === "idle_timeout" && !idleStopConfirmed(prev.cleanup, session2)) {
|
|
52421
|
+
return retryRefusal(prev, "unsafe");
|
|
52422
|
+
}
|
|
52164
52423
|
await new Promise((resolve2) => setTimeout(resolve2, Math.max(0, pending.at - Date.now())));
|
|
52165
52424
|
if (!await executionHeld(executionOf())) return retryRefusal(prev, "authorization");
|
|
52166
52425
|
}
|
|
@@ -52540,6 +52799,7 @@ var INDEX_ACTIONS, SINGLETON_ACTIONS, VERB, SINGLETON_BUSY, RUN_STATUS, specPath
|
|
|
52540
52799
|
var init_sessions = __esm({
|
|
52541
52800
|
"src/lib/agent/sessions.ts"() {
|
|
52542
52801
|
"use strict";
|
|
52802
|
+
init_codex_background_types();
|
|
52543
52803
|
init_connection_process();
|
|
52544
52804
|
init_retry();
|
|
52545
52805
|
init_execution();
|
|
@@ -52838,8 +53098,8 @@ var init_inbox = __esm({
|
|
|
52838
53098
|
META_LINE = /^\s+("(?:[^"\\]|\\.)*"|[^:]+):\s*(.*)$/;
|
|
52839
53099
|
slugOf = (said2) => said2.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 56).replace(/-+$/, "");
|
|
52840
53100
|
fileName = (title, slug = "") => `${slugOf(slug) || slugOf(title) || "item"}.md`;
|
|
52841
|
-
readArchived = () => readFolder(
|
|
52842
|
-
readAllDismissed = () => readFolder(
|
|
53101
|
+
readArchived = (dir = SIGNALS_ARCHIVED) => readFolder(dir);
|
|
53102
|
+
readAllDismissed = (dir = SIGNALS_DISMISSED) => readFolder(dir, true);
|
|
52843
53103
|
}
|
|
52844
53104
|
});
|
|
52845
53105
|
|
|
@@ -55472,7 +55732,7 @@ function cmdValidate(id2) {
|
|
|
55472
55732
|
const reason = errors.length ? formatContractErrors(errors) : void 0;
|
|
55473
55733
|
const session = insideRun();
|
|
55474
55734
|
if (session) patch(session, (run3) => {
|
|
55475
|
-
run3.validationFailure = reason ? { code: "validation_failed", level: 1, reason } : void 0;
|
|
55735
|
+
run3.validationFailure = reason ? { code: "validation_failed", level: 1, source: "validation", reason } : void 0;
|
|
55476
55736
|
});
|
|
55477
55737
|
if (reason) die(reason, { kind: "spec-contract", errors });
|
|
55478
55738
|
say(`Spec format valid (${cards.length} card${cards.length === 1 ? "" : "s"}).`);
|
|
@@ -61502,7 +61762,7 @@ var init_reply_log = __esm({
|
|
|
61502
61762
|
});
|
|
61503
61763
|
|
|
61504
61764
|
// src/commands/task-chat.ts
|
|
61505
|
-
import { setTimeout as
|
|
61765
|
+
import { setTimeout as delay2 } from "node:timers/promises";
|
|
61506
61766
|
function validateChatOptions(message, opts) {
|
|
61507
61767
|
if (opts.limit !== void 0 && opts.all || message.length && (opts.limit !== void 0 || opts.all || opts.follow || opts.stop) || opts.stop && (opts.limit !== void 0 || opts.all || opts.follow)) {
|
|
61508
61768
|
throw new BoardError("Use a message, history options [--limit <n> | --all] [--follow], or --stop separately.", { kind: "bad-args" });
|
|
@@ -61638,7 +61898,7 @@ async function taskChatFollow(id2, opts) {
|
|
|
61638
61898
|
if (!active2(reply)) {
|
|
61639
61899
|
break;
|
|
61640
61900
|
}
|
|
61641
|
-
await
|
|
61901
|
+
await delay2(1e3, void 0, { signal: controller.signal });
|
|
61642
61902
|
}
|
|
61643
61903
|
} else {
|
|
61644
61904
|
body = first.chat.messages.at(-1)?.role === "agent" ? first.chat.messages.at(-1).body : null;
|
|
@@ -61736,7 +61996,7 @@ var init_describe_project = __esm({
|
|
|
61736
61996
|
var discuss_goal_default;
|
|
61737
61997
|
var init_discuss_goal = __esm({
|
|
61738
61998
|
"src/guide/discuss-goal.md"() {
|
|
61739
|
-
discuss_goal_default = "# Discuss a goal\n\nExplain feasible options and key tradeoffs, then save the result the user can choose to start.\n\n- **Investigations**: finish checks and diagnosis here; save a change only when findings establish it. Report unverified work plainly.\n- **Goals**: save independent deliverables separately with a title, outcome (at most 150 words), and verifiable `## Done when` criteria. Update existing goals rather than duplicate them.\n- **Studio**: choose the fitting installed Studio, preferring the user's choice; read its Additional Notes with `akb studio rule <studio>` and honor their scope. Its Preview IDs name outputs, not agents.\n- **Review**: before saving a Goal, choose the human review points and save them with the Goal using `--review-file <json>` (`{id,
|
|
61999
|
+
discuss_goal_default = "# Discuss a goal\n\nExplain feasible options and key tradeoffs, then save the result the user can choose to start.\n\n- **Investigations**: finish checks and diagnosis here; save a change only when findings establish it. Report unverified work plainly.\n- **Goals**: save independent deliverables separately with a title, outcome (at most 150 words), and verifiable `## Done when` criteria. Update existing goals rather than duplicate them.\n- **Studio**: choose the fitting installed Studio, preferring the user's choice; read its Additional Notes with `akb studio rule <studio>` and honor their scope. Its Preview IDs name outputs, not agents.\n- **Review**: before saving a Goal, choose the human review points and save them with the Goal using `--review-file <json>` (`{id,after?,previews?}`). Use the Studio\u2019s Preview IDs, stable node IDs and `after` for dependencies. Require approval only where downstream work needs it.\n- **Review state**: save `[]` when no extra review is needed and `null` only while a decision is missing. Keep the saved arrangement when editing other details.\n- **Decisions**: explain the proposed outcome and review arrangement before saving. Ask only for choices the user must make, with a recommendation.\n- **Start**: the user starts each Goal from the page; starting accepts its arrangement, never skips its review gates. Changing the arrangement after starting requires plan confirmation.\n- **Communication**: the remote user sees tasks and previews. Use plain words and button labels, omitting internal paths, commands and tools.\n";
|
|
61740
62000
|
}
|
|
61741
62001
|
});
|
|
61742
62002
|
|
|
@@ -62588,7 +62848,8 @@ var init_memory_review = __esm({
|
|
|
62588
62848
|
import fs77 from "node:fs";
|
|
62589
62849
|
import path78 from "node:path";
|
|
62590
62850
|
function rejectionsToReview() {
|
|
62591
|
-
const
|
|
62851
|
+
const scratch = process.env.AI4KANBAN_REJECTION_INPUT;
|
|
62852
|
+
const dir = path78.join(scratch ? path78.join(scratch, ".archive") : ARCHIVE, REJECTIONS_TO_REVIEW);
|
|
62592
62853
|
if (!fs77.existsSync(dir)) return [];
|
|
62593
62854
|
const found2 = [];
|
|
62594
62855
|
for (const file2 of walkMd(dir)) {
|
|
@@ -62605,7 +62866,7 @@ function rejectionsToReview() {
|
|
|
62605
62866
|
return found2.sort((a, b) => a.rejectedAt.localeCompare(b.rejectedAt) || a.id - b.id);
|
|
62606
62867
|
}
|
|
62607
62868
|
function dismissalsToReview() {
|
|
62608
|
-
return
|
|
62869
|
+
return reviewDismissed().filter((s) => s.dismissedBy === "user" && s.dismissedReason.trim()).sort((a, b) => a.dismissedAt.localeCompare(b.dismissedAt)).map((s) => ({
|
|
62609
62870
|
sourceId: s.sourceId,
|
|
62610
62871
|
title: s.title,
|
|
62611
62872
|
file: s.relPath,
|
|
@@ -62631,11 +62892,12 @@ function withdrawnSources() {
|
|
|
62631
62892
|
}
|
|
62632
62893
|
}))];
|
|
62633
62894
|
if (cited.length === 0) return [];
|
|
62634
|
-
const
|
|
62635
|
-
const
|
|
62895
|
+
const scratch = process.env.AI4KANBAN_REJECTION_INPUT;
|
|
62896
|
+
const dismissed = new Set(reviewDismissed().map((s) => s.sourceId));
|
|
62897
|
+
const restored = new Set([...readInbox(), ...readArchived(scratch ? path78.join(scratch, "triage", "archived") : void 0)].map((s) => s.sourceId));
|
|
62636
62898
|
return cited.filter((id2) => restored.has(id2) && !dismissed.has(id2));
|
|
62637
62899
|
}
|
|
62638
|
-
var SOURCES;
|
|
62900
|
+
var reviewDismissed, SOURCES;
|
|
62639
62901
|
var init_dismissal_review = __esm({
|
|
62640
62902
|
"src/lib/agent/dismissal-review.ts"() {
|
|
62641
62903
|
"use strict";
|
|
@@ -62645,6 +62907,10 @@ var init_dismissal_review = __esm({
|
|
|
62645
62907
|
init_paths();
|
|
62646
62908
|
init_inbox();
|
|
62647
62909
|
init_archive();
|
|
62910
|
+
reviewDismissed = () => {
|
|
62911
|
+
const scratch = process.env.AI4KANBAN_REJECTION_INPUT;
|
|
62912
|
+
return readAllDismissed(scratch ? path78.join(scratch, "triage", "dismissed") : void 0);
|
|
62913
|
+
};
|
|
62648
62914
|
SOURCES = /\(([^()]+)\)\s*$/;
|
|
62649
62915
|
}
|
|
62650
62916
|
});
|
|
@@ -63215,18 +63481,15 @@ function refinementStep(card) {
|
|
|
63215
63481
|
function refinementRequest(req) {
|
|
63216
63482
|
const card = req.id === void 0 ? null : currentCard(req.id);
|
|
63217
63483
|
if (!card) return { error: `task #${req.id} does not exist` };
|
|
63218
|
-
const context =
|
|
63219
|
-
const
|
|
63220
|
-
|
|
63221
|
-
const authorized = review && !review.pending_plan && (review.plan === null || review.stages.some((s) => ["available", "running"].includes(s.status) && (!assigned || assigned.includes(s.id))));
|
|
63222
|
-
const step = review ? authorized && !card.questions.some((q) => q.options?.length) ? "clarify" : "done" : refinementStep(card);
|
|
63223
|
-
if (step === "done") {
|
|
63484
|
+
const context = taskReviewContext();
|
|
63485
|
+
const canStart = context ? reviewAllows(reviewAuthorization(context.review, context.assigned), "refine") && !card.questions.some((q) => q.options?.length) : refinementStep(card) === "clarify";
|
|
63486
|
+
if (!canStart) {
|
|
63224
63487
|
const waiting = card.questions.length > 0 && canRefine({ ...card, questions: [] });
|
|
63225
63488
|
return {
|
|
63226
63489
|
error: waiting ? `#${card.id} is waiting for the user to answer its open questions, so there is nothing to refine yet \u2014 the board refines it on its own once they are answered.` : `a refine would not move #${card.id}`
|
|
63227
63490
|
};
|
|
63228
63491
|
}
|
|
63229
|
-
return { action:
|
|
63492
|
+
return { action: "clarify", id: card.id, title: card.title, notes: req.notes, refineRound: 1, ...req.carry ? { carry: req.carry } : {} };
|
|
63230
63493
|
}
|
|
63231
63494
|
async function startRefinement(req) {
|
|
63232
63495
|
const next = refinementRequest(req);
|
|
@@ -63292,6 +63555,8 @@ var init_refine2 = __esm({
|
|
|
63292
63555
|
"use strict";
|
|
63293
63556
|
init_read();
|
|
63294
63557
|
init_rules();
|
|
63558
|
+
init_review_plan();
|
|
63559
|
+
init_env();
|
|
63295
63560
|
init_start();
|
|
63296
63561
|
init_stage_end();
|
|
63297
63562
|
init_stages();
|
|
@@ -63405,72 +63670,6 @@ var init_propose = __esm({
|
|
|
63405
63670
|
}
|
|
63406
63671
|
});
|
|
63407
63672
|
|
|
63408
|
-
// src/lib/agent/idle.ts
|
|
63409
|
-
function createIdleWatchdog(expired, busy = () => false, milliseconds = IDLE_TIMEOUT.milliseconds, now = Date.now) {
|
|
63410
|
-
const calls = /* @__PURE__ */ new Set();
|
|
63411
|
-
const local = /* @__PURE__ */ new Set();
|
|
63412
|
-
const seen = /* @__PURE__ */ new Map();
|
|
63413
|
-
let last = now();
|
|
63414
|
-
let working = false;
|
|
63415
|
-
let closed2 = false;
|
|
63416
|
-
const touch = () => {
|
|
63417
|
-
if (!closed2) last = now();
|
|
63418
|
-
};
|
|
63419
|
-
const check2 = () => {
|
|
63420
|
-
if (closed2) return;
|
|
63421
|
-
const active3 = calls.size > 0 || busy();
|
|
63422
|
-
if (active3 || working) last = now();
|
|
63423
|
-
working = active3;
|
|
63424
|
-
if (!active3 && now() - last >= milliseconds) {
|
|
63425
|
-
close();
|
|
63426
|
-
expired();
|
|
63427
|
-
}
|
|
63428
|
-
};
|
|
63429
|
-
const timer = setInterval(check2, Math.min(1e3, milliseconds));
|
|
63430
|
-
timer.unref?.();
|
|
63431
|
-
const close = () => {
|
|
63432
|
-
closed2 = true;
|
|
63433
|
-
clearInterval(timer);
|
|
63434
|
-
calls.clear();
|
|
63435
|
-
local.clear();
|
|
63436
|
-
seen.clear();
|
|
63437
|
-
};
|
|
63438
|
-
return {
|
|
63439
|
-
touch,
|
|
63440
|
-
check: check2,
|
|
63441
|
-
close,
|
|
63442
|
-
event(e) {
|
|
63443
|
-
if (closed2 || e.kind === "log" || e.kind === "context") return;
|
|
63444
|
-
if (e.kind === "phase" && !e.data.contentAt) return;
|
|
63445
|
-
const key = e.kind === "tool_call" || e.kind === "tool_call_update" ? `${e.kind}:${e.data.toolCallId}` : e.kind;
|
|
63446
|
-
const value = JSON.stringify(e.data);
|
|
63447
|
-
if (seen.get(key) === value) return;
|
|
63448
|
-
seen.set(key, value);
|
|
63449
|
-
if (e.kind === "tool_call" && (e.data.kind === "execute" || e.data.subagent)) local.add(e.data.toolCallId);
|
|
63450
|
-
if (e.kind === "tool_call" || e.kind === "tool_call_update") {
|
|
63451
|
-
const { toolCallId, status } = e.data;
|
|
63452
|
-
if (local.has(toolCallId) && ["in_progress", "running"].includes(status)) calls.add(toolCallId);
|
|
63453
|
-
if (["completed", "failed"].includes(status)) {
|
|
63454
|
-
calls.delete(toolCallId);
|
|
63455
|
-
local.delete(toolCallId);
|
|
63456
|
-
}
|
|
63457
|
-
}
|
|
63458
|
-
touch();
|
|
63459
|
-
check2();
|
|
63460
|
-
}
|
|
63461
|
-
};
|
|
63462
|
-
}
|
|
63463
|
-
var IDLE_MS, IDLE_TIMEOUT, IDLE_ERROR, IDLE_FAILURE;
|
|
63464
|
-
var init_idle = __esm({
|
|
63465
|
-
"src/lib/agent/idle.ts"() {
|
|
63466
|
-
"use strict";
|
|
63467
|
-
IDLE_MS = 5 * 6e4;
|
|
63468
|
-
IDLE_TIMEOUT = { milliseconds: IDLE_MS };
|
|
63469
|
-
IDLE_ERROR = "No response for 5 minutes (idle timeout).";
|
|
63470
|
-
IDLE_FAILURE = { code: "idle_timeout", level: 2, reason: IDLE_ERROR };
|
|
63471
|
-
}
|
|
63472
|
-
});
|
|
63473
|
-
|
|
63474
63673
|
// src/lib/agent/watch.ts
|
|
63475
63674
|
var watch_exports = {};
|
|
63476
63675
|
__export(watch_exports, {
|
|
@@ -63478,7 +63677,7 @@ __export(watch_exports, {
|
|
|
63478
63677
|
});
|
|
63479
63678
|
import { spawn as spawn3 } from "node:child_process";
|
|
63480
63679
|
import fs79 from "node:fs";
|
|
63481
|
-
async function watchRun(sessionId, resume = startResume) {
|
|
63680
|
+
async function watchRun(sessionId, resume = startResume, retryBackoff = backoffMs) {
|
|
63482
63681
|
const spec = readSpec(sessionId);
|
|
63483
63682
|
const run3 = peekRun(sessionId);
|
|
63484
63683
|
if (!run3 || !spec) {
|
|
@@ -63547,8 +63746,9 @@ async function watchRun(sessionId, resume = startResume) {
|
|
|
63547
63746
|
`);
|
|
63548
63747
|
const basePrompt = record2.resumedFrom ? spec.prompt || resumePrompt(record2.deliveryId, record2.action) : spec.prompt;
|
|
63549
63748
|
const recoveryPrompt = record2.harness === "antigravity" && record2.resumedFrom ? "First verify existing progress and operation results. Preserve user decisions and completed work; do not repeat completed operations. Check actual state before continuing any operation whose result is uncertain." : "";
|
|
63550
|
-
const
|
|
63551
|
-
const
|
|
63749
|
+
const reviewContext = taskReviewContext();
|
|
63750
|
+
const boundary = reviewContext ? reviewBoundary(reviewContext.review, reviewContext.assigned) : "";
|
|
63751
|
+
const prompt = [process.env.AI4KANBAN_SYNC_DIAGNOSTIC ? syncRepairPrompt(process.env.AI4KANBAN_SYNC_DIAGNOSTIC) : "", record2.retry ? `Previous execution failed: ${record2.retry.reason}. Check existing results before continuing; do not repeat completed operations.` : "", conflictPrompt(KANBAN), boundary, basePrompt, recoveryPrompt, discardedCardsPrompt(record2.discardedCards)].filter(Boolean).join("\n\n");
|
|
63552
63752
|
const before = markBoard();
|
|
63553
63753
|
const takes = active3.images;
|
|
63554
63754
|
active3.renderer?.setRequiredImages?.(record2.pictures ?? []);
|
|
@@ -63716,6 +63916,7 @@ async function watchRun(sessionId, resume = startResume) {
|
|
|
63716
63916
|
let done = false;
|
|
63717
63917
|
let spoken;
|
|
63718
63918
|
let silent = false;
|
|
63919
|
+
let uncertainAtIdle = false;
|
|
63719
63920
|
let watchdog;
|
|
63720
63921
|
let wakeUp;
|
|
63721
63922
|
const sleep4 = (ms) => new Promise((wake) => {
|
|
@@ -63768,9 +63969,9 @@ async function watchRun(sessionId, resume = startResume) {
|
|
|
63768
63969
|
let retrying = false;
|
|
63769
63970
|
if (failure2 && !sub && !taskCompleted) {
|
|
63770
63971
|
const attempt2 = held4.retry?.attempt ?? 1;
|
|
63771
|
-
const decision = planRetry(failure2, attempt2);
|
|
63972
|
+
const decision = planRetry(failure2, attempt2, Date.now(), retryBackoff);
|
|
63772
63973
|
if ("pause" in decision) retryPause = decision.pause;
|
|
63773
|
-
else if (blocker || pendingOperations.size || !structured || !resumeSessionId(held4) || spoken?.cleanup?.status === "unconfirmed" || client?.managedProcess && silent) retryPause = "unsafe";
|
|
63974
|
+
else if (blocker || pendingOperations.size || !structured || !resumeSessionId(held4) || spoken?.cleanup?.status === "unconfirmed" || client?.managedProcess && silent && (uncertainAtIdle || !idleStopConfirmed(spoken?.cleanup, resumeSessionId(held4)))) retryPause = "unsafe";
|
|
63774
63975
|
else {
|
|
63775
63976
|
const mark = runMark(sessionId, agentStartedAt);
|
|
63776
63977
|
const root2 = child.pid ? { pid: child.pid, since: agentStartedAt, identity: held4.agentIdentity } : void 0;
|
|
@@ -63795,7 +63996,7 @@ async function watchRun(sessionId, resume = startResume) {
|
|
|
63795
63996
|
}
|
|
63796
63997
|
asked ||= stoppedByUser();
|
|
63797
63998
|
retrying &&= !asked;
|
|
63798
|
-
const error62 = asked ? void 0 : joinNotes(said2 ?? failure2?.reason, retryPause ? pauseLine(retryPause) : void 0);
|
|
63999
|
+
const error62 = asked ? void 0 : joinNotes(said2 ?? failure2?.reason, retryPause && failure2?.source !== "invariant" ? pauseLine(retryPause) : void 0);
|
|
63799
64000
|
const status = asked ? "stopped" : failed2 || code !== 0 ? "error" : "done";
|
|
63800
64001
|
const reported = spoken ? spoken.costUsd : renderer?.costUsd?.();
|
|
63801
64002
|
const totals = reportsSessionTotal(record2.harness);
|
|
@@ -63844,7 +64045,7 @@ ${result}
|
|
|
63844
64045
|
errorWhy,
|
|
63845
64046
|
endedAt
|
|
63846
64047
|
});
|
|
63847
|
-
|
|
64048
|
+
finishWatch(status === "done" ? 0 : 1);
|
|
63848
64049
|
return;
|
|
63849
64050
|
}
|
|
63850
64051
|
await closeRun(sessionId, {
|
|
@@ -63875,7 +64076,7 @@ ${result}
|
|
|
63875
64076
|
}
|
|
63876
64077
|
if (status === "done") queueCompleted(before.keys());
|
|
63877
64078
|
if (status === "done") await followUp(sessionId, record2.flowId, settled?.runs ?? []);
|
|
63878
|
-
|
|
64079
|
+
finishWatch(status === "done" ? 0 : 1);
|
|
63879
64080
|
};
|
|
63880
64081
|
let ending = false;
|
|
63881
64082
|
const endChild = () => {
|
|
@@ -63895,6 +64096,7 @@ ${result}
|
|
|
63895
64096
|
const giveUp = (asked) => {
|
|
63896
64097
|
endChild();
|
|
63897
64098
|
after(STOP_GRACE_MS + STOP_CLOSE_MS, () => {
|
|
64099
|
+
if (done) return;
|
|
63898
64100
|
after(STOP_FINISH_MS, () => process.exit(0));
|
|
63899
64101
|
void finish(null, asked).finally(() => process.exit(0));
|
|
63900
64102
|
});
|
|
@@ -63904,6 +64106,7 @@ ${result}
|
|
|
63904
64106
|
giveUp(false);
|
|
63905
64107
|
};
|
|
63906
64108
|
const cancellation = new AbortController();
|
|
64109
|
+
const idle = new AbortController();
|
|
63907
64110
|
let stopped2 = false;
|
|
63908
64111
|
const stoppedByUser = () => stopped2 || peekRun(sessionId)?.stopping === true;
|
|
63909
64112
|
const askToStop = () => {
|
|
@@ -63917,6 +64120,11 @@ ${result}
|
|
|
63917
64120
|
if (done) return;
|
|
63918
64121
|
giveUp(true);
|
|
63919
64122
|
};
|
|
64123
|
+
const finishWatch = (code) => {
|
|
64124
|
+
process.off("SIGTERM", askToStop);
|
|
64125
|
+
process.off("SIGINT", askToStop);
|
|
64126
|
+
resolve2(code);
|
|
64127
|
+
};
|
|
63920
64128
|
process.on("SIGTERM", askToStop);
|
|
63921
64129
|
process.on("SIGINT", askToStop);
|
|
63922
64130
|
watchdog = createIdleWatchdog(() => {
|
|
@@ -63925,7 +64133,15 @@ ${result}
|
|
|
63925
64133
|
log.write(`
|
|
63926
64134
|
[board] ${silenceSaid(silenceFor)}
|
|
63927
64135
|
`);
|
|
63928
|
-
|
|
64136
|
+
if (!client?.idleRecovery) {
|
|
64137
|
+
giveUp(false);
|
|
64138
|
+
return;
|
|
64139
|
+
}
|
|
64140
|
+
uncertainAtIdle = pendingOperations.size > 0;
|
|
64141
|
+
patch(sessionId, (run4) => {
|
|
64142
|
+
run4.cleanup = { status: "unconfirmed", execution: sessionId, kept: [] };
|
|
64143
|
+
});
|
|
64144
|
+
idle.abort();
|
|
63929
64145
|
}, () => !!(client?.background?.() ?? renderer?.background?.()) || liveSubRuns(sessionId).length > 0);
|
|
63930
64146
|
touch = watchdog.touch;
|
|
63931
64147
|
observeActivity = watchdog.event;
|
|
@@ -63953,12 +64169,13 @@ ${result}
|
|
|
63953
64169
|
gotContext,
|
|
63954
64170
|
completed,
|
|
63955
64171
|
activity: touch,
|
|
63956
|
-
signal: cancellation.signal
|
|
64172
|
+
signal: cancellation.signal,
|
|
64173
|
+
idleSignal: idle.signal
|
|
63957
64174
|
}).then((end2) => {
|
|
63958
64175
|
if (done) return;
|
|
63959
64176
|
spoken = end2;
|
|
63960
64177
|
if (end2.cleanup) patch(sessionId, (r) => {
|
|
63961
|
-
r.cleanup = end2.cleanup;
|
|
64178
|
+
r.cleanup = uncertainAtIdle || silent && pendingOperations.size ? { ...end2.cleanup, status: "unconfirmed" } : end2.cleanup;
|
|
63962
64179
|
});
|
|
63963
64180
|
endChild();
|
|
63964
64181
|
void finish(end2.ok ? 0 : 1, peekRun(sessionId)?.stopping === true || stopped2);
|
|
@@ -64013,6 +64230,7 @@ var init_watch = __esm({
|
|
|
64013
64230
|
"src/lib/agent/watch.ts"() {
|
|
64014
64231
|
"use strict";
|
|
64015
64232
|
init_review_plan();
|
|
64233
|
+
init_env();
|
|
64016
64234
|
init_connection_process();
|
|
64017
64235
|
init_deliveries();
|
|
64018
64236
|
init_board_conflicts();
|
|
@@ -64032,6 +64250,7 @@ var init_watch = __esm({
|
|
|
64032
64250
|
init_prompts();
|
|
64033
64251
|
init_resolve();
|
|
64034
64252
|
init_idle();
|
|
64253
|
+
init_codex_background_types();
|
|
64035
64254
|
init_retry();
|
|
64036
64255
|
init_failures();
|
|
64037
64256
|
init_execution();
|
|
@@ -64499,11 +64718,21 @@ function deliveryOutcome(deliveryId) {
|
|
|
64499
64718
|
id: deliveryId,
|
|
64500
64719
|
status: delivery.status,
|
|
64501
64720
|
line,
|
|
64721
|
+
...delivery.status === "cancelled" ? {
|
|
64722
|
+
ending: { kind: delivery.steps.some((s) => s.step === "discarded") ? "discarded" : "stopped" }
|
|
64723
|
+
} : {},
|
|
64502
64724
|
...commit ? { commit, ...delivery.targetBranch ? { branch: delivery.targetBranch } : {} } : {}
|
|
64503
64725
|
};
|
|
64504
64726
|
}
|
|
64505
64727
|
const state = deliveryState(delivery, delivery.cardId === null ? 0 : openQuestions(delivery.cardId));
|
|
64506
|
-
|
|
64728
|
+
const reason = delivery.review?.stopped?.why;
|
|
64729
|
+
return {
|
|
64730
|
+
id: deliveryId,
|
|
64731
|
+
status: delivery.status,
|
|
64732
|
+
stage: state.stage,
|
|
64733
|
+
line: state.line,
|
|
64734
|
+
...reason ? { ending: { kind: "blocked", reason } } : {}
|
|
64735
|
+
};
|
|
64507
64736
|
}
|
|
64508
64737
|
function runLine(r, program2 = "akb", indent2 = "") {
|
|
64509
64738
|
const sub = r.action === "sub";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wildcrane",
|
|
3
|
-
"version": "0.11.
|
|
4
|
-
"akbContract":
|
|
3
|
+
"version": "0.11.75",
|
|
4
|
+
"akbContract": 22,
|
|
5
5
|
"description": "WildCrane's `akb` command — scaffold the Markdown board under docs/kanban/, put an agent on a card, and carry the flows the agent works by.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"kanban",
|