dexto 1.5.5 → 1.5.7

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.
Files changed (234) hide show
  1. package/README.md +13 -0
  2. package/dist/agents/agent-template.yml +1 -1
  3. package/dist/agents/coding-agent/coding-agent.yml +17 -2
  4. package/dist/agents/coding-agent/skills/code-review.md +46 -0
  5. package/dist/agents/explore-agent/explore-agent.yml +2 -0
  6. package/dist/agents/podcast-agent/podcast-agent.yml +1 -1
  7. package/dist/analytics/events.d.ts +1 -1
  8. package/dist/analytics/events.d.ts.map +1 -1
  9. package/dist/api/server-hono.d.ts.map +1 -1
  10. package/dist/api/server-hono.js +55 -10
  11. package/dist/cli/assets/dexto-logo.svg +31 -0
  12. package/dist/cli/auth/api-client.d.ts +49 -0
  13. package/dist/cli/auth/api-client.d.ts.map +1 -0
  14. package/dist/cli/auth/api-client.js +127 -0
  15. package/dist/cli/auth/constants.d.ts +23 -0
  16. package/dist/cli/auth/constants.d.ts.map +1 -0
  17. package/dist/cli/auth/constants.js +24 -0
  18. package/dist/cli/auth/index.d.ts +5 -0
  19. package/dist/cli/auth/index.d.ts.map +1 -0
  20. package/dist/cli/auth/index.js +6 -0
  21. package/dist/cli/auth/oauth.d.ts +26 -0
  22. package/dist/cli/auth/oauth.d.ts.map +1 -0
  23. package/dist/cli/auth/oauth.js +327 -0
  24. package/dist/cli/auth/service.d.ts +20 -0
  25. package/dist/cli/auth/service.d.ts.map +1 -0
  26. package/dist/cli/auth/service.js +147 -0
  27. package/dist/cli/commands/auth/index.d.ts +4 -0
  28. package/dist/cli/commands/auth/index.d.ts.map +1 -0
  29. package/dist/cli/commands/auth/index.js +4 -0
  30. package/dist/cli/commands/auth/login.d.ts +9 -0
  31. package/dist/cli/commands/auth/login.d.ts.map +1 -0
  32. package/dist/cli/commands/auth/login.js +255 -0
  33. package/dist/cli/commands/auth/logout.d.ts +5 -0
  34. package/dist/cli/commands/auth/logout.d.ts.map +1 -0
  35. package/dist/cli/commands/auth/logout.js +51 -0
  36. package/dist/cli/commands/auth/status.d.ts +2 -0
  37. package/dist/cli/commands/auth/status.d.ts.map +1 -0
  38. package/dist/cli/commands/auth/status.js +22 -0
  39. package/dist/cli/commands/billing/index.d.ts +2 -0
  40. package/dist/cli/commands/billing/index.d.ts.map +1 -0
  41. package/dist/cli/commands/billing/index.js +2 -0
  42. package/dist/cli/commands/billing/status.d.ts +6 -0
  43. package/dist/cli/commands/billing/status.d.ts.map +1 -0
  44. package/dist/cli/commands/billing/status.js +60 -0
  45. package/dist/cli/commands/index.d.ts +4 -0
  46. package/dist/cli/commands/index.d.ts.map +1 -1
  47. package/dist/cli/commands/index.js +9 -0
  48. package/dist/cli/commands/interactive-commands/auth/index.d.ts +12 -0
  49. package/dist/cli/commands/interactive-commands/auth/index.d.ts.map +1 -0
  50. package/dist/cli/commands/interactive-commands/auth/index.js +20 -0
  51. package/dist/cli/commands/interactive-commands/command-parser.d.ts +5 -0
  52. package/dist/cli/commands/interactive-commands/command-parser.d.ts.map +1 -1
  53. package/dist/cli/commands/interactive-commands/command-parser.js +6 -0
  54. package/dist/cli/commands/interactive-commands/commands.d.ts +1 -0
  55. package/dist/cli/commands/interactive-commands/commands.d.ts.map +1 -1
  56. package/dist/cli/commands/interactive-commands/commands.js +10 -0
  57. package/dist/cli/commands/interactive-commands/export/index.d.ts +13 -0
  58. package/dist/cli/commands/interactive-commands/export/index.d.ts.map +1 -0
  59. package/dist/cli/commands/interactive-commands/export/index.js +21 -0
  60. package/dist/cli/commands/interactive-commands/general-commands.d.ts.map +1 -1
  61. package/dist/cli/commands/interactive-commands/general-commands.js +1 -0
  62. package/dist/cli/commands/interactive-commands/mcp/index.d.ts +2 -2
  63. package/dist/cli/commands/interactive-commands/mcp/index.d.ts.map +1 -1
  64. package/dist/cli/commands/interactive-commands/mcp/index.js +4 -7
  65. package/dist/cli/commands/interactive-commands/model/index.d.ts +2 -2
  66. package/dist/cli/commands/interactive-commands/model/index.d.ts.map +1 -1
  67. package/dist/cli/commands/interactive-commands/model/index.js +4 -7
  68. package/dist/cli/commands/interactive-commands/plugin/index.d.ts +13 -0
  69. package/dist/cli/commands/interactive-commands/plugin/index.d.ts.map +1 -0
  70. package/dist/cli/commands/interactive-commands/plugin/index.js +18 -0
  71. package/dist/cli/commands/interactive-commands/prompt-commands.d.ts +3 -1
  72. package/dist/cli/commands/interactive-commands/prompt-commands.d.ts.map +1 -1
  73. package/dist/cli/commands/interactive-commands/prompt-commands.js +72 -36
  74. package/dist/cli/commands/interactive-commands/system/system-commands.d.ts.map +1 -1
  75. package/dist/cli/commands/interactive-commands/system/system-commands.js +2 -3
  76. package/dist/cli/commands/plugin.d.ts +161 -0
  77. package/dist/cli/commands/plugin.d.ts.map +1 -0
  78. package/dist/cli/commands/plugin.js +376 -0
  79. package/dist/cli/commands/setup.d.ts +9 -9
  80. package/dist/cli/commands/setup.d.ts.map +1 -1
  81. package/dist/cli/commands/setup.js +325 -37
  82. package/dist/cli/commands/sync-agents.d.ts +44 -0
  83. package/dist/cli/commands/sync-agents.d.ts.map +1 -0
  84. package/dist/cli/commands/sync-agents.js +483 -0
  85. package/dist/cli/ink-cli/InkCLIRefactored.d.ts +14 -1
  86. package/dist/cli/ink-cli/InkCLIRefactored.d.ts.map +1 -1
  87. package/dist/cli/ink-cli/InkCLIRefactored.js +8 -2
  88. package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts +1 -1
  89. package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts.map +1 -1
  90. package/dist/cli/ink-cli/components/ApprovalPrompt.js +80 -12
  91. package/dist/cli/ink-cli/components/Footer.d.ts +2 -1
  92. package/dist/cli/ink-cli/components/Footer.d.ts.map +1 -1
  93. package/dist/cli/ink-cli/components/Footer.js +6 -2
  94. package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts.map +1 -1
  95. package/dist/cli/ink-cli/components/SlashCommandAutocomplete.js +15 -7
  96. package/dist/cli/ink-cli/components/StatusBar.d.ts +9 -1
  97. package/dist/cli/ink-cli/components/StatusBar.d.ts.map +1 -1
  98. package/dist/cli/ink-cli/components/StatusBar.js +17 -5
  99. package/dist/cli/ink-cli/components/TodoPanel.d.ts +11 -8
  100. package/dist/cli/ink-cli/components/TodoPanel.d.ts.map +1 -1
  101. package/dist/cli/ink-cli/components/TodoPanel.js +38 -36
  102. package/dist/cli/ink-cli/components/chat/Header.d.ts.map +1 -1
  103. package/dist/cli/ink-cli/components/chat/Header.js +1 -1
  104. package/dist/cli/ink-cli/components/chat/MessageItem.d.ts.map +1 -1
  105. package/dist/cli/ink-cli/components/chat/MessageItem.js +14 -1
  106. package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.js +1 -1
  107. package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts.map +1 -1
  108. package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.js +16 -4
  109. package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts.map +1 -1
  110. package/dist/cli/ink-cli/components/modes/StaticCLI.js +4 -1
  111. package/dist/cli/ink-cli/components/overlays/ExportWizard.d.ts +22 -0
  112. package/dist/cli/ink-cli/components/overlays/ExportWizard.d.ts.map +1 -0
  113. package/dist/cli/ink-cli/components/overlays/ExportWizard.js +308 -0
  114. package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts +1 -0
  115. package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts.map +1 -1
  116. package/dist/cli/ink-cli/components/overlays/LogLevelSelector.js +31 -20
  117. package/dist/cli/ink-cli/components/overlays/MarketplaceAddPrompt.d.ts +20 -0
  118. package/dist/cli/ink-cli/components/overlays/MarketplaceAddPrompt.d.ts.map +1 -0
  119. package/dist/cli/ink-cli/components/overlays/MarketplaceAddPrompt.js +81 -0
  120. package/dist/cli/ink-cli/components/overlays/MarketplaceBrowser.d.ts +31 -0
  121. package/dist/cli/ink-cli/components/overlays/MarketplaceBrowser.d.ts.map +1 -0
  122. package/dist/cli/ink-cli/components/overlays/MarketplaceBrowser.js +297 -0
  123. package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts.map +1 -1
  124. package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.js +7 -1
  125. package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts +1 -1
  126. package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts.map +1 -1
  127. package/dist/cli/ink-cli/components/overlays/McpServerActions.js +9 -0
  128. package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts.map +1 -1
  129. package/dist/cli/ink-cli/components/overlays/McpServerList.js +9 -2
  130. package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts.map +1 -1
  131. package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.js +15 -2
  132. package/dist/cli/ink-cli/components/overlays/PluginActions.d.ts +27 -0
  133. package/dist/cli/ink-cli/components/overlays/PluginActions.d.ts.map +1 -0
  134. package/dist/cli/ink-cli/components/overlays/PluginActions.js +66 -0
  135. package/dist/cli/ink-cli/components/overlays/PluginList.d.ts +21 -0
  136. package/dist/cli/ink-cli/components/overlays/PluginList.d.ts.map +1 -0
  137. package/dist/cli/ink-cli/components/overlays/PluginList.js +70 -0
  138. package/dist/cli/ink-cli/components/overlays/PluginManager.d.ts +21 -0
  139. package/dist/cli/ink-cli/components/overlays/PluginManager.d.ts.map +1 -0
  140. package/dist/cli/ink-cli/components/overlays/PluginManager.js +63 -0
  141. package/dist/cli/ink-cli/components/overlays/PromptList.d.ts.map +1 -1
  142. package/dist/cli/ink-cli/components/overlays/PromptList.js +4 -1
  143. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts +2 -1
  144. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts.map +1 -1
  145. package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.js +61 -2
  146. package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts +4 -2
  147. package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts.map +1 -1
  148. package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.js +4 -4
  149. package/dist/cli/ink-cli/constants/tips.js +2 -2
  150. package/dist/cli/ink-cli/containers/InputContainer.d.ts.map +1 -1
  151. package/dist/cli/ink-cli/containers/InputContainer.js +31 -3
  152. package/dist/cli/ink-cli/containers/OverlayContainer.d.ts.map +1 -1
  153. package/dist/cli/ink-cli/containers/OverlayContainer.js +260 -11
  154. package/dist/cli/ink-cli/hooks/index.d.ts +1 -0
  155. package/dist/cli/ink-cli/hooks/index.d.ts.map +1 -1
  156. package/dist/cli/ink-cli/hooks/index.js +1 -0
  157. package/dist/cli/ink-cli/hooks/useCLIState.d.ts.map +1 -1
  158. package/dist/cli/ink-cli/hooks/useCLIState.js +3 -0
  159. package/dist/cli/ink-cli/hooks/useGitBranch.d.ts +13 -0
  160. package/dist/cli/ink-cli/hooks/useGitBranch.d.ts.map +1 -0
  161. package/dist/cli/ink-cli/hooks/useGitBranch.js +35 -0
  162. package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts.map +1 -1
  163. package/dist/cli/ink-cli/hooks/useInputOrchestrator.js +50 -6
  164. package/dist/cli/ink-cli/services/processStream.d.ts.map +1 -1
  165. package/dist/cli/ink-cli/services/processStream.js +42 -10
  166. package/dist/cli/ink-cli/state/initialState.d.ts.map +1 -1
  167. package/dist/cli/ink-cli/state/initialState.js +3 -0
  168. package/dist/cli/ink-cli/state/types.d.ts +16 -1
  169. package/dist/cli/ink-cli/state/types.d.ts.map +1 -1
  170. package/dist/cli/ink-cli/utils/commandOverlays.d.ts.map +1 -1
  171. package/dist/cli/ink-cli/utils/commandOverlays.js +2 -0
  172. package/dist/cli/ink-cli/utils/messageFormatting.d.ts +14 -1
  173. package/dist/cli/ink-cli/utils/messageFormatting.d.ts.map +1 -1
  174. package/dist/cli/ink-cli/utils/messageFormatting.js +68 -8
  175. package/dist/cli/ink-cli/utils/toolUtils.d.ts +11 -0
  176. package/dist/cli/ink-cli/utils/toolUtils.d.ts.map +1 -1
  177. package/dist/cli/ink-cli/utils/toolUtils.js +17 -0
  178. package/dist/cli/mcp/index.d.ts +8 -0
  179. package/dist/cli/mcp/index.d.ts.map +1 -0
  180. package/dist/cli/mcp/index.js +7 -0
  181. package/dist/cli/mcp/oauth-factory.d.ts +6 -0
  182. package/dist/cli/mcp/oauth-factory.d.ts.map +1 -0
  183. package/dist/cli/mcp/oauth-factory.js +25 -0
  184. package/dist/cli/mcp/oauth-provider.d.ts +10 -0
  185. package/dist/cli/mcp/oauth-provider.d.ts.map +1 -0
  186. package/dist/cli/mcp/oauth-provider.js +77 -0
  187. package/dist/cli/mcp/oauth-redirect.d.ts +3 -0
  188. package/dist/cli/mcp/oauth-redirect.d.ts.map +1 -0
  189. package/dist/cli/mcp/oauth-redirect.js +4 -0
  190. package/dist/cli/mcp/oauth-server.d.ts +2 -0
  191. package/dist/cli/mcp/oauth-server.d.ts.map +1 -0
  192. package/dist/cli/mcp/oauth-server.js +70 -0
  193. package/dist/cli/mcp/oauth-store.d.ts +10 -0
  194. package/dist/cli/mcp/oauth-store.d.ts.map +1 -0
  195. package/dist/cli/mcp/oauth-store.js +27 -0
  196. package/dist/cli/mcp/oauth-ui.d.ts +2 -0
  197. package/dist/cli/mcp/oauth-ui.d.ts.map +1 -0
  198. package/dist/cli/mcp/oauth-ui.js +12 -0
  199. package/dist/cli/mcp/oauth-utils.d.ts +2 -0
  200. package/dist/cli/mcp/oauth-utils.d.ts.map +1 -0
  201. package/dist/cli/mcp/oauth-utils.js +17 -0
  202. package/dist/cli/utils/api-key-setup.d.ts.map +1 -1
  203. package/dist/cli/utils/api-key-setup.js +13 -90
  204. package/dist/cli/utils/api-key-verification.d.ts.map +1 -1
  205. package/dist/cli/utils/api-key-verification.js +36 -0
  206. package/dist/cli/utils/config-validation.d.ts +3 -1
  207. package/dist/cli/utils/config-validation.d.ts.map +1 -1
  208. package/dist/cli/utils/config-validation.js +42 -19
  209. package/dist/cli/utils/dexto-auth-check.d.ts +53 -0
  210. package/dist/cli/utils/dexto-auth-check.d.ts.map +1 -0
  211. package/dist/cli/utils/dexto-auth-check.js +104 -0
  212. package/dist/cli/utils/dexto-setup.d.ts +8 -0
  213. package/dist/cli/utils/dexto-setup.d.ts.map +1 -0
  214. package/dist/cli/utils/dexto-setup.js +17 -0
  215. package/dist/cli/utils/options.d.ts.map +1 -1
  216. package/dist/cli/utils/options.js +5 -1
  217. package/dist/cli/utils/provider-setup.d.ts +4 -0
  218. package/dist/cli/utils/provider-setup.d.ts.map +1 -1
  219. package/dist/cli/utils/provider-setup.js +20 -0
  220. package/dist/cli/utils/version-check.d.ts +45 -0
  221. package/dist/cli/utils/version-check.d.ts.map +1 -0
  222. package/dist/cli/utils/version-check.js +195 -0
  223. package/dist/config/cli-overrides.d.ts +17 -8
  224. package/dist/config/cli-overrides.d.ts.map +1 -1
  225. package/dist/config/cli-overrides.js +36 -22
  226. package/dist/config/effective-llm.d.ts +123 -0
  227. package/dist/config/effective-llm.d.ts.map +1 -0
  228. package/dist/config/effective-llm.js +171 -0
  229. package/dist/index.js +451 -126
  230. package/dist/webui/assets/index-C9JXwpvo.css +1 -0
  231. package/dist/webui/assets/{index-DVQWNLpT.js → index-Dl3mj53P.js} +217 -217
  232. package/dist/webui/index.html +2 -2
  233. package/package.json +9 -8
  234. package/dist/webui/assets/index-BglIVTSG.css +0 -1
