@openrig/cli 0.7.18 → 0.7.19

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 (647) hide show
  1. package/README.md +7 -6
  2. package/daemon/assets/claude-hook-bridge.cjs +146 -0
  3. package/daemon/assets/plugins/openrig/.claude-plugin/plugin.json +1 -1
  4. package/daemon/assets/plugins/openrig/.codex-plugin/plugin.json +1 -1
  5. package/daemon/assets/plugins/openrig/.cursor-plugin/plugin.json +1 -1
  6. package/daemon/assets/plugins/openrig/plugin.json +1 -1
  7. package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +1 -1
  8. package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
  9. package/daemon/assets/plugins/openrig-core/README.md +1 -1
  10. package/daemon/assets/plugins/openrig-core/hooks/claude.json +14 -14
  11. package/daemon/assets/plugins/openrig-core/hooks/scripts/activity-relay.cjs +43 -22
  12. package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus.cjs +1 -0
  13. package/daemon/assets/plugins/openrig-core/skills/mission-slice-sop/SKILL.md +1 -1
  14. package/daemon/assets/plugins/openrig-core/skills/refocusing/scripts/trace-to-root.py +70 -2
  15. package/daemon/assets/skills/rigs/SKILL.md +40 -19
  16. package/daemon/context-packs/help/manifest.yaml +1 -1
  17. package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
  18. package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +16 -7
  19. package/daemon/context-packs/reference/getting-started.md +9 -4
  20. package/daemon/context-packs/reference/manifest.yaml +1 -1
  21. package/daemon/context-packs/reference/rig-spec.md +56 -26
  22. package/daemon/context-packs/reference/whats-new.md +82 -11
  23. package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
  24. package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
  25. package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
  26. package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
  27. package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
  28. package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
  29. package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
  30. package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
  31. package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
  32. package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
  33. package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
  34. package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
  35. package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
  36. package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
  37. package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
  38. package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
  39. package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
  40. package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
  41. package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
  42. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
  43. package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
  44. package/daemon/context-packs/skills/core/working-with-an-openrig-team/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/SKILL.md +1 -1
  49. package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
  50. package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
  51. package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
  52. package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
  53. package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
  54. package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
  55. package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
  56. package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
  57. package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
  58. package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
  59. package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
  60. package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
  61. package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
  62. package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
  63. package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
  64. package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
  65. package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
  66. package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
  67. package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
  68. package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
  69. package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
  70. package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
  71. package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
  72. package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
  73. package/daemon/context-packs/skills/refocusing/scripts/trace-to-root.py +70 -2
  74. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
  75. package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
  76. package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
  77. package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
  78. package/daemon/context-packs/world-example/manifest.yaml +1 -1
  79. package/daemon/context-packs/world-public/manifest.yaml +1 -1
  80. package/daemon/dist/adapters/claude-code-adapter.d.ts +9 -0
  81. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  82. package/daemon/dist/adapters/claude-code-adapter.js +41 -4
  83. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  84. package/daemon/dist/adapters/claude-resume.d.ts +2 -0
  85. package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
  86. package/daemon/dist/adapters/claude-resume.js +3 -1
  87. package/daemon/dist/adapters/claude-resume.js.map +1 -1
  88. package/daemon/dist/adapters/codex-runtime-adapter.d.ts +5 -0
  89. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  90. package/daemon/dist/adapters/codex-runtime-adapter.js +45 -10
  91. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  92. package/daemon/dist/adapters/kernel-authority.d.ts +7 -0
  93. package/daemon/dist/adapters/kernel-authority.d.ts.map +1 -1
  94. package/daemon/dist/adapters/kernel-authority.js +24 -1
  95. package/daemon/dist/adapters/kernel-authority.js.map +1 -1
  96. package/daemon/dist/adapters/pi-resume.d.ts.map +1 -1
  97. package/daemon/dist/adapters/pi-resume.js +5 -7
  98. package/daemon/dist/adapters/pi-resume.js.map +1 -1
  99. package/daemon/dist/adapters/pi-runner-protocol.d.ts +5 -1
  100. package/daemon/dist/adapters/pi-runner-protocol.d.ts.map +1 -1
  101. package/daemon/dist/adapters/pi-runner.d.ts +34 -0
  102. package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
  103. package/daemon/dist/adapters/pi-runner.js +359 -26
  104. package/daemon/dist/adapters/pi-runner.js.map +1 -1
  105. package/daemon/dist/adapters/pi-runtime-adapter.d.ts +7 -1
  106. package/daemon/dist/adapters/pi-runtime-adapter.d.ts.map +1 -1
  107. package/daemon/dist/adapters/pi-runtime-adapter.js +29 -19
  108. package/daemon/dist/adapters/pi-runtime-adapter.js.map +1 -1
  109. package/daemon/dist/adapters/tmux.d.ts +54 -34
  110. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  111. package/daemon/dist/adapters/tmux.js +183 -57
  112. package/daemon/dist/adapters/tmux.js.map +1 -1
  113. package/daemon/dist/build-info.js +3 -3
  114. package/daemon/dist/db/all-migrations.d.ts.map +1 -1
  115. package/daemon/dist/db/all-migrations.js +6 -0
  116. package/daemon/dist/db/all-migrations.js.map +1 -1
  117. package/daemon/dist/db/migrations/171_seat_hook_bridge.d.ts +5 -0
  118. package/daemon/dist/db/migrations/171_seat_hook_bridge.d.ts.map +1 -0
  119. package/daemon/dist/db/migrations/171_seat_hook_bridge.js +25 -0
  120. package/daemon/dist/db/migrations/171_seat_hook_bridge.js.map +1 -0
  121. package/daemon/dist/db/migrations/174_session_launched_cwd.d.ts +6 -0
  122. package/daemon/dist/db/migrations/174_session_launched_cwd.d.ts.map +1 -0
  123. package/daemon/dist/db/migrations/174_session_launched_cwd.js +8 -0
  124. package/daemon/dist/db/migrations/174_session_launched_cwd.js.map +1 -0
  125. package/daemon/dist/db/migrations/175_core_app_access.d.ts +3 -0
  126. package/daemon/dist/db/migrations/175_core_app_access.d.ts.map +1 -0
  127. package/daemon/dist/db/migrations/175_core_app_access.js +26 -0
  128. package/daemon/dist/db/migrations/175_core_app_access.js.map +1 -0
  129. package/daemon/dist/domain/activity-grants.d.ts.map +1 -1
  130. package/daemon/dist/domain/activity-grants.js +6 -4
  131. package/daemon/dist/domain/activity-grants.js.map +1 -1
  132. package/daemon/dist/domain/agent-activity-store.d.ts +23 -0
  133. package/daemon/dist/domain/agent-activity-store.d.ts.map +1 -1
  134. package/daemon/dist/domain/agent-activity-store.js +62 -5
  135. package/daemon/dist/domain/agent-activity-store.js.map +1 -1
  136. package/daemon/dist/domain/claude-activity-hooks.d.ts +4 -2
  137. package/daemon/dist/domain/claude-activity-hooks.d.ts.map +1 -1
  138. package/daemon/dist/domain/claude-activity-hooks.js +5 -3
  139. package/daemon/dist/domain/claude-activity-hooks.js.map +1 -1
  140. package/daemon/dist/domain/claude-compaction-enforcer.d.ts +64 -3
  141. package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
  142. package/daemon/dist/domain/claude-compaction-enforcer.js +203 -6
  143. package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
  144. package/daemon/dist/domain/compaction-restore-notice.d.ts +3 -1
  145. package/daemon/dist/domain/compaction-restore-notice.d.ts.map +1 -1
  146. package/daemon/dist/domain/compaction-restore-notice.js +22 -3
  147. package/daemon/dist/domain/compaction-restore-notice.js.map +1 -1
  148. package/daemon/dist/domain/configured-account.d.ts +3 -0
  149. package/daemon/dist/domain/configured-account.d.ts.map +1 -0
  150. package/daemon/dist/domain/configured-account.js +10 -0
  151. package/daemon/dist/domain/configured-account.js.map +1 -0
  152. package/daemon/dist/domain/core-app-access.d.ts +51 -0
  153. package/daemon/dist/domain/core-app-access.d.ts.map +1 -0
  154. package/daemon/dist/domain/core-app-access.js +107 -0
  155. package/daemon/dist/domain/core-app-access.js.map +1 -0
  156. package/daemon/dist/domain/core-app-job.d.ts +411 -0
  157. package/daemon/dist/domain/core-app-job.d.ts.map +1 -0
  158. package/daemon/dist/domain/core-app-job.js +537 -0
  159. package/daemon/dist/domain/core-app-job.js.map +1 -0
  160. package/daemon/dist/domain/current-park-arm.d.ts +4 -0
  161. package/daemon/dist/domain/current-park-arm.d.ts.map +1 -0
  162. package/daemon/dist/domain/current-park-arm.js +14 -0
  163. package/daemon/dist/domain/current-park-arm.js.map +1 -0
  164. package/daemon/dist/domain/cwd-resolution.d.ts +12 -0
  165. package/daemon/dist/domain/cwd-resolution.d.ts.map +1 -1
  166. package/daemon/dist/domain/cwd-resolution.js +21 -1
  167. package/daemon/dist/domain/cwd-resolution.js.map +1 -1
  168. package/daemon/dist/domain/execution-view.d.ts.map +1 -1
  169. package/daemon/dist/domain/execution-view.js +9 -3
  170. package/daemon/dist/domain/execution-view.js.map +1 -1
  171. package/daemon/dist/domain/gateway/participants.d.ts +2 -0
  172. package/daemon/dist/domain/gateway/participants.d.ts.map +1 -1
  173. package/daemon/dist/domain/gateway/participants.js +5 -1
  174. package/daemon/dist/domain/gateway/participants.js.map +1 -1
  175. package/daemon/dist/domain/gateway/slack/message.d.ts +1 -0
  176. package/daemon/dist/domain/gateway/slack/message.d.ts.map +1 -1
  177. package/daemon/dist/domain/gateway/slack/message.js +37 -17
  178. package/daemon/dist/domain/gateway/slack/message.js.map +1 -1
  179. package/daemon/dist/domain/gateway/slack/settled-asks.js +1 -1
  180. package/daemon/dist/domain/gateway/slack/settled-asks.js.map +1 -1
  181. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts +1 -0
  182. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts.map +1 -1
  183. package/daemon/dist/domain/gateway/slack/slack-delivery.js +2 -0
  184. package/daemon/dist/domain/gateway/slack/slack-delivery.js.map +1 -1
  185. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts +4 -0
  186. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
  187. package/daemon/dist/domain/gateway/slack/slack-subsystem.js +26 -2
  188. package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
  189. package/daemon/dist/domain/hook-bridge.d.ts +345 -0
  190. package/daemon/dist/domain/hook-bridge.d.ts.map +1 -0
  191. package/daemon/dist/domain/hook-bridge.js +547 -0
  192. package/daemon/dist/domain/hook-bridge.js.map +1 -0
  193. package/daemon/dist/domain/hosted-wake.d.ts +9 -0
  194. package/daemon/dist/domain/hosted-wake.d.ts.map +1 -1
  195. package/daemon/dist/domain/hosted-wake.js +45 -6
  196. package/daemon/dist/domain/hosted-wake.js.map +1 -1
  197. package/daemon/dist/domain/human-ask-attention.d.ts +10 -0
  198. package/daemon/dist/domain/human-ask-attention.d.ts.map +1 -0
  199. package/daemon/dist/domain/human-ask-attention.js +22 -0
  200. package/daemon/dist/domain/human-ask-attention.js.map +1 -0
  201. package/daemon/dist/domain/mission-control/mission-control-action-log.d.ts +4 -0
  202. package/daemon/dist/domain/mission-control/mission-control-action-log.d.ts.map +1 -1
  203. package/daemon/dist/domain/mission-control/mission-control-action-log.js +8 -1
  204. package/daemon/dist/domain/mission-control/mission-control-action-log.js.map +1 -1
  205. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts +10 -0
  206. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
  207. package/daemon/dist/domain/mission-control/mission-control-write-contract.js +64 -12
  208. package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
  209. package/daemon/dist/domain/native-continuation-notice.d.ts +16 -0
  210. package/daemon/dist/domain/native-continuation-notice.d.ts.map +1 -0
  211. package/daemon/dist/domain/native-continuation-notice.js +79 -0
  212. package/daemon/dist/domain/native-continuation-notice.js.map +1 -0
  213. package/daemon/dist/domain/native-process-lineage.d.ts +16 -0
  214. package/daemon/dist/domain/native-process-lineage.d.ts.map +1 -1
  215. package/daemon/dist/domain/native-process-lineage.js +48 -3
  216. package/daemon/dist/domain/native-process-lineage.js.map +1 -1
  217. package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
  218. package/daemon/dist/domain/node-inventory.js +27 -6
  219. package/daemon/dist/domain/node-inventory.js.map +1 -1
  220. package/daemon/dist/domain/node-launcher.d.ts +6 -0
  221. package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
  222. package/daemon/dist/domain/node-launcher.js +16 -2
  223. package/daemon/dist/domain/node-launcher.js.map +1 -1
  224. package/daemon/dist/domain/outbox-handler.d.ts +21 -3
  225. package/daemon/dist/domain/outbox-handler.d.ts.map +1 -1
  226. package/daemon/dist/domain/outbox-handler.js +88 -8
  227. package/daemon/dist/domain/outbox-handler.js.map +1 -1
  228. package/daemon/dist/domain/park-wake-text.d.ts +18 -0
  229. package/daemon/dist/domain/park-wake-text.d.ts.map +1 -1
  230. package/daemon/dist/domain/park-wake-text.js +44 -0
  231. package/daemon/dist/domain/park-wake-text.js.map +1 -1
  232. package/daemon/dist/domain/policies/idle-gate-qitem.d.ts +3 -0
  233. package/daemon/dist/domain/policies/idle-gate-qitem.d.ts.map +1 -1
  234. package/daemon/dist/domain/policies/idle-gate-qitem.js +15 -0
  235. package/daemon/dist/domain/policies/idle-gate-qitem.js.map +1 -1
  236. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts +6 -1
  237. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts.map +1 -1
  238. package/daemon/dist/domain/policies/parked-owner-consumer.js +28 -1
  239. package/daemon/dist/domain/policies/parked-owner-consumer.js.map +1 -1
  240. package/daemon/dist/domain/process-limits.d.ts +21 -11
  241. package/daemon/dist/domain/process-limits.d.ts.map +1 -1
  242. package/daemon/dist/domain/process-limits.js +74 -20
  243. package/daemon/dist/domain/process-limits.js.map +1 -1
  244. package/daemon/dist/domain/process-table.d.ts +15 -0
  245. package/daemon/dist/domain/process-table.d.ts.map +1 -1
  246. package/daemon/dist/domain/process-table.js +39 -0
  247. package/daemon/dist/domain/process-table.js.map +1 -1
  248. package/daemon/dist/domain/queue-erasure.d.ts.map +1 -1
  249. package/daemon/dist/domain/queue-erasure.js +3 -0
  250. package/daemon/dist/domain/queue-erasure.js.map +1 -1
  251. package/daemon/dist/domain/queue-repository.d.ts +60 -7
  252. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  253. package/daemon/dist/domain/queue-repository.js +178 -36
  254. package/daemon/dist/domain/queue-repository.js.map +1 -1
  255. package/daemon/dist/domain/queue-stuck-sweep.d.ts +2 -0
  256. package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
  257. package/daemon/dist/domain/queue-stuck-sweep.js +29 -0
  258. package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
  259. package/daemon/dist/domain/queue-waiting.d.ts.map +1 -1
  260. package/daemon/dist/domain/queue-waiting.js +28 -3
  261. package/daemon/dist/domain/queue-waiting.js.map +1 -1
  262. package/daemon/dist/domain/queue-wake-ladder.d.ts +12 -0
  263. package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
  264. package/daemon/dist/domain/queue-wake-ladder.js +115 -14
  265. package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
  266. package/daemon/dist/domain/queue-wake-repository.d.ts +8 -0
  267. package/daemon/dist/domain/queue-wake-repository.d.ts.map +1 -1
  268. package/daemon/dist/domain/queue-wake-repository.js +48 -8
  269. package/daemon/dist/domain/queue-wake-repository.js.map +1 -1
  270. package/daemon/dist/domain/reconciler.d.ts +18 -2
  271. package/daemon/dist/domain/reconciler.d.ts.map +1 -1
  272. package/daemon/dist/domain/reconciler.js +40 -0
  273. package/daemon/dist/domain/reconciler.js.map +1 -1
  274. package/daemon/dist/domain/restore-attempt-receipt.d.ts.map +1 -1
  275. package/daemon/dist/domain/restore-attempt-receipt.js +3 -2
  276. package/daemon/dist/domain/restore-attempt-receipt.js.map +1 -1
  277. package/daemon/dist/domain/restore-orchestrator.d.ts +5 -1
  278. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  279. package/daemon/dist/domain/restore-orchestrator.js +73 -8
  280. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  281. package/daemon/dist/domain/restore-topology.d.ts +7 -1
  282. package/daemon/dist/domain/restore-topology.d.ts.map +1 -1
  283. package/daemon/dist/domain/restore-topology.js +21 -0
  284. package/daemon/dist/domain/restore-topology.js.map +1 -1
  285. package/daemon/dist/domain/resume-metadata-refresher.d.ts +2 -3
  286. package/daemon/dist/domain/resume-metadata-refresher.d.ts.map +1 -1
  287. package/daemon/dist/domain/resume-metadata-refresher.js +6 -25
  288. package/daemon/dist/domain/resume-metadata-refresher.js.map +1 -1
  289. package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
  290. package/daemon/dist/domain/rig-repository.js +7 -6
  291. package/daemon/dist/domain/rig-repository.js.map +1 -1
  292. package/daemon/dist/domain/rig-teardown.d.ts +16 -3
  293. package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
  294. package/daemon/dist/domain/rig-teardown.js +73 -9
  295. package/daemon/dist/domain/rig-teardown.js.map +1 -1
  296. package/daemon/dist/domain/rigspec-exporter.js +2 -2
  297. package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
  298. package/daemon/dist/domain/rigspec-instantiator.d.ts +5 -0
  299. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  300. package/daemon/dist/domain/rigspec-instantiator.js +17 -7
  301. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  302. package/daemon/dist/domain/rosters.d.ts +11 -0
  303. package/daemon/dist/domain/rosters.d.ts.map +1 -1
  304. package/daemon/dist/domain/rosters.js +21 -2
  305. package/daemon/dist/domain/rosters.js.map +1 -1
  306. package/daemon/dist/domain/runner-channel.d.ts +35 -3
  307. package/daemon/dist/domain/runner-channel.d.ts.map +1 -1
  308. package/daemon/dist/domain/runner-channel.js +177 -8
  309. package/daemon/dist/domain/runner-channel.js.map +1 -1
  310. package/daemon/dist/domain/runner-permissions.d.ts +26 -3
  311. package/daemon/dist/domain/runner-permissions.d.ts.map +1 -1
  312. package/daemon/dist/domain/runner-permissions.js +160 -39
  313. package/daemon/dist/domain/runner-permissions.js.map +1 -1
  314. package/daemon/dist/domain/scope/mission-parent.d.ts +19 -0
  315. package/daemon/dist/domain/scope/mission-parent.d.ts.map +1 -0
  316. package/daemon/dist/domain/scope/mission-parent.js +134 -0
  317. package/daemon/dist/domain/scope/mission-parent.js.map +1 -0
  318. package/daemon/dist/domain/scope/scope-audit.d.ts.map +1 -1
  319. package/daemon/dist/domain/scope/scope-audit.js +8 -0
  320. package/daemon/dist/domain/scope/scope-audit.js.map +1 -1
  321. package/daemon/dist/domain/scope/types.d.ts +3 -1
  322. package/daemon/dist/domain/scope/types.d.ts.map +1 -1
  323. package/daemon/dist/domain/scope/types.js +5 -1
  324. package/daemon/dist/domain/scope/types.js.map +1 -1
  325. package/daemon/dist/domain/seat-delivery-guard.d.ts +14 -2
  326. package/daemon/dist/domain/seat-delivery-guard.d.ts.map +1 -1
  327. package/daemon/dist/domain/seat-delivery-guard.js +53 -14
  328. package/daemon/dist/domain/seat-delivery-guard.js.map +1 -1
  329. package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
  330. package/daemon/dist/domain/seat-handover-service.js +9 -4
  331. package/daemon/dist/domain/seat-handover-service.js.map +1 -1
  332. package/daemon/dist/domain/seat-identity-reconciler.d.ts +4 -3
  333. package/daemon/dist/domain/seat-identity-reconciler.d.ts.map +1 -1
  334. package/daemon/dist/domain/seat-identity-reconciler.js +40 -5
  335. package/daemon/dist/domain/seat-identity-reconciler.js.map +1 -1
  336. package/daemon/dist/domain/seat-lifecycle-service.d.ts +14 -6
  337. package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
  338. package/daemon/dist/domain/seat-lifecycle-service.js +104 -22
  339. package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
  340. package/daemon/dist/domain/seat-restart-in-place.d.ts.map +1 -1
  341. package/daemon/dist/domain/seat-restart-in-place.js +4 -1
  342. package/daemon/dist/domain/seat-restart-in-place.js.map +1 -1
  343. package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -1
  344. package/daemon/dist/domain/seat-runtime-switch-service.js +2 -0
  345. package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
  346. package/daemon/dist/domain/seat-skill-apply.d.ts +1 -1
  347. package/daemon/dist/domain/seat-skill-apply.d.ts.map +1 -1
  348. package/daemon/dist/domain/seat-skill-apply.js +3 -2
  349. package/daemon/dist/domain/seat-skill-apply.js.map +1 -1
  350. package/daemon/dist/domain/session-registry.d.ts +5 -1
  351. package/daemon/dist/domain/session-registry.d.ts.map +1 -1
  352. package/daemon/dist/domain/session-registry.js +12 -1
  353. package/daemon/dist/domain/session-registry.js.map +1 -1
  354. package/daemon/dist/domain/session-transport.d.ts +40 -1
  355. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  356. package/daemon/dist/domain/session-transport.js +211 -10
  357. package/daemon/dist/domain/session-transport.js.map +1 -1
  358. package/daemon/dist/domain/shared-history-selection.d.ts.map +1 -1
  359. package/daemon/dist/domain/shared-history-selection.js +9 -5
  360. package/daemon/dist/domain/shared-history-selection.js.map +1 -1
  361. package/daemon/dist/domain/slices/slice-indexer.d.ts +1 -1
  362. package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -1
  363. package/daemon/dist/domain/slices/slice-indexer.js +4 -0
  364. package/daemon/dist/domain/slices/slice-indexer.js.map +1 -1
  365. package/daemon/dist/domain/startup-orchestrator.d.ts +1 -0
  366. package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
  367. package/daemon/dist/domain/startup-orchestrator.js +6 -4
  368. package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
  369. package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
  370. package/daemon/dist/domain/successor-session-launcher.js +10 -4
  371. package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
  372. package/daemon/dist/domain/terminal/herdr-adapter.d.ts +35 -1
  373. package/daemon/dist/domain/terminal/herdr-adapter.d.ts.map +1 -1
  374. package/daemon/dist/domain/terminal/herdr-adapter.js +231 -33
  375. package/daemon/dist/domain/terminal/herdr-adapter.js.map +1 -1
  376. package/daemon/dist/domain/terminal/herdr-sessions.d.ts.map +1 -1
  377. package/daemon/dist/domain/terminal/herdr-sessions.js +2 -1
  378. package/daemon/dist/domain/terminal/herdr-sessions.js.map +1 -1
  379. package/daemon/dist/domain/terminal/rig-viewer-records.d.ts +59 -0
  380. package/daemon/dist/domain/terminal/rig-viewer-records.d.ts.map +1 -0
  381. package/daemon/dist/domain/terminal/rig-viewer-records.js +210 -0
  382. package/daemon/dist/domain/terminal/rig-viewer-records.js.map +1 -0
  383. package/daemon/dist/domain/terminal/terminal-provider.d.ts +2 -0
  384. package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
  385. package/daemon/dist/domain/terminal/terminal-service.d.ts +99 -4
  386. package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
  387. package/daemon/dist/domain/terminal/terminal-service.js +556 -36
  388. package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
  389. package/daemon/dist/domain/terminal/tile-layout.js +1 -1
  390. package/daemon/dist/domain/terminal/tile-layout.js.map +1 -1
  391. package/daemon/dist/domain/terminal/tmux-viewer-guard.d.ts +25 -0
  392. package/daemon/dist/domain/terminal/tmux-viewer-guard.d.ts.map +1 -0
  393. package/daemon/dist/domain/terminal/tmux-viewer-guard.js +70 -0
  394. package/daemon/dist/domain/terminal/tmux-viewer-guard.js.map +1 -0
  395. package/daemon/dist/domain/transcript-grep-worker.d.ts +2 -0
  396. package/daemon/dist/domain/transcript-grep-worker.d.ts.map +1 -0
  397. package/daemon/dist/domain/transcript-grep-worker.js +108 -0
  398. package/daemon/dist/domain/transcript-grep-worker.js.map +1 -0
  399. package/daemon/dist/domain/transcript-grep.d.ts +26 -0
  400. package/daemon/dist/domain/transcript-grep.d.ts.map +1 -0
  401. package/daemon/dist/domain/transcript-grep.js +90 -0
  402. package/daemon/dist/domain/transcript-grep.js.map +1 -0
  403. package/daemon/dist/domain/transcript-store.d.ts +8 -2
  404. package/daemon/dist/domain/transcript-store.d.ts.map +1 -1
  405. package/daemon/dist/domain/transcript-store.js +10 -60
  406. package/daemon/dist/domain/transcript-store.js.map +1 -1
  407. package/daemon/dist/domain/types.d.ts +69 -2
  408. package/daemon/dist/domain/types.d.ts.map +1 -1
  409. package/daemon/dist/domain/types.js.map +1 -1
  410. package/daemon/dist/domain/watchdog-delivery-receipts.d.ts +4 -0
  411. package/daemon/dist/domain/watchdog-delivery-receipts.d.ts.map +1 -1
  412. package/daemon/dist/domain/watchdog-delivery-receipts.js +35 -2
  413. package/daemon/dist/domain/watchdog-delivery-receipts.js.map +1 -1
  414. package/daemon/dist/domain/watchdog-delivery.d.ts +44 -0
  415. package/daemon/dist/domain/watchdog-delivery.d.ts.map +1 -1
  416. package/daemon/dist/domain/watchdog-delivery.js +60 -2
  417. package/daemon/dist/domain/watchdog-delivery.js.map +1 -1
  418. package/daemon/dist/domain/watchdog-history-log.d.ts +12 -0
  419. package/daemon/dist/domain/watchdog-history-log.d.ts.map +1 -1
  420. package/daemon/dist/domain/watchdog-history-log.js +19 -1
  421. package/daemon/dist/domain/watchdog-history-log.js.map +1 -1
  422. package/daemon/dist/domain/watchdog-jobs-repository.d.ts +32 -0
  423. package/daemon/dist/domain/watchdog-jobs-repository.d.ts.map +1 -1
  424. package/daemon/dist/domain/watchdog-jobs-repository.js +78 -0
  425. package/daemon/dist/domain/watchdog-jobs-repository.js.map +1 -1
  426. package/daemon/dist/domain/watchdog-policy-engine.d.ts +17 -3
  427. package/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -1
  428. package/daemon/dist/domain/watchdog-policy-engine.js +19 -5
  429. package/daemon/dist/domain/watchdog-policy-engine.js.map +1 -1
  430. package/daemon/dist/domain/workflow-projector.js +1 -1
  431. package/daemon/dist/domain/workflow-projector.js.map +1 -1
  432. package/daemon/dist/domain/workflow-runtime.d.ts +12 -0
  433. package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
  434. package/daemon/dist/domain/workflow-runtime.js +64 -7
  435. package/daemon/dist/domain/workflow-runtime.js.map +1 -1
  436. package/daemon/dist/domain/workflow-step-trail-log.d.ts +2 -2
  437. package/daemon/dist/domain/workflow-step-trail-log.d.ts.map +1 -1
  438. package/daemon/dist/domain/workflow-step-trail-log.js.map +1 -1
  439. package/daemon/dist/domain/workflow-types.d.ts +3 -1
  440. package/daemon/dist/domain/workflow-types.d.ts.map +1 -1
  441. package/daemon/dist/domain/workflow-types.js.map +1 -1
  442. package/daemon/dist/index.d.ts.map +1 -1
  443. package/daemon/dist/index.js +5 -1
  444. package/daemon/dist/index.js.map +1 -1
  445. package/daemon/dist/lib/pane-envelope.d.ts +3 -0
  446. package/daemon/dist/lib/pane-envelope.d.ts.map +1 -1
  447. package/daemon/dist/lib/pane-envelope.js +3 -1
  448. package/daemon/dist/lib/pane-envelope.js.map +1 -1
  449. package/daemon/dist/mission-parent-surface.d.ts +2 -0
  450. package/daemon/dist/mission-parent-surface.d.ts.map +1 -0
  451. package/daemon/dist/mission-parent-surface.js +2 -0
  452. package/daemon/dist/mission-parent-surface.js.map +1 -0
  453. package/daemon/dist/routes/activity.d.ts +18 -1
  454. package/daemon/dist/routes/activity.d.ts.map +1 -1
  455. package/daemon/dist/routes/activity.js +47 -9
  456. package/daemon/dist/routes/activity.js.map +1 -1
  457. package/daemon/dist/routes/attention.d.ts.map +1 -1
  458. package/daemon/dist/routes/attention.js +194 -177
  459. package/daemon/dist/routes/attention.js.map +1 -1
  460. package/daemon/dist/routes/core-app.d.ts +10 -0
  461. package/daemon/dist/routes/core-app.d.ts.map +1 -0
  462. package/daemon/dist/routes/core-app.js +175 -0
  463. package/daemon/dist/routes/core-app.js.map +1 -0
  464. package/daemon/dist/routes/hook-bridge.d.ts +3 -0
  465. package/daemon/dist/routes/hook-bridge.d.ts.map +1 -0
  466. package/daemon/dist/routes/hook-bridge.js +158 -0
  467. package/daemon/dist/routes/hook-bridge.js.map +1 -0
  468. package/daemon/dist/routes/missions.d.ts.map +1 -1
  469. package/daemon/dist/routes/missions.js +14 -2
  470. package/daemon/dist/routes/missions.js.map +1 -1
  471. package/daemon/dist/routes/queue.d.ts +1 -1
  472. package/daemon/dist/routes/queue.d.ts.map +1 -1
  473. package/daemon/dist/routes/queue.js +8 -5
  474. package/daemon/dist/routes/queue.js.map +1 -1
  475. package/daemon/dist/routes/rigspec.js +1 -1
  476. package/daemon/dist/routes/rigspec.js.map +1 -1
  477. package/daemon/dist/routes/scope-audit.d.ts.map +1 -1
  478. package/daemon/dist/routes/scope-audit.js +7 -1
  479. package/daemon/dist/routes/scope-audit.js.map +1 -1
  480. package/daemon/dist/routes/seat.d.ts.map +1 -1
  481. package/daemon/dist/routes/seat.js +30 -4
  482. package/daemon/dist/routes/seat.js.map +1 -1
  483. package/daemon/dist/routes/slices.d.ts.map +1 -1
  484. package/daemon/dist/routes/slices.js +21 -2
  485. package/daemon/dist/routes/slices.js.map +1 -1
  486. package/daemon/dist/routes/startup.js +2 -1
  487. package/daemon/dist/routes/startup.js.map +1 -1
  488. package/daemon/dist/routes/terminal.d.ts.map +1 -1
  489. package/daemon/dist/routes/terminal.js +47 -6
  490. package/daemon/dist/routes/terminal.js.map +1 -1
  491. package/daemon/dist/routes/transcripts.d.ts.map +1 -1
  492. package/daemon/dist/routes/transcripts.js +16 -1
  493. package/daemon/dist/routes/transcripts.js.map +1 -1
  494. package/daemon/dist/routes/watchdog.d.ts.map +1 -1
  495. package/daemon/dist/routes/watchdog.js +3 -2
  496. package/daemon/dist/routes/watchdog.js.map +1 -1
  497. package/daemon/dist/routes/workflow.d.ts.map +1 -1
  498. package/daemon/dist/routes/workflow.js +5 -0
  499. package/daemon/dist/routes/workflow.js.map +1 -1
  500. package/daemon/dist/server.d.ts +2 -0
  501. package/daemon/dist/server.d.ts.map +1 -1
  502. package/daemon/dist/server.js +11 -0
  503. package/daemon/dist/server.js.map +1 -1
  504. package/daemon/dist/startup.d.ts.map +1 -1
  505. package/daemon/dist/startup.js +90 -33
  506. package/daemon/dist/startup.js.map +1 -1
  507. package/daemon/dist/terminal-viewer-guard-surface.d.ts +2 -0
  508. package/daemon/dist/terminal-viewer-guard-surface.d.ts.map +1 -0
  509. package/daemon/dist/terminal-viewer-guard-surface.js +2 -0
  510. package/daemon/dist/terminal-viewer-guard-surface.js.map +1 -0
  511. package/daemon/docs/reference/agent-startup-guide.md +4 -1
  512. package/daemon/docs/reference/claude-status-line.md +3 -2
  513. package/daemon/docs/reference/community-harness-examples/cursor/openrig-cursor-launch +6 -0
  514. package/daemon/docs/reference/community-harness-examples/dsh/README.md +1 -1
  515. package/daemon/docs/reference/community-harness-examples/dsh/openrig-dsh-runner.mjs +186 -30
  516. package/daemon/docs/reference/community-harness-examples/hermes/openrig-hermes-launch +6 -0
  517. package/daemon/docs/reference/community-harness-examples/openclaw/openrig-openclaw-launch +6 -0
  518. package/daemon/docs/reference/community-harness-examples/openshell/README.md +2 -0
  519. package/daemon/docs/reference/community-harness-examples/pi-tui/openrig-pi-tui-launch +6 -0
  520. package/daemon/docs/reference/community-harness-presets.md +6 -5
  521. package/daemon/docs/reference/core-app.md +212 -0
  522. package/daemon/docs/reference/daemon-http-clients.md +6 -0
  523. package/daemon/docs/reference/getting-started.md +9 -4
  524. package/daemon/docs/reference/harness-runner-contract.md +50 -4
  525. package/daemon/docs/reference/hosted-members.md +21 -1
  526. package/daemon/docs/reference/quickstart.md +4 -3
  527. package/daemon/docs/reference/rig-spec.md +56 -26
  528. package/daemon/docs/reference/rosters.md +8 -0
  529. package/daemon/docs/reference/sdlc-conventions.md +42 -5
  530. package/daemon/docs/reference/seat-delivery.md +87 -6
  531. package/daemon/docs/reference/terminal-sessions.md +99 -1
  532. package/daemon/docs/reference/whats-new.md +82 -11
  533. package/daemon/specs/rigs/launch/factory/guidance/lead-first-move.md +4 -3
  534. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +13 -3
  535. package/daemon/specs/rigs/launch/starter/guidance/lead-first-move.md +4 -3
  536. package/dist/ask-wake.d.ts.map +1 -1
  537. package/dist/ask-wake.js +8 -1
  538. package/dist/ask-wake.js.map +1 -1
  539. package/dist/build-info.js +3 -3
  540. package/dist/commands/archive.js +1 -1
  541. package/dist/commands/archive.js.map +1 -1
  542. package/dist/commands/daemon.d.ts.map +1 -1
  543. package/dist/commands/daemon.js +7 -0
  544. package/dist/commands/daemon.js.map +1 -1
  545. package/dist/commands/down.d.ts.map +1 -1
  546. package/dist/commands/down.js +5 -0
  547. package/dist/commands/down.js.map +1 -1
  548. package/dist/commands/ps.d.ts +2 -1
  549. package/dist/commands/ps.d.ts.map +1 -1
  550. package/dist/commands/ps.js +9 -4
  551. package/dist/commands/ps.js.map +1 -1
  552. package/dist/commands/queue.js +4 -4
  553. package/dist/commands/queue.js.map +1 -1
  554. package/dist/commands/roster.d.ts +5 -0
  555. package/dist/commands/roster.d.ts.map +1 -1
  556. package/dist/commands/scope.d.ts.map +1 -1
  557. package/dist/commands/scope.js +346 -9
  558. package/dist/commands/scope.js.map +1 -1
  559. package/dist/commands/seat.d.ts.map +1 -1
  560. package/dist/commands/seat.js +90 -8
  561. package/dist/commands/seat.js.map +1 -1
  562. package/dist/commands/send.d.ts +2 -0
  563. package/dist/commands/send.d.ts.map +1 -1
  564. package/dist/commands/send.js +3 -1
  565. package/dist/commands/send.js.map +1 -1
  566. package/dist/commands/terminal.d.ts +56 -0
  567. package/dist/commands/terminal.d.ts.map +1 -1
  568. package/dist/commands/terminal.js +194 -4
  569. package/dist/commands/terminal.js.map +1 -1
  570. package/dist/commands/transcript.js +1 -1
  571. package/dist/commands/transcript.js.map +1 -1
  572. package/dist/commands/unarchive.js +1 -1
  573. package/dist/commands/unarchive.js.map +1 -1
  574. package/dist/commands/workflow-follow.d.ts +3 -1
  575. package/dist/commands/workflow-follow.d.ts.map +1 -1
  576. package/dist/commands/workflow-follow.js +25 -6
  577. package/dist/commands/workflow-follow.js.map +1 -1
  578. package/dist/commands/workflow-render.d.ts.map +1 -1
  579. package/dist/commands/workflow-render.js +5 -1
  580. package/dist/commands/workflow-render.js.map +1 -1
  581. package/dist/commands/workflow.d.ts.map +1 -1
  582. package/dist/commands/workflow.js +14 -4
  583. package/dist/commands/workflow.js.map +1 -1
  584. package/dist/daemon-lifecycle.d.ts.map +1 -1
  585. package/dist/daemon-lifecycle.js +11 -0
  586. package/dist/daemon-lifecycle.js.map +1 -1
  587. package/dist/lib/scope/mission-composition.d.ts +1 -0
  588. package/dist/lib/scope/mission-composition.d.ts.map +1 -1
  589. package/dist/lib/scope/mission-composition.js +14 -0
  590. package/dist/lib/scope/mission-composition.js.map +1 -1
  591. package/dist/lib/scope/scope-audit.d.ts.map +1 -1
  592. package/dist/lib/scope/scope-audit.js +8 -0
  593. package/dist/lib/scope/scope-audit.js.map +1 -1
  594. package/dist/lib/scope/scope-fs.d.ts +10 -0
  595. package/dist/lib/scope/scope-fs.d.ts.map +1 -1
  596. package/dist/lib/scope/scope-fs.js +60 -0
  597. package/dist/lib/scope/scope-fs.js.map +1 -1
  598. package/dist/lib/scope/types.d.ts +3 -1
  599. package/dist/lib/scope/types.d.ts.map +1 -1
  600. package/dist/lib/scope/types.js +5 -1
  601. package/dist/lib/scope/types.js.map +1 -1
  602. package/dist/mcp-server.d.ts.map +1 -1
  603. package/dist/mcp-server.js +18 -8
  604. package/dist/mcp-server.js.map +1 -1
  605. package/dist/restore-packet/packet-writer.d.ts.map +1 -1
  606. package/dist/restore-packet/packet-writer.js +8 -5
  607. package/dist/restore-packet/packet-writer.js.map +1 -1
  608. package/dist/terminal-window.d.ts +2 -1
  609. package/dist/terminal-window.d.ts.map +1 -1
  610. package/dist/terminal-window.js +567 -41
  611. package/dist/terminal-window.js.map +1 -1
  612. package/package.json +1 -1
  613. package/tui/dist/daemon-client.d.ts +4 -0
  614. package/tui/dist/daemon-client.d.ts.map +1 -1
  615. package/tui/dist/daemon-client.js.map +1 -1
  616. package/tui/dist/execution/execution-model.d.ts.map +1 -1
  617. package/tui/dist/execution/execution-model.js +22 -5
  618. package/tui/dist/execution/execution-model.js.map +1 -1
  619. package/tui/dist/hydrate.d.ts.map +1 -1
  620. package/tui/dist/hydrate.js +6 -3
  621. package/tui/dist/hydrate.js.map +1 -1
  622. package/tui/dist/navigator.d.ts +1 -1
  623. package/tui/dist/navigator.d.ts.map +1 -1
  624. package/tui/dist/navigator.js +4 -2
  625. package/tui/dist/navigator.js.map +1 -1
  626. package/tui/dist/pulse/render-pulse.d.ts.map +1 -1
  627. package/tui/dist/pulse/render-pulse.js +7 -14
  628. package/tui/dist/pulse/render-pulse.js.map +1 -1
  629. package/tui/dist/render.d.ts.map +1 -1
  630. package/tui/dist/render.js +29 -21
  631. package/tui/dist/render.js.map +1 -1
  632. package/tui/dist/stylize.d.ts.map +1 -1
  633. package/tui/dist/stylize.js +3 -3
  634. package/tui/dist/stylize.js.map +1 -1
  635. package/tui/dist/terminals/terminal-model.d.ts +1 -0
  636. package/tui/dist/terminals/terminal-model.d.ts.map +1 -1
  637. package/tui/dist/terminals/terminal-model.js +4 -2
  638. package/tui/dist/terminals/terminal-model.js.map +1 -1
  639. package/tui/dist/types.d.ts +1 -0
  640. package/tui/dist/types.d.ts.map +1 -1
  641. package/tui/dist/visual-layout.d.ts +3 -0
  642. package/tui/dist/visual-layout.d.ts.map +1 -1
  643. package/tui/dist/visual-layout.js +17 -0
  644. package/tui/dist/visual-layout.js.map +1 -1
  645. package/ui/dist/assets/{index-1O1f3A7K.js → index-B-sMy02c.js} +107 -107
  646. package/ui/dist/assets/{index-BX8TUZ0E.css → index-DiN7RwWg.css} +1 -1
  647. package/ui/dist/index.html +2 -2
