@openrig/cli 0.3.0 → 0.3.2

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 (482) hide show
  1. package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +15 -0
  2. package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +24 -0
  3. package/daemon/assets/plugins/openrig-core/LICENSE +200 -0
  4. package/daemon/assets/plugins/openrig-core/README.md +42 -0
  5. package/daemon/assets/plugins/openrig-core/hooks/claude.json +78 -0
  6. package/daemon/assets/plugins/openrig-core/hooks/codex.json +37 -0
  7. package/daemon/assets/{openrig-activity-hook-relay.cjs → plugins/openrig-core/hooks/scripts/activity-relay.cjs} +12 -0
  8. package/daemon/assets/plugins/openrig-core/hooks/scripts/compaction-restore-bridge.cjs +172 -0
  9. package/daemon/assets/plugins/openrig-core/skills/agent-startup-and-context-ingestion/SKILL.md +104 -0
  10. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/SKILL.md +131 -0
  11. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/precompact-hook.mjs +174 -0
  12. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/restore-from-jsonl.mjs +433 -0
  13. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/templates/compact-instruction.md +1 -0
  14. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/templates/post-compact-restore-instruction.md +1 -0
  15. package/daemon/assets/plugins/openrig-core/skills/forming-an-openrig-mental-model/SKILL.md +305 -0
  16. package/daemon/{specs/agents/shared/skills/rig-architect → assets/plugins/openrig-core/skills/openrig-architect}/SKILL.md +38 -19
  17. package/daemon/assets/plugins/openrig-core/skills/openrig-operator/SKILL.md +222 -0
  18. package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +597 -0
  19. package/daemon/assets/plugins/openrig-core/skills/queue-handoff/SKILL.md +122 -0
  20. package/daemon/assets/plugins/openrig-core/skills/seat-continuity-and-handover/SKILL.md +137 -0
  21. package/daemon/assets/vm-preview-fixtures/README.md +48 -0
  22. package/daemon/assets/vm-preview-fixtures/workflows/sample-basic-loop.yaml +79 -0
  23. package/daemon/dist/adapters/claude-code-adapter.d.ts +1 -3
  24. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  25. package/daemon/dist/adapters/claude-code-adapter.js +17 -57
  26. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  27. package/daemon/dist/adapters/cmux-transport.d.ts.map +1 -1
  28. package/daemon/dist/adapters/cmux-transport.js +81 -2
  29. package/daemon/dist/adapters/cmux-transport.js.map +1 -1
  30. package/daemon/dist/adapters/cmux.d.ts +4 -0
  31. package/daemon/dist/adapters/cmux.d.ts.map +1 -1
  32. package/daemon/dist/adapters/cmux.js +87 -0
  33. package/daemon/dist/adapters/cmux.js.map +1 -1
  34. package/daemon/dist/adapters/codex-runtime-adapter.d.ts +14 -3
  35. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  36. package/daemon/dist/adapters/codex-runtime-adapter.js +45 -58
  37. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  38. package/daemon/dist/adapters/tmux.d.ts +36 -0
  39. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  40. package/daemon/dist/adapters/tmux.js +66 -0
  41. package/daemon/dist/adapters/tmux.js.map +1 -1
  42. package/daemon/dist/db/migrations/037_mission_control_actions.d.ts +5 -1
  43. package/daemon/dist/db/migrations/037_mission_control_actions.d.ts.map +1 -1
  44. package/daemon/dist/db/migrations/037_mission_control_actions.js +5 -1
  45. package/daemon/dist/db/migrations/037_mission_control_actions.js.map +1 -1
  46. package/daemon/dist/db/migrations/040_workflow_specs_diagnostic.d.ts +32 -0
  47. package/daemon/dist/db/migrations/040_workflow_specs_diagnostic.d.ts.map +1 -0
  48. package/daemon/dist/db/migrations/040_workflow_specs_diagnostic.js +37 -0
  49. package/daemon/dist/db/migrations/040_workflow_specs_diagnostic.js.map +1 -0
  50. package/daemon/dist/db/migrations/041_rig_policy.d.ts +32 -0
  51. package/daemon/dist/db/migrations/041_rig_policy.d.ts.map +1 -0
  52. package/daemon/dist/db/migrations/041_rig_policy.js +47 -0
  53. package/daemon/dist/db/migrations/041_rig_policy.js.map +1 -0
  54. package/daemon/dist/domain/agent-images/resume-token-discovery.js +1 -1
  55. package/daemon/dist/domain/agent-images/resume-token-discovery.js.map +1 -1
  56. package/daemon/dist/domain/agent-images/snapshot-capturer.d.ts.map +1 -1
  57. package/daemon/dist/domain/agent-images/snapshot-capturer.js +2 -1
  58. package/daemon/dist/domain/agent-images/snapshot-capturer.js.map +1 -1
  59. package/daemon/dist/domain/agent-manifest.d.ts.map +1 -1
  60. package/daemon/dist/domain/agent-manifest.js +143 -37
  61. package/daemon/dist/domain/agent-manifest.js.map +1 -1
  62. package/daemon/dist/domain/agent-resolver.js +1 -1
  63. package/daemon/dist/domain/agent-resolver.js.map +1 -1
  64. package/daemon/dist/domain/bootstrap-orchestrator.d.ts.map +1 -1
  65. package/daemon/dist/domain/bootstrap-orchestrator.js +86 -6
  66. package/daemon/dist/domain/bootstrap-orchestrator.js.map +1 -1
  67. package/daemon/dist/domain/bundle-agent-images-router.d.ts +95 -0
  68. package/daemon/dist/domain/bundle-agent-images-router.d.ts.map +1 -0
  69. package/daemon/dist/domain/bundle-agent-images-router.js +140 -0
  70. package/daemon/dist/domain/bundle-agent-images-router.js.map +1 -0
  71. package/daemon/dist/domain/bundle-assembler.d.ts +18 -1
  72. package/daemon/dist/domain/bundle-assembler.d.ts.map +1 -1
  73. package/daemon/dist/domain/bundle-assembler.js +11 -1
  74. package/daemon/dist/domain/bundle-assembler.js.map +1 -1
  75. package/daemon/dist/domain/bundle-audit.d.ts +89 -0
  76. package/daemon/dist/domain/bundle-audit.d.ts.map +1 -0
  77. package/daemon/dist/domain/bundle-audit.js +87 -0
  78. package/daemon/dist/domain/bundle-audit.js.map +1 -0
  79. package/daemon/dist/domain/bundle-conflict-detector.d.ts +57 -0
  80. package/daemon/dist/domain/bundle-conflict-detector.d.ts.map +1 -0
  81. package/daemon/dist/domain/bundle-conflict-detector.js +49 -0
  82. package/daemon/dist/domain/bundle-conflict-detector.js.map +1 -0
  83. package/daemon/dist/domain/bundle-context-packs-router.d.ts +100 -0
  84. package/daemon/dist/domain/bundle-context-packs-router.d.ts.map +1 -0
  85. package/daemon/dist/domain/bundle-context-packs-router.js +158 -0
  86. package/daemon/dist/domain/bundle-context-packs-router.js.map +1 -0
  87. package/daemon/dist/domain/bundle-plugins-router.d.ts +69 -0
  88. package/daemon/dist/domain/bundle-plugins-router.d.ts.map +1 -0
  89. package/daemon/dist/domain/bundle-plugins-router.js +87 -0
  90. package/daemon/dist/domain/bundle-plugins-router.js.map +1 -0
  91. package/daemon/dist/domain/bundle-skills-router.d.ts +62 -0
  92. package/daemon/dist/domain/bundle-skills-router.d.ts.map +1 -0
  93. package/daemon/dist/domain/bundle-skills-router.js +90 -0
  94. package/daemon/dist/domain/bundle-skills-router.js.map +1 -0
  95. package/daemon/dist/domain/bundle-types.d.ts +106 -0
  96. package/daemon/dist/domain/bundle-types.d.ts.map +1 -1
  97. package/daemon/dist/domain/bundle-types.js +375 -0
  98. package/daemon/dist/domain/bundle-types.js.map +1 -1
  99. package/daemon/dist/domain/bundle-workflow-specs-router.d.ts +94 -0
  100. package/daemon/dist/domain/bundle-workflow-specs-router.d.ts.map +1 -0
  101. package/daemon/dist/domain/bundle-workflow-specs-router.js +144 -0
  102. package/daemon/dist/domain/bundle-workflow-specs-router.js.map +1 -0
  103. package/daemon/dist/domain/claude-compaction-enforcer.d.ts +81 -0
  104. package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -0
  105. package/daemon/dist/domain/claude-compaction-enforcer.js +242 -0
  106. package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -0
  107. package/daemon/dist/domain/cmux-layout-service.d.ts +41 -0
  108. package/daemon/dist/domain/cmux-layout-service.d.ts.map +1 -0
  109. package/daemon/dist/domain/cmux-layout-service.js +184 -0
  110. package/daemon/dist/domain/cmux-layout-service.js.map +1 -0
  111. package/daemon/dist/domain/context-monitor.d.ts +19 -1
  112. package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
  113. package/daemon/dist/domain/context-monitor.js +62 -14
  114. package/daemon/dist/domain/context-monitor.js.map +1 -1
  115. package/daemon/dist/domain/graph-projection.d.ts +6 -0
  116. package/daemon/dist/domain/graph-projection.d.ts.map +1 -1
  117. package/daemon/dist/domain/graph-projection.js +6 -0
  118. package/daemon/dist/domain/graph-projection.js.map +1 -1
  119. package/daemon/dist/domain/kernel-boot-tracker.d.ts +74 -0
  120. package/daemon/dist/domain/kernel-boot-tracker.d.ts.map +1 -0
  121. package/daemon/dist/domain/kernel-boot-tracker.js +213 -0
  122. package/daemon/dist/domain/kernel-boot-tracker.js.map +1 -0
  123. package/daemon/dist/domain/kernel-boot.d.ts +50 -0
  124. package/daemon/dist/domain/kernel-boot.d.ts.map +1 -0
  125. package/daemon/dist/domain/kernel-boot.js +147 -0
  126. package/daemon/dist/domain/kernel-boot.js.map +1 -0
  127. package/daemon/dist/domain/mission-control/mission-control-read-layer.d.ts +5 -0
  128. package/daemon/dist/domain/mission-control/mission-control-read-layer.d.ts.map +1 -1
  129. package/daemon/dist/domain/mission-control/mission-control-read-layer.js +16 -2
  130. package/daemon/dist/domain/mission-control/mission-control-read-layer.js.map +1 -1
  131. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
  132. package/daemon/dist/domain/mission-control/mission-control-write-contract.js +3 -1
  133. package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
  134. package/daemon/dist/domain/native-resume-probe.js +7 -7
  135. package/daemon/dist/domain/native-resume-probe.js.map +1 -1
  136. package/daemon/dist/domain/node-inventory.d.ts +18 -0
  137. package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
  138. package/daemon/dist/domain/node-inventory.js +98 -0
  139. package/daemon/dist/domain/node-inventory.js.map +1 -1
  140. package/daemon/dist/domain/node-launcher.d.ts +12 -0
  141. package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
  142. package/daemon/dist/domain/node-launcher.js +25 -1
  143. package/daemon/dist/domain/node-launcher.js.map +1 -1
  144. package/daemon/dist/domain/plugin-discovery-service.d.ts +150 -0
  145. package/daemon/dist/domain/plugin-discovery-service.d.ts.map +1 -0
  146. package/daemon/dist/domain/plugin-discovery-service.js +468 -0
  147. package/daemon/dist/domain/plugin-discovery-service.js.map +1 -0
  148. package/daemon/dist/domain/plugin-vendor-service.d.ts +54 -0
  149. package/daemon/dist/domain/plugin-vendor-service.d.ts.map +1 -0
  150. package/daemon/dist/domain/plugin-vendor-service.js +111 -0
  151. package/daemon/dist/domain/plugin-vendor-service.js.map +1 -0
  152. package/daemon/dist/domain/pod-bundle-assembler.d.ts +16 -1
  153. package/daemon/dist/domain/pod-bundle-assembler.d.ts.map +1 -1
  154. package/daemon/dist/domain/pod-bundle-assembler.js +11 -1
  155. package/daemon/dist/domain/pod-bundle-assembler.js.map +1 -1
  156. package/daemon/dist/domain/profile-resolver.d.ts +13 -3
  157. package/daemon/dist/domain/profile-resolver.d.ts.map +1 -1
  158. package/daemon/dist/domain/profile-resolver.js +11 -7
  159. package/daemon/dist/domain/profile-resolver.js.map +1 -1
  160. package/daemon/dist/domain/projection-planner.d.ts +7 -1
  161. package/daemon/dist/domain/projection-planner.d.ts.map +1 -1
  162. package/daemon/dist/domain/projection-planner.js +44 -4
  163. package/daemon/dist/domain/projection-planner.js.map +1 -1
  164. package/daemon/dist/domain/ps-projection.d.ts +22 -0
  165. package/daemon/dist/domain/ps-projection.d.ts.map +1 -1
  166. package/daemon/dist/domain/ps-projection.js +57 -0
  167. package/daemon/dist/domain/ps-projection.js.map +1 -1
  168. package/daemon/dist/domain/queue-repository.d.ts +44 -1
  169. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  170. package/daemon/dist/domain/queue-repository.js +112 -6
  171. package/daemon/dist/domain/queue-repository.js.map +1 -1
  172. package/daemon/dist/domain/restore-check-service.d.ts +4 -0
  173. package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
  174. package/daemon/dist/domain/restore-check-service.js +16 -7
  175. package/daemon/dist/domain/restore-check-service.js.map +1 -1
  176. package/daemon/dist/domain/rig-policy/rig-policy-defaults.d.ts +48 -0
  177. package/daemon/dist/domain/rig-policy/rig-policy-defaults.d.ts.map +1 -0
  178. package/daemon/dist/domain/rig-policy/rig-policy-defaults.js +96 -0
  179. package/daemon/dist/domain/rig-policy/rig-policy-defaults.js.map +1 -0
  180. package/daemon/dist/domain/rig-policy/rig-policy-store.d.ts +46 -0
  181. package/daemon/dist/domain/rig-policy/rig-policy-store.d.ts.map +1 -0
  182. package/daemon/dist/domain/rig-policy/rig-policy-store.js +171 -0
  183. package/daemon/dist/domain/rig-policy/rig-policy-store.js.map +1 -0
  184. package/daemon/dist/domain/rig-policy/rig-policy-types.d.ts +145 -0
  185. package/daemon/dist/domain/rig-policy/rig-policy-types.d.ts.map +1 -0
  186. package/daemon/dist/domain/rig-policy/rig-policy-types.js +52 -0
  187. package/daemon/dist/domain/rig-policy/rig-policy-types.js.map +1 -0
  188. package/daemon/dist/domain/rig-policy/rig-policy-validator.d.ts +58 -0
  189. package/daemon/dist/domain/rig-policy/rig-policy-validator.d.ts.map +1 -0
  190. package/daemon/dist/domain/rig-policy/rig-policy-validator.js +211 -0
  191. package/daemon/dist/domain/rig-policy/rig-policy-validator.js.map +1 -0
  192. package/daemon/dist/domain/rigspec-instantiator.d.ts +1 -1
  193. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  194. package/daemon/dist/domain/rigspec-instantiator.js +109 -18
  195. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  196. package/daemon/dist/domain/seat-activity-service.d.ts +79 -0
  197. package/daemon/dist/domain/seat-activity-service.d.ts.map +1 -0
  198. package/daemon/dist/domain/seat-activity-service.js +123 -0
  199. package/daemon/dist/domain/seat-activity-service.js.map +1 -0
  200. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  201. package/daemon/dist/domain/session-transport.js +33 -0
  202. package/daemon/dist/domain/session-transport.js.map +1 -1
  203. package/daemon/dist/domain/skill-library-discovery.d.ts +68 -0
  204. package/daemon/dist/domain/skill-library-discovery.d.ts.map +1 -0
  205. package/daemon/dist/domain/skill-library-discovery.js +144 -0
  206. package/daemon/dist/domain/skill-library-discovery.js.map +1 -0
  207. package/daemon/dist/domain/slices/slice-indexer.d.ts +31 -0
  208. package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -1
  209. package/daemon/dist/domain/slices/slice-indexer.js +111 -6
  210. package/daemon/dist/domain/slices/slice-indexer.js.map +1 -1
  211. package/daemon/dist/domain/spec-library-service.d.ts +6 -0
  212. package/daemon/dist/domain/spec-library-service.d.ts.map +1 -1
  213. package/daemon/dist/domain/spec-library-service.js +19 -0
  214. package/daemon/dist/domain/spec-library-service.js.map +1 -1
  215. package/daemon/dist/domain/spec-library-workflow-scanner.d.ts +43 -0
  216. package/daemon/dist/domain/spec-library-workflow-scanner.d.ts.map +1 -1
  217. package/daemon/dist/domain/spec-library-workflow-scanner.js +157 -3
  218. package/daemon/dist/domain/spec-library-workflow-scanner.js.map +1 -1
  219. package/daemon/dist/domain/spec-review-service.d.ts +1 -1
  220. package/daemon/dist/domain/spec-review-service.d.ts.map +1 -1
  221. package/daemon/dist/domain/spec-review-service.js +14 -1
  222. package/daemon/dist/domain/spec-review-service.js.map +1 -1
  223. package/daemon/dist/domain/types.d.ts +106 -10
  224. package/daemon/dist/domain/types.d.ts.map +1 -1
  225. package/daemon/dist/domain/types.js.map +1 -1
  226. package/daemon/dist/domain/user-settings/settings-store.d.ts +25 -1
  227. package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
  228. package/daemon/dist/domain/user-settings/settings-store.js +186 -4
  229. package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
  230. package/daemon/dist/domain/workflow-spec-cache.d.ts +49 -0
  231. package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
  232. package/daemon/dist/domain/workflow-spec-cache.js +96 -0
  233. package/daemon/dist/domain/workflow-spec-cache.js.map +1 -1
  234. package/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts +7 -0
  235. package/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts.map +1 -1
  236. package/daemon/dist/domain/workspace/default-workspace-scaffold.js +201 -3
  237. package/daemon/dist/domain/workspace/default-workspace-scaffold.js.map +1 -1
  238. package/daemon/dist/domain/workspace/getting-started-narrative.d.ts +15 -0
  239. package/daemon/dist/domain/workspace/getting-started-narrative.d.ts.map +1 -0
  240. package/daemon/dist/domain/workspace/getting-started-narrative.js +237 -0
  241. package/daemon/dist/domain/workspace/getting-started-narrative.js.map +1 -0
  242. package/daemon/dist/domain/workspace/workspace-doctor.d.ts +197 -0
  243. package/daemon/dist/domain/workspace/workspace-doctor.d.ts.map +1 -0
  244. package/daemon/dist/domain/workspace/workspace-doctor.js +448 -0
  245. package/daemon/dist/domain/workspace/workspace-doctor.js.map +1 -0
  246. package/daemon/dist/index.d.ts +2 -1
  247. package/daemon/dist/index.d.ts.map +1 -1
  248. package/daemon/dist/index.js +63 -17
  249. package/daemon/dist/index.js.map +1 -1
  250. package/daemon/dist/lib/pane-envelope.d.ts +7 -0
  251. package/daemon/dist/lib/pane-envelope.d.ts.map +1 -0
  252. package/daemon/dist/lib/pane-envelope.js +38 -0
  253. package/daemon/dist/lib/pane-envelope.js.map +1 -0
  254. package/daemon/dist/middleware/auth-bearer-token.d.ts +47 -5
  255. package/daemon/dist/middleware/auth-bearer-token.d.ts.map +1 -1
  256. package/daemon/dist/middleware/auth-bearer-token.js +109 -8
  257. package/daemon/dist/middleware/auth-bearer-token.js.map +1 -1
  258. package/daemon/dist/routes/bundles.d.ts.map +1 -1
  259. package/daemon/dist/routes/bundles.js +966 -7
  260. package/daemon/dist/routes/bundles.js.map +1 -1
  261. package/daemon/dist/routes/config.d.ts.map +1 -1
  262. package/daemon/dist/routes/config.js +19 -2
  263. package/daemon/dist/routes/config.js.map +1 -1
  264. package/daemon/dist/routes/info.d.ts +3 -0
  265. package/daemon/dist/routes/info.d.ts.map +1 -0
  266. package/daemon/dist/routes/info.js +20 -0
  267. package/daemon/dist/routes/info.js.map +1 -0
  268. package/daemon/dist/routes/kernel-status.d.ts +3 -0
  269. package/daemon/dist/routes/kernel-status.d.ts.map +1 -0
  270. package/daemon/dist/routes/kernel-status.js +40 -0
  271. package/daemon/dist/routes/kernel-status.js.map +1 -0
  272. package/daemon/dist/routes/mission-control.d.ts.map +1 -1
  273. package/daemon/dist/routes/mission-control.js +25 -2
  274. package/daemon/dist/routes/mission-control.js.map +1 -1
  275. package/daemon/dist/routes/missions.d.ts +3 -0
  276. package/daemon/dist/routes/missions.d.ts.map +1 -0
  277. package/daemon/dist/routes/missions.js +195 -0
  278. package/daemon/dist/routes/missions.js.map +1 -0
  279. package/daemon/dist/routes/plugins.d.ts +3 -0
  280. package/daemon/dist/routes/plugins.d.ts.map +1 -0
  281. package/daemon/dist/routes/plugins.js +223 -0
  282. package/daemon/dist/routes/plugins.js.map +1 -0
  283. package/daemon/dist/routes/queue.d.ts +18 -0
  284. package/daemon/dist/routes/queue.d.ts.map +1 -1
  285. package/daemon/dist/routes/queue.js +97 -5
  286. package/daemon/dist/routes/queue.js.map +1 -1
  287. package/daemon/dist/routes/rig-cmux.d.ts +3 -0
  288. package/daemon/dist/routes/rig-cmux.d.ts.map +1 -0
  289. package/daemon/dist/routes/rig-cmux.js +121 -0
  290. package/daemon/dist/routes/rig-cmux.js.map +1 -0
  291. package/daemon/dist/routes/rig-policy.d.ts +9 -0
  292. package/daemon/dist/routes/rig-policy.d.ts.map +1 -0
  293. package/daemon/dist/routes/rig-policy.js +174 -0
  294. package/daemon/dist/routes/rig-policy.js.map +1 -0
  295. package/daemon/dist/routes/rigs.d.ts.map +1 -1
  296. package/daemon/dist/routes/rigs.js +10 -2
  297. package/daemon/dist/routes/rigs.js.map +1 -1
  298. package/daemon/dist/routes/sessions.d.ts.map +1 -1
  299. package/daemon/dist/routes/sessions.js +26 -3
  300. package/daemon/dist/routes/sessions.js.map +1 -1
  301. package/daemon/dist/routes/skills.d.ts +3 -0
  302. package/daemon/dist/routes/skills.d.ts.map +1 -0
  303. package/daemon/dist/routes/skills.js +147 -0
  304. package/daemon/dist/routes/skills.js.map +1 -0
  305. package/daemon/dist/routes/slices.d.ts.map +1 -1
  306. package/daemon/dist/routes/slices.js +15 -0
  307. package/daemon/dist/routes/slices.js.map +1 -1
  308. package/daemon/dist/routes/spec-library.d.ts.map +1 -1
  309. package/daemon/dist/routes/spec-library.js +16 -1
  310. package/daemon/dist/routes/spec-library.js.map +1 -1
  311. package/daemon/dist/routes/up.d.ts +25 -0
  312. package/daemon/dist/routes/up.d.ts.map +1 -1
  313. package/daemon/dist/routes/up.js +70 -3
  314. package/daemon/dist/routes/up.js.map +1 -1
  315. package/daemon/dist/routes/workspace.d.ts.map +1 -1
  316. package/daemon/dist/routes/workspace.js +80 -1
  317. package/daemon/dist/routes/workspace.js.map +1 -1
  318. package/daemon/dist/server.d.ts +41 -0
  319. package/daemon/dist/server.d.ts.map +1 -1
  320. package/daemon/dist/server.js +41 -0
  321. package/daemon/dist/server.js.map +1 -1
  322. package/daemon/dist/startup.d.ts.map +1 -1
  323. package/daemon/dist/startup.js +236 -6
  324. package/daemon/dist/startup.js.map +1 -1
  325. package/daemon/specs/agents/apps/vault-specialist/agent.yaml +0 -1
  326. package/daemon/specs/agents/conveyor/builder/agent.yaml +0 -1
  327. package/daemon/specs/agents/conveyor/lead/agent.yaml +0 -1
  328. package/daemon/specs/agents/conveyor/planner/agent.yaml +0 -1
  329. package/daemon/specs/agents/conveyor/reviewer/agent.yaml +0 -1
  330. package/daemon/specs/agents/design/product-designer/agent.yaml +0 -1
  331. package/daemon/specs/agents/development/implementer/agent.yaml +0 -1
  332. package/daemon/specs/agents/development/qa/agent.yaml +0 -1
  333. package/daemon/specs/agents/development/qa/guidance/role.md +0 -2
  334. package/daemon/specs/agents/orchestration/orchestrator/agent.yaml +0 -1
  335. package/daemon/specs/agents/orchestration/orchestrator/guidance/role.md +28 -4
  336. package/daemon/specs/agents/research/analyst/agent.yaml +0 -1
  337. package/daemon/specs/agents/research/synthesizer/agent.yaml +0 -1
  338. package/daemon/specs/agents/review/independent-reviewer/agent.yaml +0 -1
  339. package/daemon/specs/agents/shared/agent.yaml +6 -6
  340. package/daemon/specs/agents/shared/skills/core/openrig-architect/SKILL.md +361 -0
  341. package/daemon/specs/agents/shared/skills/core/openrig-installer/SKILL.md +142 -0
  342. package/daemon/specs/agents/shared/skills/core/openrig-user/SKILL.md +288 -6
  343. package/daemon/specs/agents/shared/skills/core/openrig-user-settings/SKILL.md +4 -4
  344. package/daemon/specs/agents/shared/skills/core/rig-lifecycle/SKILL.md +116 -0
  345. package/daemon/specs/agents/shared/skills/pods/development-team/SKILL.md +0 -1
  346. package/daemon/specs/agents/shared/skills/pods/orchestration-team/SKILL.md +2 -2
  347. package/daemon/specs/agents/shared/skills/process/agent-browser/LOCAL-INSIGHTS.md +6 -6
  348. package/daemon/specs/agents/shared/skills/process/agent-browser/OPENRIG.md +40 -0
  349. package/daemon/specs/agents/shared/skills/process/agent-browser/SKILL.md +10 -0
  350. package/daemon/specs/agents/shared/skills/process/brainstorming/OPENRIG.md +48 -0
  351. package/daemon/specs/agents/shared/skills/process/brainstorming/SKILL.md +11 -0
  352. package/daemon/specs/agents/shared/skills/process/dogfood/SKILL.md +5 -0
  353. package/daemon/specs/agents/shared/skills/process/executing-plans/OPENRIG.md +56 -0
  354. package/daemon/specs/agents/shared/skills/process/executing-plans/SKILL.md +10 -0
  355. package/daemon/specs/agents/shared/skills/process/frontend-design/SKILL.md +5 -0
  356. package/daemon/specs/agents/shared/skills/process/systematic-debugging/SKILL.md +5 -0
  357. package/daemon/specs/agents/shared/skills/process/test-driven-development/SKILL.md +5 -0
  358. package/daemon/specs/agents/shared/skills/process/using-superpowers/OPENRIG.md +48 -0
  359. package/daemon/specs/agents/shared/skills/process/using-superpowers/SKILL.md +11 -0
  360. package/daemon/specs/agents/shared/skills/process/verification-before-completion/SKILL.md +5 -0
  361. package/daemon/specs/agents/shared/skills/process/writing-plans/OPENRIG.md +52 -0
  362. package/daemon/specs/agents/shared/skills/process/writing-plans/SKILL.md +12 -2
  363. package/daemon/specs/rigs/launch/conveyor/rig.yaml +1 -1
  364. package/daemon/specs/rigs/launch/kernel/agents/advisor/lead/agent.yaml +35 -0
  365. package/daemon/specs/rigs/launch/kernel/agents/advisor/lead/guidance/role.md +50 -0
  366. package/daemon/specs/rigs/launch/kernel/agents/advisor/lead/startup/context.md +37 -0
  367. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/agent.yaml +35 -0
  368. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +49 -0
  369. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/startup/context.md +63 -0
  370. package/daemon/specs/rigs/launch/kernel/agents/queue/worker/agent.yaml +35 -0
  371. package/daemon/specs/rigs/launch/kernel/agents/queue/worker/guidance/role.md +33 -0
  372. package/daemon/specs/rigs/launch/kernel/agents/queue/worker/startup/context.md +30 -0
  373. package/daemon/specs/rigs/launch/kernel/culture/CULTURE.md +69 -0
  374. package/daemon/specs/rigs/launch/kernel/rig-claude-only.yaml +59 -0
  375. package/daemon/specs/rigs/launch/kernel/rig-codex-only.yaml +59 -0
  376. package/daemon/specs/rigs/launch/kernel/rig.yaml +69 -0
  377. package/dist/client.d.ts +3 -0
  378. package/dist/client.d.ts.map +1 -1
  379. package/dist/client.js +13 -1
  380. package/dist/client.js.map +1 -1
  381. package/dist/commands/bundle.d.ts.map +1 -1
  382. package/dist/commands/bundle.js +123 -2
  383. package/dist/commands/bundle.js.map +1 -1
  384. package/dist/commands/config-init-workspace.d.ts.map +1 -1
  385. package/dist/commands/config-init-workspace.js +293 -5
  386. package/dist/commands/config-init-workspace.js.map +1 -1
  387. package/dist/commands/config.d.ts.map +1 -1
  388. package/dist/commands/config.js +11 -3
  389. package/dist/commands/config.js.map +1 -1
  390. package/dist/commands/daemon.d.ts.map +1 -1
  391. package/dist/commands/daemon.js +53 -1
  392. package/dist/commands/daemon.js.map +1 -1
  393. package/dist/commands/heartbeat.d.ts.map +1 -1
  394. package/dist/commands/heartbeat.js +0 -5
  395. package/dist/commands/heartbeat.js.map +1 -1
  396. package/dist/commands/plugin.d.ts +4 -0
  397. package/dist/commands/plugin.d.ts.map +1 -0
  398. package/dist/commands/plugin.js +395 -0
  399. package/dist/commands/plugin.js.map +1 -0
  400. package/dist/commands/ps.d.ts.map +1 -1
  401. package/dist/commands/ps.js +51 -8
  402. package/dist/commands/ps.js.map +1 -1
  403. package/dist/commands/queue.d.ts +6 -0
  404. package/dist/commands/queue.d.ts.map +1 -1
  405. package/dist/commands/queue.js +103 -5
  406. package/dist/commands/queue.js.map +1 -1
  407. package/dist/commands/rig-policy.d.ts +48 -0
  408. package/dist/commands/rig-policy.d.ts.map +1 -0
  409. package/dist/commands/rig-policy.js +429 -0
  410. package/dist/commands/rig-policy.js.map +1 -0
  411. package/dist/commands/scope.d.ts +6 -0
  412. package/dist/commands/scope.d.ts.map +1 -0
  413. package/dist/commands/scope.js +659 -0
  414. package/dist/commands/scope.js.map +1 -0
  415. package/dist/commands/send.d.ts +8 -0
  416. package/dist/commands/send.d.ts.map +1 -1
  417. package/dist/commands/send.js +8 -0
  418. package/dist/commands/send.js.map +1 -1
  419. package/dist/commands/up.d.ts.map +1 -1
  420. package/dist/commands/up.js +60 -1
  421. package/dist/commands/up.js.map +1 -1
  422. package/dist/commands/workflow.d.ts +9 -0
  423. package/dist/commands/workflow.d.ts.map +1 -1
  424. package/dist/commands/workflow.js +139 -1
  425. package/dist/commands/workflow.js.map +1 -1
  426. package/dist/commands/workspace.d.ts +20 -0
  427. package/dist/commands/workspace.d.ts.map +1 -1
  428. package/dist/commands/workspace.js +138 -7
  429. package/dist/commands/workspace.js.map +1 -1
  430. package/dist/config-store.d.ts +18 -1
  431. package/dist/config-store.d.ts.map +1 -1
  432. package/dist/config-store.js +167 -4
  433. package/dist/config-store.js.map +1 -1
  434. package/dist/daemon-lifecycle.d.ts +45 -2
  435. package/dist/daemon-lifecycle.d.ts.map +1 -1
  436. package/dist/daemon-lifecycle.js +90 -9
  437. package/dist/daemon-lifecycle.js.map +1 -1
  438. package/dist/host-registry.d.ts +1 -1
  439. package/dist/host-registry.js +1 -1
  440. package/dist/index.d.ts +3 -0
  441. package/dist/index.d.ts.map +1 -1
  442. package/dist/index.js +7 -0
  443. package/dist/index.js.map +1 -1
  444. package/dist/lib/scope/dot-id.d.ts +43 -0
  445. package/dist/lib/scope/dot-id.d.ts.map +1 -0
  446. package/dist/lib/scope/dot-id.js +165 -0
  447. package/dist/lib/scope/dot-id.js.map +1 -0
  448. package/dist/lib/scope/scope-fs.d.ts +79 -0
  449. package/dist/lib/scope/scope-fs.d.ts.map +1 -0
  450. package/dist/lib/scope/scope-fs.js +468 -0
  451. package/dist/lib/scope/scope-fs.js.map +1 -0
  452. package/dist/lib/scope/templates.d.ts +38 -0
  453. package/dist/lib/scope/templates.d.ts.map +1 -0
  454. package/dist/lib/scope/templates.js +109 -0
  455. package/dist/lib/scope/templates.js.map +1 -0
  456. package/dist/lib/scope/types.d.ts +61 -0
  457. package/dist/lib/scope/types.d.ts.map +1 -0
  458. package/dist/lib/scope/types.js +38 -0
  459. package/dist/lib/scope/types.js.map +1 -0
  460. package/dist/lib/scope-templates/backlog-deprecation.md +26 -0
  461. package/dist/lib/scope-templates/backlog-tech-debt.md +22 -0
  462. package/dist/lib/scope-templates/bug-fix.md +30 -0
  463. package/dist/lib/scope-templates/mission-notes.md +97 -0
  464. package/dist/lib/scope-templates/mission-placeholder.md +20 -0
  465. package/dist/lib/scope-templates/mission-release.md +25 -0
  466. package/dist/lib/scope-templates/placeholder.md +30 -0
  467. package/dist/lib/scope-templates/release-feature.md +26 -0
  468. package/dist/lib/scope-templates/research.md +22 -0
  469. package/package.json +2 -2
  470. package/ui/dist/assets/index-C_Q5FczU.css +1 -0
  471. package/ui/dist/assets/index-GjTxfi9S.js +547 -0
  472. package/ui/dist/index.html +2 -2
  473. package/daemon/specs/agents/shared/skills/claude-compact-in-place/SKILL.md +0 -100
  474. package/daemon/specs/agents/shared/skills/process/containerized-e2e/SKILL.md +0 -256
  475. package/daemon/specs/agents/shared/skills/process/containerized-e2e/scripts/Dockerfile +0 -39
  476. package/daemon/specs/agents/shared/skills/process/containerized-e2e/scripts/build-e2e-image.sh +0 -37
  477. package/daemon/specs/agents/shared/skills/process/containerized-e2e/templates/control-plane-test.yaml +0 -40
  478. package/daemon/specs/agents/shared/skills/process/containerized-e2e/templates/e2e-report-template.md +0 -94
  479. package/daemon/specs/agents/shared/skills/process/containerized-e2e/templates/expansion-collision-fragment.yaml +0 -13
  480. package/daemon/specs/agents/shared/skills/process/containerized-e2e/templates/expansion-pod-fragment.yaml +0 -14
  481. package/ui/dist/assets/index-BDHU1JUK.js +0 -412
  482. package/ui/dist/assets/index-DXTyJSqu.css +0 -1
