@1agents/acp-service 0.10.12 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/acp-connection.js +33 -0
- package/dist/src/bridge.js +44 -1
- package/dist/src/capacity-queue.d.ts +3 -1
- package/dist/src/capacity-queue.js +4 -0
- package/dist/src/catalog.js +13 -3
- package/package.json +4 -4
- package/skills/acp-service/SKILL.md +1 -1
- package/vendor/dsh/adapter.d.ts +6 -0
- package/vendor/dsh/adapter.js +23 -0
- package/vendor/dsh/index.js +19 -0
- package/vendor/runtime/README.md +36 -11
- package/vendor/runtime/dist/{agent-registry-DxcyXXqb.js → agent-registry-CsdsVpJb.js} +209 -177
- package/vendor/runtime/dist/agent-registry-CsdsVpJb.js.map +1 -0
- package/vendor/runtime/dist/agent-registry.d.ts +0 -2
- package/vendor/runtime/dist/agent-registry.d.ts.map +1 -1
- package/vendor/runtime/dist/agent-registry.js +1 -1
- package/vendor/runtime/dist/{cli-BKmMxgix.js → cli-B5gQOSDl.js} +33 -14
- package/vendor/runtime/dist/cli-B5gQOSDl.js.map +1 -0
- package/vendor/runtime/dist/cli.d.ts +2 -6
- package/vendor/runtime/dist/cli.d.ts.map +1 -1
- package/vendor/runtime/dist/cli.js +189 -164
- package/vendor/runtime/dist/cli.js.map +1 -1
- package/vendor/runtime/dist/{client-C5zneoBs.d.ts → client-D5y4RXME.d.ts} +4 -12
- package/vendor/runtime/dist/client-D5y4RXME.d.ts.map +1 -0
- package/vendor/runtime/dist/docs-site/CLI.html +19 -21
- package/vendor/runtime/dist/docs-site/VISION.html +3 -2
- package/vendor/runtime/dist/docs-site/agents.html +10 -15
- package/vendor/runtime/dist/docs-site/assets/agents/Apache-2.0.txt +202 -0
- package/vendor/runtime/dist/docs-site/assets/agents/LobeHub-MIT.txt +21 -0
- package/vendor/runtime/dist/docs-site/assets/agents/Mux-AGPL-3.0.txt +661 -0
- package/vendor/runtime/dist/docs-site/assets/agents/README.md +41 -0
- package/vendor/runtime/dist/docs-site/assets/agents/ante.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/antigravity.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/claude.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/codex.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/copilot.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/cursor.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/deepseek-harness.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/devin.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/droid.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/fast-agent.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/fx.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/gemini.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/goose.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/grok-build.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/iflow.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/junie.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/kilocode.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/kimi.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/kiro.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/mcode.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/mux.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/octomind.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/openclaw.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/opencode.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/pi.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/pool.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/qoder.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/qwen.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/trae.png +0 -0
- package/vendor/runtime/dist/docs-site/assets/agents/zeroclaw.png +0 -0
- package/vendor/runtime/dist/docs-site/compare.html +8 -7
- package/vendor/runtime/dist/docs-site/config.html +5 -4
- package/vendor/runtime/dist/docs-site/custom-agents.html +13 -13
- package/vendor/runtime/dist/docs-site/exit-codes.html +4 -3
- package/vendor/runtime/dist/docs-site/flows.html +21 -8
- package/vendor/runtime/dist/docs-site/index.html +7 -6
- package/vendor/runtime/dist/docs-site/install.html +7 -6
- package/vendor/runtime/dist/docs-site/llms.txt +6 -6
- package/vendor/runtime/dist/docs-site/output-formats.html +9 -8
- package/vendor/runtime/dist/docs-site/permissions.html +5 -4
- package/vendor/runtime/dist/docs-site/prompting.html +9 -7
- package/vendor/runtime/dist/docs-site/quickstart.html +5 -4
- package/vendor/runtime/dist/docs-site/releasing.html +9 -8
- package/vendor/runtime/dist/docs-site/runtime-environment.html +28 -5
- package/vendor/runtime/dist/docs-site/runtime-process-lifecycle.html +13 -7
- package/vendor/runtime/dist/docs-site/safe-errors.html +3 -2
- package/vendor/runtime/dist/docs-site/session-control.html +7 -6
- package/vendor/runtime/dist/docs-site/session-watch.html +6 -5
- package/vendor/runtime/dist/docs-site/sessions.html +13 -10
- package/vendor/runtime/dist/docs-site/shared-sessions.html +7 -4
- package/vendor/runtime/dist/{flows-VrII9VKZ.js → flows-CDj5YcTh.js} +136 -68
- package/vendor/runtime/dist/flows-CDj5YcTh.js.map +1 -0
- package/vendor/runtime/dist/flows.d.ts +28 -19
- package/vendor/runtime/dist/flows.d.ts.map +1 -1
- package/vendor/runtime/dist/flows.js +1 -1
- package/vendor/runtime/dist/{invocation-options-DHMZ5Rrb.js → input-file-BsfVGZgn.js} +30 -15
- package/vendor/runtime/dist/input-file-BsfVGZgn.js.map +1 -0
- package/vendor/runtime/dist/{ipc-CNNM5DP_.js → ipc-DfqJsbk6.js} +114 -146
- package/vendor/runtime/dist/ipc-DfqJsbk6.js.map +1 -0
- package/vendor/runtime/dist/{output-DtzXtiBc.js → output-DOIF4iFc.js} +20 -47
- package/vendor/runtime/dist/output-DOIF4iFc.js.map +1 -0
- package/vendor/runtime/dist/{queue-owner-runtime-ehuh3SQU.js → queue-owner-runtime-DHBQbjXo.js} +394 -258
- package/vendor/runtime/dist/queue-owner-runtime-DHBQbjXo.js.map +1 -0
- package/vendor/runtime/dist/runtime.d.ts +37 -36
- package/vendor/runtime/dist/runtime.d.ts.map +1 -1
- package/vendor/runtime/dist/runtime.js +117 -172
- package/vendor/runtime/dist/runtime.js.map +1 -1
- package/vendor/runtime/dist/{session-options-NjpFwf-c.d.ts → session-options-Ci4aw1oD.d.ts} +13 -16
- package/vendor/runtime/dist/session-options-Ci4aw1oD.d.ts.map +1 -0
- package/vendor/runtime/dist/{session-watch-CbKfGRkZ.js → session-watch-DRwFHcWw.js} +5 -6
- package/vendor/runtime/dist/{session-watch-CbKfGRkZ.js.map → session-watch-DRwFHcWw.js.map} +1 -1
- package/vendor/runtime/dist/{watch-BGt4kcE6.js → watch-CUDGkljG.js} +3 -4
- package/vendor/runtime/dist/{watch-BGt4kcE6.js.map → watch-CUDGkljG.js.map} +1 -1
- package/vendor/runtime/package.json +3 -3
- package/vendor/runtime/skills/acpx/SKILL.md +42 -11
- package/vendor/runtime/dist/agent-registry-DxcyXXqb.js.map +0 -1
- package/vendor/runtime/dist/cli-BKmMxgix.js.map +0 -1
- package/vendor/runtime/dist/client-C5zneoBs.d.ts.map +0 -1
- package/vendor/runtime/dist/flows-VrII9VKZ.js.map +0 -1
- package/vendor/runtime/dist/invocation-options-DHMZ5Rrb.js.map +0 -1
- package/vendor/runtime/dist/ipc-CNNM5DP_.js.map +0 -1
- package/vendor/runtime/dist/output-DtzXtiBc.js.map +0 -1
- package/vendor/runtime/dist/queue-owner-runtime-ehuh3SQU.js.map +0 -1
- package/vendor/runtime/dist/session-options-NjpFwf-c.d.ts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as runTimedExecFile, F as readWindowsEnvValue, I as resolveInstalledExecutable, O as splitCommandLine, _ as PROCESS_HELPER_TIMEOUT_MS, b as isChildProcessRunning, g as PROCESS_HELPER_MAX_BUFFER_BYTES, n as AGENT_REGISTRY, r as BUILT_IN_AGENT_PACKAGES, t as AGENT_ARGV_REGISTRY } from "./agent-registry-CsdsVpJb.js";
|
|
2
2
|
import fs, { statSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import fs$1 from "node:fs/promises";
|
|
@@ -12,7 +12,18 @@ import { isHardlinkFallbackError } from "@openclaw/fs-safe/durability";
|
|
|
12
12
|
import { acquireFileLock } from "@openclaw/fs-safe/file-lock";
|
|
13
13
|
import net from "node:net";
|
|
14
14
|
import { resolveSecureTempRoot } from "@openclaw/fs-safe/secure-temp-root";
|
|
15
|
-
|
|
15
|
+
// \0rolldown/runtime.js
|
|
16
|
+
var __defProp = Object.defineProperty;
|
|
17
|
+
var __exportAll = (all, flags) => {
|
|
18
|
+
let target = Object.setPrototypeOf({}, null);
|
|
19
|
+
for (var name in all) __defProp(target, name, {
|
|
20
|
+
get: all[name],
|
|
21
|
+
enumerable: true
|
|
22
|
+
});
|
|
23
|
+
if (!(flags & 1)) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
24
|
+
return flags & 2 ? target : Object.preventExtensions(target);
|
|
25
|
+
};
|
|
26
|
+
// src/errors.ts
|
|
16
27
|
function agentStartupMessage(params) {
|
|
17
28
|
const exitSummary = `exit=${params.exitCode ?? "null"}, signal=${params.signal ?? "null"}`;
|
|
18
29
|
const stderrSuffix = typeof params.stderrSummary === "string" && params.stderrSummary.trim().length > 0 ? `: ${params.stderrSummary.trim()}` : "";
|
|
@@ -46,11 +57,42 @@ var SessionNotFoundError = class extends AcpxOperationalError {
|
|
|
46
57
|
}
|
|
47
58
|
};
|
|
48
59
|
var SessionResolutionError = class extends AcpxOperationalError {};
|
|
60
|
+
/** Best-effort description of which launch path was missing when spawn failed with ENOENT. */
|
|
61
|
+
function spawnEnoentHint(context) {
|
|
62
|
+
try {
|
|
63
|
+
if (!fs.statSync(context.cwd, { throwIfNoEntry: false })?.isDirectory()) return `Working directory is unavailable: ${context.cwd}. `;
|
|
64
|
+
if (resolveInstalledExecutable(context.command, context)) return "";
|
|
65
|
+
if (path.parse(context.command).dir.length > 0) return `Executable path could not be resolved: ${path.resolve(context.cwd, context.command)}. `;
|
|
66
|
+
return (process.platform === "win32" ? readWindowsEnvValue(context.env, "PATH") : context.env.PATH) === void 0 ? "" : `No runnable executable named ${JSON.stringify(context.command)} was found on the child PATH. `;
|
|
67
|
+
} catch {
|
|
68
|
+
return "";
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Prefixes a spawn ENOENT with the launch path that was missing.
|
|
73
|
+
* Other errors pass through unchanged.
|
|
74
|
+
*/
|
|
75
|
+
function describeSpawnEnoent(error, prefix, context) {
|
|
76
|
+
const spawnError = error;
|
|
77
|
+
if (!(error instanceof Error) || spawnError.code !== "ENOENT" || !spawnError.syscall?.startsWith("spawn")) return error;
|
|
78
|
+
const hint = spawnEnoentHint({
|
|
79
|
+
...context,
|
|
80
|
+
command: spawnError.path ?? context.command
|
|
81
|
+
});
|
|
82
|
+
const described = new Error(`${prefix}${hint}${error.message}`, { cause: error });
|
|
83
|
+
return Object.assign(described, {
|
|
84
|
+
code: spawnError.code,
|
|
85
|
+
errno: spawnError.errno,
|
|
86
|
+
syscall: spawnError.syscall,
|
|
87
|
+
path: spawnError.path
|
|
88
|
+
});
|
|
89
|
+
}
|
|
49
90
|
var AgentSpawnError = class extends AcpxOperationalError {
|
|
50
91
|
agentCommand;
|
|
51
|
-
constructor(agentCommand, cause) {
|
|
92
|
+
constructor(agentCommand, cause, context) {
|
|
52
93
|
const spawnEnoent = (cause instanceof Error ? cause.code : void 0) === "ENOENT";
|
|
53
|
-
const
|
|
94
|
+
const hint = spawnEnoent && context ? spawnEnoentHint(context) : "";
|
|
95
|
+
const message = spawnEnoent ? `Failed to spawn agent command: ${agentCommand}. ${hint}The agent process could not start because a required executable, interpreter, working directory, or other launch path was not found. Check the command, effective PATH, and working directory, or verify the custom agent's configured argv.` : `Failed to spawn agent command: ${agentCommand}`;
|
|
54
96
|
super(message, {
|
|
55
97
|
cause: cause instanceof Error ? cause : void 0,
|
|
56
98
|
...spawnEnoent ? { detailCode: "AGENT_SPAWN_ENOENT" } : {}
|
|
@@ -190,8 +232,7 @@ var PermissionPromptUnavailableError = class extends AcpxOperationalError {
|
|
|
190
232
|
super(message);
|
|
191
233
|
}
|
|
192
234
|
};
|
|
193
|
-
|
|
194
|
-
//#region src/runtime/public/errors.ts
|
|
235
|
+
// src/runtime/public/errors.ts
|
|
195
236
|
var AcpRuntimeError = class extends Error {
|
|
196
237
|
code;
|
|
197
238
|
cause;
|
|
@@ -205,8 +246,7 @@ var AcpRuntimeError = class extends Error {
|
|
|
205
246
|
function isAcpRuntimeError(value) {
|
|
206
247
|
return value instanceof AcpRuntimeError;
|
|
207
248
|
}
|
|
208
|
-
|
|
209
|
-
//#region src/types.ts
|
|
249
|
+
// src/types.ts
|
|
210
250
|
const EXIT_CODES = {
|
|
211
251
|
SUCCESS: 0,
|
|
212
252
|
ERROR: 1,
|
|
@@ -266,8 +306,7 @@ const QUEUE_ERROR_DETAIL_CODES = [
|
|
|
266
306
|
"QUEUE_RUNTIME_PROMPT_FAILED"
|
|
267
307
|
];
|
|
268
308
|
const SESSION_RECORD_SCHEMA = "acpx.session.v1";
|
|
269
|
-
|
|
270
|
-
//#region src/acp/error-shapes.ts
|
|
309
|
+
// src/acp/error-shapes.ts
|
|
271
310
|
const RESOURCE_NOT_FOUND_ACP_CODES = /* @__PURE__ */ new Set([-32001, -32002]);
|
|
272
311
|
function asRecord$5(value) {
|
|
273
312
|
if (!value || typeof value !== "object" || Array.isArray(value)) return;
|
|
@@ -339,10 +378,8 @@ function isAcpResourceNotFoundError(error) {
|
|
|
339
378
|
}
|
|
340
379
|
return isSessionNotFoundText(formatUnknownErrorMessage(error));
|
|
341
380
|
}
|
|
342
|
-
|
|
343
|
-
//#region src/acp/error-normalization.ts
|
|
381
|
+
// src/acp/error-normalization.ts
|
|
344
382
|
const AUTH_REQUIRED_ACP_CODES = /* @__PURE__ */ new Set([-32e3]);
|
|
345
|
-
const QUERY_CLOSED_BEFORE_RESPONSE_DETAIL = "query closed before response received";
|
|
346
383
|
function asRecord$4(value) {
|
|
347
384
|
if (!value || typeof value !== "object" || Array.isArray(value)) return;
|
|
348
385
|
return value;
|
|
@@ -410,13 +447,6 @@ function isUsageLike(error) {
|
|
|
410
447
|
function formatErrorMessage(error) {
|
|
411
448
|
return formatUnknownErrorMessage(error);
|
|
412
449
|
}
|
|
413
|
-
function isAcpQueryClosedBeforeResponseError(error) {
|
|
414
|
-
const acp = extractAcpError(error);
|
|
415
|
-
if (!acp || acp.code !== -32603) return false;
|
|
416
|
-
const details = asRecord$4(acp.data)?.details;
|
|
417
|
-
if (typeof details !== "string") return false;
|
|
418
|
-
return details.toLowerCase().includes(QUERY_CLOSED_BEFORE_RESPONSE_DETAIL);
|
|
419
|
-
}
|
|
420
450
|
function mapErrorCode(error) {
|
|
421
451
|
if (error instanceof PermissionPromptUnavailableError) return "PERMISSION_PROMPT_UNAVAILABLE";
|
|
422
452
|
if (error instanceof PermissionDeniedError) return "PERMISSION_DENIED";
|
|
@@ -500,7 +530,8 @@ const LOCAL_OPERATIONAL_MESSAGES = {
|
|
|
500
530
|
ACP_CAPACITY_SOFT_LIMIT: "Automatic ACP capacity is full; retry after an active task or process finishes.",
|
|
501
531
|
ACP_CAPACITY_HARD_LIMIT: "Device ACP capacity is full; retry after an active task or process finishes.",
|
|
502
532
|
ACP_CAPACITY_MEMORY_LIMIT: "Available device memory is below the ACP startup reserve; retry after memory is freed.",
|
|
503
|
-
ACP_CAPACITY_STATE_UNAVAILABLE: "ACP capacity state is unavailable; check the local host capacity state before retrying."
|
|
533
|
+
ACP_CAPACITY_STATE_UNAVAILABLE: "ACP capacity state is unavailable; check the local host capacity state before retrying.",
|
|
534
|
+
SESSION_RESUME_REQUIRED: "Persistent ACP session record could not be resumed."
|
|
504
535
|
};
|
|
505
536
|
const SAFE_CODES = /* @__PURE__ */ new Set([
|
|
506
537
|
...OUTPUT_ERROR_CODES,
|
|
@@ -625,6 +656,8 @@ function localOperationalMessage(error) {
|
|
|
625
656
|
for (const record of safeErrorRecords(error)) {
|
|
626
657
|
const code = record.code;
|
|
627
658
|
if (typeof code === "string" && Object.hasOwn(LOCAL_OPERATIONAL_MESSAGES, code)) return LOCAL_OPERATIONAL_MESSAGES[code];
|
|
659
|
+
const detailCode = record.detailCode;
|
|
660
|
+
if (typeof detailCode === "string" && Object.hasOwn(LOCAL_OPERATIONAL_MESSAGES, detailCode)) return LOCAL_OPERATIONAL_MESSAGES[detailCode];
|
|
628
661
|
if (typeof record.message === "string" && known.has(record.message)) return record.message;
|
|
629
662
|
}
|
|
630
663
|
}
|
|
@@ -713,8 +746,7 @@ function safeErrorRejection(error) {
|
|
|
713
746
|
safeProjections.add(rejection);
|
|
714
747
|
return rejection;
|
|
715
748
|
}
|
|
716
|
-
|
|
717
|
-
//#region src/process-liveness.ts
|
|
749
|
+
// src/process-liveness.ts
|
|
718
750
|
function isProcessAlive(pid) {
|
|
719
751
|
if (!pid || !Number.isInteger(pid) || pid <= 0 || pid === process.pid) return false;
|
|
720
752
|
try {
|
|
@@ -733,8 +765,7 @@ function isProcessDefinitelyDead(pid) {
|
|
|
733
765
|
return error.code === "ESRCH";
|
|
734
766
|
}
|
|
735
767
|
}
|
|
736
|
-
|
|
737
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/usingCtx.js
|
|
768
|
+
// \0@oxc-project+runtime@0.158.0/helpers/esm/usingCtx.js
|
|
738
769
|
function _usingCtx() {
|
|
739
770
|
var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
|
|
740
771
|
var n = Error();
|
|
@@ -789,8 +820,7 @@ function _usingCtx() {
|
|
|
789
820
|
}
|
|
790
821
|
};
|
|
791
822
|
}
|
|
792
|
-
|
|
793
|
-
//#region src/state-files.ts
|
|
823
|
+
// src/state-files.ts
|
|
794
824
|
async function writePrivateFile(filePath, content, options = {}) {
|
|
795
825
|
try {
|
|
796
826
|
var _usingCtx$1 = _usingCtx();
|
|
@@ -823,8 +853,7 @@ async function writePrivateFile(filePath, content, options = {}) {
|
|
|
823
853
|
async function writePrivateJsonFile(filePath, value) {
|
|
824
854
|
await writePrivateFile(filePath, `${JSON.stringify(value, null, 2)}\n`);
|
|
825
855
|
}
|
|
826
|
-
|
|
827
|
-
//#region src/session/event-log.ts
|
|
856
|
+
// src/session/event-log.ts
|
|
828
857
|
const DEFAULT_EVENT_SEGMENT_MAX_BYTES = 67108864;
|
|
829
858
|
/** Upper bound stored for a newly imported journal. */
|
|
830
859
|
const MAX_EVENT_SEGMENTS = 1024;
|
|
@@ -897,8 +926,7 @@ function defaultSessionEventLog(sessionId) {
|
|
|
897
926
|
last_write_error: null
|
|
898
927
|
};
|
|
899
928
|
}
|
|
900
|
-
|
|
901
|
-
//#region src/acp/jsonrpc.ts
|
|
929
|
+
// src/acp/jsonrpc.ts
|
|
902
930
|
function asRecord$3(value) {
|
|
903
931
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
904
932
|
return value;
|
|
@@ -990,8 +1018,7 @@ function parseJsonRpcErrorMessage(message) {
|
|
|
990
1018
|
if (!errorRecord || typeof errorRecord.message !== "string") return;
|
|
991
1019
|
return errorRecord.message;
|
|
992
1020
|
}
|
|
993
|
-
|
|
994
|
-
//#region src/perf-metrics.ts
|
|
1021
|
+
// src/perf-metrics.ts
|
|
995
1022
|
const counters = /* @__PURE__ */ new Map();
|
|
996
1023
|
const gauges = /* @__PURE__ */ new Map();
|
|
997
1024
|
const timings = /* @__PURE__ */ new Map();
|
|
@@ -1056,8 +1083,7 @@ function resetPerfMetrics() {
|
|
|
1056
1083
|
function formatPerfMetric(name, durationMsValue) {
|
|
1057
1084
|
return `${name}=${roundMetric(durationMsValue)}ms`;
|
|
1058
1085
|
}
|
|
1059
|
-
|
|
1060
|
-
//#region src/session/journal.ts
|
|
1086
|
+
// src/session/journal.ts
|
|
1061
1087
|
const SESSION_JOURNAL_SCHEMA = "acpx.session.journal.v1";
|
|
1062
1088
|
const sequenceSchema = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
1063
1089
|
const resultSchema = z.union([z.object({
|
|
@@ -1096,7 +1122,7 @@ const markerSchema = z.discriminatedUnion("type", [
|
|
|
1096
1122
|
]);
|
|
1097
1123
|
const WATCH_PAGE_BYTES = 1048576;
|
|
1098
1124
|
function createJournalPage(options = {}) {
|
|
1099
|
-
const maxBytes = options.maxBytes ??
|
|
1125
|
+
const maxBytes = options.maxBytes ?? 1e400;
|
|
1100
1126
|
if (!(maxBytes > 0)) throw new Error("Session journal page size must be positive");
|
|
1101
1127
|
return {
|
|
1102
1128
|
events: [],
|
|
@@ -1553,8 +1579,7 @@ async function settleUnlessAborted(operation, signal) {
|
|
|
1553
1579
|
throw error;
|
|
1554
1580
|
}
|
|
1555
1581
|
}
|
|
1556
|
-
|
|
1557
|
-
//#region src/acp/agent-session-id.ts
|
|
1582
|
+
// src/acp/agent-session-id.ts
|
|
1558
1583
|
const AGENT_SESSION_ID_META_KEYS = ["agentSessionId", "sessionId"];
|
|
1559
1584
|
function normalizeAgentSessionId(value) {
|
|
1560
1585
|
if (typeof value !== "string") return;
|
|
@@ -1573,8 +1598,7 @@ function extractAgentSessionId(meta) {
|
|
|
1573
1598
|
if (normalized) return normalized;
|
|
1574
1599
|
}
|
|
1575
1600
|
}
|
|
1576
|
-
|
|
1577
|
-
//#region src/session/persistence/serialize.ts
|
|
1601
|
+
// src/session/persistence/serialize.ts
|
|
1578
1602
|
function serializeSessionRecordForDisk(record) {
|
|
1579
1603
|
return {
|
|
1580
1604
|
schema: SESSION_RECORD_SCHEMA,
|
|
@@ -1616,14 +1640,14 @@ function serializeSessionRecordForDisk(record) {
|
|
|
1616
1640
|
} : void 0
|
|
1617
1641
|
};
|
|
1618
1642
|
}
|
|
1619
|
-
|
|
1620
|
-
//#region src/acp/builtin-command-migration.ts
|
|
1643
|
+
// src/acp/builtin-command-migration.ts
|
|
1621
1644
|
const LEGACY_AGENT_COMMANDS = {
|
|
1622
1645
|
pi: [
|
|
1623
1646
|
"npx pi-acp",
|
|
1624
1647
|
"npx pi-acp@^0.0.22",
|
|
1625
1648
|
"npx pi-acp@^0.0.26",
|
|
1626
|
-
"npx pi-acp@^0.0.31"
|
|
1649
|
+
"npx pi-acp@^0.0.31",
|
|
1650
|
+
"npx pi-acp@^0.0.33"
|
|
1627
1651
|
],
|
|
1628
1652
|
codex: [
|
|
1629
1653
|
"npx @zed-industries/codex-acp",
|
|
@@ -1632,7 +1656,8 @@ const LEGACY_AGENT_COMMANDS = {
|
|
|
1632
1656
|
"npx @zed-industries/codex-acp@^0.11.1",
|
|
1633
1657
|
"npx @zed-industries/codex-acp@^0.12.0",
|
|
1634
1658
|
"npx -y @agentclientprotocol/codex-acp@^0.0.44",
|
|
1635
|
-
"npx -y @agentclientprotocol/codex-acp@^1.1.4"
|
|
1659
|
+
"npx -y @agentclientprotocol/codex-acp@^1.1.4",
|
|
1660
|
+
"npx -y @agentclientprotocol/codex-acp@^1.1.5"
|
|
1636
1661
|
],
|
|
1637
1662
|
claude: [
|
|
1638
1663
|
"npx @zed-industries/claude-agent-acp",
|
|
@@ -1649,17 +1674,21 @@ const LEGACY_AGENT_COMMANDS = {
|
|
|
1649
1674
|
"npx -y @agentclientprotocol/claude-agent-acp@^0.37.0",
|
|
1650
1675
|
"npx -y @agentclientprotocol/claude-agent-acp@^0.60.0",
|
|
1651
1676
|
"npx -y @agentclientprotocol/claude-agent-acp@^0.76.0",
|
|
1677
|
+
"npx -y @agentclientprotocol/claude-agent-acp@^0.81.2",
|
|
1678
|
+
"npx -y @agentclientprotocol/claude-agent-acp@^0.95.0",
|
|
1652
1679
|
"npm exec @agentclientprotocol/claude-agent-acp@^0.25.0",
|
|
1653
1680
|
"npm exec @agentclientprotocol/claude-agent-acp@^0.31.0",
|
|
1654
1681
|
"npm exec @agentclientprotocol/claude-agent-acp@^0.36.1",
|
|
1655
1682
|
"npm exec @agentclientprotocol/claude-agent-acp@^0.37.0",
|
|
1656
1683
|
"npm exec @agentclientprotocol/claude-agent-acp@^0.60.0",
|
|
1657
|
-
"npm exec @agentclientprotocol/claude-agent-acp@^0.76.0"
|
|
1684
|
+
"npm exec @agentclientprotocol/claude-agent-acp@^0.76.0",
|
|
1685
|
+
"npm exec @agentclientprotocol/claude-agent-acp@^0.81.2"
|
|
1658
1686
|
],
|
|
1659
1687
|
gemini: ["gemini", "gemini --experimental-acp"],
|
|
1688
|
+
kilocode: ["npx -y @kilocode/cli acp"],
|
|
1660
1689
|
kiro: ["kiro-cli acp"],
|
|
1661
|
-
mux: ["npx -y mux@^0.27.0 acp"],
|
|
1662
|
-
opencode: ["npx opencode-ai"]
|
|
1690
|
+
mux: ["npx -y mux@^0.27.0 acp", "npx -y mux@^0.28.0 acp"],
|
|
1691
|
+
opencode: ["npx opencode-ai", "npx -y opencode-ai acp"]
|
|
1663
1692
|
};
|
|
1664
1693
|
function currentArgv(name) {
|
|
1665
1694
|
const argv = AGENT_ARGV_REGISTRY[name];
|
|
@@ -1712,8 +1741,7 @@ function migrateBuiltInAgentIdentity(agentCommand, agentArgv) {
|
|
|
1712
1741
|
function canonicalAgentCommand(agentCommand) {
|
|
1713
1742
|
return migrateBuiltInAgentIdentity(agentCommand).agentCommand;
|
|
1714
1743
|
}
|
|
1715
|
-
|
|
1716
|
-
//#region src/session/persistence/parse.ts
|
|
1744
|
+
// src/session/persistence/parse.ts
|
|
1717
1745
|
function asRecord$2(value) {
|
|
1718
1746
|
if (!value || typeof value !== "object" || Array.isArray(value)) return;
|
|
1719
1747
|
return value;
|
|
@@ -2192,8 +2220,7 @@ function hasNullOptionalSessionFields(options) {
|
|
|
2192
2220
|
function hasInvalidExitStatus(options) {
|
|
2193
2221
|
return typeof options.lastAgentExitCode === "symbol" || typeof options.lastAgentExitSignal === "symbol";
|
|
2194
2222
|
}
|
|
2195
|
-
|
|
2196
|
-
//#region src/persisted-key-policy.ts
|
|
2223
|
+
// src/persisted-key-policy.ts
|
|
2197
2224
|
const SNAKE_CASE_KEY = /^[a-z][a-z0-9_]*$/;
|
|
2198
2225
|
const ZED_TAG_KEYS = /* @__PURE__ */ new Set([
|
|
2199
2226
|
"User",
|
|
@@ -2223,22 +2250,10 @@ const OPAQUE_VALUE_PATHS = /* @__PURE__ */ new Set([
|
|
|
2223
2250
|
function isRecord(value) {
|
|
2224
2251
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
2225
2252
|
}
|
|
2226
|
-
function joinPath(path) {
|
|
2227
|
-
return path.join(".");
|
|
2228
|
-
}
|
|
2229
|
-
function shouldSkipKeyRule(path) {
|
|
2230
|
-
return MAP_OBJECT_PATHS.has(joinPath(path));
|
|
2231
|
-
}
|
|
2232
|
-
function shouldSkipDescend(path) {
|
|
2233
|
-
return OPAQUE_VALUE_PATHS.has(joinPath(path)) || isToolResultOutputPath(path);
|
|
2234
|
-
}
|
|
2235
|
-
function isToolResultOutputTail(path, toolResultsIndex) {
|
|
2236
|
-
return toolResultsIndex !== -1 && toolResultsIndex + 2 === path.length - 1;
|
|
2237
|
-
}
|
|
2238
2253
|
function isToolResultOutputPath(path) {
|
|
2239
2254
|
if (path.length < 5 || path[path.length - 1] !== "output") return false;
|
|
2240
2255
|
const toolResultsIndex = path.lastIndexOf("tool_results");
|
|
2241
|
-
if (
|
|
2256
|
+
if (toolResultsIndex === -1 || toolResultsIndex + 2 !== path.length - 1) return false;
|
|
2242
2257
|
return path.slice(0, toolResultsIndex + 1).join(".") === "messages.Agent.tool_results";
|
|
2243
2258
|
}
|
|
2244
2259
|
function collectViolations(value, path, violations) {
|
|
@@ -2247,13 +2262,13 @@ function collectViolations(value, path, violations) {
|
|
|
2247
2262
|
return;
|
|
2248
2263
|
}
|
|
2249
2264
|
if (!isRecord(value)) return;
|
|
2250
|
-
const skipKeyRule =
|
|
2265
|
+
const skipKeyRule = MAP_OBJECT_PATHS.has(path.join("."));
|
|
2251
2266
|
for (const [key, child] of Object.entries(value)) collectKeyViolation(child, key, path, skipKeyRule, violations);
|
|
2252
2267
|
}
|
|
2253
2268
|
function collectKeyViolation(child, key, path, skipKeyRule, violations) {
|
|
2254
|
-
if (!skipKeyRule && !SNAKE_CASE_KEY.test(key) && !ZED_TAG_KEYS.has(key)) violations.push(`${
|
|
2269
|
+
if (!skipKeyRule && !SNAKE_CASE_KEY.test(key) && !ZED_TAG_KEYS.has(key)) violations.push(`${path.join(".")}.${key}`.replace(/^\./, ""));
|
|
2255
2270
|
const childPath = [...path, key];
|
|
2256
|
-
if (!
|
|
2271
|
+
if (!OPAQUE_VALUE_PATHS.has(childPath.join(".")) && !isToolResultOutputPath(childPath)) collectViolations(child, childPath, violations);
|
|
2257
2272
|
}
|
|
2258
2273
|
function findPersistedKeyPolicyViolations(value) {
|
|
2259
2274
|
const violations = [];
|
|
@@ -2265,8 +2280,7 @@ function assertPersistedKeyPolicy(value) {
|
|
|
2265
2280
|
if (violations.length === 0) return;
|
|
2266
2281
|
throw new Error(`Persisted key policy violation (expected snake_case keys): ${violations.join(", ")}`);
|
|
2267
2282
|
}
|
|
2268
|
-
|
|
2269
|
-
//#region src/session/persistence/discovery.ts
|
|
2283
|
+
// src/session/persistence/discovery.ts
|
|
2270
2284
|
const DISCOVERY_BATCH_SIZE = 4;
|
|
2271
2285
|
/** Select and return the same canonical snapshot; cached metadata cannot exclude records. */
|
|
2272
2286
|
async function* scanSessionRecords(sessionDir) {
|
|
@@ -2288,8 +2302,7 @@ async function readRecord(file) {
|
|
|
2288
2302
|
return;
|
|
2289
2303
|
}
|
|
2290
2304
|
}
|
|
2291
|
-
|
|
2292
|
-
//#region src/session/persistence/repository.ts
|
|
2305
|
+
// src/session/persistence/repository.ts
|
|
2293
2306
|
const DEFAULT_HISTORY_LIMIT = 20;
|
|
2294
2307
|
function sessionFilePath(acpxRecordId) {
|
|
2295
2308
|
const safeId = safeSessionId(acpxRecordId);
|
|
@@ -2434,7 +2447,7 @@ async function findSessionByDirectoryWalk(options) {
|
|
|
2434
2447
|
const scope = agentScope(options.agentCommand);
|
|
2435
2448
|
const directories = walkDirectories(options);
|
|
2436
2449
|
let match;
|
|
2437
|
-
let distance =
|
|
2450
|
+
let distance = 1e400;
|
|
2438
2451
|
for await (const record of sessionRecords()) {
|
|
2439
2452
|
const candidateDistance = directories.get(record.cwd);
|
|
2440
2453
|
if (candidateDistance !== void 0 && matchesSession(record, scope, normalizedName) && (candidateDistance < distance || candidateDistance === distance && isNewer(record, match))) {
|
|
@@ -2514,11 +2527,15 @@ async function unlinkCountingBytes(filePath) {
|
|
|
2514
2527
|
try {
|
|
2515
2528
|
bytes = (await fs$1.stat(filePath)).size;
|
|
2516
2529
|
} catch {}
|
|
2517
|
-
|
|
2518
|
-
|
|
2530
|
+
try {
|
|
2531
|
+
await fs$1.unlink(filePath);
|
|
2532
|
+
return bytes;
|
|
2533
|
+
} catch (error) {
|
|
2534
|
+
if (error.code === "ENOENT") return 0;
|
|
2535
|
+
throw error;
|
|
2536
|
+
}
|
|
2519
2537
|
}
|
|
2520
|
-
|
|
2521
|
-
//#region src/process-identity.ts
|
|
2538
|
+
// src/process-identity.ts
|
|
2522
2539
|
const IDENTITY_QUERY_TIMEOUT_MS$1 = 2e3;
|
|
2523
2540
|
const LINUX_PROCESS_QUERY = `
|
|
2524
2541
|
const fs = require('node:fs/promises');
|
|
@@ -2913,8 +2930,7 @@ async function getOwnProcessIdentity() {
|
|
|
2913
2930
|
});
|
|
2914
2931
|
return await ownIdentityPending;
|
|
2915
2932
|
}
|
|
2916
|
-
|
|
2917
|
-
//#region src/session/lock-owner.ts
|
|
2933
|
+
// src/session/lock-owner.ts
|
|
2918
2934
|
const OBSERVATION_REUSE_MS = 1e3;
|
|
2919
2935
|
const IDENTITY_QUERY_TIMEOUT_MS = 1e3;
|
|
2920
2936
|
function lockOwnerPid(value) {
|
|
@@ -2953,8 +2969,7 @@ async function createLockOwner(options = {}) {
|
|
|
2953
2969
|
}
|
|
2954
2970
|
};
|
|
2955
2971
|
}
|
|
2956
|
-
|
|
2957
|
-
//#region src/prompt-content.ts
|
|
2972
|
+
// src/prompt-content.ts
|
|
2958
2973
|
var PromptInputValidationError = class extends Error {
|
|
2959
2974
|
constructor(message) {
|
|
2960
2975
|
super(message);
|
|
@@ -2978,41 +2993,11 @@ function isImageMimeType(value) {
|
|
|
2978
2993
|
function isAudioMimeType(value) {
|
|
2979
2994
|
return /^audio\/[A-Za-z0-9.+-]+$/i.test(value);
|
|
2980
2995
|
}
|
|
2981
|
-
function isTextBlock(value) {
|
|
2982
|
-
const record = asRecord$1(value);
|
|
2983
|
-
return record?.type === "text" && typeof record.text === "string";
|
|
2984
|
-
}
|
|
2985
|
-
function isImageBlock(value) {
|
|
2986
|
-
const record = asRecord$1(value);
|
|
2987
|
-
return record?.type === "image" && isNonEmptyString(record.mimeType) && isImageMimeType(record.mimeType) && typeof record.data === "string" && isBase64Data(record.data);
|
|
2988
|
-
}
|
|
2989
|
-
function isAudioBlock(value) {
|
|
2990
|
-
const record = asRecord$1(value);
|
|
2991
|
-
return record?.type === "audio" && isNonEmptyString(record.mimeType) && isAudioMimeType(record.mimeType) && typeof record.data === "string" && isBase64Data(record.data);
|
|
2992
|
-
}
|
|
2993
|
-
function isResourceLinkBlock(value) {
|
|
2994
|
-
const record = asRecord$1(value);
|
|
2995
|
-
return record?.type === "resource_link" && isNonEmptyString(record.uri) && (record.title == null || typeof record.title === "string") && typeof record.name === "string";
|
|
2996
|
-
}
|
|
2997
2996
|
function isResourcePayload(value) {
|
|
2998
2997
|
const record = asRecord$1(value);
|
|
2999
2998
|
if (!record || !isNonEmptyString(record.uri)) return false;
|
|
3000
2999
|
return typeof record.text === "string" || typeof record.blob === "string";
|
|
3001
3000
|
}
|
|
3002
|
-
function isResourceBlock(value) {
|
|
3003
|
-
const record = asRecord$1(value);
|
|
3004
|
-
return record?.type === "resource" && isResourcePayload(record.resource);
|
|
3005
|
-
}
|
|
3006
|
-
const CONTENT_BLOCK_VALIDATORS = [
|
|
3007
|
-
isTextBlock,
|
|
3008
|
-
isImageBlock,
|
|
3009
|
-
isAudioBlock,
|
|
3010
|
-
isResourceLinkBlock,
|
|
3011
|
-
isResourceBlock
|
|
3012
|
-
];
|
|
3013
|
-
function isContentBlock(value) {
|
|
3014
|
-
return CONTENT_BLOCK_VALIDATORS.some((validator) => validator(value));
|
|
3015
|
-
}
|
|
3016
3001
|
const CONTENT_BLOCK_ERROR_VALIDATORS = {
|
|
3017
3002
|
text: validateTextContentBlock,
|
|
3018
3003
|
image: validateImageContentBlock,
|
|
@@ -3054,7 +3039,7 @@ function getContentBlockValidationError(value, index) {
|
|
|
3054
3039
|
return validator ? validator(record, index) : `prompt[${index}] has unsupported content block type ${JSON.stringify(record.type)}`;
|
|
3055
3040
|
}
|
|
3056
3041
|
function isPromptInput(value) {
|
|
3057
|
-
return Array.isArray(value) && value.every((entry) =>
|
|
3042
|
+
return Array.isArray(value) && value.every((entry, index) => getContentBlockValidationError(entry, index) === void 0);
|
|
3058
3043
|
}
|
|
3059
3044
|
function promptCapabilityRequirement(block) {
|
|
3060
3045
|
switch (block.type) {
|
|
@@ -3129,8 +3114,7 @@ function contentBlockDisplayText(block) {
|
|
|
3129
3114
|
function resourceBlockDisplayText(block) {
|
|
3130
3115
|
return "text" in block.resource && typeof block.resource.text === "string" ? block.resource.text : block.resource.uri;
|
|
3131
3116
|
}
|
|
3132
|
-
|
|
3133
|
-
//#region src/acp/process-descendants.ts
|
|
3117
|
+
// src/acp/process-descendants.ts
|
|
3134
3118
|
function hasStaleWindowsParent(identity, parent) {
|
|
3135
3119
|
return identity.birth.kind === "windows-creation" && (parent?.birth.kind !== "windows-creation" || parent.birth.value > identity.birth.value);
|
|
3136
3120
|
}
|
|
@@ -3286,8 +3270,7 @@ var ProcessDescendants = class {
|
|
|
3286
3270
|
this.identities.clear();
|
|
3287
3271
|
}
|
|
3288
3272
|
};
|
|
3289
|
-
|
|
3290
|
-
//#region src/session/queue/paths.ts
|
|
3273
|
+
// src/session/queue/paths.ts
|
|
3291
3274
|
function shortHash(value, length) {
|
|
3292
3275
|
return createHash("sha256").update(value).digest("hex").slice(0, length);
|
|
3293
3276
|
}
|
|
@@ -3309,8 +3292,7 @@ function queueSocketPath(sessionId, homeDir = os.homedir()) {
|
|
|
3309
3292
|
if (process.platform === "win32") return `\\\\.\\pipe\\acpx-${key}`;
|
|
3310
3293
|
return path.join(queueSocketBaseDir(homeDir) ?? "/tmp", `${key}.sock`);
|
|
3311
3294
|
}
|
|
3312
|
-
|
|
3313
|
-
//#region src/session/queue/retirement-receipt.ts
|
|
3295
|
+
// src/session/queue/retirement-receipt.ts
|
|
3314
3296
|
const MAX_RETIREMENT_MEMBERS = 4096;
|
|
3315
3297
|
const MAX_RETIREMENT_BYTES = 1048576;
|
|
3316
3298
|
function hasQueueRetirementReceipt(value) {
|
|
@@ -3448,8 +3430,7 @@ async function assertQueueRetirementComplete(receipt, deadline) {
|
|
|
3448
3430
|
const table = live.length > 0 ? await readRetirementSnapshot(deadline) : void 0;
|
|
3449
3431
|
for (const witness of live) if (observeRetirementSnapshot(witness, table) !== "gone") throw queueRetirementIncomplete();
|
|
3450
3432
|
}
|
|
3451
|
-
|
|
3452
|
-
//#region src/session/queue/lease-mutation.ts
|
|
3433
|
+
// src/session/queue/lease-mutation.ts
|
|
3453
3434
|
const GUARD_WAIT_MS = 2e3;
|
|
3454
3435
|
const localMutations = /* @__PURE__ */ new Map();
|
|
3455
3436
|
var QueueLeaseGuardSettlementError = class extends QueueConnectionError {
|
|
@@ -3475,7 +3456,7 @@ async function acquireGuard(lockPath, owner) {
|
|
|
3475
3456
|
return await acquireFileLock(lockPath, {
|
|
3476
3457
|
managerKey: "acpx.queue-lease-mutation",
|
|
3477
3458
|
lockPath: `${lockPath}.guard`,
|
|
3478
|
-
staleMs:
|
|
3459
|
+
staleMs: 1e400,
|
|
3479
3460
|
timeoutMs: GUARD_WAIT_MS,
|
|
3480
3461
|
retry: {
|
|
3481
3462
|
minTimeout: 5,
|
|
@@ -3598,8 +3579,7 @@ async function withQueueLeaseMutation(sessionId, mutate, options = {}) {
|
|
|
3598
3579
|
return outcome.value;
|
|
3599
3580
|
});
|
|
3600
3581
|
}
|
|
3601
|
-
|
|
3602
|
-
//#region src/session/queue/lease-store.ts
|
|
3582
|
+
// src/session/queue/lease-store.ts
|
|
3603
3583
|
const PROCESS_SIGTERM_GRACE_MS = process.platform === "win32" ? 4e3 : 12e3;
|
|
3604
3584
|
const PROCESS_SIGKILL_GRACE_MS = 1500;
|
|
3605
3585
|
const PROCESS_POLL_MS = 50;
|
|
@@ -3759,7 +3739,7 @@ async function dispatchQueueOwnerSignal(pid, signal, deadline) {
|
|
|
3759
3739
|
});
|
|
3760
3740
|
return true;
|
|
3761
3741
|
}
|
|
3762
|
-
async function terminateWithDispatch(pid, dispatch, hasExited, deadline =
|
|
3742
|
+
async function terminateWithDispatch(pid, dispatch, hasExited, deadline = 1e400) {
|
|
3763
3743
|
for (const [signal, graceMs] of [["SIGTERM", PROCESS_SIGTERM_GRACE_MS], ["SIGKILL", PROCESS_SIGKILL_GRACE_MS]]) {
|
|
3764
3744
|
if (!await dispatch(signal)) return false;
|
|
3765
3745
|
if (await waitForProcessExit(pid, Math.min(graceMs, deadline - performance.now()), hasExited)) return true;
|
|
@@ -3993,7 +3973,7 @@ async function dispatchVerifiedQueueOwnerSignal(owner, signal, requireStale, ret
|
|
|
3993
3973
|
}
|
|
3994
3974
|
async function retireQueueOwner(owner, requireStale, retirement) {
|
|
3995
3975
|
const { deadline } = retirement;
|
|
3996
|
-
const exited = await terminateWithDispatch(owner.pid, (signal) => dispatchVerifiedQueueOwnerSignal(owner, signal, requireStale, retirement), isProcessDefinitelyDead, process.platform === "win32" ? deadline :
|
|
3976
|
+
const exited = await terminateWithDispatch(owner.pid, (signal) => dispatchVerifiedQueueOwnerSignal(owner, signal, requireStale, retirement), isProcessDefinitelyDead, process.platform === "win32" ? deadline : 1e400);
|
|
3997
3977
|
if (await waitForReleasedOwner(owner, requireStale, retirement)) return false;
|
|
3998
3978
|
const gone = retirement.gone || process.platform === "win32" && exited || await observeRetiringOwner(owner, deadline) === "gone";
|
|
3999
3979
|
if (retirement.unverified && !gone) throw unverifiedQueueOwnerError(owner);
|
|
@@ -4112,8 +4092,7 @@ async function waitMs(ms) {
|
|
|
4112
4092
|
setTimeout(resolve, ms);
|
|
4113
4093
|
});
|
|
4114
4094
|
}
|
|
4115
|
-
|
|
4116
|
-
//#region src/session/queue/ipc-transport.ts
|
|
4095
|
+
// src/session/queue/ipc-transport.ts
|
|
4117
4096
|
const QUEUE_CONNECT_ATTEMPTS = 40;
|
|
4118
4097
|
const SOCKET_CONNECTION_TIMEOUT_MS = 5e3;
|
|
4119
4098
|
function shouldRetryQueueConnect(error) {
|
|
@@ -4157,8 +4136,7 @@ async function connectToQueueOwner(owner, maxAttempts = QUEUE_CONNECT_ATTEMPTS)
|
|
|
4157
4136
|
await waitMs(50);
|
|
4158
4137
|
}
|
|
4159
4138
|
}
|
|
4160
|
-
|
|
4161
|
-
//#region src/session/queue/ipc-health.ts
|
|
4139
|
+
// src/session/queue/ipc-health.ts
|
|
4162
4140
|
async function isStillCurrent(owner) {
|
|
4163
4141
|
const current = await readQueueOwnerRecord(owner.sessionId);
|
|
4164
4142
|
return current?.pid === owner.pid && current.ownerGeneration === owner.ownerGeneration;
|
|
@@ -4210,8 +4188,7 @@ async function probeQueueOwnerHealth(sessionId) {
|
|
|
4210
4188
|
queueDepth: owner.queueDepth
|
|
4211
4189
|
};
|
|
4212
4190
|
}
|
|
4213
|
-
|
|
4214
|
-
//#region src/session/queue/messages.ts
|
|
4191
|
+
// src/session/queue/messages.ts
|
|
4215
4192
|
function asRecord(value) {
|
|
4216
4193
|
if (!value || typeof value !== "object" || Array.isArray(value)) return;
|
|
4217
4194
|
return value;
|
|
@@ -4590,8 +4567,7 @@ function parseErrorOwnerMessage(message, context) {
|
|
|
4590
4567
|
function isValidOwnerErrorCore(message) {
|
|
4591
4568
|
return typeof message.message === "string" && isOutputErrorCode(message.code) && isOutputErrorOrigin(message.origin);
|
|
4592
4569
|
}
|
|
4593
|
-
|
|
4594
|
-
//#region src/session/queue/request-limit.ts
|
|
4570
|
+
// src/session/queue/request-limit.ts
|
|
4595
4571
|
function queueRequestByteLimit(raw = process.env.ACPX_QUEUE_MAX_REQUEST_BYTES) {
|
|
4596
4572
|
if (raw === void 0 || raw.trim() === "") return;
|
|
4597
4573
|
const limit = Number(raw);
|
|
@@ -4609,8 +4585,7 @@ function assertQueueRequestSize(line) {
|
|
|
4609
4585
|
retryable: false
|
|
4610
4586
|
});
|
|
4611
4587
|
}
|
|
4612
|
-
|
|
4613
|
-
//#region src/session/queue/socket-output.ts
|
|
4588
|
+
// src/session/queue/socket-output.ts
|
|
4614
4589
|
const OUTPUT_CHUNK_BYTES = 65536;
|
|
4615
4590
|
const DRAIN_TIMEOUT_MS = 1e3;
|
|
4616
4591
|
const DEFAULT_LIMITS = Object.freeze({
|
|
@@ -4820,8 +4795,7 @@ var QueueSocketOutput = class {
|
|
|
4820
4795
|
this.closeSpool();
|
|
4821
4796
|
}
|
|
4822
4797
|
};
|
|
4823
|
-
|
|
4824
|
-
//#region src/session/queue/ipc-server.ts
|
|
4798
|
+
// src/session/queue/ipc-server.ts
|
|
4825
4799
|
const QUEUE_SOCKET_DRAIN_TIMEOUT_MS = 1e3;
|
|
4826
4800
|
function makeQueueOwnerError(requestId, message, detailCode, options = {}) {
|
|
4827
4801
|
return {
|
|
@@ -4968,11 +4942,6 @@ var SessionQueueOwner = class SessionQueueOwner {
|
|
|
4968
4942
|
this.onQueueDepthChanged?.(this.pending.length);
|
|
4969
4943
|
}
|
|
4970
4944
|
enqueue(task) {
|
|
4971
|
-
if (this.closed) {
|
|
4972
|
-
task.send(makeQueueOwnerError(task.requestId, "Queue owner is shutting down", "QUEUE_OWNER_SHUTTING_DOWN", { retryable: true }));
|
|
4973
|
-
task.close();
|
|
4974
|
-
return false;
|
|
4975
|
-
}
|
|
4976
4945
|
if (this.activeTask?.requestId === task.requestId || this.pending.some((queued) => queued.requestId === task.requestId)) {
|
|
4977
4946
|
task.send(makeQueueOwnerError(task.requestId, "Request is already queued or active", "QUEUE_REQUEST_DUPLICATE", { retryable: false }));
|
|
4978
4947
|
task.close();
|
|
@@ -5213,8 +5182,8 @@ var SessionQueueOwner = class SessionQueueOwner {
|
|
|
5213
5182
|
return true;
|
|
5214
5183
|
}
|
|
5215
5184
|
};
|
|
5216
|
-
|
|
5217
|
-
|
|
5185
|
+
// src/session/queue/ipc.ts
|
|
5186
|
+
var ipc_exports = /* @__PURE__ */ __exportAll({ tryCancelOnRunningOwner: () => tryCancelOnRunningOwner });
|
|
5218
5187
|
function assertOwnerGeneration(owner, message) {
|
|
5219
5188
|
if (owner.ownerGeneration !== void 0 && message.ownerGeneration !== void 0 && message.ownerGeneration !== owner.ownerGeneration) throw new QueueProtocolError("Queue owner returned mismatched generation", {
|
|
5220
5189
|
detailCode: "QUEUE_OWNER_GENERATION_MISMATCH",
|
|
@@ -5684,7 +5653,6 @@ async function trySetConfigOptionOnRunningOwner(sessionId, configId, value, time
|
|
|
5684
5653
|
submit: (owner) => withOwnerControlPersistence(owner, submitSetConfigOptionToQueueOwner(owner, configId, value, timeoutMs, assertDispatch))
|
|
5685
5654
|
});
|
|
5686
5655
|
}
|
|
5687
|
-
|
|
5688
|
-
export { measurePerf as $, SessionModeReplayError as $t, findSession as A, extractAcpError as At, assertPersistedKeyPolicy as B, isAcpRuntimeError as Bt, textPrompt as C, exitCodeForOutputErrorCode as Ct, DEFAULT_HISTORY_LIMIT as D, normalizeOutputError as Dt, observeProcessIncarnation as E, isRetryablePromptError as Et, normalizeName as F, OUTPUT_FORMATS as Ft, normalizeAgentSessionId as G, AuthPolicyError as Gt, canonicalAgentCommand as H, AgentDisconnectedError as Ht, pruneSessions as I, PERMISSION_MODES as It, SessionWatchError as J, GeminiAcpStartupTimeoutError as Jt, SESSION_JOURNAL_SCHEMA as K, ClaudeAcpSessionCreateTimeoutError as Kt, readSessionRecord as L, PERMISSION_POLICY_ACTIONS as Lt, isoNow as M, AUTH_POLICIES as Mt, listSessions as N, EXIT_CODES as Nt, absolutePath as O, safeErrorRejection as Ot, listSessionsForAgent as P, NON_INTERACTIVE_PERMISSION_POLICIES as Pt, incrementPerfCounter as Q, SessionConfigOptionReplayError as Qt, resolveSessionRecord as R, SESSION_RECORD_SCHEMA as Rt, promptToDisplayText as S, isProcessAlive as St, lockOwnerPid as T, isAcpQueryClosedBeforeResponseError as Tt, serializeSessionRecordForDisk as U, AgentSpawnError as Ut, parseSessionRecord as V, AcpxOperationalError as Vt, extractAgentSessionId as W, AgentStartupError as Wt, formatPerfMetric as X, PermissionPromptUnavailableError as Xt, watchSession as Y, PermissionDeniedError as Yt, getPerfMetricsSnapshot as Z, QueueConnectionError as Zt, ProcessDescendants as _, sessionEventLockPath as _t, trySetModelOnRunningOwner as a, isAcpMessageObject as at, mergePromptSourceWithText as b, writePrivateJsonFile as bt, probeQueueOwnerHealth as c, parsePermissionNotice as ct, releaseQueueOwnerLease as d, boundedEventMaxSegments as dt, SessionModelReplayError as en, resetPerfMetrics as et, terminateProcess as f, defaultSessionEventLog as ft, QueueLeaseGuardSettlementError as g, sessionEventActivePath as gt, waitMs as h, sessionBaseDir as ht, trySetModeOnRunningOwner as i, isAcpJsonRpcMessage as it, findSessionByDirectoryWalk as j, isAcpResourceNotFoundError as jt, findGitRepositoryRoot as k, toSafeError as kt, readQueueOwnerRecord as l, parsePromptStopReason as lt, tryAcquireQueueOwnerLease as m, retainedEventMaxSegments as mt, tryCloseSessionOnRunningOwner as n, SessionResumeRequiredError as nn, startPerfTimer as nt, trySubmitToRunningOwner as o, isSessionUpdateNotification as ot, terminateQueueOwnerForSession as p, existingEventSegmentIndices as pt, SessionJournalReader as q, CopilotAcpUnsupportedError as qt, trySetConfigOptionOnRunningOwner as r, UnsupportedPromptContentError as rn, extractSessionUpdateNotification as rt, SessionQueueOwner as s, parseJsonRpcErrorMessage as st, tryCancelOnRunningOwner as t, SessionNotFoundError as tn, setPerfGauge as tt, refreshQueueOwnerLease as u, DEFAULT_EVENT_SEGMENT_MAX_BYTES as ut, PromptInputValidationError as v, sessionEventSegmentPath as vt, createLockOwner as w, formatErrorMessage as wt, parsePromptSource as x, _usingCtx as xt, getUnsupportedPromptContentMessage as y, writePrivateFile as yt, writeSessionRecord as z, AcpRuntimeError as zt };
|
|
5656
|
+
export { incrementPerfCounter as $, SessionModeReplayError as $t, findGitRepositoryRoot as A, extractAcpError as At, writeSessionRecord as B, isAcpRuntimeError as Bt, promptToDisplayText as C, isProcessAlive as Ct, observeProcessIncarnation as D, normalizeOutputError as Dt, lockOwnerPid as E, isRetryablePromptError as Et, listSessionsForAgent as F, OUTPUT_FORMATS as Ft, extractAgentSessionId as G, AuthPolicyError as Gt, parseSessionRecord as H, AgentDisconnectedError as Ht, normalizeName as I, PERMISSION_MODES as It, SessionJournalReader as J, GeminiAcpStartupTimeoutError as Jt, normalizeAgentSessionId as K, ClaudeAcpSessionCreateTimeoutError as Kt, pruneSessions as L, PERMISSION_POLICY_ACTIONS as Lt, findSessionByDirectoryWalk as M, AUTH_POLICIES as Mt, isoNow as N, EXIT_CODES as Nt, DEFAULT_HISTORY_LIMIT as O, safeErrorRejection as Ot, listSessions as P, NON_INTERACTIVE_PERMISSION_POLICIES as Pt, getPerfMetricsSnapshot as Q, SessionConfigOptionReplayError as Qt, readSessionRecord as R, SESSION_RECORD_SCHEMA as Rt, parsePromptSource as S, _usingCtx as St, createLockOwner as T, formatErrorMessage as Tt, canonicalAgentCommand as U, AgentSpawnError as Ut, assertPersistedKeyPolicy as V, AcpxOperationalError as Vt, serializeSessionRecordForDisk as W, AgentStartupError as Wt, watchSession as X, PermissionPromptUnavailableError as Xt, SessionWatchError as Y, PermissionDeniedError as Yt, formatPerfMetric as Z, QueueConnectionError as Zt, QueueLeaseGuardSettlementError as _, sessionEventActivePath as _t, trySetModeOnRunningOwner as a, __exportAll as an, isAcpJsonRpcMessage as at, getUnsupportedPromptContentMessage as b, writePrivateFile as bt, SessionQueueOwner as c, parseJsonRpcErrorMessage as ct, refreshQueueOwnerLease as d, DEFAULT_EVENT_SEGMENT_MAX_BYTES as dt, SessionModelReplayError as en, measurePerf as et, releaseQueueOwnerLease as f, boundedEventMaxSegments as ft, waitMs as g, sessionBaseDir as gt, tryAcquireQueueOwnerLease as h, retainedEventMaxSegments as ht, trySetConfigOptionOnRunningOwner as i, describeSpawnEnoent as in, extractSessionUpdateNotification as it, findSession as j, isAcpResourceNotFoundError as jt, absolutePath as k, toSafeError as kt, probeQueueOwnerHealth as l, parsePermissionNotice as lt, terminateQueueOwnerForSession as m, existingEventSegmentIndices as mt, tryCancelOnRunningOwner as n, SessionResumeRequiredError as nn, setPerfGauge as nt, trySetModelOnRunningOwner as o, isAcpMessageObject as ot, terminateProcess as p, defaultSessionEventLog as pt, SESSION_JOURNAL_SCHEMA as q, CopilotAcpUnsupportedError as qt, tryCloseSessionOnRunningOwner as r, UnsupportedPromptContentError as rn, startPerfTimer as rt, trySubmitToRunningOwner as s, isSessionUpdateNotification as st, ipc_exports as t, SessionNotFoundError as tn, resetPerfMetrics as tt, readQueueOwnerRecord as u, parsePromptStopReason as ut, ProcessDescendants as v, sessionEventLockPath as vt, textPrompt as w, exitCodeForOutputErrorCode as wt, mergePromptSourceWithText as x, writePrivateJsonFile as xt, PromptInputValidationError as y, sessionEventSegmentPath as yt, resolveSessionRecord as z, AcpRuntimeError as zt };
|
|
5689
5657
|
|
|
5690
|
-
//# sourceMappingURL=ipc-
|
|
5658
|
+
//# sourceMappingURL=ipc-DfqJsbk6.js.map
|