@openrig/cli 0.7.7 → 0.7.8

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 (590) hide show
  1. package/README.md +5 -5
  2. package/daemon/assets/openshell/Dockerfile +15 -0
  3. package/daemon/assets/openshell/README.md +137 -0
  4. package/daemon/assets/openshell/agents/coordinator/agent.yaml +20 -0
  5. package/daemon/assets/openshell/agents/coordinator/role.md +1 -0
  6. package/daemon/assets/openshell/agents/worker/agent.yaml +20 -0
  7. package/daemon/assets/openshell/agents/worker/role.md +3 -0
  8. package/daemon/assets/openshell/claude-code-provider.yaml +55 -0
  9. package/daemon/assets/openshell/driver-v1.schema.json +81 -0
  10. package/daemon/assets/openshell/guest.py +306 -0
  11. package/daemon/assets/openshell/policy.yaml +33 -0
  12. package/daemon/assets/openshell/preset.yaml +12 -0
  13. package/daemon/assets/openshell/rig.yaml +20 -0
  14. package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +1 -1
  15. package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
  16. package/daemon/assets/plugins/openrig-core/skills/seat-continuity-and-handover/SKILL.md +1 -1
  17. package/daemon/context-packs/help/manifest.yaml +1 -1
  18. package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
  19. package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +16 -6
  20. package/daemon/context-packs/reference/getting-started.md +8 -3
  21. package/daemon/context-packs/reference/manifest.yaml +1 -1
  22. package/daemon/context-packs/reference/rig-spec.md +69 -12
  23. package/daemon/context-packs/reference/whats-new.md +119 -15
  24. package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
  25. package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
  26. package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
  27. package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
  28. package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
  29. package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
  30. package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
  31. package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
  32. package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
  33. package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
  34. package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
  35. package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
  36. package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
  37. package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
  38. package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
  39. package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
  40. package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
  41. package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
  42. package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
  43. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
  44. package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
  45. package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
  46. package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
  47. package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
  48. package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
  49. package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
  50. package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
  51. package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
  52. package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
  53. package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
  54. package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
  55. package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
  56. package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
  57. package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
  58. package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
  59. package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
  60. package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
  61. package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
  62. package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
  63. package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
  64. package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
  65. package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
  66. package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
  67. package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
  68. package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
  69. package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
  70. package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
  71. package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
  72. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
  73. package/daemon/context-packs/skills/seat-continuity-and-handover/SKILL.md +1 -1
  74. package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
  75. package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
  76. package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
  77. package/daemon/context-packs/world-example/manifest.yaml +1 -1
  78. package/daemon/context-packs/world-public/manifest.yaml +1 -1
  79. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  80. package/daemon/dist/adapters/claude-code-adapter.js +37 -6
  81. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  82. package/daemon/dist/adapters/claude-resume.d.ts +2 -1
  83. package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
  84. package/daemon/dist/adapters/claude-resume.js +6 -3
  85. package/daemon/dist/adapters/claude-resume.js.map +1 -1
  86. package/daemon/dist/adapters/codex-runtime-adapter.d.ts +4 -7
  87. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  88. package/daemon/dist/adapters/codex-runtime-adapter.js +86 -33
  89. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  90. package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts +13 -1
  91. package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts.map +1 -1
  92. package/daemon/dist/adapters/community-harness-runtime-adapter.js +28 -1
  93. package/daemon/dist/adapters/community-harness-runtime-adapter.js.map +1 -1
  94. package/daemon/dist/adapters/openshell-driver.d.ts +39 -0
  95. package/daemon/dist/adapters/openshell-driver.d.ts.map +1 -0
  96. package/daemon/dist/adapters/openshell-driver.js +139 -0
  97. package/daemon/dist/adapters/openshell-driver.js.map +1 -0
  98. package/daemon/dist/adapters/openshell-podman-observer.d.ts +30 -0
  99. package/daemon/dist/adapters/openshell-podman-observer.d.ts.map +1 -0
  100. package/daemon/dist/adapters/openshell-podman-observer.js +94 -0
  101. package/daemon/dist/adapters/openshell-podman-observer.js.map +1 -0
  102. package/daemon/dist/adapters/pi-openrouter-charge.d.ts +1 -0
  103. package/daemon/dist/adapters/pi-openrouter-charge.d.ts.map +1 -1
  104. package/daemon/dist/adapters/pi-openrouter-charge.js +17 -3
  105. package/daemon/dist/adapters/pi-openrouter-charge.js.map +1 -1
  106. package/daemon/dist/adapters/tmux-control.d.ts +12 -6
  107. package/daemon/dist/adapters/tmux-control.d.ts.map +1 -1
  108. package/daemon/dist/adapters/tmux-control.js +42 -21
  109. package/daemon/dist/adapters/tmux-control.js.map +1 -1
  110. package/daemon/dist/adapters/tmux-server.d.ts +6 -3
  111. package/daemon/dist/adapters/tmux-server.d.ts.map +1 -1
  112. package/daemon/dist/adapters/tmux-server.js +13 -8
  113. package/daemon/dist/adapters/tmux-server.js.map +1 -1
  114. package/daemon/dist/adapters/tmux.d.ts +8 -2
  115. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  116. package/daemon/dist/adapters/tmux.js +38 -11
  117. package/daemon/dist/adapters/tmux.js.map +1 -1
  118. package/daemon/dist/build-info.js +3 -3
  119. package/daemon/dist/db/all-migrations.d.ts.map +1 -1
  120. package/daemon/dist/db/all-migrations.js +8 -0
  121. package/daemon/dist/db/all-migrations.js.map +1 -1
  122. package/daemon/dist/db/migrations/142_node_claude_mcp.d.ts +3 -0
  123. package/daemon/dist/db/migrations/142_node_claude_mcp.d.ts.map +1 -0
  124. package/daemon/dist/db/migrations/142_node_claude_mcp.js +5 -0
  125. package/daemon/dist/db/migrations/142_node_claude_mcp.js.map +1 -0
  126. package/daemon/dist/db/migrations/143_activity_grants.d.ts +8 -0
  127. package/daemon/dist/db/migrations/143_activity_grants.d.ts.map +1 -0
  128. package/daemon/dist/db/migrations/143_activity_grants.js +22 -0
  129. package/daemon/dist/db/migrations/143_activity_grants.js.map +1 -0
  130. package/daemon/dist/db/migrations/144_environment_bindings.d.ts +4 -0
  131. package/daemon/dist/db/migrations/144_environment_bindings.d.ts.map +1 -0
  132. package/daemon/dist/db/migrations/144_environment_bindings.js +31 -0
  133. package/daemon/dist/db/migrations/144_environment_bindings.js.map +1 -0
  134. package/daemon/dist/db/migrations/145_node_permissions_to.d.ts +5 -0
  135. package/daemon/dist/db/migrations/145_node_permissions_to.d.ts.map +1 -0
  136. package/daemon/dist/db/migrations/145_node_permissions_to.js +7 -0
  137. package/daemon/dist/db/migrations/145_node_permissions_to.js.map +1 -0
  138. package/daemon/dist/domain/active-occupant.d.ts +2 -0
  139. package/daemon/dist/domain/active-occupant.d.ts.map +1 -1
  140. package/daemon/dist/domain/active-occupant.js +9 -1
  141. package/daemon/dist/domain/active-occupant.js.map +1 -1
  142. package/daemon/dist/domain/activity-grants.d.ts +63 -0
  143. package/daemon/dist/domain/activity-grants.d.ts.map +1 -0
  144. package/daemon/dist/domain/activity-grants.js +106 -0
  145. package/daemon/dist/domain/activity-grants.js.map +1 -0
  146. package/daemon/dist/domain/agent-images/agent-image-library-service.d.ts.map +1 -1
  147. package/daemon/dist/domain/agent-images/agent-image-library-service.js +5 -2
  148. package/daemon/dist/domain/agent-images/agent-image-library-service.js.map +1 -1
  149. package/daemon/dist/domain/claude-compaction-enforcer.d.ts +11 -4
  150. package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
  151. package/daemon/dist/domain/claude-compaction-enforcer.js +34 -10
  152. package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
  153. package/daemon/dist/domain/claude-mcp.d.ts +10 -0
  154. package/daemon/dist/domain/claude-mcp.d.ts.map +1 -0
  155. package/daemon/dist/domain/claude-mcp.js +19 -0
  156. package/daemon/dist/domain/claude-mcp.js.map +1 -0
  157. package/daemon/dist/domain/codex-owned-plugin-trust.d.ts.map +1 -1
  158. package/daemon/dist/domain/codex-owned-plugin-trust.js +2 -1
  159. package/daemon/dist/domain/codex-owned-plugin-trust.js.map +1 -1
  160. package/daemon/dist/domain/community-harness-presets.d.ts +2 -1
  161. package/daemon/dist/domain/community-harness-presets.d.ts.map +1 -1
  162. package/daemon/dist/domain/community-harness-presets.js +3 -2
  163. package/daemon/dist/domain/community-harness-presets.js.map +1 -1
  164. package/daemon/dist/domain/context-monitor.d.ts +2 -2
  165. package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
  166. package/daemon/dist/domain/context-monitor.js +8 -2
  167. package/daemon/dist/domain/context-monitor.js.map +1 -1
  168. package/daemon/dist/domain/desired-claude-activity-hooks.d.ts +21 -0
  169. package/daemon/dist/domain/desired-claude-activity-hooks.d.ts.map +1 -0
  170. package/daemon/dist/domain/desired-claude-activity-hooks.js +30 -0
  171. package/daemon/dist/domain/desired-claude-activity-hooks.js.map +1 -0
  172. package/daemon/dist/domain/draft-aware-delivery.d.ts.map +1 -1
  173. package/daemon/dist/domain/draft-aware-delivery.js +6 -2
  174. package/daemon/dist/domain/draft-aware-delivery.js.map +1 -1
  175. package/daemon/dist/domain/environment-artifacts.d.ts +49 -0
  176. package/daemon/dist/domain/environment-artifacts.d.ts.map +1 -0
  177. package/daemon/dist/domain/environment-artifacts.js +158 -0
  178. package/daemon/dist/domain/environment-artifacts.js.map +1 -0
  179. package/daemon/dist/domain/environment-lifecycle.d.ts +119 -0
  180. package/daemon/dist/domain/environment-lifecycle.d.ts.map +1 -0
  181. package/daemon/dist/domain/environment-lifecycle.js +461 -0
  182. package/daemon/dist/domain/environment-lifecycle.js.map +1 -0
  183. package/daemon/dist/domain/environment-platform.d.ts +121 -0
  184. package/daemon/dist/domain/environment-platform.d.ts.map +1 -0
  185. package/daemon/dist/domain/environment-platform.js +280 -0
  186. package/daemon/dist/domain/environment-platform.js.map +1 -0
  187. package/daemon/dist/domain/environment-startup.d.ts +41 -0
  188. package/daemon/dist/domain/environment-startup.d.ts.map +1 -0
  189. package/daemon/dist/domain/environment-startup.js +281 -0
  190. package/daemon/dist/domain/environment-startup.js.map +1 -0
  191. package/daemon/dist/domain/expected-conversation.d.ts +20 -0
  192. package/daemon/dist/domain/expected-conversation.d.ts.map +1 -0
  193. package/daemon/dist/domain/expected-conversation.js +101 -0
  194. package/daemon/dist/domain/expected-conversation.js.map +1 -0
  195. package/daemon/dist/domain/gateway/operator-delivery-engine.d.ts +8 -1
  196. package/daemon/dist/domain/gateway/operator-delivery-engine.d.ts.map +1 -1
  197. package/daemon/dist/domain/gateway/operator-delivery-engine.js +61 -4
  198. package/daemon/dist/domain/gateway/operator-delivery-engine.js.map +1 -1
  199. package/daemon/dist/domain/gateway/slack/inbound.d.ts +2 -0
  200. package/daemon/dist/domain/gateway/slack/inbound.d.ts.map +1 -1
  201. package/daemon/dist/domain/gateway/slack/inbound.js +40 -8
  202. package/daemon/dist/domain/gateway/slack/inbound.js.map +1 -1
  203. package/daemon/dist/domain/gateway/slack/message.d.ts +16 -0
  204. package/daemon/dist/domain/gateway/slack/message.d.ts.map +1 -1
  205. package/daemon/dist/domain/gateway/slack/message.js +216 -7
  206. package/daemon/dist/domain/gateway/slack/message.js.map +1 -1
  207. package/daemon/dist/domain/gateway/slack/queue-access.d.ts +14 -0
  208. package/daemon/dist/domain/gateway/slack/queue-access.d.ts.map +1 -1
  209. package/daemon/dist/domain/gateway/slack/queue-access.js +9 -1
  210. package/daemon/dist/domain/gateway/slack/queue-access.js.map +1 -1
  211. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts.map +1 -1
  212. package/daemon/dist/domain/gateway/slack/slack-delivery.js +9 -4
  213. package/daemon/dist/domain/gateway/slack/slack-delivery.js.map +1 -1
  214. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts +2 -0
  215. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
  216. package/daemon/dist/domain/gateway/slack/slack-subsystem.js +6 -1
  217. package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
  218. package/daemon/dist/domain/hosts/hosts-registry-writer.d.ts +22 -0
  219. package/daemon/dist/domain/hosts/hosts-registry-writer.d.ts.map +1 -1
  220. package/daemon/dist/domain/hosts/hosts-registry-writer.js +116 -0
  221. package/daemon/dist/domain/hosts/hosts-registry-writer.js.map +1 -1
  222. package/daemon/dist/domain/kernel-hook-review.d.ts +16 -0
  223. package/daemon/dist/domain/kernel-hook-review.d.ts.map +1 -0
  224. package/daemon/dist/domain/kernel-hook-review.js +49 -0
  225. package/daemon/dist/domain/kernel-hook-review.js.map +1 -0
  226. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts +3 -0
  227. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
  228. package/daemon/dist/domain/mission-control/mission-control-write-contract.js +20 -5
  229. package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
  230. package/daemon/dist/domain/model-divergence/current-generation-record.d.ts.map +1 -1
  231. package/daemon/dist/domain/model-divergence/current-generation-record.js +10 -6
  232. package/daemon/dist/domain/model-divergence/current-generation-record.js.map +1 -1
  233. package/daemon/dist/domain/native-process-lineage.d.ts +3 -0
  234. package/daemon/dist/domain/native-process-lineage.d.ts.map +1 -1
  235. package/daemon/dist/domain/native-process-lineage.js +34 -1
  236. package/daemon/dist/domain/native-process-lineage.js.map +1 -1
  237. package/daemon/dist/domain/native-resume-probe.d.ts +2 -1
  238. package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
  239. package/daemon/dist/domain/native-resume-probe.js +4 -2
  240. package/daemon/dist/domain/native-resume-probe.js.map +1 -1
  241. package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
  242. package/daemon/dist/domain/node-inventory.js +18 -8
  243. package/daemon/dist/domain/node-inventory.js.map +1 -1
  244. package/daemon/dist/domain/node-launcher.d.ts +3 -0
  245. package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
  246. package/daemon/dist/domain/node-launcher.js +6 -0
  247. package/daemon/dist/domain/node-launcher.js.map +1 -1
  248. package/daemon/dist/domain/outbox-handler.d.ts +12 -0
  249. package/daemon/dist/domain/outbox-handler.d.ts.map +1 -1
  250. package/daemon/dist/domain/outbox-handler.js +32 -3
  251. package/daemon/dist/domain/outbox-handler.js.map +1 -1
  252. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts +10 -0
  253. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts.map +1 -1
  254. package/daemon/dist/domain/policies/parked-owner-consumer.js +60 -4
  255. package/daemon/dist/domain/policies/parked-owner-consumer.js.map +1 -1
  256. package/daemon/dist/domain/provider/claude-seat-switch.d.ts +9 -3
  257. package/daemon/dist/domain/provider/claude-seat-switch.d.ts.map +1 -1
  258. package/daemon/dist/domain/provider/claude-seat-switch.js +100 -17
  259. package/daemon/dist/domain/provider/claude-seat-switch.js.map +1 -1
  260. package/daemon/dist/domain/provider/provider-service-impl.js +1 -1
  261. package/daemon/dist/domain/provider/provider-service-impl.js.map +1 -1
  262. package/daemon/dist/domain/provider/provider-service.d.ts +32 -2
  263. package/daemon/dist/domain/provider/provider-service.d.ts.map +1 -1
  264. package/daemon/dist/domain/provider/provider-types.d.ts +1 -1
  265. package/daemon/dist/domain/provider/provider-types.d.ts.map +1 -1
  266. package/daemon/dist/domain/queue-repository.d.ts +36 -5
  267. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  268. package/daemon/dist/domain/queue-repository.js +155 -37
  269. package/daemon/dist/domain/queue-repository.js.map +1 -1
  270. package/daemon/dist/domain/queue-stuck-sweep.d.ts +1 -1
  271. package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
  272. package/daemon/dist/domain/queue-stuck-sweep.js +31 -0
  273. package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
  274. package/daemon/dist/domain/queue-wake-ladder.d.ts +3 -0
  275. package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
  276. package/daemon/dist/domain/queue-wake-ladder.js +124 -25
  277. package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
  278. package/daemon/dist/domain/restore-check-service.d.ts +2 -7
  279. package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
  280. package/daemon/dist/domain/restore-check-service.js.map +1 -1
  281. package/daemon/dist/domain/restore-orchestrator.d.ts +35 -3
  282. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  283. package/daemon/dist/domain/restore-orchestrator.js +166 -21
  284. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  285. package/daemon/dist/domain/resume-metadata-refresher.d.ts +2 -1
  286. package/daemon/dist/domain/resume-metadata-refresher.d.ts.map +1 -1
  287. package/daemon/dist/domain/resume-metadata-refresher.js +20 -6
  288. package/daemon/dist/domain/resume-metadata-refresher.js.map +1 -1
  289. package/daemon/dist/domain/rig-expansion-service.js +1 -1
  290. package/daemon/dist/domain/rig-expansion-service.js.map +1 -1
  291. package/daemon/dist/domain/rig-repository.d.ts +10 -0
  292. package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
  293. package/daemon/dist/domain/rig-repository.js +37 -0
  294. package/daemon/dist/domain/rig-repository.js.map +1 -1
  295. package/daemon/dist/domain/rigspec-codec.d.ts.map +1 -1
  296. package/daemon/dist/domain/rigspec-codec.js +4 -0
  297. package/daemon/dist/domain/rigspec-codec.js.map +1 -1
  298. package/daemon/dist/domain/rigspec-exporter.d.ts +8 -0
  299. package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
  300. package/daemon/dist/domain/rigspec-exporter.js +60 -2
  301. package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
  302. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  303. package/daemon/dist/domain/rigspec-instantiator.js +19 -4
  304. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  305. package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
  306. package/daemon/dist/domain/rigspec-schema.js +24 -1
  307. package/daemon/dist/domain/rigspec-schema.js.map +1 -1
  308. package/daemon/dist/domain/runner-permissions.d.ts +135 -0
  309. package/daemon/dist/domain/runner-permissions.d.ts.map +1 -0
  310. package/daemon/dist/domain/runner-permissions.js +318 -0
  311. package/daemon/dist/domain/runner-permissions.js.map +1 -0
  312. package/daemon/dist/domain/runtime-adapter.d.ts +10 -0
  313. package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
  314. package/daemon/dist/domain/runtime-adapter.js.map +1 -1
  315. package/daemon/dist/domain/seat-effort.d.ts +6 -0
  316. package/daemon/dist/domain/seat-effort.d.ts.map +1 -1
  317. package/daemon/dist/domain/seat-effort.js +0 -2
  318. package/daemon/dist/domain/seat-effort.js.map +1 -1
  319. package/daemon/dist/domain/seat-handover-planner.js +1 -1
  320. package/daemon/dist/domain/seat-handover-planner.js.map +1 -1
  321. package/daemon/dist/domain/seat-handover-service.d.ts +2 -0
  322. package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
  323. package/daemon/dist/domain/seat-handover-service.js +45 -28
  324. package/daemon/dist/domain/seat-handover-service.js.map +1 -1
  325. package/daemon/dist/domain/seat-lifecycle-service.d.ts +24 -2
  326. package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
  327. package/daemon/dist/domain/seat-lifecycle-service.js +62 -1
  328. package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
  329. package/daemon/dist/domain/seat-restart-in-place.d.ts.map +1 -1
  330. package/daemon/dist/domain/seat-restart-in-place.js +6 -1
  331. package/daemon/dist/domain/seat-restart-in-place.js.map +1 -1
  332. package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -1
  333. package/daemon/dist/domain/seat-runtime-switch-service.js +4 -0
  334. package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
  335. package/daemon/dist/domain/seat-skill-storage.d.ts +6 -4
  336. package/daemon/dist/domain/seat-skill-storage.d.ts.map +1 -1
  337. package/daemon/dist/domain/seat-skill-storage.js +25 -5
  338. package/daemon/dist/domain/seat-skill-storage.js.map +1 -1
  339. package/daemon/dist/domain/seat-status-service.d.ts +5 -0
  340. package/daemon/dist/domain/seat-status-service.d.ts.map +1 -1
  341. package/daemon/dist/domain/seat-status-service.js +9 -0
  342. package/daemon/dist/domain/seat-status-service.js.map +1 -1
  343. package/daemon/dist/domain/self-attach-service.d.ts +8 -1
  344. package/daemon/dist/domain/self-attach-service.d.ts.map +1 -1
  345. package/daemon/dist/domain/self-attach-service.js +26 -0
  346. package/daemon/dist/domain/self-attach-service.js.map +1 -1
  347. package/daemon/dist/domain/session-transport.d.ts +10 -0
  348. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  349. package/daemon/dist/domain/session-transport.js +112 -10
  350. package/daemon/dist/domain/session-transport.js.map +1 -1
  351. package/daemon/dist/domain/snapshot-capture.d.ts.map +1 -1
  352. package/daemon/dist/domain/snapshot-capture.js +14 -0
  353. package/daemon/dist/domain/snapshot-capture.js.map +1 -1
  354. package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
  355. package/daemon/dist/domain/startup-orchestrator.js +32 -1
  356. package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
  357. package/daemon/dist/domain/successor-session-launcher.d.ts +1 -0
  358. package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
  359. package/daemon/dist/domain/successor-session-launcher.js +1 -0
  360. package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
  361. package/daemon/dist/domain/terminal/herdr-follow-view.d.ts.map +1 -1
  362. package/daemon/dist/domain/terminal/herdr-follow-view.js +22 -4
  363. package/daemon/dist/domain/terminal/herdr-follow-view.js.map +1 -1
  364. package/daemon/dist/domain/terminal/scope-task-terminal-view.d.ts +12 -1
  365. package/daemon/dist/domain/terminal/scope-task-terminal-view.d.ts.map +1 -1
  366. package/daemon/dist/domain/terminal/scope-task-terminal-view.js +120 -18
  367. package/daemon/dist/domain/terminal/scope-task-terminal-view.js.map +1 -1
  368. package/daemon/dist/domain/terminal/terminal-following.js +1 -1
  369. package/daemon/dist/domain/terminal/terminal-following.js.map +1 -1
  370. package/daemon/dist/domain/terminal/terminal-provider.d.ts +2 -0
  371. package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
  372. package/daemon/dist/domain/terminal/terminal-service.d.ts +3 -2
  373. package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
  374. package/daemon/dist/domain/terminal/terminal-service.js +18 -27
  375. package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
  376. package/daemon/dist/domain/terminal/view-composer.d.ts +6 -3
  377. package/daemon/dist/domain/terminal/view-composer.d.ts.map +1 -1
  378. package/daemon/dist/domain/terminal/view-composer.js +15 -5
  379. package/daemon/dist/domain/terminal/view-composer.js.map +1 -1
  380. package/daemon/dist/domain/tmux-server-selection.d.ts +47 -0
  381. package/daemon/dist/domain/tmux-server-selection.d.ts.map +1 -0
  382. package/daemon/dist/domain/tmux-server-selection.js +220 -0
  383. package/daemon/dist/domain/tmux-server-selection.js.map +1 -0
  384. package/daemon/dist/domain/transcript-store.d.ts.map +1 -1
  385. package/daemon/dist/domain/transcript-store.js +8 -5
  386. package/daemon/dist/domain/transcript-store.js.map +1 -1
  387. package/daemon/dist/domain/types.d.ts +38 -0
  388. package/daemon/dist/domain/types.d.ts.map +1 -1
  389. package/daemon/dist/domain/types.js.map +1 -1
  390. package/daemon/dist/domain/user-settings/settings-browser.d.ts.map +1 -1
  391. package/daemon/dist/domain/user-settings/settings-browser.js +3 -1
  392. package/daemon/dist/domain/user-settings/settings-browser.js.map +1 -1
  393. package/daemon/dist/domain/user-settings/settings-store.d.ts +1 -1
  394. package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
  395. package/daemon/dist/domain/user-settings/settings-store.js +9 -0
  396. package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
  397. package/daemon/dist/domain/watchdog-delivery.d.ts +1 -0
  398. package/daemon/dist/domain/watchdog-delivery.d.ts.map +1 -1
  399. package/daemon/dist/domain/watchdog-delivery.js +15 -3
  400. package/daemon/dist/domain/watchdog-delivery.js.map +1 -1
  401. package/daemon/dist/domain/watchdog-policy-engine.d.ts +2 -0
  402. package/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -1
  403. package/daemon/dist/domain/watchdog-policy-engine.js +3 -1
  404. package/daemon/dist/domain/watchdog-policy-engine.js.map +1 -1
  405. package/daemon/dist/domain/workflow-runtime.d.ts +1 -1
  406. package/daemon/dist/index.d.ts +4 -0
  407. package/daemon/dist/index.d.ts.map +1 -1
  408. package/daemon/dist/index.js +14 -0
  409. package/daemon/dist/index.js.map +1 -1
  410. package/daemon/dist/routes/activity.d.ts +4 -0
  411. package/daemon/dist/routes/activity.d.ts.map +1 -1
  412. package/daemon/dist/routes/activity.js +258 -18
  413. package/daemon/dist/routes/activity.js.map +1 -1
  414. package/daemon/dist/routes/compaction.js +4 -2
  415. package/daemon/dist/routes/compaction.js.map +1 -1
  416. package/daemon/dist/routes/environments.d.ts +3 -0
  417. package/daemon/dist/routes/environments.d.ts.map +1 -0
  418. package/daemon/dist/routes/environments.js +104 -0
  419. package/daemon/dist/routes/environments.js.map +1 -0
  420. package/daemon/dist/routes/hosts.d.ts.map +1 -1
  421. package/daemon/dist/routes/hosts.js +80 -4
  422. package/daemon/dist/routes/hosts.js.map +1 -1
  423. package/daemon/dist/routes/provider.d.ts.map +1 -1
  424. package/daemon/dist/routes/provider.js +53 -7
  425. package/daemon/dist/routes/provider.js.map +1 -1
  426. package/daemon/dist/routes/restore-check.d.ts.map +1 -1
  427. package/daemon/dist/routes/restore-check.js +5 -19
  428. package/daemon/dist/routes/restore-check.js.map +1 -1
  429. package/daemon/dist/routes/rigs.js +3 -0
  430. package/daemon/dist/routes/rigs.js.map +1 -1
  431. package/daemon/dist/routes/rigspec.d.ts.map +1 -1
  432. package/daemon/dist/routes/rigspec.js +8 -3
  433. package/daemon/dist/routes/rigspec.js.map +1 -1
  434. package/daemon/dist/routes/seat.d.ts.map +1 -1
  435. package/daemon/dist/routes/seat.js +29 -2
  436. package/daemon/dist/routes/seat.js.map +1 -1
  437. package/daemon/dist/routes/sessions.d.ts.map +1 -1
  438. package/daemon/dist/routes/sessions.js +66 -20
  439. package/daemon/dist/routes/sessions.js.map +1 -1
  440. package/daemon/dist/routes/transport.d.ts.map +1 -1
  441. package/daemon/dist/routes/transport.js +23 -2
  442. package/daemon/dist/routes/transport.js.map +1 -1
  443. package/daemon/dist/server.d.ts +6 -0
  444. package/daemon/dist/server.d.ts.map +1 -1
  445. package/daemon/dist/server.js +56 -1
  446. package/daemon/dist/server.js.map +1 -1
  447. package/daemon/dist/startup.d.ts +2 -0
  448. package/daemon/dist/startup.d.ts.map +1 -1
  449. package/daemon/dist/startup.js +61 -26
  450. package/daemon/dist/startup.js.map +1 -1
  451. package/daemon/docs/reference/agent-startup-guide.md +4 -0
  452. package/daemon/docs/reference/author-contracts.md +6 -6
  453. package/daemon/docs/reference/community-harness-examples/dsh/README.md +71 -0
  454. package/daemon/docs/reference/community-harness-examples/dsh/dsh.yaml +20 -0
  455. package/daemon/docs/reference/community-harness-examples/dsh/openrig-dsh-runner.mjs +543 -0
  456. package/daemon/docs/reference/community-harness-examples/openshell/README.md +5 -0
  457. package/daemon/docs/reference/community-harness-presets.md +25 -1
  458. package/daemon/docs/reference/execution-platform-contract.md +1 -1
  459. package/daemon/docs/reference/getting-started.md +8 -3
  460. package/daemon/docs/reference/harness-runner-contract.md +151 -16
  461. package/daemon/docs/reference/pi-tool-selection-recovery.md +83 -0
  462. package/daemon/docs/reference/quickstart.md +1 -1
  463. package/daemon/docs/reference/rig-spec.md +69 -12
  464. package/daemon/docs/reference/runner-conformance/README.md +75 -0
  465. package/daemon/docs/reference/runner-conformance/check-runner.mjs +698 -0
  466. package/daemon/docs/reference/runner-conformance/fake-acp-agent.mjs +143 -0
  467. package/daemon/docs/reference/terminal-sessions.md +85 -9
  468. package/daemon/docs/reference/tmux-servers.md +166 -0
  469. package/daemon/docs/reference/whats-new.md +119 -15
  470. package/dist/acp/connector.d.ts.map +1 -1
  471. package/dist/acp/connector.js +6 -1
  472. package/dist/acp/connector.js.map +1 -1
  473. package/dist/build-info.js +3 -3
  474. package/dist/client.d.ts +3 -0
  475. package/dist/client.d.ts.map +1 -1
  476. package/dist/client.js +28 -0
  477. package/dist/client.js.map +1 -1
  478. package/dist/commands/attach.d.ts +1 -0
  479. package/dist/commands/attach.d.ts.map +1 -1
  480. package/dist/commands/attach.js +8 -2
  481. package/dist/commands/attach.js.map +1 -1
  482. package/dist/commands/compact.d.ts.map +1 -1
  483. package/dist/commands/compact.js +7 -4
  484. package/dist/commands/compact.js.map +1 -1
  485. package/dist/commands/config.d.ts.map +1 -1
  486. package/dist/commands/config.js +8 -3
  487. package/dist/commands/config.js.map +1 -1
  488. package/dist/commands/daemon.d.ts.map +1 -1
  489. package/dist/commands/daemon.js +7 -1
  490. package/dist/commands/daemon.js.map +1 -1
  491. package/dist/commands/destroy.d.ts.map +1 -1
  492. package/dist/commands/destroy.js +2 -0
  493. package/dist/commands/destroy.js.map +1 -1
  494. package/dist/commands/doctor.d.ts +8 -1
  495. package/dist/commands/doctor.d.ts.map +1 -1
  496. package/dist/commands/doctor.js +79 -5
  497. package/dist/commands/doctor.js.map +1 -1
  498. package/dist/commands/env.js +1 -1
  499. package/dist/commands/env.js.map +1 -1
  500. package/dist/commands/environment.d.ts +8 -0
  501. package/dist/commands/environment.d.ts.map +1 -0
  502. package/dist/commands/environment.js +194 -0
  503. package/dist/commands/environment.js.map +1 -0
  504. package/dist/commands/export.d.ts.map +1 -1
  505. package/dist/commands/export.js +5 -2
  506. package/dist/commands/export.js.map +1 -1
  507. package/dist/commands/host.d.ts.map +1 -1
  508. package/dist/commands/host.js +77 -7
  509. package/dist/commands/host.js.map +1 -1
  510. package/dist/commands/provider.d.ts.map +1 -1
  511. package/dist/commands/provider.js +2 -0
  512. package/dist/commands/provider.js.map +1 -1
  513. package/dist/commands/queue.d.ts.map +1 -1
  514. package/dist/commands/queue.js +12 -2
  515. package/dist/commands/queue.js.map +1 -1
  516. package/dist/commands/seat.d.ts.map +1 -1
  517. package/dist/commands/seat.js +54 -4
  518. package/dist/commands/seat.js.map +1 -1
  519. package/dist/commands/setup.d.ts.map +1 -1
  520. package/dist/commands/setup.js +18 -0
  521. package/dist/commands/setup.js.map +1 -1
  522. package/dist/commands/terminal.d.ts +2 -0
  523. package/dist/commands/terminal.d.ts.map +1 -1
  524. package/dist/commands/terminal.js +31 -2
  525. package/dist/commands/terminal.js.map +1 -1
  526. package/dist/commands/tui.d.ts +3 -2
  527. package/dist/commands/tui.d.ts.map +1 -1
  528. package/dist/commands/tui.js.map +1 -1
  529. package/dist/config-store.d.ts +3 -1
  530. package/dist/config-store.d.ts.map +1 -1
  531. package/dist/config-store.js +10 -0
  532. package/dist/config-store.js.map +1 -1
  533. package/dist/cross-host-target.d.ts.map +1 -1
  534. package/dist/cross-host-target.js +3 -1
  535. package/dist/cross-host-target.js.map +1 -1
  536. package/dist/daemon-lifecycle.d.ts +6 -0
  537. package/dist/daemon-lifecycle.d.ts.map +1 -1
  538. package/dist/daemon-lifecycle.js +66 -4
  539. package/dist/daemon-lifecycle.js.map +1 -1
  540. package/dist/daemon-reachability.d.ts +2 -1
  541. package/dist/daemon-reachability.d.ts.map +1 -1
  542. package/dist/daemon-reachability.js +3 -2
  543. package/dist/daemon-reachability.js.map +1 -1
  544. package/dist/destroy-helpers.d.ts +3 -2
  545. package/dist/destroy-helpers.d.ts.map +1 -1
  546. package/dist/destroy-helpers.js +6 -3
  547. package/dist/destroy-helpers.js.map +1 -1
  548. package/dist/host-bindings.js +1 -1
  549. package/dist/host-bindings.js.map +1 -1
  550. package/dist/host-registry.d.ts +22 -0
  551. package/dist/host-registry.d.ts.map +1 -1
  552. package/dist/host-registry.js +121 -0
  553. package/dist/host-registry.js.map +1 -1
  554. package/dist/index.d.ts +2 -0
  555. package/dist/index.d.ts.map +1 -1
  556. package/dist/index.js +2 -0
  557. package/dist/index.js.map +1 -1
  558. package/dist/lazy-program.d.ts.map +1 -1
  559. package/dist/lazy-program.js +1 -0
  560. package/dist/lazy-program.js.map +1 -1
  561. package/dist/mcp-server.d.ts.map +1 -1
  562. package/dist/mcp-server.js +36 -2
  563. package/dist/mcp-server.js.map +1 -1
  564. package/dist/openrig-compat.d.ts +1 -1
  565. package/dist/openrig-compat.d.ts.map +1 -1
  566. package/dist/openrig-compat.js +2 -2
  567. package/dist/openrig-compat.js.map +1 -1
  568. package/dist/shared-tui.d.ts +4 -2
  569. package/dist/shared-tui.d.ts.map +1 -1
  570. package/dist/shared-tui.js +4 -11
  571. package/dist/shared-tui.js.map +1 -1
  572. package/dist/terminal-window.d.ts.map +1 -1
  573. package/dist/terminal-window.js +34 -29
  574. package/dist/terminal-window.js.map +1 -1
  575. package/dist/tmux-attachment.d.ts +17 -0
  576. package/dist/tmux-attachment.d.ts.map +1 -0
  577. package/dist/tmux-attachment.js +89 -0
  578. package/dist/tmux-attachment.js.map +1 -0
  579. package/package.json +2 -2
  580. package/tui/dist/hydrate.d.ts.map +1 -1
  581. package/tui/dist/hydrate.js +8 -3
  582. package/tui/dist/hydrate.js.map +1 -1
  583. package/tui/dist/render.d.ts.map +1 -1
  584. package/tui/dist/render.js +7 -1
  585. package/tui/dist/render.js.map +1 -1
  586. package/tui/dist/terminals/terminal-model.d.ts.map +1 -1
  587. package/tui/dist/terminals/terminal-model.js +2 -1
  588. package/tui/dist/terminals/terminal-model.js.map +1 -1
  589. package/ui/dist/assets/{index-CMBgYrS7.js → index-Ch6UxNld.js} +88 -88
  590. package/ui/dist/index.html +1 -1
