@openrig/cli 0.7.17 → 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 (986) 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 +6 -0
  13. package/daemon/assets/plugins/openrig-core/skills/messaging-the-human/SKILL.md +23 -0
  14. package/daemon/assets/plugins/openrig-core/skills/mission-slice-sop/SKILL.md +1 -1
  15. package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +11 -0
  16. package/daemon/assets/plugins/openrig-core/skills/refocusing/scripts/trace-to-root.py +95 -7
  17. package/daemon/assets/skills/rigs/SKILL.md +68 -33
  18. package/daemon/assets/skills/rigs/references/installing-for-someone.md +2 -2
  19. package/daemon/context-packs/help/manifest.yaml +1 -1
  20. package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
  21. package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +57 -14
  22. package/daemon/context-packs/reference/getting-started.md +9 -4
  23. package/daemon/context-packs/reference/manifest.yaml +1 -1
  24. package/daemon/context-packs/reference/rig-spec.md +197 -1
  25. package/daemon/context-packs/reference/whats-new.md +187 -15
  26. package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
  27. package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
  28. package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
  29. package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
  30. package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
  31. package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
  32. package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
  33. package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
  34. package/daemon/context-packs/skills/core/messaging-the-human/SKILL.md +23 -0
  35. package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
  36. package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
  37. package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
  38. package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
  39. package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
  40. package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
  41. package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
  42. package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
  43. package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
  44. package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
  45. package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
  46. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
  47. package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
  48. package/daemon/context-packs/skills/core/working-with-an-openrig-team/manifest.yaml +1 -1
  49. package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
  50. package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
  51. package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
  52. package/daemon/context-packs/skills/mission-slice-sop/SKILL.md +1 -1
  53. package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
  54. package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
  55. package/daemon/context-packs/skills/openrig-user/SKILL.md +11 -0
  56. package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
  57. package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
  58. package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
  59. package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
  60. package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
  61. package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
  62. package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
  63. package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
  64. package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
  65. package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
  66. package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
  67. package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
  68. package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
  69. package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
  70. package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
  71. package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
  72. package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
  73. package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
  74. package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
  75. package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
  76. package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
  77. package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
  78. package/daemon/context-packs/skills/refocusing/scripts/trace-to-root.py +95 -7
  79. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
  80. package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
  81. package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
  82. package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
  83. package/daemon/context-packs/world-example/manifest.yaml +1 -1
  84. package/daemon/context-packs/world-public/manifest.yaml +1 -1
  85. package/daemon/dist/adapters/claude-code-adapter.d.ts +9 -0
  86. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  87. package/daemon/dist/adapters/claude-code-adapter.js +57 -9
  88. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  89. package/daemon/dist/adapters/claude-resume.d.ts +4 -1
  90. package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
  91. package/daemon/dist/adapters/claude-resume.js +15 -5
  92. package/daemon/dist/adapters/claude-resume.js.map +1 -1
  93. package/daemon/dist/adapters/codex-runtime-adapter.d.ts +5 -0
  94. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  95. package/daemon/dist/adapters/codex-runtime-adapter.js +45 -10
  96. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  97. package/daemon/dist/adapters/kernel-authority.d.ts +8 -1
  98. package/daemon/dist/adapters/kernel-authority.d.ts.map +1 -1
  99. package/daemon/dist/adapters/kernel-authority.js +45 -10
  100. package/daemon/dist/adapters/kernel-authority.js.map +1 -1
  101. package/daemon/dist/adapters/pi-resume.d.ts.map +1 -1
  102. package/daemon/dist/adapters/pi-resume.js +5 -7
  103. package/daemon/dist/adapters/pi-resume.js.map +1 -1
  104. package/daemon/dist/adapters/pi-runner-protocol.d.ts +47 -0
  105. package/daemon/dist/adapters/pi-runner-protocol.d.ts.map +1 -1
  106. package/daemon/dist/adapters/pi-runner-protocol.js.map +1 -1
  107. package/daemon/dist/adapters/pi-runner.d.ts +84 -1
  108. package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
  109. package/daemon/dist/adapters/pi-runner.js +799 -16
  110. package/daemon/dist/adapters/pi-runner.js.map +1 -1
  111. package/daemon/dist/adapters/pi-runtime-adapter.d.ts +7 -1
  112. package/daemon/dist/adapters/pi-runtime-adapter.d.ts.map +1 -1
  113. package/daemon/dist/adapters/pi-runtime-adapter.js +29 -19
  114. package/daemon/dist/adapters/pi-runtime-adapter.js.map +1 -1
  115. package/daemon/dist/adapters/tmux-credential-env.d.ts +4 -0
  116. package/daemon/dist/adapters/tmux-credential-env.d.ts.map +1 -0
  117. package/daemon/dist/adapters/tmux-credential-env.js +14 -0
  118. package/daemon/dist/adapters/tmux-credential-env.js.map +1 -0
  119. package/daemon/dist/adapters/tmux-exec.d.ts.map +1 -1
  120. package/daemon/dist/adapters/tmux-exec.js +4 -3
  121. package/daemon/dist/adapters/tmux-exec.js.map +1 -1
  122. package/daemon/dist/adapters/tmux-server.d.ts +2 -2
  123. package/daemon/dist/adapters/tmux-server.d.ts.map +1 -1
  124. package/daemon/dist/adapters/tmux-server.js +12 -4
  125. package/daemon/dist/adapters/tmux-server.js.map +1 -1
  126. package/daemon/dist/adapters/tmux.d.ts +242 -14
  127. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  128. package/daemon/dist/adapters/tmux.js +966 -34
  129. package/daemon/dist/adapters/tmux.js.map +1 -1
  130. package/daemon/dist/attention-surface.d.ts +4 -1
  131. package/daemon/dist/attention-surface.d.ts.map +1 -1
  132. package/daemon/dist/attention-surface.js.map +1 -1
  133. package/daemon/dist/build-info.js +3 -3
  134. package/daemon/dist/db/all-migrations.d.ts.map +1 -1
  135. package/daemon/dist/db/all-migrations.js +14 -0
  136. package/daemon/dist/db/all-migrations.js.map +1 -1
  137. package/daemon/dist/db/migrations/171_claude_auto_mode.d.ts +4 -0
  138. package/daemon/dist/db/migrations/171_claude_auto_mode.d.ts.map +1 -0
  139. package/daemon/dist/db/migrations/171_claude_auto_mode.js +9 -0
  140. package/daemon/dist/db/migrations/171_claude_auto_mode.js.map +1 -0
  141. package/daemon/dist/db/migrations/171_node_input_route.d.ts +4 -0
  142. package/daemon/dist/db/migrations/171_node_input_route.d.ts.map +1 -0
  143. package/daemon/dist/db/migrations/171_node_input_route.js +6 -0
  144. package/daemon/dist/db/migrations/171_node_input_route.js.map +1 -0
  145. package/daemon/dist/db/migrations/171_seat_hook_bridge.d.ts +5 -0
  146. package/daemon/dist/db/migrations/171_seat_hook_bridge.d.ts.map +1 -0
  147. package/daemon/dist/db/migrations/171_seat_hook_bridge.js +25 -0
  148. package/daemon/dist/db/migrations/171_seat_hook_bridge.js.map +1 -0
  149. package/daemon/dist/db/migrations/172_queue_return_route.d.ts +3 -0
  150. package/daemon/dist/db/migrations/172_queue_return_route.d.ts.map +1 -0
  151. package/daemon/dist/db/migrations/172_queue_return_route.js +13 -0
  152. package/daemon/dist/db/migrations/172_queue_return_route.js.map +1 -0
  153. package/daemon/dist/db/migrations/173_node_process_limits.d.ts +4 -0
  154. package/daemon/dist/db/migrations/173_node_process_limits.d.ts.map +1 -0
  155. package/daemon/dist/db/migrations/173_node_process_limits.js +6 -0
  156. package/daemon/dist/db/migrations/173_node_process_limits.js.map +1 -0
  157. package/daemon/dist/db/migrations/174_session_launched_cwd.d.ts +6 -0
  158. package/daemon/dist/db/migrations/174_session_launched_cwd.d.ts.map +1 -0
  159. package/daemon/dist/db/migrations/174_session_launched_cwd.js +8 -0
  160. package/daemon/dist/db/migrations/174_session_launched_cwd.js.map +1 -0
  161. package/daemon/dist/db/migrations/175_core_app_access.d.ts +3 -0
  162. package/daemon/dist/db/migrations/175_core_app_access.d.ts.map +1 -0
  163. package/daemon/dist/db/migrations/175_core_app_access.js +26 -0
  164. package/daemon/dist/db/migrations/175_core_app_access.js.map +1 -0
  165. package/daemon/dist/domain/activity-grants.d.ts.map +1 -1
  166. package/daemon/dist/domain/activity-grants.js +8 -4
  167. package/daemon/dist/domain/activity-grants.js.map +1 -1
  168. package/daemon/dist/domain/agent-activity-store.d.ts +59 -1
  169. package/daemon/dist/domain/agent-activity-store.d.ts.map +1 -1
  170. package/daemon/dist/domain/agent-activity-store.js +250 -4
  171. package/daemon/dist/domain/agent-activity-store.js.map +1 -1
  172. package/daemon/dist/domain/agent-images/resume-token-discovery.d.ts +10 -0
  173. package/daemon/dist/domain/agent-images/resume-token-discovery.d.ts.map +1 -1
  174. package/daemon/dist/domain/agent-images/resume-token-discovery.js +21 -0
  175. package/daemon/dist/domain/agent-images/resume-token-discovery.js.map +1 -1
  176. package/daemon/dist/domain/applied-launch-observation-store.d.ts +5 -0
  177. package/daemon/dist/domain/applied-launch-observation-store.d.ts.map +1 -1
  178. package/daemon/dist/domain/applied-launch-observation-store.js +57 -21
  179. package/daemon/dist/domain/applied-launch-observation-store.js.map +1 -1
  180. package/daemon/dist/domain/builtin-startup-files.d.ts +26 -12
  181. package/daemon/dist/domain/builtin-startup-files.d.ts.map +1 -1
  182. package/daemon/dist/domain/builtin-startup-files.js +73 -34
  183. package/daemon/dist/domain/builtin-startup-files.js.map +1 -1
  184. package/daemon/dist/domain/claude-activity-hooks.d.ts +4 -2
  185. package/daemon/dist/domain/claude-activity-hooks.d.ts.map +1 -1
  186. package/daemon/dist/domain/claude-activity-hooks.js +5 -3
  187. package/daemon/dist/domain/claude-activity-hooks.js.map +1 -1
  188. package/daemon/dist/domain/claude-auto-mode.d.ts +64 -0
  189. package/daemon/dist/domain/claude-auto-mode.d.ts.map +1 -0
  190. package/daemon/dist/domain/claude-auto-mode.js +114 -0
  191. package/daemon/dist/domain/claude-auto-mode.js.map +1 -0
  192. package/daemon/dist/domain/claude-compaction-enforcer.d.ts +66 -3
  193. package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
  194. package/daemon/dist/domain/claude-compaction-enforcer.js +214 -10
  195. package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
  196. package/daemon/dist/domain/claude-continuation-launch.d.ts +5 -1
  197. package/daemon/dist/domain/claude-continuation-launch.d.ts.map +1 -1
  198. package/daemon/dist/domain/claude-continuation-launch.js +51 -2
  199. package/daemon/dist/domain/claude-continuation-launch.js.map +1 -1
  200. package/daemon/dist/domain/claude-core-plugin-env.d.ts +7 -3
  201. package/daemon/dist/domain/claude-core-plugin-env.d.ts.map +1 -1
  202. package/daemon/dist/domain/claude-core-plugin-env.js +11 -8
  203. package/daemon/dist/domain/claude-core-plugin-env.js.map +1 -1
  204. package/daemon/dist/domain/codex-daemon-support.d.ts.map +1 -1
  205. package/daemon/dist/domain/codex-daemon-support.js +6 -1
  206. package/daemon/dist/domain/codex-daemon-support.js.map +1 -1
  207. package/daemon/dist/domain/community-harness-launch-result.d.ts +2 -0
  208. package/daemon/dist/domain/community-harness-launch-result.d.ts.map +1 -1
  209. package/daemon/dist/domain/community-harness-launch-result.js +5 -1
  210. package/daemon/dist/domain/community-harness-launch-result.js.map +1 -1
  211. package/daemon/dist/domain/compaction-restore-notice.d.ts +3 -1
  212. package/daemon/dist/domain/compaction-restore-notice.d.ts.map +1 -1
  213. package/daemon/dist/domain/compaction-restore-notice.js +22 -3
  214. package/daemon/dist/domain/compaction-restore-notice.js.map +1 -1
  215. package/daemon/dist/domain/configured-account.d.ts +3 -0
  216. package/daemon/dist/domain/configured-account.d.ts.map +1 -0
  217. package/daemon/dist/domain/configured-account.js +10 -0
  218. package/daemon/dist/domain/configured-account.js.map +1 -0
  219. package/daemon/dist/domain/connection-contract.d.ts +91 -0
  220. package/daemon/dist/domain/connection-contract.d.ts.map +1 -1
  221. package/daemon/dist/domain/connection-contract.js +73 -0
  222. package/daemon/dist/domain/connection-contract.js.map +1 -1
  223. package/daemon/dist/domain/context-usage-store.d.ts +5 -0
  224. package/daemon/dist/domain/context-usage-store.d.ts.map +1 -1
  225. package/daemon/dist/domain/context-usage-store.js +37 -2
  226. package/daemon/dist/domain/context-usage-store.js.map +1 -1
  227. package/daemon/dist/domain/core-app-access.d.ts +51 -0
  228. package/daemon/dist/domain/core-app-access.d.ts.map +1 -0
  229. package/daemon/dist/domain/core-app-access.js +107 -0
  230. package/daemon/dist/domain/core-app-access.js.map +1 -0
  231. package/daemon/dist/domain/core-app-job.d.ts +411 -0
  232. package/daemon/dist/domain/core-app-job.d.ts.map +1 -0
  233. package/daemon/dist/domain/core-app-job.js +537 -0
  234. package/daemon/dist/domain/core-app-job.js.map +1 -0
  235. package/daemon/dist/domain/current-park-arm.d.ts +4 -0
  236. package/daemon/dist/domain/current-park-arm.d.ts.map +1 -0
  237. package/daemon/dist/domain/current-park-arm.js +14 -0
  238. package/daemon/dist/domain/current-park-arm.js.map +1 -0
  239. package/daemon/dist/domain/current-work.d.ts +6 -1
  240. package/daemon/dist/domain/current-work.d.ts.map +1 -1
  241. package/daemon/dist/domain/current-work.js +41 -8
  242. package/daemon/dist/domain/current-work.js.map +1 -1
  243. package/daemon/dist/domain/cwd-resolution.d.ts +14 -0
  244. package/daemon/dist/domain/cwd-resolution.d.ts.map +1 -1
  245. package/daemon/dist/domain/cwd-resolution.js +28 -3
  246. package/daemon/dist/domain/cwd-resolution.js.map +1 -1
  247. package/daemon/dist/domain/draft-aware-delivery.d.ts.map +1 -1
  248. package/daemon/dist/domain/draft-aware-delivery.js +5 -1
  249. package/daemon/dist/domain/draft-aware-delivery.js.map +1 -1
  250. package/daemon/dist/domain/errors.d.ts +4 -0
  251. package/daemon/dist/domain/errors.d.ts.map +1 -1
  252. package/daemon/dist/domain/errors.js +7 -0
  253. package/daemon/dist/domain/errors.js.map +1 -1
  254. package/daemon/dist/domain/execution-view.d.ts.map +1 -1
  255. package/daemon/dist/domain/execution-view.js +17 -4
  256. package/daemon/dist/domain/execution-view.js.map +1 -1
  257. package/daemon/dist/domain/existing-rig-restore.d.ts +2 -0
  258. package/daemon/dist/domain/existing-rig-restore.d.ts.map +1 -1
  259. package/daemon/dist/domain/existing-rig-restore.js +1 -0
  260. package/daemon/dist/domain/existing-rig-restore.js.map +1 -1
  261. package/daemon/dist/domain/gateway/operator-delivery-engine.d.ts.map +1 -1
  262. package/daemon/dist/domain/gateway/operator-delivery-engine.js +107 -3
  263. package/daemon/dist/domain/gateway/operator-delivery-engine.js.map +1 -1
  264. package/daemon/dist/domain/gateway/participants.d.ts +2 -0
  265. package/daemon/dist/domain/gateway/participants.d.ts.map +1 -1
  266. package/daemon/dist/domain/gateway/participants.js +5 -1
  267. package/daemon/dist/domain/gateway/participants.js.map +1 -1
  268. package/daemon/dist/domain/gateway/slack/capabilities.d.ts +9 -1
  269. package/daemon/dist/domain/gateway/slack/capabilities.d.ts.map +1 -1
  270. package/daemon/dist/domain/gateway/slack/capabilities.js +6 -1
  271. package/daemon/dist/domain/gateway/slack/capabilities.js.map +1 -1
  272. package/daemon/dist/domain/gateway/slack/inbound-admission.js +1 -1
  273. package/daemon/dist/domain/gateway/slack/inbound-admission.js.map +1 -1
  274. package/daemon/dist/domain/gateway/slack/inbound.d.ts +4 -0
  275. package/daemon/dist/domain/gateway/slack/inbound.d.ts.map +1 -1
  276. package/daemon/dist/domain/gateway/slack/inbound.js +15 -1
  277. package/daemon/dist/domain/gateway/slack/inbound.js.map +1 -1
  278. package/daemon/dist/domain/gateway/slack/manifest.d.ts +5 -1
  279. package/daemon/dist/domain/gateway/slack/manifest.d.ts.map +1 -1
  280. package/daemon/dist/domain/gateway/slack/manifest.js +12 -3
  281. package/daemon/dist/domain/gateway/slack/manifest.js.map +1 -1
  282. package/daemon/dist/domain/gateway/slack/message.d.ts +2 -0
  283. package/daemon/dist/domain/gateway/slack/message.d.ts.map +1 -1
  284. package/daemon/dist/domain/gateway/slack/message.js +41 -18
  285. package/daemon/dist/domain/gateway/slack/message.js.map +1 -1
  286. package/daemon/dist/domain/gateway/slack/queue-access.d.ts +2 -0
  287. package/daemon/dist/domain/gateway/slack/queue-access.d.ts.map +1 -1
  288. package/daemon/dist/domain/gateway/slack/queue-access.js +1 -0
  289. package/daemon/dist/domain/gateway/slack/queue-access.js.map +1 -1
  290. package/daemon/dist/domain/gateway/slack/settled-asks.d.ts.map +1 -1
  291. package/daemon/dist/domain/gateway/slack/settled-asks.js +6 -5
  292. package/daemon/dist/domain/gateway/slack/settled-asks.js.map +1 -1
  293. package/daemon/dist/domain/gateway/slack/slack-api.d.ts +1 -0
  294. package/daemon/dist/domain/gateway/slack/slack-api.d.ts.map +1 -1
  295. package/daemon/dist/domain/gateway/slack/slack-api.js +7 -2
  296. package/daemon/dist/domain/gateway/slack/slack-api.js.map +1 -1
  297. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts +1 -0
  298. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts.map +1 -1
  299. package/daemon/dist/domain/gateway/slack/slack-delivery.js +2 -0
  300. package/daemon/dist/domain/gateway/slack/slack-delivery.js.map +1 -1
  301. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts +4 -0
  302. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
  303. package/daemon/dist/domain/gateway/slack/slack-subsystem.js +26 -2
  304. package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
  305. package/daemon/dist/domain/harness-not-started-notice.d.ts +36 -0
  306. package/daemon/dist/domain/harness-not-started-notice.d.ts.map +1 -0
  307. package/daemon/dist/domain/harness-not-started-notice.js +81 -0
  308. package/daemon/dist/domain/harness-not-started-notice.js.map +1 -0
  309. package/daemon/dist/domain/hook-bridge.d.ts +345 -0
  310. package/daemon/dist/domain/hook-bridge.d.ts.map +1 -0
  311. package/daemon/dist/domain/hook-bridge.js +547 -0
  312. package/daemon/dist/domain/hook-bridge.js.map +1 -0
  313. package/daemon/dist/domain/hosted-wake.d.ts +9 -0
  314. package/daemon/dist/domain/hosted-wake.d.ts.map +1 -1
  315. package/daemon/dist/domain/hosted-wake.js +45 -6
  316. package/daemon/dist/domain/hosted-wake.js.map +1 -1
  317. package/daemon/dist/domain/hot-potato-enforcer.d.ts +1 -1
  318. package/daemon/dist/domain/human-ask-attention.d.ts +10 -0
  319. package/daemon/dist/domain/human-ask-attention.d.ts.map +1 -0
  320. package/daemon/dist/domain/human-ask-attention.js +22 -0
  321. package/daemon/dist/domain/human-ask-attention.js.map +1 -0
  322. package/daemon/dist/domain/input-read-diagnostic.js +1 -1
  323. package/daemon/dist/domain/input-read-diagnostic.js.map +1 -1
  324. package/daemon/dist/domain/instance-initialization.d.ts +2 -0
  325. package/daemon/dist/domain/instance-initialization.d.ts.map +1 -1
  326. package/daemon/dist/domain/instance-initialization.js +2 -1
  327. package/daemon/dist/domain/instance-initialization.js.map +1 -1
  328. package/daemon/dist/domain/member-connection.d.ts +14 -0
  329. package/daemon/dist/domain/member-connection.d.ts.map +1 -0
  330. package/daemon/dist/domain/member-connection.js +34 -0
  331. package/daemon/dist/domain/member-connection.js.map +1 -0
  332. package/daemon/dist/domain/mission-control/mission-control-action-log.d.ts +4 -0
  333. package/daemon/dist/domain/mission-control/mission-control-action-log.d.ts.map +1 -1
  334. package/daemon/dist/domain/mission-control/mission-control-action-log.js +8 -1
  335. package/daemon/dist/domain/mission-control/mission-control-action-log.js.map +1 -1
  336. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts +10 -0
  337. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
  338. package/daemon/dist/domain/mission-control/mission-control-write-contract.js +64 -12
  339. package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
  340. package/daemon/dist/domain/model-divergence/current-model-reader.d.ts +3 -1
  341. package/daemon/dist/domain/model-divergence/current-model-reader.d.ts.map +1 -1
  342. package/daemon/dist/domain/model-divergence/current-model-reader.js +32 -7
  343. package/daemon/dist/domain/model-divergence/current-model-reader.js.map +1 -1
  344. package/daemon/dist/domain/native-continuation-notice.d.ts +16 -0
  345. package/daemon/dist/domain/native-continuation-notice.d.ts.map +1 -0
  346. package/daemon/dist/domain/native-continuation-notice.js +79 -0
  347. package/daemon/dist/domain/native-continuation-notice.js.map +1 -0
  348. package/daemon/dist/domain/native-permission-store.d.ts +6 -2
  349. package/daemon/dist/domain/native-permission-store.d.ts.map +1 -1
  350. package/daemon/dist/domain/native-permission-store.js +12 -5
  351. package/daemon/dist/domain/native-permission-store.js.map +1 -1
  352. package/daemon/dist/domain/native-process-lineage.d.ts +16 -0
  353. package/daemon/dist/domain/native-process-lineage.d.ts.map +1 -1
  354. package/daemon/dist/domain/native-process-lineage.js +48 -3
  355. package/daemon/dist/domain/native-process-lineage.js.map +1 -1
  356. package/daemon/dist/domain/native-resume-probe.d.ts +5 -0
  357. package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
  358. package/daemon/dist/domain/native-resume-probe.js +94 -10
  359. package/daemon/dist/domain/native-resume-probe.js.map +1 -1
  360. package/daemon/dist/domain/network/network-connector.d.ts.map +1 -1
  361. package/daemon/dist/domain/network/network-connector.js +11 -2
  362. package/daemon/dist/domain/network/network-connector.js.map +1 -1
  363. package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
  364. package/daemon/dist/domain/node-inventory.js +55 -6
  365. package/daemon/dist/domain/node-inventory.js.map +1 -1
  366. package/daemon/dist/domain/node-launcher.d.ts +14 -0
  367. package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
  368. package/daemon/dist/domain/node-launcher.js +35 -6
  369. package/daemon/dist/domain/node-launcher.js.map +1 -1
  370. package/daemon/dist/domain/outbox-handler.d.ts +69 -1
  371. package/daemon/dist/domain/outbox-handler.d.ts.map +1 -1
  372. package/daemon/dist/domain/outbox-handler.js +337 -3
  373. package/daemon/dist/domain/outbox-handler.js.map +1 -1
  374. package/daemon/dist/domain/park-wake-text.d.ts +18 -0
  375. package/daemon/dist/domain/park-wake-text.d.ts.map +1 -1
  376. package/daemon/dist/domain/park-wake-text.js +44 -0
  377. package/daemon/dist/domain/park-wake-text.js.map +1 -1
  378. package/daemon/dist/domain/parked-query.d.ts.map +1 -1
  379. package/daemon/dist/domain/parked-query.js +3 -1
  380. package/daemon/dist/domain/parked-query.js.map +1 -1
  381. package/daemon/dist/domain/permission-account.d.ts +28 -1
  382. package/daemon/dist/domain/permission-account.d.ts.map +1 -1
  383. package/daemon/dist/domain/permission-account.js +55 -11
  384. package/daemon/dist/domain/permission-account.js.map +1 -1
  385. package/daemon/dist/domain/permission-drift.d.ts +2 -0
  386. package/daemon/dist/domain/permission-drift.d.ts.map +1 -1
  387. package/daemon/dist/domain/permission-drift.js.map +1 -1
  388. package/daemon/dist/domain/pi-compaction-request-store.d.ts +16 -0
  389. package/daemon/dist/domain/pi-compaction-request-store.d.ts.map +1 -0
  390. package/daemon/dist/domain/pi-compaction-request-store.js +40 -0
  391. package/daemon/dist/domain/pi-compaction-request-store.js.map +1 -0
  392. package/daemon/dist/domain/pi-compaction-service.d.ts +82 -0
  393. package/daemon/dist/domain/pi-compaction-service.d.ts.map +1 -0
  394. package/daemon/dist/domain/pi-compaction-service.js +229 -0
  395. package/daemon/dist/domain/pi-compaction-service.js.map +1 -0
  396. package/daemon/dist/domain/policies/idle-gate-qitem.d.ts +3 -0
  397. package/daemon/dist/domain/policies/idle-gate-qitem.d.ts.map +1 -1
  398. package/daemon/dist/domain/policies/idle-gate-qitem.js +15 -0
  399. package/daemon/dist/domain/policies/idle-gate-qitem.js.map +1 -1
  400. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts +6 -1
  401. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts.map +1 -1
  402. package/daemon/dist/domain/policies/parked-owner-consumer.js +28 -1
  403. package/daemon/dist/domain/policies/parked-owner-consumer.js.map +1 -1
  404. package/daemon/dist/domain/process-limits.d.ts +47 -0
  405. package/daemon/dist/domain/process-limits.d.ts.map +1 -0
  406. package/daemon/dist/domain/process-limits.js +123 -0
  407. package/daemon/dist/domain/process-limits.js.map +1 -0
  408. package/daemon/dist/domain/process-table.d.ts +24 -0
  409. package/daemon/dist/domain/process-table.d.ts.map +1 -1
  410. package/daemon/dist/domain/process-table.js +60 -4
  411. package/daemon/dist/domain/process-table.js.map +1 -1
  412. package/daemon/dist/domain/proof/judgments.d.ts +7 -0
  413. package/daemon/dist/domain/proof/judgments.d.ts.map +1 -1
  414. package/daemon/dist/domain/proof/judgments.js +27 -1
  415. package/daemon/dist/domain/proof/judgments.js.map +1 -1
  416. package/daemon/dist/domain/ps-projection.d.ts +2 -1
  417. package/daemon/dist/domain/ps-projection.d.ts.map +1 -1
  418. package/daemon/dist/domain/ps-projection.js +6 -1
  419. package/daemon/dist/domain/ps-projection.js.map +1 -1
  420. package/daemon/dist/domain/queue-erasure.d.ts +11 -6
  421. package/daemon/dist/domain/queue-erasure.d.ts.map +1 -1
  422. package/daemon/dist/domain/queue-erasure.js +47 -21
  423. package/daemon/dist/domain/queue-erasure.js.map +1 -1
  424. package/daemon/dist/domain/queue-repository.d.ts +122 -21
  425. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  426. package/daemon/dist/domain/queue-repository.js +448 -101
  427. package/daemon/dist/domain/queue-repository.js.map +1 -1
  428. package/daemon/dist/domain/queue-stuck-sweep.d.ts +5 -0
  429. package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
  430. package/daemon/dist/domain/queue-stuck-sweep.js +74 -13
  431. package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
  432. package/daemon/dist/domain/queue-transition-log.d.ts +5 -3
  433. package/daemon/dist/domain/queue-transition-log.d.ts.map +1 -1
  434. package/daemon/dist/domain/queue-transition-log.js +9 -6
  435. package/daemon/dist/domain/queue-transition-log.js.map +1 -1
  436. package/daemon/dist/domain/queue-waiting.d.ts.map +1 -1
  437. package/daemon/dist/domain/queue-waiting.js +28 -3
  438. package/daemon/dist/domain/queue-waiting.js.map +1 -1
  439. package/daemon/dist/domain/queue-wake-ladder.d.ts +20 -0
  440. package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
  441. package/daemon/dist/domain/queue-wake-ladder.js +264 -25
  442. package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
  443. package/daemon/dist/domain/queue-wake-repository.d.ts +10 -1
  444. package/daemon/dist/domain/queue-wake-repository.d.ts.map +1 -1
  445. package/daemon/dist/domain/queue-wake-repository.js +79 -12
  446. package/daemon/dist/domain/queue-wake-repository.js.map +1 -1
  447. package/daemon/dist/domain/reconciler.d.ts +18 -2
  448. package/daemon/dist/domain/reconciler.d.ts.map +1 -1
  449. package/daemon/dist/domain/reconciler.js +40 -0
  450. package/daemon/dist/domain/reconciler.js.map +1 -1
  451. package/daemon/dist/domain/restore-attempt-receipt.d.ts.map +1 -1
  452. package/daemon/dist/domain/restore-attempt-receipt.js +3 -2
  453. package/daemon/dist/domain/restore-attempt-receipt.js.map +1 -1
  454. package/daemon/dist/domain/restore-check-service.d.ts +10 -0
  455. package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
  456. package/daemon/dist/domain/restore-check-service.js +76 -3
  457. package/daemon/dist/domain/restore-check-service.js.map +1 -1
  458. package/daemon/dist/domain/restore-orchestrator.d.ts +65 -3
  459. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  460. package/daemon/dist/domain/restore-orchestrator.js +311 -55
  461. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  462. package/daemon/dist/domain/restore-plan-preview.d.ts +28 -1
  463. package/daemon/dist/domain/restore-plan-preview.d.ts.map +1 -1
  464. package/daemon/dist/domain/restore-plan-preview.js +17 -5
  465. package/daemon/dist/domain/restore-plan-preview.js.map +1 -1
  466. package/daemon/dist/domain/restore-preconditions.d.ts +24 -0
  467. package/daemon/dist/domain/restore-preconditions.d.ts.map +1 -1
  468. package/daemon/dist/domain/restore-preconditions.js +61 -1
  469. package/daemon/dist/domain/restore-preconditions.js.map +1 -1
  470. package/daemon/dist/domain/restore-topology.d.ts +7 -1
  471. package/daemon/dist/domain/restore-topology.d.ts.map +1 -1
  472. package/daemon/dist/domain/restore-topology.js +21 -0
  473. package/daemon/dist/domain/restore-topology.js.map +1 -1
  474. package/daemon/dist/domain/resume-metadata-refresher.d.ts +2 -3
  475. package/daemon/dist/domain/resume-metadata-refresher.d.ts.map +1 -1
  476. package/daemon/dist/domain/resume-metadata-refresher.js +6 -25
  477. package/daemon/dist/domain/resume-metadata-refresher.js.map +1 -1
  478. package/daemon/dist/domain/resume-token-validation.d.ts +3 -1
  479. package/daemon/dist/domain/resume-token-validation.d.ts.map +1 -1
  480. package/daemon/dist/domain/resume-token-validation.js +6 -3
  481. package/daemon/dist/domain/resume-token-validation.js.map +1 -1
  482. package/daemon/dist/domain/return-route.d.ts +73 -0
  483. package/daemon/dist/domain/return-route.d.ts.map +1 -0
  484. package/daemon/dist/domain/return-route.js +124 -0
  485. package/daemon/dist/domain/return-route.js.map +1 -0
  486. package/daemon/dist/domain/rig-expansion-service.js +1 -1
  487. package/daemon/dist/domain/rig-expansion-service.js.map +1 -1
  488. package/daemon/dist/domain/rig-repository.d.ts +12 -0
  489. package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
  490. package/daemon/dist/domain/rig-repository.js +74 -0
  491. package/daemon/dist/domain/rig-repository.js.map +1 -1
  492. package/daemon/dist/domain/rig-teardown.d.ts +20 -5
  493. package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
  494. package/daemon/dist/domain/rig-teardown.js +105 -22
  495. package/daemon/dist/domain/rig-teardown.js.map +1 -1
  496. package/daemon/dist/domain/rigspec-codec.d.ts.map +1 -1
  497. package/daemon/dist/domain/rigspec-codec.js +9 -0
  498. package/daemon/dist/domain/rigspec-codec.js.map +1 -1
  499. package/daemon/dist/domain/rigspec-exporter.d.ts +6 -0
  500. package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
  501. package/daemon/dist/domain/rigspec-exporter.js +30 -0
  502. package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
  503. package/daemon/dist/domain/rigspec-instantiator.d.ts +27 -2
  504. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  505. package/daemon/dist/domain/rigspec-instantiator.js +95 -26
  506. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  507. package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
  508. package/daemon/dist/domain/rigspec-schema.js +44 -1
  509. package/daemon/dist/domain/rigspec-schema.js.map +1 -1
  510. package/daemon/dist/domain/rosters.d.ts +23 -0
  511. package/daemon/dist/domain/rosters.d.ts.map +1 -1
  512. package/daemon/dist/domain/rosters.js +37 -5
  513. package/daemon/dist/domain/rosters.js.map +1 -1
  514. package/daemon/dist/domain/runner-channel.d.ts +65 -0
  515. package/daemon/dist/domain/runner-channel.d.ts.map +1 -0
  516. package/daemon/dist/domain/runner-channel.js +348 -0
  517. package/daemon/dist/domain/runner-channel.js.map +1 -0
  518. package/daemon/dist/domain/runner-grant-launch.js +2 -2
  519. package/daemon/dist/domain/runner-permissions.d.ts +26 -3
  520. package/daemon/dist/domain/runner-permissions.d.ts.map +1 -1
  521. package/daemon/dist/domain/runner-permissions.js +160 -39
  522. package/daemon/dist/domain/runner-permissions.js.map +1 -1
  523. package/daemon/dist/domain/runtime-adapter.d.ts +2 -0
  524. package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
  525. package/daemon/dist/domain/runtime-adapter.js.map +1 -1
  526. package/daemon/dist/domain/runtime-switch-materials.d.ts.map +1 -1
  527. package/daemon/dist/domain/runtime-switch-materials.js +4 -3
  528. package/daemon/dist/domain/runtime-switch-materials.js.map +1 -1
  529. package/daemon/dist/domain/scope/mission-parent.d.ts +19 -0
  530. package/daemon/dist/domain/scope/mission-parent.d.ts.map +1 -0
  531. package/daemon/dist/domain/scope/mission-parent.js +134 -0
  532. package/daemon/dist/domain/scope/mission-parent.js.map +1 -0
  533. package/daemon/dist/domain/scope/scope-audit.d.ts.map +1 -1
  534. package/daemon/dist/domain/scope/scope-audit.js +63 -3
  535. package/daemon/dist/domain/scope/scope-audit.js.map +1 -1
  536. package/daemon/dist/domain/scope/types.d.ts +3 -1
  537. package/daemon/dist/domain/scope/types.d.ts.map +1 -1
  538. package/daemon/dist/domain/scope/types.js +5 -1
  539. package/daemon/dist/domain/scope/types.js.map +1 -1
  540. package/daemon/dist/domain/seat-attention-reconciler.d.ts +6 -4
  541. package/daemon/dist/domain/seat-attention-reconciler.d.ts.map +1 -1
  542. package/daemon/dist/domain/seat-attention-reconciler.js +17 -10
  543. package/daemon/dist/domain/seat-attention-reconciler.js.map +1 -1
  544. package/daemon/dist/domain/seat-delivery-guard.d.ts +14 -2
  545. package/daemon/dist/domain/seat-delivery-guard.d.ts.map +1 -1
  546. package/daemon/dist/domain/seat-delivery-guard.js +55 -15
  547. package/daemon/dist/domain/seat-delivery-guard.js.map +1 -1
  548. package/daemon/dist/domain/seat-handover-service.d.ts +27 -4
  549. package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
  550. package/daemon/dist/domain/seat-handover-service.js +210 -65
  551. package/daemon/dist/domain/seat-handover-service.js.map +1 -1
  552. package/daemon/dist/domain/seat-identity-reconciler.d.ts +12 -4
  553. package/daemon/dist/domain/seat-identity-reconciler.d.ts.map +1 -1
  554. package/daemon/dist/domain/seat-identity-reconciler.js +92 -17
  555. package/daemon/dist/domain/seat-identity-reconciler.js.map +1 -1
  556. package/daemon/dist/domain/seat-lifecycle-service.d.ts +31 -6
  557. package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
  558. package/daemon/dist/domain/seat-lifecycle-service.js +172 -24
  559. package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
  560. package/daemon/dist/domain/seat-restart-in-place.d.ts +9 -2
  561. package/daemon/dist/domain/seat-restart-in-place.d.ts.map +1 -1
  562. package/daemon/dist/domain/seat-restart-in-place.js +38 -3
  563. package/daemon/dist/domain/seat-restart-in-place.js.map +1 -1
  564. package/daemon/dist/domain/seat-runtime-switch-service.d.ts +4 -0
  565. package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -1
  566. package/daemon/dist/domain/seat-runtime-switch-service.js +11 -3
  567. package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
  568. package/daemon/dist/domain/seat-skill-apply.d.ts +1 -1
  569. package/daemon/dist/domain/seat-skill-apply.d.ts.map +1 -1
  570. package/daemon/dist/domain/seat-skill-apply.js +3 -2
  571. package/daemon/dist/domain/seat-skill-apply.js.map +1 -1
  572. package/daemon/dist/domain/seat-status-service.d.ts +4 -0
  573. package/daemon/dist/domain/seat-status-service.d.ts.map +1 -1
  574. package/daemon/dist/domain/seat-status-service.js +31 -6
  575. package/daemon/dist/domain/seat-status-service.js.map +1 -1
  576. package/daemon/dist/domain/session-registry.d.ts +5 -1
  577. package/daemon/dist/domain/session-registry.d.ts.map +1 -1
  578. package/daemon/dist/domain/session-registry.js +12 -1
  579. package/daemon/dist/domain/session-registry.js.map +1 -1
  580. package/daemon/dist/domain/session-transport.d.ts +56 -4
  581. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  582. package/daemon/dist/domain/session-transport.js +344 -18
  583. package/daemon/dist/domain/session-transport.js.map +1 -1
  584. package/daemon/dist/domain/shared-conversation.d.ts +58 -0
  585. package/daemon/dist/domain/shared-conversation.d.ts.map +1 -0
  586. package/daemon/dist/domain/shared-conversation.js +98 -0
  587. package/daemon/dist/domain/shared-conversation.js.map +1 -0
  588. package/daemon/dist/domain/shared-history-selection.d.ts.map +1 -1
  589. package/daemon/dist/domain/shared-history-selection.js +9 -5
  590. package/daemon/dist/domain/shared-history-selection.js.map +1 -1
  591. package/daemon/dist/domain/slices/slice-indexer.d.ts +1 -1
  592. package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -1
  593. package/daemon/dist/domain/slices/slice-indexer.js +4 -0
  594. package/daemon/dist/domain/slices/slice-indexer.js.map +1 -1
  595. package/daemon/dist/domain/startup-orchestrator.d.ts +1 -0
  596. package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
  597. package/daemon/dist/domain/startup-orchestrator.js +6 -4
  598. package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
  599. package/daemon/dist/domain/startup-phase-timing.d.ts +19 -0
  600. package/daemon/dist/domain/startup-phase-timing.d.ts.map +1 -0
  601. package/daemon/dist/domain/startup-phase-timing.js +23 -0
  602. package/daemon/dist/domain/startup-phase-timing.js.map +1 -0
  603. package/daemon/dist/domain/successor-session-launcher.d.ts +9 -0
  604. package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
  605. package/daemon/dist/domain/successor-session-launcher.js +33 -10
  606. package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
  607. package/daemon/dist/domain/team-operations.d.ts +6 -6
  608. package/daemon/dist/domain/team-operations.d.ts.map +1 -1
  609. package/daemon/dist/domain/team-operations.js +2 -4
  610. package/daemon/dist/domain/team-operations.js.map +1 -1
  611. package/daemon/dist/domain/terminal/herdr-adapter.d.ts +35 -1
  612. package/daemon/dist/domain/terminal/herdr-adapter.d.ts.map +1 -1
  613. package/daemon/dist/domain/terminal/herdr-adapter.js +231 -33
  614. package/daemon/dist/domain/terminal/herdr-adapter.js.map +1 -1
  615. package/daemon/dist/domain/terminal/herdr-app-provider.d.ts +6 -0
  616. package/daemon/dist/domain/terminal/herdr-app-provider.d.ts.map +1 -1
  617. package/daemon/dist/domain/terminal/herdr-app-provider.js +23 -1
  618. package/daemon/dist/domain/terminal/herdr-app-provider.js.map +1 -1
  619. package/daemon/dist/domain/terminal/herdr-sessions.d.ts.map +1 -1
  620. package/daemon/dist/domain/terminal/herdr-sessions.js +2 -1
  621. package/daemon/dist/domain/terminal/herdr-sessions.js.map +1 -1
  622. package/daemon/dist/domain/terminal/rig-viewer-records.d.ts +59 -0
  623. package/daemon/dist/domain/terminal/rig-viewer-records.d.ts.map +1 -0
  624. package/daemon/dist/domain/terminal/rig-viewer-records.js +210 -0
  625. package/daemon/dist/domain/terminal/rig-viewer-records.js.map +1 -0
  626. package/daemon/dist/domain/terminal/terminal-provider.d.ts +2 -0
  627. package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
  628. package/daemon/dist/domain/terminal/terminal-service.d.ts +99 -4
  629. package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
  630. package/daemon/dist/domain/terminal/terminal-service.js +556 -36
  631. package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
  632. package/daemon/dist/domain/terminal/tile-layout.js +1 -1
  633. package/daemon/dist/domain/terminal/tile-layout.js.map +1 -1
  634. package/daemon/dist/domain/terminal/tmux-viewer-guard.d.ts +25 -0
  635. package/daemon/dist/domain/terminal/tmux-viewer-guard.d.ts.map +1 -0
  636. package/daemon/dist/domain/terminal/tmux-viewer-guard.js +70 -0
  637. package/daemon/dist/domain/terminal/tmux-viewer-guard.js.map +1 -0
  638. package/daemon/dist/domain/terminal-policy.js +1 -1
  639. package/daemon/dist/domain/terminal-policy.js.map +1 -1
  640. package/daemon/dist/domain/transcript-grep-worker.d.ts +2 -0
  641. package/daemon/dist/domain/transcript-grep-worker.d.ts.map +1 -0
  642. package/daemon/dist/domain/transcript-grep-worker.js +108 -0
  643. package/daemon/dist/domain/transcript-grep-worker.js.map +1 -0
  644. package/daemon/dist/domain/transcript-grep.d.ts +26 -0
  645. package/daemon/dist/domain/transcript-grep.d.ts.map +1 -0
  646. package/daemon/dist/domain/transcript-grep.js +90 -0
  647. package/daemon/dist/domain/transcript-grep.js.map +1 -0
  648. package/daemon/dist/domain/transcript-store.d.ts +8 -2
  649. package/daemon/dist/domain/transcript-store.d.ts.map +1 -1
  650. package/daemon/dist/domain/transcript-store.js +10 -60
  651. package/daemon/dist/domain/transcript-store.js.map +1 -1
  652. package/daemon/dist/domain/types.d.ts +149 -5
  653. package/daemon/dist/domain/types.d.ts.map +1 -1
  654. package/daemon/dist/domain/types.js.map +1 -1
  655. package/daemon/dist/domain/watchdog-delivery-receipts.d.ts +4 -0
  656. package/daemon/dist/domain/watchdog-delivery-receipts.d.ts.map +1 -1
  657. package/daemon/dist/domain/watchdog-delivery-receipts.js +35 -2
  658. package/daemon/dist/domain/watchdog-delivery-receipts.js.map +1 -1
  659. package/daemon/dist/domain/watchdog-delivery.d.ts +45 -1
  660. package/daemon/dist/domain/watchdog-delivery.d.ts.map +1 -1
  661. package/daemon/dist/domain/watchdog-delivery.js +66 -5
  662. package/daemon/dist/domain/watchdog-delivery.js.map +1 -1
  663. package/daemon/dist/domain/watchdog-history-log.d.ts +12 -0
  664. package/daemon/dist/domain/watchdog-history-log.d.ts.map +1 -1
  665. package/daemon/dist/domain/watchdog-history-log.js +19 -1
  666. package/daemon/dist/domain/watchdog-history-log.js.map +1 -1
  667. package/daemon/dist/domain/watchdog-jobs-repository.d.ts +32 -0
  668. package/daemon/dist/domain/watchdog-jobs-repository.d.ts.map +1 -1
  669. package/daemon/dist/domain/watchdog-jobs-repository.js +79 -0
  670. package/daemon/dist/domain/watchdog-jobs-repository.js.map +1 -1
  671. package/daemon/dist/domain/watchdog-policy-engine.d.ts +22 -3
  672. package/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -1
  673. package/daemon/dist/domain/watchdog-policy-engine.js +33 -9
  674. package/daemon/dist/domain/watchdog-policy-engine.js.map +1 -1
  675. package/daemon/dist/domain/workflow-projector.js +1 -1
  676. package/daemon/dist/domain/workflow-projector.js.map +1 -1
  677. package/daemon/dist/domain/workflow-runtime.d.ts +13 -1
  678. package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
  679. package/daemon/dist/domain/workflow-runtime.js +68 -9
  680. package/daemon/dist/domain/workflow-runtime.js.map +1 -1
  681. package/daemon/dist/domain/workflow-step-trail-log.d.ts +2 -2
  682. package/daemon/dist/domain/workflow-step-trail-log.d.ts.map +1 -1
  683. package/daemon/dist/domain/workflow-step-trail-log.js.map +1 -1
  684. package/daemon/dist/domain/workflow-types.d.ts +3 -1
  685. package/daemon/dist/domain/workflow-types.d.ts.map +1 -1
  686. package/daemon/dist/domain/workflow-types.js.map +1 -1
  687. package/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts +7 -1
  688. package/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts.map +1 -1
  689. package/daemon/dist/domain/workspace/default-workspace-scaffold.js +35 -7
  690. package/daemon/dist/domain/workspace/default-workspace-scaffold.js.map +1 -1
  691. package/daemon/dist/gateway-slack-surface.d.ts +2 -2
  692. package/daemon/dist/gateway-slack-surface.d.ts.map +1 -1
  693. package/daemon/dist/gateway-slack-surface.js +1 -1
  694. package/daemon/dist/gateway-slack-surface.js.map +1 -1
  695. package/daemon/dist/index.d.ts.map +1 -1
  696. package/daemon/dist/index.js +17 -2
  697. package/daemon/dist/index.js.map +1 -1
  698. package/daemon/dist/lib/pane-envelope.d.ts +3 -0
  699. package/daemon/dist/lib/pane-envelope.d.ts.map +1 -1
  700. package/daemon/dist/lib/pane-envelope.js +3 -1
  701. package/daemon/dist/lib/pane-envelope.js.map +1 -1
  702. package/daemon/dist/mission-parent-surface.d.ts +2 -0
  703. package/daemon/dist/mission-parent-surface.d.ts.map +1 -0
  704. package/daemon/dist/mission-parent-surface.js +2 -0
  705. package/daemon/dist/mission-parent-surface.js.map +1 -0
  706. package/daemon/dist/routes/activity.d.ts +18 -1
  707. package/daemon/dist/routes/activity.d.ts.map +1 -1
  708. package/daemon/dist/routes/activity.js +150 -9
  709. package/daemon/dist/routes/activity.js.map +1 -1
  710. package/daemon/dist/routes/agent-images.d.ts.map +1 -1
  711. package/daemon/dist/routes/agent-images.js +6 -1
  712. package/daemon/dist/routes/agent-images.js.map +1 -1
  713. package/daemon/dist/routes/attention.d.ts.map +1 -1
  714. package/daemon/dist/routes/attention.js +194 -176
  715. package/daemon/dist/routes/attention.js.map +1 -1
  716. package/daemon/dist/routes/compaction.d.ts.map +1 -1
  717. package/daemon/dist/routes/compaction.js +46 -7
  718. package/daemon/dist/routes/compaction.js.map +1 -1
  719. package/daemon/dist/routes/core-app.d.ts +10 -0
  720. package/daemon/dist/routes/core-app.d.ts.map +1 -0
  721. package/daemon/dist/routes/core-app.js +175 -0
  722. package/daemon/dist/routes/core-app.js.map +1 -0
  723. package/daemon/dist/routes/hook-bridge.d.ts +3 -0
  724. package/daemon/dist/routes/hook-bridge.d.ts.map +1 -0
  725. package/daemon/dist/routes/hook-bridge.js +158 -0
  726. package/daemon/dist/routes/hook-bridge.js.map +1 -0
  727. package/daemon/dist/routes/missions.d.ts.map +1 -1
  728. package/daemon/dist/routes/missions.js +14 -2
  729. package/daemon/dist/routes/missions.js.map +1 -1
  730. package/daemon/dist/routes/queue.d.ts +4 -1
  731. package/daemon/dist/routes/queue.d.ts.map +1 -1
  732. package/daemon/dist/routes/queue.js +239 -38
  733. package/daemon/dist/routes/queue.js.map +1 -1
  734. package/daemon/dist/routes/require-sender-identity.d.ts +4 -3
  735. package/daemon/dist/routes/require-sender-identity.d.ts.map +1 -1
  736. package/daemon/dist/routes/require-sender-identity.js.map +1 -1
  737. package/daemon/dist/routes/restore-check.d.ts.map +1 -1
  738. package/daemon/dist/routes/restore-check.js +1 -0
  739. package/daemon/dist/routes/restore-check.js.map +1 -1
  740. package/daemon/dist/routes/rigspec.d.ts.map +1 -1
  741. package/daemon/dist/routes/rigspec.js +24 -4
  742. package/daemon/dist/routes/rigspec.js.map +1 -1
  743. package/daemon/dist/routes/scope-audit.d.ts.map +1 -1
  744. package/daemon/dist/routes/scope-audit.js +7 -1
  745. package/daemon/dist/routes/scope-audit.js.map +1 -1
  746. package/daemon/dist/routes/seat.d.ts.map +1 -1
  747. package/daemon/dist/routes/seat.js +133 -6
  748. package/daemon/dist/routes/seat.js.map +1 -1
  749. package/daemon/dist/routes/sessions.js +14 -3
  750. package/daemon/dist/routes/sessions.js.map +1 -1
  751. package/daemon/dist/routes/slices.d.ts.map +1 -1
  752. package/daemon/dist/routes/slices.js +21 -2
  753. package/daemon/dist/routes/slices.js.map +1 -1
  754. package/daemon/dist/routes/startup.js +9 -2
  755. package/daemon/dist/routes/startup.js.map +1 -1
  756. package/daemon/dist/routes/terminal.d.ts.map +1 -1
  757. package/daemon/dist/routes/terminal.js +47 -6
  758. package/daemon/dist/routes/terminal.js.map +1 -1
  759. package/daemon/dist/routes/transcripts.d.ts.map +1 -1
  760. package/daemon/dist/routes/transcripts.js +16 -1
  761. package/daemon/dist/routes/transcripts.js.map +1 -1
  762. package/daemon/dist/routes/up.d.ts.map +1 -1
  763. package/daemon/dist/routes/up.js +14 -4
  764. package/daemon/dist/routes/up.js.map +1 -1
  765. package/daemon/dist/routes/watchdog.d.ts.map +1 -1
  766. package/daemon/dist/routes/watchdog.js +21 -3
  767. package/daemon/dist/routes/watchdog.js.map +1 -1
  768. package/daemon/dist/routes/workflow.d.ts.map +1 -1
  769. package/daemon/dist/routes/workflow.js +5 -0
  770. package/daemon/dist/routes/workflow.js.map +1 -1
  771. package/daemon/dist/server.d.ts +5 -0
  772. package/daemon/dist/server.d.ts.map +1 -1
  773. package/daemon/dist/server.js +22 -0
  774. package/daemon/dist/server.js.map +1 -1
  775. package/daemon/dist/startup.d.ts.map +1 -1
  776. package/daemon/dist/startup.js +140 -48
  777. package/daemon/dist/startup.js.map +1 -1
  778. package/daemon/dist/terminal-viewer-guard-surface.d.ts +2 -0
  779. package/daemon/dist/terminal-viewer-guard-surface.d.ts.map +1 -0
  780. package/daemon/dist/terminal-viewer-guard-surface.js +2 -0
  781. package/daemon/dist/terminal-viewer-guard-surface.js.map +1 -0
  782. package/daemon/docs/reference/agent-startup-guide.md +5 -1
  783. package/daemon/docs/reference/claude-status-line.md +3 -2
  784. package/daemon/docs/reference/community-harness-examples/cursor/openrig-cursor-launch +6 -0
  785. package/daemon/docs/reference/community-harness-examples/dsh/README.md +8 -0
  786. package/daemon/docs/reference/community-harness-examples/dsh/openrig-dsh-runner.mjs +310 -20
  787. package/daemon/docs/reference/community-harness-examples/hermes/openrig-hermes-launch +6 -0
  788. package/daemon/docs/reference/community-harness-examples/openclaw/openrig-openclaw-launch +6 -0
  789. package/daemon/docs/reference/community-harness-examples/openshell/README.md +2 -0
  790. package/daemon/docs/reference/community-harness-examples/pi-tui/openrig-pi-tui-launch +6 -0
  791. package/daemon/docs/reference/community-harness-presets.md +7 -4
  792. package/daemon/docs/reference/core-app.md +212 -0
  793. package/daemon/docs/reference/daemon-http-clients.md +67 -12
  794. package/daemon/docs/reference/getting-started.md +9 -4
  795. package/daemon/docs/reference/harness-runner-contract.md +140 -4
  796. package/daemon/docs/reference/herdr-app.md +6 -0
  797. package/daemon/docs/reference/hosted-members.md +21 -1
  798. package/daemon/docs/reference/quickstart.md +4 -3
  799. package/daemon/docs/reference/rig-spec.md +197 -1
  800. package/daemon/docs/reference/rosters.md +17 -0
  801. package/daemon/docs/reference/sdlc-conventions.md +47 -6
  802. package/daemon/docs/reference/seat-delivery.md +87 -6
  803. package/daemon/docs/reference/slack-app-setup.md +39 -21
  804. package/daemon/docs/reference/terminal-sessions.md +99 -1
  805. package/daemon/docs/reference/whats-new.md +187 -15
  806. package/daemon/specs/agents/shared/skills/core/messaging-the-human/SKILL.md +23 -0
  807. package/daemon/specs/rigs/launch/factory/guidance/lead-first-move.md +27 -5
  808. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +32 -8
  809. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/startup/context.md +1 -1
  810. package/daemon/specs/rigs/launch/kernel/culture/CULTURE.md +12 -0
  811. package/daemon/specs/rigs/launch/starter/guidance/lead-first-move.md +27 -5
  812. package/dist/acp/connector.js +1 -1
  813. package/dist/acp/connector.js.map +1 -1
  814. package/dist/ask-wake.d.ts.map +1 -1
  815. package/dist/ask-wake.js +8 -1
  816. package/dist/ask-wake.js.map +1 -1
  817. package/dist/build-info.js +3 -3
  818. package/dist/cli-error.d.ts.map +1 -1
  819. package/dist/cli-error.js +7 -1
  820. package/dist/cli-error.js.map +1 -1
  821. package/dist/client.d.ts +2 -1
  822. package/dist/client.d.ts.map +1 -1
  823. package/dist/client.js +3 -2
  824. package/dist/client.js.map +1 -1
  825. package/dist/commands/archive.js +1 -1
  826. package/dist/commands/archive.js.map +1 -1
  827. package/dist/commands/ask.d.ts.map +1 -1
  828. package/dist/commands/ask.js +92 -11
  829. package/dist/commands/ask.js.map +1 -1
  830. package/dist/commands/broadcast.js +9 -5
  831. package/dist/commands/broadcast.js.map +1 -1
  832. package/dist/commands/compact.d.ts +3 -4
  833. package/dist/commands/compact.d.ts.map +1 -1
  834. package/dist/commands/compact.js +76 -16
  835. package/dist/commands/compact.js.map +1 -1
  836. package/dist/commands/config-init-workspace.d.ts.map +1 -1
  837. package/dist/commands/config-init-workspace.js +3 -0
  838. package/dist/commands/config-init-workspace.js.map +1 -1
  839. package/dist/commands/daemon.d.ts.map +1 -1
  840. package/dist/commands/daemon.js +7 -0
  841. package/dist/commands/daemon.js.map +1 -1
  842. package/dist/commands/down.d.ts.map +1 -1
  843. package/dist/commands/down.js +8 -1
  844. package/dist/commands/down.js.map +1 -1
  845. package/dist/commands/export.d.ts.map +1 -1
  846. package/dist/commands/export.js +2 -1
  847. package/dist/commands/export.js.map +1 -1
  848. package/dist/commands/fork.d.ts.map +1 -1
  849. package/dist/commands/fork.js +2 -0
  850. package/dist/commands/fork.js.map +1 -1
  851. package/dist/commands/launch.d.ts.map +1 -1
  852. package/dist/commands/launch.js +11 -3
  853. package/dist/commands/launch.js.map +1 -1
  854. package/dist/commands/ps.d.ts +30 -1
  855. package/dist/commands/ps.d.ts.map +1 -1
  856. package/dist/commands/ps.js +85 -6
  857. package/dist/commands/ps.js.map +1 -1
  858. package/dist/commands/queue.d.ts.map +1 -1
  859. package/dist/commands/queue.js +309 -21
  860. package/dist/commands/queue.js.map +1 -1
  861. package/dist/commands/rig.d.ts +2 -0
  862. package/dist/commands/rig.d.ts.map +1 -1
  863. package/dist/commands/rig.js +36 -2
  864. package/dist/commands/rig.js.map +1 -1
  865. package/dist/commands/roster.d.ts +8 -0
  866. package/dist/commands/roster.d.ts.map +1 -1
  867. package/dist/commands/scope.d.ts.map +1 -1
  868. package/dist/commands/scope.js +346 -9
  869. package/dist/commands/scope.js.map +1 -1
  870. package/dist/commands/seat.d.ts.map +1 -1
  871. package/dist/commands/seat.js +213 -12
  872. package/dist/commands/seat.js.map +1 -1
  873. package/dist/commands/send.d.ts +2 -0
  874. package/dist/commands/send.d.ts.map +1 -1
  875. package/dist/commands/send.js +50 -7
  876. package/dist/commands/send.js.map +1 -1
  877. package/dist/commands/setup.js +2 -2
  878. package/dist/commands/setup.js.map +1 -1
  879. package/dist/commands/slack.d.ts +2 -1
  880. package/dist/commands/slack.d.ts.map +1 -1
  881. package/dist/commands/slack.js +38 -2
  882. package/dist/commands/slack.js.map +1 -1
  883. package/dist/commands/terminal.d.ts +56 -0
  884. package/dist/commands/terminal.d.ts.map +1 -1
  885. package/dist/commands/terminal.js +199 -9
  886. package/dist/commands/terminal.js.map +1 -1
  887. package/dist/commands/transcript.js +1 -1
  888. package/dist/commands/transcript.js.map +1 -1
  889. package/dist/commands/unarchive.js +1 -1
  890. package/dist/commands/unarchive.js.map +1 -1
  891. package/dist/commands/up.d.ts.map +1 -1
  892. package/dist/commands/up.js +3 -0
  893. package/dist/commands/up.js.map +1 -1
  894. package/dist/commands/workflow-follow.d.ts +3 -1
  895. package/dist/commands/workflow-follow.d.ts.map +1 -1
  896. package/dist/commands/workflow-follow.js +25 -6
  897. package/dist/commands/workflow-follow.js.map +1 -1
  898. package/dist/commands/workflow-render.d.ts.map +1 -1
  899. package/dist/commands/workflow-render.js +5 -1
  900. package/dist/commands/workflow-render.js.map +1 -1
  901. package/dist/commands/workflow.d.ts.map +1 -1
  902. package/dist/commands/workflow.js +18 -4
  903. package/dist/commands/workflow.js.map +1 -1
  904. package/dist/daemon-lifecycle.d.ts.map +1 -1
  905. package/dist/daemon-lifecycle.js +12 -0
  906. package/dist/daemon-lifecycle.js.map +1 -1
  907. package/dist/lib/model-observation.d.ts.map +1 -1
  908. package/dist/lib/model-observation.js +9 -3
  909. package/dist/lib/model-observation.js.map +1 -1
  910. package/dist/lib/scope/mission-composition.d.ts +1 -0
  911. package/dist/lib/scope/mission-composition.d.ts.map +1 -1
  912. package/dist/lib/scope/mission-composition.js +14 -0
  913. package/dist/lib/scope/mission-composition.js.map +1 -1
  914. package/dist/lib/scope/scope-audit.d.ts.map +1 -1
  915. package/dist/lib/scope/scope-audit.js +63 -3
  916. package/dist/lib/scope/scope-audit.js.map +1 -1
  917. package/dist/lib/scope/scope-fs.d.ts +10 -0
  918. package/dist/lib/scope/scope-fs.d.ts.map +1 -1
  919. package/dist/lib/scope/scope-fs.js +60 -0
  920. package/dist/lib/scope/scope-fs.js.map +1 -1
  921. package/dist/lib/scope/types.d.ts +3 -1
  922. package/dist/lib/scope/types.d.ts.map +1 -1
  923. package/dist/lib/scope/types.js +5 -1
  924. package/dist/lib/scope/types.js.map +1 -1
  925. package/dist/local-db.d.ts +5 -0
  926. package/dist/local-db.d.ts.map +1 -0
  927. package/dist/local-db.js +23 -0
  928. package/dist/local-db.js.map +1 -0
  929. package/dist/local-origin.d.ts.map +1 -1
  930. package/dist/local-origin.js +2 -17
  931. package/dist/local-origin.js.map +1 -1
  932. package/dist/mcp-server.d.ts.map +1 -1
  933. package/dist/mcp-server.js +138 -24
  934. package/dist/mcp-server.js.map +1 -1
  935. package/dist/restore-packet/packet-writer.d.ts.map +1 -1
  936. package/dist/restore-packet/packet-writer.js +8 -5
  937. package/dist/restore-packet/packet-writer.js.map +1 -1
  938. package/dist/sender-identity.d.ts +18 -6
  939. package/dist/sender-identity.d.ts.map +1 -1
  940. package/dist/sender-identity.js +67 -7
  941. package/dist/sender-identity.js.map +1 -1
  942. package/dist/terminal-window-rex.d.ts +1 -1
  943. package/dist/terminal-window-rex.d.ts.map +1 -1
  944. package/dist/terminal-window-rex.js +3 -2
  945. package/dist/terminal-window-rex.js.map +1 -1
  946. package/dist/terminal-window.d.ts +2 -1
  947. package/dist/terminal-window.d.ts.map +1 -1
  948. package/dist/terminal-window.js +570 -44
  949. package/dist/terminal-window.js.map +1 -1
  950. package/package.json +1 -1
  951. package/tui/dist/daemon-client.d.ts +4 -0
  952. package/tui/dist/daemon-client.d.ts.map +1 -1
  953. package/tui/dist/daemon-client.js +2 -1
  954. package/tui/dist/daemon-client.js.map +1 -1
  955. package/tui/dist/execution/execution-model.d.ts.map +1 -1
  956. package/tui/dist/execution/execution-model.js +22 -5
  957. package/tui/dist/execution/execution-model.js.map +1 -1
  958. package/tui/dist/hydrate.d.ts.map +1 -1
  959. package/tui/dist/hydrate.js +6 -3
  960. package/tui/dist/hydrate.js.map +1 -1
  961. package/tui/dist/navigator.d.ts +1 -1
  962. package/tui/dist/navigator.d.ts.map +1 -1
  963. package/tui/dist/navigator.js +4 -2
  964. package/tui/dist/navigator.js.map +1 -1
  965. package/tui/dist/pulse/render-pulse.d.ts.map +1 -1
  966. package/tui/dist/pulse/render-pulse.js +7 -14
  967. package/tui/dist/pulse/render-pulse.js.map +1 -1
  968. package/tui/dist/render.d.ts.map +1 -1
  969. package/tui/dist/render.js +29 -21
  970. package/tui/dist/render.js.map +1 -1
  971. package/tui/dist/stylize.d.ts.map +1 -1
  972. package/tui/dist/stylize.js +3 -3
  973. package/tui/dist/stylize.js.map +1 -1
  974. package/tui/dist/terminals/terminal-model.d.ts +1 -0
  975. package/tui/dist/terminals/terminal-model.d.ts.map +1 -1
  976. package/tui/dist/terminals/terminal-model.js +4 -2
  977. package/tui/dist/terminals/terminal-model.js.map +1 -1
  978. package/tui/dist/types.d.ts +1 -0
  979. package/tui/dist/types.d.ts.map +1 -1
  980. package/tui/dist/visual-layout.d.ts +3 -0
  981. package/tui/dist/visual-layout.d.ts.map +1 -1
  982. package/tui/dist/visual-layout.js +17 -0
  983. package/tui/dist/visual-layout.js.map +1 -1
  984. package/ui/dist/assets/{index-BvUEh33d.js → index-B-sMy02c.js} +116 -116
  985. package/ui/dist/assets/{index-BX8TUZ0E.css → index-DiN7RwWg.css} +1 -1
  986. package/ui/dist/index.html +2 -2
