feat(settings): refactor agent auth modes and add model provider authentication
- Split env vars and config file persistence into separate save operations - Add model_provider_id field to agent_setting for tracking selected provider - Add "Model Provider" auth mode for Claude Code, Codex CLI, and Gemini CLI - Add "Custom Endpoint" auth mode for Claude Code (previously only official subscription) - Unify auth mode labels across all three agents (official subscription / custom endpoint / model provider) - When model provider is selected, fill api_url and api_key into env and config automatically - Resolve model provider credentials at ACP connect time as a backend fallback - Clear provider deletion cascades to agent_setting.model_provider_id - Claude Code writes API credentials to config.env (ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN) - Codex: switching auth modes patches config.toml instead of clearing it - Add i18n keys for new auth modes in all 10 supported languages Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -228,6 +228,40 @@ export async function acpUpdateAgentPreferences(
|
||||
})
|
||||
}
|
||||
|
||||
export async function acpUpdateAgentEnv(
|
||||
agentType: AgentType,
|
||||
params: {
|
||||
enabled: boolean
|
||||
env: Record<string, string>
|
||||
modelProviderId?: number | null
|
||||
}
|
||||
): Promise<void> {
|
||||
return getTransport().call("acp_update_agent_env", {
|
||||
agentType,
|
||||
enabled: params.enabled,
|
||||
env: params.env,
|
||||
modelProviderId: params.modelProviderId ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function acpUpdateAgentConfig(
|
||||
agentType: AgentType,
|
||||
params: {
|
||||
config_json?: string | null
|
||||
opencode_auth_json?: string | null
|
||||
codex_auth_json?: string | null
|
||||
codex_config_toml?: string | null
|
||||
}
|
||||
): Promise<void> {
|
||||
return getTransport().call("acp_update_agent_config", {
|
||||
agentType,
|
||||
configJson: params.config_json ?? null,
|
||||
opencodeAuthJson: params.opencode_auth_json ?? null,
|
||||
codexAuthJson: params.codex_auth_json ?? null,
|
||||
codexConfigToml: params.codex_config_toml ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function acpReorderAgents(agentTypes: AgentType[]): Promise<void> {
|
||||
return getTransport().call("acp_reorder_agents", { agentTypes })
|
||||
}
|
||||
|
||||
@@ -475,6 +475,7 @@ export interface AcpAgentInfo {
|
||||
codex_auth_json: string | null
|
||||
codex_config_toml: string | null
|
||||
cline_secrets_json: string | null
|
||||
model_provider_id: number | null
|
||||
}
|
||||
|
||||
// Lightweight agent status returned by acp_get_agent_status
|
||||
@@ -902,6 +903,7 @@ export interface ModelProviderInfo {
|
||||
id: number
|
||||
name: string
|
||||
api_url: string
|
||||
api_key: string
|
||||
api_key_masked: string
|
||||
agent_types: AgentType[]
|
||||
created_at: string
|
||||
|
||||
Reference in New Issue
Block a user