Add afterPack hook that copies the @electron/rebuild-compiled
better_sqlite3.node into the standalone resources directory.
Previously the standalone copy retained the system Node ABI from
next build, causing MODULE_VERSION mismatch at runtime.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Previously the database path depended on app.getPath('userData') which
varies with app name changes (CodePilot vs codepilot vs Claude GUI).
Now uses a fixed ~/.codepilot/ directory for both dev and production.
Includes automatic migration: on first launch, if the DB doesn't exist
at the new path, it checks old locations (Application Support variants
and the old dev-mode data/ folder) and copies the database over.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Shows a copy icon at the bottom of each message on hover. Clicking
copies the text content to clipboard with a brief checkmark confirmation.
User messages show the button right-aligned; assistant messages show it
alongside the existing timestamp and token usage.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1. Skills API: accept optional cwd query param so project-level skills
are scanned from the session's working directory, not the standalone
server's process.cwd().
2. SDK env: explicitly set HOME so Claude Code can resolve ~/.claude/
for global skills discovery in packaged builds.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1. Change StickToBottom resize mode from "smooth" to "instant" to
prevent scroll position bouncing when new streaming content
arrives faster than the smooth animation completes.
2. Use SDK's preset append mode for system prompts instead of
replacing Claude Code's default prompt. This preserves Claude
Code's built-in awareness of skills (.claude/commands/), working
directory context, and other default behaviors.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a new "API Configuration" section in settings for users who use
custom Anthropic-compatible APIs (e.g. via ai-claude-start). Users
can optionally set ANTHROPIC_AUTH_TOKEN and ANTHROPIC_BASE_URL in
CodePilot's settings UI. These are stored in SQLite and injected
into the Claude Code subprocess env only when configured.
Existing authentication methods (claude login, shell env vars) are
not affected - the API config is purely additive.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1. Explicitly pass process.env to the Claude Agent SDK's env option,
ensuring user shell env vars (ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL,
etc.) reach the claude subprocess in packaged builds.
2. Spawn the standalone server via /bin/sh with exec to prevent the
Electron binary from appearing as a separate Dock icon on macOS.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When launched from Dock/Finder, Electron's process.env is very limited
and misses vars from .zshrc/.bashrc (API keys, custom PATH, etc.).
Added loadUserShellEnv() to run a login shell and capture the full
environment, then pass it to the standalone server process. This fixes
"organization does not have access" errors for users with custom API
configurations.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
electron-builder's @electron/rebuild compiles better-sqlite3 for
Electron's Node ABI. The standalone server must use Electron's
built-in Node (ELECTRON_RUN_AS_NODE=1) to match, otherwise the
native module fails with NODE_MODULE_VERSION mismatch.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Return full error stack traces from the sessions API and display
the actual server error in the frontend, instead of a generic
"Failed to create session" message.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The SDK's query() function also needs to find the claude binary.
Added findClaudePath() in claude-client.ts and pass it via
pathToClaudeCodeExecutable option, fixing "Failed to create session"
in packaged builds where PATH is limited.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The claude-status endpoint now searches common installation paths
(/usr/local/bin, /opt/homebrew/bin, ~/.npm-global/bin, ~/.local/bin,
~/.claude/bin) and uses `which` with expanded PATH as fallback,
fixing "Disconnected" status in packaged builds.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Find system Node.js binary instead of using Electron's Node
(avoids native module ABI mismatch with better-sqlite3)
- Detect server process crash and fail fast instead of waiting 30s
- Include server stdout/stderr in error dialog for debugging
- Expand PATH to include homebrew directories
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace fork() with spawn() + ELECTRON_RUN_AS_NODE=1 so the
standalone server runs correctly inside the packaged app
- Set cwd to standalone directory for proper dependency resolution
- Show error dialog on startup failure instead of silent quit
- Add Chinese README (README_CN.md)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add README_CN.md with full Chinese translation
- Link between EN/CN README at the top
- Replace placeholder URLs with actual repo URLs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace symlinks in .next/standalone with real copies for electron-builder
- Exclude electron/, dist-electron/, scripts/, release/ from tsconfig
- Use arm64 target instead of universal to avoid native module merge issues
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Full-featured desktop application built with Next.js + Electron:
- Streaming chat with Claude Code via Agent SDK
- Session management with SQLite persistence
- Project file tree and file preview
- MCP server and custom skills management
- Permission controls with Code/Plan/Ask modes
- Dark/light theme, token tracking
- macOS DMG packaging with electron-builder
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>