@openrig/cli 0.5.2 → 0.5.4

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 (586) hide show
  1. package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +1 -1
  2. package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
  3. package/daemon/assets/plugins/openrig-core/README.md +1 -1
  4. package/daemon/assets/plugins/openrig-core/hooks/claude.json +36 -0
  5. package/daemon/assets/plugins/openrig-core/hooks/codex.json +27 -0
  6. package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus.cjs +152 -0
  7. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/SKILL.md +35 -3
  8. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/precompact-hook.mjs +8 -95
  9. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/restore-from-jsonl.mjs +63 -20
  10. package/daemon/assets/plugins/openrig-core/skills/forming-an-openrig-mental-model/SKILL.md +6 -2
  11. package/daemon/assets/plugins/openrig-core/skills/messaging-the-human/SKILL.md +28 -2
  12. package/daemon/assets/plugins/openrig-core/skills/mission-slice-sop/SKILL.md +42 -52
  13. package/daemon/assets/plugins/openrig-core/skills/openrig-skills/SKILL.md +26 -1
  14. package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +7 -2
  15. package/daemon/assets/plugins/openrig-core/skills/orienting-to-an-inherited-seat/CHANGELOG.md +64 -0
  16. package/daemon/assets/plugins/openrig-core/skills/orienting-to-an-inherited-seat/SKILL.md +235 -0
  17. package/daemon/assets/plugins/openrig-core/skills/queue-handoff/SKILL.md +31 -1
  18. package/daemon/assets/plugins/openrig-core/skills/retiring-and-inheriting-a-seat/CHANGELOG.md +48 -0
  19. package/daemon/assets/plugins/openrig-core/skills/retiring-and-inheriting-a-seat/SKILL.md +211 -0
  20. package/daemon/assets/plugins/openrig-core/skills/seat-continuity-and-handover/SKILL.md +8 -0
  21. package/daemon/assets/plugins/openrig-core/skills/software-for-agents/SKILL.md +31 -9
  22. package/daemon/context-packs/skills/core/agent-starters/SKILL.md +132 -0
  23. package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +9 -0
  24. package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/SKILL.md +112 -0
  25. package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +9 -0
  26. package/daemon/context-packs/skills/core/attention-queue/SKILL.md +264 -0
  27. package/daemon/context-packs/skills/core/attention-queue/manifest.yaml +9 -0
  28. package/daemon/context-packs/skills/core/cross-host-rig-commands/SKILL.md +195 -0
  29. package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +9 -0
  30. package/daemon/context-packs/skills/core/human-in-the-loop/SKILL.md +104 -0
  31. package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +9 -0
  32. package/daemon/context-packs/skills/core/openrig-architect/SKILL.md +378 -0
  33. package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +9 -0
  34. package/daemon/context-packs/skills/core/openrig-cmux/SKILL.md +81 -0
  35. package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +9 -0
  36. package/daemon/context-packs/skills/core/openrig-herdr/SKILL.md +153 -0
  37. package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +9 -0
  38. package/daemon/context-packs/skills/core/openrig-upgrade/SKILL.md +460 -0
  39. package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +9 -0
  40. package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/SKILL.md +101 -0
  41. package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +9 -0
  42. package/daemon/context-packs/skills/core/rig-lifecycle/SKILL.md +127 -0
  43. package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +9 -0
  44. package/daemon/context-packs/skills/core/session-source-fork/SKILL.md +160 -0
  45. package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +9 -0
  46. package/daemon/context-packs/skills/core/specification-system/SKILL.md +103 -0
  47. package/daemon/context-packs/skills/core/specification-system/manifest.yaml +9 -0
  48. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/SKILL.md +118 -0
  49. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +9 -0
  50. package/daemon/context-packs/skills/core/watchdog/SKILL.md +126 -0
  51. package/daemon/context-packs/skills/core/watchdog/manifest.yaml +9 -0
  52. package/daemon/context-packs/skills/pm/backlog-capture/SKILL.md +43 -0
  53. package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +9 -0
  54. package/daemon/context-packs/skills/pm/context-builder/SKILL.md +87 -0
  55. package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +9 -0
  56. package/daemon/context-packs/skills/pm/exec-summary/SKILL.md +84 -0
  57. package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +9 -0
  58. package/daemon/context-packs/skills/pm/office-hours/SKILL.md +129 -0
  59. package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +9 -0
  60. package/daemon/context-packs/skills/pm/plan-review/SKILL.md +98 -0
  61. package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +9 -0
  62. package/daemon/context-packs/skills/pm/requirements-writer/SKILL.md +113 -0
  63. package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +9 -0
  64. package/daemon/context-packs/skills/pm/ui-mockup/SKILL.md +76 -0
  65. package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +9 -0
  66. package/daemon/context-packs/skills/pods/development-team/SKILL.md +156 -0
  67. package/daemon/context-packs/skills/pods/development-team/manifest.yaml +9 -0
  68. package/daemon/context-packs/skills/pods/orchestration-team/SKILL.md +307 -0
  69. package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +9 -0
  70. package/daemon/context-packs/skills/pods/oversight-team/SKILL.md +106 -0
  71. package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +9 -0
  72. package/daemon/context-packs/skills/pods/review-team/SKILL.md +213 -0
  73. package/daemon/context-packs/skills/pods/review-team/manifest.yaml +9 -0
  74. package/daemon/context-packs/skills/process/agent-browser/LOCAL-INSIGHTS.md +189 -0
  75. package/daemon/context-packs/skills/process/agent-browser/OPENRIG.md +40 -0
  76. package/daemon/context-packs/skills/process/agent-browser/SKILL.md +427 -0
  77. package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +13 -0
  78. package/daemon/context-packs/skills/process/brainstorming/OPENRIG.md +48 -0
  79. package/daemon/context-packs/skills/process/brainstorming/SKILL.md +107 -0
  80. package/daemon/context-packs/skills/process/brainstorming/manifest.yaml +11 -0
  81. package/daemon/context-packs/skills/process/context-engineering/SKILL.md +479 -0
  82. package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +9 -0
  83. package/daemon/context-packs/skills/process/dogfood/SKILL.md +225 -0
  84. package/daemon/context-packs/skills/process/dogfood/manifest.yaml +13 -0
  85. package/daemon/context-packs/skills/process/dogfood/references/issue-taxonomy.md +109 -0
  86. package/daemon/context-packs/skills/process/dogfood/templates/dogfood-report-template.md +53 -0
  87. package/daemon/context-packs/skills/process/executing-plans/OPENRIG.md +56 -0
  88. package/daemon/context-packs/skills/process/executing-plans/SKILL.md +94 -0
  89. package/daemon/context-packs/skills/process/executing-plans/manifest.yaml +11 -0
  90. package/daemon/context-packs/skills/process/frontend-design/LICENSE.txt +177 -0
  91. package/daemon/context-packs/skills/process/frontend-design/SKILL.md +50 -0
  92. package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +11 -0
  93. package/daemon/context-packs/skills/process/systematic-debugging/SKILL.md +301 -0
  94. package/daemon/context-packs/skills/process/systematic-debugging/condition-based-waiting-example.ts +158 -0
  95. package/daemon/context-packs/skills/process/systematic-debugging/condition-based-waiting.md +115 -0
  96. package/daemon/context-packs/skills/process/systematic-debugging/defense-in-depth.md +122 -0
  97. package/daemon/context-packs/skills/process/systematic-debugging/find-polluter.sh +63 -0
  98. package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +19 -0
  99. package/daemon/context-packs/skills/process/systematic-debugging/root-cause-tracing.md +169 -0
  100. package/daemon/context-packs/skills/process/test-driven-development/SKILL.md +385 -0
  101. package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +11 -0
  102. package/daemon/context-packs/skills/process/test-driven-development/testing-anti-patterns.md +299 -0
  103. package/daemon/context-packs/skills/process/using-superpowers/OPENRIG.md +48 -0
  104. package/daemon/context-packs/skills/process/using-superpowers/SKILL.md +106 -0
  105. package/daemon/context-packs/skills/process/using-superpowers/manifest.yaml +11 -0
  106. package/daemon/context-packs/skills/process/verification-before-completion/SKILL.md +155 -0
  107. package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +9 -0
  108. package/daemon/context-packs/skills/process/writing-plans/OPENRIG.md +52 -0
  109. package/daemon/context-packs/skills/process/writing-plans/SKILL.md +126 -0
  110. package/daemon/context-packs/skills/process/writing-plans/manifest.yaml +11 -0
  111. package/daemon/context-packs/world/install/01-world-from-primitives.md +97 -0
  112. package/daemon/context-packs/world/install/02-permission-self-sleep.md +141 -0
  113. package/daemon/context-packs/world/install/03-what-this-is-for.md +86 -0
  114. package/daemon/context-packs/world/install/04-ontology.md +790 -0
  115. package/daemon/context-packs/world/install/05-harness-power-use.md +355 -0
  116. package/daemon/context-packs/world/install/06-a-competent-turn.md +225 -0
  117. package/daemon/context-packs/world/install/manifest.yaml +125 -0
  118. package/daemon/context-packs/world/install/reference-material.md +125 -0
  119. package/daemon/context-packs/world/install/what-you-can-do.md +416 -0
  120. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  121. package/daemon/dist/adapters/claude-code-adapter.js +7 -4
  122. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  123. package/daemon/dist/adapters/claude-resume.js +2 -2
  124. package/daemon/dist/adapters/claude-resume.js.map +1 -1
  125. package/daemon/dist/adapters/tmux.d.ts +41 -2
  126. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  127. package/daemon/dist/adapters/tmux.js +58 -18
  128. package/daemon/dist/adapters/tmux.js.map +1 -1
  129. package/daemon/dist/adapters/yolo-mode.d.ts +18 -0
  130. package/daemon/dist/adapters/yolo-mode.d.ts.map +1 -1
  131. package/daemon/dist/adapters/yolo-mode.js +21 -0
  132. package/daemon/dist/adapters/yolo-mode.js.map +1 -1
  133. package/daemon/dist/build-info.js +3 -3
  134. package/daemon/dist/daemon-db-path.d.ts.map +1 -1
  135. package/daemon/dist/daemon-db-path.js +50 -2
  136. package/daemon/dist/daemon-db-path.js.map +1 -1
  137. package/daemon/dist/domain/codex-thread-id.d.ts +95 -0
  138. package/daemon/dist/domain/codex-thread-id.d.ts.map +1 -1
  139. package/daemon/dist/domain/codex-thread-id.js +171 -2
  140. package/daemon/dist/domain/codex-thread-id.js.map +1 -1
  141. package/daemon/dist/domain/context-packs/context-pack-types.d.ts +48 -0
  142. package/daemon/dist/domain/context-packs/context-pack-types.d.ts.map +1 -1
  143. package/daemon/dist/domain/context-packs/context-pack-types.js +8 -0
  144. package/daemon/dist/domain/context-packs/context-pack-types.js.map +1 -1
  145. package/daemon/dist/domain/context-packs/manifest-parser.d.ts.map +1 -1
  146. package/daemon/dist/domain/context-packs/manifest-parser.js +234 -2
  147. package/daemon/dist/domain/context-packs/manifest-parser.js.map +1 -1
  148. package/daemon/dist/domain/context-packs/probe-eval-bridge.d.ts +34 -0
  149. package/daemon/dist/domain/context-packs/probe-eval-bridge.d.ts.map +1 -0
  150. package/daemon/dist/domain/context-packs/probe-eval-bridge.js +38 -0
  151. package/daemon/dist/domain/context-packs/probe-eval-bridge.js.map +1 -0
  152. package/daemon/dist/domain/context-packs/profile-composer.d.ts +49 -0
  153. package/daemon/dist/domain/context-packs/profile-composer.d.ts.map +1 -0
  154. package/daemon/dist/domain/context-packs/profile-composer.js +125 -0
  155. package/daemon/dist/domain/context-packs/profile-composer.js.map +1 -0
  156. package/daemon/dist/domain/context-packs/profile-source-resolver.d.ts +53 -0
  157. package/daemon/dist/domain/context-packs/profile-source-resolver.d.ts.map +1 -0
  158. package/daemon/dist/domain/context-packs/profile-source-resolver.js +129 -0
  159. package/daemon/dist/domain/context-packs/profile-source-resolver.js.map +1 -0
  160. package/daemon/dist/domain/context-packs/seat-recap-store.d.ts +48 -0
  161. package/daemon/dist/domain/context-packs/seat-recap-store.d.ts.map +1 -0
  162. package/daemon/dist/domain/context-packs/seat-recap-store.js +123 -0
  163. package/daemon/dist/domain/context-packs/seat-recap-store.js.map +1 -0
  164. package/daemon/dist/domain/markdown-address.d.ts +56 -0
  165. package/daemon/dist/domain/markdown-address.d.ts.map +1 -0
  166. package/daemon/dist/domain/markdown-address.js +188 -0
  167. package/daemon/dist/domain/markdown-address.js.map +1 -0
  168. package/daemon/dist/domain/model-divergence/current-generation-record.d.ts +8 -2
  169. package/daemon/dist/domain/model-divergence/current-generation-record.d.ts.map +1 -1
  170. package/daemon/dist/domain/model-divergence/current-generation-record.js +1 -1
  171. package/daemon/dist/domain/model-divergence/current-generation-record.js.map +1 -1
  172. package/daemon/dist/domain/model-divergence/model-divergence-monitor.d.ts +33 -21
  173. package/daemon/dist/domain/model-divergence/model-divergence-monitor.d.ts.map +1 -1
  174. package/daemon/dist/domain/model-divergence/model-divergence-monitor.js +64 -55
  175. package/daemon/dist/domain/model-divergence/model-divergence-monitor.js.map +1 -1
  176. package/daemon/dist/domain/periodic-snapshot-scheduler.d.ts +4 -0
  177. package/daemon/dist/domain/periodic-snapshot-scheduler.d.ts.map +1 -1
  178. package/daemon/dist/domain/periodic-snapshot-scheduler.js +5 -1
  179. package/daemon/dist/domain/periodic-snapshot-scheduler.js.map +1 -1
  180. package/daemon/dist/domain/permission-drift-observer.d.ts.map +1 -1
  181. package/daemon/dist/domain/permission-drift-observer.js +6 -1
  182. package/daemon/dist/domain/permission-drift-observer.js.map +1 -1
  183. package/daemon/dist/domain/plugin-discovery-service.d.ts +16 -0
  184. package/daemon/dist/domain/plugin-discovery-service.d.ts.map +1 -1
  185. package/daemon/dist/domain/plugin-discovery-service.js +175 -1
  186. package/daemon/dist/domain/plugin-discovery-service.js.map +1 -1
  187. package/daemon/dist/domain/plugin-vendor-service.d.ts +9 -5
  188. package/daemon/dist/domain/plugin-vendor-service.d.ts.map +1 -1
  189. package/daemon/dist/domain/plugin-vendor-service.js +101 -12
  190. package/daemon/dist/domain/plugin-vendor-service.js.map +1 -1
  191. package/daemon/dist/domain/process-census.d.ts +25 -0
  192. package/daemon/dist/domain/process-census.d.ts.map +1 -0
  193. package/daemon/dist/domain/process-census.js +47 -0
  194. package/daemon/dist/domain/process-census.js.map +1 -0
  195. package/daemon/dist/domain/queue-repository.d.ts +3 -1
  196. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  197. package/daemon/dist/domain/queue-repository.js +50 -2
  198. package/daemon/dist/domain/queue-repository.js.map +1 -1
  199. package/daemon/dist/domain/reconciler.d.ts.map +1 -1
  200. package/daemon/dist/domain/reconciler.js +6 -1
  201. package/daemon/dist/domain/reconciler.js.map +1 -1
  202. package/daemon/dist/domain/resume-metadata-refresher.d.ts +31 -2
  203. package/daemon/dist/domain/resume-metadata-refresher.d.ts.map +1 -1
  204. package/daemon/dist/domain/resume-metadata-refresher.js +64 -29
  205. package/daemon/dist/domain/resume-metadata-refresher.js.map +1 -1
  206. package/daemon/dist/domain/review/compose.d.ts +5 -26
  207. package/daemon/dist/domain/review/compose.d.ts.map +1 -1
  208. package/daemon/dist/domain/review/compose.js +31 -57
  209. package/daemon/dist/domain/review/compose.js.map +1 -1
  210. package/daemon/dist/domain/rig-repository.d.ts +4 -0
  211. package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
  212. package/daemon/dist/domain/rig-repository.js +9 -0
  213. package/daemon/dist/domain/rig-repository.js.map +1 -1
  214. package/daemon/dist/domain/rigspec-instantiator.d.ts +13 -0
  215. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  216. package/daemon/dist/domain/rigspec-instantiator.js +71 -0
  217. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  218. package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
  219. package/daemon/dist/domain/rigspec-schema.js +19 -3
  220. package/daemon/dist/domain/rigspec-schema.js.map +1 -1
  221. package/daemon/dist/domain/running-name-guard.d.ts +52 -0
  222. package/daemon/dist/domain/running-name-guard.d.ts.map +1 -0
  223. package/daemon/dist/domain/running-name-guard.js +34 -0
  224. package/daemon/dist/domain/running-name-guard.js.map +1 -0
  225. package/daemon/dist/domain/scope/logical-checkbox.d.ts +26 -0
  226. package/daemon/dist/domain/scope/logical-checkbox.d.ts.map +1 -0
  227. package/daemon/dist/domain/scope/logical-checkbox.js +65 -0
  228. package/daemon/dist/domain/scope/logical-checkbox.js.map +1 -0
  229. package/daemon/dist/domain/scope/plan-lock-artifacts.d.ts +1 -1
  230. package/daemon/dist/domain/scope/plan-lock-artifacts.d.ts.map +1 -1
  231. package/daemon/dist/domain/scope/plan-lock-artifacts.js +2 -2
  232. package/daemon/dist/domain/scope/plan-lock-artifacts.js.map +1 -1
  233. package/daemon/dist/domain/scope/scaffold-placeholder.d.ts +22 -0
  234. package/daemon/dist/domain/scope/scaffold-placeholder.d.ts.map +1 -1
  235. package/daemon/dist/domain/scope/scaffold-placeholder.js +24 -0
  236. package/daemon/dist/domain/scope/scaffold-placeholder.js.map +1 -1
  237. package/daemon/dist/domain/seat-activity-service.d.ts +1 -0
  238. package/daemon/dist/domain/seat-activity-service.d.ts.map +1 -1
  239. package/daemon/dist/domain/seat-activity-service.js +39 -23
  240. package/daemon/dist/domain/seat-activity-service.js.map +1 -1
  241. package/daemon/dist/domain/seat-handover-service.d.ts +22 -0
  242. package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
  243. package/daemon/dist/domain/seat-handover-service.js +32 -2
  244. package/daemon/dist/domain/seat-handover-service.js.map +1 -1
  245. package/daemon/dist/domain/seat-lifecycle-service.d.ts +97 -0
  246. package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -0
  247. package/daemon/dist/domain/seat-lifecycle-service.js +312 -0
  248. package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -0
  249. package/daemon/dist/domain/session-transport.d.ts +16 -5
  250. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  251. package/daemon/dist/domain/session-transport.js +155 -16
  252. package/daemon/dist/domain/session-transport.js.map +1 -1
  253. package/daemon/dist/domain/shell-classifier.d.ts +23 -0
  254. package/daemon/dist/domain/shell-classifier.d.ts.map +1 -0
  255. package/daemon/dist/domain/shell-classifier.js +36 -0
  256. package/daemon/dist/domain/shell-classifier.js.map +1 -0
  257. package/daemon/dist/domain/slices/slice-detail-projector.d.ts.map +1 -1
  258. package/daemon/dist/domain/slices/slice-detail-projector.js +10 -1
  259. package/daemon/dist/domain/slices/slice-detail-projector.js.map +1 -1
  260. package/daemon/dist/domain/spec-validation-advisory.d.ts +17 -0
  261. package/daemon/dist/domain/spec-validation-advisory.d.ts.map +1 -0
  262. package/daemon/dist/domain/spec-validation-advisory.js +38 -0
  263. package/daemon/dist/domain/spec-validation-advisory.js.map +1 -0
  264. package/daemon/dist/domain/successor-session-launcher.d.ts +7 -0
  265. package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
  266. package/daemon/dist/domain/successor-session-launcher.js +38 -1
  267. package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
  268. package/daemon/dist/domain/topology-defaults-installer.d.ts +47 -0
  269. package/daemon/dist/domain/topology-defaults-installer.d.ts.map +1 -0
  270. package/daemon/dist/domain/topology-defaults-installer.js +92 -0
  271. package/daemon/dist/domain/topology-defaults-installer.js.map +1 -0
  272. package/daemon/dist/domain/transcript-rotation.d.ts +4 -0
  273. package/daemon/dist/domain/transcript-rotation.d.ts.map +1 -1
  274. package/daemon/dist/domain/transcript-rotation.js +61 -3
  275. package/daemon/dist/domain/transcript-rotation.js.map +1 -1
  276. package/daemon/dist/domain/transcript-store.d.ts.map +1 -1
  277. package/daemon/dist/domain/transcript-store.js +9 -2
  278. package/daemon/dist/domain/transcript-store.js.map +1 -1
  279. package/daemon/dist/domain/types.d.ts +39 -0
  280. package/daemon/dist/domain/types.d.ts.map +1 -1
  281. package/daemon/dist/domain/types.js.map +1 -1
  282. package/daemon/dist/domain/user-settings/settings-store.d.ts +10 -1
  283. package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
  284. package/daemon/dist/domain/user-settings/settings-store.js +39 -0
  285. package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
  286. package/daemon/dist/routes/context-packs.d.ts.map +1 -1
  287. package/daemon/dist/routes/context-packs.js +205 -0
  288. package/daemon/dist/routes/context-packs.js.map +1 -1
  289. package/daemon/dist/routes/queue.d.ts.map +1 -1
  290. package/daemon/dist/routes/queue.js +29 -24
  291. package/daemon/dist/routes/queue.js.map +1 -1
  292. package/daemon/dist/routes/rigspec.js +20 -6
  293. package/daemon/dist/routes/rigspec.js.map +1 -1
  294. package/daemon/dist/routes/seat.d.ts.map +1 -1
  295. package/daemon/dist/routes/seat.js +69 -0
  296. package/daemon/dist/routes/seat.js.map +1 -1
  297. package/daemon/dist/routes/sessions.js +55 -0
  298. package/daemon/dist/routes/sessions.js.map +1 -1
  299. package/daemon/dist/routes/transport.d.ts.map +1 -1
  300. package/daemon/dist/routes/transport.js +52 -39
  301. package/daemon/dist/routes/transport.js.map +1 -1
  302. package/daemon/dist/routes/up.js +21 -2
  303. package/daemon/dist/routes/up.js.map +1 -1
  304. package/daemon/dist/seat-recap-store-surface.d.ts +2 -0
  305. package/daemon/dist/seat-recap-store-surface.d.ts.map +1 -0
  306. package/daemon/dist/seat-recap-store-surface.js +6 -0
  307. package/daemon/dist/seat-recap-store-surface.js.map +1 -0
  308. package/daemon/dist/startup.d.ts.map +1 -1
  309. package/daemon/dist/startup.js +37 -6
  310. package/daemon/dist/startup.js.map +1 -1
  311. package/daemon/docs/reference/chain-file-convention.md +115 -0
  312. package/daemon/docs/reference/legacy-topology-migration.md +53 -0
  313. package/daemon/docs/reference/refocus-channel.md +80 -0
  314. package/daemon/docs/reference/sdlc-conventions.md +24 -0
  315. package/daemon/specs/agents/shared/skills/core/attention-queue/SKILL.md +1 -1
  316. package/daemon/specs/agents/shared/skills/core/human-in-the-loop/SKILL.md +1 -1
  317. package/daemon/specs/agents/shared/skills/core/session-source-fork/SKILL.md +1 -1
  318. package/daemon/specs/agents/shared/skills/core/watchdog/SKILL.md +4 -4
  319. package/daemon/specs/agents/shared/skills/pods/development-team/SKILL.md +8 -0
  320. package/daemon/specs/agents/shared/skills/pods/orchestration-team/SKILL.md +72 -31
  321. package/daemon/specs/agents/shared/skills/pods/oversight-team/SKILL.md +106 -0
  322. package/daemon/specs/agents/shared/skills/process/context-engineering/SKILL.md +479 -0
  323. package/daemon/specs/agents/shared/skills/process/test-driven-development/SKILL.md +9 -0
  324. package/daemon/specs/rigs/launch/demo/project-example/README.md +25 -0
  325. package/daemon/specs/rigs/launch/demo/project-example/missions/improve-onboarding/SPEC.md +19 -0
  326. package/daemon/specs/rigs/launch/demo/project-example/missions/improve-onboarding/slices/01-shorten-first-run/PROGRESS.md +6 -0
  327. package/daemon/specs/rigs/launch/demo/project-example/missions/improve-onboarding/slices/01-shorten-first-run/PROOF.md +7 -0
  328. package/daemon/specs/rigs/launch/demo/project-example/missions/improve-onboarding/slices/01-shorten-first-run/SPEC.md +31 -0
  329. package/daemon/specs/rigs/preview/product-team/topology/instance/CRAFT.md +24 -0
  330. package/daemon/specs/rigs/preview/product-team/topology/rig/CRAFT.md +21 -0
  331. package/daemon/specs/rigs/preview/product-team/topology/rig/ORCHESTRATION-CRAFT.md +50 -0
  332. package/daemon/specs/rigs/preview/product-team/topology/seats/dev1-qa/CRAFT.md +13 -0
  333. package/daemon/specs/rigs/preview/product-team/topology/seats/orch1-lead/CRAFT.md +17 -0
  334. package/daemon/specs/rigs/preview/product-team/topology/seats/rev1-r1/CRAFT.md +17 -0
  335. package/daemon/specs/rigs/preview/product-team/topology/seats/rev1-r2/CRAFT.md +15 -0
  336. package/dist/build-info.js +3 -3
  337. package/dist/cli-error.js +1 -1
  338. package/dist/cli-error.js.map +1 -1
  339. package/dist/commands/broadcast.js +6 -0
  340. package/dist/commands/broadcast.js.map +1 -1
  341. package/dist/commands/config.d.ts.map +1 -1
  342. package/dist/commands/config.js +8 -0
  343. package/dist/commands/config.js.map +1 -1
  344. package/dist/commands/context.d.ts.map +1 -1
  345. package/dist/commands/context.js +363 -48
  346. package/dist/commands/context.js.map +1 -1
  347. package/dist/commands/daemon.d.ts.map +1 -1
  348. package/dist/commands/daemon.js +23 -2
  349. package/dist/commands/daemon.js.map +1 -1
  350. package/dist/commands/import.d.ts.map +1 -1
  351. package/dist/commands/import.js +10 -0
  352. package/dist/commands/import.js.map +1 -1
  353. package/dist/commands/proof.d.ts.map +1 -1
  354. package/dist/commands/proof.js +70 -12
  355. package/dist/commands/proof.js.map +1 -1
  356. package/dist/commands/queue.d.ts.map +1 -1
  357. package/dist/commands/queue.js +36 -13
  358. package/dist/commands/queue.js.map +1 -1
  359. package/dist/commands/rig.d.ts.map +1 -1
  360. package/dist/commands/rig.js +5 -0
  361. package/dist/commands/rig.js.map +1 -1
  362. package/dist/commands/seat.d.ts.map +1 -1
  363. package/dist/commands/seat.js +88 -0
  364. package/dist/commands/seat.js.map +1 -1
  365. package/dist/commands/send.d.ts.map +1 -1
  366. package/dist/commands/send.js +224 -20
  367. package/dist/commands/send.js.map +1 -1
  368. package/dist/commands/transcript.d.ts.map +1 -1
  369. package/dist/commands/transcript.js +25 -1
  370. package/dist/commands/transcript.js.map +1 -1
  371. package/dist/commands/up.d.ts.map +1 -1
  372. package/dist/commands/up.js +8 -0
  373. package/dist/commands/up.js.map +1 -1
  374. package/dist/commands/walk.d.ts +1 -1
  375. package/dist/commands/walk.d.ts.map +1 -1
  376. package/dist/commands/walk.js +293 -30
  377. package/dist/commands/walk.js.map +1 -1
  378. package/dist/config-store.d.ts +15 -1
  379. package/dist/config-store.d.ts.map +1 -1
  380. package/dist/config-store.js +35 -1
  381. package/dist/config-store.js.map +1 -1
  382. package/dist/lib/scope/logical-checkbox.d.ts +26 -0
  383. package/dist/lib/scope/logical-checkbox.d.ts.map +1 -0
  384. package/dist/lib/scope/logical-checkbox.js +65 -0
  385. package/dist/lib/scope/logical-checkbox.js.map +1 -0
  386. package/dist/lib/scope/scaffold-placeholder.d.ts +22 -0
  387. package/dist/lib/scope/scaffold-placeholder.d.ts.map +1 -1
  388. package/dist/lib/scope/scaffold-placeholder.js +24 -0
  389. package/dist/lib/scope/scaffold-placeholder.js.map +1 -1
  390. package/dist/lib/topology-trace.d.ts +36 -0
  391. package/dist/lib/topology-trace.d.ts.map +1 -0
  392. package/dist/lib/topology-trace.js +91 -0
  393. package/dist/lib/topology-trace.js.map +1 -0
  394. package/node_modules/@openrig/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  395. package/node_modules/@openrig/daemon/dist/adapters/claude-code-adapter.js +7 -4
  396. package/node_modules/@openrig/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  397. package/node_modules/@openrig/daemon/dist/adapters/claude-resume.js +2 -2
  398. package/node_modules/@openrig/daemon/dist/adapters/claude-resume.js.map +1 -1
  399. package/node_modules/@openrig/daemon/dist/adapters/tmux.d.ts +41 -2
  400. package/node_modules/@openrig/daemon/dist/adapters/tmux.d.ts.map +1 -1
  401. package/node_modules/@openrig/daemon/dist/adapters/tmux.js +58 -18
  402. package/node_modules/@openrig/daemon/dist/adapters/tmux.js.map +1 -1
  403. package/node_modules/@openrig/daemon/dist/adapters/yolo-mode.d.ts +18 -0
  404. package/node_modules/@openrig/daemon/dist/adapters/yolo-mode.d.ts.map +1 -1
  405. package/node_modules/@openrig/daemon/dist/adapters/yolo-mode.js +21 -0
  406. package/node_modules/@openrig/daemon/dist/adapters/yolo-mode.js.map +1 -1
  407. package/node_modules/@openrig/daemon/dist/build-info.js +3 -3
  408. package/node_modules/@openrig/daemon/dist/daemon-db-path.d.ts.map +1 -1
  409. package/node_modules/@openrig/daemon/dist/daemon-db-path.js +50 -2
  410. package/node_modules/@openrig/daemon/dist/daemon-db-path.js.map +1 -1
  411. package/node_modules/@openrig/daemon/dist/domain/codex-thread-id.d.ts +95 -0
  412. package/node_modules/@openrig/daemon/dist/domain/codex-thread-id.d.ts.map +1 -1
  413. package/node_modules/@openrig/daemon/dist/domain/codex-thread-id.js +171 -2
  414. package/node_modules/@openrig/daemon/dist/domain/codex-thread-id.js.map +1 -1
  415. package/node_modules/@openrig/daemon/dist/domain/context-packs/context-pack-types.d.ts +48 -0
  416. package/node_modules/@openrig/daemon/dist/domain/context-packs/context-pack-types.d.ts.map +1 -1
  417. package/node_modules/@openrig/daemon/dist/domain/context-packs/context-pack-types.js +8 -0
  418. package/node_modules/@openrig/daemon/dist/domain/context-packs/context-pack-types.js.map +1 -1
  419. package/node_modules/@openrig/daemon/dist/domain/context-packs/manifest-parser.d.ts.map +1 -1
  420. package/node_modules/@openrig/daemon/dist/domain/context-packs/manifest-parser.js +234 -2
  421. package/node_modules/@openrig/daemon/dist/domain/context-packs/manifest-parser.js.map +1 -1
  422. package/node_modules/@openrig/daemon/dist/domain/context-packs/probe-eval-bridge.d.ts +34 -0
  423. package/node_modules/@openrig/daemon/dist/domain/context-packs/probe-eval-bridge.d.ts.map +1 -0
  424. package/node_modules/@openrig/daemon/dist/domain/context-packs/probe-eval-bridge.js +38 -0
  425. package/node_modules/@openrig/daemon/dist/domain/context-packs/probe-eval-bridge.js.map +1 -0
  426. package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-composer.d.ts +49 -0
  427. package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-composer.d.ts.map +1 -0
  428. package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-composer.js +125 -0
  429. package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-composer.js.map +1 -0
  430. package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-source-resolver.d.ts +53 -0
  431. package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-source-resolver.d.ts.map +1 -0
  432. package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-source-resolver.js +129 -0
  433. package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-source-resolver.js.map +1 -0
  434. package/node_modules/@openrig/daemon/dist/domain/context-packs/seat-recap-store.d.ts +48 -0
  435. package/node_modules/@openrig/daemon/dist/domain/context-packs/seat-recap-store.d.ts.map +1 -0
  436. package/node_modules/@openrig/daemon/dist/domain/context-packs/seat-recap-store.js +123 -0
  437. package/node_modules/@openrig/daemon/dist/domain/context-packs/seat-recap-store.js.map +1 -0
  438. package/node_modules/@openrig/daemon/dist/domain/markdown-address.d.ts +56 -0
  439. package/node_modules/@openrig/daemon/dist/domain/markdown-address.d.ts.map +1 -0
  440. package/node_modules/@openrig/daemon/dist/domain/markdown-address.js +188 -0
  441. package/node_modules/@openrig/daemon/dist/domain/markdown-address.js.map +1 -0
  442. package/node_modules/@openrig/daemon/dist/domain/model-divergence/current-generation-record.d.ts +8 -2
  443. package/node_modules/@openrig/daemon/dist/domain/model-divergence/current-generation-record.d.ts.map +1 -1
  444. package/node_modules/@openrig/daemon/dist/domain/model-divergence/current-generation-record.js +1 -1
  445. package/node_modules/@openrig/daemon/dist/domain/model-divergence/current-generation-record.js.map +1 -1
  446. package/node_modules/@openrig/daemon/dist/domain/model-divergence/model-divergence-monitor.d.ts +33 -21
  447. package/node_modules/@openrig/daemon/dist/domain/model-divergence/model-divergence-monitor.d.ts.map +1 -1
  448. package/node_modules/@openrig/daemon/dist/domain/model-divergence/model-divergence-monitor.js +64 -55
  449. package/node_modules/@openrig/daemon/dist/domain/model-divergence/model-divergence-monitor.js.map +1 -1
  450. package/node_modules/@openrig/daemon/dist/domain/periodic-snapshot-scheduler.d.ts +4 -0
  451. package/node_modules/@openrig/daemon/dist/domain/periodic-snapshot-scheduler.d.ts.map +1 -1
  452. package/node_modules/@openrig/daemon/dist/domain/periodic-snapshot-scheduler.js +5 -1
  453. package/node_modules/@openrig/daemon/dist/domain/periodic-snapshot-scheduler.js.map +1 -1
  454. package/node_modules/@openrig/daemon/dist/domain/permission-drift-observer.d.ts.map +1 -1
  455. package/node_modules/@openrig/daemon/dist/domain/permission-drift-observer.js +6 -1
  456. package/node_modules/@openrig/daemon/dist/domain/permission-drift-observer.js.map +1 -1
  457. package/node_modules/@openrig/daemon/dist/domain/plugin-discovery-service.d.ts +16 -0
  458. package/node_modules/@openrig/daemon/dist/domain/plugin-discovery-service.d.ts.map +1 -1
  459. package/node_modules/@openrig/daemon/dist/domain/plugin-discovery-service.js +175 -1
  460. package/node_modules/@openrig/daemon/dist/domain/plugin-discovery-service.js.map +1 -1
  461. package/node_modules/@openrig/daemon/dist/domain/plugin-vendor-service.d.ts +9 -5
  462. package/node_modules/@openrig/daemon/dist/domain/plugin-vendor-service.d.ts.map +1 -1
  463. package/node_modules/@openrig/daemon/dist/domain/plugin-vendor-service.js +101 -12
  464. package/node_modules/@openrig/daemon/dist/domain/plugin-vendor-service.js.map +1 -1
  465. package/node_modules/@openrig/daemon/dist/domain/process-census.d.ts +25 -0
  466. package/node_modules/@openrig/daemon/dist/domain/process-census.d.ts.map +1 -0
  467. package/node_modules/@openrig/daemon/dist/domain/process-census.js +47 -0
  468. package/node_modules/@openrig/daemon/dist/domain/process-census.js.map +1 -0
  469. package/node_modules/@openrig/daemon/dist/domain/queue-repository.d.ts +3 -1
  470. package/node_modules/@openrig/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  471. package/node_modules/@openrig/daemon/dist/domain/queue-repository.js +50 -2
  472. package/node_modules/@openrig/daemon/dist/domain/queue-repository.js.map +1 -1
  473. package/node_modules/@openrig/daemon/dist/domain/reconciler.d.ts.map +1 -1
  474. package/node_modules/@openrig/daemon/dist/domain/reconciler.js +6 -1
  475. package/node_modules/@openrig/daemon/dist/domain/reconciler.js.map +1 -1
  476. package/node_modules/@openrig/daemon/dist/domain/resume-metadata-refresher.d.ts +31 -2
  477. package/node_modules/@openrig/daemon/dist/domain/resume-metadata-refresher.d.ts.map +1 -1
  478. package/node_modules/@openrig/daemon/dist/domain/resume-metadata-refresher.js +64 -29
  479. package/node_modules/@openrig/daemon/dist/domain/resume-metadata-refresher.js.map +1 -1
  480. package/node_modules/@openrig/daemon/dist/domain/review/compose.d.ts +5 -26
  481. package/node_modules/@openrig/daemon/dist/domain/review/compose.d.ts.map +1 -1
  482. package/node_modules/@openrig/daemon/dist/domain/review/compose.js +31 -57
  483. package/node_modules/@openrig/daemon/dist/domain/review/compose.js.map +1 -1
  484. package/node_modules/@openrig/daemon/dist/domain/rig-repository.d.ts +4 -0
  485. package/node_modules/@openrig/daemon/dist/domain/rig-repository.d.ts.map +1 -1
  486. package/node_modules/@openrig/daemon/dist/domain/rig-repository.js +9 -0
  487. package/node_modules/@openrig/daemon/dist/domain/rig-repository.js.map +1 -1
  488. package/node_modules/@openrig/daemon/dist/domain/rigspec-instantiator.d.ts +13 -0
  489. package/node_modules/@openrig/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  490. package/node_modules/@openrig/daemon/dist/domain/rigspec-instantiator.js +71 -0
  491. package/node_modules/@openrig/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  492. package/node_modules/@openrig/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
  493. package/node_modules/@openrig/daemon/dist/domain/rigspec-schema.js +19 -3
  494. package/node_modules/@openrig/daemon/dist/domain/rigspec-schema.js.map +1 -1
  495. package/node_modules/@openrig/daemon/dist/domain/running-name-guard.d.ts +52 -0
  496. package/node_modules/@openrig/daemon/dist/domain/running-name-guard.d.ts.map +1 -0
  497. package/node_modules/@openrig/daemon/dist/domain/running-name-guard.js +34 -0
  498. package/node_modules/@openrig/daemon/dist/domain/running-name-guard.js.map +1 -0
  499. package/node_modules/@openrig/daemon/dist/domain/scope/logical-checkbox.d.ts +26 -0
  500. package/node_modules/@openrig/daemon/dist/domain/scope/logical-checkbox.d.ts.map +1 -0
  501. package/node_modules/@openrig/daemon/dist/domain/scope/logical-checkbox.js +65 -0
  502. package/node_modules/@openrig/daemon/dist/domain/scope/logical-checkbox.js.map +1 -0
  503. package/node_modules/@openrig/daemon/dist/domain/scope/plan-lock-artifacts.d.ts +1 -1
  504. package/node_modules/@openrig/daemon/dist/domain/scope/plan-lock-artifacts.d.ts.map +1 -1
  505. package/node_modules/@openrig/daemon/dist/domain/scope/plan-lock-artifacts.js +2 -2
  506. package/node_modules/@openrig/daemon/dist/domain/scope/plan-lock-artifacts.js.map +1 -1
  507. package/node_modules/@openrig/daemon/dist/domain/scope/scaffold-placeholder.d.ts +22 -0
  508. package/node_modules/@openrig/daemon/dist/domain/scope/scaffold-placeholder.d.ts.map +1 -1
  509. package/node_modules/@openrig/daemon/dist/domain/scope/scaffold-placeholder.js +24 -0
  510. package/node_modules/@openrig/daemon/dist/domain/scope/scaffold-placeholder.js.map +1 -1
  511. package/node_modules/@openrig/daemon/dist/domain/seat-activity-service.d.ts +1 -0
  512. package/node_modules/@openrig/daemon/dist/domain/seat-activity-service.d.ts.map +1 -1
  513. package/node_modules/@openrig/daemon/dist/domain/seat-activity-service.js +39 -23
  514. package/node_modules/@openrig/daemon/dist/domain/seat-activity-service.js.map +1 -1
  515. package/node_modules/@openrig/daemon/dist/domain/seat-handover-service.d.ts +22 -0
  516. package/node_modules/@openrig/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
  517. package/node_modules/@openrig/daemon/dist/domain/seat-handover-service.js +32 -2
  518. package/node_modules/@openrig/daemon/dist/domain/seat-handover-service.js.map +1 -1
  519. package/node_modules/@openrig/daemon/dist/domain/seat-lifecycle-service.d.ts +97 -0
  520. package/node_modules/@openrig/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -0
  521. package/node_modules/@openrig/daemon/dist/domain/seat-lifecycle-service.js +312 -0
  522. package/node_modules/@openrig/daemon/dist/domain/seat-lifecycle-service.js.map +1 -0
  523. package/node_modules/@openrig/daemon/dist/domain/session-transport.d.ts +16 -5
  524. package/node_modules/@openrig/daemon/dist/domain/session-transport.d.ts.map +1 -1
  525. package/node_modules/@openrig/daemon/dist/domain/session-transport.js +155 -16
  526. package/node_modules/@openrig/daemon/dist/domain/session-transport.js.map +1 -1
  527. package/node_modules/@openrig/daemon/dist/domain/shell-classifier.d.ts +23 -0
  528. package/node_modules/@openrig/daemon/dist/domain/shell-classifier.d.ts.map +1 -0
  529. package/node_modules/@openrig/daemon/dist/domain/shell-classifier.js +36 -0
  530. package/node_modules/@openrig/daemon/dist/domain/shell-classifier.js.map +1 -0
  531. package/node_modules/@openrig/daemon/dist/domain/slices/slice-detail-projector.d.ts.map +1 -1
  532. package/node_modules/@openrig/daemon/dist/domain/slices/slice-detail-projector.js +10 -1
  533. package/node_modules/@openrig/daemon/dist/domain/slices/slice-detail-projector.js.map +1 -1
  534. package/node_modules/@openrig/daemon/dist/domain/spec-validation-advisory.d.ts +17 -0
  535. package/node_modules/@openrig/daemon/dist/domain/spec-validation-advisory.d.ts.map +1 -0
  536. package/node_modules/@openrig/daemon/dist/domain/spec-validation-advisory.js +38 -0
  537. package/node_modules/@openrig/daemon/dist/domain/spec-validation-advisory.js.map +1 -0
  538. package/node_modules/@openrig/daemon/dist/domain/successor-session-launcher.d.ts +7 -0
  539. package/node_modules/@openrig/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
  540. package/node_modules/@openrig/daemon/dist/domain/successor-session-launcher.js +38 -1
  541. package/node_modules/@openrig/daemon/dist/domain/successor-session-launcher.js.map +1 -1
  542. package/node_modules/@openrig/daemon/dist/domain/topology-defaults-installer.d.ts +47 -0
  543. package/node_modules/@openrig/daemon/dist/domain/topology-defaults-installer.d.ts.map +1 -0
  544. package/node_modules/@openrig/daemon/dist/domain/topology-defaults-installer.js +92 -0
  545. package/node_modules/@openrig/daemon/dist/domain/topology-defaults-installer.js.map +1 -0
  546. package/node_modules/@openrig/daemon/dist/domain/transcript-rotation.d.ts +4 -0
  547. package/node_modules/@openrig/daemon/dist/domain/transcript-rotation.d.ts.map +1 -1
  548. package/node_modules/@openrig/daemon/dist/domain/transcript-rotation.js +61 -3
  549. package/node_modules/@openrig/daemon/dist/domain/transcript-rotation.js.map +1 -1
  550. package/node_modules/@openrig/daemon/dist/domain/transcript-store.d.ts.map +1 -1
  551. package/node_modules/@openrig/daemon/dist/domain/transcript-store.js +9 -2
  552. package/node_modules/@openrig/daemon/dist/domain/transcript-store.js.map +1 -1
  553. package/node_modules/@openrig/daemon/dist/domain/types.d.ts +39 -0
  554. package/node_modules/@openrig/daemon/dist/domain/types.d.ts.map +1 -1
  555. package/node_modules/@openrig/daemon/dist/domain/types.js.map +1 -1
  556. package/node_modules/@openrig/daemon/dist/domain/user-settings/settings-store.d.ts +10 -1
  557. package/node_modules/@openrig/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
  558. package/node_modules/@openrig/daemon/dist/domain/user-settings/settings-store.js +39 -0
  559. package/node_modules/@openrig/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
  560. package/node_modules/@openrig/daemon/dist/routes/context-packs.d.ts.map +1 -1
  561. package/node_modules/@openrig/daemon/dist/routes/context-packs.js +205 -0
  562. package/node_modules/@openrig/daemon/dist/routes/context-packs.js.map +1 -1
  563. package/node_modules/@openrig/daemon/dist/routes/queue.d.ts.map +1 -1
  564. package/node_modules/@openrig/daemon/dist/routes/queue.js +29 -24
  565. package/node_modules/@openrig/daemon/dist/routes/queue.js.map +1 -1
  566. package/node_modules/@openrig/daemon/dist/routes/rigspec.js +20 -6
  567. package/node_modules/@openrig/daemon/dist/routes/rigspec.js.map +1 -1
  568. package/node_modules/@openrig/daemon/dist/routes/seat.d.ts.map +1 -1
  569. package/node_modules/@openrig/daemon/dist/routes/seat.js +69 -0
  570. package/node_modules/@openrig/daemon/dist/routes/seat.js.map +1 -1
  571. package/node_modules/@openrig/daemon/dist/routes/sessions.js +55 -0
  572. package/node_modules/@openrig/daemon/dist/routes/sessions.js.map +1 -1
  573. package/node_modules/@openrig/daemon/dist/routes/transport.d.ts.map +1 -1
  574. package/node_modules/@openrig/daemon/dist/routes/transport.js +52 -39
  575. package/node_modules/@openrig/daemon/dist/routes/transport.js.map +1 -1
  576. package/node_modules/@openrig/daemon/dist/routes/up.js +21 -2
  577. package/node_modules/@openrig/daemon/dist/routes/up.js.map +1 -1
  578. package/node_modules/@openrig/daemon/dist/seat-recap-store-surface.d.ts +2 -0
  579. package/node_modules/@openrig/daemon/dist/seat-recap-store-surface.d.ts.map +1 -0
  580. package/node_modules/@openrig/daemon/dist/seat-recap-store-surface.js +6 -0
  581. package/node_modules/@openrig/daemon/dist/seat-recap-store-surface.js.map +1 -0
  582. package/node_modules/@openrig/daemon/dist/startup.d.ts.map +1 -1
  583. package/node_modules/@openrig/daemon/dist/startup.js +37 -6
  584. package/node_modules/@openrig/daemon/dist/startup.js.map +1 -1
  585. package/node_modules/@openrig/daemon/package.json +6 -1
  586. package/package.json +1 -1
