@openrig/cli 0.7.11 → 0.7.13

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 (958) hide show
  1. package/README.md +9 -6
  2. package/daemon/assets/guidance/openrig-context-entry.md +8 -0
  3. package/daemon/assets/herdr-app/mods/rig-cell-header/main.js +15 -0
  4. package/daemon/assets/herdr-app/mods/rig-cell-header/mod.json +1 -0
  5. package/daemon/assets/herdr-app/mods/rig-ended/main.js +14 -0
  6. package/daemon/assets/herdr-app/mods/rig-ended/mod.json +1 -0
  7. package/daemon/assets/herdr-app/mods/rig-pad/main.js +10 -0
  8. package/daemon/assets/herdr-app/mods/rig-pad/mod.json +1 -0
  9. package/daemon/assets/herdr-app/mods/rig-strip/main.js +153 -0
  10. package/daemon/assets/herdr-app/mods/rig-strip/mod.json +1 -0
  11. package/daemon/assets/plugins/openrig/.claude-plugin/icon.png +0 -0
  12. package/daemon/assets/plugins/openrig/.claude-plugin/plugin.json +2 -2
  13. package/daemon/assets/plugins/openrig/.codex-plugin/plugin.json +4 -2
  14. package/daemon/assets/plugins/openrig/.cursor-plugin/plugin.json +1 -1
  15. package/daemon/assets/plugins/openrig/plugin.json +2 -2
  16. package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +2 -2
  17. package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +5 -3
  18. package/daemon/assets/plugins/openrig-core/README.md +6 -0
  19. package/daemon/assets/plugins/openrig-core/hooks/scripts/activity-relay.cjs +140 -0
  20. package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus-state.cjs +103 -0
  21. package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus.cjs +194 -87
  22. package/daemon/assets/plugins/openrig-core/skills/agent-operated-software/SKILL.md +5 -1
  23. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/SKILL.md +3 -2
  24. package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +1 -1
  25. package/daemon/assets/plugins/openrig-core/skills/retiring-and-inheriting-a-seat/SKILL.md +1 -1
  26. package/daemon/assets/plugins/openrig-core/skills/seat-continuity-and-handover/SKILL.md +10 -6
  27. package/daemon/assets/plugins/openrig-core/skills/session-compaction-and-restore/SKILL.md +1 -1
  28. package/daemon/assets/skills/rigs/SKILL.md +43 -4
  29. package/daemon/context-packs/help/help.md +18 -0
  30. package/daemon/context-packs/help/manifest.yaml +1 -1
  31. package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
  32. package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +74 -26
  33. package/daemon/context-packs/reference/getting-started.md +41 -14
  34. package/daemon/context-packs/reference/manifest.yaml +1 -1
  35. package/daemon/context-packs/reference/rig-spec.md +29 -9
  36. package/daemon/context-packs/reference/tmux-servers.md +6 -3
  37. package/daemon/context-packs/reference/whats-new.md +300 -295
  38. package/daemon/context-packs/skills/agent-operated-software/SKILL.md +5 -1
  39. package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
  40. package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
  41. package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
  42. package/daemon/context-packs/skills/claude-compaction-restore/SKILL.md +3 -2
  43. package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
  44. package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
  45. package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
  46. package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
  47. package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
  48. package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
  49. package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
  50. package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
  51. package/daemon/context-packs/skills/core/openrig-herdr/SKILL.md +1 -0
  52. package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
  53. package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
  54. package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
  55. package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
  56. package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
  57. package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
  58. package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
  59. package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
  60. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
  61. package/daemon/context-packs/skills/core/watchdog/SKILL.md +5 -0
  62. package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
  63. package/daemon/context-packs/skills/core/working-with-an-openrig-team/manifest.yaml +1 -1
  64. package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
  65. package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
  66. package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
  67. package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
  68. package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
  69. package/daemon/context-packs/skills/openrig-user/SKILL.md +1 -1
  70. package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
  71. package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
  72. package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
  73. package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
  74. package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
  75. package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
  76. package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
  77. package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
  78. package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
  79. package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
  80. package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
  81. package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
  82. package/daemon/context-packs/skills/pods/review-team/SKILL.md +2 -0
  83. package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
  84. package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
  85. package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
  86. package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
  87. package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
  88. package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
  89. package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
  90. package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
  91. package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
  92. package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
  93. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/SKILL.md +1 -1
  94. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
  95. package/daemon/context-packs/skills/seat-continuity-and-handover/SKILL.md +10 -6
  96. package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
  97. package/daemon/context-packs/skills/session-compaction-and-restore/SKILL.md +1 -1
  98. package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
  99. package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
  100. package/daemon/context-packs/world-example/manifest.yaml +1 -1
  101. package/daemon/context-packs/world-public/manifest.yaml +1 -1
  102. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  103. package/daemon/dist/adapters/claude-code-adapter.js +18 -3
  104. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  105. package/daemon/dist/adapters/claude-resume.d.ts +2 -1
  106. package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
  107. package/daemon/dist/adapters/claude-resume.js +13 -5
  108. package/daemon/dist/adapters/claude-resume.js.map +1 -1
  109. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  110. package/daemon/dist/adapters/codex-runtime-adapter.js +18 -2
  111. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  112. package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts +10 -6
  113. package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts.map +1 -1
  114. package/daemon/dist/adapters/community-harness-runtime-adapter.js +78 -24
  115. package/daemon/dist/adapters/community-harness-runtime-adapter.js.map +1 -1
  116. package/daemon/dist/adapters/pi-community-runtime-adapter.d.ts +27 -0
  117. package/daemon/dist/adapters/pi-community-runtime-adapter.d.ts.map +1 -0
  118. package/daemon/dist/adapters/pi-community-runtime-adapter.js +38 -0
  119. package/daemon/dist/adapters/pi-community-runtime-adapter.js.map +1 -0
  120. package/daemon/dist/adapters/pi-runner-protocol.d.ts +5 -3
  121. package/daemon/dist/adapters/pi-runner-protocol.d.ts.map +1 -1
  122. package/daemon/dist/adapters/pi-runner-protocol.js +6 -1
  123. package/daemon/dist/adapters/pi-runner-protocol.js.map +1 -1
  124. package/daemon/dist/adapters/pi-runner.d.ts +58 -5
  125. package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
  126. package/daemon/dist/adapters/pi-runner.js +441 -52
  127. package/daemon/dist/adapters/pi-runner.js.map +1 -1
  128. package/daemon/dist/adapters/pi-runtime-adapter.d.ts +32 -15
  129. package/daemon/dist/adapters/pi-runtime-adapter.d.ts.map +1 -1
  130. package/daemon/dist/adapters/pi-runtime-adapter.js +41 -10
  131. package/daemon/dist/adapters/pi-runtime-adapter.js.map +1 -1
  132. package/daemon/dist/adapters/tmux-exec.d.ts.map +1 -1
  133. package/daemon/dist/adapters/tmux-exec.js +13 -4
  134. package/daemon/dist/adapters/tmux-exec.js.map +1 -1
  135. package/daemon/dist/adapters/tmux-server.d.ts +11 -1
  136. package/daemon/dist/adapters/tmux-server.d.ts.map +1 -1
  137. package/daemon/dist/adapters/tmux-server.js +37 -5
  138. package/daemon/dist/adapters/tmux-server.js.map +1 -1
  139. package/daemon/dist/adapters/tmux.d.ts +14 -1
  140. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  141. package/daemon/dist/adapters/tmux.js +77 -15
  142. package/daemon/dist/adapters/tmux.js.map +1 -1
  143. package/daemon/dist/attention-surface.d.ts +7 -0
  144. package/daemon/dist/attention-surface.d.ts.map +1 -1
  145. package/daemon/dist/attention-surface.js.map +1 -1
  146. package/daemon/dist/build-info.js +3 -3
  147. package/daemon/dist/connection-contract-surface.d.ts +2 -0
  148. package/daemon/dist/connection-contract-surface.d.ts.map +1 -0
  149. package/daemon/dist/connection-contract-surface.js +4 -0
  150. package/daemon/dist/connection-contract-surface.js.map +1 -0
  151. package/daemon/dist/db/all-migrations.d.ts.map +1 -1
  152. package/daemon/dist/db/all-migrations.js +16 -0
  153. package/daemon/dist/db/all-migrations.js.map +1 -1
  154. package/daemon/dist/db/migrations/155_queue_erasure.d.ts +12 -0
  155. package/daemon/dist/db/migrations/155_queue_erasure.d.ts.map +1 -0
  156. package/daemon/dist/db/migrations/155_queue_erasure.js +28 -0
  157. package/daemon/dist/db/migrations/155_queue_erasure.js.map +1 -0
  158. package/daemon/dist/db/migrations/156_queue_erasure_link_indexes.d.ts +4 -0
  159. package/daemon/dist/db/migrations/156_queue_erasure_link_indexes.d.ts.map +1 -0
  160. package/daemon/dist/db/migrations/156_queue_erasure_link_indexes.js +14 -0
  161. package/daemon/dist/db/migrations/156_queue_erasure_link_indexes.js.map +1 -0
  162. package/daemon/dist/db/migrations/157_queue_erasure_batches.d.ts +9 -0
  163. package/daemon/dist/db/migrations/157_queue_erasure_batches.d.ts.map +1 -0
  164. package/daemon/dist/db/migrations/157_queue_erasure_batches.js +18 -0
  165. package/daemon/dist/db/migrations/157_queue_erasure_batches.js.map +1 -0
  166. package/daemon/dist/db/migrations/158_queue_inbox_checkins.d.ts +8 -0
  167. package/daemon/dist/db/migrations/158_queue_inbox_checkins.d.ts.map +1 -0
  168. package/daemon/dist/db/migrations/158_queue_inbox_checkins.js +15 -0
  169. package/daemon/dist/db/migrations/158_queue_inbox_checkins.js.map +1 -0
  170. package/daemon/dist/db/migrations/159_queue_items_handed_off_from_index.d.ts +5 -0
  171. package/daemon/dist/db/migrations/159_queue_items_handed_off_from_index.d.ts.map +1 -0
  172. package/daemon/dist/db/migrations/159_queue_items_handed_off_from_index.js +9 -0
  173. package/daemon/dist/db/migrations/159_queue_items_handed_off_from_index.js.map +1 -0
  174. package/daemon/dist/db/migrations/160_network_bindings.d.ts +7 -0
  175. package/daemon/dist/db/migrations/160_network_bindings.d.ts.map +1 -0
  176. package/daemon/dist/db/migrations/160_network_bindings.js +26 -0
  177. package/daemon/dist/db/migrations/160_network_bindings.js.map +1 -0
  178. package/daemon/dist/db/migrations/161_network_receipts.d.ts +8 -0
  179. package/daemon/dist/db/migrations/161_network_receipts.d.ts.map +1 -0
  180. package/daemon/dist/db/migrations/161_network_receipts.js +25 -0
  181. package/daemon/dist/db/migrations/161_network_receipts.js.map +1 -0
  182. package/daemon/dist/db/migrations/162_session_address_read_indexes.d.ts +5 -0
  183. package/daemon/dist/db/migrations/162_session_address_read_indexes.d.ts.map +1 -0
  184. package/daemon/dist/db/migrations/162_session_address_read_indexes.js +12 -0
  185. package/daemon/dist/db/migrations/162_session_address_read_indexes.js.map +1 -0
  186. package/daemon/dist/domain/agent-activity-store.d.ts +12 -2
  187. package/daemon/dist/domain/agent-activity-store.d.ts.map +1 -1
  188. package/daemon/dist/domain/agent-activity-store.js +25 -7
  189. package/daemon/dist/domain/agent-activity-store.js.map +1 -1
  190. package/daemon/dist/domain/bootstrap-orchestrator.d.ts.map +1 -1
  191. package/daemon/dist/domain/bootstrap-orchestrator.js +5 -0
  192. package/daemon/dist/domain/bootstrap-orchestrator.js.map +1 -1
  193. package/daemon/dist/domain/builtin-startup-files.d.ts +8 -0
  194. package/daemon/dist/domain/builtin-startup-files.d.ts.map +1 -1
  195. package/daemon/dist/domain/builtin-startup-files.js +37 -11
  196. package/daemon/dist/domain/builtin-startup-files.js.map +1 -1
  197. package/daemon/dist/domain/claude-compaction-enforcer.d.ts +30 -17
  198. package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
  199. package/daemon/dist/domain/claude-compaction-enforcer.js +140 -66
  200. package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
  201. package/daemon/dist/domain/claude-continuation-launch.d.ts +16 -0
  202. package/daemon/dist/domain/claude-continuation-launch.d.ts.map +1 -0
  203. package/daemon/dist/domain/claude-continuation-launch.js +110 -0
  204. package/daemon/dist/domain/claude-continuation-launch.js.map +1 -0
  205. package/daemon/dist/domain/claude-git-trust-root.d.ts +11 -0
  206. package/daemon/dist/domain/claude-git-trust-root.d.ts.map +1 -0
  207. package/daemon/dist/domain/claude-git-trust-root.js +72 -0
  208. package/daemon/dist/domain/claude-git-trust-root.js.map +1 -0
  209. package/daemon/dist/domain/claude-managed-launch.d.ts +1 -0
  210. package/daemon/dist/domain/claude-managed-launch.d.ts.map +1 -1
  211. package/daemon/dist/domain/claude-managed-launch.js +5 -5
  212. package/daemon/dist/domain/claude-managed-launch.js.map +1 -1
  213. package/daemon/dist/domain/community-harness-presets.d.ts +5 -0
  214. package/daemon/dist/domain/community-harness-presets.d.ts.map +1 -1
  215. package/daemon/dist/domain/community-harness-presets.js +33 -6
  216. package/daemon/dist/domain/community-harness-presets.js.map +1 -1
  217. package/daemon/dist/domain/compaction-restore-notice.d.ts +3 -1
  218. package/daemon/dist/domain/compaction-restore-notice.d.ts.map +1 -1
  219. package/daemon/dist/domain/compaction-restore-notice.js +37 -6
  220. package/daemon/dist/domain/compaction-restore-notice.js.map +1 -1
  221. package/daemon/dist/domain/connection-contract.d.ts +111 -0
  222. package/daemon/dist/domain/connection-contract.d.ts.map +1 -0
  223. package/daemon/dist/domain/connection-contract.js +113 -0
  224. package/daemon/dist/domain/connection-contract.js.map +1 -0
  225. package/daemon/dist/domain/current-work.d.ts +52 -0
  226. package/daemon/dist/domain/current-work.d.ts.map +1 -1
  227. package/daemon/dist/domain/current-work.js +215 -0
  228. package/daemon/dist/domain/current-work.js.map +1 -1
  229. package/daemon/dist/domain/default-receiver.d.ts +40 -0
  230. package/daemon/dist/domain/default-receiver.d.ts.map +1 -0
  231. package/daemon/dist/domain/default-receiver.js +70 -0
  232. package/daemon/dist/domain/default-receiver.js.map +1 -0
  233. package/daemon/dist/domain/draft-aware-delivery.js +1 -1
  234. package/daemon/dist/domain/draft-aware-delivery.js.map +1 -1
  235. package/daemon/dist/domain/escalation-owner.d.ts.map +1 -1
  236. package/daemon/dist/domain/escalation-owner.js +8 -3
  237. package/daemon/dist/domain/escalation-owner.js.map +1 -1
  238. package/daemon/dist/domain/event-bus.d.ts +16 -8
  239. package/daemon/dist/domain/event-bus.d.ts.map +1 -1
  240. package/daemon/dist/domain/event-bus.js +50 -16
  241. package/daemon/dist/domain/event-bus.js.map +1 -1
  242. package/daemon/dist/domain/execution-view.d.ts.map +1 -1
  243. package/daemon/dist/domain/execution-view.js +30 -5
  244. package/daemon/dist/domain/execution-view.js.map +1 -1
  245. package/daemon/dist/domain/gateway/gateway-subsystem.d.ts +3 -0
  246. package/daemon/dist/domain/gateway/gateway-subsystem.d.ts.map +1 -1
  247. package/daemon/dist/domain/gateway/gateway-subsystem.js +9 -0
  248. package/daemon/dist/domain/gateway/gateway-subsystem.js.map +1 -1
  249. package/daemon/dist/domain/gateway/human-quiet-windows.d.ts +2 -1
  250. package/daemon/dist/domain/gateway/human-quiet-windows.d.ts.map +1 -1
  251. package/daemon/dist/domain/gateway/human-quiet-windows.js +2 -1
  252. package/daemon/dist/domain/gateway/human-quiet-windows.js.map +1 -1
  253. package/daemon/dist/domain/gateway/human-registry.d.ts +12 -1
  254. package/daemon/dist/domain/gateway/human-registry.d.ts.map +1 -1
  255. package/daemon/dist/domain/gateway/human-registry.js +64 -8
  256. package/daemon/dist/domain/gateway/human-registry.js.map +1 -1
  257. package/daemon/dist/domain/gateway/relay-config.d.ts +5 -2
  258. package/daemon/dist/domain/gateway/relay-config.d.ts.map +1 -1
  259. package/daemon/dist/domain/gateway/relay-config.js +34 -3
  260. package/daemon/dist/domain/gateway/relay-config.js.map +1 -1
  261. package/daemon/dist/domain/gateway/relay-inbound.d.ts +11 -0
  262. package/daemon/dist/domain/gateway/relay-inbound.d.ts.map +1 -1
  263. package/daemon/dist/domain/gateway/relay-inbound.js +283 -41
  264. package/daemon/dist/domain/gateway/relay-inbound.js.map +1 -1
  265. package/daemon/dist/domain/gateway/relay-outbound.d.ts +5 -2
  266. package/daemon/dist/domain/gateway/relay-outbound.d.ts.map +1 -1
  267. package/daemon/dist/domain/gateway/relay-outbound.js +37 -6
  268. package/daemon/dist/domain/gateway/relay-outbound.js.map +1 -1
  269. package/daemon/dist/domain/gateway/slack/config.d.ts +21 -0
  270. package/daemon/dist/domain/gateway/slack/config.d.ts.map +1 -1
  271. package/daemon/dist/domain/gateway/slack/config.js +30 -3
  272. package/daemon/dist/domain/gateway/slack/config.js.map +1 -1
  273. package/daemon/dist/domain/gateway/slack/message.d.ts +4 -0
  274. package/daemon/dist/domain/gateway/slack/message.d.ts.map +1 -1
  275. package/daemon/dist/domain/gateway/slack/message.js +7 -2
  276. package/daemon/dist/domain/gateway/slack/message.js.map +1 -1
  277. package/daemon/dist/domain/gateway/slack/open-asks.d.ts +13 -1
  278. package/daemon/dist/domain/gateway/slack/open-asks.d.ts.map +1 -1
  279. package/daemon/dist/domain/gateway/slack/open-asks.js +58 -7
  280. package/daemon/dist/domain/gateway/slack/open-asks.js.map +1 -1
  281. package/daemon/dist/domain/gateway/slack/outbound-driver.d.ts +9 -0
  282. package/daemon/dist/domain/gateway/slack/outbound-driver.d.ts.map +1 -1
  283. package/daemon/dist/domain/gateway/slack/outbound-driver.js.map +1 -1
  284. package/daemon/dist/domain/gateway/slack/settled-asks.d.ts.map +1 -1
  285. package/daemon/dist/domain/gateway/slack/settled-asks.js +19 -1
  286. package/daemon/dist/domain/gateway/slack/settled-asks.js.map +1 -1
  287. package/daemon/dist/domain/gateway/slack/slack-api.d.ts +3 -0
  288. package/daemon/dist/domain/gateway/slack/slack-api.d.ts.map +1 -1
  289. package/daemon/dist/domain/gateway/slack/slack-api.js +12 -4
  290. package/daemon/dist/domain/gateway/slack/slack-api.js.map +1 -1
  291. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts +2 -0
  292. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts.map +1 -1
  293. package/daemon/dist/domain/gateway/slack/slack-delivery.js +38 -12
  294. package/daemon/dist/domain/gateway/slack/slack-delivery.js.map +1 -1
  295. package/daemon/dist/domain/gateway/slack/slack-recovery.d.ts +12 -1
  296. package/daemon/dist/domain/gateway/slack/slack-recovery.d.ts.map +1 -1
  297. package/daemon/dist/domain/gateway/slack/slack-recovery.js +68 -10
  298. package/daemon/dist/domain/gateway/slack/slack-recovery.js.map +1 -1
  299. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
  300. package/daemon/dist/domain/gateway/slack/slack-subsystem.js +151 -47
  301. package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
  302. package/daemon/dist/domain/gateway/slack/socket-inbound.d.ts +1 -0
  303. package/daemon/dist/domain/gateway/slack/socket-inbound.d.ts.map +1 -1
  304. package/daemon/dist/domain/gateway/slack/socket-inbound.js +5 -0
  305. package/daemon/dist/domain/gateway/slack/socket-inbound.js.map +1 -1
  306. package/daemon/dist/domain/gateway/slack/state-store.d.ts +4 -0
  307. package/daemon/dist/domain/gateway/slack/state-store.d.ts.map +1 -1
  308. package/daemon/dist/domain/gateway/slack/state-store.js +4 -1
  309. package/daemon/dist/domain/gateway/slack/state-store.js.map +1 -1
  310. package/daemon/dist/domain/gateway/slack/thread-recovery.d.ts +23 -3
  311. package/daemon/dist/domain/gateway/slack/thread-recovery.d.ts.map +1 -1
  312. package/daemon/dist/domain/gateway/slack/thread-recovery.js +52 -10
  313. package/daemon/dist/domain/gateway/slack/thread-recovery.js.map +1 -1
  314. package/daemon/dist/domain/gateway/slack/thread-seat-map.d.ts +4 -1
  315. package/daemon/dist/domain/gateway/slack/thread-seat-map.d.ts.map +1 -1
  316. package/daemon/dist/domain/gateway/slack/thread-seat-map.js +7 -4
  317. package/daemon/dist/domain/gateway/slack/thread-seat-map.js.map +1 -1
  318. package/daemon/dist/domain/guidance-projection.d.ts +39 -0
  319. package/daemon/dist/domain/guidance-projection.d.ts.map +1 -0
  320. package/daemon/dist/domain/guidance-projection.js +91 -0
  321. package/daemon/dist/domain/guidance-projection.js.map +1 -0
  322. package/daemon/dist/domain/health-passive-ceremony.d.ts.map +1 -1
  323. package/daemon/dist/domain/health-passive-ceremony.js +31 -12
  324. package/daemon/dist/domain/health-passive-ceremony.js.map +1 -1
  325. package/daemon/dist/domain/hosted-wake.d.ts +5 -1
  326. package/daemon/dist/domain/hosted-wake.d.ts.map +1 -1
  327. package/daemon/dist/domain/hosted-wake.js +13 -3
  328. package/daemon/dist/domain/hosted-wake.js.map +1 -1
  329. package/daemon/dist/domain/install-engine.d.ts +5 -0
  330. package/daemon/dist/domain/install-engine.d.ts.map +1 -1
  331. package/daemon/dist/domain/install-engine.js +28 -26
  332. package/daemon/dist/domain/install-engine.js.map +1 -1
  333. package/daemon/dist/domain/install-verifier.d.ts +5 -1
  334. package/daemon/dist/domain/install-verifier.d.ts.map +1 -1
  335. package/daemon/dist/domain/install-verifier.js +12 -1
  336. package/daemon/dist/domain/install-verifier.js.map +1 -1
  337. package/daemon/dist/domain/launch-wrapper.d.ts +2 -1
  338. package/daemon/dist/domain/launch-wrapper.d.ts.map +1 -1
  339. package/daemon/dist/domain/launch-wrapper.js +6 -2
  340. package/daemon/dist/domain/launch-wrapper.js.map +1 -1
  341. package/daemon/dist/domain/managed-block-records.d.ts +9 -3
  342. package/daemon/dist/domain/managed-block-records.d.ts.map +1 -1
  343. package/daemon/dist/domain/managed-block-records.js +43 -8
  344. package/daemon/dist/domain/managed-block-records.js.map +1 -1
  345. package/daemon/dist/domain/managed-blocks.d.ts +43 -3
  346. package/daemon/dist/domain/managed-blocks.d.ts.map +1 -1
  347. package/daemon/dist/domain/managed-blocks.js +156 -39
  348. package/daemon/dist/domain/managed-blocks.js.map +1 -1
  349. package/daemon/dist/domain/markdown-address.d.ts.map +1 -1
  350. package/daemon/dist/domain/markdown-address.js +12 -1
  351. package/daemon/dist/domain/markdown-address.js.map +1 -1
  352. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
  353. package/daemon/dist/domain/mission-control/mission-control-write-contract.js +39 -7
  354. package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
  355. package/daemon/dist/domain/native-process-arguments.d.ts +5 -0
  356. package/daemon/dist/domain/native-process-arguments.d.ts.map +1 -1
  357. package/daemon/dist/domain/native-process-arguments.js +60 -5
  358. package/daemon/dist/domain/native-process-arguments.js.map +1 -1
  359. package/daemon/dist/domain/network/hub-client.d.ts +40 -0
  360. package/daemon/dist/domain/network/hub-client.d.ts.map +1 -0
  361. package/daemon/dist/domain/network/hub-client.js +102 -0
  362. package/daemon/dist/domain/network/hub-client.js.map +1 -0
  363. package/daemon/dist/domain/network/network-bindings.d.ts +74 -0
  364. package/daemon/dist/domain/network/network-bindings.d.ts.map +1 -0
  365. package/daemon/dist/domain/network/network-bindings.js +235 -0
  366. package/daemon/dist/domain/network/network-bindings.js.map +1 -0
  367. package/daemon/dist/domain/network/network-connector.d.ts +77 -0
  368. package/daemon/dist/domain/network/network-connector.d.ts.map +1 -0
  369. package/daemon/dist/domain/network/network-connector.js +380 -0
  370. package/daemon/dist/domain/network/network-connector.js.map +1 -0
  371. package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
  372. package/daemon/dist/domain/node-inventory.js +9 -8
  373. package/daemon/dist/domain/node-inventory.js.map +1 -1
  374. package/daemon/dist/domain/package-install-service.d.ts +1 -0
  375. package/daemon/dist/domain/package-install-service.d.ts.map +1 -1
  376. package/daemon/dist/domain/package-install-service.js +2 -1
  377. package/daemon/dist/domain/package-install-service.js.map +1 -1
  378. package/daemon/dist/domain/package-manifest.d.ts.map +1 -1
  379. package/daemon/dist/domain/package-manifest.js +10 -5
  380. package/daemon/dist/domain/package-manifest.js.map +1 -1
  381. package/daemon/dist/domain/plugin-vendor-service.d.ts +9 -0
  382. package/daemon/dist/domain/plugin-vendor-service.d.ts.map +1 -1
  383. package/daemon/dist/domain/plugin-vendor-service.js +50 -8
  384. package/daemon/dist/domain/plugin-vendor-service.js.map +1 -1
  385. package/daemon/dist/domain/policies/delivery-digest-flush.d.ts.map +1 -1
  386. package/daemon/dist/domain/policies/delivery-digest-flush.js +9 -1
  387. package/daemon/dist/domain/policies/delivery-digest-flush.js.map +1 -1
  388. package/daemon/dist/domain/policies/mode-scheduled-end.d.ts +4 -1
  389. package/daemon/dist/domain/policies/mode-scheduled-end.d.ts.map +1 -1
  390. package/daemon/dist/domain/policies/mode-scheduled-end.js +19 -10
  391. package/daemon/dist/domain/policies/mode-scheduled-end.js.map +1 -1
  392. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts.map +1 -1
  393. package/daemon/dist/domain/policies/parked-owner-consumer.js +3 -2
  394. package/daemon/dist/domain/policies/parked-owner-consumer.js.map +1 -1
  395. package/daemon/dist/domain/policies/quiet-release.d.ts +19 -6
  396. package/daemon/dist/domain/policies/quiet-release.d.ts.map +1 -1
  397. package/daemon/dist/domain/policies/quiet-release.js +44 -7
  398. package/daemon/dist/domain/policies/quiet-release.js.map +1 -1
  399. package/daemon/dist/domain/proof/judgments.d.ts +23 -13
  400. package/daemon/dist/domain/proof/judgments.d.ts.map +1 -1
  401. package/daemon/dist/domain/proof/judgments.js +75 -38
  402. package/daemon/dist/domain/proof/judgments.js.map +1 -1
  403. package/daemon/dist/domain/proof/source-watch.d.ts +1 -1
  404. package/daemon/dist/domain/proof/source-watch.d.ts.map +1 -1
  405. package/daemon/dist/domain/proof/source-watch.js +45 -22
  406. package/daemon/dist/domain/proof/source-watch.js.map +1 -1
  407. package/daemon/dist/domain/provider/claude-usage-reader.d.ts +3 -3
  408. package/daemon/dist/domain/provider/claude-usage-reader.d.ts.map +1 -1
  409. package/daemon/dist/domain/provider/claude-usage-reader.js +16 -5
  410. package/daemon/dist/domain/provider/claude-usage-reader.js.map +1 -1
  411. package/daemon/dist/domain/provider/codex-limit-banner.d.ts.map +1 -1
  412. package/daemon/dist/domain/provider/codex-limit-banner.js +2 -1
  413. package/daemon/dist/domain/provider/codex-limit-banner.js.map +1 -1
  414. package/daemon/dist/domain/provider/provider-signals.d.ts +6 -0
  415. package/daemon/dist/domain/provider/provider-signals.d.ts.map +1 -1
  416. package/daemon/dist/domain/provider/provider-signals.js +9 -3
  417. package/daemon/dist/domain/provider/provider-signals.js.map +1 -1
  418. package/daemon/dist/domain/provider/reactive-tap.d.ts.map +1 -1
  419. package/daemon/dist/domain/provider/reactive-tap.js +6 -0
  420. package/daemon/dist/domain/provider/reactive-tap.js.map +1 -1
  421. package/daemon/dist/domain/queue-blocker.d.ts +5 -0
  422. package/daemon/dist/domain/queue-blocker.d.ts.map +1 -0
  423. package/daemon/dist/domain/queue-blocker.js +12 -0
  424. package/daemon/dist/domain/queue-blocker.js.map +1 -0
  425. package/daemon/dist/domain/queue-erasure.d.ts +173 -0
  426. package/daemon/dist/domain/queue-erasure.d.ts.map +1 -0
  427. package/daemon/dist/domain/queue-erasure.js +885 -0
  428. package/daemon/dist/domain/queue-erasure.js.map +1 -0
  429. package/daemon/dist/domain/queue-owner.d.ts +6 -0
  430. package/daemon/dist/domain/queue-owner.d.ts.map +1 -1
  431. package/daemon/dist/domain/queue-owner.js +13 -4
  432. package/daemon/dist/domain/queue-owner.js.map +1 -1
  433. package/daemon/dist/domain/queue-repository.d.ts +176 -21
  434. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  435. package/daemon/dist/domain/queue-repository.js +503 -62
  436. package/daemon/dist/domain/queue-repository.js.map +1 -1
  437. package/daemon/dist/domain/queue-retention.d.ts +15 -1
  438. package/daemon/dist/domain/queue-retention.d.ts.map +1 -1
  439. package/daemon/dist/domain/queue-retention.js +35 -0
  440. package/daemon/dist/domain/queue-retention.js.map +1 -1
  441. package/daemon/dist/domain/queue-stuck-sweep.d.ts +17 -4
  442. package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
  443. package/daemon/dist/domain/queue-stuck-sweep.js +309 -100
  444. package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
  445. package/daemon/dist/domain/queue-transition-log.d.ts +5 -2
  446. package/daemon/dist/domain/queue-transition-log.d.ts.map +1 -1
  447. package/daemon/dist/domain/queue-transition-log.js +30 -5
  448. package/daemon/dist/domain/queue-transition-log.js.map +1 -1
  449. package/daemon/dist/domain/queue-waiting.d.ts +48 -2
  450. package/daemon/dist/domain/queue-waiting.d.ts.map +1 -1
  451. package/daemon/dist/domain/queue-waiting.js +73 -13
  452. package/daemon/dist/domain/queue-waiting.js.map +1 -1
  453. package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
  454. package/daemon/dist/domain/queue-wake-ladder.js +124 -55
  455. package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
  456. package/daemon/dist/domain/queue-wake-repository.d.ts +3 -0
  457. package/daemon/dist/domain/queue-wake-repository.d.ts.map +1 -1
  458. package/daemon/dist/domain/queue-wake-repository.js +6 -0
  459. package/daemon/dist/domain/queue-wake-repository.js.map +1 -1
  460. package/daemon/dist/domain/rebuild-priming-chain.d.ts +3 -1
  461. package/daemon/dist/domain/rebuild-priming-chain.d.ts.map +1 -1
  462. package/daemon/dist/domain/rebuild-priming-chain.js +3 -1
  463. package/daemon/dist/domain/rebuild-priming-chain.js.map +1 -1
  464. package/daemon/dist/domain/receiver-context.d.ts +9 -0
  465. package/daemon/dist/domain/receiver-context.d.ts.map +1 -0
  466. package/daemon/dist/domain/receiver-context.js +24 -0
  467. package/daemon/dist/domain/receiver-context.js.map +1 -0
  468. package/daemon/dist/domain/reconciler.d.ts +15 -6
  469. package/daemon/dist/domain/reconciler.d.ts.map +1 -1
  470. package/daemon/dist/domain/reconciler.js +26 -26
  471. package/daemon/dist/domain/reconciler.js.map +1 -1
  472. package/daemon/dist/domain/refocus-record.d.ts +17 -0
  473. package/daemon/dist/domain/refocus-record.d.ts.map +1 -0
  474. package/daemon/dist/domain/refocus-record.js +94 -0
  475. package/daemon/dist/domain/refocus-record.js.map +1 -0
  476. package/daemon/dist/domain/restore-check-service.js +1 -1
  477. package/daemon/dist/domain/restore-check-service.js.map +1 -1
  478. package/daemon/dist/domain/restore-guidance.d.ts +6 -4
  479. package/daemon/dist/domain/restore-guidance.d.ts.map +1 -1
  480. package/daemon/dist/domain/restore-guidance.js +43 -33
  481. package/daemon/dist/domain/restore-guidance.js.map +1 -1
  482. package/daemon/dist/domain/restore-orchestrator.d.ts +2 -0
  483. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  484. package/daemon/dist/domain/restore-orchestrator.js +39 -18
  485. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  486. package/daemon/dist/domain/restore-plan-preview.d.ts.map +1 -1
  487. package/daemon/dist/domain/restore-plan-preview.js +2 -1
  488. package/daemon/dist/domain/restore-plan-preview.js.map +1 -1
  489. package/daemon/dist/domain/resume-token-validation.d.ts +7 -0
  490. package/daemon/dist/domain/resume-token-validation.d.ts.map +1 -1
  491. package/daemon/dist/domain/resume-token-validation.js +13 -3
  492. package/daemon/dist/domain/resume-token-validation.js.map +1 -1
  493. package/daemon/dist/domain/rig-repository.js +3 -3
  494. package/daemon/dist/domain/rig-repository.js.map +1 -1
  495. package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
  496. package/daemon/dist/domain/rig-teardown.js +2 -1
  497. package/daemon/dist/domain/rig-teardown.js.map +1 -1
  498. package/daemon/dist/domain/rigs-being-built.d.ts +5 -0
  499. package/daemon/dist/domain/rigs-being-built.d.ts.map +1 -0
  500. package/daemon/dist/domain/rigs-being-built.js +18 -0
  501. package/daemon/dist/domain/rigs-being-built.js.map +1 -0
  502. package/daemon/dist/domain/rigspec-instantiator.d.ts +3 -0
  503. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  504. package/daemon/dist/domain/rigspec-instantiator.js +32 -2
  505. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  506. package/daemon/dist/domain/rigspec-preflight.d.ts.map +1 -1
  507. package/daemon/dist/domain/rigspec-preflight.js +4 -1
  508. package/daemon/dist/domain/rigspec-preflight.js.map +1 -1
  509. package/daemon/dist/domain/rigspec-schema.js +2 -2
  510. package/daemon/dist/domain/rigspec-schema.js.map +1 -1
  511. package/daemon/dist/domain/rosters.d.ts +11 -0
  512. package/daemon/dist/domain/rosters.d.ts.map +1 -1
  513. package/daemon/dist/domain/rosters.js +24 -1
  514. package/daemon/dist/domain/rosters.js.map +1 -1
  515. package/daemon/dist/domain/runner-permissions.d.ts +16 -0
  516. package/daemon/dist/domain/runner-permissions.d.ts.map +1 -1
  517. package/daemon/dist/domain/runner-permissions.js +104 -16
  518. package/daemon/dist/domain/runner-permissions.js.map +1 -1
  519. package/daemon/dist/domain/runtime-adapter.d.ts +1 -0
  520. package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
  521. package/daemon/dist/domain/runtime-adapter.js.map +1 -1
  522. package/daemon/dist/domain/scope/logical-checkbox.d.ts.map +1 -1
  523. package/daemon/dist/domain/scope/logical-checkbox.js +14 -0
  524. package/daemon/dist/domain/scope/logical-checkbox.js.map +1 -1
  525. package/daemon/dist/domain/seat-activity-service.d.ts +12 -0
  526. package/daemon/dist/domain/seat-activity-service.d.ts.map +1 -1
  527. package/daemon/dist/domain/seat-activity-service.js +85 -4
  528. package/daemon/dist/domain/seat-activity-service.js.map +1 -1
  529. package/daemon/dist/domain/seat-handover-service.d.ts +16 -1
  530. package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
  531. package/daemon/dist/domain/seat-handover-service.js +78 -15
  532. package/daemon/dist/domain/seat-handover-service.js.map +1 -1
  533. package/daemon/dist/domain/seat-identity-reconciler.d.ts +4 -0
  534. package/daemon/dist/domain/seat-identity-reconciler.d.ts.map +1 -1
  535. package/daemon/dist/domain/seat-identity-reconciler.js +18 -2
  536. package/daemon/dist/domain/seat-identity-reconciler.js.map +1 -1
  537. package/daemon/dist/domain/seat-kinds.d.ts +21 -0
  538. package/daemon/dist/domain/seat-kinds.d.ts.map +1 -0
  539. package/daemon/dist/domain/seat-kinds.js +27 -0
  540. package/daemon/dist/domain/seat-kinds.js.map +1 -0
  541. package/daemon/dist/domain/seat-launch-environment.d.ts +4 -0
  542. package/daemon/dist/domain/seat-launch-environment.d.ts.map +1 -1
  543. package/daemon/dist/domain/seat-launch-environment.js +7 -6
  544. package/daemon/dist/domain/seat-launch-environment.js.map +1 -1
  545. package/daemon/dist/domain/seat-lifecycle-service.d.ts +17 -0
  546. package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
  547. package/daemon/dist/domain/seat-lifecycle-service.js +74 -13
  548. package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
  549. package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -1
  550. package/daemon/dist/domain/seat-runtime-switch-service.js +23 -12
  551. package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
  552. package/daemon/dist/domain/seat-skill-apply.d.ts +2 -0
  553. package/daemon/dist/domain/seat-skill-apply.d.ts.map +1 -1
  554. package/daemon/dist/domain/seat-skill-apply.js +5 -2
  555. package/daemon/dist/domain/seat-skill-apply.js.map +1 -1
  556. package/daemon/dist/domain/seat-skill-storage.js +1 -1
  557. package/daemon/dist/domain/seat-skill-storage.js.map +1 -1
  558. package/daemon/dist/domain/seat-status-service.d.ts +10 -0
  559. package/daemon/dist/domain/seat-status-service.d.ts.map +1 -1
  560. package/daemon/dist/domain/seat-status-service.js +36 -2
  561. package/daemon/dist/domain/seat-status-service.js.map +1 -1
  562. package/daemon/dist/domain/seat-structural-activity-service.d.ts +8 -0
  563. package/daemon/dist/domain/seat-structural-activity-service.d.ts.map +1 -1
  564. package/daemon/dist/domain/seat-structural-activity-service.js +15 -6
  565. package/daemon/dist/domain/seat-structural-activity-service.js.map +1 -1
  566. package/daemon/dist/domain/session-jsonl.d.ts +4 -2
  567. package/daemon/dist/domain/session-jsonl.d.ts.map +1 -1
  568. package/daemon/dist/domain/session-jsonl.js +56 -22
  569. package/daemon/dist/domain/session-jsonl.js.map +1 -1
  570. package/daemon/dist/domain/session-registry.d.ts +20 -3
  571. package/daemon/dist/domain/session-registry.d.ts.map +1 -1
  572. package/daemon/dist/domain/session-registry.js +55 -8
  573. package/daemon/dist/domain/session-registry.js.map +1 -1
  574. package/daemon/dist/domain/session-transport.d.ts +30 -4
  575. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  576. package/daemon/dist/domain/session-transport.js +243 -60
  577. package/daemon/dist/domain/session-transport.js.map +1 -1
  578. package/daemon/dist/domain/slices/slice-indexer.d.ts +46 -2
  579. package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -1
  580. package/daemon/dist/domain/slices/slice-indexer.js +522 -37
  581. package/daemon/dist/domain/slices/slice-indexer.js.map +1 -1
  582. package/daemon/dist/domain/slow-op-recorder.d.ts +0 -3
  583. package/daemon/dist/domain/slow-op-recorder.d.ts.map +1 -1
  584. package/daemon/dist/domain/slow-op-recorder.js +5 -34
  585. package/daemon/dist/domain/slow-op-recorder.js.map +1 -1
  586. package/daemon/dist/domain/spec-library-workflow-scanner.d.ts +2 -0
  587. package/daemon/dist/domain/spec-library-workflow-scanner.d.ts.map +1 -1
  588. package/daemon/dist/domain/spec-library-workflow-scanner.js +22 -13
  589. package/daemon/dist/domain/spec-library-workflow-scanner.js.map +1 -1
  590. package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
  591. package/daemon/dist/domain/startup-orchestrator.js +5 -2
  592. package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
  593. package/daemon/dist/domain/startup-submission-evidence.d.ts +1 -0
  594. package/daemon/dist/domain/startup-submission-evidence.d.ts.map +1 -1
  595. package/daemon/dist/domain/startup-submission-evidence.js +18 -4
  596. package/daemon/dist/domain/startup-submission-evidence.js.map +1 -1
  597. package/daemon/dist/domain/successor-session-launcher.d.ts +5 -0
  598. package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
  599. package/daemon/dist/domain/successor-session-launcher.js +11 -6
  600. package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
  601. package/daemon/dist/domain/terminal/herdr-adapter.d.ts.map +1 -1
  602. package/daemon/dist/domain/terminal/herdr-adapter.js +3 -2
  603. package/daemon/dist/domain/terminal/herdr-adapter.js.map +1 -1
  604. package/daemon/dist/domain/terminal/herdr-app-install.d.ts +28 -0
  605. package/daemon/dist/domain/terminal/herdr-app-install.d.ts.map +1 -0
  606. package/daemon/dist/domain/terminal/herdr-app-install.js +170 -0
  607. package/daemon/dist/domain/terminal/herdr-app-install.js.map +1 -0
  608. package/daemon/dist/domain/terminal/herdr-app-layout.d.ts +79 -0
  609. package/daemon/dist/domain/terminal/herdr-app-layout.d.ts.map +1 -0
  610. package/daemon/dist/domain/terminal/herdr-app-layout.js +134 -0
  611. package/daemon/dist/domain/terminal/herdr-app-layout.js.map +1 -0
  612. package/daemon/dist/domain/terminal/herdr-app-provider.d.ts +123 -0
  613. package/daemon/dist/domain/terminal/herdr-app-provider.d.ts.map +1 -0
  614. package/daemon/dist/domain/terminal/herdr-app-provider.js +681 -0
  615. package/daemon/dist/domain/terminal/herdr-app-provider.js.map +1 -0
  616. package/daemon/dist/domain/terminal/herdr-app-state.d.ts +91 -0
  617. package/daemon/dist/domain/terminal/herdr-app-state.d.ts.map +1 -0
  618. package/daemon/dist/domain/terminal/herdr-app-state.js +140 -0
  619. package/daemon/dist/domain/terminal/herdr-app-state.js.map +1 -0
  620. package/daemon/dist/domain/terminal/herdr-app-transport.d.ts +68 -0
  621. package/daemon/dist/domain/terminal/herdr-app-transport.d.ts.map +1 -0
  622. package/daemon/dist/domain/terminal/herdr-app-transport.js +133 -0
  623. package/daemon/dist/domain/terminal/herdr-app-transport.js.map +1 -0
  624. package/daemon/dist/domain/terminal/terminal-provider.d.ts +18 -0
  625. package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
  626. package/daemon/dist/domain/terminal/terminal-service.d.ts +28 -3
  627. package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
  628. package/daemon/dist/domain/terminal/terminal-service.js +41 -8
  629. package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
  630. package/daemon/dist/domain/terminal/view-composer.d.ts.map +1 -1
  631. package/daemon/dist/domain/terminal/view-composer.js +1 -0
  632. package/daemon/dist/domain/terminal/view-composer.js.map +1 -1
  633. package/daemon/dist/domain/time-bound-advisory.js +3 -3
  634. package/daemon/dist/domain/time-bound-advisory.js.map +1 -1
  635. package/daemon/dist/domain/tmux-option-defaults.d.ts +4 -4
  636. package/daemon/dist/domain/tmux-option-defaults.d.ts.map +1 -1
  637. package/daemon/dist/domain/tmux-option-defaults.js +25 -12
  638. package/daemon/dist/domain/tmux-option-defaults.js.map +1 -1
  639. package/daemon/dist/domain/types.d.ts +54 -0
  640. package/daemon/dist/domain/types.d.ts.map +1 -1
  641. package/daemon/dist/domain/types.js.map +1 -1
  642. package/daemon/dist/domain/user-settings/settings-browser.d.ts +2 -1
  643. package/daemon/dist/domain/user-settings/settings-browser.d.ts.map +1 -1
  644. package/daemon/dist/domain/user-settings/settings-browser.js +22 -3
  645. package/daemon/dist/domain/user-settings/settings-browser.js.map +1 -1
  646. package/daemon/dist/domain/user-settings/settings-store.d.ts +1 -1
  647. package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
  648. package/daemon/dist/domain/user-settings/settings-store.js +35 -0
  649. package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
  650. package/daemon/dist/domain/wake-recovery.d.ts.map +1 -1
  651. package/daemon/dist/domain/wake-recovery.js +3 -2
  652. package/daemon/dist/domain/wake-recovery.js.map +1 -1
  653. package/daemon/dist/domain/watchdog-delivery-receipts.d.ts.map +1 -1
  654. package/daemon/dist/domain/watchdog-delivery-receipts.js +8 -3
  655. package/daemon/dist/domain/watchdog-delivery-receipts.js.map +1 -1
  656. package/daemon/dist/domain/whoami-service.d.ts +6 -0
  657. package/daemon/dist/domain/whoami-service.d.ts.map +1 -1
  658. package/daemon/dist/domain/whoami-service.js +9 -1
  659. package/daemon/dist/domain/whoami-service.js.map +1 -1
  660. package/daemon/dist/domain/workflow-projector.js +1 -1
  661. package/daemon/dist/domain/workflow-projector.js.map +1 -1
  662. package/daemon/dist/domain/workflow-runtime.js +4 -4
  663. package/daemon/dist/domain/workflow-runtime.js.map +1 -1
  664. package/daemon/dist/domain/workflow-spec-cache.d.ts +22 -0
  665. package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
  666. package/daemon/dist/domain/workflow-spec-cache.js +59 -14
  667. package/daemon/dist/domain/workflow-spec-cache.js.map +1 -1
  668. package/daemon/dist/index.d.ts +2 -1
  669. package/daemon/dist/index.d.ts.map +1 -1
  670. package/daemon/dist/index.js +11 -1
  671. package/daemon/dist/index.js.map +1 -1
  672. package/daemon/dist/lib/pane-envelope.d.ts +3 -0
  673. package/daemon/dist/lib/pane-envelope.d.ts.map +1 -1
  674. package/daemon/dist/lib/pane-envelope.js +3 -1
  675. package/daemon/dist/lib/pane-envelope.js.map +1 -1
  676. package/daemon/dist/routes/activity.d.ts.map +1 -1
  677. package/daemon/dist/routes/activity.js +122 -23
  678. package/daemon/dist/routes/activity.js.map +1 -1
  679. package/daemon/dist/routes/attention.d.ts.map +1 -1
  680. package/daemon/dist/routes/attention.js +2 -0
  681. package/daemon/dist/routes/attention.js.map +1 -1
  682. package/daemon/dist/routes/config.d.ts.map +1 -1
  683. package/daemon/dist/routes/config.js +9 -1
  684. package/daemon/dist/routes/config.js.map +1 -1
  685. package/daemon/dist/routes/events.js +7 -2
  686. package/daemon/dist/routes/events.js.map +1 -1
  687. package/daemon/dist/routes/gateway.d.ts.map +1 -1
  688. package/daemon/dist/routes/gateway.js +34 -5
  689. package/daemon/dist/routes/gateway.js.map +1 -1
  690. package/daemon/dist/routes/hosts.d.ts.map +1 -1
  691. package/daemon/dist/routes/hosts.js +154 -79
  692. package/daemon/dist/routes/hosts.js.map +1 -1
  693. package/daemon/dist/routes/network.d.ts +9 -0
  694. package/daemon/dist/routes/network.d.ts.map +1 -0
  695. package/daemon/dist/routes/network.js +58 -0
  696. package/daemon/dist/routes/network.js.map +1 -0
  697. package/daemon/dist/routes/packages.js +3 -1
  698. package/daemon/dist/routes/packages.js.map +1 -1
  699. package/daemon/dist/routes/proof.d.ts.map +1 -1
  700. package/daemon/dist/routes/proof.js +6 -4
  701. package/daemon/dist/routes/proof.js.map +1 -1
  702. package/daemon/dist/routes/provider.js +1 -1
  703. package/daemon/dist/routes/provider.js.map +1 -1
  704. package/daemon/dist/routes/queue.d.ts +19 -0
  705. package/daemon/dist/routes/queue.d.ts.map +1 -1
  706. package/daemon/dist/routes/queue.js +236 -43
  707. package/daemon/dist/routes/queue.js.map +1 -1
  708. package/daemon/dist/routes/skills.d.ts.map +1 -1
  709. package/daemon/dist/routes/skills.js +8 -2
  710. package/daemon/dist/routes/skills.js.map +1 -1
  711. package/daemon/dist/routes/slices.d.ts +1 -0
  712. package/daemon/dist/routes/slices.d.ts.map +1 -1
  713. package/daemon/dist/routes/slices.js +217 -39
  714. package/daemon/dist/routes/slices.js.map +1 -1
  715. package/daemon/dist/routes/spec-library.d.ts.map +1 -1
  716. package/daemon/dist/routes/spec-library.js +7 -3
  717. package/daemon/dist/routes/spec-library.js.map +1 -1
  718. package/daemon/dist/routes/terminal.d.ts.map +1 -1
  719. package/daemon/dist/routes/terminal.js +40 -3
  720. package/daemon/dist/routes/terminal.js.map +1 -1
  721. package/daemon/dist/routes/transport.d.ts.map +1 -1
  722. package/daemon/dist/routes/transport.js +0 -1
  723. package/daemon/dist/routes/transport.js.map +1 -1
  724. package/daemon/dist/server.d.ts +2 -0
  725. package/daemon/dist/server.d.ts.map +1 -1
  726. package/daemon/dist/server.js +5 -0
  727. package/daemon/dist/server.js.map +1 -1
  728. package/daemon/dist/startup.d.ts +34 -0
  729. package/daemon/dist/startup.d.ts.map +1 -1
  730. package/daemon/dist/startup.js +206 -36
  731. package/daemon/dist/startup.js.map +1 -1
  732. package/daemon/docs/reference/agent-spec.md +2 -4
  733. package/daemon/docs/reference/agent-startup-guide.md +45 -15
  734. package/daemon/docs/reference/claude-status-line.md +25 -9
  735. package/daemon/docs/reference/community-harness-examples/omo/omo.yaml +14 -0
  736. package/daemon/docs/reference/community-harness-presets.md +56 -2
  737. package/daemon/docs/reference/daemon-http-clients.md +15 -1
  738. package/daemon/docs/reference/edge-types.md +6 -4
  739. package/daemon/docs/reference/gateway-participants.md +19 -0
  740. package/daemon/docs/reference/gateway-relay.md +41 -12
  741. package/daemon/docs/reference/getting-started.md +41 -14
  742. package/daemon/docs/reference/harness-runner-contract.md +61 -12
  743. package/daemon/docs/reference/health-diagnosis.md +5 -1
  744. package/daemon/docs/reference/help.md +18 -0
  745. package/daemon/docs/reference/herdr-app.md +149 -0
  746. package/daemon/docs/reference/hosted-members.md +51 -9
  747. package/daemon/docs/reference/keeping-a-watch.md +31 -1
  748. package/daemon/docs/reference/network-connector.md +114 -0
  749. package/daemon/docs/reference/queue-erasure.md +161 -0
  750. package/daemon/docs/reference/quickstart.md +4 -4
  751. package/daemon/docs/reference/rig-spec.md +29 -9
  752. package/daemon/docs/reference/rosters.md +5 -0
  753. package/daemon/docs/reference/runner-conformance/README.md +3 -0
  754. package/daemon/docs/reference/runner-conformance/check-runner.mjs +27 -6
  755. package/daemon/docs/reference/runner-conformance/fake-acp-agent.mjs +1 -1
  756. package/daemon/docs/reference/sdlc-conventions.md +16 -1
  757. package/daemon/docs/reference/seat-delivery.md +10 -3
  758. package/daemon/docs/reference/slack-app-setup.md +37 -12
  759. package/daemon/docs/reference/terminal-sessions.md +28 -15
  760. package/daemon/docs/reference/tmux-servers.md +6 -3
  761. package/daemon/docs/reference/whats-new.md +300 -295
  762. package/daemon/specs/agents/shared/skills/core/openrig-herdr/SKILL.md +1 -0
  763. package/daemon/specs/agents/shared/skills/core/watchdog/SKILL.md +5 -0
  764. package/daemon/specs/agents/shared/skills/pods/review-team/SKILL.md +2 -0
  765. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +66 -16
  766. package/daemon/specs/rigs/launch/kernel/culture/CULTURE.md +7 -4
  767. package/daemon/specs/rigs/launch/kernel/rig.yaml +6 -3
  768. package/daemon/specs/rigs/launch/starter/guidance/lead-first-move.md +3 -1
  769. package/dist/build-info.js +3 -3
  770. package/dist/client.js +2 -2
  771. package/dist/client.js.map +1 -1
  772. package/dist/commands/config.d.ts.map +1 -1
  773. package/dist/commands/config.js +11 -1
  774. package/dist/commands/config.js.map +1 -1
  775. package/dist/commands/context.d.ts.map +1 -1
  776. package/dist/commands/context.js +44 -4
  777. package/dist/commands/context.js.map +1 -1
  778. package/dist/commands/daemon.d.ts +8 -2
  779. package/dist/commands/daemon.d.ts.map +1 -1
  780. package/dist/commands/daemon.js +63 -7
  781. package/dist/commands/daemon.js.map +1 -1
  782. package/dist/commands/gateway.d.ts.map +1 -1
  783. package/dist/commands/gateway.js +21 -4
  784. package/dist/commands/gateway.js.map +1 -1
  785. package/dist/commands/host.d.ts +4 -10
  786. package/dist/commands/host.d.ts.map +1 -1
  787. package/dist/commands/host.js +17 -35
  788. package/dist/commands/host.js.map +1 -1
  789. package/dist/commands/launch.d.ts +1 -0
  790. package/dist/commands/launch.d.ts.map +1 -1
  791. package/dist/commands/launch.js +1 -1
  792. package/dist/commands/launch.js.map +1 -1
  793. package/dist/commands/network.d.ts +12 -0
  794. package/dist/commands/network.d.ts.map +1 -0
  795. package/dist/commands/network.js +95 -0
  796. package/dist/commands/network.js.map +1 -0
  797. package/dist/commands/package.d.ts.map +1 -1
  798. package/dist/commands/package.js +5 -0
  799. package/dist/commands/package.js.map +1 -1
  800. package/dist/commands/proof.d.ts.map +1 -1
  801. package/dist/commands/proof.js +18 -6
  802. package/dist/commands/proof.js.map +1 -1
  803. package/dist/commands/provider.js +1 -1
  804. package/dist/commands/ps.d.ts +9 -1
  805. package/dist/commands/ps.d.ts.map +1 -1
  806. package/dist/commands/ps.js +23 -2
  807. package/dist/commands/ps.js.map +1 -1
  808. package/dist/commands/queue.d.ts.map +1 -1
  809. package/dist/commands/queue.js +233 -8
  810. package/dist/commands/queue.js.map +1 -1
  811. package/dist/commands/roster.d.ts +17 -0
  812. package/dist/commands/roster.d.ts.map +1 -1
  813. package/dist/commands/roster.js +47 -2
  814. package/dist/commands/roster.js.map +1 -1
  815. package/dist/commands/scope.d.ts +2 -0
  816. package/dist/commands/scope.d.ts.map +1 -1
  817. package/dist/commands/scope.js +15 -0
  818. package/dist/commands/scope.js.map +1 -1
  819. package/dist/commands/seat.d.ts.map +1 -1
  820. package/dist/commands/seat.js +65 -10
  821. package/dist/commands/seat.js.map +1 -1
  822. package/dist/commands/send.d.ts +2 -0
  823. package/dist/commands/send.d.ts.map +1 -1
  824. package/dist/commands/send.js +16 -6
  825. package/dist/commands/send.js.map +1 -1
  826. package/dist/commands/setup.js +1 -1
  827. package/dist/commands/setup.js.map +1 -1
  828. package/dist/commands/skill.d.ts.map +1 -1
  829. package/dist/commands/skill.js +5 -0
  830. package/dist/commands/skill.js.map +1 -1
  831. package/dist/commands/slack.d.ts +1 -1
  832. package/dist/commands/slack.d.ts.map +1 -1
  833. package/dist/commands/slack.js +5 -1
  834. package/dist/commands/slack.js.map +1 -1
  835. package/dist/commands/status.d.ts.map +1 -1
  836. package/dist/commands/status.js +11 -1
  837. package/dist/commands/status.js.map +1 -1
  838. package/dist/commands/terminal.d.ts +22 -0
  839. package/dist/commands/terminal.d.ts.map +1 -1
  840. package/dist/commands/terminal.js +116 -7
  841. package/dist/commands/terminal.js.map +1 -1
  842. package/dist/commands/up.d.ts.map +1 -1
  843. package/dist/commands/up.js +22 -0
  844. package/dist/commands/up.js.map +1 -1
  845. package/dist/commands/watchdog.d.ts.map +1 -1
  846. package/dist/commands/watchdog.js +22 -2
  847. package/dist/commands/watchdog.js.map +1 -1
  848. package/dist/commands/whoami.d.ts.map +1 -1
  849. package/dist/commands/whoami.js +13 -2
  850. package/dist/commands/whoami.js.map +1 -1
  851. package/dist/commands/workflow-errors.js +1 -1
  852. package/dist/commands/workflow-errors.js.map +1 -1
  853. package/dist/commands/workflow.js +1 -1
  854. package/dist/commands/workflow.js.map +1 -1
  855. package/dist/config-store.d.ts +8 -1
  856. package/dist/config-store.d.ts.map +1 -1
  857. package/dist/config-store.js +60 -0
  858. package/dist/config-store.js.map +1 -1
  859. package/dist/cross-host-executor.d.ts.map +1 -1
  860. package/dist/cross-host-executor.js +6 -1
  861. package/dist/cross-host-executor.js.map +1 -1
  862. package/dist/daemon-lifecycle.d.ts +11 -0
  863. package/dist/daemon-lifecycle.d.ts.map +1 -1
  864. package/dist/daemon-lifecycle.js +61 -9
  865. package/dist/daemon-lifecycle.js.map +1 -1
  866. package/dist/daemon-reachability.js +1 -1
  867. package/dist/daemon-reachability.js.map +1 -1
  868. package/dist/daemon-start-lock.d.ts +24 -2
  869. package/dist/daemon-start-lock.d.ts.map +1 -1
  870. package/dist/daemon-start-lock.js +125 -4
  871. package/dist/daemon-start-lock.js.map +1 -1
  872. package/dist/index.d.ts +2 -0
  873. package/dist/index.d.ts.map +1 -1
  874. package/dist/index.js +2 -0
  875. package/dist/index.js.map +1 -1
  876. package/dist/lazy-program.d.ts.map +1 -1
  877. package/dist/lazy-program.js +1 -0
  878. package/dist/lazy-program.js.map +1 -1
  879. package/dist/lib/scope/logical-checkbox.d.ts.map +1 -1
  880. package/dist/lib/scope/logical-checkbox.js +14 -0
  881. package/dist/lib/scope/logical-checkbox.js.map +1 -1
  882. package/dist/lib/scope/scope-fs.d.ts.map +1 -1
  883. package/dist/lib/scope/scope-fs.js +36 -2
  884. package/dist/lib/scope/scope-fs.js.map +1 -1
  885. package/dist/mcp-server.d.ts.map +1 -1
  886. package/dist/mcp-server.js +49 -8
  887. package/dist/mcp-server.js.map +1 -1
  888. package/dist/recap-seat.d.ts +28 -0
  889. package/dist/recap-seat.d.ts.map +1 -0
  890. package/dist/recap-seat.js +41 -0
  891. package/dist/recap-seat.js.map +1 -0
  892. package/dist/seat-attention.d.ts +24 -0
  893. package/dist/seat-attention.d.ts.map +1 -0
  894. package/dist/seat-attention.js +119 -0
  895. package/dist/seat-attention.js.map +1 -0
  896. package/dist/terminal-window.d.ts.map +1 -1
  897. package/dist/terminal-window.js +3 -3
  898. package/dist/terminal-window.js.map +1 -1
  899. package/package.json +1 -1
  900. package/tui/dist/attention/attention-model.d.ts.map +1 -1
  901. package/tui/dist/attention/attention-model.js +13 -5
  902. package/tui/dist/attention/attention-model.js.map +1 -1
  903. package/tui/dist/config/config-model.d.ts.map +1 -1
  904. package/tui/dist/config/config-model.js +6 -1
  905. package/tui/dist/config/config-model.js.map +1 -1
  906. package/tui/dist/config/pairing.d.ts +49 -0
  907. package/tui/dist/config/pairing.d.ts.map +1 -0
  908. package/tui/dist/config/pairing.js +98 -0
  909. package/tui/dist/config/pairing.js.map +1 -0
  910. package/tui/dist/daemon-client.d.ts +11 -1
  911. package/tui/dist/daemon-client.d.ts.map +1 -1
  912. package/tui/dist/daemon-client.js +18 -5
  913. package/tui/dist/daemon-client.js.map +1 -1
  914. package/tui/dist/detail.d.ts +3 -0
  915. package/tui/dist/detail.d.ts.map +1 -1
  916. package/tui/dist/detail.js +6 -1
  917. package/tui/dist/detail.js.map +1 -1
  918. package/tui/dist/execution/execution-model.d.ts +2 -0
  919. package/tui/dist/execution/execution-model.d.ts.map +1 -1
  920. package/tui/dist/execution/execution-model.js +10 -3
  921. package/tui/dist/execution/execution-model.js.map +1 -1
  922. package/tui/dist/health/health-model.d.ts.map +1 -1
  923. package/tui/dist/health/health-model.js +27 -11
  924. package/tui/dist/health/health-model.js.map +1 -1
  925. package/tui/dist/hydrate.d.ts.map +1 -1
  926. package/tui/dist/hydrate.js +12 -6
  927. package/tui/dist/hydrate.js.map +1 -1
  928. package/tui/dist/main.js +6 -1
  929. package/tui/dist/main.js.map +1 -1
  930. package/tui/dist/navigator.js +1 -1
  931. package/tui/dist/navigator.js.map +1 -1
  932. package/tui/dist/render.d.ts.map +1 -1
  933. package/tui/dist/render.js +44 -29
  934. package/tui/dist/render.js.map +1 -1
  935. package/tui/dist/scopes/scopes-model.d.ts +9 -0
  936. package/tui/dist/scopes/scopes-model.d.ts.map +1 -1
  937. package/tui/dist/scopes/scopes-model.js +27 -1
  938. package/tui/dist/scopes/scopes-model.js.map +1 -1
  939. package/tui/dist/state.d.ts.map +1 -1
  940. package/tui/dist/state.js +6 -5
  941. package/tui/dist/state.js.map +1 -1
  942. package/tui/dist/stylize.d.ts.map +1 -1
  943. package/tui/dist/stylize.js +4 -0
  944. package/tui/dist/stylize.js.map +1 -1
  945. package/tui/dist/terminals/open-window.d.ts +21 -1
  946. package/tui/dist/terminals/open-window.d.ts.map +1 -1
  947. package/tui/dist/terminals/open-window.js +46 -9
  948. package/tui/dist/terminals/open-window.js.map +1 -1
  949. package/tui/dist/terminals/terminal-model.d.ts +8 -1
  950. package/tui/dist/terminals/terminal-model.d.ts.map +1 -1
  951. package/tui/dist/terminals/terminal-model.js +25 -8
  952. package/tui/dist/terminals/terminal-model.js.map +1 -1
  953. package/tui/dist/topology/host-label.d.ts +2 -0
  954. package/tui/dist/topology/host-label.d.ts.map +1 -1
  955. package/tui/dist/topology/host-label.js +7 -1
  956. package/tui/dist/topology/host-label.js.map +1 -1
  957. package/tui/dist/types.d.ts +20 -3
  958. package/tui/dist/types.d.ts.map +1 -1
