@openrig/cli 0.7.22 → 0.7.24

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 (1187) hide show
  1. package/README.md +7 -7
  2. package/daemon/assets/claude-hook-bridge.cjs +575 -6
  3. package/daemon/assets/claude-hook-bridge.d.cts +5 -0
  4. package/daemon/assets/claude-permission-policies.cjs +4 -3
  5. package/daemon/assets/guidance/openrig-context-entry.md +1 -0
  6. package/daemon/assets/onboarding/01-world-and-purpose.md +2 -1
  7. package/daemon/assets/onboarding/02-self-and-competent-action.md +6 -0
  8. package/daemon/assets/plugins/openrig/.claude-plugin/plugin.json +4 -3
  9. package/daemon/assets/plugins/openrig/.codex-plugin/plugin.json +3 -2
  10. package/daemon/assets/plugins/openrig/.cursor-plugin/plugin.json +1 -1
  11. package/daemon/assets/plugins/openrig/README.md +64 -9
  12. package/daemon/assets/plugins/openrig/hooks/claude.json +39 -0
  13. package/daemon/assets/plugins/openrig/hooks/codex.json +27 -0
  14. package/daemon/assets/plugins/openrig/hooks/scripts/claude-hook-bridge.cjs +715 -0
  15. package/daemon/assets/plugins/openrig/plugin.json +1 -1
  16. package/daemon/assets/plugins/openrig/scripts/run-rig.cjs +30 -0
  17. package/daemon/assets/plugins/openrig/skills/working-with-an-openrig-team/SKILL.md +71 -9
  18. package/daemon/assets/plugins/openrig-codex/.agents/plugins/marketplace.json +15 -0
  19. package/daemon/assets/plugins/openrig-codex/.codex-plugin/plugin.json +42 -0
  20. package/daemon/assets/plugins/openrig-codex/LICENSE +200 -0
  21. package/daemon/assets/plugins/openrig-codex/assets/logo.svg +1 -0
  22. package/daemon/assets/plugins/openrig-codex/hooks/codex.json +27 -0
  23. package/daemon/assets/plugins/openrig-codex/hooks/scripts/claude-hook-bridge.cjs +715 -0
  24. package/daemon/assets/plugins/openrig-codex/skills/working-with-an-openrig-team/SKILL.md +175 -0
  25. package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +1 -1
  26. package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
  27. package/daemon/assets/plugins/openrig-core/README.md +10 -2
  28. package/daemon/assets/plugins/openrig-core/hooks/claude.json +9 -0
  29. package/daemon/assets/plugins/openrig-core/hooks/scripts/activity-relay.cjs +50 -0
  30. package/daemon/assets/plugins/openrig-core/hooks/scripts/compaction-restore-bridge.cjs +3 -1
  31. package/daemon/assets/plugins/openrig-core/hooks/scripts/permission-answer.cjs +270 -0
  32. package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus.cjs +24 -6
  33. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/precompact-hook.mjs +11 -8
  34. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/restore-from-jsonl.mjs +76 -10
  35. package/daemon/assets/plugins/openrig-core/skills/messaging-the-human/SKILL.md +1 -1
  36. package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +4 -2
  37. package/daemon/assets/plugins/openrig-core/skills/refocusing/scripts/trace-to-root.py +191 -25
  38. package/daemon/assets/skills/rigs/SKILL.md +136 -26
  39. package/daemon/context-packs/help/manifest.yaml +1 -1
  40. package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
  41. package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +128 -18
  42. package/daemon/context-packs/reference/acp-agents.md +11 -3
  43. package/daemon/context-packs/reference/getting-started.md +144 -13
  44. package/daemon/context-packs/reference/manifest.yaml +1 -1
  45. package/daemon/context-packs/reference/rig-spec.md +201 -3
  46. package/daemon/context-packs/reference/tmux-servers.md +43 -2
  47. package/daemon/context-packs/reference/whats-new.md +186 -12
  48. package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
  49. package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
  50. package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
  51. package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
  52. package/daemon/context-packs/skills/claude-compaction-restore/scripts/precompact-hook.mjs +11 -8
  53. package/daemon/context-packs/skills/claude-compaction-restore/scripts/restore-from-jsonl.mjs +76 -10
  54. package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
  55. package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
  56. package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
  57. package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
  58. package/daemon/context-packs/skills/core/messaging-the-human/SKILL.md +1 -1
  59. package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +3 -3
  60. package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
  61. package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
  62. package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
  63. package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
  64. package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
  65. package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
  66. package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
  67. package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
  68. package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
  69. package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
  70. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
  71. package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
  72. package/daemon/context-packs/skills/core/working-with-an-openrig-team/SKILL.md +71 -9
  73. package/daemon/context-packs/skills/core/working-with-an-openrig-team/manifest.yaml +1 -1
  74. package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
  75. package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
  76. package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
  77. package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
  78. package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
  79. package/daemon/context-packs/skills/openrig-user/SKILL.md +4 -2
  80. package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
  81. package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
  82. package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
  83. package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
  84. package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
  85. package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
  86. package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
  87. package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
  88. package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
  89. package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
  90. package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
  91. package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
  92. package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
  93. package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
  94. package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
  95. package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
  96. package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
  97. package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
  98. package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
  99. package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
  100. package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
  101. package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
  102. package/daemon/context-packs/skills/refocusing/scripts/trace-to-root.py +191 -25
  103. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
  104. package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
  105. package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
  106. package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
  107. package/daemon/context-packs/world-example/manifest.yaml +1 -1
  108. package/daemon/context-packs/world-public/manifest.yaml +1 -1
  109. package/daemon/dist/adapters/claude-code-adapter.d.ts +24 -2
  110. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  111. package/daemon/dist/adapters/claude-code-adapter.js +312 -45
  112. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  113. package/daemon/dist/adapters/claude-resume-launch.d.ts +3 -0
  114. package/daemon/dist/adapters/claude-resume-launch.d.ts.map +1 -1
  115. package/daemon/dist/adapters/claude-resume-launch.js +5 -0
  116. package/daemon/dist/adapters/claude-resume-launch.js.map +1 -1
  117. package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
  118. package/daemon/dist/adapters/claude-resume.js +66 -24
  119. package/daemon/dist/adapters/claude-resume.js.map +1 -1
  120. package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts +22 -0
  121. package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts.map +1 -1
  122. package/daemon/dist/adapters/community-harness-runtime-adapter.js +72 -20
  123. package/daemon/dist/adapters/community-harness-runtime-adapter.js.map +1 -1
  124. package/daemon/dist/adapters/pi-community-runtime-adapter.d.ts +9 -0
  125. package/daemon/dist/adapters/pi-community-runtime-adapter.d.ts.map +1 -1
  126. package/daemon/dist/adapters/pi-community-runtime-adapter.js +6 -0
  127. package/daemon/dist/adapters/pi-community-runtime-adapter.js.map +1 -1
  128. package/daemon/dist/adapters/pi-runtime-adapter.d.ts +3 -0
  129. package/daemon/dist/adapters/pi-runtime-adapter.d.ts.map +1 -1
  130. package/daemon/dist/adapters/pi-runtime-adapter.js +9 -3
  131. package/daemon/dist/adapters/pi-runtime-adapter.js.map +1 -1
  132. package/daemon/dist/adapters/seat-slice.d.ts +19 -0
  133. package/daemon/dist/adapters/seat-slice.d.ts.map +1 -0
  134. package/daemon/dist/adapters/seat-slice.js +29 -0
  135. package/daemon/dist/adapters/seat-slice.js.map +1 -0
  136. package/daemon/dist/adapters/shell-quote.d.ts +1 -0
  137. package/daemon/dist/adapters/shell-quote.d.ts.map +1 -1
  138. package/daemon/dist/adapters/shell-quote.js +6 -0
  139. package/daemon/dist/adapters/shell-quote.js.map +1 -1
  140. package/daemon/dist/adapters/tmux.d.ts +84 -17
  141. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  142. package/daemon/dist/adapters/tmux.js +355 -78
  143. package/daemon/dist/adapters/tmux.js.map +1 -1
  144. package/daemon/dist/build-info.js +3 -3
  145. package/daemon/dist/conversation-key-surface.d.ts +2 -0
  146. package/daemon/dist/conversation-key-surface.d.ts.map +1 -0
  147. package/daemon/dist/conversation-key-surface.js +5 -0
  148. package/daemon/dist/conversation-key-surface.js.map +1 -0
  149. package/daemon/dist/daemon-shutdown.d.ts +8 -0
  150. package/daemon/dist/daemon-shutdown.d.ts.map +1 -1
  151. package/daemon/dist/daemon-shutdown.js +15 -2
  152. package/daemon/dist/daemon-shutdown.js.map +1 -1
  153. package/daemon/dist/db/all-migrations.d.ts.map +1 -1
  154. package/daemon/dist/db/all-migrations.js +32 -0
  155. package/daemon/dist/db/all-migrations.js.map +1 -1
  156. package/daemon/dist/db/migrate.d.ts +15 -1
  157. package/daemon/dist/db/migrate.d.ts.map +1 -1
  158. package/daemon/dist/db/migrate.js +41 -6
  159. package/daemon/dist/db/migrate.js.map +1 -1
  160. package/daemon/dist/db/migrations/179_community_harness_runtime_switches.d.ts +14 -0
  161. package/daemon/dist/db/migrations/179_community_harness_runtime_switches.d.ts.map +1 -0
  162. package/daemon/dist/db/migrations/179_community_harness_runtime_switches.js +54 -0
  163. package/daemon/dist/db/migrations/179_community_harness_runtime_switches.js.map +1 -0
  164. package/daemon/dist/db/migrations/179_remote_control_observations.d.ts +10 -0
  165. package/daemon/dist/db/migrations/179_remote_control_observations.d.ts.map +1 -0
  166. package/daemon/dist/db/migrations/179_remote_control_observations.js +20 -0
  167. package/daemon/dist/db/migrations/179_remote_control_observations.js.map +1 -0
  168. package/daemon/dist/db/migrations/180_session_stop_attempt.d.ts +5 -0
  169. package/daemon/dist/db/migrations/180_session_stop_attempt.d.ts.map +1 -0
  170. package/daemon/dist/db/migrations/180_session_stop_attempt.js +7 -0
  171. package/daemon/dist/db/migrations/180_session_stop_attempt.js.map +1 -0
  172. package/daemon/dist/db/migrations/181_node_keep_alive.d.ts +8 -0
  173. package/daemon/dist/db/migrations/181_node_keep_alive.d.ts.map +1 -0
  174. package/daemon/dist/db/migrations/181_node_keep_alive.js +26 -0
  175. package/daemon/dist/db/migrations/181_node_keep_alive.js.map +1 -0
  176. package/daemon/dist/db/migrations/182_queue_items_blocked_on_index.d.ts +7 -0
  177. package/daemon/dist/db/migrations/182_queue_items_blocked_on_index.d.ts.map +1 -0
  178. package/daemon/dist/db/migrations/182_queue_items_blocked_on_index.js +11 -0
  179. package/daemon/dist/db/migrations/182_queue_items_blocked_on_index.js.map +1 -0
  180. package/daemon/dist/db/migrations/183_queue_items_scan_indexes.d.ts +8 -0
  181. package/daemon/dist/db/migrations/183_queue_items_scan_indexes.d.ts.map +1 -0
  182. package/daemon/dist/db/migrations/183_queue_items_scan_indexes.js +13 -0
  183. package/daemon/dist/db/migrations/183_queue_items_scan_indexes.js.map +1 -0
  184. package/daemon/dist/db/migrations/184_network_requests.d.ts +11 -0
  185. package/daemon/dist/db/migrations/184_network_requests.d.ts.map +1 -0
  186. package/daemon/dist/db/migrations/184_network_requests.js +32 -0
  187. package/daemon/dist/db/migrations/184_network_requests.js.map +1 -0
  188. package/daemon/dist/db/migrations/185_seat_cold_starts.d.ts +9 -0
  189. package/daemon/dist/db/migrations/185_seat_cold_starts.d.ts.map +1 -0
  190. package/daemon/dist/db/migrations/185_seat_cold_starts.js +19 -0
  191. package/daemon/dist/db/migrations/185_seat_cold_starts.js.map +1 -0
  192. package/daemon/dist/db/migrations/186_queue_relayed_answers.d.ts +3 -0
  193. package/daemon/dist/db/migrations/186_queue_relayed_answers.d.ts.map +1 -0
  194. package/daemon/dist/db/migrations/186_queue_relayed_answers.js +5 -0
  195. package/daemon/dist/db/migrations/186_queue_relayed_answers.js.map +1 -0
  196. package/daemon/dist/db/migrations/189_rig_seat_slice.d.ts +5 -0
  197. package/daemon/dist/db/migrations/189_rig_seat_slice.d.ts.map +1 -0
  198. package/daemon/dist/db/migrations/189_rig_seat_slice.js +7 -0
  199. package/daemon/dist/db/migrations/189_rig_seat_slice.js.map +1 -0
  200. package/daemon/dist/db/migrations/190_queue_transfer_staging.d.ts +3 -0
  201. package/daemon/dist/db/migrations/190_queue_transfer_staging.d.ts.map +1 -0
  202. package/daemon/dist/db/migrations/190_queue_transfer_staging.js +20 -0
  203. package/daemon/dist/db/migrations/190_queue_transfer_staging.js.map +1 -0
  204. package/daemon/dist/db/migrations/191_network_binding_providers.d.ts +3 -0
  205. package/daemon/dist/db/migrations/191_network_binding_providers.d.ts.map +1 -0
  206. package/daemon/dist/db/migrations/191_network_binding_providers.js +27 -0
  207. package/daemon/dist/db/migrations/191_network_binding_providers.js.map +1 -0
  208. package/daemon/dist/db/migrations/194_workflow_run_title.d.ts +4 -0
  209. package/daemon/dist/db/migrations/194_workflow_run_title.d.ts.map +1 -0
  210. package/daemon/dist/db/migrations/194_workflow_run_title.js +6 -0
  211. package/daemon/dist/db/migrations/194_workflow_run_title.js.map +1 -0
  212. package/daemon/dist/db/migrations/195_workflow_start_operations.d.ts +4 -0
  213. package/daemon/dist/db/migrations/195_workflow_start_operations.d.ts.map +1 -0
  214. package/daemon/dist/db/migrations/195_workflow_start_operations.js +13 -0
  215. package/daemon/dist/db/migrations/195_workflow_start_operations.js.map +1 -0
  216. package/daemon/dist/db/migrations/196_queue_item_evidence_ref_roots.d.ts +5 -0
  217. package/daemon/dist/db/migrations/196_queue_item_evidence_ref_roots.d.ts.map +1 -0
  218. package/daemon/dist/db/migrations/196_queue_item_evidence_ref_roots.js +7 -0
  219. package/daemon/dist/db/migrations/196_queue_item_evidence_ref_roots.js.map +1 -0
  220. package/daemon/dist/db/migrations/199_queue_items_native_permission_index.d.ts +9 -0
  221. package/daemon/dist/db/migrations/199_queue_items_native_permission_index.d.ts.map +1 -0
  222. package/daemon/dist/db/migrations/199_queue_items_native_permission_index.js +14 -0
  223. package/daemon/dist/db/migrations/199_queue_items_native_permission_index.js.map +1 -0
  224. package/daemon/dist/domain/activity-taxonomy.d.ts +3 -0
  225. package/daemon/dist/domain/activity-taxonomy.d.ts.map +1 -1
  226. package/daemon/dist/domain/activity-taxonomy.js.map +1 -1
  227. package/daemon/dist/domain/agent-activity-store.d.ts +17 -0
  228. package/daemon/dist/domain/agent-activity-store.d.ts.map +1 -1
  229. package/daemon/dist/domain/agent-activity-store.js +101 -45
  230. package/daemon/dist/domain/agent-activity-store.js.map +1 -1
  231. package/daemon/dist/domain/agent-manifest.d.ts.map +1 -1
  232. package/daemon/dist/domain/agent-manifest.js +14 -0
  233. package/daemon/dist/domain/agent-manifest.js.map +1 -1
  234. package/daemon/dist/domain/background-process-evidence.d.ts +23 -0
  235. package/daemon/dist/domain/background-process-evidence.d.ts.map +1 -0
  236. package/daemon/dist/domain/background-process-evidence.js +81 -0
  237. package/daemon/dist/domain/background-process-evidence.js.map +1 -0
  238. package/daemon/dist/domain/chat-repository.d.ts +1 -1
  239. package/daemon/dist/domain/chat-repository.d.ts.map +1 -1
  240. package/daemon/dist/domain/chat-repository.js +2 -2
  241. package/daemon/dist/domain/chat-repository.js.map +1 -1
  242. package/daemon/dist/domain/claude-compaction-enforcer.d.ts +46 -8
  243. package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
  244. package/daemon/dist/domain/claude-compaction-enforcer.js +66 -20
  245. package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
  246. package/daemon/dist/domain/codex-member-permissions.d.ts +35 -0
  247. package/daemon/dist/domain/codex-member-permissions.d.ts.map +1 -1
  248. package/daemon/dist/domain/codex-member-permissions.js +106 -1
  249. package/daemon/dist/domain/codex-member-permissions.js.map +1 -1
  250. package/daemon/dist/domain/community-harness-presets.d.ts +9 -0
  251. package/daemon/dist/domain/community-harness-presets.d.ts.map +1 -1
  252. package/daemon/dist/domain/community-harness-presets.js +25 -1
  253. package/daemon/dist/domain/community-harness-presets.js.map +1 -1
  254. package/daemon/dist/domain/compaction-restore-notice.d.ts +12 -1
  255. package/daemon/dist/domain/compaction-restore-notice.d.ts.map +1 -1
  256. package/daemon/dist/domain/compaction-restore-notice.js +130 -2
  257. package/daemon/dist/domain/compaction-restore-notice.js.map +1 -1
  258. package/daemon/dist/domain/continuity-policy-materializer.d.ts.map +1 -1
  259. package/daemon/dist/domain/continuity-policy-materializer.js +11 -3
  260. package/daemon/dist/domain/continuity-policy-materializer.js.map +1 -1
  261. package/daemon/dist/domain/core-app-job.d.ts +4 -4
  262. package/daemon/dist/domain/core-app-job.d.ts.map +1 -1
  263. package/daemon/dist/domain/core-app-job.js +4 -59
  264. package/daemon/dist/domain/core-app-job.js.map +1 -1
  265. package/daemon/dist/domain/current-work.d.ts +43 -4
  266. package/daemon/dist/domain/current-work.d.ts.map +1 -1
  267. package/daemon/dist/domain/current-work.js +52 -3
  268. package/daemon/dist/domain/current-work.js.map +1 -1
  269. package/daemon/dist/domain/escalation-owner.d.ts +3 -0
  270. package/daemon/dist/domain/escalation-owner.d.ts.map +1 -1
  271. package/daemon/dist/domain/escalation-owner.js +9 -3
  272. package/daemon/dist/domain/escalation-owner.js.map +1 -1
  273. package/daemon/dist/domain/execution-candidate-reader.d.ts +3 -0
  274. package/daemon/dist/domain/execution-candidate-reader.d.ts.map +1 -1
  275. package/daemon/dist/domain/execution-candidate-reader.js +8 -2
  276. package/daemon/dist/domain/execution-candidate-reader.js.map +1 -1
  277. package/daemon/dist/domain/existing-rig-restore.d.ts +2 -0
  278. package/daemon/dist/domain/existing-rig-restore.d.ts.map +1 -1
  279. package/daemon/dist/domain/existing-rig-restore.js +11 -1
  280. package/daemon/dist/domain/existing-rig-restore.js.map +1 -1
  281. package/daemon/dist/domain/feed/attention-aggregator.d.ts +5 -5
  282. package/daemon/dist/domain/feed/attention-aggregator.d.ts.map +1 -1
  283. package/daemon/dist/domain/feed/attention-aggregator.js +10 -4
  284. package/daemon/dist/domain/feed/attention-aggregator.js.map +1 -1
  285. package/daemon/dist/domain/files/path-safety.d.ts +7 -0
  286. package/daemon/dist/domain/files/path-safety.d.ts.map +1 -1
  287. package/daemon/dist/domain/files/path-safety.js +23 -0
  288. package/daemon/dist/domain/files/path-safety.js.map +1 -1
  289. package/daemon/dist/domain/frontmatter.d.ts.map +1 -1
  290. package/daemon/dist/domain/frontmatter.js +4 -2
  291. package/daemon/dist/domain/frontmatter.js.map +1 -1
  292. package/daemon/dist/domain/gateway/destination-resolver.d.ts +3 -0
  293. package/daemon/dist/domain/gateway/destination-resolver.d.ts.map +1 -1
  294. package/daemon/dist/domain/gateway/destination-resolver.js +9 -0
  295. package/daemon/dist/domain/gateway/destination-resolver.js.map +1 -1
  296. package/daemon/dist/domain/gateway/human-quiet-windows.d.ts.map +1 -1
  297. package/daemon/dist/domain/gateway/human-quiet-windows.js +2 -1
  298. package/daemon/dist/domain/gateway/human-quiet-windows.js.map +1 -1
  299. package/daemon/dist/domain/gateway/slack/inbound.d.ts +6 -1
  300. package/daemon/dist/domain/gateway/slack/inbound.d.ts.map +1 -1
  301. package/daemon/dist/domain/gateway/slack/inbound.js +53 -9
  302. package/daemon/dist/domain/gateway/slack/inbound.js.map +1 -1
  303. package/daemon/dist/domain/gateway/slack/message.d.ts +4 -4
  304. package/daemon/dist/domain/gateway/slack/message.d.ts.map +1 -1
  305. package/daemon/dist/domain/gateway/slack/message.js +20 -7
  306. package/daemon/dist/domain/gateway/slack/message.js.map +1 -1
  307. package/daemon/dist/domain/gateway/slack/outbound-driver.d.ts +4 -0
  308. package/daemon/dist/domain/gateway/slack/outbound-driver.d.ts.map +1 -1
  309. package/daemon/dist/domain/gateway/slack/outbound-driver.js +1 -0
  310. package/daemon/dist/domain/gateway/slack/outbound-driver.js.map +1 -1
  311. package/daemon/dist/domain/gateway/slack/queue-access.d.ts +9 -1
  312. package/daemon/dist/domain/gateway/slack/queue-access.d.ts.map +1 -1
  313. package/daemon/dist/domain/gateway/slack/queue-access.js +2 -0
  314. package/daemon/dist/domain/gateway/slack/queue-access.js.map +1 -1
  315. package/daemon/dist/domain/gateway/slack/settled-asks.d.ts.map +1 -1
  316. package/daemon/dist/domain/gateway/slack/settled-asks.js +15 -2
  317. package/daemon/dist/domain/gateway/slack/settled-asks.js.map +1 -1
  318. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts +10 -19
  319. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts.map +1 -1
  320. package/daemon/dist/domain/gateway/slack/slack-delivery.js +64 -40
  321. package/daemon/dist/domain/gateway/slack/slack-delivery.js.map +1 -1
  322. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts +3 -13
  323. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
  324. package/daemon/dist/domain/gateway/slack/slack-subsystem.js +70 -22
  325. package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
  326. package/daemon/dist/domain/harness-not-started-notice.d.ts +5 -2
  327. package/daemon/dist/domain/harness-not-started-notice.d.ts.map +1 -1
  328. package/daemon/dist/domain/harness-not-started-notice.js +46 -15
  329. package/daemon/dist/domain/harness-not-started-notice.js.map +1 -1
  330. package/daemon/dist/domain/health-detectors.d.ts +4 -0
  331. package/daemon/dist/domain/health-detectors.d.ts.map +1 -1
  332. package/daemon/dist/domain/health-detectors.js +4 -1
  333. package/daemon/dist/domain/health-detectors.js.map +1 -1
  334. package/daemon/dist/domain/health-diagnosis.d.ts.map +1 -1
  335. package/daemon/dist/domain/health-diagnosis.js +14 -9
  336. package/daemon/dist/domain/health-diagnosis.js.map +1 -1
  337. package/daemon/dist/domain/health-passive-ceremony.d.ts +2 -0
  338. package/daemon/dist/domain/health-passive-ceremony.d.ts.map +1 -1
  339. package/daemon/dist/domain/health-passive-ceremony.js +71 -13
  340. package/daemon/dist/domain/health-passive-ceremony.js.map +1 -1
  341. package/daemon/dist/domain/history-query.d.ts +1 -1
  342. package/daemon/dist/domain/history-query.d.ts.map +1 -1
  343. package/daemon/dist/domain/history-query.js +1 -2
  344. package/daemon/dist/domain/history-query.js.map +1 -1
  345. package/daemon/dist/domain/hosts/read-through.d.ts +1 -1
  346. package/daemon/dist/domain/hosts/read-through.d.ts.map +1 -1
  347. package/daemon/dist/domain/hosts/read-through.js +9 -2
  348. package/daemon/dist/domain/hosts/read-through.js.map +1 -1
  349. package/daemon/dist/domain/hot-potato-enforcer.d.ts +3 -3
  350. package/daemon/dist/domain/hot-potato-enforcer.d.ts.map +1 -1
  351. package/daemon/dist/domain/hot-potato-enforcer.js +2 -2
  352. package/daemon/dist/domain/hot-potato-enforcer.js.map +1 -1
  353. package/daemon/dist/domain/human-questions.d.ts +1 -1
  354. package/daemon/dist/domain/human-questions.d.ts.map +1 -1
  355. package/daemon/dist/domain/human-questions.js +2 -0
  356. package/daemon/dist/domain/human-questions.js.map +1 -1
  357. package/daemon/dist/domain/input-read-diagnostic.js +1 -1
  358. package/daemon/dist/domain/input-read-diagnostic.js.map +1 -1
  359. package/daemon/dist/domain/keep-alive-supervisor.d.ts +178 -0
  360. package/daemon/dist/domain/keep-alive-supervisor.d.ts.map +1 -0
  361. package/daemon/dist/domain/keep-alive-supervisor.js +523 -0
  362. package/daemon/dist/domain/keep-alive-supervisor.js.map +1 -0
  363. package/daemon/dist/domain/managed-restore-read-access.d.ts +18 -0
  364. package/daemon/dist/domain/managed-restore-read-access.d.ts.map +1 -1
  365. package/daemon/dist/domain/managed-restore-read-access.js +41 -1
  366. package/daemon/dist/domain/managed-restore-read-access.js.map +1 -1
  367. package/daemon/dist/domain/mission-control/audit-browse.d.ts +1 -1
  368. package/daemon/dist/domain/mission-control/audit-browse.d.ts.map +1 -1
  369. package/daemon/dist/domain/mission-control/audit-browse.js +3 -6
  370. package/daemon/dist/domain/mission-control/audit-browse.js.map +1 -1
  371. package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.d.ts +6 -0
  372. package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.d.ts.map +1 -1
  373. package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.js +38 -9
  374. package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.js.map +1 -1
  375. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
  376. package/daemon/dist/domain/mission-control/mission-control-write-contract.js +50 -5
  377. package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
  378. package/daemon/dist/domain/mutation-trace.d.ts +28 -0
  379. package/daemon/dist/domain/mutation-trace.d.ts.map +1 -0
  380. package/daemon/dist/domain/mutation-trace.js +38 -0
  381. package/daemon/dist/domain/mutation-trace.js.map +1 -0
  382. package/daemon/dist/domain/native-resume-probe.d.ts +35 -3
  383. package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
  384. package/daemon/dist/domain/native-resume-probe.js +84 -17
  385. package/daemon/dist/domain/native-resume-probe.js.map +1 -1
  386. package/daemon/dist/domain/network/hub-client.d.ts +30 -1
  387. package/daemon/dist/domain/network/hub-client.d.ts.map +1 -1
  388. package/daemon/dist/domain/network/hub-client.js +62 -9
  389. package/daemon/dist/domain/network/hub-client.js.map +1 -1
  390. package/daemon/dist/domain/network/network-bindings.d.ts +52 -2
  391. package/daemon/dist/domain/network/network-bindings.d.ts.map +1 -1
  392. package/daemon/dist/domain/network/network-bindings.js +217 -23
  393. package/daemon/dist/domain/network/network-bindings.js.map +1 -1
  394. package/daemon/dist/domain/network/network-connector.d.ts +9 -1
  395. package/daemon/dist/domain/network/network-connector.d.ts.map +1 -1
  396. package/daemon/dist/domain/network/network-connector.js +95 -7
  397. package/daemon/dist/domain/network/network-connector.js.map +1 -1
  398. package/daemon/dist/domain/network/network-installations.d.ts.map +1 -1
  399. package/daemon/dist/domain/network/network-installations.js +22 -7
  400. package/daemon/dist/domain/network/network-installations.js.map +1 -1
  401. package/daemon/dist/domain/network/network-provider-removal.d.ts +9 -0
  402. package/daemon/dist/domain/network/network-provider-removal.d.ts.map +1 -0
  403. package/daemon/dist/domain/network/network-provider-removal.js +75 -0
  404. package/daemon/dist/domain/network/network-provider-removal.js.map +1 -0
  405. package/daemon/dist/domain/network/network-requests.d.ts +60 -0
  406. package/daemon/dist/domain/network/network-requests.d.ts.map +1 -0
  407. package/daemon/dist/domain/network/network-requests.js +502 -0
  408. package/daemon/dist/domain/network/network-requests.js.map +1 -0
  409. package/daemon/dist/domain/node-inventory.d.ts +26 -0
  410. package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
  411. package/daemon/dist/domain/node-inventory.js +87 -7
  412. package/daemon/dist/domain/node-inventory.js.map +1 -1
  413. package/daemon/dist/domain/node-launcher.d.ts +2 -2
  414. package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
  415. package/daemon/dist/domain/node-launcher.js +9 -7
  416. package/daemon/dist/domain/node-launcher.js.map +1 -1
  417. package/daemon/dist/domain/occupant-invalidator.d.ts +1 -1
  418. package/daemon/dist/domain/occupant-invalidator.d.ts.map +1 -1
  419. package/daemon/dist/domain/occupant-invalidator.js +1 -1
  420. package/daemon/dist/domain/occupant-invalidator.js.map +1 -1
  421. package/daemon/dist/domain/outbox-handler.d.ts +11 -0
  422. package/daemon/dist/domain/outbox-handler.d.ts.map +1 -1
  423. package/daemon/dist/domain/outbox-handler.js +20 -0
  424. package/daemon/dist/domain/outbox-handler.js.map +1 -1
  425. package/daemon/dist/domain/pane-cutover.d.ts +36 -9
  426. package/daemon/dist/domain/pane-cutover.d.ts.map +1 -1
  427. package/daemon/dist/domain/pane-cutover.js +82 -13
  428. package/daemon/dist/domain/pane-cutover.js.map +1 -1
  429. package/daemon/dist/domain/parked-query.d.ts +6 -0
  430. package/daemon/dist/domain/parked-query.d.ts.map +1 -1
  431. package/daemon/dist/domain/parked-query.js +14 -4
  432. package/daemon/dist/domain/parked-query.js.map +1 -1
  433. package/daemon/dist/domain/policies/seat-pool.d.ts +13 -0
  434. package/daemon/dist/domain/policies/seat-pool.d.ts.map +1 -1
  435. package/daemon/dist/domain/policies/seat-pool.js +18 -3
  436. package/daemon/dist/domain/policies/seat-pool.js.map +1 -1
  437. package/daemon/dist/domain/profile-resolver.d.ts +7 -1
  438. package/daemon/dist/domain/profile-resolver.d.ts.map +1 -1
  439. package/daemon/dist/domain/profile-resolver.js +7 -0
  440. package/daemon/dist/domain/profile-resolver.js.map +1 -1
  441. package/daemon/dist/domain/progress/progress-indexer.d.ts.map +1 -1
  442. package/daemon/dist/domain/progress/progress-indexer.js +11 -0
  443. package/daemon/dist/domain/progress/progress-indexer.js.map +1 -1
  444. package/daemon/dist/domain/project-lifecycle-compiler.d.ts.map +1 -1
  445. package/daemon/dist/domain/project-lifecycle-compiler.js +4 -1
  446. package/daemon/dist/domain/project-lifecycle-compiler.js.map +1 -1
  447. package/daemon/dist/domain/projection-planner.d.ts +17 -3
  448. package/daemon/dist/domain/projection-planner.d.ts.map +1 -1
  449. package/daemon/dist/domain/projection-planner.js +9 -1
  450. package/daemon/dist/domain/projection-planner.js.map +1 -1
  451. package/daemon/dist/domain/proof/judgments.d.ts +3 -0
  452. package/daemon/dist/domain/proof/judgments.d.ts.map +1 -1
  453. package/daemon/dist/domain/proof/judgments.js +13 -3
  454. package/daemon/dist/domain/proof/judgments.js.map +1 -1
  455. package/daemon/dist/domain/proof/source-watch.js +4 -4
  456. package/daemon/dist/domain/proof/source-watch.js.map +1 -1
  457. package/daemon/dist/domain/provider/claude-interruption.d.ts +6 -0
  458. package/daemon/dist/domain/provider/claude-interruption.d.ts.map +1 -1
  459. package/daemon/dist/domain/provider/claude-interruption.js +18 -0
  460. package/daemon/dist/domain/provider/claude-interruption.js.map +1 -1
  461. package/daemon/dist/domain/ps-projection.d.ts +8 -1
  462. package/daemon/dist/domain/ps-projection.d.ts.map +1 -1
  463. package/daemon/dist/domain/ps-projection.js +11 -3
  464. package/daemon/dist/domain/ps-projection.js.map +1 -1
  465. package/daemon/dist/domain/queue-destination-check.d.ts +8 -0
  466. package/daemon/dist/domain/queue-destination-check.d.ts.map +1 -1
  467. package/daemon/dist/domain/queue-destination-check.js +17 -4
  468. package/daemon/dist/domain/queue-destination-check.js.map +1 -1
  469. package/daemon/dist/domain/queue-erasure.d.ts +3 -0
  470. package/daemon/dist/domain/queue-erasure.d.ts.map +1 -1
  471. package/daemon/dist/domain/queue-erasure.js +2 -2
  472. package/daemon/dist/domain/queue-erasure.js.map +1 -1
  473. package/daemon/dist/domain/queue-owner.d.ts +5 -0
  474. package/daemon/dist/domain/queue-owner.d.ts.map +1 -1
  475. package/daemon/dist/domain/queue-owner.js +16 -8
  476. package/daemon/dist/domain/queue-owner.js.map +1 -1
  477. package/daemon/dist/domain/queue-recorded-graph.d.ts +32 -0
  478. package/daemon/dist/domain/queue-recorded-graph.d.ts.map +1 -0
  479. package/daemon/dist/domain/queue-recorded-graph.js +84 -0
  480. package/daemon/dist/domain/queue-recorded-graph.js.map +1 -0
  481. package/daemon/dist/domain/queue-repository.d.ts +94 -5
  482. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  483. package/daemon/dist/domain/queue-repository.js +491 -39
  484. package/daemon/dist/domain/queue-repository.js.map +1 -1
  485. package/daemon/dist/domain/queue-retention.d.ts +1 -1
  486. package/daemon/dist/domain/queue-retention.d.ts.map +1 -1
  487. package/daemon/dist/domain/queue-retention.js +4 -0
  488. package/daemon/dist/domain/queue-retention.js.map +1 -1
  489. package/daemon/dist/domain/queue-stuck-sweep.d.ts +23 -3
  490. package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
  491. package/daemon/dist/domain/queue-stuck-sweep.js +661 -22
  492. package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
  493. package/daemon/dist/domain/queue-transfer-export.d.ts +75 -0
  494. package/daemon/dist/domain/queue-transfer-export.d.ts.map +1 -0
  495. package/daemon/dist/domain/queue-transfer-export.js +158 -0
  496. package/daemon/dist/domain/queue-transfer-export.js.map +1 -0
  497. package/daemon/dist/domain/queue-transfer-format.d.ts +15 -0
  498. package/daemon/dist/domain/queue-transfer-format.d.ts.map +1 -0
  499. package/daemon/dist/domain/queue-transfer-format.js +32 -0
  500. package/daemon/dist/domain/queue-transfer-format.js.map +1 -0
  501. package/daemon/dist/domain/queue-transfer-parse.d.ts +40 -0
  502. package/daemon/dist/domain/queue-transfer-parse.d.ts.map +1 -0
  503. package/daemon/dist/domain/queue-transfer-parse.js +131 -0
  504. package/daemon/dist/domain/queue-transfer-parse.js.map +1 -0
  505. package/daemon/dist/domain/queue-transfer-review.d.ts +22 -0
  506. package/daemon/dist/domain/queue-transfer-review.d.ts.map +1 -0
  507. package/daemon/dist/domain/queue-transfer-review.js +81 -0
  508. package/daemon/dist/domain/queue-transfer-review.js.map +1 -0
  509. package/daemon/dist/domain/queue-transfer-staging.d.ts +79 -0
  510. package/daemon/dist/domain/queue-transfer-staging.d.ts.map +1 -0
  511. package/daemon/dist/domain/queue-transfer-staging.js +67 -0
  512. package/daemon/dist/domain/queue-transfer-staging.js.map +1 -0
  513. package/daemon/dist/domain/queue-transition-log.d.ts +6 -0
  514. package/daemon/dist/domain/queue-transition-log.d.ts.map +1 -1
  515. package/daemon/dist/domain/queue-transition-log.js +1 -1
  516. package/daemon/dist/domain/queue-transition-log.js.map +1 -1
  517. package/daemon/dist/domain/queue-waiting.d.ts.map +1 -1
  518. package/daemon/dist/domain/queue-waiting.js +7 -0
  519. package/daemon/dist/domain/queue-waiting.js.map +1 -1
  520. package/daemon/dist/domain/queue-wake-ladder.d.ts +4 -0
  521. package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
  522. package/daemon/dist/domain/queue-wake-ladder.js +181 -24
  523. package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
  524. package/daemon/dist/domain/reconciler.d.ts +27 -2
  525. package/daemon/dist/domain/reconciler.d.ts.map +1 -1
  526. package/daemon/dist/domain/reconciler.js +184 -16
  527. package/daemon/dist/domain/reconciler.js.map +1 -1
  528. package/daemon/dist/domain/refusal-trace.d.ts +15 -0
  529. package/daemon/dist/domain/refusal-trace.d.ts.map +1 -0
  530. package/daemon/dist/domain/refusal-trace.js +23 -0
  531. package/daemon/dist/domain/refusal-trace.js.map +1 -0
  532. package/daemon/dist/domain/rehydrate-eligibility.d.ts +8 -0
  533. package/daemon/dist/domain/rehydrate-eligibility.d.ts.map +1 -1
  534. package/daemon/dist/domain/rehydrate-eligibility.js +61 -9
  535. package/daemon/dist/domain/rehydrate-eligibility.js.map +1 -1
  536. package/daemon/dist/domain/relayed-answers.d.ts +80 -0
  537. package/daemon/dist/domain/relayed-answers.d.ts.map +1 -0
  538. package/daemon/dist/domain/relayed-answers.js +8 -0
  539. package/daemon/dist/domain/relayed-answers.js.map +1 -0
  540. package/daemon/dist/domain/remote-control-observations.d.ts +50 -0
  541. package/daemon/dist/domain/remote-control-observations.d.ts.map +1 -0
  542. package/daemon/dist/domain/remote-control-observations.js +72 -0
  543. package/daemon/dist/domain/remote-control-observations.js.map +1 -0
  544. package/daemon/dist/domain/restore-attempt-receipt.d.ts.map +1 -1
  545. package/daemon/dist/domain/restore-attempt-receipt.js +8 -2
  546. package/daemon/dist/domain/restore-attempt-receipt.js.map +1 -1
  547. package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
  548. package/daemon/dist/domain/restore-check-service.js +5 -2
  549. package/daemon/dist/domain/restore-check-service.js.map +1 -1
  550. package/daemon/dist/domain/restore-orchestrator.d.ts +70 -6
  551. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  552. package/daemon/dist/domain/restore-orchestrator.js +387 -51
  553. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  554. package/daemon/dist/domain/return-route.d.ts +13 -2
  555. package/daemon/dist/domain/return-route.d.ts.map +1 -1
  556. package/daemon/dist/domain/return-route.js +30 -1
  557. package/daemon/dist/domain/return-route.js.map +1 -1
  558. package/daemon/dist/domain/rig-lifecycle-service.d.ts +1 -0
  559. package/daemon/dist/domain/rig-lifecycle-service.d.ts.map +1 -1
  560. package/daemon/dist/domain/rig-lifecycle-service.js +27 -3
  561. package/daemon/dist/domain/rig-lifecycle-service.js.map +1 -1
  562. package/daemon/dist/domain/rig-mode/operating-posture.d.ts.map +1 -1
  563. package/daemon/dist/domain/rig-mode/operating-posture.js +23 -4
  564. package/daemon/dist/domain/rig-mode/operating-posture.js.map +1 -1
  565. package/daemon/dist/domain/rig-repository.d.ts +21 -3
  566. package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
  567. package/daemon/dist/domain/rig-repository.js +67 -2
  568. package/daemon/dist/domain/rig-repository.js.map +1 -1
  569. package/daemon/dist/domain/rig-teardown.d.ts +52 -9
  570. package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
  571. package/daemon/dist/domain/rig-teardown.js +184 -32
  572. package/daemon/dist/domain/rig-teardown.js.map +1 -1
  573. package/daemon/dist/domain/rigspec-codec.d.ts.map +1 -1
  574. package/daemon/dist/domain/rigspec-codec.js +12 -0
  575. package/daemon/dist/domain/rigspec-codec.js.map +1 -1
  576. package/daemon/dist/domain/rigspec-exporter.d.ts +14 -0
  577. package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
  578. package/daemon/dist/domain/rigspec-exporter.js +56 -14
  579. package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
  580. package/daemon/dist/domain/rigspec-instantiator.d.ts +34 -3
  581. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  582. package/daemon/dist/domain/rigspec-instantiator.js +195 -40
  583. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  584. package/daemon/dist/domain/rigspec-preflight.d.ts.map +1 -1
  585. package/daemon/dist/domain/rigspec-preflight.js +26 -3
  586. package/daemon/dist/domain/rigspec-preflight.js.map +1 -1
  587. package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
  588. package/daemon/dist/domain/rigspec-schema.js +30 -4
  589. package/daemon/dist/domain/rigspec-schema.js.map +1 -1
  590. package/daemon/dist/domain/roster-ready-notice.d.ts +11 -0
  591. package/daemon/dist/domain/roster-ready-notice.d.ts.map +1 -0
  592. package/daemon/dist/domain/roster-ready-notice.js +35 -0
  593. package/daemon/dist/domain/roster-ready-notice.js.map +1 -0
  594. package/daemon/dist/domain/rosters.d.ts +1 -0
  595. package/daemon/dist/domain/rosters.d.ts.map +1 -1
  596. package/daemon/dist/domain/rosters.js +5 -4
  597. package/daemon/dist/domain/rosters.js.map +1 -1
  598. package/daemon/dist/domain/runner-permissions.d.ts +140 -5
  599. package/daemon/dist/domain/runner-permissions.d.ts.map +1 -1
  600. package/daemon/dist/domain/runner-permissions.js +593 -16
  601. package/daemon/dist/domain/runner-permissions.js.map +1 -1
  602. package/daemon/dist/domain/runtime-adapter.d.ts +3 -1
  603. package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
  604. package/daemon/dist/domain/runtime-exit.d.ts +79 -0
  605. package/daemon/dist/domain/runtime-exit.d.ts.map +1 -0
  606. package/daemon/dist/domain/runtime-exit.js +301 -0
  607. package/daemon/dist/domain/runtime-exit.js.map +1 -0
  608. package/daemon/dist/domain/runtime-switch-materials.d.ts +4 -1
  609. package/daemon/dist/domain/runtime-switch-materials.d.ts.map +1 -1
  610. package/daemon/dist/domain/runtime-switch-materials.js +66 -13
  611. package/daemon/dist/domain/runtime-switch-materials.js.map +1 -1
  612. package/daemon/dist/domain/scope/attestation-lineage.generated.js +2 -2
  613. package/daemon/dist/domain/scope/attestation-lineage.generated.js.map +1 -1
  614. package/daemon/dist/domain/scope/logical-checkbox.d.ts.map +1 -1
  615. package/daemon/dist/domain/scope/logical-checkbox.js +18 -0
  616. package/daemon/dist/domain/scope/logical-checkbox.js.map +1 -1
  617. package/daemon/dist/domain/scope/scaffold-placeholder.js +2 -2
  618. package/daemon/dist/domain/scope/scaffold-placeholder.js.map +1 -1
  619. package/daemon/dist/domain/seat-activity-service.d.ts +4 -0
  620. package/daemon/dist/domain/seat-activity-service.d.ts.map +1 -1
  621. package/daemon/dist/domain/seat-activity-service.js +24 -5
  622. package/daemon/dist/domain/seat-activity-service.js.map +1 -1
  623. package/daemon/dist/domain/seat-attention-reconciler.d.ts +7 -0
  624. package/daemon/dist/domain/seat-attention-reconciler.d.ts.map +1 -1
  625. package/daemon/dist/domain/seat-attention-reconciler.js +152 -65
  626. package/daemon/dist/domain/seat-attention-reconciler.js.map +1 -1
  627. package/daemon/dist/domain/seat-cold-start.d.ts +150 -0
  628. package/daemon/dist/domain/seat-cold-start.d.ts.map +1 -0
  629. package/daemon/dist/domain/seat-cold-start.js +371 -0
  630. package/daemon/dist/domain/seat-cold-start.js.map +1 -0
  631. package/daemon/dist/domain/seat-delivery-guard.d.ts +11 -2
  632. package/daemon/dist/domain/seat-delivery-guard.d.ts.map +1 -1
  633. package/daemon/dist/domain/seat-delivery-guard.js +34 -6
  634. package/daemon/dist/domain/seat-delivery-guard.js.map +1 -1
  635. package/daemon/dist/domain/seat-handover-service.d.ts +5 -2
  636. package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
  637. package/daemon/dist/domain/seat-handover-service.js +30 -6
  638. package/daemon/dist/domain/seat-handover-service.js.map +1 -1
  639. package/daemon/dist/domain/seat-identity-reconciler.d.ts +31 -0
  640. package/daemon/dist/domain/seat-identity-reconciler.d.ts.map +1 -1
  641. package/daemon/dist/domain/seat-identity-reconciler.js +218 -29
  642. package/daemon/dist/domain/seat-identity-reconciler.js.map +1 -1
  643. package/daemon/dist/domain/seat-identity-store.d.ts +5 -3
  644. package/daemon/dist/domain/seat-identity-store.d.ts.map +1 -1
  645. package/daemon/dist/domain/seat-identity-store.js +7 -3
  646. package/daemon/dist/domain/seat-identity-store.js.map +1 -1
  647. package/daemon/dist/domain/seat-launch-environment.d.ts +8 -0
  648. package/daemon/dist/domain/seat-launch-environment.d.ts.map +1 -1
  649. package/daemon/dist/domain/seat-launch-environment.js +37 -5
  650. package/daemon/dist/domain/seat-launch-environment.js.map +1 -1
  651. package/daemon/dist/domain/seat-lifecycle-service.d.ts +54 -1
  652. package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
  653. package/daemon/dist/domain/seat-lifecycle-service.js +220 -30
  654. package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
  655. package/daemon/dist/domain/seat-pool-executor.d.ts +174 -0
  656. package/daemon/dist/domain/seat-pool-executor.d.ts.map +1 -0
  657. package/daemon/dist/domain/seat-pool-executor.js +1241 -0
  658. package/daemon/dist/domain/seat-pool-executor.js.map +1 -0
  659. package/daemon/dist/domain/seat-pool-registration.d.ts +93 -0
  660. package/daemon/dist/domain/seat-pool-registration.d.ts.map +1 -0
  661. package/daemon/dist/domain/seat-pool-registration.js +149 -0
  662. package/daemon/dist/domain/seat-pool-registration.js.map +1 -0
  663. package/daemon/dist/domain/seat-pool-slots.d.ts +66 -0
  664. package/daemon/dist/domain/seat-pool-slots.d.ts.map +1 -1
  665. package/daemon/dist/domain/seat-pool-slots.js +101 -0
  666. package/daemon/dist/domain/seat-pool-slots.js.map +1 -1
  667. package/daemon/dist/domain/seat-restart-in-place.d.ts +15 -0
  668. package/daemon/dist/domain/seat-restart-in-place.d.ts.map +1 -1
  669. package/daemon/dist/domain/seat-restart-in-place.js +54 -2
  670. package/daemon/dist/domain/seat-restart-in-place.js.map +1 -1
  671. package/daemon/dist/domain/seat-runtime-home-record.d.ts +8 -0
  672. package/daemon/dist/domain/seat-runtime-home-record.d.ts.map +1 -1
  673. package/daemon/dist/domain/seat-runtime-home-record.js +1 -1
  674. package/daemon/dist/domain/seat-runtime-home-record.js.map +1 -1
  675. package/daemon/dist/domain/seat-runtime-switch-service.d.ts +2 -1
  676. package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -1
  677. package/daemon/dist/domain/seat-runtime-switch-service.js +68 -20
  678. package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
  679. package/daemon/dist/domain/session-registry.d.ts +22 -3
  680. package/daemon/dist/domain/session-registry.d.ts.map +1 -1
  681. package/daemon/dist/domain/session-registry.js +38 -6
  682. package/daemon/dist/domain/session-registry.js.map +1 -1
  683. package/daemon/dist/domain/session-transport.d.ts +18 -2
  684. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  685. package/daemon/dist/domain/session-transport.js +73 -39
  686. package/daemon/dist/domain/session-transport.js.map +1 -1
  687. package/daemon/dist/domain/skill-catalog.d.ts.map +1 -1
  688. package/daemon/dist/domain/skill-catalog.js +24 -10
  689. package/daemon/dist/domain/skill-catalog.js.map +1 -1
  690. package/daemon/dist/domain/slices/slice-indexer.d.ts +55 -0
  691. package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -1
  692. package/daemon/dist/domain/slices/slice-indexer.js +259 -50
  693. package/daemon/dist/domain/slices/slice-indexer.js.map +1 -1
  694. package/daemon/dist/domain/startup-orchestrator.d.ts +6 -2
  695. package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
  696. package/daemon/dist/domain/startup-orchestrator.js +118 -30
  697. package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
  698. package/daemon/dist/domain/startup-proof.d.ts +6 -0
  699. package/daemon/dist/domain/startup-proof.d.ts.map +1 -1
  700. package/daemon/dist/domain/startup-proof.js +11 -0
  701. package/daemon/dist/domain/startup-proof.js.map +1 -1
  702. package/daemon/dist/domain/startup-submission-evidence.d.ts +3 -0
  703. package/daemon/dist/domain/startup-submission-evidence.d.ts.map +1 -1
  704. package/daemon/dist/domain/startup-submission-evidence.js +36 -3
  705. package/daemon/dist/domain/startup-submission-evidence.js.map +1 -1
  706. package/daemon/dist/domain/stream-reader-actions.d.ts +23 -0
  707. package/daemon/dist/domain/stream-reader-actions.d.ts.map +1 -1
  708. package/daemon/dist/domain/stream-reader-actions.js +43 -0
  709. package/daemon/dist/domain/stream-reader-actions.js.map +1 -1
  710. package/daemon/dist/domain/successor-session-launcher.d.ts +24 -3
  711. package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
  712. package/daemon/dist/domain/successor-session-launcher.js +54 -23
  713. package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
  714. package/daemon/dist/domain/terminal/earlier-tile-attach-0723.d.ts +2 -0
  715. package/daemon/dist/domain/terminal/earlier-tile-attach-0723.d.ts.map +1 -0
  716. package/daemon/dist/domain/terminal/earlier-tile-attach-0723.js +48 -0
  717. package/daemon/dist/domain/terminal/earlier-tile-attach-0723.js.map +1 -0
  718. package/daemon/dist/domain/terminal/herdr-adapter.d.ts +2 -0
  719. package/daemon/dist/domain/terminal/herdr-adapter.d.ts.map +1 -1
  720. package/daemon/dist/domain/terminal/herdr-adapter.js +2 -0
  721. package/daemon/dist/domain/terminal/herdr-adapter.js.map +1 -1
  722. package/daemon/dist/domain/terminal/rex-agent-status.d.ts.map +1 -1
  723. package/daemon/dist/domain/terminal/rex-agent-status.js +5 -2
  724. package/daemon/dist/domain/terminal/rex-agent-status.js.map +1 -1
  725. package/daemon/dist/domain/terminal/scope-task-terminal-view.d.ts +2 -1
  726. package/daemon/dist/domain/terminal/scope-task-terminal-view.d.ts.map +1 -1
  727. package/daemon/dist/domain/terminal/scope-task-terminal-view.js +80 -38
  728. package/daemon/dist/domain/terminal/scope-task-terminal-view.js.map +1 -1
  729. package/daemon/dist/domain/terminal/terminal-provider.d.ts +2 -0
  730. package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
  731. package/daemon/dist/domain/terminal/terminal-service.d.ts +3 -0
  732. package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
  733. package/daemon/dist/domain/terminal/terminal-service.js +30 -26
  734. package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
  735. package/daemon/dist/domain/terminal/tile-attach.d.ts +31 -3
  736. package/daemon/dist/domain/terminal/tile-attach.d.ts.map +1 -1
  737. package/daemon/dist/domain/terminal/tile-attach.js +95 -4
  738. package/daemon/dist/domain/terminal/tile-attach.js.map +1 -1
  739. package/daemon/dist/domain/terminal/view-composer.d.ts +2 -0
  740. package/daemon/dist/domain/terminal/view-composer.d.ts.map +1 -1
  741. package/daemon/dist/domain/terminal/view-composer.js +4 -2
  742. package/daemon/dist/domain/terminal/view-composer.js.map +1 -1
  743. package/daemon/dist/domain/topology-trace.d.ts +40 -0
  744. package/daemon/dist/domain/topology-trace.d.ts.map +1 -0
  745. package/daemon/dist/domain/topology-trace.js +106 -0
  746. package/daemon/dist/domain/topology-trace.js.map +1 -0
  747. package/daemon/dist/domain/transcript-redaction.d.ts +10 -8
  748. package/daemon/dist/domain/transcript-redaction.d.ts.map +1 -1
  749. package/daemon/dist/domain/transcript-redaction.js +51 -22
  750. package/daemon/dist/domain/transcript-redaction.js.map +1 -1
  751. package/daemon/dist/domain/transcript-store.d.ts.map +1 -1
  752. package/daemon/dist/domain/transcript-store.js +12 -1
  753. package/daemon/dist/domain/transcript-store.js.map +1 -1
  754. package/daemon/dist/domain/types.d.ts +111 -9
  755. package/daemon/dist/domain/types.d.ts.map +1 -1
  756. package/daemon/dist/domain/types.js +6 -2
  757. package/daemon/dist/domain/types.js.map +1 -1
  758. package/daemon/dist/domain/user-settings/settings-browser.d.ts.map +1 -1
  759. package/daemon/dist/domain/user-settings/settings-browser.js +2 -0
  760. package/daemon/dist/domain/user-settings/settings-browser.js.map +1 -1
  761. package/daemon/dist/domain/user-settings/settings-store.d.ts +1 -1
  762. package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
  763. package/daemon/dist/domain/user-settings/settings-store.js +13 -0
  764. package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
  765. package/daemon/dist/domain/watchdog-jobs-repository.d.ts +5 -3
  766. package/daemon/dist/domain/watchdog-jobs-repository.d.ts.map +1 -1
  767. package/daemon/dist/domain/watchdog-jobs-repository.js +6 -1
  768. package/daemon/dist/domain/watchdog-jobs-repository.js.map +1 -1
  769. package/daemon/dist/domain/watchdog-policy-engine.d.ts +8 -1
  770. package/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -1
  771. package/daemon/dist/domain/watchdog-policy-engine.js +6 -2
  772. package/daemon/dist/domain/watchdog-policy-engine.js.map +1 -1
  773. package/daemon/dist/domain/whoami-service.d.ts +11 -0
  774. package/daemon/dist/domain/whoami-service.d.ts.map +1 -1
  775. package/daemon/dist/domain/whoami-service.js +13 -0
  776. package/daemon/dist/domain/whoami-service.js.map +1 -1
  777. package/daemon/dist/domain/workflow-instance-store.d.ts +2 -0
  778. package/daemon/dist/domain/workflow-instance-store.d.ts.map +1 -1
  779. package/daemon/dist/domain/workflow-instance-store.js +11 -2
  780. package/daemon/dist/domain/workflow-instance-store.js.map +1 -1
  781. package/daemon/dist/domain/workflow-projector.d.ts +3 -1
  782. package/daemon/dist/domain/workflow-projector.d.ts.map +1 -1
  783. package/daemon/dist/domain/workflow-projector.js +58 -10
  784. package/daemon/dist/domain/workflow-projector.js.map +1 -1
  785. package/daemon/dist/domain/workflow-reconciliation.d.ts.map +1 -1
  786. package/daemon/dist/domain/workflow-reconciliation.js +9 -0
  787. package/daemon/dist/domain/workflow-reconciliation.js.map +1 -1
  788. package/daemon/dist/domain/workflow-run-title.d.ts +4 -0
  789. package/daemon/dist/domain/workflow-run-title.d.ts.map +1 -0
  790. package/daemon/dist/domain/workflow-run-title.js +5 -0
  791. package/daemon/dist/domain/workflow-run-title.js.map +1 -0
  792. package/daemon/dist/domain/workflow-runtime.d.ts +3 -0
  793. package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
  794. package/daemon/dist/domain/workflow-runtime.js +48 -3
  795. package/daemon/dist/domain/workflow-runtime.js.map +1 -1
  796. package/daemon/dist/domain/workflow-spec-cache.d.ts +2 -2
  797. package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
  798. package/daemon/dist/domain/workflow-spec-cache.js +20 -1
  799. package/daemon/dist/domain/workflow-spec-cache.js.map +1 -1
  800. package/daemon/dist/domain/workflow-types.d.ts +15 -0
  801. package/daemon/dist/domain/workflow-types.d.ts.map +1 -1
  802. package/daemon/dist/domain/workflow-types.js +4 -0
  803. package/daemon/dist/domain/workflow-types.js.map +1 -1
  804. package/daemon/dist/domain/workspace/project-read.d.ts +10 -0
  805. package/daemon/dist/domain/workspace/project-read.d.ts.map +1 -1
  806. package/daemon/dist/domain/workspace/project-read.js +34 -2
  807. package/daemon/dist/domain/workspace/project-read.js.map +1 -1
  808. package/daemon/dist/index.d.ts.map +1 -1
  809. package/daemon/dist/index.js +7 -1
  810. package/daemon/dist/index.js.map +1 -1
  811. package/daemon/dist/queue-transfer-export-surface.d.ts +33 -0
  812. package/daemon/dist/queue-transfer-export-surface.d.ts.map +1 -0
  813. package/daemon/dist/queue-transfer-export-surface.js +13 -0
  814. package/daemon/dist/queue-transfer-export-surface.js.map +1 -0
  815. package/daemon/dist/queue-transfer-staging-surface.d.ts +86 -0
  816. package/daemon/dist/queue-transfer-staging-surface.d.ts.map +1 -0
  817. package/daemon/dist/queue-transfer-staging-surface.js +91 -0
  818. package/daemon/dist/queue-transfer-staging-surface.js.map +1 -0
  819. package/daemon/dist/routes/activity.d.ts.map +1 -1
  820. package/daemon/dist/routes/activity.js +105 -2
  821. package/daemon/dist/routes/activity.js.map +1 -1
  822. package/daemon/dist/routes/compaction.d.ts.map +1 -1
  823. package/daemon/dist/routes/compaction.js +33 -11
  824. package/daemon/dist/routes/compaction.js.map +1 -1
  825. package/daemon/dist/routes/context-packs.d.ts.map +1 -1
  826. package/daemon/dist/routes/context-packs.js +23 -1
  827. package/daemon/dist/routes/context-packs.js.map +1 -1
  828. package/daemon/dist/routes/events.js +7 -4
  829. package/daemon/dist/routes/events.js.map +1 -1
  830. package/daemon/dist/routes/network.d.ts +2 -0
  831. package/daemon/dist/routes/network.d.ts.map +1 -1
  832. package/daemon/dist/routes/network.js +62 -1
  833. package/daemon/dist/routes/network.js.map +1 -1
  834. package/daemon/dist/routes/ps.js +12 -1
  835. package/daemon/dist/routes/ps.js.map +1 -1
  836. package/daemon/dist/routes/queue.d.ts.map +1 -1
  837. package/daemon/dist/routes/queue.js +219 -77
  838. package/daemon/dist/routes/queue.js.map +1 -1
  839. package/daemon/dist/routes/require-sender-identity.d.ts +15 -0
  840. package/daemon/dist/routes/require-sender-identity.d.ts.map +1 -1
  841. package/daemon/dist/routes/require-sender-identity.js +57 -8
  842. package/daemon/dist/routes/require-sender-identity.js.map +1 -1
  843. package/daemon/dist/routes/rigs.js +2 -0
  844. package/daemon/dist/routes/rigs.js.map +1 -1
  845. package/daemon/dist/routes/seat.d.ts.map +1 -1
  846. package/daemon/dist/routes/seat.js +18 -5
  847. package/daemon/dist/routes/seat.js.map +1 -1
  848. package/daemon/dist/routes/sessions.d.ts.map +1 -1
  849. package/daemon/dist/routes/sessions.js +14 -0
  850. package/daemon/dist/routes/sessions.js.map +1 -1
  851. package/daemon/dist/routes/slices.d.ts.map +1 -1
  852. package/daemon/dist/routes/slices.js +16 -7
  853. package/daemon/dist/routes/slices.js.map +1 -1
  854. package/daemon/dist/routes/startup.d.ts.map +1 -1
  855. package/daemon/dist/routes/startup.js +49 -4
  856. package/daemon/dist/routes/startup.js.map +1 -1
  857. package/daemon/dist/routes/stream.d.ts.map +1 -1
  858. package/daemon/dist/routes/stream.js +28 -1
  859. package/daemon/dist/routes/stream.js.map +1 -1
  860. package/daemon/dist/routes/terminal-ws.js +28 -2
  861. package/daemon/dist/routes/terminal-ws.js.map +1 -1
  862. package/daemon/dist/routes/terminal.d.ts.map +1 -1
  863. package/daemon/dist/routes/terminal.js +3 -2
  864. package/daemon/dist/routes/terminal.js.map +1 -1
  865. package/daemon/dist/routes/transport.d.ts.map +1 -1
  866. package/daemon/dist/routes/transport.js +14 -2
  867. package/daemon/dist/routes/transport.js.map +1 -1
  868. package/daemon/dist/routes/up.js +2 -0
  869. package/daemon/dist/routes/up.js.map +1 -1
  870. package/daemon/dist/routes/workflow.d.ts.map +1 -1
  871. package/daemon/dist/routes/workflow.js +57 -44
  872. package/daemon/dist/routes/workflow.js.map +1 -1
  873. package/daemon/dist/server.d.ts +7 -0
  874. package/daemon/dist/server.d.ts.map +1 -1
  875. package/daemon/dist/server.js +25 -1
  876. package/daemon/dist/server.js.map +1 -1
  877. package/daemon/dist/startup.d.ts +3 -0
  878. package/daemon/dist/startup.d.ts.map +1 -1
  879. package/daemon/dist/startup.js +166 -12
  880. package/daemon/dist/startup.js.map +1 -1
  881. package/daemon/dist/terminal/TerminalSessionBroker.d.ts +10 -0
  882. package/daemon/dist/terminal/TerminalSessionBroker.d.ts.map +1 -1
  883. package/daemon/dist/terminal/TerminalSessionBroker.js +63 -4
  884. package/daemon/dist/terminal/TerminalSessionBroker.js.map +1 -1
  885. package/daemon/dist/topology-trace-surface.d.ts +2 -0
  886. package/daemon/dist/topology-trace-surface.d.ts.map +1 -0
  887. package/daemon/dist/topology-trace-surface.js +2 -0
  888. package/daemon/dist/topology-trace-surface.js.map +1 -0
  889. package/daemon/dist/transcript-redaction-surface.d.ts +2 -0
  890. package/daemon/dist/transcript-redaction-surface.d.ts.map +1 -0
  891. package/daemon/dist/transcript-redaction-surface.js +2 -0
  892. package/daemon/dist/transcript-redaction-surface.js.map +1 -0
  893. package/daemon/docs/reference/acp-agents.md +11 -3
  894. package/daemon/docs/reference/agent-spec.md +25 -2
  895. package/daemon/docs/reference/agent-startup-guide.md +13 -1
  896. package/daemon/docs/reference/agent-state-taxonomy.md +35 -1
  897. package/daemon/docs/reference/checked-seat-stop.md +11 -1
  898. package/daemon/docs/reference/claude-status-line.md +7 -0
  899. package/daemon/docs/reference/community-harness-examples/cursor/cursor.yaml +3 -1
  900. package/daemon/docs/reference/community-harness-presets.md +27 -2
  901. package/daemon/docs/reference/daemon-http-clients.md +177 -18
  902. package/daemon/docs/reference/developing.md +3 -2
  903. package/daemon/docs/reference/gateway-participants.md +6 -0
  904. package/daemon/docs/reference/getting-started.md +144 -13
  905. package/daemon/docs/reference/harness-runner-contract.md +72 -0
  906. package/daemon/docs/reference/hosted-members.md +133 -0
  907. package/daemon/docs/reference/inventory-request-diagnostics.md +22 -0
  908. package/daemon/docs/reference/network-connector.md +141 -4
  909. package/daemon/docs/reference/project-workspace.md +11 -2
  910. package/daemon/docs/reference/queue-erasure.md +1 -1
  911. package/daemon/docs/reference/queue-transfer-export.md +38 -0
  912. package/daemon/docs/reference/queue-transfer-staging.md +39 -0
  913. package/daemon/docs/reference/quickstart.md +4 -4
  914. package/daemon/docs/reference/refocus-channel.md +53 -2
  915. package/daemon/docs/reference/rig-bundle.md +11 -1
  916. package/daemon/docs/reference/rig-spec.md +201 -3
  917. package/daemon/docs/reference/rosters.md +18 -3
  918. package/daemon/docs/reference/sdlc-conventions.md +1 -1
  919. package/daemon/docs/reference/seat-delivery.md +21 -4
  920. package/daemon/docs/reference/seat-node-targeting.md +10 -0
  921. package/daemon/docs/reference/seat-pools.md +182 -0
  922. package/daemon/docs/reference/slack-app-setup.md +15 -0
  923. package/daemon/docs/reference/terminal-sessions.md +127 -13
  924. package/daemon/docs/reference/tmux-servers.md +43 -2
  925. package/daemon/docs/reference/whats-new.md +186 -12
  926. package/daemon/specs/agents/shared/skills/core/messaging-the-human/SKILL.md +1 -1
  927. package/daemon/specs/agents/shared/skills/core/working-with-an-openrig-team/SKILL.md +71 -9
  928. package/daemon/specs/rigs/launch/factory/guidance/lead-first-move.md +4 -1
  929. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +2 -1
  930. package/daemon/specs/rigs/launch/starter/guidance/lead-first-move.md +4 -1
  931. package/dist/bin-wrapper.d.ts.map +1 -1
  932. package/dist/bin-wrapper.js +24 -5
  933. package/dist/bin-wrapper.js.map +1 -1
  934. package/dist/build-info.js +3 -3
  935. package/dist/client.d.ts +6 -1
  936. package/dist/client.d.ts.map +1 -1
  937. package/dist/client.js +7 -1
  938. package/dist/client.js.map +1 -1
  939. package/dist/commands/add.js +1 -1
  940. package/dist/commands/add.js.map +1 -1
  941. package/dist/commands/agent.js +1 -1
  942. package/dist/commands/agent.js.map +1 -1
  943. package/dist/commands/broadcast.d.ts.map +1 -1
  944. package/dist/commands/broadcast.js +87 -8
  945. package/dist/commands/broadcast.js.map +1 -1
  946. package/dist/commands/bundle.d.ts.map +1 -1
  947. package/dist/commands/bundle.js +18 -4
  948. package/dist/commands/bundle.js.map +1 -1
  949. package/dist/commands/chatroom.d.ts +3 -0
  950. package/dist/commands/chatroom.d.ts.map +1 -1
  951. package/dist/commands/chatroom.js +7 -1
  952. package/dist/commands/chatroom.js.map +1 -1
  953. package/dist/commands/config.d.ts.map +1 -1
  954. package/dist/commands/config.js +2 -1
  955. package/dist/commands/config.js.map +1 -1
  956. package/dist/commands/create.d.ts.map +1 -1
  957. package/dist/commands/create.js +6 -2
  958. package/dist/commands/create.js.map +1 -1
  959. package/dist/commands/daemon.d.ts.map +1 -1
  960. package/dist/commands/daemon.js +18 -15
  961. package/dist/commands/daemon.js.map +1 -1
  962. package/dist/commands/down.d.ts.map +1 -1
  963. package/dist/commands/down.js +12 -1
  964. package/dist/commands/down.js.map +1 -1
  965. package/dist/commands/exec.d.ts.map +1 -1
  966. package/dist/commands/exec.js +22 -13
  967. package/dist/commands/exec.js.map +1 -1
  968. package/dist/commands/expand.js +1 -1
  969. package/dist/commands/expand.js.map +1 -1
  970. package/dist/commands/export.d.ts.map +1 -1
  971. package/dist/commands/export.js +5 -1
  972. package/dist/commands/export.js.map +1 -1
  973. package/dist/commands/fork.js +1 -1
  974. package/dist/commands/fork.js.map +1 -1
  975. package/dist/commands/gateway.d.ts +4 -0
  976. package/dist/commands/gateway.d.ts.map +1 -1
  977. package/dist/commands/gateway.js +37 -0
  978. package/dist/commands/gateway.js.map +1 -1
  979. package/dist/commands/grow.d.ts.map +1 -1
  980. package/dist/commands/grow.js +9 -4
  981. package/dist/commands/grow.js.map +1 -1
  982. package/dist/commands/import.js +1 -1
  983. package/dist/commands/import.js.map +1 -1
  984. package/dist/commands/mcp.d.ts.map +1 -1
  985. package/dist/commands/mcp.js +57 -22
  986. package/dist/commands/mcp.js.map +1 -1
  987. package/dist/commands/network.d.ts +2 -3
  988. package/dist/commands/network.d.ts.map +1 -1
  989. package/dist/commands/network.js +102 -4
  990. package/dist/commands/network.js.map +1 -1
  991. package/dist/commands/parked.d.ts.map +1 -1
  992. package/dist/commands/parked.js +12 -6
  993. package/dist/commands/parked.js.map +1 -1
  994. package/dist/commands/provider.d.ts.map +1 -1
  995. package/dist/commands/provider.js +3 -2
  996. package/dist/commands/provider.js.map +1 -1
  997. package/dist/commands/ps.d.ts +13 -1
  998. package/dist/commands/ps.d.ts.map +1 -1
  999. package/dist/commands/ps.js +65 -29
  1000. package/dist/commands/ps.js.map +1 -1
  1001. package/dist/commands/queue-export.d.ts +3 -0
  1002. package/dist/commands/queue-export.d.ts.map +1 -0
  1003. package/dist/commands/queue-export.js +67 -0
  1004. package/dist/commands/queue-export.js.map +1 -0
  1005. package/dist/commands/queue-import.d.ts +4 -0
  1006. package/dist/commands/queue-import.d.ts.map +1 -0
  1007. package/dist/commands/queue-import.js +47 -0
  1008. package/dist/commands/queue-import.js.map +1 -0
  1009. package/dist/commands/queue.d.ts +3 -1
  1010. package/dist/commands/queue.d.ts.map +1 -1
  1011. package/dist/commands/queue.js +79 -7
  1012. package/dist/commands/queue.js.map +1 -1
  1013. package/dist/commands/reconcile-session.js +1 -1
  1014. package/dist/commands/reconcile-session.js.map +1 -1
  1015. package/dist/commands/restore.js +1 -1
  1016. package/dist/commands/restore.js.map +1 -1
  1017. package/dist/commands/rig.js +2 -2
  1018. package/dist/commands/rig.js.map +1 -1
  1019. package/dist/commands/roster.js +1 -1
  1020. package/dist/commands/roster.js.map +1 -1
  1021. package/dist/commands/scope.d.ts.map +1 -1
  1022. package/dist/commands/scope.js +30 -18
  1023. package/dist/commands/scope.js.map +1 -1
  1024. package/dist/commands/seat.d.ts.map +1 -1
  1025. package/dist/commands/seat.js +75 -18
  1026. package/dist/commands/seat.js.map +1 -1
  1027. package/dist/commands/send.d.ts.map +1 -1
  1028. package/dist/commands/send.js +15 -3
  1029. package/dist/commands/send.js.map +1 -1
  1030. package/dist/commands/skill.js +1 -1
  1031. package/dist/commands/skill.js.map +1 -1
  1032. package/dist/commands/start.d.ts +14 -0
  1033. package/dist/commands/start.d.ts.map +1 -1
  1034. package/dist/commands/start.js +57 -7
  1035. package/dist/commands/start.js.map +1 -1
  1036. package/dist/commands/terminal.d.ts.map +1 -1
  1037. package/dist/commands/terminal.js +20 -4
  1038. package/dist/commands/terminal.js.map +1 -1
  1039. package/dist/commands/up.d.ts.map +1 -1
  1040. package/dist/commands/up.js +2 -1
  1041. package/dist/commands/up.js.map +1 -1
  1042. package/dist/commands/whoami.d.ts.map +1 -1
  1043. package/dist/commands/whoami.js +6 -0
  1044. package/dist/commands/whoami.js.map +1 -1
  1045. package/dist/commands/workflow-follow.d.ts.map +1 -1
  1046. package/dist/commands/workflow-follow.js +37 -34
  1047. package/dist/commands/workflow-follow.js.map +1 -1
  1048. package/dist/commands/workflow-render.d.ts +1 -1
  1049. package/dist/commands/workflow-render.d.ts.map +1 -1
  1050. package/dist/commands/workflow-render.js +2 -7
  1051. package/dist/commands/workflow-render.js.map +1 -1
  1052. package/dist/commands/workflow.d.ts.map +1 -1
  1053. package/dist/commands/workflow.js +26 -2
  1054. package/dist/commands/workflow.js.map +1 -1
  1055. package/dist/config-store.d.ts +2 -1
  1056. package/dist/config-store.d.ts.map +1 -1
  1057. package/dist/config-store.js +14 -1
  1058. package/dist/config-store.js.map +1 -1
  1059. package/dist/cross-host-executor.d.ts +3 -0
  1060. package/dist/cross-host-executor.d.ts.map +1 -1
  1061. package/dist/cross-host-executor.js +5 -0
  1062. package/dist/cross-host-executor.js.map +1 -1
  1063. package/dist/daemon-auto-start.d.ts.map +1 -1
  1064. package/dist/daemon-auto-start.js +1 -0
  1065. package/dist/daemon-auto-start.js.map +1 -1
  1066. package/dist/daemon-lifecycle.d.ts +30 -1
  1067. package/dist/daemon-lifecycle.d.ts.map +1 -1
  1068. package/dist/daemon-lifecycle.js +135 -38
  1069. package/dist/daemon-lifecycle.js.map +1 -1
  1070. package/dist/daemon-start-lock.d.ts +38 -3
  1071. package/dist/daemon-start-lock.d.ts.map +1 -1
  1072. package/dist/daemon-start-lock.js +201 -48
  1073. package/dist/daemon-start-lock.js.map +1 -1
  1074. package/dist/lib/bundle-source.d.ts +4 -0
  1075. package/dist/lib/bundle-source.d.ts.map +1 -1
  1076. package/dist/lib/bundle-source.js +14 -2
  1077. package/dist/lib/bundle-source.js.map +1 -1
  1078. package/dist/lib/context-git.js +2 -2
  1079. package/dist/lib/context-git.js.map +1 -1
  1080. package/dist/lib/frontmatter.d.ts.map +1 -1
  1081. package/dist/lib/frontmatter.js +4 -2
  1082. package/dist/lib/frontmatter.js.map +1 -1
  1083. package/dist/lib/scope/attestation-lineage.js +2 -2
  1084. package/dist/lib/scope/attestation-lineage.js.map +1 -1
  1085. package/dist/lib/scope/logical-checkbox.d.ts.map +1 -1
  1086. package/dist/lib/scope/logical-checkbox.js +18 -0
  1087. package/dist/lib/scope/logical-checkbox.js.map +1 -1
  1088. package/dist/lib/scope/progress-edit.d.ts.map +1 -1
  1089. package/dist/lib/scope/progress-edit.js +11 -1
  1090. package/dist/lib/scope/progress-edit.js.map +1 -1
  1091. package/dist/lib/scope/scaffold-placeholder.js +2 -2
  1092. package/dist/lib/scope/scaffold-placeholder.js.map +1 -1
  1093. package/dist/lib/terminal-cell.d.ts +5 -0
  1094. package/dist/lib/terminal-cell.d.ts.map +1 -0
  1095. package/dist/lib/terminal-cell.js +22 -0
  1096. package/dist/lib/terminal-cell.js.map +1 -0
  1097. package/dist/lib/topology-trace.d.ts +3 -34
  1098. package/dist/lib/topology-trace.d.ts.map +1 -1
  1099. package/dist/lib/topology-trace.js +3 -97
  1100. package/dist/lib/topology-trace.js.map +1 -1
  1101. package/dist/local-db.d.ts +2 -0
  1102. package/dist/local-db.d.ts.map +1 -1
  1103. package/dist/local-db.js +14 -11
  1104. package/dist/local-db.js.map +1 -1
  1105. package/dist/mcp-caller-resolver.d.ts +36 -0
  1106. package/dist/mcp-caller-resolver.d.ts.map +1 -0
  1107. package/dist/mcp-caller-resolver.js +82 -0
  1108. package/dist/mcp-caller-resolver.js.map +1 -0
  1109. package/dist/mcp-http.d.ts +44 -3
  1110. package/dist/mcp-http.d.ts.map +1 -1
  1111. package/dist/mcp-http.js +228 -48
  1112. package/dist/mcp-http.js.map +1 -1
  1113. package/dist/mcp-server.d.ts +28 -1
  1114. package/dist/mcp-server.d.ts.map +1 -1
  1115. package/dist/mcp-server.js +219 -52
  1116. package/dist/mcp-server.js.map +1 -1
  1117. package/dist/mcp-surface.d.ts +3 -2
  1118. package/dist/mcp-surface.d.ts.map +1 -1
  1119. package/dist/node-support.d.ts.map +1 -1
  1120. package/dist/node-support.js +10 -0
  1121. package/dist/node-support.js.map +1 -1
  1122. package/dist/release-surface/extract-surface.d.ts.map +1 -1
  1123. package/dist/release-surface/extract-surface.js +38 -20
  1124. package/dist/release-surface/extract-surface.js.map +1 -1
  1125. package/dist/release-surface/generate.d.ts.map +1 -1
  1126. package/dist/release-surface/generate.js +3 -0
  1127. package/dist/release-surface/generate.js.map +1 -1
  1128. package/dist/release-surface/surface-diff.d.ts +1 -0
  1129. package/dist/release-surface/surface-diff.d.ts.map +1 -1
  1130. package/dist/release-surface/surface-diff.js +19 -18
  1131. package/dist/release-surface/surface-diff.js.map +1 -1
  1132. package/dist/remote-host-ops.d.ts +3 -0
  1133. package/dist/remote-host-ops.d.ts.map +1 -1
  1134. package/dist/remote-host-ops.js +15 -1
  1135. package/dist/remote-host-ops.js.map +1 -1
  1136. package/dist/restore-packet/redaction.d.ts +4 -26
  1137. package/dist/restore-packet/redaction.d.ts.map +1 -1
  1138. package/dist/restore-packet/redaction.js +19 -63
  1139. package/dist/restore-packet/redaction.js.map +1 -1
  1140. package/dist/terminal-orca.d.ts +7 -0
  1141. package/dist/terminal-orca.d.ts.map +1 -0
  1142. package/dist/terminal-orca.js +239 -0
  1143. package/dist/terminal-orca.js.map +1 -0
  1144. package/package.json +3 -3
  1145. package/scripts/check-abi.mjs +15 -0
  1146. package/tui/dist/attention/attention-model.d.ts.map +1 -1
  1147. package/tui/dist/attention/attention-model.js +8 -4
  1148. package/tui/dist/attention/attention-model.js.map +1 -1
  1149. package/tui/dist/connected-assistants.d.ts +1 -1
  1150. package/tui/dist/connected-assistants.d.ts.map +1 -1
  1151. package/tui/dist/connected-assistants.js +3 -1
  1152. package/tui/dist/connected-assistants.js.map +1 -1
  1153. package/tui/dist/crash-cart/start-daemon.d.ts +20 -0
  1154. package/tui/dist/crash-cart/start-daemon.d.ts.map +1 -1
  1155. package/tui/dist/crash-cart/start-daemon.js +56 -0
  1156. package/tui/dist/crash-cart/start-daemon.js.map +1 -1
  1157. package/tui/dist/daemon-client.d.ts +4 -0
  1158. package/tui/dist/daemon-client.d.ts.map +1 -1
  1159. package/tui/dist/daemon-client.js +12 -8
  1160. package/tui/dist/daemon-client.js.map +1 -1
  1161. package/tui/dist/health/health-model.d.ts.map +1 -1
  1162. package/tui/dist/health/health-model.js +2 -0
  1163. package/tui/dist/health/health-model.js.map +1 -1
  1164. package/tui/dist/hydrate.d.ts +3 -1
  1165. package/tui/dist/hydrate.d.ts.map +1 -1
  1166. package/tui/dist/hydrate.js +44 -27
  1167. package/tui/dist/hydrate.js.map +1 -1
  1168. package/tui/dist/live.d.ts +5 -1
  1169. package/tui/dist/live.d.ts.map +1 -1
  1170. package/tui/dist/live.js +20 -2
  1171. package/tui/dist/live.js.map +1 -1
  1172. package/tui/dist/main.js +29 -10
  1173. package/tui/dist/main.js.map +1 -1
  1174. package/tui/dist/pulse/pulse-model.d.ts.map +1 -1
  1175. package/tui/dist/pulse/pulse-model.js +3 -2
  1176. package/tui/dist/pulse/pulse-model.js.map +1 -1
  1177. package/tui/dist/render.d.ts +2 -0
  1178. package/tui/dist/render.d.ts.map +1 -1
  1179. package/tui/dist/render.js +47 -14
  1180. package/tui/dist/render.js.map +1 -1
  1181. package/tui/dist/types.d.ts +10 -4
  1182. package/tui/dist/types.d.ts.map +1 -1
  1183. package/ui/dist/assets/index-Chh-NS8Z.css +32 -0
  1184. package/ui/dist/assets/index-DG_7XFcL.js +628 -0
  1185. package/ui/dist/index.html +2 -2
  1186. package/ui/dist/assets/index-B-sMy02c.js +0 -623
  1187. package/ui/dist/assets/index-DiN7RwWg.css +0 -32
