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,68 @@
|
|
|
1
|
+
import { type Dispatch } from 'react';
|
|
2
|
+
import type { HistoryItem, HistoryItemWithoutId } from '../types/history.js';
|
|
3
|
+
export declare enum StreamingState {
|
|
4
|
+
Idle = "idle",
|
|
5
|
+
Streaming = "streaming",
|
|
6
|
+
Cancelling = "cancelling"
|
|
7
|
+
}
|
|
8
|
+
export interface ActiveToolCall {
|
|
9
|
+
name: string;
|
|
10
|
+
args?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ChatState {
|
|
13
|
+
history: HistoryItem[];
|
|
14
|
+
pendingContent: string;
|
|
15
|
+
streamingState: StreamingState;
|
|
16
|
+
threadId: string | null;
|
|
17
|
+
sessionTitle: string | null;
|
|
18
|
+
error: string | null;
|
|
19
|
+
activeToolCall: ActiveToolCall | null;
|
|
20
|
+
tokenCount: number;
|
|
21
|
+
/** Incremented on session switch to force Static re-mount */
|
|
22
|
+
sessionVersion: number;
|
|
23
|
+
}
|
|
24
|
+
export type ChatAction = {
|
|
25
|
+
type: 'ADD_ITEM';
|
|
26
|
+
item: HistoryItemWithoutId;
|
|
27
|
+
} | {
|
|
28
|
+
type: 'STREAM_START';
|
|
29
|
+
threadId: string;
|
|
30
|
+
} | {
|
|
31
|
+
type: 'STREAM_TOKEN';
|
|
32
|
+
content: string;
|
|
33
|
+
} | {
|
|
34
|
+
type: 'STREAM_DONE';
|
|
35
|
+
} | {
|
|
36
|
+
type: 'STREAM_ERROR';
|
|
37
|
+
error: string;
|
|
38
|
+
} | {
|
|
39
|
+
type: 'SET_SESSION_TITLE';
|
|
40
|
+
title: string;
|
|
41
|
+
} | {
|
|
42
|
+
type: 'CLEAR_HISTORY';
|
|
43
|
+
} | {
|
|
44
|
+
type: 'LOAD_HISTORY';
|
|
45
|
+
items: HistoryItem[];
|
|
46
|
+
} | {
|
|
47
|
+
type: 'SET_THREAD_ID';
|
|
48
|
+
threadId: string | null;
|
|
49
|
+
} | {
|
|
50
|
+
type: 'CANCEL_STREAM';
|
|
51
|
+
} | {
|
|
52
|
+
type: 'TOOL_CALL_START';
|
|
53
|
+
name: string;
|
|
54
|
+
args?: string;
|
|
55
|
+
} | {
|
|
56
|
+
type: 'TOOL_CALL_DONE';
|
|
57
|
+
} | {
|
|
58
|
+
type: 'SWITCH_SESSION';
|
|
59
|
+
threadId: string;
|
|
60
|
+
title: string | null;
|
|
61
|
+
items: HistoryItem[];
|
|
62
|
+
};
|
|
63
|
+
export declare const ChatStateContext: import("react").Context<ChatState | null>;
|
|
64
|
+
export declare const ChatDispatchContext: import("react").Context<Dispatch<ChatAction> | null>;
|
|
65
|
+
export declare function useChatState(): ChatState;
|
|
66
|
+
export declare function useChatDispatch(): Dispatch<ChatAction>;
|
|
67
|
+
export declare function useChatReducer(): [ChatState, import("react").ActionDispatch<[action: ChatAction]>];
|
|
68
|
+
//# sourceMappingURL=ChatContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/ChatContext.tsx"],"names":[],"mappings":"AAAA,OAA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AAE,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAClD;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,GACzB;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GACxD;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAC1B;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,EAAE,WAAW,EAAE,CAAA;CAAE,CAAC;AA2I7F,eAAO,MAAM,gBAAgB,2CAAwC,CAAC;AACtE,eAAO,MAAM,mBAAmB,sDAE/B,CAAC;AAEF,wBAAgB,YAAY,IAAI,SAAS,CAKxC;AAED,wBAAgB,eAAe,IAAI,QAAQ,CAAC,UAAU,CAAC,CAKtD;AAID,wBAAgB,cAAc,sEAE7B"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { createContext, useContext, useReducer } from 'react';
|
|
2
|
+
import { nextHistoryId } from '../types/history.js';
|
|
3
|
+
// === State ===
|
|
4
|
+
export var StreamingState;
|
|
5
|
+
(function (StreamingState) {
|
|
6
|
+
StreamingState["Idle"] = "idle";
|
|
7
|
+
StreamingState["Streaming"] = "streaming";
|
|
8
|
+
StreamingState["Cancelling"] = "cancelling";
|
|
9
|
+
})(StreamingState || (StreamingState = {}));
|
|
10
|
+
const initialChatState = {
|
|
11
|
+
history: [],
|
|
12
|
+
pendingContent: '',
|
|
13
|
+
streamingState: StreamingState.Idle,
|
|
14
|
+
threadId: null,
|
|
15
|
+
sessionTitle: null,
|
|
16
|
+
error: null,
|
|
17
|
+
activeToolCall: null,
|
|
18
|
+
tokenCount: 0,
|
|
19
|
+
sessionVersion: 0,
|
|
20
|
+
};
|
|
21
|
+
// === Reducer ===
|
|
22
|
+
function chatReducer(state, action) {
|
|
23
|
+
switch (action.type) {
|
|
24
|
+
case 'ADD_ITEM': {
|
|
25
|
+
const addedTokens = 'text' in action.item
|
|
26
|
+
? Math.ceil(action.item.text.length / 4)
|
|
27
|
+
: 0;
|
|
28
|
+
return {
|
|
29
|
+
...state,
|
|
30
|
+
history: [
|
|
31
|
+
...state.history,
|
|
32
|
+
{ ...action.item, id: nextHistoryId() },
|
|
33
|
+
],
|
|
34
|
+
tokenCount: state.tokenCount + addedTokens,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
case 'STREAM_START':
|
|
38
|
+
return {
|
|
39
|
+
...state,
|
|
40
|
+
streamingState: StreamingState.Streaming,
|
|
41
|
+
threadId: action.threadId,
|
|
42
|
+
pendingContent: '',
|
|
43
|
+
error: null,
|
|
44
|
+
activeToolCall: null,
|
|
45
|
+
};
|
|
46
|
+
case 'STREAM_TOKEN':
|
|
47
|
+
return {
|
|
48
|
+
...state,
|
|
49
|
+
pendingContent: state.pendingContent + action.content,
|
|
50
|
+
};
|
|
51
|
+
case 'STREAM_DONE': {
|
|
52
|
+
const newHistory = [...state.history];
|
|
53
|
+
if (state.pendingContent.trim()) {
|
|
54
|
+
newHistory.push({
|
|
55
|
+
id: nextHistoryId(),
|
|
56
|
+
type: 'assistant',
|
|
57
|
+
text: state.pendingContent,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
...state,
|
|
62
|
+
streamingState: StreamingState.Idle,
|
|
63
|
+
history: newHistory,
|
|
64
|
+
pendingContent: '',
|
|
65
|
+
activeToolCall: null,
|
|
66
|
+
tokenCount: state.tokenCount + Math.ceil(state.pendingContent.length / 4),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
case 'STREAM_ERROR':
|
|
70
|
+
return {
|
|
71
|
+
...state,
|
|
72
|
+
streamingState: StreamingState.Idle,
|
|
73
|
+
history: [
|
|
74
|
+
...state.history,
|
|
75
|
+
{ id: nextHistoryId(), type: 'error', text: action.error },
|
|
76
|
+
],
|
|
77
|
+
pendingContent: '',
|
|
78
|
+
error: action.error,
|
|
79
|
+
activeToolCall: null,
|
|
80
|
+
};
|
|
81
|
+
case 'SET_SESSION_TITLE':
|
|
82
|
+
return {
|
|
83
|
+
...state,
|
|
84
|
+
sessionTitle: action.title,
|
|
85
|
+
};
|
|
86
|
+
case 'CLEAR_HISTORY':
|
|
87
|
+
return {
|
|
88
|
+
...state,
|
|
89
|
+
history: [],
|
|
90
|
+
pendingContent: '',
|
|
91
|
+
threadId: null,
|
|
92
|
+
sessionTitle: null,
|
|
93
|
+
error: null,
|
|
94
|
+
activeToolCall: null,
|
|
95
|
+
tokenCount: 0,
|
|
96
|
+
sessionVersion: state.sessionVersion + 1,
|
|
97
|
+
};
|
|
98
|
+
case 'LOAD_HISTORY':
|
|
99
|
+
return {
|
|
100
|
+
...state,
|
|
101
|
+
history: action.items,
|
|
102
|
+
};
|
|
103
|
+
case 'SET_THREAD_ID':
|
|
104
|
+
return {
|
|
105
|
+
...state,
|
|
106
|
+
threadId: action.threadId,
|
|
107
|
+
};
|
|
108
|
+
case 'CANCEL_STREAM':
|
|
109
|
+
return {
|
|
110
|
+
...state,
|
|
111
|
+
streamingState: StreamingState.Cancelling,
|
|
112
|
+
};
|
|
113
|
+
case 'TOOL_CALL_START':
|
|
114
|
+
return {
|
|
115
|
+
...state,
|
|
116
|
+
activeToolCall: { name: action.name, args: action.args },
|
|
117
|
+
};
|
|
118
|
+
case 'TOOL_CALL_DONE':
|
|
119
|
+
return {
|
|
120
|
+
...state,
|
|
121
|
+
activeToolCall: null,
|
|
122
|
+
};
|
|
123
|
+
case 'SWITCH_SESSION':
|
|
124
|
+
return {
|
|
125
|
+
...state,
|
|
126
|
+
history: action.items,
|
|
127
|
+
threadId: action.threadId,
|
|
128
|
+
sessionTitle: action.title,
|
|
129
|
+
pendingContent: '',
|
|
130
|
+
error: null,
|
|
131
|
+
activeToolCall: null,
|
|
132
|
+
tokenCount: 0,
|
|
133
|
+
sessionVersion: state.sessionVersion + 1,
|
|
134
|
+
};
|
|
135
|
+
default:
|
|
136
|
+
return state;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// === Contexts (read/write split) ===
|
|
140
|
+
export const ChatStateContext = createContext(null);
|
|
141
|
+
export const ChatDispatchContext = createContext(null);
|
|
142
|
+
export function useChatState() {
|
|
143
|
+
const ctx = useContext(ChatStateContext);
|
|
144
|
+
if (!ctx)
|
|
145
|
+
throw new Error('useChatState must be used within ChatStateContext');
|
|
146
|
+
return ctx;
|
|
147
|
+
}
|
|
148
|
+
export function useChatDispatch() {
|
|
149
|
+
const ctx = useContext(ChatDispatchContext);
|
|
150
|
+
if (!ctx)
|
|
151
|
+
throw new Error('useChatDispatch must be used within ChatDispatchContext');
|
|
152
|
+
return ctx;
|
|
153
|
+
}
|
|
154
|
+
// === Hook for provider ===
|
|
155
|
+
export function useChatReducer() {
|
|
156
|
+
return useReducer(chatReducer, initialChatState);
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=ChatContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatContext.js","sourceRoot":"","sources":["../../../src/contexts/ChatContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAiB,MAAM,OAAO,CAAC;AAE7E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,gBAAgB;AAEhB,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,+BAAa,CAAA;IACb,yCAAuB,CAAA;IACvB,2CAAyB,CAAA;AAC3B,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB;AAoBD,MAAM,gBAAgB,GAAc;IAClC,OAAO,EAAE,EAAE;IACX,cAAc,EAAE,EAAE;IAClB,cAAc,EAAE,cAAc,CAAC,IAAI;IACnC,QAAQ,EAAE,IAAI;IACd,YAAY,EAAE,IAAI;IA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N,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,OAAO,GAAG,CAAC;AACb,CAAC;AAED,4BAA4B;AAE5B,MAAM,UAAU,cAAc;IAC5B,OAAO,UAAU,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KeypressContext — raw stdin keypress parser and event system.
|
|
3
|
+
*
|
|
4
|
+
* Bypasses Ink's useInput entirely and parses raw stdin data using a generator
|
|
5
|
+
* (emitKeys), identical to the approach in the CLI reference implementation.
|
|
6
|
+
*
|
|
7
|
+
* Data flow:
|
|
8
|
+
* stdin.on('data')
|
|
9
|
+
* → createDataListener (buffers chars, drives emitKeys generator)
|
|
10
|
+
* → emitKeys* (ANSI escape sequence parser → Key objects)
|
|
11
|
+
* → bufferPaste (bracketed paste → single 'paste' event)
|
|
12
|
+
* → bufferBackslashEnter (backslash+return → shift+return)
|
|
13
|
+
* → [optional] bufferFastReturn (quick returns → newline in non-Kitty mode)
|
|
14
|
+
* → nonKeyboardEventFilter (drop mouse / focus events)
|
|
15
|
+
* → broadcast (priority-ordered handlers)
|
|
16
|
+
*/
|
|
17
|
+
import type React from 'react';
|
|
18
|
+
export declare const BACKSLASH_ENTER_TIMEOUT = 5;
|
|
19
|
+
export declare const ESC_TIMEOUT = 50;
|
|
20
|
+
export declare const PASTE_TIMEOUT = 30000;
|
|
21
|
+
export declare const FAST_RETURN_TIMEOUT = 30;
|
|
22
|
+
export declare enum KeypressPriority {
|
|
23
|
+
Low = -100,
|
|
24
|
+
Normal = 0,
|
|
25
|
+
High = 100,
|
|
26
|
+
Critical = 200
|
|
27
|
+
}
|
|
28
|
+
export interface Key {
|
|
29
|
+
name: string;
|
|
30
|
+
shift: boolean;
|
|
31
|
+
alt: boolean;
|
|
32
|
+
ctrl: boolean;
|
|
33
|
+
cmd: boolean;
|
|
34
|
+
insertable: boolean;
|
|
35
|
+
sequence: string;
|
|
36
|
+
}
|
|
37
|
+
export type KeypressHandler = (key: Key) => boolean | void;
|
|
38
|
+
interface KeypressContextValue {
|
|
39
|
+
subscribe: (handler: KeypressHandler, priority?: KeypressPriority | boolean) => void;
|
|
40
|
+
unsubscribe: (handler: KeypressHandler) => void;
|
|
41
|
+
}
|
|
42
|
+
export declare function useKeypressContext(): KeypressContextValue;
|
|
43
|
+
export declare function KeypressProvider({ children }: {
|
|
44
|
+
children: React.ReactNode;
|
|
45
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=KeypressContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeypressContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/KeypressContext.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,aAAa,QAAS,CAAC;AACpC,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAItC,oBAAY,gBAAgB;IAC1B,GAAG,OAAO;IACV,MAAM,IAAI;IACV,IAAI,MAAM;IACV,QAAQ,MAAM;CACf;AAID,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,GAAG,IAAI,CAAC;AAopB3D,UAAU,oBAAoB;IAC5B,SAAS,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,gBAAgB,GAAG,OAAO,KAAK,IAAI,CAAC;IACrF,WAAW,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;CACjD;AAID,wBAAgB,kBAAkB,yBAMjC;AAID,wBAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CA6H3E"}
|