supipowers 1.5.3 → 2.0.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 (340) hide show
  1. package/README.md +14 -8
  2. package/bin/install.mjs +20 -5
  3. package/bin/install.ts +95 -0
  4. package/package.json +8 -4
  5. package/skills/context-mode/SKILL.md +17 -10
  6. package/skills/harness/SKILL.md +94 -0
  7. package/skills/ui-design/SKILL.md +63 -0
  8. package/skills/ui-design/sub-agent-templates/component-builder.md +29 -0
  9. package/skills/ui-design/sub-agent-templates/design-critic.md +46 -0
  10. package/skills/ui-design/sub-agent-templates/pencil/component-builder.md +29 -0
  11. package/skills/ui-design/sub-agent-templates/pencil/design-critic.md +42 -0
  12. package/skills/ui-design/sub-agent-templates/pencil/section-assembler.md +27 -0
  13. package/skills/ui-design/sub-agent-templates/section-assembler.md +27 -0
  14. package/skills/ultraplan-discover/SKILL.md +96 -0
  15. package/skills/ultraplan-intake/SKILL.md +89 -0
  16. package/skills/ultraplan-research/SKILL.md +129 -0
  17. package/skills/ultraplan-review/SKILL.md +86 -0
  18. package/skills/ultraplan-review-scope/SKILL.md +111 -0
  19. package/skills/ultraplan-review-structure/SKILL.md +120 -0
  20. package/skills/ultraplan-review-tdd/SKILL.md +142 -0
  21. package/skills/ultraplan-scout/SKILL.md +110 -0
  22. package/skills/ultraplan-synthesize/SKILL.md +124 -0
  23. package/src/{quality/ai-session.ts → ai/final-message.ts} +27 -0
  24. package/src/ai/schema-text.ts +129 -0
  25. package/src/ai/structured-output.ts +274 -0
  26. package/src/ai/template.ts +27 -0
  27. package/src/bootstrap.ts +63 -28
  28. package/src/commands/agents.ts +131 -42
  29. package/src/commands/ai-review.ts +251 -30
  30. package/src/commands/clear.ts +434 -0
  31. package/src/commands/commit.ts +1 -0
  32. package/src/commands/config.ts +242 -44
  33. package/src/commands/context.ts +55 -28
  34. package/src/commands/doctor.ts +234 -6
  35. package/src/commands/fix-pr.ts +306 -131
  36. package/src/commands/generate.ts +111 -21
  37. package/src/commands/memory.ts +192 -0
  38. package/src/commands/model-picker.ts +28 -21
  39. package/src/commands/model.ts +18 -8
  40. package/src/commands/optimize-context.ts +408 -29
  41. package/src/commands/plan.ts +2 -0
  42. package/src/commands/qa.ts +312 -137
  43. package/src/commands/release.ts +259 -76
  44. package/src/commands/review.ts +293 -59
  45. package/src/commands/status.ts +200 -13
  46. package/src/commands/supi.ts +3 -35
  47. package/src/commands/ui-design.ts +394 -0
  48. package/src/commands/ultraplan.ts +1518 -0
  49. package/src/commands/update.ts +86 -0
  50. package/src/config/defaults.ts +62 -0
  51. package/src/config/loader.ts +448 -60
  52. package/src/config/schema.ts +108 -2
  53. package/src/context/optimizer.ts +25 -33
  54. package/src/context/rule-renderer.ts +223 -0
  55. package/src/context/savings.ts +258 -0
  56. package/src/context/startup-check.ts +380 -0
  57. package/src/context/startup-optimizer.ts +355 -0
  58. package/src/context/tokenignore.ts +146 -0
  59. package/src/context-mode/cache-handle.ts +49 -0
  60. package/src/context-mode/cache-preview.ts +71 -0
  61. package/src/context-mode/cache-store.ts +738 -0
  62. package/src/context-mode/compressor.ts +131 -26
  63. package/src/context-mode/dedup.ts +108 -0
  64. package/src/context-mode/detector.ts +35 -4
  65. package/src/context-mode/event-extractor.ts +14 -12
  66. package/src/context-mode/event-store.ts +91 -36
  67. package/src/context-mode/hooks.ts +798 -56
  68. package/src/context-mode/knowledge/store.ts +255 -11
  69. package/src/context-mode/memory-store.ts +325 -0
  70. package/src/context-mode/metrics-recorder.ts +158 -0
  71. package/src/context-mode/metrics-store.ts +765 -0
  72. package/src/context-mode/model.ts +24 -0
  73. package/src/context-mode/processor-keys.ts +29 -0
  74. package/src/context-mode/processors/build.ts +66 -0
  75. package/src/context-mode/processors/docker.ts +57 -0
  76. package/src/context-mode/processors/git.ts +111 -0
  77. package/src/context-mode/processors/json.ts +112 -0
  78. package/src/context-mode/processors/k8s.ts +67 -0
  79. package/src/context-mode/processors/lint.ts +67 -0
  80. package/src/context-mode/processors/log.ts +86 -0
  81. package/src/context-mode/processors/registry.ts +116 -0
  82. package/src/context-mode/processors/test-runner.ts +102 -0
  83. package/src/context-mode/processors/types.ts +20 -0
  84. package/src/context-mode/repomap.ts +400 -0
  85. package/src/context-mode/routing.ts +97 -24
  86. package/src/context-mode/sandbox/runners.ts +5 -1
  87. package/src/context-mode/snapshot-builder.ts +106 -11
  88. package/src/context-mode/source-hash.ts +173 -0
  89. package/src/context-mode/tool-name.ts +11 -0
  90. package/src/context-mode/tools.ts +654 -22
  91. package/src/context-mode/web/fetcher.ts +31 -12
  92. package/src/debug/logger.ts +2 -1
  93. package/src/deps/registry.ts +1 -1
  94. package/src/discipline/failure-summarizer.ts +170 -0
  95. package/src/discipline/failure-taxonomy.ts +131 -0
  96. package/src/discipline/workflow-invariants.ts +125 -0
  97. package/src/discovery/index.ts +31 -0
  98. package/src/discovery/lsp.ts +87 -0
  99. package/src/discovery/rank.ts +144 -0
  100. package/src/discovery/sources.ts +89 -0
  101. package/src/discovery/workflow.ts +87 -0
  102. package/src/docs/contracts.ts +39 -0
  103. package/src/docs/drift.ts +117 -87
  104. package/src/fix-pr/assessment.ts +200 -0
  105. package/src/fix-pr/contracts.ts +47 -0
  106. package/src/fix-pr/fetch-comments.ts +80 -0
  107. package/src/fix-pr/prompt-builder.ts +58 -40
  108. package/src/fix-pr/scripts/exec.ts +34 -0
  109. package/src/fix-pr/scripts/trigger-review.ts +106 -0
  110. package/src/fix-pr/scripts/wait-and-check.ts +108 -0
  111. package/src/fix-pr/types.ts +4 -0
  112. package/src/git/branch-finish.ts +5 -0
  113. package/src/git/commit-contract.ts +83 -0
  114. package/src/git/commit.ts +121 -184
  115. package/src/git/status.ts +62 -8
  116. package/src/harness/anti_slop/architecture-parser.ts +210 -0
  117. package/src/harness/anti_slop/backend-factory.ts +30 -0
  118. package/src/harness/anti_slop/backend.ts +140 -0
  119. package/src/harness/anti_slop/desloppify-adapter.ts +319 -0
  120. package/src/harness/anti_slop/fallow-adapter.ts +305 -0
  121. package/src/harness/anti_slop/installer.ts +227 -0
  122. package/src/harness/anti_slop/queue.ts +216 -0
  123. package/src/harness/anti_slop/recommend.ts +84 -0
  124. package/src/harness/anti_slop/score.ts +180 -0
  125. package/src/harness/anti_slop/synthetic-edit-test.ts +128 -0
  126. package/src/harness/artifacts/agents-md.ts +88 -0
  127. package/src/harness/artifacts/checks-wiring.ts +57 -0
  128. package/src/harness/artifacts/docs-tree.ts +79 -0
  129. package/src/harness/artifacts/lint-configs.ts +136 -0
  130. package/src/harness/artifacts/review-agents.ts +67 -0
  131. package/src/harness/bare-entry.ts +108 -0
  132. package/src/harness/command.ts +1010 -0
  133. package/src/harness/default-agents/design.md +23 -0
  134. package/src/harness/default-agents/discover.md +18 -0
  135. package/src/harness/default-agents/implement.md +24 -0
  136. package/src/harness/default-agents/plan.md +19 -0
  137. package/src/harness/default-agents/research.md +21 -0
  138. package/src/harness/default-agents/validate.md +22 -0
  139. package/src/harness/gc/reporter.ts +28 -0
  140. package/src/harness/gc/runner.ts +136 -0
  141. package/src/harness/hooks/layer-context-inject.ts +155 -0
  142. package/src/harness/hooks/post-session-sweep.ts +130 -0
  143. package/src/harness/hooks/pre-edit-dupe-probe.ts +224 -0
  144. package/src/harness/hooks/register.ts +118 -0
  145. package/src/harness/model.ts +117 -0
  146. package/src/harness/pipeline.ts +348 -0
  147. package/src/harness/project-paths.ts +235 -0
  148. package/src/harness/stage-runner.ts +107 -0
  149. package/src/harness/stages/design.ts +386 -0
  150. package/src/harness/stages/discover.ts +454 -0
  151. package/src/harness/stages/implement.ts +162 -0
  152. package/src/harness/stages/plan.ts +335 -0
  153. package/src/harness/stages/research.ts +263 -0
  154. package/src/harness/stages/validate.ts +684 -0
  155. package/src/harness/storage.ts +467 -0
  156. package/src/harness/tools.ts +426 -0
  157. package/src/lsp/bridge.ts +56 -95
  158. package/src/lsp/capabilities.ts +108 -0
  159. package/src/lsp/contracts.ts +35 -0
  160. package/src/lsp/detector.ts +8 -12
  161. package/src/markdown-frontmatter.ts +68 -0
  162. package/src/mempalace/bridge.ts +129 -0
  163. package/src/mempalace/config.ts +75 -0
  164. package/src/mempalace/format.ts +163 -0
  165. package/src/mempalace/hooks.ts +370 -0
  166. package/src/mempalace/installer-helper.ts +194 -0
  167. package/src/mempalace/python/mempalace_bridge.py +440 -0
  168. package/src/mempalace/runtime.ts +565 -0
  169. package/src/mempalace/schema.ts +264 -0
  170. package/src/mempalace/session-summary.ts +198 -0
  171. package/src/mempalace/tool.ts +186 -0
  172. package/src/mempalace/uv.ts +256 -0
  173. package/src/migrate/runner.ts +354 -0
  174. package/src/planning/approval-flow.ts +206 -9
  175. package/src/planning/plan-writer-prompt.ts +4 -3
  176. package/src/planning/planning-ask-tool.ts +39 -0
  177. package/src/planning/render-markdown.ts +74 -0
  178. package/src/planning/spec.ts +42 -0
  179. package/src/planning/system-prompt.ts +11 -8
  180. package/src/planning/validate.ts +84 -0
  181. package/src/platform/omp.ts +15 -2
  182. package/src/platform/system-prompt.ts +37 -0
  183. package/src/platform/test-utils.ts +3 -0
  184. package/src/platform/types.ts +6 -1
  185. package/src/qa/config.ts +12 -6
  186. package/src/qa/detect-app-type.ts +13 -6
  187. package/src/qa/matrix.ts +12 -6
  188. package/src/qa/prompt-builder.ts +28 -30
  189. package/src/qa/scripts/dev-server-utils.ts +72 -0
  190. package/src/qa/scripts/run-e2e-tests.ts +226 -0
  191. package/src/qa/scripts/start-dev-server.ts +138 -0
  192. package/src/qa/scripts/stop-dev-server.ts +77 -0
  193. package/src/qa/session.ts +13 -7
  194. package/src/quality/ai-setup.ts +27 -25
  195. package/src/quality/contracts.ts +34 -0
  196. package/src/quality/gates/ai-review.ts +20 -58
  197. package/src/quality/gates/command.ts +249 -46
  198. package/src/quality/review-gates.ts +18 -2
  199. package/src/quality/runner.ts +63 -22
  200. package/src/quality/schemas.ts +37 -2
  201. package/src/quality/setup.ts +96 -16
  202. package/src/release/changelog.ts +1 -1
  203. package/src/release/channels/custom.ts +13 -3
  204. package/src/release/channels/types.ts +5 -0
  205. package/src/release/contracts.ts +90 -0
  206. package/src/release/executor.ts +122 -45
  207. package/src/release/prompt.ts +18 -2
  208. package/src/release/targets.ts +86 -0
  209. package/src/release/version.ts +96 -71
  210. package/src/review/agent-loader.ts +221 -109
  211. package/src/review/fixer.ts +10 -6
  212. package/src/review/multi-agent-runner.ts +114 -13
  213. package/src/review/output.ts +12 -139
  214. package/src/review/runner.ts +12 -6
  215. package/src/review/scope.ts +144 -24
  216. package/src/review/types.ts +1 -20
  217. package/src/review/validator.ts +12 -6
  218. package/src/storage/fix-pr-sessions.ts +21 -14
  219. package/src/storage/plans.ts +14 -5
  220. package/src/storage/qa-sessions.ts +25 -19
  221. package/src/storage/reliability-metrics.ts +180 -0
  222. package/src/storage/reports.ts +8 -7
  223. package/src/storage/review-sessions.ts +55 -20
  224. package/src/tool-catalog/active-tool-controller.ts +164 -0
  225. package/src/tool-catalog/active-tool-planner.ts +212 -0
  226. package/src/tool-catalog/tool-groups.ts +102 -0
  227. package/src/types.ts +1399 -5
  228. package/src/ui-design/backend-adapter.ts +78 -0
  229. package/src/ui-design/backends/local-html.ts +82 -0
  230. package/src/ui-design/backends/pencil-mcp.ts +111 -0
  231. package/src/ui-design/components-scanner.ts +124 -0
  232. package/src/ui-design/config.ts +55 -0
  233. package/src/ui-design/pen-scanner.ts +95 -0
  234. package/src/ui-design/pen-selector.ts +72 -0
  235. package/src/ui-design/prompt-builder.ts +73 -0
  236. package/src/ui-design/scanner.ts +136 -0
  237. package/src/ui-design/session.ts +974 -0
  238. package/src/ui-design/system-prompt.ts +312 -0
  239. package/src/ui-design/tokens-scanner.ts +181 -0
  240. package/src/ui-design/types.ts +96 -0
  241. package/src/ultraplan/agent-catalog.ts +522 -0
  242. package/src/ultraplan/authoring/agent-catalog.ts +310 -0
  243. package/src/ultraplan/authoring/authoring-tools.ts +552 -0
  244. package/src/ultraplan/authoring/command-handlers.ts +339 -0
  245. package/src/ultraplan/authoring/markdown.ts +510 -0
  246. package/src/ultraplan/authoring/model.ts +162 -0
  247. package/src/ultraplan/authoring/pipeline.ts +319 -0
  248. package/src/ultraplan/authoring/stage-runner.ts +141 -0
  249. package/src/ultraplan/authoring/stages/approve.ts +249 -0
  250. package/src/ultraplan/authoring/stages/discover.ts +289 -0
  251. package/src/ultraplan/authoring/stages/intake.ts +203 -0
  252. package/src/ultraplan/authoring/stages/research.ts +399 -0
  253. package/src/ultraplan/authoring/stages/review.ts +333 -0
  254. package/src/ultraplan/authoring/stages/scout.ts +188 -0
  255. package/src/ultraplan/authoring/stages/synthesize.ts +348 -0
  256. package/src/ultraplan/authoring/storage.ts +594 -0
  257. package/src/ultraplan/authoring/synth-gate.ts +165 -0
  258. package/src/ultraplan/authoring-draft.ts +653 -0
  259. package/src/ultraplan/authoring-persist.ts +180 -0
  260. package/src/ultraplan/authoring-tool.ts +608 -0
  261. package/src/ultraplan/authoring-wizard.ts +587 -0
  262. package/src/ultraplan/batch/merge.ts +98 -0
  263. package/src/ultraplan/batch/planner.ts +150 -0
  264. package/src/ultraplan/batch/presenter.ts +97 -0
  265. package/src/ultraplan/batch/storage.ts +420 -0
  266. package/src/ultraplan/batch/supervisor.ts +317 -0
  267. package/src/ultraplan/batch/worker.ts +26 -0
  268. package/src/ultraplan/batch/worktree.ts +110 -0
  269. package/src/ultraplan/contracts.ts +1593 -0
  270. package/src/ultraplan/default-agents/authoring/discoverer.md +12 -0
  271. package/src/ultraplan/default-agents/authoring/intake.md +12 -0
  272. package/src/ultraplan/default-agents/authoring/planner.md +12 -0
  273. package/src/ultraplan/default-agents/authoring/researcher.md +12 -0
  274. package/src/ultraplan/default-agents/authoring/scope-checker.md +12 -0
  275. package/src/ultraplan/default-agents/authoring/scout.md +12 -0
  276. package/src/ultraplan/default-agents/authoring/structure-checker.md +12 -0
  277. package/src/ultraplan/default-agents/authoring/tdd-checker.md +12 -0
  278. package/src/ultraplan/default-agents/backend-domain-reviewer.md +10 -0
  279. package/src/ultraplan/default-agents/backend-executor.md +10 -0
  280. package/src/ultraplan/default-agents/backend-stack-reviewer.md +10 -0
  281. package/src/ultraplan/default-agents/backend-tester.md +10 -0
  282. package/src/ultraplan/default-agents/frontend-domain-reviewer.md +10 -0
  283. package/src/ultraplan/default-agents/frontend-executor.md +10 -0
  284. package/src/ultraplan/default-agents/frontend-stack-reviewer.md +10 -0
  285. package/src/ultraplan/default-agents/frontend-tester.md +10 -0
  286. package/src/ultraplan/default-agents/infrastructure-domain-reviewer.md +10 -0
  287. package/src/ultraplan/default-agents/infrastructure-executor.md +10 -0
  288. package/src/ultraplan/default-agents/infrastructure-stack-reviewer.md +10 -0
  289. package/src/ultraplan/default-agents/infrastructure-tester.md +10 -0
  290. package/src/ultraplan/execution/contract.ts +71 -0
  291. package/src/ultraplan/execution/policy.ts +217 -0
  292. package/src/ultraplan/execution/runtime-tools.ts +107 -0
  293. package/src/ultraplan/execution/session-runner.ts +281 -0
  294. package/src/ultraplan/next-router.ts +85 -0
  295. package/src/ultraplan/presenter.ts +359 -0
  296. package/src/ultraplan/project-paths.ts +342 -0
  297. package/src/ultraplan/runtime/active-execution.ts +72 -0
  298. package/src/ultraplan/runtime/apply-mutation.ts +416 -0
  299. package/src/ultraplan/runtime/blockers.ts +243 -0
  300. package/src/ultraplan/runtime/hook-bridge.ts +486 -0
  301. package/src/ultraplan/runtime/launch-context.ts +207 -0
  302. package/src/ultraplan/runtime/migration.ts +524 -0
  303. package/src/ultraplan/runtime/normalize.ts +281 -0
  304. package/src/ultraplan/runtime/proof.ts +260 -0
  305. package/src/ultraplan/runtime/reducer.ts +416 -0
  306. package/src/ultraplan/runtime/repair.ts +251 -0
  307. package/src/ultraplan/runtime/tracker-storage.ts +368 -0
  308. package/src/ultraplan/session-selection.ts +291 -0
  309. package/src/ultraplan/storage.ts +374 -0
  310. package/src/utils/editor.ts +38 -0
  311. package/src/utils/executable.ts +80 -0
  312. package/src/utils/paths.ts +1 -20
  313. package/src/utils/shell.ts +31 -0
  314. package/src/visual/companion.ts +2 -1
  315. package/src/visual/scripts/frame-template.html +60 -0
  316. package/src/visual/scripts/index.js +59 -13
  317. package/src/visual/scripts/package.json +3 -0
  318. package/src/visual/start-server.ts +2 -1
  319. package/src/workspace/git-scope.ts +64 -0
  320. package/src/workspace/locks.ts +23 -0
  321. package/src/workspace/package-manager.ts +117 -0
  322. package/src/workspace/path-mapping.ts +75 -0
  323. package/src/workspace/project-slug.ts +92 -0
  324. package/src/workspace/repo-root.ts +137 -0
  325. package/src/workspace/selector.ts +115 -0
  326. package/src/workspace/state-paths.ts +118 -0
  327. package/src/workspace/targets.ts +313 -0
  328. package/src/fix-pr/scripts/diff-comments.sh +0 -33
  329. package/src/fix-pr/scripts/fetch-pr-comments.sh +0 -25
  330. package/src/fix-pr/scripts/trigger-review.sh +0 -36
  331. package/src/fix-pr/scripts/wait-and-check.sh +0 -37
  332. package/src/qa/scripts/detect-app-type.sh +0 -68
  333. package/src/qa/scripts/discover-routes.sh +0 -143
  334. package/src/qa/scripts/run-e2e-tests.sh +0 -131
  335. package/src/qa/scripts/start-dev-server.sh +0 -46
  336. package/src/qa/scripts/stop-dev-server.sh +0 -36
  337. package/src/review/prompts/fix-output-schema.md +0 -18
  338. package/src/review/prompts/review-output-schema.md +0 -38
  339. package/src/review/template.ts +0 -15
  340. /package/src/{review → ai}/prompts/invalid-output-retry.md +0 -0
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: discoverer
3
+ description: Gray-area capture agent that surfaces ambiguities and deferred ideas before planning
4
+ supportedSlots:
5
+ - discoverer
6
+ focus: ambiguity surfaces, explicit deferrals
7
+ ---
8
+ You are the UltraPlan discoverer agent.
9
+
10
+ You receive the intake artifact and the scout findings. Identify every area where the goal is ambiguous, where design choices are unresolved, or where scope is unclear. For each such area, call `ultraplan_decision_record` once. For ideas that are clearly out of scope for this plan but worth preserving, call `ultraplan_decision_record` with `kind: "deferred"`.
11
+
12
+ Do not attempt to resolve the ambiguities; record them faithfully. Do not call `ultraplan_decision_record` for items that are already clearly settled by the intake. Your output is one `ultraplan_decision_record` call per distinct area.
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: intake
3
+ description: Structured extraction of goal, stacks, and constraints from a user request
4
+ supportedSlots:
5
+ - intake
6
+ focus: goal clarity, constraint completeness
7
+ ---
8
+ You are the UltraPlan intake agent.
9
+
10
+ You receive the raw user goal text. Extract the concrete implementation goal, the applicable stacks (frontend, backend, infrastructure), any explicit constraints, and the domains the work spans. Call `ultraplan_intake_record` exactly once with all extracted fields; do not call it more than once.
11
+
12
+ Do not invent stacks or domains that the request does not imply. If a stack is ambiguous, mark it as inferred and note why. Your only output is the single `ultraplan_intake_record` call.
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: planner
3
+ description: Synthesizer agent that produces the structured UltraPlan draft from all upstream inputs
4
+ supportedSlots:
5
+ - planner
6
+ focus: scenario coverage, dependency ordering, level assignment
7
+ ---
8
+ You are the UltraPlan planner agent.
9
+
10
+ You receive the intake artifact, scout findings, discoverer decisions, and all per-stack research records. Produce a complete UltraPlan draft: one or more stacks, each with domains, each with unit, integration, and e2e scenarios. Assign levels accurately; do not conflate unit tests with integration scenarios. Order scenarios so dependencies come before the steps that rely on them. Call `ultraplan_synth_draft` exactly once with the full authored draft and its manifest; do not call it more than once.
11
+
12
+ Do not drop any domain or stack implied by the intake. Do not invent scenarios unsupported by the scout or research inputs. Your only output is the single `ultraplan_synth_draft` call.
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: researcher
3
+ description: Per-stack research agent that gathers best practices and precedents for one stack
4
+ supportedSlots:
5
+ - researcher
6
+ focus: authoritative sources, codebase precedents, stack-specific constraints
7
+ ---
8
+ You are the UltraPlan researcher agent for a single assigned stack.
9
+
10
+ You receive the intake artifact, scout findings, and your assigned stack (frontend, backend, or infrastructure). Use `web_search`, `read`, and `search` to gather relevant best practices, official documentation patterns, and codebase precedents specific to that stack and the goal. Call `ultraplan_research_record` exactly once with your findings for the assigned stack; do not research other stacks.
11
+
12
+ Cite sources or file paths for every claim. Do not speculate beyond what sources support. Your only output is the single `ultraplan_research_record` call.
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: scope-checker
3
+ description: Scope review agent that flags scenarios outside the stated goal or missing required coverage
4
+ supportedSlots:
5
+ - scope-checker
6
+ focus: goal alignment, coverage gaps, out-of-scope inclusions
7
+ ---
8
+ You are the UltraPlan scope-checker agent.
9
+
10
+ You receive the intake artifact and the synthesized draft. For each scenario, verify that it maps to the stated goal and the domains the intake identified. Flag scenarios that address functionality not requested and flag domains or stacks the intake implied but the draft omits. Call `ultraplan_review_finding` once per finding.
11
+
12
+ If scope is fully aligned, call `ultraplan_review_finding` zero times. Do not flag structural formatting or TDD concerns; those belong to other reviewers. Only report scope mismatches grounded in the intake record.
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: scout
3
+ description: Codebase reconnaissance agent that maps relevant structure before planning
4
+ supportedSlots:
5
+ - scout
6
+ focus: existing patterns, entry points, affected surfaces
7
+ ---
8
+ You are the UltraPlan scout agent.
9
+
10
+ You receive the intake artifact. Use `find`, `search`, and `read` to locate entry points, relevant modules, existing patterns, and surfaces touched by the goal. Identify what already exists that can be reused and what would need to change. Call `ultraplan_scout_record` exactly once with your findings; do not call it more than once.
11
+
12
+ Stay within the directories relevant to the goal. Do not read unrelated subsystems. Your only output is the single `ultraplan_scout_record` call.
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: structure-checker
3
+ description: Structural review agent that flags schema violations and malformed plan anatomy
4
+ supportedSlots:
5
+ - structure-checker
6
+ focus: schema conformance, required fields, level correctness
7
+ ---
8
+ You are the UltraPlan structure-checker agent.
9
+
10
+ You receive the synthesized draft. Verify that every stack, domain, and scenario conforms to the expected schema: required fields are present, levels are one of unit/integration/e2e, scenario ids are unique, and dependency references resolve. For each violation found, call `ultraplan_review_finding` once with the location and the specific structural problem.
11
+
12
+ If the draft is fully conformant, call `ultraplan_review_finding` zero times. Do not flag style preferences or scope concerns; those belong to other reviewers. Only emit findings for objective structural defects.
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: tdd-checker
3
+ description: TDD-ownership review agent that ensures every scenario has a testable acceptance criterion
4
+ supportedSlots:
5
+ - tdd-checker
6
+ focus: testability, acceptance criteria completeness, implementation ordering
7
+ ---
8
+ You are the UltraPlan tdd-checker agent.
9
+
10
+ You receive the synthesized draft. For each scenario, verify that it carries a concrete, testable acceptance criterion and that unit scenarios do not encode implementation details that prevent test-first development. Flag scenarios that are too vague to drive a failing test, scenarios that conflate test ownership across levels, and any scenario that would force implementation before a test can exist. Call `ultraplan_review_finding` once per finding.
11
+
12
+ If all scenarios are TDD-ready, call `ultraplan_review_finding` zero times. Do not flag structural or scope issues; those belong to other reviewers.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: backend-domain-reviewer
3
+ description: Backend domain reviewer for business rules and data truthfulness
4
+ supportedSlots:
5
+ - backend-domain-reviewer
6
+ focus: business rules, data semantics, workflow integrity
7
+ ---
8
+ You are the default UltraPlan backend domain reviewer.
9
+
10
+ Review backend changes for domain correctness. Check that business rules, data semantics, and workflow assumptions still hold under real inputs and failure conditions. Reject code that tells callers a convenient lie.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: backend-executor
3
+ description: Backend implementation agent for services, APIs, and persistence
4
+ supportedSlots:
5
+ - backend-executor
6
+ focus: api behavior, data integrity, failure handling
7
+ ---
8
+ You are the default UltraPlan backend executor.
9
+
10
+ Implement backend changes with truthful contracts. Preserve data integrity, surface failures clearly, and keep interfaces coherent for downstream callers. Prefer direct, maintainable code over compatibility layers or silent fallback behavior.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: backend-stack-reviewer
3
+ description: Backend stack reviewer for architecture, reliability, and maintainability
4
+ supportedSlots:
5
+ - backend-stack-reviewer
6
+ focus: service architecture, reliability, operational correctness
7
+ ---
8
+ You are the default UltraPlan backend stack reviewer.
9
+
10
+ Review backend changes for stack-level quality: architecture boundaries, reliability, operational correctness, and maintainability. Focus on defects that would become incidents, not cosmetic differences.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: backend-tester
3
+ description: Backend testing agent for contract, integration, and regression coverage
4
+ supportedSlots:
5
+ - backend-tester
6
+ focus: api contracts, integration coverage, failure paths
7
+ ---
8
+ You are the default UltraPlan backend tester.
9
+
10
+ Prove backend behavior with tests that exercise contracts, integration boundaries, and failure modes. Target the places where plausible-looking output can hide real bugs, and prefer real execution paths over brittle mocks.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: frontend-domain-reviewer
3
+ description: Frontend domain reviewer for product correctness and UX integrity
4
+ supportedSlots:
5
+ - frontend-domain-reviewer
6
+ focus: product behavior, user flows, domain correctness
7
+ ---
8
+ You are the default UltraPlan frontend domain reviewer.
9
+
10
+ Review frontend work for product correctness. Check whether the implementation matches the intended workflow, preserves user trust, and handles boundary cases honestly. Call out gaps in behavior, not formatting trivia.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: frontend-executor
3
+ description: Frontend implementation agent for application code changes
4
+ supportedSlots:
5
+ - frontend-executor
6
+ focus: ui implementation, state flows, accessible interactions
7
+ ---
8
+ You are the default UltraPlan frontend executor.
9
+
10
+ Implement frontend application changes with production discipline. Favor minimal, coherent edits that keep accessibility, loading states, and error handling truthful. Coordinate with tests and reviewers through clear, maintainable code rather than speculative abstractions.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: frontend-stack-reviewer
3
+ description: Frontend stack reviewer for framework and platform quality
4
+ supportedSlots:
5
+ - frontend-stack-reviewer
6
+ focus: framework conventions, accessibility, performance, maintainability
7
+ ---
8
+ You are the default UltraPlan frontend stack reviewer.
9
+
10
+ Review frontend changes through the lens of stack quality: framework conventions, accessibility, performance, and maintainability. Find the issues that would matter in production, especially hidden regressions and misleading abstractions.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: frontend-tester
3
+ description: Frontend testing agent focused on regressions and edge cases
4
+ supportedSlots:
5
+ - frontend-tester
6
+ focus: unit tests, interaction coverage, regression pressure
7
+ ---
8
+ You are the default UltraPlan frontend tester.
9
+
10
+ Prove frontend behavior before claiming progress. Add or strengthen tests that cover rendering, interaction, edge cases, and failure states. Prefer tests that would fail for a real regression instead of mock-heavy happy-path checks.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: infrastructure-domain-reviewer
3
+ description: Infrastructure domain reviewer for operational policy and deployment intent
4
+ supportedSlots:
5
+ - infrastructure-domain-reviewer
6
+ focus: deployment policy, operational workflows, environment intent
7
+ ---
8
+ You are the default UltraPlan infrastructure domain reviewer.
9
+
10
+ Review infrastructure changes against the intended operational workflow. Check deployment policy, environment expectations, and release safeguards so the system behaves correctly outside the happy path.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: infrastructure-executor
3
+ description: Infrastructure implementation agent for CI, deployment, and platform automation
4
+ supportedSlots:
5
+ - infrastructure-executor
6
+ focus: ci pipelines, automation, environment safety
7
+ ---
8
+ You are the default UltraPlan infrastructure executor.
9
+
10
+ Implement infrastructure changes with cross-platform and operational discipline. Prefer deterministic automation, explicit environment handling, and changes that fail safely when assumptions are violated.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: infrastructure-stack-reviewer
3
+ description: Infrastructure stack reviewer for platform reliability and tooling quality
4
+ supportedSlots:
5
+ - infrastructure-stack-reviewer
6
+ focus: platform reliability, tooling quality, maintainable automation
7
+ ---
8
+ You are the default UltraPlan infrastructure stack reviewer.
9
+
10
+ Review infrastructure changes for platform reliability, tooling quality, and maintainable automation. Find weak assumptions, unsafe defaults, and stack-specific issues before they become operational failures.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: infrastructure-tester
3
+ description: Infrastructure testing agent for automation and release safety
4
+ supportedSlots:
5
+ - infrastructure-tester
6
+ focus: automation validation, release safety, failure rehearsal
7
+ ---
8
+ You are the default UltraPlan infrastructure tester.
9
+
10
+ Test infrastructure work where regressions are expensive: automation, release safety, environment differences, and failure paths. Prefer verification that exercises real scripts and platform behavior instead of assuming configuration is correct.
@@ -0,0 +1,71 @@
1
+ import type {
2
+ ResolvedUltraPlanSlotBinding,
3
+ UltraPlanLaunchContext,
4
+ } from "../../types.js";
5
+ import {
6
+ injectLaunchContextIntoPrompt,
7
+ injectTargetHintIntoPrompt,
8
+ LAUNCH_CONTEXT_METADATA_KEY,
9
+ TARGET_HINT_METADATA_KEY,
10
+ } from "../runtime/launch-context.js";
11
+ import type { UltraPlanExecutionTarget } from "./policy.js";
12
+
13
+ export interface BuildUltraPlanAttemptContractInput {
14
+ slot: ResolvedUltraPlanSlotBinding;
15
+ launchContext: UltraPlanLaunchContext;
16
+ target: UltraPlanExecutionTarget;
17
+ prompt: string;
18
+ }
19
+
20
+ export interface UltraPlanAttemptContract {
21
+ slot: ResolvedUltraPlanSlotBinding;
22
+ launchContext: UltraPlanLaunchContext;
23
+ target: UltraPlanExecutionTarget;
24
+ assignment: string;
25
+ metadata: Record<string, unknown>;
26
+ }
27
+
28
+ export function buildUltraPlanAttemptContract(input: BuildUltraPlanAttemptContractInput): UltraPlanAttemptContract {
29
+ if (input.target.requiredSlot && input.slot.slot !== input.target.requiredSlot) {
30
+ throw new Error(
31
+ `UltraPlan attempt contract slot mismatch: expected ${input.target.requiredSlot}, received ${input.slot.slot}`,
32
+ );
33
+ }
34
+
35
+ const targetHint = {
36
+ targetType: input.target.targetType,
37
+ stack: input.target.stack,
38
+ domainId: input.target.domainId,
39
+ level: input.target.level,
40
+ scenarioId: input.target.scenarioId,
41
+ phase: input.target.phase,
42
+ resolvedSlot: input.target.requiredSlot,
43
+ actorKind: "slot" as const,
44
+ sourceAgent: "sub-agent" as const,
45
+ };
46
+ const metadata = {
47
+ [LAUNCH_CONTEXT_METADATA_KEY]: input.launchContext,
48
+ [TARGET_HINT_METADATA_KEY]: targetHint,
49
+ } satisfies Record<string, unknown>;
50
+
51
+ const assignmentSections = [
52
+ input.prompt.trim(),
53
+ `Reserved slot: ${input.slot.slot}`,
54
+ `Attempt target: ${input.target.summary}`,
55
+ `Phase: ${input.target.phase}`,
56
+ "TDD ownership: own exactly this reserved-slot attempt. In red, establish the failing proof. In green, make the authored target pass with the smallest truthful change. In review, validate and write the required review artifact.",
57
+ "No nested sub-agents. Do not delegate, spawn task agents, batch multiple targets, or widen scope beyond this target.",
58
+ input.target.reviewArtifactPath ? `Review artifact path: ${input.target.reviewArtifactPath}` : null,
59
+ ].filter((section): section is string => section !== null && section.length > 0);
60
+
61
+ const assignmentWithLaunchContext = injectLaunchContextIntoPrompt(assignmentSections.join("\n\n"), input.launchContext);
62
+ const assignment = injectTargetHintIntoPrompt(assignmentWithLaunchContext, targetHint);
63
+
64
+ return {
65
+ slot: input.slot,
66
+ launchContext: input.launchContext,
67
+ target: input.target,
68
+ assignment,
69
+ metadata,
70
+ };
71
+ }
@@ -0,0 +1,217 @@
1
+ import type { PlatformPaths } from "../../platform/types.js";
2
+ import type {
3
+ UltraPlanAgentSlotName,
4
+ UltraPlanAuthoredArtifact,
5
+ UltraPlanCursor,
6
+ UltraPlanExecutionPhase,
7
+ UltraPlanManifest,
8
+ UltraPlanReviewStatus,
9
+ UltraPlanScenario,
10
+ UltraPlanScenarioStatus,
11
+ UltraPlanStack,
12
+ UltraPlanStackId,
13
+ } from "../../types.js";
14
+ import { hasRequiredUltraPlanScenarioProof } from "../contracts.js";
15
+ import {
16
+ getUltraplanDomainReviewPath,
17
+ getUltraplanStackReviewPath,
18
+ } from "../project-paths.js";
19
+
20
+ export interface UltraPlanExecutionReviewMaps {
21
+ domainReviews: ReadonlyMap<UltraPlanStackId, ReadonlyMap<string, UltraPlanReviewStatus>>;
22
+ stackReviews: ReadonlyMap<UltraPlanStackId, UltraPlanReviewStatus>;
23
+ }
24
+
25
+ export interface ResolveNextExecutionTargetInput {
26
+ paths: PlatformPaths;
27
+ cwd: string;
28
+ authored: UltraPlanAuthoredArtifact;
29
+ manifest: UltraPlanManifest;
30
+ reviews?: UltraPlanExecutionReviewMaps;
31
+ }
32
+
33
+ export interface UltraPlanExecutionTarget extends UltraPlanCursor {
34
+ requiredSlot: UltraPlanAgentSlotName | null;
35
+ reviewArtifactPath: string | null;
36
+ }
37
+
38
+ const TERMINAL_SCENARIO_STATUSES = new Set<UltraPlanScenarioStatus>([
39
+ "green-proved",
40
+ "review-passed",
41
+ "done",
42
+ ]);
43
+
44
+ export function resolveNextExecutionTarget(input: ResolveNextExecutionTargetInput): UltraPlanExecutionTarget {
45
+ for (const stack of input.authored.stacks) {
46
+ if (stack.applicability === "not-applicable") {
47
+ continue;
48
+ }
49
+
50
+ const stackTarget = resolveStackTarget(input, stack);
51
+ if (stackTarget) {
52
+ return stackTarget;
53
+ }
54
+ }
55
+
56
+ return {
57
+ targetType: "session",
58
+ stack: null,
59
+ domainId: null,
60
+ level: null,
61
+ scenarioId: null,
62
+ phase: "complete",
63
+ status: "complete",
64
+ summary: "Session complete",
65
+ requiredSlot: null,
66
+ reviewArtifactPath: null,
67
+ };
68
+ }
69
+
70
+ function resolveStackTarget(
71
+ input: ResolveNextExecutionTargetInput,
72
+ stack: UltraPlanStack,
73
+ ): UltraPlanExecutionTarget | null {
74
+ for (const domain of stack.domains) {
75
+ const scenarioTarget =
76
+ resolveScenarioTarget(stack, domain.unit)
77
+ ?? resolveScenarioTarget(stack, domain.integration)
78
+ ?? resolveScenarioTarget(stack, domain.e2e);
79
+
80
+ if (scenarioTarget) {
81
+ return scenarioTarget;
82
+ }
83
+
84
+ if (!stack.agentSlots.domainReviewEnabled || !domain.review.enabled) {
85
+ continue;
86
+ }
87
+
88
+ const reviewStatus = readDomainReviewStatus(input, stack.stack, domain.id) ?? "pending";
89
+ if (reviewStatus !== "passed") {
90
+ const reviewerSlot = stack.agentSlots.domainReviewer?.slot ?? null;
91
+ return {
92
+ targetType: "domain-review",
93
+ stack: stack.stack,
94
+ domainId: domain.id,
95
+ level: null,
96
+ scenarioId: null,
97
+ phase: reviewStatus === "blocked" || reviewerSlot === null ? "waiting" : "review",
98
+ status: reviewerSlot === null ? "blocked" : reviewStatus,
99
+ summary: reviewerSlot === null
100
+ ? `${stack.stack} / ${domain.id} / domain review blocked — missing reviewer slot`
101
+ : `${stack.stack} / ${domain.id} / domain review`,
102
+ requiredSlot: reviewerSlot,
103
+ reviewArtifactPath: getUltraplanDomainReviewPath(input.paths, input.cwd, input.authored.sessionId, stack.stack, domain.id),
104
+ };
105
+ }
106
+ }
107
+
108
+ if (!stack.agentSlots.stackReviewEnabled) {
109
+ return null;
110
+ }
111
+
112
+ const reviewStatus = readStackReviewStatus(input, stack.stack) ?? "pending";
113
+ if (reviewStatus === "passed") {
114
+ return null;
115
+ }
116
+
117
+ const reviewerSlot = stack.agentSlots.stackReviewer?.slot ?? null;
118
+ return {
119
+ targetType: "stack-review",
120
+ stack: stack.stack,
121
+ domainId: null,
122
+ level: null,
123
+ scenarioId: null,
124
+ phase: reviewStatus === "blocked" || reviewerSlot === null ? "waiting" : "review",
125
+ status: reviewerSlot === null ? "blocked" : reviewStatus,
126
+ summary: reviewerSlot === null
127
+ ? `${stack.stack} / stack review blocked — missing reviewer slot`
128
+ : `${stack.stack} / stack review`,
129
+ requiredSlot: reviewerSlot,
130
+ reviewArtifactPath: getUltraplanStackReviewPath(input.paths, input.cwd, input.authored.sessionId, stack.stack),
131
+ };
132
+ }
133
+
134
+ function resolveScenarioTarget(stack: UltraPlanStack, scenarios: readonly UltraPlanScenario[]): UltraPlanExecutionTarget | null {
135
+ for (const scenario of scenarios) {
136
+ if (TERMINAL_SCENARIO_STATUSES.has(scenario.status) && hasRequiredUltraPlanScenarioProof(scenario)) {
137
+ continue;
138
+ }
139
+
140
+ const phase = getScenarioPhase(scenario.status);
141
+ return {
142
+ targetType: "scenario",
143
+ stack: scenario.stack,
144
+ domainId: scenario.domainId,
145
+ level: scenario.level,
146
+ scenarioId: scenario.id,
147
+ phase,
148
+ status: scenario.status,
149
+ summary: `${scenario.stack} / ${scenario.domainId} / ${scenario.level} / ${scenario.title}`,
150
+ requiredSlot: resolveScenarioSlot(stack, scenario.level, phase),
151
+ reviewArtifactPath: null,
152
+ };
153
+ }
154
+
155
+ return null;
156
+ }
157
+
158
+ function resolveScenarioSlot(
159
+ stack: UltraPlanStack,
160
+ level: UltraPlanScenario["level"],
161
+ phase: UltraPlanExecutionPhase,
162
+ ): UltraPlanAgentSlotName | null {
163
+ switch (phase) {
164
+ case "red":
165
+ return level === "unit" ? stack.agentSlots.executor.slot : stack.agentSlots.tester.slot;
166
+ case "green":
167
+ return stack.agentSlots.executor.slot;
168
+ default:
169
+ return null;
170
+ }
171
+ }
172
+
173
+ function readDomainReviewStatus(
174
+ input: ResolveNextExecutionTargetInput,
175
+ stack: UltraPlanStackId,
176
+ domainId: string,
177
+ ): UltraPlanReviewStatus | null {
178
+ const fromMap = input.reviews?.domainReviews.get(stack)?.get(domainId);
179
+ if (fromMap) {
180
+ return fromMap;
181
+ }
182
+
183
+ return input.manifest.reviews.find(
184
+ (review) => review.type === "domain" && review.stack === stack && review.domainId === domainId,
185
+ )?.status ?? null;
186
+ }
187
+
188
+ function readStackReviewStatus(
189
+ input: ResolveNextExecutionTargetInput,
190
+ stack: UltraPlanStackId,
191
+ ): UltraPlanReviewStatus | null {
192
+ const fromMap = input.reviews?.stackReviews.get(stack);
193
+ if (fromMap) {
194
+ return fromMap;
195
+ }
196
+
197
+ return input.manifest.reviews.find((review) => review.type === "stack" && review.stack === stack)?.status ?? null;
198
+ }
199
+
200
+ function getScenarioPhase(status: UltraPlanScenarioStatus): UltraPlanCursor["phase"] {
201
+ switch (status) {
202
+ case "planned":
203
+ case "red-running":
204
+ return "red";
205
+ case "red-proved":
206
+ case "green-running":
207
+ return "green";
208
+ case "in-review":
209
+ return "review";
210
+ case "blocked":
211
+ return "waiting";
212
+ case "green-proved":
213
+ case "review-passed":
214
+ case "done":
215
+ return "complete";
216
+ }
217
+ }
@@ -0,0 +1,107 @@
1
+ import type { Platform } from "../../platform/types.js";
2
+ import {
3
+ readActiveUltraPlanExecution,
4
+ readActiveUltraPlanExecutionForCwd,
5
+ } from "../runtime/active-execution.js";
6
+
7
+ export interface UltraPlanRuntimeSignalProofInput {
8
+ kind: "proof";
9
+ summary: string;
10
+ details?: Record<string, unknown>;
11
+ }
12
+
13
+ export interface UltraPlanRuntimeSignalBlockInput {
14
+ kind: "block" | "await-user";
15
+ code: string;
16
+ summary: string;
17
+ details?: Record<string, unknown>;
18
+ }
19
+
20
+ export type UltraPlanRuntimeSignalInput = UltraPlanRuntimeSignalProofInput | UltraPlanRuntimeSignalBlockInput;
21
+
22
+ export type UltraPlanRuntimeSignalPayload =
23
+ | {
24
+ kind: "proof";
25
+ proof: {
26
+ evidence: {
27
+ summary: string;
28
+ metadata?: Record<string, unknown>;
29
+ };
30
+ };
31
+ }
32
+ | {
33
+ kind: "block" | "await-user";
34
+ blocker: {
35
+ code: string;
36
+ message: string;
37
+ details?: Record<string, unknown>;
38
+ };
39
+ };
40
+
41
+ export function registerUltraPlanRuntimeTools(platform: Platform): void {
42
+ if (!platform.registerTool) {
43
+ return;
44
+ }
45
+
46
+ platform.registerTool({
47
+ name: "ultraplan_signal",
48
+ label: "UltraPlan Signal",
49
+ description: "Report proof, blocker, or await-user outcomes during an active UltraPlan execution attempt.",
50
+ promptSnippet: "ultraplan_signal — emit proof/block/await-user for the active UltraPlan attempt",
51
+ parameters: {
52
+ type: "object",
53
+ properties: {
54
+ kind: { type: "string", enum: ["proof", "block", "await-user"], description: "Signal type" },
55
+ code: { type: "string", description: "Blocker code for block/await-user signals" },
56
+ summary: { type: "string", description: "Human-readable proof summary or blocker message" },
57
+ details: { type: "object", additionalProperties: true, description: "Structured metadata attached to the signal" },
58
+ },
59
+ required: ["kind", "summary"],
60
+ },
61
+ async execute(_toolCallId: string, params: UltraPlanRuntimeSignalInput, _signal: AbortSignal, _onUpdate: unknown, toolCtx: any) {
62
+ const execution = resolveActiveExecution(toolCtx);
63
+ if (!execution) {
64
+ return {
65
+ content: [{ type: "text", text: "Error: ultraplan_signal requires an unambiguous active UltraPlan run." }],
66
+ details: { error: "ultraplan_signal requires an unambiguous active UltraPlan run." },
67
+ };
68
+ }
69
+
70
+ const payload = buildSignalPayload(params);
71
+ return {
72
+ content: [{ type: "text", text: JSON.stringify(payload) }],
73
+ details: { payload, execution },
74
+ };
75
+ },
76
+ });
77
+ }
78
+
79
+ function resolveActiveExecution(toolCtx: unknown) {
80
+ const cwd = typeof (toolCtx as { cwd?: unknown } | null)?.cwd === "string"
81
+ ? ((toolCtx as { cwd?: string }).cwd ?? null)
82
+ : null;
83
+ return cwd === null ? readActiveUltraPlanExecution() : readActiveUltraPlanExecutionForCwd(cwd);
84
+ }
85
+
86
+ function buildSignalPayload(params: UltraPlanRuntimeSignalInput): UltraPlanRuntimeSignalPayload {
87
+ if (params.kind === "proof") {
88
+ return {
89
+ kind: "proof",
90
+ proof: {
91
+ evidence: {
92
+ summary: params.summary,
93
+ ...(params.details ? { metadata: params.details } : {}),
94
+ },
95
+ },
96
+ };
97
+ }
98
+
99
+ return {
100
+ kind: params.kind,
101
+ blocker: {
102
+ code: params.code,
103
+ message: params.summary,
104
+ ...(params.details ? { details: params.details } : {}),
105
+ },
106
+ };
107
+ }