@@ -1,5 +1,6 @@
1
1
  import { RigDeliveryDrainStore } from "./rig-delivery-drain.js";
2
- import { PROMPT_ALERT_TAG, WAKE_ESCALATION_TAG, readWakeLadderBackstop } from "./queue-wake-ladder.js";
2
+ import { PROMPT_ALERT_TAG, WAKE_ESCALATION_TAG, readWakeLadderBackstop, resolveWakeRetryCap } from "./queue-wake-ladder.js";
3
+ import { LADDER_ATTEMPT_PREFIX } from "./queue-stuck-sweep.js";
3
4
  import { withUrgentLine } from "./urgent-line.js";
4
5
  import { quietCustodyBackstop, quietHoldCustody } from "./quiet-hold-custody.js";
5
6
  import { cooperativeReadFile, readRowsCooperatively } from "./execution-candidate-reader.js";
@@ -18,11 +19,11 @@ export const MC_OPERATION_TAG_PREFIX = "mc-operation:";
18
19
  export function mcOperationTag(operation) {
19
20
  return `${MC_OPERATION_TAG_PREFIX}${operation}`;
20
21
  }
21
- import { WAKE_INTENT_PREFIX } from "./outbox-handler.js";
22
+ import { HELD_SENDER_NOTICE_PREFIX, WAKE_INTENT_PREFIX } from "./outbox-handler.js";
22
23
  import { physicalSessionName, SessionRegistry } from "./session-registry.js";