@@ -14,6 +14,7 @@ import { isBoundTerminalSeat } from "./terminal-seat.js";
14
14
  import { renderQueueHandoffNudge } from "./queue-nudge-text.js";
15
15
  import { getSelfHostId } from "./hosts/fanout-contract.js";
16
16
  import { parseSessionName, isHumanSeatSessionRef } from "./session-name.js";
17
+ import { runnerPermissionOrigin } from "./runner-permissions.js";
17
18
  import { parseReplyToChoice, parseReplyToThreadMissing, formatReplyToChoice, describeReplyToFallback, REPLY_TO_CHOICE_ACTOR } from "./reply-to-choice.js";
18
19
  import { classifyDestination } from "./gateway/destination-resolver.js";
19
20
  import { join } from "node:path";
@@ -28,6 +29,10 @@ import { WatchdogJobsRepository } from "./watchdog-jobs-repository.js";
28
29
  import { armQueueWait, backOffQueueWait, refreshQueueWaits, evaluateQueueWait, retargetQueueWait, isQueueWait } from "./queue-wait-backoff.js";
29
30
  import { parseHumanQuestions, unansweredQuestions, describeTypedReplyPlacement } from "./human-questions.js";
30
31
  import { slackMicros } from "./gateway/slack/state-store.js";
