dexto 1.5.8 → 1.6.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.
Files changed (127) hide show
  1. package/README.md +3 -3
  2. package/dist/agents/agent-template.yml +2 -2
  3. package/dist/agents/coding-agent/README.md +10 -10
  4. package/dist/agents/coding-agent/coding-agent.yml +81 -82
  5. package/dist/agents/default-agent.yml +32 -47
  6. package/dist/agents/explore-agent/explore-agent.yml +3 -6
  7. package/dist/agents/image-editor-agent/image-editor-agent.yml +1 -1
  8. package/dist/agents/nano-banana-agent/nano-banana-agent.yml +1 -1
  9. package/dist/agents/podcast-agent/podcast-agent.yml +1 -1
  10. package/dist/agents/product-name-researcher/product-name-researcher.yml +1 -1
  11. package/dist/agents/sora-video-agent/sora-video-agent.yml +4 -6
  12. package/dist/agents/triage-demo/triage-agent.yml +1 -1
  13. package/dist/analytics/events.d.ts +1 -1
  14. package/dist/analytics/events.d.ts.map +1 -1
  15. package/dist/api/mcp/tool-aggregation-handler.d.ts +2 -2
  16. package/dist/api/server-hono.d.ts +2 -2
  17. package/dist/api/server-hono.d.ts.map +1 -1
  18. package/dist/api/server-hono.js +37 -60
  19. package/dist/cli/approval/cli-approval-handler.d.ts +10 -3
  20. package/dist/cli/approval/cli-approval-handler.d.ts.map +1 -1
  21. package/dist/cli/approval/cli-approval-handler.js +1 -1
  22. package/dist/cli/commands/create-app.d.ts +1 -11
  23. package/dist/cli/commands/create-app.d.ts.map +1 -1
  24. package/dist/cli/commands/create-app.js +21 -545
  25. package/dist/cli/commands/create-image.d.ts.map +1 -1
  26. package/dist/cli/commands/create-image.js +54 -53
  27. package/dist/cli/commands/image.d.ts +52 -0
  28. package/dist/cli/commands/image.d.ts.map +1 -0
  29. package/dist/cli/commands/image.js +118 -0
  30. package/dist/cli/commands/index.d.ts +2 -1
  31. package/dist/cli/commands/index.d.ts.map +1 -1
  32. package/dist/cli/commands/index.js +3 -1
  33. package/dist/cli/commands/init-app.d.ts +4 -8
  34. package/dist/cli/commands/init-app.d.ts.map +1 -1
  35. package/dist/cli/commands/init-app.js +37 -161
  36. package/dist/cli/commands/interactive-commands/command-parser.d.ts +2 -0
  37. package/dist/cli/commands/interactive-commands/command-parser.d.ts.map +1 -1
  38. package/dist/cli/commands/interactive-commands/commands.d.ts +1 -1
  39. package/dist/cli/commands/interactive-commands/commands.d.ts.map +1 -1
  40. package/dist/cli/commands/interactive-commands/commands.js +2 -2
  41. package/dist/cli/commands/interactive-commands/general-commands.js +2 -2
  42. package/dist/cli/commands/interactive-commands/prompt-commands.d.ts.map +1 -1
  43. package/dist/cli/commands/interactive-commands/prompt-commands.js +2 -7
  44. package/dist/cli/commands/interactive-commands/session/index.d.ts +2 -1
  45. package/dist/cli/commands/interactive-commands/session/index.d.ts.map +1 -1
  46. package/dist/cli/commands/interactive-commands/session/index.js +2 -1
  47. package/dist/cli/commands/interactive-commands/session/session-commands.d.ts +2 -2
  48. package/dist/cli/commands/interactive-commands/session/session-commands.js +2 -2
  49. package/dist/cli/commands/interactive-commands/system/system-commands.d.ts.map +1 -1
  50. package/dist/cli/commands/interactive-commands/system/system-commands.js +7 -29
  51. package/dist/cli/commands/plugin.d.ts +4 -4
  52. package/dist/cli/commands/sync-agents.d.ts +2 -12
  53. package/dist/cli/commands/sync-agents.d.ts.map +1 -1
  54. package/dist/cli/commands/sync-agents.js +2 -50
  55. package/dist/cli/ink-cli/InkCLIRefactored.d.ts +7 -1
  56. package/dist/cli/ink-cli/InkCLIRefactored.d.ts.map +1 -1
  57. package/dist/cli/ink-cli/InkCLIRefactored.js +6 -6
  58. package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts +2 -2
  59. package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts.map +1 -1
  60. package/dist/cli/ink-cli/components/ApprovalPrompt.js +15 -14
  61. package/dist/cli/ink-cli/components/BackgroundTasksPanel.js +1 -1
  62. package/dist/cli/ink-cli/components/Footer.d.ts.map +1 -1
  63. package/dist/cli/ink-cli/components/Footer.js +1 -2
  64. package/dist/cli/ink-cli/components/StatusBar.d.ts.map +1 -1
  65. package/dist/cli/ink-cli/components/StatusBar.js +10 -6
  66. package/dist/cli/ink-cli/components/TodoPanel.js +1 -1
  67. package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.js +1 -1
  68. package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts +3 -1
  69. package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts.map +1 -1
  70. package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.js +2 -2
  71. package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts +3 -1
  72. package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts.map +1 -1
  73. package/dist/cli/ink-cli/components/modes/StaticCLI.js +2 -2
  74. package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts +1 -1
  75. package/dist/cli/ink-cli/components/overlays/ToolBrowser.js +8 -8
  76. package/dist/cli/ink-cli/constants/tips.js +1 -1
  77. package/dist/cli/ink-cli/containers/InputContainer.d.ts +4 -0
  78. package/dist/cli/ink-cli/containers/InputContainer.d.ts.map +1 -1
  79. package/dist/cli/ink-cli/containers/InputContainer.js +28 -6
  80. package/dist/cli/ink-cli/containers/OverlayContainer.d.ts +2 -0
  81. package/dist/cli/ink-cli/containers/OverlayContainer.d.ts.map +1 -1
  82. package/dist/cli/ink-cli/containers/OverlayContainer.js +81 -36
  83. package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts.map +1 -1
  84. package/dist/cli/ink-cli/hooks/useAgentEvents.js +15 -16
  85. package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts.map +1 -1
  86. package/dist/cli/ink-cli/hooks/useTokenCounter.js +7 -4
  87. package/dist/cli/ink-cli/services/CommandService.d.ts +1 -1
  88. package/dist/cli/ink-cli/services/CommandService.d.ts.map +1 -1
  89. package/dist/cli/ink-cli/services/CommandService.js +2 -2
  90. package/dist/cli/ink-cli/services/processStream.d.ts +2 -2
  91. package/dist/cli/ink-cli/services/processStream.d.ts.map +1 -1
  92. package/dist/cli/ink-cli/services/processStream.js +12 -13
  93. package/dist/cli/ink-cli/state/types.d.ts +2 -2
  94. package/dist/cli/ink-cli/state/types.d.ts.map +1 -1
  95. package/dist/cli/ink-cli/utils/messageFormatting.d.ts +9 -3
  96. package/dist/cli/ink-cli/utils/messageFormatting.d.ts.map +1 -1
  97. package/dist/cli/ink-cli/utils/messageFormatting.js +42 -155
  98. package/dist/cli/ink-cli/utils/toolUtils.d.ts.map +1 -1
  99. package/dist/cli/ink-cli/utils/toolUtils.js +2 -9
  100. package/dist/cli/utils/config-validation.d.ts +11 -11
  101. package/dist/cli/utils/config-validation.d.ts.map +1 -1
  102. package/dist/cli/utils/config-validation.js +56 -290
  103. package/dist/cli/utils/image-store.d.ts +16 -0
  104. package/dist/cli/utils/image-store.d.ts.map +1 -0
  105. package/dist/cli/utils/image-store.js +289 -0
  106. package/dist/cli/utils/scaffolding-utils.d.ts +5 -0
  107. package/dist/cli/utils/scaffolding-utils.d.ts.map +1 -1
  108. package/dist/cli/utils/scaffolding-utils.js +46 -4
  109. package/dist/cli/utils/template-engine.d.ts +28 -16
  110. package/dist/cli/utils/template-engine.d.ts.map +1 -1
  111. package/dist/cli/utils/template-engine.js +339 -479
  112. package/dist/config/cli-overrides.d.ts +4 -3
  113. package/dist/config/cli-overrides.d.ts.map +1 -1
  114. package/dist/config/cli-overrides.js +7 -9
  115. package/dist/index-main.d.ts +2 -0
  116. package/dist/index-main.d.ts.map +1 -0
  117. package/dist/index-main.js +1554 -0
  118. package/dist/index.js +2 -1589
  119. package/dist/utils/session-logger-factory.d.ts +3 -0
  120. package/dist/utils/session-logger-factory.d.ts.map +1 -0
  121. package/dist/utils/session-logger-factory.js +19 -0
  122. package/dist/webui/assets/{index-Cz2z7NQ8.js → index-DwtueA8l.js} +231 -231
  123. package/dist/webui/index.html +1 -1
  124. package/package.json +10 -7
  125. package/dist/cli/cli-subscriber.d.ts +0 -45
  126. package/dist/cli/cli-subscriber.d.ts.map +0 -1
  127. package/dist/cli/cli-subscriber.js +0 -204
