dexto 1.4.0 → 1.5.0
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 +62 -7
- package/dist/agents/agent-template.yml +2 -2
- package/dist/agents/coding-agent/coding-agent.yml +22 -16
- package/dist/agents/database-agent/database-agent.yml +2 -2
- package/dist/agents/default-agent.yml +7 -5
- package/dist/agents/github-agent/github-agent.yml +2 -2
- package/dist/agents/product-name-researcher/product-name-researcher.yml +2 -2
- package/dist/agents/talk2pdf-agent/talk2pdf-agent.yml +2 -2
- package/dist/analytics/events.d.ts +13 -6
- package/dist/analytics/events.d.ts.map +1 -1
- package/dist/analytics/index.d.ts +1 -1
- package/dist/analytics/index.d.ts.map +1 -1
- package/dist/analytics/index.js +6 -2
- package/dist/api/server-hono.d.ts.map +1 -1
- package/dist/api/server-hono.js +27 -5
- package/dist/cli/cli-subscriber.d.ts +4 -0
- package/dist/cli/cli-subscriber.d.ts.map +1 -1
- package/dist/cli/cli-subscriber.js +40 -2
- package/dist/cli/commands/create-app.d.ts +16 -14
- package/dist/cli/commands/create-app.d.ts.map +1 -1
- package/dist/cli/commands/create-app.js +626 -102
- package/dist/cli/commands/create-image.d.ts +7 -0
- package/dist/cli/commands/create-image.d.ts.map +1 -0
- package/dist/cli/commands/create-image.js +201 -0
- package/dist/cli/commands/helpers/formatters.js +7 -7
- package/dist/cli/commands/index.d.ts +2 -1
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +2 -1
- package/dist/cli/commands/init-app.js +7 -7
- package/dist/cli/commands/install.d.ts +0 -3
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +10 -35
- package/dist/cli/commands/interactive-commands/command-parser.js +7 -7
- package/dist/cli/commands/interactive-commands/general-commands.js +1 -1
- package/dist/cli/commands/interactive-commands/prompt-commands.js +11 -11
- package/dist/cli/commands/interactive-commands/system/system-commands.js +3 -3
- package/dist/cli/commands/list-agents.js +2 -2
- package/dist/cli/commands/session-commands.js +16 -16
- package/dist/cli/commands/setup.d.ts +13 -5
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +860 -65
- package/dist/cli/commands/which.js +1 -1
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts +2 -0
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ApprovalPrompt.js +29 -7
- package/dist/cli/ink-cli/components/CustomInput.js +1 -1
- package/dist/cli/ink-cli/components/EditableMultiLineInput.js +4 -4
- package/dist/cli/ink-cli/components/ElicitationForm.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ElicitationForm.js +6 -6
- package/dist/cli/ink-cli/components/ErrorBoundary.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ErrorBoundary.js +1 -1
- package/dist/cli/ink-cli/components/Footer.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/Footer.js +1 -1
- package/dist/cli/ink-cli/components/HistorySearchBar.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/HistorySearchBar.js +1 -1
- package/dist/cli/ink-cli/components/MultiLineInput.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/MultiLineInput.js +3 -3
- package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ResourceAutocomplete.js +4 -4
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.js +3 -3
- package/dist/cli/ink-cli/components/StatusBar.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/StatusBar.js +7 -5
- package/dist/cli/ink-cli/components/TextBufferInput.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/TextBufferInput.js +6 -6
- package/dist/cli/ink-cli/components/base/BaseAutocomplete.js +4 -4
- package/dist/cli/ink-cli/components/base/BaseSelector.js +2 -2
- package/dist/cli/ink-cli/components/chat/Footer.js +1 -1
- package/dist/cli/ink-cli/components/chat/Header.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/Header.js +2 -4
- package/dist/cli/ink-cli/components/chat/MessageItem.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/MessageItem.js +5 -5
- package/dist/cli/ink-cli/components/chat/MessageList.js +1 -1
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.js +1 -1
- package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts +1 -1
- package/dist/cli/ink-cli/components/chat/ToolIcon.js +4 -4
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.js +1 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.js +1 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.js +2 -2
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.js +5 -5
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.js +2 -2
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.js +1 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.js +1 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.js +2 -2
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.js +1 -1
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/modes/StaticCLI.js +1 -1
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.js +1 -1
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts +10 -2
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.js +198 -89
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.js +2 -2
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.js +1 -1
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.js +1 -1
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.js +2 -2
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.js +1 -1
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.js +1 -1
- package/dist/cli/ink-cli/components/overlays/McpSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/McpSelector.js +1 -1
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/McpServerActions.js +2 -2
- package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/McpServerList.js +1 -1
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts +5 -5
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.js +222 -68
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.js +2 -2
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.js +1 -1
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.js +2 -2
- package/dist/cli/ink-cli/components/overlays/PromptList.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/PromptList.js +2 -2
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.js +4 -4
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.js +1 -1
- package/dist/cli/ink-cli/components/overlays/StreamSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/StreamSelector.js +1 -1
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.js +12 -12
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.d.ts +25 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.js +609 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.d.ts +15 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.js +14 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts +33 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.js +419 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.d.ts +25 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.js +29 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.d.ts +17 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.js +11 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.d.ts +20 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.js +10 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.d.ts +30 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.js +13 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.d.ts +8 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.js +7 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.d.ts +79 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.js +38 -0
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.js +2 -2
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.js +1 -1
- package/dist/cli/ink-cli/components/renderers/FileRenderer.js +4 -4
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.js +2 -2
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.js +1 -1
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.js +3 -3
- package/dist/cli/ink-cli/components/renderers/diff-shared.js +1 -1
- package/dist/cli/ink-cli/components/shared/MarkdownText.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/shared/MarkdownText.js +8 -6
- package/dist/cli/ink-cli/containers/InputContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/InputContainer.js +23 -1
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/OverlayContainer.js +80 -24
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts +1 -1
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useAgentEvents.js +5 -1
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts +1 -1
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useCLIState.js +4 -2
- package/dist/cli/ink-cli/services/processStream.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/processStream.js +77 -9
- package/dist/cli/ink-cli/state/types.d.ts +3 -2
- package/dist/cli/ink-cli/state/types.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts +5 -0
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/messageFormatting.js +59 -1
- package/dist/cli/ink-cli/utils/toolUtils.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/toolUtils.js +2 -0
- package/dist/cli/utils/api-key-setup.d.ts +54 -4
- package/dist/cli/utils/api-key-setup.d.ts.map +1 -1
- package/dist/cli/utils/api-key-setup.js +433 -107
- package/dist/cli/utils/api-key-verification.d.ts +17 -0
- package/dist/cli/utils/api-key-verification.d.ts.map +1 -0
- package/dist/cli/utils/api-key-verification.js +211 -0
- package/dist/cli/utils/config-validation.d.ts +22 -2
- package/dist/cli/utils/config-validation.d.ts.map +1 -1
- package/dist/cli/utils/config-validation.js +354 -25
- package/dist/cli/utils/local-model-setup.d.ts +46 -0
- package/dist/cli/utils/local-model-setup.d.ts.map +1 -0
- package/dist/cli/utils/local-model-setup.js +662 -0
- package/dist/cli/utils/options.js +1 -1
- package/dist/cli/utils/prompt-helpers.d.ts +47 -0
- package/dist/cli/utils/prompt-helpers.d.ts.map +1 -0
- package/dist/cli/utils/prompt-helpers.js +66 -0
- package/dist/cli/utils/provider-setup.d.ts +66 -8
- package/dist/cli/utils/provider-setup.d.ts.map +1 -1
- package/dist/cli/utils/provider-setup.js +324 -84
- package/dist/cli/utils/scaffolding-utils.d.ts +76 -0
- package/dist/cli/utils/scaffolding-utils.d.ts.map +1 -0
- package/dist/cli/utils/scaffolding-utils.js +246 -0
- package/dist/cli/utils/setup-utils.d.ts +16 -0
- package/dist/cli/utils/setup-utils.d.ts.map +1 -1
- package/dist/cli/utils/setup-utils.js +72 -21
- package/dist/cli/utils/template-engine.d.ts +65 -0
- package/dist/cli/utils/template-engine.d.ts.map +1 -0
- package/dist/cli/utils/template-engine.js +1089 -0
- package/dist/config/cli-overrides.d.ts +44 -1
- package/dist/config/cli-overrides.d.ts.map +1 -1
- package/dist/config/cli-overrides.js +102 -0
- package/dist/index.js +315 -53
- package/dist/webui/assets/index-8j-KMkX1.js +2054 -0
- package/dist/webui/assets/index-c_AX24V4.css +1 -0
- package/dist/webui/index.html +3 -9
- package/dist/webui/logos/aws-color.svg +1 -0
- package/dist/webui/logos/dexto/dexto_logo.svg +1 -1
- package/dist/webui/logos/dexto/dexto_logo_light.svg +6 -6
- package/dist/webui/logos/glama.svg +7 -0
- package/dist/webui/logos/litellm.svg +7 -0
- package/dist/webui/logos/openrouter.svg +1 -0
- package/package.json +8 -7
- package/dist/webui/assets/index-BkwPkZpd.css +0 -1
- package/dist/webui/assets/index-D9u1XfyH.js +0 -2025
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CLI-specific configuration types and utilities
|
|
3
3
|
* This file handles CLI argument processing and config merging logic
|
|
4
|
+
*
|
|
5
|
+
* TODO: Future preference system enhancement
|
|
6
|
+
* Currently, global preferences are only applied to the coding-agent at runtime.
|
|
7
|
+
* Future improvements could include:
|
|
8
|
+
* - Per-agent preference overrides (~/.dexto/agents/{id}/preferences.yml)
|
|
9
|
+
* - Agent capability requirements (requires: { vision: true, toolUse: true })
|
|
10
|
+
* - Merge strategy configuration (global > agent, agent > global, field-specific)
|
|
11
|
+
* - User-controlled preference scopes via CLI flags (--prefer-global-llm)
|
|
4
12
|
*/
|
|
5
|
-
import type { AgentConfig, LLMConfig } from '@dexto/core';
|
|
13
|
+
import type { AgentConfig, LLMConfig, LLMProvider } from '@dexto/core';
|
|
14
|
+
import type { GlobalPreferences } from '@dexto/agent-management';
|
|
6
15
|
/**
|
|
7
16
|
* CLI config override type for fields that can be overridden via CLI
|
|
8
17
|
* Uses input type (LLMConfig) since these represent user-provided CLI arguments
|
|
@@ -20,4 +29,38 @@ export interface CLIConfigOverrides extends Partial<Pick<LLMConfig, 'provider' |
|
|
|
20
29
|
* @returns Merged configuration (unvalidated)
|
|
21
30
|
*/
|
|
22
31
|
export declare function applyCLIOverrides(baseConfig: AgentConfig, cliOverrides?: CLIConfigOverrides): AgentConfig;
|
|
32
|
+
/**
|
|
33
|
+
* Applies global user preferences to an agent configuration at runtime.
|
|
34
|
+
* This is used for the coding-agent to ensure user's LLM preferences are applied.
|
|
35
|
+
*
|
|
36
|
+
* Unlike writeLLMPreferences() which modifies files, this performs an in-memory merge.
|
|
37
|
+
*
|
|
38
|
+
* @param baseConfig The configuration loaded from agent file
|
|
39
|
+
* @param preferences Global user preferences
|
|
40
|
+
* @returns Merged configuration with user preferences applied
|
|
41
|
+
*/
|
|
42
|
+
export declare function applyUserPreferences(baseConfig: AgentConfig, preferences: GlobalPreferences): AgentConfig;
|
|
43
|
+
/**
|
|
44
|
+
* Result of agent compatibility check
|
|
45
|
+
*/
|
|
46
|
+
export interface AgentCompatibilityResult {
|
|
47
|
+
compatible: boolean;
|
|
48
|
+
warnings: string[];
|
|
49
|
+
instructions: string[];
|
|
50
|
+
agentProvider: LLMProvider;
|
|
51
|
+
agentModel: string;
|
|
52
|
+
userProvider: LLMProvider | undefined;
|
|
53
|
+
userModel: string | undefined;
|
|
54
|
+
userHasApiKey: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Check if user's current setup is compatible with an agent's requirements.
|
|
58
|
+
* Used when switching to non-default agents to warn users about potential issues.
|
|
59
|
+
*
|
|
60
|
+
* @param agentConfig The agent's configuration
|
|
61
|
+
* @param preferences User's global preferences (if available)
|
|
62
|
+
* @param resolvedApiKey Whether user has a valid API key for the agent's provider
|
|
63
|
+
* @returns Compatibility result with warnings and instructions
|
|
64
|
+
*/
|
|
65
|
+
export declare function checkAgentCompatibility(agentConfig: AgentConfig, preferences: GlobalPreferences | null, resolvedApiKey: string | undefined): AgentCompatibilityResult;
|
|
23
66
|
//# sourceMappingURL=cli-overrides.d.ts.map
|
|
@@ -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;;;;;;;;;;;GAWG;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;CACzB;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC7B,UAAU,EAAE,WAAW,EACvB,YAAY,CAAC,EAAE,kBAAkB,GAClC,WAAW,CA+Bb;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAChC,UAAU,EAAE,WAAW,EACvB,WAAW,EAAE,iBAAiB,GAC/B,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"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CLI-specific configuration types and utilities
|
|
3
3
|
* This file handles CLI argument processing and config merging logic
|
|
4
|
+
*
|
|
5
|
+
* TODO: Future preference system enhancement
|
|
6
|
+
* Currently, global preferences are only applied to the coding-agent at runtime.
|
|
7
|
+
* Future improvements could include:
|
|
8
|
+
* - Per-agent preference overrides (~/.dexto/agents/{id}/preferences.yml)
|
|
9
|
+
* - Agent capability requirements (requires: { vision: true, toolUse: true })
|
|
10
|
+
* - Merge strategy configuration (global > agent, agent > global, field-specific)
|
|
11
|
+
* - User-controlled preference scopes via CLI flags (--prefer-global-llm)
|
|
4
12
|
*/
|
|
5
13
|
/**
|
|
6
14
|
* Applies CLI overrides to an agent configuration
|
|
@@ -40,3 +48,97 @@ export function applyCLIOverrides(baseConfig, cliOverrides) {
|
|
|
40
48
|
// Return merged config without validation - validation happens later
|
|
41
49
|
return mergedConfig;
|
|
42
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Applies global user preferences to an agent configuration at runtime.
|
|
53
|
+
* This is used for the coding-agent to ensure user's LLM preferences are applied.
|
|
54
|
+
*
|
|
55
|
+
* Unlike writeLLMPreferences() which modifies files, this performs an in-memory merge.
|
|
56
|
+
*
|
|
57
|
+
* @param baseConfig The configuration loaded from agent file
|
|
58
|
+
* @param preferences Global user preferences
|
|
59
|
+
* @returns Merged configuration with user preferences applied
|
|
60
|
+
*/
|
|
61
|
+
export function applyUserPreferences(baseConfig, preferences) {
|
|
62
|
+
// Create a deep copy to avoid mutating the original
|
|
63
|
+
const mergedConfig = JSON.parse(JSON.stringify(baseConfig));
|
|
64
|
+
// Apply LLM preferences (user preferences override agent defaults)
|
|
65
|
+
if (preferences.llm) {
|
|
66
|
+
mergedConfig.llm = {
|
|
67
|
+
...mergedConfig.llm,
|
|
68
|
+
provider: preferences.llm.provider,
|
|
69
|
+
model: preferences.llm.model,
|
|
70
|
+
};
|
|
71
|
+
// Only override apiKey if user has one configured
|
|
72
|
+
if (preferences.llm.apiKey) {
|
|
73
|
+
mergedConfig.llm.apiKey = preferences.llm.apiKey;
|
|
74
|
+
}
|
|
75
|
+
// Only override baseURL if user has one configured
|
|
76
|
+
if (preferences.llm.baseURL) {
|
|
77
|
+
mergedConfig.llm.baseURL = preferences.llm.baseURL;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return mergedConfig;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Check if user's current setup is compatible with an agent's requirements.
|
|
84
|
+
* Used when switching to non-default agents to warn users about potential issues.
|
|
85
|
+
*
|
|
86
|
+
* @param agentConfig The agent's configuration
|
|
87
|
+
* @param preferences User's global preferences (if available)
|
|
88
|
+
* @param resolvedApiKey Whether user has a valid API key for the agent's provider
|
|
89
|
+
* @returns Compatibility result with warnings and instructions
|
|
90
|
+
*/
|
|
91
|
+
export function checkAgentCompatibility(agentConfig, preferences, resolvedApiKey) {
|
|
92
|
+
const warnings = [];
|
|
93
|
+
const instructions = [];
|
|
94
|
+
const agentProvider = agentConfig.llm.provider;
|
|
95
|
+
const agentModel = agentConfig.llm.model;
|
|
96
|
+
const userProvider = preferences?.llm?.provider;
|
|
97
|
+
const userModel = preferences?.llm?.model;
|
|
98
|
+
const userHasApiKey = Boolean(resolvedApiKey);
|
|
99
|
+
// Check if user has API key for this agent's provider
|
|
100
|
+
if (!userHasApiKey) {
|
|
101
|
+
warnings.push(`This agent uses ${agentProvider} but you don't have an API key configured for it.`);
|
|
102
|
+
instructions.push(`Run: dexto setup --provider ${agentProvider}`);
|
|
103
|
+
}
|
|
104
|
+
// Check if agent uses a different provider than user's default
|
|
105
|
+
// Only show this as a warning if API key is missing; otherwise just informational
|
|
106
|
+
if (userProvider && agentProvider !== userProvider && !userHasApiKey) {
|
|
107
|
+
const userDefault = userModel ? `${userProvider}/${userModel}` : userProvider;
|
|
108
|
+
warnings.push(`This agent uses ${agentProvider}/${agentModel} (your default is ${userDefault}).`);
|
|
109
|
+
instructions.push(`Make sure you have ${getEnvVarForProvider(agentProvider)} set in your environment.`);
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
compatible: warnings.length === 0,
|
|
113
|
+
warnings,
|
|
114
|
+
instructions,
|
|
115
|
+
agentProvider,
|
|
116
|
+
agentModel,
|
|
117
|
+
userProvider,
|
|
118
|
+
userModel,
|
|
119
|
+
userHasApiKey,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Get the environment variable name for a provider's API key
|
|
124
|
+
*/
|
|
125
|
+
function getEnvVarForProvider(provider) {
|
|
126
|
+
const envVarMap = {
|
|
127
|
+
openai: 'OPENAI_API_KEY',
|
|
128
|
+
'openai-compatible': 'OPENAI_API_KEY',
|
|
129
|
+
anthropic: 'ANTHROPIC_API_KEY',
|
|
130
|
+
google: 'GOOGLE_GENERATIVE_AI_API_KEY',
|
|
131
|
+
groq: 'GROQ_API_KEY',
|
|
132
|
+
xai: 'XAI_API_KEY',
|
|
133
|
+
cohere: 'COHERE_API_KEY',
|
|
134
|
+
openrouter: 'OPENROUTER_API_KEY',
|
|
135
|
+
litellm: 'LITELLM_API_KEY',
|
|
136
|
+
glama: 'GLAMA_API_KEY',
|
|
137
|
+
vertex: 'GOOGLE_APPLICATION_CREDENTIALS',
|
|
138
|
+
bedrock: 'AWS_ACCESS_KEY_ID',
|
|
139
|
+
// Local providers don't require API keys (empty string signals no key needed)
|
|
140
|
+
local: '',
|
|
141
|
+
ollama: '',
|
|
142
|
+
};
|
|
143
|
+
return envVarMap[provider];
|
|
144
|
+
}
|