orkestrator 2.36.1 → 2.36.3-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 +444 -68
- package/dist/main.js +173063 -163635
- package/package.json +3 -3
- package/resources/acp-bridge/dist/index.js +686 -433
- package/resources/claude-bridge/dist/index.js +633 -152
- package/resources/codex-bridge/dist/index.js +1972 -1263
- package/resources/cursor-bridge/dist/index.js +620 -46
- package/resources/cursor-bridge/runtime/install.json +1 -1
- package/resources/pi-bridge/dist/index.js +791 -108
- 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: {
|
|
@@ -412,6 +487,7 @@ var ENVIRONMENT_LOG_AREAS = defineLogAreas({
|
|
|
412
487
|
"status.docker-error": "A transient Docker error stopped a status read, so the stored status is kept.",
|
|
413
488
|
"setup.clear-launch-failed": "A pending agent launch could not be cleared after setup failed.",
|
|
414
489
|
"setup.record-failure-failed": "A setup failure before its first attempt could not be recorded.",
|
|
490
|
+
"setup.tab-publish-failed": "The setup terminal's tab could not be published.",
|
|
415
491
|
"lifecycle.failed": "Starting, rebuilding or recreating an environment failed; `operation` says which.",
|
|
416
492
|
"tab-teardown.pending": "A tab's teardown failed and stays pending; the reconcile sweep retries.",
|
|
417
493
|
"tab-reconcile.skipped": "Orphaned tab reconciliation was skipped because pane layouts are unreadable.",
|
|
@@ -448,6 +524,8 @@ var GATEWAY_LOG_AREAS = defineLogAreas({
|
|
|
448
524
|
"loopback.unavailable": "The loopback client listener could not start.",
|
|
449
525
|
"auth-token.stored": "The gateway token's file was written. The path only, never the token.",
|
|
450
526
|
"auth-token.persist-failed": "The gateway token could not be saved.",
|
|
527
|
+
"auth-guess.throttled": "A listener saw enough different wrong tokens that it now pauses new ones. Never the values.",
|
|
528
|
+
"host.refused": "A request named a host this gateway does not answer to. Logged once per name, up to a limit.",
|
|
451
529
|
"port.fallback": "The preferred port was taken, so a nearby one is used.",
|
|
452
530
|
"port.fallback-distant": "The preferred port and those nearby were taken, so another is used.",
|
|
453
531
|
"request.failed": "A gateway request failed. Throttled: repeats are counted, not written.",
|
|
@@ -491,6 +569,22 @@ var LOCAL_SERVER_LOG_AREAS = defineLogAreas({
|
|
|
491
569
|
"bridge-runtime.installed": "A bridge runtime finished installing.",
|
|
492
570
|
"opencode.database-lost-retrying": "OpenCode lost its shared database at startup, so it is retried.",
|
|
493
571
|
"server.stopping": "A local server is being stopped, for the fixed `reason` given.",
|
|
572
|
+
"bridge.started": {
|
|
573
|
+
description: "A local bridge process was spawned; `key` names its kind and environment.",
|
|
574
|
+
essential: true,
|
|
575
|
+
fields: { key: "label", pid: "number" }
|
|
576
|
+
},
|
|
577
|
+
"bridge.exited": {
|
|
578
|
+
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.",
|
|
579
|
+
essential: true,
|
|
580
|
+
fields: {
|
|
581
|
+
key: "label",
|
|
582
|
+
pid: "number",
|
|
583
|
+
code: "number",
|
|
584
|
+
signal: "label",
|
|
585
|
+
requested: "boolean"
|
|
586
|
+
}
|
|
587
|
+
},
|
|
494
588
|
"reaper.tmux-list-failed": "Orphaned claude-tmux sessions could not be listed.",
|
|
495
589
|
"reaper.tmux-kill-failed": "An orphaned tmux session could not be killed.",
|
|
496
590
|
"reaper.tmux-reaped": "Orphaned claude-tmux sessions of a deleted environment were killed.",
|
|
@@ -524,13 +618,29 @@ var LOGGING_LOG_AREAS = defineLogAreas({
|
|
|
524
618
|
"capture.started": "Saving logs to disk began for this process.",
|
|
525
619
|
"capture.stopped": "Saving logs to disk stopped for this process.",
|
|
526
620
|
"config.invalid": "A logging environment variable held a value that was ignored.",
|
|
527
|
-
"entries.dropped":
|
|
621
|
+
"entries.dropped": {
|
|
622
|
+
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.",
|
|
623
|
+
essential: true,
|
|
624
|
+
fields: { entries: "number", bytes: "number", reason: "label" }
|
|
625
|
+
},
|
|
626
|
+
"essential.started": {
|
|
627
|
+
description: "This process began writing the essential log. One with no `essential.stopped` before it means the last writer died.",
|
|
628
|
+
essential: true,
|
|
629
|
+
fields: { owner: "label" }
|
|
630
|
+
},
|
|
631
|
+
"essential.stopped": {
|
|
632
|
+
description: "This process stopped writing the essential log, in an orderly exit.",
|
|
633
|
+
essential: true,
|
|
634
|
+
fields: { owner: "label" }
|
|
635
|
+
},
|
|
636
|
+
"essential.write-failed": "Writing the essential log failed. Its entries are counted, and a marker reports them at the next write that works.",
|
|
528
637
|
"policy.changed": "The logging settings changed: saving, retention and levels, with no content.",
|
|
529
638
|
"policy.bridge-predates-route": "A running bridge has no logging settings route; it applies them at its next start.",
|
|
530
639
|
"policy.push-failed": "A running bridge did not take the logging settings after retries; its next start resends them.",
|
|
531
640
|
"prune.failed": "Removing expired log files failed; the next sweep retries.",
|
|
532
641
|
"write.failed": "Appending to the log file failed.",
|
|
533
|
-
"unknown-area": "Code outside the type checker asked for an area that is not listed."
|
|
642
|
+
"unknown-area": "Code outside the type checker asked for an area that is not listed.",
|
|
643
|
+
...THROTTLE_LOG_EVENTS
|
|
534
644
|
}
|
|
535
645
|
}
|
|
536
646
|
});
|
|
@@ -585,6 +695,7 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
585
695
|
"turn-recovery.failed": "Recovering an incomplete turn failed.",
|
|
586
696
|
"turn-recovery.exhausted": "A turn failed again after automatic recovery and is left for the user.",
|
|
587
697
|
"turn-recovery.retrying": "An incomplete or provider-failed turn is being retried automatically.",
|
|
698
|
+
"usage-limit.notice-failed": "A usage-limit stop's outcome could not be read for its notice.",
|
|
588
699
|
"usage-limit.resend-failed": "Resending after a usage limit failed. An unknown send stays in the journal.",
|
|
589
700
|
"title.strategy-failed": "A session title strategy failed, so the next is tried. Content-free: the error can quote the prompt.",
|
|
590
701
|
...THROTTLE_LOG_EVENTS
|
|
@@ -601,6 +712,15 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
|
|
|
601
712
|
"recover.failed": "Goals could not be recovered at startup."
|
|
602
713
|
}
|
|
603
714
|
},
|
|
715
|
+
"native-agent.subork": {
|
|
716
|
+
description: "Suborks: the ask_agents calls a native agent makes. Content-free.",
|
|
717
|
+
events: {
|
|
718
|
+
"pass.failed": "A pass over a call failed, so a later pass retries. Counts only.",
|
|
719
|
+
"delivery.failed": "A call's answers could not be placed in the caller's mailbox yet. Error class only.",
|
|
720
|
+
"retention.failed": "An old call could not be removed.",
|
|
721
|
+
"sweep.failed": "A running call's caller could not be checked; the next sweep looks again."
|
|
722
|
+
}
|
|
723
|
+
},
|
|
604
724
|
"native-agent.opencode": {
|
|
605
725
|
description: "The OpenCode provider: its request monitor, retries and agent tools.",
|
|
606
726
|
events: {
|
|
@@ -655,7 +775,28 @@ var RUNTIME_LOG_AREAS = defineLogAreas({
|
|
|
655
775
|
"event-loop": {
|
|
656
776
|
description: "This process's event loop. A stall of 10 seconds or more is written at error, so no level hides it.",
|
|
657
777
|
events: {
|
|
658
|
-
stalled:
|
|
778
|
+
stalled: {
|
|
779
|
+
description: "A timer fired late, so every request in that window waited.",
|
|
780
|
+
essential: true,
|
|
781
|
+
minLevel: "error",
|
|
782
|
+
fields: { lagMs: "number", intervalMs: "number" }
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
},
|
|
786
|
+
process: {
|
|
787
|
+
description: "Failures of a whole process that nothing in it handled.",
|
|
788
|
+
events: {
|
|
789
|
+
"rejection.unhandled": {
|
|
790
|
+
description: "A promise rejection reached the fatal rejection guard, which keeps the process running.",
|
|
791
|
+
essential: true,
|
|
792
|
+
fields: { kind: "label", ...ESSENTIAL_ERROR_FIELDS }
|
|
793
|
+
},
|
|
794
|
+
"uncaught-exception": {
|
|
795
|
+
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.",
|
|
796
|
+
essential: true,
|
|
797
|
+
fields: { origin: "label", ...ESSENTIAL_ERROR_FIELDS }
|
|
798
|
+
},
|
|
799
|
+
...THROTTLE_LOG_EVENTS
|
|
659
800
|
}
|
|
660
801
|
}
|
|
661
802
|
});
|
|
@@ -893,21 +1034,43 @@ var STORAGE_LOG_AREAS = defineLogAreas({
|
|
|
893
1034
|
description: "The SQLite-backed stores, their snapshots and imports from older formats.",
|
|
894
1035
|
events: {
|
|
895
1036
|
"usage.environment-label-failed": "Usage labels could not be retained for a removed environment; deletion continues.",
|
|
896
|
-
"
|
|
1037
|
+
"migration.failed": {
|
|
1038
|
+
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.",
|
|
1039
|
+
essential: true,
|
|
1040
|
+
fields: {
|
|
1041
|
+
fromVersion: "number",
|
|
1042
|
+
toVersion: "number",
|
|
1043
|
+
step: "label",
|
|
1044
|
+
...ESSENTIAL_ERROR_FIELDS
|
|
1045
|
+
}
|
|
1046
|
+
},
|
|
1047
|
+
"snapshot.integrity-failed": {
|
|
1048
|
+
description: "A database snapshot failed its integrity check and was discarded.",
|
|
1049
|
+
essential: true,
|
|
1050
|
+
fields: {}
|
|
1051
|
+
},
|
|
897
1052
|
"snapshot.skipped-low-disk": "The hourly database snapshot was skipped because the disk lacks room; `retryAt` says when it tries again.",
|
|
898
|
-
"snapshot.failed":
|
|
1053
|
+
"snapshot.failed": {
|
|
1054
|
+
description: "The hourly database snapshot failed; `retryAt` says when it tries again, if known.",
|
|
1055
|
+
essential: true,
|
|
1056
|
+
fields: { retryAt: "label", ...ESSENTIAL_ERROR_FIELDS }
|
|
1057
|
+
},
|
|
899
1058
|
"listener.attention-failed": "An environment attention listener threw; the committed mutation stands.",
|
|
900
1059
|
"listener.change-failed": "A resource change listener threw; the committed mutation stands.",
|
|
901
1060
|
"kanban.image-cleanup-failed": "An orphaned Kanban image could not be removed after its retries; it is safe to remove later.",
|
|
902
1061
|
"nodes.entries-dropped": "Unreadable node registry entries were ignored.",
|
|
903
1062
|
"preview-identity.reminted": "The data directory moved or was copied, so previews get a new backend identity.",
|
|
1063
|
+
"preview-settings.invalid": "Invalid preview settings disabled transport and relay.",
|
|
904
1064
|
"machine-profile.invalid": "The stored machine profile was invalid and the default was restored.",
|
|
905
1065
|
"permission-rules.cleanup-failed": "A deleted project's permission rules could not be removed.",
|
|
906
1066
|
"retired.turn-cleanup-pending": "Cleanup of a retired Looped Review turn did not finish and stays pending.",
|
|
907
1067
|
"handoffs.prune-failed": "Pruning agent handoffs that nothing references failed; a later prune retries.",
|
|
908
1068
|
"desktop-connections.malformed": "Stored desktop connection settings were malformed, so the local connection is used.",
|
|
909
1069
|
"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."
|
|
1070
|
+
"legacy-json.archive-failed": "Imported JSON store files could not be archived.",
|
|
1071
|
+
"lease.heartbeat-failed": "A held lease's heartbeat failed, which shortens the lease; the next one retries.",
|
|
1072
|
+
"scrub.checkpoint-failed": "Deleted content could not be scrubbed from the WAL because the truncating checkpoint failed or was blocked; the next checkpoint retries.",
|
|
1073
|
+
...THROTTLE_LOG_EVENTS
|
|
911
1074
|
}
|
|
912
1075
|
}
|
|
913
1076
|
});
|
|
@@ -998,6 +1161,11 @@ var COORDINATOR_LOG_AREAS = defineLogAreas({
|
|
|
998
1161
|
"wake.observe-pull-request-failed": "A pull request could not be observed for status wakes.",
|
|
999
1162
|
"wake.observe-feature-plan-failed": "A feature plan could not be observed for status wakes.",
|
|
1000
1163
|
"wake.observe-workflow-failed": "A workflow could not be observed for status wakes.",
|
|
1164
|
+
"notice.outbox-refused": "A leaf's outbox refused a coordinator notice, so its own coordinator takes it.",
|
|
1165
|
+
"notice.start-main-failed": "A coordinator notice could not start a main coordinator; it waits for one to open.",
|
|
1166
|
+
"notice.take-back-unread": "A notice handed back from a command node found no open coordinator here.",
|
|
1167
|
+
"limit-stop.own": "A coordinator's own usage-limit stop attempted to move it off the account.",
|
|
1168
|
+
"limit-stop.notice-failed": "A usage-limit notice could not be sent; it stays in the ledger for the next attempt.",
|
|
1001
1169
|
"wake.deliver-failed": "A workflow status wake could not be delivered; the next pass retries.",
|
|
1002
1170
|
"wake.waiting-check-failed": "A waiting worker could not be checked; the next pass retries.",
|
|
1003
1171
|
"wake.resolve-report-failed": "A finished Resolve tab could not be reported.",
|
|
@@ -1015,8 +1183,10 @@ var COORDINATOR_LOG_AREAS = defineLogAreas({
|
|
|
1015
1183
|
"remote-worker.settle-failed": "A remote worker could not be settled.",
|
|
1016
1184
|
"checkout.merge-followed": "After an environment's PR merged, the project checkout was fast-forwarded, or `outcome` says why not.",
|
|
1017
1185
|
"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."
|
|
1186
|
+
"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`).",
|
|
1187
|
+
"checkout.mail-follow-failed": "Before mail woke the main coordinator, checking whether to fast-forward the project checkout failed; the mail was delivered anyway.",
|
|
1188
|
+
"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`.",
|
|
1189
|
+
"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
1190
|
}
|
|
1021
1191
|
}
|
|
1022
1192
|
});
|
|
@@ -1026,15 +1196,15 @@ var REVIEW_LOG_AREAS = defineLogAreas({
|
|
|
1026
1196
|
review: {
|
|
1027
1197
|
description: "Multi Review workflows: scheduling, graph runs and interactive fix sessions.",
|
|
1028
1198
|
events: {
|
|
1029
|
-
"fix-tab.publish-failed": "A
|
|
1199
|
+
"fix-tab.publish-failed": "A Address Findings request was delivered but its tab could not be opened; the user is told.",
|
|
1030
1200
|
"graph-run.not-started": "A workflow's graph run did not start.",
|
|
1031
1201
|
"reconcile.scan-failed": "A reconciliation scan failed; the next scan retries.",
|
|
1032
1202
|
"graph-engine.unavailable": "The graph engine is selected but unavailable, so the bespoke engine runs.",
|
|
1033
1203
|
"graph-run.cancel-failed": "Cancelling a graph run failed; the next pass projects how it ended.",
|
|
1034
1204
|
"delete.cleanup-failed": "A cleanup step after deleting a workflow failed; stale tabs reconcile away on hydration.",
|
|
1035
|
-
"fix-session.read-failed": "Reading an interactive
|
|
1205
|
+
"fix-session.read-failed": "Reading an interactive Address Findings session's state failed.",
|
|
1036
1206
|
"fix-outcome.read-failed": "Reading an interactive fix's outcome failed; it stays pending.",
|
|
1037
|
-
"fix-usage.read-failed": "Reading
|
|
1207
|
+
"fix-usage.read-failed": "Reading an Address Findings session's token usage failed.",
|
|
1038
1208
|
"result.consume-deferred": "Consuming a workflow result failed; it stays staged and is retried.",
|
|
1039
1209
|
"failure-triage.failed": "Classifying a review package's failing tests failed; the package is sealed without the triage and says so."
|
|
1040
1210
|
}
|
|
@@ -1087,6 +1257,7 @@ var AGENT_ACCOUNTS_LOG_AREAS = defineLogAreas({
|
|
|
1087
1257
|
"agent-accounts": {
|
|
1088
1258
|
description: "Agent accounts: automatic switching, staged logins and plan usage.",
|
|
1089
1259
|
events: {
|
|
1260
|
+
"limit-stop-notice.failed": "A session's usage-limit stop could not be reported.",
|
|
1090
1261
|
"switch-notice.failed": "A notice about an automatic account switch failed; the switch stands. `audience` says whose.",
|
|
1091
1262
|
"auto-switch.check-failed": "An automatic account check failed; the next nudge retries.",
|
|
1092
1263
|
"container-sync.failed": "Handing a login or account to a container failed; `step` says which part.",
|
|
@@ -1105,6 +1276,17 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
1105
1276
|
description: "Docker containers: lifecycle, starts, staged inputs and the login files they hold.",
|
|
1106
1277
|
events: {
|
|
1107
1278
|
"portable-inputs.relay-missing": "Docker is rootless and the image predates the staged-input relay, so the container cannot read them until rebuilt.",
|
|
1279
|
+
"git-mirror.mount-unavailable": "A new container gets no project Git mirror, so its clone goes to the remote.",
|
|
1280
|
+
"git-mirror.refreshed": "A project's Git mirror was built or updated.",
|
|
1281
|
+
"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.",
|
|
1282
|
+
"git-mirror.low-disk": "A project's Git mirror was not updated: the disk is nearly full.",
|
|
1283
|
+
"git-mirror.oversized": "A project's repository is too large for a Git mirror, so its environments keep the blobless clone.",
|
|
1284
|
+
"git-mirror.compact-failed": "A project's Git mirror could not be compacted.",
|
|
1285
|
+
"git-mirror.state-write-failed": "A project's Git mirror could not be marked for checking.",
|
|
1286
|
+
"git-mirror.remove-failed": "A project's Git mirror could not be removed; a sweep retries.",
|
|
1287
|
+
"git-mirror.orphans-removed": "Git mirrors of removed projects were removed.",
|
|
1288
|
+
"git-mirror.clone-used": "A new environment cloned from its project's Git mirror.",
|
|
1289
|
+
"git-mirror.clone-fallback": "A new environment could not clone from its project's Git mirror and cloned from the remote.",
|
|
1108
1290
|
"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.",
|
|
1109
1291
|
"opencode.warm-incomplete": "OpenCode did not finish loading /workspace in a container.",
|
|
1110
1292
|
"lifecycle-event.reconcile-failed": "Reconciling an environment after a container start or stop event failed; the next status read retries.",
|
|
@@ -1119,7 +1301,27 @@ var DOCKER_LOG_AREAS = defineLogAreas({
|
|
|
1119
1301
|
"recovery.clear-terminals-failed": "Terminal sessions could not be cleared after a recovery restore.",
|
|
1120
1302
|
"github-ranges.seed-not-copied": "The GitHub ranges seed could not be copied into a container, so its firewall fetches them.",
|
|
1121
1303
|
"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."
|
|
1304
|
+
"start.port-collision-retrying": "An automatic host port collided on start, so it is retried once with fresh ports.",
|
|
1305
|
+
"writer-lease.lost": {
|
|
1306
|
+
description: "This backend lost the registry writer lease, for the fixed `reason` given. Schedules stop and container changes are refused until it restarts.",
|
|
1307
|
+
essential: true,
|
|
1308
|
+
fields: { reason: "label" }
|
|
1309
|
+
},
|
|
1310
|
+
"writer-lease.regained": {
|
|
1311
|
+
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.",
|
|
1312
|
+
essential: true,
|
|
1313
|
+
fields: { staleForMs: "number" }
|
|
1314
|
+
},
|
|
1315
|
+
"writer-lease.not-acquired": {
|
|
1316
|
+
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.",
|
|
1317
|
+
essential: true,
|
|
1318
|
+
fields: { reason: "label" }
|
|
1319
|
+
},
|
|
1320
|
+
"bridge.launched": {
|
|
1321
|
+
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.",
|
|
1322
|
+
essential: true,
|
|
1323
|
+
fields: { provider: "label", containerPort: "number" }
|
|
1324
|
+
}
|
|
1123
1325
|
}
|
|
1124
1326
|
},
|
|
1125
1327
|
"docker.reachability": {
|
|
@@ -1233,8 +1435,12 @@ var NODES_LOG_AREAS = defineLogAreas({
|
|
|
1233
1435
|
nodes: {
|
|
1234
1436
|
description: "Command nodes: links, handovers, leaf mail, ticket sync and project copies.",
|
|
1235
1437
|
events: {
|
|
1438
|
+
...THROTTLE_LOG_EVENTS,
|
|
1236
1439
|
"actions.resume-failed": "Approved actions could not be resumed; a later pass retries.",
|
|
1237
1440
|
"project-copy.notify-failed": "The coordinator could not be told a project copy finished.",
|
|
1441
|
+
"mail.return-deferred": "The leaf refused returned mail; it remains queued for retry.",
|
|
1442
|
+
"notices.take-back-failed": "A notice for this node's coordinator stayed in the outbox.",
|
|
1443
|
+
"notice.collected-retired": "A detached controller owned a notice with ambiguous delivery; retired without redelivery.",
|
|
1238
1444
|
"mail.delivery-deferred": "Leaf mail could not reach a coordinator yet.",
|
|
1239
1445
|
"command.post-step-failed": "A step after a routed command failed.",
|
|
1240
1446
|
"seed-files.incomplete": "Seed files for a leaf environment were not all copied.",
|
|
@@ -1750,6 +1956,7 @@ var WEB_SYNC_LOG_AREAS = defineLogAreas({
|
|
|
1750
1956
|
"web.read-coordinator": {
|
|
1751
1957
|
description: "The renderer's coalesced, bounded backend reads.",
|
|
1752
1958
|
events: {
|
|
1959
|
+
"poll.read-failed": "A coordinated poll's read failed; it stays on its interval.",
|
|
1753
1960
|
"listener.threw": "A read state listener threw.",
|
|
1754
1961
|
"read.settle-failed": "Applying a finished read's result threw."
|
|
1755
1962
|
}
|
|
@@ -2005,6 +2212,146 @@ function logErrorKind(error) {
|
|
|
2005
2212
|
return matching(read(error, "name"), NAME_PATTERN) ?? "Error";
|
|
2006
2213
|
}
|
|
2007
2214
|
|
|
2215
|
+
// ../protocol/src/log-essential-labels.ts
|
|
2216
|
+
var ERROR_NAMES = new Set([
|
|
2217
|
+
"Error",
|
|
2218
|
+
"TypeError",
|
|
2219
|
+
"RangeError",
|
|
2220
|
+
"ReferenceError",
|
|
2221
|
+
"SyntaxError",
|
|
2222
|
+
"URIError",
|
|
2223
|
+
"EvalError",
|
|
2224
|
+
"AggregateError",
|
|
2225
|
+
"AbortError",
|
|
2226
|
+
"TimeoutError",
|
|
2227
|
+
"SystemError"
|
|
2228
|
+
]);
|
|
2229
|
+
var ERROR_CODES = new Set([
|
|
2230
|
+
"EACCES",
|
|
2231
|
+
"EADDRINUSE",
|
|
2232
|
+
"EADDRNOTAVAIL",
|
|
2233
|
+
"EAGAIN",
|
|
2234
|
+
"EBADF",
|
|
2235
|
+
"EBUSY",
|
|
2236
|
+
"ECANCELED",
|
|
2237
|
+
"ECONNABORTED",
|
|
2238
|
+
"ECONNREFUSED",
|
|
2239
|
+
"ECONNRESET",
|
|
2240
|
+
"EEXIST",
|
|
2241
|
+
"EHOSTUNREACH",
|
|
2242
|
+
"EINTR",
|
|
2243
|
+
"EINVAL",
|
|
2244
|
+
"EIO",
|
|
2245
|
+
"EISDIR",
|
|
2246
|
+
"EMFILE",
|
|
2247
|
+
"ENETUNREACH",
|
|
2248
|
+
"ENFILE",
|
|
2249
|
+
"ENOENT",
|
|
2250
|
+
"ENOMEM",
|
|
2251
|
+
"ENOSPC",
|
|
2252
|
+
"ENOSYS",
|
|
2253
|
+
"ENOTDIR",
|
|
2254
|
+
"ENOTEMPTY",
|
|
2255
|
+
"ENOTFOUND",
|
|
2256
|
+
"EPERM",
|
|
2257
|
+
"EPIPE",
|
|
2258
|
+
"EROFS",
|
|
2259
|
+
"ETIMEDOUT",
|
|
2260
|
+
"EXDEV",
|
|
2261
|
+
"SQLITE_BUSY",
|
|
2262
|
+
"SQLITE_CORRUPT",
|
|
2263
|
+
"SQLITE_FULL",
|
|
2264
|
+
"SQLITE_IOERR",
|
|
2265
|
+
"SQLITE_NOTADB",
|
|
2266
|
+
"SQLITE_READONLY",
|
|
2267
|
+
"ERR_CANCELED",
|
|
2268
|
+
"ERR_STREAM_DESTROYED"
|
|
2269
|
+
]);
|
|
2270
|
+
var SYSCALLS = new Set([
|
|
2271
|
+
"open",
|
|
2272
|
+
"read",
|
|
2273
|
+
"write",
|
|
2274
|
+
"stat",
|
|
2275
|
+
"lstat",
|
|
2276
|
+
"mkdir",
|
|
2277
|
+
"rmdir",
|
|
2278
|
+
"readdir",
|
|
2279
|
+
"rename",
|
|
2280
|
+
"unlink",
|
|
2281
|
+
"fsync",
|
|
2282
|
+
"fdatasync",
|
|
2283
|
+
"close",
|
|
2284
|
+
"access",
|
|
2285
|
+
"chmod",
|
|
2286
|
+
"copyfile",
|
|
2287
|
+
"connect",
|
|
2288
|
+
"listen",
|
|
2289
|
+
"bind",
|
|
2290
|
+
"spawn",
|
|
2291
|
+
"kill",
|
|
2292
|
+
"getaddrinfo"
|
|
2293
|
+
]);
|
|
2294
|
+
var SIGNALS = new Set([
|
|
2295
|
+
"SIGABRT",
|
|
2296
|
+
"SIGALRM",
|
|
2297
|
+
"SIGBUS",
|
|
2298
|
+
"SIGCHLD",
|
|
2299
|
+
"SIGCONT",
|
|
2300
|
+
"SIGFPE",
|
|
2301
|
+
"SIGHUP",
|
|
2302
|
+
"SIGILL",
|
|
2303
|
+
"SIGINT",
|
|
2304
|
+
"SIGKILL",
|
|
2305
|
+
"SIGPIPE",
|
|
2306
|
+
"SIGQUIT",
|
|
2307
|
+
"SIGSEGV",
|
|
2308
|
+
"SIGSTOP",
|
|
2309
|
+
"SIGTERM",
|
|
2310
|
+
"SIGTRAP",
|
|
2311
|
+
"SIGTSTP",
|
|
2312
|
+
"SIGTTIN",
|
|
2313
|
+
"SIGTTOU",
|
|
2314
|
+
"SIGUSR1",
|
|
2315
|
+
"SIGUSR2",
|
|
2316
|
+
"SIGWINCH",
|
|
2317
|
+
"SIGXCPU",
|
|
2318
|
+
"SIGXFSZ"
|
|
2319
|
+
]);
|
|
2320
|
+
var PROVIDERS = new Set(["claude", "codex", "opencode", "cursor", "grok", "acp", "pi"]);
|
|
2321
|
+
var UUID = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
|
|
2322
|
+
var SOURCE = new RegExp(`^(?:claude|codex|opencode|cursor|grok|acp|pi):${UUID}$`, "i");
|
|
2323
|
+
|
|
2324
|
+
// ../protocol/src/log-essential.ts
|
|
2325
|
+
var vocabulary = LOG_VOCABULARY;
|
|
2326
|
+
var UNDECLARED_ERROR_LABELS = new Set([
|
|
2327
|
+
"site",
|
|
2328
|
+
"kind",
|
|
2329
|
+
"step",
|
|
2330
|
+
"reason",
|
|
2331
|
+
"signal",
|
|
2332
|
+
"code"
|
|
2333
|
+
]);
|
|
2334
|
+
function eventSpec(area, event) {
|
|
2335
|
+
const spec = Object.hasOwn(vocabulary, area) ? vocabulary[area] : undefined;
|
|
2336
|
+
if (!spec || !Object.hasOwn(spec.events, event))
|
|
2337
|
+
return null;
|
|
2338
|
+
const definition = spec.events[event];
|
|
2339
|
+
return typeof definition === "object" && definition.essential ? definition : null;
|
|
2340
|
+
}
|
|
2341
|
+
function declaredEssential(area, event, level) {
|
|
2342
|
+
const spec = eventSpec(area, event);
|
|
2343
|
+
return spec && (spec.minLevel !== "error" || level === "error") ? spec : null;
|
|
2344
|
+
}
|
|
2345
|
+
function hasEssentialEvents(area) {
|
|
2346
|
+
const spec = Object.hasOwn(vocabulary, area) ? vocabulary[area] : undefined;
|
|
2347
|
+
return spec !== undefined && Object.values(spec.events).some((event) => typeof event === "object" && event.essential);
|
|
2348
|
+
}
|
|
2349
|
+
function isEssentialEntry(area, event, level) {
|
|
2350
|
+
if (area === "logging" && event === "essential.write-failed")
|
|
2351
|
+
return false;
|
|
2352
|
+
return level === "error" || declaredEssential(area, event, level) !== null;
|
|
2353
|
+
}
|
|
2354
|
+
|
|
2008
2355
|
// ../protocol/src/logger.ts
|
|
2009
2356
|
var LOG_LEVELS = ["error", "warn", "info", "debug", "trace"];
|
|
2010
2357
|
var MAX_FIELD_CHARS = 2048;
|
|
@@ -2049,7 +2396,9 @@ var DEFAULT_CONFIG = {
|
|
|
2049
2396
|
level: "info",
|
|
2050
2397
|
areaLevels: {},
|
|
2051
2398
|
format: "text",
|
|
2052
|
-
sink: consoleSink
|
|
2399
|
+
sink: consoleSink,
|
|
2400
|
+
essentialSink: null,
|
|
2401
|
+
relayEssential: false
|
|
2053
2402
|
};
|
|
2054
2403
|
var config = DEFAULT_CONFIG;
|
|
2055
2404
|
var generation = 0;
|
|
@@ -2160,17 +2509,38 @@ function renderText(record) {
|
|
|
2160
2509
|
function renderJson(record) {
|
|
2161
2510
|
return escapeLogLine(JSON.stringify(record));
|
|
2162
2511
|
}
|
|
2512
|
+
function offerEssential(record) {
|
|
2513
|
+
if (!config.essentialSink || !isEssentialEntry(record.area, record.event, record.level))
|
|
2514
|
+
return;
|
|
2515
|
+
try {
|
|
2516
|
+
config.essentialSink(record);
|
|
2517
|
+
} catch {}
|
|
2518
|
+
}
|
|
2163
2519
|
function deliver(record) {
|
|
2520
|
+
let delivered = true;
|
|
2164
2521
|
try {
|
|
2165
2522
|
config.sink({
|
|
2166
2523
|
method: OUTPUT_METHOD[record.level],
|
|
2167
2524
|
line: config.format === "json" ? renderJson(record) : renderText(record),
|
|
2168
2525
|
record
|
|
2169
2526
|
});
|
|
2170
|
-
return true;
|
|
2171
2527
|
} catch {
|
|
2172
|
-
|
|
2528
|
+
delivered = false;
|
|
2529
|
+
}
|
|
2530
|
+
offerEssential(record);
|
|
2531
|
+
return delivered;
|
|
2532
|
+
}
|
|
2533
|
+
function deliverEssentialOnly(record) {
|
|
2534
|
+
if (config.essentialSink) {
|
|
2535
|
+
offerEssential(record);
|
|
2536
|
+
return;
|
|
2173
2537
|
}
|
|
2538
|
+
if (!config.relayEssential)
|
|
2539
|
+
return;
|
|
2540
|
+
const marked = { ...record, essentialOnly: true };
|
|
2541
|
+
try {
|
|
2542
|
+
config.sink({ method: OUTPUT_METHOD[record.level], line: renderJson(marked), record: marked });
|
|
2543
|
+
} catch {}
|
|
2174
2544
|
}
|
|
2175
2545
|
function buildRecord(level, area, event, fields) {
|
|
2176
2546
|
const clean = fields ? sanitizeFields(fields, areaSpec(area)?.maxStringChars ?? MAX_FIELD_CHARS) : undefined;
|
|
@@ -2335,12 +2705,17 @@ function deliverEvent(level, area, event, fields) {
|
|
|
2335
2705
|
return deliver(buildRecord(level, area, event, fields));
|
|
2336
2706
|
}
|
|
2337
2707
|
function tryWriteLog(level, area, event, fields) {
|
|
2338
|
-
if (LEVEL_RANK[level] > thresholdRank(area))
|
|
2708
|
+
if (LEVEL_RANK[level] > thresholdRank(area)) {
|
|
2709
|
+
if (isEssentialEntry(area, event, level)) {
|
|
2710
|
+
deliverEssentialOnly(buildRecord(level, area, event, resolveFields(fields)));
|
|
2711
|
+
}
|
|
2339
2712
|
return false;
|
|
2713
|
+
}
|
|
2340
2714
|
return deliverEvent(level, area, event, resolveFields(fields));
|
|
2341
2715
|
}
|
|
2342
2716
|
function createLogger(area) {
|
|
2343
2717
|
const spec = areaSpec(area);
|
|
2718
|
+
const mayHoldEssential = hasEssentialEvents(area);
|
|
2344
2719
|
let seenGeneration = -1;
|
|
2345
2720
|
let rank = 0;
|
|
2346
2721
|
const enabled = (level) => {
|
|
@@ -2353,9 +2728,16 @@ function createLogger(area) {
|
|
|
2353
2728
|
const writeResolved = (level, event, resolved) => {
|
|
2354
2729
|
deliverEvent(level, area, event, resolved);
|
|
2355
2730
|
};
|
|
2731
|
+
const writeFiltered = (level, event, fields) => {
|
|
2732
|
+
if (!mayHoldEssential || !isEssentialEntry(area, event, level))
|
|
2733
|
+
return;
|
|
2734
|
+
deliverEssentialOnly(buildRecord(level, area, event, resolveFields(fields)));
|
|
2735
|
+
};
|
|
2356
2736
|
const write = (level, event, fields) => {
|
|
2357
|
-
if (!enabled(level))
|
|
2737
|
+
if (!enabled(level)) {
|
|
2738
|
+
writeFiltered(level, event, fields);
|
|
2358
2739
|
return;
|
|
2740
|
+
}
|
|
2359
2741
|
writeResolved(level, event, resolveFields(fields));
|
|
2360
2742
|
};
|
|
2361
2743
|
return {
|
|
@@ -2366,8 +2748,10 @@ function createLogger(area) {
|
|
|
2366
2748
|
trace: (event, fields) => write("trace", event, fields),
|
|
2367
2749
|
throttled: (level, event, options) => {
|
|
2368
2750
|
syncThrottleLevels();
|
|
2369
|
-
if (!enabled(level))
|
|
2751
|
+
if (!enabled(level)) {
|
|
2752
|
+
writeFiltered(level, event, options.fields);
|
|
2370
2753
|
return;
|
|
2754
|
+
}
|
|
2371
2755
|
if (!spec || !Object.hasOwn(spec.events, event) || event.startsWith("throttle.") || !Object.hasOwn(spec.events, "throttle.recovered")) {
|
|
2372
2756
|
deliver(buildRecord(level, spec ? area : "logging", spec ? "invalid-event" : "unknown-area", undefined));
|
|
2373
2757
|
return;
|
|
@@ -2491,7 +2875,8 @@ function configureLoggerFromEnvironment(env, options = {}) {
|
|
|
2491
2875
|
configureLogger({
|
|
2492
2876
|
...levels.level ? { level: levels.level } : {},
|
|
2493
2877
|
areaLevels: levels.areaLevels,
|
|
2494
|
-
format
|
|
2878
|
+
format,
|
|
2879
|
+
relayEssential: options.relayToSupervisor === true
|
|
2495
2880
|
});
|
|
2496
2881
|
const log = createLogger("logging");
|
|
2497
2882
|
if (levels.invalid.length > 0) {
|
|
@@ -4888,7 +5273,7 @@ var PERMISSION_RULE_PROVIDERS = [
|
|
|
4888
5273
|
"grok",
|
|
4889
5274
|
"pi"
|
|
4890
5275
|
];
|
|
4891
|
-
var
|
|
5276
|
+
var PROVIDERS2 = new Set(PERMISSION_RULE_PROVIDERS);
|
|
4892
5277
|
var KINDS = new Set(PERMISSION_RULE_KINDS);
|
|
4893
5278
|
var SCOPES = new Set(PERMISSION_RULE_SCOPES);
|
|
4894
5279
|
var UNQUOTED_REFUSED = new Set([
|
|
@@ -5160,7 +5545,7 @@ var AGENT_INTERACTION_AUTHORIZATION_KINDS = [
|
|
|
5160
5545
|
];
|
|
5161
5546
|
var INPUT_KINDS = new Set(AGENT_INTERACTION_INPUT_KINDS);
|
|
5162
5547
|
var AUTHORIZATION_KINDS = new Set(AGENT_INTERACTION_AUTHORIZATION_KINDS);
|
|
5163
|
-
var
|
|
5548
|
+
var PROVIDERS3 = new Set(AGENT_INTERACTION_PROVIDERS);
|
|
5164
5549
|
var KINDS2 = new Set(AGENT_INTERACTION_KINDS);
|
|
5165
5550
|
var ORIGINS = new Set(AGENT_INTERACTION_ORIGINS);
|
|
5166
5551
|
var STATES = new Set(AGENT_INTERACTION_STATES);
|
|
@@ -6923,45 +7308,6 @@ function nextTurnGeneration() {
|
|
|
6923
7308
|
turnGenerationCounter += 1;
|
|
6924
7309
|
return turnGenerationCounter;
|
|
6925
7310
|
}
|
|
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
7311
|
// ../protocol/src/native-agent-goal.ts
|
|
6966
7312
|
var NATIVE_AGENT_GOAL_LIMITS = Object.freeze({
|
|
6967
7313
|
objectiveMaxChars: 4000,
|
|
@@ -7421,6 +7767,7 @@ var PROJECTION_FIELD_SET = new Set([
|
|
|
7421
7767
|
"asyncQuestionResponses",
|
|
7422
7768
|
"contextUsage",
|
|
7423
7769
|
"goal",
|
|
7770
|
+
"suborks",
|
|
7424
7771
|
"rateLimits",
|
|
7425
7772
|
"runtime",
|
|
7426
7773
|
"runtimeHealthAuthoritative",
|
|
@@ -7446,6 +7793,7 @@ var OPTIONAL_PROJECTION_FIELD_SET = new Set([
|
|
|
7446
7793
|
"asyncQuestionResponses",
|
|
7447
7794
|
"contextUsage",
|
|
7448
7795
|
"goal",
|
|
7796
|
+
"suborks",
|
|
7449
7797
|
"rateLimits",
|
|
7450
7798
|
"runtime",
|
|
7451
7799
|
"runtimeHealthAuthoritative",
|
|
@@ -7460,7 +7808,135 @@ var OPTIONAL_PROJECTION_FIELD_SET = new Set([
|
|
|
7460
7808
|
"slashCommandCatalogue"
|
|
7461
7809
|
]);
|
|
7462
7810
|
|
|
7811
|
+
// ../protocol/src/execution-policy-narrowing.ts
|
|
7812
|
+
var APPROVALS_STRICTNESS = {
|
|
7813
|
+
"auto-approve": 0,
|
|
7814
|
+
ask: 1,
|
|
7815
|
+
deny: 2
|
|
7816
|
+
};
|
|
7817
|
+
var SANDBOX_STRICTNESS = {
|
|
7818
|
+
none: 0,
|
|
7819
|
+
container: 1,
|
|
7820
|
+
provider: 2
|
|
7821
|
+
};
|
|
7822
|
+
function networkStrictness(value) {
|
|
7823
|
+
return value === "restricted" ? 1 : 0;
|
|
7824
|
+
}
|
|
7825
|
+
function isSubset(candidate, of) {
|
|
7826
|
+
const allowed = new Set(of);
|
|
7827
|
+
return candidate.every((item) => allowed.has(item));
|
|
7828
|
+
}
|
|
7829
|
+
function rawCapabilityDenials(policy) {
|
|
7830
|
+
return [
|
|
7831
|
+
...policy.capabilityPolicy?.deny ?? [],
|
|
7832
|
+
...policy.capabilityPolicy?.extendedDeny ?? []
|
|
7833
|
+
];
|
|
7834
|
+
}
|
|
7835
|
+
function executionPolicyWidenings(current, next) {
|
|
7836
|
+
if (!current)
|
|
7837
|
+
return [];
|
|
7838
|
+
const widened = [];
|
|
7839
|
+
if (next.id !== current.id)
|
|
7840
|
+
widened.push("id");
|
|
7841
|
+
if (APPROVALS_STRICTNESS[next.approvals] < APPROVALS_STRICTNESS[current.approvals]) {
|
|
7842
|
+
widened.push("approvals");
|
|
7843
|
+
}
|
|
7844
|
+
if (SANDBOX_STRICTNESS[next.sandbox] < SANDBOX_STRICTNESS[current.sandbox]) {
|
|
7845
|
+
widened.push("sandbox");
|
|
7846
|
+
}
|
|
7847
|
+
if (next.projectResources && !current.projectResources)
|
|
7848
|
+
widened.push("projectResources");
|
|
7849
|
+
if (networkStrictness(next.networkAccess) < networkStrictness(current.networkAccess)) {
|
|
7850
|
+
widened.push("networkAccess");
|
|
7851
|
+
}
|
|
7852
|
+
if (networkStrictness(next.containerNetworkAccess) < networkStrictness(current.containerNetworkAccess)) {
|
|
7853
|
+
widened.push("containerNetworkAccess");
|
|
7854
|
+
}
|
|
7855
|
+
const currentAllow = current.toolPolicy?.allow;
|
|
7856
|
+
const nextAllow = next.toolPolicy?.allow;
|
|
7857
|
+
const allowNarrows = currentAllow === undefined ? nextAllow === undefined || nextAllow.length === 0 : nextAllow !== undefined && isSubset(nextAllow, currentAllow);
|
|
7858
|
+
if (!allowNarrows)
|
|
7859
|
+
widened.push("toolPolicy.allow");
|
|
7860
|
+
if (!isSubset(current.toolPolicy?.deny ?? [], next.toolPolicy?.deny ?? [])) {
|
|
7861
|
+
widened.push("toolPolicy.deny");
|
|
7862
|
+
}
|
|
7863
|
+
if (!isSubset(rawCapabilityDenials(current), rawCapabilityDenials(next))) {
|
|
7864
|
+
widened.push("capabilityPolicy.deny");
|
|
7865
|
+
}
|
|
7866
|
+
if (!isSubset(next.capabilityPolicy?.allow ?? [], current.capabilityPolicy?.allow ?? [])) {
|
|
7867
|
+
widened.push("capabilityPolicy.allow");
|
|
7868
|
+
}
|
|
7869
|
+
const currentServers = nativeAgentUserMcpGrant(current);
|
|
7870
|
+
const nextServers = nativeAgentUserMcpGrant(next);
|
|
7871
|
+
if (currentServers !== undefined && (nextServers === undefined || !isSubset(nextServers, currentServers))) {
|
|
7872
|
+
widened.push("capabilityPolicy.userMcpServers");
|
|
7873
|
+
}
|
|
7874
|
+
return widened;
|
|
7875
|
+
}
|
|
7876
|
+
var POLICY_WIDENING_REFUSED_CODE = "policy-widening-refused";
|
|
7877
|
+
function policyWideningRefusal(widened) {
|
|
7878
|
+
return {
|
|
7879
|
+
error: "Execution policy can only be narrowed on a live session; a wider policy applies after the agent bridge restarts.",
|
|
7880
|
+
code: POLICY_WIDENING_REFUSED_CODE,
|
|
7881
|
+
widened
|
|
7882
|
+
};
|
|
7883
|
+
}
|
|
7884
|
+
|
|
7885
|
+
class PolicyWideningRefusedError extends Error {
|
|
7886
|
+
widened;
|
|
7887
|
+
constructor(widened) {
|
|
7888
|
+
super(policyWideningRefusal(widened).error);
|
|
7889
|
+
this.widened = widened;
|
|
7890
|
+
this.name = "PolicyWideningRefusedError";
|
|
7891
|
+
}
|
|
7892
|
+
refusal() {
|
|
7893
|
+
return policyWideningRefusal(this.widened);
|
|
7894
|
+
}
|
|
7895
|
+
}
|
|
7896
|
+
function assertExecutionPolicyNotWidened(current, next) {
|
|
7897
|
+
const widened = executionPolicyWidenings(current, next);
|
|
7898
|
+
if (widened.length > 0)
|
|
7899
|
+
throw new PolicyWideningRefusedError(widened);
|
|
7900
|
+
}
|
|
7901
|
+
|
|
7902
|
+
// ../../bridges/claude-bridge/src/services/image-attachment-data.ts
|
|
7903
|
+
var SUPPORTED_IMAGE_MEDIA_TYPES = new Set([
|
|
7904
|
+
"image/jpeg",
|
|
7905
|
+
"image/png",
|
|
7906
|
+
"image/gif",
|
|
7907
|
+
"image/webp"
|
|
7908
|
+
]);
|
|
7909
|
+
var MAX_IMAGE_ATTACHMENT_BYTES = 8 * 1024 * 1024;
|
|
7910
|
+
function decodedBase64ByteLength(value) {
|
|
7911
|
+
const padding = value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0;
|
|
7912
|
+
return value.length / 4 * 3 - padding;
|
|
7913
|
+
}
|
|
7914
|
+
function parseBase64ImageData(value) {
|
|
7915
|
+
let data = value;
|
|
7916
|
+
let mediaType;
|
|
7917
|
+
if (value.startsWith("data:")) {
|
|
7918
|
+
const match = /^data:([^;,]+);base64,([\s\S]+)$/.exec(value);
|
|
7919
|
+
if (!match || !SUPPORTED_IMAGE_MEDIA_TYPES.has(match[1])) {
|
|
7920
|
+
return null;
|
|
7921
|
+
}
|
|
7922
|
+
mediaType = match[1];
|
|
7923
|
+
data = match[2];
|
|
7924
|
+
}
|
|
7925
|
+
const normalized = data.replace(/\s+/g, "");
|
|
7926
|
+
if (normalized.length === 0 || normalized.length % 4 !== 0 || !/^[A-Za-z0-9+/]+={0,2}$/.test(normalized) || decodedBase64ByteLength(normalized) > MAX_IMAGE_ATTACHMENT_BYTES) {
|
|
7927
|
+
return null;
|
|
7928
|
+
}
|
|
7929
|
+
return { data: normalized, mediaType };
|
|
7930
|
+
}
|
|
7931
|
+
// ../../bridges/claude-bridge/src/services/session-manager-runtime.ts
|
|
7932
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
7933
|
+
|
|
7463
7934
|
// ../../bridges/claude-bridge/src/services/runtime-env.ts
|
|
7935
|
+
import { execFile as execFile2 } from "node:child_process";
|
|
7936
|
+
import { mkdtemp, readFile as readFile2 } from "node:fs/promises";
|
|
7937
|
+
import { tmpdir } from "node:os";
|
|
7938
|
+
import path from "node:path";
|
|
7939
|
+
import { promisify } from "node:util";
|
|
7464
7940
|
var GITHUB_CREDENTIAL_FILE_ENV = "ORKESTRATOR_GITHUB_CREDENTIAL_FILE";
|
|
7465
7941
|
var GITHUB_MCP_TOKEN_ENV = "GITHUB_PERSONAL_ACCESS_TOKEN";
|
|
7466
7942
|
var execFileAsync = promisify(execFile2);
|
|
@@ -7602,6 +8078,7 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
|
|
|
7602
8078
|
"address_multi_review",
|
|
7603
8079
|
"adopt_workflow",
|
|
7604
8080
|
"answer_worker_question",
|
|
8081
|
+
"ask_agents",
|
|
7605
8082
|
"cancel_build_pipeline",
|
|
7606
8083
|
"cancel_graph_run",
|
|
7607
8084
|
"cancel_multi_review",
|
|
@@ -7664,6 +8141,7 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
|
|
|
7664
8141
|
"request_project_on_node",
|
|
7665
8142
|
"request_root_changes",
|
|
7666
8143
|
"resolve_conflicts",
|
|
8144
|
+
"restart_build_pipeline_step",
|
|
7667
8145
|
"resume_build_pipeline",
|
|
7668
8146
|
"resume_schedule",
|
|
7669
8147
|
"run_worker_command",
|
|
@@ -9980,6 +10458,12 @@ class ToolTracker {
|
|
|
9980
10458
|
this.tools.set(toolUseId, { ...part, toolUseId, parentTaskUseId });
|
|
9981
10459
|
}
|
|
9982
10460
|
}
|
|
10461
|
+
setSubagentModel(toolUseId, modelId) {
|
|
10462
|
+
const existing = this.tools.get(toolUseId);
|
|
10463
|
+
if (existing && existing.subagentModelId !== modelId) {
|
|
10464
|
+
this.tools.set(toolUseId, { ...existing, subagentModelId: modelId });
|
|
10465
|
+
}
|
|
10466
|
+
}
|
|
9983
10467
|
updateToolResult(toolUseId, result) {
|
|
9984
10468
|
const existing = this.tools.get(toolUseId);
|
|
9985
10469
|
if (existing) {
|
|
@@ -10301,6 +10785,11 @@ function parseMessageContent(message, toolTracker, mcpServerNames, activeTaskIds
|
|
|
10301
10785
|
const providerTimestamp = typeof message.timestamp === "string" && Number.isFinite(Date.parse(message.timestamp)) ? message.timestamp : undefined;
|
|
10302
10786
|
const recordTimestamp = providerTimestamp ?? (timestampFallback && Number.isFinite(Date.parse(timestampFallback)) ? timestampFallback : undefined);
|
|
10303
10787
|
const explicitParentTaskUseId = typeof message.parent_tool_use_id === "string" && message.parent_tool_use_id.length > 0 ? message.parent_tool_use_id : undefined;
|
|
10788
|
+
if (explicitParentTaskUseId && message.type === "assistant") {
|
|
10789
|
+
const subagentModelId = normalizeBackendModelId(message.message?.model);
|
|
10790
|
+
if (subagentModelId)
|
|
10791
|
+
toolTracker?.setSubagentModel(explicitParentTaskUseId, subagentModelId);
|
|
10792
|
+
}
|
|
10304
10793
|
const isUserRecord = message.type === "user";
|
|
10305
10794
|
const rawContent = message.message?.content;
|
|
10306
10795
|
if (typeof rawContent === "string") {
|
|
@@ -14111,6 +14600,21 @@ function subagentParts(records, createdAt) {
|
|
|
14111
14600
|
}
|
|
14112
14601
|
return buildMessageParts(ordered, tracker).slice(-MAX_REHYDRATED_PARTS_PER_CALL);
|
|
14113
14602
|
}
|
|
14603
|
+
function labelSubagentModel(row, parent, records) {
|
|
14604
|
+
const index = row.parts.findIndex((part) => part.toolUseId === parent);
|
|
14605
|
+
if (index < 0 || row.parts[index].subagentModelId)
|
|
14606
|
+
return;
|
|
14607
|
+
for (let at = records.length - 1;at >= 0; at -= 1) {
|
|
14608
|
+
const record = records[at];
|
|
14609
|
+
if (record.type !== "assistant")
|
|
14610
|
+
continue;
|
|
14611
|
+
const subagentModelId = normalizeBackendModelId(record.message?.model);
|
|
14612
|
+
if (subagentModelId) {
|
|
14613
|
+
row.parts[index] = { ...row.parts[index], subagentModelId };
|
|
14614
|
+
return;
|
|
14615
|
+
}
|
|
14616
|
+
}
|
|
14617
|
+
}
|
|
14114
14618
|
async function rehydrateSubagentParts(sdk, sdkSessionId, dir, messages) {
|
|
14115
14619
|
if (typeof sdk.listSubagents !== "function" || typeof sdk.getSubagentMessages !== "function") {
|
|
14116
14620
|
return;
|
|
@@ -14134,6 +14638,7 @@ async function rehydrateSubagentParts(sdk, sdkSessionId, dir, messages) {
|
|
|
14134
14638
|
unplaced.push(entry);
|
|
14135
14639
|
continue;
|
|
14136
14640
|
}
|
|
14641
|
+
labelSubagentModel(row, entry.parent, entry.records);
|
|
14137
14642
|
if (row.parts.some((part) => part.parentTaskUseId === entry.parent))
|
|
14138
14643
|
continue;
|
|
14139
14644
|
const parts = subagentParts(entry.records, row.createdAt);
|
|
@@ -15028,7 +15533,10 @@ async function createOrRecoverSession(title, clientSessionKey, policy) {
|
|
|
15028
15533
|
if (stableId) {
|
|
15029
15534
|
const existing = sessions.get(stableId) ?? await ensurePersistedSession(stableId);
|
|
15030
15535
|
if (existing) {
|
|
15031
|
-
|
|
15536
|
+
if (policy) {
|
|
15537
|
+
assertExecutionPolicyNotWidened(existing.executionPolicy, policy);
|
|
15538
|
+
existing.executionPolicy = policy;
|
|
15539
|
+
}
|
|
15032
15540
|
return existing;
|
|
15033
15541
|
}
|
|
15034
15542
|
journal = await stableIdDispatchJournal(stableId);
|
|
@@ -16375,6 +16883,8 @@ import { join as join11 } from "node:path";
|
|
|
16375
16883
|
var AGENT_MAIL_MAX_BODY_BYTES = 32 * 1024;
|
|
16376
16884
|
var AGENT_MAIL_MAX_STORE_BYTES = 32 * 1024 * 1024;
|
|
16377
16885
|
var AGENT_MAIL_DEFAULT_RETENTION_DAYS = 14;
|
|
16886
|
+
var AGENT_MAIL_MAX_ATTACHMENT_BYTES = 8 * 1024 * 1024;
|
|
16887
|
+
var AGENT_MAIL_MAX_TOTAL_ATTACHMENT_BYTES = 32 * 1024 * 1024;
|
|
16378
16888
|
var AGENT_MAIL_DEFAULT_AUTONOMOUS_WAKE_BUDGET = 16;
|
|
16379
16889
|
var AGENT_MAIL_DEFAULT_HOURLY_WAKE_LIMIT = 40;
|
|
16380
16890
|
var AGENT_MAIL_TOOL_NAMES = Object.freeze([
|
|
@@ -17093,7 +17603,7 @@ var SOURCES = new Set([
|
|
|
17093
17603
|
var EXECUTION_KINDS = new Set(NATIVE_AGENT_COMMAND_EXECUTION_KINDS);
|
|
17094
17604
|
var ORIGINS2 = new Set(NATIVE_AGENT_COMMAND_ORIGINS);
|
|
17095
17605
|
var UNAVAILABLE_REASONS = new Set(NATIVE_AGENT_COMMAND_UNAVAILABLE_REASONS);
|
|
17096
|
-
var
|
|
17606
|
+
var ERROR_CODES2 = new Set(NATIVE_AGENT_COMMAND_CATALOGUE_ERROR_CODES);
|
|
17097
17607
|
var encoder = new TextEncoder;
|
|
17098
17608
|
function utf8ByteLength(value) {
|
|
17099
17609
|
if (/^[\x00-\x7f]*$/.test(value))
|
|
@@ -18558,6 +19068,24 @@ function createStaleMcpServerHook(mcp) {
|
|
|
18558
19068
|
};
|
|
18559
19069
|
}
|
|
18560
19070
|
|
|
19071
|
+
// ../protocol/src/suborks.ts
|
|
19072
|
+
var SUBORK_TOOL_NAME = "ask_agents";
|
|
19073
|
+
var AGENT_SUBORK_TOOL_NAMES = Object.freeze([SUBORK_TOOL_NAME]);
|
|
19074
|
+
var SUBORK_LIMITS = Object.freeze({
|
|
19075
|
+
targetsPerCall: 4,
|
|
19076
|
+
activePerSession: 8,
|
|
19077
|
+
totalPerSession: 64,
|
|
19078
|
+
retainedBatchesPerSession: 16,
|
|
19079
|
+
promptMaxBytes: 64 * 1024,
|
|
19080
|
+
nameMaxChars: 80,
|
|
19081
|
+
targetTextMaxChars: 200,
|
|
19082
|
+
storedAnswerMaxBytes: 64 * 1024,
|
|
19083
|
+
deliveredAnswersMaxBytes: AGENT_MAIL_MAX_BODY_BYTES - 2 * 1024,
|
|
19084
|
+
lineMaxChars: 240,
|
|
19085
|
+
errorMaxChars: 1024,
|
|
19086
|
+
deadlineMs: 45 * 60000
|
|
19087
|
+
});
|
|
19088
|
+
|
|
18561
19089
|
// ../../bridges/claude-bridge/src/services/session-manager-prompt-query.ts
|
|
18562
19090
|
import { createHash as createHash11 } from "node:crypto";
|
|
18563
19091
|
|
|
@@ -18575,6 +19103,7 @@ var WORKFLOW_RESULT_KINDS = [
|
|
|
18575
19103
|
"fix-result",
|
|
18576
19104
|
"verification-result",
|
|
18577
19105
|
"pr-result",
|
|
19106
|
+
"subork-answer",
|
|
18578
19107
|
"graph-output",
|
|
18579
19108
|
"graph-template"
|
|
18580
19109
|
];
|
|
@@ -18590,7 +19119,8 @@ var WORKFLOW_RESULT_TOOL_NAMES = {
|
|
|
18590
19119
|
"verification-result": "submit_verification_result",
|
|
18591
19120
|
"pr-result": "submit_pr_result",
|
|
18592
19121
|
"graph-output": "submit_graph_output",
|
|
18593
|
-
"graph-template": "submit_graph_template"
|
|
19122
|
+
"graph-template": "submit_graph_template",
|
|
19123
|
+
"subork-answer": "submit_subork_answer"
|
|
18594
19124
|
};
|
|
18595
19125
|
var WORKFLOW_RESULT_VALIDATION_TOOL_NAME = "validate_workflow_result";
|
|
18596
19126
|
var REPORT_FINDING_TOOL_NAME = "report_finding";
|
|
@@ -19732,7 +20262,12 @@ async function resolveQueryPlan(turn, sdkTextPrompt, testHooks) {
|
|
|
19732
20262
|
];
|
|
19733
20263
|
const coordinatorReadOnly = isCoordinatorReadOnlyPolicy(policy);
|
|
19734
20264
|
const grantedMcpServerNames = claudeAsksForApproval(policy, options) ? [] : claudeGrantedMcpServerNames(policy, mcpServerNames);
|
|
19735
|
-
const agentMailTools = mcpServerNames.has(AGENT_MCP_SERVER_NAME) ? [
|
|
20265
|
+
const agentMailTools = mcpServerNames.has(AGENT_MCP_SERVER_NAME) ? [
|
|
20266
|
+
...AGENT_MAIL_TOOL_NAMES,
|
|
20267
|
+
...ARTIFACT_TOOL_NAMES,
|
|
20268
|
+
...AGENT_GOAL_TOOL_NAMES,
|
|
20269
|
+
...AGENT_SUBORK_TOOL_NAMES
|
|
20270
|
+
].map((name) => `mcp__${AGENT_MCP_SERVER_NAME}__${name}`) : [];
|
|
19736
20271
|
const allowedTools = coordinatorReadOnly ? claudeReadOnlyAllowedTools({
|
|
19737
20272
|
agentMcpServerNames: mcpServerNames.has(AGENT_MCP_SERVER_NAME) ? [AGENT_MCP_SERVER_NAME] : [],
|
|
19738
20273
|
policy,
|
|
@@ -22322,72 +22857,6 @@ function boundTranscriptResponse(messages, maximumBytes, options = {}) {
|
|
|
22322
22857
|
};
|
|
22323
22858
|
}
|
|
22324
22859
|
|
|
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
22860
|
// ../../bridges/claude-bridge/src/routes/session-close.ts
|
|
22392
22861
|
function registerSessionCloseRoute(app) {
|
|
22393
22862
|
app.post("/:id/close", async (c) => {
|
|
@@ -23268,6 +23737,10 @@ session.post("/create", async (c) => {
|
|
|
23268
23737
|
};
|
|
23269
23738
|
return c.json(response, 201);
|
|
23270
23739
|
} catch (error) {
|
|
23740
|
+
if (error instanceof PolicyWideningRefusedError) {
|
|
23741
|
+
log21.warn("session.policy-widening-refused", { widened: error.widened.join(",") });
|
|
23742
|
+
return c.json(error.refusal(), 403);
|
|
23743
|
+
}
|
|
23271
23744
|
log21.error("session.create-failed", { error: formatLogError(error) });
|
|
23272
23745
|
return c.json({ error: error instanceof Error ? error.message : "Failed to create session" }, 500);
|
|
23273
23746
|
}
|
|
@@ -23421,11 +23894,7 @@ session.post("/:id/config", async (c) => {
|
|
|
23421
23894
|
sessionId: sessionData.id,
|
|
23422
23895
|
widened: widened.join(",")
|
|
23423
23896
|
});
|
|
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);
|
|
23897
|
+
return c.json(policyWideningRefusal(widened), 403);
|
|
23429
23898
|
}
|
|
23430
23899
|
};
|
|
23431
23900
|
const refusal = refusePolicyWidening();
|
|
@@ -24884,6 +25353,9 @@ function installFatalRejectionGuard(options) {
|
|
|
24884
25353
|
try {
|
|
24885
25354
|
warn(`${options.label} Unhandled promise rejection (continuing): ${describe(reason)}`);
|
|
24886
25355
|
} catch {}
|
|
25356
|
+
try {
|
|
25357
|
+
options.onRejection?.(reason);
|
|
25358
|
+
} catch {}
|
|
24887
25359
|
};
|
|
24888
25360
|
target.on("unhandledRejection", handler);
|
|
24889
25361
|
return () => {
|
|
@@ -24891,6 +25363,15 @@ function installFatalRejectionGuard(options) {
|
|
|
24891
25363
|
};
|
|
24892
25364
|
}
|
|
24893
25365
|
|
|
25366
|
+
// ../protocol/src/node/process-failure-log.ts
|
|
25367
|
+
var log25 = createLogger("process");
|
|
25368
|
+
function logUnhandledRejection(reason) {
|
|
25369
|
+
log25.throttled("error", "rejection.unhandled", {
|
|
25370
|
+
error: reason,
|
|
25371
|
+
fields: () => ({ error: formatLogError(reason, { message: false }) })
|
|
25372
|
+
});
|
|
25373
|
+
}
|
|
25374
|
+
|
|
24894
25375
|
// ../../node_modules/.bun/@hono+node-server@2.1.5+c539cad7f494f5c9/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
|
|
24895
25376
|
var X_ALREADY_SENT = "x-hono-already-sent";
|
|
24896
25377
|
|
|
@@ -26376,11 +26857,11 @@ var serve = (options, listeningListener) => {
|
|
|
26376
26857
|
};
|
|
26377
26858
|
|
|
26378
26859
|
// ../../bridges/claude-bridge/src/index.ts
|
|
26379
|
-
var
|
|
26860
|
+
var log26 = createLogger("bridge.claude");
|
|
26380
26861
|
configureBridgeLogger();
|
|
26381
26862
|
var app = new Hono2;
|
|
26382
26863
|
app.onError((error, c) => {
|
|
26383
|
-
|
|
26864
|
+
log26.error("http.request-failed", {
|
|
26384
26865
|
method: c.req.method,
|
|
26385
26866
|
path: c.req.path,
|
|
26386
26867
|
error: formatLogError(error)
|
|
@@ -26503,13 +26984,13 @@ app.get("/", (c) => {
|
|
|
26503
26984
|
}
|
|
26504
26985
|
});
|
|
26505
26986
|
});
|
|
26506
|
-
installFatalRejectionGuard({ label: "[claude-bridge]" });
|
|
26987
|
+
installFatalRejectionGuard({ label: "[claude-bridge]", onRejection: logUnhandledRejection });
|
|
26507
26988
|
var parentPid = parseParentPid(process.env[PARENT_PID_ENV]);
|
|
26508
26989
|
if (parentPid !== null) {
|
|
26509
26990
|
startParentWatchdog({
|
|
26510
26991
|
parentPid,
|
|
26511
26992
|
onParentExit: () => {
|
|
26512
|
-
|
|
26993
|
+
log26.warn("parent.gone", { parentPid });
|
|
26513
26994
|
process.exit(0);
|
|
26514
26995
|
}
|
|
26515
26996
|
});
|
|
@@ -26520,13 +27001,13 @@ function startBridgeServer(env = process.env, start = serve) {
|
|
|
26520
27001
|
}
|
|
26521
27002
|
const port = parseInt(env.PORT || "4097", 10);
|
|
26522
27003
|
const hostname = env.HOSTNAME || "0.0.0.0";
|
|
26523
|
-
|
|
27004
|
+
log26.debug("server.starting", { hostname, port });
|
|
26524
27005
|
const server = start({
|
|
26525
27006
|
fetch: app.fetch,
|
|
26526
27007
|
port,
|
|
26527
27008
|
hostname
|
|
26528
27009
|
});
|
|
26529
|
-
|
|
27010
|
+
log26.info("server.listening", { hostname, port });
|
|
26530
27011
|
return server;
|
|
26531
27012
|
}
|
|
26532
27013
|
var __testing = {
|