@openrig/cli 0.7.9 → 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 (793) 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/openshell/guest.py +3 -2
  7. package/daemon/assets/pi-account-lock.cjs +39 -0
  8. package/daemon/assets/plugins/openrig/.claude-plugin/marketplace.json +15 -0
  9. package/daemon/assets/plugins/openrig/.claude-plugin/plugin.json +32 -0
  10. package/daemon/assets/plugins/openrig/.codex-plugin/plugin.json +39 -0
  11. package/daemon/assets/plugins/openrig/.cursor-plugin/plugin.json +6 -0
  12. package/daemon/assets/plugins/openrig/LICENSE +200 -0
  13. package/daemon/assets/plugins/openrig/README.md +106 -0
  14. package/daemon/assets/plugins/openrig/assets/logo.svg +1 -0
  15. package/daemon/assets/plugins/openrig/mcp.json +10 -0
  16. package/daemon/assets/plugins/openrig/plugin.json +14 -0
  17. package/daemon/assets/plugins/openrig/skills/working-with-an-openrig-team/SKILL.md +90 -0
  18. package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +1 -1
  19. package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
  20. package/daemon/assets/plugins/openrig-core/hooks/claude.json +11 -0
  21. package/daemon/assets/plugins/openrig-core/hooks/scripts/activity-relay.cjs +39 -0
  22. package/daemon/assets/plugins/openrig-core/hooks/scripts/permission-stop-descriptor.cjs +221 -0
  23. package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus.cjs +16 -2
  24. package/daemon/assets/plugins/openrig-core/skills/openrig-skills/SKILL.md +1 -0
  25. package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +24 -8
  26. package/daemon/assets/plugins/openrig-core/skills/refocusing/SKILL.md +5 -0
  27. package/daemon/assets/plugins/openrig-core/skills/refocusing/scripts/trace-to-root.py +39 -4
  28. package/daemon/assets/skills/rigs/SKILL.md +10 -3
  29. package/daemon/context-packs/help/manifest.yaml +1 -1
  30. package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
  31. package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +122 -17
  32. package/daemon/context-packs/reference/acp-agents.md +176 -2
  33. package/daemon/context-packs/reference/getting-started.md +23 -4
  34. package/daemon/context-packs/reference/manifest.yaml +4 -1
  35. package/daemon/context-packs/reference/rig-spec.md +64 -7
  36. package/daemon/context-packs/reference/tmux-servers.md +214 -0
  37. package/daemon/context-packs/reference/whats-new.md +484 -76
  38. package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
  39. package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
  40. package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
  41. package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
  42. package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
  43. package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
  44. package/daemon/context-packs/skills/core/cross-host-rig-commands/SKILL.md +7 -0
  45. package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
  46. package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
  47. package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
  48. package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
  49. package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
  50. package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
  51. package/daemon/context-packs/skills/core/openrig-skills/SKILL.md +1 -0
  52. package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
  53. package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
  54. package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
  55. package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
  56. package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
  57. package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
  58. package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
  59. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
  60. package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
  61. package/daemon/context-packs/skills/core/working-with-an-openrig-team/SKILL.md +90 -0
  62. package/daemon/context-packs/skills/core/working-with-an-openrig-team/manifest.yaml +10 -0
  63. package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
  64. package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
  65. package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
  66. package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
  67. package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
  68. package/daemon/context-packs/skills/openrig-user/SKILL.md +24 -8
  69. package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
  70. package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
  71. package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
  72. package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
  73. package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
  74. package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
  75. package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
  76. package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
  77. package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
  78. package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
  79. package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
  80. package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
  81. package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
  82. package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
  83. package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
  84. package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
  85. package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
  86. package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
  87. package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
  88. package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
  89. package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
  90. package/daemon/context-packs/skills/refocusing/SKILL.md +5 -0
  91. package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
  92. package/daemon/context-packs/skills/refocusing/scripts/trace-to-root.py +39 -4
  93. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
  94. package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
  95. package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
  96. package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
  97. package/daemon/context-packs/world-example/manifest.yaml +1 -1
  98. package/daemon/context-packs/world-public/manifest.yaml +1 -1
  99. package/daemon/dist/adapters/claude-code-adapter.d.ts +3 -1
  100. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  101. package/daemon/dist/adapters/claude-code-adapter.js +53 -12
  102. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  103. package/daemon/dist/adapters/claude-resume.d.ts +1 -1
  104. package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
  105. package/daemon/dist/adapters/claude-resume.js +17 -3
  106. package/daemon/dist/adapters/claude-resume.js.map +1 -1
  107. package/daemon/dist/adapters/codex-resume.d.ts +3 -1
  108. package/daemon/dist/adapters/codex-resume.d.ts.map +1 -1
  109. package/daemon/dist/adapters/codex-resume.js +8 -4
  110. package/daemon/dist/adapters/codex-resume.js.map +1 -1
  111. package/daemon/dist/adapters/codex-runtime-adapter.d.ts +6 -0
  112. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  113. package/daemon/dist/adapters/codex-runtime-adapter.js +49 -19
  114. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  115. package/daemon/dist/adapters/kernel-authority.d.ts +2 -4
  116. package/daemon/dist/adapters/kernel-authority.d.ts.map +1 -1
  117. package/daemon/dist/adapters/kernel-authority.js +10 -41
  118. package/daemon/dist/adapters/kernel-authority.js.map +1 -1
  119. package/daemon/dist/adapters/openshell-podman-observer.d.ts.map +1 -1
  120. package/daemon/dist/adapters/openshell-podman-observer.js +25 -20
  121. package/daemon/dist/adapters/openshell-podman-observer.js.map +1 -1
  122. package/daemon/dist/adapters/pi-resume.d.ts +4 -1
  123. package/daemon/dist/adapters/pi-resume.d.ts.map +1 -1
  124. package/daemon/dist/adapters/pi-resume.js +38 -9
  125. package/daemon/dist/adapters/pi-resume.js.map +1 -1
  126. package/daemon/dist/adapters/pi-runner-protocol.d.ts +4 -0
  127. package/daemon/dist/adapters/pi-runner-protocol.d.ts.map +1 -1
  128. package/daemon/dist/adapters/pi-runner-protocol.js +7 -0
  129. package/daemon/dist/adapters/pi-runner-protocol.js.map +1 -1
  130. package/daemon/dist/adapters/pi-runner.d.ts +5 -0
  131. package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
  132. package/daemon/dist/adapters/pi-runner.js +79 -8
  133. package/daemon/dist/adapters/pi-runner.js.map +1 -1
  134. package/daemon/dist/adapters/pi-runtime-adapter.d.ts +6 -0
  135. package/daemon/dist/adapters/pi-runtime-adapter.d.ts.map +1 -1
  136. package/daemon/dist/adapters/pi-runtime-adapter.js +58 -23
  137. package/daemon/dist/adapters/pi-runtime-adapter.js.map +1 -1
  138. package/daemon/dist/adapters/tmux-control.d.ts +32 -1
  139. package/daemon/dist/adapters/tmux-control.d.ts.map +1 -1
  140. package/daemon/dist/adapters/tmux-control.js +149 -9
  141. package/daemon/dist/adapters/tmux-control.js.map +1 -1
  142. package/daemon/dist/adapters/tmux-server.d.ts +9 -0
  143. package/daemon/dist/adapters/tmux-server.d.ts.map +1 -1
  144. package/daemon/dist/adapters/tmux-server.js +12 -0
  145. package/daemon/dist/adapters/tmux-server.js.map +1 -1
  146. package/daemon/dist/adapters/tmux.d.ts +21 -1
  147. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  148. package/daemon/dist/adapters/tmux.js +184 -14
  149. package/daemon/dist/adapters/tmux.js.map +1 -1
  150. package/daemon/dist/build-info.js +3 -3
  151. package/daemon/dist/db/all-migrations.d.ts.map +1 -1
  152. package/daemon/dist/db/all-migrations.js +10 -0
  153. package/daemon/dist/db/all-migrations.js.map +1 -1
  154. package/daemon/dist/db/migrations/150_node_launch_wrapper.d.ts +3 -0
  155. package/daemon/dist/db/migrations/150_node_launch_wrapper.d.ts.map +1 -0
  156. package/daemon/dist/db/migrations/150_node_launch_wrapper.js +5 -0
  157. package/daemon/dist/db/migrations/150_node_launch_wrapper.js.map +1 -0
  158. package/daemon/dist/db/migrations/151_pi_account_switches.d.ts +4 -0
  159. package/daemon/dist/db/migrations/151_pi_account_switches.d.ts.map +1 -0
  160. package/daemon/dist/db/migrations/151_pi_account_switches.js +44 -0
  161. package/daemon/dist/db/migrations/151_pi_account_switches.js.map +1 -0
  162. package/daemon/dist/db/migrations/152_workflow_instance_spec.d.ts +8 -0
  163. package/daemon/dist/db/migrations/152_workflow_instance_spec.d.ts.map +1 -0
  164. package/daemon/dist/db/migrations/152_workflow_instance_spec.js +13 -0
  165. package/daemon/dist/db/migrations/152_workflow_instance_spec.js.map +1 -0
  166. package/daemon/dist/db/migrations/153_events_retention_marks.d.ts +7 -0
  167. package/daemon/dist/db/migrations/153_events_retention_marks.d.ts.map +1 -0
  168. package/daemon/dist/db/migrations/153_events_retention_marks.js +17 -0
  169. package/daemon/dist/db/migrations/153_events_retention_marks.js.map +1 -0
  170. package/daemon/dist/db/migrations/154_workflow_instance_root_objective.d.ts +7 -0
  171. package/daemon/dist/db/migrations/154_workflow_instance_root_objective.d.ts.map +1 -0
  172. package/daemon/dist/db/migrations/154_workflow_instance_root_objective.js +11 -0
  173. package/daemon/dist/db/migrations/154_workflow_instance_root_objective.js.map +1 -0
  174. package/daemon/dist/domain/activity-taxonomy.d.ts +9 -0
  175. package/daemon/dist/domain/activity-taxonomy.d.ts.map +1 -1
  176. package/daemon/dist/domain/activity-taxonomy.js.map +1 -1
  177. package/daemon/dist/domain/agent-activity-store.d.ts +14 -0
  178. package/daemon/dist/domain/agent-activity-store.d.ts.map +1 -1
  179. package/daemon/dist/domain/agent-activity-store.js +33 -0
  180. package/daemon/dist/domain/agent-activity-store.js.map +1 -1
  181. package/daemon/dist/domain/agent-manifest.d.ts.map +1 -1
  182. package/daemon/dist/domain/agent-manifest.js +47 -9
  183. package/daemon/dist/domain/agent-manifest.js.map +1 -1
  184. package/daemon/dist/domain/agent-resolver.d.ts +8 -0
  185. package/daemon/dist/domain/agent-resolver.d.ts.map +1 -1
  186. package/daemon/dist/domain/agent-resolver.js +6 -1
  187. package/daemon/dist/domain/agent-resolver.js.map +1 -1
  188. package/daemon/dist/domain/claude-compaction-enforcer.d.ts +55 -3
  189. package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
  190. package/daemon/dist/domain/claude-compaction-enforcer.js +339 -31
  191. package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
  192. package/daemon/dist/domain/claude-managed-launch.d.ts +2 -0
  193. package/daemon/dist/domain/claude-managed-launch.d.ts.map +1 -1
  194. package/daemon/dist/domain/claude-managed-launch.js +12 -2
  195. package/daemon/dist/domain/claude-managed-launch.js.map +1 -1
  196. package/daemon/dist/domain/compaction-restore-notice.d.ts +1 -1
  197. package/daemon/dist/domain/compaction-restore-notice.d.ts.map +1 -1
  198. package/daemon/dist/domain/compaction-restore-notice.js +2 -1
  199. package/daemon/dist/domain/compaction-restore-notice.js.map +1 -1
  200. package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
  201. package/daemon/dist/domain/context-monitor.js +3 -0
  202. package/daemon/dist/domain/context-monitor.js.map +1 -1
  203. package/daemon/dist/domain/context-usage-store.d.ts.map +1 -1
  204. package/daemon/dist/domain/context-usage-store.js +10 -1
  205. package/daemon/dist/domain/context-usage-store.js.map +1 -1
  206. package/daemon/dist/domain/desired-claude-activity-hooks.d.ts +4 -3
  207. package/daemon/dist/domain/desired-claude-activity-hooks.d.ts.map +1 -1
  208. package/daemon/dist/domain/desired-claude-activity-hooks.js +49 -15
  209. package/daemon/dist/domain/desired-claude-activity-hooks.js.map +1 -1
  210. package/daemon/dist/domain/draft-aware-delivery.d.ts.map +1 -1
  211. package/daemon/dist/domain/draft-aware-delivery.js +5 -1
  212. package/daemon/dist/domain/draft-aware-delivery.js.map +1 -1
  213. package/daemon/dist/domain/event-bus.d.ts +31 -0
  214. package/daemon/dist/domain/event-bus.d.ts.map +1 -1
  215. package/daemon/dist/domain/event-bus.js +88 -2
  216. package/daemon/dist/domain/event-bus.js.map +1 -1
  217. package/daemon/dist/domain/execution-view.d.ts +9 -0
  218. package/daemon/dist/domain/execution-view.d.ts.map +1 -1
  219. package/daemon/dist/domain/execution-view.js +91 -50
  220. package/daemon/dist/domain/execution-view.js.map +1 -1
  221. package/daemon/dist/domain/gateway/connections-projection.d.ts +13 -1
  222. package/daemon/dist/domain/gateway/connections-projection.d.ts.map +1 -1
  223. package/daemon/dist/domain/gateway/connections-projection.js +38 -10
  224. package/daemon/dist/domain/gateway/connections-projection.js.map +1 -1
  225. package/daemon/dist/domain/gateway/dispatcher.d.ts +2 -0
  226. package/daemon/dist/domain/gateway/dispatcher.d.ts.map +1 -1
  227. package/daemon/dist/domain/gateway/dispatcher.js +14 -1
  228. package/daemon/dist/domain/gateway/dispatcher.js.map +1 -1
  229. package/daemon/dist/domain/gateway/gateway-subsystem.d.ts +2 -0
  230. package/daemon/dist/domain/gateway/gateway-subsystem.d.ts.map +1 -1
  231. package/daemon/dist/domain/gateway/gateway-subsystem.js +1 -0
  232. package/daemon/dist/domain/gateway/gateway-subsystem.js.map +1 -1
  233. package/daemon/dist/domain/gateway/human-readiness.d.ts +7 -0
  234. package/daemon/dist/domain/gateway/human-readiness.d.ts.map +1 -1
  235. package/daemon/dist/domain/gateway/human-readiness.js +45 -0
  236. package/daemon/dist/domain/gateway/human-readiness.js.map +1 -1
  237. package/daemon/dist/domain/gateway/human-registry.d.ts +23 -3
  238. package/daemon/dist/domain/gateway/human-registry.d.ts.map +1 -1
  239. package/daemon/dist/domain/gateway/human-registry.js +66 -34
  240. package/daemon/dist/domain/gateway/human-registry.js.map +1 -1
  241. package/daemon/dist/domain/gateway/operator-delivery-engine.d.ts.map +1 -1
  242. package/daemon/dist/domain/gateway/operator-delivery-engine.js +8 -2
  243. package/daemon/dist/domain/gateway/operator-delivery-engine.js.map +1 -1
  244. package/daemon/dist/domain/gateway/relay-config.d.ts +80 -0
  245. package/daemon/dist/domain/gateway/relay-config.d.ts.map +1 -0
  246. package/daemon/dist/domain/gateway/relay-config.js +290 -0
  247. package/daemon/dist/domain/gateway/relay-config.js.map +1 -0
  248. package/daemon/dist/domain/gateway/relay-inbound.d.ts +74 -0
  249. package/daemon/dist/domain/gateway/relay-inbound.d.ts.map +1 -0
  250. package/daemon/dist/domain/gateway/relay-inbound.js +739 -0
  251. package/daemon/dist/domain/gateway/relay-inbound.js.map +1 -0
  252. package/daemon/dist/domain/gateway/relay-outbound.d.ts +215 -0
  253. package/daemon/dist/domain/gateway/relay-outbound.d.ts.map +1 -0
  254. package/daemon/dist/domain/gateway/relay-outbound.js +770 -0
  255. package/daemon/dist/domain/gateway/relay-outbound.js.map +1 -0
  256. package/daemon/dist/domain/gateway/slack/inbound.d.ts +4 -0
  257. package/daemon/dist/domain/gateway/slack/inbound.d.ts.map +1 -1
  258. package/daemon/dist/domain/gateway/slack/inbound.js +14 -2
  259. package/daemon/dist/domain/gateway/slack/inbound.js.map +1 -1
  260. package/daemon/dist/domain/gateway/slack/open-asks.d.ts.map +1 -1
  261. package/daemon/dist/domain/gateway/slack/open-asks.js +14 -1
  262. package/daemon/dist/domain/gateway/slack/open-asks.js.map +1 -1
  263. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
  264. package/daemon/dist/domain/gateway/slack/slack-subsystem.js +225 -32
  265. package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
  266. package/daemon/dist/domain/hosts/pairing-ask.d.ts +10 -0
  267. package/daemon/dist/domain/hosts/pairing-ask.d.ts.map +1 -0
  268. package/daemon/dist/domain/hosts/pairing-ask.js +9 -0
  269. package/daemon/dist/domain/hosts/pairing-ask.js.map +1 -0
  270. package/daemon/dist/domain/launch-wrapper.d.ts +28 -0
  271. package/daemon/dist/domain/launch-wrapper.d.ts.map +1 -0
  272. package/daemon/dist/domain/launch-wrapper.js +93 -0
  273. package/daemon/dist/domain/launch-wrapper.js.map +1 -0
  274. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts +1 -1
  275. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
  276. package/daemon/dist/domain/mission-control/mission-control-write-contract.js +85 -28
  277. package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
  278. package/daemon/dist/domain/model-divergence/current-model-reader.d.ts.map +1 -1
  279. package/daemon/dist/domain/model-divergence/current-model-reader.js +14 -3
  280. package/daemon/dist/domain/model-divergence/current-model-reader.js.map +1 -1
  281. package/daemon/dist/domain/native-process-lineage.d.ts.map +1 -1
  282. package/daemon/dist/domain/native-process-lineage.js +32 -9
  283. package/daemon/dist/domain/native-process-lineage.js.map +1 -1
  284. package/daemon/dist/domain/native-resume-probe.d.ts +5 -0
  285. package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
  286. package/daemon/dist/domain/native-resume-probe.js +5 -0
  287. package/daemon/dist/domain/native-resume-probe.js.map +1 -1
  288. package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
  289. package/daemon/dist/domain/node-inventory.js +7 -0
  290. package/daemon/dist/domain/node-inventory.js.map +1 -1
  291. package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
  292. package/daemon/dist/domain/node-launcher.js +9 -2
  293. package/daemon/dist/domain/node-launcher.js.map +1 -1
  294. package/daemon/dist/domain/outbox-handler.d.ts +53 -3
  295. package/daemon/dist/domain/outbox-handler.d.ts.map +1 -1
  296. package/daemon/dist/domain/outbox-handler.js +101 -6
  297. package/daemon/dist/domain/outbox-handler.js.map +1 -1
  298. package/daemon/dist/domain/parent-session-env.d.ts +2 -1
  299. package/daemon/dist/domain/parent-session-env.d.ts.map +1 -1
  300. package/daemon/dist/domain/parent-session-env.js +9 -1
  301. package/daemon/dist/domain/parent-session-env.js.map +1 -1
  302. package/daemon/dist/domain/parked-query.d.ts +6 -0
  303. package/daemon/dist/domain/parked-query.d.ts.map +1 -1
  304. package/daemon/dist/domain/parked-query.js +1 -0
  305. package/daemon/dist/domain/parked-query.js.map +1 -1
  306. package/daemon/dist/domain/permission-stop-observation.d.ts +50 -0
  307. package/daemon/dist/domain/permission-stop-observation.d.ts.map +1 -0
  308. package/daemon/dist/domain/permission-stop-observation.js +163 -0
  309. package/daemon/dist/domain/permission-stop-observation.js.map +1 -0
  310. package/daemon/dist/domain/pi-account-state.d.ts +6 -0
  311. package/daemon/dist/domain/pi-account-state.d.ts.map +1 -0
  312. package/daemon/dist/domain/pi-account-state.js +14 -0
  313. package/daemon/dist/domain/pi-account-state.js.map +1 -0
  314. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts +6 -0
  315. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts.map +1 -1
  316. package/daemon/dist/domain/policies/parked-owner-consumer.js +10 -1
  317. package/daemon/dist/domain/policies/parked-owner-consumer.js.map +1 -1
  318. package/daemon/dist/domain/policies/quiet-release.d.ts.map +1 -1
  319. package/daemon/dist/domain/policies/quiet-release.js +6 -3
  320. package/daemon/dist/domain/policies/quiet-release.js.map +1 -1
  321. package/daemon/dist/domain/profile-resolver.d.ts.map +1 -1
  322. package/daemon/dist/domain/profile-resolver.js +3 -0
  323. package/daemon/dist/domain/profile-resolver.js.map +1 -1
  324. package/daemon/dist/domain/projection-planner.d.ts +4 -1
  325. package/daemon/dist/domain/projection-planner.d.ts.map +1 -1
  326. package/daemon/dist/domain/projection-planner.js +3 -0
  327. package/daemon/dist/domain/projection-planner.js.map +1 -1
  328. package/daemon/dist/domain/queue-pickup.d.ts +20 -1
  329. package/daemon/dist/domain/queue-pickup.d.ts.map +1 -1
  330. package/daemon/dist/domain/queue-pickup.js +38 -6
  331. package/daemon/dist/domain/queue-pickup.js.map +1 -1
  332. package/daemon/dist/domain/queue-recovery.d.ts +19 -0
  333. package/daemon/dist/domain/queue-recovery.d.ts.map +1 -1
  334. package/daemon/dist/domain/queue-recovery.js +80 -2
  335. package/daemon/dist/domain/queue-recovery.js.map +1 -1
  336. package/daemon/dist/domain/queue-repository.d.ts +81 -10
  337. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  338. package/daemon/dist/domain/queue-repository.js +381 -48
  339. package/daemon/dist/domain/queue-repository.js.map +1 -1
  340. package/daemon/dist/domain/queue-retention.d.ts +68 -0
  341. package/daemon/dist/domain/queue-retention.d.ts.map +1 -1
  342. package/daemon/dist/domain/queue-retention.js +133 -0
  343. package/daemon/dist/domain/queue-retention.js.map +1 -1
  344. package/daemon/dist/domain/queue-stuck-sweep.d.ts +22 -1
  345. package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
  346. package/daemon/dist/domain/queue-stuck-sweep.js +586 -157
  347. package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
  348. package/daemon/dist/domain/queue-transition-log.d.ts +49 -1
  349. package/daemon/dist/domain/queue-transition-log.d.ts.map +1 -1
  350. package/daemon/dist/domain/queue-transition-log.js +216 -3
  351. package/daemon/dist/domain/queue-transition-log.js.map +1 -1
  352. package/daemon/dist/domain/queue-waiting.d.ts +1 -1
  353. package/daemon/dist/domain/queue-waiting.d.ts.map +1 -1
  354. package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
  355. package/daemon/dist/domain/queue-wake-ladder.js +7 -2
  356. package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
  357. package/daemon/dist/domain/quiet-hold-custody.d.ts.map +1 -1
  358. package/daemon/dist/domain/quiet-hold-custody.js +7 -3
  359. package/daemon/dist/domain/quiet-hold-custody.js.map +1 -1
  360. package/daemon/dist/domain/restore-check-service.d.ts +1 -0
  361. package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
  362. package/daemon/dist/domain/restore-check-service.js +7 -2
  363. package/daemon/dist/domain/restore-check-service.js.map +1 -1
  364. package/daemon/dist/domain/restore-orchestrator.d.ts +13 -2
  365. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  366. package/daemon/dist/domain/restore-orchestrator.js +63 -26
  367. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  368. package/daemon/dist/domain/rig-repository.d.ts +3 -0
  369. package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
  370. package/daemon/dist/domain/rig-repository.js +46 -1
  371. package/daemon/dist/domain/rig-repository.js.map +1 -1
  372. package/daemon/dist/domain/rigspec-codec.d.ts.map +1 -1
  373. package/daemon/dist/domain/rigspec-codec.js +4 -0
  374. package/daemon/dist/domain/rigspec-codec.js.map +1 -1
  375. package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
  376. package/daemon/dist/domain/rigspec-exporter.js +5 -0
  377. package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
  378. package/daemon/dist/domain/rigspec-instantiator.d.ts +20 -2
  379. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  380. package/daemon/dist/domain/rigspec-instantiator.js +76 -20
  381. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  382. package/daemon/dist/domain/rigspec-preflight.d.ts.map +1 -1
  383. package/daemon/dist/domain/rigspec-preflight.js +13 -1
  384. package/daemon/dist/domain/rigspec-preflight.js.map +1 -1
  385. package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
  386. package/daemon/dist/domain/rigspec-schema.js +26 -1
  387. package/daemon/dist/domain/rigspec-schema.js.map +1 -1
  388. package/daemon/dist/domain/runtime-adapter.d.ts +1 -0
  389. package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
  390. package/daemon/dist/domain/runtime-adapter.js.map +1 -1
  391. package/daemon/dist/domain/runtime-switch-materials.d.ts +1 -1
  392. package/daemon/dist/domain/runtime-switch-materials.d.ts.map +1 -1
  393. package/daemon/dist/domain/runtime-switch-materials.js +2 -2
  394. package/daemon/dist/domain/runtime-switch-materials.js.map +1 -1
  395. package/daemon/dist/domain/seat-activity-service.d.ts +38 -1
  396. package/daemon/dist/domain/seat-activity-service.d.ts.map +1 -1
  397. package/daemon/dist/domain/seat-activity-service.js +59 -1
  398. package/daemon/dist/domain/seat-activity-service.js.map +1 -1
  399. package/daemon/dist/domain/seat-attention-reconciler.d.ts +13 -0
  400. package/daemon/dist/domain/seat-attention-reconciler.d.ts.map +1 -1
  401. package/daemon/dist/domain/seat-attention-reconciler.js +45 -1
  402. package/daemon/dist/domain/seat-attention-reconciler.js.map +1 -1
  403. package/daemon/dist/domain/seat-handover-service.d.ts +1 -0
  404. package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
  405. package/daemon/dist/domain/seat-handover-service.js +38 -11
  406. package/daemon/dist/domain/seat-handover-service.js.map +1 -1
  407. package/daemon/dist/domain/seat-launch-environment.d.ts +10 -0
  408. package/daemon/dist/domain/seat-launch-environment.d.ts.map +1 -1
  409. package/daemon/dist/domain/seat-launch-environment.js +62 -15
  410. package/daemon/dist/domain/seat-launch-environment.js.map +1 -1
  411. package/daemon/dist/domain/seat-lifecycle-service.d.ts +3 -0
  412. package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
  413. package/daemon/dist/domain/seat-lifecycle-service.js +30 -8
  414. package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
  415. package/daemon/dist/domain/seat-restart-in-place.d.ts +2 -1
  416. package/daemon/dist/domain/seat-restart-in-place.d.ts.map +1 -1
  417. package/daemon/dist/domain/seat-restart-in-place.js +22 -2
  418. package/daemon/dist/domain/seat-restart-in-place.js.map +1 -1
  419. package/daemon/dist/domain/seat-runtime-home.d.ts +4 -1
  420. package/daemon/dist/domain/seat-runtime-home.d.ts.map +1 -1
  421. package/daemon/dist/domain/seat-runtime-home.js +6 -4
  422. package/daemon/dist/domain/seat-runtime-home.js.map +1 -1
  423. package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -1
  424. package/daemon/dist/domain/seat-runtime-switch-service.js +75 -11
  425. package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
  426. package/daemon/dist/domain/seat-skill-storage.d.ts +57 -4
  427. package/daemon/dist/domain/seat-skill-storage.d.ts.map +1 -1
  428. package/daemon/dist/domain/seat-skill-storage.js +338 -8
  429. package/daemon/dist/domain/seat-skill-storage.js.map +1 -1
  430. package/daemon/dist/domain/seat-status-service.d.ts +9 -2
  431. package/daemon/dist/domain/seat-status-service.d.ts.map +1 -1
  432. package/daemon/dist/domain/seat-status-service.js +17 -2
  433. package/daemon/dist/domain/seat-status-service.js.map +1 -1
  434. package/daemon/dist/domain/self-attach-service.d.ts.map +1 -1
  435. package/daemon/dist/domain/self-attach-service.js +11 -4
  436. package/daemon/dist/domain/self-attach-service.js.map +1 -1
  437. package/daemon/dist/domain/session-transport.d.ts +33 -4
  438. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  439. package/daemon/dist/domain/session-transport.js +225 -37
  440. package/daemon/dist/domain/session-transport.js.map +1 -1
  441. package/daemon/dist/domain/skill-catalog.d.ts +37 -0
  442. package/daemon/dist/domain/skill-catalog.d.ts.map +1 -1
  443. package/daemon/dist/domain/skill-catalog.js +152 -3
  444. package/daemon/dist/domain/skill-catalog.js.map +1 -1
  445. package/daemon/dist/domain/slices/slice-detail-projector.d.ts +1 -1
  446. package/daemon/dist/domain/slices/slice-detail-projector.d.ts.map +1 -1
  447. package/daemon/dist/domain/slices/slice-detail-projector.js +11 -13
  448. package/daemon/dist/domain/slices/slice-detail-projector.js.map +1 -1
  449. package/daemon/dist/domain/spec-validation-service.d.ts +1 -0
  450. package/daemon/dist/domain/spec-validation-service.d.ts.map +1 -1
  451. package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
  452. package/daemon/dist/domain/startup-orchestrator.js +7 -1
  453. package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
  454. package/daemon/dist/domain/successor-session-launcher.d.ts +1 -0
  455. package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
  456. package/daemon/dist/domain/successor-session-launcher.js +1 -0
  457. package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
  458. package/daemon/dist/domain/terminal/earlier-tile-attach-0711.d.ts +2 -0
  459. package/daemon/dist/domain/terminal/earlier-tile-attach-0711.d.ts.map +1 -0
  460. package/daemon/dist/domain/terminal/earlier-tile-attach-0711.js +146 -0
  461. package/daemon/dist/domain/terminal/earlier-tile-attach-0711.js.map +1 -0
  462. package/daemon/dist/domain/terminal/earlier-tile-attach.d.ts +4 -0
  463. package/daemon/dist/domain/terminal/earlier-tile-attach.d.ts.map +1 -0
  464. package/daemon/dist/domain/terminal/earlier-tile-attach.js +131 -0
  465. package/daemon/dist/domain/terminal/earlier-tile-attach.js.map +1 -0
  466. package/daemon/dist/domain/terminal/herdr-follow-view.d.ts.map +1 -1
  467. package/daemon/dist/domain/terminal/herdr-follow-view.js +47 -17
  468. package/daemon/dist/domain/terminal/herdr-follow-view.js.map +1 -1
  469. package/daemon/dist/domain/terminal/herdr-viewer.d.ts +7 -4
  470. package/daemon/dist/domain/terminal/herdr-viewer.d.ts.map +1 -1
  471. package/daemon/dist/domain/terminal/herdr-viewer.js +105 -41
  472. package/daemon/dist/domain/terminal/herdr-viewer.js.map +1 -1
  473. package/daemon/dist/domain/terminal/terminal-following.js +3 -3
  474. package/daemon/dist/domain/terminal/terminal-following.js.map +1 -1
  475. package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
  476. package/daemon/dist/domain/terminal/terminal-service.js +16 -1
  477. package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
  478. package/daemon/dist/domain/terminal/tile-attach.d.ts +8 -1
  479. package/daemon/dist/domain/terminal/tile-attach.d.ts.map +1 -1
  480. package/daemon/dist/domain/terminal/tile-attach.js +20 -50
  481. package/daemon/dist/domain/terminal/tile-attach.js.map +1 -1
  482. package/daemon/dist/domain/terminal/view-composer.js +1 -1
  483. package/daemon/dist/domain/terminal/view-composer.js.map +1 -1
  484. package/daemon/dist/domain/tmux-server-selection.d.ts.map +1 -1
  485. package/daemon/dist/domain/tmux-server-selection.js +8 -2
  486. package/daemon/dist/domain/tmux-server-selection.js.map +1 -1
  487. package/daemon/dist/domain/types.d.ts +18 -1
  488. package/daemon/dist/domain/types.d.ts.map +1 -1
  489. package/daemon/dist/domain/types.js.map +1 -1
  490. package/daemon/dist/domain/user-settings/settings-store.d.ts +1 -1
  491. package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
  492. package/daemon/dist/domain/user-settings/settings-store.js +52 -0
  493. package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
  494. package/daemon/dist/domain/view-event-bridge.js +1 -1
  495. package/daemon/dist/domain/view-event-bridge.js.map +1 -1
  496. package/daemon/dist/domain/view-projector.d.ts +4 -1
  497. package/daemon/dist/domain/view-projector.d.ts.map +1 -1
  498. package/daemon/dist/domain/view-projector.js +9 -4
  499. package/daemon/dist/domain/view-projector.js.map +1 -1
  500. package/daemon/dist/domain/wake-recovery.d.ts.map +1 -1
  501. package/daemon/dist/domain/wake-recovery.js +9 -2
  502. package/daemon/dist/domain/wake-recovery.js.map +1 -1
  503. package/daemon/dist/domain/workflow-exception-escalation.d.ts +3 -2
  504. package/daemon/dist/domain/workflow-exception-escalation.d.ts.map +1 -1
  505. package/daemon/dist/domain/workflow-exception-escalation.js +1 -1
  506. package/daemon/dist/domain/workflow-exception-escalation.js.map +1 -1
  507. package/daemon/dist/domain/workflow-instance-store.d.ts +8 -1
  508. package/daemon/dist/domain/workflow-instance-store.d.ts.map +1 -1
  509. package/daemon/dist/domain/workflow-instance-store.js +21 -3
  510. package/daemon/dist/domain/workflow-instance-store.js.map +1 -1
  511. package/daemon/dist/domain/workflow-reconciliation.d.ts.map +1 -1
  512. package/daemon/dist/domain/workflow-reconciliation.js +2 -1
  513. package/daemon/dist/domain/workflow-reconciliation.js.map +1 -1
  514. package/daemon/dist/domain/workflow-runtime.d.ts +4 -1
  515. package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
  516. package/daemon/dist/domain/workflow-runtime.js +20 -7
  517. package/daemon/dist/domain/workflow-runtime.js.map +1 -1
  518. package/daemon/dist/domain/workflow-spec-cache.d.ts +24 -4
  519. package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
  520. package/daemon/dist/domain/workflow-spec-cache.js +87 -7
  521. package/daemon/dist/domain/workflow-spec-cache.js.map +1 -1
  522. package/daemon/dist/domain/workflow-spec-unregister.d.ts +36 -0
  523. package/daemon/dist/domain/workflow-spec-unregister.d.ts.map +1 -0
  524. package/daemon/dist/domain/workflow-spec-unregister.js +105 -0
  525. package/daemon/dist/domain/workflow-spec-unregister.js.map +1 -0
  526. package/daemon/dist/domain/workflow-types.d.ts +14 -0
  527. package/daemon/dist/domain/workflow-types.d.ts.map +1 -1
  528. package/daemon/dist/index.d.ts +2 -1
  529. package/daemon/dist/index.d.ts.map +1 -1
  530. package/daemon/dist/index.js +23 -5
  531. package/daemon/dist/index.js.map +1 -1
  532. package/daemon/dist/learned-host-bindings-surface.d.ts +2 -0
  533. package/daemon/dist/learned-host-bindings-surface.d.ts.map +1 -0
  534. package/daemon/dist/learned-host-bindings-surface.js +4 -0
  535. package/daemon/dist/learned-host-bindings-surface.js.map +1 -0
  536. package/daemon/dist/middleware/auth-bearer-token.d.ts +2 -0
  537. package/daemon/dist/middleware/auth-bearer-token.d.ts.map +1 -1
  538. package/daemon/dist/middleware/auth-bearer-token.js +12 -8
  539. package/daemon/dist/middleware/auth-bearer-token.js.map +1 -1
  540. package/daemon/dist/routes/activity.d.ts.map +1 -1
  541. package/daemon/dist/routes/activity.js +59 -4
  542. package/daemon/dist/routes/activity.js.map +1 -1
  543. package/daemon/dist/routes/adapters.d.ts.map +1 -1
  544. package/daemon/dist/routes/adapters.js +4 -0
  545. package/daemon/dist/routes/adapters.js.map +1 -1
  546. package/daemon/dist/routes/compaction.js +3 -1
  547. package/daemon/dist/routes/compaction.js.map +1 -1
  548. package/daemon/dist/routes/events.js +4 -0
  549. package/daemon/dist/routes/events.js.map +1 -1
  550. package/daemon/dist/routes/gateway.d.ts +3 -0
  551. package/daemon/dist/routes/gateway.d.ts.map +1 -1
  552. package/daemon/dist/routes/gateway.js +58 -8
  553. package/daemon/dist/routes/gateway.js.map +1 -1
  554. package/daemon/dist/routes/hosts.d.ts.map +1 -1
  555. package/daemon/dist/routes/hosts.js +298 -35
  556. package/daemon/dist/routes/hosts.js.map +1 -1
  557. package/daemon/dist/routes/queue.d.ts.map +1 -1
  558. package/daemon/dist/routes/queue.js +10 -3
  559. package/daemon/dist/routes/queue.js.map +1 -1
  560. package/daemon/dist/routes/seat.d.ts.map +1 -1
  561. package/daemon/dist/routes/seat.js +8 -5
  562. package/daemon/dist/routes/seat.js.map +1 -1
  563. package/daemon/dist/routes/sessions.js +1 -1
  564. package/daemon/dist/routes/sessions.js.map +1 -1
  565. package/daemon/dist/routes/terminal-ws.d.ts +1 -0
  566. package/daemon/dist/routes/terminal-ws.d.ts.map +1 -1
  567. package/daemon/dist/routes/terminal-ws.js +1 -1
  568. package/daemon/dist/routes/terminal-ws.js.map +1 -1
  569. package/daemon/dist/routes/terminal.js +2 -2
  570. package/daemon/dist/routes/terminal.js.map +1 -1
  571. package/daemon/dist/routes/transport.js +1 -1
  572. package/daemon/dist/routes/transport.js.map +1 -1
  573. package/daemon/dist/routes/workflow.d.ts.map +1 -1
  574. package/daemon/dist/routes/workflow.js +24 -0
  575. package/daemon/dist/routes/workflow.js.map +1 -1
  576. package/daemon/dist/server.d.ts +2 -0
  577. package/daemon/dist/server.d.ts.map +1 -1
  578. package/daemon/dist/server.js +7 -2
  579. package/daemon/dist/server.js.map +1 -1
  580. package/daemon/dist/startup.d.ts.map +1 -1
  581. package/daemon/dist/startup.js +74 -17
  582. package/daemon/dist/startup.js.map +1 -1
  583. package/daemon/dist/terminal/TerminalSessionBroker.d.ts +18 -13
  584. package/daemon/dist/terminal/TerminalSessionBroker.d.ts.map +1 -1
  585. package/daemon/dist/terminal/TerminalSessionBroker.js +113 -76
  586. package/daemon/dist/terminal/TerminalSessionBroker.js.map +1 -1
  587. package/daemon/dist/terminal/window-pin.d.ts +3 -3
  588. package/daemon/dist/terminal/window-pin.d.ts.map +1 -1
  589. package/daemon/dist/terminal/window-pin.js +2 -2
  590. package/daemon/dist/terminal/window-pin.js.map +1 -1
  591. package/daemon/docs/reference/acp-agents.md +176 -2
  592. package/daemon/docs/reference/agent-spec.md +73 -6
  593. package/daemon/docs/reference/agent-startup-guide.md +28 -0
  594. package/daemon/docs/reference/agent-state-taxonomy.md +7 -0
  595. package/daemon/docs/reference/author-contracts.md +1 -1
  596. package/daemon/docs/reference/community-harness-examples/dsh/dsh.yaml +2 -2
  597. package/daemon/docs/reference/daemon-http-clients.md +16 -7
  598. package/daemon/docs/reference/gateway-participants.md +4 -1
  599. package/daemon/docs/reference/gateway-relay.md +239 -0
  600. package/daemon/docs/reference/getting-started.md +23 -4
  601. package/daemon/docs/reference/harness-runner-contract.md +20 -3
  602. package/daemon/docs/reference/hosted-members.md +38 -1
  603. package/daemon/docs/reference/project-workspace.md +4 -0
  604. package/daemon/docs/reference/quickstart.md +1 -1
  605. package/daemon/docs/reference/reconstructions.md +90 -0
  606. package/daemon/docs/reference/rig-spec.md +64 -7
  607. package/daemon/docs/reference/seat-delivery.md +83 -0
  608. package/daemon/docs/reference/slack-app-setup.md +1 -2
  609. package/daemon/docs/reference/telemetry.md +64 -0
  610. package/daemon/docs/reference/terminal-sessions.md +88 -26
  611. package/daemon/docs/reference/tmux-servers.md +48 -0
  612. package/daemon/docs/reference/whats-new.md +484 -76
  613. package/daemon/specs/agents/shared/skills/core/cross-host-rig-commands/SKILL.md +7 -0
  614. package/daemon/specs/agents/shared/skills/core/openrig-skills/SKILL.md +1 -0
  615. package/daemon/specs/agents/shared/skills/core/working-with-an-openrig-team/SKILL.md +90 -0
  616. package/dist/acp/agent-server.d.ts +126 -0
  617. package/dist/acp/agent-server.d.ts.map +1 -0
  618. package/dist/acp/agent-server.js +449 -0
  619. package/dist/acp/agent-server.js.map +1 -0
  620. package/dist/acp/connector.d.ts +27 -1
  621. package/dist/acp/connector.d.ts.map +1 -1
  622. package/dist/acp/connector.js +38 -5
  623. package/dist/acp/connector.js.map +1 -1
  624. package/dist/acp/json-rpc-stdio.d.ts +24 -10
  625. package/dist/acp/json-rpc-stdio.d.ts.map +1 -1
  626. package/dist/acp/json-rpc-stdio.js +58 -36
  627. package/dist/acp/json-rpc-stdio.js.map +1 -1
  628. package/dist/acp/run-processes.d.ts +3 -2
  629. package/dist/acp/run-processes.d.ts.map +1 -1
  630. package/dist/acp/run-processes.js +4 -3
  631. package/dist/acp/run-processes.js.map +1 -1
  632. package/dist/bin-wrapper.d.ts.map +1 -1
  633. package/dist/bin-wrapper.js +3 -1
  634. package/dist/bin-wrapper.js.map +1 -1
  635. package/dist/build-info.js +3 -3
  636. package/dist/client.d.ts +4 -0
  637. package/dist/client.d.ts.map +1 -1
  638. package/dist/client.js +7 -0
  639. package/dist/client.js.map +1 -1
  640. package/dist/commands/acp.d.ts +16 -0
  641. package/dist/commands/acp.d.ts.map +1 -1
  642. package/dist/commands/acp.js +191 -4
  643. package/dist/commands/acp.js.map +1 -1
  644. package/dist/commands/agent.d.ts.map +1 -1
  645. package/dist/commands/agent.js +3 -0
  646. package/dist/commands/agent.js.map +1 -1
  647. package/dist/commands/attach.js +1 -1
  648. package/dist/commands/attach.js.map +1 -1
  649. package/dist/commands/broadcast.js +4 -0
  650. package/dist/commands/broadcast.js.map +1 -1
  651. package/dist/commands/capture.js +6 -6
  652. package/dist/commands/capture.js.map +1 -1
  653. package/dist/commands/compact.d.ts.map +1 -1
  654. package/dist/commands/compact.js +14 -2
  655. package/dist/commands/compact.js.map +1 -1
  656. package/dist/commands/config.d.ts.map +1 -1
  657. package/dist/commands/config.js +42 -6
  658. package/dist/commands/config.js.map +1 -1
  659. package/dist/commands/context-reconstruction.d.ts +5 -0
  660. package/dist/commands/context-reconstruction.d.ts.map +1 -0
  661. package/dist/commands/context-reconstruction.js +69 -0
  662. package/dist/commands/context-reconstruction.js.map +1 -0
  663. package/dist/commands/context.d.ts.map +1 -1
  664. package/dist/commands/context.js +2 -0
  665. package/dist/commands/context.js.map +1 -1
  666. package/dist/commands/daemon.d.ts.map +1 -1
  667. package/dist/commands/daemon.js +5 -2
  668. package/dist/commands/daemon.js.map +1 -1
  669. package/dist/commands/doctor.d.ts +1 -1
  670. package/dist/commands/doctor.d.ts.map +1 -1
  671. package/dist/commands/doctor.js +97 -7
  672. package/dist/commands/doctor.js.map +1 -1
  673. package/dist/commands/exec.d.ts +102 -0
  674. package/dist/commands/exec.d.ts.map +1 -0
  675. package/dist/commands/exec.js +562 -0
  676. package/dist/commands/exec.js.map +1 -0
  677. package/dist/commands/gateway.d.ts.map +1 -1
  678. package/dist/commands/gateway.js +15 -7
  679. package/dist/commands/gateway.js.map +1 -1
  680. package/dist/commands/host.d.ts.map +1 -1
  681. package/dist/commands/host.js +59 -12
  682. package/dist/commands/host.js.map +1 -1
  683. package/dist/commands/mcp.d.ts.map +1 -1
  684. package/dist/commands/mcp.js +29 -5
  685. package/dist/commands/mcp.js.map +1 -1
  686. package/dist/commands/provider.d.ts.map +1 -1
  687. package/dist/commands/provider.js +4 -1
  688. package/dist/commands/provider.js.map +1 -1
  689. package/dist/commands/ps.d.ts +2 -0
  690. package/dist/commands/ps.d.ts.map +1 -1
  691. package/dist/commands/ps.js +3 -1
  692. package/dist/commands/ps.js.map +1 -1
  693. package/dist/commands/queue.d.ts +3 -0
  694. package/dist/commands/queue.d.ts.map +1 -1
  695. package/dist/commands/queue.js +203 -67
  696. package/dist/commands/queue.js.map +1 -1
  697. package/dist/commands/roster.d.ts +1 -1
  698. package/dist/commands/roster.d.ts.map +1 -1
  699. package/dist/commands/roster.js +14 -2
  700. package/dist/commands/roster.js.map +1 -1
  701. package/dist/commands/seat.d.ts.map +1 -1
  702. package/dist/commands/seat.js +48 -5
  703. package/dist/commands/seat.js.map +1 -1
  704. package/dist/commands/send.d.ts.map +1 -1
  705. package/dist/commands/send.js +7 -11
  706. package/dist/commands/send.js.map +1 -1
  707. package/dist/commands/slack.d.ts.map +1 -1
  708. package/dist/commands/slack.js +2 -0
  709. package/dist/commands/slack.js.map +1 -1
  710. package/dist/commands/stream.d.ts.map +1 -1
  711. package/dist/commands/stream.js +24 -1
  712. package/dist/commands/stream.js.map +1 -1
  713. package/dist/commands/terminal.js +1 -1
  714. package/dist/commands/workflow-render.d.ts +4 -0
  715. package/dist/commands/workflow-render.d.ts.map +1 -1
  716. package/dist/commands/workflow-render.js +7 -0
  717. package/dist/commands/workflow-render.js.map +1 -1
  718. package/dist/commands/workflow.d.ts.map +1 -1
  719. package/dist/commands/workflow.js +69 -1
  720. package/dist/commands/workflow.js.map +1 -1
  721. package/dist/config-store.d.ts +9 -1
  722. package/dist/config-store.d.ts.map +1 -1
  723. package/dist/config-store.js +57 -3
  724. package/dist/config-store.js.map +1 -1
  725. package/dist/cross-host-target.d.ts +2 -0
  726. package/dist/cross-host-target.d.ts.map +1 -1
  727. package/dist/cross-host-target.js +1 -1
  728. package/dist/cross-host-target.js.map +1 -1
  729. package/dist/daemon-lifecycle.d.ts +2 -0
  730. package/dist/daemon-lifecycle.d.ts.map +1 -1
  731. package/dist/daemon-lifecycle.js +38 -5
  732. package/dist/daemon-lifecycle.js.map +1 -1
  733. package/dist/daemon-reachability.d.ts +1 -1
  734. package/dist/daemon-reachability.d.ts.map +1 -1
  735. package/dist/daemon-reachability.js +4 -2
  736. package/dist/daemon-reachability.js.map +1 -1
  737. package/dist/index.d.ts +2 -0
  738. package/dist/index.d.ts.map +1 -1
  739. package/dist/index.js +2 -0
  740. package/dist/index.js.map +1 -1
  741. package/dist/lazy-program.d.ts.map +1 -1
  742. package/dist/lazy-program.js +1 -0
  743. package/dist/lazy-program.js.map +1 -1
  744. package/dist/lib/reconstruction-reader.d.ts +122 -0
  745. package/dist/lib/reconstruction-reader.d.ts.map +1 -0
  746. package/dist/lib/reconstruction-reader.js +481 -0
  747. package/dist/lib/reconstruction-reader.js.map +1 -0
  748. package/dist/lib/work-install.d.ts +28 -0
  749. package/dist/lib/work-install.d.ts.map +1 -1
  750. package/dist/lib/work-install.js +80 -20
  751. package/dist/lib/work-install.js.map +1 -1
  752. package/dist/mcp-http.d.ts +7 -0
  753. package/dist/mcp-http.d.ts.map +1 -1
  754. package/dist/mcp-http.js +30 -6
  755. package/dist/mcp-http.js.map +1 -1
  756. package/dist/mcp-server.d.ts +33 -3
  757. package/dist/mcp-server.d.ts.map +1 -1
  758. package/dist/mcp-server.js +443 -52
  759. package/dist/mcp-server.js.map +1 -1
  760. package/dist/queue-artifact.d.ts +57 -0
  761. package/dist/queue-artifact.d.ts.map +1 -0
  762. package/dist/queue-artifact.js +70 -0
  763. package/dist/queue-artifact.js.map +1 -0
  764. package/dist/queue-receipt.d.ts.map +1 -1
  765. package/dist/queue-receipt.js +4 -3
  766. package/dist/queue-receipt.js.map +1 -1
  767. package/dist/system-preflight.d.ts.map +1 -1
  768. package/dist/system-preflight.js +15 -7
  769. package/dist/system-preflight.js.map +1 -1
  770. package/dist/terminal-window.d.ts.map +1 -1
  771. package/dist/terminal-window.js +13 -10
  772. package/dist/terminal-window.js.map +1 -1
  773. package/package.json +1 -1
  774. package/tui/dist/attention/attention-model.d.ts +2 -1
  775. package/tui/dist/attention/attention-model.d.ts.map +1 -1
  776. package/tui/dist/attention/attention-model.js +18 -4
  777. package/tui/dist/attention/attention-model.js.map +1 -1
  778. package/tui/dist/config/config-model.d.ts.map +1 -1
  779. package/tui/dist/config/config-model.js +2 -1
  780. package/tui/dist/config/config-model.js.map +1 -1
  781. package/tui/dist/daemon-client.d.ts +7 -0
  782. package/tui/dist/daemon-client.d.ts.map +1 -1
  783. package/tui/dist/daemon-client.js +19 -5
  784. package/tui/dist/daemon-client.js.map +1 -1
  785. package/tui/dist/demo-data.js +2 -2
  786. package/tui/dist/demo-data.js.map +1 -1
  787. package/tui/dist/main.js +5 -1
  788. package/tui/dist/main.js.map +1 -1
  789. package/ui/dist/assets/index-BOYrLyfQ.js +623 -0
  790. package/ui/dist/assets/index-DqSRu4OY.css +32 -0
  791. package/ui/dist/index.html +2 -2
  792. package/ui/dist/assets/index-BFOs3ejL.css +0 -32
  793. package/ui/dist/assets/index-CdkFwtld.js +0 -623
