@openrig/cli 0.5.7 → 0.5.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 (362) hide show
  1. package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus.cjs +25 -2
  2. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/precompact-hook.mjs +95 -8
  3. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/restore-from-jsonl.mjs +9 -1
  4. package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
  5. package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +40 -15
  6. package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
  7. package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
  8. package/daemon/context-packs/skills/claude-compaction-restore/scripts/precompact-hook.mjs +95 -8
  9. package/daemon/context-packs/skills/claude-compaction-restore/scripts/restore-from-jsonl.mjs +9 -1
  10. package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
  11. package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
  12. package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
  13. package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
  14. package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
  15. package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
  16. package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
  17. package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
  18. package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
  19. package/daemon/context-packs/skills/core/openrig-upgrade/SKILL.md +120 -355
  20. package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +9 -3
  21. package/daemon/context-packs/skills/core/openrig-upgrade/scripts/backup-sqlite.mjs +62 -0
  22. package/daemon/context-packs/skills/core/openrig-upgrade/scripts/inspect-upgrade.mjs +40 -0
  23. package/daemon/context-packs/skills/core/openrig-upgrade/scripts/refresh-managed-plugin.mjs +151 -0
  24. package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
  25. package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
  26. package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
  27. package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
  28. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
  29. package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
  30. package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
  31. package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
  32. package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
  33. package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
  34. package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
  35. package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
  36. package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
  37. package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
  38. package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
  39. package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
  40. package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
  41. package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
  42. package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
  43. package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
  44. package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
  45. package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
  46. package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
  47. package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
  48. package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
  49. package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
  50. package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
  51. package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
  52. package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
  53. package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
  54. package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
  55. package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
  56. package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
  57. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
  58. package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
  59. package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
  60. package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
  61. package/daemon/context-packs/world-example/manifest.yaml +1 -1
  62. package/daemon/context-packs/world-public/manifest.yaml +1 -1
  63. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  64. package/daemon/dist/adapters/codex-runtime-adapter.js +249 -2
  65. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  66. package/daemon/dist/adapters/tmux.d.ts +6 -5
  67. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  68. package/daemon/dist/adapters/tmux.js +29 -12
  69. package/daemon/dist/adapters/tmux.js.map +1 -1
  70. package/daemon/dist/build-info.js +3 -3
  71. package/daemon/dist/db/all-migrations.d.ts +1 -1
  72. package/daemon/dist/db/all-migrations.d.ts.map +1 -1
  73. package/daemon/dist/db/all-migrations.js +3 -1
  74. package/daemon/dist/db/all-migrations.js.map +1 -1
  75. package/daemon/dist/db/migrations/078_idle_gate_fired_condition.d.ts +17 -0
  76. package/daemon/dist/db/migrations/078_idle_gate_fired_condition.d.ts.map +1 -0
  77. package/daemon/dist/db/migrations/078_idle_gate_fired_condition.js +21 -0
  78. package/daemon/dist/db/migrations/078_idle_gate_fired_condition.js.map +1 -0
  79. package/daemon/dist/domain/active-occupant.d.ts +6 -0
  80. package/daemon/dist/domain/active-occupant.d.ts.map +1 -1
  81. package/daemon/dist/domain/active-occupant.js +14 -0
  82. package/daemon/dist/domain/active-occupant.js.map +1 -1
  83. package/daemon/dist/domain/current-work.d.ts +73 -0
  84. package/daemon/dist/domain/current-work.d.ts.map +1 -0
  85. package/daemon/dist/domain/current-work.js +225 -0
  86. package/daemon/dist/domain/current-work.js.map +1 -0
  87. package/daemon/dist/domain/execution-view.d.ts.map +1 -1
  88. package/daemon/dist/domain/execution-view.js +215 -13
  89. package/daemon/dist/domain/execution-view.js.map +1 -1
  90. package/daemon/dist/domain/gateway/human-registry.d.ts +3 -2
  91. package/daemon/dist/domain/gateway/human-registry.d.ts.map +1 -1
  92. package/daemon/dist/domain/gateway/human-registry.js +113 -18
  93. package/daemon/dist/domain/gateway/human-registry.js.map +1 -1
  94. package/daemon/dist/domain/model-divergence/effective-model-readers.d.ts +3 -2
  95. package/daemon/dist/domain/model-divergence/effective-model-readers.d.ts.map +1 -1
  96. package/daemon/dist/domain/model-divergence/effective-model-readers.js +7 -5
  97. package/daemon/dist/domain/model-divergence/effective-model-readers.js.map +1 -1
  98. package/daemon/dist/domain/policies/idle-gate-qitem.d.ts +5 -5
  99. package/daemon/dist/domain/policies/idle-gate-qitem.d.ts.map +1 -1
  100. package/daemon/dist/domain/policies/idle-gate-qitem.js +130 -22
  101. package/daemon/dist/domain/policies/idle-gate-qitem.js.map +1 -1
  102. package/daemon/dist/domain/policies/types.d.ts +12 -0
  103. package/daemon/dist/domain/policies/types.d.ts.map +1 -1
  104. package/daemon/dist/domain/queue-repository.d.ts +37 -2
  105. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  106. package/daemon/dist/domain/queue-repository.js +171 -16
  107. package/daemon/dist/domain/queue-repository.js.map +1 -1
  108. package/daemon/dist/domain/queue-wake-repository.d.ts +19 -0
  109. package/daemon/dist/domain/queue-wake-repository.d.ts.map +1 -1
  110. package/daemon/dist/domain/queue-wake-repository.js +33 -0
  111. package/daemon/dist/domain/queue-wake-repository.js.map +1 -1
  112. package/daemon/dist/domain/reconciler.d.ts.map +1 -1
  113. package/daemon/dist/domain/reconciler.js +4 -1
  114. package/daemon/dist/domain/reconciler.js.map +1 -1
  115. package/daemon/dist/domain/rehydrate-eligibility.d.ts +11 -1
  116. package/daemon/dist/domain/rehydrate-eligibility.d.ts.map +1 -1
  117. package/daemon/dist/domain/rehydrate-eligibility.js +34 -0
  118. package/daemon/dist/domain/rehydrate-eligibility.js.map +1 -1
  119. package/daemon/dist/domain/restore-orchestrator.d.ts +9 -0
  120. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  121. package/daemon/dist/domain/restore-orchestrator.js +32 -0
  122. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  123. package/daemon/dist/domain/restore-plan-preview.js +2 -2
  124. package/daemon/dist/domain/restore-plan-preview.js.map +1 -1
  125. package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
  126. package/daemon/dist/domain/rigspec-exporter.js +2 -0
  127. package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
  128. package/daemon/dist/domain/rigspec-instantiator.d.ts +15 -9
  129. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  130. package/daemon/dist/domain/rigspec-instantiator.js +66 -83
  131. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  132. package/daemon/dist/domain/rigspec-schema.d.ts +5 -1
  133. package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
  134. package/daemon/dist/domain/rigspec-schema.js +41 -2
  135. package/daemon/dist/domain/rigspec-schema.js.map +1 -1
  136. package/daemon/dist/domain/seat-attention-reconciler.d.ts +32 -1
  137. package/daemon/dist/domain/seat-attention-reconciler.d.ts.map +1 -1
  138. package/daemon/dist/domain/seat-attention-reconciler.js +183 -4
  139. package/daemon/dist/domain/seat-attention-reconciler.js.map +1 -1
  140. package/daemon/dist/domain/session-transport.d.ts +5 -0
  141. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  142. package/daemon/dist/domain/session-transport.js +33 -7
  143. package/daemon/dist/domain/session-transport.js.map +1 -1
  144. package/daemon/dist/domain/snapshot-capture.d.ts.map +1 -1
  145. package/daemon/dist/domain/snapshot-capture.js +4 -2
  146. package/daemon/dist/domain/snapshot-capture.js.map +1 -1
  147. package/daemon/dist/domain/topology-defaults-installer.d.ts +4 -2
  148. package/daemon/dist/domain/topology-defaults-installer.d.ts.map +1 -1
  149. package/daemon/dist/domain/topology-defaults-installer.js +27 -0
  150. package/daemon/dist/domain/topology-defaults-installer.js.map +1 -1
  151. package/daemon/dist/domain/types.d.ts +1 -1
  152. package/daemon/dist/domain/types.d.ts.map +1 -1
  153. package/daemon/dist/domain/types.js.map +1 -1
  154. package/daemon/dist/domain/up-command-router.d.ts.map +1 -1
  155. package/daemon/dist/domain/up-command-router.js +19 -0
  156. package/daemon/dist/domain/up-command-router.js.map +1 -1
  157. package/daemon/dist/domain/watchdog-jobs-repository.d.ts +9 -0
  158. package/daemon/dist/domain/watchdog-jobs-repository.d.ts.map +1 -1
  159. package/daemon/dist/domain/watchdog-jobs-repository.js +15 -2
  160. package/daemon/dist/domain/watchdog-jobs-repository.js.map +1 -1
  161. package/daemon/dist/domain/watchdog-policy-engine.d.ts +7 -0
  162. package/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -1
  163. package/daemon/dist/domain/watchdog-policy-engine.js +47 -0
  164. package/daemon/dist/domain/watchdog-policy-engine.js.map +1 -1
  165. package/daemon/dist/routes/queue.d.ts.map +1 -1
  166. package/daemon/dist/routes/queue.js +31 -10
  167. package/daemon/dist/routes/queue.js.map +1 -1
  168. package/daemon/dist/routes/rigs.js +10 -3
  169. package/daemon/dist/routes/rigs.js.map +1 -1
  170. package/daemon/dist/routes/rigspec.d.ts.map +1 -1
  171. package/daemon/dist/routes/rigspec.js +37 -0
  172. package/daemon/dist/routes/rigspec.js.map +1 -1
  173. package/daemon/dist/routes/up.js +10 -3
  174. package/daemon/dist/routes/up.js.map +1 -1
  175. package/daemon/dist/startup.d.ts.map +1 -1
  176. package/daemon/dist/startup.js +16 -6
  177. package/daemon/dist/startup.js.map +1 -1
  178. package/daemon/docs/reference/agent-spec.md +33 -0
  179. package/daemon/docs/reference/chain-file-convention.md +17 -12
  180. package/daemon/docs/reference/release-boundary.md +29 -5
  181. package/daemon/docs/reference/sdlc-conventions.md +6 -0
  182. package/daemon/specs/agents/shared/skills/core/openrig-upgrade/SKILL.md +120 -355
  183. package/daemon/specs/agents/shared/skills/core/openrig-upgrade/scripts/backup-sqlite.mjs +62 -0
  184. package/daemon/specs/agents/shared/skills/core/openrig-upgrade/scripts/inspect-upgrade.mjs +40 -0
  185. package/daemon/specs/agents/shared/skills/core/openrig-upgrade/scripts/refresh-managed-plugin.mjs +151 -0
  186. package/daemon/specs/rigs/preview/product-team/topology/instance/CRAFT.md +4 -4
  187. package/daemon/specs/rigs/preview/product-team/topology/rig/ORCHESTRATION-CRAFT.md +3 -3
  188. package/dist/build-info.js +3 -3
  189. package/dist/commands/context.d.ts.map +1 -1
  190. package/dist/commands/context.js +55 -9
  191. package/dist/commands/context.js.map +1 -1
  192. package/dist/commands/import.d.ts.map +1 -1
  193. package/dist/commands/import.js +27 -1
  194. package/dist/commands/import.js.map +1 -1
  195. package/dist/commands/watchdog.d.ts.map +1 -1
  196. package/dist/commands/watchdog.js +51 -3
  197. package/dist/commands/watchdog.js.map +1 -1
  198. package/dist/front-door.d.ts.map +1 -1
  199. package/dist/front-door.js +16 -4
  200. package/dist/front-door.js.map +1 -1
  201. package/dist/lib/topology-trace.d.ts +3 -2
  202. package/dist/lib/topology-trace.d.ts.map +1 -1
  203. package/dist/lib/topology-trace.js +12 -2
  204. package/dist/lib/topology-trace.js.map +1 -1
  205. package/dist/lib/work-install.d.ts.map +1 -1
  206. package/dist/lib/work-install.js +65 -31
  207. package/dist/lib/work-install.js.map +1 -1
  208. package/node_modules/@openrig/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  209. package/node_modules/@openrig/daemon/dist/adapters/codex-runtime-adapter.js +249 -2
  210. package/node_modules/@openrig/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  211. package/node_modules/@openrig/daemon/dist/adapters/tmux.d.ts +6 -5
  212. package/node_modules/@openrig/daemon/dist/adapters/tmux.d.ts.map +1 -1
  213. package/node_modules/@openrig/daemon/dist/adapters/tmux.js +29 -12
  214. package/node_modules/@openrig/daemon/dist/adapters/tmux.js.map +1 -1
  215. package/node_modules/@openrig/daemon/dist/build-info.js +3 -3
  216. package/node_modules/@openrig/daemon/dist/db/all-migrations.d.ts +1 -1
  217. package/node_modules/@openrig/daemon/dist/db/all-migrations.d.ts.map +1 -1
  218. package/node_modules/@openrig/daemon/dist/db/all-migrations.js +3 -1
  219. package/node_modules/@openrig/daemon/dist/db/all-migrations.js.map +1 -1
  220. package/node_modules/@openrig/daemon/dist/db/migrations/078_idle_gate_fired_condition.d.ts +17 -0
  221. package/node_modules/@openrig/daemon/dist/db/migrations/078_idle_gate_fired_condition.d.ts.map +1 -0
  222. package/node_modules/@openrig/daemon/dist/db/migrations/078_idle_gate_fired_condition.js +21 -0
  223. package/node_modules/@openrig/daemon/dist/db/migrations/078_idle_gate_fired_condition.js.map +1 -0
  224. package/node_modules/@openrig/daemon/dist/domain/active-occupant.d.ts +6 -0
  225. package/node_modules/@openrig/daemon/dist/domain/active-occupant.d.ts.map +1 -1
  226. package/node_modules/@openrig/daemon/dist/domain/active-occupant.js +14 -0
  227. package/node_modules/@openrig/daemon/dist/domain/active-occupant.js.map +1 -1
  228. package/node_modules/@openrig/daemon/dist/domain/current-work.d.ts +73 -0
  229. package/node_modules/@openrig/daemon/dist/domain/current-work.d.ts.map +1 -0
  230. package/node_modules/@openrig/daemon/dist/domain/current-work.js +225 -0
  231. package/node_modules/@openrig/daemon/dist/domain/current-work.js.map +1 -0
  232. package/node_modules/@openrig/daemon/dist/domain/execution-view.d.ts.map +1 -1
  233. package/node_modules/@openrig/daemon/dist/domain/execution-view.js +215 -13
  234. package/node_modules/@openrig/daemon/dist/domain/execution-view.js.map +1 -1
  235. package/node_modules/@openrig/daemon/dist/domain/gateway/human-registry.d.ts +3 -2
  236. package/node_modules/@openrig/daemon/dist/domain/gateway/human-registry.d.ts.map +1 -1
  237. package/node_modules/@openrig/daemon/dist/domain/gateway/human-registry.js +113 -18
  238. package/node_modules/@openrig/daemon/dist/domain/gateway/human-registry.js.map +1 -1
  239. package/node_modules/@openrig/daemon/dist/domain/model-divergence/effective-model-readers.d.ts +3 -2
  240. package/node_modules/@openrig/daemon/dist/domain/model-divergence/effective-model-readers.d.ts.map +1 -1
  241. package/node_modules/@openrig/daemon/dist/domain/model-divergence/effective-model-readers.js +7 -5
  242. package/node_modules/@openrig/daemon/dist/domain/model-divergence/effective-model-readers.js.map +1 -1
  243. package/node_modules/@openrig/daemon/dist/domain/policies/idle-gate-qitem.d.ts +5 -5
  244. package/node_modules/@openrig/daemon/dist/domain/policies/idle-gate-qitem.d.ts.map +1 -1
  245. package/node_modules/@openrig/daemon/dist/domain/policies/idle-gate-qitem.js +130 -22
  246. package/node_modules/@openrig/daemon/dist/domain/policies/idle-gate-qitem.js.map +1 -1
  247. package/node_modules/@openrig/daemon/dist/domain/policies/types.d.ts +12 -0
  248. package/node_modules/@openrig/daemon/dist/domain/policies/types.d.ts.map +1 -1
  249. package/node_modules/@openrig/daemon/dist/domain/queue-repository.d.ts +37 -2
  250. package/node_modules/@openrig/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  251. package/node_modules/@openrig/daemon/dist/domain/queue-repository.js +171 -16
  252. package/node_modules/@openrig/daemon/dist/domain/queue-repository.js.map +1 -1
  253. package/node_modules/@openrig/daemon/dist/domain/queue-wake-repository.d.ts +19 -0
  254. package/node_modules/@openrig/daemon/dist/domain/queue-wake-repository.d.ts.map +1 -1
  255. package/node_modules/@openrig/daemon/dist/domain/queue-wake-repository.js +33 -0
  256. package/node_modules/@openrig/daemon/dist/domain/queue-wake-repository.js.map +1 -1
  257. package/node_modules/@openrig/daemon/dist/domain/reconciler.d.ts.map +1 -1
  258. package/node_modules/@openrig/daemon/dist/domain/reconciler.js +4 -1
  259. package/node_modules/@openrig/daemon/dist/domain/reconciler.js.map +1 -1
  260. package/node_modules/@openrig/daemon/dist/domain/rehydrate-eligibility.d.ts +11 -1
  261. package/node_modules/@openrig/daemon/dist/domain/rehydrate-eligibility.d.ts.map +1 -1
  262. package/node_modules/@openrig/daemon/dist/domain/rehydrate-eligibility.js +34 -0
  263. package/node_modules/@openrig/daemon/dist/domain/rehydrate-eligibility.js.map +1 -1
  264. package/node_modules/@openrig/daemon/dist/domain/restore-orchestrator.d.ts +9 -0
  265. package/node_modules/@openrig/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  266. package/node_modules/@openrig/daemon/dist/domain/restore-orchestrator.js +32 -0
  267. package/node_modules/@openrig/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  268. package/node_modules/@openrig/daemon/dist/domain/restore-plan-preview.js +2 -2
  269. package/node_modules/@openrig/daemon/dist/domain/restore-plan-preview.js.map +1 -1
  270. package/node_modules/@openrig/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
  271. package/node_modules/@openrig/daemon/dist/domain/rigspec-exporter.js +2 -0
  272. package/node_modules/@openrig/daemon/dist/domain/rigspec-exporter.js.map +1 -1
  273. package/node_modules/@openrig/daemon/dist/domain/rigspec-instantiator.d.ts +15 -9
  274. package/node_modules/@openrig/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  275. package/node_modules/@openrig/daemon/dist/domain/rigspec-instantiator.js +66 -83
  276. package/node_modules/@openrig/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  277. package/node_modules/@openrig/daemon/dist/domain/rigspec-schema.d.ts +5 -1
  278. package/node_modules/@openrig/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
  279. package/node_modules/@openrig/daemon/dist/domain/rigspec-schema.js +41 -2
  280. package/node_modules/@openrig/daemon/dist/domain/rigspec-schema.js.map +1 -1
  281. package/node_modules/@openrig/daemon/dist/domain/seat-attention-reconciler.d.ts +32 -1
  282. package/node_modules/@openrig/daemon/dist/domain/seat-attention-reconciler.d.ts.map +1 -1
  283. package/node_modules/@openrig/daemon/dist/domain/seat-attention-reconciler.js +183 -4
  284. package/node_modules/@openrig/daemon/dist/domain/seat-attention-reconciler.js.map +1 -1
  285. package/node_modules/@openrig/daemon/dist/domain/session-transport.d.ts +5 -0
  286. package/node_modules/@openrig/daemon/dist/domain/session-transport.d.ts.map +1 -1
  287. package/node_modules/@openrig/daemon/dist/domain/session-transport.js +33 -7
  288. package/node_modules/@openrig/daemon/dist/domain/session-transport.js.map +1 -1
  289. package/node_modules/@openrig/daemon/dist/domain/snapshot-capture.d.ts.map +1 -1
  290. package/node_modules/@openrig/daemon/dist/domain/snapshot-capture.js +4 -2
  291. package/node_modules/@openrig/daemon/dist/domain/snapshot-capture.js.map +1 -1
  292. package/node_modules/@openrig/daemon/dist/domain/topology-defaults-installer.d.ts +4 -2
  293. package/node_modules/@openrig/daemon/dist/domain/topology-defaults-installer.d.ts.map +1 -1
  294. package/node_modules/@openrig/daemon/dist/domain/topology-defaults-installer.js +27 -0
  295. package/node_modules/@openrig/daemon/dist/domain/topology-defaults-installer.js.map +1 -1
  296. package/node_modules/@openrig/daemon/dist/domain/types.d.ts +1 -1
  297. package/node_modules/@openrig/daemon/dist/domain/types.d.ts.map +1 -1
  298. package/node_modules/@openrig/daemon/dist/domain/types.js.map +1 -1
  299. package/node_modules/@openrig/daemon/dist/domain/up-command-router.d.ts.map +1 -1
  300. package/node_modules/@openrig/daemon/dist/domain/up-command-router.js +19 -0
  301. package/node_modules/@openrig/daemon/dist/domain/up-command-router.js.map +1 -1
  302. package/node_modules/@openrig/daemon/dist/domain/watchdog-jobs-repository.d.ts +9 -0
  303. package/node_modules/@openrig/daemon/dist/domain/watchdog-jobs-repository.d.ts.map +1 -1
  304. package/node_modules/@openrig/daemon/dist/domain/watchdog-jobs-repository.js +15 -2
  305. package/node_modules/@openrig/daemon/dist/domain/watchdog-jobs-repository.js.map +1 -1
  306. package/node_modules/@openrig/daemon/dist/domain/watchdog-policy-engine.d.ts +7 -0
  307. package/node_modules/@openrig/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -1
  308. package/node_modules/@openrig/daemon/dist/domain/watchdog-policy-engine.js +47 -0
  309. package/node_modules/@openrig/daemon/dist/domain/watchdog-policy-engine.js.map +1 -1
  310. package/node_modules/@openrig/daemon/dist/routes/queue.d.ts.map +1 -1
  311. package/node_modules/@openrig/daemon/dist/routes/queue.js +31 -10
  312. package/node_modules/@openrig/daemon/dist/routes/queue.js.map +1 -1
  313. package/node_modules/@openrig/daemon/dist/routes/rigs.js +10 -3
  314. package/node_modules/@openrig/daemon/dist/routes/rigs.js.map +1 -1
  315. package/node_modules/@openrig/daemon/dist/routes/rigspec.d.ts.map +1 -1
  316. package/node_modules/@openrig/daemon/dist/routes/rigspec.js +37 -0
  317. package/node_modules/@openrig/daemon/dist/routes/rigspec.js.map +1 -1
  318. package/node_modules/@openrig/daemon/dist/routes/up.js +10 -3
  319. package/node_modules/@openrig/daemon/dist/routes/up.js.map +1 -1
  320. package/node_modules/@openrig/daemon/dist/startup.d.ts.map +1 -1
  321. package/node_modules/@openrig/daemon/dist/startup.js +16 -6
  322. package/node_modules/@openrig/daemon/dist/startup.js.map +1 -1
  323. package/node_modules/@openrig/daemon/package.json +1 -1
  324. package/package.json +2 -1
  325. package/tui/dist/daemon-client.d.ts +2 -0
  326. package/tui/dist/daemon-client.d.ts.map +1 -1
  327. package/tui/dist/daemon-client.js +4 -0
  328. package/tui/dist/daemon-client.js.map +1 -1
  329. package/tui/dist/execution/execution-model.d.ts +19 -0
  330. package/tui/dist/execution/execution-model.d.ts.map +1 -0
  331. package/tui/dist/execution/execution-model.js +518 -0
  332. package/tui/dist/execution/execution-model.js.map +1 -0
  333. package/tui/dist/hydrate.d.ts +1 -1
  334. package/tui/dist/hydrate.d.ts.map +1 -1
  335. package/tui/dist/hydrate.js +6 -2
  336. package/tui/dist/hydrate.js.map +1 -1
  337. package/tui/dist/input.d.ts +7 -0
  338. package/tui/dist/input.d.ts.map +1 -1
  339. package/tui/dist/input.js +13 -0
  340. package/tui/dist/input.js.map +1 -1
  341. package/tui/dist/live.d.ts +10 -0
  342. package/tui/dist/live.d.ts.map +1 -1
  343. package/tui/dist/live.js +34 -1
  344. package/tui/dist/live.js.map +1 -1
  345. package/tui/dist/main.js +22 -3
  346. package/tui/dist/main.js.map +1 -1
  347. package/tui/dist/render.d.ts.map +1 -1
  348. package/tui/dist/render.js +13 -2
  349. package/tui/dist/render.js.map +1 -1
  350. package/tui/dist/scopes/scopes-model.d.ts +1 -0
  351. package/tui/dist/scopes/scopes-model.d.ts.map +1 -1
  352. package/tui/dist/scopes/scopes-model.js +4 -2
  353. package/tui/dist/scopes/scopes-model.js.map +1 -1
  354. package/tui/dist/sections.js +2 -2
  355. package/tui/dist/sections.js.map +1 -1
  356. package/tui/dist/state.d.ts.map +1 -1
  357. package/tui/dist/state.js +15 -2
  358. package/tui/dist/state.js.map +1 -1
  359. package/tui/dist/stylize.js +2 -2
  360. package/tui/dist/stylize.js.map +1 -1
  361. package/tui/dist/types.d.ts +20 -0
  362. package/tui/dist/types.d.ts.map +1 -1
