aiwcli 0.15.7 → 0.17.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 (272) hide show
  1. package/README.md +106 -1125
  2. package/bin/run.js +0 -4
  3. package/dist/capabilities/installation/control-plane/clear-command.d.ts +2 -0
  4. package/dist/capabilities/installation/control-plane/clear-command.js +32 -3
  5. package/dist/capabilities/installation/control-plane/init-command.js +2 -2
  6. package/dist/capabilities/launch/contracts.d.ts +39 -4
  7. package/dist/capabilities/launch/control-plane/execute-launch.js +158 -119
  8. package/dist/capabilities/launch/runtime-core/launch-decisions.d.ts +82 -0
  9. package/dist/capabilities/launch/runtime-core/launch-decisions.js +202 -0
  10. package/dist/commands/branch.d.ts +1 -1
  11. package/dist/commands/branch.js +1 -1
  12. package/dist/commands/launch.d.ts +0 -5
  13. package/dist/commands/launch.js +2 -37
  14. package/dist/lib/config.js +1 -2
  15. package/dist/lib/context/context-store.js +28 -2
  16. package/dist/lib/core-installer.d.ts +1 -1
  17. package/dist/lib/core-installer.js +6 -27
  18. package/dist/lib/debug.d.ts +0 -10
  19. package/dist/lib/debug.js +0 -10
  20. package/dist/lib/env-sanitizer.d.ts +25 -0
  21. package/dist/lib/env-sanitizer.js +46 -0
  22. package/dist/lib/errors.d.ts +0 -13
  23. package/dist/lib/errors.js +0 -15
  24. package/dist/lib/git-exclude-manager.js +1 -1
  25. package/dist/lib/hooks/context-monitor-logic.d.ts +6 -0
  26. package/dist/lib/hooks/context-monitor-logic.js +25 -0
  27. package/dist/lib/hooks/hook-utils.js +11 -0
  28. package/dist/lib/hooks/prompt-binding-logic.d.ts +7 -0
  29. package/dist/lib/hooks/prompt-binding-logic.js +50 -0
  30. package/dist/lib/hooks/session-end-logic.js +2 -14
  31. package/dist/lib/install-state.js +6 -13
  32. package/dist/lib/json-io.d.ts +12 -0
  33. package/dist/lib/json-io.js +30 -0
  34. package/dist/lib/multiplexer.d.ts +43 -35
  35. package/dist/lib/multiplexer.js +21 -2
  36. package/dist/lib/multiplexers/psmux.d.ts +14 -34
  37. package/dist/lib/multiplexers/psmux.js +70 -130
  38. package/dist/lib/multiplexers/tmux.d.ts +11 -19
  39. package/dist/lib/multiplexers/tmux.js +79 -120
  40. package/dist/lib/multiplexers/wezterm.d.ts +38 -0
  41. package/dist/lib/multiplexers/wezterm.js +225 -0
  42. package/dist/lib/mux-utils.d.ts +4 -3
  43. package/dist/lib/mux-utils.js +7 -13
  44. package/dist/lib/prompt-file-manager.d.ts +23 -0
  45. package/dist/lib/prompt-file-manager.js +41 -0
  46. package/dist/lib/runtime/agent-launcher.d.ts +67 -0
  47. package/dist/lib/runtime/agent-launcher.js +262 -0
  48. package/dist/lib/runtime/aiw-cli.d.ts +2 -0
  49. package/dist/lib/runtime/aiw-cli.js +3 -1
  50. package/dist/lib/runtime/cli-args.d.ts +5 -2
  51. package/dist/lib/runtime/cli-args.js +18 -3
  52. package/dist/lib/runtime/inference.js +3 -14
  53. package/dist/lib/runtime/models.d.ts +6 -0
  54. package/dist/lib/runtime/models.js +6 -0
  55. package/dist/lib/runtime/state-io.d.ts +2 -1
  56. package/dist/lib/runtime/state-io.js +9 -4
  57. package/dist/lib/runtime/utils.d.ts +8 -0
  58. package/dist/lib/runtime/utils.js +31 -1
  59. package/dist/lib/schemas.d.ts +250 -0
  60. package/dist/lib/schemas.js +216 -0
  61. package/dist/lib/sentinel-manager.d.ts +32 -0
  62. package/dist/lib/sentinel-manager.js +62 -0
  63. package/dist/lib/sentinel-wrapper.d.ts +1 -0
  64. package/dist/lib/sentinel-wrapper.js +12 -3
  65. package/dist/lib/settings-hierarchy.js +3 -20
  66. package/dist/lib/shell-adapters/bash-adapter.d.ts +18 -0
  67. package/dist/lib/shell-adapters/bash-adapter.js +69 -0
  68. package/dist/lib/shell-adapters/index.d.ts +5 -0
  69. package/dist/lib/shell-adapters/index.js +7 -0
  70. package/dist/lib/shell-adapters/powershell-adapter.d.ts +18 -0
  71. package/dist/lib/shell-adapters/powershell-adapter.js +62 -0
  72. package/dist/lib/shell-adapters/shell-adapter.d.ts +45 -0
  73. package/dist/lib/shell-adapters/shell-adapter.js +5 -0
  74. package/dist/lib/spawn-errors.d.ts +3 -0
  75. package/dist/lib/spawn-errors.js +15 -1
  76. package/dist/lib/spinner.d.ts +0 -5
  77. package/dist/lib/spinner.js +0 -16
  78. package/dist/lib/template-installer.d.ts +10 -0
  79. package/dist/lib/template-installer.js +4 -4
  80. package/dist/lib/terminal-strategy.d.ts +1 -0
  81. package/dist/lib/terminal-strategy.js +12 -6
  82. package/dist/lib/terminal.d.ts +7 -5
  83. package/dist/lib/terminal.js +42 -19
  84. package/dist/lib/tmux-primitives.d.ts +0 -2
  85. package/dist/lib/tmux-primitives.js +0 -4
  86. package/dist/lib/tmux-session.js +2 -1
  87. package/dist/lib/windsurf-hooks-hierarchy.js +6 -23
  88. package/dist/platform/launch.d.ts +2 -1
  89. package/dist/platform/launch.js +1 -0
  90. package/dist/templates/CLAUDE.md +0 -1
  91. package/dist/templates/cc-native/.claude/settings.json +0 -10
  92. package/dist/templates/cc-native/TEMPLATE-SCHEMA.md +11 -4
  93. package/dist/templates/cc-native/_cc-native/cc-native.config.json +3 -7
  94. package/dist/templates/cc-native/_cc-native/hooks/CLAUDE.md +26 -47
  95. package/dist/templates/cc-native/_cc-native/hooks/cc-native-plan-review.ts +7 -9
  96. package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_write.ts +2 -3
  97. package/dist/templates/cc-native/_cc-native/hooks/mark_questions_asked.ts +2 -2
  98. package/dist/templates/cc-native/_cc-native/hooks/plan_questions_early.ts +0 -25
  99. package/dist/templates/cc-native/_cc-native/hooks/validate_task_prompt.ts +4 -4
  100. package/dist/templates/cc-native/_cc-native/lib-ts/.mocharc.json +9 -0
  101. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/aggregate-agents.test.ts +118 -0
  102. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/artifacts.test.ts +234 -0
  103. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/cc-native-state.test.ts +170 -0
  104. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/cli-output-parser.test.ts +73 -0
  105. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/config.test.ts +64 -0
  106. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/constants.test.ts +40 -0
  107. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/debug.test.ts +42 -0
  108. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/exports.test.ts +58 -0
  109. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/helpers.ts +107 -0
  110. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/hooks/add-plan-context.hook.test.ts +97 -0
  111. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/hooks/plan-questions.hook.test.ts +81 -0
  112. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/hooks/plan-review.hook.test.ts +71 -0
  113. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/json-parser.test.ts +99 -0
  114. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/orchestrator-agent.test.ts +288 -0
  115. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/orchestrator.test.ts +48 -0
  116. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/reviewers.test.ts +32 -0
  117. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/state.test.ts +124 -0
  118. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/verdict.test.ts +93 -0
  119. package/dist/templates/cc-native/_cc-native/lib-ts/agent-selection.ts +163 -0
  120. package/dist/templates/cc-native/_cc-native/lib-ts/aggregate-agents.ts +6 -14
  121. package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/format.ts +597 -599
  122. package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/index.ts +26 -26
  123. package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/tracker.ts +106 -107
  124. package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/write.ts +118 -119
  125. package/dist/templates/cc-native/_cc-native/lib-ts/artifacts.ts +21 -0
  126. package/dist/templates/cc-native/_cc-native/lib-ts/cc-native-state.ts +16 -15
  127. package/dist/templates/cc-native/_cc-native/lib-ts/cli-output-parser.ts +132 -10
  128. package/dist/templates/cc-native/_cc-native/lib-ts/constants.ts +6 -6
  129. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/corroboration.ts +119 -119
  130. package/dist/templates/cc-native/_cc-native/lib-ts/debug.ts +1 -2
  131. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/graduation.ts +132 -132
  132. package/dist/templates/cc-native/_cc-native/lib-ts/index.ts +88 -86
  133. package/dist/templates/cc-native/_cc-native/lib-ts/json-parser.ts +5 -6
  134. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/orchestrator.ts +70 -70
  135. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/output-builder.ts +130 -121
  136. package/dist/templates/cc-native/_cc-native/lib-ts/package-lock.json +1679 -0
  137. package/dist/templates/cc-native/_cc-native/lib-ts/package.json +24 -0
  138. package/dist/templates/cc-native/_cc-native/lib-ts/plan-discovery.ts +4 -4
  139. package/dist/templates/cc-native/_cc-native/lib-ts/plan-enhancement.ts +1 -6
  140. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/plan-questions.ts +101 -101
  141. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/review-pipeline.ts +511 -543
  142. package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/__tests__/agent-providers.test.ts +262 -0
  143. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/agent.ts +71 -85
  144. package/dist/templates/{core/lib-ts/agent-exec → cc-native/_cc-native/lib-ts/reviewers/base}/base-agent.ts +138 -152
  145. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/index.ts +12 -12
  146. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/claude-agent.ts +66 -57
  147. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/codex-agent.ts +185 -200
  148. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/gemini-agent.ts +39 -40
  149. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/orchestrator-claude-agent.ts +196 -224
  150. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/schemas.ts +201 -201
  151. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/types.ts +21 -23
  152. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/__tests__/hyde.test.ts +365 -0
  153. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/__tests__/ollama-client.test.ts +223 -0
  154. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/embedding-indexer.ts +12 -16
  155. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/hyde.ts +3 -2
  156. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/index.ts +31 -31
  157. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/logger.ts +6 -7
  158. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/ollama-client.ts +7 -9
  159. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/retrieval-pipeline.ts +14 -17
  160. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-indexer.ts +37 -41
  161. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-loader.ts +33 -43
  162. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-searcher.ts +20 -20
  163. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/types.ts +8 -9
  164. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/vector-store.ts +3 -4
  165. package/dist/templates/cc-native/_cc-native/lib-ts/settings.ts +50 -126
  166. package/dist/templates/cc-native/_cc-native/lib-ts/state.ts +19 -21
  167. package/dist/templates/cc-native/_cc-native/lib-ts/types.ts +13 -88
  168. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/verdict.ts +72 -72
  169. package/dist/templates/cc-native/_cc-native/plan-review/CLAUDE.md +35 -0
  170. package/dist/templates/cc-native/_cc-native/plan-review/lib/agent-selection.ts +1 -1
  171. package/dist/templates/cc-native/_cc-native/scripts/council_debate.ts +242 -0
  172. package/dist/templates/cc-native/_cc-native/scripts/council_debate_simple.ts +294 -0
  173. package/dist/templates/cc-native/_cc-native/{plan-review/workflows → workflows}/specdev.md +9 -9
  174. package/dist/templates/core/.claude/skills/codex/SKILL.md +25 -0
  175. package/dist/templates/core/.claude/skills/devin/SKILL.md +25 -0
  176. package/dist/templates/core/.claude/skills/handoff/SKILL.md +11 -0
  177. package/dist/templates/core/.claude/skills/handoff-resume/SKILL.md +11 -0
  178. package/dist/templates/core/.claude/skills/meta-plan/SKILL.md +13 -0
  179. package/dist/templates/core/.codex/skills/codex/SKILL.md +13 -0
  180. package/dist/templates/core/.codex/skills/devin/SKILL.md +19 -0
  181. package/dist/templates/core/.codex/skills/handoff/SKILL.md +11 -0
  182. package/dist/templates/core/.codex/skills/handoff-resume/SKILL.md +11 -0
  183. package/dist/templates/core/.codex/{workflows/meta-plan.md → skills/meta-plan/SKILL.md} +6 -0
  184. package/dist/templates/core/{.cognition → .devin}/AGENTS.md +2 -2
  185. package/dist/templates/core/.devin/skills/codex/SKILL.md +19 -0
  186. package/dist/templates/core/.devin/skills/devin/SKILL.md +13 -0
  187. package/dist/templates/core/.devin/skills/handoff/SKILL.md +11 -0
  188. package/dist/templates/core/.devin/skills/handoff-resume/SKILL.md +11 -0
  189. package/dist/templates/core/.devin/skills/meta-plan/SKILL.md +13 -0
  190. package/dist/templates/core/.windsurf/workflows/handoff-resume.md +9 -0
  191. package/dist/templates/core/hooks-ts/archive_plan.ts +1 -21
  192. package/dist/templates/core/hooks-ts/file-suggestion.ts +1 -19
  193. package/dist/templates/core/hooks-ts/pre_compact.ts +5 -18
  194. package/dist/templates/core/lib-ts/context/context-store.ts +29 -2
  195. package/dist/templates/core/lib-ts/hooks/hook-utils.ts +11 -0
  196. package/dist/templates/core/lib-ts/hooks/session-end-logic.ts +2 -13
  197. package/dist/templates/core/lib-ts/runtime/agent-launcher.ts +74 -0
  198. package/dist/templates/core/lib-ts/runtime/aiw-cli.ts +4 -2
  199. package/dist/templates/core/lib-ts/runtime/cli-args.ts +18 -4
  200. package/dist/templates/core/lib-ts/runtime/inference.ts +3 -15
  201. package/dist/templates/core/lib-ts/runtime/models.ts +7 -0
  202. package/dist/templates/core/lib-ts/runtime/state-io.ts +9 -4
  203. package/dist/templates/core/lib-ts/runtime/utils.ts +30 -1
  204. package/dist/templates/core/lib-ts/schemas.ts +233 -0
  205. package/dist/templates/core/scripts/resolve-run.ts +34 -2
  206. package/dist/templates/core/scripts/status_line.ts +1 -1
  207. package/dist/templates/core/skills/codex/CLAUDE.md +9 -4
  208. package/dist/templates/core/skills/codex/SKILL.md +6 -0
  209. package/dist/templates/core/skills/codex/lib/codex-watcher.ts +3 -10
  210. package/dist/templates/core/skills/codex/scripts/launch-codex.ts +26 -26
  211. package/dist/templates/core/skills/devin/CLAUDE.md +63 -6
  212. package/dist/templates/core/skills/devin/lib/devin-watcher.ts +116 -96
  213. package/dist/templates/core/skills/devin/scripts/launch-devin.ts +22 -21
  214. package/dist/templates/core/skills/handoff-system/CLAUDE.md +1 -1
  215. package/oclif.manifest.json +4 -4
  216. package/package.json +4 -4
  217. package/dist/lib/base-command.d.ts +0 -1
  218. package/dist/lib/base-command.js +0 -1
  219. package/dist/lib/env-compat.d.ts +0 -18
  220. package/dist/lib/env-compat.js +0 -23
  221. package/dist/lib/launch-options.d.ts +0 -1
  222. package/dist/lib/launch-options.js +0 -1
  223. package/dist/lib/stdin.d.ts +0 -48
  224. package/dist/lib/stdin.js +0 -60
  225. package/dist/templates/cc-native/_cc-native/CLAUDE.md +0 -73
  226. package/dist/templates/cc-native/_cc-native/artifacts/CLAUDE.md +0 -64
  227. package/dist/templates/cc-native/_cc-native/lib-ts/CLAUDE.md +0 -70
  228. package/dist/templates/cc-native/_cc-native/plan-review/CODING-STANDARDS-CHECKLIST.md +0 -75
  229. package/dist/templates/cc-native/_cc-native/plan-review/agents/CLAUDE.md +0 -143
  230. package/dist/templates/cc-native/_cc-native/plan-review/agents/PLAN-ORCHESTRATOR.md +0 -213
  231. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-questions/PLAN-QUESTIONER.md +0 -70
  232. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-EVOLUTION.md +0 -62
  233. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-PATTERNS.md +0 -61
  234. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-STRUCTURE.md +0 -62
  235. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ASSUMPTION-TRACER.md +0 -56
  236. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/CLARITY-AUDITOR.md +0 -53
  237. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-FEASIBILITY.md +0 -66
  238. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-GAPS.md +0 -70
  239. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-ORDERING.md +0 -62
  240. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/CONSTRAINT-VALIDATOR.md +0 -72
  241. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DESIGN-ADR-VALIDATOR.md +0 -61
  242. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DESIGN-SCALE-MATCHER.md +0 -64
  243. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DEVILS-ADVOCATE.md +0 -56
  244. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DOCUMENTATION-PHILOSOPHY.md +0 -86
  245. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/HANDOFF-READINESS.md +0 -59
  246. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/HIDDEN-COMPLEXITY.md +0 -58
  247. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/INCREMENTAL-DELIVERY.md +0 -66
  248. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-DEPENDENCY.md +0 -62
  249. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-FMEA.md +0 -66
  250. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-PREMORTEM.md +0 -71
  251. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-REVERSIBILITY.md +0 -74
  252. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SCOPE-BOUNDARY.md +0 -77
  253. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SIMPLICITY-GUARDIAN.md +0 -62
  254. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SKEPTIC.md +0 -68
  255. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-BEHAVIOR-AUDITOR.md +0 -61
  256. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-CHARACTERIZATION.md +0 -71
  257. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-FIRST-VALIDATOR.md +0 -61
  258. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-PYRAMID-ANALYZER.md +0 -61
  259. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TRADEOFF-COSTS.md +0 -67
  260. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TRADEOFF-STAKEHOLDERS.md +0 -65
  261. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/VERIFY-COVERAGE.md +0 -74
  262. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/VERIFY-STRENGTH.md +0 -69
  263. package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/base/base-agent.ts +0 -7
  264. package/dist/templates/core/.codex/workflows/codex.md +0 -17
  265. package/dist/templates/core/.codex/workflows/handoff.md +0 -5
  266. package/dist/templates/core/lib-ts/agent-exec/backends/headless.ts +0 -34
  267. package/dist/templates/core/lib-ts/agent-exec/backends/index.ts +0 -6
  268. package/dist/templates/core/lib-ts/agent-exec/backends/tmux.ts +0 -148
  269. package/dist/templates/core/lib-ts/agent-exec/execution-backend.ts +0 -50
  270. package/dist/templates/core/lib-ts/agent-exec/index.ts +0 -6
  271. package/dist/templates/core/lib-ts/agent-exec/structured-output.ts +0 -165
  272. /package/dist/templates/core/{.cognition → .devin}/config.json +0 -0
