Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ function getExpandedShellPath(): string {
return [...new Set(allParts)].join(sep);
} else {
const basePath = `/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin`;
const raw = `${basePath}:${home}/.npm-global/bin:${home}/.local/bin:${home}/.claude/bin:${shellPath}`;
const raw = `${basePath}:${home}/.npm-global/bin:${home}/.bun/bin:${home}/.local/bin:${home}/.claude/bin:${shellPath}`;
const allParts = raw.split(':').filter(Boolean);
return [...new Set(allParts)].join(':');
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/claude-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ export function streamClaude(options: ClaudeStreamOptions): ReadableStream<strin
const detailHint = extraDetail ? `\n\nDetails: ${extraDetail}` : '';
const hasImages = files && files.some(f => isImageFile(f.type));
const imageHint = hasImages ? '\n• Provider may not support image/vision input' : '';
errorMessage = `Claude Code process exited with an error${providerHint}. This is often caused by:\n• Invalid or missing API Key\n• Incorrect Base URL configuration\n• Network connectivity issues${imageHint}${detailHint}\n\nOriginal error: ${rawMessage}`;
errorMessage = `Claude Code process exited with an error${providerHint}. This is often caused by:\n• Invalid or missing API Key\n• Incorrect Base URL configuration\n• Network connectivity issues\n• API provider not activated (check Settings → API Providers and ensure your provider is set as active)${imageHint}${detailHint}\n\nOriginal error: ${rawMessage}`;
} else if (rawMessage.includes('exited with code')) {
const providerHint = resolved.provider?.name ? ` (Provider: ${resolved.provider?.name})` : '';
errorMessage = `Claude Code process crashed unexpectedly${providerHint}.\n\nOriginal error: ${rawMessage}`;
Expand Down
5 changes: 4 additions & 1 deletion src/lib/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,9 @@ export function createProvider(data: CreateProviderRequest): ApiProvider {
const maxRow = db.prepare('SELECT MAX(sort_order) as max_order FROM api_providers').get() as { max_order: number | null };
const sortOrder = (maxRow.max_order ?? -1) + 1;

// Activate the new provider only if there is no existing active provider (e.g. first-time onboarding)
const hasActive = db.prepare('SELECT 1 FROM api_providers WHERE is_active = 1 LIMIT 1').get();

db.prepare(
`INSERT INTO api_providers (id, name, provider_type, protocol, base_url, api_key, is_active, sort_order, extra_env, headers_json, env_overrides_json, role_models_json, notes, created_at, updated_at)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
Expand All @@ -1064,7 +1067,7 @@ export function createProvider(data: CreateProviderRequest): ApiProvider {
data.protocol || '',
data.base_url || '',
data.api_key || '',
0,
hasActive ? 0 : 1,
sortOrder,
data.extra_env || '{}',
data.headers_json || '{}',
Expand Down
2 changes: 2 additions & 0 deletions src/lib/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export function getExtraPathDirs(): string[] {
'/usr/bin',
'/bin',
path.join(home, '.npm-global', 'bin'),
path.join(home, '.bun', 'bin'),
path.join(home, '.nvm', 'current', 'bin'),
path.join(home, '.local', 'bin'),
path.join(home, '.claude', 'bin'),
Expand Down Expand Up @@ -74,6 +75,7 @@ export function getClaudeCandidatePaths(): string[] {
'/usr/local/bin/claude',
'/opt/homebrew/bin/claude',
path.join(home, '.npm-global', 'bin', 'claude'),
path.join(home, '.bun', 'bin', 'claude'),
path.join(home, '.local', 'bin', 'claude'),
path.join(home, '.claude', 'bin', 'claude'),
];
Expand Down