Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98dda8a51b | ||
|
|
42baa5cb78 | ||
|
|
11fd7fcd71 | ||
|
|
d6950948fa | ||
|
|
9693793bba | ||
|
|
a72f012851 | ||
|
|
1368709f4e |
@@ -989,7 +989,7 @@ const TerminalComponent: React.FC<TerminalProps> = ({
|
||||
if (terminalSettings) {
|
||||
termRef.current.options.cursorStyle = terminalSettings.cursorShape;
|
||||
termRef.current.options.cursorBlink = terminalSettings.cursorBlink;
|
||||
termRef.current.options.scrollback = terminalSettings.scrollback;
|
||||
termRef.current.options.scrollback = terminalSettings.scrollback === 0 ? 999999 : terminalSettings.scrollback;
|
||||
termRef.current.options.fontWeight = effectiveFontWeight as
|
||||
| 100
|
||||
| 200
|
||||
|
||||
@@ -30,6 +30,7 @@ import { createCattyTools } from '../../../infrastructure/ai/sdk/tools';
|
||||
import type { NetcattyBridge, ExecutorContext } from '../../../infrastructure/ai/cattyAgent/executor';
|
||||
import { runExternalAgentTurn } from '../../../infrastructure/ai/externalAgentAdapter';
|
||||
import { runAcpAgentTurn } from '../../../infrastructure/ai/acpAgentAdapter';
|
||||
import { matchesManagedAgentConfig } from '../../../infrastructure/ai/managedAgents';
|
||||
import { classifyError } from '../../../infrastructure/ai/errorClassifier';
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
@@ -553,8 +554,21 @@ export function useAIChatStreaming({
|
||||
|
||||
// Pass only the provider ID — the main process resolves and decrypts the API key itself,
|
||||
// avoiding plaintext key transit across the IPC boundary.
|
||||
const openaiProvider = context.providers.find(p => p.providerId === 'openai' && p.enabled && p.apiKey);
|
||||
const agentProviderId = openaiProvider?.id;
|
||||
// Resolve the correct provider based on agent type:
|
||||
// - Claude agent → anthropic provider (prefer over generic custom)
|
||||
// - Codex agent → openai provider
|
||||
const agentProviderId = (() => {
|
||||
if (matchesManagedAgentConfig(agentConfig, 'claude')) {
|
||||
return (
|
||||
context.providers.find(p => p.providerId === 'anthropic' && p.enabled && p.apiKey)?.id
|
||||
?? context.providers.find(p => p.providerId === 'custom' && p.enabled && p.apiKey && p.baseURL)?.id
|
||||
);
|
||||
}
|
||||
if (matchesManagedAgentConfig(agentConfig, 'codex')) {
|
||||
return context.providers.find(p => p.providerId === 'openai' && p.enabled && p.apiKey)?.id;
|
||||
}
|
||||
return undefined;
|
||||
})();
|
||||
|
||||
// Mutable flag: set after tool-result, cleared when new assistant msg is created
|
||||
let needsNewAssistantMsg = false;
|
||||
|
||||
@@ -182,7 +182,11 @@ export const createXTermRuntime = (ctx: CreateXTermRuntimeContext): XTermRuntime
|
||||
|
||||
const cursorStyle = settings?.cursorShape ?? "block";
|
||||
const cursorBlink = settings?.cursorBlink ?? true;
|
||||
const scrollback = settings?.scrollback ?? 10000;
|
||||
// xterm.js treats scrollback=0 as "no scrollback buffer", which breaks mouse
|
||||
// wheel scrolling (events become arrow-key sequences). The UI uses 0 to mean
|
||||
// "no limit", so map it to a large value instead.
|
||||
const rawScrollback = settings?.scrollback ?? 10000;
|
||||
const scrollback = rawScrollback === 0 ? 999999 : rawScrollback;
|
||||
const drawBoldTextInBrightColors = settings?.drawBoldInBrightColors ?? true;
|
||||
const fontWeight = resolveHostTerminalFontWeight(ctx.host, settings?.fontWeight ?? 400);
|
||||
const fontWeightBold = settings?.fontWeightBold ?? 700;
|
||||
|
||||
@@ -2103,9 +2103,18 @@ function registerHandlers(ipcMain) {
|
||||
const apiKey = resolvedProvider?.apiKey || undefined;
|
||||
|
||||
const agentEnv = withCliDiscoveryEnv({ ...shellEnv });
|
||||
if (apiKey) {
|
||||
if (isCodexAgent && apiKey) {
|
||||
agentEnv.CODEX_API_KEY = apiKey;
|
||||
}
|
||||
if (isCodexAgent && resolvedProvider?.provider?.baseURL) {
|
||||
agentEnv.OPENAI_BASE_URL = resolvedProvider.provider.baseURL;
|
||||
}
|
||||
if (isClaudeAgent && apiKey) {
|
||||
agentEnv.ANTHROPIC_API_KEY = apiKey;
|
||||
}
|
||||
if (isClaudeAgent && resolvedProvider?.provider?.baseURL) {
|
||||
agentEnv.ANTHROPIC_BASE_URL = resolvedProvider.provider.baseURL;
|
||||
}
|
||||
|
||||
if (isCopilotAgent) {
|
||||
copilotConfigInfo = prepareCopilotHome(shellEnv, [], chatSessionId || `models_${Date.now()}`);
|
||||
@@ -2266,7 +2275,11 @@ function registerHandlers(ipcMain) {
|
||||
}
|
||||
}
|
||||
|
||||
const authFingerprint = isCodexAgent ? getCodexAuthFingerprint(apiKey) : null;
|
||||
const authFingerprint = isCodexAgent
|
||||
? getCodexAuthFingerprint(apiKey)
|
||||
: isClaudeAgent
|
||||
? getCodexAuthFingerprint(apiKey + (resolvedProvider?.provider?.baseURL || ""))
|
||||
: null;
|
||||
const mcpSnapshot = isCodexAgent
|
||||
? await resolveCodexMcpSnapshot(sessionCwd)
|
||||
: { mcpServers: [], fingerprint: getCodexMcpFingerprint([]) };
|
||||
@@ -2333,9 +2346,18 @@ function registerHandlers(ipcMain) {
|
||||
cleanupAcpProvider(chatSessionId);
|
||||
|
||||
const agentEnv = withCliDiscoveryEnv({ ...shellEnv });
|
||||
if (apiKey) {
|
||||
if (isCodexAgent && apiKey) {
|
||||
agentEnv.CODEX_API_KEY = apiKey;
|
||||
}
|
||||
if (isCodexAgent && resolvedProvider?.provider?.baseURL) {
|
||||
agentEnv.OPENAI_BASE_URL = resolvedProvider.provider.baseURL;
|
||||
}
|
||||
if (isClaudeAgent && apiKey) {
|
||||
agentEnv.ANTHROPIC_API_KEY = apiKey;
|
||||
}
|
||||
if (isClaudeAgent && resolvedProvider?.provider?.baseURL) {
|
||||
agentEnv.ANTHROPIC_BASE_URL = resolvedProvider.provider.baseURL;
|
||||
}
|
||||
let copilotConfigInfo = null;
|
||||
if (isCopilotAgent) {
|
||||
copilotConfigInfo = prepareCopilotHome(shellEnv, mcpSnapshot.mcpServers, chatSessionId);
|
||||
@@ -2452,8 +2474,17 @@ function registerHandlers(ipcMain) {
|
||||
: acpArgs || [],
|
||||
env: (() => {
|
||||
const fallbackEnv = withCliDiscoveryEnv(
|
||||
apiKey ? { ...shellEnv, CODEX_API_KEY: apiKey } : { ...shellEnv },
|
||||
isCodexAgent && apiKey ? { ...shellEnv, CODEX_API_KEY: apiKey } : { ...shellEnv },
|
||||
);
|
||||
if (isCodexAgent && resolvedProvider?.provider?.baseURL) {
|
||||
fallbackEnv.OPENAI_BASE_URL = resolvedProvider.provider.baseURL;
|
||||
}
|
||||
if (isClaudeAgent && apiKey) {
|
||||
fallbackEnv.ANTHROPIC_API_KEY = apiKey;
|
||||
}
|
||||
if (isClaudeAgent && resolvedProvider?.provider?.baseURL) {
|
||||
fallbackEnv.ANTHROPIC_BASE_URL = resolvedProvider.provider.baseURL;
|
||||
}
|
||||
if (isCopilotAgent) {
|
||||
const fallbackCopilotConfig = prepareCopilotHome(shellEnv, mcpSnapshot.mcpServers, chatSessionId);
|
||||
fallbackEnv.COPILOT_HOME = fallbackCopilotConfig.copilotHome;
|
||||
|
||||
Reference in New Issue
Block a user