@@ -1,132 +1,132 @@
1
- /**
2
- * Graduation logic: pass eligibility, pass streaks, graduation threshold, iteration advancement.
3
- * Extracted from cc-native-plan-review.ts.
4
- */
5
-
6
- import type {
7
- IterationState,
8
- ReviewerResult,
9
- CombinedReviewResult,
10
- IterationAdvancement,
11
- } from "../../lib-ts/types.js";
12
-
13
- // ---------------------------------------------------------------------------
14
- // Pass Eligibility
15
- // ---------------------------------------------------------------------------
16
-
17
- /**
18
- * Determine which agents are pass-eligible this iteration.
19
- * Criteria: verdict === "pass" OR zero high-severity issues.
20
- * Agents with "skip"/"error" are NOT eligible (no signal).
21
- */
22
- export function computePassEligible(agentResults: Record<string, ReviewerResult>): string[] {
23
- const eligible: string[] = [];
24
- for (const [name, result] of Object.entries(agentResults)) {
25
- if (result.verdict === "skip" || result.verdict === "error") continue;
26
- if (result.verdict === "pass") { eligible.push(name); continue; }
27
- const issues = Array.isArray(result.data?.issues)
28
- ? (result.data.issues as Array<{ severity?: string }>) : [];
29
- if (issues.filter(i => i.severity === "high").length === 0) {
30
- eligible.push(name);
31
- }
32
- }
33
- return eligible;
34
- }
35
-
36
- // ---------------------------------------------------------------------------
37
- // Tracker Issue Extraction
38
- // ---------------------------------------------------------------------------
39
-
40
- /**
41
- * Extract top high-severity issues for the review tracker.
42
- */
43
- export function extractTopIssuesForTracker(
44
- combined: CombinedReviewResult,
45
- maxCount = 5,
46
- ): string[] {
47
- const allReviewers = Object.values(combined.agents);
48
- const issues: string[] = [];
49
- for (const r of allReviewers) {
50
- if (!r.data) continue;
51
- const issueList = r.data.issues as Array<Record<string, unknown>> | undefined;
52
- if (!issueList) continue;
53
- for (const issue of issueList) {
54
- if (issue.severity === "high") {
55
- const text = String(issue.issue ?? "").trim();
56
- if (text) {
57
- issues.push(`[${r.name}] ${text}`);
58
- }
59
- }
60
- }
61
- if (issues.length >= maxCount) break;
62
- }
63
- return issues.slice(0, maxCount);
64
- }
65
-
66
- // ---------------------------------------------------------------------------
67
- // Iteration Advancement
68
- // ---------------------------------------------------------------------------
69
-
70
- const GRADUATION_THRESHOLD = 2;
71
-
72
- /**
73
- * Advance iteration state after a review cycle. Returns a new state copy
74
- * (does not mutate input).
75
- *
76
- * - On pass/warrant: sets current past max (stop iterating)
77
- * - On deny: increments current toward max (safety valve)
78
- * - Updates pass streaks and graduates agents that reached threshold
79
- */
80
- export function advanceIterationState(
81
- state: IterationState,
82
- planHash: string,
83
- planPath: string,
84
- verdict: string,
85
- shouldDeny: boolean,
86
- passEligible: string[],
87
- agentResults: Record<string, ReviewerResult>,
88
- graduationThreshold = GRADUATION_THRESHOLD,
89
- ): IterationAdvancement {
90
- const updated: IterationState = {
91
- ...state,
92
- history: [...state.history, { hash: planHash, verdict, timestamp: new Date().toISOString() }],
93
- lastPlanHash: planHash,
94
- lastPlanPath: planPath,
95
- graduated: [...state.graduated],
96
- passStreaks: { ...state.passStreaks },
97
- };
98
-
99
- if (!shouldDeny) {
100
- // Pass/warrant: stop iterating
101
- updated.current = updated.max + 1;
102
- } else {
103
- // Deny: advance toward max
104
- updated.current = state.current + 1;
105
- }
106
-
107
- // Update pass streaks — only for agents that actually ran this iteration
108
- const passEligibleSet = new Set(passEligible);
109
- const graduatedSet = new Set(updated.graduated);
110
-
111
- for (const name of Object.keys(agentResults)) {
112
- if (graduatedSet.has(name)) continue;
113
- if (passEligibleSet.has(name)) {
114
- updated.passStreaks[name] = (updated.passStreaks[name] ?? 0) + 1;
115
- } else {
116
- updated.passStreaks[name] = 0;
117
- }
118
- }
119
-
120
- // Graduate agents that reached threshold
121
- const newGraduates: string[] = [];
122
- for (const [name, streak] of Object.entries(updated.passStreaks)) {
123
- if (streak >= graduationThreshold && !graduatedSet.has(name)) {
124
- newGraduates.push(name);
125
- }
126
- }
127
- if (newGraduates.length > 0) {
128
- updated.graduated = [...updated.graduated, ...newGraduates];
129
- }
130
-
131
- return { updatedState: updated, newGraduates };
132
- }
1
+ /**
2
+ * Graduation logic: pass eligibility, pass streaks, graduation threshold, iteration advancement.
3
+ * Extracted from cc-native-plan-review.ts.
4
+ */
5
+
6
+ import type {
7
+ IterationState,
8
+ ReviewerResult,
9
+ CombinedReviewResult,
10
+ IterationAdvancement,
11
+ } from "./types.js";
12
+
13
+ // ---------------------------------------------------------------------------
14
+ // Pass Eligibility
15
+ // ---------------------------------------------------------------------------
16
+
17
+ /**
18
+ * Determine which agents are pass-eligible this iteration.
19
+ * Criteria: verdict === "pass" OR zero high-severity issues.
20
+ * Agents with "skip"/"error" are NOT eligible (no signal).
21
+ */
22
+ export function computePassEligible(agentResults: Record<string, ReviewerResult>): string[] {
23
+ const eligible: string[] = [];
24
+ for (const [name, result] of Object.entries(agentResults)) {
25
+ if (result.verdict === "skip" || result.verdict === "error") continue;
26
+ if (result.verdict === "pass") { eligible.push(name); continue; }
27
+ const issues = Array.isArray(result.data?.issues)
28
+ ? (result.data.issues as Array<{ severity?: string }>) : [];
29
+ if (issues.filter(i => i.severity === "high").length === 0) {
30
+ eligible.push(name);
31
+ }
32
+ }
33
+ return eligible;
34
+ }
35
+
36
+ // ---------------------------------------------------------------------------
37
+ // Tracker Issue Extraction
38
+ // ---------------------------------------------------------------------------
39
+
40
+ /**
41
+ * Extract top high-severity issues for the review tracker.
42
+ */
43
+ export function extractTopIssuesForTracker(
44
+ combined: CombinedReviewResult,
45
+ maxCount = 5,
46
+ ): string[] {
47
+ const allReviewers = Object.values(combined.agents);
48
+ const issues: string[] = [];
49
+ for (const r of allReviewers) {
50
+ if (!r.data) continue;
51
+ const issueList = r.data.issues as Array<Record<string, unknown>> | undefined;
52
+ if (!issueList) continue;
53
+ for (const issue of issueList) {
54
+ if (issue.severity === "high") {
55
+ const text = String(issue.issue ?? "").trim();
56
+ if (text) {
57
+ issues.push(`[${r.name}] ${text}`);
58
+ }
59
+ }
60
+ }
61
+ if (issues.length >= maxCount) break;
62
+ }
63
+ return issues.slice(0, maxCount);
64
+ }
65
+
66
+ // ---------------------------------------------------------------------------
67
+ // Iteration Advancement
68
+ // ---------------------------------------------------------------------------
69
+
70
+ const GRADUATION_THRESHOLD = 2;
71
+
72
+ /**
73
+ * Advance iteration state after a review cycle. Returns a new state copy
74
+ * (does not mutate input).
75
+ *
76
+ * - On pass/warrant: sets current past max (stop iterating)
77
+ * - On deny: increments current toward max (safety valve)
78
+ * - Updates pass streaks and graduates agents that reached threshold
79
+ */
80
+ export function advanceIterationState(
81
+ state: IterationState,
82
+ planHash: string,
83
+ planPath: string,
84
+ verdict: string,
85
+ shouldDeny: boolean,
86
+ passEligible: string[],
87
+ agentResults: Record<string, ReviewerResult>,
88
+ graduationThreshold = GRADUATION_THRESHOLD,
89
+ ): IterationAdvancement {
90
+ const updated: IterationState = {
91
+ ...state,
92
+ history: [...state.history, { hash: planHash, verdict, timestamp: new Date().toISOString() }],
93
+ lastPlanHash: planHash,
94
+ lastPlanPath: planPath,
95
+ graduated: [...state.graduated],
96
+ passStreaks: { ...(state.passStreaks ?? {}) },
97
+ };
98
+
99
+ if (!shouldDeny) {
100
+ // Pass/warrant: stop iterating
101
+ updated.current = updated.max + 1;
102
+ } else {
103
+ // Deny: advance toward max
104
+ updated.current = state.current + 1;
105
+ }
106
+
107
+ // Update pass streaks — only for agents that actually ran this iteration
108
+ const passEligibleSet = new Set(passEligible);
109
+ const graduatedSet = new Set(updated.graduated);
110
+
111
+ for (const name of Object.keys(agentResults)) {
112
+ if (graduatedSet.has(name)) continue;
113
+ if (passEligibleSet.has(name)) {
114
+ updated.passStreaks[name] = (updated.passStreaks[name] ?? 0) + 1;
115
+ } else {
116
+ updated.passStreaks[name] = 0;
117
+ }
118
+ }
119
+
120
+ // Graduate agents that reached threshold
121
+ const newGraduates: string[] = [];
122
+ for (const [name, streak] of Object.entries(updated.passStreaks)) {
123
+ if (streak >= graduationThreshold && !graduatedSet.has(name)) {
124
+ newGraduates.push(name);
125
+ }
126
+ }
127
+ if (newGraduates.length > 0) {
128
+ updated.graduated = [...updated.graduated, ...newGraduates];
129
+ }
130
+
131
+ return { updatedState: updated, newGraduates };
132
+ }
@@ -3,114 +3,116 @@
3
3
  * Re-exports the public API from all modules.