@@ -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 credits are properly authenticated.
6
+ * This prevents the confusing state where user is logged out but still has
7
+ * Dexto 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`,
17
+ * their preferences.yml still points to Dexto. Without this check, the CLI
18
+ * would attempt to use Dexto 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 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 credits but is not authenticated.
32
+ * This can happen if user logged out after setting up with Dexto 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 provider - nothing to check
57
+ if (!effectiveLLM || effectiveLLM.provider !== 'dexto') {
58
+ return { shouldContinue: true };
59
+ }
60
+ // Using dexto provider - check if authenticated
61
+ const authenticated = await isAuthenticated();
62
+ if (authenticated) {
63
+ return { shouldContinue: true };
64
+ }
65
+ // User is configured for Dexto 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 credits but not logged in.\n'));
69
+ console.log(chalk.dim('Your preferences have provider: dexto, 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 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 credits (provider: dexto)'));
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 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":"AAIA;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,CAiGlD;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAoB3D"}
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 supportedProviders = getSupportedProviders().map((p) => p.toLowerCase());
11
+ const allProviders = getSupportedProviders();
12
+ const supportedProviders = allProviders
13
+ .filter((p) => p !== 'dexto' || 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 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
  /**
@@ -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;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,CA8H1E,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,CAEpE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,WAAW,GAAG,cAAc,GAAG,SAAS,CAEjF;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB;WA1GmB,WAAW;WAAS,MAAM;UAAQ,MAAM;GA0GlC,CAAC;AAEv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,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 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',
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Update info returned when a newer version is available
3
+ */
4
+ export interface UpdateInfo {
5
+ current: string;
6
+ latest: string;
7
+ updateCommand: string;
8
+ }
9
+ /**
10
+ * Check for updates (non-blocking, cached)
11
+ *
12
+ * @param currentVersion The current installed version
13
+ * @returns UpdateInfo if a newer version is available, null otherwise
14
+ *
15
+ * This function is designed to be called at CLI startup. It:
16
+ * - Respects DEXTO_NO_UPDATE_CHECK=true to disable checks
17
+ * - Uses a 24-hour cache to avoid hammering npm
18
+ * - Fails silently on network errors
19
+ * - Never blocks startup for more than 5 seconds
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * const updateInfo = await checkForUpdates('1.5.4');
24
+ * if (updateInfo) {
25
+ * displayUpdateNotification(updateInfo);
26
+ * }
27
+ * ```
28
+ */
29
+ export declare function checkForUpdates(currentVersion: string): Promise<UpdateInfo | null>;
30
+ /**
31
+ * Display update notification in a styled box
32
+ *
33
+ * @param updateInfo Update information to display
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * displayUpdateNotification({
38
+ * current: '1.5.4',
39
+ * latest: '1.6.0',
40
+ * updateCommand: 'npm i -g dexto'
41
+ * });
42
+ * ```
43
+ */
44
+ export declare function displayUpdateNotification(updateInfo: UpdateInfo): void;
45
+ //# sourceMappingURL=version-check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version-check.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/version-check.ts"],"names":[],"mappings":"AAkBA;;GAEG;AACH,MAAM,WAAW,UAAU;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACzB;AAqGD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CA+DxF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAatE"}
@@ -0,0 +1,195 @@
1
+ // packages/cli/src/cli/utils/version-check.ts
2
+ import { promises as fs } from 'fs';
3
+ import path from 'path';
4
+ import chalk from 'chalk';
5
+ import boxen from 'boxen';
6
+ import { logger } from '@dexto/core';
7
+ import { getDextoGlobalPath } from '@dexto/agent-management';
8
+ const CACHE_TTL_MS = 24 * 60 * 60 * 1000; // 24 hours
9
+ const NPM_REGISTRY_URL = 'https://registry.npmjs.org/dexto/latest';
10
+ const CACHE_FILE_PATH = getDextoGlobalPath('cache', 'version-check.json');
11
+ /**
12
+ * Compare two semver versions.
13
+ * Returns:
14
+ * - negative if v1 < v2
15
+ * - 0 if v1 === v2
16
+ * - positive if v1 > v2
17
+ *
18
+ * Note: Pre-release versions (e.g., 1.0.0-beta.1) are not fully supported.
19
+ * The comparison strips pre-release suffixes, so 1.0.0 and 1.0.0-beta.1
20
+ * would be considered equal. This is acceptable for update notifications
21
+ * since we don't publish pre-release versions to npm's latest tag.
22
+ */
23
+ function compareSemver(v1, v2) {
24
+ const parse = (v) => {
25
+ // Strip leading 'v' if present and split on '.'
26
+ const cleaned = v.replace(/^v/, '');
27
+ const parts = cleaned.split('.').map((p) => parseInt(p, 10) || 0);
28
+ // Pad to 3 parts
29
+ while (parts.length < 3)
30
+ parts.push(0);
31
+ return parts;
32
+ };
33
+ const p1 = parse(v1);
34
+ const p2 = parse(v2);
35
+ for (let i = 0; i < 3; i++) {
36
+ const v1Part = p1[i] ?? 0;
37
+ const v2Part = p2[i] ?? 0;
38
+ if (v1Part !== v2Part) {
39
+ return v1Part - v2Part;
40
+ }
41
+ }
42
+ return 0;
43
+ }
44
+ /**
45
+ * Load cached version info from disk
46
+ */
47
+ async function loadCache() {
48
+ try {
49
+ const content = await fs.readFile(CACHE_FILE_PATH, 'utf-8');
50
+ return JSON.parse(content);
51
+ }
52
+ catch {
53
+ return null;
54
+ }
55
+ }
56
+ /**
57
+ * Save version cache to disk
58
+ */
59
+ async function saveCache(cache) {
60
+ try {
61
+ await fs.mkdir(path.dirname(CACHE_FILE_PATH), { recursive: true });
62
+ await fs.writeFile(CACHE_FILE_PATH, JSON.stringify(cache, null, 2));
63
+ }
64
+ catch (error) {
65
+ // Non-critical - just log and continue
66
+ logger.debug(`Failed to save version cache: ${error instanceof Error ? error.message : String(error)}`);
67
+ }
68
+ }
69
+ /**
70
+ * Fetch latest version from npm registry
71
+ */
72
+ async function fetchLatestVersion() {
73
+ const controller = new AbortController();
74
+ const timeoutId = setTimeout(() => controller.abort(), 5000); // 5 second timeout
75
+ try {
76
+ const response = await fetch(NPM_REGISTRY_URL, {
77
+ signal: controller.signal,
78
+ headers: {
79
+ Accept: 'application/json',
80
+ },
81
+ });
82
+ if (!response.ok) {
83
+ logger.debug(`npm registry returned status ${response.status}`);
84
+ return null;
85
+ }
86
+ const data = (await response.json());
87
+ return data.version || null;
88
+ }
89
+ catch (error) {
90
+ // Network errors, timeouts, etc. - silent fail
91
+ logger.debug(`Failed to fetch latest version: ${error instanceof Error ? error.message : String(error)}`);
92
+ return null;
93
+ }
94
+ finally {
95
+ clearTimeout(timeoutId);
96
+ }
97
+ }
98
+ /**
99
+ * Check for updates (non-blocking, cached)
100
+ *
101
+ * @param currentVersion The current installed version
102
+ * @returns UpdateInfo if a newer version is available, null otherwise
103
+ *
104
+ * This function is designed to be called at CLI startup. It:
105
+ * - Respects DEXTO_NO_UPDATE_CHECK=true to disable checks
106
+ * - Uses a 24-hour cache to avoid hammering npm
107
+ * - Fails silently on network errors
108
+ * - Never blocks startup for more than 5 seconds
109
+ *
110
+ * @example
111
+ * ```typescript
112
+ * const updateInfo = await checkForUpdates('1.5.4');
113
+ * if (updateInfo) {
114
+ * displayUpdateNotification(updateInfo);
115
+ * }
116
+ * ```
117
+ */
118
+ export async function checkForUpdates(currentVersion) {
119
+ // Check if update checks are disabled
120
+ if (process.env.DEXTO_NO_UPDATE_CHECK === 'true') {
121
+ logger.debug('Version check disabled via DEXTO_NO_UPDATE_CHECK');
122
+ return null;
123
+ }
124
+ try {
125
+ const now = Date.now();
126
+ const cache = await loadCache();
127
+ // Check if cache is valid
128
+ if (cache && cache.currentVersion === currentVersion) {
129
+ const cacheAge = now - cache.lastCheck;
130
+ if (cacheAge < CACHE_TTL_MS) {
131
+ logger.debug(`Using cached version info (age: ${Math.round(cacheAge / 1000 / 60)} minutes)`);
132
+ // Return cached result if newer version exists
133
+ if (compareSemver(cache.latestVersion, currentVersion) > 0) {
134
+ return {
135
+ current: currentVersion,
136
+ latest: cache.latestVersion,
137
+ updateCommand: 'npm i -g dexto',
138
+ };
139
+ }
140
+ return null;
141
+ }
142
+ }
143
+ // Cache expired or invalid - fetch from npm
144
+ logger.debug('Fetching latest version from npm registry');
145
+ const latestVersion = await fetchLatestVersion();
146
+ if (!latestVersion) {
147
+ return null;
148
+ }
149
+ // Update cache
150
+ const newCache = {
151
+ lastCheck: now,
152
+ latestVersion,
153
+ currentVersion,
154
+ };
155
+ await saveCache(newCache);
156
+ // Check if update is available
157
+ if (compareSemver(latestVersion, currentVersion) > 0) {
158
+ return {
159
+ current: currentVersion,
160
+ latest: latestVersion,
161
+ updateCommand: 'npm i -g dexto',
162
+ };
163
+ }
164
+ return null;
165
+ }
166
+ catch (error) {
167
+ // Never fail the CLI startup due to version check errors
168
+ logger.debug(`Version check error: ${error instanceof Error ? error.message : String(error)}`);
169
+ return null;
170
+ }
171
+ }
172
+ /**
173
+ * Display update notification in a styled box
174
+ *
175
+ * @param updateInfo Update information to display
176
+ *
177
+ * @example
178
+ * ```typescript
179
+ * displayUpdateNotification({
180
+ * current: '1.5.4',
181
+ * latest: '1.6.0',
182
+ * updateCommand: 'npm i -g dexto'
183
+ * });
184
+ * ```
185
+ */
186
+ export function displayUpdateNotification(updateInfo) {
187
+ const message = `Update available: ${chalk.gray(updateInfo.current)} ${chalk.gray('→')} ${chalk.green(updateInfo.latest)}\n` +
188
+ `Run: ${chalk.cyan(updateInfo.updateCommand)}`;
189
+ console.log(boxen(message, {
190
+ padding: 1,
191
+ margin: { top: 1, bottom: 1, left: 0, right: 0 },
192
+ borderColor: 'yellow',
193
+ borderStyle: 'round',
194
+ }));
195
+ }
@@ -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
- * 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)
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 (global > agent, agent > global, field-specific)
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 for the coding-agent to ensure user's LLM preferences are applied.
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;;;;;;;;;;;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;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;;;;;;;;;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,EA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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"}
@@ -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
- * 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)
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 (global > agent, agent > global, field-specific)
11
- * - User-controlled preference scopes via CLI flags (--prefer-global-llm)
19
+ * - Merge strategy configuration for non-LLM fields
12
20
  */