23
24
  import { derivePickup } from "./queue-pickup.js";
24
25
  import { withRecoveryIndex } from "./queue-recovery.js";
25
- import { lastMeaningfulTransitionMany, meaningfulFor, readWaitingView, WaitingStatements } from "./queue-waiting.js";
26
+ import { lastMeaningfulTransition, lastMeaningfulTransitionMany, meaningfulFor, readWaitingView, WaitingStatements } from "./queue-waiting.js";
26
27
  import { isTypedGateBlocker, typedGateBlockerPrefix } from "./queue-blocker.js";
27
28
  export { TYPED_GATE_BLOCKER_PREFIXES, isTypedGateBlocker, typedGateBlockerPrefix } from "./queue-blocker.js";
28
29
  import { isOpenRigSender, OPENRIG_SENDER, wrapPaneEnvelope } from "../lib/pane-envelope.js";
@@ -31,8 +32,9 @@ import { renderQueueHandoffNudge } from "./queue-nudge-text.js";
31
32
  import { getSelfHostId } from "./hosts/fanout-contract.js";
32
33
  import { parseSessionName, isHumanSeatSessionRef } from "./session-name.js";
33
34
  import { isEpisodeRelay, RELAY_CLAIMED_PREFIX, RELAY_FOR_PREFIX, RELAY_KEY_PREFIX, RELAY_TAG } from "./return-route.js";
