dexto 1.5.7 → 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.
- package/README.md +3 -3
- package/dist/agents/agent-template.yml +2 -2
- package/dist/agents/coding-agent/README.md +10 -10
- package/dist/agents/coding-agent/coding-agent.yml +81 -80
- package/dist/agents/default-agent.yml +32 -47
- package/dist/agents/explore-agent/explore-agent.yml +3 -6
- package/dist/agents/image-editor-agent/image-editor-agent.yml +1 -1
- package/dist/agents/nano-banana-agent/nano-banana-agent.yml +1 -1
- package/dist/agents/podcast-agent/podcast-agent.yml +1 -1
- package/dist/agents/product-name-researcher/product-name-researcher.yml +1 -1
- package/dist/agents/sora-video-agent/sora-video-agent.yml +4 -6
- package/dist/agents/triage-demo/triage-agent.yml +1 -1
- package/dist/analytics/events.d.ts +2 -2
- package/dist/analytics/events.d.ts.map +1 -1
- package/dist/api/mcp/tool-aggregation-handler.d.ts +2 -2
- package/dist/api/server-hono.d.ts +2 -2
- package/dist/api/server-hono.d.ts.map +1 -1
- package/dist/api/server-hono.js +37 -60
- package/dist/cli/approval/cli-approval-handler.d.ts +10 -3
- package/dist/cli/approval/cli-approval-handler.d.ts.map +1 -1
- package/dist/cli/approval/cli-approval-handler.js +1 -1
- package/dist/cli/auth/constants.d.ts +4 -0
- package/dist/cli/auth/constants.d.ts.map +1 -1
- package/dist/cli/auth/constants.js +4 -0
- package/dist/cli/commands/auth/logout.js +2 -2
- package/dist/cli/commands/billing/status.d.ts +3 -1
- package/dist/cli/commands/billing/status.d.ts.map +1 -1
- package/dist/cli/commands/billing/status.js +23 -1
- package/dist/cli/commands/create-app.d.ts +1 -11
- package/dist/cli/commands/create-app.d.ts.map +1 -1
- package/dist/cli/commands/create-app.js +21 -545
- package/dist/cli/commands/create-image.d.ts.map +1 -1
- package/dist/cli/commands/create-image.js +54 -53
- package/dist/cli/commands/image.d.ts +52 -0
- package/dist/cli/commands/image.d.ts.map +1 -0
- package/dist/cli/commands/image.js +118 -0
- 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 +3 -1
- package/dist/cli/commands/init-app.d.ts +4 -8
- package/dist/cli/commands/init-app.d.ts.map +1 -1
- package/dist/cli/commands/init-app.js +37 -161
- package/dist/cli/commands/interactive-commands/command-parser.d.ts +2 -0
- package/dist/cli/commands/interactive-commands/command-parser.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/commands.d.ts +1 -1
- package/dist/cli/commands/interactive-commands/commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/commands.js +2 -2
- package/dist/cli/commands/interactive-commands/general-commands.js +2 -2
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/prompt-commands.js +13 -2
- package/dist/cli/commands/interactive-commands/session/index.d.ts +2 -1
- package/dist/cli/commands/interactive-commands/session/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/session/index.js +2 -1
- package/dist/cli/commands/interactive-commands/session/session-commands.d.ts +2 -2
- package/dist/cli/commands/interactive-commands/session/session-commands.js +2 -2
- package/dist/cli/commands/interactive-commands/system/system-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/system/system-commands.js +7 -29
- package/dist/cli/commands/list-agents.d.ts.map +1 -1
- package/dist/cli/commands/list-agents.js +3 -2
- package/dist/cli/commands/plugin.d.ts +4 -4
- package/dist/cli/commands/setup.d.ts +5 -5
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +766 -207
- package/dist/cli/commands/sync-agents.d.ts +2 -12
- package/dist/cli/commands/sync-agents.d.ts.map +1 -1
- package/dist/cli/commands/sync-agents.js +2 -50
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts +7 -1
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/InkCLIRefactored.js +17 -7
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts +2 -2
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ApprovalPrompt.js +15 -14
- package/dist/cli/ink-cli/components/BackgroundTasksPanel.d.ts +18 -0
- package/dist/cli/ink-cli/components/BackgroundTasksPanel.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/BackgroundTasksPanel.js +48 -0
- package/dist/cli/ink-cli/components/ErrorBoundary.js +1 -1
- package/dist/cli/ink-cli/components/Footer.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/Footer.js +5 -6
- package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ResourceAutocomplete.js +150 -41
- package/dist/cli/ink-cli/components/StatusBar.d.ts +3 -1
- package/dist/cli/ink-cli/components/StatusBar.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/StatusBar.js +27 -7
- package/dist/cli/ink-cli/components/TodoPanel.js +1 -1
- package/dist/cli/ink-cli/components/chat/MessageItem.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/MessageItem.js +9 -5
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.js +1 -1
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts +3 -1
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.js +3 -2
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts +3 -1
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/modes/StaticCLI.js +3 -2
- package/dist/cli/ink-cli/components/overlays/ContextStatsOverlay.js +1 -1
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.js +8 -4
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.js +1 -1
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.js +1 -1
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts +1 -0
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.js +144 -41
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts +2 -1
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.js +286 -44
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts +9 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.js +35 -9
- package/dist/cli/ink-cli/constants/tips.js +1 -1
- package/dist/cli/ink-cli/containers/InputContainer.d.ts +4 -0
- package/dist/cli/ink-cli/containers/InputContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/InputContainer.js +30 -8
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts +2 -0
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/OverlayContainer.js +215 -59
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useAgentEvents.js +73 -13
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useCLIState.js +3 -0
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.js +8 -0
- package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useTokenCounter.js +7 -4
- package/dist/cli/ink-cli/services/CommandService.d.ts +1 -1
- package/dist/cli/ink-cli/services/CommandService.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/CommandService.js +2 -2
- package/dist/cli/ink-cli/services/processStream.d.ts +2 -2
- package/dist/cli/ink-cli/services/processStream.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/processStream.js +55 -8
- package/dist/cli/ink-cli/state/initialState.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/initialState.js +3 -0
- package/dist/cli/ink-cli/state/types.d.ts +11 -2
- package/dist/cli/ink-cli/state/types.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/llm-provider-display.d.ts +3 -0
- package/dist/cli/ink-cli/utils/llm-provider-display.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/llm-provider-display.js +22 -0
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts +13 -9
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/messageFormatting.js +106 -151
- package/dist/cli/ink-cli/utils/toolUtils.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/toolUtils.js +2 -9
- package/dist/cli/utils/config-validation.d.ts +11 -11
- package/dist/cli/utils/config-validation.d.ts.map +1 -1
- package/dist/cli/utils/config-validation.js +56 -290
- package/dist/cli/utils/dexto-auth-check.d.ts +7 -7
- package/dist/cli/utils/dexto-auth-check.d.ts.map +1 -1
- package/dist/cli/utils/dexto-auth-check.js +16 -16
- package/dist/cli/utils/image-store.d.ts +16 -0
- package/dist/cli/utils/image-store.d.ts.map +1 -0
- package/dist/cli/utils/image-store.js +289 -0
- package/dist/cli/utils/options.js +1 -1
- package/dist/cli/utils/provider-setup.d.ts +2 -2
- package/dist/cli/utils/provider-setup.d.ts.map +1 -1
- package/dist/cli/utils/provider-setup.js +10 -2
- package/dist/cli/utils/scaffolding-utils.d.ts +5 -0
- package/dist/cli/utils/scaffolding-utils.d.ts.map +1 -1
- package/dist/cli/utils/scaffolding-utils.js +46 -4
- package/dist/cli/utils/template-engine.d.ts +28 -16
- package/dist/cli/utils/template-engine.d.ts.map +1 -1
- package/dist/cli/utils/template-engine.js +339 -479
- package/dist/config/cli-overrides.d.ts +4 -3
- package/dist/config/cli-overrides.d.ts.map +1 -1
- package/dist/config/cli-overrides.js +8 -10
- package/dist/config/effective-llm.d.ts +4 -4
- package/dist/config/effective-llm.d.ts.map +1 -1
- package/dist/config/effective-llm.js +4 -4
- package/dist/index-main.d.ts +2 -0
- package/dist/index-main.d.ts.map +1 -0
- package/dist/index-main.js +1554 -0
- package/dist/index.js +2 -1580
- package/dist/utils/session-logger-factory.d.ts +3 -0
- package/dist/utils/session-logger-factory.d.ts.map +1 -0
- package/dist/utils/session-logger-factory.js +19 -0
- package/dist/webui/assets/{index-Dl3mj53P.js → index-DwtueA8l.js} +231 -231
- package/dist/webui/index.html +1 -1
- package/package.json +10 -7
- package/dist/cli/cli-subscriber.d.ts +0 -45
- package/dist/cli/cli-subscriber.d.ts.map +0 -1
- package/dist/cli/cli-subscriber.js +0 -204
|
@@ -5,6 +5,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
5
5
|
*/
|
|
6
6
|
import React, { useCallback, useRef, useImperativeHandle, forwardRef, useState } from 'react';
|
|
7
7
|
import { Box } from 'ink';
|
|
8
|
+
import path from 'path';
|
|
8
9
|
import { ApprovalStatus, DenialReason, isUserMessage } from '@dexto/core';
|
|
9
10
|
import { ApprovalPrompt, } from '../components/ApprovalPrompt.js';
|
|
10
11
|
import { SlashCommandAutocomplete, } from '../components/SlashCommandAutocomplete.js';
|
|
@@ -22,6 +23,7 @@ import SessionSubcommandSelector from '../components/overlays/SessionSubcommandS
|
|
|
22
23
|
import McpCustomTypeSelector from '../components/overlays/McpCustomTypeSelector.js';
|
|
23
24
|
import McpCustomWizard from '../components/overlays/McpCustomWizard.js';
|
|
24
25
|
import CustomModelWizard from '../components/overlays/CustomModelWizard.js';
|
|
26
|
+
import { getProviderKeyStatus, loadGlobalPreferences, updateGlobalPreferences, } from '@dexto/agent-management';
|
|
25
27
|
import ApiKeyInput from '../components/overlays/ApiKeyInput.js';
|
|
26
28
|
import SearchOverlay from '../components/overlays/SearchOverlay.js';
|
|
27
29
|
import PromptList from '../components/overlays/PromptList.js';
|
|
@@ -44,8 +46,7 @@ import { capture } from '../../../analytics/index.js';
|
|
|
44
46
|
* Smart container for managing overlays
|
|
45
47
|
* Handles all modal interactions (selectors, autocomplete, approval)
|
|
46
48
|
*/
|
|
47
|
-
export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input, session, approval, setInput, setUi, setSession, setMessages, setApproval, setApprovalQueue, agent, inputService, buffer, refreshStatic, onSubmitPromptCommand, }, ref) {
|
|
48
|
-
const eventBus = agent.agentEventBus;
|
|
49
|
+
export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input, session, approval, setInput, setUi, setSession, setMessages, setApproval, setApprovalQueue, agent, inputService, buffer, configFilePath, refreshStatic, onSubmitPromptCommand, }, ref) {
|
|
49
50
|
// Refs to overlay components for input handling
|
|
50
51
|
const approvalRef = useRef(null);
|
|
51
52
|
const slashAutocompleteRef = useRef(null);
|
|
@@ -79,6 +80,21 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
79
80
|
// State for selected plugin (for plugin-actions overlay)
|
|
80
81
|
const [selectedPlugin, setSelectedPlugin] = useState(null);
|
|
81
82
|
const marketplaceAddPromptRef = useRef(null);
|
|
83
|
+
const getConfigFilePathOrWarn = useCallback((action) => {
|
|
84
|
+
if (configFilePath) {
|
|
85
|
+
return configFilePath;
|
|
86
|
+
}
|
|
87
|
+
setMessages((prev) => [
|
|
88
|
+
...prev,
|
|
89
|
+
{
|
|
90
|
+
id: generateMessageId('system'),
|
|
91
|
+
role: 'system',
|
|
92
|
+
content: `⚠️ Cannot ${action}: this agent is not file-backed (no config path).`,
|
|
93
|
+
timestamp: new Date(),
|
|
94
|
+
},
|
|
95
|
+
]);
|
|
96
|
+
return null;
|
|
97
|
+
}, [configFilePath, setMessages]);
|
|
82
98
|
// Expose handleInput method via ref - routes to appropriate overlay
|
|
83
99
|
useImperativeHandle(ref, () => ({
|
|
84
100
|
handleInput: (inputStr, key) => {
|
|
@@ -176,7 +192,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
176
192
|
}, [setApproval, setApprovalQueue, setUi]);
|
|
177
193
|
// Handle approval responses
|
|
178
194
|
const handleApprove = useCallback((options) => {
|
|
179
|
-
if (!approval
|
|
195
|
+
if (!approval)
|
|
180
196
|
return;
|
|
181
197
|
// Enable "accept all edits" mode if requested
|
|
182
198
|
if (options.enableAcceptEditsMode) {
|
|
@@ -185,18 +201,14 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
185
201
|
// Auto-disable plan mode when plan_create or plan_review is approved
|
|
186
202
|
// This signals the transition from planning phase to execution phase
|
|
187
203
|
const toolName = approval.metadata.toolName;
|
|
188
|
-
|
|
189
|
-
toolName === 'plan_review' ||
|
|
190
|
-
toolName === 'custom--plan_create' ||
|
|
191
|
-
toolName === 'custom--plan_review';
|
|
192
|
-
if (isPlanTool) {
|
|
204
|
+
if (toolName === 'plan_create' || toolName === 'plan_review') {
|
|
193
205
|
setUi((prev) => ({
|
|
194
206
|
...prev,
|
|
195
207
|
planModeActive: false,
|
|
196
208
|
planModeInitialized: false,
|
|
197
209
|
}));
|
|
198
210
|
}
|
|
199
|
-
|
|
211
|
+
agent.emit('approval:response', {
|
|
200
212
|
approvalId: approval.approvalId,
|
|
201
213
|
status: ApprovalStatus.APPROVED,
|
|
202
214
|
sessionId: approval.sessionId,
|
|
@@ -208,15 +220,15 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
208
220
|
},
|
|
209
221
|
});
|
|
210
222
|
completeApproval();
|
|
211
|
-
}, [approval,
|
|
223
|
+
}, [approval, agent, completeApproval, setUi]);
|
|
212
224
|
const handleDeny = useCallback((feedback) => {
|
|
213
|
-
if (!approval
|
|
225
|
+
if (!approval)
|
|
214
226
|
return;
|
|
215
227
|
// Include user feedback in the denial message if provided
|
|
216
228
|
const message = feedback
|
|
217
229
|
? `User requested changes: ${feedback}`
|
|
218
230
|
: 'User denied the tool execution';
|
|
219
|
-
|
|
231
|
+
agent.emit('approval:response', {
|
|
220
232
|
approvalId: approval.approvalId,
|
|
221
233
|
status: ApprovalStatus.DENIED,
|
|
222
234
|
sessionId: approval.sessionId,
|
|
@@ -224,11 +236,11 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
224
236
|
message,
|
|
225
237
|
});
|
|
226
238
|
completeApproval();
|
|
227
|
-
}, [approval,
|
|
239
|
+
}, [approval, agent, completeApproval]);
|
|
228
240
|
const handleCancelApproval = useCallback(() => {
|
|
229
|
-
if (!approval
|
|
241
|
+
if (!approval)
|
|
230
242
|
return;
|
|
231
|
-
|
|
243
|
+
agent.emit('approval:response', {
|
|
232
244
|
approvalId: approval.approvalId,
|
|
233
245
|
status: ApprovalStatus.CANCELLED,
|
|
234
246
|
sessionId: approval.sessionId,
|
|
@@ -236,7 +248,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
236
248
|
message: 'User cancelled the approval request',
|
|
237
249
|
});
|
|
238
250
|
completeApproval();
|
|
239
|
-
}, [approval,
|
|
251
|
+
}, [approval, agent, completeApproval]);
|
|
240
252
|
// Helper: Check if error is due to missing API key
|
|
241
253
|
const isApiKeyMissingError = (error) => {
|
|
242
254
|
if (error instanceof DextoValidationError) {
|
|
@@ -251,11 +263,12 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
251
263
|
}
|
|
252
264
|
return null;
|
|
253
265
|
};
|
|
254
|
-
// Handle model selection
|
|
266
|
+
// Handle model selection (session-only)
|
|
255
267
|
const handleModelSelect = useCallback(async (provider, model, displayName, baseURL, reasoningEffort) => {
|
|
256
|
-
//
|
|
268
|
+
// Session-only switch (default is set via explicit action)
|
|
269
|
+
// Pre-check: Dexto Nova provider requires OAuth login AND API key
|
|
257
270
|
// Check BEFORE closing the overlay so user can pick a different model
|
|
258
|
-
if (provider === 'dexto') {
|
|
271
|
+
if (provider === 'dexto-nova') {
|
|
259
272
|
try {
|
|
260
273
|
const { canUseDextoProvider } = await import('../../utils/dexto-setup.js');
|
|
261
274
|
const canUse = await canUseDextoProvider();
|
|
@@ -265,7 +278,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
265
278
|
{
|
|
266
279
|
id: generateMessageId('system'),
|
|
267
280
|
role: 'system',
|
|
268
|
-
content: '
|
|
281
|
+
content: 'Cannot switch to Dexto Nova model - authentication required. Run /login to authenticate.',
|
|
269
282
|
timestamp: new Date(),
|
|
270
283
|
},
|
|
271
284
|
]);
|
|
@@ -279,7 +292,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
279
292
|
{
|
|
280
293
|
id: generateMessageId('error'),
|
|
281
294
|
role: 'system',
|
|
282
|
-
content:
|
|
295
|
+
content: `Failed to verify Dexto Nova auth: ${error instanceof Error ? error.message : String(error)}`,
|
|
283
296
|
timestamp: new Date(),
|
|
284
297
|
},
|
|
285
298
|
]);
|
|
@@ -326,6 +339,8 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
326
339
|
provider: missingProvider,
|
|
327
340
|
model,
|
|
328
341
|
...(displayName && { displayName }),
|
|
342
|
+
...(baseURL && { baseURL }),
|
|
343
|
+
...(reasoningEffort && { reasoningEffort }),
|
|
329
344
|
},
|
|
330
345
|
}));
|
|
331
346
|
setMessages((prev) => [
|
|
@@ -344,12 +359,99 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
344
359
|
{
|
|
345
360
|
id: generateMessageId('error'),
|
|
346
361
|
role: 'system',
|
|
347
|
-
content:
|
|
362
|
+
content: `Failed to switch model: ${error instanceof Error ? error.message : String(error)}`,
|
|
348
363
|
timestamp: new Date(),
|
|
349
364
|
},
|
|
350
365
|
]);
|
|
351
366
|
}
|
|
352
367
|
}, [setUi, setInput, setMessages, setSession, agent, session.id, buffer]);
|
|
368
|
+
const handleSetDefaultModel = useCallback(async (provider, model, displayName, baseURL, reasoningEffort) => {
|
|
369
|
+
try {
|
|
370
|
+
const preferencesUpdate = {
|
|
371
|
+
provider,
|
|
372
|
+
model,
|
|
373
|
+
...(baseURL ? { baseURL } : {}),
|
|
374
|
+
...(reasoningEffort ? { reasoningEffort } : {}),
|
|
375
|
+
};
|
|
376
|
+
let providerEnvVar;
|
|
377
|
+
try {
|
|
378
|
+
const providerKeyStatus = await getProviderKeyStatus(provider);
|
|
379
|
+
providerEnvVar = providerKeyStatus?.envVar;
|
|
380
|
+
}
|
|
381
|
+
catch (error) {
|
|
382
|
+
agent.logger.debug(`Failed to resolve provider API key env var: ${error instanceof Error ? error.message : String(error)}`);
|
|
383
|
+
}
|
|
384
|
+
let existing = null;
|
|
385
|
+
try {
|
|
386
|
+
existing = await loadGlobalPreferences();
|
|
387
|
+
}
|
|
388
|
+
catch {
|
|
389
|
+
existing = null;
|
|
390
|
+
}
|
|
391
|
+
// Only preserve the API key if the provider hasn't changed
|
|
392
|
+
// If provider changed, use the new provider's env var
|
|
393
|
+
if (existing?.llm.provider === provider && existing?.llm.apiKey) {
|
|
394
|
+
preferencesUpdate.apiKey = existing.llm.apiKey;
|
|
395
|
+
}
|
|
396
|
+
else if (providerEnvVar) {
|
|
397
|
+
preferencesUpdate.apiKey = '$' + providerEnvVar;
|
|
398
|
+
}
|
|
399
|
+
await updateGlobalPreferences({
|
|
400
|
+
llm: preferencesUpdate,
|
|
401
|
+
});
|
|
402
|
+
try {
|
|
403
|
+
await agent.switchLLM({ provider: provider, model, baseURL, reasoningEffort }, session.id || undefined);
|
|
404
|
+
setSession((prev) => ({ ...prev, modelName: displayName || model }));
|
|
405
|
+
setMessages((prev) => [
|
|
406
|
+
...prev,
|
|
407
|
+
{
|
|
408
|
+
id: generateMessageId('system'),
|
|
409
|
+
role: 'system',
|
|
410
|
+
content: `✅ Default model set to ${displayName || model} (${provider})`,
|
|
411
|
+
timestamp: new Date(),
|
|
412
|
+
},
|
|
413
|
+
]);
|
|
414
|
+
}
|
|
415
|
+
catch (error) {
|
|
416
|
+
const missingProvider = isApiKeyMissingError(error);
|
|
417
|
+
if (missingProvider) {
|
|
418
|
+
setUi((prev) => ({
|
|
419
|
+
...prev,
|
|
420
|
+
activeOverlay: 'api-key-input',
|
|
421
|
+
pendingModelSwitch: {
|
|
422
|
+
provider: missingProvider,
|
|
423
|
+
model,
|
|
424
|
+
...(displayName && { displayName }),
|
|
425
|
+
...(baseURL && { baseURL }),
|
|
426
|
+
...(reasoningEffort && { reasoningEffort }),
|
|
427
|
+
},
|
|
428
|
+
}));
|
|
429
|
+
setMessages((prev) => [
|
|
430
|
+
...prev,
|
|
431
|
+
{
|
|
432
|
+
id: generateMessageId('system'),
|
|
433
|
+
role: 'system',
|
|
434
|
+
content: `🔑 API key required for ${provider}`,
|
|
435
|
+
timestamp: new Date(),
|
|
436
|
+
},
|
|
437
|
+
]);
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
throw error;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
catch (error) {
|
|
444
|
+
setMessages((prev) => [
|
|
445
|
+
...prev,
|
|
446
|
+
{
|
|
447
|
+
id: generateMessageId('error'),
|
|
448
|
+
role: 'system',
|
|
449
|
+
content: `Failed to set default model: ${error instanceof Error ? error.message : String(error)}`,
|
|
450
|
+
timestamp: new Date(),
|
|
451
|
+
},
|
|
452
|
+
]);
|
|
453
|
+
}
|
|
454
|
+
}, [agent, setMessages, setSession, setUi, session.id]);
|
|
353
455
|
// State for editing custom model
|
|
354
456
|
const [editingModel, setEditingModel] = useState(null);
|
|
355
457
|
// Handle "Add custom model" from model selector
|
|
@@ -434,7 +536,14 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
434
536
|
timestamp: new Date(),
|
|
435
537
|
},
|
|
436
538
|
]);
|
|
437
|
-
await agent.switchLLM({
|
|
539
|
+
await agent.switchLLM({
|
|
540
|
+
provider: pending.provider,
|
|
541
|
+
model: pending.model,
|
|
542
|
+
...(pending.baseURL && { baseURL: pending.baseURL }),
|
|
543
|
+
...(pending.reasoningEffort && {
|
|
544
|
+
reasoningEffort: pending.reasoningEffort,
|
|
545
|
+
}),
|
|
546
|
+
}, session.id || undefined);
|
|
438
547
|
// Update session state with display name (fallback to model ID)
|
|
439
548
|
setSession((prev) => ({ ...prev, modelName: pendingDisplayName }));
|
|
440
549
|
setMessages((prev) => [
|
|
@@ -453,7 +562,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
453
562
|
{
|
|
454
563
|
id: generateMessageId('error'),
|
|
455
564
|
role: 'system',
|
|
456
|
-
content:
|
|
565
|
+
content: `Failed to switch model: ${error instanceof Error ? error.message : String(error)}`,
|
|
457
566
|
timestamp: new Date(),
|
|
458
567
|
},
|
|
459
568
|
]);
|
|
@@ -577,7 +686,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
577
686
|
{
|
|
578
687
|
id: generateMessageId('error'),
|
|
579
688
|
role: 'system',
|
|
580
|
-
content:
|
|
689
|
+
content: `Failed to switch session: ${error instanceof Error ? error.message : String(error)}`,
|
|
581
690
|
timestamp: new Date(),
|
|
582
691
|
},
|
|
583
692
|
]);
|
|
@@ -657,7 +766,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
657
766
|
{
|
|
658
767
|
id: generateMessageId('error'),
|
|
659
768
|
role: 'system',
|
|
660
|
-
content:
|
|
769
|
+
content: `${error instanceof Error ? error.message : String(error)}`,
|
|
661
770
|
timestamp: new Date(),
|
|
662
771
|
},
|
|
663
772
|
]);
|
|
@@ -735,7 +844,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
735
844
|
{
|
|
736
845
|
id: generateMessageId('error'),
|
|
737
846
|
role: 'system',
|
|
738
|
-
content:
|
|
847
|
+
content: `${error instanceof Error ? error.message : String(error)}`,
|
|
739
848
|
timestamp: new Date(),
|
|
740
849
|
},
|
|
741
850
|
]);
|
|
@@ -759,8 +868,20 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
759
868
|
const atIndex = input.value.lastIndexOf('@');
|
|
760
869
|
if (atIndex >= 0) {
|
|
761
870
|
const before = input.value.slice(0, atIndex + 1);
|
|
762
|
-
const uriParts = resource.uri.split(
|
|
763
|
-
|
|
871
|
+
const uriParts = resource.uri.split(/[\\/]/);
|
|
872
|
+
let reference = resource.name || uriParts[uriParts.length - 1] || resource.uri;
|
|
873
|
+
// If it's an absolute path, use relative path as reference to be more descriptive and less bulky
|
|
874
|
+
const rawUri = resource.uri.replace(/^(fs|file):\/\//, ''); // Stripped prefix
|
|
875
|
+
if (path.isAbsolute(rawUri)) {
|
|
876
|
+
try {
|
|
877
|
+
const relativePath = path.relative(process.cwd(), rawUri);
|
|
878
|
+
// Prioritize relative path for local files to avoid ambiguity
|
|
879
|
+
reference = relativePath;
|
|
880
|
+
}
|
|
881
|
+
catch {
|
|
882
|
+
// Keep fallback if relative fails
|
|
883
|
+
}
|
|
884
|
+
}
|
|
764
885
|
const newValue = `${before}${reference} `;
|
|
765
886
|
buffer.setText(newValue);
|
|
766
887
|
setInput((prev) => ({ ...prev, value: newValue }));
|
|
@@ -786,7 +907,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
786
907
|
timestamp: new Date(),
|
|
787
908
|
},
|
|
788
909
|
]);
|
|
789
|
-
}, [setUi, setInput, setMessages, agent, buffer]);
|
|
910
|
+
}, [setUi, setInput, setMessages, agent, buffer, getConfigFilePathOrWarn]);
|
|
790
911
|
// Handle stream mode selection
|
|
791
912
|
const handleStreamSelect = useCallback((enabled) => {
|
|
792
913
|
setUi((prev) => ({ ...prev, activeOverlay: 'none', mcpWizardServerType: null }));
|
|
@@ -889,7 +1010,11 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
889
1010
|
// Import persistence utilities
|
|
890
1011
|
const { updateMcpServerField } = await import('@dexto/agent-management');
|
|
891
1012
|
// Persist to config file AFTER successful enable/disable
|
|
892
|
-
|
|
1013
|
+
const agentPath = getConfigFilePathOrWarn('persist MCP server settings');
|
|
1014
|
+
if (!agentPath) {
|
|
1015
|
+
return;
|
|
1016
|
+
}
|
|
1017
|
+
await updateMcpServerField(agentPath, server.name, 'enabled', newEnabled);
|
|
893
1018
|
setMessages((prev) => [
|
|
894
1019
|
...prev,
|
|
895
1020
|
{
|
|
@@ -917,7 +1042,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
917
1042
|
{
|
|
918
1043
|
id: generateMessageId('error'),
|
|
919
1044
|
role: 'system',
|
|
920
|
-
content:
|
|
1045
|
+
content: `Failed to ${action.type} server: ${errorMessage}`,
|
|
921
1046
|
timestamp: new Date(),
|
|
922
1047
|
},
|
|
923
1048
|
]);
|
|
@@ -951,7 +1076,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
951
1076
|
{
|
|
952
1077
|
id: generateMessageId('error'),
|
|
953
1078
|
role: 'system',
|
|
954
|
-
content:
|
|
1079
|
+
content: `Failed to authenticate server: ${error instanceof Error ? error.message : String(error)}`,
|
|
955
1080
|
timestamp: new Date(),
|
|
956
1081
|
},
|
|
957
1082
|
]);
|
|
@@ -971,7 +1096,10 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
971
1096
|
// Import persistence utilities
|
|
972
1097
|
const { removeMcpServerFromConfig } = await import('@dexto/agent-management');
|
|
973
1098
|
// Persist to config file using surgical removal
|
|
974
|
-
|
|
1099
|
+
const agentPath = getConfigFilePathOrWarn('persist MCP server deletion');
|
|
1100
|
+
if (agentPath) {
|
|
1101
|
+
await removeMcpServerFromConfig(agentPath, server.name);
|
|
1102
|
+
}
|
|
975
1103
|
// Also disconnect if connected
|
|
976
1104
|
try {
|
|
977
1105
|
await agent.removeMcpServer(server.name);
|
|
@@ -995,7 +1123,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
995
1123
|
{
|
|
996
1124
|
id: generateMessageId('error'),
|
|
997
1125
|
role: 'system',
|
|
998
|
-
content:
|
|
1126
|
+
content: `Failed to delete server: ${error instanceof Error ? error.message : String(error)}`,
|
|
999
1127
|
timestamp: new Date(),
|
|
1000
1128
|
},
|
|
1001
1129
|
]);
|
|
@@ -1072,7 +1200,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1072
1200
|
{
|
|
1073
1201
|
id: generateMessageId('system'),
|
|
1074
1202
|
role: 'system',
|
|
1075
|
-
content:
|
|
1203
|
+
content: `Failed to connect: ${error instanceof Error ? error.message : String(error)}`,
|
|
1076
1204
|
timestamp: new Date(),
|
|
1077
1205
|
},
|
|
1078
1206
|
]);
|
|
@@ -1153,7 +1281,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1153
1281
|
{
|
|
1154
1282
|
id: generateMessageId('system'),
|
|
1155
1283
|
role: 'system',
|
|
1156
|
-
content:
|
|
1284
|
+
content: `Failed to connect: ${error instanceof Error ? error.message : String(error)}`,
|
|
1157
1285
|
timestamp: new Date(),
|
|
1158
1286
|
},
|
|
1159
1287
|
]);
|
|
@@ -1214,8 +1342,12 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1214
1342
|
]);
|
|
1215
1343
|
// Refresh prompts to remove uninstalled plugin skills
|
|
1216
1344
|
try {
|
|
1217
|
-
const
|
|
1218
|
-
|
|
1345
|
+
const agentPath = getConfigFilePathOrWarn('refresh prompts after plugin uninstall');
|
|
1346
|
+
if (!agentPath) {
|
|
1347
|
+
return;
|
|
1348
|
+
}
|
|
1349
|
+
const newConfig = await reloadAgentConfigFromFile(agentPath);
|
|
1350
|
+
const enrichedConfig = enrichAgentConfig(newConfig, agentPath);
|
|
1219
1351
|
await agent.refreshPrompts(enrichedConfig.prompts);
|
|
1220
1352
|
}
|
|
1221
1353
|
catch {
|
|
@@ -1236,7 +1368,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1236
1368
|
setSelectedPlugin(null);
|
|
1237
1369
|
setUi((prev) => ({ ...prev, isProcessing: false }));
|
|
1238
1370
|
}
|
|
1239
|
-
}, [setUi, setMessages, agent]);
|
|
1371
|
+
}, [setUi, setMessages, agent, getConfigFilePathOrWarn]);
|
|
1240
1372
|
// Handle marketplace browser actions
|
|
1241
1373
|
const handleMarketplaceBrowserAction = useCallback(async (action) => {
|
|
1242
1374
|
if (action.type === 'add-marketplace') {
|
|
@@ -1256,8 +1388,12 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1256
1388
|
// Refresh prompts to include new plugin skills
|
|
1257
1389
|
try {
|
|
1258
1390
|
const { reloadAgentConfigFromFile, enrichAgentConfig } = await import('@dexto/agent-management');
|
|
1259
|
-
const
|
|
1260
|
-
|
|
1391
|
+
const agentPath = getConfigFilePathOrWarn('refresh prompts after plugin install');
|
|
1392
|
+
if (!agentPath) {
|
|
1393
|
+
return;
|
|
1394
|
+
}
|
|
1395
|
+
const newConfig = await reloadAgentConfigFromFile(agentPath);
|
|
1396
|
+
const enrichedConfig = enrichAgentConfig(newConfig, agentPath);
|
|
1261
1397
|
await agent.refreshPrompts(enrichedConfig.prompts);
|
|
1262
1398
|
}
|
|
1263
1399
|
catch (error) {
|
|
@@ -1265,7 +1401,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1265
1401
|
// Log but don't show error to user
|
|
1266
1402
|
}
|
|
1267
1403
|
}
|
|
1268
|
-
}, [setUi, setMessages, agent]);
|
|
1404
|
+
}, [setUi, setMessages, agent, getConfigFilePathOrWarn]);
|
|
1269
1405
|
// Handle marketplace add completion
|
|
1270
1406
|
const handleMarketplaceAddComplete = useCallback((name, pluginCount) => {
|
|
1271
1407
|
setUi((prev) => ({ ...prev, activeOverlay: 'marketplace-browser' }));
|
|
@@ -1333,7 +1469,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1333
1469
|
{
|
|
1334
1470
|
id: generateMessageId('error'),
|
|
1335
1471
|
role: 'system',
|
|
1336
|
-
content:
|
|
1472
|
+
content: `${error instanceof Error ? error.message : String(error)}`,
|
|
1337
1473
|
timestamp: new Date(),
|
|
1338
1474
|
},
|
|
1339
1475
|
]);
|
|
@@ -1480,26 +1616,34 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1480
1616
|
await writeFile(filePath, fileContent, 'utf-8');
|
|
1481
1617
|
// Re-discover commands and refresh with enriched prompts
|
|
1482
1618
|
const { reloadAgentConfigFromFile, enrichAgentConfig } = await import('@dexto/agent-management');
|
|
1483
|
-
const
|
|
1484
|
-
|
|
1619
|
+
const agentPath = getConfigFilePathOrWarn('refresh prompts after creating shared prompt');
|
|
1620
|
+
if (!agentPath) {
|
|
1621
|
+
return;
|
|
1622
|
+
}
|
|
1623
|
+
const newConfig = await reloadAgentConfigFromFile(agentPath);
|
|
1624
|
+
const enrichedConfig = enrichAgentConfig(newConfig, agentPath);
|
|
1485
1625
|
await agent.refreshPrompts(enrichedConfig.prompts);
|
|
1486
1626
|
}
|
|
1487
1627
|
else {
|
|
1488
1628
|
// Create in agent's prompts directory
|
|
1489
|
-
const
|
|
1629
|
+
const agentPath = getConfigFilePathOrWarn('create prompt in agent prompts directory');
|
|
1630
|
+
if (!agentPath) {
|
|
1631
|
+
return;
|
|
1632
|
+
}
|
|
1633
|
+
const agentDir = dirname(agentPath);
|
|
1490
1634
|
const promptsDir = join(agentDir, 'prompts');
|
|
1491
1635
|
filePath = join(promptsDir, `${data.name}.md`);
|
|
1492
1636
|
await mkdir(promptsDir, { recursive: true });
|
|
1493
1637
|
await writeFile(filePath, fileContent, 'utf-8');
|
|
1494
1638
|
// Add file reference to agent config using surgical helper
|
|
1495
1639
|
const { addPromptToAgentConfig, reloadAgentConfigFromFile, enrichAgentConfig, } = await import('@dexto/agent-management');
|
|
1496
|
-
await addPromptToAgentConfig(
|
|
1640
|
+
await addPromptToAgentConfig(agentPath, {
|
|
1497
1641
|
type: 'file',
|
|
1498
1642
|
file: `\${{dexto.agent_dir}}/prompts/${data.name}.md`,
|
|
1499
1643
|
});
|
|
1500
1644
|
// Reload config from disk, enrich to include discovered commands, then refresh
|
|
1501
|
-
const newConfig = await reloadAgentConfigFromFile(
|
|
1502
|
-
const enrichedConfig = enrichAgentConfig(newConfig,
|
|
1645
|
+
const newConfig = await reloadAgentConfigFromFile(agentPath);
|
|
1646
|
+
const enrichedConfig = enrichAgentConfig(newConfig, agentPath);
|
|
1503
1647
|
await agent.refreshPrompts(enrichedConfig.prompts);
|
|
1504
1648
|
}
|
|
1505
1649
|
setMessages((prev) => [
|
|
@@ -1518,12 +1662,20 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1518
1662
|
{
|
|
1519
1663
|
id: generateMessageId('error'),
|
|
1520
1664
|
role: 'system',
|
|
1521
|
-
content:
|
|
1665
|
+
content: `Failed to create prompt: ${error instanceof Error ? error.message : String(error)}`,
|
|
1522
1666
|
timestamp: new Date(),
|
|
1523
1667
|
},
|
|
1524
1668
|
]);
|
|
1525
1669
|
}
|
|
1526
|
-
}, [
|
|
1670
|
+
}, [
|
|
1671
|
+
ui.promptAddWizard?.scope,
|
|
1672
|
+
setUi,
|
|
1673
|
+
setInput,
|
|
1674
|
+
setMessages,
|
|
1675
|
+
buffer,
|
|
1676
|
+
agent,
|
|
1677
|
+
getConfigFilePathOrWarn,
|
|
1678
|
+
]);
|
|
1527
1679
|
// Handle prompt delete
|
|
1528
1680
|
const handlePromptDelete = useCallback(async (deletable) => {
|
|
1529
1681
|
const displayName = deletable.prompt.displayName || deletable.prompt.name;
|
|
@@ -1538,10 +1690,14 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1538
1690
|
]);
|
|
1539
1691
|
try {
|
|
1540
1692
|
const { deletePromptByMetadata, reloadAgentConfigFromFile, enrichAgentConfig } = await import('@dexto/agent-management');
|
|
1693
|
+
const agentPath = getConfigFilePathOrWarn('delete prompt');
|
|
1694
|
+
if (!agentPath) {
|
|
1695
|
+
return;
|
|
1696
|
+
}
|
|
1541
1697
|
// Use the higher-level delete function that handles file + config
|
|
1542
1698
|
// Pass full metadata including originalId for inline prompt deletion
|
|
1543
1699
|
const promptMetadata = deletable.prompt.metadata;
|
|
1544
|
-
const result = await deletePromptByMetadata(
|
|
1700
|
+
const result = await deletePromptByMetadata(agentPath, {
|
|
1545
1701
|
name: deletable.prompt.name,
|
|
1546
1702
|
metadata: {
|
|
1547
1703
|
filePath: deletable.filePath,
|
|
@@ -1552,8 +1708,8 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1552
1708
|
throw new Error(result.error || 'Failed to delete prompt');
|
|
1553
1709
|
}
|
|
1554
1710
|
// Reload config from disk, enrich to include discovered commands, then refresh
|
|
1555
|
-
const newConfig = await reloadAgentConfigFromFile(
|
|
1556
|
-
const enrichedConfig = enrichAgentConfig(newConfig,
|
|
1711
|
+
const newConfig = await reloadAgentConfigFromFile(agentPath);
|
|
1712
|
+
const enrichedConfig = enrichAgentConfig(newConfig, agentPath);
|
|
1557
1713
|
await agent.refreshPrompts(enrichedConfig.prompts);
|
|
1558
1714
|
setMessages((prev) => [
|
|
1559
1715
|
...prev,
|
|
@@ -1577,7 +1733,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1577
1733
|
{
|
|
1578
1734
|
id: generateMessageId('error'),
|
|
1579
1735
|
role: 'system',
|
|
1580
|
-
content:
|
|
1736
|
+
content: `Failed to delete prompt: ${error instanceof Error ? error.message : String(error)}`,
|
|
1581
1737
|
timestamp: new Date(),
|
|
1582
1738
|
},
|
|
1583
1739
|
]);
|
|
@@ -1587,7 +1743,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1587
1743
|
activeOverlay: 'prompt-list',
|
|
1588
1744
|
}));
|
|
1589
1745
|
}
|
|
1590
|
-
}, [setUi, setMessages, agent]);
|
|
1746
|
+
}, [setUi, setMessages, agent, getConfigFilePathOrWarn]);
|
|
1591
1747
|
// Handle prompt add wizard close
|
|
1592
1748
|
const handlePromptAddWizardClose = useCallback(() => {
|
|
1593
1749
|
setUi((prev) => ({
|
|
@@ -1645,7 +1801,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1645
1801
|
{
|
|
1646
1802
|
id: generateMessageId('error'),
|
|
1647
1803
|
role: 'system',
|
|
1648
|
-
content:
|
|
1804
|
+
content: `Failed to rename session: ${error instanceof Error ? error.message : String(error)}`,
|
|
1649
1805
|
timestamp: new Date(),
|
|
1650
1806
|
},
|
|
1651
1807
|
]);
|
|
@@ -1655,7 +1811,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1655
1811
|
const handleSessionRenameClose = useCallback(() => {
|
|
1656
1812
|
setUi((prev) => ({ ...prev, activeOverlay: 'none' }));
|
|
1657
1813
|
}, [setUi]);
|
|
1658
|
-
return (_jsxs(_Fragment, { children: [approval && (_jsx(ApprovalPrompt, { ref: approvalRef, approval: approval, onApprove: handleApprove, onDeny: handleDeny, onCancel: handleCancelApproval })), ui.activeOverlay === 'slash-autocomplete' && (_jsx(Box, { marginTop: 1, children: _jsx(SlashCommandAutocomplete, { ref: slashAutocompleteRef, isVisible: true, searchQuery: input.value, onSelectPrompt: handlePromptSelect, onSelectSystemCommand: handleSystemCommandSelect, onLoadIntoInput: handleLoadIntoInput, onSubmitRaw: onSubmitPromptCommand, onClose: handleClose, agent: agent }) })), ui.activeOverlay === 'resource-autocomplete' && (_jsx(Box, { marginTop: 1, children: _jsx(ResourceAutocomplete, { ref: resourceAutocompleteRef, isVisible: true, searchQuery: input.value, onSelectResource: handleResourceSelect, onLoadIntoInput: handleLoadIntoInput, onClose: handleClose, agent: agent }) })), ui.activeOverlay === 'model-selector' && (_jsx(Box, { marginTop: 1, children: _jsx(ModelSelectorRefactored, { ref: modelSelectorRef, isVisible: true, onSelectModel: handleModelSelect, onClose: handleClose, onAddCustomModel: handleAddCustomModel, onEditCustomModel: handleEditCustomModel, agent: agent }) })), ui.activeOverlay === 'session-selector' && (_jsx(Box, { marginTop: 1, children: _jsx(SessionSelectorRefactored, { ref: sessionSelectorRef, isVisible: true, onSelectSession: handleSessionSelect, onClose: handleClose, agent: agent, currentSessionId: session.id || undefined }) })), ui.activeOverlay === 'log-level-selector' && (_jsx(Box, { marginTop: 1, children: _jsx(LogLevelSelector, { ref: logLevelSelectorRef, isVisible: true, onSelect: handleLogLevelSelect, onClose: handleClose, agent: agent, sessionId: session.id }) })), ui.activeOverlay === 'stream-selector' && (_jsx(Box, { marginTop: 1, children: _jsx(StreamSelector, { ref: streamSelectorRef, isVisible: true, onSelect: handleStreamSelect, onClose: handleClose }) })), ui.activeOverlay === 'tool-browser' && (_jsx(Box, { marginTop: 1, children: _jsx(ToolBrowser, { ref: toolBrowserRef, isVisible: true, onClose: handleClose, agent: agent }) })), ui.activeOverlay === 'mcp-server-list' && (_jsx(Box, { marginTop: 1, children: _jsx(McpServerList, { ref: mcpServerListRef, isVisible: true, onAction: handleMcpServerListAction, onClose: handleClose, agent: agent }) })), ui.activeOverlay === 'mcp-server-actions' && ui.selectedMcpServer && (_jsx(Box, { marginTop: 1, children: _jsx(McpServerActions, { ref: mcpServerActionsRef, isVisible: true, server: ui.selectedMcpServer, onAction: handleMcpServerAction, onClose: handleClose }) })), ui.activeOverlay === 'mcp-add-choice' && (_jsx(Box, { marginTop: 1, children: _jsx(McpAddChoice, { ref: mcpAddChoiceRef, isVisible: true, onSelect: handleMcpAddChoice, onClose: handleClose }) })), ui.activeOverlay === 'mcp-add-selector' && (_jsx(Box, { marginTop: 1, children: _jsx(McpAddSelector, { ref: mcpAddSelectorRef, isVisible: true, onSelect: handleMcpAddSelect, onClose: handleClose }) })), ui.activeOverlay === 'mcp-custom-type-selector' && (_jsx(Box, { marginTop: 1, children: _jsx(McpCustomTypeSelector, { ref: mcpCustomTypeSelectorRef, isVisible: true, onSelect: handleMcpCustomTypeSelect, onClose: handleClose }) })), ui.activeOverlay === 'mcp-custom-wizard' && ui.mcpWizardServerType && (_jsx(McpCustomWizard, { ref: mcpCustomWizardRef, isVisible: true, serverType: ui.mcpWizardServerType, onComplete: handleMcpCustomWizardComplete, onClose: handleClose })), ui.activeOverlay === 'custom-model-wizard' && (_jsx(CustomModelWizard, { ref: customModelWizardRef, isVisible: true, onComplete: handleCustomModelComplete, onClose: () => {
|
|
1814
|
+
return (_jsxs(_Fragment, { children: [approval && (_jsx(ApprovalPrompt, { ref: approvalRef, approval: approval, onApprove: handleApprove, onDeny: handleDeny, onCancel: handleCancelApproval })), ui.activeOverlay === 'slash-autocomplete' && (_jsx(Box, { marginTop: 1, children: _jsx(SlashCommandAutocomplete, { ref: slashAutocompleteRef, isVisible: true, searchQuery: input.value, onSelectPrompt: handlePromptSelect, onSelectSystemCommand: handleSystemCommandSelect, onLoadIntoInput: handleLoadIntoInput, onSubmitRaw: onSubmitPromptCommand, onClose: handleClose, agent: agent }) })), ui.activeOverlay === 'resource-autocomplete' && (_jsx(Box, { marginTop: 1, children: _jsx(ResourceAutocomplete, { ref: resourceAutocompleteRef, isVisible: true, searchQuery: input.value, onSelectResource: handleResourceSelect, onLoadIntoInput: handleLoadIntoInput, onClose: handleClose, agent: agent }) })), ui.activeOverlay === 'model-selector' && (_jsx(Box, { marginTop: 1, children: _jsx(ModelSelectorRefactored, { ref: modelSelectorRef, isVisible: true, onSelectModel: handleModelSelect, onSetDefaultModel: handleSetDefaultModel, onClose: handleClose, onAddCustomModel: handleAddCustomModel, onEditCustomModel: handleEditCustomModel, agent: agent }) })), ui.activeOverlay === 'session-selector' && (_jsx(Box, { marginTop: 1, children: _jsx(SessionSelectorRefactored, { ref: sessionSelectorRef, isVisible: true, onSelectSession: handleSessionSelect, onClose: handleClose, agent: agent, currentSessionId: session.id || undefined }) })), ui.activeOverlay === 'log-level-selector' && (_jsx(Box, { marginTop: 1, children: _jsx(LogLevelSelector, { ref: logLevelSelectorRef, isVisible: true, onSelect: handleLogLevelSelect, onClose: handleClose, agent: agent, sessionId: session.id }) })), ui.activeOverlay === 'stream-selector' && (_jsx(Box, { marginTop: 1, children: _jsx(StreamSelector, { ref: streamSelectorRef, isVisible: true, onSelect: handleStreamSelect, onClose: handleClose }) })), ui.activeOverlay === 'tool-browser' && (_jsx(Box, { marginTop: 1, children: _jsx(ToolBrowser, { ref: toolBrowserRef, isVisible: true, onClose: handleClose, agent: agent, sessionId: session.id }) })), ui.activeOverlay === 'mcp-server-list' && (_jsx(Box, { marginTop: 1, children: _jsx(McpServerList, { ref: mcpServerListRef, isVisible: true, onAction: handleMcpServerListAction, onClose: handleClose, agent: agent }) })), ui.activeOverlay === 'mcp-server-actions' && ui.selectedMcpServer && (_jsx(Box, { marginTop: 1, children: _jsx(McpServerActions, { ref: mcpServerActionsRef, isVisible: true, server: ui.selectedMcpServer, onAction: handleMcpServerAction, onClose: handleClose }) })), ui.activeOverlay === 'mcp-add-choice' && (_jsx(Box, { marginTop: 1, children: _jsx(McpAddChoice, { ref: mcpAddChoiceRef, isVisible: true, onSelect: handleMcpAddChoice, onClose: handleClose }) })), ui.activeOverlay === 'mcp-add-selector' && (_jsx(Box, { marginTop: 1, children: _jsx(McpAddSelector, { ref: mcpAddSelectorRef, isVisible: true, onSelect: handleMcpAddSelect, onClose: handleClose }) })), ui.activeOverlay === 'mcp-custom-type-selector' && (_jsx(Box, { marginTop: 1, children: _jsx(McpCustomTypeSelector, { ref: mcpCustomTypeSelectorRef, isVisible: true, onSelect: handleMcpCustomTypeSelect, onClose: handleClose }) })), ui.activeOverlay === 'mcp-custom-wizard' && ui.mcpWizardServerType && (_jsx(McpCustomWizard, { ref: mcpCustomWizardRef, isVisible: true, serverType: ui.mcpWizardServerType, onComplete: handleMcpCustomWizardComplete, onClose: handleClose })), ui.activeOverlay === 'custom-model-wizard' && (_jsx(CustomModelWizard, { ref: customModelWizardRef, isVisible: true, onComplete: handleCustomModelComplete, onClose: () => {
|
|
1659
1815
|
setEditingModel(null);
|
|
1660
1816
|
handleClose();
|
|
1661
1817
|
}, initialModel: editingModel })), ui.activeOverlay === 'plugin-manager' && (_jsx(Box, { marginTop: 1, children: _jsx(PluginManager, { ref: pluginManagerRef, isVisible: true, onAction: handlePluginManagerAction, onClose: handleClose }) })), ui.activeOverlay === 'plugin-list' && (_jsx(Box, { marginTop: 1, children: _jsx(PluginList, { ref: pluginListRef, isVisible: true, onPluginSelect: handlePluginSelect, onClose: handleClose }) })), ui.activeOverlay === 'plugin-actions' && (_jsx(Box, { marginTop: 1, children: _jsx(PluginActions, { ref: pluginActionsRef, isVisible: true, plugin: selectedPlugin, onAction: handlePluginAction, onClose: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAgentEvents.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/hooks/useAgentEvents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAEH,KAAK,UAAU,EACf,KAAK,aAAa,EAErB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAEtE,UAAU,mBAAmB;IACzB,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC7D,kBAAkB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACpE,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACrD,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,CAAC;IAC/D,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;IAC3D,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC,CAAC;IAC1E,gBAAgB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;IAC1E,iBAAiB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;IACzE,8CAA8C;IAC9C,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,iFAAiF;IACjF,MAAM,EAAE,UAAU,CAAC;CACtB;AAYD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAC3B,KAAK,EACL,WAAW,EACX,kBAAkB,EAClB,KAAK,EACL,UAAU,EACV,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,GACT,EAAE,mBAAmB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"useAgentEvents.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/hooks/useAgentEvents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAEH,KAAK,UAAU,EACf,KAAK,aAAa,EAErB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAEtE,UAAU,mBAAmB;IACzB,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC7D,kBAAkB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACpE,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACrD,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,CAAC;IAC/D,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;IAC3D,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC,CAAC;IAC1E,gBAAgB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;IAC1E,iBAAiB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;IACzE,8CAA8C;IAC9C,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,iFAAiF;IACjF,MAAM,EAAE,UAAU,CAAC;CACtB;AAYD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAC3B,KAAK,EACL,WAAW,EACX,kBAAkB,EAClB,KAAK,EACL,UAAU,EACV,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,GACT,EAAE,mBAAmB,GAAG,IAAI,CAgd5B"}
|