32
+ /** A direct ask's answer row ID: from the ask, or from the ask and the park episode its answer belongs to. */
33
+ function humanAnswerId(askId, episodeKey) {
34
+ return `qitem-human-answer-${createHash("sha256").update(episodeKey ? `${askId}\n${episodeKey}` : askId).digest("hex").slice(0, 20)}`;
35
+ }
31
36
  export const QUEUE_STATES = [
32
37
  "pending",
33
38
  "in-progress",
@@ -1263,7 +1268,7 @@ export class QueueRepository {
1263
1268
  * primary user, who may answer anyone's ask. A shared channel's rows are correspondence, never an answer. */
1264
1269
  getHumanAnswer(qitemId, actorSession, opts = {}) {
1265
1270
  const ask = this.getById(qitemId);
1266
- if (!this.hasReplyToColumn || !ask || this.isSharedChannel(actorSession) || (ask.destinationSession !== actorSession && !opts.primaryUser)
1271
+ if (!this.hasReplyToColumn || !ask || this.isSharedChannel(actorSession) || (!this.answersAsk(ask, actorSession) && !opts.primaryUser)
1267
1272
  || ask.humanIntent === "update" || !this.isPersonAddress(ask.destinationSession))
1268
1273
  return null;
1269
1274
  const row = this.db.prepare(`SELECT qitem_id FROM queue_items
@@ -1274,15 +1279,38 @@ export class QueueRepository {
1274
1279
  return row ? this.getById(row.qitem_id) : null;
1275
1280
  }
1276
1281
  /** The lookup and create's insert run synchronously before its first delivery await.
1277
- * Every new surface uses the same ID; old IDs and their original bodies remain intact. */
1282
+ * Every new surface uses the same ID; old IDs and their original bodies remain intact. An answer to a decision parked
1283
+ * on the person it asked belongs to that park's question (`episodeKey`): its ID includes it, and only that ID counts. */
1278
1284
  async createHumanAnswer(input) {
1279
- const existing = this.getHumanAnswer(input.inboundReplyTo, input.sourceSession);
1285
+ const { episodeKey, ...create } = input;
1286
+ // A runner's permission request is answered in its ask, and the runner reads the answer back. No reply row: it
1287
+ // would wake the runner's terminal, where typed text reads as a prompt to its agent.
1288
+ const ask = this.getById(input.inboundReplyTo);
1289
+ if (ask && runnerPermissionOrigin(ask))
1290
+ return ask;
1291
+ const qitemId = humanAnswerId(input.inboundReplyTo, episodeKey);
1292
+ const existing = episodeKey ? this.getById(qitemId) : this.getHumanAnswer(input.inboundReplyTo, input.sourceSession);
1280
1293
  if (existing)
1281
1294
  return existing;
1282
- return this.create({ ...input,
1283
- qitemId: `qitem-human-answer-${createHash("sha256").update(input.inboundReplyTo).digest("hex").slice(0, 20)}`,
1284
- tags: [...new Set([...(input.tags ?? []), "human-answer"])],
1285
- });
1295
+ return this.create({ ...create, qitemId, tags: [...new Set([...(input.tags ?? []), "human-answer"])] });
1296
+ }
1297
+ /** Every answer this person returned to the ask (one per park), oldest first: after close, a replay finds the one its
1298
+ * event returned or was absorbed into, whichever park it answered. */
1299
+ listHumanAnswers(qitemId, actorSession) {
1300
+ const ask = this.getById(qitemId);
1301
+ if (!this.hasReplyToColumn || !ask || ask.destinationSession !== actorSession)
1302
+ return [];
1303
+ return this.db.prepare(`SELECT qitem_id, body FROM queue_items
1304
+ WHERE reply_to = ? AND source_session = ? AND destination_session = ?
1305
+ AND EXISTS (SELECT 1 FROM json_each(queue_items.tags) WHERE value = 'human-answer')
1306
+ ORDER BY ts_created, rowid`).all(qitemId, actorSession, ask.sourceSession)
1307
+ .map((row) => ({ qitemId: row.qitem_id, body: row.body ?? "" }));
1308
+ }
1309
+ /** This person's answer to the current question of a decision parked on them, if one was returned. */
1310
+ currentEpisodeAnswer(qitemId, actorSession) {
1311
+ const episode = this.currentHumanRequiredEpisode(qitemId);
1312
+ const row = episode ? this.getById(humanAnswerId(qitemId, episode.key)) : null;
1313
+ return row?.sourceSession === actorSession ? row : null;
1286
1314
  }
1287
1315
  async create(input) {
1288
1316
  // FOUNDER ROOT INVARIANT (2026-08-27, supersedes 51-09 incr 4 / ruling cb19867f Q2):
@@ -1540,12 +1568,44 @@ export class QueueRepository {
1540
1568
  }
1541
1569
  }
1542
1570
  /** A person by address or by the registry: a registered person may be addressed as their seat or an alias. */
1571
+ /** A runner's permission ask whose seat has since been relaunched can't be answered: its request died with the
1572
+ * occupant. Close it (canceled), so the person sees it isn't waiting, and return true. An unreadable ledger
1573
+ * closes nothing. */
1574
+ closeStaleRunnerPermission(qitemId) {
1575
+ const item = this.getById(qitemId);
1576
+ const origin = item?.state === "pending" ? runnerPermissionOrigin(item) : null;
1577
+ if (!item || !origin)
1578
+ return false;
1579
+ let current;
1580
+ try {
1581
+ current = this.db.prepare("SELECT generation_uuid FROM occupant_tenures WHERE node_id = ? ORDER BY generation_ordinal DESC LIMIT 1")
1582
+ .get(origin.nodeId)?.generation_uuid ?? null;
1583
+ }
1584
+ catch {
1585
+ return false;
1586
+ }
1587
+ if (current === origin.generation)
1588
+ return false;
1589
+ this.update({ qitemId, actorSession: item.sourceSession, state: "canceled",
1590
+ transitionNote: "runner-permission-stale reason=relaunched: a later occupant holds this seat, so any answer here is not sent." });
1591
+ return true;
1592
+ }
1543
1593
  isPersonAddress(destination) {
1544
1594
  if (isHumanSeatSessionRef(destination))
1545
1595
  return true;
1546
1596
  const registry = this.loadHumanRegistryFn();
1547
1597
  return registry.ok && resolveRegisteredHumanAddress(destination, registry.entities) !== null;
1548
1598
  }
1599
+ /** Who may answer an ask: the asked person; and on a runner's permission request, any registered person, since a
1600
+ * person's yes counts however it arrives there. A shared channel never answers. */
1601
+ answersAsk(item, actorSession) {
1602
+ if (item.destinationSession === actorSession)
1603
+ return true;
1604
+ if (!runnerPermissionOrigin(item) || this.isSharedChannel(actorSession))
1605
+ return false;
1606
+ const registry = this.loadHumanRegistryFn();
1607
+ return registry.ok && resolveRegisteredHumanAddress(actorSession, registry.entities) !== null;
1608
+ }
1549
1609
  /** A registered shared channel. It takes correspondence, so it never answers, approves, resolves or denies (0.7.3). */
1550
1610
  isSharedChannel(address) {
1551
1611
  return !!address && this.sharedChannelsFn().some((channel) => channel.address === address);
@@ -1659,10 +1719,11 @@ export class QueueRepository {
1659
1719
  this.persistSummary(newId, input.summary ?? null);
1660
1720
  this.persistEvidenceRef(newId, input.evidenceRef ?? null);
1661
1721
  this.persistMintingGeneration(newId, input.fromSession);
1722
+ const carried = this.carryPermissionQuestion(source, newId, input.toSession);
1662
1723
  const successorNotification = this.classifyOwnerNotification({
1663
1724
  action: "create",
1664
1725
  destinationSession: input.toSession,
1665
- humanAlert: input.humanAlert,
1726
+ humanAlert: input.humanAlert ?? (carried ? true : undefined), // a carried permission ask alerts, as Mission Control's does
1666
1727
  nextState: "pending",
1667
1728
  });
1668
1729
  this.transitionLog.append({
@@ -1810,10 +1871,11 @@ export class QueueRepository {
1810
1871
  this.persistSummary(newId, input.summary ?? null);
1811
1872
  this.persistEvidenceRef(newId, input.evidenceRef ?? null);
1812
1873
  this.persistMintingGeneration(newId, input.fromSession);
1874
+ const carried = this.carryPermissionQuestion(source, newId, input.toSession);
1813
1875
  const successorNotification = this.classifyOwnerNotification({
1814
1876
  action: "create",
1815
1877
  destinationSession: input.toSession,
1816
- humanAlert: input.humanAlert,
1878
+ humanAlert: input.humanAlert ?? (carried ? true : undefined), // a carried permission ask alerts, as Mission Control's does
1817
1879
  nextState: "pending",
1818
1880
  });
1819
1881
  this.transitionLog.append({
@@ -2902,25 +2964,15 @@ export class QueueRepository {
2902
2964
  const result = this.db.transaction(() => {
2903
2965
  const item = this.getById(input.qitemId);
2904
2966
  if (item?.state !== "pending" || item.humanIntent === "update"
2905
- || (item.destinationSession !== input.actorSession && !input.primaryUser)
2967
+ || (!this.answersAsk(item, input.actorSession) && !input.primaryUser)
2906
2968
  || !this.isPersonAddress(item.destinationSession))
2907
2969
  return null;
2908
- const text = input.decision.trim();
2909
- const unanswered = this.hasHumanQuestionsColumn && text && text !== "[file reply]"
2910
- ? unansweredQuestions(item.humanQuestions ?? [], item.humanAnswers ?? {})
2911
- : [];
2912
- const question = unanswered[0];
2913
2970
  let transitionNote = item.destinationSession === input.actorSession ? "direct human reply received"
2914
- : `reply from ${input.actorSession}, the primary user at the terminal, on ${item.destinationSession}'s ask; not answered by ${item.destinationSession}`;
2915
- if (question) {
2916
- const typedReply = {
2917
- kind: "typed-reply", text, placement: "first-unanswered", unansweredCount: unanswered.length - 1,
2918
- };
2919
- const answers = { ...item.humanAnswers, [question.id]: typedReply };
2920
- this.db.prepare("UPDATE queue_items SET human_answers = ? WHERE qitem_id = ?")
2921
- .run(JSON.stringify(answers), input.qitemId);
2922
- transitionNote += `; ${describeTypedReplyPlacement(question, typedReply)}`;
2923
- }
2971
+ : input.primaryUser ? `reply from ${input.actorSession}, the primary user at the terminal, on ${item.destinationSession}'s ask; not answered by ${item.destinationSession}`
2972
+ : `reply from ${input.actorSession}, a registered person, on the runner permission request asked of ${item.destinationSession}`;
2973
+ const placed = this.placeTypedReply(item, input.decision);
2974
+ if (placed)
2975
+ transitionNote += `; ${placed}`;
2924
2976
  return this.updateInTransactionalContext({
2925
2977
  qitemId: input.qitemId,
2926
2978
  actorSession: input.actorSession,
@@ -2936,6 +2988,29 @@ export class QueueRepository {
2936
2988
  this.eventBus.notifySubscribers(event);
2937
2989
  return true;
2938
2990
  }
2991
+ /** Store a typed reply under the first unanswered question, keeping earlier clicks; the placement note, or null. */
2992
+ placeTypedReply(item, decision) {
2993
+ const text = decision.trim();
2994
+ const unanswered = this.hasHumanQuestionsColumn && text && text !== "[file reply]"
2995
+ ? unansweredQuestions(item.humanQuestions ?? [], item.humanAnswers ?? {})
2996
+ : [];
2997
+ const question = unanswered[0];
2998
+ if (!question)
2999
+ return null;
3000
+ const typedReply = {
3001
+ kind: "typed-reply", text, placement: "first-unanswered", unansweredCount: unanswered.length - 1,
3002
+ };
3003
+ const answers = { ...item.humanAnswers, [question.id]: typedReply };
3004
+ this.db.prepare("UPDATE queue_items SET human_answers = ? WHERE qitem_id = ?").run(JSON.stringify(answers), item.qitemId);
3005
+ return describeTypedReplyPlacement(question, typedReply);
3006
+ }
3007
+ /** A typed reply that resumes a decision parked on the person it asked is that decision's answer, as their click is.
3008
+ * The write contract's resolve runs it inside its own transaction, so the answer is stored exactly when the decision resumes. */
3009
+ recordParkedTypedReply(qitemId, decision) {
3010
+ const item = this.getById(qitemId);
3011
+ if (item)
3012
+ this.placeTypedReply(item, decision);
3013
+ }
2939
3014
  /**
2940
3015
  * #193 — record one clicked answer on a pending decision that carries structured questions.
2941
3016
  * Only the decision's own human may answer, and only while it is pending. A click may change
@@ -2947,11 +3022,13 @@ export class QueueRepository {
2947
3022
  recordHumanAnswer(input) {
2948
3023
  if (!this.hasHumanQuestionsColumn)
2949
3024
  return { status: "not-applicable", reason: "schema" };
3025
+ if (this.closeStaleRunnerPermission(input.qitemId))
3026
+ return { status: "not-applicable", reason: "state-canceled" };
2950
3027
  return this.db.transaction(() => {
2951
3028
  const item = this.getById(input.qitemId);
2952
3029
  if (!item?.humanQuestions?.length)
2953
3030
  return { status: "not-applicable", reason: "no-questions" };
2954
- if (item.state !== "pending" && !this.clickAnswersPark(item, input.actorSession, input.clickedTs)) {
3031
+ if (item.state !== "pending" && !this.answersPark(item, input.actorSession, input.clickedTs)) {
2955
3032
  // Slack can redeliver the click that closed it. Only to the asked human, say whether this answer is on record.
2956
3033
  const onRecord = item.destinationSession === input.actorSession && item.humanAnswers?.[input.questionId] === input.optionId;
2957
3034
  const delegated = item.destinationSession === input.actorSession ? item.delegatedDecision : null;
@@ -2960,7 +3037,7 @@ export class QueueRepository {
2960
3037
  return { status: "not-applicable", reason: `state-${item.state}`, ...(onRecord ? { answerOnRecord: true } : {}),
2961
3038
  ...(decidedForThem ? { decidedForThem } : {}) };
2962
3039
  }
2963
- if (item.destinationSession !== input.actorSession && !input.primaryUser)
3040
+ if (!this.answersAsk(item, input.actorSession) && !input.primaryUser)
2964
3041
  return { status: "not-applicable", reason: "not-the-asked-human" };
2965
3042
  const question = item.humanQuestions.find((q) => q.id === input.questionId);
2966
3043
  if (!question?.options.some((o) => o.id === input.optionId))
@@ -2975,16 +3052,16 @@ export class QueueRepository {
2975
3052
  return { status: "recorded", answers, complete, questions: item.humanQuestions };
2976
3053
  })();
2977
3054
  }
2978
- /** A decision parked on the person it asked takes that person's click, as their typed reply does (makeHumanReplyResolver):
2979
- * the park is on them by any of their addresses, and the click came after its current question posted. */
2980
- clickAnswersPark(item, actorSession, clickedTs) {
3055
+ /** A decision parked on the person it asked takes that person's click or typed reply as its answer (makeHumanReplyResolver
3056
+ * resumes it): the park is on them by any of their addresses, and the answer came after its current question posted. */
3057
+ answersPark(item, actorSession, answeredTs) {
2981
3058
  if (item.state !== "blocked" || !item.blockedOn || !this.isPersonAddress(item.blockedOn))
2982
3059
  return false;
2983
3060
  if (item.destinationSession !== actorSession || this.askedSomeoneElse(actorSession, item.blockedOn))
2984
3061
  return false;
2985
3062
  const posted = slackMicros(this.currentHumanRequiredEpisode(item.qitemId)?.receipt?.messageTs);
2986
- const clicked = slackMicros(clickedTs);
2987
- return posted !== null && clicked !== null && clicked > posted;
3063
+ const answered = slackMicros(answeredTs);
3064
+ return posted !== null && answered !== null && answered > posted;
2988
3065
  }
2989
3066
  /** A park's current question: its latest human-required transition, and that notification's final post receipt, if any. */
2990
3067
  currentHumanRequiredEpisode(qitemId) {
@@ -3228,7 +3305,7 @@ export class QueueRepository {
3228
3305
  .prepare(`SELECT ${columns} FROM queue_items ${where} ORDER BY ${orderBy} LIMIT ?`)
3229
3306
  .all(...params);
3230
3307
  const owners = this.transitionLog.ownerNotificationsForQitems(rows.map((row) => row.qitem_id));
3231
- const ledgers = this.deliveryOutcomesFor(rows, owners);
3308
+ const ledgers = this.deliveryOutcomesFor(rows, owners, true);
3232
3309
  const items = rows.map((r) => {
3233
3310
  const ledger = ledgers.get(r.qitem_id);
3234
3311
  const item = this.rowToItem(r, !opts?.compact, { owners: owners.get(r.qitem_id) ?? [], ledger: ledger ?? null });
@@ -3533,6 +3610,22 @@ export class QueueRepository {
3533
3610
  }
3534
3611
  /** OPR.0.5.6.14 — the one destination-classification seam, as the wake path consults it.
3535
3612
  * Public for the single-row read route; getById itself stays free of topology reads. */
3613
+ /** A local, unregistered human decision remains on the attention feed; it has no gateway wake to retry.
3614
+ * A broken registry, an external address or any configured person is not evidence of this case. */
3615
+ isLocalHumanDecisionWithoutGateway(row) {
3616
+ if (row.state !== "pending" || row.humanIntent === "update" || row.destinationSession !== "human@kernel"
3617
+ || !row.lastNudgeResult?.startsWith("unroutable:"))
3618
+ return false;
3619
+ try {
3620
+ const registry = this.loadHumanRegistryFn();
3621
+ if (registry.ok ? registry.entities.length !== 0 : registry.noHumans !== true)
3622
+ return false;
3623
+ return this.classifyDestinationOf(row.destinationSession).class === "unroutable";
3624
+ }
3625
+ catch {
3626
+ return false;
3627
+ }
3628
+ }
3536
3629
  classifyDestinationOf(destinationSession) {
3537
3630
  return classifyDestination(destinationSession, {
3538
3631
  entities: (() => {
@@ -3691,7 +3784,7 @@ export class QueueRepository {
3691
3784
  /** The delivery ledger of each row, its reads batched: one read of the rows' owner notifications (unless the caller
3692
3785
  * read them already), one of their receipts, the human registry loaded once at most. A single row's
3693
3786
  * (deliveryOutcomeFor, show, the sweeps) is a batch of one. receiptsAfterEpisodes: read the receipts once the
3694
- * episodes (and so the registry) are worked out, as a single row's ledger does; a listing reads them before. */
3787
+ * episodes (and so the registry) are worked out; listings and single-row projections use that ordering. */
3695
3788
  deliveryOutcomesFor(rows, knownOwners, receiptsAfterEpisodes = false) {
3696
3789
  const ledgers = new Map();
3697
3790
  if (!this.hasQueueTransitionsTable || rows.length === 0)
@@ -3894,6 +3987,27 @@ export class QueueRepository {
3894
3987
  * column) are unaffected; only writes when a value is present (NULL is the
3895
3988
  * default and degrades in the Story consumer). Runs inside the caller's
3896
3989
  * transaction (create / handoff / handoff-and-complete). */
3990
+ /** A runner's permission ask handed to a person: that person decides, so their row carries the agent's options, as
3991
+ * Mission Control's route and handoff give it. Any other row is handed on unchanged. */
3992
+ carryPermissionQuestion(source, successorId, toSession) {
3993
+ const questions = runnerPermissionOrigin(source) ? this.permissionQuestionsFor(source) : null;
3994
+ if (!questions || !this.hasHumanQuestionsColumn || !this.hasHumanIntentColumn || !this.isPersonAddress(toSession))
3995
+ return false;
3996
+ this.db.prepare("UPDATE queue_items SET human_questions = ?, human_intent = 'decision' WHERE qitem_id = ?")
3997
+ .run(JSON.stringify(questions), successorId);
3998
+ return true;
3999
+ }
4000
+ /** A runner permission ask's options: the row's own, or, when it came through a seat that got none (an agent seat),
4001
+ * the nearest earlier row's along handed_off_from. */
4002
+ permissionQuestionsFor(item) {
4003
+ let current = item;
4004
+ for (let hops = 0; current && runnerPermissionOrigin(current) && hops <= 10; hops++) {
4005
+ if (current.humanQuestions?.length)
4006
+ return current.humanQuestions;
4007
+ current = current.handedOffFrom ? this.getById(current.handedOffFrom) : null;
4008
+ }
4009
+ return null;
4010
+ }
3897
4011
  persistSummary(qitemId, summary) {
3898
4012
  if (this.hasSummaryColumn && summary !== null) {
3899
4013
  this.db.prepare("UPDATE queue_items SET summary = ? WHERE qitem_id = ?").run(summary, qitemId);
@@ -4014,9 +4128,13 @@ export class QueueRepository {
4014
4128
  // episode (same predicate as runStuckSweep), so the view must not promise that sweep.
4015
4129
  const posted = view.state === "pending" && this.humanNotificationPostedThisEpisode(qitemId, listed);
4016
4130
  const onSteering = !posted && view.state === "pending" && this.humanAskWithoutAlert(qitemId, listed);
4017
- const awaitingHuman = posted || onSteering;
4131
+ const row = !posted && !onSteering ? this.db.prepare(`SELECT state, ${this.hasHumanIntentColumn ? "human_intent" : "NULL AS human_intent"}, destination_session, last_nudge_result FROM queue_items WHERE qitem_id = ?`).get(qitemId) : undefined;
4132
+ const noticeOutcome = listed ? listed.ledger?.outcome : this.deliveryOutcomeFor(qitemId)?.outcome;
4133
+ const localOnly = !!row && noticeOutcome !== "never-posted" && noticeOutcome !== "transport-failed"
4134
+ && this.isLocalHumanDecisionWithoutGateway({ state: row.state, humanIntent: row.human_intent, destinationSession: row.destination_session, lastNudgeResult: row.last_nudge_result });
4135
+ const awaitingHuman = posted || onSteering || localOnly;
4018
4136
  if (awaitingHuman) {
4019
- view.nextBackstop = { owner: view.owner, mechanism: onSteering
4137
+ view.nextBackstop = { owner: view.owner, mechanism: localOnly ? "local attention feed (no registered human gateway)" : onSteering
4020
4138
  ? "none (on Steering for the human, with no Slack alert; awaiting their decision)"
4021
4139
  : "none (posted to the human; awaiting their decision)", dueAt: null, intervalSeconds: null };
4022
4140
  }
@@ -4027,7 +4145,7 @@ export class QueueRepository {
4027
4145
  return view;
4028
4146
  }
4029
4147
  const recovery = readWakeLadderBackstop(this.db, qitemId, target => this.acceptsDestination(target));
4030
- if (recovery) {
4148
+ if (recovery && !localOnly) {
4031
4149
  if (!awaitingHuman)
4032
4150
  view.laterBackstop = { ...view.nextBackstop, note: "Conditional safety net; current delivery/recovery ownership is evaluated first." };
4033
4151
  view.nextBackstop = recovery;