@nathapp/nax-agent-acp 0.91.3 → 0.91.5

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,14 @@
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.91.5] - 2026-10-23
7
+
8
+ - No changes in this package. Released in lockstep with the other nax packages.
9
+
10
+ ## [0.91.4] - 2026-10-23
11
+
12
+ - No changes in this package. Released in lockstep with the other nax packages.
13
+
6
14
  ## [0.91.3] - 2026-10-22
7
15
 
8
16
  - No changes in this package. Released in lockstep with the other nax packages.
@@ -92,7 +92,14 @@ function routerFor(ctx, options) {
92
92
  cwd: ctx.workdir,
93
93
  agentName: options.agentName,
94
94
  rules: options.rules,
95
- ...(sandbox === undefined ? {} : { sandbox }),
95
+ ...(sandbox === undefined
96
+ ? {}
97
+ : {
98
+ sandbox,
99
+ ...(ctx.sandbox?.kind === "policy" && ctx.sandbox.writeExemption !== undefined
100
+ ? { writeExemption: ctx.sandbox.writeExemption }
101
+ : {}),
102
+ }),
96
103
  ...(options.shellSandboxPlan === undefined
97
104
  ? {}
98
105
  : {
@@ -6,4 +6,4 @@ export declare const _editTargetsDeps: {
6
6
  platform: () => string;
7
7
  };
8
8
  export declare function editTargets(toolCall: unknown): readonly string[];
9
- export declare function firstOutsidePolicy(targets: readonly string[], policy: SandboxPolicy, cwd: string | undefined): Promise<string | undefined>;
9
+ export declare function firstOutsidePolicy(targets: readonly string[], policy: SandboxPolicy, cwd: string | undefined, writeExemption?: string): Promise<string | undefined>;
@@ -111,9 +111,10 @@ const contains = (path, root) => path === root || path.startsWith(root.endsWith(
111
111
  const withinRoot = (path, root) => contains(nfc(path), nfc(root));
112
112
  /** denyWrite matching: case-folded on darwin and win32, so a differently cased spelling is still denied. */
113
113
  const withinDenied = (path, denied) => contains(foldCase(nfc(path)), foldCase(nfc(denied)));
114
- export async function firstOutsidePolicy(targets, policy, cwd) {
114
+ export async function firstOutsidePolicy(targets, policy, cwd, writeExemption) {
115
115
  const roots = await Promise.all(policy.writeRoots.map(canonicalPolicyPath));
116
116
  const denied = await Promise.all(policy.denyWrite.map(canonicalPolicyPath));
117
+ const exemption = writeExemption === undefined ? undefined : await canonical(writeExemption);
117
118
  for (const target of targets) {
118
119
  if (hasDotDotSegment(target))
119
120
  return target;
@@ -123,7 +124,9 @@ export async function firstOutsidePolicy(targets, policy, cwd) {
123
124
  const real = await canonical(absolute);
124
125
  if (real === undefined)
125
126
  return target;
126
- if (denied.some((d) => withinDenied(real, d)) || !roots.some((r) => withinRoot(real, r)))
127
+ // Only this exact canonical file bypasses denyWrite; containment and traversal still apply.
128
+ const exempt = exemption !== undefined && nfc(real) === nfc(exemption);
129
+ if ((!exempt && denied.some((d) => withinDenied(real, d))) || !roots.some((r) => withinRoot(real, r)))
127
130
  return target;
128
131
  }
129
132
  return undefined;
@@ -38,6 +38,8 @@ export interface PermissionContext {
38
38
  readonly signal: AbortSignal;
39
39
  /** nax#2500: the session sandbox policy (review/full on claude); drives the network and R4 path rules. */
40
40
  readonly sandbox?: SandboxPolicy;
41
+ /** Single writable output; bypasses denyWrite only, never write-root containment. */
42
+ readonly writeExemption?: string;
41
43
  /** nax#2500: the session cwd, for resolving relative edit targets (R4). */
42
44
  readonly cwd?: string;
43
45
  /**
@@ -177,7 +177,7 @@ async function decideFull(request, display, offered, auto, ctx) {
177
177
  const targets = editTargets(request.toolCall);
178
178
  const unknownWrite = ctx.sandbox !== undefined && WRITE_KINDS.has(display.tool) && targets.length === 0;
179
179
  const outside = ctx.sandbox !== undefined && display.tool !== "execute" && !READ_ONLY_KINDS.has(display.tool)
180
- ? await firstOutsidePolicy(targets, ctx.sandbox, ctx.cwd)
180
+ ? await firstOutsidePolicy(targets, ctx.sandbox, ctx.cwd, ctx.writeExemption)
181
181
  : undefined;
182
182
  if (unknownWrite || outside !== undefined) {
183
183
  auto(OUTSIDE_WRITE_ROOTS_REASON, "deny");
@@ -86,7 +86,9 @@ async function promptFailure(state, error) {
86
86
  }
87
87
  /** session/cancel, then cancelGraceMs for the prompt to answer; past that the process is killed. */
88
88
  async function cancelTurn(state, pending) {
89
- await state.link.cancel(state.agentSessionId).catch(() => undefined);
89
+ // A backpressured stdin can block the notification itself. Start the grace
90
+ // without waiting for that write so cancellation still reaches the kill path.
91
+ void state.link.cancel(state.agentSessionId).catch(() => undefined);
90
92
  const settled = await race(pending, { timeoutMs: state.cancelGraceMs });
91
93
  if (settled.kind === "ok")
92
94
  return settled.value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nathapp/nax-agent-acp",
3
- "version": "0.91.3",
3
+ "version": "0.91.5",
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",
@@ -49,7 +49,7 @@
49
49
  "zod": "^4.3.6"
50
50
  },
51
51
  "peerDependencies": {
52
- "@nathapp/nax-agent": "^0.91.3"
52
+ "@nathapp/nax-agent": "^0.91.5"
53
53
  },
54
54
  "publishConfig": {
55
55
  "access": "public",