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
@@ -0,0 +1,25 @@
1
+ export const CONTEXT_WARNING_30 = "## Context Window: ~30% Remaining\n\n" +
2
+ "This session is approaching its context limit. Consider:\n\n" +
3
+ "- Completing your current task, then pausing for the user to decide next steps\n" +
4
+ "- If significant work remains, mention that `/aiwcli-shared:handoff` can capture progress " +
5
+ "for a fresh session\n\n" +
6
+ "Do not rush or cut corners — finish the current task properly. " +
7
+ "Just be aware that starting large new tasks may not complete before context runs out.";
8
+ export const CONTEXT_WARNING_15 = "## Context Window: ~15% Remaining — Wrap Up Now\n\n" +
9
+ "Context is critically low. After completing your current step:\n\n" +
10
+ "1. **Stop taking on new work**\n" +
11
+ "2. Summarize what was accomplished and what remains\n" +
12
+ "3. Offer to run `/aiwcli-shared:handoff` so progress transfers to a fresh session\n\n" +
13
+ "Do not start new multi-step tasks. Focus on clean closure.";
14
+ const WARNING_THRESHOLDS = [
15
+ { pct: 15, msg: CONTEXT_WARNING_15 },
16
+ { pct: 30, msg: CONTEXT_WARNING_30 },
17
+ ];
18
+ export function selectWarningMessage(pctRemaining, alreadyFired) {
19
+ for (const warning of WARNING_THRESHOLDS) {
20
+ if (pctRemaining <= warning.pct && !alreadyFired.includes(warning.pct)) {
21
+ return warning;
22
+ }
23
+ }
24
+ return null;
25
+ }
@@ -7,6 +7,7 @@ import * as fs from "node:fs";
7
7
  import { getContextBySessionId, maybeActivate } from "../context/context-store.js";
8
8
  import { getProjectRoot } from "../runtime/constants.js";
9
9
  import { logDebug, logWarn, hookLog, setSessionId, getContextPath as _getContextPath } from "../runtime/logger.js";
10
+ import { HookInputSchema } from "../schemas.js";
10
11
  // Re-export logger functions for convenience (matches Python hook_utils re-exports)
11
12
  // Context window baseline: tokens not visible in hook data §5.9
12
13
  export const CONTEXT_BASELINE_TOKENS = 22_600;
