@nathapp/nax 0.82.0-canary.7 → 0.82.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 (4) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/README.md +24 -1
  3. package/dist/nax.js +108161 -106451
  4. package/package.json +35 -20
package/CHANGELOG.md CHANGED
@@ -13,10 +13,86 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13
13
  ### Breaking
14
14
 
15
15
  - `autoMode.defaultAgent`, `autoMode.fallbackOrder`, and `context.v2.fallback` config fields removed. Use `agent.default` and `agent.fallback.map` instead (ADR-012 Phase 6). Loading a config containing any of these keys throws `NaxError CONFIG_LEGACY_AGENT_KEYS` with a per-key migration pointer.
16
+ - **BREAKING (custom permission profiles only):** the agent's file-tool containment root moved from the
17
+ story's package directory to the repo root (single-frame redesign). A custom `scoped` permission
18
+ profile's grant globs (e.g. `Write(src/**)`) now match against REPO-ROOTED paths instead of
19
+ package-relative paths — `Write(src/**)` that used to scope a grant to the package's own `src/` now
20
+ matches `src/**` at the repo root only; a monorepo profile author who wants the old scoping must
21
+ rewrite the glob as `Write(packages/*/src/**)` or the specific package path. The default `unrestricted`
22
+ profile is unaffected (it skips glob matching entirely). No config schema change; this is a semantic
23
+ shift in what an existing glob string matches.
16
24
 
17
25
  ### Fixed
18
26
 
19
27
  - **watchdog:** Count ACP `tool_call` / `tool_call_update` stream activity by default, and add `agent.idleWatchdog.toolCallOnlyIdleTimeoutSeconds` (default 1800s) so long-running tool-only sessions stay alive without masking runaway tool loops.