4
4
  */
5
5
 
6
- // Artifacts
7
- export {
8
- buildCombinedJson,
9
- buildHighIssuesDocument,
10
- buildInlineReviewSummary,
11
- extractTopIssuesText,
12
- formatCombinedMarkdown,
13
- formatReviewMarkdown,
14
- generateReviewIndex,
15
- writeCombinedArtifacts,
16
- } from "../artifacts/lib/index.js";
17
-
18
- // Orchestrator
19
- export { buildOrchestratorSchema, runOrchestrator } from "../plan-review/lib/orchestrator.js";
20
-
21
- // Reviewers
22
- export {
23
- AgentReviewer,
24
- runAgentReview,
25
- } from "../plan-review/lib/reviewers/index.js";
26
-
27
- // Verdict aggregation
28
- export { computeReviewDecision, worstVerdict } from "../plan-review/lib/verdict.js";
29
-
30
- // Agent aggregation
31
- export {
32
- aggregateAgents,
33
- extractBody,
34
- extractFrontmatter,
35
- } from "./aggregate-agents.js";
6
+ // Types & schemas
7
+ export type {
8
+ Verdict,
9
+ ReviewDecision,
10
+ ComplexityCategory,
11
+ ReviewIssue,
12
+ ReviewData,
13
+ ReviewerResult,
14
+ OrchestratorResult,
15
+ CombinedReviewResult,
16
+ ReviewDecisionResult,
17
+ AgentConfig,
18
+ OrchestratorConfig,
19
+ IterationState,
20
+ IterationEntry,
21
+ CcNativeState,
22
+ PlanReviewState,
23
+ QuestionsAskedState,
24
+ StuckDetectionState,
25
+ PlanReviewConfig,
26
+ DisplaySettings,
27
+ ReviewOptions,
28
+ Reviewer,
29
+ } from "./types.js";
36
30
 