@@ -3,6 +3,11 @@ import { withUrgentLine } from "./urgent-line.js";
3
3
  import { quietCustodyBackstop, quietHoldCustody } from "./quiet-hold-custody.js";
4
4
  import { createHash } from "node:crypto";
5
5
  import { loadHumanRegistry, registeredPeople, resolveRegisteredHumanAddress, slackSubscriptionFor, withHumanAlertTag } from "./gateway/human-registry.js";
6
+ import { DispatchBuffer } from "./gateway/dispatch-buffer.js";
7
+ import { loadRelayProfiles } from "./gateway/relay-config.js";
8
+ import { relayStatePaths, validateRelayOutboundEnvelope } from "./gateway/relay-outbound.js";
9
+ import { SeenStore } from "./gateway/slack/state-store.js";
10
+ import { getOpenRigHome } from "../openrig-compat.js";
6
11
  import { sharedChannelAddresses } from "./gateway/participants.js";
7
12
  import { resolveExternal } from "./gateway/external-admission.js";
8
13
  import { QueueTransitionLog, RELAY_OWNER_NOTIFICATION_ACCEPTED_PREFIX, RELAY_OWNER_NOTIFICATION_TRANSPORT_FAILED_PREFIX, formatRelayOwnerNotificationAccepted, formatRelayOwnerNotificationTransportFailed, parseRelayOwnerNotificationAccepted, parseRelayOwnerNotificationTransportFailed, } from "./queue-transition-log.js";
