@sunub/obsidian-mcp-server 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +15 -0
- package/README.md +392 -153
- package/build/cli/AppContainer.d.ts +1 -0
- package/build/cli/AppContainer.js +197 -0
- package/build/cli/AppContainer.js.map +1 -0
- package/build/cli/app.js +7 -0
- package/build/cli/app.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 +18 -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 +180 -0
- package/build/cli/config/settingSchema.js +128 -0
- package/build/cli/config/settingSchema.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 +474 -0
- package/build/cli/context/KeypressContext.util.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/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 +13 -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.d.ts +12 -0
- package/build/cli/hooks/useLlmStream.js +365 -0
- package/build/cli/hooks/useLlmStream.js.map +1 -0
- package/build/cli/hooks/useMcpClient.d.ts +10 -0
- package/build/cli/hooks/useMcpClient.js +100 -0
- package/build/cli/hooks/useMcpClient.js.map +1 -0
- package/build/cli/hooks/useMcpManager.d.ts +22 -0
- package/build/cli/hooks/useMcpManager.js +86 -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 +83 -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 +9 -0
- package/build/cli/hooks/useTerminalSize.js +26 -0
- package/build/cli/hooks/useTerminalSize.js.map +1 -0
- package/build/cli/index.js +27 -0
- package/build/cli/index.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 +27 -0
- package/build/cli/key/keyMatchers.js +33 -0
- package/build/cli/key/keyMatchers.js.map +1 -0
- package/build/cli/key/text-buffer-bestcase.js +2754 -0
- package/build/cli/key/text-buffer-bestcase.js.map +1 -0
- package/build/cli/key/text-buffer.js +918 -0
- package/build/cli/key/text-buffer.js.map +1 -0
- package/build/cli/reference/HistoryItemDisplay.d.ts +23 -0
- package/build/cli/reference/HistoryItemDisplay.js +63 -0
- package/build/cli/reference/HistoryItemDisplay.js.map +1 -0
- package/build/cli/reference/InputContext.d.ts +17 -0
- package/build/cli/reference/InputContext.js +16 -0
- package/build/cli/reference/InputContext.js.map +1 -0
- package/build/cli/reference/KerypressContext.d.ts +37 -0
- package/build/cli/reference/KerypressContext.js +791 -0
- package/build/cli/reference/KerypressContext.js.map +1 -0
- package/build/cli/reference/MainContent.d.ts +6 -0
- package/build/cli/reference/MainContent.js +207 -0
- package/build/cli/reference/MainContent.js.map +1 -0
- package/build/cli/reference/UIStateContext.d.ts +188 -0
- package/build/cli/reference/UIStateContext.js +16 -0
- package/build/cli/reference/UIStateContext.js.map +1 -0
- package/build/cli/reference/useGeminiStream.d.ts +42 -0
- package/build/cli/reference/useGeminiStream.js +1404 -0
- package/build/cli/reference/useGeminiStream.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/no-color.js +125 -0
- package/build/cli/theme/builtin/no-color.js.map +1 -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.js +19 -0
- package/build/cli/theme/semantic-colors.js.map +1 -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.js +333 -0
- package/build/cli/theme/theme.js.map +1 -0
- package/build/cli/tmp.js +27 -0
- package/build/cli/tmp.js.map +1 -0
- package/build/cli/types.d.ts +72 -0
- package/build/cli/types.js +8 -0
- package/build/cli/types.js.map +1 -0
- package/build/cli/ui/ConnectionStatus.d.ts +13 -0
- package/build/cli/ui/ConnectionStatus.js +24 -0
- package/build/cli/ui/ConnectionStatus.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 +38 -0
- package/build/cli/ui/HistoryItemDisplay.js.map +1 -0
- package/build/cli/ui/InputPrompt-bestcase.d.ts +63 -0
- package/build/cli/ui/InputPrompt-bestcase.js +1301 -0
- package/build/cli/ui/InputPrompt-bestcase.js.map +1 -0
- package/build/cli/ui/InputPrompt.d.ts +12 -0
- package/build/cli/ui/InputPrompt.js +145 -0
- package/build/cli/ui/InputPrompt.js.map +1 -0
- package/build/cli/ui/InputPrompt.tmp.d.ts +7 -0
- package/build/cli/ui/InputPrompt.tmp.js +215 -0
- package/build/cli/ui/InputPrompt.tmp.js.map +1 -0
- package/build/cli/ui/MainContent.d.ts +10 -0
- package/build/cli/ui/MainContent.js +24 -0
- package/build/cli/ui/MainContent.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/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/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/debugLogger.d.ts +12 -0
- package/build/cli/utils/debugLogger.js +52 -0
- package/build/cli/utils/debugLogger.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/textUtil.d.ts +68 -0
- package/build/cli/utils/textUtil.js +236 -0
- package/build/cli/utils/textUtil.js.map +1 -0
- package/build/config.js +31 -5
- package/build/config.js.map +1 -0
- package/build/db.js +55 -0
- package/build/db.js.map +1 -0
- package/build/index.js +4 -4
- package/build/index.js.map +1 -0
- package/build/tools/create_document_with_properties/index.d.ts +60 -0
- package/build/tools/create_document_with_properties/index.js +6 -0
- 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/build/tools/generate_property/index.js +6 -0
- package/build/tools/generate_property/index.js.map +1 -0
- package/build/tools/index.d.ts +184 -0
- package/build/tools/organize_attachments/index.js +6 -0
- package/build/tools/organize_attachments/index.js.map +1 -0
- package/build/tools/organize_attachments/params.d.ts +122 -0
- package/build/tools/vault/index.js +16 -2
- package/build/tools/vault/index.js.map +1 -0
- package/build/tools/vault/params.d.ts +115 -0
- package/build/tools/vault/types/collect_context.d.ts +1340 -0
- package/build/tools/vault/types/list_all.d.ts +387 -0
- package/build/tools/vault/types/read_specific.d.ts +297 -0
- package/build/tools/vault/types/search.d.ts +598 -0
- package/build/tools/vault/utils/actions/collect_context.js +26 -1
- package/build/tools/vault/utils/actions/collect_context.js.map +1 -0
- package/build/tools/vault/utils/actions/index_rag.js +27 -0
- package/build/tools/vault/utils/actions/index_rag.js.map +1 -0
- package/build/tools/vault/utils/actions/list_all.js +1 -0
- package/build/tools/vault/utils/actions/list_all.js.map +1 -0
- package/build/tools/vault/utils/actions/load_memory.js +23 -13
- package/build/tools/vault/utils/actions/load_memory.js.map +1 -0
- package/build/tools/vault/utils/actions/read.js +2 -1
- package/build/tools/vault/utils/actions/read.js.map +1 -0
- package/build/tools/vault/utils/actions/search.js +2 -1
- package/build/tools/vault/utils/actions/search.js.map +1 -0
- package/build/tools/vault/utils/actions/search_semantic.js +54 -0
- package/build/tools/vault/utils/actions/search_semantic.js.map +1 -0
- package/build/tools/vault/utils/actions/stats.js +1 -0
- package/build/tools/vault/utils/actions/stats.js.map +1 -0
- package/build/tools/vault/utils/document.js +1 -0
- package/build/tools/vault/utils/document.js.map +1 -0
- package/build/tools/write_property/index.d.ts +58 -0
- package/build/tools/write_property/index.js +6 -0
- package/build/tools/write_property/index.js.map +1 -0
- package/build/utils/DirectoryWalker.d.ts +6 -0
- package/build/utils/DirectoryWalker.js +7 -0
- package/build/utils/DirectoryWalker.js.map +1 -0
- package/build/utils/Indexer.d.ts +18 -0
- package/build/utils/Indexer.js +5 -9
- package/build/utils/Indexer.js.map +1 -0
- package/build/utils/LLMClient.d.ts +37 -0
- package/build/utils/LLMClient.js +82 -0
- package/build/utils/LLMClient.js.map +1 -0
- package/build/utils/RAGIndexer.d.ts +22 -0
- package/build/utils/RAGIndexer.js +206 -0
- package/build/utils/RAGIndexer.js.map +1 -0
- package/build/utils/RerankerClient.d.ts +27 -0
- package/build/utils/RerankerClient.js +69 -0
- package/build/utils/RerankerClient.js.map +1 -0
- package/build/utils/VaultManger/VaultManager.d.ts +34 -0
- package/build/utils/VaultManger/VaultManager.js +1 -0
- package/build/utils/VaultManger/VaultManager.js.map +1 -0
- package/build/utils/VaultManger/VaultPathError.d.ts +6 -0
- package/build/utils/VaultManger/VaultPathError.js +1 -0
- package/build/utils/VaultManger/VaultPathError.js.map +1 -0
- package/build/utils/VaultManger/index.d.ts +3 -0
- package/build/utils/VaultManger/index.js +1 -0
- package/build/utils/VaultManger/index.js.map +1 -0
- package/build/utils/VaultManger/types.d.ts +16 -0
- package/build/utils/VaultManger/types.js +1 -0
- package/build/utils/VaultManger/types.js.map +1 -0
- package/build/utils/VaultWatcher.d.ts +8 -0
- package/build/utils/VaultWatcher.js +96 -0
- package/build/utils/VaultWatcher.js.map +1 -0
- package/build/utils/VectorDB.d.ts +53 -0
- package/build/utils/VectorDB.js +243 -0
- package/build/utils/VectorDB.js.map +1 -0
- package/build/utils/createToolError.d.ts +2 -0
- package/build/utils/createToolError.js +1 -0
- package/build/utils/createToolError.js.map +1 -0
- package/build/utils/getVaultManager.d.ts +2 -0
- package/build/utils/getVaultManager.js +1 -0
- package/build/utils/getVaultManager.js.map +1 -0
- package/build/utils/processor/LinkExtractor.d.ts +2 -0
- package/build/utils/processor/LinkExtractor.js +1 -0
- package/build/utils/processor/LinkExtractor.js.map +1 -0
- package/build/utils/processor/MatterParser.d.ts +2 -0
- package/build/utils/processor/MatterParser.js +12 -3
- package/build/utils/processor/MatterParser.js.map +1 -0
- package/build/utils/processor/types.d.ts +100 -0
- package/package.json +28 -7
- package/build/server.js +0 -32
- package/build/tools/create_document_with_properties/params.js +0 -32
- package/build/tools/generate_property/params.js +0 -54
- package/build/tools/index.js +0 -12
- package/build/tools/organize_attachments/params.js +0 -60
- package/build/tools/organize_attachments/utils.js +0 -65
- package/build/tools/vault/metrics.js +0 -126
- package/build/tools/vault/params.js +0 -141
- package/build/tools/vault/types/collect_context.js +0 -102
- package/build/tools/vault/types/list_all.js +0 -52
- package/build/tools/vault/types/read_specific.js +0 -40
- package/build/tools/vault/types/search.js +0 -58
- package/build/tools/vault/utils/constants.js +0 -2
- package/build/tools/vault/utils/shared.js +0 -74
- package/build/tools/vault/utils.js +0 -6
- package/build/tools/write_property/params.js +0 -51
- package/build/utils/processor/types.js +0 -27
- package/build/utils/semaphore.js +0 -25
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
export var MergeStrategy;
|
|
2
|
+
(function (MergeStrategy) {
|
|
3
|
+
MergeStrategy["SHALLOW_MERGE"] = "shallow_merge";
|
|
4
|
+
MergeStrategy["CONCAT"] = "concat";
|
|
5
|
+
MergeStrategy["UNION"] = "union";
|
|
6
|
+
MergeStrategy["REPLACE"] = "replace";
|
|
7
|
+
})(MergeStrategy || (MergeStrategy = {}));
|
|
8
|
+
export const SETTINGS_SCHEMA = {
|
|
9
|
+
// 1. Obsidian Vault 설정 (핵심)
|
|
10
|
+
obsidian: {
|
|
11
|
+
type: "object",
|
|
12
|
+
label: "Obsidian Vault",
|
|
13
|
+
category: "Obsidian",
|
|
14
|
+
requiresRestart: true,
|
|
15
|
+
default: {},
|
|
16
|
+
description: "Obsidian Vault 연동 및 데이터 관리 설정",
|
|
17
|
+
showInDialog: true,
|
|
18
|
+
properties: {
|
|
19
|
+
vaultPath: {
|
|
20
|
+
type: "string",
|
|
21
|
+
label: "Vault 절대 경로",
|
|
22
|
+
category: "Obsidian",
|
|
23
|
+
requiresRestart: true,
|
|
24
|
+
default: "",
|
|
25
|
+
description: "Obsidian Vault 디렉토리의 절대 경로 (VAULT_DIR_PATH)",
|
|
26
|
+
showInDialog: true,
|
|
27
|
+
},
|
|
28
|
+
loggingLevel: {
|
|
29
|
+
type: "enum",
|
|
30
|
+
label: "로그 레벨",
|
|
31
|
+
category: "Obsidian",
|
|
32
|
+
requiresRestart: false,
|
|
33
|
+
default: "info",
|
|
34
|
+
description: "서버 로그 기록 상세 수준",
|
|
35
|
+
showInDialog: true,
|
|
36
|
+
options: [
|
|
37
|
+
{ value: "debug", label: "Debug" },
|
|
38
|
+
{ value: "info", label: "Info" },
|
|
39
|
+
{ value: "warn", label: "Warn" },
|
|
40
|
+
{ value: "error", label: "Error" },
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
metricsLogPath: {
|
|
44
|
+
type: "string",
|
|
45
|
+
label: "메트릭 로그 경로",
|
|
46
|
+
category: "Obsidian",
|
|
47
|
+
requiresRestart: false,
|
|
48
|
+
default: "",
|
|
49
|
+
description: "토큰 사용량 등 메트릭을 기록할 JSONL 파일 경로 (VAULT_METRICS_LOG_PATH)",
|
|
50
|
+
showInDialog: true,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
// 2. LLM & RAG 설정 (GEMINI.md 기준 필수)
|
|
55
|
+
llm: {
|
|
56
|
+
type: "object",
|
|
57
|
+
label: "LLM (Local RAG)",
|
|
58
|
+
category: "RAG",
|
|
59
|
+
requiresRestart: true,
|
|
60
|
+
default: {},
|
|
61
|
+
description: "로컬 AI 모델 연동 및 임베딩 설정",
|
|
62
|
+
showInDialog: true,
|
|
63
|
+
properties: {
|
|
64
|
+
apiUrl: {
|
|
65
|
+
type: "string",
|
|
66
|
+
label: "Chat API URL",
|
|
67
|
+
category: "RAG",
|
|
68
|
+
requiresRestart: true,
|
|
69
|
+
default: "http://127.0.0.1:8080",
|
|
70
|
+
description: "로컬 LLM 채팅 서버 주소 (LLM_API_URL)",
|
|
71
|
+
showInDialog: true,
|
|
72
|
+
},
|
|
73
|
+
embeddingApiUrl: {
|
|
74
|
+
type: "string",
|
|
75
|
+
label: "Embedding API URL",
|
|
76
|
+
category: "RAG",
|
|
77
|
+
requiresRestart: true,
|
|
78
|
+
default: "http://127.0.0.1:8081",
|
|
79
|
+
description: "로컬 임베딩 서버 주소 (LLM_EMBEDDING_API_URL)",
|
|
80
|
+
showInDialog: true,
|
|
81
|
+
},
|
|
82
|
+
embedModel: {
|
|
83
|
+
type: "string",
|
|
84
|
+
label: "임베딩 모델",
|
|
85
|
+
category: "RAG",
|
|
86
|
+
requiresRestart: true,
|
|
87
|
+
default: "nomic-embed-text",
|
|
88
|
+
description: "벡터화에 사용할 임베딩 모델명 (LLM_EMBEDDING_MODEL)",
|
|
89
|
+
showInDialog: true,
|
|
90
|
+
},
|
|
91
|
+
chatModel: {
|
|
92
|
+
type: "string",
|
|
93
|
+
label: "채팅 모델",
|
|
94
|
+
category: "RAG",
|
|
95
|
+
requiresRestart: true,
|
|
96
|
+
default: "llama3",
|
|
97
|
+
description: "답변 생성에 사용할 모델명 (LLM_CHAT_MODEL)",
|
|
98
|
+
showInDialog: true,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
// 3. 일반 설정
|
|
103
|
+
general: {
|
|
104
|
+
type: "object",
|
|
105
|
+
label: "일반 설정",
|
|
106
|
+
category: "General",
|
|
107
|
+
requiresRestart: false,
|
|
108
|
+
default: {},
|
|
109
|
+
description: "일반적인 애플리케이션 설정",
|
|
110
|
+
showInDialog: true,
|
|
111
|
+
properties: {
|
|
112
|
+
defaultApprovalMode: {
|
|
113
|
+
type: "enum",
|
|
114
|
+
label: "도구 승인 모드",
|
|
115
|
+
category: "General",
|
|
116
|
+
requiresRestart: false,
|
|
117
|
+
default: "default",
|
|
118
|
+
description: "도구 실행 시 승인 절차를 제어합니다.",
|
|
119
|
+
showInDialog: true,
|
|
120
|
+
options: [
|
|
121
|
+
{ value: "default", label: "승인 필요" },
|
|
122
|
+
{ value: "auto_edit", label: "자동 수정 허용" },
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
//# sourceMappingURL=settingSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settingSchema.js","sourceRoot":"","sources":["../../../src/cli/config/settingSchema.ts"],"names":[],"m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,SAAS;QACnB,eAAe,EAAE,KAAK;QACtB,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,gBAAgB;QAC7B,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE;YACX,mBAAmB,EAAE;gBACpB,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,UAAU;gBACjB,QAAQ,EAAE,SAAS;gBACnB,eAAe,EAAE,KAAK;gBACtB,OAAO,EAAE,SAAS;gBAClB,WAAW,EAAE,uBAAuB;gBACpC,YAAY,EAAE,IAAI;gBAClB,OAAO,EAAE;oBACR,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE;oBACpC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE;iBACzC;aACD;SACD;KACD;CACiC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TextBuffer } from "../key/text-buffer.js";
|
|
2
|
+
export interface InputState {
|
|
3
|
+
buffer: TextBuffer;
|
|
4
|
+
userMessages: string[];
|
|
5
|
+
shellModeActive: boolean;
|
|
6
|
+
showEscapePrompt: boolean;
|
|
7
|
+
copyModeEnabled: boolean | undefined;
|
|
8
|
+
inputWidth: number;
|
|
9
|
+
suggestionsWidth: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const InputContext: import("react").Context<InputState | null>;
|
|
12
|
+
export declare const useInputState: () => InputState;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
export const InputContext = createContext(null);
|
|
3
|
+
export const useInputState = () => {
|
|
4
|
+
const context = useContext(InputContext);
|
|
5
|
+
if (!context) {
|
|
6
|
+
throw new Error("useInputState must be used within an InputProvider");
|
|
7
|
+
}
|
|
8
|
+
return context;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=InputContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputContext.js","sourceRoot":"","sources":["../../../src/cli/context/InputContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAalD,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAoB,IAAI,CAAC,CAAC;AAEnE,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE;IACjC,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IACzC,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
export declare const BACKSLASH_ENTER_TIMEOUT = 5;
|
|
3
|
+
export declare const ESC_TIMEOUT = 50;
|
|
4
|
+
export declare const PASTE_TIMEOUT = 30000;
|
|
5
|
+
export declare const FAST_RETURN_TIMEOUT = 30;
|
|
6
|
+
export declare enum KeypressPriority {
|
|
7
|
+
Low = -100,
|
|
8
|
+
Normal = 0,
|
|
9
|
+
High = 100,
|
|
10
|
+
Critical = 200
|
|
11
|
+
}
|
|
12
|
+
export interface Key {
|
|
13
|
+
name: string;
|
|
14
|
+
shift: boolean;
|
|
15
|
+
alt: boolean;
|
|
16
|
+
ctrl: boolean;
|
|
17
|
+
cmd: boolean;
|
|
18
|
+
insertable: boolean;
|
|
19
|
+
sequence: string;
|
|
20
|
+
}
|
|
21
|
+
interface KeypressContextValue {
|
|
22
|
+
subscribe: (handler: KeypressHandler, priority?: KeypressPriority | boolean) => void;
|
|
23
|
+
unsubscribe: (handler: KeypressHandler) => void;
|
|
24
|
+
}
|
|
25
|
+
export type KeypressHandler = (key: Key) => boolean | undefined;
|
|
26
|
+
export declare function KeypressProvider({ children }: {
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare function useKeypressContext(): KeypressContextValue;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useStdin } from "ink";
|
|
3
|
+
import { MultiMap } from "mnemonist";
|
|
4
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, } from "react";
|
|
5
|
+
import { emitKeys, nonKeyboardEventFilter } from "./KeypressContext.util.js";
|
|
6
|
+
export const BACKSLASH_ENTER_TIMEOUT = 5;
|
|
7
|
+
export const ESC_TIMEOUT = 50;
|
|
8
|
+
export const PASTE_TIMEOUT = 30_000;
|
|
9
|
+
export const FAST_RETURN_TIMEOUT = 30;
|
|
10
|
+
export var KeypressPriority;
|
|
11
|
+
(function (KeypressPriority) {
|
|
12
|
+
KeypressPriority[KeypressPriority["Low"] = -100] = "Low";
|
|
13
|
+
KeypressPriority[KeypressPriority["Normal"] = 0] = "Normal";
|
|
14
|
+
KeypressPriority[KeypressPriority["High"] = 100] = "High";
|
|
15
|
+
KeypressPriority[KeypressPriority["Critical"] = 200] = "Critical";
|
|
16
|
+
})(KeypressPriority || (KeypressPriority = {}));
|
|
17
|
+
/**
|
|
18
|
+
* Buffers "/" keys to see if they are followed return.
|
|
19
|
+
* Will flush the buffer if no data is received for DRAG_COMPLETION_TIMEOUT_MS
|
|
20
|
+
* or when a null key is received.
|
|
21
|
+
*/
|
|
22
|
+
function bufferBackslashEnter(keypressHandler) {
|
|
23
|
+
const bufferer = (function* () {
|
|
24
|
+
while (true) {
|
|
25
|
+
const key = yield;
|
|
26
|
+
if (key == null) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
else if (key.sequence !== "\\") {
|
|
30
|
+
keypressHandler(key);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
const timeoutId = setTimeout(() => bufferer.next(null), BACKSLASH_ENTER_TIMEOUT);
|
|
34
|
+
const nextKey = yield;
|
|
35
|
+
clearTimeout(timeoutId);
|
|
36
|
+
if (nextKey === null) {
|
|
37
|
+
keypressHandler(key);
|
|
38
|
+
}
|
|
39
|
+
else if (nextKey.name === "enter") {
|
|
40
|
+
keypressHandler({
|
|
41
|
+
...nextKey,
|
|
42
|
+
shift: true,
|
|
43
|
+
sequence: "\r",
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
keypressHandler(key);
|
|
48
|
+
keypressHandler(nextKey);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
})();
|
|
52
|
+
bufferer.next(); // prime the generator so it starts listening.
|
|
53
|
+
return (key) => {
|
|
54
|
+
bufferer.next(key);
|
|
55
|
+
return undefined;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Buffers paste events between paste-start and paste-end sequences.
|
|
60
|
+
* Will flush the buffer if no data is received for PASTE_TIMEOUT ms or
|
|
61
|
+
* when a null key is received.
|
|
62
|
+
*/
|
|
63
|
+
function bufferPaste(keypressHandler) {
|
|
64
|
+
const bufferer = (function* () {
|
|
65
|
+
while (true) {
|
|
66
|
+
let key = yield;
|
|
67
|
+
if (key === null) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
else if (key.name !== "paste-start") {
|
|
71
|
+
keypressHandler(key);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
let buffer = "";
|
|
75
|
+
while (true) {
|
|
76
|
+
const timeoutId = setTimeout(() => bufferer.next(null), PASTE_TIMEOUT);
|
|
77
|
+
key = yield;
|
|
78
|
+
clearTimeout(timeoutId);
|
|
79
|
+
if (key === null) {
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
if (key.name === "paste-end") {
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
buffer += key.sequence;
|
|
86
|
+
}
|
|
87
|
+
if (buffer.length > 0) {
|
|
88
|
+
keypressHandler({
|
|
89
|
+
name: "paste",
|
|
90
|
+
shift: false,
|
|
91
|
+
alt: false,
|
|
92
|
+
ctrl: false,
|
|
93
|
+
cmd: false,
|
|
94
|
+
insertable: true,
|
|
95
|
+
sequence: buffer,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
})();
|
|
100
|
+
bufferer.next(); // prime the generator so it starts listening.
|
|
101
|
+
return (key) => {
|
|
102
|
+
bufferer.next(key);
|
|
103
|
+
return undefined;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Turns raw data strings into keypress events sent to the provided handler.
|
|
108
|
+
* Buffers escape sequences until a full sequence is received or
|
|
109
|
+
* until a timeout occurs.
|
|
110
|
+
*/
|
|
111
|
+
function createDataListener(keypressHandler) {
|
|
112
|
+
const parser = emitKeys(keypressHandler);
|
|
113
|
+
parser.next(); // prime the generator so it starts listening.
|
|
114
|
+
let timeoutId;
|
|
115
|
+
return (data) => {
|
|
116
|
+
clearTimeout(timeoutId);
|
|
117
|
+
for (const char of data) {
|
|
118
|
+
parser.next(char);
|
|
119
|
+
}
|
|
120
|
+
if (data.length !== 0) {
|
|
121
|
+
timeoutId = setTimeout(() => parser.next(""), ESC_TIMEOUT);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
const KeypressContext = createContext(undefined);
|
|
126
|
+
export function KeypressProvider({ children }) {
|
|
127
|
+
const { stdin, setRawMode } = useStdin();
|
|
128
|
+
const subscribersToPriority = useRef(new Map()).current;
|
|
129
|
+
const subscribers = useRef(new MultiMap(Set)).current;
|
|
130
|
+
const sortedPriorities = useRef([]);
|
|
131
|
+
const subscribe = useCallback((handler, priority = KeypressPriority.Normal) => {
|
|
132
|
+
const p = typeof priority === "boolean"
|
|
133
|
+
? priority
|
|
134
|
+
? KeypressPriority.High
|
|
135
|
+
: KeypressPriority.Normal
|
|
136
|
+
: priority;
|
|
137
|
+
subscribersToPriority.set(handler, p);
|
|
138
|
+
const hadPriority = subscribers.has(p);
|
|
139
|
+
subscribers.set(p, handler);
|
|
140
|
+
if (!hadPriority) {
|
|
141
|
+
// Cache sorted priorities only when a new priority level is added
|
|
142
|
+
sortedPriorities.current = Array.from(subscribers.keys()).sort((a, b) => b - a);
|
|
143
|
+
}
|
|
144
|
+
}, [subscribers, subscribersToPriority]);
|
|
145
|
+
const unsubscribe = useCallback((handler) => {
|
|
146
|
+
const p = subscribersToPriority.get(handler);
|
|
147
|
+
if (p !== undefined) {
|
|
148
|
+
subscribers.remove(p, handler);
|
|
149
|
+
subscribersToPriority.delete(handler);
|
|
150
|
+
if (!subscribers.has(p)) {
|
|
151
|
+
// Cache sorted priorities only when a priority level is completely removed
|
|
152
|
+
sortedPriorities.current = Array.from(subscribers.keys()).sort((a, b) => b - a);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}, [subscribers, subscribersToPriority]);
|
|
156
|
+
const broadcast = useCallback((key) => {
|
|
157
|
+
// Use cached sorted priorities to avoid sorting on every keypress
|
|
158
|
+
for (const p of sortedPriorities.current) {
|
|
159
|
+
const set = subscribers.get(p);
|
|
160
|
+
if (!set)
|
|
161
|
+
continue;
|
|
162
|
+
// Within a priority level, use stack behavior (last subscribed is first to handle)
|
|
163
|
+
const handlers = Array.from(set).reverse();
|
|
164
|
+
for (const handler of handlers) {
|
|
165
|
+
if (handler(key) === true) {
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return false;
|
|
171
|
+
}, [subscribers]);
|
|
172
|
+
useEffect(() => {
|
|
173
|
+
const wasRaw = stdin.isRaw;
|
|
174
|
+
if (wasRaw === false) {
|
|
175
|
+
setRawMode(true);
|
|
176
|
+
}
|
|
177
|
+
process.stdin.setEncoding("utf8");
|
|
178
|
+
let processor = nonKeyboardEventFilter(broadcast);
|
|
179
|
+
processor = bufferBackslashEnter(processor);
|
|
180
|
+
processor = bufferPaste(processor);
|
|
181
|
+
const dataListener = createDataListener(processor);
|
|
182
|
+
stdin.on("data", dataListener);
|
|
183
|
+
return () => {
|
|
184
|
+
stdin.removeListener("data", dataListener);
|
|
185
|
+
if (wasRaw === false) {
|
|
186
|
+
setRawMode(false);
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
}, [stdin, setRawMode, broadcast]);
|
|
190
|
+
const contextValue = useMemo(() => ({ subscribe, unsubscribe }), [subscribe, unsubscribe]);
|
|
191
|
+
return (_jsx(KeypressContext.Provider, { value: contextValue, children: children }));
|
|
192
|
+
}
|
|
193
|
+
export function useKeypressContext() {
|
|
194
|
+
const context = useContext(KeypressContext);
|
|
195
|
+
if (!context) {
|
|
196
|
+
throw new Error("useKeypressContext must be used within a KeypressProvider");
|
|
197
|
+
}
|
|
198
|
+
return context;
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=KeypressContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeypressContext.js","sourceRoot":"","sources":["../../../src/cli/context/KeypressContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EACN,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,MAAM,GACN,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAE7E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAC9B,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC;AACpC,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AACtC,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC3B,wDAAU,CAAA;IACV,2DAAU,CAAA;IACV,yDAAU,CAAA;IACV,iEAAc,CAAA;AACf,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B;AAs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YAAY,GAAG,OAAO,CAC3B,GAAG,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,EAClC,CAAC,SAAS,EAAE,WAAW,CAAC,CACxB,CAAC;IAEF,OAAO,CACN,KAAC,eAAe,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YAC3C,QAAQ,GACiB,CAC3B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,kBAAkB;IACjC,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IAC5C,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CACd,2DAA2D,CAC3D,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { KeypressHandler } from "./KeypressContext.js";
|
|
2
|
+
export declare const BACKSLASH_ENTER_TIMEOUT = 5;
|
|
3
|
+
export declare const ESC_TIMEOUT = 50;
|
|
4
|
+
export declare const PASTE_TIMEOUT = 30000;
|
|
5
|
+
export declare const FAST_RETURN_TIMEOUT = 30;
|
|
6
|
+
export declare function emitKeys(keypressHandler: KeypressHandler): Generator<void, void, string>;
|
|
7
|
+
export declare function nonKeyboardEventFilter(keypressHandler: KeypressHandler): KeypressHandler;
|