@sunub/obsidian-mcp-server 0.3.19 → 0.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -24
- package/build/cli/App.d.ts +1 -0
- package/build/cli/App.js +273 -0
- package/build/cli/App.js.map +1 -0
- package/build/cli/AppContainer.d.ts +1 -0
- package/build/cli/AppContainer.js +19 -0
- package/build/cli/AppContainer.js.map +1 -0
- package/build/cli/colors.d.ts +15 -0
- package/build/cli/colors.js +15 -0
- package/build/cli/colors.js.map +1 -0
- package/build/cli/commands/types.d.ts +19 -0
- package/build/cli/commands/types.js +11 -0
- package/build/cli/commands/types.js.map +1 -0
- package/build/cli/config/SettingContext.d.ts +1 -0
- package/build/cli/config/SettingContext.js +2 -0
- package/build/cli/config/SettingContext.js.map +1 -0
- package/build/cli/config/mcpServersConfig.d.ts +30 -0
- package/build/cli/config/mcpServersConfig.js +119 -0
- package/build/cli/config/mcpServersConfig.js.map +1 -0
- package/build/cli/config/settingSchema.d.ts +162 -0
- package/build/cli/config/settingSchema.js +110 -0
- package/build/cli/config/settingSchema.js.map +1 -0
- package/build/cli/constants.d.ts +47 -0
- package/build/cli/constants.js +101 -0
- package/build/cli/constants.js.map +1 -0
- package/build/cli/context/InputContext.d.ts +12 -0
- package/build/cli/context/InputContext.js +10 -0
- package/build/cli/context/InputContext.js.map +1 -0
- package/build/cli/context/KeypressContext.d.ts +30 -0
- package/build/cli/context/KeypressContext.js +200 -0
- package/build/cli/context/KeypressContext.js.map +1 -0
- package/build/cli/context/KeypressContext.util.d.ts +7 -0
- package/build/cli/context/KeypressContext.util.js +476 -0
- package/build/cli/context/KeypressContext.util.js.map +1 -0
- package/build/cli/errors/index.d.ts +3 -0
- package/build/cli/errors/index.js +7 -0
- package/build/cli/errors/index.js.map +1 -0
- package/build/cli/hooks/useAtCompletion.d.ts +12 -0
- package/build/cli/hooks/useAtCompletion.js +5 -0
- package/build/cli/hooks/useAtCompletion.js.map +1 -0
- package/build/cli/hooks/useCommandCompletion.d.ts +59 -0
- package/build/cli/hooks/useCommandCompletion.js +344 -0
- package/build/cli/hooks/useCommandCompletion.js.map +1 -0
- package/build/cli/hooks/useCompletion.d.ts +22 -0
- package/build/cli/hooks/useCompletion.js +84 -0
- package/build/cli/hooks/useCompletion.js.map +1 -0
- package/build/cli/hooks/useDispatcher.d.ts +6 -0
- package/build/cli/hooks/useDispatcher.js +286 -0
- package/build/cli/hooks/useDispatcher.js.map +1 -0
- package/build/cli/hooks/useFocus.d.ts +2 -0
- package/build/cli/hooks/useFocus.js +3 -0
- package/build/cli/hooks/useFocus.js.map +1 -0
- package/build/cli/hooks/useHistoryManager.d.ts +32 -0
- package/build/cli/hooks/useHistoryManager.js +78 -0
- package/build/cli/hooks/useHistoryManager.js.map +1 -0
- package/build/cli/hooks/useInputHistory.d.ts +24 -0
- package/build/cli/hooks/useInputHistory.js +159 -0
- package/build/cli/hooks/useInputHistory.js.map +1 -0
- package/build/cli/hooks/useKeyMatchers.d.ts +17 -0
- package/build/cli/hooks/useKeyMatchers.js +18 -0
- package/build/cli/hooks/useKeyMatchers.js.map +1 -0
- package/build/cli/hooks/useKeypress.d.ts +19 -0
- package/build/cli/hooks/useKeypress.js +28 -0
- package/build/cli/hooks/useKeypress.js.map +1 -0
- package/build/cli/hooks/useLlmStream/constants.d.ts +4 -0
- package/build/cli/hooks/useLlmStream/constants.js +5 -0
- package/build/cli/hooks/useLlmStream/constants.js.map +1 -0
- package/build/cli/hooks/useLlmStream/index.d.ts +2 -0
- package/build/cli/hooks/useLlmStream/index.js +2 -0
- package/build/cli/hooks/useLlmStream/index.js.map +1 -0
- package/build/cli/hooks/useLlmStream/llmService.d.ts +2 -0
- package/build/cli/hooks/useLlmStream/llmService.js +111 -0
- package/build/cli/hooks/useLlmStream/llmService.js.map +1 -0
- package/build/cli/hooks/useLlmStream/types.d.ts +38 -0
- package/build/cli/hooks/useLlmStream/types.js.map +1 -0
- package/build/cli/hooks/useLlmStream/useLlmStream.d.ts +12 -0
- package/build/cli/hooks/useLlmStream/useLlmStream.js +176 -0
- package/build/cli/hooks/useLlmStream/useLlmStream.js.map +1 -0
- package/build/cli/hooks/useLlmStream/utils.d.ts +17 -0
- package/build/cli/hooks/useLlmStream/utils.js +142 -0
- package/build/cli/hooks/useLlmStream/utils.js.map +1 -0
- package/build/cli/hooks/useMcpClient.d.ts +10 -0
- package/build/cli/hooks/useMcpClient.js +98 -0
- package/build/cli/hooks/useMcpClient.js.map +1 -0
- package/build/cli/hooks/useMcpManager.d.ts +26 -0
- package/build/cli/hooks/useMcpManager.js +89 -0
- package/build/cli/hooks/useMcpManager.js.map +1 -0
- package/build/cli/hooks/usePromptCompletion.d.ts +19 -0
- package/build/cli/hooks/usePromptCompletion.js +13 -0
- package/build/cli/hooks/usePromptCompletion.js.map +1 -0
- package/build/cli/hooks/useRagContext.d.ts +6 -0
- package/build/cli/hooks/useRagContext.js +84 -0
- package/build/cli/hooks/useRagContext.js.map +1 -0
- package/build/cli/hooks/useShellCompletion.d.ts +18 -0
- package/build/cli/hooks/useShellCompletion.js +10 -0
- package/build/cli/hooks/useShellCompletion.js.map +1 -0
- package/build/cli/hooks/useSlashCompletion.d.ts +21 -0
- package/build/cli/hooks/useSlashCompletion.js +11 -0
- package/build/cli/hooks/useSlashCompletion.js.map +1 -0
- package/build/cli/hooks/useTerminalSize.d.ts +4 -0
- package/build/cli/hooks/useTerminalSize.js +21 -0
- package/build/cli/hooks/useTerminalSize.js.map +1 -0
- package/build/cli/index.d.ts +1 -0
- package/build/cli/index.js +27 -0
- package/build/cli/index.js.map +1 -0
- package/build/cli/key/input.d.ts +5 -0
- package/build/cli/key/input.js +9 -0
- package/build/cli/key/input.js.map +1 -0
- package/build/cli/key/keyBindings.d.ts +152 -0
- package/build/cli/key/keyBindings.js +630 -0
- package/build/cli/key/keyBindings.js.map +1 -0
- package/build/cli/key/keyMatchers.d.ts +19 -0
- package/build/cli/key/keyMatchers.js +25 -0
- package/build/cli/key/keyMatchers.js.map +1 -0
- package/build/cli/key/mouse.d.ts +23 -0
- package/build/cli/key/mouse.js +155 -0
- package/build/cli/key/mouse.js.map +1 -0
- package/build/cli/key/text-buffer.d.ts +156 -0
- package/build/cli/key/text-buffer.js +937 -0
- package/build/cli/key/text-buffer.js.map +1 -0
- package/build/cli/main.d.ts +1 -0
- package/build/cli/main.js +20 -0
- package/build/cli/main.js.map +1 -0
- package/build/cli/services/McpClientService.d.ts +32 -0
- package/build/cli/services/McpClientService.js +123 -0
- package/build/cli/services/McpClientService.js.map +1 -0
- package/build/cli/services/McpManager.d.ts +28 -0
- package/build/cli/services/McpManager.js +146 -0
- package/build/cli/services/McpManager.js.map +1 -0
- package/build/cli/theme/builtin/default-dark.d.ts +7 -0
- package/build/cli/theme/builtin/default-dark.js +143 -0
- package/build/cli/theme/builtin/default-dark.js.map +1 -0
- package/build/cli/theme/builtin/no-color.d.ts +7 -0
- package/build/cli/theme/builtin/no-color.js +125 -0
- package/build/cli/theme/builtin/no-color.js.map +1 -0
- package/build/cli/theme/builtin/tokyonight-dark.d.ts +7 -0
- package/build/cli/theme/builtin/tokyonight-dark.js +146 -0
- package/build/cli/theme/builtin/tokyonight-dark.js.map +1 -0
- package/build/cli/theme/semantic-colors.d.ts +2 -0
- package/build/cli/theme/semantic-colors.js +19 -0
- package/build/cli/theme/semantic-colors.js.map +1 -0
- package/build/cli/theme/semantic-tokens.d.ts +42 -0
- package/build/cli/theme/semantic-tokens.js +77 -0
- package/build/cli/theme/semantic-tokens.js.map +1 -0
- package/build/cli/theme/theme-manager.d.ts +32 -0
- package/build/cli/theme/theme-manager.js +150 -0
- package/build/cli/theme/theme-manager.js.map +1 -0
- package/build/cli/theme/theme.d.ts +107 -0
- package/build/cli/theme/theme.js +333 -0
- package/build/cli/theme/theme.js.map +1 -0
- package/build/cli/tmp.d.ts +1 -0
- package/build/cli/tmp.js +27 -0
- package/build/cli/tmp.js.map +1 -0
- package/build/cli/types.d.ts +97 -0
- package/build/cli/types.js +2 -0
- package/build/cli/types.js.map +1 -0
- package/build/cli/ui/ConnectionStatus.d.ts +13 -0
- package/build/cli/ui/ConnectionStatus.js +19 -0
- package/build/cli/ui/ConnectionStatus.js.map +1 -0
- package/build/cli/ui/HalfPaddingBox.d.ts +13 -0
- package/build/cli/ui/HalfPaddingBox.js +11 -0
- package/build/cli/ui/HalfPaddingBox.js.map +1 -0
- package/build/cli/ui/HelpCommands.d.ts +5 -0
- package/build/cli/ui/HelpCommands.js +11 -0
- package/build/cli/ui/HelpCommands.js.map +1 -0
- package/build/cli/ui/HistoryItemDisplay.d.ts +9 -0
- package/build/cli/ui/HistoryItemDisplay.js +34 -0
- package/build/cli/ui/HistoryItemDisplay.js.map +1 -0
- package/build/cli/ui/InputPrompt.d.ts +13 -0
- package/build/cli/ui/InputPrompt.js +138 -0
- package/build/cli/ui/InputPrompt.js.map +1 -0
- package/build/cli/ui/LLMErrorComponent.d.ts +6 -0
- package/build/cli/ui/LLMErrorComponent.js +18 -0
- package/build/cli/ui/LLMErrorComponent.js.map +1 -0
- package/build/cli/ui/LLMHealthChecker.d.ts +8 -0
- package/build/cli/ui/LLMHealthChecker.js +22 -0
- package/build/cli/ui/LLMHealthChecker.js.map +1 -0
- package/build/cli/ui/MCPServers.d.ts +11 -0
- package/build/cli/ui/MCPServers.js +15 -0
- package/build/cli/ui/MCPServers.js.map +1 -0
- package/build/cli/ui/MainContent.d.ts +12 -0
- package/build/cli/ui/MainContent.js +28 -0
- package/build/cli/ui/MainContent.js.map +1 -0
- package/build/cli/ui/MarkdownDisplay.d.ts +8 -0
- package/build/cli/ui/MarkdownDisplay.js +6 -0
- package/build/cli/ui/MarkdownDisplay.js.map +1 -0
- package/build/cli/ui/MouseContext.d.ts +1 -0
- package/build/cli/ui/MouseContext.js +2 -0
- package/build/cli/ui/MouseContext.js.map +1 -0
- package/build/cli/ui/SuggestionsDisplay.d.ts +25 -0
- package/build/cli/ui/SuggestionsDisplay.js +45 -0
- package/build/cli/ui/SuggestionsDisplay.js.map +1 -0
- package/build/cli/ui/SystemInfoSummaryBox.d.ts +6 -0
- package/build/cli/ui/SystemInfoSummaryBox.js +6 -0
- package/build/cli/ui/SystemInfoSummaryBox.js.map +1 -0
- package/build/cli/ui/ThinkingIndicator.d.ts +2 -0
- package/build/cli/ui/ThinkingIndicator.js +16 -0
- package/build/cli/ui/ThinkingIndicator.js.map +1 -0
- package/build/cli/ui/layout/DefaultAppLayout.d.ts +2 -0
- package/build/cli/ui/layout/DefaultAppLayout.js +6 -0
- package/build/cli/ui/layout/DefaultAppLayout.js.map +1 -0
- package/build/cli/ui/shared/ExpandableText.d.ts +14 -0
- package/build/cli/ui/shared/ExpandableText.js +19 -0
- package/build/cli/ui/shared/ExpandableText.js.map +1 -0
- package/build/cli/utils/cache.d.ts +21 -0
- package/build/cli/utils/cache.js +56 -0
- package/build/cli/utils/cache.js.map +1 -0
- package/build/cli/utils/cleanup.d.ts +1 -0
- package/build/cli/utils/cleanup.js +5 -0
- package/build/cli/utils/cleanup.js.map +1 -0
- package/build/cli/utils/commandUtils.d.ts +11 -0
- package/build/cli/utils/commandUtils.js +16 -0
- package/build/cli/utils/commandUtils.js.map +1 -0
- package/build/cli/utils/historyStorage.d.ts +13 -0
- package/build/cli/utils/historyStorage.js +64 -0
- package/build/cli/utils/historyStorage.js.map +1 -0
- package/build/cli/utils/stdio.d.ts +18 -0
- package/build/cli/utils/stdio.js +58 -0
- package/build/cli/utils/stdio.js.map +1 -0
- package/build/cli/utils/terminal.d.ts +15 -0
- package/build/cli/utils/terminal.js +51 -0
- package/build/cli/utils/terminal.js.map +1 -0
- package/build/cli/utils/textUtil.d.ts +63 -0
- package/build/cli/utils/textUtil.js +231 -0
- package/build/cli/utils/textUtil.js.map +1 -0
- package/build/config.d.ts +25 -0
- package/{dist/src → build}/config.js +29 -8
- package/build/config.js.map +1 -0
- package/build/index.d.ts +2 -0
- package/{dist/src → build}/index.js +0 -3
- package/build/index.js.map +1 -0
- package/{dist/src → build}/server.d.ts +0 -1
- package/{dist/src → build}/server.js +1 -2
- package/build/server.js.map +1 -0
- package/{dist/src → build}/setup.d.ts +0 -2
- package/{dist/src → build}/setup.js +2 -4
- package/build/setup.js.map +1 -0
- package/build/shared/configSchema.d.ts +27 -0
- package/build/shared/configSchema.js +31 -0
- package/build/shared/configSchema.js.map +1 -0
- package/build/shared/index.d.ts +3 -0
- package/build/shared/index.js +4 -0
- package/build/shared/index.js.map +1 -0
- package/build/shared/types.d.ts +20 -0
- package/build/shared/types.js +2 -0
- package/build/shared/types.js.map +1 -0
- package/build/shared/utils/debugLogger.d.ts +12 -0
- package/build/shared/utils/debugLogger.js +54 -0
- package/build/shared/utils/debugLogger.js.map +1 -0
- package/{dist/src → build}/tools/create_document_with_properties/index.d.ts +22 -5
- package/{dist/src → build}/tools/create_document_with_properties/index.js +2 -2
- package/build/tools/create_document_with_properties/index.js.map +1 -0
- package/build/tools/create_document_with_properties/params.d.ts +66 -0
- package/{dist/src → build}/tools/create_document_with_properties/params.js +1 -1
- package/build/tools/create_document_with_properties/params.js.map +1 -0
- package/{dist/src → build}/tools/generate_property/index.d.ts +1 -2
- package/{dist/src → build}/tools/generate_property/index.js +1 -1
- package/build/tools/generate_property/index.js.map +1 -0
- package/{dist/src → build}/tools/generate_property/params.d.ts +30 -7
- package/build/tools/generate_property/params.js.map +1 -0
- package/{dist/src → build}/tools/index.d.ts +51 -36
- package/build/tools/index.js +13 -0
- package/build/tools/index.js.map +1 -0
- package/{dist/src → build}/tools/organize_attachments/index.d.ts +1 -2
- package/{dist/src → build}/tools/organize_attachments/index.js +2 -2
- package/build/tools/organize_attachments/index.js.map +1 -0
- package/build/tools/organize_attachments/params.d.ts +122 -0
- package/{dist/src → build}/tools/organize_attachments/params.js +3 -3
- package/build/tools/organize_attachments/params.js.map +1 -0
- package/{dist/src → build}/tools/organize_attachments/utils.d.ts +0 -1
- package/build/tools/organize_attachments/utils.js.map +1 -0
- package/{dist/src → build}/tools/vault/index.d.ts +5 -26
- package/{dist/src → build}/tools/vault/index.js +3 -3
- package/build/tools/vault/index.js.map +1 -0
- package/{dist/src → build}/tools/vault/metrics.d.ts +0 -1
- package/build/tools/vault/metrics.js.map +1 -0
- package/build/tools/vault/params.d.ts +115 -0
- package/{dist/src → build}/tools/vault/params.js +0 -1
- package/build/tools/vault/params.js.map +1 -0
- package/build/tools/vault/types/collect_context.d.ts +1340 -0
- package/{dist/src → build}/tools/vault/types/collect_context.js +1 -1
- package/build/tools/vault/types/collect_context.js.map +1 -0
- package/build/tools/vault/types/list_all.d.ts +387 -0
- package/{dist/src → build}/tools/vault/types/list_all.js +4 -9
- package/build/tools/vault/types/list_all.js.map +1 -0
- package/build/tools/vault/types/read_specific.d.ts +297 -0
- package/{dist/src → build}/tools/vault/types/read_specific.js +1 -3
- package/build/tools/vault/types/read_specific.js.map +1 -0
- package/build/tools/vault/types/search.d.ts +598 -0
- package/{dist/src → build}/tools/vault/types/search.js +8 -16
- package/build/tools/vault/types/search.js.map +1 -0
- package/{dist/src → build}/tools/vault/utils/actions/collect_context.d.ts +1 -2
- package/{dist/src → build}/tools/vault/utils/actions/collect_context.js +4 -4
- package/build/tools/vault/utils/actions/collect_context.js.map +1 -0
- package/{dist/src → build}/tools/vault/utils/actions/index_rag.d.ts +0 -1
- package/build/tools/vault/utils/actions/index_rag.js.map +1 -0
- package/{dist/src → build}/tools/vault/utils/actions/list_all.d.ts +1 -2
- package/{dist/src → build}/tools/vault/utils/actions/list_all.js +1 -1
- package/build/tools/vault/utils/actions/list_all.js.map +1 -0
- package/{dist/src → build}/tools/vault/utils/actions/load_memory.d.ts +1 -2
- package/{dist/src → build}/tools/vault/utils/actions/load_memory.js +3 -3
- package/build/tools/vault/utils/actions/load_memory.js.map +1 -0
- package/{dist/src → build}/tools/vault/utils/actions/read.d.ts +1 -2
- package/{dist/src → build}/tools/vault/utils/actions/read.js +1 -1
- package/build/tools/vault/utils/actions/read.js.map +1 -0
- package/{dist/src → build}/tools/vault/utils/actions/search.d.ts +1 -2
- package/{dist/src → build}/tools/vault/utils/actions/search.js +2 -2
- package/build/tools/vault/utils/actions/search.js.map +1 -0
- package/{dist/src → build}/tools/vault/utils/actions/stats.d.ts +0 -1
- package/build/tools/vault/utils/actions/stats.js.map +1 -0
- package/{dist/src → build}/tools/vault/utils/constants.d.ts +0 -1
- package/build/tools/vault/utils/constants.js.map +1 -0
- package/{dist/src → build}/tools/vault/utils/document.d.ts +0 -6
- package/{dist/src → build}/tools/vault/utils/document.js +0 -1
- package/build/tools/vault/utils/document.js.map +1 -0
- package/{dist/src → build}/tools/vault/utils/shared.d.ts +1 -2
- package/build/tools/vault/utils/shared.js.map +1 -0
- package/build/tools/vault/utils.d.ts +7 -0
- package/build/tools/vault/utils.js +8 -0
- package/build/tools/vault/utils.js.map +1 -0
- package/{dist/src → build}/tools/write_property/index.d.ts +22 -5
- package/{dist/src → build}/tools/write_property/index.js +1 -1
- package/build/tools/write_property/index.js.map +1 -0
- package/build/tools/write_property/params.d.ts +60 -0
- package/build/tools/write_property/params.js.map +1 -0
- package/{dist/src → build}/utils/DirectoryWalker.d.ts +1 -2
- package/build/utils/DirectoryWalker.js.map +1 -0
- package/{dist/src → build}/utils/Embedder.d.ts +0 -1
- package/{dist/src → build}/utils/Embedder.js +1 -1
- package/build/utils/Embedder.js.map +1 -0
- package/{dist/src → build}/utils/Indexer.d.ts +2 -3
- package/{dist/src → build}/utils/Indexer.js +2 -2
- package/build/utils/Indexer.js.map +1 -0
- package/{dist/src → build}/utils/LLMClient.d.ts +0 -5
- package/build/utils/LLMClient.js +53 -0
- package/build/utils/LLMClient.js.map +1 -0
- package/{dist/src → build}/utils/LocalReranker.d.ts +0 -1
- package/{dist/src → build}/utils/LocalReranker.js +1 -1
- package/build/utils/LocalReranker.js.map +1 -0
- package/{dist/src → build}/utils/RAGIndexer.d.ts +1 -2
- package/{dist/src → build}/utils/RAGIndexer.js +8 -11
- package/build/utils/RAGIndexer.js.map +1 -0
- package/build/utils/RerankerClient.d.ts +61 -0
- package/{dist/src → build}/utils/RerankerClient.js +1 -20
- package/build/utils/RerankerClient.js.map +1 -0
- package/{dist/src → build}/utils/VaultManger/VaultManager.d.ts +3 -7
- package/{dist/src → build}/utils/VaultManger/VaultManager.js +17 -20
- package/build/utils/VaultManger/VaultManager.js.map +1 -0
- package/{dist/src → build}/utils/VaultManger/VaultPathError.d.ts +0 -1
- package/build/utils/VaultManger/VaultPathError.js.map +1 -0
- package/build/utils/VaultManger/index.d.ts +3 -0
- package/build/utils/VaultManger/index.js +3 -0
- package/build/utils/VaultManger/index.js.map +1 -0
- package/{dist/src → build}/utils/VaultManger/types.d.ts +1 -2
- package/build/utils/VaultManger/types.js +2 -0
- package/build/utils/VaultManger/types.js.map +1 -0
- package/{dist/src → build}/utils/VaultWatcher.d.ts +0 -1
- package/{dist/src → build}/utils/VaultWatcher.js +1 -1
- package/build/utils/VaultWatcher.js.map +1 -0
- package/{dist/src → build}/utils/VectorDB.d.ts +0 -1
- package/build/utils/VectorDB.js +241 -0
- package/build/utils/VectorDB.js.map +1 -0
- package/{dist/src → build}/utils/constants.d.ts +0 -1
- package/build/utils/constants.js.map +1 -0
- package/{dist/src → build}/utils/createToolError.d.ts +0 -1
- package/build/utils/createToolError.js.map +1 -0
- package/build/utils/getVaultManager.d.ts +2 -0
- package/{dist/src → build}/utils/getVaultManager.js +1 -7
- package/build/utils/getVaultManager.js.map +1 -0
- package/{dist/src → build}/utils/processor/LinkExtractor.d.ts +0 -1
- package/build/utils/processor/LinkExtractor.js.map +1 -0
- package/build/utils/processor/MatterParser.d.ts +2 -0
- package/build/utils/processor/MatterParser.js +28 -0
- package/build/utils/processor/MatterParser.js.map +1 -0
- package/build/utils/processor/types.d.ts +104 -0
- package/{dist/src → build}/utils/processor/types.js +2 -10
- package/build/utils/processor/types.js.map +1 -0
- package/{dist/src → build}/utils/semaphore.d.ts +0 -1
- package/build/utils/semaphore.js.map +1 -0
- package/package.json +84 -72
- package/dist/package.json +0 -74
- package/dist/src/config.d.ts +0 -6
- package/dist/src/config.d.ts.map +0 -1
- package/dist/src/config.js.map +0 -1
- package/dist/src/db.d.ts +0 -2
- package/dist/src/db.d.ts.map +0 -1
- package/dist/src/db.js +0 -58
- package/dist/src/db.js.map +0 -1
- package/dist/src/index.d.ts +0 -3
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js.map +0 -1
- package/dist/src/server.d.ts.map +0 -1
- package/dist/src/server.js.map +0 -1
- package/dist/src/setup.d.ts.map +0 -1
- package/dist/src/setup.js.map +0 -1
- package/dist/src/tools/create_document_with_properties/index.d.ts.map +0 -1
- package/dist/src/tools/create_document_with_properties/index.js.map +0 -1
- package/dist/src/tools/create_document_with_properties/params.d.ts +0 -19
- package/dist/src/tools/create_document_with_properties/params.d.ts.map +0 -1
- package/dist/src/tools/create_document_with_properties/params.js.map +0 -1
- package/dist/src/tools/generate_property/index.d.ts.map +0 -1
- package/dist/src/tools/generate_property/index.js.map +0 -1
- package/dist/src/tools/generate_property/params.d.ts.map +0 -1
- package/dist/src/tools/generate_property/params.js.map +0 -1
- package/dist/src/tools/index.d.ts.map +0 -1
- package/dist/src/tools/index.js +0 -13
- package/dist/src/tools/index.js.map +0 -1
- package/dist/src/tools/organize_attachments/index.d.ts.map +0 -1
- package/dist/src/tools/organize_attachments/index.js.map +0 -1
- package/dist/src/tools/organize_attachments/params.d.ts +0 -47
- package/dist/src/tools/organize_attachments/params.d.ts.map +0 -1
- package/dist/src/tools/organize_attachments/params.js.map +0 -1
- package/dist/src/tools/organize_attachments/utils.d.ts.map +0 -1
- package/dist/src/tools/organize_attachments/utils.js.map +0 -1
- package/dist/src/tools/vault/index.d.ts.map +0 -1
- package/dist/src/tools/vault/index.js.map +0 -1
- package/dist/src/tools/vault/metrics.d.ts.map +0 -1
- package/dist/src/tools/vault/metrics.js.map +0 -1
- package/dist/src/tools/vault/params.d.ts +0 -100
- package/dist/src/tools/vault/params.d.ts.map +0 -1
- package/dist/src/tools/vault/params.js.map +0 -1
- package/dist/src/tools/vault/types/collect_context.d.ts +0 -388
- package/dist/src/tools/vault/types/collect_context.d.ts.map +0 -1
- package/dist/src/tools/vault/types/collect_context.js.map +0 -1
- package/dist/src/tools/vault/types/list_all.d.ts +0 -89
- package/dist/src/tools/vault/types/list_all.d.ts.map +0 -1
- package/dist/src/tools/vault/types/list_all.js.map +0 -1
- package/dist/src/tools/vault/types/read_specific.d.ts +0 -68
- package/dist/src/tools/vault/types/read_specific.d.ts.map +0 -1
- package/dist/src/tools/vault/types/read_specific.js.map +0 -1
- package/dist/src/tools/vault/types/search.d.ts +0 -151
- package/dist/src/tools/vault/types/search.d.ts.map +0 -1
- package/dist/src/tools/vault/types/search.js.map +0 -1
- package/dist/src/tools/vault/utils/actions/collect_context.d.ts.map +0 -1
- package/dist/src/tools/vault/utils/actions/collect_context.js.map +0 -1
- package/dist/src/tools/vault/utils/actions/index_rag.d.ts.map +0 -1
- package/dist/src/tools/vault/utils/actions/index_rag.js.map +0 -1
- package/dist/src/tools/vault/utils/actions/list_all.d.ts.map +0 -1
- package/dist/src/tools/vault/utils/actions/list_all.js.map +0 -1
- package/dist/src/tools/vault/utils/actions/load_memory.d.ts.map +0 -1
- package/dist/src/tools/vault/utils/actions/load_memory.js.map +0 -1
- package/dist/src/tools/vault/utils/actions/read.d.ts.map +0 -1
- package/dist/src/tools/vault/utils/actions/read.js.map +0 -1
- package/dist/src/tools/vault/utils/actions/search.d.ts.map +0 -1
- package/dist/src/tools/vault/utils/actions/search.js.map +0 -1
- package/dist/src/tools/vault/utils/actions/stats.d.ts.map +0 -1
- package/dist/src/tools/vault/utils/actions/stats.js.map +0 -1
- package/dist/src/tools/vault/utils/constants.d.ts.map +0 -1
- package/dist/src/tools/vault/utils/constants.js.map +0 -1
- package/dist/src/tools/vault/utils/document.d.ts.map +0 -1
- package/dist/src/tools/vault/utils/document.js.map +0 -1
- package/dist/src/tools/vault/utils/shared.d.ts.map +0 -1
- package/dist/src/tools/vault/utils/shared.js.map +0 -1
- package/dist/src/tools/vault/utils.d.ts +0 -8
- package/dist/src/tools/vault/utils.d.ts.map +0 -1
- package/dist/src/tools/vault/utils.js +0 -8
- package/dist/src/tools/vault/utils.js.map +0 -1
- package/dist/src/tools/write_property/index.d.ts.map +0 -1
- package/dist/src/tools/write_property/index.js.map +0 -1
- package/dist/src/tools/write_property/params.d.ts +0 -17
- package/dist/src/tools/write_property/params.d.ts.map +0 -1
- package/dist/src/tools/write_property/params.js.map +0 -1
- package/dist/src/utils/DirectoryWalker.d.ts.map +0 -1
- package/dist/src/utils/DirectoryWalker.js.map +0 -1
- package/dist/src/utils/Embedder.d.ts.map +0 -1
- package/dist/src/utils/Embedder.js.map +0 -1
- package/dist/src/utils/Indexer.d.ts.map +0 -1
- package/dist/src/utils/Indexer.js.map +0 -1
- package/dist/src/utils/LLMClient.d.ts.map +0 -1
- package/dist/src/utils/LLMClient.js +0 -112
- package/dist/src/utils/LLMClient.js.map +0 -1
- package/dist/src/utils/LocalReranker.d.ts.map +0 -1
- package/dist/src/utils/LocalReranker.js.map +0 -1
- package/dist/src/utils/RAGIndexer.d.ts.map +0 -1
- package/dist/src/utils/RAGIndexer.js.map +0 -1
- package/dist/src/utils/RerankerClient.d.ts +0 -28
- package/dist/src/utils/RerankerClient.d.ts.map +0 -1
- package/dist/src/utils/RerankerClient.js.map +0 -1
- package/dist/src/utils/VaultManger/VaultManager.d.ts.map +0 -1
- package/dist/src/utils/VaultManger/VaultManager.js.map +0 -1
- package/dist/src/utils/VaultManger/VaultPathError.d.ts.map +0 -1
- package/dist/src/utils/VaultManger/VaultPathError.js.map +0 -1
- package/dist/src/utils/VaultManger/index.d.ts +0 -4
- package/dist/src/utils/VaultManger/index.d.ts.map +0 -1
- package/dist/src/utils/VaultManger/index.js +0 -3
- package/dist/src/utils/VaultManger/index.js.map +0 -1
- package/dist/src/utils/VaultManger/types.d.ts.map +0 -1
- package/dist/src/utils/VaultManger/types.js.map +0 -1
- package/dist/src/utils/VaultWatcher.d.ts.map +0 -1
- package/dist/src/utils/VaultWatcher.js.map +0 -1
- package/dist/src/utils/VectorDB.d.ts.map +0 -1
- package/dist/src/utils/VectorDB.js +0 -305
- package/dist/src/utils/VectorDB.js.map +0 -1
- package/dist/src/utils/constants.d.ts.map +0 -1
- package/dist/src/utils/constants.js.map +0 -1
- package/dist/src/utils/createToolError.d.ts.map +0 -1
- package/dist/src/utils/createToolError.js.map +0 -1
- package/dist/src/utils/getVaultManager.d.ts +0 -7
- package/dist/src/utils/getVaultManager.d.ts.map +0 -1
- package/dist/src/utils/getVaultManager.js.map +0 -1
- package/dist/src/utils/processor/LinkExtractor.d.ts.map +0 -1
- package/dist/src/utils/processor/LinkExtractor.js.map +0 -1
- package/dist/src/utils/processor/MatterParser.d.ts +0 -3
- package/dist/src/utils/processor/MatterParser.d.ts.map +0 -1
- package/dist/src/utils/processor/MatterParser.js +0 -27
- package/dist/src/utils/processor/MatterParser.js.map +0 -1
- package/dist/src/utils/processor/types.d.ts +0 -53
- package/dist/src/utils/processor/types.d.ts.map +0 -1
- package/dist/src/utils/processor/types.js.map +0 -1
- package/dist/src/utils/semaphore.d.ts.map +0 -1
- package/dist/src/utils/semaphore.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- /package/{dist/src/utils/VaultManger → build/cli/hooks/useLlmStream}/types.js +0 -0
- /package/{dist/src → build}/tools/generate_property/params.js +0 -0
- /package/{dist/src → build}/tools/organize_attachments/utils.js +0 -0
- /package/{dist/src → build}/tools/vault/metrics.js +0 -0
- /package/{dist/src → build}/tools/vault/utils/actions/index_rag.js +0 -0
- /package/{dist/src → build}/tools/vault/utils/actions/stats.js +0 -0
- /package/{dist/src → build}/tools/vault/utils/constants.js +0 -0
- /package/{dist/src → build}/tools/vault/utils/shared.js +0 -0
- /package/{dist/src → build}/tools/write_property/params.js +0 -0
- /package/{dist/src → build}/utils/DirectoryWalker.js +0 -0
- /package/{dist/src → build}/utils/VaultManger/VaultPathError.js +0 -0
- /package/{dist/src → build}/utils/constants.js +0 -0
- /package/{dist/src → build}/utils/createToolError.js +0 -0
- /package/{dist/src → build}/utils/processor/LinkExtractor.js +0 -0
- /package/{dist/src → build}/utils/semaphore.js +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from "ink";
|
|
3
|
+
export const MAX_WIDTH = 120;
|
|
4
|
+
/**
|
|
5
|
+
* Renders a suggestion label, highlighting the matched portion if provided.
|
|
6
|
+
*/
|
|
7
|
+
export function ExpandableText({ label, matchedIndex, userInput, textColor, isExpanded: _isExpanded, }) {
|
|
8
|
+
if (matchedIndex !== undefined &&
|
|
9
|
+
matchedIndex >= 0 &&
|
|
10
|
+
userInput &&
|
|
11
|
+
userInput.length > 0) {
|
|
12
|
+
const before = label.slice(0, matchedIndex);
|
|
13
|
+
const match = label.slice(matchedIndex, matchedIndex + userInput.length);
|
|
14
|
+
const after = label.slice(matchedIndex + userInput.length);
|
|
15
|
+
return (_jsxs(Text, { color: textColor, children: [before, _jsx(Text, { bold: true, children: match }), after] }));
|
|
16
|
+
}
|
|
17
|
+
return _jsx(Text, { color: textColor, children: label });
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=ExpandableText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpandableText.js","sourceRoot":"","sources":["../../../../src/cli/ui/shared/ExpandableText.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAG3B,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAC;AAU7B;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,EAC9B,KAAK,EACL,YAAY,EACZ,SAAS,EACT,SAAS,EACT,UAAU,EAAE,WAAW,GACF;IACrB,IACC,YAAY,KAAK,SAAS;QAC1B,YAAY,IAAI,CAAC;QACjB,SAAS;QACT,SAAS,CAAC,MAAM,GAAG,CAAC,EACnB,CAAC;QACF,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;QAC5C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,YAAY,EAAE,YAAY,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QACzE,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,YAAY,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QAC3D,OAAO,CACN,MAAC,IAAI,IAAC,KAAK,EAAE,SAAS,aACpB,MAAM,EACP,KAAC,IAAI,IAAC,IAAI,kBAAE,KAAK,GAAQ,EACxB,KAAK,IACA,CACP,CAAC;IACH,CAAC;IACD,OAAO,KAAC,IAAI,IAAC,KAAK,EAAE,SAAS,YAAG,KAAK,GAAQ,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface CacheEntry<V> {
|
|
2
|
+
value: V;
|
|
3
|
+
timestamp: number;
|
|
4
|
+
ttl?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface CacheOptions {
|
|
7
|
+
defaultTTL?: number;
|
|
8
|
+
deleteOnPromiseFailure?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare class CacheService<K extends object | string | undefined, V> {
|
|
11
|
+
private readonly storage;
|
|
12
|
+
private readonly defaultTTL?;
|
|
13
|
+
private readonly deleteOnPromiseFailure;
|
|
14
|
+
constructor(options?: CacheOptions);
|
|
15
|
+
get(key: K): V | undefined;
|
|
16
|
+
set(key: K, value: V, ttl?: number): void;
|
|
17
|
+
getOrCreate(key: K, creator: () => V, ttl?: number): V;
|
|
18
|
+
delete(key: K): void;
|
|
19
|
+
}
|
|
20
|
+
export declare function createCache<K extends string | undefined, V>(options: CacheOptions): CacheService<K, V>;
|
|
21
|
+
export declare function createCache<K extends object, V>(options?: CacheOptions): CacheService<K, V>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export class CacheService {
|
|
2
|
+
storage;
|
|
3
|
+
defaultTTL;
|
|
4
|
+
deleteOnPromiseFailure;
|
|
5
|
+
constructor(options = {}) {
|
|
6
|
+
this.storage = new Map();
|
|
7
|
+
this.defaultTTL = options.defaultTTL;
|
|
8
|
+
this.deleteOnPromiseFailure = options.deleteOnPromiseFailure ?? false;
|
|
9
|
+
}
|
|
10
|
+
get(key) {
|
|
11
|
+
const entry = this.storage.get(key);
|
|
12
|
+
if (!entry) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
const ttl = entry.ttl ?? this.defaultTTL;
|
|
16
|
+
if (ttl !== undefined && Date.now() - entry.timestamp > ttl) {
|
|
17
|
+
this.delete(key);
|
|
18
|
+
}
|
|
19
|
+
return entry.value;
|
|
20
|
+
}
|
|
21
|
+
set(key, value, ttl) {
|
|
22
|
+
const entry = {
|
|
23
|
+
value,
|
|
24
|
+
timestamp: Date.now(),
|
|
25
|
+
ttl,
|
|
26
|
+
};
|
|
27
|
+
this.storage.set(key, entry);
|
|
28
|
+
if (this.deleteOnPromiseFailure && value instanceof Promise) {
|
|
29
|
+
value.catch(() => {
|
|
30
|
+
if (this.storage.get(key) === entry) {
|
|
31
|
+
this.delete(key);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
getOrCreate(key, creator, ttl) {
|
|
37
|
+
let value = this.get(key);
|
|
38
|
+
if (value === undefined) {
|
|
39
|
+
value = creator();
|
|
40
|
+
this.set(key, value, ttl);
|
|
41
|
+
}
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
delete(key) {
|
|
45
|
+
if (this.storage instanceof Map) {
|
|
46
|
+
this.storage.delete(key);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
this.storage.delete(key);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export function createCache(options = {}) {
|
|
54
|
+
return new CacheService(options);
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../src/cli/utils/cache.ts"],"names":[],"mappings":"AAWA,MAAM,OAAO,YAAY;IACP,OAAO,CAAwB;IAC/B,UAAU,CAAU;IACpB,sBAAsB,CAAU;IAEjD,YAAY,UAAwB,EAAE;QACrC,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,EAAoB,CAAC;QAC3C,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,IAAI,KAAK,CAAC;IACvE,CAAC;IAED,GAAG,CAAC,GAAM;QACT,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAA8B,CAAC;QACjE,IAAI,CAAC,KAAK,EAAE,CAAC;YACZ,OAAO,SAAS,CAAC;QAClB,CAAC;QAED,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC;QACzC,IAAI,GAAG,KAAK,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,SAAS,GAAG,GAAG,EAAE,CAAC;YAC7D,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAClB,CAAC;QAED,OAAO,KAAK,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,GAAG,CAAC,GAAM,EAAE,KAAQ,EAAE,GAAY;QACjC,MAAM,KAAK,GAAkB;YAC5B,KAAK;YACL,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,GAAG;SACH,CAAC;QAEF,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAE7B,IAAI,IAAI,CAAC,sBAAsB,IAAI,KAAK,YAAY,OAAO,EAAE,CAAC;YAC7D,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE;gBAChB,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC;oBACrC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAClB,CAAC;YACF,CAAC,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IAED,WAAW,CAAC,GAAM,EAAE,OAAgB,EAAE,GAAY;QACjD,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACzB,KAAK,GAAG,OAAO,EAAE,CAAC;YAClB,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IAED,MAAM,CAAC,GAAM;QACZ,IAAI,IAAI,CAAC,OAAO,YAAY,GAAG,EAAE,CAAC;YACjC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,OAA2C,CAAC,MAAM,CAAC,GAAc,CAAC,CAAC;QAC1E,CAAC;IACF,CAAC;CACD;AAQD,MAAM,UAAU,WAAW,CAC1B,UAAwB,EAAE;IAE1B,OAAO,IAAI,YAAY,CAAO,OAAO,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function registerSyncCleanup(fn: () => void): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanup.js","sourceRoot":"","sources":["../../../src/cli/utils/cleanup.ts"],"names":[],"mappings":"AAAA,MAAM,oBAAoB,GAAsB,EAAE,CAAC;AAEnD,MAAM,UAAU,mBAAmB,CAAC,EAAc;IACjD,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for command parsing.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Returns true if the trimmed text begins with '/', indicating a slash command.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isSlashCommand(text: string): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Returns true if the trimmed text begins with '@', indicating an at-command.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isAtCommand(text: string): boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for command parsing.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Returns true if the trimmed text begins with '/', indicating a slash command.
|
|
6
|
+
*/
|
|
7
|
+
export function isSlashCommand(text) {
|
|
8
|
+
return text.trimStart().startsWith("/");
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Returns true if the trimmed text begins with '@', indicating an at-command.
|
|
12
|
+
*/
|
|
13
|
+
export function isAtCommand(text) {
|
|
14
|
+
return text.trimStart().startsWith("@");
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=commandUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandUtils.js","sourceRoot":"","sources":["../../../src/cli/utils/commandUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IAC1C,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACvC,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface HistoryItem {
|
|
2
|
+
text: string;
|
|
3
|
+
timestamp: number;
|
|
4
|
+
}
|
|
5
|
+
export declare class HistoryStorage {
|
|
6
|
+
private filePath;
|
|
7
|
+
constructor(filePath?: string);
|
|
8
|
+
getPreviousUserMessages(): Promise<string[]>;
|
|
9
|
+
appendMessage(text: string): Promise<void>;
|
|
10
|
+
private getRawItems;
|
|
11
|
+
private saveItems;
|
|
12
|
+
}
|
|
13
|
+
export declare const historyStorage: HistoryStorage;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { debugLogger } from "../../shared/index.js";
|
|
5
|
+
const HISTORY_FILE_PATH = path.join(os.homedir(), ".obsidian-mcp-agent-history.json");
|
|
6
|
+
const EXPIRY_MS = 24 * 60 * 60 * 1000; // 24 hours
|
|
7
|
+
export class HistoryStorage {
|
|
8
|
+
filePath;
|
|
9
|
+
constructor(filePath = HISTORY_FILE_PATH) {
|
|
10
|
+
this.filePath = filePath;
|
|
11
|
+
}
|
|
12
|
+
async getPreviousUserMessages() {
|
|
13
|
+
try {
|
|
14
|
+
const data = await fs.readFile(this.filePath, "utf-8");
|
|
15
|
+
const parsed = JSON.parse(data);
|
|
16
|
+
const now = Date.now();
|
|
17
|
+
const validItems = parsed.filter((item) => now - item.timestamp <= EXPIRY_MS);
|
|
18
|
+
// If items were pruned, save back to file to save disk space
|
|
19
|
+
if (validItems.length < parsed.length) {
|
|
20
|
+
await this.saveItems(validItems);
|
|
21
|
+
}
|
|
22
|
+
// Return just the text values
|
|
23
|
+
return validItems.map((item) => item.text);
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
if (error.code !== "ENOENT") {
|
|
27
|
+
debugLogger.warn("Failed to read history storage", error);
|
|
28
|
+
}
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async appendMessage(text) {
|
|
33
|
+
try {
|
|
34
|
+
const currentMessages = await this.getRawItems();
|
|
35
|
+
const now = Date.now();
|
|
36
|
+
// Prune old items first
|
|
37
|
+
const validItems = currentMessages.filter((item) => now - item.timestamp <= EXPIRY_MS);
|
|
38
|
+
validItems.push({ text, timestamp: now });
|
|
39
|
+
await this.saveItems(validItems);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
debugLogger.warn("Failed to append message to history storage", error);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async getRawItems() {
|
|
46
|
+
try {
|
|
47
|
+
const data = await fs.readFile(this.filePath, "utf-8");
|
|
48
|
+
return JSON.parse(data);
|
|
49
|
+
}
|
|
50
|
+
catch (_error) {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async saveItems(items) {
|
|
55
|
+
try {
|
|
56
|
+
await fs.writeFile(this.filePath, JSON.stringify(items, null, 2), "utf-8");
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
debugLogger.warn("Failed to save items to history storage", error);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export const historyStorage = new HistoryStorage();
|
|
64
|
+
//# sourceMappingURL=historyStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"historyStorage.js","sourceRoot":"","sources":["../../../src/cli/utils/historyStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAClC,EAAE,CAAC,OAAO,EAAE,EACZ,kCAAkC,CAClC,CAAC;AACF,MAAM,SAAS,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,WAAW;AAOlD,MAAM,OAAO,cAAc;IAClB,QAAQ,CAAS;IAEzB,YAAY,WAAmB,iBAAiB;QAC/C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,uBAAuB;QAC5B,IAAI,CAAC;YACJ,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACvD,MAAM,MAAM,GAAkB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC/C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAEvB,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAC/B,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,SAAS,IAAI,SAAS,CAC3C,CAAC;YAEF,6DAA6D;YAC7D,IAAI,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;gBACvC,MAAM,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;YAClC,CAAC;YAED,8BAA8B;YAC9B,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5C,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACzB,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACxD,WAAW,CAAC,IAAI,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;YAC3D,CAAC;YACD,OAAO,EAAE,CAAC;QACX,CAAC;IACF,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,IAAY;QAC/B,IAAI,CAAC;YACJ,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;YACjD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAEvB,wBAAwB;YACxB,MAAM,UAAU,GAAG,eAAe,CAAC,MAAM,CACxC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,SAAS,IAAI,SAAS,CAC3C,CAAC;YACF,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;YAE1C,MAAM,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,WAAW,CAAC,IAAI,CAAC,6CAA6C,EAAE,KAAK,CAAC,CAAC;QACxE,CAAC;IACF,CAAC;IAEO,KAAK,CAAC,WAAW;QACxB,IAAI,CAAC;YACJ,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACvD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;QAAC,OAAO,MAAM,EAAE,CAAC;YACjB,OAAO,EAAE,CAAC;QACX,CAAC;IACF,CAAC;IAEO,KAAK,CAAC,SAAS,CAAC,KAAoB;QAC3C,IAAI,CAAC;YACJ,MAAM,EAAE,CAAC,SAAS,CACjB,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAC9B,OAAO,CACP,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,WAAW,CAAC,IAAI,CAAC,yCAAyC,EAAE,KAAK,CAAC,CAAC;QACpE,CAAC;IACF,CAAC;CACD;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 몽키패칭에서 사용이 필요한 경우, 원래의 stdout과 stderr에 직접 쓰기 위해 이 함수를 사용합니다. stdio가 패치된 이후에도 원래의 출력 스트림에 접근할 수 있도록 합니다.
|
|
3
|
+
*/
|
|
4
|
+
export declare function writeToStdout(...args: Parameters<typeof process.stdout.write>): boolean;
|
|
5
|
+
export declare function writeToStderr(...args: Parameters<typeof process.stderr.write>): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Creates proxies for process.stdout and process.stderr that use the real write methods
|
|
8
|
+
* (writeToStdout and writeToStderr) bypassing any monkey patching.
|
|
9
|
+
* This is used to write to the real output even when stdio is patched.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createWorkingStdio(): {
|
|
12
|
+
stdout: NodeJS.WriteStream & {
|
|
13
|
+
fd: 1;
|
|
14
|
+
};
|
|
15
|
+
stderr: NodeJS.WriteStream & {
|
|
16
|
+
fd: 2;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* 몽키 패칭을 수행하기 이전에 원래의 stdout과 stderr의 write 메서드를 저장합니다. 이렇게 하면 stdio가 패치된 이후에도 원래의 출력 스트림에 접근할 수 있습니다.
|
|
3
|
+
*/
|
|
4
|
+
const originalStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
5
|
+
const originalStderrWrite = process.stderr.write.bind(process.stderr);
|
|
6
|
+
/**
|
|
7
|
+
* 몽키패칭에서 사용이 필요한 경우, 원래의 stdout과 stderr에 직접 쓰기 위해 이 함수를 사용합니다. stdio가 패치된 이후에도 원래의 출력 스트림에 접근할 수 있도록 합니다.
|
|
8
|
+
*/
|
|
9
|
+
export function writeToStdout(...args) {
|
|
10
|
+
return originalStdoutWrite(...args);
|
|
11
|
+
}
|
|
12
|
+
export function writeToStderr(...args) {
|
|
13
|
+
return originalStderrWrite(...args);
|
|
14
|
+
}
|
|
15
|
+
function isKey(key, obj) {
|
|
16
|
+
return key in obj;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Creates proxies for process.stdout and process.stderr that use the real write methods
|
|
20
|
+
* (writeToStdout and writeToStderr) bypassing any monkey patching.
|
|
21
|
+
* This is used to write to the real output even when stdio is patched.
|
|
22
|
+
*/
|
|
23
|
+
export function createWorkingStdio() {
|
|
24
|
+
const stdoutHandler = {
|
|
25
|
+
get(target, prop) {
|
|
26
|
+
if (prop === "write") {
|
|
27
|
+
return writeToStdout;
|
|
28
|
+
}
|
|
29
|
+
if (isKey(prop, target)) {
|
|
30
|
+
const value = target[prop];
|
|
31
|
+
if (typeof value === "function") {
|
|
32
|
+
return value.bind(target);
|
|
33
|
+
}
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
return undefined;
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
const inkStdout = new Proxy(process.stdout, stdoutHandler);
|
|
40
|
+
const stderrHandler = {
|
|
41
|
+
get(target, prop) {
|
|
42
|
+
if (prop === "write") {
|
|
43
|
+
return writeToStderr;
|
|
44
|
+
}
|
|
45
|
+
if (isKey(prop, target)) {
|
|
46
|
+
const value = target[prop];
|
|
47
|
+
if (typeof value === "function") {
|
|
48
|
+
return value.bind(target);
|
|
49
|
+
}
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
const inkStderr = new Proxy(process.stderr, stderrHandler);
|
|
56
|
+
return { stdout: inkStdout, stderr: inkStderr };
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=stdio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../../../src/cli/utils/stdio.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACtE,MAAM,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAEtE;;GAEG;AACH,MAAM,UAAU,aAAa,CAC5B,GAAG,IAA6C;IAEhD,OAAO,mBAAmB,CAAC,GAAG,IAAI,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,aAAa,CAC5B,GAAG,IAA6C;IAEhD,OAAO,mBAAmB,CAAC,GAAG,IAAI,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,KAAK,CACb,GAA6B,EAC7B,GAAM;IAEN,OAAO,GAAG,IAAI,GAAG,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB;IACjC,MAAM,aAAa,GAAwC;QAC1D,GAAG,CAAC,MAAM,EAAE,IAAI;YACf,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;gBACtB,OAAO,aAAa,CAAC;YACtB,CAAC;YACD,IAAI,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;gBACzB,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;gBAC3B,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;oBACjC,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBAC3B,CAAC;gBACD,OAAO,KAAK,CAAC;YACd,CAAC;YACD,OAAO,SAAS,CAAC;QAClB,CAAC;KACD,CAAC;IACF,MAAM,SAAS,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAE3D,MAAM,aAAa,GAAwC;QAC1D,GAAG,CAAC,MAAM,EAAE,IAAI;YACf,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;gBACtB,OAAO,aAAa,CAAC;YACtB,CAAC;YACD,IAAI,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;gBACzB,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;gBAC3B,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;oBACjC,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBAC3B,CAAC;gBACD,OAAO,KAAK,CAAC;YACd,CAAC;YACD,OAAO,SAAS,CAAC;QAClB,CAAC;KACD,CAAC;IACF,MAAM,SAAS,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAE3D,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANSI escape codes for disabling mouse tracking.
|
|
3
|
+
*/
|
|
4
|
+
export declare function disableMouseTracking(): void;
|
|
5
|
+
export declare function enableMouseEvents(): void;
|
|
6
|
+
export declare function disableMouseEvents(): void;
|
|
7
|
+
export declare function enableModifyOtherKeys(): void;
|
|
8
|
+
export declare function disableModifyOtherKeys(): void;
|
|
9
|
+
export declare function enableBracketedPasteMode(): void;
|
|
10
|
+
export declare function disableBracketedPasteMode(): void;
|
|
11
|
+
export declare function enableLineWrapping(): void;
|
|
12
|
+
export declare function disableLineWrapping(): void;
|
|
13
|
+
export declare function enterAlternateScreen(): void;
|
|
14
|
+
export declare function exitAlternateScreen(): void;
|
|
15
|
+
export declare function shouldEnterAlternateScreen(useAlternateBuffer: boolean, isScreenReader: boolean): boolean;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { writeToStdout } from "./stdio.js";
|
|
2
|
+
/**
|
|
3
|
+
* ANSI escape codes for disabling mouse tracking.
|
|
4
|
+
*/
|
|
5
|
+
export function disableMouseTracking() {
|
|
6
|
+
writeToStdout([
|
|
7
|
+
"\x1b[?1000l", // Normal tracking
|
|
8
|
+
"\x1b[?1003l", // Any-event tracking
|
|
9
|
+
"\x1b[?1015l", // urxvt extended mouse mode
|
|
10
|
+
"\x1b[?1006l", // SGR-style mouse tracking
|
|
11
|
+
"\x1b[?1002l", // Button-event tracking
|
|
12
|
+
].join(""));
|
|
13
|
+
}
|
|
14
|
+
export function enableMouseEvents() {
|
|
15
|
+
// Enable mouse tracking with SGR format
|
|
16
|
+
// ?1002h = button event tracking (clicks + drags + scroll wheel)
|
|
17
|
+
// ?1006h = SGR extended mouse mode (better coordinate handling)
|
|
18
|
+
writeToStdout("\u001b[?1002h\u001b[?1006h");
|
|
19
|
+
}
|
|
20
|
+
export function disableMouseEvents() {
|
|
21
|
+
// Disable mouse tracking with SGR format
|
|
22
|
+
writeToStdout("\u001b[?1006l\u001b[?1002l");
|
|
23
|
+
}
|
|
24
|
+
export function enableModifyOtherKeys() {
|
|
25
|
+
writeToStdout("\x1b[>4;2m");
|
|
26
|
+
}
|
|
27
|
+
export function disableModifyOtherKeys() {
|
|
28
|
+
writeToStdout("\x1b[>4;0m");
|
|
29
|
+
}
|
|
30
|
+
export function enableBracketedPasteMode() {
|
|
31
|
+
writeToStdout("\x1b[?2004h");
|
|
32
|
+
}
|
|
33
|
+
export function disableBracketedPasteMode() {
|
|
34
|
+
writeToStdout("\x1b[?2004l");
|
|
35
|
+
}
|
|
36
|
+
export function enableLineWrapping() {
|
|
37
|
+
writeToStdout("\x1b[?7h");
|
|
38
|
+
}
|
|
39
|
+
export function disableLineWrapping() {
|
|
40
|
+
writeToStdout("\x1b[?7l");
|
|
41
|
+
}
|
|
42
|
+
export function enterAlternateScreen() {
|
|
43
|
+
writeToStdout("\x1b[?1049h");
|
|
44
|
+
}
|
|
45
|
+
export function exitAlternateScreen() {
|
|
46
|
+
writeToStdout("\x1b[?1049l");
|
|
47
|
+
}
|
|
48
|
+
export function shouldEnterAlternateScreen(useAlternateBuffer, isScreenReader) {
|
|
49
|
+
return useAlternateBuffer && !isScreenReader;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=terminal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal.js","sourceRoot":"","sources":["../../../src/cli/utils/terminal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C;;GAEG;AACH,MAAM,UAAU,oBAAoB;IACnC,aAAa,CACZ;QACC,aAAa,EAAE,kBAAkB;QACjC,aAAa,EAAE,qBAAqB;QACpC,aAAa,EAAE,4BAA4B;QAC3C,aAAa,EAAE,2BAA2B;QAC1C,aAAa,EAAE,wBAAwB;KACvC,CAAC,IAAI,CAAC,EAAE,CAAC,CACV,CAAC;AACH,CAAC;AAED,MAAM,UAAU,iBAAiB;IAChC,wCAAwC;IACxC,iEAAiE;IACjE,gEAAgE;IAChE,aAAa,CAAC,4BAA4B,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,kBAAkB;IACjC,yCAAyC;IACzC,aAAa,CAAC,4BAA4B,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,qBAAqB;IACpC,aAAa,CAAC,YAAY,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,sBAAsB;IACrC,aAAa,CAAC,YAAY,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,wBAAwB;IACvC,aAAa,CAAC,aAAa,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,yBAAyB;IACxC,aAAa,CAAC,aAAa,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,kBAAkB;IACjC,aAAa,CAAC,UAAU,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,mBAAmB;IAClC,aAAa,CAAC,UAAU,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,oBAAoB;IACnC,aAAa,CAAC,aAAa,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,mBAAmB;IAClC,aAAa,CAAC,aAAa,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,0BAA0B,CACzC,kBAA2B,EAC3B,cAAuB;IAEvB,OAAO,kBAAkB,IAAI,CAAC,cAAc,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculates the maximum width of a multi-line ASCII art string.
|
|
3
|
+
* @param asciiArt The ASCII art string.
|
|
4
|
+
* @returns The length of the longest line in the ASCII art.
|
|
5
|
+
*/
|
|
6
|
+
export declare const getAsciiArtWidth: (asciiArt: string) => number;
|
|
7
|
+
/**
|
|
8
|
+
* Checks if a string contains only ASCII characters (0-127).
|
|
9
|
+
*/
|
|
10
|
+
export declare function isAscii(str: string): boolean;
|
|
11
|
+
export declare function toCodePoints(str: string): string[];
|
|
12
|
+
export declare function cpLen(str: string): number;
|
|
13
|
+
/**
|
|
14
|
+
* Converts a code point index to a UTF-16 code unit offset.
|
|
15
|
+
*/
|
|
16
|
+
export declare function cpIndexToOffset(str: string, cpIndex: number): number;
|
|
17
|
+
export declare function cpSlice(str: string, start: number, end?: number): string;
|
|
18
|
+
/**
|
|
19
|
+
* Strip characters that can break terminal rendering.
|
|
20
|
+
*
|
|
21
|
+
* This is a strict sanitization function intended for general display
|
|
22
|
+
* contexts. It strips all C1 control characters (0x80-0x9F) and VT
|
|
23
|
+
* control sequences. For list display contexts where a more lenient
|
|
24
|
+
* approach is needed (preserving C1 characters and only stripping ANSI
|
|
25
|
+
* codes and newlines/tabs), use a separate function instead.
|
|
26
|
+
*
|
|
27
|
+
* Processing order:
|
|
28
|
+
* 1. stripAnsi removes ANSI escape sequences (including 8-bit CSI 0x9B)
|
|
29
|
+
* 2. Regex strips C0, C1, BiDi, and zero-width control characters
|
|
30
|
+
* 3. stripVTControlCharacters removes any remaining VT sequences
|
|
31
|
+
*
|
|
32
|
+
* Characters stripped:
|
|
33
|
+
* - ANSI escape sequences (via strip-ansi)
|
|
34
|
+
* - VT control sequences (via Node.js util.stripVTControlCharacters)
|
|
35
|
+
* - C0 control chars (0x00-0x1F) except TAB(0x09), LF(0x0A), CR(0x0D)
|
|
36
|
+
* - C1 control chars (0x80-0x9F) that can cause display issues
|
|
37
|
+
* - BiDi control chars (U+200E, U+200F, U+202A-U+202E, U+2066-U+2069)
|
|
38
|
+
* - Zero-width chars (U+200B, U+FEFF)
|
|
39
|
+
*
|
|
40
|
+
* Characters preserved:
|
|
41
|
+
* - All printable Unicode including emojis
|
|
42
|
+
* - ZWJ (U+200D) - needed for complex emoji sequences
|
|
43
|
+
* - ZWNJ (U+200C) - preserve zero-width non-joiner
|
|
44
|
+
* - DEL (0x7F) - handled functionally by applyOperations, not a display issue
|
|
45
|
+
* - CR/LF (0x0D/0x0A) - needed for line breaks
|
|
46
|
+
* - TAB (0x09) - preserve tabs
|
|
47
|
+
*/
|
|
48
|
+
export declare function stripUnsafeCharacters(str: string): string;
|
|
49
|
+
/**
|
|
50
|
+
* Sanitize a string for display in inline UI components (e.g. Help, Suggestions).
|
|
51
|
+
* Removes ANSI codes, dangerous control characters, collapses whitespace
|
|
52
|
+
* characters into a single space, and optionally truncates.
|
|
53
|
+
*/
|
|
54
|
+
export declare function sanitizeForDisplay(str: string, maxLength?: number): string;
|
|
55
|
+
/**
|
|
56
|
+
* Normalizes escaped newline characters (e.g., "\\n") into actual newline characters.
|
|
57
|
+
*/
|
|
58
|
+
export declare function normalizeEscapedNewlines(value: string): string;
|
|
59
|
+
/**
|
|
60
|
+
* Cached version of stringWidth function for better performance
|
|
61
|
+
*/
|
|
62
|
+
export declare const getCachedStringWidth: (str: string) => number;
|
|
63
|
+
export declare function escapeAnsiCtrlCodes<T>(obj: T): T;
|