@openrig/cli 0.6.9 → 0.6.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (570) hide show
  1. package/README.md +2 -2
  2. package/daemon/assets/onboarding/02-self-and-competent-action.md +4 -3
  3. package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +1 -1
  4. package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
  5. package/daemon/assets/plugins/openrig-core/hooks/scripts/activity-relay.cjs +42 -2
  6. package/daemon/assets/plugins/openrig-core/skills/openrig-skills/SKILL.md +1 -1
  7. package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +7 -1
  8. package/daemon/assets/plugins/openrig-core/skills/refocusing/scripts/trace-to-root.py +6 -1
  9. package/daemon/assets/skills/rigs/SKILL.md +7 -5
  10. package/daemon/context-packs/help/manifest.yaml +1 -1
  11. package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
  12. package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +64 -14
  13. package/daemon/context-packs/reference/getting-started.md +10 -6
  14. package/daemon/context-packs/reference/manifest.yaml +1 -1
  15. package/daemon/context-packs/reference/rig-spec.md +2 -2
  16. package/daemon/context-packs/reference/whats-new.md +151 -74
  17. package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
  18. package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
  19. package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
  20. package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
  21. package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
  22. package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
  23. package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
  24. package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
  25. package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
  26. package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
  27. package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
  28. package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
  29. package/daemon/context-packs/skills/core/openrig-skills/SKILL.md +1 -1
  30. package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +3 -3
  31. package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
  32. package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
  33. package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
  34. package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
  35. package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
  36. package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
  37. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/SKILL.md +2 -2
  38. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
  39. package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
  40. package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
  41. package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
  42. package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
  43. package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
  44. package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
  45. package/daemon/context-packs/skills/openrig-user/SKILL.md +7 -1
  46. package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
  47. package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
  48. package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
  49. package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
  50. package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
  51. package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
  52. package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
  53. package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
  54. package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
  55. package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
  56. package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
  57. package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
  58. package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
  59. package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
  60. package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
  61. package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
  62. package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
  63. package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
  64. package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
  65. package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
  66. package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
  67. package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
  68. package/daemon/context-packs/skills/refocusing/scripts/trace-to-root.py +6 -1
  69. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
  70. package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
  71. package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
  72. package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
  73. package/daemon/context-packs/world-example/manifest.yaml +1 -1
  74. package/daemon/context-packs/world-public/manifest.yaml +1 -1
  75. package/daemon/dist/adapters/claude-code-adapter.d.ts +0 -14
  76. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  77. package/daemon/dist/adapters/claude-code-adapter.js +43 -80
  78. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  79. package/daemon/dist/adapters/claude-resume-launch.d.ts +4 -0
  80. package/daemon/dist/adapters/claude-resume-launch.d.ts.map +1 -0
  81. package/daemon/dist/adapters/claude-resume-launch.js +13 -0
  82. package/daemon/dist/adapters/claude-resume-launch.js.map +1 -0
  83. package/daemon/dist/adapters/claude-resume.d.ts +2 -1
  84. package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
  85. package/daemon/dist/adapters/claude-resume.js +9 -4
  86. package/daemon/dist/adapters/claude-resume.js.map +1 -1
  87. package/daemon/dist/adapters/codex-runtime-adapter.d.ts +35 -0
  88. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  89. package/daemon/dist/adapters/codex-runtime-adapter.js +94 -44
  90. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  91. package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
  92. package/daemon/dist/adapters/pi-runner.js +6 -3
  93. package/daemon/dist/adapters/pi-runner.js.map +1 -1
  94. package/daemon/dist/adapters/pi-runtime-adapter.js +1 -1
  95. package/daemon/dist/adapters/pi-runtime-adapter.js.map +1 -1
  96. package/daemon/dist/adapters/tmux-server.d.ts +15 -0
  97. package/daemon/dist/adapters/tmux-server.d.ts.map +1 -0
  98. package/daemon/dist/adapters/tmux-server.js +58 -0
  99. package/daemon/dist/adapters/tmux-server.js.map +1 -0
  100. package/daemon/dist/adapters/tmux.d.ts +26 -1
  101. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  102. package/daemon/dist/adapters/tmux.js +130 -7
  103. package/daemon/dist/adapters/tmux.js.map +1 -1
  104. package/daemon/dist/build-info.js +3 -3
  105. package/daemon/dist/db/all-migrations.d.ts.map +1 -1
  106. package/daemon/dist/db/all-migrations.js +6 -0
  107. package/daemon/dist/db/all-migrations.js.map +1 -1
  108. package/daemon/dist/db/migrations/099_queue_items_recovery_tags.d.ts +3 -0
  109. package/daemon/dist/db/migrations/099_queue_items_recovery_tags.d.ts.map +1 -0
  110. package/daemon/dist/db/migrations/099_queue_items_recovery_tags.js +19 -0
  111. package/daemon/dist/db/migrations/099_queue_items_recovery_tags.js.map +1 -0
  112. package/daemon/dist/db/migrations/101_claude_resume_rotation.d.ts +3 -0
  113. package/daemon/dist/db/migrations/101_claude_resume_rotation.d.ts.map +1 -0
  114. package/daemon/dist/db/migrations/101_claude_resume_rotation.js +19 -0
  115. package/daemon/dist/db/migrations/101_claude_resume_rotation.js.map +1 -0
  116. package/daemon/dist/db/migrations/103_session_stop_intent.d.ts +4 -0
  117. package/daemon/dist/db/migrations/103_session_stop_intent.d.ts.map +1 -0
  118. package/daemon/dist/db/migrations/103_session_stop_intent.js +9 -0
  119. package/daemon/dist/db/migrations/103_session_stop_intent.js.map +1 -0
  120. package/daemon/dist/domain/active-occupant.d.ts +14 -0
  121. package/daemon/dist/domain/active-occupant.d.ts.map +1 -1
  122. package/daemon/dist/domain/active-occupant.js +17 -0
  123. package/daemon/dist/domain/active-occupant.js.map +1 -1
  124. package/daemon/dist/domain/agent-activity-store.js +3 -0
  125. package/daemon/dist/domain/agent-activity-store.js.map +1 -1
  126. package/daemon/dist/domain/bootstrap-repository.js +1 -1
  127. package/daemon/dist/domain/bootstrap-repository.js.map +1 -1
  128. package/daemon/dist/domain/chat-repository.d.ts +3 -0
  129. package/daemon/dist/domain/chat-repository.d.ts.map +1 -1
  130. package/daemon/dist/domain/chat-repository.js +15 -4
  131. package/daemon/dist/domain/chat-repository.js.map +1 -1
  132. package/daemon/dist/domain/claude-managed-launch.d.ts +1 -1
  133. package/daemon/dist/domain/claude-managed-launch.d.ts.map +1 -1
  134. package/daemon/dist/domain/claude-managed-launch.js +3 -2
  135. package/daemon/dist/domain/claude-managed-launch.js.map +1 -1
  136. package/daemon/dist/domain/cmux-layout-service.d.ts.map +1 -1
  137. package/daemon/dist/domain/cmux-layout-service.js +2 -1
  138. package/daemon/dist/domain/cmux-layout-service.js.map +1 -1
  139. package/daemon/dist/domain/codex-git-add-dirs.js +1 -1
  140. package/daemon/dist/domain/codex-git-add-dirs.js.map +1 -1
  141. package/daemon/dist/domain/codex-network-default.d.ts +3 -0
  142. package/daemon/dist/domain/codex-network-default.d.ts.map +1 -1
  143. package/daemon/dist/domain/codex-network-default.js +1 -1
  144. package/daemon/dist/domain/codex-network-default.js.map +1 -1
  145. package/daemon/dist/domain/codex-pane-patterns.d.ts +2 -0
  146. package/daemon/dist/domain/codex-pane-patterns.d.ts.map +1 -0
  147. package/daemon/dist/domain/codex-pane-patterns.js +5 -0
  148. package/daemon/dist/domain/codex-pane-patterns.js.map +1 -0
  149. package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
  150. package/daemon/dist/domain/context-monitor.js +46 -22
  151. package/daemon/dist/domain/context-monitor.js.map +1 -1
  152. package/daemon/dist/domain/context-usage-store.d.ts.map +1 -1
  153. package/daemon/dist/domain/context-usage-store.js +6 -1
  154. package/daemon/dist/domain/context-usage-store.js.map +1 -1
  155. package/daemon/dist/domain/crash-cart-conductor.d.ts.map +1 -1
  156. package/daemon/dist/domain/crash-cart-conductor.js +3 -1
  157. package/daemon/dist/domain/crash-cart-conductor.js.map +1 -1
  158. package/daemon/dist/domain/cwd-resolution.d.ts +8 -0
  159. package/daemon/dist/domain/cwd-resolution.d.ts.map +1 -1
  160. package/daemon/dist/domain/cwd-resolution.js +24 -3
  161. package/daemon/dist/domain/cwd-resolution.js.map +1 -1
  162. package/daemon/dist/domain/files/file-read.d.ts.map +1 -1
  163. package/daemon/dist/domain/files/file-read.js +11 -3
  164. package/daemon/dist/domain/files/file-read.js.map +1 -1
  165. package/daemon/dist/domain/gateway/connections-projection.d.ts +1 -1
  166. package/daemon/dist/domain/gateway/slack/channel-recovery.d.ts.map +1 -1
  167. package/daemon/dist/domain/gateway/slack/channel-recovery.js +4 -3
  168. package/daemon/dist/domain/gateway/slack/channel-recovery.js.map +1 -1
  169. package/daemon/dist/domain/gateway/slack/inbound.d.ts +21 -2
  170. package/daemon/dist/domain/gateway/slack/inbound.d.ts.map +1 -1
  171. package/daemon/dist/domain/gateway/slack/inbound.js +70 -11
  172. package/daemon/dist/domain/gateway/slack/inbound.js.map +1 -1
  173. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts +4 -0
  174. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts.map +1 -1
  175. package/daemon/dist/domain/gateway/slack/slack-delivery.js +1 -1
  176. package/daemon/dist/domain/gateway/slack/slack-delivery.js.map +1 -1
  177. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
  178. package/daemon/dist/domain/gateway/slack/slack-subsystem.js +7 -4
  179. package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
  180. package/daemon/dist/domain/history-query.d.ts.map +1 -1
  181. package/daemon/dist/domain/history-query.js +8 -6
  182. package/daemon/dist/domain/history-query.js.map +1 -1
  183. package/daemon/dist/domain/human-questions.d.ts +4 -1
  184. package/daemon/dist/domain/human-questions.d.ts.map +1 -1
  185. package/daemon/dist/domain/human-questions.js.map +1 -1
  186. package/daemon/dist/domain/install-engine.js +2 -2
  187. package/daemon/dist/domain/install-engine.js.map +1 -1
  188. package/daemon/dist/domain/native-process-lineage.d.ts +57 -4
  189. package/daemon/dist/domain/native-process-lineage.d.ts.map +1 -1
  190. package/daemon/dist/domain/native-process-lineage.js +277 -42
  191. package/daemon/dist/domain/native-process-lineage.js.map +1 -1
  192. package/daemon/dist/domain/node-cmux-service.d.ts.map +1 -1
  193. package/daemon/dist/domain/node-cmux-service.js +2 -1
  194. package/daemon/dist/domain/node-cmux-service.js.map +1 -1
  195. package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
  196. package/daemon/dist/domain/node-inventory.js +71 -18
  197. package/daemon/dist/domain/node-inventory.js.map +1 -1
  198. package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
  199. package/daemon/dist/domain/node-launcher.js +2 -1
  200. package/daemon/dist/domain/node-launcher.js.map +1 -1
  201. package/daemon/dist/domain/pane-cutover.d.ts +27 -0
  202. package/daemon/dist/domain/pane-cutover.d.ts.map +1 -0
  203. package/daemon/dist/domain/pane-cutover.js +37 -0
  204. package/daemon/dist/domain/pane-cutover.js.map +1 -0
  205. package/daemon/dist/domain/parent-session-env.d.ts +8 -0
  206. package/daemon/dist/domain/parent-session-env.d.ts.map +1 -0
  207. package/daemon/dist/domain/parent-session-env.js +37 -0
  208. package/daemon/dist/domain/parent-session-env.js.map +1 -0
  209. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts +11 -0
  210. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts.map +1 -1
  211. package/daemon/dist/domain/policies/parked-owner-consumer.js +81 -11
  212. package/daemon/dist/domain/policies/parked-owner-consumer.js.map +1 -1
  213. package/daemon/dist/domain/profile-resolver.d.ts.map +1 -1
  214. package/daemon/dist/domain/profile-resolver.js +2 -3
  215. package/daemon/dist/domain/profile-resolver.js.map +1 -1
  216. package/daemon/dist/domain/progress/progress-indexer.d.ts.map +1 -1
  217. package/daemon/dist/domain/progress/progress-indexer.js +19 -0
  218. package/daemon/dist/domain/progress/progress-indexer.js.map +1 -1
  219. package/daemon/dist/domain/proof/judgments.d.ts +10 -5
  220. package/daemon/dist/domain/proof/judgments.d.ts.map +1 -1
  221. package/daemon/dist/domain/proof/judgments.js +27 -19
  222. package/daemon/dist/domain/proof/judgments.js.map +1 -1
  223. package/daemon/dist/domain/provider/codex-limit-banner.d.ts +40 -0
  224. package/daemon/dist/domain/provider/codex-limit-banner.d.ts.map +1 -0
  225. package/daemon/dist/domain/provider/codex-limit-banner.js +168 -0
  226. package/daemon/dist/domain/provider/codex-limit-banner.js.map +1 -0
  227. package/daemon/dist/domain/provider/codex-usage-reader.d.ts +31 -0
  228. package/daemon/dist/domain/provider/codex-usage-reader.d.ts.map +1 -0
  229. package/daemon/dist/domain/provider/codex-usage-reader.js +115 -0
  230. package/daemon/dist/domain/provider/codex-usage-reader.js.map +1 -0
  231. package/daemon/dist/domain/provider/codex-usage-windows.d.ts +78 -0
  232. package/daemon/dist/domain/provider/codex-usage-windows.d.ts.map +1 -0
  233. package/daemon/dist/domain/provider/codex-usage-windows.js +259 -0
  234. package/daemon/dist/domain/provider/codex-usage-windows.js.map +1 -0
  235. package/daemon/dist/domain/provider/provider-service-impl.d.ts +10 -0
  236. package/daemon/dist/domain/provider/provider-service-impl.d.ts.map +1 -1
  237. package/daemon/dist/domain/provider/provider-service-impl.js +27 -1
  238. package/daemon/dist/domain/provider/provider-service-impl.js.map +1 -1
  239. package/daemon/dist/domain/provider/provider-service.d.ts +5 -0
  240. package/daemon/dist/domain/provider/provider-service.d.ts.map +1 -1
  241. package/daemon/dist/domain/provider/provider-types.d.ts +65 -0
  242. package/daemon/dist/domain/provider/provider-types.d.ts.map +1 -1
  243. package/daemon/dist/domain/ps-projection.d.ts +5 -2
  244. package/daemon/dist/domain/ps-projection.d.ts.map +1 -1
  245. package/daemon/dist/domain/ps-projection.js +29 -26
  246. package/daemon/dist/domain/ps-projection.js.map +1 -1
  247. package/daemon/dist/domain/queue-recovery.d.ts.map +1 -1
  248. package/daemon/dist/domain/queue-recovery.js +10 -3
  249. package/daemon/dist/domain/queue-recovery.js.map +1 -1
  250. package/daemon/dist/domain/queue-repository.d.ts +68 -13
  251. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  252. package/daemon/dist/domain/queue-repository.js +72 -43
  253. package/daemon/dist/domain/queue-repository.js.map +1 -1
  254. package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
  255. package/daemon/dist/domain/queue-stuck-sweep.js +26 -9
  256. package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
  257. package/daemon/dist/domain/queue-wake-ladder.d.ts +17 -0
  258. package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
  259. package/daemon/dist/domain/queue-wake-ladder.js +49 -3
  260. package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
  261. package/daemon/dist/domain/restore-check-service.d.ts +8 -0
  262. package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
  263. package/daemon/dist/domain/restore-check-service.js +12 -3
  264. package/daemon/dist/domain/restore-check-service.js.map +1 -1
  265. package/daemon/dist/domain/restore-guidance.d.ts +39 -0
  266. package/daemon/dist/domain/restore-guidance.d.ts.map +1 -0
  267. package/daemon/dist/domain/restore-guidance.js +163 -0
  268. package/daemon/dist/domain/restore-guidance.js.map +1 -0
  269. package/daemon/dist/domain/restore-orchestrator.d.ts +10 -1
  270. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  271. package/daemon/dist/domain/restore-orchestrator.js +192 -9
  272. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  273. package/daemon/dist/domain/restore-plan-preview.d.ts +4 -0
  274. package/daemon/dist/domain/restore-plan-preview.d.ts.map +1 -1
  275. package/daemon/dist/domain/restore-plan-preview.js +14 -3
  276. package/daemon/dist/domain/restore-plan-preview.js.map +1 -1
  277. package/daemon/dist/domain/rigspec-preflight.d.ts.map +1 -1
  278. package/daemon/dist/domain/rigspec-preflight.js +7 -6
  279. package/daemon/dist/domain/rigspec-preflight.js.map +1 -1
  280. package/daemon/dist/domain/runtime-adapter.d.ts +3 -0
  281. package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
  282. package/daemon/dist/domain/runtime-adapter.js.map +1 -1
  283. package/daemon/dist/domain/scope/scope-view-projection.d.ts +4 -2
  284. package/daemon/dist/domain/scope/scope-view-projection.d.ts.map +1 -1
  285. package/daemon/dist/domain/scope/scope-view-projection.js +11 -11
  286. package/daemon/dist/domain/scope/scope-view-projection.js.map +1 -1
  287. package/daemon/dist/domain/seat-attention-reconciler.d.ts +5 -2
  288. package/daemon/dist/domain/seat-attention-reconciler.d.ts.map +1 -1
  289. package/daemon/dist/domain/seat-attention-reconciler.js +18 -4
  290. package/daemon/dist/domain/seat-attention-reconciler.js.map +1 -1
  291. package/daemon/dist/domain/seat-identity-reconciler.d.ts.map +1 -1
  292. package/daemon/dist/domain/seat-identity-reconciler.js +7 -2
  293. package/daemon/dist/domain/seat-identity-reconciler.js.map +1 -1
  294. package/daemon/dist/domain/seat-lifecycle-service.d.ts +117 -2
  295. package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
  296. package/daemon/dist/domain/seat-lifecycle-service.js +335 -74
  297. package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
  298. package/daemon/dist/domain/seat-restart-in-place.d.ts +292 -0
  299. package/daemon/dist/domain/seat-restart-in-place.d.ts.map +1 -0
  300. package/daemon/dist/domain/seat-restart-in-place.js +895 -0
  301. package/daemon/dist/domain/seat-restart-in-place.js.map +1 -0
  302. package/daemon/dist/domain/seat-status-service.d.ts +2 -1
  303. package/daemon/dist/domain/seat-status-service.d.ts.map +1 -1
  304. package/daemon/dist/domain/seat-status-service.js +1 -0
  305. package/daemon/dist/domain/seat-status-service.js.map +1 -1
  306. package/daemon/dist/domain/seat-structural-activity-service.d.ts +9 -1
  307. package/daemon/dist/domain/seat-structural-activity-service.d.ts.map +1 -1
  308. package/daemon/dist/domain/seat-structural-activity-service.js +27 -4
  309. package/daemon/dist/domain/seat-structural-activity-service.js.map +1 -1
  310. package/daemon/dist/domain/seat-switch-client-service.d.ts.map +1 -1
  311. package/daemon/dist/domain/seat-switch-client-service.js +2 -1
  312. package/daemon/dist/domain/seat-switch-client-service.js.map +1 -1
  313. package/daemon/dist/domain/session-fingerprinter.d.ts.map +1 -1
  314. package/daemon/dist/domain/session-fingerprinter.js +9 -5
  315. package/daemon/dist/domain/session-fingerprinter.js.map +1 -1
  316. package/daemon/dist/domain/session-registry.d.ts +49 -0
  317. package/daemon/dist/domain/session-registry.d.ts.map +1 -1
  318. package/daemon/dist/domain/session-registry.js +92 -5
  319. package/daemon/dist/domain/session-registry.js.map +1 -1
  320. package/daemon/dist/domain/session-transport.d.ts +46 -4
  321. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  322. package/daemon/dist/domain/session-transport.js +492 -26
  323. package/daemon/dist/domain/session-transport.js.map +1 -1
  324. package/daemon/dist/domain/startup-orchestrator.d.ts +10 -0
  325. package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
  326. package/daemon/dist/domain/startup-orchestrator.js +41 -4
  327. package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
  328. package/daemon/dist/domain/successor-session-launcher.d.ts +3 -7
  329. package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
  330. package/daemon/dist/domain/successor-session-launcher.js +6 -32
  331. package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
  332. package/daemon/dist/domain/terminal/terminal-service.d.ts +5 -1
  333. package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
  334. package/daemon/dist/domain/terminal/terminal-service.js +30 -4
  335. package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
  336. package/daemon/dist/domain/terminal/view-composer.d.ts +6 -0
  337. package/daemon/dist/domain/terminal/view-composer.d.ts.map +1 -1
  338. package/daemon/dist/domain/terminal/view-composer.js +2 -1
  339. package/daemon/dist/domain/terminal/view-composer.js.map +1 -1
  340. package/daemon/dist/domain/transcript-store.js +1 -1
  341. package/daemon/dist/domain/transcript-store.js.map +1 -1
  342. package/daemon/dist/domain/types.d.ts +38 -0
  343. package/daemon/dist/domain/types.d.ts.map +1 -1
  344. package/daemon/dist/domain/types.js +5 -0
  345. package/daemon/dist/domain/types.js.map +1 -1
  346. package/daemon/dist/domain/usage-series.d.ts.map +1 -1
  347. package/daemon/dist/domain/usage-series.js +9 -4
  348. package/daemon/dist/domain/usage-series.js.map +1 -1
  349. package/daemon/dist/domain/user-settings/settings-store.d.ts +1 -1
  350. package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
  351. package/daemon/dist/domain/user-settings/settings-store.js +44 -0
  352. package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
  353. package/daemon/dist/domain/view-projector.d.ts +4 -0
  354. package/daemon/dist/domain/view-projector.d.ts.map +1 -1
  355. package/daemon/dist/domain/view-projector.js +19 -4
  356. package/daemon/dist/domain/view-projector.js.map +1 -1
  357. package/daemon/dist/domain/wake-resolver.js +2 -2
  358. package/daemon/dist/domain/wake-resolver.js.map +1 -1
  359. package/daemon/dist/domain/watchdog-jobs-repository.d.ts.map +1 -1
  360. package/daemon/dist/domain/watchdog-jobs-repository.js +19 -3
  361. package/daemon/dist/domain/watchdog-jobs-repository.js.map +1 -1
  362. package/daemon/dist/domain/whoami-service.d.ts +4 -1
  363. package/daemon/dist/domain/whoami-service.d.ts.map +1 -1
  364. package/daemon/dist/domain/whoami-service.js +25 -19
  365. package/daemon/dist/domain/whoami-service.js.map +1 -1
  366. package/daemon/dist/domain/workflow-runtime.d.ts +1 -1
  367. package/daemon/dist/domain/workspace/project-read.d.ts +2 -0
  368. package/daemon/dist/domain/workspace/project-read.d.ts.map +1 -1
  369. package/daemon/dist/domain/workspace/project-read.js +19 -8
  370. package/daemon/dist/domain/workspace/project-read.js.map +1 -1
  371. package/daemon/dist/index.d.ts.map +1 -1
  372. package/daemon/dist/index.js +6 -0
  373. package/daemon/dist/index.js.map +1 -1
  374. package/daemon/dist/routes/activity.d.ts.map +1 -1
  375. package/daemon/dist/routes/activity.js +33 -1
  376. package/daemon/dist/routes/activity.js.map +1 -1
  377. package/daemon/dist/routes/chat.d.ts.map +1 -1
  378. package/daemon/dist/routes/chat.js +29 -4
  379. package/daemon/dist/routes/chat.js.map +1 -1
  380. package/daemon/dist/routes/projects.d.ts.map +1 -1
  381. package/daemon/dist/routes/projects.js +5 -1
  382. package/daemon/dist/routes/projects.js.map +1 -1
  383. package/daemon/dist/routes/proof.d.ts.map +1 -1
  384. package/daemon/dist/routes/proof.js +99 -10
  385. package/daemon/dist/routes/proof.js.map +1 -1
  386. package/daemon/dist/routes/provider.d.ts.map +1 -1
  387. package/daemon/dist/routes/provider.js +31 -0
  388. package/daemon/dist/routes/provider.js.map +1 -1
  389. package/daemon/dist/routes/query-limit.d.ts +19 -0
  390. package/daemon/dist/routes/query-limit.d.ts.map +1 -0
  391. package/daemon/dist/routes/query-limit.js +24 -0
  392. package/daemon/dist/routes/query-limit.js.map +1 -0
  393. package/daemon/dist/routes/queue.d.ts.map +1 -1
  394. package/daemon/dist/routes/queue.js +35 -12
  395. package/daemon/dist/routes/queue.js.map +1 -1
  396. package/daemon/dist/routes/rig-cmux.js +8 -10
  397. package/daemon/dist/routes/rig-cmux.js.map +1 -1
  398. package/daemon/dist/routes/rigs.d.ts.map +1 -1
  399. package/daemon/dist/routes/rigs.js +11 -7
  400. package/daemon/dist/routes/rigs.js.map +1 -1
  401. package/daemon/dist/routes/scopes.d.ts.map +1 -1
  402. package/daemon/dist/routes/scopes.js +5 -3
  403. package/daemon/dist/routes/scopes.js.map +1 -1
  404. package/daemon/dist/routes/seat.d.ts.map +1 -1
  405. package/daemon/dist/routes/seat.js +32 -0
  406. package/daemon/dist/routes/seat.js.map +1 -1
  407. package/daemon/dist/routes/stream.d.ts.map +1 -1
  408. package/daemon/dist/routes/stream.js +5 -1
  409. package/daemon/dist/routes/stream.js.map +1 -1
  410. package/daemon/dist/routes/up.d.ts.map +1 -1
  411. package/daemon/dist/routes/up.js +2 -1
  412. package/daemon/dist/routes/up.js.map +1 -1
  413. package/daemon/dist/routes/views.d.ts.map +1 -1
  414. package/daemon/dist/routes/views.js +7 -1
  415. package/daemon/dist/routes/views.js.map +1 -1
  416. package/daemon/dist/startup.d.ts.map +1 -1
  417. package/daemon/dist/startup.js +30 -1
  418. package/daemon/dist/startup.js.map +1 -1
  419. package/daemon/docs/reference/agent-startup-guide.md +19 -0
  420. package/daemon/docs/reference/getting-started.md +10 -6
  421. package/daemon/docs/reference/keeping-a-watch.md +156 -0
  422. package/daemon/docs/reference/rig-spec.md +2 -2
  423. package/daemon/docs/reference/sdlc-conventions.md +11 -1
  424. package/daemon/docs/reference/slack-app-setup.md +12 -4
  425. package/daemon/docs/reference/whats-new.md +151 -74
  426. package/daemon/specs/agents/development/qa/guidance/role.md +9 -0
  427. package/daemon/specs/agents/shared/skills/core/openrig-skills/SKILL.md +1 -1
  428. package/daemon/specs/agents/shared/skills/core/topology-mutation-and-seat-management/SKILL.md +2 -2
  429. package/daemon/specs/rigs/launch/factory/CULTURE.md +13 -0
  430. package/daemon/specs/rigs/launch/factory/guidance/lead-first-move.md +18 -5
  431. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +20 -1
  432. package/daemon/specs/rigs/launch/starter/CULTURE.md +13 -0
  433. package/daemon/specs/rigs/launch/starter/guidance/lead-first-move.md +18 -5
  434. package/dist/build-info.js +3 -3
  435. package/dist/cli-error.d.ts.map +1 -1
  436. package/dist/cli-error.js +2 -0
  437. package/dist/cli-error.js.map +1 -1
  438. package/dist/commands/add.d.ts.map +1 -1
  439. package/dist/commands/add.js +55 -4
  440. package/dist/commands/add.js.map +1 -1
  441. package/dist/commands/capture.d.ts +9 -0
  442. package/dist/commands/capture.d.ts.map +1 -1
  443. package/dist/commands/capture.js +93 -41
  444. package/dist/commands/capture.js.map +1 -1
  445. package/dist/commands/config.d.ts.map +1 -1
  446. package/dist/commands/config.js +6 -1
  447. package/dist/commands/config.js.map +1 -1
  448. package/dist/commands/daemon.d.ts.map +1 -1
  449. package/dist/commands/daemon.js +44 -3
  450. package/dist/commands/daemon.js.map +1 -1
  451. package/dist/commands/down.d.ts.map +1 -1
  452. package/dist/commands/down.js +1 -50
  453. package/dist/commands/down.js.map +1 -1
  454. package/dist/commands/env.d.ts.map +1 -1
  455. package/dist/commands/env.js +6 -0
  456. package/dist/commands/env.js.map +1 -1
  457. package/dist/commands/heartbeat.js +2 -2
  458. package/dist/commands/heartbeat.js.map +1 -1
  459. package/dist/commands/proof.d.ts.map +1 -1
  460. package/dist/commands/proof.js +11 -5
  461. package/dist/commands/proof.js.map +1 -1
  462. package/dist/commands/provider.d.ts.map +1 -1
  463. package/dist/commands/provider.js +72 -0
  464. package/dist/commands/provider.js.map +1 -1
  465. package/dist/commands/ps.d.ts +7 -0
  466. package/dist/commands/ps.d.ts.map +1 -1
  467. package/dist/commands/ps.js +20 -6
  468. package/dist/commands/ps.js.map +1 -1
  469. package/dist/commands/queue.d.ts +48 -5
  470. package/dist/commands/queue.d.ts.map +1 -1
  471. package/dist/commands/queue.js +215 -45
  472. package/dist/commands/queue.js.map +1 -1
  473. package/dist/commands/scope.d.ts.map +1 -1
  474. package/dist/commands/scope.js +57 -36
  475. package/dist/commands/scope.js.map +1 -1
  476. package/dist/commands/seat.d.ts.map +1 -1
  477. package/dist/commands/seat.js +167 -10
  478. package/dist/commands/seat.js.map +1 -1
  479. package/dist/commands/setup.d.ts +6 -0
  480. package/dist/commands/setup.d.ts.map +1 -1
  481. package/dist/commands/setup.js +100 -44
  482. package/dist/commands/setup.js.map +1 -1
  483. package/dist/commands/start.d.ts.map +1 -1
  484. package/dist/commands/start.js +9 -4
  485. package/dist/commands/start.js.map +1 -1
  486. package/dist/commands/up.d.ts.map +1 -1
  487. package/dist/commands/up.js +10 -0
  488. package/dist/commands/up.js.map +1 -1
  489. package/dist/commands/usage.d.ts.map +1 -1
  490. package/dist/commands/usage.js +10 -5
  491. package/dist/commands/usage.js.map +1 -1
  492. package/dist/commands/workflow.d.ts.map +1 -1
  493. package/dist/commands/workflow.js +8 -8
  494. package/dist/commands/workflow.js.map +1 -1
  495. package/dist/config-store.d.ts +8 -1
  496. package/dist/config-store.d.ts.map +1 -1
  497. package/dist/config-store.js +57 -0
  498. package/dist/config-store.js.map +1 -1
  499. package/dist/daemon-lifecycle.d.ts +4 -0
  500. package/dist/daemon-lifecycle.d.ts.map +1 -1
  501. package/dist/daemon-lifecycle.js +16 -4
  502. package/dist/daemon-lifecycle.js.map +1 -1
  503. package/dist/lib/scope/capability-delta.d.ts.map +1 -1
  504. package/dist/lib/scope/capability-delta.js +8 -0
  505. package/dist/lib/scope/capability-delta.js.map +1 -1
  506. package/dist/lib/scope/mission-composition.d.ts +5 -1
  507. package/dist/lib/scope/mission-composition.d.ts.map +1 -1
  508. package/dist/lib/scope/mission-composition.js +61 -1
  509. package/dist/lib/scope/mission-composition.js.map +1 -1
  510. package/dist/lib/scope/progress-edit.js +1 -1
  511. package/dist/lib/scope/progress-edit.js.map +1 -1
  512. package/dist/lib/scope/scope-fs.d.ts +2 -1
  513. package/dist/lib/scope/scope-fs.d.ts.map +1 -1
  514. package/dist/lib/scope/scope-fs.js +7 -7
  515. package/dist/lib/scope/scope-fs.js.map +1 -1
  516. package/dist/lib/scope/slice-claims.d.ts +8 -0
  517. package/dist/lib/scope/slice-claims.d.ts.map +1 -0
  518. package/dist/lib/scope/slice-claims.js +88 -0
  519. package/dist/lib/scope/slice-claims.js.map +1 -0
  520. package/dist/queue-receipt.d.ts +41 -0
  521. package/dist/queue-receipt.d.ts.map +1 -0
  522. package/dist/queue-receipt.js +272 -0
  523. package/dist/queue-receipt.js.map +1 -0
  524. package/dist/rig-handle.d.ts +45 -0
  525. package/dist/rig-handle.d.ts.map +1 -0
  526. package/dist/rig-handle.js +51 -0
  527. package/dist/rig-handle.js.map +1 -0
  528. package/dist/system-preflight.d.ts +5 -0
  529. package/dist/system-preflight.d.ts.map +1 -1
  530. package/dist/system-preflight.js +8 -0
  531. package/dist/system-preflight.js.map +1 -1
  532. package/dist/terminal-window.d.ts.map +1 -1
  533. package/dist/terminal-window.js +3 -1
  534. package/dist/terminal-window.js.map +1 -1
  535. package/package.json +1 -1
  536. package/tui/dist/config/config-model.d.ts.map +1 -1
  537. package/tui/dist/config/config-model.js +3 -0
  538. package/tui/dist/config/config-model.js.map +1 -1
  539. package/tui/dist/daemon-client.d.ts +3 -0
  540. package/tui/dist/daemon-client.d.ts.map +1 -1
  541. package/tui/dist/daemon-client.js +4 -1
  542. package/tui/dist/daemon-client.js.map +1 -1
  543. package/tui/dist/detail.d.ts.map +1 -1
  544. package/tui/dist/detail.js +6 -1
  545. package/tui/dist/detail.js.map +1 -1
  546. package/tui/dist/hydrate.d.ts.map +1 -1
  547. package/tui/dist/hydrate.js +30 -21
  548. package/tui/dist/hydrate.js.map +1 -1
  549. package/tui/dist/input.d.ts.map +1 -1
  550. package/tui/dist/input.js +15 -4
  551. package/tui/dist/input.js.map +1 -1
  552. package/tui/dist/local-reading.js +2 -2
  553. package/tui/dist/local-reading.js.map +1 -1
  554. package/tui/dist/pulse/pulse-model.d.ts +1 -0
  555. package/tui/dist/pulse/pulse-model.d.ts.map +1 -1
  556. package/tui/dist/pulse/pulse-model.js +7 -3
  557. package/tui/dist/pulse/pulse-model.js.map +1 -1
  558. package/tui/dist/pulse/render-pulse.d.ts.map +1 -1
  559. package/tui/dist/pulse/render-pulse.js +3 -1
  560. package/tui/dist/pulse/render-pulse.js.map +1 -1
  561. package/tui/dist/reading.d.ts.map +1 -1
  562. package/tui/dist/reading.js +14 -3
  563. package/tui/dist/reading.js.map +1 -1
  564. package/tui/dist/render.d.ts.map +1 -1
  565. package/tui/dist/render.js +26 -11
  566. package/tui/dist/render.js.map +1 -1
  567. package/tui/dist/types.d.ts +3 -0
  568. package/tui/dist/types.d.ts.map +1 -1
  569. package/ui/dist/assets/{index-D5n8EwkG.js → index-DhmxKuZf.js} +159 -159
  570. package/ui/dist/index.html +1 -1