@@ -1,14 +1,12 @@
1
1
  import chalk from 'chalk';
2
2
  import * as p from '@clack/prompts';
3
- import { AgentConfigSchema, createAgentConfigSchema, } from '@dexto/core';
4
- import { interactiveApiKeySetup } from './api-key-setup.js';
5
- import { LLMErrorCode } from '@dexto/core';
6
- import { logger } from '@dexto/core';
7
- import { getGlobalPreferencesPath, loadGlobalPreferences, saveGlobalPreferences, } from '@dexto/agent-management';
3
+ import { AgentConfigSchema, } from '@dexto/agent-config';
4
+ import { getPrimaryApiKeyEnvVar, logger, requiresApiKey, requiresBaseURL, resolveApiKeyForProvider, } from '@dexto/core';
5
+ import { getGlobalPreferencesPath } from '@dexto/agent-management';
8
6
  import { handleSyncAgentsCommand } from '../commands/sync-agents.js';
9
7
  /**
10
8
  * Validates agent config with optional interactive fixes for user experience.
11
- * Uses schema parsing to detect API key issues and provides targeted setup.
9
+ * Uses schema parsing for structural validation and performs targeted credential checks.
12
10
  * Returns validated config with all defaults applied.
13
11
  *
14
12
  * IMPORTANT: This function NEVER exits the process. It always returns a result
@@ -16,20 +14,27 @@ import { handleSyncAgentsCommand } from '../commands/sync-agents.js';
16
14
  *
17
15
  * @param config - The agent configuration to validate
18
16
  * @param interactive - Whether to allow interactive prompts to fix issues
19
- * @param validationOptions - Validation strictness options
20
- * @param validationOptions.strict - When true (default), enforces API key requirements.
21
- * When false, allows missing credentials for interactive config.
17
+ * @param options.credentialPolicy - Behavior when credentials are missing (warn, error, ignore)
18
+ * @param options.agentPath - Agent config path (used for manual-edit instructions).
22
19
  */
