@openrig/cli 0.7.13 → 0.7.14

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 (413) hide show
  1. package/README.md +5 -5
  2. package/daemon/assets/plugins/openrig/.claude-plugin/plugin.json +1 -1
  3. package/daemon/assets/plugins/openrig/.codex-plugin/plugin.json +1 -1
  4. package/daemon/assets/plugins/openrig/.cursor-plugin/plugin.json +1 -1
  5. package/daemon/assets/plugins/openrig/plugin.json +1 -1
  6. package/daemon/assets/plugins/openrig/skills/working-with-an-openrig-team/SKILL.md +7 -0
  7. package/daemon/assets/skills/rigs/SKILL.md +5 -2
  8. package/daemon/context-packs/help/manifest.yaml +1 -1
  9. package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
  10. package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +65 -21
  11. package/daemon/context-packs/reference/getting-started.md +13 -8
  12. package/daemon/context-packs/reference/manifest.yaml +1 -1
  13. package/daemon/context-packs/reference/rig-spec.md +4 -0
  14. package/daemon/context-packs/reference/tmux-servers.md +8 -2
  15. package/daemon/context-packs/reference/whats-new.md +153 -15
  16. package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
  17. package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
  18. package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
  19. package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
  20. package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
  21. package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
  22. package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
  23. package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
  24. package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
  25. package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
  26. package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
  27. package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
  28. package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
  29. package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
  30. package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
  31. package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
  32. package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
  33. package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
  34. package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
  35. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
  36. package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
  37. package/daemon/context-packs/skills/core/working-with-an-openrig-team/SKILL.md +7 -0
  38. package/daemon/context-packs/skills/core/working-with-an-openrig-team/manifest.yaml +1 -1
  39. package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
  40. package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
  41. package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
  42. package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
  43. package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
  44. package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
  45. package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
  46. package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
  47. package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
  48. package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
  49. package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
  50. package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
  51. package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
  52. package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
  53. package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
  54. package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
  55. package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
  56. package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
  57. package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
  58. package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
  59. package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
  60. package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
  61. package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
  62. package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
  63. package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
  64. package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
  65. package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
  66. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
  67. package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
  68. package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
  69. package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
  70. package/daemon/context-packs/world-example/manifest.yaml +1 -1
  71. package/daemon/context-packs/world-public/manifest.yaml +1 -1
  72. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  73. package/daemon/dist/adapters/claude-code-adapter.js +27 -4
  74. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  75. package/daemon/dist/adapters/codex-runtime-adapter.d.ts +11 -2
  76. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  77. package/daemon/dist/adapters/codex-runtime-adapter.js +32 -9
  78. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  79. package/daemon/dist/adapters/tmux-exec.d.ts +4 -4
  80. package/daemon/dist/adapters/tmux-exec.d.ts.map +1 -1
  81. package/daemon/dist/adapters/tmux-exec.js +37 -8
  82. package/daemon/dist/adapters/tmux-exec.js.map +1 -1
  83. package/daemon/dist/adapters/tmux.d.ts +9 -0
  84. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  85. package/daemon/dist/adapters/tmux.js +23 -3
  86. package/daemon/dist/adapters/tmux.js.map +1 -1
  87. package/daemon/dist/attention-surface.d.ts +8 -0
  88. package/daemon/dist/attention-surface.d.ts.map +1 -1
  89. package/daemon/dist/attention-surface.js.map +1 -1
  90. package/daemon/dist/build-info.js +3 -3
  91. package/daemon/dist/db/all-migrations.d.ts.map +1 -1
  92. package/daemon/dist/db/all-migrations.js +6 -0
  93. package/daemon/dist/db/all-migrations.js.map +1 -1
  94. package/daemon/dist/db/migrations/163_network_installations.d.ts +7 -0
  95. package/daemon/dist/db/migrations/163_network_installations.d.ts.map +1 -0
  96. package/daemon/dist/db/migrations/163_network_installations.js +23 -0
  97. package/daemon/dist/db/migrations/163_network_installations.js.map +1 -0
  98. package/daemon/dist/db/migrations/164_queue_items_reply_to_index.d.ts +5 -0
  99. package/daemon/dist/db/migrations/164_queue_items_reply_to_index.d.ts.map +1 -0
  100. package/daemon/dist/db/migrations/164_queue_items_reply_to_index.js +9 -0
  101. package/daemon/dist/db/migrations/164_queue_items_reply_to_index.js.map +1 -0
  102. package/daemon/dist/db/migrations/166_queue_list_read_indexes.d.ts +4 -0
  103. package/daemon/dist/db/migrations/166_queue_list_read_indexes.d.ts.map +1 -0
  104. package/daemon/dist/db/migrations/166_queue_list_read_indexes.js +17 -0
  105. package/daemon/dist/db/migrations/166_queue_list_read_indexes.js.map +1 -0
  106. package/daemon/dist/domain/claude-compaction-enforcer.d.ts +5 -0
  107. package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
  108. package/daemon/dist/domain/claude-compaction-enforcer.js +12 -3
  109. package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
  110. package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
  111. package/daemon/dist/domain/context-monitor.js +8 -3
  112. package/daemon/dist/domain/context-monitor.js.map +1 -1
  113. package/daemon/dist/domain/draft-aware-delivery.d.ts.map +1 -1
  114. package/daemon/dist/domain/draft-aware-delivery.js +2 -1
  115. package/daemon/dist/domain/draft-aware-delivery.js.map +1 -1
  116. package/daemon/dist/domain/hosts/pairing-ask.d.ts +8 -0
  117. package/daemon/dist/domain/hosts/pairing-ask.d.ts.map +1 -1
  118. package/daemon/dist/domain/hosts/pairing-ask.js +20 -0
  119. package/daemon/dist/domain/hosts/pairing-ask.js.map +1 -1
  120. package/daemon/dist/domain/input-read-diagnostic.d.ts +30 -0
  121. package/daemon/dist/domain/input-read-diagnostic.d.ts.map +1 -0
  122. package/daemon/dist/domain/input-read-diagnostic.js +32 -0
  123. package/daemon/dist/domain/input-read-diagnostic.js.map +1 -0
  124. package/daemon/dist/domain/native-model-picker.d.ts +8 -0
  125. package/daemon/dist/domain/native-model-picker.d.ts.map +1 -0
  126. package/daemon/dist/domain/native-model-picker.js +35 -0
  127. package/daemon/dist/domain/native-model-picker.js.map +1 -0
  128. package/daemon/dist/domain/native-process-lineage.d.ts +6 -0
  129. package/daemon/dist/domain/native-process-lineage.d.ts.map +1 -1
  130. package/daemon/dist/domain/native-process-lineage.js +34 -29
  131. package/daemon/dist/domain/native-process-lineage.js.map +1 -1
  132. package/daemon/dist/domain/native-resume-probe.d.ts +6 -0
  133. package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
  134. package/daemon/dist/domain/native-resume-probe.js +124 -2
  135. package/daemon/dist/domain/native-resume-probe.js.map +1 -1
  136. package/daemon/dist/domain/network/network-bindings.d.ts +32 -2
  137. package/daemon/dist/domain/network/network-bindings.d.ts.map +1 -1
  138. package/daemon/dist/domain/network/network-bindings.js +65 -28
  139. package/daemon/dist/domain/network/network-bindings.js.map +1 -1
  140. package/daemon/dist/domain/network/network-installations.d.ts +97 -0
  141. package/daemon/dist/domain/network/network-installations.d.ts.map +1 -0
  142. package/daemon/dist/domain/network/network-installations.js +371 -0
  143. package/daemon/dist/domain/network/network-installations.js.map +1 -0
  144. package/daemon/dist/domain/operation-correlation.d.ts +1 -1
  145. package/daemon/dist/domain/operation-correlation.d.ts.map +1 -1
  146. package/daemon/dist/domain/operation-correlation.js +1 -1
  147. package/daemon/dist/domain/operation-correlation.js.map +1 -1
  148. package/daemon/dist/domain/process-observation-pass.d.ts +20 -0
  149. package/daemon/dist/domain/process-observation-pass.d.ts.map +1 -0
  150. package/daemon/dist/domain/process-observation-pass.js +80 -0
  151. package/daemon/dist/domain/process-observation-pass.js.map +1 -0
  152. package/daemon/dist/domain/queue-erasure.d.ts +10 -6
  153. package/daemon/dist/domain/queue-erasure.d.ts.map +1 -1
  154. package/daemon/dist/domain/queue-erasure.js +31 -18
  155. package/daemon/dist/domain/queue-erasure.js.map +1 -1
  156. package/daemon/dist/domain/queue-recovery.d.ts +10 -1
  157. package/daemon/dist/domain/queue-recovery.d.ts.map +1 -1
  158. package/daemon/dist/domain/queue-recovery.js +25 -3
  159. package/daemon/dist/domain/queue-recovery.js.map +1 -1
  160. package/daemon/dist/domain/queue-repository.d.ts +23 -2
  161. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  162. package/daemon/dist/domain/queue-repository.js +77 -4
  163. package/daemon/dist/domain/queue-repository.js.map +1 -1
  164. package/daemon/dist/domain/queue-retention.d.ts +1 -1
  165. package/daemon/dist/domain/queue-retention.d.ts.map +1 -1
  166. package/daemon/dist/domain/queue-retention.js +1 -0
  167. package/daemon/dist/domain/queue-retention.js.map +1 -1
  168. package/daemon/dist/domain/queue-stuck-sweep.d.ts +5 -0
  169. package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
  170. package/daemon/dist/domain/queue-stuck-sweep.js +335 -50
  171. package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
  172. package/daemon/dist/domain/receiver-context.d.ts.map +1 -1
  173. package/daemon/dist/domain/receiver-context.js +3 -2
  174. package/daemon/dist/domain/receiver-context.js.map +1 -1
  175. package/daemon/dist/domain/restore-guidance.d.ts +3 -0
  176. package/daemon/dist/domain/restore-guidance.d.ts.map +1 -1
  177. package/daemon/dist/domain/restore-guidance.js +5 -0
  178. package/daemon/dist/domain/restore-guidance.js.map +1 -1
  179. package/daemon/dist/domain/restore-orchestrator.d.ts +6 -0
  180. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  181. package/daemon/dist/domain/restore-orchestrator.js +69 -5
  182. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  183. package/daemon/dist/domain/restore-preconditions.d.ts.map +1 -1
  184. package/daemon/dist/domain/restore-preconditions.js +2 -1
  185. package/daemon/dist/domain/restore-preconditions.js.map +1 -1
  186. package/daemon/dist/domain/rigspec-instantiator.d.ts +1 -0
  187. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  188. package/daemon/dist/domain/rigspec-instantiator.js +1 -1
  189. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  190. package/daemon/dist/domain/rosters.d.ts +2 -1
  191. package/daemon/dist/domain/rosters.d.ts.map +1 -1
  192. package/daemon/dist/domain/rosters.js.map +1 -1
  193. package/daemon/dist/domain/runtime-adapter.d.ts +9 -0
  194. package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
  195. package/daemon/dist/domain/runtime-adapter.js +2 -0
  196. package/daemon/dist/domain/runtime-adapter.js.map +1 -1
  197. package/daemon/dist/domain/seat-delivery-guard.d.ts +3 -1
  198. package/daemon/dist/domain/seat-delivery-guard.d.ts.map +1 -1
  199. package/daemon/dist/domain/seat-delivery-guard.js +8 -5
  200. package/daemon/dist/domain/seat-delivery-guard.js.map +1 -1
  201. package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
  202. package/daemon/dist/domain/seat-handover-service.js +20 -2
  203. package/daemon/dist/domain/seat-handover-service.js.map +1 -1
  204. package/daemon/dist/domain/session-transport.d.ts +2 -0
  205. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  206. package/daemon/dist/domain/session-transport.js +37 -6
  207. package/daemon/dist/domain/session-transport.js.map +1 -1
  208. package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
  209. package/daemon/dist/domain/startup-orchestrator.js +8 -3
  210. package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
  211. package/daemon/dist/domain/team-operations.d.ts +20 -0
  212. package/daemon/dist/domain/team-operations.d.ts.map +1 -0
  213. package/daemon/dist/domain/team-operations.js +23 -0
  214. package/daemon/dist/domain/team-operations.js.map +1 -0
  215. package/daemon/dist/domain/terminal/herdr-adapter.d.ts +12 -2
  216. package/daemon/dist/domain/terminal/herdr-adapter.d.ts.map +1 -1
  217. package/daemon/dist/domain/terminal/herdr-adapter.js +52 -2
  218. package/daemon/dist/domain/terminal/herdr-adapter.js.map +1 -1
  219. package/daemon/dist/domain/terminal/herdr-live-workspace.d.ts +42 -0
  220. package/daemon/dist/domain/terminal/herdr-live-workspace.d.ts.map +1 -0
  221. package/daemon/dist/domain/terminal/herdr-live-workspace.js +118 -0
  222. package/daemon/dist/domain/terminal/herdr-live-workspace.js.map +1 -0
  223. package/daemon/dist/domain/terminal/herdr-sessions.d.ts.map +1 -1
  224. package/daemon/dist/domain/terminal/herdr-sessions.js +3 -0
  225. package/daemon/dist/domain/terminal/herdr-sessions.js.map +1 -1
  226. package/daemon/dist/domain/terminal/rex-adapter.d.ts +3 -0
  227. package/daemon/dist/domain/terminal/rex-adapter.d.ts.map +1 -1
  228. package/daemon/dist/domain/terminal/rex-adapter.js +10 -1
  229. package/daemon/dist/domain/terminal/rex-adapter.js.map +1 -1
  230. package/daemon/dist/domain/terminal/rex-agent-status.d.ts +76 -0
  231. package/daemon/dist/domain/terminal/rex-agent-status.d.ts.map +1 -0
  232. package/daemon/dist/domain/terminal/rex-agent-status.js +168 -0
  233. package/daemon/dist/domain/terminal/rex-agent-status.js.map +1 -0
  234. package/daemon/dist/domain/terminal/terminal-provider.d.ts +12 -1
  235. package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
  236. package/daemon/dist/domain/terminal/terminal-service.d.ts +2 -0
  237. package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
  238. package/daemon/dist/domain/terminal/terminal-service.js +3 -2
  239. package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
  240. package/daemon/dist/domain/types.d.ts +9 -0
  241. package/daemon/dist/domain/types.d.ts.map +1 -1
  242. package/daemon/dist/domain/types.js.map +1 -1
  243. package/daemon/dist/domain/user-settings/settings-browser.d.ts +8 -2
  244. package/daemon/dist/domain/user-settings/settings-browser.d.ts.map +1 -1
  245. package/daemon/dist/domain/user-settings/settings-browser.js +5 -2
  246. package/daemon/dist/domain/user-settings/settings-browser.js.map +1 -1
  247. package/daemon/dist/domain/user-settings/settings-store.d.ts +15 -1
  248. package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
  249. package/daemon/dist/domain/user-settings/settings-store.js +108 -44
  250. package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
  251. package/daemon/dist/domain/workflow-exception-escalation.d.ts.map +1 -1
  252. package/daemon/dist/domain/workflow-exception-escalation.js +4 -2
  253. package/daemon/dist/domain/workflow-exception-escalation.js.map +1 -1
  254. package/daemon/dist/domain/workflow-validator.d.ts.map +1 -1
  255. package/daemon/dist/domain/workflow-validator.js +16 -0
  256. package/daemon/dist/domain/workflow-validator.js.map +1 -1
  257. package/daemon/dist/herdr-live-workspace-surface.d.ts +2 -0
  258. package/daemon/dist/herdr-live-workspace-surface.d.ts.map +1 -0
  259. package/daemon/dist/herdr-live-workspace-surface.js +2 -0
  260. package/daemon/dist/herdr-live-workspace-surface.js.map +1 -0
  261. package/daemon/dist/index.d.ts.map +1 -1
  262. package/daemon/dist/index.js +1 -0
  263. package/daemon/dist/index.js.map +1 -1
  264. package/daemon/dist/routes/attention.d.ts.map +1 -1
  265. package/daemon/dist/routes/attention.js +5 -1
  266. package/daemon/dist/routes/attention.js.map +1 -1
  267. package/daemon/dist/routes/hosts.d.ts.map +1 -1
  268. package/daemon/dist/routes/hosts.js +23 -14
  269. package/daemon/dist/routes/hosts.js.map +1 -1
  270. package/daemon/dist/routes/network.d.ts +7 -3
  271. package/daemon/dist/routes/network.d.ts.map +1 -1
  272. package/daemon/dist/routes/network.js +52 -17
  273. package/daemon/dist/routes/network.js.map +1 -1
  274. package/daemon/dist/routes/queue.d.ts.map +1 -1
  275. package/daemon/dist/routes/queue.js +9 -0
  276. package/daemon/dist/routes/queue.js.map +1 -1
  277. package/daemon/dist/routes/rigspec.js +13 -4
  278. package/daemon/dist/routes/rigspec.js.map +1 -1
  279. package/daemon/dist/routes/sessions.d.ts.map +1 -1
  280. package/daemon/dist/routes/sessions.js +24 -5
  281. package/daemon/dist/routes/sessions.js.map +1 -1
  282. package/daemon/dist/routes/terminal.js +1 -1
  283. package/daemon/dist/routes/terminal.js.map +1 -1
  284. package/daemon/dist/server.d.ts +1 -0
  285. package/daemon/dist/server.d.ts.map +1 -1
  286. package/daemon/dist/server.js +2 -0
  287. package/daemon/dist/server.js.map +1 -1
  288. package/daemon/dist/startup.d.ts.map +1 -1
  289. package/daemon/dist/startup.js +19 -5
  290. package/daemon/dist/startup.js.map +1 -1
  291. package/daemon/dist/tmux-server-start-surface.d.ts +2 -0
  292. package/daemon/dist/tmux-server-start-surface.d.ts.map +1 -0
  293. package/daemon/dist/tmux-server-start-surface.js +2 -0
  294. package/daemon/dist/tmux-server-start-surface.js.map +1 -0
  295. package/daemon/dist/tmux-server-start.d.ts +13 -0
  296. package/daemon/dist/tmux-server-start.d.ts.map +1 -0
  297. package/daemon/dist/tmux-server-start.js +36 -0
  298. package/daemon/dist/tmux-server-start.js.map +1 -0
  299. package/daemon/docs/reference/agent-startup-guide.md +34 -7
  300. package/daemon/docs/reference/agent-state-taxonomy.md +2 -1
  301. package/daemon/docs/reference/daemon-http-clients.md +42 -0
  302. package/daemon/docs/reference/getting-started.md +13 -8
  303. package/daemon/docs/reference/hosted-members.md +29 -3
  304. package/daemon/docs/reference/network-connector.md +76 -5
  305. package/daemon/docs/reference/operation-correlation.md +18 -2
  306. package/daemon/docs/reference/queue-erasure.md +7 -5
  307. package/daemon/docs/reference/quickstart.md +2 -2
  308. package/daemon/docs/reference/rig-spec.md +4 -0
  309. package/daemon/docs/reference/seat-delivery.md +16 -1
  310. package/daemon/docs/reference/terminal-sessions.md +12 -0
  311. package/daemon/docs/reference/tmux-servers.md +8 -2
  312. package/daemon/docs/reference/whats-new.md +153 -15
  313. package/daemon/specs/agents/shared/skills/core/working-with-an-openrig-team/SKILL.md +7 -0
  314. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +27 -11
  315. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/startup/context.md +11 -3
  316. package/dist/build-info.js +3 -3
  317. package/dist/commands/broadcast.js +7 -3
  318. package/dist/commands/broadcast.js.map +1 -1
  319. package/dist/commands/chatroom.d.ts.map +1 -1
  320. package/dist/commands/chatroom.js +8 -3
  321. package/dist/commands/chatroom.js.map +1 -1
  322. package/dist/commands/config.d.ts.map +1 -1
  323. package/dist/commands/config.js +50 -10
  324. package/dist/commands/config.js.map +1 -1
  325. package/dist/commands/daemon.d.ts +0 -4
  326. package/dist/commands/daemon.d.ts.map +1 -1
  327. package/dist/commands/daemon.js +1 -19
  328. package/dist/commands/daemon.js.map +1 -1
  329. package/dist/commands/doctor.js +1 -1
  330. package/dist/commands/doctor.js.map +1 -1
  331. package/dist/commands/down.d.ts.map +1 -1
  332. package/dist/commands/down.js +2 -1
  333. package/dist/commands/down.js.map +1 -1
  334. package/dist/commands/gateway.d.ts.map +1 -1
  335. package/dist/commands/gateway.js +5 -0
  336. package/dist/commands/gateway.js.map +1 -1
  337. package/dist/commands/host.js +2 -2
  338. package/dist/commands/host.js.map +1 -1
  339. package/dist/commands/import.d.ts.map +1 -1
  340. package/dist/commands/import.js +96 -3
  341. package/dist/commands/import.js.map +1 -1
  342. package/dist/commands/network.d.ts.map +1 -1
  343. package/dist/commands/network.js +72 -17
  344. package/dist/commands/network.js.map +1 -1
  345. package/dist/commands/ps.d.ts.map +1 -1
  346. package/dist/commands/ps.js +44 -0
  347. package/dist/commands/ps.js.map +1 -1
  348. package/dist/commands/queue.d.ts.map +1 -1
  349. package/dist/commands/queue.js +61 -3
  350. package/dist/commands/queue.js.map +1 -1
  351. package/dist/commands/roster.d.ts +2 -4
  352. package/dist/commands/roster.d.ts.map +1 -1
  353. package/dist/commands/roster.js +3 -12
  354. package/dist/commands/roster.js.map +1 -1
  355. package/dist/commands/seat.js +2 -2
  356. package/dist/commands/seat.js.map +1 -1
  357. package/dist/commands/send.d.ts +4 -0
  358. package/dist/commands/send.d.ts.map +1 -1
  359. package/dist/commands/send.js +6 -1
  360. package/dist/commands/send.js.map +1 -1
  361. package/dist/commands/setup.js +1 -1
  362. package/dist/commands/setup.js.map +1 -1
  363. package/dist/commands/terminal.d.ts.map +1 -1
  364. package/dist/commands/terminal.js +9 -7
  365. package/dist/commands/terminal.js.map +1 -1
  366. package/dist/config-store.d.ts +14 -1
  367. package/dist/config-store.d.ts.map +1 -1
  368. package/dist/config-store.js +34 -5
  369. package/dist/config-store.js.map +1 -1
  370. package/dist/lib/check-in.d.ts +7 -0
  371. package/dist/lib/check-in.d.ts.map +1 -0
  372. package/dist/lib/check-in.js +13 -0
  373. package/dist/lib/check-in.js.map +1 -0
  374. package/dist/mcp-http.d.ts.map +1 -1
  375. package/dist/mcp-http.js +25 -2
  376. package/dist/mcp-http.js.map +1 -1
  377. package/dist/mcp-server.d.ts +12 -1
  378. package/dist/mcp-server.d.ts.map +1 -1
  379. package/dist/mcp-server.js +185 -57
  380. package/dist/mcp-server.js.map +1 -1
  381. package/dist/person-registration-offer.d.ts +10 -0
  382. package/dist/person-registration-offer.d.ts.map +1 -0
  383. package/dist/person-registration-offer.js +25 -0
  384. package/dist/person-registration-offer.js.map +1 -0
  385. package/dist/terminal-window.d.ts.map +1 -1
  386. package/dist/terminal-window.js +20 -102
  387. package/dist/terminal-window.js.map +1 -1
  388. package/dist/tmux-attachment.d.ts.map +1 -1
  389. package/dist/tmux-attachment.js +3 -1
  390. package/dist/tmux-attachment.js.map +1 -1
  391. package/package.json +1 -1
  392. package/tui/dist/config/pairing.d.ts.map +1 -1
  393. package/tui/dist/config/pairing.js +8 -3
  394. package/tui/dist/config/pairing.js.map +1 -1
  395. package/tui/dist/connected-assistants.d.ts +20 -0
  396. package/tui/dist/connected-assistants.d.ts.map +1 -0
  397. package/tui/dist/connected-assistants.js +51 -0
  398. package/tui/dist/connected-assistants.js.map +1 -0
  399. package/tui/dist/daemon-client.d.ts +8 -0
  400. package/tui/dist/daemon-client.d.ts.map +1 -1
  401. package/tui/dist/daemon-client.js +8 -0
  402. package/tui/dist/daemon-client.js.map +1 -1
  403. package/tui/dist/hydrate.d.ts.map +1 -1
  404. package/tui/dist/hydrate.js +13 -2
  405. package/tui/dist/hydrate.js.map +1 -1
  406. package/tui/dist/render.d.ts.map +1 -1
  407. package/tui/dist/render.js +4 -0
  408. package/tui/dist/render.js.map +1 -1
  409. package/tui/dist/topology/glyphs.d.ts.map +1 -1
  410. package/tui/dist/topology/glyphs.js +4 -0
  411. package/tui/dist/topology/glyphs.js.map +1 -1
  412. package/tui/dist/types.d.ts +11 -0
  413. package/tui/dist/types.d.ts.map +1 -1
