orkestrator 2.37.3-beta → 2.37.5-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/artifact-runtime/worker-context/Dockerfile +1 -1
- package/dist/artifact-runtime/worker-context/package-lock.json +4 -4
- package/dist/artifact-runtime/worker-context/package.json +1 -1
- package/dist/client.js +397 -24
- package/dist/main.js +112233 -102964
- package/package.json +4 -4
- package/resources/acp-bridge/dist/index.js +218 -123
- package/resources/claude-bridge/dist/index.js +459 -460
- package/resources/codex-bridge/dist/index.js +259 -224
- package/resources/cursor-bridge/dist/index.js +1370 -419
- package/resources/cursor-bridge/runtime/install.json +1 -1
- package/resources/pi-bridge/dist/index.js +374 -162
- package/resources/pi-bridge/runtime/install.json +1 -1
- package/resources/release-runtime/bun.lock +2 -2
- package/resources/release-runtime/package.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",
|
|
@@ -1258,10 +1315,13 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
1258
1315
|
"prompt.accepted": "The route accepted a prompt and answered 202.",
|
|
1259
1316
|
"prompt.failed": "A prompt turn failed; the session reports the error.",
|
|
1260
1317
|
"prompt.processing-failed": "A prompt accepted by the route failed while processing.",
|
|
1318
|
+
"prompt.processing-usage-limited": "A prompt accepted by the route ended on a usage limit; the turn already logged prompt.usage-limited.",
|
|
1261
1319
|
"prompt.received": "A prompt reached the bridge; only its length is logged.",
|
|
1262
1320
|
"prompt.send-failed": "A prompt request failed; the route answered with an error.",
|
|
1321
|
+
"prompt.usage-limited": "A prompt turn ended because the account's plan allowance is used up; the session reports the limit.",
|
|
1263
1322
|
"query.close-failed": "Stopping the Claude query failed while closing a tab; the close stays pending.",
|
|
1264
1323
|
"query.failed": "A Claude query ended with an error result.",
|
|
1324
|
+
"query.usage-limited": "Claude refused a query because the account's plan allowance is used up; the turn reports the limit.",
|
|
1265
1325
|
"question.answer-failed": "The answer-question route failed.",
|
|
1266
1326
|
"question.answering": "Answering a parked question.",
|
|
1267
1327
|
"question.answers-prepared": "The route prepared a question answer for the session.",
|
|
@@ -1460,10 +1520,10 @@ var DESKTOP_LOG_AREAS = defineLogAreas({
|
|
|
1460
1520
|
"dev-mode.ignored-packaged": "A packaged app was launched with ELECTRON_DEV=1 and ignored it; it loads its bundled renderer.",
|
|
1461
1521
|
"instance.already-running": "Another instance holds this data directory; this one will quit.",
|
|
1462
1522
|
"main-thread.stalled": {
|
|
1463
|
-
description: "A timer fired late, so windows, IPC and the stdout reader waited.",
|
|
1523
|
+
description: "A timer fired late, so windows, IPC and the stdout reader waited. `cpuMs` is the CPU time the process used in the window: near `lagMs` the main thread was busy, far below it the thread waited.",
|
|
1464
1524
|
essential: true,
|
|
1465
1525
|
minLevel: "error",
|
|
1466
|
-
fields: { lagMs: "number", intervalMs: "number" }
|
|
1526
|
+
fields: { lagMs: "number", intervalMs: "number", cpuMs: "number" }
|
|
1467
1527
|
},
|
|
1468
1528
|
"process-memory": "Development only: working set per Electron process type, sampled on an interval.",
|
|
1469
1529
|
"process-memory.failed": "Development only: one process memory sample could not be read.",
|
|
@@ -1513,12 +1573,22 @@ var DESKTOP_LOG_AREAS = defineLogAreas({
|
|
|
1513
1573
|
denied: "A renderer asked for a permission the policy does not grant."
|
|
1514
1574
|
}
|
|
1515
1575
|
},
|
|
1576
|
+
"desktop.webrequest": {
|
|
1577
|
+
description: "Main-process webRequest listeners on Electron sessions. Listener names only; never a URL, header or error message.",
|
|
1578
|
+
events: {
|
|
1579
|
+
"listener.failed-closed": "A listener's decision threw or rejected, so it answered with its fail-closed response.",
|
|
1580
|
+
"observer.failed": "A listener with no callback (a redirect observer) threw; its fallback ran.",
|
|
1581
|
+
"callback.failed": "Electron's webRequest callback threw while a listener answered.",
|
|
1582
|
+
...THROTTLE_LOG_EVENTS
|
|
1583
|
+
}
|
|
1584
|
+
},
|
|
1516
1585
|
"desktop.dialog": {
|
|
1517
1586
|
description: "Native dialogs, whose modal loops hold the main thread while they are open.",
|
|
1518
1587
|
events: {
|
|
1519
1588
|
"attention-failed": "A dialog could not ask for the user's attention.",
|
|
1520
1589
|
closed: "A native dialog closed.",
|
|
1521
1590
|
"hidden-cancelled": "A hidden profile cancelled a dialog without opening native UI.",
|
|
1591
|
+
"no-display-cancelled": "A headless Electron with no display cancelled a dialog instead of opening native UI.",
|
|
1522
1592
|
"open-failed": "A dialog could not open; it was answered as cancelled.",
|
|
1523
1593
|
opening: "A native dialog is opening.",
|
|
1524
1594
|
"preview-beforeunload-ignored": "A browser preview's beforeunload handler was ignored.",
|
|
@@ -1874,6 +1944,7 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
1874
1944
|
"agent-tools.unavailable": "OpenCode agent tools remain unavailable for a session.",
|
|
1875
1945
|
"coordinator-servers.unavailable": "OpenCode coordinator research servers are unavailable.",
|
|
1876
1946
|
"monitor.reconnecting": "The request monitor lost its stream and is reconnecting. Error class only.",
|
|
1947
|
+
"monitor.silent": "The request monitor's stream stopped heartbeating, so it is replaced. `silenceMs` only.",
|
|
1877
1948
|
"worker-limit.reached": "The bounded request workers are full, so the stream restarts and a snapshot reconciles.",
|
|
1878
1949
|
"request.failed": "Handling a request event failed, so the stream restarts. Error class only.",
|
|
1879
1950
|
"credential-plugin.skipped": "A host OpenCode server started without the credential plugin, so its tools inherit its password; `reason` says why.",
|
|
@@ -1896,6 +1967,7 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
1896
1967
|
"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.",
|
|
1897
1968
|
"container-server.launched": "The start script of a container environment's 2.x server was run. Container port only.",
|
|
1898
1969
|
"container-server.ready": "A container environment's 2.x server this backend started answered `/api/info` as 2.x. Environment id only.",
|
|
1970
|
+
"container-server.cleanup-failed": "Cleanup after OpenCode startup failed; step names only, while the original startup error is preserved.",
|
|
1899
1971
|
"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.",
|
|
1900
1972
|
"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.",
|
|
1901
1973
|
"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.",
|
|
@@ -1950,12 +2022,13 @@ var RUNTIME_LOG_AREAS = defineLogAreas({
|
|
|
1950
2022
|
description: "This process's event loop. A stall of 10 seconds or more is written at error, so no level hides it.",
|
|
1951
2023
|
events: {
|
|
1952
2024
|
stalled: {
|
|
1953
|
-
description: "A timer fired late, so every request in that window waited. In the backend the line also names what ran: `storageMs` and the `storage*` fields describe the slow SQLite calls in the window (`operation.slow` in `storage`), `commandsInFlight` and `commands` the commands running,
|
|
2025
|
+
description: "A timer fired late, so every request in that window waited. In the backend the line also names what ran: `storageMs` and the `storage*` fields describe the slow SQLite calls in the window (`operation.slow` in `storage`), `commandsInFlight` and `commands` the commands running, `blockingCommand` one whose synchronous part overlapped it, and `jobsInWindow` and `jobs` the recurring jobs that ran around it. `cpuMs` is the CPU time the process used in the window: near `lagMs` its own thread was busy, far below it the thread waited.",
|
|
1954
2026
|
essential: true,
|
|
1955
2027
|
minLevel: "error",
|
|
1956
2028
|
fields: {
|
|
1957
2029
|
lagMs: "number",
|
|
1958
2030
|
intervalMs: "number",
|
|
2031
|
+
cpuMs: "number",
|
|
1959
2032
|
storageMs: "number",
|
|
1960
2033
|
storageDatabase: "label",
|
|
1961
2034
|
storageOp: "label",
|
|
@@ -1963,7 +2036,8 @@ var RUNTIME_LOG_AREAS = defineLogAreas({
|
|
|
1963
2036
|
storageLongestMs: "number",
|
|
1964
2037
|
storageBusy: "boolean",
|
|
1965
2038
|
commandsInFlight: "number",
|
|
1966
|
-
blockingCommandMs: "number"
|
|
2039
|
+
blockingCommandMs: "number",
|
|
2040
|
+
jobsInWindow: "number"
|
|
1967
2041
|
}
|
|
1968
2042
|
}
|
|
1969
2043
|
}
|
|
@@ -2003,6 +2077,8 @@ var TERMINAL_LOG_AREAS = defineLogAreas({
|
|
|
2003
2077
|
"pty.exit-notify-failed": "Notifying a terminal's exit failed.",
|
|
2004
2078
|
"pty.late-exit-listener-failed": "A listener added after a terminal exited threw.",
|
|
2005
2079
|
"setup.pty-reused": "A setup terminal reused its existing PTY.",
|
|
2080
|
+
"setup.pty-retired": "A setup retry ended the terminal the previous run left open, so the new run gets its own.",
|
|
2081
|
+
"setup.pty-retire-failed": "A setup retry could not end the previous run's process tree, so it kept that terminal and started nothing.",
|
|
2006
2082
|
"setup.pty-spawning": "A setup terminal is spawning its PTY. The argument count only, never the arguments.",
|
|
2007
2083
|
"setup.pty-spawned": "A setup terminal's PTY started.",
|
|
2008
2084
|
"setup.pty-exited": "A setup terminal's PTY exited.",
|
|
@@ -2130,6 +2206,7 @@ var TMUX_LOG_AREAS = defineLogAreas({
|
|
|
2130
2206
|
"cleanup.skipped": "Environment tmux cleanup was skipped because tmux could not be reached and nothing required it.",
|
|
2131
2207
|
"cleanup.environments-load-failed": "Environments could not be loaded during tmux cleanup, so it stays incomplete.",
|
|
2132
2208
|
"cleanup.kill-failed": "An environment's tmux sessions could not be killed.",
|
|
2209
|
+
"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.",
|
|
2133
2210
|
"hooks.uninstall-failed": "Workspace hooks could not be uninstalled.",
|
|
2134
2211
|
"hooks.git-exclude-failed": "The git exclude for Claude's local settings could not be set.",
|
|
2135
2212
|
"naming.prepare-failed": "First-prompt naming could not be prepared; the prompt still goes ahead.",
|
|
@@ -2259,6 +2336,7 @@ var STORAGE_LOG_AREAS = defineLogAreas({
|
|
|
2259
2336
|
"config.restrict-mode-failed": "A config file holding provider secrets could not be set to owner-only; the backend carries on.",
|
|
2260
2337
|
"legacy-json.moved": "JSON store files written after the SQLite migration were archived, not imported.",
|
|
2261
2338
|
"legacy-json.archive-failed": "Imported JSON store files could not be archived.",
|
|
2339
|
+
"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.",
|
|
2262
2340
|
"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.",
|
|
2263
2341
|
"lease.heartbeat-failed": "A held lease's heartbeat failed, which shortens the lease; the next one retries.",
|
|
2264
2342
|
"scrub.vacuum-failed": "Deleted-content page reclamation failed; the checkpoint is attempted independently.",
|
|
@@ -2308,9 +2386,12 @@ var BUILD_PIPELINE_LOG_AREAS = defineLogAreas({
|
|
|
2308
2386
|
"transcripts.maintenance-failed": "Migrating or sweeping stage transcripts failed; the next start retries.",
|
|
2309
2387
|
"restore.skipped": "A pipeline could not be restored at startup and was skipped.",
|
|
2310
2388
|
"criteria.record-failed": "Acceptance criteria results could not be recorded on the ticket.",
|
|
2389
|
+
"completion-notes.publish-failed": "A finished pipeline's notes tab could not be added to the layout; the run stays complete.",
|
|
2311
2390
|
"workspace.waiting": "A pipeline is waiting for its workspace; written once per reason.",
|
|
2312
2391
|
"rewind.pending": "A pipeline's code rewind has not finished; written once per reason.",
|
|
2313
2392
|
"kanban.status-failed": "A restarted pipeline's Kanban status could not be set; it retries shortly.",
|
|
2393
|
+
"kanban.environment-deleted-read-failed": "The pipelines of an environment being deleted could not be read, so their tickets keep their columns.",
|
|
2394
|
+
"kanban.environment-deleted-update-failed": "The ticket of a pipeline whose environment was deleted could not be moved; the deletion goes on.",
|
|
2314
2395
|
"usage.read-failed": "Reading a stage session's token usage failed.",
|
|
2315
2396
|
"checkpoint.deferred": "A stage transcript checkpoint could not be written yet; the provider's history stands.",
|
|
2316
2397
|
"checkpoint.not-committed": "A stage transcript checkpoint was reverted in the commit that should have kept it.",
|
|
@@ -2349,6 +2430,8 @@ var CHANGE_TRACKING_LOG_AREAS = defineLogAreas({
|
|
|
2349
2430
|
"dispatch.record-failed": "Recording a turn's dispatch outcome failed.",
|
|
2350
2431
|
"turn.finalize-failed": "Finalizing a turn failed.",
|
|
2351
2432
|
"turn.settle-failed": "Settling a late interrupted turn failed.",
|
|
2433
|
+
"turn.end-recovery": "A background retry of a turn end capture that timed out finished: recovered, done (no longer eligible) or exhausted.",
|
|
2434
|
+
"turn.end-recovery-failed": "A background retry of a turn end capture threw; it counts as a failed attempt.",
|
|
2352
2435
|
"evidence.pull-failed": "Pulling change evidence from a bridge failed; a later pull retries.",
|
|
2353
2436
|
"measurement.failed": "Recomputing a tool's measurement failed."
|
|
2354
2437
|
}
|
|
@@ -2359,6 +2442,7 @@ var CHANGE_TRACKING_LOG_AREAS = defineLogAreas({
|
|
|
2359
2442
|
"baseline.update-failed": "An environment's diff baseline could not be updated.",
|
|
2360
2443
|
"scan.watcher-failed": "An environment's diff watcher failed; its scans fall back to polling.",
|
|
2361
2444
|
"scan.failed": "A diff scan failed; the last results stay, marked stale, and the scan is retried.",
|
|
2445
|
+
"scan.target-missing": "A local environment's worktree folder is missing (deleted, moved or on an unmounted drive); no scan runs, the last results stay, marked stale, and the folder is checked again on the failure backoff.",
|
|
2362
2446
|
"scan.freshness-read-failed": "Reading whether an environment's remote is fresh failed.",
|
|
2363
2447
|
"scan.listener-failed": "A change-tracking scan listener threw; the scan itself stands.",
|
|
2364
2448
|
"emit.diff-stats-failed": "A diff stats change could not be emitted to its sink.",
|
|
@@ -2417,6 +2501,7 @@ var COORDINATOR_LOG_AREAS = defineLogAreas({
|
|
|
2417
2501
|
"node-release.no-coordinator": "Work closed on a released node belonged to a coordinator that no longer exists, so nobody was told.",
|
|
2418
2502
|
"node-offline.notice-failed": "The notice that a node has been unreachable for a day could not be sent; the next failed read retries.",
|
|
2419
2503
|
"node-offline.check-failed": "Whether a long-unreachable node's coordinators were told could not be checked; the next read retries.",
|
|
2504
|
+
"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.",
|
|
2420
2505
|
"checkout.merge-followed": "After an environment's PR merged, the project checkout was fast-forwarded, or `outcome` says why not.",
|
|
2421
2506
|
"checkout.merge-follow-failed": "Fast-forwarding the project checkout failed, after an environment's PR merged or before mail woke the main coordinator.",
|
|
2422
2507
|
"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`).",
|
|
@@ -2469,7 +2554,8 @@ var REVIEW_LOG_AREAS = defineLogAreas({
|
|
|
2469
2554
|
"monitor.task-store-failed": "A pull request could not be recorded on its Kanban task.",
|
|
2470
2555
|
"monitor.merged-tickets-closed": "The startup sweep moved Kanban tickets whose pull request had merged to done (`count`).",
|
|
2471
2556
|
"monitor.merged-tickets-close-failed": "The startup sweep closing Kanban tickets whose pull request merged failed; the next backend start retries.",
|
|
2472
|
-
"monitor.emit-failed": "A pull request monitor event could not be emitted to its sink."
|
|
2557
|
+
"monitor.emit-failed": "A pull request monitor event could not be emitted to its sink.",
|
|
2558
|
+
"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`)."
|
|
2473
2559
|
}
|
|
2474
2560
|
}
|
|
2475
2561
|
});
|
|
@@ -2501,6 +2587,8 @@ var AGENT_ACCOUNTS_LOG_AREAS = defineLogAreas({
|
|
|
2501
2587
|
"kept-note.failed": "Recording why a limit stop found no account to move to failed; the stop stands.",
|
|
2502
2588
|
"container-sync.failed": "Handing a login or account to a container failed; `step` says which part.",
|
|
2503
2589
|
"last-usage.save-failed": "The last plan usage reading could not be saved; the next save retries.",
|
|
2590
|
+
"shared-usage.save-failed": "The shared usage readings could not be saved; they stay in memory and the next reading saves them.",
|
|
2591
|
+
"shared-usage.record-failed": "A fresh usage reading could not be kept for sharing with other machines; the account's own reading stands.",
|
|
2504
2592
|
"login-cleanup.failed": "A temporary login could not be cleaned up.",
|
|
2505
2593
|
"login-renewal.failed": "Renewing an idle account's sign-in to read its usage failed; it is retried after a backoff.",
|
|
2506
2594
|
"login-renewal.not-extended": "Claude Code ran to renew an idle account's sign-in, but its token is still lapsed.",
|
|
@@ -2518,6 +2606,7 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
2518
2606
|
"git-mirror.mount-unavailable": "A new container gets no project Git mirror, so its clone goes to the remote.",
|
|
2519
2607
|
"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.",
|
|
2520
2608
|
"git-mirror.refreshed": "A project's Git mirror was built or updated.",
|
|
2609
|
+
"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.",
|
|
2521
2610
|
"git-mirror.seeded": "A project's Git mirror was built from its host checkout and only what the remote added to it.",
|
|
2522
2611
|
"git-mirror.seed-skipped": "A project's host checkout could not seed its Git mirror, so the build downloads everything.",
|
|
2523
2612
|
"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.",
|
|
@@ -2531,6 +2620,9 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
2531
2620
|
"git-mirror.clone-fallback": "A new environment could not clone from its project's Git mirror and cloned from the remote.",
|
|
2532
2621
|
"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.",
|
|
2533
2622
|
"opencode.warm-incomplete": "OpenCode did not finish loading /workspace in a container.",
|
|
2623
|
+
"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; that connection then sends nothing more.",
|
|
2624
|
+
"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.",
|
|
2625
|
+
"opencode.project-config-filtered": "Values were left out of a checkout's OpenCode configuration before a launched server reads it: 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.",
|
|
2534
2626
|
"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.",
|
|
2535
2627
|
"lifecycle-event.reconcile-failed": "Reconciling an environment after a container start or stop event failed; the next status read retries.",
|
|
2536
2628
|
"login-keeper.pass-failed": "A Claude login keeper pass failed; the next interval retries.",
|
|
@@ -2565,6 +2657,17 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
2565
2657
|
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.",
|
|
2566
2658
|
essential: true,
|
|
2567
2659
|
fields: { provider: "label", containerPort: "number" }
|
|
2660
|
+
},
|
|
2661
|
+
"bridge.listener-refused": {
|
|
2662
|
+
description: "The socket listening on a container bridge's port is not the one the bridge the backend started opened, 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`.",
|
|
2663
|
+
essential: true,
|
|
2664
|
+
fields: { provider: "label", reason: "label" }
|
|
2665
|
+
},
|
|
2666
|
+
"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.",
|
|
2667
|
+
"bridge.listener-unrecorded": {
|
|
2668
|
+
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.",
|
|
2669
|
+
essential: true,
|
|
2670
|
+
fields: { provider: "label", reason: "label" }
|
|
2568
2671
|
}
|
|
2569
2672
|
}
|
|
2570
2673
|
},
|
|
@@ -2619,7 +2722,8 @@ var MCP_LOG_AREAS = defineLogAreas({
|
|
|
2619
2722
|
"listener.port-free": "The Control MCP's fixed port is free again, so it is listening.",
|
|
2620
2723
|
"state-listener.failed": "A Control MCP state listener threw; the others still run.",
|
|
2621
2724
|
"delegation.remote-open-failed": "A delegation could not be opened on another node.",
|
|
2622
|
-
"delegation.open-failed": "A coordinator delegation could not be opened."
|
|
2725
|
+
"delegation.open-failed": "A coordinator delegation could not be opened.",
|
|
2726
|
+
"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."
|
|
2623
2727
|
}
|
|
2624
2728
|
},
|
|
2625
2729
|
"mcp-management": {
|
|
@@ -2704,6 +2808,7 @@ var NODES_LOG_AREAS = defineLogAreas({
|
|
|
2704
2808
|
"ticket-sync.failed": "A Kanban sync with a node failed; it is retried.",
|
|
2705
2809
|
"ticket-sync.unknown-project": "A node sent ticket changes for a project that no longer exists here.",
|
|
2706
2810
|
"ticket-sync.forget-failed": "A detached command node's ticket copies could not be released.",
|
|
2811
|
+
"usage-sync.failed": "Sharing usage readings with a node failed; the next reading or reconnect retries.",
|
|
2707
2812
|
"fleet-update.requested": "The update policy asked an older leaf to install the command node's version.",
|
|
2708
2813
|
"fleet-update.failed": "The update policy could not read or update a leaf; it retries later.",
|
|
2709
2814
|
"fleet-update.policy-load-failed": "The stored update policy could not be read; it is off."
|
|
@@ -2795,6 +2900,20 @@ var SCHEDULER_LOG_AREAS = defineLogAreas({
|
|
|
2795
2900
|
}
|
|
2796
2901
|
});
|
|
2797
2902
|
|
|
2903
|
+
// ../protocol/src/log-vocabulary/self-improvement.ts
|
|
2904
|
+
var SELF_IMPROVEMENT_LOG_AREAS = defineLogAreas({
|
|
2905
|
+
"self-improvement": {
|
|
2906
|
+
description: "Self-improvement runs: diagnostics and conversation review turned into tickets. Counts and steps only, never conversation text.",
|
|
2907
|
+
events: {
|
|
2908
|
+
"run.started": "A run started; `trigger` is manual, daily or dry-run.",
|
|
2909
|
+
"run.finished": "A run finished; `created`, `verified`, `fixFailed` and `parts` count its tickets, confirmed fixes, failed fixes and conversation parts read.",
|
|
2910
|
+
"run.failed": "A run stopped before it finished; `reason` is a fixed label.",
|
|
2911
|
+
"review.call-failed": "One conversation review call failed; the run carries on and the part is read again next run.",
|
|
2912
|
+
"daily.check-failed": "The daily run check failed; the next check retries."
|
|
2913
|
+
}
|
|
2914
|
+
}
|
|
2915
|
+
});
|
|
2916
|
+
|
|
2798
2917
|
// ../protocol/src/log-vocabulary/web-app.ts
|
|
2799
2918
|
var WEB_APP_LOG_AREAS = defineLogAreas({
|
|
2800
2919
|
"web.app": {
|
|
@@ -3062,6 +3181,7 @@ var WEB_KANBAN_LOG_AREAS = defineLogAreas({
|
|
|
3062
3181
|
"task.move-failed": "A task move failed and its status was rolled back.",
|
|
3063
3182
|
"comment.add-failed": "A comment could not be added to a task.",
|
|
3064
3183
|
"comment.delete-failed": "A comment could not be deleted from a task.",
|
|
3184
|
+
"pr.merge-failed": "Merging a ticket's pull request from its Notes tab failed; the error was shown to the user.",
|
|
3065
3185
|
"image.add-failed": "An image could not be added to a task.",
|
|
3066
3186
|
"image.delete-failed": "An image could not be deleted from a task.",
|
|
3067
3187
|
"notes.load-failed": "Project notes could not be loaded; the editor stays disabled.",
|
|
@@ -3130,6 +3250,10 @@ var WEB_SETTINGS_LOG_AREAS = defineLogAreas({
|
|
|
3130
3250
|
"web.settings": {
|
|
3131
3251
|
description: "The settings screens.",
|
|
3132
3252
|
events: {
|
|
3253
|
+
"self-improvement.status-failed": "Settings → Self-improvement could not read the status.",
|
|
3254
|
+
"self-improvement.projects-failed": "Settings → Self-improvement could not list the projects.",
|
|
3255
|
+
"self-improvement.save-failed": "Settings → Self-improvement could not save a setting.",
|
|
3256
|
+
"self-improvement.run-failed": "Settings → Self-improvement could not start a run.",
|
|
3133
3257
|
"config.save-failed": "Global settings could not be saved.",
|
|
3134
3258
|
"config.load-failed": "The settings page could not load the config.",
|
|
3135
3259
|
"config.reload-failed": "Re-reading the workspace config after a save failed.",
|
|
@@ -3299,6 +3423,7 @@ var LOG_VOCABULARY = {
|
|
|
3299
3423
|
...HOST_LOG_AREAS,
|
|
3300
3424
|
...TRANSCRIPT_ARTIFACTS_LOG_AREAS,
|
|
3301
3425
|
...SCHEDULER_LOG_AREAS,
|
|
3426
|
+
...SELF_IMPROVEMENT_LOG_AREAS,
|
|
3302
3427
|
...WEB_APP_LOG_AREAS,
|
|
3303
3428
|
...WEB_BUILD_PIPELINE_LOG_AREAS,
|
|
3304
3429
|
...WEB_CHAT_LOG_AREAS,
|
|
@@ -3599,6 +3724,14 @@ var SIGNALS = new Set([
|
|
|
3599
3724
|
"SIGXFSZ"
|
|
3600
3725
|
]);
|
|
3601
3726
|
var PROVIDERS3 = new Set(["claude", "codex", "opencode", "cursor", "grok", "acp", "pi"]);
|
|
3727
|
+
var BRIDGE_LISTENER_REASONS = new Set([
|
|
3728
|
+
"different-socket",
|
|
3729
|
+
"several-sockets",
|
|
3730
|
+
"pending",
|
|
3731
|
+
"scan-incomplete",
|
|
3732
|
+
"no-listener",
|
|
3733
|
+
"launch-exited"
|
|
3734
|
+
]);
|
|
3602
3735
|
var UUID = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
|
|
3603
3736
|
var SOURCE = new RegExp(`^(?:claude|codex|opencode|cursor|grok|acp|pi):${UUID}$`, "i");
|
|
3604
3737
|
var STORAGE_DATABASES = new Set(["main", "ledger", "other"]);
|
|
@@ -4598,11 +4731,10 @@ function setLiveBridgeDiagnostics(enabled) {
|
|
|
4598
4731
|
for (const scope of Array.from(liveScopes))
|
|
4599
4732
|
scope.syncActive();
|
|
4600
4733
|
}
|
|
4601
|
-
function bridgeDebugEnabled(
|
|
4734
|
+
function bridgeDebugEnabled(_bridge, env = process.env) {
|
|
4602
4735
|
if (liveDiagnostics !== undefined && env === process.env)
|
|
4603
4736
|
return liveDiagnostics;
|
|
4604
|
-
|
|
4605
|
-
return readBridgeDebugFlag(value);
|
|
4737
|
+
return readBridgeDebugFlag(env.ORKESTRATOR_BRIDGE_DEBUG);
|
|
4606
4738
|
}
|
|
4607
4739
|
function safeDiagnosticMetrics(value) {
|
|
4608
4740
|
const result = {};
|
|
@@ -13617,6 +13749,11 @@ function toBridgeModel(model) {
|
|
|
13617
13749
|
defaultReasoningEffort: fallbackReasoningId(model.supportedReasoningEfforts.map((entry) => entry.effort), model.defaultReasoningEffort) ?? model.defaultReasoningEffort
|
|
13618
13750
|
};
|
|
13619
13751
|
}
|
|
13752
|
+
// ../protocol/src/terminal-text.ts
|
|
13753
|
+
var MAX_STRING_LENGTH = 8 * 1024;
|
|
13754
|
+
var BUDGET_FLOOR = 4 * 1024;
|
|
13755
|
+
var MAX_MOVE = 4 * 1024;
|
|
13756
|
+
|
|
13620
13757
|
// ../protocol/src/human-prompts.ts
|
|
13621
13758
|
var HUMAN_PROMPT_SCAN_BYTES = 16 * 1024;
|
|
13622
13759
|
var HUMAN_PROMPT_KINDS = new Set([
|
|
@@ -17093,8 +17230,9 @@ class TurnAccumulator {
|
|
|
17093
17230
|
settleEndedAttempt() {
|
|
17094
17231
|
this.interruptOpenAgentMessages();
|
|
17095
17232
|
for (const accumulator of this.items.values()) {
|
|
17096
|
-
if (!accumulator.completed && !accumulator.interrupted)
|
|
17233
|
+
if (!accumulator.completed && !accumulator.interrupted || accumulator.item?.type === "command_execution" && accumulator.item.status === "in_progress") {
|
|
17097
17234
|
this.touch(accumulator);
|
|
17235
|
+
}
|
|
17098
17236
|
}
|
|
17099
17237
|
}
|
|
17100
17238
|
recordRetryCard(id, text, state) {
|
|
@@ -17400,6 +17538,7 @@ function mcpToolCallParts(item) {
|
|
|
17400
17538
|
function commandExecutionParts(item) {
|
|
17401
17539
|
const output = capCommandOutput(item.aggregated_output);
|
|
17402
17540
|
const failed = item.status === "failed";
|
|
17541
|
+
const leftRunning = item.left_running === true && item.status === "in_progress";
|
|
17403
17542
|
return [
|
|
17404
17543
|
{
|
|
17405
17544
|
type: "tool-invocation",
|
|
@@ -17407,7 +17546,9 @@ function commandExecutionParts(item) {
|
|
|
17407
17546
|
content: item.command,
|
|
17408
17547
|
toolName: "bash",
|
|
17409
17548
|
toolArgs: { command: item.command },
|
|
17410
|
-
|
|
17549
|
+
...leftRunning ? { toolLeftRunning: true } : {
|
|
17550
|
+
toolState: item.status === "failed" ? "failure" : item.status === "completed" ? "success" : "pending"
|
|
17551
|
+
},
|
|
17411
17552
|
toolTitle: item.command,
|
|
17412
17553
|
toolOutput: failed ? undefined : output || undefined,
|
|
17413
17554
|
toolError: failed ? output || "Command failed" : undefined,
|
|
@@ -17773,6 +17914,40 @@ function rolloutCommandExecutionParts(item) {
|
|
|
17773
17914
|
});
|
|
17774
17915
|
return adapted?.type === "command_execution" ? commandExecutionParts(adapted) : null;
|
|
17775
17916
|
}
|
|
17917
|
+
|
|
17918
|
+
class ReplayCommandSettlement {
|
|
17919
|
+
slots = new Map;
|
|
17920
|
+
terminal = false;
|
|
17921
|
+
reset() {
|
|
17922
|
+
this.slots.clear();
|
|
17923
|
+
this.terminal = false;
|
|
17924
|
+
}
|
|
17925
|
+
settle() {
|
|
17926
|
+
this.terminal = true;
|
|
17927
|
+
for (const { parts, index } of this.slots.values())
|
|
17928
|
+
this.settlePart(parts[index]);
|
|
17929
|
+
}
|
|
17930
|
+
settlePart(part) {
|
|
17931
|
+
if (this.terminal && part.toolState === "pending") {
|
|
17932
|
+
delete part.toolState;
|
|
17933
|
+
part.toolLeftRunning = true;
|
|
17934
|
+
}
|
|
17935
|
+
}
|
|
17936
|
+
update(id, incoming) {
|
|
17937
|
+
const slot = this.slots.get(id);
|
|
17938
|
+
if (!slot)
|
|
17939
|
+
return false;
|
|
17940
|
+
slot.parts[slot.index] = incoming[0];
|
|
17941
|
+
this.settlePart(slot.parts[slot.index]);
|
|
17942
|
+
return true;
|
|
17943
|
+
}
|
|
17944
|
+
append(id, target, incoming) {
|
|
17945
|
+
const index = target.length;
|
|
17946
|
+
target.push(...incoming);
|
|
17947
|
+
this.slots.set(id, { parts: target, index });
|
|
17948
|
+
this.settlePart(target[index]);
|
|
17949
|
+
}
|
|
17950
|
+
}
|
|
17776
17951
|
// ../protocol/src/coordinator.ts
|
|
17777
17952
|
var COORDINATOR_CODEX_USER_SKILLS_DIR_ENV = "ORKESTRATOR_COORDINATOR_CODEX_USER_SKILLS_DIR";
|
|
17778
17953
|
var COORDINATOR_OTHER_ENVIRONMENTS_SETTING_LABEL = "Let the coordinator use environments it did not create";
|
|
@@ -18909,6 +19084,7 @@ async function replayPersistedRollout(threadId, snapshot, meta, structuredTurns)
|
|
|
18909
19084
|
const messages = [];
|
|
18910
19085
|
const toolPartsByCallId = new Map;
|
|
18911
19086
|
const turnCallIds = new Set;
|
|
19087
|
+
const commandSettlement = new ReplayCommandSettlement;
|
|
18912
19088
|
const transcriptCwd = asNonEmptyString2(meta.cwd) ?? getWorkingDirectory();
|
|
18913
19089
|
let currentTurnId;
|
|
18914
19090
|
let currentTurnModel;
|
|
@@ -19030,6 +19206,8 @@ async function replayPersistedRollout(threadId, snapshot, meta, structuredTurns)
|
|
|
19030
19206
|
const open = [...openCells.values()];
|
|
19031
19207
|
const parts = rolloutCommandExecutionParts(item);
|
|
19032
19208
|
const id = asNonEmptyString2(item.id);
|
|
19209
|
+
if (parts && id && commandSettlement.update(id, parts))
|
|
19210
|
+
return;
|
|
19033
19211
|
const direct = id !== undefined && turnCallIds.has(id);
|
|
19034
19212
|
if (!parts || direct || open.length !== 1) {
|
|
19035
19213
|
for (const cell of open)
|
|
@@ -19038,7 +19216,7 @@ async function replayPersistedRollout(threadId, snapshot, meta, structuredTurns)
|
|
|
19038
19216
|
}
|
|
19039
19217
|
const cell = open[0];
|
|
19040
19218
|
cell.sawCommandRecord = true;
|
|
19041
|
-
cell.message.parts
|
|
19219
|
+
commandSettlement.append(id, cell.message.parts, parts);
|
|
19042
19220
|
};
|
|
19043
19221
|
const visitCompletedItem = (item, timestamp) => {
|
|
19044
19222
|
if (!item || typeof item !== "object" || Array.isArray(item))
|
|
@@ -19161,6 +19339,7 @@ async function replayPersistedRollout(threadId, snapshot, meta, structuredTurns)
|
|
|
19161
19339
|
const recordTurnId = readTurnId(record.payload);
|
|
19162
19340
|
if (recordTurnId && recordTurnId !== currentTurnId) {
|
|
19163
19341
|
settleOpenCells();
|
|
19342
|
+
commandSettlement.reset();
|
|
19164
19343
|
currentTurnId = recordTurnId;
|
|
19165
19344
|
turnCallIds.clear();
|
|
19166
19345
|
typedPromptConsumed = false;
|
|
@@ -19184,7 +19363,10 @@ async function replayPersistedRollout(threadId, snapshot, meta, structuredTurns)
|
|
|
19184
19363
|
}
|
|
19185
19364
|
return;
|
|
19186
19365
|
}
|
|
19366
|
+
if (record.type === "event_msg" && record.payload?.type === "turn_aborted")
|
|
19367
|
+
commandSettlement.settle();
|
|
19187
19368
|
if (record.type === "event_msg" && record.payload?.type === "task_complete") {
|
|
19369
|
+
commandSettlement.settle();
|
|
19188
19370
|
const error = record.payload.error;
|
|
19189
19371
|
if (error && typeof error === "object" && typeof error.message === "string") {
|
|
19190
19372
|
ensureAssistantMessage(timestamp).parts.push({
|
|
@@ -19431,12 +19613,13 @@ function effectiveItem(turn, accumulator) {
|
|
|
19431
19613
|
}
|
|
19432
19614
|
switch (item.type) {
|
|
19433
19615
|
case "command_execution": {
|
|
19434
|
-
|
|
19435
|
-
|
|
19616
|
+
const settled = item.status === "in_progress" && turn.isTerminal() ? { ...item, left_running: true } : item;
|
|
19617
|
+
if (settled.aggregated_output && settled.aggregated_output.length > 0)
|
|
19618
|
+
return settled;
|
|
19436
19619
|
if (accumulator.outputDelta.length === 0)
|
|
19437
|
-
return
|
|
19620
|
+
return settled;
|
|
19438
19621
|
return {
|
|
19439
|
-
...
|
|
19622
|
+
...settled,
|
|
19440
19623
|
aggregated_output: accumulator.outputDelta + (accumulator.outputTruncated ? TRUNCATION_NOTICE : "")
|
|
19441
19624
|
};
|
|
19442
19625
|
}
|
|
@@ -19798,7 +19981,8 @@ async function renderTurn(turn, options) {
|
|
|
19798
19981
|
const accumulator = accumulatorsByKey.get(itemId);
|
|
19799
19982
|
const cached = options.state.completedItemParts.get(itemId);
|
|
19800
19983
|
const suppressDraft = suppressStructuredOutputDraft(turn, options.state, accumulator, item, structuredOutputItemId);
|
|
19801
|
-
|
|
19984
|
+
const leftRunning = item.type === "command_execution" && item.left_running === true;
|
|
19985
|
+
if (accumulator?.completed && cached?.source === accumulator.item && cached.commandChanges === accumulator.commandChanges && cached.leftRunning === true === leftRunning) {
|
|
19802
19986
|
if (!suppressDraft)
|
|
19803
19987
|
parts.push(...cached.parts);
|
|
19804
19988
|
} else {
|
|
@@ -19823,6 +20007,7 @@ async function renderTurn(turn, options) {
|
|
|
19823
20007
|
options.state.completedItemParts.set(itemId, {
|
|
19824
20008
|
source: accumulator.item,
|
|
19825
20009
|
...accumulator.commandChanges ? { commandChanges: accumulator.commandChanges } : {},
|
|
20010
|
+
...leftRunning ? { leftRunning: true } : {},
|
|
19826
20011
|
parts: stampedParts
|
|
19827
20012
|
});
|
|
19828
20013
|
} else {
|
|
@@ -20174,58 +20359,6 @@ async function publishAssistantRows(context, state, turn, options) {
|
|
|
20174
20359
|
// ../../bridges/codex-bridge/src/app-server-runtime-sessions.ts
|
|
20175
20360
|
import { createHash as createHash14, randomUUID as randomUUID9 } from "node:crypto";
|
|
20176
20361
|
|
|
20177
|
-
// ../protocol/src/agent-mail.ts
|
|
20178
|
-
var AGENT_MAIL_MAX_BODY_BYTES = 32 * 1024;
|
|
20179
|
-
var AGENT_MAIL_MAX_STORE_BYTES = 32 * 1024 * 1024;
|
|
20180
|
-
var AGENT_MAIL_DEFAULT_RETENTION_DAYS = 14;
|
|
20181
|
-
var AGENT_MAIL_MAX_ATTACHMENT_BYTES = 8 * 1024 * 1024;
|
|
20182
|
-
var AGENT_MAIL_MAX_TOTAL_ATTACHMENT_BYTES = 32 * 1024 * 1024;
|
|
20183
|
-
var AGENT_MAIL_DEFAULT_AUTONOMOUS_WAKE_BUDGET = 16;
|
|
20184
|
-
var AGENT_MAIL_DEFAULT_HOURLY_WAKE_LIMIT = 40;
|
|
20185
|
-
var AGENT_MAIL_TOOL_NAMES = Object.freeze([
|
|
20186
|
-
"list_mailboxes",
|
|
20187
|
-
"send_message",
|
|
20188
|
-
"check_inbox",
|
|
20189
|
-
"read_message",
|
|
20190
|
-
"ack_message",
|
|
20191
|
-
"reply_message",
|
|
20192
|
-
"get_message_status"
|
|
20193
|
-
]);
|
|
20194
|
-
var DEFAULT_AGENT_MESSAGING_SETTINGS = Object.freeze({
|
|
20195
|
-
enabled: true,
|
|
20196
|
-
allowCrossProject: false,
|
|
20197
|
-
defaultInjectPolicy: "off",
|
|
20198
|
-
wakePeers: false,
|
|
20199
|
-
autonomousWakeBudget: AGENT_MAIL_DEFAULT_AUTONOMOUS_WAKE_BUDGET,
|
|
20200
|
-
hourlyWakeLimit: AGENT_MAIL_DEFAULT_HOURLY_WAKE_LIMIT,
|
|
20201
|
-
coordinatorStatusWakes: "settled",
|
|
20202
|
-
retentionDays: AGENT_MAIL_DEFAULT_RETENTION_DAYS,
|
|
20203
|
-
paused: false
|
|
20204
|
-
});
|
|
20205
|
-
function agentMailCapabilities(tabType, agent, locked = true) {
|
|
20206
|
-
if (tabType === "agent-native") {
|
|
20207
|
-
if (!locked || !agent)
|
|
20208
|
-
return { canPull: false, canSend: false, canInject: false };
|
|
20209
|
-
if (agent === "claude" || agent === "codex" || agent === "opencode" || agent === "pi" || agent === "cursor" || agent === "grok") {
|
|
20210
|
-
return { canPull: true, canSend: true, canInject: true };
|
|
20211
|
-
}
|
|
20212
|
-
return { canPull: false, canSend: false, canInject: false };
|
|
20213
|
-
}
|
|
20214
|
-
if (tabType === "claude-tmux")
|
|
20215
|
-
return { canPull: true, canSend: true, canInject: true };
|
|
20216
|
-
if (tabType === "pipeline-worker") {
|
|
20217
|
-
return agent ? { canPull: true, canSend: true, canInject: true } : { canPull: false, canSend: false, canInject: false };
|
|
20218
|
-
}
|
|
20219
|
-
if (["claude", "codex", "opencode"].includes(tabType)) {
|
|
20220
|
-
return { canPull: true, canSend: true, canInject: false };
|
|
20221
|
-
}
|
|
20222
|
-
if (["cursor", "grok", "pi"].includes(tabType)) {
|
|
20223
|
-
return { canPull: false, canSend: false, canInject: false };
|
|
20224
|
-
}
|
|
20225
|
-
return { canPull: false, canSend: false, canInject: false };
|
|
20226
|
-
}
|
|
20227
|
-
var NATIVE_AGENT_MAIL_CAPABILITIES = Object.freeze(Object.fromEntries(AGENT_PLATFORMS.map((agent) => [agent, agentMailCapabilities("agent-native", agent)])));
|
|
20228
|
-
|
|
20229
20362
|
// ../protocol/src/rich-content-policy.ts
|
|
20230
20363
|
var KIB = 1024;
|
|
20231
20364
|
var MIB = 1024 * KIB;
|
|
@@ -23918,7 +24051,6 @@ import {
|
|
|
23918
24051
|
} from "node:fs/promises";
|
|
23919
24052
|
import { join as join15 } from "node:path";
|
|
23920
24053
|
var log12 = createLogger("bridge.codex");
|
|
23921
|
-
var BRIDGE_SESSION_REGISTRY_VERSION = 2;
|
|
23922
24054
|
var SESSION_TITLE_SOURCES = new Set([
|
|
23923
24055
|
"codex",
|
|
23924
24056
|
"explicit",
|
|
@@ -24022,9 +24154,6 @@ class BridgeSessionStore {
|
|
|
24022
24154
|
dir() {
|
|
24023
24155
|
return codexBridgeStateDir(this.codexHome);
|
|
24024
24156
|
}
|
|
24025
|
-
path() {
|
|
24026
|
-
return join15(this.dir(), `bridge-sessions-${this.cwdHash}.json`);
|
|
24027
|
-
}
|
|
24028
24157
|
recordsDir() {
|
|
24029
24158
|
return join15(this.dir(), `bridge-sessions-${this.cwdHash}`);
|
|
24030
24159
|
}
|
|
@@ -24049,19 +24178,13 @@ class BridgeSessionStore {
|
|
|
24049
24178
|
}
|
|
24050
24179
|
async load() {
|
|
24051
24180
|
const cutoff = this.now() - this.retentionMs;
|
|
24052
|
-
const legacy = await this.loadLegacy(cutoff);
|
|
24053
|
-
let migrationFailed = false;
|
|
24054
|
-
await this.migrateLegacy(legacy).catch((error) => {
|
|
24055
|
-
migrationFailed = true;
|
|
24056
|
-
this.warnPersistenceFailure(error);
|
|
24057
|
-
});
|
|
24058
24181
|
await this.adoptLoginRecords().catch((error) => this.warnPersistenceFailure(error));
|
|
24059
24182
|
let names;
|
|
24060
24183
|
try {
|
|
24061
24184
|
await this.ensurePrivateStorage();
|
|
24062
24185
|
names = await readdir2(this.recordsDir());
|
|
24063
24186
|
} catch {
|
|
24064
|
-
return
|
|
24187
|
+
return [];
|
|
24065
24188
|
}
|
|
24066
24189
|
const records = await Promise.all(names.map(async (name) => {
|
|
24067
24190
|
const path = join15(this.recordsDir(), name);
|
|
@@ -24090,8 +24213,7 @@ class BridgeSessionStore {
|
|
|
24090
24213
|
return null;
|
|
24091
24214
|
}
|
|
24092
24215
|
}));
|
|
24093
|
-
|
|
24094
|
-
return migrationFailed && loaded.length === 0 ? legacy : loaded;
|
|
24216
|
+
return records.filter((record) => record !== null);
|
|
24095
24217
|
}
|
|
24096
24218
|
async loadRecord(bridgeSessionId) {
|
|
24097
24219
|
const cutoff = this.now() - this.retentionMs;
|
|
@@ -24099,9 +24221,6 @@ class BridgeSessionStore {
|
|
|
24099
24221
|
const record = await this.readRecordFile(join15(this.recordsDir(), key), bridgeSessionId, cutoff);
|
|
24100
24222
|
if (record !== RECORD_FILE_MISSING)
|
|
24101
24223
|
return record;
|
|
24102
|
-
const legacy = (await this.readLegacy(cutoff)).find((session) => session.bridgeSessionId === bridgeSessionId);
|
|
24103
|
-
if (legacy)
|
|
24104
|
-
return legacy;
|
|
24105
24224
|
const loginRecords = this.loginRecordsDir();
|
|
24106
24225
|
if (!loginRecords)
|
|
24107
24226
|
return null;
|
|
@@ -24158,53 +24277,6 @@ class BridgeSessionStore {
|
|
|
24158
24277
|
});
|
|
24159
24278
|
await attempt;
|
|
24160
24279
|
}
|
|
24161
|
-
async loadLegacy(cutoff) {
|
|
24162
|
-
try {
|
|
24163
|
-
await chmod(this.dir(), PRIVATE_DIRECTORY_MODE);
|
|
24164
|
-
await chmod(this.path(), PRIVATE_FILE_MODE);
|
|
24165
|
-
} catch {
|
|
24166
|
-
return [];
|
|
24167
|
-
}
|
|
24168
|
-
return this.readLegacy(cutoff);
|
|
24169
|
-
}
|
|
24170
|
-
async readLegacy(cutoff) {
|
|
24171
|
-
try {
|
|
24172
|
-
const parsed = JSON.parse(await readFile6(this.path(), "utf8"));
|
|
24173
|
-
if (parsed.version !== BRIDGE_SESSION_REGISTRY_VERSION)
|
|
24174
|
-
return [];
|
|
24175
|
-
if (!Array.isArray(parsed.sessions))
|
|
24176
|
-
return [];
|
|
24177
|
-
return parsed.sessions.filter((session) => isPersistedBridgeSession(session, this.cwdHash, cutoff));
|
|
24178
|
-
} catch {
|
|
24179
|
-
return [];
|
|
24180
|
-
}
|
|
24181
|
-
}
|
|
24182
|
-
async migrateLegacy(sessions) {
|
|
24183
|
-
if (sessions.length === 0)
|
|
24184
|
-
return;
|
|
24185
|
-
await this.ensurePrivateStorage();
|
|
24186
|
-
await Promise.all(sessions.map(async (session) => {
|
|
24187
|
-
const target = this.recordPath(session.bridgeSessionId);
|
|
24188
|
-
const temporary = `${target}.${process.pid}.${randomUUID8()}.tmp`;
|
|
24189
|
-
await writeFile4(temporary, `${JSON.stringify(session, null, 2)}
|
|
24190
|
-
`, {
|
|
24191
|
-
encoding: "utf8",
|
|
24192
|
-
mode: PRIVATE_FILE_MODE
|
|
24193
|
-
});
|
|
24194
|
-
await chmod(temporary, PRIVATE_FILE_MODE);
|
|
24195
|
-
await link2(temporary, target).catch((error) => {
|
|
24196
|
-
if (error.code !== "EEXIST")
|
|
24197
|
-
throw error;
|
|
24198
|
-
});
|
|
24199
|
-
await chmod(target, PRIVATE_FILE_MODE);
|
|
24200
|
-
await rm6(temporary, { force: true }).catch(() => {
|
|
24201
|
-
return;
|
|
24202
|
-
});
|
|
24203
|
-
}));
|
|
24204
|
-
await rm6(this.path(), { force: true }).catch(() => {
|
|
24205
|
-
return;
|
|
24206
|
-
});
|
|
24207
|
-
}
|
|
24208
24280
|
async adoptLoginRecords() {
|
|
24209
24281
|
const source = this.loginRecordsDir();
|
|
24210
24282
|
if (!source)
|
|
@@ -25011,6 +25083,48 @@ function collect(config, exclusions) {
|
|
|
25011
25083
|
}
|
|
25012
25084
|
}
|
|
25013
25085
|
|
|
25086
|
+
// ../protocol/src/node/bounded-wait.ts
|
|
25087
|
+
function boundedWait(work, timeoutMs, options = {}) {
|
|
25088
|
+
return new Promise((resolve, reject) => {
|
|
25089
|
+
let timedOut = false;
|
|
25090
|
+
const timer = setTimeout(() => {
|
|
25091
|
+
timedOut = true;
|
|
25092
|
+
resolve({ settled: false });
|
|
25093
|
+
}, timeoutMs);
|
|
25094
|
+
unrefTimer(timer);
|
|
25095
|
+
Promise.resolve(work).then((value) => {
|
|
25096
|
+
if (!timedOut) {
|
|
25097
|
+
clearTimeout(timer);
|
|
25098
|
+
resolve({ settled: true, value });
|
|
25099
|
+
return;
|
|
25100
|
+
}
|
|
25101
|
+
disposeLate(options.onLate, value);
|
|
25102
|
+
}, (error) => {
|
|
25103
|
+
if (!timedOut) {
|
|
25104
|
+
clearTimeout(timer);
|
|
25105
|
+
reject(error);
|
|
25106
|
+
}
|
|
25107
|
+
});
|
|
25108
|
+
});
|
|
25109
|
+
}
|
|
25110
|
+
function unrefTimer(timer) {
|
|
25111
|
+
const handle = timer;
|
|
25112
|
+
if (typeof handle === "object" && typeof handle.unref === "function")
|
|
25113
|
+
handle.unref();
|
|
25114
|
+
}
|
|
25115
|
+
function disposeLate(onLate, value) {
|
|
25116
|
+
if (!onLate)
|
|
25117
|
+
return;
|
|
25118
|
+
try {
|
|
25119
|
+
const disposal = onLate(value);
|
|
25120
|
+
if (disposal && typeof disposal.then === "function") {
|
|
25121
|
+
Promise.resolve(disposal).catch(() => {
|
|
25122
|
+
return;
|
|
25123
|
+
});
|
|
25124
|
+
}
|
|
25125
|
+
} catch {}
|
|
25126
|
+
}
|
|
25127
|
+
|
|
25014
25128
|
// ../../bridges/codex-bridge/src/engine/mcp-tool-availability.ts
|
|
25015
25129
|
var ORKESTRATOR_MCP_STARTUP_TIMEOUT_SEC = 15;
|
|
25016
25130
|
var MCP_TOOL_AVAILABILITY_TIMEOUT_MS = (ORKESTRATOR_MCP_STARTUP_TIMEOUT_SEC + 5) * 1000;
|
|
@@ -25047,29 +25161,19 @@ async function waitForMcpToolAvailability(list, serverName, toolName, options =
|
|
|
25047
25161
|
const now = options.now ?? Date.now;
|
|
25048
25162
|
const deadline = now() + (options.timeoutMs ?? MCP_TOOL_AVAILABILITY_TIMEOUT_MS);
|
|
25049
25163
|
const pollMs = options.pollMs ?? MCP_TOOL_AVAILABILITY_POLL_MS;
|
|
25050
|
-
const expired = Symbol("availability-deadline");
|
|
25051
25164
|
for (;; ) {
|
|
25052
25165
|
const remainingMs = deadline - now();
|
|
25053
25166
|
if (remainingMs <= 0)
|
|
25054
25167
|
return { state: "unverified" };
|
|
25055
25168
|
let response;
|
|
25056
|
-
let timer;
|
|
25057
25169
|
try {
|
|
25058
|
-
response = await
|
|
25059
|
-
list(remainingMs),
|
|
25060
|
-
new Promise((resolve) => {
|
|
25061
|
-
timer = setTimeout(() => resolve(expired), remainingMs);
|
|
25062
|
-
timer.unref?.();
|
|
25063
|
-
})
|
|
25064
|
-
]);
|
|
25170
|
+
response = await boundedWait(list(remainingMs), remainingMs);
|
|
25065
25171
|
} catch {
|
|
25066
25172
|
return { state: "unverified" };
|
|
25067
|
-
} finally {
|
|
25068
|
-
clearTimeout(timer);
|
|
25069
25173
|
}
|
|
25070
|
-
if (response
|
|
25174
|
+
if (!response.settled || now() >= deadline)
|
|
25071
25175
|
return { state: "unverified" };
|
|
25072
|
-
const availability = classifyMcpToolAvailability(response, serverName, toolName);
|
|
25176
|
+
const availability = classifyMcpToolAvailability(response.value, serverName, toolName);
|
|
25073
25177
|
if (availability)
|
|
25074
25178
|
return availability;
|
|
25075
25179
|
await new Promise((resolve) => {
|
|
@@ -25765,34 +25869,6 @@ function allowlistRateLimits(value) {
|
|
|
25765
25869
|
...Object.keys(rateLimitsByLimitId).length > 0 ? { rateLimitsByLimitId } : {}
|
|
25766
25870
|
};
|
|
25767
25871
|
}
|
|
25768
|
-
var MAX_DATE_MS2 = 8640000000000000;
|
|
25769
|
-
function rateLimitWindowsFromRead(value) {
|
|
25770
|
-
const response = objectRecord(value);
|
|
25771
|
-
const snapshot = allowlistRateLimitSnapshot(response.rateLimits);
|
|
25772
|
-
const planLabel = optionalPublicString(snapshot.limitName);
|
|
25773
|
-
const normalModelSlug = optionalPublicString(snapshot.normalModelSlug);
|
|
25774
|
-
const windows = [];
|
|
25775
|
-
for (const slot of ["primary", "secondary"]) {
|
|
25776
|
-
if (!Object.hasOwn(snapshot, slot))
|
|
25777
|
-
continue;
|
|
25778
|
-
const window = objectRecord(snapshot[slot]);
|
|
25779
|
-
if (!window)
|
|
25780
|
-
continue;
|
|
25781
|
-
const usedPercent = typeof window.usedPercent === "number" ? window.usedPercent : undefined;
|
|
25782
|
-
const windowMinutes = typeof window.windowDurationMins === "number" ? window.windowDurationMins : undefined;
|
|
25783
|
-
const resetsAtSeconds = typeof window.resetsAt === "number" ? window.resetsAt : undefined;
|
|
25784
|
-
const resetsAtMs = resetsAtSeconds !== undefined && Math.abs(resetsAtSeconds * 1000) <= MAX_DATE_MS2 ? resetsAtSeconds * 1000 : undefined;
|
|
25785
|
-
const resetsAt = resetsAtMs !== undefined ? new Date(resetsAtMs).toISOString() : undefined;
|
|
25786
|
-
windows.push({
|
|
25787
|
-
slot,
|
|
25788
|
-
label: slot === "primary" ? planLabel ?? normalModelSlug ?? "Primary" : "Secondary",
|
|
25789
|
-
...usedPercent !== undefined ? { usedPercent } : {},
|
|
25790
|
-
...resetsAt !== undefined ? { resetsAt } : {},
|
|
25791
|
-
...windowMinutes !== undefined ? { windowMinutes } : {}
|
|
25792
|
-
});
|
|
25793
|
-
}
|
|
25794
|
-
return windows;
|
|
25795
|
-
}
|
|
25796
25872
|
function safeUsageCount(value) {
|
|
25797
25873
|
let parsed;
|
|
25798
25874
|
if (typeof value === "bigint")
|
|
@@ -26919,10 +26995,6 @@ class AppServerEngine {
|
|
|
26919
26995
|
const response = await this.supervisor.request("account/usage/read", undefined);
|
|
26920
26996
|
return accountUsageWindows(response);
|
|
26921
26997
|
}
|
|
26922
|
-
async readRateLimitWindows() {
|
|
26923
|
-
const response = await this.supervisor.request("account/rateLimits/read", undefined);
|
|
26924
|
-
return rateLimitWindowsFromRead(response);
|
|
26925
|
-
}
|
|
26926
26998
|
async beginAccountLogin(method = "browser") {
|
|
26927
26999
|
const sequence = ++this.loginSequence;
|
|
26928
27000
|
this.forgetSignIn();
|
|
@@ -27694,6 +27766,9 @@ class CodexRuntimeSessions {
|
|
|
27694
27766
|
this.ctx = ctx;
|
|
27695
27767
|
this.lifecycle = lifecycle;
|
|
27696
27768
|
}
|
|
27769
|
+
sessionDeleteClaimed(session) {
|
|
27770
|
+
return this.deleteClaims.has(session);
|
|
27771
|
+
}
|
|
27697
27772
|
sessionAdmissionClosed(session) {
|
|
27698
27773
|
return this.ctx.closingSessionIds.has(session.id) || this.ctx.registry.getSession(session.id) !== session;
|
|
27699
27774
|
}
|
|
@@ -30696,16 +30771,8 @@ class CodexRuntimeLifecycle {
|
|
|
30696
30771
|
return false;
|
|
30697
30772
|
if (this.ctx.sessionRestore !== "restoring")
|
|
30698
30773
|
return true;
|
|
30699
|
-
|
|
30700
|
-
|
|
30701
|
-
timer = setTimeout(() => resolve(false), timeoutMs);
|
|
30702
|
-
timer.unref?.();
|
|
30703
|
-
});
|
|
30704
|
-
try {
|
|
30705
|
-
return await Promise.race([this.ctx.sessionsRestored.promise, timedOut]);
|
|
30706
|
-
} finally {
|
|
30707
|
-
clearTimeout(timer);
|
|
30708
|
-
}
|
|
30774
|
+
const restored = await boundedWait(this.ctx.sessionsRestored.promise, timeoutMs);
|
|
30775
|
+
return restored.settled && restored.value;
|
|
30709
30776
|
}
|
|
30710
30777
|
async stop() {
|
|
30711
30778
|
this.ctx.stopping = true;
|
|
@@ -32629,7 +32696,8 @@ class CodexRuntimePrompt {
|
|
|
32629
32696
|
const retryMessages = context.messages;
|
|
32630
32697
|
await this.ctx.journal.markRetryable(requestId);
|
|
32631
32698
|
await new Promise((resolve) => setTimeout(resolve, this.ctx.options.initialPromptRetryDelayMs ?? DEFAULT_INITIAL_PROMPT_RETRY_DELAY_MS));
|
|
32632
|
-
|
|
32699
|
+
const registeredSession = () => this.sessions.sessionDeleteClaimed(session) ? undefined : this.ctx.registry.getSession(session.id);
|
|
32700
|
+
let liveSession = registeredSession();
|
|
32633
32701
|
if (!this.ctx.stopping && liveSession === session && this.sessions.sessionAdmissionClosed(session)) {
|
|
32634
32702
|
return await refuseRetryForClose();
|
|
32635
32703
|
}
|
|
@@ -32648,7 +32716,7 @@ class CodexRuntimePrompt {
|
|
|
32648
32716
|
return { ok: false, status: 404, error: "Session not found" };
|
|
32649
32717
|
}
|
|
32650
32718
|
await this.ctx.generationRecovery;
|
|
32651
|
-
liveSession =
|
|
32719
|
+
liveSession = registeredSession();
|
|
32652
32720
|
if (!this.ctx.stopping && liveSession === session && this.sessions.sessionAdmissionClosed(session)) {
|
|
32653
32721
|
return await refuseRetryForClose();
|
|
32654
32722
|
}
|
|
@@ -33364,11 +33432,6 @@ class CodexRuntimeTail {
|
|
|
33364
33432
|
}
|
|
33365
33433
|
return this.ctx.options.loadCachedModels();
|
|
33366
33434
|
}
|
|
33367
|
-
async readPlanUsage() {
|
|
33368
|
-
const limits = await this.ctx.options.engine.readRateLimitWindows();
|
|
33369
|
-
const windows = accountUsageFromLimits(limits);
|
|
33370
|
-
return windows.length > 0 ? windows : undefined;
|
|
33371
|
-
}
|
|
33372
33435
|
async listSessions(options = {}) {
|
|
33373
33436
|
const cwd = getWorkingDirectory(this.ctx.options.cwd);
|
|
33374
33437
|
const merged = new Map;
|
|
@@ -33724,9 +33787,6 @@ class AppServerRuntime {
|
|
|
33724
33787
|
listModels(...args) {
|
|
33725
33788
|
return this.tail.listModels(...args);
|
|
33726
33789
|
}
|
|
33727
|
-
readPlanUsage(...args) {
|
|
33728
|
-
return this.tail.readPlanUsage(...args);
|
|
33729
|
-
}
|
|
33730
33790
|
listSessions(...args) {
|
|
33731
33791
|
return this.tail.listSessions(...args);
|
|
33732
33792
|
}
|
|
@@ -34350,7 +34410,6 @@ function boundCodexTranscriptResponse(messages, tailMessages) {
|
|
|
34350
34410
|
return { messages: bounded, messageWindow };
|
|
34351
34411
|
}
|
|
34352
34412
|
var BRIDGE_TOKEN_ENV = "CODEX_BRIDGE_TOKEN";
|
|
34353
|
-
var BRIDGE_ALLOWED_ORIGINS_ENV = "CODEX_BRIDGE_ALLOWED_ORIGINS";
|
|
34354
34413
|
var bridgeCredential = loadBridgeCredential(BRIDGE_TOKEN_ENV);
|
|
34355
34414
|
var bridgeAuthEnabledOverrideForTesting = null;
|
|
34356
34415
|
var sseRouteTestHooks = null;
|
|
@@ -34453,11 +34512,6 @@ function bearerToken(header) {
|
|
|
34453
34512
|
function isTrustedBridgeOrigin(origin) {
|
|
34454
34513
|
if (!origin)
|
|
34455
34514
|
return true;
|
|
34456
|
-
if (origin === "null" || origin === "file://")
|
|
34457
|
-
return true;
|
|
34458
|
-
const configured = (process.env[BRIDGE_ALLOWED_ORIGINS_ENV] ?? "").split(",").map((entry) => entry.trim().replace(/\/$/, "")).filter(Boolean);
|
|
34459
|
-
if (configured.includes(origin.replace(/\/$/, "")))
|
|
34460
|
-
return true;
|
|
34461
34515
|
try {
|
|
34462
34516
|
const parsed = new URL(origin);
|
|
34463
34517
|
return (parsed.protocol === "http:" || parsed.protocol === "https:") && (parsed.hostname === "127.0.0.1" || parsed.hostname === "localhost" || parsed.hostname === "::1" || parsed.hostname === "[::1]");
|
|
@@ -34862,21 +34916,10 @@ app.use("*", async (c, next) => {
|
|
|
34862
34916
|
if (!isTrustedBridgeOrigin(origin)) {
|
|
34863
34917
|
return c.json({ error: "Origin is not allowed" }, 403);
|
|
34864
34918
|
}
|
|
34865
|
-
if (origin) {
|
|
34866
|
-
c.header("Access-Control-Allow-Origin", origin);
|
|
34867
|
-
c.header("Vary", "Origin");
|
|
34868
|
-
}
|
|
34869
|
-
if (c.req.method === "OPTIONS") {
|
|
34870
|
-
c.header("Access-Control-Allow-Methods", "GET, POST, DELETE, OPTIONS");
|
|
34871
|
-
c.header("Access-Control-Allow-Headers", "Content-Type, Authorization, X-Orkestrator-Codex-Token");
|
|
34872
|
-
c.header("Access-Control-Allow-Private-Network", "true");
|
|
34873
|
-
return c.body(null, 204);
|
|
34874
|
-
}
|
|
34875
34919
|
if (isBridgeAuthEnabled() && !isPublicHealthRequest(c.req.method, c.req.path)) {
|
|
34876
34920
|
const dedicatedHeaderToken = c.req.raw.headers.get("x-orkestrator-codex-token")?.trim();
|
|
34877
34921
|
const headerToken = bearerToken(c.req.raw.headers.get("authorization") ?? undefined);
|
|
34878
|
-
|
|
34879
|
-
if (!tokenMatches(dedicatedHeaderToken) && !tokenMatches(headerToken) && !tokenMatches(eventToken)) {
|
|
34922
|
+
if (!tokenMatches(dedicatedHeaderToken) && !tokenMatches(headerToken)) {
|
|
34880
34923
|
return c.json({ error: "Unauthorized" }, 401);
|
|
34881
34924
|
}
|
|
34882
34925
|
const admission = await admitFetchBridgeRequest(bridgeCredential.authority, c.req.raw);
|
|
@@ -34985,10 +35028,6 @@ app.post("/global/auth/logout", async (c) => {
|
|
|
34985
35028
|
app.get("/global/models", async (c) => {
|
|
34986
35029
|
return c.json(await appServerRuntime.listModels());
|
|
34987
35030
|
});
|
|
34988
|
-
app.get("/global/usage", async (c) => {
|
|
34989
|
-
const account = await appServerRuntime.readPlanUsage();
|
|
34990
|
-
return c.json({ account: account ?? null });
|
|
34991
|
-
});
|
|
34992
35031
|
app.get("/session/:id/commands", async (c) => {
|
|
34993
35032
|
return c.json(await appServerRuntime.getCommandCatalogue(c.req.param("id")));
|
|
34994
35033
|
});
|
|
@@ -35422,7 +35461,7 @@ app.get("/session/:id/mcp", async (c) => {
|
|
|
35422
35461
|
if (typeof server.name !== "string")
|
|
35423
35462
|
return [];
|
|
35424
35463
|
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";
|
|
35425
|
-
const tools = server.tools && typeof server.tools === "object" ? Object.keys(server.tools).slice(0, 256) : [];
|
|
35464
|
+
const tools = server.tools && typeof server.tools === "object" ? Object.keys(server.tools).sort().slice(0, 256) : [];
|
|
35426
35465
|
return [
|
|
35427
35466
|
{
|
|
35428
35467
|
id: server.name,
|
|
@@ -35477,10 +35516,6 @@ app.post("/session/:id/abort", async (c) => {
|
|
|
35477
35516
|
return c.json({ error: "Session not found" }, 404);
|
|
35478
35517
|
return c.json({ status: outcome.status, phase: outcome.phase }, 202);
|
|
35479
35518
|
});
|
|
35480
|
-
app.delete("/session/:id", async (c) => {
|
|
35481
|
-
const deleted = await appServerRuntime.deleteSession(c.req.param("id"));
|
|
35482
|
-
return deleted ? c.json({ status: "deleted" }) : c.json({ error: "Session not found" }, 404);
|
|
35483
|
-
});
|
|
35484
35519
|
app.get("/event/subscribe", (c) => {
|
|
35485
35520
|
const cursor = parseEventCursor(c.req.query("since")) ?? parseEventCursor(c.req.header("last-event-id"));
|
|
35486
35521
|
const sessionFilter = c.req.query("sessionId")?.trim() || null;
|