37
- // CC-native state
38
31
  export {
39
- getCcNativeState,
40
- isPlanAlreadyReviewed,
41
- markPlanReviewed,
42
- markQuestionsAsked,
43
- saveCcNativeState,
44
- wasPlanPreviouslyDenied,
45
- wasQuestionsAsked,
46
- } from "./cc-native-state.js";
47
-
48
- // CLI output parsing
49
- export { parseCliOutput } from "./cli-output-parser.js";
50
-
51
- // Configuration
52
- export { getDisplaySettings, loadConfig } from "./config.js";
32
+ REVIEW_SCHEMA,
33
+ ORCHESTRATOR_SCHEMA,
34
+ REVIEW_PROMPT_PREFIX,
35
+ AGENT_REVIEW_PROMPT_PREFIX,
36
+ DEFAULT_DISPLAY,
37
+ DEFAULT_SANITIZATION,
38
+ } from "./types.js";
53
39
 
54
40
  // Constants & security
55
41
  export {
56
- ENABLE_PLAN_NOTIFICATIONS,
57
42
  ENABLE_ROBUST_PLAN_WRITES,
58
- MAX_ERROR_FILE_SIZE,
43
+ ENABLE_PLAN_NOTIFICATIONS,
44
+ PLANS_DIR,
59
45
  MAX_PLAN_PATH_LENGTH,
46
+ MAX_ERROR_FILE_SIZE,
60
47
  MAX_RETRY_ATTEMPTS,
61
- MAX_TOTAL_RETRY_TIME_MS,
62
- PLANS_DIR,
63
48
  RETRY_BACKOFF_MS,
49
+ MAX_TOTAL_RETRY_TIME_MS,
64
50
  validatePlanPath,
65
51
  } from "./constants.js";
