orkestrator 2.36.6-beta → 2.37.1-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.
Files changed (55) hide show
  1. package/dist/artifact-runtime/THIRD_PARTY_NOTICES.txt +1038 -0
  2. package/dist/artifact-runtime/chart.umd.min.js +14 -0
  3. package/dist/artifact-runtime/d3.min.js +2 -0
  4. package/dist/artifact-runtime/licenses/chart.js@4.5.1/@kurkle/color/LICENSE.md +9 -0
  5. package/dist/artifact-runtime/licenses/chart.js@4.5.1/LICENSE.md +9 -0
  6. package/dist/artifact-runtime/licenses/d3@7.9.0/LICENSE +13 -0
  7. package/dist/artifact-runtime/licenses/dompurify@3.4.17/LICENSE +202 -0
  8. package/dist/artifact-runtime/licenses/dompurify@3.4.17/LICENSE-MPL +373 -0
  9. package/dist/artifact-runtime/licenses/mermaid@12.2.0/LICENSE +21 -0
  10. package/dist/artifact-runtime/licenses/pdfjs-dist-worker@6.4.299/LICENSE +177 -0
  11. package/dist/artifact-runtime/licenses/pdfjs-dist@6.4.299/LICENSE +177 -0
  12. package/dist/artifact-runtime/mermaid.min.js +4330 -0
  13. package/dist/artifact-runtime/pdf.min.mjs +28 -0
  14. package/dist/artifact-runtime/pdf.worker.min.mjs +28 -0
  15. package/dist/artifact-runtime/preview-worker.js +2043 -0
  16. package/dist/artifact-runtime/purify.min.js +7 -0
  17. package/dist/artifact-runtime/seccomp_profile.json +701 -0
  18. package/dist/artifact-runtime/worker-context/Dockerfile +41 -0
  19. package/dist/artifact-runtime/worker-context/THIRD_PARTY_NOTICES.txt +1038 -0
  20. package/dist/artifact-runtime/worker-context/chart.umd.min.js +14 -0
  21. package/dist/artifact-runtime/worker-context/d3.min.js +2 -0
  22. package/dist/artifact-runtime/worker-context/licenses/chart.js@4.5.1/@kurkle/color/LICENSE.md +9 -0
  23. package/dist/artifact-runtime/worker-context/licenses/chart.js@4.5.1/LICENSE.md +9 -0
  24. package/dist/artifact-runtime/worker-context/licenses/d3@7.9.0/LICENSE +13 -0
  25. package/dist/artifact-runtime/worker-context/licenses/dompurify@3.4.17/LICENSE +202 -0
  26. package/dist/artifact-runtime/worker-context/licenses/dompurify@3.4.17/LICENSE-MPL +373 -0
  27. package/dist/artifact-runtime/worker-context/licenses/mermaid@12.2.0/LICENSE +21 -0
  28. package/dist/artifact-runtime/worker-context/licenses/pdfjs-dist-worker@6.4.299/LICENSE +177 -0
  29. package/dist/artifact-runtime/worker-context/licenses/pdfjs-dist@6.4.299/LICENSE +177 -0
  30. package/dist/artifact-runtime/worker-context/mermaid.min.js +4330 -0
  31. package/dist/artifact-runtime/worker-context/package-lock.json +25 -0
  32. package/dist/artifact-runtime/worker-context/package.json +8 -0
  33. package/dist/artifact-runtime/worker-context/pdf.min.mjs +28 -0
  34. package/dist/artifact-runtime/worker-context/pdf.worker.min.mjs +28 -0
  35. package/dist/artifact-runtime/worker-context/preview-worker.mjs +2042 -0
  36. package/dist/artifact-runtime/worker-context/purify.min.js +7 -0
  37. package/dist/artifact-runtime/worker-context/seccomp_profile.json +701 -0
  38. package/dist/client.js +6132 -294
  39. package/dist/main.js +103177 -64996
  40. package/package.json +4 -4
  41. package/resources/acp-bridge/dist/index.js +253 -36
  42. package/resources/claude-bridge/dist/index.js +2705 -2320
  43. package/resources/codex-bridge/dist/index.js +332 -34
  44. package/resources/cursor-bridge/dist/index.js +160 -11
  45. package/resources/cursor-bridge/runtime/bun.lock +8 -8
  46. package/resources/cursor-bridge/runtime/install.json +1 -1
  47. package/resources/cursor-bridge/runtime/package.json +2 -2
  48. package/resources/cursor-bridge/runtime/patches/@cursor%2Fsdk@1.3.1.patch +19 -0
  49. package/resources/pi-bridge/dist/index.js +622 -86
  50. package/resources/pi-bridge/runtime/bun.lock +36 -32
  51. package/resources/pi-bridge/runtime/install.json +1 -1
  52. package/resources/pi-bridge/runtime/package.json +3 -3
  53. package/resources/release-runtime/bun.lock +13 -13
  54. package/resources/release-runtime/package.json +1 -1
  55. package/resources/cursor-bridge/runtime/patches/@cursor%2Fsdk@1.2.0.patch +0 -19
@@ -413,6 +413,29 @@ var SOURCE_SCOPE_LABELS = Object.freeze({
413
413
  agent: "an agent definition",
414
414
  sdk: "the agent host"
415
415
  });
416
+ var TOOL_HINT_KEYS = ["readOnly", "destructive", "idempotent", "openWorld"];
417
+ var TOOL_HINT_KEY_SET = new Set(TOOL_HINT_KEYS);
418
+ var MCP_TOOL_ANNOTATION_KEYS = Object.freeze({
419
+ readOnly: "readOnlyHint",
420
+ destructive: "destructiveHint",
421
+ idempotent: "idempotentHint",
422
+ openWorld: "openWorldHint"
423
+ });
424
+ function toolHintsFrom(value, keyFor) {
425
+ if (typeof value !== "object" || value === null || Array.isArray(value))
426
+ return;
427
+ const source = value;
428
+ const hints = {};
429
+ for (const key of TOOL_HINT_KEYS) {
430
+ const declared = source[keyFor(key)];
431
+ if (typeof declared === "boolean")
432
+ hints[key] = declared;
433
+ }
434
+ return Object.keys(hints).length > 0 ? hints : undefined;
435
+ }
436
+ function agentInteractionToolHintsFromMcpAnnotations(annotations) {
437
+ return toolHintsFrom(annotations, (key) => MCP_TOOL_ANNOTATION_KEYS[key]);
438
+ }
416
439
  var UNATTENDED_POLICY_INSTRUCTION = "This is a non-interactive build session: no user can answer a provider input request. " + "If input is unavailable or declined, choose the safest likely assumption yourself, " + "state that assumption, and continue. Never treat the absence of a person as authorization.";
