@nanocollective/nanocoder 1.22.5 → 1.24.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/LICENSE.md +1 -15
- package/README.md +25 -821
- package/assets/nanocoder-vscode.vsix +0 -0
- package/dist/ai-sdk-client/ai-sdk-client.d.ts +3 -2
- package/dist/ai-sdk-client/ai-sdk-client.d.ts.map +1 -1
- package/dist/ai-sdk-client/ai-sdk-client.js +16 -2
- package/dist/ai-sdk-client/ai-sdk-client.js.map +1 -1
- package/dist/ai-sdk-client/chat/chat-handler.d.ts +2 -1
- package/dist/ai-sdk-client/chat/chat-handler.d.ts.map +1 -1
- package/dist/ai-sdk-client/chat/chat-handler.js +37 -70
- package/dist/ai-sdk-client/chat/chat-handler.js.map +1 -1
- package/dist/ai-sdk-client/chat/streaming-handler.d.ts +2 -2
- package/dist/ai-sdk-client/chat/streaming-handler.d.ts.map +1 -1
- package/dist/ai-sdk-client/chat/streaming-handler.js +4 -23
- package/dist/ai-sdk-client/chat/streaming-handler.js.map +1 -1
- package/dist/ai-sdk-client/error-handling/error-parser.d.ts.map +1 -1
- package/dist/ai-sdk-client/error-handling/error-parser.js +11 -3
- package/dist/ai-sdk-client/error-handling/error-parser.js.map +1 -1
- package/dist/ai-sdk-client/providers/provider-factory.d.ts +2 -1
- package/dist/ai-sdk-client/providers/provider-factory.d.ts.map +1 -1
- package/dist/ai-sdk-client/providers/provider-factory.js +55 -0
- package/dist/ai-sdk-client/providers/provider-factory.js.map +1 -1
- package/dist/app/App.d.ts +1 -1
- package/dist/app/App.d.ts.map +1 -1
- package/dist/app/App.js +148 -37
- package/dist/app/App.js.map +1 -1
- package/dist/app/components/chat-input.d.ts +9 -1
- package/dist/app/components/chat-input.d.ts.map +1 -1
- package/dist/app/components/chat-input.js +11 -8
- package/dist/app/components/chat-input.js.map +1 -1
- package/dist/app/components/modal-selectors.d.ts +6 -7
- package/dist/app/components/modal-selectors.d.ts.map +1 -1
- package/dist/app/components/modal-selectors.js +11 -7
- package/dist/app/components/modal-selectors.js.map +1 -1
- package/dist/app/components/settings-selector.d.ts.map +1 -1
- package/dist/app/components/settings-selector.js +3 -3
- package/dist/app/components/settings-selector.js.map +1 -1
- package/dist/app/helpers.d.ts.map +1 -1
- package/dist/app/helpers.js +2 -4
- package/dist/app/helpers.js.map +1 -1
- package/dist/app/index.d.ts +0 -1
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +0 -1
- package/dist/app/index.js.map +1 -1
- package/dist/app/types.d.ts +2 -0
- package/dist/app/types.d.ts.map +1 -1
- package/dist/app/utils/app-util.d.ts +1 -0
- package/dist/app/utils/app-util.d.ts.map +1 -1
- package/dist/app/utils/app-util.js +69 -204
- package/dist/app/utils/app-util.js.map +1 -1
- package/dist/app/utils/handlers/compact-handler.d.ts +6 -0
- package/dist/app/utils/handlers/compact-handler.d.ts.map +1 -0
- package/dist/app/utils/handlers/compact-handler.js +148 -0
- package/dist/app/utils/handlers/compact-handler.js.map +1 -0
- package/dist/app/utils/handlers/context-max-handler.d.ts +11 -0
- package/dist/app/utils/handlers/context-max-handler.d.ts.map +1 -0
- package/dist/app/utils/handlers/context-max-handler.js +102 -0
- package/dist/app/utils/handlers/context-max-handler.js.map +1 -0
- package/dist/app/utils/handlers/create-handler.d.ts +17 -0
- package/dist/app/utils/handlers/create-handler.d.ts.map +1 -0
- package/dist/app/utils/handlers/create-handler.js +112 -0
- package/dist/app/utils/handlers/create-handler.js.map +1 -0
- package/dist/app/utils/handlers/session-handler.d.ts +8 -0
- package/dist/app/utils/handlers/session-handler.d.ts.map +1 -0
- package/dist/app/utils/handlers/session-handler.js +99 -0
- package/dist/app/utils/handlers/session-handler.js.map +1 -0
- package/dist/auth/github-copilot.d.ts +44 -0
- package/dist/auth/github-copilot.d.ts.map +1 -0
- package/dist/auth/github-copilot.js +178 -0
- package/dist/auth/github-copilot.js.map +1 -0
- package/dist/cli.js +64 -3
- package/dist/cli.js.map +1 -1
- package/dist/client-factory.d.ts +1 -1
- package/dist/client-factory.d.ts.map +1 -1
- package/dist/client-factory.js +42 -10
- package/dist/client-factory.js.map +1 -1
- package/dist/commands/compact.d.ts +1 -6
- package/dist/commands/compact.d.ts.map +1 -1
- package/dist/commands/compact.js +2 -13
- package/dist/commands/compact.js.map +1 -1
- package/dist/commands/context-max.d.ts +14 -0
- package/dist/commands/context-max.d.ts.map +1 -0
- package/dist/commands/context-max.js +15 -0
- package/dist/commands/context-max.js.map +1 -0
- package/dist/commands/copilot-login-command.d.ts +3 -0
- package/dist/commands/copilot-login-command.d.ts.map +1 -0
- package/dist/commands/copilot-login-command.js +9 -0
- package/dist/commands/copilot-login-command.js.map +1 -0
- package/dist/commands/copilot-login.d.ts +9 -0
- package/dist/commands/copilot-login.d.ts.map +1 -0
- package/dist/commands/copilot-login.js +70 -0
- package/dist/commands/copilot-login.js.map +1 -0
- package/dist/commands/create-stub-command.d.ts +8 -0
- package/dist/commands/create-stub-command.d.ts.map +1 -0
- package/dist/commands/create-stub-command.js +14 -0
- package/dist/commands/create-stub-command.js.map +1 -0
- package/dist/commands/custom-commands.d.ts.map +1 -1
- package/dist/commands/custom-commands.js +88 -4
- package/dist/commands/custom-commands.js.map +1 -1
- package/dist/commands/exit.d.ts.map +1 -1
- package/dist/commands/exit.js +5 -8
- package/dist/commands/exit.js.map +1 -1
- package/dist/commands/explorer.d.ts +1 -2
- package/dist/commands/explorer.d.ts.map +1 -1
- package/dist/commands/explorer.js +2 -9
- package/dist/commands/explorer.js.map +1 -1
- package/dist/commands/help.d.ts.map +1 -1
- package/dist/commands/help.js +1 -1
- package/dist/commands/help.js.map +1 -1
- package/dist/commands/ide.d.ts +2 -0
- package/dist/commands/ide.d.ts.map +1 -0
- package/dist/commands/ide.js +3 -0
- package/dist/commands/ide.js.map +1 -0
- package/dist/commands/index.d.ts +5 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +5 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +2 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/model.d.ts +1 -2
- package/dist/commands/model.d.ts.map +1 -1
- package/dist/commands/model.js +2 -10
- package/dist/commands/model.js.map +1 -1
- package/dist/commands/provider.d.ts +1 -2
- package/dist/commands/provider.d.ts.map +1 -1
- package/dist/commands/provider.js +2 -10
- package/dist/commands/provider.js.map +1 -1
- package/dist/commands/resume.d.ts +8 -0
- package/dist/commands/resume.d.ts.map +1 -0
- package/dist/commands/resume.js +11 -0
- package/dist/commands/resume.js.map +1 -0
- package/dist/commands/schedule.d.ts +3 -0
- package/dist/commands/schedule.d.ts.map +1 -0
- package/dist/commands/schedule.js +177 -0
- package/dist/commands/schedule.js.map +1 -0
- package/dist/commands/settings.d.ts +1 -2
- package/dist/commands/settings.d.ts.map +1 -1
- package/dist/commands/settings.js +2 -10
- package/dist/commands/settings.js.map +1 -1
- package/dist/commands/status.d.ts +1 -2
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +2 -10
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/usage.d.ts.map +1 -1
- package/dist/commands/usage.js +4 -3
- package/dist/commands/usage.js.map +1 -1
- package/dist/components/assistant-message.d.ts.map +1 -1
- package/dist/components/assistant-message.js +2 -27
- package/dist/components/assistant-message.js.map +1 -1
- package/dist/components/development-mode-indicator.d.ts +3 -2
- package/dist/components/development-mode-indicator.d.ts.map +1 -1
- package/dist/components/development-mode-indicator.js +23 -9
- package/dist/components/development-mode-indicator.js.map +1 -1
- package/dist/components/ide-selector.d.ts +7 -0
- package/dist/components/ide-selector.d.ts.map +1 -0
- package/dist/components/ide-selector.js +17 -0
- package/dist/components/ide-selector.js.map +1 -0
- package/dist/components/provider-selector.d.ts.map +1 -1
- package/dist/components/provider-selector.js +4 -3
- package/dist/components/provider-selector.js.map +1 -1
- package/dist/components/question-prompt.d.ts +8 -0
- package/dist/components/question-prompt.d.ts.map +1 -0
- package/dist/components/question-prompt.js +58 -0
- package/dist/components/question-prompt.js.map +1 -0
- package/dist/components/scheduler-view.d.ts +14 -0
- package/dist/components/scheduler-view.d.ts.map +1 -0
- package/dist/components/scheduler-view.js +17 -0
- package/dist/components/scheduler-view.js.map +1 -0
- package/dist/components/session-selector.d.ts +12 -0
- package/dist/components/session-selector.d.ts.map +1 -0
- package/dist/components/session-selector.js +108 -0
- package/dist/components/session-selector.js.map +1 -0
- package/dist/components/text-input.d.ts +13 -0
- package/dist/components/text-input.d.ts.map +1 -0
- package/dist/components/text-input.js +175 -0
- package/dist/components/text-input.js.map +1 -0
- package/dist/components/tool-confirmation.d.ts.map +1 -1
- package/dist/components/tool-confirmation.js +9 -6
- package/dist/components/tool-confirmation.js.map +1 -1
- package/dist/components/ui/styled-title.js +2 -2
- package/dist/components/ui/styled-title.js.map +1 -1
- package/dist/components/user-input.d.ts +4 -1
- package/dist/components/user-input.d.ts.map +1 -1
- package/dist/components/user-input.js +29 -24
- package/dist/components/user-input.js.map +1 -1
- package/dist/components/user-message.d.ts.map +1 -1
- package/dist/components/user-message.js +1 -23
- package/dist/components/user-message.js.map +1 -1
- package/dist/components/vscode-extension-prompt.d.ts +6 -1
- package/dist/components/vscode-extension-prompt.d.ts.map +1 -1
- package/dist/components/vscode-extension-prompt.js +80 -36
- package/dist/components/vscode-extension-prompt.js.map +1 -1
- package/dist/config/copilot-credentials.d.ts +27 -0
- package/dist/config/copilot-credentials.d.ts.map +1 -0
- package/dist/config/copilot-credentials.js +81 -0
- package/dist/config/copilot-credentials.js.map +1 -0
- package/dist/config/index.d.ts +0 -2
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +63 -27
- package/dist/config/index.js.map +1 -1
- package/dist/config/mcp-config-loader.d.ts +2 -3
- package/dist/config/mcp-config-loader.d.ts.map +1 -1
- package/dist/config/mcp-config-loader.js +136 -181
- package/dist/config/mcp-config-loader.js.map +1 -1
- package/dist/config/nanocoder-tools-config.js +2 -2
- package/dist/config/nanocoder-tools-config.js.map +1 -1
- package/dist/config/themes.d.ts.map +1 -1
- package/dist/config/themes.js +9 -746
- package/dist/config/themes.js.map +1 -1
- package/dist/config/validation.d.ts.map +1 -1
- package/dist/config/validation.js +0 -19
- package/dist/config/validation.js.map +1 -1
- package/dist/custom-commands/command-integration.d.ts +24 -0
- package/dist/custom-commands/command-integration.d.ts.map +1 -0
- package/dist/custom-commands/command-integration.js +68 -0
- package/dist/custom-commands/command-integration.js.map +1 -0
- package/dist/custom-commands/executor.d.ts.map +1 -1
- package/dist/custom-commands/executor.js +12 -2
- package/dist/custom-commands/executor.js.map +1 -1
- package/dist/custom-commands/loader.d.ts +33 -5
- package/dist/custom-commands/loader.d.ts.map +1 -1
- package/dist/custom-commands/loader.js +191 -18
- package/dist/custom-commands/loader.js.map +1 -1
- package/dist/custom-commands/parser.d.ts.map +1 -1
- package/dist/custom-commands/parser.js +106 -48
- package/dist/custom-commands/parser.js.map +1 -1
- package/dist/hooks/chat-handler/conversation/conversation-loop.d.ts +6 -1
- package/dist/hooks/chat-handler/conversation/conversation-loop.d.ts.map +1 -1
- package/dist/hooks/chat-handler/conversation/conversation-loop.js +89 -76
- package/dist/hooks/chat-handler/conversation/conversation-loop.js.map +1 -1
- package/dist/hooks/chat-handler/conversation/tool-executor.d.ts +7 -2
- package/dist/hooks/chat-handler/conversation/tool-executor.d.ts.map +1 -1
- package/dist/hooks/chat-handler/conversation/tool-executor.js +109 -41
- package/dist/hooks/chat-handler/conversation/tool-executor.js.map +1 -1
- package/dist/hooks/chat-handler/types.d.ts +6 -1
- package/dist/hooks/chat-handler/types.d.ts.map +1 -1
- package/dist/hooks/chat-handler/useChatHandler.d.ts +1 -1
- package/dist/hooks/chat-handler/useChatHandler.d.ts.map +1 -1
- package/dist/hooks/chat-handler/useChatHandler.js +19 -5
- package/dist/hooks/chat-handler/useChatHandler.js.map +1 -1
- package/dist/hooks/useAppHandlers.d.ts +10 -1
- package/dist/hooks/useAppHandlers.d.ts.map +1 -1
- package/dist/hooks/useAppHandlers.js +124 -13
- package/dist/hooks/useAppHandlers.js.map +1 -1
- package/dist/hooks/useAppInitialization.d.ts +5 -3
- package/dist/hooks/useAppInitialization.d.ts.map +1 -1
- package/dist/hooks/useAppInitialization.js +54 -30
- package/dist/hooks/useAppInitialization.js.map +1 -1
- package/dist/hooks/useAppState.d.ts +27 -7
- package/dist/hooks/useAppState.d.ts.map +1 -1
- package/dist/hooks/useAppState.js +54 -22
- package/dist/hooks/useAppState.js.map +1 -1
- package/dist/hooks/useContextPercentage.d.ts +17 -0
- package/dist/hooks/useContextPercentage.d.ts.map +1 -0
- package/dist/hooks/useContextPercentage.js +71 -0
- package/dist/hooks/useContextPercentage.js.map +1 -0
- package/dist/hooks/useModeHandlers.d.ts +9 -12
- package/dist/hooks/useModeHandlers.d.ts.map +1 -1
- package/dist/hooks/useModeHandlers.js +31 -91
- package/dist/hooks/useModeHandlers.js.map +1 -1
- package/dist/hooks/useNonInteractiveMode.d.ts +7 -0
- package/dist/hooks/useNonInteractiveMode.d.ts.map +1 -1
- package/dist/hooks/useNonInteractiveMode.js +42 -3
- package/dist/hooks/useNonInteractiveMode.js.map +1 -1
- package/dist/hooks/useSchedulerMode.d.ts +30 -0
- package/dist/hooks/useSchedulerMode.d.ts.map +1 -0
- package/dist/hooks/useSchedulerMode.js +99 -0
- package/dist/hooks/useSchedulerMode.js.map +1 -0
- package/dist/hooks/useSessionAutosave.d.ts +16 -0
- package/dist/hooks/useSessionAutosave.d.ts.map +1 -0
- package/dist/hooks/useSessionAutosave.js +133 -0
- package/dist/hooks/useSessionAutosave.js.map +1 -0
- package/dist/hooks/useToolHandler.d.ts +2 -1
- package/dist/hooks/useToolHandler.d.ts.map +1 -1
- package/dist/hooks/useToolHandler.js +9 -3
- package/dist/hooks/useToolHandler.js.map +1 -1
- package/dist/lsp/lsp-manager.d.ts.map +1 -1
- package/dist/lsp/lsp-manager.js +10 -0
- package/dist/lsp/lsp-manager.js.map +1 -1
- package/dist/mcp/mcp-client.d.ts.map +1 -1
- package/dist/mcp/mcp-client.js +23 -3
- package/dist/mcp/mcp-client.js.map +1 -1
- package/dist/mcp/transport-factory.d.ts.map +1 -1
- package/dist/mcp/transport-factory.js +4 -36
- package/dist/mcp/transport-factory.js.map +1 -1
- package/dist/models/index.d.ts +1 -1
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +1 -1
- package/dist/models/index.js.map +1 -1
- package/dist/models/models-dev-client.d.ts +8 -1
- package/dist/models/models-dev-client.d.ts.map +1 -1
- package/dist/models/models-dev-client.js +71 -15
- package/dist/models/models-dev-client.js.map +1 -1
- package/dist/schedule/cron.d.ts +14 -0
- package/dist/schedule/cron.d.ts.map +1 -0
- package/dist/schedule/cron.js +107 -0
- package/dist/schedule/cron.js.map +1 -0
- package/dist/schedule/index.d.ts +4 -0
- package/dist/schedule/index.d.ts.map +1 -0
- package/dist/schedule/index.js +4 -0
- package/dist/schedule/index.js.map +1 -0
- package/dist/schedule/runner.d.ts +42 -0
- package/dist/schedule/runner.d.ts.map +1 -0
- package/dist/schedule/runner.js +136 -0
- package/dist/schedule/runner.js.map +1 -0
- package/dist/schedule/storage.d.ts +9 -0
- package/dist/schedule/storage.d.ts.map +1 -0
- package/dist/schedule/storage.js +68 -0
- package/dist/schedule/storage.js.map +1 -0
- package/dist/schedule/types.d.ts +24 -0
- package/dist/schedule/types.d.ts.map +1 -0
- package/dist/schedule/types.js +2 -0
- package/dist/schedule/types.js.map +1 -0
- package/dist/services/bash-executor.d.ts.map +1 -1
- package/dist/services/bash-executor.js +5 -0
- package/dist/services/bash-executor.js.map +1 -1
- package/dist/session/session-manager.d.ts +57 -0
- package/dist/session/session-manager.d.ts.map +1 -0
- package/dist/session/session-manager.js +361 -0
- package/dist/session/session-manager.js.map +1 -0
- package/dist/test-utils/render-with-theme.d.ts.map +1 -1
- package/dist/test-utils/render-with-theme.js +2 -1
- package/dist/test-utils/render-with-theme.js.map +1 -1
- package/dist/tool-calling/tool-parser.d.ts +4 -3
- package/dist/tool-calling/tool-parser.d.ts.map +1 -1
- package/dist/tool-calling/tool-parser.js +17 -34
- package/dist/tool-calling/tool-parser.js.map +1 -1
- package/dist/tool-calling/xml-parser.d.ts +8 -4
- package/dist/tool-calling/xml-parser.d.ts.map +1 -1
- package/dist/tool-calling/xml-parser.js +15 -5
- package/dist/tool-calling/xml-parser.js.map +1 -1
- package/dist/tools/ask-question.d.ts +3 -0
- package/dist/tools/ask-question.d.ts.map +1 -0
- package/dist/tools/ask-question.js +66 -0
- package/dist/tools/ask-question.js.map +1 -0
- package/dist/tools/execute-bash.d.ts.map +1 -1
- package/dist/tools/execute-bash.js +6 -1
- package/dist/tools/execute-bash.js.map +1 -1
- package/dist/tools/fetch-url.d.ts.map +1 -1
- package/dist/tools/fetch-url.js +11 -2
- package/dist/tools/fetch-url.js.map +1 -1
- package/dist/tools/file-ops/copy-file.d.ts +3 -0
- package/dist/tools/file-ops/copy-file.d.ts.map +1 -0
- package/dist/tools/file-ops/copy-file.js +96 -0
- package/dist/tools/file-ops/copy-file.js.map +1 -0
- package/dist/tools/file-ops/create-directory.d.ts +3 -0
- package/dist/tools/file-ops/create-directory.d.ts.map +1 -0
- package/dist/tools/file-ops/create-directory.js +59 -0
- package/dist/tools/file-ops/create-directory.js.map +1 -0
- package/dist/tools/file-ops/delete-file.d.ts +3 -0
- package/dist/tools/file-ops/delete-file.d.ts.map +1 -0
- package/dist/tools/file-ops/delete-file.js +74 -0
- package/dist/tools/file-ops/delete-file.js.map +1 -0
- package/dist/tools/file-ops/index.d.ts +3 -0
- package/dist/tools/file-ops/index.d.ts.map +1 -0
- package/dist/tools/file-ops/index.js +8 -0
- package/dist/tools/file-ops/index.js.map +1 -0
- package/dist/tools/file-ops/move-file.d.ts +3 -0
- package/dist/tools/file-ops/move-file.d.ts.map +1 -0
- package/dist/tools/file-ops/move-file.js +96 -0
- package/dist/tools/file-ops/move-file.js.map +1 -0
- package/dist/tools/file-ops/string-replace-preview.d.ts +10 -0
- package/dist/tools/file-ops/string-replace-preview.d.ts.map +1 -0
- package/dist/tools/file-ops/string-replace-preview.js +171 -0
- package/dist/tools/file-ops/string-replace-preview.js.map +1 -0
- package/dist/tools/file-ops/string-replace.d.ts +3 -0
- package/dist/tools/file-ops/string-replace.d.ts.map +1 -0
- package/dist/tools/file-ops/string-replace.js +178 -0
- package/dist/tools/file-ops/string-replace.js.map +1 -0
- package/dist/tools/file-ops/write-file.d.ts +3 -0
- package/dist/tools/file-ops/write-file.d.ts.map +1 -0
- package/dist/tools/{write-file.js → file-ops/write-file.js} +34 -79
- package/dist/tools/file-ops/write-file.js.map +1 -0
- package/dist/tools/find-files.d.ts.map +1 -1
- package/dist/tools/find-files.js +1 -0
- package/dist/tools/find-files.js.map +1 -1
- package/dist/tools/git/git-diff.d.ts.map +1 -1
- package/dist/tools/git/git-diff.js +1 -0
- package/dist/tools/git/git-diff.js.map +1 -1
- package/dist/tools/git/git-log.d.ts.map +1 -1
- package/dist/tools/git/git-log.js +1 -0
- package/dist/tools/git/git-log.js.map +1 -1
- package/dist/tools/git/git-reset.js +1 -1
- package/dist/tools/git/git-reset.js.map +1 -1
- package/dist/tools/git/git-status.d.ts.map +1 -1
- package/dist/tools/git/git-status.js +1 -0
- package/dist/tools/git/git-status.js.map +1 -1
- package/dist/tools/git/index.js +3 -3
- package/dist/tools/git/index.js.map +1 -1
- package/dist/tools/git/utils.d.ts +4 -0
- package/dist/tools/git/utils.d.ts.map +1 -1
- package/dist/tools/git/utils.js +12 -0
- package/dist/tools/git/utils.js.map +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +15 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/list-directory.d.ts.map +1 -1
- package/dist/tools/list-directory.js +2 -1
- package/dist/tools/list-directory.js.map +1 -1
- package/dist/tools/lsp-get-diagnostics.d.ts.map +1 -1
- package/dist/tools/lsp-get-diagnostics.js +1 -5
- package/dist/tools/lsp-get-diagnostics.js.map +1 -1
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +1 -0
- package/dist/tools/read-file.js.map +1 -1
- package/dist/tools/search-file-contents.d.ts.map +1 -1
- package/dist/tools/search-file-contents.js +60 -10
- package/dist/tools/search-file-contents.js.map +1 -1
- package/dist/tools/tasks/list-tasks.d.ts.map +1 -1
- package/dist/tools/tasks/list-tasks.js +1 -0
- package/dist/tools/tasks/list-tasks.js.map +1 -1
- package/dist/tools/tool-manager.d.ts +10 -0
- package/dist/tools/tool-manager.d.ts.map +1 -1
- package/dist/tools/tool-manager.js +25 -2
- package/dist/tools/tool-manager.js.map +1 -1
- package/dist/tools/tool-registry.d.ts +9 -1
- package/dist/tools/tool-registry.d.ts.map +1 -1
- package/dist/tools/tool-registry.js +17 -1
- package/dist/tools/tool-registry.js.map +1 -1
- package/dist/tools/web-search.d.ts.map +1 -1
- package/dist/tools/web-search.js +1 -0
- package/dist/tools/web-search.js.map +1 -1
- package/dist/types/app.d.ts +5 -0
- package/dist/types/app.d.ts.map +1 -1
- package/dist/types/commands.d.ts +20 -1
- package/dist/types/commands.d.ts.map +1 -1
- package/dist/types/config.d.ts +11 -15
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/core.d.ts +15 -4
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/core.js +7 -0
- package/dist/types/core.js.map +1 -1
- package/dist/types/markdown-parser.d.ts +2 -10
- package/dist/types/markdown-parser.d.ts.map +1 -1
- package/dist/types/mcp.d.ts +2 -28
- package/dist/types/mcp.d.ts.map +1 -1
- package/dist/types/ui.d.ts +1 -1
- package/dist/types/ui.d.ts.map +1 -1
- package/dist/utils/ansi-truncate.d.ts +6 -0
- package/dist/utils/ansi-truncate.d.ts.map +1 -0
- package/dist/utils/ansi-truncate.js +39 -0
- package/dist/utils/ansi-truncate.js.map +1 -0
- package/dist/utils/auto-compact.d.ts.map +1 -1
- package/dist/utils/auto-compact.js +13 -7
- package/dist/utils/auto-compact.js.map +1 -1
- package/dist/utils/installation-detector.d.ts +6 -0
- package/dist/utils/installation-detector.d.ts.map +1 -1
- package/dist/utils/installation-detector.js +33 -19
- package/dist/utils/installation-detector.js.map +1 -1
- package/dist/utils/logging/health-monitor/checks/memory-check.d.ts.map +1 -1
- package/dist/utils/logging/health-monitor/checks/memory-check.js +2 -1
- package/dist/utils/logging/health-monitor/checks/memory-check.js.map +1 -1
- package/dist/utils/logging/health-monitor/core/health-monitor.d.ts.map +1 -1
- package/dist/utils/logging/health-monitor/core/health-monitor.js +3 -2
- package/dist/utils/logging/health-monitor/core/health-monitor.js.map +1 -1
- package/dist/utils/logging/index.d.ts.map +1 -1
- package/dist/utils/logging/index.js +18 -30
- package/dist/utils/logging/index.js.map +1 -1
- package/dist/utils/logging/performance.d.ts.map +1 -1
- package/dist/utils/logging/performance.js +21 -17
- package/dist/utils/logging/performance.js.map +1 -1
- package/dist/utils/logging/pino-logger.d.ts.map +1 -1
- package/dist/utils/logging/pino-logger.js +7 -8
- package/dist/utils/logging/pino-logger.js.map +1 -1
- package/dist/utils/logging/redaction.d.ts.map +1 -1
- package/dist/utils/logging/redaction.js +2 -0
- package/dist/utils/logging/redaction.js.map +1 -1
- package/dist/utils/logging/request-tracker.d.ts.map +1 -1
- package/dist/utils/logging/request-tracker.js +6 -5
- package/dist/utils/logging/request-tracker.js.map +1 -1
- package/dist/utils/logging/safe-process.d.ts +16 -0
- package/dist/utils/logging/safe-process.d.ts.map +1 -0
- package/dist/utils/logging/safe-process.js +37 -0
- package/dist/utils/logging/safe-process.js.map +1 -0
- package/dist/utils/logging/types.d.ts +0 -3
- package/dist/utils/logging/types.d.ts.map +1 -1
- package/dist/utils/message-builder.d.ts +0 -5
- package/dist/utils/message-builder.d.ts.map +1 -1
- package/dist/utils/message-builder.js +0 -8
- package/dist/utils/message-builder.js.map +1 -1
- package/dist/utils/path-validation.d.ts.map +1 -1
- package/dist/utils/path-validation.js +3 -1
- package/dist/utils/path-validation.js.map +1 -1
- package/dist/utils/path-validators.d.ts +16 -0
- package/dist/utils/path-validators.d.ts.map +1 -0
- package/dist/utils/path-validators.js +55 -0
- package/dist/utils/path-validators.js.map +1 -0
- package/dist/utils/question-queue.d.ts +15 -0
- package/dist/utils/question-queue.d.ts.map +1 -0
- package/dist/utils/question-queue.js +25 -0
- package/dist/utils/question-queue.js.map +1 -0
- package/dist/utils/response-formatter.d.ts +108 -0
- package/dist/utils/response-formatter.d.ts.map +1 -0
- package/dist/utils/response-formatter.js +372 -0
- package/dist/utils/response-formatter.js.map +1 -0
- package/dist/utils/shutdown/index.d.ts +7 -0
- package/dist/utils/shutdown/index.d.ts.map +1 -0
- package/dist/utils/shutdown/index.js +6 -0
- package/dist/utils/shutdown/index.js.map +1 -0
- package/dist/utils/shutdown/shutdown-manager.d.ts +19 -0
- package/dist/utils/shutdown/shutdown-manager.d.ts.map +1 -0
- package/dist/utils/shutdown/shutdown-manager.js +100 -0
- package/dist/utils/shutdown/shutdown-manager.js.map +1 -0
- package/dist/utils/shutdown/types.d.ts +9 -0
- package/dist/utils/shutdown/types.d.ts.map +1 -0
- package/dist/utils/shutdown/types.js +2 -0
- package/dist/utils/shutdown/types.js.map +1 -0
- package/dist/utils/text-wrapping.d.ts +8 -0
- package/dist/utils/text-wrapping.d.ts.map +1 -0
- package/dist/utils/text-wrapping.js +29 -0
- package/dist/utils/text-wrapping.js.map +1 -0
- package/dist/utils/tool-approval.d.ts +6 -0
- package/dist/utils/tool-approval.d.ts.map +1 -0
- package/dist/utils/tool-approval.js +15 -0
- package/dist/utils/tool-approval.js.map +1 -0
- package/dist/utils/tool-result-display.d.ts +15 -1
- package/dist/utils/tool-result-display.d.ts.map +1 -1
- package/dist/utils/tool-result-display.js +93 -3
- package/dist/utils/tool-result-display.js.map +1 -1
- package/dist/utils/type-helpers.d.ts +140 -0
- package/dist/utils/type-helpers.d.ts.map +1 -0
- package/dist/utils/type-helpers.js +220 -0
- package/dist/utils/type-helpers.js.map +1 -0
- package/dist/utils/url-utils.d.ts +6 -0
- package/dist/utils/url-utils.d.ts.map +1 -0
- package/dist/utils/url-utils.js +22 -0
- package/dist/utils/url-utils.js.map +1 -0
- package/dist/vscode/extension-installer.d.ts +34 -7
- package/dist/vscode/extension-installer.d.ts.map +1 -1
- package/dist/vscode/extension-installer.js +151 -64
- package/dist/vscode/extension-installer.js.map +1 -1
- package/dist/vscode/index.d.ts +1 -1
- package/dist/vscode/index.d.ts.map +1 -1
- package/dist/vscode/index.js +1 -1
- package/dist/vscode/index.js.map +1 -1
- package/dist/vscode/vscode-server.d.ts.map +1 -1
- package/dist/vscode/vscode-server.js +10 -0
- package/dist/vscode/vscode-server.js.map +1 -1
- package/dist/wizards/mcp-wizard.d.ts.map +1 -1
- package/dist/wizards/mcp-wizard.js +2 -1
- package/dist/wizards/mcp-wizard.js.map +1 -1
- package/dist/wizards/provider-wizard.d.ts.map +1 -1
- package/dist/wizards/provider-wizard.js +4 -2
- package/dist/wizards/provider-wizard.js.map +1 -1
- package/dist/wizards/steps/location-step.d.ts.map +1 -1
- package/dist/wizards/steps/location-step.js +2 -1
- package/dist/wizards/steps/location-step.js.map +1 -1
- package/dist/wizards/steps/mcp-step.d.ts.map +1 -1
- package/dist/wizards/steps/mcp-step.js +3 -2
- package/dist/wizards/steps/mcp-step.js.map +1 -1
- package/dist/wizards/steps/provider-step.d.ts.map +1 -1
- package/dist/wizards/steps/provider-step.js +5 -2
- package/dist/wizards/steps/provider-step.js.map +1 -1
- package/dist/wizards/steps/summary-step.d.ts.map +1 -1
- package/dist/wizards/steps/summary-step.js +2 -1
- package/dist/wizards/steps/summary-step.js.map +1 -1
- package/dist/wizards/templates/mcp-templates.d.ts +0 -8
- package/dist/wizards/templates/mcp-templates.d.ts.map +1 -1
- package/dist/wizards/templates/mcp-templates.js +8 -6
- package/dist/wizards/templates/mcp-templates.js.map +1 -1
- package/dist/wizards/templates/provider-templates.d.ts.map +1 -1
- package/dist/wizards/templates/provider-templates.js +59 -0
- package/dist/wizards/templates/provider-templates.js.map +1 -1
- package/dist/wizards/validation.d.ts.map +1 -1
- package/dist/wizards/validation.js +2 -4
- package/dist/wizards/validation.js.map +1 -1
- package/package.json +22 -23
- package/source/app/prompts/main-prompt.md +21 -3
- package/source/config/themes.json +787 -0
- package/dist/ai-sdk-client/chat/tool-processor.d.ts +0 -10
- package/dist/ai-sdk-client/chat/tool-processor.d.ts.map +0 -1
- package/dist/ai-sdk-client/chat/tool-processor.js +0 -53
- package/dist/ai-sdk-client/chat/tool-processor.js.map +0 -1
- package/dist/hooks/chat-handler/utils/context-checker.d.ts +0 -15
- package/dist/hooks/chat-handler/utils/context-checker.d.ts.map +0 -1
- package/dist/hooks/chat-handler/utils/context-checker.js +0 -68
- package/dist/hooks/chat-handler/utils/context-checker.js.map +0 -1
- package/dist/tool-calling/json-parser.d.ts +0 -24
- package/dist/tool-calling/json-parser.d.ts.map +0 -1
- package/dist/tool-calling/json-parser.js +0 -202
- package/dist/tool-calling/json-parser.js.map +0 -1
- package/dist/tools/string-replace.d.ts +0 -3
- package/dist/tools/string-replace.d.ts.map +0 -1
- package/dist/tools/string-replace.js +0 -461
- package/dist/tools/string-replace.js.map +0 -1
- package/dist/tools/write-file.d.ts +0 -3
- package/dist/tools/write-file.d.ts.map +0 -1
- package/dist/tools/write-file.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../source/utils/shutdown/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,sBAAsB;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../source/utils/shutdown/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ink uses wrap-ansi with trim: false, which preserves the space at word
|
|
3
|
+
* boundaries as leading whitespace on continuation lines. This function
|
|
4
|
+
* wraps each original line individually and trims only the artifact spaces
|
|
5
|
+
* from continuation lines, preserving intentional indentation.
|
|
6
|
+
*/
|
|
7
|
+
export declare function wrapWithTrimmedContinuations(text: string, width: number): string;
|
|
8
|
+
//# sourceMappingURL=text-wrapping.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-wrapping.d.ts","sourceRoot":"","sources":["../../source/utils/text-wrapping.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC3C,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACX,MAAM,CAyBR"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import wrapAnsi from 'wrap-ansi';
|
|
2
|
+
/**
|
|
3
|
+
* Ink uses wrap-ansi with trim: false, which preserves the space at word
|
|
4
|
+
* boundaries as leading whitespace on continuation lines. This function
|
|
5
|
+
* wraps each original line individually and trims only the artifact spaces
|
|
6
|
+
* from continuation lines, preserving intentional indentation.
|
|
7
|
+
*/
|
|
8
|
+
export function wrapWithTrimmedContinuations(text, width) {
|
|
9
|
+
if (width <= 0)
|
|
10
|
+
return text;
|
|
11
|
+
const originalLines = text.split('\n');
|
|
12
|
+
const result = [];
|
|
13
|
+
for (const line of originalLines) {
|
|
14
|
+
if (line === '') {
|
|
15
|
+
result.push('');
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
const wrapped = wrapAnsi(line, width, { trim: false, hard: true });
|
|
19
|
+
const subLines = wrapped.split('\n');
|
|
20
|
+
result.push(subLines[0] ?? '');
|
|
21
|
+
for (let i = 1; i < subLines.length; i++) {
|
|
22
|
+
// Trim the leading space that is a word-wrap artifact.
|
|
23
|
+
// Handle ANSI escape codes that may precede the space.
|
|
24
|
+
result.push((subLines[i] ?? '').replace(/^((?:\x1b\[[0-9;]*m)*)\s/, '$1'));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return result.join('\n');
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=text-wrapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-wrapping.js","sourceRoot":"","sources":["../../source/utils/text-wrapping.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,WAAW,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAC3C,IAAY,EACZ,KAAa;IAEb,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5B,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;QAClC,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;YACjB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAChB,SAAS;QACV,CAAC;QACD,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,EAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAC,CAAC,CAAC;QACjE,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAErC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAE/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC1C,uDAAuD;YACvD,uDAAuD;YACvD,MAAM,CAAC,IAAI,CACV,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,0BAA0B,EAAE,IAAI,CAAC,CAC7D,CAAC;QACH,CAAC;IACF,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a needsApproval function for file-mutation tools.
|
|
3
|
+
* Returns false if the tool is always-allowed or the current mode is auto-accept/scheduler.
|
|
4
|
+
*/
|
|
5
|
+
export declare function createFileToolApproval(toolName: string): () => boolean;
|
|
6
|
+
//# sourceMappingURL=tool-approval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-approval.d.ts","sourceRoot":"","sources":["../../source/utils/tool-approval.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,OAAO,CAMtE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { isNanocoderToolAlwaysAllowed } from '../config/nanocoder-tools-config.js';
|
|
2
|
+
import { getCurrentMode } from '../context/mode-context.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a needsApproval function for file-mutation tools.
|
|
5
|
+
* Returns false if the tool is always-allowed or the current mode is auto-accept/scheduler.
|
|
6
|
+
*/
|
|
7
|
+
export function createFileToolApproval(toolName) {
|
|
8
|
+
return () => {
|
|
9
|
+
if (isNanocoderToolAlwaysAllowed(toolName))
|
|
10
|
+
return false;
|
|
11
|
+
const mode = getCurrentMode();
|
|
12
|
+
return mode !== 'auto-accept' && mode !== 'scheduler';
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=tool-approval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-approval.js","sourceRoot":"","sources":["../../source/utils/tool-approval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,4BAA4B,EAAC,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAEtD;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,QAAgB;IACtD,OAAO,GAAG,EAAE;QACX,IAAI,4BAA4B,CAAC,QAAQ,CAAC;YAAE,OAAO,KAAK,CAAC;QACzD,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;QAC9B,OAAO,IAAI,KAAK,aAAa,IAAI,IAAI,KAAK,WAAW,CAAC;IACvD,CAAC,CAAC;AACH,CAAC"}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ToolManager } from '../tools/tool-manager.js';
|
|
3
3
|
import type { ToolCall, ToolResult } from '../types/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Live display component for running compact tool counts.
|
|
6
|
+
* Shows accumulated counts during execution (e.g. "⚒ Read 7 files").
|
|
7
|
+
* Rendered in the live area (not Static) so it updates in-place.
|
|
8
|
+
*/
|
|
9
|
+
export declare function LiveCompactCounts({ counts }: {
|
|
10
|
+
counts: Record<string, number>;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* Flush accumulated compact counts to the static chat queue.
|
|
14
|
+
* Called when the conversation loop finishes to persist the summary.
|
|
15
|
+
*/
|
|
16
|
+
export declare function displayCompactCountsSummary(counts: Record<string, number>, addToChatQueue: (component: React.ReactNode) => void, getNextComponentKey: () => number): void;
|
|
4
17
|
/**
|
|
5
18
|
* Display tool result with proper formatting
|
|
6
19
|
* Extracted to eliminate duplication between useChatHandler and useToolHandler
|
|
@@ -10,6 +23,7 @@ import type { ToolCall, ToolResult } from '../types/index.js';
|
|
|
10
23
|
* @param toolManager - The tool manager instance (for formatters)
|
|
11
24
|
* @param addToChatQueue - Function to add components to chat queue
|
|
12
25
|
* @param getNextComponentKey - Function to generate unique React keys
|
|
26
|
+
* @param compact - When true, show one-liner instead of full formatter output
|
|
13
27
|
*/
|
|
14
|
-
export declare function displayToolResult(toolCall: ToolCall, result: ToolResult, toolManager: ToolManager | null, addToChatQueue: (component: React.ReactNode) => void, getNextComponentKey: () => number): Promise<void>;
|
|
28
|
+
export declare function displayToolResult(toolCall: ToolCall, result: ToolResult, toolManager: ToolManager | null, addToChatQueue: (component: React.ReactNode) => void, getNextComponentKey: () => number, compact?: boolean): Promise<void>;
|
|
15
29
|
//# sourceMappingURL=tool-result-display.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-result-display.d.ts","sourceRoot":"","sources":["../../source/utils/tool-result-display.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tool-result-display.d.ts","sourceRoot":"","sources":["../../source/utils/tool-result-display.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAC,QAAQ,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAmExD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAC,MAAM,EAAC,EAAE;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAC,2CAW3E;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,cAAc,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,EACpD,mBAAmB,EAAE,MAAM,MAAM,GAC/B,IAAI,CA4BN;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACtC,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,UAAU,EAClB,WAAW,EAAE,WAAW,GAAG,IAAI,EAC/B,cAAc,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,EACpD,mBAAmB,EAAE,MAAM,MAAM,EACjC,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,IAAI,CAAC,CAkFf"}
|
|
@@ -1,8 +1,91 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { ErrorMessage } from '../components/message-box.js';
|
|
4
5
|
import ToolMessage from '../components/tool-message.js';
|
|
6
|
+
import { useTheme } from '../hooks/useTheme.js';
|
|
5
7
|
import { parseToolArguments } from '../utils/tool-args-parser.js';
|
|
8
|
+
/**
|
|
9
|
+
* Compact tool result display - shows "⚒ toolName description" in tool color.
|
|
10
|
+
*/
|
|
11
|
+
function CompactToolResult({ toolName, description, }) {
|
|
12
|
+
const { colors } = useTheme();
|
|
13
|
+
return (_jsxs(Text, { color: colors.tool, children: ['\u2692', " ", description] }));
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Generate a compact grouped description for N calls of the same tool.
|
|
17
|
+
* Always uses count-based phrasing for consistency.
|
|
18
|
+
*/
|
|
19
|
+
function getGroupedCompactDescription(toolName, count) {
|
|
20
|
+
const s = count === 1 ? '' : 's';
|
|
21
|
+
switch (toolName) {
|
|
22
|
+
case 'read_file':
|
|
23
|
+
return `Read ${count} file${s}`;
|
|
24
|
+
case 'write_file':
|
|
25
|
+
return `Wrote ${count} file${s}`;
|
|
26
|
+
case 'string_replace':
|
|
27
|
+
return `Made ${count} edit${s}`;
|
|
28
|
+
case 'execute_bash':
|
|
29
|
+
return `Ran ${count} command${s}`;
|
|
30
|
+
case 'search_file_contents':
|
|
31
|
+
return `Searched for ${count} pattern${s}`;
|
|
32
|
+
case 'find_files':
|
|
33
|
+
return `Ran ${count} file search${count === 1 ? '' : 'es'}`;
|
|
34
|
+
case 'list_directory':
|
|
35
|
+
return `Listed ${count} director${count === 1 ? 'y' : 'ies'}`;
|
|
36
|
+
case 'web_search':
|
|
37
|
+
return `Ran ${count} web search${count === 1 ? '' : 'es'}`;
|
|
38
|
+
case 'fetch_url':
|
|
39
|
+
return `Fetched ${count} URL${s}`;
|
|
40
|
+
case 'git_status':
|
|
41
|
+
case 'git_diff':
|
|
42
|
+
case 'git_log':
|
|
43
|
+
return `Ran ${count} git command${s}`;
|
|
44
|
+
case 'lsp_get_diagnostics':
|
|
45
|
+
return `Got diagnostics ${count} time${s}`;
|
|
46
|
+
case 'create_task':
|
|
47
|
+
return `Created ${count} task${s}`;
|
|
48
|
+
case 'list_tasks':
|
|
49
|
+
return `Listed tasks ${count} time${s}`;
|
|
50
|
+
case 'update_task':
|
|
51
|
+
return `Updated ${count} task${s}`;
|
|
52
|
+
case 'delete_task':
|
|
53
|
+
return `Deleted ${count} task${s}`;
|
|
54
|
+
case 'ask_question':
|
|
55
|
+
return `Asked ${count} question${s}`;
|
|
56
|
+
default:
|
|
57
|
+
return `Executed ${toolName} \u00d7 ${count}`;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Live display component for running compact tool counts.
|
|
62
|
+
* Shows accumulated counts during execution (e.g. "⚒ Read 7 files").
|
|
63
|
+
* Rendered in the live area (not Static) so it updates in-place.
|
|
64
|
+
*/
|
|
65
|
+
export function LiveCompactCounts({ counts }) {
|
|
66
|
+
const { colors } = useTheme();
|
|
67
|
+
return (_jsx(Box, { flexDirection: "column", marginBottom: 1, children: Object.entries(counts).map(([toolName, count]) => (_jsxs(Text, { color: colors.tool, children: ['\u2692', " ", getGroupedCompactDescription(toolName, count)] }, toolName))) }));
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Flush accumulated compact counts to the static chat queue.
|
|
71
|
+
* Called when the conversation loop finishes to persist the summary.
|
|
72
|
+
*/
|
|
73
|
+
export function displayCompactCountsSummary(counts, addToChatQueue, getNextComponentKey) {
|
|
74
|
+
const entries = Object.entries(counts);
|
|
75
|
+
for (let i = 0; i < entries.length; i++) {
|
|
76
|
+
const [toolName, count] = entries[i];
|
|
77
|
+
const isLast = i === entries.length - 1;
|
|
78
|
+
const description = getGroupedCompactDescription(toolName, count);
|
|
79
|
+
if (isLast) {
|
|
80
|
+
// Last entry gets wrapped in a flex-column Box with marginBottom
|
|
81
|
+
// to separate from subsequent content (same pattern as ToolMessage)
|
|
82
|
+
addToChatQueue(_jsx(Box, { flexDirection: "column", marginBottom: 1, children: _jsx(CompactToolResult, { toolName: toolName, description: description }) }, `tool-compact-summary-${toolName}-${getNextComponentKey()}`));
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
addToChatQueue(_jsx(CompactToolResult, { toolName: toolName, description: description }, `tool-compact-summary-${toolName}-${getNextComponentKey()}`));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
6
89
|
/**
|
|
7
90
|
* Display tool result with proper formatting
|
|
8
91
|
* Extracted to eliminate duplication between useChatHandler and useToolHandler
|
|
@@ -12,16 +95,23 @@ import { parseToolArguments } from '../utils/tool-args-parser.js';
|
|
|
12
95
|
* @param toolManager - The tool manager instance (for formatters)
|
|
13
96
|
* @param addToChatQueue - Function to add components to chat queue
|
|
14
97
|
* @param getNextComponentKey - Function to generate unique React keys
|
|
98
|
+
* @param compact - When true, show one-liner instead of full formatter output
|
|
15
99
|
*/
|
|
16
|
-
export async function displayToolResult(toolCall, result, toolManager, addToChatQueue, getNextComponentKey) {
|
|
100
|
+
export async function displayToolResult(toolCall, result, toolManager, addToChatQueue, getNextComponentKey, compact) {
|
|
17
101
|
// Check if this is an error result
|
|
18
102
|
const isError = result.content.startsWith('Error: ');
|
|
19
103
|
if (isError) {
|
|
20
|
-
// Display as error message
|
|
104
|
+
// Display as error message - always shown in full
|
|
21
105
|
const errorMessage = result.content.replace(/^Error: /, '');
|
|
22
106
|
addToChatQueue(_jsx(ErrorMessage, { message: errorMessage, hideBox: true }, `tool-error-${result.tool_call_id}-${getNextComponentKey()}-${Date.now()}`));
|
|
23
107
|
return;
|
|
24
108
|
}
|
|
109
|
+
// Compact mode: show count-based one-liner instead of full formatter output
|
|
110
|
+
if (compact) {
|
|
111
|
+
const description = getGroupedCompactDescription(result.name, 1);
|
|
112
|
+
addToChatQueue(_jsx(CompactToolResult, { toolName: result.name, description: description }, `tool-compact-${result.tool_call_id}-${getNextComponentKey()}`));
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
25
115
|
if (toolManager) {
|
|
26
116
|
const formatter = toolManager.getToolFormatter(result.name);
|
|
27
117
|
if (formatter) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-result-display.js","sourceRoot":"","sources":["../../source/utils/tool-result-display.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AACtD,OAAO,WAAW,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-result-display.js","sourceRoot":"","sources":["../../source/utils/tool-result-display.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAC;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AACtD,OAAO,WAAW,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAG1C,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAE5D;;GAEG;AACH,SAAS,iBAAiB,CAAC,EAC1B,QAAQ,EACR,WAAW,GAIX;IACA,MAAM,EAAC,MAAM,EAAC,GAAG,QAAQ,EAAE,CAAC;IAC5B,OAAO,CACN,MAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,IAAI,aACtB,QAAQ,OAAG,WAAW,IACjB,CACP,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,4BAA4B,CAAC,QAAgB,EAAE,KAAa;IACpE,MAAM,CAAC,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E,EAAE,CAIjE,CACF,CAAC;YACH,CAAC;QACF,CAAC;aAAM,CAAC;YACP,gCAAgC;YAChC,cAAc,CACb,KAAC,WAAW,IAEX,KAAK,EAAE,KAAK,MAAM,CAAC,IAAI,EAAE,EACzB,OAAO,EAAE,MAAM,CAAC,OAAO,EACvB,OAAO,EAAE,IAAI,IAHR,eAAe,MAAM,CAAC,YAAY,IAAI,mBAAmB,EAAE,EAAE,CAIjE,CACF,CAAC;QACH,CAAC;IACF,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-safe helper utilities for handling non-string content
|
|
3
|
+
*
|
|
4
|
+
* This module provides type guards and conversion functions that:
|
|
5
|
+
* 1. Accept unknown types (string, object, array, null, undefined)
|
|
6
|
+
* 2. Convert to appropriate types for processing
|
|
7
|
+
* 3. Preserve types in memory (critical for ToolCall.arguments)
|
|
8
|
+
* 4. Provide safe fallbacks for edge cases
|
|
9
|
+
*
|
|
10
|
+
* TYPE PRESERVATION STRATEGY
|
|
11
|
+
* ===========================
|
|
12
|
+
*
|
|
13
|
+
* "Preserving types" means:
|
|
14
|
+
* 1. When receiving LLM responses (which can be ANY type):
|
|
15
|
+
* - We accept unknown types (string, object, array, null, undefined)
|
|
16
|
+
* - We convert to string ONLY for PARSING OPERATIONS
|
|
17
|
+
* - We preserve the original type in the tool call structure
|
|
18
|
+
*
|
|
19
|
+
* 2. When storing ToolCall.arguments:
|
|
20
|
+
* - MUST preserve as Record<string, unknown> (object type)
|
|
21
|
+
* - NOT convert to string
|
|
22
|
+
* - Enables direct property access without JSON.parse
|
|
23
|
+
*
|
|
24
|
+
* 3. When displaying/writing to disk:
|
|
25
|
+
* - Convert to string for display/storage operations
|
|
26
|
+
* - Use JSON.stringify for objects/arrays
|
|
27
|
+
* - Use String() for primitives
|
|
28
|
+
*
|
|
29
|
+
* The confusion comes from mixing up:
|
|
30
|
+
* - "Preserve types in memory" (CRITICAL: ToolCall.arguments stays as object)
|
|
31
|
+
* - "Convert to string for processing" (NECESSARY: Parser expects strings)
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Type guard to check if value is a string
|
|
35
|
+
*
|
|
36
|
+
* @param value - Value to check
|
|
37
|
+
* @returns True if value is a string, false otherwise
|
|
38
|
+
*/
|
|
39
|
+
export declare function isString(value: unknown): value is string;
|
|
40
|
+
/**
|
|
41
|
+
* Type guard to check if value is a non-null object
|
|
42
|
+
*
|
|
43
|
+
* @param value - Value to check
|
|
44
|
+
* @returns True if value is a non-null object, false otherwise
|
|
45
|
+
*/
|
|
46
|
+
export declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
47
|
+
/**
|
|
48
|
+
* Type guard to check if value is an array
|
|
49
|
+
*
|
|
50
|
+
* @param value - Value to check
|
|
51
|
+
* @returns True if value is an array, false otherwise
|
|
52
|
+
*/
|
|
53
|
+
export declare function isArray(value: unknown): value is unknown[];
|
|
54
|
+
/**
|
|
55
|
+
* Type guard to check if value is a plain object (not null, not array, not instance)
|
|
56
|
+
*
|
|
57
|
+
* @param value - Value to check
|
|
58
|
+
* @returns True if value is a plain object, false otherwise
|
|
59
|
+
*/
|
|
60
|
+
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
61
|
+
/**
|
|
62
|
+
* Type guard to check if value is a valid function
|
|
63
|
+
*
|
|
64
|
+
* @param value - Value to check
|
|
65
|
+
* @returns True if value is a function, false otherwise
|
|
66
|
+
*/
|
|
67
|
+
export declare function isFunction(value: unknown): value is Function;
|
|
68
|
+
/**
|
|
69
|
+
* Type guard to check if value is a valid number
|
|
70
|
+
*
|
|
71
|
+
* @param value - Value to check
|
|
72
|
+
* @returns True if value is a number, false otherwise
|
|
73
|
+
*/
|
|
74
|
+
export declare function isNumber(value: unknown): value is number;
|
|
75
|
+
/**
|
|
76
|
+
* Type guard to check if value is a valid boolean
|
|
77
|
+
*
|
|
78
|
+
* @param value - Value to check
|
|
79
|
+
* @returns True if value is a boolean, false otherwise
|
|
80
|
+
*/
|
|
81
|
+
export declare function isBoolean(value: unknown): value is boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Type guard to check if value is a valid null value
|
|
84
|
+
*
|
|
85
|
+
* @param value - Value to check
|
|
86
|
+
* @returns True if value is null, false otherwise
|
|
87
|
+
*/
|
|
88
|
+
export declare function isNull(value: unknown): value is null;
|
|
89
|
+
/**
|
|
90
|
+
* Type guard to check if value is undefined
|
|
91
|
+
*
|
|
92
|
+
* @param value - Value to check
|
|
93
|
+
* @returns True if value is undefined, false otherwise
|
|
94
|
+
*/
|
|
95
|
+
export declare function isUndefined(value: unknown): value is undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Ensures value is a string for display/storage operations
|
|
98
|
+
*
|
|
99
|
+
* This function is used for:
|
|
100
|
+
* 1. DISPLAY OPERATIONS - where we need to display content
|
|
101
|
+
* 2. STORAGE OPERATIONS - where we write to disk
|
|
102
|
+
*
|
|
103
|
+
* For display/storage, we convert to string.
|
|
104
|
+
*
|
|
105
|
+
* @param value - Value to convert (unknown type)
|
|
106
|
+
* @returns String representation of the value
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```typescript
|
|
110
|
+
* // ToolCall.arguments is an object in memory
|
|
111
|
+
* const toolCall = {
|
|
112
|
+
* function: {
|
|
113
|
+
* name: 'write_file',
|
|
114
|
+
* arguments: {path: "/tmp/test.txt", content: "hello"}
|
|
115
|
+
* }
|
|
116
|
+
* };
|
|
117
|
+
*
|
|
118
|
+
* // For storage, convert to string
|
|
119
|
+
* const contentStr = ensureString(toolCall.function.arguments);
|
|
120
|
+
* // contentStr = '{"path": "/tmp/test.txt", "content": "hello"}'
|
|
121
|
+
*
|
|
122
|
+
* await writeFile(path, contentStr, 'utf-8');
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
export declare function ensureString(value: unknown): string;
|
|
126
|
+
/**
|
|
127
|
+
* Checks if value is empty
|
|
128
|
+
*
|
|
129
|
+
* @param value - Value to check
|
|
130
|
+
* @returns True if value is empty, false otherwise
|
|
131
|
+
*/
|
|
132
|
+
export declare function isEmpty(value: unknown): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Checks if value is non-empty (opposite of isEmpty)
|
|
135
|
+
*
|
|
136
|
+
* @param value - Value to check
|
|
137
|
+
* @returns True if value is non-empty, false otherwise
|
|
138
|
+
*/
|
|
139
|
+
export declare function isNotEmpty(value: unknown): boolean;
|
|
140
|
+
//# sourceMappingURL=type-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-helpers.d.ts","sourceRoot":"","sources":["../../source/utils/type-helpers.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAMH;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,EAAE,CAE1D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC5B,KAAK,EAAE,OAAO,GACZ,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQlC;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAE1D;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,IAAI,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAE9D;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAiCnD;AAMD;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAsB/C;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAElD"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
// source/utils/type-helpers.ts
|
|
2
|
+
/**
|
|
3
|
+
* Type-safe helper utilities for handling non-string content
|
|
4
|
+
*
|
|
5
|
+
* This module provides type guards and conversion functions that:
|
|
6
|
+
* 1. Accept unknown types (string, object, array, null, undefined)
|
|
7
|
+
* 2. Convert to appropriate types for processing
|
|
8
|
+
* 3. Preserve types in memory (critical for ToolCall.arguments)
|
|
9
|
+
* 4. Provide safe fallbacks for edge cases
|
|
10
|
+
*
|
|
11
|
+
* TYPE PRESERVATION STRATEGY
|
|
12
|
+
* ===========================
|
|
13
|
+
*
|
|
14
|
+
* "Preserving types" means:
|
|
15
|
+
* 1. When receiving LLM responses (which can be ANY type):
|
|
16
|
+
* - We accept unknown types (string, object, array, null, undefined)
|
|
17
|
+
* - We convert to string ONLY for PARSING OPERATIONS
|
|
18
|
+
* - We preserve the original type in the tool call structure
|
|
19
|
+
*
|
|
20
|
+
* 2. When storing ToolCall.arguments:
|
|
21
|
+
* - MUST preserve as Record<string, unknown> (object type)
|
|
22
|
+
* - NOT convert to string
|
|
23
|
+
* - Enables direct property access without JSON.parse
|
|
24
|
+
*
|
|
25
|
+
* 3. When displaying/writing to disk:
|
|
26
|
+
* - Convert to string for display/storage operations
|
|
27
|
+
* - Use JSON.stringify for objects/arrays
|
|
28
|
+
* - Use String() for primitives
|
|
29
|
+
*
|
|
30
|
+
* The confusion comes from mixing up:
|
|
31
|
+
* - "Preserve types in memory" (CRITICAL: ToolCall.arguments stays as object)
|
|
32
|
+
* - "Convert to string for processing" (NECESSARY: Parser expects strings)
|
|
33
|
+
*/
|
|
34
|
+
// ============================================================================
|
|
35
|
+
// TYPE GUARDS
|
|
36
|
+
// ============================================================================
|
|
37
|
+
/**
|
|
38
|
+
* Type guard to check if value is a string
|
|
39
|
+
*
|
|
40
|
+
* @param value - Value to check
|
|
41
|
+
* @returns True if value is a string, false otherwise
|
|
42
|
+
*/
|
|
43
|
+
export function isString(value) {
|
|
44
|
+
return typeof value === 'string';
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Type guard to check if value is a non-null object
|
|
48
|
+
*
|
|
49
|
+
* @param value - Value to check
|
|
50
|
+
* @returns True if value is a non-null object, false otherwise
|
|
51
|
+
*/
|
|
52
|
+
export function isObject(value) {
|
|
53
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Type guard to check if value is an array
|
|
57
|
+
*
|
|
58
|
+
* @param value - Value to check
|
|
59
|
+
* @returns True if value is an array, false otherwise
|
|
60
|
+
*/
|
|
61
|
+
export function isArray(value) {
|
|
62
|
+
return Array.isArray(value);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Type guard to check if value is a plain object (not null, not array, not instance)
|
|
66
|
+
*
|
|
67
|
+
* @param value - Value to check
|
|
68
|
+
* @returns True if value is a plain object, false otherwise
|
|
69
|
+
*/
|
|
70
|
+
export function isPlainObject(value) {
|
|
71
|
+
if (value === null || typeof value !== 'object') {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
// Check for prototype chain
|
|
75
|
+
const prototype = Object.getPrototypeOf(value);
|
|
76
|
+
return prototype === null || prototype === Object.prototype;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Type guard to check if value is a valid function
|
|
80
|
+
*
|
|
81
|
+
* @param value - Value to check
|
|
82
|
+
* @returns True if value is a function, false otherwise
|
|
83
|
+
*/
|
|
84
|
+
export function isFunction(value) {
|
|
85
|
+
return typeof value === 'function';
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Type guard to check if value is a valid number
|
|
89
|
+
*
|
|
90
|
+
* @param value - Value to check
|
|
91
|
+
* @returns True if value is a number, false otherwise
|
|
92
|
+
*/
|
|
93
|
+
export function isNumber(value) {
|
|
94
|
+
return typeof value === 'number' && !isNaN(value) && isFinite(value);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Type guard to check if value is a valid boolean
|
|
98
|
+
*
|
|
99
|
+
* @param value - Value to check
|
|
100
|
+
* @returns True if value is a boolean, false otherwise
|
|
101
|
+
*/
|
|
102
|
+
export function isBoolean(value) {
|
|
103
|
+
return typeof value === 'boolean';
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Type guard to check if value is a valid null value
|
|
107
|
+
*
|
|
108
|
+
* @param value - Value to check
|
|
109
|
+
* @returns True if value is null, false otherwise
|
|
110
|
+
*/
|
|
111
|
+
export function isNull(value) {
|
|
112
|
+
return value === null;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Type guard to check if value is undefined
|
|
116
|
+
*
|
|
117
|
+
* @param value - Value to check
|
|
118
|
+
* @returns True if value is undefined, false otherwise
|
|
119
|
+
*/
|
|
120
|
+
export function isUndefined(value) {
|
|
121
|
+
return value === undefined;
|
|
122
|
+
}
|
|
123
|
+
// ============================================================================
|
|
124
|
+
// STRING CONVERSION FUNCTIONS
|
|
125
|
+
// ============================================================================
|
|
126
|
+
/**
|
|
127
|
+
* Ensures value is a string for display/storage operations
|
|
128
|
+
*
|
|
129
|
+
* This function is used for:
|
|
130
|
+
* 1. DISPLAY OPERATIONS - where we need to display content
|
|
131
|
+
* 2. STORAGE OPERATIONS - where we write to disk
|
|
132
|
+
*
|
|
133
|
+
* For display/storage, we convert to string.
|
|
134
|
+
*
|
|
135
|
+
* @param value - Value to convert (unknown type)
|
|
136
|
+
* @returns String representation of the value
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* // ToolCall.arguments is an object in memory
|
|
141
|
+
* const toolCall = {
|
|
142
|
+
* function: {
|
|
143
|
+
* name: 'write_file',
|
|
144
|
+
* arguments: {path: "/tmp/test.txt", content: "hello"}
|
|
145
|
+
* }
|
|
146
|
+
* };
|
|
147
|
+
*
|
|
148
|
+
* // For storage, convert to string
|
|
149
|
+
* const contentStr = ensureString(toolCall.function.arguments);
|
|
150
|
+
* // contentStr = '{"path": "/tmp/test.txt", "content": "hello"}'
|
|
151
|
+
*
|
|
152
|
+
* await writeFile(path, contentStr, 'utf-8');
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
export function ensureString(value) {
|
|
156
|
+
// Handle null/undefined
|
|
157
|
+
if (value === null || value === undefined) {
|
|
158
|
+
return '';
|
|
159
|
+
}
|
|
160
|
+
// Handle string - return as-is
|
|
161
|
+
if (isString(value)) {
|
|
162
|
+
return value;
|
|
163
|
+
}
|
|
164
|
+
// Handle number - convert to string
|
|
165
|
+
if (isNumber(value)) {
|
|
166
|
+
return String(value);
|
|
167
|
+
}
|
|
168
|
+
// Handle boolean - convert to string
|
|
169
|
+
if (isBoolean(value)) {
|
|
170
|
+
return String(value);
|
|
171
|
+
}
|
|
172
|
+
// Handle array - convert to JSON string
|
|
173
|
+
if (isArray(value)) {
|
|
174
|
+
return JSON.stringify(value);
|
|
175
|
+
}
|
|
176
|
+
// Handle object - convert to JSON string
|
|
177
|
+
if (isObject(value)) {
|
|
178
|
+
return JSON.stringify(value);
|
|
179
|
+
}
|
|
180
|
+
// Fallback for unknown types
|
|
181
|
+
return String(value);
|
|
182
|
+
}
|
|
183
|
+
// ============================================================================
|
|
184
|
+
// UTILITY FUNCTIONS
|
|
185
|
+
// ============================================================================
|
|
186
|
+
/**
|
|
187
|
+
* Checks if value is empty
|
|
188
|
+
*
|
|
189
|
+
* @param value - Value to check
|
|
190
|
+
* @returns True if value is empty, false otherwise
|
|
191
|
+
*/
|
|
192
|
+
export function isEmpty(value) {
|
|
193
|
+
// Check for null or undefined
|
|
194
|
+
if (value === null || value === undefined) {
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
197
|
+
// Check for empty string
|
|
198
|
+
if (isString(value) && value === '') {
|
|
199
|
+
return true;
|
|
200
|
+
}
|
|
201
|
+
// Check for empty array
|
|
202
|
+
if (isArray(value) && value.length === 0) {
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
// Check for empty object
|
|
206
|
+
if (isObject(value) && Object.keys(value).length === 0) {
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Checks if value is non-empty (opposite of isEmpty)
|
|
213
|
+
*
|
|
214
|
+
* @param value - Value to check
|
|
215
|
+
* @returns True if value is non-empty, false otherwise
|
|
216
|
+
*/
|
|
217
|
+
export function isNotEmpty(value) {
|
|
218
|
+
return !isEmpty(value);
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=type-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-helpers.js","sourceRoot":"","sources":["../../source/utils/type-helpers.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AAClC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,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