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,15 +1,15 @@
1
1
  /**
2
2
  * PsmuxMultiplexer — unified psmux (Windows ConPTY) backend.
3
- * Consolidates PsmuxLauncher + launchInPsmuxSession + command building from pane-driver.
3
+ * Composes with PowerShellAdapter for command building.
4
+ * Owns: version checking, session readiness polling, bootstrap defaults.
4
5
  */
5
6
  import { existsSync, readdirSync, writeFileSync } from 'node:fs';
6
7
  import * as os from 'node:os';
7
8
  import path from 'node:path';
8
- import { cleanClaudeEnv, getLastLine, spawnAttached, splitFlagFromDimensions } from '../mux-utils.js';
9
- import { cleanupSentinelIpc, createSentinelIpcPaths } from '../runtime/sentinel-ipc.js';
9
+ import { sanitizedProcessEnv } from '../env-sanitizer.js';
10
+ import { PANE_HOLD_MESSAGE, buildBootstrapPrompt, getLastLine, spawnAttached, splitFlagFromDimensions } from '../mux-utils.js';
10
11
  import { execFileAsync, findExecutable } from '../runtime/subprocess-utils.js';
11
- import { wrapSentinelPowerShell } from '../sentinel-wrapper.js';
12
- import { quoteForPowerShell, toEncodedPowerShell } from '../shell-quoting.js';
12
+ import { PowerShellAdapter } from '../shell-adapters/powershell-adapter.js';
13
13
  const MIN_VERSION = { major: 0, minor: 4, patch: 0 };
14
14
  const ATTACH_RETRY_DELAY_MS = 200;
15
15
  const SESSION_READY_BACKOFF_MS = [50, 100, 150, 250];
@@ -37,27 +37,9 @@ export function parseVersionString(stdout) {
37
37
  patch: Number(match[3]),
38
38
  };
39
39
  }
