dexto 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -7
- package/dist/agents/agent-template.yml +2 -2
- package/dist/agents/coding-agent/coding-agent.yml +22 -16
- package/dist/agents/database-agent/database-agent.yml +2 -2
- package/dist/agents/default-agent.yml +7 -5
- package/dist/agents/github-agent/github-agent.yml +2 -2
- package/dist/agents/product-name-researcher/product-name-researcher.yml +2 -2
- package/dist/agents/talk2pdf-agent/talk2pdf-agent.yml +2 -2
- package/dist/analytics/events.d.ts +13 -6
- package/dist/analytics/events.d.ts.map +1 -1
- package/dist/analytics/index.d.ts +1 -1
- package/dist/analytics/index.d.ts.map +1 -1
- package/dist/analytics/index.js +6 -2
- package/dist/api/server-hono.d.ts.map +1 -1
- package/dist/api/server-hono.js +27 -5
- package/dist/cli/cli-subscriber.d.ts +4 -0
- package/dist/cli/cli-subscriber.d.ts.map +1 -1
- package/dist/cli/cli-subscriber.js +40 -2
- package/dist/cli/commands/create-app.d.ts +16 -14
- package/dist/cli/commands/create-app.d.ts.map +1 -1
- package/dist/cli/commands/create-app.js +626 -102
- package/dist/cli/commands/create-image.d.ts +7 -0
- package/dist/cli/commands/create-image.d.ts.map +1 -0
- package/dist/cli/commands/create-image.js +201 -0
- package/dist/cli/commands/helpers/formatters.js +7 -7
- package/dist/cli/commands/index.d.ts +2 -1
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +2 -1
- package/dist/cli/commands/init-app.js +7 -7
- package/dist/cli/commands/install.d.ts +0 -3
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +10 -35
- package/dist/cli/commands/interactive-commands/command-parser.d.ts +1 -1
- package/dist/cli/commands/interactive-commands/command-parser.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/command-parser.js +18 -8
- package/dist/cli/commands/interactive-commands/general-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/general-commands.js +64 -1
- package/dist/cli/commands/interactive-commands/prompt-commands.js +11 -11
- package/dist/cli/commands/interactive-commands/system/system-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/system/system-commands.js +6 -5
- package/dist/cli/commands/list-agents.js +2 -2
- package/dist/cli/commands/session-commands.js +16 -16
- package/dist/cli/commands/setup.d.ts +13 -5
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +995 -65
- package/dist/cli/commands/which.js +1 -1
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts +2 -0
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ApprovalPrompt.js +29 -7
- package/dist/cli/ink-cli/components/CustomInput.js +1 -1
- package/dist/cli/ink-cli/components/EditableMultiLineInput.js +4 -4
- package/dist/cli/ink-cli/components/ElicitationForm.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ElicitationForm.js +6 -6
- package/dist/cli/ink-cli/components/ErrorBoundary.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ErrorBoundary.js +1 -1
- package/dist/cli/ink-cli/components/Footer.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/Footer.js +1 -1
- package/dist/cli/ink-cli/components/HistorySearchBar.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/HistorySearchBar.js +1 -1
- package/dist/cli/ink-cli/components/MultiLineInput.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/MultiLineInput.js +3 -3
- package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ResourceAutocomplete.js +4 -4
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.js +3 -3
- package/dist/cli/ink-cli/components/StatusBar.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/StatusBar.js +7 -5
- package/dist/cli/ink-cli/components/TextBufferInput.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/TextBufferInput.js +13 -9
- package/dist/cli/ink-cli/components/base/BaseAutocomplete.js +4 -4
- package/dist/cli/ink-cli/components/base/BaseSelector.js +2 -2
- package/dist/cli/ink-cli/components/chat/Footer.js +1 -1
- package/dist/cli/ink-cli/components/chat/Header.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/Header.js +2 -4
- package/dist/cli/ink-cli/components/chat/MessageItem.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/MessageItem.js +9 -6
- package/dist/cli/ink-cli/components/chat/MessageList.js +1 -1
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.js +1 -1
- package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts +1 -1
- package/dist/cli/ink-cli/components/chat/ToolIcon.js +4 -4
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.js +1 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.js +1 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.js +2 -2
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.js +5 -5
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.js +2 -2
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.js +1 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.js +1 -1
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.js +2 -2
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.js +1 -1
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/modes/StaticCLI.js +1 -1
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.js +1 -1
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts +10 -2
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.js +209 -89
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.js +2 -2
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.js +1 -1
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.js +1 -1
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.js +2 -2
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.js +1 -1
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.js +1 -1
- package/dist/cli/ink-cli/components/overlays/McpSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/McpSelector.js +1 -1
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/McpServerActions.js +2 -2
- package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/McpServerList.js +1 -1
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts +6 -5
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.js +284 -68
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.js +2 -2
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.js +1 -1
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.js +2 -2
- package/dist/cli/ink-cli/components/overlays/PromptList.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/PromptList.js +2 -2
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.js +4 -4
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.js +1 -1
- package/dist/cli/ink-cli/components/overlays/StreamSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/StreamSelector.js +1 -1
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.js +12 -12
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.d.ts +25 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.js +609 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.d.ts +15 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/index.js +14 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts +33 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/provider-config.js +462 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.d.ts +25 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ApiKeyStep.js +29 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.d.ts +17 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/ProviderSelector.js +11 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.d.ts +20 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/SetupInfoBanner.js +10 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.d.ts +30 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/WizardStepInput.js +13 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.d.ts +8 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/shared/index.js +7 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.d.ts +85 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/types.js +38 -0
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.js +2 -2
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.js +1 -1
- package/dist/cli/ink-cli/components/renderers/FileRenderer.js +4 -4
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.js +2 -2
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.js +1 -1
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.js +3 -3
- package/dist/cli/ink-cli/components/renderers/diff-shared.js +1 -1
- package/dist/cli/ink-cli/components/shared/MarkdownText.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/shared/MarkdownText.js +8 -6
- package/dist/cli/ink-cli/containers/InputContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/InputContainer.js +23 -1
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/OverlayContainer.js +81 -25
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts +9 -2
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useAgentEvents.js +148 -6
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts +1 -1
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useCLIState.js +7 -2
- package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts +11 -7
- package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useTokenCounter.js +41 -18
- package/dist/cli/ink-cli/services/processStream.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/processStream.js +97 -17
- package/dist/cli/ink-cli/state/types.d.ts +5 -4
- package/dist/cli/ink-cli/state/types.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts +5 -0
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/messageFormatting.js +59 -1
- package/dist/cli/ink-cli/utils/toolUtils.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/toolUtils.js +2 -0
- package/dist/cli/utils/api-key-setup.d.ts +54 -4
- package/dist/cli/utils/api-key-setup.d.ts.map +1 -1
- package/dist/cli/utils/api-key-setup.js +433 -107
- package/dist/cli/utils/api-key-verification.d.ts +17 -0
- package/dist/cli/utils/api-key-verification.d.ts.map +1 -0
- package/dist/cli/utils/api-key-verification.js +211 -0
- package/dist/cli/utils/config-validation.d.ts +22 -2
- package/dist/cli/utils/config-validation.d.ts.map +1 -1
- package/dist/cli/utils/config-validation.js +354 -25
- package/dist/cli/utils/local-model-setup.d.ts +46 -0
- package/dist/cli/utils/local-model-setup.d.ts.map +1 -0
- package/dist/cli/utils/local-model-setup.js +662 -0
- package/dist/cli/utils/options.js +1 -1
- package/dist/cli/utils/prompt-helpers.d.ts +47 -0
- package/dist/cli/utils/prompt-helpers.d.ts.map +1 -0
- package/dist/cli/utils/prompt-helpers.js +66 -0
- package/dist/cli/utils/provider-setup.d.ts +66 -8
- package/dist/cli/utils/provider-setup.d.ts.map +1 -1
- package/dist/cli/utils/provider-setup.js +324 -84
- package/dist/cli/utils/scaffolding-utils.d.ts +76 -0
- package/dist/cli/utils/scaffolding-utils.d.ts.map +1 -0
- package/dist/cli/utils/scaffolding-utils.js +246 -0
- package/dist/cli/utils/setup-utils.d.ts +16 -0
- package/dist/cli/utils/setup-utils.d.ts.map +1 -1
- package/dist/cli/utils/setup-utils.js +72 -21
- package/dist/cli/utils/template-engine.d.ts +65 -0
- package/dist/cli/utils/template-engine.d.ts.map +1 -0
- package/dist/cli/utils/template-engine.js +1089 -0
- package/dist/config/cli-overrides.d.ts +44 -1
- package/dist/config/cli-overrides.d.ts.map +1 -1
- package/dist/config/cli-overrides.js +102 -0
- package/dist/index.js +339 -56
- package/dist/webui/assets/index-8j-KMkX1.js +2054 -0
- package/dist/webui/assets/index-c_AX24V4.css +1 -0
- package/dist/webui/index.html +3 -9
- package/dist/webui/logos/aws-color.svg +1 -0
- package/dist/webui/logos/dexto/dexto_logo.svg +1 -1
- package/dist/webui/logos/dexto/dexto_logo_light.svg +6 -6
- package/dist/webui/logos/glama.svg +7 -0
- package/dist/webui/logos/litellm.svg +7 -0
- package/dist/webui/logos/openrouter.svg +1 -0
- package/package.json +8 -7
- package/dist/webui/assets/index-BkwPkZpd.css +0 -1
- package/dist/webui/assets/index-D9u1XfyH.js +0 -2025
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* useTokenCounter Hook
|
|
3
|
-
* Tracks token usage during streaming with live estimates
|
|
3
|
+
* Tracks token usage during streaming with live estimates
|
|
4
4
|
*
|
|
5
5
|
* Accumulation strategy for multi-step turns:
|
|
6
|
-
* -
|
|
6
|
+
* - lastInputTokens: Input tokens from the most recent LLM call (not summed to avoid double-counting)
|
|
7
|
+
* - cumulativeOutputTokens: Sum of output tokens across all LLM calls in the turn
|
|
7
8
|
* - currentSegmentEstimate: Estimated tokens for current streaming segment
|
|
8
|
-
* - Display =
|
|
9
|
+
* - Display = lastInput + cumulativeOutput + currentEstimate
|
|
10
|
+
*
|
|
11
|
+
* This approach avoids double-counting shared context (system prompt, history) across
|
|
12
|
+
* multiple LLM calls in a single turn while accurately capturing output generation.
|
|
9
13
|
*
|
|
10
14
|
* For queued messages: Tokens continue accumulating (same turn)
|
|
11
15
|
* Reset only when isActive transitions false→true (new turn)
|
|
@@ -21,25 +25,29 @@ function estimateTokens(charCount) {
|
|
|
21
25
|
}
|
|
22
26
|
/**
|
|
23
27
|
* Format token count for display
|
|
28
|
+
* Only shows count when >= 1000, using x.xK format
|
|
24
29
|
*/
|
|
25
30
|
function formatTokenCount(count, includesEstimate) {
|
|
26
|
-
if (count
|
|
31
|
+
if (count < 1000)
|
|
27
32
|
return '';
|
|
28
33
|
const prefix = includesEstimate ? '~' : '';
|
|
29
|
-
|
|
34
|
+
const kValue = (count / 1000).toFixed(1);
|
|
35
|
+
return `${prefix}${kValue}K tokens`;
|
|
30
36
|
}
|
|
31
37
|
/**
|
|
32
38
|
* Hook that tracks token usage during LLM streaming
|
|
33
39
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
40
|
+
* Tracks tokens across multi-step turns (text → tool → text → tool)
|
|
41
|
+
* using: lastInputTokens + cumulativeOutputTokens to avoid double-counting.
|
|
36
42
|
*
|
|
37
43
|
* @param options - Configuration options
|
|
38
|
-
* @returns Token counts (
|
|
44
|
+
* @returns Token counts (actual + current segment estimate)
|
|
39
45
|
*/
|
|
40
46
|
export function useTokenCounter({ agent, isActive }) {
|
|
41
|
-
//
|
|
42
|
-
const [
|
|
47
|
+
// Input tokens from the most recent LLM response (replaced, not summed)
|
|
48
|
+
const [lastInputTokens, setLastInputTokens] = useState(0);
|
|
49
|
+
// Cumulative output tokens across all LLM responses in this turn
|
|
50
|
+
const [cumulativeOutputTokens, setCumulativeOutputTokens] = useState(0);
|
|
43
51
|
// Estimated tokens for current streaming segment (resets after each response)
|
|
44
52
|
const [currentSegmentEstimate, setCurrentSegmentEstimate] = useState(0);
|
|
45
53
|
// Character count for current segment (ref to avoid re-renders on each chunk)
|
|
@@ -47,7 +55,8 @@ export function useTokenCounter({ agent, isActive }) {
|
|
|
47
55
|
useEffect(() => {
|
|
48
56
|
if (!isActive) {
|
|
49
57
|
// Reset when turn ends (isActive becomes false)
|
|
50
|
-
|
|
58
|
+
setLastInputTokens(0);
|
|
59
|
+
setCumulativeOutputTokens(0);
|
|
51
60
|
setCurrentSegmentEstimate(0);
|
|
52
61
|
currentCharCountRef.current = 0;
|
|
53
62
|
return;
|
|
@@ -56,9 +65,9 @@ export function useTokenCounter({ agent, isActive }) {
|
|
|
56
65
|
const controller = new AbortController();
|
|
57
66
|
const { signal } = controller;
|
|
58
67
|
// Reset on new turn (isActive just became true)
|
|
59
|
-
// This handles the transition from inactive to active
|
|
60
68
|
currentCharCountRef.current = 0;
|
|
61
|
-
|
|
69
|
+
setLastInputTokens(0);
|
|
70
|
+
setCumulativeOutputTokens(0);
|
|
62
71
|
setCurrentSegmentEstimate(0);
|
|
63
72
|
// Track streaming chunks - accumulate estimate for current segment
|
|
64
73
|
bus.on('llm:chunk', (payload) => {
|
|
@@ -67,11 +76,23 @@ export function useTokenCounter({ agent, isActive }) {
|
|
|
67
76
|
setCurrentSegmentEstimate(estimateTokens(currentCharCountRef.current));
|
|
68
77
|
}
|
|
69
78
|
}, { signal });
|
|
70
|
-
// On response:
|
|
79
|
+
// On response: update input (replace), accumulate output, reset estimate
|
|
71
80
|
bus.on('llm:response', (payload) => {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
81
|
+
const usage = payload.tokenUsage;
|
|
82
|
+
if (usage) {
|
|
83
|
+
// Replace input tokens (most recent call's context)
|
|
84
|
+
// Subtract cacheWriteTokens to exclude system prompt on first call
|
|
85
|
+
const rawInputTokens = usage.inputTokens ?? 0;
|
|
86
|
+
const cacheWriteTokens = usage.cacheWriteTokens ?? 0;
|
|
87
|
+
const inputTokens = Math.max(0, rawInputTokens - cacheWriteTokens);
|
|
88
|
+
if (inputTokens > 0) {
|
|
89
|
+
setLastInputTokens(inputTokens);
|
|
90
|
+
}
|
|
91
|
+
// Accumulate output tokens (additive across calls)
|
|
92
|
+
const outputTokens = usage.outputTokens ?? 0;
|
|
93
|
+
if (outputTokens > 0) {
|
|
94
|
+
setCumulativeOutputTokens((prev) => prev + outputTokens);
|
|
95
|
+
}
|
|
75
96
|
}
|
|
76
97
|
// Reset current segment for next streaming segment
|
|
77
98
|
currentCharCountRef.current = 0;
|
|
@@ -83,7 +104,9 @@ export function useTokenCounter({ agent, isActive }) {
|
|
|
83
104
|
controller.abort();
|
|
84
105
|
};
|
|
85
106
|
}, [agent, isActive]);
|
|
86
|
-
//
|
|
107
|
+
// Total = lastInput + cumulativeOutput (avoids double-counting shared context)
|
|
108
|
+
const totalActualTokens = lastInputTokens + cumulativeOutputTokens;
|
|
109
|
+
// Display = actual + current streaming estimate
|
|
87
110
|
const displayCount = totalActualTokens + currentSegmentEstimate;
|
|
88
111
|
const includesEstimate = currentSegmentEstimate > 0;
|
|
89
112
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processStream.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/services/processStream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAuB,MAAM,aAAa,CAAC;AAGvE,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAc,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"processStream.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/services/processStream.ts"],"names":[],"mappings":"AAAA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QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAC1C,qDAAqD;IACrD,QAAQ,EAAE,OAAO,aAAa,EAAE,aAAa,CAAC;CACjD;AA0BD;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CAC/B,QAAQ,EAAE,qBAAqB,CAAC,cAAc,CAAC,EAC/C,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE,oBAAoB,GAC9B,OAAO,CAAC,IAAI,CAAC,CA+xBf"}
|
|
@@ -23,8 +23,23 @@ import { createDebugLogger } from '../utils/debugLog.js';
|
|
|
23
23
|
import { ApprovalType as ApprovalTypeEnum, ApprovalStatus } from '@dexto/core';
|
|
24
24
|
import { generateMessageId } from '../utils/idGenerator.js';
|
|
25
25
|
import { checkForSplit } from '../utils/streamSplitter.js';
|
|
26
|
-
import { getToolDisplayName, formatToolArgsForDisplay } from '../utils/messageFormatting.js';
|
|
26
|
+
import { getToolDisplayName, formatToolArgsForDisplay, getToolTypeBadge, } from '../utils/messageFormatting.js';
|
|
27
27
|
import { isEditWriteTool } from '../utils/toolUtils.js';
|
|
28
|
+
import { capture } from '../../../analytics/index.js';
|
|
29
|
+
import chalk from 'chalk';
|
|
30
|
+
/**
|
|
31
|
+
* Build error message with recovery guidance if available
|
|
32
|
+
*/
|
|
33
|
+
function buildErrorContent(error, prefix) {
|
|
34
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
35
|
+
let errorContent = `${prefix}${errorMessage}`;
|
|
36
|
+
// Add recovery guidance if available (for DextoRuntimeError)
|
|
37
|
+
if (error instanceof Error && 'recovery' in error && error.recovery) {
|
|
38
|
+
const recoveryMessages = Array.isArray(error.recovery) ? error.recovery : [error.recovery];
|
|
39
|
+
errorContent += '\n\n' + recoveryMessages.map((msg) => `💡 ${msg}`).join('\n');
|
|
40
|
+
}
|
|
41
|
+
return errorContent;
|
|
42
|
+
}
|
|
28
43
|
/**
|
|
29
44
|
* Processes the async iterator from agent.stream() and updates UI state.
|
|
30
45
|
*
|
|
@@ -43,7 +58,8 @@ export async function processStream(iterator, setters, options) {
|
|
|
43
58
|
const state = {
|
|
44
59
|
messageId: null,
|
|
45
60
|
content: '',
|
|
46
|
-
|
|
61
|
+
lastInputTokens: 0,
|
|
62
|
+
cumulativeOutputTokens: 0,
|
|
47
63
|
finalizedContent: '',
|
|
48
64
|
splitCounter: 0,
|
|
49
65
|
textFinalizedBeforeTool: false,
|
|
@@ -224,7 +240,8 @@ export async function processStream(iterator, setters, options) {
|
|
|
224
240
|
setUi((prev) => ({ ...prev, isThinking: true }));
|
|
225
241
|
state.messageId = null;
|
|
226
242
|
state.content = '';
|
|
227
|
-
state.
|
|
243
|
+
state.lastInputTokens = 0;
|
|
244
|
+
state.cumulativeOutputTokens = 0;
|
|
228
245
|
state.finalizedContent = '';
|
|
229
246
|
state.splitCounter = 0;
|
|
230
247
|
state.textFinalizedBeforeTool = false;
|
|
@@ -299,9 +316,34 @@ export async function processStream(iterator, setters, options) {
|
|
|
299
316
|
if (!useStreaming) {
|
|
300
317
|
setUi((prev) => ({ ...prev, isThinking: false }));
|
|
301
318
|
}
|
|
302
|
-
//
|
|
303
|
-
|
|
304
|
-
|
|
319
|
+
// Track token usage: replace input (last context), accumulate output
|
|
320
|
+
// Subtract cacheWriteTokens to exclude system prompt on first call
|
|
321
|
+
if (event.tokenUsage) {
|
|
322
|
+
const rawInputTokens = event.tokenUsage.inputTokens ?? 0;
|
|
323
|
+
const cacheWriteTokens = event.tokenUsage.cacheWriteTokens ?? 0;
|
|
324
|
+
const inputTokens = Math.max(0, rawInputTokens - cacheWriteTokens);
|
|
325
|
+
if (inputTokens > 0) {
|
|
326
|
+
state.lastInputTokens = inputTokens;
|
|
327
|
+
}
|
|
328
|
+
if (event.tokenUsage.outputTokens) {
|
|
329
|
+
state.cumulativeOutputTokens += event.tokenUsage.outputTokens;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
// Track token usage analytics
|
|
333
|
+
if (event.tokenUsage &&
|
|
334
|
+
(event.tokenUsage.inputTokens || event.tokenUsage.outputTokens)) {
|
|
335
|
+
capture('dexto_llm_tokens_consumed', {
|
|
336
|
+
source: 'cli',
|
|
337
|
+
sessionId: event.sessionId,
|
|
338
|
+
provider: event.provider,
|
|
339
|
+
model: event.model,
|
|
340
|
+
inputTokens: event.tokenUsage.inputTokens,
|
|
341
|
+
outputTokens: event.tokenUsage.outputTokens,
|
|
342
|
+
reasoningTokens: event.tokenUsage.reasoningTokens,
|
|
343
|
+
totalTokens: event.tokenUsage.totalTokens,
|
|
344
|
+
cacheReadTokens: event.tokenUsage.cacheReadTokens,
|
|
345
|
+
cacheWriteTokens: event.tokenUsage.cacheWriteTokens,
|
|
346
|
+
});
|
|
305
347
|
}
|
|
306
348
|
const finalContent = event.content || '';
|
|
307
349
|
if (state.messageId) {
|
|
@@ -400,13 +442,20 @@ export async function processStream(iterator, setters, options) {
|
|
|
400
442
|
const toolMessageId = event.callId
|
|
401
443
|
? `tool-${event.callId}`
|
|
402
444
|
: generateMessageId('tool');
|
|
403
|
-
// Get friendly display name and
|
|
445
|
+
// Get friendly display name, format args, and tool type badge
|
|
404
446
|
const displayName = getToolDisplayName(event.toolName);
|
|
405
447
|
const argsFormatted = formatToolArgsForDisplay(event.toolName, event.args || {});
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
448
|
+
const badge = getToolTypeBadge(event.toolName);
|
|
449
|
+
// Extract description if present
|
|
450
|
+
const description = event.args?.description;
|
|
451
|
+
// Format: toolName(args) [badge]
|
|
452
|
+
// If description exists, add it on a new line with dim styling
|
|
453
|
+
let toolContent = argsFormatted
|
|
454
|
+
? `${displayName}(${argsFormatted}) [${badge}]`
|
|
455
|
+
: `${displayName}() [${badge}]`;
|
|
456
|
+
if (description && typeof description === 'string') {
|
|
457
|
+
toolContent += `\n${chalk.dim(description)}`;
|
|
458
|
+
}
|
|
410
459
|
// Tool calls start in 'pending' state (don't know if approval needed yet)
|
|
411
460
|
// Status transitions: pending → pending_approval (if approval needed) → running → finished
|
|
412
461
|
// Or for pre-approved: pending → running → finished
|
|
@@ -417,6 +466,12 @@ export async function processStream(iterator, setters, options) {
|
|
|
417
466
|
timestamp: new Date(),
|
|
418
467
|
toolStatus: 'pending',
|
|
419
468
|
});
|
|
469
|
+
// Track tool called analytics
|
|
470
|
+
capture('dexto_tool_called', {
|
|
471
|
+
source: 'cli',
|
|
472
|
+
sessionId: event.sessionId,
|
|
473
|
+
toolName: event.toolName,
|
|
474
|
+
});
|
|
420
475
|
break;
|
|
421
476
|
}
|
|
422
477
|
case 'llm:tool-result': {
|
|
@@ -474,16 +529,24 @@ export async function processStream(iterator, setters, options) {
|
|
|
474
529
|
...(toolContent && { toolContent }),
|
|
475
530
|
});
|
|
476
531
|
}
|
|
532
|
+
// Track tool result analytics
|
|
533
|
+
capture('dexto_tool_result', {
|
|
534
|
+
source: 'cli',
|
|
535
|
+
sessionId: event.sessionId,
|
|
536
|
+
toolName: event.toolName || 'unknown',
|
|
537
|
+
success: event.success !== false,
|
|
538
|
+
});
|
|
477
539
|
break;
|
|
478
540
|
}
|
|
479
541
|
case 'llm:error': {
|
|
542
|
+
const errorContent = buildErrorContent(event.error, '❌ Error: ');
|
|
480
543
|
// Add error message to finalized
|
|
481
544
|
setMessages((prev) => [
|
|
482
545
|
...prev,
|
|
483
546
|
{
|
|
484
547
|
id: generateMessageId('error'),
|
|
485
548
|
role: 'system',
|
|
486
|
-
content:
|
|
549
|
+
content: errorContent,
|
|
487
550
|
timestamp: new Date(),
|
|
488
551
|
},
|
|
489
552
|
]);
|
|
@@ -507,16 +570,31 @@ export async function processStream(iterator, setters, options) {
|
|
|
507
570
|
}
|
|
508
571
|
break;
|
|
509
572
|
}
|
|
573
|
+
case 'llm:unsupported-input': {
|
|
574
|
+
// Show warning for unsupported features (e.g., model doesn't support tool calling)
|
|
575
|
+
const warningContent = '⚠️ ' + event.errors.join('\n⚠️ ');
|
|
576
|
+
setMessages((prev) => [
|
|
577
|
+
...prev,
|
|
578
|
+
{
|
|
579
|
+
id: generateMessageId('warning'),
|
|
580
|
+
role: 'system',
|
|
581
|
+
content: warningContent,
|
|
582
|
+
timestamp: new Date(),
|
|
583
|
+
},
|
|
584
|
+
]);
|
|
585
|
+
break;
|
|
586
|
+
}
|
|
510
587
|
case 'run:complete': {
|
|
511
588
|
const { durationMs } = event;
|
|
512
|
-
|
|
589
|
+
// Total = lastInput + cumulativeOutput (avoids double-counting shared context)
|
|
590
|
+
const totalTokens = state.lastInputTokens + state.cumulativeOutputTokens;
|
|
513
591
|
// Ensure any remaining pending messages are finalized
|
|
514
592
|
finalizeAllPending();
|
|
515
593
|
// Add run summary message at the END (not inserted in middle)
|
|
516
594
|
// IMPORTANT: Ink's <Static> tracks rendered items by array position, not key.
|
|
517
595
|
// Inserting in the middle shifts existing items, causing them to re-render.
|
|
518
596
|
// Always append to avoid duplicate rendering.
|
|
519
|
-
if (durationMs > 0 ||
|
|
597
|
+
if (durationMs > 0 || totalTokens > 0) {
|
|
520
598
|
const summaryMessage = {
|
|
521
599
|
id: generateMessageId('summary'),
|
|
522
600
|
role: 'system',
|
|
@@ -525,7 +603,7 @@ export async function processStream(iterator, setters, options) {
|
|
|
525
603
|
styledType: 'run-summary',
|
|
526
604
|
styledData: {
|
|
527
605
|
durationMs,
|
|
528
|
-
|
|
606
|
+
totalTokens,
|
|
529
607
|
},
|
|
530
608
|
};
|
|
531
609
|
setMessages((prev) => [...prev, summaryMessage]);
|
|
@@ -608,7 +686,8 @@ export async function processStream(iterator, setters, options) {
|
|
|
608
686
|
// Show approval UI (moved from useAgentEvents for ordering)
|
|
609
687
|
if (event.type === ApprovalTypeEnum.TOOL_CONFIRMATION ||
|
|
610
688
|
event.type === ApprovalTypeEnum.COMMAND_CONFIRMATION ||
|
|
611
|
-
event.type === ApprovalTypeEnum.ELICITATION
|
|
689
|
+
event.type === ApprovalTypeEnum.ELICITATION ||
|
|
690
|
+
event.type === ApprovalTypeEnum.DIRECTORY_ACCESS) {
|
|
612
691
|
const newApproval = {
|
|
613
692
|
approvalId: event.approvalId,
|
|
614
693
|
type: event.type,
|
|
@@ -654,12 +733,13 @@ export async function processStream(iterator, setters, options) {
|
|
|
654
733
|
else {
|
|
655
734
|
// Unexpected error, show to user
|
|
656
735
|
clearPending();
|
|
736
|
+
const errorContent = buildErrorContent(error, '❌ Stream error: ');
|
|
657
737
|
setMessages((prev) => [
|
|
658
738
|
...prev,
|
|
659
739
|
{
|
|
660
740
|
id: generateMessageId('error'),
|
|
661
741
|
role: 'system',
|
|
662
|
-
content:
|
|
742
|
+
content: errorContent,
|
|
663
743
|
timestamp: new Date(),
|
|
664
744
|
},
|
|
665
745
|
]);
|
|
@@ -19,8 +19,8 @@ export interface StartupInfo {
|
|
|
19
19
|
/**
|
|
20
20
|
* Tool call status for visual feedback
|
|
21
21
|
* - pending: Tool call received, checking if approval needed (static gray dot)
|
|
22
|
-
* - pending_approval: Waiting for user approval (static
|
|
23
|
-
* - running: Actually executing (animated
|
|
22
|
+
* - pending_approval: Waiting for user approval (static orange dot)
|
|
23
|
+
* - running: Actually executing (animated green/teal spinner)
|
|
24
24
|
* - finished: Completed (green dot success, red dot error)
|
|
25
25
|
*/
|
|
26
26
|
export type ToolStatus = 'pending' | 'pending_approval' | 'running' | 'finished';
|
|
@@ -98,8 +98,8 @@ export interface LogConfigStyledData {
|
|
|
98
98
|
export interface RunSummaryStyledData {
|
|
99
99
|
/** Duration in milliseconds */
|
|
100
100
|
durationMs: number;
|
|
101
|
-
/**
|
|
102
|
-
|
|
101
|
+
/** Total tokens used (lastInput + cumulativeOutput) */
|
|
102
|
+
totalTokens: number;
|
|
103
103
|
}
|
|
104
104
|
export interface PromptsStyledData {
|
|
105
105
|
mcpPrompts: Array<{
|
|
@@ -238,6 +238,7 @@ export interface SelectedMcpServer {
|
|
|
238
238
|
export interface PendingModelSwitch {
|
|
239
239
|
provider: string;
|
|
240
240
|
model: string;
|
|
241
|
+
displayName?: string;
|
|
241
242
|
}
|
|
242
243
|
/**
|
|
243
244
|
* Prompt add wizard state
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/state/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEpG;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,gBAAgB,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IACrD,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,kBAAkB,GAAG,SAAS,GAAG,UAAU,CAAC;AAEjF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACvB,QAAQ,GACR,OAAO,GACP,MAAM,GACN,cAAc,GACd,iBAAiB,GACjB,YAAY,GACZ,aAAa,GACb,SAAS,GACT,WAAW,GACX,WAAW,CAAC;AAElB;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,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IAGZ,OAAO,EAAE,YAAY,CAAC;IAGtB,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IACjC,aAAa,EAAE,eAAe,EAAE,CAAC;CACpC"}
|
|
@@ -36,6 +36,11 @@ export declare function centerTruncatePath(filePath: string, maxWidth: number):
|
|
|
36
36
|
* MCP tools keep their server prefix for clarity (e.g., "mcp_server__tool").
|
|
37
37
|
*/
|
|
38
38
|
export declare function getToolDisplayName(toolName: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Gets the tool type badge for display.
|
|
41
|
+
* Returns: 'internal', MCP server name, or 'custom'
|
|
42
|
+
*/
|
|
43
|
+
export declare function getToolTypeBadge(toolName: string): string;
|
|
39
44
|
/**
|
|
40
45
|
* Formats tool arguments for display.
|
|
41
46
|
* Format: ToolName(primary_arg) or ToolName(primary_arg, key: value)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageFormatting.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/utils/messageFormatting.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAe,MAAM,aAAa,CAAC;AAE5E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAGjD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,GAAE,MAAsB,GAAG,MAAM,CAmB1F;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAChC,YAAY,EAAE,MAAM,EACpB,QAAQ,GAAE,MAAW,EACrB,GAAG,GAAE,MAAsB,GAC5B,MAAM,CAWR;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAiC7E;
|
|
1
|
+
{"version":3,"file":"messageFormatting.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/utils/messageFormatting.ts"],"names":[],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,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,CAQjE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAO3D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAQhD;AAgBD;;GAEG;AACH,wBAAgB,0BAA0B,CACtC,OAAO,EAAE,eAAe,EAAE,EAC1B,SAAS,EAAE,MAAM,GAClB,OAAO,EAAE,CAmBX;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,UAAU;;;;;;;;GAiBrD"}
|
|
@@ -126,6 +126,11 @@ function getToolConfig(toolName) {
|
|
|
126
126
|
const baseName = toolName.replace('internal--', '');
|
|
127
127
|
return TOOL_CONFIGS[baseName];
|
|
128
128
|
}
|
|
129
|
+
// Strip "custom--" prefix and try again
|
|
130
|
+
if (toolName.startsWith('custom--')) {
|
|
131
|
+
const baseName = toolName.replace('custom--', '');
|
|
132
|
+
return TOOL_CONFIGS[baseName];
|
|
133
|
+
}
|
|
129
134
|
return undefined;
|
|
130
135
|
}
|
|
131
136
|
/**
|
|
@@ -143,9 +148,58 @@ export function getToolDisplayName(toolName) {
|
|
|
143
148
|
if (toolName.startsWith('internal--')) {
|
|
144
149
|
return toolName.replace('internal--', '');
|
|
145
150
|
}
|
|
146
|
-
//
|
|
151
|
+
// Strip "custom--" prefix for custom tools
|
|
152
|
+
if (toolName.startsWith('custom--')) {
|
|
153
|
+
return toolName.replace('custom--', '');
|
|
154
|
+
}
|
|
155
|
+
// MCP tools: strip mcp-- or mcp__ prefix and server name for clean display
|
|
156
|
+
if (toolName.startsWith('mcp--')) {
|
|
157
|
+
const parts = toolName.split('--');
|
|
158
|
+
if (parts.length >= 3) {
|
|
159
|
+
return parts.slice(2).join('--');
|
|
160
|
+
}
|
|
161
|
+
return toolName.substring(5);
|
|
162
|
+
}
|
|
163
|
+
if (toolName.startsWith('mcp__')) {
|
|
164
|
+
const parts = toolName.substring(5).split('__');
|
|
165
|
+
if (parts.length >= 2) {
|
|
166
|
+
return parts.slice(1).join('__');
|
|
167
|
+
}
|
|
168
|
+
return toolName.substring(5);
|
|
169
|
+
}
|
|
147
170
|
return toolName;
|
|
148
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* Gets the tool type badge for display.
|
|
174
|
+
* Returns: 'internal', MCP server name, or 'custom'
|
|
175
|
+
*/
|
|
176
|
+
export function getToolTypeBadge(toolName) {
|
|
177
|
+
// Internal tools
|
|
178
|
+
if (toolName.startsWith('internal--') || toolName.startsWith('internal__')) {
|
|
179
|
+
return 'internal';
|
|
180
|
+
}
|
|
181
|
+
// MCP tools with server name
|
|
182
|
+
if (toolName.startsWith('mcp--')) {
|
|
183
|
+
const parts = toolName.split('--');
|
|
184
|
+
if (parts.length >= 3 && parts[1]) {
|
|
185
|
+
return `MCP: ${parts[1]}`; // Format: 'MCP: github', 'MCP: postgres'
|
|
186
|
+
}
|
|
187
|
+
return 'MCP';
|
|
188
|
+
}
|
|
189
|
+
if (toolName.startsWith('mcp__')) {
|
|
190
|
+
const parts = toolName.substring(5).split('__');
|
|
191
|
+
if (parts.length >= 2 && parts[0]) {
|
|
192
|
+
return `MCP: ${parts[0]}`; // Format: 'MCP: servername'
|
|
193
|
+
}
|
|
194
|
+
return 'MCP';
|
|
195
|
+
}
|
|
196
|
+
// Custom tools
|
|
197
|
+
if (toolName.startsWith('custom--')) {
|
|
198
|
+
return 'custom';
|
|
199
|
+
}
|
|
200
|
+
// Unknown - likely custom
|
|
201
|
+
return 'custom';
|
|
202
|
+
}
|
|
149
203
|
/**
|
|
150
204
|
* Fallback primary argument names for unknown tools.
|
|
151
205
|
* Used when we don't have a specific config for a tool.
|
|
@@ -217,6 +271,8 @@ export function formatToolArgsForDisplay(toolName, args) {
|
|
|
217
271
|
for (const argName of config.argsToShow) {
|
|
218
272
|
if (!(argName in args))
|
|
219
273
|
continue;
|
|
274
|
+
if (argName === 'description')
|
|
275
|
+
continue; // Skip description field
|
|
220
276
|
if (parts.length >= 3)
|
|
221
277
|
break;
|
|
222
278
|
const formattedValue = formatArgValue(argName, args[argName]);
|
|
@@ -233,6 +289,8 @@ export function formatToolArgsForDisplay(toolName, args) {
|
|
|
233
289
|
else {
|
|
234
290
|
// Fallback for unknown tools (MCP, etc.)
|
|
235
291
|
for (const [key, value] of entries) {
|
|
292
|
+
if (key === 'description')
|
|
293
|
+
continue; // Skip description field
|
|
236
294
|
if (parts.length >= 3)
|
|
237
295
|
break;
|
|
238
296
|
const formattedValue = formatArgValue(key, value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolUtils.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/utils/toolUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"toolUtils.d.ts","sourceRoot":"","sources":["../../../../src/cli/ink-cli/utils/toolUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CASrE"}
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
export function isEditWriteTool(toolName) {
|
|
9
9
|
return (toolName === 'internal--edit_file' ||
|
|
10
10
|
toolName === 'internal--write_file' ||
|
|
11
|
+
toolName === 'custom--write_file' ||
|
|
12
|
+
toolName === 'custom--edit_file' ||
|
|
11
13
|
toolName === 'edit_file' ||
|
|
12
14
|
toolName === 'write_file');
|
|
13
15
|
}
|
|
@@ -1,10 +1,60 @@
|
|
|
1
1
|
import type { LLMProvider } from '@dexto/core';
|
|
2
|
+
export interface ApiKeySetupResult {
|
|
3
|
+
success: boolean;
|
|
4
|
+
apiKey?: string;
|
|
5
|
+
cancelled?: boolean;
|
|
6
|
+
skipped?: boolean;
|
|
7
|
+
error?: string;
|
|
8
|
+
}
|
|
2
9
|
/**
|
|
3
10
|
* Interactively prompts the user to set up an API key for a specific provider.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Exits the process if user cancels or setup fails.
|
|
11
|
+
* Includes browser auto-open, format validation with hints, and API key verification.
|
|
12
|
+
*
|
|
7
13
|
* @param provider - The specific provider that needs API key setup
|
|
14
|
+
* @param options - Configuration options
|
|
15
|
+
* @returns Result indicating success, cancellation, or error
|
|
8
16
|
*/
|
|
9
|
-
export declare function interactiveApiKeySetup(provider: LLMProvider
|
|
17
|
+
export declare function interactiveApiKeySetup(provider: LLMProvider, options?: {
|
|
18
|
+
exitOnCancel?: boolean;
|
|
19
|
+
skipVerification?: boolean;
|
|
20
|
+
model?: string;
|
|
21
|
+
}): Promise<ApiKeySetupResult>;
|
|
22
|
+
/**
|
|
23
|
+
* Quick check if an API key is already configured for a provider
|
|
24
|
+
*/
|
|
25
|
+
export declare function hasApiKeyConfigured(provider: LLMProvider): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Result when user is prompted about pending API key setup
|
|
28
|
+
*/
|
|
29
|
+
export interface PendingSetupPromptResult {
|
|
30
|
+
action: 'setup' | 'skip' | 'cancel';
|
|
31
|
+
apiKey?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Prompts user about pending API key setup from a previous incomplete setup.
|
|
35
|
+
* This is shown when user previously skipped API key setup and is now trying to run dexto.
|
|
36
|
+
*
|
|
37
|
+
* @param provider - The provider that needs API key setup
|
|
38
|
+
* @param model - The model configured for the provider
|
|
39
|
+
* @returns Result indicating which action the user chose
|
|
40
|
+
*/
|
|
41
|
+
export declare function promptForPendingApiKey(provider: LLMProvider, model: string): Promise<PendingSetupPromptResult>;
|
|
42
|
+
/**
|
|
43
|
+
* Result when user is prompted about missing API key for a specific agent
|
|
44
|
+
*/
|
|
45
|
+
export interface AgentApiKeyPromptResult {
|
|
46
|
+
action: 'add-key' | 'use-default' | 'cancel';
|
|
47
|
+
apiKey?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Prompts user when loading a specific agent that requires an API key they don't have.
|
|
51
|
+
* Offers options to add the API key, continue with their default LLM, or cancel.
|
|
52
|
+
*
|
|
53
|
+
* @param agentProvider - The provider the agent requires
|
|
54
|
+
* @param agentModel - The model the agent uses
|
|
55
|
+
* @param userProvider - The user's default provider (from preferences)
|
|
56
|
+
* @param userModel - The user's default model (from preferences)
|
|
57
|
+
* @returns Result indicating which action the user chose
|
|
58
|
+
*/
|
|
59
|
+
export declare function promptForMissingAgentApiKey(agentProvider: LLMProvider, agentModel: string, userProvider: LLMProvider, userModel: string): Promise<AgentApiKeyPromptResult>;
|
|
10
60
|
//# sourceMappingURL=api-key-setup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-key-setup.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/api-key-setup.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"api-key-setup.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/api-key-setup.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAe/C,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CACxC,QAAQ,EAAE,WAAW,EACrB,OAAO,GAAE;IACL,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;CACb,GACP,OAAO,CAAC,iBAAiB,CAAC,C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