mistagent 0.1.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/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/src/api/auth.d.ts +7 -0
- package/dist/src/api/auth.d.ts.map +1 -0
- package/dist/src/api/auth.js +16 -0
- package/dist/src/api/auth.js.map +1 -0
- package/dist/src/api/chat.d.ts +8 -0
- package/dist/src/api/chat.d.ts.map +1 -0
- package/dist/src/api/chat.js +14 -0
- package/dist/src/api/chat.js.map +1 -0
- package/dist/src/api/client.d.ts +22 -0
- package/dist/src/api/client.d.ts.map +1 -0
- package/dist/src/api/client.js +140 -0
- package/dist/src/api/client.js.map +1 -0
- package/dist/src/api/commands.d.ts +8 -0
- package/dist/src/api/commands.d.ts.map +1 -0
- package/dist/src/api/commands.js +13 -0
- package/dist/src/api/commands.js.map +1 -0
- package/dist/src/api/models.d.ts +9 -0
- package/dist/src/api/models.d.ts.map +1 -0
- package/dist/src/api/models.js +13 -0
- package/dist/src/api/models.js.map +1 -0
- package/dist/src/api/sessions.d.ts +25 -0
- package/dist/src/api/sessions.d.ts.map +1 -0
- package/dist/src/api/sessions.js +26 -0
- package/dist/src/api/sessions.js.map +1 -0
- package/dist/src/api/tools.d.ts +7 -0
- package/dist/src/api/tools.d.ts.map +1 -0
- package/dist/src/api/tools.js +8 -0
- package/dist/src/api/tools.js.map +1 -0
- package/dist/src/components/App.d.ts +22 -0
- package/dist/src/components/App.d.ts.map +1 -0
- package/dist/src/components/App.js +61 -0
- package/dist/src/components/App.js.map +1 -0
- package/dist/src/components/AppLayout.d.ts +8 -0
- package/dist/src/components/AppLayout.d.ts.map +1 -0
- package/dist/src/components/AppLayout.js +18 -0
- package/dist/src/components/AppLayout.js.map +1 -0
- package/dist/src/components/Composer.d.ts +8 -0
- package/dist/src/components/Composer.d.ts.map +1 -0
- package/dist/src/components/Composer.js +294 -0
- package/dist/src/components/Composer.js.map +1 -0
- package/dist/src/components/Footer.d.ts +10 -0
- package/dist/src/components/Footer.d.ts.map +1 -0
- package/dist/src/components/Footer.js +34 -0
- package/dist/src/components/Footer.js.map +1 -0
- package/dist/src/components/Header.d.ts +3 -0
- package/dist/src/components/Header.d.ts.map +1 -0
- package/dist/src/components/Header.js +99 -0
- package/dist/src/components/Header.js.map +1 -0
- package/dist/src/components/HistoryItemDisplay.d.ts +8 -0
- package/dist/src/components/HistoryItemDisplay.d.ts.map +1 -0
- package/dist/src/components/HistoryItemDisplay.js +32 -0
- package/dist/src/components/HistoryItemDisplay.js.map +1 -0
- package/dist/src/components/InputPrompt.d.ts +11 -0
- package/dist/src/components/InputPrompt.d.ts.map +1 -0
- package/dist/src/components/InputPrompt.js +12 -0
- package/dist/src/components/InputPrompt.js.map +1 -0
- package/dist/src/components/LoadingIndicator.d.ts +8 -0
- package/dist/src/components/LoadingIndicator.d.ts.map +1 -0
- package/dist/src/components/LoadingIndicator.js +17 -0
- package/dist/src/components/LoadingIndicator.js.map +1 -0
- package/dist/src/components/LoginPrompt.d.ts +8 -0
- package/dist/src/components/LoginPrompt.d.ts.map +1 -0
- package/dist/src/components/LoginPrompt.js +76 -0
- package/dist/src/components/LoginPrompt.js.map +1 -0
- package/dist/src/components/MainContent.d.ts +3 -0
- package/dist/src/components/MainContent.d.ts.map +1 -0
- package/dist/src/components/MainContent.js +22 -0
- package/dist/src/components/MainContent.js.map +1 -0
- package/dist/src/components/ModelPicker.d.ts +3 -0
- package/dist/src/components/ModelPicker.d.ts.map +1 -0
- package/dist/src/components/ModelPicker.js +119 -0
- package/dist/src/components/ModelPicker.js.map +1 -0
- package/dist/src/components/MultiLineInput.d.ts +19 -0
- package/dist/src/components/MultiLineInput.d.ts.map +1 -0
- package/dist/src/components/MultiLineInput.js +108 -0
- package/dist/src/components/MultiLineInput.js.map +1 -0
- package/dist/src/components/SessionPicker.d.ts +3 -0
- package/dist/src/components/SessionPicker.d.ts.map +1 -0
- package/dist/src/components/SessionPicker.js +131 -0
- package/dist/src/components/SessionPicker.js.map +1 -0
- package/dist/src/components/SuggestionsDisplay.d.ts +16 -0
- package/dist/src/components/SuggestionsDisplay.d.ts.map +1 -0
- package/dist/src/components/SuggestionsDisplay.js +34 -0
- package/dist/src/components/SuggestionsDisplay.js.map +1 -0
- package/dist/src/components/messages/AssistantMessage.d.ts +8 -0
- package/dist/src/components/messages/AssistantMessage.d.ts.map +1 -0
- package/dist/src/components/messages/AssistantMessage.js +9 -0
- package/dist/src/components/messages/AssistantMessage.js.map +1 -0
- package/dist/src/components/messages/CommandResult.d.ts +8 -0
- package/dist/src/components/messages/CommandResult.d.ts.map +1 -0
- package/dist/src/components/messages/CommandResult.js +7 -0
- package/dist/src/components/messages/CommandResult.js.map +1 -0
- package/dist/src/components/messages/ErrorMessage.d.ts +7 -0
- package/dist/src/components/messages/ErrorMessage.d.ts.map +1 -0
- package/dist/src/components/messages/ErrorMessage.js +7 -0
- package/dist/src/components/messages/ErrorMessage.js.map +1 -0
- package/dist/src/components/messages/InfoMessage.d.ts +9 -0
- package/dist/src/components/messages/InfoMessage.d.ts.map +1 -0
- package/dist/src/components/messages/InfoMessage.js +8 -0
- package/dist/src/components/messages/InfoMessage.js.map +1 -0
- package/dist/src/components/messages/ModelMessage.d.ts +8 -0
- package/dist/src/components/messages/ModelMessage.d.ts.map +1 -0
- package/dist/src/components/messages/ModelMessage.js +7 -0
- package/dist/src/components/messages/ModelMessage.js.map +1 -0
- package/dist/src/components/messages/SessionMessage.d.ts +8 -0
- package/dist/src/components/messages/SessionMessage.d.ts.map +1 -0
- package/dist/src/components/messages/SessionMessage.js +12 -0
- package/dist/src/components/messages/SessionMessage.js.map +1 -0
- package/dist/src/components/messages/ToolCallMessage.d.ts +9 -0
- package/dist/src/components/messages/ToolCallMessage.d.ts.map +1 -0
- package/dist/src/components/messages/ToolCallMessage.js +14 -0
- package/dist/src/components/messages/ToolCallMessage.js.map +1 -0
- package/dist/src/components/messages/UserMessage.d.ts +7 -0
- package/dist/src/components/messages/UserMessage.d.ts.map +1 -0
- package/dist/src/components/messages/UserMessage.js +9 -0
- package/dist/src/components/messages/UserMessage.js.map +1 -0
- package/dist/src/components/shared/HorizontalLine.d.ts +11 -0
- package/dist/src/components/shared/HorizontalLine.d.ts.map +1 -0
- package/dist/src/components/shared/HorizontalLine.js +10 -0
- package/dist/src/components/shared/HorizontalLine.js.map +1 -0
- package/dist/src/components/shared/MarkdownRenderer.d.ts +7 -0
- package/dist/src/components/shared/MarkdownRenderer.d.ts.map +1 -0
- package/dist/src/components/shared/MarkdownRenderer.js +33 -0
- package/dist/src/components/shared/MarkdownRenderer.js.map +1 -0
- package/dist/src/components/shared/Spinner.d.ts +8 -0
- package/dist/src/components/shared/Spinner.d.ts.map +1 -0
- package/dist/src/components/shared/Spinner.js +7 -0
- package/dist/src/components/shared/Spinner.js.map +1 -0
- package/dist/src/components/shared/TextInput.d.ts +10 -0
- package/dist/src/components/shared/TextInput.d.ts.map +1 -0
- package/dist/src/components/shared/TextInput.js +110 -0
- package/dist/src/components/shared/TextInput.js.map +1 -0
- package/dist/src/contexts/AppContext.d.ts +21 -0
- package/dist/src/contexts/AppContext.d.ts.map +1 -0
- package/dist/src/contexts/AppContext.js +16 -0
- package/dist/src/contexts/AppContext.js.map +1 -0
- package/dist/src/contexts/ChatContext.d.ts +68 -0
- package/dist/src/contexts/ChatContext.d.ts.map +1 -0
- package/dist/src/contexts/ChatContext.js +158 -0
- package/dist/src/contexts/ChatContext.js.map +1 -0
- package/dist/src/contexts/KeypressContext.d.ts +47 -0
- package/dist/src/contexts/KeypressContext.d.ts.map +1 -0
- package/dist/src/contexts/KeypressContext.js +792 -0
- package/dist/src/contexts/KeypressContext.js.map +1 -0
- package/dist/src/contexts/ModelContext.d.ts +20 -0
- package/dist/src/contexts/ModelContext.d.ts.map +1 -0
- package/dist/src/contexts/ModelContext.js +42 -0
- package/dist/src/contexts/ModelContext.js.map +1 -0
- package/dist/src/contexts/PasteContext.d.ts +8 -0
- package/dist/src/contexts/PasteContext.d.ts.map +1 -0
- package/dist/src/contexts/PasteContext.js +12 -0
- package/dist/src/contexts/PasteContext.js.map +1 -0
- package/dist/src/contexts/SessionContext.d.ts +19 -0
- package/dist/src/contexts/SessionContext.d.ts.map +1 -0
- package/dist/src/contexts/SessionContext.js +56 -0
- package/dist/src/contexts/SessionContext.js.map +1 -0
- package/dist/src/contexts/UIContext.d.ts +15 -0
- package/dist/src/contexts/UIContext.d.ts.map +1 -0
- package/dist/src/contexts/UIContext.js +16 -0
- package/dist/src/contexts/UIContext.js.map +1 -0
- package/dist/src/hooks/useChat.d.ts +11 -0
- package/dist/src/hooks/useChat.d.ts.map +1 -0
- package/dist/src/hooks/useChat.js +146 -0
- package/dist/src/hooks/useChat.js.map +1 -0
- package/dist/src/hooks/useFileCompletion.d.ts +8 -0
- package/dist/src/hooks/useFileCompletion.d.ts.map +1 -0
- package/dist/src/hooks/useFileCompletion.js +75 -0
- package/dist/src/hooks/useFileCompletion.js.map +1 -0
- package/dist/src/hooks/useInputHistory.d.ts +6 -0
- package/dist/src/hooks/useInputHistory.d.ts.map +1 -0
- package/dist/src/hooks/useInputHistory.js +46 -0
- package/dist/src/hooks/useInputHistory.js.map +1 -0
- package/dist/src/hooks/useKeypress.d.ts +16 -0
- package/dist/src/hooks/useKeypress.d.ts.map +1 -0
- package/dist/src/hooks/useKeypress.js +23 -0
- package/dist/src/hooks/useKeypress.js.map +1 -0
- package/dist/src/hooks/useLoadingIndicator.d.ts +5 -0
- package/dist/src/hooks/useLoadingIndicator.d.ts.map +1 -0
- package/dist/src/hooks/useLoadingIndicator.js +31 -0
- package/dist/src/hooks/useLoadingIndicator.js.map +1 -0
- package/dist/src/hooks/useMultiLineInput.d.ts +37 -0
- package/dist/src/hooks/useMultiLineInput.d.ts.map +1 -0
- package/dist/src/hooks/useMultiLineInput.js +202 -0
- package/dist/src/hooks/useMultiLineInput.js.map +1 -0
- package/dist/src/hooks/usePasteBuffer.d.ts +10 -0
- package/dist/src/hooks/usePasteBuffer.d.ts.map +1 -0
- package/dist/src/hooks/usePasteBuffer.js +90 -0
- package/dist/src/hooks/usePasteBuffer.js.map +1 -0
- package/dist/src/hooks/useSlashCommand.d.ts +6 -0
- package/dist/src/hooks/useSlashCommand.d.ts.map +1 -0
- package/dist/src/hooks/useSlashCommand.js +198 -0
- package/dist/src/hooks/useSlashCommand.js.map +1 -0
- package/dist/src/hooks/useStdinInterceptor.d.ts +2 -0
- package/dist/src/hooks/useStdinInterceptor.d.ts.map +1 -0
- package/dist/src/hooks/useStdinInterceptor.js +85 -0
- package/dist/src/hooks/useStdinInterceptor.js.map +1 -0
- package/dist/src/hooks/useSymbolCompletion.d.ts +10 -0
- package/dist/src/hooks/useSymbolCompletion.d.ts.map +1 -0
- package/dist/src/hooks/useSymbolCompletion.js +65 -0
- package/dist/src/hooks/useSymbolCompletion.js.map +1 -0
- package/dist/src/hooks/useTextBuffer.d.ts +37 -0
- package/dist/src/hooks/useTextBuffer.d.ts.map +1 -0
- package/dist/src/hooks/useTextBuffer.js +627 -0
- package/dist/src/hooks/useTextBuffer.js.map +1 -0
- package/dist/src/main.d.ts +2 -0
- package/dist/src/main.d.ts.map +1 -0
- package/dist/src/main.js +152 -0
- package/dist/src/main.js.map +1 -0
- package/dist/src/tools/code-analyzer/config/ignore-service.d.ts +2 -0
- package/dist/src/tools/code-analyzer/config/ignore-service.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/config/ignore-service.js +209 -0
- package/dist/src/tools/code-analyzer/config/ignore-service.js.map +1 -0
- package/dist/src/tools/code-analyzer/config/supported-languages.d.ts +13 -0
- package/dist/src/tools/code-analyzer/config/supported-languages.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/config/supported-languages.js +17 -0
- package/dist/src/tools/code-analyzer/config/supported-languages.js.map +1 -0
- package/dist/src/tools/code-analyzer/core/graph/graph.d.ts +3 -0
- package/dist/src/tools/code-analyzer/core/graph/graph.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/core/graph/graph.js +67 -0
- package/dist/src/tools/code-analyzer/core/graph/graph.js.map +1 -0
- package/dist/src/tools/code-analyzer/core/graph/types.d.ts +62 -0
- package/dist/src/tools/code-analyzer/core/graph/types.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/core/graph/types.js +2 -0
- package/dist/src/tools/code-analyzer/core/graph/types.js.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/ast-cache.d.ts +12 -0
- package/dist/src/tools/code-analyzer/core/ingestion/ast-cache.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/ast-cache.js +35 -0
- package/dist/src/tools/code-analyzer/core/ingestion/ast-cache.js.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/call-processor.d.ts +16 -0
- package/dist/src/tools/code-analyzer/core/ingestion/call-processor.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/call-processor.js +328 -0
- package/dist/src/tools/code-analyzer/core/ingestion/call-processor.js.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/community-processor.d.ts +40 -0
- package/dist/src/tools/code-analyzer/core/ingestion/community-processor.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/community-processor.js +328 -0
- package/dist/src/tools/code-analyzer/core/ingestion/community-processor.js.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/entry-point-scoring.d.ts +40 -0
- package/dist/src/tools/code-analyzer/core/ingestion/entry-point-scoring.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/entry-point-scoring.js +236 -0
- package/dist/src/tools/code-analyzer/core/ingestion/entry-point-scoring.js.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/filesystem-walker.d.ts +29 -0
- package/dist/src/tools/code-analyzer/core/ingestion/filesystem-walker.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/filesystem-walker.js +81 -0
- package/dist/src/tools/code-analyzer/core/ingestion/filesystem-walker.js.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/framework-detection.d.ts +39 -0
- package/dist/src/tools/code-analyzer/core/ingestion/framework-detection.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/framework-detection.js +184 -0
- package/dist/src/tools/code-analyzer/core/ingestion/framework-detection.js.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/heritage-processor.d.ts +21 -0
- package/dist/src/tools/code-analyzer/core/ingestion/heritage-processor.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/heritage-processor.js +198 -0
- package/dist/src/tools/code-analyzer/core/ingestion/heritage-processor.js.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/import-processor.d.ts +39 -0
- package/dist/src/tools/code-analyzer/core/ingestion/import-processor.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/import-processor.js +791 -0
- package/dist/src/tools/code-analyzer/core/ingestion/import-processor.js.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/parsing-processor.d.ts +16 -0
- package/dist/src/tools/code-analyzer/core/ingestion/parsing-processor.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/parsing-processor.js +296 -0
- package/dist/src/tools/code-analyzer/core/ingestion/parsing-processor.js.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/pipeline.d.ts +3 -0
- package/dist/src/tools/code-analyzer/core/ingestion/pipeline.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/pipeline.js +309 -0
- package/dist/src/tools/code-analyzer/core/ingestion/pipeline.js.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/process-processor.d.ts +52 -0
- package/dist/src/tools/code-analyzer/core/ingestion/process-processor.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/process-processor.js +310 -0
- package/dist/src/tools/code-analyzer/core/ingestion/process-processor.js.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/structure-processor.d.ts +3 -0
- package/dist/src/tools/code-analyzer/core/ingestion/structure-processor.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/structure-processor.js +37 -0
- package/dist/src/tools/code-analyzer/core/ingestion/structure-processor.js.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/symbol-table.d.ts +34 -0
- package/dist/src/tools/code-analyzer/core/ingestion/symbol-table.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/symbol-table.js +39 -0
- package/dist/src/tools/code-analyzer/core/ingestion/symbol-table.js.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/tree-sitter-queries.d.ts +13 -0
- package/dist/src/tools/code-analyzer/core/ingestion/tree-sitter-queries.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/tree-sitter-queries.js +355 -0
- package/dist/src/tools/code-analyzer/core/ingestion/tree-sitter-queries.js.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/utils.d.ts +11 -0
- package/dist/src/tools/code-analyzer/core/ingestion/utils.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/utils.js +48 -0
- package/dist/src/tools/code-analyzer/core/ingestion/utils.js.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/workers/parse-worker.d.ts +59 -0
- package/dist/src/tools/code-analyzer/core/ingestion/workers/parse-worker.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/workers/parse-worker.js +538 -0
- package/dist/src/tools/code-analyzer/core/ingestion/workers/parse-worker.js.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/workers/worker-pool.d.ts +17 -0
- package/dist/src/tools/code-analyzer/core/ingestion/workers/worker-pool.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/core/ingestion/workers/worker-pool.js +121 -0
- package/dist/src/tools/code-analyzer/core/ingestion/workers/worker-pool.js.map +1 -0
- package/dist/src/tools/code-analyzer/core/tree-sitter/parser-loader.d.ts +5 -0
- package/dist/src/tools/code-analyzer/core/tree-sitter/parser-loader.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/core/tree-sitter/parser-loader.js +45 -0
- package/dist/src/tools/code-analyzer/core/tree-sitter/parser-loader.js.map +1 -0
- package/dist/src/tools/code-analyzer/index.d.ts +17 -0
- package/dist/src/tools/code-analyzer/index.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/index.js +15 -0
- package/dist/src/tools/code-analyzer/index.js.map +1 -0
- package/dist/src/tools/code-analyzer/lib/utils.d.ts +2 -0
- package/dist/src/tools/code-analyzer/lib/utils.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/lib/utils.js +4 -0
- package/dist/src/tools/code-analyzer/lib/utils.js.map +1 -0
- package/dist/src/tools/code-analyzer/types/pipeline.d.ts +33 -0
- package/dist/src/tools/code-analyzer/types/pipeline.d.ts.map +1 -0
- package/dist/src/tools/code-analyzer/types/pipeline.js +19 -0
- package/dist/src/tools/code-analyzer/types/pipeline.js.map +1 -0
- package/dist/src/types/api.d.ts +124 -0
- package/dist/src/types/api.d.ts.map +1 -0
- package/dist/src/types/api.js +3 -0
- package/dist/src/types/api.js.map +1 -0
- package/dist/src/types/history.d.ts +49 -0
- package/dist/src/types/history.d.ts.map +1 -0
- package/dist/src/types/history.js +10 -0
- package/dist/src/types/history.js.map +1 -0
- package/dist/src/utils/colors.d.ts +40 -0
- package/dist/src/utils/colors.d.ts.map +1 -0
- package/dist/src/utils/colors.js +48 -0
- package/dist/src/utils/colors.js.map +1 -0
- package/dist/src/utils/config.d.ts +13 -0
- package/dist/src/utils/config.d.ts.map +1 -0
- package/dist/src/utils/config.js +74 -0
- package/dist/src/utils/config.js.map +1 -0
- package/dist/src/utils/constants.d.ts +8 -0
- package/dist/src/utils/constants.d.ts.map +1 -0
- package/dist/src/utils/constants.js +48 -0
- package/dist/src/utils/constants.js.map +1 -0
- package/dist/src/utils/fileRef.d.ts +26 -0
- package/dist/src/utils/fileRef.d.ts.map +1 -0
- package/dist/src/utils/fileRef.js +305 -0
- package/dist/src/utils/fileRef.js.map +1 -0
- package/dist/src/utils/formatters.d.ts +4 -0
- package/dist/src/utils/formatters.d.ts.map +1 -0
- package/dist/src/utils/formatters.js +18 -0
- package/dist/src/utils/formatters.js.map +1 -0
- package/dist/src/utils/pasteTransform.d.ts +37 -0
- package/dist/src/utils/pasteTransform.d.ts.map +1 -0
- package/dist/src/utils/pasteTransform.js +161 -0
- package/dist/src/utils/pasteTransform.js.map +1 -0
- package/dist/src/utils/pasteUtils.d.ts +7 -0
- package/dist/src/utils/pasteUtils.d.ts.map +1 -0
- package/dist/src/utils/pasteUtils.js +33 -0
- package/dist/src/utils/pasteUtils.js.map +1 -0
- package/dist/src/utils/textUtils.d.ts +25 -0
- package/dist/src/utils/textUtils.d.ts.map +1 -0
- package/dist/src/utils/textUtils.js +107 -0
- package/dist/src/utils/textUtils.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/utils/config.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,kBAAkB,iCAAiC,CAAC;AAIjE,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAMpD;AAGD,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAO7C;AAGD,wBAAgB,SAAS,IAAI,MAAM,GAAG,IAAI,CAMzC;AAGD,wBAAgB,UAAU,IAAI,IAAI,CAMjC;AAID,eAAO,MAAM,iBAAiB,eAAe,CAAC;AAE9C,eAAO,MAAM,wBAAwB,eAAe,CAAC;AASrD,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAM7C,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAGtC,eAAO,MAAM,8BAA8B,KAAK,CAAC;AAKjD,eAAO,MAAM,gBAAgB,QAAQ,CAAC;AAEtC,eAAO,MAAM,iBAAiB,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
// ─── 认证与服务器 ─────────────────────────────────────────────
|
|
5
|
+
// 用户凭证存放目录(~/.mistagent/),包含登录 token 等持久化数据
|
|
6
|
+
const CONFIG_DIR = join(homedir(), '.mistagent');
|
|
7
|
+
// 登录 token 文件路径,文件权限 0o600 仅当前用户可读写
|
|
8
|
+
const TOKEN_FILE = join(CONFIG_DIR, 'token');
|
|
9
|
+
// 后端服务器默认地址,可通过 CLI 参数或环境变量 MISTAGENT_SERVER 覆盖
|
|
10
|
+
export const DEFAULT_SERVER_URL = 'https://solidity.slowmist.ai';
|
|
11
|
+
// 获取后端服务器地址,优先级: CLI 参数 > 环境变量 > 默认值
|
|
12
|
+
// 非 localhost 地址强制要求 HTTPS,防止中间人攻击导致 token 泄露
|
|
13
|
+
export function getServerUrl(cliArg) {
|
|
14
|
+
const url = cliArg || process.env['MISTAGENT_SERVER'] || DEFAULT_SERVER_URL;
|
|
15
|
+
if (url.startsWith('http://') && !url.includes('localhost') && !url.includes('127.0.0.1')) {
|
|
16
|
+
process.stderr.write(`⚠ Warning: Using insecure HTTP connection to ${url}\n Tokens may be exposed. Consider using HTTPS.\n`);
|
|
17
|
+
}
|
|
18
|
+
return url;
|
|
19
|
+
}
|
|
20
|
+
// 保存登录 token 到本地文件(跨会话持久化)
|
|
21
|
+
export function saveToken(token) {
|
|
22
|
+
try {
|
|
23
|
+
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
24
|
+
writeFileSync(TOKEN_FILE, token, { mode: 0o600 });
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
// 写入失败时静默处理,token 不会跨会话保留
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// 从本地文件加载已保存的登录 token,不存在则返回 null
|
|
31
|
+
export function loadToken() {
|
|
32
|
+
try {
|
|
33
|
+
return readFileSync(TOKEN_FILE, 'utf-8').trim();
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// 清除已保存的登录 token(/logout 时调用)
|
|
40
|
+
export function clearToken() {
|
|
41
|
+
try {
|
|
42
|
+
writeFileSync(TOKEN_FILE, '', { mode: 0o600 });
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// 写入失败时静默处理
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// ─── 代码分析器(/init 生成的知识图谱) ──────────────────────────
|
|
49
|
+
// 代码分析结果存放目录(项目根目录下的 .mistagent/)
|
|
50
|
+
export const CODE_ANALYZER_DIR = '.mistagent';
|
|
51
|
+
// 知识图谱文件名,包含函数、类、调用关系等结构化数据
|
|
52
|
+
export const CODE_ANALYZER_GRAPH_FILE = 'graph.json';
|
|
53
|
+
// ─── 调用链(@@@ 引用)相关配置 ─────────────────────────────────
|
|
54
|
+
// 调用关系的最低置信度阈值,低于此值的 CALLS 边会被忽略
|
|
55
|
+
// 置信度由代码分析器根据调用解析方式评估:
|
|
56
|
+
// 0.9 = import-resolved(通过 import 语句精确解析)
|
|
57
|
+
// 0.85 = same-file(同文件内直接调用)
|
|
58
|
+
// 0.5 = fuzzy-global(全局唯一匹配)
|
|
59
|
+
// 0.3 = fuzzy-global(全局存在多个同名候选)
|
|
60
|
+
export const CALL_CHAIN_MIN_CONFIDENCE = 0.1;
|
|
61
|
+
// 调用链向外展开的最大层级
|
|
62
|
+
// 1 = 只展示直接调用者和被调用者
|
|
63
|
+
// 2 = 再往外展开一层(调用者的调用者、被调用者的被调用者)
|
|
64
|
+
// 层级越深,注入到 AI 上下文的代码量越大,注意 token 消耗
|
|
65
|
+
export const CALL_CHAIN_MAX_DEPTH = 1;
|
|
66
|
+
// 每一层最多展示的 caller/callee 数量,防止热点函数(如工具函数)产生过多上下文
|
|
67
|
+
export const CALL_CHAIN_MAX_ITEMS_PER_LEVEL = 10;
|
|
68
|
+
// ─── 调试 ────────────────────────────────────────────────────
|
|
69
|
+
// 是否将发送给 AI 的完整 aiText 写入文件(用于调试 @/@@/@@@ 引用注入的内容)
|
|
70
|
+
// 开启后每次发送消息会写入 <CODE_ANALYZER_DIR>/<DEBUG_AITEXT_FILE>
|
|
71
|
+
export const DEBUG_LOG_AITEXT = false;
|
|
72
|
+
// 调试输出文件名(位于 CODE_ANALYZER_DIR 目录下,即 .mistagent/debug-aitext.txt)
|
|
73
|
+
export const DEBUG_AITEXT_FILE = 'debug-aitext.txt';
|
|
74
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,2DAA2D;AAC3D,4CAA4C;AAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAC;AACjD,oCAAoC;AACpC,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAE7C,gDAAgD;AAChD,MAAM,CAAC,MAAM,kBAAkB,GAAG,8BAA8B,CAAC;AAEjE,qCAAqC;AACrC,8CAA8C;AAC9C,MAAM,UAAU,YAAY,CAAC,MAAe;IAC1C,MAAM,GAAG,GAAG,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,IAAI,kBAAkB,CAAC;IAC5E,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QA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AAiD;AACjD,MAAM,CAAC,MAAM,8BAA8B,GAAG,EAAE,CAAC;AAEjD,8DAA8D;AAC9D,mDAAmD;AACnD,uDAAuD;AACvD,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC;AACtC,kEAAkE;AAClE,MAAM,CAAC,MAAM,iBAAiB,GAAG,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const VERSION = "0.1.0";
|
|
2
|
+
export declare const BANNER_LINES: string[];
|
|
3
|
+
export declare const BANNER_GRADIENT: string[];
|
|
4
|
+
export declare const MASCOT_LINES: string[];
|
|
5
|
+
export declare const SPINNER_COLORS: string[];
|
|
6
|
+
export declare const LOADING_PHRASES: string[];
|
|
7
|
+
export declare const PHRASE_INTERVAL_MS = 4000;
|
|
8
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,eAAO,MAAM,YAAY,UAOxB,CAAC;AAGF,eAAO,MAAM,eAAe,UAO3B,CAAC;AAGF,eAAO,MAAM,YAAY,UAOxB,CAAC;AAGF,eAAO,MAAM,cAAc,UAM1B,CAAC;AAEF,eAAO,MAAM,eAAe,UAS3B,CAAC;AAEF,eAAO,MAAM,kBAAkB,OAAO,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export const VERSION = '0.1.0';
|
|
2
|
+
// Banner as line array for per-line gradient coloring
|
|
3
|
+
export const BANNER_LINES = [
|
|
4
|
+
' ███╗ ███╗██╗███████╗████████╗',
|
|
5
|
+
' ████╗ ████║██║██╔════╝╚══██╔══╝',
|
|
6
|
+
' ██╔████╔██║██║███████╗ ██║ ',
|
|
7
|
+
' ██║╚██╔╝██║██║╚════██║ ██║ ',
|
|
8
|
+
' ██║ ╚═╝ ██║██║███████║ ██║ ',
|
|
9
|
+
' ╚═╝ ╚═╝╚═╝╚══════╝ ╚═╝ ',
|
|
10
|
+
];
|
|
11
|
+
// Per-line gradient: warm amber tones (light → dark)
|
|
12
|
+
export const BANNER_GRADIENT = [
|
|
13
|
+
'#F59E0B', // Amber-500
|
|
14
|
+
'#D97706', // Amber-600
|
|
15
|
+
'#B45309', // Amber-700
|
|
16
|
+
'#92400E', // Amber-800
|
|
17
|
+
'#78350F', // Amber-900
|
|
18
|
+
'#451A03', // Amber-950
|
|
19
|
+
];
|
|
20
|
+
// Mascot ASCII art lines (pixel robot character)
|
|
21
|
+
export const MASCOT_LINES = [
|
|
22
|
+
' ✻ ✻ ',
|
|
23
|
+
' ╲ ╱ ',
|
|
24
|
+
' ▐▙▖ ▗▟▌ ',
|
|
25
|
+
' ▐▝█ ▗█▘▌ ',
|
|
26
|
+
' ▐ ▜▛ ▌ ',
|
|
27
|
+
' ▝▘ ▝▘ ',
|
|
28
|
+
];
|
|
29
|
+
// Spinner color cycle (500ms per step) — warm tones
|
|
30
|
+
export const SPINNER_COLORS = [
|
|
31
|
+
'#D97706', // amber-600
|
|
32
|
+
'#B45309', // amber-700
|
|
33
|
+
'#0284C7', // sky-600
|
|
34
|
+
'#B45309', // amber-700
|
|
35
|
+
'#D97706', // amber-600
|
|
36
|
+
];
|
|
37
|
+
export const LOADING_PHRASES = [
|
|
38
|
+
'Thinking...',
|
|
39
|
+
'Analyzing...',
|
|
40
|
+
'Generating...',
|
|
41
|
+
'Processing...',
|
|
42
|
+
'Reasoning...',
|
|
43
|
+
'Working...',
|
|
44
|
+
'Computing...',
|
|
45
|
+
'Synthesizing...',
|
|
46
|
+
];
|
|
47
|
+
export const PHRASE_INTERVAL_MS = 4000;
|
|
48
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,sDAAsD;AACtD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,kCAAkC;IAClC,kCAAkC;IAClC,kCAAkC;IAClC,kCAAkC;IAClC,kCAAkC;IAClC,kCAAkC;CACnC,CAAC;AAEF,qDAAqD;AACrD,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,SAAS,EAAE,YAAY;IACvB,SAAS,EAAE,YAAY;IACvB,SAAS,EAAE,YAAY;IACvB,SAAS,EAAE,YAAY;IACvB,SAAS,EAAE,YAAY;IACvB,SAAS,EAAE,YAAY;CACxB,CAAC;AAEF,iDAAiD;AACjD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,kBAAkB;IAClB,mBAAmB;IACnB,mBAAmB;IACnB,mBAAmB;IACnB,mBAAmB;IACnB,mBAAmB;CACpB,CAAC;AAEF,oDAAoD;AACpD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,SAAS,EAAE,YAAY;IACvB,SAAS,EAAE,YAAY;IACvB,SAAS,EAAE,UAAU;IACrB,SAAS,EAAE,YAAY;IACvB,SAAS,EAAE,YAAY;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,aAAa;IACb,cAAc;IACd,eAAe;IACf,eAAe;IACf,cAAc;IACd,YAAY;IACZ,cAAc;IACd,iBAAiB;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface FileReference {
|
|
2
|
+
atPath: string;
|
|
3
|
+
resolvedPath: string;
|
|
4
|
+
relativePath: string;
|
|
5
|
+
isText: boolean;
|
|
6
|
+
content?: string;
|
|
7
|
+
error?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SymbolReference {
|
|
10
|
+
symbolName: string;
|
|
11
|
+
filePath: string;
|
|
12
|
+
startLine: number;
|
|
13
|
+
endLine: number;
|
|
14
|
+
label: string;
|
|
15
|
+
content?: string;
|
|
16
|
+
error?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ProcessedMessage {
|
|
19
|
+
displayText: string;
|
|
20
|
+
aiText: string;
|
|
21
|
+
fileRefs: FileReference[];
|
|
22
|
+
symbolRefs: SymbolReference[];
|
|
23
|
+
}
|
|
24
|
+
export declare function parseFileReferences(input: string): string[];
|
|
25
|
+
export declare function processFileReferences(input: string): ProcessedMessage;
|
|
26
|
+
//# sourceMappingURL=fileRef.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileRef.d.ts","sourceRoot":"","sources":["../../../src/utils/fileRef.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,UAAU,EAAE,eAAe,EAAE,CAAC;CAC/B;AAsBD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAQ3D;AA0LD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,CA2HrE"}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { CALL_CHAIN_MIN_CONFIDENCE, CALL_CHAIN_MAX_DEPTH, CALL_CHAIN_MAX_ITEMS_PER_LEVEL } from './config.js';
|
|
4
|
+
// Matches @@@symbol tokens (call chain, must be checked first)
|
|
5
|
+
const TRIPLE_AT_REF_REGEX = /@@@([^\s,;!?()[\]{}]+)/g;
|
|
6
|
+
// Matches @@symbol tokens (must not match @@@)
|
|
7
|
+
const DOUBLE_AT_REF_REGEX = /(?<!@)@@(?!@)([^\s,;!?()[\]{}]+)/g;
|
|
8
|
+
// Matches @path tokens — must not match @@ or @@@
|
|
9
|
+
const AT_REF_REGEX = /(?<!@)@(?!@)([^\s,;!?()[\]{}]+)/g;
|
|
10
|
+
const BINARY_EXTENSIONS = new Set([
|
|
11
|
+
'.png', '.jpg', '.jpeg', '.gif', '.bmp', '.ico', '.webp', '.svg',
|
|
12
|
+
'.mp3', '.mp4', '.wav', '.avi', '.mov', '.mkv', '.flac', '.ogg',
|
|
13
|
+
'.zip', '.tar', '.gz', '.rar', '.7z', '.bz2', '.xz',
|
|
14
|
+
'.pdf', '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx',
|
|
15
|
+
'.exe', '.dll', '.so', '.dylib', '.bin', '.o', '.a',
|
|
16
|
+
'.woff', '.woff2', '.ttf', '.eot', '.otf',
|
|
17
|
+
'.sqlite', '.db',
|
|
18
|
+
'.pyc', '.class', '.jar', '.war',
|
|
19
|
+
]);
|
|
20
|
+
const MAX_FILE_SIZE = 100 * 1024; // 100KB per file
|
|
21
|
+
export function parseFileReferences(input) {
|
|
22
|
+
const matches = [];
|
|
23
|
+
const regex = new RegExp(AT_REF_REGEX.source, 'g');
|
|
24
|
+
let match;
|
|
25
|
+
while ((match = regex.exec(input)) !== null) {
|
|
26
|
+
matches.push(match[1]);
|
|
27
|
+
}
|
|
28
|
+
return matches;
|
|
29
|
+
}
|
|
30
|
+
function parseTripleAtReferences(input) {
|
|
31
|
+
const matches = [];
|
|
32
|
+
const regex = new RegExp(TRIPLE_AT_REF_REGEX.source, 'g');
|
|
33
|
+
let match;
|
|
34
|
+
while ((match = regex.exec(input)) !== null) {
|
|
35
|
+
matches.push(match[1]);
|
|
36
|
+
}
|
|
37
|
+
return matches;
|
|
38
|
+
}
|
|
39
|
+
function parseSymbolReferences(input) {
|
|
40
|
+
const matches = [];
|
|
41
|
+
const regex = new RegExp(DOUBLE_AT_REF_REGEX.source, 'g');
|
|
42
|
+
let match;
|
|
43
|
+
while ((match = regex.exec(input)) !== null) {
|
|
44
|
+
matches.push(match[1]);
|
|
45
|
+
}
|
|
46
|
+
return matches;
|
|
47
|
+
}
|
|
48
|
+
let cachedGraphData = null;
|
|
49
|
+
let cachedGraphMtime = 0;
|
|
50
|
+
function loadGraph() {
|
|
51
|
+
const cwd = process.cwd();
|
|
52
|
+
const graphPath = path.join(cwd, '.mistagent', 'graph.json');
|
|
53
|
+
if (!fs.existsSync(graphPath))
|
|
54
|
+
return { symbols: [], relationships: [] };
|
|
55
|
+
try {
|
|
56
|
+
const stat = fs.statSync(graphPath);
|
|
57
|
+
if (cachedGraphData && stat.mtimeMs === cachedGraphMtime)
|
|
58
|
+
return cachedGraphData;
|
|
59
|
+
const data = JSON.parse(fs.readFileSync(graphPath, 'utf-8'));
|
|
60
|
+
const labels = new Set(['Function', 'Method', 'Class', 'Interface']);
|
|
61
|
+
const symbols = data.nodes
|
|
62
|
+
.filter(n => labels.has(n.label))
|
|
63
|
+
.map(n => ({
|
|
64
|
+
id: n.id,
|
|
65
|
+
name: n.properties.name,
|
|
66
|
+
filePath: n.properties.filePath,
|
|
67
|
+
startLine: n.properties.startLine,
|
|
68
|
+
endLine: n.properties.endLine,
|
|
69
|
+
label: n.label,
|
|
70
|
+
}));
|
|
71
|
+
const relationships = data.relationships
|
|
72
|
+
.filter(r => r.type === 'CALLS' && r.confidence >= CALL_CHAIN_MIN_CONFIDENCE)
|
|
73
|
+
.map(r => ({
|
|
74
|
+
sourceId: r.sourceId,
|
|
75
|
+
targetId: r.targetId,
|
|
76
|
+
type: r.type,
|
|
77
|
+
confidence: r.confidence,
|
|
78
|
+
}));
|
|
79
|
+
cachedGraphData = { symbols, relationships };
|
|
80
|
+
cachedGraphMtime = stat.mtimeMs;
|
|
81
|
+
return cachedGraphData;
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return { symbols: [], relationships: [] };
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function loadGraphSymbols() {
|
|
88
|
+
return loadGraph().symbols;
|
|
89
|
+
}
|
|
90
|
+
function buildCallChainContext(symbolName) {
|
|
91
|
+
const { symbols, relationships } = loadGraph();
|
|
92
|
+
const target = symbols.find(s => s.name === symbolName);
|
|
93
|
+
if (!target)
|
|
94
|
+
return null;
|
|
95
|
+
const symbolById = new Map(symbols.map(s => [s.id, s]));
|
|
96
|
+
// Build adjacency: callers (who calls id) and callees (what id calls)
|
|
97
|
+
const callersOf = new Map();
|
|
98
|
+
const calleesOf = new Map();
|
|
99
|
+
for (const rel of relationships) {
|
|
100
|
+
if (!callersOf.has(rel.targetId))
|
|
101
|
+
callersOf.set(rel.targetId, []);
|
|
102
|
+
callersOf.get(rel.targetId).push(rel.sourceId);
|
|
103
|
+
if (!calleesOf.has(rel.sourceId))
|
|
104
|
+
calleesOf.set(rel.sourceId, []);
|
|
105
|
+
calleesOf.get(rel.sourceId).push(rel.targetId);
|
|
106
|
+
}
|
|
107
|
+
const sections = [];
|
|
108
|
+
const visited = new Set();
|
|
109
|
+
// Collect symbols by BFS up to CALL_CHAIN_MAX_DEPTH levels
|
|
110
|
+
function collect(startId, adjacency) {
|
|
111
|
+
const levels = [];
|
|
112
|
+
let frontier = [startId];
|
|
113
|
+
const seen = new Set([startId]);
|
|
114
|
+
for (let depth = 0; depth < CALL_CHAIN_MAX_DEPTH; depth++) {
|
|
115
|
+
const nextIds = [];
|
|
116
|
+
for (const id of frontier) {
|
|
117
|
+
for (const neighborId of adjacency.get(id) ?? []) {
|
|
118
|
+
if (!seen.has(neighborId)) {
|
|
119
|
+
seen.add(neighborId);
|
|
120
|
+
nextIds.push(neighborId);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (nextIds.length === 0)
|
|
125
|
+
break;
|
|
126
|
+
const resolved = nextIds
|
|
127
|
+
.map(id => symbolById.get(id))
|
|
128
|
+
.filter(Boolean);
|
|
129
|
+
levels.push(resolved);
|
|
130
|
+
frontier = nextIds;
|
|
131
|
+
}
|
|
132
|
+
return levels;
|
|
133
|
+
}
|
|
134
|
+
// 1. Callers (multi-level)
|
|
135
|
+
const callerLevels = collect(target.id, callersOf);
|
|
136
|
+
for (let i = 0; i < callerLevels.length; i++) {
|
|
137
|
+
const level = callerLevels[i];
|
|
138
|
+
const depthLabel = CALL_CHAIN_MAX_DEPTH > 1 ? ` (depth ${i + 1})` : '';
|
|
139
|
+
sections.push(`=== Callers of ${symbolName}${depthLabel} (${level.length}) ===`);
|
|
140
|
+
for (const caller of level.slice(0, CALL_CHAIN_MAX_ITEMS_PER_LEVEL)) {
|
|
141
|
+
if (visited.has(caller.id))
|
|
142
|
+
continue;
|
|
143
|
+
visited.add(caller.id);
|
|
144
|
+
const src = extractSourceLines(caller.filePath, caller.startLine, caller.endLine);
|
|
145
|
+
if (src) {
|
|
146
|
+
sections.push(`--- ${caller.label} ${caller.name} (${caller.filePath}:${caller.startLine + 1}-${caller.endLine + 1}) ---\n${src}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// 2. The target function itself
|
|
151
|
+
visited.add(target.id);
|
|
152
|
+
const selfSrc = extractSourceLines(target.filePath, target.startLine, target.endLine);
|
|
153
|
+
if (selfSrc) {
|
|
154
|
+
sections.push(`=== ${target.label} ${symbolName} (${target.filePath}:${target.startLine + 1}-${target.endLine + 1}) ===\n${selfSrc}`);
|
|
155
|
+
}
|
|
156
|
+
// 3. Callees (multi-level)
|
|
157
|
+
const calleeLevels = collect(target.id, calleesOf);
|
|
158
|
+
for (let i = 0; i < calleeLevels.length; i++) {
|
|
159
|
+
const level = calleeLevels[i];
|
|
160
|
+
const depthLabel = CALL_CHAIN_MAX_DEPTH > 1 ? ` (depth ${i + 1})` : '';
|
|
161
|
+
sections.push(`=== Callees of ${symbolName}${depthLabel} (${level.length}) ===`);
|
|
162
|
+
for (const callee of level.slice(0, CALL_CHAIN_MAX_ITEMS_PER_LEVEL)) {
|
|
163
|
+
if (visited.has(callee.id))
|
|
164
|
+
continue;
|
|
165
|
+
visited.add(callee.id);
|
|
166
|
+
const src = extractSourceLines(callee.filePath, callee.startLine, callee.endLine);
|
|
167
|
+
if (src) {
|
|
168
|
+
sections.push(`--- ${callee.label} ${callee.name} (${callee.filePath}:${callee.startLine + 1}-${callee.endLine + 1}) ---\n${src}`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return sections.length > 0 ? sections.join('\n\n') : null;
|
|
173
|
+
}
|
|
174
|
+
function extractSourceLines(filePath, startLine, endLine) {
|
|
175
|
+
const cwd = process.cwd();
|
|
176
|
+
const absPath = path.resolve(cwd, filePath);
|
|
177
|
+
try {
|
|
178
|
+
const content = fs.readFileSync(absPath, 'utf-8');
|
|
179
|
+
const lines = content.split('\n');
|
|
180
|
+
return lines.slice(startLine, endLine + 1).join('\n');
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
export function processFileReferences(input) {
|
|
187
|
+
const cwd = process.cwd();
|
|
188
|
+
const sections = [];
|
|
189
|
+
// --- Handle @@@ call chain references (check first) ---
|
|
190
|
+
const chainNames = parseTripleAtReferences(input);
|
|
191
|
+
for (const symName of [...new Set(chainNames)]) {
|
|
192
|
+
const chain = buildCallChainContext(symName);
|
|
193
|
+
if (chain) {
|
|
194
|
+
sections.push(chain);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
sections.push(`--- @@@${symName} ---\n[Symbol "${symName}" not found or has no call relationships]`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
// --- Handle @@ symbol references ---
|
|
201
|
+
const symbolNames = parseSymbolReferences(input);
|
|
202
|
+
const symbolRefs = [];
|
|
203
|
+
if (symbolNames.length > 0) {
|
|
204
|
+
const graphSymbols = loadGraphSymbols();
|
|
205
|
+
const uniqueSymbols = [...new Set(symbolNames)];
|
|
206
|
+
for (const symName of uniqueSymbols) {
|
|
207
|
+
const match = graphSymbols.find(s => s.name === symName);
|
|
208
|
+
if (!match) {
|
|
209
|
+
symbolRefs.push({
|
|
210
|
+
symbolName: symName,
|
|
211
|
+
filePath: '',
|
|
212
|
+
startLine: 0,
|
|
213
|
+
endLine: 0,
|
|
214
|
+
label: '',
|
|
215
|
+
error: `Symbol "${symName}" not found in graph.json`,
|
|
216
|
+
});
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
const source = extractSourceLines(match.filePath, match.startLine, match.endLine);
|
|
220
|
+
symbolRefs.push({
|
|
221
|
+
symbolName: symName,
|
|
222
|
+
filePath: match.filePath,
|
|
223
|
+
startLine: match.startLine,
|
|
224
|
+
endLine: match.endLine,
|
|
225
|
+
label: match.label,
|
|
226
|
+
content: source ?? undefined,
|
|
227
|
+
error: source === null ? `Could not read ${match.filePath}` : undefined,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
// --- Handle @ file references ---
|
|
232
|
+
const paths = parseFileReferences(input);
|
|
233
|
+
const fileRefs = [];
|
|
234
|
+
for (const relPath of [...new Set(paths)]) {
|
|
235
|
+
const absPath = path.resolve(cwd, relPath);
|
|
236
|
+
const ext = path.extname(relPath).toLowerCase();
|
|
237
|
+
const isText = !BINARY_EXTENSIONS.has(ext);
|
|
238
|
+
const ref = {
|
|
239
|
+
atPath: `@${relPath}`,
|
|
240
|
+
resolvedPath: absPath,
|
|
241
|
+
relativePath: relPath,
|
|
242
|
+
isText,
|
|
243
|
+
};
|
|
244
|
+
try {
|
|
245
|
+
const stat = fs.statSync(absPath);
|
|
246
|
+
if (stat.isDirectory()) {
|
|
247
|
+
const entries = fs.readdirSync(absPath)
|
|
248
|
+
.filter((e) => !e.startsWith('.'))
|
|
249
|
+
.slice(0, 50);
|
|
250
|
+
ref.content = `[Directory: ${entries.join(', ')}]`;
|
|
251
|
+
}
|
|
252
|
+
else if (stat.isFile()) {
|
|
253
|
+
if (!isText) {
|
|
254
|
+
ref.content = `[Binary file: ${relPath} (${formatSize(stat.size)})]`;
|
|
255
|
+
}
|
|
256
|
+
else if (stat.size > MAX_FILE_SIZE) {
|
|
257
|
+
ref.content = `[File too large: ${formatSize(stat.size)}, limit ${formatSize(MAX_FILE_SIZE)}]`;
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
ref.content = fs.readFileSync(absPath, 'utf-8');
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
catch (err) {
|
|
265
|
+
ref.error = err instanceof Error ? err.message : String(err);
|
|
266
|
+
}
|
|
267
|
+
fileRefs.push(ref);
|
|
268
|
+
}
|
|
269
|
+
if (fileRefs.length === 0 && symbolRefs.length === 0 && sections.length === 0) {
|
|
270
|
+
return { displayText: input, aiText: input, fileRefs: [], symbolRefs: [] };
|
|
271
|
+
}
|
|
272
|
+
// --- Build AI message ---
|
|
273
|
+
// Symbol source code sections (@@)
|
|
274
|
+
for (const s of symbolRefs) {
|
|
275
|
+
if (s.error) {
|
|
276
|
+
sections.push(`--- @@${s.symbolName} ---\n[Error: ${s.error}]`);
|
|
277
|
+
}
|
|
278
|
+
else if (s.content) {
|
|
279
|
+
sections.push(`--- ${s.label} ${s.symbolName} (${s.filePath}:${s.startLine + 1}-${s.endLine + 1}) ---\n${s.content}`);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
// File content sections (@)
|
|
283
|
+
for (const r of fileRefs) {
|
|
284
|
+
if (r.error) {
|
|
285
|
+
sections.push(`--- ${r.relativePath} ---\n[Error: ${r.error}]`);
|
|
286
|
+
}
|
|
287
|
+
else if (r.content) {
|
|
288
|
+
sections.push(`--- ${r.relativePath} ---\n${r.content}`);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
let aiText = input;
|
|
292
|
+
if (sections.length > 0) {
|
|
293
|
+
aiText +=
|
|
294
|
+
'\n\n--- Content from referenced files ---\n\n' +
|
|
295
|
+
sections.join('\n\n') +
|
|
296
|
+
'\n\n--- End of referenced content ---';
|
|
297
|
+
}
|
|
298
|
+
return { displayText: input, aiText, fileRefs, symbolRefs };
|
|
299
|
+
}
|
|
300
|
+
function formatSize(bytes) {
|
|
301
|
+
if (bytes < 1024)
|
|
302
|
+
return `${bytes}B`;
|
|
303
|
+
return `${Math.round(bytes / 1024)}KB`;
|
|
304
|
+
}
|
|
305
|
+
//# sourceMappingURL=fileRef.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileRef.js","sourceRoot":"","sources":["../../../src/utils/fileRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AA4B9G,+DAA+D;AAC/D,MAAM,mBAAmB,GAAG,yBAAyB,CAAC;AACtD,+CAA+C;AAC/C,MAAM,mBAAmB,GAAG,mCAAmC,CAAC;AAChE,kDAAkD;AAClD,MAAM,YAAY,GAAG,kCAAkC,CAAC;AAExD,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAChC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAChE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,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C;YACZ,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,YAAY,iBAAiB,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;QAClE,CAAC;aAAM,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;YACrB,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,YAAY,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;IAED,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,MAAM;YACJ,+CAA+C;gBAC/C,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;gBACrB,uCAAuC,CAAC;IAC5C,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;AAC9D,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,IAAI,KAAK,GAAG,IAAI;QAAE,OAAO,GAAG,KAAK,GAAG,CAAC;IACrC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../../src/utils/formatters.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMrD;AAED,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAGpD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAG7D"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function formatElapsed(startMs) {
|
|
2
|
+
const elapsed = Math.floor((Date.now() - startMs) / 1000);
|
|
3
|
+
if (elapsed < 60)
|
|
4
|
+
return `${elapsed}s`;
|
|
5
|
+
const mins = Math.floor(elapsed / 60);
|
|
6
|
+
const secs = elapsed % 60;
|
|
7
|
+
return `${mins}m${secs}s`;
|
|
8
|
+
}
|
|
9
|
+
export function formatDate(isoString) {
|
|
10
|
+
const date = new Date(isoString);
|
|
11
|
+
return date.toLocaleDateString() + ' ' + date.toLocaleTimeString();
|
|
12
|
+
}
|
|
13
|
+
export function truncate(text, maxLen) {
|
|
14
|
+
if (text.length <= maxLen)
|
|
15
|
+
return text;
|
|
16
|
+
return text.slice(0, maxLen - 1) + '…';
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=formatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../../src/utils/formatters.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;IAC1D,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,GAAG,OAAO,GAAG,CAAC;IACvC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,OAAO,GAAG,EAAE,CAAC;IAC1B,OAAO,GAAG,IAAI,IAAI,IAAI,GAAG,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,SAAiB;IAC1C,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC;IACjC,OAAO,IAAI,CAAC,kBAAkB,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,MAAc;IACnD,IAAI,IAAI,CAAC,MAAM,IAAI,MAAM;QAAE,OAAO,IAAI,CAAC;IACvC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Transform, type TransformCallback } from 'node:stream';
|
|
2
|
+
export declare const PASTE_PLACEHOLDER_REGEX: RegExp;
|
|
3
|
+
/**
|
|
4
|
+
* A Transform stream that sits between raw stdin and Ink.
|
|
5
|
+
* It detects bracketed paste sequences, buffers them, and replaces
|
|
6
|
+
* large pastes with short placeholders.
|
|
7
|
+
*
|
|
8
|
+
* The actual pasted content is stored in `pasteStore` for later expansion.
|
|
9
|
+
*/
|
|
10
|
+
export declare class PasteTransform extends Transform {
|
|
11
|
+
private isPasting;
|
|
12
|
+
private pasteAccum;
|
|
13
|
+
pasteStore: Map<string, string>;
|
|
14
|
+
constructor();
|
|
15
|
+
private generatePlaceholder;
|
|
16
|
+
private finishPaste;
|
|
17
|
+
_transform(chunk: string | Buffer, _encoding: string, callback: TransformCallback): void;
|
|
18
|
+
private processChunk;
|
|
19
|
+
/**
|
|
20
|
+
* Expand all placeholders back to real content.
|
|
21
|
+
*/
|
|
22
|
+
expandAll(text: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Clear stored pastes (call after submit).
|
|
25
|
+
*/
|
|
26
|
+
clearPastes(): void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Create a PasteTransform that wraps stdin and mimics ReadStream properties
|
|
30
|
+
* needed by Ink (isTTY, setRawMode, ref, unref, setEncoding, etc.).
|
|
31
|
+
*/
|
|
32
|
+
export declare function createPasteStdin(realStdin: NodeJS.ReadStream): PasteTransform & {
|
|
33
|
+
isTTY: boolean;
|
|
34
|
+
setRawMode: (mode: boolean) => any;
|
|
35
|
+
fd: number;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=pasteTransform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pasteTransform.d.ts","sourceRoot":"","sources":["../../../src/utils/pasteTransform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAUhE,eAAO,MAAM,uBAAuB,QAA+C,CAAC;AAOpF;;;;;;GAMG;AACH,qBAAa,cAAe,SAAQ,SAAS;IAC3C,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,UAAU,CAAM;IACjB,UAAU,sBAA6B;;IAM9C,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,WAAW;IAUnB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAMxF,OAAO,CAAC,YAAY;IA4DpB;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAK/B;;OAEG;IACH,WAAW,IAAI,IAAI;CAGpB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,CAAC,UAAU,GAAG,cAAc,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,GAAG,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAwClJ"}
|