orkestrator 2.36.2-beta → 2.36.4-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/dist/client.js +641 -228
- package/dist/main.js +216455 -203389
- package/package.json +3 -3
- package/resources/acp-bridge/dist/index.js +435 -177
- package/resources/claude-bridge/dist/index.js +625 -79
- package/resources/codex-bridge/dist/index.js +529 -204
- package/resources/cursor-bridge/dist/index.js +29729 -29377
- package/resources/cursor-bridge/runtime/install.json +1 -1
- package/resources/pi-bridge/dist/index.js +29622 -29239
- package/resources/pi-bridge/runtime/install.json +1 -1
- package/resources/release-runtime/bun.lock +305 -0
- package/resources/release-runtime/package.json +9 -0
|
@@ -844,6 +844,7 @@ var PROJECTION_FIELD_SET = new Set([
|
|
|
844
844
|
"asyncQuestionResponses",
|
|
845
845
|
"contextUsage",
|
|
846
846
|
"goal",
|
|
847
|
+
"suborks",
|
|
847
848
|
"rateLimits",
|
|
848
849
|
"runtime",
|
|
849
850
|
"runtimeHealthAuthoritative",
|
|
@@ -869,6 +870,7 @@ var OPTIONAL_PROJECTION_FIELD_SET = new Set([
|
|
|
869
870
|
"asyncQuestionResponses",
|
|
870
871
|
"contextUsage",
|
|
871
872
|
"goal",
|
|
873
|
+
"suborks",
|
|
872
874
|
"rateLimits",
|
|
873
875
|
"runtime",
|
|
874
876
|
"runtimeHealthAuthoritative",
|
|
@@ -1052,6 +1054,12 @@ var BACKEND_LOG_AREAS = defineLogAreas({
|
|
|
1052
1054
|
"startup.looped-review-pending": "Cleanup of the retired Looped Review stays pending.",
|
|
1053
1055
|
"notice.failed": "A background notice after a turn or prompt failed; `step` says which.",
|
|
1054
1056
|
"artifacts.live-unavailable": "Live interactive artifacts are unavailable.",
|
|
1057
|
+
"previous-run": {
|
|
1058
|
+
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.",
|
|
1059
|
+
essential: true,
|
|
1060
|
+
fields: { outcome: "label", ranForMs: "number", lastSeenAgoMs: "number" }
|
|
1061
|
+
},
|
|
1062
|
+
"health.write-failed": "A health summary row could not be written or read; the next sample retries.",
|
|
1055
1063
|
"shutdown.step-failed": "One part of shutdown failed and the rest went on; `step` says which.",
|
|
1056
1064
|
"shutdown.signal-received": {
|
|
1057
1065
|
description: "A signal started shutdown, which tells a clean quit from the backend being killed.",
|
|
@@ -1095,7 +1103,8 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
1095
1103
|
description: "What every long-lived bridge does the same way: its sweep and its shutdown.",
|
|
1096
1104
|
events: {
|
|
1097
1105
|
"idle-sweep.failed": "An idle sweep threw; the next tick retries.",
|
|
1098
|
-
"shutdown.failed": "Releasing the bridge failed during shutdown; it still exits."
|
|
1106
|
+
"shutdown.failed": "Releasing the bridge failed during shutdown; it still exits.",
|
|
1107
|
+
"credential.not-hardened": "The bridge could not mark itself non-dumpable, so a same-uid process can read its memory; `reason` says why."
|
|
1099
1108
|
}
|
|
1100
1109
|
},
|
|
1101
1110
|
"bridge.acp": {
|
|
@@ -1229,7 +1238,6 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
1229
1238
|
"parent.gone": "The backend that launched this bridge has gone; stopping turns and shutting down.",
|
|
1230
1239
|
"queue.overflow": "The notification queue passed a bound and dropped its backlog.",
|
|
1231
1240
|
"queue.task-failed": "A task on a per-thread queue failed.",
|
|
1232
|
-
"raw-log.write-failed": "Appending to the raw Codex log failed.",
|
|
1233
1241
|
"recorder.notice": "The notification recorder needs attention: it is on, or was asked for without its confirmation.",
|
|
1234
1242
|
"recorder.threw": "The notification recorder threw.",
|
|
1235
1243
|
"recorder.write-failed": "Writing a notification recording failed; its lines were dropped.",
|
|
@@ -1435,6 +1443,7 @@ var ENVIRONMENT_LOG_AREAS = defineLogAreas({
|
|
|
1435
1443
|
environment: {
|
|
1436
1444
|
description: "Environment naming, setup, status, moves, deletion and cleanup afterwards.",
|
|
1437
1445
|
events: {
|
|
1446
|
+
"cleanup.sessions-failed": "Session metadata cleanup failed during environment deletion; deletion continues.",
|
|
1438
1447
|
"cleanup.branch-kept": "A deleted environment's local branch was kept, as it may hold unmerged work.",
|
|
1439
1448
|
"rename.failed": "Naming an environment from its pending prompt failed for the first time.",
|
|
1440
1449
|
"rename.still-failing": "That rename is still failing; written at the 2nd, 4th, 8th... failure.",
|
|
@@ -1463,6 +1472,7 @@ var ENVIRONMENT_LOG_AREAS = defineLogAreas({
|
|
|
1463
1472
|
"status.docker-error": "A transient Docker error stopped a status read, so the stored status is kept.",
|
|
1464
1473
|
"setup.clear-launch-failed": "A pending agent launch could not be cleared after setup failed.",
|
|
1465
1474
|
"setup.record-failure-failed": "A setup failure before its first attempt could not be recorded.",
|
|
1475
|
+
"setup.tab-publish-failed": "The setup terminal's tab could not be published.",
|
|
1466
1476
|
"lifecycle.failed": "Starting, rebuilding or recreating an environment failed; `operation` says which.",
|
|
1467
1477
|
"tab-teardown.pending": "A tab's teardown failed and stays pending; the reconcile sweep retries.",
|
|
1468
1478
|
"tab-reconcile.skipped": "Orphaned tab reconciliation was skipped because pane layouts are unreadable.",
|
|
@@ -1507,6 +1517,7 @@ var GATEWAY_LOG_AREAS = defineLogAreas({
|
|
|
1507
1517
|
"websocket.upgrade-failed": "A WebSocket upgrade failed.",
|
|
1508
1518
|
"events.client-dropped": "An event-stream client buffered too much and was dropped; it reconnects and refetches.",
|
|
1509
1519
|
"proxy.client-disconnected": "A proxy client went away, so its upstream request was aborted.",
|
|
1520
|
+
"traffic.burst": "Connections or requests spiked. Counts by source address, route class, client family, listener and registered invoke command; never request content.",
|
|
1510
1521
|
"throttle.suppressed": "Repeats of the throttled `site` were counted over a window, not written.",
|
|
1511
1522
|
"throttle.recovered": "The throttled `site` succeeded again, so its fault has cleared.",
|
|
1512
1523
|
"throttle.evicted": "The tracked-key limit dropped the `site`, so no recovered line follows unless it fails again."
|
|
@@ -1640,6 +1651,7 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
1640
1651
|
"native-agent": {
|
|
1641
1652
|
description: "Native agent sessions and what the backend reads from their bridges.",
|
|
1642
1653
|
events: {
|
|
1654
|
+
"session.bridge-replaced-for-policy": "An idle bridge was stopped so a resume could apply the user's wider execution policy.",
|
|
1643
1655
|
"catalogue.outdated-bridge": "A bridge predates the command catalogue, so its commands stay unavailable.",
|
|
1644
1656
|
"compact.instructions-ignored": "A bridge compacted without confirming the instructions sent with /compact: it predates them.",
|
|
1645
1657
|
"handoff.summary-read-failed": "Change summaries could not be read for a handoff, so the carrier says they are unmeasured.",
|
|
@@ -1670,6 +1682,7 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
1670
1682
|
"turn-recovery.failed": "Recovering an incomplete turn failed.",
|
|
1671
1683
|
"turn-recovery.exhausted": "A turn failed again after automatic recovery and is left for the user.",
|
|
1672
1684
|
"turn-recovery.retrying": "An incomplete or provider-failed turn is being retried automatically.",
|
|
1685
|
+
"usage-limit.notice-failed": "A usage-limit stop's outcome could not be read for its notice.",
|
|
1673
1686
|
"usage-limit.resend-failed": "Resending after a usage limit failed. An unknown send stays in the journal.",
|
|
1674
1687
|
"title.strategy-failed": "A session title strategy failed, so the next is tried. Content-free: the error can quote the prompt.",
|
|
1675
1688
|
...THROTTLE_LOG_EVENTS
|
|
@@ -1686,6 +1699,15 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
1686
1699
|
"recover.failed": "Goals could not be recovered at startup."
|
|
1687
1700
|
}
|
|
1688
1701
|
},
|
|
1702
|
+
"native-agent.subork": {
|
|
1703
|
+
description: "Suborks: the ask_agents calls a native agent makes. Content-free.",
|
|
1704
|
+
events: {
|
|
1705
|
+
"pass.failed": "A pass over a call failed, so a later pass retries. Counts only.",
|
|
1706
|
+
"delivery.failed": "A call's answers could not be placed in the caller's mailbox yet. Error class only.",
|
|
1707
|
+
"retention.failed": "An old call could not be removed.",
|
|
1708
|
+
"sweep.failed": "A running call's caller could not be checked; the next sweep looks again."
|
|
1709
|
+
}
|
|
1710
|
+
},
|
|
1689
1711
|
"native-agent.opencode": {
|
|
1690
1712
|
description: "The OpenCode provider: its request monitor, retries and agent tools.",
|
|
1691
1713
|
events: {
|
|
@@ -1695,7 +1717,8 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
1695
1717
|
"coordinator-servers.unavailable": "OpenCode coordinator research servers are unavailable.",
|
|
1696
1718
|
"monitor.reconnecting": "The request monitor lost its stream and is reconnecting. Error class only.",
|
|
1697
1719
|
"worker-limit.reached": "The bounded request workers are full, so the stream restarts and a snapshot reconciles.",
|
|
1698
|
-
"request.failed": "Handling a request event failed, so the stream restarts. Error class only."
|
|
1720
|
+
"request.failed": "Handling a request event failed, so the stream restarts. Error class only.",
|
|
1721
|
+
"credential-plugin.skipped": "A host OpenCode server started without the credential plugin, so its tools inherit its password; `reason` says why."
|
|
1699
1722
|
}
|
|
1700
1723
|
}
|
|
1701
1724
|
});
|
|
@@ -1723,6 +1746,7 @@ var PREVIEW_LOG_AREAS = defineLogAreas({
|
|
|
1723
1746
|
"publication.start-failed": "Private preview publication did not start.",
|
|
1724
1747
|
"publication.reconfigure-failed": "Preview publication could not be reconfigured.",
|
|
1725
1748
|
"publication.listening": "Private preview origins are listening.",
|
|
1749
|
+
"publication.same-site": "The preview domain is the same site as the application; publication runs with a warning.",
|
|
1726
1750
|
"certificate.reloaded": "The preview certificate was reloaded.",
|
|
1727
1751
|
"access.revoked-close-failed": "A revoked preview resource could not be closed. Error class only.",
|
|
1728
1752
|
"registry.invalid-definition": "An invalid stored preview service definition was ignored.",
|
|
@@ -2031,10 +2055,19 @@ var STORAGE_LOG_AREAS = defineLogAreas({
|
|
|
2031
2055
|
"retired.turn-cleanup-pending": "Cleanup of a retired Looped Review turn did not finish and stays pending.",
|
|
2032
2056
|
"handoffs.prune-failed": "Pruning agent handoffs that nothing references failed; a later prune retries.",
|
|
2033
2057
|
"desktop-connections.malformed": "Stored desktop connection settings were malformed, so the local connection is used.",
|
|
2058
|
+
"config.restrict-mode-failed": "A config file holding provider secrets could not be set to owner-only; the backend carries on.",
|
|
2034
2059
|
"legacy-json.moved": "JSON store files written after the SQLite migration were archived, not imported.",
|
|
2035
2060
|
"legacy-json.archive-failed": "Imported JSON store files could not be archived.",
|
|
2061
|
+
"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.",
|
|
2036
2062
|
"lease.heartbeat-failed": "A held lease's heartbeat failed, which shortens the lease; the next one retries.",
|
|
2037
|
-
"scrub.
|
|
2063
|
+
"scrub.vacuum-failed": "Deleted-content page reclamation failed; the checkpoint is attempted independently.",
|
|
2064
|
+
"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.",
|
|
2065
|
+
"upkeep.vacuum-failed": "Periodic page reclamation failed; the next upkeep pass retries.",
|
|
2066
|
+
"optimize.failed": "Refreshing the query planner's statistics failed; queries still run and the next check retries.",
|
|
2067
|
+
"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.",
|
|
2068
|
+
"snapshot.top-tables-failed": "The sampled table sizes from a finished snapshot could not be saved; the snapshot stands and the next one retries.",
|
|
2069
|
+
"snapshot.ledger-skipped": "The daily change-tracking ledger snapshot was skipped because the disk or the snapshot budget lacks room; `retryAt` says when it tries again.",
|
|
2070
|
+
"snapshot.ledger-failed": "The daily change-tracking ledger snapshot failed; `retryAt` says when it tries again, if known.",
|
|
2038
2071
|
...THROTTLE_LOG_EVENTS
|
|
2039
2072
|
}
|
|
2040
2073
|
}
|
|
@@ -2051,6 +2084,7 @@ var BUILD_PIPELINE_LOG_AREAS = defineLogAreas({
|
|
|
2051
2084
|
"consolidation.consume-deferred": "Consuming a review consolidation result failed; it stays pending and is retried.",
|
|
2052
2085
|
"dispatch.prepare-failed": "Attaching the agent before dispatch failed; the prompt request does the same work and answers authoritatively.",
|
|
2053
2086
|
"interaction.resolved": "A human interaction on a pipeline stage resolved. Metadata only.",
|
|
2087
|
+
"user-message.background-send-refused": "The bridge refused a queued user message during a background wait; it stays queued and is retried.",
|
|
2054
2088
|
"transcripts.migrated": "A transcript migration pass moved stage transcripts; counts only.",
|
|
2055
2089
|
"transcripts.maintenance-failed": "Migrating or sweeping stage transcripts failed; the next start retries.",
|
|
2056
2090
|
"restore.skipped": "A pipeline could not be restored at startup and was skipped.",
|
|
@@ -2088,6 +2122,8 @@ var CHANGE_TRACKING_LOG_AREAS = defineLogAreas({
|
|
|
2088
2122
|
description: "Change tracking: turn capture, evidence pulls and measurements.",
|
|
2089
2123
|
events: {
|
|
2090
2124
|
"journal-import.failed": "Importing surviving OpenCode command journals as legacy summaries failed.",
|
|
2125
|
+
"measurement-drain.failed": "Draining an owner's superseded measurements failed; the retention pass retries.",
|
|
2126
|
+
"retention.failed": "A retention pass failed partway; what it deleted stands and the next pass goes on.",
|
|
2091
2127
|
"projection.failed": "Projecting a change event onto its environment failed.",
|
|
2092
2128
|
"startup.reconcile-failed": "Reconciling change tracking at startup failed.",
|
|
2093
2129
|
"turn-start.capture-failed": "Capturing a turn's start failed, so the turn is untracked.",
|
|
@@ -2118,7 +2154,16 @@ var COORDINATOR_LOG_AREAS = defineLogAreas({
|
|
|
2118
2154
|
coordinator: {
|
|
2119
2155
|
description: "Coordinators: delegations, status wakes and their store.",
|
|
2120
2156
|
events: {
|
|
2157
|
+
...THROTTLE_LOG_EVENTS,
|
|
2121
2158
|
"delegation.open-failed": "A delegation could not be opened; `source` says for what.",
|
|
2159
|
+
"delegation.reconcile-failed": "One delegation could not be settled; the rest of the pass still ran and the next one retries.",
|
|
2160
|
+
"delegation.wake-failed": "One delegation's wake could not be delivered; the rest of the pass still ran and the next one retries.",
|
|
2161
|
+
"delegation.wake-held": "A wake is waiting on a state the user can change (messaging off, conversation limit), and is not counted as a failure.",
|
|
2162
|
+
"delegation.wake-pass-failed": "A delegation wake pass could not run; the next sweep retries.",
|
|
2163
|
+
"delegation.wake-retire-failed": "A wake that keeps failing could not be given up on; the next pass retries.",
|
|
2164
|
+
"delegation.wake-retire-notice-failed": "The one notice for a wake being retired could not be sent; the wake stays owed and the next pass retries.",
|
|
2165
|
+
"delegation.wake-retired": "A wake kept failing and was given up on; `kind` is the last failure.",
|
|
2166
|
+
"mail.reconcile-failed": "One coordinator's mail could not be reconciled; the sweep carried on with the others.",
|
|
2122
2167
|
"deliver-now.drain-failed": "The mail delivery pass after deliverNow failed; the next sweep delivers.",
|
|
2123
2168
|
"mail.move-failed": "Mail could not move to the new main coordinator.",
|
|
2124
2169
|
"work.move-failed": "Work could not move to the main coordinator.",
|
|
@@ -2126,6 +2171,11 @@ var COORDINATOR_LOG_AREAS = defineLogAreas({
|
|
|
2126
2171
|
"wake.observe-pull-request-failed": "A pull request could not be observed for status wakes.",
|
|
2127
2172
|
"wake.observe-feature-plan-failed": "A feature plan could not be observed for status wakes.",
|
|
2128
2173
|
"wake.observe-workflow-failed": "A workflow could not be observed for status wakes.",
|
|
2174
|
+
"notice.outbox-refused": "A leaf's outbox refused a coordinator notice, so its own coordinator takes it.",
|
|
2175
|
+
"notice.start-main-failed": "A coordinator notice could not start a main coordinator; it waits for one to open.",
|
|
2176
|
+
"notice.take-back-unread": "A notice handed back from a command node found no open coordinator here.",
|
|
2177
|
+
"limit-stop.own": "A coordinator's own usage-limit stop attempted to move it off the account.",
|
|
2178
|
+
"limit-stop.notice-failed": "A usage-limit notice could not be sent; it stays in the ledger for the next attempt.",
|
|
2129
2179
|
"wake.deliver-failed": "A workflow status wake could not be delivered; the next pass retries.",
|
|
2130
2180
|
"wake.waiting-check-failed": "A waiting worker could not be checked; the next pass retries.",
|
|
2131
2181
|
"wake.resolve-report-failed": "A finished Resolve tab could not be reported.",
|
|
@@ -2156,15 +2206,15 @@ var REVIEW_LOG_AREAS = defineLogAreas({
|
|
|
2156
2206
|
review: {
|
|
2157
2207
|
description: "Multi Review workflows: scheduling, graph runs and interactive fix sessions.",
|
|
2158
2208
|
events: {
|
|
2159
|
-
"fix-tab.publish-failed": "A
|
|
2209
|
+
"fix-tab.publish-failed": "A Address Findings request was delivered but its tab could not be opened; the user is told.",
|
|
2160
2210
|
"graph-run.not-started": "A workflow's graph run did not start.",
|
|
2161
2211
|
"reconcile.scan-failed": "A reconciliation scan failed; the next scan retries.",
|
|
2162
2212
|
"graph-engine.unavailable": "The graph engine is selected but unavailable, so the bespoke engine runs.",
|
|
2163
2213
|
"graph-run.cancel-failed": "Cancelling a graph run failed; the next pass projects how it ended.",
|
|
2164
2214
|
"delete.cleanup-failed": "A cleanup step after deleting a workflow failed; stale tabs reconcile away on hydration.",
|
|
2165
|
-
"fix-session.read-failed": "Reading an interactive
|
|
2215
|
+
"fix-session.read-failed": "Reading an interactive Address Findings session's state failed.",
|
|
2166
2216
|
"fix-outcome.read-failed": "Reading an interactive fix's outcome failed; it stays pending.",
|
|
2167
|
-
"fix-usage.read-failed": "Reading
|
|
2217
|
+
"fix-usage.read-failed": "Reading an Address Findings session's token usage failed.",
|
|
2168
2218
|
"result.consume-deferred": "Consuming a workflow result failed; it stays staged and is retried.",
|
|
2169
2219
|
"failure-triage.failed": "Classifying a review package's failing tests failed; the package is sealed without the triage and says so."
|
|
2170
2220
|
}
|
|
@@ -2217,6 +2267,7 @@ var AGENT_ACCOUNTS_LOG_AREAS = defineLogAreas({
|
|
|
2217
2267
|
"agent-accounts": {
|
|
2218
2268
|
description: "Agent accounts: automatic switching, staged logins and plan usage.",
|
|
2219
2269
|
events: {
|
|
2270
|
+
"limit-stop-notice.failed": "A session's usage-limit stop could not be reported.",
|
|
2220
2271
|
"switch-notice.failed": "A notice about an automatic account switch failed; the switch stands. `audience` says whose.",
|
|
2221
2272
|
"auto-switch.check-failed": "An automatic account check failed; the next nudge retries.",
|
|
2222
2273
|
"container-sync.failed": "Handing a login or account to a container failed; `step` says which part.",
|
|
@@ -2235,8 +2286,22 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
2235
2286
|
description: "Docker containers: lifecycle, starts, staged inputs and the login files they hold.",
|
|
2236
2287
|
events: {
|
|
2237
2288
|
"portable-inputs.relay-missing": "Docker is rootless and the image predates the staged-input relay, so the container cannot read them until rebuilt.",
|
|
2289
|
+
"git-mirror.mount-unavailable": "A new container gets no project Git mirror, so its clone goes to the remote.",
|
|
2290
|
+
"git-mirror.refreshed": "A project's Git mirror was built or updated.",
|
|
2291
|
+
"git-mirror.seeded": "A project's Git mirror was built from its host checkout and only what the remote added to it.",
|
|
2292
|
+
"git-mirror.seed-skipped": "A project's host checkout could not seed its Git mirror, so the build downloads everything.",
|
|
2293
|
+
"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.",
|
|
2294
|
+
"git-mirror.low-disk": "A project's Git mirror was not updated: the disk is nearly full.",
|
|
2295
|
+
"git-mirror.oversized": "A project's repository is too large for a Git mirror, so its environments keep the blobless clone.",
|
|
2296
|
+
"git-mirror.compact-failed": "A project's Git mirror could not be compacted.",
|
|
2297
|
+
"git-mirror.state-write-failed": "A project's Git mirror could not be marked for checking.",
|
|
2298
|
+
"git-mirror.remove-failed": "A project's Git mirror could not be removed; a sweep retries.",
|
|
2299
|
+
"git-mirror.orphans-removed": "Git mirrors of removed projects were removed.",
|
|
2300
|
+
"git-mirror.clone-used": "A new environment cloned from its project's Git mirror.",
|
|
2301
|
+
"git-mirror.clone-fallback": "A new environment could not clone from its project's Git mirror and cloned from the remote.",
|
|
2238
2302
|
"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.",
|
|
2239
2303
|
"opencode.warm-incomplete": "OpenCode did not finish loading /workspace in a container.",
|
|
2304
|
+
"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.",
|
|
2240
2305
|
"lifecycle-event.reconcile-failed": "Reconciling an environment after a container start or stop event failed; the next status read retries.",
|
|
2241
2306
|
"login-keeper.pass-failed": "A Claude login keeper pass failed; the next interval retries.",
|
|
2242
2307
|
"login-keeper.refresh-failed": "Refreshing the host Claude login failed. Fixed text: CLI output can hold credentials.",
|
|
@@ -2260,6 +2325,7 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
2260
2325
|
essential: true,
|
|
2261
2326
|
fields: { staleForMs: "number" }
|
|
2262
2327
|
},
|
|
2328
|
+
"writer-lease.listener-failed": "The callback told about a lost registry writer lease threw, so the schedules settings learn of the loss only at their next read.",
|
|
2263
2329
|
"writer-lease.not-acquired": {
|
|
2264
2330
|
description: "This backend started without the registry writer lease, for the fixed `reason` given. A second backend on one data directory is normal: it serves reads, runs no schedules and refuses container changes.",
|
|
2265
2331
|
essential: true,
|
|
@@ -2383,8 +2449,12 @@ var NODES_LOG_AREAS = defineLogAreas({
|
|
|
2383
2449
|
nodes: {
|
|
2384
2450
|
description: "Command nodes: links, handovers, leaf mail, ticket sync and project copies.",
|
|
2385
2451
|
events: {
|
|
2452
|
+
...THROTTLE_LOG_EVENTS,
|
|
2386
2453
|
"actions.resume-failed": "Approved actions could not be resumed; a later pass retries.",
|
|
2387
2454
|
"project-copy.notify-failed": "The coordinator could not be told a project copy finished.",
|
|
2455
|
+
"mail.return-deferred": "The leaf refused returned mail; it remains queued for retry.",
|
|
2456
|
+
"notices.take-back-failed": "A notice for this node's coordinator stayed in the outbox.",
|
|
2457
|
+
"notice.collected-retired": "A detached controller owned a notice with ambiguous delivery; retired without redelivery.",
|
|
2388
2458
|
"mail.delivery-deferred": "Leaf mail could not reach a coordinator yet.",
|
|
2389
2459
|
"command.post-step-failed": "A step after a routed command failed.",
|
|
2390
2460
|
"seed-files.incomplete": "Seed files for a leaf environment were not all copied.",
|
|
@@ -2900,6 +2970,7 @@ var WEB_SYNC_LOG_AREAS = defineLogAreas({
|
|
|
2900
2970
|
"web.read-coordinator": {
|
|
2901
2971
|
description: "The renderer's coalesced, bounded backend reads.",
|
|
2902
2972
|
events: {
|
|
2973
|
+
"poll.read-failed": "A coordinated poll's read failed; it stays on its interval.",
|
|
2903
2974
|
"listener.threw": "A read state listener threw.",
|
|
2904
2975
|
"read.settle-failed": "Applying a finished read's result threw."
|
|
2905
2976
|
}
|
|
@@ -2909,6 +2980,7 @@ var WEB_SYNC_LOG_AREAS = defineLogAreas({
|
|
|
2909
2980
|
events: {
|
|
2910
2981
|
"events.disconnected": "The main event stream dropped; it reconnects and replays.",
|
|
2911
2982
|
"terminal-stream.disconnected": "A terminal event stream dropped; it reconnects.",
|
|
2983
|
+
"relayed-stream.disconnected": "The relayed node event stream dropped; it reconnects.",
|
|
2912
2984
|
"connection-listener.failed": "A main stream connection state listener threw.",
|
|
2913
2985
|
"event-listener.failed": "A listener for a gateway event threw.",
|
|
2914
2986
|
"stream-listener.failed": "A listener for the stream-connected notice threw."
|
|
@@ -2993,6 +3065,7 @@ var TEXT_RULES = [
|
|
|
2993
3065
|
pattern: /\beyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}/g,
|
|
2994
3066
|
replacement: "[redacted]"
|
|
2995
3067
|
},
|
|
3068
|
+
{ pattern: /\bok[ab]_[A-Za-z0-9_-]{16,}/g, replacement: "[redacted]" },
|
|
2996
3069
|
{ pattern: /\bgh[pousr]_[A-Za-z0-9]{16,}/g, replacement: "[redacted]" },
|
|
2997
3070
|
{ pattern: /\bgithub_pat_[A-Za-z0-9_]{20,}/g, replacement: "[redacted]" },
|
|
2998
3071
|
{ pattern: /\b(?:sk|rk|pk)-[A-Za-z0-9_-]{12,}/g, replacement: "[redacted]" },
|
|
@@ -3777,6 +3850,73 @@ function parseBridgeLogPolicy(value) {
|
|
|
3777
3850
|
return Number.isSafeInteger(seq) && seq >= 0 ? { ...detail, seq } : null;
|
|
3778
3851
|
}
|
|
3779
3852
|
|
|
3853
|
+
// ../protocol/src/node/bridge-credential.ts
|
|
3854
|
+
import { createHash, randomBytes, timingSafeEqual } from "node:crypto";
|
|
3855
|
+
import { createRequire } from "node:module";
|
|
3856
|
+
var BRIDGE_TOKEN_PREFIX = "okb_";
|
|
3857
|
+
var PR_SET_DUMPABLE = 4;
|
|
3858
|
+
var VERIFIER_PATTERN = /^[0-9a-f]{64}$/;
|
|
3859
|
+
var log = createLogger("bridge.lifecycle");
|
|
3860
|
+
function mintBridgeToken() {
|
|
3861
|
+
return `${BRIDGE_TOKEN_PREFIX}${randomBytes(32).toString("base64url")}`;
|
|
3862
|
+
}
|
|
3863
|
+
function bridgeTokenVerifier(token) {
|
|
3864
|
+
return createHash("sha256").update(token).digest("hex");
|
|
3865
|
+
}
|
|
3866
|
+
function bridgeTokenVerifierEnv(tokenEnv) {
|
|
3867
|
+
return `${tokenEnv}_SHA256`;
|
|
3868
|
+
}
|
|
3869
|
+
function credentialFromVerifier(verifier, plainToken) {
|
|
3870
|
+
const expected = Buffer.from(verifier, "hex");
|
|
3871
|
+
return {
|
|
3872
|
+
plainToken,
|
|
3873
|
+
matches(candidate) {
|
|
3874
|
+
if (!candidate)
|
|
3875
|
+
return false;
|
|
3876
|
+
return timingSafeEqual(expected, createHash("sha256").update(candidate).digest());
|
|
3877
|
+
}
|
|
3878
|
+
};
|
|
3879
|
+
}
|
|
3880
|
+
function bridgeCredentialFromToken(token) {
|
|
3881
|
+
return credentialFromVerifier(bridgeTokenVerifier(token), token);
|
|
3882
|
+
}
|
|
3883
|
+
function markProcessNonDumpable(loadFfi = () => createRequire(import.meta.url)("bun:ffi")) {
|
|
3884
|
+
if (process.platform !== "linux" || !process.versions.bun)
|
|
3885
|
+
return false;
|
|
3886
|
+
try {
|
|
3887
|
+
const { dlopen, FFIType } = loadFfi();
|
|
3888
|
+
const libc = dlopen("libc.so.6", {
|
|
3889
|
+
prctl: {
|
|
3890
|
+
args: [FFIType.i32, FFIType.u64, FFIType.u64, FFIType.u64, FFIType.u64],
|
|
3891
|
+
returns: FFIType.i32
|
|
3892
|
+
}
|
|
3893
|
+
});
|
|
3894
|
+
try {
|
|
3895
|
+
if (libc.symbols.prctl(PR_SET_DUMPABLE, 0n, 0n, 0n, 0n) === 0)
|
|
3896
|
+
return true;
|
|
3897
|
+
} finally {
|
|
3898
|
+
libc.close();
|
|
3899
|
+
}
|
|
3900
|
+
log.warn("credential.not-hardened", { reason: "prctl-refused" });
|
|
3901
|
+
} catch {
|
|
3902
|
+
log.warn("credential.not-hardened", { reason: "ffi-unavailable" });
|
|
3903
|
+
}
|
|
3904
|
+
return false;
|
|
3905
|
+
}
|
|
3906
|
+
function loadBridgeCredential(tokenEnv, options = {}) {
|
|
3907
|
+
const env = options.env ?? process.env;
|
|
3908
|
+
const verifierEnv = bridgeTokenVerifierEnv(tokenEnv);
|
|
3909
|
+
const verifier = env[verifierEnv]?.trim();
|
|
3910
|
+
const token = env[tokenEnv]?.trim();
|
|
3911
|
+
delete env[verifierEnv];
|
|
3912
|
+
delete env[tokenEnv];
|
|
3913
|
+
if (verifier) {
|
|
3914
|
+
(options.harden ?? markProcessNonDumpable)();
|
|
3915
|
+
return VERIFIER_PATTERN.test(verifier) ? credentialFromVerifier(verifier, undefined) : bridgeCredentialFromToken(mintBridgeToken());
|
|
3916
|
+
}
|
|
3917
|
+
return bridgeCredentialFromToken(token || mintBridgeToken());
|
|
3918
|
+
}
|
|
3919
|
+
|
|
3780
3920
|
// ../protocol/src/node/logger-environment.ts
|
|
3781
3921
|
var LOG_LEVEL_ENV = "ORKESTRATOR_LOG_LEVEL";
|
|
3782
3922
|
var LOG_FORMAT_ENV = "ORKESTRATOR_LOG_FORMAT";
|
|
@@ -3853,14 +3993,14 @@ function applyLogDetail(detail, env = process.env) {
|
|
|
3853
3993
|
}
|
|
3854
3994
|
|
|
3855
3995
|
// ../protocol/src/node/bridge-diagnostics.ts
|
|
3856
|
-
import { createHash } from "node:crypto";
|
|
3996
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
3857
3997
|
|
|
3858
3998
|
// ../protocol/src/event-loop-stall-monitor.ts
|
|
3859
|
-
var
|
|
3999
|
+
var log2 = createLogger("event-loop");
|
|
3860
4000
|
var EVENT_LOOP_STALL_ALWAYS_LOG_MS = 1e4;
|
|
3861
4001
|
|
|
3862
4002
|
// ../protocol/src/node/bridge-diagnostics.ts
|
|
3863
|
-
var
|
|
4003
|
+
var log3 = createLogger("bridge.diagnostics");
|
|
3864
4004
|
var BRIDGE_DIAGNOSTICS_INTERVAL_MS = 60000;
|
|
3865
4005
|
var INTERVAL_MS = BRIDGE_DIAGNOSTICS_INTERVAL_MS;
|
|
3866
4006
|
var STALL_NO_DELTA_MS = 2 * INTERVAL_MS;
|
|
@@ -3952,7 +4092,7 @@ function sameSet(a, b) {
|
|
|
3952
4092
|
function identity(value) {
|
|
3953
4093
|
if (typeof value !== "string" || !value || value.length > MAX_ID_LENGTH)
|
|
3954
4094
|
return;
|
|
3955
|
-
return
|
|
4095
|
+
return createHash2("sha256").update(value).digest("hex").slice(0, 16);
|
|
3956
4096
|
}
|
|
3957
4097
|
function readBridgeDebugFlag(value) {
|
|
3958
4098
|
return value?.trim() === "1";
|
|
@@ -4025,16 +4165,16 @@ function safeDiagnosticMetrics(value) {
|
|
|
4025
4165
|
return result;
|
|
4026
4166
|
}
|
|
4027
4167
|
function bridgeDiagnosticsChangesEnabled() {
|
|
4028
|
-
return
|
|
4168
|
+
return log3.isEnabled("trace");
|
|
4029
4169
|
}
|
|
4030
4170
|
function writeBridgeDiagnostic({ bridge, event, payload }) {
|
|
4031
4171
|
return tryWriteLog("info", "bridge.diagnostics", event, { bridge, payload });
|
|
4032
4172
|
}
|
|
4033
4173
|
function bridgeDiagnosticsActive() {
|
|
4034
|
-
return
|
|
4174
|
+
return log3.isEnabled("info");
|
|
4035
4175
|
}
|
|
4036
4176
|
function bridgeDiagnosticsStreamEnabled(bridge) {
|
|
4037
|
-
return bridgeDebugEnabled(bridge) ||
|
|
4177
|
+
return bridgeDebugEnabled(bridge) || log3.isEnabled("debug");
|
|
4038
4178
|
}
|
|
4039
4179
|
function writeDiagnostic(bridge, event, payload, write) {
|
|
4040
4180
|
try {
|
|
@@ -4397,8 +4537,7 @@ async function readBridgeLogPolicyBody(request) {
|
|
|
4397
4537
|
|
|
4398
4538
|
// ../../bridges/codex-bridge/src/index.ts
|
|
4399
4539
|
import { execFile as execFileCallback2 } from "node:child_process";
|
|
4400
|
-
import {
|
|
4401
|
-
import { appendFile as appendFile5, mkdir as mkdir9, readFile as readFile7, writeFile as writeFile6 } from "node:fs/promises";
|
|
4540
|
+
import { mkdir as mkdir9, readFile as readFile7, writeFile as writeFile6 } from "node:fs/promises";
|
|
4402
4541
|
import { join as join23 } from "node:path";
|
|
4403
4542
|
import { promisify as promisify2 } from "node:util";
|
|
4404
4543
|
|
|
@@ -8329,6 +8468,7 @@ var WORKFLOW_RESULT_KINDS = [
|
|
|
8329
8468
|
"fix-result",
|
|
8330
8469
|
"verification-result",
|
|
8331
8470
|
"pr-result",
|
|
8471
|
+
"subork-answer",
|
|
8332
8472
|
"graph-output",
|
|
8333
8473
|
"graph-template"
|
|
8334
8474
|
];
|
|
@@ -8344,7 +8484,8 @@ var WORKFLOW_RESULT_TOOL_NAMES = {
|
|
|
8344
8484
|
"verification-result": "submit_verification_result",
|
|
8345
8485
|
"pr-result": "submit_pr_result",
|
|
8346
8486
|
"graph-output": "submit_graph_output",
|
|
8347
|
-
"graph-template": "submit_graph_template"
|
|
8487
|
+
"graph-template": "submit_graph_template",
|
|
8488
|
+
"subork-answer": "submit_subork_answer"
|
|
8348
8489
|
};
|
|
8349
8490
|
var WORKFLOW_RESULT_VALIDATION_TOOL_NAME = "validate_workflow_result";
|
|
8350
8491
|
var WORKFLOW_RESULT_KEY_MAX_LENGTH = 128;
|
|
@@ -8924,7 +9065,7 @@ function registerSessionActivityBatchRoute(app, runtime) {
|
|
|
8924
9065
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
8925
9066
|
|
|
8926
9067
|
// ../protocol/src/node/revised-rows.ts
|
|
8927
|
-
import { createHash as
|
|
9068
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
8928
9069
|
var RECENTLY_REVISED_ROWS_MAX = 128;
|
|
8929
9070
|
|
|
8930
9071
|
class RecentlyRevisedRows {
|
|
@@ -8962,7 +9103,7 @@ class RecentlyRevisedRows {
|
|
|
8962
9103
|
function revisedRowsReconciliationToken(overflowVersion, omitted) {
|
|
8963
9104
|
if (overflowVersion === 0 && omitted.length === 0)
|
|
8964
9105
|
return;
|
|
8965
|
-
const digest =
|
|
9106
|
+
const digest = createHash3("sha256").update(String(overflowVersion));
|
|
8966
9107
|
for (const row of omitted)
|
|
8967
9108
|
digest.update(JSON.stringify(row) ?? "null");
|
|
8968
9109
|
return digest.digest("hex");
|
|
@@ -8970,7 +9111,7 @@ function revisedRowsReconciliationToken(overflowVersion, omitted) {
|
|
|
8970
9111
|
|
|
8971
9112
|
// ../protocol/src/node/bridge-transcript-summary.ts
|
|
8972
9113
|
import { Buffer as Buffer3 } from "node:buffer";
|
|
8973
|
-
import { createHash as
|
|
9114
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
8974
9115
|
|
|
8975
9116
|
// ../protocol/src/node/progressive-transcript.ts
|
|
8976
9117
|
var BRIDGE_TRANSCRIPT_MAX_MESSAGES = 100;
|
|
@@ -9136,7 +9277,7 @@ function digestPayload(payload) {
|
|
|
9136
9277
|
const serialized = JSON.stringify(payload);
|
|
9137
9278
|
return {
|
|
9138
9279
|
bytes: Buffer3.byteLength(serialized),
|
|
9139
|
-
digest:
|
|
9280
|
+
digest: createHash4("sha256").update(serialized).digest("base64url").slice(0, 32)
|
|
9140
9281
|
};
|
|
9141
9282
|
}
|
|
9142
9283
|
function topLevelKey(part, index) {
|
|
@@ -9581,7 +9722,7 @@ function registerCodexChangeEvidenceRoutes(app, spool) {
|
|
|
9581
9722
|
}
|
|
9582
9723
|
|
|
9583
9724
|
// ../../bridges/codex-bridge/src/change-evidence.ts
|
|
9584
|
-
import { createHash as
|
|
9725
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
9585
9726
|
import { existsSync as existsSync2 } from "node:fs";
|
|
9586
9727
|
import { basename, join as join8 } from "node:path";
|
|
9587
9728
|
|
|
@@ -9988,7 +10129,7 @@ function workspaceObservationReportIssues(value) {
|
|
|
9988
10129
|
}
|
|
9989
10130
|
|
|
9990
10131
|
// ../protocol/src/node/change-tracking/evidence-spool.ts
|
|
9991
|
-
import { createHash as
|
|
10132
|
+
import { createHash as createHash5, randomUUID as randomUUID3 } from "node:crypto";
|
|
9992
10133
|
import { readdirSync, readFileSync } from "node:fs";
|
|
9993
10134
|
import { appendFile, mkdir, rename, rm as rm2, writeFile } from "node:fs/promises";
|
|
9994
10135
|
import { join as join3 } from "node:path";
|
|
@@ -10004,10 +10145,10 @@ var DEFAULT_EVIDENCE_SPOOL_LIMITS = {
|
|
|
10004
10145
|
var ENTRIES_FILE = "entries.jsonl";
|
|
10005
10146
|
var BODY_DIRECTORY = "bodies";
|
|
10006
10147
|
function evidenceBodyId(bytes) {
|
|
10007
|
-
return `sha256:${
|
|
10148
|
+
return `sha256:${createHash5("sha256").update(bytes).digest("hex")}`;
|
|
10008
10149
|
}
|
|
10009
10150
|
function stableEvidenceId(...parts) {
|
|
10010
|
-
const hash =
|
|
10151
|
+
const hash = createHash5("sha256");
|
|
10011
10152
|
for (const part of parts)
|
|
10012
10153
|
hash.update(`${part ?? ""}\x00`);
|
|
10013
10154
|
return hash.digest("hex").slice(0, 40);
|
|
@@ -11552,7 +11693,7 @@ function suppliedMovePath(change) {
|
|
|
11552
11693
|
return supplied?.kind === "update" ? supplied.movePath : change.move_path;
|
|
11553
11694
|
}
|
|
11554
11695
|
function codexChangeEvidenceDir(codexHome, cwd) {
|
|
11555
|
-
const cwdHash =
|
|
11696
|
+
const cwdHash = createHash6("sha256").update(cwd).digest("hex").slice(0, 16);
|
|
11556
11697
|
return join8(codexBridgeStateDir(codexHome), "change-evidence", cwdHash);
|
|
11557
11698
|
}
|
|
11558
11699
|
function createCodexChangeEvidence(options) {
|
|
@@ -12154,6 +12295,18 @@ function toBridgeModel(model) {
|
|
|
12154
12295
|
}
|
|
12155
12296
|
// ../protocol/src/human-prompts.ts
|
|
12156
12297
|
var HUMAN_PROMPT_SCAN_BYTES = 16 * 1024;
|
|
12298
|
+
var HUMAN_PROMPT_KINDS = new Set([
|
|
12299
|
+
"sign-in",
|
|
12300
|
+
"device-code",
|
|
12301
|
+
"press-enter",
|
|
12302
|
+
"secret",
|
|
12303
|
+
"host-key"
|
|
12304
|
+
]);
|
|
12305
|
+
var HUMAN_PROMPT_SOURCES = new Set([
|
|
12306
|
+
"user-command",
|
|
12307
|
+
"agent-tool",
|
|
12308
|
+
"agent-background-task"
|
|
12309
|
+
]);
|
|
12157
12310
|
var HUMAN_PROMPT_OBSERVATION_ROWS = 64;
|
|
12158
12311
|
function humanPromptObservation(messages, tasks) {
|
|
12159
12312
|
const object = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
@@ -12205,14 +12358,17 @@ function humanPromptObservation(messages, tasks) {
|
|
|
12205
12358
|
return { messages: [{ parts }], backgroundTasks };
|
|
12206
12359
|
}
|
|
12207
12360
|
|
|
12361
|
+
// ../protocol/src/agent-usage-limits.ts
|
|
12362
|
+
var USAGE_LIMIT_ERROR_CODE = "usage-limit";
|
|
12363
|
+
|
|
12208
12364
|
// ../../bridges/codex-bridge/src/sessions/typed-prompts.ts
|
|
12209
|
-
import { createHash as
|
|
12365
|
+
import { createHash as createHash7, randomUUID as randomUUID5 } from "node:crypto";
|
|
12210
12366
|
import { mkdir as mkdir4, open, opendir, rename as rename3, rm as rm4, writeFile as writeFile3 } from "node:fs/promises";
|
|
12211
12367
|
import { dirname as dirname2, join as join10 } from "node:path";
|
|
12212
12368
|
var MAX_TYPED_PROMPT_CHARS = 32000;
|
|
12213
12369
|
var MAX_RECORD_BYTES = 6 * MAX_TYPED_PROMPT_CHARS + 2048;
|
|
12214
12370
|
function typedPromptDigest(sentText) {
|
|
12215
|
-
return
|
|
12371
|
+
return createHash7("sha256").update(sentText.trim()).digest("hex");
|
|
12216
12372
|
}
|
|
12217
12373
|
function typedPromptFor(record, sentText) {
|
|
12218
12374
|
return record?.sent === typedPromptDigest(sentText) ? record.typed : undefined;
|
|
@@ -14432,7 +14588,7 @@ async function deriveTranscriptSubagentPartsForTurn({
|
|
|
14432
14588
|
}
|
|
14433
14589
|
|
|
14434
14590
|
// ../../bridges/codex-bridge/src/history/rollout.ts
|
|
14435
|
-
import { createHash as
|
|
14591
|
+
import { createHash as createHash8 } from "node:crypto";
|
|
14436
14592
|
import { readdir, stat as stat5 } from "node:fs/promises";
|
|
14437
14593
|
import { homedir } from "node:os";
|
|
14438
14594
|
import { basename as basename2, join as join11 } from "node:path";
|
|
@@ -16271,6 +16427,7 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
|
|
|
16271
16427
|
"address_multi_review",
|
|
16272
16428
|
"adopt_workflow",
|
|
16273
16429
|
"answer_worker_question",
|
|
16430
|
+
"ask_agents",
|
|
16274
16431
|
"cancel_build_pipeline",
|
|
16275
16432
|
"cancel_graph_run",
|
|
16276
16433
|
"cancel_multi_review",
|
|
@@ -16303,13 +16460,11 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
|
|
|
16303
16460
|
"launch_graph",
|
|
16304
16461
|
"launch_job",
|
|
16305
16462
|
"launch_multi_review",
|
|
16306
|
-
"launch_node_environment",
|
|
16307
16463
|
"launch_terminal",
|
|
16308
16464
|
"list_agents",
|
|
16309
16465
|
"list_environments",
|
|
16310
16466
|
"list_graph_templates",
|
|
16311
16467
|
"list_mailboxes",
|
|
16312
|
-
"list_node_environments",
|
|
16313
16468
|
"list_nodes",
|
|
16314
16469
|
"list_projects",
|
|
16315
16470
|
"list_provider_accounts",
|
|
@@ -16338,16 +16493,11 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
|
|
|
16338
16493
|
"resume_schedule",
|
|
16339
16494
|
"run_worker_command",
|
|
16340
16495
|
"send_message",
|
|
16341
|
-
"send_node_message",
|
|
16342
|
-
"send_prompt_to_node_tab",
|
|
16343
16496
|
"send_prompt_to_tab",
|
|
16344
16497
|
"set_worker_goal",
|
|
16345
16498
|
"start_build_pipeline",
|
|
16346
16499
|
"start_environment",
|
|
16347
|
-
"start_multi_review",
|
|
16348
|
-
"start_node_environment",
|
|
16349
16500
|
"stop_environment",
|
|
16350
|
-
"stop_node_environment",
|
|
16351
16501
|
"stop_worker_turn",
|
|
16352
16502
|
"switch_provider_account",
|
|
16353
16503
|
"set_account_auto_switch",
|
|
@@ -16740,7 +16890,7 @@ async function readSessionIndex(path) {
|
|
|
16740
16890
|
}
|
|
16741
16891
|
|
|
16742
16892
|
// ../../bridges/codex-bridge/src/history/rollout.ts
|
|
16743
|
-
var
|
|
16893
|
+
var log4 = createLogger("bridge.codex");
|
|
16744
16894
|
function getCodexHomeDir() {
|
|
16745
16895
|
return process.env.CODEX_HOME || join11(homedir(), ".codex");
|
|
16746
16896
|
}
|
|
@@ -17309,7 +17459,7 @@ async function hydrateMessagesFromPersistedSession(threadId, options = {}) {
|
|
|
17309
17459
|
};
|
|
17310
17460
|
}
|
|
17311
17461
|
}
|
|
17312
|
-
|
|
17462
|
+
log4.warn("rollout.hydrate-failed", { threadId });
|
|
17313
17463
|
return {
|
|
17314
17464
|
messages: [],
|
|
17315
17465
|
title: meta.title,
|
|
@@ -17333,7 +17483,7 @@ var NON_TOOL_TURN_ITEM_TYPES = new Set([
|
|
|
17333
17483
|
]);
|
|
17334
17484
|
var MAX_OPEN_CODE_MODE_CELLS = 256;
|
|
17335
17485
|
function replayedRowId(threadId, scope, kind, ordinal) {
|
|
17336
|
-
const digest =
|
|
17486
|
+
const digest = createHash8("sha256").update(`${threadId}\x00${scope}\x00${kind}\x00${ordinal}`).digest("hex");
|
|
17337
17487
|
return `msg-r-${digest.slice(0, 32)}`;
|
|
17338
17488
|
}
|
|
17339
17489
|
async function forEachHistoryBatch(snapshot, visit) {
|
|
@@ -17798,7 +17948,7 @@ async function replayPersistedRollout(threadId, snapshot, meta, structuredTurns)
|
|
|
17798
17948
|
}
|
|
17799
17949
|
|
|
17800
17950
|
// ../../bridges/codex-bridge/src/messages/render-turn.ts
|
|
17801
|
-
var
|
|
17951
|
+
var log5 = createLogger("bridge.codex");
|
|
17802
17952
|
var TRUNCATION_NOTICE = `
|
|
17803
17953
|
… output truncated`;
|
|
17804
17954
|
var SUBAGENT_TRANSCRIPT_PROBE_INTERVAL_MS = 2000;
|
|
@@ -18219,7 +18369,7 @@ async function renderTurn(turn, options) {
|
|
|
18219
18369
|
loadSnapshot = latestSnapshot;
|
|
18220
18370
|
}
|
|
18221
18371
|
} catch (error) {
|
|
18222
|
-
|
|
18372
|
+
log5.warn("subagent.activity-load-failed", { error: formatLogError(error) });
|
|
18223
18373
|
}
|
|
18224
18374
|
}
|
|
18225
18375
|
const { items, itemsByKey, accumulatorsByKey, versionsByKey, itemKeys } = collectTurnItems(turn, options.segment);
|
|
@@ -18610,7 +18760,7 @@ async function publishAssistantRows(context, state, turn, options) {
|
|
|
18610
18760
|
}
|
|
18611
18761
|
|
|
18612
18762
|
// ../../bridges/codex-bridge/src/app-server-runtime-sessions.ts
|
|
18613
|
-
import { createHash as
|
|
18763
|
+
import { createHash as createHash13, randomUUID as randomUUID8 } from "node:crypto";
|
|
18614
18764
|
|
|
18615
18765
|
// ../protocol/src/agent-mail.ts
|
|
18616
18766
|
var AGENT_MAIL_MAX_BODY_BYTES = 32 * 1024;
|
|
@@ -18664,10 +18814,178 @@ function agentMailCapabilities(tabType, agent, locked = true) {
|
|
|
18664
18814
|
}
|
|
18665
18815
|
var NATIVE_AGENT_MAIL_CAPABILITIES = Object.freeze(Object.fromEntries(AGENT_PLATFORMS.map((agent) => [agent, agentMailCapabilities("agent-native", agent)])));
|
|
18666
18816
|
|
|
18817
|
+
// ../protocol/src/rich-content-policy.ts
|
|
18818
|
+
var KIB = 1024;
|
|
18819
|
+
var MIB = 1024 * KIB;
|
|
18820
|
+
var CODE_BLOCK_POLICY = {
|
|
18821
|
+
maxHighlightBytes: 32 * KIB,
|
|
18822
|
+
maxHighlightLines: 2000,
|
|
18823
|
+
initialVisualLines: 24
|
|
18824
|
+
};
|
|
18825
|
+
var MERMAID_POLICY = {
|
|
18826
|
+
maxSourceBytes: 32 * KIB,
|
|
18827
|
+
maxEdges: 250,
|
|
18828
|
+
maxSvgBytes: 1 * MIB,
|
|
18829
|
+
maxSvgElements: 5000,
|
|
18830
|
+
renderTimeoutMs: 5000
|
|
18831
|
+
};
|
|
18832
|
+
var CHART_POLICY = {
|
|
18833
|
+
maxPayloadBytes: 256 * KIB,
|
|
18834
|
+
maxSeries: 6,
|
|
18835
|
+
maxBarCategories: 100,
|
|
18836
|
+
maxCartesianPoints: 2000,
|
|
18837
|
+
maxDonutSlices: 24,
|
|
18838
|
+
maxTitleCharacters: 200,
|
|
18839
|
+
maxLabelCharacters: 200,
|
|
18840
|
+
maxDescriptionCharacters: 2000,
|
|
18841
|
+
maxSourceNotes: 8,
|
|
18842
|
+
maxSourceNoteCharacters: 500,
|
|
18843
|
+
maxIdCharacters: 64,
|
|
18844
|
+
maxUnitCharacters: 32,
|
|
18845
|
+
maxAbsoluteValue: 1000000000000000,
|
|
18846
|
+
maxJsonDepth: 16
|
|
18847
|
+
};
|
|
18848
|
+
var WORKFLOW_SNAPSHOT_POLICY = {
|
|
18849
|
+
maxNormalizedBytes: 256 * KIB,
|
|
18850
|
+
maxNodes: 200,
|
|
18851
|
+
maxEdges: 400,
|
|
18852
|
+
maxIdCharacters: 128,
|
|
18853
|
+
maxLabelCharacters: 200,
|
|
18854
|
+
maxDescriptionCharacters: 2000,
|
|
18855
|
+
maxRawStatusCharacters: 100,
|
|
18856
|
+
maxLinksPerNode: 8
|
|
18857
|
+
};
|
|
18858
|
+
var STATIC_HTML_POLICY = {
|
|
18859
|
+
maxSourceBytes: 256 * KIB,
|
|
18860
|
+
maxPreparedBytes: 16 * MIB,
|
|
18861
|
+
maxElements: 5000
|
|
18862
|
+
};
|
|
18863
|
+
var STATIC_PRESENTATION_POLICY = {
|
|
18864
|
+
maxDocumentBytes: STATIC_HTML_POLICY.maxSourceBytes,
|
|
18865
|
+
maxElements: STATIC_HTML_POLICY.maxElements,
|
|
18866
|
+
maxFramesPerWindow: 4,
|
|
18867
|
+
renderTimeoutMs: 15000,
|
|
18868
|
+
maxSizeChangesPerWindow: 16,
|
|
18869
|
+
sizeChangeWindowMs: 5000,
|
|
18870
|
+
maxRefusedMessages: 100,
|
|
18871
|
+
maxSearchTextCharacters: 64 * KIB,
|
|
18872
|
+
searchTextChunkCharacters: 2 * KIB
|
|
18873
|
+
};
|
|
18874
|
+
var INTERACTIVE_HTML_POLICY = {
|
|
18875
|
+
maxAuthoredBytes: 512 * KIB,
|
|
18876
|
+
maxAssets: 32,
|
|
18877
|
+
maxAssetBytesTotal: 10 * MIB,
|
|
18878
|
+
maxDependencies: 4,
|
|
18879
|
+
maxPreparedBytes: 16 * MIB,
|
|
18880
|
+
maxRuntimeElements: 1e4,
|
|
18881
|
+
maxProbeSteps: 20,
|
|
18882
|
+
maxProbeStepMs: 2000,
|
|
18883
|
+
defaultWaitVisibleMs: 1000,
|
|
18884
|
+
maxProbeTextCharacters: 1024,
|
|
18885
|
+
probeTargetPattern: /^[A-Za-z][A-Za-z0-9_-]{0,63}$/
|
|
18886
|
+
};
|
|
18887
|
+
var PREVIEW_CAPTURE_POLICY = {
|
|
18888
|
+
maxPngBytes: 8 * MIB,
|
|
18889
|
+
maxPixels: 12000000,
|
|
18890
|
+
maxDimension: 4096,
|
|
18891
|
+
minDimension: 240,
|
|
18892
|
+
maxCapturesPerReceipt: 3,
|
|
18893
|
+
defaultViewport: { width: 960, height: 640, deviceScaleFactor: 1 }
|
|
18894
|
+
};
|
|
18895
|
+
var PREVIEW_ADMISSION_POLICY = {
|
|
18896
|
+
runningPerEnvironment: 1,
|
|
18897
|
+
runningGlobal: 2,
|
|
18898
|
+
queuedPerEnvironment: 8,
|
|
18899
|
+
queuedGlobal: 16,
|
|
18900
|
+
nonterminalPerConversation: 2,
|
|
18901
|
+
queuedMetadataBytesGlobal: 8 * MIB,
|
|
18902
|
+
queueWaitMs: 15000,
|
|
18903
|
+
workerWallMs: 30000,
|
|
18904
|
+
readinessMs: 5000,
|
|
18905
|
+
operationDeadlineMs: 45000,
|
|
18906
|
+
cleanupGraceMs: 2000,
|
|
18907
|
+
workerMemoryBytes: 1024 * MIB,
|
|
18908
|
+
workerCpus: 2,
|
|
18909
|
+
workerPids: 128
|
|
18910
|
+
};
|
|
18911
|
+
var FRONTEND_RENDER_POLICY = {
|
|
18912
|
+
highlightConcurrency: 2,
|
|
18913
|
+
diagramConcurrency: 1,
|
|
18914
|
+
maxQueuedJobs: 32,
|
|
18915
|
+
maxQueuedSourceBytes: 2 * MIB,
|
|
18916
|
+
maxSettledCacheEntries: 128,
|
|
18917
|
+
maxSettledCacheBytes: 16 * MIB,
|
|
18918
|
+
maxInactiveViewStateEntries: 500,
|
|
18919
|
+
maxActiveViewStateEntries: 200,
|
|
18920
|
+
maxPinnedViewStateEntries: 50,
|
|
18921
|
+
liveExecutableHostsPerWindow: 1,
|
|
18922
|
+
imageDecodeMaxPixels: 40000000,
|
|
18923
|
+
pdfPreviewMaxPages: 100,
|
|
18924
|
+
pdfPreviewMaxBytes: 20 * MIB
|
|
18925
|
+
};
|
|
18926
|
+
var PDF_POLICY = {
|
|
18927
|
+
maxPages: 100,
|
|
18928
|
+
maxBytes: 20 * MIB,
|
|
18929
|
+
thumbnailMaxDimension: 1024,
|
|
18930
|
+
thumbnailMaxPngBytes: 4 * MIB,
|
|
18931
|
+
imageDecodeMaxPixels: 40000000,
|
|
18932
|
+
printMarginMm: 10,
|
|
18933
|
+
previewCacheEntries: 32,
|
|
18934
|
+
previewCacheBytes: 16 * MIB
|
|
18935
|
+
};
|
|
18936
|
+
var DIAGNOSTIC_POLICY = {
|
|
18937
|
+
maxPersistedEntries: 50,
|
|
18938
|
+
maxEntryBytes: 2 * KIB,
|
|
18939
|
+
maxPersistedBytes: 32 * KIB,
|
|
18940
|
+
maxToolFieldErrors: 20,
|
|
18941
|
+
maxToolDiagnosticBytes: 8 * KIB
|
|
18942
|
+
};
|
|
18943
|
+
var ARTIFACT_TOOL_POLICY = {
|
|
18944
|
+
maxResultBytes: 16 * KIB,
|
|
18945
|
+
maxSourceSliceBytes: 8 * KIB,
|
|
18946
|
+
maxTitleCharacters: 120,
|
|
18947
|
+
maxSummaryCharacters: 400,
|
|
18948
|
+
maxRequestKeyCharacters: 128,
|
|
18949
|
+
maxRepairRevisions: 2,
|
|
18950
|
+
maxTransientRetries: 2,
|
|
18951
|
+
maxUnpublishedArtifactsPerConversation: 100,
|
|
18952
|
+
maxRevisionsPerArtifact: 100,
|
|
18953
|
+
assetStoreBytesPerEnvironment: 1024 * MIB,
|
|
18954
|
+
scopeCapabilityTtlMs: 24 * 60 * 60 * 1000
|
|
18955
|
+
};
|
|
18956
|
+
var ARTIFACT_RETENTION_POLICY = {
|
|
18957
|
+
cleanupIntervalMs: 60 * 60 * 1000,
|
|
18958
|
+
abandonedStagingMs: 60 * 60 * 1000,
|
|
18959
|
+
unpublishedDraftMs: 7 * 24 * 60 * 60 * 1000,
|
|
18960
|
+
unreferencedPreviewAssetMs: 24 * 60 * 60 * 1000
|
|
18961
|
+
};
|
|
18962
|
+
var FRAME_CHANNEL_POLICY = {
|
|
18963
|
+
maxMessageBytes: 8 * KIB,
|
|
18964
|
+
messagesPerSecond: 20,
|
|
18965
|
+
burst: 40,
|
|
18966
|
+
sizeUpdatesPerSecond: 4,
|
|
18967
|
+
minInlineHeight: 120,
|
|
18968
|
+
maxInlineHeight: 1600,
|
|
18969
|
+
maxLinkCharacters: 2048,
|
|
18970
|
+
maxLinkLabelCharacters: 200
|
|
18971
|
+
};
|
|
18972
|
+
|
|
18667
18973
|
// ../protocol/src/agent-system-instructions.ts
|
|
18668
|
-
var AGENT_IMAGE_PREVIEW_INSTRUCTION = "Orkestrator renders Markdown images inline in the transcript. When you show the user an image in your reply (a screenshot, rendered preview, or
|
|
18974
|
+
var AGENT_IMAGE_PREVIEW_INSTRUCTION = "Orkestrator renders Markdown images inline in the transcript. When you show the user an image in your reply (a photograph, screenshot, rendered preview, or a requested image file) using Markdown image syntax, reference it by its absolute path. In a managed worktree or container environment, save the file inside the working directory, preferably in a git-ignored folder so preview files stay out of the change set. Local image previews are limited to Orkestrator-managed workspace storage or the container's /workspace. Project-home checkouts are excluded from host preview reads, even when they are the working directory, so images saved there cannot be previewed from a local Markdown path. Paths outside previewable storage, such as /tmp, also show a placeholder.";
|
|
18669
18975
|
var AGENT_DOCUMENT_INSTRUCTION = "When the user asks for a document (a report, design doc, plan, analysis, guide, or other writing to keep), prefer writing it as a Markdown file in a `docs/` folder at the root of the working directory, and tell the user the file's path. Project instructions (such as AGENTS.md or CLAUDE.md), local skills, and the user's own request take priority over this default when they say where or how to write documents.";
|
|
18976
|
+
var AGENT_CHART_SPEC_SHAPES = "bar adds xAxis:{kind:'category',label}, yAxis:{label,unit?}, categories:[{id,label}], series:[{id,label,points:[{categoryId,value|null}]}] (one point per category); " + "line/area/scatter add xAxis:{kind:'number'|'utc-time',label,unit?}, yAxis:{label,unit?}, series:[{id,label,points:[{x,y|null}]}]; " + "donut adds valueLabel, unit?, slices:[{id,label,value}]";
|
|
18977
|
+
var AGENT_CHART_FENCE_EXAMPLE = '{"schemaVersion":1,"kind":"bar","title":"Passing tests","description":"Passing tests per suite.","xAxis":{"kind":"category","label":"Suite"},"yAxis":{"label":"Tests"},"categories":[{"id":"unit","label":"Unit"},{"id":"browser","label":"Browser"}],"series":[{"id":"passed","label":"Passed","points":[{"categoryId":"unit","value":40},{"categoryId":"browser","value":8}]}]}';
|
|
18978
|
+
var AGENT_VISUAL_OUTPUT_INSTRUCTION = [
|
|
18979
|
+
"Orkestrator displays rich visuals directly in the conversation; choose one when it helps answer the question.",
|
|
18980
|
+
`Flows, architecture, sequences and relationships: a \`mermaid\` code fence. Standard bar, line, area, scatter and donut charts: a \`chart\` code fence holding one ChartSpecV1 JSON object with schemaVersion 1, kind, title and description; ${AGENT_CHART_SPEC_SHAPES}. For example: ${AGENT_CHART_FENCE_EXAMPLE}.`,
|
|
18981
|
+
"When this session has the Orkestrator artifact tools, use them for durable visuals: create_artifact, preview_artifact, get_artifact_operation to inspect the diagnostics and capture, then publish_artifact, and respect their repair limits.",
|
|
18982
|
+
`A custom report, timeline or layout combining text and graphics is an html-static artifact: self-contained HTML, CSS and inline SVG, with no scripts or network resources. Its verified document is displayed in the transcript as real, selectable content, so keep it within ${STATIC_PRESENTATION_POLICY.maxDocumentBytes / 1024} KiB and ${STATIC_PRESENTATION_POLICY.maxElements} elements, use fluid widths, let content set the height (no 100vh on the root), and colour it with the --ork-foreground, --ork-muted-foreground, --ork-background, --ork-border, --ork-primary and --ork-chart-1 to --ork-chart-8 CSS variables, which follow the application theme. Always give them a fallback, such as var(--ork-foreground, #18181b), because the preview defines none of them.`,
|
|
18983
|
+
"Behaviour that needs authored JavaScript, such as a calculator or a filterable dashboard, is an html-interactive artifact; it runs when the reader activates it.",
|
|
18984
|
+
"Use ordinary images only for photographs, screenshots and requested image files.",
|
|
18985
|
+
"HTML, SVG and JavaScript code fences are shown as source and a file path alone publishes nothing: a visual is in the conversation only once publish_artifact succeeds. If verification is unavailable, say so and use a supported form such as a Mermaid or chart fence."
|
|
18986
|
+
].join(" ");
|
|
18670
18987
|
var GENERAL_AGENT_INSTRUCTIONS = [
|
|
18988
|
+
AGENT_VISUAL_OUTPUT_INSTRUCTION,
|
|
18671
18989
|
AGENT_IMAGE_PREVIEW_INSTRUCTION,
|
|
18672
18990
|
AGENT_DOCUMENT_INSTRUCTION
|
|
18673
18991
|
];
|
|
@@ -18716,6 +19034,24 @@ async function readRepositoryInstructions(cwd, maxBytes = MAX_REPOSITORY_INSTRUC
|
|
|
18716
19034
|
}
|
|
18717
19035
|
}
|
|
18718
19036
|
|
|
19037
|
+
// ../protocol/src/suborks.ts
|
|
19038
|
+
var SUBORK_TOOL_NAME = "ask_agents";
|
|
19039
|
+
var AGENT_SUBORK_TOOL_NAMES = Object.freeze([SUBORK_TOOL_NAME]);
|
|
19040
|
+
var SUBORK_LIMITS = Object.freeze({
|
|
19041
|
+
targetsPerCall: 4,
|
|
19042
|
+
activePerSession: 8,
|
|
19043
|
+
totalPerSession: 64,
|
|
19044
|
+
retainedBatchesPerSession: 16,
|
|
19045
|
+
promptMaxBytes: 64 * 1024,
|
|
19046
|
+
nameMaxChars: 80,
|
|
19047
|
+
targetTextMaxChars: 200,
|
|
19048
|
+
storedAnswerMaxBytes: 64 * 1024,
|
|
19049
|
+
deliveredAnswersMaxBytes: AGENT_MAIL_MAX_BODY_BYTES - 2 * 1024,
|
|
19050
|
+
lineMaxChars: 240,
|
|
19051
|
+
errorMaxChars: 1024,
|
|
19052
|
+
deadlineMs: 45 * 60000
|
|
19053
|
+
});
|
|
19054
|
+
|
|
18719
19055
|
// ../protocol/src/build-pipeline-key-information.ts
|
|
18720
19056
|
var KEY_INFORMATION_LIMITS = Object.freeze({
|
|
18721
19057
|
proseLength: 4000,
|
|
@@ -18760,7 +19096,7 @@ var ORKESTRATOR_ARTIFACT_MCP_PATH = "/artifact-mcp";
|
|
|
18760
19096
|
|
|
18761
19097
|
// ../../bridges/codex-bridge/src/engine/app-server-engine.ts
|
|
18762
19098
|
import { open as open9 } from "node:fs/promises";
|
|
18763
|
-
import { createHash as
|
|
19099
|
+
import { createHash as createHash12 } from "node:crypto";
|
|
18764
19100
|
import { isAbsolute as isAbsolute9, join as join20 } from "node:path";
|
|
18765
19101
|
|
|
18766
19102
|
// ../../bridges/codex-bridge/src/app-server/process-supervisor.ts
|
|
@@ -19030,7 +19366,7 @@ function extractThreadId(params) {
|
|
|
19030
19366
|
}
|
|
19031
19367
|
|
|
19032
19368
|
// ../../bridges/codex-bridge/src/app-server/jsonl-rpc-client.ts
|
|
19033
|
-
var
|
|
19369
|
+
var log6 = createLogger("bridge.codex");
|
|
19034
19370
|
var DEFAULT_MAX_INBOUND_LINE_BYTES = 64 * 1024 * 1024;
|
|
19035
19371
|
var DEFAULT_MAX_OUTBOUND_LINE_BYTES = 32 * 1024 * 1024;
|
|
19036
19372
|
var DEFAULT_REQUEST_TIMEOUT_MS = 60000;
|
|
@@ -19142,7 +19478,7 @@ class JsonlRpcClient {
|
|
|
19142
19478
|
try {
|
|
19143
19479
|
this.options.recordInboundLine(line);
|
|
19144
19480
|
} catch (error) {
|
|
19145
|
-
|
|
19481
|
+
log6.error("recorder.threw", { error: formatLogError(error) });
|
|
19146
19482
|
}
|
|
19147
19483
|
}
|
|
19148
19484
|
const message = parseInboundLine(line);
|
|
@@ -19174,7 +19510,7 @@ class JsonlRpcClient {
|
|
|
19174
19510
|
try {
|
|
19175
19511
|
this.options.onServerRequest(message);
|
|
19176
19512
|
} catch (error) {
|
|
19177
|
-
|
|
19513
|
+
log6.error("server-request.handoff-failed", { error: formatLogError(error) });
|
|
19178
19514
|
}
|
|
19179
19515
|
return;
|
|
19180
19516
|
}
|
|
@@ -19183,7 +19519,7 @@ class JsonlRpcClient {
|
|
|
19183
19519
|
try {
|
|
19184
19520
|
this.options.onNotification(message, extractThreadId(message.params), Buffer.byteLength(line, "utf8"));
|
|
19185
19521
|
} catch (error) {
|
|
19186
|
-
|
|
19522
|
+
log6.error("notification.enqueue-failed", { error: formatLogError(error) });
|
|
19187
19523
|
}
|
|
19188
19524
|
return;
|
|
19189
19525
|
}
|
|
@@ -19365,7 +19701,7 @@ class SerialQueue {
|
|
|
19365
19701
|
run(key, task, bytes = 0) {
|
|
19366
19702
|
if (this.depth >= this.maxDepth || this.bytes + bytes > this.maxBytes) {
|
|
19367
19703
|
const overflow = { depth: this.depth, bytes: this.bytes };
|
|
19368
|
-
|
|
19704
|
+
log6.error("queue.overflow", overflow);
|
|
19369
19705
|
this.clear();
|
|
19370
19706
|
this.onOverflow?.(overflow);
|
|
19371
19707
|
return;
|
|
@@ -19445,16 +19781,16 @@ class SerialQueue {
|
|
|
19445
19781
|
queue.waiters.splice(0, resolved);
|
|
19446
19782
|
}
|
|
19447
19783
|
reportTaskFailure(key, error) {
|
|
19448
|
-
|
|
19784
|
+
log6.error("queue.task-failed", { key, error: formatLogError(error) });
|
|
19449
19785
|
}
|
|
19450
19786
|
}
|
|
19451
19787
|
|
|
19452
19788
|
// ../../bridges/codex-bridge/src/app-server/notification-recorder.ts
|
|
19453
19789
|
import { appendFile as appendFile4, mkdir as mkdir5 } from "node:fs/promises";
|
|
19454
19790
|
import { join as join13 } from "node:path";
|
|
19455
|
-
var
|
|
19791
|
+
var log7 = createLogger("bridge.codex");
|
|
19456
19792
|
function recorderNotice(message) {
|
|
19457
|
-
|
|
19793
|
+
log7.warn("recorder.notice", { detail: message });
|
|
19458
19794
|
}
|
|
19459
19795
|
var DEFAULT_MAX_RECORDING_BYTES = 64 * 1024 * 1024;
|
|
19460
19796
|
var DEFAULT_FLUSH_INTERVAL_MS = 250;
|
|
@@ -19567,7 +19903,7 @@ class NotificationRecorder {
|
|
|
19567
19903
|
} catch (error) {
|
|
19568
19904
|
this.stats.writeErrors += 1;
|
|
19569
19905
|
this.stats.linesDropped += pending.length;
|
|
19570
|
-
|
|
19906
|
+
log7.error("recorder.write-failed", { error: formatLogError(error, { stack: false }) });
|
|
19571
19907
|
}
|
|
19572
19908
|
}
|
|
19573
19909
|
async close() {
|
|
@@ -19600,9 +19936,9 @@ function createRecorderFromEnv(options) {
|
|
|
19600
19936
|
|
|
19601
19937
|
// ../../bridges/codex-bridge/src/runtime-env.ts
|
|
19602
19938
|
import { execFile as execFileCallback } from "node:child_process";
|
|
19603
|
-
import { createHash as
|
|
19939
|
+
import { createHash as createHash9 } from "node:crypto";
|
|
19604
19940
|
import { promisify } from "node:util";
|
|
19605
|
-
var
|
|
19941
|
+
var log8 = createLogger("bridge.codex");
|
|
19606
19942
|
var execFile2 = promisify(execFileCallback);
|
|
19607
19943
|
var RUNTIME_ENV_SCRIPT_ENV = "ORKESTRATOR_RUNTIME_ENV_SCRIPT";
|
|
19608
19944
|
var DEFAULT_RUNTIME_ENV_SCRIPT = "/usr/local/bin/orkestrator-runtime-env.sh";
|
|
@@ -19680,14 +20016,14 @@ async function refreshRuntimeEnvironment(run = execFile2) {
|
|
|
19680
20016
|
});
|
|
19681
20017
|
const updated = applyRuntimeEnvironmentOutput(stdout);
|
|
19682
20018
|
if (updated.length > 0) {
|
|
19683
|
-
|
|
20019
|
+
log8.info("runtime-env.refreshed", { names: updated.join(", ") });
|
|
19684
20020
|
}
|
|
19685
20021
|
} catch (error) {
|
|
19686
|
-
|
|
20022
|
+
log8.warn("runtime-env.refresh-failed", { error: formatLogError(error) });
|
|
19687
20023
|
}
|
|
19688
20024
|
}
|
|
19689
20025
|
function fingerprintRuntimeEnvironment(env = process.env) {
|
|
19690
|
-
const hash =
|
|
20026
|
+
const hash = createHash9("sha256");
|
|
19691
20027
|
for (const name of [...RUNTIME_ENV_VARIABLES].sort()) {
|
|
19692
20028
|
hash.update(name);
|
|
19693
20029
|
hash.update("\x00");
|
|
@@ -19703,7 +20039,7 @@ function runtimeEnvironmentSnapshot(env = process.env) {
|
|
|
19703
20039
|
}
|
|
19704
20040
|
|
|
19705
20041
|
// ../../bridges/codex-bridge/src/app-server/process-supervisor.ts
|
|
19706
|
-
var
|
|
20042
|
+
var log9 = createLogger("bridge.codex");
|
|
19707
20043
|
|
|
19708
20044
|
class AppServerOwnershipUnavailableError extends AppServerUnavailableError {
|
|
19709
20045
|
ownershipContention = true;
|
|
@@ -19989,7 +20325,7 @@ class AppServerSupervisor {
|
|
|
19989
20325
|
if (describedLines >= STDERR_METADATA_LINE_BUDGET)
|
|
19990
20326
|
return;
|
|
19991
20327
|
describedLines += 1;
|
|
19992
|
-
|
|
20328
|
+
log9.info("app-server.stderr", () => ({
|
|
19993
20329
|
generation: generationId,
|
|
19994
20330
|
detail: describeChildStderrLine(line)
|
|
19995
20331
|
}));
|
|
@@ -20013,7 +20349,7 @@ class AppServerSupervisor {
|
|
|
20013
20349
|
stderrTail = "";
|
|
20014
20350
|
if (suppressedLines === 0)
|
|
20015
20351
|
return;
|
|
20016
|
-
|
|
20352
|
+
log9.info("app-server.stderr-suppressed", {
|
|
20017
20353
|
generation: generationId,
|
|
20018
20354
|
lines: suppressedLines,
|
|
20019
20355
|
payloadBytes: suppressedBytes
|
|
@@ -20023,7 +20359,7 @@ class AppServerSupervisor {
|
|
|
20023
20359
|
};
|
|
20024
20360
|
const recorder = (this.options.createRecorder ?? ((generation) => createRecorderFromEnv({ generation })))(generationId);
|
|
20025
20361
|
if (recorder) {
|
|
20026
|
-
|
|
20362
|
+
log9.warn("app-server.recording", {
|
|
20027
20363
|
generation: generationId,
|
|
20028
20364
|
fileName: recorder.getStats().fileName
|
|
20029
20365
|
});
|
|
@@ -20036,7 +20372,7 @@ class AppServerSupervisor {
|
|
|
20036
20372
|
onServerRequest: (request) => this.options.onServerRequest(request, generationId),
|
|
20037
20373
|
onProtocolViolation: (detail) => {
|
|
20038
20374
|
this.unknownNotifications += 1;
|
|
20039
|
-
|
|
20375
|
+
log9.warn("app-server.protocol-violation", { generation: generationId, detail });
|
|
20040
20376
|
},
|
|
20041
20377
|
...recorder ? { recordInboundLine: (line) => recorder.record(line) } : {}
|
|
20042
20378
|
});
|
|
@@ -20114,7 +20450,7 @@ class AppServerSupervisor {
|
|
|
20114
20450
|
return;
|
|
20115
20451
|
const exited = this.current;
|
|
20116
20452
|
this.current = null;
|
|
20117
|
-
|
|
20453
|
+
log9.warn("app-server.exited", {
|
|
20118
20454
|
generation: generationId,
|
|
20119
20455
|
code,
|
|
20120
20456
|
signal,
|
|
@@ -20134,7 +20470,7 @@ class AppServerSupervisor {
|
|
|
20134
20470
|
const reason = "notification queue overflowed";
|
|
20135
20471
|
this.lastError = reason;
|
|
20136
20472
|
this.restartNow(reason).catch((error) => {
|
|
20137
|
-
|
|
20473
|
+
log9.error("app-server.overflow-restart-failed", { error: formatLogError(error) });
|
|
20138
20474
|
});
|
|
20139
20475
|
}
|
|
20140
20476
|
async ensureEnvironmentIsCurrent(options) {
|
|
@@ -20387,7 +20723,7 @@ class AppServerSupervisor {
|
|
|
20387
20723
|
if (outcome === "contended")
|
|
20388
20724
|
return true;
|
|
20389
20725
|
if (matches && pid !== null) {
|
|
20390
|
-
|
|
20726
|
+
log9.info("app-server.stale-reaped", { pid });
|
|
20391
20727
|
(this.options.signalPidFileProcess ?? signalStaleProcessTree)(pid);
|
|
20392
20728
|
}
|
|
20393
20729
|
return true;
|
|
@@ -21064,7 +21400,7 @@ function buildInteractionResponse(request, answer) {
|
|
|
21064
21400
|
}
|
|
21065
21401
|
|
|
21066
21402
|
// ../../bridges/codex-bridge/src/app-server/server-request-router.ts
|
|
21067
|
-
var
|
|
21403
|
+
var log10 = createLogger("bridge.codex");
|
|
21068
21404
|
var DEFAULT_RESPONSE_TIMEOUT_MS = 1e4;
|
|
21069
21405
|
var DEFAULT_APPROVAL_TIMEOUT_MS = AGENT_INTERACTION_DEFAULT_TIMEOUT_MS;
|
|
21070
21406
|
|
|
@@ -21224,7 +21560,7 @@ class ServerRequestRouter {
|
|
|
21224
21560
|
record.timedOut = true;
|
|
21225
21561
|
this.counts.timedOut += 1;
|
|
21226
21562
|
if (this.sendStarted.has(key)) {
|
|
21227
|
-
|
|
21563
|
+
log10.error("server-request.flush-timeout", {
|
|
21228
21564
|
method: record.method,
|
|
21229
21565
|
timeoutMs: this.responseTimeoutMs
|
|
21230
21566
|
});
|
|
@@ -21328,7 +21664,7 @@ class ServerRequestRouter {
|
|
|
21328
21664
|
accepted = this.options.presentApproval?.(approval) === true;
|
|
21329
21665
|
} catch (error) {
|
|
21330
21666
|
deadline.settle();
|
|
21331
|
-
|
|
21667
|
+
log10.error("approval.present-failed", { error: formatLogError(error) });
|
|
21332
21668
|
return false;
|
|
21333
21669
|
}
|
|
21334
21670
|
if (!accepted) {
|
|
@@ -21365,7 +21701,7 @@ class ServerRequestRouter {
|
|
|
21365
21701
|
try {
|
|
21366
21702
|
this.options.onApprovalResolved?.(parked.request, decision, resolution);
|
|
21367
21703
|
} catch (error) {
|
|
21368
|
-
|
|
21704
|
+
log10.error("approval.resolved-callback-failed", { error: formatLogError(error) });
|
|
21369
21705
|
}
|
|
21370
21706
|
if (options.skipSend) {
|
|
21371
21707
|
this.pending.delete(parked.key);
|
|
@@ -21386,7 +21722,7 @@ class ServerRequestRouter {
|
|
|
21386
21722
|
try {
|
|
21387
21723
|
this.options.onApprovalResolved?.(parked.request, "withdrawn", "withdrawn");
|
|
21388
21724
|
} catch (error) {
|
|
21389
|
-
|
|
21725
|
+
log10.error("approval.resolved-callback-failed", { error: formatLogError(error) });
|
|
21390
21726
|
}
|
|
21391
21727
|
this.pending.delete(parked.key);
|
|
21392
21728
|
this.sendStarted.delete(parked.key);
|
|
@@ -21428,7 +21764,7 @@ class ServerRequestRouter {
|
|
|
21428
21764
|
accepted = this.options.presentInteraction?.(interaction) === true;
|
|
21429
21765
|
} catch (error) {
|
|
21430
21766
|
deadline?.settle();
|
|
21431
|
-
|
|
21767
|
+
log10.error("interaction.present-failed", { error: formatLogError(error) });
|
|
21432
21768
|
return false;
|
|
21433
21769
|
}
|
|
21434
21770
|
if (!accepted) {
|
|
@@ -21464,7 +21800,7 @@ class ServerRequestRouter {
|
|
|
21464
21800
|
try {
|
|
21465
21801
|
this.options.onInteractionResolved?.(parked.request, answer, resolution);
|
|
21466
21802
|
} catch (error) {
|
|
21467
|
-
|
|
21803
|
+
log10.error("interaction.resolved-callback-failed", { error: formatLogError(error) });
|
|
21468
21804
|
}
|
|
21469
21805
|
if (options.skipSend) {
|
|
21470
21806
|
this.pending.delete(parked.key);
|
|
@@ -21497,7 +21833,7 @@ class ServerRequestRouter {
|
|
|
21497
21833
|
try {
|
|
21498
21834
|
await send();
|
|
21499
21835
|
} catch (error) {
|
|
21500
|
-
|
|
21836
|
+
log10.error("server-request.answer-failed", {
|
|
21501
21837
|
method: record.method,
|
|
21502
21838
|
error: formatLogError(error, { stack: false })
|
|
21503
21839
|
});
|
|
@@ -21514,7 +21850,7 @@ class ServerRequestRouter {
|
|
|
21514
21850
|
}
|
|
21515
21851
|
violation(method, detail) {
|
|
21516
21852
|
this.options.onInvariantViolation?.(method, detail);
|
|
21517
|
-
|
|
21853
|
+
log10.error("app-server.invariant-violation", { method, detail });
|
|
21518
21854
|
}
|
|
21519
21855
|
explain(record, message) {
|
|
21520
21856
|
this.options.reportToTranscript?.({
|
|
@@ -22100,12 +22436,12 @@ function reduceHistoricalTurns(turns, generation, threadId, handle) {
|
|
|
22100
22436
|
}
|
|
22101
22437
|
|
|
22102
22438
|
// ../../bridges/codex-bridge/src/sessions/dispatch-journal.ts
|
|
22103
|
-
import { createHash as
|
|
22439
|
+
import { createHash as createHash11 } from "node:crypto";
|
|
22104
22440
|
import { mkdir as mkdir8, open as open7, rename as rename6, rm as rm7, writeFile as writeFile5 } from "node:fs/promises";
|
|
22105
22441
|
import { join as join16 } from "node:path";
|
|
22106
22442
|
|
|
22107
22443
|
// ../../bridges/codex-bridge/src/sessions/persistence.ts
|
|
22108
|
-
import { createHash as
|
|
22444
|
+
import { createHash as createHash10, randomUUID as randomUUID7 } from "node:crypto";
|
|
22109
22445
|
import {
|
|
22110
22446
|
chmod,
|
|
22111
22447
|
link as link2,
|
|
@@ -22118,7 +22454,7 @@ import {
|
|
|
22118
22454
|
writeFile as writeFile4
|
|
22119
22455
|
} from "node:fs/promises";
|
|
22120
22456
|
import { join as join15 } from "node:path";
|
|
22121
|
-
var
|
|
22457
|
+
var log11 = createLogger("bridge.codex");
|
|
22122
22458
|
var BRIDGE_SESSION_REGISTRY_VERSION = 2;
|
|
22123
22459
|
var SESSION_TITLE_SOURCES = new Set([
|
|
22124
22460
|
"codex",
|
|
@@ -22200,7 +22536,7 @@ function isPersistedSessionTombstone(value) {
|
|
|
22200
22536
|
return tombstone.deleted === true && typeof tombstone.bridgeSessionId === "string" && tombstone.bridgeSessionId.length > 0 && typeof tombstone.deletedAt === "string" && Number.isFinite(Date.parse(tombstone.deletedAt));
|
|
22201
22537
|
}
|
|
22202
22538
|
function hashCwd(cwd) {
|
|
22203
|
-
return
|
|
22539
|
+
return createHash10("sha256").update(cwd).digest("hex").slice(0, 16);
|
|
22204
22540
|
}
|
|
22205
22541
|
var DEFAULT_RETENTION_MS = 7 * 24 * 60 * 60 * 1000;
|
|
22206
22542
|
var RECORD_FILE_MISSING = Symbol("record-file-missing");
|
|
@@ -22234,7 +22570,7 @@ class BridgeSessionStore {
|
|
|
22234
22570
|
return directory === this.recordsDir() ? undefined : directory;
|
|
22235
22571
|
}
|
|
22236
22572
|
recordKey(bridgeSessionId) {
|
|
22237
|
-
return
|
|
22573
|
+
return createHash10("sha256").update(bridgeSessionId).digest("hex");
|
|
22238
22574
|
}
|
|
22239
22575
|
recordPath(bridgeSessionId) {
|
|
22240
22576
|
return join15(this.recordsDir(), `${this.recordKey(bridgeSessionId)}.json`);
|
|
@@ -22457,7 +22793,7 @@ class BridgeSessionStore {
|
|
|
22457
22793
|
await chmod(path, PRIVATE_FILE_MODE);
|
|
22458
22794
|
}
|
|
22459
22795
|
warnPersistenceFailure(error) {
|
|
22460
|
-
|
|
22796
|
+
log11.warn("registry.persist-failed", { error: formatLogError(error, { stack: false }) });
|
|
22461
22797
|
}
|
|
22462
22798
|
toRecord(options) {
|
|
22463
22799
|
const { agentMcp: _agentMcp, ...persistedConfig } = options.config;
|
|
@@ -22481,7 +22817,7 @@ class BridgeSessionStore {
|
|
|
22481
22817
|
}
|
|
22482
22818
|
|
|
22483
22819
|
// ../../bridges/codex-bridge/src/sessions/dispatch-journal.ts
|
|
22484
|
-
var
|
|
22820
|
+
var log12 = createLogger("bridge.codex");
|
|
22485
22821
|
var DISPATCH_JOURNAL_VERSION = 1;
|
|
22486
22822
|
var DISPATCH_COMPLETENESS_VERSION = 1;
|
|
22487
22823
|
var MAX_FRESH_SESSION_MARKERS = 256;
|
|
@@ -22897,7 +23233,7 @@ class DispatchJournal {
|
|
|
22897
23233
|
this.filterAdd(requestId);
|
|
22898
23234
|
}
|
|
22899
23235
|
filterPositions(requestId) {
|
|
22900
|
-
const digest =
|
|
23236
|
+
const digest = createHash11("sha256").update(requestId, "utf8").digest();
|
|
22901
23237
|
const positions = [];
|
|
22902
23238
|
for (let index = 0;index < UNTRACKED_FILTER_HASHES; index += 1) {
|
|
22903
23239
|
positions.push(digest.readUInt32BE(index * 4) % UNTRACKED_FILTER_BITS);
|
|
@@ -23020,7 +23356,7 @@ class DispatchJournal {
|
|
|
23020
23356
|
throw error;
|
|
23021
23357
|
});
|
|
23022
23358
|
} catch (error) {
|
|
23023
|
-
|
|
23359
|
+
log12.warn("journal.persist-failed", { error: formatLogError(error, { stack: false }) });
|
|
23024
23360
|
if (options.failClosed)
|
|
23025
23361
|
throw error;
|
|
23026
23362
|
}
|
|
@@ -23602,6 +23938,7 @@ function codexAppServerConfigOverrides(env = process.env) {
|
|
|
23602
23938
|
...AGENT_MAIL_TOOL_NAMES,
|
|
23603
23939
|
...ARTIFACT_TOOL_NAMES,
|
|
23604
23940
|
...AGENT_GOAL_TOOL_NAMES,
|
|
23941
|
+
...AGENT_SUBORK_TOOL_NAMES,
|
|
23605
23942
|
...KEY_INFORMATION_TOOL_NAMES
|
|
23606
23943
|
]) {
|
|
23607
23944
|
overrides[`mcp_servers.orkestrator.tools.${name}.approval_mode`] = JSON.stringify("approve");
|
|
@@ -23771,11 +24108,12 @@ var APP_SERVER_CAPABILITIES = {
|
|
|
23771
24108
|
};
|
|
23772
24109
|
|
|
23773
24110
|
// ../../bridges/codex-bridge/src/engine/app-server-engine.ts
|
|
23774
|
-
var
|
|
24111
|
+
var log13 = createLogger("bridge.codex");
|
|
23775
24112
|
var AGENT_MAIL_TOOL_APPROVALS = Object.fromEntries([
|
|
23776
24113
|
...AGENT_MAIL_TOOL_NAMES,
|
|
23777
24114
|
...ARTIFACT_TOOL_NAMES,
|
|
23778
24115
|
...AGENT_GOAL_TOOL_NAMES,
|
|
24116
|
+
...AGENT_SUBORK_TOOL_NAMES,
|
|
23779
24117
|
...KEY_INFORMATION_TOOL_NAMES
|
|
23780
24118
|
].map((name) => [name, { approval_mode: "approve" }]));
|
|
23781
24119
|
var ROOT_THREAD_SOURCE_KINDS = ["cli", "vscode", "exec", "appServer", "unknown"];
|
|
@@ -24145,7 +24483,7 @@ async function readStoredLoginFingerprint(codexHome) {
|
|
|
24145
24483
|
const apiKey = typeof root.OPENAI_API_KEY === "string" ? root.OPENAI_API_KEY : "";
|
|
24146
24484
|
if (!refreshToken && !apiKey)
|
|
24147
24485
|
return;
|
|
24148
|
-
return
|
|
24486
|
+
return createHash12("sha256").update(JSON.stringify([refreshToken, apiKey])).digest("hex");
|
|
24149
24487
|
} catch {
|
|
24150
24488
|
return;
|
|
24151
24489
|
}
|
|
@@ -24355,7 +24693,7 @@ class AppServerEngine {
|
|
|
24355
24693
|
try {
|
|
24356
24694
|
listener(event);
|
|
24357
24695
|
} catch (error) {
|
|
24358
|
-
|
|
24696
|
+
log13.error("engine.listener-failed", { error: formatLogError(error) });
|
|
24359
24697
|
}
|
|
24360
24698
|
}
|
|
24361
24699
|
}
|
|
@@ -24480,7 +24818,7 @@ class AppServerEngine {
|
|
|
24480
24818
|
const sequence = ++this.accountCheckSequence;
|
|
24481
24819
|
const generation = this.supervisor.getGeneration();
|
|
24482
24820
|
this.supervisor.request("account/read", { refreshToken }).catch(signedOutAccountRead).then((response) => this.applyAccountRead(response, sequence, generation, accountReplaced)).catch((error) => {
|
|
24483
|
-
|
|
24821
|
+
log13.warn("account.sign-in-check-failed", {
|
|
24484
24822
|
error: formatLogError(error, { stack: false })
|
|
24485
24823
|
});
|
|
24486
24824
|
});
|
|
@@ -25067,7 +25405,7 @@ class AppServerEngine {
|
|
|
25067
25405
|
const generation = this.supervisor.getGeneration();
|
|
25068
25406
|
const response = await this.supervisor.request("account/read", { refreshToken: false }).catch(signedOutAccountRead);
|
|
25069
25407
|
this.applyAccountRead(response, sequence, generation, false).catch((error) => {
|
|
25070
|
-
|
|
25408
|
+
log13.warn("account.connector-recovery-failed", {
|
|
25071
25409
|
error: formatLogError(error, { stack: false })
|
|
25072
25410
|
});
|
|
25073
25411
|
});
|
|
@@ -25280,7 +25618,7 @@ class AppServerEngine {
|
|
|
25280
25618
|
await this.supervisor.request("thread/name/set", { threadId, name });
|
|
25281
25619
|
return true;
|
|
25282
25620
|
} catch (error) {
|
|
25283
|
-
|
|
25621
|
+
log13.warn("thread.rename-failed", { error: formatLogError(error, { stack: false }) });
|
|
25284
25622
|
return false;
|
|
25285
25623
|
}
|
|
25286
25624
|
}
|
|
@@ -25300,7 +25638,7 @@ class AppServerEngine {
|
|
|
25300
25638
|
} catch (error) {
|
|
25301
25639
|
if (requireConfirmation)
|
|
25302
25640
|
throw error;
|
|
25303
|
-
|
|
25641
|
+
log13.warn("thread.unsubscribe-failed", { error: formatLogError(error, { stack: false }) });
|
|
25304
25642
|
}
|
|
25305
25643
|
this.accountProofTurns.delete(threadId);
|
|
25306
25644
|
this.rolloutPaths.delete(threadId);
|
|
@@ -25770,7 +26108,7 @@ class ThreadRegistry {
|
|
|
25770
26108
|
if (busy)
|
|
25771
26109
|
throw new OverlappingTurnError(context.threadId);
|
|
25772
26110
|
}
|
|
25773
|
-
setPhase(context, phase, error) {
|
|
26111
|
+
setPhase(context, phase, error, errorCode) {
|
|
25774
26112
|
if (phase === "starting") {
|
|
25775
26113
|
context.turnStartedAt = new Date(this.now()).toISOString();
|
|
25776
26114
|
} else if ((phase === "running" || phase === "cancelling" || phase === "recovering") && context.turnStartedAt === undefined && context.activeTurn) {
|
|
@@ -25780,6 +26118,7 @@ class ThreadRegistry {
|
|
|
25780
26118
|
}
|
|
25781
26119
|
context.phase = phase;
|
|
25782
26120
|
context.error = phase === "failed" ? error : undefined;
|
|
26121
|
+
context.errorCode = phase === "failed" ? errorCode : undefined;
|
|
25783
26122
|
}
|
|
25784
26123
|
sessionsForThread(threadId) {
|
|
25785
26124
|
const context = this.threads.get(threadId);
|
|
@@ -25845,7 +26184,7 @@ function externalRevertCut(messages, survivingTurnIds, running) {
|
|
|
25845
26184
|
}
|
|
25846
26185
|
|
|
25847
26186
|
// ../../bridges/codex-bridge/src/app-server-runtime-sessions.ts
|
|
25848
|
-
var
|
|
26187
|
+
var log14 = createLogger("bridge.codex");
|
|
25849
26188
|
var SESSION_CLOSING_ERROR = "Session is closing";
|
|
25850
26189
|
var ACTIVITY_PROCESS = randomUUID8();
|
|
25851
26190
|
|
|
@@ -25862,7 +26201,7 @@ class CodexRuntimeSessions {
|
|
|
25862
26201
|
}
|
|
25863
26202
|
createSession(body) {
|
|
25864
26203
|
const clientSessionKey = typeof body.clientSessionKey === "string" && body.clientSessionKey.trim().length > 0 && body.clientSessionKey.length <= 512 ? body.clientSessionKey : undefined;
|
|
25865
|
-
const sessionId = clientSessionKey ? `session-client-${
|
|
26204
|
+
const sessionId = clientSessionKey ? `session-client-${createHash13("sha256").update(this.ctx.options.cwd).update("\x00").update(clientSessionKey).digest("hex").slice(0, 32)}` : createSessionId();
|
|
25866
26205
|
const existing = this.ctx.registry.getSession(sessionId);
|
|
25867
26206
|
if (existing) {
|
|
25868
26207
|
this.ctx.registry.touch(sessionId);
|
|
@@ -26000,7 +26339,7 @@ class CodexRuntimeSessions {
|
|
|
26000
26339
|
try {
|
|
26001
26340
|
fork = await this.ctx.options.engine.forkThread(parent.threadId, parent.config, lastTurnId);
|
|
26002
26341
|
} catch (error) {
|
|
26003
|
-
|
|
26342
|
+
log14.warn("thread.fork-failed", {
|
|
26004
26343
|
threadId: parent.threadId,
|
|
26005
26344
|
error: formatLogError(error, { stack: false })
|
|
26006
26345
|
});
|
|
@@ -26052,7 +26391,7 @@ class CodexRuntimeSessions {
|
|
|
26052
26391
|
await this.ctx.callbacks.deleteSession(child.id).catch(() => {
|
|
26053
26392
|
return;
|
|
26054
26393
|
});
|
|
26055
|
-
|
|
26394
|
+
log14.warn("thread.fork-hydrate-failed", {
|
|
26056
26395
|
threadId: parent.threadId,
|
|
26057
26396
|
error: formatLogError(error, { stack: false })
|
|
26058
26397
|
});
|
|
@@ -26067,7 +26406,7 @@ class CodexRuntimeSessions {
|
|
|
26067
26406
|
});
|
|
26068
26407
|
turns = thread?.turns;
|
|
26069
26408
|
} catch (error) {
|
|
26070
|
-
|
|
26409
|
+
log14.warn("thread.turns-read-failed", {
|
|
26071
26410
|
threadId: context.threadId,
|
|
26072
26411
|
error: formatLogError(error, { stack: false })
|
|
26073
26412
|
});
|
|
@@ -26184,7 +26523,7 @@ class CodexRuntimeSessions {
|
|
|
26184
26523
|
return "not-found";
|
|
26185
26524
|
if (this.sessionAdmissionClosed(session))
|
|
26186
26525
|
return "closing";
|
|
26187
|
-
const inputDigest =
|
|
26526
|
+
const inputDigest = createHash13("sha256").update(input).digest("hex");
|
|
26188
26527
|
const previous = this.ctx.steerRequests.get(requestId);
|
|
26189
26528
|
if (previous) {
|
|
26190
26529
|
if (previous.threadId !== session.threadId || previous.turnId !== expectedTurnId || previous.inputDigest !== inputDigest) {
|
|
@@ -26402,6 +26741,7 @@ class CodexRuntimeSessions {
|
|
|
26402
26741
|
}
|
|
26403
26742
|
const phaseBeforeReview = context.phase;
|
|
26404
26743
|
const errorBeforeReview = context.error;
|
|
26744
|
+
const errorCodeBeforeReview = context.errorCode;
|
|
26405
26745
|
context.dispatchInFlight = true;
|
|
26406
26746
|
this.ctx.registry.setPhase(context, "starting");
|
|
26407
26747
|
await this.ctx.callbacks.primeCommandChanges(context);
|
|
@@ -26467,7 +26807,7 @@ class CodexRuntimeSessions {
|
|
|
26467
26807
|
});
|
|
26468
26808
|
}
|
|
26469
26809
|
if (context.phase === "starting") {
|
|
26470
|
-
this.ctx.registry.setPhase(context, phaseBeforeReview, errorBeforeReview);
|
|
26810
|
+
this.ctx.registry.setPhase(context, phaseBeforeReview, errorBeforeReview, errorCodeBeforeReview);
|
|
26471
26811
|
}
|
|
26472
26812
|
this.lifecycle.emitStatus(context);
|
|
26473
26813
|
const message = error instanceof Error ? error.message : "Native review failed";
|
|
@@ -26558,7 +26898,7 @@ class CodexRuntimeSessions {
|
|
|
26558
26898
|
try {
|
|
26559
26899
|
turns = (await this.ctx.options.engine.readThread(context.threadId, { includeTurns: true }))?.turns;
|
|
26560
26900
|
} catch (error) {
|
|
26561
|
-
|
|
26901
|
+
log14.warn("thread.turns-read-after-revert-failed", {
|
|
26562
26902
|
threadId: context.threadId,
|
|
26563
26903
|
error: formatLogError(error, { stack: false })
|
|
26564
26904
|
});
|
|
@@ -26659,7 +26999,7 @@ class CodexRuntimeSessions {
|
|
|
26659
26999
|
}
|
|
26660
27000
|
} catch (error) {
|
|
26661
27001
|
await restoreEngineConfig();
|
|
26662
|
-
|
|
27002
|
+
log14.warn("session.config-apply-failed", {
|
|
26663
27003
|
sessionId,
|
|
26664
27004
|
error: formatLogError(error, { stack: false })
|
|
26665
27005
|
});
|
|
@@ -26702,7 +27042,7 @@ class CodexRuntimeSessions {
|
|
|
26702
27042
|
try {
|
|
26703
27043
|
context = await this.ctx.callbacks.ensureAttached(sessionId);
|
|
26704
27044
|
} catch (error) {
|
|
26705
|
-
|
|
27045
|
+
log14.warn("transcript.serving-last-known", {
|
|
26706
27046
|
sessionId,
|
|
26707
27047
|
error: formatLogError(error, { stack: false })
|
|
26708
27048
|
});
|
|
@@ -26786,6 +27126,7 @@ class CodexRuntimeSessions {
|
|
|
26786
27126
|
phase,
|
|
26787
27127
|
title: session.titleSource === "prompt" ? undefined : session.title,
|
|
26788
27128
|
error,
|
|
27129
|
+
...phase === "failed" && error !== undefined && context?.errorCode === "usageLimitExceeded" ? { errorCode: USAGE_LIMIT_ERROR_CODE } : {},
|
|
26789
27130
|
...phase === "failed" && session.restartFailure && error === CODEX_RESTARTED_MID_TURN_MESSAGE ? {
|
|
26790
27131
|
interruption: "restart",
|
|
26791
27132
|
...interruptedRequestId ? { interruptedRequestId } : {}
|
|
@@ -26904,7 +27245,7 @@ class CodexRuntimeSessions {
|
|
|
26904
27245
|
}
|
|
26905
27246
|
return "unpublished";
|
|
26906
27247
|
}
|
|
26907
|
-
|
|
27248
|
+
log14.warn("registry.persist-failed", { error: formatLogError(error, { stack: false }) });
|
|
26908
27249
|
}
|
|
26909
27250
|
if (this.ctx.registry.getSession(sessionId) !== session)
|
|
26910
27251
|
return "released";
|
|
@@ -26998,7 +27339,7 @@ class CodexRuntimeSessions {
|
|
|
26998
27339
|
}
|
|
26999
27340
|
}
|
|
27000
27341
|
// ../../bridges/codex-bridge/src/app-server-runtime-approvals.ts
|
|
27001
|
-
var
|
|
27342
|
+
var log15 = createLogger("bridge.codex");
|
|
27002
27343
|
|
|
27003
27344
|
class CodexRuntimeApprovals {
|
|
27004
27345
|
ctx;
|
|
@@ -27089,7 +27430,7 @@ class CodexRuntimeApprovals {
|
|
|
27089
27430
|
if (this.ctx.options.engine.resolveApproval(approvalId, decision)) {
|
|
27090
27431
|
if (decision === "cancel") {
|
|
27091
27432
|
this.ctx.callbacks.abort(sessionId).catch((error) => {
|
|
27092
|
-
|
|
27433
|
+
log15.error("approval.cancel-failed", { error: formatLogError(error) });
|
|
27093
27434
|
});
|
|
27094
27435
|
}
|
|
27095
27436
|
return "applied";
|
|
@@ -27210,7 +27551,7 @@ function parseCommandToken(text, sigils = ["/"]) {
|
|
|
27210
27551
|
}
|
|
27211
27552
|
|
|
27212
27553
|
// ../../bridges/codex-bridge/src/prompts/template-discovery.ts
|
|
27213
|
-
import { createHash as
|
|
27554
|
+
import { createHash as createHash14 } from "node:crypto";
|
|
27214
27555
|
import { open as open10, readdir as readdir3, stat as stat8 } from "node:fs/promises";
|
|
27215
27556
|
import { join as join21 } from "node:path";
|
|
27216
27557
|
var TEMPLATE_LIMITS = Object.freeze({
|
|
@@ -27243,7 +27584,7 @@ function templateBindingRevision(origin, relativePath) {
|
|
|
27243
27584
|
return commandBindingRevision(["template", origin, relativePath]);
|
|
27244
27585
|
}
|
|
27245
27586
|
function fingerprintOf(bytes) {
|
|
27246
|
-
return
|
|
27587
|
+
return createHash14("sha256").update(bytes).digest("hex").slice(0, 32);
|
|
27247
27588
|
}
|
|
27248
27589
|
function nameFromRelativePath(relativePath) {
|
|
27249
27590
|
return `/${relativePath.replace(/\.md$/i, "")}`;
|
|
@@ -28496,7 +28837,7 @@ class UpdateCoalescer {
|
|
|
28496
28837
|
|
|
28497
28838
|
// ../../bridges/codex-bridge/src/app-server-runtime-capacity-retry.ts
|
|
28498
28839
|
import { stat as stat9 } from "node:fs/promises";
|
|
28499
|
-
var
|
|
28840
|
+
var log16 = createLogger("bridge.codex");
|
|
28500
28841
|
|
|
28501
28842
|
class CodexCapacityRetry {
|
|
28502
28843
|
ctx;
|
|
@@ -28610,7 +28951,7 @@ class CodexCapacityRetry {
|
|
|
28610
28951
|
}
|
|
28611
28952
|
entry.stage = "starting";
|
|
28612
28953
|
const work = this.startContinuation(context, turn, entry).catch((error) => {
|
|
28613
|
-
|
|
28954
|
+
log16.error("turn.capacity-retry-failed", {
|
|
28614
28955
|
turnId: turn.turnId,
|
|
28615
28956
|
error: formatLogError(error, { stack: false })
|
|
28616
28957
|
});
|
|
@@ -28682,7 +29023,7 @@ class CodexCapacityRetry {
|
|
|
28682
29023
|
});
|
|
28683
29024
|
return;
|
|
28684
29025
|
}
|
|
28685
|
-
await this.ctx.journal.markAccepted(requestId, { threadId: context.threadId, turnId: started.turnId }).catch((error) =>
|
|
29026
|
+
await this.ctx.journal.markAccepted(requestId, { threadId: context.threadId, turnId: started.turnId }).catch((error) => log16.warn("turn.capacity-retry-journal-failed", {
|
|
28686
29027
|
requestId,
|
|
28687
29028
|
error: formatLogError(error, { stack: false })
|
|
28688
29029
|
}));
|
|
@@ -28753,7 +29094,7 @@ class CodexCapacityRetry {
|
|
|
28753
29094
|
}
|
|
28754
29095
|
|
|
28755
29096
|
// ../../bridges/codex-bridge/src/app-server-runtime-lifecycle.ts
|
|
28756
|
-
var
|
|
29097
|
+
var log17 = createLogger("bridge.codex");
|
|
28757
29098
|
function artifactConnectionToken(value) {
|
|
28758
29099
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
28759
29100
|
return;
|
|
@@ -28938,7 +29279,7 @@ class CodexRuntimeLifecycle {
|
|
|
28938
29279
|
this.ctx.registry.setPhase(existing, "recovering");
|
|
28939
29280
|
this.emitStatus(existing);
|
|
28940
29281
|
this.ctx.callbacks.scheduleRecoveryBackstop(existing);
|
|
28941
|
-
|
|
29282
|
+
log17.warn("dispatch.restore-failed", {
|
|
28942
29283
|
requestId: record.requestId,
|
|
28943
29284
|
error: formatLogError(error, { stack: false })
|
|
28944
29285
|
});
|
|
@@ -29117,7 +29458,7 @@ class CodexRuntimeLifecycle {
|
|
|
29117
29458
|
});
|
|
29118
29459
|
}));
|
|
29119
29460
|
}
|
|
29120
|
-
|
|
29461
|
+
log17.warn("thread.reattach-failed", {
|
|
29121
29462
|
threadId,
|
|
29122
29463
|
rolloutMissing: isMissingRolloutError(error),
|
|
29123
29464
|
error: formatLogError(error, { stack: false })
|
|
@@ -29198,7 +29539,7 @@ class CodexRuntimeLifecycle {
|
|
|
29198
29539
|
coalescer: new UpdateCoalescer({
|
|
29199
29540
|
intervalMs: this.ctx.options.coalesceIntervalMs ?? (() => messageSnapshotIntervalMs(this.ctx.threadState.get(threadId)?.lastPublishedSnapshotChars ?? 0)),
|
|
29200
29541
|
publish: () => this.ctx.callbacks.publishAssistantMessage(threadId),
|
|
29201
|
-
onError: (error) =>
|
|
29542
|
+
onError: (error) => log17.error("message.publish-failed", { error: formatLogError(error) })
|
|
29202
29543
|
})
|
|
29203
29544
|
};
|
|
29204
29545
|
this.ctx.threadState.set(threadId, state);
|
|
@@ -29234,7 +29575,7 @@ class CodexRuntimeLifecycle {
|
|
|
29234
29575
|
this.ctx.commandCatalogue.withdrawGeneration(event.generation);
|
|
29235
29576
|
const recovery = this.ctx.generationRecovery.then(() => this.ctx.callbacks.recoverAfterGenerationChange(event.generation));
|
|
29236
29577
|
this.ctx.generationRecovery = recovery.catch((error) => {
|
|
29237
|
-
|
|
29578
|
+
log17.error("generation.recovery-failed", { error: formatLogError(error) });
|
|
29238
29579
|
});
|
|
29239
29580
|
return;
|
|
29240
29581
|
}
|
|
@@ -29254,7 +29595,7 @@ class CodexRuntimeLifecycle {
|
|
|
29254
29595
|
}
|
|
29255
29596
|
if (event.kind === "account.reload.requested") {
|
|
29256
29597
|
this.ctx.callbacks.reloadStoredAccountLogin().catch((error) => {
|
|
29257
|
-
|
|
29598
|
+
log17.warn("account.login-reload-failed", { error: formatLogError(error, { stack: false }) });
|
|
29258
29599
|
});
|
|
29259
29600
|
return;
|
|
29260
29601
|
}
|
|
@@ -29557,7 +29898,7 @@ class CodexRuntimeLifecycle {
|
|
|
29557
29898
|
}
|
|
29558
29899
|
this.ctx.options.changeEvidence?.turn(this.evidenceSource(context, turn), event.status);
|
|
29559
29900
|
const finalize = () => this.runFinalization(context, turn).catch((error) => {
|
|
29560
|
-
|
|
29901
|
+
log17.error("turn.finalize-failed", {
|
|
29561
29902
|
turnId: turn.turnId,
|
|
29562
29903
|
error: formatLogError(error, { stack: false })
|
|
29563
29904
|
});
|
|
@@ -29775,7 +30116,7 @@ class CodexRuntimeLifecycle {
|
|
|
29775
30116
|
}
|
|
29776
30117
|
trackCommandChangeWork(work) {
|
|
29777
30118
|
const tracked = work.catch((error) => {
|
|
29778
|
-
|
|
30119
|
+
log17.warn("command-changes.record-failed", { error: formatLogError(error, { stack: false }) });
|
|
29779
30120
|
});
|
|
29780
30121
|
this.ctx.pendingCommandChanges.add(tracked);
|
|
29781
30122
|
tracked.finally(() => this.ctx.pendingCommandChanges.delete(tracked));
|
|
@@ -29987,6 +30328,7 @@ class CodexRuntimeLifecycle {
|
|
|
29987
30328
|
}
|
|
29988
30329
|
const phaseBeforeRebind = context.phase;
|
|
29989
30330
|
const errorBeforeRebind = context.error;
|
|
30331
|
+
const errorCodeBeforeRebind = context.errorCode;
|
|
29990
30332
|
const turn = context.activeTurn;
|
|
29991
30333
|
try {
|
|
29992
30334
|
if (!context.materialized) {
|
|
@@ -30012,7 +30354,7 @@ class CodexRuntimeLifecycle {
|
|
|
30012
30354
|
context.unsubscribed = false;
|
|
30013
30355
|
context.engineGeneration = generation;
|
|
30014
30356
|
if (!turn) {
|
|
30015
|
-
this.ctx.registry.setPhase(context, phaseBeforeRebind === "failed" ? "failed" : "idle", phaseBeforeRebind === "failed" ? errorBeforeRebind : undefined);
|
|
30357
|
+
this.ctx.registry.setPhase(context, phaseBeforeRebind === "failed" ? "failed" : "idle", phaseBeforeRebind === "failed" ? errorBeforeRebind : undefined, phaseBeforeRebind === "failed" ? errorCodeBeforeRebind : undefined);
|
|
30016
30358
|
this.emitStatus(context);
|
|
30017
30359
|
continue;
|
|
30018
30360
|
}
|
|
@@ -30137,7 +30479,7 @@ class CodexRuntimeLifecycle {
|
|
|
30137
30479
|
await Promise.all(restartNoticeSessions.map((session) => this.ctx.callbacks.persistSession(session)));
|
|
30138
30480
|
}
|
|
30139
30481
|
context.activeTurn = null;
|
|
30140
|
-
this.ctx.registry.setPhase(context, turn.phase === "failed" ? "failed" : "idle", turn.error?.message);
|
|
30482
|
+
this.ctx.registry.setPhase(context, turn.phase === "failed" ? "failed" : "idle", turn.error?.message, turn.error?.code);
|
|
30141
30483
|
state.assistantMessageId = undefined;
|
|
30142
30484
|
this.ctx.callbacks.notifyThreadActivity();
|
|
30143
30485
|
for (const sessionId of context.bridgeSessionIds) {
|
|
@@ -30218,7 +30560,7 @@ class CodexRuntimeLifecycle {
|
|
|
30218
30560
|
try {
|
|
30219
30561
|
await state.coalescer.flushNow();
|
|
30220
30562
|
} catch (error) {
|
|
30221
|
-
|
|
30563
|
+
log17.error("ordered-events.flush-failed", { error: formatLogError(error) });
|
|
30222
30564
|
}
|
|
30223
30565
|
state.orderedReconcilePending = false;
|
|
30224
30566
|
for (const sessionId of this.ctx.sessionIdsForThread(threadId)) {
|
|
@@ -30237,7 +30579,7 @@ class CodexRuntimeLifecycle {
|
|
|
30237
30579
|
await state.coalescer.flushNow();
|
|
30238
30580
|
event.publish();
|
|
30239
30581
|
} catch (error) {
|
|
30240
|
-
|
|
30582
|
+
log17.error("ordered-events.publish-failed", { error: formatLogError(error) });
|
|
30241
30583
|
state.orderedEvents.length = 0;
|
|
30242
30584
|
state.orderedEventBytes = 0;
|
|
30243
30585
|
state.orderedReconcilePending = true;
|
|
@@ -30246,7 +30588,7 @@ class CodexRuntimeLifecycle {
|
|
|
30246
30588
|
}
|
|
30247
30589
|
}
|
|
30248
30590
|
} catch (error) {
|
|
30249
|
-
|
|
30591
|
+
log17.error("ordered-events.reconcile-failed", { error: formatLogError(error) });
|
|
30250
30592
|
} finally {
|
|
30251
30593
|
state.orderedEventDraining = false;
|
|
30252
30594
|
if ((state.orderedReconcilePending || state.orderedEvents.length > 0) && this.ctx.threadState.get(threadId) === state) {
|
|
@@ -30362,7 +30704,7 @@ function isTabInitialPromptRequestId(requestId) {
|
|
|
30362
30704
|
}
|
|
30363
30705
|
|
|
30364
30706
|
// ../../bridges/codex-bridge/src/app-server-runtime-prompt.ts
|
|
30365
|
-
var
|
|
30707
|
+
var log18 = createLogger("bridge.codex");
|
|
30366
30708
|
function commandRefusal(message) {
|
|
30367
30709
|
return { ok: false, status: 422, error: message, kind: "command-unavailable" };
|
|
30368
30710
|
}
|
|
@@ -31024,7 +31366,7 @@ class CodexRuntimePrompt {
|
|
|
31024
31366
|
try {
|
|
31025
31367
|
outcome = await this.ctx.options.engine.reconcileRequest(context.threadId, accumulator.providerRequestId);
|
|
31026
31368
|
} catch (error) {
|
|
31027
|
-
|
|
31369
|
+
log18.warn("dispatch.reconcile-failed", {
|
|
31028
31370
|
requestId,
|
|
31029
31371
|
threadId: context.threadId,
|
|
31030
31372
|
error: formatLogError(error, { stack: false })
|
|
@@ -31299,7 +31641,7 @@ class CodexRuntimePrompt {
|
|
|
31299
31641
|
if (this.ctx.stopping || this.shouldAbandonDrain(expectedGeneration))
|
|
31300
31642
|
return;
|
|
31301
31643
|
if (Date.now() >= deadline) {
|
|
31302
|
-
|
|
31644
|
+
log18.warn("app-server.drain-expired");
|
|
31303
31645
|
return;
|
|
31304
31646
|
}
|
|
31305
31647
|
await this.waitForThreadActivity();
|
|
@@ -31333,7 +31675,7 @@ class CodexRuntimePrompt {
|
|
|
31333
31675
|
|
|
31334
31676
|
// ../../bridges/codex-bridge/src/app-server-runtime-tail.ts
|
|
31335
31677
|
import { join as join22, relative as relative4, isAbsolute as isAbsolute11 } from "node:path";
|
|
31336
|
-
var
|
|
31678
|
+
var log19 = createLogger("bridge.codex");
|
|
31337
31679
|
|
|
31338
31680
|
class CodexRuntimeTail {
|
|
31339
31681
|
ctx;
|
|
@@ -31482,7 +31824,7 @@ class CodexRuntimeTail {
|
|
|
31482
31824
|
};
|
|
31483
31825
|
}
|
|
31484
31826
|
} catch (error) {
|
|
31485
|
-
|
|
31827
|
+
log19.warn("models.list-failed", { error: formatLogError(error, { stack: false }) });
|
|
31486
31828
|
}
|
|
31487
31829
|
return this.ctx.options.loadCachedModels();
|
|
31488
31830
|
}
|
|
@@ -31508,7 +31850,7 @@ class CodexRuntimeTail {
|
|
|
31508
31850
|
});
|
|
31509
31851
|
}
|
|
31510
31852
|
} catch (error) {
|
|
31511
|
-
|
|
31853
|
+
log19.warn("threads.list-failed", { error: formatLogError(error, { stack: false }) });
|
|
31512
31854
|
}
|
|
31513
31855
|
const archived = new Set;
|
|
31514
31856
|
try {
|
|
@@ -31593,7 +31935,7 @@ class CodexRuntimeTail {
|
|
|
31593
31935
|
else
|
|
31594
31936
|
await this.ctx.options.engine.unarchiveThread(threadId);
|
|
31595
31937
|
} catch (error) {
|
|
31596
|
-
|
|
31938
|
+
log19.warn("thread.archive-failed", {
|
|
31597
31939
|
archived,
|
|
31598
31940
|
error: formatLogError(error, { stack: false })
|
|
31599
31941
|
});
|
|
@@ -31926,7 +32268,7 @@ class AppServerRuntime {
|
|
|
31926
32268
|
}
|
|
31927
32269
|
}
|
|
31928
32270
|
|
|
31929
|
-
//
|
|
32271
|
+
// ../protocol/src/node/event-ring.ts
|
|
31930
32272
|
var DEFAULT_RING_CAPACITY = 512;
|
|
31931
32273
|
|
|
31932
32274
|
class EventRing {
|
|
@@ -31965,6 +32307,32 @@ class EventRing {
|
|
|
31965
32307
|
}
|
|
31966
32308
|
append(event) {
|
|
31967
32309
|
this.revision += 1;
|
|
32310
|
+
this.retain(event);
|
|
32311
|
+
return this.revision;
|
|
32312
|
+
}
|
|
32313
|
+
appendAt(revision, event) {
|
|
32314
|
+
this.skipTo(revision - 1);
|
|
32315
|
+
this.revision = revision;
|
|
32316
|
+
this.retain(event);
|
|
32317
|
+
}
|
|
32318
|
+
advance() {
|
|
32319
|
+
this.advanceTo(this.revision + 1);
|
|
32320
|
+
return this.revision;
|
|
32321
|
+
}
|
|
32322
|
+
advanceTo(revision) {
|
|
32323
|
+
this.skipTo(revision);
|
|
32324
|
+
this.revision = revision;
|
|
32325
|
+
}
|
|
32326
|
+
skipTo(revision) {
|
|
32327
|
+
if (!Number.isSafeInteger(revision) || revision < this.revision) {
|
|
32328
|
+
throw new RangeError("EventRing: revisions must not go backwards");
|
|
32329
|
+
}
|
|
32330
|
+
if (revision > this.revision && this.buffer.length > 0) {
|
|
32331
|
+
this.droppedEvents += this.buffer.length;
|
|
32332
|
+
this.clear();
|
|
32333
|
+
}
|
|
32334
|
+
}
|
|
32335
|
+
retain(event) {
|
|
31968
32336
|
if (this.supersede)
|
|
31969
32337
|
this.collapseSuperseded(event);
|
|
31970
32338
|
this.retainedBytes += Math.max(0, this.measureBytes(event));
|
|
@@ -31976,11 +32344,6 @@ class EventRing {
|
|
|
31976
32344
|
this.retainedBytes -= Math.max(0, this.measureBytes(removed.event));
|
|
31977
32345
|
this.droppedEvents += 1;
|
|
31978
32346
|
}
|
|
31979
|
-
return this.revision;
|
|
31980
|
-
}
|
|
31981
|
-
advance() {
|
|
31982
|
-
this.revision += 1;
|
|
31983
|
-
return this.revision;
|
|
31984
32347
|
}
|
|
31985
32348
|
collapseSuperseded(incoming) {
|
|
31986
32349
|
const supersede = this.supersede;
|
|
@@ -31991,10 +32354,11 @@ class EventRing {
|
|
|
31991
32354
|
const replacement = supersede(incoming, entry.event);
|
|
31992
32355
|
if (replacement === null)
|
|
31993
32356
|
continue;
|
|
32357
|
+
if (replacement === entry.event)
|
|
32358
|
+
return;
|
|
31994
32359
|
this.retainedBytes -= Math.max(0, this.measureBytes(entry.event));
|
|
31995
32360
|
entry.event = replacement;
|
|
31996
32361
|
this.retainedBytes += Math.max(0, this.measureBytes(replacement));
|
|
31997
|
-
return;
|
|
31998
32362
|
}
|
|
31999
32363
|
}
|
|
32000
32364
|
since(cursor) {
|
|
@@ -32089,6 +32453,7 @@ function installFatalRejectionGuard(options) {
|
|
|
32089
32453
|
const APP_PATH = /(?:^|\/)((?:apps\/(?:backend|desktop|web|web-public)|packages\/(?:protocol|cli|toolchain)|bridges\/[\w-]+|[\w-]+-bridge)\/.*)$/;
|
|
32090
32454
|
const PACKAGED_PATH = /\/((?:app\.asar(?:\.unpacked)?|resources)\/.*)$/i;
|
|
32091
32455
|
const CREDENTIALS = [
|
|
32456
|
+
{ pattern: /\bok[ab]_[A-Za-z0-9_-]{16,}/g, replacement: "[redacted]" },
|
|
32092
32457
|
{
|
|
32093
32458
|
pattern: /([a-z][a-z0-9+.-]*:\/\/)[^/\s:@]+(?::[^/\s@]*)?@/gi,
|
|
32094
32459
|
replacement: "$1[redacted]@"
|
|
@@ -32216,9 +32581,9 @@ function installFatalRejectionGuard(options) {
|
|
|
32216
32581
|
}
|
|
32217
32582
|
|
|
32218
32583
|
// ../protocol/src/node/process-failure-log.ts
|
|
32219
|
-
var
|
|
32584
|
+
var log20 = createLogger("process");
|
|
32220
32585
|
function logUnhandledRejection(reason) {
|
|
32221
|
-
|
|
32586
|
+
log20.throttled("error", "rejection.unhandled", {
|
|
32222
32587
|
error: reason,
|
|
32223
32588
|
fields: () => ({ error: formatLogError(reason, { message: false }) })
|
|
32224
32589
|
});
|
|
@@ -32243,7 +32608,7 @@ var CODEX_FALLBACK_MODEL_CATALOG = [
|
|
|
32243
32608
|
];
|
|
32244
32609
|
|
|
32245
32610
|
// ../../bridges/codex-bridge/src/models-cache.ts
|
|
32246
|
-
var
|
|
32611
|
+
var log21 = createLogger("bridge.codex");
|
|
32247
32612
|
var MODEL_REASONING_EFFORTS = new Set([
|
|
32248
32613
|
"minimal",
|
|
32249
32614
|
"low",
|
|
@@ -32390,13 +32755,13 @@ class ModelCatalogCache {
|
|
|
32390
32755
|
await this.opts.writePersistedCache(models);
|
|
32391
32756
|
}
|
|
32392
32757
|
} catch (error) {
|
|
32393
|
-
|
|
32758
|
+
log21.warn("models.refresh-failed", { error: formatLogError(error, { stack: false }) });
|
|
32394
32759
|
}
|
|
32395
32760
|
}
|
|
32396
32761
|
}
|
|
32397
32762
|
|
|
32398
32763
|
// ../../bridges/codex-bridge/src/index.ts
|
|
32399
|
-
var
|
|
32764
|
+
var log22 = createLogger("bridge.codex");
|
|
32400
32765
|
configureBridgeLogger();
|
|
32401
32766
|
var WORKFLOW_RESULT_TOOL_NAMES2 = new Set(WORKFLOW_RESULT_KINDS.map(workflowResultToolName));
|
|
32402
32767
|
function isWorkflowResultTool(value) {
|
|
@@ -32426,14 +32791,14 @@ function isScopedAgentMcp(value) {
|
|
|
32426
32791
|
var app = new Hono2;
|
|
32427
32792
|
app.onError((error, c) => {
|
|
32428
32793
|
if (error instanceof PolicyWideningRefusedError) {
|
|
32429
|
-
|
|
32794
|
+
log22.warn("session.policy-widening-refused", { widened: error.widened.join(",") });
|
|
32430
32795
|
return c.json(error.refusal(), 403);
|
|
32431
32796
|
}
|
|
32432
32797
|
if ("getResponse" in error) {
|
|
32433
32798
|
const response = error.getResponse();
|
|
32434
32799
|
return c.newResponse(response.body, response);
|
|
32435
32800
|
}
|
|
32436
|
-
|
|
32801
|
+
log22.error("http.request-failed", {
|
|
32437
32802
|
method: c.req.method,
|
|
32438
32803
|
path: c.req.path,
|
|
32439
32804
|
error: formatLogError(error)
|
|
@@ -32447,8 +32812,7 @@ function boundCodexTranscriptResponse(messages, tailMessages) {
|
|
|
32447
32812
|
}
|
|
32448
32813
|
var BRIDGE_TOKEN_ENV = "CODEX_BRIDGE_TOKEN";
|
|
32449
32814
|
var BRIDGE_ALLOWED_ORIGINS_ENV = "CODEX_BRIDGE_ALLOWED_ORIGINS";
|
|
32450
|
-
var
|
|
32451
|
-
delete process.env[BRIDGE_TOKEN_ENV];
|
|
32815
|
+
var bridgeCredential = loadBridgeCredential(BRIDGE_TOKEN_ENV);
|
|
32452
32816
|
var bridgeAuthEnabledOverrideForTesting = null;
|
|
32453
32817
|
var sseRouteTestHooks = null;
|
|
32454
32818
|
var BRIDGE_VERSION = "1.0.0";
|
|
@@ -32462,10 +32826,10 @@ function notifyObservers(event, revision) {
|
|
|
32462
32826
|
for (const observer of observers) {
|
|
32463
32827
|
try {
|
|
32464
32828
|
Promise.resolve(observer(event, revision, "{}")).catch((error) => {
|
|
32465
|
-
|
|
32829
|
+
log22.warn("sse.observer-failed", { error: formatLogError(error) });
|
|
32466
32830
|
});
|
|
32467
32831
|
} catch (error) {
|
|
32468
|
-
|
|
32832
|
+
log22.warn("sse.observer-failed", { error: formatLogError(error) });
|
|
32469
32833
|
}
|
|
32470
32834
|
}
|
|
32471
32835
|
}
|
|
@@ -32532,11 +32896,6 @@ function acquireReplayRetention() {
|
|
|
32532
32896
|
}
|
|
32533
32897
|
scheduleReplayRetentionDrop();
|
|
32534
32898
|
var CLEANUP_INTERVAL_MS = 5 * 60 * 1000;
|
|
32535
|
-
var codexRawLogDir = normalizeOptionalEnvPath("ORKESTRATOR_CODEX_RAW_LOG_DIR");
|
|
32536
|
-
function normalizeOptionalEnvPath(name) {
|
|
32537
|
-
const value = process.env[name]?.trim();
|
|
32538
|
-
return value ? value : null;
|
|
32539
|
-
}
|
|
32540
32899
|
function isBridgeAuthEnabled() {
|
|
32541
32900
|
if (bridgeAuthEnabledOverrideForTesting !== null) {
|
|
32542
32901
|
return bridgeAuthEnabledOverrideForTesting;
|
|
@@ -32544,11 +32903,7 @@ function isBridgeAuthEnabled() {
|
|
|
32544
32903
|
return !(process.env.CODEX_BRIDGE_NO_SERVER === "1" && process.env.CODEX_BRIDGE_AUTH_DISABLED_FOR_TESTING === "1");
|
|
32545
32904
|
}
|
|
32546
32905
|
function tokenMatches(candidate) {
|
|
32547
|
-
|
|
32548
|
-
return false;
|
|
32549
|
-
const expected = Buffer.from(bridgeAuthToken);
|
|
32550
|
-
const actual = Buffer.from(candidate);
|
|
32551
|
-
return expected.length === actual.length && timingSafeEqual(expected, actual);
|
|
32906
|
+
return bridgeCredential.matches(candidate);
|
|
32552
32907
|
}
|
|
32553
32908
|
function bearerToken(header) {
|
|
32554
32909
|
if (!header)
|
|
@@ -32574,33 +32929,6 @@ function isTrustedBridgeOrigin(origin) {
|
|
|
32574
32929
|
function isPublicHealthRequest(method, path) {
|
|
32575
32930
|
return method === "GET" && path === "/global/health";
|
|
32576
32931
|
}
|
|
32577
|
-
function sanitizeLogFileComponent(value) {
|
|
32578
|
-
return value.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
32579
|
-
}
|
|
32580
|
-
function normalizeLogPayload(value) {
|
|
32581
|
-
try {
|
|
32582
|
-
return JSON.parse(JSON.stringify(value));
|
|
32583
|
-
} catch {
|
|
32584
|
-
return stringifyUnknown(value);
|
|
32585
|
-
}
|
|
32586
|
-
}
|
|
32587
|
-
async function writeCodexRawLog(sessionId, entry, logDir = codexRawLogDir) {
|
|
32588
|
-
if (!logDir) {
|
|
32589
|
-
return;
|
|
32590
|
-
}
|
|
32591
|
-
try {
|
|
32592
|
-
await mkdir9(logDir, { recursive: true });
|
|
32593
|
-
const filename = `${sanitizeLogFileComponent(sessionId)}.jsonl`;
|
|
32594
|
-
await appendFile5(join23(logDir, filename), `${JSON.stringify({
|
|
32595
|
-
timestamp: new Date().toISOString(),
|
|
32596
|
-
sessionId,
|
|
32597
|
-
...entry
|
|
32598
|
-
})}
|
|
32599
|
-
`, "utf8");
|
|
32600
|
-
} catch (error) {
|
|
32601
|
-
log21.warn("raw-log.write-failed", { error: formatLogError(error) });
|
|
32602
|
-
}
|
|
32603
|
-
}
|
|
32604
32932
|
function createShutdownHandler(timer, clearTimer = clearInterval, exit = (code) => process.exit(code), stopEngine = () => stopSelectedEngine()) {
|
|
32605
32933
|
let shuttingDown = false;
|
|
32606
32934
|
return () => {
|
|
@@ -32609,12 +32937,12 @@ function createShutdownHandler(timer, clearTimer = clearInterval, exit = (code)
|
|
|
32609
32937
|
shuttingDown = true;
|
|
32610
32938
|
clearTimer(timer);
|
|
32611
32939
|
stopEngine().catch((error) => {
|
|
32612
|
-
|
|
32940
|
+
log22.warn("engine.stop-failed", { error: formatLogError(error) });
|
|
32613
32941
|
}).finally(() => exit(0));
|
|
32614
32942
|
};
|
|
32615
32943
|
}
|
|
32616
32944
|
function createParentExitHandler(interrupt, shutdown, report = (turns, ms) => {
|
|
32617
|
-
|
|
32945
|
+
log22.info("turns.stopped", { turns, elapsedMs: ms });
|
|
32618
32946
|
}) {
|
|
32619
32947
|
return async () => {
|
|
32620
32948
|
const detectedAt = performance.now();
|
|
@@ -32645,7 +32973,7 @@ function serializeSseEventData(event) {
|
|
|
32645
32973
|
...event.data
|
|
32646
32974
|
});
|
|
32647
32975
|
} catch {
|
|
32648
|
-
|
|
32976
|
+
log22.error("sse.payload-serialize-failed");
|
|
32649
32977
|
return JSON.stringify({
|
|
32650
32978
|
sessionId: event.sessionId,
|
|
32651
32979
|
error: "payload could not be serialized"
|
|
@@ -32710,7 +33038,7 @@ function emit(event) {
|
|
|
32710
33038
|
messageId = retainedMessageId(event.type, payload);
|
|
32711
33039
|
bytes = eager === null ? estimateSsePayloadBytes(payload) : Buffer.byteLength(eager, "utf8");
|
|
32712
33040
|
} catch {
|
|
32713
|
-
|
|
33041
|
+
log22.error("sse.payload-snapshot-failed");
|
|
32714
33042
|
payload = { error: "payload could not be serialized" };
|
|
32715
33043
|
eager = subscribers.size > 0 ? serializeSseEventData({ sessionId, data: payload }) : null;
|
|
32716
33044
|
messageId = undefined;
|
|
@@ -32727,10 +33055,10 @@ function emit(event) {
|
|
|
32727
33055
|
for (const subscriber of subscribers) {
|
|
32728
33056
|
try {
|
|
32729
33057
|
Promise.resolve(subscriber(event, revision, eager ?? "{}")).catch((error) => {
|
|
32730
|
-
|
|
33058
|
+
log22.warn("sse.subscriber-failed", { error: formatLogError(error) });
|
|
32731
33059
|
});
|
|
32732
33060
|
} catch (error) {
|
|
32733
|
-
|
|
33061
|
+
log22.warn("sse.subscriber-failed", { error: formatLogError(error) });
|
|
32734
33062
|
}
|
|
32735
33063
|
}
|
|
32736
33064
|
}
|
|
@@ -32757,7 +33085,7 @@ async function writePersistedBridgeCache(models) {
|
|
|
32757
33085
|
await mkdir9(bridgeCacheDir(), { recursive: true });
|
|
32758
33086
|
await writeFile6(bridgeCachePath(), JSON.stringify({ version: BRIDGE_MODEL_CACHE_VERSION, at: Date.now(), models }, null, 2));
|
|
32759
33087
|
} catch (error) {
|
|
32760
|
-
|
|
33088
|
+
log22.warn("models.cache-persist-failed", { error: formatLogError(error, { stack: false }) });
|
|
32761
33089
|
}
|
|
32762
33090
|
}
|
|
32763
33091
|
async function readCodexCliModelCache() {
|
|
@@ -32779,7 +33107,7 @@ async function fetchLiveModelsFromCli(run = execFile4, env = process.env) {
|
|
|
32779
33107
|
const models = parseModelCatalog(stdout);
|
|
32780
33108
|
return models.length > 0 ? models : null;
|
|
32781
33109
|
} catch (error) {
|
|
32782
|
-
|
|
33110
|
+
log22.warn("models.debug-read-failed", { error: formatLogError(error, { stack: false }) });
|
|
32783
33111
|
return null;
|
|
32784
33112
|
}
|
|
32785
33113
|
}
|
|
@@ -32824,7 +33152,7 @@ async function sweepIdleThreads(runtime = appServerRuntime) {
|
|
|
32824
33152
|
try {
|
|
32825
33153
|
await runtime.sweepIdle();
|
|
32826
33154
|
} catch (error) {
|
|
32827
|
-
|
|
33155
|
+
log22.warn("idle-sweep.failed", { error: formatLogError(error) });
|
|
32828
33156
|
}
|
|
32829
33157
|
}
|
|
32830
33158
|
function createCodexProcessDiagnostics(runtime = appServerRuntime) {
|
|
@@ -32860,9 +33188,9 @@ async function startSelectedEngine(env = process.env, runtime = appServerRuntime
|
|
|
32860
33188
|
}
|
|
32861
33189
|
try {
|
|
32862
33190
|
await runtime.start();
|
|
32863
|
-
|
|
33191
|
+
log22.info("engine.ready", { codexVersion: runtime.getHealth().codexVersion ?? "unknown" });
|
|
32864
33192
|
} catch (error) {
|
|
32865
|
-
|
|
33193
|
+
log22.error("engine.start-failed", { error: formatLogError(error, { stack: false }) });
|
|
32866
33194
|
}
|
|
32867
33195
|
}
|
|
32868
33196
|
var __testing = {
|
|
@@ -32900,7 +33228,6 @@ var __testing = {
|
|
|
32900
33228
|
hydrateMessagesFromPersistedSessionForTesting: hydrateMessagesFromPersistedSession,
|
|
32901
33229
|
listPersistedSessionsForCwdForTesting: listPersistedSessionsForCwd,
|
|
32902
33230
|
mergePersistedSessionMetaForTesting: mergePersistedSessionMeta,
|
|
32903
|
-
normalizeLogPayloadForTesting: normalizeLogPayload,
|
|
32904
33231
|
readPersistedBridgeCache,
|
|
32905
33232
|
readCodexCliModelCache,
|
|
32906
33233
|
readTextFileIfPresentForTesting: readTextFileIfPresent,
|
|
@@ -32911,11 +33238,10 @@ var __testing = {
|
|
|
32911
33238
|
bridgeAuthEnabledOverrideForTesting = null;
|
|
32912
33239
|
return;
|
|
32913
33240
|
}
|
|
32914
|
-
|
|
33241
|
+
bridgeCredential = bridgeCredentialFromToken(token);
|
|
32915
33242
|
bridgeAuthEnabledOverrideForTesting = true;
|
|
32916
33243
|
},
|
|
32917
33244
|
isTrustedBridgeOriginForTesting: isTrustedBridgeOrigin,
|
|
32918
|
-
sanitizeLogFileComponentForTesting: sanitizeLogFileComponent,
|
|
32919
33245
|
serializeSseEventDataForTesting: serializeSseEventData,
|
|
32920
33246
|
setSseRouteTestHooksForTesting: (hooks) => {
|
|
32921
33247
|
sseRouteTestHooks = hooks;
|
|
@@ -32933,7 +33259,6 @@ var __testing = {
|
|
|
32933
33259
|
releaseReplayRetention();
|
|
32934
33260
|
};
|
|
32935
33261
|
},
|
|
32936
|
-
writeCodexRawLogForTesting: writeCodexRawLog,
|
|
32937
33262
|
writePersistedBridgeCache
|
|
32938
33263
|
};
|
|
32939
33264
|
function startSseKeepalive(writeSSE, intervalMs = 5000, shouldSendAtActiveCadence = () => true, idleIntervalMs = 30000) {
|
|
@@ -32948,7 +33273,7 @@ function startSseKeepalive(writeSSE, intervalMs = 5000, shouldSendAtActiveCadenc
|
|
|
32948
33273
|
id: String(eventRing.latestRevision),
|
|
32949
33274
|
data: "{}"
|
|
32950
33275
|
}).catch((error) => {
|
|
32951
|
-
|
|
33276
|
+
log22.warn("sse.keepalive-failed", { error: formatLogError(error, { stack: false }) });
|
|
32952
33277
|
});
|
|
32953
33278
|
}, intervalMs);
|
|
32954
33279
|
}
|
|
@@ -33204,7 +33529,7 @@ app.get("/session/:id/usage", async (c) => {
|
|
|
33204
33529
|
return c.json({ error: "Session not found" }, 404);
|
|
33205
33530
|
return c.json({ contextUsage });
|
|
33206
33531
|
} catch (error) {
|
|
33207
|
-
|
|
33532
|
+
log22.warn("account.usage-read-failed", { error: formatLogError(error, { stack: false }) });
|
|
33208
33533
|
return c.json({ error: "Account usage is temporarily unavailable" }, 503);
|
|
33209
33534
|
}
|
|
33210
33535
|
});
|
|
@@ -33615,7 +33940,7 @@ app.get("/event/subscribe", (c) => {
|
|
|
33615
33940
|
if (!open)
|
|
33616
33941
|
return;
|
|
33617
33942
|
open = false;
|
|
33618
|
-
|
|
33943
|
+
log22.info("sse.closed", { reason });
|
|
33619
33944
|
resolveConnectionClosed();
|
|
33620
33945
|
};
|
|
33621
33946
|
const writeWhileOpen = createSerializedSseWriter(createOpenSseWriter(() => open, (event) => stream.writeSSE(event)), { onOverflow: () => failSlowSubscriber("write backlog exceeded its cap") });
|
|
@@ -33763,7 +34088,7 @@ if (parentPid !== null) {
|
|
|
33763
34088
|
startParentWatchdog({
|
|
33764
34089
|
parentPid,
|
|
33765
34090
|
onParentExit: () => {
|
|
33766
|
-
|
|
34091
|
+
log22.warn("parent.gone", { parentPid });
|
|
33767
34092
|
createParentExitHandler((budgetMs) => appServerRuntime.interruptForParentExit(budgetMs), shutdownHandler)();
|
|
33768
34093
|
}
|
|
33769
34094
|
});
|