34
- import { runnerPermissionOrigin } from "./runner-permissions.js";
35
+ import { nativeAskPastWindow, nativePermissionHook, nativeWindowEndedNote, plainYesOrNo, runnerPermissionOrigin } from "./runner-permissions.js";
35
36
  import { isHostPairingAsk } from "./hosts/pairing-ask.js";
37
+ import { renderRelayedAnswers } from "./relayed-answers.js";
36
38
  import { parseReplyToChoice, parseArrivalThread, parseReplyToThreadMissing, formatReplyToChoice, describeReplyToFallback, REPLY_TO_CHOICE_ACTOR } from "./reply-to-choice.js";
37
39
  import { classifyDestination, recordsNoWakeRoute } from "./gateway/destination-resolver.js";
38
40
  import { join } from "node:path";
@@ -125,6 +127,43 @@ const HOSTED_WAKE_ACCEPTED_TAG = "queue:hosted-wake-accepted";
125
127
  /** A first failed intent with typed no-input proof permits one return retry; a claim consumes it. */
126
128
  const WAKE_PRE_INPUT_FAILURE_TAG = "queue:wake-pre-input-failure";
127
129
  const AUTO_UNPARK_BLOCKER_TAG_PREFIX = "queue:auto-unpark:blocker-ref:";
