@sunub/obsidian-mcp-server 0.3.4 → 0.3.9

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.
Files changed (323) hide show
  1. package/build/config.d.ts +2 -27
  2. package/build/config.js +11 -31
  3. package/build/config.js.map +1 -1
  4. package/build/db.js +3 -0
  5. package/build/db.js.map +1 -1
  6. package/build/index.js +28 -6
  7. package/build/index.js.map +1 -1
  8. package/build/server.js +16 -13
  9. package/build/server.js.map +1 -1
  10. package/build/setup.d.ts +4 -0
  11. package/build/setup.js +114 -0
  12. package/build/setup.js.map +1 -0
  13. package/build/tools/create_document_with_properties/index.d.ts +5 -5
  14. package/build/tools/create_document_with_properties/index.js +2 -2
  15. package/build/tools/create_document_with_properties/index.js.map +1 -1
  16. package/build/tools/create_document_with_properties/params.d.ts +8 -8
  17. package/build/tools/create_document_with_properties/params.js +1 -1
  18. package/build/tools/create_document_with_properties/params.js.map +1 -1
  19. package/build/tools/generate_property/index.d.ts +1 -1
  20. package/build/tools/generate_property/index.js +1 -1
  21. package/build/tools/generate_property/index.js.map +1 -1
  22. package/build/tools/generate_property/params.d.ts +4 -4
  23. package/build/tools/index.d.ts +8 -8
  24. package/build/tools/index.js +5 -5
  25. package/build/tools/index.js.map +1 -1
  26. package/build/tools/organize_attachments/index.d.ts +1 -1
  27. package/build/tools/organize_attachments/index.js +2 -2
  28. package/build/tools/organize_attachments/index.js.map +1 -1
  29. package/build/tools/vault/index.d.ts +2 -2
  30. package/build/tools/vault/index.js +7 -8
  31. package/build/tools/vault/index.js.map +1 -1
  32. package/build/tools/vault/params.d.ts +4 -4
  33. package/build/tools/vault/types/collect_context.d.ts +58 -58
  34. package/build/tools/vault/types/collect_context.js +1 -1
  35. package/build/tools/vault/types/collect_context.js.map +1 -1
  36. package/build/tools/vault/types/list_all.d.ts +42 -42
  37. package/build/tools/vault/types/list_all.js +2 -2
  38. package/build/tools/vault/types/list_all.js.map +1 -1
  39. package/build/tools/vault/types/read_specific.d.ts +6 -6
  40. package/build/tools/vault/types/read_specific.js +1 -1
  41. package/build/tools/vault/types/read_specific.js.map +1 -1
  42. package/build/tools/vault/types/search.d.ts +70 -70
  43. package/build/tools/vault/utils/actions/collect_context.d.ts +1 -1
  44. package/build/tools/vault/utils/actions/collect_context.js +4 -4
  45. package/build/tools/vault/utils/actions/collect_context.js.map +1 -1
  46. package/build/tools/vault/utils/actions/list_all.d.ts +1 -1
  47. package/build/tools/vault/utils/actions/list_all.js +1 -1
  48. package/build/tools/vault/utils/actions/list_all.js.map +1 -1
  49. package/build/tools/vault/utils/actions/load_memory.d.ts +1 -1
  50. package/build/tools/vault/utils/actions/load_memory.js +3 -3
  51. package/build/tools/vault/utils/actions/load_memory.js.map +1 -1
  52. package/build/tools/vault/utils/actions/read.d.ts +1 -1
  53. package/build/tools/vault/utils/actions/read.js +1 -1
  54. package/build/tools/vault/utils/actions/read.js.map +1 -1
  55. package/build/tools/vault/utils/actions/search.d.ts +1 -1
  56. package/build/tools/vault/utils/actions/search.js +25 -15
  57. package/build/tools/vault/utils/actions/search.js.map +1 -1
  58. package/build/tools/vault/utils/shared.d.ts +1 -1
  59. package/build/tools/vault/utils.d.ts +7 -8
  60. package/build/tools/vault/utils.js +7 -8
  61. package/build/tools/vault/utils.js.map +1 -1
  62. package/build/tools/write_property/index.d.ts +5 -5
  63. package/build/tools/write_property/index.js +1 -1
  64. package/build/tools/write_property/index.js.map +1 -1
  65. package/build/tools/write_property/params.d.ts +8 -8
  66. package/build/utils/DirectoryWalker.d.ts +1 -1
  67. package/build/utils/Embedder.d.ts +11 -0
  68. package/build/utils/Embedder.js +46 -0
  69. package/build/utils/Embedder.js.map +1 -0
  70. package/build/utils/Indexer.d.ts +4 -2
  71. package/build/utils/Indexer.js +19 -2
  72. package/build/utils/Indexer.js.map +1 -1
  73. package/build/utils/LLMClient.js +16 -0
  74. package/build/utils/LLMClient.js.map +1 -1
  75. package/build/utils/LocalReranker.d.ts +17 -0
  76. package/build/utils/LocalReranker.js +71 -0
  77. package/build/utils/LocalReranker.js.map +1 -0
  78. package/build/utils/RAGIndexer.d.ts +10 -1
  79. package/build/utils/RAGIndexer.js +59 -27
  80. package/build/utils/RAGIndexer.js.map +1 -1
  81. package/build/utils/RerankerClient.d.ts +6 -6
  82. package/build/utils/RerankerClient.js +20 -1
  83. package/build/utils/RerankerClient.js.map +1 -1
  84. package/build/utils/VaultManger/VaultManager.d.ts +38 -2
  85. package/build/utils/VaultManger/VaultManager.js +268 -13
  86. package/build/utils/VaultManger/VaultManager.js.map +1 -1
  87. package/build/utils/VaultManger/index.d.ts +3 -3
  88. package/build/utils/VaultManger/index.js +2 -2
  89. package/build/utils/VaultManger/index.js.map +1 -1
  90. package/build/utils/VaultManger/types.d.ts +1 -1
  91. package/build/utils/VaultWatcher.d.ts +1 -1
  92. package/build/utils/VaultWatcher.js +12 -55
  93. package/build/utils/VaultWatcher.js.map +1 -1
  94. package/build/utils/VectorDB.js +31 -6
  95. package/build/utils/VectorDB.js.map +1 -1
  96. package/build/utils/constants.d.ts +3 -0
  97. package/build/utils/constants.js +14 -0
  98. package/build/utils/constants.js.map +1 -0
  99. package/build/utils/getVaultManager.d.ts +1 -1
  100. package/build/utils/getVaultManager.js +1 -1
  101. package/build/utils/getVaultManager.js.map +1 -1
  102. package/build/utils/processor/MatterParser.d.ts +1 -1
  103. package/build/utils/processor/MatterParser.js +1 -1
  104. package/build/utils/processor/MatterParser.js.map +1 -1
  105. package/build/utils/processor/types.d.ts +4 -0
  106. package/build/utils/processor/types.js +1 -0
  107. package/build/utils/processor/types.js.map +1 -1
  108. package/package.json +16 -49
  109. package/LICENSE +0 -15
  110. package/README.md +0 -512
  111. package/build/cli/AppContainer.d.ts +0 -1
  112. package/build/cli/AppContainer.js +0 -197
  113. package/build/cli/AppContainer.js.map +0 -1
  114. package/build/cli/app.d.ts +0 -1
  115. package/build/cli/app.js +0 -7
  116. package/build/cli/app.js.map +0 -1
  117. package/build/cli/colors.d.ts +0 -15
  118. package/build/cli/colors.js +0 -15
  119. package/build/cli/colors.js.map +0 -1
  120. package/build/cli/commands/types.d.ts +0 -19
  121. package/build/cli/commands/types.js +0 -11
  122. package/build/cli/commands/types.js.map +0 -1
  123. package/build/cli/config/SettingContext.d.ts +0 -1
  124. package/build/cli/config/SettingContext.js +0 -2
  125. package/build/cli/config/SettingContext.js.map +0 -1
  126. package/build/cli/config/mcpServersConfig.d.ts +0 -30
  127. package/build/cli/config/mcpServersConfig.js +0 -119
  128. package/build/cli/config/mcpServersConfig.js.map +0 -1
  129. package/build/cli/config/settingSchema.d.ts +0 -180
  130. package/build/cli/config/settingSchema.js +0 -128
  131. package/build/cli/config/settingSchema.js.map +0 -1
  132. package/build/cli/constants.d.ts +0 -47
  133. package/build/cli/constants.js +0 -101
  134. package/build/cli/constants.js.map +0 -1
  135. package/build/cli/context/InputContext.d.ts +0 -12
  136. package/build/cli/context/InputContext.js +0 -10
  137. package/build/cli/context/InputContext.js.map +0 -1
  138. package/build/cli/context/KeypressContext.d.ts +0 -30
  139. package/build/cli/context/KeypressContext.js +0 -200
  140. package/build/cli/context/KeypressContext.js.map +0 -1
  141. package/build/cli/context/KeypressContext.util.d.ts +0 -7
  142. package/build/cli/context/KeypressContext.util.js +0 -474
  143. package/build/cli/context/KeypressContext.util.js.map +0 -1
  144. package/build/cli/hooks/useAtCompletion.d.ts +0 -12
  145. package/build/cli/hooks/useAtCompletion.js +0 -5
  146. package/build/cli/hooks/useAtCompletion.js.map +0 -1
  147. package/build/cli/hooks/useCommandCompletion.d.ts +0 -59
  148. package/build/cli/hooks/useCommandCompletion.js +0 -344
  149. package/build/cli/hooks/useCommandCompletion.js.map +0 -1
  150. package/build/cli/hooks/useCompletion.d.ts +0 -22
  151. package/build/cli/hooks/useCompletion.js +0 -84
  152. package/build/cli/hooks/useCompletion.js.map +0 -1
  153. package/build/cli/hooks/useDispatcher.d.ts +0 -6
  154. package/build/cli/hooks/useDispatcher.js +0 -286
  155. package/build/cli/hooks/useDispatcher.js.map +0 -1
  156. package/build/cli/hooks/useFocus.d.ts +0 -2
  157. package/build/cli/hooks/useFocus.js +0 -3
  158. package/build/cli/hooks/useFocus.js.map +0 -1
  159. package/build/cli/hooks/useInputHistory.d.ts +0 -24
  160. package/build/cli/hooks/useInputHistory.js +0 -159
  161. package/build/cli/hooks/useInputHistory.js.map +0 -1
  162. package/build/cli/hooks/useKeyMatchers.d.ts +0 -17
  163. package/build/cli/hooks/useKeyMatchers.js +0 -13
  164. package/build/cli/hooks/useKeyMatchers.js.map +0 -1
  165. package/build/cli/hooks/useKeypress.d.ts +0 -19
  166. package/build/cli/hooks/useKeypress.js +0 -28
  167. package/build/cli/hooks/useKeypress.js.map +0 -1
  168. package/build/cli/hooks/useLlmStream.d.ts +0 -12
  169. package/build/cli/hooks/useLlmStream.js +0 -365
  170. package/build/cli/hooks/useLlmStream.js.map +0 -1
  171. package/build/cli/hooks/useMcpClient.d.ts +0 -10
  172. package/build/cli/hooks/useMcpClient.js +0 -100
  173. package/build/cli/hooks/useMcpClient.js.map +0 -1
  174. package/build/cli/hooks/useMcpManager.d.ts +0 -22
  175. package/build/cli/hooks/useMcpManager.js +0 -86
  176. package/build/cli/hooks/useMcpManager.js.map +0 -1
  177. package/build/cli/hooks/usePromptCompletion.d.ts +0 -19
  178. package/build/cli/hooks/usePromptCompletion.js +0 -13
  179. package/build/cli/hooks/usePromptCompletion.js.map +0 -1
  180. package/build/cli/hooks/useRagContext.d.ts +0 -6
  181. package/build/cli/hooks/useRagContext.js +0 -83
  182. package/build/cli/hooks/useRagContext.js.map +0 -1
  183. package/build/cli/hooks/useShellCompletion.d.ts +0 -18
  184. package/build/cli/hooks/useShellCompletion.js +0 -10
  185. package/build/cli/hooks/useShellCompletion.js.map +0 -1
  186. package/build/cli/hooks/useSlashCompletion.d.ts +0 -21
  187. package/build/cli/hooks/useSlashCompletion.js +0 -11
  188. package/build/cli/hooks/useSlashCompletion.js.map +0 -1
  189. package/build/cli/hooks/useTerminalSize.d.ts +0 -9
  190. package/build/cli/hooks/useTerminalSize.js +0 -26
  191. package/build/cli/hooks/useTerminalSize.js.map +0 -1
  192. package/build/cli/index.d.ts +0 -1
  193. package/build/cli/index.js +0 -39
  194. package/build/cli/index.js.map +0 -1
  195. package/build/cli/key/input.d.ts +0 -5
  196. package/build/cli/key/input.js +0 -9
  197. package/build/cli/key/input.js.map +0 -1
  198. package/build/cli/key/keyBindings.d.ts +0 -152
  199. package/build/cli/key/keyBindings.js +0 -630
  200. package/build/cli/key/keyBindings.js.map +0 -1
  201. package/build/cli/key/keyMatchers.d.ts +0 -27
  202. package/build/cli/key/keyMatchers.js +0 -33
  203. package/build/cli/key/keyMatchers.js.map +0 -1
  204. package/build/cli/key/mouse.d.ts +0 -23
  205. package/build/cli/key/mouse.js +0 -155
  206. package/build/cli/key/mouse.js.map +0 -1
  207. package/build/cli/key/text-buffer-bestcase.d.ts +0 -867
  208. package/build/cli/key/text-buffer-bestcase.js +0 -2754
  209. package/build/cli/key/text-buffer-bestcase.js.map +0 -1
  210. package/build/cli/key/text-buffer.d.ts +0 -509
  211. package/build/cli/key/text-buffer.js +0 -918
  212. package/build/cli/key/text-buffer.js.map +0 -1
  213. package/build/cli/main.d.ts +0 -1
  214. package/build/cli/main.js +0 -20
  215. package/build/cli/main.js.map +0 -1
  216. package/build/cli/reference/HistoryItemDisplay.d.ts +0 -23
  217. package/build/cli/reference/HistoryItemDisplay.js +0 -63
  218. package/build/cli/reference/HistoryItemDisplay.js.map +0 -1
  219. package/build/cli/reference/InputContext.d.ts +0 -17
  220. package/build/cli/reference/InputContext.js +0 -16
  221. package/build/cli/reference/InputContext.js.map +0 -1
  222. package/build/cli/reference/KerypressContext.d.ts +0 -37
  223. package/build/cli/reference/KerypressContext.js +0 -791
  224. package/build/cli/reference/KerypressContext.js.map +0 -1
  225. package/build/cli/reference/MainContent.d.ts +0 -6
  226. package/build/cli/reference/MainContent.js +0 -207
  227. package/build/cli/reference/MainContent.js.map +0 -1
  228. package/build/cli/reference/UIStateContext.d.ts +0 -188
  229. package/build/cli/reference/UIStateContext.js +0 -16
  230. package/build/cli/reference/UIStateContext.js.map +0 -1
  231. package/build/cli/reference/text-buffer.d.ts +0 -867
  232. package/build/cli/reference/text-buffer.js +0 -2754
  233. package/build/cli/reference/text-buffer.js.map +0 -1
  234. package/build/cli/reference/useGeminiStream.d.ts +0 -42
  235. package/build/cli/reference/useGeminiStream.js +0 -1404
  236. package/build/cli/reference/useGeminiStream.js.map +0 -1
  237. package/build/cli/services/McpClientService.d.ts +0 -32
  238. package/build/cli/services/McpClientService.js +0 -123
  239. package/build/cli/services/McpClientService.js.map +0 -1
  240. package/build/cli/services/McpManager.d.ts +0 -28
  241. package/build/cli/services/McpManager.js +0 -146
  242. package/build/cli/services/McpManager.js.map +0 -1
  243. package/build/cli/theme/builtin/default-dark.d.ts +0 -7
  244. package/build/cli/theme/builtin/default-dark.js +0 -143
  245. package/build/cli/theme/builtin/default-dark.js.map +0 -1
  246. package/build/cli/theme/builtin/no-color.d.ts +0 -7
  247. package/build/cli/theme/builtin/no-color.js +0 -125
  248. package/build/cli/theme/builtin/no-color.js.map +0 -1
  249. package/build/cli/theme/builtin/tokyonight-dark.d.ts +0 -7
  250. package/build/cli/theme/builtin/tokyonight-dark.js +0 -146
  251. package/build/cli/theme/builtin/tokyonight-dark.js.map +0 -1
  252. package/build/cli/theme/semantic-colors.d.ts +0 -2
  253. package/build/cli/theme/semantic-colors.js +0 -19
  254. package/build/cli/theme/semantic-colors.js.map +0 -1
  255. package/build/cli/theme/semantic-tokens.d.ts +0 -42
  256. package/build/cli/theme/semantic-tokens.js +0 -77
  257. package/build/cli/theme/semantic-tokens.js.map +0 -1
  258. package/build/cli/theme/theme-manager.d.ts +0 -32
  259. package/build/cli/theme/theme-manager.js +0 -150
  260. package/build/cli/theme/theme-manager.js.map +0 -1
  261. package/build/cli/theme/theme.d.ts +0 -107
  262. package/build/cli/theme/theme.js +0 -333
  263. package/build/cli/theme/theme.js.map +0 -1
  264. package/build/cli/tmp.d.ts +0 -1
  265. package/build/cli/tmp.js +0 -27
  266. package/build/cli/tmp.js.map +0 -1
  267. package/build/cli/types.d.ts +0 -72
  268. package/build/cli/types.js +0 -8
  269. package/build/cli/types.js.map +0 -1
  270. package/build/cli/ui/ConnectionStatus.d.ts +0 -13
  271. package/build/cli/ui/ConnectionStatus.js +0 -24
  272. package/build/cli/ui/ConnectionStatus.js.map +0 -1
  273. package/build/cli/ui/HelpCommands.d.ts +0 -5
  274. package/build/cli/ui/HelpCommands.js +0 -11
  275. package/build/cli/ui/HelpCommands.js.map +0 -1
  276. package/build/cli/ui/HistoryItemDisplay.d.ts +0 -9
  277. package/build/cli/ui/HistoryItemDisplay.js +0 -38
  278. package/build/cli/ui/HistoryItemDisplay.js.map +0 -1
  279. package/build/cli/ui/InputPrompt-bestcase.d.ts +0 -63
  280. package/build/cli/ui/InputPrompt-bestcase.js +0 -1301
  281. package/build/cli/ui/InputPrompt-bestcase.js.map +0 -1
  282. package/build/cli/ui/InputPrompt.d.ts +0 -12
  283. package/build/cli/ui/InputPrompt.js +0 -145
  284. package/build/cli/ui/InputPrompt.js.map +0 -1
  285. package/build/cli/ui/InputPrompt.tmp.d.ts +0 -7
  286. package/build/cli/ui/InputPrompt.tmp.js +0 -215
  287. package/build/cli/ui/InputPrompt.tmp.js.map +0 -1
  288. package/build/cli/ui/MainContent.d.ts +0 -10
  289. package/build/cli/ui/MainContent.js +0 -24
  290. package/build/cli/ui/MainContent.js.map +0 -1
  291. package/build/cli/ui/MouseContext.d.ts +0 -1
  292. package/build/cli/ui/MouseContext.js +0 -2
  293. package/build/cli/ui/MouseContext.js.map +0 -1
  294. package/build/cli/ui/SuggestionsDisplay.d.ts +0 -25
  295. package/build/cli/ui/SuggestionsDisplay.js +0 -45
  296. package/build/cli/ui/SuggestionsDisplay.js.map +0 -1
  297. package/build/cli/ui/ThinkingIndicator.d.ts +0 -2
  298. package/build/cli/ui/ThinkingIndicator.js +0 -16
  299. package/build/cli/ui/ThinkingIndicator.js.map +0 -1
  300. package/build/cli/ui/layout/DefaultAppLayout.d.ts +0 -2
  301. package/build/cli/ui/layout/DefaultAppLayout.js +0 -6
  302. package/build/cli/ui/layout/DefaultAppLayout.js.map +0 -1
  303. package/build/cli/ui/shared/ExpandableText.d.ts +0 -14
  304. package/build/cli/ui/shared/ExpandableText.js +0 -19
  305. package/build/cli/ui/shared/ExpandableText.js.map +0 -1
  306. package/build/cli/utils/cache.d.ts +0 -21
  307. package/build/cli/utils/cache.js +0 -56
  308. package/build/cli/utils/cache.js.map +0 -1
  309. package/build/cli/utils/commandUtils.d.ts +0 -11
  310. package/build/cli/utils/commandUtils.js +0 -16
  311. package/build/cli/utils/commandUtils.js.map +0 -1
  312. package/build/cli/utils/debugLogger.d.ts +0 -12
  313. package/build/cli/utils/debugLogger.js +0 -54
  314. package/build/cli/utils/debugLogger.js.map +0 -1
  315. package/build/cli/utils/historyStorage.d.ts +0 -13
  316. package/build/cli/utils/historyStorage.js +0 -64
  317. package/build/cli/utils/historyStorage.js.map +0 -1
  318. package/build/cli/utils/textUtil.d.ts +0 -68
  319. package/build/cli/utils/textUtil.js +0 -236
  320. package/build/cli/utils/textUtil.js.map +0 -1
  321. package/build/tools/vault/utils/actions/search_semantic.d.ts +0 -3
  322. package/build/tools/vault/utils/actions/search_semantic.js +0 -71
  323. package/build/tools/vault/utils/actions/search_semantic.js.map +0 -1
