wildcrane 0.11.52 → 0.11.54
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 +48 -30
- package/package.json +1 -1
package/dist/kanban.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// ai4kanban 0.11.
|
|
2
|
+
// ai4kanban 0.11.54 — 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)
|
|
@@ -4206,7 +4206,7 @@ var init_package = __esm({
|
|
|
4206
4206
|
"package.json"() {
|
|
4207
4207
|
package_default = {
|
|
4208
4208
|
name: "wildcrane",
|
|
4209
|
-
version: "0.11.
|
|
4209
|
+
version: "0.11.54",
|
|
4210
4210
|
akbContract: 15,
|
|
4211
4211
|
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.",
|
|
4212
4212
|
keywords: [
|
|
@@ -5452,6 +5452,10 @@ async function run(io, options, tasks) {
|
|
|
5452
5452
|
if (ended || checking || active2) return;
|
|
5453
5453
|
checking = true;
|
|
5454
5454
|
try {
|
|
5455
|
+
if (io.completed?.()) {
|
|
5456
|
+
end2();
|
|
5457
|
+
return;
|
|
5458
|
+
}
|
|
5455
5459
|
for (const key of tasks.running().filter((id) => id.startsWith("agent:"))) {
|
|
5456
5460
|
const id = key.slice(6);
|
|
5457
5461
|
let thread = obj2((await rpc.call("thread/read", { threadId: id, includeTurns: false })).thread);
|
|
@@ -17364,6 +17368,21 @@ function endAgent(child, mark, graceMs) {
|
|
|
17364
17368
|
round(KILL_ROUNDS);
|
|
17365
17369
|
});
|
|
17366
17370
|
}
|
|
17371
|
+
function processesStopped(mark, root2) {
|
|
17372
|
+
try {
|
|
17373
|
+
if (WINDOWS3) {
|
|
17374
|
+
const list2 = procsOnWindows();
|
|
17375
|
+
if (!list2 || !root2) return false;
|
|
17376
|
+
const current = list2.procs.find((p) => p.pid === root2.pid);
|
|
17377
|
+
if (current && current.startedAt > root2.since) return false;
|
|
17378
|
+
return startedUnder(list2, root2.pid, root2.since).length === 0;
|
|
17379
|
+
}
|
|
17380
|
+
const entry = `${mark.name}=${mark.value}`;
|
|
17381
|
+
return (process.platform === "linux" ? markedInProc(entry, true, mark.since) : markedInPs(entry, root2 ? [root2.pid] : [])).length === 0;
|
|
17382
|
+
} catch {
|
|
17383
|
+
return false;
|
|
17384
|
+
}
|
|
17385
|
+
}
|
|
17367
17386
|
var runMark, WINDOWS3, KILL_ROUND_MS, KILL_ROUNDS, LIST_PROCS;
|
|
17368
17387
|
var init_stop = __esm({
|
|
17369
17388
|
"src/lib/agent/stop.ts"() {
|
|
@@ -18817,18 +18836,6 @@ ${stage.artifact?.body ?? ""}`),
|
|
|
18817
18836
|
`Write only the current work in your existing section. Submit it with: ${command} raw previews ${name} ${id} --submit --stage ${current.id}. Stop after success.`
|
|
18818
18837
|
].join("\n\n");
|
|
18819
18838
|
}
|
|
18820
|
-
function previewBlocker(id) {
|
|
18821
|
-
const card = findCard(id);
|
|
18822
|
-
if (!card) return null;
|
|
18823
|
-
const meta = cardMeta(id);
|
|
18824
|
-
const flow = studioFor(card.studio);
|
|
18825
|
-
const required = cardStages(meta, flow).slice(0, cardStage(meta, flow)).flat();
|
|
18826
|
-
for (const name of required) {
|
|
18827
|
-
const progress = freezePreviewProgress(id, name);
|
|
18828
|
-
if (progress && !previewReady(progress)) return `#${id}: ${name} / ${progress.currentStageId ?? "stage selection"} is unfinished. Review that preview before approving or implementing.`;
|
|
18829
|
-
}
|
|
18830
|
-
return null;
|
|
18831
|
-
}
|
|
18832
18839
|
function previewRun(id, name) {
|
|
18833
18840
|
const run3 = readRuns().find((run4) => run4.sessionId === insideRun());
|
|
18834
18841
|
if (!run3 || run3.status !== "running" || run3.action !== "spec" || run3.specAgent !== name || run3.cardId !== id) throw Error("Only the active preview agent can select or submit its stages.");
|
|
@@ -18937,8 +18944,6 @@ function approvalRequest(req) {
|
|
|
18937
18944
|
const id = req.id;
|
|
18938
18945
|
const card = id === void 0 ? null : findCard(id);
|
|
18939
18946
|
if (!card) return { error: `task #${id} does not exist` };
|
|
18940
|
-
const blocked = previewBlocker(card.id);
|
|
18941
|
-
if (blocked) return { error: blocked };
|
|
18942
18947
|
if (card.questions.length) return { error: `#${card.id} has open questions \u2014 answer them before approving it.` };
|
|
18943
18948
|
if (readRuns().some((r) => r.status === "running" && r.cardId === card.id && holdsCard(r.action))) {
|
|
18944
18949
|
return { error: `#${card.id} has a run in flight \u2014 approve once it ends.` };
|
|
@@ -18963,7 +18968,6 @@ function advancePhase(id) {
|
|
|
18963
18968
|
var init_approve = __esm({
|
|
18964
18969
|
"src/lib/agent/approve.ts"() {
|
|
18965
18970
|
"use strict";
|
|
18966
|
-
init_preview_progress();
|
|
18967
18971
|
init_cards();
|
|
18968
18972
|
init_frontmatter();
|
|
18969
18973
|
init_read();
|
|
@@ -18981,10 +18985,6 @@ async function startRun(req) {
|
|
|
18981
18985
|
const cardId2 = Number.isInteger(req.id) ? req.id : null;
|
|
18982
18986
|
const short2 = studioRefusal(req) ?? await scheduledRefusal(req);
|
|
18983
18987
|
if (short2) return short2;
|
|
18984
|
-
if (cardId2 !== null && ["implement", "approve", "archive"].includes(req.action)) {
|
|
18985
|
-
const blocked = previewBlocker(cardId2);
|
|
18986
|
-
if (blocked) return { error: blocked };
|
|
18987
|
-
}
|
|
18988
18988
|
const delivery = req.action === "implement" ? deliveryFor(req) : void 0;
|
|
18989
18989
|
if (delivery && req.session !== "new") {
|
|
18990
18990
|
const previous = readRuns().filter((r) => r.deliveryId === delivery.deliveryId && r.action === "implement").reverse().sort((a, b) => b.startedAt - a.startedAt)[0];
|
|
@@ -19069,7 +19069,6 @@ async function startResume(id, options) {
|
|
|
19069
19069
|
var init_start = __esm({
|
|
19070
19070
|
"src/lib/agent/start.ts"() {
|
|
19071
19071
|
"use strict";
|
|
19072
|
-
init_preview_progress();
|
|
19073
19072
|
init_approve();
|
|
19074
19073
|
init_launch();
|
|
19075
19074
|
init_pictures();
|
|
@@ -26429,12 +26428,16 @@ async function watchRun(sessionId, resume = startResume) {
|
|
|
26429
26428
|
});
|
|
26430
26429
|
child.stdin.write(stdinPrompt(prompt));
|
|
26431
26430
|
}
|
|
26431
|
+
const completed = () => !!record.deliveryId && findDelivery(record.deliveryId)?.status === "finished";
|
|
26432
|
+
let finishCompletedTurn = () => {
|
|
26433
|
+
};
|
|
26432
26434
|
let turnsSeen = 0;
|
|
26433
26435
|
const afterTurn = () => {
|
|
26434
26436
|
const turns = renderer?.turns?.() ?? [];
|
|
26435
26437
|
if (turns.length === turnsSeen) return;
|
|
26436
26438
|
turnsSeen = turns.length;
|
|
26437
|
-
if (
|
|
26439
|
+
if (completed()) finishCompletedTurn();
|
|
26440
|
+
else if (renderer && streamFinished(renderer)) endInput();
|
|
26438
26441
|
};
|
|
26439
26442
|
let sawResumeId = !!record.resumeId;
|
|
26440
26443
|
let sawModel = false;
|
|
@@ -26515,6 +26518,18 @@ async function watchRun(sessionId, resume = startResume) {
|
|
|
26515
26518
|
let asked = wanted;
|
|
26516
26519
|
if (idle) clearTimeout(idle);
|
|
26517
26520
|
await stopSubRuns(sessionId);
|
|
26521
|
+
const taskCompleted = completed();
|
|
26522
|
+
if (taskCompleted) {
|
|
26523
|
+
endChild();
|
|
26524
|
+
const mark = runMark(sessionId, agentStartedAt);
|
|
26525
|
+
const root2 = child.pid ? { pid: child.pid, since: agentStartedAt } : void 0;
|
|
26526
|
+
const until = Date.now() + STOP_GRACE_MS + STOP_CLOSE_MS;
|
|
26527
|
+
while (!processesStopped(mark, root2) && Date.now() < until) await sleep4(100);
|
|
26528
|
+
if (!processesStopped(mark, root2)) {
|
|
26529
|
+
spawnError = "Task completed, but its background processes could not be confirmed stopped.";
|
|
26530
|
+
code = 1;
|
|
26531
|
+
}
|
|
26532
|
+
}
|
|
26518
26533
|
if (renderer) {
|
|
26519
26534
|
append2(renderer.flush());
|
|
26520
26535
|
drainEvents();
|
|
@@ -26526,7 +26541,7 @@ async function watchRun(sessionId, resume = startResume) {
|
|
|
26526
26541
|
if (errRest) log.write(errRest);
|
|
26527
26542
|
const endedAt = Date.now();
|
|
26528
26543
|
const blocker = peekRun(sessionId)?.blocker;
|
|
26529
|
-
let failure = renderer?.failure?.() ?? (renderer?.background?.() ? "The agent exited with unfinished background tasks." : void 0);
|
|
26544
|
+
let failure = renderer?.failure?.() ?? (!taskCompleted && renderer?.background?.() ? "The agent exited with unfinished background tasks." : void 0);
|
|
26530
26545
|
const unfinished = blocker || failure;
|
|
26531
26546
|
const result = spoken ? spoken.result : renderer?.result();
|
|
26532
26547
|
const held4 = peekRun(sessionId) ?? record;
|
|
@@ -26732,6 +26747,7 @@ Cannot resume board repair: ${next.error}`;
|
|
|
26732
26747
|
};
|
|
26733
26748
|
let ending = false;
|
|
26734
26749
|
const endChild = () => {
|
|
26750
|
+
if (ending) return;
|
|
26735
26751
|
ending = true;
|
|
26736
26752
|
try {
|
|
26737
26753
|
child.stdin?.end();
|
|
@@ -26739,6 +26755,10 @@ Cannot resume board repair: ${next.error}`;
|
|
|
26739
26755
|
}
|
|
26740
26756
|
endAgent(child, runMark(sessionId), STOP_GRACE_MS);
|
|
26741
26757
|
};
|
|
26758
|
+
finishCompletedTurn = () => {
|
|
26759
|
+
endChild();
|
|
26760
|
+
void finish(0, false);
|
|
26761
|
+
};
|
|
26742
26762
|
const giveUp = (asked) => {
|
|
26743
26763
|
endChild();
|
|
26744
26764
|
after(STOP_GRACE_MS + STOP_CLOSE_MS, () => {
|
|
@@ -26805,8 +26825,10 @@ Cannot resume board repair: ${next.error}`;
|
|
|
26805
26825
|
gotResumeId: (id, restarted) => gotResumeId(id, restarted),
|
|
26806
26826
|
gotModel: (model) => gotModel(model),
|
|
26807
26827
|
event: event2,
|
|
26808
|
-
gotContext
|
|
26828
|
+
gotContext,
|
|
26829
|
+
completed
|
|
26809
26830
|
}).then((end2) => {
|
|
26831
|
+
if (done) return;
|
|
26810
26832
|
spoken = end2;
|
|
26811
26833
|
endChild();
|
|
26812
26834
|
void finish(end2.ok ? 0 : 1, peekRun(sessionId)?.stopping === true || stopped2);
|
|
@@ -26890,6 +26912,7 @@ var init_watch = __esm({
|
|
|
26890
26912
|
init_command();
|
|
26891
26913
|
init_preview_progress();
|
|
26892
26914
|
init_progress();
|
|
26915
|
+
init_deliveries();
|
|
26893
26916
|
init_paths();
|
|
26894
26917
|
init_reconcile();
|
|
26895
26918
|
init_spec_contract();
|
|
@@ -26930,10 +26953,6 @@ import path85 from "node:path";
|
|
|
26930
26953
|
async function cmdStartRun(action, args2, opts, program2 = "akb") {
|
|
26931
26954
|
if (action === "approve" && (opts.preview || opts.previewStage || opts.previewVersion || opts.definitionRevision)) return confirmLocalPreview(Number(args2[0]), opts);
|
|
26932
26955
|
const { req, follow: follow2, print } = readRequest(action, args2, opts);
|
|
26933
|
-
if (Number.isInteger(req.id) && ["approve", "implement", "archive"].includes(action)) {
|
|
26934
|
-
const blocked = previewBlocker(req.id);
|
|
26935
|
-
if (blocked) die(blocked, { kind: "preview-unfinished" });
|
|
26936
|
-
}
|
|
26937
26956
|
if (!print && (action === "approve" || action === "implement")) {
|
|
26938
26957
|
const deferred = await approveAfterReply(String(req.id), req.notes);
|
|
26939
26958
|
if (deferred) return deferred;
|
|
@@ -27433,7 +27452,6 @@ var init_run = __esm({
|
|
|
27433
27452
|
"src/commands/run.ts"() {
|
|
27434
27453
|
"use strict";
|
|
27435
27454
|
init_preview_confirm();
|
|
27436
|
-
init_preview_progress();
|
|
27437
27455
|
init_progress();
|
|
27438
27456
|
init_complete();
|
|
27439
27457
|
init_answers();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wildcrane",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.54",
|
|
4
4
|
"akbContract": 15,
|
|
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": [
|