@@ -0,0 +1,195 @@
1
+ // V0.3.1 slice 12 walk-item 1 — mission scope data layer.
2
+ // V0.3.1 slice 13 walk-item 7 — extended with workflow_spec frontmatter
3
+ // + projected topology spec graph.
4
+ //
5
+ // GET /api/missions/:missionId — returns aggregated mission metadata
6
+ // (missionPath + slices + optional workflow_spec declaration + optional
7
+ // projected topology). Powers the Mission Overview / Progress / Topology
8
+ // tabs in the Project surface; pairs with useScopeMarkdown for README /
9
+ // PROGRESS content via the existing /api/files/read route.
10
+ //
11
+ // Returns:
12
+ // 200 {
13
+ // missionId, missionPath, slices,
14
+ // workflow_spec: { name, version } | null,
15
+ // topology: { specGraph: SpecGraphPayload | null } | null
16
+ // }
17
+ // 404 { error: "mission_not_found" } when no slices match
18
+ // 503 { error: "slices_indexer_unavailable" } when indexer not wired
19
+ // 503 { error: "slices_root_not_configured" } when indexer not ready
20
+ //
21
+ // workflow_spec is parsed lazily from <missionPath>/README.md frontmatter
22
+ // using the same parser the slice-indexer uses. topology.specGraph is
23
+ // projected via projectSpecGraph(spec, null) when the spec is in the
24
+ // WorkflowSpecCache; { specGraph: null } when declared but not cached;
25
+ // null when nothing is declared.
26
+ import { Hono } from "hono";
27
+ import * as fs from "node:fs";
28
+ import * as path from "node:path";
29
+ import { parseWorkflowSpecRef } from "../domain/slices/slice-indexer.js";
30
+ import { projectSpecGraph } from "../domain/workflow/slice-workflow-projection.js";
31
+ export function missionsRoutes() {
32
+ const app = new Hono();
33
+ app.get("/:missionId", (c) => {
34
+ const indexer = c.get("sliceIndexer");
35
+ if (!indexer) {
36
+ return c.json({
37
+ error: "slices_indexer_unavailable",
38
+ hint: "Mission data layer requires the SliceIndexer to be wired into AppDeps.",
39
+ }, 503);
40
+ }
41
+ if (!indexer.isReady()) {
42
+ return c.json({
43
+ error: "slices_root_not_configured",
44
+ hint: "Run rig config init-workspace, or set workspace.slices_root to workspace/missions. Supported shape: missions/<mission>/slices/<slice>.",
45
+ }, 503);
46
+ }
47
+ const missionId = c.req.param("missionId");
48
+ const allSlices = indexer.list();
49
+ const slices = allSlices.filter((s) => s.missionId === missionId);
50
+ if (slices.length === 0) {
51
+ return c.json({ error: "mission_not_found", missionId }, 404);
52
+ }
53
+ const missionPath = computeMissionPath(slices[0]);
54
+ const workflowSpec = readMissionWorkflowSpec(missionPath);
55
+ const topology = computeMissionTopology(workflowSpec, c.get("workflowSpecCache"));
56
+ const status = readMissionStatus(missionPath);
57
+ return c.json({
58
+ missionId,
59
+ missionPath,
60
+ slices,
61
+ workflow_spec: workflowSpec,
62
+ topology,
63
+ status,
64
+ });
65
+ });
66
+ // Slice 18 §3.5 — Mark mission complete (Getting Started complete-and-hide).
67
+ // Writes `status: complete` to the mission README.md frontmatter; the UI
68
+ // storytelling preview gates on this so completed missions disappear from
69
+ // the band. The daemon is the audit-trail surface; the UI maintains
70
+ // an optimistic local mirror via localStorage so the hide is instant.
71
+ app.post("/:missionId/complete", (c) => {
72
+ const indexer = c.get("sliceIndexer");
73
+ if (!indexer) {
74
+ return c.json({ error: "slices_indexer_unavailable" }, 503);
75
+ }
76
+ const missionId = c.req.param("missionId");
77
+ const allSlices = indexer.list();
78
+ const slices = allSlices.filter((s) => s.missionId === missionId);
79
+ if (slices.length === 0) {
80
+ return c.json({ error: "mission_not_found", missionId }, 404);
81
+ }
82
+ const missionPath = computeMissionPath(slices[0]);
83
+ try {
84
+ writeMissionStatusComplete(missionPath);
85
+ }
86
+ catch (err) {
87
+ return c.json({
88
+ error: "mission_complete_write_failed",
89
+ missionId,
90
+ message: err.message,
91
+ }, 500);
92
+ }
93
+ return c.json({ missionId, status: "complete" });
94
+ });
95
+ return app;
96
+ }
97
+ /** Slice 18 §3.5 — write `status: complete` to a mission README's
98
+ * frontmatter, creating the frontmatter block when absent and
99
+ * replacing an existing status field when present. Idempotent.
100
+ * Preserves unrelated frontmatter fields. */
101
+ function writeMissionStatusComplete(missionPath) {
102
+ const readmePath = path.join(missionPath, "README.md");
103
+ let body = fs.existsSync(readmePath) ? fs.readFileSync(readmePath, "utf-8") : "";
104
+ const fmMatch = body.match(/^---\r?\n([\s\S]*?)\r?\n---/);
105
+ if (fmMatch) {
106
+ const fmInner = fmMatch[1] ?? "";
107
+ const statusLineRegex = /^\s*status\s*:\s*[^\r\n]*$/m;
108
+ let newFm;
109
+ if (statusLineRegex.test(fmInner)) {
110
+ newFm = fmInner.replace(statusLineRegex, "status: complete");
111
+ }
112
+ else {
113
+ newFm = fmInner.trimEnd() + "\nstatus: complete";
114
+ }
115
+ body = body.replace(fmMatch[0], `---\n${newFm}\n---`);
116
+ }
117
+ else {
118
+ body = `---\nstatus: complete\n---\n${body}`;
119
+ }
120
+ fs.writeFileSync(readmePath, body);
121
+ }
122
+ /** Derive the mission folder's absolute path from any slice's
123
+ * `slicePath`. Slices live at
124
+ * `<missionsRoot>/<missionId>/slices/<sliceName>` per the workspace
125
+ * contract, so going up two levels yields the mission folder. */
126
+ function computeMissionPath(slice) {
127
+ return path.resolve(slice.slicePath, "..", "..");
128
+ }
129
+ /** Slice 18 §3.5 — parse the `status` field from the mission README's
130
+ * frontmatter. Returns the string when present (no enum validation —
131
+ * v0 callers care primarily about the "complete" value but other
132
+ * workflow states may appear), or null when the README is missing /
133
+ * the field is absent. Powers the durable storytelling-filter for
134
+ * Getting Started complete-and-hide. */
135
+ function readMissionStatus(missionPath) {
136
+ const readmePath = path.join(missionPath, "README.md");
137
+ if (!fs.existsSync(readmePath))
138
+ return null;
139
+ const raw = fs.readFileSync(readmePath, "utf-8");
140
+ const fm = parseSimpleFrontmatter(raw);
141
+ const value = fm["status"];
142
+ return typeof value === "string" && value.length > 0 ? value : null;
143
+ }
144
+ /** V0.3.1 slice 13 walk-item 7 — parse `workflow_spec` from the mission
145
+ * README's frontmatter. Returns null when the README is missing or the
146
+ * field is absent / malformed. Uses the same parseWorkflowSpecRef
147
+ * helper the slice-indexer uses so both surfaces stay in lockstep. */
148
+ function readMissionWorkflowSpec(missionPath) {
149
+ const readmePath = path.join(missionPath, "README.md");
150
+ if (!fs.existsSync(readmePath))
151
+ return null;
152
+ const raw = fs.readFileSync(readmePath, "utf-8");
153
+ const fm = parseSimpleFrontmatter(raw);
154
+ return parseWorkflowSpecRef(fm["workflow_spec"]);
155
+ }
156
+ /** Minimal frontmatter parser. The slice-indexer's parseFrontmatter is
157
+ * private; duplicating the v0 shape here is cheaper than exposing
158
+ * internal API and keeps the missions route's surface minimal. */
159
+ function parseSimpleFrontmatter(text) {
160
+ const m = text.match(/^---\r?\n([\s\S]*?)\r?\n---/);
161
+ if (!m)
162
+ return {};
163
+ const out = {};
164
+ for (const line of m[1].split(/\r?\n/)) {
165
+ const trimmed = line.trim();
166
+ if (!trimmed || trimmed.startsWith("#"))
167
+ continue;
168
+ const colonIdx = trimmed.indexOf(":");
169
+ if (colonIdx === -1)
170
+ continue;
171
+ const key = trimmed.slice(0, colonIdx).trim();
172
+ let value = trimmed.slice(colonIdx + 1).trim();
173
+ if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
174
+ value = value.slice(1, -1);
175
+ }
176
+ out[key] = value;
177
+ }
178
+ return out;
179
+ }
180
+ /** V0.3.1 slice 13 walk-item 7 — project the spec graph when both the
181
+ * declaration AND the cached spec are present. Returns the topology
182
+ * envelope with `specGraph: null` when declared but not yet cached;
183
+ * returns `null` for the whole envelope when nothing is declared. */
184
+ function computeMissionTopology(workflowSpec, specCache) {
185
+ if (!workflowSpec)
186
+ return null;
187
+ if (!specCache)
188
+ return { specGraph: null };
189
+ const row = specCache.getByNameVersion(workflowSpec.name, workflowSpec.version);
190
+ if (!row)
191
+ return { specGraph: null };
192
+ // WorkflowSpecRow.spec is the WorkflowSpec object the projector expects.
193
+ return { specGraph: projectSpecGraph(row.spec, null) };
194
+ }
195
+ //# sourceMappingURL=missions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"missions.js","sourceRoot":"","sources":["../../src/routes/missions.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,wEAAwE;AACxE,mCAAmC;AACnC,EAAE;AACF,qEAAqE;AACrE,wEAAwE;AACxE,yEAAyE;AACzE,wEAAwE;AACxE,2DAA2D;AAC3D,EAAE;AACF,WAAW;AACX,UAAU;AACV,sCAAsC;AACtC,+CAA+C;AAC/C,8DAA8D;AAC9D,MAAM;AACN,4DAA4D;AAC5D,uEAAuE;AACvE,uEAAuE;AACvE,EAAE;AACF,0EAA0E;AAC1E,sEAAsE;AACtE,qEAAqE;AACrE,uEAAuE;AACvE,iCAAiC;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAMlC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE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AAG,GAAG,SAAS,CAAC,gBAAgB,CAAC,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAChF,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACrC,yEAAyE;IACzE,OAAO,EAAE,SAAS,EAAE,gBAAgB,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;AACzD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Hono } from "hono";
2
+ export declare function pluginsRoutes(): Hono;
3
+ //# sourceMappingURL=plugins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/routes/plugins.ts"],"names":[],"mappings":"AAwCA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAkE5B,wBAAgB,aAAa,IAAI,IAAI,CA4HpC"}
@@ -0,0 +1,223 @@
1
+ // Phase 3a slice 3.3 — Plugins HTTP routes (read-only).
2
+ //
3
+ // SC-29 EXCEPTION #8 declared verbatim:
4
+ // "Slice 3.3 (UI plugin surface) requires daemon-side plugin-discovery-service
5
+ // + 3 HTTP routes (GET /api/plugins, GET /api/plugins/:id, GET /api/plugins/:id/used-by)
6
+ // as backing API. No additional state, no SQL migration, no mutation routes.
7
+ // Read-only discovery surface aggregating filesystem-scan unions per
8
+ // DESIGN.md §5.4. Per IMPL-PRD §3.3 'Code touches' this allocation is explicit;
9
+ // documenting in compliance with banked SC-29 verbatim-declaration rule."
10
+ //
11
+ // SC-29 EXCEPTION #11 (slice 28 library-explorer-finishing) declared verbatim:
12
+ // "Slice 28 (Library Explorer finishing — founder-walk follow-up) requires:
13
+ // (a) two additive read-only HTTP routes — GET /api/plugins/:id/files/list
14
+ // and GET /api/plugins/:id/files/read — that wrap the existing path-safety
15
+ // machinery (resolveAllowedDirectory/File) with the discovered plugin's
16
+ // absolute path acting as a synthetic single-root allowlist. Enables
17
+ // docs-browser file navigation of a plugin's on-disk folder without
18
+ // requiring the operator to allowlist ~/.openrig/plugins/ in
19
+ // OPENRIG_FILES_ALLOWLIST.
20
+ // (b) one PluginEntry shape extension — skillCount: number — populated in
21
+ // detectPlugin() by readdir of <plugin>/skills/. Surfaces skill-count in
22
+ // the plugin list response so PluginsIndexPage can render the column
23
+ // without an N+1 detail fetch per row.
24
+ // No additional state, no SQL migration, no write mutations on plugin
25
+ // folders. Read-only docs-browser surface per slice 28 founder direction
26
+ // 'finishing it is 0.3.1 work, not 0.3.2'. Routing decision
27
+ // qitem-20260513042155-f31c11c3 (orch OPT-A authorization)."
28
+ //
29
+ // Endpoint shape:
30
+ // GET /api/plugins → PluginEntry[] (?runtime=, ?source= filters)
31
+ // GET /api/plugins/:id → PluginDetail (404 when unknown)
32
+ // GET /api/plugins/:id/used-by → AgentReference[]
33
+ // GET /api/plugins/:id/files/list?path=<rel> → FilesListResponse (slice 28)
34
+ // GET /api/plugins/:id/files/read?path=<rel> → FilesReadResponse (slice 28)
35
+ //
36
+ // All endpoints return 503 when the service is not provisioned in context
37
+ // (consistent with the existing daemon route pattern for optional services).
38
+ // /files/list + /files/read use the discovered plugin path as a synthetic
39
+ // AllowlistRoot + reuse resolveAllowedDirectory/File for path-safety.
40
+ import { Hono } from "hono";
41
+ import * as fs from "node:fs";
42
+ import * as path from "node:path";
43
+ import { resolveAllowedDirectory, resolveAllowedFile, FilePathSafetyError, } from "../domain/files/path-safety.js";
44
+ import { sha256Hex } from "../domain/files/file-write-service.js";
45
+ import { FILE_READ_TRUNCATION_BYTES } from "./files.js";
46
+ function getService(c) {
47
+ return c.get("pluginDiscoveryService");
48
+ }
49
+ function parseRuntimeFilter(value) {
50
+ if (value === "claude" || value === "codex")
51
+ return value;
52
+ return undefined;
53
+ }
54
+ function parseSourceFilter(value) {
55
+ if (value === "vendored" || value === "claude-cache" || value === "codex-cache")
56
+ return value;
57
+ return undefined;
58
+ }
59
+ function pluginRootAllowlist(absolutePath) {
60
+ // Synthetic single-root allowlist scoped to the plugin's folder.
61
+ // Reuses the existing path-safety helpers for ../ escape / symlink
62
+ // realpath containment checks without any allowlist env-var coupling
63
+ // (operator does not need to declare plugin paths in OPENRIG_FILES_ALLOWLIST).
64
+ //
65
+ // Normalize via fs.realpathSync so the containment check (realpath vs
66
+ // canonicalPath) holds on platforms where the input path is itself
67
+ // a symlink chain (e.g. macOS /tmp → /private/tmp, /var/folders →
68
+ // /private/var/folders). Matches decodeAllowlist's normalization in
69
+ // path-safety.ts.
70
+ let canonical;
71
+ try {
72
+ canonical = fs.realpathSync(absolutePath);
73
+ }
74
+ catch {
75
+ canonical = path.resolve(absolutePath);
76
+ }
77
+ return [{ name: "plugin", canonicalPath: canonical }];
78
+ }
79
+ function pathSafetyErrorResponse(c, err) {
80
+ const status = err.code === "root_unknown" ? 400
81
+ : err.code === "path_invalid" || err.code === "path_escape" ? 400
82
+ : err.code === "stat_failed" ? 404
83
+ : err.code === "not_a_file" || err.code === "not_a_directory" ? 400
84
+ : 500;
85
+ return c.json({ error: err.code, message: err.message, ...(err.details ?? {}) }, status);
86
+ }
87
+ export function pluginsRoutes() {
88
+ const router = new Hono();
89
+ // GET / — list discoverable plugins
90
+ router.get("/", (c) => {
91
+ const service = getService(c);
92
+ if (!service)
93
+ return c.json({ error: "plugin_discovery_unavailable" }, 503);
94
+ const runtimeFilter = parseRuntimeFilter(c.req.query("runtime"));
95
+ const sourceFilter = parseSourceFilter(c.req.query("source"));
96
+ // Slice 3.3 fix-C — DESIGN §5.4 union 4th category: rig-bundled
97
+ // <cwd>/.claude/plugins/* + <cwd>/.codex/plugins/*. The API caller
98
+ // (UI in rig context, CLI in slice 3.4) passes ?cwd=<path> when
99
+ // they want the rig-cwd discoveries included; the Library page
100
+ // omits it (cross-cutting view).
101
+ const cwd = c.req.query("cwd");
102
+ const cwdScanRoots = cwd ? [cwd] : undefined;
103
+ const plugins = service.listPlugins({ runtimeFilter, sourceFilter, cwdScanRoots });
104
+ return c.json(plugins);
105
+ });
106
+ // GET /:id/used-by — reverse query for agents referencing this plugin.
107
+ // Mounted BEFORE /:id so the literal sub-path doesn't get eaten by the
108
+ // bare-param catchall (per spec-library-routes Phase A R1 SSE route-order
109
+ // lesson banked in that file).
110
+ router.get("/:id/used-by", (c) => {
111
+ const service = getService(c);
112
+ if (!service)
113
+ return c.json({ error: "plugin_discovery_unavailable" }, 503);
114
+ const id = c.req.param("id");
115
+ return c.json(service.findUsedBy(id));
116
+ });
117
+ // Slice 28 — GET /:id/files/list?path=<rel>
118
+ // Lists directory entries inside the plugin's source folder. Uses the
119
+ // existing path-safety helpers with a synthetic single-root allowlist
120
+ // built from the discovered plugin's absolute path. Mounted BEFORE the
121
+ // bare /:id route (same route-order discipline as /:id/used-by).
122
+ router.get("/:id/files/list", (c) => {
123
+ const service = getService(c);
124
+ if (!service)
125
+ return c.json({ error: "plugin_discovery_unavailable" }, 503);
126
+ const id = c.req.param("id");
127
+ const detail = service.getPlugin(id);
128
+ if (!detail)
129
+ return c.notFound();
130
+ const relativePath = c.req.query("path") ?? "";
131
+ try {
132
+ const allowlist = pluginRootAllowlist(detail.entry.path);
133
+ const resolved = resolveAllowedDirectory(allowlist, "plugin", relativePath);
134
+ const entries = fs.readdirSync(resolved, { withFileTypes: true });
135
+ return c.json({
136
+ pluginId: id,
137
+ path: relativePath,
138
+ entries: entries
139
+ .map((entry) => {
140
+ const fullPath = path.join(resolved, entry.name);
141
+ let stat = null;
142
+ try {
143
+ stat = fs.statSync(fullPath);
144
+ }
145
+ catch { /* skip stat-failed */ }
146
+ return {
147
+ name: entry.name,
148
+ type: entry.isDirectory() ? "dir" : entry.isFile() ? "file" : "other",
149
+ size: stat?.isFile() ? stat.size : null,
150
+ mtime: stat ? stat.mtime.toISOString() : null,
151
+ };
152
+ })
153
+ .sort((a, b) => {
154
+ if (a.type !== b.type)
155
+ return a.type === "dir" ? -1 : 1;
156
+ return a.name.localeCompare(b.name);
157
+ }),
158
+ });
159
+ }
160
+ catch (err) {
161
+ if (err instanceof FilePathSafetyError)
162
+ return pathSafetyErrorResponse(c, err);
163
+ return c.json({ error: "list_failed", message: err instanceof Error ? err.message : String(err) }, 500);
164
+ }
165
+ });
166
+ // Slice 28 — GET /:id/files/read?path=<rel>
167
+ // Reads a file inside the plugin's source folder. Same truncation cap
168
+ // semantics as /api/files/read (FILE_READ_TRUNCATION_BYTES; hash over
169
+ // full content for honest edit-conflict semantics — but plugin folders
170
+ // are read-only at v0 so the hash is informational only).
171
+ router.get("/:id/files/read", (c) => {
172
+ const service = getService(c);
173
+ if (!service)
174
+ return c.json({ error: "plugin_discovery_unavailable" }, 503);
175
+ const id = c.req.param("id");
176
+ const detail = service.getPlugin(id);
177
+ if (!detail)
178
+ return c.notFound();
179
+ const relativePath = c.req.query("path") ?? "";
180
+ if (!relativePath)
181
+ return c.json({ error: "path_required" }, 400);
182
+ try {
183
+ const allowlist = pluginRootAllowlist(detail.entry.path);
184
+ const resolved = resolveAllowedFile(allowlist, "plugin", relativePath);
185
+ const stat = fs.statSync(resolved);
186
+ const fullContent = fs.readFileSync(resolved);
187
+ const truncated = stat.size > FILE_READ_TRUNCATION_BYTES;
188
+ const returnedContent = truncated
189
+ ? fullContent.subarray(0, FILE_READ_TRUNCATION_BYTES)
190
+ : fullContent;
191
+ return c.json({
192
+ pluginId: id,
193
+ path: relativePath,
194
+ absolutePath: resolved,
195
+ content: returnedContent.toString("utf-8"),
196
+ mtime: stat.mtime.toISOString(),
197
+ contentHash: sha256Hex(fullContent),
198
+ size: stat.size,
199
+ truncated,
200
+ truncatedAtBytes: truncated ? FILE_READ_TRUNCATION_BYTES : null,
201
+ totalBytes: stat.size,
202
+ });
203
+ }
204
+ catch (err) {
205
+ if (err instanceof FilePathSafetyError)
206
+ return pathSafetyErrorResponse(c, err);
207
+ return c.json({ error: "read_failed", message: err instanceof Error ? err.message : String(err) }, 500);
208
+ }
209
+ });
210
+ // GET /:id — plugin detail
211
+ router.get("/:id", (c) => {
212
+ const service = getService(c);
213
+ if (!service)
214
+ return c.json({ error: "plugin_discovery_unavailable" }, 503);
215
+ const id = c.req.param("id");
216
+ const detail = service.getPlugin(id);
217
+ if (!detail)
218
+ return c.notFound();
219
+ return c.json(detail);
220
+ });
221
+ return router;
222
+ }
223
+ //# sourceMappingURL=plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/routes/plugins.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,wCAAwC;AACxC,+EAA+E;AAC/E,yFAAyF;AACzF,6EAA6E;AAC7E,qEAAqE;AACrE,gFAAgF;AAChF,0EAA0E;AAC1E,EAAE;AACF,+EAA+E;AAC/E,4EAA4E;AAC5E,2EAA2E;AAC3E,2EAA2E;AAC3E,wEAAwE;AACxE,qEAAqE;AACrE,oEAAoE;AACpE,6DAA6D;AAC7D,2BAA2B;AAC3B,0EAA0E;AAC1E,yEAAyE;AACzE,qEAAqE;AACrE,uCAAuC;AACvC,sEAAsE;AACtE,yEAAyE;AACzE,4DAA4D;AAC5D,6DAA6D;AAC7D,EAAE;AACF,kBAAkB;AAClB,kGAAkG;AAClG,uFAAuF;AACvF,qEAAqE;AACrE,iFAAiF;AACjF,iFAAiF;AACjF,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,0EAA0E;AAC1E,sEAAsE;AAEtE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAMlC,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,GAEpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAIxD,SAAS,UAAU,CAAC,CAAyB;IAC3C,OAAO,CAAC,CAAC,GAAG,CAAC,wBAAi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M,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;QAC1G,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,2BAA2B;IAC3B,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE;QACvB,MAAM,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAC9B,IAAI,CAAC,OAAO;YAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,8BAA8B,EAAE,EAAE,GAAG,CAAC,CAAC;QAC5E,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QACrC,IAAI,CAAC,MAAM;YAAE,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;QACjC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -6,5 +6,23 @@ import { Hono } from "hono";
6
6
  * Hot-potato strict-rejection happens in the domain layer; routes surface
