@nathapp/nax 0.45.0 → 0.46.1
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.
- package/CHANGELOG.md +33 -0
- package/bin/nax.ts +7 -6
- package/dist/nax.js +340 -202
- package/package.json +1 -1
- package/src/acceptance/generator.ts +1 -1
- package/src/acceptance/types.ts +2 -0
- package/src/agents/acp/adapter.ts +34 -6
- package/src/agents/acp/cost.ts +5 -75
- package/src/agents/acp/index.ts +0 -2
- package/src/agents/acp/parser.ts +57 -104
- package/src/agents/acp/spawn-client.ts +13 -2
- package/src/agents/{claude.ts → claude/adapter.ts} +15 -12
- package/src/agents/{claude-complete.ts → claude/complete.ts} +3 -3
- package/src/agents/claude/cost.ts +16 -0
- package/src/agents/{claude-execution.ts → claude/execution.ts} +17 -6
- package/src/agents/claude/index.ts +3 -0
- package/src/agents/{claude-interactive.ts → claude/interactive.ts} +4 -4
- package/src/agents/{claude-plan.ts → claude/plan.ts} +12 -9
- package/src/agents/cost/calculate.ts +154 -0
- package/src/agents/cost/index.ts +10 -0
- package/src/agents/cost/parse.ts +97 -0
- package/src/agents/cost/pricing.ts +59 -0
- package/src/agents/cost/types.ts +45 -0
- package/src/agents/index.ts +6 -4
- package/src/agents/registry.ts +5 -5
- package/src/agents/{claude-decompose.ts → shared/decompose.ts} +2 -2
- package/src/agents/{model-resolution.ts → shared/model-resolution.ts} +2 -2
- package/src/agents/{types-extended.ts → shared/types-extended.ts} +4 -4
- package/src/agents/{validation.ts → shared/validation.ts} +2 -2
- package/src/agents/{version-detection.ts → shared/version-detection.ts} +3 -3
- package/src/agents/types.ts +11 -4
- package/src/cli/agents.ts +1 -1
- package/src/cli/init.ts +15 -1
- package/src/pipeline/stages/acceptance-setup.ts +1 -0
- package/src/pipeline/stages/acceptance.ts +5 -8
- package/src/pipeline/stages/regression.ts +2 -0
- package/src/pipeline/stages/verify.ts +5 -10
- package/src/precheck/checks-agents.ts +1 -1
- package/src/precheck/checks-git.ts +28 -2
- package/src/precheck/checks-warnings.ts +30 -2
- package/src/precheck/checks.ts +1 -0
- package/src/precheck/index.ts +2 -0
- package/src/utils/log-test-output.ts +25 -0
- package/src/agents/cost.ts +0 -268
- /package/src/agents/{adapters/aider.ts → aider/adapter.ts} +0 -0
- /package/src/agents/{adapters/codex.ts → codex/adapter.ts} +0 -0
- /package/src/agents/{adapters/gemini.ts → gemini/adapter.ts} +0 -0
- /package/src/agents/{adapters/opencode.ts → opencode/adapter.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,39 @@ 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.1] - 2026-03-17
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **BUG-074:** `working-tree-clean` precheck now allows 12 nax runtime files to be dirty without blocking. Includes fix for `--porcelain` trim bug that corrupted leading status chars.
|
|
12
|
+
- **BUG-074:** `nax init` now adds complete gitignore entries for all nax runtime files (was missing: status.json, plan/, acp-sessions.json, interactions/, progress.txt, acceptance-refined.json, .nax-pids, .nax-wt/, ~/).
|
|
13
|
+
- **BUG-074:** `checkGitignoreCoversNax` warning now checks 6 critical patterns (was only 3).
|
|
14
|
+
- **BUG-075:** `acceptance-refined.json` now written to featureDir instead of workdir root.
|
|
15
|
+
- **BUG-076:** HOME env is now validated before passing to spawned agents — if not an absolute path (e.g. unexpanded "~"), falls back to `os.homedir()` with a warning log. Prevents literal "~/" directory creation in repo.
|
|
16
|
+
- **BUG-076:** New `checkHomeEnvValid()` precheck warning fires when HOME is unset or not absolute.
|
|
17
|
+
|
|
18
|
+
### Tests
|
|
19
|
+
- New tests in `test/unit/precheck/checks-git.test.ts` (188 lines) for working-tree-clean allowlist.
|
|
20
|
+
- New tests in `test/unit/agents/claude/execution.test.ts` (79 lines) for HOME sanitization.
|
|
21
|
+
|
|
22
|
+
## [0.46.0] - 2026-03-16
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
- **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`.
|
|
26
|
+
- **ACP `complete()` cost:** Now logs exact cost via `getSafeLogger()` — previously had zero cost tracking.
|
|
27
|
+
- **`run()` cost:** Prefers exact `cost.amount` from acpx over token-based estimation; falls back to `estimateCostFromTokenUsage` when unavailable.
|
|
28
|
+
|
|
29
|
+
### Refactored
|
|
30
|
+
- **`src/agents/` folder restructure:** Each adapter now lives in its own subfolder for consistency.
|
|
31
|
+
- `claude/` — Claude Code adapter (adapter, execution, complete, interactive, plan, cost)
|
|
32
|
+
- `acp/` — ACP protocol adapter (unchanged internals)
|
|
33
|
+
- `aider/`, `codex/`, `gemini/`, `opencode/` — per-adapter subfolders
|
|
34
|
+
- `shared/` — cross-adapter utilities: `decompose` (extracted from both claude + acp), `model-resolution`, `validation`, `version-detection`, `types-extended`
|
|
35
|
+
- **Dead code removal:** `streamJsonRpcEvents` (exported but never called), stale `estimateCostFromTokenUsage` re-export from `acp/index.ts`.
|
|
36
|
+
|
|
37
|
+
### Docs
|
|
38
|
+
- **ARCHITECTURE.md §1:** Updated `src/agents/` tree.
|
|
39
|
+
- **ARCHITECTURE.md §16:** New section — agent adapter folder conventions, `shared/` rules, ACP cost alignment.
|
|
40
|
+
|
|
8
41
|
## [0.43.0] - 2026-03-16
|
|
9
42
|
|
|
10
43
|
### 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
|
|
370
|
-
|
|
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(
|
|
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
|
|
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,
|
|
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
|
|