@openrig/cli 0.7.7 → 0.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (590) hide show
  1. package/README.md +5 -5
  2. package/daemon/assets/openshell/Dockerfile +15 -0
  3. package/daemon/assets/openshell/README.md +137 -0
  4. package/daemon/assets/openshell/agents/coordinator/agent.yaml +20 -0
  5. package/daemon/assets/openshell/agents/coordinator/role.md +1 -0
  6. package/daemon/assets/openshell/agents/worker/agent.yaml +20 -0
  7. package/daemon/assets/openshell/agents/worker/role.md +3 -0
  8. package/daemon/assets/openshell/claude-code-provider.yaml +55 -0
  9. package/daemon/assets/openshell/driver-v1.schema.json +81 -0
  10. package/daemon/assets/openshell/guest.py +306 -0
  11. package/daemon/assets/openshell/policy.yaml +33 -0
  12. package/daemon/assets/openshell/preset.yaml +12 -0
  13. package/daemon/assets/openshell/rig.yaml +20 -0
  14. package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +1 -1
  15. package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
  16. package/daemon/assets/plugins/openrig-core/skills/seat-continuity-and-handover/SKILL.md +1 -1
  17. package/daemon/context-packs/help/manifest.yaml +1 -1
  18. package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
  19. package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +16 -6
  20. package/daemon/context-packs/reference/getting-started.md +8 -3
  21. package/daemon/context-packs/reference/manifest.yaml +1 -1
  22. package/daemon/context-packs/reference/rig-spec.md +69 -12
  23. package/daemon/context-packs/reference/whats-new.md +119 -15
  24. package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
  25. package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
  26. package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
  27. package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
  28. package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
  29. package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
  30. package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
  31. package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
  32. package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
  33. package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
  34. package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
  35. package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
  36. package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
  37. package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
  38. package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
  39. package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
  40. package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
  41. package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
  42. package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
  43. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
  44. package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
  45. package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
  46. package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
  47. package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
  48. package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
  49. package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
  50. package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
  51. package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
  52. package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
  53. package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
  54. package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
  55. package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
  56. package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
  57. package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
  58. package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
  59. package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
  60. package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
  61. package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
  62. package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
  63. package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
  64. package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
  65. package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
  66. package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
  67. package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
  68. package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
  69. package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
  70. package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
  71. package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
  72. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
  73. package/daemon/context-packs/skills/seat-continuity-and-handover/SKILL.md +1 -1
  74. package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
  75. package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
  76. package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
  77. package/daemon/context-packs/world-example/manifest.yaml +1 -1
  78. package/daemon/context-packs/world-public/manifest.yaml +1 -1
  79. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  80. package/daemon/dist/adapters/claude-code-adapter.js +37 -6
  81. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  82. package/daemon/dist/adapters/claude-resume.d.ts +2 -1
  83. package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
  84. package/daemon/dist/adapters/claude-resume.js +6 -3
  85. package/daemon/dist/adapters/claude-resume.js.map +1 -1
  86. package/daemon/dist/adapters/codex-runtime-adapter.d.ts +4 -7
  87. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  88. package/daemon/dist/adapters/codex-runtime-adapter.js +86 -33
  89. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  90. package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts +13 -1
  91. package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts.map +1 -1
  92. package/daemon/dist/adapters/community-harness-runtime-adapter.js +28 -1
  93. package/daemon/dist/adapters/community-harness-runtime-adapter.js.map +1 -1
  94. package/daemon/dist/adapters/openshell-driver.d.ts +39 -0
  95. package/daemon/dist/adapters/openshell-driver.d.ts.map +1 -0
  96. package/daemon/dist/adapters/openshell-driver.js +139 -0
  97. package/daemon/dist/adapters/openshell-driver.js.map +1 -0
  98. package/daemon/dist/adapters/openshell-podman-observer.d.ts +30 -0
  99. package/daemon/dist/adapters/openshell-podman-observer.d.ts.map +1 -0
  100. package/daemon/dist/adapters/openshell-podman-observer.js +94 -0
  101. package/daemon/dist/adapters/openshell-podman-observer.js.map +1 -0
  102. package/daemon/dist/adapters/pi-openrouter-charge.d.ts +1 -0
  103. package/daemon/dist/adapters/pi-openrouter-charge.d.ts.map +1 -1
  104. package/daemon/dist/adapters/pi-openrouter-charge.js +17 -3
  105. package/daemon/dist/adapters/pi-openrouter-charge.js.map +1 -1
  106. package/daemon/dist/adapters/tmux-control.d.ts +12 -6
  107. package/daemon/dist/adapters/tmux-control.d.ts.map +1 -1
  108. package/daemon/dist/adapters/tmux-control.js +42 -21
  109. package/daemon/dist/adapters/tmux-control.js.map +1 -1
  110. package/daemon/dist/adapters/tmux-server.d.ts +6 -3
  111. package/daemon/dist/adapters/tmux-server.d.ts.map +1 -1
  112. package/daemon/dist/adapters/tmux-server.js +13 -8
  113. package/daemon/dist/adapters/tmux-server.js.map +1 -1
  114. package/daemon/dist/adapters/tmux.d.ts +8 -2
  115. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  116. package/daemon/dist/adapters/tmux.js +38 -11
  117. package/daemon/dist/adapters/tmux.js.map +1 -1
  118. package/daemon/dist/build-info.js +3 -3
  119. package/daemon/dist/db/all-migrations.d.ts.map +1 -1
  120. package/daemon/dist/db/all-migrations.js +8 -0
  121. package/daemon/dist/db/all-migrations.js.map +1 -1
  122. package/daemon/dist/db/migrations/142_node_claude_mcp.d.ts +3 -0
  123. package/daemon/dist/db/migrations/142_node_claude_mcp.d.ts.map +1 -0
  124. package/daemon/dist/db/migrations/142_node_claude_mcp.js +5 -0
  125. package/daemon/dist/db/migrations/142_node_claude_mcp.js.map +1 -0
  126. package/daemon/dist/db/migrations/143_activity_grants.d.ts +8 -0
  127. package/daemon/dist/db/migrations/143_activity_grants.d.ts.map +1 -0
  128. package/daemon/dist/db/migrations/143_activity_grants.js +22 -0
  129. package/daemon/dist/db/migrations/143_activity_grants.js.map +1 -0
  130. package/daemon/dist/db/migrations/144_environment_bindings.d.ts +4 -0
  131. package/daemon/dist/db/migrations/144_environment_bindings.d.ts.map +1 -0
  132. package/daemon/dist/db/migrations/144_environment_bindings.js +31 -0
  133. package/daemon/dist/db/migrations/144_environment_bindings.js.map +1 -0
  134. package/daemon/dist/db/migrations/145_node_permissions_to.d.ts +5 -0
  135. package/daemon/dist/db/migrations/145_node_permissions_to.d.ts.map +1 -0
  136. package/daemon/dist/db/migrations/145_node_permissions_to.js +7 -0
  137. package/daemon/dist/db/migrations/145_node_permissions_to.js.map +1 -0
  138. package/daemon/dist/domain/active-occupant.d.ts +2 -0
  139. package/daemon/dist/domain/active-occupant.d.ts.map +1 -1
  140. package/daemon/dist/domain/active-occupant.js +9 -1
  141. package/daemon/dist/domain/active-occupant.js.map +1 -1
  142. package/daemon/dist/domain/activity-grants.d.ts +63 -0
  143. package/daemon/dist/domain/activity-grants.d.ts.map +1 -0
  144. package/daemon/dist/domain/activity-grants.js +106 -0
  145. package/daemon/dist/domain/activity-grants.js.map +1 -0
  146. package/daemon/dist/domain/agent-images/agent-image-library-service.d.ts.map +1 -1
  147. package/daemon/dist/domain/agent-images/agent-image-library-service.js +5 -2
  148. package/daemon/dist/domain/agent-images/agent-image-library-service.js.map +1 -1
  149. package/daemon/dist/domain/claude-compaction-enforcer.d.ts +11 -4
  150. package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
  151. package/daemon/dist/domain/claude-compaction-enforcer.js +34 -10
  152. package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
  153. package/daemon/dist/domain/claude-mcp.d.ts +10 -0
  154. package/daemon/dist/domain/claude-mcp.d.ts.map +1 -0
  155. package/daemon/dist/domain/claude-mcp.js +19 -0
  156. package/daemon/dist/domain/claude-mcp.js.map +1 -0
  157. package/daemon/dist/domain/codex-owned-plugin-trust.d.ts.map +1 -1
  158. package/daemon/dist/domain/codex-owned-plugin-trust.js +2 -1
  159. package/daemon/dist/domain/codex-owned-plugin-trust.js.map +1 -1
  160. package/daemon/dist/domain/community-harness-presets.d.ts +2 -1
  161. package/daemon/dist/domain/community-harness-presets.d.ts.map +1 -1
  162. package/daemon/dist/domain/community-harness-presets.js +3 -2
  163. package/daemon/dist/domain/community-harness-presets.js.map +1 -1
  164. package/daemon/dist/domain/context-monitor.d.ts +2 -2
  165. package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
  166. package/daemon/dist/domain/context-monitor.js +8 -2
  167. package/daemon/dist/domain/context-monitor.js.map +1 -1
  168. package/daemon/dist/domain/desired-claude-activity-hooks.d.ts +21 -0
  169. package/daemon/dist/domain/desired-claude-activity-hooks.d.ts.map +1 -0
  170. package/daemon/dist/domain/desired-claude-activity-hooks.js +30 -0
  171. package/daemon/dist/domain/desired-claude-activity-hooks.js.map +1 -0
  172. package/daemon/dist/domain/draft-aware-delivery.d.ts.map +1 -1
  173. package/daemon/dist/domain/draft-aware-delivery.js +6 -2
  174. package/daemon/dist/domain/draft-aware-delivery.js.map +1 -1
  175. package/daemon/dist/domain/environment-artifacts.d.ts +49 -0
  176. package/daemon/dist/domain/environment-artifacts.d.ts.map +1 -0
  177. package/daemon/dist/domain/environment-artifacts.js +158 -0
  178. package/daemon/dist/domain/environment-artifacts.js.map +1 -0
  179. package/daemon/dist/domain/environment-lifecycle.d.ts +119 -0
  180. package/daemon/dist/domain/environment-lifecycle.d.ts.map +1 -0
  181. package/daemon/dist/domain/environment-lifecycle.js +461 -0
  182. package/daemon/dist/domain/environment-lifecycle.js.map +1 -0
  183. package/daemon/dist/domain/environment-platform.d.ts +121 -0
  184. package/daemon/dist/domain/environment-platform.d.ts.map +1 -0
  185. package/daemon/dist/domain/environment-platform.js +280 -0
  186. package/daemon/dist/domain/environment-platform.js.map +1 -0
  187. package/daemon/dist/domain/environment-startup.d.ts +41 -0
  188. package/daemon/dist/domain/environment-startup.d.ts.map +1 -0
  189. package/daemon/dist/domain/environment-startup.js +281 -0
  190. package/daemon/dist/domain/environment-startup.js.map +1 -0
  191. package/daemon/dist/domain/expected-conversation.d.ts +20 -0
  192. package/daemon/dist/domain/expected-conversation.d.ts.map +1 -0
  193. package/daemon/dist/domain/expected-conversation.js +101 -0
  194. package/daemon/dist/domain/expected-conversation.js.map +1 -0
  195. package/daemon/dist/domain/gateway/operator-delivery-engine.d.ts +8 -1
  196. package/daemon/dist/domain/gateway/operator-delivery-engine.d.ts.map +1 -1
  197. package/daemon/dist/domain/gateway/operator-delivery-engine.js +61 -4
  198. package/daemon/dist/domain/gateway/operator-delivery-engine.js.map +1 -1
  199. package/daemon/dist/domain/gateway/slack/inbound.d.ts +2 -0
  200. package/daemon/dist/domain/gateway/slack/inbound.d.ts.map +1 -1
  201. package/daemon/dist/domain/gateway/slack/inbound.js +40 -8
  202. package/daemon/dist/domain/gateway/slack/inbound.js.map +1 -1
  203. package/daemon/dist/domain/gateway/slack/message.d.ts +16 -0
  204. package/daemon/dist/domain/gateway/slack/message.d.ts.map +1 -1
  205. package/daemon/dist/domain/gateway/slack/message.js +216 -7
  206. package/daemon/dist/domain/gateway/slack/message.js.map +1 -1
  207. package/daemon/dist/domain/gateway/slack/queue-access.d.ts +14 -0
  208. package/daemon/dist/domain/gateway/slack/queue-access.d.ts.map +1 -1
  209. package/daemon/dist/domain/gateway/slack/queue-access.js +9 -1
  210. package/daemon/dist/domain/gateway/slack/queue-access.js.map +1 -1
  211. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts.map +1 -1
  212. package/daemon/dist/domain/gateway/slack/slack-delivery.js +9 -4
  213. package/daemon/dist/domain/gateway/slack/slack-delivery.js.map +1 -1
  214. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts +2 -0
  215. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
  216. package/daemon/dist/domain/gateway/slack/slack-subsystem.js +6 -1
  217. package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
  218. package/daemon/dist/domain/hosts/hosts-registry-writer.d.ts +22 -0
  219. package/daemon/dist/domain/hosts/hosts-registry-writer.d.ts.map +1 -1
  220. package/daemon/dist/domain/hosts/hosts-registry-writer.js +116 -0
  221. package/daemon/dist/domain/hosts/hosts-registry-writer.js.map +1 -1
  222. package/daemon/dist/domain/kernel-hook-review.d.ts +16 -0
  223. package/daemon/dist/domain/kernel-hook-review.d.ts.map +1 -0
  224. package/daemon/dist/domain/kernel-hook-review.js +49 -0
  225. package/daemon/dist/domain/kernel-hook-review.js.map +1 -0
  226. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts +3 -0
  227. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
  228. package/daemon/dist/domain/mission-control/mission-control-write-contract.js +20 -5
  229. package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
  230. package/daemon/dist/domain/model-divergence/current-generation-record.d.ts.map +1 -1
  231. package/daemon/dist/domain/model-divergence/current-generation-record.js +10 -6
  232. package/daemon/dist/domain/model-divergence/current-generation-record.js.map +1 -1
  233. package/daemon/dist/domain/native-process-lineage.d.ts +3 -0
  234. package/daemon/dist/domain/native-process-lineage.d.ts.map +1 -1
  235. package/daemon/dist/domain/native-process-lineage.js +34 -1
  236. package/daemon/dist/domain/native-process-lineage.js.map +1 -1
  237. package/daemon/dist/domain/native-resume-probe.d.ts +2 -1
  238. package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
  239. package/daemon/dist/domain/native-resume-probe.js +4 -2
  240. package/daemon/dist/domain/native-resume-probe.js.map +1 -1
  241. package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
  242. package/daemon/dist/domain/node-inventory.js +18 -8
  243. package/daemon/dist/domain/node-inventory.js.map +1 -1
  244. package/daemon/dist/domain/node-launcher.d.ts +3 -0
  245. package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
  246. package/daemon/dist/domain/node-launcher.js +6 -0
  247. package/daemon/dist/domain/node-launcher.js.map +1 -1
  248. package/daemon/dist/domain/outbox-handler.d.ts +12 -0
  249. package/daemon/dist/domain/outbox-handler.d.ts.map +1 -1
  250. package/daemon/dist/domain/outbox-handler.js +32 -3
  251. package/daemon/dist/domain/outbox-handler.js.map +1 -1
  252. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts +10 -0
  253. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts.map +1 -1
  254. package/daemon/dist/domain/policies/parked-owner-consumer.js +60 -4
  255. package/daemon/dist/domain/policies/parked-owner-consumer.js.map +1 -1
  256. package/daemon/dist/domain/provider/claude-seat-switch.d.ts +9 -3
  257. package/daemon/dist/domain/provider/claude-seat-switch.d.ts.map +1 -1
  258. package/daemon/dist/domain/provider/claude-seat-switch.js +100 -17
  259. package/daemon/dist/domain/provider/claude-seat-switch.js.map +1 -1
  260. package/daemon/dist/domain/provider/provider-service-impl.js +1 -1
  261. package/daemon/dist/domain/provider/provider-service-impl.js.map +1 -1
  262. package/daemon/dist/domain/provider/provider-service.d.ts +32 -2
  263. package/daemon/dist/domain/provider/provider-service.d.ts.map +1 -1
  264. package/daemon/dist/domain/provider/provider-types.d.ts +1 -1
  265. package/daemon/dist/domain/provider/provider-types.d.ts.map +1 -1
  266. package/daemon/dist/domain/queue-repository.d.ts +36 -5
  267. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  268. package/daemon/dist/domain/queue-repository.js +155 -37
  269. package/daemon/dist/domain/queue-repository.js.map +1 -1
  270. package/daemon/dist/domain/queue-stuck-sweep.d.ts +1 -1
  271. package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
  272. package/daemon/dist/domain/queue-stuck-sweep.js +31 -0
  273. package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
  274. package/daemon/dist/domain/queue-wake-ladder.d.ts +3 -0
  275. package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
  276. package/daemon/dist/domain/queue-wake-ladder.js +124 -25
  277. package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
  278. package/daemon/dist/domain/restore-check-service.d.ts +2 -7
  279. package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
  280. package/daemon/dist/domain/restore-check-service.js.map +1 -1
  281. package/daemon/dist/domain/restore-orchestrator.d.ts +35 -3
  282. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  283. package/daemon/dist/domain/restore-orchestrator.js +166 -21
  284. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  285. package/daemon/dist/domain/resume-metadata-refresher.d.ts +2 -1
  286. package/daemon/dist/domain/resume-metadata-refresher.d.ts.map +1 -1
  287. package/daemon/dist/domain/resume-metadata-refresher.js +20 -6
  288. package/daemon/dist/domain/resume-metadata-refresher.js.map +1 -1
  289. package/daemon/dist/domain/rig-expansion-service.js +1 -1
  290. package/daemon/dist/domain/rig-expansion-service.js.map +1 -1
  291. package/daemon/dist/domain/rig-repository.d.ts +10 -0
  292. package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
  293. package/daemon/dist/domain/rig-repository.js +37 -0
  294. package/daemon/dist/domain/rig-repository.js.map +1 -1
  295. package/daemon/dist/domain/rigspec-codec.d.ts.map +1 -1
  296. package/daemon/dist/domain/rigspec-codec.js +4 -0
  297. package/daemon/dist/domain/rigspec-codec.js.map +1 -1
  298. package/daemon/dist/domain/rigspec-exporter.d.ts +8 -0
  299. package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
  300. package/daemon/dist/domain/rigspec-exporter.js +60 -2
  301. package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
  302. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  303. package/daemon/dist/domain/rigspec-instantiator.js +19 -4
  304. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  305. package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
  306. package/daemon/dist/domain/rigspec-schema.js +24 -1
  307. package/daemon/dist/domain/rigspec-schema.js.map +1 -1
  308. package/daemon/dist/domain/runner-permissions.d.ts +135 -0
  309. package/daemon/dist/domain/runner-permissions.d.ts.map +1 -0
  310. package/daemon/dist/domain/runner-permissions.js +318 -0
  311. package/daemon/dist/domain/runner-permissions.js.map +1 -0
  312. package/daemon/dist/domain/runtime-adapter.d.ts +10 -0
  313. package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
  314. package/daemon/dist/domain/runtime-adapter.js.map +1 -1
  315. package/daemon/dist/domain/seat-effort.d.ts +6 -0
  316. package/daemon/dist/domain/seat-effort.d.ts.map +1 -1
  317. package/daemon/dist/domain/seat-effort.js +0 -2
  318. package/daemon/dist/domain/seat-effort.js.map +1 -1
  319. package/daemon/dist/domain/seat-handover-planner.js +1 -1
  320. package/daemon/dist/domain/seat-handover-planner.js.map +1 -1
  321. package/daemon/dist/domain/seat-handover-service.d.ts +2 -0
  322. package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
  323. package/daemon/dist/domain/seat-handover-service.js +45 -28
  324. package/daemon/dist/domain/seat-handover-service.js.map +1 -1
  325. package/daemon/dist/domain/seat-lifecycle-service.d.ts +24 -2
  326. package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
  327. package/daemon/dist/domain/seat-lifecycle-service.js +62 -1
  328. package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
  329. package/daemon/dist/domain/seat-restart-in-place.d.ts.map +1 -1
  330. package/daemon/dist/domain/seat-restart-in-place.js +6 -1
  331. package/daemon/dist/domain/seat-restart-in-place.js.map +1 -1
  332. package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -1
  333. package/daemon/dist/domain/seat-runtime-switch-service.js +4 -0
  334. package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
  335. package/daemon/dist/domain/seat-skill-storage.d.ts +6 -4
  336. package/daemon/dist/domain/seat-skill-storage.d.ts.map +1 -1
  337. package/daemon/dist/domain/seat-skill-storage.js +25 -5
  338. package/daemon/dist/domain/seat-skill-storage.js.map +1 -1
  339. package/daemon/dist/domain/seat-status-service.d.ts +5 -0
  340. package/daemon/dist/domain/seat-status-service.d.ts.map +1 -1
  341. package/daemon/dist/domain/seat-status-service.js +9 -0
  342. package/daemon/dist/domain/seat-status-service.js.map +1 -1
  343. package/daemon/dist/domain/self-attach-service.d.ts +8 -1
  344. package/daemon/dist/domain/self-attach-service.d.ts.map +1 -1
  345. package/daemon/dist/domain/self-attach-service.js +26 -0
  346. package/daemon/dist/domain/self-attach-service.js.map +1 -1
  347. package/daemon/dist/domain/session-transport.d.ts +10 -0
  348. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  349. package/daemon/dist/domain/session-transport.js +112 -10
  350. package/daemon/dist/domain/session-transport.js.map +1 -1
  351. package/daemon/dist/domain/snapshot-capture.d.ts.map +1 -1
  352. package/daemon/dist/domain/snapshot-capture.js +14 -0
  353. package/daemon/dist/domain/snapshot-capture.js.map +1 -1
  354. package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
  355. package/daemon/dist/domain/startup-orchestrator.js +32 -1
  356. package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
  357. package/daemon/dist/domain/successor-session-launcher.d.ts +1 -0
  358. package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
  359. package/daemon/dist/domain/successor-session-launcher.js +1 -0
  360. package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
  361. package/daemon/dist/domain/terminal/herdr-follow-view.d.ts.map +1 -1
  362. package/daemon/dist/domain/terminal/herdr-follow-view.js +22 -4
  363. package/daemon/dist/domain/terminal/herdr-follow-view.js.map +1 -1
  364. package/daemon/dist/domain/terminal/scope-task-terminal-view.d.ts +12 -1
  365. package/daemon/dist/domain/terminal/scope-task-terminal-view.d.ts.map +1 -1
  366. package/daemon/dist/domain/terminal/scope-task-terminal-view.js +120 -18
  367. package/daemon/dist/domain/terminal/scope-task-terminal-view.js.map +1 -1
  368. package/daemon/dist/domain/terminal/terminal-following.js +1 -1
  369. package/daemon/dist/domain/terminal/terminal-following.js.map +1 -1
  370. package/daemon/dist/domain/terminal/terminal-provider.d.ts +2 -0
  371. package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
  372. package/daemon/dist/domain/terminal/terminal-service.d.ts +3 -2
  373. package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
  374. package/daemon/dist/domain/terminal/terminal-service.js +18 -27
  375. package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
  376. package/daemon/dist/domain/terminal/view-composer.d.ts +6 -3
  377. package/daemon/dist/domain/terminal/view-composer.d.ts.map +1 -1
  378. package/daemon/dist/domain/terminal/view-composer.js +15 -5
  379. package/daemon/dist/domain/terminal/view-composer.js.map +1 -1
  380. package/daemon/dist/domain/tmux-server-selection.d.ts +47 -0
  381. package/daemon/dist/domain/tmux-server-selection.d.ts.map +1 -0
  382. package/daemon/dist/domain/tmux-server-selection.js +220 -0
  383. package/daemon/dist/domain/tmux-server-selection.js.map +1 -0
  384. package/daemon/dist/domain/transcript-store.d.ts.map +1 -1
  385. package/daemon/dist/domain/transcript-store.js +8 -5
  386. package/daemon/dist/domain/transcript-store.js.map +1 -1
  387. package/daemon/dist/domain/types.d.ts +38 -0
  388. package/daemon/dist/domain/types.d.ts.map +1 -1
  389. package/daemon/dist/domain/types.js.map +1 -1
  390. package/daemon/dist/domain/user-settings/settings-browser.d.ts.map +1 -1
  391. package/daemon/dist/domain/user-settings/settings-browser.js +3 -1
  392. package/daemon/dist/domain/user-settings/settings-browser.js.map +1 -1
  393. package/daemon/dist/domain/user-settings/settings-store.d.ts +1 -1
  394. package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
  395. package/daemon/dist/domain/user-settings/settings-store.js +9 -0
  396. package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
  397. package/daemon/dist/domain/watchdog-delivery.d.ts +1 -0
  398. package/daemon/dist/domain/watchdog-delivery.d.ts.map +1 -1
  399. package/daemon/dist/domain/watchdog-delivery.js +15 -3
  400. package/daemon/dist/domain/watchdog-delivery.js.map +1 -1
  401. package/daemon/dist/domain/watchdog-policy-engine.d.ts +2 -0
  402. package/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -1
  403. package/daemon/dist/domain/watchdog-policy-engine.js +3 -1
  404. package/daemon/dist/domain/watchdog-policy-engine.js.map +1 -1
  405. package/daemon/dist/domain/workflow-runtime.d.ts +1 -1
  406. package/daemon/dist/index.d.ts +4 -0
  407. package/daemon/dist/index.d.ts.map +1 -1
  408. package/daemon/dist/index.js +14 -0
  409. package/daemon/dist/index.js.map +1 -1
  410. package/daemon/dist/routes/activity.d.ts +4 -0
  411. package/daemon/dist/routes/activity.d.ts.map +1 -1
  412. package/daemon/dist/routes/activity.js +258 -18
  413. package/daemon/dist/routes/activity.js.map +1 -1
  414. package/daemon/dist/routes/compaction.js +4 -2
  415. package/daemon/dist/routes/compaction.js.map +1 -1
  416. package/daemon/dist/routes/environments.d.ts +3 -0
  417. package/daemon/dist/routes/environments.d.ts.map +1 -0
  418. package/daemon/dist/routes/environments.js +104 -0
  419. package/daemon/dist/routes/environments.js.map +1 -0
  420. package/daemon/dist/routes/hosts.d.ts.map +1 -1
  421. package/daemon/dist/routes/hosts.js +80 -4
  422. package/daemon/dist/routes/hosts.js.map +1 -1
  423. package/daemon/dist/routes/provider.d.ts.map +1 -1
  424. package/daemon/dist/routes/provider.js +53 -7
  425. package/daemon/dist/routes/provider.js.map +1 -1
  426. package/daemon/dist/routes/restore-check.d.ts.map +1 -1
  427. package/daemon/dist/routes/restore-check.js +5 -19
  428. package/daemon/dist/routes/restore-check.js.map +1 -1
  429. package/daemon/dist/routes/rigs.js +3 -0
  430. package/daemon/dist/routes/rigs.js.map +1 -1
  431. package/daemon/dist/routes/rigspec.d.ts.map +1 -1
  432. package/daemon/dist/routes/rigspec.js +8 -3
  433. package/daemon/dist/routes/rigspec.js.map +1 -1
  434. package/daemon/dist/routes/seat.d.ts.map +1 -1
  435. package/daemon/dist/routes/seat.js +29 -2
  436. package/daemon/dist/routes/seat.js.map +1 -1
  437. package/daemon/dist/routes/sessions.d.ts.map +1 -1
  438. package/daemon/dist/routes/sessions.js +66 -20
  439. package/daemon/dist/routes/sessions.js.map +1 -1
  440. package/daemon/dist/routes/transport.d.ts.map +1 -1
  441. package/daemon/dist/routes/transport.js +23 -2
  442. package/daemon/dist/routes/transport.js.map +1 -1
  443. package/daemon/dist/server.d.ts +6 -0
  444. package/daemon/dist/server.d.ts.map +1 -1
  445. package/daemon/dist/server.js +56 -1
  446. package/daemon/dist/server.js.map +1 -1
  447. package/daemon/dist/startup.d.ts +2 -0
  448. package/daemon/dist/startup.d.ts.map +1 -1
  449. package/daemon/dist/startup.js +61 -26
  450. package/daemon/dist/startup.js.map +1 -1
  451. package/daemon/docs/reference/agent-startup-guide.md +4 -0
  452. package/daemon/docs/reference/author-contracts.md +6 -6
  453. package/daemon/docs/reference/community-harness-examples/dsh/README.md +71 -0
  454. package/daemon/docs/reference/community-harness-examples/dsh/dsh.yaml +20 -0
  455. package/daemon/docs/reference/community-harness-examples/dsh/openrig-dsh-runner.mjs +543 -0
  456. package/daemon/docs/reference/community-harness-examples/openshell/README.md +5 -0
  457. package/daemon/docs/reference/community-harness-presets.md +25 -1
  458. package/daemon/docs/reference/execution-platform-contract.md +1 -1
  459. package/daemon/docs/reference/getting-started.md +8 -3
  460. package/daemon/docs/reference/harness-runner-contract.md +151 -16
  461. package/daemon/docs/reference/pi-tool-selection-recovery.md +83 -0
  462. package/daemon/docs/reference/quickstart.md +1 -1
  463. package/daemon/docs/reference/rig-spec.md +69 -12
  464. package/daemon/docs/reference/runner-conformance/README.md +75 -0
  465. package/daemon/docs/reference/runner-conformance/check-runner.mjs +698 -0
  466. package/daemon/docs/reference/runner-conformance/fake-acp-agent.mjs +143 -0
  467. package/daemon/docs/reference/terminal-sessions.md +85 -9
  468. package/daemon/docs/reference/tmux-servers.md +166 -0
  469. package/daemon/docs/reference/whats-new.md +119 -15
  470. package/dist/acp/connector.d.ts.map +1 -1
  471. package/dist/acp/connector.js +6 -1
  472. package/dist/acp/connector.js.map +1 -1
  473. package/dist/build-info.js +3 -3
  474. package/dist/client.d.ts +3 -0
  475. package/dist/client.d.ts.map +1 -1
  476. package/dist/client.js +28 -0
  477. package/dist/client.js.map +1 -1
  478. package/dist/commands/attach.d.ts +1 -0
  479. package/dist/commands/attach.d.ts.map +1 -1
  480. package/dist/commands/attach.js +8 -2
  481. package/dist/commands/attach.js.map +1 -1
  482. package/dist/commands/compact.d.ts.map +1 -1
  483. package/dist/commands/compact.js +7 -4
  484. package/dist/commands/compact.js.map +1 -1
  485. package/dist/commands/config.d.ts.map +1 -1
  486. package/dist/commands/config.js +8 -3
  487. package/dist/commands/config.js.map +1 -1
  488. package/dist/commands/daemon.d.ts.map +1 -1
  489. package/dist/commands/daemon.js +7 -1
  490. package/dist/commands/daemon.js.map +1 -1
  491. package/dist/commands/destroy.d.ts.map +1 -1
  492. package/dist/commands/destroy.js +2 -0
  493. package/dist/commands/destroy.js.map +1 -1
  494. package/dist/commands/doctor.d.ts +8 -1
  495. package/dist/commands/doctor.d.ts.map +1 -1
  496. package/dist/commands/doctor.js +79 -5
  497. package/dist/commands/doctor.js.map +1 -1
  498. package/dist/commands/env.js +1 -1
  499. package/dist/commands/env.js.map +1 -1
  500. package/dist/commands/environment.d.ts +8 -0
  501. package/dist/commands/environment.d.ts.map +1 -0
  502. package/dist/commands/environment.js +194 -0
  503. package/dist/commands/environment.js.map +1 -0
  504. package/dist/commands/export.d.ts.map +1 -1
  505. package/dist/commands/export.js +5 -2
  506. package/dist/commands/export.js.map +1 -1
  507. package/dist/commands/host.d.ts.map +1 -1
  508. package/dist/commands/host.js +77 -7
  509. package/dist/commands/host.js.map +1 -1
  510. package/dist/commands/provider.d.ts.map +1 -1
  511. package/dist/commands/provider.js +2 -0
  512. package/dist/commands/provider.js.map +1 -1
  513. package/dist/commands/queue.d.ts.map +1 -1
  514. package/dist/commands/queue.js +12 -2
  515. package/dist/commands/queue.js.map +1 -1
  516. package/dist/commands/seat.d.ts.map +1 -1
  517. package/dist/commands/seat.js +54 -4
  518. package/dist/commands/seat.js.map +1 -1
  519. package/dist/commands/setup.d.ts.map +1 -1
  520. package/dist/commands/setup.js +18 -0
  521. package/dist/commands/setup.js.map +1 -1
  522. package/dist/commands/terminal.d.ts +2 -0
  523. package/dist/commands/terminal.d.ts.map +1 -1
  524. package/dist/commands/terminal.js +31 -2
  525. package/dist/commands/terminal.js.map +1 -1
  526. package/dist/commands/tui.d.ts +3 -2
  527. package/dist/commands/tui.d.ts.map +1 -1
  528. package/dist/commands/tui.js.map +1 -1
  529. package/dist/config-store.d.ts +3 -1
  530. package/dist/config-store.d.ts.map +1 -1
  531. package/dist/config-store.js +10 -0
  532. package/dist/config-store.js.map +1 -1
  533. package/dist/cross-host-target.d.ts.map +1 -1
  534. package/dist/cross-host-target.js +3 -1
  535. package/dist/cross-host-target.js.map +1 -1
  536. package/dist/daemon-lifecycle.d.ts +6 -0
  537. package/dist/daemon-lifecycle.d.ts.map +1 -1
  538. package/dist/daemon-lifecycle.js +66 -4
  539. package/dist/daemon-lifecycle.js.map +1 -1
  540. package/dist/daemon-reachability.d.ts +2 -1
  541. package/dist/daemon-reachability.d.ts.map +1 -1
  542. package/dist/daemon-reachability.js +3 -2
  543. package/dist/daemon-reachability.js.map +1 -1
  544. package/dist/destroy-helpers.d.ts +3 -2
  545. package/dist/destroy-helpers.d.ts.map +1 -1
  546. package/dist/destroy-helpers.js +6 -3
  547. package/dist/destroy-helpers.js.map +1 -1
  548. package/dist/host-bindings.js +1 -1
  549. package/dist/host-bindings.js.map +1 -1
  550. package/dist/host-registry.d.ts +22 -0
  551. package/dist/host-registry.d.ts.map +1 -1
  552. package/dist/host-registry.js +121 -0
  553. package/dist/host-registry.js.map +1 -1
  554. package/dist/index.d.ts +2 -0
  555. package/dist/index.d.ts.map +1 -1
  556. package/dist/index.js +2 -0
  557. package/dist/index.js.map +1 -1
  558. package/dist/lazy-program.d.ts.map +1 -1
  559. package/dist/lazy-program.js +1 -0
  560. package/dist/lazy-program.js.map +1 -1
  561. package/dist/mcp-server.d.ts.map +1 -1
  562. package/dist/mcp-server.js +36 -2
  563. package/dist/mcp-server.js.map +1 -1
  564. package/dist/openrig-compat.d.ts +1 -1
  565. package/dist/openrig-compat.d.ts.map +1 -1
  566. package/dist/openrig-compat.js +2 -2
  567. package/dist/openrig-compat.js.map +1 -1
  568. package/dist/shared-tui.d.ts +4 -2
  569. package/dist/shared-tui.d.ts.map +1 -1
  570. package/dist/shared-tui.js +4 -11
  571. package/dist/shared-tui.js.map +1 -1
  572. package/dist/terminal-window.d.ts.map +1 -1
  573. package/dist/terminal-window.js +34 -29
  574. package/dist/terminal-window.js.map +1 -1
  575. package/dist/tmux-attachment.d.ts +17 -0
  576. package/dist/tmux-attachment.d.ts.map +1 -0
  577. package/dist/tmux-attachment.js +89 -0
  578. package/dist/tmux-attachment.js.map +1 -0
  579. package/package.json +2 -2
  580. package/tui/dist/hydrate.d.ts.map +1 -1
  581. package/tui/dist/hydrate.js +8 -3
  582. package/tui/dist/hydrate.js.map +1 -1
  583. package/tui/dist/render.d.ts.map +1 -1
  584. package/tui/dist/render.js +7 -1
  585. package/tui/dist/render.js.map +1 -1
  586. package/tui/dist/terminals/terminal-model.d.ts.map +1 -1
  587. package/tui/dist/terminals/terminal-model.js +2 -1
  588. package/tui/dist/terminals/terminal-model.js.map +1 -1
  589. package/ui/dist/assets/{index-CMBgYrS7.js → index-Ch6UxNld.js} +88 -88
  590. package/ui/dist/index.html +1 -1
