wildcrane-runner 0.6.120 → 0.6.122

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/plugin.mjs CHANGED
@@ -1,4 +1,4 @@
1
- // wildcrane-runner 0.6.120 — built by runner/scripts/build.mjs. Do not edit.
1
+ // wildcrane-runner 0.6.122 — 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;
@@ -91263,6 +91263,10 @@ var reviewNodeSchema = external_exports.object({
91263
91263
  previews: external_exports.array(id).max(50).default([]),
91264
91264
  kind: external_exports.literal("work").optional()
91265
91265
  }).strict();
91266
+ var flatReviewPlanSchema = external_exports.object({
91267
+ rule: external_exports.string().trim().max(2e4),
91268
+ previews: external_exports.array(id).max(50).transform((ids) => [...new Set(ids)])
91269
+ }).strict();
91266
91270
  function reviewLayers(plan) {
91267
91271
  const remaining = new Set(plan.map((n) => n.id));
91268
91272
  if (remaining.size !== plan.length) throw new Error("Review node IDs must be unique.");
@@ -91283,13 +91287,14 @@ function reviewLayers(plan) {
91283
91287
  }
91284
91288
  return layers;
91285
91289
  }
91286
- var reviewPlanSchema = external_exports.array(reviewNodeSchema).max(50).superRefine((nodes, ctx) => {
91290
+ var legacyReviewPlanSchema = external_exports.array(reviewNodeSchema).max(50).superRefine((nodes, ctx) => {
91287
91291
  try {
91288
91292
  reviewLayers(nodes);
91289
91293
  } catch (e) {
91290
91294
  ctx.addIssue({ code: "custom", message: e.message });
91291
91295
  }
91292
- }).nullable();
91296
+ });
91297
+ var reviewPlanSchema = external_exports.union([flatReviewPlanSchema, legacyReviewPlanSchema]).nullable();
91293
91298
 
91294
91299
  // src/plugin.ts
91295
91300
  import crypto11 from "node:crypto";
@@ -107820,16 +107825,6 @@ function alive(pid) {
107820
107825
  }
107821
107826
  var sleep = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
107822
107827
 
107823
- // ../cli/src/lib/agent/cloud-studios.ts
107824
- import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypto";
107825
- import fs8 from "node:fs";
107826
- import path10 from "node:path";
107827
-
107828
- // ../cli/src/lib/lock.ts
107829
- import { randomUUID } from "node:crypto";
107830
- import fs3 from "node:fs";
107831
- import path5 from "node:path";
107832
-
107833
107828
  // ../cli/src/lib/paths.ts
107834
107829
  import path4 from "node:path";
107835
107830
 
