dexto 1.5.8 → 1.6.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 +3 -3
- package/dist/agents/agent-template.yml +2 -2
- package/dist/agents/coding-agent/README.md +10 -10
- package/dist/agents/coding-agent/coding-agent.yml +84 -83
- package/dist/agents/default-agent.yml +32 -47
- package/dist/agents/explore-agent/explore-agent.yml +3 -6
- package/dist/agents/image-editor-agent/image-editor-agent.yml +1 -1
- package/dist/agents/nano-banana-agent/nano-banana-agent.yml +1 -1
- package/dist/agents/podcast-agent/podcast-agent.yml +1 -1
- package/dist/agents/product-name-researcher/product-name-researcher.yml +1 -1
- package/dist/agents/sora-video-agent/sora-video-agent.yml +4 -6
- package/dist/agents/triage-demo/triage-agent.yml +1 -1
- package/dist/analytics/events.d.ts +1 -1
- package/dist/analytics/events.d.ts.map +1 -1
- package/dist/api/mcp/tool-aggregation-handler.d.ts +2 -2
- package/dist/api/server-hono.d.ts +2 -2
- package/dist/api/server-hono.d.ts.map +1 -1
- package/dist/api/server-hono.js +37 -60
- package/dist/cli/approval/cli-approval-handler.d.ts +10 -3
- package/dist/cli/approval/cli-approval-handler.d.ts.map +1 -1
- package/dist/cli/approval/cli-approval-handler.js +1 -1
- package/dist/cli/assets/sounds/SOURCES.md +35 -0
- package/dist/cli/assets/sounds/boot.wav +0 -0
- package/dist/cli/assets/sounds/chime.wav +0 -0
- package/dist/cli/assets/sounds/coin.wav +0 -0
- package/dist/cli/assets/sounds/confirm.wav +0 -0
- package/dist/cli/assets/sounds/levelup.wav +0 -0
- package/dist/cli/assets/sounds/ping.wav +0 -0
- package/dist/cli/assets/sounds/powerup.wav +0 -0
- package/dist/cli/assets/sounds/startup.wav +0 -0
- package/dist/cli/assets/sounds/success.wav +0 -0
- package/dist/cli/assets/sounds/treasure.wav +0 -0
- package/dist/cli/assets/sounds/win.wav +0 -0
- package/dist/cli/commands/create-app.d.ts +1 -11
- package/dist/cli/commands/create-app.d.ts.map +1 -1
- package/dist/cli/commands/create-app.js +21 -545
- package/dist/cli/commands/create-image.d.ts.map +1 -1
- package/dist/cli/commands/create-image.js +54 -53
- package/dist/cli/commands/image.d.ts +52 -0
- package/dist/cli/commands/image.d.ts.map +1 -0
- package/dist/cli/commands/image.js +118 -0
- package/dist/cli/commands/index.d.ts +2 -1
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +3 -1
- package/dist/cli/commands/init-app.d.ts +4 -8
- package/dist/cli/commands/init-app.d.ts.map +1 -1
- package/dist/cli/commands/init-app.js +37 -161
- package/dist/cli/commands/interactive-commands/command-parser.d.ts +2 -0
- package/dist/cli/commands/interactive-commands/command-parser.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/commands.d.ts +1 -1
- package/dist/cli/commands/interactive-commands/commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/commands.js +2 -2
- package/dist/cli/commands/interactive-commands/exit-handler.d.ts +12 -0
- package/dist/cli/commands/interactive-commands/exit-handler.d.ts.map +1 -0
- package/dist/cli/commands/interactive-commands/exit-handler.js +20 -0
- package/dist/cli/commands/interactive-commands/exit-stats.d.ts +24 -0
- package/dist/cli/commands/interactive-commands/exit-stats.d.ts.map +1 -0
- package/dist/cli/commands/interactive-commands/exit-stats.js +17 -0
- package/dist/cli/commands/interactive-commands/general-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/general-commands.js +55 -5
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/prompt-commands.js +14 -74
- package/dist/cli/commands/interactive-commands/session/index.d.ts +2 -1
- package/dist/cli/commands/interactive-commands/session/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/session/index.js +2 -1
- package/dist/cli/commands/interactive-commands/session/session-commands.d.ts +2 -2
- package/dist/cli/commands/interactive-commands/session/session-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/session/session-commands.js +2 -4
- package/dist/cli/commands/interactive-commands/system/system-commands.d.ts +1 -13
- package/dist/cli/commands/interactive-commands/system/system-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/system/system-commands.js +52 -83
- package/dist/cli/commands/plugin.d.ts +4 -4
- package/dist/cli/commands/sync-agents.d.ts +2 -12
- package/dist/cli/commands/sync-agents.d.ts.map +1 -1
- package/dist/cli/commands/sync-agents.js +2 -50
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts +7 -1
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/InkCLIRefactored.js +138 -27
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts +2 -2
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ApprovalPrompt.js +85 -30
- package/dist/cli/ink-cli/components/BackgroundTasksPanel.js +1 -1
- package/dist/cli/ink-cli/components/ElicitationForm.d.ts +5 -3
- package/dist/cli/ink-cli/components/ElicitationForm.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ElicitationForm.js +414 -180
- package/dist/cli/ink-cli/components/Footer.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/Footer.js +1 -2
- package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ResourceAutocomplete.js +20 -11
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.js +47 -67
- package/dist/cli/ink-cli/components/StatusBar.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/StatusBar.js +20 -10
- package/dist/cli/ink-cli/components/TodoPanel.js +1 -1
- package/dist/cli/ink-cli/components/base/BaseSelector.d.ts +2 -1
- package/dist/cli/ink-cli/components/base/BaseSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/base/BaseSelector.js +37 -27
- package/dist/cli/ink-cli/components/chat/Header.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/Header.js +1 -1
- package/dist/cli/ink-cli/components/chat/MessageItem.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/MessageItem.js +3 -1
- package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/ToolIcon.js +5 -15
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.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 +1 -1
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts +3 -1
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.js +5 -3
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts +3 -1
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/modes/StaticCLI.js +10 -3
- package/dist/cli/ink-cli/components/overlays/CommandOutputOverlay.d.ts +13 -0
- package/dist/cli/ink-cli/components/overlays/CommandOutputOverlay.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/CommandOutputOverlay.js +60 -0
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.js +1 -1
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.js +213 -100
- package/dist/cli/ink-cli/components/overlays/PromptList.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/PromptList.js +12 -16
- package/dist/cli/ink-cli/components/overlays/SoundsSelector.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/SoundsSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/SoundsSelector.js +566 -0
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts +1 -1
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.js +100 -45
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/custom-model-wizard/LocalModelWizard.js +8 -13
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts +3 -3
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.js +6 -5
- package/dist/cli/ink-cli/components/renderers/FileRenderer.d.ts +3 -1
- package/dist/cli/ink-cli/components/renderers/FileRenderer.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/renderers/FileRenderer.js +18 -7
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.js +7 -17
- package/dist/cli/ink-cli/components/renderers/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/renderers/index.js +1 -1
- package/dist/cli/ink-cli/components/shared/FocusOverlayFrame.d.ts +7 -0
- package/dist/cli/ink-cli/components/shared/FocusOverlayFrame.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/shared/FocusOverlayFrame.js +8 -0
- package/dist/cli/ink-cli/components/shared/HintBar.d.ts +6 -0
- package/dist/cli/ink-cli/components/shared/HintBar.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/shared/HintBar.js +6 -0
- package/dist/cli/ink-cli/constants/spinnerFrames.d.ts +2 -0
- package/dist/cli/ink-cli/constants/spinnerFrames.d.ts.map +1 -0
- package/dist/cli/ink-cli/constants/spinnerFrames.js +1 -0
- package/dist/cli/ink-cli/constants/tips.d.ts.map +1 -1
- package/dist/cli/ink-cli/constants/tips.js +2 -1
- package/dist/cli/ink-cli/containers/InputContainer.d.ts +4 -0
- package/dist/cli/ink-cli/containers/InputContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/InputContainer.js +47 -21
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts +2 -0
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/OverlayContainer.js +101 -40
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useAgentEvents.js +15 -16
- package/dist/cli/ink-cli/hooks/useAnimationTick.d.ts +11 -0
- package/dist/cli/ink-cli/hooks/useAnimationTick.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useAnimationTick.js +54 -0
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useCLIState.js +1 -0
- package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useTokenCounter.js +7 -4
- package/dist/cli/ink-cli/services/CommandService.d.ts +1 -1
- package/dist/cli/ink-cli/services/CommandService.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/CommandService.js +2 -2
- package/dist/cli/ink-cli/services/processStream.d.ts +2 -2
- package/dist/cli/ink-cli/services/processStream.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/processStream.js +27 -19
- package/dist/cli/ink-cli/state/initialState.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/initialState.js +1 -0
- package/dist/cli/ink-cli/state/types.d.ts +15 -3
- 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/elicitationSchema.d.ts +11 -0
- package/dist/cli/ink-cli/utils/elicitationSchema.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/elicitationSchema.js +80 -0
- package/dist/cli/ink-cli/utils/index.d.ts +1 -1
- package/dist/cli/ink-cli/utils/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/index.js +1 -1
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts +10 -19
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/messageFormatting.js +43 -262
- package/dist/cli/ink-cli/utils/overlayPresentation.d.ts +19 -0
- package/dist/cli/ink-cli/utils/overlayPresentation.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/overlayPresentation.js +33 -0
- package/dist/cli/ink-cli/utils/overlaySizing.d.ts +19 -0
- package/dist/cli/ink-cli/utils/overlaySizing.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/overlaySizing.js +11 -0
- package/dist/cli/ink-cli/utils/soundNotification.d.ts +19 -13
- package/dist/cli/ink-cli/utils/soundNotification.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/soundNotification.js +120 -97
- package/dist/cli/ink-cli/utils/toolUtils.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/toolUtils.js +2 -9
- package/dist/cli/utils/config-validation.d.ts +11 -11
- package/dist/cli/utils/config-validation.d.ts.map +1 -1
- package/dist/cli/utils/config-validation.js +56 -290
- package/dist/cli/utils/image-store.d.ts +16 -0
- package/dist/cli/utils/image-store.d.ts.map +1 -0
- package/dist/cli/utils/image-store.js +289 -0
- package/dist/cli/utils/scaffolding-utils.d.ts +5 -0
- package/dist/cli/utils/scaffolding-utils.d.ts.map +1 -1
- package/dist/cli/utils/scaffolding-utils.js +46 -4
- package/dist/cli/utils/template-engine.d.ts +28 -16
- package/dist/cli/utils/template-engine.d.ts.map +1 -1
- package/dist/cli/utils/template-engine.js +339 -479
- package/dist/config/cli-overrides.d.ts +4 -3
- package/dist/config/cli-overrides.d.ts.map +1 -1
- package/dist/config/cli-overrides.js +7 -9
- package/dist/index-main.d.ts +2 -0
- package/dist/index-main.d.ts.map +1 -0
- package/dist/index-main.js +1554 -0
- package/dist/index.js +2 -1589
- package/dist/utils/session-logger-factory.d.ts +3 -0
- package/dist/utils/session-logger-factory.d.ts.map +1 -0
- package/dist/utils/session-logger-factory.js +34 -0
- package/dist/webui/assets/{index-Cz2z7NQ8.js → index-CKhumsZA.js} +231 -231
- package/dist/webui/index.html +1 -1
- package/package.json +11 -8
- package/dist/cli/cli-subscriber.d.ts +0 -45
- package/dist/cli/cli-subscriber.d.ts.map +0 -1
- package/dist/cli/cli-subscriber.js +0 -204
package/dist/webui/index.html
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
if (theme === 'dark') document.documentElement.classList.add('dark');
|
|
19
19
|
})();
|
|
20
20
|
</script>
|
|
21
|
-
<script type="module" crossorigin src="/assets/index-
|
|
21
|
+
<script type="module" crossorigin src="/assets/index-CKhumsZA.js"></script>
|
|
22
22
|
<link rel="modulepreload" crossorigin href="/assets/react-vendor-gH-7aFTg.js">
|
|
23
23
|
<link rel="modulepreload" crossorigin href="/assets/tanstack-Br79RQ-n.js">
|
|
24
24
|
<link rel="stylesheet" crossorigin href="/assets/index-C9JXwpvo.css">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dexto",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"dexto": "./dist/index.js"
|
|
@@ -42,12 +42,15 @@
|
|
|
42
42
|
"ws": "^8.18.1",
|
|
43
43
|
"yaml": "^2.7.1",
|
|
44
44
|
"zod": "^3.25.0",
|
|
45
|
-
"@dexto/agent-
|
|
46
|
-
"@dexto/
|
|
47
|
-
"@dexto/
|
|
48
|
-
"@dexto/
|
|
49
|
-
"@dexto/
|
|
50
|
-
"@dexto/
|
|
45
|
+
"@dexto/agent-config": "1.6.1",
|
|
46
|
+
"@dexto/agent-management": "1.6.1",
|
|
47
|
+
"@dexto/analytics": "1.6.1",
|
|
48
|
+
"@dexto/core": "1.6.1",
|
|
49
|
+
"@dexto/image-local": "1.6.1",
|
|
50
|
+
"@dexto/image-logger-agent": "1.6.1",
|
|
51
|
+
"@dexto/registry": "1.6.1",
|
|
52
|
+
"@dexto/server": "1.6.1",
|
|
53
|
+
"@dexto/storage": "1.6.1"
|
|
51
54
|
},
|
|
52
55
|
"devDependencies": {
|
|
53
56
|
"@types/react": "^19.0.0",
|
|
@@ -65,7 +68,7 @@
|
|
|
65
68
|
"build": "cross-env NODE_OPTIONS='--max-old-space-size=4096' tsc -p tsconfig.json && pnpm run copy-agents && pnpm run copy-assets",
|
|
66
69
|
"_comment_build": "TODO: (355) This is a known issue with MCP SDK >= 1.18.1 taking heap space, see if we can solve this without heap size hacks - https://github.com/truffle-ai/dexto/pull/355#discussion_r2412949424",
|
|
67
70
|
"copy-agents": "tsx scripts/copy-agents.ts",
|
|
68
|
-
"copy-assets": "
|
|
71
|
+
"copy-assets": "tsx scripts/copy-assets.ts",
|
|
69
72
|
"start": "node dist/index.js",
|
|
70
73
|
"typecheck": "tsc -p tsconfig.typecheck.json --noEmit",
|
|
71
74
|
"lint": "eslint . --ext .ts"
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI Event Subscriber for headless mode
|
|
3
|
-
* Handles agent events and outputs to stdout/stderr
|
|
4
|
-
*
|
|
5
|
-
* Simple, composable output suitable for piping and scripting
|
|
6
|
-
* No TUI, no boxes - just clean text output
|
|
7
|
-
*/
|
|
8
|
-
import { DextoAgent } from '@dexto/core';
|
|
9
|
-
import { EventSubscriber } from '@dexto/server';
|
|
10
|
-
import { AgentEventBus } from '@dexto/core';
|
|
11
|
-
import type { SanitizedToolResult, AgentEventMap } from '@dexto/core';
|
|
12
|
-
/**
|
|
13
|
-
* Event subscriber for CLI headless mode
|
|
14
|
-
* Implements the standard EventSubscriber pattern used throughout the codebase
|
|
15
|
-
*/
|
|
16
|
-
export declare class CLISubscriber implements EventSubscriber {
|
|
17
|
-
private streamingContent;
|
|
18
|
-
private completionResolve?;
|
|
19
|
-
private completionReject?;
|
|
20
|
-
subscribe(eventBus: AgentEventBus): void;
|
|
21
|
-
/**
|
|
22
|
-
* Clean up internal state
|
|
23
|
-
* Called when the CLI subscriber is being disposed of
|
|
24
|
-
*/
|
|
25
|
-
cleanup(): void;
|
|
26
|
-
onThinking(): void;
|
|
27
|
-
onChunk(text: string): void;
|
|
28
|
-
onToolCall(toolName: string, _args: any): void;
|
|
29
|
-
onToolResult(toolName: string, sanitized: SanitizedToolResult, rawResult?: unknown, success?: boolean): void;
|
|
30
|
-
onResponse(text: string): void;
|
|
31
|
-
onError(error: Error): void;
|
|
32
|
-
onConversationReset(): void;
|
|
33
|
-
onContextCompacting(payload: AgentEventMap['context:compacting']): void;
|
|
34
|
-
onContextCompacted(payload: AgentEventMap['context:compacted']): void;
|
|
35
|
-
/**
|
|
36
|
-
* Capture LLM token usage analytics
|
|
37
|
-
*/
|
|
38
|
-
private captureTokenUsage;
|
|
39
|
-
/**
|
|
40
|
-
* Run agent in headless mode and wait for completion
|
|
41
|
-
* Returns a promise that resolves when the response is complete
|
|
42
|
-
*/
|
|
43
|
-
runAndWait(agent: DextoAgent, prompt: string, sessionId: string): Promise<void>;
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=cli-subscriber.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli-subscriber.d.ts","sourceRoot":"","sources":["../../src/cli/cli-subscriber.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAU,UAAU,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGtE;;;GAGG;AACH,qBAAa,aAAc,YAAW,eAAe;IACjD,OAAO,CAAC,gBAAgB,CAAc;IACtC,OAAO,CAAC,iBAAiB,CAAC,CAAa;IACvC,OAAO,CAAC,gBAAgB,CAAC,CAAyB;IAElD,SAAS,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI;IA+BxC;;;OAGG;IACH,OAAO,IAAI,IAAI;IAcf,UAAU,IAAI,IAAI;IAIlB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAM3B,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAK9C,YAAY,CACR,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,mBAAmB,EAC9B,SAAS,CAAC,EAAE,OAAO,EACnB,OAAO,CAAC,EAAE,OAAO,GAClB,IAAI;IAMP,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IA0B9B,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAyC3B,mBAAmB,IAAI,IAAI;IAM3B,mBAAmB,CAAC,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,GAAG,IAAI;IAOvE,kBAAkB,CAAC,OAAO,EAAE,aAAa,CAAC,mBAAmB,CAAC,GAAG,IAAI;IAcrE;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA6BzB;;;OAGG;IACG,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAsBxF"}
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI Event Subscriber for headless mode
|
|
3
|
-
* Handles agent events and outputs to stdout/stderr
|
|
4
|
-
*
|
|
5
|
-
* Simple, composable output suitable for piping and scripting
|
|
6
|
-
* No TUI, no boxes - just clean text output
|
|
7
|
-
*/
|
|
8
|
-
import { logger } from '@dexto/core';
|
|
9
|
-
import { capture } from '../analytics/index.js';
|
|
10
|
-
/**
|
|
11
|
-
* Event subscriber for CLI headless mode
|
|
12
|
-
* Implements the standard EventSubscriber pattern used throughout the codebase
|
|
13
|
-
*/
|
|
14
|
-
export class CLISubscriber {
|
|
15
|
-
streamingContent = '';
|
|
16
|
-
completionResolve;
|
|
17
|
-
completionReject;
|
|
18
|
-
subscribe(eventBus) {
|
|
19
|
-
eventBus.on('llm:thinking', this.onThinking.bind(this));
|
|
20
|
-
eventBus.on('llm:chunk', (payload) => {
|
|
21
|
-
if (payload.chunkType === 'text') {
|
|
22
|
-
this.onChunk(payload.content);
|
|
23
|
-
}
|
|
24
|
-
// Ignore reasoning chunks for headless mode
|
|
25
|
-
});
|
|
26
|
-
eventBus.on('llm:tool-call', (payload) => this.onToolCall(payload.toolName, payload.args));
|
|
27
|
-
eventBus.on('llm:tool-result', (payload) => {
|
|
28
|
-
// Only call onToolResult when we have sanitized result (success case)
|
|
29
|
-
if (payload.sanitized) {
|
|
30
|
-
this.onToolResult(payload.toolName, payload.sanitized, payload.rawResult, payload.success);
|
|
31
|
-
}
|
|
32
|
-
// For error case (success=false), the error is handled via llm:error event
|
|
33
|
-
});
|
|
34
|
-
eventBus.on('llm:response', (payload) => {
|
|
35
|
-
this.onResponse(payload.content);
|
|
36
|
-
this.captureTokenUsage(payload);
|
|
37
|
-
});
|
|
38
|
-
eventBus.on('llm:error', (payload) => this.onError(payload.error));
|
|
39
|
-
eventBus.on('session:reset', this.onConversationReset.bind(this));
|
|
40
|
-
eventBus.on('context:compacting', this.onContextCompacting.bind(this));
|
|
41
|
-
eventBus.on('context:compacted', this.onContextCompacted.bind(this));
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Clean up internal state
|
|
45
|
-
* Called when the CLI subscriber is being disposed of
|
|
46
|
-
*/
|
|
47
|
-
cleanup() {
|
|
48
|
-
this.streamingContent = '';
|
|
49
|
-
// Reject any pending promises to prevent resource leaks
|
|
50
|
-
if (this.completionReject) {
|
|
51
|
-
const reject = this.completionReject;
|
|
52
|
-
delete this.completionResolve;
|
|
53
|
-
delete this.completionReject;
|
|
54
|
-
reject(new Error('CLI subscriber cleaned up while operation pending'));
|
|
55
|
-
}
|
|
56
|
-
logger.debug('CLI event subscriber cleaned up');
|
|
57
|
-
}
|
|
58
|
-
onThinking() {
|
|
59
|
-
// Silent in headless mode - no "thinking..." messages
|
|
60
|
-
}
|
|
61
|
-
onChunk(text) {
|
|
62
|
-
// Stream directly to stdout for real-time output
|
|
63
|
-
this.streamingContent += text;
|
|
64
|
-
process.stdout.write(text);
|
|
65
|
-
}
|
|
66
|
-
onToolCall(toolName, _args) {
|
|
67
|
-
// Simple tool indicator to stderr (doesn't interfere with stdout)
|
|
68
|
-
process.stderr.write(`[Tool: ${toolName}]\n`);
|
|
69
|
-
}
|
|
70
|
-
onToolResult(toolName, sanitized, rawResult, success) {
|
|
71
|
-
// Simple completion indicator to stderr
|
|
72
|
-
const status = success ? '✓' : '✗';
|
|
73
|
-
process.stderr.write(`[${status}] ${toolName} complete\n`);
|
|
74
|
-
}
|
|
75
|
-
onResponse(text) {
|
|
76
|
-
// If we didn't stream anything (no chunks), output the full response now
|
|
77
|
-
if (!this.streamingContent) {
|
|
78
|
-
process.stdout.write(text);
|
|
79
|
-
if (!text.endsWith('\n')) {
|
|
80
|
-
process.stdout.write('\n');
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
// We already streamed the content, just add newline if needed
|
|
85
|
-
if (!this.streamingContent.endsWith('\n')) {
|
|
86
|
-
process.stdout.write('\n');
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
// Clear accumulated state
|
|
90
|
-
this.streamingContent = '';
|
|
91
|
-
// Resolve completion promise if waiting
|
|
92
|
-
if (this.completionResolve) {
|
|
93
|
-
const resolve = this.completionResolve;
|
|
94
|
-
delete this.completionResolve;
|
|
95
|
-
delete this.completionReject;
|
|
96
|
-
resolve();
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
onError(error) {
|
|
100
|
-
// Clear any partial response state
|
|
101
|
-
this.streamingContent = '';
|
|
102
|
-
// Show error to stderr for immediate user feedback
|
|
103
|
-
console.error(`❌ Error: ${error.message}`);
|
|
104
|
-
// Show recovery guidance if available (for DextoRuntimeError)
|
|
105
|
-
if ('recovery' in error && error.recovery) {
|
|
106
|
-
const recoveryMessages = Array.isArray(error.recovery)
|
|
107
|
-
? error.recovery
|
|
108
|
-
: [error.recovery];
|
|
109
|
-
console.error('');
|
|
110
|
-
recoveryMessages.forEach((msg) => {
|
|
111
|
-
console.error(`💡 ${msg}`);
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
// Show stack for debugging if available
|
|
115
|
-
if (error.stack) {
|
|
116
|
-
console.error('');
|
|
117
|
-
console.error(error.stack);
|
|
118
|
-
}
|
|
119
|
-
// Log details to file
|
|
120
|
-
logger.error(`Error: ${error.message}`, {
|
|
121
|
-
stack: error.stack,
|
|
122
|
-
name: error.name,
|
|
123
|
-
cause: error.cause,
|
|
124
|
-
recovery: 'recovery' in error ? error.recovery : undefined,
|
|
125
|
-
});
|
|
126
|
-
// Reject completion promise if waiting
|
|
127
|
-
if (this.completionReject) {
|
|
128
|
-
const reject = this.completionReject;
|
|
129
|
-
delete this.completionResolve;
|
|
130
|
-
delete this.completionReject;
|
|
131
|
-
reject(error);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
onConversationReset() {
|
|
135
|
-
// Clear any partial response state
|
|
136
|
-
this.streamingContent = '';
|
|
137
|
-
logger.info('🔄 Conversation history cleared.', null, 'blue');
|
|
138
|
-
}
|
|
139
|
-
onContextCompacting(payload) {
|
|
140
|
-
// Output to stderr (doesn't interfere with stdout response stream)
|
|
141
|
-
process.stderr.write(`[📦 Compacting context (~${payload.estimatedTokens.toLocaleString()} tokens)...]\n`);
|
|
142
|
-
}
|
|
143
|
-
onContextCompacted(payload) {
|
|
144
|
-
const { originalTokens, compactedTokens, originalMessages, compactedMessages, reason } = payload;
|
|
145
|
-
const reductionPercent = originalTokens > 0
|
|
146
|
-
? Math.round(((originalTokens - compactedTokens) / originalTokens) * 100)
|
|
147
|
-
: 0;
|
|
148
|
-
// Output to stderr (doesn't interfere with stdout response stream)
|
|
149
|
-
process.stderr.write(`[📦 Context compacted (${reason}): ${originalTokens.toLocaleString()} → ~${compactedTokens.toLocaleString()} tokens (${reductionPercent}% reduction), ${originalMessages} → ${compactedMessages} messages]\n`);
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Capture LLM token usage analytics
|
|
153
|
-
*/
|
|
154
|
-
captureTokenUsage(payload) {
|
|
155
|
-
const { tokenUsage, provider, model, sessionId, estimatedInputTokens } = payload;
|
|
156
|
-
if (!tokenUsage || (!tokenUsage.inputTokens && !tokenUsage.outputTokens)) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
// Calculate estimate accuracy if both estimate and actual are available
|
|
160
|
-
let estimateAccuracyPercent;
|
|
161
|
-
if (estimatedInputTokens !== undefined && tokenUsage.inputTokens) {
|
|
162
|
-
const diff = estimatedInputTokens - tokenUsage.inputTokens;
|
|
163
|
-
estimateAccuracyPercent = Math.round((diff / tokenUsage.inputTokens) * 100);
|
|
164
|
-
}
|
|
165
|
-
capture('dexto_llm_tokens_consumed', {
|
|
166
|
-
source: 'cli',
|
|
167
|
-
sessionId,
|
|
168
|
-
provider,
|
|
169
|
-
model,
|
|
170
|
-
inputTokens: tokenUsage.inputTokens,
|
|
171
|
-
outputTokens: tokenUsage.outputTokens,
|
|
172
|
-
reasoningTokens: tokenUsage.reasoningTokens,
|
|
173
|
-
totalTokens: tokenUsage.totalTokens,
|
|
174
|
-
cacheReadTokens: tokenUsage.cacheReadTokens,
|
|
175
|
-
cacheWriteTokens: tokenUsage.cacheWriteTokens,
|
|
176
|
-
estimatedInputTokens,
|
|
177
|
-
estimateAccuracyPercent,
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Run agent in headless mode and wait for completion
|
|
182
|
-
* Returns a promise that resolves when the response is complete
|
|
183
|
-
*/
|
|
184
|
-
async runAndWait(agent, prompt, sessionId) {
|
|
185
|
-
// Prevent concurrent calls
|
|
186
|
-
if (this.completionResolve || this.completionReject) {
|
|
187
|
-
throw new Error('Cannot call runAndWait while another operation is pending');
|
|
188
|
-
}
|
|
189
|
-
return new Promise((resolve, reject) => {
|
|
190
|
-
this.completionResolve = resolve;
|
|
191
|
-
this.completionReject = reject;
|
|
192
|
-
// Execute the prompt
|
|
193
|
-
agent.run(prompt, undefined, undefined, sessionId).catch((error) => {
|
|
194
|
-
// If agent.run() rejects but we haven't already rejected via event
|
|
195
|
-
if (this.completionReject) {
|
|
196
|
-
const rejectHandler = this.completionReject;
|
|
197
|
-
delete this.completionResolve;
|
|
198
|
-
delete this.completionReject;
|
|
199
|
-
rejectHandler(error);
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
}
|