@nathapp/nax 0.44.0 → 0.46.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 (41) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/bin/nax.ts +7 -6
  3. package/dist/nax.js +266 -161
  4. package/package.json +1 -1
  5. package/src/agents/acp/adapter.ts +34 -6
  6. package/src/agents/acp/index.ts +0 -2
  7. package/src/agents/acp/parser.ts +57 -104
  8. package/src/agents/acp/spawn-client.ts +2 -1
  9. package/src/agents/{claude.ts → claude/adapter.ts} +15 -12
  10. package/src/agents/{claude-complete.ts → claude/complete.ts} +3 -3
  11. package/src/agents/{cost.ts → claude/cost.ts} +1 -1
  12. package/src/agents/{claude-execution.ts → claude/execution.ts} +5 -5
  13. package/src/agents/claude/index.ts +3 -0
  14. package/src/agents/{claude-interactive.ts → claude/interactive.ts} +4 -4
  15. package/src/agents/{claude-plan.ts → claude/plan.ts} +12 -9
  16. package/src/agents/index.ts +5 -5
  17. package/src/agents/registry.ts +5 -5
  18. package/src/agents/{claude-decompose.ts → shared/decompose.ts} +7 -22
  19. package/src/agents/{model-resolution.ts → shared/model-resolution.ts} +2 -2
  20. package/src/agents/{types-extended.ts → shared/types-extended.ts} +4 -4
  21. package/src/agents/{validation.ts → shared/validation.ts} +2 -2
  22. package/src/agents/{version-detection.ts → shared/version-detection.ts} +3 -3
  23. package/src/agents/types.ts +8 -4
  24. package/src/cli/agents.ts +1 -1
  25. package/src/cli/plan.ts +4 -11
  26. package/src/config/test-strategy.ts +70 -0
  27. package/src/execution/lifecycle/acceptance-loop.ts +2 -0
  28. package/src/execution/parallel-coordinator.ts +3 -1
  29. package/src/execution/parallel-executor.ts +3 -0
  30. package/src/execution/runner-execution.ts +16 -2
  31. package/src/execution/story-context.ts +6 -0
  32. package/src/pipeline/stages/acceptance.ts +5 -8
  33. package/src/pipeline/stages/regression.ts +2 -0
  34. package/src/pipeline/stages/verify.ts +5 -10
  35. package/src/prd/schema.ts +4 -14
  36. package/src/precheck/checks-agents.ts +1 -1
  37. package/src/utils/log-test-output.ts +25 -0
  38. /package/src/agents/{adapters/aider.ts → aider/adapter.ts} +0 -0
  39. /package/src/agents/{adapters/codex.ts → codex/adapter.ts} +0 -0
  40. /package/src/agents/{adapters/gemini.ts → gemini/adapter.ts} +0 -0
  41. /package/src/agents/{adapters/opencode.ts → opencode/adapter.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.46.0] - 2026-03-16
9
+
10
+ ### Fixed
11
+ - **ACP cost metric:** Cost was always `$0` for ACP sessions. `parseAcpxJsonOutput` now handles JSON-RPC envelope format (acpx v0.3+): extracts text from `agent_message_chunk`, captures exact USD cost from `usage_update` (`cost.amount`), and reads camelCase token breakdown (`inputTokens`, `outputTokens`, `cachedReadTokens`, `cachedWriteTokens`) from `result.usage`.
12
+ - **ACP `complete()` cost:** Now logs exact cost via `getSafeLogger()` — previously had zero cost tracking.
13
+ - **`run()` cost:** Prefers exact `cost.amount` from acpx over token-based estimation; falls back to `estimateCostFromTokenUsage` when unavailable.
14
+
15
+ ### Refactored
16
+ - **`src/agents/` folder restructure:** Each adapter now lives in its own subfolder for consistency.
17
+ - `claude/` — Claude Code adapter (adapter, execution, complete, interactive, plan, cost)
18
+ - `acp/` — ACP protocol adapter (unchanged internals)
19
+ - `aider/`, `codex/`, `gemini/`, `opencode/` — per-adapter subfolders
20
+ - `shared/` — cross-adapter utilities: `decompose` (extracted from both claude + acp), `model-resolution`, `validation`, `version-detection`, `types-extended`
21
+ - **Dead code removal:** `streamJsonRpcEvents` (exported but never called), stale `estimateCostFromTokenUsage` re-export from `acp/index.ts`.
22
+
23
+ ### Docs
24
+ - **ARCHITECTURE.md §1:** Updated `src/agents/` tree.
25
+ - **ARCHITECTURE.md §16:** New section — agent adapter folder conventions, `shared/` rules, ACP cost alignment.
26
+
8
27
  ## [0.43.0] - 2026-03-16
9
28
 
10
29
  ### Added
package/bin/nax.ts CHANGED
@@ -366,10 +366,11 @@ program
366
366
  }
367
367
 
368
368
  try {
369
- // Initialize plan logger before calling planCommand — writes to features/<feature>/plan-<ts>.jsonl
370
- mkdirSync(featureDir, { recursive: true });
369
+ // Initialize plan logger before calling planCommand — writes to features/<feature>/plan/<ts>.jsonl
370
+ const planLogDir = join(featureDir, "plan");
371
+ mkdirSync(planLogDir, { recursive: true });
371
372
  const planLogId = new Date().toISOString().replace(/:/g, "-").replace(/\..+/, "");
372
- const planLogPath = join(featureDir, `plan-${planLogId}.jsonl`);
373
+ const planLogPath = join(planLogDir, `${planLogId}.jsonl`);
373
374
  initLogger({ level: "info", filePath: planLogPath, useChalk: false, headless: true });
374
375
  console.log(chalk.dim(` [Plan log: ${planLogPath}]`));
375
376
 
@@ -688,11 +689,11 @@ program
688
689
  // Load config
689
690
  const config = await loadConfig(workdir);
690
691
 
691
- // Initialize logger — writes to nax/features/<feature>/plan-<timestamp>.jsonl
692
- const featureLogDir = join(naxDir, "features", options.feature);
692
+ // Initialize logger — writes to nax/features/<feature>/plan/<timestamp>.jsonl
693
+ const featureLogDir = join(naxDir, "features", options.feature, "plan");
693
694
  mkdirSync(featureLogDir, { recursive: true });
694
695
  const planLogId = new Date().toISOString().replace(/:/g, "-").replace(/\..+/, "");
695
- const planLogPath = join(featureLogDir, `plan-${planLogId}.jsonl`);
696
+ const planLogPath = join(featureLogDir, `${planLogId}.jsonl`);
696
697
  initLogger({ level: "info", filePath: planLogPath, useChalk: false, headless: true });
697
698
  console.log(chalk.dim(` [Plan log: ${planLogPath}]`));
698
699