orkestrator 2.37.3-beta → 2.37.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.
@@ -929,10 +929,13 @@ var BRIDGE_LOG_AREAS = defineLogAreas({
929
929
  "prompt.accepted": "The route accepted a prompt and answered 202.",
930
930
  "prompt.failed": "A prompt turn failed; the session reports the error.",
931
931
  "prompt.processing-failed": "A prompt accepted by the route failed while processing.",
932
+ "prompt.processing-usage-limited": "A prompt accepted by the route ended on a usage limit; the turn already logged prompt.usage-limited.",
932
933
  "prompt.received": "A prompt reached the bridge; only its length is logged.",
933
934
  "prompt.send-failed": "A prompt request failed; the route answered with an error.",
935
+ "prompt.usage-limited": "A prompt turn ended because the account's plan allowance is used up; the session reports the limit.",
934
936
  "query.close-failed": "Stopping the Claude query failed while closing a tab; the close stays pending.",
935
937
  "query.failed": "A Claude query ended with an error result.",
938
+ "query.usage-limited": "Claude refused a query because the account's plan allowance is used up; the turn reports the limit.",
936
939
  "question.answer-failed": "The answer-question route failed.",
937
940
  "question.answering": "Answering a parked question.",
938
941
  "question.answers-prepared": "The route prepared a question answer for the session.",
@@ -1131,10 +1134,10 @@ var DESKTOP_LOG_AREAS = defineLogAreas({
1131
1134
  "dev-mode.ignored-packaged": "A packaged app was launched with ELECTRON_DEV=1 and ignored it; it loads its bundled renderer.",
1132
1135
  "instance.already-running": "Another instance holds this data directory; this one will quit.",
1133
1136
  "main-thread.stalled": {
1134
- description: "A timer fired late, so windows, IPC and the stdout reader waited.",
1137
+ description: "A timer fired late, so windows, IPC and the stdout reader waited. `cpuMs` is the CPU time the process used in the window: near `lagMs` the main thread was busy, far below it the thread waited.",
1135
1138
  essential: true,
1136
1139
  minLevel: "error",
1137
- fields: { lagMs: "number", intervalMs: "number" }
1140
+ fields: { lagMs: "number", intervalMs: "number", cpuMs: "number" }
1138
1141
  },
1139
1142
  "process-memory": "Development only: working set per Electron process type, sampled on an interval.",
1140
1143
  "process-memory.failed": "Development only: one process memory sample could not be read.",
@@ -1184,12 +1187,22 @@ var DESKTOP_LOG_AREAS = defineLogAreas({
1184
1187
  denied: "A renderer asked for a permission the policy does not grant."
1185
1188
  }
1186
1189
  },
1190
+ "desktop.webrequest": {
1191
+ description: "Main-process webRequest listeners on Electron sessions. Listener names only; never a URL, header or error message.",
1192
+ events: {
1193
+ "listener.failed-closed": "A listener's decision threw or rejected, so it answered with its fail-closed response.",
1194
+ "observer.failed": "A listener with no callback (a redirect observer) threw; its fallback ran.",
1195
+ "callback.failed": "Electron's webRequest callback threw while a listener answered.",
1196
+ ...THROTTLE_LOG_EVENTS
1197
+ }
1198
+ },
1187
1199
  "desktop.dialog": {
1188
1200
  description: "Native dialogs, whose modal loops hold the main thread while they are open.",
1189
1201
  events: {
1190
1202
  "attention-failed": "A dialog could not ask for the user's attention.",
1191
1203
  closed: "A native dialog closed.",
1192
1204
  "hidden-cancelled": "A hidden profile cancelled a dialog without opening native UI.",
1205
+ "no-display-cancelled": "A headless Electron with no display cancelled a dialog instead of opening native UI.",
1193
1206
  "open-failed": "A dialog could not open; it was answered as cancelled.",
1194
1207
  opening: "A native dialog is opening.",
1195
1208
  "preview-beforeunload-ignored": "A browser preview's beforeunload handler was ignored.",
@@ -1545,6 +1558,7 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
1545
1558
  "agent-tools.unavailable": "OpenCode agent tools remain unavailable for a session.",
1546
1559
  "coordinator-servers.unavailable": "OpenCode coordinator research servers are unavailable.",
1547
1560
  "monitor.reconnecting": "The request monitor lost its stream and is reconnecting. Error class only.",
1561
+ "monitor.silent": "The request monitor's stream stopped heartbeating, so it is replaced. `silenceMs` only.",
1548
1562
  "worker-limit.reached": "The bounded request workers are full, so the stream restarts and a snapshot reconciles.",
1549
1563
  "request.failed": "Handling a request event failed, so the stream restarts. Error class only.",
1550
1564
  "credential-plugin.skipped": "A host OpenCode server started without the credential plugin, so its tools inherit its password; `reason` says why.",
@@ -1567,6 +1581,7 @@ var NATIVE_AGENT_LOG_AREAS = defineLogAreas({
1567
1581
  "host-server.terminate-failed": "A 2.x server that did not become ready could not be stopped; its process entry is kept for shutdown. Error class only.",
1568
1582
  "container-server.launched": "The start script of a container environment's 2.x server was run. Container port only.",
1569
1583
  "container-server.ready": "A container environment's 2.x server this backend started answered `/api/info` as 2.x. Environment id only.",
1584
+ "container-server.cleanup-failed": "Cleanup after OpenCode startup failed; step names only, while the original startup error is preserved.",
1570
1585
  "container-server.warm-incomplete": "The first workspace request to a container's new 2.x server failed, so its plugins load on the next one. Error class only.",
1571
1586
  "resume-list.unavailable": "The 2.x sessions could not be listed for the resume picker, so it shows the 1.x list alone. Error class only.",
1572
1587
  "credential.mirrored": "A provider sign-in change was copied into the 2.x database. `outcome` (written, removed, unchanged, skipped) only; never a provider id or value.",
@@ -1621,12 +1636,13 @@ var RUNTIME_LOG_AREAS = defineLogAreas({
1621
1636
  description: "This process's event loop. A stall of 10 seconds or more is written at error, so no level hides it.",
1622
1637
  events: {
1623
1638
  stalled: {
1624
- description: "A timer fired late, so every request in that window waited. In the backend the line also names what ran: `storageMs` and the `storage*` fields describe the slow SQLite calls in the window (`operation.slow` in `storage`), `commandsInFlight` and `commands` the commands running, and `blockingCommand` one whose synchronous part overlapped it.",
1639
+ description: "A timer fired late, so every request in that window waited. In the backend the line also names what ran: `storageMs` and the `storage*` fields describe the slow SQLite calls in the window (`operation.slow` in `storage`), `commandsInFlight` and `commands` the commands running, `blockingCommand` one whose synchronous part overlapped it, and `jobsInWindow` and `jobs` the recurring jobs that ran around it. `cpuMs` is the CPU time the process used in the window: near `lagMs` its own thread was busy, far below it the thread waited.",
1625
1640
  essential: true,
1626
1641
  minLevel: "error",
1627
1642
  fields: {
1628
1643
  lagMs: "number",
1629
1644
  intervalMs: "number",
1645
+ cpuMs: "number",
1630
1646
  storageMs: "number",
1631
1647
  storageDatabase: "label",
1632
1648
  storageOp: "label",
@@ -1634,7 +1650,8 @@ var RUNTIME_LOG_AREAS = defineLogAreas({
1634
1650
  storageLongestMs: "number",
1635
1651
  storageBusy: "boolean",
1636
1652
  commandsInFlight: "number",
1637
- blockingCommandMs: "number"
1653
+ blockingCommandMs: "number",
1654
+ jobsInWindow: "number"
1638
1655
  }
1639
1656
  }
1640
1657
  }
@@ -1674,6 +1691,8 @@ var TERMINAL_LOG_AREAS = defineLogAreas({
1674
1691
  "pty.exit-notify-failed": "Notifying a terminal's exit failed.",
1675
1692
  "pty.late-exit-listener-failed": "A listener added after a terminal exited threw.",
1676
1693
  "setup.pty-reused": "A setup terminal reused its existing PTY.",
1694
+ "setup.pty-retired": "A setup retry ended the terminal the previous run left open, so the new run gets its own.",
1695
+ "setup.pty-retire-failed": "A setup retry could not end the previous run's process tree, so it kept that terminal and started nothing.",
1677
1696
  "setup.pty-spawning": "A setup terminal is spawning its PTY. The argument count only, never the arguments.",
1678
1697
  "setup.pty-spawned": "A setup terminal's PTY started.",
1679
1698
  "setup.pty-exited": "A setup terminal's PTY exited.",
@@ -1801,6 +1820,7 @@ var TMUX_LOG_AREAS = defineLogAreas({
1801
1820
  "cleanup.skipped": "Environment tmux cleanup was skipped because tmux could not be reached and nothing required it.",
1802
1821
  "cleanup.environments-load-failed": "Environments could not be loaded during tmux cleanup, so it stays incomplete.",
1803
1822
  "cleanup.kill-failed": "An environment's tmux sessions could not be killed.",
1823
+ "cleanup.kill-incomplete": "An environment's tmux sessions could not all be shown gone (a session survived, or the socket was unreachable while another tmux process might own it), so cleanup stays incomplete.",
1804
1824
  "hooks.uninstall-failed": "Workspace hooks could not be uninstalled.",
1805
1825
  "hooks.git-exclude-failed": "The git exclude for Claude's local settings could not be set.",
1806
1826
  "naming.prepare-failed": "First-prompt naming could not be prepared; the prompt still goes ahead.",
@@ -1930,6 +1950,7 @@ var STORAGE_LOG_AREAS = defineLogAreas({
1930
1950
  "config.restrict-mode-failed": "A config file holding provider secrets could not be set to owner-only; the backend carries on.",
1931
1951
  "legacy-json.moved": "JSON store files written after the SQLite migration were archived, not imported.",
1932
1952
  "legacy-json.archive-failed": "Imported JSON store files could not be archived.",
1953
+ "native-session-owners.backfill-failed": "Native-session rows could not be given their environment as owner at open; an environment delete then parses those rows instead, and the next open retries.",
1933
1954
  "lease.timed-out": "A waiter gave up on a lease; `lease` and `family` name it, `holderAgeMs` is the time since its holder's last heartbeat (null when the holder had just gone), `waitedMs` how long the waiter waited.",
1934
1955
  "lease.heartbeat-failed": "A held lease's heartbeat failed, which shortens the lease; the next one retries.",
1935
1956
  "scrub.vacuum-failed": "Deleted-content page reclamation failed; the checkpoint is attempted independently.",
@@ -1979,9 +2000,12 @@ var BUILD_PIPELINE_LOG_AREAS = defineLogAreas({
1979
2000
  "transcripts.maintenance-failed": "Migrating or sweeping stage transcripts failed; the next start retries.",
1980
2001
  "restore.skipped": "A pipeline could not be restored at startup and was skipped.",
1981
2002
  "criteria.record-failed": "Acceptance criteria results could not be recorded on the ticket.",
2003
+ "completion-notes.publish-failed": "A finished pipeline's notes tab could not be added to the layout; the run stays complete.",
1982
2004
  "workspace.waiting": "A pipeline is waiting for its workspace; written once per reason.",
1983
2005
  "rewind.pending": "A pipeline's code rewind has not finished; written once per reason.",
1984
2006
  "kanban.status-failed": "A restarted pipeline's Kanban status could not be set; it retries shortly.",
2007
+ "kanban.environment-deleted-read-failed": "The pipelines of an environment being deleted could not be read, so their tickets keep their columns.",
2008
+ "kanban.environment-deleted-update-failed": "The ticket of a pipeline whose environment was deleted could not be moved; the deletion goes on.",
1985
2009
  "usage.read-failed": "Reading a stage session's token usage failed.",
1986
2010
  "checkpoint.deferred": "A stage transcript checkpoint could not be written yet; the provider's history stands.",
1987
2011
  "checkpoint.not-committed": "A stage transcript checkpoint was reverted in the commit that should have kept it.",
@@ -2020,6 +2044,8 @@ var CHANGE_TRACKING_LOG_AREAS = defineLogAreas({
2020
2044
  "dispatch.record-failed": "Recording a turn's dispatch outcome failed.",
2021
2045
  "turn.finalize-failed": "Finalizing a turn failed.",
2022
2046
  "turn.settle-failed": "Settling a late interrupted turn failed.",
2047
+ "turn.end-recovery": "A background retry of a turn end capture that timed out finished: recovered, done (no longer eligible) or exhausted.",
2048
+ "turn.end-recovery-failed": "A background retry of a turn end capture threw; it counts as a failed attempt.",
2023
2049
  "evidence.pull-failed": "Pulling change evidence from a bridge failed; a later pull retries.",
2024
2050
  "measurement.failed": "Recomputing a tool's measurement failed."
2025
2051
  }
@@ -2030,6 +2056,7 @@ var CHANGE_TRACKING_LOG_AREAS = defineLogAreas({
2030
2056
  "baseline.update-failed": "An environment's diff baseline could not be updated.",
2031
2057
  "scan.watcher-failed": "An environment's diff watcher failed; its scans fall back to polling.",
2032
2058
  "scan.failed": "A diff scan failed; the last results stay, marked stale, and the scan is retried.",
2059
+ "scan.target-missing": "A local environment's worktree folder is missing (deleted, moved or on an unmounted drive); no scan runs, the last results stay, marked stale, and the folder is checked again on the failure backoff.",
2033
2060
  "scan.freshness-read-failed": "Reading whether an environment's remote is fresh failed.",
2034
2061
  "scan.listener-failed": "A change-tracking scan listener threw; the scan itself stands.",
2035
2062
  "emit.diff-stats-failed": "A diff stats change could not be emitted to its sink.",
@@ -2088,6 +2115,7 @@ var COORDINATOR_LOG_AREAS = defineLogAreas({
2088
2115
  "node-release.no-coordinator": "Work closed on a released node belonged to a coordinator that no longer exists, so nobody was told.",
2089
2116
  "node-offline.notice-failed": "The notice that a node has been unreachable for a day could not be sent; the next failed read retries.",
2090
2117
  "node-offline.check-failed": "Whether a long-unreachable node's coordinators were told could not be checked; the next read retries.",
2118
+ "node-reconnect.notice-failed": "The message that a node a coordinator tried while it was disconnected is back could not be sent; it is not retried, since the coordinator already holds the refusal.",
2091
2119
  "checkout.merge-followed": "After an environment's PR merged, the project checkout was fast-forwarded, or `outcome` says why not.",
2092
2120
  "checkout.merge-follow-failed": "Fast-forwarding the project checkout failed, after an environment's PR merged or before mail woke the main coordinator.",
2093
2121
  "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`).",
@@ -2140,7 +2168,8 @@ var REVIEW_LOG_AREAS = defineLogAreas({
2140
2168
  "monitor.task-store-failed": "A pull request could not be recorded on its Kanban task.",
2141
2169
  "monitor.merged-tickets-closed": "The startup sweep moved Kanban tickets whose pull request had merged to done (`count`).",
2142
2170
  "monitor.merged-tickets-close-failed": "The startup sweep closing Kanban tickets whose pull request merged failed; the next backend start retries.",
2143
- "monitor.emit-failed": "A pull request monitor event could not be emitted to its sink."
2171
+ "monitor.emit-failed": "A pull request monitor event could not be emitted to its sink.",
2172
+ "branch-cleanup.kept": "A merge or cleanup kept a pull request's head branch because it is not the branch created for the environment (`reason`)."
2144
2173
  }
2145
2174
  }
2146
2175
  });
@@ -2172,6 +2201,8 @@ var AGENT_ACCOUNTS_LOG_AREAS = defineLogAreas({
2172
2201
  "kept-note.failed": "Recording why a limit stop found no account to move to failed; the stop stands.",
2173
2202
  "container-sync.failed": "Handing a login or account to a container failed; `step` says which part.",
2174
2203
  "last-usage.save-failed": "The last plan usage reading could not be saved; the next save retries.",
2204
+ "shared-usage.save-failed": "The shared usage readings could not be saved; they stay in memory and the next reading saves them.",
2205
+ "shared-usage.record-failed": "A fresh usage reading could not be kept for sharing with other machines; the account's own reading stands.",
2175
2206
  "login-cleanup.failed": "A temporary login could not be cleaned up.",
2176
2207
  "login-renewal.failed": "Renewing an idle account's sign-in to read its usage failed; it is retried after a backoff.",
2177
2208
  "login-renewal.not-extended": "Claude Code ran to renew an idle account's sign-in, but its token is still lapsed.",
@@ -2189,6 +2220,7 @@ var DOCKER_LOG_AREAS = defineLogAreas({
2189
2220
  "git-mirror.mount-unavailable": "A new container gets no project Git mirror, so its clone goes to the remote.",
2190
2221
  "git-mirror.mount-withheld": "A new restricted container gets no project Git mirror because its firewall would not let it reach the project's remote, so it cannot read what the remote serves through the mirror either.",
2191
2222
  "git-mirror.refreshed": "A project's Git mirror was built or updated.",
2223
+ "git-mirror.access-changed": "A project's Git mirror was withdrawn because containers are now given a different credential (another access kind, or a token acting as another or an unreadable account), so no reader keeps what it could not fetch itself.",
2192
2224
  "git-mirror.seeded": "A project's Git mirror was built from its host checkout and only what the remote added to it.",
2193
2225
  "git-mirror.seed-skipped": "A project's host checkout could not seed its Git mirror, so the build downloads everything.",
2194
2226
  "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.",
@@ -2202,6 +2234,9 @@ var DOCKER_LOG_AREAS = defineLogAreas({
2202
2234
  "git-mirror.clone-fallback": "A new environment could not clone from its project's Git mirror and cloned from the remote.",
2203
2235
  "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.",
2204
2236
  "opencode.warm-incomplete": "OpenCode did not finish loading /workspace in a container.",
2237
+ "opencode.listener-replaced": "The process on a container's OpenCode port (`provider`: `opencode` or `opencode2`) is not the server the backend launched and recorded, so its password was withheld and the next start replaces it. `stage` is `request` when the re-check after a refused connection or an unexpected answer found it; that connection then sends nothing more.",
2238
+ "opencode.project-config-too-large": "A checkout's opencode.json or opencode.jsonc was larger than the limit, so a launched OpenCode server does not read it. File name only.",
2239
+ "opencode.project-config-filtered": "Values were left out of a checkout's OpenCode configuration before a launched server reads it: counts of plugin keys, `{env:}` and `{file:}` references and dropped instructions (including separate instructionGlob and instructionUrl counts), and the names of files that were not a JSONC object. Never values.",
2205
2240
  "log-driver.unbounded": "The Docker daemon offers neither the local nor the json-file log driver, so new containers keep its default driver, whose log may be uncapped. Written once per backend.",
2206
2241
  "lifecycle-event.reconcile-failed": "Reconciling an environment after a container start or stop event failed; the next status read retries.",
2207
2242
  "login-keeper.pass-failed": "A Claude login keeper pass failed; the next interval retries.",
@@ -2236,6 +2271,17 @@ var DOCKER_LOG_AREAS = defineLogAreas({
2236
2271
  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.",
2237
2272
  essential: true,
2238
2273
  fields: { provider: "label", containerPort: "number" }
2274
+ },
2275
+ "bridge.listener-refused": {
2276
+ description: "The socket listening on a container bridge's port is not the one the bridge the backend started opened, so its token is not handed out and the next start replaces it. `reason` is a fixed label: `different-socket`, `several-sockets`, `pending` (a start has not recorded its bridge yet, or failed before it did) or `scan-incomplete`.",
2277
+ essential: true,
2278
+ fields: { provider: "label", reason: "label" }
2279
+ },
2280
+ "bridge.listener-adopted": "A running container bridge had no listener record, because a backend from before the record started it, so the socket on its port was recorded as the bridge's; `provider` names it.",
2281
+ "bridge.listener-unrecorded": {
2282
+ description: "A bridge the backend just launched could not be recorded as its port's listener, for the fixed `reason` given (`no-listener`, `several-sockets`, `launch-exited` or `scan-incomplete`); what listens on the port is stopped and the start fails.",
2283
+ essential: true,
2284
+ fields: { provider: "label", reason: "label" }
2239
2285
  }
2240
2286
  }
2241
2287
  },
@@ -2290,7 +2336,8 @@ var MCP_LOG_AREAS = defineLogAreas({
2290
2336
  "listener.port-free": "The Control MCP's fixed port is free again, so it is listening.",
2291
2337
  "state-listener.failed": "A Control MCP state listener threw; the others still run.",
2292
2338
  "delegation.remote-open-failed": "A delegation could not be opened on another node.",
2293
- "delegation.open-failed": "A coordinator delegation could not be opened."
2339
+ "delegation.open-failed": "A coordinator delegation could not be opened.",
2340
+ "delegation.turn-origin-unreadable": "A coordinator's last turn origin could not be read, so its delegated prompt is marked as arising from agent mail."
2294
2341
  }
2295
2342
  },
2296
2343
  "mcp-management": {
@@ -2375,6 +2422,7 @@ var NODES_LOG_AREAS = defineLogAreas({
2375
2422
  "ticket-sync.failed": "A Kanban sync with a node failed; it is retried.",
2376
2423
  "ticket-sync.unknown-project": "A node sent ticket changes for a project that no longer exists here.",
2377
2424
  "ticket-sync.forget-failed": "A detached command node's ticket copies could not be released.",
2425
+ "usage-sync.failed": "Sharing usage readings with a node failed; the next reading or reconnect retries.",
2378
2426
  "fleet-update.requested": "The update policy asked an older leaf to install the command node's version.",
2379
2427
  "fleet-update.failed": "The update policy could not read or update a leaf; it retries later.",
2380
2428
  "fleet-update.policy-load-failed": "The stored update policy could not be read; it is off."
@@ -2466,6 +2514,20 @@ var SCHEDULER_LOG_AREAS = defineLogAreas({
2466
2514
  }
2467
2515
  });
2468
2516
 
2517
+ // ../protocol/src/log-vocabulary/self-improvement.ts
2518
+ var SELF_IMPROVEMENT_LOG_AREAS = defineLogAreas({
2519
+ "self-improvement": {
2520
+ description: "Self-improvement runs: diagnostics and conversation review turned into tickets. Counts and steps only, never conversation text.",
2521
+ events: {
2522
+ "run.started": "A run started; `trigger` is manual, daily or dry-run.",
2523
+ "run.finished": "A run finished; `created`, `verified`, `fixFailed` and `parts` count its tickets, confirmed fixes, failed fixes and conversation parts read.",
2524
+ "run.failed": "A run stopped before it finished; `reason` is a fixed label.",
2525
+ "review.call-failed": "One conversation review call failed; the run carries on and the part is read again next run.",
2526
+ "daily.check-failed": "The daily run check failed; the next check retries."
2527
+ }
2528
+ }
2529
+ });
2530
+
2469
2531
  // ../protocol/src/log-vocabulary/web-app.ts
2470
2532
  var WEB_APP_LOG_AREAS = defineLogAreas({
2471
2533
  "web.app": {
@@ -2733,6 +2795,7 @@ var WEB_KANBAN_LOG_AREAS = defineLogAreas({
2733
2795
  "task.move-failed": "A task move failed and its status was rolled back.",
2734
2796
  "comment.add-failed": "A comment could not be added to a task.",
2735
2797
  "comment.delete-failed": "A comment could not be deleted from a task.",
2798
+ "pr.merge-failed": "Merging a ticket's pull request from its Notes tab failed; the error was shown to the user.",
2736
2799
  "image.add-failed": "An image could not be added to a task.",
2737
2800
  "image.delete-failed": "An image could not be deleted from a task.",
2738
2801
  "notes.load-failed": "Project notes could not be loaded; the editor stays disabled.",
@@ -2801,6 +2864,10 @@ var WEB_SETTINGS_LOG_AREAS = defineLogAreas({
2801
2864
  "web.settings": {
2802
2865
  description: "The settings screens.",
2803
2866
  events: {
2867
+ "self-improvement.status-failed": "Settings → Self-improvement could not read the status.",
2868
+ "self-improvement.projects-failed": "Settings → Self-improvement could not list the projects.",
2869
+ "self-improvement.save-failed": "Settings → Self-improvement could not save a setting.",
2870
+ "self-improvement.run-failed": "Settings → Self-improvement could not start a run.",
2804
2871
  "config.save-failed": "Global settings could not be saved.",
2805
2872
  "config.load-failed": "The settings page could not load the config.",
2806
2873
  "config.reload-failed": "Re-reading the workspace config after a save failed.",
@@ -2970,6 +3037,7 @@ var LOG_VOCABULARY = {
2970
3037
  ...HOST_LOG_AREAS,
2971
3038
  ...TRANSCRIPT_ARTIFACTS_LOG_AREAS,
2972
3039
  ...SCHEDULER_LOG_AREAS,
3040
+ ...SELF_IMPROVEMENT_LOG_AREAS,
2973
3041
  ...WEB_APP_LOG_AREAS,
2974
3042
  ...WEB_BUILD_PIPELINE_LOG_AREAS,
2975
3043
  ...WEB_CHAT_LOG_AREAS,
@@ -3091,6 +3159,14 @@ var SIGNALS = new Set([
3091
3159
  "SIGXFSZ"
3092
3160
  ]);
3093
3161
  var PROVIDERS = new Set(["claude", "codex", "opencode", "cursor", "grok", "acp", "pi"]);
3162
+ var BRIDGE_LISTENER_REASONS = new Set([
3163
+ "different-socket",
3164
+ "several-sockets",
3165
+ "pending",
3166
+ "scan-incomplete",
3167
+ "no-listener",
3168
+ "launch-exited"
3169
+ ]);
3094
3170
  var UUID = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
3095
3171
  var SOURCE = new RegExp(`^(?:claude|codex|opencode|cursor|grok|acp|pi):${UUID}$`, "i");
3096
3172
  var STORAGE_DATABASES = new Set(["main", "ledger", "other"]);
@@ -3950,8 +4026,10 @@ function reservePromptAdmission(state, closed) {
3950
4026
  function releasePromptClaim(state, claim) {
3951
4027
  if (claim === undefined)
3952
4028
  return;
3953
- if (state.promptClaim === claim)
4029
+ if (state.promptClaim === claim) {
3954
4030
  state.promptClaim = undefined;
4031
+ state.lastAccessed = Date.now();
4032
+ }
3955
4033
  if (state.cancelRequestedClaim === claim)
3956
4034
  state.cancelRequestedClaim = undefined;
3957
4035
  if (state.promptStartup?.claim === claim)
@@ -4009,24 +4087,60 @@ function sessionIsWorking(state) {
4009
4087
  function sessionIsBlocked(state) {
4010
4088
  return state.approvals.size > 0;
4011
4089
  }
4090
+ // ../protocol/src/node/bounded-wait.ts
4091
+ function boundedWait(work, timeoutMs, options = {}) {
4092
+ return new Promise((resolve, reject) => {
4093
+ let timedOut = false;
4094
+ const timer = setTimeout(() => {
4095
+ timedOut = true;
4096
+ resolve({ settled: false });
4097
+ }, timeoutMs);
4098
+ unrefTimer(timer);
4099
+ Promise.resolve(work).then((value) => {
4100
+ if (!timedOut) {
4101
+ clearTimeout(timer);
4102
+ resolve({ settled: true, value });
4103
+ return;
4104
+ }
4105
+ disposeLate(options.onLate, value);
4106
+ }, (error) => {
4107
+ if (!timedOut) {
4108
+ clearTimeout(timer);
4109
+ reject(error);
4110
+ }
4111
+ });
4112
+ });
4113
+ }
4114
+ async function boundedWaitOrThrow(work, timeoutMs, timeoutError, options = {}) {
4115
+ const result = await boundedWait(work, timeoutMs, options);
4116
+ if (!result.settled)
4117
+ throw timeoutError();
4118
+ return result.value;
4119
+ }
4120
+ function unrefTimer(timer) {
4121
+ const handle = timer;
4122
+ if (typeof handle === "object" && typeof handle.unref === "function")
4123
+ handle.unref();
4124
+ }
4125
+ function disposeLate(onLate, value) {
4126
+ if (!onLate)
4127
+ return;
4128
+ try {
4129
+ const disposal = onLate(value);
4130
+ if (disposal && typeof disposal.then === "function") {
4131
+ Promise.resolve(disposal).catch(() => {
4132
+ return;
4133
+ });
4134
+ }
4135
+ } catch {}
4136
+ }
4137
+
4012
4138
  // ../../bridges/pi-bridge/src/timeout.ts
4013
4139
  class TimeoutError extends Error {
4014
4140
  name = "TimeoutError";
4015
4141
  }
4016
- async function withTimeout(work, timeoutMs, message) {
4017
- let timer;
4018
- try {
4019
- return await Promise.race([
4020
- work,
4021
- new Promise((_, reject) => {
4022
- timer = setTimeout(() => reject(new TimeoutError(message)), timeoutMs);
4023
- timer.unref();
4024
- })
4025
- ]);
4026
- } finally {
4027
- if (timer)
4028
- clearTimeout(timer);
4029
- }
4142
+ function withTimeout(work, timeoutMs, message) {
4143
+ return boundedWaitOrThrow(work, timeoutMs, () => new TimeoutError(message));
4030
4144
  }
4031
4145
  // ../../bridges/pi-bridge/src/pi-sdk.ts
4032
4146
  import {
@@ -5375,6 +5489,58 @@ var PROTECTED_SEGMENTS = new Set([
5375
5489
  ".mcp.json"
5376
5490
  ]);
5377
5491
 
5492
+ // ../protocol/src/agent-mail.ts
5493
+ var AGENT_MAIL_MAX_BODY_BYTES = 32 * 1024;
5494
+ var AGENT_MAIL_MAX_STORE_BYTES = 32 * 1024 * 1024;
5495
+ var AGENT_MAIL_DEFAULT_RETENTION_DAYS = 14;
5496
+ var AGENT_MAIL_MAX_ATTACHMENT_BYTES = 8 * 1024 * 1024;
5497
+ var AGENT_MAIL_MAX_TOTAL_ATTACHMENT_BYTES = 32 * 1024 * 1024;
5498
+ var AGENT_MAIL_DEFAULT_AUTONOMOUS_WAKE_BUDGET = 16;
5499
+ var AGENT_MAIL_DEFAULT_HOURLY_WAKE_LIMIT = 40;
5500
+ var AGENT_MAIL_TOOL_NAMES = Object.freeze([
5501
+ "list_mailboxes",
5502
+ "send_message",
5503
+ "check_inbox",
5504
+ "read_message",
5505
+ "ack_message",
5506
+ "reply_message",
5507
+ "get_message_status"
5508
+ ]);
5509
+ var DEFAULT_AGENT_MESSAGING_SETTINGS = Object.freeze({
5510
+ enabled: true,
5511
+ allowCrossProject: false,
5512
+ defaultInjectPolicy: "off",
5513
+ wakePeers: false,
5514
+ autonomousWakeBudget: AGENT_MAIL_DEFAULT_AUTONOMOUS_WAKE_BUDGET,
5515
+ hourlyWakeLimit: AGENT_MAIL_DEFAULT_HOURLY_WAKE_LIMIT,
5516
+ coordinatorStatusWakes: "settled",
5517
+ retentionDays: AGENT_MAIL_DEFAULT_RETENTION_DAYS,
5518
+ paused: false
5519
+ });
5520
+ function agentMailCapabilities(tabType, agent, locked = true) {
5521
+ if (tabType === "agent-native") {
5522
+ if (!locked || !agent)
5523
+ return { canPull: false, canSend: false, canInject: false };
5524
+ if (agent === "claude" || agent === "codex" || agent === "opencode" || agent === "pi" || agent === "cursor" || agent === "grok") {
5525
+ return { canPull: true, canSend: true, canInject: true };
5526
+ }
5527
+ return { canPull: false, canSend: false, canInject: false };
5528
+ }
5529
+ if (tabType === "claude-tmux")
5530
+ return { canPull: true, canSend: true, canInject: true };
5531
+ if (tabType === "pipeline-worker") {
5532
+ return agent ? { canPull: true, canSend: true, canInject: true } : { canPull: false, canSend: false, canInject: false };
5533
+ }
5534
+ if (["claude", "codex", "opencode"].includes(tabType)) {
5535
+ return { canPull: true, canSend: true, canInject: false };
5536
+ }
5537
+ if (["cursor", "grok", "pi"].includes(tabType)) {
5538
+ return { canPull: false, canSend: false, canInject: false };
5539
+ }
5540
+ return { canPull: false, canSend: false, canInject: false };
5541
+ }
5542
+ var NATIVE_AGENT_MAIL_CAPABILITIES = Object.freeze(Object.fromEntries(AGENT_PLATFORMS.map((agent) => [agent, agentMailCapabilities("agent-native", agent)])));
5543
+
5378
5544
  // ../protocol/src/review-evidence-frames.ts
5379
5545
  var COORDINATOR_WORKER_NO_PR_INSTRUCTION = "Do not open a pull request, even if the prompt below asks you to: commit your work and report back. Orkestrator raises the pull request from a PR tab once the work has been reviewed.";
5380
5546
  var COORDINATOR_WORKER_VALIDATION_INSTRUCTION = "Run the focused checks your changes need and report them. When the prompt below says review follows, leave the required full test suite, typecheck, lint and build passes to review preparation unless it explicitly asks you to run them. When no review follows or the prompt does not say, follow the repository's validation requirements before handoff. Report any required full validation you did not run; do not assume a later review will run it.";
@@ -5956,6 +6122,11 @@ var BACKGROUND_CAPABLE_SHELL_TOOL_NAMES = new Set([
5956
6122
  "run_terminal_cmd",
5957
6123
  "execute_command"
5958
6124
  ]);
6125
+ var NATIVE_AGENT_BRANCH_LIST_LIMITS = Object.freeze({
6126
+ branches: 50,
6127
+ promptChars: 280,
6128
+ entryIdChars: 512
6129
+ });
5959
6130
  var NATIVE_AGENT_COMMAND_EXECUTION_KINDS = [
5960
6131
  "provider-prompt",
5961
6132
  "provider-command",
@@ -6814,6 +6985,7 @@ function applySessionEvent(state, event) {
6814
6985
  break;
6815
6986
  case "compaction_end":
6816
6987
  state.compacting = false;
6988
+ state.lastAccessed = Date.now();
6817
6989
  applyCompaction(state, event);
6818
6990
  break;
6819
6991
  case "thinking_level_changed":
@@ -7658,58 +7830,6 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
7658
7830
  ]);
7659
7831
  var COORDINATOR_PROJECT_HOME_MESSAGE_WINDOW_MS = 3 * 60 * 60000;
7660
7832
 
7661
- // ../protocol/src/agent-mail.ts
7662
- var AGENT_MAIL_MAX_BODY_BYTES = 32 * 1024;
7663
- var AGENT_MAIL_MAX_STORE_BYTES = 32 * 1024 * 1024;
7664
- var AGENT_MAIL_DEFAULT_RETENTION_DAYS = 14;
7665
- var AGENT_MAIL_MAX_ATTACHMENT_BYTES = 8 * 1024 * 1024;
7666
- var AGENT_MAIL_MAX_TOTAL_ATTACHMENT_BYTES = 32 * 1024 * 1024;
7667
- var AGENT_MAIL_DEFAULT_AUTONOMOUS_WAKE_BUDGET = 16;
7668
- var AGENT_MAIL_DEFAULT_HOURLY_WAKE_LIMIT = 40;
7669
- var AGENT_MAIL_TOOL_NAMES = Object.freeze([
7670
- "list_mailboxes",
7671
- "send_message",
7672
- "check_inbox",
7673
- "read_message",
7674
- "ack_message",
7675
- "reply_message",
7676
- "get_message_status"
7677
- ]);
7678
- var DEFAULT_AGENT_MESSAGING_SETTINGS = Object.freeze({
7679
- enabled: true,
7680
- allowCrossProject: false,
7681
- defaultInjectPolicy: "off",
7682
- wakePeers: false,
7683
- autonomousWakeBudget: AGENT_MAIL_DEFAULT_AUTONOMOUS_WAKE_BUDGET,
7684
- hourlyWakeLimit: AGENT_MAIL_DEFAULT_HOURLY_WAKE_LIMIT,
7685
- coordinatorStatusWakes: "settled",
7686
- retentionDays: AGENT_MAIL_DEFAULT_RETENTION_DAYS,
7687
- paused: false
7688
- });
7689
- function agentMailCapabilities(tabType, agent, locked = true) {
7690
- if (tabType === "agent-native") {
7691
- if (!locked || !agent)
7692
- return { canPull: false, canSend: false, canInject: false };
7693
- if (agent === "claude" || agent === "codex" || agent === "opencode" || agent === "pi" || agent === "cursor" || agent === "grok") {
7694
- return { canPull: true, canSend: true, canInject: true };
7695
- }
7696
- return { canPull: false, canSend: false, canInject: false };
7697
- }
7698
- if (tabType === "claude-tmux")
7699
- return { canPull: true, canSend: true, canInject: true };
7700
- if (tabType === "pipeline-worker") {
7701
- return agent ? { canPull: true, canSend: true, canInject: true } : { canPull: false, canSend: false, canInject: false };
7702
- }
7703
- if (["claude", "codex", "opencode"].includes(tabType)) {
7704
- return { canPull: true, canSend: true, canInject: false };
7705
- }
7706
- if (["cursor", "grok", "pi"].includes(tabType)) {
7707
- return { canPull: false, canSend: false, canInject: false };
7708
- }
7709
- return { canPull: false, canSend: false, canInject: false };
7710
- }
7711
- var NATIVE_AGENT_MAIL_CAPABILITIES = Object.freeze(Object.fromEntries(AGENT_PLATFORMS.map((agent) => [agent, agentMailCapabilities("agent-native", agent)])));
7712
-
7713
7833
  // ../protocol/src/suborks.ts
7714
7834
  var SUBORK_TOOL_NAME = "ask_agents";
7715
7835
  var AGENT_SUBORK_TOOL_NAMES = Object.freeze([SUBORK_TOOL_NAME]);
@@ -31944,15 +32064,8 @@ async function closeConnections(state, connections) {
31944
32064
  const settled = Promise.allSettled(connections.map(async (connection) => {
31945
32065
  await connection.close();
31946
32066
  }));
31947
- let timer;
31948
- const deadline = new Promise((resolve) => {
31949
- timer = setTimeout(() => resolve("timeout"), closeTimeoutMs);
31950
- timer.unref();
31951
- });
31952
- const outcome = await Promise.race([settled.then(() => "closed"), deadline]);
31953
- if (timer)
31954
- clearTimeout(timer);
31955
- if (outcome === "timeout") {
32067
+ const outcome = await boundedWait(settled, closeTimeoutMs);
32068
+ if (!outcome.settled) {
31956
32069
  state.health.recordNotice({
31957
32070
  message: "An MCP server did not close in time; the bridge moved on without waiting",
31958
32071
  method: "mcp/close",
@@ -32042,31 +32155,7 @@ function recordConnectFailure(state, server, error) {
32042
32155
  };
32043
32156
  }
32044
32157
  async function connectWithTimeout(transport, server, context) {
32045
- const attempt = transport.connect(server, context);
32046
- let timedOut = false;
32047
- let timer;
32048
- const deadline = new Promise((_resolve, reject) => {
32049
- timer = setTimeout(() => {
32050
- timedOut = true;
32051
- reject(new Error(`MCP server ${server.id} timed out`));
32052
- }, connectTimeoutMs);
32053
- timer.unref();
32054
- });
32055
- try {
32056
- return await Promise.race([attempt, deadline]);
32057
- } catch (error) {
32058
- if (timedOut) {
32059
- attempt.then((late) => late.close().catch(() => {
32060
- return;
32061
- }), () => {
32062
- return;
32063
- });
32064
- }
32065
- throw error;
32066
- } finally {
32067
- if (timer)
32068
- clearTimeout(timer);
32069
- }
32158
+ return await boundedWaitOrThrow(transport.connect(server, context), connectTimeoutMs, () => new Error(`MCP server ${server.id} timed out`), { onLate: (late) => late.close() });
32070
32159
  }
32071
32160
  function registerListedTool(server, listed, connection) {
32072
32161
  const remoteName = listed.name.trim();
@@ -36394,6 +36483,18 @@ async function overlayCommandChanges(state, options = {}) {
36394
36483
  } catch {}
36395
36484
  }
36396
36485
 
36486
+ // ../../bridges/pi-bridge/src/project-extensions.ts
36487
+ var PROJECT_EXTENSIONS_REFUSED_NOTE = "Pi runs extensions inside the bridge process, where they could answer approvals themselves, so discovered extensions and configured packages do not load under any approval policy; local project skills and prompt templates still do.";
36488
+ function projectExtensionsRefusedForApprovals(policy, readOnly = false) {
36489
+ return policy?.projectResources === true && !readOnly;
36490
+ }
36491
+ function excludeConfiguredPackages(settingsManager) {
36492
+ for (const key of ["getGlobalSettings", "getProjectSettings"]) {
36493
+ const read = settingsManager[key].bind(settingsManager);
36494
+ settingsManager[key] = () => ({ ...read(), packages: [] });
36495
+ }
36496
+ }
36497
+
36397
36498
  // ../../bridges/pi-bridge/src/session-list-cache.ts
36398
36499
  import { createHash as createHash6 } from "node:crypto";
36399
36500
  import { readdir, stat as stat2 } from "node:fs/promises";
@@ -36718,8 +36819,13 @@ function piAppendedInstructions(state) {
36718
36819
  }
36719
36820
  async function createPiSessionServices(state, options) {
36720
36821
  const loaderPolicy = piResourceLoaderPolicy(state, options.cwd);
36822
+ const settingsManager = options.settingsManager ?? SettingsManager.create(options.cwd, options.agentDir, {
36823
+ projectTrusted: loaderPolicy.projectTrusted
36824
+ });
36825
+ excludeConfiguredPackages(settingsManager);
36721
36826
  const services = await createAgentSessionServices({
36722
36827
  ...options,
36828
+ settingsManager,
36723
36829
  resourceLoaderOptions: {
36724
36830
  ...loaderPolicy.discovery,
36725
36831
  appendSystemPromptOverride: (base) => [...base, ...piAppendedInstructions(state)],
@@ -36948,10 +37054,10 @@ async function runDeferredCommandReload(state) {
36948
37054
  return;
36949
37055
  await reloadSessionCommands(state, session);
36950
37056
  }
36951
- function projectResourceDiscoveryOptions(enabled = false, readOnly = false) {
37057
+ function projectResourceDiscoveryOptions(enabled = false, readOnly = false, _approvals) {
36952
37058
  const discoverProjectResources = enabled && !readOnly;
36953
37059
  return {
36954
- noExtensions: !discoverProjectResources,
37060
+ noExtensions: true,
36955
37061
  noSkills: !discoverProjectResources,
36956
37062
  noPromptTemplates: !discoverProjectResources,
36957
37063
  noContextFiles: readOnly
@@ -36965,7 +37071,7 @@ function coordinatorProjectSkillPaths(cwd = workingDirectory) {
36965
37071
  ].filter((path) => existsSync2(path));
36966
37072
  }
36967
37073
  function piResourceLoaderPolicy(state, cwd = workingDirectory) {
36968
- const discovery = projectResourceDiscoveryOptions(state.policy?.projectResources, state.readOnly === true);
37074
+ const discovery = projectResourceDiscoveryOptions(state.policy?.projectResources, state.readOnly === true, state.policy?.approvals);
36969
37075
  const coordinator = state.policy?.id === "coordinator-read-only" && process.env[BRIDGE_EXECUTION_POLICY_ENV2] === "coordinator-read-only";
36970
37076
  return {
36971
37077
  discovery: coordinator ? { ...discovery, noSkills: false, additionalSkillPaths: coordinatorProjectSkillPaths(cwd) } : discovery,
@@ -37375,7 +37481,7 @@ async function forkSession(state, messageId) {
37375
37481
  throw error;
37376
37482
  }
37377
37483
  }
37378
- async function navigateSessionHistory(state, messageOrEntryId) {
37484
+ async function navigateSessionHistory(state, messageOrEntryId, position = "before") {
37379
37485
  if (state.status === "running" || state.dispatching)
37380
37486
  throw new SessionBusyError;
37381
37487
  const session = await ensureSession(state);
@@ -37385,6 +37491,10 @@ async function navigateSessionHistory(state, messageOrEntryId) {
37385
37491
  const result = await session.navigateTree(target, { summarize: false });
37386
37492
  if (result.cancelled || result.aborted)
37387
37493
  throw new Error("Pi did not change the active branch");
37494
+ if (position === "at" && session.sessionManager.getLeafId() !== target) {
37495
+ session.sessionManager.branch(target);
37496
+ session.refreshContext();
37497
+ }
37388
37498
  rememberHistoryLeaf(state, session.sessionManager);
37389
37499
  resetRenderedHistory(state);
37390
37500
  hydrateHistory(state);
@@ -37705,11 +37815,10 @@ function setLiveBridgeDiagnostics(enabled) {
37705
37815
  for (const scope of Array.from(liveScopes))
37706
37816
  scope.syncActive();
37707
37817
  }
37708
- function bridgeDebugEnabled(bridge, env = process.env) {
37818
+ function bridgeDebugEnabled(_bridge, env = process.env) {
37709
37819
  if (liveDiagnostics !== undefined && env === process.env)
37710
37820
  return liveDiagnostics;
37711
- const value = env.ORKESTRATOR_BRIDGE_DEBUG ?? env[`${bridge.toUpperCase()}_BRIDGE_DEBUG`];
37712
- return readBridgeDebugFlag(value);
37821
+ return readBridgeDebugFlag(env.ORKESTRATOR_BRIDGE_DEBUG);
37713
37822
  }
37714
37823
  function safeDiagnosticMetrics(value) {
37715
37824
  const result = {};
@@ -38446,15 +38555,15 @@ ${structuredPromptInstruction(input.schema)}` : input.prompt;
38446
38555
  diagnostics?.streamSettled("rejected");
38447
38556
  announceAccepted(false);
38448
38557
  });
38449
- const acceptance = await withinStartupDeadline(accepted, startupDeadlineMs);
38450
- if (acceptance === "timeout") {
38558
+ const startup = await boundedWait(accepted, startupDeadlineMs);
38559
+ if (!startup.settled) {
38451
38560
  const error = new PromptStartupTimeoutError(startupDeadlineMs);
38452
38561
  abandonStartup(state, session, claim, accepted, settled, input, diagnostics, error, evidenceTurnId);
38453
38562
  throw error;
38454
38563
  }
38455
38564
  if (claim !== undefined && state.promptStartup?.claim === claim)
38456
38565
  state.promptStartup = undefined;
38457
- if (!acceptance) {
38566
+ if (!startup.value) {
38458
38567
  forgetEvidenceTurn(state, evidenceTurnId);
38459
38568
  await settled;
38460
38569
  if (commandRun && state.commandRun === commandRun)
@@ -38528,21 +38637,6 @@ ${structuredPromptInstruction(input.schema)}` : input.prompt;
38528
38637
  })
38529
38638
  };
38530
38639
  }
38531
- async function withinStartupDeadline(accepted, deadlineMs) {
38532
- let timer;
38533
- try {
38534
- return await Promise.race([
38535
- accepted,
38536
- new Promise((resolve) => {
38537
- timer = setTimeout(() => resolve("timeout"), deadlineMs);
38538
- timer.unref();
38539
- })
38540
- ]);
38541
- } finally {
38542
- if (timer)
38543
- clearTimeout(timer);
38544
- }
38545
- }
38546
38640
  function abandonStartup(state, session, claim, accepted, settled, input, diagnostics, error, evidenceTurnId) {
38547
38641
  log7.warn("turn.startup-timed-out", { sessionId: state.id });
38548
38642
  state.status = "error";
@@ -39024,10 +39118,11 @@ function boundTranscriptResponse(messages, maximumBytes, options = {}) {
39024
39118
 
39025
39119
  // ../../bridges/pi-bridge/src/public.ts
39026
39120
  function piReportedPolicy(policy, readOnly) {
39027
- return withoutProviderSandbox(policy, {
39121
+ const reported = withoutProviderSandbox(policy, {
39028
39122
  agent: "Pi",
39029
39123
  toolsetBlocksNetwork: readOnly === true || policy.approvals === "deny"
39030
39124
  });
39125
+ return projectExtensionsRefusedForApprovals(policy, readOnly === true) ? appendNativeAgentPolicyNote(reported, PROJECT_EXTENSIONS_REFUSED_NOTE) : reported;
39031
39126
  }
39032
39127
  function publicSession(state) {
39033
39128
  const contextUsage = publicContextUsage(state);
@@ -39335,6 +39430,11 @@ function applyBridgeLogPolicy(value, env = process.env) {
39335
39430
  return { status: 200, body: { applied: true, seq: policy.seq, diagnostics } };
39336
39431
  }
39337
39432
 
39433
+ // ../protocol/src/terminal-text.ts
39434
+ var MAX_STRING_LENGTH = 8 * 1024;
39435
+ var BUDGET_FLOOR = 4 * 1024;
39436
+ var MAX_MOVE = 4 * 1024;
39437
+
39338
39438
  // ../protocol/src/human-prompts.ts
39339
39439
  var HUMAN_PROMPT_SCAN_BYTES = 16 * 1024;
39340
39440
  var HUMAN_PROMPT_KINDS = new Set([
@@ -39405,6 +39505,68 @@ import { createHash as createHash9, randomBytes as randomBytes9 } from "node:cry
39405
39505
  import { pathToFileURL } from "node:url";
39406
39506
  import { gzip } from "node:zlib";
39407
39507
 
39508
+ // ../../bridges/pi-bridge/src/liveness.ts
39509
+ var METHODS = new Set(["GET", "POST", "PUT", "PATCH", "DELETE"]);
39510
+ var FIXED_SUBJECTS = new Set(["refresh", "dispatch", "detail", "page"]);
39511
+ function sessionRouteLabel(request) {
39512
+ const method = request.method && METHODS.has(request.method) ? request.method : "OTHER";
39513
+ let path = request.action ?? "session";
39514
+ if (request.subject !== undefined) {
39515
+ path += `/${FIXED_SUBJECTS.has(request.subject) ? request.subject : ":id"}`;
39516
+ }
39517
+ if (request.detail !== undefined)
39518
+ path += "/hold";
39519
+ return `${method} ${path}`;
39520
+ }
39521
+ function touchesLiveness(request) {
39522
+ if (request.method === "GET" || request.method === "HEAD")
39523
+ return false;
39524
+ if (request.action === "title")
39525
+ return false;
39526
+ if (request.action === "approvals" && request.detail !== undefined)
39527
+ return false;
39528
+ return true;
39529
+ }
39530
+ function observeSessionRequest(state, request, now = Date.now()) {
39531
+ const touched = touchesLiveness(request);
39532
+ if (touched)
39533
+ state.lastAccessed = now;
39534
+ const label = sessionRouteLabel(request);
39535
+ const routes = state.routeCounts ??= new Map;
39536
+ const count = routes.get(label) ?? { requests: 0, touches: 0 };
39537
+ count.requests += 1;
39538
+ if (touched)
39539
+ count.touches += 1;
39540
+ routes.set(label, count);
39541
+ return touched;
39542
+ }
39543
+ function publicLiveness(state) {
39544
+ return {
39545
+ routes: Object.fromEntries(Array.from(state.routeCounts ?? [], ([label, count]) => [label, { ...count }]))
39546
+ };
39547
+ }
39548
+
39549
+ // ../protocol/src/contract/ipc-error.ts
39550
+ var REGISTERED_ERROR_CODES = {
39551
+ "unknown-command": { domain: "text", command: "text" },
39552
+ "unsupported-version": { domain: "text", range: "range", command: "text" },
39553
+ "unsupported-field": { domain: "text", field: "text", command: "text" },
39554
+ "kanban-request-id-conflict": { record: "text" },
39555
+ "native-job-receipt-capacity": { limit: "count" },
39556
+ "native-agent-provider-session-missing": {},
39557
+ "container-lifecycle": { reason: "text" },
39558
+ "mcp-management": { reason: "text" },
39559
+ "pane-layout-revision-conflict": {},
39560
+ "design-revision-conflict": {},
39561
+ "prompt-queue-message-conflict": {},
39562
+ "unknown-node": {},
39563
+ "node-admin-refused": {},
39564
+ "node-scope-closed": {},
39565
+ "node-unavailable": {}
39566
+ };
39567
+ var REGISTERED_ERROR_CODE_LIST = Object.keys(REGISTERED_ERROR_CODES);
39568
+ var MAX_COUNT = 2 ** 31 - 1;
39569
+
39408
39570
  // ../protocol/src/mcp-management.ts
39409
39571
  var MCP_CONFIG_REPORTING_VERSION = 1;
39410
39572
  var MCP_MANAGEMENT_LIMITS = {
@@ -40044,6 +40206,7 @@ async function readResourceCommands(options) {
40044
40206
  const settingsManager = SettingsManager.create(options.cwd, options.agentDir, {
40045
40207
  projectTrusted: options.policy.projectTrusted
40046
40208
  });
40209
+ excludeConfiguredPackages(settingsManager);
40047
40210
  const loader = new DefaultResourceLoader({
40048
40211
  ...options.policy.discovery,
40049
40212
  cwd: options.cwd,
@@ -40163,6 +40326,70 @@ async function runClose(state, budgetMs) {
40163
40326
  return "closed";
40164
40327
  }
40165
40328
 
40329
+ // ../../bridges/pi-bridge/src/session-branches.ts
40330
+ var MAX_LISTED_BRANCHES = NATIVE_AGENT_BRANCH_LIST_LIMITS.branches;
40331
+ var MAX_BRANCH_PROMPT_CHARS = NATIVE_AGENT_BRANCH_LIST_LIMITS.promptChars;
40332
+ function isConversationEntry(entry) {
40333
+ return entry.type === "message" || entry.type === "custom_message";
40334
+ }
40335
+ function promptText(entry) {
40336
+ if (entry.type !== "message" || entry.message.role !== "user")
40337
+ return;
40338
+ const text = readContentText(entry.message.content).replace(/\s+/g, " ").trim();
40339
+ return text.length > MAX_BRANCH_PROMPT_CHARS ? `${text.slice(0, MAX_BRANCH_PROMPT_CHARS - 1)}…` : text;
40340
+ }
40341
+ function listSessionBranches(manager) {
40342
+ const entries = manager.getEntries();
40343
+ const byId = new Map;
40344
+ const hasChildren = new Set;
40345
+ for (const entry of entries) {
40346
+ byId.set(entry.id, entry);
40347
+ if (entry.parentId)
40348
+ hasChildren.add(entry.parentId);
40349
+ }
40350
+ const activeEntryId = manager.getLeafId();
40351
+ const activePath = new Set;
40352
+ for (let cursor = activeEntryId ? byId.get(activeEntryId) : undefined;cursor; cursor = cursor.parentId ? byId.get(cursor.parentId) : undefined) {
40353
+ if (activePath.has(cursor.id))
40354
+ break;
40355
+ activePath.add(cursor.id);
40356
+ }
40357
+ const leaves = entries.map((entry, index) => ({ entry, index })).filter(({ entry }) => !hasChildren.has(entry.id) && !activePath.has(entry.id)).sort((left, right) => right.entry.timestamp.localeCompare(left.entry.timestamp) || right.index - left.index).map(({ entry }) => entry);
40358
+ const branches = [];
40359
+ let truncated = false;
40360
+ for (const leaf of leaves) {
40361
+ const own = [];
40362
+ const seen = new Set;
40363
+ let depth = 0;
40364
+ let newestPrompt;
40365
+ for (let cursor = leaf;cursor && !seen.has(cursor.id); cursor = cursor.parentId ? byId.get(cursor.parentId) : undefined) {
40366
+ seen.add(cursor.id);
40367
+ depth += 1;
40368
+ if (!activePath.has(cursor.id))
40369
+ own.push(cursor);
40370
+ newestPrompt ??= promptText(cursor);
40371
+ }
40372
+ if (!own.some(isConversationEntry))
40373
+ continue;
40374
+ if (branches.length >= MAX_LISTED_BRANCHES) {
40375
+ truncated = true;
40376
+ break;
40377
+ }
40378
+ const firstOwnPrompt = own.slice().reverse().map(promptText).find((text) => text !== undefined);
40379
+ branches.push({
40380
+ entryId: leaf.id,
40381
+ prompt: firstOwnPrompt ?? newestPrompt ?? "",
40382
+ entries: depth,
40383
+ updatedAt: leaf.timestamp
40384
+ });
40385
+ }
40386
+ return { activeEntryId, branches, truncated };
40387
+ }
40388
+ async function readSessionBranches(state) {
40389
+ const session = await ensureSession(state);
40390
+ return listSessionBranches(session.sessionManager);
40391
+ }
40392
+
40166
40393
  // ../../bridges/pi-bridge/src/session-activity.ts
40167
40394
  function sessionActivityObservation(sessionId) {
40168
40395
  const state = sessions.get(sessionId);
@@ -40374,13 +40601,13 @@ function assertSessionOpen(state) {
40374
40601
  throw new HttpError(409, "Session is closed");
40375
40602
  }
40376
40603
  var GLOBAL_REFRESH_CONCURRENCY = 4;
40377
- var DEFAULT_DELETE_CANCEL_TIMEOUT_MS = 5000;
40604
+ var DEFAULT_CLOSE_CANCEL_TIMEOUT_MS = 5000;
40378
40605
  var DEFAULT_CANCEL_ACK_TIMEOUT_MS = 5000;
40379
40606
  var TRANSCRIPT_GENERATION = randomBytes9(16).toString("hex");
40380
- var deleteCancelTimeoutMs = DEFAULT_DELETE_CANCEL_TIMEOUT_MS;
40607
+ var closeCancelTimeoutMs = DEFAULT_CLOSE_CANCEL_TIMEOUT_MS;
40381
40608
  var cancelAckTimeoutMs = DEFAULT_CANCEL_ACK_TIMEOUT_MS;
40382
- function setDeleteCancelTimeoutForTests(timeoutMs) {
40383
- deleteCancelTimeoutMs = timeoutMs ?? DEFAULT_DELETE_CANCEL_TIMEOUT_MS;
40609
+ function setCloseCancelTimeoutForTests(timeoutMs) {
40610
+ closeCancelTimeoutMs = timeoutMs ?? DEFAULT_CLOSE_CANCEL_TIMEOUT_MS;
40384
40611
  }
40385
40612
  function setCancelAckTimeoutForTests(timeoutMs) {
40386
40613
  cancelAckTimeoutMs = timeoutMs ?? DEFAULT_CANCEL_ACK_TIMEOUT_MS;
@@ -40625,9 +40852,7 @@ async function routeSession(request, response, url, clientSignal) {
40625
40852
  }
40626
40853
  return json(response, 404, { error: "Session not found" });
40627
40854
  }
40628
- if (action !== "activity" && action !== "runtime-health" && action !== "dispatch" && !(action === "steer" && subject === "dispatch") && !(action === "commands" && request.method === "GET")) {
40629
- state.lastAccessed = Date.now();
40630
- }
40855
+ observeSessionRequest(state, { method: request.method, action, subject, detail });
40631
40856
  if (request.method === "GET" && (!action || action === "status") || action === "config" && (request.method === "GET" || request.method === "POST")) {
40632
40857
  await withTimeout(hydrateSessionComposer(state).catch(() => {
40633
40858
  return;
@@ -40639,11 +40864,8 @@ async function routeSession(request, response, url, clientSignal) {
40639
40864
  boundTranscriptForRead(state);
40640
40865
  return json(response, 200, publicSession(state));
40641
40866
  }
40642
- if (!action && request.method === "DELETE") {
40643
- return await handleDelete(response, state);
40644
- }
40645
40867
  if (action === "close" && !subject && request.method === "POST") {
40646
- const outcome = await closeSessionRetaining(state, deleteCancelTimeoutMs);
40868
+ const outcome = await closeSessionRetaining(state, closeCancelTimeoutMs);
40647
40869
  return outcome === "closed" ? json(response, 200, { closed: true, retained: true }) : json(response, 503, {
40648
40870
  closed: false,
40649
40871
  pending: true,
@@ -40672,7 +40894,8 @@ async function routeSession(request, response, url, clientSignal) {
40672
40894
  summary: publicRuntime(state),
40673
40895
  ...state.health.snapshot(),
40674
40896
  mcpConfigReporting: MCP_CONFIG_REPORTING_VERSION,
40675
- ...mcpConfig ? { mcpConfig } : {}
40897
+ ...mcpConfig ? { mcpConfig } : {},
40898
+ liveness: publicLiveness(state)
40676
40899
  });
40677
40900
  }
40678
40901
  if (action === "dispatch" && request.method === "GET") {
@@ -40744,8 +40967,11 @@ async function routeSession(request, response, url, clientSignal) {
40744
40967
  await persistBarrier();
40745
40968
  return json(response, 200, { rewound: true });
40746
40969
  }
40970
+ if (action === "branches" && !subject && request.method === "GET") {
40971
+ return json(response, 200, await readSessionBranches(state));
40972
+ }
40747
40973
  if (action === "branches" && subject && request.method === "POST") {
40748
- await navigateSessionHistory(state, decodeURIComponent(subject));
40974
+ await navigateSessionHistory(state, decodeURIComponent(subject), "at");
40749
40975
  await persistBarrier();
40750
40976
  return json(response, 200, { switched: true });
40751
40977
  }
@@ -40783,21 +41009,6 @@ async function routeSession(request, response, url, clientSignal) {
40783
41009
  }
40784
41010
  return json(response, 404, { error: "Not found" });
40785
41011
  }
40786
- async function handleDelete(response, state) {
40787
- markSessionClosed(state);
40788
- const { cancel } = requestTurnCancellation(state, "The session was closed before this request was answered.");
40789
- try {
40790
- if (cancel) {
40791
- await withTimeout(cancel, deleteCancelTimeoutMs, "Pi cancellation timed out while deleting the session");
40792
- }
40793
- } catch {}
40794
- await closeSession(state);
40795
- sessions.delete(state.id);
40796
- if (state.clientSessionKey)
40797
- clientSessionKeys.delete(state.clientSessionKey);
40798
- schedulePersist();
40799
- return json(response, 200, { deleted: true });
40800
- }
40801
41012
  async function handleConfig(request, response, state) {
40802
41013
  const body = await readJson(request);
40803
41014
  assertSessionOpen(state);
@@ -40878,6 +41089,7 @@ async function handleCompact(request, response, state) {
40878
41089
  state.manualCompaction = undefined;
40879
41090
  settle(stopped);
40880
41091
  state.compacting = false;
41092
+ state.lastAccessed = Date.now();
40881
41093
  state.dispatching = false;
40882
41094
  state.revision += 1;
40883
41095
  schedulePersist();
@@ -42091,7 +42303,7 @@ export {
42091
42303
  setAgentSessionTestHooks,
42092
42304
  setAuthProbeTimeoutForTests,
42093
42305
  setCancelAckTimeoutForTests,
42094
- setDeleteCancelTimeoutForTests,
42306
+ setCloseCancelTimeoutForTests,
42095
42307
  setModelRuntimeFactoryForTests,
42096
42308
  setPendingRemoval,
42097
42309
  setPersistWriteGateForTests,