zelio-cli 0.0.0-stage → 0.1.0-beta.1
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/README.md +178 -2
- package/dist/attachments.js +121 -0
- package/dist/attachments.js.map +1 -0
- package/dist/cli.js +469 -0
- package/dist/cli.js.map +1 -0
- package/dist/cloud/board.js +311 -0
- package/dist/cloud/board.js.map +1 -0
- package/dist/cloud/command.js +260 -0
- package/dist/cloud/command.js.map +1 -0
- package/dist/cloud/config.js +132 -0
- package/dist/cloud/config.js.map +1 -0
- package/dist/cloud/credentials.js +134 -0
- package/dist/cloud/credentials.js.map +1 -0
- package/dist/cloud/login.js +165 -0
- package/dist/cloud/login.js.map +1 -0
- package/dist/cloud/pair.js +110 -0
- package/dist/cloud/pair.js.map +1 -0
- package/dist/cloud/pkce.js +16 -0
- package/dist/cloud/pkce.js.map +1 -0
- package/dist/cloud/push-nudge.js +63 -0
- package/dist/cloud/push-nudge.js.map +1 -0
- package/dist/cloud/relay.js +129 -0
- package/dist/cloud/relay.js.map +1 -0
- package/dist/cloud/token.js +66 -0
- package/dist/cloud/token.js.map +1 -0
- package/dist/cloud/tunnel.js +410 -0
- package/dist/cloud/tunnel.js.map +1 -0
- package/dist/db/db.js +1614 -0
- package/dist/db/db.js.map +1 -0
- package/dist/db/lifecycle.js +133 -0
- package/dist/db/lifecycle.js.map +1 -0
- package/dist/limits.js +35 -0
- package/dist/limits.js.map +1 -0
- package/dist/metrics.js +30 -0
- package/dist/metrics.js.map +1 -0
- package/dist/orchestrator/claude-session.js +208 -0
- package/dist/orchestrator/claude-session.js.map +1 -0
- package/dist/orchestrator/codex-session.js +326 -0
- package/dist/orchestrator/codex-session.js.map +1 -0
- package/dist/orchestrator/contract.js +181 -0
- package/dist/orchestrator/contract.js.map +1 -0
- package/dist/orchestrator/explore.js +176 -0
- package/dist/orchestrator/explore.js.map +1 -0
- package/dist/orchestrator/new-task-prompt.js +51 -0
- package/dist/orchestrator/new-task-prompt.js.map +1 -0
- package/dist/orchestrator/pi-session.js +228 -0
- package/dist/orchestrator/pi-session.js.map +1 -0
- package/dist/orchestrator/prompt.js +110 -0
- package/dist/orchestrator/prompt.js.map +1 -0
- package/dist/orchestrator/research.js +178 -0
- package/dist/orchestrator/research.js.map +1 -0
- package/dist/orchestrator/runtime.js +1054 -0
- package/dist/orchestrator/runtime.js.map +1 -0
- package/dist/orchestrator/session.js +2 -0
- package/dist/orchestrator/session.js.map +1 -0
- package/dist/orchestrator/types.js +2 -0
- package/dist/orchestrator/types.js.map +1 -0
- package/dist/orchestrator/web.js +276 -0
- package/dist/orchestrator/web.js.map +1 -0
- package/dist/repo/index.js +188 -0
- package/dist/repo/index.js.map +1 -0
- package/dist/repo/instructions.js +52 -0
- package/dist/repo/instructions.js.map +1 -0
- package/dist/repo/linked-boards.js +252 -0
- package/dist/repo/linked-boards.js.map +1 -0
- package/dist/run/actions.js +233 -0
- package/dist/run/actions.js.map +1 -0
- package/dist/run/bash-guard.js +183 -0
- package/dist/run/bash-guard.js.map +1 -0
- package/dist/run/claude-runtime.js +242 -0
- package/dist/run/claude-runtime.js.map +1 -0
- package/dist/run/claude-stream.js +306 -0
- package/dist/run/claude-stream.js.map +1 -0
- package/dist/run/codex-client.js +200 -0
- package/dist/run/codex-client.js.map +1 -0
- package/dist/run/codex-runtime.js +366 -0
- package/dist/run/codex-runtime.js.map +1 -0
- package/dist/run/context.js +87 -0
- package/dist/run/context.js.map +1 -0
- package/dist/run/diff.js +196 -0
- package/dist/run/diff.js.map +1 -0
- package/dist/run/evidence.js +48 -0
- package/dist/run/evidence.js.map +1 -0
- package/dist/run/finish.js +393 -0
- package/dist/run/finish.js.map +1 -0
- package/dist/run/harness-runtime.js +28 -0
- package/dist/run/harness-runtime.js.map +1 -0
- package/dist/run/harnesses.js +273 -0
- package/dist/run/harnesses.js.map +1 -0
- package/dist/run/issue.js +79 -0
- package/dist/run/issue.js.map +1 -0
- package/dist/run/keep-awake.js +58 -0
- package/dist/run/keep-awake.js.map +1 -0
- package/dist/run/lead.js +200 -0
- package/dist/run/lead.js.map +1 -0
- package/dist/run/manager.js +1709 -0
- package/dist/run/manager.js.map +1 -0
- package/dist/run/mentions.js +35 -0
- package/dist/run/mentions.js.map +1 -0
- package/dist/run/merge-watch.js +394 -0
- package/dist/run/merge-watch.js.map +1 -0
- package/dist/run/models.js +88 -0
- package/dist/run/models.js.map +1 -0
- package/dist/run/phases.js +23 -0
- package/dist/run/phases.js.map +1 -0
- package/dist/run/pi-rpc.js +412 -0
- package/dist/run/pi-rpc.js.map +1 -0
- package/dist/run/pr-merge.js +121 -0
- package/dist/run/pr-merge.js.map +1 -0
- package/dist/run/profiles.js +43 -0
- package/dist/run/profiles.js.map +1 -0
- package/dist/run/prompt.js +345 -0
- package/dist/run/prompt.js.map +1 -0
- package/dist/run/pull-request.js +23 -0
- package/dist/run/pull-request.js.map +1 -0
- package/dist/run/result-tool.js +93 -0
- package/dist/run/result-tool.js.map +1 -0
- package/dist/run/result.js +113 -0
- package/dist/run/result.js.map +1 -0
- package/dist/run/retro.js +346 -0
- package/dist/run/retro.js.map +1 -0
- package/dist/run/settings.js +25 -0
- package/dist/run/settings.js.map +1 -0
- package/dist/run/thinking.js +41 -0
- package/dist/run/thinking.js.map +1 -0
- package/dist/run/types.js +2 -0
- package/dist/run/types.js.map +1 -0
- package/dist/run/workflow.js +266 -0
- package/dist/run/workflow.js.map +1 -0
- package/dist/run/worktree.js +354 -0
- package/dist/run/worktree.js.map +1 -0
- package/dist/server/app.js +2503 -0
- package/dist/server/app.js.map +1 -0
- package/dist/server/auth.js +93 -0
- package/dist/server/auth.js.map +1 -0
- package/dist/server/demo.js +96 -0
- package/dist/server/demo.js.map +1 -0
- package/dist/server/idempotency.js +104 -0
- package/dist/server/idempotency.js.map +1 -0
- package/dist/server/port.js +36 -0
- package/dist/server/port.js.map +1 -0
- package/dist/server/principal.js +90 -0
- package/dist/server/principal.js.map +1 -0
- package/dist/server/terminal.js +285 -0
- package/dist/server/terminal.js.map +1 -0
- package/dist/setup/components.js +98 -0
- package/dist/setup/components.js.map +1 -0
- package/dist/setup/config.js +102 -0
- package/dist/setup/config.js.map +1 -0
- package/dist/setup/ink-ui.js +188 -0
- package/dist/setup/ink-ui.js.map +1 -0
- package/dist/setup/onboarding.js +183 -0
- package/dist/setup/onboarding.js.map +1 -0
- package/dist/setup/run.js +70 -0
- package/dist/setup/run.js.map +1 -0
- package/dist/ticket-cli.js +116 -0
- package/dist/ticket-cli.js.map +1 -0
- package/dist/voice/index.js +69 -0
- package/dist/voice/index.js.map +1 -0
- package/dist/voice/moonshine.js +247 -0
- package/dist/voice/moonshine.js.map +1 -0
- package/dist/voice/wav.js +54 -0
- package/dist/voice/wav.js.map +1 -0
- package/dist/voice/whisper.js +491 -0
- package/dist/voice/whisper.js.map +1 -0
- package/dist/web/assets/index-ChuS3qKc.js +254 -0
- package/dist/web/assets/index-DR6WkmzI.css +1 -0
- package/dist/web/icons/apple-touch-icon.png +0 -0
- package/dist/web/icons/icon-192.png +0 -0
- package/dist/web/icons/icon-512.png +0 -0
- package/dist/web/icons/maskable-512.png +0 -0
- package/dist/web/index.html +21 -0
- package/dist/web/manifest.webmanifest +30 -0
- package/dist/web/sw.js +183 -0
- package/package.json +96 -4
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { stripVTControlCharacters } from "node:util";
|
|
3
|
+
/** A stuck harness must not make the Agents page hang forever. */
|
|
4
|
+
const DEFAULT_TIMEOUT_MS = 10_000;
|
|
5
|
+
const MAX_STDERR = 400;
|
|
6
|
+
/**
|
|
7
|
+
* Pi prints a provider/model table, not a list of bare IDs. Keep both columns
|
|
8
|
+
* so models from the same provider remain distinct and --model selects the
|
|
9
|
+
* intended provider. Custom wrappers may still print IDs in the first column.
|
|
10
|
+
*/
|
|
11
|
+
export function parseModelList(stdout) {
|
|
12
|
+
const lines = stripVTControlCharacters(stdout)
|
|
13
|
+
.split("\n")
|
|
14
|
+
.map((line) => line.trim())
|
|
15
|
+
.filter(Boolean);
|
|
16
|
+
if (lines.some((line) => /^No models (?:available|matching)\b/.test(line)))
|
|
17
|
+
return [];
|
|
18
|
+
const header = lines.findIndex((line) => /^provider\s+model(?:\s|$)/.test(line));
|
|
19
|
+
const seen = new Set();
|
|
20
|
+
for (const line of header < 0 ? lines : lines.slice(header + 1)) {
|
|
21
|
+
const [first, model] = line.split(/\s+/);
|
|
22
|
+
if (!first)
|
|
23
|
+
continue;
|
|
24
|
+
if (header >= 0) {
|
|
25
|
+
if (model)
|
|
26
|
+
seen.add(`${first}/${model}`);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
seen.add(first);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return [...seen];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Asks one harness which models it knows. Every failure — no such command, a
|
|
36
|
+
* non-zero exit, a timeout — becomes an `error` string, because the caller is a
|
|
37
|
+
* page that has to keep working with a free-text model field.
|
|
38
|
+
*/
|
|
39
|
+
export function listAgentModels(command, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
40
|
+
return new Promise((resolve) => {
|
|
41
|
+
let stdout = "";
|
|
42
|
+
let stderr = "";
|
|
43
|
+
let settled = false;
|
|
44
|
+
let child;
|
|
45
|
+
const finish = (result) => {
|
|
46
|
+
if (settled)
|
|
47
|
+
return;
|
|
48
|
+
settled = true;
|
|
49
|
+
clearTimeout(timer);
|
|
50
|
+
resolve(result);
|
|
51
|
+
};
|
|
52
|
+
try {
|
|
53
|
+
child = spawn(command, ["--list-models"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
54
|
+
}
|
|
55
|
+
catch (cause) {
|
|
56
|
+
const message = cause instanceof Error ? cause.message : "the harness could not start";
|
|
57
|
+
resolve({ models: [], error: `${command}: ${message}` });
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const timer = setTimeout(() => {
|
|
61
|
+
child.kill("SIGKILL");
|
|
62
|
+
finish({ models: [], error: `${command} --list-models timed out` });
|
|
63
|
+
}, timeoutMs);
|
|
64
|
+
child.stdout?.setEncoding("utf8");
|
|
65
|
+
child.stdout?.on("data", (chunk) => {
|
|
66
|
+
stdout += chunk;
|
|
67
|
+
});
|
|
68
|
+
child.stderr?.setEncoding("utf8");
|
|
69
|
+
child.stderr?.on("data", (chunk) => {
|
|
70
|
+
stderr = (stderr + chunk).slice(-MAX_STDERR);
|
|
71
|
+
});
|
|
72
|
+
child.on("error", (cause) => {
|
|
73
|
+
finish({ models: [], error: `${command}: ${cause.message}` });
|
|
74
|
+
});
|
|
75
|
+
child.on("close", (code) => {
|
|
76
|
+
if (code === 0) {
|
|
77
|
+
finish({ models: parseModelList(stdout), error: null });
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const detail = stderr.trim().replace(/\s+/g, " ");
|
|
81
|
+
finish({
|
|
82
|
+
models: [],
|
|
83
|
+
error: `${command} --list-models exited ${code ?? "without a code"}${detail ? `: ${detail}` : ""}`,
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/run/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,kEAAkE;AAClE,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,UAAU,GAAG,GAAG,CAAC;AASvB;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,MAAM,KAAK,GAAG,wBAAwB,CAAC,MAAM,CAAC;SAC3C,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,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C,CAAC,UAAU,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YAC1B,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,KAAK,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACzB,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;gBACf,MAAM,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;gBACxD,OAAO;YACT,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YAClD,MAAM,CAAC;gBACL,MAAM,EAAE,EAAE;gBACV,KAAK,EAAE,GAAG,OAAO,yBAAyB,IAAI,IAAI,gBAAgB,GAChE,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC,CAAC,EAC3B,EAAE;aACH,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Best-effort trace phase; validation failures deliberately reopen implementation. */
|
|
2
|
+
export function phaseForTool(current, tool, args, failed = false) {
|
|
3
|
+
if (failed && current === "validate")
|
|
4
|
+
return "implement";
|
|
5
|
+
if (tool === "read" ||
|
|
6
|
+
tool === "grep" ||
|
|
7
|
+
tool === "find" ||
|
|
8
|
+
tool === "ls" ||
|
|
9
|
+
tool === "inspect") {
|
|
10
|
+
return current === "inspect" ? "inspect" : current;
|
|
11
|
+
}
|
|
12
|
+
if (tool === "edit" || tool === "write")
|
|
13
|
+
return "implement";
|
|
14
|
+
if (tool !== "bash")
|
|
15
|
+
return current;
|
|
16
|
+
const command = String(args?.command ?? "");
|
|
17
|
+
if (/\b(pnpm\s+(check|test|typecheck|lint|fmt:check)|npm\s+test|vitest|pytest|cargo\s+test)\b/.test(command))
|
|
18
|
+
return "validate";
|
|
19
|
+
if (/\b(git\s+(add|commit|push)|gh\s+pr\s+|zelio\s+ticket\s+comment|ZELIO_STATUS_URL)\b/.test(command))
|
|
20
|
+
return "finish";
|
|
21
|
+
return current;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=phases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phases.js","sourceRoot":"","sources":["../../src/run/phases.ts"],"names":[],"mappings":"AAEA,uFAAuF;AACvF,MAAM,UAAU,YAAY,CAC1B,OAAgC,EAChC,IAAY,EACZ,IAAa,EACb,MAAM,GAAG,KAAK;IAEd,IAAI,MAAM,IAAI,OAAO,KAAK,UAAU;QAAE,OAAO,WAAW,CAAC;IACzD,IACE,IAAI,KAAK,MAAM;QACf,IAAI,KAAK,MAAM;QACf,IAAI,KAAK,MAAM;QACf,IAAI,KAAK,IAAI;QACb,IAAI,KAAK,SAAS,EAClB,CAAC;QACD,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;IACrD,CAAC;IACD,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,OAAO;QAAE,OAAO,WAAW,CAAC;IAC5D,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,OAAO,CAAC;IACpC,MAAM,OAAO,GAAG,MAAM,CAAE,IAAqC,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;IAC9E,IACE,0FAA0F,CAAC,IAAI,CAC7F,OAAO,CACR;QAED,OAAO,UAAU,CAAC;IACpB,IACE,oFAAoF,CAAC,IAAI,CACvF,OAAO,CACR;QAED,OAAO,QAAQ,CAAC;IAClB,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { clip, stripWorktreeCd, toolResultText } from "./actions.js";
|
|
3
|
+
import { BASH_GUARD_EXTENSION } from "./bash-guard.js";
|
|
4
|
+
import { RESULT_TOOL_EXTENSION } from "./result-tool.js";
|
|
5
|
+
import { CODING_AGENT_PROMPT } from "./prompt.js";
|
|
6
|
+
import { resolveThinkingLevel, thinkingArgs } from "./thinking.js";
|
|
7
|
+
/** A ticket can be a long job; the timeout is a backstop, not a turn budget. */
|
|
8
|
+
const DEFAULT_TIMEOUT_MS = 30 * 60_000;
|
|
9
|
+
const KILL_GRACE_MS = 2_000;
|
|
10
|
+
/** Stable, machine-independent tools for ticket runs; local pi defaults are irrelevant. */
|
|
11
|
+
export const DEVELOPER_TOOLS = ["read", "bash", "edit", "write", "grep", "find", "ls"];
|
|
12
|
+
/** The same honest labels as the panel, without depending on the planner. */
|
|
13
|
+
export function runToolLabel(tool, args) {
|
|
14
|
+
const fields = (args ?? {});
|
|
15
|
+
const text = (key) => typeof fields[key] === "string" ? fields[key] : "";
|
|
16
|
+
switch (tool) {
|
|
17
|
+
case "read": {
|
|
18
|
+
const path = text("path") || text("file_path");
|
|
19
|
+
return path ? `Reading ${clip(path, 46)}` : "Reading a file";
|
|
20
|
+
}
|
|
21
|
+
case "grep": {
|
|
22
|
+
const pattern = text("pattern") || text("query");
|
|
23
|
+
return pattern ? `Searching for “${clip(pattern, 32)}”` : "Searching the repo";
|
|
24
|
+
}
|
|
25
|
+
case "find": {
|
|
26
|
+
const pattern = text("pattern");
|
|
27
|
+
return pattern ? `Finding “${clip(pattern, 32)}”` : "Finding files";
|
|
28
|
+
}
|
|
29
|
+
case "ls": {
|
|
30
|
+
const path = text("path");
|
|
31
|
+
return path ? `Listing ${clip(path, 46)}` : "Listing the repo";
|
|
32
|
+
}
|
|
33
|
+
case "bash": {
|
|
34
|
+
// Ticket commands start with `cd <worktree> &&`; spending the label on a
|
|
35
|
+
// path the person already knows hides the part that says what it runs.
|
|
36
|
+
const command = stripWorktreeCd(text("command"));
|
|
37
|
+
return command ? `Running ${clip(command, 44)}` : "Running a command";
|
|
38
|
+
}
|
|
39
|
+
case "edit":
|
|
40
|
+
case "write": {
|
|
41
|
+
const path = text("path") || text("file_path");
|
|
42
|
+
return path ? `Editing ${clip(path, 46)}` : "Editing a file";
|
|
43
|
+
}
|
|
44
|
+
default:
|
|
45
|
+
return clip(tool, 40);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The token counts and the dollar cost worth keeping. Providers and pi versions
|
|
50
|
+
* disagree about the field names, so both the short and the snake_case
|
|
51
|
+
* spellings are read; a message with no numeric usage is not a zero, it is
|
|
52
|
+
* silence.
|
|
53
|
+
*
|
|
54
|
+
* A provider reports prompt tokens in three buckets: fresh input, cache reads
|
|
55
|
+
* and cache writes. Counting only `input` recorded the smallest one, so a long
|
|
56
|
+
* cached run looked nearly free. Input here is every token the model was sent,
|
|
57
|
+
* which also makes input + output match pi's own `totalTokens`.
|
|
58
|
+
*
|
|
59
|
+
* The cost is whatever the harness says it spent. pi reports a priced message as
|
|
60
|
+
* `cost: { input, output, cacheRead, cacheWrite, total }`, while older harnesses
|
|
61
|
+
* put one number on `cost`; both are read. A usage object that carries tokens
|
|
62
|
+
* but no cost is `cost: null`, not zero: a harness that does not price its own
|
|
63
|
+
* messages must not look free.
|
|
64
|
+
*/
|
|
65
|
+
export function readUsage(usage) {
|
|
66
|
+
if (!usage || typeof usage !== "object")
|
|
67
|
+
return null;
|
|
68
|
+
const fields = usage;
|
|
69
|
+
const count = (...names) => {
|
|
70
|
+
for (const name of names) {
|
|
71
|
+
const value = fields[name];
|
|
72
|
+
if (typeof value === "number" && Number.isFinite(value) && value >= 0)
|
|
73
|
+
return value;
|
|
74
|
+
}
|
|
75
|
+
return undefined;
|
|
76
|
+
};
|
|
77
|
+
const input = count("input", "input_tokens", "inputTokens");
|
|
78
|
+
const output = count("output", "output_tokens", "outputTokens");
|
|
79
|
+
// pi 1.4 nests the dollars under `cost.total`, so the flat lookup finds no
|
|
80
|
+
// number there; reading only `cost` reported every real run as unpriced.
|
|
81
|
+
const costField = fields.cost;
|
|
82
|
+
const nestedTotal = costField && typeof costField === "object"
|
|
83
|
+
? costField.total
|
|
84
|
+
: undefined;
|
|
85
|
+
const cost = count("cost", "cost_usd", "totalCost", "total_cost", "total_cost_usd") ??
|
|
86
|
+
(typeof nestedTotal === "number" && Number.isFinite(nestedTotal) && nestedTotal >= 0
|
|
87
|
+
? nestedTotal
|
|
88
|
+
: null);
|
|
89
|
+
if (input === undefined && output === undefined && cost === null)
|
|
90
|
+
return null;
|
|
91
|
+
const cacheRead = count("cacheRead", "cache_read", "cacheReadTokens", "cache_read_tokens") ?? 0;
|
|
92
|
+
const cacheWrite = count("cacheWrite", "cache_write", "cacheWriteTokens", "cache_write_tokens") ?? 0;
|
|
93
|
+
return { input: (input ?? 0) + cacheRead + cacheWrite, output: output ?? 0, cost };
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* pi over RPC, with the event shapes the M0 spike documented: LF-delimited
|
|
97
|
+
* JSONL, `agent_settled` as the only reliable end of work, and no exit until
|
|
98
|
+
* stdin closes.
|
|
99
|
+
*/
|
|
100
|
+
export class PiRpcRuntime {
|
|
101
|
+
command;
|
|
102
|
+
fixedCommand;
|
|
103
|
+
timeoutMs;
|
|
104
|
+
messageTimeoutMs;
|
|
105
|
+
fallbackThinking;
|
|
106
|
+
constructor(options = {}) {
|
|
107
|
+
this.command = options.command ?? process.env.ZELIO_HARNESS ?? "pi";
|
|
108
|
+
this.fixedCommand = options.command?.trim() || undefined;
|
|
109
|
+
this.timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
110
|
+
this.messageTimeoutMs = options.messageTimeoutMs ?? 2_000;
|
|
111
|
+
this.fallbackThinking =
|
|
112
|
+
options.thinking ??
|
|
113
|
+
resolveThinkingLevel(process.env.ZELIO_AGENT_THINKING, "ZELIO_AGENT_THINKING", "low");
|
|
114
|
+
}
|
|
115
|
+
spawn(cwd, prompt, options = {}) {
|
|
116
|
+
const thinking = options.thinking ?? this.fallbackThinking;
|
|
117
|
+
const reporting = options.reporting === true && !options.readOnly;
|
|
118
|
+
// A profile may name its own harness; an empty value means the server's
|
|
119
|
+
// default (ZELIO_HARNESS, then `pi`).
|
|
120
|
+
const command = this.fixedCommand || options.command?.trim() || this.command;
|
|
121
|
+
// A session is how a run outlives the process that was running it: the
|
|
122
|
+
// board opens the same id again after a restart, so the agent keeps its
|
|
123
|
+
// conversation instead of being briefed a second time. `--no-session` is
|
|
124
|
+
// only the fallback for a caller that has nowhere to keep one.
|
|
125
|
+
const sessionArgs = options.sessionId
|
|
126
|
+
? [
|
|
127
|
+
"--session-id",
|
|
128
|
+
options.sessionId,
|
|
129
|
+
...(options.sessionDir ? ["--session-dir", options.sessionDir] : []),
|
|
130
|
+
]
|
|
131
|
+
: ["--no-session"];
|
|
132
|
+
const child = spawn(command, [
|
|
133
|
+
"--mode",
|
|
134
|
+
"rpc",
|
|
135
|
+
...sessionArgs,
|
|
136
|
+
"--no-mcp",
|
|
137
|
+
"--no-extensions",
|
|
138
|
+
// RunManager already supplies repository instructions and the resolved workflow.
|
|
139
|
+
...(reporting ? ["--no-context-files"] : []),
|
|
140
|
+
...(options.shellGuard ? ["--extension", BASH_GUARD_EXTENSION.href] : []),
|
|
141
|
+
...(reporting ? ["--extension", RESULT_TOOL_EXTENSION.href] : []),
|
|
142
|
+
"--tools",
|
|
143
|
+
[...(options.tools ?? DEVELOPER_TOOLS), ...(reporting ? ["report_result"] : [])].join(","),
|
|
144
|
+
"--no-skills",
|
|
145
|
+
"--no-prompt-templates",
|
|
146
|
+
"--system-prompt",
|
|
147
|
+
options.systemPrompt ?? CODING_AGENT_PROMPT,
|
|
148
|
+
...(options.model?.trim() ? ["--model", options.model.trim()] : []),
|
|
149
|
+
...thinkingArgs(thinking),
|
|
150
|
+
], {
|
|
151
|
+
cwd,
|
|
152
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
153
|
+
env: options.env ? { ...process.env, ...options.env } : process.env,
|
|
154
|
+
});
|
|
155
|
+
const events = [];
|
|
156
|
+
let finished = false;
|
|
157
|
+
let terminal = false;
|
|
158
|
+
let wake;
|
|
159
|
+
let stderr = "";
|
|
160
|
+
let timedOut = false;
|
|
161
|
+
let aborted = false;
|
|
162
|
+
let turnSettled = false;
|
|
163
|
+
let turnCanContinue = false;
|
|
164
|
+
let nextMessageId = 1;
|
|
165
|
+
const pendingMessages = new Map();
|
|
166
|
+
const settleMessages = (accepted) => {
|
|
167
|
+
for (const pending of pendingMessages.values()) {
|
|
168
|
+
clearTimeout(pending.timer);
|
|
169
|
+
pending.resolve(accepted);
|
|
170
|
+
}
|
|
171
|
+
pendingMessages.clear();
|
|
172
|
+
};
|
|
173
|
+
let killTimer;
|
|
174
|
+
const signal = () => {
|
|
175
|
+
const resume = wake;
|
|
176
|
+
wake = undefined;
|
|
177
|
+
resume?.();
|
|
178
|
+
};
|
|
179
|
+
const push = (event) => {
|
|
180
|
+
events.push(event);
|
|
181
|
+
signal();
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Tools disagree about `partialResult`: bash reports the whole output so
|
|
185
|
+
* far, others report only the newest chunk. Both collapse to a delta here,
|
|
186
|
+
* so the board can append what it receives without thinking about it.
|
|
187
|
+
*/
|
|
188
|
+
const toolOutputs = new Map();
|
|
189
|
+
const pushToolText = (record, raw) => {
|
|
190
|
+
const tool = record.toolName ?? "tool";
|
|
191
|
+
const id = record.toolCallId ?? tool;
|
|
192
|
+
const text = toolResultText(raw);
|
|
193
|
+
if (!text)
|
|
194
|
+
return;
|
|
195
|
+
const seen = toolOutputs.get(id) ?? "";
|
|
196
|
+
const cumulative = text.startsWith(seen);
|
|
197
|
+
const delta = cumulative ? text.slice(seen.length) : text;
|
|
198
|
+
toolOutputs.set(id, cumulative ? text : seen + text);
|
|
199
|
+
if (delta)
|
|
200
|
+
push({
|
|
201
|
+
type: "tool_output",
|
|
202
|
+
tool,
|
|
203
|
+
text: delta,
|
|
204
|
+
...(record.toolCallId ? { callId: record.toolCallId } : {}),
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
const finish = (event) => {
|
|
208
|
+
if (terminal)
|
|
209
|
+
return;
|
|
210
|
+
terminal = true;
|
|
211
|
+
finished = true;
|
|
212
|
+
settleMessages(false);
|
|
213
|
+
clearTimeout(timer);
|
|
214
|
+
clearTimeout(killTimer);
|
|
215
|
+
push(event);
|
|
216
|
+
};
|
|
217
|
+
const timer = setTimeout(() => {
|
|
218
|
+
timedOut = true;
|
|
219
|
+
child.kill("SIGKILL");
|
|
220
|
+
}, this.timeoutMs);
|
|
221
|
+
child.stderr.setEncoding("utf8");
|
|
222
|
+
child.stderr.on("data", (chunk) => {
|
|
223
|
+
stderr = (stderr + chunk).slice(-4000);
|
|
224
|
+
});
|
|
225
|
+
child.stdin.on("error", () => {
|
|
226
|
+
// The harness can exit before the prompt is written; `exit` below is the
|
|
227
|
+
// event that matters, not EPIPE on a dead pipe.
|
|
228
|
+
});
|
|
229
|
+
const sendMessage = (kind, message) => {
|
|
230
|
+
const id = `${kind}-${nextMessageId++}`;
|
|
231
|
+
return new Promise((resolve) => {
|
|
232
|
+
const rejectMessage = () => {
|
|
233
|
+
const pending = pendingMessages.get(id);
|
|
234
|
+
if (!pending)
|
|
235
|
+
return;
|
|
236
|
+
pendingMessages.delete(id);
|
|
237
|
+
clearTimeout(pending.timer);
|
|
238
|
+
pending.resolve(false);
|
|
239
|
+
};
|
|
240
|
+
const messageTimer = setTimeout(rejectMessage, this.messageTimeoutMs);
|
|
241
|
+
pendingMessages.set(id, { resolve, timer: messageTimer, command: kind });
|
|
242
|
+
try {
|
|
243
|
+
child.stdin.write(JSON.stringify({ id, type: kind, message }) + "\n", (error) => {
|
|
244
|
+
if (error)
|
|
245
|
+
rejectMessage();
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
catch {
|
|
249
|
+
rejectMessage();
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
// LF only: `readline` also splits U+2028/U+2029, which are legal in JSON.
|
|
254
|
+
let buffer = "";
|
|
255
|
+
child.stdout.setEncoding("utf8");
|
|
256
|
+
child.stdout.on("data", (chunk) => {
|
|
257
|
+
buffer += chunk;
|
|
258
|
+
let newline;
|
|
259
|
+
while ((newline = buffer.indexOf("\n")) !== -1) {
|
|
260
|
+
const line = buffer.slice(0, newline).replace(/\r$/, "");
|
|
261
|
+
buffer = buffer.slice(newline + 1);
|
|
262
|
+
if (!line.trim())
|
|
263
|
+
continue;
|
|
264
|
+
let record;
|
|
265
|
+
try {
|
|
266
|
+
record = JSON.parse(line);
|
|
267
|
+
}
|
|
268
|
+
catch {
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
if (typeof record.id === "string" && pendingMessages.has(record.id)) {
|
|
272
|
+
const pending = pendingMessages.get(record.id);
|
|
273
|
+
pendingMessages.delete(record.id);
|
|
274
|
+
clearTimeout(pending.timer);
|
|
275
|
+
pending.resolve(record.type === "response" &&
|
|
276
|
+
record.success === true &&
|
|
277
|
+
(pending.command !== "prompt" || record.data?.disposition !== "handled"));
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
if (record.type === "message_update" &&
|
|
281
|
+
record.assistantMessageEvent?.type === "text_delta") {
|
|
282
|
+
push({ type: "text", text: record.assistantMessageEvent.delta ?? "" });
|
|
283
|
+
}
|
|
284
|
+
if (record.type === "tool_execution_start" && record.toolName) {
|
|
285
|
+
push({
|
|
286
|
+
type: "tool_start",
|
|
287
|
+
tool: record.toolName,
|
|
288
|
+
args: record.args,
|
|
289
|
+
label: runToolLabel(record.toolName, record.args),
|
|
290
|
+
...(record.toolCallId ? { callId: record.toolCallId } : {}),
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
// A long command is the one case where nothing else moves for minutes.
|
|
294
|
+
if (record.type === "tool_execution_update")
|
|
295
|
+
pushToolText(record, record.partialResult);
|
|
296
|
+
// The per-message usage is authoritative; `message_update` usage is
|
|
297
|
+
// cumulative per response and must not be summed.
|
|
298
|
+
if (record.type === "message_end") {
|
|
299
|
+
if (record.message?.role === "assistant") {
|
|
300
|
+
turnCanContinue = ["stop", "length"].includes(record.message.stopReason ?? "");
|
|
301
|
+
}
|
|
302
|
+
const usage = readUsage(record.message?.usage);
|
|
303
|
+
if (usage)
|
|
304
|
+
push({ type: "usage", ...usage });
|
|
305
|
+
}
|
|
306
|
+
if (record.type === "tool_execution_end" && record.toolName) {
|
|
307
|
+
// Belt and braces: the final result fills in whatever the updates missed.
|
|
308
|
+
pushToolText(record, record.result);
|
|
309
|
+
toolOutputs.delete(record.toolCallId ?? record.toolName);
|
|
310
|
+
push({
|
|
311
|
+
type: "tool_end",
|
|
312
|
+
tool: record.toolName,
|
|
313
|
+
isError: Boolean(record.isError),
|
|
314
|
+
...(record.toolCallId ? { callId: record.toolCallId } : {}),
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
if (record.type === "agent_settled") {
|
|
318
|
+
turnSettled = true;
|
|
319
|
+
settleMessages(false);
|
|
320
|
+
push({ type: "settled" });
|
|
321
|
+
const endStdin = () => {
|
|
322
|
+
if (!child.stdin.destroyed && !child.stdin.writableEnded)
|
|
323
|
+
child.stdin.end();
|
|
324
|
+
};
|
|
325
|
+
const mayContinue = !finished && !aborted && !timedOut && turnCanContinue && !options.readOnly;
|
|
326
|
+
if (!mayContinue || !options.continuationPrompt) {
|
|
327
|
+
endStdin();
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
// The hook may be async; stdin stays open until it resolves.
|
|
331
|
+
const decision = new Promise((resolve) => resolve(options.continuationPrompt?.()));
|
|
332
|
+
void decision.then((continuation) => {
|
|
333
|
+
// State may have changed while the hook was pending.
|
|
334
|
+
if (continuation?.trim() && !finished && !aborted && !timedOut) {
|
|
335
|
+
turnSettled = false;
|
|
336
|
+
turnCanContinue = false;
|
|
337
|
+
void sendMessage("prompt", continuation).then((accepted) => {
|
|
338
|
+
if (!accepted)
|
|
339
|
+
endStdin();
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
endStdin();
|
|
344
|
+
}
|
|
345
|
+
}, () => endStdin());
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
child.on("error", (error) => {
|
|
351
|
+
finish({
|
|
352
|
+
type: "exit",
|
|
353
|
+
code: null,
|
|
354
|
+
stderr: `${command}: ${error.message}`,
|
|
355
|
+
timedOut,
|
|
356
|
+
// A command that cannot be found ends before it ever speaks; the run
|
|
357
|
+
// manager has to record a failure, not a silent clean exit.
|
|
358
|
+
spawnError: true,
|
|
359
|
+
});
|
|
360
|
+
});
|
|
361
|
+
child.on("exit", (code) => {
|
|
362
|
+
finish({ type: "exit", code, stderr: stderr.trim(), timedOut });
|
|
363
|
+
});
|
|
364
|
+
child.stdin.write(JSON.stringify({ id: "ticket-1", type: "prompt", message: prompt }) + "\n");
|
|
365
|
+
const abort = () => {
|
|
366
|
+
if (finished || aborted)
|
|
367
|
+
return;
|
|
368
|
+
aborted = true;
|
|
369
|
+
settleMessages(false);
|
|
370
|
+
child.kill("SIGTERM");
|
|
371
|
+
killTimer = setTimeout(() => child.kill("SIGKILL"), KILL_GRACE_MS);
|
|
372
|
+
};
|
|
373
|
+
const iterator = (async function* iterate() {
|
|
374
|
+
for (;;) {
|
|
375
|
+
if (events.length === 0) {
|
|
376
|
+
if (finished)
|
|
377
|
+
return;
|
|
378
|
+
// Waiting for the next process event is the generator's whole job.
|
|
379
|
+
// oxlint-disable-next-line no-await-in-loop
|
|
380
|
+
await new Promise((resolve) => {
|
|
381
|
+
wake = resolve;
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
const event = events.shift();
|
|
385
|
+
if (!event)
|
|
386
|
+
continue;
|
|
387
|
+
yield event;
|
|
388
|
+
if (event.type === "exit")
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
})();
|
|
392
|
+
return {
|
|
393
|
+
events: iterator,
|
|
394
|
+
get aborted() {
|
|
395
|
+
return aborted;
|
|
396
|
+
},
|
|
397
|
+
abort,
|
|
398
|
+
sendMessage: (text) => {
|
|
399
|
+
if (finished ||
|
|
400
|
+
aborted ||
|
|
401
|
+
turnSettled ||
|
|
402
|
+
!text.trim() ||
|
|
403
|
+
child.stdin.destroyed ||
|
|
404
|
+
!child.stdin.writable) {
|
|
405
|
+
return Promise.resolve(false);
|
|
406
|
+
}
|
|
407
|
+
return sendMessage("steer", text);
|
|
408
|
+
},
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
//# sourceMappingURL=pi-rpc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pi-rpc.js","sourceRoot":"","sources":["../../src/run/pi-rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAsB,MAAM,eAAe,CAAC;AAGvF,gFAAgF;AAChF,MAAM,kBAAkB,GAAG,EAAE,GAAG,MAAM,CAAC;AACvC,MAAM,aAAa,GAAG,KAAK,CAAC;AAC5B,2FAA2F;AAC3F,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAU,CA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