wildcrane-runner 0.6.67 → 0.6.68

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