orkestrator 2.35.4-beta → 2.35.5-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.
@@ -4081,6 +4081,7 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
4081
4081
  "update_schedule",
4082
4082
  "update_ticket"
4083
4083
  ]);
4084
+ var COORDINATOR_PROJECT_HOME_MESSAGE_WINDOW_MS = 3 * 60 * 60000;
4084
4085
 
4085
4086
  // ../protocol/src/agent-mail.ts
4086
4087
  var AGENT_MAIL_MAX_BODY_BYTES = 32 * 1024;
@@ -28809,8 +28810,10 @@ function stackFrames(target, message) {
28809
28810
  `).filter((line) => /^\s*at\s/.test(line)).slice(0, MAX_STACK_FRAMES).map((line) => boundedText3(relativeFrame(line), MAX_FRAME_CHARS));
28810
28811
  return frames.length > 0 ? frames : undefined;
28811
28812
  }
28812
- function describe2(error, includeStack, depth) {
28813
+ function describe2(error, includeStack, includeMessage, depth) {
28813
28814
  if (typeof error !== "object" || error === null) {
28815
+ if (!includeMessage)
28816
+ return { name: "NonError" };
28814
28817
  return {
28815
28818
  name: "NonError",
28816
28819
  message: typeof error === "string" ? boundedText3(error, MAX_MESSAGE_CHARS) : `[${typeof error}]`
@@ -28827,7 +28830,7 @@ function describe2(error, includeStack, depth) {
28827
28830
  const details = { name };
28828
28831
  if (commandFailure)
28829
28832
  details.outputOmitted = true;
28830
- else if (message)
28833
+ else if (message && includeMessage)
28831
28834
  details.message = boundedText3(message, MAX_MESSAGE_CHARS);
28832
28835
  const code = read(error, "code");
28833
28836
  const safeCode = finite(code) ?? matching(code, CODE_PATTERN);
@@ -28855,13 +28858,13 @@ function describe2(error, includeStack, depth) {
28855
28858
  details.errorCount = members.length;
28856
28859
  const cause = read(error, "cause") ?? (Array.isArray(members) ? members[0] : undefined);
28857
28860
  if (cause !== undefined && cause !== null && depth < MAX_CAUSE_DEPTH) {
28858
- details.cause = describe2(cause, false, depth + 1);
28861
+ details.cause = describe2(cause, false, includeMessage, depth + 1);
28859
28862
  }
28860
28863
  return details;
28861
28864
  }
28862
28865
  function formatLogError(error, options = {}) {
28863
28866
  try {
28864
- return brand(describe2(error, options.stack !== false, 0));
28867
+ return brand(describe2(error, options.stack !== false, options.message !== false, 0));
28865
28868
  } catch {
28866
28869
  return brand({ name: "Error", message: "[unreadable]" });
28867
28870
  }
@@ -28893,7 +28896,16 @@ var AGENT_MAIL_LOG_AREAS = defineLogAreas({
28893
28896
  "agent-mail": {
28894
28897
  description: "Delivering agent mail into waiting agent sessions.",
28895
28898
  events: {
28896
- "delivery.waiting": "The drain passed over a pending message, for a reason it had not yet logged."
28899
+ "delivery.waiting": "The drain passed over a pending message, for a reason it had not yet logged.",
28900
+ "drain.new-mail-failed": "Draining newly received mail failed; the next sweep delivers it.",
28901
+ "presence.sync-failed": "Mailboxes could not be synchronized.",
28902
+ "inject.verified": "An injected message's delivery was checked. Ids and decisions only.",
28903
+ "inject.dispatched": "Messages were dispatched into a session. Ids and decisions only.",
28904
+ "stopped-worker.action-failed": "Nothing could act on mail for a stopped worker.",
28905
+ "coordinator.start-failed": "The main coordinator could not be started for a new message.",
28906
+ "message.placed": "A message was placed in a mailbox. Ids and decisions only, never subjects or bodies.",
28907
+ "budget.hold-notify-failed": "The coordinator could not be told about held worker mail.",
28908
+ "budget.reset-failed": "The mail budget could not be reset for a prompted tab."
28897
28909
  }
28898
28910
  }
28899
28911
  });
@@ -28915,6 +28927,30 @@ var BACKEND_LOG_AREAS = defineLogAreas({
28915
28927
  "job.failed": "One pass of the job named in `scope` failed; its next pass retries.",
28916
28928
  ...THROTTLE_LOG_EVENTS
28917
28929
  }
28930
+ },
28931
+ backend: {
28932
+ description: "The backend process: startup, background notices and shutdown.",
28933
+ events: {
28934
+ starting: "The backend process is starting.",
28935
+ "ssh-socket.resolved": "An SSH agent socket was found.",
28936
+ "ssh-socket.missing": "No usable SSH agent socket was found.",
28937
+ "standalone-updater.mismatch": "--standalone-updater does not match --data-dir, so self-update is off.",
28938
+ "instance.publish-failed": "The instance descriptor could not be published.",
28939
+ "instance.republish-failed": "The instance descriptor could not be republished; a later pass retries.",
28940
+ "parent.exited": "The parent process exited, so local servers are shutting down.",
28941
+ "startup.step-failed": "One part of startup failed and the backend carried on; `step` says which.",
28942
+ "startup.setup-fence-failed": "An environment's interrupted setup could not be fenced.",
28943
+ "startup.setup-adopt-failed": "An environment's pending setup could not be adopted.",
28944
+ "startup.deletion-pending": "An interrupted environment deletion stays pending. Its owning step logged the detail.",
28945
+ "startup.looped-review-pending": "Cleanup of the retired Looped Review stays pending.",
28946
+ "notice.failed": "A background notice after a turn or prompt failed; `step` says which.",
28947
+ "artifacts.live-unavailable": "Live interactive artifacts are unavailable.",
28948
+ "shutdown.step-failed": "One part of shutdown failed and the rest went on; `step` says which.",
28949
+ "shutdown.signal-received": "A signal started shutdown, which tells a clean quit from the backend being killed.",
28950
+ "shutdown.finished": "Shutdown finished, and the process exits with `code`.",
28951
+ "port-policy.second-backend": "Another backend serves the default data directory, so this one avoids its ports.",
28952
+ "port-policy.serve-on-free-port": "--tailscale-serve is on a free gateway port; pass --port with --strict-gateway-port to keep one."
28953
+ }
28918
28954
  }
28919
28955
  });
28920
28956
 
@@ -28922,11 +28958,12 @@ var BACKEND_LOG_AREAS = defineLogAreas({
28922
28958
  var MAX_BRIDGE_DIAGNOSTIC_BYTES = 8192;
28923
28959
  var BRIDGE_LOG_AREAS = defineLogAreas({
28924
28960
  "bridge.diagnostics": {
28925
- description: "Metadata snapshots of bridge turns and processes, written while Save Logs for Debugging is on. docs/architecture/bridge-diagnostics.md reads them.",
28961
+ description: "Metadata snapshots of bridge turns and processes: lifecycle, stalls and a keepalive at info, every minute at debug, and each change at trace. docs/architecture/bridge-diagnostics.md reads them.",
28926
28962
  tag: "bridge-diagnostics",
28927
28963
  maxStringChars: MAX_BRIDGE_DIAGNOSTIC_BYTES,
28928
28964
  events: {
28929
- heartbeat: "The once-a-minute snapshot of a turn or process that is still open.",
28965
+ heartbeat: "A periodic snapshot of an open turn or process: every minute at debug; at info only as stall evidence (a stall starting or clearing, a late timer, a change during a silent stall) or the ten-minute keepalive.",
28966
+ change: "At trace only: a snapshot written as soon as the phase, the pending tools or a counter past its threshold changes.",
28930
28967
  "send-started": "A turn or process diagnostic scope began.",
28931
28968
  "send-resolved": "The provider accepted a dispatch.",
28932
28969
  "cancel-requested": "Cancellation of a turn was requested.",
@@ -29225,7 +29262,7 @@ var DESKTOP_LOG_AREAS = defineLogAreas({
29225
29262
  // ../protocol/src/log-vocabulary/environment.ts
29226
29263
  var ENVIRONMENT_LOG_AREAS = defineLogAreas({
29227
29264
  environment: {
29228
- description: "Environment naming, held setup and cleanup after deletion.",
29265
+ description: "Environment naming, setup, status, moves, deletion and cleanup afterwards.",
29229
29266
  events: {
29230
29267
  "cleanup.branch-kept": "A deleted environment's local branch was kept, as it may hold unmerged work.",
29231
29268
  "rename.failed": "Naming an environment from its pending prompt failed for the first time.",
@@ -29234,6 +29271,40 @@ var ENVIRONMENT_LOG_AREAS = defineLogAreas({
29234
29271
  "setup.attention-not-recorded": "Held setup could not be recorded as needing the user's attention.",
29235
29272
  "setup.coordinator-not-notified": "The worker's coordinator could not be told that its setup is held for approval.",
29236
29273
  "setup.unknown-environment": "The renderer was asked to act on the setup of an environment it does not hold.",
29274
+ "cleanup.rearmed": "A deleted environment's stopped cleanup is retried once under a new backend version.",
29275
+ "cleanup.exhausted": "A deleted environment's cleanup keeps failing after its attempts; written once per environment.",
29276
+ "cleanup.retry-not-admitted": "A cleanup retry was not admitted; the entry stays for the next start.",
29277
+ "cleanup.step-failed": "One step of a deleted environment's cleanup failed; a later reconcile retries it.",
29278
+ "cleanup.record-failed": "A finished cleanup step could not be recorded, so it may run again.",
29279
+ "cleanup.sweep-failed": "A cleanup sweep failed; written once per sweep.",
29280
+ "cleanup.reconcile-failed": "A cleanup reconcile pass failed; the next one retries.",
29281
+ "orphan-state.remove-failed": "An orphaned environment state directory could not be removed.",
29282
+ "orphan-state.removed": "Orphaned environment state directories were removed.",
29283
+ "orphan-state.sweep-failed": "Sweeping orphaned environment state failed.",
29284
+ "orphan-canvas.removed": "Orphaned design canvases were removed.",
29285
+ "orphan-canvas.sweep-failed": "Sweeping orphaned design canvases failed.",
29286
+ "orphan-branches.swept": "Orphaned environment branches were deleted, or kept as they may hold unmerged work.",
29287
+ "stray-workspace.remove-failed": "A stray workspace directory could not be removed.",
29288
+ "stray-workspace.removed": "Stray workspace directories were removed.",
29289
+ "stray-workspace.kept": "Unowned workspace directories that hold files were kept; remove them by hand if unneeded.",
29290
+ "temp-files.removed": "Abandoned temp files were removed.",
29291
+ "status.ownership-probe-failed": "A strict container ownership probe failed, so the stored status is kept.",
29292
+ "status.docker-error": "A transient Docker error stopped a status read, so the stored status is kept.",
29293
+ "setup.clear-launch-failed": "A pending agent launch could not be cleared after setup failed.",
29294
+ "setup.record-failure-failed": "A setup failure before its first attempt could not be recorded.",
29295
+ "lifecycle.failed": "Starting, rebuilding or recreating an environment failed; `operation` says which.",
29296
+ "tab-teardown.pending": "A tab's teardown failed and stays pending; the reconcile sweep retries.",
29297
+ "tab-reconcile.skipped": "Orphaned tab reconciliation was skipped because pane layouts are unreadable.",
29298
+ "orphan-session.reaped": "A native session no tab references was torn down.",
29299
+ "handoff-sweep.failed": "Sweeping transferred transcripts no tab references failed.",
29300
+ "delete.terminals-survived": "Terminal process trees outlived termination, so the deletion stops.",
29301
+ "delete.artifacts-left": "Graph run artifact directories were not removed.",
29302
+ "delete.worktrees-kept": "Graph runs kept branch worktrees.",
29303
+ "delete.step-failed": "One best-effort part of deleting an environment failed; `step` says which, and the rest goes on.",
29304
+ "merge-cleanup.resume-failed": "A merge cleanup interrupted by a restart could not be resumed.",
29305
+ "move.sessions-not-moved": "A provider's sessions could not follow a moved environment.",
29306
+ "move.recovery-failed": "Recovering an interrupted environment move failed.",
29307
+ "stop.settle-activity-failed": "Agent activity could not be settled after a runtime stopped.",
29237
29308
  ...THROTTLE_LOG_EVENTS
29238
29309
  }
29239
29310
  }
@@ -29242,10 +29313,50 @@ var ENVIRONMENT_LOG_AREAS = defineLogAreas({
29242
29313
  // ../protocol/src/log-vocabulary/gateway.ts
29243
29314
  var GATEWAY_LOG_AREAS = defineLogAreas({
29244
29315
  gateway: {
29245
- description: "The remote gateway other devices and browsers connect through.",
29316
+ description: "The gateway other devices, browsers and the desktop connect through.",
29246
29317
  events: {
29247
29318
  "remote.start-failed": "The desktop could not start the remote gateway.",
29248
- "remote.stop-failed": "The desktop could not stop the remote gateway cleanly."
29319
+ "remote.stop-failed": "The desktop could not stop the remote gateway cleanly.",
29320
+ disabled: "The gateway is disabled by its environment variable.",
29321
+ "tailscale.no-address": "No Tailscale address was found, so the gateway did not start.",
29322
+ "tailscale.no-address-fallback": "No Tailscale address was found, so the gateway binds its fallback address.",
29323
+ "control.listening": "The backend control listener is up.",
29324
+ "browser.listening": "The browser listener is up.",
29325
+ "browser.unavailable": "The browser listener could not start; control remains if started, or loopback is attempted.",
29326
+ "browser.unavailable-degraded": "No browser listener was started (`reason=no-tailscale-address`); control remains if started, or loopback is attempted.",
29327
+ "loopback.listening": "The loopback client listener is up.",
29328
+ "loopback.unavailable": "The loopback client listener could not start.",
29329
+ "auth-token.stored": "The gateway token's file was written. The path only, never the token.",
29330
+ "auth-token.persist-failed": "The gateway token could not be saved.",
29331
+ "port.fallback": "The preferred port was taken, so a nearby one is used.",
29332
+ "port.fallback-distant": "The preferred port and those nearby were taken, so another is used.",
29333
+ "request.failed": "A gateway request failed. Throttled: repeats are counted, not written.",
29334
+ "websocket.upgrade-failed": "A WebSocket upgrade failed.",
29335
+ "events.client-dropped": "An event-stream client buffered too much and was dropped; it reconnects and refetches.",
29336
+ "proxy.client-disconnected": "A proxy client went away, so its upstream request was aborted.",
29337
+ "throttle.suppressed": "Repeats of the throttled `site` were counted over a window, not written.",
29338
+ "throttle.recovered": "The throttled `site` succeeded again, so its fault has cleared.",
29339
+ "throttle.evicted": "The tracked-key limit dropped the `site`, so no recovered line follows unless it fails again."
29340
+ }
29341
+ },
29342
+ "gateway.terminal": {
29343
+ description: "The gateway's terminal WebSocket.",
29344
+ events: {
29345
+ "upgrade-rejected": "A terminal WebSocket upgrade was refused.",
29346
+ "socket-error": "A terminal WebSocket reported an error.",
29347
+ "subscription-failed": "A terminal subscription failed.",
29348
+ "operation-failed": "A terminal operation failed. Fixed text: the operation can hold terminal input."
29349
+ }
29350
+ },
29351
+ "gateway.tailscale": {
29352
+ description: "Tailscale Serve for desktop web access and a standalone backend.",
29353
+ events: {
29354
+ "web-access.disable-failed": "Desktop web access could not be turned off.",
29355
+ "web-access.enable-failed": "Desktop web access could not be turned on.",
29356
+ "web-access.cleanup-failed": "Cleaning up after a failed enable also failed.",
29357
+ "web-access.reset-failed": "Desktop web access could not be reset.",
29358
+ "startup.init-failed": "Desktop web access could not be initialized at startup.",
29359
+ available: "Tailscale Serve is publishing the gateway."
29249
29360
  }
29250
29361
  }
29251
29362
  });
@@ -29256,6 +29367,18 @@ var LOCAL_SERVER_LOG_AREAS = defineLogAreas({
29256
29367
  description: "Agent bridge processes the backend runs on the host.",
29257
29368
  events: {
29258
29369
  "bridge.not-answering": "A bridge with work in progress fails health checks, so it is not restarted yet.",
29370
+ "bridge-runtime.installing": "A bridge runtime is being installed.",
29371
+ "bridge-runtime.installed": "A bridge runtime finished installing.",
29372
+ "opencode.database-lost-retrying": "OpenCode lost its shared database at startup, so it is retried.",
29373
+ "server.stopping": "A local server is being stopped, for the fixed `reason` given.",
29374
+ "reaper.tmux-list-failed": "Orphaned claude-tmux sessions could not be listed.",
29375
+ "reaper.tmux-kill-failed": "An orphaned tmux session could not be killed.",
29376
+ "reaper.tmux-reaped": "Orphaned claude-tmux sessions of a deleted environment were killed.",
29377
+ "reaper.runtime-root-remove-failed": "A claude-tmux runtime root could not be removed; it stays for a retry.",
29378
+ "reaper.server-unidentified": "An orphan candidate could not be identified, so its record is kept.",
29379
+ "reaper.server-refused": "An orphan candidate leads no process group, so it was not reaped.",
29380
+ "reaper.server-reaping": "An orphaned server is being stopped.",
29381
+ "reaper.server-kill-failed": "An orphaned server did not exit.",
29259
29382
  ...THROTTLE_LOG_EVENTS
29260
29383
  }
29261
29384
  }
@@ -29297,7 +29420,12 @@ var MODEL_LOG_AREAS = defineLogAreas({
29297
29420
  models: {
29298
29421
  description: "Agent model catalogues and their persistent caches.",
29299
29422
  events: {
29300
- "cache.write-failed": "A successful catalogue refresh could not update the host cache."
29423
+ "cache.write-failed": "A successful catalogue refresh could not update the host cache.",
29424
+ "seed.pi-failed": "The host Pi model catalogue could not be seeded; the next launch retries.",
29425
+ "bridge.not-ready": "The first-use catalogue bridge did not become ready.",
29426
+ "bridge.start-failed": "The first-use catalogue bridge failed to start.",
29427
+ "probe.exit-unclean": "A catalogue probe or sign-in server did not exit cleanly.",
29428
+ "download.deferred": "A model catalogue could not be downloaded yet."
29301
29429
  }
29302
29430
  }
29303
29431
  });
@@ -29308,8 +29436,61 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
29308
29436
  description: "Native agent sessions and what the backend reads from their bridges.",
29309
29437
  events: {
29310
29438
  "catalogue.outdated-bridge": "A bridge predates the command catalogue, so its commands stay unavailable.",
29439
+ "handoff.summary-read-failed": "Change summaries could not be read for a handoff, so the carrier says they are unmeasured.",
29440
+ "handoff.consume-failed": "A delivered handoff could not be marked consumed.",
29441
+ "job.pr-refresh-rollback-failed": "Rolling back a pull request refresh for a job failed.",
29442
+ "job.resend-queue-failed": "A resend could not be queued for a job.",
29443
+ "interaction.requests-dropped": "Interaction requests that could not be mapped were dropped.",
29444
+ "interaction.observe-failed": "Observing a session's interactions failed. Error class only.",
29445
+ "human-prompt.listener-failed": "A human prompt listener threw; the others still run.",
29446
+ "question.attention-record-failed": "Attention for an async question could not be recorded; the transcript stays readable.",
29447
+ "activity.reconcile-failed": "Reconciling an environment's activity failed. Error class only.",
29448
+ "activity.persist-failed": "An environment's activity could not be saved.",
29449
+ "pr-refresh.schedule-failed": "A pull request refresh after completion could not be scheduled.",
29450
+ "launch.startup-failed": "A startup launch failed; it retries unless `permanent`.",
29451
+ "queue.failing": "A native prompt queue keeps failing. The key and reason only, never the prompt.",
29452
+ "provider.retire-failed": "Retiring an obsolete provider failed.",
29453
+ "workflow-result.store-unavailable": "The workflow result store is unavailable, so the provider's result is used.",
29454
+ "catalogue.refresh-failed": "A provider's command catalogue could not be refreshed.",
29455
+ "dispatch.attach-failed": "Attaching an agent before dispatch failed; the prompt request answers authoritatively.",
29456
+ "coordinator-context.ack-failed": "Coordinator repository context could not be acknowledged.",
29457
+ "naming.prepare-failed": "First-prompt naming could not be prepared; the prompt still goes ahead.",
29458
+ "interrupt.persist-failed": "A turn interrupt could not be saved, so automatic publication stays fenced.",
29459
+ "resume.close-replaced-failed": "The session a resume replaced could not be closed.",
29460
+ "sign-in.check-failed": "A turn could not be checked for a login refusal.",
29461
+ "sign-in.resend-failed": "Sending refused prompts after sign-in failed.",
29462
+ "sign-in.prompt-resend-failed": "One refused prompt could not be sent again after sign-in. Error class only.",
29463
+ "shutdown.checkpoints-skipped": "Shutdown skipped display-tail checkpoints; provider history stays authoritative. Count only.",
29464
+ "turn-recovery.failed": "Recovering an incomplete turn failed.",
29465
+ "turn-recovery.exhausted": "A turn failed again after automatic recovery and is left for the user.",
29466
+ "turn-recovery.retrying": "An incomplete or provider-failed turn is being retried automatically.",
29467
+ "usage-limit.resend-failed": "Resending after a usage limit failed. An unknown send stays in the journal.",
29468
+ "title.strategy-failed": "A session title strategy failed, so the next is tried. Content-free: the error can quote the prompt.",
29311
29469
  ...THROTTLE_LOG_EVENTS
29312
29470
  }
29471
+ },
29472
+ "native-agent.goal": {
29473
+ description: "The /goal loop: advancing goals and their verifiers.",
29474
+ events: {
29475
+ "advance.failed": "A goal could not advance; the next sweep retries.",
29476
+ "attention.record-failed": "Attention for a goal could not be recorded.",
29477
+ "turn-end.settle-failed": "Turn-end work for a goal could not be settled.",
29478
+ "verifier.finish-failed": "A verifier failed to finish; the goal stays verifying, so the next sweep runs it again.",
29479
+ "verifier.stop-failed": "An earlier verifier could not be stopped.",
29480
+ "recover.failed": "Goals could not be recovered at startup."
29481
+ }
29482
+ },
29483
+ "native-agent.opencode": {
29484
+ description: "The OpenCode provider: its request monitor, retries and agent tools.",
29485
+ events: {
29486
+ "retry.abort-failed": "Aborting an automatic retry failed. Error class only.",
29487
+ "retry.abort-not-scheduled": "An automatic retry abort could not be scheduled. Error class only.",
29488
+ "agent-tools.unavailable": "OpenCode agent tools remain unavailable for a session.",
29489
+ "coordinator-servers.unavailable": "OpenCode coordinator research servers are unavailable.",
29490
+ "monitor.reconnecting": "The request monitor lost its stream and is reconnecting. Error class only.",
29491
+ "worker-limit.reached": "The bounded request workers are full, so the stream restarts and a snapshot reconciles.",
29492
+ "request.failed": "Handling a request event failed, so the stream restarts. Error class only."
29493
+ }
29313
29494
  }
29314
29495
  });
29315
29496
 
@@ -29332,6 +29513,17 @@ var PREVIEW_LOG_AREAS = defineLogAreas({
29332
29513
  "partitions.retry-forgotten-failed": "Retrying a forgotten preview cleanup failed.",
29333
29514
  "port-hints.persist-failed": "Preview port hints could not be saved.",
29334
29515
  "transport.close-failed": "A preview transport could not be closed.",
29516
+ "ca-bundle.read-failed": "The upstream CA bundle could not be read.",
29517
+ "publication.start-failed": "Private preview publication did not start.",
29518
+ "publication.reconfigure-failed": "Preview publication could not be reconfigured.",
29519
+ "publication.listening": "Private preview origins are listening.",
29520
+ "certificate.reloaded": "The preview certificate was reloaded.",
29521
+ "access.revoked-close-failed": "A revoked preview resource could not be closed. Error class only.",
29522
+ "registry.invalid-definition": "An invalid stored preview service definition was ignored.",
29523
+ "registry.environment-reconcile-failed": "An environment's preview services could not be reconciled.",
29524
+ "registry.resolver-failed": "A preview resolver failed. Error class only.",
29525
+ "registry.revocation-listener-failed": "A preview revocation listener threw. Error class only.",
29526
+ "registry.change-emit-failed": "A preview change event could not be emitted. Error class only.",
29335
29527
  ...THROTTLE_LOG_EVENTS
29336
29528
  }
29337
29529
  }
@@ -29350,9 +29542,33 @@ var RUNTIME_LOG_AREAS = defineLogAreas({
29350
29542
  // ../protocol/src/log-vocabulary/terminal.ts
29351
29543
  var TERMINAL_LOG_AREAS = defineLogAreas({
29352
29544
  terminal: {
29353
- description: "The renderer's terminal. Its lines stay in the browser console, never the saved log.",
29545
+ description: "Terminals. The renderer's lines stay in the browser console; the backend's reach the saved log.",
29354
29546
  events: {
29355
29547
  "input.undelivered": "A keystroke did not reach a shell: `no-session` or `not-delivered`.",
29548
+ "orphan.reaped": "A terminal no tab references was closed.",
29549
+ "agent-completion.notify-failed": "A terminal agent's completion could not be reported.",
29550
+ "activity.record-failed": "Terminal environment activity could not be recorded.",
29551
+ "pty.exit-listener-failed": "A terminal exit listener threw; the others still run.",
29552
+ "pty.exit-notify-failed": "Notifying a terminal's exit failed.",
29553
+ "pty.late-exit-listener-failed": "A listener added after a terminal exited threw.",
29554
+ "setup.pty-reused": "A setup terminal reused its existing PTY.",
29555
+ "setup.pty-spawning": "A setup terminal is spawning its PTY. The argument count only, never the arguments.",
29556
+ "setup.pty-spawned": "A setup terminal's PTY started.",
29557
+ "setup.pty-exited": "A setup terminal's PTY exited.",
29558
+ "setup.preparing": "Workspace preparation started in the setup terminal.",
29559
+ "setup.session-creating": "A setup session is being created.",
29560
+ "setup.intro-emitted": "The setup intro was written to the terminal.",
29561
+ "setup.completed": "Setup finished.",
29562
+ "setup.failed": "Setup failed.",
29563
+ "setup.already-complete": "Setup was requested but had already finished.",
29564
+ "setup.renderer-ensured": "The renderer asked for setup to be running.",
29565
+ "setup.renderer-requested": "The renderer asked for the setup session.",
29566
+ "setup.renderer-requested-none": "The renderer asked for a setup session that does not exist.",
29567
+ "setup.no-commands": "An environment has no setup commands to run.",
29568
+ "setup.already-running": "Setup was requested while it was already running.",
29569
+ "setup.held-for-approval": "Setup is held until its commands are approved.",
29570
+ "setup.renderer-checked-session": "The renderer asked whether a setup terminal session exists.",
29571
+ "setup.renderer-requested-buffer": "The renderer asked for a setup terminal's output buffer. A size only, never its contents.",
29356
29572
  "input.resume-failed": "Asking the backend to resume refused terminal input failed.",
29357
29573
  "input.write-failed": "Writing input to a terminal session threw.",
29358
29574
  "listener.remove-failed": "Removing a terminal output listener threw.",
@@ -29452,13 +29668,39 @@ var TERMINAL_LOG_AREAS = defineLogAreas({
29452
29668
  // ../protocol/src/log-vocabulary/tmux.ts
29453
29669
  var TMUX_LOG_AREAS = defineLogAreas({
29454
29670
  tmux: {
29455
- description: "The poll loop behind a Claude tmux tab.",
29671
+ description: "Claude tmux tabs: launch, the poll loop, cleanup and the tmux prompt queue.",
29456
29672
  events: {
29457
29673
  "poll.discovery-failed": "Finding the session's transcript failed; a later tick retries.",
29458
29674
  "poll.snapshot-failed": "Reading the hook and transcript state failed; the next tick retries.",
29459
29675
  "poll.drain-pending-failed": "Delivering pending hook events failed; the next tick retries.",
29460
29676
  "poll.drain-timeouts-failed": "Delivering hook timeouts failed; the next tick retries.",
29461
29677
  "poll.tail-failed": "Reading new transcript lines failed; the next tick retries.",
29678
+ "cleanup.session-stop-failed": "A tmux session could not be stopped while cleaning up an environment.",
29679
+ "cleanup.skipped": "Environment tmux cleanup was skipped because tmux could not be reached and nothing required it.",
29680
+ "cleanup.environments-load-failed": "Environments could not be loaded during tmux cleanup, so it stays incomplete.",
29681
+ "cleanup.kill-failed": "An environment's tmux sessions could not be killed.",
29682
+ "hooks.uninstall-failed": "Workspace hooks could not be uninstalled.",
29683
+ "hooks.git-exclude-failed": "The git exclude for Claude's local settings could not be set.",
29684
+ "naming.prepare-failed": "First-prompt naming could not be prepared; the prompt still goes ahead.",
29685
+ "orphans.skipped": "Orphan reconciliation was skipped because pane layouts are unreadable.",
29686
+ "orphan.reaped": "A tmux session no tab references was killed.",
29687
+ "orphan.kill-skipped": "An orphan tmux kill was skipped because the tmux server could not be reached.",
29688
+ "cli.thinking-display-probe-failed": "Probing the CLI for --thinking-display failed, so it launches without it.",
29689
+ "cli.fast-mode-unsupported": "The claude CLI lacks --settings, so it launches without fast mode.",
29690
+ "cli.effort-unsupported": "The claude CLI lacks --effort, so it launches without it.",
29691
+ "interactive.snapshot-failed": "An interactive snapshot failed; expected while a pane is closing.",
29692
+ "signal.arm-failed": "The Claude state signal could not be armed.",
29693
+ "signal.degraded": "The Claude state signal missed a change or rang too often, so polling stays at one second until it is re-armed.",
29694
+ "pr-refresh.schedule-failed": "A pull request refresh after a turn could not be scheduled.",
29695
+ "pr-probe.failed": "Probing for a pull request an agent created failed.",
29696
+ "activity.persist-failed": "Tmux tab activity could not be saved.",
29697
+ "fast-mode.persist-failed": "The launch fast mode could not be saved.",
29698
+ "fast-mode.repair-failed": "Fast mode metadata could not be repaired on a reattached session.",
29699
+ "pane.observe-failed": "A pane observation failed. Error class only: pane contents are sensitive.",
29700
+ "turn.failure-record-failed": "A failed turn could not be recorded.",
29701
+ "slash-command.settle-timeout": "Timed out waiting for a Claude slash command to settle.",
29702
+ "queue.failing": "A tmux prompt queue keeps failing to dispatch.",
29703
+ "queue.rename-failed": "An environment could not be named from its first prompt; the prompt still goes ahead.",
29462
29704
  ...THROTTLE_LOG_EVENTS
29463
29705
  }
29464
29706
  }
@@ -29485,7 +29727,8 @@ var UPDATER_LOG_AREAS = defineLogAreas({
29485
29727
  "remote.unavailable": "Updates requested by remote clients are unavailable in this session.",
29486
29728
  "restart-prompt.failed": "The restart prompt for a downloaded update failed.",
29487
29729
  unavailable: "Auto-update could not be set up in this session.",
29488
- "update.failed": "electron-updater reported an update error."
29730
+ "update.failed": "electron-updater reported an update error.",
29731
+ "standalone.restarting": "A standalone backend is restarting into a new version."
29489
29732
  }
29490
29733
  }
29491
29734
  });
@@ -29496,11 +29739,460 @@ var WEB_ANNOTATIONS_LOG_AREAS = defineLogAreas({
29496
29739
  description: "Web annotation requests and their background reconciler.",
29497
29740
  events: {
29498
29741
  "reconcile.failed": "A background reconcile pass failed; the next one retries.",
29742
+ "legacy.degraded": "Legacy annotation storage is damaged, so the previous committed copy is served read-only.",
29743
+ "legacy.draft-index-problem": "The legacy draft index could not be used; `status` says why.",
29744
+ "legacy.unreadable-records": "The legacy import found unreadable records; they stay unread.",
29745
+ "legacy.unavailable": "Legacy annotation storage could not be read.",
29746
+ "legacy.unreadable": "An environment's legacy annotation storage is unreadable.",
29747
+ "legacy.archive-failed": "Imported legacy annotation files could not be archived.",
29748
+ "legacy.files-archived": "Legacy files beside an imported environment were archived, not imported.",
29749
+ "migration.draft-failed": "Migrating one draft failed.",
29750
+ "draft-reconcile.deferred": "Draft reconciliation was deferred; a later pass retries.",
29751
+ "request.handoff-deferred": "A request's handoff was deferred; a later pass retries.",
29752
+ "evidence.materialize-failed": "Materializing a request's evidence failed; it backs off and retries.",
29753
+ "queue.publish-deferred": "Publishing a request to the queue was deferred; it retries under the same id.",
29754
+ "request.reconcile-failed": "Reconciling a request failed; the next pass retries.",
29755
+ "turn-end.reconcile-failed": "Reconciling a request at the end of a turn failed; the next pass retries.",
29756
+ "gc.failed": "Annotation garbage collection failed; the next pass retries.",
29757
+ "record.unavailable": "An annotation record is unavailable; written once per record.",
29758
+ "storage.unavailable": "An environment's annotation store is unreadable.",
29759
+ "change-hint.listener-failed": "A change hint listener threw.",
29760
+ "orphan.remove-failed": "An orphaned environment's annotation storage could not be removed.",
29761
+ "storage.load-failed": "An environment's annotation storage could not be loaded.",
29499
29762
  ...THROTTLE_LOG_EVENTS
29500
29763
  }
29501
29764
  }
29502
29765
  });
29503
29766
 
29767
+ // ../protocol/src/log-vocabulary/storage.ts
29768
+ var STORAGE_LOG_AREAS = defineLogAreas({
29769
+ storage: {
29770
+ description: "The SQLite-backed stores, their snapshots and imports from older formats.",
29771
+ events: {
29772
+ "usage.environment-label-failed": "Usage labels could not be retained for a removed environment; deletion continues.",
29773
+ "snapshot.integrity-failed": "An hourly database snapshot failed its integrity check and was discarded.",
29774
+ "snapshot.skipped-low-disk": "The hourly database snapshot was skipped because the disk lacks room; `retryAt` says when it tries again.",
29775
+ "snapshot.failed": "The hourly database snapshot failed; `retryAt` says when it tries again, if known.",
29776
+ "listener.attention-failed": "An environment attention listener threw; the committed mutation stands.",
29777
+ "listener.change-failed": "A resource change listener threw; the committed mutation stands.",
29778
+ "kanban.image-cleanup-failed": "An orphaned Kanban image could not be removed after its retries; it is safe to remove later.",
29779
+ "nodes.entries-dropped": "Unreadable node registry entries were ignored.",
29780
+ "preview-identity.reminted": "The data directory moved or was copied, so previews get a new backend identity.",
29781
+ "machine-profile.invalid": "The stored machine profile was invalid and the default was restored.",
29782
+ "permission-rules.cleanup-failed": "A deleted project's permission rules could not be removed.",
29783
+ "retired.turn-cleanup-pending": "Cleanup of a retired Looped Review turn did not finish and stays pending.",
29784
+ "handoffs.prune-failed": "Pruning agent handoffs that nothing references failed; a later prune retries.",
29785
+ "desktop-connections.malformed": "Stored desktop connection settings were malformed, so the local connection is used.",
29786
+ "legacy-json.moved": "JSON store files written after the SQLite migration were archived, not imported.",
29787
+ "legacy-json.archive-failed": "Imported JSON store files could not be archived."
29788
+ }
29789
+ }
29790
+ });
29791
+
29792
+ // ../protocol/src/log-vocabulary/build-pipeline.ts
29793
+ var BUILD_PIPELINE_LOG_AREAS = defineLogAreas({
29794
+ "build-pipeline": {
29795
+ description: "Build pipelines: their supervision, stages, transcripts and sidebar state.",
29796
+ events: {
29797
+ "sidebar.reconcile-failed": "Sidebar activity for pipelines could not be reconciled.",
29798
+ "sidebar.update-failed": "The sidebar could not be updated for one pipeline.",
29799
+ "result.consume-deferred": "Consuming a stage's workflow result failed; it stays staged and is retried.",
29800
+ "consolidation.consume-deferred": "Consuming a review consolidation result failed; it stays pending and is retried.",
29801
+ "dispatch.prepare-failed": "Attaching the agent before dispatch failed; the prompt request does the same work and answers authoritatively.",
29802
+ "interaction.resolved": "A human interaction on a pipeline stage resolved. Metadata only.",
29803
+ "transcripts.migrated": "A transcript migration pass moved stage transcripts; counts only.",
29804
+ "transcripts.maintenance-failed": "Migrating or sweeping stage transcripts failed; the next start retries.",
29805
+ "restore.skipped": "A pipeline could not be restored at startup and was skipped.",
29806
+ "criteria.record-failed": "Acceptance criteria results could not be recorded on the ticket.",
29807
+ "workspace.waiting": "A pipeline is waiting for its workspace; written once per reason.",
29808
+ "rewind.pending": "A pipeline's code rewind has not finished; written once per reason.",
29809
+ "kanban.status-failed": "A restarted pipeline's Kanban status could not be set; it retries shortly.",
29810
+ "usage.read-failed": "Reading a stage session's token usage failed.",
29811
+ "checkpoint.deferred": "A stage transcript checkpoint could not be written yet; the provider's history stands.",
29812
+ "checkpoint.not-committed": "A stage transcript checkpoint was reverted in the commit that should have kept it.",
29813
+ "legacy-transcript.deferred": "Moving a legacy inline transcript failed; the inline body stays readable."
29814
+ }
29815
+ }
29816
+ });
29817
+
29818
+ // ../protocol/src/log-vocabulary/agent-branch.ts
29819
+ var AGENT_BRANCH_LOG_AREAS = defineLogAreas({
29820
+ "agent-branch": {
29821
+ description: "Agent branches shared by review fan-outs, graph agents and goal verifiers; `owner` names which.",
29822
+ events: {
29823
+ "observation.checkpoint-failed": "Checkpointing reviewer observations failed; the next pass retries.",
29824
+ "transcript.mirror-failed": "Mirroring a reviewer transcript failed.",
29825
+ "usage.read-failed": "Reading a reviewer's token usage failed.",
29826
+ "result.nudge-failed": "An agent with an uncommitted result could not be nudged.",
29827
+ "dispatch.prepare-failed": "Attaching the agent before dispatch failed; the prompt request answers authoritatively.",
29828
+ "result.consume-deferred": "Consuming a branch's workflow result failed; it stays staged and is retried."
29829
+ }
29830
+ }
29831
+ });
29832
+
29833
+ // ../protocol/src/log-vocabulary/change-tracking.ts
29834
+ var CHANGE_TRACKING_LOG_AREAS = defineLogAreas({
29835
+ "change-tracking": {
29836
+ description: "Change tracking: turn capture, evidence pulls and measurements.",
29837
+ events: {
29838
+ "journal-import.failed": "Importing surviving OpenCode command journals as legacy summaries failed.",
29839
+ "projection.failed": "Projecting a change event onto its environment failed.",
29840
+ "startup.reconcile-failed": "Reconciling change tracking at startup failed.",
29841
+ "turn-start.capture-failed": "Capturing a turn's start failed, so the turn is untracked.",
29842
+ "dispatch.record-failed": "Recording a turn's dispatch outcome failed.",
29843
+ "turn.finalize-failed": "Finalizing a turn failed.",
29844
+ "turn.settle-failed": "Settling a late interrupted turn failed.",
29845
+ "evidence.pull-failed": "Pulling change evidence from a bridge failed; a later pull retries.",
29846
+ "measurement.failed": "Recomputing a tool's measurement failed."
29847
+ }
29848
+ },
29849
+ "diff-stats": {
29850
+ description: "Environment diff stats and the worktree signals that drive them.",
29851
+ events: {
29852
+ "baseline.update-failed": "An environment's diff baseline could not be updated.",
29853
+ "scan.watcher-failed": "An environment's diff watcher failed; its scans fall back to polling.",
29854
+ "scan.failed": "A diff scan failed; the last results stay, marked stale, and the scan is retried.",
29855
+ "scan.freshness-read-failed": "Reading whether an environment's remote is fresh failed.",
29856
+ "scan.listener-failed": "A change-tracking scan listener threw; the scan itself stands.",
29857
+ "emit.diff-stats-failed": "A diff stats change could not be emitted to its sink.",
29858
+ "emit.worktree-snapshot-failed": "A worktree snapshot could not be emitted to its sink.",
29859
+ "signal.demoted": "A worktree signal stopped being trusted, so scans fall back to timers until it is re-armed."
29860
+ }
29861
+ }
29862
+ });
29863
+
29864
+ // ../protocol/src/log-vocabulary/coordinator.ts
29865
+ var COORDINATOR_LOG_AREAS = defineLogAreas({
29866
+ coordinator: {
29867
+ description: "Coordinators: delegations, status wakes and their store.",
29868
+ events: {
29869
+ "delegation.open-failed": "A delegation could not be opened; `source` says for what.",
29870
+ "deliver-now.drain-failed": "The mail delivery pass after deliverNow failed; the next sweep delivers.",
29871
+ "mail.move-failed": "Mail could not move to the new main coordinator.",
29872
+ "work.move-failed": "Work could not move to the main coordinator.",
29873
+ "wake.observe-remote-workflow-failed": "A remote workflow could not be observed for status wakes.",
29874
+ "wake.observe-pull-request-failed": "A pull request could not be observed for status wakes.",
29875
+ "wake.observe-workflow-failed": "A workflow could not be observed for status wakes.",
29876
+ "wake.deliver-failed": "A workflow status wake could not be delivered; the next pass retries.",
29877
+ "wake.waiting-check-failed": "A waiting worker could not be checked; the next pass retries.",
29878
+ "wake.resolve-report-failed": "A finished Resolve tab could not be reported.",
29879
+ "wake.waiting-report-failed": "A waiting worker could not be reported.",
29880
+ "wake.worker-outcomes-failed": "Coordinator-owned workers' merges and deletions could not be checked; the next sweep retries.",
29881
+ "store.malformed": "The coordinator store was malformed and is treated as empty.",
29882
+ "store.unsupported-version": "The coordinator store has an unsupported version and is treated as empty.",
29883
+ "store.invalid-workspace": "An invalid coordinator workspace record was ignored.",
29884
+ "store.workflows-cleared": "The workflow store was full, so a batch of its oldest finished records was removed.",
29885
+ "store.workflows-in-use": "The workflow store was full and every record was still in use, so new work was refused.",
29886
+ "remote-worker.settle-failed": "A remote worker could not be settled."
29887
+ }
29888
+ }
29889
+ });
29890
+
29891
+ // ../protocol/src/log-vocabulary/review.ts
29892
+ var REVIEW_LOG_AREAS = defineLogAreas({
29893
+ review: {
29894
+ description: "Multi Review workflows: scheduling, graph runs and interactive fix sessions.",
29895
+ events: {
29896
+ "fix-tab.publish-failed": "A fix request was delivered but its tab could not be opened; the user is told.",
29897
+ "graph-run.not-started": "A workflow's graph run did not start.",
29898
+ "reconcile.scan-failed": "A reconciliation scan failed; the next scan retries.",
29899
+ "graph-engine.unavailable": "The graph engine is selected but unavailable, so the bespoke engine runs.",
29900
+ "graph-run.cancel-failed": "Cancelling a graph run failed; the next pass projects how it ended.",
29901
+ "delete.cleanup-failed": "A cleanup step after deleting a workflow failed; stale tabs reconcile away on hydration.",
29902
+ "fix-session.read-failed": "Reading an interactive fix session's state failed.",
29903
+ "fix-outcome.read-failed": "Reading an interactive fix's outcome failed; it stays pending.",
29904
+ "fix-usage.read-failed": "Reading a fix session's token usage failed.",
29905
+ "result.consume-deferred": "Consuming a workflow result failed; it stays staged and is retried.",
29906
+ "failure-triage.failed": "Classifying a review package's failing tests failed; the package is sealed without the triage and says so."
29907
+ }
29908
+ },
29909
+ "pull-request": {
29910
+ description: "Pull request monitoring, auto-merge and the `gh` reads behind them.",
29911
+ events: {
29912
+ "merged-state.persist-failed": "A merged pull request's state could not be saved; GitHub stays authoritative and cleanup goes on.",
29913
+ "refresh.failed": "A pull request could not be refreshed; the armed flag stands.",
29914
+ "arm.track-failed": "An armed environment could not be tracked; the monitor's next sync retries.",
29915
+ "gh.pr-list-unparseable": "`gh pr list` returned nothing that parses. Sizes only, never the output.",
29916
+ "monitor.start-failed": "Monitoring could not start for a newly opened pull request.",
29917
+ "cleanup-scheduler.missing": "A merged pull request was seen, but this runtime has no merge cleanup scheduler.",
29918
+ "auto-merge.evaluation-failed": "Evaluating an environment for auto-merge failed.",
29919
+ "auto-merge.merge-failed": "Auto-merge could not merge a pull request; the attempt is held and retried.",
29920
+ "auto-merge.resolve-failed": "Auto-merge could not launch Resolve for a pull request; the attempt is held and retried.",
29921
+ "monitor.detection-failed": "Checking an environment for its pull request failed.",
29922
+ "monitor.detection-admission-failed": "A pull request check could not be admitted to the work pool.",
29923
+ "monitor.terminal-repair-failed": "Repairing a merged or closed pull request's side effects failed.",
29924
+ "monitor.terminal-resume-failed": "Resuming a merged or closed pull request's side effects failed.",
29925
+ "monitor.stale-reading-ignored": "A non-merged reading (`state`) for a pull request already merged was ignored as stale.",
29926
+ "monitor.state-persist-failed": "A pull request's observed state could not be saved.",
29927
+ "monitor.state-clear-failed": "A pull request's saved state could not be cleared.",
29928
+ "monitor.task-reconcile-failed": "Updating the Kanban task of a merged or closed (`state`) pull request failed.",
29929
+ "monitor.task-store-failed": "A pull request could not be recorded on its Kanban task.",
29930
+ "monitor.emit-failed": "A pull request monitor event could not be emitted to its sink."
29931
+ }
29932
+ }
29933
+ });
29934
+
29935
+ // ../protocol/src/log-vocabulary/public-api.ts
29936
+ var PUBLIC_API_LOG_AREAS = defineLogAreas({
29937
+ "public-api": {
29938
+ description: "The public CLI's operations: their outcomes, reconciliation and exec workers.",
29939
+ events: {
29940
+ "outcome.record-failed": "A background operation's outcome could not be recorded; reconciliation settles it.",
29941
+ "goal-checks.stop-failed": "Goal checks could not be stopped.",
29942
+ "exec.list-failed": "Exec workers could not be listed.",
29943
+ "exec.cancel-failed": "An exec could not be cancelled.",
29944
+ "goal-workers.list-failed": "Goal check workers could not be listed.",
29945
+ "operation.reconcile-failed": "Reconciling one operation failed; the next pass retries.",
29946
+ "reconcile.pass-failed": "A reconciliation pass failed; the next one retries."
29947
+ }
29948
+ }
29949
+ });
29950
+
29951
+ // ../protocol/src/log-vocabulary/agent-accounts.ts
29952
+ var AGENT_ACCOUNTS_LOG_AREAS = defineLogAreas({
29953
+ "agent-accounts": {
29954
+ description: "Agent accounts: automatic switching, staged logins and plan usage.",
29955
+ events: {
29956
+ "switch-notice.failed": "A notice about an automatic account switch failed; the switch stands. `audience` says whose.",
29957
+ "auto-switch.check-failed": "An automatic account check failed; the next nudge retries.",
29958
+ "container-sync.failed": "Handing a login or account to a container failed; `step` says which part.",
29959
+ "last-usage.save-failed": "The last plan usage reading could not be saved; the next save retries.",
29960
+ "login-cleanup.failed": "A temporary login could not be cleaned up.",
29961
+ "login-refresh.deferred": "Containers were not told to refresh their login now; they reconcile from its durable generation."
29962
+ }
29963
+ }
29964
+ });
29965
+
29966
+ // ../protocol/src/log-vocabulary/docker.ts
29967
+ var DOCKER_LOG_AREAS = defineLogAreas({
29968
+ docker: {
29969
+ description: "Docker containers: lifecycle, starts, staged inputs and the login files they hold.",
29970
+ events: {
29971
+ "portable-inputs.relay-missing": "Docker is rootless and the image predates the staged-input relay, so the container cannot read them until rebuilt.",
29972
+ "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.",
29973
+ "opencode.warm-incomplete": "OpenCode did not finish loading /workspace in a container.",
29974
+ "login-keeper.pass-failed": "A Claude login keeper pass failed; the next interval retries.",
29975
+ "login-keeper.refresh-failed": "Refreshing the host Claude login failed. Fixed text: CLI output can hold credentials.",
29976
+ "login-keeper.refresh-not-extended": "Refreshing the host Claude login did not extend its expiry.",
29977
+ "login-keeper.refresh-check-failed": "Checking the host Claude login after a refresh failed.",
29978
+ "login-watcher.pass-failed": "A container login file watcher pass failed; the next one retries.",
29979
+ "lifecycle.record-failure-failed": "A failed container operation could not be recorded.",
29980
+ "lifecycle.reconcile-failed": "Reconciling one environment's container operation failed; the next pass retries.",
29981
+ "replacement.clear-terminals-failed": "Terminal sessions could not be cleared after a container replacement.",
29982
+ "recovery.clear-terminals-failed": "Terminal sessions could not be cleared after a recovery restore.",
29983
+ "github-ranges.seed-not-copied": "The GitHub ranges seed could not be copied into a container, so its firewall fetches them.",
29984
+ "availability.probe-failed": "Docker is not available; written when the diagnostic changes. Fixed-shape metadata only: messages can hold daemon endpoints.",
29985
+ "start.port-collision-retrying": "An automatic host port collided on start, so it is retried once with fresh ports."
29986
+ }
29987
+ },
29988
+ "docker.reachability": {
29989
+ description: "Whether agents in containers can reach the backend's agent tools server.",
29990
+ events: {
29991
+ "check.crashed": "A reachability check crashed.",
29992
+ "check.started": "A reachability check started.",
29993
+ "check.finished": "A reachability check finished.",
29994
+ "check.probe": "One probe of a finished check.",
29995
+ "check.summary": "Content-free status and reason for a check that did not find the host reachable.",
29996
+ "check.remediation": "One command the user can run to unblock containers.",
29997
+ "shutdown.awaiting-network": "Shutdown is waiting for probe network preparation.",
29998
+ "shutdown.cleanup-deferred": "Probe network cleanup waits until its preparation settles.",
29999
+ "shutdown.removing-resources": "Shutdown is removing probe resources.",
30000
+ "shutdown.container-remove-failed": "A probe container could not be removed at shutdown.",
30001
+ "shutdown.network-remove-failed": "The probe network could not be removed at shutdown.",
30002
+ "probe.skipped": "A container probe was skipped because the agent tools server is not listening.",
30003
+ "preflight.refused": "A stage was refused because its container cannot reach the host.",
30004
+ "probe.prepare-failed": "A container could not be prepared for a probe.",
30005
+ "probe.result": "The outcome of probing one container.",
30006
+ "probe.contradicts-host": "A container probe disagrees with the host status, so the host is rechecked.",
30007
+ "topology.detected": "The Docker topology was read.",
30008
+ "firewall.detected": "The host firewall was read.",
30009
+ "probe-network.remove-failed": "The probe network could not be removed.",
30010
+ "probe-network.create-failed": "The probe network could not be created, so only the default bridge is checked.",
30011
+ "event.emit-failed": "A reachability event could not be emitted.",
30012
+ "host-addresses.list-failed": "Host addresses could not be listed.",
30013
+ "probe-image.present": "The probe image is already present.",
30014
+ "probe-image.pulling": "The probe image is being pulled.",
30015
+ "probe-image.pulled": "The probe image was pulled.",
30016
+ "probe-image.pull-failed": "The probe image could not be pulled.",
30017
+ "probe-image.fallback": "The environment image is used as the probe image.",
30018
+ "probe-image.missing": "No probe image is available.",
30019
+ "network.list-failed": "Docker networks could not be listed.",
30020
+ "network.inspect-failed": "A Docker network could not be inspected.",
30021
+ "stale-containers.removing": "Stale probe containers are being removed.",
30022
+ "stale-networks.removing": "Stale probe networks are being removed."
30023
+ }
30024
+ }
30025
+ });
30026
+
30027
+ // ../protocol/src/log-vocabulary/mcp.ts
30028
+ var MCP_LOG_AREAS = defineLogAreas({
30029
+ "control-mcp": {
30030
+ description: "The Control MCP server other agents and devices reach Orkestrator through.",
30031
+ events: {
30032
+ "listener.port-free": "The Control MCP's fixed port is free again, so it is listening.",
30033
+ "state-listener.failed": "A Control MCP state listener threw; the others still run.",
30034
+ "delegation.remote-open-failed": "A delegation could not be opened on another node.",
30035
+ "delegation.open-failed": "A coordinator delegation could not be opened."
30036
+ }
30037
+ },
30038
+ "mcp-management": {
30039
+ description: "Managed MCP configuration: its commands, overlays and apply loop.",
30040
+ events: {
30041
+ "command.failed": "An MCP management command failed; `ref` is the correlation id shown to the user.",
30042
+ "overlay.materialise-failed": "An MCP overlay could not be written.",
30043
+ "apply.tick-failed": "An MCP apply tick failed; the next one retries."
30044
+ }
30045
+ }
30046
+ });
30047
+
30048
+ // ../protocol/src/log-vocabulary/design.ts
30049
+ var DESIGN_LOG_AREAS = defineLogAreas({
30050
+ design: {
30051
+ description: "The design canvas: its library, renderer and session links.",
30052
+ events: {
30053
+ "change-signal.failed": "A design change signal failed.",
30054
+ "library.index-write-failed": "The design library index could not be written.",
30055
+ "library.refresh-failed": "The design library could not be refreshed.",
30056
+ "renderer.problem": "The renderer hit a limit or lost a browser; `problem` is a fixed name.",
30057
+ "task.failed": "A design background task failed.",
30058
+ "canvas.needs-recovery": "A design canvas is unreadable and marked for recovery.",
30059
+ "startup.step-failed": "One part of design startup failed; `step` says which.",
30060
+ "legacy.retire-failed": "A migrated legacy design could not be retired.",
30061
+ "profiles.swept": "Design startup removed stale browser profiles.",
30062
+ "session-link.record-failed": "A closing conversation could not be recorded on a design link."
30063
+ }
30064
+ }
30065
+ });
30066
+
30067
+ // ../protocol/src/log-vocabulary/graph.ts
30068
+ var GRAPH_LOG_AREAS = defineLogAreas({
30069
+ graph: {
30070
+ description: "Graph runs: launches, passes, rewinds, system actions and templates.",
30071
+ events: {
30072
+ "describe.pass-failed": "A graph describe pass failed. Content-free: never the description or draft.",
30073
+ "system.stop-failed": "A system action's work could not be stopped.",
30074
+ "system.action-failed": "A system action failed; `cause` is its fixed failure cause.",
30075
+ "attention.update-failed": "The sidebar could not be updated for a run.",
30076
+ "launch.ticket-link-failed": "A launched run's ticket could not be linked.",
30077
+ "launch.started": "A graph run was launched.",
30078
+ "launch.swept": "Runs that ended without an environment were removed.",
30079
+ "rewind.pending": "A run's code rewind has not finished.",
30080
+ "rewind.applied": "A run was restarted or rewound.",
30081
+ "rewind.waiting": "A run waits for its code rewind to finish.",
30082
+ "history.pruned": "Finished runs beyond an environment's history were removed.",
30083
+ "history.prune-failed": "Pruning an environment's run history failed.",
30084
+ "worktree.cleanup-failed": "A run's branch worktree cleanup failed.",
30085
+ "run.unreadable": "A run is unreadable, so it is not scheduled.",
30086
+ "run.pass-failed": "A pass over a run failed.",
30087
+ "transcript.capture-failed": "A run's transcript capture failed.",
30088
+ "ticket.link-failed": "A run's ticket could not be linked to its environment.",
30089
+ "template.skipped": "A built-in template was skipped as invalid or a duplicate."
30090
+ }
30091
+ }
30092
+ });
30093
+
30094
+ // ../protocol/src/log-vocabulary/nodes.ts
30095
+ var NODES_LOG_AREAS = defineLogAreas({
30096
+ nodes: {
30097
+ description: "Command nodes: links, handovers, leaf mail and project copies.",
30098
+ events: {
30099
+ "actions.resume-failed": "Approved actions could not be resumed; a later pass retries.",
30100
+ "project-copy.notify-failed": "The coordinator could not be told a project copy finished.",
30101
+ "mail.delivery-deferred": "Leaf mail could not reach a coordinator yet.",
30102
+ "command.post-step-failed": "A step after a routed command failed.",
30103
+ "seed-files.incomplete": "Seed files for a leaf environment were not all copied.",
30104
+ "contact.record-failed": "The latest controller contact could not be recorded.",
30105
+ "settings.send-failed": "Settings could not be sent to a node.",
30106
+ "verification.record-failed": "A node verification could not be recorded.",
30107
+ "profile.record-failed": "A node profile could not be recorded.",
30108
+ "detach.unconfirmed": "A forgotten node has not confirmed the detach yet.",
30109
+ "handover.recovery-pending": "Command handover recovery is still pending."
30110
+ }
30111
+ }
30112
+ });
30113
+
30114
+ // ../protocol/src/log-vocabulary/linear.ts
30115
+ var LINEAR_LOG_AREAS = defineLogAreas({
30116
+ linear: {
30117
+ description: "Linear issues read for build actions.",
30118
+ events: {
30119
+ "comments.load-failed": "An issue's comments could not be loaded; the issue still renders without them."
30120
+ }
30121
+ }
30122
+ });
30123
+
30124
+ // ../protocol/src/log-vocabulary/usage-history.ts
30125
+ var USAGE_HISTORY_LOG_AREAS = defineLogAreas({
30126
+ "usage-history": {
30127
+ description: "Recorded agent token usage.",
30128
+ events: {
30129
+ "record.failed": "Agent usage could not be recorded; a later read counts it.",
30130
+ "prune.failed": "Pruning recorded usage failed; the next prune retries."
30131
+ }
30132
+ }
30133
+ });
30134
+
30135
+ // ../protocol/src/log-vocabulary/feature.ts
30136
+ var FEATURE_LOG_AREAS = defineLogAreas({
30137
+ feature: {
30138
+ description: "Pipeline environments started from a feature, and feature planning.",
30139
+ events: {
30140
+ "naming.fallback": "Automatic naming failed, so a local fallback name is used. Error kind only: the description stays out.",
30141
+ "planning.legacy-adopt-failed": "Legacy planning conversations could not be adopted.",
30142
+ "planning.tick-retrying": "A planning tick failed on a transient error; the next tick retries."
30143
+ }
30144
+ }
30145
+ });
30146
+
30147
+ // ../protocol/src/log-vocabulary/host.ts
30148
+ var HOST_LOG_AREAS = defineLogAreas({
30149
+ host: {
30150
+ description: "The host machine: its executables, load, suspends and maintenance.",
30151
+ events: {
30152
+ "path.discovered": "Executable discovery finished. Counts and booleans only: PATH entries can hold private directory names.",
30153
+ "tool.available": "A host tool's availability was read.",
30154
+ "tool.missing": "A host tool was not found.",
30155
+ "maintenance.listener-failed": "A host maintenance listener threw; the others still run.",
30156
+ "suspend.reconcile-failed": "Reconciling due work after a host suspension failed.",
30157
+ "load.sample-failed": "Sampling machine load failed; the next sample retries."
30158
+ }
30159
+ }
30160
+ });
30161
+
30162
+ // ../protocol/src/log-vocabulary/transcript-artifacts.ts
30163
+ var TRANSCRIPT_ARTIFACTS_LOG_AREAS = defineLogAreas({
30164
+ "transcript-artifacts": {
30165
+ description: "Transcript artifacts: previews, printing, grants and their ledger. Ids, kinds, sizes and reason codes only.",
30166
+ events: {
30167
+ "announce-failed": "An artifact change could not be announced.",
30168
+ "cleanup-failed": "An artifact cleanup failed.",
30169
+ "grant-revocation-failed": "A grant could not be revoked.",
30170
+ "ledger-listener-failed": "A ledger listener threw.",
30171
+ "ledger-read-failed": "The ledger could not be read.",
30172
+ "operation-executor-failed": "A preview operation's executor failed.",
30173
+ "operation-failed": "A preview operation failed.",
30174
+ "pdf-preview": "A PDF preview was served.",
30175
+ "pdf-preview-failed": "A PDF preview failed.",
30176
+ "pdf-print-failed": "Printing an artifact to PDF failed.",
30177
+ "pdf-printed": "An artifact was printed to PDF.",
30178
+ "runtime-unavailable": "The artifact runtime could not be created."
30179
+ }
30180
+ }
30181
+ });
30182
+
30183
+ // ../protocol/src/log-vocabulary/scheduler.ts
30184
+ var SCHEDULER_LOG_AREAS = defineLogAreas({
30185
+ scheduler: {
30186
+ description: "Scheduled jobs and the backend-owned timing that fires them.",
30187
+ events: {
30188
+ "tick.failed": "A scheduler tick failed; the next tick retries.",
30189
+ "job.claim-failed": "A due job could not be claimed.",
30190
+ "fire.heartbeat-failed": "A running fire's heartbeat could not be recorded.",
30191
+ "fire.outcome-record-failed": "A finished fire's outcome could not be recorded."
30192
+ }
30193
+ }
30194
+ });
30195
+
29504
30196
  // ../protocol/src/log-vocabulary/web-app.ts
29505
30197
  var WEB_APP_LOG_AREAS = defineLogAreas({
29506
30198
  "web.app": {
@@ -29668,7 +30360,7 @@ var WEB_ENVIRONMENT_LOG_AREAS = defineLogAreas({
29668
30360
  "models.pi-seed-failed": "The create dialog could not seed the Pi model catalogue.",
29669
30361
  "models.opencode-cache-load-failed": "The create dialog could not read cached OpenCode models.",
29670
30362
  "github-credential.check-failed": "The GitHub credential check before creating failed.",
29671
- "feature-build.start-failed": "Starting a feature build from the dialog failed.",
30363
+ "feature-build.start-failed": "Starting a pipeline environment from the dialog failed.",
29672
30364
  "settings.extensions-load-failed": "The settings dialog could not load extensions.",
29673
30365
  "settings.container-reset-failed": "The settings dialog could not reset the container.",
29674
30366
  "settings.save-failed": "The settings dialog could not save.",
@@ -29960,6 +30652,25 @@ var LOG_VOCABULARY = {
29960
30652
  ...TMUX_LOG_AREAS,
29961
30653
  ...UPDATER_LOG_AREAS,
29962
30654
  ...WEB_ANNOTATIONS_LOG_AREAS,
30655
+ ...STORAGE_LOG_AREAS,
30656
+ ...BUILD_PIPELINE_LOG_AREAS,
30657
+ ...AGENT_BRANCH_LOG_AREAS,
30658
+ ...CHANGE_TRACKING_LOG_AREAS,
30659
+ ...COORDINATOR_LOG_AREAS,
30660
+ ...REVIEW_LOG_AREAS,
30661
+ ...PUBLIC_API_LOG_AREAS,
30662
+ ...AGENT_ACCOUNTS_LOG_AREAS,
30663
+ ...DOCKER_LOG_AREAS,
30664
+ ...MCP_LOG_AREAS,
30665
+ ...DESIGN_LOG_AREAS,
30666
+ ...GRAPH_LOG_AREAS,
30667
+ ...NODES_LOG_AREAS,
30668
+ ...LINEAR_LOG_AREAS,
30669
+ ...USAGE_HISTORY_LOG_AREAS,
30670
+ ...FEATURE_LOG_AREAS,
30671
+ ...HOST_LOG_AREAS,
30672
+ ...TRANSCRIPT_ARTIFACTS_LOG_AREAS,
30673
+ ...SCHEDULER_LOG_AREAS,
29963
30674
  ...WEB_APP_LOG_AREAS,
29964
30675
  ...WEB_BUILD_PIPELINE_LOG_AREAS,
29965
30676
  ...WEB_CHAT_LOG_AREAS,
@@ -30137,7 +30848,10 @@ function deliver(record) {
30137
30848
  line: config2.format === "json" ? renderJson(record) : renderText(record),
30138
30849
  record
30139
30850
  });
30140
- } catch {}
30851
+ return true;
30852
+ } catch {
30853
+ return false;
30854
+ }
30141
30855
  }
30142
30856
  function buildRecord(level, area, event, fields) {
30143
30857
  const clean = fields ? sanitizeFields(fields, areaSpec(area)?.maxStringChars ?? MAX_FIELD_CHARS) : undefined;
@@ -30293,6 +31007,19 @@ function resolveFields(fields) {
30293
31007
  return { fieldsFailed: true };
30294
31008
  }
30295
31009
  }
31010
+ function deliverEvent(level, area, event, fields) {
31011
+ const spec = areaSpec(area);
31012
+ if (!spec)
31013
+ return deliver(buildRecord(level, "logging", "unknown-area", undefined));
31014
+ if (!Object.hasOwn(spec.events, event))
31015
+ return deliver(buildRecord(level, area, "invalid-event", undefined));
31016
+ return deliver(buildRecord(level, area, event, fields));
31017
+ }
31018
+ function tryWriteLog(level, area, event, fields) {
31019
+ if (LEVEL_RANK[level] > thresholdRank(area))
31020
+ return false;
31021
+ return deliverEvent(level, area, event, resolveFields(fields));
31022
+ }
30296
31023
  function createLogger(area) {
30297
31024
  const spec = areaSpec(area);
30298
31025
  let seenGeneration = -1;
@@ -30305,13 +31032,7 @@ function createLogger(area) {
30305
31032
  return LEVEL_RANK[level] <= rank;
30306
31033
  };
30307
31034
  const writeResolved = (level, event, resolved) => {
30308
- if (!spec) {
30309
- deliver(buildRecord(level, "logging", "unknown-area", undefined));
30310
- } else if (Object.hasOwn(spec.events, event)) {
30311
- deliver(buildRecord(level, area, event, resolved));
30312
- } else {
30313
- deliver(buildRecord(level, area, "invalid-event", undefined));
30314
- }
31035
+ deliverEvent(level, area, event, resolved);
30315
31036
  };
30316
31037
  const write = (level, event, fields) => {
30317
31038
  if (!enabled(level))
@@ -33880,8 +34601,19 @@ function pushMessage(state, role, content, parts, createdAt, messageId = randomB
33880
34601
  }
33881
34602
  // ../protocol/src/node/bridge-diagnostics.ts
33882
34603
  import { createHash as createHash4 } from "node:crypto";
33883
- var log2 = createLogger("bridge.diagnostics");
33884
- var INTERVAL_MS = 60000;
34604
+
34605
+ // ../protocol/src/event-loop-stall-monitor.ts
34606
+ var log2 = createLogger("event-loop");
34607
+ var EVENT_LOOP_STALL_ALWAYS_LOG_MS = 1e4;
34608
+
34609
+ // ../protocol/src/node/bridge-diagnostics.ts
34610
+ var log3 = createLogger("bridge.diagnostics");
34611
+ var BRIDGE_DIAGNOSTICS_INTERVAL_MS = 60000;
34612
+ var INTERVAL_MS = BRIDGE_DIAGNOSTICS_INTERVAL_MS;
34613
+ var STALL_NO_DELTA_MS = 2 * INTERVAL_MS;
34614
+ var STALL_TOOL_PENDING_MS = 10 * 60000;
34615
+ var STALL_TICK_DELAY_MS = EVENT_LOOP_STALL_ALWAYS_LOG_MS;
34616
+ var BRIDGE_DIAGNOSTICS_KEEPALIVE_MS = 10 * 60000;
33885
34617
  var MAX_PENDING_TOOLS = 128;
33886
34618
  var MAX_REPORTED_TOOLS = 8;
33887
34619
  var MAX_ID_LENGTH = 1024;
@@ -33942,6 +34674,28 @@ var UPDATE_KINDS = new Set([
33942
34674
  "step-started",
33943
34675
  "step-completed"
33944
34676
  ]);
34677
+ var COUNTER_CHANGE_THRESHOLDS = {
34678
+ stderrBytes: 4096,
34679
+ requestsSent: 1,
34680
+ responsesReceived: 1,
34681
+ timeouts: 1,
34682
+ notificationsReceived: Number.POSITIVE_INFINITY,
34683
+ protocolErrors: 1
34684
+ };
34685
+ var WAITING_PHASES = new Set([
34686
+ "sending",
34687
+ "following",
34688
+ "draining",
34689
+ "cancelling"
34690
+ ]);
34691
+ function sameSet(a, b) {
34692
+ if (a.size !== b.size)
34693
+ return false;
34694
+ for (const value of a)
34695
+ if (!b.has(value))
34696
+ return false;
34697
+ return true;
34698
+ }
33945
34699
  function identity(value) {
33946
34700
  if (typeof value !== "string" || !value || value.length > MAX_ID_LENGTH)
33947
34701
  return;
@@ -34017,26 +34771,35 @@ function safeDiagnosticMetrics(value) {
34017
34771
  result.state = value.state;
34018
34772
  return result;
34019
34773
  }
34774
+ function bridgeDiagnosticsChangesEnabled() {
34775
+ return log3.isEnabled("trace");
34776
+ }
34020
34777
  function writeBridgeDiagnostic({ bridge, event, payload }) {
34021
- log2.info(event, { bridge, payload });
34778
+ return tryWriteLog("info", "bridge.diagnostics", event, { bridge, payload });
34022
34779
  }
34023
34780
  function bridgeDiagnosticsActive() {
34024
- return log2.isEnabled("info");
34781
+ return log3.isEnabled("info");
34782
+ }
34783
+ function bridgeDiagnosticsStreamEnabled(bridge) {
34784
+ return bridgeDebugEnabled(bridge) || log3.isEnabled("debug");
34025
34785
  }
34026
34786
  function writeDiagnostic(bridge, event, payload, write) {
34027
34787
  try {
34028
34788
  const json = JSON.stringify({ bridge, event, ...payload });
34029
34789
  const bytes = Buffer.byteLength(json);
34030
34790
  if (bytes <= MAX_BRIDGE_DIAGNOSTIC_BYTES) {
34031
- write({ bridge, event, payload: json });
34032
- return;
34791
+ const accepted = write({ bridge, event, payload: json });
34792
+ return accepted !== false;
34033
34793
  }
34034
- write({
34794
+ const accepted = write({
34035
34795
  bridge,
34036
34796
  event: "snapshot-overflow",
34037
34797
  payload: JSON.stringify({ bridge, event: "snapshot-overflow", omittedBytes: bytes })
34038
34798
  });
34039
- } catch {}
34799
+ return accepted !== false;
34800
+ } catch {
34801
+ return false;
34802
+ }
34040
34803
  }
34041
34804
 
34042
34805
  class BridgeRunDiagnostics {
@@ -34068,6 +34831,7 @@ class BridgeRunDiagnostics {
34068
34831
  completedTools = 0;
34069
34832
  pending = new Map;
34070
34833
  phase = "sending";
34834
+ processScope = false;
34071
34835
  terminal = "pending";
34072
34836
  stream = "pending";
34073
34837
  cancellation = "none";
@@ -34075,6 +34839,8 @@ class BridgeRunDiagnostics {
34075
34839
  run;
34076
34840
  closed = false;
34077
34841
  wasActive;
34842
+ baseline;
34843
+ changeQueued = false;
34078
34844
  timer;
34079
34845
  constructor(bridge, state, now = Date.now, write = writeBridgeDiagnostic, intervalMs = INTERVAL_MS, metrics = () => ({}), active = () => true) {
34080
34846
  this.bridge = bridge;
@@ -34120,7 +34886,8 @@ class BridgeRunDiagnostics {
34120
34886
  return;
34121
34887
  }
34122
34888
  if (stage === "completed") {
34123
- this.pending.delete(key);
34889
+ if (this.pending.delete(key))
34890
+ this.changed();
34124
34891
  this.completedTools++;
34125
34892
  return;
34126
34893
  }
@@ -34135,13 +34902,23 @@ class BridgeRunDiagnostics {
34135
34902
  stage: stage === "started" || existing?.stage === "started" ? "started" : "partial",
34136
34903
  nested
34137
34904
  });
34905
+ if (!existing)
34906
+ this.changed();
34138
34907
  }
34139
34908
  checkpoint(phase) {
34909
+ if (phase === "attached")
34910
+ this.processScope = true;
34911
+ if (phase === this.phase)
34912
+ return;
34140
34913
  this.phase = phase;
34914
+ this.changed();
34141
34915
  }
34142
34916
  count(key, amount = 1) {
34143
- if (!this.closed && Number.isSafeInteger(amount) && amount >= 0)
34144
- this.counters[key] += amount;
34917
+ if (this.closed || !Number.isSafeInteger(amount) || amount < 0)
34918
+ return;
34919
+ this.counters[key] += amount;
34920
+ if (amount > 0 && Number.isFinite(COUNTER_CHANGE_THRESHOLDS[key]))
34921
+ this.changed();
34145
34922
  }
34146
34923
  translationFailed() {
34147
34924
  this.translationFailures++;
@@ -34157,8 +34934,10 @@ class BridgeRunDiagnostics {
34157
34934
  }
34158
34935
  terminalSettled(outcome) {
34159
34936
  this.terminal = outcome;
34160
- if (outcome === "resolved")
34937
+ if (outcome === "resolved" && this.phase !== "draining") {
34161
34938
  this.phase = "draining";
34939
+ this.changed();
34940
+ }
34162
34941
  }
34163
34942
  requestCancellation(reason = "user") {
34164
34943
  this.cancellation = "pending";
@@ -34180,12 +34959,38 @@ class BridgeRunDiagnostics {
34180
34959
  if (this.closed)
34181
34960
  return;
34182
34961
  const now = this.now();
34183
- const age = (time) => time === undefined ? null : Math.max(0, now - time);
34184
34962
  const tickDelayMs = event === "heartbeat" ? Math.max(0, now - this.lastTick - this.intervalMs) : 0;
34185
34963
  if (event === "heartbeat")
34186
34964
  this.lastTick = now;
34187
- if (!this.active() || !bridgeDiagnosticsActive())
34965
+ if (!bridgeDiagnosticsActive())
34188
34966
  return;
34967
+ const stall = this.stallState(now, tickDelayMs);
34968
+ if (event === "heartbeat" && !this.active() && !this.periodicDue(now, stall))
34969
+ return;
34970
+ this.writeSnapshot(event, now, tickDelayMs, stall);
34971
+ }
34972
+ changed() {
34973
+ if (this.closed || this.changeQueued || !bridgeDiagnosticsChangesEnabled())
34974
+ return;
34975
+ this.changeQueued = true;
34976
+ queueMicrotask(() => {
34977
+ this.changeQueued = false;
34978
+ this.reportChange();
34979
+ });
34980
+ }
34981
+ reportChange() {
34982
+ if (this.closed || !bridgeDiagnosticsChangesEnabled() || !bridgeDiagnosticsActive())
34983
+ return;
34984
+ const last = this.baseline;
34985
+ if (last && !this.changedSince(last))
34986
+ return;
34987
+ const now = this.now();
34988
+ try {
34989
+ this.writeSnapshot("change", now, 0, this.stallState(now, 0));
34990
+ } catch {}
34991
+ }
34992
+ writeSnapshot(event, now, tickDelayMs, stall) {
34993
+ const age = (time) => time === undefined ? null : Math.max(0, now - time);
34189
34994
  const pendingTools = Array.from(this.pending.entries()).slice(0, MAX_REPORTED_TOOLS).map(([id, tool]) => ({
34190
34995
  id,
34191
34996
  kind: tool.kind,
@@ -34194,7 +34999,7 @@ class BridgeRunDiagnostics {
34194
34999
  ageMs: age(tool.since)
34195
35000
  }));
34196
35001
  try {
34197
- writeDiagnostic(this.bridge, event, {
35002
+ const written = writeDiagnostic(this.bridge, event, {
34198
35003
  session: identity(this.state.id),
34199
35004
  run: this.run,
34200
35005
  phase: this.phase,
@@ -34221,8 +35026,64 @@ class BridgeRunDiagnostics {
34221
35026
  completedTools: this.completedTools,
34222
35027
  tickDelayMs
34223
35028
  }, this.write);
35029
+ if (!written)
35030
+ return;
35031
+ this.baseline = {
35032
+ at: now,
35033
+ phase: this.phase,
35034
+ pending: new Set(this.pending.keys()),
35035
+ counters: { ...this.counters },
35036
+ stall
35037
+ };
34224
35038
  } catch {}
34225
35039
  }
35040
+ periodicDue(now, stall) {
35041
+ if (stall.signals.has("tick-delay"))
35042
+ return true;
35043
+ const last = this.baseline;
35044
+ if (!last)
35045
+ return true;
35046
+ if (!sameSet(stall.signals, last.stall.signals) || !sameSet(stall.tools, last.stall.tools))
35047
+ return true;
35048
+ if (stall.signals.has("no-delta") && this.changedSince(last))
35049
+ return true;
35050
+ return now - last.at >= BRIDGE_DIAGNOSTICS_KEEPALIVE_MS;
35051
+ }
35052
+ changedSince(last) {
35053
+ if (this.phase !== last.phase)
35054
+ return true;
35055
+ if (this.pending.size !== last.pending.size)
35056
+ return true;
35057
+ for (const key of this.pending.keys())
35058
+ if (!last.pending.has(key))
35059
+ return true;
35060
+ for (const key of Object.keys(this.counters))
35061
+ if (this.counters[key] - last.counters[key] >= COUNTER_CHANGE_THRESHOLDS[key])
35062
+ return true;
35063
+ return false;
35064
+ }
35065
+ stallState(now, tickDelayMs) {
35066
+ const signals = new Set;
35067
+ const tools = new Set;
35068
+ let oldestPending;
35069
+ for (const [key, tool] of this.pending) {
35070
+ if (oldestPending === undefined || tool.since < oldestPending)
35071
+ oldestPending = tool.since;
35072
+ if (now - tool.since >= STALL_TOOL_PENDING_MS)
35073
+ tools.add(key);
35074
+ }
35075
+ const waitingSince = this.processScope ? oldestPending : WAITING_PHASES.has(this.phase) ? this.startedAt : undefined;
35076
+ if (waitingSince !== undefined) {
35077
+ const quietSince = Math.max(this.lastDelta ?? waitingSince, waitingSince);
35078
+ if (now - quietSince >= STALL_NO_DELTA_MS)
35079
+ signals.add("no-delta");
35080
+ }
35081
+ if (tools.size > 0)
35082
+ signals.add("tool-pending");
35083
+ if (tickDelayMs >= STALL_TICK_DELAY_MS)
35084
+ signals.add("tick-delay");
35085
+ return { signals, tools };
35086
+ }
34226
35087
  close(phase = "finished") {
34227
35088
  if (this.closed)
34228
35089
  return;
@@ -34235,8 +35096,9 @@ class BridgeRunDiagnostics {
34235
35096
  }
34236
35097
  }
34237
35098
  function createBridgeDiagnostics(bridge, state, metrics) {
34238
- return new BridgeRunDiagnostics(bridge, state, undefined, undefined, undefined, metrics, () => bridgeDebugEnabled(bridge));
35099
+ return new BridgeRunDiagnostics(bridge, state, undefined, undefined, undefined, metrics, () => bridgeDiagnosticsStreamEnabled(bridge));
34239
35100
  }
35101
+ var bufferedFlushes = new Set;
34240
35102
 
34241
35103
  // ../protocol/src/structured-output-text.ts
34242
35104
  var STRUCTURED_OUTPUT_RECOVERY_CHARS = 1024 * 1024;
@@ -36612,7 +37474,7 @@ async function answerSessionActivityBatch(body, read, options = {}) {
36612
37474
  }
36613
37475
 
36614
37476
  // ../../bridges/pi-bridge/src/http.ts
36615
- var log3 = createLogger("bridge.pi");
37477
+ var log4 = createLogger("bridge.pi");
36616
37478
 
36617
37479
  class HttpError extends Error {
36618
37480
  status;
@@ -36696,7 +37558,7 @@ async function route(request, response, clientSignal) {
36696
37558
  if (error instanceof PromptAttachmentError) {
36697
37559
  return json(response, 400, { error: error.message });
36698
37560
  }
36699
- log3.error("http.route-failed");
37561
+ log4.error("http.route-failed");
36700
37562
  return json(response, 500, { error: "Internal bridge error" });
36701
37563
  }
36702
37564
  }
@@ -37696,7 +38558,7 @@ function startParentWatchdog(options) {
37696
38558
  }
37697
38559
 
37698
38560
  // ../protocol/src/bridge-lifecycle.ts
37699
- var log4 = createLogger("bridge.lifecycle");
38561
+ var log5 = createLogger("bridge.lifecycle");
37700
38562
  var TERMINATION_SIGNALS = ["SIGTERM", "SIGINT"];
37701
38563
  function errorKind(error) {
37702
38564
  if (error instanceof Error)
@@ -37750,7 +38612,7 @@ class BridgeLifecycle {
37750
38612
  }
37751
38613
  requestExit() {
37752
38614
  this.#exit ??= this.shutdown().then(() => this.#options.exit(0), (error) => {
37753
- log4.error("shutdown.failed", {
38615
+ log5.error("shutdown.failed", {
37754
38616
  bridge: this.#options.label,
37755
38617
  errorClass: errorKind(error)
37756
38618
  });
@@ -37767,7 +38629,7 @@ class BridgeLifecycle {
37767
38629
  try {
37768
38630
  idleSweep.run();
37769
38631
  } catch (error) {
37770
- log4.warn("idle-sweep.failed", {
38632
+ log5.warn("idle-sweep.failed", {
37771
38633
  bridge: this.#options.label,
37772
38634
  errorClass: errorKind(error)
37773
38635
  });