@@ -1,404 +1,169 @@
1
1
  ---
2
2
  name: openrig-upgrade
3
- description: Use when upgrading the OpenRig CLI/daemon on a host with running rigs, especially when preserving tmux-backed agent sessions through a daemon restart or documenting hot-upgrade SOP evidence.
3
+ description: Use when an agent is preparing or performing an OpenRig CLI/daemon upgrade and must preserve live seats, verify each mutation, or reconcile managed plugin and skill files without overwriting local work.
4
4
  metadata:
5
5
  cli_surfaces_referenced:
6
6
  - capture
7
- - daemon adopt-state
8
7
  - daemon start
9
8
  - daemon status
10
9
  - daemon stop
11
- - down
10
+ - plugin list
12
11
  - ps
13
12
  - restore-check
14
13
  - snapshot
15
- - up
16
- - upgrade backup
17
- - upgrade preflight
18
- - upgrade promote-runtime
19
- - upgrade verify
20
14
  - version
21
15
  openrig:
22
16
  stage: factory-approved
23
17
  sibling_skills:
24
18
  - openrig-user
25
19
  - openrig-operator
26
- - openrig-builder
27
- - openrig-architect
28
20
  - forming-an-openrig-mental-model
29
- - ai-dev-workflows
30
21
  ---
