@openrig/cli 0.7.10 → 0.7.11

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.
Files changed (699) hide show
  1. package/README.md +5 -5
  2. package/daemon/assets/claude-permission-policies.cjs +41 -0
  3. package/daemon/assets/claude-permission-policies.d.cts +3 -0
  4. package/daemon/assets/claude-team-permissions.cjs +13 -3
  5. package/daemon/assets/openshell/README.md +1 -1
  6. package/daemon/assets/pi-account-lock.cjs +39 -0
  7. package/daemon/assets/plugins/openrig/.claude-plugin/marketplace.json +15 -0
  8. package/daemon/assets/plugins/openrig/.claude-plugin/plugin.json +32 -0
  9. package/daemon/assets/plugins/openrig/.codex-plugin/plugin.json +39 -0
  10. package/daemon/assets/plugins/openrig/.cursor-plugin/plugin.json +6 -0
  11. package/daemon/assets/plugins/openrig/LICENSE +200 -0
  12. package/daemon/assets/plugins/openrig/README.md +106 -0
  13. package/daemon/assets/plugins/openrig/assets/logo.svg +1 -0
  14. package/daemon/assets/plugins/openrig/mcp.json +10 -0
  15. package/daemon/assets/plugins/openrig/plugin.json +14 -0
  16. package/daemon/assets/plugins/openrig/skills/working-with-an-openrig-team/SKILL.md +90 -0
  17. package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +1 -1
  18. package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
  19. package/daemon/assets/plugins/openrig-core/hooks/scripts/activity-relay.cjs +20 -0
  20. package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus.cjs +7 -0
  21. package/daemon/assets/plugins/openrig-core/skills/openrig-skills/SKILL.md +1 -0
  22. package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +24 -8
  23. package/daemon/assets/plugins/openrig-core/skills/refocusing/SKILL.md +5 -0
  24. package/daemon/assets/plugins/openrig-core/skills/refocusing/scripts/trace-to-root.py +26 -4
  25. package/daemon/context-packs/help/manifest.yaml +1 -1
  26. package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
  27. package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +72 -9
  28. package/daemon/context-packs/reference/acp-agents.md +68 -0
  29. package/daemon/context-packs/reference/getting-started.md +3 -2
  30. package/daemon/context-packs/reference/manifest.yaml +4 -1
  31. package/daemon/context-packs/reference/rig-spec.md +63 -6
  32. package/daemon/context-packs/reference/tmux-servers.md +214 -0
  33. package/daemon/context-packs/reference/whats-new.md +271 -21
  34. package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
  35. package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
  36. package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
  37. package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
  38. package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
  39. package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
  40. package/daemon/context-packs/skills/core/cross-host-rig-commands/SKILL.md +7 -0
  41. package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
  42. package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
  43. package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
  44. package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
  45. package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
  46. package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
  47. package/daemon/context-packs/skills/core/openrig-skills/SKILL.md +1 -0
  48. package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
  49. package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
  50. package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
  51. package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
  52. package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
  53. package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
  54. package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
  55. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
  56. package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
  57. package/daemon/context-packs/skills/core/working-with-an-openrig-team/SKILL.md +90 -0
  58. package/daemon/context-packs/skills/core/working-with-an-openrig-team/manifest.yaml +10 -0
  59. package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
  60. package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
  61. package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
  62. package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
  63. package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
  64. package/daemon/context-packs/skills/openrig-user/SKILL.md +24 -8
  65. package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
  66. package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
  67. package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
  68. package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
  69. package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
  70. package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
  71. package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
  72. package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
  73. package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
  74. package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
  75. package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
  76. package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
  77. package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
  78. package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
  79. package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
  80. package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
  81. package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
  82. package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
  83. package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
  84. package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
  85. package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
  86. package/daemon/context-packs/skills/refocusing/SKILL.md +5 -0
  87. package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
  88. package/daemon/context-packs/skills/refocusing/scripts/trace-to-root.py +26 -4
  89. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
  90. package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
  91. package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
  92. package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
  93. package/daemon/context-packs/world-example/manifest.yaml +1 -1
  94. package/daemon/context-packs/world-public/manifest.yaml +1 -1
  95. package/daemon/dist/adapters/claude-code-adapter.d.ts +3 -1
  96. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  97. package/daemon/dist/adapters/claude-code-adapter.js +41 -12
  98. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  99. package/daemon/dist/adapters/claude-resume.d.ts +1 -1
  100. package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
  101. package/daemon/dist/adapters/claude-resume.js +17 -3
  102. package/daemon/dist/adapters/claude-resume.js.map +1 -1
  103. package/daemon/dist/adapters/codex-resume.d.ts +1 -1
  104. package/daemon/dist/adapters/codex-resume.d.ts.map +1 -1
  105. package/daemon/dist/adapters/codex-resume.js +6 -2
  106. package/daemon/dist/adapters/codex-resume.js.map +1 -1
  107. package/daemon/dist/adapters/codex-runtime-adapter.d.ts +2 -0
  108. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  109. package/daemon/dist/adapters/codex-runtime-adapter.js +36 -11
  110. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  111. package/daemon/dist/adapters/kernel-authority.d.ts +2 -4
  112. package/daemon/dist/adapters/kernel-authority.d.ts.map +1 -1
  113. package/daemon/dist/adapters/kernel-authority.js +10 -41
  114. package/daemon/dist/adapters/kernel-authority.js.map +1 -1
  115. package/daemon/dist/adapters/openshell-podman-observer.d.ts.map +1 -1
  116. package/daemon/dist/adapters/openshell-podman-observer.js +5 -3
  117. package/daemon/dist/adapters/openshell-podman-observer.js.map +1 -1
  118. package/daemon/dist/adapters/pi-resume.d.ts +4 -1
  119. package/daemon/dist/adapters/pi-resume.d.ts.map +1 -1
  120. package/daemon/dist/adapters/pi-resume.js +38 -9
  121. package/daemon/dist/adapters/pi-resume.js.map +1 -1
  122. package/daemon/dist/adapters/pi-runner-protocol.d.ts +4 -0
  123. package/daemon/dist/adapters/pi-runner-protocol.d.ts.map +1 -1
  124. package/daemon/dist/adapters/pi-runner-protocol.js +7 -0
  125. package/daemon/dist/adapters/pi-runner-protocol.js.map +1 -1
  126. package/daemon/dist/adapters/pi-runner.d.ts +5 -0
  127. package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
  128. package/daemon/dist/adapters/pi-runner.js +79 -8
  129. package/daemon/dist/adapters/pi-runner.js.map +1 -1
  130. package/daemon/dist/adapters/pi-runtime-adapter.d.ts +6 -0
  131. package/daemon/dist/adapters/pi-runtime-adapter.d.ts.map +1 -1
  132. package/daemon/dist/adapters/pi-runtime-adapter.js +58 -23
  133. package/daemon/dist/adapters/pi-runtime-adapter.js.map +1 -1
  134. package/daemon/dist/adapters/tmux-control.d.ts +32 -1
  135. package/daemon/dist/adapters/tmux-control.d.ts.map +1 -1
  136. package/daemon/dist/adapters/tmux-control.js +149 -9
  137. package/daemon/dist/adapters/tmux-control.js.map +1 -1
  138. package/daemon/dist/adapters/tmux-server.d.ts +9 -0
  139. package/daemon/dist/adapters/tmux-server.d.ts.map +1 -1
  140. package/daemon/dist/adapters/tmux-server.js +12 -0
  141. package/daemon/dist/adapters/tmux-server.js.map +1 -1
  142. package/daemon/dist/adapters/tmux.d.ts +18 -0
  143. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  144. package/daemon/dist/adapters/tmux.js +164 -12
  145. package/daemon/dist/adapters/tmux.js.map +1 -1
  146. package/daemon/dist/build-info.js +3 -3
  147. package/daemon/dist/db/all-migrations.d.ts.map +1 -1
  148. package/daemon/dist/db/all-migrations.js +10 -0
  149. package/daemon/dist/db/all-migrations.js.map +1 -1
  150. package/daemon/dist/db/migrations/150_node_launch_wrapper.d.ts +3 -0
  151. package/daemon/dist/db/migrations/150_node_launch_wrapper.d.ts.map +1 -0
  152. package/daemon/dist/db/migrations/150_node_launch_wrapper.js +5 -0
  153. package/daemon/dist/db/migrations/150_node_launch_wrapper.js.map +1 -0
  154. package/daemon/dist/db/migrations/151_pi_account_switches.d.ts +4 -0
  155. package/daemon/dist/db/migrations/151_pi_account_switches.d.ts.map +1 -0
  156. package/daemon/dist/db/migrations/151_pi_account_switches.js +44 -0
  157. package/daemon/dist/db/migrations/151_pi_account_switches.js.map +1 -0
  158. package/daemon/dist/db/migrations/152_workflow_instance_spec.d.ts +8 -0
  159. package/daemon/dist/db/migrations/152_workflow_instance_spec.d.ts.map +1 -0
  160. package/daemon/dist/db/migrations/152_workflow_instance_spec.js +13 -0
  161. package/daemon/dist/db/migrations/152_workflow_instance_spec.js.map +1 -0
  162. package/daemon/dist/db/migrations/153_events_retention_marks.d.ts +7 -0
  163. package/daemon/dist/db/migrations/153_events_retention_marks.d.ts.map +1 -0
  164. package/daemon/dist/db/migrations/153_events_retention_marks.js +17 -0
  165. package/daemon/dist/db/migrations/153_events_retention_marks.js.map +1 -0
  166. package/daemon/dist/db/migrations/154_workflow_instance_root_objective.d.ts +7 -0
  167. package/daemon/dist/db/migrations/154_workflow_instance_root_objective.d.ts.map +1 -0
  168. package/daemon/dist/db/migrations/154_workflow_instance_root_objective.js +11 -0
  169. package/daemon/dist/db/migrations/154_workflow_instance_root_objective.js.map +1 -0
  170. package/daemon/dist/domain/activity-taxonomy.d.ts +9 -0
  171. package/daemon/dist/domain/activity-taxonomy.d.ts.map +1 -1
  172. package/daemon/dist/domain/activity-taxonomy.js.map +1 -1
  173. package/daemon/dist/domain/agent-manifest.d.ts.map +1 -1
  174. package/daemon/dist/domain/agent-manifest.js +11 -1
  175. package/daemon/dist/domain/agent-manifest.js.map +1 -1
  176. package/daemon/dist/domain/claude-compaction-enforcer.d.ts +43 -3
  177. package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
  178. package/daemon/dist/domain/claude-compaction-enforcer.js +306 -22
  179. package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
  180. package/daemon/dist/domain/claude-managed-launch.d.ts +2 -0
  181. package/daemon/dist/domain/claude-managed-launch.d.ts.map +1 -1
  182. package/daemon/dist/domain/claude-managed-launch.js +12 -2
  183. package/daemon/dist/domain/claude-managed-launch.js.map +1 -1
  184. package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
  185. package/daemon/dist/domain/context-monitor.js +3 -0
  186. package/daemon/dist/domain/context-monitor.js.map +1 -1
  187. package/daemon/dist/domain/context-usage-store.d.ts.map +1 -1
  188. package/daemon/dist/domain/context-usage-store.js +10 -1
  189. package/daemon/dist/domain/context-usage-store.js.map +1 -1
  190. package/daemon/dist/domain/desired-claude-activity-hooks.d.ts +4 -3
  191. package/daemon/dist/domain/desired-claude-activity-hooks.d.ts.map +1 -1
  192. package/daemon/dist/domain/desired-claude-activity-hooks.js +49 -15
  193. package/daemon/dist/domain/desired-claude-activity-hooks.js.map +1 -1
  194. package/daemon/dist/domain/draft-aware-delivery.d.ts.map +1 -1
  195. package/daemon/dist/domain/draft-aware-delivery.js +5 -1
  196. package/daemon/dist/domain/draft-aware-delivery.js.map +1 -1
  197. package/daemon/dist/domain/event-bus.d.ts +31 -0
  198. package/daemon/dist/domain/event-bus.d.ts.map +1 -1
  199. package/daemon/dist/domain/event-bus.js +87 -1
  200. package/daemon/dist/domain/event-bus.js.map +1 -1
  201. package/daemon/dist/domain/execution-view.d.ts +9 -0
  202. package/daemon/dist/domain/execution-view.d.ts.map +1 -1
  203. package/daemon/dist/domain/execution-view.js +13 -0
  204. package/daemon/dist/domain/execution-view.js.map +1 -1
  205. package/daemon/dist/domain/gateway/connections-projection.d.ts +13 -1
  206. package/daemon/dist/domain/gateway/connections-projection.d.ts.map +1 -1
  207. package/daemon/dist/domain/gateway/connections-projection.js +38 -10
  208. package/daemon/dist/domain/gateway/connections-projection.js.map +1 -1
  209. package/daemon/dist/domain/gateway/dispatcher.d.ts +2 -0
  210. package/daemon/dist/domain/gateway/dispatcher.d.ts.map +1 -1
  211. package/daemon/dist/domain/gateway/dispatcher.js +14 -1
  212. package/daemon/dist/domain/gateway/dispatcher.js.map +1 -1
  213. package/daemon/dist/domain/gateway/gateway-subsystem.d.ts +2 -0
  214. package/daemon/dist/domain/gateway/gateway-subsystem.d.ts.map +1 -1
  215. package/daemon/dist/domain/gateway/gateway-subsystem.js +1 -0
  216. package/daemon/dist/domain/gateway/gateway-subsystem.js.map +1 -1
  217. package/daemon/dist/domain/gateway/human-readiness.d.ts +7 -0
  218. package/daemon/dist/domain/gateway/human-readiness.d.ts.map +1 -1
  219. package/daemon/dist/domain/gateway/human-readiness.js +45 -0
  220. package/daemon/dist/domain/gateway/human-readiness.js.map +1 -1
  221. package/daemon/dist/domain/gateway/human-registry.d.ts +23 -3
  222. package/daemon/dist/domain/gateway/human-registry.d.ts.map +1 -1
  223. package/daemon/dist/domain/gateway/human-registry.js +66 -34
  224. package/daemon/dist/domain/gateway/human-registry.js.map +1 -1
  225. package/daemon/dist/domain/gateway/operator-delivery-engine.d.ts.map +1 -1
  226. package/daemon/dist/domain/gateway/operator-delivery-engine.js +8 -2
  227. package/daemon/dist/domain/gateway/operator-delivery-engine.js.map +1 -1
  228. package/daemon/dist/domain/gateway/relay-config.d.ts +80 -0
  229. package/daemon/dist/domain/gateway/relay-config.d.ts.map +1 -0
  230. package/daemon/dist/domain/gateway/relay-config.js +290 -0
  231. package/daemon/dist/domain/gateway/relay-config.js.map +1 -0
  232. package/daemon/dist/domain/gateway/relay-inbound.d.ts +74 -0
  233. package/daemon/dist/domain/gateway/relay-inbound.d.ts.map +1 -0
  234. package/daemon/dist/domain/gateway/relay-inbound.js +739 -0
  235. package/daemon/dist/domain/gateway/relay-inbound.js.map +1 -0
  236. package/daemon/dist/domain/gateway/relay-outbound.d.ts +215 -0
  237. package/daemon/dist/domain/gateway/relay-outbound.d.ts.map +1 -0
  238. package/daemon/dist/domain/gateway/relay-outbound.js +770 -0
  239. package/daemon/dist/domain/gateway/relay-outbound.js.map +1 -0
  240. package/daemon/dist/domain/gateway/slack/open-asks.d.ts.map +1 -1
  241. package/daemon/dist/domain/gateway/slack/open-asks.js +14 -1
  242. package/daemon/dist/domain/gateway/slack/open-asks.js.map +1 -1
  243. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
  244. package/daemon/dist/domain/gateway/slack/slack-subsystem.js +224 -32
  245. package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
  246. package/daemon/dist/domain/hosts/pairing-ask.d.ts +10 -0
  247. package/daemon/dist/domain/hosts/pairing-ask.d.ts.map +1 -0
  248. package/daemon/dist/domain/hosts/pairing-ask.js +9 -0
  249. package/daemon/dist/domain/hosts/pairing-ask.js.map +1 -0
  250. package/daemon/dist/domain/launch-wrapper.d.ts +28 -0
  251. package/daemon/dist/domain/launch-wrapper.d.ts.map +1 -0
  252. package/daemon/dist/domain/launch-wrapper.js +93 -0
  253. package/daemon/dist/domain/launch-wrapper.js.map +1 -0
  254. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts +1 -1
  255. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
  256. package/daemon/dist/domain/mission-control/mission-control-write-contract.js +85 -28
  257. package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
  258. package/daemon/dist/domain/model-divergence/current-model-reader.d.ts.map +1 -1
  259. package/daemon/dist/domain/model-divergence/current-model-reader.js +14 -3
  260. package/daemon/dist/domain/model-divergence/current-model-reader.js.map +1 -1
  261. package/daemon/dist/domain/native-process-lineage.d.ts.map +1 -1
  262. package/daemon/dist/domain/native-process-lineage.js +32 -9
  263. package/daemon/dist/domain/native-process-lineage.js.map +1 -1
  264. package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
  265. package/daemon/dist/domain/node-inventory.js +7 -0
  266. package/daemon/dist/domain/node-inventory.js.map +1 -1
  267. package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
  268. package/daemon/dist/domain/node-launcher.js +9 -2
  269. package/daemon/dist/domain/node-launcher.js.map +1 -1
  270. package/daemon/dist/domain/outbox-handler.d.ts +53 -3
  271. package/daemon/dist/domain/outbox-handler.d.ts.map +1 -1
  272. package/daemon/dist/domain/outbox-handler.js +101 -6
  273. package/daemon/dist/domain/outbox-handler.js.map +1 -1
  274. package/daemon/dist/domain/parent-session-env.d.ts +2 -1
  275. package/daemon/dist/domain/parent-session-env.d.ts.map +1 -1
  276. package/daemon/dist/domain/parent-session-env.js +9 -1
  277. package/daemon/dist/domain/parent-session-env.js.map +1 -1
  278. package/daemon/dist/domain/parked-query.d.ts +6 -0
  279. package/daemon/dist/domain/parked-query.d.ts.map +1 -1
  280. package/daemon/dist/domain/parked-query.js +1 -0
  281. package/daemon/dist/domain/parked-query.js.map +1 -1
  282. package/daemon/dist/domain/pi-account-state.d.ts +6 -0
  283. package/daemon/dist/domain/pi-account-state.d.ts.map +1 -0
  284. package/daemon/dist/domain/pi-account-state.js +14 -0
  285. package/daemon/dist/domain/pi-account-state.js.map +1 -0
  286. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts +6 -0
  287. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts.map +1 -1
  288. package/daemon/dist/domain/policies/parked-owner-consumer.js +10 -1
  289. package/daemon/dist/domain/policies/parked-owner-consumer.js.map +1 -1
  290. package/daemon/dist/domain/policies/quiet-release.d.ts.map +1 -1
  291. package/daemon/dist/domain/policies/quiet-release.js +6 -3
  292. package/daemon/dist/domain/policies/quiet-release.js.map +1 -1
  293. package/daemon/dist/domain/projection-planner.d.ts +4 -1
  294. package/daemon/dist/domain/projection-planner.d.ts.map +1 -1
  295. package/daemon/dist/domain/projection-planner.js +3 -0
  296. package/daemon/dist/domain/projection-planner.js.map +1 -1
  297. package/daemon/dist/domain/queue-pickup.d.ts +20 -1
  298. package/daemon/dist/domain/queue-pickup.d.ts.map +1 -1
  299. package/daemon/dist/domain/queue-pickup.js +38 -6
  300. package/daemon/dist/domain/queue-pickup.js.map +1 -1
  301. package/daemon/dist/domain/queue-recovery.d.ts +14 -0
  302. package/daemon/dist/domain/queue-recovery.d.ts.map +1 -1
  303. package/daemon/dist/domain/queue-recovery.js +33 -1
  304. package/daemon/dist/domain/queue-recovery.js.map +1 -1
  305. package/daemon/dist/domain/queue-repository.d.ts +76 -10
  306. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  307. package/daemon/dist/domain/queue-repository.js +351 -44
  308. package/daemon/dist/domain/queue-repository.js.map +1 -1
  309. package/daemon/dist/domain/queue-retention.d.ts +68 -0
  310. package/daemon/dist/domain/queue-retention.d.ts.map +1 -1
  311. package/daemon/dist/domain/queue-retention.js +133 -0
  312. package/daemon/dist/domain/queue-retention.js.map +1 -1
  313. package/daemon/dist/domain/queue-stuck-sweep.d.ts +22 -1
  314. package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
  315. package/daemon/dist/domain/queue-stuck-sweep.js +577 -158
  316. package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
  317. package/daemon/dist/domain/queue-transition-log.d.ts +49 -1
  318. package/daemon/dist/domain/queue-transition-log.d.ts.map +1 -1
  319. package/daemon/dist/domain/queue-transition-log.js +216 -3
  320. package/daemon/dist/domain/queue-transition-log.js.map +1 -1
  321. package/daemon/dist/domain/queue-waiting.d.ts +1 -1
  322. package/daemon/dist/domain/queue-waiting.d.ts.map +1 -1
  323. package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
  324. package/daemon/dist/domain/queue-wake-ladder.js +7 -2
  325. package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
  326. package/daemon/dist/domain/quiet-hold-custody.d.ts.map +1 -1
  327. package/daemon/dist/domain/quiet-hold-custody.js +7 -3
  328. package/daemon/dist/domain/quiet-hold-custody.js.map +1 -1
  329. package/daemon/dist/domain/restore-orchestrator.d.ts +13 -2
  330. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  331. package/daemon/dist/domain/restore-orchestrator.js +63 -26
  332. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  333. package/daemon/dist/domain/rig-repository.d.ts +3 -0
  334. package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
  335. package/daemon/dist/domain/rig-repository.js +46 -1
  336. package/daemon/dist/domain/rig-repository.js.map +1 -1
  337. package/daemon/dist/domain/rigspec-codec.d.ts.map +1 -1
  338. package/daemon/dist/domain/rigspec-codec.js +4 -0
  339. package/daemon/dist/domain/rigspec-codec.js.map +1 -1
  340. package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
  341. package/daemon/dist/domain/rigspec-exporter.js +5 -0
  342. package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
  343. package/daemon/dist/domain/rigspec-instantiator.d.ts +17 -1
  344. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  345. package/daemon/dist/domain/rigspec-instantiator.js +68 -20
  346. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  347. package/daemon/dist/domain/rigspec-preflight.d.ts.map +1 -1
  348. package/daemon/dist/domain/rigspec-preflight.js +10 -0
  349. package/daemon/dist/domain/rigspec-preflight.js.map +1 -1
  350. package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
  351. package/daemon/dist/domain/rigspec-schema.js +26 -1
  352. package/daemon/dist/domain/rigspec-schema.js.map +1 -1
  353. package/daemon/dist/domain/runtime-adapter.d.ts +1 -0
  354. package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
  355. package/daemon/dist/domain/runtime-adapter.js.map +1 -1
  356. package/daemon/dist/domain/runtime-switch-materials.d.ts +1 -1
  357. package/daemon/dist/domain/runtime-switch-materials.d.ts.map +1 -1
  358. package/daemon/dist/domain/runtime-switch-materials.js +2 -2
  359. package/daemon/dist/domain/runtime-switch-materials.js.map +1 -1
  360. package/daemon/dist/domain/seat-activity-service.d.ts +38 -1
  361. package/daemon/dist/domain/seat-activity-service.d.ts.map +1 -1
  362. package/daemon/dist/domain/seat-activity-service.js +59 -1
  363. package/daemon/dist/domain/seat-activity-service.js.map +1 -1
  364. package/daemon/dist/domain/seat-attention-reconciler.d.ts +13 -0
  365. package/daemon/dist/domain/seat-attention-reconciler.d.ts.map +1 -1
  366. package/daemon/dist/domain/seat-attention-reconciler.js +45 -1
  367. package/daemon/dist/domain/seat-attention-reconciler.js.map +1 -1
  368. package/daemon/dist/domain/seat-handover-service.d.ts +1 -0
  369. package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
  370. package/daemon/dist/domain/seat-handover-service.js +38 -11
  371. package/daemon/dist/domain/seat-handover-service.js.map +1 -1
  372. package/daemon/dist/domain/seat-launch-environment.d.ts +10 -0
  373. package/daemon/dist/domain/seat-launch-environment.d.ts.map +1 -1
  374. package/daemon/dist/domain/seat-launch-environment.js +62 -15
  375. package/daemon/dist/domain/seat-launch-environment.js.map +1 -1
  376. package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
  377. package/daemon/dist/domain/seat-lifecycle-service.js +7 -3
  378. package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
  379. package/daemon/dist/domain/seat-restart-in-place.d.ts +2 -1
  380. package/daemon/dist/domain/seat-restart-in-place.d.ts.map +1 -1
  381. package/daemon/dist/domain/seat-restart-in-place.js +19 -1
  382. package/daemon/dist/domain/seat-restart-in-place.js.map +1 -1
  383. package/daemon/dist/domain/seat-runtime-home.d.ts +4 -1
  384. package/daemon/dist/domain/seat-runtime-home.d.ts.map +1 -1
  385. package/daemon/dist/domain/seat-runtime-home.js +6 -4
  386. package/daemon/dist/domain/seat-runtime-home.js.map +1 -1
  387. package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -1
  388. package/daemon/dist/domain/seat-runtime-switch-service.js +73 -10
  389. package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
  390. package/daemon/dist/domain/seat-skill-storage.d.ts +57 -4
  391. package/daemon/dist/domain/seat-skill-storage.d.ts.map +1 -1
  392. package/daemon/dist/domain/seat-skill-storage.js +338 -8
  393. package/daemon/dist/domain/seat-skill-storage.js.map +1 -1
  394. package/daemon/dist/domain/seat-status-service.d.ts +2 -2
  395. package/daemon/dist/domain/seat-status-service.d.ts.map +1 -1
  396. package/daemon/dist/domain/seat-status-service.js +3 -2
  397. package/daemon/dist/domain/seat-status-service.js.map +1 -1
  398. package/daemon/dist/domain/self-attach-service.d.ts.map +1 -1
  399. package/daemon/dist/domain/self-attach-service.js +11 -4
  400. package/daemon/dist/domain/self-attach-service.js.map +1 -1
  401. package/daemon/dist/domain/session-transport.d.ts +25 -2
  402. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  403. package/daemon/dist/domain/session-transport.js +199 -30
  404. package/daemon/dist/domain/session-transport.js.map +1 -1
  405. package/daemon/dist/domain/skill-catalog.d.ts +37 -0
  406. package/daemon/dist/domain/skill-catalog.d.ts.map +1 -1
  407. package/daemon/dist/domain/skill-catalog.js +152 -3
  408. package/daemon/dist/domain/skill-catalog.js.map +1 -1
  409. package/daemon/dist/domain/slices/slice-detail-projector.d.ts +1 -1
  410. package/daemon/dist/domain/slices/slice-detail-projector.d.ts.map +1 -1
  411. package/daemon/dist/domain/slices/slice-detail-projector.js +11 -13
  412. package/daemon/dist/domain/slices/slice-detail-projector.js.map +1 -1
  413. package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
  414. package/daemon/dist/domain/startup-orchestrator.js +7 -1
  415. package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
  416. package/daemon/dist/domain/successor-session-launcher.d.ts +1 -0
  417. package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
  418. package/daemon/dist/domain/successor-session-launcher.js +1 -0
  419. package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
  420. package/daemon/dist/domain/terminal/earlier-tile-attach-0711.d.ts +2 -0
  421. package/daemon/dist/domain/terminal/earlier-tile-attach-0711.d.ts.map +1 -0
  422. package/daemon/dist/domain/terminal/earlier-tile-attach-0711.js +146 -0
  423. package/daemon/dist/domain/terminal/earlier-tile-attach-0711.js.map +1 -0
  424. package/daemon/dist/domain/terminal/earlier-tile-attach.d.ts +1 -0
  425. package/daemon/dist/domain/terminal/earlier-tile-attach.d.ts.map +1 -1
  426. package/daemon/dist/domain/terminal/earlier-tile-attach.js +42 -1
  427. package/daemon/dist/domain/terminal/earlier-tile-attach.js.map +1 -1
  428. package/daemon/dist/domain/terminal/herdr-follow-view.d.ts.map +1 -1
  429. package/daemon/dist/domain/terminal/herdr-follow-view.js +43 -19
  430. package/daemon/dist/domain/terminal/herdr-follow-view.js.map +1 -1
  431. package/daemon/dist/domain/terminal/herdr-viewer.d.ts +7 -4
  432. package/daemon/dist/domain/terminal/herdr-viewer.d.ts.map +1 -1
  433. package/daemon/dist/domain/terminal/herdr-viewer.js +101 -47
  434. package/daemon/dist/domain/terminal/herdr-viewer.js.map +1 -1
  435. package/daemon/dist/domain/terminal/terminal-following.js +3 -3
  436. package/daemon/dist/domain/terminal/terminal-following.js.map +1 -1
  437. package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
  438. package/daemon/dist/domain/terminal/terminal-service.js +16 -1
  439. package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
  440. package/daemon/dist/domain/terminal/tile-attach.d.ts +6 -3
  441. package/daemon/dist/domain/terminal/tile-attach.d.ts.map +1 -1
  442. package/daemon/dist/domain/terminal/tile-attach.js +11 -46
  443. package/daemon/dist/domain/terminal/tile-attach.js.map +1 -1
  444. package/daemon/dist/domain/tmux-server-selection.d.ts.map +1 -1
  445. package/daemon/dist/domain/tmux-server-selection.js +8 -2
  446. package/daemon/dist/domain/tmux-server-selection.js.map +1 -1
  447. package/daemon/dist/domain/types.d.ts +18 -1
  448. package/daemon/dist/domain/types.d.ts.map +1 -1
  449. package/daemon/dist/domain/types.js.map +1 -1
  450. package/daemon/dist/domain/user-settings/settings-store.d.ts +1 -1
  451. package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
  452. package/daemon/dist/domain/user-settings/settings-store.js +48 -0
  453. package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
  454. package/daemon/dist/domain/view-event-bridge.js +1 -1
  455. package/daemon/dist/domain/view-event-bridge.js.map +1 -1
  456. package/daemon/dist/domain/view-projector.d.ts +4 -1
  457. package/daemon/dist/domain/view-projector.d.ts.map +1 -1
  458. package/daemon/dist/domain/view-projector.js +9 -4
  459. package/daemon/dist/domain/view-projector.js.map +1 -1
  460. package/daemon/dist/domain/wake-recovery.d.ts.map +1 -1
  461. package/daemon/dist/domain/wake-recovery.js +9 -2
  462. package/daemon/dist/domain/wake-recovery.js.map +1 -1
  463. package/daemon/dist/domain/workflow-exception-escalation.d.ts +3 -2
  464. package/daemon/dist/domain/workflow-exception-escalation.d.ts.map +1 -1
  465. package/daemon/dist/domain/workflow-exception-escalation.js +1 -1
  466. package/daemon/dist/domain/workflow-exception-escalation.js.map +1 -1
  467. package/daemon/dist/domain/workflow-instance-store.d.ts +8 -1
  468. package/daemon/dist/domain/workflow-instance-store.d.ts.map +1 -1
  469. package/daemon/dist/domain/workflow-instance-store.js +21 -3
  470. package/daemon/dist/domain/workflow-instance-store.js.map +1 -1
  471. package/daemon/dist/domain/workflow-reconciliation.d.ts.map +1 -1
  472. package/daemon/dist/domain/workflow-reconciliation.js +2 -1
  473. package/daemon/dist/domain/workflow-reconciliation.js.map +1 -1
  474. package/daemon/dist/domain/workflow-runtime.d.ts +4 -1
  475. package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
  476. package/daemon/dist/domain/workflow-runtime.js +20 -7
  477. package/daemon/dist/domain/workflow-runtime.js.map +1 -1
  478. package/daemon/dist/domain/workflow-spec-cache.d.ts +24 -4
  479. package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
  480. package/daemon/dist/domain/workflow-spec-cache.js +87 -7
  481. package/daemon/dist/domain/workflow-spec-cache.js.map +1 -1
  482. package/daemon/dist/domain/workflow-spec-unregister.d.ts +36 -0
  483. package/daemon/dist/domain/workflow-spec-unregister.d.ts.map +1 -0
  484. package/daemon/dist/domain/workflow-spec-unregister.js +105 -0
  485. package/daemon/dist/domain/workflow-spec-unregister.js.map +1 -0
  486. package/daemon/dist/domain/workflow-types.d.ts +14 -0
  487. package/daemon/dist/domain/workflow-types.d.ts.map +1 -1
  488. package/daemon/dist/index.d.ts +2 -1
  489. package/daemon/dist/index.d.ts.map +1 -1
  490. package/daemon/dist/index.js +23 -5
  491. package/daemon/dist/index.js.map +1 -1
  492. package/daemon/dist/learned-host-bindings-surface.d.ts +2 -0
  493. package/daemon/dist/learned-host-bindings-surface.d.ts.map +1 -0
  494. package/daemon/dist/learned-host-bindings-surface.js +4 -0
  495. package/daemon/dist/learned-host-bindings-surface.js.map +1 -0
  496. package/daemon/dist/routes/activity.d.ts.map +1 -1
  497. package/daemon/dist/routes/activity.js +37 -2
  498. package/daemon/dist/routes/activity.js.map +1 -1
  499. package/daemon/dist/routes/adapters.d.ts.map +1 -1
  500. package/daemon/dist/routes/adapters.js +4 -0
  501. package/daemon/dist/routes/adapters.js.map +1 -1
  502. package/daemon/dist/routes/compaction.js +2 -0
  503. package/daemon/dist/routes/compaction.js.map +1 -1
  504. package/daemon/dist/routes/events.js +4 -0
  505. package/daemon/dist/routes/events.js.map +1 -1
  506. package/daemon/dist/routes/gateway.d.ts +3 -0
  507. package/daemon/dist/routes/gateway.d.ts.map +1 -1
  508. package/daemon/dist/routes/gateway.js +58 -8
  509. package/daemon/dist/routes/gateway.js.map +1 -1
  510. package/daemon/dist/routes/hosts.d.ts.map +1 -1
  511. package/daemon/dist/routes/hosts.js +298 -35
  512. package/daemon/dist/routes/hosts.js.map +1 -1
  513. package/daemon/dist/routes/queue.d.ts.map +1 -1
  514. package/daemon/dist/routes/queue.js +10 -3
  515. package/daemon/dist/routes/queue.js.map +1 -1
  516. package/daemon/dist/routes/seat.d.ts.map +1 -1
  517. package/daemon/dist/routes/seat.js +4 -3
  518. package/daemon/dist/routes/seat.js.map +1 -1
  519. package/daemon/dist/routes/terminal-ws.d.ts +1 -0
  520. package/daemon/dist/routes/terminal-ws.d.ts.map +1 -1
  521. package/daemon/dist/routes/terminal-ws.js +1 -1
  522. package/daemon/dist/routes/terminal-ws.js.map +1 -1
  523. package/daemon/dist/routes/workflow.d.ts.map +1 -1
  524. package/daemon/dist/routes/workflow.js +24 -0
  525. package/daemon/dist/routes/workflow.js.map +1 -1
  526. package/daemon/dist/server.d.ts +2 -0
  527. package/daemon/dist/server.d.ts.map +1 -1
  528. package/daemon/dist/server.js +7 -2
  529. package/daemon/dist/server.js.map +1 -1
  530. package/daemon/dist/startup.d.ts.map +1 -1
  531. package/daemon/dist/startup.js +65 -15
  532. package/daemon/dist/startup.js.map +1 -1
  533. package/daemon/dist/terminal/TerminalSessionBroker.d.ts +18 -13
  534. package/daemon/dist/terminal/TerminalSessionBroker.d.ts.map +1 -1
  535. package/daemon/dist/terminal/TerminalSessionBroker.js +113 -76
  536. package/daemon/dist/terminal/TerminalSessionBroker.js.map +1 -1
  537. package/daemon/dist/terminal/window-pin.d.ts +3 -3
  538. package/daemon/dist/terminal/window-pin.d.ts.map +1 -1
  539. package/daemon/dist/terminal/window-pin.js +2 -2
  540. package/daemon/dist/terminal/window-pin.js.map +1 -1
  541. package/daemon/docs/reference/acp-agents.md +68 -0
  542. package/daemon/docs/reference/agent-spec.md +53 -1
  543. package/daemon/docs/reference/agent-startup-guide.md +28 -0
  544. package/daemon/docs/reference/agent-state-taxonomy.md +7 -0
  545. package/daemon/docs/reference/daemon-http-clients.md +16 -7
  546. package/daemon/docs/reference/gateway-participants.md +4 -1
  547. package/daemon/docs/reference/gateway-relay.md +239 -0
  548. package/daemon/docs/reference/getting-started.md +3 -2
  549. package/daemon/docs/reference/hosted-members.md +38 -1
  550. package/daemon/docs/reference/project-workspace.md +4 -0
  551. package/daemon/docs/reference/quickstart.md +1 -1
  552. package/daemon/docs/reference/reconstructions.md +90 -0
  553. package/daemon/docs/reference/rig-spec.md +63 -6
  554. package/daemon/docs/reference/seat-delivery.md +20 -0
  555. package/daemon/docs/reference/terminal-sessions.md +88 -26
  556. package/daemon/docs/reference/tmux-servers.md +48 -0
  557. package/daemon/docs/reference/whats-new.md +271 -21
  558. package/daemon/specs/agents/shared/skills/core/cross-host-rig-commands/SKILL.md +7 -0
  559. package/daemon/specs/agents/shared/skills/core/openrig-skills/SKILL.md +1 -0
  560. package/daemon/specs/agents/shared/skills/core/working-with-an-openrig-team/SKILL.md +90 -0
  561. package/dist/acp/agent-server.d.ts +126 -0
  562. package/dist/acp/agent-server.d.ts.map +1 -0
  563. package/dist/acp/agent-server.js +449 -0
  564. package/dist/acp/agent-server.js.map +1 -0
  565. package/dist/acp/json-rpc-stdio.d.ts +24 -10
  566. package/dist/acp/json-rpc-stdio.d.ts.map +1 -1
  567. package/dist/acp/json-rpc-stdio.js +58 -36
  568. package/dist/acp/json-rpc-stdio.js.map +1 -1
  569. package/dist/bin-wrapper.d.ts.map +1 -1
  570. package/dist/bin-wrapper.js +3 -1
  571. package/dist/bin-wrapper.js.map +1 -1
  572. package/dist/build-info.js +3 -3
  573. package/dist/client.d.ts +4 -0
  574. package/dist/client.d.ts.map +1 -1
  575. package/dist/client.js +7 -0
  576. package/dist/client.js.map +1 -1
  577. package/dist/commands/acp.d.ts +14 -0
  578. package/dist/commands/acp.d.ts.map +1 -1
  579. package/dist/commands/acp.js +189 -2
  580. package/dist/commands/acp.js.map +1 -1
  581. package/dist/commands/attach.js +1 -1
  582. package/dist/commands/attach.js.map +1 -1
  583. package/dist/commands/capture.js +6 -6
  584. package/dist/commands/capture.js.map +1 -1
  585. package/dist/commands/compact.d.ts.map +1 -1
  586. package/dist/commands/compact.js +14 -2
  587. package/dist/commands/compact.js.map +1 -1
  588. package/dist/commands/config.d.ts.map +1 -1
  589. package/dist/commands/config.js +35 -6
  590. package/dist/commands/config.js.map +1 -1
  591. package/dist/commands/context-reconstruction.d.ts +5 -0
  592. package/dist/commands/context-reconstruction.d.ts.map +1 -0
  593. package/dist/commands/context-reconstruction.js +69 -0
  594. package/dist/commands/context-reconstruction.js.map +1 -0
  595. package/dist/commands/context.d.ts.map +1 -1
  596. package/dist/commands/context.js +2 -0
  597. package/dist/commands/context.js.map +1 -1
  598. package/dist/commands/daemon.d.ts.map +1 -1
  599. package/dist/commands/daemon.js +5 -2
  600. package/dist/commands/daemon.js.map +1 -1
  601. package/dist/commands/doctor.d.ts.map +1 -1
  602. package/dist/commands/doctor.js +61 -0
  603. package/dist/commands/doctor.js.map +1 -1
  604. package/dist/commands/gateway.d.ts.map +1 -1
  605. package/dist/commands/gateway.js +15 -7
  606. package/dist/commands/gateway.js.map +1 -1
  607. package/dist/commands/host.d.ts.map +1 -1
  608. package/dist/commands/host.js +59 -12
  609. package/dist/commands/host.js.map +1 -1
  610. package/dist/commands/mcp.d.ts.map +1 -1
  611. package/dist/commands/mcp.js +29 -5
  612. package/dist/commands/mcp.js.map +1 -1
  613. package/dist/commands/provider.d.ts.map +1 -1
  614. package/dist/commands/provider.js +4 -1
  615. package/dist/commands/provider.js.map +1 -1
  616. package/dist/commands/ps.d.ts +2 -0
  617. package/dist/commands/ps.d.ts.map +1 -1
  618. package/dist/commands/ps.js +3 -1
  619. package/dist/commands/ps.js.map +1 -1
  620. package/dist/commands/queue.d.ts +3 -0
  621. package/dist/commands/queue.d.ts.map +1 -1
  622. package/dist/commands/queue.js +203 -67
  623. package/dist/commands/queue.js.map +1 -1
  624. package/dist/commands/seat.d.ts.map +1 -1
  625. package/dist/commands/seat.js +15 -3
  626. package/dist/commands/seat.js.map +1 -1
  627. package/dist/commands/stream.d.ts.map +1 -1
  628. package/dist/commands/stream.js +24 -1
  629. package/dist/commands/stream.js.map +1 -1
  630. package/dist/commands/terminal.js +1 -1
  631. package/dist/commands/workflow-render.d.ts +4 -0
  632. package/dist/commands/workflow-render.d.ts.map +1 -1
  633. package/dist/commands/workflow-render.js +7 -0
  634. package/dist/commands/workflow-render.js.map +1 -1
  635. package/dist/commands/workflow.d.ts.map +1 -1
  636. package/dist/commands/workflow.js +69 -1
  637. package/dist/commands/workflow.js.map +1 -1
  638. package/dist/config-store.d.ts +8 -1
  639. package/dist/config-store.d.ts.map +1 -1
  640. package/dist/config-store.js +52 -1
  641. package/dist/config-store.js.map +1 -1
  642. package/dist/daemon-lifecycle.d.ts +2 -0
  643. package/dist/daemon-lifecycle.d.ts.map +1 -1
  644. package/dist/daemon-lifecycle.js +38 -5
  645. package/dist/daemon-lifecycle.js.map +1 -1
  646. package/dist/daemon-reachability.d.ts +1 -1
  647. package/dist/daemon-reachability.d.ts.map +1 -1
  648. package/dist/daemon-reachability.js +4 -2
  649. package/dist/daemon-reachability.js.map +1 -1
  650. package/dist/lib/reconstruction-reader.d.ts +122 -0
  651. package/dist/lib/reconstruction-reader.d.ts.map +1 -0
  652. package/dist/lib/reconstruction-reader.js +481 -0
  653. package/dist/lib/reconstruction-reader.js.map +1 -0
  654. package/dist/lib/work-install.d.ts +28 -0
  655. package/dist/lib/work-install.d.ts.map +1 -1
  656. package/dist/lib/work-install.js +80 -20
  657. package/dist/lib/work-install.js.map +1 -1
  658. package/dist/mcp-http.d.ts +7 -0
  659. package/dist/mcp-http.d.ts.map +1 -1
  660. package/dist/mcp-http.js +30 -6
  661. package/dist/mcp-http.js.map +1 -1
  662. package/dist/mcp-server.d.ts +33 -3
  663. package/dist/mcp-server.d.ts.map +1 -1
  664. package/dist/mcp-server.js +443 -52
  665. package/dist/mcp-server.js.map +1 -1
  666. package/dist/queue-artifact.d.ts +57 -0
  667. package/dist/queue-artifact.d.ts.map +1 -0
  668. package/dist/queue-artifact.js +70 -0
  669. package/dist/queue-artifact.js.map +1 -0
  670. package/dist/queue-receipt.d.ts.map +1 -1
  671. package/dist/queue-receipt.js +4 -3
  672. package/dist/queue-receipt.js.map +1 -1
  673. package/dist/system-preflight.d.ts.map +1 -1
  674. package/dist/system-preflight.js +15 -7
  675. package/dist/system-preflight.js.map +1 -1
  676. package/dist/terminal-window.d.ts.map +1 -1
  677. package/dist/terminal-window.js +13 -10
  678. package/dist/terminal-window.js.map +1 -1
  679. package/package.json +1 -1
  680. package/tui/dist/attention/attention-model.d.ts +2 -1
  681. package/tui/dist/attention/attention-model.d.ts.map +1 -1
  682. package/tui/dist/attention/attention-model.js +18 -4
  683. package/tui/dist/attention/attention-model.js.map +1 -1
  684. package/tui/dist/config/config-model.d.ts.map +1 -1
  685. package/tui/dist/config/config-model.js +2 -1
  686. package/tui/dist/config/config-model.js.map +1 -1
  687. package/tui/dist/daemon-client.d.ts +7 -0
  688. package/tui/dist/daemon-client.d.ts.map +1 -1
  689. package/tui/dist/daemon-client.js +15 -4
  690. package/tui/dist/daemon-client.js.map +1 -1
  691. package/tui/dist/demo-data.js +2 -2
  692. package/tui/dist/demo-data.js.map +1 -1
  693. package/tui/dist/main.js +5 -1
  694. package/tui/dist/main.js.map +1 -1
  695. package/ui/dist/assets/index-BOYrLyfQ.js +623 -0
  696. package/ui/dist/assets/index-DqSRu4OY.css +32 -0
  697. package/ui/dist/index.html +2 -2
  698. package/ui/dist/assets/index-BFOs3ejL.css +0 -32
  699. package/ui/dist/assets/index-CdkFwtld.js +0 -623