130
+ const autoUnparkLine = (blockerQitemId, qitemId) => `Blocker ${blockerQitemId} resolved; parked qitem ${qitemId} is pending. Resume the recorded continuation and update the row.`;
131
+ /** The text of wakes that go in one send. #3896: the unpark wakes of rows parked on one blocker name the blocker once,
132
+ * then the rows, when their frozen envelopes differ only in the row (same sender, stamp and urgency); any other member
133
+ * keeps its own body. Each member still records its own outcome. */
134
+ function joinWakeBodies(members) {
135
+ const merged = new Map();
136
+ const parts = [];
137
+ for (const entry of members) {
138
+ const blocker = entry.tags?.includes(AUTO_UNPARK_WAKE_TAG)
139
+ ? entry.tags.find((tag) => tag.startsWith(AUTO_UNPARK_BLOCKER_TAG_PREFIX))?.slice(AUTO_UNPARK_BLOCKER_TAG_PREFIX.length)
140
+ : undefined;
141
+ const line = blocker && entry.auditPointer ? autoUnparkLine(blocker, entry.auditPointer) : undefined;
142
+ const at = line ? entry.body.indexOf(line) : -1;
143
+ if (!blocker || !line || at === -1 || entry.body.indexOf(line, at + 1) !== -1) {
144
+ parts.push(entry.body);
145
+ continue;
146
+ }
147
+ const head = entry.body.slice(0, at);
148
+ const tail = entry.body.slice(at + line.length);
149
+ const key = JSON.stringify([blocker, head, tail]);
150
+ const group = merged.get(key);
151
+ if (group) {
152
+ group.rows.push(entry.auditPointer);
153
+ continue;
154
+ }
155
+ merged.set(key, { blocker, head, tail, rows: [entry.auditPointer] });
156
+ parts.push({ key });
157
+ }
158
+ return parts.map((part) => {
159
+ if (typeof part === "string")
160
+ return part;
161
+ const { blocker, head, tail, rows } = merged.get(part.key);
162
+ const text = rows.length === 1 ? autoUnparkLine(blocker, rows[0])
163
+ : `Blocker ${blocker} resolved; ${rows.length} parked qitems are pending:\n${rows.map((row) => `- ${row}`).join("\n")}\nResume each row's recorded continuation and update the row.`;
164
+ return head + text + tail;
165
+ }).join("\n");
166
+ }
128
167
  /** The actor on the transition routeToFallback writes; the row's own history is how a later reroute finds the line it wrote. */
129
168
  const FALLBACK_ACTOR = "system:queue-fallback";
130
169
  /** The actor a terminal act is recorded as when it names no responder: explicitly unattributed, never a person. */
@@ -479,6 +518,17 @@ function detectQueueColumn(db, columnName) {
479
518
  return false;
480
519
  }
481
520
  }