66
52
 
67
- // Debug logging
68
- export { cleanupDebugFolder, debugLog, debugRaw, getDebugDir } from "./debug.js";
53
+ // Verdict aggregation
54
+ export { worstVerdict, computeReviewDecision } from "./verdict.js";
69
55
 
70
56
  // JSON parsing
71
- export { coerceToReview, parseJsonMaybe } from "./json-parser.js";
57
+ export { parseJsonMaybe, coerceToReview } from "./json-parser.js";
58
+
59
+ // CLI output parsing
60
+ export { parseCliOutput } from "./cli-output-parser.js";
61
+
62
+ // Configuration
63
+ export { loadConfig, getDisplaySettings } from "./config.js";
64
+
65
+ // Debug logging
66
+ export { debugLog, debugRaw, getDebugDir, cleanupDebugFolder } from "./debug.js";
67
+
68
+ // CC-native state
69
+ export {
70
+ getCcNativeState,
71
+ saveCcNativeState,
72
+ isPlanAlreadyReviewed,
73
+ wasPlanPreviouslyDenied,
74
+ markPlanReviewed,
75
+ wasQuestionsAsked,
76
+ markQuestionsAsked,
77
+ getStuckDetectionState,
78
+ updateStuckDetectionState,
79
+ } from "./cc-native-state.js";
72
80
 