@@ -1 +1 @@
1
- {"version":3,"file":"claude-compaction-enforcer.d.ts","source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ACzB,OAAO,CAAC,qBAAqB;IAU7B;;uGAEmG;IACnG,OAAO,CAAC,gBAAgB;IAUxB;0HACsH;IACtH,OAAO,CAAC,eAAe;IAKvB,0FAA0F;IAC1F,qBAAqB,IAAI,IAAI;IA0B7B;;sGAEkG;IAClG,OAAO,CAAC,YAAY;IAapB,0DAA0D;IAC1D,OAAO,CAAC,WAAW;IAYnB;8FAC0F;IAC1F,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,YAAY;IAKpB,6HAA6H;IAC7H,OAAO,CAAC,sBAAsB;IAK9B;;;;;;;;;;OAUG;IACH,mBAAmB,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,EAAE,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IA2GtI,OAAO,CAAC,eAAe;IAevB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI;IA2B3D,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI;IAa7D,+EAA+E;IAC/E,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,sBAAsB,GAAG,IAAI;IAI5E;;;;;;;OAOG;IACH,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAkB7C,OAAO,CAAC,cAAc;IAItB;;;;mEAI+D;IAC/D,OAAO,CAAC,oBAAoB;IAU5B,OAAO,CAAC,mBAAmB;IAK3B;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;CAO3B"}
@@ -1,6 +1,6 @@
1
1
  import { TerminalPolicyRefusal } from "./terminal-policy.js";