31
22
 
32
- # OpenRig Upgrade
23
+ # Upgrade OpenRig
33
24
 
34
- ## Core Principle
25
+ An upgrade is an observed agent workflow, not a transaction hidden behind one
26
+ command. Hosts differ, process state drifts, local plugin files accumulate, and
27
+ the useful response to a failed step depends on what is still alive.
35
28
 
36
- OpenRig has two different failure domains:
29
+ **The agent owns the sequence. Stop after every mutation and observe the actual
30
+ effect before choosing the next step.** There is deliberately no end-to-end
31
+ upgrade subcommand.
37
32
 
38
- - **Agent process plane:** Claude/Codex/terminal seats running inside tmux.
39
- - **Management plane:** the OpenRig daemon, CLI, SQLite DB, transcripts, node inventory,
40
- send/capture APIs, restore metadata, and migrations.
33
+ ## Safety model
41
34
 
42
- A hot daemon upgrade is possible when the continuity seats remain alive in tmux and
43
- the new daemon restarts against the same DB and transcript root. Do not run
44
- `rig down` on continuity rigs unless the goal is a disruptive restore test; `rig down`
45
- kills OpenRig-launched tmux sessions.
35
+ Keep these planes separate:
46
36
 
47
- ## Preferred Live-Cutover Operator Mode
37
+ - Seats normally live in tmux and can survive a daemon restart.
38
+ - The daemon, database, wrappers, and managed plugin projection are the control
39
+ plane being changed.
40
+ - `rig down` tears down seats. It is not part of a continuity-preserving upgrade.
48
41
 