28
+ - **Story fragments no longer name nax's own artifacts.** The fragment collector (`## Files touched`) ran
29
+ `git diff --name-only` with no exclusions, so git-tracked run state such as
30
+ `<pkg>/.nax/cache/test-patterns.json` was recorded as a changed file and then offered to a dependent
31
+ story as something worth reading. Excludes are anchored at the repository root, so the same fragment is
32
+ produced whether the story's workdir is the repo root or a package (#2072).
33
+ - **Monorepo: the agent loop now uses per-package config.** `callOp` resolved its config from the repo
34
+ root, so a story with a `workdir` was given the ROOT `quality.commands` and `RunCommand` ran the wrong
35
+ toolchain (#2066). The registry also missed every override under worktree and parallel isolation, where
36
+ a package resolved through `.nax-wt/<storyId>/` (#2069).
37
+
38
+ **Behaviour change:** `execution.permissionProfile` and `execution.permissions` declared in
39
+ `.nax/mono/<pkg>/config.json` were previously inert at every dispatch site and now apply, completing the
40
+ SEC-3 fix. Per-package `execution.denyPaths`, `models`, `agent.native.transportRetry` and
41
+ `execution.compaction` likewise now take effect. If an overlay in your repo sets any of these, review it
42
+ before upgrading — the resolved profile is now logged once per dispatch.
43
+ - **RunCommand:** `target` supplied with a declared `command` is now rejected (previously the `target`
44
+ was silently discarded); `target` remains valid only for the `argv` branch (#2066).
45
+ - **Review diff paths are now package-relative.** `collectDiff`, `collectDiffStat` and
46
+ `computeTestInventory` ran git without `--relative`, so a monorepo story's reviewer — whose file
47
+ tools are rooted at the package dir — was shown repo-rooted paths like `packages/lib/src/util.ts`.
48
+ Reading one resolved to `<pkg>/packages/lib/...` and failed, costing a round trip per file before
49
+ the model retried. `computeTestInventory` also gained the `-- .` pathspec its siblings already had,
50
+ so the adversarial prompt's test-gap inventory no longer lists files from other packages (#2066).
51
+ - **Fixed** — a same-agent fallback hop dispatched the previous model, because
52
+ `SessionManager` reused a live session whenever the agent name matched and
53
+ discarded the requested endpoint. Same-agent ladder rungs and sticky endpoints
54
+ inherited by warm rectification ops were both inert (#1965).
55
+ - `nax plan --decompose` now persists through `finalizeAndWritePrd` instead of writing the PRD raw, so decompose-created sub-stories get `workdirSource` stamped and their declared paths re-spelled into the repo frame (#2080). The write is scoped to the new sub-stories: workdir derivation and routing resolution do not re-run over stories already in the PRD, which may have executed.
56
+
57
+ ### Changed
58
+
59
+ - **Changed** — `agent.fallback.maxHopsPerStory` now bounds ladder DEPTH per
60
+ (story, tier, agent, role) rather than counting swap events per story, so a
61
+ story keeps descending its ladder across its operations instead of stranding
62
+ later ops on a dead endpoint.
63
+
64
+ ### Added
65
+
66
+ - **Added** — `agent.fallback.map` agents are validated against `agent.protocol`
67
+ at config load instead of failing mid-story at dispatch.
68
+
69
+ ### Fixed
70
+
71
+ - **Fixed** — `resolveFallbackModelId` resolved a literal model pin in
72
+ preference to a co-present tier, so a cooldown recorded at mark time
73
+ (`markUnavailable(agent, failure, tier, dispatchedModel)`, where `tier` is
74
+ declared and `dispatchedModel` is the hop's derived endpoint) and a
75
+ candidate lookup at read time (a bare `{agent, tier}` rung, no model) could
76
+ key on different identities for the same endpoint — a rung that just died
77
+ could read back as healthy. Precedence is now tier-first: when a tier is
78
+ present and `models` is available, the tier map is authoritative, and the
79
+ pin is used only when there is no tier, or the tier fails to resolve.
80
+ - **Fixed** — `AgentManager.configureRuntime` silently dropped `models`. An
81
+ `AgentManager` injected via `opts.agentManager` in `runtime/index.ts` (which
82
+ spreads `models: config.models` into `configureRuntime`) never had its
83
+ `_models` backfilled, so `resolveFallbackModelId` returned `undefined` for
84
+ every tier and a rung like `{agent: "native", model: "powerful"}` never
85
+ folded to its named tier — it dispatched the literal string `"powerful"` as
86
+ a model id, with no error and no log. `configureRuntime` now accepts
87
+ `models` and assigns it with the same guard style as its siblings.
88
+
89
+ ### Migration
90
+
91
+ - **Migration** — a config that names an agent in `agent.fallback.map` which the
92
+ declared `agent.protocol` does not permit is now rejected at config load
93
+ rather than failing mid-story with `AGENT_NOT_FOUND`. A ladder mixing
94
+ `native` with acpx agents requires `agent.protocol: "hybrid"`; previously
95
+ such a config parsed and failed later, at dispatch.
20
96
 
21
97
  ## [0.51.2] — 2026-03-22
22
98
 
package/README.md CHANGED
@@ -120,11 +120,34 @@ For full flag details, see the [CLI Reference](docs/guides/cli-reference.md).
120
120
  "hooks": {
121
121
  "on-all-stories-complete": { "command": "npm run build" } // Fire after all stories pass
122
122
  }
123
+ },
124
+ "mcp": {
125
+ "servers": {
126
+ "codebase-memory": {
127
+ "command": "codebase-memory-mcp", // stdio MCP server binary (client only)
128
+ "args": [], // Optional server args
129
+ "stages": ["run"], // Attach in these pipeline stages ("*" = all)
130
+ "allowedTools": ["search_graph"] // Optional: subset of locked tools that is grantable
131
+ }
132
+ }
133
+ },
134
+ "execution": {
135
+ "commandInterceptor": {
136
+ "provider": "rtk", // Token-reducing proxy for the Git tool
137
+ "enabled": true, // Off by default — opt in per project
138
+ "git": { "verbs": ["log", "diff"] } // Only these subcommands are rewritten
139
+ }
123
140
  }
124
141
  }
125
142
  ```
126
143
 
127
- See [Configuration Guide](docs/guides/configuration.md) for the full schema.
144
+ `mcp` attaches external Model Context Protocol (MCP) servers as tool providers — nax is a client only, never an MCP server. The server id is the tool-name namespace: the `codebase-memory` server advertises its tools as `codebase-memory__search_graph`, `codebase-memory__trace_path`, and so on. Before any of those tools are grantable, run `nax mcp lock` at the project root: it connects every enabled server once, pins the advertised tool surface (name + input-schema hash) to `.nax/mcp-lock.json`, and that lockfile is committed like `bun.lock`. `stages` is the attachment control — a server's tools attach only to the listed pipeline stages, and an empty list attaches nowhere. MCP tools are advertised under the `unrestricted` permission profile only; `safe` and `scoped` resolve no provider tools at all. `allowedTools` narrows which locked tools are grantable; omitted means every locked tool is.
145
+
146
+ `execution.commandInterceptor` rewrites the `Git` tool's argv through `rtk` so `log` and `diff` output reaches the model compressed. It is confined to the Git site: user-authored `quality.commands` and `acceptance.command` are never wrapped. It fails open — if the `rtk` binary is missing the call runs as plain git.
147
+
148
+ **Both features are native-agent only.** An ACP agent (`claude`, `codex`, `opencode`, `gemini`) brings its own tools, so nax's `Git` tool is never invoked and no MCP tool is advertised. A project on `"protocol": "acp"` can hold a complete, valid config for both and get zero effect, with no error. Set `agent.protocol: "hybrid"` and `agent.default: "native"` first.
149
+
150
+ See [MCP & Command Interception](docs/guides/mcp-and-interception.md) for setup, verification and troubleshooting, and the [Configuration Guide](docs/guides/configuration.md) for the full schema.
128
151
 
129
152
  ---
130
153