@openrig/cli 0.7.11 → 0.7.12

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 (772) 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-core/.claude-plugin/plugin.json +1 -1
  12. package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
  13. package/daemon/assets/plugins/openrig-core/hooks/scripts/activity-relay.cjs +15 -0
  14. package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus-state.cjs +103 -0
  15. package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus.cjs +170 -86
  16. package/daemon/assets/plugins/openrig-core/skills/agent-operated-software/SKILL.md +5 -1
  17. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/SKILL.md +3 -2
  18. package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +1 -1
  19. package/daemon/assets/plugins/openrig-core/skills/retiring-and-inheriting-a-seat/SKILL.md +1 -1
  20. package/daemon/assets/plugins/openrig-core/skills/seat-continuity-and-handover/SKILL.md +10 -6
  21. package/daemon/assets/plugins/openrig-core/skills/session-compaction-and-restore/SKILL.md +1 -1
  22. package/daemon/assets/skills/rigs/SKILL.md +37 -2
  23. package/daemon/context-packs/help/help.md +18 -0
  24. package/daemon/context-packs/help/manifest.yaml +1 -1
  25. package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
  26. package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +48 -21
  27. package/daemon/context-packs/reference/getting-started.md +18 -3
  28. package/daemon/context-packs/reference/manifest.yaml +1 -1
  29. package/daemon/context-packs/reference/rig-spec.md +15 -9
  30. package/daemon/context-packs/reference/tmux-servers.md +2 -2
  31. package/daemon/context-packs/reference/whats-new.md +141 -121
  32. package/daemon/context-packs/skills/agent-operated-software/SKILL.md +5 -1
  33. package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
  34. package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
  35. package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
  36. package/daemon/context-packs/skills/claude-compaction-restore/SKILL.md +3 -2
  37. package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
  38. package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
  39. package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
  40. package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
  41. package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
  42. package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
  43. package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
  44. package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
  45. package/daemon/context-packs/skills/core/openrig-herdr/SKILL.md +1 -0
  46. package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
  47. package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
  48. package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
  49. package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
  50. package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
  51. package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
  52. package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
  53. package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
  54. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
  55. package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
  56. package/daemon/context-packs/skills/core/working-with-an-openrig-team/manifest.yaml +1 -1
  57. package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
  58. package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
  59. package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
  60. package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
  61. package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
  62. package/daemon/context-packs/skills/openrig-user/SKILL.md +1 -1
  63. package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
  64. package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
  65. package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
  66. package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
  67. package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
  68. package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
  69. package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
  70. package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
  71. package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
  72. package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
  73. package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
  74. package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
  75. package/daemon/context-packs/skills/pods/review-team/SKILL.md +2 -0
  76. package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
  77. package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
  78. package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
  79. package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
  80. package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
  81. package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
  82. package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
  83. package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
  84. package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
  85. package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
  86. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/SKILL.md +1 -1
  87. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
  88. package/daemon/context-packs/skills/seat-continuity-and-handover/SKILL.md +10 -6
  89. package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
  90. package/daemon/context-packs/skills/session-compaction-and-restore/SKILL.md +1 -1
  91. package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
  92. package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
  93. package/daemon/context-packs/world-example/manifest.yaml +1 -1
  94. package/daemon/context-packs/world-public/manifest.yaml +1 -1
  95. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  96. package/daemon/dist/adapters/claude-code-adapter.js +18 -3
  97. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  98. package/daemon/dist/adapters/claude-resume.d.ts +2 -1
  99. package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
  100. package/daemon/dist/adapters/claude-resume.js +13 -5
  101. package/daemon/dist/adapters/claude-resume.js.map +1 -1
  102. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  103. package/daemon/dist/adapters/codex-runtime-adapter.js +18 -2
  104. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  105. package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts +10 -6
  106. package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts.map +1 -1
  107. package/daemon/dist/adapters/community-harness-runtime-adapter.js +78 -24
  108. package/daemon/dist/adapters/community-harness-runtime-adapter.js.map +1 -1
  109. package/daemon/dist/adapters/pi-community-runtime-adapter.d.ts +27 -0
  110. package/daemon/dist/adapters/pi-community-runtime-adapter.d.ts.map +1 -0
  111. package/daemon/dist/adapters/pi-community-runtime-adapter.js +38 -0
  112. package/daemon/dist/adapters/pi-community-runtime-adapter.js.map +1 -0
  113. package/daemon/dist/adapters/pi-runner-protocol.d.ts +5 -3
  114. package/daemon/dist/adapters/pi-runner-protocol.d.ts.map +1 -1
  115. package/daemon/dist/adapters/pi-runner-protocol.js +6 -1
  116. package/daemon/dist/adapters/pi-runner-protocol.js.map +1 -1
  117. package/daemon/dist/adapters/pi-runner.d.ts +9 -4
  118. package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
  119. package/daemon/dist/adapters/pi-runner.js +104 -30
  120. package/daemon/dist/adapters/pi-runner.js.map +1 -1
  121. package/daemon/dist/adapters/pi-runtime-adapter.d.ts +32 -15
  122. package/daemon/dist/adapters/pi-runtime-adapter.d.ts.map +1 -1
  123. package/daemon/dist/adapters/pi-runtime-adapter.js +41 -10
  124. package/daemon/dist/adapters/pi-runtime-adapter.js.map +1 -1
  125. package/daemon/dist/adapters/tmux-exec.d.ts.map +1 -1
  126. package/daemon/dist/adapters/tmux-exec.js +13 -4
  127. package/daemon/dist/adapters/tmux-exec.js.map +1 -1
  128. package/daemon/dist/adapters/tmux-server.d.ts +2 -0
  129. package/daemon/dist/adapters/tmux-server.d.ts.map +1 -1
  130. package/daemon/dist/adapters/tmux-server.js +1 -1
  131. package/daemon/dist/adapters/tmux-server.js.map +1 -1
  132. package/daemon/dist/adapters/tmux.d.ts +14 -1
  133. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  134. package/daemon/dist/adapters/tmux.js +77 -15
  135. package/daemon/dist/adapters/tmux.js.map +1 -1
  136. package/daemon/dist/attention-surface.d.ts +7 -0
  137. package/daemon/dist/attention-surface.d.ts.map +1 -1
  138. package/daemon/dist/attention-surface.js.map +1 -1
  139. package/daemon/dist/build-info.js +3 -3
  140. package/daemon/dist/db/all-migrations.d.ts.map +1 -1
  141. package/daemon/dist/db/all-migrations.js +10 -0
  142. package/daemon/dist/db/all-migrations.js.map +1 -1
  143. package/daemon/dist/db/migrations/155_queue_erasure.d.ts +12 -0
  144. package/daemon/dist/db/migrations/155_queue_erasure.d.ts.map +1 -0
  145. package/daemon/dist/db/migrations/155_queue_erasure.js +28 -0
  146. package/daemon/dist/db/migrations/155_queue_erasure.js.map +1 -0
  147. package/daemon/dist/db/migrations/156_queue_erasure_link_indexes.d.ts +4 -0
  148. package/daemon/dist/db/migrations/156_queue_erasure_link_indexes.d.ts.map +1 -0
  149. package/daemon/dist/db/migrations/156_queue_erasure_link_indexes.js +14 -0
  150. package/daemon/dist/db/migrations/156_queue_erasure_link_indexes.js.map +1 -0
  151. package/daemon/dist/db/migrations/157_queue_erasure_batches.d.ts +9 -0
  152. package/daemon/dist/db/migrations/157_queue_erasure_batches.d.ts.map +1 -0
  153. package/daemon/dist/db/migrations/157_queue_erasure_batches.js +18 -0
  154. package/daemon/dist/db/migrations/157_queue_erasure_batches.js.map +1 -0
  155. package/daemon/dist/db/migrations/158_queue_inbox_checkins.d.ts +8 -0
  156. package/daemon/dist/db/migrations/158_queue_inbox_checkins.d.ts.map +1 -0
  157. package/daemon/dist/db/migrations/158_queue_inbox_checkins.js +15 -0
  158. package/daemon/dist/db/migrations/158_queue_inbox_checkins.js.map +1 -0
  159. package/daemon/dist/db/migrations/159_queue_items_handed_off_from_index.d.ts +5 -0
  160. package/daemon/dist/db/migrations/159_queue_items_handed_off_from_index.d.ts.map +1 -0
  161. package/daemon/dist/db/migrations/159_queue_items_handed_off_from_index.js +9 -0
  162. package/daemon/dist/db/migrations/159_queue_items_handed_off_from_index.js.map +1 -0
  163. package/daemon/dist/domain/agent-activity-store.d.ts +4 -2
  164. package/daemon/dist/domain/agent-activity-store.d.ts.map +1 -1
  165. package/daemon/dist/domain/agent-activity-store.js +11 -7
  166. package/daemon/dist/domain/agent-activity-store.js.map +1 -1
  167. package/daemon/dist/domain/builtin-startup-files.d.ts +8 -0
  168. package/daemon/dist/domain/builtin-startup-files.d.ts.map +1 -1
  169. package/daemon/dist/domain/builtin-startup-files.js +37 -11
  170. package/daemon/dist/domain/builtin-startup-files.js.map +1 -1
  171. package/daemon/dist/domain/claude-compaction-enforcer.d.ts +30 -17
  172. package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
  173. package/daemon/dist/domain/claude-compaction-enforcer.js +140 -66
  174. package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
  175. package/daemon/dist/domain/claude-continuation-launch.d.ts +16 -0
  176. package/daemon/dist/domain/claude-continuation-launch.d.ts.map +1 -0
  177. package/daemon/dist/domain/claude-continuation-launch.js +110 -0
  178. package/daemon/dist/domain/claude-continuation-launch.js.map +1 -0
  179. package/daemon/dist/domain/claude-git-trust-root.d.ts +11 -0
  180. package/daemon/dist/domain/claude-git-trust-root.d.ts.map +1 -0
  181. package/daemon/dist/domain/claude-git-trust-root.js +72 -0
  182. package/daemon/dist/domain/claude-git-trust-root.js.map +1 -0
  183. package/daemon/dist/domain/claude-managed-launch.d.ts +1 -0
  184. package/daemon/dist/domain/claude-managed-launch.d.ts.map +1 -1
  185. package/daemon/dist/domain/claude-managed-launch.js +5 -5
  186. package/daemon/dist/domain/claude-managed-launch.js.map +1 -1
  187. package/daemon/dist/domain/community-harness-presets.d.ts +5 -0
  188. package/daemon/dist/domain/community-harness-presets.d.ts.map +1 -1
  189. package/daemon/dist/domain/community-harness-presets.js +33 -6
  190. package/daemon/dist/domain/community-harness-presets.js.map +1 -1
  191. package/daemon/dist/domain/compaction-restore-notice.d.ts +3 -1
  192. package/daemon/dist/domain/compaction-restore-notice.d.ts.map +1 -1
  193. package/daemon/dist/domain/compaction-restore-notice.js +37 -6
  194. package/daemon/dist/domain/compaction-restore-notice.js.map +1 -1
  195. package/daemon/dist/domain/current-work.d.ts +52 -0
  196. package/daemon/dist/domain/current-work.d.ts.map +1 -1
  197. package/daemon/dist/domain/current-work.js +215 -0
  198. package/daemon/dist/domain/current-work.js.map +1 -1
  199. package/daemon/dist/domain/default-receiver.d.ts +40 -0
  200. package/daemon/dist/domain/default-receiver.d.ts.map +1 -0
  201. package/daemon/dist/domain/default-receiver.js +70 -0
  202. package/daemon/dist/domain/default-receiver.js.map +1 -0
  203. package/daemon/dist/domain/draft-aware-delivery.js +1 -1
  204. package/daemon/dist/domain/draft-aware-delivery.js.map +1 -1
  205. package/daemon/dist/domain/escalation-owner.d.ts.map +1 -1
  206. package/daemon/dist/domain/escalation-owner.js +8 -3
  207. package/daemon/dist/domain/escalation-owner.js.map +1 -1
  208. package/daemon/dist/domain/event-bus.d.ts +16 -8
  209. package/daemon/dist/domain/event-bus.d.ts.map +1 -1
  210. package/daemon/dist/domain/event-bus.js +50 -16
  211. package/daemon/dist/domain/event-bus.js.map +1 -1
  212. package/daemon/dist/domain/execution-view.d.ts.map +1 -1
  213. package/daemon/dist/domain/execution-view.js +28 -3
  214. package/daemon/dist/domain/execution-view.js.map +1 -1
  215. package/daemon/dist/domain/gateway/gateway-subsystem.d.ts +3 -0
  216. package/daemon/dist/domain/gateway/gateway-subsystem.d.ts.map +1 -1
  217. package/daemon/dist/domain/gateway/gateway-subsystem.js +9 -0
  218. package/daemon/dist/domain/gateway/gateway-subsystem.js.map +1 -1
  219. package/daemon/dist/domain/gateway/human-quiet-windows.d.ts +2 -1
  220. package/daemon/dist/domain/gateway/human-quiet-windows.d.ts.map +1 -1
  221. package/daemon/dist/domain/gateway/human-quiet-windows.js +2 -1
  222. package/daemon/dist/domain/gateway/human-quiet-windows.js.map +1 -1
  223. package/daemon/dist/domain/gateway/human-registry.d.ts +12 -1
  224. package/daemon/dist/domain/gateway/human-registry.d.ts.map +1 -1
  225. package/daemon/dist/domain/gateway/human-registry.js +64 -8
  226. package/daemon/dist/domain/gateway/human-registry.js.map +1 -1
  227. package/daemon/dist/domain/gateway/relay-config.d.ts +5 -2
  228. package/daemon/dist/domain/gateway/relay-config.d.ts.map +1 -1
  229. package/daemon/dist/domain/gateway/relay-config.js +34 -3
  230. package/daemon/dist/domain/gateway/relay-config.js.map +1 -1
  231. package/daemon/dist/domain/gateway/relay-inbound.d.ts +11 -0
  232. package/daemon/dist/domain/gateway/relay-inbound.d.ts.map +1 -1
  233. package/daemon/dist/domain/gateway/relay-inbound.js +283 -41
  234. package/daemon/dist/domain/gateway/relay-inbound.js.map +1 -1
  235. package/daemon/dist/domain/gateway/relay-outbound.d.ts +5 -2
  236. package/daemon/dist/domain/gateway/relay-outbound.d.ts.map +1 -1
  237. package/daemon/dist/domain/gateway/relay-outbound.js +37 -6
  238. package/daemon/dist/domain/gateway/relay-outbound.js.map +1 -1
  239. package/daemon/dist/domain/gateway/slack/config.d.ts +21 -0
  240. package/daemon/dist/domain/gateway/slack/config.d.ts.map +1 -1
  241. package/daemon/dist/domain/gateway/slack/config.js +30 -3
  242. package/daemon/dist/domain/gateway/slack/config.js.map +1 -1
  243. package/daemon/dist/domain/gateway/slack/message.d.ts +4 -0
  244. package/daemon/dist/domain/gateway/slack/message.d.ts.map +1 -1
  245. package/daemon/dist/domain/gateway/slack/message.js +7 -2
  246. package/daemon/dist/domain/gateway/slack/message.js.map +1 -1
  247. package/daemon/dist/domain/gateway/slack/open-asks.d.ts +13 -1
  248. package/daemon/dist/domain/gateway/slack/open-asks.d.ts.map +1 -1
  249. package/daemon/dist/domain/gateway/slack/open-asks.js +58 -7
  250. package/daemon/dist/domain/gateway/slack/open-asks.js.map +1 -1
  251. package/daemon/dist/domain/gateway/slack/outbound-driver.d.ts +9 -0
  252. package/daemon/dist/domain/gateway/slack/outbound-driver.d.ts.map +1 -1
  253. package/daemon/dist/domain/gateway/slack/outbound-driver.js.map +1 -1
  254. package/daemon/dist/domain/gateway/slack/settled-asks.d.ts.map +1 -1
  255. package/daemon/dist/domain/gateway/slack/settled-asks.js +19 -1
  256. package/daemon/dist/domain/gateway/slack/settled-asks.js.map +1 -1
  257. package/daemon/dist/domain/gateway/slack/slack-api.d.ts +3 -0
  258. package/daemon/dist/domain/gateway/slack/slack-api.d.ts.map +1 -1
  259. package/daemon/dist/domain/gateway/slack/slack-api.js +12 -4
  260. package/daemon/dist/domain/gateway/slack/slack-api.js.map +1 -1
  261. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts +2 -0
  262. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts.map +1 -1
  263. package/daemon/dist/domain/gateway/slack/slack-delivery.js +38 -12
  264. package/daemon/dist/domain/gateway/slack/slack-delivery.js.map +1 -1
  265. package/daemon/dist/domain/gateway/slack/slack-recovery.d.ts +12 -1
  266. package/daemon/dist/domain/gateway/slack/slack-recovery.d.ts.map +1 -1
  267. package/daemon/dist/domain/gateway/slack/slack-recovery.js +68 -10
  268. package/daemon/dist/domain/gateway/slack/slack-recovery.js.map +1 -1
  269. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
  270. package/daemon/dist/domain/gateway/slack/slack-subsystem.js +151 -47
  271. package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
  272. package/daemon/dist/domain/gateway/slack/socket-inbound.d.ts +1 -0
  273. package/daemon/dist/domain/gateway/slack/socket-inbound.d.ts.map +1 -1
  274. package/daemon/dist/domain/gateway/slack/socket-inbound.js +5 -0
  275. package/daemon/dist/domain/gateway/slack/socket-inbound.js.map +1 -1
  276. package/daemon/dist/domain/gateway/slack/state-store.d.ts +4 -0
  277. package/daemon/dist/domain/gateway/slack/state-store.d.ts.map +1 -1
  278. package/daemon/dist/domain/gateway/slack/state-store.js +4 -1
  279. package/daemon/dist/domain/gateway/slack/state-store.js.map +1 -1
  280. package/daemon/dist/domain/gateway/slack/thread-recovery.d.ts +23 -3
  281. package/daemon/dist/domain/gateway/slack/thread-recovery.d.ts.map +1 -1
  282. package/daemon/dist/domain/gateway/slack/thread-recovery.js +52 -10
  283. package/daemon/dist/domain/gateway/slack/thread-recovery.js.map +1 -1
  284. package/daemon/dist/domain/gateway/slack/thread-seat-map.d.ts +4 -1
  285. package/daemon/dist/domain/gateway/slack/thread-seat-map.d.ts.map +1 -1
  286. package/daemon/dist/domain/gateway/slack/thread-seat-map.js +7 -4
  287. package/daemon/dist/domain/gateway/slack/thread-seat-map.js.map +1 -1
  288. package/daemon/dist/domain/guidance-projection.d.ts +39 -0
  289. package/daemon/dist/domain/guidance-projection.d.ts.map +1 -0
  290. package/daemon/dist/domain/guidance-projection.js +91 -0
  291. package/daemon/dist/domain/guidance-projection.js.map +1 -0
  292. package/daemon/dist/domain/health-passive-ceremony.d.ts.map +1 -1
  293. package/daemon/dist/domain/health-passive-ceremony.js +31 -12
  294. package/daemon/dist/domain/health-passive-ceremony.js.map +1 -1
  295. package/daemon/dist/domain/hosted-wake.d.ts +5 -1
  296. package/daemon/dist/domain/hosted-wake.d.ts.map +1 -1
  297. package/daemon/dist/domain/hosted-wake.js +13 -3
  298. package/daemon/dist/domain/hosted-wake.js.map +1 -1
  299. package/daemon/dist/domain/launch-wrapper.d.ts +2 -1
  300. package/daemon/dist/domain/launch-wrapper.d.ts.map +1 -1
  301. package/daemon/dist/domain/launch-wrapper.js +6 -2
  302. package/daemon/dist/domain/launch-wrapper.js.map +1 -1
  303. package/daemon/dist/domain/managed-blocks.d.ts +3 -0
  304. package/daemon/dist/domain/managed-blocks.d.ts.map +1 -1
  305. package/daemon/dist/domain/managed-blocks.js +5 -0
  306. package/daemon/dist/domain/managed-blocks.js.map +1 -1
  307. package/daemon/dist/domain/markdown-address.d.ts.map +1 -1
  308. package/daemon/dist/domain/markdown-address.js +12 -1
  309. package/daemon/dist/domain/markdown-address.js.map +1 -1
  310. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
  311. package/daemon/dist/domain/mission-control/mission-control-write-contract.js +37 -6
  312. package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
  313. package/daemon/dist/domain/native-process-arguments.d.ts +5 -0
  314. package/daemon/dist/domain/native-process-arguments.d.ts.map +1 -1
  315. package/daemon/dist/domain/native-process-arguments.js +60 -5
  316. package/daemon/dist/domain/native-process-arguments.js.map +1 -1
  317. package/daemon/dist/domain/node-inventory.js +3 -3
  318. package/daemon/dist/domain/node-inventory.js.map +1 -1
  319. package/daemon/dist/domain/package-manifest.d.ts.map +1 -1
  320. package/daemon/dist/domain/package-manifest.js +10 -5
  321. package/daemon/dist/domain/package-manifest.js.map +1 -1
  322. package/daemon/dist/domain/policies/delivery-digest-flush.d.ts.map +1 -1
  323. package/daemon/dist/domain/policies/delivery-digest-flush.js +9 -1
  324. package/daemon/dist/domain/policies/delivery-digest-flush.js.map +1 -1
  325. package/daemon/dist/domain/policies/mode-scheduled-end.d.ts +4 -1
  326. package/daemon/dist/domain/policies/mode-scheduled-end.d.ts.map +1 -1
  327. package/daemon/dist/domain/policies/mode-scheduled-end.js +19 -10
  328. package/daemon/dist/domain/policies/mode-scheduled-end.js.map +1 -1
  329. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts.map +1 -1
  330. package/daemon/dist/domain/policies/parked-owner-consumer.js +3 -2
  331. package/daemon/dist/domain/policies/parked-owner-consumer.js.map +1 -1
  332. package/daemon/dist/domain/policies/quiet-release.d.ts +19 -6
  333. package/daemon/dist/domain/policies/quiet-release.d.ts.map +1 -1
  334. package/daemon/dist/domain/policies/quiet-release.js +44 -7
  335. package/daemon/dist/domain/policies/quiet-release.js.map +1 -1
  336. package/daemon/dist/domain/proof/judgments.d.ts +11 -0
  337. package/daemon/dist/domain/proof/judgments.d.ts.map +1 -1
  338. package/daemon/dist/domain/proof/judgments.js +61 -38
  339. package/daemon/dist/domain/proof/judgments.js.map +1 -1
  340. package/daemon/dist/domain/queue-blocker.d.ts +5 -0
  341. package/daemon/dist/domain/queue-blocker.d.ts.map +1 -0
  342. package/daemon/dist/domain/queue-blocker.js +12 -0
  343. package/daemon/dist/domain/queue-blocker.js.map +1 -0
  344. package/daemon/dist/domain/queue-erasure.d.ts +173 -0
  345. package/daemon/dist/domain/queue-erasure.d.ts.map +1 -0
  346. package/daemon/dist/domain/queue-erasure.js +885 -0
  347. package/daemon/dist/domain/queue-erasure.js.map +1 -0
  348. package/daemon/dist/domain/queue-owner.d.ts +6 -0
  349. package/daemon/dist/domain/queue-owner.d.ts.map +1 -1
  350. package/daemon/dist/domain/queue-owner.js +13 -4
  351. package/daemon/dist/domain/queue-owner.js.map +1 -1
  352. package/daemon/dist/domain/queue-repository.d.ts +160 -20
  353. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  354. package/daemon/dist/domain/queue-repository.js +449 -61
  355. package/daemon/dist/domain/queue-repository.js.map +1 -1
  356. package/daemon/dist/domain/queue-retention.d.ts +15 -1
  357. package/daemon/dist/domain/queue-retention.d.ts.map +1 -1
  358. package/daemon/dist/domain/queue-retention.js +35 -0
  359. package/daemon/dist/domain/queue-retention.js.map +1 -1
  360. package/daemon/dist/domain/queue-stuck-sweep.d.ts +17 -4
  361. package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
  362. package/daemon/dist/domain/queue-stuck-sweep.js +246 -92
  363. package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
  364. package/daemon/dist/domain/queue-transition-log.d.ts +5 -2
  365. package/daemon/dist/domain/queue-transition-log.d.ts.map +1 -1
  366. package/daemon/dist/domain/queue-transition-log.js +30 -5
  367. package/daemon/dist/domain/queue-transition-log.js.map +1 -1
  368. package/daemon/dist/domain/queue-waiting.d.ts +48 -2
  369. package/daemon/dist/domain/queue-waiting.d.ts.map +1 -1
  370. package/daemon/dist/domain/queue-waiting.js +73 -13
  371. package/daemon/dist/domain/queue-waiting.js.map +1 -1
  372. package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
  373. package/daemon/dist/domain/queue-wake-ladder.js +79 -28
  374. package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
  375. package/daemon/dist/domain/rebuild-priming-chain.d.ts +3 -1
  376. package/daemon/dist/domain/rebuild-priming-chain.d.ts.map +1 -1
  377. package/daemon/dist/domain/rebuild-priming-chain.js +3 -1
  378. package/daemon/dist/domain/rebuild-priming-chain.js.map +1 -1
  379. package/daemon/dist/domain/refocus-record.d.ts +17 -0
  380. package/daemon/dist/domain/refocus-record.d.ts.map +1 -0
  381. package/daemon/dist/domain/refocus-record.js +94 -0
  382. package/daemon/dist/domain/refocus-record.js.map +1 -0
  383. package/daemon/dist/domain/restore-check-service.js +1 -1
  384. package/daemon/dist/domain/restore-check-service.js.map +1 -1
  385. package/daemon/dist/domain/restore-guidance.d.ts.map +1 -1
  386. package/daemon/dist/domain/restore-guidance.js +5 -6
  387. package/daemon/dist/domain/restore-guidance.js.map +1 -1
  388. package/daemon/dist/domain/restore-orchestrator.d.ts +2 -0
  389. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  390. package/daemon/dist/domain/restore-orchestrator.js +39 -18
  391. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  392. package/daemon/dist/domain/restore-plan-preview.d.ts.map +1 -1
  393. package/daemon/dist/domain/restore-plan-preview.js +2 -1
  394. package/daemon/dist/domain/restore-plan-preview.js.map +1 -1
  395. package/daemon/dist/domain/resume-token-validation.d.ts +7 -0
  396. package/daemon/dist/domain/resume-token-validation.d.ts.map +1 -1
  397. package/daemon/dist/domain/resume-token-validation.js +13 -3
  398. package/daemon/dist/domain/resume-token-validation.js.map +1 -1
  399. package/daemon/dist/domain/rig-repository.js +3 -3
  400. package/daemon/dist/domain/rig-repository.js.map +1 -1
  401. package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
  402. package/daemon/dist/domain/rig-teardown.js +2 -1
  403. package/daemon/dist/domain/rig-teardown.js.map +1 -1
  404. package/daemon/dist/domain/rigs-being-built.d.ts +5 -0
  405. package/daemon/dist/domain/rigs-being-built.d.ts.map +1 -0
  406. package/daemon/dist/domain/rigs-being-built.js +18 -0
  407. package/daemon/dist/domain/rigs-being-built.js.map +1 -0
  408. package/daemon/dist/domain/rigspec-instantiator.d.ts +3 -0
  409. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  410. package/daemon/dist/domain/rigspec-instantiator.js +32 -2
  411. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  412. package/daemon/dist/domain/rigspec-preflight.d.ts.map +1 -1
  413. package/daemon/dist/domain/rigspec-preflight.js +4 -1
  414. package/daemon/dist/domain/rigspec-preflight.js.map +1 -1
  415. package/daemon/dist/domain/rigspec-schema.js +2 -2
  416. package/daemon/dist/domain/rigspec-schema.js.map +1 -1
  417. package/daemon/dist/domain/runner-permissions.d.ts +16 -0
  418. package/daemon/dist/domain/runner-permissions.d.ts.map +1 -1
  419. package/daemon/dist/domain/runner-permissions.js +95 -14
  420. package/daemon/dist/domain/runner-permissions.js.map +1 -1
  421. package/daemon/dist/domain/runtime-adapter.d.ts +1 -0
  422. package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
  423. package/daemon/dist/domain/runtime-adapter.js.map +1 -1
  424. package/daemon/dist/domain/scope/logical-checkbox.d.ts.map +1 -1
  425. package/daemon/dist/domain/scope/logical-checkbox.js +14 -0
  426. package/daemon/dist/domain/scope/logical-checkbox.js.map +1 -1
  427. package/daemon/dist/domain/seat-activity-service.d.ts +12 -0
  428. package/daemon/dist/domain/seat-activity-service.d.ts.map +1 -1
  429. package/daemon/dist/domain/seat-activity-service.js +85 -4
  430. package/daemon/dist/domain/seat-activity-service.js.map +1 -1
  431. package/daemon/dist/domain/seat-handover-service.d.ts +7 -0
  432. package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
  433. package/daemon/dist/domain/seat-handover-service.js +23 -8
  434. package/daemon/dist/domain/seat-handover-service.js.map +1 -1
  435. package/daemon/dist/domain/seat-kinds.d.ts +21 -0
  436. package/daemon/dist/domain/seat-kinds.d.ts.map +1 -0
  437. package/daemon/dist/domain/seat-kinds.js +27 -0
  438. package/daemon/dist/domain/seat-kinds.js.map +1 -0
  439. package/daemon/dist/domain/seat-launch-environment.d.ts +4 -0
  440. package/daemon/dist/domain/seat-launch-environment.d.ts.map +1 -1
  441. package/daemon/dist/domain/seat-launch-environment.js +7 -6
  442. package/daemon/dist/domain/seat-launch-environment.js.map +1 -1
  443. package/daemon/dist/domain/seat-lifecycle-service.d.ts +12 -0
  444. package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
  445. package/daemon/dist/domain/seat-lifecycle-service.js +52 -11
  446. package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
  447. package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -1
  448. package/daemon/dist/domain/seat-runtime-switch-service.js +23 -12
  449. package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
  450. package/daemon/dist/domain/seat-skill-apply.d.ts +2 -0
  451. package/daemon/dist/domain/seat-skill-apply.d.ts.map +1 -1
  452. package/daemon/dist/domain/seat-skill-apply.js +5 -2
  453. package/daemon/dist/domain/seat-skill-apply.js.map +1 -1
  454. package/daemon/dist/domain/seat-skill-storage.js +1 -1
  455. package/daemon/dist/domain/seat-skill-storage.js.map +1 -1
  456. package/daemon/dist/domain/seat-status-service.d.ts +10 -0
  457. package/daemon/dist/domain/seat-status-service.d.ts.map +1 -1
  458. package/daemon/dist/domain/seat-status-service.js +36 -2
  459. package/daemon/dist/domain/seat-status-service.js.map +1 -1
  460. package/daemon/dist/domain/seat-structural-activity-service.d.ts +8 -0
  461. package/daemon/dist/domain/seat-structural-activity-service.d.ts.map +1 -1
  462. package/daemon/dist/domain/seat-structural-activity-service.js +8 -2
  463. package/daemon/dist/domain/seat-structural-activity-service.js.map +1 -1
  464. package/daemon/dist/domain/session-jsonl.d.ts +4 -2
  465. package/daemon/dist/domain/session-jsonl.d.ts.map +1 -1
  466. package/daemon/dist/domain/session-jsonl.js +56 -22
  467. package/daemon/dist/domain/session-jsonl.js.map +1 -1
  468. package/daemon/dist/domain/session-registry.d.ts +20 -3
  469. package/daemon/dist/domain/session-registry.d.ts.map +1 -1
  470. package/daemon/dist/domain/session-registry.js +39 -3
  471. package/daemon/dist/domain/session-registry.js.map +1 -1
  472. package/daemon/dist/domain/session-transport.d.ts +28 -4
  473. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  474. package/daemon/dist/domain/session-transport.js +236 -56
  475. package/daemon/dist/domain/session-transport.js.map +1 -1
  476. package/daemon/dist/domain/slices/slice-indexer.d.ts +41 -0
  477. package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -1
  478. package/daemon/dist/domain/slices/slice-indexer.js +463 -22
  479. package/daemon/dist/domain/slices/slice-indexer.js.map +1 -1
  480. package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
  481. package/daemon/dist/domain/startup-orchestrator.js +5 -2
  482. package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
  483. package/daemon/dist/domain/startup-submission-evidence.d.ts +1 -0
  484. package/daemon/dist/domain/startup-submission-evidence.d.ts.map +1 -1
  485. package/daemon/dist/domain/startup-submission-evidence.js +18 -4
  486. package/daemon/dist/domain/startup-submission-evidence.js.map +1 -1
  487. package/daemon/dist/domain/terminal/herdr-adapter.d.ts.map +1 -1
  488. package/daemon/dist/domain/terminal/herdr-adapter.js +3 -2
  489. package/daemon/dist/domain/terminal/herdr-adapter.js.map +1 -1
  490. package/daemon/dist/domain/terminal/herdr-app-install.d.ts +28 -0
  491. package/daemon/dist/domain/terminal/herdr-app-install.d.ts.map +1 -0
  492. package/daemon/dist/domain/terminal/herdr-app-install.js +170 -0
  493. package/daemon/dist/domain/terminal/herdr-app-install.js.map +1 -0
  494. package/daemon/dist/domain/terminal/herdr-app-layout.d.ts +79 -0
  495. package/daemon/dist/domain/terminal/herdr-app-layout.d.ts.map +1 -0
  496. package/daemon/dist/domain/terminal/herdr-app-layout.js +134 -0
  497. package/daemon/dist/domain/terminal/herdr-app-layout.js.map +1 -0
  498. package/daemon/dist/domain/terminal/herdr-app-provider.d.ts +123 -0
  499. package/daemon/dist/domain/terminal/herdr-app-provider.d.ts.map +1 -0
  500. package/daemon/dist/domain/terminal/herdr-app-provider.js +681 -0
  501. package/daemon/dist/domain/terminal/herdr-app-provider.js.map +1 -0
  502. package/daemon/dist/domain/terminal/herdr-app-state.d.ts +91 -0
  503. package/daemon/dist/domain/terminal/herdr-app-state.d.ts.map +1 -0
  504. package/daemon/dist/domain/terminal/herdr-app-state.js +140 -0
  505. package/daemon/dist/domain/terminal/herdr-app-state.js.map +1 -0
  506. package/daemon/dist/domain/terminal/herdr-app-transport.d.ts +68 -0
  507. package/daemon/dist/domain/terminal/herdr-app-transport.d.ts.map +1 -0
  508. package/daemon/dist/domain/terminal/herdr-app-transport.js +133 -0
  509. package/daemon/dist/domain/terminal/herdr-app-transport.js.map +1 -0
  510. package/daemon/dist/domain/terminal/terminal-provider.d.ts +18 -0
  511. package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
  512. package/daemon/dist/domain/terminal/terminal-service.d.ts +28 -3
  513. package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
  514. package/daemon/dist/domain/terminal/terminal-service.js +41 -8
  515. package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
  516. package/daemon/dist/domain/terminal/view-composer.d.ts.map +1 -1
  517. package/daemon/dist/domain/terminal/view-composer.js +1 -0
  518. package/daemon/dist/domain/terminal/view-composer.js.map +1 -1
  519. package/daemon/dist/domain/time-bound-advisory.js +3 -3
  520. package/daemon/dist/domain/time-bound-advisory.js.map +1 -1
  521. package/daemon/dist/domain/types.d.ts +51 -0
  522. package/daemon/dist/domain/types.d.ts.map +1 -1
  523. package/daemon/dist/domain/types.js.map +1 -1
  524. package/daemon/dist/domain/user-settings/settings-browser.d.ts +2 -1
  525. package/daemon/dist/domain/user-settings/settings-browser.d.ts.map +1 -1
  526. package/daemon/dist/domain/user-settings/settings-browser.js +22 -3
  527. package/daemon/dist/domain/user-settings/settings-browser.js.map +1 -1
  528. package/daemon/dist/domain/user-settings/settings-store.d.ts +1 -1
  529. package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
  530. package/daemon/dist/domain/user-settings/settings-store.js +35 -0
  531. package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
  532. package/daemon/dist/domain/wake-recovery.d.ts.map +1 -1
  533. package/daemon/dist/domain/wake-recovery.js +3 -2
  534. package/daemon/dist/domain/wake-recovery.js.map +1 -1
  535. package/daemon/dist/domain/whoami-service.d.ts +6 -0
  536. package/daemon/dist/domain/whoami-service.d.ts.map +1 -1
  537. package/daemon/dist/domain/whoami-service.js +9 -1
  538. package/daemon/dist/domain/whoami-service.js.map +1 -1
  539. package/daemon/dist/domain/workflow-projector.js +1 -1
  540. package/daemon/dist/domain/workflow-projector.js.map +1 -1
  541. package/daemon/dist/domain/workflow-runtime.js +4 -4
  542. package/daemon/dist/domain/workflow-runtime.js.map +1 -1
  543. package/daemon/dist/domain/workflow-spec-cache.d.ts +14 -0
  544. package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
  545. package/daemon/dist/domain/workflow-spec-cache.js +28 -7
  546. package/daemon/dist/domain/workflow-spec-cache.js.map +1 -1
  547. package/daemon/dist/index.d.ts +2 -1
  548. package/daemon/dist/index.d.ts.map +1 -1
  549. package/daemon/dist/index.js +9 -1
  550. package/daemon/dist/index.js.map +1 -1
  551. package/daemon/dist/lib/pane-envelope.d.ts +3 -0
  552. package/daemon/dist/lib/pane-envelope.d.ts.map +1 -1
  553. package/daemon/dist/lib/pane-envelope.js +3 -1
  554. package/daemon/dist/lib/pane-envelope.js.map +1 -1
  555. package/daemon/dist/routes/activity.d.ts.map +1 -1
  556. package/daemon/dist/routes/activity.js +110 -23
  557. package/daemon/dist/routes/activity.js.map +1 -1
  558. package/daemon/dist/routes/attention.d.ts.map +1 -1
  559. package/daemon/dist/routes/attention.js +2 -0
  560. package/daemon/dist/routes/attention.js.map +1 -1
  561. package/daemon/dist/routes/config.d.ts.map +1 -1
  562. package/daemon/dist/routes/config.js +9 -1
  563. package/daemon/dist/routes/config.js.map +1 -1
  564. package/daemon/dist/routes/events.js +7 -2
  565. package/daemon/dist/routes/events.js.map +1 -1
  566. package/daemon/dist/routes/gateway.d.ts.map +1 -1
  567. package/daemon/dist/routes/gateway.js +34 -5
  568. package/daemon/dist/routes/gateway.js.map +1 -1
  569. package/daemon/dist/routes/hosts.d.ts.map +1 -1
  570. package/daemon/dist/routes/hosts.js +146 -46
  571. package/daemon/dist/routes/hosts.js.map +1 -1
  572. package/daemon/dist/routes/provider.js +1 -1
  573. package/daemon/dist/routes/provider.js.map +1 -1
  574. package/daemon/dist/routes/queue.d.ts +19 -0
  575. package/daemon/dist/routes/queue.d.ts.map +1 -1
  576. package/daemon/dist/routes/queue.js +232 -43
  577. package/daemon/dist/routes/queue.js.map +1 -1
  578. package/daemon/dist/routes/skills.d.ts.map +1 -1
  579. package/daemon/dist/routes/skills.js +8 -2
  580. package/daemon/dist/routes/skills.js.map +1 -1
  581. package/daemon/dist/routes/slices.d.ts.map +1 -1
  582. package/daemon/dist/routes/slices.js +156 -28
  583. package/daemon/dist/routes/slices.js.map +1 -1
  584. package/daemon/dist/routes/terminal.d.ts.map +1 -1
  585. package/daemon/dist/routes/terminal.js +40 -3
  586. package/daemon/dist/routes/terminal.js.map +1 -1
  587. package/daemon/dist/routes/transport.d.ts.map +1 -1
  588. package/daemon/dist/routes/transport.js +0 -1
  589. package/daemon/dist/routes/transport.js.map +1 -1
  590. package/daemon/dist/startup.d.ts +34 -0
  591. package/daemon/dist/startup.d.ts.map +1 -1
  592. package/daemon/dist/startup.js +190 -10
  593. package/daemon/dist/startup.js.map +1 -1
  594. package/daemon/docs/reference/agent-spec.md +2 -4
  595. package/daemon/docs/reference/agent-startup-guide.md +24 -2
  596. package/daemon/docs/reference/community-harness-examples/omo/omo.yaml +14 -0
  597. package/daemon/docs/reference/community-harness-presets.md +56 -2
  598. package/daemon/docs/reference/daemon-http-clients.md +15 -1
  599. package/daemon/docs/reference/edge-types.md +6 -4
  600. package/daemon/docs/reference/gateway-participants.md +19 -0
  601. package/daemon/docs/reference/gateway-relay.md +41 -12
  602. package/daemon/docs/reference/getting-started.md +18 -3
  603. package/daemon/docs/reference/harness-runner-contract.md +61 -12
  604. package/daemon/docs/reference/health-diagnosis.md +5 -1
  605. package/daemon/docs/reference/help.md +18 -0
  606. package/daemon/docs/reference/herdr-app.md +148 -0
  607. package/daemon/docs/reference/hosted-members.md +19 -7
  608. package/daemon/docs/reference/keeping-a-watch.md +3 -1
  609. package/daemon/docs/reference/queue-erasure.md +161 -0
  610. package/daemon/docs/reference/quickstart.md +1 -1
  611. package/daemon/docs/reference/rig-spec.md +15 -9
  612. package/daemon/docs/reference/runner-conformance/README.md +3 -0
  613. package/daemon/docs/reference/runner-conformance/check-runner.mjs +27 -6
  614. package/daemon/docs/reference/runner-conformance/fake-acp-agent.mjs +1 -1
  615. package/daemon/docs/reference/sdlc-conventions.md +16 -1
  616. package/daemon/docs/reference/seat-delivery.md +10 -3
  617. package/daemon/docs/reference/slack-app-setup.md +37 -12
  618. package/daemon/docs/reference/terminal-sessions.md +28 -15
  619. package/daemon/docs/reference/tmux-servers.md +2 -2
  620. package/daemon/docs/reference/whats-new.md +141 -121
  621. package/daemon/specs/agents/shared/skills/core/openrig-herdr/SKILL.md +1 -0
  622. package/daemon/specs/agents/shared/skills/pods/review-team/SKILL.md +2 -0
  623. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +24 -0
  624. package/daemon/specs/rigs/launch/kernel/culture/CULTURE.md +7 -4
  625. package/daemon/specs/rigs/launch/kernel/rig.yaml +6 -3
  626. package/daemon/specs/rigs/launch/starter/guidance/lead-first-move.md +3 -1
  627. package/dist/build-info.js +3 -3
  628. package/dist/client.js +2 -2
  629. package/dist/client.js.map +1 -1
  630. package/dist/commands/config.d.ts.map +1 -1
  631. package/dist/commands/config.js +11 -1
  632. package/dist/commands/config.js.map +1 -1
  633. package/dist/commands/context.d.ts.map +1 -1
  634. package/dist/commands/context.js +44 -4
  635. package/dist/commands/context.js.map +1 -1
  636. package/dist/commands/daemon.d.ts.map +1 -1
  637. package/dist/commands/daemon.js +17 -3
  638. package/dist/commands/daemon.js.map +1 -1
  639. package/dist/commands/gateway.d.ts.map +1 -1
  640. package/dist/commands/gateway.js +21 -4
  641. package/dist/commands/gateway.js.map +1 -1
  642. package/dist/commands/host.d.ts.map +1 -1
  643. package/dist/commands/host.js +10 -1
  644. package/dist/commands/host.js.map +1 -1
  645. package/dist/commands/launch.d.ts +1 -0
  646. package/dist/commands/launch.d.ts.map +1 -1
  647. package/dist/commands/launch.js +1 -1
  648. package/dist/commands/launch.js.map +1 -1
  649. package/dist/commands/proof.d.ts.map +1 -1
  650. package/dist/commands/proof.js +18 -6
  651. package/dist/commands/proof.js.map +1 -1
  652. package/dist/commands/provider.js +1 -1
  653. package/dist/commands/ps.d.ts +9 -1
  654. package/dist/commands/ps.d.ts.map +1 -1
  655. package/dist/commands/ps.js +23 -2
  656. package/dist/commands/ps.js.map +1 -1
  657. package/dist/commands/queue.d.ts.map +1 -1
  658. package/dist/commands/queue.js +226 -8
  659. package/dist/commands/queue.js.map +1 -1
  660. package/dist/commands/scope.d.ts +2 -0
  661. package/dist/commands/scope.d.ts.map +1 -1
  662. package/dist/commands/scope.js +15 -0
  663. package/dist/commands/scope.js.map +1 -1
  664. package/dist/commands/seat.d.ts.map +1 -1
  665. package/dist/commands/seat.js +64 -10
  666. package/dist/commands/seat.js.map +1 -1
  667. package/dist/commands/send.d.ts +2 -0
  668. package/dist/commands/send.d.ts.map +1 -1
  669. package/dist/commands/send.js +16 -6
  670. package/dist/commands/send.js.map +1 -1
  671. package/dist/commands/setup.js +1 -1
  672. package/dist/commands/setup.js.map +1 -1
  673. package/dist/commands/skill.d.ts.map +1 -1
  674. package/dist/commands/skill.js +5 -0
  675. package/dist/commands/skill.js.map +1 -1
  676. package/dist/commands/slack.d.ts +1 -1
  677. package/dist/commands/slack.d.ts.map +1 -1
  678. package/dist/commands/slack.js +5 -1
  679. package/dist/commands/slack.js.map +1 -1
  680. package/dist/commands/status.d.ts.map +1 -1
  681. package/dist/commands/status.js +11 -1
  682. package/dist/commands/status.js.map +1 -1
  683. package/dist/commands/terminal.d.ts +22 -0
  684. package/dist/commands/terminal.d.ts.map +1 -1
  685. package/dist/commands/terminal.js +116 -7
  686. package/dist/commands/terminal.js.map +1 -1
  687. package/dist/commands/up.d.ts.map +1 -1
  688. package/dist/commands/up.js +22 -0
  689. package/dist/commands/up.js.map +1 -1
  690. package/dist/commands/whoami.d.ts.map +1 -1
  691. package/dist/commands/whoami.js +13 -2
  692. package/dist/commands/whoami.js.map +1 -1
  693. package/dist/commands/workflow-errors.js +1 -1
  694. package/dist/commands/workflow-errors.js.map +1 -1
  695. package/dist/commands/workflow.js +1 -1
  696. package/dist/commands/workflow.js.map +1 -1
  697. package/dist/config-store.d.ts +8 -1
  698. package/dist/config-store.d.ts.map +1 -1
  699. package/dist/config-store.js +60 -0
  700. package/dist/config-store.js.map +1 -1
  701. package/dist/daemon-start-lock.d.ts +24 -2
  702. package/dist/daemon-start-lock.d.ts.map +1 -1
  703. package/dist/daemon-start-lock.js +125 -4
  704. package/dist/daemon-start-lock.js.map +1 -1
  705. package/dist/lib/scope/logical-checkbox.d.ts.map +1 -1
  706. package/dist/lib/scope/logical-checkbox.js +14 -0
  707. package/dist/lib/scope/logical-checkbox.js.map +1 -1
  708. package/dist/lib/scope/scope-fs.d.ts.map +1 -1
  709. package/dist/lib/scope/scope-fs.js +36 -2
  710. package/dist/lib/scope/scope-fs.js.map +1 -1
  711. package/dist/mcp-server.d.ts.map +1 -1
  712. package/dist/mcp-server.js +49 -8
  713. package/dist/mcp-server.js.map +1 -1
  714. package/dist/recap-seat.d.ts +28 -0
  715. package/dist/recap-seat.d.ts.map +1 -0
  716. package/dist/recap-seat.js +41 -0
  717. package/dist/recap-seat.js.map +1 -0
  718. package/dist/seat-attention.d.ts +24 -0
  719. package/dist/seat-attention.d.ts.map +1 -0
  720. package/dist/seat-attention.js +119 -0
  721. package/dist/seat-attention.js.map +1 -0
  722. package/dist/terminal-window.d.ts.map +1 -1
  723. package/dist/terminal-window.js +3 -3
  724. package/dist/terminal-window.js.map +1 -1
  725. package/package.json +1 -1
  726. package/tui/dist/attention/attention-model.d.ts.map +1 -1
  727. package/tui/dist/attention/attention-model.js +3 -0
  728. package/tui/dist/attention/attention-model.js.map +1 -1
  729. package/tui/dist/config/config-model.d.ts.map +1 -1
  730. package/tui/dist/config/config-model.js +6 -1
  731. package/tui/dist/config/config-model.js.map +1 -1
  732. package/tui/dist/config/pairing.d.ts +49 -0
  733. package/tui/dist/config/pairing.d.ts.map +1 -0
  734. package/tui/dist/config/pairing.js +98 -0
  735. package/tui/dist/config/pairing.js.map +1 -0
  736. package/tui/dist/daemon-client.d.ts +11 -1
  737. package/tui/dist/daemon-client.d.ts.map +1 -1
  738. package/tui/dist/daemon-client.js +18 -5
  739. package/tui/dist/daemon-client.js.map +1 -1
  740. package/tui/dist/detail.d.ts +3 -0
  741. package/tui/dist/detail.d.ts.map +1 -1
  742. package/tui/dist/detail.js +6 -1
  743. package/tui/dist/detail.js.map +1 -1
  744. package/tui/dist/execution/execution-model.d.ts +2 -0
  745. package/tui/dist/execution/execution-model.d.ts.map +1 -1
  746. package/tui/dist/execution/execution-model.js +10 -3
  747. package/tui/dist/execution/execution-model.js.map +1 -1
  748. package/tui/dist/health/health-model.d.ts.map +1 -1
  749. package/tui/dist/health/health-model.js +27 -11
  750. package/tui/dist/health/health-model.js.map +1 -1
  751. package/tui/dist/hydrate.d.ts.map +1 -1
  752. package/tui/dist/hydrate.js +4 -2
  753. package/tui/dist/hydrate.js.map +1 -1
  754. package/tui/dist/main.js +6 -1
  755. package/tui/dist/main.js.map +1 -1
  756. package/tui/dist/scopes/scopes-model.d.ts +9 -0
  757. package/tui/dist/scopes/scopes-model.d.ts.map +1 -1
  758. package/tui/dist/scopes/scopes-model.js +27 -1
  759. package/tui/dist/scopes/scopes-model.js.map +1 -1
  760. package/tui/dist/state.d.ts.map +1 -1
  761. package/tui/dist/state.js +4 -3
  762. package/tui/dist/state.js.map +1 -1
  763. package/tui/dist/terminals/open-window.d.ts +21 -1
  764. package/tui/dist/terminals/open-window.d.ts.map +1 -1
  765. package/tui/dist/terminals/open-window.js +46 -9
  766. package/tui/dist/terminals/open-window.js.map +1 -1
  767. package/tui/dist/terminals/terminal-model.d.ts +8 -1
  768. package/tui/dist/terminals/terminal-model.d.ts.map +1 -1
  769. package/tui/dist/terminals/terminal-model.js +25 -8
  770. package/tui/dist/terminals/terminal-model.js.map +1 -1
  771. package/tui/dist/types.d.ts +18 -2
  772. package/tui/dist/types.d.ts.map +1 -1