@@ -594,7 +594,7 @@ export function createRunnerInput(input, output, onSubmit, pane) {
594
594
  }
595
595
  pane?.refresh();
596
596
  };
597
- const wasRaw = input.isRaw;
597
+ const wasRaw = input.isRaw ?? false;
598
598
  const end = () => editor.close();
599
599
  input.setRawMode(true);
600
600
  output.write("\u001b[?2004h");
@@ -720,7 +720,8 @@ export function mapPiEvent(event, runtime = "pi", style = STYLE) {
720
720
  // summary (Pi's docs/rpc.md). An end that names neither is done.
721
721
  const failure = diagnosticText([event.errorMessage]).slice(0, 400);
722
722
  return { mirrorLines: [event.aborted === true ? `[${runtime}] compaction cancelled`
723
- : failure ? `[${runtime}] compaction failed: ${failure}` : `[${runtime}] compaction done`] };
723
+ : failure ? `[${runtime}] compaction failed: ${failure}` : `[${runtime}] compaction done`],
724
+ ...(runtime === "pi" ? { activity: { hookEvent: "Stop", subtype: "compaction" } } : {}) };
724
725
  }
725
726
  // OMP names its automatic compaction separately. Pi keeps main's mapping
726
727
  // (unmapped), so an idle Pi seat never reads as running after one.
