orkestrator 2.37.1-beta → 2.37.4-beta
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/client.js +454 -23
- package/dist/main.js +185742 -168918
- package/package.json +3 -3
- package/resources/acp-bridge/dist/index.js +229 -77
- package/resources/claude-bridge/dist/index.js +395 -169
- package/resources/codex-bridge/dist/index.js +270 -90
- package/resources/cursor-bridge/dist/index.js +1375 -397
- package/resources/cursor-bridge/runtime/install.json +1 -1
- package/resources/pi-bridge/dist/index.js +382 -133
- package/resources/pi-bridge/runtime/install.json +1 -1
|
@@ -262,6 +262,58 @@ var PROTECTED_SEGMENTS = new Set([
|
|
|
262
262
|
".mcp.json"
|
|
263
263
|
]);
|
|
264
264
|
|
|
265
|
+
// ../protocol/src/agent-mail.ts
|
|
266
|
+
var AGENT_MAIL_MAX_BODY_BYTES = 32 * 1024;
|
|
267
|
+
var AGENT_MAIL_MAX_STORE_BYTES = 32 * 1024 * 1024;
|
|
268
|
+
var AGENT_MAIL_DEFAULT_RETENTION_DAYS = 14;
|
|
269
|
+
var AGENT_MAIL_MAX_ATTACHMENT_BYTES = 8 * 1024 * 1024;
|
|
270
|
+
var AGENT_MAIL_MAX_TOTAL_ATTACHMENT_BYTES = 32 * 1024 * 1024;
|
|
271
|
+
var AGENT_MAIL_DEFAULT_AUTONOMOUS_WAKE_BUDGET = 16;
|
|
272
|
+
var AGENT_MAIL_DEFAULT_HOURLY_WAKE_LIMIT = 40;
|
|
273
|
+
var AGENT_MAIL_TOOL_NAMES = Object.freeze([
|
|
274
|
+
"list_mailboxes",
|
|
275
|
+
"send_message",
|
|
276
|
+
"check_inbox",
|
|
277
|
+
"read_message",
|
|
278
|
+
"ack_message",
|
|
279
|
+
"reply_message",
|
|
280
|
+
"get_message_status"
|
|
281
|
+
]);
|
|
282
|
+
var DEFAULT_AGENT_MESSAGING_SETTINGS = Object.freeze({
|
|
283
|
+
enabled: true,
|
|
284
|
+
allowCrossProject: false,
|
|
285
|
+
defaultInjectPolicy: "off",
|
|
286
|
+
wakePeers: false,
|
|
287
|
+
autonomousWakeBudget: AGENT_MAIL_DEFAULT_AUTONOMOUS_WAKE_BUDGET,
|
|
288
|
+
hourlyWakeLimit: AGENT_MAIL_DEFAULT_HOURLY_WAKE_LIMIT,
|
|
289
|
+
coordinatorStatusWakes: "settled",
|
|
290
|
+
retentionDays: AGENT_MAIL_DEFAULT_RETENTION_DAYS,
|
|
291
|
+
paused: false
|
|
292
|
+
});
|
|
293
|
+
function agentMailCapabilities(tabType, agent, locked = true) {
|
|
294
|
+
if (tabType === "agent-native") {
|
|
295
|
+
if (!locked || !agent)
|
|
296
|
+
return { canPull: false, canSend: false, canInject: false };
|
|
297
|
+
if (agent === "claude" || agent === "codex" || agent === "opencode" || agent === "pi" || agent === "cursor" || agent === "grok") {
|
|
298
|
+
return { canPull: true, canSend: true, canInject: true };
|
|
299
|
+
}
|
|
300
|
+
return { canPull: false, canSend: false, canInject: false };
|
|
301
|
+
}
|
|
302
|
+
if (tabType === "claude-tmux")
|
|
303
|
+
return { canPull: true, canSend: true, canInject: true };
|
|
304
|
+
if (tabType === "pipeline-worker") {
|
|
305
|
+
return agent ? { canPull: true, canSend: true, canInject: true } : { canPull: false, canSend: false, canInject: false };
|
|
306
|
+
}
|
|
307
|
+
if (["claude", "codex", "opencode"].includes(tabType)) {
|
|
308
|
+
return { canPull: true, canSend: true, canInject: false };
|
|
309
|
+
}
|
|
310
|
+
if (["cursor", "grok", "pi"].includes(tabType)) {
|
|
311
|
+
return { canPull: false, canSend: false, canInject: false };
|
|
312
|
+
}
|
|
313
|
+
return { canPull: false, canSend: false, canInject: false };
|
|
314
|
+
}
|
|
315
|
+
var NATIVE_AGENT_MAIL_CAPABILITIES = Object.freeze(Object.fromEntries(AGENT_PLATFORMS.map((agent) => [agent, agentMailCapabilities("agent-native", agent)])));
|
|
316
|
+
|
|
265
317
|
// ../protocol/src/review-evidence-frames.ts
|
|
266
318
|
var SYSTEM_INSTRUCTIONS_FRAME_OPEN = "<orkestrator-system-instructions>";
|
|
267
319
|
var SYSTEM_INSTRUCTIONS_FRAME_CLOSE = "</orkestrator-system-instructions>";
|
|
@@ -883,6 +935,11 @@ var BACKGROUND_CAPABLE_SHELL_TOOL_NAMES = new Set([
|
|
|
883
935
|
"run_terminal_cmd",
|
|
884
936
|
"execute_command"
|
|
885
937
|
]);
|
|
938
|
+
var NATIVE_AGENT_BRANCH_LIST_LIMITS = Object.freeze({
|
|
939
|
+
branches: 50,
|
|
940
|
+
promptChars: 280,
|
|
941
|
+
entryIdChars: 512
|
|
942
|
+
});
|
|
886
943
|
var NATIVE_AGENT_COMMAND_EXECUTION_KINDS = [
|
|
887
944
|
"provider-prompt",
|
|
888
945
|
"provider-command",
|
|
@@ -1513,12 +1570,22 @@ var DESKTOP_LOG_AREAS = defineLogAreas({
|
|
|
1513
1570
|
denied: "A renderer asked for a permission the policy does not grant."
|
|
1514
1571
|
}
|
|
1515
1572
|
},
|
|
1573
|
+
"desktop.webrequest": {
|
|
1574
|
+
description: "Main-process webRequest listeners on Electron sessions. Listener names only; never a URL, header or error message.",
|
|
1575
|
+
events: {
|
|
1576
|
+
"listener.failed-closed": "A listener's decision threw or rejected, so it answered with its fail-closed response.",
|
|
1577
|
+
"observer.failed": "A listener with no callback (a redirect observer) threw; its fallback ran.",
|
|
1578
|
+
"callback.failed": "Electron's webRequest callback threw while a listener answered.",
|
|
1579
|
+
...THROTTLE_LOG_EVENTS
|
|
1580
|
+
}
|
|
1581
|
+
},
|
|
1516
1582
|
"desktop.dialog": {
|
|
1517
1583
|
description: "Native dialogs, whose modal loops hold the main thread while they are open.",
|
|
1518
1584
|
events: {
|
|
1519
1585
|
"attention-failed": "A dialog could not ask for the user's attention.",
|
|
1520
1586
|
closed: "A native dialog closed.",
|
|
1521
1587
|
"hidden-cancelled": "A hidden profile cancelled a dialog without opening native UI.",
|
|
1588
|
+
"no-display-cancelled": "A headless Electron with no display cancelled a dialog instead of opening native UI.",
|
|
1522
1589
|
"open-failed": "A dialog could not open; it was answered as cancelled.",
|
|
1523
1590
|
opening: "A native dialog is opening.",
|
|
1524
1591
|
"preview-beforeunload-ignored": "A browser preview's beforeunload handler was ignored.",
|
|
@@ -1601,6 +1668,9 @@ var ENVIRONMENT_LOG_AREAS = defineLogAreas({
|
|
|
1601
1668
|
"setup.record-failure-failed": "A setup failure before its first attempt could not be recorded.",
|
|
1602
1669
|
"setup.tab-publish-failed": "The setup terminal's tab could not be published.",
|
|
1603
1670
|
"lifecycle.failed": "Starting, rebuilding or recreating an environment failed; `operation` says which.",
|
|
1671
|
+
"git-https-probe.failed": "Checking whether a project's GitHub remote works over HTTPS failed; `reason` says why.",
|
|
1672
|
+
"git-https-remedy.failed": "Deciding whether to offer HTTPS after an SSH failure threw; no remedy is offered.",
|
|
1673
|
+
"git-origin.switched-to-https": "A project's origin remote was switched from GitHub SSH to HTTPS at the user's request.",
|
|
1604
1674
|
"tab-teardown.pending": "A tab's teardown failed and stays pending; the reconcile sweep retries.",
|
|
1605
1675
|
"tab-reconcile.skipped": "Orphaned tab reconciliation was skipped because pane layouts are unreadable.",
|
|
1606
1676
|
"orphan-session.reaped": "A native session no tab references was torn down.",
|
|
@@ -1871,11 +1941,38 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
1871
1941
|
"agent-tools.unavailable": "OpenCode agent tools remain unavailable for a session.",
|
|
1872
1942
|
"coordinator-servers.unavailable": "OpenCode coordinator research servers are unavailable.",
|
|
1873
1943
|
"monitor.reconnecting": "The request monitor lost its stream and is reconnecting. Error class only.",
|
|
1944
|
+
"monitor.silent": "The request monitor's stream stopped heartbeating, so it is replaced. `silenceMs` only.",
|
|
1874
1945
|
"worker-limit.reached": "The bounded request workers are full, so the stream restarts and a snapshot reconciles.",
|
|
1875
1946
|
"request.failed": "Handling a request event failed, so the stream restarts. Error class only.",
|
|
1876
1947
|
"credential-plugin.skipped": "A host OpenCode server started without the credential plugin, so its tools inherit its password; `reason` says why.",
|
|
1877
1948
|
"host-database.separated": "Host OpenCode uses Orkestrator's own database because the shared one has no `session` table (an OpenCode 2 database); `reason` says why.",
|
|
1878
|
-
"host-database.unreadable": "The shared OpenCode database could not be inspected, so host OpenCode opens it as usual. Error class only."
|
|
1949
|
+
"host-database.unreadable": "The shared OpenCode database could not be inspected, so host OpenCode opens it as usual. Error class only.",
|
|
1950
|
+
"login.opencode2-mirror-failed": "A provider sign-in change reached OpenCode 1 but could not be copied into the OpenCode 2 database; the user is told to retry. Error class only."
|
|
1951
|
+
}
|
|
1952
|
+
},
|
|
1953
|
+
"native-agent.opencode2": {
|
|
1954
|
+
description: "The OpenCode 2.x provider: its event monitor, steering, routing, host and container servers.",
|
|
1955
|
+
events: {
|
|
1956
|
+
"events.dropped": "The 2.x event stream ended or failed, so reads go to the server until it reconnects. Error class only.",
|
|
1957
|
+
"steer.unconfirmed": "A 2.x steer got no definite answer, so its delivery is reconciled from history. Error class only.",
|
|
1958
|
+
"provider.dispose-failed": "Disposing the 2.x provider of a replaced server failed. Error class only.",
|
|
1959
|
+
"transcript.unknown-row": "A 2.x history row of a kind the transcript does not know was dropped (a newer server). Its kind name only, once per kind.",
|
|
1960
|
+
"mcp.remove-failed": "Removing a closed session's Orkestrator MCP server from the 2.x server failed. Error class only.",
|
|
1961
|
+
"protocol.select-failed": "A workflow could not read the OpenCode line setting, so its new session takes 1.x. Error class only.",
|
|
1962
|
+
"host-server.ready": "A local environment's (or a coordinator conversation's) 2.x server answered `/api/info` as 2.x. Environment id, pid and whether it is a coordinator's only.",
|
|
1963
|
+
"coordinator-research.unavailable": "A coordinator's 2.x server could not register its research servers, so the conversation runs without them until the server restarts. Error class only.",
|
|
1964
|
+
"host-server.terminate-failed": "A 2.x server that did not become ready could not be stopped; its process entry is kept for shutdown. Error class only.",
|
|
1965
|
+
"container-server.launched": "The start script of a container environment's 2.x server was run. Container port only.",
|
|
1966
|
+
"container-server.ready": "A container environment's 2.x server this backend started answered `/api/info` as 2.x. Environment id only.",
|
|
1967
|
+
"container-server.cleanup-failed": "Cleanup after OpenCode startup failed; step names only, while the original startup error is preserved.",
|
|
1968
|
+
"container-server.warm-incomplete": "The first workspace request to a container's new 2.x server failed, so its plugins load on the next one. Error class only.",
|
|
1969
|
+
"resume-list.unavailable": "The 2.x sessions could not be listed for the resume picker, so it shows the 1.x list alone. Error class only.",
|
|
1970
|
+
"credential.mirrored": "A provider sign-in change was copied into the 2.x database. `outcome` (written, removed, unchanged, skipped) only; never a provider id or value.",
|
|
1971
|
+
"credential.server-exit-unclean": "The private 2.x server started to copy a sign-in did not stop cleanly. Error class only.",
|
|
1972
|
+
"user-config.mirror-failed": "The user's global OpenCode configuration could not be mirrored for a host 2.x server, which starts without it. Error class only.",
|
|
1973
|
+
"user-config.unreadable": "A file of the user's OpenCode configuration could not be read for the 2.x mirror. `source`, the file's name and the error code only.",
|
|
1974
|
+
"user-config.rejected": "Files of the user's OpenCode configuration are not a JSONC object, so the 2.x mirror leaves them out. `source` and file names only, never contents.",
|
|
1975
|
+
"user-config.plugins-withheld": "The user's OpenCode configuration lists plugins, which the 2.x mirror leaves out (1.x plugins do not run on 2.x). `source` only."
|
|
1879
1976
|
}
|
|
1880
1977
|
}
|
|
1881
1978
|
});
|
|
@@ -2102,6 +2199,7 @@ var TMUX_LOG_AREAS = defineLogAreas({
|
|
|
2102
2199
|
"cleanup.skipped": "Environment tmux cleanup was skipped because tmux could not be reached and nothing required it.",
|
|
2103
2200
|
"cleanup.environments-load-failed": "Environments could not be loaded during tmux cleanup, so it stays incomplete.",
|
|
2104
2201
|
"cleanup.kill-failed": "An environment's tmux sessions could not be killed.",
|
|
2202
|
+
"cleanup.kill-incomplete": "An environment's tmux sessions could not all be shown gone (a session survived, or the socket was unreachable while another tmux process might own it), so cleanup stays incomplete.",
|
|
2105
2203
|
"hooks.uninstall-failed": "Workspace hooks could not be uninstalled.",
|
|
2106
2204
|
"hooks.git-exclude-failed": "The git exclude for Claude's local settings could not be set.",
|
|
2107
2205
|
"naming.prepare-failed": "First-prompt naming could not be prepared; the prompt still goes ahead.",
|
|
@@ -2231,6 +2329,7 @@ var STORAGE_LOG_AREAS = defineLogAreas({
|
|
|
2231
2329
|
"config.restrict-mode-failed": "A config file holding provider secrets could not be set to owner-only; the backend carries on.",
|
|
2232
2330
|
"legacy-json.moved": "JSON store files written after the SQLite migration were archived, not imported.",
|
|
2233
2331
|
"legacy-json.archive-failed": "Imported JSON store files could not be archived.",
|
|
2332
|
+
"native-session-owners.backfill-failed": "Native-session rows could not be given their environment as owner at open; an environment delete then parses those rows instead, and the next open retries.",
|
|
2234
2333
|
"lease.timed-out": "A waiter gave up on a lease; `lease` and `family` name it, `holderAgeMs` is the time since its holder's last heartbeat (null when the holder had just gone), `waitedMs` how long the waiter waited.",
|
|
2235
2334
|
"lease.heartbeat-failed": "A held lease's heartbeat failed, which shortens the lease; the next one retries.",
|
|
2236
2335
|
"scrub.vacuum-failed": "Deleted-content page reclamation failed; the checkpoint is attempted independently.",
|
|
@@ -2280,6 +2379,7 @@ var BUILD_PIPELINE_LOG_AREAS = defineLogAreas({
|
|
|
2280
2379
|
"transcripts.maintenance-failed": "Migrating or sweeping stage transcripts failed; the next start retries.",
|
|
2281
2380
|
"restore.skipped": "A pipeline could not be restored at startup and was skipped.",
|
|
2282
2381
|
"criteria.record-failed": "Acceptance criteria results could not be recorded on the ticket.",
|
|
2382
|
+
"completion-notes.publish-failed": "A finished pipeline's notes tab could not be added to the layout; the run stays complete.",
|
|
2283
2383
|
"workspace.waiting": "A pipeline is waiting for its workspace; written once per reason.",
|
|
2284
2384
|
"rewind.pending": "A pipeline's code rewind has not finished; written once per reason.",
|
|
2285
2385
|
"kanban.status-failed": "A restarted pipeline's Kanban status could not be set; it retries shortly.",
|
|
@@ -2321,6 +2421,8 @@ var CHANGE_TRACKING_LOG_AREAS = defineLogAreas({
|
|
|
2321
2421
|
"dispatch.record-failed": "Recording a turn's dispatch outcome failed.",
|
|
2322
2422
|
"turn.finalize-failed": "Finalizing a turn failed.",
|
|
2323
2423
|
"turn.settle-failed": "Settling a late interrupted turn failed.",
|
|
2424
|
+
"turn.end-recovery": "A background retry of a turn end capture that timed out finished: recovered, done (no longer eligible) or exhausted.",
|
|
2425
|
+
"turn.end-recovery-failed": "A background retry of a turn end capture threw; it counts as a failed attempt.",
|
|
2324
2426
|
"evidence.pull-failed": "Pulling change evidence from a bridge failed; a later pull retries.",
|
|
2325
2427
|
"measurement.failed": "Recomputing a tool's measurement failed."
|
|
2326
2428
|
}
|
|
@@ -2389,6 +2491,7 @@ var COORDINATOR_LOG_AREAS = defineLogAreas({
|
|
|
2389
2491
|
"node-release.no-coordinator": "Work closed on a released node belonged to a coordinator that no longer exists, so nobody was told.",
|
|
2390
2492
|
"node-offline.notice-failed": "The notice that a node has been unreachable for a day could not be sent; the next failed read retries.",
|
|
2391
2493
|
"node-offline.check-failed": "Whether a long-unreachable node's coordinators were told could not be checked; the next read retries.",
|
|
2494
|
+
"node-reconnect.notice-failed": "The message that a node a coordinator tried while it was disconnected is back could not be sent; it is not retried, since the coordinator already holds the refusal.",
|
|
2392
2495
|
"checkout.merge-followed": "After an environment's PR merged, the project checkout was fast-forwarded, or `outcome` says why not.",
|
|
2393
2496
|
"checkout.merge-follow-failed": "Fast-forwarding the project checkout failed, after an environment's PR merged or before mail woke the main coordinator.",
|
|
2394
2497
|
"checkout.mail-follow": "Before mail woke the main coordinator, the project checkout was fast-forwarded (`fast-forwarded-fetched` when the fetch was slow or failed and the upstream commit already fetched was merged), or `outcome` says why not (`timed-out`, `failed`).",
|
|
@@ -2441,7 +2544,8 @@ var REVIEW_LOG_AREAS = defineLogAreas({
|
|
|
2441
2544
|
"monitor.task-store-failed": "A pull request could not be recorded on its Kanban task.",
|
|
2442
2545
|
"monitor.merged-tickets-closed": "The startup sweep moved Kanban tickets whose pull request had merged to done (`count`).",
|
|
2443
2546
|
"monitor.merged-tickets-close-failed": "The startup sweep closing Kanban tickets whose pull request merged failed; the next backend start retries.",
|
|
2444
|
-
"monitor.emit-failed": "A pull request monitor event could not be emitted to its sink."
|
|
2547
|
+
"monitor.emit-failed": "A pull request monitor event could not be emitted to its sink.",
|
|
2548
|
+
"branch-cleanup.kept": "A merge or cleanup kept a pull request's head branch because it is not the branch created for the environment (`reason`)."
|
|
2445
2549
|
}
|
|
2446
2550
|
}
|
|
2447
2551
|
});
|
|
@@ -2473,6 +2577,8 @@ var AGENT_ACCOUNTS_LOG_AREAS = defineLogAreas({
|
|
|
2473
2577
|
"kept-note.failed": "Recording why a limit stop found no account to move to failed; the stop stands.",
|
|
2474
2578
|
"container-sync.failed": "Handing a login or account to a container failed; `step` says which part.",
|
|
2475
2579
|
"last-usage.save-failed": "The last plan usage reading could not be saved; the next save retries.",
|
|
2580
|
+
"shared-usage.save-failed": "The shared usage readings could not be saved; they stay in memory and the next reading saves them.",
|
|
2581
|
+
"shared-usage.record-failed": "A fresh usage reading could not be kept for sharing with other machines; the account's own reading stands.",
|
|
2476
2582
|
"login-cleanup.failed": "A temporary login could not be cleaned up.",
|
|
2477
2583
|
"login-renewal.failed": "Renewing an idle account's sign-in to read its usage failed; it is retried after a backoff.",
|
|
2478
2584
|
"login-renewal.not-extended": "Claude Code ran to renew an idle account's sign-in, but its token is still lapsed.",
|
|
@@ -2490,6 +2596,7 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
2490
2596
|
"git-mirror.mount-unavailable": "A new container gets no project Git mirror, so its clone goes to the remote.",
|
|
2491
2597
|
"git-mirror.mount-withheld": "A new restricted container gets no project Git mirror because its firewall would not let it reach the project's remote, so it cannot read what the remote serves through the mirror either.",
|
|
2492
2598
|
"git-mirror.refreshed": "A project's Git mirror was built or updated.",
|
|
2599
|
+
"git-mirror.access-changed": "A project's Git mirror was withdrawn because containers are now given a different credential (another access kind, or a token acting as another or an unreadable account), so no reader keeps what it could not fetch itself.",
|
|
2493
2600
|
"git-mirror.seeded": "A project's Git mirror was built from its host checkout and only what the remote added to it.",
|
|
2494
2601
|
"git-mirror.seed-skipped": "A project's host checkout could not seed its Git mirror, so the build downloads everything.",
|
|
2495
2602
|
"git-mirror.refresh-failed": "A project's Git mirror could not be updated. New clones still work, from the mirror as it was or from the remote.",
|
|
@@ -2503,6 +2610,9 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
2503
2610
|
"git-mirror.clone-fallback": "A new environment could not clone from its project's Git mirror and cloned from the remote.",
|
|
2504
2611
|
"project-seed.refused": "A project .env, .env.local or opencode.json was not copied into a new container: a link, not a regular file, outside the project, too large or unreadable.",
|
|
2505
2612
|
"opencode.warm-incomplete": "OpenCode did not finish loading /workspace in a container.",
|
|
2613
|
+
"opencode.listener-replaced": "The process on a container's OpenCode port (`provider`: `opencode` or `opencode2`) is not the server the backend launched and recorded, so its password was withheld and the next start replaces it. `stage` is `request` when the re-check after a refused connection or an unexpected answer found it (to-do 7550); that connection then sends nothing more.",
|
|
2614
|
+
"opencode.project-config-too-large": "A checkout's opencode.json or opencode.jsonc was larger than the limit, so a launched OpenCode server does not read it. File name only.",
|
|
2615
|
+
"opencode.project-config-filtered": "Values were left out of a checkout's OpenCode configuration before a launched server reads it (to-do 7550): counts of plugin keys, `{env:}` and `{file:}` references and dropped instructions (including separate instructionGlob and instructionUrl counts), and the names of files that were not a JSONC object. Never values.",
|
|
2506
2616
|
"log-driver.unbounded": "The Docker daemon offers neither the local nor the json-file log driver, so new containers keep its default driver, whose log may be uncapped. Written once per backend.",
|
|
2507
2617
|
"lifecycle-event.reconcile-failed": "Reconciling an environment after a container start or stop event failed; the next status read retries.",
|
|
2508
2618
|
"login-keeper.pass-failed": "A Claude login keeper pass failed; the next interval retries.",
|
|
@@ -2537,6 +2647,17 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
2537
2647
|
description: "A bridge process was launched in a container, for the first time there or as a relaunch; `provider` names it. A relaunch keeps the run before it in the previous log.",
|
|
2538
2648
|
essential: true,
|
|
2539
2649
|
fields: { provider: "label", containerPort: "number" }
|
|
2650
|
+
},
|
|
2651
|
+
"bridge.listener-refused": {
|
|
2652
|
+
description: "The socket listening on a container bridge's port is not the one the bridge the backend started opened (to-do 7250), so its token is not handed out and the next start replaces it. `reason` is a fixed label: `different-socket`, `several-sockets`, `pending` (a start has not recorded its bridge yet, or failed before it did) or `scan-incomplete`.",
|
|
2653
|
+
essential: true,
|
|
2654
|
+
fields: { provider: "label", reason: "label" }
|
|
2655
|
+
},
|
|
2656
|
+
"bridge.listener-adopted": "A running container bridge had no listener record, because a backend from before the record started it, so the socket on its port was recorded as the bridge's; `provider` names it.",
|
|
2657
|
+
"bridge.listener-unrecorded": {
|
|
2658
|
+
description: "A bridge the backend just launched could not be recorded as its port's listener, for the fixed `reason` given (`no-listener`, `several-sockets`, `launch-exited` or `scan-incomplete`); what listens on the port is stopped and the start fails.",
|
|
2659
|
+
essential: true,
|
|
2660
|
+
fields: { provider: "label", reason: "label" }
|
|
2540
2661
|
}
|
|
2541
2662
|
}
|
|
2542
2663
|
},
|
|
@@ -2591,7 +2712,8 @@ var MCP_LOG_AREAS = defineLogAreas({
|
|
|
2591
2712
|
"listener.port-free": "The Control MCP's fixed port is free again, so it is listening.",
|
|
2592
2713
|
"state-listener.failed": "A Control MCP state listener threw; the others still run.",
|
|
2593
2714
|
"delegation.remote-open-failed": "A delegation could not be opened on another node.",
|
|
2594
|
-
"delegation.open-failed": "A coordinator delegation could not be opened."
|
|
2715
|
+
"delegation.open-failed": "A coordinator delegation could not be opened.",
|
|
2716
|
+
"delegation.turn-origin-unreadable": "A coordinator's last turn origin could not be read, so its delegated prompt is marked as arising from agent mail."
|
|
2595
2717
|
}
|
|
2596
2718
|
},
|
|
2597
2719
|
"mcp-management": {
|
|
@@ -2676,6 +2798,7 @@ var NODES_LOG_AREAS = defineLogAreas({
|
|
|
2676
2798
|
"ticket-sync.failed": "A Kanban sync with a node failed; it is retried.",
|
|
2677
2799
|
"ticket-sync.unknown-project": "A node sent ticket changes for a project that no longer exists here.",
|
|
2678
2800
|
"ticket-sync.forget-failed": "A detached command node's ticket copies could not be released.",
|
|
2801
|
+
"usage-sync.failed": "Sharing usage readings with a node failed; the next reading or reconnect retries.",
|
|
2679
2802
|
"fleet-update.requested": "The update policy asked an older leaf to install the command node's version.",
|
|
2680
2803
|
"fleet-update.failed": "The update policy could not read or update a leaf; it retries later.",
|
|
2681
2804
|
"fleet-update.policy-load-failed": "The stored update policy could not be read; it is off."
|
|
@@ -2767,6 +2890,20 @@ var SCHEDULER_LOG_AREAS = defineLogAreas({
|
|
|
2767
2890
|
}
|
|
2768
2891
|
});
|
|
2769
2892
|
|
|
2893
|
+
// ../protocol/src/log-vocabulary/self-improvement.ts
|
|
2894
|
+
var SELF_IMPROVEMENT_LOG_AREAS = defineLogAreas({
|
|
2895
|
+
"self-improvement": {
|
|
2896
|
+
description: "Self-improvement runs: diagnostics and conversation review turned into tickets. Counts and steps only, never conversation text.",
|
|
2897
|
+
events: {
|
|
2898
|
+
"run.started": "A run started; `trigger` is manual, daily or dry-run.",
|
|
2899
|
+
"run.finished": "A run finished; `created`, `verified`, `fixFailed` and `parts` count its tickets, confirmed fixes, failed fixes and conversation parts read.",
|
|
2900
|
+
"run.failed": "A run stopped before it finished; `reason` is a fixed label.",
|
|
2901
|
+
"review.call-failed": "One conversation review call failed; the run carries on and the part is read again next run.",
|
|
2902
|
+
"daily.check-failed": "The daily run check failed; the next check retries."
|
|
2903
|
+
}
|
|
2904
|
+
}
|
|
2905
|
+
});
|
|
2906
|
+
|
|
2770
2907
|
// ../protocol/src/log-vocabulary/web-app.ts
|
|
2771
2908
|
var WEB_APP_LOG_AREAS = defineLogAreas({
|
|
2772
2909
|
"web.app": {
|
|
@@ -3102,6 +3239,10 @@ var WEB_SETTINGS_LOG_AREAS = defineLogAreas({
|
|
|
3102
3239
|
"web.settings": {
|
|
3103
3240
|
description: "The settings screens.",
|
|
3104
3241
|
events: {
|
|
3242
|
+
"self-improvement.status-failed": "Settings → Self-improvement could not read the status.",
|
|
3243
|
+
"self-improvement.projects-failed": "Settings → Self-improvement could not list the projects.",
|
|
3244
|
+
"self-improvement.save-failed": "Settings → Self-improvement could not save a setting.",
|
|
3245
|
+
"self-improvement.run-failed": "Settings → Self-improvement could not start a run.",
|
|
3105
3246
|
"config.save-failed": "Global settings could not be saved.",
|
|
3106
3247
|
"config.load-failed": "The settings page could not load the config.",
|
|
3107
3248
|
"config.reload-failed": "Re-reading the workspace config after a save failed.",
|
|
@@ -3271,6 +3412,7 @@ var LOG_VOCABULARY = {
|
|
|
3271
3412
|
...HOST_LOG_AREAS,
|
|
3272
3413
|
...TRANSCRIPT_ARTIFACTS_LOG_AREAS,
|
|
3273
3414
|
...SCHEDULER_LOG_AREAS,
|
|
3415
|
+
...SELF_IMPROVEMENT_LOG_AREAS,
|
|
3274
3416
|
...WEB_APP_LOG_AREAS,
|
|
3275
3417
|
...WEB_BUILD_PIPELINE_LOG_AREAS,
|
|
3276
3418
|
...WEB_CHAT_LOG_AREAS,
|
|
@@ -3571,6 +3713,14 @@ var SIGNALS = new Set([
|
|
|
3571
3713
|
"SIGXFSZ"
|
|
3572
3714
|
]);
|
|
3573
3715
|
var PROVIDERS3 = new Set(["claude", "codex", "opencode", "cursor", "grok", "acp", "pi"]);
|
|
3716
|
+
var BRIDGE_LISTENER_REASONS = new Set([
|
|
3717
|
+
"different-socket",
|
|
3718
|
+
"several-sockets",
|
|
3719
|
+
"pending",
|
|
3720
|
+
"scan-incomplete",
|
|
3721
|
+
"no-listener",
|
|
3722
|
+
"launch-exited"
|
|
3723
|
+
]);
|
|
3574
3724
|
var UUID = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
|
|
3575
3725
|
var SOURCE = new RegExp(`^(?:claude|codex|opencode|cursor|grok|acp|pi):${UUID}$`, "i");
|
|
3576
3726
|
var STORAGE_DATABASES = new Set(["main", "ledger", "other"]);
|
|
@@ -8522,7 +8672,8 @@ var SHARED_RULES = [
|
|
|
8522
8672
|
["auth-failed", /terminal prompts disabled|invalid username or password|bad credentials/i],
|
|
8523
8673
|
["auth-failed", /permission denied \(|permission to \S+ denied|host key verification failed/i],
|
|
8524
8674
|
["auth-failed", /gh auth login|not logged in|unauthorized|http 401|returned error: 40[13]/i],
|
|
8525
|
-
["network-failed", /could not resolve host|connection
|
|
8675
|
+
["network-failed", /could not resolve host|(?:connection|operation) timed out/i],
|
|
8676
|
+
["network-failed", /connection (?:refused|reset)/i],
|
|
8526
8677
|
["network-failed", /network is unreachable|no route to host|temporary failure in name/i],
|
|
8527
8678
|
["network-failed", /early eof|failed to connect|remote end hung up/i],
|
|
8528
8679
|
["network-failed", /unable to access ['"]?https?:\/\//i],
|
|
@@ -13588,6 +13739,11 @@ function toBridgeModel(model) {
|
|
|
13588
13739
|
defaultReasoningEffort: fallbackReasoningId(model.supportedReasoningEfforts.map((entry) => entry.effort), model.defaultReasoningEffort) ?? model.defaultReasoningEffort
|
|
13589
13740
|
};
|
|
13590
13741
|
}
|
|
13742
|
+
// ../protocol/src/terminal-text.ts
|
|
13743
|
+
var MAX_STRING_LENGTH = 8 * 1024;
|
|
13744
|
+
var BUDGET_FLOOR = 4 * 1024;
|
|
13745
|
+
var MAX_MOVE = 4 * 1024;
|
|
13746
|
+
|
|
13591
13747
|
// ../protocol/src/human-prompts.ts
|
|
13592
13748
|
var HUMAN_PROMPT_SCAN_BYTES = 16 * 1024;
|
|
13593
13749
|
var HUMAN_PROMPT_KINDS = new Set([
|
|
@@ -17064,8 +17220,9 @@ class TurnAccumulator {
|
|
|
17064
17220
|
settleEndedAttempt() {
|
|
17065
17221
|
this.interruptOpenAgentMessages();
|
|
17066
17222
|
for (const accumulator of this.items.values()) {
|
|
17067
|
-
if (!accumulator.completed && !accumulator.interrupted)
|
|
17223
|
+
if (!accumulator.completed && !accumulator.interrupted || accumulator.item?.type === "command_execution" && accumulator.item.status === "in_progress") {
|
|
17068
17224
|
this.touch(accumulator);
|
|
17225
|
+
}
|
|
17069
17226
|
}
|
|
17070
17227
|
}
|
|
17071
17228
|
recordRetryCard(id, text, state) {
|
|
@@ -17371,6 +17528,7 @@ function mcpToolCallParts(item) {
|
|
|
17371
17528
|
function commandExecutionParts(item) {
|
|
17372
17529
|
const output = capCommandOutput(item.aggregated_output);
|
|
17373
17530
|
const failed = item.status === "failed";
|
|
17531
|
+
const leftRunning = item.left_running === true && item.status === "in_progress";
|
|
17374
17532
|
return [
|
|
17375
17533
|
{
|
|
17376
17534
|
type: "tool-invocation",
|
|
@@ -17378,7 +17536,9 @@ function commandExecutionParts(item) {
|
|
|
17378
17536
|
content: item.command,
|
|
17379
17537
|
toolName: "bash",
|
|
17380
17538
|
toolArgs: { command: item.command },
|
|
17381
|
-
|
|
17539
|
+
...leftRunning ? { toolLeftRunning: true } : {
|
|
17540
|
+
toolState: item.status === "failed" ? "failure" : item.status === "completed" ? "success" : "pending"
|
|
17541
|
+
},
|
|
17382
17542
|
toolTitle: item.command,
|
|
17383
17543
|
toolOutput: failed ? undefined : output || undefined,
|
|
17384
17544
|
toolError: failed ? output || "Command failed" : undefined,
|
|
@@ -17744,6 +17904,40 @@ function rolloutCommandExecutionParts(item) {
|
|
|
17744
17904
|
});
|
|
17745
17905
|
return adapted?.type === "command_execution" ? commandExecutionParts(adapted) : null;
|
|
17746
17906
|
}
|
|
17907
|
+
|
|
17908
|
+
class ReplayCommandSettlement {
|
|
17909
|
+
slots = new Map;
|
|
17910
|
+
terminal = false;
|
|
17911
|
+
reset() {
|
|
17912
|
+
this.slots.clear();
|
|
17913
|
+
this.terminal = false;
|
|
17914
|
+
}
|
|
17915
|
+
settle() {
|
|
17916
|
+
this.terminal = true;
|
|
17917
|
+
for (const { parts, index } of this.slots.values())
|
|
17918
|
+
this.settlePart(parts[index]);
|
|
17919
|
+
}
|
|
17920
|
+
settlePart(part) {
|
|
17921
|
+
if (this.terminal && part.toolState === "pending") {
|
|
17922
|
+
delete part.toolState;
|
|
17923
|
+
part.toolLeftRunning = true;
|
|
17924
|
+
}
|
|
17925
|
+
}
|
|
17926
|
+
update(id, incoming) {
|
|
17927
|
+
const slot = this.slots.get(id);
|
|
17928
|
+
if (!slot)
|
|
17929
|
+
return false;
|
|
17930
|
+
slot.parts[slot.index] = incoming[0];
|
|
17931
|
+
this.settlePart(slot.parts[slot.index]);
|
|
17932
|
+
return true;
|
|
17933
|
+
}
|
|
17934
|
+
append(id, target, incoming) {
|
|
17935
|
+
const index = target.length;
|
|
17936
|
+
target.push(...incoming);
|
|
17937
|
+
this.slots.set(id, { parts: target, index });
|
|
17938
|
+
this.settlePart(target[index]);
|
|
17939
|
+
}
|
|
17940
|
+
}
|
|
17747
17941
|
// ../protocol/src/coordinator.ts
|
|
17748
17942
|
var COORDINATOR_CODEX_USER_SKILLS_DIR_ENV = "ORKESTRATOR_COORDINATOR_CODEX_USER_SKILLS_DIR";
|
|
17749
17943
|
var COORDINATOR_OTHER_ENVIRONMENTS_SETTING_LABEL = "Let the coordinator use environments it did not create";
|
|
@@ -18880,6 +19074,7 @@ async function replayPersistedRollout(threadId, snapshot, meta, structuredTurns)
|
|
|
18880
19074
|
const messages = [];
|
|
18881
19075
|
const toolPartsByCallId = new Map;
|
|
18882
19076
|
const turnCallIds = new Set;
|
|
19077
|
+
const commandSettlement = new ReplayCommandSettlement;
|
|
18883
19078
|
const transcriptCwd = asNonEmptyString2(meta.cwd) ?? getWorkingDirectory();
|
|
18884
19079
|
let currentTurnId;
|
|
18885
19080
|
let currentTurnModel;
|
|
@@ -19001,6 +19196,8 @@ async function replayPersistedRollout(threadId, snapshot, meta, structuredTurns)
|
|
|
19001
19196
|
const open = [...openCells.values()];
|
|
19002
19197
|
const parts = rolloutCommandExecutionParts(item);
|
|
19003
19198
|
const id = asNonEmptyString2(item.id);
|
|
19199
|
+
if (parts && id && commandSettlement.update(id, parts))
|
|
19200
|
+
return;
|
|
19004
19201
|
const direct = id !== undefined && turnCallIds.has(id);
|
|
19005
19202
|
if (!parts || direct || open.length !== 1) {
|
|
19006
19203
|
for (const cell of open)
|
|
@@ -19009,7 +19206,7 @@ async function replayPersistedRollout(threadId, snapshot, meta, structuredTurns)
|
|
|
19009
19206
|
}
|
|
19010
19207
|
const cell = open[0];
|
|
19011
19208
|
cell.sawCommandRecord = true;
|
|
19012
|
-
cell.message.parts
|
|
19209
|
+
commandSettlement.append(id, cell.message.parts, parts);
|
|
19013
19210
|
};
|
|
19014
19211
|
const visitCompletedItem = (item, timestamp) => {
|
|
19015
19212
|
if (!item || typeof item !== "object" || Array.isArray(item))
|
|
@@ -19132,6 +19329,7 @@ async function replayPersistedRollout(threadId, snapshot, meta, structuredTurns)
|
|
|
19132
19329
|
const recordTurnId = readTurnId(record.payload);
|
|
19133
19330
|
if (recordTurnId && recordTurnId !== currentTurnId) {
|
|
19134
19331
|
settleOpenCells();
|
|
19332
|
+
commandSettlement.reset();
|
|
19135
19333
|
currentTurnId = recordTurnId;
|
|
19136
19334
|
turnCallIds.clear();
|
|
19137
19335
|
typedPromptConsumed = false;
|
|
@@ -19155,7 +19353,10 @@ async function replayPersistedRollout(threadId, snapshot, meta, structuredTurns)
|
|
|
19155
19353
|
}
|
|
19156
19354
|
return;
|
|
19157
19355
|
}
|
|
19356
|
+
if (record.type === "event_msg" && record.payload?.type === "turn_aborted")
|
|
19357
|
+
commandSettlement.settle();
|
|
19158
19358
|
if (record.type === "event_msg" && record.payload?.type === "task_complete") {
|
|
19359
|
+
commandSettlement.settle();
|
|
19159
19360
|
const error = record.payload.error;
|
|
19160
19361
|
if (error && typeof error === "object" && typeof error.message === "string") {
|
|
19161
19362
|
ensureAssistantMessage(timestamp).parts.push({
|
|
@@ -19402,12 +19603,13 @@ function effectiveItem(turn, accumulator) {
|
|
|
19402
19603
|
}
|
|
19403
19604
|
switch (item.type) {
|
|
19404
19605
|
case "command_execution": {
|
|
19405
|
-
|
|
19406
|
-
|
|
19606
|
+
const settled = item.status === "in_progress" && turn.isTerminal() ? { ...item, left_running: true } : item;
|
|
19607
|
+
if (settled.aggregated_output && settled.aggregated_output.length > 0)
|
|
19608
|
+
return settled;
|
|
19407
19609
|
if (accumulator.outputDelta.length === 0)
|
|
19408
|
-
return
|
|
19610
|
+
return settled;
|
|
19409
19611
|
return {
|
|
19410
|
-
...
|
|
19612
|
+
...settled,
|
|
19411
19613
|
aggregated_output: accumulator.outputDelta + (accumulator.outputTruncated ? TRUNCATION_NOTICE : "")
|
|
19412
19614
|
};
|
|
19413
19615
|
}
|
|
@@ -19769,7 +19971,8 @@ async function renderTurn(turn, options) {
|
|
|
19769
19971
|
const accumulator = accumulatorsByKey.get(itemId);
|
|
19770
19972
|
const cached = options.state.completedItemParts.get(itemId);
|
|
19771
19973
|
const suppressDraft = suppressStructuredOutputDraft(turn, options.state, accumulator, item, structuredOutputItemId);
|
|
19772
|
-
|
|
19974
|
+
const leftRunning = item.type === "command_execution" && item.left_running === true;
|
|
19975
|
+
if (accumulator?.completed && cached?.source === accumulator.item && cached.commandChanges === accumulator.commandChanges && cached.leftRunning === true === leftRunning) {
|
|
19773
19976
|
if (!suppressDraft)
|
|
19774
19977
|
parts.push(...cached.parts);
|
|
19775
19978
|
} else {
|
|
@@ -19794,6 +19997,7 @@ async function renderTurn(turn, options) {
|
|
|
19794
19997
|
options.state.completedItemParts.set(itemId, {
|
|
19795
19998
|
source: accumulator.item,
|
|
19796
19999
|
...accumulator.commandChanges ? { commandChanges: accumulator.commandChanges } : {},
|
|
20000
|
+
...leftRunning ? { leftRunning: true } : {},
|
|
19797
20001
|
parts: stampedParts
|
|
19798
20002
|
});
|
|
19799
20003
|
} else {
|
|
@@ -20145,58 +20349,6 @@ async function publishAssistantRows(context, state, turn, options) {
|
|
|
20145
20349
|
// ../../bridges/codex-bridge/src/app-server-runtime-sessions.ts
|
|
20146
20350
|
import { createHash as createHash14, randomUUID as randomUUID9 } from "node:crypto";
|
|
20147
20351
|
|
|
20148
|
-
// ../protocol/src/agent-mail.ts
|
|
20149
|
-
var AGENT_MAIL_MAX_BODY_BYTES = 32 * 1024;
|
|
20150
|
-
var AGENT_MAIL_MAX_STORE_BYTES = 32 * 1024 * 1024;
|
|
20151
|
-
var AGENT_MAIL_DEFAULT_RETENTION_DAYS = 14;
|
|
20152
|
-
var AGENT_MAIL_MAX_ATTACHMENT_BYTES = 8 * 1024 * 1024;
|
|
20153
|
-
var AGENT_MAIL_MAX_TOTAL_ATTACHMENT_BYTES = 32 * 1024 * 1024;
|
|
20154
|
-
var AGENT_MAIL_DEFAULT_AUTONOMOUS_WAKE_BUDGET = 16;
|
|
20155
|
-
var AGENT_MAIL_DEFAULT_HOURLY_WAKE_LIMIT = 40;
|
|
20156
|
-
var AGENT_MAIL_TOOL_NAMES = Object.freeze([
|
|
20157
|
-
"list_mailboxes",
|
|
20158
|
-
"send_message",
|
|
20159
|
-
"check_inbox",
|
|
20160
|
-
"read_message",
|
|
20161
|
-
"ack_message",
|
|
20162
|
-
"reply_message",
|
|
20163
|
-
"get_message_status"
|
|
20164
|
-
]);
|
|
20165
|
-
var DEFAULT_AGENT_MESSAGING_SETTINGS = Object.freeze({
|
|
20166
|
-
enabled: true,
|
|
20167
|
-
allowCrossProject: false,
|
|
20168
|
-
defaultInjectPolicy: "off",
|
|
20169
|
-
wakePeers: false,
|
|
20170
|
-
autonomousWakeBudget: AGENT_MAIL_DEFAULT_AUTONOMOUS_WAKE_BUDGET,
|
|
20171
|
-
hourlyWakeLimit: AGENT_MAIL_DEFAULT_HOURLY_WAKE_LIMIT,
|
|
20172
|
-
coordinatorStatusWakes: "settled",
|
|
20173
|
-
retentionDays: AGENT_MAIL_DEFAULT_RETENTION_DAYS,
|
|
20174
|
-
paused: false
|
|
20175
|
-
});
|
|
20176
|
-
function agentMailCapabilities(tabType, agent, locked = true) {
|
|
20177
|
-
if (tabType === "agent-native") {
|
|
20178
|
-
if (!locked || !agent)
|
|
20179
|
-
return { canPull: false, canSend: false, canInject: false };
|
|
20180
|
-
if (agent === "claude" || agent === "codex" || agent === "opencode" || agent === "pi" || agent === "cursor" || agent === "grok") {
|
|
20181
|
-
return { canPull: true, canSend: true, canInject: true };
|
|
20182
|
-
}
|
|
20183
|
-
return { canPull: false, canSend: false, canInject: false };
|
|
20184
|
-
}
|
|
20185
|
-
if (tabType === "claude-tmux")
|
|
20186
|
-
return { canPull: true, canSend: true, canInject: true };
|
|
20187
|
-
if (tabType === "pipeline-worker") {
|
|
20188
|
-
return agent ? { canPull: true, canSend: true, canInject: true } : { canPull: false, canSend: false, canInject: false };
|
|
20189
|
-
}
|
|
20190
|
-
if (["claude", "codex", "opencode"].includes(tabType)) {
|
|
20191
|
-
return { canPull: true, canSend: true, canInject: false };
|
|
20192
|
-
}
|
|
20193
|
-
if (["cursor", "grok", "pi"].includes(tabType)) {
|
|
20194
|
-
return { canPull: false, canSend: false, canInject: false };
|
|
20195
|
-
}
|
|
20196
|
-
return { canPull: false, canSend: false, canInject: false };
|
|
20197
|
-
}
|
|
20198
|
-
var NATIVE_AGENT_MAIL_CAPABILITIES = Object.freeze(Object.fromEntries(AGENT_PLATFORMS.map((agent) => [agent, agentMailCapabilities("agent-native", agent)])));
|
|
20199
|
-
|
|
20200
20352
|
// ../protocol/src/rich-content-policy.ts
|
|
20201
20353
|
var KIB = 1024;
|
|
20202
20354
|
var MIB = 1024 * KIB;
|
|
@@ -24982,6 +25134,48 @@ function collect(config, exclusions) {
|
|
|
24982
25134
|
}
|
|
24983
25135
|
}
|
|
24984
25136
|
|
|
25137
|
+
// ../protocol/src/node/bounded-wait.ts
|
|
25138
|
+
function boundedWait(work, timeoutMs, options = {}) {
|
|
25139
|
+
return new Promise((resolve, reject) => {
|
|
25140
|
+
let timedOut = false;
|
|
25141
|
+
const timer = setTimeout(() => {
|
|
25142
|
+
timedOut = true;
|
|
25143
|
+
resolve({ settled: false });
|
|
25144
|
+
}, timeoutMs);
|
|
25145
|
+
unrefTimer(timer);
|
|
25146
|
+
Promise.resolve(work).then((value) => {
|
|
25147
|
+
if (!timedOut) {
|
|
25148
|
+
clearTimeout(timer);
|
|
25149
|
+
resolve({ settled: true, value });
|
|
25150
|
+
return;
|
|
25151
|
+
}
|
|
25152
|
+
disposeLate(options.onLate, value);
|
|
25153
|
+
}, (error) => {
|
|
25154
|
+
if (!timedOut) {
|
|
25155
|
+
clearTimeout(timer);
|
|
25156
|
+
reject(error);
|
|
25157
|
+
}
|
|
25158
|
+
});
|
|
25159
|
+
});
|
|
25160
|
+
}
|
|
25161
|
+
function unrefTimer(timer) {
|
|
25162
|
+
const handle = timer;
|
|
25163
|
+
if (typeof handle === "object" && typeof handle.unref === "function")
|
|
25164
|
+
handle.unref();
|
|
25165
|
+
}
|
|
25166
|
+
function disposeLate(onLate, value) {
|
|
25167
|
+
if (!onLate)
|
|
25168
|
+
return;
|
|
25169
|
+
try {
|
|
25170
|
+
const disposal = onLate(value);
|
|
25171
|
+
if (disposal && typeof disposal.then === "function") {
|
|
25172
|
+
Promise.resolve(disposal).catch(() => {
|
|
25173
|
+
return;
|
|
25174
|
+
});
|
|
25175
|
+
}
|
|
25176
|
+
} catch {}
|
|
25177
|
+
}
|
|
25178
|
+
|
|
24985
25179
|
// ../../bridges/codex-bridge/src/engine/mcp-tool-availability.ts
|
|
24986
25180
|
var ORKESTRATOR_MCP_STARTUP_TIMEOUT_SEC = 15;
|
|
24987
25181
|
var MCP_TOOL_AVAILABILITY_TIMEOUT_MS = (ORKESTRATOR_MCP_STARTUP_TIMEOUT_SEC + 5) * 1000;
|
|
@@ -25018,29 +25212,19 @@ async function waitForMcpToolAvailability(list, serverName, toolName, options =
|
|
|
25018
25212
|
const now = options.now ?? Date.now;
|
|
25019
25213
|
const deadline = now() + (options.timeoutMs ?? MCP_TOOL_AVAILABILITY_TIMEOUT_MS);
|
|
25020
25214
|
const pollMs = options.pollMs ?? MCP_TOOL_AVAILABILITY_POLL_MS;
|
|
25021
|
-
const expired = Symbol("availability-deadline");
|
|
25022
25215
|
for (;; ) {
|
|
25023
25216
|
const remainingMs = deadline - now();
|
|
25024
25217
|
if (remainingMs <= 0)
|
|
25025
25218
|
return { state: "unverified" };
|
|
25026
25219
|
let response;
|
|
25027
|
-
let timer;
|
|
25028
25220
|
try {
|
|
25029
|
-
response = await
|
|
25030
|
-
list(remainingMs),
|
|
25031
|
-
new Promise((resolve) => {
|
|
25032
|
-
timer = setTimeout(() => resolve(expired), remainingMs);
|
|
25033
|
-
timer.unref?.();
|
|
25034
|
-
})
|
|
25035
|
-
]);
|
|
25221
|
+
response = await boundedWait(list(remainingMs), remainingMs);
|
|
25036
25222
|
} catch {
|
|
25037
25223
|
return { state: "unverified" };
|
|
25038
|
-
} finally {
|
|
25039
|
-
clearTimeout(timer);
|
|
25040
25224
|
}
|
|
25041
|
-
if (response
|
|
25225
|
+
if (!response.settled || now() >= deadline)
|
|
25042
25226
|
return { state: "unverified" };
|
|
25043
|
-
const availability = classifyMcpToolAvailability(response, serverName, toolName);
|
|
25227
|
+
const availability = classifyMcpToolAvailability(response.value, serverName, toolName);
|
|
25044
25228
|
if (availability)
|
|
25045
25229
|
return availability;
|
|
25046
25230
|
await new Promise((resolve) => {
|
|
@@ -27665,6 +27849,9 @@ class CodexRuntimeSessions {
|
|
|
27665
27849
|
this.ctx = ctx;
|
|
27666
27850
|
this.lifecycle = lifecycle;
|
|
27667
27851
|
}
|
|
27852
|
+
sessionDeleteClaimed(session) {
|
|
27853
|
+
return this.deleteClaims.has(session);
|
|
27854
|
+
}
|
|
27668
27855
|
sessionAdmissionClosed(session) {
|
|
27669
27856
|
return this.ctx.closingSessionIds.has(session.id) || this.ctx.registry.getSession(session.id) !== session;
|
|
27670
27857
|
}
|
|
@@ -30667,16 +30854,8 @@ class CodexRuntimeLifecycle {
|
|
|
30667
30854
|
return false;
|
|
30668
30855
|
if (this.ctx.sessionRestore !== "restoring")
|
|
30669
30856
|
return true;
|
|
30670
|
-
|
|
30671
|
-
|
|
30672
|
-
timer = setTimeout(() => resolve(false), timeoutMs);
|
|
30673
|
-
timer.unref?.();
|
|
30674
|
-
});
|
|
30675
|
-
try {
|
|
30676
|
-
return await Promise.race([this.ctx.sessionsRestored.promise, timedOut]);
|
|
30677
|
-
} finally {
|
|
30678
|
-
clearTimeout(timer);
|
|
30679
|
-
}
|
|
30857
|
+
const restored = await boundedWait(this.ctx.sessionsRestored.promise, timeoutMs);
|
|
30858
|
+
return restored.settled && restored.value;
|
|
30680
30859
|
}
|
|
30681
30860
|
async stop() {
|
|
30682
30861
|
this.ctx.stopping = true;
|
|
@@ -32600,7 +32779,8 @@ class CodexRuntimePrompt {
|
|
|
32600
32779
|
const retryMessages = context.messages;
|
|
32601
32780
|
await this.ctx.journal.markRetryable(requestId);
|
|
32602
32781
|
await new Promise((resolve) => setTimeout(resolve, this.ctx.options.initialPromptRetryDelayMs ?? DEFAULT_INITIAL_PROMPT_RETRY_DELAY_MS));
|
|
32603
|
-
|
|
32782
|
+
const registeredSession = () => this.sessions.sessionDeleteClaimed(session) ? undefined : this.ctx.registry.getSession(session.id);
|
|
32783
|
+
let liveSession = registeredSession();
|
|
32604
32784
|
if (!this.ctx.stopping && liveSession === session && this.sessions.sessionAdmissionClosed(session)) {
|
|
32605
32785
|
return await refuseRetryForClose();
|
|
32606
32786
|
}
|
|
@@ -32619,7 +32799,7 @@ class CodexRuntimePrompt {
|
|
|
32619
32799
|
return { ok: false, status: 404, error: "Session not found" };
|
|
32620
32800
|
}
|
|
32621
32801
|
await this.ctx.generationRecovery;
|
|
32622
|
-
liveSession =
|
|
32802
|
+
liveSession = registeredSession();
|
|
32623
32803
|
if (!this.ctx.stopping && liveSession === session && this.sessions.sessionAdmissionClosed(session)) {
|
|
32624
32804
|
return await refuseRetryForClose();
|
|
32625
32805
|
}
|
|
@@ -35393,7 +35573,7 @@ app.get("/session/:id/mcp", async (c) => {
|
|
|
35393
35573
|
if (typeof server.name !== "string")
|
|
35394
35574
|
return [];
|
|
35395
35575
|
const status = server.authStatus === "notLoggedIn" || server.runtimeStatus === "authenticationRequired" ? "needs-auth" : server.runtimeStatus === "connected" ? "connected" : server.runtimeStatus === "starting" ? "connecting" : server.runtimeStatus === "disabled" ? "disabled" : server.runtimeStatus === "failed" || server.runtimeStatus === "cancelled" ? "failed" : "unknown";
|
|
35396
|
-
const tools = server.tools && typeof server.tools === "object" ? Object.keys(server.tools).slice(0, 256) : [];
|
|
35576
|
+
const tools = server.tools && typeof server.tools === "object" ? Object.keys(server.tools).sort().slice(0, 256) : [];
|
|
35397
35577
|
return [
|
|
35398
35578
|
{
|
|
35399
35579
|
id: server.name,
|