@@ -101,6 +101,7 @@ export function createStuckSweepStatus() {
101
101
  lastError: null,
102
102
  consecutiveFailures: 0,
103
103
  findingsRouted: 0,
104
+ findingsOpen: 0,
104
105
  runningSince: null,
105
106
  skippedTicks: 0,
106
107
  };
@@ -110,8 +111,10 @@ export function createStuckSweepStatus() {
110
111
  state.lastOutcome = outcome;
111
112
  state.lastError = outcome === "failed" ? (detail?.error ?? "unknown error") : null;
112
113
  state.consecutiveFailures = outcome === "failed" ? state.consecutiveFailures + 1 : 0;
113
- if (detail?.findings)
114
- state.findingsRouted += detail.findings;
114
+ if (detail?.created)
115
+ state.findingsRouted += detail.created;
116
+ if (detail?.open !== undefined)
117
+ state.findingsOpen = detail.open;
115
118
  },
116
119
  pass(pass) {
117
120
  state.runningSince = pass.runningSince;
@@ -149,8 +152,10 @@ export { resolveSessionNodeId, defaultResolveOrchestrator, resolveOperatorSeat }
149
152
  * ladder live again. Unrelated transitions do not change the latest marker. */
150
153
  /** Durable custody-verification disposition: a transition note on the CLOSED source row,
151
154
  * 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.
155
+ * `custody-verified: <exact-target> <free-form how/where>`. Prefix-anchored parse; per note,
156
+ * the first whitespace-delimited word after the prefix that names one of the row's targets
157
+ * (itself or a comma member, matched exactly) is what that note verifies, so prose naming the
158
+ * successor later still verifies it while a later mention of another target doesn't (#2841).
154
159
  * Read from the ACTIVE table AND the retention archive: the daily archiver MOVES every
155
160
  * transition of an aged terminal qitem into `queue_transitions_archive` (the exact class
156
161
  * custody rows belong to) while the row itself keeps participating in this sweep, so an
@@ -158,7 +163,7 @@ export { resolveSessionNodeId, defaultResolveOrchestrator, resolveOperatorSeat }
158
163
  * the very finding the verifier already answered. The archive is never deleted, so the
159
164
  * union is the complete audit history. */
160
165
  export const CUSTODY_VERIFIED_PREFIX = "custody-verified:";
161
- function custodyVerifiedTargets(db, qitemId) {
166
+ function custodyVerifiedTargets(db, qitemId, targets) {
162
167
  const notes = db
163
168
  .prepare(`SELECT transition_note FROM queue_transitions WHERE qitem_id = ? AND transition_note LIKE ?
164
169
  UNION ALL
@@ -168,13 +173,13 @@ function custodyVerifiedTargets(db, qitemId) {
168
173
  for (const { transition_note: note } of notes) {
169
174
  if (!note)
170
175
  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
- }
176
+ for (const token of note.slice(CUSTODY_VERIFIED_PREFIX.length).trim().split(/\s+/)) {
177
+ const named = [token, ...token.split(",").map((t) => t.trim())].filter(Boolean);
178
+ if (!named.some((t) => targets.includes(t)))
179
+ continue;
180
+ for (const t of named)
181
+ verified.add(t);
182
+ break;
178
183
  }
179
184
  }
180
185
  return verified;
@@ -307,7 +312,7 @@ function legacyHumanRecipientRetained(deps, row) {
307
312
  * source's receipts and dispositions before closing an existing finding; an
308
313
  * unavailable source or an unconfirmed send supplies no resolution evidence. */
309
314
  function deliveryResolutionEvidence(deps, kind, qitemId, now) {
310
- const row = deps.queueRepo.getById(qitemId);
315
+ const row = deps.queueRepo.getById(qitemId, { waiting: false });
311
316
  if (!row)
312
317
  return null;
313
318
  if (["done", "failed", "denied", "canceled", "handed-off"].includes(row.state)) {
@@ -401,7 +406,8 @@ export function custodyHeadline(rowId, targets, ageMinutes) {
401
406
  function evidenceBody(db, c) {
402
407
  if (c.verificationTargets?.length) {
403
408
  const checks = c.verificationTargets
404
- .map((target) => `- ${target}\n ${verificationCommand(target)}`)
409
+ .map((target) => `- ${target}\n ${verificationCommand(target)}\n` +
410
+ ` rig queue update ${c.row.qitemId} --note "custody-verified: ${target} <how verified>"`)
405
411
  .join("\n");
406
412
  return (`STUCK SWEEP FINDING (successor-verification-required)\n` +
407
413
  `row: ${c.row.qitemId}\n` +
@@ -409,10 +415,11 @@ function evidenceBody(db, c) {
409
415
  `age: ${c.ageMinutes} min\n` +
410
416
  `last transition: ${lastTransitionLine(db, c.row.qitemId)}\n` +
411
417
  `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.`);
418
+ `verification targets (indeterminate until checked on the registered host), each with its check and its note:\n${checks}\n` +
419
+ `After a registered-host read confirms a target, record its note on the closed row so the sweep stops asking. ` +
420
+ `The note starts with "custody-verified:"; its first word that names one of these targets exactly is what it verifies. ` +
421
+ `Name several in one comma-list word (a,b), or write one note each.\n` +
422
+ `Do not rewrite historical custody from this local observation; the note is the separate record of the verification.`);
416
423
  }
417
424
  return (`STUCK SWEEP FINDING (${c.kind})\n` +
418
425
  `row: ${c.row.qitemId}\n` +
@@ -424,9 +431,8 @@ function evidenceBody(db, c) {
424
431
  }
425
432
  /** The last line of a standing notice's body: every row it stands for, so the sweep knows what it covered. */
426
433
  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) {
434
+ /** A standing notice's row lines: oldest first, the first ones by id, the rest counted. */
435
+ function backlogListing(rows) {
430
436
  const sorted = [...rows].sort((a, b) => a.since.localeCompare(b.since) || a.qitemId.localeCompare(b.qitemId));
431
437
  const listed = sorted.slice(0, UNCLAIMED_BACKLOG_LISTED_ROWS).map((r) => {
432
438
  const about = r.summary ? `: ${r.summary.replace(/\s+/g, " ").trim().slice(0, 120)}` : "";
@@ -434,7 +440,12 @@ function unclaimedBacklogText(seat, rows, thresholdMinutes, node) {
434
440
  });
435
441
  if (sorted.length > listed.length)
436
442
  listed.push(`- and ${sorted.length - listed.length} more`);
437
- const count = `${rows.length} ${rows.length === 1 ? "row" : "rows"}`;
443
+ return { sorted, listed, count: `${rows.length} ${rows.length === 1 ? "row" : "rows"}` };
444
+ }
445
+ /** A seat's standing unclaimed-backlog notice: its rows by id, how to list them, and how to send their findings to a seat
446
+ * that watches this one. Built only from the rows' fixed facts, so a pass rewrites it only when the rows change. */
447
+ function unclaimedBacklogText(seat, rows, thresholdMinutes, node) {
448
+ const { sorted, listed, count } = backlogListing(rows);
438
449
  const edge = node ? `rig edge add ${node.rig} ${node.logicalId} <watching seat> --kind escalates_to` : "an escalates_to edge from this seat";
439
450
  return {
440
451
  summary: `Stuck sweep: unclaimed-backlog on ${seat} (${count})`,
@@ -450,6 +461,36 @@ function unclaimedBacklogText(seat, rows, thresholdMinutes, node) {
450
461
  `${BACKLOG_ROWS_PREFIX}${JSON.stringify(sorted.map((r) => r.qitemId))}`,
451
462
  };
452
463
  }
464
+ /** A polling hosted member's standing notice: whether it's checking in (its own inbox reads), the rows it hasn't claimed,
465
+ * 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
466
+ * 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
467
+ * or that state change. */
468
+ function polledBacklogText(member, rows, thresholdMinutes, checkIn, now) {
469
+ const { sorted, listed, count } = backlogListing(rows);
470
+ const recent = checkIn.state === "seen" && now.getTime() - Date.parse(checkIn.at) <= thresholdMinutes * 60_000;
471
+ const checkIns = recent
472
+ ? `checking in: it read its own inbox within the last ${thresholdMinutes} min`
473
+ : checkIn.state === "seen"
474
+ ? `no check-in observed since ${checkIn.at}`
475
+ : checkIn.state === "never" ? "no check-in observed yet" : "unknown: its check-ins couldn't be read";
476
+ const why = recent
477
+ ? "it's checking in, but this work is still unclaimed. Check whether it can do this work, or route it to another seat"
478
+ : checkIn.state === "unknown"
479
+ ? "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"
480
+ : "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";
481
+ return {
482
+ summary: `Stuck sweep: unclaimed-backlog on ${member} (${count})`,
483
+ body: `STUCK SWEEP FINDING (unclaimed-backlog)\n` +
484
+ `member: ${member} (a hosted member with no wake trigger: it picks up work when it reads its own queue)\n` +
485
+ `check-ins: ${checkIns}\n` +
486
+ `unclaimed: ${count} (the threshold is ${thresholdMinutes} min)\n` +
487
+ `${listed.join("\n")}\n` +
488
+ `why: ${why}. This one notice stands for these rows instead of a finding per row, and follows them as they come and go.\n` +
489
+ `List them: rig queue list --destination ${member} --state pending\n` +
490
+ `The sweep closes this notice itself once every row it stands for is claimed, parked or closed.\n` +
491
+ `${BACKLOG_ROWS_PREFIX}${JSON.stringify(sorted.map((r) => r.qitemId))}`,
492
+ };
493
+ }
453
494
  /** The rows a standing notice's body says it stands for, or null when the line is missing or unreadable: unknown, which is
454
495
  * never read as "none". */
455
496
  function backlogRowsOf(body) {
@@ -464,6 +505,14 @@ function backlogRowsOf(body) {
464
505
  return null;
465
506
  }
466
507
  }
508
+ /** What a pass hands the status: the findings it created (the routed total grows only by these), and the finding
509
+ * rows still open after it. Open is read from the queue, not from the pass's actions: a finding kept open without an
510
+ * action (a live ladder suppresses its reporting, a grace holds it) is still open. */
511
+ function findingCounts(db, findings) {
512
+ const open = db.prepare(`SELECT COUNT(*) AS n FROM queue_items WHERE state IN ('pending', 'in-progress', 'blocked')
513
+ AND tags LIKE ?`).get(`%"${STUCK_SWEEP_FINDING_TAG}"%`);
514
+ return { created: findings.filter((f) => f.action === "created").length, open: open.n };
515
+ }
467
516
  /**
468
517
  * One sweep pass. Instance-wide (no rig scope — the loop is the net for every rig the
469
518
  * daemon carries). Never throws: a sweep that cannot run reports outcome=failed loudly
@@ -474,6 +523,10 @@ function backlogRowsOf(body) {
474
523
  * for its whole length (seconds on a queue of tens of thousands of rows, with healthz and every request waiting);
475
524
  * every this many rows it now lets timers and requests run. */
476
525
  export const STUCK_SWEEP_YIELD_EVERY_ROWS = 50;
526
+ /** ...or after this many milliseconds of work since the last yield, whichever comes first: a stretch of slow rows (or
527
+ * of awaited writes that resolve by microtasks alone) holds the loop no longer than this. The clock restarts after the
528
+ * yield, so the time others run during it does not count against the next stretch. */
529
+ export const STUCK_SWEEP_YIELD_AFTER_MS = 50;
477
530
  export async function runStuckSweep(deps) {
478
531
  const log = deps.log ?? ((line) => console.error(line));
479
532
  const status = deps.status;
@@ -488,16 +541,25 @@ export async function runStuckSweep(deps) {
488
541
  // tells a list read before it that its rows need a fresh read.
489
542
  let othersRan = 0;
490
543
  const othersMayHaveRun = () => { othersRan++; recoveries.invalidate(); successors?.invalidate(); };
544
+ // A successor index whose build took at least half of a stretch that yielded by elapsed time is not rebuilt for
545
+ // the rest of the pass: the yield drops it, the next stretch would pay the build again and end the same way after a
546
+ // few rows, so the rows would pay about one build each instead of one per STUCK_SWEEP_YIELD_EVERY_ROWS. Those rows
547
+ // ask their own narrow query (hasLinkedSuccessor), which costs less than a rebuilt index.
548
+ let successorsPerRow = false;
491
549
  // A synchronous read with both indexes lent to what it calls deep inside (a getById's waiting view and handoff
492
550
  // 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()));
551
+ const indexed = (fn) => recoveries.run(() => (successors && !successorsPerRow ? successors.run(fn) : fn()));
494
552
  // `if (dueToYield()) await yieldLoop();` and never a bare await per row: even an await that does not yield lets
495
553
  // queued microtasks (other requests' continuations) run and write between two rows the snapshot still covers.
496
554
  let rowsSinceYield = 0;
497
- const dueToYield = () => ++rowsSinceYield >= STUCK_SWEEP_YIELD_EVERY_ROWS;
555
+ let lastYieldAt = performance.now();
556
+ const dueToYield = () => ++rowsSinceYield >= STUCK_SWEEP_YIELD_EVERY_ROWS || performance.now() - lastYieldAt >= STUCK_SWEEP_YIELD_AFTER_MS;
498
557
  const yieldLoop = async () => {
558
+ const stretchMs = performance.now() - lastYieldAt;
559
+ successorsPerRow ||= successors !== null && stretchMs >= STUCK_SWEEP_YIELD_AFTER_MS && 2 * successors.builtMs() >= stretchMs;
499
560
  rowsSinceYield = 0;
500
561
  await new Promise((resolve) => setImmediate(resolve));
562
+ lastYieldAt = performance.now();
501
563
  othersMayHaveRun();
502
564
  };
503
565
  const suppressionMinutes = deps.ladderSuppressionMinutes ?? resolveLadderSuppressionMinutes();
@@ -549,7 +611,7 @@ export async function runStuckSweep(deps) {
549
611
  // S04 seam — a claimed row with no later motion past the pickup threshold. The
550
612
  // pickup module remains the ONE derivation rule; this only enumerates and routes.
551
613
  const stalledCandidate = (qitemId) => {
552
- const row = indexed(() => deps.queueRepo.getById(qitemId));
614
+ const row = indexed(() => deps.queueRepo.getById(qitemId, { waiting: false }));
553
615
  if (!row || isFindingRow(row))
554
616
  return null;
555
617
  if ((row.state !== "pending" && row.state !== "in-progress") || !row.claimedAt)
@@ -581,7 +643,7 @@ export async function runStuckSweep(deps) {
581
643
  if (!notice || now.getTime() - Date.parse(notice.at) <= resolvePickupThresholdMinutes() * 60_000)
582
644
  return null;
583
645
  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;
646
+ const row = binding ? indexed(() => deps.queueRepo.getById(binding.qitem_id, { waiting: false })) : null;
585
647
  if (!row || row.state !== "blocked" || deps.queueRepo.getParkWakeStatus(row.qitemId)?.ref !== jobId)
586
648
  return null;
587
649
  const response = lastMeaningfulTransition(deps.db, row.qitemId);
@@ -597,7 +659,7 @@ export async function runStuckSweep(deps) {
597
659
  // The parked policy stops repeating a positively no-input failure. Unhealthy blocked rows
598
660
  // have no retry ladder: the same sweep/recovery route owns their actionable disposition.
599
661
  const parkedCandidate = (qitemId) => {
600
- const row = indexed(() => deps.queueRepo.getById(qitemId));
662
+ const row = indexed(() => deps.queueRepo.getById(qitemId, { waiting: false }));
601
663
  if (!row || isFindingRow(row))
602
664
  return null;
603
665
  if (row.state !== "blocked" || !startsWithCI(row.lastNudgeResult, "failed:"))
@@ -627,15 +689,23 @@ export async function runStuckSweep(deps) {
627
689
  // row's own wake intent instead of reporting it: the intent is claimed and settled, so a startup drain doesn't send it
628
690
  // again, and one already in flight or settled isn't sent twice. The next tick reads the new result, so a failed send
629
691
  // 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";
692
+ // The rule is shared with the reachable-seat retry; a live retry ladder is this sweep's own check.
693
+ const wakeToRetry = (row) => deps.queueRepo.unroutableWakeRetryable(row, now)
694
+ && !hasLiveLadder(deps.db, row.qitemId, now, suppressionMinutes);
634
695
  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 ?? "");
696
+ // A hosted member with no wake trigger picks up its work by reading the queue: nothing can push work to it, by design.
697
+ // Its rows' unroutable wakes aren't failed deliveries, so they get no finding each; work it leaves unclaimed past the
698
+ // unclaimed age is listed in the member's one standing notice instead. Read once per member per pass.
699
+ const pollingMembers = new Map();
700
+ const pollsForWork = (session) => {
701
+ let polls = pollingMembers.get(session);
702
+ if (polls === undefined) {
703
+ polls = deps.queueRepo.isHostedMember(session) && deps.queueRepo.classifyDestinationOf(session).class === "unroutable";
704
+ pollingMembers.set(session, polls);
705
+ }
706
+ return polls;
707
+ };
708
+ const polledRow = (row) => !!row.lastNudgeResult?.startsWith("unroutable:") && pollsForWork(row.destinationSession);
639
709
  /** `row` comes from findUndelivered (it carries the delivery verdict). Call it after any wake retry the row needs. */
640
710
  const undeliveredCandidate = (row, recordSuppression) => {
641
711
  if (isFindingRow(row))
@@ -648,14 +718,20 @@ export async function runStuckSweep(deps) {
648
718
  return null;
649
719
  if (!humanNotice && deps.queueRepo.isLocalHumanDecisionWithoutGateway(row))
650
720
  return null;
721
+ if (!humanNotice && polledRow(row))
722
+ return null;
651
723
  const notification = humanNotice ? deps.queueRepo.transitionLog.latestOwnerNotificationForQitem(row.qitemId) : null;
652
724
  const resolutionNotice = notification?.ownerNotificationKind === "human-decision-resolved";
653
725
  // Match the notification source in slack/queue-access.ts, not the agent wake's escalator.
654
726
  const noticeOwner = row.state === "blocked" || resolutionNotice ? row.destinationSession : row.sourceSession;
655
727
  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"})`;
728
+ // Slack answered 2xx but its body couldn't be read (slack-delivery's POSSIBLY_POSTED_CLASS): it may be in Slack.
729
+ const possiblyPosted = humanNotice && /\bclass=possibly-posted\b/.test(row.deliveryFailureDetail ?? "");
730
+ const failure = possiblyPosted
731
+ ? `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`
732
+ : humanNotice
733
+ ? `human notice ${row.deliveryOutcome} to ${noticeRecipient}: ${row.deliveryFailureDetail}`
734
+ : `wake failed (${row.lastNudgeResult ?? "failed"})`;
659
735
  // Quiet hours: a held, turned-back or released ask belongs to its window's release job, so a failed wake, or a post
660
736
  // not yet made, isn't "nothing retried it". A release whose post failed is a failed delivery, and a hold with no
661
737
  // live release job is orphaned: both stay findings, with their own reason.
@@ -685,13 +761,13 @@ export async function runStuckSweep(deps) {
685
761
  : `${failure} and nothing retried it`,
686
762
  };
687
763
  };
688
- const undeliveredNow = (qitemId) => indexed(() => deps.queueRepo.findUndelivered({ qitemId }))[0];
764
+ const undeliveredNow = (qitemId) => indexed(() => deps.queueRepo.findUndelivered({ qitemId, waiting: false }))[0];
689
765
  // The A1 net — created-with-destination rows carrying real obligations, unclaimed past
690
766
  // the config-keyed age. Parks (state=blocked) legitimately wait and never appear here;
691
767
  // failed-nudge rows already surfaced in half 2; laddered rows are S01's.
692
768
  const cutoff = new Date(now.getTime() - ageMinutes * 60_000).toISOString();
693
769
  const unclaimedCandidate = (qitemId, recordSuppression) => {
694
- const row = indexed(() => deps.queueRepo.getById(qitemId));
770
+ const row = indexed(() => deps.queueRepo.getById(qitemId, { waiting: false }));
695
771
  if (!row || isFindingRow(row))
696
772
  return null;
697
773
  // The query's own predicate, on the row as it is now.
@@ -740,9 +816,24 @@ export async function runStuckSweep(deps) {
740
816
  evidenceAt: actionableAt,
741
817
  why: quiet?.state === "orphaned"
742
818
  ? `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})`,
819
+ : `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
820
  };
745
821
  };
822
+ /** The seat's activity can't be read (no reading, or one that reads unknown): said in the finding, so an unreadable
823
+ * seat isn't taken for one ignoring its work. The stalled finding says the same (`queue-pickup.ts`). A person has no
824
+ * seat to read, so their row never says so; nor does a row whose destination can't be classified, since it may be a
825
+ * person's. A classification fault never stops the sweep. */
826
+ function unreadableOwner(session) {
827
+ try {
828
+ if (deps.queueRepo.isHumanDestination(session))
829
+ return false;
830
+ }
831
+ catch {
832
+ return false;
833
+ }
834
+ const activity = deps.queueRepo.ownerActivity(session)?.activity;
835
+ return !activity || activity === "unknown";
836
+ }
746
837
  // The custody class — a terminal row whose closure names one or more successor
747
838
  // qitems or seat-address targets (closure_reason = 'handed_off_to'). A local miss is
748
839
  // never proof of absence: the successor may live in another registered host's database.
@@ -768,7 +859,7 @@ export async function runStuckSweep(deps) {
768
859
  /** `recheck`: read live without the lent indexes, and don't log the registry fallback a second time. */
769
860
  const custodyCandidate = (qitemId, hasSuccessor, recheck = false) => {
770
861
  // 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));
862
+ const row = recheck ? deps.queueRepo.getById(qitemId, { waiting: false }) : indexed(() => deps.queueRepo.getById(qitemId, { waiting: false }));
772
863
  if (!row || isFindingRow(row))
773
864
  return null;
774
865
  // The query's own predicate, on the row as it is now.
@@ -787,7 +878,7 @@ export async function runStuckSweep(deps) {
787
878
  if (targets.length === 0 && row.closureReason === "handed_off_to") {
788
879
  targets.push("(unspecified)");
789
880
  }
790
- const verified = custodyVerifiedTargets(deps.db, row.qitemId);
881
+ const verified = custodyVerifiedTargets(deps.db, row.qitemId, targets);
791
882
  const verificationTargets = targets.filter((target) => {
792
883
  if (verified.has(target))
793
884
  return false;
@@ -802,7 +893,7 @@ export async function runStuckSweep(deps) {
802
893
  }
803
894
  if (target === row.qitemId)
804
895
  return true;
805
- return !indexed(() => deps.queueRepo.getById(target));
896
+ return !indexed(() => deps.queueRepo.getById(target, { waiting: false }));
806
897
  }
807
898
  try {
808
899
  return !hasSuccessor(row.qitemId, target);
@@ -841,7 +932,7 @@ export async function runStuckSweep(deps) {
841
932
  const freshCandidate = (kind, id, jobId) => {
842
933
  switch (kind) {
843
934
  case "overdue-claim": {
844
- const row = deps.queueRepo.findOverdue({ now: nowIso, qitemId: id })[0];
935
+ const row = deps.queueRepo.findOverdue({ now: nowIso, qitemId: id, waiting: false })[0];
845
936
  return row ? overdueCandidate(row) : null;
846
937
  }
847
938
  case "stalled-after-claim": return stalledCandidate(id);
@@ -885,10 +976,10 @@ export async function runStuckSweep(deps) {
885
976
  // The rows each rule looks at. The id lists are judged on a fresh getById per row; the two finders return whole
886
977
  // rows, which are read again by id once other code may have run since the list was read.
887
978
  let listedAt = othersRan;
888
- for (const listed of indexed(() => deps.queueRepo.findOverdue({ now: nowIso }))) {
979
+ for (const listed of indexed(() => deps.queueRepo.findOverdue({ now: nowIso, waiting: false }))) {
889
980
  if (dueToYield())
890
981
  await yieldLoop();
891
- const row = listedAt !== othersRan ? indexed(() => deps.queueRepo.findOverdue({ now: nowIso, qitemId: listed.qitemId }))[0] : listed;
982
+ const row = listedAt !== othersRan ? indexed(() => deps.queueRepo.findOverdue({ now: nowIso, qitemId: listed.qitemId, waiting: false }))[0] : listed;
892
983
  const c = row ? overdueCandidate(row) : null;
893
984
  if (!c)
894
985
  continue;
@@ -927,18 +1018,18 @@ export async function runStuckSweep(deps) {
927
1018
  candidates.push(c);
928
1019
  }
929
1020
  listedAt = othersRan;
930
- for (const listed of indexed(() => deps.queueRepo.findUndelivered())) {
1021
+ for (const listed of indexed(() => deps.queueRepo.findUndelivered({ waiting: false }))) {
931
1022
  if (dueToYield())
932
1023
  await yieldLoop();
933
1024
  let row = listedAt !== othersRan ? undeliveredNow(listed.qitemId) : listed;
934
1025
  if (!row || isFindingRow(row))
935
1026
  continue;
936
- if (wakeRetryEligible(row) && wakeToRetry(row, isHumanNotice(row))) {
1027
+ if (wakeToRetry(row)) {
937
1028
  await deps.queueRepo.deliverWakeForSuccessor(row.qitemId, row.destinationSession, true, row.sourceSession);
938
1029
  othersMayHaveRun();
939
1030
  // judged again on the row as the send (and anyone else during it) left it
940
1031
  row = undeliveredNow(row.qitemId);
941
- if (!row || !startsWithCI(row.lastNudgeResult, "unroutable:"))
1032
+ if (!row?.lastNudgeResult?.startsWith("unroutable:"))
942
1033
  continue;
943
1034
  }
944
1035
  const c = undeliveredCandidate(row, true);
@@ -998,7 +1089,9 @@ export async function runStuckSweep(deps) {
998
1089
  for (const { qitem_id } of custodyRows) {
999
1090
  if (dueToYield())
1000
1091
  await yieldLoop();
1001
- const c = custodyCandidate(qitem_id, (source, target) => lookup.has(source, target));
1092
+ const c = custodyCandidate(qitem_id, successorsPerRow
1093
+ ? (source, target) => hasLinkedSuccessor(deps.db, source, target)
1094
+ : (source, target) => lookup.has(source, target));
1002
1095
  if (c)
1003
1096
  candidates.push(c);
1004
1097
  }
@@ -1040,6 +1133,22 @@ export async function runStuckSweep(deps) {
1040
1133
  // unroutable or a terminal seat itself. A bound terminal seat goes the same way: the queue wake types nothing into
1041
1134
  // it, and nothing there can claim work.
1042
1135
  const classOf = (seat) => deps.queueRepo.classifyDestinationOf(seat).class;
1136
+ /** Who hears about work for a destination that can't hear it: the index into NO_WAKE_ROUTE_RULES and the seat, or -1. */
1137
+ const noWakeRecipient = (destination, creator) => {
1138
+ const operatorSeat = (deps.resolveOperatorSeat ?? resolveOperatorSeat)();
1139
+ const person = operatorSeat && classOf(operatorSeat) === "gateway-routable" ? operatorSeat : null;
1140
+ const choices = [person, creator, (deps.resolveRecoveryAgentSeat ?? resolveRecoveryAgentSeat)()];
1141
+ const chosen = choices.findIndex((seat) => !!seat && seat !== destination && !sessionMissing(seat) && classOf(seat) !== "unroutable"
1142
+ && !isBoundTerminalSeat(deps.db, seat));
1143
+ return { chosen, seat: chosen < 0 ? null : choices[chosen] };
1144
+ };
1145
+ /** The person (the operator seat when it's a person's address) or the operator agent: recipients that may see any row. */
1146
+ const seesAnyRow = (seat) => {
1147
+ const operatorSeat = (deps.resolveOperatorSeat ?? resolveOperatorSeat)();
1148
+ if (operatorSeat === seat && classOf(seat) === "gateway-routable")
1149
+ return true;
1150
+ return (deps.resolveRecoveryAgentSeat ?? resolveRecoveryAgentSeat)() === seat;
1151
+ };
1043
1152
  const routeAroundNoWake = (c) => {
1044
1153
  if (c.route !== c.row.destinationSession)
1045
1154
  return;
@@ -1048,22 +1157,19 @@ export async function runStuckSweep(deps) {
1048
1157
  const terminalSeat = destination === "pane-bound" && isBoundTerminalSeat(deps.db, c.row.destinationSession);
1049
1158
  if (!noRoute && !terminalSeat && !(destination === "hosted" && !c.row.claimedAt))
1050
1159
  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));
1160
+ c.noWake = true;
1161
+ const recipient = noWakeRecipient(c.route, c.row.sourceSession);
1056
1162
  c.why += noRoute
1057
1163
  ? `; ${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
1164
  : terminalSeat
1059
1165
  ? `; ${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
1166
  : `; ${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) {
1167
+ if (!recipient.seat) {
1062
1168
  c.why += `. No person, creator or operator agent that can be reached is available, so this finding stays addressed to it`;
1063
1169
  return;
1064
1170
  }
1065
- c.why += `. This finding goes to ${choices[chosen]}, ${NO_WAKE_ROUTE_RULES[chosen]}`;
1066
- c.route = choices[chosen];
1171
+ c.why += `. This finding goes to ${recipient.seat}, ${NO_WAKE_ROUTE_RULES[recipient.chosen]}`;
1172
+ c.route = recipient.seat;
1067
1173
  };
1068
1174
  /** The two re-routes, in order, for one candidate. */
1069
1175
  const routeCandidate = (c) => { routeAroundMissing(c); routeAroundNoWake(c); };
@@ -1115,21 +1221,29 @@ export async function runStuckSweep(deps) {
1115
1221
  };
1116
1222
  const selfRoutedUnclaimed = (c) => c.kind === "unclaimed-obligation"
1117
1223
  && c.route === c.row.destinationSession && !routeNotes.has(c.row.qitemId) && agentSeatNode(c.route) !== null;
1224
+ // A hosted member that polls for its work (no wake trigger) can't hear a finding, so each unclaimed row went to a
1225
+ // person as a finding of its own. Those rows share one standing notice per member instead, unless a route the member
1226
+ // declares (a delegation parent or escalates_to) takes them.
1227
+ const polledUnclaimed = (c) => c.kind === "unclaimed-obligation" && c.noWake === true
1228
+ && !routeNotes.has(c.row.qitemId) && polledRow(c.row);
1229
+ /** The standing notice a candidate belongs to (the seat or member it stands for), or null for a finding of its own. */
1230
+ const backlogKeyOf = (c) => polledUnclaimed(c) ? c.row.destinationSession : selfRoutedUnclaimed(c) ? c.route : null;
1118
1231
  const unclaimedBacklog = new Map();
1119
1232
  for (const c of [...new Map(candidates.map(c => [c.row.qitemId, c])).values()]) {
1120
1233
  if (dueToYield())
1121
1234
  await yieldLoop();
1122
1235
  const dedupTag = findingDedupTag(c.kind, c.row.qitemId);
1123
1236
  const shared = recoveries.find(c.row.qitemId);
1124
- if (!shared && selfRoutedUnclaimed(c)) {
1125
- const rows = unclaimedBacklog.get(c.route);
1237
+ const backlogKey = shared ? null : backlogKeyOf(c);
1238
+ if (backlogKey) {
1239
+ const rows = unclaimedBacklog.get(backlogKey);
1126
1240
  if (rows)
1127
1241
  rows.push(c);
1128
1242
  else
1129
- unclaimedBacklog.set(c.route, [c]);
1243
+ unclaimedBacklog.set(backlogKey, [c]);
1130
1244
  continue;
1131
1245
  }
1132
- const sharedRow = shared ? indexed(() => deps.queueRepo.getById(shared.qitemId)) : null;
1246
+ const sharedRow = shared ? indexed(() => deps.queueRepo.getById(shared.qitemId, { waiting: false })) : null;
1133
1247
  // A later accepted deadline can expire after the previous finding closed.
1134
1248
  // Its newer time is fresh evidence even when the pickup candidate wins this row.
1135
1249
  // An OPEN recovery still owns custody.
@@ -1204,7 +1318,8 @@ export async function runStuckSweep(deps) {
1204
1318
  : `Stuck sweep: ${c.kind} on ${c.row.qitemId} (${now_.ageMinutes} min)`,
1205
1319
  evidenceRef: `rig queue show ${c.row.qitemId}`,
1206
1320
  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] : [])],
1321
+ ...(routed.has(c.row.qitemId) || now_.row.tags?.includes(ESCALATION_HOP_TAG) ? [ESCALATION_HOP_TAG] : []),
1322
+ ...(now_.row.tags ?? []).filter((tag) => /^(project|mission|slice):/.test(tag))],
1208
1323
  // OpenRig's own finding, whoever created the stuck row.
1209
1324
  wakeTrigger: "openrig",
1210
1325
  };
@@ -1246,10 +1361,48 @@ export async function runStuckSweep(deps) {
1246
1361
  const tag = unclaimedBacklogTag(seat);
1247
1362
  liveDedupTags.add(tag);
1248
1363
  const node = agentSeatNode(seat);
1364
+ // A polling member's notice says whether it's checking in; an agent seat's names the route to add instead.
1365
+ const polled = rows.length > 0 ? rows.some(polledUnclaimed) : pollsForWork(seat);
1366
+ const backlogText = (standsFor) => polled
1367
+ ? polledBacklogText(seat, standsFor, ageMinutes, deps.queueRepo.lastInboxCheckIn(seat), now)
1368
+ : unclaimedBacklogText(seat, standsFor, ageMinutes, node);
1369
+ // A polling member's notice goes where its rows' findings went: the person, else their creator when they share one,
1370
+ // else the operator agent. With none, it stays with the member, which reads it when it next checks.
1371
+ const recipientFor = (creators) => {
1372
+ if (!polled)
1373
+ return seat;
1374
+ const distinct = [...new Set(creators)];
1375
+ return noWakeRecipient(seat, distinct.length === 1 ? distinct[0] : null).seat ?? seat;
1376
+ };
1377
+ /** Files a notice and wakes its recipient; false when the create failed (reported in failedCreates). */
1378
+ const fileNotice = async (text, recipient) => {
1379
+ try {
1380
+ const created = await deps.queueRepo.create({
1381
+ // A notice about a seat's own rows comes from that seat, as a restore notice does; OpenRig wakes its recipient.
1382
+ sourceSession: seat,
1383
+ destinationSession: recipient,
1384
+ body: text.body,
1385
+ summary: text.summary,
1386
+ evidenceRef: `rig queue list --destination ${seat} --state pending`,
1387
+ tags: [STUCK_SWEEP_FINDING_TAG, tag],
1388
+ wakeTrigger: "openrig",
1389
+ });
1390
+ othersMayHaveRun();
1391
+ findings.push({ kind: "unclaimed-backlog", qitemId: seat, findingQitemId: created.qitemId, action: "created" });
1392
+ return true;
1393
+ }
1394
+ catch (err) {
1395
+ const message = `unclaimed-backlog notice for ${seat} not created: ${err instanceof Error ? err.message : String(err)}`;
1396
+ othersMayHaveRun();
1397
+ log(`[stuck-sweep] ${message}`);
1398
+ failedCreates.push(message);
1399
+ return false;
1400
+ }
1401
+ };
1249
1402
  const last = deps.db
1250
1403
  .prepare(
1251
1404
  // 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
1405
+ `SELECT qitem_id, state, ts_updated, summary, body, destination_session FROM queue_items
1253
1406
  WHERE (tags LIKE '%"stuck-sweep:%') AND tags LIKE ? ESCAPE '\\'
1254
1407
  ORDER BY CASE WHEN state IN ('pending', 'in-progress', 'blocked') THEN 0 ELSE 1 END,
1255
1408
  ts_updated DESC, ts_created DESC, qitem_id DESC
@@ -1259,7 +1412,7 @@ export async function runStuckSweep(deps) {
1259
1412
  const listedNow = new Set(rows.map((c) => c.row.qitemId));
1260
1413
  const stoodFor = backlogRowsOf(last.body);
1261
1414
  const still = [...(stoodFor ?? [])].filter((id) => !listedNow.has(id)).flatMap((id) => {
1262
- const row = indexed(() => deps.queueRepo.getById(id));
1415
+ const row = indexed(() => deps.queueRepo.getById(id, { waiting: false }));
1263
1416
  // Gone, someone else's now, resolved at its source, or held by a finding or recovery of its own: one actually
1264
1417
  // written, so a create that failed this pass leaves the row here.
1265
1418
  if (!row || row.destinationSession !== seat || recoveries.find(id)
@@ -1285,7 +1438,28 @@ export async function runStuckSweep(deps) {
1285
1438
  findings.push({ kind: "unclaimed-backlog", qitemId: seat, findingQitemId: last.qitem_id, action: "closed" });
1286
1439
  continue;
1287
1440
  }
1288
- const text = unclaimedBacklogText(seat, standsFor, ageMinutes, node);
1441
+ // A notice that went to one of its rows' creators (no person reachable) shows that creator only rows it sent. When a
1442
+ // row from anyone else would join it, one notice for every row it stands for goes where a new notice would go now,
1443
+ // which wakes that recipient, and only then does this one close: a notice the sweep closed holds its rows back, so a
1444
+ // failed create leaves it open as it was (not rewritten), and the next pass tries again. A person, the operator
1445
+ // agent and the member see any of the rows.
1446
+ if (polled && last.destination_session !== seat && !seesAnyRow(last.destination_session)
1447
+ && standsFor.some((r) => r.from !== last.destination_session)) {
1448
+ const recipient = recipientFor(standsFor.map((r) => r.from));
1449
+ if (!(await fileNotice(backlogText(standsFor), recipient)))
1450
+ continue;
1451
+ await deps.queueRepo.update({
1452
+ qitemId: last.qitem_id,
1453
+ actorSession: "stuck-sweep@system",
1454
+ state: "done",
1455
+ closureReason: "no-follow-on",
1456
+ 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}`,
1457
+ });
1458
+ othersMayHaveRun();
1459
+ findings.push({ kind: "unclaimed-backlog", qitemId: seat, findingQitemId: last.qitem_id, action: "closed" });
1460
+ continue;
1461
+ }
1462
+ const text = backlogText(standsFor);
1289
1463
  if (text.summary !== last.summary || text.body !== last.body) {
1290
1464
  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
1465
  .run(text.body, text.summary, last.qitem_id, last.body, last.summary);
@@ -1302,7 +1476,7 @@ export async function runStuckSweep(deps) {
1302
1476
  const now_ = freshCandidate(c.kind, c.row.qitemId);
1303
1477
  if (now_)
1304
1478
  routeCandidate(now_);
1305
- return now_ && selfRoutedUnclaimed(now_) && now_.route === seat && !recoveries.find(now_.row.qitemId) ? [now_] : [];
1479
+ return now_ && backlogKeyOf(now_) === seat && !recoveries.find(now_.row.qitemId) ? [now_] : [];
1306
1480
  });
1307
1481
  if (current.length === 0)
1308
1482
  continue;
@@ -1310,27 +1484,7 @@ export async function runStuckSweep(deps) {
1310
1484
  const covered = last ? backlogRowsOf(last.body) : null;
1311
1485
  if (last && !current.some((c) => (covered !== null && !covered.has(c.row.qitemId)) || evidenceIsNewer(c.evidenceAt, last.ts_updated)))
1312
1486
  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
- }
1487
+ await fileNotice(backlogText(current.map(backlogRow)), recipientFor(current.map((c) => c.row.sourceSession)));
1334
1488
  }
1335
1489
  // Resolution: an open finding whose underlying condition is no longer detected closes
1336
1490
  // with its reason — the sweep cleans up after itself, no human unwind.
@@ -1360,7 +1514,7 @@ export async function runStuckSweep(deps) {
1360
1514
  continue;
1361
1515
  // #2661: a claim working only on a grace (a background shell, a pending managed restore) is not resolved: the
1362
1516
  // 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)
1517
+ if (kind === "stalled-after-claim" && stuckId && deps.queueRepo.getById(stuckId, { waiting: false })?.pickup?.grace)
1364
1518
  continue;
1365
1519
  let resolution = "no longer detected";
1366
1520
  if (stuckId && (kind === "undelivered-wake" || kind === "undelivered-human-notice" || kind === "unclaimed-obligation")) {
@@ -1401,11 +1555,11 @@ export async function runStuckSweep(deps) {
1401
1555
  if (failedCreates.length > 0) {
1402
1556
  // Not a clean or complete pass: say so, while keeping the findings that were made.
1403
1557
  const error = failedCreates.join("; ");
1404
- status?.record("failed", { error, findings: findings.filter((f) => f.action !== "closed").length });
1558
+ status?.record("failed", { error, ...findingCounts(deps.db, findings) });
1405
1559
  return { outcome: "failed", findings, error };
1406
1560
  }
1407
1561
  const outcome = findings.length > 0 ? "findings" : "clean";
1408
- status?.record(outcome, { findings: findings.filter((f) => f.action !== "closed").length });
1562
+ status?.record(outcome, findingCounts(deps.db, findings));
1409
1563
  return { outcome, findings };
1410
1564
  }
1411
1565
  catch (err) {