40
- /** @internal */
41
- export function buildCommandArgs(args, mode, promptPath) {
42
- if (mode !== 'repl' || !promptPath)
43
- return args;
44
- const absolutePromptPath = path.resolve(promptPath);
45
- const bootstrap = `Read startup instructions from this file path before taking action: ${formatPromptPathForBootstrap(absolutePromptPath)}. Use that file as the initial context.`;
46
- return [...args, bootstrap];
47
- }
48
- /** @internal */
49
- export function buildPowerShellToolCommand(params) {
50
- const { toolPath, args, env, mode, promptPath } = params;
51
- const envPrefix = Object.entries(env)
52
- .map(([key, value]) => `$env:${key}=${quoteForPowerShell(value)}`)
53
- .join('; ');
54
- const commandArgs = buildCommandArgs(args, mode, promptPath);
55
- const argArray = commandArgs.map((arg) => quoteForPowerShell(arg)).join(', ');
56
- const invocation = `& ${quoteForPowerShell(toolPath)}${argArray ? ` @(${argArray})` : ''}`;
57
- const body = mode === 'exec' && promptPath
58
- ? `Get-Content -Raw -Path ${quoteForPowerShell(promptPath)} | ${invocation}`
59
- : invocation;
60
- return [envPrefix, body].filter(Boolean).join('; ');
40
+ /** @internal — translate unified SplitDirection to psmux flag. */
41
+ export function toPsmuxSplitFlag(direction) {
42
+ return direction === 'horizontal' ? '-h' : '-v';
61
43
  }
62
44
  /** @internal */
63
45
  export function buildCreateSessionArgs(params) {
@@ -82,15 +64,11 @@ export function buildAttachArgs(sessionName) {
82
64
  export class PsmuxMultiplexer {
83
65
  backend = 'psmux';
84
66
  psmuxPath;
67
+ shell;
85
68
  constructor(psmuxPath) {
86
69
  this.psmuxPath = psmuxPath;
70
+ this.shell = new PowerShellAdapter();
87
71
  }
88
- /**
89
- * Check if psmux is installed and meets version requirements.
90
- * Checks PATH first, then probes the winget install directory
91
- * (winget install doesn't always add packages to PATH).
92
- * Returns a PsmuxMultiplexer instance or null.
93
- */
94
72
  static async create() {
95
73
  if (process.platform !== 'win32')
96
74
  return null;
@@ -107,48 +85,40 @@ export class PsmuxMultiplexer {
107
85
  return null;
108
86
  return new PsmuxMultiplexer(psmuxPath);
109
87
  }
110
- /**
111
- * Create a new psmux session.
112
- * Injects PSMUX_PANE=1 into the PowerShell command so child processes
113
- * can detect they're inside a psmux session.
114
- */
88
+ resolveStrategy(ctx) {
89
+ if (ctx.disableMux) {
90
+ return { strategy: 'inline', reason: 'Multiplexer disabled via --no-tmux' };
91
+ }
92
+ if (Boolean(process.env.PSMUX_PANE)) {
93
+ return { strategy: 'split', reason: 'Inside psmux session' };
94
+ }
95
+ return { strategy: 'create-session', reason: 'Outside psmux — will create new session' };
96
+ }
115
97
  async createSession(options) {
116
- const { sessionName, reattach, enableMouse = true } = options;
98
+ const { sessionName, reattach, enableMouse = true, cwd } = options;
117
99
  let promptFilePath;
118
100
  if (options.promptText) {
119
101
  promptFilePath = path.join(os.tmpdir(), `aiwcli-prompt-${Date.now()}-${process.pid}.txt`);
120
102
  writeFileSync(promptFilePath, options.promptText, { encoding: 'utf8', mode: 0o600 });
121
103
  }
122
- // Build the PowerShell command to run inside the psmux session
123
- const shellCommand = buildPsmuxShellCommand(options, promptFilePath);
124
- // Inject PSMUX_PANE=1 for inside-session detection
125
- const commandWithEnv = `$env:PSMUX_PANE='1'; ${shellCommand}`;
104
+ const shellCommand = buildPsmuxShellCommand(this.shell, options, promptFilePath);
105
+ // Inject PSMUX_PANE=1 for inside-session detection + nesting cleanup
106
+ const nestingCleanup = this.shell.buildNestingCleanup();
107
+ const commandWithEnv = `$env:PSMUX_PANE='1'; ${nestingCleanup} ${shellCommand}`;
126
108
  const psmuxArgs = buildCreateSessionArgs({
127
109
  sessionName,
128
- cwd: process.cwd(),
129
- encodedCommand: toEncodedPowerShell(commandWithEnv),
110
+ cwd,
111
+ encodedCommand: this.shell.encodeForExecution(commandWithEnv),
130
112
  });
131
- if (reattach) {
132
- const exists = await this.hasSession(sessionName);
133
- if (!exists) {
134
- const detachedCreate = await execFileAsync(this.psmuxPath, psmuxArgs, { timeout: 5000 });
135
- if (detachedCreate.exitCode !== 0) {
136
- const stderr = detachedCreate.stderr.trim();
137
- return {
138
- exitCode: detachedCreate.exitCode ?? 1,
139
- usedMux: false,
140
- reason: stderr ? `psmux new-session failed: ${stderr}` : 'psmux new-session failed',
141
- };
142
- }
143
- }
144
- }
145
- else {
113
+ const shouldCreate = !reattach || !(await this.hasSession(sessionName));
114
+ if (shouldCreate) {
146
115
  const detachedCreate = await execFileAsync(this.psmuxPath, psmuxArgs, { timeout: 5000 });
147
116
  if (detachedCreate.exitCode !== 0) {
148
117
  const stderr = detachedCreate.stderr.trim();
149
118
  return {
119
+ launched: false,
150
120
  exitCode: detachedCreate.exitCode ?? 1,
151
- usedMux: false,
121
+ backend: this.backend,
152
122
  reason: stderr ? `psmux new-session failed: ${stderr}` : 'psmux new-session failed',
153
123
  };
154
124
  }
@@ -156,112 +126,88 @@ export class PsmuxMultiplexer {
156
126
  const ready = await this.waitForSessionReady(sessionName);
157
127
  if (!ready) {
158
128
  return {
129
+ launched: false,
159
130
  exitCode: 1,
160
- usedMux: false,
131
+ backend: this.backend,
161
132
  reason: `psmux session '${sessionName}' not ready for attach`,
162
133
  };
163
134
  }
164
135
  await this.applyBootstrapDefaults(enableMouse);
165
136
  const attachArgs = buildAttachArgs(sessionName);
166
- const env = cleanClaudeEnv();
137
+ const env = sanitizedProcessEnv();
167
138
  const firstAttach = await spawnAttached(this.psmuxPath, attachArgs, env, this.backend);
168
- if (firstAttach.usedMux || firstAttach.exitCode !== 1)
139
+ if (firstAttach.launched || (firstAttach.exitCode !== undefined && firstAttach.exitCode !== 1))
169
140
  return firstAttach;
170
141
  await waitMs(ATTACH_RETRY_DELAY_MS);
171
142
  const secondAttach = await spawnAttached(this.psmuxPath, attachArgs, env, this.backend);
172
- if (secondAttach.usedMux || secondAttach.exitCode !== 1)
143
+ if (secondAttach.launched || (secondAttach.exitCode !== undefined && secondAttach.exitCode !== 1))
173
144
  return secondAttach;
174
145
  return {
175
146
  ...secondAttach,
176
147
  reason: 'psmux attach failed after retry (auth/session readiness race)',
177
- usedMux: false,
148
+ launched: false,
178
149
  };
179
150
  }
180
- /**
181
- * Detect if we're inside a psmux session we created.
182
- * Uses PSMUX_PANE env var that we inject in createSession().
183
- */
184
- isInsideSession() {
185
- return Boolean(process.env.PSMUX_PANE);
186
- }
187
- async kill(paneId) {
188
- if (!paneId)
151
+ async kill(handle) {
152
+ if (!handle)
189
153
  return;
190
- await execFileAsync(this.psmuxPath, ['kill-pane', '-t', paneId], { timeout: 3000 });
154
+ await execFileAsync(this.psmuxPath, ['kill-pane', '-t', handle], { timeout: 3000 });
191
155
  }
192
- async splitPane(options) {
193
- const mode = options.mode ?? 'repl';
194
- const args = options.args ?? [];
195
- const envVars = options.env ?? {};
196
- const cwd = options.cwd ?? process.cwd();
197
- // Resolve tool path — psmux uses native Windows paths directly
198
- const toolPath = findExecutable(options.toolName);
199
- if (!toolPath) {
200
- return { launched: false, backend: this.backend, reason: `${options.toolName} not found on PATH` };
156
+ async split(options) {
157
+ const { toolName, args, env, cwd, mode, sentinelPath } = options;
158
+ const nativePath = findExecutable(toolName);
159
+ if (!nativePath) {
160
+ return { launched: false, backend: this.backend, reason: `${toolName} not found on PATH` };
201
161
  }
202
- // Sentinel IPC
203
- const useSentinel = options.sentinel !== false;
204
- const sentinel = useSentinel ? createSentinelIpcPaths(`aiwcli-pane-${options.toolName}`) : null;
205
162
  try {
206
- const baseCommand = buildPowerShellToolCommand({
207
- toolPath,
163
+ const baseCommand = this.shell.buildToolCommand({
164
+ toolPath: nativePath,
208
165
  args,
209
- env: envVars,
166
+ env,
210
167
  mode,
211
168
  ...(options.promptPath ? { promptPath: options.promptPath } : {}),
212
169
  });
213
- let paneCommand = baseCommand;
214
- if (sentinel) {
215
- const holdMessage = options.holdMessage ?? '[aiwcli] Driver exited. Pane held open.';
216
- paneCommand = wrapSentinelPowerShell({
217
- command: baseCommand,
218
- sentinelPath: sentinel.sentinelPath,
219
- autoClose: Boolean(options.autoClose),
220
- holdPane: Boolean(options.holdPane),
221
- holdMessage,
222
- });
223
- }
224
- // Wrap in PowerShell using -EncodedCommand to avoid double-quote expansion issues
225
- const effectivePaneCommand = toEncodedPowerShell(paneCommand);
170
+ const holdMessage = PANE_HOLD_MESSAGE;
171
+ const wrappedCommand = this.shell.wrapSentinel({
172
+ command: baseCommand,
173
+ sentinelPath,
174
+ autoClose: false,
175
+ holdPane: false,
176
+ holdMessage,
177
+ });
178
+ const effectiveCommand = this.shell.encodeForExecution(wrappedCommand);
226
179
  // Resolve split direction
227
- const splitDirection = options.split ?? 'auto';
180
+ const splitDirection = options.split;
228
181
  let splitFlag;
229
182
  if (splitDirection === 'auto') {
230
183
  splitFlag = await this.resolveAutoSplit();
231
184
  }
232
185
  else {
233
- splitFlag = splitDirection === 'v' ? '-v' : '-h';
186
+ splitFlag = toPsmuxSplitFlag(splitDirection);
234
187
  }
235
188
  await this.applyBootstrapDefaults();
236
- // Build psmux split-window command
237
189
  const psmuxArgs = buildSplitWindowArgs({
238
190
  splitFlag,
239
- encodedCommand: effectivePaneCommand,
191
+ encodedCommand: effectiveCommand,
240
192
  cwd,
241
- splitTarget: options.splitTarget,
242
193
  });
243
194
  const split = await execFileAsync(this.psmuxPath, psmuxArgs, { timeout: 5000 });
244
195
  if (split.exitCode !== 0) {
245
- if (sentinel)
246
- cleanupSentinelIpc(sentinel);
247
196
  return {
248
197
  launched: false,
249
198
  backend: this.backend,
250
199
  reason: 'psmux split-window failed',
251
- stderr: split.stderr.trim() || undefined,
252
200
  };
253
201
  }
254
- const paneId = getLastLine(split.stdout) || undefined;
202
+ const handle = getLastLine(split.stdout) || undefined;
255
203
  return {
256
204
  launched: true,
257
205
  backend: this.backend,
258
- paneId,
259
- sentinelPath: sentinel?.sentinelPath,
206
+ handle,
207
+ sentinelPath,
260
208
  };
261
209
  }
262
210
  catch (error) {
263
- if (sentinel)
264
- cleanupSentinelIpc(sentinel);
265
211
  return {
266
212
  launched: false,
267
213
  backend: this.backend,
@@ -314,9 +260,6 @@ export class PsmuxMultiplexer {
314
260
  return poll(0);
315
261
  }
316
262
  }
317
- // Probe winget package dir for psmux.exe.
318
- // winget install drops the binary under %LOCALAPPDATA%/Microsoft/WinGet/Packages/
319
- // but does not always add it to PATH.
320
263
  function findPsmuxInWinget() {
321
264
  const localAppData = process.env.LOCALAPPDATA;
322
265
  if (!localAppData)
@@ -346,25 +289,22 @@ export function buildPsmuxBootstrapCommands(enableMouse = true) {
346
289
  return commands;
347
290
  }
348
291
  /** @internal */
349
- export function buildPsmuxShellCommand(opts, promptFilePath) {
292
+ export function buildPsmuxShellCommand(shell, opts, promptFilePath) {
350
293
  const { toolPath, toolArgs } = opts;
351
294
  const cmdParts = [];
352
- cmdParts.push(`& ${quoteForPowerShell(toolPath)}`);
295
+ cmdParts.push(`& ${shell.quote(toolPath)}`);
353
296
  for (const arg of toolArgs) {
354
- cmdParts.push(quoteForPowerShell(arg));
297
+ cmdParts.push(shell.quote(arg));
355
298
  }
356
299
  if (promptFilePath) {
357
- const bootstrap = `Read startup instructions from this file path before taking action: ${formatPromptPathForBootstrap(promptFilePath)}. Use that file as the initial context.`;
358
- cmdParts.push(quoteForPowerShell(bootstrap));
300
+ const formatted = process.platform === 'win32'
301
+ ? promptFilePath.replaceAll('\\', '/')
302
+ : promptFilePath;
303
+ const bootstrap = buildBootstrapPrompt(formatted);
304
+ cmdParts.push(shell.quote(bootstrap));
359
305
  }
360
306
  return cmdParts.join(' ');
361
307
  }
362
- /** @internal */
363
- export function formatPromptPathForBootstrap(promptPath) {
364
- if (process.platform !== 'win32')
365
- return promptPath;
366
- return promptPath.replaceAll('\\', '/');
367
- }
368
308
  async function runBootstrapCommands(psmuxPath, commands, index = 0) {
369
309
  const command = commands[index];
370
310
  if (!command)
@@ -1,21 +1,12 @@
1
1
  /**
2
2
  * TmuxMultiplexer — unified tmux backend.
3
- * Consolidates TmuxLauncher + launchInTmuxSession + command building from pane-driver.
3
+ * Composes with BashAdapter for command building.
4
+ * Owns: split direction resolution, tmux session config, Windows bootstrap.
4
5
  */
5
- import type { CreateSessionOptions, CreateSessionResult, Multiplexer, SplitPaneOptions, SplitPaneResult } from '../multiplexer.js';
6
- /** @internal */
7
- export declare function buildEnvPrefix(env: Record<string, string>): string;
8
- /** @internal */
9
- export declare function buildShToolCommand(params: {
10
- args: string[];
11
- env: Record<string, string>;
12
- mode: 'exec' | 'repl';
13
- promptPath?: string;
14
- promptText?: string | undefined;
15
- toolPath: string;
16
- }): string;
17
- /** @internal */
18
- export declare function buildCommandArgs(args: string[], mode: 'exec' | 'repl', promptText?: string): string[];
6
+ import type { CreateSessionOptions, LaunchResult, Multiplexer, ResolvedStrategy, SplitOptions, StrategyContext } from '../multiplexer.js';
7
+ import { type TmuxSplitFlag } from '../tmux-pane-placement.js';
8
+ /** @internal translate unified SplitDirection to tmux flag. */
9
+ export declare function toTmuxSplitFlag(direction: 'horizontal' | 'vertical'): TmuxSplitFlag;
19
10
  /** @internal */
20
11
  export declare function withWindowsTmuxBootstrap(command: string, platform?: NodeJS.Platform): string;
21
12
  /** @internal */
@@ -35,10 +26,11 @@ export declare function buildTmuxCreateSessionArgs(params: {
35
26
  export declare class TmuxMultiplexer implements Multiplexer {
36
27
  readonly backend: "tmux";
37
28
  private readonly tmuxPath;
29
+ private readonly shell;
38
30
  private constructor();
39
31
  static create(): null | TmuxMultiplexer;
40
- createSession(options: CreateSessionOptions): Promise<CreateSessionResult>;
41
- isInsideSession(): boolean;
42
- kill(paneId: string): Promise<void>;
43
- splitPane(options: SplitPaneOptions): Promise<SplitPaneResult>;
32
+ resolveStrategy(ctx: StrategyContext): ResolvedStrategy;
33
+ createSession(options: CreateSessionOptions): Promise<LaunchResult>;
34
+ kill(handle: string): Promise<void>;
35
+ split(options: SplitOptions): Promise<LaunchResult>;
44
36
  }