521
+ /** A recorded evidence_ref_roots value. One that can't be read is a scoped writer whose roots are unknown: no roots,
522
+ * never a writer without a grant. */
523
+ function evidenceRefRootsOf(raw) {
524
+ try {
525
+ const parsed = JSON.parse(raw);
526
+ return Array.isArray(parsed) ? parsed.filter((root) => typeof root === "string") : [];
527
+ }
528
+ catch {
529
+ return [];
530
+ }
531
+ }
482
532
  export function detectTable(db, tableName) {
483
533
  try {
484
534
  return !!db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(tableName);
@@ -623,6 +673,7 @@ function destinationValidationError(field, session, loadRegistry) {
623
673
  function isWakeTimeoutSignal(s) {
624
674
  return !!s && /timeout|timed\s*out|etimedout/i.test(s);
625
675
  }
676
+ export { buildQueueTransfer } from "./queue-transfer-export.js";
626
677
  export class QueueRepository {
627
678
  db;
628
679
  deliveryDrains;
@@ -648,6 +699,8 @@ export class QueueRepository {
648
699
  * best-effort {@link maybeNudge} when no store is attached (P34 made that
649
700
  * fallback real code rather than a promise in a comment). */
650
701
  outbox;
702
+ /** #2829 slice 1 — cold-start notifier, late-wired by startup after the restore orchestrator exists. */
703
+ wakeWithoutReceiverNotifier;
651
704
  // A first clear may recover durable refusals observed before startup. Later clears need
652
705
  // a new positive refusal/attention episode, so a returning prompt cannot spin retries.
653
706
  promptRecoveryState = new Map();
@@ -671,6 +724,7 @@ export class QueueRepository {
671
724
  hasHumanQuestionsColumn;
672
725
  hasDelegatedDecisionColumn;
673
726
  hasEvidenceRefColumn;
727
+ hasEvidenceRefRootsColumn;
674
728
  hasMintingGenColumn;
675
729
  hasClaimedGenColumn;
676
730
  hasQueueTransitionsTable;
@@ -726,6 +780,7 @@ export class QueueRepository {
726
780
  this.hasHumanQuestionsColumn = detectQueueColumn(db, "human_questions");
727
781
  this.hasDelegatedDecisionColumn = detectQueueColumn(db, "delegated_decision");
728
782
  this.hasEvidenceRefColumn = detectQueueColumn(db, "evidence_ref");
783
+ this.hasEvidenceRefRootsColumn = detectQueueColumn(db, "evidence_ref_roots");
729
784
  this.hasQueueTransitionsTable = detectTable(db, "queue_transitions");
730
785
  this.hasErasedIdsTable = detectTable(db, "queue_erased_ids");
731
786
  const transitionColumns = this.hasQueueTransitionsTable
@@ -897,7 +952,7 @@ export class QueueRepository {
897
952
  // OpenRig's own row is marked urgent by OpenRig, not by the person whose obligation it's about.
898
953
  return { source: trigger, urgent, ...(urgent && row ? { urgentBy: trigger === "openrig" ? "OpenRig" : row.sourceSession } : {}) };
899
954
  }
900
- classifyWakeResult(res) {
955
+ classifyWakeResult(res, destinationSession) {
901
956
  // Held by the seat's hold or interruption level (on purpose; a retry is held again) is the typing guard's; any other
902
957
  // retention is the draft-aware delivery's (a draft, an unreadable input, a native prompt), which can clear.
903
958
  if (res.outcome === "retained")
@@ -907,16 +962,29 @@ export class QueueRepository {
907
962
  // The bridge owns the row now (handed to the hook, typed by its fallback, or named uncertain), so it isn't finalized.
908
963
  if (res.outcome === "bridged")
909
964
  return { classified: "bridged", nudgeResult: "bridged:queued" };
965
+ // The nudge result keeps its words; a wake that reached a seat at its usage limit, or may have, also gets a note on the row.
966
+ const usageLimit = res.usageLimit ? { usageLimit: { asOf: res.usageLimit.asOf, resetsAt: res.usageLimit.resetsAt,
967
+ ...(res.sessionName ? { sessionName: res.sessionName } : {}) } } : {};
910
968
  if (res.ok)
911
- return res.verified ? { classified: "verified", nudgeResult: "verified" } : { classified: "indeterminate", nudgeResult: "delivered-ack-pending" };
969
+ return res.verified ? { classified: "verified", nudgeResult: "verified", ...usageLimit } : { classified: "indeterminate", nudgeResult: "delivered-ack-pending", ...usageLimit };
912
970
  const detail = res.error ?? res.reason ?? "unknown";
913
971
  // Input evidence survives receipt removal: an issued paste or uncertain Enter is never an unsent failure.
914
972
  const inputUncertain = res.sent === true || res.inputPhase === "attempted" || res.inputPhase === "written"
915
973
  || (res.sent !== false && res.inputPhase !== "not_reached" && (res.reason === "delivery_indeterminate" || res.reason === "submit_failed"));
916
974
  if (inputUncertain || isWakeTimeoutSignal(res.reason) || isWakeTimeoutSignal(res.error)) {
917
- return { classified: "indeterminate", nudgeResult: `indeterminate:${detail}` };
975
+ return { classified: "indeterminate", nudgeResult: `indeterminate:${detail}`, ...usageLimit };
976
+ }
977
+ const outcome = { classified: "failed", nudgeResult: `failed:${detail}`, preInputFailure: res.inputPhase === "not_reached" && res.sent !== true };
978
+ // #2829 slice 1 — positive no-receiver evidence rides the shared send path: a send
979
+ // that never reached the input phase means the seat was gone before the wake could be
980
+ // typed. Best-effort; it can never change this classification.
981
+ if (outcome.preInputFailure === true && destinationSession !== undefined) {
982
+ try {
983
+ this.wakeHasNoReceiver(destinationSession);
984
+ }
985
+ catch { /* never changes the outcome */ }
918
986
  }
919
- return { classified: "failed", nudgeResult: `failed:${detail}`, preInputFailure: res.inputPhase === "not_reached" && res.sent !== true };
987
+ return outcome;
920
988
  }
921
989
  /**
922
990
  * W1 (transactional closure): attach the durable wake-intent store AFTER
@@ -934,6 +1002,12 @@ export class QueueRepository {
934
1002
  }
935
1003
  this.outbox = outbox;
936
1004
  }
1005
+ /** #2829 slice 1 — late-wired cold-start notifier. Fired (fire-and-forget, never
1006
+ * awaited, never throwing) whenever a wake's destination provably has no receiver:
1007
+ * the drain's skip branch and the unroutable send classification both land here. */
1008
+ attachWakeWithoutReceiverNotifier(notifier) {
1009
+ this.wakeWithoutReceiverNotifier = notifier;
1010
+ }
937
1011
  /** The one transition-write classifier. It consumes structured state/action facts only. */
938
1012
  classifyOwnerNotification(input) {
939
1013
  if (input.explicitKind === "human-decision-resolved") {
@@ -1100,7 +1174,7 @@ export class QueueRepository {
1100
1174
  fromSession: input.fromSession,
1101
1175
  toSession: input.destinationSession,
1102
1176
  identityProvenance: input.identityProvenance,
1103
- bareBody: `Blocker ${input.blockerQitemId} resolved; parked qitem ${input.qitemId} is pending. Resume the recorded continuation and update the row.`,
1177
+ bareBody: autoUnparkLine(input.blockerQitemId, input.qitemId),
1104
1178
  tags: [AUTO_UNPARK_WAKE_TAG, WAKE_TRIGGER_OPENRIG_TAG, `${AUTO_UNPARK_BLOCKER_TAG_PREFIX}${input.blockerQitemId}`, `queue:return:${input.blockerQitemId}`],
1105
1179
  });
1106
1180
  }
@@ -1331,9 +1405,9 @@ export class QueueRepository {
1331
1405
  })();
1332
1406
  released.push(entry);
1333
1407
  }
1334
- return { text: recoveryNotice(keep) + keep.map(entry => entry.body).join("\n"), outboxIds: keep.map(entry => entry.outboxId) };
1408
+ return { text: recoveryNotice(keep) + joinWakeBodies(keep), outboxIds: keep.map(entry => entry.outboxId) };
1335
1409
  };
1336
- const outcome = await this.performWakeSend(qitemId, intent.destinationSession, intent.senderSession, undefined, recoveryNotice(group) + group.map(entry => entry.body).join("\n"), group.map(entry => entry.outboxId), trigger, recheckMembers);
1410
+ const outcome = await this.performWakeSend(qitemId, intent.destinationSession, intent.senderSession, undefined, recoveryNotice(group) + joinWakeBodies(group), group.map(entry => entry.outboxId), trigger, recheckMembers);
1337
1411
  // A bridged wake isn't confirmed, so the pass counts it as unconfirmed; its row is the bridge's to settle.
1338
1412
  let reportedState = outcome.classified === "verified" ? "delivered"
1339
1413
  : outcome.classified === "bridged" ? "indeterminate" : outcome.classified;
@@ -1354,7 +1428,7 @@ export class QueueRepository {
1354
1428
  : undefined;
1355
1429
  const wakeEvent = this.db.transaction(() => {
1356
1430
  if (!this.wakeOutcomeStale(intent))
1357
- this.recordNudgeAttempt(qitemId, nudgeResult);
1431
+ this.recordNudgeAttempt(qitemId, nudgeResult, outcome.usageLimit);
1358
1432
  if (finalState)
1359
1433
  this.outbox.finalizeDelivery(intent.outboxId, finalState);
1360
1434
  // Only a first attempt creates proof: an actual retry consumes it even if it again fails before input.
@@ -1441,6 +1515,7 @@ export class QueueRepository {
1441
1515
  if (!this.outbox || !this.transport)
1442
1516
  return tally;
1443
1517
  const attempted = new Set();
1518
+ const coldStartPass = {};
1444
1519
  // Notifications left alone for want of a receiver; one a later claim in this pass attempted isn't waiting.
1445
1520
  const skipped = new Map();
1446
1521
  const result = () => {
@@ -1469,7 +1544,7 @@ export class QueueRepository {
1469
1544
  const eligible = (entry) => {
1470
1545
  if (opts?.stopRequested?.() || opts?.eligible && !opts.eligible(entry))
1471
1546
  return false;
1472
- if (entry.deliveryState === "pending" || !this.wakeHasNoReceiver(entry.destinationSession))
1547
+ if (entry.deliveryState === "pending" || !this.wakeHasNoReceiver(entry.destinationSession, coldStartPass))
1473
1548
  return true;
1474
1549
  skipped.set(entry.outboxId, entry.destinationSession);
1475
1550
  return false;
@@ -1503,11 +1578,11 @@ export class QueueRepository {
1503
1578
  * move the row's last nudge time, which the stuck sweep reads as new evidence; #2939), or the newest session under
1504
1579
  * the name the transport sends to has stopped (exited, or detached because its tmux session is gone). A canonical
1505
1580
  * address resolves to its current physical session first. Anything unknown may have a receiver. */
1506
- wakeHasNoReceiver(destinationSession) {
1581
+ wakeHasNoReceiver(destinationSession, drainPass) {
1507
1582
  try {
1508
1583
  const destClass = this.classifyDestinationOf(destinationSession).class;
1509
1584
  if (destClass === "unroutable")
1510
- return true;
1585
+ return this.noteWakeWithoutReceiver(destinationSession, drainPass);
1511
1586
  if (destClass !== "pane-bound")
1512
1587
  return false;
1513
1588
  const physical = physicalSessionName(this.db, destinationSession);
@@ -1515,12 +1590,23 @@ export class QueueRepository {
1515
1590
  return true;
1516
1591
  const newest = this.db.prepare("SELECT status FROM sessions WHERE session_name = ? ORDER BY id DESC LIMIT 1")
1517
1592
  .get(physical);
1518
- return newest?.status === "exited" || newest?.status === "detached";
1593
+ return (newest?.status === "exited" || newest?.status === "detached") && this.noteWakeWithoutReceiver(destinationSession, drainPass);
1519
1594
  }
1520
1595
  catch {
1521
1596
  return false;
1522
1597
  }
1523
1598
  }
1599
+ /** #2829 slice 1 — positive no-receiver evidence is the cold-start trigger. The notifier is
1600
+ * fire-and-forget and can never change the predicate's value or throw into its caller. */
1601
+ noteWakeWithoutReceiver(destinationSession, drainPass) {
1602
+ try {
1603
+ this.wakeWithoutReceiverNotifier?.(destinationSession, drainPass);
1604
+ }
1605
+ catch {
1606
+ /* a notifier failure must never change delivery semantics */
1607
+ }
1608
+ return true;
1609
+ }
1524
1610
  /**
1525
1611
  * Issue a default nudge to the destination after a create / handoff /
1526
1612
  * handoff-and-complete commit. Records the result via recordNudgeAttempt.
@@ -1551,7 +1637,11 @@ export class QueueRepository {
1551
1637
  if (!this.transport)
1552
1638
  return;
1553
1639
  const outcome = await this.performWakeSend(qitemId, destinationSession, sourceSession, bodyOverride, undefined, undefined, trigger, undefined, opts?.explicit === true);
1554
- this.recordNudgeAttempt(qitemId, outcome.nudgeResult);
1640
+ // #2829 slice 1 — `preInputFailure` is the honest no-receiver shape: the input phase
1641
+ // was never reached and nothing was sent, meaning the seat was gone before the wake
1642
+ // could be typed. The positive-evidence check itself rides the shared send path
1643
+ // (performWakeSend / classifyWakeResult) and covers this caller.
1644
+ this.recordNudgeAttempt(qitemId, outcome.nudgeResult, outcome.usageLimit);
1555
1645
  }
1556
1646
  /** The following startup intent drain owns durable pending wakes. Legacy packets
1557
1647
  * and overdue claimed work (not eligible for that drain) still use the nudge path. */
@@ -1714,6 +1804,107 @@ export class QueueRepository {
1714
1804
  await this.maybeNudge(qitem_id, row.destinationSession, undefined, row.sourceSession);
1715
1805
  }
1716
1806
  }
1807
+ /** #48: a queue wake the draft-aware guard held is tried again when its seat reports idle, through the same guarded
1808
+ * delivery, which re-checks the input and holds it again if it still can't go. Only while the seat is still in
1809
+ * draft-aware mode: switching modes alone replays nothing, and a retry already admitted goes once. Only rows created
1810
+ * straight to the seat: a handed-off row's retries are the wake ladder's. A hold-mode wake is never retried. Each try
1811
+ * is one of the ladder's attempts, so the existing wake retry cap bounds them; the ladder's one held notice comes past
1812
+ * that cap or the unconfirmed window. */
1813
+ async retryDraftHeldWakesOnIdle(sessionName, state) {
1814
+ if (state !== "idle" || !this.outbox || !this.transport?.draftAwareTarget?.(sessionName))
1815
+ return;
1816
+ const addresses = this.resolveSessionAddresses(sessionName);
1817
+ if (!addresses.length || addresses.some(address => this.deliveryDrains.holds(address)))
1818
+ return;
1819
+ // As for a prompt clear (#2575): while a compaction's restore is owed, the wake would reach the agent before it.
1820
+ if ([sessionName, ...addresses].some(address => this.hasPendingPostCompactStage?.(address)))
1821
+ return;
1822
+ const rows = this.db.prepare(`SELECT qitem_id FROM queue_items WHERE state = 'pending' AND claimed_at IS NULL
1823
+ AND handed_off_from IS NULL AND destination_session IN (${addresses.map(() => "?").join(",")})
1824
+ AND last_nudge_result = 'retained:draft_aware' ORDER BY ts_created, qitem_id`).all(...addresses);
1825
+ const cap = resolveWakeRetryCap();
1826
+ for (const { qitem_id } of rows) {
1827
+ const intent = `${WAKE_INTENT_PREFIX}${qitem_id}`;
1828
+ const after = lastMeaningfulTransition(this.db, qitem_id)?.id ?? 0;
1829
+ const tries = this.db.prepare(`SELECT COUNT(*) AS n FROM queue_transitions WHERE qitem_id = ? AND transition_id > ?
1830
+ AND transition_note LIKE '${LADDER_ATTEMPT_PREFIX}%'`).get(qitem_id, after).n;
1831
+ if (tries >= cap || !this.outbox.reopenHeld(intent))
1832
+ continue;
1833
+ const outcome = await this.deliverWakeIntent(intent);
1834
+ const row = this.getById(qitem_id);
1835
+ if (row)
1836
+ this.transitionLog.append({ qitemId: qitem_id, state: row.state, actorSession: "wake-ladder@system",
1837
+ transitionNote: `${LADDER_ATTEMPT_PREFIX} ${tries + 1}/${cap} outcome=${row.lastNudgeResult ?? outcome} trigger=seat-idle` });
1838
+ }
1839
+ }
1840
+ /** #48: the wake ladder's one notice to a held row's sender in one held episode, recorded in the outbox before the ladder
1841
+ * marks the owner's rung, so a restart before it's sent, or a send that definitely wrote nothing, leaves it owed rather
1842
+ * than lost. Recording it again in the same episode returns the same entry. Null with no outbox: the ladder then sends
1843
+ * it at once with noticeHeldSender, as before, with no custody. */
1844
+ stageHeldSenderNotice(qitemId, episode, sender, body) {
1845
+ if (!this.outbox)
1846
+ return null;
1847
+ const outboxId = `${HELD_SENDER_NOTICE_PREFIX}${qitemId}-${episode}`;
1848
+ this.outbox.record({ outboxId, senderSession: OPENRIG_SENDER, destinationSession: sender, body, auditPointer: qitemId });
1849
+ return outboxId;
1850
+ }
1851
+ /** #48: send a recorded sender notice, as noticeHeldSender does. Only one never tried, or one whose last try definitely
1852
+ * wrote nothing, is sent; delivered, uncertain, held or in-flight ones aren't sent again. The entry keeps the actual
1853
+ * outcome (delivered, failed, indeterminate or retained), and the returned string is the ladder's record. */
1854
+ async deliverHeldSenderNotice(outboxId) {
1855
+ if (!this.outbox || !this.transport)
1856
+ return "skipped:no transport";
1857
+ const entry = this.outbox.getById(outboxId);
1858
+ if (!entry)
1859
+ return "skipped:no notice";
1860
+ if (!this.outbox.claimUnsent(outboxId))
1861
+ return `skipped:${entry.deliveryState}`;
1862
+ let outcome;
1863
+ try {
1864
+ outcome = this.classifyWakeResult(await this.transport.send(entry.destinationSession, wrapPaneEnvelope(OPENRIG_SENDER, entry.destinationSession, entry.body), { verify: true, actorSession: OPENRIG_SENDER, openrigNotice: true }));
1865
+ }
1866
+ catch (error) {
1867
+ const message = error instanceof Error ? error.message : String(error);
1868
+ outcome = isWakeTimeoutSignal(message) ? { classified: "indeterminate", nudgeResult: `indeterminate:${message}` }
1869
+ : { classified: "failed", nudgeResult: `failed:${message}` };
1870
+ }
1871
+ // Only a definite no-write stays retryable; anything that may have reached the sender is never sent again.
1872
+ this.outbox.finalizeDelivery(outboxId, outcome.classified === "verified" ? "delivered" : outcome.classified === "failed" ? "failed"
1873
+ : outcome.classified === "retained" ? "retained" : "indeterminate");
1874
+ return outcome.nudgeResult;
1875
+ }
1876
+ /** #48: recorded sender notices still owed (never tried, or definitely not written), oldest first. */
1877
+ listOwedHeldSenderNotices(limit = 50, after) {
1878
+ if (!this.outbox)
1879
+ return [];
1880
+ // A page starts after `after` in the same order, so a caller can go past entries it can't act on yet.
1881
+ const ts = after?.ts ?? null;
1882
+ return this.db.prepare(`SELECT rowid, outbox_id, destination_session, audit_pointer, delivery_state, ts_dispatched FROM outbox_entries
1883
+ WHERE substr(outbox_id, 1, ?) = ? AND delivery_state IN ('pending','failed')
1884
+ AND (? IS NULL OR ts_dispatched > ? OR (ts_dispatched = ? AND rowid > ?))
1885
+ ORDER BY ts_dispatched, rowid LIMIT ?`)
1886
+ .all(HELD_SENDER_NOTICE_PREFIX.length, HELD_SENDER_NOTICE_PREFIX, ts, ts, ts, after?.rowid ?? 0, limit)
1887
+ .map((row) => ({ outboxId: row.outbox_id, sender: row.destination_session, qitemId: row.audit_pointer, state: row.delivery_state,
1888
+ cursor: { ts: row.ts_dispatched, rowid: row.rowid } }));
1889
+ }
1890
+ /** #48: a recorded sender notice whose row is no longer held in that episode isn't sent; it's retired with the reason. */
1891
+ retireHeldSenderNotice(outboxId, actor, reason) {
1892
+ return this.outbox?.retireUnsent(outboxId, actor, reason) ?? false;
1893
+ }
1894
+ /** #48: the wake ladder's one notice to a held row's sender, sent as OpenRig through the same guarded transport (the
1895
+ * sender's own guard applies), with no custody: the path for a repository with no outbox. Returns the outcome for the
1896
+ * ladder's record. */
1897
+ async noticeHeldSender(sender, body) {
1898
+ if (!this.transport)
1899
+ return "skipped:no transport";
1900
+ try {
1901
+ const res = await this.transport.send(sender, wrapPaneEnvelope(OPENRIG_SENDER, sender, body), { verify: true, actorSession: OPENRIG_SENDER, openrigNotice: true });
1902
+ return res.verified ? "verified" : !res.ok ? `failed:${res.reason ?? res.error ?? "unknown"}` : res.outcome ?? "sent-unverified";
1903
+ }
1904
+ catch (error) {
1905
+ return `failed:${error instanceof Error ? error.message : String(error)}`;
1906
+ }
1907
+ }
1717
1908
  /**
1718
1909
  * W1 (transactional closure): the shared wake-send CORE. Builds the pane
1719
1910
  * envelope, sends with verify, and CLASSIFIES the transport result into the W1
@@ -1757,6 +1948,9 @@ export class QueueRepository {
1757
1948
  };
1758
1949
  }
1759
1950
  if (destClass.class === "unroutable") {
1951
+ // #2829 slice 1 — positive no-receiver evidence: the queue's cold-start
1952
+ // trigger. Fire-and-forget; it can never change this classification.
1953
+ this.noteWakeWithoutReceiver(destinationSession);
1760
1954
  return { classified: "failed", nudgeResult: destClass.teaching };
1761
1955
  }
1762
1956
  // A hosted member with a trigger: ring it. Accepted is indeterminate, never verified: pickup is its claim.
@@ -1819,7 +2013,7 @@ export class QueueRepository {
1819
2013
  // expired — so it records `indeterminate` (never silently delivered, never a
1820
2014
  // hard `failed`). A definite non-timeout failure (unreachable, unknown
1821
2015
  // session) stays `failed`.
1822
- return this.classifyWakeResult(res);
2016
+ return this.classifyWakeResult(res, destinationSession);
1823
2017
  }
1824
2018
  catch (err) {
1825
2019
  const msg = err instanceof Error ? err.message : String(err);
@@ -1827,6 +2021,12 @@ export class QueueRepository {
1827
2021
  if (isWakeTimeoutSignal(msg)) {
1828
2022
  return { classified: "indeterminate", nudgeResult: `indeterminate:${msg}` };
1829
2023
  }
2024
+ // #2829 slice 1 — a thrown send is still an attempted send: the same positive
2025
+ // no-receiver evidence check rides here (best-effort, never changes the outcome).
2026
+ try {
2027
+ this.wakeHasNoReceiver(destinationSession);
2028
+ }
2029
+ catch { /* never changes the outcome */ }
1830
2030
  return { classified: "failed", nudgeResult: `failed:${msg}` };
1831
2031
  }
1832
2032
  }
@@ -1890,12 +2090,16 @@ export class QueueRepository {
1890
2090
  const ask = this.getById(askId);
1891
2091
  if (!this.hasReplyToColumn || !ask || ask.humanIntent === "update" || !this.isPersonAddress(ask.destinationSession))
1892
2092
  return [];
2093
+ if (ask.relayedAnswers) {
2094
+ const { relays, corrections, directAnswers = [], unplacedReplies = [], returnId } = ask.relayedAnswers;
2095
+ return [...[...directAnswers, ...relays].map(answer => ({ ...answer, qitemId: returnId })), ...corrections, ...unplacedReplies].sort((a, b) => a.at.localeCompare(b.at));
2096
+ }
1893
2097
  const candidates = this.db.prepare(`SELECT qitem_id, source_session, ts_created,
1894
2098
  EXISTS (SELECT 1 FROM json_each(queue_items.tags) WHERE value = 'human-answer') AS tagged
1895
2099
  FROM queue_items
1896
2100
  WHERE reply_to = ? AND destination_session = ?
1897
2101
  AND (EXISTS (SELECT 1 FROM json_each(queue_items.tags) WHERE value = 'human-answer')
1898
- OR (qitem_id LIKE 'qitem-slack-inbound-%' AND COALESCE(summary, '') NOT LIKE '[Recovered after gap] %'))
2102
+ ${this.hasSummaryColumn ? "OR (qitem_id LIKE 'qitem-slack-inbound-%' AND COALESCE(summary, '') NOT LIKE '[Recovered after gap] %')" : ""})
1899
2103
  ORDER BY ts_created, rowid`).all(askId, ask.sourceSession)
1900
2104
  .filter((row) => !this.isSharedChannel(row.source_session)
1901
2105
  && (this.answersAsk(ask, row.source_session) || (row.tagged === 1 && row.source_session === UNATTRIBUTED_ACTOR)));
@@ -1929,6 +2133,195 @@ export class QueueRepository {
1929
2133
  const row = episode ? this.getById(humanAnswerId(qitemId, episode.key)) : null;
1930
2134
  return row?.sourceSession === actorSession ? row : null;
1931
2135
  }
2136
+ /** The history, linked return, close and wake intent commit together. */
2137
+ writeRelayedAnswer(input, envelope) {
2138
+ const events = [];
2139
+ const wakes = [];
2140
+ const result = this.db.transaction(() => {
2141
+ const ask = this.getByIdOrThrow(input.qitemId);
2142
+ const refuse = (message) => { throw new QueueRepositoryError("relayed_answer_refused", message); };
2143
+ if (!this.isPersonAddress(ask.destinationSession) || this.isPersonAddress(ask.sourceSession)
2144
+ || ask.humanIntent === "update" || ask.delegatedDecision || runnerPermissionOrigin(ask)
2145
+ || isHostPairingAsk(ask) || ask.tags?.includes("runner-permission") || ask.tags?.includes(PROMPT_ALERT_TAG)) {
2146
+ refuse("Only ordinary asks to a person take relayed answers, not permission requests or host pairing.");
2147
+ }
2148
+ const questions = ask.humanQuestions ?? [];
2149
+ const submission = "relay" in input ? input.relay : input.direct;
2150
+ const named = questions.find(q => q.id === submission.questionId);
2151
+ const option = named?.options.find(option => option.id === submission.optionId);
2152
+ if (("relay" in input && (questions.length ? !named : submission.questionId !== undefined))
2153
+ || (submission.optionId !== undefined && !option)) {
2154
+ refuse("Name the exact question and, for a choice, a valid option on that question.");
2155
+ }
2156
+ let journal = ask.relayedAnswers ?? { relays: [], corrections: [], returnId: null };
2157
+ const directAnswersAtEntry = journal.directAnswers?.length ?? 0;
2158
+ let direct = ask.humanAnswers ?? {};
2159
+ const relayedQuestions = () => questions.filter(q => journal.relays.some(answer => answer.questionId === q.id));
2160
+ const openQuestions = () => unansweredQuestions(questions.filter(q => !journal.relays.some(r => r.questionId === q.id)), direct);
2161
+ const unanswered = () => ask.state === "pending" ? openQuestions().map(q => q.id) : [];
2162
+ const receipt = (replyQitemId = journal.returnId, disposition) => ({
2163
+ item: this.getByIdOrThrow(input.qitemId), replyQitemId, unanswered: unanswered(), ...(disposition ? { [disposition]: true } : {}),
2164
+ });
2165
+ const at = new Date().toISOString();
2166
+ const identity = { identityProvenance: input.identityProvenance, identityPrincipal: input.identityPrincipal };
2167
+ const deliver = (qitemId, summary, body, tag) => {
2168
+ const create = { qitemId, sourceSession: input.actorSession, destinationSession: ask.sourceSession, summary, body,
2169
+ tags: [tag, ...(ask.tags ?? []).filter(t => /^(project|mission|slice):/.test(t))], inboundReplyTo: ask.qitemId,
2170
+ nudge: input.nudge, ...identity };
2171
+ events.push(this.createWithinTransaction(create).persistedEvent);
2172
+ if (this.outbox)
2173
+ this.stageHandoffWake(qitemId, create.sourceSession, create.destinationSession, sideEffectProvenance(input.identityProvenance), input.nudge);
2174
+ wakes.push(create);
2175
+ };
2176
+ let correctionId;
2177
+ let unplacedId;
2178
+ if ("relay" in input) {
2179
+ const relay = input.relay;
2180
+ const questionId = named?.id ?? null;
2181
+ const prior = journal.relays.find(answer => answer.questionId === questionId);
2182
+ if (parseSessionName(input.actorSession).kind !== "canonical" || !this.answersAsk(ask, relay.attributedTo)
2183
+ || !this.isPersonAddress(relay.attributedTo) || this.isSharedChannel(relay.attributedTo)) {
2184
+ refuse("Record as an agent seat and attribute the answer to a person's address (a human seat or @external person), never a shared channel.");
2185
+ }
2186
+ if (prior) {
2187
+ if (prior.recordedBy === input.actorSession && prior.by === relay.attributedTo && prior.text === relay.text
2188
+ && prior.channel === relay.channel && prior.optionId === relay.optionId && prior.answeredAt === relay.answeredAt)
2189
+ return receipt();
2190
+ refuse("This question already has a relay; a direct answer can correct it.");
2191
+ }
2192
+ if (ask.state !== "pending" || ask.blockedOn || (named && Object.hasOwn(direct, named.id))
2193
+ || this.getById(humanAnswerId(ask.qitemId)) || (!ask.relayedAnswers && this.answersForAsk(ask.qitemId).length > 0)) {
2194
+ refuse("This question is not waiting for a relayed answer.");
2195
+ }
2196
+ if (!ask.relayedAnswers && Object.keys(direct).length) {
2197
+ // Partial clicks predate the journal. Recover their real actor and time from the click transitions.
2198
+ const choices = new Map(questions.flatMap(q => q.options.map(o => [
2199
+ `human-answer-recorded: ${JSON.stringify({ questionId: q.id, optionId: o.id })}`,
2200
+ { kind: "direct-answer", questionId: q.id, optionId: o.id, text: o.label },
2201
+ ])));
2202
+ journal = { ...journal, directAnswers: this.transitionLog.listForQitem(ask.qitemId).flatMap(transition => {
2203
+ const choice = choices.get(transition.transitionNote ?? "");
2204
+ return choice ? [{ ...choice, by: transition.actorSession, at: transition.ts }] : [];
2205
+ }) };
2206
+ }
2207
+ journal = { ...journal, relays: [...journal.relays, { kind: "relayed-answer", by: relay.attributedTo, at,
2208
+ recordedBy: input.actorSession, questionId, channel: relay.channel, text: relay.text,
2209
+ ...(relay.optionId !== undefined ? { optionId: relay.optionId } : {}), ...(relay.answeredAt ? { answeredAt: relay.answeredAt } : {}) }] };
2210
+ }
2211
+ else {
2212
+ if (!ask.relayedAnswers || this.isSharedChannel(input.actorSession)
2213
+ || (!input.direct.primaryUser && !this.answersAsk(ask, input.actorSession)))
2214
+ refuse("Only a direct human answer can correct a relay.");
2215
+ const text = input.direct.text ?? option?.label ?? "";
2216
+ if (!text.trim())
2217
+ refuse("Supply the direct answer's words or option.");
2218
+ const { eventId, optionId, attachments, recovering } = input.direct;
2219
+ const history = [...journal.corrections, ...(journal.directAnswers ?? []), ...(journal.unplacedReplies ?? [])];
2220
+ const replay = eventId ? history.find(answer => answer.eventId === eventId)
2221
+ : history.filter(answer => named ? answer.questionId === named.id
2222
+ : answer.questionId === null || (submission.questionId === undefined && "placement" in answer && answer.placement === "first-unanswered"))
2223
+ .sort((a, b) => a.at.localeCompare(b.at)).at(-1);
2224
+ if (replay && (!named || replay.questionId === named.id || (eventId && replay.kind === "unplaced-reply"))
2225
+ && replay.by === input.actorSession && replay.text === text && replay.optionId === optionId) {
2226
+ if (replay.kind === "direct-correction")
2227
+ return receipt(replay.qitemId, "corrected");
2228
+ if (replay.kind === "unplaced-reply")
2229
+ return receipt(replay.qitemId, "unplaced");
2230
+ return receipt();
2231
+ }
2232
+ if (eventId && replay)
2233
+ refuse("This event was already recorded with a different answer.");
2234
+ const waiting = ask.state === "pending" && !ask.blockedOn;
2235
+ const closedByRelay = ask.state === "done" && ask.closureReason === "relayed-answer";
2236
+ const candidates = waiting ? openQuestions() : closedByRelay ? unansweredQuestions(relayedQuestions(), direct) : [];
2237
+ const question = named ?? (!recovering && submission.questionId === undefined && candidates.length === 1 ? candidates[0] : undefined);
2238
+ const questionId = question?.id ?? null;
2239
+ const prior = journal.relays.find(answer => answer.questionId === questionId);
2240
+ const canPlace = (waiting || (closedByRelay && prior !== undefined))
2241
+ && (question !== undefined || (questions.length === 0 && submission.questionId === undefined));
2242
+ if (!canPlace && optionId !== undefined && !recovering) {
2243
+ refuse("This ask is not waiting for an answer or a correction to that question.");
2244
+ }
2245
+ const typedReply = { kind: "typed-reply", text, placement: named ? "explicit" : "first-unanswered",
2246
+ unansweredCount: Math.max(0, openQuestions().length - (prior ? 0 : 1)) };
2247
+ const answer = { by: input.actorSession, at, text, questionId,
2248
+ ...(optionId === undefined ? {} : { optionId }), ...(eventId ? { eventId } : {}) };
2249
+ const placedAnswer = { ...answer, ...(question && optionId === undefined ? { placement: typedReply.placement } : {}) };
2250
+ if (!canPlace || recovering) {
2251
+ unplacedId = humanAnswerId(ask.qitemId, `relay-unplaced:${journal.unplacedReplies?.length ?? 0}`);
2252
+ journal = { ...journal, unplacedReplies: [...(journal.unplacedReplies ?? []),
2253
+ { kind: "unplaced-reply", qitemId: unplacedId, ...answer, questionId: null }] };
2254
+ const describe = (items) => items.map(q => `${q.id}: ${q.question}`).join("; ") || "none";
2255
+ deliver(unplacedId, `Direct reply (not placed): ${ask.summary ?? ask.qitemId}`, `Direct reply from ${input.actorSession} on ${ask.qitemId}; no answer was changed.${named ? ` Selected question: ${named.id}.` : ""}\nOpen questions: ${describe(waiting ? openQuestions() : [])}\nQuestions with a relay: ${describe(relayedQuestions())}\n\n${text}`, "human-reply-unplaced");
2256
+ }
2257
+ else if (question) {
2258
+ direct = { ...direct, [question.id]: optionId ?? typedReply };
2259
+ }
2260
+ if (!unplacedId && prior) {
2261
+ correctionId = humanAnswerId(ask.qitemId, `relay-correction:${journal.corrections.length}`);
2262
+ journal = { ...journal, corrections: [...journal.corrections, { kind: "direct-correction", qitemId: correctionId, ...placedAnswer }] };
2263
+ deliver(correctionId, `Direct correction to a RELAYED answer: ${ask.summary ?? ask.qitemId}`, `Direct correction from ${input.actorSession} to the RELAYED answer on ${ask.qitemId}${question ? `, question ${question.id}${optionId ? `, option ${optionId}` : ""}` : ""}. The relay stays in history. Do not repeat work already performed.\n\n${question && !named ? `${describeTypedReplyPlacement(question, typedReply)}:\n` : ""}${text}`, "human-answer-correction");
2264
+ }
2265
+ else if (!unplacedId) {
2266
+ journal = { ...journal, directAnswers: [...(journal.directAnswers ?? []), { kind: "direct-answer", ...placedAnswer }] };
2267
+ }
2268
+ if (eventId && attachments) {
2269
+ deliver(humanAnswerId(ask.qitemId, `relay-attachments:${eventId}`), `Attachments to a direct answer on ${ask.qitemId}`, attachments.body, attachments.tag);
2270
+ }
2271
+ }
2272
+ const completed = !unplacedId && ask.state === "pending" && unanswered().length === 0;
2273
+ if (completed) {
2274
+ if (!journal.returnId) {
2275
+ // First completion only. After a deliberate reopen, the journal still names the
2276
+ // original return row; re-inserting the same deterministic id would roll back the
2277
+ // correction and its linked reply on a duplicate primary key, so reuse that row.
2278
+ const returnId = humanAnswerId(ask.qitemId, "relayed-answer");
2279
+ deliver(returnId, `Answers recorded with a RELAY: ${ask.summary ?? ask.qitemId}`, `${renderRelayedAnswers(journal, questions, direct)}\n\nIn reply to: ${ask.qitemId} (see its answer history).`, "relayed-answer");
2280
+ journal = { ...journal, returnId };
2281
+ }
2282
+ else if ((journal.directAnswers?.length ?? 0) > directAnswersAtEntry) {
2283
+ // A reopened ask whose direct answer changed: the stored return keeps its first
2284
+ // words, so the changed answer must still reach the asker as a linked correction.
2285
+ // An exact retry returns at the replay check above and never reaches this branch.
2286
+ // The id derives from the cumulative direct-answer count: it only grows across
2287
+ // reopens, so B and C never collide on the deterministic id (a corrections+added
2288
+ // sum would repeat for a direct-only second question).
2289
+ const added = (journal.directAnswers ?? []).slice(directAnswersAtEntry);
2290
+ const updateId = humanAnswerId(ask.qitemId, `relay-return-update:${(journal.directAnswers ?? []).length}`);
2291
+ deliver(updateId, `Direct answer changed on a reopened ask: ${ask.summary ?? ask.qitemId}`, `Direct answer from ${input.actorSession} on ${ask.qitemId} changed after reopen. The stored return keeps its id and history; the words now stand as:\n\n${added.map(a => `${a.questionId ?? "general"}: ${a.text}`).join("\n")}\n\nIn reply to: ${ask.qitemId}.`, "human-answer-correction");
2292
+ }
2293
+ }
2294
+ this.db.prepare("UPDATE queue_items SET relayed_answers = ?, human_answers = ?, ts_updated = ? WHERE qitem_id = ?")
2295
+ .run(JSON.stringify(journal), Object.keys(direct).length ? JSON.stringify(direct) : null, at, ask.qitemId);
2296
+ events.push(...this.updateInTransactionalContext({ qitemId: ask.qitemId, actorSession: input.actorSession, ...identity,
2297
+ transitionNote: completed ? "RELAYED answer set returned to the asking seat" : correctionId ? "Direct correction to a RELAYED answer" : unplacedId ? "Direct reply returned without placing it" : "relay" in input ? "RELAYED answer recorded" : "Direct answer recorded",
2298
+ ...(completed ? { state: "done", closureReason: "relayed-answer", resolution: renderRelayedAnswers(journal, questions, direct) } : {}),
2299
+ }, completed).persistedEvents);
2300
+ return unplacedId ? receipt(unplacedId, "unplaced") : correctionId ? receipt(correctionId, "corrected") : receipt();
2301
+ })();
2302
+ const deliverWakes = () => {
2303
+ for (const wake of wakes) {
2304
+ if (wake.nudge === false || !wake.qitemId)
2305
+ continue;
2306
+ if (this.outbox)
2307
+ this.deliverWakeIntentAfterCommit(`${WAKE_INTENT_PREFIX}${wake.qitemId}`);
2308
+ else
2309
+ void this.maybeNudge(wake.qitemId, wake.destinationSession, wake.nudge, wake.sourceSession)
2310
+ .catch(error => console.warn(`[queue] answer ${wake.qitemId} retained; wake failed`, error));
2311
+ }
2312
+ };
2313
+ if (envelope) {
2314
+ for (const event of events)
2315
+ envelope.register(event);
2316
+ envelope.afterCommit(deliverWakes);
2317
+ }
2318
+ else {
2319
+ for (const event of events)
2320
+ this.eventBus.notifySubscribers(event);
2321
+ deliverWakes();
2322
+ }
2323
+ return result;
2324
+ }
1932
2325
  async create(input, verifyBeforeCreate) {
1933
2326
  // FOUNDER ROOT INVARIANT (2026-08-27, supersedes 51-09 incr 4 / ruling cb19867f Q2):
1934
2327
  // a LOCAL write stores the bare transport identity — no self-host suffix inside one
@@ -2135,7 +2528,7 @@ export class QueueRepository {
2135
2528
  .run(id, ts, ts, input.sourceSession, input.destinationSession, priority, tier, tags, expiresAt, chain, handedOffFrom, input.body);
2136
2529
  }
2137
2530
  this.persistSummary(id, input.summary ?? null);
2138
- this.persistEvidenceRef(id, input.evidenceRef ?? null);
2531
+ this.persistEvidenceRef(id, input.evidenceRef ?? null, input.evidenceRefRoots);
2139
2532
  if (this.hasHumanIntentColumn) {
2140
2533
  this.db.prepare("UPDATE queue_items SET human_intent = ?, human_detail = ? WHERE qitem_id = ?")
2141
2534
  .run(input.humanIntent ?? null, input.humanDetail ?? null, id);
@@ -2218,6 +2611,11 @@ export class QueueRepository {
2218
2611
  const origin = item?.state === "pending" ? runnerPermissionOrigin(item) : null;
2219
2612
  if (!item || !origin)
2220
2613
  return false;
2614
+ // A seat's own native prompt past its window: its hook no longer takes an answer, so one given now would reach no one.
2615
+ if (nativeAskPastWindow(item)) {
2616
+ this.update({ qitemId, actorSession: item.sourceSession, state: "canceled", transitionNote: nativeWindowEndedNote(item) });
2617
+ return true;
2618
+ }
2221
2619
  const authority = this.runnerPermissionAuthority(origin);
2222
2620
  if (authority !== "replaced" && authority !== "absent")
2223
2621
  return false;
@@ -2372,7 +2770,7 @@ export class QueueRepository {
2372
2770
  .run(newId, ts, ts, input.fromSession, input.toSession, priority, tier, tags, source.qitemId, chain, body);
2373
2771
  }
2374
2772
  this.persistSummary(newId, input.summary ?? null);
2375
- this.persistEvidenceRef(newId, input.evidenceRef ?? null);
2773
+ this.persistEvidenceRef(newId, input.evidenceRef ?? null, input.evidenceRefRoots);
2376
2774
  // The goal's return route goes with the work, as its body does.
2377
2775
  this.persistReturnRoute(newId, source.returnRoute ?? null, source.returnRouteBasis ?? null);
2378
2776
  this.persistMintingGeneration(newId, input.fromSession);
@@ -2530,7 +2928,7 @@ export class QueueRepository {
2530
2928
  .run(newId, ts, ts, input.fromSession, input.toSession, priority, tier, tags, source.qitemId, chain, body);
2531
2929
  }
2532
2930
  this.persistSummary(newId, input.summary ?? null);
2533
- this.persistEvidenceRef(newId, input.evidenceRef ?? null);
2931
+ this.persistEvidenceRef(newId, input.evidenceRef ?? null, input.evidenceRefRoots);
2534
2932
  // The goal's return route goes with the work, as its body does.
2535
2933
  this.persistReturnRoute(newId, source.returnRoute ?? null, source.returnRouteBasis ?? null);
2536
2934
  this.persistMintingGeneration(newId, input.fromSession);
@@ -2998,7 +3396,10 @@ export class QueueRepository {
2998
3396
  * (the public update() wraps; the public updateWithinTransaction()
2999
3397
  * composes inside the caller's outer transaction).
3000
3398
  */
3001
- updateInTransactionalContext(input) {
3399
+ updateInTransactionalContext(input, completingRelay = false) {
3400
+ if (input.closureReason === "relayed-answer" && !completingRelay) {
3401
+ throw new QueueRepositoryError("invalid_closure_reason", "Use the relay-answer operation to record a relayed answer.");
3402
+ }
3002
3403
  const qitem = this.getById(input.qitemId);
3003
3404
  if (!qitem) {
3004
3405
  throw new QueueRepositoryError("qitem_not_found", `qitem ${input.qitemId} not found`);
@@ -3083,8 +3484,10 @@ export class QueueRepository {
3083
3484
  actorSession: input.actorSession,
3084
3485
  transitionNote: note,
3085
3486
  // A note-only append does not clear the claim's retained park gate.
3086
- // Carry its audit pointer so a later state write can end this chain.
3087
- closureTarget: qitem.state === "in-progress" ? this.retainedClaimBlocker(input.qitemId) : undefined,
3487
+ // Carry its audit pointer so a later state write can end this chain;
3488
+ // on a parked row the pointer is the blocker the append leaves in place.
3489
+ closureTarget: qitem.state === "in-progress" ? this.retainedClaimBlocker(input.qitemId)
3490
+ : qitem.state === "blocked" ? qitem.blockedOn ?? undefined : undefined,
3088
3491
  identityProvenance: input.identityProvenance ?? null,
3089
3492
  identityPrincipal: input.identityPrincipal ?? null,
3090
3493
  });
@@ -3138,7 +3541,7 @@ export class QueueRepository {
3138
3541
  state: input.state,
3139
3542
  closureReason: input.closureReason ?? null,
3140
3543
  closureTarget: input.closureTarget ?? null,
3141
- });
3544
+ }, completingRelay);
3142
3545
  if (!validation.ok) {
3143
3546
  throw new QueueRepositoryError(validation.code, validation.message, {
3144
3547
  validReasons: "validReasons" in validation ? validation.validReasons : undefined,
@@ -3369,14 +3772,16 @@ export class QueueRepository {
3369
3772
  if (hasValidSummary)
3370
3773
  this.persistSummary(input.qitemId, input.summary);
3371
3774
  if (hasValidEvidenceRef)
3372
- this.persistEvidenceRef(input.qitemId, input.evidenceRef);
3775
+ this.persistEvidenceRef(input.qitemId, input.evidenceRef, input.evidenceRefRoots);
3373
3776
  const transition = this.transitionLog.append({
3374
3777
  qitemId: input.qitemId,
3375
3778
  state: input.state,
3376
3779
  actorSession: input.actorSession,
3377
3780
  transitionNote: isReopen ? `reopen acknowledged: ${input.transitionNote}` : input.transitionNote,
3378
3781
  closureReason: validation.closureReason ?? undefined,
3379
- closureTarget: validation.closureTarget ?? undefined,
3782
+ // A park transition logs the blocker it leaves in force, or none when the row has none: a caller's closure target
3783
+ // never stands in for it. Only the log carries this: queue_items.closure_target above is written from validation alone.
3784
+ closureTarget: input.state === "blocked" ? nextBlockedOn ?? undefined : validation.closureTarget ?? undefined,
3380
3785
  identityProvenance: input.identityProvenance ?? null, // P21 §4 era-stamp
3381
3786
  identityPrincipal: input.identityPrincipal ?? null,
3382
3787
  ownerNotificationKind: notification?.kind,
@@ -3586,6 +3991,18 @@ export class QueueRepository {
3586
3991
  return null;
3587
3992
  return "park_timer_target_terminal";
3588
3993
  }
3994
+ /** A usage-limit blocker's timer is a time event with no recipient: the blocker is addressed to `wake-ladder@<rig>`,
3995
+ * which no seat carries, so an input delivery can never succeed (#3704). When every row this job currently wakes is
3996
+ * such a blocker, its due fire is recorded here, before transport: the blocker resolves once and its dependents are
3997
+ * released. Returns the job's terminal reason, or null to keep the send path. */
3998
+ fireUsageLimitTimerWithoutDelivery(jobId) {
3999
+ const targets = this.wakeRepo.findBlockedQitemsByWatchdog(jobId, true);
4000
+ if (targets.length === 0
4001
+ || !targets.every(({ qitemId }) => this.getById(qitemId)?.tags?.includes(USAGE_LIMIT_BLOCKER_TAG)))
4002
+ return null;
4003
+ this.recordWatchdogWakeAttempt(jobId, "no-recipient");
4004
+ return "usage_limit_expiry_fired";
4005
+ }
3589
4006
  /** OPR.0.7.0.12 — the current park's recorded continuation, bounded (see the transition log). */
3590
4007
  currentParkContinuation(qitemId) {
3591
4008
  return this.transitionLog.currentParkContinuation(qitemId);
@@ -3797,7 +4214,7 @@ export class QueueRepository {
3797
4214
  let mine = true;
3798
4215
  const result = this.db.transaction(() => {
3799
4216
  const item = this.getById(input.qitemId);
3800
- if (item?.state !== "pending" || item.humanIntent === "update"
4217
+ if (item?.state !== "pending" || item.humanIntent === "update" || item.relayedAnswers
3801
4218
  || (!this.answersAsk(item, input.actorSession) && !input.primaryUser)
3802
4219
  || !this.isPersonAddress(item.destinationSession))
3803
4220
  return null;
@@ -3834,6 +4251,15 @@ export class QueueRepository {
3834
4251
  || (!this.answersAsk(item, input.actorSession) && !input.primaryUser) || !this.isPersonAddress(item.destinationSession)
3835
4252
  || this.committedAnswerFromAnother(item.qitemId, input.actorSession))
3836
4253
  return null;
4254
+ // A seat's own native prompt (slice 15): a pick of an offered option, or a plain yes or no, is the person's own answer to
4255
+ // it, relayed as they gave it, with no agent in between; it closes the ask as theirs (the direct reply below). Only their
4256
+ // words go on to the receiving agent, to judge against the exact action.
4257
+ if (nativePermissionHook(item)) {
4258
+ const picked = item.humanAnswers?.[(this.permissionQuestionsFor(item) ?? [])[0]?.id ?? "permission"];
4259
+ const offered = (this.permissionQuestionsFor(item) ?? [])[0]?.options.map((option) => option.id) ?? [];
4260
+ if ((typeof picked === "string" && offered.includes(picked)) || plainYesOrNo(input.decision) !== null)
4261
+ return null;
4262
+ }
3837
4263
  // The requester is the runner seat that asked: the first row of the request, whoever handed it on since.
3838
4264
  let root = item;
3839
4265
  for (let hops = 0; root.handedOffFrom && hops < 10; hops++) {
@@ -3921,6 +4347,9 @@ export class QueueRepository {
3921
4347
  // (The caller read it first: a row already decided explicitly, withdrawn or stale never reaches here.)
3922
4348
  if (item.state === "done" || item.state === "failed") {
3923
4349
  this.db.prepare("UPDATE queue_items SET human_answers = ? WHERE qitem_id = ?").run(JSON.stringify(answers), item.qitemId);
4350
+ if (input.resolution)
4351
+ this.db.prepare("UPDATE queue_items SET resolution = ? WHERE qitem_id = ?")
4352
+ .run(item.resolution ? `${item.resolution}\n${input.resolution}` : input.resolution, item.qitemId);
3924
4353
  this.transitionLog.append({ qitemId: item.qitemId, state: item.state, actorSession: input.actorSession, transitionNote: input.transitionNote });
3925
4354
  // The row's state doesn't change, but its decision does: a runner waiting on this request reads it now, and
3926
4355
  // Steering refreshes.
@@ -3932,7 +4361,7 @@ export class QueueRepository {
3932
4361
  return null;
3933
4362
  this.db.prepare("UPDATE queue_items SET human_answers = ? WHERE qitem_id = ?").run(JSON.stringify(answers), item.qitemId);
3934
4363
  return this.updateInTransactionalContext({ qitemId: item.qitemId, actorSession: input.actorSession, state: "done",
3935
- closureReason: "no-follow-on", transitionNote: input.transitionNote });
4364
+ closureReason: "no-follow-on", transitionNote: input.transitionNote, ...(input.resolution ? { resolution: input.resolution } : {}) });
3936
4365
  })();
3937
4366
  if (!result)
3938
4367
  return false;
@@ -4167,6 +4596,7 @@ export class QueueRepository {
4167
4596
  }
4168
4597
  const decision = [item.body, item.humanIntent ?? null, item.humanQuestions ?? null, phase, item.destinationSession, item.blockedOn,
4169
4598
  item.humanAnswers ?? null, item.delegatedDecision ?? null, this.currentHumanRequiredEpisode(item.qitemId)?.key ?? null, parkEntry, replies,
4599
+ ...(item.relayedAnswers ? [item.relayedAnswers] : []),
4170
4600
  ...(item.evidenceRef ? [item.evidenceRef] : [])];
4171
4601
  return `dr1-${createHash("sha256").update(JSON.stringify(decision)).digest("hex").slice(0, 24)}`;
4172
4602
  }
@@ -4278,7 +4708,7 @@ export class QueueRepository {
4278
4708
  return refuse("permission-prompt", "a permission prompt or approval gate is never decided on the person's behalf");
4279
4709
  }
4280
4710
  // A click keeps a multi-question ask pending until every question is answered: once the person has started, it's theirs.
4281
- if (item.humanAnswers && Object.keys(item.humanAnswers).length > 0) {
4711
+ if (item.relayedAnswers || (item.humanAnswers && Object.keys(item.humanAnswers).length > 0)) {
4282
4712
  return refuse("person-answering", "they've started answering; their answer stands");
4283
4713
  }
4284
4714
  if (item.sourceSession !== input.actorSession) {
@@ -4470,19 +4900,19 @@ export class QueueRepository {
4470
4900
  * about this seat's own prompt that nobody holds is left out: with no operator seat to carry it, the alert falls back
4471
4901
  * to the seat itself, and the escalation is the wake, not the content, so it is never that seat's work. One its owner
4472
4902
  * explicitly holds (blocked) stays, so that hold and its wake are diagnosed as before; so does a row whose tags aren't
4473
- * a JSON array. */
4903
+ * a JSON array. Each row carries its blocker and last update, so a hold is shown with what it waits on and its age. */
4474
4904
  listOpenObligations(destinationSession, limit) {
4475
4905
  const addresses = this.resolveSessionAddresses(destinationSession);
4476
4906
  const slots = addresses.map(() => "?").join(",");
4477
4907
  const ownPrompt = addresses.flatMap((address) => [`prompt-destination:${address}`, `consumed-prompt-destination:${address}`]);
4478
- const rows = this.db.prepare(`SELECT qitem_id, state${this.hasSummaryColumn ? ", summary" : ""} FROM queue_items
4908
+ const rows = this.db.prepare(`SELECT qitem_id, state, blocked_on, ts_updated${this.hasSummaryColumn ? ", summary" : ""} FROM queue_items
4479
4909
  WHERE destination_session IN (${slots}) AND state IN ('pending', 'in-progress', 'blocked')
4480
4910
  AND NOT CASE WHEN state != 'blocked' AND json_valid(tags) THEN CASE WHEN json_type(tags) = 'array' THEN
4481
4911
  EXISTS (SELECT 1 FROM json_each(queue_items.tags) WHERE value = ?)
4482
4912
  AND EXISTS (SELECT 1 FROM json_each(queue_items.tags) WHERE value IN (${ownPrompt.map(() => "?").join(",")}))
4483
4913
  ELSE 0 END ELSE 0 END
4484
4914
  ORDER BY ts_created DESC LIMIT ?`).all(...addresses, WAKE_ESCALATION_TAG, ...ownPrompt, limit);
4485
- return rows.map((r) => ({ qitemId: r.qitem_id, state: r.state, summary: r.summary ?? null }));
4915
+ return rows.map((r) => ({ qitemId: r.qitem_id, state: r.state, summary: r.summary ?? null, blockedOn: r.blocked_on, updatedAt: r.ts_updated }));
4486
4916
  }
4487
4917
  list(opts) {
4488
4918
  // one recovery index for the whole listing (built on first use) instead of one json_each scan per row
@@ -5014,6 +5444,7 @@ export class QueueRepository {
5014
5444
  hasTerminalTransport: (dest) => this.hasTerminalTransport(dest),
5015
5445
  hostedWake: (dest) => this.hostedWakeFn(dest),
5016
5446
  isHostedMember: (dest) => this.hostedMemberFn(dest),
5447
+ hostedCheckIn: (dest) => this.hostedMemberCheckIn(dest),
5017
5448
  });
5018
5449
  }
5019
5450
  /** OPR.0.5.6.14 — terminal transport is a CAPABILITY, not topology presence.
@@ -5272,22 +5703,35 @@ export class QueueRepository {
5272
5703
  * as prompt-clear recovery of a refused wake) read the real end and not `bridged:queued` (#3270). A typed fallback's
5273
5704
  * result is recorded as a typed wake's is. */
5274
5705
  recordBridgedWakeEnd(qitemId, end) {
5275
- const result = end.kind === "typed" && end.result ? this.classifyWakeResult(end.result).nudgeResult
5706
+ const typed = end.kind === "typed" && end.result ? this.classifyWakeResult(end.result) : null;
5707
+ const result = typed ? typed.nudgeResult
5276
5708
  : end.kind === "handed-to-hook" ? "bridged:handed-to-hook"
5277
5709
  : end.kind === "not-delivered" ? "failed:hook_bridge_not_delivered"
5278
5710
  : "indeterminate:hook_bridge_claimed_unacked";
5279
5711
  const intent = this.outbox?.getById(end.outboxId);
5280
5712
  if (intent && this.wakeOutcomeStale(intent))
5281
5713
  return;
5282
- this.recordNudgeAttempt(qitemId, result);
5714
+ this.recordNudgeAttempt(qitemId, result, typed?.usageLimit);
5283
5715
  }
5284
- recordNudgeAttempt(qitemId, result) {
5716
+ recordNudgeAttempt(qitemId, result, usageLimit) {
5285
5717
  const ts = new Date().toISOString();
5286
5718
  this.db
5287
5719
  .prepare(`UPDATE queue_items
5288
5720
  SET last_nudge_attempt = ?, last_nudge_result = ?
5289
5721
  WHERE qitem_id = ?`)
5290
5722
  .run(ts, result, qitemId);
5723
+ if (usageLimit) {
5724
+ // The receipt's words stay as every reader knows them; the row says what they can't. Delivery bookkeeping, so a
5725
+ // reserved daemon actor: it isn't a change to the row for the wake ladder, the stuck sweep or recovery
5726
+ // (lastMeaningfulTransition), as closure-overdue's note isn't.
5727
+ const row = this.getById(qitemId);
5728
+ // It names the session the wake was sent to, which a reroute during the send can't change, and an in-progress row
5729
+ // keeps its retained claim blocker, as every other non-state receipt does.
5730
+ if (row)
5731
+ this.transitionLog.append({ qitemId, state: row.state, actorSession: "daemon@system",
5732
+ transitionNote: `wake reached ${usageLimit.sessionName ?? row.destinationSession}, or may have, at its usage limit (recorded ${usageLimit.asOf}; resets ${usageLimit.resetsAt}); delivery=${result}. Its agent isn't expected to read it before the reset.`,
5733
+ closureTarget: row.state === "in-progress" ? this.retainedClaimBlocker(qitemId) : undefined });
5734
+ }
5291
5735
  // The transport's definite no-write refusal establishes the episode even when a
5292
5736
  // fresh hook hid needs_input. Uncertain delivery never arms clear-triggered replay.
5293
5737
  if (!this.promptClearRetries.has(qitemId) && isPromptOwnedWakeRefusal(result)) {
@@ -5519,10 +5963,16 @@ export class QueueRepository {
5519
5963
  }
5520
5964
  }
5521
5965
  /** OPR.0.4.4.19 FR-5 — persist the optional evidence_ref additively, same
5522
- * contract as persistSummary (pre-048 fixtures degrade; NULL default). */
5523
- persistEvidenceRef(qitemId, evidenceRef) {
5966
+ * contract as persistSummary (pre-048 fixtures degrade; NULL default).
5967
+ * The writer's shared roots are written with the reference, every time it is written, so the authority a later
5968
+ * attachment reads is always this reference's writer's: a state change, note or alert that leaves the reference
5969
+ * alone leaves its authority alone, and a writer with no root grant records null. */
5970
+ persistEvidenceRef(qitemId, evidenceRef, roots) {
5524
5971
  if (this.hasEvidenceRefColumn && evidenceRef !== null) {
5525
5972
  this.db.prepare("UPDATE queue_items SET evidence_ref = ? WHERE qitem_id = ?").run(evidenceRef, qitemId);
5973
+ if (this.hasEvidenceRefRootsColumn) {
5974
+ this.db.prepare("UPDATE queue_items SET evidence_ref_roots = ? WHERE qitem_id = ?").run(roots ? JSON.stringify([...roots]) : null, qitemId);
5975
+ }
5526
5976
  }
5527
5977
  }
5528
5978
  /** A relay task's claim is pickup at its return route. It's recorded on the escalation the task carries, keyed by that
@@ -5825,12 +6275,14 @@ export class QueueRepository {
5825
6275
  // OPR.0.4.4.19 FR-5: evidence_ref present only when migration 048 has
5826
6276
  // applied; legacy fixtures degrade to null.
5827
6277
  evidenceRef: row.evidence_ref ?? null,
6278
+ ...(row.evidence_ref_roots ? { evidenceRefRoots: evidenceRefRootsOf(row.evidence_ref_roots) } : {}),
5828
6279
  humanIntent: row.human_intent ?? null,
5829
6280
  humanDetail: row.human_detail ?? null,
5830
6281
  replyTo: row.reply_to ?? null,
5831
6282
  humanQuestions: row.human_questions ? JSON.parse(row.human_questions) : null,
5832
6283
  humanAnswers: row.human_answers ? JSON.parse(row.human_answers) : null,
5833
6284
  delegatedDecision: row.delegated_decision ? JSON.parse(row.delegated_decision) : null,
6285
+ ...(row.relayed_answers ? { relayedAnswers: JSON.parse(row.relayed_answers) } : {}),
5834
6286
  closureReason: row.closure_reason,
5835
6287
  closureTarget: row.closure_target,
5836
6288
  closureRequiredAt: row.closure_required_at,