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/akb/dist/kanban.mjs +1701 -1146
- package/dist/akb/package.json +1 -1
- package/dist/akb-proxy.mjs +3 -2
- package/dist/codex-proxy.mjs +4 -4
- package/dist/codex-retained.mjs +2 -2
- package/dist/flow-worker-main.mjs +20274 -19678
- package/dist/launcher.mjs +160 -59
- package/dist/plugin.mjs +209 -107
- package/dist/runner.mjs +1062 -489
- package/dist/settings.mjs +160 -59
- package/package.json +1 -1
package/dist/launcher.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// wildcrane-runner 0.6.
|
|
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;
|
|
@@ -40963,6 +40963,7 @@ function withSystemProxy(env2 = process.env, platform = process.platform, read3
|
|
|
40963
40963
|
|
|
40964
40964
|
// src/proxy.ts
|
|
40965
40965
|
var LOOPBACK = "localhost,127.0.0.1,[::1]";
|
|
40966
|
+
var withLoopback = (value) => [value, LOOPBACK].filter(Boolean).join(",");
|
|
40966
40967
|
var HOST_PROXY_ENV = "WILDCRANE_HOST_PROXY";
|
|
40967
40968
|
var HOST = null;
|
|
40968
40969
|
var current = {};
|
|
@@ -40983,7 +40984,7 @@ function followProxy(read3) {
|
|
|
40983
40984
|
const route = {
|
|
40984
40985
|
httpProxy,
|
|
40985
40986
|
httpsProxy: current.HTTPS_PROXY || current.https_proxy || httpProxy,
|
|
40986
|
-
noProxy:
|
|
40987
|
+
noProxy: withLoopback(current.NO_PROXY ?? current.no_proxy)
|
|
40987
40988
|
};
|
|
40988
40989
|
const key = JSON.stringify(route);
|
|
40989
40990
|
if (key !== applied) {
|
|
@@ -41120,8 +41121,8 @@ function saveAlphaUpdates(value) {
|
|
|
41120
41121
|
}
|
|
41121
41122
|
|
|
41122
41123
|
// src/protocol.ts
|
|
41123
|
-
var VERSION = true ? "0.6.
|
|
41124
|
-
var AKB_VERSION = true ? "0.11.
|
|
41124
|
+
var VERSION = true ? "0.6.122" : "0.0.0";
|
|
41125
|
+
var AKB_VERSION = true ? "0.11.104" : "0.0.0";
|
|
41125
41126
|
var EXIT_REFUSED = 10;
|
|
41126
41127
|
var EXIT_OUTDATED = 11;
|
|
41127
41128
|
var EXIT_UPDATE = 12;
|
|
@@ -41349,7 +41350,7 @@ function rootAbove(board) {
|
|
|
41349
41350
|
var NESTED_STATE = /(^|[/\\])\.akb[/\\](?:(?:boards|hidden-boards)[/\\])?\.akb(?=[/\\]|$)/;
|
|
41350
41351
|
var InvalidBoardStatePath = class extends BoardError {
|
|
41351
41352
|
constructor(file2, state, id) {
|
|
41352
|
-
const use = state ? `Use ${state}${id ? ` or an
|
|
41353
|
+
const use = state ? `Use ${state}${id ? ` or an asset:<path> reference` : ""}.` : "Use the board\u2019s project-local state directory.";
|
|
41353
41354
|
super(`Invalid nested board state path: ${file2}. ${use}`, { kind: "board-state-path" });
|
|
41354
41355
|
}
|
|
41355
41356
|
};
|
|
@@ -41381,7 +41382,6 @@ function stateLayout(board, root2) {
|
|
|
41381
41382
|
function projectStateDir(board, root2 = stateRootOf(board)) {
|
|
41382
41383
|
return stateLayout(board, root2).state;
|
|
41383
41384
|
}
|
|
41384
|
-
var cloudBoardOf = (project) => path4.join(project, ".akb", "kanban");
|
|
41385
41385
|
function hasLegacyProjectState(board, root2 = stateRootOf(board)) {
|
|
41386
41386
|
const { legacy } = stateLayout(board, root2);
|
|
41387
41387
|
return legacy.some((dir) => fs4.lstatSync(dir, { throwIfNoEntry: false }));
|
|
@@ -41508,8 +41508,8 @@ function removeClaim(dir, token) {
|
|
|
41508
41508
|
throw err;
|
|
41509
41509
|
}
|
|
41510
41510
|
}
|
|
41511
|
-
function tryLock(dir
|
|
41512
|
-
|
|
41511
|
+
function tryLock(dir) {
|
|
41512
|
+
fs5.mkdirSync(path6.dirname(dir), { recursive: true });
|
|
41513
41513
|
const token = `${process.pid}-${randomUUID()}`;
|
|
41514
41514
|
const candidate = fs5.mkdtempSync(`${dir}.`);
|
|
41515
41515
|
try {
|
|
@@ -41716,10 +41716,8 @@ function landSections(body, previews) {
|
|
|
41716
41716
|
const start = heading.index;
|
|
41717
41717
|
const end = start + heading[0].length;
|
|
41718
41718
|
if (!/^ {0,3}##[ \t]+Land(?:[ \t]+#+)?[ \t]*$/.test(visible.slice(start, end))) return [];
|
|
41719
|
-
|
|
41720
|
-
|
|
41721
|
-
empty: !visible.slice(end, headings[index + 1]?.index).replace(comments, "").trim()
|
|
41722
|
-
}];
|
|
41719
|
+
const text2 = visible.slice(end, headings[index + 1]?.index).replace(comments, "").trim();
|
|
41720
|
+
return [{ offset: start + heading[0].indexOf("#"), empty: !text2, text: text2 }];
|
|
41723
41721
|
});
|
|
41724
41722
|
}
|
|
41725
41723
|
function parseStudioFile(id, source, from, { requirePreviewCopy = false, requireLand = false } = {}) {
|
|
@@ -42550,7 +42548,7 @@ import path27 from "node:path";
|
|
|
42550
42548
|
// ../cli/src/lib/agent/harnesses/antigravity.ts
|
|
42551
42549
|
import fs19 from "node:fs";
|
|
42552
42550
|
import path21 from "node:path";
|
|
42553
|
-
import { createHash as
|
|
42551
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
42554
42552
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
42555
42553
|
|
|
42556
42554
|
// ../cli/src/lib/agent/locate.ts
|
|
@@ -43220,7 +43218,22 @@ ${files.map((file2) => `- ${file2}`).join("\n")}` : "";
|
|
|
43220
43218
|
import fs18 from "node:fs";
|
|
43221
43219
|
|
|
43222
43220
|
// ../cli/src/lib/agent/wire/events.ts
|
|
43221
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
43223
43222
|
var TOOL_KINDS = ["read", "edit", "delete", "move", "search", "execute", "fetch", "other"];
|
|
43223
|
+
var isPollingTool = (title) => /^(?:.*\.)?(?:command_status|wait(?:_5_seconds|_agent)?|TaskOutput)$/i.test(title);
|
|
43224
|
+
var toolOutput = (text2) => text2.split(/\r?\n/).map((line) => line.trim()).filter(
|
|
43225
|
+
(line) => line && !/^(?:\[?heartbeat\]?(?:\b|\s|$)|(?:status:\s*)?(?:(?:command|task) (?:is )?(?:still )?running|running|in[_ ]progress|pending)[.!]?$)/i.test(line)
|
|
43226
|
+
).join("\n");
|
|
43227
|
+
function progressSnapshots() {
|
|
43228
|
+
const seen = /* @__PURE__ */ new Set();
|
|
43229
|
+
return (key, text2) => {
|
|
43230
|
+
if (!text2) return false;
|
|
43231
|
+
const digest = createHash5("sha256").update(key).update("\0").update(text2).digest("base64");
|
|
43232
|
+
if (seen.has(digest)) return false;
|
|
43233
|
+
seen.add(digest);
|
|
43234
|
+
return true;
|
|
43235
|
+
};
|
|
43236
|
+
}
|
|
43224
43237
|
var toolKind = (v) => TOOL_KINDS.includes(str2(v)) ? v : "other";
|
|
43225
43238
|
function targetOf(raw) {
|
|
43226
43239
|
const line = raw.split("\n")[0].trim();
|
|
@@ -43258,6 +43271,8 @@ function createEventCollector() {
|
|
|
43258
43271
|
let queue = [];
|
|
43259
43272
|
let said = "";
|
|
43260
43273
|
let activity = 0;
|
|
43274
|
+
const fresh = progressSnapshots();
|
|
43275
|
+
const polls = /* @__PURE__ */ new Map();
|
|
43261
43276
|
const todoCalls = /* @__PURE__ */ new Set();
|
|
43262
43277
|
const held2 = /* @__PURE__ */ new Map();
|
|
43263
43278
|
let todos = [];
|
|
@@ -43276,6 +43291,9 @@ function createEventCollector() {
|
|
|
43276
43291
|
progress: () => {
|
|
43277
43292
|
activity++;
|
|
43278
43293
|
},
|
|
43294
|
+
progressSnapshot(key, text2) {
|
|
43295
|
+
if (fresh(key, toolOutput(text2))) activity++;
|
|
43296
|
+
},
|
|
43279
43297
|
submitted() {
|
|
43280
43298
|
queue.push({ kind: "phase", data: { phase: "submitted", at: (/* @__PURE__ */ new Date()).toISOString() } });
|
|
43281
43299
|
},
|
|
@@ -43297,6 +43315,8 @@ function createEventCollector() {
|
|
|
43297
43315
|
todoCalls.add(id);
|
|
43298
43316
|
return;
|
|
43299
43317
|
}
|
|
43318
|
+
const title = str2(u.title);
|
|
43319
|
+
if (isPollingTool(title)) polls.set(id, `${title}:${str2(obj2(u.rawInput).task_id) || str2(obj2(u.rawInput).CommandId)}`);
|
|
43300
43320
|
const target = targetIn(u);
|
|
43301
43321
|
const subagent = /^(?:Task|Agent|delegate_task|spawn_agent)$/i.test(str2(u.title)) || !!obj2(u.rawInput).subagent_type;
|
|
43302
43322
|
const data = { toolCallId: id, title: str2(u.title) || "tool", kind: toolKind(u.kind), status: str2(u.status) || "pending", ...subagent ? { subagent: true } : {}, ...target ? { target } : {} };
|
|
@@ -43312,7 +43332,9 @@ function createEventCollector() {
|
|
|
43312
43332
|
return;
|
|
43313
43333
|
}
|
|
43314
43334
|
release(id, targetIn(u));
|
|
43315
|
-
const result = contentText(u.content);
|
|
43335
|
+
const result = contentText(u.content) || str2(obj2(u.rawOutput).output) || str2(u.rawOutput);
|
|
43336
|
+
const poll = polls.get(id);
|
|
43337
|
+
if (poll && fresh(poll, toolOutput(result))) activity++;
|
|
43316
43338
|
if (!u.status && !result) return;
|
|
43317
43339
|
queue.push({
|
|
43318
43340
|
kind: "tool_call_update",
|
|
@@ -43520,8 +43542,8 @@ function createTail(log) {
|
|
|
43520
43542
|
// ../cli/package.json
|
|
43521
43543
|
var package_default = {
|
|
43522
43544
|
name: "wildcrane",
|
|
43523
|
-
version: "0.11.
|
|
43524
|
-
akbContract:
|
|
43545
|
+
version: "0.11.104",
|
|
43546
|
+
akbContract: 39,
|
|
43525
43547
|
canonicalCommands: true,
|
|
43526
43548
|
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.",
|
|
43527
43549
|
keywords: [
|
|
@@ -44288,11 +44310,22 @@ function createAntigravityRenderer(expectedSession, cwd = process.cwd()) {
|
|
|
44288
44310
|
let out = "";
|
|
44289
44311
|
if (!calls.has(id)) {
|
|
44290
44312
|
calls.add(id);
|
|
44291
|
-
events.
|
|
44313
|
+
if (["invoke_subagent", "browser_subagent"].includes(name)) events.subagent(id, target || name);
|
|
44314
|
+
else events.toolCall(id, name, KINDS[name] ?? "other", target);
|
|
44292
44315
|
out = `
|
|
44293
44316
|
\u23FA ${name}${target ? ` ${target}` : ""}
|
|
44294
44317
|
`;
|
|
44295
44318
|
}
|
|
44319
|
+
const output2 = str2(tool.output);
|
|
44320
|
+
if (isPollingTool(name)) {
|
|
44321
|
+
const command = str2(p.CommandId) || str2(p.CommandID) || name;
|
|
44322
|
+
const commandOutput = /(?:^|\n)Command output:\s*([\s\S]*)/.exec(output2)?.[1].trim();
|
|
44323
|
+
const exit = /(?:^|\n)(Command exited with code -?\d+\.)/.exec(output2)?.[1];
|
|
44324
|
+
if (commandOutput) events.progressSnapshot(`command:${command}`, commandOutput);
|
|
44325
|
+
if (exit) events.progressSnapshot(`exit:${command}`, exit);
|
|
44326
|
+
} else if (!["DONE", "ERROR", "CANCELED", "INTERRUPTED"].includes(str2(step.state))) {
|
|
44327
|
+
events.progressSnapshot(id, output2);
|
|
44328
|
+
}
|
|
44296
44329
|
const error = obj2(tool.error);
|
|
44297
44330
|
const reason = str2(error.message) || str2(error.type);
|
|
44298
44331
|
if (["DONE", "ERROR", "CANCELED", "INTERRUPTED"].includes(str2(step.state)) && !closed.has(id)) {
|
|
@@ -44310,7 +44343,7 @@ ${imageError(target, reason || str2(step.state))}
|
|
|
44310
44343
|
imageErrors.delete(file2);
|
|
44311
44344
|
}
|
|
44312
44345
|
}
|
|
44313
|
-
events.toolResult(id, failed ? "failed" : "completed",
|
|
44346
|
+
events.toolResult(id, failed ? "failed" : "completed", output2 || reason);
|
|
44314
44347
|
}
|
|
44315
44348
|
return out;
|
|
44316
44349
|
}
|
|
@@ -44424,7 +44457,7 @@ function systemPrompt(text2, _argv, env2) {
|
|
|
44424
44457
|
const rule = `${text2}
|
|
44425
44458
|
|
|
44426
44459
|
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.`;
|
|
44427
|
-
const hash =
|
|
44460
|
+
const hash = createHash6("sha256").update(rule).digest("hex").slice(0, 16);
|
|
44428
44461
|
const root2 = path21.join(machineHome(), "prompts", `antigravity-${hash}`);
|
|
44429
44462
|
const file2 = path21.join(root2, ".agents", "rules", "language.md");
|
|
44430
44463
|
fs19.mkdirSync(path21.dirname(file2), { recursive: true });
|
|
@@ -44676,6 +44709,7 @@ function createStreamRenderer() {
|
|
|
44676
44709
|
const plans = /* @__PURE__ */ new Set();
|
|
44677
44710
|
const subagents = /* @__PURE__ */ new Map();
|
|
44678
44711
|
const detached = /* @__PURE__ */ new Set();
|
|
44712
|
+
const taskUsage = /* @__PURE__ */ new Map();
|
|
44679
44713
|
const endSubagent = (id, status2) => {
|
|
44680
44714
|
if (subagents.get(id) !== false) return;
|
|
44681
44715
|
subagents.set(id, true);
|
|
@@ -44687,8 +44721,18 @@ function createStreamRenderer() {
|
|
|
44687
44721
|
if (!ev) return `${line}
|
|
44688
44722
|
`;
|
|
44689
44723
|
if (model === void 0) model = eventModel(ev);
|
|
44690
|
-
|
|
44691
|
-
|
|
44724
|
+
const parent = str2(ev.parent_tool_use_id);
|
|
44725
|
+
const content = obj2(ev.message).content;
|
|
44726
|
+
const streamEvent = obj2(ev.event);
|
|
44727
|
+
const delta = obj2(streamEvent.delta);
|
|
44728
|
+
if (ev.type === "stream_event" && streamEvent.type === "content_block_delta" && (str2(delta.text) || str2(delta.thinking) || str2(delta.partial_json))) events.progress();
|
|
44729
|
+
if (parent) {
|
|
44730
|
+
if (["assistant", "user"].includes(str2(ev.type)) && Array.isArray(content)) {
|
|
44731
|
+
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());
|
|
44732
|
+
if (useful.length) events.progressSnapshot(parent, JSON.stringify(useful));
|
|
44733
|
+
}
|
|
44734
|
+
return "";
|
|
44735
|
+
}
|
|
44692
44736
|
switch (ev.type) {
|
|
44693
44737
|
case "assistant": {
|
|
44694
44738
|
apiFailure = typeof ev.error === "string" ? providerFailure({ type: ev.error }, "Claude could not complete the request.") : void 0;
|
|
@@ -44704,6 +44748,8 @@ function createStreamRenderer() {
|
|
|
44704
44748
|
|
|
44705
44749
|
`);
|
|
44706
44750
|
events.message(b.text);
|
|
44751
|
+
} else if (b?.type === "thinking" && str2(b.thinking).trim()) {
|
|
44752
|
+
events.progressSnapshot("thinking", str2(b.thinking));
|
|
44707
44753
|
} else if (b?.type === "tool_use" && typeof b.name === "string") {
|
|
44708
44754
|
out.push(`\u23FA ${b.name}${argHint(b.input, ARG_KEYS)}
|
|
44709
44755
|
`);
|
|
@@ -44723,8 +44769,8 @@ function createStreamRenderer() {
|
|
|
44723
44769
|
return out.join("");
|
|
44724
44770
|
}
|
|
44725
44771
|
case "user": {
|
|
44726
|
-
const
|
|
44727
|
-
for (const raw of Array.isArray(
|
|
44772
|
+
const content2 = obj2(ev.message).content;
|
|
44773
|
+
for (const raw of Array.isArray(content2) ? content2 : []) {
|
|
44728
44774
|
const b = obj2(raw);
|
|
44729
44775
|
if (b.type !== "tool_result" || plans.has(str2(b.tool_use_id))) continue;
|
|
44730
44776
|
if (subagents.has(str2(b.tool_use_id))) {
|
|
@@ -44768,8 +44814,20 @@ function createStreamRenderer() {
|
|
|
44768
44814
|
if (ev.subtype === "task_notification" && subagents.has(str2(ev.tool_use_id))) {
|
|
44769
44815
|
endSubagent(str2(ev.tool_use_id), str2(ev.status) === "completed" ? "completed" : "failed");
|
|
44770
44816
|
}
|
|
44771
|
-
|
|
44772
|
-
|
|
44817
|
+
const task = str2(ev.task_id);
|
|
44818
|
+
if (ev.subtype === "task_progress" && task) {
|
|
44819
|
+
const usage2 = obj2(ev.usage);
|
|
44820
|
+
const previous = taskUsage.get(task) ?? { tokens: 0, tools: 0 };
|
|
44821
|
+
const tokens = Math.max(previous.tokens, Number(usage2.total_tokens) || 0);
|
|
44822
|
+
const tools = Math.max(previous.tools, Number(usage2.tool_uses) || 0);
|
|
44823
|
+
if (tokens > previous.tokens || tools > previous.tools) {
|
|
44824
|
+
taskUsage.set(task, { tokens, tools });
|
|
44825
|
+
events.progress();
|
|
44826
|
+
}
|
|
44827
|
+
}
|
|
44828
|
+
if (ev.subtype === "task_notification" && backgrounded.delete(task)) {
|
|
44829
|
+
events.progress();
|
|
44830
|
+
if (str2(ev.summary)) return `\u23FA ${str2(ev.summary)}
|
|
44773
44831
|
`;
|
|
44774
44832
|
}
|
|
44775
44833
|
return "";
|
|
@@ -45109,23 +45167,20 @@ function createCodexStreamRenderer(carried = false) {
|
|
|
45109
45167
|
const started = /* @__PURE__ */ new Set();
|
|
45110
45168
|
const background = createBackgroundTasks();
|
|
45111
45169
|
const subagents = /* @__PURE__ */ new Set();
|
|
45112
|
-
const
|
|
45113
|
-
const collab = (item, done) => {
|
|
45170
|
+
const collab = (item) => {
|
|
45114
45171
|
if (item.type !== "collab_tool_call") return;
|
|
45115
|
-
const key = `${str2(item.id)}:${done}`;
|
|
45116
|
-
if (collabItems.has(key)) return;
|
|
45117
|
-
collabItems.add(key);
|
|
45118
45172
|
for (const [id, raw] of Object.entries(obj2(item.agents_states))) {
|
|
45119
45173
|
const state = obj2(raw);
|
|
45120
45174
|
const status2 = str2(state.status);
|
|
45121
45175
|
if (!["pending_init", "running", "completed", "interrupted", "errored", "shutdown", "not_found"].includes(status2)) continue;
|
|
45122
45176
|
const previous = background.results().find((t2) => t2.id === id);
|
|
45123
|
-
|
|
45177
|
+
const running = status2 === "pending_init" || status2 === "running";
|
|
45178
|
+
if ((running || ["shutdown", "not_found"].includes(status2)) && previous && previous.status !== "running") continue;
|
|
45124
45179
|
if (!subagents.has(id)) {
|
|
45125
45180
|
subagents.add(id);
|
|
45126
45181
|
events.subagent(`agent:${id}`, str2(item.prompt) || "Agent");
|
|
45127
45182
|
}
|
|
45128
|
-
|
|
45183
|
+
if (running) events.progressSnapshot(`agent:${id}`, str2(state.message));
|
|
45129
45184
|
const failed = !running && status2 !== "completed";
|
|
45130
45185
|
if (background.update(id, running ? "running" : failed ? "failed" : "completed", str2(state.message)) && !running) {
|
|
45131
45186
|
events.toolResult(`agent:${id}`, failed ? "failed" : "completed", str2(state.message));
|
|
@@ -45158,15 +45213,21 @@ function createCodexStreamRenderer(carried = false) {
|
|
|
45158
45213
|
if (!threadId) threadId = str2(ev.thread_id).trim() || void 0;
|
|
45159
45214
|
return "";
|
|
45160
45215
|
case "item.started":
|
|
45161
|
-
collab(obj2(ev.item)
|
|
45216
|
+
collab(obj2(ev.item));
|
|
45162
45217
|
itemEvents(events, started, obj2(ev.item), false);
|
|
45163
45218
|
return renderStarted(obj2(ev.item));
|
|
45164
|
-
case "item.updated":
|
|
45165
|
-
|
|
45219
|
+
case "item.updated": {
|
|
45220
|
+
const item = obj2(ev.item);
|
|
45221
|
+
collab(item);
|
|
45222
|
+
if (item.type === "todo_list") itemEvents(events, started, item, false);
|
|
45223
|
+
if (item.type === "command_execution" && started.has(str2(item.id))) {
|
|
45224
|
+
events.progressSnapshot(`command:${str2(item.id)}`, str2(item.aggregated_output));
|
|
45225
|
+
}
|
|
45166
45226
|
return "";
|
|
45227
|
+
}
|
|
45167
45228
|
case "item.completed": {
|
|
45168
45229
|
const item = obj2(ev.item);
|
|
45169
|
-
collab(item
|
|
45230
|
+
collab(item);
|
|
45170
45231
|
if (item.type === "mcp_tool_call" && !/view_image|read_image|open_image/.test(str2(item.tool))) {
|
|
45171
45232
|
const content = obj2(item.result).content;
|
|
45172
45233
|
for (const block of Array.isArray(content) ? content : []) {
|
|
@@ -45435,7 +45496,8 @@ function createKimiStreamRenderer(cwd, resumeId) {
|
|
|
45435
45496
|
`;
|
|
45436
45497
|
switch (row.role) {
|
|
45437
45498
|
case "assistant": {
|
|
45438
|
-
|
|
45499
|
+
const thought = str2(row.reasoning_content);
|
|
45500
|
+
if (thought) events.progressSnapshot("reasoning", thought);
|
|
45439
45501
|
const said = str2(row.content).trim();
|
|
45440
45502
|
if (said) final = said;
|
|
45441
45503
|
if (said) events.message(said);
|
|
@@ -45532,7 +45594,7 @@ function modelOf2(ref) {
|
|
|
45532
45594
|
const provider = str2(model.providerId);
|
|
45533
45595
|
return provider ? `${provider}/${id}` : id;
|
|
45534
45596
|
}
|
|
45535
|
-
function createParts(tail) {
|
|
45597
|
+
function createParts(tail, activity) {
|
|
45536
45598
|
const written = /* @__PURE__ */ new Map();
|
|
45537
45599
|
const tools = /* @__PURE__ */ new Set();
|
|
45538
45600
|
const named = /* @__PURE__ */ new Map();
|
|
@@ -45541,6 +45603,7 @@ function createParts(tail) {
|
|
|
45541
45603
|
const fresh = text2.startsWith(before) ? text2.slice(before.length) : text2;
|
|
45542
45604
|
if (!fresh) return;
|
|
45543
45605
|
written.set(partId, text2);
|
|
45606
|
+
activity();
|
|
45544
45607
|
if (kind === "reasoning" || kind === "thought") tail.thought(fresh);
|
|
45545
45608
|
else tail.text(fresh);
|
|
45546
45609
|
};
|
|
@@ -45552,7 +45615,10 @@ function createParts(tail) {
|
|
|
45552
45615
|
const partId = str2(part.partId);
|
|
45553
45616
|
if (type === "text" || type === "reasoning" || type === "thought") {
|
|
45554
45617
|
if (partId) say(partId, type, str2(part.text));
|
|
45555
|
-
else
|
|
45618
|
+
else if (str2(part.text)) {
|
|
45619
|
+
activity();
|
|
45620
|
+
tail.text(str2(part.text));
|
|
45621
|
+
}
|
|
45556
45622
|
return;
|
|
45557
45623
|
}
|
|
45558
45624
|
if (type !== "tool") return;
|
|
@@ -45576,14 +45642,18 @@ function createParts(tail) {
|
|
|
45576
45642
|
const delta = str2(event2.delta);
|
|
45577
45643
|
if (!delta) return;
|
|
45578
45644
|
written.set(partId, (written.get(partId) ?? "") + delta);
|
|
45645
|
+
activity();
|
|
45579
45646
|
if (field === "reasoning") tail.thought(delta);
|
|
45580
45647
|
else tail.text(delta);
|
|
45581
45648
|
},
|
|
45582
45649
|
/** A piece of the turn, as `model.streaming` sends it. */
|
|
45583
45650
|
streaming(payload) {
|
|
45584
45651
|
const kind = str2(payload.kind);
|
|
45585
|
-
|
|
45586
|
-
if (kind === "
|
|
45652
|
+
const delta = str2(payload.delta);
|
|
45653
|
+
if (delta && (kind === "text_delta" || kind === "reasoning_delta")) {
|
|
45654
|
+
activity();
|
|
45655
|
+
return kind === "text_delta" ? tail.text(delta) : tail.thought(delta);
|
|
45656
|
+
}
|
|
45587
45657
|
if (kind !== "tool_call") return;
|
|
45588
45658
|
const callId = str2(payload.toolCallId);
|
|
45589
45659
|
const name = str2(payload.toolName) || "tool";
|
|
@@ -45623,7 +45693,7 @@ function stopped(io, why) {
|
|
|
45623
45693
|
}
|
|
45624
45694
|
async function oneTurn2(io, options) {
|
|
45625
45695
|
const tail = createTail(io.log);
|
|
45626
|
-
const parts = createParts(tail);
|
|
45696
|
+
const parts = createParts(tail, () => io.activity?.());
|
|
45627
45697
|
const activityEvents = createEventCollector();
|
|
45628
45698
|
const activeCalls = /* @__PURE__ */ new Set();
|
|
45629
45699
|
let live = false;
|
|
@@ -45650,7 +45720,6 @@ async function oneTurn2(io, options) {
|
|
|
45650
45720
|
const part = obj2(payload.part);
|
|
45651
45721
|
const state = obj2(part.state);
|
|
45652
45722
|
const type = str2(envelope.type);
|
|
45653
|
-
if (["part.delta", "model.streaming"].includes(type) && str2(payload.delta)) io.activity?.();
|
|
45654
45723
|
const id = str2(payload.toolCallId) || str2(part.callId) || str2(part.partId);
|
|
45655
45724
|
const name = str2(payload.toolName) || str2(part.tool) || str2(state.title);
|
|
45656
45725
|
if (id && name && !activeCalls.has(id)) {
|
|
@@ -45659,7 +45728,21 @@ async function oneTurn2(io, options) {
|
|
|
45659
45728
|
else activityEvents.toolCall(id, name, /^(?:bash|shell|execute|run_command|terminal)$/i.test(name) ? "execute" : "other");
|
|
45660
45729
|
}
|
|
45661
45730
|
const status2 = str2(state.status) || str2(payload.kind);
|
|
45662
|
-
|
|
45731
|
+
const output2 = str2(state.output) || str2(payload.output);
|
|
45732
|
+
if (type === "part.delta" && payload.field === "output") {
|
|
45733
|
+
const before = activityEvents.activity();
|
|
45734
|
+
activityEvents.progressSnapshot(id || str2(payload.partId), str2(payload.delta));
|
|
45735
|
+
if (activityEvents.activity() > before) io.activity?.();
|
|
45736
|
+
}
|
|
45737
|
+
if (id && ["completed", "error", "result"].includes(status2)) {
|
|
45738
|
+
activityEvents.toolResult(id, status2 === "error" ? "failed" : "completed", output2);
|
|
45739
|
+
} else if (id && output2) {
|
|
45740
|
+
activityEvents.update({
|
|
45741
|
+
sessionUpdate: "tool_call_update",
|
|
45742
|
+
toolCallId: id,
|
|
45743
|
+
content: [{ type: "content", content: { text: output2 } }]
|
|
45744
|
+
});
|
|
45745
|
+
}
|
|
45663
45746
|
for (const e of activityEvents.events()) io.event?.(e);
|
|
45664
45747
|
}
|
|
45665
45748
|
event(envelope, parts, tail, live, ended);
|
|
@@ -45728,6 +45811,7 @@ async function oneTurn2(io, options) {
|
|
|
45728
45811
|
});
|
|
45729
45812
|
const before = io.resumeId ? await tokensOf(rpc, sessionId) : ZERO_USAGE;
|
|
45730
45813
|
live = true;
|
|
45814
|
+
io.event?.({ kind: "phase", data: { phase: "submitted", at: (/* @__PURE__ */ new Date()).toISOString() } });
|
|
45731
45815
|
const accepted = await rpc.call("session/send", { sessionId, content: io.prompt });
|
|
45732
45816
|
if (accepted.accepted === false) throw new Error("the agent would not take the prompt");
|
|
45733
45817
|
const done = await finished;
|
|
@@ -45809,9 +45893,8 @@ function decide2(params, tail) {
|
|
|
45809
45893
|
|
|
45810
45894
|
// ../cli/src/lib/agent/idle.ts
|
|
45811
45895
|
var IDLE_MS = 5 * 6e4;
|
|
45812
|
-
var IDLE_ERROR = "No
|
|
45896
|
+
var IDLE_ERROR = "No verifiable progress for 5 minutes (idle timeout).";
|
|
45813
45897
|
var IDLE_FAILURE = { code: "idle_timeout", source: "runtime", summary: IDLE_ERROR };
|
|
45814
|
-
var PROVIDER_RETRY_MS = { announcement: 10 * 6e4, episode: 30 * 6e4 };
|
|
45815
45898
|
|
|
45816
45899
|
// ../cli/src/lib/agent/wire/codex.ts
|
|
45817
45900
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
@@ -46140,6 +46223,7 @@ async function run(io, options, count2) {
|
|
|
46140
46223
|
const offered = /* @__PURE__ */ new Map();
|
|
46141
46224
|
const snapshot = (w) => JSON.stringify([w.threadId, w.processId, w.status, w.exitCode, w.result]);
|
|
46142
46225
|
const childEvents = /* @__PURE__ */ new Map();
|
|
46226
|
+
const freshOutput = progressSnapshots();
|
|
46143
46227
|
const seenItems = /* @__PURE__ */ new Set();
|
|
46144
46228
|
const completedTurns = /* @__PURE__ */ new Set();
|
|
46145
46229
|
const historicalTurns = /* @__PURE__ */ new Set();
|
|
@@ -46174,6 +46258,9 @@ async function run(io, options, count2) {
|
|
|
46174
46258
|
io.stdout.off("close", closed);
|
|
46175
46259
|
io.stdin.off("error", inputFailed);
|
|
46176
46260
|
if (settlement) flushMessages(work.work().some((w) => !w.intentionalStop && !["running", "unknown"].includes(w.status) && presented.get(w.id) !== snapshot(w)));
|
|
46261
|
+
if (classified?.code === "codex_ownership_unconfirmed") {
|
|
46262
|
+
cleanup = { ...cleanup, status: "unconfirmed", detail: classified.detail ?? classified.summary };
|
|
46263
|
+
}
|
|
46177
46264
|
cleanup.items = work.work().map(({ id, threadId: threadId2, processId, status: status3, disposition }) => ({ id, threadId: threadId2, processId, status: status3, disposition }));
|
|
46178
46265
|
io.log(renderer.flush());
|
|
46179
46266
|
const usage = ownUsage(total, baseline);
|
|
@@ -46234,7 +46321,9 @@ async function run(io, options, count2) {
|
|
|
46234
46321
|
io.idleSignal?.addEventListener("abort", idle, { once: true });
|
|
46235
46322
|
const childUpdates = () => {
|
|
46236
46323
|
for (const w of work.entries.values()) {
|
|
46237
|
-
if (w.kind !== "agent"
|
|
46324
|
+
if (w.kind !== "agent") continue;
|
|
46325
|
+
if (w.status === "running" && freshOutput(w.id, toolOutput(w.result))) io.activity?.();
|
|
46326
|
+
if (childEvents.get(w.id) === w.status) continue;
|
|
46238
46327
|
if (!childEvents.has(w.id)) io.event?.({ kind: "tool_call", data: { toolCallId: w.id, title: "Agent", kind: "other", status: "in_progress", subagent: true } });
|
|
46239
46328
|
if (w.status !== "running") io.event?.({ kind: "tool_call_update", data: { toolCallId: w.id, status: w.status === "completed" ? "completed" : "failed", result: w.result } });
|
|
46240
46329
|
childEvents.set(w.id, w.status);
|
|
@@ -46472,7 +46561,26 @@ async function run(io, options, count2) {
|
|
|
46472
46561
|
armCleanup();
|
|
46473
46562
|
if (source === threadId && obj2(p.item).type !== "agentMessage") item(obj2(p.item), msg.method === "item/completed", false);
|
|
46474
46563
|
}
|
|
46475
|
-
|
|
46564
|
+
const turnId = str2(p.turnId) || str2(obj2(p.turn).id);
|
|
46565
|
+
const main = source === threadId;
|
|
46566
|
+
const live = main ? !historicalTurns.has(turnId) && (!currentTurn2 || !turnId || currentTurn2 === turnId) : work.entries.get(`agent:${source}`)?.status === "running";
|
|
46567
|
+
const delta = str2(p.delta);
|
|
46568
|
+
if (submitted && live && delta) {
|
|
46569
|
+
if (["item/agentMessage/delta", "item/plan/delta", "item/reasoning/summaryTextDelta", "item/reasoning/textDelta"].includes(msg.method ?? "")) {
|
|
46570
|
+
if (main) {
|
|
46571
|
+
if (msg.method?.startsWith("item/reasoning/")) thinking();
|
|
46572
|
+
else recovered();
|
|
46573
|
+
}
|
|
46574
|
+
io.activity?.();
|
|
46575
|
+
}
|
|
46576
|
+
const terminal = terminalKey(source, str2(p.itemId));
|
|
46577
|
+
if (msg.method === "item/commandExecution/outputDelta" && work.entries.get(terminal)?.status === "running" && freshOutput(terminal, toolOutput(delta))) io.activity?.();
|
|
46578
|
+
}
|
|
46579
|
+
if (!main) {
|
|
46580
|
+
if (live && msg.method === "item/completed") {
|
|
46581
|
+
const item2 = obj2(p.item);
|
|
46582
|
+
if (freshOutput(`${source}:${str2(item2.id)}`, toolOutput(str2(item2.text) || str2(item2.aggregatedOutput)))) io.activity?.();
|
|
46583
|
+
}
|
|
46476
46584
|
if (msg.method === "turn/completed") {
|
|
46477
46585
|
work.observeTurn(source, obj2(p.turn));
|
|
46478
46586
|
armCleanup();
|
|
@@ -46480,13 +46588,7 @@ async function run(io, options, count2) {
|
|
|
46480
46588
|
childUpdates();
|
|
46481
46589
|
return;
|
|
46482
46590
|
}
|
|
46483
|
-
|
|
46484
|
-
if (historicalTurns.has(turnId) || currentTurn2 && turnId && currentTurn2 !== turnId) return;
|
|
46485
|
-
if (submitted && ["item/agentMessage/delta", "item/plan/delta", "item/reasoning/summaryTextDelta", "item/reasoning/textDelta"].includes(msg.method ?? "") && str2(p.delta)) {
|
|
46486
|
-
if (msg.method?.startsWith("item/reasoning/")) thinking();
|
|
46487
|
-
else recovered();
|
|
46488
|
-
io.activity?.();
|
|
46489
|
-
}
|
|
46591
|
+
if (!live) return;
|
|
46490
46592
|
if (msg.method === "turn/started") {
|
|
46491
46593
|
if (!submitted || completedTurns.has(turnId)) return;
|
|
46492
46594
|
currentTurn2 = turnId;
|
|
@@ -46588,7 +46690,6 @@ async function run(io, options, count2) {
|
|
|
46588
46690
|
waiting2 = true;
|
|
46589
46691
|
io.event?.({ kind: "log", data: { text: failure2.summary } });
|
|
46590
46692
|
}
|
|
46591
|
-
io.activity?.();
|
|
46592
46693
|
await delay(500, void 0, { signal: io.signal });
|
|
46593
46694
|
preparingUntil = Date.now() + CONVERSATION_MS.prepare;
|
|
46594
46695
|
}
|
|
@@ -48113,7 +48214,7 @@ function hold(dir) {
|
|
|
48113
48214
|
}
|
|
48114
48215
|
function paused(dir) {
|
|
48115
48216
|
try {
|
|
48116
|
-
const file2 = path27.join(projectStateDir(
|
|
48217
|
+
const file2 = path27.join(projectStateDir(path27.join(akbDir(dir), "kanban")), SESSIONS_FILE);
|
|
48117
48218
|
const held2 = JSON.parse(fs23.readFileSync(file2, "utf8"));
|
|
48118
48219
|
return (held2.deliveries ?? []).some((d) => d.status === "active");
|
|
48119
48220
|
} catch {
|
|
@@ -48139,14 +48240,14 @@ function busy(dir) {
|
|
|
48139
48240
|
}
|
|
48140
48241
|
function conflicted(dir) {
|
|
48141
48242
|
try {
|
|
48142
|
-
return pendingConflicts(
|
|
48243
|
+
return pendingConflicts(path27.join(dir, ".akb", "kanban")).length > 0;
|
|
48143
48244
|
} catch {
|
|
48144
48245
|
return true;
|
|
48145
48246
|
}
|
|
48146
48247
|
}
|
|
48147
48248
|
function legacyState(dir) {
|
|
48148
48249
|
try {
|
|
48149
|
-
return hasLegacyProjectState(
|
|
48250
|
+
return hasLegacyProjectState(path27.join(akbDir(dir), "kanban"));
|
|
48150
48251
|
} catch {
|
|
48151
48252
|
return true;
|
|
48152
48253
|
}
|