@@ -107903,7 +107898,7 @@ function rootAbove(board) {
107903
107898
  var NESTED_STATE = /(^|[/\\])\.akb[/\\](?:(?:boards|hidden-boards)[/\\])?\.akb(?=[/\\]|$)/;
107904
107899
  var InvalidBoardStatePath = class extends BoardError {
107905
107900
  constructor(file3, state2, id2) {
107906
- const use = state2 ? `Use ${state2}${id2 ? ` or an .assets/${id2}/\u2026 reference` : ""}.` : "Use the board\u2019s project-local state directory.";
107901
+ const use = state2 ? `Use ${state2}${id2 ? ` or an asset:<path> reference` : ""}.` : "Use the board\u2019s project-local state directory.";
107907
107902
  super(`Invalid nested board state path: ${file3}. ${use}`, { kind: "board-state-path" });
107908
107903
  }
107909
107904
  };
@@ -107935,7 +107930,6 @@ function stateLayout(board, root2) {
107935
107930
  function projectStateDir(board, root2 = stateRootOf(board)) {
107936
107931
  return stateLayout(board, root2).state;
107937
107932
  }
107938
- var cloudBoardOf = (project) => path3.join(project, ".akb", "kanban");
107939
107933
  function hasLegacyProjectState(board, root2 = stateRootOf(board)) {
107940
107934
  const { legacy } = stateLayout(board, root2);
107941
107935
  return legacy.some((dir) => fs2.lstatSync(dir, { throwIfNoEntry: false }));
@@ -108034,7 +108028,15 @@ function setBoardRoot(root2, named = false) {
108034
108028
  }
108035
108029
  setBoardRoot(process.cwd());
108036
108030
 
108031
+ // ../cli/src/lib/agent/cloud-studios.ts
108032
+ import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypto";
108033
+ import fs8 from "node:fs";
108034
+ import path10 from "node:path";
108035
+
108037
108036
  // ../cli/src/lib/lock.ts
108037
+ import { randomUUID } from "node:crypto";
108038
+ import fs3 from "node:fs";
108039
+ import path5 from "node:path";
108038
108040
  function pidAlive(pid) {
108039
108041
  if (!pid) return false;
108040
108042
  try {
@@ -108062,8 +108064,8 @@ function removeClaim(dir, token) {
108062
108064
  throw err;
108063
108065
  }
108064
108066
  }
108065
- function tryLock(dir, createParent = true) {
108066
- if (createParent) fs3.mkdirSync(path5.dirname(dir), { recursive: true });
108067
+ function tryLock(dir) {
108068
+ fs3.mkdirSync(path5.dirname(dir), { recursive: true });
108067
108069
  const token = `${process.pid}-${randomUUID()}`;
108068
108070
  const candidate = fs3.mkdtempSync(`${dir}.`);
108069
108071
  try {
@@ -108201,10 +108203,8 @@ function landSections(body, previews) {
108201
108203
  const start = heading.index;
108202
108204
  const end = start + heading[0].length;
108203
108205
  if (!/^ {0,3}##[ \t]+Land(?:[ \t]+#+)?[ \t]*$/.test(visible.slice(start, end))) return [];
108204
- return [{
108205
- offset: start + heading[0].indexOf("#"),
108206
- empty: !visible.slice(end, headings[index + 1]?.index).replace(comments, "").trim()
108207
- }];
108206
+ const text3 = visible.slice(end, headings[index + 1]?.index).replace(comments, "").trim();
108207
+ return [{ offset: start + heading[0].indexOf("#"), empty: !text3, text: text3 }];
108208
108208
  });
108209
108209
  }
108210
108210
  function parseStudioFile(id2, source, from, { requirePreviewCopy = false, requireLand = false } = {}) {
@@ -108781,10 +108781,44 @@ import fs19 from "node:fs";
108781
108781
  import path23 from "node:path";
108782
108782
  import { fileURLToPath as fileURLToPath2, pathToFileURL } from "node:url";
108783
108783
 
108784
+ // ../cli/src/lib/agent/proxy.ts
108785
+ import { execFileSync } from "node:child_process";
108786
+ var PROXY_KEYS = ["HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy", "ALL_PROXY", "all_proxy"];
108787
+ function withSystemProxy(env2 = process.env, platform = process.platform, read3 = () => execFileSync("/usr/sbin/scutil", ["--proxy"], { encoding: "utf8", timeout: 1e3, stdio: ["ignore", "pipe", "ignore"] })) {
108788
+ const out = { ...env2 };
108789
+ if (platform !== "darwin" || PROXY_KEYS.some((key) => env2[key] !== void 0)) return out;
108790
+ let raw;
108791
+ try {
108792
+ raw = read3();
108793
+ } catch {
108794
+ return out;
108795
+ }
108796
+ const value = (key) => new RegExp(`^\\s*${key}\\s*:\\s*(.*?)\\s*$`, "m").exec(raw)?.[1];
108797
+ for (const [name, key, scheme] of [["HTTP", "HTTP_PROXY", "http"], ["HTTPS", "HTTPS_PROXY", "http"], ["SOCKS", "ALL_PROXY", "socks5"]]) {
108798
+ if (value(`${name}Enable`) !== "1") continue;
108799
+ const host2 = value(`${name}Proxy`);
108800
+ const port = Number(value(`${name}Port`));
108801
+ if (!host2 || /[\s/@?#]/.test(host2) || !Number.isInteger(port) || port < 1 || port > 65535) continue;
108802
+ try {
108803
+ out[key] = new URL(`${scheme}://${host2.includes(":") && !host2.startsWith("[") ? `[${host2}]` : host2}:${port}`).href.replace(/\/$/, "");
108804
+ } catch {
108805
+ }
108806
+ }
108807
+ if (PROXY_KEYS.some((key) => out[key]) && env2.NO_PROXY === void 0 && env2.no_proxy === void 0) {
108808
+ const exceptions = /ExceptionsList\s*:\s*<array>\s*\{([^}]+)\}/.exec(raw)?.[1];
108809
+ const bypass = exceptions?.split("\n").flatMap((line) => {
108810
+ const host2 = /^\s*\d+\s*:\s*(\S+)\s*$/.exec(line)?.[1];
108811
+ return host2 ? [host2.startsWith("*.") ? host2.slice(1) : host2] : [];
108812
+ });
108813
+ if (bypass?.length) out.NO_PROXY = bypass.join(",");
108814
+ }
108815
+ return out;
108816
+ }
108817
+
108784
108818
  // ../cli/src/lib/agent/harnesses/antigravity.ts
108785
108819
  import fs15 from "node:fs";
108786
108820
  import path17 from "node:path";
108787
- import { createHash as createHash5 } from "node:crypto";
108821
+ import { createHash as createHash6 } from "node:crypto";
108788
108822
  import { spawnSync as spawnSync2 } from "node:child_process";
108789
108823
 
108790
108824
  // ../cli/src/lib/agent/locate.ts
@@ -109454,7 +109488,22 @@ ${files.map((file3) => `- ${file3}`).join("\n")}` : "";
109454
109488
  import fs14 from "node:fs";
109455
109489
 
109456
109490
  // ../cli/src/lib/agent/wire/events.ts
109491
+ import { createHash as createHash5 } from "node:crypto";
109457
109492
  var TOOL_KINDS = ["read", "edit", "delete", "move", "search", "execute", "fetch", "other"];
109493
+ var isPollingTool = (title) => /^(?:.*\.)?(?:command_status|wait(?:_5_seconds|_agent)?|TaskOutput)$/i.test(title);
109494
+ var toolOutput = (text3) => text3.split(/\r?\n/).map((line) => line.trim()).filter(
109495
+ (line) => line && !/^(?:\[?heartbeat\]?(?:\b|\s|$)|(?:status:\s*)?(?:(?:command|task) (?:is )?(?:still )?running|running|in[_ ]progress|pending)[.!]?$)/i.test(line)
109496
+ ).join("\n");
109497
+ function progressSnapshots() {
109498
+ const seen = /* @__PURE__ */ new Set();
109499
+ return (key, text3) => {
109500
+ if (!text3) return false;
109501
+ const digest = createHash5("sha256").update(key).update("\0").update(text3).digest("base64");
109502
+ if (seen.has(digest)) return false;
109503
+ seen.add(digest);
109504
+ return true;
109505
+ };
109506
+ }
109458
109507
  var toolKind = (v) => TOOL_KINDS.includes(str2(v)) ? v : "other";
109459
109508
  function targetOf(raw) {
109460
109509
  const line = raw.split("\n")[0].trim();
@@ -109492,6 +109541,8 @@ function createEventCollector() {
109492
109541
  let queue = [];
109493
109542
  let said = "";
109494
109543
  let activity = 0;
109544
+ const fresh = progressSnapshots();
109545
+ const polls = /* @__PURE__ */ new Map();
109495
109546
  const todoCalls = /* @__PURE__ */ new Set();
109496
109547
  const held2 = /* @__PURE__ */ new Map();
109497
109548
  let todos = [];
@@ -109510,6 +109561,9 @@ function createEventCollector() {
109510
109561
  progress: () => {
109511
109562
  activity++;
109512
109563
  },
109564
+ progressSnapshot(key, text3) {
109565
+ if (fresh(key, toolOutput(text3))) activity++;
109566
+ },
109513
109567
  submitted() {
109514
109568
  queue.push({ kind: "phase", data: { phase: "submitted", at: (/* @__PURE__ */ new Date()).toISOString() } });
109515
109569
  },
@@ -109531,6 +109585,8 @@ function createEventCollector() {
109531
109585
  todoCalls.add(id2);
109532
109586
  return;
109533
109587
  }
109588
+ const title = str2(u.title);
109589
+ if (isPollingTool(title)) polls.set(id2, `${title}:${str2(obj2(u.rawInput).task_id) || str2(obj2(u.rawInput).CommandId)}`);
109534
109590
  const target = targetIn(u);
109535
109591
  const subagent = /^(?:Task|Agent|delegate_task|spawn_agent)$/i.test(str2(u.title)) || !!obj2(u.rawInput).subagent_type;
109536
109592
  const data = { toolCallId: id2, title: str2(u.title) || "tool", kind: toolKind(u.kind), status: str2(u.status) || "pending", ...subagent ? { subagent: true } : {}, ...target ? { target } : {} };
@@ -109546,7 +109602,9 @@ function createEventCollector() {
109546
109602
  return;
109547
109603
  }
109548
109604
  release(id2, targetIn(u));
109549
- const result = contentText(u.content);
109605
+ const result = contentText(u.content) || str2(obj2(u.rawOutput).output) || str2(u.rawOutput);
109606
+ const poll = polls.get(id2);
109607
+ if (poll && fresh(poll, toolOutput(result))) activity++;
109550
109608
  if (!u.status && !result) return;
109551
109609
  queue.push({
109552
109610
  kind: "tool_call_update",
@@ -109754,8 +109812,8 @@ function createTail(log) {
109754
109812
  // ../cli/package.json
109755
109813
  var package_default = {
109756
109814
  name: "wildcrane",
109757
- version: "0.11.102",
109758
- akbContract: 35,
109815
+ version: "0.11.104",
109816
+ akbContract: 39,
109759
109817
  canonicalCommands: true,
109760
109818
  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.",
109761
109819
  keywords: [
@@ -110522,11 +110580,22 @@ function createAntigravityRenderer(expectedSession, cwd = process.cwd()) {
110522
110580
  let out = "";
110523
110581
  if (!calls.has(id2)) {
110524
110582
  calls.add(id2);
110525
- events.toolCall(id2, name, KINDS[name] ?? "other", target);
110583
+ if (["invoke_subagent", "browser_subagent"].includes(name)) events.subagent(id2, target || name);
110584
+ else events.toolCall(id2, name, KINDS[name] ?? "other", target);
110526
110585
  out = `
110527
110586
  \u23FA ${name}${target ? ` ${target}` : ""}
110528
110587
  `;
110529
110588
  }
110589
+ const output3 = str2(tool.output);
110590
+ if (isPollingTool(name)) {
110591
+ const command = str2(p.CommandId) || str2(p.CommandID) || name;
110592
+ const commandOutput = /(?:^|\n)Command output:\s*([\s\S]*)/.exec(output3)?.[1].trim();
110593
+ const exit = /(?:^|\n)(Command exited with code -?\d+\.)/.exec(output3)?.[1];
110594
+ if (commandOutput) events.progressSnapshot(`command:${command}`, commandOutput);
110595
+ if (exit) events.progressSnapshot(`exit:${command}`, exit);
110596
+ } else if (!["DONE", "ERROR", "CANCELED", "INTERRUPTED"].includes(str2(step.state))) {
110597
+ events.progressSnapshot(id2, output3);
110598
+ }
110530
110599
  const error63 = obj2(tool.error);
110531
110600
  const reason = str2(error63.message) || str2(error63.type);
110532
110601
  if (["DONE", "ERROR", "CANCELED", "INTERRUPTED"].includes(str2(step.state)) && !closed.has(id2)) {
@@ -110544,7 +110613,7 @@ ${imageError(target, reason || str2(step.state))}
110544
110613
  imageErrors.delete(file3);
110545
110614
  }
110546
110615
  }
110547
- events.toolResult(id2, failed ? "failed" : "completed", str2(tool.output) || reason);
110616
+ events.toolResult(id2, failed ? "failed" : "completed", output3 || reason);
110548
110617
  }
110549
110618
  return out;
110550
110619
  }
@@ -110658,7 +110727,7 @@ function systemPrompt(text3, _argv, env2) {
110658
110727
  const rule = `${text3}
110659
110728
 
110660
110729
  The task working directory is ${env2.PWD ?? process.cwd()}. Use it as the base for project files and commands. This additional workspace contains only language rules; do not write task output here.`;
110661
- const hash2 = createHash5("sha256").update(rule).digest("hex").slice(0, 16);
110730
+ const hash2 = createHash6("sha256").update(rule).digest("hex").slice(0, 16);
110662
110731
  const root2 = path17.join(machineHome(), "prompts", `antigravity-${hash2}`);
110663
110732
  const file3 = path17.join(root2, ".agents", "rules", "language.md");
110664
110733
  fs15.mkdirSync(path17.dirname(file3), { recursive: true });
@@ -110910,6 +110979,7 @@ function createStreamRenderer() {
110910
110979
  const plans = /* @__PURE__ */ new Set();
110911
110980
  const subagents = /* @__PURE__ */ new Map();
110912
110981
  const detached = /* @__PURE__ */ new Set();
110982
+ const taskUsage = /* @__PURE__ */ new Map();
110913
110983
  const endSubagent = (id2, status2) => {
110914
110984
  if (subagents.get(id2) !== false) return;
110915
110985
  subagents.set(id2, true);
@@ -110921,8 +110991,18 @@ function createStreamRenderer() {
110921
110991
  if (!ev) return `${line}
110922
110992
  `;
110923
110993
  if (model === void 0) model = eventModel(ev);
110924
- if (str2(ev.parent_tool_use_id)) return "";
110925
- if (ev.type === "assistant" || ev.type === "stream_event" && obj2(ev.event).type === "content_block_delta") events.progress();
110994
+ const parent = str2(ev.parent_tool_use_id);
110995
+ const content = obj2(ev.message).content;
110996
+ const streamEvent = obj2(ev.event);
110997
+ const delta = obj2(streamEvent.delta);
110998
+ if (ev.type === "stream_event" && streamEvent.type === "content_block_delta" && (str2(delta.text) || str2(delta.thinking) || str2(delta.partial_json))) events.progress();
110999
+ if (parent) {
111000
+ if (["assistant", "user"].includes(str2(ev.type)) && Array.isArray(content)) {
111001
+ const useful = content.map(obj2).filter((block) => !!str2(block.text).trim() || !!str2(block.thinking).trim() || block.type === "tool_use" || block.type === "tool_result" && !!resultText(block.content).trim());
111002
+ if (useful.length) events.progressSnapshot(parent, JSON.stringify(useful));
111003
+ }
111004
+ return "";
111005
+ }
110926
111006
  switch (ev.type) {
110927
111007
  case "assistant": {
110928
111008
  apiFailure = typeof ev.error === "string" ? providerFailure({ type: ev.error }, "Claude could not complete the request.") : void 0;
@@ -110938,6 +111018,8 @@ function createStreamRenderer() {
110938
111018
 
110939
111019
  `);
110940
111020
  events.message(b.text);
111021
+ } else if (b?.type === "thinking" && str2(b.thinking).trim()) {
111022
+ events.progressSnapshot("thinking", str2(b.thinking));
110941
111023
  } else if (b?.type === "tool_use" && typeof b.name === "string") {
110942
111024
  out.push(`\u23FA ${b.name}${argHint(b.input, ARG_KEYS)}
110943
111025
  `);
@@ -110957,8 +111039,8 @@ function createStreamRenderer() {
110957
111039
  return out.join("");
110958
111040
  }
110959
111041
  case "user": {
110960
- const content = obj2(ev.message).content;
110961
- for (const raw of Array.isArray(content) ? content : []) {
111042
+ const content2 = obj2(ev.message).content;
111043
+ for (const raw of Array.isArray(content2) ? content2 : []) {
110962
111044
  const b = obj2(raw);
110963
111045
  if (b.type !== "tool_result" || plans.has(str2(b.tool_use_id))) continue;
110964
111046
  if (subagents.has(str2(b.tool_use_id))) {
@@ -111002,8 +111084,20 @@ function createStreamRenderer() {
111002
111084
  if (ev.subtype === "task_notification" && subagents.has(str2(ev.tool_use_id))) {
111003
111085
  endSubagent(str2(ev.tool_use_id), str2(ev.status) === "completed" ? "completed" : "failed");
111004
111086
  }
111005
- if (ev.subtype === "task_notification" && backgrounded.has(str2(ev.task_id)) && str2(ev.summary)) {
111006
- return `\u23FA ${str2(ev.summary)}
111087
+ const task = str2(ev.task_id);
111088
+ if (ev.subtype === "task_progress" && task) {
111089
+ const usage2 = obj2(ev.usage);
111090
+ const previous = taskUsage.get(task) ?? { tokens: 0, tools: 0 };
111091
+ const tokens = Math.max(previous.tokens, Number(usage2.total_tokens) || 0);
111092
+ const tools = Math.max(previous.tools, Number(usage2.tool_uses) || 0);
111093
+ if (tokens > previous.tokens || tools > previous.tools) {
111094
+ taskUsage.set(task, { tokens, tools });
111095
+ events.progress();
111096
+ }
111097
+ }
111098
+ if (ev.subtype === "task_notification" && backgrounded.delete(task)) {
111099
+ events.progress();
111100
+ if (str2(ev.summary)) return `\u23FA ${str2(ev.summary)}
111007
111101
  `;
111008
111102
  }
111009
111103
  return "";
@@ -111343,23 +111437,20 @@ function createCodexStreamRenderer(carried = false) {
111343
111437
  const started = /* @__PURE__ */ new Set();
111344
111438
  const background = createBackgroundTasks();
111345
111439
  const subagents = /* @__PURE__ */ new Set();
111346
- const collabItems = /* @__PURE__ */ new Set();
111347
- const collab = (item, done) => {
111440
+ const collab = (item) => {
111348
111441
  if (item.type !== "collab_tool_call") return;
111349
- const key = `${str2(item.id)}:${done}`;
111350
- if (collabItems.has(key)) return;
111351
- collabItems.add(key);
111352
111442
  for (const [id2, raw] of Object.entries(obj2(item.agents_states))) {
111353
111443
  const state2 = obj2(raw);
111354
111444
  const status2 = str2(state2.status);
111355
111445
  if (!["pending_init", "running", "completed", "interrupted", "errored", "shutdown", "not_found"].includes(status2)) continue;
111356
111446
  const previous = background.results().find((t2) => t2.id === id2);
111357
- if (["shutdown", "not_found"].includes(status2) && previous && previous.status !== "running") continue;
111447
+ const running = status2 === "pending_init" || status2 === "running";
111448
+ if ((running || ["shutdown", "not_found"].includes(status2)) && previous && previous.status !== "running") continue;
111358
111449
  if (!subagents.has(id2)) {
111359
111450
  subagents.add(id2);
111360
111451
  events.subagent(`agent:${id2}`, str2(item.prompt) || "Agent");
111361
111452
  }
111362
- const running = status2 === "pending_init" || status2 === "running";
111453
+ if (running) events.progressSnapshot(`agent:${id2}`, str2(state2.message));
111363
111454
  const failed = !running && status2 !== "completed";
111364
111455
  if (background.update(id2, running ? "running" : failed ? "failed" : "completed", str2(state2.message)) && !running) {
111365
111456
  events.toolResult(`agent:${id2}`, failed ? "failed" : "completed", str2(state2.message));
@@ -111392,15 +111483,21 @@ function createCodexStreamRenderer(carried = false) {
111392
111483
  if (!threadId) threadId = str2(ev.thread_id).trim() || void 0;
111393
111484
  return "";
111394
111485
  case "item.started":
111395
- collab(obj2(ev.item), false);
111486
+ collab(obj2(ev.item));
111396
111487
  itemEvents(events, started, obj2(ev.item), false);
111397
111488
  return renderStarted(obj2(ev.item));
111398
- case "item.updated":
111399
- if (obj2(ev.item).type === "todo_list") itemEvents(events, started, obj2(ev.item), false);
111489
+ case "item.updated": {
111490
+ const item = obj2(ev.item);
111491
+ collab(item);
111492
+ if (item.type === "todo_list") itemEvents(events, started, item, false);
111493
+ if (item.type === "command_execution" && started.has(str2(item.id))) {
111494
+ events.progressSnapshot(`command:${str2(item.id)}`, str2(item.aggregated_output));
111495
+ }
111400
111496
  return "";
111497
+ }
111401
111498
  case "item.completed": {
111402
111499
  const item = obj2(ev.item);
111403
- collab(item, true);
111500
+ collab(item);
111404
111501
  if (item.type === "mcp_tool_call" && !/view_image|read_image|open_image/.test(str2(item.tool))) {
111405
111502
  const content = obj2(item.result).content;
111406
111503
  for (const block of Array.isArray(content) ? content : []) {
@@ -111669,7 +111766,8 @@ function createKimiStreamRenderer(cwd, resumeId) {
111669
111766
  `;
111670
111767
  switch (row.role) {
111671
111768
  case "assistant": {
111672
- events.progress();
111769
+ const thought = str2(row.reasoning_content);
111770
+ if (thought) events.progressSnapshot("reasoning", thought);
111673
111771
  const said = str2(row.content).trim();
111674
111772
  if (said) final = said;
111675
111773
  if (said) events.message(said);
@@ -111766,7 +111864,7 @@ function modelOf2(ref) {
111766
111864
  const provider = str2(model.providerId);
111767
111865
  return provider ? `${provider}/${id2}` : id2;
111768
111866
  }
111769
- function createParts(tail) {
111867
+ function createParts(tail, activity) {
111770
111868
  const written = /* @__PURE__ */ new Map();
111771
111869
  const tools = /* @__PURE__ */ new Set();
111772
111870
  const named = /* @__PURE__ */ new Map();
@@ -111775,6 +111873,7 @@ function createParts(tail) {
111775
111873
  const fresh = text3.startsWith(before) ? text3.slice(before.length) : text3;
111776
111874
  if (!fresh) return;
111777
111875
  written.set(partId, text3);
111876
+ activity();
111778
111877
  if (kind === "reasoning" || kind === "thought") tail.thought(fresh);
111779
111878
  else tail.text(fresh);
111780
111879
  };
@@ -111786,7 +111885,10 @@ function createParts(tail) {
111786
111885
  const partId = str2(part.partId);
111787
111886
  if (type === "text" || type === "reasoning" || type === "thought") {
111788
111887
  if (partId) say(partId, type, str2(part.text));
111789
- else tail.text(str2(part.text));
111888
+ else if (str2(part.text)) {
111889
+ activity();
111890
+ tail.text(str2(part.text));
111891
+ }
111790
111892
  return;
111791
111893
  }
111792
111894
  if (type !== "tool") return;
@@ -111810,14 +111912,18 @@ function createParts(tail) {
111810
111912
  const delta = str2(event2.delta);
111811
111913
  if (!delta) return;
111812
111914
  written.set(partId, (written.get(partId) ?? "") + delta);
111915
+ activity();
111813
111916
  if (field === "reasoning") tail.thought(delta);
111814
111917
  else tail.text(delta);
111815
111918
  },
111816
111919
  /** A piece of the turn, as `model.streaming` sends it. */
111817
111920
  streaming(payload) {
111818
111921
  const kind = str2(payload.kind);
111819
- if (kind === "text_delta") return tail.text(str2(payload.delta));
111820
- if (kind === "reasoning_delta") return tail.thought(str2(payload.delta));
111922
+ const delta = str2(payload.delta);
111923
+ if (delta && (kind === "text_delta" || kind === "reasoning_delta")) {
111924
+ activity();
111925
+ return kind === "text_delta" ? tail.text(delta) : tail.thought(delta);
111926
+ }
111821
111927
  if (kind !== "tool_call") return;
111822
111928
  const callId = str2(payload.toolCallId);
111823
111929
  const name = str2(payload.toolName) || "tool";
@@ -111857,7 +111963,7 @@ function stopped(io, why) {
111857
111963
  }
111858
111964
  async function oneTurn2(io, options) {
111859
111965
  const tail = createTail(io.log);
111860
- const parts = createParts(tail);
111966
+ const parts = createParts(tail, () => io.activity?.());
111861
111967
  const activityEvents = createEventCollector();
111862
111968
  const activeCalls = /* @__PURE__ */ new Set();
111863
111969
  let live = false;
@@ -111884,7 +111990,6 @@ async function oneTurn2(io, options) {
111884
111990
  const part = obj2(payload.part);
111885
111991
  const state2 = obj2(part.state);
111886
111992
  const type = str2(envelope.type);
111887
- if (["part.delta", "model.streaming"].includes(type) && str2(payload.delta)) io.activity?.();
111888
111993
  const id2 = str2(payload.toolCallId) || str2(part.callId) || str2(part.partId);
111889
111994
  const name = str2(payload.toolName) || str2(part.tool) || str2(state2.title);
111890
111995
  if (id2 && name && !activeCalls.has(id2)) {
@@ -111893,7 +111998,21 @@ async function oneTurn2(io, options) {
111893
111998
  else activityEvents.toolCall(id2, name, /^(?:bash|shell|execute|run_command|terminal)$/i.test(name) ? "execute" : "other");
111894
111999
  }
111895
112000
  const status2 = str2(state2.status) || str2(payload.kind);
111896
- if (id2 && ["completed", "error", "result"].includes(status2)) activityEvents.toolResult(id2, status2 === "error" ? "failed" : "completed", "");
112001
+ const output3 = str2(state2.output) || str2(payload.output);
112002
+ if (type === "part.delta" && payload.field === "output") {
112003
+ const before = activityEvents.activity();
112004
+ activityEvents.progressSnapshot(id2 || str2(payload.partId), str2(payload.delta));
112005
+ if (activityEvents.activity() > before) io.activity?.();
112006
+ }
112007
+ if (id2 && ["completed", "error", "result"].includes(status2)) {
112008
+ activityEvents.toolResult(id2, status2 === "error" ? "failed" : "completed", output3);
112009
+ } else if (id2 && output3) {
112010
+ activityEvents.update({
112011
+ sessionUpdate: "tool_call_update",
112012
+ toolCallId: id2,
112013
+ content: [{ type: "content", content: { text: output3 } }]
112014
+ });
112015
+ }
111897
112016
  for (const e of activityEvents.events()) io.event?.(e);
111898
112017
  }
111899
112018
  event(envelope, parts, tail, live, ended);
@@ -111962,6 +112081,7 @@ async function oneTurn2(io, options) {
111962
112081
  });
111963
112082
  const before = io.resumeId ? await tokensOf(rpc, sessionId) : ZERO_USAGE;
111964
112083
  live = true;
112084
+ io.event?.({ kind: "phase", data: { phase: "submitted", at: (/* @__PURE__ */ new Date()).toISOString() } });
111965
112085
  const accepted = await rpc.call("session/send", { sessionId, content: io.prompt });
111966
112086
  if (accepted.accepted === false) throw new Error("the agent would not take the prompt");
111967
112087
  const done = await finished;
@@ -112043,9 +112163,8 @@ function decide2(params, tail) {
112043
112163
 
112044
112164
  // ../cli/src/lib/agent/idle.ts
112045
112165
  var IDLE_MS = 5 * 6e4;
112046
- var IDLE_ERROR = "No response for 5 minutes (idle timeout).";
112166
+ var IDLE_ERROR = "No verifiable progress for 5 minutes (idle timeout).";
112047
112167
  var IDLE_FAILURE = { code: "idle_timeout", source: "runtime", summary: IDLE_ERROR };
112048
- var PROVIDER_RETRY_MS = { announcement: 10 * 6e4, episode: 30 * 6e4 };
112049
112168
 
112050
112169
  // ../cli/src/lib/agent/wire/codex.ts
112051
112170
  import { randomUUID as randomUUID3 } from "node:crypto";
@@ -112374,6 +112493,7 @@ async function run(io, options, count2) {
112374
112493
  const offered = /* @__PURE__ */ new Map();
112375
112494
  const snapshot = (w) => JSON.stringify([w.threadId, w.processId, w.status, w.exitCode, w.result]);
112376
112495
  const childEvents = /* @__PURE__ */ new Map();
112496
+ const freshOutput = progressSnapshots();
112377
112497
  const seenItems = /* @__PURE__ */ new Set();
112378
112498
  const completedTurns = /* @__PURE__ */ new Set();
112379
112499
  const historicalTurns = /* @__PURE__ */ new Set();
@@ -112408,6 +112528,9 @@ async function run(io, options, count2) {
112408
112528
  io.stdout.off("close", closed);
112409
112529
  io.stdin.off("error", inputFailed);
112410
112530
  if (settlement) flushMessages(work.work().some((w) => !w.intentionalStop && !["running", "unknown"].includes(w.status) && presented.get(w.id) !== snapshot(w)));
112531
+ if (classified?.code === "codex_ownership_unconfirmed") {
112532
+ cleanup = { ...cleanup, status: "unconfirmed", detail: classified.detail ?? classified.summary };
112533
+ }
112411
112534
  cleanup.items = work.work().map(({ id: id2, threadId: threadId2, processId, status: status3, disposition }) => ({ id: id2, threadId: threadId2, processId, status: status3, disposition }));
112412
112535
  io.log(renderer.flush());
112413
112536
  const usage = ownUsage(total, baseline);
@@ -112468,7 +112591,9 @@ async function run(io, options, count2) {
112468
112591
  io.idleSignal?.addEventListener("abort", idle, { once: true });
112469
112592
  const childUpdates = () => {
112470
112593
  for (const w of work.entries.values()) {
112471
- if (w.kind !== "agent" || childEvents.get(w.id) === w.status) continue;
112594
+ if (w.kind !== "agent") continue;
112595
+ if (w.status === "running" && freshOutput(w.id, toolOutput(w.result))) io.activity?.();
112596
+ if (childEvents.get(w.id) === w.status) continue;
112472
112597
  if (!childEvents.has(w.id)) io.event?.({ kind: "tool_call", data: { toolCallId: w.id, title: "Agent", kind: "other", status: "in_progress", subagent: true } });
112473
112598
  if (w.status !== "running") io.event?.({ kind: "tool_call_update", data: { toolCallId: w.id, status: w.status === "completed" ? "completed" : "failed", result: w.result } });
112474
112599
  childEvents.set(w.id, w.status);
@@ -112706,7 +112831,26 @@ async function run(io, options, count2) {
112706
112831
  armCleanup();
112707
112832
  if (source === threadId && obj2(p.item).type !== "agentMessage") item(obj2(p.item), msg.method === "item/completed", false);
112708
112833
  }
112709
- if (source !== threadId) {
112834
+ const turnId = str2(p.turnId) || str2(obj2(p.turn).id);
112835
+ const main2 = source === threadId;
112836
+ const live = main2 ? !historicalTurns.has(turnId) && (!currentTurn2 || !turnId || currentTurn2 === turnId) : work.entries.get(`agent:${source}`)?.status === "running";
112837
+ const delta = str2(p.delta);
112838
+ if (submitted && live && delta) {
112839
+ if (["item/agentMessage/delta", "item/plan/delta", "item/reasoning/summaryTextDelta", "item/reasoning/textDelta"].includes(msg.method ?? "")) {
112840
+ if (main2) {
112841
+ if (msg.method?.startsWith("item/reasoning/")) thinking();
112842
+ else recovered();
112843
+ }
112844
+ io.activity?.();
112845
+ }
112846
+ const terminal = terminalKey(source, str2(p.itemId));
112847
+ if (msg.method === "item/commandExecution/outputDelta" && work.entries.get(terminal)?.status === "running" && freshOutput(terminal, toolOutput(delta))) io.activity?.();
112848
+ }
112849
+ if (!main2) {
112850
+ if (live && msg.method === "item/completed") {
112851
+ const item2 = obj2(p.item);
112852
+ if (freshOutput(`${source}:${str2(item2.id)}`, toolOutput(str2(item2.text) || str2(item2.aggregatedOutput)))) io.activity?.();
112853
+ }
112710
112854
  if (msg.method === "turn/completed") {
112711
112855
  work.observeTurn(source, obj2(p.turn));
112712
112856
  armCleanup();
@@ -112714,13 +112858,7 @@ async function run(io, options, count2) {
112714
112858
  childUpdates();
112715
112859
  return;
112716
112860
  }
112717
- const turnId = str2(p.turnId) || str2(obj2(p.turn).id);
112718
- if (historicalTurns.has(turnId) || currentTurn2 && turnId && currentTurn2 !== turnId) return;
112719
- if (submitted && ["item/agentMessage/delta", "item/plan/delta", "item/reasoning/summaryTextDelta", "item/reasoning/textDelta"].includes(msg.method ?? "") && str2(p.delta)) {
112720
- if (msg.method?.startsWith("item/reasoning/")) thinking();
112721
- else recovered();
112722
- io.activity?.();
112723
- }
112861
+ if (!live) return;
112724
112862
  if (msg.method === "turn/started") {
112725
112863
  if (!submitted || completedTurns.has(turnId)) return;
112726
112864
  currentTurn2 = turnId;
@@ -112822,7 +112960,6 @@ async function run(io, options, count2) {
112822
112960
  waiting2 = true;
112823
112961
  io.event?.({ kind: "log", data: { text: failure5.summary } });
112824
112962
  }
112825
- io.activity?.();
112826
112963
  await delay(500, void 0, { signal: io.signal });
112827
112964
  preparingUntil = Date.now() + CONVERSATION_MS.prepare;
112828
112965
  }
@@ -114164,43 +114301,8 @@ import path22 from "node:path";
114164
114301
 
114165
114302
  // src/proxy.ts
114166
114303
  var import_undici = __toESM(require_undici(), 1);
114167
-
114168
- // ../cli/src/lib/agent/proxy.ts
114169
- import { execFileSync } from "node:child_process";
114170
- var PROXY_KEYS = ["HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy", "ALL_PROXY", "all_proxy"];
114171
- function withSystemProxy(env2 = process.env, platform = process.platform, read3 = () => execFileSync("/usr/sbin/scutil", ["--proxy"], { encoding: "utf8", timeout: 1e3, stdio: ["ignore", "pipe", "ignore"] })) {
114172
- const out = { ...env2 };
114173
- if (platform !== "darwin" || PROXY_KEYS.some((key) => env2[key] !== void 0)) return out;
114174
- let raw;
114175
- try {
114176
- raw = read3();
114177
- } catch {
114178
- return out;
114179
- }
114180
- const value = (key) => new RegExp(`^\\s*${key}\\s*:\\s*(.*?)\\s*$`, "m").exec(raw)?.[1];
114181
- for (const [name, key, scheme] of [["HTTP", "HTTP_PROXY", "http"], ["HTTPS", "HTTPS_PROXY", "http"], ["SOCKS", "ALL_PROXY", "socks5"]]) {
114182
- if (value(`${name}Enable`) !== "1") continue;
114183
- const host2 = value(`${name}Proxy`);
114184
- const port = Number(value(`${name}Port`));
114185
- if (!host2 || /[\s/@?#]/.test(host2) || !Number.isInteger(port) || port < 1 || port > 65535) continue;
114186
- try {
114187
- out[key] = new URL(`${scheme}://${host2.includes(":") && !host2.startsWith("[") ? `[${host2}]` : host2}:${port}`).href.replace(/\/$/, "");
114188
- } catch {
114189
- }
114190
- }
114191
- if (PROXY_KEYS.some((key) => out[key]) && env2.NO_PROXY === void 0 && env2.no_proxy === void 0) {
114192
- const exceptions = /ExceptionsList\s*:\s*<array>\s*\{([^}]+)\}/.exec(raw)?.[1];
114193
- const bypass = exceptions?.split("\n").flatMap((line) => {
114194
- const host2 = /^\s*\d+\s*:\s*(\S+)\s*$/.exec(line)?.[1];
114195
- return host2 ? [host2.startsWith("*.") ? host2.slice(1) : host2] : [];
114196
- });
114197
- if (bypass?.length) out.NO_PROXY = bypass.join(",");
114198
- }
114199
- return out;
114200
- }
114201
-
114202
- // src/proxy.ts
114203
114304
  var LOOPBACK = "localhost,127.0.0.1,[::1]";
114305
+ var withLoopback = (value) => [value, LOOPBACK].filter(Boolean).join(",");
114204
114306
  var HOST_PROXY_ENV = "WILDCRANE_HOST_PROXY";
114205
114307
  var HOST = null;
114206
114308
  var current = {};
@@ -114221,7 +114323,7 @@ function followProxy(read3) {
114221
114323
  const route = {
114222
114324
  httpProxy,
114223
114325
  httpsProxy: current.HTTPS_PROXY || current.https_proxy || httpProxy,
114224
- noProxy: [current.NO_PROXY ?? current.no_proxy, LOOPBACK].filter(Boolean).join(",")
114326
+ noProxy: withLoopback(current.NO_PROXY ?? current.no_proxy)
114225
114327
  };
114226
114328
  const key = JSON.stringify(route);
114227
114329
  if (key !== applied) {
@@ -114262,8 +114364,8 @@ function machineId() {
114262
114364
  var machineName = () => os4.hostname().replace(/\.local$/, "");
114263
114365
 
114264
114366
  // src/protocol.ts
114265
- var VERSION = true ? "0.6.120" : "0.0.0";
114266
- var AKB_VERSION = true ? "0.11.102" : "0.0.0";
114367
+ var VERSION = true ? "0.6.122" : "0.0.0";
114368
+ var AKB_VERSION = true ? "0.11.104" : "0.0.0";
114267
114369
  var EXIT_OUTDATED = 11;
114268
114370
  var EXIT_UPDATE = 12;
114269
114371
  var EXIT_ALREADY_RUNNING = 13;
@@ -114561,7 +114663,7 @@ function hold(dir) {
114561
114663
  }
114562
114664
  function paused(dir) {
114563
114665
  try {
114564
- const file3 = path26.join(projectStateDir(cloudBoardOf(dir)), SESSIONS_FILE);
114666
+ const file3 = path26.join(projectStateDir(path26.join(akbDir(dir), "kanban")), SESSIONS_FILE);
114565
114667
  const held2 = JSON.parse(fs22.readFileSync(file3, "utf8"));
114566
114668
  return (held2.deliveries ?? []).some((d) => d.status === "active");
114567
114669
  } catch {
@@ -114587,14 +114689,14 @@ function busy(dir) {
114587
114689
  }
114588
114690
  function conflicted(dir) {
114589
114691
  try {
114590
- return pendingConflicts(cloudBoardOf(dir)).length > 0;
114692
+ return pendingConflicts(path26.join(dir, ".akb", "kanban")).length > 0;
114591
114693
  } catch {
114592
114694
  return true;
114593
114695
  }
114594
114696
  }
114595
114697
  function legacyState(dir) {
114596
114698
  try {
114597
- return hasLegacyProjectState(cloudBoardOf(dir));
114699
+ return hasLegacyProjectState(path26.join(akbDir(dir), "kanban"));
114598
114700
  } catch {
114599
114701
  return true;
114600
114702
  }