7
7
  * structured errors with the validReasons enum so CLIs can render help.
8
8
  */
9
+ /**
10
+ * OPR.0.3.2.20 — attention-class predicate for the `/list?attention=1`
11
+ * filter. Mirrors the mission-control read layer's semantics so the
12
+ * For You Action-required + Approval lenses agree with the
13
+ * single-pane view:
14
+ *
15
+ * - approval class → tier === "human-gate"
16
+ * - action-required → destinationSession matches
17
+ * /^human(?:-[A-Za-z0-9._-]+)?@(kernel|host)$/
18
+ *
19
+ * Exported so the predicate is a discrete, testable surface. The route
20
+ * layer composes this with the open-state default so only unresolved
21
+ * items appear — closed/done attention items are not surfaced.
22
+ */
23
+ export declare function isAttentionItem(q: {
24
+ tier: string | null;
25
+ destinationSession: string;
26
+ }): boolean;
9
27
  export declare function queueRoutes(): Hono;
10
28
  //# sourceMappingURL=queue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/routes/queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAa5B;;;;;;GAMG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAkdlC"}
1
+ {"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/routes/queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAa5B;;;;;;GAMG;AAEH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,kBAAkB,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAG/F;AAGD,wBAAgB,WAAW,IAAI,IAAI,CA8hBlC"}
@@ -9,6 +9,25 @@ import { InboxHandlerError } from "../domain/inbox-handler.js";
9
9
  * Hot-potato strict-rejection happens in the domain layer; routes surface