@@ -0,0 +1,371 @@
1
+ import { randomBytes } from "node:crypto";
2
+ import { existsSync, renameSync, rmSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { NetworkBindingError, readPrivateToken, writePrivateToken } from "./network-bindings.js";
5
+ const project = (row) => ({
6
+ id: row.id, site: row.site, installationId: row.installation_id, name: row.name, allowHttp: row.allow_http === 1, createdAt: row.created_at,
7
+ });
8
+ /** Where the installation key lives: `<home>/network-secrets/<installation>/key.json`, private to this user. */
9
+ export function networkInstallationKeyFile(home, id) {
10
+ if (!/^neti-[0-9a-f]{20}$/.test(id))
11
+ throw new NetworkBindingError("invalid_installation_id", `'${id}' isn't a network installation id.`);
12
+ return join(home, "network-secrets", id, "key.json");
13
+ }
14
+ const NAME = /^[a-z0-9](?:[a-z0-9-]{0,30}[a-z0-9])?$/;
15
+ /** The state reason of a binding a replaced enrollment ended: its name belongs to the old installation. */
16
+ export const REPLACED_REASON = "replaced by a new enrollment";
17
+ /** What's known about the account's side of an ended binding made through it: confirmed dropped, unconfirmed (a removal
18
+ * that failed or whose answer was lost), or left with an earlier account installation after the enrollment was replaced,
19
+ * which this daemon's key can neither drop nor confirm. `accountInstallationNow` is the account's id for the binding's
20
+ * enrollment as it is now. */
21
+ export function accountRemoval(binding, accountInstallationNow) {
22
+ if (!binding.installationId || binding.state === "active")
23
+ return null;
24
+ if (binding.accountRemovedAt)
25
+ return "confirmed";
26
+ // The hub refused its credential, so nothing live is left there.
27
+ if (binding.state === "revoked")
28
+ return null;
29
+ if (binding.accountInstallationId !== accountInstallationNow)
30
+ return "old-installation";
31
+ return "unconfirmed";
32
+ }
33
+ /** The command's time with the account ran out before a call was sent. */
34
+ class NotSent extends NetworkBindingError {
35
+ }
36
+ /** How long one enroll, connect or disconnect may spend with the account in all, waiting for its turn included. */
37
+ export const ACCOUNT_DEADLINE_MS = 30_000;
38
+ /** One change at a time to an installation's participant list, across the stores each request makes. */
39
+ const listTurns = new Map();
40
+ async function inListTurn(installationId, run) {
41
+ const before = listTurns.get(installationId) ?? Promise.resolve();
42
+ let release;
43
+ const mine = new Promise((resolve) => { release = resolve; });
44
+ const chain = before.then(() => mine);
45
+ listTurns.set(installationId, chain);
46
+ try {
47
+ await before;
48
+ return await run();
49
+ }
50
+ finally {
51
+ release();
52
+ if (listTurns.get(installationId) === chain)
53
+ listTurns.delete(installationId);
54
+ }
55
+ }
56
+ export class NetworkInstallationStore {
57
+ db;
58
+ home;
59
+ opts;
60
+ fetch;
61
+ constructor(db, home, opts) {
62
+ this.db = db;
63
+ this.home = home;
64
+ this.opts = opts;
65
+ this.fetch = opts.fetch ?? ((url, init) => fetch(url, init));
66
+ }
67
+ list() {
68
+ return this.db.prepare("SELECT * FROM network_installations ORDER BY created_at, id").all().map(project);
69
+ }
70
+ /** Trade the account page's one-time code for this installation's key. The code is checked by the account only, so a
71
+ * refused enroll here (a URL, a second enroll at the same site without `replace`) never spends it. With `replace`, the
72
+ * installation's turn comes first, so its wait counts against the same deadline: a wait that runs out sends no code,
73
+ * and the new key takes the old one's place only after the account accepted the new code. */
74
+ async enroll(bindings, input) {
75
+ const code = typeof input.code === "string" ? input.code.trim() : "";
76
+ if (!code || /\s/.test(code))
77
+ throw new NetworkBindingError("invalid_code", "Give the one-time code the account page shows.");
78
+ const site = validSite(input.site, input.allowHttp === true);
79
+ const existing = this.db.prepare("SELECT * FROM network_installations WHERE site = ?").get(site);
80
+ if (existing && input.replace !== true) {
81
+ throw new NetworkBindingError("already_enrolled", `This daemon is already enrolled at ${site} (${existing.id}). To enroll again with a new code, add --replace.`, 409);
82
+ }
83
+ const instance = this.instance();
84
+ const until = this.deadline();
85
+ const allowHttp = input.allowHttp === true ? 1 : 0;
86
+ if (existing) {
87
+ return inListTurn(existing.id, async () => {
88
+ const next = await this.exchange(site, code, instance, until);
89
+ return this.replace(bindings, this.get(existing.id), next.installation, next.key, allowHttp);
90
+ });
91
+ }
92
+ const { installation, key } = await this.exchange(site, code, instance, until);
93
+ const id = this.opts.newId?.() ?? `neti-${randomBytes(10).toString("hex")}`;
94
+ const cleanup = writePrivateToken(networkInstallationKeyFile(this.home, id), key);
95
+ try {
96
+ this.db.prepare("INSERT INTO network_installations (id, site, installation_id, name, allow_http, created_at) VALUES (?, ?, ?, ?, ?, ?)")
97
+ .run(id, site, installation.id, installation.name, allowHttp, (this.opts.now?.() ?? new Date()).toISOString());
98
+ }
99
+ catch (error) {
100
+ cleanup();
101
+ throw error;
102
+ }
103
+ return this.get(id);
104
+ }
105
+ /** The code, with this daemon's host id, for an account installation and its key. */
106
+ async exchange(site, code, instance, until) {
107
+ let answer;
108
+ try {
109
+ answer = await this.call(site, "POST", "/api/connector/enroll", null, { code, instance }, until);
110
+ }
111
+ catch (error) {
112
+ if (error instanceof NotSent)
113
+ throw new NetworkBindingError(error.code, `${error.message} The code wasn't sent, so it's still good while it's current: try again.`, 503);
114
+ if (error instanceof NetworkBindingError && error.code === "account_unavailable") {
115
+ throw new NetworkBindingError("account_unavailable", `${error.message} Whether the account took the code is unknown: try again with the same code, and if it's refused, get a new one.`, 503);
116
+ }
117
+ throw error;
118
+ }
119
+ if (answer.status !== 200) {
120
+ const error = errorCode(answer.body);
121
+ if (answer.status === 400 || answer.status === 409) {
122
+ throw new NetworkBindingError(error ?? "enroll_refused", `The account refused the code (${error ?? answer.status}). Get a new one from the account page; each is single-use and short-lived.`, answer.status);
123
+ }
124
+ throw new NetworkBindingError("account_unavailable", `The account couldn't answer (${answer.status}). If the code is still current, try again with it; otherwise get a new one.`, 503);
125
+ }
126
+ const body = (answer.body ?? {});
127
+ if (typeof body.installation?.id !== "string" || typeof body.key !== "string" || !body.key || /\s/.test(body.key)) {
128
+ throw new NetworkBindingError("account_unexpected", "The account's answer to the enroll had no installation or key.", 502);
129
+ }
130
+ return { installation: { id: body.installation.id, name: typeof body.installation.name === "string" ? body.installation.name : null }, key: body.key };
131
+ }
132
+ /** The new key goes in beside the old one and takes its place, then the row and the old installation's active bindings
133
+ * change in one transaction. A failure before that commits puts the old key back (with no old key, it removes the new
134
+ * one), so nothing here changes, though the account has already made the new installation and nothing here holds its
135
+ * key. After the commit the replace has happened: the ended bindings' names are returned, since the old installation
136
+ * may still list them and this key can't drop them, with any cleanup that didn't finish. */
137
+ replace(bindings, old, next, key, allowHttp) {
138
+ const file = networkInstallationKeyFile(this.home, old.id);
139
+ const staged = `${file}.next`;
140
+ const kept = `${file}.prev`;
141
+ const ending = bindings.active().filter((b) => b.installationId === old.id);
142
+ rmSync(staged, { force: true });
143
+ const cleanup = writePrivateToken(staged, key);
144
+ const hadKey = existsSync(file);
145
+ try {
146
+ if (hadKey)
147
+ renameSync(file, kept);
148
+ renameSync(staged, file);
149
+ this.db.transaction(() => {
150
+ this.db.prepare("UPDATE network_installations SET installation_id = ?, name = ?, allow_http = ? WHERE id = ?").run(next.id, next.name, allowHttp, old.id);
151
+ bindings.markDisconnected(ending.map((b) => b.id), REPLACED_REASON);
152
+ })();
153
+ }
154
+ catch (error) {
155
+ if (!hadKey)
156
+ rmSync(file, { force: true });
157
+ else if (existsSync(kept))
158
+ renameSync(kept, file);
159
+ cleanup();
160
+ throw new NetworkBindingError("replace_failed", `The account accepted the new code, but this daemon couldn't switch to it (${error.message.slice(0, 200)}), so nothing here changed. The account now has a new installation whose key nothing here holds: remove it on the account page, then enroll again with a new code.`, 500);
161
+ }
162
+ const problems = [];
163
+ try {
164
+ rmSync(kept, { force: true });
165
+ }
166
+ catch (error) {
167
+ problems.push(`The earlier key's backup at ${kept} couldn't be removed (${error.message.slice(0, 200)}). It's no longer used; remove it by hand.`);
168
+ }
169
+ for (const binding of ending) {
170
+ // Already ended in the transaction; this removes its credential, and a failure says how to retry.
171
+ try {
172
+ bindings.disconnect(binding.id, REPLACED_REASON);
173
+ }
174
+ catch (error) {
175
+ problems.push(error.message);
176
+ }
177
+ }
178
+ return { ...this.get(old.id), replaced: { endedBindings: ending.map((b) => ({ id: b.id, localSession: b.localSession, participantName: b.participantName })),
179
+ ...(problems.length ? { problems } : {}) } };
180
+ }
181
+ /** The one installation a name-only connect goes through. */
182
+ only() {
183
+ const all = this.list();
184
+ if (all.length === 0)
185
+ throw new NetworkBindingError("not_enrolled", "This daemon isn't enrolled in an account. Run rig network enroll <code> --site <site> first, or connect with --hub and --token-file.", 404);
186
+ if (all.length > 1)
187
+ throw new NetworkBindingError("installation_ambiguous", "This daemon is enrolled at more than one site; connect with --hub and --token-file.", 409);
188
+ return all[0];
189
+ }
190
+ /** Connect a seat as a participant name: list it with the account, then bind to the account's MCP front with the new
191
+ * bearer. The seat is checked first, so a refusal here sends nothing. A name the account keeps without a bearer had
192
+ * its answer lost earlier: it's dropped and listed again for a fresh one. */
193
+ async connect(bindings, input) {
194
+ const installation = this.only();
195
+ bindings.freeSeat(input.session);
196
+ const name = typeof input.name === "string" ? input.name.trim() : "";
197
+ if (!NAME.test(name))
198
+ throw new NetworkBindingError("invalid_name", `'${name}' isn't a participant name: lowercase letters, digits and inner dashes, up to 32.`);
199
+ const until = this.deadline();
200
+ return inListTurn(installation.id, async () => {
201
+ // In this installation's turn: checked again, with the enrollment as it is now (a replace may have run while this
202
+ // waited), and every list sent reads the names to keep afresh.
203
+ const current = this.get(installation.id);
204
+ bindings.freeSeat(input.session);
205
+ if (this.listedNames(bindings, current).includes(name))
206
+ throw new NetworkBindingError("participant_already_connected", `${name} is already connected here.`, 409);
207
+ const others = () => this.listedNames(bindings, current).filter((n) => n !== name);
208
+ let answer = await this.setParticipants(bindings, current, () => [...others(), name], until);
209
+ let bearer = answer.participants.find((p) => p.name === name)?.bearer;
210
+ if (!bearer) {
211
+ await this.setParticipants(bindings, current, others, until);
212
+ answer = await this.setParticipants(bindings, current, () => [...others(), name], until);
213
+ bearer = answer.participants.find((p) => p.name === name)?.bearer;
214
+ if (!bearer)
215
+ throw new NetworkBindingError("account_unexpected", `The account listed ${name} without a bearer, twice.`, 502);
216
+ }
217
+ try {
218
+ return bindings.create({ session: input.session, hubUrl: answer.mcp, hubSeat: `${name}@${answer.rig}`, token: bearer,
219
+ allowHttp: current.allowHttp, installation: { id: current.id, name, account: current.installationId } });
220
+ }
221
+ catch (error) {
222
+ // Best effort: nothing here holds that bearer, so the account is asked to stop listing the name. If that fails,
223
+ // the error says so, whatever failed here; the account may still list it.
224
+ let unconfirmed = "";
225
+ try {
226
+ await this.setParticipants(bindings, current, others, until);
227
+ }
228
+ catch (drop) {
229
+ unconfirmed = ` OpenRig couldn't confirm the account dropped ${name} again (${drop.message}); it may still list it.`;
230
+ }
231
+ if (!unconfirmed)
232
+ throw error;
233
+ if (error instanceof NetworkBindingError)
234
+ throw new NetworkBindingError(error.code, `${error.message}${unconfirmed}`, error.status);
235
+ throw new NetworkBindingError("binding_write_failed", `The binding couldn't be saved here (${error.message.slice(0, 200)}).${unconfirmed}`, 500);
236
+ }
237
+ });
238
+ }
239
+ /** After a binding made through the account ended here, the account stops listing its name, which revokes it there.
240
+ * Only an answered list that no longer has the name marks it removed; a failed or lost one leaves it unconfirmed. */
241
+ async removeAtAccount(bindings, binding) {
242
+ const installation = this.list().find((i) => i.id === binding.installationId);
243
+ if (!installation || accountRemoval(binding, installation.installationId) !== "unconfirmed")
244
+ return binding;
245
+ const until = this.deadline();
246
+ return inListTurn(installation.id, async () => {
247
+ // A replace while this waited moved the enrollment to another account installation, which can't drop this name.
248
+ const current = this.get(installation.id);
249
+ if (accountRemoval(binding, current.installationId) !== "unconfirmed")
250
+ return bindings.get(binding.id);
251
+ try {
252
+ await this.setParticipants(bindings, current, () => this.listedNames(bindings, current), until);
253
+ }
254
+ catch (error) {
255
+ throw new NetworkBindingError("account_update_unconfirmed", `${binding.id} is ${binding.state} here, but OpenRig couldn't confirm that the account dropped ${binding.participantName} (${error.message}). Run \`rig network disconnect ${binding.id}\` again.`, 502);
256
+ }
257
+ return bindings.get(binding.id);
258
+ });
259
+ }
260
+ /** `accountRemoval` against this binding's enrollment as it is now. */
261
+ removalOf(binding) {
262
+ const now = binding.installationId ? this.list().find((i) => i.id === binding.installationId) : undefined;
263
+ return accountRemoval(binding, now?.installationId);
264
+ }
265
+ get(id) {
266
+ return project(this.db.prepare("SELECT * FROM network_installations WHERE id = ?").get(id));
267
+ }
268
+ listedNames(bindings, installation) {
269
+ return bindings.active().filter((b) => b.installationId === installation.id && b.participantName).map((b) => b.participantName);
270
+ }
271
+ instance() {
272
+ const instance = this.opts.selfHostId();
273
+ if (!instance)
274
+ throw new NetworkBindingError("instance_unknown", "This daemon hasn't resolved its host id yet. Try again once it's fully up.", 503);
275
+ return instance;
276
+ }
277
+ deadline() {
278
+ return Date.now() + (this.opts.timeoutMs ?? ACCOUNT_DEADLINE_MS);
279
+ }
280
+ async setParticipants(bindings, installation, names, until) {
281
+ const instance = this.instance();
282
+ const repair = `Get a new code from the account page and run rig network enroll <code> --site ${installation.site} --replace.`;
283
+ const key = readPrivateToken(networkInstallationKeyFile(this.home, installation.id), (file) => `The installation key for ${installation.id} isn't at ${file}. ${repair}`);
284
+ const put = () => this.call(installation.site, "PUT", "/api/connector/identities", key, { instance, participants: names() }, until);
285
+ let answer = await put();
286
+ // The account couldn't apply a drop while something else changed this installation: the list is read and sent once more.
287
+ if (answer.status === 409 && errorCode(answer.body) === "drop_failed")
288
+ answer = await put();
289
+ if (answer.status !== 200) {
290
+ const error = errorCode(answer.body);
291
+ if (answer.status === 409 && error === "drop_failed") {
292
+ throw new NetworkBindingError("account_busy", "The account was changing this installation's participants at the same time. Try again.", 503);
293
+ }
294
+ if (answer.status === 409)
295
+ throw new NetworkBindingError(error ?? "name_taken", "Another connection to the account already uses that name. Choose another.", 409);
296
+ if (answer.status === 401)
297
+ throw new NetworkBindingError(error ?? "not_enrolled", `The account doesn't recognize this installation any more. ${repair}`, 401);
298
+ if (answer.status === 400)
299
+ throw new NetworkBindingError(error ?? "bad_names", "The account refused the participant names.", 400);
300
+ throw new NetworkBindingError("account_unavailable", `The account couldn't answer (${answer.status}). Try again.`, 503);
301
+ }
302
+ const body = (answer.body ?? {});
303
+ if (!Array.isArray(body.participants) || typeof body.mcp !== "string" || typeof body.rig !== "string") {
304
+ throw new NetworkBindingError("account_unexpected", "The account's answer had no participants, MCP front or rig.", 502);
305
+ }
306
+ // The answer is what this account installation now lists: a binding that ended while listed under it, whose name
307
+ // isn't in the answer, is confirmed dropped. A name listed under an earlier installation is never confirmed here.
308
+ const listed = new Set(body.participants.map((p) => p.name));
309
+ for (const ended of bindings.list()) {
310
+ if (ended.installationId === installation.id && ended.participantName && !listed.has(ended.participantName)
311
+ && accountRemoval(ended, installation.installationId) === "unconfirmed") {
312
+ bindings.markAccountRemoved(ended.id);
313
+ }
314
+ }
315
+ return body;
316
+ }
317
+ async call(site, method, path, key, payload, until) {
318
+ const left = until - Date.now();
319
+ if (left <= 0)
320
+ throw new NotSent("account_unavailable", `The account at ${site} wasn't reached in time: this command's time with the account ran out.`, 503);
321
+ let res;
322
+ try {
323
+ // The key goes only to the site the person enrolled at: a redirect isn't followed with it, and a stalled call ends.
324
+ res = await this.fetch(new URL(path, site).toString(), {
325
+ method,
326
+ headers: { "Content-Type": "application/json", ...(key ? { Authorization: `Bearer ${key}` } : {}) },
327
+ body: JSON.stringify(payload),
328
+ redirect: "error",
329
+ signal: AbortSignal.timeout(left),
330
+ });
331
+ }
332
+ catch (error) {
333
+ const cause = error.cause?.message;
334
+ if (typeof cause === "string" && /redirect/i.test(cause)) {
335
+ throw new NetworkBindingError("account_redirected", `The account at ${site} answered with a redirect, which isn't followed with the installation key. Use the site's own URL.`, 502);
336
+ }
337
+ throw new NetworkBindingError("account_unavailable", `The account at ${site} couldn't be reached: ${error.message.slice(0, 200)}.`, 503);
338
+ }
339
+ let body = null;
340
+ try {
341
+ body = await res.json();
342
+ }
343
+ catch { /* no JSON body */ }
344
+ return { status: res.status, body };
345
+ }
346
+ }
347
+ function errorCode(body) {
348
+ const error = body?.error;
349
+ return typeof error === "string" && /^[a-z][a-z0-9_]*$/.test(error) ? error : null;
350
+ }
351
+ /** The account's site: https, or plain http on the person's choice, with no credential in it. */
352
+ function validSite(raw, allowHttp) {
353
+ if (typeof raw !== "string" || !raw.trim())
354
+ throw new NetworkBindingError("invalid_site", "Give the account's site URL with --site.");
355
+ let url;
356
+ try {
357
+ url = new URL(raw.trim());
358
+ }
359
+ catch {
360
+ throw new NetworkBindingError("invalid_site", `'${raw}' isn't a URL.`);
361
+ }
362
+ if (url.protocol !== "https:" && url.protocol !== "http:")
363
+ throw new NetworkBindingError("invalid_site", "The site must use https (or http).");
364
+ if (url.username || url.password)
365
+ throw new NetworkBindingError("invalid_site", "The site URL can't hold a credential.");
366
+ if (url.protocol === "http:" && !allowHttp) {
367
+ throw new NetworkBindingError("http_not_allowed", `${url.origin} is plain http, so the installation key and every participant's token would cross the network unencrypted, where they can be read. Use the site's https URL, or enroll again with --allow-http to accept that.`);
368
+ }
369
+ return url.origin + "/";
370
+ }
371
+ //# sourceMappingURL=network-installations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"network-installations.js","sourceRoot":"","sources":["../../../src/domain/network/network-installations.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,iBAAiB,EAAiD,MAAM,uBAAuB,CAAC;AAoBhJ,MAAM,OAAO,GAAG,CAAC,GAAQ,EAAuB,EAAE,CAAC,CAAC;IAClD,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,CAAC,eAAe,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,UAAU,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,CAAC,UAAU;CAC5I,CAAC,CAAC;AAEH,gHAAgH;AAChH,MAAM,UAAU,0BAA0B,CAAC,IAAY,EAAE,EAAU;IACjE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,MAAM,IAAI,mBAAmB,CAAC,yBAAyB,EAAE,IAAI,EAAE,oCAAoC,CAAC,CAAC;IAC1I,OAAO,IAAI,CAAC,IAAI,EAAE,iBAAiB,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,IAAI,GAAG,wCAAwC,CAAC;AAEtD,2GAA2G;AAC3G,MAAM,CAAC,MAAM,eAAe,GAAG,8BAA8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AO,KAAK,KAAK,QAAQ,IAAI,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AACrF,CAAC;AAED,iGAAiG;AACjG,SAAS,SAAS,CAAC,GAAY,EAAE,SAAkB;IACjD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE;QAAE,MAAM,IAAI,mBAAmB,CAAC,cAAc,EAAE,0CAA0C,CAAC,CAAC;IACtI,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QAAC,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,MAAM,IAAI,mBAAmB,CAAC,cAAc,EAAE,IAAI,GAAG,gBAAgB,CAAC,CAAC;IAAC,CAAC;IACpH,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,GAAG,CAAC,QAAQ,KAAK,OAAO;QAAE,MAAM,IAAI,mBAAmB,CAAC,cAAc,EAAE,oCAAoC,CAAC,CAAC;IAC/I,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ;QAAE,MAAM,IAAI,mBAAmB,CAAC,cAAc,EAAE,uCAAuC,CAAC,CAAC;IACzH,IAAI,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC;QAC3C,MAAM,IAAI,mBAAmB,CAAC,kBAAkB,EAAE,GAAG,GAAG,CAAC,MAAM,gNAAgN,CAAC,CAAC;IACnR,CAAC;IACD,OAAO,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC;AAC1B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type Database from "better-sqlite3";
2
2
  export declare const OPERATION_CONTRACT = "operation-correlation.v1";
3
- export declare const OPERATION_KINDS: readonly ["rig.create", "rig.import", "member.add"];
3
+ export declare const OPERATION_KINDS: readonly ["rig.create", "rig.import", "rig.materialize", "member.add"];
4
4
  type OperationKind = typeof OPERATION_KINDS[number];
5
5
  export type RecordCreated = (rigId: string, nodeId?: string) => void;
6
6
  /** Accept RFC UUID versions used by clients; a missing header is an ordinary request. */
@@ -1 +1 @@
1
- {"version":3,"file":"operation-correlation.d.ts","sourceRoot":"","sources":["../../src/domain/operation-correlation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AAC7D,eAAO,MAAM,eAAe,qDAAsD,CAAC;AACnF,KAAK,aAAa,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AAGpD,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;AAErE,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAEpE;AAED,iHAAiH;AACjH,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,MAAM,EAAE,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqBR,MAAM;4BAAU,MAAM;mCAAiB,MAAM,GAAG,IAAI;;;;;;;;;;;;;;2BAa7C,MAAM,WAAW,MAAM;;;;;;;;;;;;;;;;wBAb9B,MAAM;4BAAU,MAAM;mCAAiB,MAAM,GAAG,IAAI;;;;;;EAuB5E"}
1
+ {"version":3,"file":"operation-correlation.d.ts","sourceRoot":"","sources":["../../src/domain/operation-correlation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AAC7D,eAAO,MAAM,eAAe,wEAAyE,CAAC;AACtG,KAAK,aAAa,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AAGpD,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;AAErE,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAEpE;AAED,iHAAiH;AACjH,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,MAAM,EAAE,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqBR,MAAM;4BAAU,MAAM;mCAAiB,MAAM,GAAG,IAAI;;;;;;;;;;;;;;2BAa7C,MAAM,WAAW,MAAM;;;;;;;;;;;;;;;;wBAb9B,MAAM;4BAAU,MAAM;mCAAiB,MAAM,GAAG,IAAI;;;;;;EAuB5E"}
@@ -1,6 +1,6 @@
1
1
  import { createHash } from "node:crypto";
2
2
  export const OPERATION_CONTRACT = "operation-correlation.v1";
3
- export const OPERATION_KINDS = ["rig.create", "rig.import", "member.add"];
3
+ export const OPERATION_KINDS = ["rig.create", "rig.import", "rig.materialize", "member.add"];
4
4
  /** Accept RFC UUID versions used by clients; a missing header is an ordinary request. */
5
5
  export function validOperationId(header) {
6
6
  return header === undefined || /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(header);
@@ -1 +1 @@
1
- {"version":3,"file":"operation-correlation.js","sourceRoot":"","sources":["../../src/domain/operation-correlation.ts"],"names":[],"mappings":"A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AAG,GAAG,EAAE,CAAC,OAAO,CAAC,iFAAiF,CAAC;aACtG,GAAG,CAAC,WAAW,CAA0C,CAAC;QAC7D,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,MAAM,KAAK,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAC1F,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,aAAa,CAAa,CAAC;QACtD,IAAI,MAAM,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtD,EAAE,CAAC,OAAO,CAAC,wFAAwF,CAAC;aACjG,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC,CAAC;IAClD,CAAC,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,OAAgB,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,20 @@
1
+ type Lister<Row> = () => Row[] | Promise<Row[]>;
2
+ export interface ObservationPassOpts {
3
+ freshnessMs?: number;
4
+ now?: () => number;
5
+ }
6
+ export declare class ObservationPass {
7
+ private readonly freshnessMs;
8
+ private readonly now;
9
+ private seq;
10
+ private readonly listings;
11
+ constructor(opts?: ObservationPassOpts);
12
+ /** A lister for ONE agent's checks in this pass. Create one per agent, never share it between agents: it
13
+ * remembers when its first check began and when its last listing finished. `base` is the shared listing and must reject when it fails;
14
+ * `fallback` is the agent's own read after a failed shared listing (default: `base`), so an agent keeps the
15
+ * failure behavior it has without a pass. */
16
+ lister<Row>(base: Lister<Row>, fallback?: Lister<Row>): Lister<Row>;
17
+ private listingFor;
18
+ }
19
+ export {};
20
+ //# sourceMappingURL=process-observation-pass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-observation-pass.d.ts","sourceRoot":"","sources":["../../src/domain/process-observation-pass.ts"],"names":[],"mappings":"AAoBA,KAAK,MAAM,CAAC,GAAG,IAAI,MAAM,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;AAUhD,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,GAAG,CAAK;IAChB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA8C;gBAE3D,IAAI,GAAE,mBAAwB;IAK1C;;;kDAG8C;IAC9C,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,QAAQ,GAAE,MAAM,CAAC,GAAG,CAAQ,GAAG,MAAM,CAAC,GAAG,CAAC;IAsBzE,OAAO,CAAC,UAAU;CA0BnB"}
@@ -0,0 +1,80 @@
1
+ // One process listing shared by every agent checked in one observation pass.
2
+ //
3
+ // A poll that checks several agents one after another used to start its own process listing for each agent, and
4
+ // each agent's identity proof needs two listings (`verifyCodexPaneProcess`, `verifyPaneIdleShell`: the second
5
+ // must see a later table than the first). This pass lets agents share a listing only when each agent still gets
6
+ // what its own call sequence needs:
7
+ // - ORDER: an agent's next listing must START after the listing it last received had FINISHED, so its two
8
+ // samples are two observations, never one table read twice. A later agent may start from a listing an earlier
9
+ // agent already took, but its next listing must START after its own first check began: tables taken before
10
+ // that point cannot show a change that happened since.
11
+ // - FRESHNESS: a listing older than `freshnessMs` is never reused (the same limit ProcessCensus uses).
12
+ // - HONEST FAILURE: a failed listing is never reused and never counts as success. Each agent that was
13
+ // waiting on it falls back to its own read, and that read's failure is the agent's failure. "Failed" means
14
+ // the shared lister REJECTED: an empty array is a legitimate success and is never read as a failure, so the
15
+ // shared lister must reject on a failed enumeration (the lenient listers that return [] cannot be shared).
16
+ // - SCOPE: a pass belongs to one poll. The next poll builds a new pass, so it starts with a fresh listing.
17
+ // Listings are kept per underlying lister, because different listers return different rows.
18
+ const DEFAULT_FRESHNESS_MS = 2_000;
19
+ export class ObservationPass {
20
+ freshnessMs;
21
+ now;
22
+ seq = 0;
23
+ listings = new Map();
24
+ constructor(opts = {}) {
25
+ this.freshnessMs = opts.freshnessMs ?? DEFAULT_FRESHNESS_MS;
26
+ this.now = opts.now ?? Date.now;
27
+ }
28
+ /** A lister for ONE agent's checks in this pass. Create one per agent, never share it between agents: it
29
+ * remembers when its first check began and when its last listing finished. `base` is the shared listing and must reject when it fails;
30
+ * `fallback` is the agent's own read after a failed shared listing (default: `base`), so an agent keeps the
31
+ * failure behavior it has without a pass. */
32
+ lister(base, fallback = base) {
33
+ let lastDoneSeq = 0;
34
+ let firstCallSeq = null;
35
+ return async () => {
36
+ const afterSeq = firstCallSeq === null ? 0 : Math.max(lastDoneSeq, firstCallSeq);
37
+ firstCallSeq ??= ++this.seq;
38
+ const listing = this.listingFor(base, afterSeq);
39
+ try {
40
+ const rows = await listing.rows;
41
+ lastDoneSeq = Math.max(lastDoneSeq, listing.doneSeq ?? ++this.seq);
42
+ return rows;
43
+ }
44
+ catch {
45
+ // The shared listing failed: this agent reads for itself, and that read's own failure stands.
46
+ try {
47
+ return await fallback();
48
+ }
49
+ finally {
50
+ lastDoneSeq = ++this.seq;
51
+ }
52
+ }
53
+ };
54
+ }
55
+ listingFor(base, afterSeq) {
56
+ const all = (this.listings.get(base) ?? []);
57
+ const now = this.now();
58
+ const usable = [...all].reverse().find((l) => !l.failed && l.startedSeq > afterSeq && now - l.startedAt <= this.freshnessMs);
59
+ if (usable)
60
+ return usable;
61
+ const listing = {
62
+ startedSeq: ++this.seq,
63
+ startedAt: now,
64
+ doneSeq: null,
65
+ failed: false,
66
+ rows: undefined,
67
+ };
68
+ listing.rows = new Promise((resolve) => resolve(base())).then((rows) => {
69
+ listing.doneSeq = ++this.seq;
70
+ return rows;
71
+ }, (err) => {
72
+ listing.failed = true;
73
+ listing.doneSeq = ++this.seq;
74
+ throw err;
75
+ });
76
+ this.listings.set(base, [...all.filter((l) => !l.failed), listing]);
77
+ return listing;
78
+ }
79
+ }
80
+ //# sourceMappingURL=process-observation-pass.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-observation-pass.js","sourceRoot":"","sources":["../../src/domain/process-observation-pass.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,EAAE;AACF,gHAAgH;AAChH,8GAA8G;AAC9G,gHAAgH;AAChH,oCAAoC;AACpC,4GAA4G;AAC5G,kHAAkH;AAClH,+GAA+G;AAC/G,2DAA2D;AAC3D,yGAAyG;AACzG,wGAAwG;AACxG,+GAA+G;AAC/G,gHAAgH;AAChH,+GAA+G;AAC/G,6GAA6G;AAC7G,4FAA4F;AAE5F,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAiBnC,MAAM,OAAO,eAAe;IACT,WAAW,CAAS;IACpB,GAAG,CAAe;IAC3B,GAAG,GAAG,CAAC,CAAC;IACC,QAAQ,GAAG,IAAI,GAAG,EAAmC,CAAC;IAEvE,YAAY,OAA4B,EAAE;QACxC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,oBAAoB,CAAC;QAC5D,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC;IAClC,CAAC;IAED;;;kDAG8C;IAC9C,MAAM,CAAM,IAAiB,EAAE,WAAwB,IAAI;QACzD,IAAI,WAAW,GAAG,CAAC,CAAC;QACpB,IAAI,YAAY,GAAkB,IAAI,CAAC;QACvC,OAAO,KAAK,IAAI,EAAE;YAChB,MAAM,QAAQ,GAAG,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;YACjF,YAAY,KAAK,EAAE,IAAI,CAA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AAG,IAAI,OAAO,CAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAChG,CAAC,IAAI,EAAE,EAAE;YACP,OAAO,CAAC,OAAO,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC;YAC7B,OAAO,IAAI,CAAC;QACd,CAAC,EACD,CAAC,GAAG,EAAE,EAAE;YACN,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;YACtB,OAAO,CAAC,OAAO,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC;YAC7B,MAAM,GAAG,CAAC;QACZ,CAAC,CACF,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAqB,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,CAAqB,CAAC,CAAC;QACzG,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
@@ -10,11 +10,13 @@ import type Database from "better-sqlite3";
10
10
  * The row's own copies follow it: its transitions, live and archived; events whose payload names it; its
11
11
  * mission-control audit rows. Copies another party holds (outbox and inbox entries, stream reader actions and
12
12
  * dispositions) go only when they're the owner's: both endpoints the account's (members scope) or the row's own
13
- * (other scopes). Others are kept and reported.
13
+ * (other scopes). Others are kept and reported. OpenRig's own sessions (`daemon@kernel`, `system:*`), which send its
14
+ * wakes and notices, are no one's: a row, copy or entry is judged by its other sessions, and needs one of them.
14
15
  *
15
- * Scope is exact. Account deletion takes the account's recorded membership (exact session names): a row whose two
16
- * endpoints are both members is deleted, whatever its state; a row with one member endpoint is reported as mixed and
17
- * left untouched. Named with the account's rig, it also removes the rig's own records that outlive the rig. Routine
16
+ * Scope is exact. Account deletion takes the account's recorded membership (exact session names): a row between two
17
+ * members, or between a member and OpenRig, is deleted, whatever its state; a row with one member endpoint and the
18
+ * other outside the account is reported as mixed and left untouched. Named with the account's rig, it also removes
19
+ * the rig's own records that outlive the rig. Routine
18
20
  * retention touches only closed rows (done, canceled, denied, handed-off; never failed or open work), aged from the
19
21
  * start of their final closed state. A row a workflow still references is reported, never erased.
20
22
  *
@@ -98,7 +100,8 @@ export interface EraseReport {
98
100
  action: EraseAction;
99
101
  state: string;
100
102
  }>;
101
- /** members scope: rows with exactly one member endpoint, left untouched */
103
+ /** members scope: rows with one member endpoint and the other outside the account (OpenRig's own isn't), left
104
+ * untouched */
102
105
  mixed: Array<{
103
106
  qitemId: string;
104
107
  memberEndpoint: "source" | "destination";
@@ -143,7 +146,8 @@ export interface EraseReport {
143
146
  streamActions: number;
144
147
  missionControl: number;
145
148
  };
146
- /** members scope: entries between members that no queue row owns; mixed ones are counted and left */
149
+ /** members scope: entries no queue row owns between members, or a member and OpenRig; mixed ones are counted and
150
+ * left */
147
151
  unlinked?: {
148
152
  outbox: number;
149
153
  inbox: number;
@@ -1 +1 @@
1
- {"version":3,"file":"queue-erasure.d.ts","sourceRoot":"","sources":["../../src/domain/queue-erasure.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,qGAAqG;AACrG,eAAO,MAAM,mBAAmB,uDAAwD,CAAC;AAczF,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,QAAQ,CAAC;AAC7C,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,aAAa,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,WAAW,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9F,iFAAiF;IACjF,OAAO,CAAC,EAAE,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