@@ -5,9 +5,16 @@ import { createHash } from "node:crypto";
5
5
  import { loadHumanRegistry, registeredPeople, resolveRegisteredHumanAddress, slackSubscriptionFor, withHumanAlertTag } from "./gateway/human-registry.js";
6
6
  import { sharedChannelAddresses } from "./gateway/participants.js";
7
7
  import { resolveExternal } from "./gateway/external-admission.js";
8
- import { QueueTransitionLog } from "./queue-transition-log.js";
8
+ import { QueueTransitionLog, RELAY_OWNER_NOTIFICATION_ACCEPTED_PREFIX, RELAY_OWNER_NOTIFICATION_TRANSPORT_FAILED_PREFIX, formatRelayOwnerNotificationAccepted, formatRelayOwnerNotificationTransportFailed, parseRelayOwnerNotificationAccepted, parseRelayOwnerNotificationTransportFailed, } from "./queue-transition-log.js";
9
+ export { RELAY_OWNER_NOTIFICATION_ACCEPTED_PREFIX, RELAY_OWNER_NOTIFICATION_TRANSPORT_FAILED_PREFIX, formatRelayOwnerNotificationAccepted, formatRelayOwnerNotificationTransportFailed, parseRelayOwnerNotificationAccepted, parseRelayOwnerNotificationTransportFailed, };
10
+ export const MC_OPERATION_TAG_PREFIX = "mc-operation:";
11
+ export function mcOperationTag(operation) {
12
+ return `${MC_OPERATION_TAG_PREFIX}${operation}`;
13
+ }
9
14
  import { WAKE_INTENT_PREFIX } from "./outbox-handler.js";