@@ -1,236 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { stripVTControlCharacters } from "node:util";
7
- import ansiRegex from "ansi-regex";
8
- import { LRUCache } from "mnemonist";
9
- import stringWidth from "string-width";
10
- import stripAnsi from "strip-ansi";
11
- import { LRU_BUFFER_PERF_CACHE_LIMIT } from "../constants.js";
12
- /**
13
- * Calculates the maximum width of a multi-line ASCII art string.
14
- * @param asciiArt The ASCII art string.
15
- * @returns The length of the longest line in the ASCII art.
16
- */
17
- export const getAsciiArtWidth = (asciiArt) => {
18
- if (!asciiArt) {
19
- return 0;
20
- }
21
- const lines = asciiArt.split("\n");
22
- return Math.max(...lines.map((line) => line.length));
23
- };
24
- /*
25
- * -------------------------------------------------------------------------
26
- * Unicode‑aware helpers (work at the code‑point level rather than UTF‑16
27
- * code units so that surrogate‑pair emoji count as one "column".)
28
- * ---------------------------------------------------------------------- */
29
- /**
30
- * Checks if a string contains only ASCII characters (0-127).
31
- */
32
- export function isAscii(str) {
33
- for (let i = 0; i < str.length; i++) {
34
- if (str.charCodeAt(i) > 127) {
35
- return false;
36
- }
37
- }
38
- return true;
39
- }
40
- // Cache for code points
41
- const MAX_STRING_LENGTH_TO_CACHE = 1000;
42
- const codePointsCache = new LRUCache(LRU_BUFFER_PERF_CACHE_LIMIT);
43
- export function toCodePoints(str) {
44
- // ASCII fast path
45
- if (isAscii(str)) {
46
- return str.split("");
47
- }
48
- // Cache short strings
49
- if (str.length <= MAX_STRING_LENGTH_TO_CACHE) {
50
- const cached = codePointsCache.get(str);
51
- if (cached !== undefined) {
52
- return cached;
53
- }
54
- }
55
- const result = Array.from(str);
56
- // Cache result
57
- if (str.length <= MAX_STRING_LENGTH_TO_CACHE) {
58
- codePointsCache.set(str, result);
59
- }
60
- return result;
61
- }
62
- export function cpLen(str) {
63
- if (isAscii(str)) {
64
- return str.length;
65
- }
66
- return toCodePoints(str).length;
67
- }
68
- /**
69
- * Converts a code point index to a UTF-16 code unit offset.
70
- */
71
- export function cpIndexToOffset(str, cpIndex) {
72
- return cpSlice(str, 0, cpIndex).length;
73
- }
74
- export function cpSlice(str, start, end) {
75
- if (isAscii(str)) {
76
- return str.slice(start, end);
77
- }
78
- // Slice by code‑point indices and re‑join.
79
- const arr = toCodePoints(str).slice(start, end);
80
- return arr.join("");
81
- }
82
- /**
83
- * Strip characters that can break terminal rendering.
84
- *
85
- * This is a strict sanitization function intended for general display
86
- * contexts. It strips all C1 control characters (0x80-0x9F) and VT
87
- * control sequences. For list display contexts where a more lenient
88
- * approach is needed (preserving C1 characters and only stripping ANSI
89
- * codes and newlines/tabs), use a separate function instead.
90
- *
91
- * Processing order:
92
- * 1. stripAnsi removes ANSI escape sequences (including 8-bit CSI 0x9B)
93
- * 2. Regex strips C0, C1, BiDi, and zero-width control characters
94
- * 3. stripVTControlCharacters removes any remaining VT sequences
95
- *
96
- * Characters stripped:
97
- * - ANSI escape sequences (via strip-ansi)
98
- * - VT control sequences (via Node.js util.stripVTControlCharacters)
99
- * - C0 control chars (0x00-0x1F) except TAB(0x09), LF(0x0A), CR(0x0D)
100
- * - C1 control chars (0x80-0x9F) that can cause display issues
101
- * - BiDi control chars (U+200E, U+200F, U+202A-U+202E, U+2066-U+2069)
102
- * - Zero-width chars (U+200B, U+FEFF)
103
- *
104
- * Characters preserved:
105
- * - All printable Unicode including emojis
106
- * - ZWJ (U+200D) - needed for complex emoji sequences
107
- * - ZWNJ (U+200C) - preserve zero-width non-joiner
108
- * - DEL (0x7F) - handled functionally by applyOperations, not a display issue
109
- * - CR/LF (0x0D/0x0A) - needed for line breaks
110
- * - TAB (0x09) - preserve tabs
111
- */
112
- export function stripUnsafeCharacters(str) {
113
- const strippedAnsi = stripAnsi(str);
114
- // Strip C0, C1, and other unsafe characters via regex first.
115
- // This is more efficient than multiple replaces and crucially removes C1
116
- // characters (e.g., 0x90 DCS) before they can be misinterpreted by
117
- // stripVTControlCharacters, which could otherwise cause data loss.
118
- const strippedWithRegex = strippedAnsi.replace(
119
- // biome-ignore lint/suspicious/noControlCharactersInRegex:터미널 입력을 파싱하기 위한 정규식입니다.
120
- /[\x00-\x08\x0B\x0C\x0E-\x1F\x80-\x9F\u200E\u200F\u202A-\u202E\u2066-\u2069\u200B\uFEFF]/g, "");
121
- // Finally, use stripVTControlCharacters for any remaining VT sequences
122
- // that the regex might not cover.
123
- return stripVTControlCharacters(strippedWithRegex);
124
- }
125
- /**
126
- * Sanitize a string for display in inline UI components (e.g. Help, Suggestions).
127
- * Removes ANSI codes, dangerous control characters, collapses whitespace
128
- * characters into a single space, and optionally truncates.
129
- */
130
- export function sanitizeForDisplay(str, maxLength) {
131
- if (!str) {
132
- return "";
133
- }
134
- let sanitized = stripUnsafeCharacters(str).replace(/\s+/g, " ");
135
- if (maxLength && sanitized.length > maxLength) {
136
- sanitized = `${sanitized.substring(0, maxLength - 3)}...`;
137
- }
138
- return sanitized;
139
- }
140
- /**
141
- * Normalizes escaped newline characters (e.g., "\\n") into actual newline characters.
142
- */
143
- export function normalizeEscapedNewlines(value) {
144
- return value.replace(/\\r\\n/g, "\n").replace(/\\n/g, "\n");
145
- }
146
- const stringWidthCache = new LRUCache(LRU_BUFFER_PERF_CACHE_LIMIT);
147
- /**
148
- * Cached version of stringWidth function for better performance
149
- */
150
- export const getCachedStringWidth = (str) => {
151
- // ASCII printable chars (32-126) have width 1.
152
- // This is a very frequent path, so we use a fast numeric check.
153
- if (str.length === 1) {
154
- const code = str.charCodeAt(0);
155
- if (code >= 0x20 && code <= 0x7e) {
156
- return 1;
157
- }
158
- }
159
- const cached = stringWidthCache.get(str);
160
- if (cached !== undefined) {
161
- return cached;
162
- }
163
- let width;
164
- try {
165
- width = stringWidth(str);
166
- }
167
- catch {
168
- // Fallback for characters that cause string-width to crash (e.g. U+0602)
169
- // See: https://github.com/google-gemini/gemini-cli/issues/16418
170
- width = toCodePoints(stripAnsi(str)).length;
171
- }
172
- stringWidthCache.set(str, width);
173
- return width;
174
- };
175
- const regex = ansiRegex();
176
- /* Recursively traverses a JSON-like structure (objects, arrays, primitives)
177
- * and escapes all ANSI control characters found in any string values.
178
- *
179
- * This function is designed to be robust, handling deeply nested objects and
180
- * arrays. It applies a regex-based replacement to all string values to
181
- * safely escape control characters.
182
- *
183
- * To optimize performance, this function uses a "copy-on-write" strategy.
184
- * It avoids allocating new objects or arrays if no nested string values
185
- * required escaping, returning the original object reference in such cases.
186
- *
187
- * @param obj The JSON-like value (object, array, string, etc.) to traverse.
188
- * @returns A new value with all nested string fields escaped, or the
189
- * original `obj` reference if no changes were necessary.
190
- */
191
- export function escapeAnsiCtrlCodes(obj) {
192
- if (typeof obj === "string") {
193
- if (obj.search(regex) === -1) {
194
- return obj; // No changes return original string
195
- }
196
- regex.lastIndex = 0; // needed for global regex
197
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
198
- return obj.replace(regex, (match) => JSON.stringify(match).slice(1, -1));
199
- }
200
- if (obj === null || typeof obj !== "object") {
201
- return obj;
202
- }
203
- if (Array.isArray(obj)) {
204
- let newArr = null;
205
- for (let i = 0; i < obj.length; i++) {
206
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
207
- const value = obj[i];
208
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
209
- const escapedValue = escapeAnsiCtrlCodes(value);
210
- if (escapedValue !== value) {
211
- if (newArr === null) {
212
- newArr = [...obj];
213
- }
214
- newArr[i] = escapedValue;
215
- }
216
- }
217
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
218
- return (newArr !== null ? newArr : obj);
219
- }
220
- let newObj = null;
221
- const keys = Object.keys(obj);
222
- for (const key of keys) {
223
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
224
- const value = obj[key];
225
- const escapedValue = escapeAnsiCtrlCodes(value);
226
- if (escapedValue !== value) {
227
- if (newObj === null) {
228
- newObj = { ...obj };
229
- }
230
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
231
- newObj[key] = escapedValue;
232
- }
233
- }
234
- return newObj !== null ? newObj : obj;
235
- }
236
- //# sourceMappingURL=textUtil.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"textUtil.js","sourceRoot":"","sources":["../../../src/cli/utils/textUtil.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC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contextprotocol/sdk/types.js";
2
- import type { ObsidianContentQueryParams } from "../../params.js";
3
- export declare const searchSemantic: (params: ObsidianContentQueryParams) => Promise<CallToolResult>;
@@ -1,71 +0,0 @@
1
- import { llmClient } from "../../../../utils/LLMClient.js";
2
- import { rerankerClient } from "../../../../utils/RerankerClient.js";
3
- import { vectorDB } from "../../../../utils/VectorDB.js";
4
- function genereateFormattedResult(res, index) {
5
- const fileStr = `File: ${res.fileName}`;
6
- const pathStr = `Path: ${res.filePath}`;
7
- const scoreStr = `Relevance: ${(res.relevance_score * 100).toFixed(2)}%`;
8
- const contextStr = `Context: ${res.context || "N/A"}`;
9
- const contentStr = `Content:\n---\n${res.content}\n---`;
10
- return [
11
- `[Result ${index + 1}]`,
12
- fileStr,
13
- pathStr,
14
- scoreStr,
15
- contextStr,
16
- contentStr,
17
- ].join("\n");
18
- }
19
- export const searchSemantic = async (params) => {
20
- const { query, limit = 5 } = params;
21
- if (!query) {
22
- throw new Error("query is required for semantic search");
23
- }
24
- try {
25
- const queryVector = await llmClient.generateEmbedding(`search_query: ${query}`);
26
- const candidates = await vectorDB.search(queryVector, limit * 4);
27
- if (candidates.length === 0) {
28
- return {
29
- content: [{ type: "text", text: "No relevant documents found." }],
30
- };
31
- }
32
- let finalResults = candidates
33
- .slice(0, limit)
34
- .map((c) => ({ ...c, relevance_score: 0 }));
35
- try {
36
- const rerankedResults = await rerankerClient.rerank(query, candidates.map((c) => c.content), limit);
37
- finalResults = rerankedResults.map((r) => ({
38
- ...candidates[r.index],
39
- relevance_score: r.relevance_score,
40
- }));
41
- }
42
- catch (rerankError) {
43
- console.error("Reranking failed, falling back to vector search results:", rerankError);
44
- // Reranking fails, keep vector search results
45
- }
46
- const formattedResults = finalResults
47
- .map((res, i) => genereateFormattedResult(res, i))
48
- .join("\n\n");
49
- return {
50
- content: [
51
- {
52
- type: "text",
53
- text: `Found ${finalResults.length} relevant chunks for query: "${query}"\n\n${formattedResults}`,
54
- },
55
- ],
56
- };
57
- }
58
- catch (error) {
59
- console.error("Semantic search failed:", error);
60
- return {
61
- content: [
62
- {
63
- type: "text",
64
- text: `Semantic search is currently unavailable. Please check if your embedding server (e.g., Ollama or llama.cpp) is running.\nError: ${error instanceof Error ? error.message : String(error)}`,
65
- },
66
- ],
67
- isError: true,
68
- };
69
- }
70
- };
71
- //# sourceMappingURL=search_semantic.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"search_semantic.js","sourceRoot":"","sources":["../../../../../src/tools/vault/utils/actions/search_semantic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAsB,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGnE,SAAS,wBAAwB,CAChC,GAAgD,EAChD,KAAa;IAEb,MAAM,OAAO,GAAG,SAAS,GAAG,CAAC,QAAQ,EAAE,CAAC;IACxC,MAAM,OAAO,GAAG,SAAS,GAAG,CAAC,QAAQ,EAAE,CAAC;IACxC,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,eAAe,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IACzE,MAAM,UAAU,GAAG,YAAY,GAAG,CAAC,OAAO,IAAI,KAAK,EAAE,CAAC;IACtD,MAAM,UAAU,GAAG,kBAAkB,GAAG,CAAC,OAAO,OAAO,CAAC;IACxD,OAAO;QACN,WAAW,KAAK,GAAG,CAAC,GAAG;QACvB,OAAO;QACP,OAAO;QACP,QAAQ;QACR,UAAU;QACV,UAAU;KACV,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACd,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAClC,MAAkC,EACR,EAAE;IAC5B,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC;IAEpC,IAAI,CAAC,KAAK,EAA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