wildcrane 0.11.53 → 0.11.55

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.
Files changed (2) hide show
  1. package/dist/kanban.mjs +28 -32
  2. package/package.json +1 -1
package/dist/kanban.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // ai4kanban 0.11.53 — built from the CLI's TypeScript sources by cli/scripts/build.mjs.
2
+ // ai4kanban 0.11.55 — 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.53",
4209
+ version: "0.11.55",
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: [
@@ -5366,7 +5366,7 @@ async function run(io, options, tasks) {
5366
5366
  if (failure) io.event?.({ kind: "error", data: { text: failure } });
5367
5367
  resolve2({ ok: !failure, error: failure, result: renderer.result(), replyParts: renderer.replyParts?.(), usage: combinedUsage, context, costUsd, costIncomplete: child.costIncomplete || cost === void 0 && child.costUsd !== void 0 || void 0 });
5368
5368
  };
5369
- const closed2 = () => end2("Codex closed the connection before all work and results finished.");
5369
+ const closed2 = () => end2("Codex connection closed before all work and results finished.");
5370
5370
  io.stdout.once("close", closed2);
5371
5371
  const update2 = (id, state, title = "") => {
5372
5372
  if (ended) return;
@@ -18836,18 +18836,6 @@ ${stage.artifact?.body ?? ""}`),
18836
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.`
18837
18837
  ].join("\n\n");
18838
18838
  }