10
10
  * structured errors with the validReasons enum so CLIs can render help.
11
11
  */
12
+ /**
13
+ * OPR.0.3.2.20 — attention-class predicate for the `/list?attention=1`
14
+ * filter. Mirrors the mission-control read layer's semantics so the
15
+ * For You Action-required + Approval lenses agree with the
16
+ * single-pane view:
17
+ *
18
+ * - approval class → tier === "human-gate"
19
+ * - action-required → destinationSession matches
20
+ * /^human(?:-[A-Za-z0-9._-]+)?@(kernel|host)$/
21
+ *
22
+ * Exported so the predicate is a discrete, testable surface. The route
23
+ * layer composes this with the open-state default so only unresolved
24
+ * items appear — closed/done attention items are not surfaced.
25
+ */
26
+ export function isAttentionItem(q) {
27
+ if (q.tier === "human-gate")
28
+ return true;
29
+ return /^human(?:-[A-Za-z0-9._-]+)?@(kernel|host)$/.test(q.destinationSession ?? "");
30
+ }
12
31
  export function queueRoutes() {
13
32
  const app = new Hono();
14
33
  function getRepo(c) {
@@ -145,7 +164,29 @@ export function queueRoutes() {
145
164
  return errorResponse(c, err);
146
165
  }
147
166
  });