417
440
  var INTERACTIVE_AGENT_INTERACTION_POLICY = Object.freeze({
418
441
  version: AGENT_INTERACTION_POLICY_VERSION,
@@ -489,7 +512,9 @@ var REQUEST_KEYS = new Set([
489
512
  "updatedAt",
490
513
  "expiresAt",
491
514
  "hold",
492
- "source"
515
+ "source",
516
+ "humanRequired",
517
+ "toolHints"
493
518
  ]);
494
519
  var SOURCE_KEYS = new Set(["kind", "name", "scope"]);
495
520
  var SOURCE_KINDS = new Set(AGENT_INTERACTION_SOURCE_KINDS);
@@ -716,6 +741,11 @@ function withheldGitHubCredentialEnvironment(env, options) {
716
741
 
717
742
  // ../protocol/src/native-agent-steer-rejection.ts
718
743
  var MAX_STEER_JOURNAL_BYTES = 1024 * 1024 * 1024;
744
+ // ../protocol/src/native-agent-cost-source.ts
745
+ var NATIVE_AGENT_COST_SOURCES = Object.freeze([
746
+ "provider",
747
+ "estimate"
748
+ ]);
719
749
  // ../protocol/src/native-agent.ts
720
750
  var DEFAULT_REASONING_ID = "default";
721
751
  var FALLBACK_REASONING_ID = "high";
@@ -1120,11 +1150,13 @@ var BACKEND_LOG_AREAS = defineLogAreas({
1120
1150
  "instance.republish-failed": "The instance descriptor could not be republished; a later pass retries.",
1121
1151
  "parent.exited": "The parent process exited, so local servers are shutting down.",
1122
1152
  "startup.step-failed": "One part of startup failed and the backend carried on; `step` says which.",
1153
+ "startup.failed": "Startup failed; the backend released what it had started and exits with code 1.",
1123
1154
  "startup.setup-fence-failed": "An environment's interrupted setup could not be fenced.",
1124
1155
  "startup.setup-adopt-failed": "An environment's pending setup could not be adopted.",
1125
1156
  "startup.deletion-pending": "An interrupted environment deletion stays pending. Its owning step logged the detail.",
1126
1157
  "startup.looped-review-pending": "Cleanup of the retired Looped Review stays pending.",
1127
1158
  "notice.failed": "A background notice after a turn or prompt failed; `step` says which.",
1159
+ "command.slow": "A registered command took at least 2 s to settle, or its synchronous part held the event loop for at least 250 ms (then at warn): `command`, `durationMs`, `syncMs` and `outcome`. Repeats of one command within a minute are folded into the next line.",
1128
1160
  "artifacts.live-unavailable": "Live interactive artifacts are unavailable.",
1129
1161
  "previous-run": {
1130
1162
  description: "This start read how the previous run ended: `outcome` is `clean` when it reached the end of shutdown and `crashed` when it did not, `ranForMs` its length and `lastSeenAgoMs` the time since its last health row.",
@@ -1203,6 +1235,7 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
1203
1235
  "context-usage.read-failed": "The detailed context usage read failed; the route falls back.",
1204
1236
  "dispatch.rollback-failed": "Rolling back a prompt dispatch claim failed.",
1205
1237
  "event-subscriber.failed": "An event subscriber threw; other subscribers still ran.",
1238
+ "hook.boundary-failed-closed": "A PreToolUse hook that holds a boundary threw, so the tool call was denied.",
1206
1239
  "http.request-failed": "An HTTP route threw; it answered 500.",
1207
1240
  "mcp.config-ignored": "An MCP server configuration of an unsupported shape was ignored.",
1208
1241
  "mcp.read-failed": "Listing MCP servers failed; the route answered 500.",
@@ -1282,6 +1315,7 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
1282
1315
  "app-server.stale-reaped": "A stale app-server left by an earlier bridge was stopped.",
1283
1316
  "app-server.stderr": "Metadata of an app-server stderr line, never its content.",
1284
1317
  "app-server.stderr-suppressed": "app-server stderr lines beyond the budget were counted, not described.",
1318
+ "app-server.termination-unconfirmed": "app-server did not report an exit after SIGKILL; the restart or shutdown went on without it.",
1285
1319
  "approval.cancel-failed": "Cancelling a turn after an approval answer failed.",
1286
1320
  "approval.present-failed": "Presenting an approval threw; it is auto-declined.",
1287
1321
  "approval.resolved-callback-failed": "An approval resolved callback threw.",
@@ -1380,6 +1414,7 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
1380
1414
  essential: true,
1381
1415
  fields: ESSENTIAL_ERROR_FIELDS
1382
1416
  },
1417
+ "session.write-lost": "Pi could not write its session file, so a resume may miss part of the conversation; logged once per session, with no error message because it names the path.",
1383
1418
  "turn.failed": "A turn failed; its error message is not logged because it can hold content. A cancelled turn is not a failure.",
1384
1419
  "turn.refused": "Pi refused a prompt before starting a run, so nothing ran; its error message is not logged because it can hold content.",
1385
1420
  "turn.startup-timed-out": "Pi did not start a turn within its startup deadline, so the prompt was abandoned."
@@ -1387,6 +1422,18 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
1387
1422
  }
1388
1423
  });
1389
1424
 
1425
+ // ../protocol/src/log-vocabulary/contract.ts
1426
+ var CONTRACT_LOG_AREAS = defineLogAreas({
1427
+ contract: {
1428
+ description: "Versioned command and event contracts: domain ranges a peer's hello advertises, typed backend events.",
1429
+ events: {
1430
+ "hello.domains-malformed": "A peer's hello carried a `domains` field outside its bounds, so the peer is treated as pre-contract. `reason` only, never names or values.",
1431
+ "listen.payload-invalid": "A client dropped a received event whose payload did not decode against its contract definition. `event` (the name, or a family's prefix) only, never payload values.",
1432
+ "event.invalid": "Development only: the backend emitted an event whose payload, key or definition failed its contract check; it was still delivered. `event` (the name, or a family's prefix) and `error` (`payload` or the check that failed), never payload values."
1433
+ }
1434
+ }
1435
+ });
1436
+
1390
1437
  // ../protocol/src/log-vocabulary/desktop.ts
1391
1438
  var DESKTOP_LOG_AREAS = defineLogAreas({
1392
1439
  desktop: {
@@ -1418,7 +1465,12 @@ var DESKTOP_LOG_AREAS = defineLogAreas({
1418
1465
  minLevel: "error",
1419
1466
  fields: { lagMs: "number", intervalMs: "number" }
1420
1467
  },
1468
+ "process-memory": "Development only: working set per Electron process type, sampled on an interval.",
1469
+ "process-memory.failed": "Development only: one process memory sample could not be read.",
1421
1470
  "quit.stopping-backend": "The app is quitting and has asked the Local backend to stop.",
1471
+ "realm-partitions.list-failed": "The partitions directory could not be read, so retired workspace realm storage stays until the next start.",
1472
+ "realm-partitions.remove-failed": "Some retired workspace realm storage directories could not be removed; count says how many.",
1473
+ "realm-partitions.removed": "Retired workspace realm storage was removed at startup; count says how many directories.",
1422
1474
  "relaunch.schedule-failed": "The AppImage relaunch waiter failed; using Electron's relauncher.",
1423
1475
  "relaunch.service-register-failed": "The AppImage relaunch service was refused; using a detached waiter.",
1424
1476
  "renderer.gone-giving-up": "A renderer kept dying, so the window is no longer reloaded.",
@@ -1456,7 +1508,7 @@ var DESKTOP_LOG_AREAS = defineLogAreas({
1456
1508
  }
1457
1509
  },
1458
1510
  "desktop.permissions": {
1459
- description: "Permission requests refused on the renderer and workspace realm sessions.",
1511
+ description: "Permission requests refused on the renderer's session.",
1460
1512
  events: {
1461
1513
  denied: "A renderer asked for a permission the policy does not grant."
1462
1514
  }
@@ -1490,9 +1542,11 @@ var DESKTOP_LOG_AREAS = defineLogAreas({
1490
1542
  }
1491
1543
  },
1492
1544
  workspaces: {
1493
- description: "Workspace realms the desktop holds on other machines.",
1545
+ description: "Node workspaces (node scopes) the desktop holds on other machines.",
1494
1546
  events: {
1495
- "route.moved-direct": "A relayed workspace moved to its direct route."
1547
+ "route.moved-direct": "A relayed workspace moved to its direct route.",
1548
+ "workspace.opened": "The command node issued a node workspace grant; durationMs is the open_node_workspace call.",
1549
+ "workspace.route-probed": "One route of a node workspace was probed; outcome is fixed, durationMs the probe."
1496
1550
  }
1497
1551
  },
1498
1552
  toolchain: {
@@ -1819,7 +1873,9 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
1819
1873
  "monitor.reconnecting": "The request monitor lost its stream and is reconnecting. Error class only.",
1820
1874
  "worker-limit.reached": "The bounded request workers are full, so the stream restarts and a snapshot reconciles.",
1821
1875
  "request.failed": "Handling a request event failed, so the stream restarts. Error class only.",
1822
- "credential-plugin.skipped": "A host OpenCode server started without the credential plugin, so its tools inherit its password; `reason` says why."
1876
+ "credential-plugin.skipped": "A host OpenCode server started without the credential plugin, so its tools inherit its password; `reason` says why.",
1877
+ "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."
1823
1879
  }
1824
1880
  }
1825
1881
  });
@@ -1866,10 +1922,21 @@ var RUNTIME_LOG_AREAS = defineLogAreas({
1866
1922
  description: "This process's event loop. A stall of 10 seconds or more is written at error, so no level hides it.",
1867
1923
  events: {
1868
1924
  stalled: {
1869
- description: "A timer fired late, so every request in that window waited.",
1925
+ 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, and `blockingCommand` one whose synchronous part overlapped it.",
1870
1926
  essential: true,
1871
1927
  minLevel: "error",
1872
- fields: { lagMs: "number", intervalMs: "number" }
1928
+ fields: {
1929
+ lagMs: "number",
1930
+ intervalMs: "number",
1931
+ storageMs: "number",
1932
+ storageDatabase: "label",
1933
+ storageOp: "label",
1934
+ storageTable: "label",
1935
+ storageLongestMs: "number",
1936
+ storageBusy: "boolean",
1937
+ commandsInFlight: "number",
1938
+ blockingCommandMs: "number"
1939
+ }
1873
1940
  }
1874
1941
  }
1875
1942
  },
@@ -1901,6 +1968,7 @@ var TERMINAL_LOG_AREAS = defineLogAreas({
1901
1968
  events: {
1902
1969
  "input.undelivered": "A keystroke did not reach a shell: `no-session` or `not-delivered`.",
1903
1970
  "orphan.reaped": "A terminal no tab references was closed.",
1971
+ "container-shell.close-failed": "Ending a closed container terminal's in-container shell failed; the next shell start sweeps its record.",
1904
1972
  "agent-completion.notify-failed": "A terminal agent's completion could not be reported.",
1905
1973
  "activity.record-failed": "Terminal environment activity could not be recorded.",
1906
1974
  "pty.exit-listener-failed": "A terminal exit listener threw; the others still run.",
@@ -2073,6 +2141,7 @@ var UPDATER_LOG_AREAS = defineLogAreas({
2073
2141
  "check.failed": "An update check failed; the next periodic check retries.",
2074
2142
  "download.failed": "Downloading or staging an update failed.",
2075
2143
  downloaded: "An update finished downloading.",
2144
+ "release.not-ready": "The newest release has no update files for this platform yet, so the check uses the one before it.",
2076
2145
  "library.message": "One line from electron-updater at its own level. Its debug output, which includes the differential download plan, is off by default.",
2077
2146
  "remote.check-failed": "A check a remote client requested failed.",
2078
2147
  "remote.installing": "Installing an update for a remote client.",
@@ -2167,6 +2236,24 @@ var STORAGE_LOG_AREAS = defineLogAreas({
2167
2236
  "scrub.vacuum-failed": "Deleted-content page reclamation failed; the checkpoint is attempted independently.",
2168
2237
  "scrub.checkpoint-failed": "Deleted content could not be scrubbed from the WAL yet because the truncating checkpoint failed or a reader held an older snapshot; it is retried without waiting until it succeeds.",
2169
2238
  "upkeep.vacuum-failed": "Periodic page reclamation failed; the next upkeep pass retries.",
2239
+ "upkeep.finished": "One periodic upkeep pass ended: `optimizeMs` is how long refreshing planner statistics held the event loop, `released` and `left` the free pages returned and still free, `releaseMs` the release child's run and `stop` why it ended (`done`, `budget`, `busy`, `no-progress`, `slow-step`, `not-incremental`, `no-free-pages`, `failed`).",
2240
+ "operation.slow": {
2241
+ description: "A synchronous SQLite call or transaction held the event loop for at least 250 ms. `database` is `main` or `ledger`, `op` the statement kind or `transaction`, `table` its table (a transaction's slowest statement's), `durationMs` the whole call; a transaction adds `mode`, `beginMs` (waiting for the write lock), `sqlMs` (its statements) and `commitMs`. `busy` means the busy timeout ran out. Repeats of one series within 10 s are folded into the next line.",
2242
+ essential: true,
2243
+ fields: {
2244
+ database: "label",
2245
+ op: "label",
2246
+ table: "label",
2247
+ mode: "label",
2248
+ durationMs: "number",
2249
+ beginMs: "number",
2250
+ sqlMs: "number",
2251
+ commitMs: "number",
2252
+ busy: "boolean",
2253
+ folded: "number",
2254
+ foldedMaxMs: "number"
2255
+ }
2256
+ },
2170
2257
  "optimize.failed": "Refreshing the query planner's statistics failed; queries still run and the next check retries.",
2171
2258
  "ledger.moved": "The change-tracking ledger was moved out of the main database into its own file; `rows` and `durationMs` say how much and how long.",
2172
2259
  "snapshot.top-tables-failed": "The sampled table sizes from a finished snapshot could not be saved; the snapshot stands and the next one retries.",
@@ -2352,6 +2439,8 @@ var REVIEW_LOG_AREAS = defineLogAreas({
2352
2439
  "monitor.state-clear-failed": "A pull request's saved state could not be cleared.",
2353
2440
  "monitor.task-reconcile-failed": "Updating the Kanban task of a merged or closed (`state`) pull request failed.",
2354
2441
  "monitor.task-store-failed": "A pull request could not be recorded on its Kanban task.",
2442
+ "monitor.merged-tickets-closed": "The startup sweep moved Kanban tickets whose pull request had merged to done (`count`).",
2443
+ "monitor.merged-tickets-close-failed": "The startup sweep closing Kanban tickets whose pull request merged failed; the next backend start retries.",
2355
2444
  "monitor.emit-failed": "A pull request monitor event could not be emitted to its sink."
2356
2445
  }
2357
2446
  }
@@ -2381,6 +2470,7 @@ var AGENT_ACCOUNTS_LOG_AREAS = defineLogAreas({
2381
2470
  "limit-stop-notice.failed": "A session's usage-limit stop could not be reported.",
2382
2471
  "switch-notice.failed": "A notice about an automatic account switch failed; the switch stands. `audience` says whose.",
2383
2472
  "auto-switch.check-failed": "An automatic account check failed; the next nudge retries.",
2473
+ "kept-note.failed": "Recording why a limit stop found no account to move to failed; the stop stands.",
2384
2474
  "container-sync.failed": "Handing a login or account to a container failed; `step` says which part.",
2385
2475
  "last-usage.save-failed": "The last plan usage reading could not be saved; the next save retries.",
2386
2476
  "login-cleanup.failed": "A temporary login could not be cleaned up.",
@@ -2579,12 +2669,16 @@ var NODES_LOG_AREAS = defineLogAreas({
2579
2669
  "verification.record-failed": "A node verification could not be recorded.",
2580
2670
  "profile.record-failed": "A node profile could not be recorded.",
2581
2671
  "detach.unconfirmed": "A forgotten node has not confirmed the detach yet.",
2672
+ "grant.scope-disagreement": "Debug only, for one release: the grant allow-list and the old deny-lists disagree on a command.",
2582
2673
  "grant.revocation-listener-failed": "A connection could not be told its client grant was removed; the grant is still gone.",
2583
2674
  "handover.recovery-pending": "Command handover recovery is still pending.",
2584
2675
  "ticket-sync.work-record-failed": "A remote build started but its ticket work location could not be saved.",
2585
2676
  "ticket-sync.failed": "A Kanban sync with a node failed; it is retried.",
2586
2677
  "ticket-sync.unknown-project": "A node sent ticket changes for a project that no longer exists here.",
2587
- "ticket-sync.forget-failed": "A detached command node's ticket copies could not be released."
2678
+ "ticket-sync.forget-failed": "A detached command node's ticket copies could not be released.",
2679
+ "fleet-update.requested": "The update policy asked an older leaf to install the command node's version.",
2680
+ "fleet-update.failed": "The update policy could not read or update a leaf; it retries later.",
2681
+ "fleet-update.policy-load-failed": "The stored update policy could not be read; it is off."
2588
2682
  }
2589
2683
  }
2590
2684
  });
@@ -2739,6 +2833,7 @@ var WEB_BUILD_PIPELINE_LOG_AREAS = defineLogAreas({
2739
2833
  "transcript.load-failed": "A stage transcript read failed and will retry with backoff.",
2740
2834
  "legacy.state-too-large": "Legacy pipeline state was over the limit and skipped.",
2741
2835
  "opencode-catalog.load-failed": "The cached OpenCode model list could not be loaded.",
2836
+ "model-catalog.hydrate-failed": "A node's cached model lists could not be loaded for a launcher.",
2742
2837
  "opencode-preferences.load-failed": "OpenCode model preferences could not be loaded."
2743
2838
  }
2744
2839
  }
@@ -3033,7 +3128,8 @@ var WEB_SHELL_LOG_AREAS = defineLogAreas({
3033
3128
  description: "Loading the renderer, after the desktop connection check.",
3034
3129
  events: {
3035
3130
  "renderer.load-failed": "Importing or mounting the application failed.",
3036
- "model-catalogue.restore-failed": "The cached model catalogue could not be restored; bundled fallbacks stay in use."
3131
+ "model-catalogue.restore-failed": "The cached model catalogue could not be restored; bundled fallbacks stay in use.",
3132
+ "model-catalogue.seed-failed": "The background model-catalogue seed failed; cached catalogues stay in use."
3037
3133
  }
3038
3134
  },
3039
3135
  "web.window": {
@@ -3056,6 +3152,18 @@ var WEB_SHELL_LOG_AREAS = defineLogAreas({
3056
3152
 
3057
3153
  // ../protocol/src/log-vocabulary/web-sync.ts
3058
3154
  var WEB_SYNC_LOG_AREAS = defineLogAreas({
3155
+ "web.node-snapshot": {
3156
+ description: "Bounded local snapshots of each node's light stores, for snapshot-first paint.",
3157
+ events: {
3158
+ "read-failed": "Reading a node's snapshot failed; the node opens without one.",
3159
+ "write-failed": "Writing a node's snapshot failed; the next interval tries again.",
3160
+ refused: "A snapshot broke the content rules or the per-node byte bound; nothing was written.",
3161
+ evicted: "Least recently used snapshots were dropped to keep the total bounds.",
3162
+ "clear-failed": "Dropping one or every snapshot failed.",
3163
+ "command-hydrated": "The window's command scope was filled from its snapshot before its services started.",
3164
+ "command-discarded": "The command node proved another id than its snapshot's; the snapshot's data was taken back."
3165
+ }
3166
+ },
3059
3167
  "web.resource-sync": {
3060
3168
  description: "Keeping renderer stores current with backend resources.",
3061
3169
  events: {
@@ -3112,6 +3220,15 @@ var WEB_SYNC_LOG_AREAS = defineLogAreas({
3112
3220
  "event-handler.failed": "A handler for an event relayed from a node failed.",
3113
3221
  "environment.start-failed": "Starting an environment opened in a workspace window failed."
3114
3222
  }
3223
+ },
3224
+ "web.node-scope": {
3225
+ description: "Per-node renderer scopes: their services, stores and cleanup.",
3226
+ events: {
3227
+ "service.failed": "A scoped service threw; only it stopped and its scope is marked failed.",
3228
+ "finalizer.failed": "A cleanup step of a scope, service or store threw; the rest still ran.",
3229
+ "workspace.render-failed": "A node's workspace in the window's tree failed to render; only it shows an error.",
3230
+ "lifecycle.pressure": "Memory pressure moved hidden node scopes down a tier (heavy data dropped, suspended or disposed); counts only."
3231
+ }
3115
3232
  }
3116
3233
  });
3117
3234
 
@@ -3120,6 +3237,7 @@ var LOG_VOCABULARY = {
3120
3237
  ...AGENT_MAIL_LOG_AREAS,
3121
3238
  ...BACKEND_LOG_AREAS,
3122
3239
  ...BRIDGE_LOG_AREAS,
3240
+ ...CONTRACT_LOG_AREAS,
3123
3241
  ...DESKTOP_LOG_AREAS,
3124
3242
  ...ENVIRONMENT_LOG_AREAS,
3125
3243
  ...GATEWAY_LOG_AREAS,
@@ -3455,6 +3573,47 @@ var SIGNALS = new Set([
3455
3573
  var PROVIDERS3 = new Set(["claude", "codex", "opencode", "cursor", "grok", "acp", "pi"]);
3456
3574
  var UUID = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
3457
3575
  var SOURCE = new RegExp(`^(?:claude|codex|opencode|cursor|grok|acp|pi):${UUID}$`, "i");
3576
+ var STORAGE_DATABASES = new Set(["main", "ledger", "other"]);
3577
+ var STORAGE_OPERATIONS = new Set([
3578
+ "select",
3579
+ "insert",
3580
+ "update",
3581
+ "delete",
3582
+ "pragma",
3583
+ "schema",
3584
+ "vacuum",
3585
+ "transaction",
3586
+ "other"
3587
+ ]);
3588
+ var TRANSACTION_MODES = new Set(["deferred", "immediate", "exclusive"]);
3589
+ var STORAGE_TABLES = new Set([
3590
+ "stores",
3591
+ "store_rows",
3592
+ "storage_meta",
3593
+ "leases",
3594
+ "store_rows_owner",
3595
+ "store_rows_position",
3596
+ "sqlite_master",
3597
+ "sqlite_schema",
3598
+ "dbstat",
3599
+ "analysis_limit",
3600
+ "auto_vacuum",
3601
+ "busy_timeout",
3602
+ "foreign_keys",
3603
+ "freelist_count",
3604
+ "incremental_vacuum",
3605
+ "integrity_check",
3606
+ "journal_mode",
3607
+ "journal_size_limit",
3608
+ "optimize",
3609
+ "page_count",
3610
+ "page_size",
3611
+ "quick_check",
3612
+ "secure_delete",
3613
+ "synchronous",
3614
+ "user_version",
3615
+ "wal_checkpoint"
3616
+ ]);
3458
3617
 
3459
3618
  // ../protocol/src/log-essential.ts
3460
3619
  var vocabulary = LOG_VOCABULARY;
@@ -4304,6 +4463,7 @@ import { createHash as createHash3 } from "node:crypto";
4304
4463
  // ../protocol/src/event-loop-stall-monitor.ts
4305
4464
  var log2 = createLogger("event-loop");
4306
4465
  var EVENT_LOOP_STALL_ALWAYS_LOG_MS = 1e4;
4466
+ var contextSources = new Set;
4307
4467
 
4308
4468
  // ../protocol/src/node/bridge-diagnostics.ts
4309
4469
  var log3 = createLogger("bridge.diagnostics");
@@ -9591,6 +9751,7 @@ function parseNumstatZ(output) {
9591
9751
  var WORKFLOW_RESULT_MAX_BYTES = 384 * 1024;
9592
9752
  var WORKFLOW_RESULT_MAX_PENDING_BYTES = 8 * 1024 * 1024;
9593
9753
  var WORKFLOW_RESULT_KINDS = [
9754
+ "auto-pipeline-draft",
9594
9755
  "feature-plan-state",
9595
9756
  "story-refinement",
9596
9757
  "validation-plan",
@@ -9606,6 +9767,7 @@ var WORKFLOW_RESULT_KINDS = [
9606
9767
  "graph-template"
9607
9768
  ];
9608
9769
  var WORKFLOW_RESULT_TOOL_NAMES = {
9770
+ "auto-pipeline-draft": "submit_auto_pipeline_draft",
9609
9771
  "feature-plan-state": "submit_feature_plan_state",
9610
9772
  "story-refinement": "submit_story_refinement",
9611
9773
  "validation-plan": "submit_validation_plan",
@@ -17582,12 +17744,13 @@ function rolloutCommandExecutionParts(item) {
17582
17744
  });
17583
17745
  return adapted?.type === "command_execution" ? commandExecutionParts(adapted) : null;
17584
17746
  }
17585
-
17586
17747
  // ../protocol/src/coordinator.ts
17587
17748
  var COORDINATOR_CODEX_USER_SKILLS_DIR_ENV = "ORKESTRATOR_COORDINATOR_CODEX_USER_SKILLS_DIR";
17588
17749
  var COORDINATOR_OTHER_ENVIRONMENTS_SETTING_LABEL = "Let the coordinator use environments it did not create";
17589
17750
  var COORDINATOR_ENVIRONMENT_ORIGIN_REFUSAL = `Not done: this coordinator did not create that environment, so it may not send it work. Do not retry. Use an environment this coordinator launched, or start a new one. If the user wants this coordinator to work in environments it did not create, tell them to turn on "${COORDINATOR_OTHER_ENVIRONMENTS_SETTING_LABEL}" in this project's settings, under Coordinator.`;
17590
17751
  var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
17752
+ "mark_topic",
17753
+ "mark_question",
17591
17754
  "ack_message",
17592
17755
  "add_ticket_comment",
17593
17756
  "address_multi_review",
@@ -17603,6 +17766,7 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
17603
17766
  "create_pr",
17604
17767
  "create_schedule",
17605
17768
  "create_ticket",
17769
+ "create_ticket_label",
17606
17770
  "custom_fix_multi_review",
17607
17771
  "edit_worker_tab",
17608
17772
  "fork_worker",
@@ -17636,6 +17800,7 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
17636
17800
  "list_provider_accounts",
17637
17801
  "list_schedules",
17638
17802
  "list_tabs",
17803
+ "list_ticket_labels",
17639
17804
  "list_tickets",
17640
17805
  "list_worker_commands",
17641
17806
  "list_workflows",
@@ -17660,6 +17825,7 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
17660
17825
  "run_worker_command",
17661
17826
  "send_message",
17662
17827
  "send_prompt_to_tab",
17828
+ "set_ticket_label",
17663
17829
  "set_worker_goal",
17664
17830
  "start_build_pipeline",
17665
17831
  "start_environment",
@@ -21274,6 +21440,7 @@ var DEFAULT_CIRCUIT_WINDOW_MS = 60000;
21274
21440
  var DEFAULT_CIRCUIT_COOLDOWN_MS = 5 * 60000;
21275
21441
  var DEFAULT_CIRCUIT_MAX_COOLDOWN_MS = 30 * 60000;
21276
21442
  var DEFAULT_SHUTDOWN_GRACE_MS = 5000;
21443
+ var DEFAULT_KILL_CONFIRM_MS = 1000;
21277
21444
  var INCOMPLETE_PIDFILE_GRACE_MS = 1000;
21278
21445
  var PID_OWNERSHIP_TTL_MS = 24 * 60 * 60 * 1000;
21279
21446
  var PID_ACQUISITION_MAX_ATTEMPTS = 5;
@@ -21290,6 +21457,7 @@ class AppServerSupervisor {
21290
21457
  circuitCooldownMs;
21291
21458
  circuitMaxCooldownMs;
21292
21459
  shutdownGraceMs;
21460
+ killConfirmMs;
21293
21461
  fingerprintEnvironment;
21294
21462
  notificationQueue;
21295
21463
  state = "stopped";
@@ -21310,7 +21478,9 @@ class AppServerSupervisor {
21310
21478
  stopping = false;
21311
21479
  unknownNotifications = 0;
21312
21480
  unknownServerRequests = 0;
21481
+ unconfirmedTerminations = 0;
21313
21482
  drainPromise = null;
21483
+ terminating = null;
21314
21484
  pidOwnerToken = randomUUID7();
21315
21485
  pidOwnershipHeld = false;
21316
21486
  constructor(options) {
@@ -21323,6 +21493,7 @@ class AppServerSupervisor {
21323
21493
  this.circuitMaxCooldownMs = Math.max(this.circuitCooldownMs, options.circuitMaxCooldownMs ?? DEFAULT_CIRCUIT_MAX_COOLDOWN_MS);
21324
21494
  this.nextCircuitCooldownMs = this.circuitCooldownMs;
21325
21495
  this.shutdownGraceMs = options.shutdownGraceMs ?? DEFAULT_SHUTDOWN_GRACE_MS;
21496
+ this.killConfirmMs = Math.max(0, options.killConfirmMs ?? DEFAULT_KILL_CONFIRM_MS);
21326
21497
  this.fingerprintEnvironment = options.fingerprintEnvironment ?? fingerprintRuntimeEnvironment;
21327
21498
  this.notificationQueue = new SerialQueue({
21328
21499
  maxDepth: options.notificationQueueMaxDepth,
@@ -21356,7 +21527,8 @@ class AppServerSupervisor {
21356
21527
  notificationQueueDepth: this.notificationQueue.pendingDepth,
21357
21528
  notificationQueueHighWaterMark: this.notificationQueue.highWaterMark,
21358
21529
  unknownNotifications: this.unknownNotifications,
21359
- unknownServerRequests: this.unknownServerRequests
21530
+ unknownServerRequests: this.unknownServerRequests,
21531
+ unconfirmedTerminations: this.unconfirmedTerminations
21360
21532
  };
21361
21533
  }
21362
21534
  recordUnknownNotification() {
@@ -21381,6 +21553,10 @@ class AppServerSupervisor {
21381
21553
  throw new AppServerUnavailableError("stopped");
21382
21554
  if (this.startPromise)
21383
21555
  return this.startPromise;
21556
+ if (this.terminating) {
21557
+ await this.terminating;
21558
+ return this.ensureStarted();
21559
+ }
21384
21560
  if (this.circuitOpen && this.now() < this.circuitProbeAt) {
21385
21561
  throw new AppServerCircuitOpenError(this.restartFailures.length, this.lastError);
21386
21562
  }
@@ -21721,11 +21897,23 @@ class AppServerSupervisor {
21721
21897
  const previous = this.current;
21722
21898
  this.current = null;
21723
21899
  if (previous) {
21724
- previous.client.close(new AppServerProcessExitError(`app-server restarting: ${reason}`, {
21725
- generation: previous.id
21726
- }));
21727
- await previous.recorder?.close();
21728
- await this.terminateChild(previous.child);
21900
+ const retire = (async () => {
21901
+ previous.client.close(new AppServerProcessExitError(`app-server restarting: ${reason}`, {
21902
+ generation: previous.id
21903
+ }));
21904
+ await previous.recorder?.close();
21905
+ await this.terminateChild(previous.child);
21906
+ })();
21907
+ const terminating = retire.catch(() => {
21908
+ return;
21909
+ });
21910
+ this.terminating = terminating;
21911
+ try {
21912
+ await retire;
21913
+ } finally {
21914
+ if (this.terminating === terminating)
21915
+ this.terminating = null;
21916
+ }
21729
21917
  }
21730
21918
  if (this.stopping)
21731
21919
  return;
@@ -21745,6 +21933,8 @@ class AppServerSupervisor {
21745
21933
  });
21746
21934
  const generation = this.current;
21747
21935
  this.current = null;
21936
+ if (this.terminating)
21937
+ await this.terminating;
21748
21938
  if (generation) {
21749
21939
  generation.client.close(new AppServerProcessExitError("bridge shutting down", {
21750
21940
  generation: generation.id
@@ -21776,7 +21966,17 @@ class AppServerSupervisor {
21776
21966
  ]);
21777
21967
  if (timedOut) {
21778
21968
  this.signalProcessTree(child, "SIGKILL");
21779
- await Promise.race([exited, sleep(1000)]);
21969
+ const confirmed = await Promise.race([
21970
+ exited.then(() => true),
21971
+ sleep(this.killConfirmMs).then(() => false)
21972
+ ]);
21973
+ if (!confirmed) {
21974
+ this.unconfirmedTerminations += 1;
21975
+ log10.warn("app-server.termination-unconfirmed", {
21976
+ pid: child.pid,
21977
+ waitedMs: this.shutdownGraceMs + this.killConfirmMs
21978
+ });
21979
+ }
21780
21980
  }
21781
21981
  }
21782
21982
  signalProcessTree(child, signal) {
@@ -22276,6 +22476,9 @@ function commandActionsText(value) {
22276
22476
  return commands.length > 0 ? [...new Set(commands)].join(`
22277
22477
  `) : undefined;
22278
22478
  }
22479
+ function isHumanCommand(method, params) {
22480
+ return method === "item/commandExecution/requestApproval" && params.kind === "humanCommand";
22481
+ }
22279
22482
  function describeApproval(options) {
22280
22483
  const params = isRecord10(options.params) ? options.params : {};
22281
22484
  const kind = options.method === "item/permissions/requestApproval" ? "permissions" : options.method === "item/fileChange/requestApproval" || options.method === "applyPatchApproval" ? "file-change" : "command";
@@ -22292,7 +22495,8 @@ function describeApproval(options) {
22292
22495
  const command = commandText(params.command) ?? commandActionsText(params.commandActions);
22293
22496
  const v2Command = options.method === "item/commandExecution/requestApproval" && (params.kind === undefined || params.kind === null || params.kind === "command");
22294
22497
  const exactCommand = v2Command && typeof params.command === "string" && params.command.length > 0;
22295
- const ruleEligible = networkContext !== undefined ? v2Command && (exactCommand || command === undefined) : kind === "command" ? exactCommand : kind === "file-change" ? str2(params.grantRoot) === undefined : false;
22498
+ const humanRequired = isHumanCommand(options.method, params);
22499
+ const ruleEligible = !humanRequired && (networkContext !== undefined ? v2Command && (exactCommand || command === undefined) : kind === "command" ? exactCommand : kind === "file-change" ? str2(params.grantRoot) === undefined : false);
22296
22500
  const proposal = exactCommand ? proposedPrefix(params.proposedExecpolicyAmendment) : undefined;
22297
22501
  const actionable = kind === "command" ? command !== undefined || networkContext !== undefined : kind === "file-change" ? Boolean(changes?.length) : permissions !== undefined && (permissions.network || permissions.fileSystem);
22298
22502
  return {
@@ -22312,17 +22516,19 @@ function describeApproval(options) {
22312
22516
  ...str2(params.reason) ? { reason: str2(params.reason) } : {},
22313
22517
  ...str2(params.grantRoot) ? { grantRoot: str2(params.grantRoot) } : {},
22314
22518
  ...networkContext ? { networkHost: networkContext } : {},
22315
- supportsApproveForSession: true,
22519
+ supportsApproveForSession: !humanRequired,
22316
22520
  actionable,
22317
22521
  ...ruleEligible ? { ruleEligible: true } : {},
22318
- ...proposal ? { proposedCommandPrefix: proposal } : {}
22522
+ ...humanRequired ? { humanRequired: true } : {},
22523
+ ...proposal && !humanRequired ? { proposedCommandPrefix: proposal } : {}
22319
22524
  };
22320
22525
  }
22321
22526
  function buildApprovalResponse(method, decision, rawParams) {
22322
22527
  switch (method) {
22323
22528
  case "item/commandExecution/requestApproval":
22324
22529
  case "item/fileChange/requestApproval": {
22325
- const wire = decision === "approve" ? "accept" : decision === "approve-for-session" ? "acceptForSession" : decision === "cancel" ? "cancel" : "decline";
22530
+ const oneTimeOnly = isHumanCommand(method, isRecord10(rawParams) ? rawParams : {});
22531
+ const wire = decision === "approve" ? "accept" : decision === "approve-for-session" ? oneTimeOnly ? "accept" : "acceptForSession" : decision === "cancel" ? "cancel" : "decline";
22326
22532
  return { result: { decision: wire } };
22327
22533
  }
22328
22534
  case "execCommandApproval":
@@ -22486,6 +22692,14 @@ class InteractionDeadline {
22486
22692
  }
22487
22693
 
22488
22694
  // ../../bridges/codex-bridge/src/app-server/interactions.ts
22695
+ var CODEX_APPROVAL_KIND_KEY = "codex_approval_kind";
22696
+ var CODEX_MCP_TOOL_CALL_APPROVAL = "mcp_tool_call";
22697
+ function mcpToolApprovalHints(meta) {
22698
+ const fields = record(meta);
22699
+ if (fields[CODEX_APPROVAL_KIND_KEY] !== CODEX_MCP_TOOL_CALL_APPROVAL)
22700
+ return;
22701
+ return agentInteractionToolHintsFromMcpAnnotations(fields.tool_annotations);
22702
+ }
22489
22703
  function isInteractionAnswerMap(value) {
22490
22704
  if (!value || typeof value !== "object" || Array.isArray(value))
22491
22705
  return false;
@@ -22582,6 +22796,7 @@ function describeInteraction(options) {
22582
22796
  if (mode !== "form" && mode !== "openai/form" && mode !== "openaiForm" && mode !== "url") {
22583
22797
  return null;
22584
22798
  }
22799
+ const toolHints = mode === "url" ? undefined : mcpToolApprovalHints(params._meta);
22585
22800
  return {
22586
22801
  interactionId: options.interactionId,
22587
22802
  kind: mode === "url" ? "mcp-url" : "mcp-form",
@@ -22598,7 +22813,8 @@ function describeInteraction(options) {
22598
22813
  ...mode === "url" ? {
22599
22814
  url: text(params.url),
22600
22815
  elicitationId: text(params.elicitationId)
22601
- } : { schema: params.requestedSchema }
22816
+ } : { schema: params.requestedSchema },
22817
+ ...toolHints ? { toolHints } : {}
22602
22818
  };
22603
22819
  }
22604
22820
  function buildInteractionResponse(request, answer) {
@@ -23173,6 +23389,7 @@ var IGNORED_METHODS = new Set([
23173
23389
  "thread/goal/cleared",
23174
23390
  "thread/environment/connected",
23175
23391
  "thread/environment/disconnected",
23392
+ "thread/section/changed",
23176
23393
  "hook/started",
23177
23394
  "hook/completed",
23178
23395
  "item/autoApprovalReview/started",
@@ -24691,7 +24908,7 @@ function coordinatorCapabilityPolicy(mode) {
24691
24908
  // ../../bridges/codex-bridge/src/codex-config.ts
24692
24909
  import { existsSync as existsSync3, readdirSync as readdirSync4, realpathSync, statSync as statSync2 } from "node:fs";
24693
24910
  import { homedir as homedir3 } from "node:os";
24694
- import { isAbsolute as isAbsolute8, join as join18, relative as relative3, sep } from "node:path";
24911
+ import { isAbsolute as isAbsolute8, join as join18, normalize, relative as relative3, sep } from "node:path";
24695
24912
 
24696
24913
  // ../../bridges/codex-bridge/src/shell-exclusions.ts
24697
24914
  import { closeSync as closeSync3, openSync as openSync3, readSync as readSync3, fstatSync as fstatSync3 } from "node:fs";
@@ -24813,6 +25030,7 @@ async function waitForMcpToolAvailability(list, serverName, toolName, options =
24813
25030
  list(remainingMs),
24814
25031
  new Promise((resolve) => {
24815
25032
  timer = setTimeout(() => resolve(expired), remainingMs);
25033
+ timer.unref?.();
24816
25034
  })
24817
25035
  ]);
24818
25036
  } catch {
@@ -24825,7 +25043,9 @@ async function waitForMcpToolAvailability(list, serverName, toolName, options =
24825
25043
  const availability = classifyMcpToolAvailability(response, serverName, toolName);
24826
25044
  if (availability)
24827
25045
  return availability;
24828
- await new Promise((resolve) => setTimeout(resolve, Math.min(pollMs, deadline - now())));
25046
+ await new Promise((resolve) => {
25047
+ setTimeout(resolve, Math.min(pollMs, deadline - now())).unref?.();
25048
+ });
24829
25049
  }
24830
25050
  }
24831
25051
 
@@ -25079,7 +25299,26 @@ var CODEX_COORDINATOR_SHELL_EXCLUDE = Object.freeze([
25079
25299
  "CODEX_BRIDGE_READABLE_RUNTIME_ROOT"
25080
25300
  ])
25081
25301
  ]);
25082
- function codexAppServerConfigOverrides(env = process.env) {
25302
+ function codexCoordinatorTmpDenials(options) {
25303
+ if ((options.platform ?? process.platform) !== "linux")
25304
+ return { tmpdir: true, slashTmp: true };
25305
+ const grants = options.readRoots.filter((root) => isAbsolute8(root));
25306
+ const slashTmp = !grants.some((root) => isLexicallyWithin(root, "/tmp"));
25307
+ const tmpdir = options.tmpdir && isAbsolute8(options.tmpdir) ? options.tmpdir : undefined;
25308
+ if (!tmpdir)
25309
+ return { tmpdir: true, slashTmp };
25310
+ const nested = slashTmp && isLexicallyWithin(tmpdir, "/tmp") && !isLexicallyWithin("/tmp", tmpdir);
25311
+ return {
25312
+ tmpdir: !nested && !grants.some((root) => isLexicallyWithin(root, tmpdir)),
25313
+ slashTmp
25314
+ };
25315
+ }
25316
+ function isLexicallyWithin(path, parent) {
25317
+ const child = normalize(path).replace(/(.)\/+$/, "$1");
25318
+ const root = normalize(parent).replace(/(.)\/+$/, "$1");
25319
+ return child === root || child.startsWith(root === "/" ? "/" : `${root}/`);
25320
+ }
25321
+ function codexAppServerConfigOverrides(env = process.env, platform = process.platform) {
25083
25322
  const userExclusions = configuredShellExclusions(env);
25084
25323
  const childLimit = resolveCodexMaxConcurrentThreads(env[CODEX_MAX_CONCURRENT_THREADS_ENV]);
25085
25324
  const overrides = {
@@ -25101,8 +25340,20 @@ function codexAppServerConfigOverrides(env = process.env) {
25101
25340
  if (!permissionProfile || !/^[A-Za-z0-9_-]+$/.test(permissionProfile) || !readableRuntimeRoot || !isAbsolute8(readableRuntimeRoot) || !projectRoot || !isAbsolute8(projectRoot)) {
25102
25341
  throw new Error("Coordinator Codex permission profile configuration is invalid");
25103
25342
  }
25343
+ const skillReadRoots = codexCoordinatorSkillReadRoots(env);
25344
+ const grantedAttachmentRoot = attachmentRoot && isAbsolute8(attachmentRoot) ? attachmentRoot : undefined;
25345
+ const tmpDenials = codexCoordinatorTmpDenials({
25346
+ tmpdir: env.TMPDIR,
25347
+ readRoots: [
25348
+ projectRoot,
25349
+ readableRuntimeRoot,
25350
+ ...grantedAttachmentRoot ? [grantedAttachmentRoot] : [],
25351
+ ...skillReadRoots
25352
+ ],
25353
+ platform
25354
+ });
25104
25355
  overrides.default_permissions = JSON.stringify(permissionProfile);
25105
- overrides[`permissions.${permissionProfile}.filesystem`] = `{ ":root" = "deny", ":minimal" = "read", ":tmpdir" = "deny", ` + `":slash_tmp" = "deny", ${JSON.stringify(readableRuntimeRoot)} = "read", ` + (attachmentRoot && isAbsolute8(attachmentRoot) ? `${JSON.stringify(attachmentRoot)} = "read", ` : "") + codexCoordinatorSkillReadRoots(env).map((root) => `${JSON.stringify(root)} = "read", `).join("") + `":workspace_roots" = { "." = "read" } }`;
25356
+ overrides[`permissions.${permissionProfile}.filesystem`] = `{ ":root" = "deny", ":minimal" = "read", ` + (tmpDenials.tmpdir ? `":tmpdir" = "deny", ` : "") + (tmpDenials.slashTmp ? `":slash_tmp" = "deny", ` : "") + `${JSON.stringify(readableRuntimeRoot)} = "read", ` + (grantedAttachmentRoot ? `${JSON.stringify(grantedAttachmentRoot)} = "read", ` : "") + skillReadRoots.map((root) => `${JSON.stringify(root)} = "read", `).join("") + `":workspace_roots" = { "." = "read" } }`;
25106
25357
  overrides[`permissions.${permissionProfile}.network.enabled`] = "false";
25107
25358
  overrides.web_search = JSON.stringify(codexNetworkDeniedSearchMode(codexCoordinatorPolicy(env)));
25108
25359
  overrides["features.standalone_web_search"] = "false";
@@ -29772,6 +30023,8 @@ class CodexRuntimeContext {
29772
30023
  now;
29773
30024
  started = false;
29774
30025
  startPromise = null;
30026
+ sessionRestore = "not-started";
30027
+ sessionsRestored = Promise.withResolvers();
29775
30028
  stopping = false;
29776
30029
  sweepTimer = null;
29777
30030
  detachedThreads = 0;
@@ -30330,6 +30583,11 @@ class CodexRuntimeLifecycle {
30330
30583
  async start() {
30331
30584
  if (this.ctx.started)
30332
30585
  return;
30586
+ if (this.ctx.sessionRestore === "failed") {
30587
+ this.ctx.sessionsRestored = Promise.withResolvers();
30588
+ }
30589
+ if (this.ctx.sessionRestore !== "restored")
30590
+ this.ctx.sessionRestore = "restoring";
30333
30591
  if (this.ctx.startPromise)
30334
30592
  return this.ctx.startPromise;
30335
30593
  const startPromise = this.startOnce();
@@ -30337,6 +30595,12 @@ class CodexRuntimeLifecycle {
30337
30595
  try {
30338
30596
  await startPromise;
30339
30597
  this.ctx.started = true;
30598
+ } catch (error) {
30599
+ if (this.ctx.sessionRestore === "restoring") {
30600
+ this.ctx.sessionRestore = "failed";
30601
+ this.ctx.sessionsRestored.resolve(false);
30602
+ }
30603
+ throw error;
30340
30604
  } finally {
30341
30605
  if (this.ctx.startPromise === startPromise)
30342
30606
  this.ctx.startPromise = null;
@@ -30376,6 +30640,8 @@ class CodexRuntimeLifecycle {
30376
30640
  if (record.threadId)
30377
30641
  this.ctx.threadsAwaitingDispatchRecovery.add(record.threadId);
30378
30642
  }
30643
+ this.ctx.sessionRestore = "restored";
30644
+ this.ctx.sessionsRestored.resolve(true);
30379
30645
  try {
30380
30646
  await this.ctx.options.engine.start();
30381
30647
  await this.ctx.generationRecovery;
@@ -30396,6 +30662,22 @@ class CodexRuntimeLifecycle {
30396
30662
  this.ctx.sweepTimer.unref?.();
30397
30663
  }
30398
30664
  }
30665
+ async whenSessionsRestored(timeoutMs) {
30666
+ if (this.ctx.sessionRestore === "failed")
30667
+ return false;
30668
+ if (this.ctx.sessionRestore !== "restoring")
30669
+ return true;
30670
+ let timer;
30671
+ const timedOut = new Promise((resolve) => {
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
+ }
30680
+ }
30399
30681
  async stop() {
30400
30682
  this.ctx.stopping = true;
30401
30683
  for (const state of this.ctx.threadState.values())
@@ -33275,6 +33557,9 @@ class AppServerRuntime {
33275
33557
  start(...args) {
33276
33558
  return this.lifecycle.start(...args);
33277
33559
  }
33560
+ whenSessionsRestored(...args) {
33561
+ return this.lifecycle.whenSessionsRestored(...args);
33562
+ }
33278
33563
  stop(...args) {
33279
33564
  return this.lifecycle.stop(...args);
33280
33565
  }
@@ -33817,16 +34102,16 @@ function logUnhandledRejection(reason) {
33817
34102
  // ../protocol/src/codex-model-catalog.ts
33818
34103
  var CODEX_FALLBACK_MODEL_CATALOG = [
33819
34104
  {
33820
- id: "gpt-5.4",
33821
- name: "gpt-5.4",
33822
- description: "Latest frontier agentic coding model.",
34105
+ id: "gpt-6.1-sol",
34106
+ name: "GPT-6.1-Sol",
34107
+ description: "Latest workhorse model for coding and everyday work.",
33823
34108
  reasoningEfforts: ["low", "medium", "high", "xhigh"],
33824
34109
  defaultReasoningEffort: "high"
33825
34110
  },
33826
34111
  {
33827
- id: "gpt-5.4-mini",
33828
- name: "GPT-5.4-Mini",
33829
- description: "Smaller frontier agentic coding model.",
34112
+ id: "gpt-6-luna",
34113
+ name: "GPT-6-Luna",
34114
+ description: "Fast and affordable model for easier tasks.",
33830
34115
  reasoningEfforts: ["low", "medium", "high", "xhigh"],
33831
34116
  defaultReasoningEffort: "high"
33832
34117
  }
@@ -34472,6 +34757,7 @@ var __testing = {
34472
34757
  sseRouteTestHooks = hooks;
34473
34758
  },
34474
34759
  startBridgeServerForTesting: startBridgeServer,
34760
+ startBridgeForTesting: startBridge,
34475
34761
  startSelectedEngineForTesting: startSelectedEngine,
34476
34762
  stopSelectedEngineForTesting: stopSelectedEngine,
34477
34763
  startSseKeepaliveForTesting: startSseKeepalive,
@@ -34573,6 +34859,15 @@ app.use("*", async (c, next) => {
34573
34859
  }
34574
34860
  await next();
34575
34861
  });
34862
+ var SESSION_RESTORE_WAIT_MS = 1e4;
34863
+ var awaitRestoredSessions = async (c, next) => {
34864
+ if (!await appServerRuntime.whenSessionsRestored(SESSION_RESTORE_WAIT_MS)) {
34865
+ return c.json({ error: "The Codex bridge is still restoring its sessions" }, 503);
34866
+ }
34867
+ await next();
34868
+ };
34869
+ app.use("/session/*", awaitRestoredSessions);
34870
+ app.use("/sessions/*", awaitRestoredSessions);
34576
34871
  app.use("/session/:id/messages", async (c, next) => {
34577
34872
  await next();
34578
34873
  c.res.headers.append("Vary", "Accept-Encoding");
@@ -35308,6 +35603,10 @@ function startBridgeServer(env = process.env, start = serve) {
35308
35603
  hostname: env.HOSTNAME || "0.0.0.0"
35309
35604
  });
35310
35605
  }
35606
+ function startBridge(env = process.env, listen = serve, runtime = appServerRuntime) {
35607
+ startSelectedEngine(env, runtime);
35608
+ return startBridgeServer(env, listen);
35609
+ }
35311
35610
  var shutdownHandler = createShutdownHandler(cleanupTimer);
35312
35611
  for (const signal of ["SIGTERM", "SIGINT"]) {
35313
35612
  process.on(signal, shutdownHandler);
@@ -35324,8 +35623,7 @@ if (parentPid !== null) {
35324
35623
  }
35325
35624
  });
35326
35625
  }
35327
- startBridgeServer();
35328
- startSelectedEngine();
35626
+ startBridge();
35329
35627
  export {
35330
35628
  MAX_CODEX_TRANSCRIPT_RESPONSE_BYTES,
35331
35629
  MAX_REPLAY_SSE_BYTES,