@openrig/cli 0.7.15 → 0.7.17

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 (603) hide show
  1. package/README.md +9 -9
  2. package/daemon/assets/onboarding/02-self-and-competent-action.md +5 -41
  3. package/daemon/assets/plugins/openrig/.claude-plugin/plugin.json +1 -1
  4. package/daemon/assets/plugins/openrig/.codex-plugin/plugin.json +1 -1
  5. package/daemon/assets/plugins/openrig/.cursor-plugin/plugin.json +1 -1
  6. package/daemon/assets/plugins/openrig/README.md +26 -7
  7. package/daemon/assets/plugins/openrig/plugin.json +1 -1
  8. package/daemon/assets/plugins/openrig/skills/working-with-an-openrig-team/SKILL.md +22 -6
  9. package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +1 -1
  10. package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
  11. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/SKILL.md +4 -1
  12. package/daemon/assets/plugins/openrig-core/skills/seat-continuity-and-handover/SKILL.md +1 -1
  13. package/daemon/assets/skills/rigs/SKILL.md +155 -41
  14. package/daemon/assets/skills/rigs/references/installing-for-someone.md +47 -0
  15. package/daemon/context-packs/help/manifest.yaml +1 -1
  16. package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
  17. package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +169 -40
  18. package/daemon/context-packs/reference/getting-started.md +12 -11
  19. package/daemon/context-packs/reference/manifest.yaml +4 -1
  20. package/daemon/context-packs/reference/product-journey-sdlc.md +348 -0
  21. package/daemon/context-packs/reference/rig-spec.md +92 -4
  22. package/daemon/context-packs/reference/whats-new.md +397 -5
  23. package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
  24. package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
  25. package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
  26. package/daemon/context-packs/skills/claude-compaction-restore/SKILL.md +4 -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-software-factory/references/worked-example.md +1 -1
  39. package/daemon/context-packs/skills/core/openrig-upgrade/SKILL.md +2 -0
  40. package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
  41. package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
  42. package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
  43. package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
  44. package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
  45. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
  46. package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
  47. package/daemon/context-packs/skills/core/working-with-an-openrig-team/SKILL.md +22 -6
  48. package/daemon/context-packs/skills/core/working-with-an-openrig-team/manifest.yaml +1 -1
  49. package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
  50. package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
  51. package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
  52. package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
  53. package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
  54. package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
  55. package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
  56. package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
  57. package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
  58. package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
  59. package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
  60. package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
  61. package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
  62. package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
  63. package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
  64. package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
  65. package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
  66. package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
  67. package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
  68. package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
  69. package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
  70. package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
  71. package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
  72. package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
  73. package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
  74. package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
  75. package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
  76. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
  77. package/daemon/context-packs/skills/seat-continuity-and-handover/SKILL.md +1 -1
  78. package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
  79. package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
  80. package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
  81. package/daemon/context-packs/world-example/manifest.yaml +1 -1
  82. package/daemon/context-packs/world-public/manifest.yaml +1 -1
  83. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  84. package/daemon/dist/adapters/claude-code-adapter.js +42 -6
  85. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  86. package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
  87. package/daemon/dist/adapters/claude-resume.js +4 -2
  88. package/daemon/dist/adapters/claude-resume.js.map +1 -1
  89. package/daemon/dist/adapters/codex-resume.d.ts +2 -0
  90. package/daemon/dist/adapters/codex-resume.d.ts.map +1 -1
  91. package/daemon/dist/adapters/codex-resume.js +28 -11
  92. package/daemon/dist/adapters/codex-resume.js.map +1 -1
  93. package/daemon/dist/adapters/codex-runtime-adapter.d.ts +15 -0
  94. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  95. package/daemon/dist/adapters/codex-runtime-adapter.js +75 -28
  96. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  97. package/daemon/dist/adapters/openshell-driver.d.ts +1 -0
  98. package/daemon/dist/adapters/openshell-driver.d.ts.map +1 -1
  99. package/daemon/dist/adapters/openshell-driver.js +3 -0
  100. package/daemon/dist/adapters/openshell-driver.js.map +1 -1
  101. package/daemon/dist/adapters/openshell-podman-observer.d.ts +9 -7
  102. package/daemon/dist/adapters/openshell-podman-observer.d.ts.map +1 -1
  103. package/daemon/dist/adapters/openshell-podman-observer.js +20 -3
  104. package/daemon/dist/adapters/openshell-podman-observer.js.map +1 -1
  105. package/daemon/dist/adapters/pi-runner.d.ts +38 -4
  106. package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
  107. package/daemon/dist/adapters/pi-runner.js +244 -30
  108. package/daemon/dist/adapters/pi-runner.js.map +1 -1
  109. package/daemon/dist/adapters/tmux.d.ts +6 -0
  110. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  111. package/daemon/dist/adapters/tmux.js +17 -3
  112. package/daemon/dist/adapters/tmux.js.map +1 -1
  113. package/daemon/dist/build-info.js +3 -3
  114. package/daemon/dist/db/all-migrations.d.ts.map +1 -1
  115. package/daemon/dist/db/all-migrations.js +8 -0
  116. package/daemon/dist/db/all-migrations.js.map +1 -1
  117. package/daemon/dist/db/migrations/167_seat_handover_attempts.d.ts +14 -0
  118. package/daemon/dist/db/migrations/167_seat_handover_attempts.d.ts.map +1 -0
  119. package/daemon/dist/db/migrations/167_seat_handover_attempts.js +54 -0
  120. package/daemon/dist/db/migrations/167_seat_handover_attempts.js.map +1 -0
  121. package/daemon/dist/db/migrations/168_context_usage_occupant_generation.d.ts +6 -0
  122. package/daemon/dist/db/migrations/168_context_usage_occupant_generation.d.ts.map +1 -0
  123. package/daemon/dist/db/migrations/168_context_usage_occupant_generation.js +10 -0
  124. package/daemon/dist/db/migrations/168_context_usage_occupant_generation.js.map +1 -0
  125. package/daemon/dist/db/migrations/169_seat_runtime_home_records.d.ts +5 -0
  126. package/daemon/dist/db/migrations/169_seat_runtime_home_records.d.ts.map +1 -0
  127. package/daemon/dist/db/migrations/169_seat_runtime_home_records.js +25 -0
  128. package/daemon/dist/db/migrations/169_seat_runtime_home_records.js.map +1 -0
  129. package/daemon/dist/db/migrations/170_rig_delivery_drains.d.ts +3 -0
  130. package/daemon/dist/db/migrations/170_rig_delivery_drains.d.ts.map +1 -0
  131. package/daemon/dist/db/migrations/170_rig_delivery_drains.js +21 -0
  132. package/daemon/dist/db/migrations/170_rig_delivery_drains.js.map +1 -0
  133. package/daemon/dist/domain/claim-service.d.ts +1 -3
  134. package/daemon/dist/domain/claim-service.d.ts.map +1 -1
  135. package/daemon/dist/domain/claim-service.js +3 -1
  136. package/daemon/dist/domain/claim-service.js.map +1 -1
  137. package/daemon/dist/domain/claude-compaction-enforcer.d.ts +11 -0
  138. package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
  139. package/daemon/dist/domain/claude-compaction-enforcer.js +83 -36
  140. package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
  141. package/daemon/dist/domain/codex-filesystem-preflight.d.ts +33 -0
  142. package/daemon/dist/domain/codex-filesystem-preflight.d.ts.map +1 -0
  143. package/daemon/dist/domain/codex-filesystem-preflight.js +255 -0
  144. package/daemon/dist/domain/codex-filesystem-preflight.js.map +1 -0
  145. package/daemon/dist/domain/codex-member-permissions.d.ts +23 -2
  146. package/daemon/dist/domain/codex-member-permissions.d.ts.map +1 -1
  147. package/daemon/dist/domain/codex-member-permissions.js +55 -9
  148. package/daemon/dist/domain/codex-member-permissions.js.map +1 -1
  149. package/daemon/dist/domain/codex-network-default.d.ts +13 -0
  150. package/daemon/dist/domain/codex-network-default.d.ts.map +1 -1
  151. package/daemon/dist/domain/codex-network-default.js +37 -30
  152. package/daemon/dist/domain/codex-network-default.js.map +1 -1
  153. package/daemon/dist/domain/codex-thread-id.d.ts +13 -0
  154. package/daemon/dist/domain/codex-thread-id.d.ts.map +1 -1
  155. package/daemon/dist/domain/codex-thread-id.js +132 -9
  156. package/daemon/dist/domain/codex-thread-id.js.map +1 -1
  157. package/daemon/dist/domain/compaction-restore-notice.d.ts.map +1 -1
  158. package/daemon/dist/domain/compaction-restore-notice.js +59 -13
  159. package/daemon/dist/domain/compaction-restore-notice.js.map +1 -1
  160. package/daemon/dist/domain/connection-contract.d.ts.map +1 -1
  161. package/daemon/dist/domain/connection-contract.js +2 -1
  162. package/daemon/dist/domain/connection-contract.js.map +1 -1
  163. package/daemon/dist/domain/context-usage-store.d.ts +11 -2
  164. package/daemon/dist/domain/context-usage-store.d.ts.map +1 -1
  165. package/daemon/dist/domain/context-usage-store.js +33 -13
  166. package/daemon/dist/domain/context-usage-store.js.map +1 -1
  167. package/daemon/dist/domain/current-work.d.ts +5 -0
  168. package/daemon/dist/domain/current-work.d.ts.map +1 -1
  169. package/daemon/dist/domain/current-work.js +66 -4
  170. package/daemon/dist/domain/current-work.js.map +1 -1
  171. package/daemon/dist/domain/destination-successor.d.ts +3 -0
  172. package/daemon/dist/domain/destination-successor.d.ts.map +1 -0
  173. package/daemon/dist/domain/destination-successor.js +49 -0
  174. package/daemon/dist/domain/destination-successor.js.map +1 -0
  175. package/daemon/dist/domain/environment-lifecycle.d.ts +15 -0
  176. package/daemon/dist/domain/environment-lifecycle.d.ts.map +1 -1
  177. package/daemon/dist/domain/environment-lifecycle.js +22 -4
  178. package/daemon/dist/domain/environment-lifecycle.js.map +1 -1
  179. package/daemon/dist/domain/expected-conversation.d.ts.map +1 -1
  180. package/daemon/dist/domain/expected-conversation.js +26 -11
  181. package/daemon/dist/domain/expected-conversation.js.map +1 -1
  182. package/daemon/dist/domain/gateway/destination-resolver.d.ts +4 -0
  183. package/daemon/dist/domain/gateway/destination-resolver.d.ts.map +1 -1
  184. package/daemon/dist/domain/gateway/destination-resolver.js +10 -3
  185. package/daemon/dist/domain/gateway/destination-resolver.js.map +1 -1
  186. package/daemon/dist/domain/gateway/operator-delivery-engine.d.ts +3 -1
  187. package/daemon/dist/domain/gateway/operator-delivery-engine.d.ts.map +1 -1
  188. package/daemon/dist/domain/gateway/operator-delivery-engine.js +14 -4
  189. package/daemon/dist/domain/gateway/operator-delivery-engine.js.map +1 -1
  190. package/daemon/dist/domain/health-diagnosis.d.ts.map +1 -1
  191. package/daemon/dist/domain/health-diagnosis.js +4 -0
  192. package/daemon/dist/domain/health-diagnosis.js.map +1 -1
  193. package/daemon/dist/domain/health-passive-ceremony.d.ts +3 -0
  194. package/daemon/dist/domain/health-passive-ceremony.d.ts.map +1 -1
  195. package/daemon/dist/domain/health-passive-ceremony.js +45 -4
  196. package/daemon/dist/domain/health-passive-ceremony.js.map +1 -1
  197. package/daemon/dist/domain/hosts/fleet-scopes.d.ts +111 -0
  198. package/daemon/dist/domain/hosts/fleet-scopes.d.ts.map +1 -0
  199. package/daemon/dist/domain/hosts/fleet-scopes.js +231 -0
  200. package/daemon/dist/domain/hosts/fleet-scopes.js.map +1 -0
  201. package/daemon/dist/domain/hosts/read-through.d.ts +1 -1
  202. package/daemon/dist/domain/hosts/read-through.d.ts.map +1 -1
  203. package/daemon/dist/domain/hosts/read-through.js +4 -0
  204. package/daemon/dist/domain/hosts/read-through.js.map +1 -1
  205. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
  206. package/daemon/dist/domain/mission-control/mission-control-write-contract.js +1 -1
  207. package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
  208. package/daemon/dist/domain/native-model-picker.d.ts +2 -0
  209. package/daemon/dist/domain/native-model-picker.d.ts.map +1 -1
  210. package/daemon/dist/domain/native-model-picker.js +8 -2
  211. package/daemon/dist/domain/native-model-picker.js.map +1 -1
  212. package/daemon/dist/domain/native-permission-store.d.ts.map +1 -1
  213. package/daemon/dist/domain/native-permission-store.js +12 -5
  214. package/daemon/dist/domain/native-permission-store.js.map +1 -1
  215. package/daemon/dist/domain/native-process-lineage.d.ts +11 -1
  216. package/daemon/dist/domain/native-process-lineage.d.ts.map +1 -1
  217. package/daemon/dist/domain/native-process-lineage.js +25 -4
  218. package/daemon/dist/domain/native-process-lineage.js.map +1 -1
  219. package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
  220. package/daemon/dist/domain/native-resume-probe.js +109 -26
  221. package/daemon/dist/domain/native-resume-probe.js.map +1 -1
  222. package/daemon/dist/domain/network/network-connector.d.ts.map +1 -1
  223. package/daemon/dist/domain/network/network-connector.js +5 -3
  224. package/daemon/dist/domain/network/network-connector.js.map +1 -1
  225. package/daemon/dist/domain/network/network-installations.d.ts +5 -4
  226. package/daemon/dist/domain/network/network-installations.d.ts.map +1 -1
  227. package/daemon/dist/domain/network/network-installations.js +42 -11
  228. package/daemon/dist/domain/network/network-installations.js.map +1 -1
  229. package/daemon/dist/domain/node-launcher.d.ts +6 -0
  230. package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
  231. package/daemon/dist/domain/node-launcher.js +10 -3
  232. package/daemon/dist/domain/node-launcher.js.map +1 -1
  233. package/daemon/dist/domain/occupant-invalidator.d.ts +4 -1
  234. package/daemon/dist/domain/occupant-invalidator.d.ts.map +1 -1
  235. package/daemon/dist/domain/occupant-invalidator.js +10 -2
  236. package/daemon/dist/domain/occupant-invalidator.js.map +1 -1
  237. package/daemon/dist/domain/operation-correlation.d.ts +1 -1
  238. package/daemon/dist/domain/operation-correlation.d.ts.map +1 -1
  239. package/daemon/dist/domain/operation-correlation.js +1 -1
  240. package/daemon/dist/domain/operation-correlation.js.map +1 -1
  241. package/daemon/dist/domain/permission-account.d.ts.map +1 -1
  242. package/daemon/dist/domain/permission-account.js +8 -6
  243. package/daemon/dist/domain/permission-account.js.map +1 -1
  244. package/daemon/dist/domain/permission-drift.d.ts.map +1 -1
  245. package/daemon/dist/domain/permission-drift.js +1 -1
  246. package/daemon/dist/domain/permission-drift.js.map +1 -1
  247. package/daemon/dist/domain/queue-destination-check.d.ts +2 -0
  248. package/daemon/dist/domain/queue-destination-check.d.ts.map +1 -1
  249. package/daemon/dist/domain/queue-destination-check.js +8 -11
  250. package/daemon/dist/domain/queue-destination-check.js.map +1 -1
  251. package/daemon/dist/domain/queue-erasure.d.ts +7 -1
  252. package/daemon/dist/domain/queue-erasure.d.ts.map +1 -1
  253. package/daemon/dist/domain/queue-erasure.js +226 -20
  254. package/daemon/dist/domain/queue-erasure.js.map +1 -1
  255. package/daemon/dist/domain/queue-repository.d.ts +39 -17
  256. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  257. package/daemon/dist/domain/queue-repository.js +96 -64
  258. package/daemon/dist/domain/queue-repository.js.map +1 -1
  259. package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
  260. package/daemon/dist/domain/queue-stuck-sweep.js +49 -21
  261. package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
  262. package/daemon/dist/domain/queue-transition-log.d.ts +6 -0
  263. package/daemon/dist/domain/queue-transition-log.d.ts.map +1 -1
  264. package/daemon/dist/domain/queue-transition-log.js +9 -0
  265. package/daemon/dist/domain/queue-transition-log.js.map +1 -1
  266. package/daemon/dist/domain/queue-waiting.d.ts +4 -4
  267. package/daemon/dist/domain/queue-waiting.d.ts.map +1 -1
  268. package/daemon/dist/domain/queue-waiting.js +30 -16
  269. package/daemon/dist/domain/queue-waiting.js.map +1 -1
  270. package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
  271. package/daemon/dist/domain/queue-wake-ladder.js +90 -24
  272. package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
  273. package/daemon/dist/domain/receiver-context.js +1 -1
  274. package/daemon/dist/domain/receiver-context.js.map +1 -1
  275. package/daemon/dist/domain/restore-check-service.d.ts +13 -0
  276. package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
  277. package/daemon/dist/domain/restore-check-service.js +122 -9
  278. package/daemon/dist/domain/restore-check-service.js.map +1 -1
  279. package/daemon/dist/domain/restore-orchestrator.d.ts +4 -1
  280. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  281. package/daemon/dist/domain/restore-orchestrator.js +132 -48
  282. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  283. package/daemon/dist/domain/restore-preconditions.d.ts +2 -0
  284. package/daemon/dist/domain/restore-preconditions.d.ts.map +1 -1
  285. package/daemon/dist/domain/restore-preconditions.js +2 -0
  286. package/daemon/dist/domain/restore-preconditions.js.map +1 -1
  287. package/daemon/dist/domain/resume-metadata-refresher.d.ts +17 -4
  288. package/daemon/dist/domain/resume-metadata-refresher.d.ts.map +1 -1
  289. package/daemon/dist/domain/resume-metadata-refresher.js +64 -15
  290. package/daemon/dist/domain/resume-metadata-refresher.js.map +1 -1
  291. package/daemon/dist/domain/resume-token-capture.d.ts +6 -0
  292. package/daemon/dist/domain/resume-token-capture.d.ts.map +1 -1
  293. package/daemon/dist/domain/resume-token-capture.js +14 -8
  294. package/daemon/dist/domain/resume-token-capture.js.map +1 -1
  295. package/daemon/dist/domain/rig-delivery-drain.d.ts +46 -0
  296. package/daemon/dist/domain/rig-delivery-drain.d.ts.map +1 -0
  297. package/daemon/dist/domain/rig-delivery-drain.js +128 -0
  298. package/daemon/dist/domain/rig-delivery-drain.js.map +1 -0
  299. package/daemon/dist/domain/rig-edge-ops.js +1 -1
  300. package/daemon/dist/domain/rig-edge-ops.js.map +1 -1
  301. package/daemon/dist/domain/rig-lifecycle-service.d.ts.map +1 -1
  302. package/daemon/dist/domain/rig-lifecycle-service.js +4 -1
  303. package/daemon/dist/domain/rig-lifecycle-service.js.map +1 -1
  304. package/daemon/dist/domain/rig-teardown.d.ts +20 -3
  305. package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
  306. package/daemon/dist/domain/rig-teardown.js +71 -11
  307. package/daemon/dist/domain/rig-teardown.js.map +1 -1
  308. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  309. package/daemon/dist/domain/rigspec-instantiator.js +6 -2
  310. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  311. package/daemon/dist/domain/rigspec-preflight.d.ts +1 -1
  312. package/daemon/dist/domain/rigspec-preflight.d.ts.map +1 -1
  313. package/daemon/dist/domain/rigspec-preflight.js +36 -1
  314. package/daemon/dist/domain/rigspec-preflight.js.map +1 -1
  315. package/daemon/dist/domain/rosters.d.ts +19 -0
  316. package/daemon/dist/domain/rosters.d.ts.map +1 -1
  317. package/daemon/dist/domain/rosters.js +69 -12
  318. package/daemon/dist/domain/rosters.js.map +1 -1
  319. package/daemon/dist/domain/runtime-adapter.d.ts +15 -0
  320. package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
  321. package/daemon/dist/domain/runtime-adapter.js.map +1 -1
  322. package/daemon/dist/domain/seat-delivery-guard.d.ts +8 -2
  323. package/daemon/dist/domain/seat-delivery-guard.d.ts.map +1 -1
  324. package/daemon/dist/domain/seat-delivery-guard.js +38 -3
  325. package/daemon/dist/domain/seat-delivery-guard.js.map +1 -1
  326. package/daemon/dist/domain/seat-handover-attempts.d.ts +50 -0
  327. package/daemon/dist/domain/seat-handover-attempts.d.ts.map +1 -0
  328. package/daemon/dist/domain/seat-handover-attempts.js +75 -0
  329. package/daemon/dist/domain/seat-handover-attempts.js.map +1 -0
  330. package/daemon/dist/domain/seat-handover-service.d.ts +64 -1
  331. package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
  332. package/daemon/dist/domain/seat-handover-service.js +443 -29
  333. package/daemon/dist/domain/seat-handover-service.js.map +1 -1
  334. package/daemon/dist/domain/seat-launch-environment.d.ts +3 -2
  335. package/daemon/dist/domain/seat-launch-environment.d.ts.map +1 -1
  336. package/daemon/dist/domain/seat-launch-environment.js +16 -4
  337. package/daemon/dist/domain/seat-launch-environment.js.map +1 -1
  338. package/daemon/dist/domain/seat-lifecycle-service.d.ts +47 -2
  339. package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
  340. package/daemon/dist/domain/seat-lifecycle-service.js +48 -2
  341. package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
  342. package/daemon/dist/domain/seat-runtime-home-record-types.d.ts +16 -0
  343. package/daemon/dist/domain/seat-runtime-home-record-types.d.ts.map +1 -0
  344. package/daemon/dist/domain/seat-runtime-home-record-types.js +2 -0
  345. package/daemon/dist/domain/seat-runtime-home-record-types.js.map +1 -0
  346. package/daemon/dist/domain/seat-runtime-home-record.d.ts +173 -0
  347. package/daemon/dist/domain/seat-runtime-home-record.d.ts.map +1 -0
  348. package/daemon/dist/domain/seat-runtime-home-record.js +317 -0
  349. package/daemon/dist/domain/seat-runtime-home-record.js.map +1 -0
  350. package/daemon/dist/domain/seat-runtime-switch-service.d.ts +7 -0
  351. package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -1
  352. package/daemon/dist/domain/seat-runtime-switch-service.js +47 -2
  353. package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
  354. package/daemon/dist/domain/seat-skill-storage.d.ts +16 -1
  355. package/daemon/dist/domain/seat-skill-storage.d.ts.map +1 -1
  356. package/daemon/dist/domain/seat-skill-storage.js +178 -1
  357. package/daemon/dist/domain/seat-skill-storage.js.map +1 -1
  358. package/daemon/dist/domain/session-name.d.ts +13 -0
  359. package/daemon/dist/domain/session-name.d.ts.map +1 -1
  360. package/daemon/dist/domain/session-name.js +77 -0
  361. package/daemon/dist/domain/session-name.js.map +1 -1
  362. package/daemon/dist/domain/session-registry.d.ts +7 -1
  363. package/daemon/dist/domain/session-registry.d.ts.map +1 -1
  364. package/daemon/dist/domain/session-registry.js +7 -4
  365. package/daemon/dist/domain/session-registry.js.map +1 -1
  366. package/daemon/dist/domain/session-transport.d.ts +1 -0
  367. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  368. package/daemon/dist/domain/session-transport.js +33 -9
  369. package/daemon/dist/domain/session-transport.js.map +1 -1
  370. package/daemon/dist/domain/shared-history-selection.d.ts +1 -0
  371. package/daemon/dist/domain/shared-history-selection.d.ts.map +1 -1
  372. package/daemon/dist/domain/shared-history-selection.js +3 -1
  373. package/daemon/dist/domain/shared-history-selection.js.map +1 -1
  374. package/daemon/dist/domain/skill-catalog.d.ts +3 -0
  375. package/daemon/dist/domain/skill-catalog.d.ts.map +1 -1
  376. package/daemon/dist/domain/skill-catalog.js +7 -3
  377. package/daemon/dist/domain/skill-catalog.js.map +1 -1
  378. package/daemon/dist/domain/snapshot-capture.d.ts +4 -1
  379. package/daemon/dist/domain/snapshot-capture.d.ts.map +1 -1
  380. package/daemon/dist/domain/snapshot-capture.js +24 -12
  381. package/daemon/dist/domain/snapshot-capture.js.map +1 -1
  382. package/daemon/dist/domain/startup-submission-evidence.d.ts.map +1 -1
  383. package/daemon/dist/domain/startup-submission-evidence.js +3 -2
  384. package/daemon/dist/domain/startup-submission-evidence.js.map +1 -1
  385. package/daemon/dist/domain/successor-session-launcher.d.ts +16 -0
  386. package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
  387. package/daemon/dist/domain/successor-session-launcher.js +70 -38
  388. package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
  389. package/daemon/dist/domain/types.d.ts +43 -2
  390. package/daemon/dist/domain/types.d.ts.map +1 -1
  391. package/daemon/dist/domain/types.js.map +1 -1
  392. package/daemon/dist/domain/user-settings/settings-browser.d.ts.map +1 -1
  393. package/daemon/dist/domain/user-settings/settings-browser.js +3 -1
  394. package/daemon/dist/domain/user-settings/settings-browser.js.map +1 -1
  395. package/daemon/dist/domain/user-settings/settings-store.d.ts +1 -1
  396. package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
  397. package/daemon/dist/domain/user-settings/settings-store.js +6 -0
  398. package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
  399. package/daemon/dist/domain/watchdog-policy-engine.d.ts +4 -0
  400. package/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -1
  401. package/daemon/dist/domain/watchdog-policy-engine.js +28 -1
  402. package/daemon/dist/domain/watchdog-policy-engine.js.map +1 -1
  403. package/daemon/dist/domain/workflow-exception-escalation.d.ts.map +1 -1
  404. package/daemon/dist/domain/workflow-exception-escalation.js +13 -8
  405. package/daemon/dist/domain/workflow-exception-escalation.js.map +1 -1
  406. package/daemon/dist/domain/workflow-instance-store.d.ts +14 -2
  407. package/daemon/dist/domain/workflow-instance-store.d.ts.map +1 -1
  408. package/daemon/dist/domain/workflow-instance-store.js +41 -4
  409. package/daemon/dist/domain/workflow-instance-store.js.map +1 -1
  410. package/daemon/dist/domain/workflow-projector.d.ts +55 -0
  411. package/daemon/dist/domain/workflow-projector.d.ts.map +1 -1
  412. package/daemon/dist/domain/workflow-projector.js +355 -174
  413. package/daemon/dist/domain/workflow-projector.js.map +1 -1
  414. package/daemon/dist/domain/workflow-reconciliation.d.ts +7 -1
  415. package/daemon/dist/domain/workflow-reconciliation.d.ts.map +1 -1
  416. package/daemon/dist/domain/workflow-reconciliation.js +51 -13
  417. package/daemon/dist/domain/workflow-reconciliation.js.map +1 -1
  418. package/daemon/dist/domain/workflow-runtime.d.ts +11 -3
  419. package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
  420. package/daemon/dist/domain/workflow-runtime.js +141 -27
  421. package/daemon/dist/domain/workflow-runtime.js.map +1 -1
  422. package/daemon/dist/lib/pane-envelope.d.ts.map +1 -1
  423. package/daemon/dist/lib/pane-envelope.js +12 -7
  424. package/daemon/dist/lib/pane-envelope.js.map +1 -1
  425. package/daemon/dist/routes/compaction.d.ts.map +1 -1
  426. package/daemon/dist/routes/compaction.js +6 -3
  427. package/daemon/dist/routes/compaction.js.map +1 -1
  428. package/daemon/dist/routes/queue.d.ts.map +1 -1
  429. package/daemon/dist/routes/queue.js +78 -31
  430. package/daemon/dist/routes/queue.js.map +1 -1
  431. package/daemon/dist/routes/restore-check.d.ts.map +1 -1
  432. package/daemon/dist/routes/restore-check.js +17 -0
  433. package/daemon/dist/routes/restore-check.js.map +1 -1
  434. package/daemon/dist/routes/rig-delivery-drain.d.ts +3 -0
  435. package/daemon/dist/routes/rig-delivery-drain.d.ts.map +1 -0
  436. package/daemon/dist/routes/rig-delivery-drain.js +46 -0
  437. package/daemon/dist/routes/rig-delivery-drain.js.map +1 -0
  438. package/daemon/dist/routes/scopes.d.ts.map +1 -1
  439. package/daemon/dist/routes/scopes.js +102 -19
  440. package/daemon/dist/routes/scopes.js.map +1 -1
  441. package/daemon/dist/routes/seat.d.ts.map +1 -1
  442. package/daemon/dist/routes/seat.js +50 -2
  443. package/daemon/dist/routes/seat.js.map +1 -1
  444. package/daemon/dist/routes/sessions.d.ts.map +1 -1
  445. package/daemon/dist/routes/sessions.js +54 -10
  446. package/daemon/dist/routes/sessions.js.map +1 -1
  447. package/daemon/dist/routes/startup.d.ts.map +1 -1
  448. package/daemon/dist/routes/startup.js +230 -40
  449. package/daemon/dist/routes/startup.js.map +1 -1
  450. package/daemon/dist/routes/transport.d.ts.map +1 -1
  451. package/daemon/dist/routes/transport.js +36 -2
  452. package/daemon/dist/routes/transport.js.map +1 -1
  453. package/daemon/dist/routes/up.js +2 -0
  454. package/daemon/dist/routes/up.js.map +1 -1
  455. package/daemon/dist/routes/watchdog.d.ts.map +1 -1
  456. package/daemon/dist/routes/watchdog.js +7 -1
  457. package/daemon/dist/routes/watchdog.js.map +1 -1
  458. package/daemon/dist/routes/workflow.d.ts.map +1 -1
  459. package/daemon/dist/routes/workflow.js +23 -5
  460. package/daemon/dist/routes/workflow.js.map +1 -1
  461. package/daemon/dist/server.d.ts.map +1 -1
  462. package/daemon/dist/server.js +2 -0
  463. package/daemon/dist/server.js.map +1 -1
  464. package/daemon/dist/startup.d.ts.map +1 -1
  465. package/daemon/dist/startup.js +111 -37
  466. package/daemon/dist/startup.js.map +1 -1
  467. package/daemon/docs/reference/agent-startup-guide.md +90 -2
  468. package/daemon/docs/reference/daemon-http-clients.md +69 -0
  469. package/daemon/docs/reference/developing.md +1 -1
  470. package/daemon/docs/reference/gateway-participants.md +5 -3
  471. package/daemon/docs/reference/getting-started.md +12 -11
  472. package/daemon/docs/reference/hosted-members.md +4 -2
  473. package/daemon/docs/reference/network-connector.md +4 -3
  474. package/daemon/docs/reference/queue-erasure.md +16 -1
  475. package/daemon/docs/reference/quickstart.md +2 -2
  476. package/daemon/docs/reference/rig-spec.md +92 -4
  477. package/daemon/docs/reference/rosters.md +26 -0
  478. package/daemon/docs/reference/seat-delivery.md +7 -1
  479. package/daemon/docs/reference/whats-new.md +397 -5
  480. package/daemon/specs/agents/shared/skills/core/openrig-software-factory/references/worked-example.md +1 -1
  481. package/daemon/specs/agents/shared/skills/core/openrig-upgrade/SKILL.md +2 -0
  482. package/daemon/specs/agents/shared/skills/core/working-with-an-openrig-team/SKILL.md +22 -6
  483. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +78 -18
  484. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/startup/context.md +9 -6
  485. package/dist/build-info.js +3 -3
  486. package/dist/client.d.ts +7 -3
  487. package/dist/client.d.ts.map +1 -1
  488. package/dist/client.js +11 -2
  489. package/dist/client.js.map +1 -1
  490. package/dist/commands/config.d.ts.map +1 -1
  491. package/dist/commands/config.js +2 -0
  492. package/dist/commands/config.js.map +1 -1
  493. package/dist/commands/down.d.ts.map +1 -1
  494. package/dist/commands/down.js +5 -1
  495. package/dist/commands/down.js.map +1 -1
  496. package/dist/commands/environment.js +1 -1
  497. package/dist/commands/environment.js.map +1 -1
  498. package/dist/commands/launch.d.ts.map +1 -1
  499. package/dist/commands/launch.js +8 -0
  500. package/dist/commands/launch.js.map +1 -1
  501. package/dist/commands/mcp.d.ts.map +1 -1
  502. package/dist/commands/mcp.js +18 -1
  503. package/dist/commands/mcp.js.map +1 -1
  504. package/dist/commands/network.d.ts +2 -0
  505. package/dist/commands/network.d.ts.map +1 -1
  506. package/dist/commands/network.js +14 -1
  507. package/dist/commands/network.js.map +1 -1
  508. package/dist/commands/ps.d.ts.map +1 -1
  509. package/dist/commands/ps.js +11 -5
  510. package/dist/commands/ps.js.map +1 -1
  511. package/dist/commands/queue.d.ts +1 -1
  512. package/dist/commands/queue.d.ts.map +1 -1
  513. package/dist/commands/queue.js +49 -12
  514. package/dist/commands/queue.js.map +1 -1
  515. package/dist/commands/restore.d.ts.map +1 -1
  516. package/dist/commands/restore.js +6 -1
  517. package/dist/commands/restore.js.map +1 -1
  518. package/dist/commands/roster.d.ts +4 -2
  519. package/dist/commands/roster.d.ts.map +1 -1
  520. package/dist/commands/roster.js +2 -2
  521. package/dist/commands/roster.js.map +1 -1
  522. package/dist/commands/seat.d.ts +2 -0
  523. package/dist/commands/seat.d.ts.map +1 -1
  524. package/dist/commands/seat.js +201 -14
  525. package/dist/commands/seat.js.map +1 -1
  526. package/dist/commands/send.d.ts.map +1 -1
  527. package/dist/commands/send.js +31 -6
  528. package/dist/commands/send.js.map +1 -1
  529. package/dist/commands/setup.d.ts.map +1 -1
  530. package/dist/commands/setup.js +5 -3
  531. package/dist/commands/setup.js.map +1 -1
  532. package/dist/commands/up.d.ts.map +1 -1
  533. package/dist/commands/up.js +7 -0
  534. package/dist/commands/up.js.map +1 -1
  535. package/dist/commands/walk.d.ts.map +1 -1
  536. package/dist/commands/walk.js +4 -0
  537. package/dist/commands/walk.js.map +1 -1
  538. package/dist/commands/workflow.d.ts.map +1 -1
  539. package/dist/commands/workflow.js +30 -4
  540. package/dist/commands/workflow.js.map +1 -1
  541. package/dist/config-store.d.ts +3 -1
  542. package/dist/config-store.d.ts.map +1 -1
  543. package/dist/config-store.js +5 -0
  544. package/dist/config-store.js.map +1 -1
  545. package/dist/lib/bundle-check.d.ts.map +1 -1
  546. package/dist/lib/bundle-check.js +33 -3
  547. package/dist/lib/bundle-check.js.map +1 -1
  548. package/dist/mcp-http.d.ts +3 -0
  549. package/dist/mcp-http.d.ts.map +1 -1
  550. package/dist/mcp-http.js +13 -0
  551. package/dist/mcp-http.js.map +1 -1
  552. package/dist/mcp-server.d.ts +9 -2
  553. package/dist/mcp-server.d.ts.map +1 -1
  554. package/dist/mcp-server.js +287 -69
  555. package/dist/mcp-server.js.map +1 -1
  556. package/dist/person-registration-offer.d.ts.map +1 -1
  557. package/dist/person-registration-offer.js +2 -1
  558. package/dist/person-registration-offer.js.map +1 -1
  559. package/package.json +2 -2
  560. package/tui/dist/commands/registry.d.ts.map +1 -1
  561. package/tui/dist/commands/registry.js +1 -0
  562. package/tui/dist/commands/registry.js.map +1 -1
  563. package/tui/dist/config/config-model.js +1 -1
  564. package/tui/dist/config/config-model.js.map +1 -1
  565. package/tui/dist/crash-cart/start-daemon.d.ts.map +1 -1
  566. package/tui/dist/crash-cart/start-daemon.js +4 -2
  567. package/tui/dist/crash-cart/start-daemon.js.map +1 -1
  568. package/tui/dist/daemon-client.d.ts +12 -1
  569. package/tui/dist/daemon-client.d.ts.map +1 -1
  570. package/tui/dist/daemon-client.js +44 -2
  571. package/tui/dist/daemon-client.js.map +1 -1
  572. package/tui/dist/hydrate.d.ts +1 -1
  573. package/tui/dist/hydrate.d.ts.map +1 -1
  574. package/tui/dist/hydrate.js +43 -1
  575. package/tui/dist/hydrate.js.map +1 -1
  576. package/tui/dist/main.js +3 -0
  577. package/tui/dist/main.js.map +1 -1
  578. package/tui/dist/page-read.d.ts.map +1 -1
  579. package/tui/dist/page-read.js +2 -1
  580. package/tui/dist/page-read.js.map +1 -1
  581. package/tui/dist/render.d.ts.map +1 -1
  582. package/tui/dist/render.js +110 -16
  583. package/tui/dist/render.js.map +1 -1
  584. package/tui/dist/scopes/fleet-scopes-model.d.ts +73 -0
  585. package/tui/dist/scopes/fleet-scopes-model.d.ts.map +1 -0
  586. package/tui/dist/scopes/fleet-scopes-model.js +102 -0
  587. package/tui/dist/scopes/fleet-scopes-model.js.map +1 -0
  588. package/tui/dist/scopes/scopes-model.d.ts +2 -0
  589. package/tui/dist/scopes/scopes-model.d.ts.map +1 -1
  590. package/tui/dist/scopes/scopes-model.js +7 -4
  591. package/tui/dist/scopes/scopes-model.js.map +1 -1
  592. package/tui/dist/sections.d.ts.map +1 -1
  593. package/tui/dist/sections.js +5 -0
  594. package/tui/dist/sections.js.map +1 -1
  595. package/tui/dist/startup.d.ts +5 -0
  596. package/tui/dist/startup.d.ts.map +1 -1
  597. package/tui/dist/startup.js +12 -0
  598. package/tui/dist/startup.js.map +1 -1
  599. package/tui/dist/state.d.ts.map +1 -1
  600. package/tui/dist/state.js +12 -5
  601. package/tui/dist/state.js.map +1 -1
  602. package/tui/dist/types.d.ts +18 -1
  603. package/tui/dist/types.d.ts.map +1 -1