73
81
  // Iteration state
74
82
  export {
75
- DEFAULT_REVIEW_ITERATIONS,
76
- deleteState,
77
- getIterationState,
78
83
  getStateFilePath,
79
84
  loadState,
80
85
  saveStateToPlan,
81
- shouldContinueIterating,
86
+ deleteState,
87
+ getIterationState,
82
88
  updateIterationState,
89
+ shouldContinueIterating,
83
90
  } from "./state.js";
84
91
 
85
- // Types & schemas
86
- export type {
87
- AgentConfig,
88
- CcNativeState,
89
- CombinedReviewResult,
90
- ComplexityCategory,
91
- DisplaySettings,
92
- IterationEntry,
93
- IterationState,
94
- OrchestratorConfig,
95
- OrchestratorResult,
96
- PlanReviewConfig,
97
- PlanReviewState,
98
- QuestionsAskedState,
99
- ReviewData,
100
- ReviewDecision,
101
- ReviewDecisionResult,
102
- Reviewer,
103
- ReviewerResult,
104
- ReviewIssue,
105
- ReviewOptions,
106
- Verdict,
107
- } from "./types.js";
92
+ // Orchestrator
93
+ export { runOrchestrator, buildOrchestratorSchema } from "./orchestrator.js";
108
94
 