2
2
  import { DeliveryGuardError } from "./seat-delivery-guard.js";
3
- import { CAPTURE_READABLE_BUDGET_MS } from "./session-transport.js";
3
+ import { CAPTURE_READABLE_BUDGET_MS, SEND_READINESS_FRESHNESS_MS } from "./session-transport.js";
4
4
  import { postCompactExtraSetting } from "./managed-restore-read-access.js";
5
5
  import * as fs from "node:fs";
6
6
  import { randomUUID } from "node:crypto";
@@ -65,6 +65,11 @@ export const AUTO_PREP_WAIT_MS_DEFAULT = 25 * 60_000;
65
65
  // How long a stopped attempt holds automatic compaction off for its seat before a fresh attempt may begin. Without it one
66
66
  // failed preparation turned automatic compaction off for the seat until someone noticed. Operational, not measured.
67
67
  export const AUTO_RETRY_AFTER_STOP_MS_DEFAULT = 10 * 60_000;
68
+ /** A held map retires once usage has risen this many points since its request (#2682). Operational, not measured: with the
69
+ * default 80% threshold, 95% is still reachable. */
70
+ export const PREPARED_MAP_MAX_GROWTH_PERCENT = 15;
71
+ /** A held map retires this long after it was first seen ready (#2682). Operational, not measured. */
72
+ export const PREPARED_MAP_MAX_AGE_MS = 2 * 60 * 60_000;
68
73
  const PREP_SEND_ATTEMPTS_MAX = 3;