49
- For live production daemon cutovers, prefer an **out-of-band upgrade operator**:
50
- a temporary host-local tmux seat outside the managed OpenRig topology, spawned
51
- from the lifecycle/runtime-upgrade agent's current mental model.
42
+ Before acting, name the rigs and seats whose continuity matters. On a production
43
+ host, use the host's normal operator ceremony. On a recovery-friendly build VM,
44
+ the orchestrator may adopt a tested runtime directly, but still observes each
45
+ step and stops on unexplained drift.
52
46
 
53
- Why: the managed rig stays in the agent process plane while a disposable sidecar
54
- mutates the management plane. The sidecar inherits enough context to avoid a
55
- cold handoff, but it is not inside the failure domain it is modifying.
47
+ ## The loop
56
48
 
57
- Use this when all are true:
49
+ For every step:
58
50
 
59
- - the upgrade mutates the live daemon, CLI wrapper, DB, runtime worktree, tmux
60
- lifecycle, or active control-plane truth;
61
- - continuity seats should keep working during the upgrade;
62
- - a lifecycle/runtime-upgrade seat has already prepared the packet or owns the
63
- needed context;
64
- - the human has granted an `operator auto window`.
51
+ 1. **Inspect.** Derive current facts from the live host.
52
+ 2. **Decide.** Choose one bounded mutation and state its expected effect.
53
+ 3. **Act once.** Do not bundle the next mutation with it.
54
+ 4. **Observe.** Check the process, listener, database, plugin, and seat surfaces
55
+ that the step could have changed.
56
+ 5. **Continue, adapt, or stop.** A failed expectation is information for the
57
+ agent, not permission for a blind retry.
65
58
 
