dexto 1.5.6 → 1.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist/agents/coding-agent/coding-agent.yml +17 -0
- package/dist/agents/coding-agent/skills/code-review.md +46 -0
- package/dist/agents/explore-agent/explore-agent.yml +2 -0
- package/dist/analytics/events.d.ts +1 -1
- package/dist/analytics/events.d.ts.map +1 -1
- package/dist/api/server-hono.d.ts.map +1 -1
- package/dist/api/server-hono.js +55 -10
- package/dist/cli/assets/dexto-logo.svg +31 -0
- package/dist/cli/auth/api-client.d.ts +49 -0
- package/dist/cli/auth/api-client.d.ts.map +1 -0
- package/dist/cli/auth/api-client.js +127 -0
- package/dist/cli/auth/constants.d.ts +27 -0
- package/dist/cli/auth/constants.d.ts.map +1 -0
- package/dist/cli/auth/constants.js +28 -0
- package/dist/cli/auth/index.d.ts +5 -0
- package/dist/cli/auth/index.d.ts.map +1 -0
- package/dist/cli/auth/index.js +6 -0
- package/dist/cli/auth/oauth.d.ts +26 -0
- package/dist/cli/auth/oauth.d.ts.map +1 -0
- package/dist/cli/auth/oauth.js +327 -0
- package/dist/cli/auth/service.d.ts +20 -0
- package/dist/cli/auth/service.d.ts.map +1 -0
- package/dist/cli/auth/service.js +147 -0
- package/dist/cli/commands/auth/index.d.ts +4 -0
- package/dist/cli/commands/auth/index.d.ts.map +1 -0
- package/dist/cli/commands/auth/index.js +4 -0
- package/dist/cli/commands/auth/login.d.ts +9 -0
- package/dist/cli/commands/auth/login.d.ts.map +1 -0
- package/dist/cli/commands/auth/login.js +255 -0
- package/dist/cli/commands/auth/logout.d.ts +5 -0
- package/dist/cli/commands/auth/logout.d.ts.map +1 -0
- package/dist/cli/commands/auth/logout.js +51 -0
- package/dist/cli/commands/auth/status.d.ts +2 -0
- package/dist/cli/commands/auth/status.d.ts.map +1 -0
- package/dist/cli/commands/auth/status.js +22 -0
- package/dist/cli/commands/billing/index.d.ts +2 -0
- package/dist/cli/commands/billing/index.d.ts.map +1 -0
- package/dist/cli/commands/billing/index.js +2 -0
- package/dist/cli/commands/billing/status.d.ts +8 -0
- package/dist/cli/commands/billing/status.d.ts.map +1 -0
- package/dist/cli/commands/billing/status.js +82 -0
- package/dist/cli/commands/index.d.ts +3 -0
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +8 -0
- package/dist/cli/commands/interactive-commands/auth/index.d.ts +12 -0
- package/dist/cli/commands/interactive-commands/auth/index.d.ts.map +1 -0
- package/dist/cli/commands/interactive-commands/auth/index.js +20 -0
- package/dist/cli/commands/interactive-commands/command-parser.d.ts +5 -0
- package/dist/cli/commands/interactive-commands/command-parser.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/command-parser.js +6 -0
- package/dist/cli/commands/interactive-commands/commands.d.ts +1 -0
- package/dist/cli/commands/interactive-commands/commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/commands.js +8 -0
- package/dist/cli/commands/interactive-commands/mcp/index.d.ts +2 -2
- package/dist/cli/commands/interactive-commands/mcp/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/mcp/index.js +4 -7
- package/dist/cli/commands/interactive-commands/model/index.d.ts +2 -2
- package/dist/cli/commands/interactive-commands/model/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/model/index.js +4 -7
- package/dist/cli/commands/interactive-commands/plugin/index.d.ts +13 -0
- package/dist/cli/commands/interactive-commands/plugin/index.d.ts.map +1 -0
- package/dist/cli/commands/interactive-commands/plugin/index.js +18 -0
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts +3 -1
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/prompt-commands.js +88 -36
- package/dist/cli/commands/list-agents.d.ts.map +1 -1
- package/dist/cli/commands/list-agents.js +3 -2
- package/dist/cli/commands/plugin.d.ts +161 -0
- package/dist/cli/commands/plugin.d.ts.map +1 -0
- package/dist/cli/commands/plugin.js +376 -0
- package/dist/cli/commands/setup.d.ts +9 -9
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +944 -176
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/InkCLIRefactored.js +13 -2
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts +1 -1
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ApprovalPrompt.js +80 -12
- package/dist/cli/ink-cli/components/BackgroundTasksPanel.d.ts +18 -0
- package/dist/cli/ink-cli/components/BackgroundTasksPanel.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/BackgroundTasksPanel.js +48 -0
- package/dist/cli/ink-cli/components/ErrorBoundary.js +1 -1
- package/dist/cli/ink-cli/components/Footer.d.ts +2 -1
- package/dist/cli/ink-cli/components/Footer.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/Footer.js +6 -2
- package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ResourceAutocomplete.js +150 -41
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.js +15 -7
- package/dist/cli/ink-cli/components/StatusBar.d.ts +7 -1
- package/dist/cli/ink-cli/components/StatusBar.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/StatusBar.js +18 -2
- package/dist/cli/ink-cli/components/chat/MessageItem.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/MessageItem.js +23 -6
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.js +5 -1
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/modes/StaticCLI.js +5 -1
- package/dist/cli/ink-cli/components/overlays/ContextStatsOverlay.js +1 -1
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.js +8 -4
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts +1 -0
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.js +31 -20
- package/dist/cli/ink-cli/components/overlays/MarketplaceAddPrompt.d.ts +20 -0
- package/dist/cli/ink-cli/components/overlays/MarketplaceAddPrompt.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/MarketplaceAddPrompt.js +81 -0
- package/dist/cli/ink-cli/components/overlays/MarketplaceBrowser.d.ts +31 -0
- package/dist/cli/ink-cli/components/overlays/MarketplaceBrowser.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/MarketplaceBrowser.js +297 -0
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.js +8 -2
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts +1 -1
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/McpServerActions.js +9 -0
- package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/McpServerList.js +9 -2
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts +1 -0
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.js +150 -34
- package/dist/cli/ink-cli/components/overlays/PluginActions.d.ts +27 -0
- package/dist/cli/ink-cli/components/overlays/PluginActions.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PluginActions.js +66 -0
- package/dist/cli/ink-cli/components/overlays/PluginList.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/PluginList.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PluginList.js +70 -0
- package/dist/cli/ink-cli/components/overlays/PluginManager.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/PluginManager.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PluginManager.js +63 -0
- package/dist/cli/ink-cli/components/overlays/PromptList.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/PromptList.js +4 -1
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts +1 -0
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.js +281 -39
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts +10 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.js +87 -2
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts +4 -2
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.js +4 -4
- package/dist/cli/ink-cli/containers/InputContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/InputContainer.js +32 -5
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/OverlayContainer.js +384 -28
- package/dist/cli/ink-cli/hooks/index.d.ts +1 -0
- package/dist/cli/ink-cli/hooks/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/index.js +1 -0
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useAgentEvents.js +61 -0
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useCLIState.js +5 -0
- package/dist/cli/ink-cli/hooks/useGitBranch.d.ts +13 -0
- package/dist/cli/ink-cli/hooks/useGitBranch.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useGitBranch.js +35 -0
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.js +53 -6
- package/dist/cli/ink-cli/services/processStream.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/processStream.js +92 -12
- package/dist/cli/ink-cli/state/initialState.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/initialState.js +5 -0
- package/dist/cli/ink-cli/state/types.d.ts +12 -1
- package/dist/cli/ink-cli/state/types.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/commandOverlays.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/commandOverlays.js +1 -0
- package/dist/cli/ink-cli/utils/llm-provider-display.d.ts +3 -0
- package/dist/cli/ink-cli/utils/llm-provider-display.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/llm-provider-display.js +22 -0
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts +18 -7
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/messageFormatting.js +143 -15
- package/dist/cli/ink-cli/utils/toolUtils.d.ts +11 -0
- package/dist/cli/ink-cli/utils/toolUtils.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/toolUtils.js +17 -0
- package/dist/cli/mcp/index.d.ts +8 -0
- package/dist/cli/mcp/index.d.ts.map +1 -0
- package/dist/cli/mcp/index.js +7 -0
- package/dist/cli/mcp/oauth-factory.d.ts +6 -0
- package/dist/cli/mcp/oauth-factory.d.ts.map +1 -0
- package/dist/cli/mcp/oauth-factory.js +25 -0
- package/dist/cli/mcp/oauth-provider.d.ts +10 -0
- package/dist/cli/mcp/oauth-provider.d.ts.map +1 -0
- package/dist/cli/mcp/oauth-provider.js +77 -0
- package/dist/cli/mcp/oauth-redirect.d.ts +3 -0
- package/dist/cli/mcp/oauth-redirect.d.ts.map +1 -0
- package/dist/cli/mcp/oauth-redirect.js +4 -0
- package/dist/cli/mcp/oauth-server.d.ts +2 -0
- package/dist/cli/mcp/oauth-server.d.ts.map +1 -0
- package/dist/cli/mcp/oauth-server.js +70 -0
- package/dist/cli/mcp/oauth-store.d.ts +10 -0
- package/dist/cli/mcp/oauth-store.d.ts.map +1 -0
- package/dist/cli/mcp/oauth-store.js +27 -0
- package/dist/cli/mcp/oauth-ui.d.ts +2 -0
- package/dist/cli/mcp/oauth-ui.d.ts.map +1 -0
- package/dist/cli/mcp/oauth-ui.js +12 -0
- package/dist/cli/mcp/oauth-utils.d.ts +2 -0
- package/dist/cli/mcp/oauth-utils.d.ts.map +1 -0
- package/dist/cli/mcp/oauth-utils.js +17 -0
- package/dist/cli/utils/api-key-verification.d.ts.map +1 -1
- package/dist/cli/utils/api-key-verification.js +36 -0
- package/dist/cli/utils/config-validation.d.ts +3 -1
- package/dist/cli/utils/config-validation.d.ts.map +1 -1
- package/dist/cli/utils/config-validation.js +42 -19
- package/dist/cli/utils/dexto-auth-check.d.ts +53 -0
- package/dist/cli/utils/dexto-auth-check.d.ts.map +1 -0
- package/dist/cli/utils/dexto-auth-check.js +104 -0
- package/dist/cli/utils/dexto-setup.d.ts +8 -0
- package/dist/cli/utils/dexto-setup.d.ts.map +1 -0
- package/dist/cli/utils/dexto-setup.js +17 -0
- package/dist/cli/utils/options.d.ts.map +1 -1
- package/dist/cli/utils/options.js +5 -1
- package/dist/cli/utils/provider-setup.d.ts +5 -1
- package/dist/cli/utils/provider-setup.d.ts.map +1 -1
- package/dist/cli/utils/provider-setup.js +29 -1
- package/dist/config/cli-overrides.d.ts +17 -8
- package/dist/config/cli-overrides.d.ts.map +1 -1
- package/dist/config/cli-overrides.js +36 -22
- package/dist/config/effective-llm.d.ts +123 -0
- package/dist/config/effective-llm.d.ts.map +1 -0
- package/dist/config/effective-llm.js +171 -0
- package/dist/index.js +404 -99
- package/dist/webui/assets/index-C9JXwpvo.css +1 -0
- package/dist/webui/assets/{index-DVQWNLpT.js → index-Cz2z7NQ8.js} +218 -218
- package/dist/webui/index.html +2 -2
- package/package.json +9 -8
- package/dist/webui/assets/index-BglIVTSG.css +0 -1
|
@@ -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';
|
|
@@ -31,7 +33,12 @@ import PromptDeleteSelector from '../components/overlays/PromptDeleteSelector.js
|
|
|
31
33
|
import SessionRenameOverlay from '../components/overlays/SessionRenameOverlay.js';
|
|
32
34
|
import ContextStatsOverlay from '../components/overlays/ContextStatsOverlay.js';
|
|
33
35
|
import ExportWizard from '../components/overlays/ExportWizard.js';
|
|
34
|
-
import
|
|
36
|
+
import PluginManager from '../components/overlays/PluginManager.js';
|
|
37
|
+
import PluginList from '../components/overlays/PluginList.js';
|
|
38
|
+
import PluginActions from '../components/overlays/PluginActions.js';
|
|
39
|
+
import MarketplaceBrowser from '../components/overlays/MarketplaceBrowser.js';
|
|
40
|
+
import MarketplaceAddPrompt from '../components/overlays/MarketplaceAddPrompt.js';
|
|
41
|
+
import { DextoValidationError, LLMErrorCode, getModelDisplayName } from '@dexto/core';
|
|
35
42
|
import { createUserMessage, convertHistoryToUIMessages } from '../utils/messageFormatting.js';
|
|
36
43
|
import { generateMessageId } from '../utils/idGenerator.js';
|
|
37
44
|
import { capture } from '../../../analytics/index.js';
|
|
@@ -67,6 +74,13 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
67
74
|
const sessionRenameRef = useRef(null);
|
|
68
75
|
const contextStatsRef = useRef(null);
|
|
69
76
|
const exportWizardRef = useRef(null);
|
|
77
|
+
const pluginManagerRef = useRef(null);
|
|
78
|
+
const pluginListRef = useRef(null);
|
|
79
|
+
const pluginActionsRef = useRef(null);
|
|
80
|
+
const marketplaceBrowserRef = useRef(null);
|
|
81
|
+
// State for selected plugin (for plugin-actions overlay)
|
|
82
|
+
const [selectedPlugin, setSelectedPlugin] = useState(null);
|
|
83
|
+
const marketplaceAddPromptRef = useRef(null);
|
|
70
84
|
// Expose handleInput method via ref - routes to appropriate overlay
|
|
71
85
|
useImperativeHandle(ref, () => ({
|
|
72
86
|
handleInput: (inputStr, key) => {
|
|
@@ -126,6 +140,16 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
126
140
|
return contextStatsRef.current?.handleInput(inputStr, key) ?? false;
|
|
127
141
|
case 'export-wizard':
|
|
128
142
|
return exportWizardRef.current?.handleInput(inputStr, key) ?? false;
|
|
143
|
+
case 'plugin-manager':
|
|
144
|
+
return pluginManagerRef.current?.handleInput(inputStr, key) ?? false;
|
|
145
|
+
case 'plugin-list':
|
|
146
|
+
return pluginListRef.current?.handleInput(inputStr, key) ?? false;
|
|
147
|
+
case 'plugin-actions':
|
|
148
|
+
return pluginActionsRef.current?.handleInput(inputStr, key) ?? false;
|
|
149
|
+
case 'marketplace-browser':
|
|
150
|
+
return (marketplaceBrowserRef.current?.handleInput(inputStr, key) ?? false);
|
|
151
|
+
case 'marketplace-add':
|
|
152
|
+
return (marketplaceAddPromptRef.current?.handleInput(inputStr, key) ?? false);
|
|
129
153
|
default:
|
|
130
154
|
return false;
|
|
131
155
|
}
|
|
@@ -160,6 +184,20 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
160
184
|
if (options.enableAcceptEditsMode) {
|
|
161
185
|
setUi((prev) => ({ ...prev, autoApproveEdits: true }));
|
|
162
186
|
}
|
|
187
|
+
// Auto-disable plan mode when plan_create or plan_review is approved
|
|
188
|
+
// This signals the transition from planning phase to execution phase
|
|
189
|
+
const toolName = approval.metadata.toolName;
|
|
190
|
+
const isPlanTool = toolName === 'plan_create' ||
|
|
191
|
+
toolName === 'plan_review' ||
|
|
192
|
+
toolName === 'custom--plan_create' ||
|
|
193
|
+
toolName === 'custom--plan_review';
|
|
194
|
+
if (isPlanTool) {
|
|
195
|
+
setUi((prev) => ({
|
|
196
|
+
...prev,
|
|
197
|
+
planModeActive: false,
|
|
198
|
+
planModeInitialized: false,
|
|
199
|
+
}));
|
|
200
|
+
}
|
|
163
201
|
eventBus.emit('approval:response', {
|
|
164
202
|
approvalId: approval.approvalId,
|
|
165
203
|
status: ApprovalStatus.APPROVED,
|
|
@@ -173,15 +211,19 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
173
211
|
});
|
|
174
212
|
completeApproval();
|
|
175
213
|
}, [approval, eventBus, completeApproval, setUi]);
|
|
176
|
-
const handleDeny = useCallback(() => {
|
|
214
|
+
const handleDeny = useCallback((feedback) => {
|
|
177
215
|
if (!approval || !eventBus)
|
|
178
216
|
return;
|
|
217
|
+
// Include user feedback in the denial message if provided
|
|
218
|
+
const message = feedback
|
|
219
|
+
? `User requested changes: ${feedback}`
|
|
220
|
+
: 'User denied the tool execution';
|
|
179
221
|
eventBus.emit('approval:response', {
|
|
180
222
|
approvalId: approval.approvalId,
|
|
181
223
|
status: ApprovalStatus.DENIED,
|
|
182
224
|
sessionId: approval.sessionId,
|
|
183
225
|
reason: DenialReason.USER_DENIED,
|
|
184
|
-
message
|
|
226
|
+
message,
|
|
185
227
|
});
|
|
186
228
|
completeApproval();
|
|
187
229
|
}, [approval, eventBus, completeApproval]);
|
|
@@ -211,8 +253,43 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
211
253
|
}
|
|
212
254
|
return null;
|
|
213
255
|
};
|
|
214
|
-
// Handle model selection
|
|
256
|
+
// Handle model selection (session-only)
|
|
215
257
|
const handleModelSelect = useCallback(async (provider, model, displayName, baseURL, reasoningEffort) => {
|
|
258
|
+
// Session-only switch (default is set via explicit action)
|
|
259
|
+
// Pre-check: Dexto Nova provider requires OAuth login AND API key
|
|
260
|
+
// Check BEFORE closing the overlay so user can pick a different model
|
|
261
|
+
if (provider === 'dexto-nova') {
|
|
262
|
+
try {
|
|
263
|
+
const { canUseDextoProvider } = await import('../../utils/dexto-setup.js');
|
|
264
|
+
const canUse = await canUseDextoProvider();
|
|
265
|
+
if (!canUse) {
|
|
266
|
+
setMessages((prev) => [
|
|
267
|
+
...prev,
|
|
268
|
+
{
|
|
269
|
+
id: generateMessageId('system'),
|
|
270
|
+
role: 'system',
|
|
271
|
+
content: 'Cannot switch to Dexto Nova model - authentication required. Run /login to authenticate.',
|
|
272
|
+
timestamp: new Date(),
|
|
273
|
+
},
|
|
274
|
+
]);
|
|
275
|
+
// Don't close the overlay - let user pick a different model
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
catch (error) {
|
|
280
|
+
setMessages((prev) => [
|
|
281
|
+
...prev,
|
|
282
|
+
{
|
|
283
|
+
id: generateMessageId('error'),
|
|
284
|
+
role: 'system',
|
|
285
|
+
content: `Failed to verify Dexto Nova auth: ${error instanceof Error ? error.message : String(error)}`,
|
|
286
|
+
timestamp: new Date(),
|
|
287
|
+
},
|
|
288
|
+
]);
|
|
289
|
+
// Don't close the overlay - let user pick a different model
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
216
293
|
setUi((prev) => ({ ...prev, activeOverlay: 'none', mcpWizardServerType: null }));
|
|
217
294
|
buffer.setText('');
|
|
218
295
|
setInput((prev) => ({ ...prev, historyIndex: -1 }));
|
|
@@ -252,6 +329,8 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
252
329
|
provider: missingProvider,
|
|
253
330
|
model,
|
|
254
331
|
...(displayName && { displayName }),
|
|
332
|
+
...(baseURL && { baseURL }),
|
|
333
|
+
...(reasoningEffort && { reasoningEffort }),
|
|
255
334
|
},
|
|
256
335
|
}));
|
|
257
336
|
setMessages((prev) => [
|
|
@@ -270,12 +349,99 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
270
349
|
{
|
|
271
350
|
id: generateMessageId('error'),
|
|
272
351
|
role: 'system',
|
|
273
|
-
content:
|
|
352
|
+
content: `Failed to switch model: ${error instanceof Error ? error.message : String(error)}`,
|
|
274
353
|
timestamp: new Date(),
|
|
275
354
|
},
|
|
276
355
|
]);
|
|
277
356
|
}
|
|
278
357
|
}, [setUi, setInput, setMessages, setSession, agent, session.id, buffer]);
|
|
358
|
+
const handleSetDefaultModel = useCallback(async (provider, model, displayName, baseURL, reasoningEffort) => {
|
|
359
|
+
try {
|
|
360
|
+
const preferencesUpdate = {
|
|
361
|
+
provider,
|
|
362
|
+
model,
|
|
363
|
+
...(baseURL ? { baseURL } : {}),
|
|
364
|
+
...(reasoningEffort ? { reasoningEffort } : {}),
|
|
365
|
+
};
|
|
366
|
+
let providerEnvVar;
|
|
367
|
+
try {
|
|
368
|
+
const providerKeyStatus = await getProviderKeyStatus(provider);
|
|
369
|
+
providerEnvVar = providerKeyStatus?.envVar;
|
|
370
|
+
}
|
|
371
|
+
catch (error) {
|
|
372
|
+
agent.logger.debug(`Failed to resolve provider API key env var: ${error instanceof Error ? error.message : String(error)}`);
|
|
373
|
+
}
|
|
374
|
+
let existing = null;
|
|
375
|
+
try {
|
|
376
|
+
existing = await loadGlobalPreferences();
|
|
377
|
+
}
|
|
378
|
+
catch {
|
|
379
|
+
existing = null;
|
|
380
|
+
}
|
|
381
|
+
// Only preserve the API key if the provider hasn't changed
|
|
382
|
+
// If provider changed, use the new provider's env var
|
|
383
|
+
if (existing?.llm.provider === provider && existing?.llm.apiKey) {
|
|
384
|
+
preferencesUpdate.apiKey = existing.llm.apiKey;
|
|
385
|
+
}
|
|
386
|
+
else if (providerEnvVar) {
|
|
387
|
+
preferencesUpdate.apiKey = '$' + providerEnvVar;
|
|
388
|
+
}
|
|
389
|
+
await updateGlobalPreferences({
|
|
390
|
+
llm: preferencesUpdate,
|
|
391
|
+
});
|
|
392
|
+
try {
|
|
393
|
+
await agent.switchLLM({ provider: provider, model, baseURL, reasoningEffort }, session.id || undefined);
|
|
394
|
+
setSession((prev) => ({ ...prev, modelName: displayName || model }));
|
|
395
|
+
setMessages((prev) => [
|
|
396
|
+
...prev,
|
|
397
|
+
{
|
|
398
|
+
id: generateMessageId('system'),
|
|
399
|
+
role: 'system',
|
|
400
|
+
content: `✅ Default model set to ${displayName || model} (${provider})`,
|
|
401
|
+
timestamp: new Date(),
|
|
402
|
+
},
|
|
403
|
+
]);
|
|
404
|
+
}
|
|
405
|
+
catch (error) {
|
|
406
|
+
const missingProvider = isApiKeyMissingError(error);
|
|
407
|
+
if (missingProvider) {
|
|
408
|
+
setUi((prev) => ({
|
|
409
|
+
...prev,
|
|
410
|
+
activeOverlay: 'api-key-input',
|
|
411
|
+
pendingModelSwitch: {
|
|
412
|
+
provider: missingProvider,
|
|
413
|
+
model,
|
|
414
|
+
...(displayName && { displayName }),
|
|
415
|
+
...(baseURL && { baseURL }),
|
|
416
|
+
...(reasoningEffort && { reasoningEffort }),
|
|
417
|
+
},
|
|
418
|
+
}));
|
|
419
|
+
setMessages((prev) => [
|
|
420
|
+
...prev,
|
|
421
|
+
{
|
|
422
|
+
id: generateMessageId('system'),
|
|
423
|
+
role: 'system',
|
|
424
|
+
content: `🔑 API key required for ${provider}`,
|
|
425
|
+
timestamp: new Date(),
|
|
426
|
+
},
|
|
427
|
+
]);
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
throw error;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
catch (error) {
|
|
434
|
+
setMessages((prev) => [
|
|
435
|
+
...prev,
|
|
436
|
+
{
|
|
437
|
+
id: generateMessageId('error'),
|
|
438
|
+
role: 'system',
|
|
439
|
+
content: `Failed to set default model: ${error instanceof Error ? error.message : String(error)}`,
|
|
440
|
+
timestamp: new Date(),
|
|
441
|
+
},
|
|
442
|
+
]);
|
|
443
|
+
}
|
|
444
|
+
}, [agent, setMessages, setSession, setUi, session.id]);
|
|
279
445
|
// State for editing custom model
|
|
280
446
|
const [editingModel, setEditingModel] = useState(null);
|
|
281
447
|
// Handle "Add custom model" from model selector
|
|
@@ -360,7 +526,14 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
360
526
|
timestamp: new Date(),
|
|
361
527
|
},
|
|
362
528
|
]);
|
|
363
|
-
await agent.switchLLM({
|
|
529
|
+
await agent.switchLLM({
|
|
530
|
+
provider: pending.provider,
|
|
531
|
+
model: pending.model,
|
|
532
|
+
...(pending.baseURL && { baseURL: pending.baseURL }),
|
|
533
|
+
...(pending.reasoningEffort && {
|
|
534
|
+
reasoningEffort: pending.reasoningEffort,
|
|
535
|
+
}),
|
|
536
|
+
}, session.id || undefined);
|
|
364
537
|
// Update session state with display name (fallback to model ID)
|
|
365
538
|
setSession((prev) => ({ ...prev, modelName: pendingDisplayName }));
|
|
366
539
|
setMessages((prev) => [
|
|
@@ -379,7 +552,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
379
552
|
{
|
|
380
553
|
id: generateMessageId('error'),
|
|
381
554
|
role: 'system',
|
|
382
|
-
content:
|
|
555
|
+
content: `Failed to switch model: ${error instanceof Error ? error.message : String(error)}`,
|
|
383
556
|
timestamp: new Date(),
|
|
384
557
|
},
|
|
385
558
|
]);
|
|
@@ -443,16 +616,19 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
443
616
|
setMessages([]);
|
|
444
617
|
setApproval(null);
|
|
445
618
|
setApprovalQueue([]);
|
|
446
|
-
|
|
447
|
-
id: newSessionId,
|
|
448
|
-
hasActiveSession: true,
|
|
449
|
-
modelName: session.modelName,
|
|
450
|
-
});
|
|
451
|
-
// Verify session exists
|
|
619
|
+
// Verify session exists first
|
|
452
620
|
const sessionData = await agent.getSession(newSessionId);
|
|
453
621
|
if (!sessionData) {
|
|
454
622
|
throw new Error(`Session ${newSessionId} not found`);
|
|
455
623
|
}
|
|
624
|
+
// Get the actual model being used for this session (respects llmOverride)
|
|
625
|
+
const newSessionConfig = agent.getCurrentLLMConfig(newSessionId);
|
|
626
|
+
const newSessionModelName = getModelDisplayName(newSessionConfig.model, newSessionConfig.provider);
|
|
627
|
+
setSession({
|
|
628
|
+
id: newSessionId,
|
|
629
|
+
hasActiveSession: true,
|
|
630
|
+
modelName: newSessionModelName,
|
|
631
|
+
});
|
|
456
632
|
// Load session history
|
|
457
633
|
const history = await agent.getSessionHistory(newSessionId);
|
|
458
634
|
if (history && history.length > 0) {
|
|
@@ -500,7 +676,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
500
676
|
{
|
|
501
677
|
id: generateMessageId('error'),
|
|
502
678
|
role: 'system',
|
|
503
|
-
content:
|
|
679
|
+
content: `Failed to switch session: ${error instanceof Error ? error.message : String(error)}`,
|
|
504
680
|
timestamp: new Date(),
|
|
505
681
|
},
|
|
506
682
|
]);
|
|
@@ -580,7 +756,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
580
756
|
{
|
|
581
757
|
id: generateMessageId('error'),
|
|
582
758
|
role: 'system',
|
|
583
|
-
content:
|
|
759
|
+
content: `${error instanceof Error ? error.message : String(error)}`,
|
|
584
760
|
timestamp: new Date(),
|
|
585
761
|
},
|
|
586
762
|
]);
|
|
@@ -658,7 +834,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
658
834
|
{
|
|
659
835
|
id: generateMessageId('error'),
|
|
660
836
|
role: 'system',
|
|
661
|
-
content:
|
|
837
|
+
content: `${error instanceof Error ? error.message : String(error)}`,
|
|
662
838
|
timestamp: new Date(),
|
|
663
839
|
},
|
|
664
840
|
]);
|
|
@@ -682,8 +858,20 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
682
858
|
const atIndex = input.value.lastIndexOf('@');
|
|
683
859
|
if (atIndex >= 0) {
|
|
684
860
|
const before = input.value.slice(0, atIndex + 1);
|
|
685
|
-
const uriParts = resource.uri.split(
|
|
686
|
-
|
|
861
|
+
const uriParts = resource.uri.split(/[\\/]/);
|
|
862
|
+
let reference = resource.name || uriParts[uriParts.length - 1] || resource.uri;
|
|
863
|
+
// If it's an absolute path, use relative path as reference to be more descriptive and less bulky
|
|
864
|
+
const rawUri = resource.uri.replace(/^(fs|file):\/\//, ''); // Stripped prefix
|
|
865
|
+
if (path.isAbsolute(rawUri)) {
|
|
866
|
+
try {
|
|
867
|
+
const relativePath = path.relative(process.cwd(), rawUri);
|
|
868
|
+
// Prioritize relative path for local files to avoid ambiguity
|
|
869
|
+
reference = relativePath;
|
|
870
|
+
}
|
|
871
|
+
catch {
|
|
872
|
+
// Keep fallback if relative fails
|
|
873
|
+
}
|
|
874
|
+
}
|
|
687
875
|
const newValue = `${before}${reference} `;
|
|
688
876
|
buffer.setText(newValue);
|
|
689
877
|
setInput((prev) => ({ ...prev, value: newValue }));
|
|
@@ -763,6 +951,8 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
763
951
|
activeOverlay: 'none',
|
|
764
952
|
selectedMcpServer: null,
|
|
765
953
|
mcpWizardServerType: null,
|
|
954
|
+
isProcessing: true,
|
|
955
|
+
isCancelling: false,
|
|
766
956
|
}));
|
|
767
957
|
buffer.setText('');
|
|
768
958
|
setInput((prev) => ({ ...prev, historyIndex: -1 }));
|
|
@@ -795,6 +985,12 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
795
985
|
timestamp: new Date(),
|
|
796
986
|
},
|
|
797
987
|
]);
|
|
988
|
+
setUi((prev) => ({
|
|
989
|
+
...prev,
|
|
990
|
+
isProcessing: false,
|
|
991
|
+
isCancelling: false,
|
|
992
|
+
isThinking: false,
|
|
993
|
+
}));
|
|
798
994
|
return;
|
|
799
995
|
}
|
|
800
996
|
}
|
|
@@ -832,7 +1028,41 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
832
1028
|
{
|
|
833
1029
|
id: generateMessageId('error'),
|
|
834
1030
|
role: 'system',
|
|
835
|
-
content:
|
|
1031
|
+
content: `Failed to ${action.type} server: ${errorMessage}`,
|
|
1032
|
+
timestamp: new Date(),
|
|
1033
|
+
},
|
|
1034
|
+
]);
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
else if (action.type === 'authenticate') {
|
|
1038
|
+
setMessages((prev) => [
|
|
1039
|
+
...prev,
|
|
1040
|
+
{
|
|
1041
|
+
id: generateMessageId('system'),
|
|
1042
|
+
role: 'system',
|
|
1043
|
+
content: `🔐 Authenticating ${server.name}...`,
|
|
1044
|
+
timestamp: new Date(),
|
|
1045
|
+
},
|
|
1046
|
+
]);
|
|
1047
|
+
try {
|
|
1048
|
+
await agent.restartMcpServer(server.name);
|
|
1049
|
+
setMessages((prev) => [
|
|
1050
|
+
...prev,
|
|
1051
|
+
{
|
|
1052
|
+
id: generateMessageId('system'),
|
|
1053
|
+
role: 'system',
|
|
1054
|
+
content: `✅ Authenticated ${server.name}`,
|
|
1055
|
+
timestamp: new Date(),
|
|
1056
|
+
},
|
|
1057
|
+
]);
|
|
1058
|
+
}
|
|
1059
|
+
catch (error) {
|
|
1060
|
+
setMessages((prev) => [
|
|
1061
|
+
...prev,
|
|
1062
|
+
{
|
|
1063
|
+
id: generateMessageId('error'),
|
|
1064
|
+
role: 'system',
|
|
1065
|
+
content: `Failed to authenticate server: ${error instanceof Error ? error.message : String(error)}`,
|
|
836
1066
|
timestamp: new Date(),
|
|
837
1067
|
},
|
|
838
1068
|
]);
|
|
@@ -876,12 +1106,18 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
876
1106
|
{
|
|
877
1107
|
id: generateMessageId('error'),
|
|
878
1108
|
role: 'system',
|
|
879
|
-
content:
|
|
1109
|
+
content: `Failed to delete server: ${error instanceof Error ? error.message : String(error)}`,
|
|
880
1110
|
timestamp: new Date(),
|
|
881
1111
|
},
|
|
882
1112
|
]);
|
|
883
1113
|
}
|
|
884
1114
|
}
|
|
1115
|
+
setUi((prev) => ({
|
|
1116
|
+
...prev,
|
|
1117
|
+
isProcessing: false,
|
|
1118
|
+
isCancelling: false,
|
|
1119
|
+
isThinking: false,
|
|
1120
|
+
}));
|
|
885
1121
|
}, [setUi, setInput, setMessages, agent, buffer]);
|
|
886
1122
|
// Handle MCP add choice (registry/custom/back)
|
|
887
1123
|
const handleMcpAddChoice = useCallback((choice) => {
|
|
@@ -947,7 +1183,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
947
1183
|
{
|
|
948
1184
|
id: generateMessageId('system'),
|
|
949
1185
|
role: 'system',
|
|
950
|
-
content:
|
|
1186
|
+
content: `Failed to connect: ${error instanceof Error ? error.message : String(error)}`,
|
|
951
1187
|
timestamp: new Date(),
|
|
952
1188
|
},
|
|
953
1189
|
]);
|
|
@@ -1028,7 +1264,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1028
1264
|
{
|
|
1029
1265
|
id: generateMessageId('system'),
|
|
1030
1266
|
role: 'system',
|
|
1031
|
-
content:
|
|
1267
|
+
content: `Failed to connect: ${error instanceof Error ? error.message : String(error)}`,
|
|
1032
1268
|
timestamp: new Date(),
|
|
1033
1269
|
},
|
|
1034
1270
|
]);
|
|
@@ -1040,6 +1276,120 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1040
1276
|
isThinking: false,
|
|
1041
1277
|
}));
|
|
1042
1278
|
}, [setUi, setInput, setMessages, agent, buffer]);
|
|
1279
|
+
// Handle plugin manager actions
|
|
1280
|
+
const handlePluginManagerAction = useCallback((action) => {
|
|
1281
|
+
if (action === 'list') {
|
|
1282
|
+
setUi((prev) => ({
|
|
1283
|
+
...prev,
|
|
1284
|
+
activeOverlay: 'plugin-list',
|
|
1285
|
+
}));
|
|
1286
|
+
}
|
|
1287
|
+
else if (action === 'marketplace') {
|
|
1288
|
+
setUi((prev) => ({
|
|
1289
|
+
...prev,
|
|
1290
|
+
activeOverlay: 'marketplace-browser',
|
|
1291
|
+
}));
|
|
1292
|
+
}
|
|
1293
|
+
}, [setUi]);
|
|
1294
|
+
// Handle plugin selection from plugin list
|
|
1295
|
+
const handlePluginSelect = useCallback((plugin) => {
|
|
1296
|
+
setSelectedPlugin(plugin);
|
|
1297
|
+
setUi((prev) => ({
|
|
1298
|
+
...prev,
|
|
1299
|
+
activeOverlay: 'plugin-actions',
|
|
1300
|
+
}));
|
|
1301
|
+
}, [setUi]);
|
|
1302
|
+
// Handle plugin actions (uninstall, back)
|
|
1303
|
+
const handlePluginAction = useCallback(async (action) => {
|
|
1304
|
+
if (action.type === 'back') {
|
|
1305
|
+
setSelectedPlugin(null);
|
|
1306
|
+
setUi((prev) => ({
|
|
1307
|
+
...prev,
|
|
1308
|
+
activeOverlay: 'plugin-list',
|
|
1309
|
+
}));
|
|
1310
|
+
return;
|
|
1311
|
+
}
|
|
1312
|
+
if (action.type === 'uninstall') {
|
|
1313
|
+
setUi((prev) => ({ ...prev, activeOverlay: 'none', isProcessing: true }));
|
|
1314
|
+
try {
|
|
1315
|
+
const { uninstallPlugin, reloadAgentConfigFromFile, enrichAgentConfig } = await import('@dexto/agent-management');
|
|
1316
|
+
await uninstallPlugin(action.plugin.name);
|
|
1317
|
+
setMessages((prev) => [
|
|
1318
|
+
...prev,
|
|
1319
|
+
{
|
|
1320
|
+
id: generateMessageId('system'),
|
|
1321
|
+
role: 'system',
|
|
1322
|
+
content: `Plugin '${action.plugin.name}' has been uninstalled.`,
|
|
1323
|
+
timestamp: new Date(),
|
|
1324
|
+
},
|
|
1325
|
+
]);
|
|
1326
|
+
// Refresh prompts to remove uninstalled plugin skills
|
|
1327
|
+
try {
|
|
1328
|
+
const newConfig = await reloadAgentConfigFromFile(agent.getAgentFilePath());
|
|
1329
|
+
const enrichedConfig = enrichAgentConfig(newConfig, agent.getAgentFilePath());
|
|
1330
|
+
await agent.refreshPrompts(enrichedConfig.prompts);
|
|
1331
|
+
}
|
|
1332
|
+
catch {
|
|
1333
|
+
// Non-critical: prompts will refresh on next agent restart
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
catch (error) {
|
|
1337
|
+
setMessages((prev) => [
|
|
1338
|
+
...prev,
|
|
1339
|
+
{
|
|
1340
|
+
id: generateMessageId('error'),
|
|
1341
|
+
role: 'system',
|
|
1342
|
+
content: `Failed to uninstall plugin: ${error instanceof Error ? error.message : String(error)}`,
|
|
1343
|
+
timestamp: new Date(),
|
|
1344
|
+
},
|
|
1345
|
+
]);
|
|
1346
|
+
}
|
|
1347
|
+
setSelectedPlugin(null);
|
|
1348
|
+
setUi((prev) => ({ ...prev, isProcessing: false }));
|
|
1349
|
+
}
|
|
1350
|
+
}, [setUi, setMessages, agent]);
|
|
1351
|
+
// Handle marketplace browser actions
|
|
1352
|
+
const handleMarketplaceBrowserAction = useCallback(async (action) => {
|
|
1353
|
+
if (action.type === 'add-marketplace') {
|
|
1354
|
+
setUi((prev) => ({ ...prev, activeOverlay: 'marketplace-add' }));
|
|
1355
|
+
}
|
|
1356
|
+
else if (action.type === 'plugin-installed') {
|
|
1357
|
+
setUi((prev) => ({ ...prev, activeOverlay: 'none' }));
|
|
1358
|
+
setMessages((prev) => [
|
|
1359
|
+
...prev,
|
|
1360
|
+
{
|
|
1361
|
+
id: generateMessageId('system'),
|
|
1362
|
+
role: 'system',
|
|
1363
|
+
content: `✅ Plugin '${action.pluginName}' installed from ${action.marketplace}`,
|
|
1364
|
+
timestamp: new Date(),
|
|
1365
|
+
},
|
|
1366
|
+
]);
|
|
1367
|
+
// Refresh prompts to include new plugin skills
|
|
1368
|
+
try {
|
|
1369
|
+
const { reloadAgentConfigFromFile, enrichAgentConfig } = await import('@dexto/agent-management');
|
|
1370
|
+
const newConfig = await reloadAgentConfigFromFile(agent.getAgentFilePath());
|
|
1371
|
+
const enrichedConfig = enrichAgentConfig(newConfig, agent.getAgentFilePath());
|
|
1372
|
+
await agent.refreshPrompts(enrichedConfig.prompts);
|
|
1373
|
+
}
|
|
1374
|
+
catch (error) {
|
|
1375
|
+
// Non-critical: prompts will refresh on next agent restart
|
|
1376
|
+
// Log but don't show error to user
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
}, [setUi, setMessages, agent]);
|
|
1380
|
+
// Handle marketplace add completion
|
|
1381
|
+
const handleMarketplaceAddComplete = useCallback((name, pluginCount) => {
|
|
1382
|
+
setUi((prev) => ({ ...prev, activeOverlay: 'marketplace-browser' }));
|
|
1383
|
+
setMessages((prev) => [
|
|
1384
|
+
...prev,
|
|
1385
|
+
{
|
|
1386
|
+
id: generateMessageId('system'),
|
|
1387
|
+
role: 'system',
|
|
1388
|
+
content: `✅ Marketplace '${name}' added (${pluginCount} plugins found)`,
|
|
1389
|
+
timestamp: new Date(),
|
|
1390
|
+
},
|
|
1391
|
+
]);
|
|
1392
|
+
}, [setUi, setMessages]);
|
|
1043
1393
|
// Handle session subcommand selection
|
|
1044
1394
|
const handleSessionSubcommandSelect = useCallback(async (action) => {
|
|
1045
1395
|
if (action === 'switch') {
|
|
@@ -1094,7 +1444,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1094
1444
|
{
|
|
1095
1445
|
id: generateMessageId('error'),
|
|
1096
1446
|
role: 'system',
|
|
1097
|
-
content:
|
|
1447
|
+
content: `${error instanceof Error ? error.message : String(error)}`,
|
|
1098
1448
|
timestamp: new Date(),
|
|
1099
1449
|
},
|
|
1100
1450
|
]);
|
|
@@ -1279,7 +1629,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1279
1629
|
{
|
|
1280
1630
|
id: generateMessageId('error'),
|
|
1281
1631
|
role: 'system',
|
|
1282
|
-
content:
|
|
1632
|
+
content: `Failed to create prompt: ${error instanceof Error ? error.message : String(error)}`,
|
|
1283
1633
|
timestamp: new Date(),
|
|
1284
1634
|
},
|
|
1285
1635
|
]);
|
|
@@ -1338,7 +1688,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1338
1688
|
{
|
|
1339
1689
|
id: generateMessageId('error'),
|
|
1340
1690
|
role: 'system',
|
|
1341
|
-
content:
|
|
1691
|
+
content: `Failed to delete prompt: ${error instanceof Error ? error.message : String(error)}`,
|
|
1342
1692
|
timestamp: new Date(),
|
|
1343
1693
|
},
|
|
1344
1694
|
]);
|
|
@@ -1406,7 +1756,7 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1406
1756
|
{
|
|
1407
1757
|
id: generateMessageId('error'),
|
|
1408
1758
|
role: 'system',
|
|
1409
|
-
content:
|
|
1759
|
+
content: `Failed to rename session: ${error instanceof Error ? error.message : String(error)}`,
|
|
1410
1760
|
timestamp: new Date(),
|
|
1411
1761
|
},
|
|
1412
1762
|
]);
|
|
@@ -1416,8 +1766,14 @@ export const OverlayContainer = forwardRef(function OverlayContainer({ ui, input
|
|
|
1416
1766
|
const handleSessionRenameClose = useCallback(() => {
|
|
1417
1767
|
setUi((prev) => ({ ...prev, activeOverlay: 'none' }));
|
|
1418
1768
|
}, [setUi]);
|
|
1419
|
-
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 }) })), 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: () => {
|
|
1769
|
+
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: () => {
|
|
1420
1770
|
setEditingModel(null);
|
|
1421
1771
|
handleClose();
|
|
1422
|
-
}, initialModel: editingModel })), ui.activeOverlay === '
|
|
1772
|
+
}, 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: () => {
|
|
1773
|
+
setSelectedPlugin(null);
|
|
1774
|
+
setUi((prev) => ({
|
|
1775
|
+
...prev,
|
|
1776
|
+
activeOverlay: 'plugin-list',
|
|
1777
|
+
}));
|
|
1778
|
+
} }) })), ui.activeOverlay === 'marketplace-browser' && (_jsx(Box, { marginTop: 1, children: _jsx(MarketplaceBrowser, { ref: marketplaceBrowserRef, isVisible: true, onAction: handleMarketplaceBrowserAction, onClose: handleClose }) })), ui.activeOverlay === 'marketplace-add' && (_jsx(Box, { marginTop: 1, children: _jsx(MarketplaceAddPrompt, { ref: marketplaceAddPromptRef, isVisible: true, onComplete: handleMarketplaceAddComplete, onClose: () => setUi((prev) => ({ ...prev, activeOverlay: 'marketplace-browser' })) }) })), ui.activeOverlay === 'session-subcommand-selector' && (_jsx(Box, { marginTop: 1, children: _jsx(SessionSubcommandSelector, { ref: sessionSubcommandSelectorRef, isVisible: true, onSelect: handleSessionSubcommandSelect, onClose: handleClose }) })), ui.activeOverlay === 'api-key-input' && ui.pendingModelSwitch && (_jsx(ApiKeyInput, { ref: apiKeyInputRef, isVisible: true, provider: ui.pendingModelSwitch.provider, onSaved: handleApiKeySaved, onClose: handleApiKeyClose })), ui.activeOverlay === 'search' && (_jsx(SearchOverlay, { ref: searchOverlayRef, isVisible: true, agent: agent, onClose: handleClose, onSelectResult: handleSearchResultSelect })), ui.activeOverlay === 'prompt-list' && (_jsx(Box, { marginTop: 1, children: _jsx(PromptList, { ref: promptListRef, isVisible: true, onAction: handlePromptListAction, onLoadIntoInput: handlePromptLoadIntoInput, onClose: handleClose, agent: agent }) })), ui.activeOverlay === 'prompt-add-choice' && (_jsx(Box, { marginTop: 1, children: _jsx(PromptAddChoice, { ref: promptAddChoiceRef, isVisible: true, onSelect: handlePromptAddChoice, onClose: handlePromptAddChoiceClose }) })), ui.activeOverlay === 'prompt-add-wizard' && ui.promptAddWizard && (_jsx(PromptAddWizard, { ref: promptAddWizardRef, isVisible: true, scope: ui.promptAddWizard.scope, onComplete: handlePromptAddComplete, onClose: handlePromptAddWizardClose })), ui.activeOverlay === 'prompt-delete-selector' && (_jsx(Box, { marginTop: 1, children: _jsx(PromptDeleteSelector, { ref: promptDeleteSelectorRef, isVisible: true, onDelete: handlePromptDelete, onClose: handlePromptDeleteClose, agent: agent }) })), ui.activeOverlay === 'session-rename' && (_jsx(SessionRenameOverlay, { ref: sessionRenameRef, isVisible: true, currentTitle: currentSessionTitle, onRename: handleSessionRename, onClose: handleSessionRenameClose })), ui.activeOverlay === 'context-stats' && session.id && (_jsx(Box, { marginTop: 1, children: _jsx(ContextStatsOverlay, { ref: contextStatsRef, isVisible: true, onClose: handleClose, agent: agent, sessionId: session.id ?? '' }) })), ui.activeOverlay === 'export-wizard' && (_jsx(ExportWizard, { ref: exportWizardRef, isVisible: true, agent: agent, sessionId: session.id, onClose: handleClose }))] }));
|
|
1423
1779
|
});
|
|
@@ -6,6 +6,7 @@ export { useKeyboardShortcuts } from './useKeyboardShortcuts.js';
|
|
|
6
6
|
export { useInputOrchestrator, createApprovalInputHandler, createSelectorInputHandler, createAutocompleteInputHandler, createMainInputHandler, type InputHandler, type InputHandlers, type UseInputOrchestratorProps, type ApprovalHandlerProps, type SelectorHandlerProps, type AutocompleteHandlerProps, type MainInputHandlerProps, } from './useInputOrchestrator.js';
|
|
7
7
|
export { useKeypress } from './useKeypress.js';
|
|
8
8
|
export { useTerminalSize, type TerminalSize } from './useTerminalSize.js';
|
|
9
|
+
export { useGitBranch } from './useGitBranch.js';
|
|
9
10
|
export { useCLIState, type UseCLIStateProps, type CLIStateReturn, type UIState, type InputState, type SessionState, } from './useCLIState.js';
|
|
10
11
|
export type { Key } from './useInputOrchestrator.js';
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|