@@ -5,7 +5,7 @@ import { NativePermissionStore } from "./native-permission-store.js";
5
5
  import { readSeatClaudeMcp } from "./claude-mcp.js";
6
6
  import { isLaunchWrapperRuntime, readSeatLaunchWrapper } from "./launch-wrapper.js";
7
7
  import { ulid } from "ulid";
8
- import { SessionAddressConflict } from "./session-registry.js";
8
+ import { SessionAddressConflict, savedSessionName } from "./session-registry.js";
9
9
  import { shellQuote } from "../adapters/shell-quote.js";
10
10
  import { SeatStatusService } from "./seat-status-service.js";
11
11
  import { SeatHandoverPlanner, parseHandoverSource, SEAT_HANDOVER_SOURCE_CAPABILITIES } from "./seat-handover-planner.js";
@@ -27,6 +27,25 @@ import { seatCodexCorePluginDir, seatCorePluginDir, withPluginDirs } from "./cla
27
27
  import { retireSeatCoreSkillCopiesForNode, seatSkillPluginDirForNode } from "./seat-skill-storage.js";
28
28
  import { recordConversationPromptForNode, recordForkConversationPromptForNode, seatLaunchAdditionsForLaunch } from "./seat-launch-additions.js";
29
29
  import { inspectStartupStagedText, startupNoInputLine, startupOwnCollapsedPaste, STARTUP_UNCONFIRMED_REASON } from "./startup-submission-evidence.js";