66
- In this SOP, `operator auto window` means a bounded operator-authorized upgrade lane. It does not
67
- mean standing Codex `auto_review`, `--full-auto`, or approval-bypass mode. Use
68
- `security-and-consequence-boundary-policy` skill for the current
69
- security and consequence-boundary policy.
59
+ ## Bounded helpers
70
60
 
71
- Do not use this pattern as a standing orchestration seat. The sidecar exists for
72
- one cutover and then closes after handback.
61
+ Let `SKILL_DIR` be the directory containing this `SKILL.md`. These scripts emit
62
+ JSON and do not decide the upgrade sequence.
73
63
 
74
- ### Sidecar Contract
64
+ ### Inspect current facts
75
65
 
76
- The in-rig lifecycle/runtime-upgrade seat owns packet preparation and final
77
- interpretation. The out-of-band sidecar owns only execution inside the approved
78
- window.
79
-
80
- Sidecar starter prompt shape:
81
-
82
- ```text
83
- You are the host-local OpenRig runtime upgrade operator, outside the managed rig
84
- topology. Execute the approved daemon-only cutover only after explicit human
85
- approval. First read the upgrade preflight artifact and runtime-upgrade
86
- decision. Prove you are outside the topology before mutation. Never run rig
87
- down. Preserve tmux topology. Stop/start only the daemon, verify protected rigs,
88
- write cutover evidence, unblock downstream artifacts only when the blocker is
89
- truly closed, and rollback to <previous-wrapper-or-commit> if needed.
66
+ ```bash
67
+ node "$SKILL_DIR/scripts/inspect-upgrade.mjs"
90
68
  ```
91
69
 
92
- Required handback:
93
-
94
- - write the live cutover evidence under the lifecycle evidence shelf;
95
- - include proof that the sidecar was outside the topology/failure domain it
96
- mutated;
97
- - update any blocked downstream dogfood/runtime task only when the blocking
98
- condition is truly closed;
99
- - preserve caveats as downstream material instead of using them to reopen a
100
- closed cutover gate;
101
- - report back to the in-rig lifecycle/runtime-upgrade seat or orch surface with
102
- daemon provenance, topology verification, caveats, rollback state, and one
103
- compact paragraph of operator judgment about ambiguous choices;
104
- - close the sidecar after the original lifecycle owner has absorbed the result.
105
-
106
- Stop conditions for the sidecar:
107
-
108
- - preflight or runtime-upgrade decision is missing;
109
- - human approval is absent or narrower than the requested cutover;
110
- - protected topology is already degraded beyond the packet's expected caveats;
111
- - target runtime cannot be verified by process path, port listener, and command
112
- evidence;
113
- - any step would require `rig down` or destructive DB restore without a new
114
- explicit human decision.
115
-
116
- Generic primitive: this upgrade specialization composes over the
117
- `sidecar-operator` skill (the underlying out-of-band-operator pattern;
118
- this skill is the upgrade-specific specialization).
119
-
120
- ## What Changed On 2026-04-27
121
-
122
- Initial belief:
123
-
124
- - All rigs had to be down before daemon restart.
125
- - Live upgrade was research-gated because DB migrations might break session/node
126
- state while sessions were running.
127
- - A parallel isolated daemon/adoption path looked necessary before production use.
70
+ This asks the installed `rig` for its version, daemon status, node inventory,
71
+ and plugin inventory. A missing surface remains visible with a suggested next
72
+ probe. `ready: false` means the agent must resolve or consciously bound the gap;
73
+ it does not mean the script should mutate anything.
128
74
 
129
- Observed result:
130
-
131
- - A daemon-only hot cutover preserved the live `example-seat` tmux
132
- sessions.
133
- - The old daemon was stopped without running `rig down`.
134
- - The new source-pinned daemon started against the same production DB.
135
- - `rig ps --nodes --json`, `rig capture`, and `rig restore-check` could inspect the
136
- still-running continuity seats after restart.
75
+ ### Back up SQLite
137
76
 
138
- The simpler model is now preferred for tmux-backed continuity rigs: snapshot and
139
- back up state, stop only the daemon, start the new daemon, then verify that live
140
- sessions are still observable and manageable.
141
-
142
- ## Proven Hot Path
143
-
144
- Use this as the canonical first-choice workflow for a host where continuity rigs
145
- are tmux-backed and the operator wants non-disruptive daemon upgrade.
146
-
147
- 0. **Spawn the out-of-band operator when live cutover is required.**
148
- The sidecar must be host-local and outside the managed topology being
149
- upgraded. Keep the lifecycle/runtime-upgrade owner inside the rig so it can
150
- continue to observe, ask questions, and absorb the handback.
151
-
152
- 1. **Choose continuity targets.**
153
- Name the exact rigs that must remain live. Everything else is source material.
154
- Do not let "nice to resume later" rigs expand the success criteria.
155
-
156
- 2. **Freeze active work.**
157
- Get continuity seats to a stable/idle checkpoint. Record resume commands if
158
- available.
159
-
160
- 3. **Inventory with filters.**
161
- Do not dump full `rig ps` output on this host. Use filtered JSON:
162
-
163
- ```bash
164
- rig ps --nodes --json \
165
- | jq -r 'map(select(.rigName=="<rig>")) | sort_by(.canonicalSessionName)[] | "\(.canonicalSessionName) \(.sessionStatus) \(.startupStatus) \(.resumeToken // "none")"'
166
- ```
167
-
168
- 4. **Take a non-destructive snapshot of each continuity rig.**
169
- This records rollback/recovery metadata without killing tmux sessions:
170
-
171
- ```bash
172
- rig snapshot <rigId>
173
- ```
174
-
175
- Verify the snapshot payload in SQLite has the expected nodes, sessions,
176
- checkpoints, and resume tokens.
177
-
178
- 5. **Create a post-snapshot SQLite backup.**
179
- Use SQLite's online backup API while the daemon is live. Then run
180
- `PRAGMA integrity_check` on the backup and verify it contains the continuity
181
- snapshot.
182
-
183
- 6. **Prepare a clean runtime artifact.**
184
- Prefer a dedicated clean source worktree pinned to a commit:
185
-
186
- ```bash
187
- git worktree add --detach /path/to/openrig-runtime-<shortsha> <commit>
188
- cd /path/to/openrig-runtime-<shortsha>
189
- PATH=/path/to/node22/bin:$PATH npm ci
190
- PATH=/path/to/node22/bin:$PATH npm run build
191
- ```
192
-
193
- Use even/LTS Node. The 2026-04-27 upgrade used Node `v22.22.1`.
194
-
195
- 7. **Stop only the daemon.**
196
- First try:
197
-
198
- ```bash
199
- rig daemon stop
200
- ```
201
-
202
- If the daemon state file is missing but the PID is known and verified as the
203
- OpenRig daemon, gracefully terminate that PID:
204
-
205
- ```bash
206
- kill -TERM <daemonPid>
207
- ```
208
-
209
- Do not use `kill -9` unless recovering from a wedged process with human
210
- approval. Do not run `rig down` on continuity rigs.
211
-
212
- 8. **Start the pinned daemon against the same production DB.**
213
-
214
- ```bash
215
- PATH=/path/to/node22/bin:$PATH \
216
- node packages/cli/dist/index.js daemon start \
217
- --port 7433 \
218
- --host 127.0.0.1 \
219
- --db ~/.openrig/openrig.sqlite
220
- ```
221
-
222
- 9. **Verify management continuity.**
223
- Required checks:
224
-
225
- ```bash
226
- rig daemon status
227
- lsof -nP -iTCP:7433 -sTCP:LISTEN
228
- rig ps --nodes --json | jq -r 'map(select(.rigName=="<rig>")) | ...'
229
- rig capture --rig <rig> --lines 1 --json
230
- rig restore-check --rig <rig>
231
- ```
232
-
233
- Success means the daemon is healthy, continuity sessions remain running/ready,
234
- capture works, transcripts are present, and `restore-check` reports no red
235
- blockers.
236
-
237
- 10. **Align the default CLI with the new daemon.**
238
- If `rig` is a wrapper, make sure it delegates to the new CLI.
239
-
240
- 11. **Write evidence and hand back.**
241
- The sidecar writes a cutover evidence packet with daemon provenance,
242
- protected topology counts, representative capture/restore checks, smoke
243
- results, caveats, and rollback state. Then it notifies the original in-rig
244
- lifecycle/runtime-upgrade owner. Do not rely on chat as the only proof.
245
-
246
- ## Proof Point: Daemon-Only Hot Cutover
247
-
248
- A clean source runtime on an LTS Node version replaced the old daemon while one
249
- tmux-backed continuity rig stayed live. The operator took a post-snapshot online
250
- database backup, verified its integrity, stopped only the daemon, started the
251
- new runtime against the same database, and confirmed that every protected seat
252
- remained running and ready with no red restore blockers.
253
-
254
- Important caveat: this proves hot daemon cutover for the tested tmux-backed
255
- Claude runtime shape. It does not prove that arbitrary migrations,
256
- non-tmux runtimes, service-backed rigs, or dead sessions can be recovered without
257
- separate testing.
258
-
259
- ## Proof Point: Out-of-Band Sidecar Cutover
260
-
261
- A lifecycle owner prepared the decision and preflight artifacts, then spawned a
262
- host-local tmux sidecar outside the managed topology. The sidecar stopped only
263
- the daemon, used a verified graceful PID fallback when daemon state was stale,
264
- started the pinned runtime, aligned the default wrapper, verified the protected
265
- topology, ran targeted smoke checks, retained cutover evidence, and handed the
266
- result back while delivery continued.
267
-
268
- Important caveat: live `rig up --plan --json` accepted valid `starter_ref`
269
- specs and rejected forbidden compositions, but plan-mode output did not emit the
270
- `resolve_starter.detail.starterContent` stage expected by the Dogfood proof bar.
271
- This is a product/dogfood caveat, not an upgrade failure.
272
-
273
- ## Brittle Edges Observed On 2026-04-27
274
-
275
- Operator lessons from the daemon upgrade:
276
-
277
- - `rig down` kills OpenRig-launched tmux sessions. Do not use it as a snapshot
278
- primitive when resumability depends on keeping sessions alive.
279
- - Old daemon/CLI combinations can be partially functional even when newer health
280
- checks fail. A `/healthz` mismatch blocked `rig down --snapshot` even though
281
- other daemon APIs still worked.
282
- - `rig daemon stop` can fail when the daemon state file is missing. Operators
283
- need a verified PID fallback, but the product should reconcile daemon state
284
- automatically.
285
- - If the sidecar has an operator auto window and `rig daemon stop` refuses only
286
- because state is stale, a verified graceful PID termination is acceptable:
287
- identify the daemon PID, verify its runtime path, send graceful `TERM`, and
288
- verify the port is gone before starting the target daemon.
289
- - CLI and daemon provenance can drift. Repointing or verifying the default
290
- `rig` wrapper is part of the upgrade, not an afterthought.
291
- - Raw `rig ps` output can be noisy. Use filtered JSON until the product
292
- has compact first-class inventory views.
293
- - Snapshot and backup verification is too manual. The SOP currently depends on
294
- checking snapshot rows, resume tokens, SQLite backups, and integrity by hand.
295
-
296
- ## Disruptive Restore Path
297
-
298
- Use disruptive restore when the goal is to test recovery from killed sessions, or
299
- when hot upgrade is blocked by incompatible migrations or corrupted management
300
- state.
77
+ Take continuity snapshots first:
301
78
 
302
79
  ```bash