@@ -10,58 +10,183 @@ import { enumArg, positiveIntArg } from "../cli-error.js";
10
10
  import { resolveContextRef } from "../context-resolve.js";
11
11
  import { shellQuote } from "../cross-host-executor.js";
12
12
  import { omittedReadField, readView } from "../read-view.js";
13
- export async function waitForDeliveryOutcome(client, qitemId, deps = {}) {
13
+ import { buildWriteReceipt, compactOutputEnabled } from "../queue-receipt.js";
14
+ function stringField(row, key) {
15
+ return typeof row[key] === "string" ? row[key] : null;
16
+ }
17
+ /** The row's own signals decide who owns delivery: the recorded wake result, then the daemon's
18
+ * destination class (present before any wake, e.g. --no-nudge), then a gateway receipt. The
19
+ * address pattern is only the fallback for a daemon that reports none of these. A gateway
20
+ * receipt beside a terminal signal adds a gateway side (gatewayAlsoPosts); it doesn't replace it. */
21
+ function receiptSourceOf(destination, row) {
22
+ const wakeResult = stringField(row, "lastNudgeResult");
23
+ if (wakeResult !== null)
24
+ return wakeResult.startsWith("gateway-owned:") ? "gateway" : "terminal";
25
+ const destinationClass = stringField(row, "destinationClass");
26
+ if (destinationClass !== null)
27
+ return destinationClass === "gateway-routable" ? "gateway" : "terminal";
28
+ if (stringField(row, "deliveryOutcome") !== null)
29
+ return "gateway";
30
+ return destination !== null && isHumanSeatSessionRef(destination) ? "gateway" : "terminal";
31
+ }
32
+ /** A terminal destination the gateway may also post to (a registered person who is also a seat
33
+ * with a pane): the row carries the owner notification level the Slack selector keys on, or a
34
+ * gateway receipt already exists. */
35
+ function gatewayAlsoPosts(row) {
36
+ return stringField(row, "ownerNotificationLevel") !== null || stringField(row, "deliveryOutcome") !== null;
37
+ }
38
+ /** A terminal destination is a person when the gateway also posts to it or its address is a human seat's. */
39
+ function terminalDestinationKind(destination, gatewaySide) {
40
+ return gatewaySide || (destination !== null && isHumanSeatSessionRef(destination)) ? "human" : "agent";
41
+ }
42
+ function gatewayReceiptOf(row) {
43
+ const outcome = stringField(row, "deliveryOutcome");
44
+ if (outcome === "posted")
45
+ return { outcome, connectorAccepted: true };
46
+ if (outcome === "transport-failed" || outcome === "never-posted") {
47
+ const detail = stringField(row, "deliveryFailureDetail");
48
+ return { outcome, connectorAccepted: false, ...(detail ? { detail } : {}) };
49
+ }
50
+ return { outcome: "still-pending", connectorAccepted: null };
51
+ }
52
+ function terminalWakeOutcome(wakeResult) {
53
+ if (wakeResult === null)
54
+ return "still-pending";
55
+ if (wakeResult === "verified" || wakeResult === "delivered-ack-pending" || wakeResult === "claimed")
56
+ return wakeResult;
57
+ if (wakeResult.startsWith("failed:") || wakeResult.startsWith("unroutable:"))
58
+ return "failed";
59
+ if (wakeResult.startsWith("retained:"))
60
+ return "retained";
61
+ return "indeterminate";
62
+ }
63
+ /** Only these known states mean "not delivered yet, nothing went wrong". An unknown value never gets that label. */
64
+ function isKnownUnconfirmed(wakeResult, outcome) {
65
+ if (outcome === "not-requested" || wakeResult === null || wakeResult === "delivered-ack-pending")
66
+ return true;
67
+ return wakeResult.startsWith("indeterminate:") || wakeResult.startsWith("retained:");
68
+ }
69
+ function terminalDeliveryResult(qitemId, destination, row, outcome, waitedMs) {
70
+ const wakeResult = stringField(row, "lastNudgeResult");
71
+ const claimedAt = stringField(row, "claimedAt");
72
+ const pickupState = typeof row.pickup === "object" && row.pickup !== null ? stringField(row.pickup, "state") : null;
73
+ const claim = { observed: claimedAt !== null, claimedAt, pickup: pickupState };
74
+ const seat = destination ?? "<destination>";
75
+ const receipt = {
76
+ "verified": "Terminal receipt confirmed: the wake rendered in the destination pane.",
77
+ "delivered-ack-pending": "Terminal receipt unconfirmed (delivered-ack-pending): the wake was sent, but its render could not be confirmed.",
78
+ "claimed": "Terminal receipt unconfirmed, but the seat has claimed the item (claimed).",
79
+ "retained": `The wake is held (${wakeResult}): nothing was typed into the pane. A held create wake is not retried automatically; inspect it with rig seat held-messages ${seat}.`,
80
+ "failed": `The wake failed (${wakeResult}).`,
81
+ "indeterminate": `Terminal receipt unconfirmed (${wakeResult}).`,
82
+ "still-pending": waitedMs === null ? "No terminal receipt was recorded before the claim." : `No terminal receipt was recorded within ${waitedMs}ms.`,
83
+ "not-requested": "No terminal wake was requested (--no-nudge).",
84
+ };
85
+ const claimText = claim.observed
86
+ ? `Claimed at ${claimedAt}${pickupState ? ` (pickup ${pickupState})` : ""}. A claim shows the seat took the item; it does not prove the body was read.`
87
+ : waitedMs === null ? "No claim observed yet." : `No claim observed within ${waitedMs}ms.`;
88
+ const gatewaySide = gatewayAlsoPosts(row);
89
+ const gateway = gatewaySide ? gatewayReceiptOf(row) : null;
90
+ const slackText = gateway === null ? ""
91
+ : gateway.outcome === "posted" ? " Slack receipt: posted."
92
+ : gateway.outcome === "still-pending" ? (waitedMs === null ? " No Slack receipt yet." : ` No Slack receipt within ${waitedMs}ms.`)
93
+ : ` Slack delivery ${gateway.outcome}${gateway.detail ? `: ${gateway.detail}` : ""}.`;
94
+ const gatewayFailed = gateway !== null && gateway.connectorAccepted === false;
95
+ const notFailed = !claim.observed && !gatewayFailed && isKnownUnconfirmed(wakeResult, outcome) ? " This is not a failed handoff." : "";
96
+ const destinationKind = terminalDestinationKind(destination, gatewaySide);
97
+ const settled = claim.observed && (gateway === null || gateway.outcome === "posted");
98
+ return {
99
+ receiptSource: "terminal",
100
+ destinationKind,
101
+ ...(destinationKind === "human" ? { humanReadership: "unknown" } : {}),
102
+ outcome,
103
+ wakeResult,
104
+ claim,
105
+ ...(gateway ? { gateway } : {}),
106
+ detail: `The qitem is saved. ${receipt[outcome]}${slackText} ${claimText}${notFailed}`,
107
+ nextAction: settled ? null : outcome === "retained" ? `rig seat held-messages ${seat}` : `rig queue show ${qitemId} --json`,
108
+ };
109
+ }
110
+ /** The receipt could not be read or correlated: say which part is unknown, nothing more. */
111
+ export function unreadableDeliveryResult(qitemId, destination, row, reason) {
112
+ const nextAction = qitemId ? `rig queue show ${qitemId} --json` : null;
113
+ if (receiptSourceOf(destination, row) === "gateway") {
114
+ return {
115
+ receiptSource: "gateway",
116
+ destinationKind: "human",
117
+ humanReadership: "unknown",
118
+ outcome: "indeterminate",
119
+ connectorAccepted: null,
120
+ detail: reason,
121
+ nextAction,
122
+ };
123
+ }
124
+ return { ...terminalDeliveryResult(qitemId ?? "", destination, row, "indeterminate", null), detail: reason, nextAction };
125
+ }
126
+ export async function waitForDeliveryOutcome(client, qitemId, deps = {}, target = {}) {
14
127
  const timeoutMs = deps.timeoutMs ?? 30_000;
15
128
  const intervalMs = deps.intervalMs ?? 500;
16
129
  const sleep = deps.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
17
130
  const now = deps.now ?? (() => Date.now());
18
131
  const started = now();
132
+ let row = {};
19
133
  for (;;) {
20
134
  try {
21
135
  const response = await client.get(`/api/queue/${encodeURIComponent(qitemId)}`);
22
136
  if (response.status !== 200)
23
137
  throw new Error(`receipt lookup returned HTTP ${response.status}`);
24
- const outcome = response.data.deliveryOutcome;
138
+ row = response.data ?? {};
139
+ }
140
+ catch (error) {
141
+ return unreadableDeliveryResult(qitemId, target.destinationSession ?? stringField(row, "destinationSession"), row, `delivery receipt could not be read: ${error.message}`);
142
+ }
143
+ const destination = target.destinationSession ?? stringField(row, "destinationSession");
144
+ const timedOut = now() - started >= timeoutMs;
145
+ if (receiptSourceOf(destination, row) === "gateway") {
146
+ const outcome = row.deliveryOutcome;
147
+ const gateway = { receiptSource: "gateway", destinationKind: "human", humanReadership: "unknown" };
25
148
  if (outcome === "posted") {
26
149
  // #96: a --reply-to update reports whether it joined the earlier item's thread.
27
- const replyTo = typeof response.data.replyTo === "string" ? response.data.replyTo : null;
28
- const fallback = typeof response.data.replyToFallback === "string" ? response.data.replyToFallback : null;
150
+ const replyTo = stringField(row, "replyTo");
151
+ const fallback = stringField(row, "replyToFallback");
29
152
  return {
153
+ ...gateway,
30
154
  outcome,
31
155
  connectorAccepted: true,
32
- humanReadership: "unknown",
33
156
  ...(replyTo ? { threaded: fallback === null } : {}),
34
157
  ...(replyTo && fallback ? { detail: `posted as a new top-level message, not in ${replyTo}'s thread: ${fallback}` } : {}),
35
158
  nextAction: null,
36
159
  };
37
160
  }
38
161
  if (outcome === "transport-failed" || outcome === "never-posted") {
162
+ const { detail } = gatewayReceiptOf(row);
163
+ return { ...gateway, outcome, connectorAccepted: false, ...(detail ? { detail } : {}), nextAction: `rig queue show ${qitemId} --json` };
164
+ }
165
+ if (timedOut) {
39
166
  return {
40
- outcome,
41
- connectorAccepted: false,
42
- humanReadership: "unknown",
43
- detail: typeof response.data.deliveryFailureDetail === "string" ? response.data.deliveryFailureDetail : undefined,
167
+ ...gateway,
168
+ outcome: "still-pending",
169
+ connectorAccepted: null,
170
+ detail: `no terminal connector receipt within ${timeoutMs}ms; the durable qitem remains intact`,
44
171
  nextAction: `rig queue show ${qitemId} --json`,
45
172
  };
46
173
  }
47
174
  }
48
- catch (error) {
49
- return {
50
- outcome: "indeterminate",
51
- connectorAccepted: null,
52
- humanReadership: "unknown",
53
- detail: `delivery receipt could not be read: ${error.message}`,
54
- nextAction: `rig queue show ${qitemId} --json`,
55
- };
56
- }
57
- if (now() - started >= timeoutMs) {
58
- return {
59
- outcome: "still-pending",
60
- connectorAccepted: null,
61
- humanReadership: "unknown",
62
- detail: `no terminal connector receipt within ${timeoutMs}ms; the durable qitem remains intact`,
63
- nextAction: `rig queue show ${qitemId} --json`,
64
- };
175
+ else {
176
+ // --no-nudge requested no wake: there is no terminal receipt to wait for.
177
+ const wakeResult = stringField(row, "lastNudgeResult");
178
+ const outcome = target.nudge === false ? "not-requested" : terminalWakeOutcome(wakeResult);
179
+ // Any recorded wake result (or an existing claim) settles the terminal side: a later pickup
180
+ // is `rig queue show`'s to report. When the gateway may also post the row, its receipt is
181
+ // awaited too. Only a missing receipt waits, up to the bound. Nothing here re-sends anything.
182
+ const gatewaySide = gatewayAlsoPosts(row);
183
+ const terminalSettled = outcome === "not-requested" || wakeResult !== null || stringField(row, "claimedAt") !== null;
184
+ const gatewaySettled = !gatewaySide || stringField(row, "deliveryOutcome") !== null;
185
+ if (terminalSettled && gatewaySettled) {
186
+ return terminalDeliveryResult(qitemId, destination, row, outcome, null);
187
+ }
188
+ if (timedOut)
189
+ return terminalDeliveryResult(qitemId, destination, row, outcome, timeoutMs);
65
190
  }
66
191
  await sleep(intervalMs);
67
192
  }
@@ -121,8 +246,45 @@ function printResult(json, body, status) {
121
246
  if (status >= 400)
122
247
  process.exitCode = status >= 500 ? 2 : 1;
123
248
  }
249
+ /** Slice 15: the receipt context when a write should print its receipt — the
250
+ * `output.compact` switch is on and `--full` was not given — else null (today's
251
+ * output). Error responses always print whole, whatever this returns. */
252
+ function writeReceipt(full, ctx) {
253
+ return !full && compactOutputEnabled() ? ctx : null;
254
+ }
255
+ /** A `--host` id that may name another daemon. Empty and `local` never do; one that
256
+ * equals the selected daemon's own host id is settled by {@link settleReceiptHost}. */
257
+ function remoteHostOf(hostId) {
258
+ return hostId && hostId !== "local" ? hostId : undefined;
259
+ }
260
+ /** The daemon's own rule (`resolvesToLocalHost`): a `--host` naming the selected
261
+ * daemon's selfHostId took the local path, so its receipt must not call the row
262
+ * remote. Read only for a receipt; an unreadable id leaves the host unconfirmed. */
263
+ async function settleReceiptHost(client, receipt) {
264
+ if (!receipt.remoteHost)
265
+ return receipt;
266
+ let selfHostId;
267
+ try {
268
+ const health = await client.get("/healthz", { timeoutMs: 1_000 });
269
+ if (health.status === 200 && typeof health.data?.selfHostId === "string" && health.data.selfHostId.trim())
270
+ selfHostId = health.data.selfHostId;
271
+ }
272
+ catch { /* An unreadable id must not change or fail the write's output. */ }
273
+ if (selfHostId === receipt.remoteHost)
274
+ return { ...receipt, remoteHost: undefined };
275
+ return selfHostId === undefined ? { ...receipt, remoteHostUnconfirmed: true } : receipt;
276
+ }
277
+ async function printWriteResult(client, json, body, status, receipt) {
278
+ const settled = receipt && status < 400 ? await settleReceiptHost(client, receipt) : null;
279
+ const projected = settled ? buildWriteReceipt(body, settled) : null;
280
+ if (!projected) {
281
+ printResult(json, body, status);
282
+ return;
283
+ }
284
+ console.log(json ? JSON.stringify(projected.json) : projected.text);
285
+ }
124
286
  // Recovery belongs to the selected daemon's reply; never infer a host from an ID.
125
- async function printQueueItemResult(client, qitemId, json, body, status) {
287
+ async function printQueueItemResult(client, qitemId, json, body, status, receipt = null) {
126
288
  if (status >= 400 && body && typeof body === "object"
127
289
  && body.error === "qitem_not_found") {
128
290
  let selfHostId;
@@ -140,7 +302,7 @@ async function printQueueItemResult(client, qitemId, json, body, status) {
140
302
  + `If it came from another host, run rig host list; replace <daemon-url> with its registered daemon URL and run: OPENRIG_URL='<daemon-url>' rig queue show ${shellQuote(qitemId)} --full --json`,
141
303
  };
142
304
  }
143
- printResult(json, body, status);
305
+ await printWriteResult(client, json, body, status, receipt);
144
306
  }
145
307
  // OPR.0.4.3.03 — `rig queue show` body preview.
146
308
  //
@@ -347,7 +509,8 @@ export function queueCommand(depsOverride) {
347
509
  .option("--evidence-ref <path>", "OPR.0.4.4.19 FR-5: pointer to the durable artifact a human judges (e.g. a PROOF.md path). Required by the daemon when the item is human-routed; optional otherwise.")
348
510
  .option("--host <id>", QUEUE_HOST_OPTION_HELP)
349
511
  .option("--no-nudge", "Suppress the default destination nudge (cold-queue)")
350
- .option("--verify", "Boundedly wait for the existing gateway delivery receipt after persistence; never retries the create and never claims human readership")
512
+ .option("--verify", "Boundedly wait after persistence for the existing receipts: the gateway receipt for a person, or the wake result and any claim already present for a seat, plus the gateway receipt when the gateway may also post to that seat (a registered person with a pane; eligible to post, not guaranteed). Never retries the create or the wake, and never claims the message was read")
513
+ .option("--full", "Print the whole response row(s) as today, even when output.compact is on (the receipt's waiting keeps only blocker and nextBackstop)")
351
514
  .option("--json", "JSON output for agents")
352
515
  .action(async (opts) => {
353
516
  // OPR.0.4.6.MH3 D-3 (C3): resolve the host qualifier at the CLI edge —
@@ -479,6 +642,9 @@ export function queueCommand(depsOverride) {
479
642
  // stderr survives an interrupted wait without adding a second JSON
480
643
  // document to stdout. This is a request identity, NOT a commit receipt.
481
644
  console.error(`Queue create request ID: ${qitemId} (not proof of persistence). ${recovery}`);
645
+ const receipt = writeReceipt(opts.full, {
646
+ verb: "create", nudgeSuppressed: opts.nudge === false, idGiven: opts.id !== undefined, remoteHost: remoteHostOf(hostResolved.hostId),
647
+ });
482
648
  const res = await client.post("/api/queue/create", {
483
649
  ...(managedSource === undefined ? { sourceSession: source } : {}),
484
650
  qitemId,
@@ -525,24 +691,19 @@ export function queueCommand(depsOverride) {
525
691
  const created = res.data;
526
692
  const qitemId = typeof created.qitemId === "string" ? created.qitemId : null;
527
693
  const delivery = qitemId
528
- ? await waitForDeliveryOutcome(client, qitemId, deps.deliveryVerify)
529
- : {
530
- outcome: "indeterminate",
531
- connectorAccepted: null,
532
- humanReadership: "unknown",
533
- detail: "create response did not include a qitem id; delivery cannot be correlated",
534
- nextAction: null,
535
- };
536
- printResult(opts.json ?? false, { ...created, qitemId, persisted: true, delivery }, res.status);
694
+ ? await waitForDeliveryOutcome(client, qitemId, deps.deliveryVerify, { destinationSession: hostResolved.destination, nudge: opts.nudge })
695
+ : unreadableDeliveryResult(null, hostResolved.destination, {}, "create response did not include a qitem id; delivery cannot be correlated");
696
+ await printWriteResult(client, opts.json ?? false, { ...created, qitemId, persisted: true, delivery }, res.status, receipt);
537
697
  return;
538
698
  }
539
- printResult(opts.json ?? false, res.data, res.status);
699
+ await printWriteResult(client, opts.json ?? false, res.data, res.status, receipt);
540
700
  }, hostResolved.hostId !== undefined, hostResolved.hostId);
541
701
  });
542
702
  cmd
543
703
  .command("claim <qitemId>")
544
704
  .description("Claim a qitem (pending → in-progress); computes closure_required_at from tier")
545
705
  .option("--destination <session>", "(deprecated, ignored) the claimant is derived from the seat env (X-OpenRig-Session); P21 I3 made the claim route derive it from the transport header")
706
+ .option("--full", "Print the whole response row(s) as today, even when output.compact is on (the receipt's waiting keeps only blocker and nextBackstop)")
546
707
  .option("--json", "JSON output for agents")
547
708
  .action(async (qitemId, opts) => {
548
709
  // P21 I3 reconcile: the claimant is DERIVED from the seat env — --destination deprecated + ignored,
@@ -552,7 +713,7 @@ export function queueCommand(depsOverride) {
552
713
  const deps = getDeps();
553
714
  await withClient(deps, async (client) => {
554
715
  const res = await client.post(`/api/queue/${encodeURIComponent(qitemId)}/claim`, {});
555
- await printQueueItemResult(client, qitemId, opts.json ?? false, res.data, res.status);
716
+ await printQueueItemResult(client, qitemId, opts.json ?? false, res.data, res.status, writeReceipt(opts.full, { verb: "claim" }));
556
717
  });
557
718
  });
558
719
  cmd
@@ -560,6 +721,7 @@ export function queueCommand(depsOverride) {
560
721
  .description("Release a claimed qitem (in-progress → pending)")
561
722
  .option("--destination <session>", "(deprecated, ignored) the releaser is derived from the seat env (X-OpenRig-Session); the unclaim route derives it from the transport header")
562
723
  .option("--reason <text>", "Reason for unclaim", "manual")
724
+ .option("--full", "Print the whole response row(s) as today, even when output.compact is on (the receipt's waiting keeps only blocker and nextBackstop)")
563
725
  .option("--json", "JSON output for agents")
564
726
  .action(async (qitemId, opts) => {
565
727
  // P21 I3 reconcile: the releaser is DERIVED from the seat env — --destination deprecated + ignored,
@@ -571,7 +733,7 @@ export function queueCommand(depsOverride) {
571
733
  const res = await client.post(`/api/queue/${encodeURIComponent(qitemId)}/unclaim`, {
572
734
  reason: opts.reason,
573
735
  });
574
- await printQueueItemResult(client, qitemId, opts.json ?? false, res.data, res.status);
736
+ await printQueueItemResult(client, qitemId, opts.json ?? false, res.data, res.status, writeReceipt(opts.full, { verb: "unclaim" }));
575
737
  });
576
738
  });
577
739
  cmd
@@ -588,6 +750,7 @@ export function queueCommand(depsOverride) {
588
750
  .option("--summary <text>", "OPR.0.4.4.19 FR-6: park-time summary persisted onto the item (human-seat parks only)")
589
751
  .option("--evidence-ref <path>", "OPR.0.4.4.19 FR-6: park-time durable-artifact pointer persisted onto the item (human-seat parks only)")
590
752
  .option("--note <text>", "Transition note for the audit log")
753
+ .option("--full", "Print the whole response row(s) as today, even when output.compact is on (the receipt's waiting keeps only blocker and nextBackstop)")
591
754
  .option("--json", "JSON output for agents")
592
755
  .action(async (qitemId, opts) => {
593
756
  // P21 I3 reconcile: the actor is DERIVED from the seat env (X-OpenRig-Session, stamped by
@@ -609,7 +772,7 @@ export function queueCommand(depsOverride) {
609
772
  evidenceRef: opts.evidenceRef,
610
773
  transitionNote: opts.note,
611
774
  });
612
- await printQueueItemResult(client, qitemId, opts.json ?? false, res.data, res.status);
775
+ await printQueueItemResult(client, qitemId, opts.json ?? false, res.data, res.status, writeReceipt(opts.full, { verb: "update" }));
613
776
  });
614
777
  });
615
778
  // OPR.0.4.4.19 FR-6 — the first-class park affordance (C5 leg 1). One verb,
@@ -630,6 +793,7 @@ export function queueCommand(depsOverride) {
630
793
  .option("--continuation <text>", "What resumes. Workspace deferred/not-imminent work belongs in a mission/slice")
631
794
  .option("--wake-watchdog <jobId>", "Attach an existing live watchdog id targeting the parked owner")
632
795
  .option("--wake-after <duration>", "Atomically arm a timer with the park (for example 90s, 15m, 2h)", wakeDurationSeconds)
796
+ .option("--full", "Print the whole response row(s) as today, even when output.compact is on (the receipt's waiting keeps only blocker and nextBackstop)")
633
797
  .option("--json", "JSON output for agents")
634
798
  .addHelpText("after", `
635
799
  --on <blocker> is always required; a wake option does not replace it.
@@ -657,7 +821,7 @@ workspace home that is deferred/not-imminent belongs in its mission/slice.`)
657
821
  wakeAfterSeconds: opts.wakeAfter,
658
822
  transitionNote: opts.continuation ? `continuation: ${opts.continuation}` : (opts.note ?? `parked on ${opts.on}`),
659
823
  });
660
- await printQueueItemResult(client, qitemId, opts.json ?? false, res.data, res.status);
824
+ await printQueueItemResult(client, qitemId, opts.json ?? false, res.data, res.status, writeReceipt(opts.full, { verb: "block" }));
661
825
  });
662
826
  });
