@agentclientprotocol/claude-agent-acp 0.100.1-preview.1 → 0.100.1-preview.3

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.
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Called by the executable's entry (`src/binary-entry.ts`) before the agent
3
+ * starts. A `bun build --compile` executable has no `node_modules` to resolve
4
+ * the SDK's platform package from, so the release archive ships the Claude CLI
5
+ * next to it. The CLI isn't embedded: a child process can't run a file inside
6
+ * Bun's `$bunfs`, so an embedded copy would have to be extracted to disk first.
7
+ */
8
+ export declare function useBundledClaudeCli(directory: string): void;
9
+ /**
10
+ * The Claude CLI binary to spawn: `CLAUDE_CODE_EXECUTABLE` if set, then the CLI
11
+ * shipped next to the executable, then the SDK's platform-specific package.
12
+ */
13
+ export declare function claudeCliPath(): Promise<string>;
14
+ //# sourceMappingURL=claude-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-cli.d.ts","sourceRoot":"","sources":["../src/claude-cli.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAE3D;AAED;;;GAGG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAQrD"}
@@ -0,0 +1,76 @@
1
+ import { existsSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ const CLI_FILE_NAME = process.platform === "win32" ? "claude.exe" : "claude";
4
+ let bundledCliDirectory;
5
+ /**
6
+ * Called by the executable's entry (`src/binary-entry.ts`) before the agent
7
+ * starts. A `bun build --compile` executable has no `node_modules` to resolve
8
+ * the SDK's platform package from, so the release archive ships the Claude CLI
9
+ * next to it. The CLI isn't embedded: a child process can't run a file inside
10
+ * Bun's `$bunfs`, so an embedded copy would have to be extracted to disk first.
11
+ */
12
+ export function useBundledClaudeCli(directory) {
13
+ bundledCliDirectory = directory;
14
+ }
15
+ /**
16
+ * The Claude CLI binary to spawn: `CLAUDE_CODE_EXECUTABLE` if set, then the CLI
17
+ * shipped next to the executable, then the SDK's platform-specific package.
18
+ */
19
+ export async function claudeCliPath() {
20
+ if (process.env.CLAUDE_CODE_EXECUTABLE) {
21
+ return process.env.CLAUDE_CODE_EXECUTABLE;
22
+ }
23
+ if (bundledCliDirectory !== undefined) {
24
+ return bundledClaudeCliPath(bundledCliDirectory);
25
+ }
26
+ return installedClaudeCliPath();
27
+ }
28
+ function bundledClaudeCliPath(directory) {
29
+ const path = join(directory, CLI_FILE_NAME);
30
+ // Without this check, spawning a missing CLI fails with a bare ENOENT.
31
+ if (!existsSync(path)) {
32
+ throw new Error(`The Claude CLI is missing: expected ${path}. Keep ${CLI_FILE_NAME} from the release archive ` +
33
+ "in the same directory as claude-agent-acp, or set CLAUDE_CODE_EXECUTABLE to a Claude CLI binary.");
34
+ }
35
+ return path;
36
+ }
37
+ async function installedClaudeCliPath() {
38
+ // The SDK's CLI is a native binary shipped as a platform-specific optional
39
+ // dependency of @anthropic-ai/claude-agent-sdk. Resolve via a require bound
40
+ // to the SDK so nested installs are found even when npm doesn't hoist.
41
+ const { createRequire } = await import("node:module");
42
+ const req = createRequire(import.meta.resolve("@anthropic-ai/claude-agent-sdk"));
43
+ const ext = process.platform === "win32" ? ".exe" : "";
44
+ // On linux, both glibc and musl variants may be installed side-by-side
45
+ // (e.g. bunx hydrates every optional dep), so picking one by trial is
46
+ // unreliable: the wrong binary segfaults at runtime instead of failing to
47
+ // spawn. Detect the runtime libc and prefer the matching variant, falling
48
+ // back to the other only if the preferred one isn't installed.
49
+ const candidates = process.platform === "linux"
50
+ ? isMuslLibc()
51
+ ? [
52
+ `@anthropic-ai/claude-agent-sdk-linux-${process.arch}-musl/claude${ext}`,
53
+ `@anthropic-ai/claude-agent-sdk-linux-${process.arch}/claude${ext}`,
54
+ ]
55
+ : [
56
+ `@anthropic-ai/claude-agent-sdk-linux-${process.arch}/claude${ext}`,
57
+ `@anthropic-ai/claude-agent-sdk-linux-${process.arch}-musl/claude${ext}`,
58
+ ]
59
+ : [`@anthropic-ai/claude-agent-sdk-${process.platform}-${process.arch}/claude${ext}`];
60
+ for (const candidate of candidates) {
61
+ try {
62
+ return req.resolve(candidate);
63
+ }
64
+ catch {
65
+ // try next candidate
66
+ }
67
+ }
68
+ throw new Error(`Claude native binary not found for ${process.platform}-${process.arch}. ` +
69
+ `Reinstall @anthropic-ai/claude-agent-sdk without --omit=optional, or set CLAUDE_CODE_EXECUTABLE.`);
70
+ }
71
+ function isMuslLibc() {
72
+ // process.report.getReport().header.glibcVersionRuntime is populated when
73
+ // Node is dynamically linked against glibc, and absent on musl.
74
+ const report = process.report?.getReport();
75
+ return !report?.header?.glibcVersionRuntime;
76
+ }
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { claudeCliPath } from "./acp-agent.js";
2
+ import { claudeCliPath } from "./claude-cli.js";
3
3
  import { applyManagedPolicyEnv } from "./managed-policy.js";
4
4
  import { acpProtocolsFromEnv, serveAcp } from "./serve.js";
5
5
  import packageJson from "../package.json" with { type: "json" };
@@ -45,8 +45,9 @@ type InitializeSessionModeParams = {
45
45
  * The permission mode a new Claude query starts in.
46
46
  *
47
47
  * An explicit mode wins. A resume or a load continues in the mode of the last
48
- * user record of the transcript. If that mode is unknown or not available now,
49
- * for example bypass, the session starts in `defaultMode` of the settings.
48
+ * user record of the transcript. If that mode is unknown or absent from the
49
+ * session's mode catalog, use an available `defaultMode` from settings, or
50
+ * `default` when that setting is unavailable too.
50
51
  */
51
52
  export declare function resolveInitialPermissionMode(sources: {
52
53
  explicit?: PermissionMode;
@@ -83,7 +84,6 @@ export declare class SessionModeManager<S extends SessionMode> {
83
84
  private isAutoUnavailable;
84
85
  private isAvailable;
85
86
  private parseMode;
86
- private buildAvailableModes;
87
87
  private trySyncMode;
88
88
  }
89
89
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"session-mode.d.ts","sourceRoot":"","sources":["../src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C,eAAe,EAAE,OAAO,CAAA;KAAE;IAwBnE;sDACkD;IAC5C,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,GAAG,SAAS;IAqBpE,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IA4BtE,cAAc,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAS9E,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO9D,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAuB9E,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlF,OAAO,CAAC,kBAAkB;IAS1B,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,SAAS;YAcH,WAAW;CAW1B"}
@@ -16,8 +16,9 @@ const AUTO_MODE_FALLBACK_NOTICE = {
16
16
  * The permission mode a new Claude query starts in.
17
17
  *
18
18
  * An explicit mode wins. A resume or a load continues in the mode of the last
19
- * user record of the transcript. If that mode is unknown or not available now,
20
- * for example bypass, the session starts in `defaultMode` of the settings.
19
+ * user record of the transcript. If that mode is unknown or absent from the
20
+ * session's mode catalog, use an available `defaultMode` from settings, or
21
+ * `default` when that setting is unavailable too.
21
22
  */
22
23
  export function resolveInitialPermissionMode(sources, logger, allowBypass) {
23
24
  if (sources.explicit !== undefined) {
@@ -26,12 +27,19 @@ export function resolveInitialPermissionMode(sources, logger, allowBypass) {
26
27
  if (sources.resumed !== undefined) {
27
28
  let rejected = false;
28
29
  const mode = resolvePermissionMode(sources.resumed, { error: () => (rejected = true) }, allowBypass);
29
- if (!rejected)
30
+ if (!rejected && buildAvailableModes(allowBypass).some((available) => available.id === mode)) {
30
31
  return mode;
32
+ }
31
33
  logger.error(`Ignoring permission mode "${sources.resumed}" of the resumed transcript: ` +
32
34
  `not available in this session.`);
33
35
  }
34
- return resolvePermissionMode(sources.defaultMode, logger, allowBypass);
36
+ const configuredMode = resolvePermissionMode(sources.defaultMode, logger, allowBypass);
37
+ // A rejected transcript mode falls back only to a mode this session can offer.
38
+ if (sources.resumed !== undefined &&
39
+ !buildAvailableModes(allowBypass).some((available) => available.id === configuredMode)) {
40
+ return "default";
41
+ }
42
+ return configuredMode;
35
43
  }
36
44
  /** Owns session-mode policy and the ACP/SDK synchronization it requires. */
37
45
  export class SessionModeManager {
@@ -40,7 +48,7 @@ export class SessionModeManager {
40
48
  this.options = options;
41
49
  }
42
50
  async initialize({ query, requestedMode, currentModelInfo, currentModelId, allowBypass, }) {
43
- const availableModes = this.buildAvailableModes(allowBypass);
51
+ const availableModes = buildAvailableModes(allowBypass, this.options.airClient?.() ?? false);
44
52
  let effectiveMode = requestedMode;
45
53
  let autoModeFallbackWarningPending = false;
46
54
  if (effectiveMode === "auto" &&
@@ -223,49 +231,6 @@ export class SessionModeManager {
223
231
  throw RequestError.invalidParams(undefined, `Invalid Mode: ${modeId}`);
224
232
  }
225
233
  }
226
- buildAvailableModes(allowBypass) {
227
- // Only AIR gets the mode kind.
228
- const air = this.options.airClient?.() ?? false;
229
- const kind = (value) => {
230
- const meta = airOnlyMeta(air, AIR_KIND_KEY, value);
231
- return meta ? { _meta: meta } : {};
232
- };
233
- const modes = [
234
- {
235
- id: "default",
236
- name: "Manual",
237
- description: "Always ask before making changes",
238
- ...kind("standard"),
239
- },
240
- {
241
- id: "acceptEdits",
242
- name: "Accept edits",
243
- description: "Automatically accept all file edits",
244
- ...kind("standard"),
245
- },
246
- {
247
- id: "plan",
248
- name: "Plan",
249
- description: "Create a plan before making changes",
250
- ...kind("plan"),
251
- },
252
- {
253
- id: "auto",
254
- name: "Auto",
255
- description: "Claude handles permission decisions",
256
- ...kind("auto_review"),
257
- },
258
- ];
259
- if (allowBypass) {
260
- modes.push({
261
- id: "bypassPermissions",
262
- name: "Bypass permissions",
263
- description: "Accepts all permissions",
264
- ...kind("full_access"),
265
- });
266
- }
267
- return modes;
268
- }
269
234
  async trySyncMode(query, mode, errorMessage) {
270
235
  try {
271
236
  await query.setPermissionMode(mode);
@@ -275,3 +240,45 @@ export class SessionModeManager {
275
240
  }
276
241
  }
277
242
  }
243
+ function buildAvailableModes(allowBypass, air = false) {
244
+ // Only AIR gets the mode kind.
245
+ const kind = (value) => {
246
+ const meta = airOnlyMeta(air, AIR_KIND_KEY, value);
247
+ return meta ? { _meta: meta } : {};
248
+ };
249
+ const modes = [
250
+ {
251
+ id: "default",
252
+ name: "Manual",
253
+ description: "Always ask before making changes",
254
+ ...kind("standard"),
255
+ },
256
+ {
257
+ id: "acceptEdits",
258
+ name: "Accept edits",
259
+ description: "Automatically accept all file edits",
260
+ ...kind("standard"),
261
+ },
262
+ {
263
+ id: "plan",
264
+ name: "Plan",
265
+ description: "Create a plan before making changes",
266
+ ...kind("plan"),
267
+ },
268
+ {
269
+ id: "auto",
270
+ name: "Auto",
271
+ description: "Claude handles permission decisions",
272
+ ...kind("auto_review"),
273
+ },
274
+ ];
275
+ if (allowBypass) {
276
+ modes.push({
277
+ id: "bypassPermissions",
278
+ name: "Bypass permissions",
279
+ description: "Accepts all permissions",
280
+ ...kind("full_access"),
281
+ });
282
+ }
283
+ return modes;
284
+ }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.100.1-preview.1",
6
+ "version": "0.100.1-preview.3",
7
7
  "description": "An ACP-compatible coding agent powered by the Claude Agent SDK (TypeScript)",
8
8
  "main": "dist/lib.js",
9
9
  "types": "dist/lib.d.ts",
@@ -21,12 +21,15 @@
21
21
  "files": [
22
22
  "dist/",
23
23
  "!dist/tests/",
24
+ "!dist/binary-entry.*",
24
25
  "README.md",
25
26
  "LICENSE",
26
27
  "package.json"
27
28
  ],
28
29
  "scripts": {
29
30
  "build": "tsc",
31
+ "build:binary": "node scripts/build-binary.mjs",
32
+ "smoke:binary": "node scripts/smoke-binary.mjs",
30
33
  "start": "node dist/index.js",
31
34
  "dev": "npm run build && npm run start",
32
35
  "example:simple-client": "node --experimental-strip-types --disable-warning=ExperimentalWarning examples/simple-client.ts",