303
- rig snapshot <rigId>
304
- rig down <rigId>
305
- # upgrade daemon/CLI
306
- rig up <rigName>
307
- rig restore-check --rig <rigName>
80
+ rig snapshot <rig-id>
81
+ node "$SKILL_DIR/scripts/backup-sqlite.mjs" \
82
+ --source "$OPENRIG_HOME/openrig.sqlite" \
83
+ --destination "/safe/path/openrig-before-upgrade.sqlite"
308
84
  ```
309
85
 
310
- Expected restore results:
311
-
312
- | Result | Meaning | Action |
313
- |---|---|---|
314
- | `fully_restored` | All nodes resumed or rebuilt | Resume normal work |
315
- | `partially_restored` | Some nodes succeeded, some failed | Inspect failed nodes and relaunch manually |
316
- | `failed` | Zero nodes restored | Check daemon logs, snapshot integrity, provider tokens |
317
- | `not_attempted` | Pre-restore blockers | Fix blockers before retrying |
318
-
319
- Do not confuse this path with hot upgrade. `rig down` is intentionally
320
- disruptive.
321
-
322
- ## Stop Conditions
86
+ The helper refuses to overwrite a destination, uses SQLite's backup operation,
87
+ and verifies the backup with `PRAGMA integrity_check`. It does not stop the
88
+ daemon or restore a database.
323
89
 
324
- Do not proceed with hot upgrade if:
90
+ ### Plan or apply safe managed-plugin refreshes
325
91
 
326
- - continuity targets are mid-task and cannot checkpoint;
327
- - continuity target tmux sessions are missing before upgrade;
328
- - no verified DB backup exists after continuity snapshots;
329
- - the target runtime cannot build under an even/LTS Node version;
330
- - the daemon migration plan is known to rewrite session/binding semantics in a
331
- way that has not been tested;
332
- - disk space or DB integrity checks fail;
333
- - the operator cannot identify the current daemon PID and runtime source.
92
+ Plugin trees may contain skills as well as hooks and metadata. Compare the last
93
+ packaged ancestor, the target package, and the live installed tree:
334
94
 
335
- ## Rollback
336
-
337
- Rollback means restoring the previous daemon runtime and, if necessary, the DB
338
- backup.
339
-
340
- For source runtime:
341
-
342
- 1. Stop the new daemon.
343
- 2. Start the previous runtime or npm/global daemon.
344
- 3. Verify `/healthz`, filtered continuity inventory, and `rig capture`.
345
- 4. Restore the DB backup only if migration or DB corruption is confirmed. Do not
346
- replace the DB just because continuity sessions are still live but management
347
- projection is degraded.
95
+ ```bash
96
+ node "$SKILL_DIR/scripts/refresh-managed-plugin.mjs" \
97
+ --ancestor /path/to/previous/package/plugin \
98
+ --target /path/to/target/package/plugin \
99
+ --live "$OPENRIG_HOME/plugins/<plugin>"
100
+ ```
348
101
 
349
- For npm runtime:
102
+ Review the sorted decisions. To apply only `refresh-safe` and `add-safe` files:
350
103
 
351
104
  ```bash