69
74
  // Slices 13–14 fix — each post-compact back-half send (turn_boundary → restore →
70
75
  // audit) is idle-gated so it cannot be injected into the busy pane right after
@@ -281,6 +286,11 @@ export const COMPACTION_RECORD_FILE = "COMPACTION-STATE.json";
281
286
  export const RESTART_RECOVERY_WINDOW_MS_DEFAULT = 6 * 60 * 60_000;
282
287
  /** This daemon process. A record this process wrote is its own state, never something to recover. */
283
288
  const DAEMON_PROCESS_ID = randomUUID();
289
+ /** What an automatic attempt returns while it is held, its map complete, until a window opens (#2682). */
290
+ const PREPARED_AWAITING_WINDOW = "prepared_awaiting_window";
291
+ /** Refusals of the /compact before any input that hold a completed map instead of stopping it: a draft in the box (in
292
+ * the receipt or thrown by the guard) and a pane in a tmux mode. Every other refusal stops as before. */
293
+ const HOLD_REASONS = new Set(["draft_input_busy", "draft_input_unknown", "draft_input_changed", "pane_in_mode"]);
284
294
  const RECORD_PHASES = new Set(["preparing", "turn_boundary", "restore_prompt", "compliance_prompt", "compact_uncertain", "done", "ended"]);
