diff --git a/CHANGELOG.md b/CHANGELOG.md index 5714e903..08ccfd16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 0.12.0 + +- Update to @anthropic-ai/claude-agent-sdk@v0.1.59 + - Brings Opus to Claude Pro plans + - Support "Don't Ask" profile +- Unify ACP + Claude Code session ids + ## 0.11.0 - Update to @anthropic-ai/claude-agent-sdk@v0.1.57 diff --git a/package-lock.json b/package-lock.json index 13898d85..df0d3193 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,19 +1,18 @@ { "name": "@zed-industries/claude-code-acp", - "version": "0.11.0", + "version": "0.12.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@zed-industries/claude-code-acp", - "version": "0.11.0", + "version": "0.12.0", "license": "Apache-2.0", "dependencies": { "@agentclientprotocol/sdk": "0.7.0", "@anthropic-ai/claude-agent-sdk": "0.1.59", "@modelcontextprotocol/sdk": "1.24.3", - "diff": "8.0.2", - "uuid": "13.0.0" + "diff": "8.0.2" }, "bin": { "claude-code-acp": "dist/index.js" @@ -21,7 +20,6 @@ "devDependencies": { "@anthropic-ai/sdk": "0.71.1", "@types/node": "24.10.1", - "@types/uuid": "10.0.0", "@typescript-eslint/eslint-plugin": "8.48.1", "@typescript-eslint/parser": "8.48.1", "eslint": "9.39.1", @@ -1564,13 +1562,6 @@ "undici-types": "~7.16.0" } }, - "node_modules/@types/uuid": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz", - "integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==", - "dev": true, - "license": "MIT" - }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "8.48.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.48.1.tgz", @@ -4230,19 +4221,6 @@ "punycode": "^2.1.0" } }, - "node_modules/uuid": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-13.0.0.tgz", - "integrity": "sha512-XQegIaBTVUjSHliKqcnFqYypAd4S+WCYt5NIeRs6w/UAry7z8Y9j5ZwRRL4kzq9U3sD6v+85er9FvkEaBpji2w==", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "license": "MIT", - "bin": { - "uuid": "dist-node/bin/uuid" - } - }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", diff --git a/package.json b/package.json index f2be271f..0f0d8a29 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "publishConfig": { "access": "public" }, - "version": "0.11.0", + "version": "0.12.0", "description": "An ACP-compatible coding agent powered by the Claude Code SDK (TypeScript)", "main": "dist/lib.js", "bin": { @@ -54,13 +54,11 @@ "@agentclientprotocol/sdk": "0.7.0", "@anthropic-ai/claude-agent-sdk": "0.1.59", "@modelcontextprotocol/sdk": "1.24.3", - "diff": "8.0.2", - "uuid": "13.0.0" + "diff": "8.0.2" }, "devDependencies": { "@anthropic-ai/sdk": "0.71.1", "@types/node": "24.10.1", - "@types/uuid": "10.0.0", "@typescript-eslint/eslint-plugin": "8.48.1", "@typescript-eslint/parser": "8.48.1", "eslint": "9.39.1", diff --git a/src/acp-agent.ts b/src/acp-agent.ts index 9ae09504..ef326936 100644 --- a/src/acp-agent.ts +++ b/src/acp-agent.ts @@ -39,7 +39,6 @@ import { import * as fs from "node:fs"; import * as path from "node:path"; import * as os from "node:os"; -import { v7 as uuidv7 } from "uuid"; import { nodeToWebReadable, nodeToWebWritable, Pushable, unreachable } from "./utils.js"; import { createMcpServer, EDIT_TOOL_NAMES, toolNames } from "./mcp-server.js"; import { @@ -53,6 +52,7 @@ import { import { ContentBlockParam } from "@anthropic-ai/sdk/resources"; import { BetaContentBlock, BetaRawContentBlockDelta } from "@anthropic-ai/sdk/resources/beta.mjs"; import packageJson from "../package.json" with { type: "json" }; +import { randomUUID } from "node:crypto"; /** * Logger interface for customizing logging output @@ -197,7 +197,7 @@ export class ClaudeAcpAgent implements Agent { throw RequestError.authRequired(); } - const sessionId = uuidv7(); + const sessionId = randomUUID(); const input = new Pushable(); const mcpServers: Record = {}; @@ -262,6 +262,8 @@ export class ClaudeAcpAgent implements Agent { cwd: params.cwd, includePartialMessages: true, mcpServers: { ...(userProvidedOptions?.mcpServers || {}), ...mcpServers }, + // Set our own session id + extraArgs: { ...userProvidedOptions?.extraArgs, "session-id": sessionId }, // If we want bypassPermissions to be an option, we have to allow it here. // But it doesn't work in root mode, so we only activate it if it will work. allowDangerouslySkipPermissions: !IS_ROOT, diff --git a/src/tests/acp-agent.test.ts b/src/tests/acp-agent.test.ts index 69f56271..0cb2ee42 100644 --- a/src/tests/acp-agent.test.ts +++ b/src/tests/acp-agent.test.ts @@ -20,6 +20,7 @@ import { nodeToWebWritable, nodeToWebReadable } from "../utils.js"; import { markdownEscape, toolInfoFromToolUse, toolUpdateFromToolResult } from "../tools.js"; import { toAcpNotifications, promptToClaude } from "../acp-agent.js"; import { query, SDKAssistantMessage } from "@anthropic-ai/claude-agent-sdk"; +import { randomUUID } from "crypto"; describe.skipIf(!process.env.RUN_INTEGRATION_TESTS)("ACP subprocess integration", () => { let child: ReturnType; @@ -830,17 +831,29 @@ describe("prompt conversion", () => { }); }); -describe("SDK behavior", () => { - it.skipIf(!process.env.RUN_INTEGRATION_TESTS)( - "query has a 'default' model", - async () => { - const q = query({ prompt: "hi" }); - const models = await q.supportedModels(); - const defaultModel = models.find((m) => m.value === "default"); - expect(defaultModel).toBeDefined(); - }, - 10000, - ); +describe.skipIf(!process.env.RUN_INTEGRATION_TESTS)("SDK behavior", () => { + it("query has a 'default' model", async () => { + const q = query({ prompt: "hi" }); + const models = await q.supportedModels(); + const defaultModel = models.find((m) => m.value === "default"); + expect(defaultModel).toBeDefined(); + }, 10000); + + it("custom session id", async () => { + const sessionId = randomUUID(); + const q = query({ + prompt: "hi", + options: { + systemPrompt: { type: "preset", preset: "claude_code" }, + extraArgs: { "session-id": sessionId }, + settingSources: ["user", "project", "local"], + includePartialMessages: true, + }, + }); + + const { value } = await q.next(); + expect(value).toMatchObject({ type: "system", subtype: "init", session_id: sessionId }); + }, 10000); }); describe("permission requests", () => {