15
+ import { physicalSessionName } from "./session-registry.js";
10
16
  import { derivePickup } from "./queue-pickup.js";
17
+ import { withRecoveryIndex } from "./queue-recovery.js";
11
18
  import { lastMeaningfulTransition, readWaitingView } from "./queue-waiting.js";
12
19
  import { isOpenRigSender, OPENRIG_SENDER, wrapPaneEnvelope } from "../lib/pane-envelope.js";
13
20
  import { isBoundTerminalSeat } from "./terminal-seat.js";
@@ -15,6 +22,7 @@ import { renderQueueHandoffNudge } from "./queue-nudge-text.js";
15
22
  import { getSelfHostId } from "./hosts/fanout-contract.js";
16
23
  import { parseSessionName, isHumanSeatSessionRef } from "./session-name.js";
17
24
  import { runnerPermissionOrigin } from "./runner-permissions.js";
25
+ import { isHostPairingAsk } from "./hosts/pairing-ask.js";
18
26
  import { parseReplyToChoice, parseReplyToThreadMissing, formatReplyToChoice, describeReplyToFallback, REPLY_TO_CHOICE_ACTOR } from "./reply-to-choice.js";
19
27
  import { classifyDestination } from "./gateway/destination-resolver.js";
20
28
  import { join } from "node:path";
