acpx 0.21.0 → 0.21.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/{agent-registry-Gtwn7nMp.js → agent-registry-Cz9fD9H1.js} +5 -8
- package/dist/{agent-registry-Gtwn7nMp.js.map → agent-registry-Cz9fD9H1.js.map} +1 -1
- package/dist/agent-registry.d.ts +0 -2
- package/dist/agent-registry.d.ts.map +1 -1
- package/dist/agent-registry.js +1 -1
- package/dist/{cli-I6rP9FGr.js → cli-BLEPj7lL.js} +6 -8
- package/dist/{cli-I6rP9FGr.js.map → cli-BLEPj7lL.js.map} +1 -1
- package/dist/cli.d.ts +1 -5
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +27 -45
- package/dist/cli.js.map +1 -1
- package/dist/{client-BaAmQKNy.d.ts → client-D12zqSyN.d.ts} +2 -8
- package/dist/client-D12zqSyN.d.ts.map +1 -0
- package/dist/{flows-7PaF7X66.js → flows-BVpRv0Df.js} +19 -33
- package/dist/{flows-7PaF7X66.js.map → flows-BVpRv0Df.js.map} +1 -1
- package/dist/flows.d.ts +2 -14
- package/dist/flows.d.ts.map +1 -1
- package/dist/flows.js +1 -1
- package/dist/{invocation-options-TRskRIuI.js → invocation-options-VJlayf-0.js} +8 -11
- package/dist/{invocation-options-TRskRIuI.js.map → invocation-options-VJlayf-0.js.map} +1 -1
- package/dist/{ipc-D2BC99hf.js → ipc-BbYFsKOj.js} +38 -69
- package/dist/{ipc-D2BC99hf.js.map → ipc-BbYFsKOj.js.map} +1 -1
- package/dist/{output-CkfCaQfo.js → output-mqRHzGzM.js} +10 -17
- package/dist/{output-CkfCaQfo.js.map → output-mqRHzGzM.js.map} +1 -1
- package/dist/{queue-owner-runtime-CNrWkR8J.js → queue-owner-runtime-B0mPqOu4.js} +51 -99
- package/dist/{queue-owner-runtime-CNrWkR8J.js.map → queue-owner-runtime-B0mPqOu4.js.map} +1 -1
- package/dist/runtime.d.ts +2 -26
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +17 -30
- package/dist/runtime.js.map +1 -1
- package/dist/{session-options-DVr_JUL7.d.ts → session-options-BlnP3WAc.d.ts} +1 -7
- package/dist/session-options-BlnP3WAc.d.ts.map +1 -0
- package/dist/{session-watch-BLLknspd.js → session-watch-BnIxHQrU.js} +5 -6
- package/dist/{session-watch-BLLknspd.js.map → session-watch-BnIxHQrU.js.map} +1 -1
- package/dist/{watch-Db2D1eYN.js → watch-bQXyUy3z.js} +3 -4
- package/dist/{watch-Db2D1eYN.js.map → watch-bQXyUy3z.js.map} +1 -1
- package/package.json +19 -19
- package/skills/acpx/SKILL.md +1 -0
- package/dist/client-BaAmQKNy.d.ts.map +0 -1
- package/dist/session-options-DVr_JUL7.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as measurePerf, $t as UnsupportedPromptContentError, Bt as AgentStartupError, C as textPrompt, Dt as normalizeOutputError, Et as isRetryablePromptError, F as normalizeName, G as normalizeAgentSessionId, Gt as PermissionDeniedError, H as canonicalAgentCommand, Ht as ClaudeAcpSessionCreateTimeoutError, Jt as SessionConfigOptionReplayError, K as SESSION_JOURNAL_SCHEMA, Kt as PermissionPromptUnavailableError, L as readSessionRecord, Lt as AcpxOperationalError, M as isoNow$1, O as absolutePath, Ot as extractAcpError, Q as incrementPerfCounter, Qt as SessionResumeRequiredError, R as resolveSessionRecord, Rt as AgentDisconnectedError, S as promptToDisplayText, St as isProcessAlive, T as lockOwnerPid, Tt as isAcpQueryClosedBeforeResponseError, Ut as CopilotAcpUnsupportedError, Vt as AuthPolicyError, W as extractAgentSessionId, Wt as GeminiAcpStartupTimeoutError, X as formatPerfMetric, Xt as SessionModelReplayError, Yt as SessionModeReplayError, Z as getPerfMetricsSnapshot, _ as ProcessDescendants, _t as sessionEventLockPath, a as trySetModelOnRunningOwner, at as isAcpMessageObject, d as releaseQueueOwnerLease, et as resetPerfMetrics, f as terminateProcess, ft as defaultSessionEventLog, g as QueueLeaseGuardSettlementError, gt as sessionEventActivePath, h as waitMs$1, ht as sessionBaseDir, i as trySetModeOnRunningOwner, it as isAcpJsonRpcMessage, j as findSessionByDirectoryWalk, k as findGitRepositoryRoot, kt as isAcpResourceNotFoundError, m as tryAcquireQueueOwnerLease, mt as retainedEventMaxSegments, n as tryCloseSessionOnRunningOwner, nt as startPerfTimer, o as trySubmitToRunningOwner, ot as isSessionUpdateNotification, p as terminateQueueOwnerForSession, pt as existingEventSegmentIndices, q as SessionJournalReader, qt as QueueConnectionError, r as trySetConfigOptionOnRunningOwner, s as SessionQueueOwner, t as tryCancelOnRunningOwner, tt as setPerfGauge, u as refreshQueueOwnerLease, vt as sessionEventSegmentPath, w as createLockOwner, wt as formatErrorMessage, y as getUnsupportedPromptContentMessage, z as writeSessionRecord, zt as AgentSpawnError } from "./ipc-
|
|
2
|
-
import { A as requireAgentStdio, C as PROCESS_HELPER_TIMEOUT_MS, D as isoNow$2, E as isChildProcessRunning, F as waitForChildExit, I as waitForSpawn, M as resolveAgentSessionCwd, N as runTimedExecFile, P as splitCommandLine, T as basenameToken, _ as buildSpawnCommandOptions, b as readWindowsEnvValue, f as resolveBuiltInAgentLaunch, g as buildAgentSpawnCommand, j as resolveAgentCommandParts, v as buildTerminalShellSpawnCommand, w as asAbsoluteCwd, x as resolveWindowsExecutablePath, y as buildTerminalSpawnCommand } from "./agent-registry-
|
|
1
|
+
import { $ as measurePerf, $t as UnsupportedPromptContentError, Bt as AgentStartupError, C as textPrompt, Dt as normalizeOutputError, Et as isRetryablePromptError, F as normalizeName, G as normalizeAgentSessionId, Gt as PermissionDeniedError, H as canonicalAgentCommand, Ht as ClaudeAcpSessionCreateTimeoutError, Jt as SessionConfigOptionReplayError, K as SESSION_JOURNAL_SCHEMA, Kt as PermissionPromptUnavailableError, L as readSessionRecord, Lt as AcpxOperationalError, M as isoNow$1, O as absolutePath, Ot as extractAcpError, Q as incrementPerfCounter, Qt as SessionResumeRequiredError, R as resolveSessionRecord, Rt as AgentDisconnectedError, S as promptToDisplayText, St as isProcessAlive, T as lockOwnerPid, Tt as isAcpQueryClosedBeforeResponseError, Ut as CopilotAcpUnsupportedError, Vt as AuthPolicyError, W as extractAgentSessionId, Wt as GeminiAcpStartupTimeoutError, X as formatPerfMetric, Xt as SessionModelReplayError, Yt as SessionModeReplayError, Z as getPerfMetricsSnapshot, _ as ProcessDescendants, _t as sessionEventLockPath, a as trySetModelOnRunningOwner, at as isAcpMessageObject, d as releaseQueueOwnerLease, et as resetPerfMetrics, f as terminateProcess, ft as defaultSessionEventLog, g as QueueLeaseGuardSettlementError, gt as sessionEventActivePath, h as waitMs$1, ht as sessionBaseDir, i as trySetModeOnRunningOwner, it as isAcpJsonRpcMessage, j as findSessionByDirectoryWalk, k as findGitRepositoryRoot, kt as isAcpResourceNotFoundError, m as tryAcquireQueueOwnerLease, mt as retainedEventMaxSegments, n as tryCloseSessionOnRunningOwner, nt as startPerfTimer, o as trySubmitToRunningOwner, ot as isSessionUpdateNotification, p as terminateQueueOwnerForSession, pt as existingEventSegmentIndices, q as SessionJournalReader, qt as QueueConnectionError, r as trySetConfigOptionOnRunningOwner, s as SessionQueueOwner, t as tryCancelOnRunningOwner, tt as setPerfGauge, u as refreshQueueOwnerLease, vt as sessionEventSegmentPath, w as createLockOwner, wt as formatErrorMessage, y as getUnsupportedPromptContentMessage, z as writeSessionRecord, zt as AgentSpawnError } from "./ipc-BbYFsKOj.js";
|
|
2
|
+
import { A as requireAgentStdio, C as PROCESS_HELPER_TIMEOUT_MS, D as isoNow$2, E as isChildProcessRunning, F as waitForChildExit, I as waitForSpawn, M as resolveAgentSessionCwd, N as runTimedExecFile, P as splitCommandLine, T as basenameToken, _ as buildSpawnCommandOptions, b as readWindowsEnvValue, f as resolveBuiltInAgentLaunch, g as buildAgentSpawnCommand, j as resolveAgentCommandParts, v as buildTerminalShellSpawnCommand, w as asAbsoluteCwd, x as resolveWindowsExecutablePath, y as buildTerminalSpawnCommand } from "./agent-registry-Cz9fD9H1.js";
|
|
3
3
|
import fs, { readFileSync, realpathSync } from "node:fs";
|
|
4
4
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
5
|
import path from "node:path";
|
|
@@ -16,7 +16,7 @@ import { FsSafeError } from "@openclaw/fs-safe/errors";
|
|
|
16
16
|
import { isPathInside } from "@openclaw/fs-safe/path";
|
|
17
17
|
import { root } from "@openclaw/fs-safe/root";
|
|
18
18
|
import readline from "node:readline/promises";
|
|
19
|
-
|
|
19
|
+
// src/async-control.ts
|
|
20
20
|
var TimeoutError = class extends Error {
|
|
21
21
|
constructor(timeoutMs) {
|
|
22
22
|
super(`Timed out after ${timeoutMs}ms`);
|
|
@@ -76,8 +76,7 @@ async function withInterrupt(run, onInterrupt) {
|
|
|
76
76
|
run().then((result) => finish(() => resolve(result)), (error) => finish(() => reject(error)));
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
//#region src/acp/codex-compat.ts
|
|
79
|
+
// src/acp/codex-compat.ts
|
|
81
80
|
function isLegacyZedCodexAcpInvocation(agentCommand) {
|
|
82
81
|
return /@zed-industries\/codex-acp\b/u.test(agentCommand);
|
|
83
82
|
}
|
|
@@ -95,8 +94,7 @@ function codexPermissionNotice(request, response, agentName) {
|
|
|
95
94
|
const selectedId = response.outcome.optionId;
|
|
96
95
|
return request.options.find((option) => option.optionId === selectedId)?.kind === "reject_once" && selectedId === "cancel" ? "Permission refused using Codex's cancellation option; this can end the current turn. The operation was not approved." : void 0;
|
|
97
96
|
}
|
|
98
|
-
|
|
99
|
-
//#region src/session/events.ts
|
|
97
|
+
// src/session/events.ts
|
|
100
98
|
async function ensureSessionDir() {
|
|
101
99
|
await fs$1.mkdir(sessionBaseDir(), {
|
|
102
100
|
recursive: true,
|
|
@@ -359,8 +357,7 @@ async function listSessionEvents(sessionId, maxSegments) {
|
|
|
359
357
|
eventLog: { max_segments: maxSegments }
|
|
360
358
|
}).readAcpMessages();
|
|
361
359
|
}
|
|
362
|
-
|
|
363
|
-
//#region src/session/turn-ownership.ts
|
|
360
|
+
// src/session/turn-ownership.ts
|
|
364
361
|
const LOCK_RETRY_MS = 15;
|
|
365
362
|
const INCOMPLETE_RESERVATION_GRACE_MS = 15e3;
|
|
366
363
|
let lastCreatedAt = 0;
|
|
@@ -599,16 +596,14 @@ async function acquireSessionOwnership(requestedPath, signal) {
|
|
|
599
596
|
await setTimeout$1(LOCK_RETRY_MS, void 0, { signal });
|
|
600
597
|
}
|
|
601
598
|
}
|
|
602
|
-
|
|
603
|
-
//#region src/session/execution/contracts.ts
|
|
599
|
+
// src/session/execution/contracts.ts
|
|
604
600
|
const DEFAULT_QUEUE_OWNER_TTL_MS = 3e5;
|
|
605
601
|
function normalizeQueueOwnerTtlMs(ttlMs) {
|
|
606
602
|
if (ttlMs == null) return DEFAULT_QUEUE_OWNER_TTL_MS;
|
|
607
603
|
if (!Number.isFinite(ttlMs) || ttlMs < 0) return DEFAULT_QUEUE_OWNER_TTL_MS;
|
|
608
604
|
return Math.round(ttlMs);
|
|
609
605
|
}
|
|
610
|
-
|
|
611
|
-
//#region src/file-read-window.ts
|
|
606
|
+
// src/file-read-window.ts
|
|
612
607
|
function sliceReadWindow(content, line, limit) {
|
|
613
608
|
if (line == null && limit == null) return content;
|
|
614
609
|
const lines = content.split("\n");
|
|
@@ -618,8 +613,7 @@ function sliceReadWindow(content, line, limit) {
|
|
|
618
613
|
const endIndex = maxLines == null ? lines.length : Math.min(lines.length, startIndex + maxLines);
|
|
619
614
|
return lines.slice(startIndex, endIndex).join("\n");
|
|
620
615
|
}
|
|
621
|
-
|
|
622
|
-
//#region src/permission-prompt.ts
|
|
616
|
+
// src/permission-prompt.ts
|
|
623
617
|
function visiblePromptText(value) {
|
|
624
618
|
let rendered = "";
|
|
625
619
|
for (const character of value) {
|
|
@@ -687,8 +681,7 @@ function writePromptDetails(options) {
|
|
|
687
681
|
if (options.header) process.stderr.write(`\n${visiblePromptText(options.header)}\n`);
|
|
688
682
|
if (options.details && options.details.trim().length > 0) process.stderr.write(`${options.details.split("\n").map(visiblePromptText).join("\n")}\n`);
|
|
689
683
|
}
|
|
690
|
-
|
|
691
|
-
//#region src/filesystem.ts
|
|
684
|
+
// src/filesystem.ts
|
|
692
685
|
const WRITE_PREVIEW_MAX_LINES = 16;
|
|
693
686
|
const WRITE_PREVIEW_MAX_CHARS = 1200;
|
|
694
687
|
function nowIso$1() {
|
|
@@ -844,8 +837,7 @@ var FileSystemHandlers = class {
|
|
|
844
837
|
this.onOperation?.(operation);
|
|
845
838
|
}
|
|
846
839
|
};
|
|
847
|
-
|
|
848
|
-
//#region src/permissions.ts
|
|
840
|
+
// src/permissions.ts
|
|
849
841
|
const PERMISSION_MODE_RANK = {
|
|
850
842
|
"deny-all": 0,
|
|
851
843
|
"approve-reads": 1,
|
|
@@ -1115,8 +1107,7 @@ function classifyPermissionDecision(params, response) {
|
|
|
1115
1107
|
if (selectedOption.kind === "allow_once" || selectedOption.kind === "allow_always") return "approved";
|
|
1116
1108
|
return "denied";
|
|
1117
1109
|
}
|
|
1118
|
-
|
|
1119
|
-
//#region src/acp/agent-command.ts
|
|
1110
|
+
// src/acp/agent-command.ts
|
|
1120
1111
|
const DEFAULT_AGENT_CLOSE_AFTER_STDIN_END_MS = 100;
|
|
1121
1112
|
const QODER_AGENT_CLOSE_AFTER_STDIN_END_MS = 750;
|
|
1122
1113
|
const GEMINI_ACP_STARTUP_TIMEOUT_MS = 15e3;
|
|
@@ -1292,8 +1283,7 @@ function resolveClaudeCodeExecutable(platform = process.platform, env = process.
|
|
|
1292
1283
|
if (readWindowsEnvValue(env, "CLAUDE_CODE_EXECUTABLE")) return;
|
|
1293
1284
|
return resolveWindowsExecutablePath("claude", env, cwd);
|
|
1294
1285
|
}
|
|
1295
|
-
|
|
1296
|
-
//#region src/acp/inherited-env.ts
|
|
1286
|
+
// src/acp/inherited-env.ts
|
|
1297
1287
|
const AUTH_GRANT_PREFIX = "ACPX_AUTH_";
|
|
1298
1288
|
const POSIX_ESSENTIAL_NAMES = [
|
|
1299
1289
|
"PATH",
|
|
@@ -1377,8 +1367,7 @@ function inheritParentEnvironment(policy) {
|
|
|
1377
1367
|
for (const name of Object.keys(env)) if (!inherits(name)) delete env[name];
|
|
1378
1368
|
return env;
|
|
1379
1369
|
}
|
|
1380
|
-
|
|
1381
|
-
//#region src/acp/auth-env.ts
|
|
1370
|
+
// src/acp/auth-env.ts
|
|
1382
1371
|
const AUTH_ENV_PREFIX = "ACPX_AUTH_";
|
|
1383
1372
|
function toEnvToken(value) {
|
|
1384
1373
|
return value.trim().replace(/[^a-zA-Z0-9]+/g, "_").replace(/^_+|_+$/g, "").toUpperCase();
|
|
@@ -1493,8 +1482,7 @@ function buildAgentSpawnOptions(cwd, authCredentials, sessionEnv, agentProcessEn
|
|
|
1493
1482
|
windowsHide: true
|
|
1494
1483
|
};
|
|
1495
1484
|
}
|
|
1496
|
-
|
|
1497
|
-
//#region src/version.ts
|
|
1485
|
+
// src/version.ts
|
|
1498
1486
|
const UNKNOWN_VERSION = "0.0.0-unknown";
|
|
1499
1487
|
const MODULE_DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
1500
1488
|
let cachedVersion = null;
|
|
@@ -1536,8 +1524,7 @@ function getAcpxVersion() {
|
|
|
1536
1524
|
cachedVersion = resolveAcpxVersion();
|
|
1537
1525
|
return cachedVersion;
|
|
1538
1526
|
}
|
|
1539
|
-
|
|
1540
|
-
//#region src/acp/client-protocol.ts
|
|
1527
|
+
// src/acp/client-protocol.ts
|
|
1541
1528
|
const DEVIN_COMPATIBILITY_CLIENT_CAPABILITIES_META = Object.freeze({ "cognition.ai/requestDiagnostics": true });
|
|
1542
1529
|
const DEVIN_COMPATIBILITY_CLIENT_NAME = "windsurf";
|
|
1543
1530
|
const DEFAULT_DEVIN_COMPATIBILITY_CLIENT_VERSION = "1.110.1";
|
|
@@ -1569,8 +1556,7 @@ function resolveClientCapabilities(params) {
|
|
|
1569
1556
|
_meta: DEVIN_COMPATIBILITY_CLIENT_CAPABILITIES_META
|
|
1570
1557
|
};
|
|
1571
1558
|
}
|
|
1572
|
-
|
|
1573
|
-
//#region src/acp/command-probe.ts
|
|
1559
|
+
// src/acp/command-probe.ts
|
|
1574
1560
|
var CommandProbeAdmissionError = class extends Error {
|
|
1575
1561
|
reason;
|
|
1576
1562
|
constructor(reason) {
|
|
@@ -1636,8 +1622,7 @@ function captureCommandProbeOutput(child, timeoutMs, retire) {
|
|
|
1636
1622
|
}
|
|
1637
1623
|
};
|
|
1638
1624
|
}
|
|
1639
|
-
|
|
1640
|
-
//#region src/acp/model-config-state.ts
|
|
1625
|
+
// src/acp/model-config-state.ts
|
|
1641
1626
|
function asRecord$2(value) {
|
|
1642
1627
|
if (!value || typeof value !== "object" || Array.isArray(value)) return;
|
|
1643
1628
|
return value;
|
|
@@ -1696,8 +1681,7 @@ function modelStateFromConfigOptions(configOptions) {
|
|
|
1696
1681
|
}
|
|
1697
1682
|
return selected;
|
|
1698
1683
|
}
|
|
1699
|
-
|
|
1700
|
-
//#region src/acp/model-support.ts
|
|
1684
|
+
// src/acp/model-support.ts
|
|
1701
1685
|
const REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE = "ACP_MODEL_UNSUPPORTED";
|
|
1702
1686
|
const REQUESTED_MODEL_UNSUPPORTED_REASONS = ["missing-capability", "unadvertised-model"];
|
|
1703
1687
|
var RequestedModelUnsupportedError = class extends Error {
|
|
@@ -1783,8 +1767,7 @@ function assertRequestedModelSupported(params) {
|
|
|
1783
1767
|
throw new RequestedModelUnsupportedError(`Cannot ${params.context === "replay" ? "replay saved model" : "apply --model"} "${params.requestedModel}": the ACP agent did not advertise that model. Available models: ${formatAvailableModelIds(params.models)}.`, "unadvertised-model");
|
|
1784
1768
|
}
|
|
1785
1769
|
}
|
|
1786
|
-
|
|
1787
|
-
//#region src/acp/ndjson-stream.ts
|
|
1770
|
+
// src/acp/ndjson-stream.ts
|
|
1788
1771
|
const DEFAULT_MAX_ACP_MESSAGE_BYTES = 67108864;
|
|
1789
1772
|
var AcpMessageLimitError = class extends AcpxOperationalError {
|
|
1790
1773
|
constructor(limit) {
|
|
@@ -1875,8 +1858,7 @@ function createNdJsonMessageStream(agentCommand, output, input, maxMessageBytes,
|
|
|
1875
1858
|
} })
|
|
1876
1859
|
};
|
|
1877
1860
|
}
|
|
1878
|
-
|
|
1879
|
-
//#region src/acp/observed-stream.ts
|
|
1861
|
+
// src/acp/observed-stream.ts
|
|
1880
1862
|
function observeAcpStream(base, options) {
|
|
1881
1863
|
const elicitationRequestIds = /* @__PURE__ */ new Set();
|
|
1882
1864
|
const shouldSuppressInboundReplaySessionUpdate = (message) => {
|
|
@@ -1943,8 +1925,7 @@ function promptRequestOwner(message) {
|
|
|
1943
1925
|
sessionId
|
|
1944
1926
|
} : void 0;
|
|
1945
1927
|
}
|
|
1946
|
-
|
|
1947
|
-
//#region src/acp/session-control-errors.ts
|
|
1928
|
+
// src/acp/session-control-errors.ts
|
|
1948
1929
|
const SESSION_CONTROL_UNSUPPORTED_ACP_CODES = /* @__PURE__ */ new Set([-32601, -32602]);
|
|
1949
1930
|
function asRecord$1(value) {
|
|
1950
1931
|
if (!value || typeof value !== "object" || Array.isArray(value)) return;
|
|
@@ -1970,8 +1951,7 @@ function maybeWrapSessionControlError(method, error, context) {
|
|
|
1970
1951
|
wrapped.acp = acp;
|
|
1971
1952
|
return wrapped;
|
|
1972
1953
|
}
|
|
1973
|
-
|
|
1974
|
-
//#region src/acp/terminal-manager.ts
|
|
1954
|
+
// src/acp/terminal-manager.ts
|
|
1975
1955
|
const DEFAULT_TERMINAL_OUTPUT_LIMIT_BYTES = 65536;
|
|
1976
1956
|
const DEFAULT_KILL_GRACE_MS = 1500;
|
|
1977
1957
|
function nowIso() {
|
|
@@ -2487,8 +2467,7 @@ function hasLivePid(pids) {
|
|
|
2487
2467
|
}
|
|
2488
2468
|
return false;
|
|
2489
2469
|
}
|
|
2490
|
-
|
|
2491
|
-
//#region src/acp/client.ts
|
|
2470
|
+
// src/acp/client.ts
|
|
2492
2471
|
const REPLAY_IDLE_MS = 80;
|
|
2493
2472
|
const REPLAY_DRAIN_TIMEOUT_MS = 5e3;
|
|
2494
2473
|
const DRAIN_POLL_INTERVAL_MS = 20;
|
|
@@ -4040,8 +4019,7 @@ var AcpClient = class {
|
|
|
4040
4019
|
await this.waitForSessionUpdateDrain(options?.idleMs ?? 0, options?.timeoutMs ?? 0);
|
|
4041
4020
|
}
|
|
4042
4021
|
};
|
|
4043
|
-
|
|
4044
|
-
//#region src/session/model-state.ts
|
|
4022
|
+
// src/session/model-state.ts
|
|
4045
4023
|
function configOptionsAreAuthoritative(state) {
|
|
4046
4024
|
return state.model_control === "config_option";
|
|
4047
4025
|
}
|
|
@@ -4088,8 +4066,7 @@ function applyConfigOptionsModelState(state, configOptions) {
|
|
|
4088
4066
|
else if (preservesLegacyControl) state.model_control = "legacy_set_model";
|
|
4089
4067
|
else clearAdvertisedModelState(state);
|
|
4090
4068
|
}
|
|
4091
|
-
|
|
4092
|
-
//#region src/session/conversation-reducer.ts
|
|
4069
|
+
// src/session/conversation-reducer.ts
|
|
4093
4070
|
function resolveUserMessageId(value) {
|
|
4094
4071
|
return typeof value === "string" ? value : value();
|
|
4095
4072
|
}
|
|
@@ -4536,8 +4513,7 @@ function applySessionInfoUpdate(conversation, update) {
|
|
|
4536
4513
|
if (hasOwn(update, "title")) conversation.title = update.title ?? null;
|
|
4537
4514
|
if (hasOwn(update, "updatedAt")) conversation.updated_at = update.updatedAt ?? conversation.updated_at;
|
|
4538
4515
|
}
|
|
4539
|
-
|
|
4540
|
-
//#region src/session/conversation-retention.ts
|
|
4516
|
+
// src/session/conversation-retention.ts
|
|
4541
4517
|
const MAX_RUNTIME_MESSAGES = 200;
|
|
4542
4518
|
const MAX_RUNTIME_AGENT_TEXT_CHARS = 8e3;
|
|
4543
4519
|
const MAX_RUNTIME_THINKING_CHARS = 4e3;
|
|
@@ -4582,8 +4558,7 @@ function trimRuntimeToolResult(result) {
|
|
|
4582
4558
|
if ("Text" in result.content) result.content.Text = trimRuntimeText(result.content.Text, MAX_RUNTIME_TOOL_IO_CHARS);
|
|
4583
4559
|
if (typeof result.output === "string") result.output = trimRuntimeText(result.output, MAX_RUNTIME_TOOL_IO_CHARS);
|
|
4584
4560
|
}
|
|
4585
|
-
|
|
4586
|
-
//#region src/session/conversation-model.ts
|
|
4561
|
+
// src/session/conversation-model.ts
|
|
4587
4562
|
function isoNow() {
|
|
4588
4563
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
4589
4564
|
}
|
|
@@ -4615,8 +4590,7 @@ function recordClientOperation(conversation, state, _operation, timestamp = isoN
|
|
|
4615
4590
|
trimConversationForRuntime(conversation);
|
|
4616
4591
|
return acpx;
|
|
4617
4592
|
}
|
|
4618
|
-
|
|
4619
|
-
//#region src/runtime/engine/lifecycle.ts
|
|
4593
|
+
// src/runtime/engine/lifecycle.ts
|
|
4620
4594
|
function createInitialSessionRecord(params) {
|
|
4621
4595
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4622
4596
|
return {
|
|
@@ -4681,8 +4655,7 @@ function applyConversation(record, conversation) {
|
|
|
4681
4655
|
record.cumulative_cost = conversation.cumulative_cost;
|
|
4682
4656
|
record.request_token_usage = conversation.request_token_usage;
|
|
4683
4657
|
}
|
|
4684
|
-
|
|
4685
|
-
//#region src/runtime/engine/session-options.ts
|
|
4658
|
+
// src/runtime/engine/session-options.ts
|
|
4686
4659
|
function mergeSessionOptions(preferred, fallback) {
|
|
4687
4660
|
const merged = { ...fallback };
|
|
4688
4661
|
assignDefinedOption(merged, "model", preferred?.model);
|
|
@@ -4780,8 +4753,7 @@ function storedMaxTurns(value) {
|
|
|
4780
4753
|
function nonEmptyString(value) {
|
|
4781
4754
|
return typeof value === "string" && value.trim().length > 0 ? value : void 0;
|
|
4782
4755
|
}
|
|
4783
|
-
|
|
4784
|
-
//#region src/session/mode-preference.ts
|
|
4756
|
+
// src/session/mode-preference.ts
|
|
4785
4757
|
function ensureAcpxState(state) {
|
|
4786
4758
|
return state ?? {};
|
|
4787
4759
|
}
|
|
@@ -4826,8 +4798,7 @@ function syncAdvertisedModelState(record, models) {
|
|
|
4826
4798
|
applyAdvertisedModelState(acpx, models);
|
|
4827
4799
|
record.acpx = acpx;
|
|
4828
4800
|
}
|
|
4829
|
-
|
|
4830
|
-
//#region src/session/model-application.ts
|
|
4801
|
+
// src/session/model-application.ts
|
|
4831
4802
|
function currentModelIdFromSetModelResponse(response, fallbackModelId) {
|
|
4832
4803
|
return modelStateFromConfigOptions(response?.configOptions)?.currentModelId ?? fallbackModelId;
|
|
4833
4804
|
}
|
|
@@ -4858,8 +4829,7 @@ async function applyRequestedModelIfAdvertised(params) {
|
|
|
4858
4829
|
response: await withTimeout(params.client.setSessionModel(params.sessionId, requestedModel, params.models, params.authority), params.timeoutMs)
|
|
4859
4830
|
};
|
|
4860
4831
|
}
|
|
4861
|
-
|
|
4862
|
-
//#region src/session/config-options.ts
|
|
4832
|
+
// src/session/config-options.ts
|
|
4863
4833
|
function applyConfigOptionsToState(state, configOptions) {
|
|
4864
4834
|
const acpxState = cloneSessionAcpxState(state) ?? {};
|
|
4865
4835
|
applyConfigOptionsModelState(acpxState, configOptions);
|
|
@@ -4923,8 +4893,7 @@ function applyConfigOptionSelection(state, configId, value, response, modelConfi
|
|
|
4923
4893
|
value
|
|
4924
4894
|
});
|
|
4925
4895
|
}
|
|
4926
|
-
|
|
4927
|
-
//#region src/session/execution/direct-lifetime.ts
|
|
4896
|
+
// src/session/execution/direct-lifetime.ts
|
|
4928
4897
|
function ownDirectClient(client, signal) {
|
|
4929
4898
|
let closing;
|
|
4930
4899
|
const cancel = async () => {
|
|
@@ -4947,8 +4916,7 @@ function ownDirectClient(client, signal) {
|
|
|
4947
4916
|
function directExecutionError(error, signal) {
|
|
4948
4917
|
return signal?.aborted && error instanceof AgentDisconnectedError ? signal.reason : error;
|
|
4949
4918
|
}
|
|
4950
|
-
|
|
4951
|
-
//#region src/runtime/engine/reconnect.ts
|
|
4919
|
+
// src/runtime/engine/reconnect.ts
|
|
4952
4920
|
const SESSION_LOAD_UNSUPPORTED_CODES = /* @__PURE__ */ new Set([-32601, -32602]);
|
|
4953
4921
|
function createReplayState(authority) {
|
|
4954
4922
|
let failure;
|
|
@@ -5348,8 +5316,7 @@ async function createFreshRuntimeSession(client, record, timeoutMs, authority) {
|
|
|
5348
5316
|
createdFreshSession: true
|
|
5349
5317
|
};
|
|
5350
5318
|
}
|
|
5351
|
-
|
|
5352
|
-
//#region src/runtime/engine/connected-session.ts
|
|
5319
|
+
// src/runtime/engine/connected-session.ts
|
|
5353
5320
|
function createActiveSessionController(params) {
|
|
5354
5321
|
const getActiveSessionId = () => params.getActiveSessionId();
|
|
5355
5322
|
return {
|
|
@@ -5459,8 +5426,7 @@ async function withConnectedSession(options) {
|
|
|
5459
5426
|
await options.saveRecord(record).catch(() => {});
|
|
5460
5427
|
}
|
|
5461
5428
|
}
|
|
5462
|
-
|
|
5463
|
-
//#region src/session/execution/prompt-runner.ts
|
|
5429
|
+
// src/session/execution/prompt-runner.ts
|
|
5464
5430
|
function buildDirectConnectedSessionOptions(options, run) {
|
|
5465
5431
|
return {
|
|
5466
5432
|
sessionRecordId: options.sessionRecordId,
|
|
@@ -5566,8 +5532,7 @@ async function runSessionSetConfigOptionDirect(options) {
|
|
|
5566
5532
|
loadError: result.loadError
|
|
5567
5533
|
};
|
|
5568
5534
|
}
|
|
5569
|
-
|
|
5570
|
-
//#region src/session/execution/windows-process-command.ts
|
|
5535
|
+
// src/session/execution/windows-process-command.ts
|
|
5571
5536
|
function skipSeparators(value) {
|
|
5572
5537
|
return value.replace(/^[ \t]+/u, "");
|
|
5573
5538
|
}
|
|
@@ -5649,8 +5614,7 @@ function splitWindowsProcessCommandLine(commandLine) {
|
|
|
5649
5614
|
}
|
|
5650
5615
|
return argv;
|
|
5651
5616
|
}
|
|
5652
|
-
|
|
5653
|
-
//#region src/session/execution/session-control.ts
|
|
5617
|
+
// src/session/execution/session-control.ts
|
|
5654
5618
|
async function cancelSessionPrompt(options) {
|
|
5655
5619
|
const cancelled = await tryCancelOnRunningOwner(options);
|
|
5656
5620
|
return {
|
|
@@ -5860,8 +5824,7 @@ async function closeSession(sessionId) {
|
|
|
5860
5824
|
await ownership[Symbol.asyncDispose]();
|
|
5861
5825
|
}
|
|
5862
5826
|
}
|
|
5863
|
-
|
|
5864
|
-
//#region src/session/execution/session-management.ts
|
|
5827
|
+
// src/session/execution/session-management.ts
|
|
5865
5828
|
async function createSessionRecordWithClient(client, options, resumedRecordId) {
|
|
5866
5829
|
const cwd = absolutePath(options.cwd);
|
|
5867
5830
|
await withTimeout(client.start({ signal: options.signal }), options.timeoutMs);
|
|
@@ -6112,8 +6075,7 @@ async function ensureSessionWithOwnership(options, cwd) {
|
|
|
6112
6075
|
created: true
|
|
6113
6076
|
};
|
|
6114
6077
|
}
|
|
6115
|
-
|
|
6116
|
-
//#region src/perf-metrics-capture.ts
|
|
6078
|
+
// src/perf-metrics-capture.ts
|
|
6117
6079
|
const PERF_METRICS_FILE_ENV = "ACPX_PERF_METRICS_FILE";
|
|
6118
6080
|
let installed = false;
|
|
6119
6081
|
let flushed = false;
|
|
@@ -6197,8 +6159,7 @@ function installPerfMetricsCapture(options = {}) {
|
|
|
6197
6159
|
process.once(signal, handler);
|
|
6198
6160
|
}
|
|
6199
6161
|
}
|
|
6200
|
-
|
|
6201
|
-
//#region src/session/queue/control-admission.ts
|
|
6162
|
+
// src/session/queue/control-admission.ts
|
|
6202
6163
|
var QueueControlDeadline = class {
|
|
6203
6164
|
controller = new AbortController();
|
|
6204
6165
|
admissionSignal;
|
|
@@ -6367,8 +6328,7 @@ var QueueOwnerControlAdmission = class {
|
|
|
6367
6328
|
return operation;
|
|
6368
6329
|
}
|
|
6369
6330
|
};
|
|
6370
|
-
|
|
6371
|
-
//#region src/session/queue/owner-turn-controller.ts
|
|
6331
|
+
// src/session/queue/owner-turn-controller.ts
|
|
6372
6332
|
var QueueOwnerTurnController = class {
|
|
6373
6333
|
state = "idle";
|
|
6374
6334
|
pendingCancel = false;
|
|
@@ -6429,8 +6389,7 @@ var QueueOwnerTurnController = class {
|
|
|
6429
6389
|
return cancelled;
|
|
6430
6390
|
}
|
|
6431
6391
|
};
|
|
6432
|
-
|
|
6433
|
-
//#region src/session/execution/owned-controls.ts
|
|
6392
|
+
// src/session/execution/owned-controls.ts
|
|
6434
6393
|
async function acceptControl(options, invoke, apply, deadline = new QueueControlDeadline()) {
|
|
6435
6394
|
deadline.assertActive();
|
|
6436
6395
|
const raw = invoke(deadline.authority).then(async (response) => {
|
|
@@ -6561,8 +6520,7 @@ async function runIdleOwnerControl(options, invoke) {
|
|
|
6561
6520
|
await ownership[Symbol.asyncDispose]();
|
|
6562
6521
|
}
|
|
6563
6522
|
}
|
|
6564
|
-
|
|
6565
|
-
//#region src/session/execution/queue-owner-process.ts
|
|
6523
|
+
// src/session/execution/queue-owner-process.ts
|
|
6566
6524
|
function isNonEmptyStringArray(value) {
|
|
6567
6525
|
return Array.isArray(value) && value.length > 0 && value.every((entry) => typeof entry === "string" && entry.length > 0);
|
|
6568
6526
|
}
|
|
@@ -6734,8 +6692,7 @@ function spawnQueueOwnerProcess(options, queueOwnerArgs) {
|
|
|
6734
6692
|
stopStartupCapture
|
|
6735
6693
|
};
|
|
6736
6694
|
}
|
|
6737
|
-
|
|
6738
|
-
//#region src/runtime/engine/prompt-turn.ts
|
|
6695
|
+
// src/runtime/engine/prompt-turn.ts
|
|
6739
6696
|
const SESSION_REPLY_IDLE_MS = 1e3;
|
|
6740
6697
|
const SESSION_REPLY_DRAIN_TIMEOUT_MS = 5e3;
|
|
6741
6698
|
function responseMetaField(meta) {
|
|
@@ -6791,8 +6748,7 @@ async function runPromptTurn(params) {
|
|
|
6791
6748
|
lifetime.abort();
|
|
6792
6749
|
}
|
|
6793
6750
|
}
|
|
6794
|
-
|
|
6795
|
-
//#region src/session/live-checkpoint.ts
|
|
6751
|
+
// src/session/live-checkpoint.ts
|
|
6796
6752
|
const DEFAULT_LIVE_CHECKPOINT_INTERVAL_MS = 500;
|
|
6797
6753
|
var LiveSessionCheckpoint = class {
|
|
6798
6754
|
save;
|
|
@@ -6849,8 +6805,7 @@ var LiveSessionCheckpoint = class {
|
|
|
6849
6805
|
}
|
|
6850
6806
|
}
|
|
6851
6807
|
};
|
|
6852
|
-
|
|
6853
|
-
//#region src/session/execution/discard-output.ts
|
|
6808
|
+
// src/session/execution/discard-output.ts
|
|
6854
6809
|
const DISCARD_OUTPUT_FORMATTER = {
|
|
6855
6810
|
setContext() {},
|
|
6856
6811
|
onAcpMessage() {},
|
|
@@ -6858,8 +6813,7 @@ const DISCARD_OUTPUT_FORMATTER = {
|
|
|
6858
6813
|
onPermissionEscalation() {},
|
|
6859
6814
|
flush() {}
|
|
6860
6815
|
};
|
|
6861
|
-
|
|
6862
|
-
//#region src/session/execution/runtime.ts
|
|
6816
|
+
// src/session/execution/runtime.ts
|
|
6863
6817
|
const INTERRUPT_CANCEL_WAIT_MS = 2500;
|
|
6864
6818
|
var QueueTaskOutputFormatter = class {
|
|
6865
6819
|
requestId;
|
|
@@ -7808,8 +7762,7 @@ async function sendSessionDirect(options, control) {
|
|
|
7808
7762
|
await closeProvidedClient?.();
|
|
7809
7763
|
}
|
|
7810
7764
|
}
|
|
7811
|
-
|
|
7812
|
-
//#region src/session/execution/queue-owner-runtime.ts
|
|
7765
|
+
// src/session/execution/queue-owner-runtime.ts
|
|
7813
7766
|
const QUEUE_OWNER_STARTUP_MAX_ATTEMPTS = 120;
|
|
7814
7767
|
const QUEUE_OWNER_HEARTBEAT_INTERVAL_MS = 5e3;
|
|
7815
7768
|
const QUEUE_OWNER_ACTIVE_TURN_CANCEL_GRACE_MS = 750;
|
|
@@ -8218,7 +8171,6 @@ async function sendSession(options) {
|
|
|
8218
8171
|
}
|
|
8219
8172
|
}
|
|
8220
8173
|
const queueOwnerRuntimeTestInternals = { queueOwnerExitIsFatal };
|
|
8221
|
-
//#endregion
|
|
8222
8174
|
export { isRequestedModelUnsupportedError as $, applyInitialModelSelection as A, reconcileAgentSessionId as B, setSessionModeOnOwner as C, connectAndLoadSession as D, withConnectedSession as E, persistSessionOptions as F, recordSessionUpdate as G, createSessionConversation as H, sessionOptionsFromRecord as I, advertisedModelState as J, trimConversationForRuntime as K, applyConversation as L, applyRequestedModelIfAdvertised as M, setDesiredModeId as N, applyConfigOptionSelection as O, normalizeSessionOptionShape as P, RequestedModelUnsupportedError as Q, applyLifecycleSnapshotToRecord as R, setSessionMode as S, setSessionModelOnOwner as T, recordClientOperation as U, cloneSessionConversation as V, recordPromptSubmission as W, REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE as X, AcpClient as Y, REQUESTED_MODEL_UNSUPPORTED_REASONS as Z, cancelSessionPrompt as _, runQueuedTask as a, DEFAULT_QUEUE_OWNER_TTL_MS as at, setSessionConfigOption as b, LiveSessionCheckpoint as c, acquireSessionScope as ct, flushPerfMetricsCapture as d, InterruptedError as dt, resolveRequestedConfigOption as et, installPerfMetricsCapture as f, TimeoutError as ft, listAgentSessions as g, ensureSession as h, withTimeout as ht, runOnce as i, permissionModeSatisfies as it, applyModelSelection as j, applyConfigOptionsToRecord as k, runPromptTurn as l, listSessionEvents as lt, createSessionWithClient as m, withInterrupt as mt, runSessionQueueOwner as n, getAcpxVersion as nt, sendSessionDirect as o, normalizeQueueOwnerTtlMs as ot, createSession as p, assertControlAuthority as pt, cloneSessionAcpxState as q, sendSession as r, snapshotEnvNames as rt, DISCARD_OUTPUT_FORMATTER as s, acquireSessionImport as st, queueOwnerRuntimeTestInternals as t, resolveRequestedModelId as tt, buildQueueOwnerArgOverride as u, isLegacyZedCodexAcpInvocation as ut, closeSession as v, setSessionModel as w, setSessionConfigOptionOnOwner as x, sessionControlTestInternals as y, createInitialSessionRecord as z };
|
|
8223
8175
|
|
|
8224
|
-
//# sourceMappingURL=queue-owner-runtime-
|
|
8176
|
+
//# sourceMappingURL=queue-owner-runtime-B0mPqOu4.js.map
|