95
+ // Agent aggregation
109
96
  export {
110
- AGENT_REVIEW_PROMPT_PREFIX,
111
- DEFAULT_DISPLAY,
112
- DEFAULT_SANITIZATION,
113
- ORCHESTRATOR_SCHEMA,
114
- REVIEW_PROMPT_PREFIX,
115
- REVIEW_SCHEMA,
116
- } from "./types.js";
97
+ aggregateAgents,
98
+ extractFrontmatter,
99
+ extractBody,
100
+ } from "./aggregate-agents.js";
101
+
102
+ // Artifacts
103
+ export {
104
+ formatReviewMarkdown,
105
+ formatCombinedMarkdown,
106
+ buildInlineReviewSummary,
107
+ extractTopIssuesText,
108
+ buildHighIssuesDocument,
109
+ generateReviewIndex,
110
+ buildCombinedJson,
111
+ writeCombinedArtifacts,
112
+ } from "./artifacts.js";
113
+
114
+ // Reviewers
115
+ export {
116
+ AgentReviewer,
117
+ runAgentReview,
118
+ } from "./reviewers/index.js";
@@ -3,8 +3,8 @@
3
3
  * See cc-native-plan-review-spec.md §4.10-4.11
4
4
  */
5
5
 
6
- import type { ReviewData, Verdict } from "./types.js";
7
6
  import { logDebug, logWarn } from "../../_core/lib-ts/runtime/logger.js";
7
+ import type { ReviewData, Verdict } from "./types.js";
8
8
 
9
9
  /**
10
10
  * Try strict JSON parse. If that fails, attempt to extract the first {...} block.
@@ -16,12 +16,12 @@ import { logDebug, logWarn } from "../../_core/lib-ts/runtime/logger.js";
16
16
  export function parseJsonMaybe(
17
17
  text: string,
18
18
  requireFields?: string[],
19
- ): null | Record<string, unknown> {
19
+ ): Record<string, unknown> | null {
20
20
  const trimmed = text.trim();
21
21
  if (!trimmed) return null;
22
22
 
23
- let obj: null | Record<string, unknown> = null;
24
- let parseMethod: null | string = null;
23
+ let obj: Record<string, unknown> | null = null;
24
+ let parseMethod: string | null = null;
25
25
 
26
26
  // Strict parse
27
27
  try {
@@ -93,7 +93,7 @@ export function parseJsonMaybe(
93
93
  * @returns Tuple of [ok, verdict, normalizedData]
94
94
  */