285
295
  const RECORD_DELIVERIES = new Set(["pending", "not_sent", "delivered", "uncertain"]);
286
296
  /** A record only in the shape this daemon writes. Any other (a newer daemon's after a rollback, a damaged file) is ignored,
@@ -297,6 +307,12 @@ function readCompactionRecord(file) {
297
307
  && text(r.mapPath) && text(r.marker) && text(r.compactInstruction) && textOrNull(r.preparationRoot) && Number.isFinite(r.updatedAt)
298
308
  && (r.operatorInitiated === undefined || typeof r.operatorInitiated === "boolean") && (r.compactSending === undefined || r.compactSending === true)
299
309
  && (r.uncertainCompact === undefined || r.uncertainCompact === true)
310
+ && (r.prepared === undefined || r.prepared === true) && (r.preparedAt === undefined || Number.isFinite(r.preparedAt))
311
+ && (r.preparedReason === undefined || text(r.preparedReason)) && (r.belowSince === undefined || Number.isFinite(r.belowSince))
312
+ && (r.mapReadyAt === undefined || Number.isFinite(r.mapReadyAt)) && (r.mapUsedPercentage === undefined || Number.isFinite(r.mapUsedPercentage))
313
+ && (r.sessionId === undefined || text(r.sessionId)) && (r.endedAt === undefined || Number.isFinite(r.endedAt))
314
+ && (r.afterEnded === undefined || Number.isFinite(r.afterEnded))
315
+ && (r.afterEndedSessionId === undefined || textOrNull(r.afterEndedSessionId))
300
316
  && (carry === undefined || (typeof carry === "object" && carry !== null && textOrNull(carry.mapPath) && textOrNull(carry.compactInstruction)
301
317
  && (carry.skipMap === undefined || (text(carry.skipMap?.mapPath) && text(carry.skipMap?.marker)))));
302
318
  return valid ? r : null;
@@ -330,6 +346,9 @@ export class ClaudeCompactionEnforcer {
330
346
  postCompactRestoreCooldownUntil = new Map();
331
347
  triggeredAboveThreshold = new Set();
332
348
  pendingPreCompactPrep = new Map();
349
+ /** The seat's last attempt that ended with its request delivered (or possibly delivered) and no /compact (#2682): a fresh
350
+ * automatic preparation for the same occupant and conversation waits for an idle seat. Kept across a restart by the record. */
351
+ lastEnded = new Map();
333
352
  pendingPostCompactRestore = new Map();
334
353
  // OPR.0.4.3.14 — per-seat manual-trigger surfaced state (AC-3). In-memory,
335
354
  // non-persisted (a daemon restart reset is the safe-failure direction).