23
- export async function validateAgentConfig(config, interactive = false, validationOptions) {
24
- // Use appropriate schema based on validation options
25
- // Default to strict validation unless explicitly relaxed
26
- const schema = validationOptions?.strict === false
27
- ? createAgentConfigSchema({ strict: false })
28
- : AgentConfigSchema;
20
+ export async function validateAgentConfig(config, interactive = false, options) {
29
21
  // Parse with schema to detect issues
30
- const parseResult = schema.safeParse(config);
22
+ const parseResult = AgentConfigSchema.safeParse(config);
31
23
  if (parseResult.success) {
32
- return { success: true, config: parseResult.data };
24
+ const credentialIssues = preflightCredentials(parseResult.data);
25
+ if (credentialIssues.length > 0) {
26
+ const policy = options?.credentialPolicy ?? 'error';
27
+ if (policy === 'error') {
28
+ showValidationErrors(credentialIssues);
29
+ showNextSteps();
30
+ return { success: false, errors: credentialIssues };
31
+ }
32
+ if (policy === 'warn') {
33
+ showCredentialWarnings(credentialIssues);
34
+ return { success: true, config: parseResult.data, warnings: credentialIssues };
35
+ }
36
+ }
37
+ return { success: true, config: parseResult.data, warnings: [] };
33
38
  }
34
39
  // Validation failed - handle based on mode
35
40
  logger.debug(`Agent config validation error: ${JSON.stringify(parseResult.error)}`);
@@ -40,196 +45,52 @@ export async function validateAgentConfig(config, interactive = false, validatio
40
45
  showNextSteps();
41
46
  return { success: false, errors };
42
47
  }
43
- // Interactive mode: try to help the user fix the issue
44
- // Check for API key errors first
45
- const apiKeyError = findApiKeyError(parseResult.error, config);
46
- if (apiKeyError) {
47
- return await handleApiKeyError(apiKeyError.provider, config, errors, validationOptions);
48
- }
49
- // Check for baseURL errors next
50
- const baseURLError = findBaseURLError(parseResult.error, config);
51
- if (baseURLError) {
52
- return await handleBaseURLError(baseURLError.provider, config, errors, validationOptions);
53
- }
54
48
  // Other validation errors - show options
55
- return await handleOtherErrors(errors, validationOptions);
49
+ return await handleOtherErrors(errors, options);
56
50
  }
57
51
  /**
58
- * Handle API key validation errors interactively
52
+ * Perform a best-effort credential preflight for startup UX.
53
+ *
54
+ * Notes:
55
+ * - This does not guarantee runtime success (e.g. Vertex/Bedrock auth is not fully validated here).
56
+ * - It only checks whether required fields are present via config or env fallback.
59
57
  */
60
- async function handleApiKeyError(provider, config, errors, validationOptions) {
61
- console.log(chalk.rgb(255, 165, 0)(`\n🔑 API key issue detected for ${provider} provider\n`));
62
- const action = await p.select({
63
- message: 'How would you like to proceed?',
64
- options: [
65
- {
66
- value: 'setup',
67
- label: 'Set up API key now',
68
- hint: 'Configure the API key interactively',
69
- },
70
- {
71
- value: 'skip',
72
- label: 'Continue anyway',
73
- hint: 'Try to start without fixing (may fail)',
74
- },
75
- {
76
- value: 'edit',
77
- label: 'Edit configuration manually',
78
- hint: 'Show file path and instructions',
79
- },
80
- ],
81
- });
82
- if (p.isCancel(action)) {
83
- showNextSteps();
84
- return { success: false, errors, skipped: true };
85
- }
86
- if (action === 'setup') {
87
- const result = await interactiveApiKeySetup(provider, { exitOnCancel: false });
88
- if (result.success && !result.skipped) {
89
- // Retry validation after API key setup
90
- return validateAgentConfig(config, true, validationOptions);
58
+ function preflightCredentials(config) {
59
+ const issues = [];
60
+ const provider = config.llm.provider;
61
+ // Mirror runtime behavior: config apiKey takes precedence, but env can satisfy missing config
62
+ const resolvedApiKey = config.llm.apiKey || resolveApiKeyForProvider(provider);
63
+ if (requiresApiKey(provider) && !resolvedApiKey?.trim()) {
64
+ const envVar = getPrimaryApiKeyEnvVar(provider);
65
+ issues.push(`llm.apiKey: Missing API key for provider '${provider}' – set $${envVar}`);
66
+ }
67
+ if (requiresBaseURL(provider)) {
68
+ const baseURL = config.llm.baseURL;
69
+ const envFallbackBaseURL = provider === 'openai-compatible'
70
+ ? process.env.OPENAI_BASE_URL?.replace(/\/$/, '')
71
+ : undefined;
72
+ if (!baseURL && !envFallbackBaseURL) {
73
+ issues.push(`llm.baseURL: Provider '${provider}' requires a 'baseURL'. ` +
74
+ `Set llm.baseURL (or $OPENAI_BASE_URL for openai-compatible).`);
91
75
  }
92
- // Setup was skipped or cancelled - let them continue anyway
93
- return { success: false, errors, skipped: true };
94
- }
95
- if (action === 'edit') {
96
- showManualEditInstructions(undefined);
97
- return { success: false, errors, skipped: true };
98
76
  }
99
- // 'skip' - continue anyway
100
- p.log.warn('Continuing with validation errors - some features may not work correctly');
101
- return { success: false, errors, skipped: true };
77
+ return issues;
102
78
  }
103
79
  /**
104
- * Handle baseURL validation errors interactively
80
+ * Show credential warnings in a user-friendly way.
105
81
  */
106
- async function handleBaseURLError(provider, config, errors, validationOptions) {
107
- console.log(chalk.rgb(255, 165, 0)(`\n🌐 Base URL required for ${provider} provider\n`));
108
- const providerExamples = {
109
- 'openai-compatible': 'http://localhost:11434/v1 (Ollama)',
110
- litellm: 'http://localhost:4000 (LiteLLM proxy)',
111
- };
112
- const example = providerExamples[provider] || 'http://localhost:8080/v1';
113
- p.note([
114
- `The ${provider} provider requires a base URL to connect to your`,
115
- `local or custom LLM endpoint.`,
116
- ``,
117
- `${chalk.gray('Example:')} ${example}`,
118
- ].join('\n'), 'Base URL Required');
119
- const action = await p.select({
120
- message: 'How would you like to proceed?',
121
- options: [
122
- {
123
- value: 'setup',
124
- label: 'Enter base URL now',
125
- hint: 'Configure the base URL interactively',
126
- },
127
- {
128
- value: 'skip',
129
- label: 'Continue anyway',
130
- hint: 'Try to start without fixing (may fail)',
131
- },
132
- {
133
- value: 'edit',
134
- label: 'Edit configuration manually',
135
- hint: 'Show file path and instructions',
136
- },
137
- ],
138
- });
139
- if (p.isCancel(action)) {
140
- showNextSteps();
141
- return { success: false, errors, skipped: true };
142
- }
143
- if (action === 'setup') {
144
- const result = await interactiveBaseURLSetup(provider, config.llm?.baseURL);
145
- if (result.success && !result.skipped && result.baseURL && config.llm) {
146
- // Update config with the new baseURL for retry validation
147
- const updatedConfig = {
148
- ...config,
149
- llm: { ...config.llm, baseURL: result.baseURL },
150
- };
151
- // Retry validation after baseURL setup
152
- return validateAgentConfig(updatedConfig, true, validationOptions);
153
- }
154
- // Setup was skipped or cancelled
155
- return { success: false, errors, skipped: true };
156
- }
157
- if (action === 'edit') {
158
- showManualEditInstructions(undefined);
159
- return { success: false, errors, skipped: true };
160
- }
161
- // 'skip' - continue anyway
162
- p.log.warn('Continuing with validation errors - some features may not work correctly');
163
- return { success: false, errors, skipped: true };
164
- }
165
- /**
166
- * Interactive baseURL setup
167
- */
168
- async function interactiveBaseURLSetup(provider, existingBaseURL) {
169
- const providerDefaults = {
170
- 'openai-compatible': 'http://localhost:11434/v1',
171
- litellm: 'http://localhost:4000',
172
- };
173
- // Use existing baseURL if available, otherwise fall back to provider defaults
174
- const defaultURL = existingBaseURL || providerDefaults[provider] || '';
175
- const baseURL = await p.text({
176
- message: `Enter base URL for ${provider}`,
177
- placeholder: defaultURL,
178
- initialValue: defaultURL,
179
- validate: (value) => {
180
- if (!value.trim()) {
181
- return 'Base URL is required';
182
- }
183
- try {
184
- new URL(value.trim());
185
- return undefined;
186
- }
187
- catch {
188
- return 'Please enter a valid URL (e.g., http://localhost:11434/v1)';
189
- }
190
- },
191
- });
192
- if (p.isCancel(baseURL)) {
193
- p.log.warn('Skipping base URL setup. You can configure it later with: dexto setup');
194
- return { success: false, skipped: true };
195
- }
196
- const trimmedURL = baseURL.trim();
197
- // Save to preferences
198
- const spinner = p.spinner();
199
- spinner.start('Saving base URL to preferences...');
200
- try {
201
- const preferences = await loadGlobalPreferences();
202
- // Update the LLM section with baseURL (complete replacement as per schema design)
203
- const updatedPreferences = {
204
- ...preferences,
205
- llm: {
206
- ...preferences.llm,
207
- baseURL: trimmedURL,
208
- },
209
- };
210
- await saveGlobalPreferences(updatedPreferences);
211
- spinner.stop(chalk.green('✓ Base URL saved to preferences'));
212
- return { success: true, baseURL: trimmedURL };
213
- }
214
- catch (error) {
215
- spinner.stop(chalk.red('✗ Failed to save base URL'));
216
- logger.error(`Failed to save baseURL: ${error instanceof Error ? error.message : String(error)}`);
217
- // Show manual instructions
218
- p.note([
219
- `Add this to your preferences file:`,
220
- ``,
221
- ` ${chalk.cyan('baseURL:')} ${trimmedURL}`,
222
- ``,
223
- `File: ${getGlobalPreferencesPath()}`,
224
- ].join('\n'), chalk.rgb(255, 165, 0)('Manual Setup Required'));
225
- // Still return success with the URL for in-memory use
226
- return { success: true, baseURL: trimmedURL, skipped: true };
82
+ function showCredentialWarnings(warnings) {
83
+ console.log(chalk.rgb(255, 165, 0)('\n⚠️ Credential warnings:\n'));
84
+ for (const warning of warnings) {
85
+ console.log(chalk.yellow(` • ${warning}`));
86
+ logger.warn(warning);
227
87
  }
88
+ console.log(chalk.gray('\n💡 Run `dexto setup` to configure credentials.\n'));
228
89
  }
229
90
  /**
230
91
  * Handle non-API-key validation errors interactively
231
92
  */
232
- async function handleOtherErrors(errors, validationOptions) {
93
+ async function handleOtherErrors(errors, options) {
233
94
  console.log(chalk.rgb(255, 165, 0)('\n⚠️ Configuration issues detected:\n'));
234
95
  for (const error of errors) {
235
96
  console.log(chalk.red(` • ${error}`));
@@ -273,7 +134,7 @@ async function handleOtherErrors(errors, validationOptions) {
273
134
  }
274
135
  }
275
136
  if (action === 'edit') {
276
- showManualEditInstructions(validationOptions?.agentPath);
137
+ showManualEditInstructions(options?.agentPath);
277
138
  return { success: false, errors, skipped: true };
278
139
  }
279
140
  // 'skip' - continue anyway
@@ -331,72 +192,6 @@ function showManualEditInstructions(agentPath) {
331
192
  ]),
332
193
  ].join('\n'), 'Manual Configuration');
333
194
  }
334
- /**
335
- * Extract API key error details from Zod validation error
336
- */
337
- function findApiKeyError(error, configData) {
338
- for (const issue of error.issues) {
339
- // Check for our custom LLM_MISSING_API_KEY error code in params
340
- if (issue.code === 'custom' && hasErrorCode(issue.params, LLMErrorCode.API_KEY_MISSING)) {
341
- // Extract provider from error params (added by our schema)
342
- const provider = getProviderFromParams(issue.params);
343
- if (provider) {
344
- return { provider };
345
- }
346
- }
347
- // Fallback: check for apiKey path errors and extract provider from config
348
- if (issue.path.includes('apiKey') && issue.message.includes('Missing API key')) {
349
- const provider = configData.llm?.provider;
350
- if (provider) {
351
- return { provider };
352
- }
353
- }
354
- }
355
- return null;
356
- }
357
- /**
358
- * Extract baseURL error details from Zod validation error
359
- */
360
- function findBaseURLError(error, configData) {
361
- for (const issue of error.issues) {
362
- // Check for our custom BASE_URL_MISSING error code in params
363
- if (issue.code === 'custom' && hasErrorCode(issue.params, LLMErrorCode.BASE_URL_MISSING)) {
364
- const provider = getProviderFromParams(issue.params) || configData.llm?.provider;
365
- if (provider) {
366
- return { provider };
367
- }
368
- }
369
- // Fallback: check for baseURL path errors
370
- if (issue.path.includes('baseURL') && issue.message.includes('requires')) {
371
- const provider = configData.llm?.provider;
372
- if (provider) {
373
- return { provider };
374
- }
375
- }
376
- }
377
- return null;
378
- }
379
- /**
380
- * Type guard to check if params contains the expected error code
381
- */
382
- function hasErrorCode(params, expectedCode) {
383
- return (typeof params === 'object' &&
384
- params !== null &&
385
- 'code' in params &&
386
- params.code === expectedCode);
387
- }
388
- /**
389
- * Extract provider from Zod issue params
390
- */
391
- function getProviderFromParams(params) {
392
- if (typeof params === 'object' &&
393
- params !== null &&
394
- 'provider' in params &&
395
- typeof params.provider === 'string') {
396
- return params.provider;
397
- }
398
- return null;
399
- }
400
195
  /**
401
196
  * Format Zod validation errors in a user-friendly way
402
197
  */
@@ -407,34 +202,5 @@ function formatZodErrors(error) {
407
202
  });
408
203
  }
409
204
  /**
410
- * Legacy function for backwards compatibility
411
- * @deprecated Use validateAgentConfig with result handling instead
205
+ * Note: validateAgentConfig never exits. Callers own exit behavior.
412
206
  */
413
- export async function validateAgentConfigOrExit(config, interactive = false) {
414
- const result = await validateAgentConfig(config, interactive);
415
- if (result.success && result.config) {
416
- return result.config;
417
- }
418
- // If validation failed but was skipped, return config as-is with defaults applied
419
- // This allows the app to launch in a limited capacity (e.g., web UI for configuration)
420
- // Runtime errors will occur when actually trying to use the LLM
421
- if (result.skipped) {
422
- logger.warn('Starting with validation warnings - some features may not work');
423
- // Apply defaults manually without strict validation
424
- // This allows launching web UI for interactive configuration
425
- // Use unknown cast to bypass branded type checking since we're intentionally
426
- // returning a partially valid config that the user acknowledged
427
- const configWithDefaults = {
428
- ...config,
429
- llm: {
430
- ...config.llm,
431
- maxIterations: config.llm?.maxIterations ?? 50,
432
- },
433
- };
434
- return configWithDefaults;
435
- }
436
- // Last resort: exit with helpful message
437
- console.log(chalk.rgb(255, 165, 0)('\nUnable to start with current configuration.'));
438
- showNextSteps();
439
- process.exit(1);
440
- }
@@ -0,0 +1,16 @@
1
+ export interface InstallImageOptions {
2
+ force?: boolean;
3
+ activate?: boolean;
4
+ storeDir?: string;
5
+ npmTimeoutMs?: number;
6
+ }
7
+ export interface InstallImageResult {
8
+ id: string;
9
+ version: string;
10
+ entryFile: string;
11
+ installDir: string;
12
+ installMode: 'store' | 'linked';
13
+ }
14
+ export declare function installImageToStore(specifier: string, options?: InstallImageOptions): Promise<InstallImageResult>;
15
+ export declare function importImageModule(imageName: string, storeDir?: string): Promise<unknown>;
16
+ //# sourceMappingURL=image-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-store.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/image-store.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,mBAAmB;IAChC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,OAAO,GAAG,QAAQ,CAAC;CACnC;AA6ND,wBAAsB,mBAAmB,CACrC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,mBAAwB,GAClC,OAAO,CAAC,kBAAkB,CAAC,CAmI7B;AAED,wBAAsB,iBAAiB,CACnC,SAAS,EAAE,MAAM,EACjB,QAAQ,GAAE,MAAkC,GAC7C,OAAO,CAAC,OAAO,CAAC,CAuBlB"}