@@ -0,0 +1,20 @@
1
+ # Install as $OPENRIG_HOME/community-harnesses/dsh.yaml, with openrig-dsh-runner.mjs (executable) on the seat's PATH.
2
+ format: 1
3
+ name: dsh
4
+ command: openrig-dsh-runner.mjs
5
+ maintainer: Your name or team
6
+ runner: true
7
+ launch_result: true
8
+ first_input: true
9
+ limits:
10
+ - written for dsh 0.2.1-rc.2 (npm @deepseek-ai/dsh) over ACP protocol 1, with Node 22 or later, and checked against a stand-in agent only
11
+ - each seat gets its own dsh home under $OPENRIG_HOME/state/dsh/<node>/home, holding a patch that turns off dsh's session-log and plugin-list uploads to DeepSeek; give it credentials (.credentials.yaml there) or a provider key in the seat's env
12
+ - DSH_PERMISSION_MODE defaults to workspace-write; a permission request goes to the default person or the seat's override (rig seat set-permissions-to), is permitted with dsh's allow_once (else allow_always) when no one can be asked or OpenRig can't answer, and is refused and held as needs input only after --deny
13
+ - allow_always creates a standing grant in dsh, which OpenRig doesn't record or revoke; the runner prefers allow_once, and where dsh keeps the grant and for how long isn't checked
14
+ - resume isn't declared until a real dsh has reopened a conversation and refused a missing one; the runner reopens by the method dsh advertises and reports missing only on dsh's own not-found error
15
+ - a prompt whose whole text is /abort can't be sent; a Ctrl-C byte inside a paste also aborts; without a TTY, input is read line by line; this isn't a binary-safe channel
16
+ - one prompt at a time; a message that arrives mid-turn waits for the next turn
17
+ - the seat's model isn't passed; dsh uses its own configured model
18
+ - no guidance, skills or startup files are placed; dsh reads its own AGENTS.md and skill folders
19
+ - when the pane closes, the runner cancels a running turn and stops dsh; anything dsh's tools started may keep running
20
+ - fork unsupported
@@ -0,0 +1,543 @@
1
+ #!/usr/bin/env node
2
+ // Example OpenRig runner for DeepSeek Harness (dsh), not installed by OpenRig. Checked against a stand-in agent only;
3
+ // written for dsh 0.2.1-rc.2 (npm @deepseek-ai/dsh), ACP protocol 1 and Node 22 or later. No dependencies.
4
+ //
5
+ // It follows docs/reference/harness-runner-contract.md: it hosts `dsh --profile acp` over ACP on stdio, writes the
6
+ // launch record once the conversation is open, turns each submitted block into one prompt, reports turn boundaries as
7
+ // activity hooks, cancels on /abort or Ctrl-C, and sends permission requests to OpenRig: a person answers, or OpenRig
8
+ // permits when no one can be asked, and so does the runner when OpenRig can't answer (refusing and holding needs input
9
+ // only when the seat opted in to refusal). Copy it and maintain it as your own.
10
+
11
+ import { spawn } from "node:child_process";
12
+ import { existsSync, mkdirSync, readFileSync, realpathSync, renameSync, writeFileSync } from "node:fs";
13
+ import { homedir } from "node:os";
14
+ import { join } from "node:path";
15
+ import { createInterface } from "node:readline";
16
+ import { pathToFileURL } from "node:url";
17
+
18
+ const RUNNER = "openrig-dsh-runner 1";
19
+ const NAME = process.env.OPENRIG_RUNTIME || "dsh"; // the preset's name: OpenRig passes it, and checks the record against it
20
+ const LIVENESS_SECONDS = 60;
21
+ const BEAT_MS = 30_000;
22
+ const ACTIVE_EVERY_MS = 15_000;
23
+ const POST_TIMEOUT_MS = 2_000;
24
+ const WAIT_SECONDS = 25;
25
+ const READ_TRIES = 3; // reads in a row that get no answer before the runner permits
26
+ // Refusals that say the request certainly isn't the seat's current occupant's live one: cancel it, and hold nothing.
27
+ const NOT_LIVE = ["stale_generation", "activity_grant_wrong_seat", "activity_grant_stale"];
28
+ // A read's states that end the request, answered cancelled (an `answered` that reaches there names an option dsh didn't
29
+ // offer). Any other state, like an unlisted status, permits.
30
+ const ENDED = ["refused", "withdrawn", "stale", "answered"];
31
+ const CANCELLED = { outcome: { outcome: "cancelled" } };
32
+ const ACP_RESOURCE_NOT_FOUND = -32002;
33
+
34
+ const PASTE_START = "\x1b[200~";
35
+ const PASTE_END = "\x1b[201~";
36
+
37
+ /** Turns terminal bytes into submitted blocks. Everything up to an Enter outside a paste is one block, line breaks
38
+ * included; a block that is exactly /abort, or a Ctrl-C byte, is the only control. */
39
+ export class InputFramer {
40
+ #buffer = "";
41
+ #pasting = false;
42
+ #partial = "";
43
+
44
+ push(chunk) {
45
+ const events = [];
46
+ const data = this.#partial + chunk;
47
+ this.#partial = "";
48
+ let i = 0;
49
+ while (i < data.length) {
50
+ if (data[i] === "\x1b") {
51
+ const rest = data.slice(i);
52
+ if (rest.startsWith(PASTE_START) || rest.startsWith(PASTE_END)) {
53
+ this.#pasting = rest.startsWith(PASTE_START);
54
+ i += PASTE_START.length;
55
+ continue;
56
+ }
57
+ if (PASTE_START.startsWith(rest) || PASTE_END.startsWith(rest)) { this.#partial = rest; break; }
58
+ if (!this.#pasting) { i += escapeLength(rest); continue; } // arrow keys and the like
59
+ }
60
+ const ch = data[i];
61
+ i += 1;
62
+ if (ch === "\x03") { this.#buffer = ""; this.#pasting = false; events.push({ type: "abort" }); continue; }
63
+ if (this.#pasting) {
64
+ if (ch === "\r") { if (data[i] === "\n") i += 1; this.#buffer += "\n"; } else this.#buffer += ch;
65
+ continue;
66
+ }
67
+ if (ch === "\r" || ch === "\n") {
68
+ const text = this.#buffer;
69
+ this.#buffer = "";
70
+ if (text.trim() === "/abort") events.push({ type: "abort" });
71
+ else if (text.trim()) events.push({ type: "block", text });
72
+ continue;
73
+ }
74
+ if (ch === "\x7f" || ch === "\b") {
75
+ if (this.#buffer) { this.#buffer = this.#buffer.slice(0, -1); events.push({ type: "erase" }); }
76
+ continue;
77
+ }
78
+ if (ch >= " ") { this.#buffer += ch; events.push({ type: "echo", text: ch }); }
79
+ }
80
+ return events;
81
+ }
82
+ }
83
+
84
+ function escapeLength(rest) {
85
+ if (rest[1] === "[") {
86
+ let j = 2;
87
+ while (j < rest.length && !(rest.charCodeAt(j) >= 0x40 && rest.charCodeAt(j) <= 0x7e)) j += 1;
88
+ return Math.min(j + 1, rest.length);
89
+ }
90
+ return rest[1] === "O" ? Math.min(3, rest.length) : 1;
91
+ }
92
+
93
+ /** JSON-RPC 2.0 with the agent, one message per line on its stdio. */
94
+ class AgentPeer {
95
+ #child;
96
+ #next = 1;
97
+ #waiting = new Map();
98
+ #requests = new Map();
99
+ #notifications = new Map();
100
+
101
+ constructor(child, onNoise) {
102
+ this.#child = child;
103
+ createInterface({ input: child.stdout }).on("line", (line) => {
104
+ let message;
105
+ try { message = JSON.parse(line); } catch { message = null; }
106
+ if (!message || typeof message !== "object") { if (line.trim()) onNoise(line); return; }
107
+ if (message.method === undefined) {
108
+ const waiter = this.#waiting.get(message.id);
109
+ if (!waiter) return;
110
+ this.#waiting.delete(message.id);
111
+ if (message.error) waiter.reject(Object.assign(new Error(message.error.message ?? "error"), { code: message.error.code }));
112
+ else waiter.resolve(message.result);
113
+ return;
114
+ }
115
+ if (message.id === undefined) { this.#notifications.get(message.method)?.(message.params ?? {}); return; }
116
+ const handler = this.#requests.get(message.method);
117
+ if (!handler) { this.#write({ id: message.id, error: { code: -32601, message: `Method not found: ${message.method}` } }); return; }
118
+ Promise.resolve().then(() => handler(message.params ?? {}, message.id)).then(
119
+ (result) => this.#write({ id: message.id, result }),
120
+ (error) => this.#write({ id: message.id, error: { code: error.code ?? -32603, message: error.message } }));
121
+ });
122
+ }
123
+
124
+ request(method, params) {
125
+ const id = this.#next++;
126
+ return new Promise((resolve, reject) => { this.#waiting.set(id, { resolve, reject }); this.#write({ id, method, params }); });
127
+ }
128
+
129
+ notify(method, params) { this.#write({ method, params }); }
130
+ onRequest(method, handler) { this.#requests.set(method, handler); }
131
+ onNotification(method, handler) { this.#notifications.set(method, handler); }
132
+
133
+ failAll(reason) {
134
+ for (const waiter of this.#waiting.values()) waiter.reject(new Error(reason));
135
+ this.#waiting.clear();
136
+ }
137
+
138
+ #write(message) {
139
+ if (this.#child.stdin.writable) this.#child.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", ...message })}\n`);
140
+ }
141
+ }
142
+
143
+ const openrigHome = () => process.env.OPENRIG_HOME || join(homedir(), ".openrig");
144
+
145
+ /** The daemon's base URL and the seat's token: from the environment, else from activity-endpoint.json. */
146
+ function openrigEndpoint() {
147
+ const env = process.env;
148
+ let base = env.OPENRIG_URL || (env.OPENRIG_PORT ? `http://${env.OPENRIG_HOST || "127.0.0.1"}:${env.OPENRIG_PORT}` : "");
149
+ let token = env.OPENRIG_ACTIVITY_HOOK_TOKEN || "";
150
+ if (!base || !token) {
151
+ try {
152
+ const file = JSON.parse(readFileSync(join(openrigHome(), "activity-endpoint.json"), "utf8"));
153
+ base ||= file.baseUrl ?? "";
154
+ token ||= file.token ?? "";
155
+ } catch { /* no daemon has written one yet */ }
156
+ }
157
+ return base && token ? { base: base.replace(/\/+$/, ""), token } : null;
158
+ }
159
+
160
+ async function callOpenRig(method, path, body, timeoutMs) {
161
+ const endpoint = openrigEndpoint();
162
+ if (!endpoint) return { status: 0, body: null };
163
+ try {
164
+ const response = await fetch(`${endpoint.base}${path}`, {
165
+ method, signal: AbortSignal.timeout(timeoutMs),
166
+ headers: { authorization: `Bearer ${endpoint.token}`, ...(body ? { "content-type": "application/json" } : {}) },
167
+ ...(body ? { body: JSON.stringify(body) } : {}),
168
+ });
169
+ let parsed = null;
170
+ try { parsed = await response.json(); } catch { /* not JSON */ }
171
+ return { status: response.status, body: parsed };
172
+ } catch {
173
+ return { status: 0, body: null };
174
+ }
175
+ }
176
+
177
+ /** Activity posts go one at a time, in order, and never hold up the agent. */
178
+ class Activity {
179
+ #sequence = 0;
180
+ #chain = Promise.resolve();
181
+
182
+ constructor(identity) { this.identity = identity; }
183
+
184
+ post(hookEvent, subtype, extra = {}) {
185
+ const body = { ...this.identity, sequence: ++this.#sequence, occurredAt: new Date().toISOString(), hookEvent, subtype, ...extra };
186
+ this.#chain = this.#chain.then(() => callOpenRig("POST", "/api/activity/hooks", body, POST_TIMEOUT_MS)).then(() => {}, () => {});
187
+ }
188
+
189
+ flushed() { return this.#chain; }
190
+ }
191
+
192
+ const UPLOADS_OFF = [
193
+ "# Written by openrig-dsh-runner for this seat; safe to edit, and an existing file is left alone.",
194
+ "# Don't attach this seat's session log, or its plugin package names and versions, to DeepSeek API requests.",
195
+ "- id: session-log-deepseek",
196
+ " config:",
197
+ " enabled: false",
198
+ "- id: plugin-package-inventory-deepseek",
199
+ " config:",
200
+ " enabled: false",
201
+ "",
202
+ ].join("\n");
203
+
204
+ /** Each seat gets its own writable dsh home (dsh rewrites its profile there on every start). OPENRIG_DSH_HOME names
205
+ * one you prepared yourself, which is used as it is. */
206
+ function seatHome() {
207
+ if (process.env.OPENRIG_DSH_HOME) return process.env.OPENRIG_DSH_HOME;
208
+ const seat = process.env.OPENRIG_NODE_ID || process.env.OPENRIG_SESSION_NAME || "default";
209
+ const home = join(openrigHome(), "state", "dsh", seat, "home");
210
+ mkdirSync(home, { recursive: true, mode: 0o700 });
211
+ const patch = join(home, "cordis.patch.yml");
212
+ if (!existsSync(patch)) writeFileSync(patch, UPLOADS_OFF, { mode: 0o600 });
213
+ return home;
214
+ }
215
+
216
+ function writeLaunchRecord(fields) {
217
+ const path = process.env.OPENRIG_LAUNCH_RESULT;
218
+ if (!path) return;
219
+ const record = { format: 1, attempt: process.env.OPENRIG_LAUNCH_ATTEMPT, harness: NAME, ...fields };
220
+ const temp = `${path}.${process.pid}.tmp`;
221
+ writeFileSync(temp, `${JSON.stringify(record)}\n`, { mode: 0o600 });
222
+ renameSync(temp, path);
223
+ }
224
+
225
+ const sleep = (ms) => new Promise((done) => setTimeout(done, ms));
226
+ const say = (line) => process.stdout.write(`${line}\n`);
227
+ const firstLine = (text) => {
228
+ const lines = text.split("\n");
229
+ return lines.length > 1 ? `${lines[0]} … (+${lines.length - 1} lines)` : lines[0];
230
+ };
231
+
232
+ async function main() {
233
+ const env = process.env;
234
+ const cwd = process.cwd();
235
+ let firstInput = null;
236
+ if (env.OPENRIG_FIRST_INPUT) {
237
+ try { firstInput = readFileSync(env.OPENRIG_FIRST_INPUT, "utf8"); } catch (error) {
238
+ console.error(`openrig-dsh-runner: the first startup turn couldn't be read (${error.message}); not starting`);
239
+ process.exit(2);
240
+ }
241
+ }
242
+
243
+ const home = seatHome();
244
+ const activity = new Activity({ sessionName: env.OPENRIG_SESSION_NAME, nodeId: env.OPENRIG_NODE_ID,
245
+ runtime: NAME, generation: env.OPENRIG_OCCUPANT_GENERATION });
246
+ const agentEnv = { ...env, DSH_HOME: home };
247
+ delete agentEnv.OPENRIG_ACTIVITY_HOOK_TOKEN; // dsh's shell tool inherits this environment
248
+ agentEnv.DSH_PERMISSION_MODE ??= "workspace-write";
249
+ if (agentEnv.DSH_TELEMETRY_DISABLED === undefined && agentEnv.DSH_TELEMETRY_MODE === undefined) agentEnv.DSH_TELEMETRY_DISABLED = "1";
250
+
251
+ const child = spawn(env.OPENRIG_DSH || "dsh", ["--profile", "acp"], { cwd, env: agentEnv, stdio: ["pipe", "pipe", "inherit"] });
252
+ child.stdin.on("error", () => {});
253
+ const peer = new AgentPeer(child, (line) => say(`[dsh] ${line}`));
254
+ const state = { sessionId: null, turn: 0, running: false, cancelRequestedAt: null, holding: false, refused: false, queue: [], asks: new Set(), lastActive: 0 };
255
+ const inflight = new Set();
256
+ const track = (promise) => { inflight.add(promise); promise.finally(() => inflight.delete(promise)); return promise; };
257
+ let agentExited = false;
258
+ let stopping = false;
259
+ let heartbeat;
260
+ let tty = false;
261
+
262
+ const restoreTty = () => {
263
+ if (!tty) return;
264
+ tty = false;
265
+ process.stdout.write("\x1b[?2004l");
266
+ try { process.stdin.setRawMode(false); } catch { /* already closed */ }
267
+ };
268
+ const finish = async (code) => {
269
+ clearInterval(heartbeat);
270
+ restoreTty();
271
+ await Promise.race([Promise.allSettled([...inflight, activity.flushed()]), sleep(2_000)]);
272
+ process.exit(code);
273
+ };
274
+ const fatal = async (message, code) => {
275
+ stopping = true;
276
+ say(`[openrig-dsh] ${message}`);
277
+ if (!agentExited) {
278
+ child.kill("SIGTERM");
279
+ await Promise.race([new Promise((done) => child.once("exit", done)), sleep(3_000)]);
280
+ }
281
+ await finish(code);
282
+ };
283
+ const postIdle = (subtype) => activity.post("Stop", subtype, { livenessSeconds: LIVENESS_SECONDS });
284
+ const withdraw = (askId, reason) => track(callOpenRig("POST", `/api/activity/permission-requests/${encodeURIComponent(askId)}/withdraw`, { reason }, POST_TIMEOUT_MS));
285
+
286
+ child.once("error", (error) => { agentExited = true; void fatal(`dsh couldn't be started (${error.message}); is it on PATH?`, 1); });
287
+ child.on("exit", (code, signal) => {
288
+ agentExited = true;
289
+ peer.failAll("dsh exited");
290
+ if (stopping) return;
291
+ for (const ask of state.asks) ask.end("exited");
292
+ say(`\n[openrig-dsh] dsh exited (code ${code ?? "none"}, signal ${signal ?? "none"})`);
293
+ activity.post("Stop", `${NAME}_exited`);
294
+ void finish(code === 0 ? 0 : 1);
295
+ });
296
+
297
+ peer.onNotification("session/update", (params) => {
298
+ if (params.sessionId !== state.sessionId || !params.update) return;
299
+ const update = params.update;
300
+ const reporting = state.running && !state.holding; // while needs input is held, nothing may read working
301
+ if (update.sessionUpdate === "agent_message_chunk") {
302
+ if (update.content?.type === "text") process.stdout.write(update.content.text);
303
+ if (reporting && Date.now() - state.lastActive >= ACTIVE_EVERY_MS) { state.lastActive = Date.now(); activity.post("active", "agent_message"); }
304
+ } else if (update.sessionUpdate === "tool_call") {
305
+ say(`\n[tool] ${update.title ?? "tool"} (${update.kind ?? "other"})`);
306
+ if (reporting) activity.post("PreToolUse", String(update.kind ?? "other"));
307
+ }
308
+ });
309
+
310
+ const refuse = (why) => {
311
+ state.holding = true;
312
+ state.refused = true; // the seat's own refusal holds needs input until the next prompt
313
+ say(`[permission] refused: ${why}. The seat reads needs input until the next prompt.`);
314
+ activity.post("Notification", "permission_prompt", { turnId: String(state.turn) });
315
+ return CANCELLED;
316
+ };
317
+
318
+ // The answered path: OpenRig opens one ask to the default person (or the seat's override, `rig seat
319
+ // set-permissions-to`), and the runner reads the answer back for this same live request. With no one to ask, OpenRig
320
+ // permits at once, and so does the runner when OpenRig can't answer. Only the seat's opt-in (`--deny`) refuses; a
321
+ // request OpenRig says isn't the current occupant's, or that a person said no to with no reject option, is cancelled.
322
+ const askOwner = async (requestId, toolCall, options) => {
323
+ const turn = state.turn;
324
+ const live = () => state.running && state.turn === turn && !state.cancelRequestedAt && !agentExited;
325
+ const submitted = await callOpenRig("POST", "/api/activity/permission-requests", {
326
+ sessionName: env.OPENRIG_SESSION_NAME, nodeId: env.OPENRIG_NODE_ID, generation: env.OPENRIG_OCCUPANT_GENERATION,
327
+ nativeRef: state.sessionId, turnId: String(turn), requestId: String(requestId), toolCall,
328
+ options: options.map((option) => ({ optionId: option.optionId, name: option.name ?? option.optionId, kind: option.kind })),
329
+ occurredAt: new Date().toISOString(),
330
+ }, 10_000);
331
+ const askId = submitted.body?.ok ? submitted.body.askId : undefined;
332
+ if (!live()) {
333
+ if (askId) withdraw(askId, state.cancelRequestedAt ? "turn_cancelled" : agentExited ? "exited" : "turn_ended");
334
+ return CANCELLED;
335
+ }
336
+ const offered = (optionId) => options.some((option) => option.optionId === optionId);
337
+ // No one can be asked: OpenRig's default is permit, with the agent's own allow option.
338
+ if (submitted.body?.ok && submitted.body.state === "permitted" && offered(submitted.body.optionId)) {
339
+ say(`[permission] permitted: ${submitted.body.reason ?? "no one can be asked"} (${submitted.body.optionId})`);
340
+ return { outcome: { outcome: "selected", optionId: submitted.body.optionId } };
341
+ }
342
+ // When OpenRig can't answer, nobody can be asked either, so the same default applies. allow_once is preferred, so
343
+ // dsh doesn't remember a permission nobody chose.
344
+ const allow = options.find((option) => option.kind === "allow_once") ?? options.find((option) => option.kind === "allow_always");
345
+ const permit = (why) => {
346
+ if (!allow) return refuse(`${why}, and the agent offered no allow option`);
347
+ state.holding = false;
348
+ say(`[permission] permitted: ${why} (${allow.optionId})`);
349
+ return { outcome: { outcome: "selected", optionId: allow.optionId } };
350
+ };
351
+ if (!askId) {
352
+ if (submitted.body?.code === "denied_by_seat") return refuse("the seat's operator chose to refuse its permission requests");
353
+ if (NOT_LIVE.includes(submitted.body?.code)) {
354
+ say(`[permission] cancelled: OpenRig says this isn't the seat's current request (${submitted.body.code})`);
355
+ return CANCELLED;
356
+ }
357
+ return permit(submitted.status === 404 ? "this OpenRig has no answered path"
358
+ : submitted.status === 0 ? "OpenRig couldn't be reached" : `OpenRig couldn't ask anyone (${submitted.body?.code ?? submitted.status})`);
359
+ }
360
+ state.holding = true; // OpenRig recorded the seat's permission prompt when it opened the ask
361
+ say(`[permission] OpenRig asked a person (${askId}); waiting for their answer`);
362
+ return new Promise((resolve) => {
363
+ let done = false; // the agent has its answer
364
+ let ended = false; // OpenRig was told the request is over
365
+ const ask = { end: (reason) => {
366
+ if (ended) return;
367
+ ended = true;
368
+ state.asks.delete(ask);
369
+ withdraw(askId, reason);
370
+ if (done) return;
371
+ done = true;
372
+ if (!state.refused) state.holding = false; // the turn ended the person's ask: no one is still being asked
373
+ resolve(CANCELLED);
374
+ } };
375
+ state.asks.add(ask);
376
+ void (async () => {
377
+ let unanswered = 0;
378
+ while (!done) {
379
+ const read = await callOpenRig("GET", `/api/activity/permission-requests/${encodeURIComponent(askId)}?waitSeconds=${WAIT_SECONDS}`, null, (WAIT_SECONDS + 10) * 1_000);
380
+ if (done) return;
381
+ if (read.status === 0 && ++unanswered < READ_TRIES) { await sleep(2_000); continue; }
382
+ if (read.status === 200 && read.body?.state === "pending") { unanswered = 0; continue; }
383
+ done = true;
384
+ const answer = read.body ?? {};
385
+ // A person's option, or OpenRig's permit when they closed it without one.
386
+ if ((answer.state === "answered" || answer.state === "permitted") && offered(answer.optionId) && live()) {
387
+ state.asks.delete(ask);
388
+ state.holding = false;
389
+ say(`[permission] ${answer.state}: ${answer.optionId}`);
390
+ resolve({ outcome: { outcome: "selected", optionId: answer.optionId } });
391
+ } else if (live() && (read.status === 200 ? !ENDED.includes(answer.state) : !NOT_LIVE.includes(answer.code))) {
392
+ // OpenRig stopped answering, or answered in a way the contract doesn't list: nobody can be asked. The ask stays
393
+ // tracked, so the turn's end still withdraws it.
394
+ resolve(permit(read.status === 0 ? "OpenRig couldn't be reached" : `OpenRig couldn't answer (${answer.code ?? read.status})`));
395
+ } else {
396
+ state.asks.delete(ask);
397
+ state.holding = false; // a person said no, or the request is over: no one is still waiting
398
+ say(`[permission] not answered (${answer.reason ?? answer.state ?? answer.code ?? read.status}); answered cancelled`);
399
+ resolve(CANCELLED);
400
+ }
401
+ }
402
+ })();
403
+ });
404
+ };
405
+
406
+ peer.onRequest("session/request_permission", (params, requestId) => {
407
+ if (params.sessionId !== state.sessionId) throw Object.assign(new Error(`no turn of conversation ${params.sessionId} runs here`), { code: -32602 });
408
+ const toolCall = { title: String(params.toolCall?.title ?? "a tool call"), kind: String(params.toolCall?.kind ?? "other") };
409
+ const options = Array.isArray(params.options) ? params.options : [];
410
+ say(`\n[permission] dsh asks: ${toolCall.title} (${toolCall.kind}); options ${options.map((option) => option.optionId).join(", ")}`);
411
+ if (!state.running || state.cancelRequestedAt) return CANCELLED;
412
+ return askOwner(requestId, toolCall, options);
413
+ });
414
+
415
+ const abort = () => {
416
+ if (!state.running) { say("[openrig-dsh] no turn is running"); return; }
417
+ if (state.cancelRequestedAt) return;
418
+ state.cancelRequestedAt = new Date().toISOString();
419
+ peer.notify("session/cancel", { sessionId: state.sessionId });
420
+ say(`\n[openrig-dsh] cancel requested at ${state.cancelRequestedAt}; the turn ends when dsh says so`);
421
+ if (!state.refused) state.holding = false; // the seat's own refusal holds until the next accepted prompt
422
+ for (const ask of state.asks) ask.end("turn_cancelled");
423
+ };
424
+
425
+ const runTurn = async (text) => {
426
+ state.running = true;
427
+ state.turn += 1;
428
+ state.holding = false;
429
+ state.refused = false;
430
+ state.cancelRequestedAt = null;
431
+ state.lastActive = 0;
432
+ const turnId = String(state.turn);
433
+ say(`\nyou ▸ ${firstLine(text)}`);
434
+ activity.post("UserPromptSubmit", "accepted", { turnId });
435
+ let stopReason;
436
+ try {
437
+ const result = await peer.request("session/prompt", { sessionId: state.sessionId, prompt: [{ type: "text", text }] });
438
+ stopReason = String(result?.stopReason ?? "unreported");
439
+ } catch (error) {
440
+ if (agentExited) return;
441
+ say(`\n[openrig-dsh] the turn failed: ${error.message}`);
442
+ activity.post("Notification", "runtime_error", { turnId });
443
+ stopReason = "error";
444
+ }
445
+ state.running = false;
446
+ for (const ask of state.asks) ask.end("turn_ended");
447
+ say(`\n── turn end (${stopReason}) ──`);
448
+ if (state.holding) say("[openrig-dsh] a permission request was refused, so the seat reads needs input until the next prompt");
449
+ else postIdle(stopReason);
450
+ pump();
451
+ };
452
+
453
+ const pump = () => {
454
+ if (state.running || agentExited || state.queue.length === 0) return;
455
+ void runTurn(state.queue.shift());
456
+ };
457
+
458
+ const submit = (text) => {
459
+ if (agentExited) return;
460
+ state.queue.push(text);
461
+ if (state.running) say(`[queued: ${state.queue.length}] this goes to dsh after the current turn`);
462
+ pump();
463
+ };
464
+
465
+ // Handshake, then open or reopen the conversation, then report it. Nothing is read as ready before this.
466
+ let init;
467
+ try {
468
+ init = await peer.request("initialize", { protocolVersion: 1, clientCapabilities: {}, clientInfo: { name: "openrig-dsh-runner", version: "1" } });
469
+ } catch (error) {
470
+ return fatal(`dsh didn't complete the ACP handshake (${error.message})`, 1);
471
+ }
472
+ const capabilities = init?.agentCapabilities ?? {};
473
+ const producer = `${RUNNER}; dsh ${init?.agentInfo?.version ?? "(version not reported)"}; ACP ${init?.protocolVersion ?? "?"}`;
474
+ const resumeRef = env.OPENRIG_RESUME_REF;
475
+ if (resumeRef) {
476
+ // The method dsh advertises; with neither advertised, session/resume, the method dsh 0.2.1-rc.2 answered in its
477
+ // maintainer's checks. Only dsh's own "not found" counts as missing; anything else leaves the resume unconfirmed.
478
+ const method = capabilities.sessionCapabilities?.resume ? "session/resume" : capabilities.loadSession ? "session/load" : "session/resume";
479
+ try {
480
+ await peer.request(method, { sessionId: resumeRef, cwd, mcpServers: [] });
481
+ } catch (error) {
482
+ if (error.code === ACP_RESOURCE_NOT_FOUND) {
483
+ writeLaunchRecord({ error: "missing", producer });
484
+ return fatal(`dsh says conversation ${resumeRef} doesn't exist (${error.message}); no new one was started`, 3);
485
+ }
486
+ return fatal(`dsh couldn't reopen conversation ${resumeRef} (${method}: ${error.message}); the resume is unconfirmed and no new conversation was started`, 4);
487
+ }
488
+ state.sessionId = resumeRef;
489
+ } else {
490
+ try {
491
+ state.sessionId = (await peer.request("session/new", { cwd, mcpServers: [] }))?.sessionId ?? null;
492
+ } catch (error) {
493
+ return fatal(`dsh couldn't open a conversation (${error.message})`, 1);
494
+ }
495
+ if (!state.sessionId) return fatal("dsh opened a conversation without naming it", 1);
496
+ }
497
+ writeLaunchRecord({ nativeRef: state.sessionId, producer });
498
+ say(`[openrig-dsh] ready · ${producer} · conversation ${state.sessionId}`);
499
+ say(`[openrig-dsh] DSH_HOME ${home} · DSH_PERMISSION_MODE ${agentEnv.DSH_PERMISSION_MODE}`);
500
+ say("[openrig-dsh] each submitted message is one prompt; /abort or Ctrl-C cancels the running turn");
501
+
502
+ heartbeat = setInterval(() => { if (!state.running && !state.holding && !agentExited) postIdle("idle_heartbeat"); }, BEAT_MS);
503
+ for (const signal of ["SIGHUP", "SIGTERM"]) {
504
+ process.on(signal, () => {
505
+ if (state.running && !state.cancelRequestedAt) peer.notify("session/cancel", { sessionId: state.sessionId });
506
+ for (const ask of state.asks) ask.end("exited");
507
+ child.kill("SIGTERM");
508
+ setTimeout(() => child.kill("SIGKILL"), 3_000).unref();
509
+ });
510
+ }
511
+ process.on("SIGINT", abort);
512
+
513
+ const framer = new InputFramer();
514
+ if (process.stdin.isTTY) {
515
+ process.stdin.setRawMode(true);
516
+ process.stdout.write("\x1b[?2004h");
517
+ tty = true;
518
+ process.stdin.setEncoding("utf8");
519
+ process.stdin.on("data", (chunk) => {
520
+ for (const event of framer.push(chunk)) {
521
+ if (event.type === "echo") process.stdout.write(event.text);
522
+ else if (event.type === "erase") process.stdout.write("\b \b");
523
+ else if (event.type === "abort") { process.stdout.write("\n"); abort(); }
524
+ else if (event.type === "block") { process.stdout.write("\n"); submit(event.text); }
525
+ }
526
+ });
527
+ } else {
528
+ createInterface({ input: process.stdin }).on("line", (line) => {
529
+ if (line.trim() === "/abort") abort();
530
+ else if (line.trim()) submit(line);
531
+ });
532
+ }
533
+
534
+ if (firstInput !== null) submit(firstInput);
535
+ else postIdle("idle_heartbeat");
536
+ }
537
+
538
+ const invoked = (() => {
539
+ try { return process.argv[1] ? pathToFileURL(realpathSync(process.argv[1])).href : null; } catch { return null; }
540
+ })();
541
+ if (invoked === import.meta.url) {
542
+ main().catch((error) => { console.error(`openrig-dsh-runner: ${error.stack ?? error}`); process.exit(1); });
543
+ }
@@ -0,0 +1,5 @@
1
+ # OpenShell reference driver
2
+
3
+ Run `rig environment setup --help` to install the maintained OpenShell 0.1.6 / Claude Code reference from the packaged daemon assets. Its README, image recipe, endpoint-specific policy, example RigSpec/AgentSpecs and versioned driver schema are installed together. Setup prepares files and an ordinary scoped work grant; it does not create compute or launch a provider.
4
+
5
+ This first cut supports explicit owned create or exact attached binding, required destination projection and verified JSON artifact return through authenticated MCP work tools. Explicit owned lifecycle operations retain separate observed receipts. Exact same-host recreate/restore requires verified private history and the selected checkpoint; attached native, storage and compute are preserved. A native process receipt is not a successful model-work claim. Existing unbound host runtimes retain their launch/projection paths.
@@ -20,7 +20,7 @@ it never reads an unsupported capability as idle, working, ready or verified.
20
20
  | Resume | when declared | `resume: true` with one of the two above (see [Reopening a conversation](#reopening-a-conversation-resume-true)). Without it, a resume says `Resume is unsupported: community harness "<name>" is launch-only`, and a restore stops and asks. |
21
21
  | Activity | partly | Read from the screen only; there are no activity hooks. Work and attention the screen shows are kept, but a screen that looks idle reads `unknown`, never idle, because a quiet prompt can be an approval or a pause. A [runner preset](#runner-presets-runner-true)'s own reports decide it instead. |
22
22
  | Attention | partly | Read from the screen: a permission question or numbered choice that OpenRig recognizes reads as needing attention, and `rig send` won't type into it. A prompt it doesn't recognize reads `unknown`. |
23
- | Approval | no | Approvals stay in the harness's own pane. OpenRig relays none, so a person answers them there. |
23
+ | Approval | no | Approvals stay in the harness's own pane. OpenRig relays none, so a person answers them there. A [runner preset](#runner-presets-runner-true) is the exception: its runner submits the agent's permission requests to OpenRig, which asks a person, and the default is permit (section 7 of the [harness and runner contract](harness-runner-contract.md)). |
24
24
  | Cancel | no | OpenRig has no verb that cancels a running turn. `rig seat stop` and `rig down` end the seat's tmux session; anything the harness runs outside its pane, such as a gateway, is its own, and the preset's `limits` should say what keeps running. Restarting in place and switching harness are refused. |
25
25
  | Transport | yes | The seat is a tmux pane like any other, so `rig capture`, `rig send` and `--host` work as they do for any seat. |
26
26
 
@@ -285,6 +285,30 @@ on it, not Pi choosing by itself to park or hand work on.
285
285
 
286
286
  Copy both and maintain them as your own.
287
287
 
288
+ ## An example runner: dsh
289
+
290
+ [`community-harness-examples/dsh/`](community-harness-examples/dsh/) has a runner preset (`runner: true`) and a small runner
291
+ for DeepSeek Harness, which speaks ACP on stdio and has no terminal UI of its own. It's written for dsh 0.2.1-rc.2 and
292
+ checked only against a stand-in agent.
293
+ - **The runner:**
294
+ - it opens the conversation and writes the launch record;
295
+ - it turns each submitted block into one prompt;
296
+ - it reports turn boundaries as activity hooks;
297
+ - it cancels on `/abort` or Ctrl-C, as the [runner contract](harness-runner-contract.md) describes.
298
+ - **Permissions:** it sends each request to OpenRig, which asks the default person or the seat's override.
299
+ - **When no one can be asked, or OpenRig can't answer,** it permits with dsh's own allow option (`allow_once`, else
300
+ `allow_always`), which is OpenRig's default. `allow_always` creates a standing grant in dsh.
301
+ - **It refuses and holds needs input** only after `--deny`. A person's no when dsh offered no reject option, or a
302
+ request OpenRig says isn't the current occupant's, is answered cancelled.
303
+ - **Each seat gets its own dsh home,** with dsh's session-log and plugin-list uploads to DeepSeek turned off. Give that
304
+ home credentials, or put a provider key in the seat's environment.
305
+ - **Resume isn't declared.** The runner reopens a conversation by the method dsh advertises, and reports one missing only
306
+ on dsh's own not-found error. Declare `resume: true` only after a real dsh has reopened a conversation and refused a
307
+ missing one.
308
+
309
+ Its [README](community-harness-examples/dsh/README.md) has the setup and a check you can run without a model. Copy both
310
+ and maintain them as your own.
311
+
288
312
  The launcher is the contributor's code, in the contributor's package. OpenRig runs no code from a preset and loads no
289
313
  module into its daemon. A preset that sets `launch_result`, `names_conversation`, `startup_assisted`, `first_input`, `runner` or `passes_model` is refused by an older
290
314
  OpenRig that doesn't know the field.
@@ -2,7 +2,7 @@
2
2
 
3
3
  This chapter describes the placement and resource responsibilities of an integration author. The harness/runner chapter owns native protocol, model input, activity, attention, permission exchange and turn cancellation. This chapter owns where that harness runs, which files and credentials it can reach, how native state survives an environment change, and how results and resources return to their owners.
4
4
 
5
- **Status:** a design contract for authors, with an existing-compatible composition and one measured private implementation. The measured baseline used OpenRig 0.7.4, OpenShell 0.1.6 and Claude Code 2.1.310. Inclusion of this draft in 0.7.6 documentation does not implement a generic environment driver, a `DeploySpec` loader or a cross-host native-resume guarantee. Proposed operations below are not commands or accepted configuration keys. Capability support must be stated for the actual integration and version.
5
+ **Status:** a design contract for authors, with an existing-compatible composition and one measured private implementation. The measured baseline used OpenRig 0.7.4, OpenShell 0.1.6 and Claude Code 2.1.310. 0.7.6 published this draft; publishing it does not implement a generic environment driver, a `DeploySpec` loader or a cross-host native-resume guarantee. Proposed operations below are not commands or accepted configuration keys. Capability support must be stated for the actual integration and version.
6
6
 
7
7
  ## Keep the identities and responsibilities separate
8
8
 
@@ -191,11 +191,11 @@ You can also read [`skills/rigs/SKILL.md`](../../skills/rigs/SKILL.md) directly.
191
191
  script will do and changes nothing:
192
192
 
193
193
  ```sh
194
- curl -fsSL https://raw.githubusercontent.com/mvschwarz/openrig/v0.7.7/scripts/install.sh | sh -s -- --dry-run
194
+ curl -fsSL https://raw.githubusercontent.com/mvschwarz/openrig/v0.7.8/scripts/install.sh | sh -s -- --dry-run
195
195
  ```
196
196
 
197
197
  The same command without `--dry-run`,
198
- `curl -fsSL https://raw.githubusercontent.com/mvschwarz/openrig/v0.7.7/scripts/install.sh | sh`, installs the
198
+ `curl -fsSL https://raw.githubusercontent.com/mvschwarz/openrig/v0.7.8/scripts/install.sh | sh`, installs the
199
199
  latest published `@openrig/cli` with `npm install -g`,
200
200
  runs the Node.js and SQLite check, then `rig setup --dry-run` and `rig setup`. `rig setup` checks both Claude Code and
201
201
  Codex and may install a missing one, as described below. A failed step prints
@@ -509,7 +509,12 @@ rig terminal open saved:kernel --provider herdr --json
509
509
  rig terminal open saved:kernel --provider cmux --json
510
510
  ```
511
511
 
512
- Use `rig terminal status --json` to inspect provider availability and liveness.
512
+ Use `rig terminal status --json` to inspect provider availability, liveness and the
513
+ daemon's effective tmux server. To keep managed seats out of your personal tmux
514
+ session list, opt into [an isolated server](tmux-servers.md) with
515
+ `rig config set terminal.tmux_server isolated`; existing live seats defer the
516
+ switch until they are stopped and the daemon restarts.
517
+
513
518
  To keep rigs in separate Herdr sessions, select one explicitly:
514
519
  `rig terminal open future-prod-rig --provider herdr --session future-prod`.
515
520
  `--session default` selects Herdr's default session; omitting the option keeps