dexto 1.5.6 → 1.5.8
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 +13 -0
- package/dist/agents/coding-agent/coding-agent.yml +17 -0
- package/dist/agents/coding-agent/skills/code-review.md +46 -0
- package/dist/agents/explore-agent/explore-agent.yml +2 -0
- package/dist/analytics/events.d.ts +1 -1
- package/dist/analytics/events.d.ts.map +1 -1
- package/dist/api/server-hono.d.ts.map +1 -1
- package/dist/api/server-hono.js +55 -10
- package/dist/cli/assets/dexto-logo.svg +31 -0
- package/dist/cli/auth/api-client.d.ts +49 -0
- package/dist/cli/auth/api-client.d.ts.map +1 -0
- package/dist/cli/auth/api-client.js +127 -0
- package/dist/cli/auth/constants.d.ts +27 -0
- package/dist/cli/auth/constants.d.ts.map +1 -0
- package/dist/cli/auth/constants.js +28 -0
- package/dist/cli/auth/index.d.ts +5 -0
- package/dist/cli/auth/index.d.ts.map +1 -0
- package/dist/cli/auth/index.js +6 -0
- package/dist/cli/auth/oauth.d.ts +26 -0
- package/dist/cli/auth/oauth.d.ts.map +1 -0
- package/dist/cli/auth/oauth.js +327 -0
- package/dist/cli/auth/service.d.ts +20 -0
- package/dist/cli/auth/service.d.ts.map +1 -0
- package/dist/cli/auth/service.js +147 -0
- package/dist/cli/commands/auth/index.d.ts +4 -0
- package/dist/cli/commands/auth/index.d.ts.map +1 -0
- package/dist/cli/commands/auth/index.js +4 -0
- package/dist/cli/commands/auth/login.d.ts +9 -0
- package/dist/cli/commands/auth/login.d.ts.map +1 -0
- package/dist/cli/commands/auth/login.js +255 -0
- package/dist/cli/commands/auth/logout.d.ts +5 -0
- package/dist/cli/commands/auth/logout.d.ts.map +1 -0
- package/dist/cli/commands/auth/logout.js +51 -0
- package/dist/cli/commands/auth/status.d.ts +2 -0
- package/dist/cli/commands/auth/status.d.ts.map +1 -0
- package/dist/cli/commands/auth/status.js +22 -0
- package/dist/cli/commands/billing/index.d.ts +2 -0
- package/dist/cli/commands/billing/index.d.ts.map +1 -0
- package/dist/cli/commands/billing/index.js +2 -0
- package/dist/cli/commands/billing/status.d.ts +8 -0
- package/dist/cli/commands/billing/status.d.ts.map +1 -0
- package/dist/cli/commands/billing/status.js +82 -0
- package/dist/cli/commands/index.d.ts +3 -0
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +8 -0
- package/dist/cli/commands/interactive-commands/auth/index.d.ts +12 -0
- package/dist/cli/commands/interactive-commands/auth/index.d.ts.map +1 -0
- package/dist/cli/commands/interactive-commands/auth/index.js +20 -0
- package/dist/cli/commands/interactive-commands/command-parser.d.ts +5 -0
- package/dist/cli/commands/interactive-commands/command-parser.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/command-parser.js +6 -0
- package/dist/cli/commands/interactive-commands/commands.d.ts +1 -0
- package/dist/cli/commands/interactive-commands/commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/commands.js +8 -0
- package/dist/cli/commands/interactive-commands/mcp/index.d.ts +2 -2
- package/dist/cli/commands/interactive-commands/mcp/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/mcp/index.js +4 -7
- package/dist/cli/commands/interactive-commands/model/index.d.ts +2 -2
- package/dist/cli/commands/interactive-commands/model/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/model/index.js +4 -7
- package/dist/cli/commands/interactive-commands/plugin/index.d.ts +13 -0
- package/dist/cli/commands/interactive-commands/plugin/index.d.ts.map +1 -0
- package/dist/cli/commands/interactive-commands/plugin/index.js +18 -0
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts +3 -1
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/prompt-commands.js +88 -36
- package/dist/cli/commands/list-agents.d.ts.map +1 -1
- package/dist/cli/commands/list-agents.js +3 -2
- package/dist/cli/commands/plugin.d.ts +161 -0
- package/dist/cli/commands/plugin.d.ts.map +1 -0
- package/dist/cli/commands/plugin.js +376 -0
- package/dist/cli/commands/setup.d.ts +9 -9
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +944 -176
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/InkCLIRefactored.js +13 -2
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts +1 -1
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ApprovalPrompt.js +80 -12
- package/dist/cli/ink-cli/components/BackgroundTasksPanel.d.ts +18 -0
- package/dist/cli/ink-cli/components/BackgroundTasksPanel.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/BackgroundTasksPanel.js +48 -0
- package/dist/cli/ink-cli/components/ErrorBoundary.js +1 -1
- package/dist/cli/ink-cli/components/Footer.d.ts +2 -1
- package/dist/cli/ink-cli/components/Footer.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/Footer.js +6 -2
- package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ResourceAutocomplete.js +150 -41
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.js +15 -7
- package/dist/cli/ink-cli/components/StatusBar.d.ts +7 -1
- package/dist/cli/ink-cli/components/StatusBar.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/StatusBar.js +18 -2
- package/dist/cli/ink-cli/components/chat/MessageItem.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/MessageItem.js +23 -6
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.js +5 -1
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/modes/StaticCLI.js +5 -1
- package/dist/cli/ink-cli/components/overlays/ContextStatsOverlay.js +1 -1
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.js +8 -4
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts +1 -0
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.js +31 -20
- package/dist/cli/ink-cli/components/overlays/MarketplaceAddPrompt.d.ts +20 -0
- package/dist/cli/ink-cli/components/overlays/MarketplaceAddPrompt.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/MarketplaceAddPrompt.js +81 -0
- package/dist/cli/ink-cli/components/overlays/MarketplaceBrowser.d.ts +31 -0
- package/dist/cli/ink-cli/components/overlays/MarketplaceBrowser.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/MarketplaceBrowser.js +297 -0
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.js +8 -2
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts +1 -1
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/McpServerActions.js +9 -0
- package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/McpServerList.js +9 -2
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts +1 -0
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.js +150 -34
- package/dist/cli/ink-cli/components/overlays/PluginActions.d.ts +27 -0
- package/dist/cli/ink-cli/components/overlays/PluginActions.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PluginActions.js +66 -0
- package/dist/cli/ink-cli/components/overlays/PluginList.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/PluginList.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PluginList.js +70 -0
- package/dist/cli/ink-cli/components/overlays/PluginManager.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/PluginManager.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PluginManager.js +63 -0
- package/dist/cli/ink-cli/components/overlays/PromptList.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/PromptList.js +4 -1
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts +1 -0
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.js +281 -39
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts +10 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.js +87 -2
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts +4 -2
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.js +4 -4
- package/dist/cli/ink-cli/containers/InputContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/InputContainer.js +32 -5
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/OverlayContainer.js +384 -28
- package/dist/cli/ink-cli/hooks/index.d.ts +1 -0
- package/dist/cli/ink-cli/hooks/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/index.js +1 -0
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useAgentEvents.js +61 -0
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useCLIState.js +5 -0
- package/dist/cli/ink-cli/hooks/useGitBranch.d.ts +13 -0
- package/dist/cli/ink-cli/hooks/useGitBranch.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useGitBranch.js +35 -0
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.js +53 -6
- package/dist/cli/ink-cli/services/processStream.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/processStream.js +92 -12
- package/dist/cli/ink-cli/state/initialState.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/initialState.js +5 -0
- package/dist/cli/ink-cli/state/types.d.ts +12 -1
- package/dist/cli/ink-cli/state/types.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/commandOverlays.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/commandOverlays.js +1 -0
- package/dist/cli/ink-cli/utils/llm-provider-display.d.ts +3 -0
- package/dist/cli/ink-cli/utils/llm-provider-display.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/llm-provider-display.js +22 -0
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts +18 -7
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/messageFormatting.js +143 -15
- package/dist/cli/ink-cli/utils/toolUtils.d.ts +11 -0
- package/dist/cli/ink-cli/utils/toolUtils.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/toolUtils.js +17 -0
- package/dist/cli/mcp/index.d.ts +8 -0
- package/dist/cli/mcp/index.d.ts.map +1 -0
- package/dist/cli/mcp/index.js +7 -0
- package/dist/cli/mcp/oauth-factory.d.ts +6 -0
- package/dist/cli/mcp/oauth-factory.d.ts.map +1 -0
- package/dist/cli/mcp/oauth-factory.js +25 -0
- package/dist/cli/mcp/oauth-provider.d.ts +10 -0
- package/dist/cli/mcp/oauth-provider.d.ts.map +1 -0
- package/dist/cli/mcp/oauth-provider.js +77 -0
- package/dist/cli/mcp/oauth-redirect.d.ts +3 -0
- package/dist/cli/mcp/oauth-redirect.d.ts.map +1 -0
- package/dist/cli/mcp/oauth-redirect.js +4 -0
- package/dist/cli/mcp/oauth-server.d.ts +2 -0
- package/dist/cli/mcp/oauth-server.d.ts.map +1 -0
- package/dist/cli/mcp/oauth-server.js +70 -0
- package/dist/cli/mcp/oauth-store.d.ts +10 -0
- package/dist/cli/mcp/oauth-store.d.ts.map +1 -0
- package/dist/cli/mcp/oauth-store.js +27 -0
- package/dist/cli/mcp/oauth-ui.d.ts +2 -0
- package/dist/cli/mcp/oauth-ui.d.ts.map +1 -0
- package/dist/cli/mcp/oauth-ui.js +12 -0
- package/dist/cli/mcp/oauth-utils.d.ts +2 -0
- package/dist/cli/mcp/oauth-utils.d.ts.map +1 -0
- package/dist/cli/mcp/oauth-utils.js +17 -0
- package/dist/cli/utils/api-key-verification.d.ts.map +1 -1
- package/dist/cli/utils/api-key-verification.js +36 -0
- package/dist/cli/utils/config-validation.d.ts +3 -1
- package/dist/cli/utils/config-validation.d.ts.map +1 -1
- package/dist/cli/utils/config-validation.js +42 -19
- package/dist/cli/utils/dexto-auth-check.d.ts +53 -0
- package/dist/cli/utils/dexto-auth-check.d.ts.map +1 -0
- package/dist/cli/utils/dexto-auth-check.js +104 -0
- package/dist/cli/utils/dexto-setup.d.ts +8 -0
- package/dist/cli/utils/dexto-setup.d.ts.map +1 -0
- package/dist/cli/utils/dexto-setup.js +17 -0
- package/dist/cli/utils/options.d.ts.map +1 -1
- package/dist/cli/utils/options.js +5 -1
- package/dist/cli/utils/provider-setup.d.ts +5 -1
- package/dist/cli/utils/provider-setup.d.ts.map +1 -1
- package/dist/cli/utils/provider-setup.js +29 -1
- package/dist/config/cli-overrides.d.ts +17 -8
- package/dist/config/cli-overrides.d.ts.map +1 -1
- package/dist/config/cli-overrides.js +36 -22
- package/dist/config/effective-llm.d.ts +123 -0
- package/dist/config/effective-llm.d.ts.map +1 -0
- package/dist/config/effective-llm.js +171 -0
- package/dist/index.js +404 -99
- package/dist/webui/assets/index-C9JXwpvo.css +1 -0
- package/dist/webui/assets/{index-DVQWNLpT.js → index-Cz2z7NQ8.js} +218 -218
- package/dist/webui/index.html +2 -2
- package/package.json +9 -8
- package/dist/webui/assets/index-BglIVTSG.css +0 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { promises as fs } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { getDextoPath } from '@dexto/core';
|
|
4
|
+
export async function loadMcpAuthStore(serverId) {
|
|
5
|
+
const filePath = getMcpAuthStorePath(serverId);
|
|
6
|
+
try {
|
|
7
|
+
const data = await fs.readFile(filePath, 'utf8');
|
|
8
|
+
return JSON.parse(data);
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
if (error.code === 'ENOENT') {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
throw error;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export async function saveMcpAuthStore(serverId, store) {
|
|
18
|
+
const filePath = getMcpAuthStorePath(serverId);
|
|
19
|
+
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
20
|
+
await fs.writeFile(filePath, JSON.stringify(store, null, 2));
|
|
21
|
+
}
|
|
22
|
+
export function getMcpAuthStorePath(serverId) {
|
|
23
|
+
return getDextoPath('mcp-auth', `${sanitizeServerId(serverId)}.json`);
|
|
24
|
+
}
|
|
25
|
+
function sanitizeServerId(serverId) {
|
|
26
|
+
return serverId.replace(/[^a-zA-Z0-9._-]/g, '_');
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-ui.d.ts","sourceRoot":"","sources":["../../../src/cli/mcp/oauth-ui.ts"],"names":[],"mappings":"AAEA,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAU5D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
export async function openAuthUrl(url) {
|
|
3
|
+
console.log(chalk.cyan('🌐 Opening browser for MCP authentication...'));
|
|
4
|
+
try {
|
|
5
|
+
const { default: open } = await import('open');
|
|
6
|
+
await open(url, { wait: false });
|
|
7
|
+
console.log(chalk.green('✅ Browser opened'));
|
|
8
|
+
}
|
|
9
|
+
catch (_error) {
|
|
10
|
+
console.log(chalk.yellow(`💡 Please open manually: ${url}`));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-utils.d.ts","sourceRoot":"","sources":["../../../src/cli/mcp/oauth-utils.ts"],"names":[],"mappings":"AAEA,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBrE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createServer } from 'node:http';
|
|
2
|
+
export async function ensurePortAvailable(port) {
|
|
3
|
+
await new Promise((resolve, reject) => {
|
|
4
|
+
const server = createServer();
|
|
5
|
+
server.listen(port, () => {
|
|
6
|
+
server.close(() => resolve());
|
|
7
|
+
});
|
|
8
|
+
server.on('error', (err) => {
|
|
9
|
+
if (err.code === 'EADDRINUSE') {
|
|
10
|
+
reject(new Error(`Port ${port} is already in use. Please close the application using it and try again.`));
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
reject(err);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-key-verification.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/api-key-verification.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAC9B,QAAQ,EAAE,WAAW,EACrB,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"api-key-verification.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/api-key-verification.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAC9B,QAAQ,EAAE,WAAW,EACrB,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,kBAAkB,CAAC,CA0C7B"}
|
|
@@ -28,6 +28,10 @@ export async function verifyApiKey(provider, apiKey, _model) {
|
|
|
28
28
|
return await verifyOpenRouter(apiKey);
|
|
29
29
|
case 'glama':
|
|
30
30
|
return await verifyGlama(apiKey);
|
|
31
|
+
case 'minimax':
|
|
32
|
+
return await verifyMiniMax(apiKey);
|
|
33
|
+
case 'glm':
|
|
34
|
+
return await verifyGLM(apiKey);
|
|
31
35
|
case 'openai-compatible':
|
|
32
36
|
case 'litellm':
|
|
33
37
|
// For custom endpoints, we can't verify without a baseURL
|
|
@@ -184,6 +188,38 @@ async function verifyGlama(apiKey) {
|
|
|
184
188
|
const error = await parseErrorResponse(response);
|
|
185
189
|
return { success: false, error };
|
|
186
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* Verify MiniMax API key using the OpenAI-compatible models endpoint
|
|
193
|
+
*/
|
|
194
|
+
async function verifyMiniMax(apiKey) {
|
|
195
|
+
const response = await fetch('https://api.minimax.chat/v1/models', {
|
|
196
|
+
method: 'GET',
|
|
197
|
+
headers: {
|
|
198
|
+
Authorization: `Bearer ${apiKey}`,
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
if (response.ok) {
|
|
202
|
+
return { success: true, modelUsed: 'models-list' };
|
|
203
|
+
}
|
|
204
|
+
const error = await parseErrorResponse(response);
|
|
205
|
+
return { success: false, error };
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Verify GLM (Zhipu) API key using the OpenAI-compatible models endpoint
|
|
209
|
+
*/
|
|
210
|
+
async function verifyGLM(apiKey) {
|
|
211
|
+
const response = await fetch('https://open.bigmodel.cn/api/paas/v4/models', {
|
|
212
|
+
method: 'GET',
|
|
213
|
+
headers: {
|
|
214
|
+
Authorization: `Bearer ${apiKey}`,
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
if (response.ok) {
|
|
218
|
+
return { success: true, modelUsed: 'models-list' };
|
|
219
|
+
}
|
|
220
|
+
const error = await parseErrorResponse(response);
|
|
221
|
+
return { success: false, error };
|
|
222
|
+
}
|
|
187
223
|
/**
|
|
188
224
|
* Parse error response from provider API
|
|
189
225
|
*/
|
|
@@ -19,7 +19,9 @@ export interface ValidationResult {
|
|
|
19
19
|
* @param validationOptions.strict - When true (default), enforces API key requirements.
|
|
20
20
|
* When false, allows missing credentials for interactive config.
|
|
21
21
|
*/
|
|
22
|
-
export declare function validateAgentConfig(config: AgentConfig, interactive?: boolean, validationOptions?: LLMValidationOptions
|
|
22
|
+
export declare function validateAgentConfig(config: AgentConfig, interactive?: boolean, validationOptions?: LLMValidationOptions & {
|
|
23
|
+
agentPath?: string;
|
|
24
|
+
}): Promise<ValidationResult>;
|
|
23
25
|
/**
|
|
24
26
|
* Legacy function for backwards compatibility
|
|
25
27
|
* @deprecated Use validateAgentConfig with result handling instead
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-validation.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/config-validation.ts"],"names":[],"mappings":"AAGA,OAAO,EAGH,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC5B,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"config-validation.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/config-validation.ts"],"names":[],"mappings":"AAGA,OAAO,EAGH,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC5B,MAAM,aAAa,CAAC;AAYrB,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,mBAAmB,CACrC,MAAM,EAAE,WAAW,EACnB,WAAW,GAAE,OAAe,EAC5B,iBAAiB,CAAC,EAAE,oBAAoB,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAClE,OAAO,CAAC,gBAAgB,CAAC,CAyC3B;AAkbD;;;GAGG;AACH,wBAAsB,yBAAyB,CAC3C,MAAM,EAAE,WAAW,EACnB,WAAW,GAAE,OAAe,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CAgC/B"}
|
|
@@ -5,6 +5,7 @@ import { interactiveApiKeySetup } from './api-key-setup.js';
|
|
|
5
5
|
import { LLMErrorCode } from '@dexto/core';
|
|
6
6
|
import { logger } from '@dexto/core';
|
|
7
7
|
import { getGlobalPreferencesPath, loadGlobalPreferences, saveGlobalPreferences, } from '@dexto/agent-management';
|
|
8
|
+
import { handleSyncAgentsCommand } from '../commands/sync-agents.js';
|
|
8
9
|
/**
|
|
9
10
|
* Validates agent config with optional interactive fixes for user experience.
|
|
10
11
|
* Uses schema parsing to detect API key issues and provides targeted setup.
|
|
@@ -51,7 +52,7 @@ export async function validateAgentConfig(config, interactive = false, validatio
|
|
|
51
52
|
return await handleBaseURLError(baseURLError.provider, config, errors, validationOptions);
|
|
52
53
|
}
|
|
53
54
|
// Other validation errors - show options
|
|
54
|
-
return await handleOtherErrors(errors);
|
|
55
|
+
return await handleOtherErrors(errors, validationOptions);
|
|
55
56
|
}
|
|
56
57
|
/**
|
|
57
58
|
* Handle API key validation errors interactively
|
|
@@ -92,7 +93,7 @@ async function handleApiKeyError(provider, config, errors, validationOptions) {
|
|
|
92
93
|
return { success: false, errors, skipped: true };
|
|
93
94
|
}
|
|
94
95
|
if (action === 'edit') {
|
|
95
|
-
showManualEditInstructions();
|
|
96
|
+
showManualEditInstructions(undefined);
|
|
96
97
|
return { success: false, errors, skipped: true };
|
|
97
98
|
}
|
|
98
99
|
// 'skip' - continue anyway
|
|
@@ -154,7 +155,7 @@ async function handleBaseURLError(provider, config, errors, validationOptions) {
|
|
|
154
155
|
return { success: false, errors, skipped: true };
|
|
155
156
|
}
|
|
156
157
|
if (action === 'edit') {
|
|
157
|
-
showManualEditInstructions();
|
|
158
|
+
showManualEditInstructions(undefined);
|
|
158
159
|
return { success: false, errors, skipped: true };
|
|
159
160
|
}
|
|
160
161
|
// 'skip' - continue anyway
|
|
@@ -228,7 +229,7 @@ async function interactiveBaseURLSetup(provider, existingBaseURL) {
|
|
|
228
229
|
/**
|
|
229
230
|
* Handle non-API-key validation errors interactively
|
|
230
231
|
*/
|
|
231
|
-
async function handleOtherErrors(errors) {
|
|
232
|
+
async function handleOtherErrors(errors, validationOptions) {
|
|
232
233
|
console.log(chalk.rgb(255, 165, 0)('\n⚠️ Configuration issues detected:\n'));
|
|
233
234
|
for (const error of errors) {
|
|
234
235
|
console.log(chalk.red(` • ${error}`));
|
|
@@ -237,6 +238,11 @@ async function handleOtherErrors(errors) {
|
|
|
237
238
|
const action = await p.select({
|
|
238
239
|
message: 'How would you like to proceed?',
|
|
239
240
|
options: [
|
|
241
|
+
{
|
|
242
|
+
value: 'sync',
|
|
243
|
+
label: 'Sync agent config',
|
|
244
|
+
hint: 'Update from bundled registry (recommended)',
|
|
245
|
+
},
|
|
240
246
|
{
|
|
241
247
|
value: 'skip',
|
|
242
248
|
label: 'Continue anyway',
|
|
@@ -247,23 +253,27 @@ async function handleOtherErrors(errors) {
|
|
|
247
253
|
label: 'Edit configuration manually',
|
|
248
254
|
hint: 'Show file path and instructions',
|
|
249
255
|
},
|
|
250
|
-
{
|
|
251
|
-
value: 'setup',
|
|
252
|
-
label: 'Run setup again',
|
|
253
|
-
hint: 'Reconfigure from scratch',
|
|
254
|
-
},
|
|
255
256
|
],
|
|
256
257
|
});
|
|
257
258
|
if (p.isCancel(action)) {
|
|
258
259
|
showNextSteps();
|
|
259
260
|
return { success: false, errors, skipped: true };
|
|
260
261
|
}
|
|
261
|
-
if (action === '
|
|
262
|
-
|
|
263
|
-
|
|
262
|
+
if (action === 'sync') {
|
|
263
|
+
try {
|
|
264
|
+
// Run sync-agents to update the agent config
|
|
265
|
+
await handleSyncAgentsCommand({ force: true, quiet: false });
|
|
266
|
+
// Exit after sync - user needs to restart dexto
|
|
267
|
+
p.outro(chalk.gray('Run dexto to start Dexto'));
|
|
268
|
+
process.exit(0);
|
|
269
|
+
}
|
|
270
|
+
catch (error) {
|
|
271
|
+
p.log.error(`Failed to sync agent: ${error instanceof Error ? error.message : String(error)}`);
|
|
272
|
+
return { success: false, errors, skipped: true };
|
|
273
|
+
}
|
|
264
274
|
}
|
|
265
|
-
if (action === '
|
|
266
|
-
|
|
275
|
+
if (action === 'edit') {
|
|
276
|
+
showManualEditInstructions(validationOptions?.agentPath);
|
|
267
277
|
return { success: false, errors, skipped: true };
|
|
268
278
|
}
|
|
269
279
|
// 'skip' - continue anyway
|
|
@@ -293,19 +303,32 @@ function showNextSteps() {
|
|
|
293
303
|
/**
|
|
294
304
|
* Show manual edit instructions
|
|
295
305
|
*/
|
|
296
|
-
function showManualEditInstructions() {
|
|
306
|
+
function showManualEditInstructions(agentPath) {
|
|
297
307
|
const prefsPath = getGlobalPreferencesPath();
|
|
308
|
+
const configPaths = [` ${chalk.cyan('Global preferences:')} ${prefsPath}`];
|
|
309
|
+
if (agentPath) {
|
|
310
|
+
configPaths.push(` ${chalk.cyan('Agent config:')} ${agentPath}`);
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
configPaths.push(` ${chalk.cyan('Agent configs:')} ~/.dexto/agents/*/`);
|
|
314
|
+
}
|
|
298
315
|
p.note([
|
|
299
316
|
`Your configuration files:`,
|
|
300
317
|
``,
|
|
301
|
-
|
|
302
|
-
` ${chalk.cyan('Agent configs:')} ~/.dexto/agents/*/`,
|
|
318
|
+
...configPaths,
|
|
303
319
|
``,
|
|
304
320
|
`Edit the appropriate file and run dexto again.`,
|
|
305
321
|
``,
|
|
306
322
|
chalk.gray('Example commands:'),
|
|
307
|
-
|
|
308
|
-
|
|
323
|
+
...(agentPath
|
|
324
|
+
? [
|
|
325
|
+
chalk.gray(` code ${agentPath} # Open in VS Code`),
|
|
326
|
+
chalk.gray(` nano ${agentPath} # Edit in terminal`),
|
|
327
|
+
]
|
|
328
|
+
: [
|
|
329
|
+
chalk.gray(` code ${prefsPath} # Open in VS Code`),
|
|
330
|
+
chalk.gray(` nano ${prefsPath} # Edit in terminal`),
|
|
331
|
+
]),
|
|
309
332
|
].join('\n'), 'Manual Configuration');
|
|
310
333
|
}
|
|
311
334
|
/**
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dexto Authentication Check
|
|
3
|
+
*
|
|
4
|
+
* Validates that users configured to use Dexto Nova credits are properly authenticated.
|
|
5
|
+
* This prevents the confusing state where user is logged out but still has
|
|
6
|
+
* Dexto Nova credits configured (which would fail at runtime).
|
|
7
|
+
*
|
|
8
|
+
* ## When This Check Runs
|
|
9
|
+
*
|
|
10
|
+
* - On CLI startup, after loading preferences
|
|
11
|
+
* - Before attempting to use the LLM
|
|
12
|
+
*
|
|
13
|
+
* ## Why This Exists
|
|
14
|
+
*
|
|
15
|
+
* When a user runs `dexto logout` while configured with `provider: dexto-nova`,
|
|
16
|
+
* their preferences.yml still points to Dexto. Without this check, the CLI
|
|
17
|
+
* would attempt to use Dexto Nova credits and fail with "Invalid API key" errors.
|
|
18
|
+
*
|
|
19
|
+
* Instead, we catch this state early and offer clear options:
|
|
20
|
+
* - Log back in to continue using Dexto Nova credits
|
|
21
|
+
* - Run setup to configure a different provider (BYOK)
|
|
22
|
+
*
|
|
23
|
+
* @module dexto-auth-check
|
|
24
|
+
*/
|
|
25
|
+
export interface DextoAuthCheckResult {
|
|
26
|
+
shouldContinue: boolean;
|
|
27
|
+
action?: 'login' | 'setup' | 'cancel';
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Check if user is configured to use Dexto Nova credits but is not authenticated.
|
|
31
|
+
* This can happen if user logged out after setting up with Dexto Nova credits.
|
|
32
|
+
*
|
|
33
|
+
* Uses getEffectiveLLMConfig() to determine the actual LLM that will be used,
|
|
34
|
+
* considering all config layers (local, preferences, bundled).
|
|
35
|
+
*
|
|
36
|
+
* @param interactive Whether to show interactive prompts
|
|
37
|
+
* @param agentId Agent to check config for (default: 'coding-agent')
|
|
38
|
+
* @returns Whether to continue startup and what action was taken
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* const result = await checkDextoAuthState(true, 'coding-agent');
|
|
43
|
+
* if (!result.shouldContinue) {
|
|
44
|
+
* if (result.action === 'login') {
|
|
45
|
+
* await handleLoginCommand();
|
|
46
|
+
* } else if (result.action === 'setup') {
|
|
47
|
+
* await handleSetupCommand();
|
|
48
|
+
* }
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function checkDextoAuthState(interactive?: boolean, agentId?: string): Promise<DextoAuthCheckResult>;
|
|
53
|
+
//# sourceMappingURL=dexto-auth-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dexto-auth-check.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/dexto-auth-check.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAOH,MAAM,WAAW,oBAAoB;IACjC,cAAc,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;CACzC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,mBAAmB,CACrC,WAAW,GAAE,OAAc,EAC3B,OAAO,GAAE,MAAuB,GACjC,OAAO,CAAC,oBAAoB,CAAC,CAoE/B"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// packages/cli/src/cli/utils/dexto-auth-check.ts
|
|
2
|
+
/**
|
|
3
|
+
* Dexto Authentication Check
|
|
4
|
+
*
|
|
5
|
+
* Validates that users configured to use Dexto Nova credits are properly authenticated.
|
|
6
|
+
* This prevents the confusing state where user is logged out but still has
|
|
7
|
+
* Dexto Nova credits configured (which would fail at runtime).
|
|
8
|
+
*
|
|
9
|
+
* ## When This Check Runs
|
|
10
|
+
*
|
|
11
|
+
* - On CLI startup, after loading preferences
|
|
12
|
+
* - Before attempting to use the LLM
|
|
13
|
+
*
|
|
14
|
+
* ## Why This Exists
|
|
15
|
+
*
|
|
16
|
+
* When a user runs `dexto logout` while configured with `provider: dexto-nova`,
|
|
17
|
+
* their preferences.yml still points to Dexto. Without this check, the CLI
|
|
18
|
+
* would attempt to use Dexto Nova credits and fail with "Invalid API key" errors.
|
|
19
|
+
*
|
|
20
|
+
* Instead, we catch this state early and offer clear options:
|
|
21
|
+
* - Log back in to continue using Dexto Nova credits
|
|
22
|
+
* - Run setup to configure a different provider (BYOK)
|
|
23
|
+
*
|
|
24
|
+
* @module dexto-auth-check
|
|
25
|
+
*/
|
|
26
|
+
import chalk from 'chalk';
|
|
27
|
+
import * as p from '@clack/prompts';
|
|
28
|
+
import { isAuthenticated } from '../auth/index.js';
|
|
29
|
+
import { getEffectiveLLMConfig } from '../../config/effective-llm.js';
|
|
30
|
+
/**
|
|
31
|
+
* Check if user is configured to use Dexto Nova credits but is not authenticated.
|
|
32
|
+
* This can happen if user logged out after setting up with Dexto Nova credits.
|
|
33
|
+
*
|
|
34
|
+
* Uses getEffectiveLLMConfig() to determine the actual LLM that will be used,
|
|
35
|
+
* considering all config layers (local, preferences, bundled).
|
|
36
|
+
*
|
|
37
|
+
* @param interactive Whether to show interactive prompts
|
|
38
|
+
* @param agentId Agent to check config for (default: 'coding-agent')
|
|
39
|
+
* @returns Whether to continue startup and what action was taken
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const result = await checkDextoAuthState(true, 'coding-agent');
|
|
44
|
+
* if (!result.shouldContinue) {
|
|
45
|
+
* if (result.action === 'login') {
|
|
46
|
+
* await handleLoginCommand();
|
|
47
|
+
* } else if (result.action === 'setup') {
|
|
48
|
+
* await handleSetupCommand();
|
|
49
|
+
* }
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export async function checkDextoAuthState(interactive = true, agentId = 'coding-agent') {
|
|
54
|
+
// Get the effective LLM config considering all layers
|
|
55
|
+
const effectiveLLM = await getEffectiveLLMConfig({ agentId });
|
|
56
|
+
// Not using dexto-nova provider - nothing to check
|
|
57
|
+
if (!effectiveLLM || effectiveLLM.provider !== 'dexto-nova') {
|
|
58
|
+
return { shouldContinue: true };
|
|
59
|
+
}
|
|
60
|
+
// Using dexto-nova provider - check if authenticated
|
|
61
|
+
const authenticated = await isAuthenticated();
|
|
62
|
+
if (authenticated) {
|
|
63
|
+
return { shouldContinue: true };
|
|
64
|
+
}
|
|
65
|
+
// User is configured for Dexto Nova credits but not logged in
|
|
66
|
+
if (!interactive) {
|
|
67
|
+
// Non-interactive mode - just show error and exit
|
|
68
|
+
console.log(chalk.red('\n❌ You are configured to use Dexto Nova credits but not logged in.\n'));
|
|
69
|
+
console.log(chalk.dim('Your preferences have provider: Dexto Nova (dexto-nova), but no active session.\n'));
|
|
70
|
+
console.log(chalk.bold('To fix this:'));
|
|
71
|
+
console.log(chalk.cyan(' • dexto login') + chalk.dim(' - Log back in to use Dexto Nova credits'));
|
|
72
|
+
console.log(chalk.cyan(' • dexto setup') + chalk.dim(' - Configure a different provider (BYOK)'));
|
|
73
|
+
console.log();
|
|
74
|
+
return { shouldContinue: false, action: 'cancel' };
|
|
75
|
+
}
|
|
76
|
+
// Interactive mode - prompt user
|
|
77
|
+
console.log(chalk.yellow('\n⚠️ Dexto Authentication Required\n'));
|
|
78
|
+
console.log(chalk.dim('You are configured to use Dexto Nova credits (provider: Dexto Nova)'));
|
|
79
|
+
console.log(chalk.dim('but you are not currently logged in.\n'));
|
|
80
|
+
const action = await p.select({
|
|
81
|
+
message: 'How would you like to proceed?',
|
|
82
|
+
options: [
|
|
83
|
+
{
|
|
84
|
+
value: 'login',
|
|
85
|
+
label: 'Log in to Dexto',
|
|
86
|
+
hint: 'Authenticate to use Dexto Nova credits',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
value: 'setup',
|
|
90
|
+
label: 'Configure a different provider',
|
|
91
|
+
hint: 'Set up your own API key (BYOK)',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
value: 'cancel',
|
|
95
|
+
label: 'Exit',
|
|
96
|
+
hint: 'Cancel and exit',
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
});
|
|
100
|
+
if (p.isCancel(action) || action === 'cancel') {
|
|
101
|
+
return { shouldContinue: false, action: 'cancel' };
|
|
102
|
+
}
|
|
103
|
+
return { shouldContinue: false, action };
|
|
104
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if user can use Dexto provider.
|
|
3
|
+
* Requires BOTH:
|
|
4
|
+
* 1. User is authenticated (valid auth token from dexto login)
|
|
5
|
+
* 2. Has DEXTO_API_KEY (from auth config or environment)
|
|
6
|
+
*/
|
|
7
|
+
export declare function canUseDextoProvider(): Promise<boolean>;
|
|
8
|
+
//# sourceMappingURL=dexto-setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dexto-setup.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/dexto-setup.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC,CAQ5D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// packages/cli/src/cli/utils/dexto-setup.ts
|
|
2
|
+
import { getDextoApiKey, isAuthenticated } from '../auth/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Check if user can use Dexto provider.
|
|
5
|
+
* Requires BOTH:
|
|
6
|
+
* 1. User is authenticated (valid auth token from dexto login)
|
|
7
|
+
* 2. Has DEXTO_API_KEY (from auth config or environment)
|
|
8
|
+
*/
|
|
9
|
+
export async function canUseDextoProvider() {
|
|
10
|
+
const authenticated = await isAuthenticated();
|
|
11
|
+
if (!authenticated)
|
|
12
|
+
return false;
|
|
13
|
+
const apiKey = await getDextoApiKey();
|
|
14
|
+
if (!apiKey)
|
|
15
|
+
return false;
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/options.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,CAoGlD;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAoB3D"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { getSupportedProviders } from '@dexto/core';
|
|
3
|
+
import { isDextoAuthEnabled } from '@dexto/agent-management';
|
|
3
4
|
import chalk from 'chalk';
|
|
4
5
|
/**
|
|
5
6
|
* Validates the command-line options.
|
|
@@ -7,7 +8,10 @@ import chalk from 'chalk';
|
|
|
7
8
|
* @throws {z.ZodError} If validation fails.
|
|
8
9
|
*/
|
|
9
10
|
export function validateCliOptions(opts) {
|
|
10
|
-
const
|
|
11
|
+
const allProviders = getSupportedProviders();
|
|
12
|
+
const supportedProviders = allProviders
|
|
13
|
+
.filter((p) => p !== 'dexto-nova' || isDextoAuthEnabled())
|
|
14
|
+
.map((p) => p.toLowerCase());
|
|
11
15
|
// Base schema for primitive shape
|
|
12
16
|
const cliOptionShape = z
|
|
13
17
|
.object({
|
|
@@ -21,6 +21,10 @@ interface ProviderOption {
|
|
|
21
21
|
/**
|
|
22
22
|
* Provider configuration registry
|
|
23
23
|
* Organized by category for better UX
|
|
24
|
+
*
|
|
25
|
+
* Note: dexto-nova is NOT included here - it's a transparent routing layer,
|
|
26
|
+
* not a user-selectable provider. When logged into Dexto, requests are
|
|
27
|
+
* automatically routed through the Dexto gateway.
|
|
24
28
|
*/
|
|
25
29
|
export declare const PROVIDER_REGISTRY: Partial<Record<LLMProvider, ProviderOption>>;
|
|
26
30
|
/**
|
|
@@ -31,7 +35,7 @@ export declare function selectProvider(): Promise<LLMProvider | '_back' | null>;
|
|
|
31
35
|
/**
|
|
32
36
|
* Get provider display name
|
|
33
37
|
*/
|
|
34
|
-
export declare function getProviderDisplayName(provider: LLMProvider): string;
|
|
38
|
+
export declare function getProviderDisplayName(provider: LLMProvider | string): string;
|
|
35
39
|
/**
|
|
36
40
|
* Get provider option info
|
|
37
41
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-setup.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/provider-setup.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,KAAK,WAAW,EAInB,MAAM,aAAa,CAAC;AAGrB;;GAEG;AACH,KAAK,gBAAgB,GAAG,aAAa,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,YAAY,CAAC;AAErF;;GAEG;AACH,UAAU,cAAc;IACpB,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAED
|
|
1
|
+
{"version":3,"file":"provider-setup.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/provider-setup.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,KAAK,WAAW,EAInB,MAAM,aAAa,CAAC;AAGrB;;GAEG;AACH,KAAK,gBAAgB,GAAG,aAAa,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,YAAY,CAAC;AAErF;;GAEG;AACH,UAAU,cAAc;IACpB,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,CA8I1E,CAAC;AA0FF;;;GAGG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,WAAW,GAAG,OAAO,GAAG,IAAI,CAAC,CAoB5E;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,CAM7E;AAMD;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,WAAW,GAAG,cAAc,GAAG,SAAS,CAEjF;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB;WAlHmB,WAAW;WAAS,MAAM;UAAQ,MAAM;GAkHlC,CAAC;AAEvD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAIxE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAChC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,WAAW,GACtB;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CA0BpC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,GAAG,OAAO,CAElF;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACnC,QAAQ,EAAE,WAAW,GACtB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAAG,IAAI,CAwBrE;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAU3E;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAEtE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,CAY7D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,CAE/D"}
|
|
@@ -7,6 +7,10 @@ import { getPrimaryApiKeyEnvVar } from '@dexto/agent-management';
|
|
|
7
7
|
/**
|
|
8
8
|
* Provider configuration registry
|
|
9
9
|
* Organized by category for better UX
|
|
10
|
+
*
|
|
11
|
+
* Note: dexto-nova is NOT included here - it's a transparent routing layer,
|
|
12
|
+
* not a user-selectable provider. When logged into Dexto, requests are
|
|
13
|
+
* automatically routed through the Dexto gateway.
|
|
10
14
|
*/
|
|
11
15
|
export const PROVIDER_REGISTRY = {
|
|
12
16
|
google: {
|
|
@@ -84,6 +88,22 @@ export const PROVIDER_REGISTRY = {
|
|
|
84
88
|
apiKeyUrl: 'https://dashboard.cohere.com/api-keys',
|
|
85
89
|
envVar: 'COHERE_API_KEY',
|
|
86
90
|
},
|
|
91
|
+
minimax: {
|
|
92
|
+
value: 'minimax',
|
|
93
|
+
label: 'MiniMax',
|
|
94
|
+
hint: 'M2.1 coding-focused models',
|
|
95
|
+
category: 'cloud',
|
|
96
|
+
apiKeyUrl: 'https://platform.minimax.io/docs/faq/about-apis',
|
|
97
|
+
envVar: 'MINIMAX_API_KEY',
|
|
98
|
+
},
|
|
99
|
+
glm: {
|
|
100
|
+
value: 'glm',
|
|
101
|
+
label: 'GLM (Zhipu)',
|
|
102
|
+
hint: 'GLM-4.7 series models',
|
|
103
|
+
category: 'cloud',
|
|
104
|
+
apiKeyUrl: 'https://open.bigmodel.cn/',
|
|
105
|
+
envVar: 'ZHIPU_API_KEY',
|
|
106
|
+
},
|
|
87
107
|
openrouter: {
|
|
88
108
|
value: 'openrouter',
|
|
89
109
|
label: 'OpenRouter',
|
|
@@ -239,7 +259,15 @@ export async function selectProvider() {
|
|
|
239
259
|
* Get provider display name
|
|
240
260
|
*/
|
|
241
261
|
export function getProviderDisplayName(provider) {
|
|
242
|
-
|
|
262
|
+
if (provider === 'dexto-nova')
|
|
263
|
+
return 'Dexto Nova';
|
|
264
|
+
if (isLLMProvider(provider)) {
|
|
265
|
+
return PROVIDER_REGISTRY[provider]?.label || provider;
|
|
266
|
+
}
|
|
267
|
+
return provider;
|
|
268
|
+
}
|
|
269
|
+
function isLLMProvider(value) {
|
|
270
|
+
return LLM_PROVIDERS.includes(value);
|
|
243
271
|
}
|
|
244
272
|
/**
|
|
245
273
|
* Get provider option info
|
|
@@ -2,13 +2,21 @@
|
|
|
2
2
|
* CLI-specific configuration types and utilities
|
|
3
3
|
* This file handles CLI argument processing and config merging logic
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Current behavior (Three-Layer LLM Resolution):
|
|
6
|
+
* Global preferences from preferences.yml are applied to ALL agents at runtime.
|
|
7
|
+
* See feature-plans/auto-update.md section 8.11 for the resolution order:
|
|
8
|
+
* 1. agent.local.yml llm section → Agent-specific override (NOT YET IMPLEMENTED)
|
|
9
|
+
* 2. preferences.yml llm section → User's global default (CURRENT)
|
|
10
|
+
* 3. agent.yml llm section → Bundled fallback
|
|
11
|
+
*
|
|
12
|
+
* Note: Sub-agents spawned via RuntimeService have separate LLM resolution logic
|
|
13
|
+
* that tries to preserve the sub-agent's intended model when possible.
|
|
14
|
+
* See packages/agent-management/src/tool-provider/llm-resolution.ts
|
|
15
|
+
*
|
|
16
|
+
* TODO: Future enhancements
|
|
17
|
+
* - Per-agent local overrides (~/.dexto/agents/{id}/{id}.local.yml)
|
|
9
18
|
* - Agent capability requirements (requires: { vision: true, toolUse: true })
|
|
10
|
-
* - Merge strategy configuration
|
|
11
|
-
* - User-controlled preference scopes via CLI flags (--prefer-global-llm)
|
|
19
|
+
* - Merge strategy configuration for non-LLM fields
|
|
12
20
|
*/
|
|
13
21
|
import type { AgentConfig, LLMConfig, LLMProvider } from '@dexto/core';
|
|
14
22
|
import type { GlobalPreferences } from '@dexto/agent-management';
|
|
@@ -33,15 +41,16 @@ export interface CLIConfigOverrides extends Partial<Pick<LLMConfig, 'provider' |
|
|
|
33
41
|
export declare function applyCLIOverrides(baseConfig: AgentConfig, cliOverrides?: CLIConfigOverrides): AgentConfig;
|
|
34
42
|
/**
|
|
35
43
|
* Applies global user preferences to an agent configuration at runtime.
|
|
36
|
-
* This is used
|
|
44
|
+
* This is used to ensure user's LLM preferences are applied to all agents.
|
|
37
45
|
*
|
|
38
46
|
* Unlike writeLLMPreferences() which modifies files, this performs an in-memory merge.
|
|
47
|
+
* User preferences fully override agent defaults for provider, model, and apiKey.
|
|
39
48
|
*
|
|
40
49
|
* @param baseConfig The configuration loaded from agent file
|
|
41
50
|
* @param preferences Global user preferences
|
|
42
51
|
* @returns Merged configuration with user preferences applied
|
|
43
52
|
*/
|
|
44
|
-
export declare function applyUserPreferences(baseConfig: AgentConfig, preferences: GlobalPreferences): AgentConfig;
|
|
53
|
+
export declare function applyUserPreferences(baseConfig: AgentConfig, preferences: Partial<GlobalPreferences>): AgentConfig;
|
|
45
54
|
/**
|
|
46
55
|
* Result of agent compatibility check
|
|
47
56
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-overrides.d.ts","sourceRoot":"","sources":["../../src/config/cli-overrides.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cli-overrides.d.ts","sourceRoot":"","sources":["../../src/config/cli-overrides.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE;;;GAGG;AACH,MAAM,WAAW,kBACb,SAAQ,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC,CAAC;IACjE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC7B,UAAU,EAAE,WAAW,EACvB,YAAY,CAAC,EAAE,kBAAkB,GAClC,WAAW,CAwCb;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAChC,UAAU,EAAE,WAAW,EACvB,WAAW,EAAE,OAAO,CAAC,iBAAiB,CAAC,GACxC,WAAW,CAwBb;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,EAAE,WAAW,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,WAAW,GAAG,SAAS,CAAC;IACtC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,aAAa,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACnC,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,iBAAiB,GAAG,IAAI,EACrC,cAAc,EAAE,MAAM,GAAG,SAAS,GACnC,wBAAwB,CAwC1B"}
|