@@ -0,0 +1,129 @@
1
+ // OPR.0.5.3.5 Atom 4a — the two pre-`#` resolvers behind ONE grammar.
2
+ //
3
+ // Q2-Amendment 1 (locked), the desk's grammar ruling verbatim: non-library sources
4
+ // are addressable with the SAME `#H2-slug/H3-slug` grammar; only the pre-`#`
5
+ // resolver differs — a library ref resolves through the library (here: the pack's
6
+ // own directory), a tree path resolves from CONFIGURED roots — and both resolve
7
+ // FAIL-LOUD. One grammar held in memory, two resolvers behind it, no second
8
+ // addressing convention. The kind prefix is the entire pre-`#` dialect:
9
+ //
10
+ // walk.md#welcome -> library (the pack's declared files)
11
+ // seat:RECAP.md#decisions -> the seat tree (recap + lore live beside LEARNED)
12
+ // mission:NOTES.md#watch-items -> the mission tree
13
+ //
14
+ // Roots arrive from CONFIG through the caller (CE-v2 03-tree-addressability: an
15
+ // addressing verb resolves tree paths from config, never literals — this module
16
+ // holds no path literal and refuses to guess a missing root). Composability comes
17
+ // from ADDRESSING, not homing: nothing must be copied into the library to compose
18
+ // (a profile that copies seat or mission content into the library is a defect —
19
+ // Q2-Amendment 1(c)).
20
+ import { lstatSync, readFileSync, realpathSync } from "node:fs";
21
+ import { isAbsolute, join, normalize, relative, sep } from "node:path";
22
+ import { parseAddress } from "../markdown-address.js";
23
+ export class SourceResolutionError extends Error {
24
+ constructor(message) {
25
+ super(message);
26
+ this.name = "SourceResolutionError";
27
+ }
28
+ }
29
+ const TREE_KINDS = ["seat", "mission"];
30
+ /** Split a pre-`#` ref into its resolver kind + relative path. Fail-loud on an
31
+ * unknown prefix or a traversal-shaped path — a clean refusal, never an escape
32
+ * (the r2-B3 precedent from the trace verb). */
33
+ export function parseSourceRef(ref) {
34
+ const colon = ref.indexOf(":");
35
+ let kind = "library";
36
+ let rel = ref;
37
+ if (colon >= 0) {
38
+ const prefix = ref.slice(0, colon);
39
+ if (!TREE_KINDS.includes(prefix)) {
40
+ throw new SourceResolutionError(`source ref '${ref}' has unknown kind prefix '${prefix}' — the pre-'#' dialect is bare (library), ${TREE_KINDS.map((k) => `'${k}:'`).join(" or ")}.`);
41
+ }
42
+ kind = prefix;
43
+ rel = ref.slice(colon + 1);
44
+ }
45
+ if (rel.length === 0) {
46
+ throw new SourceResolutionError(`source ref '${ref}' has an empty path after its kind prefix.`);
47
+ }
48
+ const unsafe = isAbsolute(rel) ||
49
+ rel.split(/[\\/]/).some((segment) => segment === ".." || segment === "");
50
+ if (unsafe) {
51
+ throw new SourceResolutionError(`source ref '${ref}' is traversal-shaped (absolute path, '..' or empty segment) — refs stay inside their source root.`);
52
+ }
53
+ return { kind, rel };
54
+ }
55
+ /** Build the composer's fail-loud readFile over the pack dir + configured tree
56
+ * roots. Every failure names the source kind and what was being resolved —
57
+ * a missing root is a MISSING CONFIG error, never a silent empty; a DANGLING
58
+ * symlink is its own named failure (a realistic corpus state, not a generic
59
+ * unreadable). Each successful read reports byte provenance via onRead. */
60
+ export function makeProfileReadFile(opts) {
61
+ return (ref) => {
62
+ const { kind, rel } = parseSourceRef(ref);
63
+ let base;
64
+ if (kind === "library") {
65
+ base = opts.packDir;
66
+ }
67
+ else {
68
+ const configured = opts.roots[kind];
69
+ if (!configured) {
70
+ throw new SourceResolutionError(`source ref '${ref}' needs the ${kind} tree root, which is not configured for this compose — ` +
71
+ `tree paths resolve from config, never literals; supply the ${kind} root or drop the ${kind}-homed atom.`);
72
+ }
73
+ base = configured;
74
+ }
75
+ const abs = normalize(join(base, rel));
76
+ let text;
77
+ try {
78
+ text = readFileSync(abs, "utf-8");
79
+ }
80
+ catch (err) {
81
+ // Name the dangling-symlink state precisely: the path EXISTS as a link
82
+ // but its target does not — a generic "unreadable" would send an author
83
+ // hunting for a file that is right there in their listing.
84
+ let dangling = false;
85
+ try {
86
+ lstatSync(abs);
87
+ dangling = true;
88
+ }
89
+ catch {
90
+ /* genuinely absent */
91
+ }
92
+ throw new SourceResolutionError(dangling
93
+ ? `source ref '${ref}' (${kind}) is a DANGLING symlink: ${abs} exists but its target does not — ${err.message}`
94
+ : `source ref '${ref}' (${kind}) did not resolve: ${abs} is unreadable — ${err.message}`);
95
+ }
96
+ // Provenance AFTER the successful read (r1: realpath on a missing file
97
+ // throws, and that throw must never garble the honest read error above).
98
+ if (opts.onRead) {
99
+ let realPath = abs;
100
+ try {
101
+ realPath = realpathSync(abs);
102
+ }
103
+ catch {
104
+ /* raced away post-read; nominal stands as the best truth available */
105
+ }
106
+ let realBase = base;
107
+ try {
108
+ realBase = realpathSync(base);
109
+ }
110
+ catch {
111
+ /* root itself unresolvable; compare against the nominal base */
112
+ }
113
+ const relFromBase = relative(realBase, realPath);
114
+ // SEGMENT comparison, never a prefix test on a path-shaped string (r1
115
+ // round-3 F1: a file legitimately NAMED '..hidden-notes.md' inside the
116
+ // root satisfied startsWith('..') — the identical class as
117
+ // startsWith(base) saying /seat-evil is inside /seat, one level in).
118
+ const escapesRoot = relFromBase === ".." || relFromBase.startsWith(`..${sep}`) || isAbsolute(relFromBase);
119
+ opts.onRead({ ref, kind, base, nominalPath: abs, realPath, escapesRoot });
120
+ }
121
+ return text;
122
+ };
123
+ }
124
+ /** The composer's per-piece source label (Q2-Amendment 1: every assembled piece
125
+ * is labeled with its source), derived from the atom's full address. */
126
+ export function sourceKindForAddress(address) {
127
+ return parseSourceRef(parseAddress(address).ref).kind;
128
+ }
129
+ //# sourceMappingURL=profile-source-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile-source-resolver.js","sourceRoot":"","sources":["../../../src/domain/context-packs/profile-source-resolver.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,EAAE;AACF,mFAAmF;AACnF,6EAA6E;AAC7E,kFAAkF;AAClF,gFAAgF;AAChF,4EAA4E;AAC5E,wEAAwE;AACxE,EAAE;AACF,wEAAwE;AACxE,qFAAqF;AACrF,qDAAqD;AACrD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,kFAAkF;AAClF,kFAAkF;AAClF,gFAAgF;AAChF,sBAAsB;AAEtB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAED,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,SAAS,CAAU,CAAC;AAShD;;iDAEiD;AACjD,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,IAAI,GAAe,SAAS,CAAC;IACjC,IAAI,GAAG,GAAG,GAAG,CAAC;IACd,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QACf,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,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ACH,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;YAChC,CAAC;YAAC,MAAM,CAAC;gBACP,gEAAgE;YAClE,CAAC;YACD,MAAM,WAAW,GAAG,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YACjD,sEAAsE;YACtE,uEAAuE;YACvE,2DAA2D;YAC3D,qEAAqE;YACrE,MAAM,WAAW,GAAG,WAAW,KAAK,IAAI,IAAI,WAAW,CAAC,UAAU,CAAC,KAAK,GAAG,EAAE,CAAC,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;YAC1G,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC;QAC5E,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAED;yEACyE;AACzE,MAAM,UAAU,oBAAoB,CAAC,OAAe;IAClD,OAAO,cAAc,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AACxD,CAAC"}
@@ -0,0 +1,48 @@
1
+ export declare const RECAP_FILENAME = "RECAP.md";
2
+ export declare class RecapWriteError extends Error {
3
+ constructor(message: string);
4
+ }
5
+ export interface RecapChainEntry {
6
+ /** Absolute path of the superseded recap. */
7
+ path: string;
8
+ /** The supersession timestamp encoded in the filename (ms epoch). */
9
+ supersededAtMs: number;
10
+ /** Same-millisecond disambiguator (1 for the bare name, 2+ for -N suffixes). */
11
+ sequence: number;
12
+ }
13
+ /** Write the seat's current recap, superseding any existing one into the
14
+ * chain. The gate is ADDRESSABILITY only — never prose shape. */
15
+ export declare function writeSeatRecap(opts: {
16
+ seatDir: string;
17
+ content: string;
18
+ now?: () => number;
19
+ }): void;
20
+ /** The superseded chain, oldest first. Empty when no recap was ever superseded. */
21
+ export declare function listRecapChain(seatDir: string): RecapChainEntry[];
22
+ export type RecapContractFinding = {
23
+ kind: "no-decisions-section";
24
+ } | {
25
+ kind: "nonstandard-unverified-marker";
26
+ line: number;
27
+ };
28
+ /** The authoring contract's CHECKABLE subset (Q2): decisions-with-rationale has
29
+ * a structural proxy (a decisions-titled section exists); the UNVERIFIED
30
+ * marker has a canonical grammar (`UNVERIFIED:` uppercase) that must stay
31
+ * findable — a variant marker hides exactly the fact it exists to flag.
32
+ * Advisory: findings, never throws. */
33
+ export declare function validateRecapContract(content: string): RecapContractFinding[];
34
+ /** BUILD FOLLOW-UP (r1 verdict bb00e850; row 17015088) — the authored-recap
35
+ * pointer resolution, ONE-HOMED here beside the store it reads, parsing the
36
+ * seat ref through the CANONICAL parseSessionName (first-@ split, the
37
+ * documented greedy-rig ruling) — never a second parser. Safety floor
38
+ * preserved: an unresolved or non-canonical ref fails with a LABELED reason
39
+ * carrying what was tried; fuzzy-matching another seat's directory would hand
40
+ * a successor a DIFFERENT occupant's decisions, which is strictly worse than
41
+ * honest absence. */
42
+ export declare function resolveAuthoredRecapPointer(seatRef: string, topologyRoot: string): {
43
+ address: string;
44
+ chainLength: number;
45
+ } | {
46
+ absentReason: string;
47
+ };
48
+ //# sourceMappingURL=seat-recap-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seat-recap-store.d.ts","sourceRoot":"","sources":["../../../src/domain/context-packs/seat-recap-store.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,cAAc,aAAa,CAAC;AAGzC,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B;AAED,MAAM,WAAW,eAAe;IAC9B,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,cAAc,EAAE,MAAM,CAAC;IACvB,gFAAgF;IAChF,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;kEACkE;AAClE,wBAAgB,cAAc,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CAAE,GAAG,IAAI,CA4BnG;AAED,mFAAmF;AACnF,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,EAAE,CAiBjE;AAED,MAAM,MAAM,oBAAoB,GAC5B;IAAE,IAAI,EAAE,sBAAsB,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,+BAA+B,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5D;;;;wCAIwC;AACxC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,oBAAoB,EAAE,CAa7E;AAED;;;;;;;sBAOsB;AACtB,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,GACnB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,CAUrE"}
@@ -0,0 +1,123 @@
1
+ // OPR.0.5.3.5 mini-req 7 (Q2 + Q2-Amendment 1) — the seat recap store.
2
+ //
3
+ // The AUTHORED recap: decisions-with-rationale written by the outgoing occupant
4
+ // at the boundary, extending the shipped from-record boot recap's name (the Q2
5
+ // unify-what-exists ruling — predecessor-recap-resolver.ts remains the
6
+ // transcript-derived sibling). SEAT-HOMED beside LEARNED (Q2-Amendment 1(a):
7
+ // the recap is POSITION knowledge, unshareable by construction — a
8
+ // library-homed recap would be position knowledge on the portable shelf).
9
+ // RETENTION (1(b)): superseded-chain versioning — the newest recap is
10
+ // RECAP.md, predecessors stay byte-preserved under recap-superseded/ in the
11
+ // seat directory, cleaned by seat-directory lifecycle, NEVER by library
12
+ // curation; no librarian job is created.
13
+ //
14
+ // Two validation altitudes, deliberately different:
15
+ // - ADDRESSABILITY is the one HARD gate on write: the recap is composed by
16
+ // address (seat:RECAP.md#...), so an unaddressable recap (duplicate header
17
+ // paths, unterminated fence) would fail every handover profile downstream,
18
+ // silently late. Structural, not prose-shaped.
19
+ // - The AUTHORING CONTRACT validates ADVISORY on its CHECKABLE subset only:
20
+ // findings flag for review, never gate the boundary (the D2 pattern). The
21
+ // contract's semantic halves (temporal order, derived-values-as-commands)
22
+ // are not mechanically checkable and are NOT pretended at.
23
+ import { mkdirSync, readdirSync, renameSync, writeFileSync, existsSync } from "node:fs";
24
+ import { join } from "node:path";
25
+ import { validateMarkdownAddressability, parseMarkdownSections } from "../markdown-address.js";
26
+ import { parseSessionName } from "../session-name.js";
27
+ export const RECAP_FILENAME = "RECAP.md";
28
+ const CHAIN_DIRNAME = "recap-superseded";
29
+ export class RecapWriteError extends Error {
30
+ constructor(message) {
31
+ super(message);
32
+ this.name = "RecapWriteError";
33
+ }
34
+ }
35
+ /** Write the seat's current recap, superseding any existing one into the
36
+ * chain. The gate is ADDRESSABILITY only — never prose shape. */
37
+ export function writeSeatRecap(opts) {
38
+ const findings = validateMarkdownAddressability(opts.content);
39
+ if (findings.length > 0) {
40
+ throw new RecapWriteError(`recap is not addressable and could never compose (seat:${RECAP_FILENAME}#... would fail every ` +
41
+ `handover profile): ${findings.map((f) => f.kind === "unterminated-fence" ? `unterminated fence at line ${f.line}` : `${f.kind} '${"headerPath" in f ? f.headerPath : ""}'`).join("; ")}. ` +
42
+ `Fix the structure (duplicate header paths / unterminated fences); prose shape is never gated.`);
43
+ }
44
+ const now = opts.now ?? Date.now;
45
+ const current = join(opts.seatDir, RECAP_FILENAME);
46
+ if (existsSync(current)) {
47
+ const chainDir = join(opts.seatDir, CHAIN_DIRNAME);
48
+ mkdirSync(chainDir, { recursive: true });
49
+ // COLLISION-SAFE naming (r1 F1): renameSync onto an existing path REPLACES
50
+ // it, so two supersessions in one millisecond silently destroyed a
51
+ // predecessor — the retention contract inverted. A counter suffix
52
+ // disambiguates: nothing is lost AND the boundary write still succeeds
53
+ // (better than throwing on both counts). `now` is injectable, so
54
+ // programmatic callers collide deterministically, not rarely.
55
+ const stamp = String(now()).padStart(15, "0");
56
+ let target = join(chainDir, `RECAP-${stamp}.md`);
57
+ for (let counter = 2; existsSync(target); counter++) {
58
+ target = join(chainDir, `RECAP-${stamp}-${counter}.md`);
59
+ }
60
+ renameSync(current, target);
61
+ }
62
+ writeFileSync(current, opts.content);
63
+ }
64
+ /** The superseded chain, oldest first. Empty when no recap was ever superseded. */
65
+ export function listRecapChain(seatDir) {
66
+ const chainDir = join(seatDir, CHAIN_DIRNAME);
67
+ let names;
68
+ try {
69
+ names = readdirSync(chainDir);
70
+ }
71
+ catch {
72
+ return [];
73
+ }
74
+ return names
75
+ .map((name) => {
76
+ const m = name.match(/^RECAP-(\d+)(?:-(\d+))?\.md$/);
77
+ return m
78
+ ? { path: join(chainDir, name), supersededAtMs: Number(m[1]), sequence: m[2] ? Number(m[2]) : 1 }
79
+ : null;
80
+ })
81
+ .filter((e) => e !== null)
82
+ .sort((a, b) => a.supersededAtMs - b.supersededAtMs || a.sequence - b.sequence);
83
+ }
84
+ /** The authoring contract's CHECKABLE subset (Q2): decisions-with-rationale has
85
+ * a structural proxy (a decisions-titled section exists); the UNVERIFIED
86
+ * marker has a canonical grammar (`UNVERIFIED:` uppercase) that must stay
87
+ * findable — a variant marker hides exactly the fact it exists to flag.
88
+ * Advisory: findings, never throws. */
89
+ export function validateRecapContract(content) {
90
+ const findings = [];
91
+ const sections = parseMarkdownSections(content);
92
+ const hasDecisions = sections.some((s) => s.headerPath[s.headerPath.length - 1].includes("decision"));
93
+ if (!hasDecisions)
94
+ findings.push({ kind: "no-decisions-section" });
95
+ const lines = content.split("\n");
96
+ for (let i = 0; i < lines.length; i++) {
97
+ const line = lines[i];
98
+ if (/unverified/i.test(line) && !line.includes("UNVERIFIED:")) {
99
+ findings.push({ kind: "nonstandard-unverified-marker", line: i });
100
+ }
101
+ }
102
+ return findings;
103
+ }
104
+ /** BUILD FOLLOW-UP (r1 verdict bb00e850; row 17015088) — the authored-recap
105
+ * pointer resolution, ONE-HOMED here beside the store it reads, parsing the
106
+ * seat ref through the CANONICAL parseSessionName (first-@ split, the
107
+ * documented greedy-rig ruling) — never a second parser. Safety floor
108
+ * preserved: an unresolved or non-canonical ref fails with a LABELED reason
109
+ * carrying what was tried; fuzzy-matching another seat's directory would hand
110
+ * a successor a DIFFERENT occupant's decisions, which is strictly worse than
111
+ * honest absence. */
112
+ export function resolveAuthoredRecapPointer(seatRef, topologyRoot) {
113
+ const parsed = parseSessionName(seatRef);
114
+ if (parsed.kind !== "canonical") {
115
+ return { absentReason: `seat ref '${seatRef}' did not parse as canonical <seat>@<rig> (parse verdict: ${parsed.kind}) — authored recap not resolved, never guessed` };
116
+ }
117
+ const seatDir = join(topologyRoot, "rigs", parsed.rig, "seats", parsed.member);
118
+ if (!existsSync(join(seatDir, RECAP_FILENAME))) {
119
+ return { absentReason: `no ${RECAP_FILENAME} on the seat tree (${seatDir}) — the predecessor never wrote one` };
120
+ }
121
+ return { address: `seat:${RECAP_FILENAME}`, chainLength: listRecapChain(seatDir).length };
122
+ }
123
+ //# sourceMappingURL=seat-recap-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seat-recap-store.js","sourceRoot":"","sources":["../../../src/domain/context-packs/seat-recap-store.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAC/E,uEAAuE;AACvE,6EAA6E;AAC7E,mEAAmE;AACnE,0EAA0E;AAC1E,sEAAsE;AACtE,4EAA4E;AAC5E,wEAAwE;AACxE,yCAAyC;AACzC,EAAE;AACF,oDAAoD;AACpD,2EAA2E;AAC3E,6EAA6E;AAC7E,6EAA6E;AAC7E,iDAAiD;AACjD,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAC5E,6DAA6D;AAE7D,OAAO,EAAE,SAAS,EAAE,WAAW,EAAgB,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACtG,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,C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AC,IAAI,CAAC,EAAE,IAAI,EAAE,+BAA+B,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;sBAOsB;AACtB,MAAM,UAAU,2BAA2B,CACzC,OAAe,EACf,YAAoB;IAEpB,MAAM,MAAM,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,MAAM,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QAChC,OAAO,EAAE,YAAY,EAAE,aAAa,OAAO,6DAA6D,MAAM,CAAC,IAAI,gDAAgD,EAAE,CAAC;IACxK,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/E,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;QAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,sBAAsB,OAAO,qCAAqC,EAAE,CAAC;IAClH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,QAAQ,cAAc,EAAE,EAAE,WAAW,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;AAC5F,CAAC"}
@@ -0,0 +1,56 @@
1
+ export declare class AddressResolutionError extends Error {
2
+ constructor(message: string);
3
+ }
4
+ /** ONE slug rule, simple enough to hold in memory: lowercase; markdown emphasis/code
5
+ * markers stripped with the text kept; every run of non-alphanumerics becomes one
6
+ * hyphen; leading/trailing hyphens trimmed. */
7
+ export declare function slugifyHeader(title: string): string;
8
+ export interface ParsedAddress {
9
+ /** The pre-`#` ref — a library ref or a tree path; the caller's resolver owns it. */
10
+ ref: string;
11
+ /** 0 (whole file), 1 (H2) or 2 (H2/H3) slugs. */
12
+ headerPath: string[];
13
+ }
14
+ /** Parse the one grammar form `ref` / `ref#h2` / `ref#h2/h3`. Fail-loud on anything else. */
15
+ export declare function parseAddress(address: string): ParsedAddress;
16
+ export interface MarkdownSection {
17
+ /** Header level (2 or 3). */
18
+ level: number;
19
+ /** The header's raw title text. */
20
+ title: string;
21
+ /** This section's address path: [h2Slug] or [h2Slug, h3Slug]. */
22
+ headerPath: string[];
23
+ /** 0-based line of the header itself. */
24
+ headerLine: number;
25
+ /** FULL span (Q1): header line through the line before the next same-or-higher header. */
26
+ text: string;
27
+ /** OWN text: header line through the line before the next header of ANY level. */
28
+ ownText: string;
29
+ }
30
+ /** Parse the addressable H2/H3 section tree of a markdown text.
31
+ * A matched section is NEVER empty by construction: the span includes the header
32
+ * line itself, so even a body-less `## alpha` (next line another header, or EOF)
33
+ * resolves to at least its own header — a matched-but-empty section can never
34
+ * quietly thin a compose (the structural half of the fail-loud contract; r1 A2). */
35
+ export declare function parseMarkdownSections(text: string): MarkdownSection[];
36
+ /** Resolve a header path against markdown text. FAIL-LOUD: no match is an error that
37
+ * names the miss and the real candidates at that altitude — never a silent empty. */
38
+ export declare function resolveAddress(text: string, headerPath: string[]): MarkdownSection;
39
+ export type AddressabilityFinding = {
40
+ kind: "duplicate-header-path";
41
+ headerPath: string;
42
+ lines: number[];
43
+ } | {
44
+ kind: "unaddressable-header";
45
+ headerPath: string;
46
+ line: number;
47
+ title: string;
48
+ } | {
49
+ kind: "unterminated-fence";
50
+ line: number;
51
+ };
52
+ /** The compose-gate validator: every H2/H3 must be uniquely addressable under the one
53
+ * slug rule, and the file must not silently lose sections. Findings, not throws —
54
+ * the caller decides the gate. */
55
+ export declare function validateMarkdownAddressability(text: string): AddressabilityFinding[];
56
+ //# sourceMappingURL=markdown-address.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-address.d.ts","sourceRoot":"","sources":["../../src/domain/markdown-address.ts"],"names":[],"mappings":"AA0BA,qBAAa,sBAAuB,SAAQ,KAAK;gBACnC,OAAO,EAAE,MAAM;C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pF"}
@@ -0,0 +1,188 @@
1
+ // OPR.0.5.3.5 mini-req 6 — ADDRESSABLE MARKDOWN, the resolver core.
2
+ //
3
+ // Locked conventions (SPEC.md Q1 ruling, approved-spec-by review-r1; grammar authority
4
+ // FOUNDER_NOTES.md P1): an address is `name#H2-slug/H3-slug` — exactly ONE form, held in
5
+ // memory. `name` is resolved by the caller (library index or configured tree roots — the
6
+ // Q2-Amendment 1 one-grammar-two-resolvers ruling); everything after `#` resolves HERE,
7
+ // against markdown text. A bare address returns the section's FULL span: everything until
8
+ // the next SAME-OR-HIGHER-level header, children included. The section's OWN text (until
9
+ // the next header of ANY level) is the `ownText` field of the same resolution — a field,
10
+ // never a second address syntax (the superseded May design accepted two separator forms;
11
+ // we deliberately ship one). Headers inside code fences are never addresses and never
12
+ // terminate spans (the May prototype's proven trap). Resolution FAILS LOUD: an address
13
+ // that matches nothing is an AddressResolutionError naming the reason and the real
14
+ // candidates — never a silent empty; in an install pipeline a missing atom must stop the
15
+ // compose, not thin the walk quietly (the prototype's graceful-undefined is the one
16
+ // behavior explicitly not carried).
17
+ //
18
+ // This module is PURE (text in, spans out) and daemon-homed so the CLI (which depends on
19
+ // @openrig/daemon) and the daemon assembler share one resolver — one grammar, one home.
20
+ // Scope fence (Q4): resolution + composition support only; CRUD/surgical-edit/lint stays
21
+ // with the 0.6.0 mdar-full-ship trail.
22
+ /** Addressable depth per the Q1 ruling: H2 and H3. */
23
+ const MIN_LEVEL = 2;
24
+ const MAX_LEVEL = 3;
25
+ export class AddressResolutionError extends Error {
26
+ constructor(message) {
27
+ super(message);
28
+ this.name = "AddressResolutionError";
29
+ }
30
+ }
31
+ /** ONE slug rule, simple enough to hold in memory: lowercase; markdown emphasis/code
32
+ * markers stripped with the text kept; every run of non-alphanumerics becomes one
33
+ * hyphen; leading/trailing hyphens trimmed. */
34
+ export function slugifyHeader(title) {
35
+ return title
36
+ .toLowerCase()
37
+ .replace(/[`*_~]/g, "")
38
+ .replace(/[^a-z0-9]+/g, "-")
39
+ .replace(/^-+|-+$/g, "");
40
+ }
41
+ /** Parse the one grammar form `ref` / `ref#h2` / `ref#h2/h3`. Fail-loud on anything else. */
42
+ export function parseAddress(address) {
43
+ const hashCount = (address.match(/#/g) ?? []).length;
44
+ if (hashCount > 1) {
45
+ throw new AddressResolutionError(`address '${address}' has ${hashCount} '#' separators — the one form is name#H2-slug/H3-slug (a single '#').`);
46
+ }
47
+ const [ref, headerPart] = hashCount === 1 ? address.split("#") : [address, undefined];
48
+ if (!ref) {
49
+ throw new AddressResolutionError(`address '${address}' has an empty ref before '#' — an address always names its file/ref.`);
50
+ }
51
+ if (headerPart === undefined)
52
+ return { ref, headerPath: [] };
53
+ const headerPath = headerPart.split("/");
54
+ if (headerPath.some((seg) => seg.length === 0)) {
55
+ throw new AddressResolutionError(`address '${address}' has an empty header segment — the form is name#H2-slug or name#H2-slug/H3-slug.`);
56
+ }
57
+ if (headerPath.length > MAX_LEVEL - MIN_LEVEL + 1) {
58
+ throw new AddressResolutionError(`address '${address}' goes ${headerPath.length} levels deep — addresses target H2 and H3 only (Q1 ruling), so the deepest form is name#H2-slug/H3-slug.`);
59
+ }
60
+ return { ref, headerPath };
61
+ }
62
+ /** Scan for real headers, skipping fenced code blocks (``` or ~~~, any info string;
63
+ * a fence closes only on the same marker at the same or greater length). */
64
+ function scanHeaders(lines) {
65
+ const hits = [];
66
+ let fence = null;
67
+ for (let i = 0; i < lines.length; i++) {
68
+ const line = lines[i];
69
+ const fenceMatch = line.match(/^\s{0,3}(`{3,}|~{3,})/);
70
+ if (fenceMatch) {
71
+ const marker = fenceMatch[1][0];
72
+ const length = fenceMatch[1].length;
73
+ if (!fence) {
74
+ fence = { marker, length, line: i };
75
+ }
76
+ else if (fence.marker === marker && length >= fence.length) {
77
+ fence = null;
78
+ }
79
+ continue;
80
+ }
81
+ if (fence)
82
+ continue;
83
+ const header = line.match(/^(#{1,6})\s+(.*\S)\s*$/);
84
+ if (header)
85
+ hits.push({ level: header[1].length, title: header[2], line: i });
86
+ }
87
+ return { hits, unterminatedFenceLine: fence?.line ?? null };
88
+ }
89
+ /** Parse the addressable H2/H3 section tree of a markdown text.
90
+ * A matched section is NEVER empty by construction: the span includes the header
91
+ * line itself, so even a body-less `## alpha` (next line another header, or EOF)
92
+ * resolves to at least its own header — a matched-but-empty section can never
93
+ * quietly thin a compose (the structural half of the fail-loud contract; r1 A2). */
94
+ export function parseMarkdownSections(text) {
95
+ const lines = text.split("\n");
96
+ const { hits: headers } = scanHeaders(lines);
97
+ const sections = [];
98
+ let currentH2 = null;
99
+ for (let idx = 0; idx < headers.length; idx++) {
100
+ const h = headers[idx];
101
+ if (h.level < MIN_LEVEL || h.level > MAX_LEVEL) {
102
+ if (h.level < MIN_LEVEL)
103
+ currentH2 = null; // an H1 resets the H2 scope
104
+ continue;
105
+ }
106
+ const slug = slugifyHeader(h.title);
107
+ if (h.level === 2)
108
+ currentH2 = slug;
109
+ // r1 F2: test the SCOPE against null, never truthiness — an H2 whose title
110
+ // slugifies to "" still owns its children. They stay under the empty segment
111
+ // (unreachable by any legal address, and the validator names the family)
112
+ // instead of being silently promoted to top-level addresses.
113
+ const headerPath = h.level === 2 ? [slug] : currentH2 !== null ? [currentH2, slug] : [slug];
114
+ // FULL span: to the next header with level <= this one (same-or-higher).
115
+ const fullEnd = headers.slice(idx + 1).find((n) => n.level <= h.level)?.line ?? lines.length;
116
+ // OWN text: to the next header of ANY level.
117
+ const ownEnd = headers[idx + 1]?.line ?? lines.length;
118
+ sections.push({
119
+ level: h.level,
120
+ title: h.title,
121
+ headerPath,
122
+ headerLine: h.line,
123
+ text: lines.slice(h.line, fullEnd).join("\n"),
124
+ ownText: lines.slice(h.line, ownEnd).join("\n"),
125
+ });
126
+ }
127
+ return sections;
128
+ }
129
+ /** Resolve a header path against markdown text. FAIL-LOUD: no match is an error that
130
+ * names the miss and the real candidates at that altitude — never a silent empty. */
131
+ export function resolveAddress(text, headerPath) {
132
+ if (headerPath.length === 0) {
133
+ throw new AddressResolutionError("resolveAddress needs at least one header slug; a bare ref resolves to the whole file at the caller.");
134
+ }
135
+ const sections = parseMarkdownSections(text);
136
+ const wanted = headerPath.join("/");
137
+ const hits = sections.filter((s) => s.headerPath.join("/") === wanted);
138
+ // AMBIGUITY fails loud at RESOLVE time (Atom 4c): a duplicate header-path is
139
+ // a validator finding, but serving must not depend on the validator having
140
+ // run — first-match on a shipped duplicate is a silent wrong answer.
141
+ if (hits.length > 1) {
142
+ throw new AddressResolutionError(`address '#${wanted}' is AMBIGUOUS in this file — ${hits.length} sections share the path ` +
143
+ `(header lines ${hits.map((h) => h.headerLine).join(", ")}). Fix the duplicate headers; ` +
144
+ `serving any one of them would be a silent wrong answer.`);
145
+ }
146
+ if (hits.length === 1)
147
+ return hits[0];
148
+ const parentPath = headerPath.slice(0, -1).join("/");
149
+ const candidates = sections
150
+ .filter((s) => s.headerPath.slice(0, -1).join("/") === parentPath)
151
+ .map((s) => s.headerPath.join("/"));
152
+ throw new AddressResolutionError(`address '#${wanted}' matches no header in this file — composition stops here rather than thinning the walk. ` +
153
+ (candidates.length > 0
154
+ ? `Addressable sections under '${parentPath || "(top)"}': ${candidates.join(", ")}.`
155
+ : `The file has ${sections.length} addressable section(s): ${sections.map((s) => s.headerPath.join("/")).join(", ") || "(none)"}.`));
156
+ }
157
+ /** The compose-gate validator: every H2/H3 must be uniquely addressable under the one
158
+ * slug rule, and the file must not silently lose sections. Findings, not throws —
159
+ * the caller decides the gate. */
160
+ export function validateMarkdownAddressability(text) {
161
+ const lines = text.split("\n");
162
+ const { unterminatedFenceLine } = scanHeaders(lines);
163
+ const sections = parseMarkdownSections(text);
164
+ const findings = [];
165
+ // r1 F1: an unclosed fence swallows every later header; resolution stays honest
166
+ // (a swallowed address fails loud) but the GATE must name the loss up front —
167
+ // this is the corpus defect a real file is most likely to actually contain.
168
+ if (unterminatedFenceLine !== null) {
169
+ findings.push({ kind: "unterminated-fence", line: unterminatedFenceLine });
170
+ }
171
+ const seen = new Map();
172
+ for (const s of sections) {
173
+ // r1 F2 family rule: ANY empty segment makes a section unreachable by a legal
174
+ // address (parseAddress rejects empty segments) — flag parent AND children.
175
+ if (s.headerPath.some((segment) => segment.length === 0)) {
176
+ findings.push({ kind: "unaddressable-header", headerPath: s.headerPath.join("/"), line: s.headerLine, title: s.title });
177
+ continue;
178
+ }
179
+ const key = s.headerPath.join("/");
180
+ seen.set(key, [...(seen.get(key) ?? []), s.headerLine]);
181
+ }
182
+ for (const [headerPath, lineNumbers] of seen) {
183
+ if (lineNumbers.length > 1)
184
+ findings.push({ kind: "duplicate-header-path", headerPath, lines: lineNumbers });
185
+ }
186
+ return findings;
187
+ }
188
+ //# sourceMappingURL=markdown-address.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-address.js","sourceRoot":"","sources":["../../src/domain/markdown-address.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,EAAE;AACF,uFAAuF;AACvF,yFAAyF;AACzF,yFAAyF;AACzF,wFAAwF;AACxF,0FAA0F;AAC1F,yFAAyF;AACzF,yFAAyF;AACzF,yFAAyF;AACzF,sFAAsF;AACtF,uFAAuF;AACvF,mFAAmF;AACnF,yFAAyF;AACzF,oFAAoF;AACpF,oCAAoC;AACpC,EAAE;AACF,yFAAyF;AACzF,wFAAwF;AACxF,yFAAyF;AACzF,uCAAuC;AAEvC,sDAAsD;AACtD,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,MAAM,SAAS,GAAG,CAAC,CAAC;AAEpB,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC/C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF;AAED;;gDAEgD;AAChD,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,KAAK;SACT,WAAW,EAAE;SACb,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;SACtB,OAAO,CAAC,aAAa,EAA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E,IAAI,EAAE,uBAAuB,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;IAC/G,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -2,12 +2,18 @@ export interface ProcessRow {
2
2
  pid: number;
3
3
  ppid: number;
4
4
  command: string;
5
+ /** OPR.0.5.3.10 — the process start time (`ps lstart`), the identity half
6
+ * of pid+start-time: pid reuse changes it, so consumers can invalidate
7
+ * cached per-pid answers without another spawn. Optional: injected legacy
8
+ * rows without it fall back to the resolver's TTL bound. */
9
+ startedAt?: string;
5
10
  }
6
11
  export interface CurrentGenerationDeps {
7
12
  getPanePid: (sessionTarget: string) => Promise<number | null>;
8
13
  listProcesses: () => Promise<ProcessRow[]>;
9
- /** Codex: thread id for a live codex pid (the logs join; async post-F1). */
10
- readThreadIdByPid: (pid: number) => Promise<string | undefined> | string | undefined;
14
+ /** Codex: thread id for a live codex pid (the logs join; async post-F1).
15
+ * `identity` = the census row's startedAt (pid+start-time reuse guard). */
16
+ readThreadIdByPid: (pid: number, identity?: string) => Promise<string | undefined> | string | undefined;
11
17
  }
12
18
  export type CurrentRecordResolution = {
13
19
  ok: true;
@@ -1 +1 @@
1
- {"version":3,"file":"current-generation-record.d.ts","sourceRoot":"","sources":["../../../src/domain/model-divergence/current-generation-record.ts"],"names":[],"mappings":"AAuBA,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC9D,aAAa,EAAE,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IAC3C,4EAA4E;IAC5E,iBAAiB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAA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aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,uBAAuB,CAAC,CAWlC"}
1
+ {"version":3,"file":"current-generation-record.d.ts","sourceRoot":"","sources":["../../../src/domain/model-divergence/current-generation-record.ts"],"names":[],"mappings":"AAuBA,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB;;;iEAG6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC9D,aAAa,EAAE,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IAC3C;gFAC4E;IAC5E,iBAAiB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,GAAG,SAAS,CAAC;CACzG;AAED,MAAM,MAAM,uBAAuB,GAC/B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACxB;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AA+BlC;;;mGAGmG;AACnG,wBAAsB,2BAA2B,CAC/C,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,IAAI,CAAC,qBAAqB,EAAE,YAAY,GAAG,eAAe,CAAC,GAChE,OAAO,CAAC,uBAAuB,CAAC,CAYlC;AAED,MAAM,WAAW,qBAAqB;IACpC,kGAAkG;IAClG,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,2DAA2D;IAC3D,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,MAAM,qBAAqB,GAC7B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACtD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAElC,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;sCAasC;AACtC,qBAAa,wBAAwB;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAInB;IAEL,MAAM,CACJ,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,qBAAqB,EAAE,EACnC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,UAAU,GAAG,IAAI,GAC9C,qBAAqB;IAkFxB,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,iBAAiB;CAQ1B;AAMD;0FAC0F;AAC1F,wBAAsB,wBAAwB,CAC5C,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,uBAAuB,CAAC,CAWlC"}
@@ -195,7 +195,7 @@ export async function resolveLiveCodexThreadId(sessionTarget, deps) {
195
195
  if (codexPids.length === 0)
196
196
  return { ok: false, reason: `no codex process under the live pane of ${sessionTarget}` };
197
197
  for (const pid of codexPids) {
198
- const threadId = await deps.readThreadIdByPid(pid);
198
+ const threadId = await deps.readThreadIdByPid(pid, processes.find((p) => p.pid === pid)?.startedAt);
199
199
  if (threadId)
200
200
  return { ok: true, id: threadId };
201
201
  }