wildcrane-runner 0.6.121 → 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 +1797 -1267
- package/dist/akb/package.json +1 -1
- package/dist/akb-proxy.mjs +3 -2
- package/dist/codex-proxy.mjs +2 -2
- package/dist/codex-retained.mjs +2 -2
- package/dist/flow-worker-main.mjs +20233 -19633
- package/dist/launcher.mjs +155 -53
- package/dist/plugin.mjs +204 -101
- package/dist/runner.mjs +1012 -410
- package/dist/settings.mjs +157 -55
- 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
|
};
|
|
@@ -41715,10 +41716,8 @@ function landSections(body, previews) {
|
|
|
41715
41716
|
const start = heading.index;
|
|
41716
41717
|
const end = start + heading[0].length;
|
|
41717
41718
|
if (!/^ {0,3}##[ \t]+Land(?:[ \t]+#+)?[ \t]*$/.test(visible.slice(start, end))) return [];
|
|
41718
|
-
|
|
41719
|
-
|
|
41720
|
-
empty: !visible.slice(end, headings[index + 1]?.index).replace(comments, "").trim()
|
|
41721
|
-
}];
|
|
41719
|
+
const text2 = visible.slice(end, headings[index + 1]?.index).replace(comments, "").trim();
|
|
41720
|
+
return [{ offset: start + heading[0].indexOf("#"), empty: !text2, text: text2 }];
|
|
41722
41721
|
});
|
|
41723
41722
|
}
|
|
41724
41723
|
function parseStudioFile(id, source, from, { requirePreviewCopy = false, requireLand = false } = {}) {
|
|
@@ -42549,7 +42548,7 @@ import path27 from "node:path";
|
|
|
42549
42548
|
// ../cli/src/lib/agent/harnesses/antigravity.ts
|
|
42550
42549
|
import fs19 from "node:fs";
|
|
42551
42550
|
import path21 from "node:path";
|
|
42552
|
-
import { createHash as
|
|
42551
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
42553
42552
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
42554
42553
|
|
|
42555
42554
|
// ../cli/src/lib/agent/locate.ts
|
|
@@ -43219,7 +43218,22 @@ ${files.map((file2) => `- ${file2}`).join("\n")}` : "";
|
|
|
43219
43218
|
import fs18 from "node:fs";
|
|
43220
43219
|
|
|
43221
43220
|
// ../cli/src/lib/agent/wire/events.ts
|
|
43221
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
43222
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
|
+
}
|
|
43223
43237
|
var toolKind = (v) => TOOL_KINDS.includes(str2(v)) ? v : "other";
|
|
43224
43238
|
function targetOf(raw) {
|
|
43225
43239
|
const line = raw.split("\n")[0].trim();
|
|
@@ -43257,6 +43271,8 @@ function createEventCollector() {
|
|
|
43257
43271
|
let queue = [];
|
|
43258
43272
|
let said = "";
|
|
43259
43273
|
let activity = 0;
|
|
43274
|
+
const fresh = progressSnapshots();
|
|
43275
|
+
const polls = /* @__PURE__ */ new Map();
|
|
43260
43276
|
const todoCalls = /* @__PURE__ */ new Set();
|
|
43261
43277
|
const held2 = /* @__PURE__ */ new Map();
|
|
43262
43278
|
let todos = [];
|
|
@@ -43275,6 +43291,9 @@ function createEventCollector() {
|
|
|
43275
43291
|
progress: () => {
|
|
43276
43292
|
activity++;
|
|
43277
43293
|
},
|
|
43294
|
+
progressSnapshot(key, text2) {
|
|
43295
|
+
if (fresh(key, toolOutput(text2))) activity++;
|
|
43296
|
+
},
|
|
43278
43297
|
submitted() {
|
|
43279
43298
|
queue.push({ kind: "phase", data: { phase: "submitted", at: (/* @__PURE__ */ new Date()).toISOString() } });
|
|
43280
43299
|
},
|
|
@@ -43296,6 +43315,8 @@ function createEventCollector() {
|
|
|
43296
43315
|
todoCalls.add(id);
|
|
43297
43316
|
return;
|
|
43298
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)}`);
|
|
43299
43320
|
const target = targetIn(u);
|
|
43300
43321
|
const subagent = /^(?:Task|Agent|delegate_task|spawn_agent)$/i.test(str2(u.title)) || !!obj2(u.rawInput).subagent_type;
|
|
43301
43322
|
const data = { toolCallId: id, title: str2(u.title) || "tool", kind: toolKind(u.kind), status: str2(u.status) || "pending", ...subagent ? { subagent: true } : {}, ...target ? { target } : {} };
|
|
@@ -43311,7 +43332,9 @@ function createEventCollector() {
|
|
|
43311
43332
|
return;
|
|
43312
43333
|
}
|
|
43313
43334
|
release(id, targetIn(u));
|
|
43314
|
-
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++;
|
|
43315
43338
|
if (!u.status && !result) return;
|
|
43316
43339
|
queue.push({
|
|
43317
43340
|
kind: "tool_call_update",
|
|
@@ -43519,8 +43542,8 @@ function createTail(log) {
|
|
|
43519
43542
|
// ../cli/package.json
|
|
43520
43543
|
var package_default = {
|
|
43521
43544
|
name: "wildcrane",
|
|
43522
|
-
version: "0.11.
|
|
43523
|
-
akbContract:
|
|
43545
|
+
version: "0.11.104",
|
|
43546
|
+
akbContract: 39,
|
|
43524
43547
|
canonicalCommands: true,
|
|
43525
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.",
|
|
43526
43549
|
keywords: [
|
|
@@ -44287,11 +44310,22 @@ function createAntigravityRenderer(expectedSession, cwd = process.cwd()) {
|
|
|
44287
44310
|
let out = "";
|
|
44288
44311
|
if (!calls.has(id)) {
|
|
44289
44312
|
calls.add(id);
|
|
44290
|
-
events.
|
|
44313
|
+
if (["invoke_subagent", "browser_subagent"].includes(name)) events.subagent(id, target || name);
|
|
44314
|
+
else events.toolCall(id, name, KINDS[name] ?? "other", target);
|
|
44291
44315
|
out = `
|
|
44292
44316
|
\u23FA ${name}${target ? ` ${target}` : ""}
|
|
44293
44317
|
`;
|
|
44294
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
|
+
}
|
|
44295
44329
|
const error = obj2(tool.error);
|
|
44296
44330
|
const reason = str2(error.message) || str2(error.type);
|
|
44297
44331
|
if (["DONE", "ERROR", "CANCELED", "INTERRUPTED"].includes(str2(step.state)) && !closed.has(id)) {
|
|
@@ -44309,7 +44343,7 @@ ${imageError(target, reason || str2(step.state))}
|
|
|
44309
44343
|
imageErrors.delete(file2);
|
|
44310
44344
|
}
|
|
44311
44345
|
}
|
|
44312
|
-
events.toolResult(id, failed ? "failed" : "completed",
|
|
44346
|
+
events.toolResult(id, failed ? "failed" : "completed", output2 || reason);
|
|
44313
44347
|
}
|
|
44314
44348
|
return out;
|
|
44315
44349
|
}
|
|
@@ -44423,7 +44457,7 @@ function systemPrompt(text2, _argv, env2) {
|
|
|
44423
44457
|
const rule = `${text2}
|
|
44424
44458
|
|
|
44425
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.`;
|
|
44426
|
-
const hash =
|
|
44460
|
+
const hash = createHash6("sha256").update(rule).digest("hex").slice(0, 16);
|
|
44427
44461
|
const root2 = path21.join(machineHome(), "prompts", `antigravity-${hash}`);
|
|
44428
44462
|
const file2 = path21.join(root2, ".agents", "rules", "language.md");
|
|
44429
44463
|
fs19.mkdirSync(path21.dirname(file2), { recursive: true });
|
|
@@ -44675,6 +44709,7 @@ function createStreamRenderer() {
|
|
|
44675
44709
|
const plans = /* @__PURE__ */ new Set();
|
|
44676
44710
|
const subagents = /* @__PURE__ */ new Map();
|
|
44677
44711
|
const detached = /* @__PURE__ */ new Set();
|
|
44712
|
+
const taskUsage = /* @__PURE__ */ new Map();
|
|
44678
44713
|
const endSubagent = (id, status2) => {
|
|
44679
44714
|
if (subagents.get(id) !== false) return;
|
|
44680
44715
|
subagents.set(id, true);
|
|
@@ -44686,8 +44721,18 @@ function createStreamRenderer() {
|
|
|
44686
44721
|
if (!ev) return `${line}
|
|
44687
44722
|
`;
|
|
44688
44723
|
if (model === void 0) model = eventModel(ev);
|
|
44689
|
-
|
|
44690
|
-
|
|
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
|
+
}
|
|
44691
44736
|
switch (ev.type) {
|
|
44692
44737
|
case "assistant": {
|
|
44693
44738
|
apiFailure = typeof ev.error === "string" ? providerFailure({ type: ev.error }, "Claude could not complete the request.") : void 0;
|
|
@@ -44703,6 +44748,8 @@ function createStreamRenderer() {
|
|
|
44703
44748
|
|
|
44704
44749
|
`);
|
|
44705
44750
|
events.message(b.text);
|
|
44751
|
+
} else if (b?.type === "thinking" && str2(b.thinking).trim()) {
|
|
44752
|
+
events.progressSnapshot("thinking", str2(b.thinking));
|
|
44706
44753
|
} else if (b?.type === "tool_use" && typeof b.name === "string") {
|
|
44707
44754
|
out.push(`\u23FA ${b.name}${argHint(b.input, ARG_KEYS)}
|
|
44708
44755
|
`);
|
|
@@ -44722,8 +44769,8 @@ function createStreamRenderer() {
|
|
|
44722
44769
|
return out.join("");
|
|
44723
44770
|
}
|
|
44724
44771
|
case "user": {
|
|
44725
|
-
const
|
|
44726
|
-
for (const raw of Array.isArray(
|
|
44772
|
+
const content2 = obj2(ev.message).content;
|
|
44773
|
+
for (const raw of Array.isArray(content2) ? content2 : []) {
|
|
44727
44774
|
const b = obj2(raw);
|
|
44728
44775
|
if (b.type !== "tool_result" || plans.has(str2(b.tool_use_id))) continue;
|
|
44729
44776
|
if (subagents.has(str2(b.tool_use_id))) {
|
|
@@ -44767,8 +44814,20 @@ function createStreamRenderer() {
|
|
|
44767
44814
|
if (ev.subtype === "task_notification" && subagents.has(str2(ev.tool_use_id))) {
|
|
44768
44815
|
endSubagent(str2(ev.tool_use_id), str2(ev.status) === "completed" ? "completed" : "failed");
|
|
44769
44816
|
}
|
|
44770
|
-
|
|
44771
|
-
|
|
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)}
|
|
44772
44831
|
`;
|
|
44773
44832
|
}
|
|
44774
44833
|
return "";
|
|
@@ -45108,23 +45167,20 @@ function createCodexStreamRenderer(carried = false) {
|
|
|
45108
45167
|
const started = /* @__PURE__ */ new Set();
|
|
45109
45168
|
const background = createBackgroundTasks();
|
|
45110
45169
|
const subagents = /* @__PURE__ */ new Set();
|
|
45111
|
-
const
|
|
45112
|
-
const collab = (item, done) => {
|
|
45170
|
+
const collab = (item) => {
|
|
45113
45171
|
if (item.type !== "collab_tool_call") return;
|
|
45114
|
-
const key = `${str2(item.id)}:${done}`;
|
|
45115
|
-
if (collabItems.has(key)) return;
|
|
45116
|
-
collabItems.add(key);
|
|
45117
45172
|
for (const [id, raw] of Object.entries(obj2(item.agents_states))) {
|
|
45118
45173
|
const state = obj2(raw);
|
|
45119
45174
|
const status2 = str2(state.status);
|
|
45120
45175
|
if (!["pending_init", "running", "completed", "interrupted", "errored", "shutdown", "not_found"].includes(status2)) continue;
|
|
45121
45176
|
const previous = background.results().find((t2) => t2.id === id);
|
|
45122
|
-
|
|
45177
|
+
const running = status2 === "pending_init" || status2 === "running";
|
|
45178
|
+
if ((running || ["shutdown", "not_found"].includes(status2)) && previous && previous.status !== "running") continue;
|
|
45123
45179
|
if (!subagents.has(id)) {
|
|
45124
45180
|
subagents.add(id);
|
|
45125
45181
|
events.subagent(`agent:${id}`, str2(item.prompt) || "Agent");
|
|
45126
45182
|
}
|
|
45127
|
-
|
|
45183
|
+
if (running) events.progressSnapshot(`agent:${id}`, str2(state.message));
|
|
45128
45184
|
const failed = !running && status2 !== "completed";
|
|
45129
45185
|
if (background.update(id, running ? "running" : failed ? "failed" : "completed", str2(state.message)) && !running) {
|
|
45130
45186
|
events.toolResult(`agent:${id}`, failed ? "failed" : "completed", str2(state.message));
|
|
@@ -45157,15 +45213,21 @@ function createCodexStreamRenderer(carried = false) {
|
|
|
45157
45213
|
if (!threadId) threadId = str2(ev.thread_id).trim() || void 0;
|
|
45158
45214
|
return "";
|
|
45159
45215
|
case "item.started":
|
|
45160
|
-
collab(obj2(ev.item)
|
|
45216
|
+
collab(obj2(ev.item));
|
|
45161
45217
|
itemEvents(events, started, obj2(ev.item), false);
|
|
45162
45218
|
return renderStarted(obj2(ev.item));
|
|
45163
|
-
case "item.updated":
|
|
45164
|
-
|
|
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
|
+
}
|
|
45165
45226
|
return "";
|
|
45227
|
+
}
|
|
45166
45228
|
case "item.completed": {
|
|
45167
45229
|
const item = obj2(ev.item);
|
|
45168
|
-
collab(item
|
|
45230
|
+
collab(item);
|
|
45169
45231
|
if (item.type === "mcp_tool_call" && !/view_image|read_image|open_image/.test(str2(item.tool))) {
|
|
45170
45232
|
const content = obj2(item.result).content;
|
|
45171
45233
|
for (const block of Array.isArray(content) ? content : []) {
|
|
@@ -45434,7 +45496,8 @@ function createKimiStreamRenderer(cwd, resumeId) {
|
|
|
45434
45496
|
`;
|
|
45435
45497
|
switch (row.role) {
|
|
45436
45498
|
case "assistant": {
|
|
45437
|
-
|
|
45499
|
+
const thought = str2(row.reasoning_content);
|
|
45500
|
+
if (thought) events.progressSnapshot("reasoning", thought);
|
|
45438
45501
|
const said = str2(row.content).trim();
|
|
45439
45502
|
if (said) final = said;
|
|
45440
45503
|
if (said) events.message(said);
|
|
@@ -45531,7 +45594,7 @@ function modelOf2(ref) {
|
|
|
45531
45594
|
const provider = str2(model.providerId);
|
|
45532
45595
|
return provider ? `${provider}/${id}` : id;
|
|
45533
45596
|
}
|
|
45534
|
-
function createParts(tail) {
|
|
45597
|
+
function createParts(tail, activity) {
|
|
45535
45598
|
const written = /* @__PURE__ */ new Map();
|
|
45536
45599
|
const tools = /* @__PURE__ */ new Set();
|
|
45537
45600
|
const named = /* @__PURE__ */ new Map();
|
|
@@ -45540,6 +45603,7 @@ function createParts(tail) {
|
|
|
45540
45603
|
const fresh = text2.startsWith(before) ? text2.slice(before.length) : text2;
|
|
45541
45604
|
if (!fresh) return;
|
|
45542
45605
|
written.set(partId, text2);
|
|
45606
|
+
activity();
|
|
45543
45607
|
if (kind === "reasoning" || kind === "thought") tail.thought(fresh);
|
|
45544
45608
|
else tail.text(fresh);
|
|
45545
45609
|
};
|
|
@@ -45551,7 +45615,10 @@ function createParts(tail) {
|
|
|
45551
45615
|
const partId = str2(part.partId);
|
|
45552
45616
|
if (type === "text" || type === "reasoning" || type === "thought") {
|
|
45553
45617
|
if (partId) say(partId, type, str2(part.text));
|
|
45554
|
-
else
|
|
45618
|
+
else if (str2(part.text)) {
|
|
45619
|
+
activity();
|
|
45620
|
+
tail.text(str2(part.text));
|
|
45621
|
+
}
|
|
45555
45622
|
return;
|
|
45556
45623
|
}
|
|
45557
45624
|
if (type !== "tool") return;
|
|
@@ -45575,14 +45642,18 @@ function createParts(tail) {
|
|
|
45575
45642
|
const delta = str2(event2.delta);
|
|
45576
45643
|
if (!delta) return;
|
|
45577
45644
|
written.set(partId, (written.get(partId) ?? "") + delta);
|
|
45645
|
+
activity();
|
|
45578
45646
|
if (field === "reasoning") tail.thought(delta);
|
|
45579
45647
|
else tail.text(delta);
|
|
45580
45648
|
},
|
|
45581
45649
|
/** A piece of the turn, as `model.streaming` sends it. */
|
|
45582
45650
|
streaming(payload) {
|
|
45583
45651
|
const kind = str2(payload.kind);
|
|
45584
|
-
|
|
45585
|
-
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
|
+
}
|
|
45586
45657
|
if (kind !== "tool_call") return;
|
|
45587
45658
|
const callId = str2(payload.toolCallId);
|
|
45588
45659
|
const name = str2(payload.toolName) || "tool";
|
|
@@ -45622,7 +45693,7 @@ function stopped(io, why) {
|
|
|
45622
45693
|
}
|
|
45623
45694
|
async function oneTurn2(io, options) {
|
|
45624
45695
|
const tail = createTail(io.log);
|
|
45625
|
-
const parts = createParts(tail);
|
|
45696
|
+
const parts = createParts(tail, () => io.activity?.());
|
|
45626
45697
|
const activityEvents = createEventCollector();
|
|
45627
45698
|
const activeCalls = /* @__PURE__ */ new Set();
|
|
45628
45699
|
let live = false;
|
|
@@ -45649,7 +45720,6 @@ async function oneTurn2(io, options) {
|
|
|
45649
45720
|
const part = obj2(payload.part);
|
|
45650
45721
|
const state = obj2(part.state);
|
|
45651
45722
|
const type = str2(envelope.type);
|
|
45652
|
-
if (["part.delta", "model.streaming"].includes(type) && str2(payload.delta)) io.activity?.();
|
|
45653
45723
|
const id = str2(payload.toolCallId) || str2(part.callId) || str2(part.partId);
|
|
45654
45724
|
const name = str2(payload.toolName) || str2(part.tool) || str2(state.title);
|
|
45655
45725
|
if (id && name && !activeCalls.has(id)) {
|
|
@@ -45658,7 +45728,21 @@ async function oneTurn2(io, options) {
|
|
|
45658
45728
|
else activityEvents.toolCall(id, name, /^(?:bash|shell|execute|run_command|terminal)$/i.test(name) ? "execute" : "other");
|
|
45659
45729
|
}
|
|
45660
45730
|
const status2 = str2(state.status) || str2(payload.kind);
|
|
45661
|
-
|
|
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
|
+
}
|
|
45662
45746
|
for (const e of activityEvents.events()) io.event?.(e);
|
|
45663
45747
|
}
|
|
45664
45748
|
event(envelope, parts, tail, live, ended);
|
|
@@ -45727,6 +45811,7 @@ async function oneTurn2(io, options) {
|
|
|
45727
45811
|
});
|
|
45728
45812
|
const before = io.resumeId ? await tokensOf(rpc, sessionId) : ZERO_USAGE;
|
|
45729
45813
|
live = true;
|
|
45814
|
+
io.event?.({ kind: "phase", data: { phase: "submitted", at: (/* @__PURE__ */ new Date()).toISOString() } });
|
|
45730
45815
|
const accepted = await rpc.call("session/send", { sessionId, content: io.prompt });
|
|
45731
45816
|
if (accepted.accepted === false) throw new Error("the agent would not take the prompt");
|
|
45732
45817
|
const done = await finished;
|
|
@@ -45808,9 +45893,8 @@ function decide2(params, tail) {
|
|
|
45808
45893
|
|
|
45809
45894
|
// ../cli/src/lib/agent/idle.ts
|
|
45810
45895
|
var IDLE_MS = 5 * 6e4;
|
|
45811
|
-
var IDLE_ERROR = "No
|
|
45896
|
+
var IDLE_ERROR = "No verifiable progress for 5 minutes (idle timeout).";
|
|
45812
45897
|
var IDLE_FAILURE = { code: "idle_timeout", source: "runtime", summary: IDLE_ERROR };
|
|
45813
|
-
var PROVIDER_RETRY_MS = { announcement: 10 * 6e4, episode: 30 * 6e4 };
|
|
45814
45898
|
|
|
45815
45899
|
// ../cli/src/lib/agent/wire/codex.ts
|
|
45816
45900
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
@@ -46139,6 +46223,7 @@ async function run(io, options, count2) {
|
|
|
46139
46223
|
const offered = /* @__PURE__ */ new Map();
|
|
46140
46224
|
const snapshot = (w) => JSON.stringify([w.threadId, w.processId, w.status, w.exitCode, w.result]);
|
|
46141
46225
|
const childEvents = /* @__PURE__ */ new Map();
|
|
46226
|
+
const freshOutput = progressSnapshots();
|
|
46142
46227
|
const seenItems = /* @__PURE__ */ new Set();
|
|
46143
46228
|
const completedTurns = /* @__PURE__ */ new Set();
|
|
46144
46229
|
const historicalTurns = /* @__PURE__ */ new Set();
|
|
@@ -46173,6 +46258,9 @@ async function run(io, options, count2) {
|
|
|
46173
46258
|
io.stdout.off("close", closed);
|
|
46174
46259
|
io.stdin.off("error", inputFailed);
|
|
46175
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
|
+
}
|
|
46176
46264
|
cleanup.items = work.work().map(({ id, threadId: threadId2, processId, status: status3, disposition }) => ({ id, threadId: threadId2, processId, status: status3, disposition }));
|
|
46177
46265
|
io.log(renderer.flush());
|
|
46178
46266
|
const usage = ownUsage(total, baseline);
|
|
@@ -46233,7 +46321,9 @@ async function run(io, options, count2) {
|
|
|
46233
46321
|
io.idleSignal?.addEventListener("abort", idle, { once: true });
|
|
46234
46322
|
const childUpdates = () => {
|
|
46235
46323
|
for (const w of work.entries.values()) {
|
|
46236
|
-
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;
|
|
46237
46327
|
if (!childEvents.has(w.id)) io.event?.({ kind: "tool_call", data: { toolCallId: w.id, title: "Agent", kind: "other", status: "in_progress", subagent: true } });
|
|
46238
46328
|
if (w.status !== "running") io.event?.({ kind: "tool_call_update", data: { toolCallId: w.id, status: w.status === "completed" ? "completed" : "failed", result: w.result } });
|
|
46239
46329
|
childEvents.set(w.id, w.status);
|
|
@@ -46471,7 +46561,26 @@ async function run(io, options, count2) {
|
|
|
46471
46561
|
armCleanup();
|
|
46472
46562
|
if (source === threadId && obj2(p.item).type !== "agentMessage") item(obj2(p.item), msg.method === "item/completed", false);
|
|
46473
46563
|
}
|
|
46474
|
-
|
|
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
|
+
}
|
|
46475
46584
|
if (msg.method === "turn/completed") {
|
|
46476
46585
|
work.observeTurn(source, obj2(p.turn));
|
|
46477
46586
|
armCleanup();
|
|
@@ -46479,13 +46588,7 @@ async function run(io, options, count2) {
|
|
|
46479
46588
|
childUpdates();
|
|
46480
46589
|
return;
|
|
46481
46590
|
}
|
|
46482
|
-
|
|
46483
|
-
if (historicalTurns.has(turnId) || currentTurn2 && turnId && currentTurn2 !== turnId) return;
|
|
46484
|
-
if (submitted && ["item/agentMessage/delta", "item/plan/delta", "item/reasoning/summaryTextDelta", "item/reasoning/textDelta"].includes(msg.method ?? "") && str2(p.delta)) {
|
|
46485
|
-
if (msg.method?.startsWith("item/reasoning/")) thinking();
|
|
46486
|
-
else recovered();
|
|
46487
|
-
io.activity?.();
|
|
46488
|
-
}
|
|
46591
|
+
if (!live) return;
|
|
46489
46592
|
if (msg.method === "turn/started") {
|
|
46490
46593
|
if (!submitted || completedTurns.has(turnId)) return;
|
|
46491
46594
|
currentTurn2 = turnId;
|
|
@@ -46587,7 +46690,6 @@ async function run(io, options, count2) {
|
|
|
46587
46690
|
waiting2 = true;
|
|
46588
46691
|
io.event?.({ kind: "log", data: { text: failure2.summary } });
|
|
46589
46692
|
}
|
|
46590
|
-
io.activity?.();
|
|
46591
46693
|
await delay(500, void 0, { signal: io.signal });
|
|
46592
46694
|
preparingUntil = Date.now() + CONVERSATION_MS.prepare;
|
|
46593
46695
|
}
|