diff --git a/CLAUDE.md b/CLAUDE.md index 724c9cd9a..65a783829 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -120,7 +120,7 @@ const projectChats = db.select().from(chats).where(eq(chats.projectId, id)).all( - **React Query**: Server state via tRPC (auto-caching, refetch) ### Claude Integration -- Dynamic import of `@anthropic-ai/claude-code` SDK +- Dynamic import of `@anthropic-ai/claude-agent-sdk` SDK - Two modes: "plan" (read-only) and "agent" (full permissions) - Session resume via `sessionId` stored in SubChat - Message streaming via tRPC subscription (`claude.onMessage`) diff --git a/build.sh b/build.sh new file mode 100755 index 000000000..f1c2569bd --- /dev/null +++ b/build.sh @@ -0,0 +1,7 @@ +bun install +bun run claude:download # Download Claude binary (required!) +bun run codex:download # Download Codex binary (required!) +bun run build +bun run package:mac +bun run package:win +bun run package:linux \ No newline at end of file diff --git a/openspec/project.md b/openspec/project.md index 9fa38c628..6d1711332 100644 --- a/openspec/project.md +++ b/openspec/project.md @@ -11,7 +11,7 @@ | Components | Radix UI, Lucide icons, Motion, Sonner | | State | Jotai, Zustand, React Query | | Backend | tRPC, Drizzle ORM, better-sqlite3 | -| AI | @anthropic-ai/claude-code | +| AI | @anthropic-ai/claude-agent-sdk | | Package Manager | bun | ## Project Conventions @@ -30,7 +30,7 @@ - Zustand: Sub-chat tabs and pinned state (persisted to localStorage) - React Query: Server state via tRPC (auto-caching, refetch) - **Database**: Drizzle ORM with SQLite, auto-migration on app startup -- **Claude Integration**: Dynamic import of `@anthropic-ai/claude-code` SDK with two modes: "plan" (read-only) and "agent" (full permissions) +- **Claude Integration**: Dynamic import of `@anthropic-ai/claude-agent-sdk` SDK with two modes: "plan" (read-only) and "agent" (full permissions) ### Testing Strategy [Testing approach not yet established - to be defined] @@ -53,6 +53,6 @@ - Dev vs Production use separate userData paths and protocols ## External Dependencies -- **Claude Code SDK**: `@anthropic-ai/claude-code` for AI interactions +- **Claude Code SDK**: `@anthropic-ai/claude-agent-sdk` for AI interactions - **21st.dev CDN**: Auto-update manifests and releases at `cdn.21st.dev` - **OAuth Provider**: Authentication flow diff --git a/src/main/lib/trpc/routers/claude.ts b/src/main/lib/trpc/routers/claude.ts index a987b06eb..b8c7b00f5 100644 --- a/src/main/lib/trpc/routers/claude.ts +++ b/src/main/lib/trpc/routers/claude.ts @@ -1772,7 +1772,7 @@ ${prompt} includePartialMessages: true, // Load skills from project and user directories (skip for Ollama - not supported) ...(!isUsingOllama && { - settingSources: ["project" as const, "user" as const], + settingSources: ["project" as const, "local" as const, "user" as const], }), canUseTool: async ( toolName: string, @@ -1979,23 +1979,20 @@ ${prompt} pathToClaudeCodeExecutable: claudeBinaryPath, // Session handling: For Ollama, use resume with session ID to maintain history // For Claude API, use resume with rollback/fork support - ...(resumeSessionId && { - resume: resumeSessionId, - // Fork support - resume at specific point and create new session - ...(shouldForkResume && forkResumeAtUuid && !isUsingOllama - ? { - resumeSessionAt: forkResumeAtUuid, - forkSession: true, - } - : // Rollback support - resume at specific message UUID (from DB) - resumeAtUuid && !isUsingOllama - ? { resumeSessionAt: resumeAtUuid } - : { continue: true }), - }), - // For first message in chat (no session ID yet), use continue mode - ...(!resumeSessionId && { continue: true }), + // resume is mutually exclusive with continue (SDK contract) + ...(resumeSessionId + ? { + resume: resumeSessionId, + // Fork support - resume at specific point and create new session + ...(shouldForkResume && forkResumeAtUuid && !isUsingOllama + ? { resumeSessionAt: forkResumeAtUuid, forkSession: true } + : // Rollback support - resume at specific message UUID (from DB) + resumeAtUuid && !isUsingOllama + ? { resumeSessionAt: resumeAtUuid } + : {}), + } + : { continue: true }), ...(resolvedModel && { model: resolvedModel }), - // fallbackModel: "claude-opus-4-5-20251101", ...(input.effort && { effort: input.effort }), }, } diff --git a/src/renderer/components/dialogs/settings-tabs/agents-models-tab.tsx b/src/renderer/components/dialogs/settings-tabs/agents-models-tab.tsx index eb692afd7..5f7a7f46b 100644 --- a/src/renderer/components/dialogs/settings-tabs/agents-models-tab.tsx +++ b/src/renderer/components/dialogs/settings-tabs/agents-models-tab.tsx @@ -760,7 +760,7 @@ export function AgentsModelsTab() { onChange={(e) => setModel(e.target.value)} onBlur={handleBlurSave} className="w-full" - placeholder="claude-3-7-sonnet-20250219" + placeholder="claude-sonnet-4-6" /> diff --git a/src/renderer/features/agents/lib/ipc-chat-transport.ts b/src/renderer/features/agents/lib/ipc-chat-transport.ts index 3988f972c..216147f2b 100644 --- a/src/renderer/features/agents/lib/ipc-chat-transport.ts +++ b/src/renderer/features/agents/lib/ipc-chat-transport.ts @@ -94,16 +94,9 @@ const ERROR_TOAST_CONFIG: Record< "Your previous chat session expired. Send your message again to start fresh.", }, EXECUTABLE_NOT_FOUND: { - title: "Claude CLI not found", + title: "Claude binary missing", description: - "Install Claude Code CLI: npm install -g @anthropic-ai/claude-code", - action: { - label: "Copy command", - onClick: () => - navigator.clipboard.writeText( - "npm install -g @anthropic-ai/claude-code", - ), - }, + "The bundled Claude binary could not be found. Reinstalling 1Code should restore it.", }, NETWORK_ERROR: { title: "Network error",