@golba98/codexa 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +320 -0
- package/bin/codexa.js +445 -0
- package/package.json +45 -0
- package/scripts/audit-codexa-capabilities.mjs +466 -0
- package/scripts/smoke-terminal-bench.mjs +35 -0
- package/src/app.tsx +4561 -0
- package/src/appRenderStability.test.ts +131 -0
- package/src/commands/handler.test.ts +643 -0
- package/src/commands/handler.ts +875 -0
- package/src/config/launchArgs.test.ts +158 -0
- package/src/config/launchArgs.ts +186 -0
- package/src/config/layeredConfig.test.ts +143 -0
- package/src/config/layeredConfig.ts +836 -0
- package/src/config/persistence.test.ts +110 -0
- package/src/config/persistence.ts +311 -0
- package/src/config/runtimeConfig.test.ts +218 -0
- package/src/config/runtimeConfig.ts +554 -0
- package/src/config/settings.test.ts +155 -0
- package/src/config/settings.ts +401 -0
- package/src/config/toml-serialize.ts +98 -0
- package/src/config/trustStore.test.ts +29 -0
- package/src/config/trustStore.ts +68 -0
- package/src/core/attachments.test.ts +155 -0
- package/src/core/attachments.ts +71 -0
- package/src/core/auth/codexAuth.test.ts +68 -0
- package/src/core/auth/codexAuth.ts +359 -0
- package/src/core/cleanupFastFail.test.ts +76 -0
- package/src/core/cleanupFastFail.ts +67 -0
- package/src/core/clipboard.ts +24 -0
- package/src/core/codex.ts +124 -0
- package/src/core/codexExecArgs.test.ts +195 -0
- package/src/core/codexExecArgs.ts +152 -0
- package/src/core/codexLaunch.test.ts +205 -0
- package/src/core/codexLaunch.ts +162 -0
- package/src/core/codexPrompt.test.ts +252 -0
- package/src/core/codexPrompt.ts +428 -0
- package/src/core/executables/claudeExecutable.ts +63 -0
- package/src/core/executables/codexExecutable.test.ts +212 -0
- package/src/core/executables/codexExecutable.ts +159 -0
- package/src/core/executables/executableResolver.test.ts +129 -0
- package/src/core/executables/executableResolver.ts +138 -0
- package/src/core/executables/geminiExecutable.test.ts +116 -0
- package/src/core/executables/geminiExecutable.ts +78 -0
- package/src/core/executables/pathSanityScan.test.ts +47 -0
- package/src/core/githubDiagnostics.test.ts +92 -0
- package/src/core/githubDiagnostics.ts +222 -0
- package/src/core/hollowResponseFormat.test.ts +58 -0
- package/src/core/hollowResponseFormat.ts +39 -0
- package/src/core/inputDebug.ts +51 -0
- package/src/core/launchContext.test.ts +157 -0
- package/src/core/launchContext.ts +266 -0
- package/src/core/models/codexCapabilities.test.ts +45 -0
- package/src/core/models/codexCapabilities.ts +95 -0
- package/src/core/models/codexModelCapabilities.test.ts +246 -0
- package/src/core/models/codexModelCapabilities.ts +571 -0
- package/src/core/models/modelSpecs.test.ts +283 -0
- package/src/core/models/modelSpecs.ts +300 -0
- package/src/core/perf/profiler.ts +125 -0
- package/src/core/perf/renderDebug.test.ts +230 -0
- package/src/core/perf/renderDebug.ts +373 -0
- package/src/core/planStorage.test.ts +143 -0
- package/src/core/planStorage.ts +141 -0
- package/src/core/process/CommandRunner.test.ts +105 -0
- package/src/core/process/CommandRunner.ts +269 -0
- package/src/core/process/processValidation.ts +101 -0
- package/src/core/projectInstructions.test.ts +50 -0
- package/src/core/projectInstructions.ts +54 -0
- package/src/core/providerLauncher/launcher.test.ts +238 -0
- package/src/core/providerLauncher/launcher.ts +203 -0
- package/src/core/providerLauncher/registry.test.ts +324 -0
- package/src/core/providerLauncher/registry.ts +253 -0
- package/src/core/providerLauncher/types.ts +84 -0
- package/src/core/providerLauncher/workspaceConfig.test.ts +638 -0
- package/src/core/providerLauncher/workspaceConfig.ts +407 -0
- package/src/core/providerRuntime/anthropic.test.ts +1120 -0
- package/src/core/providerRuntime/anthropic.ts +576 -0
- package/src/core/providerRuntime/capabilityProfile.test.ts +311 -0
- package/src/core/providerRuntime/capabilityProfile.ts +288 -0
- package/src/core/providerRuntime/claudeCodeDiscovery.ts +446 -0
- package/src/core/providerRuntime/contextMetadata.test.ts +468 -0
- package/src/core/providerRuntime/contextMetadata.ts +409 -0
- package/src/core/providerRuntime/gemini.test.ts +437 -0
- package/src/core/providerRuntime/gemini.ts +784 -0
- package/src/core/providerRuntime/lmstudio.test.ts +168 -0
- package/src/core/providerRuntime/lmstudio.ts +118 -0
- package/src/core/providerRuntime/local.test.ts +787 -0
- package/src/core/providerRuntime/local.ts +754 -0
- package/src/core/providerRuntime/models.ts +150 -0
- package/src/core/providerRuntime/reasoning.ts +17 -0
- package/src/core/providerRuntime/registry.test.ts +233 -0
- package/src/core/providerRuntime/registry.ts +203 -0
- package/src/core/providerRuntime/types.ts +103 -0
- package/src/core/providers/codexJsonStream.test.ts +148 -0
- package/src/core/providers/codexJsonStream.ts +305 -0
- package/src/core/providers/codexSubprocess.test.ts +68 -0
- package/src/core/providers/codexSubprocess.ts +372 -0
- package/src/core/providers/codexTranscript.test.ts +284 -0
- package/src/core/providers/codexTranscript.ts +695 -0
- package/src/core/providers/openaiNative.ts +13 -0
- package/src/core/providers/registry.ts +21 -0
- package/src/core/providers/types.ts +59 -0
- package/src/core/terminal/terminalCapabilities.test.ts +93 -0
- package/src/core/terminal/terminalCapabilities.ts +100 -0
- package/src/core/terminal/terminalControl.test.ts +75 -0
- package/src/core/terminal/terminalControl.ts +147 -0
- package/src/core/terminal/terminalSanitize.test.ts +22 -0
- package/src/core/terminal/terminalSanitize.ts +147 -0
- package/src/core/terminal/terminalSelection.test.ts +42 -0
- package/src/core/terminal/terminalSelection.ts +66 -0
- package/src/core/terminal/terminalTitle.test.ts +328 -0
- package/src/core/terminal/terminalTitle.ts +483 -0
- package/src/core/workspaceActivity.test.ts +163 -0
- package/src/core/workspaceActivity.ts +380 -0
- package/src/core/workspaceGuard.test.ts +151 -0
- package/src/core/workspaceGuard.ts +288 -0
- package/src/core/workspaceRoot.test.ts +23 -0
- package/src/core/workspaceRoot.ts +47 -0
- package/src/exec.test.ts +13 -0
- package/src/exec.ts +72 -0
- package/src/headless/execArgs.test.ts +147 -0
- package/src/headless/execArgs.ts +294 -0
- package/src/headless/execRunner.test.ts +434 -0
- package/src/headless/execRunner.ts +304 -0
- package/src/index.test.tsx +618 -0
- package/src/index.tsx +296 -0
- package/src/session/appSession.test.ts +897 -0
- package/src/session/appSession.ts +761 -0
- package/src/session/chatLifecycle.test.ts +64 -0
- package/src/session/chatLifecycle.ts +951 -0
- package/src/session/liveRenderScheduler.test.ts +201 -0
- package/src/session/liveRenderScheduler.ts +214 -0
- package/src/session/planFlow.test.ts +103 -0
- package/src/session/planFlow.ts +149 -0
- package/src/session/planTranscript.test.ts +65 -0
- package/src/session/planTranscript.ts +15 -0
- package/src/session/promptRunSchedule.test.ts +36 -0
- package/src/session/promptRunSchedule.ts +26 -0
- package/src/session/types.ts +228 -0
- package/src/test/runtimeTestUtils.ts +14 -0
- package/src/types/react-dom.d.ts +3 -0
- package/src/ui/ActionRequiredBlock.tsx +38 -0
- package/src/ui/ActivityBars.tsx +68 -0
- package/src/ui/ActivityIndicator.test.tsx +58 -0
- package/src/ui/ActivityIndicator.tsx +58 -0
- package/src/ui/AgentBlock.test.ts +6 -0
- package/src/ui/AgentBlock.tsx +130 -0
- package/src/ui/AnimatedStatusText.test.ts +16 -0
- package/src/ui/AnimatedStatusText.tsx +69 -0
- package/src/ui/AppShell.test.tsx +1739 -0
- package/src/ui/AppShell.tsx +698 -0
- package/src/ui/AttachmentImportPanel.test.tsx +204 -0
- package/src/ui/AttachmentImportPanel.tsx +98 -0
- package/src/ui/AuthPanel.tsx +113 -0
- package/src/ui/BackendPicker.tsx +28 -0
- package/src/ui/BottomComposer.test.ts +674 -0
- package/src/ui/BottomComposer.tsx +1028 -0
- package/src/ui/CodexLogo.tsx +55 -0
- package/src/ui/DashCard.tsx +82 -0
- package/src/ui/Markdown.test.ts +157 -0
- package/src/ui/Markdown.tsx +310 -0
- package/src/ui/ModePicker.tsx +27 -0
- package/src/ui/ModelPicker.tsx +31 -0
- package/src/ui/ModelPickerProviderScope.test.tsx +411 -0
- package/src/ui/ModelPickerScreen.test.tsx +99 -0
- package/src/ui/ModelPickerScreen.tsx +416 -0
- package/src/ui/ModelPickerState.test.tsx +151 -0
- package/src/ui/ModelReasoningPicker.test.tsx +447 -0
- package/src/ui/ModelReasoningPicker.tsx +458 -0
- package/src/ui/Panel.tsx +51 -0
- package/src/ui/PermissionsPanel.tsx +78 -0
- package/src/ui/PlanActionPicker.tsx +119 -0
- package/src/ui/PlanReviewPanel.test.tsx +267 -0
- package/src/ui/PlanReviewPanel.tsx +212 -0
- package/src/ui/PromptCardBorder.test.tsx +161 -0
- package/src/ui/ProviderPicker.test.tsx +289 -0
- package/src/ui/ProviderPicker.tsx +321 -0
- package/src/ui/ProviderShortcut.test.tsx +143 -0
- package/src/ui/ReasoningPicker.tsx +46 -0
- package/src/ui/RunFooter.tsx +65 -0
- package/src/ui/SelectionPanel.tsx +67 -0
- package/src/ui/SettingsPanel.test.tsx +233 -0
- package/src/ui/SettingsPanel.tsx +156 -0
- package/src/ui/Spinner.tsx +25 -0
- package/src/ui/StaticIntroItem.tsx +54 -0
- package/src/ui/StaticTranscriptItem.tsx +56 -0
- package/src/ui/TextEntryPanel.tsx +139 -0
- package/src/ui/ThemePicker.tsx +31 -0
- package/src/ui/ThinkingBlock.tsx +100 -0
- package/src/ui/Timeline.test.ts +2067 -0
- package/src/ui/Timeline.tsx +1472 -0
- package/src/ui/TimelineNavigation.test.tsx +201 -0
- package/src/ui/TopHeader.test.tsx +239 -0
- package/src/ui/TopHeader.tsx +257 -0
- package/src/ui/TurnGroup.test.tsx +365 -0
- package/src/ui/TurnGroup.tsx +657 -0
- package/src/ui/busyStatusAnimation.test.ts +30 -0
- package/src/ui/busyStatusAnimation.ts +11 -0
- package/src/ui/commandNormalize.test.ts +142 -0
- package/src/ui/commandNormalize.ts +66 -0
- package/src/ui/diffRenderer.test.ts +102 -0
- package/src/ui/diffRenderer.ts +116 -0
- package/src/ui/focus.ts +61 -0
- package/src/ui/focusFlow.test.tsx +1098 -0
- package/src/ui/inputBuffer.test.ts +151 -0
- package/src/ui/inputBuffer.ts +203 -0
- package/src/ui/layout.test.ts +145 -0
- package/src/ui/layout.ts +287 -0
- package/src/ui/modeDisplay.test.ts +42 -0
- package/src/ui/modeDisplay.ts +52 -0
- package/src/ui/outputPipeline.ts +64 -0
- package/src/ui/progressEntries.ts +156 -0
- package/src/ui/runActivityView.test.ts +89 -0
- package/src/ui/runActivityView.ts +37 -0
- package/src/ui/runLifecycleView.test.tsx +237 -0
- package/src/ui/slashCommands.ts +41 -0
- package/src/ui/statusRenderIsolation.test.tsx +654 -0
- package/src/ui/terminalAnswerFormat.test.ts +19 -0
- package/src/ui/terminalAnswerFormat.ts +128 -0
- package/src/ui/textLayout.test.ts +18 -0
- package/src/ui/textLayout.ts +338 -0
- package/src/ui/theme.tsx +395 -0
- package/src/ui/themeFlow.test.ts +53 -0
- package/src/ui/themeFlow.ts +41 -0
- package/src/ui/timelineMeasure.ts +3088 -0
- package/src/ui/timelineMeasureCache.test.ts +986 -0
- package/src/ui/useThrottledValue.ts +31 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { buildProviderRegistry, getDefaultProviderId } from "./registry.js";
|
|
4
|
+
import { checkLocalProvider, resetLocalProviderStateForTests } from "../providerRuntime/local.js";
|
|
5
|
+
import { resetGeminiRouteValidationCacheForTests } from "../providerRuntime/gemini.js";
|
|
6
|
+
import { resetGeminiExecutableCacheForTests } from "../executables/geminiExecutable.js";
|
|
7
|
+
import { setProviderActiveRoute } from "./workspaceConfig.js";
|
|
8
|
+
import { resolveActiveProviderRoute } from "../providerRuntime/registry.js";
|
|
9
|
+
|
|
10
|
+
test("provider registry exposes the default launcher providers", () => {
|
|
11
|
+
const providers = buildProviderRegistry({ activeModel: "gpt-5.4" });
|
|
12
|
+
|
|
13
|
+
assert.deepEqual(providers.map((provider) => provider.id), ["openai", "anthropic", "google", "local"]);
|
|
14
|
+
assert.equal(providers[0]?.displayName, "OpenAI");
|
|
15
|
+
assert.equal(providers[0]?.currentModel, "gpt-5.4");
|
|
16
|
+
assert.deepEqual(providers[0]?.launchCommand, { executable: "codex", args: [] });
|
|
17
|
+
assert.deepEqual(providers[1]?.launchCommand, { executable: "claude", args: [] });
|
|
18
|
+
assert.deepEqual(providers[2]?.launchCommand, { executable: "gemini", args: [] });
|
|
19
|
+
assert.equal(providers[3]?.enabled, false);
|
|
20
|
+
assert.equal(providers[3]?.launchCommand, null);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test("workspace config can set the default provider", () => {
|
|
24
|
+
const providers = buildProviderRegistry({
|
|
25
|
+
activeModel: "gpt-5.4",
|
|
26
|
+
workspaceConfig: { workspaceDefaultProviderId: "anthropic" },
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
assert.equal(getDefaultProviderId({ workspaceDefaultProviderId: "anthropic" }), "anthropic");
|
|
30
|
+
assert.equal(providers.find((provider) => provider.id === "anthropic")?.isDefault, true);
|
|
31
|
+
assert.equal(providers.find((provider) => provider.id === "openai")?.isDefault, false);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test("provider registry keeps workspace default separate from active route", () => {
|
|
35
|
+
const providers = buildProviderRegistry({
|
|
36
|
+
activeModel: "gpt-5.4",
|
|
37
|
+
workspaceConfig: {
|
|
38
|
+
workspaceDefaultProviderId: "anthropic",
|
|
39
|
+
activeRoute: {
|
|
40
|
+
providerId: "openai",
|
|
41
|
+
modelId: "gpt-5.4",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
assert.equal(providers.find((provider) => provider.id === "anthropic")?.isDefault, true);
|
|
47
|
+
assert.equal(providers.find((provider) => provider.id === "anthropic")?.isActiveRoute, false);
|
|
48
|
+
assert.equal(providers.find((provider) => provider.id === "openai")?.isDefault, false);
|
|
49
|
+
assert.equal(providers.find((provider) => provider.id === "openai")?.isActiveRoute, true);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test("unvalidated local provider remains disabled until endpoint discovery succeeds", () => {
|
|
53
|
+
resetLocalProviderStateForTests();
|
|
54
|
+
const providers = buildProviderRegistry({
|
|
55
|
+
activeModel: "gpt-5.4",
|
|
56
|
+
workspaceConfig: {
|
|
57
|
+
workspaceDefaultProviderId: "anthropic",
|
|
58
|
+
activeRoute: {
|
|
59
|
+
providerId: "local",
|
|
60
|
+
modelId: "llama-local",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
assert.equal(providers.find((provider) => provider.id === "anthropic")?.isDefault, true);
|
|
66
|
+
assert.equal(providers.find((provider) => provider.id === "local")?.isActiveRoute, true);
|
|
67
|
+
assert.equal(providers.find((provider) => provider.id === "local")?.routeMode, "in-codexa");
|
|
68
|
+
assert.equal(providers.find((provider) => provider.id === "local")?.enabled, false);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test("google can be selected as an active in-Codexa route", () => {
|
|
72
|
+
const providers = buildProviderRegistry({
|
|
73
|
+
activeModel: "gpt-5.4",
|
|
74
|
+
workspaceConfig: {
|
|
75
|
+
activeRoute: {
|
|
76
|
+
providerId: "google",
|
|
77
|
+
modelId: "gemini-3-flash-preview",
|
|
78
|
+
backendKind: "gemini-cli-auth",
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
assert.equal(providers.find((provider) => provider.id === "google")?.isActiveRoute, true);
|
|
84
|
+
assert.equal(providers.find((provider) => provider.id === "google")?.routeMode, "in-codexa");
|
|
85
|
+
assert.equal(providers.find((provider) => provider.id === "google")?.currentModel, "gemini-3-flash-preview");
|
|
86
|
+
assert.equal(providers.find((provider) => provider.id === "openai")?.isActiveRoute, false);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test("anthropic can be selected as an active in-Codexa route", () => {
|
|
90
|
+
const providers = buildProviderRegistry({
|
|
91
|
+
activeModel: "gpt-5.4",
|
|
92
|
+
workspaceConfig: {
|
|
93
|
+
activeRoute: {
|
|
94
|
+
providerId: "anthropic",
|
|
95
|
+
modelId: "claude-sonnet-4-20250514",
|
|
96
|
+
backendKind: "anthropic-api-key",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
assert.equal(providers.find((provider) => provider.id === "anthropic")?.isActiveRoute, true);
|
|
102
|
+
assert.equal(providers.find((provider) => provider.id === "anthropic")?.routeMode, "in-codexa");
|
|
103
|
+
assert.equal(providers.find((provider) => provider.id === "anthropic")?.currentModel, "claude-sonnet-4-20250514");
|
|
104
|
+
assert.equal(providers.find((provider) => provider.id === "openai")?.isActiveRoute, false);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
test("discovered local models enable local provider and display selected model", async () => {
|
|
109
|
+
resetLocalProviderStateForTests();
|
|
110
|
+
const localOverride = {
|
|
111
|
+
currentModel: "google/gemma-4-26b-a4b",
|
|
112
|
+
};
|
|
113
|
+
await checkLocalProvider({
|
|
114
|
+
override: localOverride,
|
|
115
|
+
fetchImpl: (async (input) => {
|
|
116
|
+
if (String(input).includes("/api/v0/")) {
|
|
117
|
+
return new Response(null, { status: 404 });
|
|
118
|
+
}
|
|
119
|
+
return new Response(JSON.stringify({
|
|
120
|
+
data: [{ id: "google/gemma-4-26b-a4b" }],
|
|
121
|
+
}), { status: 200 });
|
|
122
|
+
}) as typeof fetch,
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
const providers = buildProviderRegistry({
|
|
126
|
+
activeModel: "gpt-5.4",
|
|
127
|
+
workspaceConfig: {
|
|
128
|
+
activeRoute: {
|
|
129
|
+
providerId: "local",
|
|
130
|
+
modelId: "google/gemma-4-26b-a4b",
|
|
131
|
+
backendKind: "local-openai-compatible",
|
|
132
|
+
},
|
|
133
|
+
providers: {
|
|
134
|
+
local: localOverride,
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const local = providers.find((provider) => provider.id === "local");
|
|
140
|
+
assert.equal(local?.enabled, true);
|
|
141
|
+
assert.equal(local?.currentModel, "google/gemma-4-26b-a4b");
|
|
142
|
+
assert.equal(local?.backendType, "local-openai-compatible");
|
|
143
|
+
assert.equal(local?.statusLabel, "Enabled");
|
|
144
|
+
assert.deepEqual(local?.launchCommand, null);
|
|
145
|
+
resetLocalProviderStateForTests();
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
test("LM Studio loaded Local model replaces stale active route in provider registry", async () => {
|
|
149
|
+
resetLocalProviderStateForTests();
|
|
150
|
+
try {
|
|
151
|
+
await checkLocalProvider({
|
|
152
|
+
override: {
|
|
153
|
+
currentModel: "google/gemma-4-26b-a4b",
|
|
154
|
+
defaultModel: "google/gemma-4-26b-a4b",
|
|
155
|
+
baseUrl: "http://localhost:1234/v1",
|
|
156
|
+
},
|
|
157
|
+
fetchImpl: (async (input) => {
|
|
158
|
+
if (String(input).includes("/api/v0/")) {
|
|
159
|
+
return new Response(JSON.stringify({
|
|
160
|
+
data: [{
|
|
161
|
+
id: "qwen/qwen3.6-27b",
|
|
162
|
+
state: "loaded",
|
|
163
|
+
loaded_context_length: 32000,
|
|
164
|
+
max_context_length: 262144,
|
|
165
|
+
capabilities: ["tool_use"],
|
|
166
|
+
}],
|
|
167
|
+
object: "list",
|
|
168
|
+
}), { status: 200 });
|
|
169
|
+
}
|
|
170
|
+
return new Response(JSON.stringify({
|
|
171
|
+
data: [{ id: "google/gemma-4-26b-a4b" }, { id: "qwen/qwen3.6-27b" }],
|
|
172
|
+
}), { status: 200 });
|
|
173
|
+
}) as typeof fetch,
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
const providers = buildProviderRegistry({
|
|
177
|
+
activeModel: "gpt-5.4",
|
|
178
|
+
workspaceConfig: {
|
|
179
|
+
activeRoute: {
|
|
180
|
+
providerId: "local",
|
|
181
|
+
modelId: "google/gemma-4-26b-a4b",
|
|
182
|
+
backendKind: "local-openai-compatible",
|
|
183
|
+
},
|
|
184
|
+
providers: {
|
|
185
|
+
local: {
|
|
186
|
+
currentModel: "google/gemma-4-26b-a4b",
|
|
187
|
+
defaultModel: "google/gemma-4-26b-a4b",
|
|
188
|
+
baseUrl: "http://localhost:1234/v1",
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
const local = providers.find((provider) => provider.id === "local");
|
|
195
|
+
assert.equal(local?.currentModel, "qwen/qwen3.6-27b");
|
|
196
|
+
assert.equal(local?.contextLengthLabel, "32,000");
|
|
197
|
+
assert.equal(local?.contextLengthSource, "lmstudio-api");
|
|
198
|
+
assert.equal(local?.capabilityProfile?.supportsToolCalls, true);
|
|
199
|
+
assert.equal(local?.capabilityProfile?.supportsVision, null);
|
|
200
|
+
} finally {
|
|
201
|
+
resetLocalProviderStateForTests();
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
// ─── Provider status label / color sync tests ────────────────────────────────
|
|
206
|
+
|
|
207
|
+
async function withNoGeminiConfig<T>(callback: () => T | Promise<T>): Promise<T> {
|
|
208
|
+
const savedGemini = process.env.GEMINI_API_KEY;
|
|
209
|
+
const savedGoogle = process.env.GOOGLE_API_KEY;
|
|
210
|
+
const savedExe = process.env.GEMINI_EXECUTABLE;
|
|
211
|
+
const savedCliPath = process.env.GEMINI_CLI_PATH;
|
|
212
|
+
try {
|
|
213
|
+
delete process.env.GEMINI_API_KEY;
|
|
214
|
+
delete process.env.GOOGLE_API_KEY;
|
|
215
|
+
delete process.env.GEMINI_EXECUTABLE;
|
|
216
|
+
delete process.env.GEMINI_CLI_PATH;
|
|
217
|
+
resetGeminiRouteValidationCacheForTests();
|
|
218
|
+
resetGeminiExecutableCacheForTests();
|
|
219
|
+
return await callback();
|
|
220
|
+
} finally {
|
|
221
|
+
if (savedGemini === undefined) delete process.env.GEMINI_API_KEY; else process.env.GEMINI_API_KEY = savedGemini;
|
|
222
|
+
if (savedGoogle === undefined) delete process.env.GOOGLE_API_KEY; else process.env.GOOGLE_API_KEY = savedGoogle;
|
|
223
|
+
if (savedExe === undefined) delete process.env.GEMINI_EXECUTABLE; else process.env.GEMINI_EXECUTABLE = savedExe;
|
|
224
|
+
if (savedCliPath === undefined) delete process.env.GEMINI_CLI_PATH; else process.env.GEMINI_CLI_PATH = savedCliPath;
|
|
225
|
+
resetGeminiRouteValidationCacheForTests();
|
|
226
|
+
resetGeminiExecutableCacheForTests();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
test("google shows 'Needs config' statusLabel when no API key or CLI validation is present", async () => {
|
|
231
|
+
await withNoGeminiConfig(() => {
|
|
232
|
+
const providers = buildProviderRegistry({ activeModel: "gpt-5.4" });
|
|
233
|
+
const google = providers.find((p) => p.id === "google");
|
|
234
|
+
assert.equal(google?.statusLabel, "Needs config");
|
|
235
|
+
assert.notEqual(google?.routeUnavailableReason, null);
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
test("google shows 'Enabled' statusLabel when GEMINI_API_KEY is set", async () => {
|
|
240
|
+
const saved = process.env.GEMINI_API_KEY;
|
|
241
|
+
try {
|
|
242
|
+
process.env.GEMINI_API_KEY = "test-key";
|
|
243
|
+
resetGeminiRouteValidationCacheForTests();
|
|
244
|
+
const providers = buildProviderRegistry({ activeModel: "gpt-5.4" });
|
|
245
|
+
const google = providers.find((p) => p.id === "google");
|
|
246
|
+
assert.equal(google?.statusLabel, "Enabled");
|
|
247
|
+
assert.equal(google?.routeUnavailableReason, null);
|
|
248
|
+
} finally {
|
|
249
|
+
if (saved === undefined) delete process.env.GEMINI_API_KEY; else process.env.GEMINI_API_KEY = saved;
|
|
250
|
+
resetGeminiRouteValidationCacheForTests();
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
test("google 'Needs config' survives workspace config override with no enabled field", async () => {
|
|
255
|
+
await withNoGeminiConfig(() => {
|
|
256
|
+
const providers = buildProviderRegistry({
|
|
257
|
+
activeModel: "gpt-5.4",
|
|
258
|
+
workspaceConfig: {
|
|
259
|
+
providers: {
|
|
260
|
+
google: { currentModel: "gemini-3-flash-preview", currentReasoning: "medium" },
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
});
|
|
264
|
+
const google = providers.find((p) => p.id === "google");
|
|
265
|
+
assert.equal(google?.statusLabel, "Needs config");
|
|
266
|
+
assert.notEqual(google?.routeUnavailableReason, null);
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
test("'Active' text is display-layer only — registry statusLabel stays 'Enabled' for active route when configured", async () => {
|
|
271
|
+
const saved = process.env.GEMINI_API_KEY;
|
|
272
|
+
try {
|
|
273
|
+
process.env.GEMINI_API_KEY = "test-key";
|
|
274
|
+
resetGeminiRouteValidationCacheForTests();
|
|
275
|
+
const providers = buildProviderRegistry({
|
|
276
|
+
activeModel: "gpt-5.4",
|
|
277
|
+
workspaceConfig: {
|
|
278
|
+
activeRoute: { providerId: "google", modelId: "gemini-3-flash-preview", backendKind: "gemini-cli-auth" },
|
|
279
|
+
},
|
|
280
|
+
});
|
|
281
|
+
const google = providers.find((p) => p.id === "google");
|
|
282
|
+
assert.equal(google?.isActiveRoute, true);
|
|
283
|
+
assert.equal(google?.statusLabel, "Enabled");
|
|
284
|
+
} finally {
|
|
285
|
+
if (saved === undefined) delete process.env.GEMINI_API_KEY; else process.env.GEMINI_API_KEY = saved;
|
|
286
|
+
resetGeminiRouteValidationCacheForTests();
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
test("resolveActiveProviderRoute returns google route when configured via API key", async () => {
|
|
291
|
+
const saved = process.env.GEMINI_API_KEY;
|
|
292
|
+
try {
|
|
293
|
+
process.env.GEMINI_API_KEY = "test-key";
|
|
294
|
+
resetGeminiRouteValidationCacheForTests();
|
|
295
|
+
const route = resolveActiveProviderRoute({
|
|
296
|
+
workspaceConfigActiveRoute: {
|
|
297
|
+
providerId: "google",
|
|
298
|
+
modelId: "gemini-3-flash-preview",
|
|
299
|
+
backendKind: "gemini-cli-auth",
|
|
300
|
+
},
|
|
301
|
+
currentModel: "gpt-5.4",
|
|
302
|
+
currentReasoning: "medium",
|
|
303
|
+
});
|
|
304
|
+
assert.equal(route.providerId, "google");
|
|
305
|
+
assert.equal(route.modelId, "gemini-3-flash-preview");
|
|
306
|
+
} finally {
|
|
307
|
+
if (saved === undefined) delete process.env.GEMINI_API_KEY; else process.env.GEMINI_API_KEY = saved;
|
|
308
|
+
resetGeminiRouteValidationCacheForTests();
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
test("setProviderActiveRoute does not update activeRoute when google is not configured", async () => {
|
|
313
|
+
await withNoGeminiConfig(() => {
|
|
314
|
+
const original: import("./types.js").ProviderWorkspaceConfig = {
|
|
315
|
+
activeRoute: { providerId: "openai", modelId: "gpt-5.4", backendKind: "codex-cli-auth" },
|
|
316
|
+
};
|
|
317
|
+
const result = setProviderActiveRoute(original, {
|
|
318
|
+
providerId: "google",
|
|
319
|
+
modelId: "gemini-3-flash-preview",
|
|
320
|
+
backendKind: "gemini-cli-auth",
|
|
321
|
+
});
|
|
322
|
+
assert.equal(result.activeRoute?.providerId, "openai");
|
|
323
|
+
});
|
|
324
|
+
});
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ProviderConfig,
|
|
3
|
+
ProviderId,
|
|
4
|
+
ProviderBackendType,
|
|
5
|
+
ProviderLaunchCommand,
|
|
6
|
+
ProviderWorkspaceConfig,
|
|
7
|
+
ProviderWorkspaceOverride,
|
|
8
|
+
} from "./types.js";
|
|
9
|
+
import { DEFAULT_MODEL } from "../../config/settings.js";
|
|
10
|
+
import {
|
|
11
|
+
getDefaultRouteModel,
|
|
12
|
+
getProviderRouteSetupMessage,
|
|
13
|
+
getProviderRuntime,
|
|
14
|
+
isProviderRoutableInCodexa,
|
|
15
|
+
isProviderRouteConfigured,
|
|
16
|
+
} from "../providerRuntime/registry.js";
|
|
17
|
+
import { normalizeGeminiModelId } from "../providerRuntime/models.js";
|
|
18
|
+
import { setLocalProviderConfig } from "../providerRuntime/local.js";
|
|
19
|
+
import { formatContextLength, resolveModelContextLengthCached } from "../providerRuntime/contextMetadata.js";
|
|
20
|
+
import { resolveModelCapabilityProfileCached } from "../providerRuntime/capabilityProfile.js";
|
|
21
|
+
|
|
22
|
+
const PROVIDER_ORDER: readonly ProviderId[] = ["openai", "anthropic", "google", "local"];
|
|
23
|
+
|
|
24
|
+
const DEFAULT_PROVIDER_ID: ProviderId = "openai";
|
|
25
|
+
|
|
26
|
+
type ProviderDefault = Omit<ProviderConfig, "currentModel" | "enabled" | "statusLabel" | "launchCommand" | "isDefault"> & {
|
|
27
|
+
currentModel: (activeModel: string) => string;
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
launchCommand: ProviderLaunchCommand | null;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const DEFAULT_PROVIDERS: Record<ProviderId, ProviderDefault> = {
|
|
33
|
+
openai: {
|
|
34
|
+
id: "openai",
|
|
35
|
+
displayName: "OpenAI",
|
|
36
|
+
currentModel: (activeModel) => activeModel,
|
|
37
|
+
backendType: "codex-cli-auth",
|
|
38
|
+
routeMode: "in-codexa",
|
|
39
|
+
enabled: true,
|
|
40
|
+
launchCommand: { executable: "codex", args: [] },
|
|
41
|
+
isActiveRoute: false,
|
|
42
|
+
routeUnavailableReason: null,
|
|
43
|
+
},
|
|
44
|
+
anthropic: {
|
|
45
|
+
id: "anthropic",
|
|
46
|
+
displayName: "Anthropic",
|
|
47
|
+
currentModel: () => "Claude Code default",
|
|
48
|
+
backendType: "claude-code-auth",
|
|
49
|
+
routeMode: "in-codexa",
|
|
50
|
+
enabled: true,
|
|
51
|
+
launchCommand: { executable: "claude", args: [] },
|
|
52
|
+
isActiveRoute: false,
|
|
53
|
+
routeUnavailableReason: null,
|
|
54
|
+
},
|
|
55
|
+
google: {
|
|
56
|
+
id: "google",
|
|
57
|
+
displayName: "Google",
|
|
58
|
+
currentModel: () => "gemini-3-flash-preview",
|
|
59
|
+
backendType: "gemini-cli-auth",
|
|
60
|
+
routeMode: "in-codexa",
|
|
61
|
+
enabled: true,
|
|
62
|
+
launchCommand: { executable: "gemini", args: [] },
|
|
63
|
+
isActiveRoute: false,
|
|
64
|
+
routeUnavailableReason: null,
|
|
65
|
+
},
|
|
66
|
+
local: {
|
|
67
|
+
id: "local",
|
|
68
|
+
displayName: "Local",
|
|
69
|
+
currentModel: () => "Local default",
|
|
70
|
+
backendType: "local-openai-compatible",
|
|
71
|
+
routeMode: "in-codexa",
|
|
72
|
+
enabled: false,
|
|
73
|
+
launchCommand: null,
|
|
74
|
+
isActiveRoute: false,
|
|
75
|
+
routeUnavailableReason: "Local provider unavailable. Start LM Studio, load a model, and enable the local server.",
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
function isProviderId(value: unknown): value is ProviderId {
|
|
80
|
+
return typeof value === "string" && PROVIDER_ORDER.includes(value as ProviderId);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function normalizeLaunchCommand(value: ProviderWorkspaceOverride["command"] | undefined): ProviderLaunchCommand | null | undefined {
|
|
84
|
+
if (value === undefined) return undefined;
|
|
85
|
+
if (value === null) return null;
|
|
86
|
+
if (typeof value === "string") {
|
|
87
|
+
const executable = value.trim();
|
|
88
|
+
return executable ? { executable, args: [] } : null;
|
|
89
|
+
}
|
|
90
|
+
if (typeof value.executable !== "string") return undefined;
|
|
91
|
+
const executable = value.executable.trim();
|
|
92
|
+
if (!executable) return null;
|
|
93
|
+
return {
|
|
94
|
+
executable,
|
|
95
|
+
args: Array.isArray(value.args)
|
|
96
|
+
? value.args.filter((arg): arg is string => typeof arg === "string")
|
|
97
|
+
: [],
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function applyOverride(
|
|
102
|
+
provider: ProviderConfig,
|
|
103
|
+
override: ProviderWorkspaceOverride | undefined,
|
|
104
|
+
): ProviderConfig {
|
|
105
|
+
if (!override) return provider;
|
|
106
|
+
|
|
107
|
+
const launchCommand = normalizeLaunchCommand(override.command);
|
|
108
|
+
const hasConfiguredCommand = launchCommand !== undefined;
|
|
109
|
+
const nextCommand = hasConfiguredCommand ? launchCommand : provider.launchCommand;
|
|
110
|
+
const nextEnabled = typeof override.enabled === "boolean"
|
|
111
|
+
? provider.id === "local" ? provider.enabled && override.enabled : override.enabled
|
|
112
|
+
: provider.enabled;
|
|
113
|
+
|
|
114
|
+
const overrideModel = typeof override.currentModel === "string" && override.currentModel.trim()
|
|
115
|
+
? override.currentModel.trim()
|
|
116
|
+
: null;
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
...provider,
|
|
120
|
+
currentModel: overrideModel && provider.id !== "local"
|
|
121
|
+
? provider.id === "google" ? normalizeGeminiModelId(overrideModel) : overrideModel
|
|
122
|
+
: provider.currentModel,
|
|
123
|
+
enabled: nextEnabled,
|
|
124
|
+
launchCommand: nextCommand,
|
|
125
|
+
statusLabel: nextEnabled
|
|
126
|
+
? (provider.routeUnavailableReason ? "Needs config" : "Enabled")
|
|
127
|
+
: "Disabled",
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function getDefaultProviderId(config: ProviderWorkspaceConfig | null | undefined): ProviderId {
|
|
132
|
+
return isProviderId(config?.workspaceDefaultProviderId) ? config.workspaceDefaultProviderId : DEFAULT_PROVIDER_ID;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function getActiveRouteProviderId(config: ProviderWorkspaceConfig | null | undefined): ProviderId {
|
|
136
|
+
const providerId = config?.activeRoute?.providerId;
|
|
137
|
+
return isProviderId(providerId) && isProviderRoutableInCodexa(providerId)
|
|
138
|
+
? providerId
|
|
139
|
+
: DEFAULT_PROVIDER_ID;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function buildProviderRegistry(options: {
|
|
143
|
+
activeModel: string;
|
|
144
|
+
workspaceConfig?: ProviderWorkspaceConfig | null;
|
|
145
|
+
diagnostics?: Record<string, Record<string, string | number | boolean | null>>;
|
|
146
|
+
routeErrors?: Record<string, string>;
|
|
147
|
+
}): ProviderConfig[] {
|
|
148
|
+
const defaultProviderId = getDefaultProviderId(options.workspaceConfig);
|
|
149
|
+
const activeRouteProviderId = getActiveRouteProviderId(options.workspaceConfig);
|
|
150
|
+
|
|
151
|
+
return PROVIDER_ORDER.map((id) => {
|
|
152
|
+
if (id === "local") {
|
|
153
|
+
setLocalProviderConfig(options.workspaceConfig?.providers?.local);
|
|
154
|
+
}
|
|
155
|
+
const defaults = DEFAULT_PROVIDERS[id];
|
|
156
|
+
const runtime = getProviderRuntime(id);
|
|
157
|
+
const discovery = runtime.discoverModels();
|
|
158
|
+
|
|
159
|
+
const activeRoute = options.workspaceConfig?.activeRoute;
|
|
160
|
+
const isThisActive = activeRoute?.providerId === id;
|
|
161
|
+
|
|
162
|
+
let currentModelLabel = isThisActive && activeRoute
|
|
163
|
+
? activeRoute.modelId
|
|
164
|
+
: getDefaultRouteModel(id, id === "openai" ? DEFAULT_MODEL : defaults.currentModel(options.activeModel));
|
|
165
|
+
|
|
166
|
+
if (id === "google") {
|
|
167
|
+
// Use the active route's model selection when this provider is active, or when
|
|
168
|
+
// the workspace config has no explicit Google model override.
|
|
169
|
+
const hasGoogleOverride = options.workspaceConfig?.providers?.google?.currentModel !== undefined;
|
|
170
|
+
const geminiRoute = isThisActive || !hasGoogleOverride ? activeRoute : null;
|
|
171
|
+
const selection = geminiRoute?.modelSelection;
|
|
172
|
+
if (selection) {
|
|
173
|
+
if (selection.kind === "auto") {
|
|
174
|
+
currentModelLabel = `Auto (${selection.family === "gemini-3" ? "Gemini 3" : "Gemini 2.5"})`;
|
|
175
|
+
} else {
|
|
176
|
+
currentModelLabel = normalizeGeminiModelId(selection.modelId);
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
currentModelLabel = normalizeGeminiModelId(currentModelLabel);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (id === "local") {
|
|
184
|
+
const selectedModel = typeof discovery.diagnostics?.selectedModel === "string" && discovery.diagnostics.selectedModel.trim()
|
|
185
|
+
? discovery.diagnostics.selectedModel.trim()
|
|
186
|
+
: discovery.models[0]?.modelId;
|
|
187
|
+
if (selectedModel) {
|
|
188
|
+
currentModelLabel = selectedModel;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const rawMetadataForModel = discovery.models.find((model) => model.modelId === currentModelLabel)?.raw;
|
|
193
|
+
const contextMetadata = resolveModelContextLengthCached({
|
|
194
|
+
providerId: id,
|
|
195
|
+
modelId: currentModelLabel,
|
|
196
|
+
providerConfig: options.workspaceConfig?.providers?.[id],
|
|
197
|
+
rawMetadata: rawMetadataForModel,
|
|
198
|
+
});
|
|
199
|
+
const contextSource = contextMetadata.source === "known-registry" ? "registry" : contextMetadata.source;
|
|
200
|
+
const capabilityProfile = resolveModelCapabilityProfileCached({
|
|
201
|
+
providerId: id,
|
|
202
|
+
modelId: currentModelLabel,
|
|
203
|
+
providerConfig: options.workspaceConfig?.providers?.[id],
|
|
204
|
+
rawMetadata: rawMetadataForModel,
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
const routeUnavailableReason: string | null = runtime.routeAvailable
|
|
208
|
+
? (isProviderRouteConfigured(id)
|
|
209
|
+
? null
|
|
210
|
+
: (options.routeErrors?.[id]
|
|
211
|
+
?? discovery.message
|
|
212
|
+
?? getProviderRouteSetupMessage(id)))
|
|
213
|
+
: runtime.routeStatus;
|
|
214
|
+
|
|
215
|
+
const enabled = id === "local" ? discovery.status === "ready" : defaults.enabled;
|
|
216
|
+
|
|
217
|
+
const statusLabel = id === "local"
|
|
218
|
+
? (discovery.status === "ready" ? "Enabled" : "Disabled")
|
|
219
|
+
: !defaults.enabled
|
|
220
|
+
? "Disabled"
|
|
221
|
+
: routeUnavailableReason
|
|
222
|
+
? "Needs config"
|
|
223
|
+
: "Enabled";
|
|
224
|
+
|
|
225
|
+
const provider: ProviderConfig = {
|
|
226
|
+
id,
|
|
227
|
+
displayName: defaults.displayName,
|
|
228
|
+
currentModel: currentModelLabel,
|
|
229
|
+
contextLengthLabel: formatContextLength(contextMetadata.contextLength),
|
|
230
|
+
contextLengthSource: contextSource,
|
|
231
|
+
capabilityProfile,
|
|
232
|
+
backendType: discovery.backendKind as ProviderBackendType,
|
|
233
|
+
routeMode: runtime.routeAvailable ? "in-codexa" : "launch-only",
|
|
234
|
+
enabled,
|
|
235
|
+
statusLabel,
|
|
236
|
+
launchCommand: defaults.launchCommand ? { ...defaults.launchCommand, args: [...defaults.launchCommand.args] } : null,
|
|
237
|
+
isDefault: id === defaultProviderId,
|
|
238
|
+
isActiveRoute: id === activeRouteProviderId,
|
|
239
|
+
routeUnavailableReason,
|
|
240
|
+
routeDiagnostics: options.diagnostics?.[id],
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
return applyOverride(provider, options.workspaceConfig?.providers?.[id]);
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export function findProvider(providers: readonly ProviderConfig[], providerId: ProviderId): ProviderConfig | null {
|
|
248
|
+
return providers.find((provider) => provider.id === providerId) ?? null;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export function isKnownProviderId(value: string): value is ProviderId {
|
|
252
|
+
return isProviderId(value);
|
|
253
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export type ProviderId = "openai" | "anthropic" | "google" | "local";
|
|
2
|
+
|
|
3
|
+
export type ProviderBackendType =
|
|
4
|
+
| "codex-cli-auth"
|
|
5
|
+
| "gemini-cli-auth"
|
|
6
|
+
| "claude-code-auth"
|
|
7
|
+
| "openai-api-key"
|
|
8
|
+
| "gemini-api-key"
|
|
9
|
+
| "anthropic-api-key"
|
|
10
|
+
| "local-openai-compatible"
|
|
11
|
+
| "unavailable";
|
|
12
|
+
|
|
13
|
+
export type ProviderLaunchAction = "launch" | "set-default" | "cancel";
|
|
14
|
+
export type ProviderRouteAction = "use-in-codexa" | "select-model" | "refresh-models" | "run-diagnostics";
|
|
15
|
+
export type ProviderPickerAction = ProviderLaunchAction | ProviderRouteAction;
|
|
16
|
+
export type ProviderRouteMode = "in-codexa" | "launch-only";
|
|
17
|
+
|
|
18
|
+
export interface ProviderLaunchCommand {
|
|
19
|
+
executable: string;
|
|
20
|
+
args: string[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ProviderConfig {
|
|
24
|
+
id: ProviderId;
|
|
25
|
+
displayName: string;
|
|
26
|
+
currentModel: string;
|
|
27
|
+
contextLengthLabel?: string;
|
|
28
|
+
contextLengthSource?: string;
|
|
29
|
+
capabilityProfile?: import("../providerRuntime/capabilityProfile.js").ModelCapabilityProfile;
|
|
30
|
+
backendType: ProviderBackendType;
|
|
31
|
+
routeMode: ProviderRouteMode;
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
statusLabel: string;
|
|
34
|
+
launchCommand: ProviderLaunchCommand | null;
|
|
35
|
+
isDefault: boolean;
|
|
36
|
+
isActiveRoute: boolean;
|
|
37
|
+
routeUnavailableReason: string | null;
|
|
38
|
+
routeDiagnostics?: Record<string, string | number | boolean | null>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface ProviderWorkspaceConfig {
|
|
42
|
+
workspaceDefaultProviderId?: ProviderId;
|
|
43
|
+
activeRoute?: ProviderActiveRoute;
|
|
44
|
+
providers?: Partial<Record<ProviderId, ProviderWorkspaceOverride>>;
|
|
45
|
+
migrationNotice?: ProviderWorkspaceMigrationNotice;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface ProviderWorkspaceMigrationNotice {
|
|
49
|
+
deprecatedProviderId: string;
|
|
50
|
+
revertedProviderId: ProviderId;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface ProviderActiveRoute {
|
|
54
|
+
providerId: ProviderId;
|
|
55
|
+
modelId: string;
|
|
56
|
+
backendKind?: import("../providerRuntime/types.js").ProviderBackendKind;
|
|
57
|
+
reasoning?: string;
|
|
58
|
+
modelSelection?: import("../providerRuntime/types.js").GeminiModelSelection;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface ProviderWorkspaceOverride {
|
|
62
|
+
currentModel?: string;
|
|
63
|
+
currentReasoning?: string;
|
|
64
|
+
enabled?: boolean;
|
|
65
|
+
type?: "openai-compatible";
|
|
66
|
+
baseUrl?: string;
|
|
67
|
+
apiKey?: string;
|
|
68
|
+
pinnedModel?: string;
|
|
69
|
+
defaultModel?: string;
|
|
70
|
+
models?: Record<string, ProviderModelWorkspaceOverride>;
|
|
71
|
+
command?: string | ProviderLaunchCommand | null;
|
|
72
|
+
claudeCommandPath?: string;
|
|
73
|
+
geminiCommandPath?: string;
|
|
74
|
+
codexCommandPath?: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface ProviderModelWorkspaceOverride {
|
|
78
|
+
contextLength?: number;
|
|
79
|
+
maxOutputTokens?: number;
|
|
80
|
+
supportsStreaming?: boolean;
|
|
81
|
+
supportsToolCalls?: boolean;
|
|
82
|
+
supportsSystemPrompt?: boolean;
|
|
83
|
+
supportsVision?: boolean;
|
|
84
|
+
}
|