95
95
  export function coerceToReview(
96
- obj: null | Record<string, unknown>,
96
+ obj: Record<string, unknown> | null,
97
97
  defaultFixMsg = "Retry or check configuration.",
98
98
  ): [boolean, Verdict, ReviewData] {
99
99
  if (!obj) {
@@ -144,7 +144,6 @@ export function coerceToReview(
144
144
  `verdict=${obj.verdict}, issues_count=${Array.isArray(obj.issues) ? (obj.issues as unknown[]).length : 0}`,
145
145
  );
146
146
  }
147
-
148
147
  if (!obj.issues) {
149
148
  logDebug("coerce", "issues array empty or missing");
150
149
  }
@@ -1,70 +1,70 @@
1
- /**
2
- * Plan orchestrator — analyzes complexity and selects reviewer agents.
3
- * Uses OrchestratorClaudeAgent (BaseCliAgent framework) for subprocess execution.
4
- * See cc-native-plan-review-spec.md §4.8
5
- */
6
-
7
- import { OrchestratorClaudeAgent } from "./reviewers/providers/orchestrator-claude-agent.js";
8
- import { logInfo, logWarn } from "../../../_core/lib-ts/runtime/logger.js";
9
- import type { AgentConfig, AgentReviewSettings, OrchestratorConfig, OrchestratorResult } from "../../lib-ts/types.js";
10
-
11
- // Re-export for backward compatibility (moved to reviewers/schemas.ts)
12
- export { buildOrchestratorSchema } from "./reviewers/schemas.js";
13
-
14
- // ---------------------------------------------------------------------------
15
- // Orchestrator
16
- // ---------------------------------------------------------------------------
17
-
18
- /**
19
- * Run the orchestrator agent to analyze plan complexity and select reviewers.
20
- * Never throws — returns fallback OrchestratorResult on failure.
21
- */
22
- export async function runOrchestrator(
23
- plan: string,
24
- agentLibrary: AgentConfig[],
25
- config: OrchestratorConfig,
26
- settings: AgentReviewSettings,
27
- mandatoryNames?: Set<string>,
28
- ): Promise<OrchestratorResult> {
29
- logInfo("orchestrator", "Starting plan analysis...");
30
-
31
- const mandatory = mandatoryNames ?? new Set<string>();
32
-
33
- // Create a synthetic AgentConfig for the orchestrator
34
- const orchestratorAgent: AgentConfig = {
35
- name: "orchestrator",
36
- model: config.model,
37
- provider: config.provider ?? "claude",
38
- focus: "plan analysis and agent selection",
39
- categories: [],
40
- description: "Plan orchestrator",
41
- system_prompt: "",
42
- };
43
-
44
- try {
45
- const agent = new OrchestratorClaudeAgent(
46
- orchestratorAgent,
47
- agentLibrary,
48
- mandatory,
49
- settings,
50
- config.timeout,
51
- );
52
-
53
- const result = await agent.review(plan);
54
-
55
- logInfo("orchestrator", `Result: complexity=${result.complexity}, category=${result.category}, agents=${JSON.stringify(result.selected_agents)}`);
56
-
57
- return result;
58
- } catch (error) {
59
- logWarn("orchestrator", `Unexpected error: ${error}`);
60
- const nonMandatory = agentLibrary.filter((a) => !mandatory.has(a.name));
61
- const fallbackCount = settings.agentSelection?.fallbackCount ?? 2;
62
- return {
63
- complexity: "medium",
64
- category: "code",
65
- selected_agents: nonMandatory.slice(0, fallbackCount).map((a) => a.name),
66
- reasoning: `Orchestrator failed: ${error}`,
67
- error: String(error),
68
- };
69
- }
70
- }
1
+ /**
2
+ * Plan orchestrator — analyzes complexity and selects reviewer agents.
3
+ * Uses OrchestratorClaudeAgent (BaseCliAgent framework) for subprocess execution.
4
+ * See cc-native-plan-review-spec.md §4.8
5
+ */
6
+
7
+ import { logInfo, logWarn } from "../../_core/lib-ts/runtime/logger.js";
8
+ import type { AgentConfig, OrchestratorConfig, OrchestratorResult } from "./types.js";
9
+ import { OrchestratorClaudeAgent } from "./reviewers/providers/orchestrator-claude-agent.js";
10
+
11
+ // Re-export for backward compatibility (moved to reviewers/schemas.ts)
12
+ export { buildOrchestratorSchema } from "./reviewers/schemas.js";
13
+
14
+ // ---------------------------------------------------------------------------
15
+ // Orchestrator
16
+ // ---------------------------------------------------------------------------
17
+
18
+ /**
19
+ * Run the orchestrator agent to analyze plan complexity and select reviewers.
20
+ * Never throws — returns fallback OrchestratorResult on failure.
21
+ */
22
+ export async function runOrchestrator(
23
+ plan: string,
24
+ agentLibrary: AgentConfig[],
25
+ config: OrchestratorConfig,
26
+ settings: Record<string, unknown>,
27
+ mandatoryNames?: Set<string>,
28
+ ): Promise<OrchestratorResult> {
29
+ logInfo("orchestrator", "Starting plan analysis...");
30
+
31
+ const mandatory = mandatoryNames ?? new Set<string>();
32
+
33
+ // Create a synthetic AgentConfig for the orchestrator
34
+ const orchestratorAgent: AgentConfig = {
35
+ name: "orchestrator",
36
+ model: config.model,
37
+ provider: "claude",
38
+ focus: "plan analysis and agent selection",
39
+ categories: [],
40
+ description: "Plan orchestrator",
41
+ system_prompt: "",
42
+ };
43
+
44
+ try {
45
+ const agent = new OrchestratorClaudeAgent(
46
+ orchestratorAgent,
47
+ agentLibrary,
48
+ mandatory,
49
+ settings,
50
+ config.timeout,
51
+ );
52
+
53
+ const result = await agent.review(plan);
54
+
55
+ logInfo("orchestrator", `Result: complexity=${result.complexity}, category=${result.category}, agents=${JSON.stringify(result.selected_agents)}`);
56
+
57
+ return result;
58
+ } catch (e) {
59
+ logWarn("orchestrator", `Unexpected error: ${e}`);
60
+ const nonMandatory = agentLibrary.filter((a) => !mandatory.has(a.name));
61
+ const fallbackCount = ((settings.agentSelection as Record<string, unknown>)?.fallbackCount as number) ?? 2;
62
+ return {
63
+ complexity: "medium",
64
+ category: "code",
65
+ selected_agents: nonMandatory.slice(0, fallbackCount).map((a) => a.name),
66
+ reasoning: `Orchestrator failed: ${e}`,
67
+ error: String(e),
68
+ };
69
+ }
70
+ }