@@ -15,7 +20,9 @@ import { WAKE_INTENT_PREFIX } from "./outbox-handler.js";
15
20
  import { physicalSessionName } from "./session-registry.js";
16
21
  import { derivePickup } from "./queue-pickup.js";
17
22
  import { withRecoveryIndex } from "./queue-recovery.js";
18
- import { lastMeaningfulTransition, readWaitingView } from "./queue-waiting.js";
23
+ import { lastMeaningfulTransitionMany, meaningfulFor, readWaitingView, WaitingStatements } from "./queue-waiting.js";
24
+ import { isTypedGateBlocker, typedGateBlockerPrefix } from "./queue-blocker.js";
25
+ export { TYPED_GATE_BLOCKER_PREFIXES, isTypedGateBlocker, typedGateBlockerPrefix } from "./queue-blocker.js";
19
26
  import { isOpenRigSender, OPENRIG_SENDER, wrapPaneEnvelope } from "../lib/pane-envelope.js";
20
27
  import { isBoundTerminalSeat } from "./terminal-seat.js";
21
28
  import { renderQueueHandoffNudge } from "./queue-nudge-text.js";
@@ -27,8 +34,9 @@ import { parseReplyToChoice, parseReplyToThreadMissing, formatReplyToChoice, des
27
34
  import { classifyDestination } from "./gateway/destination-resolver.js";
28
35
  import { join } from "node:path";
29
36
  import { SettingsStore } from "./user-settings/settings-store.js";
30
- import { hostedWakeFor, isHostedMemberAt } from "./rosters.js";
31
- import { ringHostedWake } from "./hosted-wake.js";
37
+ import { hostedMembersAt, hostedWakeFor, isHostedMemberAt } from "./rosters.js";
38
+ import { memberCheckInStatus } from "./connection-contract.js";
39
+ import { hostedRingMayHaveArrived, ringHostedWake } from "./hosted-wake.js";
32
40
  import { effectiveGateRoles } from "./gate-predicate.js";
33
41
  import { computeClosureRequiredAt, validateClosure, } from "./hot-potato-enforcer.js";
34
42
  import { validateHumanPark, validateHumanRoute } from "./human-route-enforcer.js";
@@ -37,6 +45,7 @@ import { WatchdogJobsRepository } from "./watchdog-jobs-repository.js";
37
45
  import { armQueueWait, backOffQueueWait, refreshQueueWaits, evaluateQueueWait, retargetQueueWait, isQueueWait } from "./queue-wait-backoff.js";
38
46
  import { parseHumanQuestions, unansweredQuestions, describeTypedReplyPlacement, formatHumanAnswers, humanAnswerText } from "./human-questions.js";
39
47
  import { slackMicros } from "./gateway/slack/state-store.js";
48
+ import { askBackRoute, RUNNER_CLOSE_WAITS, terminalAnswerMeaning } from "./receiver-context.js";
40
49
  /** A direct ask's answer row ID: from the ask, or from the ask and the park episode its answer belongs to. */
41
50
  function humanAnswerId(askId, episodeKey) {
42
51
  return `qitem-human-answer-${createHash("sha256").update(episodeKey ? `${askId}\n${episodeKey}` : askId).digest("hex").slice(0, 20)}`;
@@ -99,22 +108,8 @@ const HOSTED_WAKE_ACCEPTED_TAG = "queue:hosted-wake-accepted";
99
108
  const AUTO_UNPARK_BLOCKER_TAG_PREFIX = "queue:auto-unpark:blocker-ref:";
100
109
  /** The actor on the transition routeToFallback writes; the row's own history is how a later reroute finds the line it wrote. */
101
110
  const FALLBACK_ACTOR = "system:queue-fallback";
102
- /** 0.5.1-53 Atom 1a — typed non-qitem gate blocker prefixes. A park may be gated on a fold / auth /
103
- * external condition that is NOT a qitem and NOT a human seat; these prefixes make such a gate a
104
- * first-class, compact-visible, downstream-classifiable blocker (the ruling detail rides a transition). */
105
- export const TYPED_GATE_BLOCKER_PREFIXES = ["fold:", "auth:", "external:"];
106
111
  /** The actor a terminal act is recorded as when it names no responder: explicitly unattributed, never a person. */
107
112
  export const UNATTRIBUTED_ACTOR = "human@host";
108
- export function typedGateBlockerPrefix(value) {
109
- return TYPED_GATE_BLOCKER_PREFIXES.find((p) => value.startsWith(p)) ?? null;
110
- }
111
- /** A well-formed typed gate blocker: a recognized prefix AND a non-empty gate body. */
112
- export function isTypedGateBlocker(value) {
113
- if (typeof value !== "string")
114
- return false;
115
- const p = typedGateBlockerPrefix(value);
116
- return p != null && value.slice(p.length).trim().length > 0;
117
- }
118
113
  /**
119
114
  * #165: a claim is the destination acting on the row, which is stronger evidence than
120
115
  * the wake send could get. While the row is claimed, an unconfirmed wire result
@@ -202,6 +197,18 @@ function defaultIsHostedMember(destination) {
202
197
  return false;
203
198
  }
204
199
  }
200
+ /** The hosted members the authored rosters list on this host. Empty when the rosters or this host's id can't be read. */
201
+ function defaultHostedMembers() {
202
+ try {
203
+ const root = new SettingsStore().resolveOne("workspace.root").value;
204
+ return typeof root === "string" && root ? hostedMembersAt(join(root, "rosters"), getSelfHostId()) : [];
205
+ }
206
+ catch {
207
+ return [];
208
+ }
209
+ }
210
+ /** A session's check-in is written at most this often; the stuck sweep reads it in units of its unclaimed age. */
211
+ const INBOX_CHECKIN_WRITE_INTERVAL_MS = 60_000;
205
212
  export class QueueRepositoryError extends Error {
206
213
  code;
207
214
  meta;
@@ -312,11 +319,15 @@ let successorScope = null;
312
319
  * equals a text id); has() then checks qitem_id or destination_session against the target and that the successor is
313
320
  * not the source itself. A snapshot from its first has() until invalidate(): the caller invalidates it whenever other
314
321
  * 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. */
322
+ * for a covered source; any other source keeps the per-row query. builtMs() is how long the build of the index as it
323
+ * is now took (0 while it is not built), so a caller can tell when rebuilding after each invalidate() costs more than
324
+ * it saves. */
316
325
  export function createLinkedSuccessorLookup(db, sourceQitemIds) {
317
326
  const sources = new Set(sourceQitemIds);
318
327
  let bySource = null;
328
+ let buildMs = 0;
319
329
  const build = () => {
330
+ const startedAt = performance.now();
320
331
  const map = new Map();
321
332
  const ids = JSON.stringify([...sources]);
322
333
  const rows = db.prepare(`SELECT s.qitem_id, s.destination_session, s.handed_off_from AS source FROM queue_items s
@@ -333,6 +344,7 @@ export function createLinkedSuccessorLookup(db, sourceQitemIds) {
333
344
  else
334
345
  map.set(r.source, [entry]);
335
346
  }
347
+ buildMs = performance.now() - startedAt;
336
348
  return map;
337
349
  };
338
350
  const has = (sourceQitemId, target) => (bySource ??= build()).get(sourceQitemId)?.some((s) => s.qitemId !== sourceQitemId && (s.qitemId === target || s.destination === target)) ?? false;
@@ -351,7 +363,8 @@ export function createLinkedSuccessorLookup(db, sourceQitemIds) {
351
363
  successorScope = previous;
352
364
  }
353
365
  },
354
- invalidate: () => { bySource = null; },
366
+ invalidate: () => { bySource = null; buildMs = 0; },
367
+ builtMs: () => buildMs,
355
368
  };
356
369
  }
357
370
  /** PL-007 — defensive column probe. Older test fixtures bypass the
@@ -538,6 +551,7 @@ export class QueueRepository {
538
551
  promptRecoveryState = new Map();
539
552
  promptClearRetries = new Map();
540
553
  resolveOccupantGeneration;
554
+ isSenderSendable;
541
555
  resolveSessionAddresses;
542
556
  hasPendingPostCompactStage;
543
557
  wakeRepo;
@@ -557,6 +571,7 @@ export class QueueRepository {
557
571
  hasMintingGenColumn;
558
572
  hasClaimedGenColumn;
559
573
  hasQueueTransitionsTable;
574
+ hasErasedIdsTable;
560
575
  hasTransitionProvenanceColumn;
561
576
  hasOwnerNotificationColumns;
562
577
  loadHumanRegistryFn;
@@ -566,7 +581,12 @@ export class QueueRepository {
566
581
  hostedWakeFn;
567
582
  /** Whether the rosters list an address as a hosted member, trigger or not. */
568
583
  hostedMemberFn;
584
+ hostedMembersFn;
585
+ permissionDecider;
569
586
  hostedWakeFetch;
587
+ /** When this process last wrote each session's inbox check-in, so a seat that polls often writes at most once a minute. */
588
+ inboxCheckInWrittenAt = new Map();
589
+ inboxCheckInWriteFailed = false;
570
590
  /** OPR.0.4.6.WF3 FR-6 — injected by startup (never imported): the
571
591
  * workflow domain's is-live-frontier-packet predicate. */
572
592
  workflowFrontierPredicate;
@@ -581,12 +601,15 @@ export class QueueRepository {
581
601
  this.attachTransport(opts.transport);
582
602
  this.workflowFrontierPredicate = opts?.workflowFrontierPredicate;
583
603
  this.resolveOccupantGeneration = opts?.resolveOccupantGeneration;
604
+ this.isSenderSendable = opts?.isSenderSendable;
584
605
  this.resolveSessionAddresses = opts?.resolveSessionAddresses ?? ((name) => [name]);
585
606
  this.hasPendingPostCompactStage = opts?.hasPendingPostCompactStage;
586
607
  this.loadHumanRegistryFn = opts?.loadHumanRegistry ?? (() => loadHumanRegistry());
587
608
  this.sharedChannelsFn = opts?.sharedChannels ?? (() => sharedChannelAddresses());
588
609
  this.hostedWakeFn = opts?.hostedWake ?? defaultHostedWake;
589
610
  this.hostedMemberFn = opts?.isHostedMember ?? defaultIsHostedMember;
611
+ this.hostedMembersFn = opts?.hostedMembers ?? defaultHostedMembers;
612
+ this.permissionDecider = opts?.permissionDecider;
590
613
  this.hostedWakeFetch = opts?.hostedWakeFetch;
591
614
  this.hasTargetRepoColumn = detectQueueColumn(db, "target_repo");
592
615
  this.hasSummaryColumn = detectQueueColumn(db, "summary");
@@ -596,6 +619,7 @@ export class QueueRepository {
596
619
  this.hasDelegatedDecisionColumn = detectQueueColumn(db, "delegated_decision");
597
620
  this.hasEvidenceRefColumn = detectQueueColumn(db, "evidence_ref");
598
621
  this.hasQueueTransitionsTable = detectTable(db, "queue_transitions");
622
+ this.hasErasedIdsTable = detectTable(db, "queue_erased_ids");
599
623
  const transitionColumns = this.hasQueueTransitionsTable
600
624
  ? new Set(db.prepare("PRAGMA table_info(queue_transitions)").all().map((column) => column.name))
601
625
  : new Set();
@@ -827,6 +851,10 @@ export class QueueRepository {
827
851
  this.recordNudgeAttempt(successorQitemId, `${WAKE_NOT_RETAINED}${err.message}`);
828
852
  }
829
853
  }
854
+ /** #2895 (a): the envelope meta for a sender `rig send` can't reach; empty (today's bytes) otherwise or when unwired. */
855
+ senderReach(sender) {
856
+ return sender && this.isSenderSendable && !this.isSenderSendable(sender) ? { senderReachable: false } : {};
857
+ }
830
858
  recordWakeIntent(input) {
831
859
  if (!this.outbox)
832
860
  return null;
@@ -834,7 +862,7 @@ export class QueueRepository {
834
862
  // recovery replay these exact bytes without re-resolving the occupant.
835
863
  const stampISO = new Date().toISOString();
836
864
  const genUuid = this.resolveOccupantGeneration?.(input.fromSession) ?? undefined;
837
- const frozenEnvelope = wrapPaneEnvelope(input.fromSession, input.toSession, input.bareBody, { stampISO, genUuid, ...(input.qitemId ? { replyToQitem: input.qitemId } : {}) });
865
+ const frozenEnvelope = wrapPaneEnvelope(input.fromSession, input.toSession, input.bareBody, { stampISO, genUuid, ...(input.qitemId ? { replyToQitem: input.qitemId } : {}), ...this.senderReach(input.fromSession) });
838
866
  const admission = this.wakeAdmission(input.auditPointer, input.tags?.includes(WAKE_TRIGGER_OPENRIG_TAG) ? "openrig" : "agent");
839
867
  // An urgent wake's frozen body carries the line naming who marked it, so a person reading it held sees it too; the
840
868
  // transport won't add it a second time when it's delivered.
@@ -919,6 +947,23 @@ export class QueueRepository {
919
947
  * hold is left alone; failed/uncertain history permits another attempt. A recovery
920
948
  * pass tracks its coalesced members only in memory so each is attempted once per pass.
921
949
  */
950
+ /** #2789: a wake committed while its seat had no pane froze a binding that can never match once the seat is bound, so
951
+ * the delivery guard refused it on every retry. Such an intent takes its first live binding, on the same node and
952
+ * canonical session, only when it is known to have written no input (pending, or failed, which a send records only
953
+ * without a write) and carries no expected identity of its own. A binding that ever named a pane is never replaced,
954
+ * so a wake can't move to another occupant; the guard's write-time check against this binding still holds.
955
+ * `entry` is the intent as read before its claim. Called inside the claim's transaction. */
956
+ bindFirstTarget(entry) {
957
+ const frozen = entry.guardBinding;
958
+ if (!frozen || frozen.pane !== null || (entry.deliveryState !== "pending" && entry.deliveryState !== "failed"))
959
+ return;
960
+ if (this.outbox.expectedIdentity(entry.outboxId))
961
+ return;
962
+ const live = this.transport?.deliveryTarget?.(entry.destinationSession);
963
+ if (!live?.pane || live.nodeId !== frozen.nodeId || live.session !== frozen.session)
964
+ return;
965
+ this.db.prepare("UPDATE outbox_entries SET guard_binding = ? WHERE outbox_id = ?").run(JSON.stringify(live), entry.outboxId);
966
+ }
922
967
  async deliverWakeIntent(outboxId, attempted = new Set(), // this pass's attempt history, inherited by any release it delivers
923
968
  eligible = () => true) {
924
969
  if (!this.outbox)
@@ -937,6 +982,7 @@ export class QueueRepository {
937
982
  const claim = (entry) => {
938
983
  if (!eligible(entry) || attempted.has(entry.outboxId) || !this.outbox.claimForDelivery(entry.outboxId))
939
984
  return false;
985
+ this.bindFirstTarget(entry);
940
986
  attempted.add(entry.outboxId);
941
987
  recovering ||= entry.deliveryState !== "pending";
942
988
  return true;
@@ -1008,8 +1054,8 @@ export class QueueRepository {
1008
1054
  // The level can change while this send waits for the seat's lease. Under the lease, each member is admitted again with
1009
1055
  // its own source and urgency; only those with the first member's outcome go with this send, and the others go back
1010
1056
  // to their state before this claim (never marked delivered, held or failed) for their own delivery.
1011
- // A hosted member's trigger already accepted the ring for exactly these intents (tagged below): recovery doesn't ring
1012
- // it again, since each ring can start a run. Any other wake rings: a new intent, or one claimed but never sent.
1057
+ // A hosted member's trigger already accepted the ring for exactly these intents, or may have before it stopped
1058
+ // answering (tagged below): recovery doesn't ring it again, since each ring can start a run. Any other wake rings: a new intent, or one claimed but never sent.
1013
1059
  if (group.every((entry) => entry.tags?.includes(HOSTED_WAKE_ACCEPTED_TAG))) {
1014
1060
  for (const entry of group)
1015
1061
  this.outbox.finalizeDelivery(entry.outboxId, "indeterminate");
@@ -1052,8 +1098,8 @@ export class QueueRepository {
1052
1098
  const wakeEvent = this.db.transaction(() => {
1053
1099
  this.recordNudgeAttempt(qitemId, nudgeResult);
1054
1100
  this.outbox.finalizeDelivery(intent.outboxId, finalState);
1055
- // The acceptance belongs to this intent, so recovery can tell this wake already rang.
1056
- if (outcome.nudgeResult.startsWith("wake-accepted:")) {
1101
+ // The acceptance (or a ring that may have arrived) belongs to this intent, so recovery can tell this wake already rang.
1102
+ if (hostedRingMayHaveArrived(outcome.nudgeResult)) {
1057
1103
  this.db.prepare(`UPDATE outbox_entries SET tags = json_insert(COALESCE(tags, '[]'), '$[#]', ?)
1058
1104
  WHERE outbox_id = ? AND NOT EXISTS (SELECT 1 FROM json_each(COALESCE(outbox_entries.tags, '[]')) WHERE value = ?)`)
1059
1105
  .run(HOSTED_WAKE_ACCEPTED_TAG, intent.outboxId, HOSTED_WAKE_ACCEPTED_TAG);
@@ -1123,9 +1169,10 @@ export class QueueRepository {
1123
1169
  /** Recover current notifications once per pass. A snapshot horizon and seek cursor
1124
1170
  * prevent new arrivals or persistent failures from making this pass unbounded. `stopRequested` is checked before
1125
1171
  * 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. */
1172
+ * A notification already tried for a seat that still has no session or transport, or that is a bound terminal seat,
1173
+ * would only fail again, so it isn't claimed, alone or in a group: it stays as it is, its row stays owed, and the
1174
+ * pass reports it as waiting. The receiver is read at each claim, so a seat that starts during the pass gets its
1175
+ * later notifications. */
1129
1176
  async drainPendingWakeIntents(opts) {
1130
1177
  const tally = { delivered: 0, indeterminate: 0, failed: 0, retained: 0 };
1131
1178
  if (!this.outbox || !this.transport)
@@ -1186,9 +1233,11 @@ export class QueueRepository {
1186
1233
  }
1187
1234
  return result();
1188
1235
  }
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. */
1236
+ /** Positive evidence only that a wake can't land now: no transport can hold the address, the address is a bound
1237
+ * terminal seat (a shell or a TUI: performWakeSend types nothing there, so a retry can only fail the same way and
1238
+ * move the row's last nudge time, which the stuck sweep reads as new evidence; #2939), or the newest session under
1239
+ * the name the transport sends to has stopped (exited, or detached because its tmux session is gone). A canonical
1240
+ * address resolves to its current physical session first. Anything unknown may have a receiver. */
1192
1241
  wakeHasNoReceiver(destinationSession) {
1193
1242
  try {
1194
1243
  const destClass = this.classifyDestinationOf(destinationSession).class;
@@ -1196,8 +1245,11 @@ export class QueueRepository {
1196
1245
  return true;
1197
1246
  if (destClass !== "pane-bound")
1198
1247
  return false;
1248
+ const physical = physicalSessionName(this.db, destinationSession);
1249
+ if (isBoundTerminalSeat(this.db, destinationSession) || isBoundTerminalSeat(this.db, physical))
1250
+ return true;
1199
1251
  const newest = this.db.prepare("SELECT status FROM sessions WHERE session_name = ? ORDER BY id DESC LIMIT 1")
1200
- .get(physicalSessionName(this.db, destinationSession));
1252
+ .get(physical);
1201
1253
  return newest?.status === "exited" || newest?.status === "detached";
1202
1254
  }
1203
1255
  catch {
@@ -1318,6 +1370,66 @@ export class QueueRepository {
1318
1370
  }
1319
1371
  }
1320
1372
  }
1373
+ /** The rule for re-sending a wake recorded unroutable once its seat may be back, shared by the stuck sweep and
1374
+ * {@link retryUnroutableWakesOnReachable}: unclaimed, not a person's notice, not a local human decision with no
1375
+ * gateway, not held or released for quiet hours, and its seat now pane-bound. A handoff's retry ladder is the
1376
+ * caller's to check: the sweep defers to a live ladder, the reachable-seat retry leaves every handed-off row to it. */
1377
+ unroutableWakeRetryable(row, now = new Date()) {
1378
+ return row.lastNudgeResult?.startsWith("unroutable:") === true
1379
+ && !row.claimedAt
1380
+ && row.deliveryOutcome !== "never-posted" && row.deliveryOutcome !== "transport-failed"
1381
+ && !this.isLocalHumanDecisionWithoutGateway(row)
1382
+ && !["held", "released"].includes(quietHoldCustody(this.db, row.qitemId, now)?.state ?? "")
1383
+ && this.classifyDestinationOf(row.destinationSession).class === "pane-bound";
1384
+ }
1385
+ /** A wake recorded unroutable because its seat wasn't bound yet, as just after a restart (#2789), is re-sent as soon
1386
+ * as the seat is seen running or idle, rather than at the stuck sweep's next tick; the sweep remains the backstop.
1387
+ * Only this seat's own pending rows, oldest first, that {@link unroutableWakeRetryable} admits. */
1388
+ async retryUnroutableWakesOnReachable(sessionName, state) {
1389
+ if (state !== "running" && state !== "idle")
1390
+ return;
1391
+ const addresses = this.resolveSessionAddresses(sessionName);
1392
+ if (!addresses.length)
1393
+ return;
1394
+ // As for a prompt clear (#2575): while a compaction's restore is owed, the wake would reach the agent before it.
1395
+ if ([sessionName, ...addresses].some(address => this.hasPendingPostCompactStage?.(address)))
1396
+ return;
1397
+ const rows = this.db.prepare(`SELECT qitem_id FROM queue_items
1398
+ WHERE destination_session IN (${addresses.map(() => "?").join(",")}) AND state = 'pending'
1399
+ AND handed_off_from IS NULL AND last_nudge_result LIKE 'unroutable:%' ORDER BY ts_created, qitem_id`)
1400
+ .all(...addresses);
1401
+ const now = new Date();
1402
+ // One attempt per intent for the pass: a returned result and its resume go as one send, so the second row's turn
1403
+ // mustn't send them again after a refusal.
1404
+ const attempted = new Set();
1405
+ // Correlation can add peers to a send. Each claim must qualify for this retry on its own: a failed wake of this
1406
+ // seat's pending row that the shared rule admits. A peer that may already have been written (indeterminate), or
1407
+ // failed for another reason, isn't claimed here.
1408
+ const eligible = (entry) => {
1409
+ if (entry.deliveryState !== "failed" || !entry.auditPointer)
1410
+ return false;
1411
+ const current = this.getById(entry.auditPointer);
1412
+ return current?.state === "pending" && addresses.includes(current.destinationSession) && !current.handedOffFrom
1413
+ && this.unroutableWakeRetryable(current, now);
1414
+ };
1415
+ for (const { qitem_id } of rows) {
1416
+ const row = this.getById(qitem_id);
1417
+ if (!row || row.state !== "pending" || !this.unroutableWakeRetryable(row, now))
1418
+ continue;
1419
+ // The failed wake may be the row's own intent or an un-park's blocker intent: re-send whichever failed.
1420
+ // One in flight or delivered is never sent again; only a row with no intent at all takes the plain nudge.
1421
+ const intents = this.outbox ? this.db.prepare(`SELECT outbox_id, delivery_state FROM outbox_entries
1422
+ WHERE audit_pointer = ? AND substr(outbox_id, 1, ?) = ?`)
1423
+ .all(qitem_id, WAKE_INTENT_PREFIX.length, WAKE_INTENT_PREFIX) : [];
1424
+ if (intents.length) {
1425
+ for (const intent of intents)
1426
+ if (intent.delivery_state === "failed")
1427
+ await this.deliverWakeIntent(intent.outbox_id, attempted, eligible);
1428
+ }
1429
+ else
1430
+ await this.maybeNudge(qitem_id, row.destinationSession, undefined, row.sourceSession);
1431
+ }
1432
+ }
1321
1433
  /**
1322
1434
  * W1 (transactional closure): the shared wake-send CORE. Builds the pane
1323
1435
  * envelope, sends with verify, and CLASSIFIES the transport result into the W1
@@ -1396,7 +1508,7 @@ export class QueueRepository {
1396
1508
  const genUuid = sourceSession
1397
1509
  ? (this.resolveOccupantGeneration?.(sourceSession) ?? undefined)
1398
1510
  : undefined;
1399
- text = wrapPaneEnvelope(sourceSession, destinationSession, bareBody, { stampISO, genUuid, replyToQitem: qitemId });
1511
+ text = wrapPaneEnvelope(sourceSession, destinationSession, bareBody, { stampISO, genUuid, replyToQitem: qitemId, ...this.senderReach(sourceSession) });
1400
1512
  }
1401
1513
  const deliveryId = `guard-nudge-${qitemId}-${createHash("sha256").update(JSON.stringify([sourceSession, destinationSession, bodyOverride ?? null])).digest("hex")}`;
1402
1514
  const held = !committedOutboxIds ? this.outbox?.getById(deliveryId) : null;
@@ -1658,6 +1770,11 @@ export class QueueRepository {
1658
1770
  }
1659
1771
  this.assertHumanAlert(input.humanAlert, input.destinationSession, input.humanIntent);
1660
1772
  const id = input.qitemId ?? newQitemId();
1773
+ // A row queue erasure deleted keeps only its id: a create that reuses it would bring erased work back.
1774
+ if (input.qitemId && this.hasErasedIdsTable
1775
+ && this.db.prepare("SELECT 1 FROM queue_erased_ids WHERE qitem_id = ?").get(input.qitemId)) {
1776
+ throw new QueueRepositoryError("qitem_erased", `qitem ${input.qitemId} was erased; its id can't be used again.`);
1777
+ }
1661
1778
  const ts = new Date().toISOString();
1662
1779
  const priority = input.priority ?? "routine";
1663
1780
  const tier = input.tier ?? null;
@@ -1736,8 +1853,11 @@ export class QueueRepository {
1736
1853
  }
1737
1854
  if (humanAlert !== true)
1738
1855
  return;
1739
- if (!this.isPersonAddress(destination) || humanIntent === "update") {
1740
- throw new QueueRepositoryError("invalid_human_notification", "humanAlert marks an ask to a person as alert-worthy: it needs a human destination, and an update isn't an ask.");
1856
+ if (!this.isPersonAddress(destination)) {
1857
+ throw new QueueRepositoryError("invalid_human_notification", "humanAlert marks an ask to a person as alert-worthy: it needs a human destination.");
1858
+ }
1859
+ if (humanIntent === "update") {
1860
+ throw new QueueRepositoryError("invalid_human_notification", "humanAlert marks an ask to a person as alert-worthy, and an update isn't an ask: send it without --alert; updates are notices; delivery depends on the person's connector and settings.");
1741
1861
  }
1742
1862
  }
1743
1863
  /** A person by address or by the registry: a registered person may be addressed as their seat or an alias. */
@@ -1769,6 +1889,14 @@ export class QueueRepository {
1769
1889
  const registry = this.loadHumanRegistryFn();
1770
1890
  return registry.ok && resolveRegisteredHumanAddress(destination, registry.entities) !== null;
1771
1891
  }
1892
+ /** The registered person an address names, so an ask back reaches them; null for anyone else, the unattributed
1893
+ * terminal actor included (it's a person address, but nothing is delivered there). */
1894
+ reachablePerson(address) {
1895
+ if (!address || address === UNATTRIBUTED_ACTOR)
1896
+ return null;
1897
+ const registry = this.loadHumanRegistryFn();
1898
+ return registry.ok ? resolveRegisteredHumanAddress(address, registry.entities) : null;
1899
+ }
1772
1900
  /** Who may answer an ask: the asked person, and any other registered person in this workspace, who's recorded as
1773
1901
  * themselves with the asked person kept (one trusted workspace, equal authority). A shared channel never answers. */
1774
1902
  answersAsk(item, actorSession) {
@@ -1814,6 +1942,11 @@ export class QueueRepository {
1814
1942
  * with `handed_off_from` recording the chain. One atomic transaction.
1815
1943
  */
1816
1944
  async handoff(input) {
1945
+ return this.handoffNow(input);
1946
+ }
1947
+ /** {@link handoff}'s whole act, synchronously: its transaction commits before this returns, and the wake is delivered
1948
+ * after commit without being awaited, so a synchronous caller (an answer's close path) can hand a row on. */
1949
+ handoffNow(input) {
1817
1950
  const source = this.getById(input.qitemId);
1818
1951
  if (!source) {
1819
1952
  throw new QueueRepositoryError("qitem_not_found", `qitem ${input.qitemId} not found`);
@@ -1950,8 +2083,11 @@ export class QueueRepository {
1950
2083
  this.assertTerminalClosureHasIntent(source.qitemId, newId, input.nudge);
1951
2084
  });
1952
2085
  txn();
2086
+ // Inside a caller's notify envelope (an answer's close path), the events join it; otherwise they're notified now.
1953
2087
  for (const e of events) {
1954
- this.eventBus.notifySubscribers(e.payload);
2088
+ const event = e.payload;
2089
+ if (!this.eventBus.registerPersistedWithinActiveEnvelope(event))
2090
+ this.eventBus.notifySubscribers(event);
1955
2091
  }
1956
2092
  // Closure and successor are persisted. Delivery is separate and recoverable
1957
2093
  // from the committed intent; a slow terminal must not hold the receipt.
@@ -3185,6 +3321,9 @@ export class QueueRepository {
3185
3321
  * button set is already final; its resolve continuation must not overwrite those answers.
3186
3322
  */
3187
3323
  resolveDirectHumanReply(input) {
3324
+ const passed = this.passRunnerAnswerToDecider(input);
3325
+ if (passed !== null)
3326
+ return passed;
3188
3327
  let mine = true;
3189
3328
  const result = this.db.transaction(() => {
3190
3329
  const item = this.getById(input.qitemId);
@@ -3212,6 +3351,143 @@ export class QueueRepository {
3212
3351
  }
3213
3352
  return mine;
3214
3353
  }
3354
+ /** A runner's permission ask its person answered, where an agent can decide while the runner waits on it: their answer
3355
+ * (a choice, or their words) stays on the ask, and the ask is handed to that agent to decide, never closed with it. The
3356
+ * runner reads pending until the agent decides (`rig seat decide-permission`), or the person uses a direct control.
3357
+ * Null when this doesn't apply (no decider, or another person's answer settles it), and the ask closes as before. */
3358
+ passRunnerAnswerToDecider(input) {
3359
+ const item = this.getById(input.qitemId);
3360
+ if (!this.permissionDecider || item?.state !== "pending" || !runnerPermissionOrigin(item) || item.humanIntent === "update"
3361
+ || (!this.answersAsk(item, input.actorSession) && !input.primaryUser) || !this.isPersonAddress(item.destinationSession)
3362
+ || this.committedAnswerFromAnother(item.qitemId, input.actorSession))
3363
+ return null;
3364
+ // The requester is the runner seat that asked: the first row of the request, whoever handed it on since.
3365
+ let root = item;
3366
+ for (let hops = 0; root.handedOffFrom && hops < 10; hops++) {
3367
+ const before = this.getById(root.handedOffFrom);
3368
+ if (!before || !runnerPermissionOrigin(before))
3369
+ break;
3370
+ root = before;
3371
+ }
3372
+ let chosen;
3373
+ try {
3374
+ chosen = this.permissionDecider(item, root.sourceSession);
3375
+ }
3376
+ catch {
3377
+ chosen = null;
3378
+ }
3379
+ const decider = chosen?.session ?? null;
3380
+ if (!decider || !this.validateRig(decider))
3381
+ return this.keepRunnerAnswer(item, input.actorSession, input.decision, root.sourceSession);
3382
+ this.db.transaction(() => { this.placeTypedReply(item, input.decision); })();
3383
+ const answered = this.getById(item.qitemId) ?? item;
3384
+ const question = (this.permissionQuestionsFor(answered) ?? [])[0];
3385
+ const answer = question ? answered.humanAnswers?.[question.id] : undefined;
3386
+ const said = typeof answer === "string" ? `chose "${question?.options.find((o) => o.id === answer)?.label ?? answer}" (option ${answer})`
3387
+ : answer && typeof answer === "object" && "text" in answer ? `wrote "${String(answer.text).trim()}"`
3388
+ : "answered without a choice or words";
3389
+ const person = input.actorSession;
3390
+ // Who to ask back: the person who answered when OpenRig can name them, else the person the request went to.
3391
+ const unattributed = person === UNATTRIBUTED_ACTOR;
3392
+ const askBack = (unattributed ? null : this.reachablePerson(person)) ?? this.reachablePerson(item.destinationSession);
3393
+ // A handoff that fails after persisting its events rolls them back with its savepoint: discardOnThrow takes their
3394
+ // tokens out of the caller's notify envelope too, so the kept answer below still commits.
3395
+ try {
3396
+ this.eventBus.discardOnThrow(() => this.handoffNow({
3397
+ qitemId: item.qitemId, fromSession: person, toSession: decider,
3398
+ summary: `Decide: ${item.summary ?? "a runner's permission request"} (${person} answered)`,
3399
+ transitionNote: `runner-permission-answer-passed: ${person}'s answer goes to ${decider}, the receiving agent, to decide while the runner waits`,
3400
+ body: [
3401
+ `${person} answered ${item.sourceSession}'s permission request ${item.qitemId}: they ${said}. Its runner is waiting on your decision: nothing is permitted or refused until you decide.`,
3402
+ "",
3403
+ `- **Question:** ${question?.question ?? "Allow this tool call?"}`,
3404
+ "- **Options:**",
3405
+ ...(question?.options ?? []).map((o) => ` - ${o.label} (${o.id})`),
3406
+ "",
3407
+ `Their whole answer is recorded on the request: rig queue show ${answered.qitemId} --full.`,
3408
+ `Decide with: rig seat decide-permission ${item.qitemId} --option <id> --reason "<why>"`,
3409
+ `- **Who's who:** ${root.sourceSession} is the agent asking to run the tool; ${item.destinationSession} is the person it asked; ${person} answered.`,
3410
+ ...(unattributed ? [terminalAnswerMeaning(UNATTRIBUTED_ACTOR)] : []),
3411
+ "Act on a clear answer at once: a clear yes or an allow click is the allow option, a clear no or a reject click the reject option. Don't ask them to confirm a clear answer.",
3412
+ `${askBackRoute(askBack, UNATTRIBUTED_ACTOR, `request ${item.qitemId}`)} Then decide on what they answer.`,
3413
+ "Until it's decided (by you, or by anyone with that command), the runner keeps waiting, with no timeout that refuses it; if its turn ends first, nothing is sent.",
3414
+ RUNNER_CLOSE_WAITS,
3415
+ ].join("\n"),
3416
+ }));
3417
+ }
3418
+ catch (error) {
3419
+ // Kept, and committed with the answer's own write (a throw here would roll it back): the request stays open, and
3420
+ // the person is told it couldn't be passed on. Never a default permit.
3421
+ console.error(`[queue] a runner permission answer couldn't be handed to ${decider}; it's kept and the request stays open`, error);
3422
+ return this.keepRunnerAnswer(item, person, input.decision, root.sourceSession, decider);
3423
+ }
3424
+ // The person learns who decides and in what recorded state, so a delay is shown: one update per request.
3425
+ const toldId = `qitem-runner-permission-passed-${item.qitemId.replace(/^qitem-runner-permission-/, "").replace(/^qitem-/, "")}`;
3426
+ setImmediate(() => {
3427
+ // The request the person answered is what they'd judge (convention C3: a note to a person names its evidence).
3428
+ void this.create({ qitemId: toldId, sourceSession: root.sourceSession, destinationSession: person, humanIntent: "update",
3429
+ evidenceRef: `rig queue show ${root.qitemId}`,
3430
+ summary: `Your answer went to ${decider} to decide; ${root.sourceSession} is waiting`,
3431
+ body: [`Your answer to ${root.sourceSession}'s permission request ${root.qitemId} went to ${decider}, which decides it while ${root.sourceSession} waits. Nothing runs until it decides.`,
3432
+ ...(chosen?.describe ? [`Receiving agent: ${chosen.describe}`] : []),
3433
+ `To decide directly instead: rig seat decide-permission ${root.qitemId} --option <id>.`].join("\n") })
3434
+ .catch((error) => console.error(`[queue] the update for ${item.qitemId}'s decider wasn't written`, error));
3435
+ });
3436
+ return true;
3437
+ }
3438
+ /** An agent's decision on a runner's permission request, on the row that holds it now: the chosen option under its
3439
+ * question, and the row closed done, in one transaction. False when the row isn't open any more. */
3440
+ recordPermissionDecision(input) {
3441
+ const result = this.db.transaction(() => {
3442
+ const item = this.getById(input.qitemId);
3443
+ if (!item)
3444
+ return null;
3445
+ const answers = { ...item.humanAnswers, [input.questionId]: input.optionId };
3446
+ // A row closed without a decision (an agent's or a person's ordinary close): the decision is recorded on it, with
3447
+ // its own transition, over any kept answer (which the transition names); the runner's next read takes it.
3448
+ // (The caller read it first: a row already decided explicitly, withdrawn or stale never reaches here.)
3449
+ if (item.state === "done" || item.state === "failed") {
3450
+ this.db.prepare("UPDATE queue_items SET human_answers = ? WHERE qitem_id = ?").run(JSON.stringify(answers), item.qitemId);
3451
+ this.transitionLog.append({ qitemId: item.qitemId, state: item.state, actorSession: input.actorSession, transitionNote: input.transitionNote });
3452
+ // The row's state doesn't change, but its decision does: a runner waiting on this request reads it now, and
3453
+ // Steering refreshes.
3454
+ return { persistedEvents: [this.eventBus.persistWithinTransaction({ type: "queue.updated", qitemId: item.qitemId,
3455
+ fromState: item.state, toState: item.state, closureReason: null, closureTarget: null,
3456
+ actorSession: input.actorSession, summary: item.summary ?? null })] };
3457
+ }
3458
+ if (item.state !== "pending" && item.state !== "in-progress" && item.state !== "blocked")
3459
+ return null;
3460
+ this.db.prepare("UPDATE queue_items SET human_answers = ? WHERE qitem_id = ?").run(JSON.stringify(answers), item.qitemId);
3461
+ return this.updateInTransactionalContext({ qitemId: item.qitemId, actorSession: input.actorSession, state: "done",
3462
+ closureReason: "no-follow-on", transitionNote: input.transitionNote });
3463
+ })();
3464
+ if (!result)
3465
+ return false;
3466
+ for (const event of result.persistedEvents) {
3467
+ if (!this.eventBus.registerPersistedWithinActiveEnvelope(event))
3468
+ this.eventBus.notifySubscribers(event);
3469
+ }
3470
+ return true;
3471
+ }
3472
+ /** No agent here can read a runner permission answer before the tool runs (none is set, or the only one is the seat
3473
+ * asking): the person's answer, a click or words, is kept on the ask, the request stays pending, and the person is
3474
+ * told once that the tool hasn't run and how to decide directly. Never a default permit, never read as a refusal. */
3475
+ keepRunnerAnswer(item, person, decision, requester, unreachable) {
3476
+ this.db.transaction(() => { this.placeTypedReply(item, decision); })();
3477
+ const options = (this.permissionQuestionsFor(item) ?? [])[0]?.options ?? [];
3478
+ const receiptId = `qitem-runner-permission-kept-${item.qitemId.replace(/^qitem-runner-permission-/, "")}`;
3479
+ // After the answer's own write settles: one receipt per request (its id is the request's), told to who answered.
3480
+ setImmediate(() => {
3481
+ void this.create({ qitemId: receiptId, sourceSession: requester, destinationSession: person, humanIntent: "update",
3482
+ evidenceRef: `rig queue show ${item.qitemId}`,
3483
+ summary: `Your answer to ${requester}'s permission request is kept; the tool hasn't run`,
3484
+ body: [`Your answer to ${requester}'s permission request ${item.qitemId} is kept, and the request is still waiting: ${unreachable ? `it couldn't be passed to ${unreachable}, the receiving agent, just now (answer again to retry)` : `no receiving agent on this host can read it before the tool runs (none is set, or the only one is ${requester} itself)`}. The tool hasn't run, and nothing was permitted or refused.`,
3485
+ `To decide now: rig seat decide-permission ${item.qitemId} --option <id>${options.length ? ` (options: ${options.map((o) => `${o.id}, ${o.label}`).join("; ")})` : ""}. Or set up a receiving agent that isn't ${requester}: rig config set agents.operator_session <seat>@<rig>.`,
3486
+ "If the agent's turn ends first, the tool call doesn't happen, and nothing is sent later."].join("\n") })
3487
+ .catch((error) => console.error(`[queue] the kept-answer receipt for ${item.qitemId} wasn't written`, error));
3488
+ });
3489
+ return true;
3490
+ }
3215
3491
  /** Another person's committed return to this ask: its shared reply (for a park's question, `episodeKey`'s). It's the
3216
3492
  * answer, so a different person's later attempt settles with it rather than their own. Null when there's none, or it's
3217
3493
  * this actor's. */
@@ -3362,15 +3638,18 @@ export class QueueRepository {
3362
3638
  listRelayOwnerNotificationReceipts(qitemId) {
3363
3639
  return this.transitionLog.listRelayOwnerNotificationReceipts(qitemId);
3364
3640
  }
3365
- getRelayOwnerNotificationReceipt(qitemId, notificationKey) {
3366
- return this.transitionLog.getRelayOwnerNotificationReceipt(qitemId, notificationKey);
3641
+ getRelayOwnerNotificationReceipt(qitemId, notificationKey, deliveryId) {
3642
+ return this.transitionLog.getRelayOwnerNotificationReceipt(qitemId, notificationKey, deliveryId);
3367
3643
  }
3368
- hasRelayOwnerNotificationReceipt(qitemId, notificationKey) {
3369
- return this.transitionLog.hasRelayOwnerNotificationReceipt(qitemId, notificationKey);
3644
+ hasRelayOwnerNotificationReceipt(qitemId, notificationKey, deliveryId) {
3645
+ return this.transitionLog.hasRelayOwnerNotificationReceipt(qitemId, notificationKey, deliveryId);
3370
3646
  }
3371
3647
  findRelayOwnerNotificationReceiptByReplyRef(replyRef) {
3372
3648
  return this.transitionLog.findRelayOwnerNotificationReceiptByReplyRef(replyRef);
3373
3649
  }
3650
+ findRelayOwnerNotificationReceiptByDeliveryId(deliveryId) {
3651
+ return this.transitionLog.findRelayOwnerNotificationReceiptByDeliveryId(deliveryId);
3652
+ }
3374
3653
  recordRelayOwnerNotificationTransportFailed(input) {
3375
3654
  const current = this.getByIdOrThrow(input.qitemId);
3376
3655
  const key = typeof input.notificationKey === "string" && input.notificationKey.trim().length > 0
@@ -3534,20 +3813,20 @@ export class QueueRepository {
3534
3813
  ORDER BY json_extract(delegated_decision, '$.decidedAt'), qitem_id`).all(applicationId);
3535
3814
  return rows.map((row) => this.rowToItem(row));
3536
3815
  }
3537
- getById(qitemId) {
3816
+ /** opts.waiting: false skips the row's waiting view (the stuck sweep's own reads); the default builds it. Per call:
3817
+ * it never changes what another read returns. */
3818
+ getById(qitemId, opts) {
3538
3819
  const row = this.db
3539
3820
  .prepare("SELECT * FROM queue_items WHERE qitem_id = ?")
3540
3821
  .get(qitemId);
3541
3822
  if (!row)
3542
3823
  return null;
3543
- const item = this.rowToItem(row);
3544
3824
  // OPR.0.5.6.14 — the row FACE answers "did it reach them" in one read for
3545
3825
  // gateway-routed rows; null for pane-bound (absence-governed, no key lies).
3546
- const ledger = this.deliveryOutcomeFor(item.qitemId);
3826
+ // The same projection as a listing's, for one row: one read of its owner notifications and ledger.
3827
+ const item = this.projectRows([row], opts?.waiting !== false)[0];
3547
3828
  return {
3548
3829
  ...item,
3549
- deliveryOutcome: ledger?.outcome ?? null,
3550
- ...(ledger && ledger.outcome !== "posted" && ledger.outcome !== "accepted" ? { deliveryFailureDetail: ledger.detail } : {}),
3551
3830
  ...(item.replyTo ? { replyToFallback: this.replyToFallbackFor(item.qitemId) } : {}),
3552
3831
  };
3553
3832
  }
@@ -3677,18 +3956,24 @@ export class QueueRepository {
3677
3956
  const rows = this.db
3678
3957
  .prepare(`SELECT ${columns} FROM queue_items ${where} ORDER BY ${orderBy} LIMIT ?`)
3679
3958
  .all(...params);
3959
+ const items = this.projectRows(rows, !opts?.compact);
3960
+ return opts?.compact ? items.map(compactRow) : items;
3961
+ }
3962
+ /** The listing projection (list, and show as a listing of one row): each row's item with its delivery outcome, the
3963
+ * owner notifications, ledgers and shared reads read once for all the rows. includeWaiting: full rows (SELECT *). */
3964
+ projectRows(rows, includeWaiting) {
3680
3965
  const owners = this.transitionLog.ownerNotificationsForQitems(rows.map((row) => row.qitem_id));
3681
3966
  const ledgers = this.deliveryOutcomesFor(rows, owners, true);
3682
- const items = rows.map((r) => {
3967
+ const reads = this.listingReads(rows, includeWaiting);
3968
+ return rows.map((r) => {
3683
3969
  const ledger = ledgers.get(r.qitem_id);
3684
- const item = this.rowToItem(r, !opts?.compact, { owners: owners.get(r.qitem_id) ?? [], ledger: ledger ?? null });
3970
+ const item = this.rowToItem(r, includeWaiting, { owners: owners.get(r.qitem_id) ?? [], ledger: ledger ?? null, reads });
3685
3971
  return {
3686
3972
  ...item,
3687
3973
  deliveryOutcome: ledger?.outcome ?? null,
3688
3974
  ...(ledger && ledger.outcome !== "posted" && ledger.outcome !== "accepted" ? { deliveryFailureDetail: ledger.detail } : {}),
3689
3975
  };
3690
3976
  });
3691
- return opts?.compact ? items.map(compactRow) : items;
3692
3977
  }
3693
3978
  /**
3694
3979
  * OPR.0.3.2.20 — durable attention-class query.
@@ -3853,7 +4138,7 @@ export class QueueRepository {
3853
4138
  params.push(opts.limit);
3854
4139
  }
3855
4140
  const rows = this.db.prepare(sql).all(...params);
3856
- const items = rows.map((r) => this.rowToItem(r, !opts?.compact));
4141
+ const items = rows.map((r) => this.rowToItem(r, !opts?.compact && opts?.waiting !== false));
3857
4142
  return opts?.compact ? items.map(compactRow) : items;
3858
4143
  }
3859
4144
  /**
@@ -3947,7 +4232,7 @@ export class QueueRepository {
3947
4232
  const rows = this.db.prepare(sql).all(...params);
3948
4233
  const out = [];
3949
4234
  for (const r of rows) {
3950
- const item = this.rowToItem(r, !opts?.compact);
4235
+ const item = this.rowToItem(r, !opts?.compact && opts?.waiting !== false);
3951
4236
  const ledger = this.deliveryOutcomeFor(item.qitemId);
3952
4237
  if (ledger?.outcome === "posted" || ledger?.outcome === "accepted")
3953
4238
  continue; // the receipt wins, always
@@ -4033,6 +4318,80 @@ export class QueueRepository {
4033
4318
  return false;
4034
4319
  }
4035
4320
  }
4321
+ /** Whether the rosters list this address as a hosted member on this host, trigger or not. An unreadable roster reads
4322
+ * false. */
4323
+ isHostedMember(destination) {
4324
+ try {
4325
+ return this.hostedMemberFn(destination);
4326
+ }
4327
+ catch {
4328
+ return false;
4329
+ }
4330
+ }
4331
+ /** Whether two addresses name the same session (one of its canonical or physical names). */
4332
+ isSameSession(a, b) {
4333
+ if (a === b)
4334
+ return true;
4335
+ try {
4336
+ return this.resolveSessionAddresses(a).includes(b) || this.resolveSessionAddresses(b).includes(a);
4337
+ }
4338
+ catch {
4339
+ return false;
4340
+ }
4341
+ }
4342
+ /** A session's successful read of its own pending inbox, as the list route decides: availability, never a receipt,
4343
+ * claim or answer for any row. Written at most once a minute per session; a failed write is logged once and never
4344
+ * fails the read that made it. */
4345
+ recordInboxCheckIn(session, at = new Date()) {
4346
+ const last = this.inboxCheckInWrittenAt.get(session);
4347
+ if (last !== undefined && at.getTime() >= last && at.getTime() - last < INBOX_CHECKIN_WRITE_INTERVAL_MS)
4348
+ return;
4349
+ try {
4350
+ this.db.prepare(`INSERT INTO queue_inbox_checkins (session, checked_at) VALUES (?, ?)
4351
+ ON CONFLICT(session) DO UPDATE SET checked_at = excluded.checked_at WHERE excluded.checked_at > queue_inbox_checkins.checked_at`)
4352
+ .run(session, at.toISOString());
4353
+ this.inboxCheckInWrittenAt.set(session, at.getTime());
4354
+ }
4355
+ catch (err) {
4356
+ if (!this.inboxCheckInWriteFailed) {
4357
+ console.error(`[queue] inbox check-in not recorded for ${session}: ${err instanceof Error ? err.message : String(err)}`);
4358
+ }
4359
+ this.inboxCheckInWriteFailed = true;
4360
+ }
4361
+ }
4362
+ /** Each hosted member on this host with its check-in status: its stated cadence against its own inbox reads. A status
4363
+ * only; nothing here changes how work reaches it. */
4364
+ hostedMemberCheckIns(now = new Date()) {
4365
+ return this.hostedMembersFn().map((m) => ({ seat: m.seat, rung: m.wake !== undefined,
4366
+ ...memberCheckInStatus({ checkInMinutes: m.check_in_minutes, onRequest: m.check_in_on_request, cadenceProblem: m.check_in_problem,
4367
+ checkIn: this.lastInboxCheckIn(m.seat), now }) }));
4368
+ }
4369
+ /** One member's check-in status, as `hostedMemberCheckIns` gives it. A seat the rosters don't list here (or can't be
4370
+ * read for) states no cadence, so it reads by its check-ins alone. */
4371
+ hostedMemberCheckIn(seat, now = new Date()) {
4372
+ let member;
4373
+ try {
4374
+ member = this.hostedMembersFn().find((m) => this.isSameSession(m.seat, seat));
4375
+ }
4376
+ catch {
4377
+ member = undefined;
4378
+ }
4379
+ // The roster's spelling of the seat, as the list read uses, so both read the same check-ins.
4380
+ return memberCheckInStatus({ checkInMinutes: member?.check_in_minutes, onRequest: member?.check_in_on_request,
4381
+ cadenceProblem: member?.check_in_problem, checkIn: this.lastInboxCheckIn(member?.seat ?? seat), now });
4382
+ }
4383
+ /** This session's latest recorded check-in under any of its names. */
4384
+ lastInboxCheckIn(session) {
4385
+ try {
4386
+ const names = [...new Set([session, ...this.resolveSessionAddresses(session)])];
4387
+ const row = this.db.prepare(`SELECT MAX(checked_at) AS at FROM queue_inbox_checkins WHERE session IN (${names.map(() => "?").join(", ")})`)
4388
+ .get(...names);
4389
+ return row?.at ? { state: "seen", at: row.at } : { state: "never" };
4390
+ }
4391
+ catch {
4392
+ return { state: "unknown" };
4393
+ }
4394
+ }
4036
4395
  classifyDestinationOf(destinationSession) {
4037
4396
  return classifyDestination(destinationSession, {
4038
4397
  entities: (() => {
@@ -4080,7 +4439,7 @@ export class QueueRepository {
4080
4439
  /** Null means legacy/no OWNER history; inactive means OWNER history exists
4081
4440
  * but the row no longer projects a current human-notification episode.
4082
4441
  * owners: the row's owner notifications, newest first. */
4083
- currentDeliveryEpisode(item, owners, loadRegistry) {
4442
+ currentDeliveryEpisode(item, owners, loadRegistry, loadProfiles, loadPullOutboxKeys) {
4084
4443
  let transition = owners[0];
4085
4444
  if (!transition)
4086
4445
  return null;
@@ -4109,14 +4468,26 @@ export class QueueRepository {
4109
4468
  : item.state === "blocked"
4110
4469
  ? resolveRegisteredHumanAddress(item.blockedOn, registry.entities)
4111
4470
  : resolveRegisteredHumanAddress(item.destinationSession, registry.entities);
4471
+ const entity = humanAddress ? registry.entities.find((entry) => entry.address === humanAddress) : undefined;
4112
4472
  // A person with no connector is reached in the Feed and Steering only: nothing is posted to them, so nothing is owed.
4113
- if (humanAddress && registry.entities.find((entity) => entity.address === humanAddress)?.connectorBindings.length === 0)
4473
+ if (entity?.connectorBindings.length === 0)
4114
4474
  return "inactive";
4475
+ const notificationKey = `${item.qitemId}:${transition.transitionId}`;
4476
+ // A ready pull-mode relay has no required polling cadence (#2742): while the outbox lists the staged envelope, waiting
4477
+ // to be pulled is not a missing post for PULL_OUTBOX_NEVER_POSTED_WINDOW_MS. ledgerOf asks only when nothing else
4478
+ // decides the outcome; a notice the outbox doesn't list gets the usual NEVER_POSTED_WINDOW_MS.
4479
+ const primary = entity?.connectorBindings.find((b) => b.role === "primary") ?? entity?.connectorBindings[0];
4480
+ const awaitingPull = primary?.kind === "relay"
4481
+ ? () => {
4482
+ const p = loadProfiles(registry.entities).get(primary.connectorRef);
4483
+ return p?.ready === true && p.mode === "pull" && loadPullOutboxKeys().has(`${primary.connectorRef}\n${notificationKey}`);
4484
+ }
4485
+ : undefined;
4115
4486
  // An ask placed on Steering without an alert (RECORD) owes no post: its ledger reports a real receipt (a posting
4116
4487
  // dial set to RECORD posts it) and never a missing one.
4117
4488
  return humanAddress
4118
- ? { notificationKey: `${item.qitemId}:${transition.transitionId}`, startedAt: transition.ts,
4119
- ...(transition.ownerNotificationLevel === "RECORD" ? { quiet: true } : {}) }
4489
+ ? { notificationKey, startedAt: transition.ts,
4490
+ ...(transition.ownerNotificationLevel === "RECORD" ? { quiet: true } : awaitingPull ? { awaitingPull } : {}) }
4120
4491
  : "inactive";
4121
4492
  }
4122
4493
  /** OPR.0.5.6.14 — derive the current episode's delivery ledger. Receipt
@@ -4212,9 +4583,13 @@ export class QueueRepository {
4212
4583
  let notes = receiptsAfterEpisodes ? undefined : this.receiptNotesFor(qitemIds);
4213
4584
  let registry;
4214
4585
  const loadRegistry = () => (registry ??= this.loadHumanRegistryFn());
4586
+ let relayProfiles;
4587
+ const loadProfiles = (entities) => (relayProfiles ??= loadRelayProfiles(undefined, { entities }));
4588
+ let pullOutboxKeys;
4589
+ const loadPullOutboxKeys = () => (pullOutboxKeys ??= listablePullOutboxKeys());
4215
4590
  const episodes = rows.map((row) => {
4216
4591
  const item = ledgerItem(row);
4217
- return { item, episode: this.currentDeliveryEpisode(item, owners.get(row.qitem_id) ?? [], loadRegistry) };
4592
+ return { item, episode: this.currentDeliveryEpisode(item, owners.get(row.qitem_id) ?? [], loadRegistry, loadProfiles, loadPullOutboxKeys) };
4218
4593
  });
4219
4594
  notes ??= this.receiptNotesFor(qitemIds);
4220
4595
  for (const { item, episode } of episodes) {
@@ -4265,7 +4640,8 @@ export class QueueRepository {
4265
4640
  const gatewayRouted = episode !== null || item.lastNudgeResult?.startsWith("gateway-owned") === true;
4266
4641
  if (gatewayRouted) {
4267
4642
  const ageMs = Date.now() - new Date(startedAt.includes("T") ? startedAt : startedAt + "Z").getTime();
4268
- if (ageMs > QueueRepository.NEVER_POSTED_WINDOW_MS) {
4643
+ if (ageMs > QueueRepository.NEVER_POSTED_WINDOW_MS
4644
+ && !(ageMs <= QueueRepository.PULL_OUTBOX_NEVER_POSTED_WINDOW_MS && episode?.awaitingPull?.())) {
4269
4645
  const key = episode ? ` for notification_key=${episode.notificationKey}` : "";
4270
4646
  return { outcome: "never-posted", detail: `gateway-routed row with no delivery receipt${key} past the post window`, episode };
4271
4647
  }
@@ -4275,6 +4651,9 @@ export class QueueRepository {
4275
4651
  /** The grace window before a receiptless gateway-routed row honestly reads
4276
4652
  * never-posted (the connector sweep cadence bounds normal posting latency). */
4277
4653
  static NEVER_POSTED_WINDOW_MS = 120_000;
4654
+ /** How long a notice staged in the relay pull outbox may wait for the connector's ack before it reads never-posted
4655
+ * (#2742). */
4656
+ static PULL_OUTBOX_NEVER_POSTED_WINDOW_MS = 24 * 60 * 60 * 1000;
4278
4657
  /** Record one wake attempt. */
4279
4658
  recordNudgeAttempt(qitemId, result) {
4280
4659
  const ts = new Date().toISOString();
@@ -4557,9 +4936,30 @@ export class QueueRepository {
4557
4936
  return null;
4558
4937
  }
4559
4938
  }
4939
+ /** What a listing reads once for all its rows instead of once per row. includeWaiting: the rows' waiting views read
4940
+ * their qitem blockers' last meaningful transitions too. */
4941
+ listingReads(rows, includeWaiting) {
4942
+ const ids = rows.map((r) => r.qitem_id);
4943
+ if (includeWaiting)
4944
+ for (const r of rows)
4945
+ if (r.blocked_on)
4946
+ ids.push(r.blocked_on);
4947
+ // Each owner's activity once per listing: a row and its waiting view (and every other row to that owner) read the
4948
+ // same seat state. ownerActivity reads a failure as null, so one session's failure stays that session's.
4949
+ const activities = new Map();
4950
+ const activity = (session) => {
4951
+ if (!activities.has(session))
4952
+ activities.set(session, this.ownerActivity(session));
4953
+ return activities.get(session) ?? null;
4954
+ };
4955
+ return { meaningful: lastMeaningfulTransitionMany(this.db, ids), statements: new WaitingStatements(this.db), activity };
4956
+ }
4560
4957
  /** listed: the row's owner notifications and ledger, when a listing read them for all its rows. */
4561
4958
  waitingView(qitemId, listed) {
4562
- const view = readWaitingView(this.db, qitemId, this.activityReader, target => this.acceptsDestination(target));
4959
+ // The row in hand, when the listing passed it: its later re-reads below are served by it too.
4960
+ const inHand = listed?.row && listed.row.qitem_id === qitemId ? listed.row : undefined;
4961
+ const reads = listed?.reads && inHand ? { ...listed.reads, row: inHand } : listed?.reads;
4962
+ const view = readWaitingView(this.db, qitemId, listed?.reads?.activity ?? this.activityReader, target => this.acceptsDestination(target), reads);
4563
4963
  if (view && ["pending", "in-progress"].includes(view.state)) {
4564
4964
  // #514 — the unclaimed sweep skips a pending ask already posted to its human in the current
4565
4965
  // episode (same predicate as runStuckSweep), so the view must not promise that sweep.
@@ -4567,7 +4967,9 @@ export class QueueRepository {
4567
4967
  const posted = episodeDelivery !== null;
4568
4968
  const onSteering = !posted && view.state === "pending" && this.humanAskWithoutAlert(qitemId, listed);
4569
4969
  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)
4970
+ ? inHand
4971
+ ? { state: inHand.state, human_intent: inHand.human_intent ?? null, destination_session: inHand.destination_session, last_nudge_result: inHand.last_nudge_result }
4972
+ : 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
4973
  : undefined;
4572
4974
  const humanUpdate = !!row && this.isRegisteredHumanUpdate({ state: row.state, humanIntent: row.human_intent, destinationSession: row.destination_session });
4573
4975
  const noticeOutcome = !posted && !onSteering ? (listed ? listed.ledger?.outcome : this.deliveryOutcomeFor(qitemId)?.outcome) : undefined;
@@ -4596,8 +4998,8 @@ export class QueueRepository {
4596
4998
  view.laterBackstop = { ...view.nextBackstop, note: "Conditional safety net; current delivery/recovery ownership is evaluated first." };
4597
4999
  view.nextBackstop = recovery;
4598
5000
  }
4599
- else if (!awaitingHuman && view.state === "pending" && this.db.prepare("SELECT last_nudge_result FROM queue_items WHERE qitem_id = ?")
4600
- .get(qitemId)?.last_nudge_result === "retained:typing_guard") {
5001
+ else if (!awaitingHuman && view.state === "pending" && (inHand ?? this.db.prepare("SELECT last_nudge_result FROM queue_items WHERE qitem_id = ?")
5002
+ .get(qitemId))?.last_nudge_result === "retained:typing_guard") {
4601
5003
  // Held at the seat on purpose: not stuck, and not picked up. Nothing replays it; reading or delivering it is a
4602
5004
  // deliberate step.
4603
5005
  view.nextBackstop = { owner: view.owner, mechanism: "held by the seat's typing guard", dueAt: null, intervalSeconds: null, held: true,
@@ -4645,9 +5047,11 @@ export class QueueRepository {
4645
5047
  rowToItem(row, includeWaiting = true, listed) {
4646
5048
  // S04 — derive the pickup receipt at the ONE shared projection point (list/show/overdue
4647
5049
  // all flow through here), so the park-vs-strand question is answered by the row face.
4648
- const meaningful = lastMeaningfulTransition(this.db, row.qitem_id);
4649
- const waiting = includeWaiting ? this.waitingView(row.qitem_id, listed) : null;
4650
- const activity = this.ownerActivity(row.destination_session);
5050
+ const meaningful = meaningfulFor(this.db, row.qitem_id, listed?.reads);
5051
+ // A listing's rows are its own SELECT *: the waiting view reads the row in hand instead of reading it again.
5052
+ const waiting = includeWaiting ? this.waitingView(row.qitem_id, listed?.reads ? { ...listed, row } : listed) : null;
5053
+ const listedActivity = listed?.reads?.activity;
5054
+ const activity = listedActivity ? listedActivity(row.destination_session) : this.ownerActivity(row.destination_session);
4651
5055
  const pickup = derivePickup({
4652
5056
  state: row.state,
4653
5057
  lastMeaningfulAt: meaningful?.at,
@@ -4704,6 +5108,7 @@ export class QueueRepository {
4704
5108
  // PL-007: target_repo present only when migration 038 has applied;
4705
5109
  // older test fixtures supply legacy rows where target_repo is undefined.
4706
5110
  targetRepo: row.target_repo ?? null,
5111
+ ...(row.content_erased_at ? { contentErasedAt: row.content_erased_at } : {}),
4707
5112
  };
4708
5113
  }
4709
5114
  }
@@ -4721,6 +5126,42 @@ function ledgerItem(row) {
4721
5126
  function isOutboundOwnerNotice(t) {
4722
5127
  return t.ownerNotificationLevel != null && t.ownerNotificationKind != null && t.ownerNotificationKind !== "human-decision-resolved";
4723
5128
  }
5129
+ /** The `<connectorRef>\n<notificationKey>` pairs GET /api/gateway/relay/outbox would list now: staged in the
5130
+ * DispatchBuffer and the attempted store, under a connector whose listing isn't refused for an invalid envelope. A store
5131
+ * the outbox can't read (so it answers 503) lists nothing. */
5132
+ function listablePullOutboxKeys() {
5133
+ let pending;
5134
+ let attempted;
5135
+ try {
5136
+ const home = getOpenRigHome();
5137
+ pending = new DispatchBuffer(home).pendingStrict();
5138
+ const { attemptedPath, deliveredPath } = relayStatePaths(home);
5139
+ attempted = new SeenStore(attemptedPath).statuses();
5140
+ new SeenStore(deliveredPath).statuses();
5141
+ }
5142
+ catch {
5143
+ return new Set();
5144
+ }
5145
+ const listed = [];
5146
+ const refused = new Set();
5147
+ for (const decision of pending) {
5148
+ const p = decision.payload && typeof decision.payload === "object" ? decision.payload : null;
5149
+ const ref = p?.relayConnectorRef;
5150
+ if (!p || typeof ref !== "string" || !ref || !attempted.has(decision.decisionId))
5151
+ continue;
5152
+ if (!p.relayEnvelope || !validateRelayOutboundEnvelope(p.relayEnvelope).ok) {
5153
+ refused.add(ref);
5154
+ continue;
5155
+ }
5156
+ const keys = p.deliveryDigestPost && Array.isArray(p.memberReceipts) && p.memberReceipts.length > 0
5157
+ ? p.memberReceipts.map((m) => m?.notificationKey)
5158
+ : [p.notificationKey || p.qitemId];
5159
+ for (const key of keys)
5160
+ if (typeof key === "string" && key)
5161
+ listed.push([ref, key]);
5162
+ }
5163
+ return new Set(listed.filter(([ref]) => !refused.has(ref)).map(([ref, key]) => `${ref}\n${key}`));
5164
+ }
4724
5165
  function isQueueState(value) {
4725
5166
  return typeof value === "string" && QUEUE_STATES.includes(value);
4726
5167
  }