@@ -368,7 +387,8 @@ export class ClaudeCompactionEnforcer {
368
387
  this.now = opts?.now ?? (() => Date.now());
369
388
  this.sleep = opts?.sleep ?? (ms => new Promise(resolve => setTimeout(resolve, ms)));
370
389
  this.postCompactSendWaitMs = opts?.postCompactSendWaitMs ?? POST_COMPACT_SEND_WAIT_MS_DEFAULT;
371
- this.compactSendIdleWaitMs = opts?.compactSendIdleWaitMs ?? 1000;
390
+ // A fresh preparation hook can veto even a visibly idle pane for the full send-readiness window.
391
+ this.compactSendIdleWaitMs = opts?.compactSendIdleWaitMs ?? SEND_READINESS_FRESHNESS_MS;
372
392
  this.restartRecoveryWindowMs = opts?.restartRecoveryWindowMs ?? RESTART_RECOVERY_WINDOW_MS_DEFAULT;
373
393
  this.daemonInstance = opts?.daemonInstance ?? DAEMON_PROCESS_ID;
374
394
  this.resolveOccupantGeneration = opts?.resolveOccupantGeneration;
@@ -381,8 +401,69 @@ export class ClaudeCompactionEnforcer {
381
401
  */
382
402
  async maybeAutoCompact(input) {
383
403
  this.reconcilePreparations();
404
+ const gated = await this.endedAttemptGate(input);
405
+ if (gated)
406
+ return gated;
384
407
  return this.withDeliveryGuard(input, () => this.maybeAutoCompactUnchecked(input));
385
408
  }
409
+ liveGeneration(session) {
410
+ return this.resolveOccupantGeneration?.(session) ?? this.sessionTransport.deliveryGuard?.maybeTarget(session)?.occupant ?? null;
411
+ }
412
+ /** #2682: before a fresh automatic preparation after an attempt that ended with its request delivered, for the same
413
+ * occupant and conversation, the seat must read idle. Runs outside the delivery lease, as the manual path's idle wait. */
414
+ async endedAttemptGate(input) {
415
+ const session = input.sessionName;
416
+ if (input.runtime !== "claude-code" || input.usedPercentage == null)
417
+ return null;
418
+ this.recoverSeat(input);
419
+ const ended = this.lastEnded.get(session);
420
+ if (!ended)
421
+ return null;
422
+ const live = this.liveGeneration(session);
423
+ // A generation that reads unknown for a moment is not another occupant: the ended attempt is kept (below).
424
+ if (ended.occupantGeneration === null || (live !== null && live !== ended.occupantGeneration)
425
+ || (ended.sessionId && input.sessionId && ended.sessionId !== input.sessionId)
426
+ || this.now() - ended.endedAt >= this.restartRecoveryWindowMs) {
427
+ this.lastEnded.delete(session);
428
+ return null;
429
+ }
430
+ let policy;
431
+ try {
432
+ policy = this.settingsStore.resolveClaudeCompactionPolicy();
433
+ }
434
+ catch {
435
+ return null;
436
+ }
437
+ if (!policy.enabled || !isValidThresholdPercent(policy.thresholdPercent) || input.usedPercentage < policy.thresholdPercent)
438
+ return null;
439
+ if (this.pendingPostCompactRestore.has(session))
440
+ return null;
441
+ const attempt = this.pendingPreCompactPrep.get(session);
442
+ // The replacement whose request hasn't gone out yet (a busy send refused it) stays behind the gate.
443
+ const unsentReplacement = attempt?.mode === "automatic" && attempt.status === "sending" && attempt.afterEnded !== undefined;
444
+ if (attempt && !unsentReplacement && (attempt.status !== "stopped" || attempt.cancelled || attempt.compact !== "not_sent"))
445
+ return null;
446
+ // The stopped attempt's cooldown holds after a restart too.
447
+ if (this.now() - ended.endedAt < this.autoRetryAfterStopMs)
448
+ return { triggered: false, reason: "preparation_stopped" };
449
+ // With no occupant to name, no attempt could begin (it would stop as occupant_generation_unavailable and drop this one).
450
+ if (live === null)
451
+ return { triggered: false, reason: "occupant_generation_unavailable" };
452
+ // One readiness read, with no wait after it: this runs inside the monitor's serial poll, so a busy seat must not hold
453
+ // the other seats' polls. A busy seat, or a read that fails, waits for a later poll.
454
+ let idle;
455
+ try {
456
+ idle = await this.sessionTransport.waitUntilIdle(session, CAPTURE_READABLE_BUDGET_MS, undefined, { singleObservation: true });
457
+ }
458
+ catch {
459
+ idle = { ok: false };
460
+ }
461
+ if (!idle.ok)
462
+ return { triggered: false, reason: "waiting_for_idle" };
463
+ // The gate is used up only when the replacement request goes out (deliverPreparation), and that send checks idle
464
+ // again: an observation refused as stale, or a peer's turn starting before the send, keeps it.
465
+ return null;
466
+ }
386
467
  /**
387
468
  * What this enforcer has recorded about a managed compaction of `sessionName`, for a sender's context, or null when
388
469
  * none is under way. Read-only: it reports the enforcer's own state (the preparation attempt and the post-compact
@@ -421,6 +502,11 @@ export class ClaudeCompactionEnforcer {
421
502
  this.recoverSeat({ sessionName, ...seat });
422
503
  return this.pendingPostCompactRestore.has(sessionName);
423
504
  }
505
+ /** #2661 (c): since when (epoch ms) a post-compact stage has been owed to this seat — the /compact this daemon sent,
506
+ * or this daemon's recovery of one recorded before a restart (a lower bound then) — or null when none is owed. */
507
+ postCompactStageOwedSince(sessionName) {
508
+ return this.pendingPostCompactRestore.has(sessionName) ? this.lastAutoCompactAt.get(sessionName) ?? null : null;
509
+ }
424
510
  /** The first time this daemon reaches a seat (a poll, a manual request, a state read): pick up its record from before a
425
511
  * restart, with the policy's preparation root (`recoverAfterRestart`). */
426
512
  recoverSeat(seat) {
@@ -488,20 +574,51 @@ export class ClaudeCompactionEnforcer {
488
574
  return (await this.drainPendingStage(unsampled, policy)) ?? { triggered: false, reason: "no_pending_stage" };
489
575
  });
490
576
  }
491
- /** Finish only an already-armed automatic map when usage has gone stale; never request another preparation. */
577
+ /** Finish only an already-armed automatic map when usage has gone stale; never request another preparation.
578
+ * `lastUsedPercentage` and `sessionId` are the seat's newest sample, however old: a map whose context has since dropped
579
+ * below the threshold, or whose conversation changed (Claude Code's own compaction, a person's /compact or /clear, also
580
+ * while the daemon was down), never compacts (#2682). */
492
581
  async drainPendingPreparedCompact(input) {
493
- const unsampled = { ...input, usedPercentage: null };
582
+ const { lastUsedPercentage, ...rest } = input;
583
+ const unsampled = { ...rest, usedPercentage: null };
494
584
  this.recoverSeat(input);
495
585
  this.reconcilePreparations();
496
586
  const attempt = this.pendingPreCompactPrep.get(input.sessionName);
497
587
  if (input.runtime !== "claude-code" || attempt?.mode !== "automatic" || attempt.status !== "waiting"
498
- || attempt.delivery === "pending" || !this.mapReady(attempt))
588
+ || attempt.delivery === "pending")
499
589
  return { triggered: false, reason: "no_pending_stage" };
500
- if (!isValidThresholdPercent(this.settingsStore.resolveClaudeCompactionPolicy().thresholdPercent))
590
+ const threshold = this.settingsStore.resolveClaudeCompactionPolicy().thresholdPercent;
591
+ if (!isValidThresholdPercent(threshold))
501
592
  return { triggered: false, reason: "invalid_policy" };
593
+ const otherConversation = !!attempt.sessionId && !!input.sessionId && attempt.sessionId !== input.sessionId;
594
+ // Another conversation, known on both sides, ends an armed or held map, as on the fresh path, also one whose map isn't
595
+ // complete yet: a later sample whose conversation reads unknown must not compact with it.
596
+ if (otherConversation && !attempt.compactInFlight) {
597
+ this.stopPreparation(input.sessionName, "below_threshold_while_prepared", attempt);
598
+ return { triggered: false, reason: "preparation_stopped" };
599
+ }
600
+ if (!this.mapReady(attempt))
601
+ return { triggered: false, reason: "no_pending_stage" };
602
+ const dropped = lastUsedPercentage != null && lastUsedPercentage < threshold;
603
+ if (dropped && !attempt.compactInFlight) {
604
+ // A held map ends, as on a fresh dip. An attempt not held keeps its deadline (and a later fresh sample above may
605
+ // still use its map), but a stale sample never compacts it.
606
+ if (attempt.prepared) {
607
+ this.stopPreparation(input.sessionName, "below_threshold_while_prepared", attempt);
608
+ return { triggered: false, reason: "preparation_stopped" };
609
+ }
610
+ return { triggered: false, reason: "below_threshold" };
611
+ }
612
+ // The same growth rule as on a fresh sample: a stale sample (a restart, a slow sidecar) that usage has carried
613
+ // PREPARED_MAP_MAX_GROWTH_PERCENT above the map retires it instead of compacting with it.
614
+ if (attempt.prepared && !attempt.compactInFlight && lastUsedPercentage != null && attempt.mapUsedPercentage !== undefined
615
+ && lastUsedPercentage - attempt.mapUsedPercentage >= PREPARED_MAP_MAX_GROWTH_PERCENT) {
616
+ this.stopPreparation(input.sessionName, "prepared_map_stale", attempt);
617
+ return { triggered: false, reason: "preparation_stopped" };
618
+ }
502
619
  return this.withDeliveryGuard(unsampled, async () => {
503
620
  const result = await this.sendPreparedCompact(unsampled, attempt, false);
504
- return result.ok ? { triggered: true } : { triggered: false, reason: result.reason === "waiting_for_idle" ? "waiting_for_idle" : "send_failed" };
621
+ return result.ok ? { triggered: true } : { triggered: false, reason: result.reason === "waiting_for_idle" || result.reason === PREPARED_AWAITING_WINDOW ? result.reason : "send_failed" };
505
622
  });
506
623
  }
