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
|
@@ -76,6 +76,12 @@ var BACKEND_LOG_AREAS = defineLogAreas({
|
|
|
76
76
|
"startup.looped-review-pending": "Cleanup of the retired Looped Review stays pending.",
|
|
77
77
|
"notice.failed": "A background notice after a turn or prompt failed; `step` says which.",
|
|
78
78
|
"artifacts.live-unavailable": "Live interactive artifacts are unavailable.",
|
|
79
|
+
"previous-run": {
|
|
80
|
+
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.",
|
|
81
|
+
essential: true,
|
|
82
|
+
fields: { outcome: "label", ranForMs: "number", lastSeenAgoMs: "number" }
|
|
83
|
+
},
|
|
84
|
+
"health.write-failed": "A health summary row could not be written or read; the next sample retries.",
|
|
79
85
|
"shutdown.step-failed": "One part of shutdown failed and the rest went on; `step` says which.",
|
|
80
86
|
"shutdown.signal-received": {
|
|
81
87
|
description: "A signal started shutdown, which tells a clean quit from the backend being killed.",
|
|
@@ -119,7 +125,8 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
119
125
|
description: "What every long-lived bridge does the same way: its sweep and its shutdown.",
|
|
120
126
|
events: {
|
|
121
127
|
"idle-sweep.failed": "An idle sweep threw; the next tick retries.",
|
|
122
|
-
"shutdown.failed": "Releasing the bridge failed during shutdown; it still exits."
|
|
128
|
+
"shutdown.failed": "Releasing the bridge failed during shutdown; it still exits.",
|
|
129
|
+
"credential.not-hardened": "The bridge could not mark itself non-dumpable, so a same-uid process can read its memory; `reason` says why."
|
|
123
130
|
}
|
|
124
131
|
},
|
|
125
132
|
"bridge.acp": {
|
|
@@ -253,7 +260,6 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
253
260
|
"parent.gone": "The backend that launched this bridge has gone; stopping turns and shutting down.",
|
|
254
261
|
"queue.overflow": "The notification queue passed a bound and dropped its backlog.",
|
|
255
262
|
"queue.task-failed": "A task on a per-thread queue failed.",
|
|
256
|
-
"raw-log.write-failed": "Appending to the raw Codex log failed.",
|
|
257
263
|
"recorder.notice": "The notification recorder needs attention: it is on, or was asked for without its confirmation.",
|
|
258
264
|
"recorder.threw": "The notification recorder threw.",
|
|
259
265
|
"recorder.write-failed": "Writing a notification recording failed; its lines were dropped.",
|
|
@@ -459,6 +465,7 @@ var ENVIRONMENT_LOG_AREAS = defineLogAreas({
|
|
|
459
465
|
environment: {
|
|
460
466
|
description: "Environment naming, setup, status, moves, deletion and cleanup afterwards.",
|
|
461
467
|
events: {
|
|
468
|
+
"cleanup.sessions-failed": "Session metadata cleanup failed during environment deletion; deletion continues.",
|
|
462
469
|
"cleanup.branch-kept": "A deleted environment's local branch was kept, as it may hold unmerged work.",
|
|
463
470
|
"rename.failed": "Naming an environment from its pending prompt failed for the first time.",
|
|
464
471
|
"rename.still-failing": "That rename is still failing; written at the 2nd, 4th, 8th... failure.",
|
|
@@ -487,6 +494,7 @@ var ENVIRONMENT_LOG_AREAS = defineLogAreas({
|
|
|
487
494
|
"status.docker-error": "A transient Docker error stopped a status read, so the stored status is kept.",
|
|
488
495
|
"setup.clear-launch-failed": "A pending agent launch could not be cleared after setup failed.",
|
|
489
496
|
"setup.record-failure-failed": "A setup failure before its first attempt could not be recorded.",
|
|
497
|
+
"setup.tab-publish-failed": "The setup terminal's tab could not be published.",
|
|
490
498
|
"lifecycle.failed": "Starting, rebuilding or recreating an environment failed; `operation` says which.",
|
|
491
499
|
"tab-teardown.pending": "A tab's teardown failed and stays pending; the reconcile sweep retries.",
|
|
492
500
|
"tab-reconcile.skipped": "Orphaned tab reconciliation was skipped because pane layouts are unreadable.",
|
|
@@ -531,6 +539,7 @@ var GATEWAY_LOG_AREAS = defineLogAreas({
|
|
|
531
539
|
"websocket.upgrade-failed": "A WebSocket upgrade failed.",
|
|
532
540
|
"events.client-dropped": "An event-stream client buffered too much and was dropped; it reconnects and refetches.",
|
|
533
541
|
"proxy.client-disconnected": "A proxy client went away, so its upstream request was aborted.",
|
|
542
|
+
"traffic.burst": "Connections or requests spiked. Counts by source address, route class, client family, listener and registered invoke command; never request content.",
|
|
534
543
|
"throttle.suppressed": "Repeats of the throttled `site` were counted over a window, not written.",
|
|
535
544
|
"throttle.recovered": "The throttled `site` succeeded again, so its fault has cleared.",
|
|
536
545
|
"throttle.evicted": "The tracked-key limit dropped the `site`, so no recovered line follows unless it fails again."
|
|
@@ -664,6 +673,7 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
664
673
|
"native-agent": {
|
|
665
674
|
description: "Native agent sessions and what the backend reads from their bridges.",
|
|
666
675
|
events: {
|
|
676
|
+
"session.bridge-replaced-for-policy": "An idle bridge was stopped so a resume could apply the user's wider execution policy.",
|
|
667
677
|
"catalogue.outdated-bridge": "A bridge predates the command catalogue, so its commands stay unavailable.",
|
|
668
678
|
"compact.instructions-ignored": "A bridge compacted without confirming the instructions sent with /compact: it predates them.",
|
|
669
679
|
"handoff.summary-read-failed": "Change summaries could not be read for a handoff, so the carrier says they are unmeasured.",
|
|
@@ -694,6 +704,7 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
694
704
|
"turn-recovery.failed": "Recovering an incomplete turn failed.",
|
|
695
705
|
"turn-recovery.exhausted": "A turn failed again after automatic recovery and is left for the user.",
|
|
696
706
|
"turn-recovery.retrying": "An incomplete or provider-failed turn is being retried automatically.",
|
|
707
|
+
"usage-limit.notice-failed": "A usage-limit stop's outcome could not be read for its notice.",
|
|
697
708
|
"usage-limit.resend-failed": "Resending after a usage limit failed. An unknown send stays in the journal.",
|
|
698
709
|
"title.strategy-failed": "A session title strategy failed, so the next is tried. Content-free: the error can quote the prompt.",
|
|
699
710
|
...THROTTLE_LOG_EVENTS
|
|
@@ -710,6 +721,15 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
710
721
|
"recover.failed": "Goals could not be recovered at startup."
|
|
711
722
|
}
|
|
712
723
|
},
|
|
724
|
+
"native-agent.subork": {
|
|
725
|
+
description: "Suborks: the ask_agents calls a native agent makes. Content-free.",
|
|
726
|
+
events: {
|
|
727
|
+
"pass.failed": "A pass over a call failed, so a later pass retries. Counts only.",
|
|
728
|
+
"delivery.failed": "A call's answers could not be placed in the caller's mailbox yet. Error class only.",
|
|
729
|
+
"retention.failed": "An old call could not be removed.",
|
|
730
|
+
"sweep.failed": "A running call's caller could not be checked; the next sweep looks again."
|
|
731
|
+
}
|
|
732
|
+
},
|
|
713
733
|
"native-agent.opencode": {
|
|
714
734
|
description: "The OpenCode provider: its request monitor, retries and agent tools.",
|
|
715
735
|
events: {
|
|
@@ -719,7 +739,8 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
719
739
|
"coordinator-servers.unavailable": "OpenCode coordinator research servers are unavailable.",
|
|
720
740
|
"monitor.reconnecting": "The request monitor lost its stream and is reconnecting. Error class only.",
|
|
721
741
|
"worker-limit.reached": "The bounded request workers are full, so the stream restarts and a snapshot reconciles.",
|
|
722
|
-
"request.failed": "Handling a request event failed, so the stream restarts. Error class only."
|
|
742
|
+
"request.failed": "Handling a request event failed, so the stream restarts. Error class only.",
|
|
743
|
+
"credential-plugin.skipped": "A host OpenCode server started without the credential plugin, so its tools inherit its password; `reason` says why."
|
|
723
744
|
}
|
|
724
745
|
}
|
|
725
746
|
});
|
|
@@ -747,6 +768,7 @@ var PREVIEW_LOG_AREAS = defineLogAreas({
|
|
|
747
768
|
"publication.start-failed": "Private preview publication did not start.",
|
|
748
769
|
"publication.reconfigure-failed": "Preview publication could not be reconfigured.",
|
|
749
770
|
"publication.listening": "Private preview origins are listening.",
|
|
771
|
+
"publication.same-site": "The preview domain is the same site as the application; publication runs with a warning.",
|
|
750
772
|
"certificate.reloaded": "The preview certificate was reloaded.",
|
|
751
773
|
"access.revoked-close-failed": "A revoked preview resource could not be closed. Error class only.",
|
|
752
774
|
"registry.invalid-definition": "An invalid stored preview service definition was ignored.",
|
|
@@ -1055,10 +1077,19 @@ var STORAGE_LOG_AREAS = defineLogAreas({
|
|
|
1055
1077
|
"retired.turn-cleanup-pending": "Cleanup of a retired Looped Review turn did not finish and stays pending.",
|
|
1056
1078
|
"handoffs.prune-failed": "Pruning agent handoffs that nothing references failed; a later prune retries.",
|
|
1057
1079
|
"desktop-connections.malformed": "Stored desktop connection settings were malformed, so the local connection is used.",
|
|
1080
|
+
"config.restrict-mode-failed": "A config file holding provider secrets could not be set to owner-only; the backend carries on.",
|
|
1058
1081
|
"legacy-json.moved": "JSON store files written after the SQLite migration were archived, not imported.",
|
|
1059
1082
|
"legacy-json.archive-failed": "Imported JSON store files could not be archived.",
|
|
1083
|
+
"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.",
|
|
1060
1084
|
"lease.heartbeat-failed": "A held lease's heartbeat failed, which shortens the lease; the next one retries.",
|
|
1061
|
-
"scrub.
|
|
1085
|
+
"scrub.vacuum-failed": "Deleted-content page reclamation failed; the checkpoint is attempted independently.",
|
|
1086
|
+
"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.",
|
|
1087
|
+
"upkeep.vacuum-failed": "Periodic page reclamation failed; the next upkeep pass retries.",
|
|
1088
|
+
"optimize.failed": "Refreshing the query planner's statistics failed; queries still run and the next check retries.",
|
|
1089
|
+
"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.",
|
|
1090
|
+
"snapshot.top-tables-failed": "The sampled table sizes from a finished snapshot could not be saved; the snapshot stands and the next one retries.",
|
|
1091
|
+
"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.",
|
|
1092
|
+
"snapshot.ledger-failed": "The daily change-tracking ledger snapshot failed; `retryAt` says when it tries again, if known.",
|
|
1062
1093
|
...THROTTLE_LOG_EVENTS
|
|
1063
1094
|
}
|
|
1064
1095
|
}
|
|
@@ -1075,6 +1106,7 @@ var BUILD_PIPELINE_LOG_AREAS = defineLogAreas({
|
|
|
1075
1106
|
"consolidation.consume-deferred": "Consuming a review consolidation result failed; it stays pending and is retried.",
|
|
1076
1107
|
"dispatch.prepare-failed": "Attaching the agent before dispatch failed; the prompt request does the same work and answers authoritatively.",
|
|
1077
1108
|
"interaction.resolved": "A human interaction on a pipeline stage resolved. Metadata only.",
|
|
1109
|
+
"user-message.background-send-refused": "The bridge refused a queued user message during a background wait; it stays queued and is retried.",
|
|
1078
1110
|
"transcripts.migrated": "A transcript migration pass moved stage transcripts; counts only.",
|
|
1079
1111
|
"transcripts.maintenance-failed": "Migrating or sweeping stage transcripts failed; the next start retries.",
|
|
1080
1112
|
"restore.skipped": "A pipeline could not be restored at startup and was skipped.",
|
|
@@ -1112,6 +1144,8 @@ var CHANGE_TRACKING_LOG_AREAS = defineLogAreas({
|
|
|
1112
1144
|
description: "Change tracking: turn capture, evidence pulls and measurements.",
|
|
1113
1145
|
events: {
|
|
1114
1146
|
"journal-import.failed": "Importing surviving OpenCode command journals as legacy summaries failed.",
|
|
1147
|
+
"measurement-drain.failed": "Draining an owner's superseded measurements failed; the retention pass retries.",
|
|
1148
|
+
"retention.failed": "A retention pass failed partway; what it deleted stands and the next pass goes on.",
|
|
1115
1149
|
"projection.failed": "Projecting a change event onto its environment failed.",
|
|
1116
1150
|
"startup.reconcile-failed": "Reconciling change tracking at startup failed.",
|
|
1117
1151
|
"turn-start.capture-failed": "Capturing a turn's start failed, so the turn is untracked.",
|
|
@@ -1142,7 +1176,16 @@ var COORDINATOR_LOG_AREAS = defineLogAreas({
|
|
|
1142
1176
|
coordinator: {
|
|
1143
1177
|
description: "Coordinators: delegations, status wakes and their store.",
|
|
1144
1178
|
events: {
|
|
1179
|
+
...THROTTLE_LOG_EVENTS,
|
|
1145
1180
|
"delegation.open-failed": "A delegation could not be opened; `source` says for what.",
|
|
1181
|
+
"delegation.reconcile-failed": "One delegation could not be settled; the rest of the pass still ran and the next one retries.",
|
|
1182
|
+
"delegation.wake-failed": "One delegation's wake could not be delivered; the rest of the pass still ran and the next one retries.",
|
|
1183
|
+
"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.",
|
|
1184
|
+
"delegation.wake-pass-failed": "A delegation wake pass could not run; the next sweep retries.",
|
|
1185
|
+
"delegation.wake-retire-failed": "A wake that keeps failing could not be given up on; the next pass retries.",
|
|
1186
|
+
"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.",
|
|
1187
|
+
"delegation.wake-retired": "A wake kept failing and was given up on; `kind` is the last failure.",
|
|
1188
|
+
"mail.reconcile-failed": "One coordinator's mail could not be reconciled; the sweep carried on with the others.",
|
|
1146
1189
|
"deliver-now.drain-failed": "The mail delivery pass after deliverNow failed; the next sweep delivers.",
|
|
1147
1190
|
"mail.move-failed": "Mail could not move to the new main coordinator.",
|
|
1148
1191
|
"work.move-failed": "Work could not move to the main coordinator.",
|
|
@@ -1150,6 +1193,11 @@ var COORDINATOR_LOG_AREAS = defineLogAreas({
|
|
|
1150
1193
|
"wake.observe-pull-request-failed": "A pull request could not be observed for status wakes.",
|
|
1151
1194
|
"wake.observe-feature-plan-failed": "A feature plan could not be observed for status wakes.",
|
|
1152
1195
|
"wake.observe-workflow-failed": "A workflow could not be observed for status wakes.",
|
|
1196
|
+
"notice.outbox-refused": "A leaf's outbox refused a coordinator notice, so its own coordinator takes it.",
|
|
1197
|
+
"notice.start-main-failed": "A coordinator notice could not start a main coordinator; it waits for one to open.",
|
|
1198
|
+
"notice.take-back-unread": "A notice handed back from a command node found no open coordinator here.",
|
|
1199
|
+
"limit-stop.own": "A coordinator's own usage-limit stop attempted to move it off the account.",
|
|
1200
|
+
"limit-stop.notice-failed": "A usage-limit notice could not be sent; it stays in the ledger for the next attempt.",
|
|
1153
1201
|
"wake.deliver-failed": "A workflow status wake could not be delivered; the next pass retries.",
|
|
1154
1202
|
"wake.waiting-check-failed": "A waiting worker could not be checked; the next pass retries.",
|
|
1155
1203
|
"wake.resolve-report-failed": "A finished Resolve tab could not be reported.",
|
|
@@ -1180,15 +1228,15 @@ var REVIEW_LOG_AREAS = defineLogAreas({
|
|
|
1180
1228
|
review: {
|
|
1181
1229
|
description: "Multi Review workflows: scheduling, graph runs and interactive fix sessions.",
|
|
1182
1230
|
events: {
|
|
1183
|
-
"fix-tab.publish-failed": "A
|
|
1231
|
+
"fix-tab.publish-failed": "A Address Findings request was delivered but its tab could not be opened; the user is told.",
|
|
1184
1232
|
"graph-run.not-started": "A workflow's graph run did not start.",
|
|
1185
1233
|
"reconcile.scan-failed": "A reconciliation scan failed; the next scan retries.",
|
|
1186
1234
|
"graph-engine.unavailable": "The graph engine is selected but unavailable, so the bespoke engine runs.",
|
|
1187
1235
|
"graph-run.cancel-failed": "Cancelling a graph run failed; the next pass projects how it ended.",
|
|
1188
1236
|
"delete.cleanup-failed": "A cleanup step after deleting a workflow failed; stale tabs reconcile away on hydration.",
|
|
1189
|
-
"fix-session.read-failed": "Reading an interactive
|
|
1237
|
+
"fix-session.read-failed": "Reading an interactive Address Findings session's state failed.",
|
|
1190
1238
|
"fix-outcome.read-failed": "Reading an interactive fix's outcome failed; it stays pending.",
|
|
1191
|
-
"fix-usage.read-failed": "Reading
|
|
1239
|
+
"fix-usage.read-failed": "Reading an Address Findings session's token usage failed.",
|
|
1192
1240
|
"result.consume-deferred": "Consuming a workflow result failed; it stays staged and is retried.",
|
|
1193
1241
|
"failure-triage.failed": "Classifying a review package's failing tests failed; the package is sealed without the triage and says so."
|
|
1194
1242
|
}
|
|
@@ -1241,6 +1289,7 @@ var AGENT_ACCOUNTS_LOG_AREAS = defineLogAreas({
|
|
|
1241
1289
|
"agent-accounts": {
|
|
1242
1290
|
description: "Agent accounts: automatic switching, staged logins and plan usage.",
|
|
1243
1291
|
events: {
|
|
1292
|
+
"limit-stop-notice.failed": "A session's usage-limit stop could not be reported.",
|
|
1244
1293
|
"switch-notice.failed": "A notice about an automatic account switch failed; the switch stands. `audience` says whose.",
|
|
1245
1294
|
"auto-switch.check-failed": "An automatic account check failed; the next nudge retries.",
|
|
1246
1295
|
"container-sync.failed": "Handing a login or account to a container failed; `step` says which part.",
|
|
@@ -1259,8 +1308,22 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
1259
1308
|
description: "Docker containers: lifecycle, starts, staged inputs and the login files they hold.",
|
|
1260
1309
|
events: {
|
|
1261
1310
|
"portable-inputs.relay-missing": "Docker is rootless and the image predates the staged-input relay, so the container cannot read them until rebuilt.",
|
|
1311
|
+
"git-mirror.mount-unavailable": "A new container gets no project Git mirror, so its clone goes to the remote.",
|
|
1312
|
+
"git-mirror.refreshed": "A project's Git mirror was built or updated.",
|
|
1313
|
+
"git-mirror.seeded": "A project's Git mirror was built from its host checkout and only what the remote added to it.",
|
|
1314
|
+
"git-mirror.seed-skipped": "A project's host checkout could not seed its Git mirror, so the build downloads everything.",
|
|
1315
|
+
"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.",
|
|
1316
|
+
"git-mirror.low-disk": "A project's Git mirror was not updated: the disk is nearly full.",
|
|
1317
|
+
"git-mirror.oversized": "A project's repository is too large for a Git mirror, so its environments keep the blobless clone.",
|
|
1318
|
+
"git-mirror.compact-failed": "A project's Git mirror could not be compacted.",
|
|
1319
|
+
"git-mirror.state-write-failed": "A project's Git mirror could not be marked for checking.",
|
|
1320
|
+
"git-mirror.remove-failed": "A project's Git mirror could not be removed; a sweep retries.",
|
|
1321
|
+
"git-mirror.orphans-removed": "Git mirrors of removed projects were removed.",
|
|
1322
|
+
"git-mirror.clone-used": "A new environment cloned from its project's Git mirror.",
|
|
1323
|
+
"git-mirror.clone-fallback": "A new environment could not clone from its project's Git mirror and cloned from the remote.",
|
|
1262
1324
|
"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.",
|
|
1263
1325
|
"opencode.warm-incomplete": "OpenCode did not finish loading /workspace in a container.",
|
|
1326
|
+
"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.",
|
|
1264
1327
|
"lifecycle-event.reconcile-failed": "Reconciling an environment after a container start or stop event failed; the next status read retries.",
|
|
1265
1328
|
"login-keeper.pass-failed": "A Claude login keeper pass failed; the next interval retries.",
|
|
1266
1329
|
"login-keeper.refresh-failed": "Refreshing the host Claude login failed. Fixed text: CLI output can hold credentials.",
|
|
@@ -1284,6 +1347,7 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
1284
1347
|
essential: true,
|
|
1285
1348
|
fields: { staleForMs: "number" }
|
|
1286
1349
|
},
|
|
1350
|
+
"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.",
|
|
1287
1351
|
"writer-lease.not-acquired": {
|
|
1288
1352
|
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.",
|
|
1289
1353
|
essential: true,
|
|
@@ -1407,8 +1471,12 @@ var NODES_LOG_AREAS = defineLogAreas({
|
|
|
1407
1471
|
nodes: {
|
|
1408
1472
|
description: "Command nodes: links, handovers, leaf mail, ticket sync and project copies.",
|
|
1409
1473
|
events: {
|
|
1474
|
+
...THROTTLE_LOG_EVENTS,
|
|
1410
1475
|
"actions.resume-failed": "Approved actions could not be resumed; a later pass retries.",
|
|
1411
1476
|
"project-copy.notify-failed": "The coordinator could not be told a project copy finished.",
|
|
1477
|
+
"mail.return-deferred": "The leaf refused returned mail; it remains queued for retry.",
|
|
1478
|
+
"notices.take-back-failed": "A notice for this node's coordinator stayed in the outbox.",
|
|
1479
|
+
"notice.collected-retired": "A detached controller owned a notice with ambiguous delivery; retired without redelivery.",
|
|
1412
1480
|
"mail.delivery-deferred": "Leaf mail could not reach a coordinator yet.",
|
|
1413
1481
|
"command.post-step-failed": "A step after a routed command failed.",
|
|
1414
1482
|
"seed-files.incomplete": "Seed files for a leaf environment were not all copied.",
|
|
@@ -1924,6 +1992,7 @@ var WEB_SYNC_LOG_AREAS = defineLogAreas({
|
|
|
1924
1992
|
"web.read-coordinator": {
|
|
1925
1993
|
description: "The renderer's coalesced, bounded backend reads.",
|
|
1926
1994
|
events: {
|
|
1995
|
+
"poll.read-failed": "A coordinated poll's read failed; it stays on its interval.",
|
|
1927
1996
|
"listener.threw": "A read state listener threw.",
|
|
1928
1997
|
"read.settle-failed": "Applying a finished read's result threw."
|
|
1929
1998
|
}
|
|
@@ -1933,6 +2002,7 @@ var WEB_SYNC_LOG_AREAS = defineLogAreas({
|
|
|
1933
2002
|
events: {
|
|
1934
2003
|
"events.disconnected": "The main event stream dropped; it reconnects and replays.",
|
|
1935
2004
|
"terminal-stream.disconnected": "A terminal event stream dropped; it reconnects.",
|
|
2005
|
+
"relayed-stream.disconnected": "The relayed node event stream dropped; it reconnects.",
|
|
1936
2006
|
"connection-listener.failed": "A main stream connection state listener threw.",
|
|
1937
2007
|
"event-listener.failed": "A listener for a gateway event threw.",
|
|
1938
2008
|
"stream-listener.failed": "A listener for the stream-connected notice threw."
|
|
@@ -2017,6 +2087,7 @@ var TEXT_RULES = [
|
|
|
2017
2087
|
pattern: /\beyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}/g,
|
|
2018
2088
|
replacement: "[redacted]"
|
|
2019
2089
|
},
|
|
2090
|
+
{ pattern: /\bok[ab]_[A-Za-z0-9_-]{16,}/g, replacement: "[redacted]" },
|
|
2020
2091
|
{ pattern: /\bgh[pousr]_[A-Za-z0-9]{16,}/g, replacement: "[redacted]" },
|
|
2021
2092
|
{ pattern: /\bgithub_pat_[A-Za-z0-9_]{20,}/g, replacement: "[redacted]" },
|
|
2022
2093
|
{ pattern: /\b(?:sk|rk|pk)-[A-Za-z0-9_-]{12,}/g, replacement: "[redacted]" },
|
|
@@ -5193,9 +5264,6 @@ var shouldTransform = (res) => {
|
|
|
5193
5264
|
return !cacheControl || !cacheControlNoTransformRegExp.test(cacheControl);
|
|
5194
5265
|
};
|
|
5195
5266
|
|
|
5196
|
-
// ../../bridges/claude-bridge/src/index.ts
|
|
5197
|
-
import { randomBytes as randomBytes2, timingSafeEqual } from "node:crypto";
|
|
5198
|
-
|
|
5199
5267
|
// ../../bridges/claude-bridge/src/routes/health.ts
|
|
5200
5268
|
var health = new Hono2;
|
|
5201
5269
|
health.get("/health", (c) => {
|
|
@@ -5671,6 +5739,15 @@ function claudePlanWindowFromLabel(label) {
|
|
|
5671
5739
|
return known ? { id: known[0], ...known[1] } : claudeModelWeeklyWindow(model);
|
|
5672
5740
|
}
|
|
5673
5741
|
|
|
5742
|
+
// ../../bridges/claude-bridge/src/services/event-message-id.ts
|
|
5743
|
+
function eventMessageId(event) {
|
|
5744
|
+
if (event.type !== "message.updated" && event.type !== "message.patched")
|
|
5745
|
+
return;
|
|
5746
|
+
const data = event.data;
|
|
5747
|
+
const id = event.type === "message.updated" ? data?.message?.id : data?.messageId;
|
|
5748
|
+
return typeof id === "string" && id.length > 0 ? id : undefined;
|
|
5749
|
+
}
|
|
5750
|
+
|
|
5674
5751
|
// ../../bridges/claude-bridge/src/services/logger.ts
|
|
5675
5752
|
function isDebugLoggingEnabled() {
|
|
5676
5753
|
return bridgeDiagnosticsStreamEnabled("claude");
|
|
@@ -6446,11 +6523,8 @@ import { execFile } from "node:child_process";
|
|
|
6446
6523
|
import { createHash as createHash3 } from "node:crypto";
|
|
6447
6524
|
var sessions = new Map;
|
|
6448
6525
|
eventEmitter.subscribe((event) => {
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
const data = event.data;
|
|
6452
|
-
const id = event.type === "message.updated" ? data?.message?.id : data?.messageId;
|
|
6453
|
-
if (typeof id !== "string" || !event.sessionId)
|
|
6526
|
+
const id = eventMessageId(event);
|
|
6527
|
+
if (id === undefined || !event.sessionId)
|
|
6454
6528
|
return;
|
|
6455
6529
|
const session = sessions.get(event.sessionId);
|
|
6456
6530
|
if (!session || session.messages.at(-1)?.id === id)
|
|
@@ -7734,6 +7808,7 @@ var PROJECTION_FIELD_SET = new Set([
|
|
|
7734
7808
|
"asyncQuestionResponses",
|
|
7735
7809
|
"contextUsage",
|
|
7736
7810
|
"goal",
|
|
7811
|
+
"suborks",
|
|
7737
7812
|
"rateLimits",
|
|
7738
7813
|
"runtime",
|
|
7739
7814
|
"runtimeHealthAuthoritative",
|
|
@@ -7759,6 +7834,7 @@ var OPTIONAL_PROJECTION_FIELD_SET = new Set([
|
|
|
7759
7834
|
"asyncQuestionResponses",
|
|
7760
7835
|
"contextUsage",
|
|
7761
7836
|
"goal",
|
|
7837
|
+
"suborks",
|
|
7762
7838
|
"rateLimits",
|
|
7763
7839
|
"runtime",
|
|
7764
7840
|
"runtimeHealthAuthoritative",
|
|
@@ -8043,6 +8119,7 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
|
|
|
8043
8119
|
"address_multi_review",
|
|
8044
8120
|
"adopt_workflow",
|
|
8045
8121
|
"answer_worker_question",
|
|
8122
|
+
"ask_agents",
|
|
8046
8123
|
"cancel_build_pipeline",
|
|
8047
8124
|
"cancel_graph_run",
|
|
8048
8125
|
"cancel_multi_review",
|
|
@@ -8075,13 +8152,11 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
|
|
|
8075
8152
|
"launch_graph",
|
|
8076
8153
|
"launch_job",
|
|
8077
8154
|
"launch_multi_review",
|
|
8078
|
-
"launch_node_environment",
|
|
8079
8155
|
"launch_terminal",
|
|
8080
8156
|
"list_agents",
|
|
8081
8157
|
"list_environments",
|
|
8082
8158
|
"list_graph_templates",
|
|
8083
8159
|
"list_mailboxes",
|
|
8084
|
-
"list_node_environments",
|
|
8085
8160
|
"list_nodes",
|
|
8086
8161
|
"list_projects",
|
|
8087
8162
|
"list_provider_accounts",
|
|
@@ -8110,16 +8185,11 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
|
|
|
8110
8185
|
"resume_schedule",
|
|
8111
8186
|
"run_worker_command",
|
|
8112
8187
|
"send_message",
|
|
8113
|
-
"send_node_message",
|
|
8114
|
-
"send_prompt_to_node_tab",
|
|
8115
8188
|
"send_prompt_to_tab",
|
|
8116
8189
|
"set_worker_goal",
|
|
8117
8190
|
"start_build_pipeline",
|
|
8118
8191
|
"start_environment",
|
|
8119
|
-
"start_multi_review",
|
|
8120
|
-
"start_node_environment",
|
|
8121
8192
|
"stop_environment",
|
|
8122
|
-
"stop_node_environment",
|
|
8123
8193
|
"stop_worker_turn",
|
|
8124
8194
|
"switch_provider_account",
|
|
8125
8195
|
"set_account_auto_switch",
|
|
@@ -10422,6 +10492,12 @@ class ToolTracker {
|
|
|
10422
10492
|
this.tools.set(toolUseId, { ...part, toolUseId, parentTaskUseId });
|
|
10423
10493
|
}
|
|
10424
10494
|
}
|
|
10495
|
+
setSubagentModel(toolUseId, modelId) {
|
|
10496
|
+
const existing = this.tools.get(toolUseId);
|
|
10497
|
+
if (existing && existing.subagentModelId !== modelId) {
|
|
10498
|
+
this.tools.set(toolUseId, { ...existing, subagentModelId: modelId });
|
|
10499
|
+
}
|
|
10500
|
+
}
|
|
10425
10501
|
updateToolResult(toolUseId, result) {
|
|
10426
10502
|
const existing = this.tools.get(toolUseId);
|
|
10427
10503
|
if (existing) {
|
|
@@ -10743,6 +10819,11 @@ function parseMessageContent(message, toolTracker, mcpServerNames, activeTaskIds
|
|
|
10743
10819
|
const providerTimestamp = typeof message.timestamp === "string" && Number.isFinite(Date.parse(message.timestamp)) ? message.timestamp : undefined;
|
|
10744
10820
|
const recordTimestamp = providerTimestamp ?? (timestampFallback && Number.isFinite(Date.parse(timestampFallback)) ? timestampFallback : undefined);
|
|
10745
10821
|
const explicitParentTaskUseId = typeof message.parent_tool_use_id === "string" && message.parent_tool_use_id.length > 0 ? message.parent_tool_use_id : undefined;
|
|
10822
|
+
if (explicitParentTaskUseId && message.type === "assistant") {
|
|
10823
|
+
const subagentModelId = normalizeBackendModelId(message.message?.model);
|
|
10824
|
+
if (subagentModelId)
|
|
10825
|
+
toolTracker?.setSubagentModel(explicitParentTaskUseId, subagentModelId);
|
|
10826
|
+
}
|
|
10746
10827
|
const isUserRecord = message.type === "user";
|
|
10747
10828
|
const rawContent = message.message?.content;
|
|
10748
10829
|
if (typeof rawContent === "string") {
|
|
@@ -14435,6 +14516,9 @@ function claudeEvidenceTurnId(turn) {
|
|
|
14435
14516
|
|
|
14436
14517
|
// ../../bridges/claude-bridge/src/services/command-changes.ts
|
|
14437
14518
|
var commandChangeProbe = new WorkspaceChangeProbe;
|
|
14519
|
+
function discardCommandChangeWindow(toolUseId) {
|
|
14520
|
+
commandChangeProbe.discard(toolUseId);
|
|
14521
|
+
}
|
|
14438
14522
|
var COMMAND_CHANGE_HOOK_MATCHER = "^(Bash|Edit|Write|MultiEdit|NotebookEdit)$";
|
|
14439
14523
|
var COMMAND_CHANGE_HOOK_TIMEOUT_SECONDS = 60;
|
|
14440
14524
|
var MAX_CACHED_JOURNALS = 64;
|
|
@@ -14553,6 +14637,21 @@ function subagentParts(records, createdAt) {
|
|
|
14553
14637
|
}
|
|
14554
14638
|
return buildMessageParts(ordered, tracker).slice(-MAX_REHYDRATED_PARTS_PER_CALL);
|
|
14555
14639
|
}
|
|
14640
|
+
function labelSubagentModel(row, parent, records) {
|
|
14641
|
+
const index = row.parts.findIndex((part) => part.toolUseId === parent);
|
|
14642
|
+
if (index < 0 || row.parts[index].subagentModelId)
|
|
14643
|
+
return;
|
|
14644
|
+
for (let at = records.length - 1;at >= 0; at -= 1) {
|
|
14645
|
+
const record = records[at];
|
|
14646
|
+
if (record.type !== "assistant")
|
|
14647
|
+
continue;
|
|
14648
|
+
const subagentModelId = normalizeBackendModelId(record.message?.model);
|
|
14649
|
+
if (subagentModelId) {
|
|
14650
|
+
row.parts[index] = { ...row.parts[index], subagentModelId };
|
|
14651
|
+
return;
|
|
14652
|
+
}
|
|
14653
|
+
}
|
|
14654
|
+
}
|
|
14556
14655
|
async function rehydrateSubagentParts(sdk, sdkSessionId, dir, messages) {
|
|
14557
14656
|
if (typeof sdk.listSubagents !== "function" || typeof sdk.getSubagentMessages !== "function") {
|
|
14558
14657
|
return;
|
|
@@ -14576,6 +14675,7 @@ async function rehydrateSubagentParts(sdk, sdkSessionId, dir, messages) {
|
|
|
14576
14675
|
unplaced.push(entry);
|
|
14577
14676
|
continue;
|
|
14578
14677
|
}
|
|
14678
|
+
labelSubagentModel(row, entry.parent, entry.records);
|
|
14579
14679
|
if (row.parts.some((part) => part.parentTaskUseId === entry.parent))
|
|
14580
14680
|
continue;
|
|
14581
14681
|
const parts = subagentParts(entry.records, row.createdAt);
|
|
@@ -16516,6 +16616,7 @@ function captureTurnStartup(session) {
|
|
|
16516
16616
|
turnStartedAt: session.turnStartedAt,
|
|
16517
16617
|
abortController: session.abortController,
|
|
16518
16618
|
error: session.error,
|
|
16619
|
+
errorCode: session.errorCode,
|
|
16519
16620
|
interruption: session.interruption,
|
|
16520
16621
|
interruptedRequestId: session.interruptedRequestId,
|
|
16521
16622
|
lastActivity: session.lastActivity,
|
|
@@ -16575,6 +16676,7 @@ function createTurnState(session, sessionId, init) {
|
|
|
16575
16676
|
receivedPromptResult: false,
|
|
16576
16677
|
settlingResult: false,
|
|
16577
16678
|
localCommandOutputSeen: false,
|
|
16679
|
+
rateLimitRejected: false,
|
|
16578
16680
|
lastThinkingTokensEmitAt: 0,
|
|
16579
16681
|
compactedTokensBefore: undefined,
|
|
16580
16682
|
pendingPlanRejectionFeedback: null,
|
|
@@ -16689,6 +16791,7 @@ async function applyPromptPlanMode(admission, planMode) {
|
|
|
16689
16791
|
session.status = beforeStartup.status;
|
|
16690
16792
|
session.turnStartedAt = beforeStartup.turnStartedAt;
|
|
16691
16793
|
session.error = beforeStartup.error;
|
|
16794
|
+
session.errorCode = beforeStartup.errorCode;
|
|
16692
16795
|
session.interruption = beforeStartup.interruption;
|
|
16693
16796
|
session.interruptedRequestId = beforeStartup.interruptedRequestId;
|
|
16694
16797
|
session.lastActivity = beforeStartup.lastActivity;
|
|
@@ -16710,6 +16813,7 @@ async function applyPromptPlanMode(admission, planMode) {
|
|
|
16710
16813
|
function beginPromptActivity(admission) {
|
|
16711
16814
|
const { session, sessionId } = admission;
|
|
16712
16815
|
session.error = undefined;
|
|
16816
|
+
session.errorCode = undefined;
|
|
16713
16817
|
session.interruption = undefined;
|
|
16714
16818
|
session.interruptedRequestId = undefined;
|
|
16715
16819
|
session.lastActivity = new Date;
|
|
@@ -19005,6 +19109,24 @@ function createStaleMcpServerHook(mcp) {
|
|
|
19005
19109
|
};
|
|
19006
19110
|
}
|
|
19007
19111
|
|
|
19112
|
+
// ../protocol/src/suborks.ts
|
|
19113
|
+
var SUBORK_TOOL_NAME = "ask_agents";
|
|
19114
|
+
var AGENT_SUBORK_TOOL_NAMES = Object.freeze([SUBORK_TOOL_NAME]);
|
|
19115
|
+
var SUBORK_LIMITS = Object.freeze({
|
|
19116
|
+
targetsPerCall: 4,
|
|
19117
|
+
activePerSession: 8,
|
|
19118
|
+
totalPerSession: 64,
|
|
19119
|
+
retainedBatchesPerSession: 16,
|
|
19120
|
+
promptMaxBytes: 64 * 1024,
|
|
19121
|
+
nameMaxChars: 80,
|
|
19122
|
+
targetTextMaxChars: 200,
|
|
19123
|
+
storedAnswerMaxBytes: 64 * 1024,
|
|
19124
|
+
deliveredAnswersMaxBytes: AGENT_MAIL_MAX_BODY_BYTES - 2 * 1024,
|
|
19125
|
+
lineMaxChars: 240,
|
|
19126
|
+
errorMaxChars: 1024,
|
|
19127
|
+
deadlineMs: 45 * 60000
|
|
19128
|
+
});
|
|
19129
|
+
|
|
19008
19130
|
// ../../bridges/claude-bridge/src/services/session-manager-prompt-query.ts
|
|
19009
19131
|
import { createHash as createHash11 } from "node:crypto";
|
|
19010
19132
|
|
|
@@ -19022,6 +19144,7 @@ var WORKFLOW_RESULT_KINDS = [
|
|
|
19022
19144
|
"fix-result",
|
|
19023
19145
|
"verification-result",
|
|
19024
19146
|
"pr-result",
|
|
19147
|
+
"subork-answer",
|
|
19025
19148
|
"graph-output",
|
|
19026
19149
|
"graph-template"
|
|
19027
19150
|
];
|
|
@@ -19037,7 +19160,8 @@ var WORKFLOW_RESULT_TOOL_NAMES = {
|
|
|
19037
19160
|
"verification-result": "submit_verification_result",
|
|
19038
19161
|
"pr-result": "submit_pr_result",
|
|
19039
19162
|
"graph-output": "submit_graph_output",
|
|
19040
|
-
"graph-template": "submit_graph_template"
|
|
19163
|
+
"graph-template": "submit_graph_template",
|
|
19164
|
+
"subork-answer": "submit_subork_answer"
|
|
19041
19165
|
};
|
|
19042
19166
|
var WORKFLOW_RESULT_VALIDATION_TOOL_NAME = "validate_workflow_result";
|
|
19043
19167
|
var REPORT_FINDING_TOOL_NAME = "report_finding";
|
|
@@ -19255,10 +19379,178 @@ function claudeArtifactServerTools(servers) {
|
|
|
19255
19379
|
import { open as open3, realpath as realpath3 } from "node:fs/promises";
|
|
19256
19380
|
import { join as join14, relative as relative2, isAbsolute as isAbsolute4 } from "node:path";
|
|
19257
19381
|
|
|
19382
|
+
// ../protocol/src/rich-content-policy.ts
|
|
19383
|
+
var KIB = 1024;
|
|
19384
|
+
var MIB = 1024 * KIB;
|
|
19385
|
+
var CODE_BLOCK_POLICY = {
|
|
19386
|
+
maxHighlightBytes: 32 * KIB,
|
|
19387
|
+
maxHighlightLines: 2000,
|
|
19388
|
+
initialVisualLines: 24
|
|
19389
|
+
};
|
|
19390
|
+
var MERMAID_POLICY = {
|
|
19391
|
+
maxSourceBytes: 32 * KIB,
|
|
19392
|
+
maxEdges: 250,
|
|
19393
|
+
maxSvgBytes: 1 * MIB,
|
|
19394
|
+
maxSvgElements: 5000,
|
|
19395
|
+
renderTimeoutMs: 5000
|
|
19396
|
+
};
|
|
19397
|
+
var CHART_POLICY = {
|
|
19398
|
+
maxPayloadBytes: 256 * KIB,
|
|
19399
|
+
maxSeries: 6,
|
|
19400
|
+
maxBarCategories: 100,
|
|
19401
|
+
maxCartesianPoints: 2000,
|
|
19402
|
+
maxDonutSlices: 24,
|
|
19403
|
+
maxTitleCharacters: 200,
|
|
19404
|
+
maxLabelCharacters: 200,
|
|
19405
|
+
maxDescriptionCharacters: 2000,
|
|
19406
|
+
maxSourceNotes: 8,
|
|
19407
|
+
maxSourceNoteCharacters: 500,
|
|
19408
|
+
maxIdCharacters: 64,
|
|
19409
|
+
maxUnitCharacters: 32,
|
|
19410
|
+
maxAbsoluteValue: 1000000000000000,
|
|
19411
|
+
maxJsonDepth: 16
|
|
19412
|
+
};
|
|
19413
|
+
var WORKFLOW_SNAPSHOT_POLICY = {
|
|
19414
|
+
maxNormalizedBytes: 256 * KIB,
|
|
19415
|
+
maxNodes: 200,
|
|
19416
|
+
maxEdges: 400,
|
|
19417
|
+
maxIdCharacters: 128,
|
|
19418
|
+
maxLabelCharacters: 200,
|
|
19419
|
+
maxDescriptionCharacters: 2000,
|
|
19420
|
+
maxRawStatusCharacters: 100,
|
|
19421
|
+
maxLinksPerNode: 8
|
|
19422
|
+
};
|
|
19423
|
+
var STATIC_HTML_POLICY = {
|
|
19424
|
+
maxSourceBytes: 256 * KIB,
|
|
19425
|
+
maxPreparedBytes: 16 * MIB,
|
|
19426
|
+
maxElements: 5000
|
|
19427
|
+
};
|
|
19428
|
+
var STATIC_PRESENTATION_POLICY = {
|
|
19429
|
+
maxDocumentBytes: STATIC_HTML_POLICY.maxSourceBytes,
|
|
19430
|
+
maxElements: STATIC_HTML_POLICY.maxElements,
|
|
19431
|
+
maxFramesPerWindow: 4,
|
|
19432
|
+
renderTimeoutMs: 15000,
|
|
19433
|
+
maxSizeChangesPerWindow: 16,
|
|
19434
|
+
sizeChangeWindowMs: 5000,
|
|
19435
|
+
maxRefusedMessages: 100,
|
|
19436
|
+
maxSearchTextCharacters: 64 * KIB,
|
|
19437
|
+
searchTextChunkCharacters: 2 * KIB
|
|
19438
|
+
};
|
|
19439
|
+
var INTERACTIVE_HTML_POLICY = {
|
|
19440
|
+
maxAuthoredBytes: 512 * KIB,
|
|
19441
|
+
maxAssets: 32,
|
|
19442
|
+
maxAssetBytesTotal: 10 * MIB,
|
|
19443
|
+
maxDependencies: 4,
|
|
19444
|
+
maxPreparedBytes: 16 * MIB,
|
|
19445
|
+
maxRuntimeElements: 1e4,
|
|
19446
|
+
maxProbeSteps: 20,
|
|
19447
|
+
maxProbeStepMs: 2000,
|
|
19448
|
+
defaultWaitVisibleMs: 1000,
|
|
19449
|
+
maxProbeTextCharacters: 1024,
|
|
19450
|
+
probeTargetPattern: /^[A-Za-z][A-Za-z0-9_-]{0,63}$/
|
|
19451
|
+
};
|
|
19452
|
+
var PREVIEW_CAPTURE_POLICY = {
|
|
19453
|
+
maxPngBytes: 8 * MIB,
|
|
19454
|
+
maxPixels: 12000000,
|
|
19455
|
+
maxDimension: 4096,
|
|
19456
|
+
minDimension: 240,
|
|
19457
|
+
maxCapturesPerReceipt: 3,
|
|
19458
|
+
defaultViewport: { width: 960, height: 640, deviceScaleFactor: 1 }
|
|
19459
|
+
};
|
|
19460
|
+
var PREVIEW_ADMISSION_POLICY = {
|
|
19461
|
+
runningPerEnvironment: 1,
|
|
19462
|
+
runningGlobal: 2,
|
|
19463
|
+
queuedPerEnvironment: 8,
|
|
19464
|
+
queuedGlobal: 16,
|
|
19465
|
+
nonterminalPerConversation: 2,
|
|
19466
|
+
queuedMetadataBytesGlobal: 8 * MIB,
|
|
19467
|
+
queueWaitMs: 15000,
|
|
19468
|
+
workerWallMs: 30000,
|
|
19469
|
+
readinessMs: 5000,
|
|
19470
|
+
operationDeadlineMs: 45000,
|
|
19471
|
+
cleanupGraceMs: 2000,
|
|
19472
|
+
workerMemoryBytes: 1024 * MIB,
|
|
19473
|
+
workerCpus: 2,
|
|
19474
|
+
workerPids: 128
|
|
19475
|
+
};
|
|
19476
|
+
var FRONTEND_RENDER_POLICY = {
|
|
19477
|
+
highlightConcurrency: 2,
|
|
19478
|
+
diagramConcurrency: 1,
|
|
19479
|
+
maxQueuedJobs: 32,
|
|
19480
|
+
maxQueuedSourceBytes: 2 * MIB,
|
|
19481
|
+
maxSettledCacheEntries: 128,
|
|
19482
|
+
maxSettledCacheBytes: 16 * MIB,
|
|
19483
|
+
maxInactiveViewStateEntries: 500,
|
|
19484
|
+
maxActiveViewStateEntries: 200,
|
|
19485
|
+
maxPinnedViewStateEntries: 50,
|
|
19486
|
+
liveExecutableHostsPerWindow: 1,
|
|
19487
|
+
imageDecodeMaxPixels: 40000000,
|
|
19488
|
+
pdfPreviewMaxPages: 100,
|
|
19489
|
+
pdfPreviewMaxBytes: 20 * MIB
|
|
19490
|
+
};
|
|
19491
|
+
var PDF_POLICY = {
|
|
19492
|
+
maxPages: 100,
|
|
19493
|
+
maxBytes: 20 * MIB,
|
|
19494
|
+
thumbnailMaxDimension: 1024,
|
|
19495
|
+
thumbnailMaxPngBytes: 4 * MIB,
|
|
19496
|
+
imageDecodeMaxPixels: 40000000,
|
|
19497
|
+
printMarginMm: 10,
|
|
19498
|
+
previewCacheEntries: 32,
|
|
19499
|
+
previewCacheBytes: 16 * MIB
|
|
19500
|
+
};
|
|
19501
|
+
var DIAGNOSTIC_POLICY = {
|
|
19502
|
+
maxPersistedEntries: 50,
|
|
19503
|
+
maxEntryBytes: 2 * KIB,
|
|
19504
|
+
maxPersistedBytes: 32 * KIB,
|
|
19505
|
+
maxToolFieldErrors: 20,
|
|
19506
|
+
maxToolDiagnosticBytes: 8 * KIB
|
|
19507
|
+
};
|
|
19508
|
+
var ARTIFACT_TOOL_POLICY = {
|
|
19509
|
+
maxResultBytes: 16 * KIB,
|
|
19510
|
+
maxSourceSliceBytes: 8 * KIB,
|
|
19511
|
+
maxTitleCharacters: 120,
|
|
19512
|
+
maxSummaryCharacters: 400,
|
|
19513
|
+
maxRequestKeyCharacters: 128,
|
|
19514
|
+
maxRepairRevisions: 2,
|
|
19515
|
+
maxTransientRetries: 2,
|
|
19516
|
+
maxUnpublishedArtifactsPerConversation: 100,
|
|
19517
|
+
maxRevisionsPerArtifact: 100,
|
|
19518
|
+
assetStoreBytesPerEnvironment: 1024 * MIB,
|
|
19519
|
+
scopeCapabilityTtlMs: 24 * 60 * 60 * 1000
|
|
19520
|
+
};
|
|
19521
|
+
var ARTIFACT_RETENTION_POLICY = {
|
|
19522
|
+
cleanupIntervalMs: 60 * 60 * 1000,
|
|
19523
|
+
abandonedStagingMs: 60 * 60 * 1000,
|
|
19524
|
+
unpublishedDraftMs: 7 * 24 * 60 * 60 * 1000,
|
|
19525
|
+
unreferencedPreviewAssetMs: 24 * 60 * 60 * 1000
|
|
19526
|
+
};
|
|
19527
|
+
var FRAME_CHANNEL_POLICY = {
|
|
19528
|
+
maxMessageBytes: 8 * KIB,
|
|
19529
|
+
messagesPerSecond: 20,
|
|
19530
|
+
burst: 40,
|
|
19531
|
+
sizeUpdatesPerSecond: 4,
|
|
19532
|
+
minInlineHeight: 120,
|
|
19533
|
+
maxInlineHeight: 1600,
|
|
19534
|
+
maxLinkCharacters: 2048,
|
|
19535
|
+
maxLinkLabelCharacters: 200
|
|
19536
|
+
};
|
|
19537
|
+
|
|
19258
19538
|
// ../protocol/src/agent-system-instructions.ts
|
|
19259
|
-
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
|
|
19539
|
+
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.";
|
|
19260
19540
|
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.";
|
|
19541
|
+
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}]";
|
|
19542
|
+
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}]}]}';
|
|
19543
|
+
var AGENT_VISUAL_OUTPUT_INSTRUCTION = [
|
|
19544
|
+
"Orkestrator displays rich visuals directly in the conversation; choose one when it helps answer the question.",
|
|
19545
|
+
`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}.`,
|
|
19546
|
+
"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.",
|
|
19547
|
+
`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.`,
|
|
19548
|
+
"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.",
|
|
19549
|
+
"Use ordinary images only for photographs, screenshots and requested image files.",
|
|
19550
|
+
"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."
|
|
19551
|
+
].join(" ");
|
|
19261
19552
|
var GENERAL_AGENT_INSTRUCTIONS = [
|
|
19553
|
+
AGENT_VISUAL_OUTPUT_INSTRUCTION,
|
|
19262
19554
|
AGENT_IMAGE_PREVIEW_INSTRUCTION,
|
|
19263
19555
|
AGENT_DOCUMENT_INSTRUCTION
|
|
19264
19556
|
];
|
|
@@ -20179,7 +20471,12 @@ async function resolveQueryPlan(turn, sdkTextPrompt, testHooks) {
|
|
|
20179
20471
|
];
|
|
20180
20472
|
const coordinatorReadOnly = isCoordinatorReadOnlyPolicy(policy);
|
|
20181
20473
|
const grantedMcpServerNames = claudeAsksForApproval(policy, options) ? [] : claudeGrantedMcpServerNames(policy, mcpServerNames);
|
|
20182
|
-
const agentMailTools = mcpServerNames.has(AGENT_MCP_SERVER_NAME) ? [
|
|
20474
|
+
const agentMailTools = mcpServerNames.has(AGENT_MCP_SERVER_NAME) ? [
|
|
20475
|
+
...AGENT_MAIL_TOOL_NAMES,
|
|
20476
|
+
...ARTIFACT_TOOL_NAMES,
|
|
20477
|
+
...AGENT_GOAL_TOOL_NAMES,
|
|
20478
|
+
...AGENT_SUBORK_TOOL_NAMES
|
|
20479
|
+
].map((name) => `mcp__${AGENT_MCP_SERVER_NAME}__${name}`) : [];
|
|
20183
20480
|
const allowedTools = coordinatorReadOnly ? claudeReadOnlyAllowedTools({
|
|
20184
20481
|
agentMcpServerNames: mcpServerNames.has(AGENT_MCP_SERVER_NAME) ? [AGENT_MCP_SERVER_NAME] : [],
|
|
20185
20482
|
policy,
|
|
@@ -20737,6 +21034,9 @@ function handlePromptSuggestion(turn, message) {
|
|
|
20737
21034
|
function handleRateLimitEvent(turn, message) {
|
|
20738
21035
|
const { session, sessionId } = turn;
|
|
20739
21036
|
const info = message.rate_limit_info;
|
|
21037
|
+
if (info?.status) {
|
|
21038
|
+
turn.rateLimitRejected = info.status === "rejected" && info.isUsingOverage !== true && info.overageInUse !== true && info.overageStatus !== "allowed" && info.overageStatus !== "allowed_warning";
|
|
21039
|
+
}
|
|
20740
21040
|
if (info) {
|
|
20741
21041
|
const nextWindows = rateLimitsFromEventInfo(info);
|
|
20742
21042
|
const nextLabels = new Set(nextWindows.map((window) => window.label));
|
|
@@ -20882,6 +21182,7 @@ function classifyUsageLimitError(text) {
|
|
|
20882
21182
|
const hint = reset?.[1]?.trim();
|
|
20883
21183
|
return hint ? { resetHint: hint } : {};
|
|
20884
21184
|
}
|
|
21185
|
+
var USAGE_LIMIT_ERROR_CODE = "usage-limit";
|
|
20885
21186
|
|
|
20886
21187
|
// ../../bridges/claude-bridge/src/services/session-manager-prompt-handlers/result.ts
|
|
20887
21188
|
var log12 = createLogger("bridge.claude");
|
|
@@ -21407,7 +21708,7 @@ function handlePermissionDenied(turn, message) {
|
|
|
21407
21708
|
const denial = message;
|
|
21408
21709
|
const reason = boundedNoticeText(denial.decision_reason ?? denial.message);
|
|
21409
21710
|
if (typeof denial.tool_use_id === "string") {
|
|
21410
|
-
|
|
21711
|
+
discardCommandChangeWindow(denial.tool_use_id);
|
|
21411
21712
|
recordClaudeToolDenied(sessionId, denial.tool_use_id, typeof denial.tool_name === "string" ? { toolName: denial.tool_name } : {});
|
|
21412
21713
|
}
|
|
21413
21714
|
const marked = typeof denial.tool_use_id === "string" && toolTracker.recordDenial(denial.tool_use_id, {
|
|
@@ -21502,7 +21803,7 @@ function handleUserMessage(turn, message) {
|
|
|
21502
21803
|
} = parseMessageContent(message, toolTracker, turn.mcpServerNames, activeTaskIds, taskRegistry, receivedAt, recordUnknownContentBlock);
|
|
21503
21804
|
const sdkUserMessage = message;
|
|
21504
21805
|
for (const toolUseId of toolResultIds(sdkUserMessage)) {
|
|
21505
|
-
|
|
21806
|
+
discardCommandChangeWindow(toolUseId);
|
|
21506
21807
|
const pending = turn.pendingCommandChanges.get(toolUseId);
|
|
21507
21808
|
if (pending) {
|
|
21508
21809
|
turn.pendingCommandChanges.delete(toolUseId);
|
|
@@ -21933,6 +22234,7 @@ function endClaudeRuntime(runtime, failure) {
|
|
|
21933
22234
|
if (interruptedOutsidePrompt) {
|
|
21934
22235
|
session.status = "error";
|
|
21935
22236
|
session.error = claudeProcessKilledMessage(killedBy);
|
|
22237
|
+
session.errorCode = undefined;
|
|
21936
22238
|
session.interruption = "restart";
|
|
21937
22239
|
session.interruptedRequestId = session.turnInFlightRequestId;
|
|
21938
22240
|
session.turnStartedAt = undefined;
|
|
@@ -21976,6 +22278,7 @@ function releaseOrphanedForeground(runtime, error) {
|
|
|
21976
22278
|
log15.error("runtime.ended-under-resumed-turn", { sessionId });
|
|
21977
22279
|
session.status = "error";
|
|
21978
22280
|
session.error = error instanceof Error ? error.message : String(error);
|
|
22281
|
+
session.errorCode = undefined;
|
|
21979
22282
|
eventEmitter.emit({ type: "session.error", sessionId, data: { error: session.error } });
|
|
21980
22283
|
}
|
|
21981
22284
|
function abandonJoin(turn, running) {
|
|
@@ -22243,6 +22546,7 @@ function settleFailedTurn(turn, error) {
|
|
|
22243
22546
|
session.turnStartedAt = turn.beforeStartup.turnStartedAt;
|
|
22244
22547
|
session.abortController = turn.beforeStartup.abortController;
|
|
22245
22548
|
session.error = turn.beforeStartup.error;
|
|
22549
|
+
session.errorCode = turn.beforeStartup.errorCode;
|
|
22246
22550
|
session.interruption = turn.beforeStartup.interruption;
|
|
22247
22551
|
session.interruptedRequestId = turn.beforeStartup.interruptedRequestId;
|
|
22248
22552
|
session.inProgressUsage = turn.beforeStartup.inProgressUsage;
|
|
@@ -22270,6 +22574,7 @@ function settleFailedTurn(turn, error) {
|
|
|
22270
22574
|
session.status = "error";
|
|
22271
22575
|
session.turnStartedAt = undefined;
|
|
22272
22576
|
session.error = failure;
|
|
22577
|
+
session.errorCode = turn.rateLimitRejected && !killedBy ? USAGE_LIMIT_ERROR_CODE : undefined;
|
|
22273
22578
|
session.interruption = killedBy ? "restart" : undefined;
|
|
22274
22579
|
session.interruptedRequestId = killedBy ? turn.dispatchRequestId : undefined;
|
|
22275
22580
|
session.abortController = undefined;
|
|
@@ -22529,6 +22834,18 @@ var config_default = config2;
|
|
|
22529
22834
|
|
|
22530
22835
|
// ../protocol/src/human-prompts.ts
|
|
22531
22836
|
var HUMAN_PROMPT_SCAN_BYTES = 16 * 1024;
|
|
22837
|
+
var HUMAN_PROMPT_KINDS = new Set([
|
|
22838
|
+
"sign-in",
|
|
22839
|
+
"device-code",
|
|
22840
|
+
"press-enter",
|
|
22841
|
+
"secret",
|
|
22842
|
+
"host-key"
|
|
22843
|
+
]);
|
|
22844
|
+
var HUMAN_PROMPT_SOURCES = new Set([
|
|
22845
|
+
"user-command",
|
|
22846
|
+
"agent-tool",
|
|
22847
|
+
"agent-background-task"
|
|
22848
|
+
]);
|
|
22532
22849
|
var HUMAN_PROMPT_OBSERVATION_ROWS = 64;
|
|
22533
22850
|
function humanPromptObservation(messages, tasks) {
|
|
22534
22851
|
const object = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
@@ -23713,6 +24030,7 @@ session.get("/:id", async (c) => {
|
|
|
23713
24030
|
createdAt: sessionData.createdAt.toISOString(),
|
|
23714
24031
|
lastActivity: sessionData.lastActivity.toISOString(),
|
|
23715
24032
|
error: sessionData.error,
|
|
24033
|
+
...sessionData.status === "error" && sessionData.errorCode ? { errorCode: sessionData.errorCode } : {},
|
|
23716
24034
|
...sessionData.status === "error" && sessionData.interruption ? {
|
|
23717
24035
|
interruption: sessionData.interruption,
|
|
23718
24036
|
...sessionData.interruptedRequestId ? { interruptedRequestId: sessionData.interruptedRequestId } : {}
|
|
@@ -24729,22 +25047,163 @@ var streamSSE = (c, cb, onError) => {
|
|
|
24729
25047
|
return c.newResponse(stream.responseReadable);
|
|
24730
25048
|
};
|
|
24731
25049
|
|
|
25050
|
+
// ../protocol/src/node/event-ring.ts
|
|
25051
|
+
var DEFAULT_RING_CAPACITY = 512;
|
|
25052
|
+
|
|
25053
|
+
class EventRing {
|
|
25054
|
+
capacity;
|
|
25055
|
+
maxBytes;
|
|
25056
|
+
measureBytes;
|
|
25057
|
+
supersede;
|
|
25058
|
+
buffer = [];
|
|
25059
|
+
revision = 0;
|
|
25060
|
+
droppedEvents = 0;
|
|
25061
|
+
retainedBytes = 0;
|
|
25062
|
+
constructor(capacity = DEFAULT_RING_CAPACITY, options = {}) {
|
|
25063
|
+
this.capacity = Math.max(1, capacity);
|
|
25064
|
+
if (options.maxBytes !== undefined && !options.measureBytes) {
|
|
25065
|
+
throw new TypeError("EventRing: maxBytes requires measureBytes");
|
|
25066
|
+
}
|
|
25067
|
+
this.maxBytes = Math.max(0, options.maxBytes ?? Number.POSITIVE_INFINITY);
|
|
25068
|
+
this.measureBytes = options.measureBytes ?? (() => 0);
|
|
25069
|
+
this.supersede = options.supersede ?? null;
|
|
25070
|
+
}
|
|
25071
|
+
get latestRevision() {
|
|
25072
|
+
return this.revision;
|
|
25073
|
+
}
|
|
25074
|
+
get oldestRevision() {
|
|
25075
|
+
return this.buffer[0]?.revision ?? 0;
|
|
25076
|
+
}
|
|
25077
|
+
getStats() {
|
|
25078
|
+
return {
|
|
25079
|
+
retained: this.buffer.length,
|
|
25080
|
+
capacity: this.capacity,
|
|
25081
|
+
latestRevision: this.revision,
|
|
25082
|
+
dropped: this.droppedEvents,
|
|
25083
|
+
retainedBytes: this.retainedBytes,
|
|
25084
|
+
maxBytes: Number.isFinite(this.maxBytes) ? this.maxBytes : null
|
|
25085
|
+
};
|
|
25086
|
+
}
|
|
25087
|
+
append(event) {
|
|
25088
|
+
this.revision += 1;
|
|
25089
|
+
this.retain(event);
|
|
25090
|
+
return this.revision;
|
|
25091
|
+
}
|
|
25092
|
+
appendAt(revision, event) {
|
|
25093
|
+
this.skipTo(revision - 1);
|
|
25094
|
+
this.revision = revision;
|
|
25095
|
+
this.retain(event);
|
|
25096
|
+
}
|
|
25097
|
+
advance() {
|
|
25098
|
+
this.advanceTo(this.revision + 1);
|
|
25099
|
+
return this.revision;
|
|
25100
|
+
}
|
|
25101
|
+
advanceTo(revision) {
|
|
25102
|
+
this.skipTo(revision);
|
|
25103
|
+
this.revision = revision;
|
|
25104
|
+
}
|
|
25105
|
+
skipTo(revision) {
|
|
25106
|
+
if (!Number.isSafeInteger(revision) || revision < this.revision) {
|
|
25107
|
+
throw new RangeError("EventRing: revisions must not go backwards");
|
|
25108
|
+
}
|
|
25109
|
+
if (revision > this.revision && this.buffer.length > 0) {
|
|
25110
|
+
this.droppedEvents += this.buffer.length;
|
|
25111
|
+
this.clear();
|
|
25112
|
+
}
|
|
25113
|
+
}
|
|
25114
|
+
retain(event) {
|
|
25115
|
+
if (this.supersede)
|
|
25116
|
+
this.collapseSuperseded(event);
|
|
25117
|
+
this.retainedBytes += Math.max(0, this.measureBytes(event));
|
|
25118
|
+
this.buffer.push({ revision: this.revision, event });
|
|
25119
|
+
while (this.buffer.length > this.capacity || this.retainedBytes > this.maxBytes) {
|
|
25120
|
+
const removed = this.buffer.shift();
|
|
25121
|
+
if (!removed)
|
|
25122
|
+
break;
|
|
25123
|
+
this.retainedBytes -= Math.max(0, this.measureBytes(removed.event));
|
|
25124
|
+
this.droppedEvents += 1;
|
|
25125
|
+
}
|
|
25126
|
+
}
|
|
25127
|
+
collapseSuperseded(incoming) {
|
|
25128
|
+
const supersede = this.supersede;
|
|
25129
|
+
if (!supersede)
|
|
25130
|
+
return;
|
|
25131
|
+
for (let index = this.buffer.length - 1;index >= 0; index -= 1) {
|
|
25132
|
+
const entry = this.buffer[index];
|
|
25133
|
+
const replacement = supersede(incoming, entry.event);
|
|
25134
|
+
if (replacement === null)
|
|
25135
|
+
continue;
|
|
25136
|
+
if (replacement === entry.event)
|
|
25137
|
+
return;
|
|
25138
|
+
this.retainedBytes -= Math.max(0, this.measureBytes(entry.event));
|
|
25139
|
+
entry.event = replacement;
|
|
25140
|
+
this.retainedBytes += Math.max(0, this.measureBytes(replacement));
|
|
25141
|
+
}
|
|
25142
|
+
}
|
|
25143
|
+
since(cursor) {
|
|
25144
|
+
if (!Number.isFinite(cursor) || cursor < 0) {
|
|
25145
|
+
return { events: [], complete: false, latestRevision: this.revision };
|
|
25146
|
+
}
|
|
25147
|
+
if (cursor > this.revision) {
|
|
25148
|
+
return { events: [], complete: false, latestRevision: this.revision };
|
|
25149
|
+
}
|
|
25150
|
+
if (cursor === this.revision) {
|
|
25151
|
+
return { events: [], complete: true, latestRevision: this.revision };
|
|
25152
|
+
}
|
|
25153
|
+
const oldest = this.oldestRevision;
|
|
25154
|
+
const complete = oldest !== 0 && cursor + 1 >= oldest;
|
|
25155
|
+
return {
|
|
25156
|
+
events: complete ? this.buffer.filter((entry) => entry.revision > cursor) : [],
|
|
25157
|
+
complete,
|
|
25158
|
+
latestRevision: this.revision
|
|
25159
|
+
};
|
|
25160
|
+
}
|
|
25161
|
+
clear() {
|
|
25162
|
+
this.buffer.length = 0;
|
|
25163
|
+
this.retainedBytes = 0;
|
|
25164
|
+
}
|
|
25165
|
+
}
|
|
25166
|
+
|
|
24732
25167
|
// ../../bridges/claude-bridge/src/routes/events.ts
|
|
24733
25168
|
var log22 = createLogger("bridge.claude");
|
|
24734
|
-
var
|
|
24735
|
-
function
|
|
24736
|
-
let
|
|
24737
|
-
if (
|
|
24738
|
-
data = JSON.stringify({
|
|
25169
|
+
var serializedEvents = new WeakMap;
|
|
25170
|
+
function serializeEvent(event) {
|
|
25171
|
+
let serialized = serializedEvents.get(event);
|
|
25172
|
+
if (serialized === undefined) {
|
|
25173
|
+
const data = JSON.stringify({
|
|
24739
25174
|
sessionId: event.sessionId,
|
|
24740
25175
|
...event.data
|
|
24741
25176
|
});
|
|
24742
|
-
|
|
25177
|
+
serialized = { data, dataBytes: Buffer.byteLength(data) };
|
|
25178
|
+
serializedEvents.set(event, serialized);
|
|
24743
25179
|
}
|
|
24744
|
-
return
|
|
25180
|
+
return serialized;
|
|
24745
25181
|
}
|
|
24746
25182
|
var MAX_PENDING_SSE_FRAMES = 1000;
|
|
24747
25183
|
var MAX_PENDING_SSE_BYTES = 16 * 1024 * 1024;
|
|
25184
|
+
var SUPERSEDED_FRAME_BYTES = 64;
|
|
25185
|
+
function supersedeReplayFrame(incoming, retained) {
|
|
25186
|
+
if (incoming.event !== "message.updated" || incoming.messageId === undefined)
|
|
25187
|
+
return null;
|
|
25188
|
+
if (retained.event !== "message.updated" && retained.event !== "message.patched")
|
|
25189
|
+
return null;
|
|
25190
|
+
if (retained.messageId !== incoming.messageId || retained.sessionId !== incoming.sessionId) {
|
|
25191
|
+
return null;
|
|
25192
|
+
}
|
|
25193
|
+
if (retained.superseded)
|
|
25194
|
+
return retained;
|
|
25195
|
+
return {
|
|
25196
|
+
revision: retained.revision,
|
|
25197
|
+
...retained.id === undefined ? {} : { id: retained.id },
|
|
25198
|
+
event: retained.event,
|
|
25199
|
+
data: "{}",
|
|
25200
|
+
dataBytes: 2,
|
|
25201
|
+
bytes: SUPERSEDED_FRAME_BYTES,
|
|
25202
|
+
...retained.sessionId === undefined ? {} : { sessionId: retained.sessionId },
|
|
25203
|
+
messageId: retained.messageId,
|
|
25204
|
+
superseded: true
|
|
25205
|
+
};
|
|
25206
|
+
}
|
|
24748
25207
|
function observationFrameData(sessionId) {
|
|
24749
25208
|
return JSON.stringify(sessionId === undefined ? {} : { sessionId });
|
|
24750
25209
|
}
|
|
@@ -24752,47 +25211,52 @@ var MAX_REPLAY_SSE_FRAMES = 512;
|
|
|
24752
25211
|
var MAX_REPLAY_SSE_BYTES = 4 * 1024 * 1024;
|
|
24753
25212
|
var REPLAY_IDLE_RETENTION_MS = 60000;
|
|
24754
25213
|
function createReplayBuffer(limits = {}) {
|
|
24755
|
-
const
|
|
24756
|
-
|
|
24757
|
-
|
|
24758
|
-
|
|
25214
|
+
const ring = new EventRing(limits.maxFrames ?? MAX_REPLAY_SSE_FRAMES, {
|
|
25215
|
+
maxBytes: limits.maxBytes ?? MAX_REPLAY_SSE_BYTES,
|
|
25216
|
+
measureBytes: (frame) => frame.bytes,
|
|
25217
|
+
supersede: supersedeReplayFrame
|
|
25218
|
+
});
|
|
24759
25219
|
return {
|
|
24760
25220
|
append(event, revision, generation) {
|
|
24761
|
-
const data =
|
|
24762
|
-
const
|
|
25221
|
+
const { data, dataBytes } = serializeEvent(event);
|
|
25222
|
+
const messageId = eventMessageId(event);
|
|
25223
|
+
ring.appendAt(revision, {
|
|
24763
25224
|
revision,
|
|
24764
25225
|
id: `${generation}:${revision}`,
|
|
24765
25226
|
event: event.type,
|
|
24766
25227
|
data,
|
|
24767
|
-
|
|
24768
|
-
|
|
24769
|
-
|
|
24770
|
-
|
|
24771
|
-
|
|
24772
|
-
|
|
24773
|
-
|
|
24774
|
-
|
|
24775
|
-
break;
|
|
24776
|
-
bytes -= removed.bytes;
|
|
24777
|
-
}
|
|
25228
|
+
dataBytes,
|
|
25229
|
+
bytes: dataBytes + Buffer.byteLength(event.type),
|
|
25230
|
+
...event.sessionId === undefined ? {} : { sessionId: event.sessionId },
|
|
25231
|
+
...messageId === undefined ? {} : { messageId }
|
|
25232
|
+
});
|
|
25233
|
+
},
|
|
25234
|
+
skip(revision) {
|
|
25235
|
+
ring.advanceTo(revision);
|
|
24778
25236
|
},
|
|
24779
25237
|
getFrames(since, through, generation) {
|
|
24780
25238
|
if (since.generation !== generation || since.revision > through) {
|
|
24781
25239
|
return { frames: [], resetRequired: true };
|
|
24782
25240
|
}
|
|
24783
|
-
|
|
24784
|
-
|
|
24785
|
-
|
|
24786
|
-
|
|
24787
|
-
resetRequired
|
|
24788
|
-
|
|
25241
|
+
if (since.revision === through)
|
|
25242
|
+
return { frames: [], resetRequired: false };
|
|
25243
|
+
const replay = ring.since(since.revision);
|
|
25244
|
+
if (!replay.complete)
|
|
25245
|
+
return { frames: [], resetRequired: true };
|
|
25246
|
+
const frames = [];
|
|
25247
|
+
for (const entry of replay.events) {
|
|
25248
|
+
if (entry.revision > through)
|
|
25249
|
+
break;
|
|
25250
|
+
frames.push(entry.event);
|
|
25251
|
+
}
|
|
25252
|
+
return { frames, resetRequired: false };
|
|
24789
25253
|
},
|
|
24790
25254
|
clear() {
|
|
24791
|
-
|
|
24792
|
-
bytes = 0;
|
|
25255
|
+
ring.clear();
|
|
24793
25256
|
},
|
|
24794
25257
|
stats() {
|
|
24795
|
-
|
|
25258
|
+
const stats = ring.getStats();
|
|
25259
|
+
return { frames: stats.retained, bytes: stats.retainedBytes };
|
|
24796
25260
|
}
|
|
24797
25261
|
};
|
|
24798
25262
|
}
|
|
@@ -24845,8 +25309,10 @@ function formatReplayCursor(revision) {
|
|
|
24845
25309
|
return `${eventEmitter.generation}:${revision}`;
|
|
24846
25310
|
}
|
|
24847
25311
|
eventEmitter.subscribe((event, revision) => {
|
|
24848
|
-
if (!replayRetention.shouldRetain())
|
|
25312
|
+
if (!replayRetention.shouldRetain()) {
|
|
25313
|
+
replayBuffer.skip(revision);
|
|
24849
25314
|
return;
|
|
25315
|
+
}
|
|
24850
25316
|
replayBuffer.append(event, revision, eventEmitter.generation);
|
|
24851
25317
|
});
|
|
24852
25318
|
function parseReplayCursor(value) {
|
|
@@ -24876,7 +25342,7 @@ function createBoundedSseWriter(write, onOverflow, limits = {}) {
|
|
|
24876
25342
|
return (frame) => {
|
|
24877
25343
|
if (overflowed)
|
|
24878
25344
|
return Promise.resolve();
|
|
24879
|
-
const frameBytes = Buffer.byteLength(frame.data);
|
|
25345
|
+
const frameBytes = frame.dataBytes ?? Buffer.byteLength(frame.data);
|
|
24880
25346
|
if (pendingFrames > 0 && (pendingFrames >= maxPendingFrames || pendingBytes + frameBytes > maxPendingBytes)) {
|
|
24881
25347
|
overflowed = true;
|
|
24882
25348
|
onOverflow();
|
|
@@ -24957,13 +25423,21 @@ function createEventsRouter(limits = {}) {
|
|
|
24957
25423
|
unsubscribe = eventEmitter.subscribe((event, revision) => {
|
|
24958
25424
|
if (!isOpen)
|
|
24959
25425
|
return;
|
|
24960
|
-
|
|
25426
|
+
let data;
|
|
25427
|
+
let dataBytes;
|
|
25428
|
+
if (observe) {
|
|
25429
|
+
data = observationFrameData(event.sessionId);
|
|
25430
|
+
dataBytes = Buffer.byteLength(data);
|
|
25431
|
+
} else {
|
|
25432
|
+
({ data, dataBytes } = serializeEvent(event));
|
|
25433
|
+
}
|
|
24961
25434
|
const frame = {
|
|
24962
25435
|
revision,
|
|
24963
25436
|
id: formatReplayCursor(revision),
|
|
24964
25437
|
event: event.type,
|
|
24965
25438
|
data,
|
|
24966
|
-
|
|
25439
|
+
dataBytes,
|
|
25440
|
+
bytes: dataBytes + Buffer.byteLength(event.type)
|
|
24967
25441
|
};
|
|
24968
25442
|
if (replaying) {
|
|
24969
25443
|
if (pendingLiveFrames.length >= maxPendingFrames || pendingLiveBytes + frame.bytes > maxPendingBytes) {
|
|
@@ -25006,7 +25480,17 @@ function createEventsRouter(limits = {}) {
|
|
|
25006
25480
|
});
|
|
25007
25481
|
} else {
|
|
25008
25482
|
for (const frame of replay.frames) {
|
|
25009
|
-
|
|
25483
|
+
if (observe) {
|
|
25484
|
+
await writeFrame({
|
|
25485
|
+
id: frame.id,
|
|
25486
|
+
event: frame.event,
|
|
25487
|
+
data: observationFrameData(frame.sessionId)
|
|
25488
|
+
});
|
|
25489
|
+
} else if (frame.superseded) {
|
|
25490
|
+
await writeFrame({ id: frame.id, event: "bridge.cursor", data: "{}" });
|
|
25491
|
+
} else {
|
|
25492
|
+
await writeFrame(frame);
|
|
25493
|
+
}
|
|
25010
25494
|
}
|
|
25011
25495
|
}
|
|
25012
25496
|
const drained = pendingLiveFrames.splice(0);
|
|
@@ -25149,6 +25633,7 @@ function installFatalRejectionGuard(options) {
|
|
|
25149
25633
|
const APP_PATH = /(?:^|\/)((?:apps\/(?:backend|desktop|web|web-public)|packages\/(?:protocol|cli|toolchain)|bridges\/[\w-]+|[\w-]+-bridge)\/.*)$/;
|
|
25150
25634
|
const PACKAGED_PATH = /\/((?:app\.asar(?:\.unpacked)?|resources)\/.*)$/i;
|
|
25151
25635
|
const CREDENTIALS = [
|
|
25636
|
+
{ pattern: /\bok[ab]_[A-Za-z0-9_-]{16,}/g, replacement: "[redacted]" },
|
|
25152
25637
|
{
|
|
25153
25638
|
pattern: /([a-z][a-z0-9+.-]*:\/\/)[^/\s:@]+(?::[^/\s@]*)?@/gi,
|
|
25154
25639
|
replacement: "$1[redacted]@"
|
|
@@ -26768,12 +27253,79 @@ var serve = (options, listeningListener) => {
|
|
|
26768
27253
|
return server;
|
|
26769
27254
|
};
|
|
26770
27255
|
|
|
27256
|
+
// ../protocol/src/node/bridge-credential.ts
|
|
27257
|
+
import { createHash as createHash13, randomBytes as randomBytes2, timingSafeEqual } from "node:crypto";
|
|
27258
|
+
import { createRequire } from "node:module";
|
|
27259
|
+
var BRIDGE_TOKEN_PREFIX = "okb_";
|
|
27260
|
+
var PR_SET_DUMPABLE = 4;
|
|
27261
|
+
var VERIFIER_PATTERN = /^[0-9a-f]{64}$/;
|
|
27262
|
+
var log26 = createLogger("bridge.lifecycle");
|
|
27263
|
+
function mintBridgeToken() {
|
|
27264
|
+
return `${BRIDGE_TOKEN_PREFIX}${randomBytes2(32).toString("base64url")}`;
|
|
27265
|
+
}
|
|
27266
|
+
function bridgeTokenVerifier(token) {
|
|
27267
|
+
return createHash13("sha256").update(token).digest("hex");
|
|
27268
|
+
}
|
|
27269
|
+
function bridgeTokenVerifierEnv(tokenEnv) {
|
|
27270
|
+
return `${tokenEnv}_SHA256`;
|
|
27271
|
+
}
|
|
27272
|
+
function credentialFromVerifier(verifier, plainToken) {
|
|
27273
|
+
const expected = Buffer.from(verifier, "hex");
|
|
27274
|
+
return {
|
|
27275
|
+
plainToken,
|
|
27276
|
+
matches(candidate) {
|
|
27277
|
+
if (!candidate)
|
|
27278
|
+
return false;
|
|
27279
|
+
return timingSafeEqual(expected, createHash13("sha256").update(candidate).digest());
|
|
27280
|
+
}
|
|
27281
|
+
};
|
|
27282
|
+
}
|
|
27283
|
+
function bridgeCredentialFromToken(token) {
|
|
27284
|
+
return credentialFromVerifier(bridgeTokenVerifier(token), token);
|
|
27285
|
+
}
|
|
27286
|
+
function markProcessNonDumpable(loadFfi = () => createRequire(import.meta.url)("bun:ffi")) {
|
|
27287
|
+
if (process.platform !== "linux" || !process.versions.bun)
|
|
27288
|
+
return false;
|
|
27289
|
+
try {
|
|
27290
|
+
const { dlopen, FFIType } = loadFfi();
|
|
27291
|
+
const libc = dlopen("libc.so.6", {
|
|
27292
|
+
prctl: {
|
|
27293
|
+
args: [FFIType.i32, FFIType.u64, FFIType.u64, FFIType.u64, FFIType.u64],
|
|
27294
|
+
returns: FFIType.i32
|
|
27295
|
+
}
|
|
27296
|
+
});
|
|
27297
|
+
try {
|
|
27298
|
+
if (libc.symbols.prctl(PR_SET_DUMPABLE, 0n, 0n, 0n, 0n) === 0)
|
|
27299
|
+
return true;
|
|
27300
|
+
} finally {
|
|
27301
|
+
libc.close();
|
|
27302
|
+
}
|
|
27303
|
+
log26.warn("credential.not-hardened", { reason: "prctl-refused" });
|
|
27304
|
+
} catch {
|
|
27305
|
+
log26.warn("credential.not-hardened", { reason: "ffi-unavailable" });
|
|
27306
|
+
}
|
|
27307
|
+
return false;
|
|
27308
|
+
}
|
|
27309
|
+
function loadBridgeCredential(tokenEnv, options = {}) {
|
|
27310
|
+
const env = options.env ?? process.env;
|
|
27311
|
+
const verifierEnv = bridgeTokenVerifierEnv(tokenEnv);
|
|
27312
|
+
const verifier = env[verifierEnv]?.trim();
|
|
27313
|
+
const token = env[tokenEnv]?.trim();
|
|
27314
|
+
delete env[verifierEnv];
|
|
27315
|
+
delete env[tokenEnv];
|
|
27316
|
+
if (verifier) {
|
|
27317
|
+
(options.harden ?? markProcessNonDumpable)();
|
|
27318
|
+
return VERIFIER_PATTERN.test(verifier) ? credentialFromVerifier(verifier, undefined) : bridgeCredentialFromToken(mintBridgeToken());
|
|
27319
|
+
}
|
|
27320
|
+
return bridgeCredentialFromToken(token || mintBridgeToken());
|
|
27321
|
+
}
|
|
27322
|
+
|
|
26771
27323
|
// ../../bridges/claude-bridge/src/index.ts
|
|
26772
|
-
var
|
|
27324
|
+
var log27 = createLogger("bridge.claude");
|
|
26773
27325
|
configureBridgeLogger();
|
|
26774
27326
|
var app = new Hono2;
|
|
26775
27327
|
app.onError((error, c) => {
|
|
26776
|
-
|
|
27328
|
+
log27.error("http.request-failed", {
|
|
26777
27329
|
method: c.req.method,
|
|
26778
27330
|
path: c.req.path,
|
|
26779
27331
|
error: formatLogError(error)
|
|
@@ -26782,9 +27334,7 @@ app.onError((error, c) => {
|
|
|
26782
27334
|
});
|
|
26783
27335
|
var BRIDGE_TOKEN_ENV = "CLAUDE_BRIDGE_TOKEN";
|
|
26784
27336
|
var BRIDGE_ALLOWED_ORIGINS_ENV = "CLAUDE_BRIDGE_ALLOWED_ORIGINS";
|
|
26785
|
-
var
|
|
26786
|
-
var bridgeAuthToken = configuredBridgeAuthToken || randomBytes2(32).toString("base64url");
|
|
26787
|
-
delete process.env[BRIDGE_TOKEN_ENV];
|
|
27337
|
+
var bridgeCredential = loadBridgeCredential(BRIDGE_TOKEN_ENV);
|
|
26788
27338
|
process.env.ORKESTRATOR_NATIVE_AGENT_BRIDGE = "claude";
|
|
26789
27339
|
var bridgeAuthEnabledOverrideForTesting = null;
|
|
26790
27340
|
function isBridgeAuthEnabled() {
|
|
@@ -26794,11 +27344,7 @@ function isBridgeAuthEnabled() {
|
|
|
26794
27344
|
return !(process.env.CLAUDE_BRIDGE_NO_SERVER === "1" && process.env.CLAUDE_BRIDGE_AUTH_DISABLED_FOR_TESTING === "1");
|
|
26795
27345
|
}
|
|
26796
27346
|
function tokenMatches(candidate) {
|
|
26797
|
-
|
|
26798
|
-
return false;
|
|
26799
|
-
const expected = Buffer.from(bridgeAuthToken);
|
|
26800
|
-
const actual = Buffer.from(candidate);
|
|
26801
|
-
return expected.length === actual.length && timingSafeEqual(expected, actual);
|
|
27347
|
+
return bridgeCredential.matches(candidate);
|
|
26802
27348
|
}
|
|
26803
27349
|
function bearerToken(header) {
|
|
26804
27350
|
if (!header)
|
|
@@ -26902,7 +27448,7 @@ if (parentPid !== null) {
|
|
|
26902
27448
|
startParentWatchdog({
|
|
26903
27449
|
parentPid,
|
|
26904
27450
|
onParentExit: () => {
|
|
26905
|
-
|
|
27451
|
+
log27.warn("parent.gone", { parentPid });
|
|
26906
27452
|
process.exit(0);
|
|
26907
27453
|
}
|
|
26908
27454
|
});
|
|
@@ -26913,13 +27459,13 @@ function startBridgeServer(env = process.env, start = serve) {
|
|
|
26913
27459
|
}
|
|
26914
27460
|
const port = parseInt(env.PORT || "4097", 10);
|
|
26915
27461
|
const hostname = env.HOSTNAME || "0.0.0.0";
|
|
26916
|
-
|
|
27462
|
+
log27.debug("server.starting", { hostname, port });
|
|
26917
27463
|
const server = start({
|
|
26918
27464
|
fetch: app.fetch,
|
|
26919
27465
|
port,
|
|
26920
27466
|
hostname
|
|
26921
27467
|
});
|
|
26922
|
-
|
|
27468
|
+
log27.info("server.listening", { hostname, port });
|
|
26923
27469
|
return server;
|
|
26924
27470
|
}
|
|
26925
27471
|
var __testing = {
|
|
@@ -26929,7 +27475,7 @@ var __testing = {
|
|
|
26929
27475
|
bridgeAuthEnabledOverrideForTesting = null;
|
|
26930
27476
|
return;
|
|
26931
27477
|
}
|
|
26932
|
-
|
|
27478
|
+
bridgeCredential = bridgeCredentialFromToken(token);
|
|
26933
27479
|
bridgeAuthEnabledOverrideForTesting = true;
|
|
26934
27480
|
},
|
|
26935
27481
|
startBridgeServerForTesting: startBridgeServer
|