18839
- function previewBlocker(id) {
18840
- const card = findCard(id);
18841
- if (!card) return null;
18842
- const meta = cardMeta(id);
18843
- const flow = studioFor(card.studio);
18844
- const required = cardStages(meta, flow).slice(0, cardStage(meta, flow)).flat();
18845
- for (const name of required) {
18846
- const progress = freezePreviewProgress(id, name);
18847
- if (progress && !previewReady(progress)) return `#${id}: ${name} / ${progress.currentStageId ?? "stage selection"} is unfinished. Review that preview before approving or implementing.`;
18848
- }
18849
- return null;
18850
- }
18851
18839
  function previewRun(id, name) {
18852
18840
  const run3 = readRuns().find((run4) => run4.sessionId === insideRun());
18853
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.");
@@ -18956,8 +18944,6 @@ function approvalRequest(req) {
18956
18944
  const id = req.id;
18957
18945
  const card = id === void 0 ? null : findCard(id);
18958
18946
  if (!card) return { error: `task #${id} does not exist` };
18959
- const blocked = previewBlocker(card.id);
18960
- if (blocked) return { error: blocked };
18961
18947
  if (card.questions.length) return { error: `#${card.id} has open questions \u2014 answer them before approving it.` };
18962
18948
  if (readRuns().some((r) => r.status === "running" && r.cardId === card.id && holdsCard(r.action))) {
18963
18949
  return { error: `#${card.id} has a run in flight \u2014 approve once it ends.` };
@@ -18982,7 +18968,6 @@ function advancePhase(id) {
18982
18968
  var init_approve = __esm({
18983
18969
  "src/lib/agent/approve.ts"() {
18984
18970
  "use strict";
18985
- init_preview_progress();
18986
18971
  init_cards();
18987
18972
  init_frontmatter();
18988
18973
  init_read();
@@ -19000,10 +18985,6 @@ async function startRun(req) {
19000
18985
  const cardId2 = Number.isInteger(req.id) ? req.id : null;
19001
18986
  const short2 = studioRefusal(req) ?? await scheduledRefusal(req);
19002
18987
  if (short2) return short2;
19003
- if (cardId2 !== null && ["implement", "approve", "archive"].includes(req.action)) {
19004
- const blocked = previewBlocker(cardId2);
19005
- if (blocked) return { error: blocked };
19006
- }
19007
18988
  const delivery = req.action === "implement" ? deliveryFor(req) : void 0;
19008
18989
  if (delivery && req.session !== "new") {
19009
18990
  const previous = readRuns().filter((r) => r.deliveryId === delivery.deliveryId && r.action === "implement").reverse().sort((a, b) => b.startedAt - a.startedAt)[0];
@@ -19088,7 +19069,6 @@ async function startResume(id, options) {
19088
19069
  var init_start = __esm({
19089
19070
  "src/lib/agent/start.ts"() {
19090
19071
  "use strict";
19091
- init_preview_progress();
19092
19072
  init_approve();
19093
19073
  init_launch();
19094
19074
  init_pictures();
@@ -26347,8 +26327,13 @@ async function watchRun(sessionId, resume = startResume) {
26347
26327
  const eventsFile = fs84.createWriteStream(eventsPathOf(sessionId), { flags: "a" });
26348
26328
  eventsFile.on("error", () => {
26349
26329
  });
26350
- const event2 = (e) => eventsFile.write(`${JSON.stringify(e)}
26330
+ const pendingOperations = /* @__PURE__ */ new Set();
26331
+ const event2 = (e) => {
26332
+ if (e.kind === "tool_call" && !["read", "search", "fetch"].includes(e.data.kind) && !["completed", "failed"].includes(e.data.status)) pendingOperations.add(e.data.toolCallId);
26333
+ if ((e.kind === "tool_call" || e.kind === "tool_call_update") && ["completed", "failed"].includes(e.data.status ?? "")) pendingOperations.delete(e.data.toolCallId);
26334
+ eventsFile.write(`${JSON.stringify(e)}
26351
26335
  `);
26336
+ };
26352
26337
  const log = {
26353
26338
  write(text4) {
26354
26339
  logFile.write(text4);
@@ -26517,6 +26502,7 @@ async function watchRun(sessionId, resume = startResume) {
26517
26502
  return await new Promise((resolve2) => {
26518
26503
  let done = false;
26519
26504
  let spoken;
26505
+ let crashed = false;
26520
26506
  let silent = false;
26521
26507
  let waited = false;
26522
26508
  let idle;
@@ -26562,6 +26548,9 @@ async function watchRun(sessionId, resume = startResume) {
26562
26548
  const endedAt = Date.now();
26563
26549
  const blocker = peekRun(sessionId)?.blocker;
26564
26550
  let failure = renderer?.failure?.() ?? (!taskCompleted && renderer?.background?.() ? "The agent exited with unfinished background tasks." : void 0);
26551
+ if (!asked && pendingOperations.size > 0 && (code !== 0 || spoken?.ok === false)) {
26552
+ failure = `${failure ?? spoken?.error ?? "Agent exited."} Operation results are unconfirmed; automatic recovery was skipped.`;
26553
+ }
26565
26554
  const unfinished = blocker || failure;
26566
26555
  const result = spoken ? spoken.result : renderer?.result();
26567
26556
  const held4 = peekRun(sessionId) ?? record;
@@ -26569,8 +26558,19 @@ async function watchRun(sessionId, resume = startResume) {
26569
26558
  const said2 = failure ?? spoken?.error;
26570
26559
  const offStream = renderer?.offStream?.();
26571
26560
  const quiet = silent && !asked && !blocker && !sub && !!resumeSessionId(held4);
26572
- const blip = quiet ? { reason: waited ? backgroundWaitMessage(BACKGROUND_WAIT.minutes) : silenceSaid(silenceFor) } : ours || sub || code === 0 && !said2 || !resumeSessionId(held4) ? void 0 : active2.transient?.({ failure: said2, result, offStream });
26573
- const again = blip ? planRetry2(held4.retry, blip, held4.startedAt, Date.now(), Math.random, !quiet) : null;
26561
+ let blip = quiet ? { reason: waited ? backgroundWaitMessage(BACKGROUND_WAIT.minutes) : silenceSaid(silenceFor) } : ours || sub || pendingOperations.size > 0 || code === 0 && !said2 || !resumeSessionId(held4) ? void 0 : active2.transient?.({ failure: said2, result, offStream }) ?? (crashed && !said2 ? { reason: `Agent process exited unexpectedly (${child.signalCode}).` } : void 0);
26562
+ if (blip) {
26563
+ const mark = runMark(sessionId, agentStartedAt);
26564
+ const root2 = child.pid ? { pid: child.pid, since: agentStartedAt } : void 0;
26565
+ const until = Date.now() + STOP_GRACE_MS + STOP_CLOSE_MS;
26566
+ while (!processesStopped(mark, root2) && Date.now() < until) await sleep4(100);
26567
+ if (!processesStopped(mark, root2)) {
26568
+ blip = void 0;
26569
+ failure = "Previous execution could not be confirmed stopped; existing results were preserved.";
26570
+ }
26571
+ }
26572
+ const serviceClosed = said2 === "Codex connection closed before all work and results finished.";
26573
+ const again = blip ? planRetry2(held4.retry, blip, serviceClosed || crashed ? Date.now() : held4.startedAt, Date.now(), Math.random, !quiet) : null;
26574
26574
  if (again) {
26575
26575
  log.write(`
26576
26576
  [board] ${retryLine(again)}
@@ -26855,7 +26855,8 @@ Cannot resume board repair: ${next.error}`;
26855
26855
  });
26856
26856
  }
26857
26857
  }
26858
- child.once("exit", () => {
26858
+ child.once("exit", (_code, signal2) => {
26859
+ crashed = !ending && !!signal2 && ["SIGKILL", "SIGTERM", "SIGSEGV", "SIGABRT", "SIGBUS", "SIGILL"].includes(signal2);
26859
26860
  if (!ending) killMarked(runMark(sessionId), child.pid ? { pid: child.pid, since: agentStartedAt } : void 0);
26860
26861
  });
26861
26862
  child.on("close", (code) => void finish(code, peekRun(sessionId)?.stopping === true || stopped2));
@@ -26973,10 +26974,6 @@ import path85 from "node:path";
26973
26974
  async function cmdStartRun(action, args2, opts, program2 = "akb") {
26974
26975
  if (action === "approve" && (opts.preview || opts.previewStage || opts.previewVersion || opts.definitionRevision)) return confirmLocalPreview(Number(args2[0]), opts);
26975
26976
  const { req, follow: follow2, print } = readRequest(action, args2, opts);
26976
- if (Number.isInteger(req.id) && ["approve", "implement", "archive"].includes(action)) {
26977
- const blocked = previewBlocker(req.id);
26978
- if (blocked) die(blocked, { kind: "preview-unfinished" });
26979
- }
26980
26977
  if (!print && (action === "approve" || action === "implement")) {
26981
26978
  const deferred = await approveAfterReply(String(req.id), req.notes);
26982
26979
  if (deferred) return deferred;
@@ -27476,7 +27473,6 @@ var init_run = __esm({
27476
27473
  "src/commands/run.ts"() {
27477
27474
  "use strict";
27478
27475
  init_preview_confirm();
27479
- init_preview_progress();
27480
27476
  init_progress();
27481
27477
  init_complete();
27482
27478
  init_answers();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wildcrane",
3
- "version": "0.11.53",
3
+ "version": "0.11.55",
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": [