148
- // POST /:qitemId/update — general state mutator (incl. done)
167
+ // POST /:qitemId/update — general state mutator (incl. done).
168
+ //
169
+ // OPR.0.3.2.21.FR-4(d-docs) — closure ≠ acceptance.
170
+ //
171
+ // `state=done` with `closure_reason=handed_off_to` records that the
172
+ // source seat has DELIVERED the work to the next stage. It does NOT
173
+ // record that the next stage has ACCEPTED the work — that's the next
174
+ // stage's verdict on its own qitem (typically a separate close with
175
+ // its own closure_reason).
176
+ //
177
+ // Closure vocabulary:
178
+ // - handed_off_to delivered to next stage; acceptance pending
179
+ // that stage's verdict on its own qitem
180
+ // - blocked_on waiting on a named blocker (closureTarget)
181
+ // - denied the source seat refuses the work
182
+ // - canceled work no longer needed (no follow-on)
183
+ // - no-follow-on completed in place; no further routing
184
+ // - escalation routed to a higher-authority seat
185
+ //
186
+ // The "accepted" state IS NOT a queue state in v0.3.x — the qitem
187
+ // model captures delivery + the receiving stage owns acceptance as
188
+ // a separate transaction. (FR-4d-state schema change adding a
189
+ // distinct "accepted" state is deferred to release-0.3.3.)
149
190
  app.post("/:qitemId/update", async (c) => {
150
191
  const qitemId = c.req.param("qitemId");
151
192
  const body = await c.req.json().catch(() => ({}));
@@ -260,15 +301,66 @@ export function queueRoutes() {
260
301
  return c.json(getRepo(c).whoami(session, { recentLimit }));
261
302
  });
262
303
  // GET /list — list with filters. MUST precede /:qitemId so the literal path wins.
304
+ //
305
+ // OPR.0.3.2.20 — `?attention=1` filter for the For You priority
306
+ // windowing slice. Returns OPEN attention-class qitems (the durable
307
+ // source of truth for the UI Action-required + Approval lenses) so
308
+ // those surfaces don't depend on the lossy ephemeral client event
309
+ // FIFO. Class membership matches the mission-control read layer
310
+ // semantics: tier='human-gate' OR destination matches
311
+ // /^human(?:-[A-Za-z0-9._-]+)?@(kernel|host)$/. Open state defaults
312
+ // to pending|in-progress|blocked (callers can still override via
313
+ // `state=...`). Composable with destinationSession/sourceSession/
314
+ // targetRepo/limit.
263
315
  app.get("/list", (c) => {
264
316
  const destinationSession = c.req.query("destinationSession") || undefined;
265
317
  const sourceSession = c.req.query("sourceSession") || undefined;
266
318
  const stateRaw = c.req.query("state") || undefined;
267
319
  const targetRepo = c.req.query("targetRepo") || undefined;
268
- const limit = c.req.query("limit") ? Number.parseInt(c.req.query("limit"), 10) : undefined;
269
- const state = stateRaw ? stateRaw.split(",") : undefined;
270
- const items = getRepo(c).list({ destinationSession, sourceSession, state, targetRepo, limit });
271
- return c.json(items);
320
+ const userLimit = c.req.query("limit") ? Number.parseInt(c.req.query("limit"), 10) : undefined;
321
+ const attention = c.req.query("attention") === "1";
322
+ const state = stateRaw
323
+ ? stateRaw.split(",")
324
+ : attention
325
+ ? ["pending", "in-progress", "blocked"]
326
+ : undefined;
327
+ if (!attention) {
328
+ const items = getRepo(c).list({
329
+ destinationSession,
330
+ sourceSession,
331
+ state,
332
+ targetRepo,
333
+ limit: userLimit,
334
+ });
335
+ return c.json(items);
336
+ }
337
+ // OPR.0.3.2.20 — attention path goes through
338
+ // QueueRepository.listAttention, which pushes the attention
339
+ // predicate INTO the SQL WHERE clause so the LIMIT applies AFTER
340
+ // attention filtering. Window-independent by construction: an
341
+ // old human-gate item is never evicted by routine open qitems,
342
+ // however many of them land after it (guard re-verify
343
+ // qitem-20260518190827 BLOCKER 1). The earlier fetch-then-filter
344
+ // shape (ATTENTION_FETCH_BOUND) is gone — the LIMIT bound is the
345
+ // user-facing one only, applied at the SQL layer post-predicate.
346
+ //
347
+ // destinationSession/sourceSession/targetRepo are composable with
348
+ // the attention predicate at the SQL layer (guard re-verify
349
+ // qitem-20260518192210 BLOCKER 1 — the previous forward-fix
350
+ // dropped composition). Scoped attention queries (e.g.,
351
+ // attention=1&destinationSession=...) return ONLY the matching
352
+ // attention items.
353
+ const items = getRepo(c).listAttention({
354
+ limit: userLimit,
355
+ state,
356
+ destinationSession,
357
+ sourceSession,
358
+ targetRepo,
359
+ });
360
+ // Defense-in-depth: refine with the JS predicate so the SQL
361
+ // LIKE superset cannot leak a malformed destination through.
362
+ const filtered = items.filter(isAttentionItem);
363
+ return c.json(filtered);
272
364
  });
273
365
  // GET /overdue — surfaces in-progress qitems past closure_required_at.
274
366
  // MUST precede /:qitemId.