@@ -113,6 +114,11 @@ export function loadHookInput() {
113
114
  if (!inputData)
114
115
  return null;
115
116
  const result = JSON.parse(inputData);
117
+ const validated = HookInputSchema.safeParse(result);
118
+ if (!validated.success) {
119
+ logWarn("hook_utils", `Hook input schema validation failed: ${validated.error.message}`);
120
+ return null;
121
+ }
116
122
  if (result && typeof result === "object") {
117
123
  _lastHookEvent = readStringField(result, "hook_event_name");
118
124
  _lastToolName = readStringField(result, "tool_name");
@@ -436,6 +442,11 @@ function _earlyReadInput(prefetchedInput) {
436
442
  const inputData = fs.readFileSync(0, "utf8").trim();
437
443
  if (inputData) {
438
444
  const parsed = JSON.parse(inputData);
445
+ const validated = HookInputSchema.safeParse(parsed);
446
+ if (!validated.success) {
447
+ logWarn("hook_utils", `Early input schema validation failed: ${validated.error.message}`);
448
+ return;
449
+ }
439
450
  if (parsed && typeof parsed === "object") {
440
451
  _prefetchedInput = parsed;
441
452
  _lastHookEvent = readStringField(parsed, "hook_event_name");
@@ -0,0 +1,7 @@
1
+ import type { ContextState } from "../types.js";
2
+ export interface PromptBindingResult {
3
+ outputs: string[];
4
+ blockedReason?: string;
5
+ }
6
+ export declare function shouldClearHandoff(state: ContextState): boolean;
7
+ export declare function executePromptBinding(prompt: string | undefined, sessionId: string, permissionMode: string, projectRoot: string): Promise<PromptBindingResult>;
@@ -0,0 +1,50 @@
1
+ import { safeMaybeActivate, logInfo, logWarn } from "./hook-utils.js";
2
+ import { buildContextInventory } from "../context/context-formatter.js";
3
+ import { BlockRequest, determineContext } from "../context/context-selector.js";
4
+ import { bindSession, getContextBySessionId, saveState, } from "../context/context-store.js";
5
+ export function shouldClearHandoff(state) {
6
+ return Boolean(state.handoff_path);
7
+ }
8
+ export async function executePromptBinding(prompt, sessionId, permissionMode, projectRoot) {
9
+ const outputs = [];
10
+ const existingCtx = getContextBySessionId(sessionId, projectRoot);
11
+ if (existingCtx) {
12
+ safeMaybeActivate(existingCtx.id, permissionMode, projectRoot, "user_prompt_submit");
13
+ return { outputs };
14
+ }
15
+ if (!prompt)
16
+ return { outputs };
17
+ try {
18
+ const [contextId, method, outputText] = await determineContext(prompt, sessionId, projectRoot);
19
+ if (contextId) {
20
+ bindSession(contextId, sessionId, projectRoot);
21
+ safeMaybeActivate(contextId, permissionMode, projectRoot, "user_prompt_submit");
22
+ const state = getContextBySessionId(sessionId, projectRoot);
23
+ if (state && shouldClearHandoff(state)) {
24
+ state.handoff_path = null;
25
+ saveState(state.id, state, projectRoot);
26
+ }
27
+ logInfo("user_prompt_submit", `Context ${contextId} via ${method}`);
28
+ }
29
+ if (outputText)
30
+ outputs.push(outputText);
31
+ try {
32
+ const boundState = getContextBySessionId(sessionId, projectRoot);
33
+ if (boundState) {
34
+ const inventory = buildContextInventory(boundState, projectRoot);
35
+ if (inventory)
36
+ outputs.push(inventory);
37
+ }
38
+ }
39
+ catch (error) {
40
+ logWarn("user_prompt_submit", `Inventory failed (non-critical): ${error}`);
41
+ }
42
+ }
43
+ catch (error) {
44
+ if (error instanceof BlockRequest) {
45
+ return { outputs, blockedReason: error.message };
46
+ }
47
+ throw error;
48
+ }
49
+ return { outputs };
50
+ }
@@ -1,4 +1,5 @@
1
1
  import * as crypto from "node:crypto";
2
+ import { determineArtifactType } from "../context/context-store.js";
2
3
  import { extractPlanAnchors, generatePlanId, normalizePlanContent, } from "../context/plan-manager.js";
3
4
  import { nowIso } from "../runtime/utils.js";
4
5
  function formatArchiveTimestamp(date) {
@@ -8,19 +9,6 @@ function formatArchiveTimestamp(date) {
8
9
  `${String(date.getHours()).padStart(2, "0")}` +
9
10
  `${String(date.getMinutes()).padStart(2, "0")}`);
10
11
  }
11
- function resolveArtifactType(state) {
12
- if (state.next_artifact_type)
13
- return state.next_artifact_type;
14
- const hasPlan = Boolean(state.plan_path && state.plan_hash);
15
- const hasHandoff = Boolean(state.handoff_path);
16
- if (hasPlan && hasHandoff)
17
- return "plan";
18
- if (hasPlan)
19
- return "plan";
20
- if (hasHandoff)
21
- return "handoff";
22
- return null;
23
- }
24
12
  export function computePlanFallback(state, planContent) {
25
13
  const normalized = normalizePlanContent(planContent);
26
14
  const planHash = crypto
@@ -37,7 +25,7 @@ export function computePlanFallback(state, planContent) {
37
25
  };
38
26
  }
39
27
  export function shouldStage(state, permissionMode) {
40
- const artifactType = resolveArtifactType(state);
28
+ const artifactType = determineArtifactType(state);
41
29
  const canStage = state.mode === "active" || permissionMode === "plan";
42
30
  return Boolean(artifactType && canStage && !state.work_consumed);
43
31
  }
@@ -1,27 +1,20 @@
1
1
  import { promises as fs } from 'node:fs';
2
2
  import { IdePathResolver } from './ide-path-resolver.js';
3
+ import { readJsonFile, writeJsonFile } from './json-io.js';
3
4
  import { pathExists } from './paths.js';
4
5
  const CORE_RUNTIME_FOLDERS = new Set(['_core']);
5
6
  const RESERVED_AIWCLI_FOLDERS = new Set(['_output', 'state', ...CORE_RUNTIME_FOLDERS]);
6
7
  const VERSION = 1;
7
8
  export async function readInstallState(targetDir) {
8
9
  const statePath = new IdePathResolver(targetDir).getInstallStatePath();
9
- try {
10
- const content = await fs.readFile(statePath, 'utf8');
11
- const parsed = JSON.parse(content);
12
- if (parsed.version !== VERSION || !parsed.core || !parsed.methods || !parsed.ides)
13
- return undefined;
14
- return parsed;
15
- }
16
- catch {
10
+ const parsed = await readJsonFile(statePath);
11
+ if (!parsed || parsed.version !== VERSION || !parsed.core || !parsed.methods || !parsed.ides)
17
12
  return undefined;
18
- }
13
+ return parsed;
19
14
  }
20
15
  export async function writeInstallState(targetDir, state) {
21
- const resolver = new IdePathResolver(targetDir);
22
- const statePath = resolver.getInstallStatePath();
23
- await fs.mkdir(resolver.getAiwcliStateDir(), { recursive: true });
24
- await fs.writeFile(statePath, JSON.stringify(state, null, 2), 'utf8');
16
+ const statePath = new IdePathResolver(targetDir).getInstallStatePath();
17
+ await writeJsonFile(statePath, state);
25
18
  }
26
19
  export async function ensureInstallState(targetDir) {
27
20
  const existing = await readInstallState(targetDir);
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Read a JSON file and parse it as type T.
3
+ * Returns undefined if the file doesn't exist or can't be parsed.
4
+ */
5
+ export declare function readJsonFile<T>(filePath: string): Promise<T | undefined>;
6
+ /**
7
+ * Write data as JSON to a file, optionally creating a backup of the existing file.
8
+ * Creates parent directories if needed.
9
+ */
10
+ export declare function writeJsonFile<T>(filePath: string, data: T, options?: {
11
+ backup?: boolean;
12
+ }): Promise<void>;
@@ -0,0 +1,30 @@
1
+ import { promises as fs } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { pathExists } from './paths.js';
4
+ /**
5
+ * Read a JSON file and parse it as type T.
6
+ * Returns undefined if the file doesn't exist or can't be parsed.
7
+ */
8
+ export async function readJsonFile(filePath) {
9
+ try {
10
+ const content = await fs.readFile(filePath, 'utf8');
11
+ return JSON.parse(content);
12
+ }
13
+ catch {
14
+ return undefined;
15
+ }
16
+ }
17
+ /**
18
+ * Write data as JSON to a file, optionally creating a backup of the existing file.
19
+ * Creates parent directories if needed.
20
+ */
21
+ export async function writeJsonFile(filePath, data, options) {
22
+ const dir = join(filePath, '..');
23
+ await fs.mkdir(dir, { recursive: true });
24
+ if (options?.backup && await pathExists(filePath)) {
25
+ const backupPath = `${filePath}.backup`;
26
+ await fs.copyFile(filePath, backupPath);
27
+ }
28
+ const content = JSON.stringify(data, null, 2);
29
+ await fs.writeFile(filePath, content, 'utf8');
30
+ }
@@ -1,56 +1,64 @@
1
1
  /**
2
2
  * Unified multiplexer abstraction.
3
- * Single interface for tmux (Unix) and psmux (Windows) backends.
3
+ * Backends implement the Multiplexer interface: resolveStrategy() for context-aware
4
+ * decision making, split()/createSession() for pane management.
4
5
  * Factory: detectMultiplexer() → Multiplexer | null
5
6
  */
6
- export type MultiplexerBackend = 'psmux' | 'tmux';
7
- export type SplitDirection = 'auto' | 'h' | 'v';
8
- export interface SplitPaneOptions {
7
+ export type LaunchStrategy = 'split' | 'create-session' | 'inline' | 'unavailable';
8
+ export interface StrategyContext {
9
+ calledFromRepl: boolean;
10
+ platform: NodeJS.Platform;
11
+ disableMux: boolean;
12
+ }
13
+ export interface ResolvedStrategy {
14
+ strategy: LaunchStrategy;
15
+ reason: string;
16
+ }
17
+ export type SplitDirection = 'auto' | 'horizontal' | 'vertical';
18
+ export interface SplitOptions {
19
+ toolName: string;
9
20
  args: string[];
10
- autoClose?: boolean | undefined;
11
- cwd?: string | undefined;
12
- env?: Record<string, string> | undefined;
13
- holdMessage?: string | undefined;
14
- holdPane?: boolean | undefined;
15
- mode?: 'exec' | 'repl' | undefined;
21
+ cwd: string;
22
+ env: Record<string, string>;
23
+ mode: 'exec' | 'repl';
24
+ split: SplitDirection;
16
25
  promptPath?: string | undefined;
17
- sentinel?: boolean | undefined;
18
- split?: SplitDirection | undefined;
19
- splitTarget?: string | undefined;
20
- toolName: string;
26
+ sentinelPath: string;
27
+ holdPane: boolean;
28
+ retryOnQuickExit: boolean;
21
29
  }
22
- export interface SplitPaneResult {
23
- backend: MultiplexerBackend;
24
- exitCode?: number | undefined;
30
+ export interface LaunchResult {
25
31
  launched: boolean;
26
- paneId?: string | undefined;
27
- reason?: string | undefined;
32
+ backend: string;
33
+ handle?: string | undefined;
28
34
  sentinelPath?: string | undefined;
29
- stderr?: string | undefined;
35
+ exitCode?: number | undefined;
36
+ reason?: string | undefined;
30
37
  }
31
38
  export interface CreateSessionOptions {
32
- enableMouse?: boolean | undefined;
33
- promptText?: string | undefined;
34
- reattach?: boolean | undefined;
35
39
  sessionName: string;
36
- toolArgs: string[];
37
40
  toolPath: string;
38
- }
39
- export interface CreateSessionResult {
40
- exitCode: number;
41
- reason?: string | undefined;
42
- usedMux: boolean;
41
+ toolArgs: string[];
42
+ cwd: string;
43
+ promptText?: string | undefined;
44
+ reattach: boolean;
45
+ enableMouse?: boolean | undefined;
43
46
  }
44
47
  export interface Multiplexer {
45
- readonly backend: MultiplexerBackend;
46
- createSession(options: CreateSessionOptions): Promise<CreateSessionResult>;
47
- isInsideSession(): boolean;
48
- kill(paneId: string): Promise<void>;
49
- splitPane(options: SplitPaneOptions): Promise<SplitPaneResult>;
48
+ readonly backend: string;
49
+ resolveStrategy(ctx: StrategyContext): ResolvedStrategy;
50
+ split(options: SplitOptions): Promise<LaunchResult>;
51
+ createSession(options: CreateSessionOptions): Promise<LaunchResult>;
52
+ kill(handle: string): Promise<void>;
50
53
  }
54
+ /**
55
+ * Resolve the priority order of multiplexer backends for a given platform.
56
+ * Pure function — no I/O, no PATH checks. Used by detectMultiplexer().
57
+ */
58
+ export declare function resolveMultiplexerPriority(platform: NodeJS.Platform, env?: Record<string, string | undefined>): string[];
51
59
  /**
52
60
  * Detect the best available multiplexer for the current platform.
53
- * Windows → PsmuxMultiplexer (if installed and meets version requirement)
61
+ * Windows → WeztermMultiplexer (if inside WezTerm) PsmuxMultiplexer (fallback)
54
62
  * Unix → TmuxMultiplexer (if tmux binary on PATH)
55
63
  * Returns null if no multiplexer is available.
56
64
  */
@@ -1,16 +1,35 @@
1
1
  /**
2
2
  * Unified multiplexer abstraction.
3
- * Single interface for tmux (Unix) and psmux (Windows) backends.
3
+ * Backends implement the Multiplexer interface: resolveStrategy() for context-aware
4
+ * decision making, split()/createSession() for pane management.
4
5
  * Factory: detectMultiplexer() → Multiplexer | null
5
6
  */
7
+ /**
8
+ * Resolve the priority order of multiplexer backends for a given platform.
9
+ * Pure function — no I/O, no PATH checks. Used by detectMultiplexer().
10
+ */
11
+ export function resolveMultiplexerPriority(platform, env = {}) {
12
+ if (platform === 'win32') {
13
+ // Prefer WezTerm if we detect a WezTerm environment
14
+ if (env.WEZTERM_PANE || env.TERM_PROGRAM === 'WezTerm') {
15
+ return ['wezterm', 'psmux'];
16
+ }
17
+ return ['psmux'];
18
+ }
19
+ return ['tmux'];
20
+ }
6
21
  /**
7
22
  * Detect the best available multiplexer for the current platform.
8
- * Windows → PsmuxMultiplexer (if installed and meets version requirement)
23
+ * Windows → WeztermMultiplexer (if inside WezTerm) PsmuxMultiplexer (fallback)
9
24
  * Unix → TmuxMultiplexer (if tmux binary on PATH)
10
25
  * Returns null if no multiplexer is available.
11
26
  */
12
27
  export async function detectMultiplexer(platform = process.platform) {
13
28
  if (platform === 'win32') {
29
+ const { WeztermMultiplexer } = await import('./multiplexers/wezterm.js');
30
+ const wezterm = WeztermMultiplexer.create();
31
+ if (wezterm)
32
+ return wezterm;
14
33
  const { PsmuxMultiplexer } = await import('./multiplexers/psmux.js');
15
34
  return PsmuxMultiplexer.create();
16
35
  }
@@ -1,8 +1,10 @@
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
- import type { CreateSessionOptions, CreateSessionResult, Multiplexer, SplitPaneOptions, SplitPaneResult } from '../multiplexer.js';
6
+ import type { CreateSessionOptions, LaunchResult, Multiplexer, ResolvedStrategy, SplitOptions, StrategyContext } from '../multiplexer.js';
7
+ import type { ShellAdapter } from '../shell-adapters/shell-adapter.js';
6
8
  /** @internal */
7
9
  export interface PsmuxVersion {
8
10
  major: number;
@@ -13,16 +15,9 @@ export interface PsmuxVersion {
13
15
  export declare function meetsMinVersion(v: PsmuxVersion): boolean;
14
16
  /** @internal */
15
17
  export declare function parseVersionString(stdout: string): null | PsmuxVersion;
16
- /** @internal */
17
- export declare function buildCommandArgs(args: string[], mode: 'exec' | 'repl', promptPath?: string): string[];
18
- /** @internal */
19
- export declare function buildPowerShellToolCommand(params: {
20
- args: string[];
21
- env: Record<string, string>;
22
- mode: 'exec' | 'repl';
23
- promptPath?: string;
24
- toolPath: string;
25
- }): string;
18
+ type PsmuxSplitFlag = '-h' | '-v';
19
+ /** @internal translate unified SplitDirection to psmux flag. */
20
+ export declare function toPsmuxSplitFlag(direction: 'horizontal' | 'vertical'): PsmuxSplitFlag;
26
21
  /** @internal */
27
22
  export declare function buildCreateSessionArgs(params: {
28
23
  cwd: string;
@@ -41,27 +36,13 @@ export declare function buildAttachArgs(sessionName: string): string[];
41
36
  export declare class PsmuxMultiplexer implements Multiplexer {
42
37
  readonly backend: "psmux";
43
38
  private readonly psmuxPath;
39
+ private readonly shell;
44
40
  private constructor();
45
- /**
46
- * Check if psmux is installed and meets version requirements.
47
- * Checks PATH first, then probes the winget install directory
48
- * (winget install doesn't always add packages to PATH).
49
- * Returns a PsmuxMultiplexer instance or null.
50
- */
51
41
  static create(): Promise<null | PsmuxMultiplexer>;
52
- /**
53
- * Create a new psmux session.
54
- * Injects PSMUX_PANE=1 into the PowerShell command so child processes
55
- * can detect they're inside a psmux session.
56
- */
57
- createSession(options: CreateSessionOptions): Promise<CreateSessionResult>;
58
- /**
59
- * Detect if we're inside a psmux session we created.
60
- * Uses PSMUX_PANE env var that we inject in createSession().
61
- */
62
- isInsideSession(): boolean;
63
- kill(paneId: string): Promise<void>;
64
- splitPane(options: SplitPaneOptions): Promise<SplitPaneResult>;
42
+ resolveStrategy(ctx: StrategyContext): ResolvedStrategy;
43
+ createSession(options: CreateSessionOptions): Promise<LaunchResult>;
44
+ kill(handle: string): Promise<void>;
45
+ split(options: SplitOptions): Promise<LaunchResult>;
65
46
  private applyBootstrapDefaults;
66
47
  private hasSession;
67
48
  private resolveAutoSplit;
@@ -70,6 +51,5 @@ export declare class PsmuxMultiplexer implements Multiplexer {
70
51
  /** @internal */
71
52
  export declare function buildPsmuxBootstrapCommands(enableMouse?: boolean): string[][];
72
53
  /** @internal */
73
- export declare function buildPsmuxShellCommand(opts: CreateSessionOptions, promptFilePath?: string): string;
74
- /** @internal */
75
- export declare function formatPromptPathForBootstrap(promptPath: string): string;
54
+ export declare function buildPsmuxShellCommand(shell: ShellAdapter, opts: CreateSessionOptions, promptFilePath?: string): string;
55
+ export {};