@nathapp/nax-agent-acp 0.85.0 → 0.85.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 CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to `@nathapp/nax-agent-acp` are recorded here. Versions move in
4
4
  step with `@nathapp/nax-agent`.
5
5
 
6
+ ## [0.85.1] - 2026-10-10
7
+
8
+ ### Added
9
+
10
+ - The server honours `execution.compaction` from `~/.nax/config.json` and passes it to the native backend. An invalid value is handled like any other invalid section of the file: one warning on stderr and the built-in defaults (#2427).
11
+
12
+ ### Changed
13
+
14
+ - Behaviour change, from `@nathapp/nax-agent`: editor threads now compact their history by default (see its changelog), so a long thread no longer ends `errored` at the context window. Each compaction adds one billed summary call. Set `execution.compaction.enabled` to `false` in `config.json` for the old behaviour (#2427).
15
+
6
16
  ## [0.85.0] - 2026-10-09
7
17
 
8
18
  ### Added
package/README.md CHANGED
@@ -4,7 +4,7 @@ ACP (Agent Client Protocol) backend for `@nathapp/nax-agent` sessions. It lets t
4
4
  nax-agent session API (`createAgentSession`, `send()`, `answer()`, `cancel()`, `close()`)
5
5
  drive external coding agents such as Claude Code over ACP.
6
6
 
7
- **Status: 0.4.0.** `./client`: `acpBackend()` drives external ACP agents (Claude Code and others) as
7
+ **Status:** released in lockstep with `@nathapp/nax` (see CHANGELOG.md). `./client`: `acpBackend()` drives external ACP agents (Claude Code and others) as
8
8
  nax-agent sessions. `./server` and the `nax-agent` binary: nax-agent's own native coding agent as an
9
9
  ACP server for editors (Zed) and headless clients (acpx). See "The nax-agent ACP server" below.
10
10
 
@@ -252,6 +252,7 @@ It reads `~/.nax/config.json`, the same file nax uses:
252
252
  - `models.native.balanced` is the default model. `fast`, `balanced` and `powerful` are the models offered in the editor.
253
253
  - `auth` controls where credentials come from.
254
254
  - An optional `agentServer` block sets `defaultMode`, `bashApproval` and `sessionsDir`.
255
+ - `execution.compaction` (`enabled`, `compactAtPercent`, `keepRecentPercent`) is honoured, with the same meaning as in nax. Editor threads compact their history by default when it nears the model's context window, and a context overflow is compacted and retried once; set `{ "enabled": false }` to turn it off. A value nax would reject (for example `compactAtPercent` outside 50-99) is treated like any other invalid section: the server logs a warning to stderr and uses its built-in defaults. Changes need a restart.
255
256
 
256
257
  Flags (`--model`, `--mode`, `--bash-approval`, `--config-dir`, `--sessions-dir`) and `NAX_AGENT_<OPTION>`
257
258
  environment variables override the file. Sessions are stored under `~/.nax/.agent-server/sessions/`.
@@ -97,6 +97,7 @@ async function serveAcp(flags, deps) {
97
97
  transcripts,
98
98
  catalogOverrides: overrides,
99
99
  turnTimeoutSeconds: TURN_TIMEOUT_SECONDS,
100
+ ...(resolved.options.compaction !== undefined ? { compaction: resolved.options.compaction } : {}),
100
101
  }),
101
102
  storage,
102
103
  transcripts,
@@ -1,4 +1,4 @@
1
- import type { AgentSessionProfile, CredentialAuthConfig, CredentialsConfig } from "@nathapp/nax-agent";
1
+ import { type AgentSessionProfile, type CredentialAuthConfig, type CredentialsConfig, type NativeBackendOptions } from "@nathapp/nax-agent";
2
2
  export type ReadTextFile = (path: string, encoding: "utf8") => Promise<string>;
3
3
  export type BashApproval = "gated" | "escalate" | "raw";
4
4
  export declare const TIERS: readonly ["fast", "balanced", "powerful"];
@@ -13,11 +13,15 @@ export interface AgentServerSection {
13
13
  readonly sessionsDir?: string;
14
14
  readonly mcpConnectTimeoutSeconds?: number;
15
15
  }
16
+ /** `execution.compaction` as nax-agent's native backend takes it; nax-agent validates and applies the defaults. */
17
+ export type CompactionSettings = NonNullable<NativeBackendOptions["compaction"]>;
16
18
  export interface NaxConfigSubset {
17
19
  readonly tiers: readonly TierModel[];
18
20
  readonly catalogOverrides: readonly Readonly<Record<string, unknown>>[];
19
21
  readonly auth: CredentialAuthConfig;
20
22
  readonly agentServer: AgentServerSection;
23
+ /** The raw `execution.compaction` object; absent when the file sets none. */
24
+ readonly compaction?: CompactionSettings;
21
25
  }
22
26
  export interface LoadedNaxConfig {
23
27
  readonly config: NaxConfigSubset;
@@ -5,6 +5,7 @@
5
5
  * warning; the server still starts.
6
6
  */
7
7
  import { join } from "node:path";
8
+ import { nativeBackend, } from "@nathapp/nax-agent";
8
9
  import { z } from "zod";
9
10
  export const TIERS = ["fast", "balanced", "powerful"];
10
11
  export const MODES = ["none", "read", "ask", "full"];
@@ -38,6 +39,8 @@ const SubsetSchema = z.object({
38
39
  })
39
40
  .optional(),
40
41
  auth: AuthSchema.optional(),
42
+ // nax owns the rest of `execution`; only compaction is read, and only when it is there.
43
+ execution: z.unknown().optional(),
41
44
  agentServer: z
42
45
  .object({
43
46
  defaultMode: z.enum(MODES).optional(),
@@ -82,6 +85,35 @@ function tiersFrom(native) {
82
85
  }
83
86
  return { tiers };
84
87
  }
88
+ function isPlainRecord(value) {
89
+ return typeof value === "object" && value !== null && !Array.isArray(value);
90
+ }
91
+ const PROBE_MODEL = "openai/compaction-probe";
92
+ const OPTIONS_PREFIX = /^Invalid agent session options: backend\./;
93
+ /**
94
+ * The server does not know the compaction rules: nax-agent owns the schema (it
95
+ * is not importable from here). nativeBackend validates its options when it is
96
+ * built and does no I/O, so building one is the check. That is safe because
97
+ * construction is validation-only: it resolves no credentials and loads no
98
+ * catalog, and the probe model need not exist. nax-agent's native-backend test
99
+ * "construction is validation-only" guards this. The error text is the schema's
100
+ * own message, which never echoes the offending value.
101
+ */
102
+ function compactionFrom(execution) {
103
+ if (!isPlainRecord(execution) || execution.compaction === undefined)
104
+ return {};
105
+ const raw = execution.compaction;
106
+ if (!isPlainRecord(raw))
107
+ return { issue: "execution.compaction: expected an object" };
108
+ const compaction = raw;
109
+ try {
110
+ nativeBackend({ model: PROBE_MODEL, compaction });
111
+ }
112
+ catch (error) {
113
+ return { issue: message(error).replace(OPTIONS_PREFIX, "execution.") };
114
+ }
115
+ return { compaction };
116
+ }
85
117
  function authFrom(auth) {
86
118
  if (auth === undefined)
87
119
  return DEFAULT_AUTH;
@@ -92,7 +124,10 @@ function authFrom(auth) {
92
124
  };
93
125
  }
94
126
  function fallback(path, reason) {
95
- return { config: EMPTY_NAX_CONFIG, warning: `ignoring ${path}: ${reason}; using built-in defaults` };
127
+ return {
128
+ config: EMPTY_NAX_CONFIG,
129
+ warning: `ignoring ${path}: ${reason}; using built-in defaults (model tiers, auth and agentServer from this file are ignored too)`,
130
+ };
96
131
  }
97
132
  export async function loadNaxConfig(configDir, readFile) {
98
133
  const path = join(configDir, "config.json");
@@ -121,8 +156,12 @@ export async function loadNaxConfig(configDir, readFile) {
121
156
  const { tiers, issue } = tiersFrom(parsed.data.models?.native);
122
157
  if (issue !== undefined)
123
158
  return fallback(path, issue);
159
+ const compacted = compactionFrom(parsed.data.execution);
160
+ if (compacted.issue !== undefined)
161
+ return fallback(path, compacted.issue);
124
162
  return {
125
163
  config: {
164
+ ...(compacted.compaction !== undefined ? { compaction: compacted.compaction } : {}),
126
165
  tiers,
127
166
  catalogOverrides: parsed.data.agent?.native?.catalogOverrides ?? [],
128
167
  auth: authFrom(parsed.data.auth),
@@ -5,7 +5,7 @@
5
5
  * facade factories are injectable for tests.
6
6
  */
7
7
  import { type AgentLogger, type AgentSession, type AgentSessionProfile, type CreateAgentSessionOptions, type EmbedderTool, type NativeBackendOptions, type NativeCatalogOverrides, type SessionBackend, type TranscriptDoc, type TranscriptStore } from "@nathapp/nax-agent";
8
- import type { BashApproval } from "#src/server/nax-config";
8
+ import type { BashApproval, CompactionSettings } from "#src/server/nax-config";
9
9
  export interface OpenSessionRequest {
10
10
  readonly sessionId: string;
11
11
  readonly cwd: string;
@@ -26,6 +26,8 @@ export interface NativeOpenDeps {
26
26
  readonly transcripts: TranscriptStore;
27
27
  readonly catalogOverrides: NativeCatalogOverrides;
28
28
  readonly turnTimeoutSeconds: number;
29
+ /** `execution.compaction` from config.json; absent leaves nax-agent's defaults (on). */
30
+ readonly compaction?: CompactionSettings;
29
31
  readonly create?: (options: CreateAgentSessionOptions) => Promise<AgentSession>;
30
32
  readonly resume?: (sessionId: string, options: CreateAgentSessionOptions) => Promise<AgentSession>;
31
33
  readonly backend?: (options: NativeBackendOptions) => SessionBackend;
@@ -42,6 +42,7 @@ export function nativeOpenSession(deps) {
42
42
  carryHistoryAcrossModels: true,
43
43
  ...(TOOL_PROFILES.has(request.profile) ? { bashApproval: request.bashApproval } : {}),
44
44
  ...(deps.catalogOverrides.length > 0 ? { catalogOverrides: deps.catalogOverrides } : {}),
45
+ ...(deps.compaction !== undefined ? { compaction: deps.compaction } : {}),
45
46
  }),
46
47
  sessionId: request.sessionId,
47
48
  profile: request.profile,
@@ -1,6 +1,6 @@
1
1
  import type { AgentSessionProfile } from "@nathapp/nax-agent";
2
2
  import type { CliFlags } from "#src/server/cli";
3
- import { type BashApproval, type NaxConfigSubset, type TierModel } from "#src/server/nax-config";
3
+ import { type BashApproval, type CompactionSettings, type NaxConfigSubset, type TierModel } from "#src/server/nax-config";
4
4
  export type Env = Readonly<Record<string, string | undefined>>;
5
5
  /** S5-5b: the per-server MCP connect timeout, in seconds (1-300). */
6
6
  export declare const MCP_CONNECT_TIMEOUT_SECONDS = 30;
@@ -12,6 +12,8 @@ export interface ServerOptions {
12
12
  readonly bashApproval: BashApproval;
13
13
  readonly tiers: readonly TierModel[];
14
14
  readonly catalogOverrides: readonly Readonly<Record<string, unknown>>[];
15
+ /** `execution.compaction` from config.json, passed to the native backend as given. */
16
+ readonly compaction?: CompactionSettings;
15
17
  readonly mcpConnectTimeoutSeconds: number;
16
18
  }
17
19
  export type OptionsResult = {
@@ -3,7 +3,7 @@
3
3
  * built-in default. Config dir: master plan M-5.
4
4
  */
5
5
  import { join } from "node:path";
6
- import { BASH_APPROVALS, MODES } from "#src/server/nax-config";
6
+ import { BASH_APPROVALS, MODES, } from "#src/server/nax-config";
7
7
  /** S5-5b: the per-server MCP connect timeout, in seconds (1-300). */
8
8
  export const MCP_CONNECT_TIMEOUT_SECONDS = 30;
9
9
  function firstSet(...candidates) {
@@ -66,6 +66,7 @@ export function resolveServerOptions(input) {
66
66
  bashApproval: bash.value,
67
67
  tiers: file.tiers,
68
68
  catalogOverrides: file.catalogOverrides,
69
+ ...(file.compaction !== undefined ? { compaction: file.compaction } : {}),
69
70
  mcpConnectTimeoutSeconds: mcpTimeout.value,
70
71
  },
71
72
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nathapp/nax-agent-acp",
3
- "version": "0.85.0",
3
+ "version": "0.85.1",
4
4
  "description": "ACP (Agent Client Protocol) backend for @nathapp/nax-agent sessions: drive Claude Code and other ACP agents through the nax-agent session API.",
5
5
  "license": "MIT",
6
6
  "author": "William Khoo",
@@ -45,11 +45,11 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@agentclientprotocol/sdk": "~1.7.0",
48
- "@modelcontextprotocol/sdk": "^1.30.0",
48
+ "@modelcontextprotocol/sdk": "^1.32.1",
49
49
  "zod": "^4.3.6"
50
50
  },
51
51
  "peerDependencies": {
52
- "@nathapp/nax-agent": "^0.85.0"
52
+ "@nathapp/nax-agent": "^0.85.1"
53
53
  },
54
54
  "publishConfig": {
55
55
  "access": "public",