30
+ import { abandonOpenHandoverAttempt, closeHandoverAttempt, openHandoverAttempt, recordFailedHandoverAttempt } from "./seat-handover-attempts.js";
31
+ import { claudeCommandForkParent, explainNativeRejection, listNativeProcesses, nativeCandidateCount, observeClaudePaneProcess, unwitnessedClaudeRow, verifyClaudePaneProcess } from "./native-process-lineage.js";
32
+ import { readClaudePidSessionId } from "./resume-metadata-refresher.js";
33
+ import { claudeConfigRootFor } from "./seat-runtime-home.js";
34
+ import nodePath from "node:path";
35
+ /** #2985 (#3044 review S6): what a guidance says once the unadopted successor is recorded, instead of "retry". */
36
+ const NO_RETRY = "do not retry the handover; it ends the running successor.";
37
+ /** #3044 delta review SD1: how long the recovery waits before a second sample confirms a not-provable foreground. */
38
+ const UNPROVABLE_CONFIRM_MS = 3_000;
39
+ /** #3044 review (:1050): the recovery's warning when the successor's current conversation could not be read. */
40
+ const UNREAD_CURRENT_CONVERSATION = "The conversation the successor's process holds now couldn't be read (Claude's session file for it is missing, older than the process, or of another session), so the one its launch named is recorded as the seat's resume target; a /clear before the recovery would make it stale.";
41
+ /** #2985: the commit of a recovery found that another occupant took the seat since its checks (rolled back). */
42
+ class RecoveryAttemptSuperseded extends Error {
43
+ }
44
+ /** #2861 item 2: finalization refusals after the successor is ready that can change (an owner or a session going away, a
45
+ * transient tmux probe or commit failure), so the attempt is recorded for `--recover`; the others would refuse it again.
46
+ * Not successor_tmux_absent: the seat's session is gone, so there is no successor left to adopt. */
47
+ const RECOVERABLE_FINALIZE_CODES = new Set(["discovered_not_active", "successor_already_managed", "address_conflict",
48
+ "tmux_probe_failed", "handover_commit_failed"]);
30
49
  export class SeatHandoverService {
31
50
  codexPermissions;
32
51
  db;
@@ -50,6 +69,9 @@ export class SeatHandoverService {
50
69
  appliedLaunchObservations;
51
70
  now;
52
71
  pluginsDir;
72
+ listProcesses;
73
+ /** The process lister a caller injected (tests), which then wins over a per-launch listing. */
74
+ injectedListProcesses;
53
75
  constructor(deps) {
54
76
  if (deps.db !== deps.rigRepo.db)
55
77
  throw new Error("SeatHandoverService: rigRepo must share the same db handle");
@@ -75,6 +97,8 @@ export class SeatHandoverService {
75
97
  this.sleep = deps.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
76
98
  this.appliedLaunchObservations = new AppliedLaunchObservationStore(deps.db);
77
99
  this.now = deps.now ?? (() => new Date());
100
+ this.listProcesses = deps.listProcesses ?? (() => listNativeProcesses());
101
+ this.injectedListProcesses = deps.listProcesses;
78
102
  this.pluginsDir = deps.pluginsDir;
79
103
  this.statusService = new SeatStatusService({ rigRepo: deps.rigRepo });
80
104
  this.planner = new SeatHandoverPlanner({ rigRepo: deps.rigRepo });
@@ -291,9 +315,11 @@ export class SeatHandoverService {
291
315
  if (permissionOverride.codexPermissions) {
292
316
  // Saved envelopes retain ordinary launch additions; only an observed predecessor
293
317
  // policy uses the exact carry path. Describe policy, not an observed native delta.
294
- const directoryPolicy = permissionOverride.codexPermissions.sandbox === "workspace-write"
295
- ? "with OpenRig's usual Git metadata, seat-folder and pod-state writable roots as on a fresh launch"
296
- : "without additional writable directory grants, as on a read-only fresh launch";
318
+ const directoryPolicy = "filesystem" in permissionOverride.codexPermissions
319
+ ? "with its explicit filesystem policy and no additional writable directory grants"
320
+ : permissionOverride.codexPermissions.sandbox === "workspace-write"
321
+ ? "with OpenRig's usual Git metadata, seat-folder and pod-state writable roots as on a fresh launch"
322
+ : "without additional writable directory grants, as on a read-only fresh launch";
297
323
  permissionContinuity = { state: "selection_used", detail: `The seat's saved permission envelope was used ${directoryPolicy}. This describes launch policy, not an observed difference. The predecessor policy was not carried; native successor equivalence is unverified.`
298
324
  + (observed.state === "unverified" ? ` Predecessor permissions could not be compared: ${observed.reason}` : "") };
299
325
  }
@@ -351,6 +377,19 @@ export class SeatHandoverService {
351
377
  // #2426: a seat that loads the vendored openrig-core itself drops OpenRig's earlier copies of its skills before its
352
378
  // successor starts, as a launch does: once the predecessor has exited (never under a running occupant), before respawn.
353
379
  const coreCopyNotes = [];
380
+ // OPR.0.7.0.9: the successor's conversation start: a fresh one starts with today's prompt; a fork inherits its
381
+ // parent's recorded start (or none). Best-effort: without it, a later resume reports unknown.
382
+ const recordPrompt = (token) => {
383
+ if (!seatAdditions.additions?.appendSystemPromptFile)
384
+ return;
385
+ try {
386
+ if (forkSource)
387
+ recordForkConversationPromptForNode(this.db, node.id, token, forkSource.value);
388
+ else
389
+ recordConversationPromptForNode(this.db, node.id, token);
390
+ }
391
+ catch { /* best-effort */ }
392
+ };
354
393
  const launch = await this.successorLauncher.createSuccessor({
355
394
  // Seam B: the successor is the SAME seat continuing — persisted policy posture carries.
356
395
  // 0.5.2-07 model fidelity: carry the seat's SPEC-pinned model so the successor launch reads the
@@ -380,13 +419,26 @@ export class SeatHandoverService {
380
419
  const pane = launch.tmuxPane ?? "unknown";
381
420
  const session = latestSession.session_name;
382
421
  const quoted = shellQuote(session);
422
+ const failedToken = this.successorLaunchToken(forkSource, launch.resumeToken, launch.resumeType, latestSession.id);
423
+ const recorded = launch.tmuxPane ? this.recordUnadoptedSuccessor({ node, latestSession, occupantGeneration,
424
+ predecessorGeneration, sourceRaw: parsed.source.raw, reason, operator, pane: launch.tmuxPane, launchToken: failedToken,
425
+ contextDelivery: "not_sent", departingProcess: launch.retireeExit === "forced" ? "ended-forced" : "ended-graceful",
426
+ launchAdditionNotes, startedWithoutRequired, appliedLaunch: launch.appliedLaunch ?? null, launchedExecutable: launch.launchedExecutable ?? null,
427
+ failedStep: launch.step, failureCode: launch.code }) : false;
428
+ // The conversation start a committed handover records before its commit, recorded for the successor that may run.
429
+ if (recorded && failedToken)
430
+ recordPrompt(failedToken.token);
431
+ // #3003's text, unchanged (no "retry"): with the attempt recorded it only gains the --recover line in front.
432
+ const unadoptedNote = `The handover was not committed: the seat's registry binding is unchanged and OpenRig has not registered the successor as the seat's occupant. The previous occupant was already ended, and a successor was launched in pane "${pane}" of ${session}; it may still be starting there or already working. Look at the pane before acting: rig capture ${quoted}. Another handover, or rig seat launch ${quoted} --fresh --stop --reason "<why>", ends that successor if it goes ahead. Shell-looking output alone does not confirm that the successor has stopped; check the launch and process state before another handover.`;
383
433
  return {
384
434
  ok: false,
385
435
  code: "successor_create_failed",
386
436
  message: `Handover failed at step "${launch.step}": ${launch.message}`,
387
437
  replacementStarted: true,
388
438
  ...(launch.tmuxPane ? { successorPane: launch.tmuxPane } : {}),
389
- guidance: `The handover was not committed: the seat's registry binding is unchanged and OpenRig has not registered the successor as the seat's occupant. The previous occupant was already ended, and a successor was launched in pane "${pane}" of ${session}; it may still be starting there or already working. Look at the pane before acting: rig capture ${quoted}. Another handover, or rig seat launch ${quoted} --fresh --stop --reason "<why>", ends that successor if it goes ahead. Shell-looking output alone does not confirm that the successor has stopped; check the launch and process state before another handover.`,
439
+ guidance: recorded
440
+ ? `${this.recoverLine(quoted)} ${unadoptedNote}`
441
+ : unadoptedNote,
390
442
  };
391
443
  }
392
444
  return {
@@ -396,7 +448,9 @@ export class SeatHandoverService {
396
448
  // The registry binding is unchanged (commit never ran). A resolve_pane failure leaves the live
397
449
  // retiree wholly untouched; a failure after the in-place respawn leaves the seat re-wakeable from
398
450
  // its provider session file (never destroyed). Inspect tmux/daemon logs and retry.
399
- guidance: "The seat's registry binding is unchanged. If the failure was after the in-place respawn, the seat is re-wakeable from its provider session file. Inspect tmux/daemon logs and retry.",
451
+ guidance: launch.code === "successor_preflight_failed"
452
+ ? `The predecessor is still running and its binding is unchanged. ${launch.message}`
453
+ : "The seat's registry binding is unchanged. If the failure was after the in-place respawn, the seat is re-wakeable from its provider session file. Inspect tmux/daemon logs and retry.",
400
454
  };
401
455
  }
402
456
  // 3. fresh: deliver the captured restore packet to the live successor BEFORE
@@ -436,11 +490,21 @@ export class SeatHandoverService {
436
490
  // unwind the discovery candidate (cleanup marks it vanished; it NEVER kills the preserved seat)
437
491
  // and leave the binding unchanged (no false-green). The seat is re-wakeable from its session file.
438
492
  await this.successorLauncher.cleanup(launch.tmuxSession, launch.discoveredId, launch.activityGrantId);
493
+ const failedToken = this.successorLaunchToken(forkSource, launch.resumeToken, launch.resumeType, latestSession.id);
494
+ const recorded = this.recordUnadoptedSuccessor({ node, latestSession, occupantGeneration, predecessorGeneration,
495
+ sourceRaw: parsed.source.raw, reason, operator, pane: launch.tmuxPane, launchToken: failedToken,
496
+ contextDelivery: "unconfirmed", departingProcess: launch.retireeExit === "forced" ? "ended-forced" : "ended-graceful",
497
+ launchAdditionNotes, startedWithoutRequired, appliedLaunch: launch.appliedLaunch ?? null,
498
+ launchedExecutable: launch.launchedExecutable ?? null, failedStep: "deliver-restore-packet", failureCode: "context_delivery_failed" });
499
+ if (recorded && failedToken)
500
+ recordPrompt(failedToken.token);
439
501
  return {
440
502
  ok: false,
441
503
  code: "context_delivery_failed",
442
504
  message: `Handover failed at step "deliver-restore-packet": ${delivered.message}`,
443
- guidance: "The successor candidate was unwound and the seat's binding is unchanged; the seat is re-wakeable from its provider session file. Retry after tmux delivery is healthy.",
505
+ guidance: recorded
506
+ ? `${this.recoverLine(shellQuote(latestSession.session_name))} The successor candidate was unwound and the seat's binding is unchanged. The successor is live in pane "${launch.tmuxPane}" without its restore packet; ${NO_RETRY}`
507
+ : "The successor candidate was unwound and the seat's binding is unchanged; the seat is re-wakeable from its provider session file. Retry after tmux delivery is healthy.",
444
508
  };
445
509
  }
446
510
  if (delivered.confirmation === "unconfirmed") {
@@ -455,23 +519,12 @@ export class SeatHandoverService {
455
519
  let sourceOutcome;
456
520
  // A fork's own id is never its parent's (the fork source) or the retiring occupant's; either answer
457
521
  // from the launch-time capture is treated as not captured.
458
- const launchedId = launch.resumeToken?.trim() || null;
459
- const retireeId = this.db.prepare("SELECT resume_token FROM sessions WHERE id = ?").get(latestSession.id)?.resume_token?.trim() || null;
460
- const forkOwnId = forkSource && launchedId && launchedId !== forkSource.value && launchedId !== retireeId ? launchedId : null;
461
- const launchToken = forkSource
462
- ? (forkOwnId ? { token: forkOwnId, resumeType: launch.resumeType } : null)
463
- : (launchedId ? { token: launchedId, resumeType: launch.resumeType } : null);
522
+ const launchToken = this.successorLaunchToken(forkSource, launch.resumeToken, launch.resumeType, latestSession.id);
523
+ const forkOwnId = forkSource ? launchToken?.token ?? null : null;
464
524
  // OPR.0.7.0.9: the successor's conversation start: a fresh one starts with today's prompt; a fork inherits its
465
525
  // parent's recorded start (or none).
466
- if (seatAdditions.additions?.appendSystemPromptFile && launchToken) {
467
- try {
468
- if (forkSource)
469
- recordForkConversationPromptForNode(this.db, node.id, launchToken.token, forkSource.value);
470
- else
471
- recordConversationPromptForNode(this.db, node.id, launchToken.token);
472
- }
473
- catch { /* best-effort: without it, a later resume reports unknown */ }
474
- }
526
+ if (launchToken)
527
+ recordPrompt(launchToken.token);
475
528
  if (parsed.source.mode === "fork" && forkSource) {
476
529
  // A fork whose own conversation id wasn't captured at launch commits with no resume token and
477
530
  // says so: its exact resumability isn't established until the id is recorded.
@@ -522,11 +575,18 @@ export class SeatHandoverService {
522
575
  // Same partial-state contract as the fresh packet: unwind the candidate,
523
576
  // binding unchanged, seat re-wakeable — never a false complete.
524
577
  await this.successorLauncher.cleanup(launch.tmuxSession, launch.discoveredId, launch.activityGrantId);
578
+ const recorded = this.recordUnadoptedSuccessor({ node, latestSession, occupantGeneration, predecessorGeneration,
579
+ sourceRaw: parsed.source.raw, reason, operator, pane: launch.tmuxPane, launchToken,
580
+ contextDelivery: "unconfirmed", departingProcess: launch.retireeExit === "forced" ? "ended-forced" : "ended-graceful",
581
+ launchAdditionNotes, startedWithoutRequired, appliedLaunch: launch.appliedLaunch ?? null,
582
+ launchedExecutable: launch.launchedExecutable ?? null, sourceOutcome, failedStep: "deliver-rebuild-priming", failureCode: "context_delivery_failed" });
525
583
  return {
526
584
  ok: false,
527
585
  code: "context_delivery_failed",
528
586
  message: `Handover failed at step "deliver-rebuild-priming": ${delivered.message}`,
529
- guidance: "The discovery candidate was marked vanished and the seat's binding is unchanged; the seat is re-wakeable from its provider session file. The successor may still process the priming packet. Inspect the successor's screen and resolve its state before another attempt; retry only after tmux delivery is healthy.",
587
+ guidance: recorded
588
+ ? `${this.recoverLine(shellQuote(latestSession.session_name))} The discovery candidate was marked vanished and the seat's binding is unchanged; the seat is re-wakeable from its provider session file. The successor may still process the priming packet. Inspect the successor's screen and resolve its state before another attempt; ${NO_RETRY}`
589
+ : "The discovery candidate was marked vanished and the seat's binding is unchanged; the seat is re-wakeable from its provider session file. The successor may still process the priming packet. Inspect the successor's screen and resolve its state before another attempt; retry only after tmux delivery is healthy.",
530
590
  };
531
591
  }
532
592
  if (delivered.confirmation === "unconfirmed") {
@@ -558,10 +618,328 @@ export class SeatHandoverService {
558
618
  sourceOutcome,
559
619
  launchAdditionNotes,
560
620
  startedWithoutRequired,
561
- launchWarnings: coreCopyNotes,
621
+ launchWarnings: [...coreCopyNotes, ...(launch.warnings ?? [])],
562
622
  cleanup: () => this.successorLauncher.cleanup(launch.tmuxSession, launch.discoveredId, launch.activityGrantId),
623
+ // #2861 item 2: finalization can still fail once the successor is ready in the respawned pane.
624
+ recordFailure: (failureCode) => RECOVERABLE_FINALIZE_CODES.has(failureCode) && this.recordUnadoptedSuccessor({ node,
625
+ latestSession, occupantGeneration, predecessorGeneration, sourceRaw: parsed.source.raw, reason, operator,
626
+ pane: launch.tmuxPane, launchToken,
627
+ contextDelivery: contextDelivered ? "delivered" : restorePacket?.status === "unconfirmed" ? "unconfirmed" : "not_sent",
628
+ departingProcess: launch.retireeExit === "forced" ? "ended-forced" : "ended-graceful",
629
+ launchAdditionNotes, startedWithoutRequired, appliedLaunch: launch.appliedLaunch ?? null,
630
+ launchedExecutable: launch.launchedExecutable ?? null, sourceOutcome, failedStep: "finalize", failureCode }),
631
+ });
632
+ }
633
+ /**
634
+ * #2985 / #2861: adopts the running successor of a handover that failed after its in-place respawn, and keeps its
635
+ * conversation, instead of a retry that ends it. The failed handover recorded its attempt (the generation it reserved
636
+ * for the successor, the pane, and the session id the daemon generated for the launch). Under the seat's lifecycle
637
+ * lease, this proves that the attempt still replaces the seat's current occupant and that the pane's one foreground
638
+ * Claude, in two samples, is exactly that launch; then it commits the handover with the reserved generation, so the
639
+ * successor's identity hooks are accepted from then on. It types nothing into the pane, respawns nothing and kills
640
+ * nothing: a packet the failed handover didn't deliver is not delivered here, and the result says so.
641
+ */
642
+ async recover(input) {
643
+ const reason = input.reason?.trim() ?? "";
644
+ if (!reason) {
645
+ return { ok: false, code: "missing_reason", message: "A handover recovery needs a reason.",
646
+ guidance: 'Pass --reason "<why>" with --recover.' };
647
+ }
648
+ const statusResult = this.statusService.getStatus(input.seatRef);
649
+ if (!statusResult.ok)
650
+ return statusResult;
651
+ const node = this.lookupNode(statusResult.status);
652
+ const guard = this.tmuxAdapter.deliveryGuard;
653
+ if (guard && !guard.ownsLifecycle(node.id)) {
654
+ return guard.lifecycle([node.id], () => this.recover(input));
655
+ }
656
+ const quotedSeat = shellQuote(input.seatRef);
657
+ const attempt = openHandoverAttempt(this.db, node.id);
658
+ if (!attempt) {
659
+ return { ok: false, code: "no_handover_to_recover",
660
+ message: `Seat "${input.seatRef}" has no failed handover whose successor could be adopted.`,
661
+ guidance: `Only a handover that failed after launching its successor in the seat's pane leaves one to adopt (its failure says so). Inspect the seat with: rig seat status ${quotedSeat}` };
662
+ }
663
+ const latestSession = this.lookupLatestSession(node.id);
664
+ if (!latestSession || !this.attemptStillCurrent(node.id, attempt)) {
665
+ closeHandoverAttempt(this.db, attempt.id, "abandoned", "another occupant took the seat after the failed handover");
666
+ return { ok: false, code: "handover_attempt_superseded",
667
+ message: `The failed handover of "${input.seatRef}" no longer replaces the seat's current occupant: another occupant took the seat after it.`,
668
+ guidance: `Nothing was adopted, and the attempt is closed. Inspect the seat with: rig seat status ${quotedSeat}` };
669
+ }
670
+ if (node.runtime !== "claude-code" || attempt.runtime !== node.runtime) {
671
+ return { ok: false, code: "recover_runtime_unsupported",
672
+ message: `Recovery adopts a Claude Code successor; this seat's runtime is "${node.runtime ?? "unknown"}".`,
673
+ guidance: `Nothing was changed. Look at the pane before acting: rig capture ${quotedSeat}` };
674
+ }
675
+ const proof = await this.proveAttemptSuccessor(attempt, node.cwd ?? null);
676
+ if (!proof.ok) {
677
+ return { ok: false, code: "successor_identity_unproven", message: proof.message,
678
+ guidance: "unprovable" in proof && proof.unprovable
679
+ ? `Nothing was changed. The successor runs in the pane (rig capture ${quotedSeat}), but --recover can't prove it: two samples a few seconds apart found the same foreground with no Claude it recognizes. If the pane shows Claude has not started yet (a wrapper still waiting), run --recover again once it has; if Claude already runs there, running it again will not change that: the seat stays bound to its previous occupant, which the failed handover already ended. Another handover, or rig seat launch ${quotedSeat} --fresh --stop --reason "<why>", ends the running successor.`
680
+ : `Nothing was changed. Look at the pane: rig capture ${quotedSeat}. If the successor is still starting, run the recovery again in a moment; another handover ends whatever runs there.` };
681
+ }
682
+ // Proven: the pane's process is the attempt's launch. It is committed through the same path as any handover, with
683
+ // the generation the failed handover reserved for it (and passed in its env).
684
+ const parsed = parseHandoverSource(attempt.sourceRaw);
685
+ // #3044 2nd review: the conversation the proven successor holds now is the resume target, whosever it also is.
686
+ const held = proof.currentToken
687
+ ? this.recoveredConversation(proof.currentToken, parsed.ok ? parsed.source : null, attempt, node.runtime, proof.launchForkParent ?? null) : null;
688
+ const reportedSource = parsed.ok ? parsed.source : { mode: "fresh", ref: null, raw: attempt.sourceRaw, defaulted: false };
689
+ // The note is said once: in a fork's outcome (its limit), else as a warning. An unread current conversation is said
690
+ // too (#3044 review :1050): the launch's is recorded, not confirmed.
691
+ const warnings = [...(proof.currentUnread ? [UNREAD_CURRENT_CONVERSATION] : []), ...(held?.note && !held.forkRef ? [held.note] : [])];
692
+ // The pane's discovery row, as the launch would have left it; a row this revives goes back to vanished on a refusal.
693
+ const priorDiscovery = this.discoveryRepo.getByTmuxIdentity(attempt.canonicalSession, attempt.pane);
694
+ const discovered = this.discoveryRepo.upsertDiscoveredSession({
695
+ tmuxSession: attempt.canonicalSession,
696
+ tmuxPane: attempt.pane,
697
+ runtimeHint: (node.runtime ?? "unknown"),
698
+ confidence: "high",
699
+ cwd: node.cwd ?? undefined,
700
+ });
701
+ const revived = !priorDiscovery || priorDiscovery.status === "vanished";
702
+ // The outcome the failed handover recorded (a rebuild's primed set, as executed then), else a fork's, rebuilt.
703
+ const launchOutcome = attempt.sourceOutcome ?? (reportedSource.mode === "fork"
704
+ ? { mode: "fork", forkedFrom: reportedSource.ref ?? attempt.canonicalSession, forkId: "captured" } : undefined);
705
+ // A fork successor on a conversation that is not its own fork (its parent's, or the retiring occupant's) reports no
706
+ // distinct fork; one whose parent can't be resolved again keeps its launch's outcome, with the limit said.
707
+ const sourceOutcome = held?.forkRef && held.shared
708
+ ? { mode: "fork", forkedFrom: held.forkRef, forkId: "none", limit: held.note }
709
+ : held?.forkRef && held.note && launchOutcome?.mode === "fork" ? { ...launchOutcome, limit: held.note } : launchOutcome;
710
+ return this.finalizeWithDiscovered({
711
+ seatRef: input.seatRef,
712
+ status: statusResult.status,
713
+ node,
714
+ latestSession: latestSession,
715
+ discoveredRef: discovered.id,
716
+ reportedSource,
717
+ reason,
718
+ operator: input.operator?.trim() || null,
719
+ contextDelivered: attempt.contextDelivery === "delivered",
720
+ ...(attempt.contextDelivery === "unconfirmed"
721
+ ? { restorePacket: { status: "unconfirmed", reason: "the failed handover sent the context packet but couldn't confirm it landed" } } : {}),
722
+ departingProcess: attempt.departingProcess,
723
+ // #3044 review S2: the conversation the proven process holds now (a /clear rotates it; its SessionStart was held
724
+ // back), else the one its launch named.
725
+ launchToken: held
726
+ ? { token: held.token, resumeType: "claude_id" }
727
+ : { token: attempt.resumeToken, ...(attempt.resumeType ? { resumeType: attempt.resumeType } : {}) },
728
+ ...(warnings.length ? { launchWarnings: warnings } : {}),
729
+ occupantGeneration: attempt.successorGeneration,
730
+ appliedLaunch: attempt.appliedLaunch,
731
+ sourceOutcome,
732
+ launchAdditionNotes: attempt.launchAdditionNotes,
733
+ startedWithoutRequired: attempt.startedWithoutRequired,
734
+ cleanup: revived ? async () => { this.discoveryRepo.markVanished([discovered.id]); } : null,
735
+ // A successor on an existing conversation (the retiring occupant's or its fork parent's) resumed it: neither a
736
+ // fresh, a rebuilt nor a distinct forked one.
737
+ recovered: { attempt, ...(held?.shared ? { continuity: "resumed" } : {}) },
563
738
  });
564
739
  }
740
+ /** #2985: the attempt still replaces the seat's current occupant: no launch or handover took the seat since (an
741
+ * occupant followed only by no-launch adoptions, such as a reconcile of the same process, is still current, as the
742
+ * identity hooks read it), and the successor's reserved generation is unregistered. */
743
+ attemptStillCurrent(nodeId, attempt) {
744
+ if (this.sessionRegistry.isOccupantGenerationRegistered(nodeId, attempt.successorGeneration))
745
+ return false;
746
+ const current = this.sessionRegistry.currentOccupantTenure(nodeId)?.generationUuid ?? null;
747
+ const latest = this.lookupLatestSession(nodeId);
748
+ if (!latest)
749
+ return false;
750
+ if (current === attempt.predecessorGeneration)
751
+ return latest.id === attempt.predecessorSessionId;
752
+ return attempt.predecessorGeneration !== null
753
+ && this.sessionRegistry.isOccupantContinuedByAdoption(nodeId, attempt.predecessorGeneration)
754
+ && latest.session_name === attempt.canonicalSession;
755
+ }
756
+ /** #2985: the pane's one foreground Claude is the attempt's launch: it names exactly the session id the daemon
757
+ * generated for it, the same process in two samples, in the seat session's only pane, with an unchanged PID (as
758
+ * `rig seat clear-attention` proves a resumed occupant). The expected id comes from the attempt, never from the
759
+ * process. Reads only. */
760
+ async proveAttemptSuccessor(attempt, cwd) {
761
+ const first = await this.proveAttemptSuccessorOnce(attempt, cwd);
762
+ if (first.ok || !first.unprovable)
763
+ return first;
764
+ // #3044 delta review SD1: a #! wrapper in its start window (only the wrapper with the token, before its exec or its
765
+ // Claude child) looks the same as one that never starts a Claude the proof knows. Not provable is said only when a
766
+ // second sample, a few seconds later, finds the same foreground; one that changed is still starting.
767
+ await this.sleep(UNPROVABLE_CONFIRM_MS);
768
+ const second = await this.proveAttemptSuccessorOnce(attempt, cwd);
769
+ if (second.ok || !second.unprovable)
770
+ return second;
771
+ if (second.foreground !== first.foreground) {
772
+ return { ok: false, message: `Pane "${attempt.pane}" of ${attempt.canonicalSession} is not proven to run the failed handover's successor: its foreground changed between two samples (a launch still starting).` };
773
+ }
774
+ return { ok: false, unprovable: true, message: second.message };
775
+ }
776
+ /** One sample of proveAttemptSuccessor; a not-provable answer carries the foreground it saw (pid and command of each
777
+ * process of the pane's foreground group), so two samples can be compared. */
778
+ async proveAttemptSuccessorOnce(attempt, cwd) {
779
+ const token = attempt.resumeToken?.trim();
780
+ if (!token)
781
+ return { ok: false, message: "The failed handover did not capture its successor's session id, so the pane's process can't be proven to be that successor." };
782
+ const onlyPane = async () => {
783
+ // Every window of the session (tmux list-panes -s): a pane in another window is a second pane too.
784
+ const panes = await this.tmuxAdapter.listPanes(attempt.canonicalSession, true);
785
+ return panes.length === 1 && panes[0]?.id === attempt.pane;
786
+ };
787
+ // #3044 review S1: proven as the adapter's readiness proves the launch (claude-code-adapter assessManagedProbe): with
788
+ // its frozen executable and, for a #! wrapper that starts Claude without exec (#2341), as the script's child.
789
+ const selectedExecutable = attempt.executable ?? undefined;
790
+ const scriptLaunch = attempt.executableIsScript;
791
+ const list = this.injectedListProcesses
792
+ ?? (() => listNativeProcesses({ claudeLaunchPaths: scriptLaunch, frozenExecutable: selectedExecutable }));
793
+ const proofInput = { target: attempt.pane, tmux: this.tmuxAdapter, listProcesses: list, expectedToken: token, selectedExecutable, scriptLaunch };
794
+ try {
795
+ if (!await onlyPane()) {
796
+ return { ok: false, message: `Pane "${attempt.pane}" is no longer the only pane of ${attempt.canonicalSession}, where the failed handover launched its successor.` };
797
+ }
798
+ const native = await verifyClaudePaneProcess(proofInput);
799
+ if (!native) {
800
+ const panePid = await this.tmuxAdapter.getPanePid(attempt.pane);
801
+ const rows = panePid ? await list() : [];
802
+ const why = panePid ? explainNativeRejection(rows, panePid, "claude-code", token, false, null, selectedExecutable, scriptLaunch) : null;
803
+ // #3044 delta review SR1: a classic launch (no permission mode: the floor posture) records no executable, so a
804
+ // Claude that a #! wrapper starts without exec, or a renamed binary, is never proven here. When the pane's
805
+ // foreground runs the launch's conversation and none of it is a Claude the proof accepts, that is this case:
806
+ // running the recovery again never changes it. Two recognized Claudes are not this case: one may exit. Nor is a
807
+ // native Claude whose executable witness this sample missed (the macOS path read timed out): a later one may read it.
808
+ const root = rows.find(row => row.pid === panePid);
809
+ if (why?.kind === "no_single_process" && !selectedExecutable && root?.tpgid && root.tpgid > 0
810
+ && nativeCandidateCount(rows, panePid, "claude-code", selectedExecutable, scriptLaunch) === 0
811
+ && !rows.some(row => row.pid !== panePid && row.pgid === root.tpgid && unwitnessedClaudeRow(row))
812
+ && rows.some(row => row.pid !== panePid && row.pgid === root.tpgid && row.command.includes(token))) {
813
+ const foreground = rows.filter(row => row.pgid === root.tpgid).map(row => `${row.pid} ${row.command}`).sort().join("\n");
814
+ return { ok: false, unprovable: true, foreground, message: `Pane "${attempt.pane}" of ${attempt.canonicalSession} runs the failed handover's conversation, but not as a process the recovery can prove: the launch recorded no executable (a classic launch), so a Claude started by a #! wrapper without exec, or under another name, is not recognized.` };
815
+ }
816
+ const detail = why?.kind === "other_conversation" ? "its Claude runs another conversation, not the one the failed handover launched"
817
+ : why?.kind === "names_no_conversation" ? "its Claude names no conversation"
818
+ : why?.kind === "no_single_process" ? "it does not hold exactly one Claude in the foreground (none yet, or more than one)"
819
+ : "its process could not be proven the same in two samples";
820
+ return { ok: false, message: `Pane "${attempt.pane}" of ${attempt.canonicalSession} is not proven to run the failed handover's successor: ${detail}.` };
821
+ }
822
+ if (!await onlyPane() || await this.tmuxAdapter.getPanePid(attempt.pane) !== native.panePid) {
823
+ return { ok: false, message: `Pane "${attempt.pane}" of ${attempt.canonicalSession} changed while its successor was being proven.` };
824
+ }
825
+ // #3044 review S2: the argv names the launch's conversation, not the current one: a /clear before the recovery
826
+ // rotates it, and its SessionStart was answered generation_uncommitted. Claude's own sessions/<pid>.json of the
827
+ // proven process says the current one (read only, as the resume refresher reads it), bracketed by a third equal
828
+ // observation of the same process.
829
+ const configDir = nodePath.resolve(cwd ?? process.cwd(), claudeConfigRootFor(this.db, attempt.nodeId));
830
+ const current = readClaudePidSessionId({ configDir, pid: native.process.pid, startedAt: native.process.startedAt, sessionName: attempt.canonicalSession });
831
+ // #3044 review (:1050): a file that confirms the launch's conversation changes nothing; one that can't be read (missing,
832
+ // older than the process, of another session, or a Claude that writes none) leaves the launch's conversation as the
833
+ // record, said as unconfirmed, never a refusal.
834
+ if (!current)
835
+ return { ok: true, currentUnread: true };
836
+ if (current === token)
837
+ return { ok: true };
838
+ const again = await observeClaudePaneProcess(proofInput);
839
+ if (again?.fingerprint !== native.fingerprint) {
840
+ return { ok: false, message: `Pane "${attempt.pane}" of ${attempt.canonicalSession} changed while its successor's current conversation was being read.` };
841
+ }
842
+ // #3044 2nd review (B2): the conversation a fork launch forked from, as the proven process's own argv names it
843
+ // (`--resume <parent> --fork-session`): the same value the launch used, whatever the seat's rows say now.
844
+ const forked = claudeCommandForkParent(native.process.command ?? "");
845
+ return { ok: true, currentToken: current, ...(forked ? { launchForkParent: forked } : {}) };
846
+ }
847
+ catch (err) {
848
+ return { ok: false, message: `Could not inspect pane "${attempt.pane}": ${err instanceof Error ? err.message : String(err)}` };
849
+ }
850
+ }
851
+ /** #3044 2nd review: the conversation the proven successor holds now (read from its own session file) is what it
852
+ * resumes, so it is recorded even when it is not its own: the retiring occupant's, or its fork parent's. The result
853
+ * says so, and a fork on such a conversation is not reported as a distinct fork. Nothing of the parent or of the
854
+ * retiring occupant changes: the token is written to the successor's own session row only.
855
+ * The parent of a fork of another seat is that seat's conversation now (resolved again), and the one it was on when
856
+ * the fork was launched (launchForkParent: the proven process's argv). A fork of the seat itself has the retiring
857
+ * occupant as its parent: a successor on the conversation its launch forked from (launchForkParent) or on the
858
+ * retiree's recorded one is no distinct fork; the seat's live context row, which by now may name the successor's own,
859
+ * is never read. A parent that can't be established is said, never taken as distinct. */
860
+ recoveredConversation(current, source, attempt, runtime, launchForkParent) {
861
+ const retiree = this.db.prepare("SELECT resume_token FROM sessions WHERE id = ?").get(attempt.predecessorSessionId)?.resume_token?.trim() || null;
862
+ const forkRef = source?.mode === "fork" ? source.ref ?? attempt.canonicalSession : null;
863
+ const target = "That conversation is recorded as the seat's resume target: the one the process is on now, not the one its launch named.";
864
+ const ofRetiree = current === retiree;
865
+ if (!forkRef) {
866
+ return ofRetiree ? { token: current, shared: "retiring_occupant", note: `The successor holds the retiring occupant's conversation. ${target}` } : { token: current };
867
+ }
868
+ // The ref as the fork resolved it (a derived seat address included, as discoverResumeToken reads it).
869
+ const forkSession = savedSessionName(this.db, forkRef);
870
+ const selfFork = forkSession === attempt.canonicalSession || this.db.prepare("SELECT node_id FROM sessions WHERE session_name = ? ORDER BY id DESC LIMIT 1").get(forkSession)?.node_id === attempt.nodeId;
871
+ // The parent the launch forked from, as the proven process's argv names it: never guessed from a seat's rows, which
872
+ // need not hold what the launch used (it reads the seat's context row first).
873
+ const notChecked = `The successor's conversation is recorded as the seat's resume target, but the conversation its fork of ${forkRef} started from could not be read from its process, so it was not checked that this conversation is distinct from the parent's.`;
874
+ if (selfFork) {
875
+ // Its parent is the retiring occupant: the conversation the launch forked from, or the one recorded for it.
876
+ if (current === launchForkParent || ofRetiree) {
877
+ const which = current === launchForkParent ? `the one its fork of ${forkRef} started from` : "the one recorded for it";
878
+ return { token: current, shared: "retiring_occupant", forkRef, note: `No distinct fork was recovered: the successor holds the retiring occupant's conversation, ${which}. ${target}` };
879
+ }
880
+ return launchForkParent ? { token: current } : { token: current, forkRef, note: notChecked };
881
+ }
882
+ const fork = this.resolveForkSource(forkRef, runtime);
883
+ if (fork.ok && fork.nativeId === current) {
884
+ return { token: current, shared: "fork_parent", forkRef, note: `No distinct fork was recovered: the successor holds the conversation of its fork parent ${forkRef}${ofRetiree ? ", which is also the retiring occupant's" : ""}. ${target} ${forkRef} keeps its own binding and its process, so both seats now name the same conversation: a restore of either resumes it, and restoring both opens it twice.` };
885
+ }
886
+ if (current === launchForkParent) {
887
+ return { token: current, shared: "fork_parent", forkRef, note: fork.ok
888
+ ? `No distinct fork was recovered: the successor holds the conversation its fork parent ${forkRef} was on when the fork was launched (${forkRef} has moved on since). ${target}`
889
+ : `No distinct fork was recovered: the successor holds the conversation its fork parent ${forkRef} was on when the fork was launched; ${forkRef} could not be resolved again, so whether it is still on it was not checked. ${target}` };
890
+ }
891
+ if (ofRetiree) {
892
+ return { token: current, shared: "retiring_occupant", forkRef, note: fork.ok
893
+ ? `No distinct fork was recovered: the successor holds the retiring occupant's conversation, not its fork parent ${forkRef}'s. ${target}`
894
+ : `No distinct fork was recovered: the successor holds the retiring occupant's conversation; its fork parent ${forkRef} could not be resolved again, so whether ${forkRef} is on it too was not checked. ${target}` };
895
+ }
896
+ if (!fork.ok) {
897
+ return { token: current, forkRef, note: `The successor's conversation is recorded as the seat's resume target, but its fork parent ${forkRef} could not be resolved again, so it was not checked that this conversation is distinct from the parent's.` };
898
+ }
899
+ return launchForkParent ? { token: current } : { token: current, forkRef, note: notChecked };
900
+ }
901
+ /** The successor's own resume token from its launch: a fork's is never its parent's (the fork source) nor the retiring
902
+ * occupant's; either answer from the launch-time capture is treated as not captured. */
903
+ successorLaunchToken(forkSource, resumeToken, resumeType, retireeSessionId) {
904
+ const launchedId = resumeToken?.trim() || null;
905
+ if (!launchedId)
906
+ return null;
907
+ if (forkSource) {
908
+ const retireeId = this.db.prepare("SELECT resume_token FROM sessions WHERE id = ?").get(retireeSessionId)?.resume_token?.trim() || null;
909
+ if (launchedId === forkSource.value || launchedId === retireeId)
910
+ return null;
911
+ }
912
+ return { token: launchedId, resumeType };
913
+ }
914
+ /** #2985 / #2861: records a handover that failed with its successor launched in the respawned pane, so `--recover`
915
+ * can adopt it. Best-effort: a failed write never hides the handover's own failure. */
916
+ recordUnadoptedSuccessor(input) {
917
+ // Only what `--recover` can adopt is recorded (and offered): a Claude successor whose launch named its session id.
918
+ if (!input.occupantGeneration || input.node.runtime !== "claude-code" || !input.launchToken?.token)
919
+ return false;
920
+ try {
921
+ recordFailedHandoverAttempt(this.db, {
922
+ nodeId: input.node.id, canonicalSession: input.latestSession.session_name, pane: input.pane, runtime: input.node.runtime,
923
+ successorGeneration: input.occupantGeneration, predecessorGeneration: input.predecessorGeneration ?? null,
924
+ predecessorSessionId: input.latestSession.id, sourceRaw: input.sourceRaw, reason: input.reason, operator: input.operator,
925
+ resumeType: input.launchToken.resumeType ?? null, resumeToken: input.launchToken.token,
926
+ contextDelivery: input.contextDelivery, departingProcess: input.departingProcess,
927
+ launchAdditionNotes: input.launchAdditionNotes, startedWithoutRequired: input.startedWithoutRequired,
928
+ appliedLaunch: input.appliedLaunch, sourceOutcome: input.sourceOutcome ?? null, executable: input.launchedExecutable?.path ?? null,
929
+ executableIsScript: input.launchedExecutable?.isScript === true, failedStep: input.failedStep, failureCode: input.failureCode,
930
+ });
931
+ return true;
932
+ }
933
+ catch {
934
+ return false;
935
+ }
936
+ }
937
+ recoveredFrom(attempt) {
938
+ return { attemptId: attempt.id, failedStep: attempt.failedStep, failureCode: attempt.failureCode, failedAt: attempt.createdAt };
939
+ }
940
+ recoverLine(quotedSeat) {
941
+ return `If the successor is running there, adopt it and keep its conversation, typing nothing into the pane: rig seat handover ${quotedSeat} --recover --reason "<why>".`;
942
+ }
565
943
  /** #2456: the seat's send_text startup files a fresh start delivers, role first; none when the saved context can't be read. */
566
944
  startupTextFiles(nodeId) {
567
945
  try {
@@ -604,6 +982,11 @@ export class SeatHandoverService {
604
982
  const fail = async (result) => {
605
983
  if (input.cleanup)
606
984
  await input.cleanup();
985
+ if (!result.ok && input.recordFailure?.(result.code) && "guidance" in result) {
986
+ // #3044 review S6: the refusal's own guidance (retry, or discovered-source advice) would end the running
987
+ // successor; the message already says what refused, so the recovery leads.
988
+ return { ...result, guidance: `${this.recoverLine(shellQuote(input.latestSession.session_name))} Run it once what refused it is resolved. The successor is ready in the seat's pane but not adopted; ${NO_RETRY}` };
989
+ }
607
990
  return result;
608
991
  };
609
992
  const discovered = this.discoveryRepo.getDiscoveredSession(input.discoveredRef);
@@ -706,6 +1089,7 @@ export class SeatHandoverService {
706
1089
  sourceOutcome: input.sourceOutcome,
707
1090
  launchAdditionNotes: input.launchAdditionNotes,
708
1091
  startedWithoutRequired: input.startedWithoutRequired,
1092
+ recovered: input.recovered,
709
1093
  });
710
1094
  if (!committed.ok)
711
1095
  return fail(committed);
@@ -723,6 +1107,7 @@ export class SeatHandoverService {
723
1107
  sessionId: committed.result.newSessionId,
724
1108
  sessionName: discovered.tmuxSession,
725
1109
  runtime: input.node.runtime,
1110
+ cwd: input.node.cwd,
726
1111
  });
727
1112
  }
728
1113
  // Held messages are never replayed, so every source's result names them, as a started seat is told (#2431). The
@@ -732,7 +1117,8 @@ export class SeatHandoverService {
732
1117
  const held = heldMessagesNotice(this.db, input.node.id, discovered.tmuxSession);
733
1118
  if (held && "result" in committed) {
734
1119
  committed.result.warnings = [held];
735
- const typed = input.reportedSource.mode !== "discovered" && input.restorePacket?.status !== "unconfirmed";
1120
+ // #2985: a recovery types nothing into the successor it adopts.
1121
+ const typed = input.reportedSource.mode !== "discovered" && input.restorePacket?.status !== "unconfirmed" && !input.recovered;
736
1122
  try {
737
1123
  if (typed && (await this.tmuxAdapter.sendText(discovered.tmuxSession, held)).ok) {
738
1124
  await this.sleep(200);
@@ -755,7 +1141,8 @@ export class SeatHandoverService {
755
1141
  */
756
1142
  async captureDiscoveredResumeToken(input) {
757
1143
  try {
758
- const derived = await deriveResumeToken({ runtime: input.runtime, sessionName: input.sessionName, nodeId: input.nodeId }, this.captureDeps);
1144
+ // The seat's own directory, as adoption passes it: a relative Claude config dir resolves there, not in the daemon's.
1145
+ const derived = await deriveResumeToken({ runtime: input.runtime, sessionName: input.sessionName, nodeId: input.nodeId, cwd: input.cwd ?? undefined }, this.captureDeps);
759
1146
  if (derived.outcome === "exempt" || derived.outcome === "noop")
760
1147
  return;
761
1148
  const runtime = input.runtime; // non-null past exempt
@@ -1036,6 +1423,13 @@ export class SeatHandoverService {
1036
1423
  return null;
1037
1424
  }
1038
1425
  }
1426
+ // #2985: the recovery's checks ran before its proof's awaits; a writer outside the lease could have taken the seat
1427
+ // since. Checked again where it commits, after every refusal above (a refusal returns, and the transaction keeps
1428
+ // what it wrote), and the attempt must still be open.
1429
+ if (input.recovered && (!this.attemptStillCurrent(input.node.id, input.recovered.attempt)
1430
+ || !closeHandoverAttempt(this.db, input.recovered.attempt.id, "adopted", `adopted by a recovery: ${input.reason}`))) {
1431
+ throw new RecoveryAttemptSuperseded();
1432
+ }
1039
1433
  const rows = this.db.prepare("SELECT id FROM sessions WHERE node_id = ? AND status NOT IN ('superseded', 'detached', 'exited') ORDER BY id").all(input.node.id);
1040
1434
  const previousSessionIdsSuperseded = rows.map((row) => row.id);
1041
1435
  if (previousSessionIdsSuperseded.length > 0) {
@@ -1056,6 +1450,11 @@ export class SeatHandoverService {
1056
1450
  const retiringGeneration = tenureBefore?.generationUuid ?? undefined;
1057
1451
  // atom-B: a seat handover mints a HANDOVER-kind occupant generation (not the default 'adopt').
1058
1452
  const newSession = this.sessionRegistry.registerClaimedSession(input.node.id, input.discovered.tmuxSession, "handover", input.occupantGeneration);
1453
+ // #2985: adoption exists to register the generation the successor runs on (its hooks are held back until then).
1454
+ // Minting it is best-effort elsewhere; here it is the point, so without it nothing is adopted (rollback).
1455
+ if (input.recovered && this.sessionRegistry.currentOccupantTenure(input.node.id)?.generationUuid !== input.occupantGeneration) {
1456
+ throw new Error("the successor's reserved occupant generation could not be registered; nothing was adopted");
1457
+ }
1059
1458
  // Keep the handover tenure/ready registration; only discovered successors are adopted.
1060
1459
  if (input.reportedSource.mode !== "discovered") {
1061
1460
  this.db.prepare("UPDATE sessions SET origin = 'launched' WHERE id = ?").run(newSession.id);
@@ -1093,10 +1492,11 @@ export class SeatHandoverService {
1093
1492
  // OPR.0.5.5.5 — the executed source records its own continuity vocabulary
1094
1493
  // (the startup-orchestrator set): fresh->fresh, fork->forked,
1095
1494
  // rebuild->rebuilt; discovered stays null (continuity unknown to us).
1096
- const continuityOutcome = input.reportedSource.mode === "fresh" ? "fresh"
1495
+ // #2985: an adopted rebuild successor whose priming packet never reached it is a fresh conversation.
1496
+ const continuityOutcome = input.recovered?.continuity ?? (input.reportedSource.mode === "fresh" ? "fresh"
1097
1497
  : input.reportedSource.mode === "fork" ? "forked"
1098
- : input.reportedSource.mode === "rebuild" ? "rebuilt"
1099
- : null;
1498
+ : input.reportedSource.mode === "rebuild" ? (input.recovered?.attempt.contextDelivery === "not_sent" ? "fresh" : "rebuilt")
1499
+ : null);
1100
1500
  this.db.prepare(`
1101
1501
  UPDATE nodes SET
1102
1502
  occupant_lifecycle = 'active',
@@ -1113,10 +1513,13 @@ export class SeatHandoverService {
1113
1513
  // cutover the successor reuses the seat name, so retiring === successor here — Class-A is safe by
1114
1514
  // TIMING (runs before the successor writes) and Class-B is gen-scoped via retiringGeneration (the
1115
1515
  // retiree's generation, captured above pre-mint). Optional dep: absent → skipped, never blocks.
1516
+ // #3044 C3: a recovery's successor has already run, so the timing doesn't cover its sidecar; the successor's
1517
+ // generation keeps a sidecar it wrote itself, best effort (the collector writes from another process).
1116
1518
  this.occupantInvalidator?.invalidateRetiringOccupant({
1117
1519
  retiringSessionName: input.latestSession.session_name,
1118
1520
  successorSessionName: input.discovered.tmuxSession,
1119
1521
  retiringGeneration,
1522
+ ...(input.occupantGeneration ? { successorGeneration: input.occupantGeneration } : {}),
1120
1523
  });
1121
1524
  const event = this.eventBus.persistWithinTransaction({
1122
1525
  type: "seat.handover_completed",
@@ -1133,7 +1536,11 @@ export class SeatHandoverService {
1133
1536
  ...(input.launchAdditionNotes?.length ? { launchAdditionNotes: input.launchAdditionNotes } : {}),
1134
1537
  // #2456: the seat list reads this while the successor's session is the seat's current one.
1135
1538
  ...(input.startedWithoutRequired?.length ? { startedWithoutRequired: input.startedWithoutRequired, successorSessionId: newSession.id } : {}),
1539
+ ...(input.recovered ? { recoveredFrom: this.recoveredFrom(input.recovered.attempt) } : {}),
1136
1540
  });
1541
+ // A later handover took the seat: a successor an earlier failed one left is no longer adoptable.
1542
+ if (!input.recovered)
1543
+ abandonOpenHandoverAttempt(this.db, input.node.id, "a later handover took the seat");
1137
1544
  return { newSessionId: newSession.id, previousSessionIdsSuperseded, event, provenanceRecordWritten };
1138
1545
  });
1139
1546
  let committed;
@@ -1150,6 +1557,12 @@ export class SeatHandoverService {
1150
1557
  committed = outcome;
1151
1558
  }
1152
1559
  catch (err) {
1560
+ if (err instanceof RecoveryAttemptSuperseded && input.recovered) {
1561
+ closeHandoverAttempt(this.db, input.recovered.attempt.id, "abandoned", "another occupant took the seat during the recovery");
1562
+ return { ok: false, code: "handover_attempt_superseded",
1563
+ message: "Another occupant took the seat while the recovery was proving the successor; nothing was adopted.",
1564
+ guidance: `Inspect the seat with: rig seat status ${shellQuote(input.seatRef)}` };
1565
+ }
1153
1566
  return {
1154
1567
  ok: false,
1155
1568
  code: "handover_commit_failed",
@@ -1225,6 +1638,7 @@ export class SeatHandoverService {
1225
1638
  ...(input.sourceOutcome ? { sourceOutcome: input.sourceOutcome } : {}),
1226
1639
  ...(input.launchAdditionNotes?.length ? { launchAdditionNotes: input.launchAdditionNotes } : {}),
1227
1640
  ...(input.startedWithoutRequired?.length ? { startedWithoutRequired: input.startedWithoutRequired } : {}),
1641
+ ...(input.recovered ? { recoveredFrom: this.recoveredFrom(input.recovered.attempt) } : {}),
1228
1642
  ...(input.restorePacket ? { restorePacket: input.restorePacket } : {}),
1229
1643
  sideEffects: {
1230
1644
  departingSessionKilled: false,