@openrig/cli 0.1.11 → 0.2.0

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 (543) hide show
  1. package/daemon/assets/openrig-activity-hook-relay.cjs +104 -0
  2. package/daemon/dist/adapters/claude-code-adapter.d.ts +14 -6
  3. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  4. package/daemon/dist/adapters/claude-code-adapter.js +192 -60
  5. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  6. package/daemon/dist/adapters/claude-resume.d.ts +5 -0
  7. package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
  8. package/daemon/dist/adapters/claude-resume.js +15 -2
  9. package/daemon/dist/adapters/claude-resume.js.map +1 -1
  10. package/daemon/dist/adapters/codex-resume.d.ts +8 -1
  11. package/daemon/dist/adapters/codex-resume.d.ts.map +1 -1
  12. package/daemon/dist/adapters/codex-resume.js +74 -5
  13. package/daemon/dist/adapters/codex-resume.js.map +1 -1
  14. package/daemon/dist/adapters/codex-runtime-adapter.d.ts +11 -6
  15. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  16. package/daemon/dist/adapters/codex-runtime-adapter.js +322 -34
  17. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  18. package/daemon/dist/adapters/terminal-adapter.d.ts +2 -1
  19. package/daemon/dist/adapters/terminal-adapter.d.ts.map +1 -1
  20. package/daemon/dist/adapters/terminal-adapter.js +7 -1
  21. package/daemon/dist/adapters/terminal-adapter.js.map +1 -1
  22. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  23. package/daemon/dist/adapters/tmux.js +53 -5
  24. package/daemon/dist/adapters/tmux.js.map +1 -1
  25. package/daemon/dist/db/migrations/021_seat_handover_observability.d.ts +3 -0
  26. package/daemon/dist/db/migrations/021_seat_handover_observability.d.ts.map +1 -0
  27. package/daemon/dist/db/migrations/021_seat_handover_observability.js +11 -0
  28. package/daemon/dist/db/migrations/021_seat_handover_observability.js.map +1 -0
  29. package/daemon/dist/db/migrations/022_node_codex_config_profile.d.ts +3 -0
  30. package/daemon/dist/db/migrations/022_node_codex_config_profile.d.ts.map +1 -0
  31. package/daemon/dist/db/migrations/022_node_codex_config_profile.js +7 -0
  32. package/daemon/dist/db/migrations/022_node_codex_config_profile.js.map +1 -0
  33. package/daemon/dist/db/migrations/023_stream_items.d.ts +16 -0
  34. package/daemon/dist/db/migrations/023_stream_items.d.ts.map +1 -0
  35. package/daemon/dist/db/migrations/023_stream_items.js +37 -0
  36. package/daemon/dist/db/migrations/023_stream_items.js.map +1 -0
  37. package/daemon/dist/db/migrations/024_queue_items.d.ts +19 -0
  38. package/daemon/dist/db/migrations/024_queue_items.d.ts.map +1 -0
  39. package/daemon/dist/db/migrations/024_queue_items.js +52 -0
  40. package/daemon/dist/db/migrations/024_queue_items.js.map +1 -0
  41. package/daemon/dist/db/migrations/025_queue_transitions.d.ts +13 -0
  42. package/daemon/dist/db/migrations/025_queue_transitions.d.ts.map +1 -0
  43. package/daemon/dist/db/migrations/025_queue_transitions.js +28 -0
  44. package/daemon/dist/db/migrations/025_queue_transitions.js.map +1 -0
  45. package/daemon/dist/db/migrations/026_inbox_entries.d.ts +14 -0
  46. package/daemon/dist/db/migrations/026_inbox_entries.d.ts.map +1 -0
  47. package/daemon/dist/db/migrations/026_inbox_entries.js +35 -0
  48. package/daemon/dist/db/migrations/026_inbox_entries.js.map +1 -0
  49. package/daemon/dist/db/migrations/027_outbox_entries.d.ts +12 -0
  50. package/daemon/dist/db/migrations/027_outbox_entries.d.ts.map +1 -0
  51. package/daemon/dist/db/migrations/027_outbox_entries.js +30 -0
  52. package/daemon/dist/db/migrations/027_outbox_entries.js.map +1 -0
  53. package/daemon/dist/db/migrations/028_project_classifications.d.ts +26 -0
  54. package/daemon/dist/db/migrations/028_project_classifications.d.ts.map +1 -0
  55. package/daemon/dist/db/migrations/028_project_classifications.js +44 -0
  56. package/daemon/dist/db/migrations/028_project_classifications.js.map +1 -0
  57. package/daemon/dist/db/migrations/029_classifier_leases.d.ts +22 -0
  58. package/daemon/dist/db/migrations/029_classifier_leases.d.ts.map +1 -0
  59. package/daemon/dist/db/migrations/029_classifier_leases.js +41 -0
  60. package/daemon/dist/db/migrations/029_classifier_leases.js.map +1 -0
  61. package/daemon/dist/db/migrations/030_views_custom.d.ts +15 -0
  62. package/daemon/dist/db/migrations/030_views_custom.d.ts.map +1 -0
  63. package/daemon/dist/db/migrations/030_views_custom.js +27 -0
  64. package/daemon/dist/db/migrations/030_views_custom.js.map +1 -0
  65. package/daemon/dist/db/migrations/031_watchdog_jobs.d.ts +34 -0
  66. package/daemon/dist/db/migrations/031_watchdog_jobs.d.ts.map +1 -0
  67. package/daemon/dist/db/migrations/031_watchdog_jobs.js +59 -0
  68. package/daemon/dist/db/migrations/031_watchdog_jobs.js.map +1 -0
  69. package/daemon/dist/db/migrations/032_watchdog_history.d.ts +28 -0
  70. package/daemon/dist/db/migrations/032_watchdog_history.d.ts.map +1 -0
  71. package/daemon/dist/db/migrations/032_watchdog_history.js +46 -0
  72. package/daemon/dist/db/migrations/032_watchdog_history.js.map +1 -0
  73. package/daemon/dist/db/migrations/033_workflow_specs.d.ts +30 -0
  74. package/daemon/dist/db/migrations/033_workflow_specs.d.ts.map +1 -0
  75. package/daemon/dist/db/migrations/033_workflow_specs.js +50 -0
  76. package/daemon/dist/db/migrations/033_workflow_specs.js.map +1 -0
  77. package/daemon/dist/db/migrations/034_workflow_instances.d.ts +42 -0
  78. package/daemon/dist/db/migrations/034_workflow_instances.d.ts.map +1 -0
  79. package/daemon/dist/db/migrations/034_workflow_instances.js +63 -0
  80. package/daemon/dist/db/migrations/034_workflow_instances.js.map +1 -0
  81. package/daemon/dist/db/migrations/035_workflow_step_trails.d.ts +29 -0
  82. package/daemon/dist/db/migrations/035_workflow_step_trails.d.ts.map +1 -0
  83. package/daemon/dist/db/migrations/035_workflow_step_trails.js +48 -0
  84. package/daemon/dist/db/migrations/035_workflow_step_trails.js.map +1 -0
  85. package/daemon/dist/db/migrations/036_watchdog_policy_enum_extension.d.ts +35 -0
  86. package/daemon/dist/db/migrations/036_watchdog_policy_enum_extension.d.ts.map +1 -0
  87. package/daemon/dist/db/migrations/036_watchdog_policy_enum_extension.js +43 -0
  88. package/daemon/dist/db/migrations/036_watchdog_policy_enum_extension.js.map +1 -0
  89. package/daemon/dist/domain/agent-activity-store.d.ts +42 -0
  90. package/daemon/dist/domain/agent-activity-store.d.ts.map +1 -0
  91. package/daemon/dist/domain/agent-activity-store.js +177 -0
  92. package/daemon/dist/domain/agent-activity-store.js.map +1 -0
  93. package/daemon/dist/domain/agent-manifest.d.ts.map +1 -1
  94. package/daemon/dist/domain/agent-manifest.js +3 -0
  95. package/daemon/dist/domain/agent-manifest.js.map +1 -1
  96. package/daemon/dist/domain/agent-starter-resolver.d.ts +100 -0
  97. package/daemon/dist/domain/agent-starter-resolver.d.ts.map +1 -0
  98. package/daemon/dist/domain/agent-starter-resolver.js +200 -0
  99. package/daemon/dist/domain/agent-starter-resolver.js.map +1 -0
  100. package/daemon/dist/domain/classifier-lease-manager.d.ts +130 -0
  101. package/daemon/dist/domain/classifier-lease-manager.d.ts.map +1 -0
  102. package/daemon/dist/domain/classifier-lease-manager.js +285 -0
  103. package/daemon/dist/domain/classifier-lease-manager.js.map +1 -0
  104. package/daemon/dist/domain/codex-thread-id.d.ts.map +1 -1
  105. package/daemon/dist/domain/codex-thread-id.js +44 -15
  106. package/daemon/dist/domain/codex-thread-id.js.map +1 -1
  107. package/daemon/dist/domain/context-monitor.d.ts +12 -7
  108. package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
  109. package/daemon/dist/domain/context-monitor.js +51 -3
  110. package/daemon/dist/domain/context-monitor.js.map +1 -1
  111. package/daemon/dist/domain/context-usage-store.d.ts +1 -1
  112. package/daemon/dist/domain/context-usage-store.js +1 -1
  113. package/daemon/dist/domain/context-usage-store.js.map +1 -1
  114. package/daemon/dist/domain/hot-potato-enforcer.d.ts +45 -0
  115. package/daemon/dist/domain/hot-potato-enforcer.d.ts.map +1 -0
  116. package/daemon/dist/domain/hot-potato-enforcer.js +94 -0
  117. package/daemon/dist/domain/hot-potato-enforcer.js.map +1 -0
  118. package/daemon/dist/domain/inbox-handler.d.ts +68 -0
  119. package/daemon/dist/domain/inbox-handler.d.ts.map +1 -0
  120. package/daemon/dist/domain/inbox-handler.js +177 -0
  121. package/daemon/dist/domain/inbox-handler.js.map +1 -0
  122. package/daemon/dist/domain/native-resume-probe.d.ts +1 -1
  123. package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
  124. package/daemon/dist/domain/native-resume-probe.js +89 -4
  125. package/daemon/dist/domain/native-resume-probe.js.map +1 -1
  126. package/daemon/dist/domain/node-inventory.d.ts +29 -1
  127. package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
  128. package/daemon/dist/domain/node-inventory.js +208 -31
  129. package/daemon/dist/domain/node-inventory.js.map +1 -1
  130. package/daemon/dist/domain/node-launcher.d.ts +2 -0
  131. package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
  132. package/daemon/dist/domain/node-launcher.js +14 -2
  133. package/daemon/dist/domain/node-launcher.js.map +1 -1
  134. package/daemon/dist/domain/outbox-handler.d.ts +48 -0
  135. package/daemon/dist/domain/outbox-handler.d.ts.map +1 -0
  136. package/daemon/dist/domain/outbox-handler.js +106 -0
  137. package/daemon/dist/domain/outbox-handler.js.map +1 -0
  138. package/daemon/dist/domain/policies/artifact-pool-helpers.d.ts +64 -0
  139. package/daemon/dist/domain/policies/artifact-pool-helpers.d.ts.map +1 -0
  140. package/daemon/dist/domain/policies/artifact-pool-helpers.js +226 -0
  141. package/daemon/dist/domain/policies/artifact-pool-helpers.js.map +1 -0
  142. package/daemon/dist/domain/policies/artifact-pool-ready.d.ts +3 -0
  143. package/daemon/dist/domain/policies/artifact-pool-ready.d.ts.map +1 -0
  144. package/daemon/dist/domain/policies/artifact-pool-ready.js +41 -0
  145. package/daemon/dist/domain/policies/artifact-pool-ready.js.map +1 -0
  146. package/daemon/dist/domain/policies/edge-artifact-required.d.ts +3 -0
  147. package/daemon/dist/domain/policies/edge-artifact-required.d.ts.map +1 -0
  148. package/daemon/dist/domain/policies/edge-artifact-required.js +90 -0
  149. package/daemon/dist/domain/policies/edge-artifact-required.js.map +1 -0
  150. package/daemon/dist/domain/policies/periodic-reminder.d.ts +3 -0
  151. package/daemon/dist/domain/policies/periodic-reminder.d.ts.map +1 -0
  152. package/daemon/dist/domain/policies/periodic-reminder.js +30 -0
  153. package/daemon/dist/domain/policies/periodic-reminder.js.map +1 -0
  154. package/daemon/dist/domain/policies/types.d.ts +51 -0
  155. package/daemon/dist/domain/policies/types.d.ts.map +1 -0
  156. package/daemon/dist/domain/policies/types.js +9 -0
  157. package/daemon/dist/domain/policies/types.js.map +1 -0
  158. package/daemon/dist/domain/policies/workflow-keepalive.d.ts +7 -0
  159. package/daemon/dist/domain/policies/workflow-keepalive.d.ts.map +1 -0
  160. package/daemon/dist/domain/policies/workflow-keepalive.js +123 -0
  161. package/daemon/dist/domain/policies/workflow-keepalive.js.map +1 -0
  162. package/daemon/dist/domain/project-classifier.d.ts +75 -0
  163. package/daemon/dist/domain/project-classifier.d.ts.map +1 -0
  164. package/daemon/dist/domain/project-classifier.js +132 -0
  165. package/daemon/dist/domain/project-classifier.js.map +1 -0
  166. package/daemon/dist/domain/projection-planner.d.ts +1 -0
  167. package/daemon/dist/domain/projection-planner.d.ts.map +1 -1
  168. package/daemon/dist/domain/projection-planner.js +3 -0
  169. package/daemon/dist/domain/projection-planner.js.map +1 -1
  170. package/daemon/dist/domain/ps-projection.d.ts +31 -0
  171. package/daemon/dist/domain/ps-projection.d.ts.map +1 -1
  172. package/daemon/dist/domain/ps-projection.js +38 -0
  173. package/daemon/dist/domain/ps-projection.js.map +1 -1
  174. package/daemon/dist/domain/queue-repository.d.ts +322 -0
  175. package/daemon/dist/domain/queue-repository.d.ts.map +1 -0
  176. package/daemon/dist/domain/queue-repository.js +686 -0
  177. package/daemon/dist/domain/queue-repository.js.map +1 -0
  178. package/daemon/dist/domain/queue-transition-log.d.ts +38 -0
  179. package/daemon/dist/domain/queue-transition-log.d.ts.map +1 -0
  180. package/daemon/dist/domain/queue-transition-log.js +52 -0
  181. package/daemon/dist/domain/queue-transition-log.js.map +1 -0
  182. package/daemon/dist/domain/restore-check-service.d.ts +203 -0
  183. package/daemon/dist/domain/restore-check-service.d.ts.map +1 -0
  184. package/daemon/dist/domain/restore-check-service.js +1047 -0
  185. package/daemon/dist/domain/restore-check-service.js.map +1 -0
  186. package/daemon/dist/domain/restore-orchestrator.d.ts +50 -2
  187. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  188. package/daemon/dist/domain/restore-orchestrator.js +476 -24
  189. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  190. package/daemon/dist/domain/resume-metadata-refresher.d.ts.map +1 -1
  191. package/daemon/dist/domain/resume-metadata-refresher.js +27 -7
  192. package/daemon/dist/domain/resume-metadata-refresher.js.map +1 -1
  193. package/daemon/dist/domain/rig-expansion-service.d.ts.map +1 -1
  194. package/daemon/dist/domain/rig-expansion-service.js +13 -0
  195. package/daemon/dist/domain/rig-expansion-service.js.map +1 -1
  196. package/daemon/dist/domain/rig-repository.d.ts +17 -1
  197. package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
  198. package/daemon/dist/domain/rig-repository.js +63 -5
  199. package/daemon/dist/domain/rig-repository.js.map +1 -1
  200. package/daemon/dist/domain/rigspec-codec.d.ts.map +1 -1
  201. package/daemon/dist/domain/rigspec-codec.js +13 -0
  202. package/daemon/dist/domain/rigspec-codec.js.map +1 -1
  203. package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
  204. package/daemon/dist/domain/rigspec-exporter.js +2 -0
  205. package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
  206. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  207. package/daemon/dist/domain/rigspec-instantiator.js +63 -1
  208. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  209. package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
  210. package/daemon/dist/domain/rigspec-schema.js +196 -0
  211. package/daemon/dist/domain/rigspec-schema.js.map +1 -1
  212. package/daemon/dist/domain/runtime-adapter.d.ts +30 -1
  213. package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
  214. package/daemon/dist/domain/runtime-adapter.js +14 -0
  215. package/daemon/dist/domain/runtime-adapter.js.map +1 -1
  216. package/daemon/dist/domain/seat-handover-planner.d.ts +84 -0
  217. package/daemon/dist/domain/seat-handover-planner.d.ts.map +1 -0
  218. package/daemon/dist/domain/seat-handover-planner.js +188 -0
  219. package/daemon/dist/domain/seat-handover-planner.js.map +1 -0
  220. package/daemon/dist/domain/seat-handover-service.d.ts +104 -0
  221. package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -0
  222. package/daemon/dist/domain/seat-handover-service.js +343 -0
  223. package/daemon/dist/domain/seat-handover-service.js.map +1 -0
  224. package/daemon/dist/domain/seat-status-service.d.ts +50 -0
  225. package/daemon/dist/domain/seat-status-service.d.ts.map +1 -0
  226. package/daemon/dist/domain/seat-status-service.js +66 -0
  227. package/daemon/dist/domain/seat-status-service.js.map +1 -0
  228. package/daemon/dist/domain/session-source-rebuild-resolver.d.ts +53 -0
  229. package/daemon/dist/domain/session-source-rebuild-resolver.d.ts.map +1 -0
  230. package/daemon/dist/domain/session-source-rebuild-resolver.js +59 -0
  231. package/daemon/dist/domain/session-source-rebuild-resolver.js.map +1 -0
  232. package/daemon/dist/domain/session-transport.d.ts +30 -0
  233. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  234. package/daemon/dist/domain/session-transport.js +322 -12
  235. package/daemon/dist/domain/session-transport.js.map +1 -1
  236. package/daemon/dist/domain/snapshot-repository.d.ts +18 -0
  237. package/daemon/dist/domain/snapshot-repository.d.ts.map +1 -1
  238. package/daemon/dist/domain/snapshot-repository.js +77 -0
  239. package/daemon/dist/domain/snapshot-repository.js.map +1 -1
  240. package/daemon/dist/domain/startup-orchestrator.d.ts +27 -3
  241. package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
  242. package/daemon/dist/domain/startup-orchestrator.js +125 -40
  243. package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
  244. package/daemon/dist/domain/stream-store.d.ts +56 -0
  245. package/daemon/dist/domain/stream-store.d.ts.map +1 -0
  246. package/daemon/dist/domain/stream-store.js +108 -0
  247. package/daemon/dist/domain/stream-store.js.map +1 -0
  248. package/daemon/dist/domain/transcript-redaction.d.ts +13 -0
  249. package/daemon/dist/domain/transcript-redaction.d.ts.map +1 -0
  250. package/daemon/dist/domain/transcript-redaction.js +34 -0
  251. package/daemon/dist/domain/transcript-redaction.js.map +1 -0
  252. package/daemon/dist/domain/transcript-store.d.ts +15 -0
  253. package/daemon/dist/domain/transcript-store.d.ts.map +1 -1
  254. package/daemon/dist/domain/transcript-store.js +76 -1
  255. package/daemon/dist/domain/transcript-store.js.map +1 -1
  256. package/daemon/dist/domain/types.d.ts +323 -3
  257. package/daemon/dist/domain/types.d.ts.map +1 -1
  258. package/daemon/dist/domain/view-event-bridge.d.ts +12 -0
  259. package/daemon/dist/domain/view-event-bridge.d.ts.map +1 -0
  260. package/daemon/dist/domain/view-event-bridge.js +92 -0
  261. package/daemon/dist/domain/view-event-bridge.js.map +1 -0
  262. package/daemon/dist/domain/view-projector.d.ts +83 -0
  263. package/daemon/dist/domain/view-projector.d.ts.map +1 -0
  264. package/daemon/dist/domain/view-projector.js +296 -0
  265. package/daemon/dist/domain/view-projector.js.map +1 -0
  266. package/daemon/dist/domain/watchdog-history-log.d.ts +49 -0
  267. package/daemon/dist/domain/watchdog-history-log.d.ts.map +1 -0
  268. package/daemon/dist/domain/watchdog-history-log.js +67 -0
  269. package/daemon/dist/domain/watchdog-history-log.js.map +1 -0
  270. package/daemon/dist/domain/watchdog-jobs-repository.d.ts +81 -0
  271. package/daemon/dist/domain/watchdog-jobs-repository.d.ts.map +1 -0
  272. package/daemon/dist/domain/watchdog-jobs-repository.js +164 -0
  273. package/daemon/dist/domain/watchdog-jobs-repository.js.map +1 -0
  274. package/daemon/dist/domain/watchdog-policy-engine.d.ts +92 -0
  275. package/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -0
  276. package/daemon/dist/domain/watchdog-policy-engine.js +442 -0
  277. package/daemon/dist/domain/watchdog-policy-engine.js.map +1 -0
  278. package/daemon/dist/domain/watchdog-scheduler.d.ts +76 -0
  279. package/daemon/dist/domain/watchdog-scheduler.d.ts.map +1 -0
  280. package/daemon/dist/domain/watchdog-scheduler.js +112 -0
  281. package/daemon/dist/domain/watchdog-scheduler.js.map +1 -0
  282. package/daemon/dist/domain/workflow-instance-store.d.ts +46 -0
  283. package/daemon/dist/domain/workflow-instance-store.d.ts.map +1 -0
  284. package/daemon/dist/domain/workflow-instance-store.js +116 -0
  285. package/daemon/dist/domain/workflow-instance-store.js.map +1 -0
  286. package/daemon/dist/domain/workflow-projector.d.ts +64 -0
  287. package/daemon/dist/domain/workflow-projector.d.ts.map +1 -0
  288. package/daemon/dist/domain/workflow-projector.js +424 -0
  289. package/daemon/dist/domain/workflow-projector.js.map +1 -0
  290. package/daemon/dist/domain/workflow-runtime.d.ts +63 -0
  291. package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -0
  292. package/daemon/dist/domain/workflow-runtime.js +150 -0
  293. package/daemon/dist/domain/workflow-runtime.js.map +1 -0
  294. package/daemon/dist/domain/workflow-spec-cache.d.ts +35 -0
  295. package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -0
  296. package/daemon/dist/domain/workflow-spec-cache.js +171 -0
  297. package/daemon/dist/domain/workflow-spec-cache.js.map +1 -0
  298. package/daemon/dist/domain/workflow-step-trail-log.d.ts +27 -0
  299. package/daemon/dist/domain/workflow-step-trail-log.d.ts.map +1 -0
  300. package/daemon/dist/domain/workflow-step-trail-log.js +73 -0
  301. package/daemon/dist/domain/workflow-step-trail-log.js.map +1 -0
  302. package/daemon/dist/domain/workflow-types.d.ts +108 -0
  303. package/daemon/dist/domain/workflow-types.d.ts.map +1 -0
  304. package/daemon/dist/domain/workflow-types.js +11 -0
  305. package/daemon/dist/domain/workflow-types.js.map +1 -0
  306. package/daemon/dist/domain/workflow-validator.d.ts +31 -0
  307. package/daemon/dist/domain/workflow-validator.d.ts.map +1 -0
  308. package/daemon/dist/domain/workflow-validator.js +115 -0
  309. package/daemon/dist/domain/workflow-validator.js.map +1 -0
  310. package/daemon/dist/index.d.ts.map +1 -1
  311. package/daemon/dist/index.js +21 -2
  312. package/daemon/dist/index.js.map +1 -1
  313. package/daemon/dist/routes/activity.d.ts +3 -0
  314. package/daemon/dist/routes/activity.d.ts.map +1 -0
  315. package/daemon/dist/routes/activity.js +47 -0
  316. package/daemon/dist/routes/activity.js.map +1 -0
  317. package/daemon/dist/routes/projects.d.ts +12 -0
  318. package/daemon/dist/routes/projects.d.ts.map +1 -0
  319. package/daemon/dist/routes/projects.js +178 -0
  320. package/daemon/dist/routes/projects.js.map +1 -0
  321. package/daemon/dist/routes/queue.d.ts +10 -0
  322. package/daemon/dist/routes/queue.d.ts.map +1 -0
  323. package/daemon/dist/routes/queue.js +374 -0
  324. package/daemon/dist/routes/queue.js.map +1 -0
  325. package/daemon/dist/routes/restore-check.d.ts +3 -0
  326. package/daemon/dist/routes/restore-check.d.ts.map +1 -0
  327. package/daemon/dist/routes/restore-check.js +200 -0
  328. package/daemon/dist/routes/restore-check.js.map +1 -0
  329. package/daemon/dist/routes/rigs.d.ts.map +1 -1
  330. package/daemon/dist/routes/rigs.js +60 -4
  331. package/daemon/dist/routes/rigs.js.map +1 -1
  332. package/daemon/dist/routes/seat.d.ts +3 -0
  333. package/daemon/dist/routes/seat.d.ts.map +1 -0
  334. package/daemon/dist/routes/seat.js +69 -0
  335. package/daemon/dist/routes/seat.js.map +1 -0
  336. package/daemon/dist/routes/sessions.d.ts.map +1 -1
  337. package/daemon/dist/routes/sessions.js +41 -5
  338. package/daemon/dist/routes/sessions.js.map +1 -1
  339. package/daemon/dist/routes/snapshots.js +66 -17
  340. package/daemon/dist/routes/snapshots.js.map +1 -1
  341. package/daemon/dist/routes/stream.d.ts +9 -0
  342. package/daemon/dist/routes/stream.d.ts.map +1 -0
  343. package/daemon/dist/routes/stream.js +119 -0
  344. package/daemon/dist/routes/stream.js.map +1 -0
  345. package/daemon/dist/routes/transcripts.d.ts.map +1 -1
  346. package/daemon/dist/routes/transcripts.js +38 -0
  347. package/daemon/dist/routes/transcripts.js.map +1 -1
  348. package/daemon/dist/routes/transport.d.ts.map +1 -1
  349. package/daemon/dist/routes/transport.js +21 -0
  350. package/daemon/dist/routes/transport.js.map +1 -1
  351. package/daemon/dist/routes/up.js +24 -3
  352. package/daemon/dist/routes/up.js.map +1 -1
  353. package/daemon/dist/routes/views.d.ts +13 -0
  354. package/daemon/dist/routes/views.d.ts.map +1 -0
  355. package/daemon/dist/routes/views.js +120 -0
  356. package/daemon/dist/routes/views.js.map +1 -0
  357. package/daemon/dist/routes/watchdog.d.ts +18 -0
  358. package/daemon/dist/routes/watchdog.d.ts.map +1 -0
  359. package/daemon/dist/routes/watchdog.js +148 -0
  360. package/daemon/dist/routes/watchdog.js.map +1 -0
  361. package/daemon/dist/routes/workflow.d.ts +20 -0
  362. package/daemon/dist/routes/workflow.d.ts.map +1 -0
  363. package/daemon/dist/routes/workflow.js +184 -0
  364. package/daemon/dist/routes/workflow.js.map +1 -0
  365. package/daemon/dist/server.d.ts +30 -0
  366. package/daemon/dist/server.d.ts.map +1 -1
  367. package/daemon/dist/server.js +33 -0
  368. package/daemon/dist/server.js.map +1 -1
  369. package/daemon/dist/startup.d.ts.map +1 -1
  370. package/daemon/dist/startup.js +202 -8
  371. package/daemon/dist/startup.js.map +1 -1
  372. package/daemon/docs/reference/agent-spec.md +12 -5
  373. package/daemon/docs/reference/agent-startup-guide.md +9 -9
  374. package/daemon/specs/agents/apps/vault-specialist/agent.yaml +1 -1
  375. package/daemon/specs/agents/design/product-designer/agent.yaml +1 -1
  376. package/daemon/specs/agents/development/implementer/agent.yaml +1 -1
  377. package/daemon/specs/agents/development/qa/agent.yaml +1 -1
  378. package/daemon/specs/agents/orchestration/orchestrator/agent.yaml +1 -1
  379. package/daemon/specs/agents/product-management/pm/agent.yaml +4 -0
  380. package/daemon/specs/agents/research/analyst/agent.yaml +1 -1
  381. package/daemon/specs/agents/research/synthesizer/agent.yaml +1 -1
  382. package/daemon/specs/agents/review/independent-reviewer/agent.yaml +1 -1
  383. package/daemon/specs/agents/shared/agent.yaml +17 -0
  384. package/daemon/specs/agents/shared/runtime/claude-mcp.fragment.json +12 -0
  385. package/daemon/specs/agents/shared/runtime/claude-settings.fragment.json +16 -0
  386. package/daemon/specs/agents/shared/runtime/codex-config.fragment.toml +5 -0
  387. package/daemon/specs/agents/shared/skills/claude-compact-in-place/SKILL.md +100 -0
  388. package/daemon/specs/agents/shared/skills/core/openrig-operator/SKILL.md +110 -0
  389. package/daemon/specs/agents/shared/skills/core/openrig-user/SKILL.md +44 -1
  390. package/daemon/specs/agents/shared/skills/mental-model-ha/SKILL.md +3 -0
  391. package/daemon/specs/agents/shared/skills/pods/orchestration-team/SKILL.md +3 -0
  392. package/dist/commands/capture.d.ts +7 -1
  393. package/dist/commands/capture.d.ts.map +1 -1
  394. package/dist/commands/capture.js +59 -1
  395. package/dist/commands/capture.js.map +1 -1
  396. package/dist/commands/compact-plan.d.ts +9 -0
  397. package/dist/commands/compact-plan.d.ts.map +1 -0
  398. package/dist/commands/compact-plan.js +354 -0
  399. package/dist/commands/compact-plan.js.map +1 -0
  400. package/dist/commands/context.d.ts +9 -0
  401. package/dist/commands/context.d.ts.map +1 -0
  402. package/dist/commands/context.js +220 -0
  403. package/dist/commands/context.js.map +1 -0
  404. package/dist/commands/doctor.d.ts.map +1 -1
  405. package/dist/commands/doctor.js +19 -8
  406. package/dist/commands/doctor.js.map +1 -1
  407. package/dist/commands/expand.d.ts.map +1 -1
  408. package/dist/commands/expand.js +15 -4
  409. package/dist/commands/expand.js.map +1 -1
  410. package/dist/commands/heartbeat.d.ts +99 -0
  411. package/dist/commands/heartbeat.d.ts.map +1 -0
  412. package/dist/commands/heartbeat.js +393 -0
  413. package/dist/commands/heartbeat.js.map +1 -0
  414. package/dist/commands/import.d.ts.map +1 -1
  415. package/dist/commands/import.js +2 -1
  416. package/dist/commands/import.js.map +1 -1
  417. package/dist/commands/preflight.js +1 -1
  418. package/dist/commands/preflight.js.map +1 -1
  419. package/dist/commands/project.d.ts +14 -0
  420. package/dist/commands/project.d.ts.map +1 -0
  421. package/dist/commands/project.js +157 -0
  422. package/dist/commands/project.js.map +1 -0
  423. package/dist/commands/ps.d.ts +20 -3
  424. package/dist/commands/ps.d.ts.map +1 -1
  425. package/dist/commands/ps.js +455 -33
  426. package/dist/commands/ps.js.map +1 -1
  427. package/dist/commands/queue.d.ts +16 -0
  428. package/dist/commands/queue.d.ts.map +1 -0
  429. package/dist/commands/queue.js +401 -0
  430. package/dist/commands/queue.js.map +1 -0
  431. package/dist/commands/restore-check.d.ts +9 -0
  432. package/dist/commands/restore-check.d.ts.map +1 -0
  433. package/dist/commands/restore-check.js +234 -0
  434. package/dist/commands/restore-check.js.map +1 -0
  435. package/dist/commands/restore-packet.d.ts +9 -0
  436. package/dist/commands/restore-packet.d.ts.map +1 -0
  437. package/dist/commands/restore-packet.js +383 -0
  438. package/dist/commands/restore-packet.js.map +1 -0
  439. package/dist/commands/restore.d.ts.map +1 -1
  440. package/dist/commands/restore.js +69 -1
  441. package/dist/commands/restore.js.map +1 -1
  442. package/dist/commands/seat.d.ts +5 -0
  443. package/dist/commands/seat.d.ts.map +1 -0
  444. package/dist/commands/seat.js +170 -0
  445. package/dist/commands/seat.js.map +1 -0
  446. package/dist/commands/send.d.ts +12 -1
  447. package/dist/commands/send.d.ts.map +1 -1
  448. package/dist/commands/send.js +93 -5
  449. package/dist/commands/send.js.map +1 -1
  450. package/dist/commands/setup.d.ts.map +1 -1
  451. package/dist/commands/setup.js +20 -8
  452. package/dist/commands/setup.js.map +1 -1
  453. package/dist/commands/specs.d.ts.map +1 -1
  454. package/dist/commands/specs.js +99 -16
  455. package/dist/commands/specs.js.map +1 -1
  456. package/dist/commands/stream.d.ts +12 -0
  457. package/dist/commands/stream.d.ts.map +1 -0
  458. package/dist/commands/stream.js +111 -0
  459. package/dist/commands/stream.js.map +1 -0
  460. package/dist/commands/up.d.ts +1 -0
  461. package/dist/commands/up.d.ts.map +1 -1
  462. package/dist/commands/up.js +65 -4
  463. package/dist/commands/up.js.map +1 -1
  464. package/dist/commands/view.d.ts +12 -0
  465. package/dist/commands/view.d.ts.map +1 -0
  466. package/dist/commands/view.js +82 -0
  467. package/dist/commands/view.js.map +1 -0
  468. package/dist/commands/watchdog.d.ts +15 -0
  469. package/dist/commands/watchdog.d.ts.map +1 -0
  470. package/dist/commands/watchdog.js +120 -0
  471. package/dist/commands/watchdog.js.map +1 -0
  472. package/dist/commands/whoami.d.ts +8 -1
  473. package/dist/commands/whoami.d.ts.map +1 -1
  474. package/dist/commands/whoami.js +60 -1
  475. package/dist/commands/whoami.js.map +1 -1
  476. package/dist/commands/workflow.d.ts +17 -0
  477. package/dist/commands/workflow.d.ts.map +1 -0
  478. package/dist/commands/workflow.js +138 -0
  479. package/dist/commands/workflow.js.map +1 -0
  480. package/dist/cross-host-cli-helpers.d.ts +12 -0
  481. package/dist/cross-host-cli-helpers.d.ts.map +1 -0
  482. package/dist/cross-host-cli-helpers.js +48 -0
  483. package/dist/cross-host-cli-helpers.js.map +1 -0
  484. package/dist/cross-host-executor.d.ts +84 -0
  485. package/dist/cross-host-executor.d.ts.map +1 -0
  486. package/dist/cross-host-executor.js +138 -0
  487. package/dist/cross-host-executor.js.map +1 -0
  488. package/dist/host-registry.d.ts +50 -0
  489. package/dist/host-registry.d.ts.map +1 -0
  490. package/dist/host-registry.js +116 -0
  491. package/dist/host-registry.js.map +1 -0
  492. package/dist/index.d.ts +20 -0
  493. package/dist/index.d.ts.map +1 -1
  494. package/dist/index.js +24 -0
  495. package/dist/index.js.map +1 -1
  496. package/dist/mcp-server.d.ts.map +1 -1
  497. package/dist/mcp-server.js +22 -2
  498. package/dist/mcp-server.js.map +1 -1
  499. package/dist/restore-packet/claude-transcript-parser.d.ts +12 -0
  500. package/dist/restore-packet/claude-transcript-parser.d.ts.map +1 -0
  501. package/dist/restore-packet/claude-transcript-parser.js +221 -0
  502. package/dist/restore-packet/claude-transcript-parser.js.map +1 -0
  503. package/dist/restore-packet/codex-jsonl-parser.d.ts +11 -0
  504. package/dist/restore-packet/codex-jsonl-parser.d.ts.map +1 -0
  505. package/dist/restore-packet/codex-jsonl-parser.js +159 -0
  506. package/dist/restore-packet/codex-jsonl-parser.js.map +1 -0
  507. package/dist/restore-packet/omitted-records.d.ts +60 -0
  508. package/dist/restore-packet/omitted-records.d.ts.map +1 -0
  509. package/dist/restore-packet/omitted-records.js +116 -0
  510. package/dist/restore-packet/omitted-records.js.map +1 -0
  511. package/dist/restore-packet/packet-writer.d.ts +59 -0
  512. package/dist/restore-packet/packet-writer.d.ts.map +1 -0
  513. package/dist/restore-packet/packet-writer.js +224 -0
  514. package/dist/restore-packet/packet-writer.js.map +1 -0
  515. package/dist/restore-packet/redaction.d.ts +30 -0
  516. package/dist/restore-packet/redaction.d.ts.map +1 -0
  517. package/dist/restore-packet/redaction.js +71 -0
  518. package/dist/restore-packet/redaction.js.map +1 -0
  519. package/dist/restore-packet/runtime-detect.d.ts +19 -0
  520. package/dist/restore-packet/runtime-detect.d.ts.map +1 -0
  521. package/dist/restore-packet/runtime-detect.js +81 -0
  522. package/dist/restore-packet/runtime-detect.js.map +1 -0
  523. package/dist/restore-packet/schema-validator.d.ts +13 -0
  524. package/dist/restore-packet/schema-validator.d.ts.map +1 -0
  525. package/dist/restore-packet/schema-validator.js +245 -0
  526. package/dist/restore-packet/schema-validator.js.map +1 -0
  527. package/dist/restore-packet/types.d.ts +76 -0
  528. package/dist/restore-packet/types.d.ts.map +1 -0
  529. package/dist/restore-packet/types.js +15 -0
  530. package/dist/restore-packet/types.js.map +1 -0
  531. package/dist/schemas/restore-summary.schema.json +98 -0
  532. package/dist/system-preflight.d.ts.map +1 -1
  533. package/dist/system-preflight.js +16 -5
  534. package/dist/system-preflight.js.map +1 -1
  535. package/dist/tmux-health.d.ts +16 -0
  536. package/dist/tmux-health.d.ts.map +1 -0
  537. package/dist/tmux-health.js +105 -0
  538. package/dist/tmux-health.js.map +1 -0
  539. package/package.json +10 -3
  540. package/scripts/check-abi.mjs +123 -0
  541. package/ui/dist/assets/{index-DlMH-REm.css → index-Dec25siz.css} +1 -1
  542. package/ui/dist/assets/{index-lEO-zBxz.js → index-GNYaWmBj.js} +9 -9
  543. package/ui/dist/index.html +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"node-launcher.js","sourceRoot":"","sources":["../../src/domain/node-launcher.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAsB3E,MAAM,OAAO,YAAY;IACd,EAAE,CAAoB;IACvB,OAAO,CAAgB;IACvB,eAAe,CAAkB;IACjC,QAAQ,CAAW;IACnB,WAAW,CAAc;IACzB,eAAe,CAAyB;IAEhD,YAAY,IAAsB;QAChC,6EAA6E;QAC7E,kFAAkF;QAClF,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACzE,CAAC;QACD,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,eAAe,CAAC,EAAE,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;QACjF,CAAC;QACD,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,sDAAsD,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/D,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,gBAAgB,CAAC,CAAC;QAChE,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEhE,OAAO;YACL,EAAE,EAAE,IAAI;YACR,WAAW;YACX,OAAO,EAAE,OAAQ;YACjB,OAAO,EAAE,OAAQ;YACjB,QAAQ,EAAE,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS;SACjE,CAAC;IACJ,CAAC;CACF;AAED,SAAS,UAAU,CAAC,KAAyC;IAC3D,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;YAAE,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACzE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,48 @@
1
+ import type Database from "better-sqlite3";
2
+ export declare const OUTBOX_DELIVERY_STATES: readonly ["pending", "delivered", "failed"];
3
+ export type OutboxDeliveryState = (typeof OUTBOX_DELIVERY_STATES)[number];
4
+ export interface OutboxEntry {
5
+ outboxId: string;
6
+ senderSession: string;
7
+ destinationSession: string;
8
+ body: string;
9
+ tags: string[] | null;
10
+ urgency: string;
11
+ tsDispatched: string;
12
+ deliveryState: OutboxDeliveryState;
13
+ deliveredAt: string | null;
14
+ auditPointer: string | null;
15
+ }
16
+ export interface OutboxRecordInput {
17
+ outboxId?: string;
18
+ senderSession: string;
19
+ destinationSession: string;
20
+ body: string;
21
+ tags?: string[];
22
+ urgency?: string;
23
+ auditPointer?: string;
24
+ }
25
+ export declare class OutboxHandlerError extends Error {
26
+ readonly code: string;
27
+ constructor(code: string, message: string);
28
+ }
29
+ /**
30
+ * Sender-side outbox. Symmetric to InboxHandler. Records what a sender
31
+ * dispatched independent of receiver behavior. Idempotent on outbox_id.
32
+ *
33
+ * No event-bus events emitted in Phase A — outbox is pure audit. If a future
34
+ * phase wants delivery-tracking events, add them through this surface.
35
+ */
36
+ export declare class OutboxHandler {
37
+ readonly db: Database.Database;
38
+ constructor(db: Database.Database);
39
+ record(input: OutboxRecordInput): OutboxEntry;
40
+ markDelivered(outboxId: string): OutboxEntry;
41
+ markFailed(outboxId: string): OutboxEntry;
42
+ getById(outboxId: string): OutboxEntry | null;
43
+ listForSender(senderSession: string, limit?: number): OutboxEntry[];
44
+ private getByIdRaw;
45
+ private getByIdOrThrow;
46
+ private rowToEntry;
47
+ }
48
+ //# sourceMappingURL=outbox-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outbox-handler.d.ts","sourceRoot":"","sources":["../../src/domain/outbox-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,eAAO,MAAM,sBAAsB,6CAA8C,CAAC;AAClF,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1E,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,mBAAmB,CAAC;IACnC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAeD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBACV,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAI1C;AAQD;;;;;;GAMG;AACH,qBAAa,aAAa;IACxB,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC;gBAEnB,EAAE,EAAE,QAAQ,CAAC,QAAQ;IAIjC,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,WAAW;IA6B7C,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW;IAiB5C,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW;IAgBzC,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAK7C,aAAa,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,SAAM,GAAG,WAAW,EAAE;IAShE,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,UAAU;CAcnB"}
@@ -0,0 +1,106 @@
1
+ export const OUTBOX_DELIVERY_STATES = ["pending", "delivered", "failed"];
2
+ export class OutboxHandlerError extends Error {
3
+ code;
4
+ constructor(code, message) {
5
+ super(message);
6
+ this.code = code;
7
+ }
8
+ }
9
+ function newOutboxId() {
10
+ const ts = new Date().toISOString().replace(/[-:T.Z]/g, "").slice(0, 14);
11
+ const hex = Math.floor(Math.random() * 0xffffffff).toString(16).padStart(8, "0");
12
+ return `outbox-${ts}-${hex}`;
13
+ }
14
+ /**
15
+ * Sender-side outbox. Symmetric to InboxHandler. Records what a sender
16
+ * dispatched independent of receiver behavior. Idempotent on outbox_id.
17
+ *
18
+ * No event-bus events emitted in Phase A — outbox is pure audit. If a future
19
+ * phase wants delivery-tracking events, add them through this surface.
20
+ */
21
+ export class OutboxHandler {
22
+ db;
23
+ constructor(db) {
24
+ this.db = db;
25
+ }
26
+ record(input) {
27
+ const id = input.outboxId ?? newOutboxId();
28
+ const existing = this.getByIdRaw(id);
29
+ if (existing)
30
+ return this.rowToEntry(existing);
31
+ const ts = new Date().toISOString();
32
+ const tags = input.tags ? JSON.stringify(input.tags) : null;
33
+ const urgency = input.urgency ?? "routine";
34
+ this.db
35
+ .prepare(`INSERT INTO outbox_entries (
36
+ outbox_id, sender_session, destination_session, body, tags, urgency, ts_dispatched, audit_pointer
37
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`)
38
+ .run(id, input.senderSession, input.destinationSession, input.body, tags, urgency, ts, input.auditPointer ?? null);
39
+ return this.getByIdOrThrow(id);
40
+ }
41
+ markDelivered(outboxId) {
42
+ const ts = new Date().toISOString();
43
+ const result = this.db
44
+ .prepare(`UPDATE outbox_entries
45
+ SET delivery_state = 'delivered', delivered_at = ?
46
+ WHERE outbox_id = ? AND delivery_state = 'pending'`)
47
+ .run(ts, outboxId);
48
+ if (result.changes === 0) {
49
+ const entry = this.getById(outboxId);
50
+ if (!entry)
51
+ throw new OutboxHandlerError("outbox_not_found", `outbox ${outboxId} not found`);
52
+ return entry;
53
+ }
54
+ return this.getByIdOrThrow(outboxId);
55
+ }
56
+ markFailed(outboxId) {
57
+ const result = this.db
58
+ .prepare(`UPDATE outbox_entries
59
+ SET delivery_state = 'failed'
60
+ WHERE outbox_id = ? AND delivery_state = 'pending'`)
61
+ .run(outboxId);
62
+ if (result.changes === 0) {
63
+ const entry = this.getById(outboxId);
64
+ if (!entry)
65
+ throw new OutboxHandlerError("outbox_not_found", `outbox ${outboxId} not found`);
66
+ return entry;
67
+ }
68
+ return this.getByIdOrThrow(outboxId);
69
+ }
70
+ getById(outboxId) {
71
+ const row = this.getByIdRaw(outboxId);
72
+ return row ? this.rowToEntry(row) : null;
73
+ }
74
+ listForSender(senderSession, limit = 100) {
75
+ const rows = this.db
76
+ .prepare(`SELECT * FROM outbox_entries WHERE sender_session = ? ORDER BY ts_dispatched DESC, rowid DESC LIMIT ?`)
77
+ .all(senderSession, limit);
78
+ return rows.map((r) => this.rowToEntry(r));
79
+ }
80
+ getByIdRaw(outboxId) {
81
+ return this.db
82
+ .prepare("SELECT * FROM outbox_entries WHERE outbox_id = ?")
83
+ .get(outboxId);
84
+ }
85
+ getByIdOrThrow(outboxId) {
86
+ const entry = this.getById(outboxId);
87
+ if (!entry)
88
+ throw new OutboxHandlerError("outbox_not_found", `outbox ${outboxId} not found after write`);
89
+ return entry;
90
+ }
91
+ rowToEntry(row) {
92
+ return {
93
+ outboxId: row.outbox_id,
94
+ senderSession: row.sender_session,
95
+ destinationSession: row.destination_session,
96
+ body: row.body,
97
+ tags: row.tags ? JSON.parse(row.tags) : null,
98
+ urgency: row.urgency,
99
+ tsDispatched: row.ts_dispatched,
100
+ deliveryState: row.delivery_state,
101
+ deliveredAt: row.delivered_at,
102
+ auditPointer: row.audit_pointer,
103
+ };
104
+ }
105
+ }
106
+ //# sourceMappingURL=outbox-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outbox-handler.js","sourceRoot":"","sources":["../../src/domain/outbox-handler.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,CAAU,CAAC;AAuClF,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAClC,IAAI,CAAS;IACtB,YAAY,IAAY,EAAE,OAAe;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,SAAS,WAAW;IAClB,MAAM,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;IACJ,CAAC;CACF"}
@@ -0,0 +1,64 @@
1
+ export interface ArtifactPoolSpec {
2
+ /** Absolute path to the pool directory. POC contract: one path per pool. */
3
+ path?: string;
4
+ /** Convenience array form; expanded to one pool per path. */
5
+ paths?: string[];
6
+ /** File extensions to include (default: ['.md']). */
7
+ extensions?: string[];
8
+ /** Filter on frontmatter `status:` field. Empty/absent = include all. */
9
+ include_statuses?: string[];
10
+ /** Frontmatter field used for keying artifacts (default: 'entry'). */
11
+ key_field?: string;
12
+ /** Per-pool extra ignore names (added to defaults). */
13
+ ignore_names?: string[];
14
+ /** When true, descend into subdirectories. Default false. */
15
+ recursive?: boolean;
16
+ /**
17
+ * When true, artifacts whose frontmatter cannot be parsed are still
18
+ * included with empty frontmatter. Default false: malformed frontmatter
19
+ * causes the artifact to be excluded (matches POC behavior so that
20
+ * agents do not get woken about half-written drafts).
21
+ */
22
+ include_malformed_frontmatter?: boolean;
23
+ }
24
+ export interface ScannedArtifact {
25
+ /** Absolute path to the artifact file. */
26
+ path: string;
27
+ /** The pool path that produced this artifact. */
28
+ pool_path: string;
29
+ /** Full file content (used by edge-artifact-required body-match). */
30
+ raw: string;
31
+ /**
32
+ * Parsed YAML frontmatter (top-level keys). Values are kept as `unknown`
33
+ * because YAML scalars are heterogeneous: timestamps parse to Date,
34
+ * URLs to string, numbers to number, etc. Frontmatter consumers in
35
+ * the policy layer (status filter, key_field lookup) coerce to string.
36
+ */
37
+ frontmatter: Record<string, unknown>;
38
+ /** Parse error message when include_malformed_frontmatter=true; else null. */
39
+ frontmatter_parse_error: string | null;
40
+ /** Convenience accessor for frontmatter.status; null when absent. */
41
+ status: string | null;
42
+ }
43
+ /**
44
+ * Scan one or more artifact pools per spec(s). Mirrors POC
45
+ * `scanArtifactPools(pools)`. Returns the flat union of matches across
46
+ * all pools, sorted by absolute path. Missing pools yield empty.
47
+ *
48
+ * Throws if `pools` is undefined / empty / shapeless — POC contract:
49
+ * the policy spec MUST declare at least one pool.
50
+ */
51
+ export declare function scanArtifactPools(pools: ArtifactPoolSpec | ArtifactPoolSpec[] | undefined): Promise<ScannedArtifact[]>;
52
+ /**
53
+ * Format an artifact list as bullet lines. Mirrors POC formatArtifactList:
54
+ * `- /full/absolute/path`. The POC favors the full path so receivers can
55
+ * cd / open / cat the artifact directly without further lookup.
56
+ */
57
+ export declare function formatArtifactList(artifacts: ScannedArtifact[], maxItems: number): string;
58
+ /**
59
+ * Compute the source-key for an artifact. Mirrors POC sourceKeyFor:
60
+ * prefer frontmatter[keyField], else basename sans .md extension.
61
+ * Coerces non-string scalars (Date, number) to string for comparison.
62
+ */
63
+ export declare function sourceKeyFor(artifact: ScannedArtifact, keyField: string): string;
64
+ //# sourceMappingURL=artifact-pool-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-pool-helpers.d.ts","sourceRoot":"","sources":["../../../src/domain/policies/artifact-pool-helpers.ts"],"names":[],"mappings":"AAsBA,MAAM,WAAW,gBAAgB;IAC/B,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,yEAAyE;IACzE,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,6BAA6B,CAAC,EAAE,OAAO,CAAC;CACzC;AAED,MAAM,WAAW,eAAe;IAC9B,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;OAKG;IACH,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,8EAA8E;IAC9E,uBAAuB,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,qEAAqE;IACrE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAyGD;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,gBAAgB,GAAG,gBAAgB,EAAE,GAAG,SAAS,GACvD,OAAO,CAAC,eAAe,EAAE,CAAC,CA0C5B;AAsBD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,eAAe,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKzF;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQhF"}
@@ -0,0 +1,226 @@
1
+ // PL-004 Phase C R1: shared artifact-pool helpers (TypeScript port of
2
+ // POC `lib/policies/artifact-pool.js`).
3
+ //
4
+ // R1 fix (guard blocker 3): full POC parity for the scanner. The
5
+ // artifact-pool-ready and edge-artifact-required policies depend on:
6
+ // - Default ignores: README.md and .DS_Store always excluded.
7
+ // - Configured ignore_names: per-pool extra exclusions.
8
+ // - Recursive scan when pool.recursive=true.
9
+ // - Malformed-frontmatter exclusion unless pool.include_malformed_frontmatter.
10
+ // - Raw content preserved on every artifact (used by edge-artifact-required
11
+ // for body-reference target satisfaction).
12
+ // - Missing pool path returns empty (ENOENT-tolerant).
13
+ //
14
+ // Pure filesystem scanner; no event-bus, no DB, no Hono.
15
+ import { readdirSync, readFileSync, statSync } from "node:fs";
16
+ import { basename, join } from "node:path";
17
+ import { parse as parseYaml } from "yaml";
18
+ const DEFAULT_EXTENSIONS = [".md"];
19
+ const DEFAULT_IGNORE_NAMES = ["README.md", ".DS_Store"];
20
+ const FRONTMATTER_OPEN = "---\n";
21
+ /**
22
+ * Parse top-level YAML frontmatter from a markdown-style document.
23
+ * Returns { raw, frontmatter, parseError } so callers can decide whether
24
+ * to include malformed artifacts.
25
+ *
26
+ * R2 fix (guard blocker 2): use the `yaml` package (already a daemon
27
+ * dep) rather than a local key/value parser. Mirrors POC's
28
+ * `lib/policies/artifact-pool.js:21-30` which delegates to the shared
29
+ * YAML loader. Valid YAML scalars containing colons (ISO timestamps,
30
+ * URLs) parse cleanly. Only true YAML parse failures (e.g.,
31
+ * `broken: value: still broken` which is genuinely invalid YAML) cause
32
+ * exclusion when `include_malformed_frontmatter` is unset.
33
+ */
34
+ function readFrontmatter(filePath) {
35
+ const raw = readFileSync(filePath, "utf-8");
36
+ if (!raw.startsWith(FRONTMATTER_OPEN)) {
37
+ return { raw, frontmatter: {}, frontmatter_parse_error: null };
38
+ }
39
+ const endIdx = raw.indexOf("\n---\n", FRONTMATTER_OPEN.length);
40
+ if (endIdx === -1) {
41
+ return { raw, frontmatter: {}, frontmatter_parse_error: null };
42
+ }
43
+ const block = raw.slice(FRONTMATTER_OPEN.length, endIdx);
44
+ let parsed;
45
+ try {
46
+ parsed = parseYaml(block);
47
+ }
48
+ catch (err) {
49
+ return {
50
+ raw,
51
+ frontmatter: {},
52
+ frontmatter_parse_error: err instanceof Error ? err.message : "frontmatter parse error",
53
+ };
54
+ }
55
+ // YAML parsed but produced a non-object root (string, array, null) —
56
+ // treat as empty frontmatter, NOT a parse error. Matches POC behavior
57
+ // (lib/policies/artifact-pool.js:35-38): non-object root yields {}.
58
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
59
+ return { raw, frontmatter: {}, frontmatter_parse_error: null };
60
+ }
61
+ return {
62
+ raw,
63
+ frontmatter: parsed,
64
+ frontmatter_parse_error: null,
65
+ };
66
+ }
67
+ function listFiles(rootDir, recursive) {
68
+ let entries;
69
+ try {
70
+ entries = readdirSync(rootDir, { withFileTypes: true });
71
+ }
72
+ catch (err) {
73
+ if (err.code === "ENOENT")
74
+ return [];
75
+ throw err;
76
+ }
77
+ const out = [];
78
+ for (const entry of entries) {
79
+ const full = join(rootDir, entry.name);
80
+ if (entry.isDirectory()) {
81
+ if (recursive)
82
+ out.push(...listFiles(full, recursive));
83
+ continue;
84
+ }
85
+ if (entry.isFile())
86
+ out.push(full);
87
+ }
88
+ return out.sort((a, b) => a.localeCompare(b));
89
+ }
90
+ function shouldIncludeFile(filePath, pool) {
91
+ const name = basename(filePath);
92
+ const ignoreNames = new Set([
93
+ ...DEFAULT_IGNORE_NAMES,
94
+ ...(Array.isArray(pool.ignore_names) ? pool.ignore_names : []),
95
+ ]);
96
+ if (ignoreNames.has(name))
97
+ return false;
98
+ const exts = Array.isArray(pool.extensions) ? pool.extensions : DEFAULT_EXTENSIONS;
99
+ return exts.some((e) => name.endsWith(e));
100
+ }
101
+ function statusAllowed(status, pool) {
102
+ const include = pool.include_statuses;
103
+ if (!Array.isArray(include) || include.length === 0)
104
+ return true;
105
+ return status !== null && include.includes(status);
106
+ }
107
+ /**
108
+ * Coerce a YAML-parsed frontmatter status field to a comparable string.
109
+ * YAML loaders may parse unquoted statuses as identifiers (string),
110
+ * but a status like `2026-05-03` would parse as Date. We coerce to ISO
111
+ * for non-string scalars so include_statuses comparisons remain stable.
112
+ */
113
+ function statusFromFrontmatter(fm) {
114
+ const v = fm.status;
115
+ if (v === undefined || v === null)
116
+ return null;
117
+ if (typeof v === "string")
118
+ return v;
119
+ if (v instanceof Date)
120
+ return v.toISOString();
121
+ return String(v);
122
+ }
123
+ /**
124
+ * Scan one or more artifact pools per spec(s). Mirrors POC
125
+ * `scanArtifactPools(pools)`. Returns the flat union of matches across
126
+ * all pools, sorted by absolute path. Missing pools yield empty.
127
+ *
128
+ * Throws if `pools` is undefined / empty / shapeless — POC contract:
129
+ * the policy spec MUST declare at least one pool.
130
+ */
131
+ export async function scanArtifactPools(pools) {
132
+ const expanded = expandPools(pools);
133
+ if (expanded.length === 0) {
134
+ throw new Error("artifact pool policy: context pool list is required");
135
+ }
136
+ const out = [];
137
+ for (const pool of expanded) {
138
+ if (!pool.path) {
139
+ throw new Error("artifact pool policy: every pool requires a path");
140
+ }
141
+ const files = listFiles(pool.path, Boolean(pool.recursive));
142
+ for (const filePath of files) {
143
+ if (!shouldIncludeFile(filePath, pool))
144
+ continue;
145
+ let st;
146
+ try {
147
+ st = statSync(filePath);
148
+ }
149
+ catch {
150
+ continue;
151
+ }
152
+ if (!st.isFile())
153
+ continue;
154
+ let parsed;
155
+ try {
156
+ parsed = readFrontmatter(filePath);
157
+ }
158
+ catch {
159
+ continue;
160
+ }
161
+ if (parsed.frontmatter_parse_error && !pool.include_malformed_frontmatter) {
162
+ continue;
163
+ }
164
+ const status = statusFromFrontmatter(parsed.frontmatter);
165
+ if (!statusAllowed(status, pool))
166
+ continue;
167
+ out.push({
168
+ path: filePath,
169
+ pool_path: pool.path,
170
+ raw: parsed.raw,
171
+ frontmatter: parsed.frontmatter,
172
+ frontmatter_parse_error: parsed.frontmatter_parse_error,
173
+ status,
174
+ });
175
+ }
176
+ }
177
+ return out.sort((a, b) => a.path.localeCompare(b.path));
178
+ }
179
+ /**
180
+ * Expand the convenience input shape (single object, array of objects,
181
+ * or `paths: [...]` shorthand) into a flat array of single-path pools.
182
+ */
183
+ function expandPools(pools) {
184
+ if (!pools)
185
+ return [];
186
+ const list = Array.isArray(pools) ? pools : [pools];
187
+ const out = [];
188
+ for (const spec of list) {
189
+ if (spec.path) {
190
+ out.push(spec);
191
+ }
192
+ else if (Array.isArray(spec.paths)) {
193
+ for (const p of spec.paths)
194
+ out.push({ ...spec, path: p, paths: undefined });
195
+ }
196
+ }
197
+ return out;
198
+ }
199
+ /**
200
+ * Format an artifact list as bullet lines. Mirrors POC formatArtifactList:
201
+ * `- /full/absolute/path`. The POC favors the full path so receivers can
202
+ * cd / open / cat the artifact directly without further lookup.
203
+ */
204
+ export function formatArtifactList(artifacts, maxItems) {
205
+ return artifacts
206
+ .slice(0, maxItems)
207
+ .map((a) => `- ${a.path}`)
208
+ .join("\n");
209
+ }
210
+ /**
211
+ * Compute the source-key for an artifact. Mirrors POC sourceKeyFor:
212
+ * prefer frontmatter[keyField], else basename sans .md extension.
213
+ * Coerces non-string scalars (Date, number) to string for comparison.
214
+ */
215
+ export function sourceKeyFor(artifact, keyField) {
216
+ const value = artifact.frontmatter[keyField];
217
+ if (value === undefined || value === null || value === "") {
218
+ return basename(artifact.path).replace(/\.md$/, "");
219
+ }
220
+ if (typeof value === "string")
221
+ return value;
222
+ if (value instanceof Date)
223
+ return value.toISOString();
224
+ return String(value);
225
+ }
226
+ //# sourceMappingURL=artifact-pool-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-pool-helpers.js","sourceRoot":"","sources":["../../../src/domain/policies/artifact-pool-helpers.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,wCAAwC;AACxC,EAAE;AACF,iEAAiE;AACjE,qEAAqE;AACrE,gEAAgE;AAChE,0DAA0D;AAC1D,+CAA+C;AAC/C,iFAAiF;AACjF,8EAA8E;AAC9E,+CAA+C;AAC/C,yDAAyD;AACzD,EAAE;AACF,yDAAyD;AAEzD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1C,MAAM,kBAAkB,GAAG,CAAC,KAAK,CAAC,CAAC;AACnC,MAAM,oBAAoB,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AA8CxD,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAEjC;;;;;;;;;;;;GAYG;AACH,SAAS,eAAe,CAAC,QAAgB;IAKvC,MAAM,GAAG,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC5C,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACtC,OAAO,EAAE,GAAG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AC,IAAI,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACtD,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,KAAK,YAAY,IAAI;QAAE,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;IACtD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Policy } from "./types.js";
2
+ export declare const artifactPoolReadyPolicy: Policy;
3
+ //# sourceMappingURL=artifact-pool-ready.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-pool-ready.d.ts","sourceRoot":"","sources":["../../../src/domain/policies/artifact-pool-ready.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAA+B,MAAM,YAAY,CAAC;AAiBtE,eAAO,MAAM,uBAAuB,EAAE,MA8BrC,CAAC"}
@@ -0,0 +1,41 @@
1
+ // PL-004 Phase C R1: artifact-pool-ready policy (TypeScript port of
2
+ // POC `lib/policies/artifact-pool-ready.mjs`).
3
+ //
4
+ // POC contract: target.session is required (top-level `target:`).
5
+ // Scans context.pools (array). Empty → skip(no_actionable_artifacts).
6
+ // Otherwise sends a formatted message ending with the standard POC
7
+ // pool-ready instruction line.
8
+ import { formatArtifactList, scanArtifactPools, } from "./artifact-pool-helpers.js";
9
+ const POC_POOL_READY_TRAILER = "Claim and process the next artifact, or terminally classify it with evidence. " +
10
+ "This is a pool-ready wake, not an approval gate, and it should not require orch to bridge the edge.";
11
+ export const artifactPoolReadyPolicy = {
12
+ name: "artifact-pool-ready",
13
+ async evaluate(job) {
14
+ if (!job.target?.session) {
15
+ throw Object.assign(new Error("artifact-pool-ready: target.session is required"), {
16
+ code: "policy_spec_invalid",
17
+ policy: "artifact-pool-ready",
18
+ field: "target.session",
19
+ });
20
+ }
21
+ const context = job.context;
22
+ const artifacts = await scanArtifactPools(context.pools);
23
+ if (artifacts.length === 0) {
24
+ return { action: "skip", reason: "no_actionable_artifacts" };
25
+ }
26
+ const label = context.label ?? "artifact pool";
27
+ const maxItems = Number(context.max_items ?? 5);
28
+ const list = formatArtifactList(artifacts, maxItems);
29
+ const hiddenCount = Math.max(0, artifacts.length - maxItems);
30
+ const suffix = hiddenCount > 0 ? `\n- ... ${hiddenCount} more` : "";
31
+ const message = job.message ??
32
+ `Artifact pool ready: ${label} has ${artifacts.length} actionable artifact(s).\n${list}${suffix}\n\n${POC_POOL_READY_TRAILER}`;
33
+ return {
34
+ action: "send",
35
+ target: job.target,
36
+ message,
37
+ notes: { artifact_count: artifacts.length, label },
38
+ };
39
+ },
40
+ };
41
+ //# sourceMappingURL=artifact-pool-ready.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-pool-ready.js","sourceRoot":"","sources":["../../../src/domain/policies/artifact-pool-ready.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,+CAA+C;AAC/C,EAAE;AACF,kEAAkE;AAClE,sEAAsE;AACtE,mEAAmE;AACnE,+BAA+B;AAG/B,OAAO,EAEL,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AAQpC,MAAM,sBAAsB,GAC1B,gFAAgF;IAChF,qGAAqG,CAAC;AAExG,MAAM,CAAC,MAAM,uBAAuB,GAAW;IAC7C,IAAI,EAAE,qBAAqB;IAC3B,KAAK,CAAC,QAAQ,CAAC,GAAc;QAC3B,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;YACzB,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,iDAAiD,CAAC,EAAE;gBAChF,IAAI,EAAE,qBAAqB;gBAC3B,MAAM,EAAE,qBAAqB;gBAC7B,KAAK,EAAE,gBAAgB;aACxB,CAAC,CAAC;QACL,CAAC;QACD,MAAM,OAAO,GAAG,GAAG,CAAC,OAAmC,CAAC;QACxD,MAAM,SAAS,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACzD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,yBAAyB,EAAE,CAAC;QAC/D,CAAC;QACD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,eAAe,CAAC;QAC/C,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC;QAChD,MAAM,IAAI,GAAG,kBAAkB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACrD,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAC;QAC7D,MAAM,MAAM,GAAG,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,WAAW,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QACpE,MAAM,OAAO,GACX,GAAG,CAAC,OAAO;YACX,wBAAwB,KAAK,QAAQ,SAAS,CAAC,MAAM,6BAA6B,IAAI,GAAG,MAAM,OAAO,sBAAsB,EAAE,CAAC;QACjI,OAAO;YACL,MAAM,EAAE,MAAM;YACd,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,OAAO;YACP,KAAK,EAAE,EAAE,cAAc,EAAE,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE;SACnD,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Policy } from "./types.js";
2
+ export declare const edgeArtifactRequiredPolicy: Policy;
3
+ //# sourceMappingURL=edge-artifact-required.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge-artifact-required.d.ts","sourceRoot":"","sources":["../../../src/domain/policies/edge-artifact-required.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,MAAM,EAA+B,MAAM,YAAY,CAAC;AA6BtE,eAAO,MAAM,0BAA0B,EAAE,MAsExC,CAAC"}
@@ -0,0 +1,90 @@
1
+ // PL-004 Phase C R1: edge-artifact-required policy (TypeScript port of
2
+ // POC `lib/policies/edge-artifact-required.mjs`).
3
+ //
4
+ // R1 fix (guard blocker 2): preserves the POC contract.
5
+ // - Spec uses `context.source` (singular) and `context.target`
6
+ // (singular) pool specs. Each may have `path` or `paths`.
7
+ // - Edge-satisfaction: a downstream target artifact satisfies a
8
+ // source iff target.raw CONTAINS the source key. NOT a frontmatter
9
+ // match — body reference suffices.
10
+ // - Target scan overrides include_statuses to [] so any downstream
11
+ // state counts as "exists".
12
+ // - Delivery target is `job.target.session` (top-level).
13
+ // - Label key is `context.edge_label` (matches POC).
14
+ import { scanArtifactPools, sourceKeyFor, } from "./artifact-pool-helpers.js";
15
+ function targetContainsKey(targets, key) {
16
+ return targets.some((t) => t.raw.includes(key));
17
+ }
18
+ function expandPoolSides(spec) {
19
+ if (!spec)
20
+ return [];
21
+ if (Array.isArray(spec.paths)) {
22
+ return spec.paths.map((p) => ({ ...spec, path: p, paths: undefined }));
23
+ }
24
+ return [spec];
25
+ }
26
+ export const edgeArtifactRequiredPolicy = {
27
+ name: "edge-artifact-required",
28
+ async evaluate(job) {
29
+ if (!job.target?.session) {
30
+ throw Object.assign(new Error("edge-artifact-required: target.session is required"), {
31
+ code: "policy_spec_invalid",
32
+ policy: "edge-artifact-required",
33
+ field: "target.session",
34
+ });
35
+ }
36
+ const context = job.context;
37
+ const source = context.source;
38
+ const target = context.target;
39
+ if (!source?.path && !Array.isArray(source?.paths)) {
40
+ throw Object.assign(new Error("edge-artifact-required: context.source.path is required"), {
41
+ code: "policy_spec_invalid",
42
+ policy: "edge-artifact-required",
43
+ field: "context.source.path",
44
+ });
45
+ }
46
+ if (!target?.path && !Array.isArray(target?.paths)) {
47
+ throw Object.assign(new Error("edge-artifact-required: context.target.path is required"), {
48
+ code: "policy_spec_invalid",
49
+ policy: "edge-artifact-required",
50
+ field: "context.target.path",
51
+ });
52
+ }
53
+ const sourcePools = expandPoolSides(source);
54
+ const targetPools = expandPoolSides(target).map((p) => ({
55
+ ...p,
56
+ include_statuses: [],
57
+ }));
58
+ const keyField = source?.key_field ?? "entry";
59
+ const sources = await scanArtifactPools(sourcePools);
60
+ const targets = await scanArtifactPools(targetPools);
61
+ const missing = [];
62
+ for (const s of sources) {
63
+ const key = sourceKeyFor(s, keyField);
64
+ if (!targetContainsKey(targets, key))
65
+ missing.push(s);
66
+ }
67
+ if (missing.length === 0) {
68
+ return { action: "skip", reason: "no_missing_edge_artifacts" };
69
+ }
70
+ const label = context.edge_label ?? "artifact edge";
71
+ const maxItems = Number(context.max_items ?? 5);
72
+ const list = missing
73
+ .slice(0, maxItems)
74
+ .map((a) => `- ${sourceKeyFor(a, keyField)} (${a.path})`)
75
+ .join("\n");
76
+ const hiddenCount = Math.max(0, missing.length - maxItems);
77
+ const suffix = hiddenCount > 0 ? `\n- ... ${hiddenCount} more` : "";
78
+ const message = job.message ??
79
+ `Artifact edge repair needed: ${label} has ${missing.length} upstream artifact(s) with no matching downstream artifact.\n${list}${suffix}\n\n` +
80
+ "Producer loop owns creating the missing downstream artifact. " +
81
+ "Do not wait for orch to bridge this manually; repair the edge or record the blocker with evidence.";
82
+ return {
83
+ action: "send",
84
+ target: job.target,
85
+ message,
86
+ notes: { missing_count: missing.length, label },
87
+ };
88
+ },
89
+ };
90
+ //# sourceMappingURL=edge-artifact-required.js.map