352
- npm install -g @openrig/cli@<previous-version>
353
- rig daemon stop
354
- rig daemon start
105
+ node "$SKILL_DIR/scripts/refresh-managed-plugin.mjs" \
106
+ --ancestor /path/to/previous/package/plugin \
107
+ --target /path/to/target/package/plugin \
108
+ --live "$OPENRIG_HOME/plugins/<plugin>" \
109
+ --apply-safe
355
110
  ```
356
111
 
357
- ## Roadmap: Better Hot Upgrades
358
-
359
- The product should make the proven manual path boring and explicit.
360
-
361
- Needed product surfaces:
362
-
363
- - `rig upgrade preflight`:
364
- daemon PID/runtime source, CLI source, DB path, migration plan, active rigs,
365
- continuity targets, tmux liveness, disk space, DB integrity, backup target,
366
- and rollback runtime.
367
- - `rig daemon adopt-state` or equivalent:
368
- recover a healthy daemon on a port when `daemon.json` is missing.
369
- - `rig upgrade backup`:
370
- online SQLite backup plus integrity and snapshot-presence verification.
371
- - `rig upgrade promote-runtime <commit|artifact>`:
372
- start from a clean worktree or packaged artifact under an even/LTS Node.
373
- - `rig upgrade verify --rig <name>`:
374
- filtered inventory, capture, transcript, restore-check, and honest continuity
375
- classification.
376
- - CLI/daemon provenance:
377
- `rig version --json` should report CLI path, daemon path, commit/package
378
- version, Node version, DB path, and started-at.
379
- - Wrapper alignment:
380
- the default `rig` wrapper should clearly show which real CLI it delegates to.
381
- - Compact inventory:
382
- first-class `rig ps --rig <name> --nodes --compact` or equivalent, so
383
- operators do not need ad hoc `jq` for routine safety checks.
384
-
385
- Research still needed:
386
-
387
- 1. Migration-bearing hot upgrade on a throwaway rig.
388
- 2. Hot upgrade with non-critical live Codex seats.
389
- 3. Hot upgrade with service-backed rigs.
390
- 4. Adoption/reconciliation when daemon DB says sessions are running but tmux has
391
- partially drifted.
392
- 5. Automated rollback on daemon startup failure or migration failure.
393
-
394
- ## Operator Summary
395
-
396
- Hot upgrade rule:
397
-
398
- **Snapshot continuity rigs, back up the DB, stop only the daemon, start the new
399
- daemon against the same DB, then verify live tmux sessions through filtered
400
- management surfaces.**
401
-
402
- Disruptive restore rule:
403
-
404
- **Use `rig down` only when testing or accepting session teardown.**
112
+ The helper never deletes a live file and never overwrites a local modification.
113
+ Local deletions, live-only files, target removals, and ambiguous types are
114
+ reported for the agent to resolve. Re-run the plan after any manual resolution.
115
+
116
+ ## Agent-led continuity upgrade
117
+
118
+ This is a decision guide, not a command recipe. Adapt paths and checks to the
119
+ host in front of you.
120
+
121
+ 1. Inspect the current CLI, daemon, nodes, and plugins with the helper.
122
+ 2. Checkpoint active work and record the exact protected tmux/session census.
123
+ 3. Run `rig snapshot <rig-id>` for each protected rig.
124
+ 4. Create and verify the SQLite backup.
125
+ 5. Build or stage the target runtime separately. Prove its version and source
126
+ identity before touching the live daemon.
127
+ 6. Run `rig daemon stop`. Verify both the listener and the identified daemon
128
+ process are gone. If the command returns while either remains, stop: inspect
129
+ identity and use the host's authorized recovery procedure. Do not blindly
130
+ signal a PID.
131
+ 7. Start the target with `rig daemon start` or the host's known wrapper. Verify
132
+ daemon status, process path, listener, version, and database integrity.
133
+ 8. Run the plugin refresh helper in plan mode. Apply safe writes only after the
134
+ three roots and classifications make sense; resolve preserved paths one at a
135
+ time when required.
136
+ 9. Verify protected seats with `rig ps --nodes -A --json`, representative
137
+ `rig capture`, and `rig restore-check` where applicable. `-A` is required:
138
+ without it the node read is your CURRENT rig only, and a daemon upgrade
139
+ protects seats across every rig on the host — so the narrow form reports
140
+ success while seats outside your rig went unchecked.
141
+ 10. Align wrappers only after deriving how that host owns them. Use its existing
142
+ mechanism; this skill does not rewrite launchers.
143
+ 11. Record the observed result, remaining local preservation decisions, and the
144
+ exact rollback runtime and backup.
145
+
146
+ ## Stop and hand back when
147
+
148
+ - a protected tmux session is missing before the upgrade;
149
+ - database integrity or backup verification fails;
150
+ - the running process or listener does not match the expected runtime;
151
+ - daemon stop reports success but the identified process or listener remains;
152
+ - the target cannot start against the existing database;
153
+ - plugin roots cannot be tied to a known ancestor and target;
154
+ - a required plugin path is classified as locally modified or deleted and the
155
+ correct ownership decision is unclear;
156
+ - continuing would require `rig down`, destructive restore, credential changes,
157
+ or broader authority than the operator has.
158
+
159
+ When stopping, report the last proven-good state, the first failed expectation,
160
+ the exact evidence, and the smallest decision needed from the owner. Preserve
161
+ live seats and the database unless recovery specifically requires otherwise.
162
+
163
+ ## Rollback is also agent-led
164
+
165
+ Prefer starting the previous known runtime against the still-valid database.
166
+ Restore the database backup only when a migration or corruption finding requires
167
+ it; a degraded projection alone is not proof that the database should be
168
+ replaced. After rollback, repeat the same process, listener, database, plugin,
169
+ and seat observations used during the forward path.
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawnSync } from "node:child_process";
4
+ import fs from "node:fs";
5
+ import path from "node:path";
6
+
7
+ function argument(name) {
8
+ const index = process.argv.indexOf(name);
9
+ return index === -1 ? undefined : process.argv[index + 1];
10
+ }
11
+
12
+ function fail(message, next) {
13
+ process.stderr.write(`${JSON.stringify({ ok: false, error: message, next }, null, 2)}\n`);
14
+ process.exit(1);
15
+ }
16
+
17
+ const source = argument("--source");
18
+ const destination = argument("--destination");
19
+ if (!source || !destination) {
20
+ fail("--source and --destination are required", "choose an existing OpenRig SQLite database and a new backup path");
21
+ }
22
+
23
+ const sourcePath = path.resolve(source);
24
+ const destinationPath = path.resolve(destination);
25
+ if (!fs.existsSync(sourcePath) || !fs.statSync(sourcePath).isFile()) {
26
+ fail(`source database is not a regular file: ${sourcePath}`, "derive the live database path from daemon status before retrying");
27
+ }
28
+ if (fs.existsSync(destinationPath)) {
29
+ fail(`destination already exists: ${destinationPath}`, "choose a new path; this helper never overwrites a backup");
30
+ }
31
+ if (destinationPath.includes("'") || destinationPath.includes("\n")) {
32
+ fail("destination contains a quote or newline unsupported by the sqlite3 backup command", "choose a simple filesystem path");
33
+ }
34
+
35
+ fs.mkdirSync(path.dirname(destinationPath), { recursive: true });
36
+ const sqlite = process.env.OPENRIG_SQLITE_BIN || "sqlite3";
37
+ const backup = spawnSync(sqlite, [sourcePath, `.backup '${destinationPath}'`], { encoding: "utf8" });
38
+ if (backup.status !== 0) {
39
+ fs.rmSync(destinationPath, { force: true });
40
+ fail(
41
+ backup.stderr?.trim() || backup.stdout?.trim() || backup.error?.message || "sqlite3 backup failed",
42
+ `run ${sqlite} against the source directly, resolve locking/path/tooling errors, then choose a fresh destination`,
43
+ );
44
+ }
45
+
46
+ const check = spawnSync(sqlite, [destinationPath, "PRAGMA integrity_check;"], { encoding: "utf8" });
47
+ const integrity = check.stdout?.trim();
48
+ if (check.status !== 0 || integrity !== "ok") {
49
+ fail(
50
+ check.stderr?.trim() || `backup integrity result was ${JSON.stringify(integrity)}`,
51
+ "preserve the failed backup for diagnosis only; do not use it for rollback",
52
+ );
53
+ }
54
+
55
+ process.stdout.write(`${JSON.stringify({
56
+ schema: "openrig-sqlite-backup/v1",
57
+ ok: true,
58
+ source: sourcePath,
59
+ destination: destinationPath,
60
+ bytes: fs.statSync(destinationPath).size,
61
+ integrity,
62
+ }, null, 2)}\n`);
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawnSync } from "node:child_process";
4
+
5
+ const rig = process.env.OPENRIG_RIG_BIN || "rig";
6
+
7
+ function probe(name, args, next) {
8
+ const result = spawnSync(rig, args, { encoding: "utf8" });
9
+ const stdout = result.stdout?.trim() || "";
10
+ const stderr = result.stderr?.trim() || "";
11
+ if (result.status === 0) {
12
+ let value = stdout;
13
+ try {
14
+ value = JSON.parse(stdout);
15
+ } catch {
16
+ // Versions and older surfaces may intentionally return plain text.
17
+ }
18
+ return { name, ok: true, command: [rig, ...args], value };
19
+ }
20
+ return {
21
+ name,
22
+ ok: false,
23
+ command: [rig, ...args],
24
+ exitCode: result.status,
25
+ error: stderr || stdout || result.error?.message || "command produced no diagnostic",
26
+ next,
27
+ };
28
+ }
29
+
30
+ const report = {
31
+ schema: "openrig-upgrade-inspection/v1",
32
+ generatedAt: new Date().toISOString(),
33
+ rigVersion: probe("rigVersion", ["--version"], `run ${rig} --version directly and verify the installed wrapper`),
34
+ daemonStatus: probe("daemonStatus", ["daemon", "status"], `run ${rig} daemon status and inspect daemon state and logs`),
35
+ nodes: probe("nodes", ["ps", "--nodes", "-A", "--json"], `run ${rig} ps --nodes -A --json and resolve control-plane reachability before mutation`),
36
+ plugins: probe("plugins", ["plugin", "list", "--json"], `run ${rig} plugin list --json and derive the installed plugin roots before refresh`),
37
+ };
38
+
39
+ report.ready = [report.rigVersion, report.daemonStatus, report.nodes, report.plugins].every((item) => item.ok);
40
+ process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);