663
827
  // OPR.0.4.4.19 FR-7 — the resolve verb's CLI wrapper: a THIN client of the
@@ -710,6 +874,7 @@ workspace home that is deferred/not-imminent belongs in its mission/slice.`)
710
874
  .option("--evidence-ref <path>", "OPR.0.4.4.19 FR-5: durable-artifact pointer for the new qitem. Required by the daemon when the new qitem is human-routed; optional otherwise.")
711
875
  .option("--host <id>", QUEUE_HOST_OPTION_HELP)
712
876
  .option("--no-nudge", "Suppress the default nudge to the new destination")
877
+ .option("--full", "Print the whole response row(s) as today, even when output.compact is on (the receipt's waiting keeps only blocker and nextBackstop)")
713
878
  .option("--json", "JSON output for agents")
714
879
  .action(async (qitemId, opts) => {
715
880
  // P21 I3 reconcile: the handing-off seat is DERIVED from the seat env (X-OpenRig-Session) —
@@ -767,7 +932,9 @@ workspace home that is deferred/not-imminent belongs in its mission/slice.`)
767
932
  nudge: opts.nudge,
768
933
  ...(hostResolved.hostId !== undefined ? { hostId: hostResolved.hostId } : {}),
769
934
  });
770
- await printQueueItemResult(client, qitemId, opts.json ?? false, res.data, res.status);
935
+ await printQueueItemResult(client, qitemId, opts.json ?? false, res.data, res.status, writeReceipt(opts.full, {
936
+ verb: "handoff", nudgeSuppressed: opts.nudge === false, remoteHost: remoteHostOf(hostResolved.hostId),
937
+ }));
771
938
  });