@@ -744,7 +745,15 @@ export function mapPiEvent(event, runtime = "pi", style = STYLE) {
744
745
  return { mirrorLines: [] };
745
746
  }
746
747
  }
748
+ export function writePiRunnerSidecar(path, state) {
749
+ const temporary = `${path}.${process.pid}.tmp`;
750
+ fs.writeFileSync(temporary, JSON.stringify(state), { mode: 0o600 });
751
+ fs.renameSync(temporary, path);
752
+ }
747
753
  const GET_STATE_ID = "pi-runner-get-state";
754
+ /** The reserved manual-compaction input carries its attempt id in the RPC id, so a
755
+ * reply and the sidecar record can name exactly the request OpenRig made. */
756
+ const COMPACT_ID = "pi-runner-compact:";
748
757
  const CATCH_UP_ID = "pi-runner-catch-up";
749
758
  const CURSOR_REFRESH_ID = "pi-runner-cursor-refresh";
750
759
  const NEGOTIATE_ID = "omp-runner-negotiate";
@@ -821,6 +830,26 @@ export class RunnerCore {
821
830
  io;
822
831
  identity;
823
832
  opts;
833
+ compaction;
834
+ /** The last attempt-stamped record, kept beside `compaction` so a later
835
+ * automatic run cannot erase a requested attempt's result. */
836
+ requestedCompaction;
837
+ /** The attempt a `/openrig-compact <id>` input named, awaiting its compaction_start. */
838
+ pendingCompactAttemptId = null;
839
+ /** Durable copy of that pending attempt: written before the compact RPC, so a
840
+ * restarted daemon reads the newest request as uncertain, not as an older run. */
841
+ pendingCompaction;
842
+ managed = new Map();
843
+ managedQueue = [];
844
+ managedRpc = new Map();
845
+ managedWake = null;
846
+ managedQuarantined = false;
847
+ pendingManagedStart = false;
848
+ personPreflights = new Set();
849
+ promptRevision = 0;
850
+ idleRevision = -1;
851
+ idleQuery = null;
852
+ nativeQueueStateAvailable = false;
824
853
  streaming = false;
825
854
  /** The child is gone; the status row says exited, never idle. */
826
855
  paneExited = false;
@@ -828,6 +857,17 @@ export class RunnerCore {
828
857
  paneError = false;
829
858
  /** A runtime-reported automatic retry is in flight; the row says retrying until it ends. */
830
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();
831
871
  /** Pi runs this runner has opened, each posted as an accepted turn (contract section 4): the working beat names it. */
832
872
  turn = 0;
833
873
  sessionFile;
@@ -884,6 +924,47 @@ export class RunnerCore {
884
924
  }
885
925
  /** Runner readiness is the sidecar's acknowledged get_state, not RPC transport ready. */
886
926
  isReady() { return this.ready; }
927
+ /** A permanent reporting-authority refusal fences new managed dispatch, not person input or native work already in flight. */
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
+ }
887
968
  /** Kick off identity capture. Called once pi's RPC stream is up; for OMP, with its `ready` frame. */
888
969
  start(ready) {
889
970
  // K4: the first credential observation, before Pi can make any request of this runner's.
@@ -968,8 +1049,289 @@ export class RunnerCore {
968
1049
  this.diag(`[omp-runner] ERROR rpc frame: ${reason}; the chunked frame was dropped`);
969
1050
  }
970
1051
  get runtime() { return this.opts.runtime ?? "pi"; }
1052
+ async acceptRunnerRequest(frame) {
1053
+ if (!this.ready || this.runtime !== "pi" && frame.kind !== "input" || !this.io.postRunner || frame.version !== 1 || frame.runId !== this.identity.runId
1054
+ || !Number.isSafeInteger(frame.sequence) || frame.sequence < 1 || typeof frame.requestId !== "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"))
1058
+ return;
1059
+ frame = { version: 1, runId: frame.runId, requestId: frame.requestId, sequence: frame.sequence, kind: frame.kind,
1060
+ payload: frame.kind === "cancel" ? { target: { ...frame.payload.target } } : frame.kind === "wake" ? { question: frame.payload.question } : { text: frame.payload.text } };
1061
+ if ([...this.managed.values()].some(entry => entry.frame.sequence === frame.sequence && entry.frame.requestId !== frame.requestId))
1062
+ throw new Error("Conflicting native sequence");
1063
+ const old = this.managed.get(frame.requestId);
1064
+ if (old) {
1065
+ if (JSON.stringify(old.frame) !== JSON.stringify(frame))
1066
+ throw new Error("Conflicting native request identity");
1067
+ await old.acceptance;
1068
+ return;
1069
+ }
1070
+ const entry = { frame, state: "accepting", reports: Promise.resolve() };
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;
1077
+ entry.acceptance = (async () => {
1078
+ const accepted = await this.io.postRunner({ type: "ack", runId: frame.runId, requestId: frame.requestId, sequence: frame.sequence, state: "accepted" });
1079
+ if (!accepted) {
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
+ }
1087
+ this.pumpManaged();
1088
+ return;
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
+ }
1111
+ entry.state = "queued";
1112
+ this.managedQueue.push(entry);
1113
+ this.managedQueue.sort((a, b) => a.frame.sequence - b.frame.sequence);
1114
+ this.pumpManaged();
1115
+ })();
1116
+ await entry.acceptance;
1117
+ }
1118
+ reportManaged(entry, type, result) {
1119
+ const f = entry.frame;
1120
+ if (type !== "submitted" && result)
1121
+ entry.terminalResult = result;
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");
1235
+ }
1236
+ pumpManaged() {
1237
+ if (!this.ready || this.cancellationFence || this.managedQuarantined || this.managedWake || this.runtime === "pi" && this.pendingManagedStart && !this.streaming)
1238
+ return;
1239
+ const entry = this.managedQueue[0];
1240
+ if (!entry || this.personPreflights.size || [...this.managed.values()].some(prior => prior.state === "accepting" && prior.frame.sequence < entry.frame.sequence)
1241
+ || entry.frame.kind === "wake" && (this.streaming || this.pendingManagedStart))
1242
+ return;
1243
+ if (entry.frame.kind === "wake" && this.idleRevision !== this.promptRevision) {
1244
+ if (!this.idleQuery) {
1245
+ this.idleQuery = { id: `openrig-native-idle-${this.promptRevision}`, revision: this.promptRevision };
1246
+ this.io.sendRpc({ type: "get_state", id: this.idleQuery.id });
1247
+ }
1248
+ return;
1249
+ }
1250
+ this.promptRevision += 1;
1251
+ this.managedQueue.shift();
1252
+ entry.state = "writing";
1253
+ if (entry.frame.kind === "wake") {
1254
+ this.managedWake = entry;
1255
+ entry.answer = [];
1256
+ }
1257
+ if (this.runtime === "pi" && !this.streaming)
1258
+ this.pendingManagedStart = true;
1259
+ const id = `openrig-native-${entry.frame.requestId}`;
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);
1263
+ this.io.sendRpc({ id, type: "prompt", message: entry.frame.kind === "wake" ? entry.frame.payload.question : entry.frame.payload.text, streamingBehavior: "steer" });
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
+ }
1273
+ // Ordinary busy messages may steer; the next queued wake waits for agent_end, not this RPC response.
1274
+ this.pumpManaged();
1275
+ }
1276
+ finishManagedWake(entry, forced) {
1277
+ // Pi reports started before agent.prompt, but awaits extension handlers before handled.
1278
+ // Events before that authoritative disposition cannot establish this invocation's ownership.
1279
+ if (!forced && entry.disposition === undefined)
1280
+ return;
1281
+ const ownershipUnknown = !["started", "handled"].includes(entry.disposition ?? "") || entry.preDispositionEvents === true;
1282
+ if (ownershipUnknown)
1283
+ this.managedQuarantined = true;
1284
+ const completion = ownershipUnknown || forced && !entry.nativeAccepted ? "unknown" : forced ?? (entry.contaminated || !entry.wakeOpened ? "unknown"
1285
+ : entry.stopReason === "stop" && entry.answer?.some(text => text.length > 0) ? "completed" : entry.stopReason === "aborted" ? "interrupted" : entry.stopReason === "error" ? "failed" : "unknown");
1286
+ entry.state = "terminal";
1287
+ entry.terminalResult = { kind: "wake", ...(entry.nativeTurnId ? { nativeTurnId: entry.nativeTurnId } : {}),
1288
+ completion, answer: completion === "completed" ? entry.answer?.join("\n") ?? "" : null,
1289
+ ...(ownershipUnknown ? { ownershipUnknown: true } : {}),
1290
+ ...(forced && !entry.nativeAccepted ? { submissionUnknown: true } : {}) };
1291
+ if (entry.nativeAccepted || forced)
1292
+ this.reportManaged(entry, "result", entry.terminalResult);
1293
+ if (this.managedWake === entry)
1294
+ this.managedWake = null;
1295
+ }
1296
+ personPrompt(command) {
1297
+ if (this.runtime !== "pi" || !this.io.postRunner) {
1298
+ this.io.sendRpc(command);
1299
+ return;
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
+ }
1305
+ const id = `openrig-person-${++this.promptRevision}`;
1306
+ this.personPreflights.add(id);
1307
+ if (!this.streaming)
1308
+ this.pendingManagedStart = true;
1309
+ if (this.streaming && typeof command.message === "string")
1310
+ this.personSteers.add(command.message);
1311
+ this.io.sendRpc({ ...command, id });
1312
+ this.acceptIntoOpenRun();
1313
+ }
971
1314
  /** One aggregated paste block from pane stdin. */