507
624
  terminalPolicyReason(input, actor) {
@@ -766,6 +883,31 @@ export class ClaudeCompactionEnforcer {
766
883
  const drained = await this.drainPendingStage(input, policy);
767
884
  if (drained)
768
885
  return drained;
886
+ // Another conversation, proved by both sample and attempt naming theirs, ends an armed or held automatic attempt, on a
887
+ // low sample as on a high one, as in the stale-sample drain: the map is of a context that is gone, and a later sample
888
+ // whose conversation reads unknown must not compact with it.
889
+ // A conversation that reads unknown on either side is not a mismatch.
890
+ const armed = this.pendingPreCompactPrep.get(input.sessionName);
891
+ // A request that never went out was made in no conversation: the attempt takes the sample's, and only a request
892
+ // delivered (or possibly delivered) in another conversation stops it.
893
+ if (armed?.mode === "automatic" && armed.status === "sending" && armed.delivery === "not_sent"
894
+ && !!input.sessionId && armed.sessionId !== input.sessionId) {
895
+ // A replacement moving to another conversation drops the gate it was replacing only when that gate fell in memory on
896
+ // this same sample (endedAttemptGate ran first), so a restart must not bring it back for the new conversation. An
897
+ // ended attempt whose conversation read unknown keeps its gate, and so does the replacement.
898
+ const dropGate = armed.afterEnded !== undefined && !this.lastEnded.has(input.sessionName);
899
+ if (dropGate) {
900
+ armed.afterEnded = undefined;
901
+ armed.afterEndedSessionId = undefined;
902
+ }
903
+ armed.sessionId = input.sessionId;
904
+ this.persist(input.sessionName, armed.attemptId, { sessionId: input.sessionId, ...(dropGate ? { afterEnded: undefined, afterEndedSessionId: undefined } : {}) });
905
+ }
906
+ if (armed?.mode === "automatic" && armed.status === "waiting" && armed.compact === "not_sent" && !armed.compactInFlight
907
+ && !!armed.sessionId && !!input.sessionId && armed.sessionId !== input.sessionId) {
908
+ this.stopPreparation(input.sessionName, "below_threshold_while_prepared", armed);
909
+ return { triggered: false, reason: "preparation_stopped" };
910
+ }
769
911
  if (input.usedPercentage < policy.thresholdPercent) {
770
912
  this.triggeredAboveThreshold.delete(input.sessionName);
771
913
  const preparation = this.pendingPreCompactPrep.get(input.sessionName);
@@ -773,8 +915,20 @@ export class ClaudeCompactionEnforcer {
773
915
  this.pendingPreCompactPrep.delete(input.sessionName);
774
916
  // A usage dip is not cancellation: retain an unfinished attempt and its
775
917
  // deadline so a later high sample can use its map without another prep.
918
+ // A held attempt ends on a fresh sample below the threshold (#2682): the context already dropped, by Claude Code's own
919
+ // compaction or a person's /compact or /clear, so its map would restore a context that is gone. On any other armed
920
+ // automatic attempt the dip is recorded, and such an attempt is never held later: it stops at its deadline as before.
921
+ if (preparation?.prepared && preparation.status === "waiting" && !preparation.compactInFlight) {
922
+ this.stopPreparation(input.sessionName, "below_threshold_while_prepared", preparation);
923
+ }
924
+ else if (preparation?.mode === "automatic" && preparation.status === "waiting" && preparation.compact === "not_sent"
925
+ && preparation.belowSince === undefined) {
926
+ preparation.belowSince = this.now();
927
+ this.persist(input.sessionName, preparation.attemptId, { belowSince: preparation.belowSince });
928
+ }
776
929
  return { triggered: false, reason: "below_threshold" };
777
930
  }
931
+ // A climb back above the threshold keeps the dip's mark (belowSince): the attempt that dipped is never held (#2682).
778
932
  // No new automatic compaction while disabled. An already-owed stage above uses
779
933
  // drainPendingStage's existing operator-initiated manual exemption.
780
934
  if (!policy.enabled) {
@@ -836,9 +990,15 @@ export class ClaudeCompactionEnforcer {
836
990
  }
837
991
  if (attempt.delivery === "pending" || !this.mapReady(attempt))
838
992
  return { triggered: false, reason: "preparation_pending" };
993
+ // A held map that usage has outgrown retires; the next idle window prepares afresh (#2682).
994
+ if (attempt.prepared && attempt.mapUsedPercentage !== undefined
995
+ && input.usedPercentage - attempt.mapUsedPercentage >= PREPARED_MAP_MAX_GROWTH_PERCENT) {
996
+ this.stopPreparation(input.sessionName, "prepared_map_stale", attempt);
997
+ return { triggered: false, reason: "preparation_stopped" };
998
+ }
839
999
  const compact = await this.sendPreparedCompact(input, attempt, false);
840
1000
  if (!compact.ok)
841
- return { triggered: false, reason: compact.reason === "waiting_for_idle" ? "waiting_for_idle" : "send_failed" };
1001
+ return { triggered: false, reason: compact.reason === "waiting_for_idle" || compact.reason === PREPARED_AWAITING_WINDOW ? compact.reason : "send_failed" };
842
1002
  return { triggered: true };
843
1003
  }
844
1004
  /**
@@ -971,6 +1131,17 @@ export class ClaudeCompactionEnforcer {
971
1131
  const stranded = this.stranded.get(input.sessionName);
972
1132
  if (stranded)
973
1133
  attempt.supersedes = strandedSummary(stranded);
1134
+ if (input.sessionId)
1135
+ attempt.sessionId = input.sessionId;
1136
+ // A manual compaction is explicit and replaces the ended attempt at once. An automatic one keeps the gate until its
1137
+ // request goes out (deliverPreparation).
1138
+ if (mode === "manual")
1139
+ this.lastEnded.delete(input.sessionName);
1140
+ else if (this.lastEnded.has(input.sessionName)) {
1141
+ const ended = this.lastEnded.get(input.sessionName);
1142
+ attempt.afterEnded = ended.endedAt;
1143
+ attempt.afterEndedSessionId = ended.sessionId;
1144
+ }
974
1145
  this.pendingPreCompactPrep.set(input.sessionName, attempt);
975
1146
  this.stranded.delete(input.sessionName);
976
1147
  // A map cannot satisfy an unknown occupant. Keep the failed attempt visible and
@@ -1044,8 +1215,10 @@ export class ClaudeCompactionEnforcer {
1044
1215
  }
1045
1216
  };
1046
1217
  // Preserve maps already published by agents using the older protocol.
1047
- if (complete(attempt.mapPath))
1218
+ if (complete(attempt.mapPath)) {
1219
+ this.noteMapReady(attempt);
1048
1220
  return true;
1221
+ }
1049
1222
  const temporary = attempt.mapPath + ".tmp";
1050
1223
  if (!complete(temporary))
1051
1224
  return false;
@@ -1059,8 +1232,19 @@ export class ClaudeCompactionEnforcer {
1059
1232
  return false;
1060
1233
  }
1061
1234
  }
1235
+ this.noteMapReady(attempt);
1062
1236
  return true;
1063
1237
  }
1238
+ /** The first time an attempt's map is seen ready, on any path (#2682): a held map's age counts from here. */
1239
+ noteMapReady(attempt) {
1240
+ if (attempt.mapReadyAt !== undefined)
1241
+ return;
1242
+ attempt.mapReadyAt = this.now();
1243
+ for (const [session, current] of this.pendingPreCompactPrep) {
1244
+ if (current === attempt)
1245
+ this.persist(session, attempt.attemptId, { mapReadyAt: attempt.mapReadyAt });
1246
+ }
1247
+ }
1064
1248
  async deliverPreparation(input, attempt) {
1065
1249
  if (attempt.sends >= PREP_SEND_ATTEMPTS_MAX) {
1066
1250
  this.stopPreparation(input.sessionName, "send_failed");
@@ -1070,6 +1254,9 @@ export class ClaudeCompactionEnforcer {
1070
1254
  // Mark waiting BEFORE the await: concurrent polls cannot replay an in-flight delivery.
1071
1255
  attempt.status = "waiting";
1072
1256
  const policy = this.settingsStore.resolveClaudeCompactionPolicy();
1257
+ // After an ended attempt, the replacement request goes only to a seat the send itself reads idle (a live pane read),
1258
+ // within the /compact send's short wait, so a turn that began after the gate's idle read gets no request (#2682).
1259
+ const idleGate = attempt.afterEnded !== undefined ? { waitForIdleMs: this.compactSendIdleWaitMs + CAPTURE_READABLE_BUDGET_MS, readinessFromPaneOnly: true } : {};
1073
1260
  let prep;
1074
1261
  let marked = false;
1075
1262
  try {
@@ -1078,7 +1265,7 @@ export class ClaudeCompactionEnforcer {
1078
1265
  overflowCompactInstruction: composed.instructionInCommand ? null : attempt.compactInstruction,
1079
1266
  usedPercentage: input.usedPercentage, thresholdPercent: policy.thresholdPercent,
1080
1267
  preCompactInstruction: policy.preCompactInstruction, preparation: attempt, constructedAt: this.now(),
1081
- }), { openrigNotice: true, preserveInput: true, beforeWrite: () => {
1268
+ }), { openrigNotice: true, preserveInput: true, ...idleGate, beforeWrite: () => {
1082
1269
  this.reconcilePreparations();
1083
1270
  if (this.pendingPreCompactPrep.get(input.sessionName) !== attempt || attempt.controller.signal.aborted || attempt.status === "stopped")
1084
1271
  throw new DeliveryGuardError("preparation_stopped", "This compaction attempt ended before preparation input.");
@@ -1109,6 +1296,9 @@ export class ClaudeCompactionEnforcer {
1109
1296
  // Neither a failed response nor its loss proves no paste/Enter. Never replay uncertainty.
1110
1297
  attempt.delivery = prep?.ok && prep.outcome !== "retained" ? "delivered" : notSent ? "not_sent" : "uncertain";
1111
1298
  this.persist(input.sessionName, attempt.attemptId, { delivery: attempt.delivery, sends: attempt.sends });
1299
+ // The replacement request went out (or may have): the ended attempt's gate is used up.
1300
+ if (!notSent && attempt.afterEnded !== undefined && this.pendingPreCompactPrep.get(input.sessionName) === attempt)
1301
+ this.lastEnded.delete(input.sessionName);
1112
1302
  if (this.pendingPreCompactPrep.get(input.sessionName) !== attempt || attempt.controller.signal.aborted)
1113
1303
  return;
1114
1304
  if (notSent) {
@@ -1119,7 +1309,10 @@ export class ClaudeCompactionEnforcer {
1119
1309
  }
1120
1310
  if (attempt.mode === "automatic")
1121
1311
  attempt.deadlineAt = this.now() + AUTO_PREP_WAIT_MS_DEFAULT;
1122
- this.persist(input.sessionName, attempt.attemptId, { deadlineAt: attempt.deadlineAt });
1312
+ // The usage the map is written at: a held map retires once usage has outgrown it (#2682).
1313
+ if (input.usedPercentage != null)
1314
+ attempt.mapUsedPercentage = input.usedPercentage;
1315
+ this.persist(input.sessionName, attempt.attemptId, { deadlineAt: attempt.deadlineAt, mapUsedPercentage: attempt.mapUsedPercentage });
1123
1316
  this.reconcilePreparations();
1124
1317
  }
1125
1318
  async sendPreparedCompact(input, attempt, skipMap) {
@@ -1147,15 +1340,18 @@ export class ClaudeCompactionEnforcer {
1147
1340
  check();
1148
1341
  if (!marked) {
1149
1342
  marked = true;
1343
+ attempt.compactInFlight = true;
1150
1344
  this.persist(input.sessionName, attempt.attemptId, { compactSending: true, restoreCarry: carry, operatorInitiated });
1151
1345
  }
1152
1346
  };
1153
1347
  const send = async () => {
1154
1348
  check();
1155
1349
  // Both paths send only to an idle seat. Include the readable observation's budget in the wait,
1156
- // still bounded by the attempt's existing deadline.
1350
+ // still bounded by the attempt's existing deadline, except for a held attempt: its deadline has no effect
1351
+ // any more, and a capped wait would discard every idle read that ends after it, so the window would never open.
1157
1352
  // Idle comes from a live pane read: the newest hook can predate the rest of the preparation turn.
1158
- return this.sessionTransport.send(input.sessionName, composed.command, { openrigNotice: true, preserveInput: true, beforeWrite, ...(attempt.deadlineAt !== null ? { waitForIdleMs: Math.max(1, Math.min(this.compactSendIdleWaitMs + CAPTURE_READABLE_BUDGET_MS, this.compactDeadline(attempt) - this.now())), readinessFromPaneOnly: true } : {}) });
1353
+ const idleWait = this.compactSendIdleWaitMs + CAPTURE_READABLE_BUDGET_MS;
1354
+ return this.sessionTransport.send(input.sessionName, composed.command, { openrigNotice: true, preserveInput: true, beforeWrite, ...(attempt.deadlineAt !== null ? { waitForIdleMs: attempt.prepared ? idleWait : Math.max(1, Math.min(idleWait, this.compactDeadline(attempt) - this.now())), readinessFromPaneOnly: true } : {}) });
1159
1355
  };
1160
1356
  let result;
1161
1357
  let guardRefused = false;
@@ -1171,6 +1367,9 @@ export class ClaudeCompactionEnforcer {
1171
1367
  result = { ok: false, reason: error instanceof DeliveryGuardError ? error.code : "delivery_uncertain",
1172
1368
  ...(written ? { sent: true, inputPhase: "written" } : attempted ? { inputPhase: "attempted" } : {}) };
1173
1369
  }
1370
+ finally {
1371
+ delete attempt.compactInFlight;
1372
+ }
1174
1373
  if (!result.ok || result.outcome === "retained") {
1175
1374
  const phase = result.inputPhase;
1176
1375
  // A write that was issued, or text already in the input, is never "nothing sent".
@@ -1180,6 +1379,11 @@ export class ClaudeCompactionEnforcer {
1180
1379
  const notSent = !writeAttempted && (guardRefused || result.outcome === "retained" || result.sent === false);
1181
1380
  if (notSent && marked)
1182
1381
  this.persist(input.sessionName, attempt.attemptId, { compactSending: undefined });
1382
+ // A completed map whose /compact was refused before any input, for a window that isn't open yet, is held with the
1383
+ // same map instead of stopped and asked for again after the retry cooldown (#2682).
1384
+ if (notSent && typeof result.reason === "string" && HOLD_REASONS.has(result.reason) && this.holdPrepared(input.sessionName, attempt, result.reason)) {
1385
+ return { ok: false, reason: PREPARED_AWAITING_WINDOW };
1386
+ }
1183
1387
  // Only a known pre-input idle deferral keeps the automatic attempt armed for a later poll; the transport
1184
1388
  // marks those `not_reached`. Reconciliation still bounds the idle grace and stops on an occupant change.
1185
1389
  // A typing-guard draft hold (`draft_*`) is `not_reached` too, but it is a refusal, not an idle wait: it stops
@@ -1229,6 +1433,7 @@ export class ClaudeCompactionEnforcer {
1229
1433
  this.restoreCarry.delete(sessionName);
1230
1434
  this.lastAutoCompactAt.set(sessionName, this.now());
1231
1435
  this.triggeredAboveThreshold.add(sessionName);
1436
+ this.lastEnded.delete(sessionName);
1232
1437
  this.pendingPostCompactRestore.set(sessionName, "turn_boundary");
1233
1438
  this.pendingStageGeneration.set(sessionName, attempt.occupantGeneration);
1234
1439
  }
@@ -1270,20 +1475,49 @@ export class ClaudeCompactionEnforcer {
1270
1475
  this.stopPreparation(session, "stale_generation");
1271
1476
  else if (!enabled && (attempt.mode === "automatic" || attempt.policyWasEnabled))
1272
1477
  this.stopPreparation(session, "disabled");
1273
- else if (attempt.deadlineAt !== null && this.now() >= this.compactDeadline(attempt)) {
1274
- this.stopPreparation(session, this.mapReady(attempt) ? "map_complete_seat_never_idle" : "preparation_incomplete");
1478
+ // A held map that stopped reading ready (its file or marker gone) stops the attempt (#2682).
1479
+ else if (attempt.prepared && !attempt.compactInFlight && !this.mapReady(attempt))
1480
+ this.stopPreparation(session, "preparation_incomplete");
1481
+ // A held map retires after a long while; a /compact already being written is never stopped (#2682).
1482
+ else if (attempt.prepared && !attempt.compactInFlight && this.now() - (attempt.mapReadyAt ?? attempt.preparedAt ?? this.now()) >= PREPARED_MAP_MAX_AGE_MS) {
1483
+ this.stopPreparation(session, "prepared_map_stale");
1484
+ }
1485
+ // A held attempt's deadline has no effect: it ends only as above, on a fresh dip, a stale map or a cancel (#2682).
1486
+ else if (!attempt.prepared && attempt.deadlineAt !== null && this.now() >= this.compactDeadline(attempt)) {
1487
+ const ready = this.mapReady(attempt);
1488
+ if (!(ready && this.holdPrepared(session, attempt, "map_complete_seat_never_idle"))) {
1489
+ this.stopPreparation(session, ready ? "map_complete_seat_never_idle" : "preparation_incomplete");
1490
+ }
1275
1491
  }
1276
1492
  if (enabled)
1277
1493
  attempt.policyWasEnabled = true;
1278
1494
  }
1279
1495
  }
1496
+ /** Hold an automatic attempt whose map is complete until a window opens, instead of stopping it (#2682). Only the
1497
+ * attempt that is current, armed and untouched: never one cancelled, stopped, manual, or with a /compact sent or in
1498
+ * flight. It keeps its controller, map and deadline, and is persisted only on the transition. */
1499
+ holdPrepared(session, attempt, reason) {
1500
+ if (attempt.mode !== "automatic" || attempt.status !== "waiting" || attempt.compact !== "not_sent" || attempt.compactInFlight
1501
+ || attempt.controller.signal.aborted || attempt.cancelled || attempt.reason !== undefined || attempt.belowSince !== undefined
1502
+ || this.pendingPreCompactPrep.get(session) !== attempt || !this.mapReady(attempt))
1503
+ return false;
1504
+ if (!attempt.prepared) {
1505
+ attempt.prepared = true;
1506
+ attempt.preparedAt = this.now();
1507
+ attempt.preparedReason = reason;
1508
+ this.persist(session, attempt.attemptId, { prepared: true, preparedAt: attempt.preparedAt, preparedReason: reason });
1509
+ }
1510
+ return true;
1511
+ }
1280
1512
  /** Start the record for a new attempt, beside its map. */
1281
1513
  startRecord(sessionName, attempt) {
1282
1514
  this.records.set(sessionName, { file: path.join(path.dirname(attempt.mapPath), COMPACTION_RECORD_FILE), record: {
1283
1515
  daemon: this.daemonInstance, attemptId: attempt.attemptId, session: sessionName, occupantGeneration: attempt.occupantGeneration, mode: attempt.mode,
1284
1516
  phase: "preparing", delivery: attempt.delivery, deadlineAt: attempt.deadlineAt, sends: attempt.sends,
1285
1517
  mapPath: attempt.mapPath, marker: attempt.marker, compactInstruction: attempt.compactInstruction,
1286
- preparationRoot: attempt.preparationRoot, updatedAt: this.now(),
1518
+ preparationRoot: attempt.preparationRoot, ...(attempt.sessionId ? { sessionId: attempt.sessionId } : {}),
1519
+ ...(attempt.afterEnded !== undefined ? { afterEnded: attempt.afterEnded, afterEndedSessionId: attempt.afterEndedSessionId ?? null } : {}),
1520
+ updatedAt: this.now(),
1287
1521
  } });
1288
1522
  this.persist(sessionName, attempt.attemptId, {});
1289
1523
  }
@@ -1362,9 +1596,30 @@ export class ClaudeCompactionEnforcer {
1362
1596
  return;
1363
1597
  const { record } = newest;
1364
1598
  // This process's own record (another enforcer in it) is live state, not a predecessor's.
1365
- if (record.daemon === this.daemonInstance || record.phase === "done" || record.phase === "ended")
1599
+ if (record.daemon === this.daemonInstance || record.phase === "done")
1366
1600
  return;
1367
1601
  const live = this.resolveOccupantGeneration?.(session) ?? this.sessionTransport.deliveryGuard?.maybeTarget(session)?.occupant ?? null;
1602
+ if (record.phase === "ended") {
1603
+ // An ended automatic attempt of this occupant whose request was delivered and whose /compact was never sent keeps a
1604
+ // busy seat from a fresh request (#2682), as in memory. Only a stop writes endedAt; a /compact that was sent (and then
1605
+ // cancelled) never stopped, and one whose result was lost is marked uncertainCompact.
1606
+ const endedAt = record.endedAt;
1607
+ if (endedAt !== undefined && !record.uncertainCompact && !record.compactSending
1608
+ && record.mode === "automatic" && (record.delivery === "delivered" || record.delivery === "uncertain")
1609
+ // An occupant that reads unknown at this first look keeps the record, inert: the gate compares the generation once
1610
+ // it can be read, and a different occupant then discards it.
1611
+ && record.occupantGeneration !== null && (live === null || live === record.occupantGeneration)
1612
+ && this.now() - endedAt < this.restartRecoveryWindowMs)
1613
+ this.lastEnded.set(session, { endedAt, occupantGeneration: record.occupantGeneration, sessionId: record.sessionId ?? null });
1614
+ // A replacement that stopped with its request never sent keeps the gate of the attempt it replaced, as in memory and
1615
+ // as a replacement still preparing does below.
1616
+ else if (record.mode === "automatic" && record.afterEnded !== undefined && record.delivery === "not_sent"
1617
+ && record.occupantGeneration !== null && (live === null || live === record.occupantGeneration)
1618
+ && this.now() - record.afterEnded < this.restartRecoveryWindowMs) {
1619
+ this.lastEnded.set(session, { endedAt: record.afterEnded, occupantGeneration: record.occupantGeneration, sessionId: record.afterEndedSessionId ?? null });
1620
+ }
1621
+ return;
1622
+ }
1368
1623
  if (record.occupantGeneration !== null && live !== null && live !== record.occupantGeneration)
1369
1624
  return;
1370
1625
  const stale = this.now() - record.updatedAt > this.restartRecoveryWindowMs;
@@ -1373,8 +1628,13 @@ export class ClaudeCompactionEnforcer {
1373
1628
  const phase = (record.phase === "preparing" && record.compactSending) || record.phase === "compact_uncertain" ? "turn_boundary" : record.phase;
1374
1629
  const inFlight = phase !== record.phase;
1375
1630
  if (phase === "preparing") {
1376
- if (stale)
1377
- return; // Its preparation deadline passed long ago; a fresh attempt may begin.
1631
+ // Its preparation deadline passed long ago; a fresh attempt may begin. A held attempt of this same occupant has no
1632
+ // deadline that matters: it is picked up as it was, however old, and the reconcile below retires its map once it is
1633
+ // too old (#2682). One whose context dropped before it was held never comes back held.
1634
+ const held = record.prepared === true && record.mode === "automatic" && record.deadlineAt !== null && record.belowSince === undefined;
1635
+ const heldHere = held && record.occupantGeneration !== null && live === record.occupantGeneration;
1636
+ if (stale && !heldHere)
1637
+ return;
1378
1638
  this.records.set(session, newest);
1379
1639
  this.pendingPreCompactPrep.set(session, {
1380
1640
  policyActor: { source: "openrig" }, attemptId: record.attemptId, occupantGeneration: record.occupantGeneration,
@@ -1385,9 +1645,24 @@ export class ClaudeCompactionEnforcer {
1385
1645
  deadlineAt: record.deadlineAt ?? (record.delivery === "not_sent" ? null : record.updatedAt + AUTO_PREP_WAIT_MS_DEFAULT),
1386
1646
  policyWasEnabled: true, preparationRoot: record.preparationRoot, controller: new AbortController(),
1387
1647
  compactInstruction: record.compactInstruction,
1648
+ // A held attempt comes back held, with its recorded hold (never stamped again) and its map's age and usage.
1649
+ ...(held ? { prepared: true, preparedAt: record.preparedAt ?? record.updatedAt, preparedReason: record.preparedReason ?? "map_complete_seat_never_idle" } : {}),
1650
+ ...(held ? { mapReadyAt: record.mapReadyAt ?? record.preparedAt ?? record.updatedAt } : record.mapReadyAt !== undefined ? { mapReadyAt: record.mapReadyAt } : {}),
1651
+ ...(record.mapUsedPercentage !== undefined ? { mapUsedPercentage: record.mapUsedPercentage } : {}),
1652
+ ...(record.sessionId !== undefined ? { sessionId: record.sessionId } : {}),
1653
+ ...(record.mode === "automatic" && record.belowSince !== undefined ? { belowSince: record.belowSince } : {}),
1654
+ ...(record.mode === "automatic" && record.afterEnded !== undefined ? { afterEnded: record.afterEnded, afterEndedSessionId: record.afterEndedSessionId ?? null } : {}),
1388
1655
  });
1656
+ // A replacement whose request never went out keeps the ended attempt's gate, as in memory.
1657
+ if (record.mode === "automatic" && record.afterEnded !== undefined && record.delivery === "not_sent" && record.occupantGeneration !== null
1658
+ && this.now() - record.afterEnded < this.restartRecoveryWindowMs) {
1659
+ this.lastEnded.set(session, { endedAt: record.afterEnded, occupantGeneration: record.occupantGeneration, sessionId: record.afterEndedSessionId ?? null });
1660
+ }
1389
1661
  if (record.mode === "manual")
1390
1662
  this.stopPreparation(session, "daemon_restarted");
1663
+ // A held map of any age is checked at once, without waiting for a send's checks (#2682).
1664
+ else
1665
+ this.reconcilePreparations();
1391
1666
  return;
1392
1667
  }
1393
1668
  if (stale) {
@@ -1418,7 +1693,14 @@ export class ClaudeCompactionEnforcer {
1418
1693
  attempt.reason = reason;
1419
1694
  attempt.stoppedAt = this.now();
1420
1695
  attempt.controller.abort();
1421
- this.persist(session, attempt.attemptId, { phase: attempt.compact === "uncertain" ? "compact_uncertain" : "ended", reason });
1696
+ // A stopped attempt is no longer held (#2682).
1697
+ const wasPrepared = attempt.prepared === true;
1698
+ delete attempt.prepared;
1699
+ this.persist(session, attempt.attemptId, { phase: attempt.compact === "uncertain" ? "compact_uncertain" : "ended", reason, endedAt: attempt.stoppedAt,
1700
+ ...(wasPrepared ? { prepared: undefined } : {}) });
1701
+ if (attempt.mode === "automatic" && (attempt.delivery === "delivered" || attempt.delivery === "uncertain") && attempt.compact === "not_sent") {
1702
+ this.lastEnded.set(session, { endedAt: attempt.stoppedAt, occupantGeneration: attempt.occupantGeneration, sessionId: attempt.sessionId ?? null });
1703
+ }
1422
1704
  if (attempt.mode === "manual")
1423
1705
  this.setManualStage(session, "skipped-or-failed", reason);
1424
1706
  }
@@ -1456,8 +1738,9 @@ export class ClaudeCompactionEnforcer {
1456
1738
  const attempt = this.pendingPreCompactPrep.get(session);
1457
1739
  if (!attempt)
1458
1740
  return null;
1459
- const { controller: _controller, sends: _sends, policyWasEnabled: _enabled, preparationRoot: _preparationRoot, compactInstruction: _instruction, stoppedAt: _stoppedAt, cancelled: _cancelled, ...state } = attempt;
1460
- return { ...state, ...(attempt.mode === "automatic" && attempt.deadlineAt !== null && this.mapReady(attempt)
1741
+ const { controller: _controller, sends: _sends, policyWasEnabled: _enabled, preparationRoot: _preparationRoot, compactInstruction: _instruction, stoppedAt: _stoppedAt, cancelled: _cancelled, belowSince: _belowSince, compactInFlight: _inFlight, sessionId: _sessionId, afterEnded: _afterEnded, afterEndedSessionId: _afterEndedSessionId, ...state } = attempt;
1742
+ // A held attempt has no idle deadline left to show: it waits for its window.
1743
+ return { ...state, ...(attempt.mode === "automatic" && !attempt.prepared && attempt.deadlineAt !== null && this.mapReady(attempt)
1461
1744
  ? { idleDeadlineAt: this.compactDeadline(attempt) } : {}) };
1462
1745
  }
1463
1746
  /** OPR.0.4.3.14 — read the surfaced manual-trigger state for a seat (AC-3). */
@@ -1474,6 +1757,7 @@ export class ClaudeCompactionEnforcer {
1474
1757
  */
1475
1758
  invalidateOccupant(sessionName) {
1476
1759
  this.stopPreparation(sessionName, "stale_generation");
1760
+ this.lastEnded.delete(sessionName);
1477
1761
  this.persistStage(sessionName, "ended");
1478
1762
  this.records.delete(sessionName);
1479
1763
  this.stranded.delete(sessionName);