@@ -82,6 +90,10 @@ const AUTO_UNPARK_WAKE_TAG = "queue:auto-unpark:blocker";
82
90
  * handoff: it keeps that source when it's replayed later. Send, broadcast, queue create and the cross-host forward never
83
91
  * set it from a request; the trusted local outbox recorder (/api/queue/outbox/record) accepts caller tags by design. */
84
92
  const WAKE_TRIGGER_OPENRIG_TAG = "queue:wake-trigger:openrig";
93
+ /** The wake telling a claimer that a cross-host handoff overrode its claim (#2631): it's about a row closed by design. */
94
+ const CLAIM_OVERRIDDEN_WAKE_PREFIX = `${WAKE_INTENT_PREFIX}claim-overridden-`;
95
+ /** The first id after every such wake's, so a range on the outbox's primary key finds them all and nothing else. */
96
+ const CLAIM_OVERRIDDEN_WAKE_END = `${WAKE_INTENT_PREFIX}claim-overridden.`;
85
97
  /** On a wake intent whose ring a hosted member's trigger accepted: recovery doesn't ring that intent again. */
86
98
  const HOSTED_WAKE_ACCEPTED_TAG = "queue:hosted-wake-accepted";
87
99
  const AUTO_UNPARK_BLOCKER_TAG_PREFIX = "queue:auto-unpark:blocker-ref:";
