@letta-ai/letta-code 0.34.67 → 0.34.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mcp-client.js +2 -2
- package/dist/mcp-client.js.map +1 -1
- package/dist/mcp-oauth.js +2 -2
- package/dist/mcp-oauth.js.map +1 -1
- package/dist/types/cli/helpers/stream-terminal-eof-guard.d.ts +1 -0
- package/dist/types/cli/helpers/stream-terminal-eof-guard.d.ts.map +1 -1
- package/dist/types/tools/impl/bash.d.ts +2 -0
- package/dist/types/tools/impl/bash.d.ts.map +1 -1
- package/dist/types/tools/impl/external-llm-trace-payload.d.ts +4 -0
- package/dist/types/tools/impl/external-llm-trace-payload.d.ts.map +1 -1
- package/dist/types/tools/impl/external-llm-trace-proxy.d.ts +4 -1
- package/dist/types/tools/impl/external-llm-trace-proxy.d.ts.map +1 -1
- package/dist/types/tools/impl/external-llm-trace-session.d.ts.map +1 -1
- package/dist/types/tools/impl/process_manager.d.ts +1 -0
- package/dist/types/tools/impl/process_manager.d.ts.map +1 -1
- package/dist/types/tools/impl/shell-runner.d.ts +3 -0
- package/dist/types/tools/impl/shell-runner.d.ts.map +1 -1
- package/dist/types/tools/impl/watch-pr-cloud.d.ts.map +1 -1
- package/letta.js +468 -250
- package/npm-shrinkwrap.json +98 -94
- package/package.json +2 -2
- package/scripts/integration/headless-sigterm.py +245 -0
- package/scripts/source-file-size-baseline.json +1 -1
package/letta.js
CHANGED
|
@@ -6139,7 +6139,7 @@ var package_default;
|
|
|
6139
6139
|
var init_package = __esm(() => {
|
|
6140
6140
|
package_default = {
|
|
6141
6141
|
name: "@letta-ai/letta-code",
|
|
6142
|
-
version: "0.34.
|
|
6142
|
+
version: "0.34.68",
|
|
6143
6143
|
lettaStartupLogProtocol: 1,
|
|
6144
6144
|
lettaConfigDirProtocol: 1,
|
|
6145
6145
|
description: "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
|
|
@@ -6426,7 +6426,7 @@ var init_package = __esm(() => {
|
|
|
6426
6426
|
},
|
|
6427
6427
|
lettaLifecycleProtocol: 1,
|
|
6428
6428
|
lettaRuntimeGraphProtocol: 1,
|
|
6429
|
-
lettaRuntimeGraphSha512: "sha512
|
|
6429
|
+
lettaRuntimeGraphSha512: "sha512-Yy+M7oHU4YOah6H3WZqq/09Wgabcydnf4hsTsaqu7Q/bFotEk/HiZC2eCABj+7J1nCVxdsd4S6srGQ14/McHdw==",
|
|
6430
6430
|
patchedDependencies: {
|
|
6431
6431
|
"@earendil-works/pi-ai@1.5.2": "patches/@earendil-works%2Fpi-ai@1.5.2.patch"
|
|
6432
6432
|
}
|
|
@@ -203475,7 +203475,7 @@ var init_mcp_client = __esm(() => {
|
|
|
203475
203475
|
init_streamableHttp();
|
|
203476
203476
|
DEFAULT_CLIENT_INFO = {
|
|
203477
203477
|
name: "letta-code",
|
|
203478
|
-
version: "0.34.
|
|
203478
|
+
version: "0.34.68"
|
|
203479
203479
|
};
|
|
203480
203480
|
});
|
|
203481
203481
|
|
|
@@ -207758,7 +207758,7 @@ Usage notes:
|
|
|
207758
207758
|
var init_AskUserQuestion = () => {};
|
|
207759
207759
|
|
|
207760
207760
|
// src/tools/descriptions/Bash.md
|
|
207761
|
-
var Bash_default = "Executes a shell command and returns its output.\n\n- Each Bash call starts from the conversation's current working directory. A `cd` affects only that command and does not change the directory used by later tool calls. To change the working directory for later tool calls, use `SetWorkingDirectory`. For a one-off command elsewhere, use an absolute path or an option such as `git -C /path/to/repo status`.\n- IMPORTANT: Avoid using this tool to run `cat`, `head`, `tail`, `sed`, `awk`, or `echo` commands, unless explicitly instructed. Use Read, Edit and Write for file operations instead. Quote paths that contain spaces.\n- Command output is displayed to you, not reliably to the user.\n- `timeout` is in milliseconds. Without it,
|
|
207761
|
+
var Bash_default = "Executes a shell command and returns its output.\n\n- Each Bash call starts from the conversation's current working directory. A `cd` affects only that command and does not change the directory used by later tool calls. To change the working directory for later tool calls, use `SetWorkingDirectory`. For a one-off command elsewhere, use an absolute path or an option such as `git -C /path/to/repo status`.\n- IMPORTANT: Avoid using this tool to run `cat`, `head`, `tail`, `sed`, `awk`, or `echo` commands, unless explicitly instructed. Use Read, Edit and Write for file operations instead. Quote paths that contain spaces.\n- Command output is displayed to you, not reliably to the user.\n- `timeout` is in milliseconds; foreground timeouts max out at 600000. Without it, a command that can't continue in the background times out after 120000; others run until they exit.\n- If the output exceeds 30000 characters, you receive only the first 2000 characters plus the path of a file containing the full output. A failed command whose output exceeds 10000 characters returns a head-and-tail excerpt plus that file path. Read or search that file when you need the rest instead of re-running the command.\n- Commands still running after a brief wait continue in the background automatically: you receive a task ID and one completion notification. Do not predict command duration, set `run_in_background` merely because a command may be slow, or poll for completion. Set `run_in_background` only when you want the task ID immediately; no `&` needed.\n- Foreground `sleep` is blocked. To wait for a condition, use Monitor.\n- Run independent commands as parallel tool calls; chain dependent ones with `&&`.\n\n# Git\n- Interactive flags (`-i`, e.g. `git rebase -i`, `git add -i`) are not supported in this environment.\n- Use the `gh` CLI for GitHub operations (PRs, issues, API).\n- GitHub notifies the owner of any `@name` written in a PR, issue, or comment. Write a bare `@name` only for a real login you mean to notify. Put roles, placeholders, and code (`@human`, `@reviewer`, `@types/node`) in backticks or drop the `@`.\n- Commit or push only when the user asks. Do not amend, skip hooks, force-push, or run other destructive git commands unless the user asks; if a pre-commit hook fails, fix the issue and create a new commit.\n- Pass commit messages and PR bodies as single-quoted strings with embedded newlines. Do not wrap them in `$(...)` or backticks. End commit messages with:\n{{COMMIT_TRAILER}}\n<example>\ngit commit -m 'Commit message here.\n\n{{COMMIT_TRAILER}}'\n</example>\n- Passing `gh pr checks` does not mean GitHub will merge the PR — unresolved review threads and still-pending required checks leave the merge state BLOCKED. If WatchPR is available and you will follow the PR toward merge, start it on the PR URL, and call the PR ready, green, or mergeable only once WatchPR reports it merge-ready.\n";
|
|
207762
207762
|
var init_Bash = () => {};
|
|
207763
207763
|
|
|
207764
207764
|
// src/tools/descriptions/CodeMode.md
|
|
@@ -211737,7 +211737,9 @@ function spawnPipeProcess(launcher, options, events) {
|
|
|
211737
211737
|
events.output(chunk2, "stderr");
|
|
211738
211738
|
});
|
|
211739
211739
|
childProcess2.on("error", events.error);
|
|
211740
|
-
childProcess2.on("close",
|
|
211740
|
+
childProcess2.on("close", (code, signal) => {
|
|
211741
|
+
events.close(code, signal, process.platform === "win32" ? undefined : childProcess2.pid);
|
|
211742
|
+
});
|
|
211741
211743
|
return {
|
|
211742
211744
|
kill: createPipeProcessKiller(childProcess2),
|
|
211743
211745
|
interrupt() {
|
|
@@ -211886,19 +211888,21 @@ function startShellProcess(launcher, options) {
|
|
|
211886
211888
|
broker?.close();
|
|
211887
211889
|
};
|
|
211888
211890
|
let processHandle;
|
|
211891
|
+
let forceKillIssued = false;
|
|
211892
|
+
let finishGroupClose;
|
|
211889
211893
|
const terminateProcess = () => {
|
|
211894
|
+
if (completed || forceKillTimer)
|
|
211895
|
+
return;
|
|
211890
211896
|
if (process.platform === "win32") {
|
|
211891
211897
|
processHandle.kill("SIGKILL");
|
|
211892
211898
|
return;
|
|
211893
211899
|
}
|
|
211894
211900
|
processHandle.kill("SIGTERM");
|
|
211895
|
-
|
|
211896
|
-
|
|
211897
|
-
|
|
211898
|
-
|
|
211899
|
-
|
|
211900
|
-
}, FORCE_KILL_GRACE_MS);
|
|
211901
|
-
}
|
|
211901
|
+
forceKillTimer = setTimeout(() => {
|
|
211902
|
+
forceKillIssued = true;
|
|
211903
|
+
processHandle.kill("SIGKILL");
|
|
211904
|
+
finishGroupClose?.();
|
|
211905
|
+
}, FORCE_KILL_GRACE_MS);
|
|
211902
211906
|
};
|
|
211903
211907
|
const abortHandler = () => {
|
|
211904
211908
|
terminateProcess();
|
|
@@ -211941,9 +211945,21 @@ function startShellProcess(launcher, options) {
|
|
|
211941
211945
|
pullRequestTracker?.finish();
|
|
211942
211946
|
rejectCompletion(buildSpawnError(error4, executable, options.cwd));
|
|
211943
211947
|
},
|
|
211944
|
-
close(code, signal) {
|
|
211948
|
+
close(code, signal, processGroup) {
|
|
211945
211949
|
if (completed)
|
|
211946
211950
|
return;
|
|
211951
|
+
if (launchOptions.waitForProcessGroupOnClose && forceKillTimer && !forceKillIssued && processGroup !== undefined) {
|
|
211952
|
+
let groupExists = true;
|
|
211953
|
+
try {
|
|
211954
|
+
process.kill(-processGroup, 0);
|
|
211955
|
+
} catch (error4) {
|
|
211956
|
+
groupExists = error4.code !== "ESRCH";
|
|
211957
|
+
}
|
|
211958
|
+
if (groupExists) {
|
|
211959
|
+
finishGroupClose = () => events.close(code, signal);
|
|
211960
|
+
return;
|
|
211961
|
+
}
|
|
211962
|
+
}
|
|
211947
211963
|
completed = true;
|
|
211948
211964
|
cleanup();
|
|
211949
211965
|
flushOutputDecoders();
|
|
@@ -213747,6 +213763,7 @@ var init_windows_command_safety = __esm(() => {
|
|
|
213747
213763
|
// src/tools/impl/bash.ts
|
|
213748
213764
|
var exports_bash = {};
|
|
213749
213765
|
__export(exports_bash, {
|
|
213766
|
+
waitForForegroundBashCleanup: () => waitForForegroundBashCleanup,
|
|
213750
213767
|
spawnCommand: () => spawnCommand,
|
|
213751
213768
|
getBackgroundLauncher: () => getBackgroundLauncher,
|
|
213752
213769
|
bash: () => bash,
|
|
@@ -213989,13 +214006,15 @@ async function bash(args) {
|
|
|
213989
214006
|
let bgProcess;
|
|
213990
214007
|
let outputWriteFailed = false;
|
|
213991
214008
|
const foregroundOutput = { stdout: "", stderr: "" };
|
|
213992
|
-
const
|
|
214009
|
+
const canYield = !run_in_background && isQueueBridgeConnected();
|
|
214010
|
+
const effectiveTimeout = run_in_background ? timeout !== undefined && timeout > 0 ? timeout : 0 : timeout !== undefined ? Math.min(Math.max(timeout, 1), MAX_FOREGROUND_TIMEOUT_MS) : canYield ? 0 : NON_YIELDING_DEFAULT_TIMEOUT_MS;
|
|
213993
214011
|
const runningProcess = shellProcessStarter(sandboxed.launcher, {
|
|
213994
214012
|
cwd: userCwd,
|
|
213995
214013
|
env: sandboxed.env,
|
|
213996
214014
|
timeoutMs: effectiveTimeout,
|
|
213997
214015
|
sourceCommand: command,
|
|
213998
214016
|
signal: run_in_background ? undefined : signal,
|
|
214017
|
+
waitForProcessGroupOnClose: !run_in_background,
|
|
213999
214018
|
captureOutput: false,
|
|
214000
214019
|
onOutput(text2, stream11) {
|
|
214001
214020
|
const sanitizedText = streamScrubbers[stream11].push(text2);
|
|
@@ -214021,6 +214040,7 @@ async function bash(args) {
|
|
|
214021
214040
|
process: runningProcess.process,
|
|
214022
214041
|
completion: runningProcess.completion,
|
|
214023
214042
|
terminate: runningProcess.terminate,
|
|
214043
|
+
foregroundBash: !run_in_background,
|
|
214024
214044
|
command,
|
|
214025
214045
|
stdout: [],
|
|
214026
214046
|
stderr: [],
|
|
@@ -214099,7 +214119,7 @@ async function bash(args) {
|
|
|
214099
214119
|
type: "settled",
|
|
214100
214120
|
result: result2
|
|
214101
214121
|
}));
|
|
214102
|
-
const outcome =
|
|
214122
|
+
const outcome = canYield ? await Promise.race([
|
|
214103
214123
|
settledOutcome,
|
|
214104
214124
|
new Promise((resolve19) => {
|
|
214105
214125
|
const timer = setTimeout(() => resolve19({ type: "yield" }), Math.max(0, foregroundYieldMs));
|
|
@@ -214138,7 +214158,7 @@ ${truncatedOutput}`
|
|
|
214138
214158
|
status: "success"
|
|
214139
214159
|
};
|
|
214140
214160
|
}
|
|
214141
|
-
|
|
214161
|
+
bgProcess.foregroundBash = false;
|
|
214142
214162
|
notifyWhenSettled();
|
|
214143
214163
|
return {
|
|
214144
214164
|
content: [
|
|
@@ -214164,7 +214184,25 @@ Output file: ${outputFile}`
|
|
|
214164
214184
|
status: "success"
|
|
214165
214185
|
};
|
|
214166
214186
|
}
|
|
214167
|
-
|
|
214187
|
+
async function waitForForegroundBashCleanup() {
|
|
214188
|
+
const active = [...backgroundProcesses.values()].filter((entry) => entry.foregroundBash);
|
|
214189
|
+
if (active.length === 0)
|
|
214190
|
+
return;
|
|
214191
|
+
for (const entry of active)
|
|
214192
|
+
entry.terminate?.();
|
|
214193
|
+
let timer;
|
|
214194
|
+
try {
|
|
214195
|
+
await Promise.race([
|
|
214196
|
+
Promise.allSettled(active.map((entry) => entry.completion)),
|
|
214197
|
+
new Promise((resolve19) => {
|
|
214198
|
+
timer = setTimeout(resolve19, FORCE_KILL_GRACE_MS + 250);
|
|
214199
|
+
})
|
|
214200
|
+
]);
|
|
214201
|
+
} finally {
|
|
214202
|
+
clearTimeout(timer);
|
|
214203
|
+
}
|
|
214204
|
+
}
|
|
214205
|
+
var cachedWorkingLauncher = null, NON_YIELDING_DEFAULT_TIMEOUT_MS = 120000, MAX_FOREGROUND_TIMEOUT_MS = 600000, shellProcessStarter, NOTIFICATION_TAIL_LINES = 50;
|
|
214168
214206
|
var init_bash = __esm(() => {
|
|
214169
214207
|
init_constants2();
|
|
214170
214208
|
init_runtime_context();
|
|
@@ -239752,23 +239790,84 @@ function assembleTraceResponse(raw2, streaming3) {
|
|
|
239752
239790
|
};
|
|
239753
239791
|
}
|
|
239754
239792
|
}
|
|
239755
|
-
|
|
239793
|
+
function traceJsonFits(bytes, encodedBytes) {
|
|
239794
|
+
return bytes <= MAX_TRACE_PAYLOAD_BYTES && encodedBytes <= MAX_ENCODED_PAYLOAD_BYTES;
|
|
239795
|
+
}
|
|
239796
|
+
function tracePayloadFits(json2) {
|
|
239797
|
+
return traceJsonFits(Buffer.byteLength(json2), Buffer.byteLength(JSON.stringify(json2)));
|
|
239798
|
+
}
|
|
239799
|
+
function compactTracePayload(json2) {
|
|
239800
|
+
const payload = JSON.parse(json2);
|
|
239801
|
+
if (!payload || typeof payload !== "object")
|
|
239802
|
+
return TRUNCATED_TRACE_JSON;
|
|
239803
|
+
if (!Array.isArray(payload)) {
|
|
239804
|
+
const object4 = payload;
|
|
239805
|
+
delete object4.system;
|
|
239806
|
+
delete object4.tools;
|
|
239807
|
+
delete object4.truncated;
|
|
239808
|
+
}
|
|
239809
|
+
const marked = () => JSON.stringify(Array.isArray(payload) ? { items: payload, ...truncated } : { ...payload, ...truncated });
|
|
239810
|
+
const initial2 = marked();
|
|
239811
|
+
let bytes = Buffer.byteLength(initial2);
|
|
239812
|
+
let encodedBytes = Buffer.byteLength(JSON.stringify(initial2));
|
|
239813
|
+
if (traceJsonFits(bytes, encodedBytes))
|
|
239814
|
+
return initial2;
|
|
239815
|
+
const candidates = [];
|
|
239816
|
+
function collect(container) {
|
|
239817
|
+
for (const [key2, value] of Object.entries(container)) {
|
|
239818
|
+
if (Array.isArray(value) || key2 === "response" && value && typeof value === "object") {
|
|
239819
|
+
collect(value);
|
|
239820
|
+
continue;
|
|
239821
|
+
}
|
|
239822
|
+
const serialized = JSON.stringify(value);
|
|
239823
|
+
const bytes2 = Buffer.byteLength(serialized) - Buffer.byteLength(TRUNCATED_TRACE_JSON);
|
|
239824
|
+
const encodedBytes2 = Buffer.byteLength(JSON.stringify(serialized)) - Buffer.byteLength(JSON.stringify(TRUNCATED_TRACE_JSON));
|
|
239825
|
+
if (bytes2 > 0 && encodedBytes2 > 0) {
|
|
239826
|
+
candidates.push({
|
|
239827
|
+
bytes: bytes2,
|
|
239828
|
+
encodedBytes: encodedBytes2,
|
|
239829
|
+
replace: () => {
|
|
239830
|
+
container[key2] = truncated;
|
|
239831
|
+
}
|
|
239832
|
+
});
|
|
239833
|
+
}
|
|
239834
|
+
}
|
|
239835
|
+
}
|
|
239836
|
+
collect(payload);
|
|
239837
|
+
candidates.sort((a2, b3) => b3.bytes - a2.bytes);
|
|
239838
|
+
for (const candidate of candidates) {
|
|
239839
|
+
if (traceJsonFits(bytes, encodedBytes))
|
|
239840
|
+
break;
|
|
239841
|
+
candidate.replace();
|
|
239842
|
+
bytes -= candidate.bytes;
|
|
239843
|
+
encodedBytes -= candidate.encodedBytes;
|
|
239844
|
+
}
|
|
239845
|
+
return traceJsonFits(bytes, encodedBytes) ? marked() : TRUNCATED_TRACE_JSON;
|
|
239846
|
+
}
|
|
239847
|
+
var MAX_TRACE_PAYLOAD_BYTES, SENSITIVE, MAX_TRACE_BUFFER_BYTES, MAX_ENCODED_PAYLOAD_BYTES, truncated, TRUNCATED_TRACE_JSON;
|
|
239756
239848
|
var init_external_llm_trace_payload = __esm(() => {
|
|
239757
239849
|
init_server_url();
|
|
239758
239850
|
MAX_TRACE_PAYLOAD_BYTES = 2 * 1024 * 1024;
|
|
239759
239851
|
SENSITIVE = /^(authorization|proxy-authorization|x-api-key|api[_-]?key|cookies?|set-cookie|x-auth-token|access[_-]?token|refresh[_-]?token|client[_-]?secret|password|secret)$/i;
|
|
239852
|
+
MAX_TRACE_BUFFER_BYTES = 16 * 1024 * 1024;
|
|
239853
|
+
MAX_ENCODED_PAYLOAD_BYTES = 3 * 1024 * 1024;
|
|
239854
|
+
truncated = { truncated: "size_limit" };
|
|
239855
|
+
TRUNCATED_TRACE_JSON = JSON.stringify(truncated);
|
|
239760
239856
|
});
|
|
239761
239857
|
|
|
239762
239858
|
// src/tools/impl/external-llm-trace-proxy.ts
|
|
239763
239859
|
import { randomUUID as randomUUID39 } from "node:crypto";
|
|
239764
239860
|
import { createServer as createServer6, request as httpRequest3 } from "node:http";
|
|
239765
239861
|
import { request as httpsRequest2 } from "node:https";
|
|
239862
|
+
import { isDeepStrictEqual } from "node:util";
|
|
239766
239863
|
import { brotliDecompressSync, gunzipSync, inflateSync } from "node:zlib";
|
|
239767
239864
|
async function startTraceProxy(options) {
|
|
239768
239865
|
const upstream = new URL(options.upstream);
|
|
239769
239866
|
if (!["http:", "https:"].includes(upstream.protocol) || upstream.username || upstream.password)
|
|
239770
239867
|
throw new Error("Unsupported trace upstream");
|
|
239771
239868
|
const prefix = `/${randomUUID39()}`;
|
|
239869
|
+
const historyKey = options.harness === "claude_code" ? "messages" : "input";
|
|
239870
|
+
let previous;
|
|
239772
239871
|
let activeCaptures = 0;
|
|
239773
239872
|
const pending2 = new Set;
|
|
239774
239873
|
const server2 = createServer6((req, res) => {
|
|
@@ -239815,37 +239914,51 @@ async function startTraceProxy(options) {
|
|
|
239815
239914
|
work.finally(() => pending2.delete(work));
|
|
239816
239915
|
};
|
|
239817
239916
|
const processCapture = (transportError) => {
|
|
239818
|
-
|
|
239819
|
-
const
|
|
239917
|
+
const id = randomUUID39();
|
|
239918
|
+
const requestBuffered = captureBody && requestBytes <= MAX_TRACE_BUFFER_BYTES;
|
|
239919
|
+
let responseBuffered = captureBody && responseBytes <= MAX_TRACE_BUFFER_BYTES;
|
|
239820
239920
|
let responseRaw = Buffer.concat(responseChunks);
|
|
239821
239921
|
try {
|
|
239822
239922
|
const decoder2 = encoding === "gzip" ? gunzipSync : encoding === "deflate" ? inflateSync : encoding === "br" ? brotliDecompressSync : undefined;
|
|
239823
|
-
if (decoder2)
|
|
239923
|
+
if (decoder2 && responseBuffered)
|
|
239824
239924
|
responseRaw = decoder2(responseRaw, {
|
|
239825
|
-
maxOutputLength:
|
|
239925
|
+
maxOutputLength: MAX_TRACE_BUFFER_BYTES
|
|
239826
239926
|
});
|
|
239827
239927
|
} catch {
|
|
239828
|
-
|
|
239928
|
+
responseBuffered = false;
|
|
239829
239929
|
}
|
|
239830
|
-
const responseText =
|
|
239930
|
+
const responseText = responseBuffered ? responseRaw.toString("utf8") : "";
|
|
239831
239931
|
streaming3 ||= /(?:^|\r?\n)data:/.test(responseText);
|
|
239832
239932
|
const assembled = assembleTraceResponse(responseText, streaming3);
|
|
239833
|
-
let responseJson = sanitizeTraceJson(JSON.stringify(
|
|
239834
|
-
|
|
239835
|
-
|
|
239836
|
-
responseJson =
|
|
239837
|
-
|
|
239838
|
-
|
|
239839
|
-
|
|
239840
|
-
|
|
239841
|
-
|
|
239933
|
+
let responseJson = responseBuffered ? sanitizeTraceJson(JSON.stringify(streaming3 ? assembled : assembled.response), credentials) : TRUNCATED_TRACE_JSON;
|
|
239934
|
+
const responseTruncated = !responseBuffered || !tracePayloadFits(responseJson);
|
|
239935
|
+
if (responseBuffered && responseTruncated)
|
|
239936
|
+
responseJson = compactTracePayload(responseJson);
|
|
239937
|
+
let requestJson = requestBuffered ? sanitizeTraceJson(Buffer.concat(requestChunks).toString("utf8"), credentials) : TRUNCATED_TRACE_JSON;
|
|
239938
|
+
const request3 = JSON.parse(requestJson);
|
|
239939
|
+
const items = request3?.[historyKey];
|
|
239940
|
+
const requestTruncated = !requestBuffered || !tracePayloadFits(requestJson);
|
|
239941
|
+
let delta;
|
|
239942
|
+
if (requestBuffered && requestTruncated) {
|
|
239943
|
+
const fallbackJson = compactTracePayload(requestJson);
|
|
239944
|
+
requestJson = fallbackJson;
|
|
239945
|
+
if (previous?.sessionId === scope.worker_session_id && Array.isArray(items)) {
|
|
239946
|
+
const prefixItems = previous.items.length;
|
|
239947
|
+
if (prefixItems > 0 && items.length > prefixItems && previous.items.every((item, index) => isDeepStrictEqual(item, items[index]))) {
|
|
239948
|
+
const deltaJson = JSON.stringify({
|
|
239949
|
+
...request3,
|
|
239950
|
+
[historyKey]: items.slice(prefixItems),
|
|
239951
|
+
base_trace_id: previous.id,
|
|
239952
|
+
prefix_items: prefixItems
|
|
239953
|
+
});
|
|
239954
|
+
if (tracePayloadFits(deltaJson)) {
|
|
239955
|
+
requestJson = deltaJson;
|
|
239956
|
+
delta = { baseId: previous.id, fallbackJson };
|
|
239957
|
+
}
|
|
239958
|
+
}
|
|
239959
|
+
}
|
|
239842
239960
|
}
|
|
239843
|
-
|
|
239844
|
-
try {
|
|
239845
|
-
const parsed = JSON.parse(requestRaw);
|
|
239846
|
-
if (parsed && typeof parsed === "object" && !Array.isArray(parsed))
|
|
239847
|
-
request3 = parsed;
|
|
239848
|
-
} catch {}
|
|
239961
|
+
previous = Array.isArray(items) && (!requestTruncated || delta) ? { id, sessionId: scope.worker_session_id, items } : undefined;
|
|
239849
239962
|
const response = assembled.response;
|
|
239850
239963
|
const usage = response.usage ?? {};
|
|
239851
239964
|
const token2 = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.min(Math.trunc(value), 4294967295) : null;
|
|
@@ -239858,9 +239971,9 @@ async function startTraceProxy(options) {
|
|
|
239858
239971
|
const error4 = transportError || status >= 400 || Boolean(response.error) || response.status === "failed";
|
|
239859
239972
|
options.emit({
|
|
239860
239973
|
...scope,
|
|
239861
|
-
id
|
|
239974
|
+
id,
|
|
239862
239975
|
harness: options.harness,
|
|
239863
|
-
model: JSON.parse(sanitizeTraceJson(JSON.stringify(String(response.model ?? request3
|
|
239976
|
+
model: JSON.parse(sanitizeTraceJson(JSON.stringify(String(response.model ?? request3?.model ?? "")), credentials)).slice(0, 255),
|
|
239864
239977
|
request_json: requestJson,
|
|
239865
239978
|
response_json: responseJson,
|
|
239866
239979
|
request_size_bytes: Math.min(requestBytes, 4294967295),
|
|
@@ -239877,9 +239990,9 @@ async function startTraceProxy(options) {
|
|
|
239877
239990
|
is_error: error4 ? 1 : 0,
|
|
239878
239991
|
error_type: transportError ? "transport_error" : error4 ? "provider_error" : "",
|
|
239879
239992
|
error_message: "",
|
|
239880
|
-
capture_status:
|
|
239993
|
+
capture_status: delta ? "delta" : requestTruncated || responseTruncated ? "size_limit" : transportError || !assembled.complete ? "incomplete" : "complete",
|
|
239881
239994
|
created_at: created
|
|
239882
|
-
});
|
|
239995
|
+
}, delta);
|
|
239883
239996
|
};
|
|
239884
239997
|
const headers = {
|
|
239885
239998
|
...req.headers,
|
|
@@ -239901,7 +240014,7 @@ async function startTraceProxy(options) {
|
|
|
239901
240014
|
if (!capture)
|
|
239902
240015
|
return;
|
|
239903
240016
|
responseBytes += chunk2.length;
|
|
239904
|
-
if (captureBody && responseBytes <=
|
|
240017
|
+
if (captureBody && responseBytes <= MAX_TRACE_BUFFER_BYTES)
|
|
239905
240018
|
responseChunks.push(Buffer.from(chunk2));
|
|
239906
240019
|
else
|
|
239907
240020
|
responseChunks.length = 0;
|
|
@@ -239923,7 +240036,7 @@ async function startTraceProxy(options) {
|
|
|
239923
240036
|
if (!capture)
|
|
239924
240037
|
return;
|
|
239925
240038
|
requestBytes += chunk2.length;
|
|
239926
|
-
if (captureBody && requestBytes <=
|
|
240039
|
+
if (captureBody && requestBytes <= MAX_TRACE_BUFFER_BYTES)
|
|
239927
240040
|
requestChunks.push(Buffer.from(chunk2));
|
|
239928
240041
|
else
|
|
239929
240042
|
requestChunks.length = 0;
|
|
@@ -240002,6 +240115,7 @@ async function createTraceSession(harness, context3, env6, upstream, workerSessi
|
|
|
240002
240115
|
const scope = { ...ids, worker_session_id: workerSessionId };
|
|
240003
240116
|
sessionScopes.set(workerSessionId, scope);
|
|
240004
240117
|
const queue = [];
|
|
240118
|
+
let uploadedBaseId;
|
|
240005
240119
|
let bytes = 0;
|
|
240006
240120
|
let draining;
|
|
240007
240121
|
let closed = false;
|
|
@@ -240017,13 +240131,23 @@ async function createTraceSession(harness, context3, env6, upstream, workerSessi
|
|
|
240017
240131
|
break;
|
|
240018
240132
|
}
|
|
240019
240133
|
const batch = [];
|
|
240020
|
-
let
|
|
240021
|
-
|
|
240022
|
-
|
|
240023
|
-
|
|
240134
|
+
let batchBytes = TRACE_BATCH_ENVELOPE_BYTES;
|
|
240135
|
+
let baseId = uploadedBaseId;
|
|
240136
|
+
let queuedBytes = 0;
|
|
240137
|
+
for (const entry of queue) {
|
|
240138
|
+
const fallback = entry.delta?.baseId !== baseId ? entry.delta : undefined;
|
|
240139
|
+
const row = fallback ? {
|
|
240140
|
+
...entry.row,
|
|
240141
|
+
request_json: fallback.fallbackJson,
|
|
240142
|
+
capture_status: "size_limit"
|
|
240143
|
+
} : entry.row;
|
|
240144
|
+
const nextBytes = Buffer.byteLength(JSON.stringify(row)) + (batch.length ? 1 : 0);
|
|
240145
|
+
if (batchBytes + nextBytes > MAX_TRACE_BATCH_BYTES || batch.length === 20)
|
|
240024
240146
|
break;
|
|
240025
240147
|
batch.push(row);
|
|
240026
|
-
|
|
240148
|
+
batchBytes += nextBytes;
|
|
240149
|
+
queuedBytes += entry.size;
|
|
240150
|
+
baseId = fallback ? undefined : row.id;
|
|
240027
240151
|
}
|
|
240028
240152
|
let success = false;
|
|
240029
240153
|
let lastError;
|
|
@@ -240043,7 +240167,9 @@ async function createTraceSession(harness, context3, env6, upstream, workerSessi
|
|
|
240043
240167
|
warn(`External trace upload failed: ${describeUploadError(lastError, secrets2)} rows=${batch.length} harness=${harness} conversation=${context3.parent_conversation_id}`);
|
|
240044
240168
|
}
|
|
240045
240169
|
queue.splice(0, batch.length);
|
|
240046
|
-
bytes -=
|
|
240170
|
+
bytes -= queuedBytes;
|
|
240171
|
+
if (success)
|
|
240172
|
+
uploadedBaseId = baseId;
|
|
240047
240173
|
if (!success && closed) {
|
|
240048
240174
|
queue.length = 0;
|
|
240049
240175
|
bytes = 0;
|
|
@@ -240065,17 +240191,21 @@ async function createTraceSession(harness, context3, env6, upstream, workerSessi
|
|
|
240065
240191
|
harness,
|
|
240066
240192
|
scope,
|
|
240067
240193
|
secrets: secrets2,
|
|
240068
|
-
emit: (row) => {
|
|
240194
|
+
emit: (row, delta) => {
|
|
240069
240195
|
if (closed || !traceCaptureEnabled(process.env, config2.baseUrl, config2.apiKey))
|
|
240070
240196
|
return;
|
|
240071
|
-
|
|
240072
|
-
|
|
240073
|
-
row
|
|
240074
|
-
|
|
240075
|
-
|
|
240197
|
+
const rowBytes = Buffer.byteLength(JSON.stringify(row));
|
|
240198
|
+
const fallbackBytes = delta ? Buffer.byteLength(JSON.stringify({
|
|
240199
|
+
...row,
|
|
240200
|
+
request_json: delta.fallbackJson,
|
|
240201
|
+
capture_status: "size_limit"
|
|
240202
|
+
})) : 0;
|
|
240203
|
+
if (Math.max(rowBytes, fallbackBytes) + TRACE_BATCH_ENVELOPE_BYTES > MAX_TRACE_BATCH_BYTES)
|
|
240204
|
+
return;
|
|
240205
|
+
const size2 = rowBytes + (delta ? Buffer.byteLength(delta.fallbackJson) : 0);
|
|
240076
240206
|
if (bytes + size2 > 64 * 1024 * 1024)
|
|
240077
240207
|
return;
|
|
240078
|
-
queue.push(row);
|
|
240208
|
+
queue.push({ row, delta, size: size2 });
|
|
240079
240209
|
bytes += size2;
|
|
240080
240210
|
if (queue.length >= 10)
|
|
240081
240211
|
flush();
|
|
@@ -240106,7 +240236,7 @@ async function createTraceSession(harness, context3, env6, upstream, workerSessi
|
|
|
240106
240236
|
return;
|
|
240107
240237
|
}
|
|
240108
240238
|
}
|
|
240109
|
-
var sessionScopes, WARN_INTERVAL_MS = 60000, productionDependencies;
|
|
240239
|
+
var sessionScopes, WARN_INTERVAL_MS = 60000, MAX_TRACE_BATCH_BYTES, TRACE_BATCH_ENVELOPE_BYTES, productionDependencies;
|
|
240110
240240
|
var init_external_llm_trace_session = __esm(() => {
|
|
240111
240241
|
init_request();
|
|
240112
240242
|
init_backend_mode();
|
|
@@ -240114,6 +240244,8 @@ var init_external_llm_trace_session = __esm(() => {
|
|
|
240114
240244
|
init_external_llm_trace_payload();
|
|
240115
240245
|
init_external_llm_trace_proxy();
|
|
240116
240246
|
sessionScopes = new Map;
|
|
240247
|
+
MAX_TRACE_BATCH_BYTES = 8 * 1024 * 1024;
|
|
240248
|
+
TRACE_BATCH_ENVELOPE_BYTES = Buffer.byteLength('{"rows":[]}');
|
|
240117
240249
|
productionDependencies = {
|
|
240118
240250
|
getConfig: getApiRequestConfig,
|
|
240119
240251
|
async upload(rows, config2, context3) {
|
|
@@ -241183,7 +241315,7 @@ class CodexAppServerClient {
|
|
|
241183
241315
|
await this.request("initialize", {
|
|
241184
241316
|
clientInfo: {
|
|
241185
241317
|
name: "letta-code",
|
|
241186
|
-
version: "0.34.
|
|
241318
|
+
version: "0.34.68"
|
|
241187
241319
|
},
|
|
241188
241320
|
capabilities: null
|
|
241189
241321
|
});
|
|
@@ -249029,7 +249161,7 @@ function getMemorySkillsDirs2(agentId) {
|
|
|
249029
249161
|
function listSkillResources(skillMdPath) {
|
|
249030
249162
|
const skillDir = dirname31(skillMdPath);
|
|
249031
249163
|
const paths = [];
|
|
249032
|
-
let
|
|
249164
|
+
let truncated2 = false;
|
|
249033
249165
|
function walk3(directory, relativeDirectory) {
|
|
249034
249166
|
let entries2;
|
|
249035
249167
|
try {
|
|
@@ -249043,12 +249175,12 @@ function listSkillResources(skillMdPath) {
|
|
|
249043
249175
|
continue;
|
|
249044
249176
|
}
|
|
249045
249177
|
if (paths.length >= MAX_LISTED_SKILL_RESOURCES) {
|
|
249046
|
-
|
|
249178
|
+
truncated2 = true;
|
|
249047
249179
|
return;
|
|
249048
249180
|
}
|
|
249049
249181
|
if (entry.isDirectory()) {
|
|
249050
249182
|
walk3(join77(directory, entry.name), relativePath);
|
|
249051
|
-
if (
|
|
249183
|
+
if (truncated2) {
|
|
249052
249184
|
return;
|
|
249053
249185
|
}
|
|
249054
249186
|
} else if (entry.isFile()) {
|
|
@@ -249057,7 +249189,7 @@ function listSkillResources(skillMdPath) {
|
|
|
249057
249189
|
}
|
|
249058
249190
|
}
|
|
249059
249191
|
walk3(skillDir, "");
|
|
249060
|
-
return { paths, truncated };
|
|
249192
|
+
return { paths, truncated: truncated2 };
|
|
249061
249193
|
}
|
|
249062
249194
|
async function readSkillContent(skillId, skillsDir, agentId, options = {}) {
|
|
249063
249195
|
const projectSkillsDirs = new Set([
|
|
@@ -250721,20 +250853,21 @@ async function startCloudPullRequestWatch(args, deps = {}) {
|
|
|
250721
250853
|
}
|
|
250722
250854
|
throw error4;
|
|
250723
250855
|
}
|
|
250724
|
-
const initial2 = toClientSnapshot(ref, created.initial_snapshot);
|
|
250856
|
+
const initial2 = created.initial_snapshot ? toClientSnapshot(ref, created.initial_snapshot) : undefined;
|
|
250857
|
+
const currentState = initial2 ? `Current state:
|
|
250858
|
+
${describeGitHubPullRequestSnapshot(initial2)}` : "The current PR state will arrive with the first event.";
|
|
250725
250859
|
return {
|
|
250726
250860
|
content: [
|
|
250727
250861
|
{
|
|
250728
250862
|
type: "text",
|
|
250729
250863
|
text: `WatchPR started (task ${created.id}). You will be notified on PR events. It stops when the PR merges/closes, on TaskStop, or at its timeout. Keep working — do not poll or sleep.
|
|
250730
250864
|
|
|
250731
|
-
|
|
250732
|
-
${describeGitHubPullRequestSnapshot(initial2)}`
|
|
250865
|
+
${currentState}`
|
|
250733
250866
|
}
|
|
250734
250867
|
],
|
|
250735
250868
|
taskId: created.id,
|
|
250736
250869
|
url: ref.url,
|
|
250737
|
-
headSha: initial2
|
|
250870
|
+
headSha: initial2?.headSha ?? "",
|
|
250738
250871
|
persistent: false
|
|
250739
250872
|
};
|
|
250740
250873
|
}
|
|
@@ -252365,7 +252498,7 @@ var init_Bash2 = __esm(() => {
|
|
|
252365
252498
|
},
|
|
252366
252499
|
timeout: {
|
|
252367
252500
|
type: "number",
|
|
252368
|
-
description: "
|
|
252501
|
+
description: "Timeout in milliseconds; foreground timeouts have a maximum of 600000. Without it, a command that can't continue in the background times out after 120000; others run until they exit."
|
|
252369
252502
|
},
|
|
252370
252503
|
description: {
|
|
252371
252504
|
type: "string",
|
|
@@ -257762,7 +257895,7 @@ var init_turn_finished_replay = __esm(() => {
|
|
|
257762
257895
|
});
|
|
257763
257896
|
|
|
257764
257897
|
// src/websocket/listener/input-terminal-journal.ts
|
|
257765
|
-
import { isDeepStrictEqual } from "node:util";
|
|
257898
|
+
import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
|
|
257766
257899
|
function identityKeys(runtime, identities) {
|
|
257767
257900
|
return [
|
|
257768
257901
|
...new Set(identities.map((identity3) => dispositionKey(runtime.key, identity3)))
|
|
@@ -258074,7 +258207,7 @@ function claimPreparedInputTerminalIfCurrent(listener, terminal, validatedComple
|
|
|
258074
258207
|
if (preparedTerminalMatchesLegacyAuthorityIndex(entry, quarantines)) {
|
|
258075
258208
|
return false;
|
|
258076
258209
|
}
|
|
258077
|
-
return entry.preparedTerminal !== undefined &&
|
|
258210
|
+
return entry.preparedTerminal !== undefined && isDeepStrictEqual2(preparedTerminalWithoutClaim(entry.preparedTerminal), expected);
|
|
258078
258211
|
});
|
|
258079
258212
|
if (matches3.length === 0)
|
|
258080
258213
|
return { current: false, changed: false };
|
|
@@ -258083,7 +258216,7 @@ function claimPreparedInputTerminalIfCurrent(listener, terminal, validatedComple
|
|
|
258083
258216
|
if (recoveryLineageId && interruptedRevision) {
|
|
258084
258217
|
const competingClaim = values4.some((entry) => {
|
|
258085
258218
|
const prepared = entry.preparedTerminal;
|
|
258086
|
-
return prepared?.publicationClaimed === true && prepared.scope.agentId === terminal.scope.agentId && prepared.scope.conversationId === terminal.scope.conversationId && prepared.owner.recoveryLineageId === recoveryLineageId && prepared.owner.interruptedRevision === interruptedRevision && !
|
|
258219
|
+
return prepared?.publicationClaimed === true && prepared.scope.agentId === terminal.scope.agentId && prepared.scope.conversationId === terminal.scope.conversationId && prepared.owner.recoveryLineageId === recoveryLineageId && prepared.owner.interruptedRevision === interruptedRevision && !isDeepStrictEqual2(preparedTerminalWithoutClaim(prepared), expected);
|
|
258087
258220
|
});
|
|
258088
258221
|
if (competingClaim) {
|
|
258089
258222
|
throw new Error("Competing terminal already owns publication claim");
|
|
@@ -258092,7 +258225,7 @@ function claimPreparedInputTerminalIfCurrent(listener, terminal, validatedComple
|
|
|
258092
258225
|
const runtimeKey = matches3[0]?.runtimeKey;
|
|
258093
258226
|
const currentAuthorities = values4.filter((entry) => entry.runtimeKey === runtimeKey && entry.completedTerminalAuthority?.recoveryLineageId === recoveryLineageId && entry.completedTerminalAuthority.interruptedRevision === interruptedRevision).map((entry) => completedAuthorityKey(entry.completedTerminalAuthority)).sort();
|
|
258094
258227
|
const validatedAuthorities = validatedCompletedAuthorities.filter((completed) => completed.runtimeKey === runtimeKey && completed.authority.recoveryLineageId === recoveryLineageId && completed.authority.interruptedRevision === interruptedRevision).map((completed) => completedAuthorityKey(completed.authority)).sort();
|
|
258095
|
-
if (!
|
|
258228
|
+
if (!isDeepStrictEqual2(currentAuthorities, validatedAuthorities)) {
|
|
258096
258229
|
throw new Error("Terminal authority changed before publication claim");
|
|
258097
258230
|
}
|
|
258098
258231
|
}
|
|
@@ -258139,7 +258272,7 @@ function publishPreparedInputTerminalIfCurrent(listener, terminal, publish, vali
|
|
|
258139
258272
|
const publishAndRetire = (entries2) => {
|
|
258140
258273
|
const values4 = [...entries2.values()];
|
|
258141
258274
|
const quarantines = buildLegacyAuthorityQuarantineIndex(values4);
|
|
258142
|
-
const matches3 = values4.filter((entry) => !preparedTerminalMatchesLegacyAuthorityIndex(entry, quarantines) && entry.preparedTerminal?.publicationClaimed === true &&
|
|
258275
|
+
const matches3 = values4.filter((entry) => !preparedTerminalMatchesLegacyAuthorityIndex(entry, quarantines) && entry.preparedTerminal?.publicationClaimed === true && isDeepStrictEqual2(preparedTerminalWithoutClaim(entry.preparedTerminal), expected));
|
|
258143
258276
|
if (matches3.length === 0)
|
|
258144
258277
|
return false;
|
|
258145
258278
|
publish();
|
|
@@ -266572,10 +266705,10 @@ function appendStreamingOutput(state2, chunk2, startTime, isStderr = false) {
|
|
|
266572
266705
|
}
|
|
266573
266706
|
let buffer = partialLine + chunk2;
|
|
266574
266707
|
if (buffer.length > MAX_BUFFER_SIZE) {
|
|
266575
|
-
const
|
|
266576
|
-
const firstNewline =
|
|
266708
|
+
const truncated2 = buffer.slice(-MAX_BUFFER_SIZE);
|
|
266709
|
+
const firstNewline = truncated2.indexOf(`
|
|
266577
266710
|
`);
|
|
266578
|
-
buffer = firstNewline >= 0 ?
|
|
266711
|
+
buffer = firstNewline >= 0 ? truncated2.slice(firstNewline + 1) : truncated2;
|
|
266579
266712
|
}
|
|
266580
266713
|
const lines = buffer.split(`
|
|
266581
266714
|
`);
|
|
@@ -268563,19 +268696,45 @@ function getTerminalEofGraceMs() {
|
|
|
268563
268696
|
function createTerminalEofGuard(context3) {
|
|
268564
268697
|
let timer = null;
|
|
268565
268698
|
let fired = false;
|
|
268699
|
+
const eof = { done: true, value: undefined };
|
|
268700
|
+
let deadline;
|
|
268701
|
+
let closeIterator;
|
|
268566
268702
|
return {
|
|
268703
|
+
untilEof(stream11) {
|
|
268704
|
+
return {
|
|
268705
|
+
[Symbol.asyncIterator]() {
|
|
268706
|
+
const iterator = stream11[Symbol.asyncIterator]();
|
|
268707
|
+
closeIterator = () => {
|
|
268708
|
+
iterator.return?.().catch(() => {});
|
|
268709
|
+
};
|
|
268710
|
+
return {
|
|
268711
|
+
next() {
|
|
268712
|
+
if (!deadline)
|
|
268713
|
+
return iterator.next();
|
|
268714
|
+
if (fired)
|
|
268715
|
+
return Promise.resolve(eof);
|
|
268716
|
+
return Promise.race([iterator.next(), deadline.promise]);
|
|
268717
|
+
},
|
|
268718
|
+
return: iterator.return?.bind(iterator)
|
|
268719
|
+
};
|
|
268720
|
+
}
|
|
268721
|
+
};
|
|
268722
|
+
},
|
|
268567
268723
|
arm: () => {
|
|
268568
268724
|
if (timer) {
|
|
268569
268725
|
clearTimeout(timer);
|
|
268570
268726
|
}
|
|
268571
268727
|
const graceMs = getTerminalEofGraceMs();
|
|
268728
|
+
deadline = Promise.withResolvers();
|
|
268572
268729
|
timer = setTimeout(() => {
|
|
268573
268730
|
fired = true;
|
|
268731
|
+
deadline?.resolve(eof);
|
|
268574
268732
|
debugWarn("drainStream", "Terminal-EOF guard fired: stop_reason=%s received but stream did not end within %dms - aborting HTTP read", context3.getStopReason(), graceMs);
|
|
268575
268733
|
telemetry.trackError("stream_terminal_eof_guard_fired", `Stream received stop_reason=${context3.getStopReason()} but HTTP body did not end within ${graceMs}ms`, "stream_drain", {
|
|
268576
268734
|
runId: context3.getRunId() ?? undefined
|
|
268577
268735
|
});
|
|
268578
268736
|
context3.abortHttpRead();
|
|
268737
|
+
closeIterator?.();
|
|
268579
268738
|
}, graceMs);
|
|
268580
268739
|
},
|
|
268581
268740
|
clear: () => {
|
|
@@ -268641,7 +268800,7 @@ async function drainStream(stream11, buffers, refresh, abortSignal, onFirstMessa
|
|
|
268641
268800
|
throw new TypeError(`Stream is not async iterable (${summarizeStreamForDebug(stream11)})`);
|
|
268642
268801
|
}
|
|
268643
268802
|
stallReconciler.arm();
|
|
268644
|
-
for await (const chunk2 of stream11) {
|
|
268803
|
+
for await (const chunk2 of terminalEofGuard.untilEof(stream11)) {
|
|
268645
268804
|
stallReconciler.arm();
|
|
268646
268805
|
lastChunkDebugSummary = summarizeChunkForDebug(chunk2);
|
|
268647
268806
|
recordTuiJsonPayload(`stream_chunk:${chunk2.message_type ?? "unknown"}`, chunk2);
|
|
@@ -457189,7 +457348,7 @@ function createFileCommandSession(params) {
|
|
|
457189
457348
|
}, "listener_grep_in_files_send_failed", "listener_grep_in_files");
|
|
457190
457349
|
return;
|
|
457191
457350
|
}
|
|
457192
|
-
const { matches: matches3, totalMatches, totalFiles, truncated } = await runGrepInFiles({
|
|
457351
|
+
const { matches: matches3, totalMatches, totalFiles, truncated: truncated2 } = await runGrepInFiles({
|
|
457193
457352
|
searchRoot,
|
|
457194
457353
|
query: parsed.query,
|
|
457195
457354
|
isRegex: parsed.is_regex ?? false,
|
|
@@ -457206,7 +457365,7 @@ function createFileCommandSession(params) {
|
|
|
457206
457365
|
matches: matches3,
|
|
457207
457366
|
total_matches: totalMatches,
|
|
457208
457367
|
total_files: totalFiles,
|
|
457209
|
-
truncated
|
|
457368
|
+
truncated: truncated2
|
|
457210
457369
|
}, "listener_grep_in_files_send_failed", "listener_grep_in_files");
|
|
457211
457370
|
} catch (error4) {
|
|
457212
457371
|
trackListenerError2("listener_grep_in_files_failed", error4, "listener_grep_in_files");
|
|
@@ -463866,8 +464025,8 @@ function createListenerLifecycleLog(opts) {
|
|
|
463866
464025
|
}
|
|
463867
464026
|
function formatListenerSocketClose(channel, code, reason) {
|
|
463868
464027
|
const text3 = reason.toString();
|
|
463869
|
-
const
|
|
463870
|
-
return `${channel} socket closed (code=${code}, reason=${JSON.stringify(
|
|
464028
|
+
const truncated2 = text3.length > MAX_CLOSE_REASON_LENGTH ? `${text3.slice(0, MAX_CLOSE_REASON_LENGTH)}...` : text3;
|
|
464029
|
+
return `${channel} socket closed (code=${code}, reason=${JSON.stringify(truncated2)})`;
|
|
463871
464030
|
}
|
|
463872
464031
|
function attachSplitStreamSocketHandlers(params) {
|
|
463873
464032
|
params.streamSocket.on("error", (error4) => {
|
|
@@ -471953,7 +472112,7 @@ async function runMessagesSubcommand(argv, deps = {}) {
|
|
|
471953
472112
|
const collected = [];
|
|
471954
472113
|
const seenIds = new Set;
|
|
471955
472114
|
let cursorBefore;
|
|
471956
|
-
let
|
|
472115
|
+
let truncated2 = true;
|
|
471957
472116
|
for (let pageIndex = 0;pageIndex < maxPages; pageIndex += 1) {
|
|
471958
472117
|
const page = await backend3.listConversationMessages(conversationId, {
|
|
471959
472118
|
limit: pageLimit,
|
|
@@ -471964,7 +472123,7 @@ async function runMessagesSubcommand(argv, deps = {}) {
|
|
|
471964
472123
|
});
|
|
471965
472124
|
const items = pageItems4(page);
|
|
471966
472125
|
if (items.length === 0) {
|
|
471967
|
-
|
|
472126
|
+
truncated2 = false;
|
|
471968
472127
|
break;
|
|
471969
472128
|
}
|
|
471970
472129
|
let newItems = 0;
|
|
@@ -471978,11 +472137,11 @@ async function runMessagesSubcommand(argv, deps = {}) {
|
|
|
471978
472137
|
}
|
|
471979
472138
|
cursorBefore = items[items.length - 1]?.id;
|
|
471980
472139
|
if (newItems === 0 || items.length < pageLimit) {
|
|
471981
|
-
|
|
472140
|
+
truncated2 = newItems === 0;
|
|
471982
472141
|
break;
|
|
471983
472142
|
}
|
|
471984
472143
|
}
|
|
471985
|
-
return { messages: sortChronological2(collected), truncated };
|
|
472144
|
+
return { messages: sortChronological2(collected), truncated: truncated2 };
|
|
471986
472145
|
};
|
|
471987
472146
|
if (action === "search") {
|
|
471988
472147
|
const query3 = parsed.values.query;
|
|
@@ -472078,7 +472237,7 @@ async function runMessagesSubcommand(argv, deps = {}) {
|
|
|
472078
472237
|
const maxPages = Math.max(1, parseLimit3(parsed.values["max-pages"], 200));
|
|
472079
472238
|
const outputPathRaw = parsed.values.out || parsed.values.output;
|
|
472080
472239
|
const outputPath = outputPathRaw ? resolve39(process.cwd(), outputPathRaw) : undefined;
|
|
472081
|
-
const { messages, truncated } = await fetchConversationMessages(conversationId, agentId || undefined, pageLimit, maxPages);
|
|
472240
|
+
const { messages, truncated: truncated2 } = await fetchConversationMessages(conversationId, agentId || undefined, pageLimit, maxPages);
|
|
472082
472241
|
const transcript2 = messages.flatMap((msg) => formatEntry(msg)).join(`
|
|
472083
472242
|
|
|
472084
472243
|
`).trim();
|
|
@@ -472090,7 +472249,7 @@ async function runMessagesSubcommand(argv, deps = {}) {
|
|
|
472090
472249
|
conversation_id: conversationId,
|
|
472091
472250
|
agent_id: agentId || null,
|
|
472092
472251
|
message_count: messages.length,
|
|
472093
|
-
truncated,
|
|
472252
|
+
truncated: truncated2,
|
|
472094
472253
|
...outputPath ? { output_path: outputPath } : { transcript: transcript2 }
|
|
472095
472254
|
}, null, 2));
|
|
472096
472255
|
return 0;
|
|
@@ -484106,6 +484265,101 @@ async function createSubagentConversation(cloudBackend, parentConversationId, ag
|
|
|
484106
484265
|
return (await create4(body3)).id;
|
|
484107
484266
|
}
|
|
484108
484267
|
|
|
484268
|
+
// src/stream-json-writer.ts
|
|
484269
|
+
function stampWireMessage(msg) {
|
|
484270
|
+
return msg.timestamp === undefined ? { ...msg, timestamp: new Date().toISOString() } : msg;
|
|
484271
|
+
}
|
|
484272
|
+
function writeWireMessage(msg) {
|
|
484273
|
+
console.log(JSON.stringify(stampWireMessage(msg)));
|
|
484274
|
+
}
|
|
484275
|
+
async function writeWireMessageAsync(msg) {
|
|
484276
|
+
const line = `${JSON.stringify(stampWireMessage(msg))}
|
|
484277
|
+
`;
|
|
484278
|
+
return await new Promise((resolve42, reject2) => {
|
|
484279
|
+
if (process.stdout.destroyed || process.stdout.writableEnded) {
|
|
484280
|
+
resolve42(false);
|
|
484281
|
+
return;
|
|
484282
|
+
}
|
|
484283
|
+
process.stdout.write(line, (error4) => {
|
|
484284
|
+
if (error4) {
|
|
484285
|
+
reject2(error4);
|
|
484286
|
+
return;
|
|
484287
|
+
}
|
|
484288
|
+
resolve42(true);
|
|
484289
|
+
});
|
|
484290
|
+
});
|
|
484291
|
+
}
|
|
484292
|
+
|
|
484293
|
+
// src/utils/sigint-abort.ts
|
|
484294
|
+
function createProcessAbortSignal(events, proc = process) {
|
|
484295
|
+
const controller = new AbortController;
|
|
484296
|
+
const listeners6 = events.map((event) => {
|
|
484297
|
+
const listener = () => controller.abort(new DOMException(event, "AbortError"));
|
|
484298
|
+
proc.once(event, listener);
|
|
484299
|
+
return { event, listener };
|
|
484300
|
+
});
|
|
484301
|
+
return {
|
|
484302
|
+
signal: controller.signal,
|
|
484303
|
+
dispose() {
|
|
484304
|
+
for (const { event, listener } of listeners6)
|
|
484305
|
+
proc.removeListener(event, listener);
|
|
484306
|
+
}
|
|
484307
|
+
};
|
|
484308
|
+
}
|
|
484309
|
+
|
|
484310
|
+
// src/headless-interrupt.ts
|
|
484311
|
+
import { randomUUID as randomUUID63 } from "node:crypto";
|
|
484312
|
+
function createHeadlessInterrupt(outputFormat, sessionId, exitHeadless) {
|
|
484313
|
+
const { signal, dispose: dispose2 } = createProcessAbortSignal(["SIGINT", "SIGTERM"]);
|
|
484314
|
+
let shutdown;
|
|
484315
|
+
function exitInterrupted() {
|
|
484316
|
+
shutdown ??= exitInterruptedHeadless(signal, outputFormat, sessionId, exitHeadless);
|
|
484317
|
+
return shutdown;
|
|
484318
|
+
}
|
|
484319
|
+
signal.addEventListener("abort", () => {
|
|
484320
|
+
if (signal.reason?.message === "SIGTERM")
|
|
484321
|
+
exitInterrupted();
|
|
484322
|
+
}, { once: true });
|
|
484323
|
+
return { signal, dispose: dispose2, exitInterrupted };
|
|
484324
|
+
}
|
|
484325
|
+
async function exitInterruptedHeadless(interruptSignal, outputFormat, sessionId, exitHeadless) {
|
|
484326
|
+
const term = interruptSignal.reason?.message === "SIGTERM";
|
|
484327
|
+
const message2 = term ? "Interrupted by SIGTERM" : "Interrupted by SIGINT";
|
|
484328
|
+
await waitForForegroundBashCleanup();
|
|
484329
|
+
if (outputFormat === "stream-json") {
|
|
484330
|
+
const write2 = writeWireMessageAsync({
|
|
484331
|
+
type: "error",
|
|
484332
|
+
message: message2,
|
|
484333
|
+
stop_reason: "cancelled",
|
|
484334
|
+
session_id: sessionId,
|
|
484335
|
+
uuid: `error-interrupted-${randomUUID63()}`
|
|
484336
|
+
});
|
|
484337
|
+
if (term)
|
|
484338
|
+
await waitForTerminationOutput(write2.catch(() => false));
|
|
484339
|
+
else
|
|
484340
|
+
await write2;
|
|
484341
|
+
} else {
|
|
484342
|
+
console.error(message2);
|
|
484343
|
+
}
|
|
484344
|
+
return exitHeadless(term ? 143 : 130, term ? "headless_sigterm_interrupted" : "headless_sigint_interrupted");
|
|
484345
|
+
}
|
|
484346
|
+
async function waitForTerminationOutput(write2) {
|
|
484347
|
+
let timer;
|
|
484348
|
+
try {
|
|
484349
|
+
await Promise.race([
|
|
484350
|
+
write2,
|
|
484351
|
+
new Promise((resolve42) => {
|
|
484352
|
+
timer = setTimeout(resolve42, 250);
|
|
484353
|
+
})
|
|
484354
|
+
]);
|
|
484355
|
+
} finally {
|
|
484356
|
+
clearTimeout(timer);
|
|
484357
|
+
}
|
|
484358
|
+
}
|
|
484359
|
+
var init_headless_interrupt = __esm(() => {
|
|
484360
|
+
init_bash();
|
|
484361
|
+
});
|
|
484362
|
+
|
|
484109
484363
|
// src/headless-message-sender.ts
|
|
484110
484364
|
function buildHeadlessSenderReminder(isAgentLaunch, fromAgentId, env6 = process.env) {
|
|
484111
484365
|
if (isAgentLaunch && isMemoryWorkerSession(env6)) {
|
|
@@ -484125,13 +484379,13 @@ var init_headless_message_sender = __esm(() => {
|
|
|
484125
484379
|
});
|
|
484126
484380
|
|
|
484127
484381
|
// src/headless-response-state.ts
|
|
484128
|
-
import { randomUUID as
|
|
484382
|
+
import { randomUUID as randomUUID64 } from "node:crypto";
|
|
484129
484383
|
function createHeadlessResponseState() {
|
|
484130
484384
|
let reusableInput = null;
|
|
484131
484385
|
return {
|
|
484132
484386
|
prepare(approvals, fullyAutoHandled) {
|
|
484133
484387
|
const input = [
|
|
484134
|
-
{ type: "approval", approvals, otid:
|
|
484388
|
+
{ type: "approval", approvals, otid: randomUUID64() }
|
|
484135
484389
|
];
|
|
484136
484390
|
reusableInput = fullyAutoHandled ? input : null;
|
|
484137
484391
|
return input;
|
|
@@ -484188,15 +484442,6 @@ var init_headless_stdout_guard = __esm(() => {
|
|
|
484188
484442
|
init_subagent_stdout_failure();
|
|
484189
484443
|
});
|
|
484190
484444
|
|
|
484191
|
-
// src/utils/sigint-abort.ts
|
|
484192
|
-
function createSigintAbortSignal(proc = process) {
|
|
484193
|
-
const controller = new AbortController;
|
|
484194
|
-
proc.once("SIGINT", () => {
|
|
484195
|
-
controller.abort();
|
|
484196
|
-
});
|
|
484197
|
-
return controller.signal;
|
|
484198
|
-
}
|
|
484199
|
-
|
|
484200
484445
|
// src/agent/list-messages-routing.ts
|
|
484201
484446
|
function resolveListMessagesRoute(listReq, sessionConvId, sessionAgentId) {
|
|
484202
484447
|
const targetConvId = listReq.conversation_id ?? sessionConvId;
|
|
@@ -484208,7 +484453,7 @@ function resolveListMessagesRoute(listReq, sessionConvId, sessionAgentId) {
|
|
|
484208
484453
|
}
|
|
484209
484454
|
|
|
484210
484455
|
// src/agent/bootstrap-handler.ts
|
|
484211
|
-
import { randomUUID as
|
|
484456
|
+
import { randomUUID as randomUUID65 } from "node:crypto";
|
|
484212
484457
|
async function handleBootstrapSessionState(params) {
|
|
484213
484458
|
const {
|
|
484214
484459
|
bootstrapReq,
|
|
@@ -484257,7 +484502,7 @@ async function handleBootstrapSessionState(params) {
|
|
|
484257
484502
|
response: payload
|
|
484258
484503
|
},
|
|
484259
484504
|
session_id: sessionContext.sessionId,
|
|
484260
|
-
uuid:
|
|
484505
|
+
uuid: randomUUID65()
|
|
484261
484506
|
};
|
|
484262
484507
|
} catch (err) {
|
|
484263
484508
|
return {
|
|
@@ -484268,14 +484513,14 @@ async function handleBootstrapSessionState(params) {
|
|
|
484268
484513
|
error: err instanceof Error ? err.message : "bootstrap_session_state failed"
|
|
484269
484514
|
},
|
|
484270
484515
|
session_id: sessionContext.sessionId,
|
|
484271
|
-
uuid:
|
|
484516
|
+
uuid: randomUUID65()
|
|
484272
484517
|
};
|
|
484273
484518
|
}
|
|
484274
484519
|
}
|
|
484275
484520
|
var init_bootstrap_handler = () => {};
|
|
484276
484521
|
|
|
484277
484522
|
// src/agent/list-messages-handler.ts
|
|
484278
|
-
import { randomUUID as
|
|
484523
|
+
import { randomUUID as randomUUID66 } from "node:crypto";
|
|
484279
484524
|
async function handleListMessages(params) {
|
|
484280
484525
|
const {
|
|
484281
484526
|
listReq,
|
|
@@ -484315,7 +484560,7 @@ async function handleListMessages(params) {
|
|
|
484315
484560
|
response: payload
|
|
484316
484561
|
},
|
|
484317
484562
|
session_id: sessionId,
|
|
484318
|
-
uuid:
|
|
484563
|
+
uuid: randomUUID66()
|
|
484319
484564
|
};
|
|
484320
484565
|
} catch (err) {
|
|
484321
484566
|
return {
|
|
@@ -484326,7 +484571,7 @@ async function handleListMessages(params) {
|
|
|
484326
484571
|
error: err instanceof Error ? err.message : "list_messages failed"
|
|
484327
484572
|
},
|
|
484328
484573
|
session_id: sessionId,
|
|
484329
|
-
uuid:
|
|
484574
|
+
uuid: randomUUID66()
|
|
484330
484575
|
};
|
|
484331
484576
|
}
|
|
484332
484577
|
}
|
|
@@ -484603,7 +484848,7 @@ var init_headless_enqueue_wait = __esm(() => {
|
|
|
484603
484848
|
});
|
|
484604
484849
|
|
|
484605
484850
|
// src/headless-cloud-send.ts
|
|
484606
|
-
import { randomUUID as
|
|
484851
|
+
import { randomUUID as randomUUID67 } from "node:crypto";
|
|
484607
484852
|
function shouldEnqueueCloudSend(values4, cloud, isAgentLaunch) {
|
|
484608
484853
|
if (!cloud || isAgentLaunch || values4["new-agent"] || values4.ephemeral)
|
|
484609
484854
|
return false;
|
|
@@ -484653,7 +484898,7 @@ async function tryCloudHeadlessSend(values4, prompt, backend3, isAgentLaunch, de
|
|
|
484653
484898
|
const format3 = values4["output-format"] ?? "text";
|
|
484654
484899
|
const noWait = Boolean(values4["no-wait"]);
|
|
484655
484900
|
const started = Date.now();
|
|
484656
|
-
const clientMessageId = values4["client-message-id"] ??
|
|
484901
|
+
const clientMessageId = values4["client-message-id"] ?? randomUUID67();
|
|
484657
484902
|
const controller = new AbortController;
|
|
484658
484903
|
const submissionTimeout = setTimeout(() => controller.abort(new Error("Cloud submission timed out; inspect the conversation before resending.")), 30000);
|
|
484659
484904
|
const timeout = setTimeout(() => controller.abort(new Error("Stopped waiting; remote execution was not cancelled.")), deps.timeoutMs ?? resolveEnvironmentMaxWaitMs());
|
|
@@ -484741,7 +484986,7 @@ async function tryCloudHeadlessSend(values4, prompt, backend3, isAgentLaunch, de
|
|
|
484741
484986
|
mcp_servers: [],
|
|
484742
484987
|
permission_mode: "",
|
|
484743
484988
|
slash_commands: [],
|
|
484744
|
-
uuid:
|
|
484989
|
+
uuid: randomUUID67()
|
|
484745
484990
|
};
|
|
484746
484991
|
await writeObject(init);
|
|
484747
484992
|
}
|
|
@@ -484784,7 +485029,7 @@ async function tryCloudHeadlessSend(values4, prompt, backend3, isAgentLaunch, de
|
|
|
484784
485029
|
duration_api_ms: 0,
|
|
484785
485030
|
num_turns: 1,
|
|
484786
485031
|
usage: null,
|
|
484787
|
-
uuid:
|
|
485032
|
+
uuid: randomUUID67(),
|
|
484788
485033
|
...recovery
|
|
484789
485034
|
});
|
|
484790
485035
|
return 0;
|
|
@@ -484803,7 +485048,7 @@ async function tryCloudHeadlessSend(values4, prompt, backend3, isAgentLaunch, de
|
|
|
484803
485048
|
run_ids: error4 instanceof EnqueuedWaitError ? error4.runIds : [],
|
|
484804
485049
|
usage: null,
|
|
484805
485050
|
stop_reason: "error",
|
|
484806
|
-
uuid:
|
|
485051
|
+
uuid: randomUUID67(),
|
|
484807
485052
|
status: receipt ? "wait_failed" : submissionAttempted && !(error4 instanceof ApiRequestError && error4.status >= 400 && error4.status < 500) ? "acceptance_unknown" : "submission_failed",
|
|
484808
485053
|
agent_id: agentId ?? null,
|
|
484809
485054
|
conversation_id: conversationId ?? "",
|
|
@@ -485098,31 +485343,6 @@ async function waitForHeadlessPermissionResponse(options) {
|
|
|
485098
485343
|
}
|
|
485099
485344
|
}
|
|
485100
485345
|
|
|
485101
|
-
// src/stream-json-writer.ts
|
|
485102
|
-
function stampWireMessage(msg) {
|
|
485103
|
-
return msg.timestamp === undefined ? { ...msg, timestamp: new Date().toISOString() } : msg;
|
|
485104
|
-
}
|
|
485105
|
-
function writeWireMessage(msg) {
|
|
485106
|
-
console.log(JSON.stringify(stampWireMessage(msg)));
|
|
485107
|
-
}
|
|
485108
|
-
async function writeWireMessageAsync(msg) {
|
|
485109
|
-
const line = `${JSON.stringify(stampWireMessage(msg))}
|
|
485110
|
-
`;
|
|
485111
|
-
return await new Promise((resolve42, reject2) => {
|
|
485112
|
-
if (process.stdout.destroyed || process.stdout.writableEnded) {
|
|
485113
|
-
resolve42(false);
|
|
485114
|
-
return;
|
|
485115
|
-
}
|
|
485116
|
-
process.stdout.write(line, (error4) => {
|
|
485117
|
-
if (error4) {
|
|
485118
|
-
reject2(error4);
|
|
485119
|
-
return;
|
|
485120
|
-
}
|
|
485121
|
-
resolve42(true);
|
|
485122
|
-
});
|
|
485123
|
-
});
|
|
485124
|
-
}
|
|
485125
|
-
|
|
485126
485346
|
// src/headless-tool-events.ts
|
|
485127
485347
|
function emitLocalToolCalls(decisions, sessionId) {
|
|
485128
485348
|
const date5 = new Date().toISOString();
|
|
@@ -485303,7 +485523,7 @@ __export(exports_headless, {
|
|
|
485303
485523
|
decideInterruptAction: () => decideInterruptAction,
|
|
485304
485524
|
__headlessTestUtils: () => __headlessTestUtils
|
|
485305
485525
|
});
|
|
485306
|
-
import { randomUUID as
|
|
485526
|
+
import { randomUUID as randomUUID68 } from "node:crypto";
|
|
485307
485527
|
function trackHeadlessBoundaryError(errorType, error4, context3) {
|
|
485308
485528
|
trackBoundaryError({
|
|
485309
485529
|
errorType,
|
|
@@ -485325,7 +485545,7 @@ async function reportStartupErrorAndExit(errorType, error4, context3, outputForm
|
|
|
485325
485545
|
message: message2,
|
|
485326
485546
|
stop_reason: "error",
|
|
485327
485547
|
session_id: "startup",
|
|
485328
|
-
uuid: `startup-error-${
|
|
485548
|
+
uuid: `startup-error-${randomUUID68()}`
|
|
485329
485549
|
};
|
|
485330
485550
|
await writeWireMessageAsync(errorMsg);
|
|
485331
485551
|
} else {
|
|
@@ -485399,7 +485619,7 @@ async function emitHeadlessTurnStartCancellationOutput(options) {
|
|
|
485399
485619
|
message: options.reason,
|
|
485400
485620
|
stop_reason: "cancelled",
|
|
485401
485621
|
session_id: options.sessionId,
|
|
485402
|
-
uuid: `error-turn-start-cancel-${
|
|
485622
|
+
uuid: `error-turn-start-cancel-${randomUUID68()}`
|
|
485403
485623
|
};
|
|
485404
485624
|
await writeWireMessageAsync(errorMsg);
|
|
485405
485625
|
const resultMsg = {
|
|
@@ -485414,7 +485634,7 @@ async function emitHeadlessTurnStartCancellationOutput(options) {
|
|
|
485414
485634
|
conversation_id: options.conversationId,
|
|
485415
485635
|
run_ids: [],
|
|
485416
485636
|
usage: null,
|
|
485417
|
-
uuid: `result-turn-start-cancel-${
|
|
485637
|
+
uuid: `result-turn-start-cancel-${randomUUID68()}`,
|
|
485418
485638
|
stop_reason: "cancelled"
|
|
485419
485639
|
};
|
|
485420
485640
|
await writeWireMessageAsync(resultMsg);
|
|
@@ -485443,7 +485663,7 @@ function writeBidirectionalTurnStartCancellation(options) {
|
|
|
485443
485663
|
message: options.reason,
|
|
485444
485664
|
stop_reason: "cancelled",
|
|
485445
485665
|
session_id: options.sessionId,
|
|
485446
|
-
uuid: `error-turn-start-cancel-${
|
|
485666
|
+
uuid: `error-turn-start-cancel-${randomUUID68()}`
|
|
485447
485667
|
};
|
|
485448
485668
|
writeWireMessage(errorMsg);
|
|
485449
485669
|
const resultMsg = {
|
|
@@ -485458,7 +485678,7 @@ function writeBidirectionalTurnStartCancellation(options) {
|
|
|
485458
485678
|
conversation_id: options.conversationId,
|
|
485459
485679
|
run_ids: [],
|
|
485460
485680
|
usage: null,
|
|
485461
|
-
uuid: `result-turn-start-cancel-${
|
|
485681
|
+
uuid: `result-turn-start-cancel-${randomUUID68()}`,
|
|
485462
485682
|
stop_reason: "cancelled"
|
|
485463
485683
|
};
|
|
485464
485684
|
writeWireMessage(resultMsg);
|
|
@@ -485516,10 +485736,14 @@ async function flushAndExit(code) {
|
|
|
485516
485736
|
stream11.write("", () => resolve42());
|
|
485517
485737
|
});
|
|
485518
485738
|
await closeClientMcpServers();
|
|
485519
|
-
|
|
485739
|
+
const flushed = Promise.allSettled([
|
|
485520
485740
|
flushWritable(process.stdout),
|
|
485521
485741
|
flushWritable(process.stderr)
|
|
485522
485742
|
]);
|
|
485743
|
+
if (code === 143)
|
|
485744
|
+
await waitForTerminationOutput(flushed);
|
|
485745
|
+
else
|
|
485746
|
+
await flushed;
|
|
485523
485747
|
process.exit(code);
|
|
485524
485748
|
}
|
|
485525
485749
|
async function writeFinalHeadlessStdout(text3) {
|
|
@@ -486265,7 +486489,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486265
486489
|
const approvalInput = {
|
|
486266
486490
|
type: "approval",
|
|
486267
486491
|
approvals: denialResults,
|
|
486268
|
-
otid:
|
|
486492
|
+
otid: randomUUID68()
|
|
486269
486493
|
};
|
|
486270
486494
|
const approvalMessages = [approvalInput];
|
|
486271
486495
|
{
|
|
@@ -486278,7 +486502,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486278
486502
|
type: "text",
|
|
486279
486503
|
text: sc.content
|
|
486280
486504
|
})),
|
|
486281
|
-
otid:
|
|
486505
|
+
otid: randomUUID68()
|
|
486282
486506
|
});
|
|
486283
486507
|
}
|
|
486284
486508
|
}
|
|
@@ -486311,7 +486535,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486311
486535
|
message: `Failed to resolve pending approvals on resume: ${approvalError instanceof Error ? approvalError.message : String(approvalError)}`,
|
|
486312
486536
|
stop_reason: "error",
|
|
486313
486537
|
session_id: sessionId,
|
|
486314
|
-
uuid: `error-pre-loop-approval-${
|
|
486538
|
+
uuid: `error-pre-loop-approval-${randomUUID68()}`
|
|
486315
486539
|
};
|
|
486316
486540
|
writeWireMessage(errorMsg);
|
|
486317
486541
|
} else {
|
|
@@ -486385,7 +486609,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486385
486609
|
content: contentParts,
|
|
486386
486610
|
backend: backend3,
|
|
486387
486611
|
onMessage: outputFormat === "stream-json" ? (message2) => {
|
|
486388
|
-
const uuid5 = Reflect.get(message2, "otid") ?? Reflect.get(message2, "id") ??
|
|
486612
|
+
const uuid5 = Reflect.get(message2, "otid") ?? Reflect.get(message2, "id") ?? randomUUID68();
|
|
486389
486613
|
writeWireMessage(includePartialMessages ? {
|
|
486390
486614
|
type: "stream_event",
|
|
486391
486615
|
event: message2,
|
|
@@ -486449,7 +486673,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486449
486673
|
{
|
|
486450
486674
|
role: "user",
|
|
486451
486675
|
content: contentParts,
|
|
486452
|
-
otid:
|
|
486676
|
+
otid: randomUUID68()
|
|
486453
486677
|
}
|
|
486454
486678
|
];
|
|
486455
486679
|
const recoveredApprovalResults = queuedRecoveredApprovalResults ?? [];
|
|
@@ -486458,7 +486682,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486458
486682
|
{
|
|
486459
486683
|
type: "approval",
|
|
486460
486684
|
approvals: recoveredApprovalResults,
|
|
486461
|
-
otid:
|
|
486685
|
+
otid: randomUUID68()
|
|
486462
486686
|
},
|
|
486463
486687
|
...currentInput
|
|
486464
486688
|
];
|
|
@@ -486506,7 +486730,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486506
486730
|
message: `Maximum turns limit reached (${buffers.usage.stepCount}/${maxTurns} steps)`,
|
|
486507
486731
|
stop_reason: "max_steps",
|
|
486508
486732
|
session_id: sessionId,
|
|
486509
|
-
uuid: `error-max-turns-${
|
|
486733
|
+
uuid: `error-max-turns-${randomUUID68()}`
|
|
486510
486734
|
};
|
|
486511
486735
|
await writeWireMessageAsync(errorMsg);
|
|
486512
486736
|
} else {
|
|
@@ -486515,25 +486739,14 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486515
486739
|
await exitHeadless(1, "headless_max_steps_reached");
|
|
486516
486740
|
}
|
|
486517
486741
|
};
|
|
486518
|
-
const
|
|
486519
|
-
|
|
486520
|
-
|
|
486521
|
-
|
|
486522
|
-
|
|
486523
|
-
message: "Interrupted by SIGINT",
|
|
486524
|
-
stop_reason: "cancelled",
|
|
486525
|
-
session_id: sessionId,
|
|
486526
|
-
uuid: `error-interrupted-${randomUUID67()}`
|
|
486527
|
-
};
|
|
486528
|
-
await writeWireMessageAsync(errorMsg);
|
|
486529
|
-
} else {
|
|
486530
|
-
console.error("Interrupted by SIGINT");
|
|
486531
|
-
}
|
|
486532
|
-
return exitHeadless(130, "headless_sigint_interrupted");
|
|
486533
|
-
};
|
|
486742
|
+
const {
|
|
486743
|
+
signal: interruptSignal,
|
|
486744
|
+
dispose: dispose2,
|
|
486745
|
+
exitInterrupted
|
|
486746
|
+
} = createHeadlessInterrupt(outputFormat, sessionId, exitHeadless);
|
|
486534
486747
|
try {
|
|
486535
486748
|
while (true) {
|
|
486536
|
-
if (
|
|
486749
|
+
if (interruptSignal.aborted) {
|
|
486537
486750
|
await exitInterrupted();
|
|
486538
486751
|
}
|
|
486539
486752
|
const hasApprovalContinuation = currentInput.some((item) => item.type === "approval");
|
|
@@ -486552,7 +486765,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486552
486765
|
type: "text",
|
|
486553
486766
|
text: sc.content
|
|
486554
486767
|
})),
|
|
486555
|
-
otid:
|
|
486768
|
+
otid: randomUUID68()
|
|
486556
486769
|
}
|
|
486557
486770
|
];
|
|
486558
486771
|
}
|
|
@@ -486579,11 +486792,11 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486579
486792
|
agentId: agent.id,
|
|
486580
486793
|
allowResponseStateReuse: responseState.consume(currentInput),
|
|
486581
486794
|
preparedToolContext: turnToolContext.preparedToolContext.preparedToolContext
|
|
486582
|
-
}, { maxRetries: 0, signal:
|
|
486795
|
+
}, { maxRetries: 0, signal: interruptSignal });
|
|
486583
486796
|
turnToolContextId = getStreamToolContextId(stream11);
|
|
486584
486797
|
busyDeadline = null;
|
|
486585
486798
|
} catch (preStreamError) {
|
|
486586
|
-
if (
|
|
486799
|
+
if (interruptSignal.aborted) {
|
|
486587
486800
|
await exitInterrupted();
|
|
486588
486801
|
}
|
|
486589
486802
|
const errorDetail3 = extractConflictDetail(preStreamError);
|
|
@@ -486599,7 +486812,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486599
486812
|
recovery_type: "approval_pending",
|
|
486600
486813
|
message: "Detected pending approval conflict on send; resolving before retry",
|
|
486601
486814
|
session_id: sessionId,
|
|
486602
|
-
uuid: `recovery-pre-stream-${
|
|
486815
|
+
uuid: `recovery-pre-stream-${randomUUID68()}`
|
|
486603
486816
|
};
|
|
486604
486817
|
writeWireMessage(recoveryMsg);
|
|
486605
486818
|
} else {
|
|
@@ -486610,7 +486823,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486610
486823
|
}
|
|
486611
486824
|
const blockingRunId = extractConversationBusyRunId(errorDetail3);
|
|
486612
486825
|
if (preStreamAction === "retry_conversation_busy" || blockingRunId) {
|
|
486613
|
-
const resumeStream = await resumeConversationBusyRequest(conversationId, agent?.id, currentInput,
|
|
486826
|
+
const resumeStream = await resumeConversationBusyRequest(conversationId, agent?.id, currentInput, interruptSignal);
|
|
486614
486827
|
if (resumeStream) {
|
|
486615
486828
|
stream11 = resumeStream;
|
|
486616
486829
|
conversationBusyRetries = 0;
|
|
@@ -486618,7 +486831,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486618
486831
|
} else {
|
|
486619
486832
|
if (blockingRunId) {
|
|
486620
486833
|
busyDeadline ??= Date.now() + CONVERSATION_BUSY_WAIT_TIMEOUT_MS;
|
|
486621
|
-
const settled = await waitForConversationBusyRunOrThrow(blockingRunId,
|
|
486834
|
+
const settled = await waitForConversationBusyRunOrThrow(blockingRunId, interruptSignal, busyDeadline);
|
|
486622
486835
|
if (settled)
|
|
486623
486836
|
continue;
|
|
486624
486837
|
}
|
|
@@ -486639,7 +486852,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486639
486852
|
max_attempts: CONVERSATION_BUSY_MAX_RETRIES,
|
|
486640
486853
|
delay_ms: retryDelayMs,
|
|
486641
486854
|
session_id: sessionId,
|
|
486642
|
-
uuid: `retry-conversation-busy-${
|
|
486855
|
+
uuid: `retry-conversation-busy-${randomUUID68()}`
|
|
486643
486856
|
};
|
|
486644
486857
|
writeWireMessage(retryMsg);
|
|
486645
486858
|
} else {
|
|
@@ -486667,7 +486880,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486667
486880
|
max_attempts: LLM_API_ERROR_MAX_RETRIES2,
|
|
486668
486881
|
delay_ms: delayMs,
|
|
486669
486882
|
session_id: sessionId,
|
|
486670
|
-
uuid: `retry-pre-stream-${
|
|
486883
|
+
uuid: `retry-pre-stream-${randomUUID68()}`
|
|
486671
486884
|
};
|
|
486672
486885
|
writeWireMessage(retryMsg);
|
|
486673
486886
|
} else {
|
|
@@ -486694,7 +486907,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486694
486907
|
stop_reason: "error",
|
|
486695
486908
|
run_id: errorInfo.run_id,
|
|
486696
486909
|
session_id: sessionId,
|
|
486697
|
-
uuid:
|
|
486910
|
+
uuid: randomUUID68(),
|
|
486698
486911
|
...errorInfo.error_type && errorInfo.run_id && {
|
|
486699
486912
|
api_error: {
|
|
486700
486913
|
message_type: "error_message",
|
|
@@ -486716,7 +486929,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486716
486929
|
message: "Detected pending approval conflict; auto-denying stale approval and retrying",
|
|
486717
486930
|
run_id: recoveryRunId ?? undefined,
|
|
486718
486931
|
session_id: sessionId,
|
|
486719
|
-
uuid: `recovery-${recoveryRunId ||
|
|
486932
|
+
uuid: `recovery-${recoveryRunId || randomUUID68()}`
|
|
486720
486933
|
};
|
|
486721
486934
|
writeWireMessage(recoveryMsg);
|
|
486722
486935
|
approvalPendingRecovery = true;
|
|
@@ -486734,7 +486947,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486734
486947
|
type: "stream_event",
|
|
486735
486948
|
event: chunk2,
|
|
486736
486949
|
session_id: sessionId,
|
|
486737
|
-
uuid: uuid5 ||
|
|
486950
|
+
uuid: uuid5 || randomUUID68()
|
|
486738
486951
|
};
|
|
486739
486952
|
writeWireMessage(streamEvent);
|
|
486740
486953
|
} else {
|
|
@@ -486742,7 +486955,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486742
486955
|
type: "message",
|
|
486743
486956
|
...chunk2,
|
|
486744
486957
|
session_id: sessionId,
|
|
486745
|
-
uuid: uuid5 ||
|
|
486958
|
+
uuid: uuid5 || randomUUID68()
|
|
486746
486959
|
};
|
|
486747
486960
|
writeWireMessage(msg);
|
|
486748
486961
|
}
|
|
@@ -486750,7 +486963,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486750
486963
|
return { shouldOutput: shouldOutputChunk, shouldAccumulate: true };
|
|
486751
486964
|
};
|
|
486752
486965
|
}
|
|
486753
|
-
const result3 = await drainStreamWithResume(stream11, buffers, () => {},
|
|
486966
|
+
const result3 = await drainStreamWithResume(stream11, buffers, () => {}, interruptSignal, undefined, streamJsonHook, reminderContextTracker, undefined, HEADLESS_STREAM_RESUME_POLICY);
|
|
486754
486967
|
const { apiDurationMs, stopReason } = result3;
|
|
486755
486968
|
const approvals = result3.approvals || [];
|
|
486756
486969
|
const lastRunId = result3.lastRunId || null;
|
|
@@ -486758,7 +486971,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486758
486971
|
if (lastRunId)
|
|
486759
486972
|
lastKnownRunId = lastRunId;
|
|
486760
486973
|
sessionStats.endTurn(apiDurationMs);
|
|
486761
|
-
if (stopReason === "cancelled" ||
|
|
486974
|
+
if (stopReason === "cancelled" || interruptSignal.aborted) {
|
|
486762
486975
|
await exitInterrupted();
|
|
486763
486976
|
}
|
|
486764
486977
|
if (stopReason !== "requires_approval" && !approvalPendingRecovery && !(stopReason === "error" && fallbackError)) {
|
|
@@ -486787,7 +487000,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486787
487000
|
{
|
|
486788
487001
|
role: "user",
|
|
486789
487002
|
content: continueMessage,
|
|
486790
|
-
otid:
|
|
487003
|
+
otid: randomUUID68()
|
|
486791
487004
|
}
|
|
486792
487005
|
];
|
|
486793
487006
|
const continueTurnStartEmission = await emitHeadlessTurnStart({
|
|
@@ -486846,10 +487059,10 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486846
487059
|
emitLocalToolCalls(decisions, sessionId);
|
|
486847
487060
|
}
|
|
486848
487061
|
const executedResults = await executeApprovalBatch2(decisions, undefined, {
|
|
486849
|
-
abortSignal:
|
|
487062
|
+
abortSignal: interruptSignal,
|
|
486850
487063
|
toolContextId: turnToolContextId ?? undefined
|
|
486851
487064
|
});
|
|
486852
|
-
if (
|
|
487065
|
+
if (interruptSignal.aborted) {
|
|
486853
487066
|
await exitInterrupted();
|
|
486854
487067
|
}
|
|
486855
487068
|
if (outputFormat === "stream-json") {
|
|
@@ -486875,7 +487088,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486875
487088
|
currentHandle: null,
|
|
486876
487089
|
error: result3.errorInfo ?? runErrorInfo2 ?? latestErrorText,
|
|
486877
487090
|
exhaustedProviders: chatgptExhaustedProviders,
|
|
486878
|
-
signal:
|
|
487091
|
+
signal: interruptSignal
|
|
486879
487092
|
});
|
|
486880
487093
|
if (rotation) {
|
|
486881
487094
|
chatgptPlanSwaps += 1;
|
|
@@ -486889,7 +487102,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486889
487102
|
delay_ms: 0,
|
|
486890
487103
|
run_id: lastRunId ?? undefined,
|
|
486891
487104
|
session_id: sessionId,
|
|
486892
|
-
uuid: `retry-${lastRunId ||
|
|
487105
|
+
uuid: `retry-${lastRunId || randomUUID68()}`
|
|
486893
487106
|
};
|
|
486894
487107
|
writeWireMessage(retryMsg);
|
|
486895
487108
|
} else {
|
|
@@ -486917,7 +487130,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486917
487130
|
delay_ms: delayMs,
|
|
486918
487131
|
run_id: lastRunId ?? undefined,
|
|
486919
487132
|
session_id: sessionId,
|
|
486920
|
-
uuid: `retry-${lastRunId ||
|
|
487133
|
+
uuid: `retry-${lastRunId || randomUUID68()}`
|
|
486921
487134
|
};
|
|
486922
487135
|
writeWireMessage(retryMsg);
|
|
486923
487136
|
} else {
|
|
@@ -486938,7 +487151,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486938
487151
|
message: "Tool call ID mismatch; fetching actual pending approvals and resyncing",
|
|
486939
487152
|
run_id: lastRunId ?? undefined,
|
|
486940
487153
|
session_id: sessionId,
|
|
486941
|
-
uuid: `recovery-${lastRunId ||
|
|
487154
|
+
uuid: `recovery-${lastRunId || randomUUID68()}`
|
|
486942
487155
|
};
|
|
486943
487156
|
writeWireMessage(recoveryMsg);
|
|
486944
487157
|
} else {
|
|
@@ -486955,7 +487168,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486955
487168
|
stop_reason: stopReason,
|
|
486956
487169
|
run_id: lastRunId ?? undefined,
|
|
486957
487170
|
session_id: sessionId,
|
|
486958
|
-
uuid: `error-${lastRunId ||
|
|
487171
|
+
uuid: `error-${lastRunId || randomUUID68()}`
|
|
486959
487172
|
};
|
|
486960
487173
|
await writeWireMessageAsync(errorMsg);
|
|
486961
487174
|
} else {
|
|
@@ -486997,7 +487210,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
486997
487210
|
const nudgeMessage = {
|
|
486998
487211
|
role: "user",
|
|
486999
487212
|
content: `<system-reminder>The previous response was empty. Please provide a response with either text content or a tool call.</system-reminder>`,
|
|
487000
|
-
otid:
|
|
487213
|
+
otid: randomUUID68()
|
|
487001
487214
|
};
|
|
487002
487215
|
currentInput = [...currentInput, nudgeMessage];
|
|
487003
487216
|
}
|
|
@@ -487010,7 +487223,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
487010
487223
|
delay_ms: delayMs,
|
|
487011
487224
|
run_id: lastRunId ?? undefined,
|
|
487012
487225
|
session_id: sessionId,
|
|
487013
|
-
uuid: `retry-empty-${lastRunId ||
|
|
487226
|
+
uuid: `retry-empty-${lastRunId || randomUUID68()}`
|
|
487014
487227
|
};
|
|
487015
487228
|
writeWireMessage(retryMsg);
|
|
487016
487229
|
} else {
|
|
@@ -487037,7 +487250,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
487037
487250
|
delay_ms: delayMs,
|
|
487038
487251
|
run_id: lastRunId ?? undefined,
|
|
487039
487252
|
session_id: sessionId,
|
|
487040
|
-
uuid: `retry-${lastRunId ||
|
|
487253
|
+
uuid: `retry-${lastRunId || randomUUID68()}`
|
|
487041
487254
|
};
|
|
487042
487255
|
writeWireMessage(retryMsg);
|
|
487043
487256
|
} else {
|
|
@@ -487067,7 +487280,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
487067
487280
|
delay_ms: delayMs,
|
|
487068
487281
|
run_id: lastRunId ?? undefined,
|
|
487069
487282
|
session_id: sessionId,
|
|
487070
|
-
uuid: `retry-${lastRunId ||
|
|
487283
|
+
uuid: `retry-${lastRunId || randomUUID68()}`
|
|
487071
487284
|
};
|
|
487072
487285
|
writeWireMessage(retryMsg);
|
|
487073
487286
|
} else {
|
|
@@ -487116,7 +487329,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
487116
487329
|
stop_reason: stopReason,
|
|
487117
487330
|
run_id: lastRunId ?? undefined,
|
|
487118
487331
|
session_id: sessionId,
|
|
487119
|
-
uuid: `error-${lastRunId ||
|
|
487332
|
+
uuid: `error-${lastRunId || randomUUID68()}`
|
|
487120
487333
|
};
|
|
487121
487334
|
await writeWireMessageAsync(errorMsg);
|
|
487122
487335
|
} else {
|
|
@@ -487125,7 +487338,7 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
487125
487338
|
await exitHeadless(1, "headless_stop_reason_error");
|
|
487126
487339
|
}
|
|
487127
487340
|
} catch (error4) {
|
|
487128
|
-
if (
|
|
487341
|
+
if (interruptSignal.aborted) {
|
|
487129
487342
|
await exitInterrupted();
|
|
487130
487343
|
}
|
|
487131
487344
|
markIncompleteToolsAsCancelled(buffers, true, "stream_error");
|
|
@@ -487138,14 +487351,18 @@ Current session AGENT_ID=${process.env.AGENT_ID}; --backend local switches to a
|
|
|
487138
487351
|
stop_reason: "error",
|
|
487139
487352
|
run_id: lastKnownRunId ?? undefined,
|
|
487140
487353
|
session_id: sessionId,
|
|
487141
|
-
uuid: `error-${lastKnownRunId ||
|
|
487354
|
+
uuid: `error-${lastKnownRunId || randomUUID68()}`
|
|
487142
487355
|
};
|
|
487143
487356
|
await writeWireMessageAsync(errorMsg);
|
|
487144
487357
|
} else {
|
|
487145
487358
|
console.error(`Error: ${errorDetails}`);
|
|
487146
487359
|
}
|
|
487147
487360
|
await exitHeadless(1, "headless_runtime_exception");
|
|
487361
|
+
} finally {
|
|
487362
|
+
dispose2();
|
|
487148
487363
|
}
|
|
487364
|
+
if (interruptSignal.aborted)
|
|
487365
|
+
await exitInterrupted();
|
|
487149
487366
|
await runPostTurnMemorySync({
|
|
487150
487367
|
conversationId,
|
|
487151
487368
|
agentId: agent.id,
|
|
@@ -487337,7 +487554,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
487337
487554
|
const approvalInput = {
|
|
487338
487555
|
type: "approval",
|
|
487339
487556
|
approvals: denialResults,
|
|
487340
|
-
otid:
|
|
487557
|
+
otid: randomUUID68()
|
|
487341
487558
|
};
|
|
487342
487559
|
const approvalMessages = [approvalInput];
|
|
487343
487560
|
{
|
|
@@ -487350,7 +487567,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
487350
487567
|
type: "text",
|
|
487351
487568
|
text: sc.content
|
|
487352
487569
|
})),
|
|
487353
|
-
otid:
|
|
487570
|
+
otid: randomUUID68()
|
|
487354
487571
|
});
|
|
487355
487572
|
}
|
|
487356
487573
|
}
|
|
@@ -487408,7 +487625,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
487408
487625
|
reason,
|
|
487409
487626
|
cleared_count: clearedCount,
|
|
487410
487627
|
session_id: sessionId,
|
|
487411
|
-
uuid: `q-clr-${
|
|
487628
|
+
uuid: `q-clr-${randomUUID68()}`
|
|
487412
487629
|
})
|
|
487413
487630
|
}
|
|
487414
487631
|
});
|
|
@@ -487438,7 +487655,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
487438
487655
|
reason: "runtime_busy",
|
|
487439
487656
|
queue_len: Math.max(1, queueLen),
|
|
487440
487657
|
session_id: sessionId,
|
|
487441
|
-
uuid: `q-blk-${
|
|
487658
|
+
uuid: `q-blk-${randomUUID68()}`
|
|
487442
487659
|
});
|
|
487443
487660
|
}
|
|
487444
487661
|
function enqueueForTracking(input) {
|
|
@@ -487503,7 +487720,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
487503
487720
|
request_id: interruptRequestId
|
|
487504
487721
|
},
|
|
487505
487722
|
session_id: sessionId,
|
|
487506
|
-
uuid:
|
|
487723
|
+
uuid: randomUUID68()
|
|
487507
487724
|
};
|
|
487508
487725
|
writeWireMessage(interruptResponse);
|
|
487509
487726
|
return;
|
|
@@ -487630,7 +487847,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
487630
487847
|
const approvalInput = {
|
|
487631
487848
|
type: "approval",
|
|
487632
487849
|
approvals: denialResults,
|
|
487633
|
-
otid:
|
|
487850
|
+
otid: randomUUID68()
|
|
487634
487851
|
};
|
|
487635
487852
|
const approvalStream = await sendScopedApprovalMessages({
|
|
487636
487853
|
agentId: agent.id,
|
|
@@ -487669,7 +487886,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
487669
487886
|
message: "Invalid JSON input",
|
|
487670
487887
|
stop_reason: "error",
|
|
487671
487888
|
session_id: sessionId,
|
|
487672
|
-
uuid:
|
|
487889
|
+
uuid: randomUUID68()
|
|
487673
487890
|
};
|
|
487674
487891
|
writeWireMessage(errorMsg2);
|
|
487675
487892
|
continue;
|
|
@@ -487695,7 +487912,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
487695
487912
|
}
|
|
487696
487913
|
},
|
|
487697
487914
|
session_id: sessionId,
|
|
487698
|
-
uuid:
|
|
487915
|
+
uuid: randomUUID68()
|
|
487699
487916
|
};
|
|
487700
487917
|
writeWireMessage(initResponse);
|
|
487701
487918
|
} else if (subtype === "interrupt") {
|
|
@@ -487712,7 +487929,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
487712
487929
|
request_id: requestId ?? ""
|
|
487713
487930
|
},
|
|
487714
487931
|
session_id: sessionId,
|
|
487715
|
-
uuid:
|
|
487932
|
+
uuid: randomUUID68()
|
|
487716
487933
|
};
|
|
487717
487934
|
writeWireMessage(interruptResponse);
|
|
487718
487935
|
} else if (subtype === "register_external_tools") {
|
|
@@ -487790,7 +488007,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
487790
488007
|
response: { registered: tools.length }
|
|
487791
488008
|
},
|
|
487792
488009
|
session_id: sessionId,
|
|
487793
|
-
uuid:
|
|
488010
|
+
uuid: randomUUID68()
|
|
487794
488011
|
};
|
|
487795
488012
|
writeWireMessage(registerResponse);
|
|
487796
488013
|
} else if (subtype === "bootstrap_session_state") {
|
|
@@ -487846,7 +488063,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
487846
488063
|
response: recovery
|
|
487847
488064
|
},
|
|
487848
488065
|
session_id: sessionId,
|
|
487849
|
-
uuid:
|
|
488066
|
+
uuid: randomUUID68()
|
|
487850
488067
|
};
|
|
487851
488068
|
writeWireMessage(recoveryResponse);
|
|
487852
488069
|
} catch (error4) {
|
|
@@ -487858,7 +488075,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
487858
488075
|
error: error4 instanceof Error ? error4.message : String(error4)
|
|
487859
488076
|
},
|
|
487860
488077
|
session_id: sessionId,
|
|
487861
|
-
uuid:
|
|
488078
|
+
uuid: randomUUID68()
|
|
487862
488079
|
};
|
|
487863
488080
|
writeWireMessage(recoveryError);
|
|
487864
488081
|
}
|
|
@@ -487871,7 +488088,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
487871
488088
|
error: `Unknown control request subtype: ${subtype}`
|
|
487872
488089
|
},
|
|
487873
488090
|
session_id: sessionId,
|
|
487874
|
-
uuid:
|
|
488091
|
+
uuid: randomUUID68()
|
|
487875
488092
|
};
|
|
487876
488093
|
writeWireMessage(errorResponse);
|
|
487877
488094
|
}
|
|
@@ -487926,7 +488143,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
487926
488143
|
try {
|
|
487927
488144
|
const buffers = createBuffers(agent.id);
|
|
487928
488145
|
const startTime = performance.now();
|
|
487929
|
-
const userOtid =
|
|
488146
|
+
const userOtid = randomUUID68();
|
|
487930
488147
|
const userTranscriptText = extractTelemetryInputText(userContent);
|
|
487931
488148
|
if (userTranscriptText.length > 0) {
|
|
487932
488149
|
const userLineId = `user-${userOtid}`;
|
|
@@ -487992,7 +488209,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
487992
488209
|
currentInput.unshift({
|
|
487993
488210
|
role: "user",
|
|
487994
488211
|
content: INTERRUPT_RECOVERY_ALERT,
|
|
487995
|
-
otid:
|
|
488212
|
+
otid: randomUUID68()
|
|
487996
488213
|
});
|
|
487997
488214
|
try {
|
|
487998
488215
|
await resolveAllPendingApprovals();
|
|
@@ -488055,7 +488272,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
488055
488272
|
recovery_type: "approval_pending",
|
|
488056
488273
|
message: "Detected pending approval conflict on send; resolving before retry",
|
|
488057
488274
|
session_id: sessionId,
|
|
488058
|
-
uuid: `recovery-bidir-${
|
|
488275
|
+
uuid: `recovery-bidir-${randomUUID68()}`
|
|
488059
488276
|
};
|
|
488060
488277
|
writeWireMessage(recoveryMsg);
|
|
488061
488278
|
await resolveAllPendingApprovals();
|
|
@@ -488078,7 +488295,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
488078
488295
|
max_attempts: LLM_API_ERROR_MAX_RETRIES2,
|
|
488079
488296
|
delay_ms: delayMs,
|
|
488080
488297
|
session_id: sessionId,
|
|
488081
|
-
uuid: `retry-bidir-${
|
|
488298
|
+
uuid: `retry-bidir-${randomUUID68()}`
|
|
488082
488299
|
};
|
|
488083
488300
|
writeWireMessage(retryMsg);
|
|
488084
488301
|
await new Promise((resolve42) => setTimeout(resolve42, delayMs));
|
|
@@ -488100,7 +488317,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
488100
488317
|
stop_reason: "error",
|
|
488101
488318
|
run_id: errorInfo.run_id,
|
|
488102
488319
|
session_id: sessionId,
|
|
488103
|
-
uuid:
|
|
488320
|
+
uuid: randomUUID68(),
|
|
488104
488321
|
...errorInfo.error_type && errorInfo.run_id && {
|
|
488105
488322
|
api_error: {
|
|
488106
488323
|
message_type: "error_message",
|
|
@@ -488128,7 +488345,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
488128
488345
|
type: "stream_event",
|
|
488129
488346
|
event: chunk2,
|
|
488130
488347
|
session_id: sessionId,
|
|
488131
|
-
uuid: uuid5 ||
|
|
488348
|
+
uuid: uuid5 || randomUUID68()
|
|
488132
488349
|
};
|
|
488133
488350
|
writeWireMessage(streamEvent);
|
|
488134
488351
|
} else {
|
|
@@ -488136,7 +488353,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
488136
488353
|
type: "message",
|
|
488137
488354
|
...chunk2,
|
|
488138
488355
|
session_id: sessionId,
|
|
488139
|
-
uuid: uuid5 ||
|
|
488356
|
+
uuid: uuid5 || randomUUID68()
|
|
488140
488357
|
};
|
|
488141
488358
|
writeWireMessage(msg);
|
|
488142
488359
|
}
|
|
@@ -488273,7 +488490,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
488273
488490
|
message: errorDetails,
|
|
488274
488491
|
stop_reason: "error",
|
|
488275
488492
|
session_id: sessionId,
|
|
488276
|
-
uuid:
|
|
488493
|
+
uuid: randomUUID68()
|
|
488277
488494
|
};
|
|
488278
488495
|
writeWireMessage(errorMsg2);
|
|
488279
488496
|
const errorResultMsg = {
|
|
@@ -488311,7 +488528,7 @@ async function runBidirectionalMode(agent, conversationId, effectiveModel, _outp
|
|
|
488311
488528
|
message: `Unknown message type: ${message2.type}`,
|
|
488312
488529
|
stop_reason: "error",
|
|
488313
488530
|
session_id: sessionId,
|
|
488314
|
-
uuid:
|
|
488531
|
+
uuid: randomUUID68()
|
|
488315
488532
|
};
|
|
488316
488533
|
writeWireMessage(errorMsg);
|
|
488317
488534
|
}
|
|
@@ -488325,6 +488542,7 @@ var init_headless = __esm(() => {
|
|
|
488325
488542
|
init_subagent_launcher();
|
|
488326
488543
|
init_paths();
|
|
488327
488544
|
init_constants2();
|
|
488545
|
+
init_headless_interrupt();
|
|
488328
488546
|
init_headless_message_sender();
|
|
488329
488547
|
init_headless_response_state();
|
|
488330
488548
|
init_headless_startup_backend();
|
|
@@ -489800,7 +490018,7 @@ var init_reflection_arena_hf_upload = __esm(() => {
|
|
|
489800
490018
|
|
|
489801
490019
|
// src/cli/helpers/reflection-arena.ts
|
|
489802
490020
|
import { execFile as execFileCb5 } from "node:child_process";
|
|
489803
|
-
import { randomInt as randomInt2, randomUUID as
|
|
490021
|
+
import { randomInt as randomInt2, randomUUID as randomUUID69 } from "node:crypto";
|
|
489804
490022
|
import { appendFile as appendFile4, mkdir as mkdir20, readFile as readFile34, writeFile as writeFile22 } from "node:fs/promises";
|
|
489805
490023
|
import { join as join119 } from "node:path";
|
|
489806
490024
|
import { promisify as promisify21 } from "node:util";
|
|
@@ -490142,7 +490360,7 @@ async function startReflectionArenaRun(options) {
|
|
|
490142
490360
|
}
|
|
490143
490361
|
let releaseReservation = true;
|
|
490144
490362
|
try {
|
|
490145
|
-
const runId =
|
|
490363
|
+
const runId = randomUUID69().slice(0, 8);
|
|
490146
490364
|
const labels = shuffledLabels();
|
|
490147
490365
|
const prepared = await Promise.all([
|
|
490148
490366
|
prepareReflectionMemoryWorktreeLaunch({
|
|
@@ -506969,18 +507187,18 @@ async function collectMemoryData(agentId, repoDir, memoryRoot, conversationId) {
|
|
|
506969
507187
|
${m4.body}` : m4.subject;
|
|
506970
507188
|
const stats = statsMap.get(m4.hash) ?? "";
|
|
506971
507189
|
let diff2 = diffsMap.get(m4.hash);
|
|
506972
|
-
let
|
|
507190
|
+
let truncated2 = false;
|
|
506973
507191
|
if (diff2 !== undefined) {
|
|
506974
507192
|
if (diff2.length > PER_DIFF_CAP) {
|
|
506975
507193
|
diff2 = `${diff2.slice(0, PER_DIFF_CAP)}
|
|
506976
507194
|
|
|
506977
507195
|
[diff truncated - exceeded ${Math.round(PER_DIFF_CAP / 1024)}KB]`;
|
|
506978
|
-
|
|
507196
|
+
truncated2 = true;
|
|
506979
507197
|
}
|
|
506980
507198
|
cumulativeSize += diff2.length;
|
|
506981
507199
|
if (cumulativeSize > TOTAL_PAYLOAD_CAP) {
|
|
506982
507200
|
diff2 = undefined;
|
|
506983
|
-
|
|
507201
|
+
truncated2 = true;
|
|
506984
507202
|
}
|
|
506985
507203
|
}
|
|
506986
507204
|
return {
|
|
@@ -506991,7 +507209,7 @@ ${m4.body}` : m4.subject;
|
|
|
506991
507209
|
message: message2,
|
|
506992
507210
|
stats,
|
|
506993
507211
|
diff: diff2,
|
|
506994
|
-
truncated,
|
|
507212
|
+
truncated: truncated2,
|
|
506995
507213
|
isReflection: REFLECTION_PATTERN.test(m4.subject)
|
|
506996
507214
|
};
|
|
506997
507215
|
});
|
|
@@ -509747,7 +509965,7 @@ var init_provider_selector_helpers = __esm(() => {
|
|
|
509747
509965
|
});
|
|
509748
509966
|
|
|
509749
509967
|
// src/cli/hooks/use-chatgpt-rate-limit-state.ts
|
|
509750
|
-
import { randomUUID as
|
|
509968
|
+
import { randomUUID as randomUUID70 } from "node:crypto";
|
|
509751
509969
|
function errorMessage8(error4, fallback) {
|
|
509752
509970
|
return error4 instanceof Error ? error4.message : fallback;
|
|
509753
509971
|
}
|
|
@@ -509844,7 +510062,7 @@ function useChatGPTRateLimitState(target) {
|
|
|
509844
510062
|
target,
|
|
509845
510063
|
providerName,
|
|
509846
510064
|
resetId,
|
|
509847
|
-
idempotencyKey:
|
|
510065
|
+
idempotencyKey: randomUUID70()
|
|
509848
510066
|
});
|
|
509849
510067
|
if (!result3.success) {
|
|
509850
510068
|
return { notice: { tone: "warning", message: result3.error.message } };
|
|
@@ -515931,12 +516149,12 @@ var init_ExitStats = __esm(async () => {
|
|
|
515931
516149
|
});
|
|
515932
516150
|
|
|
515933
516151
|
// src/cli/app/ids.ts
|
|
515934
|
-
import { randomUUID as
|
|
516152
|
+
import { randomUUID as randomUUID71 } from "node:crypto";
|
|
515935
516153
|
function uid(prefix) {
|
|
515936
516154
|
return `${prefix}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
515937
516155
|
}
|
|
515938
516156
|
function createClientOtid() {
|
|
515939
|
-
return
|
|
516157
|
+
return randomUUID71();
|
|
515940
516158
|
}
|
|
515941
516159
|
function appendOptimisticUserLine(buffers, text3, otid) {
|
|
515942
516160
|
if (!text3) {
|
|
@@ -519414,7 +519632,7 @@ var init_turn_input = __esm(() => {
|
|
|
519414
519632
|
});
|
|
519415
519633
|
|
|
519416
519634
|
// src/cli/app/use-approval-flow.ts
|
|
519417
|
-
import { randomUUID as
|
|
519635
|
+
import { randomUUID as randomUUID72 } from "node:crypto";
|
|
519418
519636
|
function useApprovalFlow(ctx) {
|
|
519419
519637
|
const {
|
|
519420
519638
|
abortControllerRef,
|
|
@@ -519920,7 +520138,7 @@ function useApprovalFlow(ctx) {
|
|
|
519920
520138
|
{
|
|
519921
520139
|
type: "approval",
|
|
519922
520140
|
approvals: allResults,
|
|
519923
|
-
otid:
|
|
520141
|
+
otid: randomUUID72()
|
|
519924
520142
|
}
|
|
519925
520143
|
]);
|
|
519926
520144
|
} catch (error4) {
|
|
@@ -521304,7 +521522,7 @@ var init_system_reminders2 = __esm(() => {
|
|
|
521304
521522
|
});
|
|
521305
521523
|
|
|
521306
521524
|
// src/cli/app/use-conversation-loop.ts
|
|
521307
|
-
import { randomUUID as
|
|
521525
|
+
import { randomUUID as randomUUID73 } from "node:crypto";
|
|
521308
521526
|
function sleep13(ms) {
|
|
521309
521527
|
return new Promise((resolve44) => setTimeout(resolve44, ms));
|
|
521310
521528
|
}
|
|
@@ -521614,16 +521832,16 @@ function useConversationLoop(ctx) {
|
|
|
521614
521832
|
currentInput = [
|
|
521615
521833
|
...lastSentInputRef.current.map((m4) => ({
|
|
521616
521834
|
...m4,
|
|
521617
|
-
otid:
|
|
521835
|
+
otid: randomUUID73()
|
|
521618
521836
|
})),
|
|
521619
521837
|
...currentInput.map((m4) => m4.type === "message" && m4.role === "user" ? {
|
|
521620
521838
|
...m4,
|
|
521621
|
-
otid:
|
|
521839
|
+
otid: randomUUID73(),
|
|
521622
521840
|
content: [
|
|
521623
521841
|
{ type: "text", text: INTERRUPT_RECOVERY_ALERT },
|
|
521624
521842
|
...typeof m4.content === "string" ? [{ type: "text", text: m4.content }] : Array.isArray(m4.content) ? m4.content : []
|
|
521625
521843
|
]
|
|
521626
|
-
} : { ...m4, otid:
|
|
521844
|
+
} : { ...m4, otid: randomUUID73() })
|
|
521627
521845
|
];
|
|
521628
521846
|
pendingInterruptRecoveryConversationIdRef.current = null;
|
|
521629
521847
|
lastSentInputRef.current = [
|
|
@@ -521662,7 +521880,7 @@ function useConversationLoop(ctx) {
|
|
|
521662
521880
|
type: "text",
|
|
521663
521881
|
text: sc.content
|
|
521664
521882
|
})),
|
|
521665
|
-
otid:
|
|
521883
|
+
otid: randomUUID73()
|
|
521666
521884
|
}
|
|
521667
521885
|
];
|
|
521668
521886
|
}
|
|
@@ -522017,7 +522235,7 @@ ${feedback}
|
|
|
522017
522235
|
});
|
|
522018
522236
|
buffersRef.current.order.push(statusId);
|
|
522019
522237
|
refreshDerived();
|
|
522020
|
-
const hookMessageOtid =
|
|
522238
|
+
const hookMessageOtid = randomUUID73();
|
|
522021
522239
|
setTimeout(() => {
|
|
522022
522240
|
processConversation([
|
|
522023
522241
|
{
|
|
@@ -522044,7 +522262,7 @@ ${feedback}
|
|
|
522044
522262
|
turnEndContinue = undefined;
|
|
522045
522263
|
}
|
|
522046
522264
|
if (turnEndContinue) {
|
|
522047
|
-
const continueOtid =
|
|
522265
|
+
const continueOtid = randomUUID73();
|
|
522048
522266
|
setTimeout(() => {
|
|
522049
522267
|
processConversation([
|
|
522050
522268
|
{
|
|
@@ -522374,7 +522592,7 @@ ${feedback}
|
|
|
522374
522592
|
{
|
|
522375
522593
|
type: "approval",
|
|
522376
522594
|
approvals: allResults,
|
|
522377
|
-
otid:
|
|
522595
|
+
otid: randomUUID73()
|
|
522378
522596
|
}
|
|
522379
522597
|
], {
|
|
522380
522598
|
allowReentry: true,
|
|
@@ -522549,7 +522767,7 @@ ${feedback}
|
|
|
522549
522767
|
type: "message",
|
|
522550
522768
|
role: "user",
|
|
522551
522769
|
content: `<system-reminder>The previous response was empty. Please provide a response with either text content or a tool call.</system-reminder>`,
|
|
522552
|
-
otid:
|
|
522770
|
+
otid: randomUUID73()
|
|
522553
522771
|
}
|
|
522554
522772
|
];
|
|
522555
522773
|
}
|
|
@@ -522832,7 +523050,7 @@ var init_use_conversation_loop = __esm(() => {
|
|
|
522832
523050
|
});
|
|
522833
523051
|
|
|
522834
523052
|
// src/cli/app/use-conversation-switching.ts
|
|
522835
|
-
import { randomUUID as
|
|
523053
|
+
import { randomUUID as randomUUID74 } from "node:crypto";
|
|
522836
523054
|
function useConversationSwitching(ctx) {
|
|
522837
523055
|
const {
|
|
522838
523056
|
abortControllerRef,
|
|
@@ -522907,7 +523125,7 @@ function useConversationSwitching(ctx) {
|
|
|
522907
523125
|
{
|
|
522908
523126
|
role: "user",
|
|
522909
523127
|
content: question,
|
|
522910
|
-
otid:
|
|
523128
|
+
otid: randomUUID74()
|
|
522911
523129
|
}
|
|
522912
523130
|
];
|
|
522913
523131
|
let approvalRecoveryRetries = 0;
|
|
@@ -528378,7 +528596,7 @@ var init_conversation_switch_alert = __esm(() => {
|
|
|
528378
528596
|
});
|
|
528379
528597
|
|
|
528380
528598
|
// src/cli/app/use-submit-handler.ts
|
|
528381
|
-
import { randomUUID as
|
|
528599
|
+
import { randomUUID as randomUUID75 } from "node:crypto";
|
|
528382
528600
|
import { existsSync as existsSync82, readFileSync as readFileSync62, renameSync as renameSync14 } from "node:fs";
|
|
528383
528601
|
import { tmpdir as tmpdir18 } from "node:os";
|
|
528384
528602
|
import { join as join129 } from "node:path";
|
|
@@ -528712,7 +528930,7 @@ ${SYSTEM_REMINDER_CLOSE}` : "";
|
|
|
528712
528930
|
content: buildTextParts(`${SYSTEM_REMINDER_OPEN}
|
|
528713
528931
|
${prompt}
|
|
528714
528932
|
${SYSTEM_REMINDER_CLOSE}`),
|
|
528715
|
-
otid:
|
|
528933
|
+
otid: randomUUID75()
|
|
528716
528934
|
}
|
|
528717
528935
|
]);
|
|
528718
528936
|
} catch (error4) {
|
|
@@ -528776,7 +528994,7 @@ ${SYSTEM_REMINDER_CLOSE}`),
|
|
|
528776
528994
|
type: "message",
|
|
528777
528995
|
role: "user",
|
|
528778
528996
|
content: buildTextParts(buildModCommandPrompt(result4)),
|
|
528779
|
-
otid:
|
|
528997
|
+
otid: randomUUID75()
|
|
528780
528998
|
}
|
|
528781
528999
|
]);
|
|
528782
529000
|
} else if (result4.type === "output") {
|
|
@@ -528821,7 +529039,7 @@ ${SYSTEM_REMINDER_CLOSE}`),
|
|
|
528821
529039
|
${SYSTEM_REMINDER_OPEN}
|
|
528822
529040
|
${request5}
|
|
528823
529041
|
${SYSTEM_REMINDER_CLOSE}`),
|
|
528824
|
-
otid:
|
|
529042
|
+
otid: randomUUID75()
|
|
528825
529043
|
}
|
|
528826
529044
|
]);
|
|
528827
529045
|
} catch (error4) {
|
|
@@ -529090,7 +529308,7 @@ ${SYSTEM_REMINDER_CLOSE}`),
|
|
|
529090
529308
|
${SYSTEM_REMINDER_OPEN}
|
|
529091
529309
|
${request5}
|
|
529092
529310
|
${SYSTEM_REMINDER_CLOSE}`),
|
|
529093
|
-
otid:
|
|
529311
|
+
otid: randomUUID75()
|
|
529094
529312
|
}
|
|
529095
529313
|
]);
|
|
529096
529314
|
} catch (error4) {
|
|
@@ -529899,7 +530117,7 @@ ${SYSTEM_REMINDER_CLOSE}`;
|
|
|
529899
530117
|
type: "message",
|
|
529900
530118
|
role: "user",
|
|
529901
530119
|
content: buildTextParts(skillMessage),
|
|
529902
|
-
otid:
|
|
530120
|
+
otid: randomUUID75()
|
|
529903
530121
|
}
|
|
529904
530122
|
]);
|
|
529905
530123
|
} catch (error4) {
|
|
@@ -530321,7 +530539,7 @@ Resumed reflection arena choice prompt for run ${run2.runId}.`, true);
|
|
|
530321
530539
|
type: "message",
|
|
530322
530540
|
role: "user",
|
|
530323
530541
|
content: buildTextParts(initMessage),
|
|
530324
|
-
otid:
|
|
530542
|
+
otid: randomUUID75()
|
|
530325
530543
|
}
|
|
530326
530544
|
]);
|
|
530327
530545
|
} catch (error4) {
|
|
@@ -530354,7 +530572,7 @@ Resumed reflection arena choice prompt for run ${run2.runId}.`, true);
|
|
|
530354
530572
|
type: "message",
|
|
530355
530573
|
role: "user",
|
|
530356
530574
|
content: buildTextParts(doctorMessage),
|
|
530357
|
-
otid:
|
|
530575
|
+
otid: randomUUID75()
|
|
530358
530576
|
}
|
|
530359
530577
|
]);
|
|
530360
530578
|
} catch (error4) {
|
|
@@ -530486,7 +530704,7 @@ Resumed reflection arena choice prompt for run ${run2.runId}.`, true);
|
|
|
530486
530704
|
type: "message",
|
|
530487
530705
|
role: "user",
|
|
530488
530706
|
content: buildTextParts(wrapSkillPrompt2(matchedSkill.id, skillContent, userRequest)),
|
|
530489
|
-
otid:
|
|
530707
|
+
otid: randomUUID75()
|
|
530490
530708
|
}
|
|
530491
530709
|
]);
|
|
530492
530710
|
} catch (error4) {
|
|
@@ -538239,4 +538457,4 @@ function registerBunOAuthFlows() {
|
|
|
538239
538457
|
registerBunOAuthFlows();
|
|
538240
538458
|
await init_src5().then(() => exports_src2);
|
|
538241
538459
|
|
|
538242
|
-
//# debugId=
|
|
538460
|
+
//# debugId=E87600B54B3190EE64756E2164756E21
|