972
1315
  handleUserBlock(block) {
1316
+ if (this.cancellation && !this.cancellation.submitted && !this.cancellation.ended)
1317
+ this.rejectNativeCancellation(this.cancellation.entry, "person_input_after_preparation");
1318
+ const compact = /^\/openrig-compact ([\w-]+)$/.exec(block);
1319
+ if (this.runtime === "pi" && compact) {
1320
+ const attemptId = compact[1];
1321
+ if (this.pendingCompactAttemptId || (this.compaction?.startedAt && !this.compaction.endedAt)) {
1322
+ this.diag("[pi-runner] compact already in progress; request not sent");
1323
+ return;
1324
+ }
1325
+ this.pendingCompactAttemptId = attemptId;
1326
+ this.pendingCompaction = { attemptId, requestedAt: this.io.now() };
1327
+ // Persist the request before the RPC leaves: the id survives a daemon
1328
+ // restart, so the newest attempt reads uncertain, never an older result.
1329
+ this.writeSidecar({});
1330
+ this.io.sendRpc({ type: "compact", id: COMPACT_ID + attemptId });
1331
+ return;
1332
+ }
1333
+ if (this.managedWake)
1334
+ this.managedWake.contaminated = true;
973
1335
  if (block === "/abort") {
974
1336
  this.io.sendRpc({ type: "abort" });
975
1337
  this.diag("[pi-runner] abort sent");
@@ -977,18 +1339,20 @@ export class RunnerCore {
977
1339
  }
978
1340
  if (block.startsWith("/followup ")) {
979
1341
  const message = block.slice("/followup ".length);
980
- this.io.sendRpc({ type: "follow_up", message });
1342
+ this.personPrompt({ type: "follow_up", message });
981
1343
  this.io.mirrorLine(`${this.style.commit("you (follow-up) ▸")} ${message}`);
982
- this.acceptIntoOpenRun();
1344
+ if (this.runtime !== "pi" || !this.io.postRunner)
1345
+ this.acceptIntoOpenRun();
983
1346
  return;
984
1347
  }
985
1348
  // The runtime decides, not the runner: with streamingBehavior "steer", Pi and OMP run the prompt when idle and,
986
1349
  // while busy, queue it as a steer, delivered after the current turn's tool calls and before the next model call.
987
1350
  // The runner's `streaming` starts only at agent_start, so it can't tell when a turn is about to start (#1932) or
988
1351
  // when a prompt was consumed locally and started none. It labels the mirror line only.
989
- this.io.sendRpc({ type: "prompt", message: block, streamingBehavior: "steer" });
1352
+ this.personPrompt({ type: "prompt", message: block, streamingBehavior: "steer" });
990
1353
  this.io.mirrorLine(this.streaming ? `${this.style.commit("you (steer) ▸")} ${block}` : `${this.style.commit("you ▸")} ${block}`);
991
- this.acceptIntoOpenRun();
1354
+ if (this.runtime !== "pi" || !this.io.postRunner)
1355
+ this.acceptIntoOpenRun();
992
1356
  }
993
1357
  /** A working beat counts only for the latest accepted turn, and each prompt the runner gives the agent is accepted with
994
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
@@ -998,12 +1362,20 @@ export class RunnerCore {
998
1362
  if (this.runtime === "omp" || !this.streaming)
999
1363
  return;
1000
1364
  this.turn += 1;
1365
+ if (this.nativeTurn) {
1366
+ this.nativeTurn.accepted.push(String(this.turn));
1367
+ this.reportNativeTurn("opened");
1368
+ }
1001
1369
  this.io.postActivity(this.activityPayload("UserPromptSubmit", "accepted", { turnId: String(this.turn) }));
1002
1370
  }
1003
1371
  /** Child process exit — honest, loud, durable. */
1004
1372
  handlePiExit(code) {
1005
1373
  this.ready = false;
1006
1374
  this.paneExited = true;
1375
+ if (this.cancellation)
1376
+ this.finishNativeCancellation(this.cancellation.submitted ? "requested" : "not-this-turn", "native_process_exited");
1377
+ if (this.managedWake)
1378
+ this.finishManagedWake(this.managedWake, "failed");
1007
1379
  this.reportDroppedFrame(this.frameDecoder?.incomplete());
1008
1380
  this.io.mirrorLine(`[${this.runtime}-runner] EXITED ${this.runtime} exited (code ${code ?? "unknown"})`);
1009
1381
  this.writeSidecar({ exited: { code, at: this.io.now() } });
@@ -1011,6 +1383,127 @@ export class RunnerCore {
1011
1383
  this.refreshPaneStatus();
1012
1384
  }
1013
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
+ }
1417
+ if (this.idleQuery && record.id === this.idleQuery.id) {
1418
+ const query = this.idleQuery;
1419
+ this.idleQuery = null;
1420
+ const data = record.data;
1421
+ if (record.success === true && data?.isStreaming === false && data.pendingMessageCount === 0 && query.revision === this.promptRevision) {
1422
+ this.idleRevision = query.revision;
1423
+ this.pumpManaged();
1424
+ }
1425
+ else if (record.success === true && typeof data?.isStreaming === "boolean" && Number.isSafeInteger(data.pendingMessageCount) && Number(data.pendingMessageCount) >= 0) {
1426
+ setTimeout(() => this.pumpManaged(), 250).unref();
1427
+ }
1428
+ else {
1429
+ const next = this.managedQueue.shift();
1430
+ if (next) {
1431
+ next.state = "terminal";
1432
+ this.reportManaged(next, "rejected", { kind: next.frame.kind, reason: "native_idle_state_unavailable" });
1433
+ }
1434
+ this.pumpManaged();
1435
+ }
1436
+ return;
1437
+ }
1438
+ if (typeof record.id === "string" && this.personPreflights.delete(record.id)) {
1439
+ if (record.success !== true || record.data?.disposition === "handled")
1440
+ this.pendingManagedStart = false;
1441
+ this.pumpPersonPrompts();
1442
+ this.pumpManaged();
1443
+ if (record.success !== false && record.error == null)
1444
+ return;
1445
+ }
1446
+ const managed = typeof record.id === "string" ? this.managedRpc.get(record.id) : undefined;
1447
+ if (managed) {
1448
+ this.managedRpc.delete(String(record.id));
1449
+ if (record.success === true) {
1450
+ managed.nativeAccepted = true;
1451
+ managed.state = "submitted";
1452
+ this.reportManaged(managed, "submitted");
1453
+ const inputData = record.data;
1454
+ if (managed.frame.kind === "wake") {
1455
+ const disposition = inputData?.disposition;
1456
+ managed.disposition = typeof disposition === "string" ? disposition : "unknown";
1457
+ if (!["started", "handled"].includes(managed.disposition) || managed.preDispositionEvents)
1458
+ this.managedQuarantined = true;
1459
+ if (managed.nativeTerminal || managed.disposition !== "started" && !this.streaming)
1460
+ this.finishManagedWake(managed);
1461
+ else if (managed.terminalResult)
1462
+ this.reportManaged(managed, "result", managed.terminalResult);
1463
+ if (this.managedWake !== managed && !this.streaming) {
1464
+ this.pendingManagedStart = false;
1465
+ this.pumpPersonPrompts();
1466
+ this.pumpManaged();
1467
+ }
1468
+ }
1469
+ else if (this.runtime !== "pi") {
1470
+ // Input acceptance needs the correlated RPC response, not an invented native invocation.
1471
+ managed.state = "terminal";
1472
+ this.reportManaged(managed, "result", { kind: "input", accepted: true });
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();
1491
+ this.pumpManaged();
1492
+ }
1493
+ }
1494
+ }
1495
+ else {
1496
+ this.pendingNativeInputs.delete(managed);
1497
+ managed.state = "terminal";
1498
+ this.pendingManagedStart = false;
1499
+ this.reportManaged(managed, "rejected", { kind: managed.frame.kind, reason: "native_prompt_rejected" });
1500
+ if (this.managedWake === managed)
1501
+ this.managedWake = null;
1502
+ this.pumpPersonPrompts();
1503
+ this.pumpManaged();
1504
+ }
1505
+ return;
1506
+ }
1014
1507
  if (record.id === NEGOTIATE_ID && this.v2Limit !== null) {
1015
1508
  if (record.success === true) {
1016
1509
  this.frameDecoder = new OmpFrameDecoder(this.v2Limit);
@@ -1022,9 +1515,43 @@ export class RunnerCore {
1022
1515
  }
1023
1516
  return;
1024
1517
  }
1518
+ if (this.runtime === "pi" && record.success === true && record.error == null
1519
+ && typeof record.id === "string" && record.id.startsWith(COMPACT_ID)) {
1520
+ const attemptId = record.id.slice(COMPACT_ID.length);
1521
+ if (this.pendingCompactAttemptId === attemptId)
1522
+ this.pendingCompactAttemptId = null;
1523
+ if (this.pendingCompaction?.attemptId === attemptId)
1524
+ this.pendingCompaction = undefined;
1525
+ this.writeSidecar({});
1526
+ return;
1527
+ }
1025
1528
  if (record.success === false || record.error != null) {
1026
1529
  const detail = typeof record.error === "string" ? record.error : "request failed";
1027
1530
  const message = detail + (this.runtime === "pi" ? piCredentialHint(detail) : "");
1531
+ const compactId = this.runtime === "pi" && typeof record.id === "string" && record.id.startsWith(COMPACT_ID)
1532
+ ? record.id : null;
1533
+ if (compactId) {
1534
+ const attemptId = compactId.slice(COMPACT_ID.length);
1535
+ const unsupported = /unknown command|unsupported|not supported/i.test(detail);
1536
+ this.io.mirrorLine(`[pi-runner] ERROR rpc compact${unsupported ? " unsupported" : " failed"}: ${message}`);
1537
+ // A failure with no start replaces any older record: this attempt is the answer.
1538
+ const prior = this.compaction?.attemptId === attemptId ? this.compaction : undefined;
1539
+ const wasPending = this.pendingCompactAttemptId === attemptId;
1540
+ if (this.pendingCompactAttemptId === attemptId)
1541
+ this.pendingCompactAttemptId = null;
1542
+ if (this.pendingCompaction?.attemptId === attemptId)
1543
+ this.pendingCompaction = undefined;
1544
+ const failed = { attemptId, reason: prior?.reason ?? "manual",
1545
+ ...(prior?.requestId ? { requestId: prior.requestId } : {}),
1546
+ ...(prior?.startedAt ? { startedAt: prior.startedAt } : {}),
1547
+ endedAt: prior?.endedAt ?? this.io.now(), errorMessage: detail };
1548
+ if (wasPending || !this.compaction?.attemptId || this.compaction.attemptId === attemptId)
1549
+ this.compaction = failed;
1550
+ if (wasPending || !this.requestedCompaction || this.requestedCompaction.attemptId === attemptId)
1551
+ this.requestedCompaction = failed;
1552
+ this.writeSidecar({});
1553
+ return;
1554
+ }
1028
1555
  if (record.id === GET_STATE_ID) {
1029
1556
  this.ready = false;
1030
1557
  this.paneError = true;
@@ -1059,7 +1586,10 @@ export class RunnerCore {
1059
1586
  this.sessionFile = sessionFile ?? this.sessionFile;
1060
1587
  this.sessionId = sessionId ?? this.sessionId;
1061
1588
  const wasReady = this.ready;
1589
+ this.nativeQueueStateAvailable = typeof data.isStreaming === "boolean" && Number.isSafeInteger(data.pendingMessageCount) && Number(data.pendingMessageCount) >= 0;
1062
1590
  this.ready = this.runtime === "pi" || !!this.sessionFile;
1591
+ if (this.ready)
1592
+ this.pumpManaged();
1063
1593
  if (!this.ready) {
1064
1594
  if (this.runtime === "omp") {
1065
1595
  this.diag("[omp-runner] ERROR rpc get_state returned no session file; cannot provide a resume token");
@@ -1290,6 +1820,63 @@ export class RunnerCore {
1290
1820
  /** Emphasis for the lines the runner writes itself; model output stays plain. */
1291
1821
  get style() { return this.opts.style ?? STYLE; }
1292
1822
  handleEvent(event) {
1823
+ if (this.runtime === "pi" && (event.type === "compaction_start" || event.type === "compaction_end")) {
1824
+ const identity = {
1825
+ ...(typeof event.requestId === "string" ? { requestId: event.requestId } : {}),
1826
+ ...(typeof event.reason === "string" ? { reason: event.reason } : {}),
1827
+ };
1828
+ // The attempt id OpenRig's reserved input named rides the runner's native
1829
+ // compact command and returns here. An automatic run (threshold/overflow)
1830
+ // never takes it, so its result cannot answer a requested attempt.
1831
+ const manualReason = typeof event.reason !== "string" || event.reason === "manual";
1832
+ if (event.type === "compaction_start") {
1833
+ const attemptId = manualReason ? this.pendingCompactAttemptId ?? undefined : undefined;
1834
+ if (attemptId) {
1835
+ this.pendingCompactAttemptId = null;
1836
+ this.pendingCompaction = undefined;
1837
+ }
1838
+ this.compaction = { ...(attemptId ? { attemptId } : {}), ...identity, startedAt: this.io.now() };
1839
+ }
1840
+ else {
1841
+ const result = event.result;
1842
+ const summary = result !== null && typeof result === "object" ? Object.fromEntries(Object.entries(result).filter(([key, value]) => (["summary", "firstKeptEntryId"].includes(key) && typeof value === "string") ||
1843
+ (["tokensBefore", "estimatedTokensAfter"].includes(key) && typeof value === "number"))) : undefined;
1844
+ const attemptId = this.compaction?.attemptId
1845
+ ?? (manualReason ? this.pendingCompactAttemptId ?? undefined : undefined);
1846
+ if (attemptId && this.pendingCompactAttemptId === attemptId)
1847
+ this.pendingCompactAttemptId = null;
1848
+ this.compaction = { ...this.compaction, ...(attemptId ? { attemptId } : {}), ...identity, endedAt: this.io.now(),
1849
+ ...(result === null ? { result: null } : summary ? { result: summary } : {}),
1850
+ ...(typeof event.aborted === "boolean" ? { aborted: event.aborted } : {}),
1851
+ ...(typeof event.willRetry === "boolean" ? { willRetry: event.willRetry } : {}),
1852
+ ...(typeof event.errorMessage === "string" ? { errorMessage: event.errorMessage } : {}),
1853
+ };
1854
+ // Keep the attempt-stamped record beside `compaction`: a later automatic
1855
+ // run replaces that field, and this request must still read completed.
1856
+ if (this.compaction.attemptId)
1857
+ this.requestedCompaction = this.compaction;
1858
+ }
1859
+ this.writeSidecar({});
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
+ }
1293
1880
  if (event.type === "extension_ui_request") {
1294
1881
  const method = event.method;
1295
1882
  const dialog = method === "select" || method === "confirm" || method === "input" || method === "editor";
@@ -1376,10 +1963,27 @@ export class RunnerCore {
1376
1963
  if (event.type === "turn_start")
1377
1964
  this.assistantErrorShown = false;
1378
1965
  }
1966
+ const wake = this.managedWake;
1967
+ if (wake && wake.disposition === undefined && ["agent_start", "message_end", "agent_end"].includes(String(event.type)))
1968
+ wake.preDispositionEvents = true;
1969
+ if (event.type === "agent_start" && wake) {
1970
+ if (wake.wakeOpened)
1971
+ wake.contaminated = true;
1972
+ wake.wakeOpened = true;
1973
+ }
1974
+ if (event.type === "message_end" && wake && wake.disposition === "started" && !wake.preDispositionEvents && wake.wakeOpened) {
1975
+ const assistant = event.message;
1976
+ if (assistant?.role === "assistant") {
1977
+ wake.answer.push(...(Array.isArray(assistant.content) ? assistant.content : []).filter(part => part.type === "text" && typeof part.text === "string").map(part => part.text));
1978
+ wake.stopReason = assistant.stopReason;
1979
+ }
1980
+ }
1379
1981
  const mapped = mapPiEvent(event, this.runtime, this.style);
1380
1982
  // A working beat counts only for the latest accepted turn. Pi's runs start from this runner's prompts, so the run
1381
1983
  // that opens is posted as one, before its first event; a prompt Pi handles without a run opens none. A prompt sent
1382
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;
1383
1987
  const opening = this.runtime !== "omp" && mapped.streaming === true && !this.streaming;
1384
1988
  if (mapped.streaming !== undefined) {
1385
1989
  const changed = this.streaming !== mapped.streaming;
@@ -1387,8 +1991,25 @@ export class RunnerCore {
1387
1991
  if (changed)
1388
1992
  this.refreshPaneStatus();
1389
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");
1390
1996
  if (opening) {
1997
+ setImmediate(() => this.pumpManaged());
1391
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();
1392
2013
  this.io.postActivity(this.activityPayload("UserPromptSubmit", "accepted", { turnId: String(this.turn) }));
1393
2014
  }
1394
2015
  // OMP writes its JSONL lazily; re-announce identity after each turn until
@@ -1401,6 +2022,16 @@ export class RunnerCore {
1401
2022
  this.paneRetrying = false;
1402
2023
  this.refreshPaneStatus();
1403
2024
  }
2025
+ this.idleRevision = -1;
2026
+ this.pendingManagedStart = false;
2027
+ this.reportNativeTurn("closed");
2028
+ this.nativeTurn = null;
2029
+ this.finishEndedNativeCancellation();
2030
+ if (wake) {
2031
+ wake.nativeTerminal = true;
2032
+ this.finishManagedWake(wake);
2033
+ }
2034
+ setImmediate(() => { this.pumpPersonPrompts(); this.pumpManaged(); });
1404
2035
  // QA RED fold: live events do not reliably carry
1405
2036
  // session-entry ids, so the durable cursor starved (lastEntryId stayed
1406
2037
  // null in real runs). Refresh it from the source of truth after every
@@ -1455,15 +2086,25 @@ export class RunnerCore {
1455
2086
  return;
1456
2087
  if (event.type === "agent_end" && this.attention === "transient_turn_error")
1457
2088
  this.clearAttention();
1458
- if (mapped.activity.hookEvent === "Stop" && this.attention) {
1459
- // The turn ended, but the operator still has to act. Drop the Stop; if
1460
- // later activity replaced the attention, restore it as the final state.
1461
- if (!this.attentionIsLatest)
1462
- this.raiseAttention(this.attention);
2089
+ const compactionBeat = this.runtime === "pi" && mapped.activity.subtype === "compaction";
2090
+ try {
2091
+ if (mapped.activity.hookEvent === "Stop" && this.attention) {
2092
+ // The turn ended, but the operator still has to act. Drop the Stop; if
2093
+ // later activity replaced the attention, restore it as the final state.
2094
+ if (!this.attentionIsLatest)
2095
+ this.raiseAttention(this.attention);
2096
+ }
2097
+ else {
2098
+ this.attentionIsLatest = false;
2099
+ this.io.postActivity(this.activityPayload(mapped.activity.hookEvent, mapped.activity.subtype, compactionBeat ? { requestId: this.compaction?.requestId, reason: this.compaction?.reason,
2100
+ ...(event.type === "compaction_end" ? { endedAt: this.compaction?.endedAt } : {}) } : {}));
2101
+ }
1463
2102
  }
1464
- else {
1465
- this.attentionIsLatest = false;
1466
- this.io.postActivity(this.activityPayload(mapped.activity.hookEvent, mapped.activity.subtype));
2103
+ finally {
2104
+ if (compactionBeat && event.type === "compaction_end") {
2105
+ this.lastPostedHook = null;
2106
+ this.lastHeartbeatMs = null;
2107
+ }
1467
2108
  }
1468
2109
  }
1469
2110
  /** Re-deliver OMP or managed run identity until the daemon confirms the resume token.
@@ -1535,6 +2176,11 @@ export class RunnerCore {
1535
2176
  sessionFile: this.sessionFile,
1536
2177
  sessionId: this.sessionId,
1537
2178
  lastEntryId: this.lastEntryId,
2179
+ ...(this.runtime === "pi" ? {
2180
+ compaction: this.compaction,
2181
+ requestedCompaction: this.requestedCompaction,
2182
+ pendingCompaction: this.pendingCompaction,
2183
+ } : {}),
1538
2184
  updatedAt: this.io.now(),
1539
2185
  ...patch,
1540
2186
  });
@@ -1801,6 +2447,121 @@ export function piLaunchCapabilityError(command, trust, line, readVersion) {
1801
2447
  catch { /* diagnostics only; never changes the child's outcome */ }
1802
2448
  return `Pi invoked as ${command} (${version}; exact executable path unknown) rejects the managed --name/--${trust} flags. Install the current @earendil-works/pi-coding-agent (npm install -g @earendil-works/pi-coding-agent) and check 'command -v pi' in this pane; an older Pi installation may be shadowing it.`;
1803
2449
  }
2450
+ function isPermanentPiRunRefusal(status, code) {
2451
+ if (![401, 403, 404, 409, 410].includes(status) || ["runner_hello_required", "runner_grant_pending", "runner_grant_unverified"].includes(code ?? ""))
2452
+ return false;
2453
+ return status === 401 || status === 403 || ["runner_grant_required", "runner_grant_revoked", "runner_grant_stale"].includes(code ?? "");
2454
+ }
2455
+ function runnerFrameBound(buffer) {
2456
+ const overhead = 64 * 1024;
2457
+ const fallback = { limit: 6 * 1024 * 1024 + overhead };
2458
+ if (!buffer.startsWith(": runner-frame-chars=") || !buffer.includes("\n"))
2459
+ return fallback;
2460
+ const header = /^: runner-frame-chars=([0-9]+)\n/.exec(buffer);
2461
+ const chars = header ? Number(header[1]) : NaN;
2462
+ if (!Number.isSafeInteger(chars) || chars < 1 || chars > Number.MAX_SAFE_INTEGER - overhead)
2463
+ throw new Error("Invalid channel frame size");
2464
+ return { limit: chars + overhead, chars };
2465
+ }
2466
+ /** Pi's HTTP/SSE wire loop; it owns no native executor or durable receiver journal. */
2467
+ export async function connectPiRunnerChannel(core, endpoint, runId, signal) {
2468
+ let retained = false, cursor = 0;
2469
+ while (!signal.aborted) {
2470
+ try {
2471
+ if (!core.isReady()) {
2472
+ await new Promise(resolve => setTimeout(resolve, 100));
2473
+ continue;
2474
+ }
2475
+ const hello = await fetch(new URL("/api/activity/runner-channel", endpoint.baseUrl), { method: "POST", signal: AbortSignal.any([signal, AbortSignal.timeout(3000)]),
2476
+ headers: { authorization: `Bearer ${endpoint.token}`, "content-type": "application/json" },
2477
+ body: JSON.stringify({ type: "hello", version: 1, runId, retained, capabilities: core.nativeChannelCapabilities() }) });
2478
+ if (!hello.ok) {
2479
+ const failure = await hello.json().catch(() => null);
2480
+ if (isPermanentPiRunRefusal(hello.status, failure?.code)) {
2481
+ core.quarantineManagedChannel();
2482
+ return;
2483
+ }
2484
+ throw new Error("Channel handshake unavailable");
2485
+ }
2486
+ retained = true;
2487
+ const response = await fetch(new URL("/api/activity/runner-channel", endpoint.baseUrl), { signal,
2488
+ headers: { authorization: `Bearer ${endpoint.token}`, "Last-Event-ID": String(cursor) } });
2489
+ if (!response.ok) {
2490
+ const failure = await response.json().catch(() => null);
2491
+ if (isPermanentPiRunRefusal(response.status, failure?.code)) {
2492
+ core.quarantineManagedChannel();
2493
+ return;
2494
+ }
2495
+ throw new Error("Channel subscription unavailable");
2496
+ }
2497
+ if (!response.body)
2498
+ throw new Error("Channel subscription unavailable");
2499
+ const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
2500
+ let buffer = "";
2501
+ try {
2502
+ for (;;) {
2503
+ const chunk = await reader.read();
2504
+ if (chunk.done)
2505
+ break;
2506
+ buffer += chunk.value.replace(/\r/g, "");
2507
+ let end;
2508
+ while ((end = buffer.indexOf("\n\n")) >= 0) {
2509
+ const bound = runnerFrameBound(buffer);
2510
+ if (end > bound.limit)
2511
+ throw new Error("Channel frame too large");
2512
+ const block = buffer.slice(0, end);
2513
+ buffer = buffer.slice(end + 2);
2514
+ const data = block.split("\n").filter(line => line.startsWith("data: ")).map(line => line.slice(6)).join("\n");
2515
+ if (bound.chars !== undefined && data.length !== bound.chars)
2516
+ throw new Error("Channel frame size mismatch");
2517
+ if (!data)
2518
+ continue;
2519
+ const frame = JSON.parse(data);
2520
+ if (frame.runId !== runId || !Number.isSafeInteger(frame.sequence) || frame.sequence < 1)
2521
+ throw new Error("Invalid channel frame");
2522
+ cursor = Math.max(cursor, frame.sequence);
2523
+ // Do not block reconnection on an ack whose response was lost; the core retains its acceptance promise.
2524
+ void core.acceptRunnerRequest(frame).catch(() => { });
2525
+ }
2526
+ if (buffer.length > runnerFrameBound(buffer).limit)
2527
+ throw new Error("Channel frame too large");
2528
+ }
2529
+ }
2530
+ finally {
2531
+ await reader.cancel().catch(() => { });
2532
+ }
2533
+ }
2534
+ catch { /* Same live process/map reconnects; native writes never replay here. */ }
2535
+ if (!signal.aborted)
2536
+ await new Promise(resolve => setTimeout(resolve, 250));
2537
+ }
2538
+ }
2539
+ async function postPiRunnerChannel(endpoint, body, signal, onPermanentRunRefusal, onContinuation) {
2540
+ while (!signal.aborted) {
2541
+ try {
2542
+ const response = await fetch(new URL("/api/activity/runner-channel", endpoint.baseUrl), { method: "POST",
2543
+ signal: AbortSignal.any([signal, AbortSignal.timeout(3000)]), headers: { authorization: `Bearer ${endpoint.token}`, "content-type": "application/json" }, body: JSON.stringify(body) });
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
+ }
2550
+ return true;
2551
+ }
2552
+ const failure = await response.json().catch(() => null);
2553
+ if ([401, 403, 404, 409, 410].includes(response.status) && !["runner_hello_required", "runner_grant_pending", "runner_grant_unverified"].includes(failure?.code ?? "")) {
2554
+ if (isPermanentPiRunRefusal(response.status, failure?.code))
2555
+ onPermanentRunRefusal();
2556
+ return false;
2557
+ }
2558
+ }
2559
+ catch { /* A lost response retries the saved receipt, never the native operation. */ }
2560
+ if (!signal.aborted)
2561
+ await new Promise(resolve => setTimeout(resolve, 250));
2562
+ }
2563
+ return false;
2564
+ }
1804
2565
  export async function main(argv = process.argv.slice(2)) {
1805
2566
  let args;
1806
2567
  try {
@@ -1890,7 +2651,7 @@ export async function main(argv = process.argv.slice(2)) {
1890
2651
  try {
1891
2652
  const pending = parsePiRunnerState(fs.readFileSync(paths.runnerStatePath, "utf8"));
1892
2653
  const exitedState = { ready: false, launchId: args.launchId, lastEntryId: pending?.lastEntryId, updatedAt: at, exited: { code: 127, at } };
1893
- fs.writeFileSync(paths.runnerStatePath, JSON.stringify(exitedState));
2654
+ writePiRunnerSidecar(paths.runnerStatePath, exitedState);
1894
2655
  }
1895
2656
  catch { /* the pane ERROR marker still fails readiness */ }
1896
2657
  process.exitCode = 127;
@@ -1985,7 +2746,27 @@ export async function main(argv = process.argv.slice(2)) {
1985
2746
  .catch(() => null)
1986
2747
  .finally(() => clearTimeout(timeout));
1987
2748
  });
2749
+ const nativePosts = new AbortController(), nativeStream = new AbortController();
2750
+ child.once("exit", () => { nativeStream.abort(); setTimeout(() => nativePosts.abort(), 2000).unref(); });
2751
+ child.once("error", () => { nativeStream.abort(); nativePosts.abort(); });
1988
2752
  const io = {
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
+ } } : {}),
1989
2770
  sendRpc: (cmd) => {
1990
2771
  try {
1991
2772
  child.stdin.write(`${JSON.stringify(cmd)}\n`);
@@ -2008,7 +2789,7 @@ export async function main(argv = process.argv.slice(2)) {
2008
2789
  },
2009
2790
  writeSidecar: (state) => {
2010
2791
  try {
2011
- fs.writeFileSync(paths.runnerStatePath, JSON.stringify(state));
2792
+ writePiRunnerSidecar(paths.runnerStatePath, state);
2012
2793
  }
2013
2794
  catch { /* best-effort; adapter falls back to pane markers */ }
2014
2795
  },
@@ -2063,6 +2844,8 @@ export async function main(argv = process.argv.slice(2)) {
2063
2844
  runId: runId,
2064
2845
  }, { catchUpSince, runtime, usageFacts: args.usageFacts === true, openRouterCharge: args.openRouterCharge === true, launchCredentialEvidence,
2065
2846
  requestedSessionFile: args.sessionFile, model: args.model, thinking: args.thinking });
2847
+ if (endpoint && runId)
2848
+ void connectPiRunnerChannel(core, endpoint, runId, nativeStream.signal);
2066
2849
  let transportUp = runtime !== "omp";
2067
2850
  readline.createInterface({ input: child.stdout }).on("line", (line) => {
2068
2851
  if (runtime === "omp" && !core.isReady()) {