dexto 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -22
- package/dist/agents/agent-registry.json +9 -0
- package/dist/agents/agent-template.yml +2 -2
- package/dist/agents/coding-agent/coding-agent.yml +27 -16
- package/dist/agents/database-agent/database-agent.yml +2 -2
- package/dist/agents/default-agent.yml +9 -7
- 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 +65 -9
- 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 +47 -3
- 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.d.ts.map +1 -1
- package/dist/cli/commands/helpers/formatters.js +9 -8
- 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 +19 -70
- package/dist/cli/commands/interactive-commands/command-parser.d.ts +17 -14
- package/dist/cli/commands/interactive-commands/command-parser.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/command-parser.js +7 -22
- package/dist/cli/commands/interactive-commands/commands.d.ts +4 -4
- package/dist/cli/commands/interactive-commands/commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/commands.js +34 -42
- package/dist/cli/commands/interactive-commands/documentation-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/documentation-commands.js +4 -7
- package/dist/cli/commands/interactive-commands/general-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/general-commands.js +159 -117
- package/dist/cli/commands/interactive-commands/mcp/index.d.ts +9 -3
- package/dist/cli/commands/interactive-commands/mcp/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/mcp/index.js +18 -3
- package/dist/cli/commands/interactive-commands/model/index.d.ts +8 -6
- package/dist/cli/commands/interactive-commands/model/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/model/index.js +18 -6
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts +3 -2
- package/dist/cli/commands/interactive-commands/prompt-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/prompt-commands.js +77 -60
- package/dist/cli/commands/interactive-commands/session/index.d.ts +7 -12
- package/dist/cli/commands/interactive-commands/session/index.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/session/index.js +7 -14
- package/dist/cli/commands/interactive-commands/session/session-commands.d.ts +10 -24
- package/dist/cli/commands/interactive-commands/session/session-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/session/session-commands.js +16 -371
- package/dist/cli/commands/interactive-commands/system/system-commands.d.ts +1 -0
- package/dist/cli/commands/interactive-commands/system/system-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/system/system-commands.js +106 -77
- package/dist/cli/commands/interactive-commands/tool-commands.d.ts +1 -1
- package/dist/cli/commands/interactive-commands/tool-commands.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/tool-commands.js +5 -62
- package/dist/cli/commands/interactive-commands/utils/command-output.d.ts +13 -17
- package/dist/cli/commands/interactive-commands/utils/command-output.d.ts.map +1 -1
- package/dist/cli/commands/interactive-commands/utils/command-output.js +18 -37
- package/dist/cli/commands/list-agents.d.ts +2 -2
- package/dist/cli/commands/list-agents.d.ts.map +1 -1
- package/dist/cli/commands/list-agents.js +38 -34
- 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 +860 -65
- package/dist/cli/commands/uninstall.d.ts.map +1 -1
- package/dist/cli/commands/uninstall.js +4 -6
- package/dist/cli/commands/which.d.ts.map +1 -1
- package/dist/cli/commands/which.js +18 -4
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts +9 -22
- package/dist/cli/ink-cli/InkCLIRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/InkCLIRefactored.js +50 -133
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts +26 -3
- package/dist/cli/ink-cli/components/ApprovalPrompt.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ApprovalPrompt.js +182 -45
- 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 +22 -0
- package/dist/cli/ink-cli/components/ElicitationForm.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/ElicitationForm.js +358 -0
- 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 +16 -0
- package/dist/cli/ink-cli/components/Footer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/Footer.js +27 -0
- package/dist/cli/ink-cli/components/HistorySearchBar.d.ts +17 -0
- package/dist/cli/ink-cli/components/HistorySearchBar.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/HistorySearchBar.js +8 -0
- 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 +15 -2
- package/dist/cli/ink-cli/components/ResourceAutocomplete.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/ResourceAutocomplete.js +126 -82
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts +15 -2
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/SlashCommandAutocomplete.js +228 -122
- package/dist/cli/ink-cli/components/StatusBar.d.ts +15 -2
- package/dist/cli/ink-cli/components/StatusBar.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/StatusBar.js +50 -10
- package/dist/cli/ink-cli/components/TextBufferInput.d.ts +52 -0
- package/dist/cli/ink-cli/components/TextBufferInput.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/TextBufferInput.js +471 -0
- package/dist/cli/ink-cli/components/base/BaseAutocomplete.js +4 -4
- package/dist/cli/ink-cli/components/base/BaseSelector.d.ts +11 -1
- package/dist/cli/ink-cli/components/base/BaseSelector.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/base/BaseSelector.js +90 -49
- package/dist/cli/ink-cli/components/chat/Footer.js +1 -1
- package/dist/cli/ink-cli/components/chat/Header.d.ts +1 -0
- package/dist/cli/ink-cli/components/chat/Header.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/Header.js +6 -3
- package/dist/cli/ink-cli/components/chat/MessageItem.d.ts +3 -0
- package/dist/cli/ink-cli/components/chat/MessageItem.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/MessageItem.js +95 -9
- package/dist/cli/ink-cli/components/chat/MessageList.js +1 -1
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.d.ts +16 -0
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/QueuedMessagesDisplay.js +27 -0
- package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts +5 -3
- package/dist/cli/ink-cli/components/chat/ToolIcon.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/chat/ToolIcon.js +21 -7
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ConfigBox.js +6 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/HelpBox.js +15 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/LogConfigBox.js +9 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionHistoryBox.js +37 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SessionListBox.js +9 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/ShortcutsBox.js +6 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StatsBox.js +29 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.d.ts +45 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/StyledBox.js +38 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.d.ts +10 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/SyspromptBox.js +6 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/index.d.ts +13 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/chat/styled-boxes/index.js +12 -0
- package/dist/cli/ink-cli/components/input/InputArea.d.ts +36 -8
- package/dist/cli/ink-cli/components/input/InputArea.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/input/InputArea.js +3 -3
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts +25 -0
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/modes/AlternateBufferCLI.js +166 -0
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts +27 -0
- package/dist/cli/ink-cli/components/modes/StaticCLI.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/modes/StaticCLI.js +95 -0
- package/dist/cli/ink-cli/components/modes/index.d.ts +10 -0
- package/dist/cli/ink-cli/components/modes/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/modes/index.js +9 -0
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.d.ts +26 -0
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/ApiKeyInput.js +92 -0
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts +29 -0
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/CustomModelWizard.js +286 -0
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts +22 -0
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/LogLevelSelector.js +59 -0
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.d.ts +22 -0
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpAddChoice.js +59 -0
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.d.ts +26 -0
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpAddSelector.js +73 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomTypeSelector.js +51 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.d.ts +29 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpCustomWizard.js +215 -0
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts +22 -0
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpRemoveSelector.js +74 -0
- package/dist/cli/ink-cli/components/overlays/McpSelector.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/McpSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpSelector.js +52 -0
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts +28 -0
- package/dist/cli/ink-cli/components/overlays/McpServerActions.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpServerActions.js +84 -0
- package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts +29 -0
- package/dist/cli/ink-cli/components/overlays/McpServerList.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/McpServerList.js +109 -0
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts +15 -8
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/ModelSelectorRefactored.js +400 -23
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.d.ts +22 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddChoice.js +52 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.d.ts +29 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PromptAddWizard.js +166 -0
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.d.ts +27 -0
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PromptDeleteSelector.js +119 -0
- package/dist/cli/ink-cli/components/overlays/PromptList.d.ts +33 -0
- package/dist/cli/ink-cli/components/overlays/PromptList.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/PromptList.js +144 -0
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.d.ts +23 -0
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/SearchOverlay.js +189 -0
- package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.d.ts +7 -2
- package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.d.ts.map +1 -1
- package/dist/cli/ink-cli/components/overlays/SessionSelectorRefactored.js +19 -5
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.d.ts +21 -0
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/SessionSubcommandSelector.js +42 -0
- package/dist/cli/ink-cli/components/overlays/StreamSelector.d.ts +20 -0
- package/dist/cli/ink-cli/components/overlays/StreamSelector.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/StreamSelector.js +58 -0
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts +25 -0
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/overlays/ToolBrowser.js +400 -0
- 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 +419 -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 +79 -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.d.ts +21 -0
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/DiffRenderer.js +65 -0
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts +28 -0
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/FilePreviewRenderer.js +66 -0
- package/dist/cli/ink-cli/components/renderers/FileRenderer.d.ts +19 -0
- package/dist/cli/ink-cli/components/renderers/FileRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/FileRenderer.js +26 -0
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.d.ts +21 -0
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/GenericRenderer.js +26 -0
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.d.ts +20 -0
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/SearchRenderer.js +12 -0
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.d.ts +21 -0
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/ShellRenderer.js +25 -0
- package/dist/cli/ink-cli/components/renderers/diff-shared.d.ts +61 -0
- package/dist/cli/ink-cli/components/renderers/diff-shared.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/diff-shared.js +158 -0
- package/dist/cli/ink-cli/components/renderers/index.d.ts +28 -0
- package/dist/cli/ink-cli/components/renderers/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/renderers/index.js +36 -0
- package/dist/cli/ink-cli/components/shared/MarkdownText.d.ts +38 -0
- package/dist/cli/ink-cli/components/shared/MarkdownText.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/shared/MarkdownText.js +362 -0
- package/dist/cli/ink-cli/components/shared/VirtualizedList.d.ts +44 -0
- package/dist/cli/ink-cli/components/shared/VirtualizedList.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/shared/VirtualizedList.js +300 -0
- package/dist/cli/ink-cli/components/shared/text-buffer.d.ts +185 -0
- package/dist/cli/ink-cli/components/shared/text-buffer.d.ts.map +1 -0
- package/dist/cli/ink-cli/components/shared/text-buffer.js +1338 -0
- package/dist/cli/ink-cli/constants/processingPhrases.d.ts +10 -0
- package/dist/cli/ink-cli/constants/processingPhrases.d.ts.map +1 -0
- package/dist/cli/ink-cli/constants/processingPhrases.js +64 -0
- package/dist/cli/ink-cli/constants/tips.d.ts +15 -0
- package/dist/cli/ink-cli/constants/tips.d.ts.map +1 -0
- package/dist/cli/ink-cli/constants/tips.js +53 -0
- package/dist/cli/ink-cli/containers/InputContainer.d.ts +42 -8
- package/dist/cli/ink-cli/containers/InputContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/InputContainer.js +513 -85
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts +23 -5
- package/dist/cli/ink-cli/containers/OverlayContainer.d.ts.map +1 -1
- package/dist/cli/ink-cli/containers/OverlayContainer.js +1214 -132
- package/dist/cli/ink-cli/containers/index.d.ts +1 -1
- package/dist/cli/ink-cli/containers/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/contexts/KeypressContext.d.ts +36 -0
- package/dist/cli/ink-cli/contexts/KeypressContext.d.ts.map +1 -0
- package/dist/cli/ink-cli/contexts/KeypressContext.js +461 -0
- package/dist/cli/ink-cli/contexts/MouseContext.d.ts +27 -0
- package/dist/cli/ink-cli/contexts/MouseContext.d.ts.map +1 -0
- package/dist/cli/ink-cli/contexts/MouseContext.js +102 -0
- package/dist/cli/ink-cli/contexts/ScrollProvider.d.ts +33 -0
- package/dist/cli/ink-cli/contexts/ScrollProvider.d.ts.map +1 -0
- package/dist/cli/ink-cli/contexts/ScrollProvider.js +170 -0
- package/dist/cli/ink-cli/contexts/index.d.ts +7 -0
- package/dist/cli/ink-cli/contexts/index.d.ts.map +1 -0
- package/dist/cli/ink-cli/contexts/index.js +6 -0
- package/dist/cli/ink-cli/hooks/index.d.ts +5 -0
- package/dist/cli/ink-cli/hooks/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/index.js +6 -1
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts +26 -9
- package/dist/cli/ink-cli/hooks/useAgentEvents.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useAgentEvents.js +90 -198
- package/dist/cli/ink-cli/hooks/useBatchedScroll.d.ts +14 -0
- package/dist/cli/ink-cli/hooks/useBatchedScroll.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useBatchedScroll.js +25 -0
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts +50 -0
- package/dist/cli/ink-cli/hooks/useCLIState.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useCLIState.js +190 -0
- package/dist/cli/ink-cli/hooks/useElapsedTime.d.ts +24 -0
- package/dist/cli/ink-cli/hooks/useElapsedTime.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useElapsedTime.js +69 -0
- package/dist/cli/ink-cli/hooks/useHistorySearch.d.ts +61 -0
- package/dist/cli/ink-cli/hooks/useHistorySearch.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useHistorySearch.js +210 -0
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts +136 -0
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useInputOrchestrator.js +663 -0
- package/dist/cli/ink-cli/hooks/useKeyboardShortcuts.d.ts.map +1 -1
- package/dist/cli/ink-cli/hooks/useKeyboardShortcuts.js +7 -26
- package/dist/cli/ink-cli/hooks/useKeypress.d.ts +18 -0
- package/dist/cli/ink-cli/hooks/useKeypress.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useKeypress.js +26 -0
- package/dist/cli/ink-cli/hooks/usePhraseCycler.d.ts +30 -0
- package/dist/cli/ink-cli/hooks/usePhraseCycler.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/usePhraseCycler.js +68 -0
- package/dist/cli/ink-cli/hooks/useStreaming.d.ts +19 -0
- package/dist/cli/ink-cli/hooks/useStreaming.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useStreaming.js +26 -0
- package/dist/cli/ink-cli/hooks/useTerminalSize.d.ts +14 -0
- package/dist/cli/ink-cli/hooks/useTerminalSize.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useTerminalSize.js +31 -0
- package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts +42 -0
- package/dist/cli/ink-cli/hooks/useTokenCounter.d.ts.map +1 -0
- package/dist/cli/ink-cli/hooks/useTokenCounter.js +96 -0
- package/dist/cli/ink-cli/services/CommandService.d.ts +32 -1
- package/dist/cli/ink-cli/services/CommandService.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/CommandService.js +36 -5
- package/dist/cli/ink-cli/services/InputService.d.ts +1 -5
- package/dist/cli/ink-cli/services/InputService.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/InputService.js +1 -8
- package/dist/cli/ink-cli/services/index.d.ts +2 -1
- package/dist/cli/ink-cli/services/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/services/index.js +2 -1
- package/dist/cli/ink-cli/services/processStream.d.ts +69 -0
- package/dist/cli/ink-cli/services/processStream.d.ts.map +1 -0
- package/dist/cli/ink-cli/services/processStream.js +742 -0
- package/dist/cli/ink-cli/state/actions.d.ts +30 -60
- package/dist/cli/ink-cli/state/actions.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/actions.js +3 -0
- package/dist/cli/ink-cli/state/index.d.ts +5 -3
- package/dist/cli/ink-cli/state/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/index.js +4 -3
- package/dist/cli/ink-cli/state/initialState.d.ts +4 -3
- package/dist/cli/ink-cli/state/initialState.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/initialState.js +20 -4
- package/dist/cli/ink-cli/state/reducer.d.ts +3 -0
- package/dist/cli/ink-cli/state/reducer.d.ts.map +1 -1
- package/dist/cli/ink-cli/state/reducer.js +62 -168
- package/dist/cli/ink-cli/state/streaming-state.d.ts +27 -0
- package/dist/cli/ink-cli/state/streaming-state.d.ts.map +1 -0
- package/dist/cli/ink-cli/state/streaming-state.js +39 -0
- package/dist/cli/ink-cli/state/types.d.ts +223 -6
- package/dist/cli/ink-cli/state/types.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/bracketedPaste.d.ts +22 -0
- package/dist/cli/ink-cli/utils/bracketedPaste.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/bracketedPaste.js +27 -0
- package/dist/cli/ink-cli/utils/clipboardUtils.d.ts +49 -0
- package/dist/cli/ink-cli/utils/clipboardUtils.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/clipboardUtils.js +356 -0
- package/dist/cli/ink-cli/utils/commandOverlays.d.ts +33 -0
- package/dist/cli/ink-cli/utils/commandOverlays.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/commandOverlays.js +78 -0
- package/dist/cli/ink-cli/utils/debugLog.d.ts +38 -0
- package/dist/cli/ink-cli/utils/debugLog.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/debugLog.js +66 -0
- package/dist/cli/ink-cli/utils/index.d.ts +2 -1
- package/dist/cli/ink-cli/utils/index.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/index.js +3 -1
- package/dist/cli/ink-cli/utils/input.d.ts +25 -0
- package/dist/cli/ink-cli/utils/input.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/input.js +56 -0
- package/dist/cli/ink-cli/utils/inputParsing.d.ts +0 -9
- package/dist/cli/ink-cli/utils/inputParsing.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/inputParsing.js +0 -27
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts +59 -3
- package/dist/cli/ink-cli/utils/messageFormatting.d.ts.map +1 -1
- package/dist/cli/ink-cli/utils/messageFormatting.js +348 -20
- package/dist/cli/ink-cli/utils/mouse.d.ts +61 -0
- package/dist/cli/ink-cli/utils/mouse.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/mouse.js +209 -0
- package/dist/cli/ink-cli/utils/streamSplitter.d.ts +44 -0
- package/dist/cli/ink-cli/utils/streamSplitter.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/streamSplitter.js +154 -0
- package/dist/cli/ink-cli/utils/textUtils.d.ts +63 -0
- package/dist/cli/ink-cli/utils/textUtils.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/textUtils.js +248 -0
- package/dist/cli/ink-cli/utils/toolUtils.d.ts +9 -0
- package/dist/cli/ink-cli/utils/toolUtils.d.ts.map +1 -0
- package/dist/cli/ink-cli/utils/toolUtils.js +15 -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.d.ts.map +1 -1
- package/dist/cli/utils/options.js +1 -3
- 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 +45 -2
- package/dist/config/cli-overrides.d.ts.map +1 -1
- package/dist/config/cli-overrides.js +107 -10
- package/dist/index.js +379 -99
- package/dist/utils/agent-helpers.d.ts +95 -0
- package/dist/utils/agent-helpers.d.ts.map +1 -0
- package/dist/utils/agent-helpers.js +117 -0
- package/dist/webui/assets/index-8j-KMkX1.js +2054 -0
- package/dist/webui/assets/index-c_AX24V4.css +1 -0
- package/dist/webui/assets/{tanstack-DgxBONJY.js → tanstack-Br79RQ-n.js} +1 -1
- package/dist/webui/index.html +4 -10
- 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 +18 -15
- package/dist/cli/commands/interactive-commands/index.d.ts +0 -63
- package/dist/cli/commands/interactive-commands/index.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/index.js +0 -73
- package/dist/cli/commands/interactive-commands/mcp/mcp-add-utils.d.ts +0 -34
- package/dist/cli/commands/interactive-commands/mcp/mcp-add-utils.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/mcp/mcp-add-utils.js +0 -178
- package/dist/cli/commands/interactive-commands/mcp/mcp-commands.d.ts +0 -9
- package/dist/cli/commands/interactive-commands/mcp/mcp-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/mcp/mcp-commands.js +0 -325
- package/dist/cli/commands/interactive-commands/model/model-commands.d.ts +0 -21
- package/dist/cli/commands/interactive-commands/model/model-commands.d.ts.map +0 -1
- package/dist/cli/commands/interactive-commands/model/model-commands.js +0 -190
- package/dist/cli/ink-cli/components/MultiLineTextInput.d.ts +0 -26
- package/dist/cli/ink-cli/components/MultiLineTextInput.d.ts.map +0 -1
- package/dist/cli/ink-cli/components/MultiLineTextInput.js +0 -220
- package/dist/discord/bot.d.ts +0 -4
- package/dist/discord/bot.d.ts.map +0 -1
- package/dist/discord/bot.js +0 -193
- package/dist/telegram/bot.d.ts +0 -5
- package/dist/telegram/bot.d.ts.map +0 -1
- package/dist/telegram/bot.js +0 -251
- package/dist/webui/assets/index-DKq5Xng1.js +0 -687
- package/dist/webui/assets/index-D_0_GBu5.css +0 -1
|
@@ -0,0 +1,1089 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template Engine for Dexto Project Scaffolding
|
|
3
|
+
*
|
|
4
|
+
* Provides code generation functions for various project types.
|
|
5
|
+
* Uses the image/harness terminology strategy:
|
|
6
|
+
* - "Image" for distributable artifacts, packages, composition
|
|
7
|
+
* - "Harness" for runtime behavior, what it provides
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Generates src/index.ts for an app using an image
|
|
11
|
+
*/
|
|
12
|
+
export function generateIndexForImage(context) {
|
|
13
|
+
return `// Load image environment (Pattern 1: Static Import)
|
|
14
|
+
// This auto-registers providers as a side-effect
|
|
15
|
+
import '${context.imageName}';
|
|
16
|
+
|
|
17
|
+
// Import from core packages
|
|
18
|
+
import { DextoAgent } from '@dexto/core';
|
|
19
|
+
import { loadAgentConfig } from '@dexto/agent-management';
|
|
20
|
+
|
|
21
|
+
async function main() {
|
|
22
|
+
console.log('🚀 Starting ${context.projectName}\\n');
|
|
23
|
+
|
|
24
|
+
// Load agent configuration
|
|
25
|
+
const config = await loadAgentConfig('./agents/default.yml');
|
|
26
|
+
|
|
27
|
+
// Create agent - providers already registered by image environment
|
|
28
|
+
const agent = new DextoAgent(config, './agents/default.yml');
|
|
29
|
+
|
|
30
|
+
await agent.start();
|
|
31
|
+
console.log('✅ Agent started\\n');
|
|
32
|
+
|
|
33
|
+
// Create a session
|
|
34
|
+
const session = await agent.createSession();
|
|
35
|
+
|
|
36
|
+
// Example interaction
|
|
37
|
+
const response = await agent.run(
|
|
38
|
+
'Hello! What can you help me with?',
|
|
39
|
+
undefined, // imageDataInput
|
|
40
|
+
undefined, // fileDataInput
|
|
41
|
+
session.id // sessionId
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
console.log('Agent response:', response);
|
|
45
|
+
|
|
46
|
+
// Cleanup
|
|
47
|
+
await agent.stop();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
main().catch((error) => {
|
|
51
|
+
console.error('Error:', error);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
});
|
|
54
|
+
`;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Generates src/index.ts for a web server application using an image
|
|
58
|
+
*/
|
|
59
|
+
export function generateWebServerIndex(context) {
|
|
60
|
+
return `// Load image environment (Pattern 1: Static Import)
|
|
61
|
+
// This auto-registers providers as a side-effect
|
|
62
|
+
import '${context.imageName}';
|
|
63
|
+
|
|
64
|
+
// Import from core packages
|
|
65
|
+
import { DextoAgent } from '@dexto/core';
|
|
66
|
+
import { loadAgentConfig } from '@dexto/agent-management';
|
|
67
|
+
import { startDextoServer } from '@dexto/server';
|
|
68
|
+
import { resolve } from 'node:path';
|
|
69
|
+
import { existsSync } from 'node:fs';
|
|
70
|
+
|
|
71
|
+
async function main() {
|
|
72
|
+
console.log('🚀 Starting ${context.projectName}\\n');
|
|
73
|
+
|
|
74
|
+
// Load agent configuration
|
|
75
|
+
console.log('📝 Loading configuration...');
|
|
76
|
+
const config = await loadAgentConfig('./agents/default.yml');
|
|
77
|
+
console.log('✅ Config loaded\\n');
|
|
78
|
+
|
|
79
|
+
// Create agent
|
|
80
|
+
console.log('🤖 Creating agent...');
|
|
81
|
+
const agent = new DextoAgent(config, './agents/default.yml');
|
|
82
|
+
console.log('✅ Agent created\\n');
|
|
83
|
+
|
|
84
|
+
// Start the server
|
|
85
|
+
console.log('🌐 Starting Dexto server...');
|
|
86
|
+
|
|
87
|
+
const webRoot = resolve(process.cwd(), 'app');
|
|
88
|
+
|
|
89
|
+
if (!existsSync(webRoot)) {
|
|
90
|
+
console.error(\`❌ Error: Web root not found at \${webRoot}\`);
|
|
91
|
+
console.error(' Make sure the app/ directory exists');
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
console.log(\`📁 Serving static files from: \${webRoot}\`);
|
|
96
|
+
|
|
97
|
+
const { stop } = await startDextoServer(agent, {
|
|
98
|
+
port: 3000,
|
|
99
|
+
webRoot,
|
|
100
|
+
agentCard: {
|
|
101
|
+
name: '${context.projectName}',
|
|
102
|
+
description: '${context.description}',
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
console.log('\\n✅ Server is running!\\n');
|
|
107
|
+
console.log('🌐 Open your browser:');
|
|
108
|
+
console.log(' http://localhost:3000\\n');
|
|
109
|
+
console.log('📚 Available endpoints:');
|
|
110
|
+
console.log(' • Web UI: http://localhost:3000');
|
|
111
|
+
console.log(' • REST API: http://localhost:3000/api/*');
|
|
112
|
+
console.log(' • Health Check: http://localhost:3000/health');
|
|
113
|
+
console.log(' • OpenAPI Spec: http://localhost:3000/openapi.json');
|
|
114
|
+
console.log(' • Agent Card: http://localhost:3000/.well-known/agent-card.json\\n');
|
|
115
|
+
|
|
116
|
+
console.log('Press Ctrl+C to stop the server...\\n');
|
|
117
|
+
|
|
118
|
+
// Handle graceful shutdown
|
|
119
|
+
const shutdown = async () => {
|
|
120
|
+
console.log('\\n🛑 Shutting down...');
|
|
121
|
+
await stop();
|
|
122
|
+
console.log('✅ Server stopped\\n');
|
|
123
|
+
process.exit(0);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
process.on('SIGINT', shutdown);
|
|
127
|
+
process.on('SIGTERM', shutdown);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
main().catch((error) => {
|
|
131
|
+
console.error('Error:', error);
|
|
132
|
+
process.exit(1);
|
|
133
|
+
});
|
|
134
|
+
`;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Generates HTML for web app
|
|
138
|
+
*/
|
|
139
|
+
export function generateWebAppHTML(projectName) {
|
|
140
|
+
return `<!DOCTYPE html>
|
|
141
|
+
<html lang="en">
|
|
142
|
+
<head>
|
|
143
|
+
<meta charset="UTF-8">
|
|
144
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
145
|
+
<title>${projectName}</title>
|
|
146
|
+
<link rel="stylesheet" href="/assets/style.css">
|
|
147
|
+
</head>
|
|
148
|
+
<body>
|
|
149
|
+
<div class="container">
|
|
150
|
+
<header>
|
|
151
|
+
<h1>🤖 ${projectName}</h1>
|
|
152
|
+
<p class="subtitle">AI-Powered Assistant</p>
|
|
153
|
+
<div class="session-info">
|
|
154
|
+
<span id="session-status">Initializing...</span>
|
|
155
|
+
</div>
|
|
156
|
+
</header>
|
|
157
|
+
|
|
158
|
+
<div class="chat-container">
|
|
159
|
+
<div id="messages" class="messages"></div>
|
|
160
|
+
|
|
161
|
+
<div class="input-container">
|
|
162
|
+
<input
|
|
163
|
+
type="text"
|
|
164
|
+
id="message-input"
|
|
165
|
+
placeholder="Type your message..."
|
|
166
|
+
disabled
|
|
167
|
+
/>
|
|
168
|
+
<button id="send-button" disabled>Send</button>
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
|
|
173
|
+
<script src="/assets/main.js"></script>
|
|
174
|
+
</body>
|
|
175
|
+
</html>
|
|
176
|
+
`;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Generates JavaScript for web app
|
|
180
|
+
*/
|
|
181
|
+
export function generateWebAppJS() {
|
|
182
|
+
return `// Dexto Chat - Frontend
|
|
183
|
+
// Use relative URL so it works regardless of hostname/port
|
|
184
|
+
const API_BASE = '/api';
|
|
185
|
+
|
|
186
|
+
let sessionId = null;
|
|
187
|
+
let isProcessing = false;
|
|
188
|
+
|
|
189
|
+
// DOM elements
|
|
190
|
+
const messagesContainer = document.getElementById('messages');
|
|
191
|
+
const messageInput = document.getElementById('message-input');
|
|
192
|
+
const sendButton = document.getElementById('send-button');
|
|
193
|
+
const sessionStatus = document.getElementById('session-status');
|
|
194
|
+
|
|
195
|
+
// Initialize the app
|
|
196
|
+
async function init() {
|
|
197
|
+
try {
|
|
198
|
+
sessionStatus.textContent = 'Creating session...';
|
|
199
|
+
|
|
200
|
+
// Create a new session
|
|
201
|
+
const response = await fetch(\`\${API_BASE}/sessions\`, {
|
|
202
|
+
method: 'POST',
|
|
203
|
+
headers: { 'Content-Type': 'application/json' },
|
|
204
|
+
body: JSON.stringify({}),
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
if (!response.ok) {
|
|
208
|
+
throw new Error(\`Failed to create session: \${response.statusText}\`);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const data = await response.json();
|
|
212
|
+
sessionId = data.session.id;
|
|
213
|
+
|
|
214
|
+
sessionStatus.textContent = \`Session: \${sessionId.substring(0, 12)}...\`;
|
|
215
|
+
|
|
216
|
+
// Enable input
|
|
217
|
+
messageInput.disabled = false;
|
|
218
|
+
sendButton.disabled = false;
|
|
219
|
+
messageInput.focus();
|
|
220
|
+
|
|
221
|
+
// Add welcome message
|
|
222
|
+
addMessage('assistant', "Hello! I'm your Dexto assistant. How can I help you today?");
|
|
223
|
+
} catch (error) {
|
|
224
|
+
console.error('Initialization error:', error);
|
|
225
|
+
const errorMsg = error.message || String(error);
|
|
226
|
+
showError(\`Failed to initialize: \${errorMsg}\`);
|
|
227
|
+
sessionStatus.textContent = \`Error: \${errorMsg}\`;
|
|
228
|
+
|
|
229
|
+
// Log more details for debugging
|
|
230
|
+
console.error('Full error details:', {
|
|
231
|
+
error,
|
|
232
|
+
apiBase: API_BASE,
|
|
233
|
+
url: \`\${API_BASE}/sessions\`,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Send a message to the agent
|
|
239
|
+
async function sendMessage() {
|
|
240
|
+
const text = messageInput.value.trim();
|
|
241
|
+
if (!text || isProcessing) return;
|
|
242
|
+
|
|
243
|
+
// Add user message to UI
|
|
244
|
+
addMessage('user', text);
|
|
245
|
+
messageInput.value = '';
|
|
246
|
+
messageInput.disabled = true;
|
|
247
|
+
sendButton.disabled = true;
|
|
248
|
+
isProcessing = true;
|
|
249
|
+
|
|
250
|
+
// Add loading indicator
|
|
251
|
+
const loadingId = addMessage('assistant', 'Thinking...', true);
|
|
252
|
+
|
|
253
|
+
try {
|
|
254
|
+
const response = await fetch(\`\${API_BASE}/message-sync\`, {
|
|
255
|
+
method: 'POST',
|
|
256
|
+
headers: { 'Content-Type': 'application/json' },
|
|
257
|
+
body: JSON.stringify({
|
|
258
|
+
content: text,
|
|
259
|
+
sessionId: sessionId,
|
|
260
|
+
}),
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
if (!response.ok) {
|
|
264
|
+
const errorData = await response.json().catch(() => ({}));
|
|
265
|
+
throw new Error(errorData.error?.message || response.statusText);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const data = await response.json();
|
|
269
|
+
|
|
270
|
+
// Remove loading indicator
|
|
271
|
+
removeMessage(loadingId);
|
|
272
|
+
|
|
273
|
+
// Add agent response
|
|
274
|
+
addMessage('assistant', data.response);
|
|
275
|
+
|
|
276
|
+
// Show token usage in console
|
|
277
|
+
if (data.tokenUsage) {
|
|
278
|
+
console.log('Token usage:', data.tokenUsage);
|
|
279
|
+
}
|
|
280
|
+
} catch (error) {
|
|
281
|
+
console.error('Send message error:', error);
|
|
282
|
+
removeMessage(loadingId);
|
|
283
|
+
showError(\`Failed to send message: \${error.message}\`);
|
|
284
|
+
} finally {
|
|
285
|
+
isProcessing = false;
|
|
286
|
+
messageInput.disabled = false;
|
|
287
|
+
sendButton.disabled = false;
|
|
288
|
+
messageInput.focus();
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Add a message to the chat UI
|
|
293
|
+
function addMessage(role, content, isLoading = false) {
|
|
294
|
+
const messageId = \`msg-\${Date.now()}-\${Math.random()}\`;
|
|
295
|
+
const messageEl = document.createElement('div');
|
|
296
|
+
messageEl.className = \`message \${role}\`;
|
|
297
|
+
messageEl.id = messageId;
|
|
298
|
+
|
|
299
|
+
const avatar = document.createElement('div');
|
|
300
|
+
avatar.className = 'message-avatar';
|
|
301
|
+
avatar.textContent = role === 'user' ? '👤' : '🤖';
|
|
302
|
+
|
|
303
|
+
const contentEl = document.createElement('div');
|
|
304
|
+
contentEl.className = \`message-content \${isLoading ? 'loading' : ''}\`;
|
|
305
|
+
contentEl.textContent = content;
|
|
306
|
+
|
|
307
|
+
messageEl.appendChild(avatar);
|
|
308
|
+
messageEl.appendChild(contentEl);
|
|
309
|
+
|
|
310
|
+
messagesContainer.appendChild(messageEl);
|
|
311
|
+
messagesContainer.scrollTop = messagesContainer.scrollHeight;
|
|
312
|
+
|
|
313
|
+
return messageId;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// Remove a message from the UI
|
|
317
|
+
function removeMessage(messageId) {
|
|
318
|
+
const messageEl = document.getElementById(messageId);
|
|
319
|
+
if (messageEl) {
|
|
320
|
+
messageEl.remove();
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// Show an error message
|
|
325
|
+
function showError(message) {
|
|
326
|
+
const errorEl = document.createElement('div');
|
|
327
|
+
errorEl.className = 'error-message';
|
|
328
|
+
errorEl.textContent = \`Error: \${message}\`;
|
|
329
|
+
messagesContainer.appendChild(errorEl);
|
|
330
|
+
messagesContainer.scrollTop = messagesContainer.scrollHeight;
|
|
331
|
+
|
|
332
|
+
// Auto-remove after 5 seconds
|
|
333
|
+
setTimeout(() => errorEl.remove(), 5000);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// Event listeners
|
|
337
|
+
sendButton.addEventListener('click', sendMessage);
|
|
338
|
+
|
|
339
|
+
messageInput.addEventListener('keypress', (e) => {
|
|
340
|
+
if (e.key === 'Enter' && !e.shiftKey) {
|
|
341
|
+
e.preventDefault();
|
|
342
|
+
sendMessage();
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
// Initialize when page loads
|
|
347
|
+
document.addEventListener('DOMContentLoaded', init);
|
|
348
|
+
`;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Generates CSS for web app
|
|
352
|
+
*/
|
|
353
|
+
export function generateWebAppCSS() {
|
|
354
|
+
return `* {
|
|
355
|
+
margin: 0;
|
|
356
|
+
padding: 0;
|
|
357
|
+
box-sizing: border-box;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
body {
|
|
361
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
362
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
363
|
+
min-height: 100vh;
|
|
364
|
+
display: flex;
|
|
365
|
+
align-items: center;
|
|
366
|
+
justify-content: center;
|
|
367
|
+
padding: 20px;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.container {
|
|
371
|
+
width: 100%;
|
|
372
|
+
max-width: 800px;
|
|
373
|
+
background: white;
|
|
374
|
+
border-radius: 16px;
|
|
375
|
+
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
|
376
|
+
overflow: hidden;
|
|
377
|
+
display: flex;
|
|
378
|
+
flex-direction: column;
|
|
379
|
+
height: 90vh;
|
|
380
|
+
max-height: 700px;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
header {
|
|
384
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
385
|
+
color: white;
|
|
386
|
+
padding: 24px;
|
|
387
|
+
text-align: center;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
header h1 {
|
|
391
|
+
font-size: 28px;
|
|
392
|
+
margin-bottom: 8px;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.subtitle {
|
|
396
|
+
font-size: 14px;
|
|
397
|
+
opacity: 0.9;
|
|
398
|
+
margin-bottom: 12px;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.session-info {
|
|
402
|
+
font-size: 12px;
|
|
403
|
+
opacity: 0.8;
|
|
404
|
+
font-family: 'Monaco', 'Courier New', monospace;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.chat-container {
|
|
408
|
+
flex: 1;
|
|
409
|
+
display: flex;
|
|
410
|
+
flex-direction: column;
|
|
411
|
+
overflow: hidden;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.messages {
|
|
415
|
+
flex: 1;
|
|
416
|
+
overflow-y: auto;
|
|
417
|
+
padding: 24px;
|
|
418
|
+
display: flex;
|
|
419
|
+
flex-direction: column;
|
|
420
|
+
gap: 16px;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.message {
|
|
424
|
+
display: flex;
|
|
425
|
+
gap: 12px;
|
|
426
|
+
animation: slideIn 0.3s ease-out;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
@keyframes slideIn {
|
|
430
|
+
from {
|
|
431
|
+
opacity: 0;
|
|
432
|
+
transform: translateY(10px);
|
|
433
|
+
}
|
|
434
|
+
to {
|
|
435
|
+
opacity: 1;
|
|
436
|
+
transform: translateY(0);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.message.user {
|
|
441
|
+
flex-direction: row-reverse;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
.message-avatar {
|
|
445
|
+
width: 40px;
|
|
446
|
+
height: 40px;
|
|
447
|
+
border-radius: 50%;
|
|
448
|
+
display: flex;
|
|
449
|
+
align-items: center;
|
|
450
|
+
justify-content: center;
|
|
451
|
+
font-size: 20px;
|
|
452
|
+
flex-shrink: 0;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
.message.user .message-avatar {
|
|
456
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.message.assistant .message-avatar {
|
|
460
|
+
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
.message-content {
|
|
464
|
+
max-width: 70%;
|
|
465
|
+
padding: 12px 16px;
|
|
466
|
+
border-radius: 12px;
|
|
467
|
+
line-height: 1.5;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.message.user .message-content {
|
|
471
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
472
|
+
color: white;
|
|
473
|
+
border-bottom-right-radius: 4px;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.message.assistant .message-content {
|
|
477
|
+
background: #f5f5f5;
|
|
478
|
+
color: #333;
|
|
479
|
+
border-bottom-left-radius: 4px;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.message-content.loading {
|
|
483
|
+
font-style: italic;
|
|
484
|
+
opacity: 0.7;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
.input-container {
|
|
488
|
+
display: flex;
|
|
489
|
+
gap: 12px;
|
|
490
|
+
padding: 20px 24px;
|
|
491
|
+
border-top: 1px solid #e5e5e5;
|
|
492
|
+
background: white;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
#message-input {
|
|
496
|
+
flex: 1;
|
|
497
|
+
padding: 12px 16px;
|
|
498
|
+
border: 2px solid #e5e5e5;
|
|
499
|
+
border-radius: 24px;
|
|
500
|
+
font-size: 15px;
|
|
501
|
+
outline: none;
|
|
502
|
+
transition: border-color 0.2s;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
#message-input:focus {
|
|
506
|
+
border-color: #667eea;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
#message-input:disabled {
|
|
510
|
+
background: #f5f5f5;
|
|
511
|
+
cursor: not-allowed;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
#send-button {
|
|
515
|
+
padding: 12px 28px;
|
|
516
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
517
|
+
color: white;
|
|
518
|
+
border: none;
|
|
519
|
+
border-radius: 24px;
|
|
520
|
+
font-size: 15px;
|
|
521
|
+
font-weight: 600;
|
|
522
|
+
cursor: pointer;
|
|
523
|
+
transition: transform 0.2s, opacity 0.2s;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
#send-button:hover:not(:disabled) {
|
|
527
|
+
transform: translateY(-2px);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
#send-button:active:not(:disabled) {
|
|
531
|
+
transform: translateY(0);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
#send-button:disabled {
|
|
535
|
+
opacity: 0.5;
|
|
536
|
+
cursor: not-allowed;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
.error-message {
|
|
540
|
+
background: #fee;
|
|
541
|
+
color: #c33;
|
|
542
|
+
padding: 12px 16px;
|
|
543
|
+
border-radius: 8px;
|
|
544
|
+
margin: 16px 24px;
|
|
545
|
+
border-left: 4px solid #c33;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/* Scrollbar styling */
|
|
549
|
+
.messages::-webkit-scrollbar {
|
|
550
|
+
width: 8px;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
.messages::-webkit-scrollbar-track {
|
|
554
|
+
background: #f1f1f1;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
.messages::-webkit-scrollbar-thumb {
|
|
558
|
+
background: #888;
|
|
559
|
+
border-radius: 4px;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
.messages::-webkit-scrollbar-thumb:hover {
|
|
563
|
+
background: #555;
|
|
564
|
+
}
|
|
565
|
+
`;
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Generates dexto.image.ts file for an image project
|
|
569
|
+
*/
|
|
570
|
+
export function generateDextoImageFile(context) {
|
|
571
|
+
const extendsField = context.baseImage ? ` extends: '${context.baseImage}',\n` : '';
|
|
572
|
+
return `import { defineImage } from '@dexto/core';
|
|
573
|
+
|
|
574
|
+
export default defineImage({
|
|
575
|
+
name: '${context.imageName || context.projectName}',
|
|
576
|
+
version: '1.0.0',
|
|
577
|
+
description: '${context.description}',
|
|
578
|
+
target: '${context.target || 'local-development'}',
|
|
579
|
+
${extendsField}
|
|
580
|
+
// Providers are AUTO-DISCOVERED from convention-based folders:
|
|
581
|
+
// tools/ - Custom tool providers
|
|
582
|
+
// blob-store/ - Blob storage providers
|
|
583
|
+
// compression/ - Compression strategy providers
|
|
584
|
+
// plugins/ - Plugin providers
|
|
585
|
+
//
|
|
586
|
+
// Each provider must export from an index.ts file in its folder.
|
|
587
|
+
// The bundler will automatically register them when the image is imported.
|
|
588
|
+
|
|
589
|
+
providers: {
|
|
590
|
+
// Manual registration for built-in core providers
|
|
591
|
+
// (These come from core, not from our providers/ folder)
|
|
592
|
+
// TODO: This is a hack to get the local blob store provider to work. Should be auto-registered or dealt with in a better way.
|
|
593
|
+
blobStore: {
|
|
594
|
+
register: async () => {
|
|
595
|
+
const { localBlobStoreProvider, inMemoryBlobStoreProvider } = await import(
|
|
596
|
+
'@dexto/core'
|
|
597
|
+
);
|
|
598
|
+
const { blobStoreRegistry } = await import('@dexto/core');
|
|
599
|
+
|
|
600
|
+
blobStoreRegistry.register(localBlobStoreProvider);
|
|
601
|
+
blobStoreRegistry.register(inMemoryBlobStoreProvider);
|
|
602
|
+
|
|
603
|
+
console.log('✓ Registered core blob storage providers: local, in-memory');
|
|
604
|
+
},
|
|
605
|
+
},
|
|
606
|
+
},
|
|
607
|
+
|
|
608
|
+
defaults: {
|
|
609
|
+
storage: {
|
|
610
|
+
blob: {
|
|
611
|
+
type: 'local',
|
|
612
|
+
storePath: './data/blobs',
|
|
613
|
+
},
|
|
614
|
+
database: {
|
|
615
|
+
type: 'sqlite',
|
|
616
|
+
path: './data/agent.db',
|
|
617
|
+
},
|
|
618
|
+
cache: {
|
|
619
|
+
type: 'in-memory',
|
|
620
|
+
},
|
|
621
|
+
},
|
|
622
|
+
logging: {
|
|
623
|
+
level: 'info',
|
|
624
|
+
fileLogging: true,
|
|
625
|
+
},
|
|
626
|
+
},
|
|
627
|
+
|
|
628
|
+
constraints: ['filesystem-required', 'offline-capable'],
|
|
629
|
+
});
|
|
630
|
+
`;
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Generates dexto.config.ts file for manual registration projects
|
|
634
|
+
*/
|
|
635
|
+
export function generateDextoConfigFile(context) {
|
|
636
|
+
return `/**
|
|
637
|
+
* ${context.projectName} - Provider Registration
|
|
638
|
+
*
|
|
639
|
+
* This file registers all custom providers before agent initialization.
|
|
640
|
+
* This is the manual registration approach - for most use cases, consider
|
|
641
|
+
* using Dexto images instead (see: dexto create-image).
|
|
642
|
+
*/
|
|
643
|
+
|
|
644
|
+
import {
|
|
645
|
+
blobStoreRegistry,
|
|
646
|
+
customToolRegistry,
|
|
647
|
+
compactionRegistry,
|
|
648
|
+
pluginRegistry,
|
|
649
|
+
} from '@dexto/core';
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* Project metadata
|
|
653
|
+
*/
|
|
654
|
+
export const projectConfig = {
|
|
655
|
+
name: '${context.projectName}',
|
|
656
|
+
version: '1.0.0',
|
|
657
|
+
description: '${context.description}',
|
|
658
|
+
};
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Register all custom providers
|
|
662
|
+
*
|
|
663
|
+
* This function is called at application startup before loading agent configs.
|
|
664
|
+
* Register your providers here by importing them and calling the appropriate
|
|
665
|
+
* registry.register() method.
|
|
666
|
+
*/
|
|
667
|
+
export function registerProviders() {
|
|
668
|
+
// Example: Register blob storage provider
|
|
669
|
+
// import { myBlobProvider } from './storage/my-blob.js';
|
|
670
|
+
// blobStoreRegistry.register(myBlobProvider);
|
|
671
|
+
|
|
672
|
+
// Example: Register custom tool
|
|
673
|
+
// import { myToolProvider } from './tools/my-tool.js';
|
|
674
|
+
// customToolRegistry.register(myToolProvider);
|
|
675
|
+
|
|
676
|
+
// Example: Register plugin
|
|
677
|
+
// import { myPluginProvider } from './plugins/my-plugin.js';
|
|
678
|
+
// pluginRegistry.register(myPluginProvider);
|
|
679
|
+
|
|
680
|
+
console.log(\`✓ Registered providers for \${projectConfig.name}\`);
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Optional: Project-wide initialization logic
|
|
685
|
+
* Use this for setting up monitoring, analytics, error tracking, etc.
|
|
686
|
+
*/
|
|
687
|
+
export async function initialize() {
|
|
688
|
+
console.log(\`✓ Initialized \${projectConfig.name} v\${projectConfig.version}\`);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* Optional: Cleanup logic
|
|
693
|
+
* Called when the application shuts down
|
|
694
|
+
*/
|
|
695
|
+
export async function cleanup() {
|
|
696
|
+
console.log(\`✓ Cleaned up \${projectConfig.name}\`);
|
|
697
|
+
}
|
|
698
|
+
`;
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* Generates README.md for an image project
|
|
702
|
+
*/
|
|
703
|
+
export function generateImageReadme(context) {
|
|
704
|
+
const imageName = context.imageName || context.projectName;
|
|
705
|
+
const extendsNote = context.baseImage
|
|
706
|
+
? `\n\nThis image extends \`${context.baseImage}\`, inheriting its providers and adding custom ones.\n`
|
|
707
|
+
: '';
|
|
708
|
+
return `# ${imageName}
|
|
709
|
+
|
|
710
|
+
${context.description}${extendsNote}
|
|
711
|
+
|
|
712
|
+
## What is this?
|
|
713
|
+
|
|
714
|
+
A **Dexto image** - a pre-configured agent harness packaged as an npm module.
|
|
715
|
+
Install it, import it, and you have a complete runtime harness ready to use.
|
|
716
|
+
|
|
717
|
+
## What's Included
|
|
718
|
+
|
|
719
|
+
The harness provides:
|
|
720
|
+
- ✅ Pre-registered providers (auto-discovered from convention-based folders)
|
|
721
|
+
- ✅ Runtime orchestration
|
|
722
|
+
- ✅ Context management
|
|
723
|
+
- ✅ Default configurations
|
|
724
|
+
|
|
725
|
+
## Quick Start
|
|
726
|
+
|
|
727
|
+
\`\`\`bash
|
|
728
|
+
# Build the image
|
|
729
|
+
pnpm run build
|
|
730
|
+
|
|
731
|
+
# Use in your app
|
|
732
|
+
pnpm add ${imageName}
|
|
733
|
+
\`\`\`
|
|
734
|
+
|
|
735
|
+
## Usage
|
|
736
|
+
|
|
737
|
+
\`\`\`typescript
|
|
738
|
+
import { createAgent } from '${imageName}';
|
|
739
|
+
import { loadAgentConfig } from '@dexto/agent-management';
|
|
740
|
+
|
|
741
|
+
const config = await loadAgentConfig('./agents/default.yml');
|
|
742
|
+
|
|
743
|
+
// Import creates the harness (providers auto-registered)
|
|
744
|
+
const agent = createAgent(config);
|
|
745
|
+
|
|
746
|
+
// The harness handles everything
|
|
747
|
+
await agent.start();
|
|
748
|
+
\`\`\`
|
|
749
|
+
|
|
750
|
+
## Adding Providers
|
|
751
|
+
|
|
752
|
+
Add your custom providers to convention-based folders:
|
|
753
|
+
- \`tools/\` - Custom tool providers
|
|
754
|
+
- \`blob-store/\` - Blob storage providers
|
|
755
|
+
- \`compression/\` - Compression strategies
|
|
756
|
+
- \`plugins/\` - Plugin providers
|
|
757
|
+
|
|
758
|
+
**Convention:** Each provider lives in its own folder with an \`index.ts\` file.
|
|
759
|
+
|
|
760
|
+
Example:
|
|
761
|
+
\`\`\`
|
|
762
|
+
tools/
|
|
763
|
+
my-tool/
|
|
764
|
+
index.ts # Provider implementation (auto-discovered)
|
|
765
|
+
helpers.ts # Optional helper functions
|
|
766
|
+
types.ts # Optional type definitions
|
|
767
|
+
\`\`\`
|
|
768
|
+
|
|
769
|
+
## Building
|
|
770
|
+
|
|
771
|
+
\`\`\`bash
|
|
772
|
+
pnpm run build
|
|
773
|
+
\`\`\`
|
|
774
|
+
|
|
775
|
+
This runs \`dexto-bundle build\` which:
|
|
776
|
+
1. Discovers providers from convention-based folders
|
|
777
|
+
2. Generates \`dist/index.js\` with side-effect registration
|
|
778
|
+
3. Exports \`createAgent()\` factory function
|
|
779
|
+
|
|
780
|
+
## Architecture
|
|
781
|
+
|
|
782
|
+
When imported, this image:
|
|
783
|
+
1. Auto-registers providers (side effect)
|
|
784
|
+
2. Exposes harness factory (\`createAgent\`)
|
|
785
|
+
3. Re-exports registries for runtime customization
|
|
786
|
+
|
|
787
|
+
The resulting harness manages your agent's runtime, including provider lifecycle,
|
|
788
|
+
context management, and tool orchestration.
|
|
789
|
+
|
|
790
|
+
## Publishing
|
|
791
|
+
|
|
792
|
+
\`\`\`bash
|
|
793
|
+
npm publish
|
|
794
|
+
\`\`\`
|
|
795
|
+
|
|
796
|
+
Users can then:
|
|
797
|
+
\`\`\`bash
|
|
798
|
+
pnpm add ${imageName}
|
|
799
|
+
\`\`\`
|
|
800
|
+
|
|
801
|
+
## Learn More
|
|
802
|
+
|
|
803
|
+
- [Dexto Images Guide](https://docs.dexto.ai/docs/guides/images)
|
|
804
|
+
- [Provider Development](https://docs.dexto.ai/docs/guides/providers)
|
|
805
|
+
- [Bundler Documentation](https://docs.dexto.ai/docs/tools/bundler)
|
|
806
|
+
`;
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Generates an example custom tool provider
|
|
810
|
+
*/
|
|
811
|
+
export function generateExampleTool(toolName = 'example-tool') {
|
|
812
|
+
// Convert kebab-case to camelCase for provider name
|
|
813
|
+
const providerName = toolName.replace(/-([a-z])/g, (_, char) => char.toUpperCase());
|
|
814
|
+
return `import { z } from 'zod';
|
|
815
|
+
import type { CustomToolProvider, InternalTool, ToolCreationContext } from '@dexto/core';
|
|
816
|
+
|
|
817
|
+
const ConfigSchema = z
|
|
818
|
+
.object({
|
|
819
|
+
type: z.literal('${toolName}'),
|
|
820
|
+
// Add your configuration options here
|
|
821
|
+
})
|
|
822
|
+
.strict();
|
|
823
|
+
|
|
824
|
+
type ${providerName.charAt(0).toUpperCase() + providerName.slice(1)}Config = z.output<typeof ConfigSchema>;
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* Example custom tool provider
|
|
828
|
+
*
|
|
829
|
+
* This demonstrates how to create a custom tool that can be used by the agent.
|
|
830
|
+
* The tool is auto-discovered by the bundler when placed in the tools/ folder.
|
|
831
|
+
*/
|
|
832
|
+
export const ${providerName}Provider: CustomToolProvider<'${toolName}', ${providerName.charAt(0).toUpperCase() + providerName.slice(1)}Config> = {
|
|
833
|
+
type: '${toolName}',
|
|
834
|
+
configSchema: ConfigSchema,
|
|
835
|
+
|
|
836
|
+
create: (config: ${providerName.charAt(0).toUpperCase() + providerName.slice(1)}Config, context: ToolCreationContext): InternalTool[] => {
|
|
837
|
+
// Create and return tools
|
|
838
|
+
const tool: InternalTool = {
|
|
839
|
+
id: '${providerName}',
|
|
840
|
+
description: 'An example custom tool that demonstrates the tool provider pattern',
|
|
841
|
+
inputSchema: z.object({
|
|
842
|
+
input: z.string().describe('Input text to process'),
|
|
843
|
+
}),
|
|
844
|
+
|
|
845
|
+
execute: async (input: unknown) => {
|
|
846
|
+
const { input: inputText } = input as { input: string };
|
|
847
|
+
context.logger.info(\`Example tool called with: \${inputText}\`);
|
|
848
|
+
|
|
849
|
+
// Your tool logic here
|
|
850
|
+
return {
|
|
851
|
+
result: \`Processed: \${inputText}\`,
|
|
852
|
+
};
|
|
853
|
+
},
|
|
854
|
+
};
|
|
855
|
+
|
|
856
|
+
return [tool];
|
|
857
|
+
},
|
|
858
|
+
|
|
859
|
+
metadata: {
|
|
860
|
+
displayName: 'Example Tool',
|
|
861
|
+
description: 'Example custom tool provider',
|
|
862
|
+
category: 'utilities',
|
|
863
|
+
},
|
|
864
|
+
};
|
|
865
|
+
`;
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Generates README for an app project
|
|
869
|
+
*/
|
|
870
|
+
export function generateAppReadme(context) {
|
|
871
|
+
const usingImage = context.imageName;
|
|
872
|
+
const imageSection = usingImage
|
|
873
|
+
? `\n## Image
|
|
874
|
+
|
|
875
|
+
This app uses the \`${context.imageName}\` image, which provides a complete agent harness with:
|
|
876
|
+
- Pre-configured providers
|
|
877
|
+
- Runtime orchestration
|
|
878
|
+
- Context management
|
|
879
|
+
|
|
880
|
+
The harness is automatically initialized when you import the image.\n`
|
|
881
|
+
: '';
|
|
882
|
+
return `# ${context.projectName}
|
|
883
|
+
|
|
884
|
+
${context.description}${imageSection}
|
|
885
|
+
|
|
886
|
+
## Quick Start
|
|
887
|
+
|
|
888
|
+
\`\`\`bash
|
|
889
|
+
# Install dependencies
|
|
890
|
+
pnpm install
|
|
891
|
+
|
|
892
|
+
# Set up environment
|
|
893
|
+
cp .env.example .env
|
|
894
|
+
# Edit .env with your API keys
|
|
895
|
+
|
|
896
|
+
# Run
|
|
897
|
+
pnpm start
|
|
898
|
+
\`\`\`
|
|
899
|
+
|
|
900
|
+
## Project Structure
|
|
901
|
+
|
|
902
|
+
\`\`\`
|
|
903
|
+
${context.projectName}/
|
|
904
|
+
├── src/
|
|
905
|
+
│ └── index.ts # Entry point
|
|
906
|
+
├── agents/
|
|
907
|
+
│ └── default.yml # Agent configuration
|
|
908
|
+
├── .env # Environment variables (gitignored)
|
|
909
|
+
├── package.json
|
|
910
|
+
└── tsconfig.json
|
|
911
|
+
\`\`\`
|
|
912
|
+
|
|
913
|
+
## Configuration
|
|
914
|
+
|
|
915
|
+
Edit \`agents/default.yml\` to configure:
|
|
916
|
+
- System prompts
|
|
917
|
+
- LLM provider and model
|
|
918
|
+
- MCP servers
|
|
919
|
+
- Internal tools
|
|
920
|
+
- Custom tools
|
|
921
|
+
|
|
922
|
+
## Learn More
|
|
923
|
+
|
|
924
|
+
- [Dexto Documentation](https://docs.dexto.ai)
|
|
925
|
+
- [Agent Configuration Guide](https://docs.dexto.ai/docs/guides/configuration)
|
|
926
|
+
- [Using Images](https://docs.dexto.ai/docs/guides/images)
|
|
927
|
+
`;
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* Generates auto-discovery script for from-core mode
|
|
931
|
+
*/
|
|
932
|
+
export function generateDiscoveryScript() {
|
|
933
|
+
return `#!/usr/bin/env tsx
|
|
934
|
+
/**
|
|
935
|
+
* Provider Auto-Discovery Script
|
|
936
|
+
*
|
|
937
|
+
* Scans conventional folders (tools/, blob-store/, compression/, plugins/)
|
|
938
|
+
* and generates src/providers.ts with import + registration statements.
|
|
939
|
+
*/
|
|
940
|
+
|
|
941
|
+
import * as fs from 'fs/promises';
|
|
942
|
+
import * as path from 'path';
|
|
943
|
+
import { fileURLToPath } from 'url';
|
|
944
|
+
|
|
945
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
946
|
+
const __dirname = path.dirname(__filename);
|
|
947
|
+
const projectRoot = path.resolve(__dirname, '..');
|
|
948
|
+
|
|
949
|
+
interface ProviderInfo {
|
|
950
|
+
category: 'customTools' | 'blobStore' | 'compression' | 'plugins';
|
|
951
|
+
folderName: string;
|
|
952
|
+
path: string;
|
|
953
|
+
registryName: string;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
const PROVIDER_CATEGORIES = [
|
|
957
|
+
{ folder: 'tools', category: 'customTools' as const, registry: 'customToolRegistry' },
|
|
958
|
+
{ folder: 'blob-store', category: 'blobStore' as const, registry: 'blobStoreRegistry' },
|
|
959
|
+
{ folder: 'compaction', category: 'compaction' as const, registry: 'compactionRegistry' },
|
|
960
|
+
{ folder: 'plugins', category: 'plugins' as const, registry: 'pluginRegistry' },
|
|
961
|
+
];
|
|
962
|
+
|
|
963
|
+
async function discoverProviders(): Promise<ProviderInfo[]> {
|
|
964
|
+
const providers: ProviderInfo[] = [];
|
|
965
|
+
|
|
966
|
+
for (const { folder, category, registry } of PROVIDER_CATEGORIES) {
|
|
967
|
+
const folderPath = path.join(projectRoot, folder);
|
|
968
|
+
|
|
969
|
+
try {
|
|
970
|
+
const entries = await fs.readdir(folderPath, { withFileTypes: true });
|
|
971
|
+
|
|
972
|
+
for (const entry of entries) {
|
|
973
|
+
if (!entry.isDirectory()) continue;
|
|
974
|
+
if (entry.name.startsWith('.')) continue;
|
|
975
|
+
|
|
976
|
+
// Check if provider has index.ts
|
|
977
|
+
const indexPath = path.join(folderPath, entry.name, 'index.ts');
|
|
978
|
+
try {
|
|
979
|
+
await fs.access(indexPath);
|
|
980
|
+
providers.push({
|
|
981
|
+
category,
|
|
982
|
+
folderName: entry.name,
|
|
983
|
+
path: \`../\${folder}/\${entry.name}/index.js\`,
|
|
984
|
+
registryName: registry,
|
|
985
|
+
});
|
|
986
|
+
} catch {
|
|
987
|
+
// No index.ts found, skip
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
} catch {
|
|
991
|
+
// Folder doesn't exist or can't be read, skip
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
return providers;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
function generateProvidersFile(providers: ProviderInfo[]): string {
|
|
999
|
+
// Helper to convert kebab-case to camelCase for valid JS identifiers
|
|
1000
|
+
const toCamelCase = (str: string): string => {
|
|
1001
|
+
return str.replace(/-([a-z])/g, (_, char) => char.toUpperCase());
|
|
1002
|
+
};
|
|
1003
|
+
|
|
1004
|
+
const imports: string[] = [];
|
|
1005
|
+
const registrations: string[] = [];
|
|
1006
|
+
const registries = new Set<string>();
|
|
1007
|
+
|
|
1008
|
+
providers.forEach((provider, index) => {
|
|
1009
|
+
const varName = \`provider\${index}\`;
|
|
1010
|
+
const providerName = \`\${toCamelCase(provider.folderName)}Provider\`;
|
|
1011
|
+
imports.push(\`import { \${providerName} as \${varName} } from '\${provider.path}';\`);
|
|
1012
|
+
registrations.push(\` \${provider.registryName}.register(\${varName});\`);
|
|
1013
|
+
registries.add(provider.registryName);
|
|
1014
|
+
});
|
|
1015
|
+
|
|
1016
|
+
const registryImports = Array.from(registries).join(', ');
|
|
1017
|
+
|
|
1018
|
+
return \`// AUTO-GENERATED - DO NOT EDIT
|
|
1019
|
+
// This file is generated by scripts/discover-providers.ts
|
|
1020
|
+
// Run 'pnpm run discover' to regenerate
|
|
1021
|
+
|
|
1022
|
+
import { \${registryImports} } from '@dexto/core';
|
|
1023
|
+
\${imports.join('\\n')}
|
|
1024
|
+
|
|
1025
|
+
/**
|
|
1026
|
+
* Register all discovered providers
|
|
1027
|
+
* Called automatically when this module is imported
|
|
1028
|
+
*/
|
|
1029
|
+
export function registerProviders(): void {
|
|
1030
|
+
\${registrations.join('\\n')}
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
// Auto-register on import
|
|
1034
|
+
registerProviders();
|
|
1035
|
+
|
|
1036
|
+
console.log('✓ Registered \${providers.length} provider(s)');
|
|
1037
|
+
\`;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
function generateEntryPoint(): string {
|
|
1041
|
+
return \`// AUTO-GENERATED - DO NOT EDIT
|
|
1042
|
+
// This file is the build entry point that wires everything together
|
|
1043
|
+
// Run 'pnpm run discover' to regenerate
|
|
1044
|
+
|
|
1045
|
+
// Register providers first
|
|
1046
|
+
import './_providers.js';
|
|
1047
|
+
|
|
1048
|
+
// Then run the user's app
|
|
1049
|
+
import './index.js';
|
|
1050
|
+
\`;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
async function main() {
|
|
1054
|
+
console.log('🔍 Discovering providers...\\n');
|
|
1055
|
+
|
|
1056
|
+
const providers = await discoverProviders();
|
|
1057
|
+
|
|
1058
|
+
if (providers.length === 0) {
|
|
1059
|
+
console.log('⚠️ No providers found');
|
|
1060
|
+
console.log(' Add providers to: tools/, blob-store/, compression/, or plugins/\\n');
|
|
1061
|
+
} else {
|
|
1062
|
+
console.log(\`✅ Found \${providers.length} provider(s):\`);
|
|
1063
|
+
providers.forEach(p => {
|
|
1064
|
+
console.log(\` • \${p.category}/\${p.folderName}\`);
|
|
1065
|
+
});
|
|
1066
|
+
console.log();
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
// Generate provider registrations
|
|
1070
|
+
const providersPath = path.join(projectRoot, 'src', '_providers.ts');
|
|
1071
|
+
const providersContent = generateProvidersFile(providers);
|
|
1072
|
+
await fs.writeFile(providersPath, providersContent, 'utf-8');
|
|
1073
|
+
console.log(\`📝 Generated: src/_providers.ts\`);
|
|
1074
|
+
|
|
1075
|
+
// Generate build entry point
|
|
1076
|
+
const entryPath = path.join(projectRoot, 'src', '_entry.ts');
|
|
1077
|
+
const entryContent = generateEntryPoint();
|
|
1078
|
+
await fs.writeFile(entryPath, entryContent, 'utf-8');
|
|
1079
|
+
console.log(\`📝 Generated: src/_entry.ts\`);
|
|
1080
|
+
|
|
1081
|
+
console.log();
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
main().catch(error => {
|
|
1085
|
+
console.error('❌ Discovery failed:', error);
|
|
1086
|
+
process.exit(1);
|
|
1087
|
+
});
|
|
1088
|
+
`;
|
|
1089
|
+
}
|