@@ -857,6 +857,17 @@ export class RunnerCore {
857
857
  paneError = false;
858
858
  /** A runtime-reported automatic retry is in flight; the row says retrying until it ends. */
859
859
  paneRetrying = false;
860
+ nativeEpoch = 0;
861
+ nativeTurn = null;
862
+ nativeTurnSequence = 0;
863
+ nativeTurnPosts = Promise.resolve();
864
+ cancellationFence = null;
865
+ cancellation = null;
866
+ nativeQueues = null;
867
+ epochSteers = new Set();
868
+ personSteers = new Set();
869
+ heldPersonPrompts = [];
870
+ pendingNativeInputs = new Set();
860
871
  /** Pi runs this runner has opened, each posted as an accepted turn (contract section 4): the working beat names it. */
861
872
  turn = 0;
862
873
  sessionFile;
@@ -914,8 +925,46 @@ export class RunnerCore {
914
925
  /** Runner readiness is the sidecar's acknowledged get_state, not RPC transport ready. */
915
926
  isReady() { return this.ready; }
916
927
  /** A permanent reporting-authority refusal fences new managed dispatch, not person input or native work already in flight. */
917
- quarantineManagedChannel() { this.managedQuarantined = true; }
918
- nativeChannelCapabilities() { return { input: this.ready && !this.managedQuarantined && this.runtime === "pi", wake: this.ready && !this.managedQuarantined && this.nativeQueueStateAvailable && this.runtime === "pi", cancel: false }; }
928
+ quarantineManagedChannel() {
929
+ this.managedQuarantined = true;
930
+ if (this.cancellation && !this.cancellation.submitted)
931
+ this.rejectNativeCancellation(this.cancellation.entry, "runner_reporting_authority_lost");
932
+ }
933
+ nativeChannelCapabilities() { return { input: this.ready && !this.managedQuarantined, wake: this.ready && !this.managedQuarantined && this.nativeQueueStateAvailable && this.runtime === "pi", cancel: this.ready && !this.managedQuarantined && this.runtime === "pi" && !!this.io.withdrawNativeTurn }; }
934
+ /** Install the local preparation fence; this method alone submits no native operation. */
935
+ prepareNativeCancellation(target) {
936
+ if (this.runtime !== "pi" || !this.ready || this.managedQuarantined || !this.nativeTurn
937
+ || !this.nativeTurn.owned || target.runId !== this.identity.runId || target.nativeTurnId !== this.nativeTurn.id
938
+ || this.cancellationFence && this.cancellationFence !== target.nativeTurnId)
939
+ return false;
940
+ this.cancellationFence = target.nativeTurnId;
941
+ return true;
942
+ }
943
+ /** After withdrawal, retain E's fence if still live; release only a pre-submit mismatch. */
944
+ recheckNativeCancellation(target) {
945
+ if (target.runId !== this.identity.runId || this.cancellationFence !== target.nativeTurnId)
946
+ return false;
947
+ if (this.cancellation?.ended || this.nativeTurn?.id === target.nativeTurnId)
948
+ return true;
949
+ this.cancellationFence = null;
950
+ this.pumpPersonPrompts();
951
+ this.pumpManaged();
952
+ return false;
953
+ }
954
+ reportNativeTurn(state) {
955
+ if (!this.nativeTurn || !this.identity.runId || !this.io.postRunner || this.runtime !== "pi")
956
+ return;
957
+ const body = { type: "turn", runId: this.identity.runId, sequence: ++this.nativeTurnSequence,
958
+ nativeTurnId: this.nativeTurn.id, state, acceptedTurnIds: [...this.nativeTurn.accepted] };
959
+ this.nativeTurnPosts = this.nativeTurnPosts.then(() => this.io.postRunner(body)).catch(() => { });
960
+ }
961
+ pumpPersonPrompts() {
962
+ if (this.streaming || this.pendingManagedStart || !this.ready || this.cancellation?.submitted || this.cancellation?.ended)
963
+ return;
964
+ const command = this.heldPersonPrompts.shift();
965
+ if (command)
966
+ this.personPrompt(command.type === "follow_up" ? { type: "prompt", message: command.message, streamingBehavior: "steer" } : command);
967
+ }
919
968
  /** Kick off identity capture. Called once pi's RPC stream is up; for OMP, with its `ready` frame. */
920
969
  start(ready) {
921
970
  // K4: the first credential observation, before Pi can make any request of this runner's.
@@ -1001,12 +1050,14 @@ export class RunnerCore {
1001
1050
  }
1002
1051
  get runtime() { return this.opts.runtime ?? "pi"; }
1003
1052
  async acceptRunnerRequest(frame) {
1004
- if (!this.ready || this.runtime !== "pi" || !this.io.postRunner || frame.version !== 1 || frame.runId !== this.identity.runId
1053
+ if (!this.ready || this.runtime !== "pi" && frame.kind !== "input" || !this.io.postRunner || frame.version !== 1 || frame.runId !== this.identity.runId
1005
1054
  || !Number.isSafeInteger(frame.sequence) || frame.sequence < 1 || typeof frame.requestId !== "string"
1006
- || !["input", "wake"].includes(frame.kind) || typeof (frame.kind === "wake" ? frame.payload?.question : frame.payload?.text) !== "string")
1055
+ || !["input", "wake", "cancel"].includes(frame.kind)
1056
+ || (frame.kind === "cancel" ? !frame.payload?.target || frame.payload.target.runId !== frame.runId || typeof frame.payload.target.nativeTurnId !== "string"
1057
+ : typeof (frame.kind === "wake" ? frame.payload?.question : frame.payload?.text) !== "string"))
1007
1058
  return;
1008
1059
  frame = { version: 1, runId: frame.runId, requestId: frame.requestId, sequence: frame.sequence, kind: frame.kind,
1009
- payload: frame.kind === "wake" ? { question: frame.payload.question } : { text: frame.payload.text } };
1060
+ payload: frame.kind === "cancel" ? { target: { ...frame.payload.target } } : frame.kind === "wake" ? { question: frame.payload.question } : { text: frame.payload.text } };
1010
1061
  if ([...this.managed.values()].some(entry => entry.frame.sequence === frame.sequence && entry.frame.requestId !== frame.requestId))
1011
1062
  throw new Error("Conflicting native sequence");
1012
1063
  const old = this.managed.get(frame.requestId);
@@ -1018,13 +1069,45 @@ export class RunnerCore {
1018
1069
  }
1019
1070
  const entry = { frame, state: "accepting", reports: Promise.resolve() };
1020
1071
  this.managed.set(frame.requestId, entry);
1072
+ const named = frame.kind === "cancel" ? frame.payload.target : null;
1073
+ const prepared = named && !this.cancellation && this.prepareNativeCancellation(named);
1074
+ const operation = prepared ? { entry, target: named, submitted: false, acknowledged: false, ended: false, aborted: false, revision: this.promptRevision } : null;
1075
+ if (operation)
1076
+ this.cancellation = operation;
1021
1077
  entry.acceptance = (async () => {
1022
1078
  const accepted = await this.io.postRunner({ type: "ack", runId: frame.runId, requestId: frame.requestId, sequence: frame.sequence, state: "accepted" });
1023
1079
  if (!accepted) {
1024
1080
  entry.state = "unavailable";
1081
+ if (operation && this.cancellation === operation && !operation.submitted && !operation.ended) {
1082
+ this.cancellation = null;
1083
+ if (this.cancellationFence === operation.target.nativeTurnId)
1084
+ this.cancellationFence = null;
1085
+ this.pumpPersonPrompts();
1086
+ }
1025
1087
  this.pumpManaged();
1026
1088
  return;
1027
1089
  }
1090
+ if (operation && this.cancellation !== operation)
1091
+ return;
1092
+ if (named) {
1093
+ entry.state = "queued";
1094
+ if (!prepared) {
1095
+ if (this.cancellation)
1096
+ this.rejectNativeCancellation(entry, "cancellation_in_progress");
1097
+ else if (this.nativeTurn && this.nativeTurn.id !== named.nativeTurnId) {
1098
+ entry.state = "terminal";
1099
+ this.reportManaged(entry, "result", { kind: "cancel", outcome: "not-this-turn", confirmed: false });
1100
+ }
1101
+ else
1102
+ this.rejectNativeCancellation(entry, "native_turn_ownership_unknown");
1103
+ }
1104
+ else
1105
+ void this.performNativeCancellation(operation).catch(() => {
1106
+ if (this.cancellation === operation && !operation.submitted)
1107
+ this.rejectNativeCancellation(entry, "preparation_failed");
1108
+ });
1109
+ return;
1110
+ }
1028
1111
  entry.state = "queued";
1029
1112
  this.managedQueue.push(entry);
1030
1113
  this.managedQueue.sort((a, b) => a.frame.sequence - b.frame.sequence);
@@ -1036,11 +1119,122 @@ export class RunnerCore {
1036
1119
  const f = entry.frame;
1037
1120
  if (type !== "submitted" && result)
1038
1121
  entry.terminalResult = result;
1039
- entry.reports = entry.reports.then(() => this.io.postRunner?.({ type, runId: f.runId, requestId: f.requestId, sequence: f.sequence,
1040
- ...(f.kind === "wake" ? { nativeTurnId: `pi-wake-${f.requestId}` } : {}), ...(result ? { result } : {}) })).catch(() => { });
1122
+ entry.reports = entry.reports.then(async () => {
1123
+ await entry.acceptance;
1124
+ if (entry.state === "unavailable")
1125
+ return;
1126
+ return this.io.postRunner?.({ type, runId: f.runId, requestId: f.requestId, sequence: f.sequence,
1127
+ ...(entry.nativeTurnId ? { nativeTurnId: entry.nativeTurnId } : {}),
1128
+ ...(entry.acceptedTurnId ? { acceptedTurnId: entry.acceptedTurnId } : {}), ...(result ? { result } : {}) });
1129
+ }).catch(() => { });
1130
+ }
1131
+ async performNativeCancellation(operation) {
1132
+ const { entry, target } = operation;
1133
+ if (this.cancellation !== operation || operation.ended)
1134
+ return;
1135
+ if (!this.io.withdrawNativeTurn) {
1136
+ this.finishNativeCancellation("not-supported");
1137
+ return;
1138
+ }
1139
+ for (;;) {
1140
+ if (this.cancellation !== operation || operation.ended)
1141
+ return;
1142
+ const withdrawal = await this.io.withdrawNativeTurn({ type: "cancel-prepare", runId: entry.frame.runId, requestId: entry.frame.requestId, sequence: entry.frame.sequence });
1143
+ if (this.cancellation !== operation || operation.ended)
1144
+ return;
1145
+ if (!withdrawal) {
1146
+ this.rejectNativeCancellation(entry, "preparation_failed");
1147
+ return;
1148
+ }
1149
+ if (operation.revision !== this.promptRevision) {
1150
+ this.rejectNativeCancellation(entry, "person_input_after_preparation");
1151
+ return;
1152
+ }
1153
+ if (!this.nativeTurn || this.nativeTurn.id !== target.nativeTurnId || withdrawal.notThisTurn) {
1154
+ this.finishNativeCancellation("not-this-turn");
1155
+ return;
1156
+ }
1157
+ if (withdrawal?.confirmed)
1158
+ break;
1159
+ if (!this.ready || this.cancellation !== operation)
1160
+ return;
1161
+ await new Promise(resolve => setTimeout(resolve, 250));
1162
+ }
1163
+ if (!this.ready || this.nativeTurn?.id !== target.nativeTurnId) {
1164
+ this.finishNativeCancellation("not-this-turn");
1165
+ return;
1166
+ }
1167
+ if (!this.nativeTurn.owned || this.managedQuarantined || !this.ownsNativeCancellationQueue()) {
1168
+ this.rejectNativeCancellation(entry, "native_queue_ownership_unknown");
1169
+ return;
1170
+ }
1171
+ // The state reply is correlated to this captured preparation. E is rechecked again after the await.
1172
+ this.io.sendRpc({ type: "get_state", id: `openrig-cancel-preflight-${entry.frame.requestId}` });
1173
+ }
1174
+ ownsNativeCancellationQueue(pending) {
1175
+ if (this.nativeQueues && (this.nativeQueues.followUp.length > 0 || this.nativeQueues.steering.some(text => this.personSteers.has(text) || !this.epochSteers.has(text))))
1176
+ return false;
1177
+ if (pending === undefined)
1178
+ return true;
1179
+ if (!Number.isSafeInteger(pending) || pending < 0)
1180
+ return false;
1181
+ return pending === 0 ? !this.nativeQueues || this.nativeQueues.steering.length === 0
1182
+ : !!this.nativeQueues && this.nativeQueues.steering.length === pending;
1183
+ }
1184
+ /** Only this local owner can establish that no native cancel was written. */
1185
+ rejectNativeCancellation(entry, reason) {
1186
+ if (this.cancellation?.entry === entry) {
1187
+ if (this.cancellation.submitted || this.cancellation.ended)
1188
+ return;
1189
+ this.cancellation = null;
1190
+ this.cancellationFence = null;
1191
+ }
1192
+ entry.state = "terminal";
1193
+ this.diag(`Cancellation ${JSON.stringify(entry.frame.requestId)} was not applied (${reason}); withdrawn approvals stay withdrawn. Person input remains available.`);
1194
+ this.reportManaged(entry, "rejected", { kind: "cancel", reason, applied: false });
1195
+ this.pumpPersonPrompts();
1196
+ this.pumpManaged();
1197
+ }
1198
+ finishNativeCancellation(outcome, detail) {
1199
+ const operation = this.cancellation;
1200
+ if (!operation)
1201
+ return;
1202
+ const unavailable = operation.entry.state === "unavailable";
1203
+ if (!unavailable)
1204
+ operation.entry.state = "terminal";
1205
+ const words = this.nativeQueues ? [...this.nativeQueues.steering, ...this.nativeQueues.followUp] : [];
1206
+ const inputRequestIds = [];
1207
+ let unmatchedCount = this.nativeQueues ? 0 : operation.pendingMessages ?? 0;
1208
+ for (const text of words) {
1209
+ const matches = [...this.managed.values()].filter(entry => entry.frame.kind === "input" && entry.nativeTurnId === operation.target.nativeTurnId && entry.frame.payload.text === text);
1210
+ if (matches.length === 1 && matches[0].frame.requestId.length > 0 && matches[0].frame.requestId.length <= 1024 && inputRequestIds.length < 100 && !inputRequestIds.includes(matches[0].frame.requestId))
1211
+ inputRequestIds.push(matches[0].frame.requestId);
1212
+ else
1213
+ unmatchedCount++;
1214
+ }
1215
+ if (!unavailable)
1216
+ this.reportManaged(operation.entry, "result", { kind: "cancel", outcome, confirmed: outcome === "cancelled", operationAccepted: operation.acknowledged, ...(detail ? { detail } : {}),
1217
+ ...(operation.submitted && (words.length || unmatchedCount) ? { continuation: { inputRequestIds, pendingRequestIds: this.managedQueue.map(entry => entry.frame.requestId).filter(id => id.length > 0 && id.length <= 1024).slice(0, 100), unmatchedCount } } : {}) });
1218
+ this.cancellation = null;
1219
+ this.cancellationFence = null;
1220
+ this.pumpPersonPrompts();
1221
+ this.pumpManaged();
1222
+ }
1223
+ finishEndedNativeCancellation(settled = false) {
1224
+ const operation = this.cancellation;
1225
+ if (!operation?.ended || !settled)
1226
+ return;
1227
+ if (!operation.submitted) {
1228
+ this.finishNativeCancellation("not-this-turn");
1229
+ return;
1230
+ }
1231
+ const queueEmpty = operation.pendingMessages === 0 && (!this.nativeQueues
1232
+ || this.nativeQueues.steering.length === 0 && this.nativeQueues.followUp.length === 0);
1233
+ const confirmed = operation.aborted && queueEmpty && operation.revision === this.promptRevision;
1234
+ this.finishNativeCancellation(confirmed ? "cancelled" : "requested", confirmed ? undefined : "native_end_without_cancellation_proof");
1041
1235
  }
1042
1236
  pumpManaged() {
1043
- if (!this.ready || this.managedQuarantined || this.managedWake || this.pendingManagedStart && !this.streaming)
1237
+ if (!this.ready || this.cancellationFence || this.managedQuarantined || this.managedWake || this.runtime === "pi" && this.pendingManagedStart && !this.streaming)
1044
1238
  return;
1045
1239
  const entry = this.managedQueue[0];
1046
1240
  if (!entry || this.personPreflights.size || [...this.managed.values()].some(prior => prior.state === "accepting" && prior.frame.sequence < entry.frame.sequence)
@@ -1060,12 +1254,22 @@ export class RunnerCore {
1060
1254
  this.managedWake = entry;
1061
1255
  entry.answer = [];
1062
1256
  }
1063
- if (!this.streaming)
1257
+ if (this.runtime === "pi" && !this.streaming)
1064
1258
  this.pendingManagedStart = true;
1065
1259
  const id = `openrig-native-${entry.frame.requestId}`;
1066
1260
  this.managedRpc.set(id, entry);
1261
+ if (this.runtime === "pi" && this.streaming && entry.frame.kind === "input")
1262
+ this.epochSteers.add(entry.frame.payload.text);
1067
1263
  this.io.sendRpc({ id, type: "prompt", message: entry.frame.kind === "wake" ? entry.frame.payload.question : entry.frame.payload.text, streamingBehavior: "steer" });
1068
1264
  this.acceptIntoOpenRun();
1265
+ if (this.runtime === "pi") {
1266
+ if (this.nativeTurn) {
1267
+ entry.nativeTurnId = this.nativeTurn.id;
1268
+ entry.acceptedTurnId = String(this.turn);
1269
+ }
1270
+ else
1271
+ this.pendingNativeInputs.add(entry);
1272
+ }
1069
1273
  // Ordinary busy messages may steer; the next queued wake waits for agent_end, not this RPC response.
1070
1274
  this.pumpManaged();
1071
1275
  }
@@ -1080,7 +1284,7 @@ export class RunnerCore {
1080
1284
  const completion = ownershipUnknown || forced && !entry.nativeAccepted ? "unknown" : forced ?? (entry.contaminated || !entry.wakeOpened ? "unknown"
1081
1285
  : entry.stopReason === "stop" && entry.answer?.some(text => text.length > 0) ? "completed" : entry.stopReason === "aborted" ? "interrupted" : entry.stopReason === "error" ? "failed" : "unknown");
1082
1286
  entry.state = "terminal";
1083
- entry.terminalResult = { kind: "wake", nativeTurnId: `pi-wake-${entry.frame.requestId}`,
1287
+ entry.terminalResult = { kind: "wake", ...(entry.nativeTurnId ? { nativeTurnId: entry.nativeTurnId } : {}),
1084
1288
  completion, answer: completion === "completed" ? entry.answer?.join("\n") ?? "" : null,
1085
1289
  ...(ownershipUnknown ? { ownershipUnknown: true } : {}),
1086
1290
  ...(forced && !entry.nativeAccepted ? { submissionUnknown: true } : {}) };
@@ -1094,14 +1298,23 @@ export class RunnerCore {
1094
1298
  this.io.sendRpc(command);
1095
1299
  return;
1096
1300
  }
1301
+ if (this.cancellation?.submitted || this.cancellation?.ended || command.type === "follow_up" && (this.streaming || this.pendingManagedStart)) {
1302
+ this.heldPersonPrompts.push(command);
1303
+ return;
1304
+ }
1097
1305
  const id = `openrig-person-${++this.promptRevision}`;
1098
1306
  this.personPreflights.add(id);
1099
1307
  if (!this.streaming)
1100
1308
  this.pendingManagedStart = true;
1309
+ if (this.streaming && typeof command.message === "string")
1310
+ this.personSteers.add(command.message);
1101
1311
  this.io.sendRpc({ ...command, id });
1312
+ this.acceptIntoOpenRun();
1102
1313
  }
1103
1314
  /** One aggregated paste block from pane stdin. */
1104
1315
  handleUserBlock(block) {
1316
+ if (this.cancellation && !this.cancellation.submitted && !this.cancellation.ended)
1317
+ this.rejectNativeCancellation(this.cancellation.entry, "person_input_after_preparation");
1105
1318
  const compact = /^\/openrig-compact ([\w-]+)$/.exec(block);
1106
1319
  if (this.runtime === "pi" && compact) {
1107
1320
  const attemptId = compact[1];
@@ -1128,7 +1341,8 @@ export class RunnerCore {
1128
1341
  const message = block.slice("/followup ".length);
1129
1342
  this.personPrompt({ type: "follow_up", message });
1130
1343
  this.io.mirrorLine(`${this.style.commit("you (follow-up) ▸")} ${message}`);
1131
- this.acceptIntoOpenRun();
1344
+ if (this.runtime !== "pi" || !this.io.postRunner)
1345
+ this.acceptIntoOpenRun();
1132
1346
  return;
1133
1347
  }
1134
1348
  // The runtime decides, not the runner: with streamingBehavior "steer", Pi and OMP run the prompt when idle and,
@@ -1137,7 +1351,8 @@ export class RunnerCore {
1137
1351
  // when a prompt was consumed locally and started none. It labels the mirror line only.
1138
1352
  this.personPrompt({ type: "prompt", message: block, streamingBehavior: "steer" });
1139
1353
  this.io.mirrorLine(this.streaming ? `${this.style.commit("you (steer) ▸")} ${block}` : `${this.style.commit("you ▸")} ${block}`);
1140
- this.acceptIntoOpenRun();
1354
+ if (this.runtime !== "pi" || !this.io.postRunner)
1355
+ this.acceptIntoOpenRun();
1141
1356
  }
1142
1357
  /** A working beat counts only for the latest accepted turn, and each prompt the runner gives the agent is accepted with
1143
1358
  * its own number (contract section 4). One sent while a Pi run is open is posted as it's sent, and the run's end
@@ -1147,12 +1362,18 @@ export class RunnerCore {
1147
1362
  if (this.runtime === "omp" || !this.streaming)
1148
1363
  return;
1149
1364
  this.turn += 1;
1365
+ if (this.nativeTurn) {
1366
+ this.nativeTurn.accepted.push(String(this.turn));
1367
+ this.reportNativeTurn("opened");
1368
+ }
1150
1369
  this.io.postActivity(this.activityPayload("UserPromptSubmit", "accepted", { turnId: String(this.turn) }));
1151
1370
  }
1152
1371
  /** Child process exit — honest, loud, durable. */
1153
1372
  handlePiExit(code) {
1154
1373
  this.ready = false;
1155
1374
  this.paneExited = true;
1375
+ if (this.cancellation)
1376
+ this.finishNativeCancellation(this.cancellation.submitted ? "requested" : "not-this-turn", "native_process_exited");
1156
1377
  if (this.managedWake)
1157
1378
  this.finishManagedWake(this.managedWake, "failed");
1158
1379
  this.reportDroppedFrame(this.frameDecoder?.incomplete());
@@ -1162,6 +1383,37 @@ export class RunnerCore {
1162
1383
  this.refreshPaneStatus();
1163
1384
  }
1164
1385
  handleResponse(record) {
1386
+ const cancellation = this.cancellation;
1387
+ if (cancellation && !cancellation.submitted && record.id === `openrig-cancel-preflight-${cancellation.entry.frame.requestId}`) {
1388
+ if (cancellation.ended)
1389
+ return;
1390
+ const state = record.data;
1391
+ if (!this.ready || this.nativeTurn?.id !== cancellation.target.nativeTurnId || state?.isStreaming === false) {
1392
+ this.finishNativeCancellation("not-this-turn");
1393
+ return;
1394
+ }
1395
+ if (cancellation.revision !== this.promptRevision) {
1396
+ this.rejectNativeCancellation(cancellation.entry, "person_input_after_preparation");
1397
+ return;
1398
+ }
1399
+ if (record.success !== true || state?.isStreaming !== true || typeof state.pendingMessageCount !== "number"
1400
+ || !this.nativeTurn.owned || this.managedQuarantined || !this.ownsNativeCancellationQueue(state.pendingMessageCount)) {
1401
+ this.rejectNativeCancellation(cancellation.entry, "native_queue_ownership_unknown");
1402
+ return;
1403
+ }
1404
+ cancellation.pendingMessages = state.pendingMessageCount;
1405
+ cancellation.submitted = true;
1406
+ cancellation.entry.state = "submitted";
1407
+ this.io.sendRpc({ type: "abort", id: `openrig-cancel-${cancellation.entry.frame.requestId}` });
1408
+ this.reportManaged(cancellation.entry, "submitted", { kind: "cancel", outcome: "requested", confirmed: false, operationAccepted: false });
1409
+ this.diag(`Cancellation ${JSON.stringify(cancellation.entry.frame.requestId)} for ${JSON.stringify(cancellation.target.nativeTurnId)} is requested, not confirmed. Managed inputs ${JSON.stringify(this.managedQueue.map(entry => entry.frame.requestId))} remain recorded for ${this.identity.sessionName}. Inspect rig seat status ${this.identity.sessionName} --json. The named invocation settling releases the cancellation hold; a wake still waits for native idle and an empty queue. Continue with a new plain prompt in this pane, without resending retained words. This is distinct from /abort or stopping the seat; continuation is not cancellation proof and never restores withdrawn approvals. Person's /abort remains available, or explicitly choose rig seat stop ${this.identity.sessionName} --reason <reason>. Nothing restarts or replays automatically.`);
1410
+ return;
1411
+ }
1412
+ if (cancellation && record.id === `openrig-cancel-${cancellation.entry.frame.requestId}`) {
1413
+ if (record.success === true)
1414
+ cancellation.acknowledged = true;
1415
+ return;
1416
+ }
1165
1417
  if (this.idleQuery && record.id === this.idleQuery.id) {
1166
1418
  const query = this.idleQuery;
1167
1419
  this.idleQuery = null;
@@ -1186,6 +1438,7 @@ export class RunnerCore {
1186
1438
  if (typeof record.id === "string" && this.personPreflights.delete(record.id)) {
1187
1439
  if (record.success !== true || record.data?.disposition === "handled")
1188
1440
  this.pendingManagedStart = false;
1441
+ this.pumpPersonPrompts();
1189
1442
  this.pumpManaged();
1190
1443
  if (record.success !== false && record.error == null)
1191
1444
  return;
@@ -1197,8 +1450,9 @@ export class RunnerCore {
1197
1450
  managed.nativeAccepted = true;
1198
1451
  managed.state = "submitted";
1199
1452
  this.reportManaged(managed, "submitted");
1453
+ const inputData = record.data;
1200
1454
  if (managed.frame.kind === "wake") {
1201
- const disposition = record.data?.disposition;
1455
+ const disposition = inputData?.disposition;
1202
1456
  managed.disposition = typeof disposition === "string" ? disposition : "unknown";
1203
1457
  if (!["started", "handled"].includes(managed.disposition) || managed.preDispositionEvents)
1204
1458
  this.managedQuarantined = true;
@@ -1208,24 +1462,44 @@ export class RunnerCore {
1208
1462
  this.reportManaged(managed, "result", managed.terminalResult);
1209
1463
  if (this.managedWake !== managed && !this.streaming) {
1210
1464
  this.pendingManagedStart = false;
1465
+ this.pumpPersonPrompts();
1211
1466
  this.pumpManaged();
1212
1467
  }
1213
1468
  }
1214
- else {
1469
+ else if (this.runtime !== "pi") {
1470
+ // Input acceptance needs the correlated RPC response, not an invented native invocation.
1215
1471
  managed.state = "terminal";
1216
1472
  this.reportManaged(managed, "result", { kind: "input", accepted: true });
1217
- if (record.data?.disposition === "handled") {
1218
- this.pendingManagedStart = false;
1473
+ }
1474
+ else {
1475
+ managed.disposition = inputData?.agentInvoked === false ? "handled" : typeof inputData?.disposition === "string" ? inputData.disposition : "unknown";
1476
+ if (managed.disposition === "handled") {
1477
+ this.pendingNativeInputs.delete(managed);
1478
+ delete managed.nativeTurnId;
1479
+ delete managed.acceptedTurnId;
1480
+ if (!this.streaming)
1481
+ this.pendingManagedStart = false;
1482
+ }
1483
+ // A started prompt's acknowledgement precedes agent_start. Wait for that actual scope before
1484
+ // committing its immutable terminal receipt; a handled local command has no native epoch.
1485
+ if (managed.disposition !== "started" || managed.nativeTurnId) {
1486
+ managed.state = "terminal";
1487
+ this.reportManaged(managed, "result", { kind: "input", accepted: true });
1488
+ }
1489
+ if (managed.disposition === "handled") {
1490
+ this.pumpPersonPrompts();
1219
1491
  this.pumpManaged();
1220
1492
  }
1221
1493
  }
1222
1494
  }
1223
1495
  else {
1496
+ this.pendingNativeInputs.delete(managed);
1224
1497
  managed.state = "terminal";
1225
1498
  this.pendingManagedStart = false;
1226
1499
  this.reportManaged(managed, "rejected", { kind: managed.frame.kind, reason: "native_prompt_rejected" });
1227
1500
  if (this.managedWake === managed)
1228
1501
  this.managedWake = null;
1502
+ this.pumpPersonPrompts();
1229
1503
  this.pumpManaged();
1230
1504
  }
1231
1505
  return;
@@ -1584,6 +1858,25 @@ export class RunnerCore {
1584
1858
  }
1585
1859
  this.writeSidecar({});
1586
1860
  }
1861
+ if (event.type === "queue_update") {
1862
+ if (this.cancellation?.submitted && (!Array.isArray(event.steering) || !event.steering.every(text => typeof text === "string") || !Array.isArray(event.followUp) || !event.followUp.every(text => typeof text === "string") || event.steering.length > 0 || event.followUp.length > 0))
1863
+ this.cancellation.pendingMessages = Math.max(1, this.cancellation.pendingMessages ?? 0);
1864
+ this.nativeQueues = Array.isArray(event.steering) && event.steering.every(text => typeof text === "string")
1865
+ && Array.isArray(event.followUp) && event.followUp.every(text => typeof text === "string")
1866
+ ? { steering: event.steering, followUp: event.followUp } : null;
1867
+ }
1868
+ if (event.type === "agent_settled" && this.cancellation?.ended) {
1869
+ if (typeof event.aborted === "boolean")
1870
+ this.cancellation.aborted = event.aborted;
1871
+ this.finishEndedNativeCancellation(true);
1872
+ }
1873
+ if (this.cancellation && this.nativeTurn?.id === this.cancellation.target.nativeTurnId) {
1874
+ const message = event.message;
1875
+ if (event.type === "message_end" && message?.role === "assistant" && message.stopReason === "aborted")
1876
+ this.cancellation.aborted = true;
1877
+ if (event.type === "agent_end")
1878
+ this.cancellation.ended = true;
1879
+ }
1587
1880
  if (event.type === "extension_ui_request") {
1588
1881
  const method = event.method;
1589
1882
  const dialog = method === "select" || method === "confirm" || method === "input" || method === "editor";
@@ -1689,6 +1982,8 @@ export class RunnerCore {
1689
1982
  // A working beat counts only for the latest accepted turn. Pi's runs start from this runner's prompts, so the run
1690
1983
  // that opens is posted as one, before its first event; a prompt Pi handles without a run opens none. A prompt sent
1691
1984
  // into an open run is accepted as it's sent (acceptIntoOpenRun).
1985
+ if (this.runtime === "pi" && event.type === "agent_start" && this.nativeTurn)
1986
+ this.managedQuarantined = true;
1692
1987
  const opening = this.runtime !== "omp" && mapped.streaming === true && !this.streaming;
1693
1988
  if (mapped.streaming !== undefined) {
1694
1989
  const changed = this.streaming !== mapped.streaming;
@@ -1696,9 +1991,25 @@ export class RunnerCore {
1696
1991
  if (changed)
1697
1992
  this.refreshPaneStatus();
1698
1993
  }
1994
+ if (this.cancellation && (this.cancellation.submitted || this.cancellation.ended) && (event.type === "agent_start" || opening))
1995
+ this.finishNativeCancellation(this.cancellation.submitted ? "requested" : "not-this-turn", "native_settlement_superseded");
1699
1996
  if (opening) {
1700
1997
  setImmediate(() => this.pumpManaged());
1701
1998
  this.turn += 1;
1999
+ this.epochSteers.clear();
2000
+ this.personSteers.clear();
2001
+ this.nativeQueues = null;
2002
+ this.nativeTurn = { id: `pi-invocation-${++this.nativeEpoch}`, accepted: [String(this.turn)], owned: this.pendingManagedStart };
2003
+ this.reportNativeTurn("opened");
2004
+ for (const entry of this.pendingNativeInputs) {
2005
+ entry.nativeTurnId = this.nativeTurn.id;
2006
+ entry.acceptedTurnId = String(this.turn);
2007
+ if (entry.frame.kind === "input" && entry.nativeAccepted && entry.disposition === "started") {
2008
+ entry.state = "terminal";
2009
+ this.reportManaged(entry, "result", { kind: "input", accepted: true });
2010
+ }
2011
+ }
2012
+ this.pendingNativeInputs.clear();
1702
2013
  this.io.postActivity(this.activityPayload("UserPromptSubmit", "accepted", { turnId: String(this.turn) }));
1703
2014
  }
1704
2015
  // OMP writes its JSONL lazily; re-announce identity after each turn until
@@ -1713,11 +2024,14 @@ export class RunnerCore {
1713
2024
  }
1714
2025
  this.idleRevision = -1;
1715
2026
  this.pendingManagedStart = false;
2027
+ this.reportNativeTurn("closed");
2028
+ this.nativeTurn = null;
2029
+ this.finishEndedNativeCancellation();
1716
2030
  if (wake) {
1717
2031
  wake.nativeTerminal = true;
1718
2032
  this.finishManagedWake(wake);
1719
2033
  }
1720
- setImmediate(() => this.pumpManaged());
2034
+ setImmediate(() => { this.pumpPersonPrompts(); this.pumpManaged(); });
1721
2035
  // QA RED fold: live events do not reliably carry
1722
2036
  // session-entry ids, so the durable cursor starved (lastEntryId stayed
1723
2037
  // null in real runs). Refresh it from the source of truth after every
@@ -2222,13 +2536,19 @@ export async function connectPiRunnerChannel(core, endpoint, runId, signal) {
2222
2536
  await new Promise(resolve => setTimeout(resolve, 250));
2223
2537
  }
2224
2538
  }
2225
- async function postPiRunnerChannel(endpoint, body, signal, onPermanentRunRefusal) {
2539
+ async function postPiRunnerChannel(endpoint, body, signal, onPermanentRunRefusal, onContinuation) {
2226
2540
  while (!signal.aborted) {
2227
2541
  try {
2228
2542
  const response = await fetch(new URL("/api/activity/runner-channel", endpoint.baseUrl), { method: "POST",
2229
2543
  signal: AbortSignal.any([signal, AbortSignal.timeout(3000)]), headers: { authorization: `Bearer ${endpoint.token}`, "content-type": "application/json" }, body: JSON.stringify(body) });
2230
- if (response.ok)
2544
+ if (response.ok) {
2545
+ if (body.result?.continuation) {
2546
+ const reply = await response.json().catch(() => null);
2547
+ if (reply?.continuation)
2548
+ onContinuation?.(`Native continuation: ${JSON.stringify(reply.continuation)}`);
2549
+ }
2231
2550
  return true;
2551
+ }
2232
2552
  const failure = await response.json().catch(() => null);
2233
2553
  if ([401, 403, 404, 409, 410].includes(response.status) && !["runner_hello_required", "runner_grant_pending", "runner_grant_unverified"].includes(failure?.code ?? "")) {
2234
2554
  if (isPermanentPiRunRefusal(response.status, failure?.code))
@@ -2331,7 +2651,7 @@ export async function main(argv = process.argv.slice(2)) {
2331
2651
  try {
2332
2652
  const pending = parsePiRunnerState(fs.readFileSync(paths.runnerStatePath, "utf8"));
2333
2653
  const exitedState = { ready: false, launchId: args.launchId, lastEntryId: pending?.lastEntryId, updatedAt: at, exited: { code: 127, at } };
2334
- fs.writeFileSync(paths.runnerStatePath, JSON.stringify(exitedState));
2654
+ writePiRunnerSidecar(paths.runnerStatePath, exitedState);
2335
2655
  }
2336
2656
  catch { /* the pane ERROR marker still fails readiness */ }
2337
2657
  process.exitCode = 127;
@@ -2430,7 +2750,23 @@ export async function main(argv = process.argv.slice(2)) {
2430
2750
  child.once("exit", () => { nativeStream.abort(); setTimeout(() => nativePosts.abort(), 2000).unref(); });
2431
2751
  child.once("error", () => { nativeStream.abort(); nativePosts.abort(); });
2432
2752
  const io = {
2433
- ...(runtime === "pi" && endpoint && runId ? { postRunner: (body) => postPiRunnerChannel(endpoint, body, nativePosts.signal, () => core.quarantineManagedChannel()) } : {}),
2753
+ ...(endpoint && runId ? { postRunner: (body) => postPiRunnerChannel(endpoint, body, nativePosts.signal, () => core.quarantineManagedChannel(), paneDiag) } : {}),
2754
+ ...(runtime === "pi" && endpoint && runId ? { withdrawNativeTurn: async (body) => {
2755
+ try {
2756
+ const response = await fetch(`${endpoint.baseUrl}/api/activity/runner-channel`, { method: "POST", signal: AbortSignal.timeout(3000),
2757
+ headers: { authorization: `Bearer ${endpoint.token}`, "content-type": "application/json" }, body: JSON.stringify(body) });
2758
+ if (!response.ok) {
2759
+ const failure = await response.json().catch(() => null);
2760
+ if (isPermanentPiRunRefusal(response.status, failure?.code))
2761
+ core.quarantineManagedChannel();
2762
+ return null;
2763
+ }
2764
+ return (await response.json()).withdrawal ?? null;
2765
+ }
2766
+ catch {
2767
+ return null;
2768
+ }
2769
+ } } : {}),
2434
2770
  sendRpc: (cmd) => {
2435
2771
  try {
2436
2772
  child.stdin.write(`${JSON.stringify(cmd)}\n`);
@@ -2453,10 +2789,7 @@ export async function main(argv = process.argv.slice(2)) {
2453
2789
  },
2454
2790
  writeSidecar: (state) => {
2455
2791
  try {
2456
- if (runtime === "pi")
2457
- writePiRunnerSidecar(paths.runnerStatePath, state);
2458
- else
2459
- fs.writeFileSync(paths.runnerStatePath, JSON.stringify(state));
2792
+ writePiRunnerSidecar(paths.runnerStatePath, state);
2460
2793
  }
2461
2794
  catch { /* best-effort; adapter falls back to pane markers */ }
2462
2795
  },
@@ -2511,7 +2844,7 @@ export async function main(argv = process.argv.slice(2)) {
2511
2844
  runId: runId,
2512
2845
  }, { catchUpSince, runtime, usageFacts: args.usageFacts === true, openRouterCharge: args.openRouterCharge === true, launchCredentialEvidence,
2513
2846
  requestedSessionFile: args.sessionFile, model: args.model, thinking: args.thinking });
2514
- if (runtime === "pi" && endpoint && runId)
2847
+ if (endpoint && runId)
2515
2848
  void connectPiRunnerChannel(core, endpoint, runId, nativeStream.signal);
2516
2849
  let transportUp = runtime !== "omp";
2517
2850
  readline.createInterface({ input: child.stdout }).on("line", (line) => {