wildcrane 0.11.79 → 0.11.81
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 +558 -199
- 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.81 — 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)
|
|
@@ -20817,6 +20817,108 @@ var init_zod = __esm({
|
|
|
20817
20817
|
}
|
|
20818
20818
|
});
|
|
20819
20819
|
|
|
20820
|
+
// src/lib/shared/preview-blocks.ts
|
|
20821
|
+
function sourcePosition(source2, offset) {
|
|
20822
|
+
const before = source2.slice(0, offset);
|
|
20823
|
+
return { line: before.split("\n").length, column: offset - before.lastIndexOf("\n") };
|
|
20824
|
+
}
|
|
20825
|
+
function withoutCode(source2) {
|
|
20826
|
+
const blank = (s) => s.replace(/[^\n\r]/g, " ");
|
|
20827
|
+
let fence;
|
|
20828
|
+
let indented = false, afterBlank = true, inList = false;
|
|
20829
|
+
return source2.split(/(?<=\n)/).map((line) => {
|
|
20830
|
+
const marker = /^ {0,3}(`{3,}|~{3,})(.*)/.exec(line);
|
|
20831
|
+
if (fence) {
|
|
20832
|
+
if (marker && marker[1][0] === fence.char && marker[1].length >= fence.length && !marker[2].trim()) fence = void 0;
|
|
20833
|
+
return blank(line);
|
|
20834
|
+
}
|
|
20835
|
+
if (marker) {
|
|
20836
|
+
fence = { char: marker[1][0], length: marker[1].length };
|
|
20837
|
+
return blank(line);
|
|
20838
|
+
}
|
|
20839
|
+
if (!line.trim()) {
|
|
20840
|
+
afterBlank = true;
|
|
20841
|
+
return line;
|
|
20842
|
+
}
|
|
20843
|
+
const hasIndent = /^(?: {4}|\t)/.test(line);
|
|
20844
|
+
if (!hasIndent) indented = false;
|
|
20845
|
+
if (/^ {0,3}(?:[-+*]|\d+[.)])\s/.test(line)) inList = true;
|
|
20846
|
+
else if (/^\S/.test(line)) inList = false;
|
|
20847
|
+
if (hasIndent && (indented || afterBlank && !inList)) {
|
|
20848
|
+
indented = true;
|
|
20849
|
+
return blank(line);
|
|
20850
|
+
}
|
|
20851
|
+
afterBlank = false;
|
|
20852
|
+
return line;
|
|
20853
|
+
}).join("").replace(/(`+)([^]*?)\1(?!`)/g, blank);
|
|
20854
|
+
}
|
|
20855
|
+
function parsePreviewBlocks(source2, file2 = "STUDIO.md") {
|
|
20856
|
+
const blocks = [], problems = [];
|
|
20857
|
+
const masked = withoutCode(source2);
|
|
20858
|
+
let open4;
|
|
20859
|
+
const seen = /* @__PURE__ */ new Set();
|
|
20860
|
+
const fail = (offset, id2, code, message, hint2) => problems.push({ file: file2, ...sourcePosition(source2, offset), path: id2 ? `previews.${id2}` : "previews", code, message, hint: hint2 });
|
|
20861
|
+
for (const tag of masked.matchAll(/<\/?Preview\b[^>]*(?:>|$)/g)) {
|
|
20862
|
+
const offset = tag.index, text5 = tag[0];
|
|
20863
|
+
const closing = /^<\/Preview\s*>$/.test(text5);
|
|
20864
|
+
if (closing) {
|
|
20865
|
+
if (!open4) fail(offset, "", "preview-unexpected-close", "Preview has no opening tag", "Remove it or restore its opening tag.");
|
|
20866
|
+
else {
|
|
20867
|
+
const instructions = source2.slice(open4.content, offset).trim();
|
|
20868
|
+
if (!instructions) fail(open4.start, open4.id, "preview-empty", `Preview ${open4.id} is empty`, "Describe the requested output inside the block.");
|
|
20869
|
+
blocks.push({ id: open4.id, instructions, start: open4.start, end: offset + text5.length });
|
|
20870
|
+
open4 = void 0;
|
|
20871
|
+
}
|
|
20872
|
+
continue;
|
|
20873
|
+
}
|
|
20874
|
+
const opening = /^<Preview\s+id=(?:"([^"]*)"|'([^']*)')\s*>$/.exec(text5);
|
|
20875
|
+
if (!opening || open4) {
|
|
20876
|
+
fail(offset, open4?.id ?? "", "preview-tag", "Malformed or nested Preview tag", 'Use one non-nested <Preview id="stable-id"> block with only id.');
|
|
20877
|
+
continue;
|
|
20878
|
+
}
|
|
20879
|
+
const id2 = opening[1] ?? opening[2];
|
|
20880
|
+
if (!PREVIEW_ID.test(id2) || seen.has(id2)) fail(offset, id2, "preview-id", `Invalid or repeated Preview ID ${id2}`, "Use a unique lowercase ID with digits and dashes.");
|
|
20881
|
+
seen.add(id2);
|
|
20882
|
+
open4 = { id: id2, start: offset, content: offset + text5.length };
|
|
20883
|
+
}
|
|
20884
|
+
if (open4) fail(open4.start, open4.id, "preview-unclosed", `Preview ${open4.id} is not closed`, "Add </Preview> after this block.");
|
|
20885
|
+
return { blocks, problems };
|
|
20886
|
+
}
|
|
20887
|
+
var PREVIEW_ID;
|
|
20888
|
+
var init_preview_blocks = __esm({
|
|
20889
|
+
"src/lib/shared/preview-blocks.ts"() {
|
|
20890
|
+
"use strict";
|
|
20891
|
+
PREVIEW_ID = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
20892
|
+
}
|
|
20893
|
+
});
|
|
20894
|
+
|
|
20895
|
+
// src/lib/shared/preview-definitions.ts
|
|
20896
|
+
function effectivePreviewCatalog(studio, definitions) {
|
|
20897
|
+
const seen = new Set(studio.map((p) => p.id));
|
|
20898
|
+
for (const p of definitions) {
|
|
20899
|
+
if (seen.has(p.id)) throw new Error(`Duplicate Preview ID "${p.id}".`);
|
|
20900
|
+
seen.add(p.id);
|
|
20901
|
+
}
|
|
20902
|
+
return [...studio, ...definitions];
|
|
20903
|
+
}
|
|
20904
|
+
var previewComponents, language, previewDefinitionSchema, previewDefinitionsSchema;
|
|
20905
|
+
var init_preview_definitions = __esm({
|
|
20906
|
+
"src/lib/shared/preview-definitions.ts"() {
|
|
20907
|
+
"use strict";
|
|
20908
|
+
init_zod();
|
|
20909
|
+
init_preview_blocks();
|
|
20910
|
+
previewComponents = ["Asset", "Compare", "Storyboard", "Set", "Studio"];
|
|
20911
|
+
language = /^[a-z]{2,3}(?:-[A-Za-z0-9]+)*$/;
|
|
20912
|
+
previewDefinitionSchema = external_exports.object({
|
|
20913
|
+
id: external_exports.string().max(100).regex(PREVIEW_ID),
|
|
20914
|
+
title: external_exports.record(external_exports.string().regex(language), external_exports.string().trim().min(1).max(100)).refine((names2) => Boolean(names2.en && names2.zh), "A Preview needs English and Chinese titles."),
|
|
20915
|
+
instructions: external_exports.string().trim().min(1).max(1e4),
|
|
20916
|
+
components: external_exports.array(external_exports.enum(previewComponents)).max(previewComponents.length).refine((items) => new Set(items).size === items.length, "Preview Components must be unique.").transform((items) => [...items].sort()).optional()
|
|
20917
|
+
}).strict();
|
|
20918
|
+
previewDefinitionsSchema = external_exports.array(previewDefinitionSchema).max(50);
|
|
20919
|
+
}
|
|
20920
|
+
});
|
|
20921
|
+
|
|
20820
20922
|
// src/lib/shared/review-plan.ts
|
|
20821
20923
|
function reviewPreviewIds(plan) {
|
|
20822
20924
|
return [...new Set((plan ?? []).flatMap((node2) => node2.previews))];
|
|
@@ -20841,47 +20943,68 @@ function reviewLayers(plan) {
|
|
|
20841
20943
|
}
|
|
20842
20944
|
return layers;
|
|
20843
20945
|
}
|
|
20844
|
-
function parseReviewPlan(value
|
|
20845
|
-
|
|
20846
|
-
|
|
20847
|
-
|
|
20946
|
+
function parseReviewPlan(value) {
|
|
20947
|
+
return reviewPlanSchema.parse(value);
|
|
20948
|
+
}
|
|
20949
|
+
function reviewNames(catalog) {
|
|
20950
|
+
return catalog.map(({ id: id2, title }) => {
|
|
20951
|
+
const labels = Object.values(title ?? {}).map((label2) => label2.trim()).filter(Boolean);
|
|
20952
|
+
return { id: id2, labels: labels.length ? [...new Set(labels)] : [id2] };
|
|
20953
|
+
});
|
|
20954
|
+
}
|
|
20955
|
+
function previewError(message, names2) {
|
|
20956
|
+
const available = names2.map(({ labels, id: id2 }) => `${labels.join(" / ")} (${id2})`).join(", ") || "none";
|
|
20957
|
+
return new Error(`${message} Available Previews: ${available}. Use a listed name in a flow or its ID in a JSON plan. Define custom Previews before using them. A Preview is a draft or result for review. Keep task context in the card body.`);
|
|
20958
|
+
}
|
|
20959
|
+
function validateReviewPreviews(plan, catalog, { saved = false } = {}) {
|
|
20960
|
+
const prerequisites = new Set((plan ?? []).flatMap((node2) => node2.after));
|
|
20961
|
+
const ids = new Set(catalog?.map((p) => p.id));
|
|
20962
|
+
for (const node2 of plan ?? []) {
|
|
20963
|
+
if (node2.previews.length) {
|
|
20964
|
+
if (!catalog) throw new Error("Preview outputs are unavailable; update Runner and try again.");
|
|
20965
|
+
const unknown2 = node2.previews.find((preview) => !ids.has(preview));
|
|
20966
|
+
if (unknown2) throw previewError(`Preview ${unknown2} is not defined for review node "${node2.id}".`, reviewNames(catalog));
|
|
20967
|
+
} else if (!saved && node2.kind !== "work") {
|
|
20968
|
+
const handoff2 = (node2.id === HANDOFF || node2.id === HANDOFF_WITH_COLLISION) && node2.after.length && !prerequisites.has(node2.id);
|
|
20969
|
+
if (!handoff2) throw previewError(
|
|
20970
|
+
`Review node "${node2.id}" needs at least one Preview. Use an empty plan for no extra review.`,
|
|
20971
|
+
reviewNames(catalog ?? [])
|
|
20972
|
+
);
|
|
20973
|
+
}
|
|
20848
20974
|
}
|
|
20849
20975
|
return plan;
|
|
20850
20976
|
}
|
|
20851
20977
|
function parseReviewFlow(flow, catalog) {
|
|
20852
20978
|
if (flow === "") return [];
|
|
20853
20979
|
if (!catalog) throw new Error("Preview outputs are unavailable; update Runner and try again.");
|
|
20854
|
-
const names2 = catalog
|
|
20855
|
-
const labels = Object.values(title ?? {}).map((label2) => label2.trim()).filter(Boolean);
|
|
20856
|
-
return { id: id2, labels: labels.length ? [...new Set(labels)] : [id2] };
|
|
20857
|
-
});
|
|
20858
|
-
const available = names2.map(({ labels }) => labels.join(" / ")).join(", ") || "none";
|
|
20980
|
+
const names2 = reviewNames(catalog);
|
|
20859
20981
|
const seen = /* @__PURE__ */ new Set();
|
|
20860
20982
|
const nodes = [];
|
|
20861
20983
|
let after2 = [];
|
|
20862
|
-
for (const group of flow.split("->")) {
|
|
20984
|
+
for (const [index, group] of flow.split("->").entries()) {
|
|
20863
20985
|
const current = group.split("+").map((entry) => {
|
|
20864
20986
|
const name = entry.trim();
|
|
20865
|
-
if (!name) throw
|
|
20987
|
+
if (!name) throw previewError(`Review flow group ${index + 1} contains an empty Preview name.`, names2);
|
|
20866
20988
|
const matches = names2.filter(({ labels }) => labels.includes(name));
|
|
20867
20989
|
if (matches.length !== 1) {
|
|
20868
|
-
throw
|
|
20990
|
+
throw previewError(`${matches.length ? "Ambiguous" : "Unknown"} Preview "${name}" in review flow group ${index + 1}.`, names2);
|
|
20869
20991
|
}
|
|
20870
20992
|
const { id: id2 } = matches[0];
|
|
20871
|
-
if (seen.has(id2)) throw
|
|
20993
|
+
if (seen.has(id2)) throw previewError(`Repeated Preview "${name}" in review flow group ${index + 1}.`, names2);
|
|
20872
20994
|
seen.add(id2);
|
|
20873
20995
|
nodes.push({ id: id2, after: after2, previews: [id2] });
|
|
20874
20996
|
return id2;
|
|
20875
20997
|
});
|
|
20876
20998
|
after2 = current;
|
|
20877
20999
|
}
|
|
20878
|
-
nodes.push({ id: seen.has(
|
|
21000
|
+
nodes.push({ id: seen.has(HANDOFF) ? HANDOFF_WITH_COLLISION : HANDOFF, after: after2, previews: [] });
|
|
20879
21001
|
return parseReviewPlan(nodes);
|
|
20880
21002
|
}
|
|
20881
21003
|
function readReviewPlan(plan) {
|
|
20882
21004
|
return plan?.map(({ id: id2, after: after2, previews, kind }) => ({ id: id2, after: after2, previews, ...kind && { kind } })) ?? null;
|
|
20883
21005
|
}
|
|
20884
21006
|
function reviewAuthorization(review, assigned, dispatchRevision) {
|
|
21007
|
+
if (review.pending_plan) return { kind: "waiting" };
|
|
20885
21008
|
const states2 = new Map(review.stages.map((stage) => [stage.id, stage]));
|
|
20886
21009
|
const nodes = (review.plan ?? []).filter((node2) => {
|
|
20887
21010
|
const stage = states2.get(node2.id);
|
|
@@ -20910,7 +21033,7 @@ function reviewInstruction(authorization) {
|
|
|
20910
21033
|
case "stages":
|
|
20911
21034
|
return [
|
|
20912
21035
|
"Work only on these unlocked stages: " + authorization.nodes.map((node2) => node2.id).join(", "),
|
|
20913
|
-
...authorization.nodes.map((node2) => `- ${node2.id}: ${node2.previews.length ? node2.previews.join(", ") : "
|
|
21036
|
+
...authorization.nodes.map((node2) => `- ${node2.id}: ${node2.previews.length ? node2.previews.join(", ") : "no Preview"}`)
|
|
20914
21037
|
].join("\n");
|
|
20915
21038
|
case "delivery":
|
|
20916
21039
|
return "Stages complete. Follow Studio delivery checks.";
|
|
@@ -20921,13 +21044,22 @@ function reviewInstruction(authorization) {
|
|
|
20921
21044
|
}
|
|
20922
21045
|
}
|
|
20923
21046
|
function reviewBoundary(review, assigned) {
|
|
21047
|
+
const { preview_definitions = [], ...state } = review;
|
|
21048
|
+
const authorization = reviewAuthorization(review, assigned);
|
|
21049
|
+
const definitions = authorization.kind === "stages" && assigned ? preview_definitions.filter((p) => authorization.nodes.some((node2) => node2.previews.includes(p.id))) : preview_definitions;
|
|
20924
21050
|
return [
|
|
20925
|
-
"Task review: " + JSON.stringify(
|
|
20926
|
-
reviewInstruction(
|
|
21051
|
+
"Task review: " + JSON.stringify(state),
|
|
21052
|
+
reviewInstruction(authorization),
|
|
21053
|
+
...definitions.map((p) => [
|
|
21054
|
+
`<Preview id="${p.id}">`,
|
|
21055
|
+
p.instructions,
|
|
21056
|
+
...p.components ? [`Allowed Preview Components: ${p.components.join(", ") || "none"}.`] : [],
|
|
21057
|
+
"</Preview>"
|
|
21058
|
+
].join("\n")),
|
|
20927
21059
|
"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. Only stage approval accepts reviewable outputs."
|
|
20928
21060
|
].join("\n");
|
|
20929
21061
|
}
|
|
20930
|
-
var id, reviewNodeSchema, reviewPlanSchema;
|
|
21062
|
+
var id, reviewNodeSchema, reviewPlanSchema, HANDOFF, HANDOFF_WITH_COLLISION;
|
|
20931
21063
|
var init_review_plan = __esm({
|
|
20932
21064
|
"src/lib/shared/review-plan.ts"() {
|
|
20933
21065
|
"use strict";
|
|
@@ -20946,6 +21078,8 @@ var init_review_plan = __esm({
|
|
|
20946
21078
|
ctx.addIssue({ code: "custom", message: e.message });
|
|
20947
21079
|
}
|
|
20948
21080
|
}).nullable();
|
|
21081
|
+
HANDOFF = "delivery-handoff";
|
|
21082
|
+
HANDOFF_WITH_COLLISION = "delivery-handoff:flow";
|
|
20949
21083
|
}
|
|
20950
21084
|
});
|
|
20951
21085
|
|
|
@@ -22232,21 +22366,24 @@ async function taskReview(id2, opts = {}, location = {}) {
|
|
|
22232
22366
|
if (count3 > 1 || opts.stage !== void 0 && opts.status === void 0) die("Use one of --review, --file, --stage with --status, or --revise-from.");
|
|
22233
22367
|
const ref = await taskRef(id2, location);
|
|
22234
22368
|
let task;
|
|
22235
|
-
if (
|
|
22369
|
+
if (opts.previewDefinitionsFile !== void 0 && (opts.status !== void 0 || opts.reviseFrom !== void 0)) die("Preview definitions can only change with a review plan.");
|
|
22370
|
+
if (!count3 && opts.previewDefinitionsFile === void 0) task = await cloud("GET", `/v1/tasks/${enc(ref)}`);
|
|
22236
22371
|
else {
|
|
22237
22372
|
const review_revision = reviewRevision(opts.revision);
|
|
22238
22373
|
let fields2;
|
|
22239
22374
|
if (opts.review !== void 0) {
|
|
22240
|
-
|
|
22241
|
-
fields2 = { operation: "plan", review_plan: parseReviewFlow(opts.review, studio?.previews) };
|
|
22375
|
+
fields2 = { operation: "plan", review_flow: opts.review };
|
|
22242
22376
|
} else if (opts.file !== void 0) {
|
|
22243
22377
|
fields2 = { operation: "plan", review_plan: parseReviewPlan(JSON.parse(fs7.readFileSync(opts.file, "utf8"))) };
|
|
22244
22378
|
} else if (opts.reviseFrom !== void 0) {
|
|
22245
22379
|
fields2 = { operation: "revise", stage: opts.reviseFrom };
|
|
22380
|
+
} else if (opts.previewDefinitionsFile !== void 0) {
|
|
22381
|
+
fields2 = { operation: "plan" };
|
|
22246
22382
|
} else {
|
|
22247
22383
|
if (!opts.stage || !["running", "done"].includes(opts.status)) die("--stage and --status running|done are required.");
|
|
22248
22384
|
fields2 = { operation: "status", stage: opts.stage, status: opts.status };
|
|
22249
22385
|
}
|
|
22386
|
+
if (opts.previewDefinitionsFile !== void 0) fields2.preview_definitions = previewDefinitionsSchema.parse(JSON.parse(fs7.readFileSync(opts.previewDefinitionsFile, "utf8")));
|
|
22250
22387
|
task = await cloud("POST", `/v1/tasks/${enc(ref)}/review`, { ...fields2, review_revision });
|
|
22251
22388
|
}
|
|
22252
22389
|
say(JSON.stringify(task.review, null, 2));
|
|
@@ -22318,6 +22455,7 @@ var init_task = __esm({
|
|
|
22318
22455
|
"use strict";
|
|
22319
22456
|
init_env();
|
|
22320
22457
|
init_reply_approval();
|
|
22458
|
+
init_preview_definitions();
|
|
22321
22459
|
init_review_plan();
|
|
22322
22460
|
init_reply_approval();
|
|
22323
22461
|
init_config();
|
|
@@ -36794,81 +36932,6 @@ var init_icon = __esm({
|
|
|
36794
36932
|
}
|
|
36795
36933
|
});
|
|
36796
36934
|
|
|
36797
|
-
// src/lib/shared/preview-blocks.ts
|
|
36798
|
-
function sourcePosition(source2, offset) {
|
|
36799
|
-
const before = source2.slice(0, offset);
|
|
36800
|
-
return { line: before.split("\n").length, column: offset - before.lastIndexOf("\n") };
|
|
36801
|
-
}
|
|
36802
|
-
function withoutCode(source2) {
|
|
36803
|
-
const blank = (s) => s.replace(/[^\n\r]/g, " ");
|
|
36804
|
-
let fence;
|
|
36805
|
-
let indented = false, afterBlank = true, inList = false;
|
|
36806
|
-
return source2.split(/(?<=\n)/).map((line) => {
|
|
36807
|
-
const marker = /^ {0,3}(`{3,}|~{3,})(.*)/.exec(line);
|
|
36808
|
-
if (fence) {
|
|
36809
|
-
if (marker && marker[1][0] === fence.char && marker[1].length >= fence.length && !marker[2].trim()) fence = void 0;
|
|
36810
|
-
return blank(line);
|
|
36811
|
-
}
|
|
36812
|
-
if (marker) {
|
|
36813
|
-
fence = { char: marker[1][0], length: marker[1].length };
|
|
36814
|
-
return blank(line);
|
|
36815
|
-
}
|
|
36816
|
-
if (!line.trim()) {
|
|
36817
|
-
afterBlank = true;
|
|
36818
|
-
return line;
|
|
36819
|
-
}
|
|
36820
|
-
const hasIndent = /^(?: {4}|\t)/.test(line);
|
|
36821
|
-
if (!hasIndent) indented = false;
|
|
36822
|
-
if (/^ {0,3}(?:[-+*]|\d+[.)])\s/.test(line)) inList = true;
|
|
36823
|
-
else if (/^\S/.test(line)) inList = false;
|
|
36824
|
-
if (hasIndent && (indented || afterBlank && !inList)) {
|
|
36825
|
-
indented = true;
|
|
36826
|
-
return blank(line);
|
|
36827
|
-
}
|
|
36828
|
-
afterBlank = false;
|
|
36829
|
-
return line;
|
|
36830
|
-
}).join("").replace(/(`+)([^]*?)\1(?!`)/g, blank);
|
|
36831
|
-
}
|
|
36832
|
-
function parsePreviewBlocks(source2, file2 = "STUDIO.md") {
|
|
36833
|
-
const blocks = [], problems = [];
|
|
36834
|
-
const masked = withoutCode(source2);
|
|
36835
|
-
let open4;
|
|
36836
|
-
const seen = /* @__PURE__ */ new Set();
|
|
36837
|
-
const fail = (offset, id2, code, message, hint2) => problems.push({ file: file2, ...sourcePosition(source2, offset), path: id2 ? `previews.${id2}` : "previews", code, message, hint: hint2 });
|
|
36838
|
-
for (const tag of masked.matchAll(/<\/?Preview\b[^>]*(?:>|$)/g)) {
|
|
36839
|
-
const offset = tag.index, text5 = tag[0];
|
|
36840
|
-
const closing = /^<\/Preview\s*>$/.test(text5);
|
|
36841
|
-
if (closing) {
|
|
36842
|
-
if (!open4) fail(offset, "", "preview-unexpected-close", "Preview has no opening tag", "Remove it or restore its opening tag.");
|
|
36843
|
-
else {
|
|
36844
|
-
const instructions = source2.slice(open4.content, offset).trim();
|
|
36845
|
-
if (!instructions) fail(open4.start, open4.id, "preview-empty", `Preview ${open4.id} is empty`, "Describe the requested output inside the block.");
|
|
36846
|
-
blocks.push({ id: open4.id, instructions, start: open4.start, end: offset + text5.length });
|
|
36847
|
-
open4 = void 0;
|
|
36848
|
-
}
|
|
36849
|
-
continue;
|
|
36850
|
-
}
|
|
36851
|
-
const opening = /^<Preview\s+id=(?:"([^"]*)"|'([^']*)')\s*>$/.exec(text5);
|
|
36852
|
-
if (!opening || open4) {
|
|
36853
|
-
fail(offset, open4?.id ?? "", "preview-tag", "Malformed or nested Preview tag", 'Use one non-nested <Preview id="stable-id"> block with only id.');
|
|
36854
|
-
continue;
|
|
36855
|
-
}
|
|
36856
|
-
const id2 = opening[1] ?? opening[2];
|
|
36857
|
-
if (!PREVIEW_ID.test(id2) || seen.has(id2)) fail(offset, id2, "preview-id", `Invalid or repeated Preview ID ${id2}`, "Use a unique lowercase ID with digits and dashes.");
|
|
36858
|
-
seen.add(id2);
|
|
36859
|
-
open4 = { id: id2, start: offset, content: offset + text5.length };
|
|
36860
|
-
}
|
|
36861
|
-
if (open4) fail(open4.start, open4.id, "preview-unclosed", `Preview ${open4.id} is not closed`, "Add </Preview> after this block.");
|
|
36862
|
-
return { blocks, problems };
|
|
36863
|
-
}
|
|
36864
|
-
var PREVIEW_ID;
|
|
36865
|
-
var init_preview_blocks = __esm({
|
|
36866
|
-
"src/lib/shared/preview-blocks.ts"() {
|
|
36867
|
-
"use strict";
|
|
36868
|
-
PREVIEW_ID = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
36869
|
-
}
|
|
36870
|
-
});
|
|
36871
|
-
|
|
36872
36935
|
// src/lib/agent/studio-def.ts
|
|
36873
36936
|
function landSections(body, previews) {
|
|
36874
36937
|
const blank = (text5) => text5.replace(/[^\r\n]/g, " ");
|
|
@@ -37574,7 +37637,7 @@ var init_language = __esm({
|
|
|
37574
37637
|
isSystemLanguage = (text5) => text5 === SYSTEM_LANGUAGE_ZH || text5 === SYSTEM_LANGUAGE_EN;
|
|
37575
37638
|
languageCode = (value) => value === "zh" || value === "en" ? value : null;
|
|
37576
37639
|
translating = () => runLanguage() === "zh";
|
|
37577
|
-
systemLanguage = (
|
|
37640
|
+
systemLanguage = (language2) => language2 === "zh" ? SYSTEM_LANGUAGE_ZH : language2 === "en" ? SYSTEM_LANGUAGE_EN : "";
|
|
37578
37641
|
}
|
|
37579
37642
|
});
|
|
37580
37643
|
|
|
@@ -37728,22 +37791,25 @@ function editGoal(args2, opts, held4) {
|
|
|
37728
37791
|
const body = readBody(opts.bodyFile);
|
|
37729
37792
|
const studio = opts.studio ? studioOf(held4, opts.studio) : fallbackStudio(held4);
|
|
37730
37793
|
const id2 = `new_${held4.goals.filter((i) => i.id.startsWith("new_")).length + 1}`;
|
|
37731
|
-
const
|
|
37732
|
-
|
|
37733
|
-
|
|
37794
|
+
const preview_definitions = goalDefinitions(opts);
|
|
37795
|
+
const review_plan = goalReview(held4, studio, opts, null, preview_definitions);
|
|
37796
|
+
held4.goals.push({ id: id2, title, ...body, studio, review_plan, ...opts.previewDefinitionsFile !== void 0 ? { preview_definitions } : {}, task: null });
|
|
37797
|
+
return { id: id2, title, studio, review_plan, preview_definitions };
|
|
37734
37798
|
}
|
|
37735
37799
|
const goal = named(held4, opts.id);
|
|
37736
37800
|
if (goal.task) die(`${goal.id} is already a task; it no longer changes here.`);
|
|
37737
37801
|
if (sub === "save") {
|
|
37738
37802
|
const studio = opts.studio !== void 0 ? studioOf(held4, opts.studio) : goal.studio;
|
|
37739
|
-
const
|
|
37803
|
+
const preview_definitions = goalDefinitions(opts, goal.preview_definitions);
|
|
37804
|
+
const review_plan = goalReview(held4, studio, opts, goal.review_plan ?? null, preview_definitions);
|
|
37740
37805
|
if (opts.title !== void 0) {
|
|
37741
37806
|
if (!opts.title.trim()) die("--title must not be empty");
|
|
37742
37807
|
goal.title = opts.title.trim();
|
|
37743
37808
|
}
|
|
37744
37809
|
if (opts.bodyFile !== void 0) Object.assign(goal, readBody(opts.bodyFile));
|
|
37745
37810
|
Object.assign(goal, { studio, review_plan });
|
|
37746
|
-
|
|
37811
|
+
if (opts.previewDefinitionsFile !== void 0) goal.preview_definitions = preview_definitions;
|
|
37812
|
+
return { id: goal.id, title: goal.title, studio: goal.studio, review_plan, preview_definitions };
|
|
37747
37813
|
}
|
|
37748
37814
|
if (sub === "drop") {
|
|
37749
37815
|
goal.dropped = true;
|
|
@@ -37763,30 +37829,29 @@ function cmdGoalStudios(held4 = loadGoals().held) {
|
|
|
37763
37829
|
}
|
|
37764
37830
|
return { studios: held4.studios.map((w) => ({ ...w, id: shortStudioId(w.id) })) };
|
|
37765
37831
|
}
|
|
37766
|
-
function
|
|
37767
|
-
|
|
37768
|
-
|
|
37769
|
-
|
|
37770
|
-
|
|
37771
|
-
|
|
37772
|
-
|
|
37773
|
-
return die(e.message);
|
|
37774
|
-
}
|
|
37832
|
+
function goalDefinitions(opts, previous = []) {
|
|
37833
|
+
return opts.previewDefinitionsFile === void 0 ? previous : previewDefinitionsSchema.parse(JSON.parse(fs16.readFileSync(opts.previewDefinitionsFile, "utf8")));
|
|
37834
|
+
}
|
|
37835
|
+
function goalCatalog(held4, studio, definitions) {
|
|
37836
|
+
const builtIn = held4.studios.find((w) => w.id === studio)?.previews;
|
|
37837
|
+
if (!builtIn && definitions.length) die("Preview outputs are unavailable; update Runner and try again.");
|
|
37838
|
+
return builtIn && effectivePreviewCatalog(builtIn, definitions);
|
|
37775
37839
|
}
|
|
37776
|
-
function goalReview(held4, studio, opts, previous
|
|
37840
|
+
function goalReview(held4, studio, opts, previous, definitions) {
|
|
37841
|
+
const catalog = goalCatalog(held4, studio, definitions);
|
|
37777
37842
|
if (opts.review !== void 0) {
|
|
37778
37843
|
if (opts.reviewFile !== void 0) die("Use either --review or --review-file.");
|
|
37779
|
-
const catalog = held4.studios.find((w) => w.id === studio)?.previews;
|
|
37780
37844
|
return parseReviewFlow(opts.review, catalog);
|
|
37781
37845
|
}
|
|
37782
|
-
const value = opts.reviewFile === void 0 ? previous : JSON.parse(fs16.readFileSync(opts.reviewFile, "utf8"));
|
|
37783
|
-
|
|
37846
|
+
const value = opts.reviewFile === void 0 ? readReviewPlan(previous) : JSON.parse(fs16.readFileSync(opts.reviewFile, "utf8"));
|
|
37847
|
+
const saved = opts.reviewFile === void 0 && opts.previewDefinitionsFile === void 0 && opts.studio === void 0;
|
|
37848
|
+
return validateReviewPreviews(parseReviewPlan(value), catalog, { saved });
|
|
37784
37849
|
}
|
|
37785
37850
|
function cmdGoalPreviews(studio, held4 = loadGoals().held) {
|
|
37786
37851
|
const id2 = studioOf(held4, studio);
|
|
37787
37852
|
const catalog = held4.studios.find((w) => w.id === id2)?.previews;
|
|
37788
37853
|
if (!catalog) die("Preview outputs are unavailable; update Runner and try again.");
|
|
37789
|
-
const previews = catalog
|
|
37854
|
+
const previews = catalog;
|
|
37790
37855
|
say(previews.map((p) => `${p.id}
|
|
37791
37856
|
${p.instructions}`).join("\n"));
|
|
37792
37857
|
return { previews, problems: [] };
|
|
@@ -37795,6 +37860,7 @@ var MAX_GOALS, shortStudioId, open2;
|
|
|
37795
37860
|
var init_goal2 = __esm({
|
|
37796
37861
|
"src/commands/goal.ts"() {
|
|
37797
37862
|
"use strict";
|
|
37863
|
+
init_preview_definitions();
|
|
37798
37864
|
init_review_plan();
|
|
37799
37865
|
init_goal_draft();
|
|
37800
37866
|
init_io();
|
|
@@ -37891,7 +37957,7 @@ async function queryPreviews(studio, workspace2) {
|
|
|
37891
37957
|
const flow = list3.find((w) => w.id === studio || shortStudioId(w.id) === studio);
|
|
37892
37958
|
if (!flow) die(`No studio \`${studio}\` here.`);
|
|
37893
37959
|
if (!flow.previews) die("Preview outputs are unavailable; update Runner and try again.");
|
|
37894
|
-
const previews = flow.previews
|
|
37960
|
+
const previews = flow.previews;
|
|
37895
37961
|
say(previews.map((p) => `${p.id}
|
|
37896
37962
|
${p.instructions}`).join("\n"));
|
|
37897
37963
|
return { previews, problems: [] };
|
|
@@ -41495,14 +41561,15 @@ function backoffMs(attempt2, random = Math.random) {
|
|
|
41495
41561
|
const step = Math.min(CAP_MS, BASE_MS * 2 ** Math.max(0, attempt2 - 2));
|
|
41496
41562
|
return Math.round(step * (1 - 0.25 * random()));
|
|
41497
41563
|
}
|
|
41498
|
-
function planRetry(failure2, attempt2, now = Date.now(), backoff = backoffMs) {
|
|
41564
|
+
function planRetry(failure2, attempt2, now = Date.now(), backoff = backoffMs, task = false) {
|
|
41499
41565
|
if (!Number.isSafeInteger(attempt2) || attempt2 < 1 || failure2.level === 3) return { pause: "needs-review" };
|
|
41500
41566
|
const of = failure2.level === 1 ? 2 : 4;
|
|
41501
41567
|
if (attempt2 >= of) return { pause: "limit" };
|
|
41502
41568
|
const delay3 = failure2.retryAfterMs;
|
|
41503
41569
|
const valid = delay3 !== void 0 && !Number.isNaN(delay3) && delay3 >= 0;
|
|
41504
41570
|
const wait = valid ? delay3 : failure2.level === 1 ? 0 : backoff(attempt2 + 1);
|
|
41505
|
-
|
|
41571
|
+
const cap = task && failure2.code === "rate_limited" && valid ? 24 * 60 * 6e4 : CAP_MS;
|
|
41572
|
+
if (wait > cap) return { pause: "wait-too-long" };
|
|
41506
41573
|
return { plan: { at: now + wait, of, failure: failure2 } };
|
|
41507
41574
|
}
|
|
41508
41575
|
function readFailure(raw) {
|
|
@@ -41511,12 +41578,12 @@ function readFailure(raw) {
|
|
|
41511
41578
|
if (typeof code !== "string" || !code || typeof reason !== "string" || level2 !== 1 && level2 !== 2 && level2 !== 3) return;
|
|
41512
41579
|
return { code, level: level2, reason, ...["validation", "provider", "harness", "invariant"].some((value) => value === source2) ? { source: source2 } : {}, ...typeof retryAfterMs2 === "number" && retryAfterMs2 >= 0 ? { retryAfterMs: retryAfterMs2 } : {} };
|
|
41513
41580
|
}
|
|
41514
|
-
function readRetryPlan(raw, attempt2) {
|
|
41581
|
+
function readRetryPlan(raw, attempt2, task = false) {
|
|
41515
41582
|
if (!raw || typeof raw !== "object") return;
|
|
41516
41583
|
const { at, of, failure: rawFailure } = raw;
|
|
41517
41584
|
const failure2 = readFailure(rawFailure);
|
|
41518
41585
|
if (!failure2 || typeof at !== "number" || !Number.isFinite(at)) return;
|
|
41519
|
-
const decision = planRetry(failure2, attempt2);
|
|
41586
|
+
const decision = planRetry(failure2, attempt2, Date.now(), backoffMs, task);
|
|
41520
41587
|
if ("plan" in decision && of === decision.plan.of) return { at, of, failure: failure2 };
|
|
41521
41588
|
}
|
|
41522
41589
|
function pauseLine(pause2, zh = translating()) {
|
|
@@ -41870,8 +41937,8 @@ var init_package = __esm({
|
|
|
41870
41937
|
"package.json"() {
|
|
41871
41938
|
package_default = {
|
|
41872
41939
|
name: "wildcrane",
|
|
41873
|
-
version: "0.11.
|
|
41874
|
-
akbContract:
|
|
41940
|
+
version: "0.11.81",
|
|
41941
|
+
akbContract: 27,
|
|
41875
41942
|
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.",
|
|
41876
41943
|
keywords: [
|
|
41877
41944
|
"kanban",
|
|
@@ -42890,6 +42957,7 @@ function antigravityPrices(at) {
|
|
|
42890
42957
|
return {
|
|
42891
42958
|
"gemini-4-carbon": { input: pro, cachedInput: pro / 20, output: pro * 5 },
|
|
42892
42959
|
"gemini-4-argon": { input: pro, cachedInput: pro / 20, output: pro * 5 },
|
|
42960
|
+
"gemini-4-neon": { input: 3, cachedInput: 0.15, output: 15 },
|
|
42893
42961
|
"gemini-4-hydrogen": { input: 1.5, cachedInput: 0.075, output: 7.5 },
|
|
42894
42962
|
"gemini-3.8-flash": { input: flash, cachedInput: flash / 10, output: flash * 5 }
|
|
42895
42963
|
};
|
|
@@ -43231,8 +43299,36 @@ function bytesField(data, field2) {
|
|
|
43231
43299
|
if (number4 === field2 && value instanceof Uint8Array) return value;
|
|
43232
43300
|
}
|
|
43233
43301
|
}
|
|
43302
|
+
function varintField(data, field2) {
|
|
43303
|
+
if (!(data instanceof Uint8Array)) return;
|
|
43304
|
+
for (const [number4, value] of fields(data)) {
|
|
43305
|
+
if (number4 === field2 && typeof value === "number") return value;
|
|
43306
|
+
}
|
|
43307
|
+
}
|
|
43308
|
+
function stepIndices(data) {
|
|
43309
|
+
const out = [];
|
|
43310
|
+
for (const [field2, value] of fields(data)) {
|
|
43311
|
+
if (field2 !== 2) continue;
|
|
43312
|
+
if (typeof value === "number") out.push(value);
|
|
43313
|
+
else {
|
|
43314
|
+
const offset = { value: 0 };
|
|
43315
|
+
while (offset.value < value.length) out.push(varint(value, offset));
|
|
43316
|
+
}
|
|
43317
|
+
}
|
|
43318
|
+
return out;
|
|
43319
|
+
}
|
|
43320
|
+
function recordedContextLimit(data) {
|
|
43321
|
+
const limit = varintField(bytesField(bytesField(bytesField(data, 1), 9), 10), 4);
|
|
43322
|
+
return limit !== void 0 && Number.isSafeInteger(limit) && limit > 0 ? limit : void 0;
|
|
43323
|
+
}
|
|
43324
|
+
function stepUuid(stepRow, index) {
|
|
43325
|
+
if (!Number.isSafeInteger(index) || index < 0) return;
|
|
43326
|
+
const id2 = bytesField(stepRow.get(index)?.metadata, 12);
|
|
43327
|
+
return id2?.length === 36 ? id2 : void 0;
|
|
43328
|
+
}
|
|
43234
43329
|
function antigravityRecordedModels(session, steps) {
|
|
43235
43330
|
const found2 = /* @__PURE__ */ new Map();
|
|
43331
|
+
if (!steps.size) return found2;
|
|
43236
43332
|
const file2 = antigravityConversationFile(session);
|
|
43237
43333
|
if (!file2 || !existsSync(file2)) return found2;
|
|
43238
43334
|
try {
|
|
@@ -43240,26 +43336,31 @@ function antigravityRecordedModels(session, steps) {
|
|
|
43240
43336
|
if (!sqlite) return found2;
|
|
43241
43337
|
const db = new sqlite.DatabaseSync(file2, { readOnly: true });
|
|
43242
43338
|
try {
|
|
43243
|
-
const
|
|
43339
|
+
const stepRow = db.prepare("SELECT metadata FROM steps WHERE idx = ?");
|
|
43340
|
+
const promptIds = /* @__PURE__ */ new Map();
|
|
43341
|
+
const promptUuid = (prompt) => {
|
|
43342
|
+
if (!promptIds.has(prompt)) promptIds.set(prompt, stepUuid(stepRow, prompt));
|
|
43343
|
+
return promptIds.get(prompt);
|
|
43344
|
+
};
|
|
43345
|
+
const groups = /* @__PURE__ */ new Map();
|
|
43346
|
+
for (const [index, { prompt }] of steps) {
|
|
43347
|
+
if (!Number.isSafeInteger(index) || index < 0) continue;
|
|
43348
|
+
const id2 = stepUuid(stepRow, index) ?? promptUuid(prompt);
|
|
43349
|
+
if (!id2) continue;
|
|
43350
|
+
const uuid3 = utf8(id2);
|
|
43351
|
+
let group = groups.get(uuid3);
|
|
43352
|
+
if (!group) groups.set(uuid3, group = { id: id2, steps: /* @__PURE__ */ new Set() });
|
|
43353
|
+
group.steps.add(index);
|
|
43354
|
+
}
|
|
43244
43355
|
const generations = db.prepare("SELECT data FROM gen_metadata WHERE instr(data, ?) > 0");
|
|
43245
|
-
for (const
|
|
43246
|
-
const id2 = bytesField(prompt.get(index)?.metadata, 12);
|
|
43247
|
-
if (id2?.length !== 36) continue;
|
|
43356
|
+
for (const [uuid3, { id: id2, steps: groupSteps }] of groups) {
|
|
43248
43357
|
const key = Buffer.concat([Buffer.from([34, 36]), id2]);
|
|
43249
43358
|
for (const { data } of generations.iterate(key)) {
|
|
43250
|
-
if (!(data instanceof Uint8Array) || utf8(bytesField(data, 4)) !==
|
|
43359
|
+
if (!(data instanceof Uint8Array) || utf8(bytesField(data, 4)) !== uuid3) continue;
|
|
43251
43360
|
const model = utf8(bytesField(bytesField(data, 1), 19)) || void 0;
|
|
43252
|
-
const
|
|
43253
|
-
if (
|
|
43361
|
+
for (const step of stepIndices(data)) {
|
|
43362
|
+
if (!groupSteps.has(step)) continue;
|
|
43254
43363
|
found2.set(step, found2.has(step) && found2.get(step) !== model ? void 0 : model);
|
|
43255
|
-
};
|
|
43256
|
-
for (const [field2, value] of fields(data)) {
|
|
43257
|
-
if (field2 !== 2) continue;
|
|
43258
|
-
if (typeof value === "number") record2(value);
|
|
43259
|
-
else {
|
|
43260
|
-
const offset = { value: 0 };
|
|
43261
|
-
while (offset.value < value.length) record2(varint(value, offset));
|
|
43262
|
-
}
|
|
43263
43364
|
}
|
|
43264
43365
|
}
|
|
43265
43366
|
}
|
|
@@ -43271,6 +43372,38 @@ function antigravityRecordedModels(session, steps) {
|
|
|
43271
43372
|
return /* @__PURE__ */ new Map();
|
|
43272
43373
|
}
|
|
43273
43374
|
}
|
|
43375
|
+
function antigravityRecordedContextLimit(session, step, prompt) {
|
|
43376
|
+
if (!Number.isSafeInteger(step) || step < 0) return;
|
|
43377
|
+
const file2 = antigravityConversationFile(session);
|
|
43378
|
+
if (!file2 || !existsSync(file2)) return;
|
|
43379
|
+
try {
|
|
43380
|
+
const sqlite = process.getBuiltinModule?.("node:sqlite");
|
|
43381
|
+
if (!sqlite) return;
|
|
43382
|
+
const db = new sqlite.DatabaseSync(file2, { readOnly: true });
|
|
43383
|
+
try {
|
|
43384
|
+
const stepRow = db.prepare("SELECT metadata FROM steps WHERE idx = ?");
|
|
43385
|
+
const id2 = stepUuid(stepRow, step) ?? stepUuid(stepRow, prompt);
|
|
43386
|
+
if (!id2) return;
|
|
43387
|
+
const key = Buffer.concat([Buffer.from([34, 36]), id2]);
|
|
43388
|
+
const generations = db.prepare("SELECT data FROM gen_metadata WHERE instr(data, ?) > 0");
|
|
43389
|
+
let found2;
|
|
43390
|
+
let matched = false;
|
|
43391
|
+
for (const { data } of generations.iterate(key)) {
|
|
43392
|
+
if (!(data instanceof Uint8Array) || utf8(bytesField(data, 4)) !== utf8(id2)) continue;
|
|
43393
|
+
if (!stepIndices(data).includes(step)) continue;
|
|
43394
|
+
const limit = recordedContextLimit(data);
|
|
43395
|
+
if (matched && found2 !== limit) return;
|
|
43396
|
+
found2 = limit;
|
|
43397
|
+
matched = true;
|
|
43398
|
+
}
|
|
43399
|
+
return found2;
|
|
43400
|
+
} finally {
|
|
43401
|
+
db.close();
|
|
43402
|
+
}
|
|
43403
|
+
} catch {
|
|
43404
|
+
return;
|
|
43405
|
+
}
|
|
43406
|
+
}
|
|
43274
43407
|
var utf8;
|
|
43275
43408
|
var init_antigravity_session = __esm({
|
|
43276
43409
|
"src/lib/agent/wire/antigravity-session.ts"() {
|
|
@@ -43305,6 +43438,20 @@ function createAntigravityRenderer(expectedSession, cwd = process.cwd()) {
|
|
|
43305
43438
|
let stderr = "";
|
|
43306
43439
|
let context;
|
|
43307
43440
|
let contextStep = -1;
|
|
43441
|
+
let contextPrompt = -1;
|
|
43442
|
+
let contextLimitStep = -1;
|
|
43443
|
+
let contextLimitLookedAt = 0;
|
|
43444
|
+
const resolveContextLimit = (now) => {
|
|
43445
|
+
if (!context || !session || contextStep < 0 || contextLimitStep === contextStep) return;
|
|
43446
|
+
const at = Date.now();
|
|
43447
|
+
if (!now && at - contextLimitLookedAt < CONTEXT_LOOK_EVERY_MS) return;
|
|
43448
|
+
contextLimitLookedAt = at;
|
|
43449
|
+
const limit = antigravityRecordedContextLimit(session, contextStep, contextPrompt);
|
|
43450
|
+
if (limit !== void 0) {
|
|
43451
|
+
context = { used: context.used, limit };
|
|
43452
|
+
contextLimitStep = contextStep;
|
|
43453
|
+
}
|
|
43454
|
+
};
|
|
43308
43455
|
const started = Date.now();
|
|
43309
43456
|
let cost;
|
|
43310
43457
|
let incomplete = false;
|
|
@@ -43370,10 +43517,13 @@ function createAntigravityRenderer(expectedSession, cwd = process.cwd()) {
|
|
|
43370
43517
|
const index = num2(step.step_index);
|
|
43371
43518
|
if (step.state === "DONE" && Number.isSafeInteger(index) && step.step_index === index && index > contextStep) {
|
|
43372
43519
|
contextStep = index;
|
|
43520
|
+
contextPrompt = prompt;
|
|
43521
|
+
contextLimitStep = -1;
|
|
43522
|
+
contextLimitLookedAt = 0;
|
|
43373
43523
|
const u = obj2(step.usage);
|
|
43374
43524
|
const counts = [u.input_tokens, u.cache_read_tokens];
|
|
43375
|
-
const
|
|
43376
|
-
context =
|
|
43525
|
+
const promptTokens = counts.every((n) => typeof n === "number" && Number.isFinite(n) && n >= 0) ? num2(u.input_tokens) + num2(u.cache_read_tokens) : 0;
|
|
43526
|
+
context = promptTokens > 0 && Number.isFinite(promptTokens) ? { used: promptTokens } : void 0;
|
|
43377
43527
|
}
|
|
43378
43528
|
if (step.state === "DONE" && step.usage && !counted.has(index)) {
|
|
43379
43529
|
counted.add(index);
|
|
@@ -43426,6 +43576,7 @@ ${imageError(target, reason || str2(step.state))}
|
|
|
43426
43576
|
return "";
|
|
43427
43577
|
}
|
|
43428
43578
|
session ||= str2(result.conversation_id) || void 0;
|
|
43579
|
+
resolveContextLimit(true);
|
|
43429
43580
|
terminal = true;
|
|
43430
43581
|
final = typeof result.response === "string" ? result.response : void 0;
|
|
43431
43582
|
const total = usageOf(result.usage);
|
|
@@ -43457,6 +43608,7 @@ ${imageError(target, reason || str2(step.state))}
|
|
|
43457
43608
|
},
|
|
43458
43609
|
flush() {
|
|
43459
43610
|
const text5 = reader.flush();
|
|
43611
|
+
resolveContextLimit(true);
|
|
43460
43612
|
if (pendingCosts.size) {
|
|
43461
43613
|
const models = session ? antigravityRecordedModels(session, pendingCosts) : void 0;
|
|
43462
43614
|
for (const [index, { usage: usage3 }] of pendingCosts) estimate(models?.get(index), usage3);
|
|
@@ -43479,7 +43631,10 @@ ${imageError(target, reason || str2(step.state))}
|
|
|
43479
43631
|
usage: () => used,
|
|
43480
43632
|
costUsd: () => cost,
|
|
43481
43633
|
costIncomplete: () => incomplete || void 0,
|
|
43482
|
-
context: () =>
|
|
43634
|
+
context: () => {
|
|
43635
|
+
resolveContextLimit(false);
|
|
43636
|
+
return context;
|
|
43637
|
+
},
|
|
43483
43638
|
failure: () => failure2 || imageFailure,
|
|
43484
43639
|
terminalFailure: () => terminal && !!classified,
|
|
43485
43640
|
executionFailure: () => classified ?? (imageFailure ? { code: "image_read_failed", level: 3, reason: imageFailure } : void 0),
|
|
@@ -43487,7 +43642,7 @@ ${imageError(target, reason || str2(step.state))}
|
|
|
43487
43642
|
activity: events.activity
|
|
43488
43643
|
};
|
|
43489
43644
|
}
|
|
43490
|
-
var KINDS, zero, usageOf, add, imagePath;
|
|
43645
|
+
var CONTEXT_LOOK_EVERY_MS, KINDS, zero, usageOf, add, imagePath;
|
|
43491
43646
|
var init_antigravity = __esm({
|
|
43492
43647
|
"src/lib/agent/wire/antigravity.ts"() {
|
|
43493
43648
|
"use strict";
|
|
@@ -43497,6 +43652,7 @@ var init_antigravity = __esm({
|
|
|
43497
43652
|
init_json();
|
|
43498
43653
|
init_stream();
|
|
43499
43654
|
init_antigravity_session();
|
|
43655
|
+
CONTEXT_LOOK_EVERY_MS = 250;
|
|
43500
43656
|
KINDS = {
|
|
43501
43657
|
run_command: "execute",
|
|
43502
43658
|
command_status: "execute",
|
|
@@ -48419,8 +48575,8 @@ edits here do not last.
|
|
|
48419
48575
|
});
|
|
48420
48576
|
|
|
48421
48577
|
// src/lib/agents/index.ts
|
|
48422
|
-
function agentLines(agent,
|
|
48423
|
-
const said2 = agent.i18n[
|
|
48578
|
+
function agentLines(agent, language2 = readLanguage()) {
|
|
48579
|
+
const said2 = agent.i18n[language2];
|
|
48424
48580
|
return {
|
|
48425
48581
|
title: said2?.title || agent.i18n.en?.title || "",
|
|
48426
48582
|
description: said2?.description || agent.description
|
|
@@ -49188,6 +49344,47 @@ var init_roster = __esm({
|
|
|
49188
49344
|
}
|
|
49189
49345
|
});
|
|
49190
49346
|
|
|
49347
|
+
// src/lib/shared/delivery-evidence.ts
|
|
49348
|
+
function approvedCardRequirements(text5) {
|
|
49349
|
+
const { meta: meta3, body } = parseFrontmatter(text5);
|
|
49350
|
+
const out = [];
|
|
49351
|
+
if (meta3?.title) out.push(`# ${meta3.title}`, "");
|
|
49352
|
+
const opening = [];
|
|
49353
|
+
const sections = [];
|
|
49354
|
+
let keeping = false;
|
|
49355
|
+
let started = false;
|
|
49356
|
+
for (const line of body.split("\n")) {
|
|
49357
|
+
if (/^##(?!#)\s/.test(line)) {
|
|
49358
|
+
started = true;
|
|
49359
|
+
keeping = isApproved(line);
|
|
49360
|
+
if (keeping) sections.push("", line);
|
|
49361
|
+
continue;
|
|
49362
|
+
}
|
|
49363
|
+
if (line.trim() === "<!-- agent -->") continue;
|
|
49364
|
+
if (!started) opening.push(line);
|
|
49365
|
+
else if (keeping) sections.push(line);
|
|
49366
|
+
}
|
|
49367
|
+
out.push(opening.join("\n").trim());
|
|
49368
|
+
out.push(sections.join("\n").trim());
|
|
49369
|
+
return out.filter(Boolean).join("\n\n").replace(/\n{3,}/g, "\n\n").trim() + "\n";
|
|
49370
|
+
}
|
|
49371
|
+
var APPROVED, isApproved;
|
|
49372
|
+
var init_delivery_evidence = __esm({
|
|
49373
|
+
"src/lib/shared/delivery-evidence.ts"() {
|
|
49374
|
+
"use strict";
|
|
49375
|
+
init_frontmatter();
|
|
49376
|
+
APPROVED = [
|
|
49377
|
+
/^##\s+Worth noting\s*$/i,
|
|
49378
|
+
/^##\s+Scope\s*$/i,
|
|
49379
|
+
/^##\s+Scope out\s*$/i,
|
|
49380
|
+
// `skill` is the word a spec section carries now; `agent` is the word it carried before
|
|
49381
|
+
// #403, and a card written by an older release still has to travel whole.
|
|
49382
|
+
/^##\s+By\s+`[^`]+`\s+(skill|agent)\s*$/i
|
|
49383
|
+
];
|
|
49384
|
+
isApproved = (heading) => APPROVED.some((re) => re.test(heading));
|
|
49385
|
+
}
|
|
49386
|
+
});
|
|
49387
|
+
|
|
49191
49388
|
// src/lib/agent/candidate.ts
|
|
49192
49389
|
function candidateBase() {
|
|
49193
49390
|
return git(["rev-parse", "HEAD"])?.trim() || null;
|
|
@@ -49502,6 +49699,7 @@ function parseStore() {
|
|
|
49502
49699
|
runs.push({
|
|
49503
49700
|
sessionId: entry.sessionId,
|
|
49504
49701
|
cloudExecution: executionOf(entry.cloudExecution ?? null),
|
|
49702
|
+
pendingWrites: entry.pendingWrites === true || void 0,
|
|
49505
49703
|
cardId: typeof entry.cardId === "number" ? entry.cardId : null,
|
|
49506
49704
|
createdCardIds: Array.isArray(entry.createdCardIds) ? [...new Set(entry.createdCardIds.filter((id2) => Number.isInteger(id2) && id2 > 0))] : void 0,
|
|
49507
49705
|
discard: entry.discard === true || void 0,
|
|
@@ -49557,7 +49755,7 @@ function parseStore() {
|
|
|
49557
49755
|
resumedFrom: typeof entry.resumedFrom === "string" ? entry.resumedFrom : void 0,
|
|
49558
49756
|
continues: typeof entry.continues?.resumeId === "string" && entry.continues.resumeId ? { resumeId: entry.continues.resumeId, ...entry.continues.fork === true ? { fork: true } : {} } : void 0,
|
|
49559
49757
|
formatRepair: entry.formatRepair && typeof entry.formatRepair === "object" && Number.isInteger(entry.formatRepair.attempt) && entry.formatRepair.attempt >= 0 && typeof entry.formatRepair.errors === "string" && [entry.formatRepair.cardIds, entry.formatRepair.changedIds, entry.formatRepair.existingIds].every((ids) => Array.isArray(ids) && ids.every(Number.isInteger)) ? entry.formatRepair : void 0,
|
|
49560
|
-
retry: readRetry2(entry.retry),
|
|
49758
|
+
retry: readRetry2(entry.retry, !!executionOf(entry.cloudExecution ?? null)),
|
|
49561
49759
|
priorStatus: typeof entry.priorStatus === "string" ? entry.priorStatus : void 0,
|
|
49562
49760
|
// The pictures the create sheet handed this run (#517), as paths in its own folder.
|
|
49563
49761
|
pictures: readPictures(entry.pictures),
|
|
@@ -49599,11 +49797,11 @@ function readReasons(raw) {
|
|
|
49599
49797
|
});
|
|
49600
49798
|
return reasons.length ? reasons : void 0;
|
|
49601
49799
|
}
|
|
49602
|
-
function readRetry2(raw) {
|
|
49800
|
+
function readRetry2(raw, task) {
|
|
49603
49801
|
if (!raw || typeof raw !== "object") return void 0;
|
|
49604
49802
|
const r = raw;
|
|
49605
49803
|
const whole2 = Number.isInteger(r.attempt) && r.attempt > 0 && Number.isInteger(r.of) && r.of > 0 && typeof r.reason === "string" && !!r.reason && typeof r.at === "number" && typeof r.since === "number";
|
|
49606
|
-
return whole2 ? { attempt: r.attempt, of: r.of, reason: r.reason, at: r.at, since: r.since, pending: readRetryPlan(r.pending, r.attempt), launching: r.launching === true || void 0 } : void 0;
|
|
49804
|
+
return whole2 ? { attempt: r.attempt, of: r.of, reason: r.reason, at: r.at, since: r.since, pending: readRetryPlan(r.pending, r.attempt, task), launching: r.launching === true || void 0 } : void 0;
|
|
49607
49805
|
}
|
|
49608
49806
|
function readMarks(raw) {
|
|
49609
49807
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return {};
|
|
@@ -50230,6 +50428,12 @@ function allAudits() {
|
|
|
50230
50428
|
}
|
|
50231
50429
|
return out;
|
|
50232
50430
|
}
|
|
50431
|
+
function cardAudits(cardId2) {
|
|
50432
|
+
return allAudits().filter((a) => a.cardId === cardId2).flatMap((a) => {
|
|
50433
|
+
const row = auditRow(a);
|
|
50434
|
+
return row ? [row] : [];
|
|
50435
|
+
}).sort((a, b) => a.startedAt - b.startedAt);
|
|
50436
|
+
}
|
|
50233
50437
|
function landedDeliveries(filter = {}) {
|
|
50234
50438
|
const out = [];
|
|
50235
50439
|
for (const audit of allAudits()) {
|
|
@@ -50391,27 +50595,7 @@ function approvedRequirements(cardId2) {
|
|
|
50391
50595
|
} catch {
|
|
50392
50596
|
return "";
|
|
50393
50597
|
}
|
|
50394
|
-
|
|
50395
|
-
const out = [];
|
|
50396
|
-
if (meta3?.title) out.push(`# ${meta3.title}`, "");
|
|
50397
|
-
const opening = [];
|
|
50398
|
-
const sections = [];
|
|
50399
|
-
let keeping = false;
|
|
50400
|
-
let started = false;
|
|
50401
|
-
for (const line of body.split("\n")) {
|
|
50402
|
-
if (/^##(?!#)\s/.test(line)) {
|
|
50403
|
-
started = true;
|
|
50404
|
-
keeping = isApproved(line);
|
|
50405
|
-
if (keeping) sections.push("", line);
|
|
50406
|
-
continue;
|
|
50407
|
-
}
|
|
50408
|
-
if (line.trim() === "<!-- agent -->") continue;
|
|
50409
|
-
if (!started) opening.push(line);
|
|
50410
|
-
else if (keeping) sections.push(line);
|
|
50411
|
-
}
|
|
50412
|
-
out.push(opening.join("\n").trim());
|
|
50413
|
-
out.push(sections.join("\n").trim());
|
|
50414
|
-
return out.filter(Boolean).join("\n\n").replace(/\n{3,}/g, "\n\n").trim() + "\n";
|
|
50598
|
+
return approvedCardRequirements(text5);
|
|
50415
50599
|
}
|
|
50416
50600
|
function cardMeta2(cardId2) {
|
|
50417
50601
|
try {
|
|
@@ -50550,7 +50734,7 @@ function heldByDelivery(cardId2, program2) {
|
|
|
50550
50734
|
const doing = state.paused ? `is waiting on you on #${cardId2} \u2014 ${state.line} \u2014 so the board won't change the card. ${answer2} Or take the card back with ` : `is in flight on #${cardId2} \u2014 it is building the card as it was approved when it started, so the board won't change it. Take the card back with `;
|
|
50551
50735
|
return `delivery ${delivery.deliveryId} ${doing}Discard on the card page, or \`${cmd} raw delivery cancel ${delivery.deliveryId}\` to end it here.`;
|
|
50552
50736
|
}
|
|
50553
|
-
var auditPath, activeAudits, auditRow, lastSessionRunning, localAudit, unknownDelivery, isResumable,
|
|
50737
|
+
var auditPath, activeAudits, auditRow, lastSessionRunning, localAudit, unknownDelivery, isResumable, cardStatus, openQuestions, activeIn, listDeliveries, withStudio;
|
|
50554
50738
|
var init_deliveries = __esm({
|
|
50555
50739
|
"src/lib/agent/deliveries.ts"() {
|
|
50556
50740
|
"use strict";
|
|
@@ -50558,6 +50742,7 @@ var init_deliveries = __esm({
|
|
|
50558
50742
|
init_cards();
|
|
50559
50743
|
init_revision();
|
|
50560
50744
|
init_frontmatter();
|
|
50745
|
+
init_delivery_evidence();
|
|
50561
50746
|
init_paths();
|
|
50562
50747
|
init_candidate();
|
|
50563
50748
|
init_command();
|
|
@@ -50578,15 +50763,6 @@ var init_deliveries = __esm({
|
|
|
50578
50763
|
localAudit = (audit) => worktreeExists(audit.worktree) || audit.sessions.some((session) => path48.resolve(REPO_ROOT, session.log) === logPathOf(session.sessionId) && fs47.existsSync(logPathOf(session.sessionId)));
|
|
50579
50764
|
unknownDelivery = (id2) => refusal("deliveryNotFound", `no delivery here answers to "${id2}"`, { id: id2 });
|
|
50580
50765
|
isResumable = (delivery) => !resumeRefusal(delivery);
|
|
50581
|
-
APPROVED = [
|
|
50582
|
-
/^##\s+Worth noting\s*$/i,
|
|
50583
|
-
/^##\s+Scope\s*$/i,
|
|
50584
|
-
/^##\s+Scope out\s*$/i,
|
|
50585
|
-
// `skill` is the word a spec section carries now; `agent` is the word it carried before
|
|
50586
|
-
// #403, and a card written by an older release still has to travel whole.
|
|
50587
|
-
/^##\s+By\s+`[^`]+`\s+(skill|agent)\s*$/i
|
|
50588
|
-
];
|
|
50589
|
-
isApproved = (heading) => APPROVED.some((re) => re.test(heading));
|
|
50590
50766
|
cardStatus = (cardId2) => cardMeta2(cardId2)?.status || "todo";
|
|
50591
50767
|
openQuestions = (cardId2) => cardMeta2(cardId2)?.questions.length ?? 0;
|
|
50592
50768
|
activeIn = (store, cardId2) => store.deliveries.find((d) => d.status === "active" && d.cardId === cardId2);
|
|
@@ -50859,13 +51035,13 @@ function languageEnv(given) {
|
|
|
50859
51035
|
}
|
|
50860
51036
|
return env2;
|
|
50861
51037
|
}
|
|
50862
|
-
function withSystemLanguage(harness, argv, env2,
|
|
51038
|
+
function withSystemLanguage(harness, argv, env2, language2) {
|
|
50863
51039
|
env2 = languageEnv(env2);
|
|
50864
|
-
const text5 = systemLanguage(
|
|
51040
|
+
const text5 = systemLanguage(language2);
|
|
50865
51041
|
if (!text5) return { argv, env: env2 };
|
|
50866
51042
|
const added = argv.length ? harness.systemPrompt?.(text5, argv, env2) : void 0;
|
|
50867
51043
|
if (!added?.args?.length && !Object.keys(added?.env ?? {}).length) {
|
|
50868
|
-
const note =
|
|
51044
|
+
const note = language2 === "zh" ? "\u8BED\u8A00\u89C4\u5219\u672A\u80FD\u66F4\u65B0\uFF1A\u8FDE\u63A5\u5668\u3001\u5DF2\u6709\u4F1A\u8BDD\u6216\u81EA\u8BBE\u7CFB\u7EDF\u63D0\u793A\u8BCD\u4E0D\u652F\u6301\u6CE8\u5165\u3002\u8BF7\u81EA\u884C\u53E6\u5F00\u652F\u6301\u7684\u4F1A\u8BDD\u4EE5\u91C7\u7528\u65B0\u89C4\u5219\u3002" : "Language rules could not be updated: the connector, existing session, or custom system prompt prevents injection. Open a supported new session to apply them.";
|
|
50869
51045
|
return { argv, env: env2, note };
|
|
50870
51046
|
}
|
|
50871
51047
|
const at = /^node(?:\.exe)?$/.test(path49.basename(argv[0])) && argv[1] && !argv[1].startsWith("-") ? 2 : 1;
|
|
@@ -51343,7 +51519,7 @@ var init_pictures = __esm({
|
|
|
51343
51519
|
var Asset_default;
|
|
51344
51520
|
var init_Asset = __esm({
|
|
51345
51521
|
"src/components/Asset.md"() {
|
|
51346
|
-
Asset_default = '# Asset\n\nShow a file as a Preview with `<Asset src=".assets/<card id>/<file>" label="..." />` alone in a paragraph.\nInline and fenced examples remain text.\n\n- **Label**: use a few words; an image\'s optional `alt` is its shipped caption and cannot contain `<`, `>` or its enclosing quote.\n- **Device**: use a separate tag for each device view, with `device="mobile"` or `device="desktop"`; both may reference the same responsive page.\n- **Variants**: versions of the same content on the same device share one tag with `variants=\'{"English": ".assets/<card id>/page.en.html", "\u4E2D\u6587": ".assets/<card id>/page.zh.html"}\'`, with `src` shown first; alternatives stay separate tags.\n- **Loop**: add `loop` for muted, looping video without controls.\n- **Tiled map**: a `.tmx` or `.tmj` `src` draws as a map; keep its `.tsx`/`.tsj` tilesets and images beside it, at the relative paths it names.\n- **Sprite animation**: a TexturePacker JSON (Hash or Array) `src` plays as an animation; keep its sheet image beside it, at the relative path `meta.image` names.\n- **Web page**: an `.html` or `.htm` `src` loads only the relative paths named in its tags and styles.\n- **Mermaid**: a `.mmd` or `.mermaid` `src` draws a diagram and shows its source if it cannot render.\n- **Excel**: a `.xlsx` draws a read-only workbook with sheet tabs, formulas, and saved results.\n- **Text**: code and other text files show as highlighted text; a `.diff` or `.patch` shows its added and removed lines.\n';
|
|
51522
|
+
Asset_default = '# Asset\n\nShow a file as a Preview with `<Asset src=".assets/<card id>/<file>" label="..." />` alone in a paragraph.\nInline and fenced examples remain text.\n\n- **Label**: use a few words; an image\'s optional `alt` is its shipped caption and cannot contain `<`, `>` or its enclosing quote.\n- **Device**: use a separate tag for each device view, with `device="mobile"` or `device="desktop"`; both may reference the same responsive page.\n- **Variants**: versions of the same content on the same device share one tag with `variants=\'{"English": ".assets/<card id>/page.en.html", "\u4E2D\u6587": ".assets/<card id>/page.zh.html"}\'`, with `src` shown first; alternatives stay separate tags.\n- **Loop**: add `loop` for muted, looping video without controls.\n- **Tiled map**: a `.tmx` or `.tmj` `src` draws as a map; keep its `.tsx`/`.tsj` tilesets and images beside it, at the relative paths it names.\n- **Sprite animation**: a TexturePacker JSON (Hash or Array) `src` plays as an animation; keep its sheet image beside it, at the relative path `meta.image` names.\n- **Web page**: an `.html` or `.htm` `src` loads only the relative paths named in its tags and styles.\n- **Mermaid**: a `.mmd` or `.mermaid` `src` draws a diagram and shows its source if it cannot render.\n- **Documents**: PDF, DOCX, and PPTX open in a read-only viewer with page and zoom controls. DOCX and PPTX previews use LibreOffice and the fonts installed on the Runner. The original remains downloadable.\n- **Excel**: a `.xlsx` draws a read-only workbook with sheet tabs, formulas, and saved results.\n- **Text**: code and other text files show as highlighted text; a `.diff` or `.patch` shows its added and removed lines.\n';
|
|
51347
51523
|
}
|
|
51348
51524
|
});
|
|
51349
51525
|
|
|
@@ -51971,21 +52147,27 @@ function endAgent(child, mark, graceMs) {
|
|
|
51971
52147
|
round(KILL_ROUNDS);
|
|
51972
52148
|
});
|
|
51973
52149
|
}
|
|
51974
|
-
function
|
|
52150
|
+
function probeProcesses(mark, root2) {
|
|
51975
52151
|
try {
|
|
51976
52152
|
if (WINDOWS3) {
|
|
51977
52153
|
const list3 = procsOnWindows();
|
|
51978
|
-
if (!list3
|
|
52154
|
+
if (!list3) return { ok: false, error: "\u65E0\u6CD5\u67E5\u8BE2\u8FDB\u7A0B\u5217\u8868\u3002" };
|
|
52155
|
+
if (!root2) return { ok: false, error: "\u7F3A\u5C11\u8FDB\u7A0B\u8D77\u70B9\uFF0C\u65E0\u6CD5\u6838\u5BF9\u9000\u51FA\u72B6\u6001\u3002" };
|
|
51979
52156
|
const current = list3.procs.find((p) => p.pid === root2.pid);
|
|
51980
|
-
if (current && current.startedAt > root2.since) return false;
|
|
51981
|
-
return startedUnder(list3, root2.pid, root2.since).length
|
|
52157
|
+
if (current && current.startedAt > root2.since) return { ok: false, error: "\u8FDB\u7A0B\u53F7\u5DF2\u88AB\u590D\u7528\u3002" };
|
|
52158
|
+
return { ok: true, alive: startedUnder(list3, root2.pid, root2.since).length > 0 };
|
|
51982
52159
|
}
|
|
51983
52160
|
const entry = `${mark.name}=${mark.value}`;
|
|
51984
|
-
|
|
51985
|
-
|
|
51986
|
-
|
|
52161
|
+
const pids = process.platform === "linux" ? markedInProc(entry, true, mark.since) : markedInPs(entry, root2 ? [root2.pid] : []);
|
|
52162
|
+
return { ok: true, alive: pids.length > 0 };
|
|
52163
|
+
} catch (e) {
|
|
52164
|
+
return { ok: false, error: e instanceof Error ? e.message : String(e) };
|
|
51987
52165
|
}
|
|
51988
52166
|
}
|
|
52167
|
+
function processesStopped(mark, root2) {
|
|
52168
|
+
const probed = probeProcesses(mark, root2);
|
|
52169
|
+
return probed.ok && !probed.alive;
|
|
52170
|
+
}
|
|
51989
52171
|
var runMark, WINDOWS3, KILL_ROUND_MS, KILL_ROUNDS, LIST_PROCS;
|
|
51990
52172
|
var init_stop = __esm({
|
|
51991
52173
|
"src/lib/agent/stop.ts"() {
|
|
@@ -52505,7 +52687,7 @@ async function openResume(id2, options) {
|
|
|
52505
52687
|
stopped: stopped2,
|
|
52506
52688
|
session,
|
|
52507
52689
|
replayable: !requireSession && neverStarted(prev),
|
|
52508
|
-
unconfirmedCleanup: prev.cleanup?.status === "unconfirmed" || prev.managedProcess && (pending?.failure ?? prev.failure)?.code === "idle_timeout" && !idleStopConfirmed(prev.cleanup, session)
|
|
52690
|
+
unconfirmedCleanup: prev.pendingWrites || prev.cleanup?.status === "unconfirmed" || prev.managedProcess && (pending?.failure ?? prev.failure)?.code === "idle_timeout" && !idleStopConfirmed(prev.cleanup, session)
|
|
52509
52691
|
});
|
|
52510
52692
|
if (recovery === "unsafe") {
|
|
52511
52693
|
if (pending) return retryRefusal(prev, "unsafe");
|
|
@@ -52812,6 +52994,152 @@ async function runIsDown(sessionId) {
|
|
|
52812
52994
|
await sleep3(STOP_POLL_MS);
|
|
52813
52995
|
}
|
|
52814
52996
|
}
|
|
52997
|
+
function verifyDeliveryRunsStopped(runs, deliveryId, cardId2) {
|
|
52998
|
+
const related = runs.filter(
|
|
52999
|
+
(r) => r.action !== "sub" && (r.deliveryId === deliveryId || r.cardId === cardId2 && holdsCard(r.action))
|
|
53000
|
+
);
|
|
53001
|
+
for (const r of related) {
|
|
53002
|
+
if (r.managedProcess) {
|
|
53003
|
+
if (!connectionStopped(r.agentPid ? { pid: r.agentPid, identity: r.agentIdentity } : void 0)) {
|
|
53004
|
+
return `Associated managed agent process for run ${r.sessionId} is still alive without an active watcher.`;
|
|
53005
|
+
}
|
|
53006
|
+
continue;
|
|
53007
|
+
}
|
|
53008
|
+
if (r.pid || r.agentPid) {
|
|
53009
|
+
const probed = probeProcesses(
|
|
53010
|
+
runMark(r.sessionId, r.agentStartedAt ?? r.startedAt),
|
|
53011
|
+
r.agentPid && r.agentStartedAt ? { pid: r.agentPid, since: r.agentStartedAt } : void 0
|
|
53012
|
+
);
|
|
53013
|
+
if (!probed.ok) return probed.error;
|
|
53014
|
+
if (probed.alive) {
|
|
53015
|
+
return `Associated delivery process for run ${r.sessionId} is still alive without an active watcher.`;
|
|
53016
|
+
}
|
|
53017
|
+
}
|
|
53018
|
+
}
|
|
53019
|
+
return void 0;
|
|
53020
|
+
}
|
|
53021
|
+
async function reconcileCardDelivery(cardId2) {
|
|
53022
|
+
const reaped = [];
|
|
53023
|
+
const restore = [];
|
|
53024
|
+
let result;
|
|
53025
|
+
try {
|
|
53026
|
+
result = withStore((store) => {
|
|
53027
|
+
reap(store.runs, reaped, restore);
|
|
53028
|
+
const file2 = cardFile(cardId2);
|
|
53029
|
+
const restoredRaw = file2 ? parseFrontmatter(fs51.readFileSync(file2, "utf8")).meta?.restored : void 0;
|
|
53030
|
+
const restoredAt = restoredRaw ? Date.parse(restoredRaw) : Number.NaN;
|
|
53031
|
+
const merged = /* @__PURE__ */ new Map();
|
|
53032
|
+
for (const audit of cardAudits(cardId2)) merged.set(audit.deliveryId, audit);
|
|
53033
|
+
for (const row of store.deliveries) {
|
|
53034
|
+
if (row.cardId === cardId2) merged.set(row.deliveryId, row);
|
|
53035
|
+
}
|
|
53036
|
+
const deliveries = [...merged.values()].filter((d) => !(Number.isFinite(restoredAt) && restoredAt > d.startedAt)).sort((a, b) => a.startedAt - b.startedAt);
|
|
53037
|
+
const activeOrLatest = deliveries.find((d) => d.status === "active") ?? deliveries.filter((d) => d.status !== "cancelled").pop();
|
|
53038
|
+
const liveRun = store.runs.find(
|
|
53039
|
+
(r) => r.status === "running" && r.action !== "sub" && !!r.deliveryId && (r.cardId === cardId2 || activeOrLatest && r.deliveryId === activeOrLatest.deliveryId)
|
|
53040
|
+
);
|
|
53041
|
+
if (liveRun) {
|
|
53042
|
+
return {
|
|
53043
|
+
kind: "running",
|
|
53044
|
+
deliveryId: liveRun.deliveryId ?? activeOrLatest?.deliveryId,
|
|
53045
|
+
sessionId: liveRun.sessionId,
|
|
53046
|
+
action: liveRun.action
|
|
53047
|
+
};
|
|
53048
|
+
}
|
|
53049
|
+
if (!activeOrLatest) return { kind: "none" };
|
|
53050
|
+
if (activeOrLatest.status === "finished" || activeOrLatest.completions?.some((c) => c.finished)) {
|
|
53051
|
+
const lastSession = activeOrLatest.sessions[activeOrLatest.sessions.length - 1];
|
|
53052
|
+
const code = activeOrLatest.completions?.slice().reverse().find((c) => c.commit);
|
|
53053
|
+
return {
|
|
53054
|
+
kind: "completed",
|
|
53055
|
+
deliveryId: activeOrLatest.deliveryId,
|
|
53056
|
+
sessionId: lastSession,
|
|
53057
|
+
commit: activeOrLatest.landing?.commit ?? code?.commit,
|
|
53058
|
+
branch: activeOrLatest.targetBranch ?? code?.branch
|
|
53059
|
+
};
|
|
53060
|
+
}
|
|
53061
|
+
const refused = resumeRefusal(activeOrLatest, store);
|
|
53062
|
+
if (refused) {
|
|
53063
|
+
return {
|
|
53064
|
+
kind: "unverified",
|
|
53065
|
+
deliveryId: activeOrLatest.deliveryId,
|
|
53066
|
+
diagnostic: refused.error
|
|
53067
|
+
};
|
|
53068
|
+
}
|
|
53069
|
+
const processError = verifyDeliveryRunsStopped(store.runs, activeOrLatest.deliveryId, cardId2);
|
|
53070
|
+
if (processError) {
|
|
53071
|
+
return {
|
|
53072
|
+
kind: "unverified",
|
|
53073
|
+
deliveryId: activeOrLatest.deliveryId,
|
|
53074
|
+
diagnostic: processError
|
|
53075
|
+
};
|
|
53076
|
+
}
|
|
53077
|
+
const lastRun = store.runs.filter((r) => r.deliveryId === activeOrLatest.deliveryId && r.action !== "sub").sort((a, b) => a.startedAt - b.startedAt).pop();
|
|
53078
|
+
return {
|
|
53079
|
+
kind: "resumable",
|
|
53080
|
+
deliveryId: activeOrLatest.deliveryId,
|
|
53081
|
+
status: activeOrLatest.status,
|
|
53082
|
+
sessionId: lastRun?.sessionId,
|
|
53083
|
+
hasSession: !!(lastRun && resumeSessionId(lastRun)),
|
|
53084
|
+
worktree: activeOrLatest.worktree,
|
|
53085
|
+
branch: activeOrLatest.branch,
|
|
53086
|
+
base: activeOrLatest.base
|
|
53087
|
+
};
|
|
53088
|
+
});
|
|
53089
|
+
} catch (error62) {
|
|
53090
|
+
return {
|
|
53091
|
+
kind: "unverified",
|
|
53092
|
+
diagnostic: error62 instanceof Error ? error62.message : String(error62)
|
|
53093
|
+
};
|
|
53094
|
+
}
|
|
53095
|
+
for (const run3 of restore) await restoreCardStatus(run3);
|
|
53096
|
+
for (const run3 of reaped) await settleDelivery(run3);
|
|
53097
|
+
return result;
|
|
53098
|
+
}
|
|
53099
|
+
async function releaseCardDelivery(cardId2) {
|
|
53100
|
+
const execution = executionOf();
|
|
53101
|
+
if (execution && !await executionHeld(execution)) {
|
|
53102
|
+
return { ok: false, error: "\u65E0\u6CD5\u786E\u8BA4\u5F53\u524D\u6267\u884C\u7684 Cloud \u6388\u6743\uFF0C\u65E0\u6CD5\u91CA\u653E\u539F\u4EA4\u4ED8\u5199\u9501\u3002" };
|
|
53103
|
+
}
|
|
53104
|
+
const reaped = [];
|
|
53105
|
+
const restore = [];
|
|
53106
|
+
let releasedDelivery;
|
|
53107
|
+
let outcome;
|
|
53108
|
+
try {
|
|
53109
|
+
outcome = withStore((store) => {
|
|
53110
|
+
reap(store.runs, reaped, restore);
|
|
53111
|
+
const active3 = activeIn(store, cardId2);
|
|
53112
|
+
if (!active3) return { ok: true, released: false };
|
|
53113
|
+
const liveRun = store.runs.find(
|
|
53114
|
+
(r) => r.status === "running" && r.action !== "sub" && (r.cardId === cardId2 || r.deliveryId === active3.deliveryId)
|
|
53115
|
+
);
|
|
53116
|
+
if (liveRun) {
|
|
53117
|
+
return {
|
|
53118
|
+
ok: false,
|
|
53119
|
+
deliveryId: active3.deliveryId,
|
|
53120
|
+
error: `\u539F\u4EA4\u4ED8\u4ECD\u6709\u8FD0\u884C\u4E2D\u7684\u8FDB\u7A0B (${liveRun.sessionId})\uFF0C\u65E0\u6CD5\u91CA\u653E\u5199\u9501\u3002`
|
|
53121
|
+
};
|
|
53122
|
+
}
|
|
53123
|
+
const processError = verifyDeliveryRunsStopped(store.runs, active3.deliveryId, cardId2);
|
|
53124
|
+
if (processError) {
|
|
53125
|
+
return { ok: false, deliveryId: active3.deliveryId, error: processError };
|
|
53126
|
+
}
|
|
53127
|
+
const at = Date.now();
|
|
53128
|
+
active3.status = "failed";
|
|
53129
|
+
active3.endedAt = at;
|
|
53130
|
+
active3.steps.push({ step: "released", at });
|
|
53131
|
+
writeAudit(active3, store.runs);
|
|
53132
|
+
releasedDelivery = { ...active3 };
|
|
53133
|
+
return { ok: true, released: true, deliveryId: active3.deliveryId };
|
|
53134
|
+
});
|
|
53135
|
+
} catch (error62) {
|
|
53136
|
+
return { ok: false, error: error62 instanceof Error ? error62.message : String(error62) };
|
|
53137
|
+
}
|
|
53138
|
+
for (const run3 of restore) await restoreCardStatus(run3);
|
|
53139
|
+
for (const run3 of reaped) await settleDelivery(run3);
|
|
53140
|
+
if (releasedDelivery) await releaseCard(releasedDelivery);
|
|
53141
|
+
return outcome;
|
|
53142
|
+
}
|
|
52815
53143
|
async function resumeDelivery(id2) {
|
|
52816
53144
|
if (!id2.trim()) return { ok: false, ...refusal("deliveryUnnamed", "name the delivery to carry on", { action: "resume" }) };
|
|
52817
53145
|
const execution = executionOf();
|
|
@@ -62024,7 +62352,7 @@ var init_describe_project = __esm({
|
|
|
62024
62352
|
var discuss_goal_default;
|
|
62025
62353
|
var init_discuss_goal = __esm({
|
|
62026
62354
|
"src/guide/discuss-goal.md"() {
|
|
62027
|
-
discuss_goal_default =
|
|
62355
|
+
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. 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.\n- **Select Previews**: choose Studio Previews for drafts or results that need review. Define a Goal Preview for a requested result the Studio lacks. Keep task context in the Goal body.\n- **Review** independent Previews in parallel by default. Use Studio or Goal Preview names, e.g. `--review \'Tech choices + UI design\'`. Add `->` when the next group needs the previous group\'s approvals. Verify the saved plan.\n- **Review state**: pass `--review \'\'` for no extra approval, leave the plan undecided while a decision is missing, and omit the option when keeping a saved plan.\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; its effective review arrangement governs output approval. Confirm changes to task-specific Preview definitions before making the affected output.\n- **Communication**: the remote user sees tasks and previews. Use plain words and button labels, omitting internal paths, commands and tools.\n\n## Goal format\n\nUse exactly these three fields on create and update. Include only what the user requested or confirmed.\n\nPass the one-line title separately with `--title`. Use this template for `--body-file`:\n\n```markdown\n<The requested outcome in at most 150 words.>\n\n## Done when\n\n- <A verifiable condition for the requested outcome.>\n```\n\n\n## Custom Preview definitions\n\nPass a JSON array with `--preview-definitions-file`. Use a stable ID, English and Chinese titles, and concise requirements. Omit the file to keep definitions, or pass `[]` to clear them.\n\n```json\n[{\n "id": "accessibility-report",\n "title": {"en": "Accessibility report", "zh": "\u65E0\u969C\u788D\u68C0\u67E5\u62A5\u544A"},\n "instructions": "Check keyboard navigation, visible focus and contrast. Include steps to reproduce issues."\n}]\n```\n\nUse the title in a Flow such as `--review \'UI design -> Accessibility report\'` when preparation requires an earlier approval.\n';
|
|
62028
62356
|
}
|
|
62029
62357
|
});
|
|
62030
62358
|
|
|
@@ -62040,7 +62368,7 @@ var init_follow_up = __esm({
|
|
|
62040
62368
|
var implement_default;
|
|
62041
62369
|
var init_implement = __esm({
|
|
62042
62370
|
"src/guide/implement.md"() {
|
|
62043
|
-
implement_default = "# Implement the approved requirements\n\nBuild the approved requirements without reopening settled decisions or unrelated questions; without a card, create none.\n\nDo not push, publish or deploy.\n\nOnce a task meets its Studio's delivery conditions, follow `akb guide archive` to record\ndelivery completion before ending the run.\n\n- **Verification**: run required and minimal representative checks, reuse valid results, distinguish defects from environment or tool limits, stop retries that add no evidence, and finish when acceptance is proven.\n- **Authorization**: carry approval for necessary in-scope operations across tools and stages without asking again.\n- **Blockers**: resolve routine problems and use `akb guide update-questions` only for user-action blockers or out-of-scope decisions, stating attempts, impact and recommendation while continuing independent work.\n- **Defer**: follow `akb guide follow-up` for unrelated work and keep it from blocking delivery.\n- **Decisions**: record material, reversible build decisions under `## Worth noting after implementation`.\n";
|
|
62371
|
+
implement_default = "# Implement the approved requirements\n\nBuild the approved requirements without reopening settled decisions or unrelated questions; without a card, create none.\n\nFor Git deliveries, adapt the approved work to the current target branch and preserve changes\nit made since approval, including removals. Stop the affected work and use\n`akb guide update-questions` only if those changes conflict with the task's core intent.\n\nDo not push, publish or deploy.\n\nOnce a task meets its Studio's delivery conditions, follow `akb guide archive` to record\ndelivery completion before ending the run.\n\n- **Verification**: run required and minimal representative checks, reuse valid results, distinguish defects from environment or tool limits, stop retries that add no evidence, and finish when acceptance is proven.\n- **Authorization**: carry approval for necessary in-scope operations across tools and stages without asking again.\n- **Blockers**: resolve routine problems and use `akb guide update-questions` only for user-action blockers or out-of-scope decisions, stating attempts, impact and recommendation while continuing independent work.\n- **Defer**: follow `akb guide follow-up` for unrelated work and keep it from blocking delivery.\n- **Decisions**: record material, reversible build decisions under `## Worth noting after implementation`.\n";
|
|
62044
62372
|
}
|
|
62045
62373
|
});
|
|
62046
62374
|
|
|
@@ -62080,7 +62408,7 @@ var init_review_rejections = __esm({
|
|
|
62080
62408
|
var refine_default;
|
|
62081
62409
|
var init_refine = __esm({
|
|
62082
62410
|
"src/guide/refine.md"() {
|
|
62083
|
-
refine_default =
|
|
62411
|
+
refine_default = "# Refine a card\n\nPlan one card until it is buildable.\n\n- **Unchecked cards**: check cards with `triage:` and empty `## Scope` against the project, rejecting obsolete or completed work with `akb raw reject <id> --reason \"<evidence>\"` and stopping.\n- **Other obsolete or completed cards**: ask whether to discard, run no previews, and stop.\n- **Groups**: preserve subtask coverage and progress, fill gaps without duplication, and do not mark the parent ready merely because its split is complete.\n- **Verification**: plan representative checks for the outcome, project rules and material risks, confirm prerequisites, and keep optional coverage optional.\n- **Review**: read `akb task review <id>`. If undecided, submit `--review <flow>` with Preview names or `--file <json>` with Preview IDs, plus `--revision <n>`. Use `--review ''` when no extra review is needed. Work only on dispatched, unlocked nodes and continue independent work during review.\n- **Preview selection**: choose Studio Previews for drafts or results that need review. For a requested result the Studio lacks, attach its definition with `--preview-definitions-file`. Keep task context in the card body.\n- **Previews**: prepare only the unlocked nodes\u2019 outputs per the Studio\u2019s `<Preview>` blocks. Before revising an approved output, use `--revise-from <stage> --revision <n>`; preserve unrelated outputs and approvals.\n- **Submit**: synchronize body and assets, then report `--stage <id> --status done --revision <n>`. Re-read after conflicts; obtain output approval at the required stages.\n- **Delivery**: the Studio's delivery flow handles separate implementation and its checks.\n- **References**: rewrite mentions of cards no longer on the board.\n- **Decisions**: settle choices supported by evidence and ask only as `akb guide update-questions` allows.\n- **Card**: follow studio rules and `akb guide writing`, fixing all errors from `akb raw validate <id>`.\n- **Ready**: when validated and buildable with prerequisites settled, run `akb raw update <id> --status ready`; otherwise leave blockers as open questions.\n\nFollow the printed closing steps. Wait only for required approvals; completion still requires Studio delivery checks.\n";
|
|
62084
62412
|
}
|
|
62085
62413
|
});
|
|
62086
62414
|
|
|
@@ -63668,7 +63996,7 @@ var init_approved_ui = __esm({
|
|
|
63668
63996
|
init_preview_blocks();
|
|
63669
63997
|
init_review_plan();
|
|
63670
63998
|
APPROVED_UI_DIR_ENV = "AI4KANBAN_APPROVED_UI_DIR";
|
|
63671
|
-
APPROVED_UI_RULE = "Open the approved mockups and
|
|
63999
|
+
APPROVED_UI_RULE = "Open the approved mockups and follow the Coding Studio delivery requirements for matching the task's intended UI changes.";
|
|
63672
64000
|
UI_PREVIEW = "ui-design";
|
|
63673
64001
|
historicalUiIds = Object.keys(CODING_PREVIEWS).filter((id2) => id2 !== UI_PREVIEW && CODING_PREVIEWS[id2] === UI_PREVIEW);
|
|
63674
64002
|
object2 = (value) => isObject2(value) ? value : {};
|
|
@@ -63788,8 +64116,14 @@ async function watchRun(sessionId, resume = startResume, retryBackoff = backoffM
|
|
|
63788
64116
|
const pendingOperations = /* @__PURE__ */ new Set();
|
|
63789
64117
|
const event2 = (e) => {
|
|
63790
64118
|
observeActivity(e);
|
|
64119
|
+
const hadPending = pendingOperations.size > 0;
|
|
63791
64120
|
if (e.kind === "tool_call" && !["read", "search", "fetch"].includes(e.data.kind) && !["completed", "failed"].includes(e.data.status)) pendingOperations.add(e.data.toolCallId);
|
|
63792
64121
|
if ((e.kind === "tool_call" || e.kind === "tool_call_update") && ["completed", "failed"].includes(e.data.status ?? "")) pendingOperations.delete(e.data.toolCallId);
|
|
64122
|
+
if (record2.cloudExecution && hadPending !== pendingOperations.size > 0) {
|
|
64123
|
+
patch(sessionId, (run4) => {
|
|
64124
|
+
run4.pendingWrites = pendingOperations.size > 0;
|
|
64125
|
+
});
|
|
64126
|
+
}
|
|
63793
64127
|
eventsFile.write(`${JSON.stringify(e)}
|
|
63794
64128
|
`);
|
|
63795
64129
|
};
|
|
@@ -64047,7 +64381,7 @@ async function watchRun(sessionId, resume = startResume, retryBackoff = backoffM
|
|
|
64047
64381
|
let retrying = false;
|
|
64048
64382
|
if (failure2 && !sub && !taskCompleted) {
|
|
64049
64383
|
const attempt2 = held4.retry?.attempt ?? 1;
|
|
64050
|
-
const decision = planRetry(failure2, attempt2, Date.now(), retryBackoff);
|
|
64384
|
+
const decision = planRetry(failure2, attempt2, Date.now(), retryBackoff, !!held4.cloudExecution);
|
|
64051
64385
|
if ("pause" in decision) retryPause = decision.pause;
|
|
64052
64386
|
else {
|
|
64053
64387
|
const mark = runMark(sessionId, agentStartedAt);
|
|
@@ -64060,7 +64394,7 @@ async function watchRun(sessionId, resume = startResume, retryBackoff = backoffM
|
|
|
64060
64394
|
stopped: stopped3(),
|
|
64061
64395
|
session,
|
|
64062
64396
|
replayable: held4.unspawned === true && !pendingOperations.size,
|
|
64063
|
-
unconfirmedCleanup: !!blocker || spoken?.cleanup?.status === "unconfirmed" || client?.managedProcess && silent && (uncertainAtIdle || !idleStopConfirmed(spoken?.cleanup, session))
|
|
64397
|
+
unconfirmedCleanup: pendingOperations.size > 0 || !!blocker || spoken?.cleanup?.status === "unconfirmed" || client?.managedProcess && silent && (uncertainAtIdle || !idleStopConfirmed(spoken?.cleanup, session))
|
|
64064
64398
|
});
|
|
64065
64399
|
if (recovery === "unsafe") retryPause = "unsafe";
|
|
64066
64400
|
else {
|
|
@@ -64512,6 +64846,23 @@ async function cmdCancel(named2) {
|
|
|
64512
64846
|
say(`delivery ${res.deliveryId} cancelled \u2014 files, branches and directories are preserved.`);
|
|
64513
64847
|
return { deliveryId: res.deliveryId };
|
|
64514
64848
|
}
|
|
64849
|
+
async function cmdReconcileDelivery(cardId2) {
|
|
64850
|
+
const result = await reconcileCardDelivery(cardId2);
|
|
64851
|
+
if (result.kind === "unverified") {
|
|
64852
|
+
say(`delivery${result.deliveryId ? ` ${result.deliveryId}` : ""}: unverified \u2014 ${result.diagnostic}`);
|
|
64853
|
+
} else if (result.kind === "none") {
|
|
64854
|
+
say(`#${cardId2}: no delivery to reconcile`);
|
|
64855
|
+
} else {
|
|
64856
|
+
say(`#${cardId2}: ${result.kind}${result.deliveryId ? ` (${result.deliveryId})` : ""}`);
|
|
64857
|
+
}
|
|
64858
|
+
return result;
|
|
64859
|
+
}
|
|
64860
|
+
async function cmdReleaseDelivery(cardId2) {
|
|
64861
|
+
const res = await releaseCardDelivery(cardId2);
|
|
64862
|
+
if (!res.ok) die(res.error, { kind: "run-refused", ...res.deliveryId ? { deliveryId: res.deliveryId } : {} });
|
|
64863
|
+
say(res.released ? `delivery ${res.deliveryId} lock released \u2014 files and branch preserved.` : `#${cardId2}: no active delivery lock to release.`);
|
|
64864
|
+
return res;
|
|
64865
|
+
}
|
|
64515
64866
|
async function cmdResumeDelivery(named2) {
|
|
64516
64867
|
const res = await resumeBoardDelivery(named2);
|
|
64517
64868
|
if (!res.ok) die(res.error ?? "that delivery could not be carried on", {
|
|
@@ -65622,7 +65973,7 @@ function declareRuns(program2, cli) {
|
|
|
65622
65973
|
withShared(task.command("approve")).argument("<task>").summary("approve the current review point").option("--stage <id>", "the reviewed node").requiredOption("--revision <n>", "the stage version you reviewed").option("--comment <text>", "a note with the approval").action(async function(id2) {
|
|
65623
65974
|
await boardless(this, cli, (_, location) => taskApprove(id2, this.opts().comment, this.opts(), location));
|
|
65624
65975
|
});
|
|
65625
|
-
withShared(task.command("review")).argument("<task>").summary("read the task review, set the plan or report a stage").option("--review <flow>", "set a review flow using Studio Preview names").addHelpText("after", REVIEW_FLOW_HELP).option("--file <path>", "set a JSON review plan").option("--stage <id>", "the node to report").option("--status <status>", "running or done").option("--revise-from <id>", "revise this node and its dependents").option("--revision <n>", "the task review version read before this write").action(async function(id2) {
|
|
65976
|
+
withShared(task.command("review")).argument("<task>").summary("read the task review, set the plan or report a stage").option("--review <flow>", "set a review flow using Studio Preview names").addHelpText("after", REVIEW_FLOW_HELP).option("--file <path>", "set a JSON review plan").option("--stage <id>", "the node to report").option("--status <status>", "running or done").option("--preview-definitions-file <path>", "propose a JSON list of task Preview definitions").option("--revise-from <id>", "revise this node and its dependents").option("--revision <n>", "the task review version read before this write").action(async function(id2) {
|
|
65626
65977
|
await boardless(this, cli, (_, location) => taskReview(id2, this.opts(), location));
|
|
65627
65978
|
});
|
|
65628
65979
|
const questionOps = [];
|
|
@@ -65651,7 +66002,7 @@ function declareRuns(program2, cli) {
|
|
|
65651
66002
|
withShared(task.command("comment")).argument("<task>").argument("<text...>").summary("comment on a task").action(async function(id2, text5) {
|
|
65652
66003
|
await boardless(this, cli, (_, location) => taskComment(id2, text5.join(" "), location));
|
|
65653
66004
|
});
|
|
65654
|
-
const goal = withShared(program2.command("goal")).argument("<move>", "new, save, drop or start").summary("save, drop and start goals of this conversation").description('Write a temporary draft, then goal new --title "\u2026" --body-file <file> [--studio <id>] [--review <flow>]; update with goal save --id <goal> and any of --title, --body-file, --studio, --review. goal drop --id <goal> withdraws one; goal start --id <goal> turns it into a task. A `## Done when` list in the body is what counts as done. Studios are the ones `akb studio list` shows.').option("--id <goal>", "the goal to save, drop or start").option("--title <title>", "what the goal is called").option("--body-file <path>", "the outcome, then a `## Done when` list").option("--studio <id>", "the studio that does the work, from `akb studio list`").option("--review <flow>", "save a review flow using Studio Preview names").option("--review-file <path>", "JSON review nodes with after dependencies; [] needs no extra review").addHelpText("after", REVIEW_FLOW_HELP);
|
|
66005
|
+
const goal = withShared(program2.command("goal")).argument("<move>", "new, save, drop or start").summary("save, drop and start goals of this conversation").description('Write a temporary draft, then goal new --title "\u2026" --body-file <file> [--studio <id>] [--review <flow>]; update with goal save --id <goal> and any of --title, --body-file, --studio, --review. goal drop --id <goal> withdraws one; goal start --id <goal> turns it into a task. A `## Done when` list in the body is what counts as done. Studios are the ones `akb studio list` shows.').option("--id <goal>", "the goal to save, drop or start").option("--title <title>", "what the goal is called").option("--body-file <path>", "the outcome, then a `## Done when` list").option("--studio <id>", "the studio that does the work, from `akb studio list`").option("--review <flow>", "save a review flow using Studio Preview names").option("--preview-definitions-file <path>", "save a JSON list of Goal Preview definitions").option("--review-file <path>", "JSON review nodes with after dependencies; [] needs no extra review").addHelpText("after", REVIEW_FLOW_HELP);
|
|
65655
66006
|
goal.action(async function(sub) {
|
|
65656
66007
|
await boardless(this, cli, () => externalGoalSession() ? cloudGoal([sub], this.opts()) : cmdGoal([sub], this.opts()));
|
|
65657
66008
|
});
|
|
@@ -65850,6 +66201,14 @@ function declareDelivery(delivery, cli) {
|
|
|
65850
66201
|
const [named2] = positional(vals);
|
|
65851
66202
|
await onBoard(this, cli, () => cmdResumeDelivery(named2));
|
|
65852
66203
|
});
|
|
66204
|
+
verb("reconcile").argument("<card>", "card number", cardId).summary("reconcile local delivery state for a card before recovery").action(async function(...vals) {
|
|
66205
|
+
const [id2] = positional(vals);
|
|
66206
|
+
await onBoard(this, cli, () => cmdReconcileDelivery(id2));
|
|
66207
|
+
});
|
|
66208
|
+
verb("release").argument("<card>", "card number", cardId).summary("safely release an active delivery write lock while preserving saved work").action(async function(...vals) {
|
|
66209
|
+
const [id2] = positional(vals);
|
|
66210
|
+
await onBoard(this, cli, () => cmdReleaseDelivery(id2));
|
|
66211
|
+
});
|
|
65853
66212
|
}
|
|
65854
66213
|
function declareFlow(parent, flow, cli) {
|
|
65855
66214
|
const byDelivery = flow.group === "delivery";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wildcrane",
|
|
3
|
-
"version": "0.11.
|
|
4
|
-
"akbContract":
|
|
3
|
+
"version": "0.11.81",
|
|
4
|
+
"akbContract": 27,
|
|
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",
|