772
939
  });
773
940
  cmd
@@ -787,6 +954,7 @@ workspace home that is deferred/not-imminent belongs in its mission/slice.`)
787
954
  .option("--evidence-ref <path>", "OPR.0.4.4.19 FR-5: durable-artifact pointer for the new qitem. Required by the daemon when the new qitem is human-routed; optional otherwise.")
788
955
  .option("--host <id>", QUEUE_HOST_OPTION_HELP)
789
956
  .option("--no-nudge", "Suppress the default nudge to the new destination")
957
+ .option("--full", "Print the whole response row(s) as today, even when output.compact is on (the receipt's waiting keeps only blocker and nextBackstop)")
790
958
  .option("--json", "JSON output for agents")
791
959
  .action(async (qitemId, opts) => {
792
960
  // P21 I3 reconcile: the handing-off seat is DERIVED from the seat env (X-OpenRig-Session) —
@@ -842,7 +1010,9 @@ workspace home that is deferred/not-imminent belongs in its mission/slice.`)
842
1010
  nudge: opts.nudge,
843
1011
  ...(hostResolved.hostId !== undefined ? { hostId: hostResolved.hostId } : {}),
844
1012
  });
845
- await printQueueItemResult(client, qitemId, opts.json ?? false, res.data, res.status);
1013
+ await printQueueItemResult(client, qitemId, opts.json ?? false, res.data, res.status, writeReceipt(opts.full, {
1014
+ verb: "handoff-and-complete", nudgeSuppressed: opts.nudge === false, remoteHost: remoteHostOf(hostResolved.hostId),
1015
+ }));
846
1016
  });
847
1017
  });
848
1018
  cmd