orkestrator 2.36.1 → 2.36.2-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +331 -23
- package/dist/main.js +7949 -3557
- package/package.json +3 -3
- package/resources/acp-bridge/dist/index.js +626 -429
- package/resources/claude-bridge/dist/index.js +540 -147
- package/resources/codex-bridge/dist/index.js +1912 -1261
- package/resources/cursor-bridge/dist/index.js +579 -42
- package/resources/cursor-bridge/runtime/install.json +1 -1
- package/resources/pi-bridge/dist/index.js +730 -103
- package/resources/pi-bridge/runtime/install.json +1 -1
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
// ../protocol/src/log-vocabulary/define.ts
|
|
2
|
+
var ESSENTIAL_ERROR_FIELDS = {
|
|
3
|
+
"error.name": "label",
|
|
4
|
+
"error.code": "label",
|
|
5
|
+
"error.errno": "number",
|
|
6
|
+
"error.syscall": "label",
|
|
7
|
+
"error.exitCode": "number",
|
|
8
|
+
"error.signal": "label",
|
|
9
|
+
"error.outputOmitted": "boolean",
|
|
10
|
+
"error.errorCount": "number"
|
|
11
|
+
};
|
|
2
12
|
var THROTTLE_LOG_EVENTS = {
|
|
3
13
|
"throttle.suppressed": "Repeats of the throttled `site` were counted over a window, not written.",
|
|
4
14
|
"throttle.recovered": "The throttled `site` succeeded again, so its fault has cleared.",
|
|
@@ -48,7 +58,11 @@ var BACKEND_LOG_AREAS = defineLogAreas({
|
|
|
48
58
|
backend: {
|
|
49
59
|
description: "The backend process: startup, background notices and shutdown.",
|
|
50
60
|
events: {
|
|
51
|
-
starting:
|
|
61
|
+
starting: {
|
|
62
|
+
description: "The backend process is starting.",
|
|
63
|
+
essential: true,
|
|
64
|
+
fields: { version: "label" }
|
|
65
|
+
},
|
|
52
66
|
"ssh-socket.resolved": "An SSH agent socket was found.",
|
|
53
67
|
"ssh-socket.missing": "No usable SSH agent socket was found.",
|
|
54
68
|
"standalone-updater.mismatch": "--standalone-updater does not match --data-dir, so self-update is off.",
|
|
@@ -63,8 +77,16 @@ var BACKEND_LOG_AREAS = defineLogAreas({
|
|
|
63
77
|
"notice.failed": "A background notice after a turn or prompt failed; `step` says which.",
|
|
64
78
|
"artifacts.live-unavailable": "Live interactive artifacts are unavailable.",
|
|
65
79
|
"shutdown.step-failed": "One part of shutdown failed and the rest went on; `step` says which.",
|
|
66
|
-
"shutdown.signal-received":
|
|
67
|
-
|
|
80
|
+
"shutdown.signal-received": {
|
|
81
|
+
description: "A signal started shutdown, which tells a clean quit from the backend being killed.",
|
|
82
|
+
essential: true,
|
|
83
|
+
fields: { signal: "label" }
|
|
84
|
+
},
|
|
85
|
+
"shutdown.finished": {
|
|
86
|
+
description: "Shutdown finished, and the process exits with `code`.",
|
|
87
|
+
essential: true,
|
|
88
|
+
fields: { code: "number" }
|
|
89
|
+
},
|
|
68
90
|
"port-policy.second-backend": "Another backend serves the default data directory, so this one avoids its ports.",
|
|
69
91
|
"port-policy.serve-on-free-port": "--tailscale-serve is on a free gateway port; pass --port with --strict-gateway-port to keep one."
|
|
70
92
|
}
|
|
@@ -107,7 +129,10 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
107
129
|
"evidence.record-failed": "Change evidence could not be recorded; the read loop carries on.",
|
|
108
130
|
"evidence.shell-record-failed": "A shell observation could not be recorded.",
|
|
109
131
|
"evidence.turn-record-failed": "Turn change evidence could not be recorded.",
|
|
132
|
+
"agent.exited": "An ACP agent process exited, with its `code` and `signal`, always at `warn`. `requested` is true when the bridge closed it normally, false for an unrequested or fault-driven exit.",
|
|
133
|
+
"http.route-failed": "An HTTP route answered 500; its error message is not logged because it can hold content.",
|
|
110
134
|
"server.listening": "The HTTP server is listening.",
|
|
135
|
+
"session.policy-widening-refused": "A request tried to widen a live session's execution policy and was refused; widened names the axes.",
|
|
111
136
|
"state.composer-reset": "A saved composer state was malformed and was reset.",
|
|
112
137
|
"state.discarded": "Saved bridge state could not be used and was discarded.",
|
|
113
138
|
"state.persist-failed": "Saving bridge state failed; a later write retries.",
|
|
@@ -161,7 +186,7 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
161
186
|
"session.created": "A session was created or recovered.",
|
|
162
187
|
"session.delete-failed": "Deleting a session failed.",
|
|
163
188
|
"session.fork-failed": "Forking a session failed.",
|
|
164
|
-
"session.policy-widening-refused": "A
|
|
189
|
+
"session.policy-widening-refused": "A request tried to widen a live session's execution policy and was refused; widened names the axes.",
|
|
165
190
|
"session.rename-failed": "Renaming a session failed.",
|
|
166
191
|
"session.resolve-failed": "A session could not be found or loaded for a request; action names the request.",
|
|
167
192
|
"session.rewind-failed": "Rewinding session files failed.",
|
|
@@ -195,6 +220,7 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
195
220
|
"app-server.exited": "app-server exited unexpectedly; the code and signal say how.",
|
|
196
221
|
"app-server.invariant-violation": "app-server asked for something its configuration forbids.",
|
|
197
222
|
"app-server.protocol-violation": "app-server wrote a line that is not valid protocol; it was ignored.",
|
|
223
|
+
"app-server.overflow-restart-failed": "Replacing the child after a notification queue overflow failed; the next request tries again.",
|
|
198
224
|
"app-server.recording": "Notification recording is on; recordings hold content.",
|
|
199
225
|
"app-server.stale-reaped": "A stale app-server left by an earlier bridge was stopped.",
|
|
200
226
|
"app-server.stderr": "Metadata of an app-server stderr line, never its content.",
|
|
@@ -225,6 +251,7 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
225
251
|
"ordered-events.publish-failed": "Publishing an ordered event failed; clients are told to rehydrate.",
|
|
226
252
|
"ordered-events.reconcile-failed": "Reconciling ordered events failed.",
|
|
227
253
|
"parent.gone": "The backend that launched this bridge has gone; stopping turns and shutting down.",
|
|
254
|
+
"queue.overflow": "The notification queue passed a bound and dropped its backlog.",
|
|
228
255
|
"queue.task-failed": "A task on a per-thread queue failed.",
|
|
229
256
|
"raw-log.write-failed": "Appending to the raw Codex log failed.",
|
|
230
257
|
"recorder.notice": "The notification recorder needs attention: it is on, or was asked for without its confirmation.",
|
|
@@ -238,6 +265,7 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
238
265
|
"server-request.flush-timeout": "An answer to a server request did not flush in time.",
|
|
239
266
|
"server-request.handoff-failed": "Handing a server request to the router threw.",
|
|
240
267
|
"session.config-apply-failed": "Applying session configuration failed; the route answers unavailable.",
|
|
268
|
+
"session.policy-widening-refused": "A request tried to widen a live session's execution policy and was refused; widened names the axes.",
|
|
241
269
|
"sse.closed": "An event stream was closed by the bridge; the client reconnects and replays.",
|
|
242
270
|
"sse.keepalive-failed": "An event stream keepalive failed.",
|
|
243
271
|
"sse.observer-failed": "An event stream observer failed; it reconnects.",
|
|
@@ -266,19 +294,39 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
|
|
|
266
294
|
events: {
|
|
267
295
|
"agent.archive-failed": "Archiving or unarchiving an agent failed.",
|
|
268
296
|
"http.route-failed": "An HTTP route failed unexpectedly; its error is not logged because it can hold content.",
|
|
297
|
+
"session.policy-widening-refused": "A request tried to widen a live session's execution policy and was refused; widened names the axes.",
|
|
269
298
|
"startup.closes-failed": "Finishing closes a previous process left behind failed at startup.",
|
|
270
299
|
"startup.closes-incomplete": "Some closes a previous process left behind did not finish at startup; a retried close finishes them.",
|
|
271
300
|
"state.publication-failing": "Saving bridge state is failing; new prompts and steers are refused until it recovers.",
|
|
272
301
|
"state.publication-recovered": "Saving bridge state recovered.",
|
|
273
|
-
"state.transcripts-shortened": "The state file reached its limit, so some sessions were saved with a shortened transcript copy."
|
|
302
|
+
"state.transcripts-shortened": "The state file reached its limit, so some sessions were saved with a shortened transcript copy.",
|
|
303
|
+
"session.resume-fell-back": {
|
|
304
|
+
description: "A saved conversation could not be resumed, so a new one started; its error message is not logged because it can hold content.",
|
|
305
|
+
essential: true,
|
|
306
|
+
fields: ESSENTIAL_ERROR_FIELDS
|
|
307
|
+
},
|
|
308
|
+
"turn.failed": "A turn failed; its error message is not logged because it can hold content. A cancelled turn is not a failure.",
|
|
309
|
+
"turn.recovery-failed": "A run recovered after a bridge restart ended in failure, or could not be followed. A cancelled run is not a failure.",
|
|
310
|
+
"turn.send-failed": "Sending a prompt to Cursor failed, so whether its run started is unknown; its error message is not logged because it can hold content.",
|
|
311
|
+
"turn.timed-out": "A turn outlived its time budget, so its run was asked to cancel; `turn.failed` follows if it never stops."
|
|
274
312
|
}
|
|
275
313
|
},
|
|
276
314
|
"bridge.pi": {
|
|
277
315
|
description: "The Pi bridge: its routes, sessions and saved state.",
|
|
278
316
|
events: {
|
|
279
317
|
"http.route-failed": "An HTTP route failed unexpectedly; its error is not logged because it can hold content.",
|
|
318
|
+
"session.policy-widening-refused": "A request tried to widen a live session's execution policy and was refused; widened names the axes.",
|
|
319
|
+
"session-list.failed": "Reading the resumable sessions failed, so none were offered; its error message is not logged because it can hold content.",
|
|
280
320
|
"state.over-budget": "The state file stayed over budget after shedding transcripts, so the write was skipped.",
|
|
281
|
-
"state.transcripts-shed": "The state file was over budget, so some sessions were saved without their transcript."
|
|
321
|
+
"state.transcripts-shed": "The state file was over budget, so some sessions were saved without their transcript.",
|
|
322
|
+
"session.resume-fell-back": {
|
|
323
|
+
description: "A saved conversation could not be reopened, so a new one started; its error message is not logged because it can hold content.",
|
|
324
|
+
essential: true,
|
|
325
|
+
fields: ESSENTIAL_ERROR_FIELDS
|
|
326
|
+
},
|
|
327
|
+
"turn.failed": "A turn failed; its error message is not logged because it can hold content. A cancelled turn is not a failure.",
|
|
328
|
+
"turn.refused": "Pi refused a prompt before starting a run, so nothing ran; its error message is not logged because it can hold content.",
|
|
329
|
+
"turn.startup-timed-out": "Pi did not start a turn within its startup deadline, so the prompt was abandoned."
|
|
282
330
|
}
|
|
283
331
|
}
|
|
284
332
|
});
|
|
@@ -289,14 +337,31 @@ var DESKTOP_LOG_AREAS = defineLogAreas({
|
|
|
289
337
|
description: "The Electron main process: startup, windows, quit and the Local backend's life.",
|
|
290
338
|
events: {
|
|
291
339
|
"backend.docker-context-seed-failed": "An agent-test profile fell back to the default Docker context.",
|
|
292
|
-
"backend.exited":
|
|
293
|
-
|
|
340
|
+
"backend.exited": {
|
|
341
|
+
description: "The Local backend exited unexpectedly; Local work is unavailable. `error.exitCode` and `error.signal` say how.",
|
|
342
|
+
essential: true,
|
|
343
|
+
fields: ESSENTIAL_ERROR_FIELDS
|
|
344
|
+
},
|
|
345
|
+
"backend.exited-recovering": {
|
|
346
|
+
description: "The Local backend exited just after a remote update; relaunching unattended. `error.exitCode` and `error.signal` say how.",
|
|
347
|
+
essential: true,
|
|
348
|
+
fields: ESSENTIAL_ERROR_FIELDS
|
|
349
|
+
},
|
|
294
350
|
"backend.keychain-link-remove-failed": "An agent-test profile kept a legacy link to the host keychain.",
|
|
295
|
-
"backend.start-failed":
|
|
351
|
+
"backend.start-failed": {
|
|
352
|
+
description: "The Local backend did not start; continuing with remote machines.",
|
|
353
|
+
essential: true,
|
|
354
|
+
fields: ESSENTIAL_ERROR_FIELDS
|
|
355
|
+
},
|
|
296
356
|
"clipboard.write-failed": "Writing text to the system clipboard failed.",
|
|
297
357
|
"dev-mode.ignored-packaged": "A packaged app was launched with ELECTRON_DEV=1 and ignored it; it loads its bundled renderer.",
|
|
298
358
|
"instance.already-running": "Another instance holds this data directory; this one will quit.",
|
|
299
|
-
"main-thread.stalled":
|
|
359
|
+
"main-thread.stalled": {
|
|
360
|
+
description: "A timer fired late, so windows, IPC and the stdout reader waited.",
|
|
361
|
+
essential: true,
|
|
362
|
+
minLevel: "error",
|
|
363
|
+
fields: { lagMs: "number", intervalMs: "number" }
|
|
364
|
+
},
|
|
300
365
|
"quit.stopping-backend": "The app is quitting and has asked the Local backend to stop.",
|
|
301
366
|
"relaunch.schedule-failed": "The AppImage relaunch waiter failed; using Electron's relauncher.",
|
|
302
367
|
"relaunch.service-register-failed": "The AppImage relaunch service was refused; using a detached waiter.",
|
|
@@ -307,7 +372,11 @@ var DESKTOP_LOG_AREAS = defineLogAreas({
|
|
|
307
372
|
"saved-machines.attach-failed": "Saved machines were not imported into the command node yet.",
|
|
308
373
|
"saved-machines.attached": "Saved machines were imported into the local command node.",
|
|
309
374
|
"startup.failed": "The application failed to start.",
|
|
310
|
-
"uncaught-exception":
|
|
375
|
+
"uncaught-exception": {
|
|
376
|
+
description: "The main process hit an uncaught exception.",
|
|
377
|
+
essential: true,
|
|
378
|
+
fields: ESSENTIAL_ERROR_FIELDS
|
|
379
|
+
},
|
|
311
380
|
"uncaught-exception.dialog-failed": "The uncaught exception sheet could not be shown.",
|
|
312
381
|
"window.create-failed": "A menu-driven new window could not be created.",
|
|
313
382
|
"window.recreate-failed": "The main window could not be recreated on activation.",
|
|
@@ -330,6 +399,12 @@ var DESKTOP_LOG_AREAS = defineLogAreas({
|
|
|
330
399
|
"unhandled-rejection": "An unhandled rejection occurred while the renderer was starting."
|
|
331
400
|
}
|
|
332
401
|
},
|
|
402
|
+
"desktop.permissions": {
|
|
403
|
+
description: "Permission requests refused on the renderer and workspace realm sessions.",
|
|
404
|
+
events: {
|
|
405
|
+
denied: "A renderer asked for a permission the policy does not grant."
|
|
406
|
+
}
|
|
407
|
+
},
|
|
333
408
|
"desktop.dialog": {
|
|
334
409
|
description: "Native dialogs, whose modal loops hold the main thread while they are open.",
|
|
335
410
|
events: {
|
|
@@ -448,6 +523,8 @@ var GATEWAY_LOG_AREAS = defineLogAreas({
|
|
|
448
523
|
"loopback.unavailable": "The loopback client listener could not start.",
|
|
449
524
|
"auth-token.stored": "The gateway token's file was written. The path only, never the token.",
|
|
450
525
|
"auth-token.persist-failed": "The gateway token could not be saved.",
|
|
526
|
+
"auth-guess.throttled": "A listener saw enough different wrong tokens that it now pauses new ones. Never the values.",
|
|
527
|
+
"host.refused": "A request named a host this gateway does not answer to. Logged once per name, up to a limit.",
|
|
451
528
|
"port.fallback": "The preferred port was taken, so a nearby one is used.",
|
|
452
529
|
"port.fallback-distant": "The preferred port and those nearby were taken, so another is used.",
|
|
453
530
|
"request.failed": "A gateway request failed. Throttled: repeats are counted, not written.",
|
|
@@ -491,6 +568,22 @@ var LOCAL_SERVER_LOG_AREAS = defineLogAreas({
|
|
|
491
568
|
"bridge-runtime.installed": "A bridge runtime finished installing.",
|
|
492
569
|
"opencode.database-lost-retrying": "OpenCode lost its shared database at startup, so it is retried.",
|
|
493
570
|
"server.stopping": "A local server is being stopped, for the fixed `reason` given.",
|
|
571
|
+
"bridge.started": {
|
|
572
|
+
description: "A local bridge process was spawned; `key` names its kind and environment.",
|
|
573
|
+
essential: true,
|
|
574
|
+
fields: { key: "label", pid: "number" }
|
|
575
|
+
},
|
|
576
|
+
"bridge.exited": {
|
|
577
|
+
description: "A local bridge process exited, with its `code` and `signal`. `warn` when nothing asked it to, whatever the code; `info` when the backend stopped it, which `server.stopping` explains.",
|
|
578
|
+
essential: true,
|
|
579
|
+
fields: {
|
|
580
|
+
key: "label",
|
|
581
|
+
pid: "number",
|
|
582
|
+
code: "number",
|
|
583
|
+
signal: "label",
|
|
584
|
+
requested: "boolean"
|
|
585
|
+
}
|
|
586
|
+
},
|
|
494
587
|
"reaper.tmux-list-failed": "Orphaned claude-tmux sessions could not be listed.",
|
|
495
588
|
"reaper.tmux-kill-failed": "An orphaned tmux session could not be killed.",
|
|
496
589
|
"reaper.tmux-reaped": "Orphaned claude-tmux sessions of a deleted environment were killed.",
|
|
@@ -524,13 +617,29 @@ var LOGGING_LOG_AREAS = defineLogAreas({
|
|
|
524
617
|
"capture.started": "Saving logs to disk began for this process.",
|
|
525
618
|
"capture.stopped": "Saving logs to disk stopped for this process.",
|
|
526
619
|
"config.invalid": "A logging environment variable held a value that was ignored.",
|
|
527
|
-
"entries.dropped":
|
|
620
|
+
"entries.dropped": {
|
|
621
|
+
description: "Entries were dropped and counted, for the fixed `reason` given: the queue was full, a write failed or, in the essential log, one event was repeating too fast.",
|
|
622
|
+
essential: true,
|
|
623
|
+
fields: { entries: "number", bytes: "number", reason: "label" }
|
|
624
|
+
},
|
|
625
|
+
"essential.started": {
|
|
626
|
+
description: "This process began writing the essential log. One with no `essential.stopped` before it means the last writer died.",
|
|
627
|
+
essential: true,
|
|
628
|
+
fields: { owner: "label" }
|
|
629
|
+
},
|
|
630
|
+
"essential.stopped": {
|
|
631
|
+
description: "This process stopped writing the essential log, in an orderly exit.",
|
|
632
|
+
essential: true,
|
|
633
|
+
fields: { owner: "label" }
|
|
634
|
+
},
|
|
635
|
+
"essential.write-failed": "Writing the essential log failed. Its entries are counted, and a marker reports them at the next write that works.",
|
|
528
636
|
"policy.changed": "The logging settings changed: saving, retention and levels, with no content.",
|
|
529
637
|
"policy.bridge-predates-route": "A running bridge has no logging settings route; it applies them at its next start.",
|
|
530
638
|
"policy.push-failed": "A running bridge did not take the logging settings after retries; its next start resends them.",
|
|
531
639
|
"prune.failed": "Removing expired log files failed; the next sweep retries.",
|
|
532
640
|
"write.failed": "Appending to the log file failed.",
|
|
533
|
-
"unknown-area": "Code outside the type checker asked for an area that is not listed."
|
|
641
|
+
"unknown-area": "Code outside the type checker asked for an area that is not listed.",
|
|
642
|
+
...THROTTLE_LOG_EVENTS
|
|
534
643
|
}
|
|
535
644
|
}
|
|
536
645
|
});
|
|
@@ -655,7 +764,28 @@ var RUNTIME_LOG_AREAS = defineLogAreas({
|
|
|
655
764
|
"event-loop": {
|
|
656
765
|
description: "This process's event loop. A stall of 10 seconds or more is written at error, so no level hides it.",
|
|
657
766
|
events: {
|
|
658
|
-
stalled:
|
|
767
|
+
stalled: {
|
|
768
|
+
description: "A timer fired late, so every request in that window waited.",
|
|
769
|
+
essential: true,
|
|
770
|
+
minLevel: "error",
|
|
771
|
+
fields: { lagMs: "number", intervalMs: "number" }
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
},
|
|
775
|
+
process: {
|
|
776
|
+
description: "Failures of a whole process that nothing in it handled.",
|
|
777
|
+
events: {
|
|
778
|
+
"rejection.unhandled": {
|
|
779
|
+
description: "A promise rejection reached the fatal rejection guard, which keeps the process running.",
|
|
780
|
+
essential: true,
|
|
781
|
+
fields: { kind: "label", ...ESSENTIAL_ERROR_FIELDS }
|
|
782
|
+
},
|
|
783
|
+
"uncaught-exception": {
|
|
784
|
+
description: "An exception reached the top of the backend, which is about to die with it. `origin` says whether it was thrown or a rejected top-level await.",
|
|
785
|
+
essential: true,
|
|
786
|
+
fields: { origin: "label", ...ESSENTIAL_ERROR_FIELDS }
|
|
787
|
+
},
|
|
788
|
+
...THROTTLE_LOG_EVENTS
|
|
659
789
|
}
|
|
660
790
|
}
|
|
661
791
|
});
|
|
@@ -893,21 +1023,43 @@ var STORAGE_LOG_AREAS = defineLogAreas({
|
|
|
893
1023
|
description: "The SQLite-backed stores, their snapshots and imports from older formats.",
|
|
894
1024
|
events: {
|
|
895
1025
|
"usage.environment-label-failed": "Usage labels could not be retained for a removed environment; deletion continues.",
|
|
896
|
-
"
|
|
1026
|
+
"migration.failed": {
|
|
1027
|
+
description: "The database could not be brought to this build's schema, so it did not open; `step` says whether the safety copy or the migration itself failed.",
|
|
1028
|
+
essential: true,
|
|
1029
|
+
fields: {
|
|
1030
|
+
fromVersion: "number",
|
|
1031
|
+
toVersion: "number",
|
|
1032
|
+
step: "label",
|
|
1033
|
+
...ESSENTIAL_ERROR_FIELDS
|
|
1034
|
+
}
|
|
1035
|
+
},
|
|
1036
|
+
"snapshot.integrity-failed": {
|
|
1037
|
+
description: "A database snapshot failed its integrity check and was discarded.",
|
|
1038
|
+
essential: true,
|
|
1039
|
+
fields: {}
|
|
1040
|
+
},
|
|
897
1041
|
"snapshot.skipped-low-disk": "The hourly database snapshot was skipped because the disk lacks room; `retryAt` says when it tries again.",
|
|
898
|
-
"snapshot.failed":
|
|
1042
|
+
"snapshot.failed": {
|
|
1043
|
+
description: "The hourly database snapshot failed; `retryAt` says when it tries again, if known.",
|
|
1044
|
+
essential: true,
|
|
1045
|
+
fields: { retryAt: "label", ...ESSENTIAL_ERROR_FIELDS }
|
|
1046
|
+
},
|
|
899
1047
|
"listener.attention-failed": "An environment attention listener threw; the committed mutation stands.",
|
|
900
1048
|
"listener.change-failed": "A resource change listener threw; the committed mutation stands.",
|
|
901
1049
|
"kanban.image-cleanup-failed": "An orphaned Kanban image could not be removed after its retries; it is safe to remove later.",
|
|
902
1050
|
"nodes.entries-dropped": "Unreadable node registry entries were ignored.",
|
|
903
1051
|
"preview-identity.reminted": "The data directory moved or was copied, so previews get a new backend identity.",
|
|
1052
|
+
"preview-settings.invalid": "Invalid preview settings disabled transport and relay.",
|
|
904
1053
|
"machine-profile.invalid": "The stored machine profile was invalid and the default was restored.",
|
|
905
1054
|
"permission-rules.cleanup-failed": "A deleted project's permission rules could not be removed.",
|
|
906
1055
|
"retired.turn-cleanup-pending": "Cleanup of a retired Looped Review turn did not finish and stays pending.",
|
|
907
1056
|
"handoffs.prune-failed": "Pruning agent handoffs that nothing references failed; a later prune retries.",
|
|
908
1057
|
"desktop-connections.malformed": "Stored desktop connection settings were malformed, so the local connection is used.",
|
|
909
1058
|
"legacy-json.moved": "JSON store files written after the SQLite migration were archived, not imported.",
|
|
910
|
-
"legacy-json.archive-failed": "Imported JSON store files could not be archived."
|
|
1059
|
+
"legacy-json.archive-failed": "Imported JSON store files could not be archived.",
|
|
1060
|
+
"lease.heartbeat-failed": "A held lease's heartbeat failed, which shortens the lease; the next one retries.",
|
|
1061
|
+
"scrub.checkpoint-failed": "Deleted content could not be scrubbed from the WAL because the truncating checkpoint failed or was blocked; the next checkpoint retries.",
|
|
1062
|
+
...THROTTLE_LOG_EVENTS
|
|
911
1063
|
}
|
|
912
1064
|
}
|
|
913
1065
|
});
|
|
@@ -1015,8 +1167,10 @@ var COORDINATOR_LOG_AREAS = defineLogAreas({
|
|
|
1015
1167
|
"remote-worker.settle-failed": "A remote worker could not be settled.",
|
|
1016
1168
|
"checkout.merge-followed": "After an environment's PR merged, the project checkout was fast-forwarded, or `outcome` says why not.",
|
|
1017
1169
|
"checkout.merge-follow-failed": "Fast-forwarding the project checkout failed, after an environment's PR merged or before mail woke the main coordinator.",
|
|
1018
|
-
"checkout.mail-follow": "Before mail woke the main coordinator, the project checkout was fast-forwarded, or `outcome` says why not (`timed-out`, `failed`).",
|
|
1019
|
-
"checkout.mail-follow-failed": "Before mail woke the main coordinator, checking whether to fast-forward the project checkout failed; the mail was delivered anyway."
|
|
1170
|
+
"checkout.mail-follow": "Before mail woke the main coordinator, the project checkout was fast-forwarded (`fast-forwarded-fetched` when the fetch was slow or failed and the upstream commit already fetched was merged), or `outcome` says why not (`timed-out`, `failed`).",
|
|
1171
|
+
"checkout.mail-follow-failed": "Before mail woke the main coordinator, checking whether to fast-forward the project checkout failed; the mail was delivered anyway.",
|
|
1172
|
+
"checkout.message-check": "Before a typed message to the main coordinator, the backend answered whether to fast-forward the project checkout: `outcome` (`offer`, `fast-forwarded`, `turn-running`, `not-behind`, `blocked`, `no-status`), `fetch` (`fetched`, `failed`, `timed-out`, `skipped`) and `durationMs`.",
|
|
1173
|
+
"checkout.message-check-failed": "Before a typed message to the main coordinator, fast-forwarding to the upstream commit already fetched failed after a slow or failed fetch; the message was sent anyway."
|
|
1020
1174
|
}
|
|
1021
1175
|
}
|
|
1022
1176
|
});
|
|
@@ -1119,7 +1273,27 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
1119
1273
|
"recovery.clear-terminals-failed": "Terminal sessions could not be cleared after a recovery restore.",
|
|
1120
1274
|
"github-ranges.seed-not-copied": "The GitHub ranges seed could not be copied into a container, so its firewall fetches them.",
|
|
1121
1275
|
"availability.probe-failed": "Docker is not available; written when the diagnostic changes. Fixed-shape metadata only: messages can hold daemon endpoints.",
|
|
1122
|
-
"start.port-collision-retrying": "An automatic host port collided on start, so it is retried once with fresh ports."
|
|
1276
|
+
"start.port-collision-retrying": "An automatic host port collided on start, so it is retried once with fresh ports.",
|
|
1277
|
+
"writer-lease.lost": {
|
|
1278
|
+
description: "This backend lost the registry writer lease, for the fixed `reason` given. Schedules stop and container changes are refused until it restarts.",
|
|
1279
|
+
essential: true,
|
|
1280
|
+
fields: { reason: "label" }
|
|
1281
|
+
},
|
|
1282
|
+
"writer-lease.regained": {
|
|
1283
|
+
description: "This backend took the registry writer lease over from a holder that stopped refreshing it (it crashed, was killed or stalled), `staleForMs` after its last refresh. The counterpart of that holder's `writer-lease.lost` with reason `reclaimed`; a lease left by a clean shutdown is acquired silently.",
|
|
1284
|
+
essential: true,
|
|
1285
|
+
fields: { staleForMs: "number" }
|
|
1286
|
+
},
|
|
1287
|
+
"writer-lease.not-acquired": {
|
|
1288
|
+
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
|
+
essential: true,
|
|
1290
|
+
fields: { reason: "label" }
|
|
1291
|
+
},
|
|
1292
|
+
"bridge.launched": {
|
|
1293
|
+
description: "A bridge process was launched in a container, for the first time there or as a relaunch; `provider` names it. A relaunch keeps the run before it in the previous log.",
|
|
1294
|
+
essential: true,
|
|
1295
|
+
fields: { provider: "label", containerPort: "number" }
|
|
1296
|
+
}
|
|
1123
1297
|
}
|
|
1124
1298
|
},
|
|
1125
1299
|
"docker.reachability": {
|
|
@@ -2005,6 +2179,146 @@ function logErrorKind(error) {
|
|
|
2005
2179
|
return matching(read(error, "name"), NAME_PATTERN) ?? "Error";
|
|
2006
2180
|
}
|
|
2007
2181
|
|
|
2182
|
+
// ../protocol/src/log-essential-labels.ts
|
|
2183
|
+
var ERROR_NAMES = new Set([
|
|
2184
|
+
"Error",
|
|
2185
|
+
"TypeError",
|
|
2186
|
+
"RangeError",
|
|
2187
|
+
"ReferenceError",
|
|
2188
|
+
"SyntaxError",
|
|
2189
|
+
"URIError",
|
|
2190
|
+
"EvalError",
|
|
2191
|
+
"AggregateError",
|
|
2192
|
+
"AbortError",
|
|
2193
|
+
"TimeoutError",
|
|
2194
|
+
"SystemError"
|
|
2195
|
+
]);
|
|
2196
|
+
var ERROR_CODES = new Set([
|
|
2197
|
+
"EACCES",
|
|
2198
|
+
"EADDRINUSE",
|
|
2199
|
+
"EADDRNOTAVAIL",
|
|
2200
|
+
"EAGAIN",
|
|
2201
|
+
"EBADF",
|
|
2202
|
+
"EBUSY",
|
|
2203
|
+
"ECANCELED",
|
|
2204
|
+
"ECONNABORTED",
|
|
2205
|
+
"ECONNREFUSED",
|
|
2206
|
+
"ECONNRESET",
|
|
2207
|
+
"EEXIST",
|
|
2208
|
+
"EHOSTUNREACH",
|
|
2209
|
+
"EINTR",
|
|
2210
|
+
"EINVAL",
|
|
2211
|
+
"EIO",
|
|
2212
|
+
"EISDIR",
|
|
2213
|
+
"EMFILE",
|
|
2214
|
+
"ENETUNREACH",
|
|
2215
|
+
"ENFILE",
|
|
2216
|
+
"ENOENT",
|
|
2217
|
+
"ENOMEM",
|
|
2218
|
+
"ENOSPC",
|
|
2219
|
+
"ENOSYS",
|
|
2220
|
+
"ENOTDIR",
|
|
2221
|
+
"ENOTEMPTY",
|
|
2222
|
+
"ENOTFOUND",
|
|
2223
|
+
"EPERM",
|
|
2224
|
+
"EPIPE",
|
|
2225
|
+
"EROFS",
|
|
2226
|
+
"ETIMEDOUT",
|
|
2227
|
+
"EXDEV",
|
|
2228
|
+
"SQLITE_BUSY",
|
|
2229
|
+
"SQLITE_CORRUPT",
|
|
2230
|
+
"SQLITE_FULL",
|
|
2231
|
+
"SQLITE_IOERR",
|
|
2232
|
+
"SQLITE_NOTADB",
|
|
2233
|
+
"SQLITE_READONLY",
|
|
2234
|
+
"ERR_CANCELED",
|
|
2235
|
+
"ERR_STREAM_DESTROYED"
|
|
2236
|
+
]);
|
|
2237
|
+
var SYSCALLS = new Set([
|
|
2238
|
+
"open",
|
|
2239
|
+
"read",
|
|
2240
|
+
"write",
|
|
2241
|
+
"stat",
|
|
2242
|
+
"lstat",
|
|
2243
|
+
"mkdir",
|
|
2244
|
+
"rmdir",
|
|
2245
|
+
"readdir",
|
|
2246
|
+
"rename",
|
|
2247
|
+
"unlink",
|
|
2248
|
+
"fsync",
|
|
2249
|
+
"fdatasync",
|
|
2250
|
+
"close",
|
|
2251
|
+
"access",
|
|
2252
|
+
"chmod",
|
|
2253
|
+
"copyfile",
|
|
2254
|
+
"connect",
|
|
2255
|
+
"listen",
|
|
2256
|
+
"bind",
|
|
2257
|
+
"spawn",
|
|
2258
|
+
"kill",
|
|
2259
|
+
"getaddrinfo"
|
|
2260
|
+
]);
|
|
2261
|
+
var SIGNALS = new Set([
|
|
2262
|
+
"SIGABRT",
|
|
2263
|
+
"SIGALRM",
|
|
2264
|
+
"SIGBUS",
|
|
2265
|
+
"SIGCHLD",
|
|
2266
|
+
"SIGCONT",
|
|
2267
|
+
"SIGFPE",
|
|
2268
|
+
"SIGHUP",
|
|
2269
|
+
"SIGILL",
|
|
2270
|
+
"SIGINT",
|
|
2271
|
+
"SIGKILL",
|
|
2272
|
+
"SIGPIPE",
|
|
2273
|
+
"SIGQUIT",
|
|
2274
|
+
"SIGSEGV",
|
|
2275
|
+
"SIGSTOP",
|
|
2276
|
+
"SIGTERM",
|
|
2277
|
+
"SIGTRAP",
|
|
2278
|
+
"SIGTSTP",
|
|
2279
|
+
"SIGTTIN",
|
|
2280
|
+
"SIGTTOU",
|
|
2281
|
+
"SIGUSR1",
|
|
2282
|
+
"SIGUSR2",
|
|
2283
|
+
"SIGWINCH",
|
|
2284
|
+
"SIGXCPU",
|
|
2285
|
+
"SIGXFSZ"
|
|
2286
|
+
]);
|
|
2287
|
+
var PROVIDERS = new Set(["claude", "codex", "opencode", "cursor", "grok", "acp", "pi"]);
|
|
2288
|
+
var UUID = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
|
|
2289
|
+
var SOURCE = new RegExp(`^(?:claude|codex|opencode|cursor|grok|acp|pi):${UUID}$`, "i");
|
|
2290
|
+
|
|
2291
|
+
// ../protocol/src/log-essential.ts
|
|
2292
|
+
var vocabulary = LOG_VOCABULARY;
|
|
2293
|
+
var UNDECLARED_ERROR_LABELS = new Set([
|
|
2294
|
+
"site",
|
|
2295
|
+
"kind",
|
|
2296
|
+
"step",
|
|
2297
|
+
"reason",
|
|
2298
|
+
"signal",
|
|
2299
|
+
"code"
|
|
2300
|
+
]);
|
|
2301
|
+
function eventSpec(area, event) {
|
|
2302
|
+
const spec = Object.hasOwn(vocabulary, area) ? vocabulary[area] : undefined;
|
|
2303
|
+
if (!spec || !Object.hasOwn(spec.events, event))
|
|
2304
|
+
return null;
|
|
2305
|
+
const definition = spec.events[event];
|
|
2306
|
+
return typeof definition === "object" && definition.essential ? definition : null;
|
|
2307
|
+
}
|
|
2308
|
+
function declaredEssential(area, event, level) {
|
|
2309
|
+
const spec = eventSpec(area, event);
|
|
2310
|
+
return spec && (spec.minLevel !== "error" || level === "error") ? spec : null;
|
|
2311
|
+
}
|
|
2312
|
+
function hasEssentialEvents(area) {
|
|
2313
|
+
const spec = Object.hasOwn(vocabulary, area) ? vocabulary[area] : undefined;
|
|
2314
|
+
return spec !== undefined && Object.values(spec.events).some((event) => typeof event === "object" && event.essential);
|
|
2315
|
+
}
|
|
2316
|
+
function isEssentialEntry(area, event, level) {
|
|
2317
|
+
if (area === "logging" && event === "essential.write-failed")
|
|
2318
|
+
return false;
|
|
2319
|
+
return level === "error" || declaredEssential(area, event, level) !== null;
|
|
2320
|
+
}
|
|
2321
|
+
|
|
2008
2322
|
// ../protocol/src/logger.ts
|
|
2009
2323
|
var LOG_LEVELS = ["error", "warn", "info", "debug", "trace"];
|
|
2010
2324
|
var MAX_FIELD_CHARS = 2048;
|
|
@@ -2049,7 +2363,9 @@ var DEFAULT_CONFIG = {
|
|
|
2049
2363
|
level: "info",
|
|
2050
2364
|
areaLevels: {},
|
|
2051
2365
|
format: "text",
|
|
2052
|
-
sink: consoleSink
|
|
2366
|
+
sink: consoleSink,
|
|
2367
|
+
essentialSink: null,
|
|
2368
|
+
relayEssential: false
|
|
2053
2369
|
};
|
|
2054
2370
|
var config = DEFAULT_CONFIG;
|
|
2055
2371
|
var generation = 0;
|
|
@@ -2160,17 +2476,38 @@ function renderText(record) {
|
|
|
2160
2476
|
function renderJson(record) {
|
|
2161
2477
|
return escapeLogLine(JSON.stringify(record));
|
|
2162
2478
|
}
|
|
2479
|
+
function offerEssential(record) {
|
|
2480
|
+
if (!config.essentialSink || !isEssentialEntry(record.area, record.event, record.level))
|
|
2481
|
+
return;
|
|
2482
|
+
try {
|
|
2483
|
+
config.essentialSink(record);
|
|
2484
|
+
} catch {}
|
|
2485
|
+
}
|
|
2163
2486
|
function deliver(record) {
|
|
2487
|
+
let delivered = true;
|
|
2164
2488
|
try {
|
|
2165
2489
|
config.sink({
|
|
2166
2490
|
method: OUTPUT_METHOD[record.level],
|
|
2167
2491
|
line: config.format === "json" ? renderJson(record) : renderText(record),
|
|
2168
2492
|
record
|
|
2169
2493
|
});
|
|
2170
|
-
return true;
|
|
2171
2494
|
} catch {
|
|
2172
|
-
|
|
2495
|
+
delivered = false;
|
|
2173
2496
|
}
|
|
2497
|
+
offerEssential(record);
|
|
2498
|
+
return delivered;
|
|
2499
|
+
}
|
|
2500
|
+
function deliverEssentialOnly(record) {
|
|
2501
|
+
if (config.essentialSink) {
|
|
2502
|
+
offerEssential(record);
|
|
2503
|
+
return;
|
|
2504
|
+
}
|
|
2505
|
+
if (!config.relayEssential)
|
|
2506
|
+
return;
|
|
2507
|
+
const marked = { ...record, essentialOnly: true };
|
|
2508
|
+
try {
|
|
2509
|
+
config.sink({ method: OUTPUT_METHOD[record.level], line: renderJson(marked), record: marked });
|
|
2510
|
+
} catch {}
|
|
2174
2511
|
}
|
|
2175
2512
|
function buildRecord(level, area, event, fields) {
|
|
2176
2513
|
const clean = fields ? sanitizeFields(fields, areaSpec(area)?.maxStringChars ?? MAX_FIELD_CHARS) : undefined;
|
|
@@ -2335,12 +2672,17 @@ function deliverEvent(level, area, event, fields) {
|
|
|
2335
2672
|
return deliver(buildRecord(level, area, event, fields));
|
|
2336
2673
|
}
|
|
2337
2674
|
function tryWriteLog(level, area, event, fields) {
|
|
2338
|
-
if (LEVEL_RANK[level] > thresholdRank(area))
|
|
2675
|
+
if (LEVEL_RANK[level] > thresholdRank(area)) {
|
|
2676
|
+
if (isEssentialEntry(area, event, level)) {
|
|
2677
|
+
deliverEssentialOnly(buildRecord(level, area, event, resolveFields(fields)));
|
|
2678
|
+
}
|
|
2339
2679
|
return false;
|
|
2680
|
+
}
|
|
2340
2681
|
return deliverEvent(level, area, event, resolveFields(fields));
|
|
2341
2682
|
}
|
|
2342
2683
|
function createLogger(area) {
|
|
2343
2684
|
const spec = areaSpec(area);
|
|
2685
|
+
const mayHoldEssential = hasEssentialEvents(area);
|
|
2344
2686
|
let seenGeneration = -1;
|
|
2345
2687
|
let rank = 0;
|
|
2346
2688
|
const enabled = (level) => {
|
|
@@ -2353,9 +2695,16 @@ function createLogger(area) {
|
|
|
2353
2695
|
const writeResolved = (level, event, resolved) => {
|
|
2354
2696
|
deliverEvent(level, area, event, resolved);
|
|
2355
2697
|
};
|
|
2698
|
+
const writeFiltered = (level, event, fields) => {
|
|
2699
|
+
if (!mayHoldEssential || !isEssentialEntry(area, event, level))
|
|
2700
|
+
return;
|
|
2701
|
+
deliverEssentialOnly(buildRecord(level, area, event, resolveFields(fields)));
|
|
2702
|
+
};
|
|
2356
2703
|
const write = (level, event, fields) => {
|
|
2357
|
-
if (!enabled(level))
|
|
2704
|
+
if (!enabled(level)) {
|
|
2705
|
+
writeFiltered(level, event, fields);
|
|
2358
2706
|
return;
|
|
2707
|
+
}
|
|
2359
2708
|
writeResolved(level, event, resolveFields(fields));
|
|
2360
2709
|
};
|
|
2361
2710
|
return {
|
|
@@ -2366,8 +2715,10 @@ function createLogger(area) {
|
|
|
2366
2715
|
trace: (event, fields) => write("trace", event, fields),
|
|
2367
2716
|
throttled: (level, event, options) => {
|
|
2368
2717
|
syncThrottleLevels();
|
|
2369
|
-
if (!enabled(level))
|
|
2718
|
+
if (!enabled(level)) {
|
|
2719
|
+
writeFiltered(level, event, options.fields);
|
|
2370
2720
|
return;
|
|
2721
|
+
}
|
|
2371
2722
|
if (!spec || !Object.hasOwn(spec.events, event) || event.startsWith("throttle.") || !Object.hasOwn(spec.events, "throttle.recovered")) {
|
|
2372
2723
|
deliver(buildRecord(level, spec ? area : "logging", spec ? "invalid-event" : "unknown-area", undefined));
|
|
2373
2724
|
return;
|
|
@@ -2491,7 +2842,8 @@ function configureLoggerFromEnvironment(env, options = {}) {
|
|
|
2491
2842
|
configureLogger({
|
|
2492
2843
|
...levels.level ? { level: levels.level } : {},
|
|
2493
2844
|
areaLevels: levels.areaLevels,
|
|
2494
|
-
format
|
|
2845
|
+
format,
|
|
2846
|
+
relayEssential: options.relayToSupervisor === true
|
|
2495
2847
|
});
|
|
2496
2848
|
const log = createLogger("logging");
|
|
2497
2849
|
if (levels.invalid.length > 0) {
|
|
@@ -4888,7 +5240,7 @@ var PERMISSION_RULE_PROVIDERS = [
|
|
|
4888
5240
|
"grok",
|
|
4889
5241
|
"pi"
|
|
4890
5242
|
];
|
|
4891
|
-
var
|
|
5243
|
+
var PROVIDERS2 = new Set(PERMISSION_RULE_PROVIDERS);
|
|
4892
5244
|
var KINDS = new Set(PERMISSION_RULE_KINDS);
|
|
4893
5245
|
var SCOPES = new Set(PERMISSION_RULE_SCOPES);
|
|
4894
5246
|
var UNQUOTED_REFUSED = new Set([
|
|
@@ -5160,7 +5512,7 @@ var AGENT_INTERACTION_AUTHORIZATION_KINDS = [
|
|
|
5160
5512
|
];
|
|
5161
5513
|
var INPUT_KINDS = new Set(AGENT_INTERACTION_INPUT_KINDS);
|
|
5162
5514
|
var AUTHORIZATION_KINDS = new Set(AGENT_INTERACTION_AUTHORIZATION_KINDS);
|
|
5163
|
-
var
|
|
5515
|
+
var PROVIDERS3 = new Set(AGENT_INTERACTION_PROVIDERS);
|
|
5164
5516
|
var KINDS2 = new Set(AGENT_INTERACTION_KINDS);
|
|
5165
5517
|
var ORIGINS = new Set(AGENT_INTERACTION_ORIGINS);
|
|
5166
5518
|
var STATES = new Set(AGENT_INTERACTION_STATES);
|
|
@@ -6923,45 +7275,6 @@ function nextTurnGeneration() {
|
|
|
6923
7275
|
turnGenerationCounter += 1;
|
|
6924
7276
|
return turnGenerationCounter;
|
|
6925
7277
|
}
|
|
6926
|
-
// ../../bridges/claude-bridge/src/services/image-attachment-data.ts
|
|
6927
|
-
var SUPPORTED_IMAGE_MEDIA_TYPES = new Set([
|
|
6928
|
-
"image/jpeg",
|
|
6929
|
-
"image/png",
|
|
6930
|
-
"image/gif",
|
|
6931
|
-
"image/webp"
|
|
6932
|
-
]);
|
|
6933
|
-
var MAX_IMAGE_ATTACHMENT_BYTES = 8 * 1024 * 1024;
|
|
6934
|
-
function decodedBase64ByteLength(value) {
|
|
6935
|
-
const padding = value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0;
|
|
6936
|
-
return value.length / 4 * 3 - padding;
|
|
6937
|
-
}
|
|
6938
|
-
function parseBase64ImageData(value) {
|
|
6939
|
-
let data = value;
|
|
6940
|
-
let mediaType;
|
|
6941
|
-
if (value.startsWith("data:")) {
|
|
6942
|
-
const match = /^data:([^;,]+);base64,([\s\S]+)$/.exec(value);
|
|
6943
|
-
if (!match || !SUPPORTED_IMAGE_MEDIA_TYPES.has(match[1])) {
|
|
6944
|
-
return null;
|
|
6945
|
-
}
|
|
6946
|
-
mediaType = match[1];
|
|
6947
|
-
data = match[2];
|
|
6948
|
-
}
|
|
6949
|
-
const normalized = data.replace(/\s+/g, "");
|
|
6950
|
-
if (normalized.length === 0 || normalized.length % 4 !== 0 || !/^[A-Za-z0-9+/]+={0,2}$/.test(normalized) || decodedBase64ByteLength(normalized) > MAX_IMAGE_ATTACHMENT_BYTES) {
|
|
6951
|
-
return null;
|
|
6952
|
-
}
|
|
6953
|
-
return { data: normalized, mediaType };
|
|
6954
|
-
}
|
|
6955
|
-
// ../../bridges/claude-bridge/src/services/session-manager-runtime.ts
|
|
6956
|
-
import { createHash as createHash6 } from "node:crypto";
|
|
6957
|
-
|
|
6958
|
-
// ../../bridges/claude-bridge/src/services/runtime-env.ts
|
|
6959
|
-
import { execFile as execFile2 } from "node:child_process";
|
|
6960
|
-
import { mkdtemp, readFile as readFile2 } from "node:fs/promises";
|
|
6961
|
-
import { tmpdir } from "node:os";
|
|
6962
|
-
import path from "node:path";
|
|
6963
|
-
import { promisify } from "node:util";
|
|
6964
|
-
|
|
6965
7278
|
// ../protocol/src/native-agent-goal.ts
|
|
6966
7279
|
var NATIVE_AGENT_GOAL_LIMITS = Object.freeze({
|
|
6967
7280
|
objectiveMaxChars: 4000,
|
|
@@ -7460,7 +7773,135 @@ var OPTIONAL_PROJECTION_FIELD_SET = new Set([
|
|
|
7460
7773
|
"slashCommandCatalogue"
|
|
7461
7774
|
]);
|
|
7462
7775
|
|
|
7776
|
+
// ../protocol/src/execution-policy-narrowing.ts
|
|
7777
|
+
var APPROVALS_STRICTNESS = {
|
|
7778
|
+
"auto-approve": 0,
|
|
7779
|
+
ask: 1,
|
|
7780
|
+
deny: 2
|
|
7781
|
+
};
|
|
7782
|
+
var SANDBOX_STRICTNESS = {
|
|
7783
|
+
none: 0,
|
|
7784
|
+
container: 1,
|
|
7785
|
+
provider: 2
|
|
7786
|
+
};
|
|
7787
|
+
function networkStrictness(value) {
|
|
7788
|
+
return value === "restricted" ? 1 : 0;
|
|
7789
|
+
}
|
|
7790
|
+
function isSubset(candidate, of) {
|
|
7791
|
+
const allowed = new Set(of);
|
|
7792
|
+
return candidate.every((item) => allowed.has(item));
|
|
7793
|
+
}
|
|
7794
|
+
function rawCapabilityDenials(policy) {
|
|
7795
|
+
return [
|
|
7796
|
+
...policy.capabilityPolicy?.deny ?? [],
|
|
7797
|
+
...policy.capabilityPolicy?.extendedDeny ?? []
|
|
7798
|
+
];
|
|
7799
|
+
}
|
|
7800
|
+
function executionPolicyWidenings(current, next) {
|
|
7801
|
+
if (!current)
|
|
7802
|
+
return [];
|
|
7803
|
+
const widened = [];
|
|
7804
|
+
if (next.id !== current.id)
|
|
7805
|
+
widened.push("id");
|
|
7806
|
+
if (APPROVALS_STRICTNESS[next.approvals] < APPROVALS_STRICTNESS[current.approvals]) {
|
|
7807
|
+
widened.push("approvals");
|
|
7808
|
+
}
|
|
7809
|
+
if (SANDBOX_STRICTNESS[next.sandbox] < SANDBOX_STRICTNESS[current.sandbox]) {
|
|
7810
|
+
widened.push("sandbox");
|
|
7811
|
+
}
|
|
7812
|
+
if (next.projectResources && !current.projectResources)
|
|
7813
|
+
widened.push("projectResources");
|
|
7814
|
+
if (networkStrictness(next.networkAccess) < networkStrictness(current.networkAccess)) {
|
|
7815
|
+
widened.push("networkAccess");
|
|
7816
|
+
}
|
|
7817
|
+
if (networkStrictness(next.containerNetworkAccess) < networkStrictness(current.containerNetworkAccess)) {
|
|
7818
|
+
widened.push("containerNetworkAccess");
|
|
7819
|
+
}
|
|
7820
|
+
const currentAllow = current.toolPolicy?.allow;
|
|
7821
|
+
const nextAllow = next.toolPolicy?.allow;
|
|
7822
|
+
const allowNarrows = currentAllow === undefined ? nextAllow === undefined || nextAllow.length === 0 : nextAllow !== undefined && isSubset(nextAllow, currentAllow);
|
|
7823
|
+
if (!allowNarrows)
|
|
7824
|
+
widened.push("toolPolicy.allow");
|
|
7825
|
+
if (!isSubset(current.toolPolicy?.deny ?? [], next.toolPolicy?.deny ?? [])) {
|
|
7826
|
+
widened.push("toolPolicy.deny");
|
|
7827
|
+
}
|
|
7828
|
+
if (!isSubset(rawCapabilityDenials(current), rawCapabilityDenials(next))) {
|
|
7829
|
+
widened.push("capabilityPolicy.deny");
|
|
7830
|
+
}
|
|
7831
|
+
if (!isSubset(next.capabilityPolicy?.allow ?? [], current.capabilityPolicy?.allow ?? [])) {
|
|
7832
|
+
widened.push("capabilityPolicy.allow");
|
|
7833
|
+
}
|
|
7834
|
+
const currentServers = nativeAgentUserMcpGrant(current);
|
|
7835
|
+
const nextServers = nativeAgentUserMcpGrant(next);
|
|
7836
|
+
if (currentServers !== undefined && (nextServers === undefined || !isSubset(nextServers, currentServers))) {
|
|
7837
|
+
widened.push("capabilityPolicy.userMcpServers");
|
|
7838
|
+
}
|
|
7839
|
+
return widened;
|
|
7840
|
+
}
|
|
7841
|
+
var POLICY_WIDENING_REFUSED_CODE = "policy-widening-refused";
|
|
7842
|
+
function policyWideningRefusal(widened) {
|
|
7843
|
+
return {
|
|
7844
|
+
error: "Execution policy can only be narrowed on a live session; a wider policy applies after the agent bridge restarts.",
|
|
7845
|
+
code: POLICY_WIDENING_REFUSED_CODE,
|
|
7846
|
+
widened
|
|
7847
|
+
};
|
|
7848
|
+
}
|
|
7849
|
+
|
|
7850
|
+
class PolicyWideningRefusedError extends Error {
|
|
7851
|
+
widened;
|
|
7852
|
+
constructor(widened) {
|
|
7853
|
+
super(policyWideningRefusal(widened).error);
|
|
7854
|
+
this.widened = widened;
|
|
7855
|
+
this.name = "PolicyWideningRefusedError";
|
|
7856
|
+
}
|
|
7857
|
+
refusal() {
|
|
7858
|
+
return policyWideningRefusal(this.widened);
|
|
7859
|
+
}
|
|
7860
|
+
}
|
|
7861
|
+
function assertExecutionPolicyNotWidened(current, next) {
|
|
7862
|
+
const widened = executionPolicyWidenings(current, next);
|
|
7863
|
+
if (widened.length > 0)
|
|
7864
|
+
throw new PolicyWideningRefusedError(widened);
|
|
7865
|
+
}
|
|
7866
|
+
|
|
7867
|
+
// ../../bridges/claude-bridge/src/services/image-attachment-data.ts
|
|
7868
|
+
var SUPPORTED_IMAGE_MEDIA_TYPES = new Set([
|
|
7869
|
+
"image/jpeg",
|
|
7870
|
+
"image/png",
|
|
7871
|
+
"image/gif",
|
|
7872
|
+
"image/webp"
|
|
7873
|
+
]);
|
|
7874
|
+
var MAX_IMAGE_ATTACHMENT_BYTES = 8 * 1024 * 1024;
|
|
7875
|
+
function decodedBase64ByteLength(value) {
|
|
7876
|
+
const padding = value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0;
|
|
7877
|
+
return value.length / 4 * 3 - padding;
|
|
7878
|
+
}
|
|
7879
|
+
function parseBase64ImageData(value) {
|
|
7880
|
+
let data = value;
|
|
7881
|
+
let mediaType;
|
|
7882
|
+
if (value.startsWith("data:")) {
|
|
7883
|
+
const match = /^data:([^;,]+);base64,([\s\S]+)$/.exec(value);
|
|
7884
|
+
if (!match || !SUPPORTED_IMAGE_MEDIA_TYPES.has(match[1])) {
|
|
7885
|
+
return null;
|
|
7886
|
+
}
|
|
7887
|
+
mediaType = match[1];
|
|
7888
|
+
data = match[2];
|
|
7889
|
+
}
|
|
7890
|
+
const normalized = data.replace(/\s+/g, "");
|
|
7891
|
+
if (normalized.length === 0 || normalized.length % 4 !== 0 || !/^[A-Za-z0-9+/]+={0,2}$/.test(normalized) || decodedBase64ByteLength(normalized) > MAX_IMAGE_ATTACHMENT_BYTES) {
|
|
7892
|
+
return null;
|
|
7893
|
+
}
|
|
7894
|
+
return { data: normalized, mediaType };
|
|
7895
|
+
}
|
|
7896
|
+
// ../../bridges/claude-bridge/src/services/session-manager-runtime.ts
|
|
7897
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
7898
|
+
|
|
7463
7899
|
// ../../bridges/claude-bridge/src/services/runtime-env.ts
|
|
7900
|
+
import { execFile as execFile2 } from "node:child_process";
|
|
7901
|
+
import { mkdtemp, readFile as readFile2 } from "node:fs/promises";
|
|
7902
|
+
import { tmpdir } from "node:os";
|
|
7903
|
+
import path from "node:path";
|
|
7904
|
+
import { promisify } from "node:util";
|
|
7464
7905
|
var GITHUB_CREDENTIAL_FILE_ENV = "ORKESTRATOR_GITHUB_CREDENTIAL_FILE";
|
|
7465
7906
|
var GITHUB_MCP_TOKEN_ENV = "GITHUB_PERSONAL_ACCESS_TOKEN";
|
|
7466
7907
|
var execFileAsync = promisify(execFile2);
|
|
@@ -7664,6 +8105,7 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
|
|
|
7664
8105
|
"request_project_on_node",
|
|
7665
8106
|
"request_root_changes",
|
|
7666
8107
|
"resolve_conflicts",
|
|
8108
|
+
"restart_build_pipeline_step",
|
|
7667
8109
|
"resume_build_pipeline",
|
|
7668
8110
|
"resume_schedule",
|
|
7669
8111
|
"run_worker_command",
|
|
@@ -15028,7 +15470,10 @@ async function createOrRecoverSession(title, clientSessionKey, policy) {
|
|
|
15028
15470
|
if (stableId) {
|
|
15029
15471
|
const existing = sessions.get(stableId) ?? await ensurePersistedSession(stableId);
|
|
15030
15472
|
if (existing) {
|
|
15031
|
-
|
|
15473
|
+
if (policy) {
|
|
15474
|
+
assertExecutionPolicyNotWidened(existing.executionPolicy, policy);
|
|
15475
|
+
existing.executionPolicy = policy;
|
|
15476
|
+
}
|
|
15032
15477
|
return existing;
|
|
15033
15478
|
}
|
|
15034
15479
|
journal = await stableIdDispatchJournal(stableId);
|
|
@@ -16375,6 +16820,8 @@ import { join as join11 } from "node:path";
|
|
|
16375
16820
|
var AGENT_MAIL_MAX_BODY_BYTES = 32 * 1024;
|
|
16376
16821
|
var AGENT_MAIL_MAX_STORE_BYTES = 32 * 1024 * 1024;
|
|
16377
16822
|
var AGENT_MAIL_DEFAULT_RETENTION_DAYS = 14;
|
|
16823
|
+
var AGENT_MAIL_MAX_ATTACHMENT_BYTES = 8 * 1024 * 1024;
|
|
16824
|
+
var AGENT_MAIL_MAX_TOTAL_ATTACHMENT_BYTES = 32 * 1024 * 1024;
|
|
16378
16825
|
var AGENT_MAIL_DEFAULT_AUTONOMOUS_WAKE_BUDGET = 16;
|
|
16379
16826
|
var AGENT_MAIL_DEFAULT_HOURLY_WAKE_LIMIT = 40;
|
|
16380
16827
|
var AGENT_MAIL_TOOL_NAMES = Object.freeze([
|
|
@@ -17093,7 +17540,7 @@ var SOURCES = new Set([
|
|
|
17093
17540
|
var EXECUTION_KINDS = new Set(NATIVE_AGENT_COMMAND_EXECUTION_KINDS);
|
|
17094
17541
|
var ORIGINS2 = new Set(NATIVE_AGENT_COMMAND_ORIGINS);
|
|
17095
17542
|
var UNAVAILABLE_REASONS = new Set(NATIVE_AGENT_COMMAND_UNAVAILABLE_REASONS);
|
|
17096
|
-
var
|
|
17543
|
+
var ERROR_CODES2 = new Set(NATIVE_AGENT_COMMAND_CATALOGUE_ERROR_CODES);
|
|
17097
17544
|
var encoder = new TextEncoder;
|
|
17098
17545
|
function utf8ByteLength(value) {
|
|
17099
17546
|
if (/^[\x00-\x7f]*$/.test(value))
|
|
@@ -22322,72 +22769,6 @@ function boundTranscriptResponse(messages, maximumBytes, options = {}) {
|
|
|
22322
22769
|
};
|
|
22323
22770
|
}
|
|
22324
22771
|
|
|
22325
|
-
// ../../bridges/claude-bridge/src/services/execution-policy-narrowing.ts
|
|
22326
|
-
var APPROVALS_STRICTNESS = {
|
|
22327
|
-
"auto-approve": 0,
|
|
22328
|
-
ask: 1,
|
|
22329
|
-
deny: 2
|
|
22330
|
-
};
|
|
22331
|
-
var SANDBOX_STRICTNESS = {
|
|
22332
|
-
none: 0,
|
|
22333
|
-
container: 1,
|
|
22334
|
-
provider: 2
|
|
22335
|
-
};
|
|
22336
|
-
function networkStrictness(value) {
|
|
22337
|
-
return value === "restricted" ? 1 : 0;
|
|
22338
|
-
}
|
|
22339
|
-
function isSubset(candidate, of) {
|
|
22340
|
-
const allowed = new Set(of);
|
|
22341
|
-
return candidate.every((item) => allowed.has(item));
|
|
22342
|
-
}
|
|
22343
|
-
function rawCapabilityDenials(policy) {
|
|
22344
|
-
return [
|
|
22345
|
-
...policy.capabilityPolicy?.deny ?? [],
|
|
22346
|
-
...policy.capabilityPolicy?.extendedDeny ?? []
|
|
22347
|
-
];
|
|
22348
|
-
}
|
|
22349
|
-
function executionPolicyWidenings(current, next) {
|
|
22350
|
-
if (!current)
|
|
22351
|
-
return [];
|
|
22352
|
-
const widened = [];
|
|
22353
|
-
if (next.id !== current.id)
|
|
22354
|
-
widened.push("id");
|
|
22355
|
-
if (APPROVALS_STRICTNESS[next.approvals] < APPROVALS_STRICTNESS[current.approvals]) {
|
|
22356
|
-
widened.push("approvals");
|
|
22357
|
-
}
|
|
22358
|
-
if (SANDBOX_STRICTNESS[next.sandbox] < SANDBOX_STRICTNESS[current.sandbox]) {
|
|
22359
|
-
widened.push("sandbox");
|
|
22360
|
-
}
|
|
22361
|
-
if (next.projectResources && !current.projectResources)
|
|
22362
|
-
widened.push("projectResources");
|
|
22363
|
-
if (networkStrictness(next.networkAccess) < networkStrictness(current.networkAccess)) {
|
|
22364
|
-
widened.push("networkAccess");
|
|
22365
|
-
}
|
|
22366
|
-
if (networkStrictness(next.containerNetworkAccess) < networkStrictness(current.containerNetworkAccess)) {
|
|
22367
|
-
widened.push("containerNetworkAccess");
|
|
22368
|
-
}
|
|
22369
|
-
const currentAllow = current.toolPolicy?.allow;
|
|
22370
|
-
const nextAllow = next.toolPolicy?.allow;
|
|
22371
|
-
const allowNarrows = currentAllow === undefined ? nextAllow === undefined || nextAllow.length === 0 : nextAllow !== undefined && isSubset(nextAllow, currentAllow);
|
|
22372
|
-
if (!allowNarrows)
|
|
22373
|
-
widened.push("toolPolicy.allow");
|
|
22374
|
-
if (!isSubset(current.toolPolicy?.deny ?? [], next.toolPolicy?.deny ?? [])) {
|
|
22375
|
-
widened.push("toolPolicy.deny");
|
|
22376
|
-
}
|
|
22377
|
-
if (!isSubset(rawCapabilityDenials(current), rawCapabilityDenials(next))) {
|
|
22378
|
-
widened.push("capabilityPolicy.deny");
|
|
22379
|
-
}
|
|
22380
|
-
if (!isSubset(next.capabilityPolicy?.allow ?? [], current.capabilityPolicy?.allow ?? [])) {
|
|
22381
|
-
widened.push("capabilityPolicy.allow");
|
|
22382
|
-
}
|
|
22383
|
-
const currentServers = nativeAgentUserMcpGrant(current);
|
|
22384
|
-
const nextServers = nativeAgentUserMcpGrant(next);
|
|
22385
|
-
if (currentServers !== undefined && (nextServers === undefined || !isSubset(nextServers, currentServers))) {
|
|
22386
|
-
widened.push("capabilityPolicy.userMcpServers");
|
|
22387
|
-
}
|
|
22388
|
-
return widened;
|
|
22389
|
-
}
|
|
22390
|
-
|
|
22391
22772
|
// ../../bridges/claude-bridge/src/routes/session-close.ts
|
|
22392
22773
|
function registerSessionCloseRoute(app) {
|
|
22393
22774
|
app.post("/:id/close", async (c) => {
|
|
@@ -23268,6 +23649,10 @@ session.post("/create", async (c) => {
|
|
|
23268
23649
|
};
|
|
23269
23650
|
return c.json(response, 201);
|
|
23270
23651
|
} catch (error) {
|
|
23652
|
+
if (error instanceof PolicyWideningRefusedError) {
|
|
23653
|
+
log21.warn("session.policy-widening-refused", { widened: error.widened.join(",") });
|
|
23654
|
+
return c.json(error.refusal(), 403);
|
|
23655
|
+
}
|
|
23271
23656
|
log21.error("session.create-failed", { error: formatLogError(error) });
|
|
23272
23657
|
return c.json({ error: error instanceof Error ? error.message : "Failed to create session" }, 500);
|
|
23273
23658
|
}
|
|
@@ -23421,11 +23806,7 @@ session.post("/:id/config", async (c) => {
|
|
|
23421
23806
|
sessionId: sessionData.id,
|
|
23422
23807
|
widened: widened.join(",")
|
|
23423
23808
|
});
|
|
23424
|
-
return c.json(
|
|
23425
|
-
error: "Execution policy can only be narrowed on a live session; a wider policy applies after the agent bridge restarts.",
|
|
23426
|
-
code: "policy-widening-refused",
|
|
23427
|
-
widened
|
|
23428
|
-
}, 403);
|
|
23809
|
+
return c.json(policyWideningRefusal(widened), 403);
|
|
23429
23810
|
}
|
|
23430
23811
|
};
|
|
23431
23812
|
const refusal = refusePolicyWidening();
|
|
@@ -24884,6 +25265,9 @@ function installFatalRejectionGuard(options) {
|
|
|
24884
25265
|
try {
|
|
24885
25266
|
warn(`${options.label} Unhandled promise rejection (continuing): ${describe(reason)}`);
|
|
24886
25267
|
} catch {}
|
|
25268
|
+
try {
|
|
25269
|
+
options.onRejection?.(reason);
|
|
25270
|
+
} catch {}
|
|
24887
25271
|
};
|
|
24888
25272
|
target.on("unhandledRejection", handler);
|
|
24889
25273
|
return () => {
|
|
@@ -24891,6 +25275,15 @@ function installFatalRejectionGuard(options) {
|
|
|
24891
25275
|
};
|
|
24892
25276
|
}
|
|
24893
25277
|
|
|
25278
|
+
// ../protocol/src/node/process-failure-log.ts
|
|
25279
|
+
var log25 = createLogger("process");
|
|
25280
|
+
function logUnhandledRejection(reason) {
|
|
25281
|
+
log25.throttled("error", "rejection.unhandled", {
|
|
25282
|
+
error: reason,
|
|
25283
|
+
fields: () => ({ error: formatLogError(reason, { message: false }) })
|
|
25284
|
+
});
|
|
25285
|
+
}
|
|
25286
|
+
|
|
24894
25287
|
// ../../node_modules/.bun/@hono+node-server@2.1.5+c539cad7f494f5c9/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
|
|
24895
25288
|
var X_ALREADY_SENT = "x-hono-already-sent";
|
|
24896
25289
|
|
|
@@ -26376,11 +26769,11 @@ var serve = (options, listeningListener) => {
|
|
|
26376
26769
|
};
|
|
26377
26770
|
|
|
26378
26771
|
// ../../bridges/claude-bridge/src/index.ts
|
|
26379
|
-
var
|
|
26772
|
+
var log26 = createLogger("bridge.claude");
|
|
26380
26773
|
configureBridgeLogger();
|
|
26381
26774
|
var app = new Hono2;
|
|
26382
26775
|
app.onError((error, c) => {
|
|
26383
|
-
|
|
26776
|
+
log26.error("http.request-failed", {
|
|
26384
26777
|
method: c.req.method,
|
|
26385
26778
|
path: c.req.path,
|
|
26386
26779
|
error: formatLogError(error)
|
|
@@ -26503,13 +26896,13 @@ app.get("/", (c) => {
|
|
|
26503
26896
|
}
|
|
26504
26897
|
});
|
|
26505
26898
|
});
|
|
26506
|
-
installFatalRejectionGuard({ label: "[claude-bridge]" });
|
|
26899
|
+
installFatalRejectionGuard({ label: "[claude-bridge]", onRejection: logUnhandledRejection });
|
|
26507
26900
|
var parentPid = parseParentPid(process.env[PARENT_PID_ENV]);
|
|
26508
26901
|
if (parentPid !== null) {
|
|
26509
26902
|
startParentWatchdog({
|
|
26510
26903
|
parentPid,
|
|
26511
26904
|
onParentExit: () => {
|
|
26512
|
-
|
|
26905
|
+
log26.warn("parent.gone", { parentPid });
|
|
26513
26906
|
process.exit(0);
|
|
26514
26907
|
}
|
|
26515
26908
|
});
|
|
@@ -26520,13 +26913,13 @@ function startBridgeServer(env = process.env, start = serve) {
|
|
|
26520
26913
|
}
|
|
26521
26914
|
const port = parseInt(env.PORT || "4097", 10);
|
|
26522
26915
|
const hostname = env.HOSTNAME || "0.0.0.0";
|
|
26523
|
-
|
|
26916
|
+
log26.debug("server.starting", { hostname, port });
|
|
26524
26917
|
const server = start({
|
|
26525
26918
|
fetch: app.fetch,
|
|
26526
26919
|
port,
|
|
26527
26920
|
hostname
|
|
26528
26921
|
});
|
|
26529
|
-
|
|
26922
|
+
log26.info("server.listening", { hostname, port });
|
|
26530
26923
|
return server;
|
|
26531
26924
|
}
|
|
26532
26925
|
var __testing = {
|