@@ -276,6 +288,8 @@ export function matchesRecordedHandoffTarget(qitemId, handedOffTo, closureTarget
276
288
  * Throws on database/query errors so callers can handle lookup failures with their own policies.
277
289
  */
278
290
  export function hasLinkedSuccessor(db, sourceQitemId, target) {
291
+ if (successorScope?.db === db && successorScope.covers(sourceQitemId))
292
+ return successorScope.has(sourceQitemId, target);
279
293
  const successor = db
280
294
  .prepare(`SELECT 1 FROM queue_items s
281
295
  WHERE (s.qitem_id = ? OR s.destination_session = ?) AND s.qitem_id != ?
@@ -289,6 +303,57 @@ export function hasLinkedSuccessor(db, sourceQitemId, target) {
289
303
  .get(target, target, sourceQitemId, sourceQitemId, sourceQitemId);
290
304
  return Boolean(successor);
291
305
  }
306
+ /** The linked-successor index lent to hasLinkedSuccessor by createLinkedSuccessorLookup's run(), for one synchronous call. */
307
+ let successorScope = null;
308
+ /** hasLinkedSuccessor for a whole set of sources in one read, for a pass that asks it once per row (the stuck sweep's
309
+ * custody loop, and the handoff advisory of each row it reads). The read keeps the per-row query's own predicates: a
310
+ * successor is a row whose handed_off_from is the source, or whose chain_of_record is valid JSON with the source among
311
+ * its json_each values (compared as `value IN (...)` compares, like `value = ?`: a number or a nested value never
312
+ * equals a text id); has() then checks qitem_id or destination_session against the target and that the successor is
313
+ * not the source itself. A snapshot from its first has() until invalidate(): the caller invalidates it whenever other
314
+ * code could have run. run(fn) lends it, for the synchronous fn only, to the hasLinkedSuccessor calls made inside fn
315
+ * for a covered source; any other source keeps the per-row query. */
316
+ export function createLinkedSuccessorLookup(db, sourceQitemIds) {
317
+ const sources = new Set(sourceQitemIds);
318
+ let bySource = null;
319
+ const build = () => {
320
+ const map = new Map();
321
+ const ids = JSON.stringify([...sources]);
322
+ const rows = db.prepare(`SELECT s.qitem_id, s.destination_session, s.handed_off_from AS source FROM queue_items s
323
+ WHERE s.handed_off_from IN (SELECT value FROM json_each(?))
324
+ UNION
325
+ SELECT s.qitem_id, s.destination_session, j.value AS source FROM queue_items s, json_each(s.chain_of_record) j
326
+ WHERE s.chain_of_record IS NOT NULL AND json_valid(s.chain_of_record)
327
+ AND j.value IN (SELECT value FROM json_each(?))`).all(ids, ids);
328
+ for (const r of rows) {
329
+ const list = map.get(r.source);
330
+ const entry = { qitemId: r.qitem_id, destination: r.destination_session };
331
+ if (list)
332
+ list.push(entry);
333
+ else
334
+ map.set(r.source, [entry]);
335
+ }
336
+ return map;
337
+ };
338
+ const has = (sourceQitemId, target) => (bySource ??= build()).get(sourceQitemId)?.some((s) => s.qitemId !== sourceQitemId && (s.qitemId === target || s.destination === target)) ?? false;
339
+ const own = { db, covers: (source) => sources.has(source), has };
340
+ return {
341
+ has,
342
+ run: (fn) => {
343
+ if (successorScope?.db === db)
344
+ return fn();
345
+ const previous = successorScope;
346
+ successorScope = own;
347
+ try {
348
+ return fn();
349
+ }
350
+ finally {
351
+ successorScope = previous;
352
+ }
353
+ },
354
+ invalidate: () => { bySource = null; },
355
+ };
356
+ }
292
357
  /** PL-007 — defensive column probe. Older test fixtures bypass the
293
358
  * canonical migration list, so target_repo may be absent. Mirrors
294
359
  * the `hasNodeColumn` pattern in rig-repository.ts. */
@@ -474,6 +539,7 @@ export class QueueRepository {
474
539
  promptClearRetries = new Map();
475
540
  resolveOccupantGeneration;
476
541
  resolveSessionAddresses;
542
+ hasPendingPostCompactStage;
477
543
  wakeRepo;
478
544
  watchdogJobsRepo;
479
545
  /** PL-007 Workspace Primitive — true when migration 038 has applied the
@@ -516,6 +582,7 @@ export class QueueRepository {
516
582
  this.workflowFrontierPredicate = opts?.workflowFrontierPredicate;
517
583
  this.resolveOccupantGeneration = opts?.resolveOccupantGeneration;
518
584
  this.resolveSessionAddresses = opts?.resolveSessionAddresses ?? ((name) => [name]);
585
+ this.hasPendingPostCompactStage = opts?.hasPendingPostCompactStage;
519
586
  this.loadHumanRegistryFn = opts?.loadHumanRegistry ?? (() => loadHumanRegistry());
520
587
  this.sharedChannelsFn = opts?.sharedChannels ?? (() => sharedChannelAddresses());
521
588
  this.hostedWakeFn = opts?.hostedWake ?? defaultHostedWake;
@@ -598,6 +665,19 @@ export class QueueRepository {
598
665
  }
599
666
  currentWakeIntent(entry) {
600
667
  const row = entry.auditPointer ? this.db.prepare("SELECT state, destination_session FROM queue_items WHERE qitem_id=?").get(entry.auditPointer) : undefined;
668
+ // That notice stays current while the row stays closed by the close that made it; every other wake, while its row
669
+ // waits on its destination. A reopen and another close end it: its text names the earlier successor.
670
+ if (entry.outboxId.startsWith(CLAIM_OVERRIDDEN_WAKE_PREFIX)) {
671
+ if (row === undefined || !isTerminalState(row.state) || row.destination_session !== entry.destinationSession)
672
+ return false;
673
+ const closed = TERMINAL_QUEUE_STATES.map(() => "?").join(",");
674
+ const close = this.db.prepare(`SELECT transition_id FROM (
675
+ SELECT transition_id, state, LAG(state) OVER (ORDER BY transition_id) AS previous_state
676
+ FROM queue_transitions WHERE qitem_id=?)
677
+ WHERE state IN (${closed}) AND (previous_state IS NULL OR previous_state NOT IN (${closed})) ORDER BY transition_id DESC LIMIT 1`)
678
+ .get(entry.auditPointer, ...TERMINAL_QUEUE_STATES, ...TERMINAL_QUEUE_STATES);
679
+ return Number(entry.outboxId.slice(CLAIM_OVERRIDDEN_WAKE_PREFIX.length)) === close?.transition_id;
680
+ }
601
681
  if (row?.state !== "pending" || row.destination_session !== entry.destinationSession)
602
682
  return false;
603
683
  const prefix = `${WAKE_INTENT_PREFIX}blocker-`;
@@ -673,10 +753,15 @@ export class QueueRepository {
673
753
  // isn't echoed back. A later park of it on a person is a new ask, classified (and posted) on that update.
674
754
  if (input.gatewayInbound)
675
755
  return { kind: "human-required", level: "RECORD" };
676
- // The person's Slack subscription decides: `every-ask` (the default) posts every ask (ALERT); `urgent-only` posts only
677
- // one marked --alert, and a plain ask lands on Steering and the TUI (RECORD: below the posting dial, so no post is owed).
756
+ // Slack subscription filters only apply when Slack is the primary connector. When a person's primary connector
757
+ // is relay (or by default when no Slack subscription restricts it), plain asks post by default (`every-ask`),
758
+ // so ordinary relay asks post (ALERT) independently of any retained Slack-specific subscription.
678
759
  const person = people.find((entity) => entity.address === destinationHuman);
679
- const posts = input.humanAlert === true || slackSubscriptionFor(person).preset === "every-ask";
760
+ const primaryBinding = person?.connectorBindings.find((b) => b.role === "primary");
761
+ const posts = input.humanAlert === true
762
+ || (primaryBinding?.kind === "relay"
763
+ ? true
764
+ : slackSubscriptionFor(person).preset === "every-ask");
680
765
  return input.humanIntent === "update"
681
766
  ? { kind: "human-update", level: "NOTICE" }
682
767
  : { kind: "human-required", level: posts ? "ALERT" : "RECORD" };
@@ -765,8 +850,10 @@ export class QueueRepository {
765
850
  // Draft-aware wakes remain pending until the transport owns their bounded
766
851
  // retry. Manual retention is deliberately never drained.
767
852
  const draftTarget = this.transport?.draftAwareTarget?.(input.toSession);
853
+ // The same rule as a held message (#2430): the sender's own held messages there count as room, since this wake
854
+ // coalesces them if it settles as held.
768
855
  if (draftTarget)
769
- this.outbox.assertRetentionCapacity(draftTarget.nodeId, frozenEnvelope);
856
+ this.outbox.assertRetentionCapacity(draftTarget.nodeId, frozenEnvelope, input.fromSession, [input.outboxId]);
770
857
  this.outbox.record(record);
771
858
  const binding = this.transport?.deliveryTarget?.(input.toSession);
772
859
  if (binding)
@@ -1035,36 +1122,60 @@ export class QueueRepository {
1035
1122
  }
1036
1123
  /** Recover current notifications once per pass. A snapshot horizon and seek cursor
1037
1124
  * prevent new arrivals or persistent failures from making this pass unbounded. `stopRequested` is checked before
1038
- * each delivery: a stopped pass leaves the notifications it has not attempted as they are, for the next start. */
1125
+ * each delivery: a stopped pass leaves the notifications it has not attempted as they are, for the next start.
1126
+ * A notification already tried for a seat that still has no session or transport would only fail again, so it isn't
1127
+ * claimed, alone or in a group: it stays as it is, its row stays owed, and the pass reports it as waiting. The
1128
+ * receiver is read at each claim, so a seat that starts during the pass gets its later notifications. */
1039
1129
  async drainPendingWakeIntents(opts) {
1040
1130
  const tally = { delivered: 0, indeterminate: 0, failed: 0, retained: 0 };
1041
1131
  if (!this.outbox || !this.transport)
1042
1132
  return tally;
1133
+ const attempted = new Set();
1134
+ // Notifications left alone for want of a receiver; one a later claim in this pass attempted isn't waiting.
1135
+ const skipped = new Map();
1136
+ const result = () => {
1137
+ const waitingBySeat = new Map();
1138
+ for (const [outboxId, seat] of skipped)
1139
+ if (!attempted.has(outboxId))
1140
+ waitingBySeat.set(seat, (waitingBySeat.get(seat) ?? 0) + 1);
1141
+ if (waitingBySeat.size)
1142
+ tally.waiting = { notifications: [...waitingBySeat.values()].reduce((a, b) => a + b, 0), seats: [...waitingBySeat.keys()] };
1143
+ return tally;
1144
+ };
1043
1145
  const BATCH = 200;
1044
1146
  const horizon = this.db.prepare("SELECT COALESCE(MAX(rowid),0) AS id FROM outbox_entries").get().id;
1045
1147
  // Retire never-attempted obsolete notifications without materializing historical intents.
1046
1148
  tally.failed += this.db.prepare(`UPDATE outbox_entries AS o SET delivery_state = 'failed',
1047
1149
  tags = json_insert(COALESCE(tags, '[]'), '$[#]', 'queue:wake-superseded')
1048
1150
  WHERE delivery_state = 'pending' AND rowid <= ? AND substr(outbox_id, 1, ?) = ?
1151
+ AND substr(outbox_id, 1, ?) != ?
1049
1152
  AND NOT EXISTS (SELECT 1 FROM queue_items q WHERE q.qitem_id = o.audit_pointer
1050
1153
  AND q.state = 'pending' AND q.destination_session = o.destination_session)`)
1051
- .run(horizon, WAKE_INTENT_PREFIX.length, WAKE_INTENT_PREFIX).changes;
1052
- const attempted = new Set();
1154
+ .run(horizon, WAKE_INTENT_PREFIX.length, WAKE_INTENT_PREFIX, CLAIM_OVERRIDDEN_WAKE_PREFIX.length, CLAIM_OVERRIDDEN_WAKE_PREFIX).changes;
1053
1155
  // A stop also refuses every later claim inside a delivery: coalesced peers and members it releases for their own send.
1054
- const eligible = () => !opts?.stopRequested?.();
1156
+ // So does a missing receiver, for a notification already tried. One never tried still gets its attempt, so its row
1157
+ // records why it didn't land.
1158
+ const eligible = (entry) => {
1159
+ if (opts?.stopRequested?.())
1160
+ return false;
1161
+ if (entry.deliveryState === "pending" || !this.wakeHasNoReceiver(entry.destinationSession))
1162
+ return true;
1163
+ skipped.set(entry.outboxId, entry.destinationSession);
1164
+ return false;
1165
+ };
1055
1166
  let cursor = 0;
1056
1167
  for (;;) {
1057
1168
  const pending = this.db.prepare(`SELECT o.rowid AS id, o.outbox_id FROM outbox_entries o
1058
- JOIN queue_items q ON q.qitem_id = o.audit_pointer AND q.state = 'pending'
1169
+ JOIN queue_items q ON q.qitem_id = o.audit_pointer AND (q.state = 'pending' OR substr(o.outbox_id, 1, ?) = ?)
1059
1170
  AND q.destination_session = o.destination_session
1060
1171
  WHERE o.rowid > ? AND o.rowid <= ? AND substr(o.outbox_id, 1, ?) = ?
1061
1172
  AND o.delivery_state IN ('pending','failed','indeterminate') ORDER BY o.rowid LIMIT ?`)
1062
- .all(cursor, horizon, WAKE_INTENT_PREFIX.length, WAKE_INTENT_PREFIX, BATCH);
1173
+ .all(CLAIM_OVERRIDDEN_WAKE_PREFIX.length, CLAIM_OVERRIDDEN_WAKE_PREFIX, cursor, horizon, WAKE_INTENT_PREFIX.length, WAKE_INTENT_PREFIX, BATCH);
1063
1174
  if (pending.length === 0)
1064
1175
  break;
1065
1176
  for (const intent of pending) {
1066
1177
  if (opts?.stopRequested?.())
1067
- return tally;
1178
+ return result();
1068
1179
  cursor = intent.id;
1069
1180
  const outcome = await this.deliverWakeIntent(intent.outbox_id, attempted, eligible);
1070
1181
  if (outcome !== "skipped")
@@ -1073,7 +1184,25 @@ export class QueueRepository {
1073
1184
  if (pending.length < BATCH)
1074
1185
  break; // served short batch ⇒ drained
1075
1186
  }
1076
- return tally;
1187
+ return result();
1188
+ }
1189
+ /** Positive evidence only that a wake can't land now: no transport can hold the address, or the newest session
1190
+ * under the name the transport sends to has stopped (exited, or detached because its tmux session is gone). A
1191
+ * canonical address resolves to its current physical session first. Anything unknown may have a receiver. */
1192
+ wakeHasNoReceiver(destinationSession) {
1193
+ try {
1194
+ const destClass = this.classifyDestinationOf(destinationSession).class;
1195
+ if (destClass === "unroutable")
1196
+ return true;
1197
+ if (destClass !== "pane-bound")
1198
+ return false;
1199
+ const newest = this.db.prepare("SELECT status FROM sessions WHERE session_name = ? ORDER BY id DESC LIMIT 1")
1200
+ .get(physicalSessionName(this.db, destinationSession));
1201
+ return newest?.status === "exited" || newest?.status === "detached";
1202
+ }
1203
+ catch {
1204
+ return false;
1205
+ }
1077
1206
  }
1078
1207
  /**
1079
1208
  * Issue a default nudge to the destination after a create / handoff /
@@ -1130,6 +1259,10 @@ export class QueueRepository {
1130
1259
  return;
1131
1260
  if (addresses.every(address => this.promptRecoveryState.get(address) === false))
1132
1261
  return;
1262
+ // A compaction's "Compacted" is also a clear. While its turn boundary, restore or audit is still owed, a retried wake
1263
+ // would reach the agent before its restore (#2575): stay armed, and the next clear after those steps retries it.
1264
+ if ([sessionName, ...addresses].some(address => this.hasPendingPostCompactStage?.(address)))
1265
+ return;
1133
1266
  for (const address of addresses)
1134
1267
  this.promptRecoveryState.set(address, false);
1135
1268
  // Correlation may expand the group or release members for separate sends. Each claim must
@@ -1138,13 +1271,22 @@ export class QueueRepository {
1138
1271
  if (entry.deliveryState !== "failed" || !entry.auditPointer)
1139
1272
  return false;
1140
1273
  const current = this.getById(entry.auditPointer), refusal = current?.lastNudgeWireResult;
1141
- return current?.state === "pending" && addresses.includes(current.destinationSession)
1274
+ const notice = entry.outboxId.startsWith(CLAIM_OVERRIDDEN_WAKE_PREFIX);
1275
+ return (current?.state === "pending" || notice) && addresses.includes(current?.destinationSession ?? "")
1142
1276
  && (refusal === "failed:target_needs_input" || (refusal?.startsWith("failed:Refused:") === true && refusal.includes("interactive prompt")));
1143
1277
  };
1278
+ const seats = addresses.map(() => "?").join(",");
1279
+ const refused = (q) => `(${q}last_nudge_result LIKE 'failed:Refused:%interactive prompt%' OR ${q}last_nudge_result = 'failed:target_needs_input')`;
1280
+ // A closed row is here only for a failed override notice, found from the notice by its id range, so this never
1281
+ // reads the host's other failed history.
1144
1282
  const rows = this.db.prepare(`SELECT qitem_id, destination_session, source_session, last_nudge_result
1145
- FROM queue_items WHERE state = 'pending' AND destination_session IN (${addresses.map(() => "?").join(",")})
1146
- AND (last_nudge_result LIKE 'failed:Refused:%interactive prompt%' OR last_nudge_result = 'failed:target_needs_input')`)
1147
- .all(...addresses);
1283
+ FROM queue_items WHERE state = 'pending' AND destination_session IN (${seats}) AND ${refused("")}
1284
+ UNION
1285
+ SELECT q.qitem_id, q.destination_session, q.source_session, q.last_nudge_result
1286
+ FROM outbox_entries o JOIN queue_items q ON q.qitem_id = o.audit_pointer AND q.destination_session = o.destination_session
1287
+ WHERE o.outbox_id >= ? AND o.outbox_id < ? AND +o.delivery_state = 'failed' AND +o.destination_session IN (${seats})
1288
+ AND ${refused("q.")}`)
1289
+ .all(...addresses, CLAIM_OVERRIDDEN_WAKE_PREFIX, CLAIM_OVERRIDDEN_WAKE_END, ...addresses);
1148
1290
  const attempted = new Set();
1149
1291
  // Reserve the whole selection before awaiting: a correlated send can include several rows.
1150
1292
  // Its refusal stays durable, but must not re-arm this same clear-triggered pass.
@@ -1310,9 +1452,10 @@ export class QueueRepository {
1310
1452
  async createHumanAnswer(input) {
1311
1453
  const { episodeKey, ...create } = input;
1312
1454
  // A runner's permission request is answered in its ask, and the runner reads the answer back. No reply row: it
1313
- // would wake the runner's terminal, where typed text reads as a prompt to its agent.
1455
+ // would wake the runner's terminal, where typed text reads as a prompt to its agent. A host pairing request is
1456
+ // answered in its ask too: the pairing poll reads it there, and nothing reads a reply.
1314
1457
  const ask = this.getById(input.inboundReplyTo);
1315
- if (ask && runnerPermissionOrigin(ask))
1458
+ if (ask && (runnerPermissionOrigin(ask) || isHostPairingAsk(ask)))
1316
1459
  return ask;
1317
1460
  const qitemId = humanAnswerId(input.inboundReplyTo, episodeKey);
1318
1461
  const existing = episodeKey ? this.getById(qitemId) : this.getHumanAnswer(input.inboundReplyTo, input.sourceSession);
@@ -2008,6 +2151,9 @@ export class QueueRepository {
2008
2151
  }
2009
2152
  const ts = new Date().toISOString();
2010
2153
  const events = [];
2154
+ const overriddenClaim = input.claimedAtBeforeForward !== undefined && source.claimedAt != null
2155
+ && source.claimedAt !== input.claimedAtBeforeForward ? source.claimedAt : null;
2156
+ let overrideWake = null;
2011
2157
  const txn = this.db.transaction(() => {
2012
2158
  this.db
2013
2159
  .prepare(`UPDATE queue_items
@@ -2018,18 +2164,42 @@ export class QueueRepository {
2018
2164
  closure_target = ?
2019
2165
  WHERE qitem_id = ?`)
2020
2166
  .run(input.terminalState, ts, input.toSession, input.closureTarget, input.qitemId);
2021
- this.transitionLog.append({
2167
+ const note = input.transitionNote ?? `cross-host handoff to ${input.toSession}`;
2168
+ const closeTransition = this.transitionLog.append({
2022
2169
  qitemId: input.qitemId,
2023
2170
  state: input.terminalState,
2024
2171
  actorSession: input.fromSession,
2025
2172
  // BR-1: the minted note carries the TWO-PART toSession only — the
2026
2173
  // host-qualified successor key is allowed in closure_target and nowhere
2027
2174
  // else, and transition_note is a durable carrier.
2028
- transitionNote: input.transitionNote ?? `cross-host handoff to ${input.toSession}`,
2175
+ transitionNote: overriddenClaim
2176
+ ? `${note} (this overrode ${source.destinationSession}'s claim made at ${overriddenClaim}, while the handoff was forwarded)`
2177
+ : note,
2029
2178
  closureReason: "handed_off_to",
2030
2179
  closureTarget: input.closureTarget,
2031
2180
  identityProvenance: input.identityProvenance ?? null,
2032
2181
  });
2182
+ if (overriddenClaim && source.destinationSession !== input.fromSession) {
2183
+ const successor = input.successorQitemId ? ` as ${input.successorQitemId}` : "";
2184
+ try {
2185
+ overrideWake = this.db.transaction(() => this.recordWakeIntent({
2186
+ outboxId: `${CLAIM_OVERRIDDEN_WAKE_PREFIX}${closeTransition.transitionId}`,
2187
+ auditPointer: input.qitemId,
2188
+ qitemId: input.qitemId,
2189
+ fromSession: input.fromSession,
2190
+ toSession: source.destinationSession,
2191
+ identityProvenance: sideEffectProvenance(input.identityProvenance),
2192
+ bareBody: `${input.qitemId} was handed off to ${input.toSession}${successor} while you claimed it, so your claim is superseded and that seat has the work. Stop work on ${input.qitemId}; to carry on with it, coordinate with ${input.toSession}.`,
2193
+ tags: [WAKE_TRIGGER_OPENRIG_TAG],
2194
+ }))();
2195
+ }
2196
+ catch (err) {
2197
+ // As a handoff's own wake: a full held-message quota doesn't undo a close whose successor already exists.
2198
+ if (err.code !== "retained_quota_full")
2199
+ throw err;
2200
+ this.recordNudgeAttempt(input.qitemId, `${WAKE_NOT_RETAINED}${err.message}`);
2201
+ }
2202
+ }
2033
2203
  // OPR.0.5.8.1 S1b — third member of the handoff family, same bypass.
2034
2204
  this.retireParkGeneratedTimer(input.qitemId, `park_ended:${input.terminalState}`);
2035
2205
  const handoffEvent = this.eventBus.persistWithinTransaction({
@@ -2060,6 +2230,8 @@ export class QueueRepository {
2060
2230
  for (const e of events) {
2061
2231
  this.eventBus.notifySubscribers(e);
2062
2232
  }
2233
+ if (overrideWake)
2234
+ this.deliverWakeIntentAfterCommit(overrideWake);
2063
2235
  return { item: this.getByIdOrThrow(input.qitemId), absorbed: false };
2064
2236
  }
2065
2237
  /**
@@ -3034,8 +3206,10 @@ export class QueueRepository {
3034
3206
  })();
3035
3207
  if (!result)
3036
3208
  return false;
3037
- for (const event of result.persistedEvents)
3038
- this.eventBus.notifySubscribers(event);
3209
+ for (const event of result.persistedEvents) {
3210
+ if (!this.eventBus.registerPersistedWithinActiveEnvelope(event))
3211
+ this.eventBus.notifySubscribers(event);
3212
+ }
3039
3213
  return mine;
3040
3214
  }
3041
3215
  /** Another person's committed return to this ask: its shared reply (for a park's question, `episodeKey`'s). It's the
@@ -3160,10 +3334,20 @@ export class QueueRepository {
3160
3334
  /** The opaque revision of what a person decides on (#2446): the question (body, intent, questions) and its decision state
3161
3335
  * (open, blocked or terminal; who it's addressed to or parked on; its answers, a decision made for them, the current park,
3162
3336
  * and the replies returned). A label, a wake, a claim or a note on a park doesn't change it; a new park does, on any blocker. */
3163
- decisionRevision(item) {
3337
+ decisionRevision(item, opts) {
3164
3338
  const phase = item.state === "blocked" ? "blocked" : item.state === "pending" || item.state === "in-progress" ? "open" : item.state;
3165
- const replies = this.hasReplyToColumn ? this.db.prepare("SELECT qitem_id FROM queue_items WHERE reply_to = ? ORDER BY ts_created, rowid")
3166
- .all(item.qitemId).map((row) => row.qitem_id) : [];
3339
+ const excludeOp = typeof opts?.excludeOperationReply === "string" && opts.excludeOperationReply.length > 0
3340
+ ? mcOperationTag(opts.excludeOperationReply)
3341
+ : null;
3342
+ const replies = this.hasReplyToColumn
3343
+ ? (excludeOp
3344
+ ? this.db
3345
+ .prepare("SELECT qitem_id FROM queue_items WHERE reply_to = ? AND NOT (tags IS NOT NULL AND json_valid(tags) AND EXISTS (SELECT 1 FROM json_each(tags) WHERE value = ?)) ORDER BY ts_created, rowid")
3346
+ .all(item.qitemId, excludeOp)
3347
+ : this.db
3348
+ .prepare("SELECT qitem_id FROM queue_items WHERE reply_to = ? ORDER BY ts_created, rowid")
3349
+ .all(item.qitemId)).map((row) => row.qitem_id)
3350
+ : [];
3167
3351
  // The park this is: the transition into blocked from another state (a later blocked-to-blocked note stays this park).
3168
3352
  const transitions = item.state === "blocked" ? this.transitionLog.listForQitem(item.qitemId) : [];
3169
3353
  let parkEntry = null;
@@ -3175,6 +3359,79 @@ export class QueueRepository {
3175
3359
  item.humanAnswers ?? null, item.delegatedDecision ?? null, this.currentHumanRequiredEpisode(item.qitemId)?.key ?? null, parkEntry, replies];
3176
3360
  return `dr1-${createHash("sha256").update(JSON.stringify(decision)).digest("hex").slice(0, 24)}`;
3177
3361
  }
3362
+ listRelayOwnerNotificationReceipts(qitemId) {
3363
+ return this.transitionLog.listRelayOwnerNotificationReceipts(qitemId);
3364
+ }
3365
+ getRelayOwnerNotificationReceipt(qitemId, notificationKey) {
3366
+ return this.transitionLog.getRelayOwnerNotificationReceipt(qitemId, notificationKey);
3367
+ }
3368
+ hasRelayOwnerNotificationReceipt(qitemId, notificationKey) {
3369
+ return this.transitionLog.hasRelayOwnerNotificationReceipt(qitemId, notificationKey);
3370
+ }
3371
+ findRelayOwnerNotificationReceiptByReplyRef(replyRef) {
3372
+ return this.transitionLog.findRelayOwnerNotificationReceiptByReplyRef(replyRef);
3373
+ }
3374
+ recordRelayOwnerNotificationTransportFailed(input) {
3375
+ const current = this.getByIdOrThrow(input.qitemId);
3376
+ const key = typeof input.notificationKey === "string" && input.notificationKey.trim().length > 0
3377
+ ? input.notificationKey.trim()
3378
+ : input.qitemId;
3379
+ const normalizedConnectorRef = typeof input.connectorRef === "string" && input.connectorRef.trim().length > 0
3380
+ ? input.connectorRef.trim()
3381
+ : null;
3382
+ const previousFailure = this.transitionLog
3383
+ .listForQitem(input.qitemId)
3384
+ .filter((transition) => (transition.transitionNote?.startsWith("slack-owner-notification-transport-failed ") ||
3385
+ transition.transitionNote?.startsWith(`${RELAY_OWNER_NOTIFICATION_TRANSPORT_FAILED_PREFIX} `)) &&
3386
+ transition.transitionNote.split(/\s+/).includes(`notification_key=${key}`))
3387
+ .at(-1);
3388
+ if (previousFailure?.transitionNote?.startsWith(`${RELAY_OWNER_NOTIFICATION_TRANSPORT_FAILED_PREFIX} `)) {
3389
+ const parsedPrevious = parseRelayOwnerNotificationTransportFailed(previousFailure.transitionNote);
3390
+ if (parsedPrevious && parsedPrevious.connectorRef === normalizedConnectorRef) {
3391
+ return current;
3392
+ }
3393
+ }
3394
+ const note = formatRelayOwnerNotificationTransportFailed({
3395
+ notificationKey: key,
3396
+ connectorRef: normalizedConnectorRef,
3397
+ failureClass: input.failureClass,
3398
+ detail: input.detail,
3399
+ });
3400
+ return this.update({
3401
+ qitemId: input.qitemId,
3402
+ actorSession: input.actorSession ?? "daemon@kernel",
3403
+ transitionNote: note,
3404
+ });
3405
+ }
3406
+ recordRelayOwnerNotificationAccepted(input) {
3407
+ const current = this.getByIdOrThrow(input.qitemId);
3408
+ const isUpdate = current.humanIntent === "update" &&
3409
+ current.state !== "blocked" &&
3410
+ !current.blockedOn &&
3411
+ this.isPersonAddress(current.destinationSession);
3412
+ const shouldCloseUpdate = isUpdate && input.closeUpdate !== false && isBlockerLive(current.state);
3413
+ if (this.transitionLog.hasRelayOwnerNotificationReceipt(input.qitemId, input.notificationKey)) {
3414
+ if (shouldCloseUpdate) {
3415
+ return this.update({
3416
+ qitemId: input.qitemId,
3417
+ actorSession: input.actorSession ?? "daemon@kernel",
3418
+ state: "done",
3419
+ closureReason: "no-follow-on",
3420
+ });
3421
+ }
3422
+ return current;
3423
+ }
3424
+ const note = formatRelayOwnerNotificationAccepted({
3425
+ ...input,
3426
+ revision: input.revision ?? this.decisionRevision(current),
3427
+ });
3428
+ return this.update({
3429
+ qitemId: input.qitemId,
3430
+ actorSession: input.actorSession ?? "daemon@kernel",
3431
+ ...(shouldCloseUpdate ? { state: "done", closureReason: "no-follow-on" } : {}),
3432
+ transitionNote: note,
3433
+ });
3434
+ }
3178
3435
  currentHumanRequiredEpisode(qitemId) {
3179
3436
  const episode = this.transitionLog.listForQitem(qitemId).filter((transition) => transition.ownerNotificationKind === "human-required").at(-1);
3180
3437
  if (!episode)
@@ -3290,7 +3547,7 @@ export class QueueRepository {
3290
3547
  return {
3291
3548
  ...item,
3292
3549
  deliveryOutcome: ledger?.outcome ?? null,
3293
- ...(ledger && ledger.outcome !== "posted" ? { deliveryFailureDetail: ledger.detail } : {}),
3550
+ ...(ledger && ledger.outcome !== "posted" && ledger.outcome !== "accepted" ? { deliveryFailureDetail: ledger.detail } : {}),
3294
3551
  ...(item.replyTo ? { replyToFallback: this.replyToFallbackFor(item.qitemId) } : {}),
3295
3552
  };
3296
3553
  }
@@ -3363,6 +3620,10 @@ export class QueueRepository {
3363
3620
  return rows.map((r) => ({ qitemId: r.qitem_id, state: r.state, summary: r.summary ?? null }));
3364
3621
  }
3365
3622
  list(opts) {
3623
+ // one recovery index for the whole listing (built on first use) instead of one json_each scan per row
3624
+ return withRecoveryIndex(this.db, () => this.listRows(opts));
3625
+ }
3626
+ listRows(opts) {
3366
3627
  const limit = opts?.limit ?? 100;
3367
3628
  const conditions = [];
3368
3629
  const params = [];
@@ -3424,7 +3685,7 @@ export class QueueRepository {
3424
3685
  return {
3425
3686
  ...item,
3426
3687
  deliveryOutcome: ledger?.outcome ?? null,
3427
- ...(ledger && ledger.outcome !== "posted" ? { deliveryFailureDetail: ledger.detail } : {}),
3688
+ ...(ledger && ledger.outcome !== "posted" && ledger.outcome !== "accepted" ? { deliveryFailureDetail: ledger.detail } : {}),
3428
3689
  };
3429
3690
  });
3430
3691
  return opts?.compact ? items.map(compactRow) : items;
@@ -3470,10 +3731,20 @@ export class QueueRepository {
3470
3731
  SELECT q.*, r.ts AS delivered_at, r.transition_note AS delivery_receipt
3471
3732
  FROM queue_items q JOIN (${receipts}) r ON r.qitem_id = q.qitem_id
3472
3733
  WHERE q.human_intent = 'update' AND is_human_seat_session(q.destination_session) = 1
3473
- AND r.transition_note LIKE 'slack-owner-notification-posted %'
3734
+ AND (r.transition_note LIKE 'slack-owner-notification-posted %' OR r.transition_note LIKE 'relay-owner-notification-accepted %')
3474
3735
  ORDER BY r.ts DESC, q.qitem_id DESC LIMIT ?
3475
3736
  `).all(limit);
3476
- return rows.map((row) => ({ ...this.rowToItem(row), deliveredAt: row.delivered_at, deliveryReceipt: row.delivery_receipt }));
3737
+ return rows.map((row) => {
3738
+ const deliveryOutcome = row.delivery_receipt.startsWith(`${RELAY_OWNER_NOTIFICATION_ACCEPTED_PREFIX} `)
3739
+ ? "accepted"
3740
+ : "posted";
3741
+ return {
3742
+ ...this.rowToItem(row),
3743
+ deliveryOutcome,
3744
+ deliveredAt: row.delivered_at,
3745
+ deliveryReceipt: row.delivery_receipt,
3746
+ };
3747
+ });
3477
3748
  }
3478
3749
  /** Current explicit human FYIs; delivery receipts are not required for local visibility.
3479
3750
  * Filter before the bounded window so agent and malformed destinations cannot hide updates. */
@@ -3566,6 +3837,10 @@ export class QueueRepository {
3566
3837
  const cutoff = opts?.now ?? new Date().toISOString();
3567
3838
  const conditions = ["state = 'in-progress'", "closure_required_at IS NOT NULL", "closure_required_at <= ?"];
3568
3839
  const params = [cutoff];
3840
+ if (opts?.qitemId !== undefined) {
3841
+ conditions.push("qitem_id = ?");
3842
+ params.push(opts.qitemId);
3843
+ }
3569
3844
  if (opts?.rig) {
3570
3845
  const escaped = opts.rig.replace(/%/g, "\\%").replace(/_/g, "\\_");
3571
3846
  conditions.push("(destination_session LIKE ? ESCAPE '\\' OR source_session LIKE ? ESCAPE '\\')");
@@ -3653,9 +3928,15 @@ export class QueueRepository {
3653
3928
  OR EXISTS (SELECT 1 FROM queue_transitions receipt
3654
3929
  WHERE receipt.qitem_id = queue_items.qitem_id
3655
3930
  AND (receipt.transition_note LIKE 'slack-owner-notification-posted %'
3656
- OR receipt.transition_note LIKE 'slack-owner-notification-transport-failed %')))`,
3931
+ OR receipt.transition_note LIKE 'relay-owner-notification-accepted %'
3932
+ OR receipt.transition_note LIKE 'slack-owner-notification-transport-failed %'
3933
+ OR receipt.transition_note LIKE 'relay-owner-notification-transport-failed %')))`,
3657
3934
  ];
3658
3935
  const params = [];
3936
+ if (opts?.qitemId !== undefined) {
3937
+ conditions.push("qitem_id = ?");
3938
+ params.push(opts.qitemId);
3939
+ }
3659
3940
  if (opts?.rig) {
3660
3941
  const escaped = opts.rig.replace(/%/g, "\\%").replace(/_/g, "\\_");
3661
3942
  conditions.push("(destination_session LIKE ? ESCAPE '\\' OR source_session LIKE ? ESCAPE '\\')");
@@ -3668,7 +3949,7 @@ export class QueueRepository {
3668
3949
  for (const r of rows) {
3669
3950
  const item = this.rowToItem(r, !opts?.compact);
3670
3951
  const ledger = this.deliveryOutcomeFor(item.qitemId);
3671
- if (ledger?.outcome === "posted")
3952
+ if (ledger?.outcome === "posted" || ledger?.outcome === "accepted")
3672
3953
  continue; // the receipt wins, always
3673
3954
  if (ledger?.outcome === "transport-failed") {
3674
3955
  out.push({
@@ -3738,6 +4019,20 @@ export class QueueRepository {
3738
4019
  return false;
3739
4020
  }
3740
4021
  }
4022
+ /** #514 — a pending explicit informational update addressed to a currently registered human
4023
+ * (external or canonical alias, regardless of terminal transport) is correspondence for reading,
4024
+ * not an obligation to claim. Registry unavailable/unregistered and agent destinations read false. */
4025
+ isRegisteredHumanUpdate(row) {
4026
+ if (row.state !== "pending" || row.humanIntent !== "update")
4027
+ return false;
4028
+ try {
4029
+ const registry = this.loadHumanRegistryFn();
4030
+ return registry.ok && resolveRegisteredHumanAddress(row.destinationSession, registry.entities) !== null;
4031
+ }
4032
+ catch {
4033
+ return false;
4034
+ }
4035
+ }
3741
4036
  classifyDestinationOf(destinationSession) {
3742
4037
  return classifyDestination(destinationSession, {
3743
4038
  entities: (() => {
@@ -3832,20 +4127,28 @@ export class QueueRepository {
3832
4127
  const ledger = this.deliveryLedger(qitemId);
3833
4128
  return ledger ? { outcome: ledger.outcome, detail: ledger.detail } : null;
3834
4129
  }
3835
- /** #514 — true only when this row's CURRENT human-notification episode (OWNER history addressed
3836
- * to a registered human, aliases included) has a POSTED receipt. Legacy rows with no OWNER
4130
+ /** OPR.0.5.6.14 + #514 — true when the row's CURRENT ask episode (create-time pending ask
4131
+ * to a registered human, aliases included) has a POSTED or ACCEPTED receipt. Legacy rows with no OWNER
3837
4132
  * history, inactive episodes, never-posted and transport-failed all read false. Same derivation
3838
4133
  * as deliveryOutcomeFor; it reads row fields, never the waiting view. */
3839
4134
  humanNotificationPostedThisEpisode(qitemId, listed) {
4135
+ return this.humanNotificationDeliveryThisEpisode(qitemId, listed) !== null;
4136
+ }
4137
+ humanNotificationDeliveryThisEpisode(qitemId, listed) {
3840
4138
  if (!this.hasQueueTransitionsTable)
3841
- return false;
4139
+ return null;
3842
4140
  const owners = listed?.owners ?? this.transitionLog.ownerNotificationsForQitems([qitemId]).get(qitemId) ?? [];
3843
4141
  const owner = this.currentAskNotification(qitemId, owners);
3844
4142
  if (!owner)
3845
- return false;
4143
+ return null;
3846
4144
  // The ledger's episode exists only when the destination resolves to a registered human (aliases included).
3847
4145
  const ledger = listed ? listed.ledger : this.deliveryLedger(qitemId, owners);
3848
- return ledger !== null && ledger.outcome === "posted" && ledger.episode?.notificationKey === `${qitemId}:${owner.transitionId}`;
4146
+ if (ledger !== null &&
4147
+ (ledger.outcome === "posted" || ledger.outcome === "accepted") &&
4148
+ ledger.episode?.notificationKey === `${qitemId}:${owner.transitionId}`) {
4149
+ return ledger.outcome;
4150
+ }
4151
+ return null;
3849
4152
  }
3850
4153
  /** The ask's own notification while it still binds its recipient. Only that notification does: create writes it in
3851
4154
  * state pending, to the destination of that moment. A park notice (its recipient is not retained), a resolution notice,
@@ -3927,7 +4230,9 @@ export class QueueRepository {
3927
4230
  receiptNotesFor(qitemIds) {
3928
4231
  this.receiptNotesStatement ??= this.db.prepare(`SELECT qitem_id, transition_note FROM queue_transitions
3929
4232
  WHERE qitem_id IN (SELECT value FROM json_each(?)) AND (transition_note LIKE 'slack-owner-notification-posted %'
3930
- OR transition_note LIKE 'slack-owner-notification-transport-failed %')
4233
+ OR transition_note LIKE 'relay-owner-notification-accepted %'
4234
+ OR transition_note LIKE 'slack-owner-notification-transport-failed %'
4235
+ OR transition_note LIKE 'relay-owner-notification-transport-failed %')
3931
4236
  ORDER BY transition_id DESC`);
3932
4237
  const notes = new Map();
3933
4238
  for (const row of this.receiptNotesStatement.all(JSON.stringify(qitemIds))) {
@@ -3947,7 +4252,11 @@ export class QueueRepository {
3947
4252
  const posted = currentNotes.find((note) => note.startsWith("slack-owner-notification-posted "));
3948
4253
  if (posted)
3949
4254
  return { outcome: "posted", detail: posted, episode };
3950
- const failed = currentNotes.find((note) => note.startsWith("slack-owner-notification-transport-failed "));
4255
+ const accepted = currentNotes.find((note) => note.startsWith("relay-owner-notification-accepted "));
4256
+ if (accepted)
4257
+ return { outcome: "accepted", detail: accepted, episode };
4258
+ const failed = currentNotes.find((note) => note.startsWith("slack-owner-notification-transport-failed ") ||
4259
+ note.startsWith(`${RELAY_OWNER_NOTIFICATION_TRANSPORT_FAILED_PREFIX} `));
3951
4260
  if (failed)
3952
4261
  return { outcome: "transport-failed", detail: failed, episode };
3953
4262
  if (episode?.quiet)
@@ -4208,6 +4517,19 @@ export class QueueRepository {
4208
4517
  }
4209
4518
  activityReader;
4210
4519
  attachActivityReader(reader) { this.activityReader = reader; }
4520
+ /** #2661 (c): since when (ISO) the daemon owes a seat its managed post-compaction stages, or null. */
4521
+ compactionReader;
4522
+ attachCompactionReader(reader) { this.compactionReader = reader; }
4523
+ compactionOwedSince(session) {
4524
+ if (!session)
4525
+ return null;
4526
+ try {
4527
+ return this.compactionReader?.(session) ?? null;
4528
+ }
4529
+ catch {
4530
+ return null;
4531
+ }
4532
+ }
4211
4533
  workflowGuidance;
4212
4534
  attachWorkflowGuidance(reader) { this.workflowGuidance = reader; }
4213
4535
  evaluateWaitReminder(input) {
@@ -4241,17 +4563,26 @@ export class QueueRepository {
4241
4563
  if (view && ["pending", "in-progress"].includes(view.state)) {
4242
4564
  // #514 — the unclaimed sweep skips a pending ask already posted to its human in the current
4243
4565
  // episode (same predicate as runStuckSweep), so the view must not promise that sweep.
4244
- const posted = view.state === "pending" && this.humanNotificationPostedThisEpisode(qitemId, listed);
4566
+ const episodeDelivery = view.state === "pending" ? this.humanNotificationDeliveryThisEpisode(qitemId, listed) : null;
4567
+ const posted = episodeDelivery !== null;
4245
4568
  const onSteering = !posted && view.state === "pending" && this.humanAskWithoutAlert(qitemId, listed);
4246
- const row = !posted && !onSteering ? this.db.prepare(`SELECT state, ${this.hasHumanIntentColumn ? "human_intent" : "NULL AS human_intent"}, destination_session, last_nudge_result FROM queue_items WHERE qitem_id = ?`).get(qitemId) : undefined;
4247
- const noticeOutcome = listed ? listed.ledger?.outcome : this.deliveryOutcomeFor(qitemId)?.outcome;
4248
- const localOnly = !!row && noticeOutcome !== "never-posted" && noticeOutcome !== "transport-failed"
4569
+ const row = view.state === "pending" && !onSteering
4570
+ ? this.db.prepare(`SELECT state, ${this.hasHumanIntentColumn ? "human_intent" : "NULL AS human_intent"}, destination_session, last_nudge_result FROM queue_items WHERE qitem_id = ?`).get(qitemId)
4571
+ : undefined;
4572
+ const humanUpdate = !!row && this.isRegisteredHumanUpdate({ state: row.state, humanIntent: row.human_intent, destinationSession: row.destination_session });
4573
+ const noticeOutcome = !posted && !onSteering ? (listed ? listed.ledger?.outcome : this.deliveryOutcomeFor(qitemId)?.outcome) : undefined;
4574
+ const localOnly = !!row && !posted && !humanUpdate && noticeOutcome !== "never-posted" && noticeOutcome !== "transport-failed"
4249
4575
  && this.isLocalHumanDecisionWithoutGateway({ state: row.state, humanIntent: row.human_intent, destinationSession: row.destination_session, lastNudgeResult: row.last_nudge_result });
4250
4576
  const awaitingHuman = posted || onSteering || localOnly;
4251
- if (awaitingHuman) {
4577
+ if (awaitingHuman || humanUpdate) {
4578
+ const deliveryPhrase = episodeDelivery === "accepted" ? "accepted by the bridge" : "posted to the human";
4252
4579
  view.nextBackstop = { owner: view.owner, mechanism: localOnly ? "local attention feed (no registered human gateway)" : onSteering
4253
4580
  ? "none (on Steering for the human, with no Slack alert; awaiting their decision)"
4254
- : "none (posted to the human; awaiting their decision)", dueAt: null, intervalSeconds: null };
4581
+ : humanUpdate
4582
+ ? posted
4583
+ ? `none (${deliveryPhrase}; informational correspondence requires no claim)`
4584
+ : "none (informational correspondence to the human; no claim required)"
4585
+ : `none (${deliveryPhrase}; awaiting their decision)`, dueAt: null, intervalSeconds: null };
4255
4586
  }
4256
4587
  // Quiet hours: a held ask is owned by its window's release job until it posts.
4257
4588
  const quiet = awaitingHuman ? null : quietCustodyBackstop(view.owner, quietHoldCustody(this.db, qitemId));
@@ -4261,7 +4592,7 @@ export class QueueRepository {
4261
4592
  }
4262
4593
  const recovery = readWakeLadderBackstop(this.db, qitemId, target => this.acceptsDestination(target));
4263
4594
  if (recovery && !localOnly) {
4264
- if (!awaitingHuman)
4595
+ if (!awaitingHuman && !humanUpdate)
4265
4596
  view.laterBackstop = { ...view.nextBackstop, note: "Conditional safety net; current delivery/recovery ownership is evaluated first." };
4266
4597
  view.nextBackstop = recovery;
4267
4598
  }
@@ -4307,8 +4638,8 @@ export class QueueRepository {
4307
4638
  target,
4308
4639
  reason: "no-live-local-successor",
4309
4640
  message: foreignTarget
4310
- ? `Successor custody for '${target}' is unverified on this daemon: the successor is named on that host, and this daemon cannot read its custody. This closure records a handoff claim, not proof of transfer or pickup. Use 'rig queue handoff' or 'handoff-and-complete': a local handoff is atomic, across hosts the successor is created first and the source closed after, and an uncertain result is reconciled by its exact id, since re-running the same handoff is idempotent.`
4311
- : `Successor custody for '${target}' is unverified on this daemon: no local row with this source's lineage was found. A successor may exist on another host. This closure records a handoff claim, not proof of transfer or pickup; reconcile the successor by ID. Use 'rig queue handoff' or 'handoff-and-complete': a local handoff is atomic, across hosts the successor is created first and the source closed after, and an uncertain result is reconciled by its exact id, since re-running the same handoff is idempotent.`,
4641
+ ? `Successor custody for '${target}' is unverified on this daemon: the successor is named on that host, and this daemon cannot read its custody. This closure records a handoff claim, not proof of transfer or pickup. Use 'rig queue handoff' or 'handoff-and-complete' with '--to <seat@rig>'; add '--host <registered-host>' for another host instead of manually closing to the successor ID; a local handoff is atomic, across hosts the successor is created first and the source closed after, and an uncertain result is reconciled by its exact id, since re-running the same handoff is idempotent.`
4642
+ : `Successor custody for '${target}' is unverified on this daemon: no local row with this source's lineage was found. A successor may exist on another host. This closure records a handoff claim, not proof of transfer or pickup; reconcile the successor by ID. Use 'rig queue handoff' or 'handoff-and-complete' with '--to <seat@rig>'; add '--host <registered-host>' for another host instead of manually closing to the successor ID; a local handoff is atomic, across hosts the successor is created first and the source closed after, and an uncertain result is reconciled by its exact id, since re-running the same handoff is idempotent.`,
4312
4643
  };
4313
4644
  }
4314
4645
  rowToItem(row, includeWaiting = true, listed) {
@@ -4323,6 +4654,8 @@ export class QueueRepository {
4323
4654
  activity: activity?.activity,
4324
4655
  needsInput: activity?.needsInput.count,
4325
4656
  needsInputReason: activity?.needsInput.reason,
4657
+ backgroundWork: activity?.backgroundWork ?? null,
4658
+ compactionOwedSince: this.compactionOwedSince(row.destination_session),
4326
4659
  claimedAt: row.claimed_at,
4327
4660
  lastHeartbeat: row.last_heartbeat,
4328
4661
  postClaimMotionCount: 0, // this reader supplies the current meaningful timestamp