@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
@@ -32,6 +32,7 @@ import { createLinkedSuccessorLookup, deriveCrossHostSuccessorId, hasLinkedSucce
32
32
  import { stalledPickupFinding } from "./queue-pickup.js";
33
33
  import { SettingsStore } from "./user-settings/settings-store.js";
34
34
  import { loadHostRegistry } from "./hosts/hosts-registry-reader.js";
35
+ import { describeCheckIn, readWakeOutcome } from "./connection-contract.js";
35
36
  export const STUCK_SWEEP_INTERVAL_KEY = "queue.stuck_sweep_interval_seconds";
36
37
  export const DEFAULT_STUCK_SWEEP_INTERVAL_SECONDS = 300;
37
38
  export const STUCK_SWEEP_UNCLAIMED_AGE_KEY = "queue.stuck_sweep_unclaimed_age_minutes";
@@ -51,6 +52,11 @@ const NO_WAKE_ROUTE_RULES = [
51
52
  "the row's creator",
52
53
  "the operator agent (agents.operator_session)",
53
54
  ];
55
+ /** How a failed wake's finding at a seat with no declared route names the rule that chose its recipient, in the order tried. */
56
+ const FAILED_WAKE_ROUTE_RULES = [
57
+ "the row's creator",
58
+ "the operator agent (agents.operator_session)",
59
+ ];
54
60
  // S01 ladder marker vocabulary (the seam contract). S01 writes these transition-note
55
61
  // prefixes; the sweep derives "live ladder" from the latest marker. An attempt/rung is
56
62
  // LIVE, an exhausted marker hands the row back, and a later attempt starts a live cycle
@@ -101,6 +107,7 @@ export function createStuckSweepStatus() {
101
107
  lastError: null,
102
108
  consecutiveFailures: 0,
103
109
  findingsRouted: 0,
110
+ findingsOpen: 0,
104
111
  runningSince: null,
105
112
  skippedTicks: 0,
106
113
  };
@@ -110,8 +117,10 @@ export function createStuckSweepStatus() {
110
117
  state.lastOutcome = outcome;
111
118
  state.lastError = outcome === "failed" ? (detail?.error ?? "unknown error") : null;
112
119
  state.consecutiveFailures = outcome === "failed" ? state.consecutiveFailures + 1 : 0;
113
- if (detail?.findings)
114
- state.findingsRouted += detail.findings;
120
+ if (detail?.created)
121
+ state.findingsRouted += detail.created;
122
+ if (detail?.open !== undefined)
123
+ state.findingsOpen = detail.open;
115
124
  },
116
125
  pass(pass) {
117
126
  state.runningSince = pass.runningSince;
@@ -149,8 +158,10 @@ export { resolveSessionNodeId, defaultResolveOrchestrator, resolveOperatorSeat }
149
158
  * ladder live again. Unrelated transitions do not change the latest marker. */
150
159
  /** Durable custody-verification disposition: a transition note on the CLOSED source row,
151
160
  * written by whoever performed the registered-host read (never by this detector),
152
- * `custody-verified: <exact-target> <free-form how/where>`. Prefix-anchored parse; the
153
- * target is the first whitespace-delimited token after the prefix, matched exactly.
161
+ * `custody-verified: <exact-target> <free-form how/where>`. Prefix-anchored parse; per note,
162
+ * the first whitespace-delimited word after the prefix that names one of the row's targets
163
+ * (itself or a comma member, matched exactly) is what that note verifies, so prose naming the
164
+ * successor later still verifies it while a later mention of another target doesn't (#2841).
154
165
  * Read from the ACTIVE table AND the retention archive: the daily archiver MOVES every
155
166
  * transition of an aged terminal qitem into `queue_transitions_archive` (the exact class
156
167
  * custody rows belong to) while the row itself keeps participating in this sweep, so an
@@ -158,7 +169,7 @@ export { resolveSessionNodeId, defaultResolveOrchestrator, resolveOperatorSeat }
158
169
  * the very finding the verifier already answered. The archive is never deleted, so the
159
170
  * union is the complete audit history. */
160
171
  export const CUSTODY_VERIFIED_PREFIX = "custody-verified:";
161
- function custodyVerifiedTargets(db, qitemId) {
172
+ function custodyVerifiedTargets(db, qitemId, targets) {
162
173
  const notes = db
163
174
  .prepare(`SELECT transition_note FROM queue_transitions WHERE qitem_id = ? AND transition_note LIKE ?
164
175
  UNION ALL
@@ -168,13 +179,15 @@ function custodyVerifiedTargets(db, qitemId) {
168
179
  for (const { transition_note: note } of notes) {
169
180
  if (!note)
170
181
  continue;
171
- const token = note.slice(CUSTODY_VERIFIED_PREFIX.length).trim().split(/\s+/)[0];
172
- if (token) {
173
- verified.add(token);
174
- for (const t of token.split(",")) {
175
- if (t.trim())
176
- verified.add(t.trim());
177
- }
182
+ for (const token of note.slice(CUSTODY_VERIFIED_PREFIX.length).trim().split(/\s+/)) {
183
+ const named = [token, ...token.split(",").map((t) => t.trim())]
184
+ .filter(Boolean)
185
+ .map((t) => targets.includes(t) ? t : t.replace(/[.,;:)]$/, ""));
186
+ if (!named.some((t) => targets.includes(t)))
187
+ continue;
188
+ for (const t of named)
189
+ verified.add(t);
190
+ break;
178
191
  }
179
192
  }
180
193
  return verified;
@@ -207,6 +220,11 @@ function defaultIsRegisteredHost(log) {
207
220
  * Use the closing transition, including archived history; later same-state notes
208
221
  * and delivery receipts do not transfer responsibility. A newer cancellation
209
222
  * without closure metadata still supersedes an older closing actor. */
223
+ /** OpenRig's own machinery (the daemon, or a `@system` actor such as this sweep): it creates and closes rows, but it isn't
224
+ * a seat that can act on a finding. */
225
+ function isMachinerySession(session) {
226
+ return session === "daemon@kernel" || session.endsWith("@system");
227
+ }
210
228
  function custodyFindingRoute(db, queueRepo, row) {
211
229
  // Unknown identity cannot establish a new owner. The caller retains this row's
212
230
  // established destination if the registry needed for classification is unavailable.
@@ -224,7 +242,7 @@ function custodyFindingRoute(db, queueRepo, row) {
224
242
  AND (state IS NOT previous_state OR closure_reason IS NOT NULL)
225
243
  ORDER BY transition_id DESC LIMIT 1`).get(row.qitemId, row.qitemId);
226
244
  for (const session of [closure?.actor_session, row.sourceSession]) {
227
- if (!session || session === "daemon@kernel" || session.endsWith("@system"))
245
+ if (!session || isMachinerySession(session))
228
246
  continue;
229
247
  if (!queueRepo.isHumanDestination(session) && queueRepo.acceptsDestination(session)) {
230
248
  return session;
@@ -307,7 +325,7 @@ function legacyHumanRecipientRetained(deps, row) {
307
325
  * source's receipts and dispositions before closing an existing finding; an
308
326
  * unavailable source or an unconfirmed send supplies no resolution evidence. */
309
327
  function deliveryResolutionEvidence(deps, kind, qitemId, now) {
310
- const row = deps.queueRepo.getById(qitemId);
328
+ const row = deps.queueRepo.getById(qitemId, { waiting: false });
311
329
  if (!row)
312
330
  return null;
313
331
  if (["done", "failed", "denied", "canceled", "handed-off"].includes(row.state)) {
@@ -323,9 +341,10 @@ function deliveryResolutionEvidence(deps, kind, qitemId, now) {
323
341
  if (row.state === "blocked")
324
342
  return "source parked";
325
343
  if (kind === "undelivered-wake") {
326
- if (row.lastNudgeResult === "verified")
344
+ const wake = readWakeOutcome(row.lastNudgeResult);
345
+ if (wake?.fact === "accepted" && wake.renderVerified)
327
346
  return "source wake verified";
328
- if (row.lastNudgeResult?.startsWith("wake-accepted:"))
347
+ if (wake?.fact === "accepted" && wake.route === "hosted-trigger")
329
348
  return "source wake accepted by its hosted trigger";
330
349
  }
331
350
  }
@@ -401,7 +420,8 @@ export function custodyHeadline(rowId, targets, ageMinutes) {
401
420
  function evidenceBody(db, c) {
402
421
  if (c.verificationTargets?.length) {
403
422
  const checks = c.verificationTargets
404
- .map((target) => `- ${target}\n ${verificationCommand(target)}`)
423
+ .map((target) => `- ${target}\n ${verificationCommand(target)}\n` +
424
+ ` rig queue update ${c.row.qitemId} --note "custody-verified: ${target} <how verified>"`)
405
425
  .join("\n");
406
426
  return (`STUCK SWEEP FINDING (successor-verification-required)\n` +
407
427
  `row: ${c.row.qitemId}\n` +
@@ -409,10 +429,11 @@ function evidenceBody(db, c) {
409
429
  `age: ${c.ageMinutes} min\n` +
410
430
  `last transition: ${lastTransitionLine(db, c.row.qitemId)}\n` +
411
431
  `why: ${c.why}\n` +
412
- `verification targets (indeterminate until checked on the registered host):\n${checks}\n` +
413
- `After a registered-host read confirms a target, record it durably on the closed row so the sweep stops asking:\n` +
414
- ` rig queue update ${c.row.qitemId} --note "custody-verified: <target> <how verified>"\n` +
415
- `Do not rewrite historical custody from this local observation; record the verification result separately.`);
432
+ `verification targets (indeterminate until checked on the registered host), each with its check and its note:\n${checks}\n` +
433
+ `After a registered-host read confirms a target, record its note on the closed row so the sweep stops asking. ` +
434
+ `The note starts with "custody-verified:"; its first word that names one of these targets exactly is what it verifies. ` +
435
+ `Name several in one comma-list word (a,b), or write one note each.\n` +
436
+ `Do not rewrite historical custody from this local observation; the note is the separate record of the verification.`);
416
437
  }
417
438
  return (`STUCK SWEEP FINDING (${c.kind})\n` +
418
439
  `row: ${c.row.qitemId}\n` +
@@ -424,9 +445,8 @@ function evidenceBody(db, c) {
424
445
  }
425
446
  /** The last line of a standing notice's body: every row it stands for, so the sweep knows what it covered. */
426
447
  const BACKLOG_ROWS_PREFIX = "Every row this notice stands for: ";
427
- /** A seat's standing unclaimed-backlog notice: its rows by id, how to list them, and how to send their findings to a seat
428
- * that watches this one. Built only from the rows' fixed facts, so a pass rewrites it only when the rows change. */
429
- function unclaimedBacklogText(seat, rows, thresholdMinutes, node) {
448
+ /** A standing notice's row lines: oldest first, the first ones by id, the rest counted. */
449
+ function backlogListing(rows) {
430
450
  const sorted = [...rows].sort((a, b) => a.since.localeCompare(b.since) || a.qitemId.localeCompare(b.qitemId));
431
451
  const listed = sorted.slice(0, UNCLAIMED_BACKLOG_LISTED_ROWS).map((r) => {
432
452
  const about = r.summary ? `: ${r.summary.replace(/\s+/g, " ").trim().slice(0, 120)}` : "";
@@ -434,7 +454,12 @@ function unclaimedBacklogText(seat, rows, thresholdMinutes, node) {
434
454
  });
435
455
  if (sorted.length > listed.length)
436
456
  listed.push(`- and ${sorted.length - listed.length} more`);
437
- const count = `${rows.length} ${rows.length === 1 ? "row" : "rows"}`;
457
+ return { sorted, listed, count: `${rows.length} ${rows.length === 1 ? "row" : "rows"}` };
458
+ }
459
+ /** A seat's standing unclaimed-backlog notice: its rows by id, how to list them, and how to send their findings to a seat
460
+ * that watches this one. Built only from the rows' fixed facts, so a pass rewrites it only when the rows change. */
461
+ function unclaimedBacklogText(seat, rows, thresholdMinutes, node) {
462
+ const { sorted, listed, count } = backlogListing(rows);
438
463
  const edge = node ? `rig edge add ${node.rig} ${node.logicalId} <watching seat> --kind escalates_to` : "an escalates_to edge from this seat";
439
464
  return {
440
465
  summary: `Stuck sweep: unclaimed-backlog on ${seat} (${count})`,
@@ -450,6 +475,52 @@ function unclaimedBacklogText(seat, rows, thresholdMinutes, node) {
450
475
  `${BACKLOG_ROWS_PREFIX}${JSON.stringify(sorted.map((r) => r.qitemId))}`,
451
476
  };
452
477
  }
478
+ /** A polling hosted member's standing notice: whether it's checking in (its own inbox reads), the rows it hasn't claimed,
479
+ * and what to do. Its work's age runs from each row's own time, which a check-in never resets. Built from the rows' fixed
480
+ * facts and the member's check-in state, never a current check-in's exact time, so a pass rewrites it only when the rows
481
+ * or that state change. */
482
+ function polledBacklogText(member, rows, thresholdMinutes, checkIn, now) {
483
+ const { sorted, listed, count } = backlogListing(rows);
484
+ // The member's shared check-in status, in the same words `rig roster` uses (`describeCheckIn`). Only the words follow
485
+ // it; when this notice is filed doesn't. Where that line would carry the time of a check-in that keeps moving (checking
486
+ // in, on request, unknown), the notice says instead whether the member read its inbox within the threshold, so a
487
+ // check-in rewrites the notice only when it changes that, never its time alone. An overdue or never-seen member's line
488
+ // is fixed until it checks in, so it keeps its evidence.
489
+ const at = checkIn.lastCheckInAt;
490
+ const lately = at !== null && now.getTime() - Date.parse(at) <= thresholdMinutes * 60_000;
491
+ const recency = at === null ? "" : lately ? `; it read its own inbox within the last ${thresholdMinutes} min` : `; no check-in since ${at}`;
492
+ const recent = checkIn.status === "checking-in" || ((checkIn.status === "on-request" || checkIn.status === "unknown") && lately);
493
+ const checkIns = (() => {
494
+ switch (checkIn.status) {
495
+ case "checking-in": return `checking in: its last check-in is within twice its expected ${checkIn.expectedMinutes} min`;
496
+ case "on-request": return `on request: it checks its queue when a person asks it${recency}`;
497
+ case "unknown": return `unknown (${checkIn.reason ?? "its check-in status couldn't be read"})${recency}`;
498
+ case "check-in-overdue":
499
+ case "no-check-in-yet":
500
+ case "disconnected":
501
+ return describeCheckIn(checkIn);
502
+ }
503
+ })();
504
+ const why = recent
505
+ ? "it's reading its own inbox, but this work is still unclaimed. Check whether it can do this work, or route it to another seat"
506
+ : checkIn.status === "check-in-overdue"
507
+ ? "nobody has claimed these rows, and it hasn't checked in as often as its setup expects. Ask its owner to check its schedule or a pending approval, or route the work to another seat"
508
+ : checkIn.status === "unknown" && at === null
509
+ ? "nobody has claimed these rows, and whether it's reading its queue isn't known. Ask its owner, or route the work to another seat"
510
+ : "nobody has claimed these rows, and no read of its own inbox has been observed in that time. Ask its owner to check it's running, or route the work to another seat";
511
+ return {
512
+ summary: `Stuck sweep: unclaimed-backlog on ${member} (${count})`,
513
+ body: `STUCK SWEEP FINDING (unclaimed-backlog)\n` +
514
+ `member: ${member} (a hosted member with no wake trigger: it picks up work when it reads its own queue)\n` +
515
+ `check-ins: ${checkIns}\n` +
516
+ `unclaimed: ${count} (the threshold is ${thresholdMinutes} min)\n` +
517
+ `${listed.join("\n")}\n` +
518
+ `why: ${why}. This one notice stands for these rows instead of a finding per row, and follows them as they come and go.\n` +
519
+ `List them: rig queue list --destination ${member} --state pending\n` +
520
+ `The sweep closes this notice itself once every row it stands for is claimed, parked or closed.\n` +
521
+ `${BACKLOG_ROWS_PREFIX}${JSON.stringify(sorted.map((r) => r.qitemId))}`,
522
+ };
523
+ }
453
524
  /** The rows a standing notice's body says it stands for, or null when the line is missing or unreadable: unknown, which is
454
525
  * never read as "none". */
455
526
  function backlogRowsOf(body) {
@@ -464,6 +535,14 @@ function backlogRowsOf(body) {
464
535
  return null;
465
536
  }
466
537
  }
538
+ /** What a pass hands the status: the findings it created (the routed total grows only by these), and the finding
539
+ * rows still open after it. Open is read from the queue, not from the pass's actions: a finding kept open without an
540
+ * action (a live ladder suppresses its reporting, a grace holds it) is still open. */
541
+ function findingCounts(db, findings) {
542
+ const open = db.prepare(`SELECT COUNT(*) AS n FROM queue_items WHERE state IN ('pending', 'in-progress', 'blocked')
543
+ AND tags LIKE ?`).get(`%"${STUCK_SWEEP_FINDING_TAG}"%`);
544
+ return { created: findings.filter((f) => f.action === "created").length, open: open.n };
545
+ }
467
546
  /**
468
547
  * One sweep pass. Instance-wide (no rig scope — the loop is the net for every rig the
469
548
  * daemon carries). Never throws: a sweep that cannot run reports outcome=failed loudly
@@ -474,6 +553,10 @@ function backlogRowsOf(body) {
474
553
  * for its whole length (seconds on a queue of tens of thousands of rows, with healthz and every request waiting);
475
554
  * every this many rows it now lets timers and requests run. */
476
555
  export const STUCK_SWEEP_YIELD_EVERY_ROWS = 50;
556
+ /** ...or after this many milliseconds of work since the last yield, whichever comes first: a stretch of slow rows (or
557
+ * of awaited writes that resolve by microtasks alone) holds the loop no longer than this. The clock restarts after the
558
+ * yield, so the time others run during it does not count against the next stretch. */
559
+ export const STUCK_SWEEP_YIELD_AFTER_MS = 50;
477
560
  export async function runStuckSweep(deps) {
478
561
  const log = deps.log ?? ((line) => console.error(line));
479
562
  const status = deps.status;
@@ -487,17 +570,29 @@ export async function runStuckSweep(deps) {
487
570
  // Every yield and every awaited write lets other code run: indexes read before it are dropped, and `othersRan`
488
571
  // tells a list read before it that its rows need a fresh read.
489
572
  let othersRan = 0;
490
- const othersMayHaveRun = () => { othersRan++; recoveries.invalidate(); successors?.invalidate(); };
573
+ /** Each seat's agent-seat reading (agentSeatNode, below), dropped with the indexes: another writer can declare a
574
+ * seat's delegation parent while the pass yields or awaits a write. */
575
+ const agentSeats = new Map();
576
+ const othersMayHaveRun = () => { othersRan++; recoveries.invalidate(); successors?.invalidate(); agentSeats.clear(); };
577
+ // A successor index whose build took at least half of a stretch that yielded by elapsed time is not rebuilt for
578
+ // the rest of the pass: the yield drops it, the next stretch would pay the build again and end the same way after a
579
+ // few rows, so the rows would pay about one build each instead of one per STUCK_SWEEP_YIELD_EVERY_ROWS. Those rows
580
+ // ask their own narrow query (hasLinkedSuccessor), which costs less than a rebuilt index.
581
+ let successorsPerRow = false;
491
582
  // A synchronous read with both indexes lent to what it calls deep inside (a getById's waiting view and handoff
492
583
  // advisory ask the same questions per row). Never spans an await: the lend ends when fn returns.
493
- const indexed = (fn) => recoveries.run(() => (successors ? successors.run(fn) : fn()));
584
+ const indexed = (fn) => recoveries.run(() => (successors && !successorsPerRow ? successors.run(fn) : fn()));
494
585
  // `if (dueToYield()) await yieldLoop();` and never a bare await per row: even an await that does not yield lets
495
586
  // queued microtasks (other requests' continuations) run and write between two rows the snapshot still covers.
496
587
  let rowsSinceYield = 0;
497
- const dueToYield = () => ++rowsSinceYield >= STUCK_SWEEP_YIELD_EVERY_ROWS;
588
+ let lastYieldAt = performance.now();
589
+ const dueToYield = () => ++rowsSinceYield >= STUCK_SWEEP_YIELD_EVERY_ROWS || performance.now() - lastYieldAt >= STUCK_SWEEP_YIELD_AFTER_MS;
498
590
  const yieldLoop = async () => {
591
+ const stretchMs = performance.now() - lastYieldAt;
592
+ successorsPerRow ||= successors !== null && stretchMs >= STUCK_SWEEP_YIELD_AFTER_MS && 2 * successors.builtMs() >= stretchMs;
499
593
  rowsSinceYield = 0;
500
594
  await new Promise((resolve) => setImmediate(resolve));
595
+ lastYieldAt = performance.now();
501
596
  othersMayHaveRun();
502
597
  };
503
598
  const suppressionMinutes = deps.ladderSuppressionMinutes ?? resolveLadderSuppressionMinutes();
@@ -549,7 +644,7 @@ export async function runStuckSweep(deps) {
549
644
  // S04 seam — a claimed row with no later motion past the pickup threshold. The
550
645
  // pickup module remains the ONE derivation rule; this only enumerates and routes.
551
646
  const stalledCandidate = (qitemId) => {
552
- const row = indexed(() => deps.queueRepo.getById(qitemId));
647
+ const row = indexed(() => deps.queueRepo.getById(qitemId, { waiting: false }));
553
648
  if (!row || isFindingRow(row))
554
649
  return null;
555
650
  if ((row.state !== "pending" && row.state !== "in-progress") || !row.claimedAt)
@@ -581,7 +676,7 @@ export async function runStuckSweep(deps) {
581
676
  if (!notice || now.getTime() - Date.parse(notice.at) <= resolvePickupThresholdMinutes() * 60_000)
582
677
  return null;
583
678
  const binding = deps.db.prepare("SELECT qitem_id FROM queue_transition_wakes WHERE wake_ref = ? AND phase = 'armed' ORDER BY transition_id DESC LIMIT 1").get(jobId);
584
- const row = binding ? indexed(() => deps.queueRepo.getById(binding.qitem_id)) : null;
679
+ const row = binding ? indexed(() => deps.queueRepo.getById(binding.qitem_id, { waiting: false })) : null;
585
680
  if (!row || row.state !== "blocked" || deps.queueRepo.getParkWakeStatus(row.qitemId)?.ref !== jobId)
586
681
  return null;
587
682
  const response = lastMeaningfulTransition(deps.db, row.qitemId);
@@ -597,7 +692,7 @@ export async function runStuckSweep(deps) {
597
692
  // The parked policy stops repeating a positively no-input failure. Unhealthy blocked rows
598
693
  // have no retry ladder: the same sweep/recovery route owns their actionable disposition.
599
694
  const parkedCandidate = (qitemId) => {
600
- const row = indexed(() => deps.queueRepo.getById(qitemId));
695
+ const row = indexed(() => deps.queueRepo.getById(qitemId, { waiting: false }));
601
696
  if (!row || isFindingRow(row))
602
697
  return null;
603
698
  if (row.state !== "blocked" || !startsWithCI(row.lastNudgeResult, "failed:"))
@@ -627,15 +722,23 @@ export async function runStuckSweep(deps) {
627
722
  // row's own wake intent instead of reporting it: the intent is claimed and settled, so a startup drain doesn't send it
628
723
  // again, and one already in flight or settled isn't sent twice. The next tick reads the new result, so a failed send
629
724
  // is reported then. A row with a live retry ladder is left to the ladder.
630
- const wakeToRetry = (row, humanNotice) => !humanNotice
631
- && startsWithCI(row.lastNudgeResult, "unroutable:")
632
- && !hasLiveLadder(deps.db, row.qitemId, now, suppressionMinutes)
633
- && deps.queueRepo.classifyDestinationOf(row.destinationSession).class === "pane-bound";
725
+ // The rule is shared with the reachable-seat retry; a live retry ladder is this sweep's own check.
726
+ const wakeToRetry = (row) => deps.queueRepo.unroutableWakeRetryable(row, now)
727
+ && !hasLiveLadder(deps.db, row.qitemId, now, suppressionMinutes);
634
728
  const isHumanNotice = (row) => row.deliveryOutcome === "never-posted" || row.deliveryOutcome === "transport-failed";
635
- /** The checks that run before the wake retry, as in the loop this replaces: a row they exclude is never woken. */
636
- const wakeRetryEligible = (row) => !row.claimedAt
637
- && !deps.queueRepo.isLocalHumanDecisionWithoutGateway(row)
638
- && !["held", "released"].includes(quietHoldCustody(deps.db, row.qitemId, now)?.state ?? "");
729
+ // A hosted member with no wake trigger picks up its work by reading the queue: nothing can push work to it, by design.
730
+ // Its rows' unroutable wakes aren't failed deliveries, so they get no finding each; work it leaves unclaimed past the
731
+ // unclaimed age is listed in the member's one standing notice instead. Read once per member per pass.
732
+ const pollingMembers = new Map();
733
+ const pollsForWork = (session) => {
734
+ let polls = pollingMembers.get(session);
735
+ if (polls === undefined) {
736
+ polls = deps.queueRepo.isHostedMember(session) && deps.queueRepo.classifyDestinationOf(session).class === "unroutable";
737
+ pollingMembers.set(session, polls);
738
+ }
739
+ return polls;
740
+ };
741
+ const polledRow = (row) => !!row.lastNudgeResult?.startsWith("unroutable:") && pollsForWork(row.destinationSession);
639
742
  /** `row` comes from findUndelivered (it carries the delivery verdict). Call it after any wake retry the row needs. */
640
743
  const undeliveredCandidate = (row, recordSuppression) => {
641
744
  if (isFindingRow(row))
@@ -648,14 +751,20 @@ export async function runStuckSweep(deps) {
648
751
  return null;
649
752
  if (!humanNotice && deps.queueRepo.isLocalHumanDecisionWithoutGateway(row))
650
753
  return null;
754
+ if (!humanNotice && polledRow(row))
755
+ return null;
651
756
  const notification = humanNotice ? deps.queueRepo.transitionLog.latestOwnerNotificationForQitem(row.qitemId) : null;
652
757
  const resolutionNotice = notification?.ownerNotificationKind === "human-decision-resolved";
653
758
  // Match the notification source in slack/queue-access.ts, not the agent wake's escalator.
654
759
  const noticeOwner = row.state === "blocked" || resolutionNotice ? row.destinationSession : row.sourceSession;
655
760
  const noticeRecipient = resolutionNotice ? notification.actorSession : row.state === "blocked" ? row.blockedOn : row.destinationSession;
656
- const failure = humanNotice
657
- ? `human notice ${row.deliveryOutcome} to ${noticeRecipient}: ${row.deliveryFailureDetail}`
658
- : `wake failed (${row.lastNudgeResult ?? "failed"})`;
761
+ // Slack answered 2xx but its body couldn't be read (slack-delivery's POSSIBLY_POSTED_CLASS): it may be in Slack.
762
+ const possiblyPosted = humanNotice && /\bclass=possibly-posted\b/.test(row.deliveryFailureDetail ?? "");
763
+ const failure = possiblyPosted
764
+ ? `human notice may have posted to ${noticeRecipient}: Slack answered but its reply couldn't be read (${row.deliveryFailureDetail}); the gateway checks Slack for its marker before any resend`
765
+ : humanNotice
766
+ ? `human notice ${row.deliveryOutcome} to ${noticeRecipient}: ${row.deliveryFailureDetail}`
767
+ : `wake failed (${row.lastNudgeResult ?? "failed"})`;
659
768
  // Quiet hours: a held, turned-back or released ask belongs to its window's release job, so a failed wake, or a post
660
769
  // not yet made, isn't "nothing retried it". A release whose post failed is a failed delivery, and a hold with no
661
770
  // live release job is orphaned: both stay findings, with their own reason.
@@ -685,13 +794,13 @@ export async function runStuckSweep(deps) {
685
794
  : `${failure} and nothing retried it`,
686
795
  };
687
796
  };
688
- const undeliveredNow = (qitemId) => indexed(() => deps.queueRepo.findUndelivered({ qitemId }))[0];
797
+ const undeliveredNow = (qitemId) => indexed(() => deps.queueRepo.findUndelivered({ qitemId, waiting: false }))[0];
689
798
  // The A1 net — created-with-destination rows carrying real obligations, unclaimed past
690
799
  // the config-keyed age. Parks (state=blocked) legitimately wait and never appear here;
691
800
  // failed-nudge rows already surfaced in half 2; laddered rows are S01's.
692
801
  const cutoff = new Date(now.getTime() - ageMinutes * 60_000).toISOString();
693
802
  const unclaimedCandidate = (qitemId, recordSuppression) => {
694
- const row = indexed(() => deps.queueRepo.getById(qitemId));
803
+ const row = indexed(() => deps.queueRepo.getById(qitemId, { waiting: false }));
695
804
  if (!row || isFindingRow(row))
696
805
  return null;
697
806
  // The query's own predicate, on the row as it is now.
@@ -740,9 +849,24 @@ export async function runStuckSweep(deps) {
740
849
  evidenceAt: actionableAt,
741
850
  why: quiet?.state === "orphaned"
742
851
  ? `held for quiet hours (window ${quiet.windowId}) for ${minutesSince(actionableAt, now)} min, but no release job is live for that window: nothing will release it`
743
- : `actionable with a destination and unclaimed for ${minutesSince(actionableAt, now)} min (threshold ${ageMinutes})`,
852
+ : `actionable with a destination and unclaimed for ${minutesSince(actionableAt, now)} min (threshold ${ageMinutes})${unreadableOwner(row.destinationSession) ? "; owner activity unknown (can't read the seat)" : ""}`,
744
853
  };
745
854
  };
855
+ /** The seat's activity can't be read (no reading, or one that reads unknown): said in the finding, so an unreadable
856
+ * seat isn't taken for one ignoring its work. The stalled finding says the same (`queue-pickup.ts`). A person has no
857
+ * seat to read, so their row never says so; nor does a row whose destination can't be classified, since it may be a
858
+ * person's. A classification fault never stops the sweep. */
859
+ function unreadableOwner(session) {
860
+ try {
861
+ if (deps.queueRepo.isHumanDestination(session))
862
+ return false;
863
+ }
864
+ catch {
865
+ return false;
866
+ }
867
+ const activity = deps.queueRepo.ownerActivity(session)?.activity;
868
+ return !activity || activity === "unknown";
869
+ }
746
870
  // The custody class — a terminal row whose closure names one or more successor
747
871
  // qitems or seat-address targets (closure_reason = 'handed_off_to'). A local miss is
748
872
  // never proof of absence: the successor may live in another registered host's database.
@@ -768,7 +892,7 @@ export async function runStuckSweep(deps) {
768
892
  /** `recheck`: read live without the lent indexes, and don't log the registry fallback a second time. */
769
893
  const custodyCandidate = (qitemId, hasSuccessor, recheck = false) => {
770
894
  // A recheck reads live, without the lent indexes: one row's own queries cost less than a rebuilt successor index.
771
- const row = recheck ? deps.queueRepo.getById(qitemId) : indexed(() => deps.queueRepo.getById(qitemId));
895
+ const row = recheck ? deps.queueRepo.getById(qitemId, { waiting: false }) : indexed(() => deps.queueRepo.getById(qitemId, { waiting: false }));
772
896
  if (!row || isFindingRow(row))
773
897
  return null;
774
898
  // The query's own predicate, on the row as it is now.
@@ -787,7 +911,7 @@ export async function runStuckSweep(deps) {
787
911
  if (targets.length === 0 && row.closureReason === "handed_off_to") {
788
912
  targets.push("(unspecified)");
789
913
  }
790
- const verified = custodyVerifiedTargets(deps.db, row.qitemId);
914
+ const verified = custodyVerifiedTargets(deps.db, row.qitemId, targets);
791
915
  const verificationTargets = targets.filter((target) => {
792
916
  if (verified.has(target))
793
917
  return false;
@@ -802,7 +926,7 @@ export async function runStuckSweep(deps) {
802
926
  }
803
927
  if (target === row.qitemId)
804
928
  return true;
805
- return !indexed(() => deps.queueRepo.getById(target));
929
+ return !indexed(() => deps.queueRepo.getById(target, { waiting: false }));
806
930
  }
807
931
  try {
808
932
  return !hasSuccessor(row.qitemId, target);
@@ -841,7 +965,7 @@ export async function runStuckSweep(deps) {
841
965
  const freshCandidate = (kind, id, jobId) => {
842
966
  switch (kind) {
843
967
  case "overdue-claim": {
844
- const row = deps.queueRepo.findOverdue({ now: nowIso, qitemId: id })[0];
968
+ const row = deps.queueRepo.findOverdue({ now: nowIso, qitemId: id, waiting: false })[0];
845
969
  return row ? overdueCandidate(row) : null;
846
970
  }
847
971
  case "stalled-after-claim": return stalledCandidate(id);
@@ -885,10 +1009,10 @@ export async function runStuckSweep(deps) {
885
1009
  // The rows each rule looks at. The id lists are judged on a fresh getById per row; the two finders return whole
886
1010
  // rows, which are read again by id once other code may have run since the list was read.
887
1011
  let listedAt = othersRan;
888
- for (const listed of indexed(() => deps.queueRepo.findOverdue({ now: nowIso }))) {
1012
+ for (const listed of indexed(() => deps.queueRepo.findOverdue({ now: nowIso, waiting: false }))) {
889
1013
  if (dueToYield())
890
1014
  await yieldLoop();
891
- const row = listedAt !== othersRan ? indexed(() => deps.queueRepo.findOverdue({ now: nowIso, qitemId: listed.qitemId }))[0] : listed;
1015
+ const row = listedAt !== othersRan ? indexed(() => deps.queueRepo.findOverdue({ now: nowIso, qitemId: listed.qitemId, waiting: false }))[0] : listed;
892
1016
  const c = row ? overdueCandidate(row) : null;
893
1017
  if (!c)
894
1018
  continue;
@@ -927,18 +1051,18 @@ export async function runStuckSweep(deps) {
927
1051
  candidates.push(c);
928
1052
  }
929
1053
  listedAt = othersRan;
930
- for (const listed of indexed(() => deps.queueRepo.findUndelivered())) {
1054
+ for (const listed of indexed(() => deps.queueRepo.findUndelivered({ waiting: false }))) {
931
1055
  if (dueToYield())
932
1056
  await yieldLoop();
933
1057
  let row = listedAt !== othersRan ? undeliveredNow(listed.qitemId) : listed;
934
1058
  if (!row || isFindingRow(row))
935
1059
  continue;
936
- if (wakeRetryEligible(row) && wakeToRetry(row, isHumanNotice(row))) {
1060
+ if (wakeToRetry(row)) {
937
1061
  await deps.queueRepo.deliverWakeForSuccessor(row.qitemId, row.destinationSession, true, row.sourceSession);
938
1062
  othersMayHaveRun();
939
1063
  // judged again on the row as the send (and anyone else during it) left it
940
1064
  row = undeliveredNow(row.qitemId);
941
- if (!row || !startsWithCI(row.lastNudgeResult, "unroutable:"))
1065
+ if (!row?.lastNudgeResult?.startsWith("unroutable:"))
942
1066
  continue;
943
1067
  }
944
1068
  const c = undeliveredCandidate(row, true);
@@ -998,7 +1122,9 @@ export async function runStuckSweep(deps) {
998
1122
  for (const { qitem_id } of custodyRows) {
999
1123
  if (dueToYield())
1000
1124
  await yieldLoop();
1001
- const c = custodyCandidate(qitem_id, (source, target) => lookup.has(source, target));
1125
+ const c = custodyCandidate(qitem_id, successorsPerRow
1126
+ ? (source, target) => hasLinkedSuccessor(deps.db, source, target)
1127
+ : (source, target) => lookup.has(source, target));
1002
1128
  if (c)
1003
1129
  candidates.push(c);
1004
1130
  }
@@ -1040,6 +1166,22 @@ export async function runStuckSweep(deps) {
1040
1166
  // unroutable or a terminal seat itself. A bound terminal seat goes the same way: the queue wake types nothing into
1041
1167
  // it, and nothing there can claim work.
1042
1168
  const classOf = (seat) => deps.queueRepo.classifyDestinationOf(seat).class;
1169
+ /** Who hears about work for a destination that can't hear it: the index into NO_WAKE_ROUTE_RULES and the seat, or -1. */
1170
+ const noWakeRecipient = (destination, creator) => {
1171
+ const operatorSeat = (deps.resolveOperatorSeat ?? resolveOperatorSeat)();
1172
+ const person = operatorSeat && classOf(operatorSeat) === "gateway-routable" ? operatorSeat : null;
1173
+ const choices = [person, creator, (deps.resolveRecoveryAgentSeat ?? resolveRecoveryAgentSeat)()];
1174
+ const chosen = choices.findIndex((seat) => !!seat && seat !== destination && !sessionMissing(seat) && classOf(seat) !== "unroutable"
1175
+ && !isBoundTerminalSeat(deps.db, seat));
1176
+ return { chosen, seat: chosen < 0 ? null : choices[chosen] };
1177
+ };
1178
+ /** The person (the operator seat when it's a person's address) or the operator agent: recipients that may see any row. */
1179
+ const seesAnyRow = (seat) => {
1180
+ const operatorSeat = (deps.resolveOperatorSeat ?? resolveOperatorSeat)();
1181
+ if (operatorSeat === seat && classOf(seat) === "gateway-routable")
1182
+ return true;
1183
+ return (deps.resolveRecoveryAgentSeat ?? resolveRecoveryAgentSeat)() === seat;
1184
+ };
1043
1185
  const routeAroundNoWake = (c) => {
1044
1186
  if (c.route !== c.row.destinationSession)
1045
1187
  return;
@@ -1048,25 +1190,20 @@ export async function runStuckSweep(deps) {
1048
1190
  const terminalSeat = destination === "pane-bound" && isBoundTerminalSeat(deps.db, c.row.destinationSession);
1049
1191
  if (!noRoute && !terminalSeat && !(destination === "hosted" && !c.row.claimedAt))
1050
1192
  return;
1051
- const operatorSeat = (deps.resolveOperatorSeat ?? resolveOperatorSeat)();
1052
- const person = operatorSeat && classOf(operatorSeat) === "gateway-routable" ? operatorSeat : null;
1053
- const choices = [person, c.row.sourceSession, (deps.resolveRecoveryAgentSeat ?? resolveRecoveryAgentSeat)()];
1054
- const chosen = choices.findIndex((seat) => !!seat && seat !== c.route && !sessionMissing(seat) && classOf(seat) !== "unroutable"
1055
- && !isBoundTerminalSeat(deps.db, seat));
1193
+ c.noWake = true;
1194
+ const recipient = noWakeRecipient(c.route, c.row.sourceSession);
1056
1195
  c.why += noRoute
1057
1196
  ? `; ${c.route} has no wake route on this daemon (no terminal, not a person). If it's a hosted member, it sees this work only when it next checks, so ask it to; otherwise fix the address`
1058
1197
  : terminalSeat
1059
1198
  ? `; ${c.route} is a terminal seat; nothing there can claim this work, and no wake is typed into it. Route the work to an agent seat`
1060
1199
  : `; ${c.route} is a hosted member. OpenRig rang its trigger (${c.row.lastNudgeResult ?? "no ring recorded"}), and it hasn't claimed this work. It sees work only when it checks, so ask it to`;
1061
- if (chosen < 0) {
1200
+ if (!recipient.seat) {
1062
1201
  c.why += `. No person, creator or operator agent that can be reached is available, so this finding stays addressed to it`;
1063
1202
  return;
1064
1203
  }
1065
- c.why += `. This finding goes to ${choices[chosen]}, ${NO_WAKE_ROUTE_RULES[chosen]}`;
1066
- c.route = choices[chosen];
1204
+ c.why += `. This finding goes to ${recipient.seat}, ${NO_WAKE_ROUTE_RULES[recipient.chosen]}`;
1205
+ c.route = recipient.seat;
1067
1206
  };
1068
- /** The two re-routes, in order, for one candidate. */
1069
- const routeCandidate = (c) => { routeAroundMissing(c); routeAroundNoWake(c); };
1070
1207
  for (const c of candidates) {
1071
1208
  if (dueToYield())
1072
1209
  await yieldLoop();
@@ -1091,10 +1228,9 @@ export async function runStuckSweep(deps) {
1091
1228
  // (below). A finding per row stays for a person's address or a terminal seat, for a declared route that failed (its
1092
1229
  // finding names why, and a declared delegation parent with no session is one), and for a row that already has a
1093
1230
  // recovery.
1094
- const agentSeats = new Map();
1095
1231
  /** An agent seat's node: one whose runtime isn't a terminal, with no declared delegation parent, at an address that
1096
1232
  * isn't a person's. An address the human registry can't classify counts as a person's. null for anything else. Read
1097
- * once per seat per pass. */
1233
+ * once per seat until other code may have run (agentSeats). */
1098
1234
  const agentSeatNode = (session) => {
1099
1235
  if (agentSeats.has(session))
1100
1236
  return agentSeats.get(session);
@@ -1113,23 +1249,56 @@ export async function runStuckSweep(deps) {
1113
1249
  agentSeats.set(session, agent);
1114
1250
  return agent;
1115
1251
  };
1252
+ // A wake that failed at a live agent seat with no delegation parent or escalates_to made its finding that same seat's,
1253
+ // so the finding's own wake went to the seat that had just failed to take one, onto whatever was in its input box.
1254
+ // The row's creator can act on it (resend, reroute or ask), as the waiting and parked-owner findings already route;
1255
+ // for a seat that sent itself the work, a row OpenRig's own machinery created, or a creator that is a bound terminal
1256
+ // seat (nothing there can claim it, as for the no-wake rule), the operator agent can. A declared
1257
+ // route that failed keeps its fallback, and a finding the two re-routes above moved keeps its recipient. A wake that
1258
+ // found no route never reached the seat, so a seat launched since keeps its own finding, whose wake is the one it missed.
1259
+ const routeAroundFailedWake = (c) => {
1260
+ if (c.kind !== "undelivered-wake" || !startsWithCI(c.row.lastNudgeResult, "failed:") || c.noWake
1261
+ || c.route !== c.row.destinationSession
1262
+ || routeNotes.has(c.row.qitemId) || agentSeatNode(c.route) === null)
1263
+ return;
1264
+ const choices = [c.row.sourceSession, (deps.resolveRecoveryAgentSeat ?? resolveRecoveryAgentSeat)()];
1265
+ const chosen = choices.findIndex((seat) => !!seat && seat !== c.route && !isMachinerySession(seat)
1266
+ && !sessionMissing(seat) && deps.queueRepo.acceptsDestination(seat) && !isBoundTerminalSeat(deps.db, seat));
1267
+ if (chosen < 0) {
1268
+ c.why += `; ${c.route} declares no delegation parent or escalates_to, and its creator and the operator agent (agents.operator_session) are each unset, missing, this seat, OpenRig's own machinery, a terminal seat or not an address this queue takes, so this finding stays addressed to it`;
1269
+ return;
1270
+ }
1271
+ c.why += `; ${c.route} declares no delegation parent or escalates_to, so this finding goes to ${choices[chosen]}, ${FAILED_WAKE_ROUTE_RULES[chosen]}`;
1272
+ c.route = choices[chosen];
1273
+ };
1274
+ /** The three re-routes, in order, for one candidate. The third reads no earlier pass: a failed wake's finding is
1275
+ * routed only here, on the row as it is right before the finding is created. */
1276
+ const routeCandidate = (c) => { routeAroundMissing(c); routeAroundNoWake(c); routeAroundFailedWake(c); };
1116
1277
  const selfRoutedUnclaimed = (c) => c.kind === "unclaimed-obligation"
1117
1278
  && c.route === c.row.destinationSession && !routeNotes.has(c.row.qitemId) && agentSeatNode(c.route) !== null;
1279
+ // A hosted member that polls for its work (no wake trigger) can't hear a finding, so each unclaimed row went to a
1280
+ // person as a finding of its own. Those rows share one standing notice per member instead, unless a route the member
1281
+ // declares (a delegation parent or escalates_to) takes them.
1282
+ const polledUnclaimed = (c) => c.kind === "unclaimed-obligation" && c.noWake === true
1283
+ && !routeNotes.has(c.row.qitemId) && polledRow(c.row);
1284
+ /** The standing notice a candidate belongs to (the seat or member it stands for), or null for a finding of its own. */
1285
+ const backlogKeyOf = (c) => polledUnclaimed(c) ? c.row.destinationSession : selfRoutedUnclaimed(c) ? c.route : null;
1118
1286
  const unclaimedBacklog = new Map();
1119
1287
  for (const c of [...new Map(candidates.map(c => [c.row.qitemId, c])).values()]) {
1120
1288
  if (dueToYield())
1121
1289
  await yieldLoop();
1122
1290
  const dedupTag = findingDedupTag(c.kind, c.row.qitemId);
1123
1291
  const shared = recoveries.find(c.row.qitemId);
1124
- if (!shared && selfRoutedUnclaimed(c)) {
1125
- const rows = unclaimedBacklog.get(c.route);
1292
+ const backlogKey = shared ? null : backlogKeyOf(c);
1293
+ if (backlogKey) {
1294
+ const rows = unclaimedBacklog.get(backlogKey);
1126
1295
  if (rows)
1127
1296
  rows.push(c);
1128
1297
  else
1129
- unclaimedBacklog.set(c.route, [c]);
1298
+ unclaimedBacklog.set(backlogKey, [c]);
1130
1299
  continue;
1131
1300
  }
1132
- const sharedRow = shared ? indexed(() => deps.queueRepo.getById(shared.qitemId)) : null;
1301
+ const sharedRow = shared ? indexed(() => deps.queueRepo.getById(shared.qitemId, { waiting: false })) : null;
1133
1302
  // A later accepted deadline can expire after the previous finding closed.
1134
1303
  // Its newer time is fresh evidence even when the pickup candidate wins this row.
1135
1304
  // An OPEN recovery still owns custody.
@@ -1204,7 +1373,8 @@ export async function runStuckSweep(deps) {
1204
1373
  : `Stuck sweep: ${c.kind} on ${c.row.qitemId} (${now_.ageMinutes} min)`,
1205
1374
  evidenceRef: `rig queue show ${c.row.qitemId}`,
1206
1375
  tags: [STUCK_SWEEP_FINDING_TAG, dedupTag, recoveryTag(c.row.qitemId),
1207
- ...(routed.has(c.row.qitemId) || now_.row.tags?.includes(ESCALATION_HOP_TAG) ? [ESCALATION_HOP_TAG] : [])],
1376
+ ...(routed.has(c.row.qitemId) || now_.row.tags?.includes(ESCALATION_HOP_TAG) ? [ESCALATION_HOP_TAG] : []),
1377
+ ...(now_.row.tags ?? []).filter((tag) => /^(project|mission|slice):/.test(tag))],
1208
1378
  // OpenRig's own finding, whoever created the stuck row.
1209
1379
  wakeTrigger: "openrig",
1210
1380
  };
@@ -1246,10 +1416,48 @@ export async function runStuckSweep(deps) {
1246
1416
  const tag = unclaimedBacklogTag(seat);
1247
1417
  liveDedupTags.add(tag);
1248
1418
  const node = agentSeatNode(seat);
1419
+ // A polling member's notice says whether it's checking in; an agent seat's names the route to add instead.
1420
+ const polled = rows.length > 0 ? rows.some(polledUnclaimed) : pollsForWork(seat);
1421
+ const backlogText = (standsFor) => polled
1422
+ ? polledBacklogText(seat, standsFor, ageMinutes, deps.queueRepo.hostedMemberCheckIn(seat, now), now)
1423
+ : unclaimedBacklogText(seat, standsFor, ageMinutes, node);
1424
+ // A polling member's notice goes where its rows' findings went: the person, else their creator when they share one,
1425
+ // else the operator agent. With none, it stays with the member, which reads it when it next checks.
1426
+ const recipientFor = (creators) => {
1427
+ if (!polled)
1428
+ return seat;
1429
+ const distinct = [...new Set(creators)];
1430
+ return noWakeRecipient(seat, distinct.length === 1 ? distinct[0] : null).seat ?? seat;
1431
+ };
1432
+ /** Files a notice and wakes its recipient; false when the create failed (reported in failedCreates). */
1433
+ const fileNotice = async (text, recipient) => {
1434
+ try {
1435
+ const created = await deps.queueRepo.create({
1436
+ // A notice about a seat's own rows comes from that seat, as a restore notice does; OpenRig wakes its recipient.
1437
+ sourceSession: seat,
1438
+ destinationSession: recipient,
1439
+ body: text.body,
1440
+ summary: text.summary,
1441
+ evidenceRef: `rig queue list --destination ${seat} --state pending`,
1442
+ tags: [STUCK_SWEEP_FINDING_TAG, tag],
1443
+ wakeTrigger: "openrig",
1444
+ });
1445
+ othersMayHaveRun();
1446
+ findings.push({ kind: "unclaimed-backlog", qitemId: seat, findingQitemId: created.qitemId, action: "created" });
1447
+ return true;
1448
+ }
1449
+ catch (err) {
1450
+ const message = `unclaimed-backlog notice for ${seat} not created: ${err instanceof Error ? err.message : String(err)}`;
1451
+ othersMayHaveRun();
1452
+ log(`[stuck-sweep] ${message}`);
1453
+ failedCreates.push(message);
1454
+ return false;
1455
+ }
1456
+ };
1249
1457
  const last = deps.db
1250
1458
  .prepare(
1251
1459
  // The first term lets the planner use idx_queue_items_recovery_tags, as the finding lookup above does.
1252
- `SELECT qitem_id, state, ts_updated, summary, body FROM queue_items
1460
+ `SELECT qitem_id, state, ts_updated, summary, body, destination_session FROM queue_items
1253
1461
  WHERE (tags LIKE '%"stuck-sweep:%') AND tags LIKE ? ESCAPE '\\'
1254
1462
  ORDER BY CASE WHEN state IN ('pending', 'in-progress', 'blocked') THEN 0 ELSE 1 END,
1255
1463
  ts_updated DESC, ts_created DESC, qitem_id DESC
@@ -1259,7 +1467,7 @@ export async function runStuckSweep(deps) {
1259
1467
  const listedNow = new Set(rows.map((c) => c.row.qitemId));
1260
1468
  const stoodFor = backlogRowsOf(last.body);
1261
1469
  const still = [...(stoodFor ?? [])].filter((id) => !listedNow.has(id)).flatMap((id) => {
1262
- const row = indexed(() => deps.queueRepo.getById(id));
1470
+ const row = indexed(() => deps.queueRepo.getById(id, { waiting: false }));
1263
1471
  // Gone, someone else's now, resolved at its source, or held by a finding or recovery of its own: one actually
1264
1472
  // written, so a create that failed this pass leaves the row here.
1265
1473
  if (!row || row.destinationSession !== seat || recoveries.find(id)
@@ -1285,7 +1493,28 @@ export async function runStuckSweep(deps) {
1285
1493
  findings.push({ kind: "unclaimed-backlog", qitemId: seat, findingQitemId: last.qitem_id, action: "closed" });
1286
1494
  continue;
1287
1495
  }
1288
- const text = unclaimedBacklogText(seat, standsFor, ageMinutes, node);
1496
+ // A notice that went to one of its rows' creators (no person reachable) shows that creator only rows it sent. When a
1497
+ // row from anyone else would join it, one notice for every row it stands for goes where a new notice would go now,
1498
+ // which wakes that recipient, and only then does this one close: a notice the sweep closed holds its rows back, so a
1499
+ // failed create leaves it open as it was (not rewritten), and the next pass tries again. A person, the operator
1500
+ // agent and the member see any of the rows.
1501
+ if (polled && last.destination_session !== seat && !seesAnyRow(last.destination_session)
1502
+ && standsFor.some((r) => r.from !== last.destination_session)) {
1503
+ const recipient = recipientFor(standsFor.map((r) => r.from));
1504
+ if (!(await fileNotice(backlogText(standsFor), recipient)))
1505
+ continue;
1506
+ await deps.queueRepo.update({
1507
+ qitemId: last.qitem_id,
1508
+ actorSession: "stuck-sweep@system",
1509
+ state: "done",
1510
+ closureReason: "no-follow-on",
1511
+ transitionNote: `stuck-sweep re-filed: unclaimed-backlog on ${seat}: a row it stands for didn't come from ${last.destination_session}, the creator it went to; one notice for every row went to ${recipient}`,
1512
+ });
1513
+ othersMayHaveRun();
1514
+ findings.push({ kind: "unclaimed-backlog", qitemId: seat, findingQitemId: last.qitem_id, action: "closed" });
1515
+ continue;
1516
+ }
1517
+ const text = backlogText(standsFor);
1289
1518
  if (text.summary !== last.summary || text.body !== last.body) {
1290
1519
  deps.db.prepare("UPDATE queue_items SET body = ?, summary = ? WHERE qitem_id = ? AND body = ? AND summary IS ? AND state IN ('pending', 'in-progress', 'blocked')")
1291
1520
  .run(text.body, text.summary, last.qitem_id, last.body, last.summary);
@@ -1302,7 +1531,7 @@ export async function runStuckSweep(deps) {
1302
1531
  const now_ = freshCandidate(c.kind, c.row.qitemId);
1303
1532
  if (now_)
1304
1533
  routeCandidate(now_);
1305
- return now_ && selfRoutedUnclaimed(now_) && now_.route === seat && !recoveries.find(now_.row.qitemId) ? [now_] : [];
1534
+ return now_ && backlogKeyOf(now_) === seat && !recoveries.find(now_.row.qitemId) ? [now_] : [];
1306
1535
  });
1307
1536
  if (current.length === 0)
1308
1537
  continue;
@@ -1310,27 +1539,7 @@ export async function runStuckSweep(deps) {
1310
1539
  const covered = last ? backlogRowsOf(last.body) : null;
1311
1540
  if (last && !current.some((c) => (covered !== null && !covered.has(c.row.qitemId)) || evidenceIsNewer(c.evidenceAt, last.ts_updated)))
1312
1541
  continue;
1313
- const text = unclaimedBacklogText(seat, current.map(backlogRow), ageMinutes, node);
1314
- try {
1315
- const created = await deps.queueRepo.create({
1316
- // A notice to a seat about its own rows comes from that seat, as a restore notice does; OpenRig wakes it.
1317
- sourceSession: seat,
1318
- destinationSession: seat,
1319
- body: text.body,
1320
- summary: text.summary,
1321
- evidenceRef: `rig queue list --destination ${seat} --state pending`,
1322
- tags: [STUCK_SWEEP_FINDING_TAG, tag],
1323
- wakeTrigger: "openrig",
1324
- });
1325
- othersMayHaveRun();
1326
- findings.push({ kind: "unclaimed-backlog", qitemId: seat, findingQitemId: created.qitemId, action: "created" });
1327
- }
1328
- catch (err) {
1329
- const message = `unclaimed-backlog notice for ${seat} not created: ${err instanceof Error ? err.message : String(err)}`;
1330
- othersMayHaveRun();
1331
- log(`[stuck-sweep] ${message}`);
1332
- failedCreates.push(message);
1333
- }
1542
+ await fileNotice(backlogText(current.map(backlogRow)), recipientFor(current.map((c) => c.row.sourceSession)));
1334
1543
  }
1335
1544
  // Resolution: an open finding whose underlying condition is no longer detected closes
1336
1545
  // with its reason — the sweep cleans up after itself, no human unwind.
@@ -1360,7 +1569,7 @@ export async function runStuckSweep(deps) {
1360
1569
  continue;
1361
1570
  // #2661: a claim working only on a grace (a background shell, a pending managed restore) is not resolved: the
1362
1571
  // grace stops new detection, and an open stall recovery stays open, so the ceiling's expiry stays actionable.
1363
- if (kind === "stalled-after-claim" && stuckId && deps.queueRepo.getById(stuckId)?.pickup?.grace)
1572
+ if (kind === "stalled-after-claim" && stuckId && deps.queueRepo.getById(stuckId, { waiting: false })?.pickup?.grace)
1364
1573
  continue;
1365
1574
  let resolution = "no longer detected";
1366
1575
  if (stuckId && (kind === "undelivered-wake" || kind === "undelivered-human-notice" || kind === "unclaimed-obligation")) {
@@ -1401,11 +1610,11 @@ export async function runStuckSweep(deps) {
1401
1610
  if (failedCreates.length > 0) {
1402
1611
  // Not a clean or complete pass: say so, while keeping the findings that were made.
1403
1612
  const error = failedCreates.join("; ");
1404
- status?.record("failed", { error, findings: findings.filter((f) => f.action !== "closed").length });
1613
+ status?.record("failed", { error, ...findingCounts(deps.db, findings) });
1405
1614
  return { outcome: "failed", findings, error };
1406
1615
  }
1407
1616
  const outcome = findings.length > 0 ? "findings" : "clean";
1408
- status?.record(outcome, { findings: findings.filter((f) => f.action !== "closed").length });
1617
+ status?.record(outcome, findingCounts(deps.db, findings));
1409
1618
  return { outcome, findings };
1410
1619
  }
1411
1620
  catch (err) {