@gguf/coder 0.2.9 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +16 -0
- package/.env.example +63 -0
- package/.gitattributes +1 -0
- package/.semgrepignore +19 -0
- package/coder-dummy-file.ts +52 -0
- package/coder.config.example.json +59 -0
- package/coder.config.json +13 -0
- package/color_picker.html +36 -0
- package/dist/tools/execute-bash.js +3 -3
- package/dist/tools/execute-bash.js.map +1 -1
- package/dist/tools/fetch-url.js +3 -3
- package/dist/tools/fetch-url.js.map +1 -1
- package/dist/tools/find-files.d.ts.map +1 -1
- package/dist/tools/find-files.js +1 -1
- package/dist/tools/find-files.js.map +1 -1
- package/dist/tools/lsp-get-diagnostics.js +1 -1
- 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 +6 -6
- 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 +1 -1
- package/dist/tools/search-file-contents.js.map +1 -1
- package/dist/tools/string-replace.js +11 -11
- package/dist/tools/string-replace.js.map +1 -1
- package/dist/tools/web-search.d.ts.map +1 -1
- package/dist/tools/web-search.js +3 -3
- package/dist/tools/web-search.js.map +1 -1
- package/dist/tools/write-file.js +4 -4
- package/dist/tools/write-file.js.map +1 -1
- package/dist/utils/tool-result-display.d.ts.map +1 -1
- package/dist/utils/tool-result-display.js +3 -3
- package/dist/utils/tool-result-display.js.map +1 -1
- package/package.json +2 -14
- package/scripts/extract-changelog.js +73 -0
- package/scripts/fetch-models.js +143 -0
- package/scripts/test.sh +40 -0
- package/scripts/update-homebrew-formula.sh +125 -0
- package/scripts/update-nix-version.sh +157 -0
- package/source/ai-sdk-client/AISDKClient.spec.ts +117 -0
- package/source/ai-sdk-client/AISDKClient.ts +155 -0
- package/source/ai-sdk-client/chat/chat-handler.spec.ts +121 -0
- package/source/ai-sdk-client/chat/chat-handler.ts +276 -0
- package/source/ai-sdk-client/chat/streaming-handler.spec.ts +173 -0
- package/source/ai-sdk-client/chat/streaming-handler.ts +110 -0
- package/source/ai-sdk-client/chat/tool-processor.spec.ts +92 -0
- package/source/ai-sdk-client/chat/tool-processor.ts +70 -0
- package/source/ai-sdk-client/converters/message-converter.spec.ts +220 -0
- package/source/ai-sdk-client/converters/message-converter.ts +113 -0
- package/source/ai-sdk-client/converters/tool-converter.spec.ts +90 -0
- package/source/ai-sdk-client/converters/tool-converter.ts +46 -0
- package/source/ai-sdk-client/error-handling/error-extractor.spec.ts +55 -0
- package/source/ai-sdk-client/error-handling/error-extractor.ts +15 -0
- package/source/ai-sdk-client/error-handling/error-parser.spec.ts +169 -0
- package/source/ai-sdk-client/error-handling/error-parser.ts +161 -0
- package/source/ai-sdk-client/index.ts +7 -0
- package/source/ai-sdk-client/providers/provider-factory.spec.ts +71 -0
- package/source/ai-sdk-client/providers/provider-factory.ts +41 -0
- package/source/ai-sdk-client/types.ts +9 -0
- package/source/ai-sdk-client-empty-message.spec.ts +141 -0
- package/source/ai-sdk-client-error-handling.spec.ts +186 -0
- package/source/ai-sdk-client-maxretries.spec.ts +114 -0
- package/source/ai-sdk-client-preparestep.spec.ts +279 -0
- package/source/app/App.spec.tsx +32 -0
- package/source/app/App.tsx +480 -0
- package/source/app/components/AppContainer.spec.tsx +96 -0
- package/source/app/components/AppContainer.tsx +56 -0
- package/source/app/components/ChatInterface.spec.tsx +163 -0
- package/source/app/components/ChatInterface.tsx +144 -0
- package/source/app/components/ModalSelectors.spec.tsx +141 -0
- package/source/app/components/ModalSelectors.tsx +135 -0
- package/source/app/helpers.spec.ts +97 -0
- package/source/app/helpers.ts +63 -0
- package/source/app/index.ts +4 -0
- package/source/app/types.ts +39 -0
- package/source/app/utils/appUtils.ts +294 -0
- package/source/app/utils/conversationState.ts +310 -0
- package/source/app.spec.tsx +244 -0
- package/source/cli.spec.ts +73 -0
- package/source/cli.tsx +51 -0
- package/source/client-factory.spec.ts +48 -0
- package/source/client-factory.ts +178 -0
- package/source/command-parser.spec.ts +127 -0
- package/source/command-parser.ts +36 -0
- package/source/commands/checkpoint.spec.tsx +277 -0
- package/source/commands/checkpoint.tsx +366 -0
- package/source/commands/clear.tsx +22 -0
- package/source/commands/custom-commands.tsx +121 -0
- package/source/commands/exit.ts +21 -0
- package/source/commands/export.spec.tsx +131 -0
- package/source/commands/export.tsx +79 -0
- package/source/commands/help.tsx +120 -0
- package/source/commands/index.ts +17 -0
- package/source/commands/init.tsx +339 -0
- package/source/commands/lsp-command.spec.tsx +281 -0
- package/source/commands/lsp.tsx +120 -0
- package/source/commands/mcp-command.spec.tsx +313 -0
- package/source/commands/mcp.tsx +162 -0
- package/source/commands/model-database.spec.tsx +758 -0
- package/source/commands/model-database.tsx +418 -0
- package/source/commands/model.ts +12 -0
- package/source/commands/provider.ts +12 -0
- package/source/commands/setup-config.tsx +16 -0
- package/source/commands/simple-commands.spec.tsx +175 -0
- package/source/commands/status.ts +12 -0
- package/source/commands/theme.ts +12 -0
- package/source/commands/update.spec.tsx +261 -0
- package/source/commands/update.tsx +201 -0
- package/source/commands/usage.spec.tsx +495 -0
- package/source/commands/usage.tsx +100 -0
- package/source/commands.spec.ts +436 -0
- package/source/commands.ts +83 -0
- package/source/components/assistant-message.spec.tsx +796 -0
- package/source/components/assistant-message.tsx +34 -0
- package/source/components/bash-execution-indicator.tsx +21 -0
- package/source/components/cancelling-indicator.tsx +16 -0
- package/source/components/chat-queue.spec.tsx +83 -0
- package/source/components/chat-queue.tsx +36 -0
- package/source/components/checkpoint-display.spec.tsx +219 -0
- package/source/components/checkpoint-display.tsx +126 -0
- package/source/components/checkpoint-selector.spec.tsx +173 -0
- package/source/components/checkpoint-selector.tsx +173 -0
- package/source/components/development-mode-indicator.spec.tsx +268 -0
- package/source/components/development-mode-indicator.tsx +38 -0
- package/source/components/message-box.spec.tsx +427 -0
- package/source/components/message-box.tsx +87 -0
- package/source/components/model-selector.tsx +132 -0
- package/source/components/provider-selector.tsx +75 -0
- package/source/components/random-spinner.tsx +19 -0
- package/source/components/security-disclaimer.tsx +73 -0
- package/source/components/status-connection-display.spec.tsx +133 -0
- package/source/components/status.tsx +267 -0
- package/source/components/theme-selector.tsx +126 -0
- package/source/components/tool-confirmation.tsx +190 -0
- package/source/components/tool-execution-indicator.tsx +33 -0
- package/source/components/tool-message.tsx +85 -0
- package/source/components/ui/titled-box.spec.tsx +207 -0
- package/source/components/ui/titled-box.tsx +57 -0
- package/source/components/usage/progress-bar.spec.tsx +398 -0
- package/source/components/usage/progress-bar.tsx +30 -0
- package/source/components/usage/usage-display.spec.tsx +780 -0
- package/source/components/usage/usage-display.tsx +291 -0
- package/source/components/user-input.spec.tsx +327 -0
- package/source/components/user-input.tsx +533 -0
- package/source/components/user-message.spec.tsx +230 -0
- package/source/components/user-message.tsx +84 -0
- package/source/components/welcome-message.tsx +76 -0
- package/source/config/env-substitution.ts +65 -0
- package/source/config/index.spec.ts +171 -0
- package/source/config/index.ts +154 -0
- package/source/config/paths.spec.ts +241 -0
- package/source/config/paths.ts +55 -0
- package/source/config/preferences.ts +51 -0
- package/source/config/themes.ts +315 -0
- package/source/constants.ts +130 -0
- package/source/context/mode-context.spec.ts +79 -0
- package/source/context/mode-context.ts +24 -0
- package/source/custom-commands/executor.spec.ts +142 -0
- package/source/custom-commands/executor.ts +64 -0
- package/source/custom-commands/loader.spec.ts +314 -0
- package/source/custom-commands/loader.ts +153 -0
- package/source/custom-commands/parser.ts +196 -0
- package/source/hooks/chat-handler/conversation/conversation-loop.spec.ts +39 -0
- package/source/hooks/chat-handler/conversation/conversation-loop.tsx +511 -0
- package/source/hooks/chat-handler/conversation/tool-executor.spec.ts +50 -0
- package/source/hooks/chat-handler/conversation/tool-executor.tsx +109 -0
- package/source/hooks/chat-handler/index.ts +12 -0
- package/source/hooks/chat-handler/state/streaming-state.spec.ts +26 -0
- package/source/hooks/chat-handler/state/streaming-state.ts +19 -0
- package/source/hooks/chat-handler/types.ts +38 -0
- package/source/hooks/chat-handler/useChatHandler.spec.tsx +321 -0
- package/source/hooks/chat-handler/useChatHandler.tsx +194 -0
- package/source/hooks/chat-handler/utils/context-checker.spec.ts +60 -0
- package/source/hooks/chat-handler/utils/context-checker.tsx +73 -0
- package/source/hooks/chat-handler/utils/message-helpers.spec.ts +42 -0
- package/source/hooks/chat-handler/utils/message-helpers.tsx +36 -0
- package/source/hooks/chat-handler/utils/tool-filters.spec.ts +109 -0
- package/source/hooks/chat-handler/utils/tool-filters.ts +64 -0
- package/source/hooks/useAppHandlers.tsx +291 -0
- package/source/hooks/useAppInitialization.tsx +422 -0
- package/source/hooks/useAppState.tsx +311 -0
- package/source/hooks/useDirectoryTrust.tsx +98 -0
- package/source/hooks/useInputState.ts +414 -0
- package/source/hooks/useModeHandlers.tsx +302 -0
- package/source/hooks/useNonInteractiveMode.ts +140 -0
- package/source/hooks/useTerminalWidth.tsx +81 -0
- package/source/hooks/useTheme.ts +18 -0
- package/source/hooks/useToolHandler.tsx +349 -0
- package/source/hooks/useUIState.ts +61 -0
- package/source/init/agents-template-generator.ts +421 -0
- package/source/init/existing-rules-extractor.ts +319 -0
- package/source/init/file-scanner.spec.ts +227 -0
- package/source/init/file-scanner.ts +238 -0
- package/source/init/framework-detector.ts +382 -0
- package/source/init/language-detector.ts +269 -0
- package/source/init/project-analyzer.spec.ts +231 -0
- package/source/init/project-analyzer.ts +458 -0
- package/source/lsp/index.ts +31 -0
- package/source/lsp/lsp-client.spec.ts +508 -0
- package/source/lsp/lsp-client.ts +487 -0
- package/source/lsp/lsp-manager.spec.ts +477 -0
- package/source/lsp/lsp-manager.ts +419 -0
- package/source/lsp/protocol.spec.ts +502 -0
- package/source/lsp/protocol.ts +360 -0
- package/source/lsp/server-discovery.spec.ts +654 -0
- package/source/lsp/server-discovery.ts +515 -0
- package/source/markdown-parser/html-entities.spec.ts +88 -0
- package/source/markdown-parser/html-entities.ts +45 -0
- package/source/markdown-parser/index.spec.ts +281 -0
- package/source/markdown-parser/index.ts +126 -0
- package/source/markdown-parser/table-parser.spec.ts +133 -0
- package/source/markdown-parser/table-parser.ts +114 -0
- package/source/markdown-parser/utils.spec.ts +70 -0
- package/source/markdown-parser/utils.ts +13 -0
- package/source/mcp/mcp-client.spec.ts +81 -0
- package/source/mcp/mcp-client.ts +625 -0
- package/source/mcp/transport-factory.spec.ts +406 -0
- package/source/mcp/transport-factory.ts +312 -0
- package/source/message-handler.ts +67 -0
- package/source/model-database/database-engine.spec.ts +494 -0
- package/source/model-database/database-engine.ts +50 -0
- package/source/model-database/model-database.spec.ts +363 -0
- package/source/model-database/model-database.ts +91 -0
- package/source/model-database/model-engine.spec.ts +447 -0
- package/source/model-database/model-engine.ts +65 -0
- package/source/model-database/model-fetcher.spec.ts +583 -0
- package/source/model-database/model-fetcher.ts +330 -0
- package/source/models/index.ts +1 -0
- package/source/models/models-cache.spec.ts +214 -0
- package/source/models/models-cache.ts +78 -0
- package/source/models/models-dev-client.spec.ts +379 -0
- package/source/models/models-dev-client.ts +329 -0
- package/source/models/models-types.ts +68 -0
- package/source/prompt-history.ts +155 -0
- package/source/security/command-injection.spec.ts +240 -0
- package/source/services/checkpoint-manager.spec.ts +523 -0
- package/source/services/checkpoint-manager.ts +466 -0
- package/source/services/file-snapshot.spec.ts +569 -0
- package/source/services/file-snapshot.ts +220 -0
- package/source/test-utils/render-with-theme.tsx +48 -0
- package/source/tokenization/index.ts +1 -0
- package/source/tokenization/tokenizer-factory.spec.ts +170 -0
- package/source/tokenization/tokenizer-factory.ts +125 -0
- package/source/tokenization/tokenizers/anthropic-tokenizer.spec.ts +200 -0
- package/source/tokenization/tokenizers/anthropic-tokenizer.ts +43 -0
- package/source/tokenization/tokenizers/fallback-tokenizer.spec.ts +236 -0
- package/source/tokenization/tokenizers/fallback-tokenizer.ts +26 -0
- package/source/tokenization/tokenizers/llama-tokenizer.spec.ts +224 -0
- package/source/tokenization/tokenizers/llama-tokenizer.ts +41 -0
- package/source/tokenization/tokenizers/openai-tokenizer.spec.ts +184 -0
- package/source/tokenization/tokenizers/openai-tokenizer.ts +57 -0
- package/source/tool-calling/index.ts +5 -0
- package/source/tool-calling/json-parser.spec.ts +639 -0
- package/source/tool-calling/json-parser.ts +247 -0
- package/source/tool-calling/tool-parser.spec.ts +395 -0
- package/source/tool-calling/tool-parser.ts +120 -0
- package/source/tool-calling/xml-parser.spec.ts +662 -0
- package/source/tool-calling/xml-parser.ts +289 -0
- package/source/tools/execute-bash.spec.tsx +353 -0
- package/source/tools/execute-bash.tsx +219 -0
- package/source/tools/execute-function.spec.ts +130 -0
- package/source/tools/fetch-url.spec.tsx +342 -0
- package/source/tools/fetch-url.tsx +172 -0
- package/source/tools/find-files.spec.tsx +924 -0
- package/source/tools/find-files.tsx +293 -0
- package/source/tools/index.ts +102 -0
- package/source/tools/lsp-get-diagnostics.tsx +192 -0
- package/source/tools/needs-approval.spec.ts +282 -0
- package/source/tools/read-file.spec.tsx +801 -0
- package/source/tools/read-file.tsx +387 -0
- package/source/tools/search-file-contents.spec.tsx +1273 -0
- package/source/tools/search-file-contents.tsx +293 -0
- package/source/tools/string-replace.spec.tsx +730 -0
- package/source/tools/string-replace.tsx +548 -0
- package/source/tools/tool-manager.ts +210 -0
- package/source/tools/tool-registry.spec.ts +415 -0
- package/source/tools/tool-registry.ts +228 -0
- package/source/tools/web-search.tsx +223 -0
- package/source/tools/write-file.spec.tsx +559 -0
- package/source/tools/write-file.tsx +228 -0
- package/source/types/app.ts +37 -0
- package/source/types/checkpoint.ts +48 -0
- package/source/types/commands.ts +46 -0
- package/source/types/components.ts +27 -0
- package/source/types/config.ts +103 -0
- package/source/types/core-connection-status.spec.ts +67 -0
- package/source/types/core.ts +181 -0
- package/source/types/hooks.ts +50 -0
- package/source/types/index.ts +12 -0
- package/source/types/markdown-parser.ts +11 -0
- package/source/types/mcp.ts +52 -0
- package/source/types/system.ts +16 -0
- package/source/types/tokenization.ts +41 -0
- package/source/types/ui.ts +40 -0
- package/source/types/usage.ts +58 -0
- package/source/types/utils.ts +16 -0
- package/source/usage/calculator.spec.ts +385 -0
- package/source/usage/calculator.ts +104 -0
- package/source/usage/storage.spec.ts +703 -0
- package/source/usage/storage.ts +238 -0
- package/source/usage/tracker.spec.ts +456 -0
- package/source/usage/tracker.ts +102 -0
- package/source/utils/atomic-deletion.spec.ts +194 -0
- package/source/utils/atomic-deletion.ts +127 -0
- package/source/utils/bounded-map.spec.ts +300 -0
- package/source/utils/bounded-map.ts +193 -0
- package/source/utils/checkpoint-utils.spec.ts +222 -0
- package/source/utils/checkpoint-utils.ts +92 -0
- package/source/utils/error-formatter.spec.ts +169 -0
- package/source/utils/error-formatter.ts +194 -0
- package/source/utils/file-autocomplete.spec.ts +173 -0
- package/source/utils/file-autocomplete.ts +196 -0
- package/source/utils/file-cache.spec.ts +309 -0
- package/source/utils/file-cache.ts +195 -0
- package/source/utils/file-content-loader.spec.ts +180 -0
- package/source/utils/file-content-loader.ts +179 -0
- package/source/utils/file-mention-handler.spec.ts +261 -0
- package/source/utils/file-mention-handler.ts +84 -0
- package/source/utils/file-mention-parser.spec.ts +182 -0
- package/source/utils/file-mention-parser.ts +170 -0
- package/source/utils/fuzzy-matching.spec.ts +149 -0
- package/source/utils/fuzzy-matching.ts +146 -0
- package/source/utils/indentation-normalizer.spec.ts +216 -0
- package/source/utils/indentation-normalizer.ts +76 -0
- package/source/utils/installation-detector.spec.ts +178 -0
- package/source/utils/installation-detector.ts +153 -0
- package/source/utils/logging/config.spec.ts +311 -0
- package/source/utils/logging/config.ts +210 -0
- package/source/utils/logging/console-facade.spec.ts +184 -0
- package/source/utils/logging/console-facade.ts +384 -0
- package/source/utils/logging/correlation.spec.ts +679 -0
- package/source/utils/logging/correlation.ts +474 -0
- package/source/utils/logging/formatters.spec.ts +464 -0
- package/source/utils/logging/formatters.ts +207 -0
- package/source/utils/logging/health-monitor/alerts/alert-manager.spec.ts +93 -0
- package/source/utils/logging/health-monitor/alerts/alert-manager.ts +79 -0
- package/source/utils/logging/health-monitor/checks/configuration-check.spec.ts +56 -0
- package/source/utils/logging/health-monitor/checks/configuration-check.ts +43 -0
- package/source/utils/logging/health-monitor/checks/logging-check.spec.ts +56 -0
- package/source/utils/logging/health-monitor/checks/logging-check.ts +58 -0
- package/source/utils/logging/health-monitor/checks/memory-check.spec.ts +100 -0
- package/source/utils/logging/health-monitor/checks/memory-check.ts +78 -0
- package/source/utils/logging/health-monitor/checks/performance-check.spec.ts +56 -0
- package/source/utils/logging/health-monitor/checks/performance-check.ts +56 -0
- package/source/utils/logging/health-monitor/checks/request-check.spec.ts +56 -0
- package/source/utils/logging/health-monitor/checks/request-check.ts +76 -0
- package/source/utils/logging/health-monitor/core/health-check-runner.spec.ts +70 -0
- package/source/utils/logging/health-monitor/core/health-check-runner.ts +138 -0
- package/source/utils/logging/health-monitor/core/health-monitor.spec.ts +58 -0
- package/source/utils/logging/health-monitor/core/health-monitor.ts +344 -0
- package/source/utils/logging/health-monitor/core/scoring.spec.ts +65 -0
- package/source/utils/logging/health-monitor/core/scoring.ts +91 -0
- package/source/utils/logging/health-monitor/index.ts +15 -0
- package/source/utils/logging/health-monitor/instances.ts +48 -0
- package/source/utils/logging/health-monitor/middleware/http-middleware.spec.ts +141 -0
- package/source/utils/logging/health-monitor/middleware/http-middleware.ts +75 -0
- package/source/utils/logging/health-monitor/types.ts +126 -0
- package/source/utils/logging/index.spec.ts +284 -0
- package/source/utils/logging/index.ts +236 -0
- package/source/utils/logging/integration.spec.ts +441 -0
- package/source/utils/logging/log-method-factory.spec.ts +573 -0
- package/source/utils/logging/log-method-factory.ts +233 -0
- package/source/utils/logging/log-query/aggregation/aggregator.spec.ts +277 -0
- package/source/utils/logging/log-query/aggregation/aggregator.ts +159 -0
- package/source/utils/logging/log-query/aggregation/facet-generator.spec.ts +159 -0
- package/source/utils/logging/log-query/aggregation/facet-generator.ts +47 -0
- package/source/utils/logging/log-query/index.ts +23 -0
- package/source/utils/logging/log-query/query/filter-predicates.spec.ts +247 -0
- package/source/utils/logging/log-query/query/filter-predicates.ts +154 -0
- package/source/utils/logging/log-query/query/query-builder.spec.ts +182 -0
- package/source/utils/logging/log-query/query/query-builder.ts +151 -0
- package/source/utils/logging/log-query/query/query-engine.spec.ts +214 -0
- package/source/utils/logging/log-query/query/query-engine.ts +45 -0
- package/source/utils/logging/log-query/storage/circular-buffer.spec.ts +143 -0
- package/source/utils/logging/log-query/storage/circular-buffer.ts +75 -0
- package/source/utils/logging/log-query/storage/index-manager.spec.ts +150 -0
- package/source/utils/logging/log-query/storage/index-manager.ts +71 -0
- package/source/utils/logging/log-query/storage/log-storage.spec.ts +257 -0
- package/source/utils/logging/log-query/storage/log-storage.ts +80 -0
- package/source/utils/logging/log-query/types.ts +163 -0
- package/source/utils/logging/log-query/utils/helpers.spec.ts +263 -0
- package/source/utils/logging/log-query/utils/helpers.ts +72 -0
- package/source/utils/logging/log-query/utils/sorting.spec.ts +182 -0
- package/source/utils/logging/log-query/utils/sorting.ts +61 -0
- package/source/utils/logging/logger-provider.spec.ts +262 -0
- package/source/utils/logging/logger-provider.ts +362 -0
- package/source/utils/logging/performance.spec.ts +209 -0
- package/source/utils/logging/performance.ts +757 -0
- package/source/utils/logging/pino-logger.spec.ts +425 -0
- package/source/utils/logging/pino-logger.ts +514 -0
- package/source/utils/logging/redaction.spec.ts +490 -0
- package/source/utils/logging/redaction.ts +267 -0
- package/source/utils/logging/request-tracker.spec.ts +1198 -0
- package/source/utils/logging/request-tracker.ts +803 -0
- package/source/utils/logging/transports.spec.ts +505 -0
- package/source/utils/logging/transports.ts +305 -0
- package/source/utils/logging/types.ts +216 -0
- package/source/utils/message-builder.spec.ts +179 -0
- package/source/utils/message-builder.ts +101 -0
- package/source/utils/message-queue.tsx +486 -0
- package/source/utils/paste-detection.spec.ts +69 -0
- package/source/utils/paste-detection.ts +124 -0
- package/source/utils/paste-roundtrip.spec.ts +442 -0
- package/source/utils/paste-utils.spec.ts +128 -0
- package/source/utils/paste-utils.ts +52 -0
- package/source/utils/programming-language-helper.spec.ts +74 -0
- package/source/utils/programming-language-helper.ts +32 -0
- package/source/utils/prompt-assembly.spec.ts +221 -0
- package/source/utils/prompt-processor.ts +173 -0
- package/source/utils/tool-args-parser.spec.ts +136 -0
- package/source/utils/tool-args-parser.ts +54 -0
- package/source/utils/tool-cancellation.spec.ts +230 -0
- package/source/utils/tool-cancellation.ts +28 -0
- package/source/utils/tool-result-display.spec.tsx +469 -0
- package/source/utils/tool-result-display.tsx +90 -0
- package/source/utils/update-checker.spec.ts +383 -0
- package/source/utils/update-checker.ts +183 -0
- package/source/wizard/config-wizard.spec.tsx +103 -0
- package/source/wizard/config-wizard.tsx +382 -0
- package/source/wizard/steps/location-step.spec.tsx +186 -0
- package/source/wizard/steps/location-step.tsx +147 -0
- package/source/wizard/steps/mcp-step.spec.tsx +607 -0
- package/source/wizard/steps/mcp-step.tsx +632 -0
- package/source/wizard/steps/provider-step.spec.tsx +342 -0
- package/source/wizard/steps/provider-step.tsx +957 -0
- package/source/wizard/steps/summary-step.spec.tsx +749 -0
- package/source/wizard/steps/summary-step.tsx +228 -0
- package/source/wizard/templates/mcp-templates.spec.ts +613 -0
- package/source/wizard/templates/mcp-templates.ts +570 -0
- package/source/wizard/templates/provider-templates.spec.ts +152 -0
- package/source/wizard/templates/provider-templates.ts +485 -0
- package/source/wizard/utils/fetch-cloud-models.spec.ts +428 -0
- package/source/wizard/utils/fetch-cloud-models.ts +223 -0
- package/source/wizard/utils/fetch-local-models.spec.ts +297 -0
- package/source/wizard/utils/fetch-local-models.ts +192 -0
- package/source/wizard/validation-array.spec.ts +264 -0
- package/source/wizard/validation.spec.ts +373 -0
- package/source/wizard/validation.ts +232 -0
- package/source/app/prompts/main-prompt.md +0 -122
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import type { Theme, ThemePreset } from '@/types/ui';
|
|
2
|
+
|
|
3
|
+
export const themes: Record<ThemePreset, Theme> = {
|
|
4
|
+
'tokyo-night': {
|
|
5
|
+
name: 'tokyo-night',
|
|
6
|
+
displayName: 'Tokyo Night',
|
|
7
|
+
colors: {
|
|
8
|
+
white: '#c0caf5',
|
|
9
|
+
black: '#1a1b26',
|
|
10
|
+
primary: '#bb9af7',
|
|
11
|
+
tool: '#7dcfff',
|
|
12
|
+
success: '#7AF778',
|
|
13
|
+
error: '#f7768e',
|
|
14
|
+
secondary: '#565f89',
|
|
15
|
+
info: '#2ac3de',
|
|
16
|
+
warning: '#e0af68',
|
|
17
|
+
diffAdded: '#1e2f1e',
|
|
18
|
+
diffRemoved: '#2f1e1e',
|
|
19
|
+
diffAddedText: '#9ece6a',
|
|
20
|
+
diffRemovedText: '#f7768e',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
'synthwave-84': {
|
|
24
|
+
name: 'synthwave-84',
|
|
25
|
+
displayName: "Synthwave '84",
|
|
26
|
+
colors: {
|
|
27
|
+
white: '#f8f8f2',
|
|
28
|
+
black: '#2b213a',
|
|
29
|
+
primary: '#ff006a',
|
|
30
|
+
tool: '#00d9ff',
|
|
31
|
+
success: '#a6e22e',
|
|
32
|
+
error: '#ff3838',
|
|
33
|
+
secondary: '#8a7ca8',
|
|
34
|
+
info: '#66d9ef',
|
|
35
|
+
warning: '#ffb86c',
|
|
36
|
+
diffAdded: '#2d4a1e',
|
|
37
|
+
diffRemoved: '#4a1e2d',
|
|
38
|
+
diffAddedText: '#a6e22e',
|
|
39
|
+
diffRemovedText: '#ff3838',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
'forest-night': {
|
|
43
|
+
name: 'forest-night',
|
|
44
|
+
displayName: 'Forest Night',
|
|
45
|
+
colors: {
|
|
46
|
+
white: '#d3c6aa',
|
|
47
|
+
black: '#2d353b',
|
|
48
|
+
primary: '#a7c080',
|
|
49
|
+
tool: '#83c092',
|
|
50
|
+
success: '#a7c080',
|
|
51
|
+
error: '#e67e80',
|
|
52
|
+
secondary: '#859289',
|
|
53
|
+
info: '#7fbbb3',
|
|
54
|
+
warning: '#dbbc7f',
|
|
55
|
+
diffAdded: '#2d3f2d',
|
|
56
|
+
diffRemoved: '#3f2d2d',
|
|
57
|
+
diffAddedText: '#a7c080',
|
|
58
|
+
diffRemovedText: '#e67e80',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
'material-ocean': {
|
|
62
|
+
name: 'material-ocean',
|
|
63
|
+
displayName: 'Material Ocean',
|
|
64
|
+
colors: {
|
|
65
|
+
white: '#b3e5fc',
|
|
66
|
+
black: '#0d1117',
|
|
67
|
+
primary: '#26c6da',
|
|
68
|
+
tool: '#4fc3f7',
|
|
69
|
+
success: '#66bb6a',
|
|
70
|
+
error: '#ef5350',
|
|
71
|
+
secondary: '#78909c',
|
|
72
|
+
info: '#29b6f6',
|
|
73
|
+
warning: '#ffa726',
|
|
74
|
+
diffAdded: '#1a3d2e',
|
|
75
|
+
diffRemoved: '#3d1a1a',
|
|
76
|
+
diffAddedText: '#66bb6a',
|
|
77
|
+
diffRemovedText: '#ef5350',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
'sunset-glow': {
|
|
81
|
+
name: 'sunset-glow',
|
|
82
|
+
displayName: 'Sunset Glow',
|
|
83
|
+
colors: {
|
|
84
|
+
white: '#fdf4dc',
|
|
85
|
+
black: '#2d1b14',
|
|
86
|
+
primary: '#ff6b35',
|
|
87
|
+
tool: '#f7941d',
|
|
88
|
+
success: '#52c41a',
|
|
89
|
+
error: '#ff4757',
|
|
90
|
+
secondary: '#a0826d',
|
|
91
|
+
info: '#ffa726',
|
|
92
|
+
warning: '#ffca28',
|
|
93
|
+
diffAdded: '#2d4a1e',
|
|
94
|
+
diffRemoved: '#4a1e2d',
|
|
95
|
+
diffAddedText: '#52c41a',
|
|
96
|
+
diffRemovedText: '#ff4757',
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
'nord-frost': {
|
|
100
|
+
name: 'nord-frost',
|
|
101
|
+
displayName: 'Nord Frost',
|
|
102
|
+
colors: {
|
|
103
|
+
white: '#eceff4',
|
|
104
|
+
black: '#2e3440',
|
|
105
|
+
primary: '#88c0d0',
|
|
106
|
+
tool: '#8fbcbb',
|
|
107
|
+
success: '#a3be8c',
|
|
108
|
+
error: '#bf616a',
|
|
109
|
+
secondary: '#4c566a',
|
|
110
|
+
info: '#5e81ac',
|
|
111
|
+
warning: '#ebcb8b',
|
|
112
|
+
diffAdded: '#2d3f2d',
|
|
113
|
+
diffRemoved: '#3f2d2d',
|
|
114
|
+
diffAddedText: '#a3be8c',
|
|
115
|
+
diffRemovedText: '#bf616a',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
'rose-pine-dawn': {
|
|
119
|
+
name: 'rose-pine-dawn',
|
|
120
|
+
displayName: 'Rosé Pine Dawn',
|
|
121
|
+
colors: {
|
|
122
|
+
white: '#575279',
|
|
123
|
+
black: '#faf4ed',
|
|
124
|
+
primary: '#907aa9',
|
|
125
|
+
tool: '#56949f',
|
|
126
|
+
success: '#618a3d',
|
|
127
|
+
error: '#b4637a',
|
|
128
|
+
secondary: '#9893a5',
|
|
129
|
+
info: '#286983',
|
|
130
|
+
warning: '#ea9d34',
|
|
131
|
+
diffAdded: '#f0f0e8',
|
|
132
|
+
diffRemoved: '#f2e9e1',
|
|
133
|
+
diffAddedText: '#618a3d',
|
|
134
|
+
diffRemovedText: '#b4637a',
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
'neon-jungle': {
|
|
138
|
+
name: 'neon-jungle',
|
|
139
|
+
displayName: 'Neon Jungle',
|
|
140
|
+
colors: {
|
|
141
|
+
white: '#e0ffe0',
|
|
142
|
+
black: '#0d1f0d',
|
|
143
|
+
primary: '#39ff14',
|
|
144
|
+
tool: '#00ff7f',
|
|
145
|
+
success: '#32cd32',
|
|
146
|
+
error: '#ff1493',
|
|
147
|
+
secondary: '#4a7c59',
|
|
148
|
+
info: '#00ffff',
|
|
149
|
+
warning: '#ffff00',
|
|
150
|
+
diffAdded: '#1a4d1a',
|
|
151
|
+
diffRemoved: '#4d1a4d',
|
|
152
|
+
diffAddedText: '#32cd32',
|
|
153
|
+
diffRemovedText: '#ff1493',
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
'midnight-amethyst': {
|
|
157
|
+
name: 'midnight-amethyst',
|
|
158
|
+
displayName: 'Midnight Amethyst',
|
|
159
|
+
colors: {
|
|
160
|
+
white: '#e6e6fa',
|
|
161
|
+
black: '#0f0a1a',
|
|
162
|
+
primary: '#9966cc',
|
|
163
|
+
tool: '#ba55d3',
|
|
164
|
+
success: '#9370db',
|
|
165
|
+
error: '#dc143c',
|
|
166
|
+
secondary: '#6a5acd',
|
|
167
|
+
info: '#c0c0c0',
|
|
168
|
+
warning: '#dda0dd',
|
|
169
|
+
diffAdded: '#2d1a4d',
|
|
170
|
+
diffRemoved: '#4d1a1a',
|
|
171
|
+
diffAddedText: '#9370db',
|
|
172
|
+
diffRemovedText: '#dc143c',
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
'desert-mirage': {
|
|
176
|
+
name: 'desert-mirage',
|
|
177
|
+
displayName: 'Desert Mirage',
|
|
178
|
+
colors: {
|
|
179
|
+
white: '#fff8dc',
|
|
180
|
+
black: '#2f1b14',
|
|
181
|
+
primary: '#ffd700',
|
|
182
|
+
tool: '#daa520',
|
|
183
|
+
success: '#228b22',
|
|
184
|
+
error: '#dc143c',
|
|
185
|
+
secondary: '#d2691e',
|
|
186
|
+
info: '#40e0d0',
|
|
187
|
+
warning: '#ffa500',
|
|
188
|
+
diffAdded: '#2d4a1e',
|
|
189
|
+
diffRemoved: '#4a1e1e',
|
|
190
|
+
diffAddedText: '#228b22',
|
|
191
|
+
diffRemovedText: '#dc143c',
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
'cherry-blossom': {
|
|
195
|
+
name: 'cherry-blossom',
|
|
196
|
+
displayName: 'Cherry Blossom',
|
|
197
|
+
colors: {
|
|
198
|
+
white: '#5a5a5a',
|
|
199
|
+
black: '#fef7f0',
|
|
200
|
+
primary: '#ffb6c1',
|
|
201
|
+
tool: '#20b2aa',
|
|
202
|
+
success: '#3cb371',
|
|
203
|
+
error: '#cd5c5c',
|
|
204
|
+
secondary: '#bc8f8f',
|
|
205
|
+
info: '#4682b4',
|
|
206
|
+
warning: '#f4a460',
|
|
207
|
+
diffAdded: '#f0fff0',
|
|
208
|
+
diffRemoved: '#ffe4e1',
|
|
209
|
+
diffAddedText: '#3cb371',
|
|
210
|
+
diffRemovedText: '#cd5c5c',
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
'electric-storm': {
|
|
214
|
+
name: 'electric-storm',
|
|
215
|
+
displayName: 'Electric Storm',
|
|
216
|
+
colors: {
|
|
217
|
+
white: '#f0f0f0',
|
|
218
|
+
black: '#1c1c1c',
|
|
219
|
+
primary: '#ffff00',
|
|
220
|
+
tool: '#00bfff',
|
|
221
|
+
success: '#adff2f',
|
|
222
|
+
error: '#ff4500',
|
|
223
|
+
secondary: '#696969',
|
|
224
|
+
info: '#87ceeb',
|
|
225
|
+
warning: '#ffd700',
|
|
226
|
+
diffAdded: '#2d4a1e',
|
|
227
|
+
diffRemoved: '#4a1e1e',
|
|
228
|
+
diffAddedText: '#adff2f',
|
|
229
|
+
diffRemovedText: '#ff4500',
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
'deep-sea': {
|
|
233
|
+
name: 'deep-sea',
|
|
234
|
+
displayName: 'Deep Sea',
|
|
235
|
+
colors: {
|
|
236
|
+
white: '#b0e0e6',
|
|
237
|
+
black: '#000080',
|
|
238
|
+
primary: '#008b8b',
|
|
239
|
+
tool: '#00ced1',
|
|
240
|
+
success: '#20b2aa',
|
|
241
|
+
error: '#ff6347',
|
|
242
|
+
secondary: '#4682b4',
|
|
243
|
+
info: '#40e0d0',
|
|
244
|
+
warning: '#ffa500',
|
|
245
|
+
diffAdded: '#1e3a3a',
|
|
246
|
+
diffRemoved: '#3a1e1e',
|
|
247
|
+
diffAddedText: '#20b2aa',
|
|
248
|
+
diffRemovedText: '#ff6347',
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
'volcanic-ash': {
|
|
252
|
+
name: 'volcanic-ash',
|
|
253
|
+
displayName: 'Volcanic Ash',
|
|
254
|
+
colors: {
|
|
255
|
+
white: '#dcdcdc',
|
|
256
|
+
black: '#2f2f2f',
|
|
257
|
+
primary: '#dc143c',
|
|
258
|
+
tool: '#ff4500',
|
|
259
|
+
success: '#32cd32',
|
|
260
|
+
error: '#ff0000',
|
|
261
|
+
secondary: '#708090',
|
|
262
|
+
info: '#ffa500',
|
|
263
|
+
warning: '#ffff00',
|
|
264
|
+
diffAdded: '#2d4a1e',
|
|
265
|
+
diffRemoved: '#4a1e1e',
|
|
266
|
+
diffAddedText: '#32cd32',
|
|
267
|
+
diffRemovedText: '#ff0000',
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
'cyberpunk-mint': {
|
|
271
|
+
name: 'cyberpunk-mint',
|
|
272
|
+
displayName: 'Cyberpunk Mint',
|
|
273
|
+
colors: {
|
|
274
|
+
white: '#f0fff0',
|
|
275
|
+
black: '#000000',
|
|
276
|
+
primary: '#00ff7f',
|
|
277
|
+
tool: '#98fb98',
|
|
278
|
+
success: '#32cd32',
|
|
279
|
+
error: '#ff00ff',
|
|
280
|
+
secondary: '#2e8b57',
|
|
281
|
+
info: '#40e0d0',
|
|
282
|
+
warning: '#ffff00',
|
|
283
|
+
diffAdded: '#1a4d1a',
|
|
284
|
+
diffRemoved: '#4d1a4d',
|
|
285
|
+
diffAddedText: '#32cd32',
|
|
286
|
+
diffRemovedText: '#ff00ff',
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
dracula: {
|
|
290
|
+
name: 'dracula',
|
|
291
|
+
displayName: 'Dracula',
|
|
292
|
+
colors: {
|
|
293
|
+
white: '#f8f8f2',
|
|
294
|
+
black: '#282a36',
|
|
295
|
+
primary: '#ff79c6',
|
|
296
|
+
tool: '#8be9fd',
|
|
297
|
+
success: '#50fa7b',
|
|
298
|
+
error: '#ff5555',
|
|
299
|
+
secondary: '#bd93f9',
|
|
300
|
+
info: '#f1fa8c',
|
|
301
|
+
warning: '#ffb86c',
|
|
302
|
+
diffAdded: '#2d4a2d',
|
|
303
|
+
diffRemoved: '#4a2d2d',
|
|
304
|
+
diffAddedText: '#50fa7b',
|
|
305
|
+
diffRemovedText: '#ff5555',
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
export function getThemeColors(themePreset: ThemePreset) {
|
|
311
|
+
return themes[themePreset].colors;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// export const defaultTheme: ThemePreset = 'tokyo-night';
|
|
315
|
+
export const defaultTheme: ThemePreset = 'neon-jungle';
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized constants for the coder codebase.
|
|
3
|
+
* Naming convention: CATEGORY_DESCRIPTOR_UNIT (e.g., TIMEOUT_PROVIDER_MS)
|
|
4
|
+
* MAX/MIN/DEFAULT always as prefix: MAX_CATEGORY_DESCRIPTOR
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// === TIMEOUTS (milliseconds) ===
|
|
8
|
+
export const TIMEOUT_PROVIDER_CONNECTION_MS = 5000;
|
|
9
|
+
export const TIMEOUT_LSP_VERIFICATION_MS = 5000;
|
|
10
|
+
export const TIMEOUT_LSP_SPAWN_VERIFICATION_MS = 2000;
|
|
11
|
+
export const TIMEOUT_OUTPUT_FLUSH_MS = 1000;
|
|
12
|
+
export const TIMEOUT_EXECUTION_MAX_MS = 300_000; // 5 minutes
|
|
13
|
+
export const TIMEOUT_WEB_SEARCH_MS = 10_000;
|
|
14
|
+
export const TIMEOUT_VSCODE_EXTENSION_SKIP_MS = 3000;
|
|
15
|
+
export const TIMEOUT_MESSAGE_PROCESSING_MS = 5 * 60 * 1000; // 5 minutes
|
|
16
|
+
export const TIMEOUT_HTTP_HEADERS_MS = 10_000;
|
|
17
|
+
export const TIMEOUT_HTTP_BODY_MS = 30_000;
|
|
18
|
+
export const TIMEOUT_UPDATE_CHECK_MS = 10_000;
|
|
19
|
+
export const TIMEOUT_SOCKET_DEFAULT_MS = 120_000;
|
|
20
|
+
export const TIMEOUT_LSP_DIAGNOSTICS_MS = 5000;
|
|
21
|
+
|
|
22
|
+
// === PASTE DETECTION ===
|
|
23
|
+
export const PASTE_CHUNK_BASE_WINDOW_MS = 500;
|
|
24
|
+
export const PASTE_CHUNK_MAX_WINDOW_MS = 2000;
|
|
25
|
+
export const PASTE_RAPID_DETECTION_MS = 50;
|
|
26
|
+
export const PASTE_LARGE_CONTENT_THRESHOLD_CHARS = 150;
|
|
27
|
+
|
|
28
|
+
// === CACHE CONFIGURATION ===
|
|
29
|
+
export const CACHE_FILE_TTL_MS = 5000;
|
|
30
|
+
export const CACHE_MODELS_EXPIRATION_MS = 7 * 24 * 60 * 60 * 1000; // 7 days
|
|
31
|
+
export const MAX_FILE_READ_RETRIES = 3;
|
|
32
|
+
|
|
33
|
+
// === LIMITS ===
|
|
34
|
+
export const MAX_CHECKPOINT_FILES = 50;
|
|
35
|
+
export const MAX_FIND_FILES_RESULTS = 100;
|
|
36
|
+
export const MAX_SEARCH_RESULTS = 100;
|
|
37
|
+
export const MAX_PROMPT_HISTORY_SIZE = 100;
|
|
38
|
+
export const MAX_USAGE_SESSIONS = 100;
|
|
39
|
+
export const MAX_DAILY_AGGREGATES = 30;
|
|
40
|
+
export const MAX_WEB_SEARCH_QUERY_LENGTH = 500;
|
|
41
|
+
|
|
42
|
+
// === DEFAULTS ===
|
|
43
|
+
export const DEFAULT_FIND_FILES_RESULTS = 50;
|
|
44
|
+
export const DEFAULT_SEARCH_RESULTS = 30;
|
|
45
|
+
export const DEFAULT_WEB_SEARCH_RESULTS = 10;
|
|
46
|
+
export const DEFAULT_TERMINAL_WIDTH = 120;
|
|
47
|
+
export const DEFAULT_TERMINAL_COLUMNS = 80;
|
|
48
|
+
|
|
49
|
+
// === BUFFER SIZES ===
|
|
50
|
+
export const BUFFER_FIND_FILES_BYTES = 1024 * 1024; // 1 MB
|
|
51
|
+
export const BUFFER_GREP_MULTIPLIER = 3;
|
|
52
|
+
|
|
53
|
+
// === FILE READING ===
|
|
54
|
+
export const FILE_READ_METADATA_THRESHOLD_LINES = 300;
|
|
55
|
+
export const FILE_READ_CHUNKING_HINT_THRESHOLD_LINES = 500;
|
|
56
|
+
export const FILE_READ_CHUNK_SIZE_LINES = 250;
|
|
57
|
+
export const CHARS_PER_TOKEN_ESTIMATE = 4;
|
|
58
|
+
|
|
59
|
+
// === TERMINAL AND UI ===
|
|
60
|
+
export const PATH_LENGTH_NARROW_TERMINAL = 30;
|
|
61
|
+
export const PATH_LENGTH_NORMAL_TERMINAL = 60;
|
|
62
|
+
export const TABLE_COLUMN_MIN_WIDTH = 10;
|
|
63
|
+
export const WEB_SEARCH_DISPLAY_RESULTS = 5;
|
|
64
|
+
|
|
65
|
+
// === TOKEN THRESHOLDS (percentages - useChatHandler) ===
|
|
66
|
+
export const TOKEN_THRESHOLD_WARNING_PERCENT = 80;
|
|
67
|
+
export const TOKEN_THRESHOLD_CRITICAL_PERCENT = 95;
|
|
68
|
+
|
|
69
|
+
// === HEAP USAGE THRESHOLDS (decimal - health-monitor) ===
|
|
70
|
+
export const HEAP_USAGE_WARNING_THRESHOLD = 0.8;
|
|
71
|
+
export const HEAP_USAGE_CRITICAL_THRESHOLD = 0.95;
|
|
72
|
+
|
|
73
|
+
// === OUTPUT TRUNCATION ===
|
|
74
|
+
export const TRUNCATION_OUTPUT_LIMIT = 2000;
|
|
75
|
+
export const TRUNCATION_DESCRIPTION_LENGTH = 100;
|
|
76
|
+
export const TRUNCATION_RESULT_STRING_LENGTH = 4000;
|
|
77
|
+
|
|
78
|
+
// === DELAYS ===
|
|
79
|
+
export const DELAY_COMMAND_COMPLETE_MS = 100;
|
|
80
|
+
|
|
81
|
+
// === FILE SCANNER ===
|
|
82
|
+
export const MAX_FILES_TO_SCAN = 1000;
|
|
83
|
+
export const MAX_DIRECTORY_DEPTH = 10;
|
|
84
|
+
|
|
85
|
+
// === LANGUAGE DETECTOR ===
|
|
86
|
+
export const MIN_LANGUAGE_PERCENTAGE = 5;
|
|
87
|
+
export const MAX_SECONDARY_LANGUAGES = 3;
|
|
88
|
+
|
|
89
|
+
// === USAGE CALCULATOR ===
|
|
90
|
+
export const TOKENS_PER_TOOL_ESTIMATE = 150;
|
|
91
|
+
export const USAGE_SUCCESS_THRESHOLD_PERCENT = 70;
|
|
92
|
+
export const USAGE_ERROR_THRESHOLD_PERCENT = 90;
|
|
93
|
+
|
|
94
|
+
// === FILE AUTOCOMPLETE ===
|
|
95
|
+
export const CACHE_FILE_LIST_TTL_MS = 5000;
|
|
96
|
+
export const BUFFER_FILE_LIST_BYTES = 10 * 1024 * 1024; // 10 MB
|
|
97
|
+
|
|
98
|
+
// === FETCH URL ===
|
|
99
|
+
export const MAX_URL_CONTENT_BYTES = 100_000; // ~100 KB
|
|
100
|
+
|
|
101
|
+
// === HEALTH MONITOR ===
|
|
102
|
+
export const INTERVAL_HEALTH_CHECK_MS = 30_000;
|
|
103
|
+
export const TIMEOUT_HEALTH_CHECK_MS = 5000;
|
|
104
|
+
export const DURATION_AVERAGE_WARNING_MS = 1000;
|
|
105
|
+
export const DURATION_AVERAGE_CRITICAL_MS = 5000;
|
|
106
|
+
export const DURATION_REQUEST_WARNING_MS = 2000;
|
|
107
|
+
export const DURATION_REQUEST_CRITICAL_MS = 10_000;
|
|
108
|
+
export const COOLDOWN_ALERT_MS = 300_000; // 5 minutes
|
|
109
|
+
|
|
110
|
+
// === LOGGING ===
|
|
111
|
+
export const BUFFER_LOG_BYTES = 65_536; // 64 KB
|
|
112
|
+
export const INTERVAL_LOG_FLUSH_MS = 1000;
|
|
113
|
+
export const MAX_LOG_ENTRIES = 10_000;
|
|
114
|
+
export const MAX_COMPLETED_REQUESTS = 1000;
|
|
115
|
+
|
|
116
|
+
// === AI SDK ===
|
|
117
|
+
export const MAX_TOOL_STEPS = 10;
|
|
118
|
+
|
|
119
|
+
// === MCP ===
|
|
120
|
+
export const TIMEOUT_MCP_DEFAULT_MS = 30_000;
|
|
121
|
+
|
|
122
|
+
// === CODEBASE ANALYSIS ===
|
|
123
|
+
export const THRESHOLD_LARGE_CODEBASE_FILES = 500;
|
|
124
|
+
|
|
125
|
+
// === COST SCORING ===
|
|
126
|
+
export const COST_SCORE_FREE = 9;
|
|
127
|
+
export const COST_SCORE_CHEAP = 7;
|
|
128
|
+
export const COST_SCORE_MODERATE = 5;
|
|
129
|
+
export const COST_SCORE_EXPENSIVE = 3;
|
|
130
|
+
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import {getCurrentMode, setCurrentMode} from './mode-context.js';
|
|
3
|
+
|
|
4
|
+
// ============================================================================
|
|
5
|
+
// Tests for Mode Context
|
|
6
|
+
// ============================================================================
|
|
7
|
+
// The mode context is critical for v6 needsApproval logic. These tests ensure
|
|
8
|
+
// that mode state management works correctly across the application.
|
|
9
|
+
|
|
10
|
+
test('getCurrentMode returns default mode (normal)', t => {
|
|
11
|
+
// After module initialization, mode should be 'normal'
|
|
12
|
+
const mode = getCurrentMode();
|
|
13
|
+
t.is(mode, 'normal');
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test('setCurrentMode updates to auto-accept mode', t => {
|
|
17
|
+
setCurrentMode('auto-accept');
|
|
18
|
+
t.is(getCurrentMode(), 'auto-accept');
|
|
19
|
+
|
|
20
|
+
// Reset for other tests
|
|
21
|
+
setCurrentMode('normal');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('setCurrentMode updates to plan mode', t => {
|
|
25
|
+
setCurrentMode('plan');
|
|
26
|
+
t.is(getCurrentMode(), 'plan');
|
|
27
|
+
|
|
28
|
+
// Reset for other tests
|
|
29
|
+
setCurrentMode('normal');
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('setCurrentMode updates to normal mode', t => {
|
|
33
|
+
setCurrentMode('auto-accept');
|
|
34
|
+
t.is(getCurrentMode(), 'auto-accept');
|
|
35
|
+
|
|
36
|
+
setCurrentMode('normal');
|
|
37
|
+
t.is(getCurrentMode(), 'normal');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('mode persists across multiple getCurrentMode calls', t => {
|
|
41
|
+
setCurrentMode('auto-accept');
|
|
42
|
+
t.is(getCurrentMode(), 'auto-accept');
|
|
43
|
+
t.is(getCurrentMode(), 'auto-accept');
|
|
44
|
+
t.is(getCurrentMode(), 'auto-accept');
|
|
45
|
+
|
|
46
|
+
setCurrentMode('normal');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('mode can be switched multiple times', t => {
|
|
50
|
+
setCurrentMode('normal');
|
|
51
|
+
t.is(getCurrentMode(), 'normal');
|
|
52
|
+
|
|
53
|
+
setCurrentMode('auto-accept');
|
|
54
|
+
t.is(getCurrentMode(), 'auto-accept');
|
|
55
|
+
|
|
56
|
+
setCurrentMode('plan');
|
|
57
|
+
t.is(getCurrentMode(), 'plan');
|
|
58
|
+
|
|
59
|
+
setCurrentMode('normal');
|
|
60
|
+
t.is(getCurrentMode(), 'normal');
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('mode changes are immediate', t => {
|
|
64
|
+
const before = getCurrentMode();
|
|
65
|
+
|
|
66
|
+
setCurrentMode('auto-accept');
|
|
67
|
+
const after = getCurrentMode();
|
|
68
|
+
|
|
69
|
+
t.not(before, after);
|
|
70
|
+
t.is(after, 'auto-accept');
|
|
71
|
+
|
|
72
|
+
// Reset
|
|
73
|
+
setCurrentMode('normal');
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// Cleanup: ensure mode is reset after all tests
|
|
77
|
+
test.after(() => {
|
|
78
|
+
setCurrentMode('normal');
|
|
79
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type {DevelopmentMode} from '@/types/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Global development mode state
|
|
5
|
+
* This is used by tool definitions to determine needsApproval dynamically
|
|
6
|
+
* Updated via setCurrentMode() when mode changes in the UI
|
|
7
|
+
*/
|
|
8
|
+
let currentMode: DevelopmentMode = 'auto-accept';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Get the current development mode
|
|
12
|
+
* Used by tool definitions to determine if approval is needed
|
|
13
|
+
*/
|
|
14
|
+
export function getCurrentMode(): DevelopmentMode {
|
|
15
|
+
return currentMode;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Set the current development mode
|
|
20
|
+
* Called by the app when mode changes via Shift+Tab
|
|
21
|
+
*/
|
|
22
|
+
export function setCurrentMode(mode: DevelopmentMode): void {
|
|
23
|
+
currentMode = mode;
|
|
24
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import type {CustomCommand} from '@/types/index';
|
|
3
|
+
import {CustomCommandExecutor} from './executor';
|
|
4
|
+
|
|
5
|
+
const executor = new CustomCommandExecutor();
|
|
6
|
+
|
|
7
|
+
// Helper to create test command objects
|
|
8
|
+
function createTestCommand(overrides?: Partial<CustomCommand>): CustomCommand {
|
|
9
|
+
return {
|
|
10
|
+
name: 'test',
|
|
11
|
+
fullName: 'test',
|
|
12
|
+
namespace: '',
|
|
13
|
+
path: '/test/command.md',
|
|
14
|
+
content: 'Test content',
|
|
15
|
+
metadata: {},
|
|
16
|
+
...overrides,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
test('execute returns prompt with command content', t => {
|
|
21
|
+
const command = createTestCommand({content: 'This is a test command'});
|
|
22
|
+
|
|
23
|
+
const result = executor.execute(command, []);
|
|
24
|
+
t.true(result.includes('This is a test command'));
|
|
25
|
+
t.true(result.includes('/test'));
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('execute substitutes cwd variable', t => {
|
|
29
|
+
const command = createTestCommand({content: 'Working in {{cwd}}'});
|
|
30
|
+
|
|
31
|
+
const result = executor.execute(command, []);
|
|
32
|
+
const expectedCwd = process.cwd();
|
|
33
|
+
t.true(result.includes(expectedCwd));
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('execute substitutes command variable', t => {
|
|
37
|
+
const command = createTestCommand({content: 'Running {{command}}'});
|
|
38
|
+
|
|
39
|
+
const result = executor.execute(command, []);
|
|
40
|
+
t.true(result.includes('/test'));
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('execute substitutes parameter variables', t => {
|
|
44
|
+
const command = createTestCommand({
|
|
45
|
+
content: 'Arg1: {{arg1}}, Arg2: {{arg2}}',
|
|
46
|
+
metadata: {
|
|
47
|
+
parameters: ['arg1', 'arg2'],
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const result = executor.execute(command, ['value1', 'value2']);
|
|
52
|
+
t.true(result.includes('value1'));
|
|
53
|
+
t.true(result.includes('value2'));
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('execute handles missing parameters gracefully', t => {
|
|
57
|
+
const command = createTestCommand({
|
|
58
|
+
content: 'Arg1: {{arg1}}',
|
|
59
|
+
metadata: {
|
|
60
|
+
parameters: ['arg1', 'arg2'],
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const result = executor.execute(command, ['value1']);
|
|
65
|
+
// Should still work, missing arg2 becomes empty string
|
|
66
|
+
t.true(result.includes('value1'));
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('execute includes args variable with all arguments', t => {
|
|
70
|
+
const command = createTestCommand({
|
|
71
|
+
content: 'All args: {{args}}',
|
|
72
|
+
metadata: {
|
|
73
|
+
parameters: ['arg1', 'arg2'],
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const result = executor.execute(command, ['hello', 'world']);
|
|
78
|
+
t.true(result.includes('hello world'));
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test('execute adds note about custom command', t => {
|
|
82
|
+
const command = createTestCommand();
|
|
83
|
+
|
|
84
|
+
const result = executor.execute(command, []);
|
|
85
|
+
t.true(result.includes('Executing custom command'));
|
|
86
|
+
t.true(result.includes('enhance it'));
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test('formatHelp returns command name', t => {
|
|
90
|
+
const command = createTestCommand();
|
|
91
|
+
|
|
92
|
+
const result = executor.formatHelp(command);
|
|
93
|
+
t.true(result.includes('/test'));
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('formatHelp includes parameters', t => {
|
|
97
|
+
const command = createTestCommand({
|
|
98
|
+
metadata: {
|
|
99
|
+
parameters: ['arg1', 'arg2'],
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
const result = executor.formatHelp(command);
|
|
104
|
+
t.true(result.includes('<arg1>'));
|
|
105
|
+
t.true(result.includes('<arg2>'));
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test('formatHelp includes description', t => {
|
|
109
|
+
const command = createTestCommand({
|
|
110
|
+
metadata: {
|
|
111
|
+
description: 'This is a test command',
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const result = executor.formatHelp(command);
|
|
116
|
+
t.true(result.includes('This is a test command'));
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
test('formatHelp includes aliases', t => {
|
|
120
|
+
const command = createTestCommand({
|
|
121
|
+
fullName: 'namespace:test',
|
|
122
|
+
namespace: 'namespace',
|
|
123
|
+
metadata: {
|
|
124
|
+
aliases: ['t', 'testy'],
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const result = executor.formatHelp(command);
|
|
129
|
+
t.true(result.includes('namespace:t'));
|
|
130
|
+
t.true(result.includes('namespace:testy'));
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test('formatHelp includes aliases without namespace', t => {
|
|
134
|
+
const command = createTestCommand({
|
|
135
|
+
metadata: {
|
|
136
|
+
aliases: ['t', 'testy'],
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const result = executor.formatHelp(command);
|
|
141
|
+
t.true(result.includes('t, testy'));
|
|
142
|
+
});
|