13
21
  /**
14
22
  * Applies CLI overrides to an agent configuration
@@ -59,9 +67,10 @@ export function applyCLIOverrides(baseConfig, cliOverrides) {
59
67
  }
60
68
  /**
61
69
  * Applies global user preferences to an agent configuration at runtime.
62
- * This is used for the coding-agent to ensure user's LLM preferences are applied.
70
+ * This is used to ensure user's LLM preferences are applied to all agents.
63
71
  *
64
72
  * Unlike writeLLMPreferences() which modifies files, this performs an in-memory merge.
73
+ * User preferences fully override agent defaults for provider, model, and apiKey.
65
74
  *
66
75
  * @param baseConfig The configuration loaded from agent file
67
76
  * @param preferences Global user preferences
@@ -70,21 +79,22 @@ export function applyCLIOverrides(baseConfig, cliOverrides) {
70
79
  export function applyUserPreferences(baseConfig, preferences) {
71
80
  // Create a deep copy to avoid mutating the original
72
81
  const mergedConfig = JSON.parse(JSON.stringify(baseConfig));
73
- // Apply LLM preferences (user preferences override agent defaults)
74
- if (preferences.llm) {
75
- mergedConfig.llm = {
76
- ...mergedConfig.llm,
77
- provider: preferences.llm.provider,
78
- model: preferences.llm.model,
79
- };
80
- // Only override apiKey if user has one configured
81
- if (preferences.llm.apiKey) {
82
- mergedConfig.llm.apiKey = preferences.llm.apiKey;
83
- }
84
- // Only override baseURL if user has one configured
85
- if (preferences.llm.baseURL) {
86
- mergedConfig.llm.baseURL = preferences.llm.baseURL;
87
- }
82
+ // No LLM preferences to apply
83
+ if (!preferences.llm) {
84
+ return mergedConfig;
85
+ }
86
+ // Apply user preferences - only override if defined (preferences is Partial)
87
+ if (preferences.llm.provider) {
88
+ mergedConfig.llm.provider = preferences.llm.provider;
89
+ }
90
+ if (preferences.llm.model) {
91
+ mergedConfig.llm.model = preferences.llm.model;
92
+ }
93
+ if (preferences.llm.apiKey) {
94
+ mergedConfig.llm.apiKey = preferences.llm.apiKey;
95
+ }
96
+ if (preferences.llm.baseURL) {
97
+ mergedConfig.llm.baseURL = preferences.llm.baseURL;
88
98
  }
89
99
  return mergedConfig;
90
100
  }
@@ -140,6 +150,8 @@ function getEnvVarForProvider(provider) {
140
150
  groq: 'GROQ_API_KEY',
141
151
  xai: 'XAI_API_KEY',
142
152
  cohere: 'COHERE_API_KEY',
153
+ minimax: 'MINIMAX_API_KEY',
154
+ glm: 'ZHIPU_API_KEY',
143
155
  openrouter: 'OPENROUTER_API_KEY',
144
156
  litellm: 'LITELLM_API_KEY',
145
157
  glama: 'GLAMA_API_KEY',
@@ -148,6 +160,8 @@ function getEnvVarForProvider(provider) {
148
160
  // Local providers don't require API keys (empty string signals no key needed)
149
161
  local: '',
150
162
  ollama: '',
163
+ // Dexto gateway uses DEXTO_API_KEY from `dexto login`
164
+ dexto: 'DEXTO_API_KEY',
151
165
  };
152
166
  return envVarMap[provider];
153
167
  }