@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.
Files changed (527) hide show
  1. package/README.md +1 -24
  2. package/build/cli/App.d.ts +1 -0
  3. package/build/cli/App.js +273 -0
  4. package/build/cli/App.js.map +1 -0
  5. package/build/cli/AppContainer.d.ts +1 -0
  6. package/build/cli/AppContainer.js +19 -0
  7. package/build/cli/AppContainer.js.map +1 -0
  8. package/build/cli/colors.d.ts +15 -0
  9. package/build/cli/colors.js +15 -0
  10. package/build/cli/colors.js.map +1 -0
  11. package/build/cli/commands/types.d.ts +19 -0
  12. package/build/cli/commands/types.js +11 -0
  13. package/build/cli/commands/types.js.map +1 -0
  14. package/build/cli/config/SettingContext.d.ts +1 -0
  15. package/build/cli/config/SettingContext.js +2 -0
  16. package/build/cli/config/SettingContext.js.map +1 -0
  17. package/build/cli/config/mcpServersConfig.d.ts +30 -0
  18. package/build/cli/config/mcpServersConfig.js +119 -0
  19. package/build/cli/config/mcpServersConfig.js.map +1 -0
  20. package/build/cli/config/settingSchema.d.ts +162 -0
  21. package/build/cli/config/settingSchema.js +110 -0
  22. package/build/cli/config/settingSchema.js.map +1 -0
  23. package/build/cli/constants.d.ts +47 -0
  24. package/build/cli/constants.js +101 -0
  25. package/build/cli/constants.js.map +1 -0
  26. package/build/cli/context/InputContext.d.ts +12 -0
  27. package/build/cli/context/InputContext.js +10 -0
  28. package/build/cli/context/InputContext.js.map +1 -0
  29. package/build/cli/context/KeypressContext.d.ts +30 -0
  30. package/build/cli/context/KeypressContext.js +200 -0
  31. package/build/cli/context/KeypressContext.js.map +1 -0
  32. package/build/cli/context/KeypressContext.util.d.ts +7 -0
  33. package/build/cli/context/KeypressContext.util.js +476 -0
  34. package/build/cli/context/KeypressContext.util.js.map +1 -0
  35. package/build/cli/errors/index.d.ts +3 -0
  36. package/build/cli/errors/index.js +7 -0
  37. package/build/cli/errors/index.js.map +1 -0
  38. package/build/cli/hooks/useAtCompletion.d.ts +12 -0
  39. package/build/cli/hooks/useAtCompletion.js +5 -0
  40. package/build/cli/hooks/useAtCompletion.js.map +1 -0
  41. package/build/cli/hooks/useCommandCompletion.d.ts +59 -0
  42. package/build/cli/hooks/useCommandCompletion.js +344 -0
  43. package/build/cli/hooks/useCommandCompletion.js.map +1 -0
  44. package/build/cli/hooks/useCompletion.d.ts +22 -0
  45. package/build/cli/hooks/useCompletion.js +84 -0
  46. package/build/cli/hooks/useCompletion.js.map +1 -0
  47. package/build/cli/hooks/useDispatcher.d.ts +6 -0
  48. package/build/cli/hooks/useDispatcher.js +286 -0
  49. package/build/cli/hooks/useDispatcher.js.map +1 -0
  50. package/build/cli/hooks/useFocus.d.ts +2 -0
  51. package/build/cli/hooks/useFocus.js +3 -0
  52. package/build/cli/hooks/useFocus.js.map +1 -0
  53. package/build/cli/hooks/useHistoryManager.d.ts +32 -0
  54. package/build/cli/hooks/useHistoryManager.js +78 -0
  55. package/build/cli/hooks/useHistoryManager.js.map +1 -0
  56. package/build/cli/hooks/useInputHistory.d.ts +24 -0
  57. package/build/cli/hooks/useInputHistory.js +159 -0
  58. package/build/cli/hooks/useInputHistory.js.map +1 -0
  59. package/build/cli/hooks/useKeyMatchers.d.ts +17 -0
  60. package/build/cli/hooks/useKeyMatchers.js +18 -0
  61. package/build/cli/hooks/useKeyMatchers.js.map +1 -0
  62. package/build/cli/hooks/useKeypress.d.ts +19 -0
  63. package/build/cli/hooks/useKeypress.js +28 -0
  64. package/build/cli/hooks/useKeypress.js.map +1 -0
  65. package/build/cli/hooks/useLlmStream/constants.d.ts +4 -0
  66. package/build/cli/hooks/useLlmStream/constants.js +5 -0
  67. package/build/cli/hooks/useLlmStream/constants.js.map +1 -0
  68. package/build/cli/hooks/useLlmStream/index.d.ts +2 -0
  69. package/build/cli/hooks/useLlmStream/index.js +2 -0
  70. package/build/cli/hooks/useLlmStream/index.js.map +1 -0
  71. package/build/cli/hooks/useLlmStream/llmService.d.ts +2 -0
  72. package/build/cli/hooks/useLlmStream/llmService.js +111 -0
  73. package/build/cli/hooks/useLlmStream/llmService.js.map +1 -0
  74. package/build/cli/hooks/useLlmStream/types.d.ts +38 -0
  75. package/build/cli/hooks/useLlmStream/types.js.map +1 -0
  76. package/build/cli/hooks/useLlmStream/useLlmStream.d.ts +12 -0
  77. package/build/cli/hooks/useLlmStream/useLlmStream.js +176 -0
  78. package/build/cli/hooks/useLlmStream/useLlmStream.js.map +1 -0
  79. package/build/cli/hooks/useLlmStream/utils.d.ts +17 -0
  80. package/build/cli/hooks/useLlmStream/utils.js +142 -0
  81. package/build/cli/hooks/useLlmStream/utils.js.map +1 -0
  82. package/build/cli/hooks/useMcpClient.d.ts +10 -0
  83. package/build/cli/hooks/useMcpClient.js +98 -0
  84. package/build/cli/hooks/useMcpClient.js.map +1 -0
  85. package/build/cli/hooks/useMcpManager.d.ts +26 -0
  86. package/build/cli/hooks/useMcpManager.js +89 -0
  87. package/build/cli/hooks/useMcpManager.js.map +1 -0
  88. package/build/cli/hooks/usePromptCompletion.d.ts +19 -0
  89. package/build/cli/hooks/usePromptCompletion.js +13 -0
  90. package/build/cli/hooks/usePromptCompletion.js.map +1 -0
  91. package/build/cli/hooks/useRagContext.d.ts +6 -0
  92. package/build/cli/hooks/useRagContext.js +84 -0
  93. package/build/cli/hooks/useRagContext.js.map +1 -0
  94. package/build/cli/hooks/useShellCompletion.d.ts +18 -0
  95. package/build/cli/hooks/useShellCompletion.js +10 -0
  96. package/build/cli/hooks/useShellCompletion.js.map +1 -0
  97. package/build/cli/hooks/useSlashCompletion.d.ts +21 -0
  98. package/build/cli/hooks/useSlashCompletion.js +11 -0
  99. package/build/cli/hooks/useSlashCompletion.js.map +1 -0
  100. package/build/cli/hooks/useTerminalSize.d.ts +4 -0
  101. package/build/cli/hooks/useTerminalSize.js +21 -0
  102. package/build/cli/hooks/useTerminalSize.js.map +1 -0
  103. package/build/cli/index.d.ts +1 -0
  104. package/build/cli/index.js +27 -0
  105. package/build/cli/index.js.map +1 -0
  106. package/build/cli/key/input.d.ts +5 -0
  107. package/build/cli/key/input.js +9 -0
  108. package/build/cli/key/input.js.map +1 -0
  109. package/build/cli/key/keyBindings.d.ts +152 -0
  110. package/build/cli/key/keyBindings.js +630 -0
  111. package/build/cli/key/keyBindings.js.map +1 -0
  112. package/build/cli/key/keyMatchers.d.ts +19 -0
  113. package/build/cli/key/keyMatchers.js +25 -0
  114. package/build/cli/key/keyMatchers.js.map +1 -0
  115. package/build/cli/key/mouse.d.ts +23 -0
  116. package/build/cli/key/mouse.js +155 -0
  117. package/build/cli/key/mouse.js.map +1 -0
  118. package/build/cli/key/text-buffer.d.ts +156 -0
  119. package/build/cli/key/text-buffer.js +937 -0
  120. package/build/cli/key/text-buffer.js.map +1 -0
  121. package/build/cli/main.d.ts +1 -0
  122. package/build/cli/main.js +20 -0
  123. package/build/cli/main.js.map +1 -0
  124. package/build/cli/services/McpClientService.d.ts +32 -0
  125. package/build/cli/services/McpClientService.js +123 -0
  126. package/build/cli/services/McpClientService.js.map +1 -0
  127. package/build/cli/services/McpManager.d.ts +28 -0
  128. package/build/cli/services/McpManager.js +146 -0
  129. package/build/cli/services/McpManager.js.map +1 -0
  130. package/build/cli/theme/builtin/default-dark.d.ts +7 -0
  131. package/build/cli/theme/builtin/default-dark.js +143 -0
  132. package/build/cli/theme/builtin/default-dark.js.map +1 -0
  133. package/build/cli/theme/builtin/no-color.d.ts +7 -0
  134. package/build/cli/theme/builtin/no-color.js +125 -0
  135. package/build/cli/theme/builtin/no-color.js.map +1 -0
  136. package/build/cli/theme/builtin/tokyonight-dark.d.ts +7 -0
  137. package/build/cli/theme/builtin/tokyonight-dark.js +146 -0
  138. package/build/cli/theme/builtin/tokyonight-dark.js.map +1 -0
  139. package/build/cli/theme/semantic-colors.d.ts +2 -0
  140. package/build/cli/theme/semantic-colors.js +19 -0
  141. package/build/cli/theme/semantic-colors.js.map +1 -0
  142. package/build/cli/theme/semantic-tokens.d.ts +42 -0
  143. package/build/cli/theme/semantic-tokens.js +77 -0
  144. package/build/cli/theme/semantic-tokens.js.map +1 -0
  145. package/build/cli/theme/theme-manager.d.ts +32 -0
  146. package/build/cli/theme/theme-manager.js +150 -0
  147. package/build/cli/theme/theme-manager.js.map +1 -0
  148. package/build/cli/theme/theme.d.ts +107 -0
  149. package/build/cli/theme/theme.js +333 -0
  150. package/build/cli/theme/theme.js.map +1 -0
  151. package/build/cli/tmp.d.ts +1 -0
  152. package/build/cli/tmp.js +27 -0
  153. package/build/cli/tmp.js.map +1 -0
  154. package/build/cli/types.d.ts +97 -0
  155. package/build/cli/types.js +2 -0
  156. package/build/cli/types.js.map +1 -0
  157. package/build/cli/ui/ConnectionStatus.d.ts +13 -0
  158. package/build/cli/ui/ConnectionStatus.js +19 -0
  159. package/build/cli/ui/ConnectionStatus.js.map +1 -0
  160. package/build/cli/ui/HalfPaddingBox.d.ts +13 -0
  161. package/build/cli/ui/HalfPaddingBox.js +11 -0
  162. package/build/cli/ui/HalfPaddingBox.js.map +1 -0
  163. package/build/cli/ui/HelpCommands.d.ts +5 -0
  164. package/build/cli/ui/HelpCommands.js +11 -0
  165. package/build/cli/ui/HelpCommands.js.map +1 -0
  166. package/build/cli/ui/HistoryItemDisplay.d.ts +9 -0
  167. package/build/cli/ui/HistoryItemDisplay.js +34 -0
  168. package/build/cli/ui/HistoryItemDisplay.js.map +1 -0
  169. package/build/cli/ui/InputPrompt.d.ts +13 -0
  170. package/build/cli/ui/InputPrompt.js +138 -0
  171. package/build/cli/ui/InputPrompt.js.map +1 -0
  172. package/build/cli/ui/LLMErrorComponent.d.ts +6 -0
  173. package/build/cli/ui/LLMErrorComponent.js +18 -0
  174. package/build/cli/ui/LLMErrorComponent.js.map +1 -0
  175. package/build/cli/ui/LLMHealthChecker.d.ts +8 -0
  176. package/build/cli/ui/LLMHealthChecker.js +22 -0
  177. package/build/cli/ui/LLMHealthChecker.js.map +1 -0
  178. package/build/cli/ui/MCPServers.d.ts +11 -0
  179. package/build/cli/ui/MCPServers.js +15 -0
  180. package/build/cli/ui/MCPServers.js.map +1 -0
  181. package/build/cli/ui/MainContent.d.ts +12 -0
  182. package/build/cli/ui/MainContent.js +28 -0
  183. package/build/cli/ui/MainContent.js.map +1 -0
  184. package/build/cli/ui/MarkdownDisplay.d.ts +8 -0
  185. package/build/cli/ui/MarkdownDisplay.js +6 -0
  186. package/build/cli/ui/MarkdownDisplay.js.map +1 -0
  187. package/build/cli/ui/MouseContext.d.ts +1 -0
  188. package/build/cli/ui/MouseContext.js +2 -0
  189. package/build/cli/ui/MouseContext.js.map +1 -0
  190. package/build/cli/ui/SuggestionsDisplay.d.ts +25 -0
  191. package/build/cli/ui/SuggestionsDisplay.js +45 -0
  192. package/build/cli/ui/SuggestionsDisplay.js.map +1 -0
  193. package/build/cli/ui/SystemInfoSummaryBox.d.ts +6 -0
  194. package/build/cli/ui/SystemInfoSummaryBox.js +6 -0
  195. package/build/cli/ui/SystemInfoSummaryBox.js.map +1 -0
  196. package/build/cli/ui/ThinkingIndicator.d.ts +2 -0
  197. package/build/cli/ui/ThinkingIndicator.js +16 -0
  198. package/build/cli/ui/ThinkingIndicator.js.map +1 -0
  199. package/build/cli/ui/layout/DefaultAppLayout.d.ts +2 -0
  200. package/build/cli/ui/layout/DefaultAppLayout.js +6 -0
  201. package/build/cli/ui/layout/DefaultAppLayout.js.map +1 -0
  202. package/build/cli/ui/shared/ExpandableText.d.ts +14 -0
  203. package/build/cli/ui/shared/ExpandableText.js +19 -0
  204. package/build/cli/ui/shared/ExpandableText.js.map +1 -0
  205. package/build/cli/utils/cache.d.ts +21 -0
  206. package/build/cli/utils/cache.js +56 -0
  207. package/build/cli/utils/cache.js.map +1 -0
  208. package/build/cli/utils/cleanup.d.ts +1 -0
  209. package/build/cli/utils/cleanup.js +5 -0
  210. package/build/cli/utils/cleanup.js.map +1 -0
  211. package/build/cli/utils/commandUtils.d.ts +11 -0
  212. package/build/cli/utils/commandUtils.js +16 -0
  213. package/build/cli/utils/commandUtils.js.map +1 -0
  214. package/build/cli/utils/historyStorage.d.ts +13 -0
  215. package/build/cli/utils/historyStorage.js +64 -0
  216. package/build/cli/utils/historyStorage.js.map +1 -0
  217. package/build/cli/utils/stdio.d.ts +18 -0
  218. package/build/cli/utils/stdio.js +58 -0
  219. package/build/cli/utils/stdio.js.map +1 -0
  220. package/build/cli/utils/terminal.d.ts +15 -0
  221. package/build/cli/utils/terminal.js +51 -0
  222. package/build/cli/utils/terminal.js.map +1 -0
  223. package/build/cli/utils/textUtil.d.ts +63 -0
  224. package/build/cli/utils/textUtil.js +231 -0
  225. package/build/cli/utils/textUtil.js.map +1 -0
  226. package/build/config.d.ts +25 -0
  227. package/{dist/src → build}/config.js +29 -8
  228. package/build/config.js.map +1 -0
  229. package/build/index.d.ts +2 -0
  230. package/{dist/src → build}/index.js +0 -3
  231. package/build/index.js.map +1 -0
  232. package/{dist/src → build}/server.d.ts +0 -1
  233. package/{dist/src → build}/server.js +1 -2
  234. package/build/server.js.map +1 -0
  235. package/{dist/src → build}/setup.d.ts +0 -2
  236. package/{dist/src → build}/setup.js +2 -4
  237. package/build/setup.js.map +1 -0
  238. package/build/shared/configSchema.d.ts +27 -0
  239. package/build/shared/configSchema.js +31 -0
  240. package/build/shared/configSchema.js.map +1 -0
  241. package/build/shared/index.d.ts +3 -0
  242. package/build/shared/index.js +4 -0
  243. package/build/shared/index.js.map +1 -0
  244. package/build/shared/types.d.ts +20 -0
  245. package/build/shared/types.js +2 -0
  246. package/build/shared/types.js.map +1 -0
  247. package/build/shared/utils/debugLogger.d.ts +12 -0
  248. package/build/shared/utils/debugLogger.js +54 -0
  249. package/build/shared/utils/debugLogger.js.map +1 -0
  250. package/{dist/src → build}/tools/create_document_with_properties/index.d.ts +22 -5
  251. package/{dist/src → build}/tools/create_document_with_properties/index.js +2 -2
  252. package/build/tools/create_document_with_properties/index.js.map +1 -0
  253. package/build/tools/create_document_with_properties/params.d.ts +66 -0
  254. package/{dist/src → build}/tools/create_document_with_properties/params.js +1 -1
  255. package/build/tools/create_document_with_properties/params.js.map +1 -0
  256. package/{dist/src → build}/tools/generate_property/index.d.ts +1 -2
  257. package/{dist/src → build}/tools/generate_property/index.js +1 -1
  258. package/build/tools/generate_property/index.js.map +1 -0
  259. package/{dist/src → build}/tools/generate_property/params.d.ts +30 -7
  260. package/build/tools/generate_property/params.js.map +1 -0
  261. package/{dist/src → build}/tools/index.d.ts +51 -36
  262. package/build/tools/index.js +13 -0
  263. package/build/tools/index.js.map +1 -0
  264. package/{dist/src → build}/tools/organize_attachments/index.d.ts +1 -2
  265. package/{dist/src → build}/tools/organize_attachments/index.js +2 -2
  266. package/build/tools/organize_attachments/index.js.map +1 -0
  267. package/build/tools/organize_attachments/params.d.ts +122 -0
  268. package/{dist/src → build}/tools/organize_attachments/params.js +3 -3
  269. package/build/tools/organize_attachments/params.js.map +1 -0
  270. package/{dist/src → build}/tools/organize_attachments/utils.d.ts +0 -1
  271. package/build/tools/organize_attachments/utils.js.map +1 -0
  272. package/{dist/src → build}/tools/vault/index.d.ts +5 -26
  273. package/{dist/src → build}/tools/vault/index.js +3 -3
  274. package/build/tools/vault/index.js.map +1 -0
  275. package/{dist/src → build}/tools/vault/metrics.d.ts +0 -1
  276. package/build/tools/vault/metrics.js.map +1 -0
  277. package/build/tools/vault/params.d.ts +115 -0
  278. package/{dist/src → build}/tools/vault/params.js +0 -1
  279. package/build/tools/vault/params.js.map +1 -0
  280. package/build/tools/vault/types/collect_context.d.ts +1340 -0
  281. package/{dist/src → build}/tools/vault/types/collect_context.js +1 -1
  282. package/build/tools/vault/types/collect_context.js.map +1 -0
  283. package/build/tools/vault/types/list_all.d.ts +387 -0
  284. package/{dist/src → build}/tools/vault/types/list_all.js +4 -9
  285. package/build/tools/vault/types/list_all.js.map +1 -0
  286. package/build/tools/vault/types/read_specific.d.ts +297 -0
  287. package/{dist/src → build}/tools/vault/types/read_specific.js +1 -3
  288. package/build/tools/vault/types/read_specific.js.map +1 -0
  289. package/build/tools/vault/types/search.d.ts +598 -0
  290. package/{dist/src → build}/tools/vault/types/search.js +8 -16
  291. package/build/tools/vault/types/search.js.map +1 -0
  292. package/{dist/src → build}/tools/vault/utils/actions/collect_context.d.ts +1 -2
  293. package/{dist/src → build}/tools/vault/utils/actions/collect_context.js +4 -4
  294. package/build/tools/vault/utils/actions/collect_context.js.map +1 -0
  295. package/{dist/src → build}/tools/vault/utils/actions/index_rag.d.ts +0 -1
  296. package/build/tools/vault/utils/actions/index_rag.js.map +1 -0
  297. package/{dist/src → build}/tools/vault/utils/actions/list_all.d.ts +1 -2
  298. package/{dist/src → build}/tools/vault/utils/actions/list_all.js +1 -1
  299. package/build/tools/vault/utils/actions/list_all.js.map +1 -0
  300. package/{dist/src → build}/tools/vault/utils/actions/load_memory.d.ts +1 -2
  301. package/{dist/src → build}/tools/vault/utils/actions/load_memory.js +3 -3
  302. package/build/tools/vault/utils/actions/load_memory.js.map +1 -0
  303. package/{dist/src → build}/tools/vault/utils/actions/read.d.ts +1 -2
  304. package/{dist/src → build}/tools/vault/utils/actions/read.js +1 -1
  305. package/build/tools/vault/utils/actions/read.js.map +1 -0
  306. package/{dist/src → build}/tools/vault/utils/actions/search.d.ts +1 -2
  307. package/{dist/src → build}/tools/vault/utils/actions/search.js +2 -2
  308. package/build/tools/vault/utils/actions/search.js.map +1 -0
  309. package/{dist/src → build}/tools/vault/utils/actions/stats.d.ts +0 -1
  310. package/build/tools/vault/utils/actions/stats.js.map +1 -0
  311. package/{dist/src → build}/tools/vault/utils/constants.d.ts +0 -1
  312. package/build/tools/vault/utils/constants.js.map +1 -0
  313. package/{dist/src → build}/tools/vault/utils/document.d.ts +0 -6
  314. package/{dist/src → build}/tools/vault/utils/document.js +0 -1
  315. package/build/tools/vault/utils/document.js.map +1 -0
  316. package/{dist/src → build}/tools/vault/utils/shared.d.ts +1 -2
  317. package/build/tools/vault/utils/shared.js.map +1 -0
  318. package/build/tools/vault/utils.d.ts +7 -0
  319. package/build/tools/vault/utils.js +8 -0
  320. package/build/tools/vault/utils.js.map +1 -0
  321. package/{dist/src → build}/tools/write_property/index.d.ts +22 -5
  322. package/{dist/src → build}/tools/write_property/index.js +1 -1
  323. package/build/tools/write_property/index.js.map +1 -0
  324. package/build/tools/write_property/params.d.ts +60 -0
  325. package/build/tools/write_property/params.js.map +1 -0
  326. package/{dist/src → build}/utils/DirectoryWalker.d.ts +1 -2
  327. package/build/utils/DirectoryWalker.js.map +1 -0
  328. package/{dist/src → build}/utils/Embedder.d.ts +0 -1
  329. package/{dist/src → build}/utils/Embedder.js +1 -1
  330. package/build/utils/Embedder.js.map +1 -0
  331. package/{dist/src → build}/utils/Indexer.d.ts +2 -3
  332. package/{dist/src → build}/utils/Indexer.js +2 -2
  333. package/build/utils/Indexer.js.map +1 -0
  334. package/{dist/src → build}/utils/LLMClient.d.ts +0 -5
  335. package/build/utils/LLMClient.js +53 -0
  336. package/build/utils/LLMClient.js.map +1 -0
  337. package/{dist/src → build}/utils/LocalReranker.d.ts +0 -1
  338. package/{dist/src → build}/utils/LocalReranker.js +1 -1
  339. package/build/utils/LocalReranker.js.map +1 -0
  340. package/{dist/src → build}/utils/RAGIndexer.d.ts +1 -2
  341. package/{dist/src → build}/utils/RAGIndexer.js +8 -11
  342. package/build/utils/RAGIndexer.js.map +1 -0
  343. package/build/utils/RerankerClient.d.ts +61 -0
  344. package/{dist/src → build}/utils/RerankerClient.js +1 -20
  345. package/build/utils/RerankerClient.js.map +1 -0
  346. package/{dist/src → build}/utils/VaultManger/VaultManager.d.ts +3 -7
  347. package/{dist/src → build}/utils/VaultManger/VaultManager.js +17 -20
  348. package/build/utils/VaultManger/VaultManager.js.map +1 -0
  349. package/{dist/src → build}/utils/VaultManger/VaultPathError.d.ts +0 -1
  350. package/build/utils/VaultManger/VaultPathError.js.map +1 -0
  351. package/build/utils/VaultManger/index.d.ts +3 -0
  352. package/build/utils/VaultManger/index.js +3 -0
  353. package/build/utils/VaultManger/index.js.map +1 -0
  354. package/{dist/src → build}/utils/VaultManger/types.d.ts +1 -2
  355. package/build/utils/VaultManger/types.js +2 -0
  356. package/build/utils/VaultManger/types.js.map +1 -0
  357. package/{dist/src → build}/utils/VaultWatcher.d.ts +0 -1
  358. package/{dist/src → build}/utils/VaultWatcher.js +1 -1
  359. package/build/utils/VaultWatcher.js.map +1 -0
  360. package/{dist/src → build}/utils/VectorDB.d.ts +0 -1
  361. package/build/utils/VectorDB.js +241 -0
  362. package/build/utils/VectorDB.js.map +1 -0
  363. package/{dist/src → build}/utils/constants.d.ts +0 -1
  364. package/build/utils/constants.js.map +1 -0
  365. package/{dist/src → build}/utils/createToolError.d.ts +0 -1
  366. package/build/utils/createToolError.js.map +1 -0
  367. package/build/utils/getVaultManager.d.ts +2 -0
  368. package/{dist/src → build}/utils/getVaultManager.js +1 -7
  369. package/build/utils/getVaultManager.js.map +1 -0
  370. package/{dist/src → build}/utils/processor/LinkExtractor.d.ts +0 -1
  371. package/build/utils/processor/LinkExtractor.js.map +1 -0
  372. package/build/utils/processor/MatterParser.d.ts +2 -0
  373. package/build/utils/processor/MatterParser.js +28 -0
  374. package/build/utils/processor/MatterParser.js.map +1 -0
  375. package/build/utils/processor/types.d.ts +104 -0
  376. package/{dist/src → build}/utils/processor/types.js +2 -10
  377. package/build/utils/processor/types.js.map +1 -0
  378. package/{dist/src → build}/utils/semaphore.d.ts +0 -1
  379. package/build/utils/semaphore.js.map +1 -0
  380. package/package.json +84 -72
  381. package/dist/package.json +0 -74
  382. package/dist/src/config.d.ts +0 -6
  383. package/dist/src/config.d.ts.map +0 -1
  384. package/dist/src/config.js.map +0 -1
  385. package/dist/src/db.d.ts +0 -2
  386. package/dist/src/db.d.ts.map +0 -1
  387. package/dist/src/db.js +0 -58
  388. package/dist/src/db.js.map +0 -1
  389. package/dist/src/index.d.ts +0 -3
  390. package/dist/src/index.d.ts.map +0 -1
  391. package/dist/src/index.js.map +0 -1
  392. package/dist/src/server.d.ts.map +0 -1
  393. package/dist/src/server.js.map +0 -1
  394. package/dist/src/setup.d.ts.map +0 -1
  395. package/dist/src/setup.js.map +0 -1
  396. package/dist/src/tools/create_document_with_properties/index.d.ts.map +0 -1
  397. package/dist/src/tools/create_document_with_properties/index.js.map +0 -1
  398. package/dist/src/tools/create_document_with_properties/params.d.ts +0 -19
  399. package/dist/src/tools/create_document_with_properties/params.d.ts.map +0 -1
  400. package/dist/src/tools/create_document_with_properties/params.js.map +0 -1
  401. package/dist/src/tools/generate_property/index.d.ts.map +0 -1
  402. package/dist/src/tools/generate_property/index.js.map +0 -1
  403. package/dist/src/tools/generate_property/params.d.ts.map +0 -1
  404. package/dist/src/tools/generate_property/params.js.map +0 -1
  405. package/dist/src/tools/index.d.ts.map +0 -1
  406. package/dist/src/tools/index.js +0 -13
  407. package/dist/src/tools/index.js.map +0 -1
  408. package/dist/src/tools/organize_attachments/index.d.ts.map +0 -1
  409. package/dist/src/tools/organize_attachments/index.js.map +0 -1
  410. package/dist/src/tools/organize_attachments/params.d.ts +0 -47
  411. package/dist/src/tools/organize_attachments/params.d.ts.map +0 -1
  412. package/dist/src/tools/organize_attachments/params.js.map +0 -1
  413. package/dist/src/tools/organize_attachments/utils.d.ts.map +0 -1
  414. package/dist/src/tools/organize_attachments/utils.js.map +0 -1
  415. package/dist/src/tools/vault/index.d.ts.map +0 -1
  416. package/dist/src/tools/vault/index.js.map +0 -1
  417. package/dist/src/tools/vault/metrics.d.ts.map +0 -1
  418. package/dist/src/tools/vault/metrics.js.map +0 -1
  419. package/dist/src/tools/vault/params.d.ts +0 -100
  420. package/dist/src/tools/vault/params.d.ts.map +0 -1
  421. package/dist/src/tools/vault/params.js.map +0 -1
  422. package/dist/src/tools/vault/types/collect_context.d.ts +0 -388
  423. package/dist/src/tools/vault/types/collect_context.d.ts.map +0 -1
  424. package/dist/src/tools/vault/types/collect_context.js.map +0 -1
  425. package/dist/src/tools/vault/types/list_all.d.ts +0 -89
  426. package/dist/src/tools/vault/types/list_all.d.ts.map +0 -1
  427. package/dist/src/tools/vault/types/list_all.js.map +0 -1
  428. package/dist/src/tools/vault/types/read_specific.d.ts +0 -68
  429. package/dist/src/tools/vault/types/read_specific.d.ts.map +0 -1
  430. package/dist/src/tools/vault/types/read_specific.js.map +0 -1
  431. package/dist/src/tools/vault/types/search.d.ts +0 -151
  432. package/dist/src/tools/vault/types/search.d.ts.map +0 -1
  433. package/dist/src/tools/vault/types/search.js.map +0 -1
  434. package/dist/src/tools/vault/utils/actions/collect_context.d.ts.map +0 -1
  435. package/dist/src/tools/vault/utils/actions/collect_context.js.map +0 -1
  436. package/dist/src/tools/vault/utils/actions/index_rag.d.ts.map +0 -1
  437. package/dist/src/tools/vault/utils/actions/index_rag.js.map +0 -1
  438. package/dist/src/tools/vault/utils/actions/list_all.d.ts.map +0 -1
  439. package/dist/src/tools/vault/utils/actions/list_all.js.map +0 -1
  440. package/dist/src/tools/vault/utils/actions/load_memory.d.ts.map +0 -1
  441. package/dist/src/tools/vault/utils/actions/load_memory.js.map +0 -1
  442. package/dist/src/tools/vault/utils/actions/read.d.ts.map +0 -1
  443. package/dist/src/tools/vault/utils/actions/read.js.map +0 -1
  444. package/dist/src/tools/vault/utils/actions/search.d.ts.map +0 -1
  445. package/dist/src/tools/vault/utils/actions/search.js.map +0 -1
  446. package/dist/src/tools/vault/utils/actions/stats.d.ts.map +0 -1
  447. package/dist/src/tools/vault/utils/actions/stats.js.map +0 -1
  448. package/dist/src/tools/vault/utils/constants.d.ts.map +0 -1
  449. package/dist/src/tools/vault/utils/constants.js.map +0 -1
  450. package/dist/src/tools/vault/utils/document.d.ts.map +0 -1
  451. package/dist/src/tools/vault/utils/document.js.map +0 -1
  452. package/dist/src/tools/vault/utils/shared.d.ts.map +0 -1
  453. package/dist/src/tools/vault/utils/shared.js.map +0 -1
  454. package/dist/src/tools/vault/utils.d.ts +0 -8
  455. package/dist/src/tools/vault/utils.d.ts.map +0 -1
  456. package/dist/src/tools/vault/utils.js +0 -8
  457. package/dist/src/tools/vault/utils.js.map +0 -1
  458. package/dist/src/tools/write_property/index.d.ts.map +0 -1
  459. package/dist/src/tools/write_property/index.js.map +0 -1
  460. package/dist/src/tools/write_property/params.d.ts +0 -17
  461. package/dist/src/tools/write_property/params.d.ts.map +0 -1
  462. package/dist/src/tools/write_property/params.js.map +0 -1
  463. package/dist/src/utils/DirectoryWalker.d.ts.map +0 -1
  464. package/dist/src/utils/DirectoryWalker.js.map +0 -1
  465. package/dist/src/utils/Embedder.d.ts.map +0 -1
  466. package/dist/src/utils/Embedder.js.map +0 -1
  467. package/dist/src/utils/Indexer.d.ts.map +0 -1
  468. package/dist/src/utils/Indexer.js.map +0 -1
  469. package/dist/src/utils/LLMClient.d.ts.map +0 -1
  470. package/dist/src/utils/LLMClient.js +0 -112
  471. package/dist/src/utils/LLMClient.js.map +0 -1
  472. package/dist/src/utils/LocalReranker.d.ts.map +0 -1
  473. package/dist/src/utils/LocalReranker.js.map +0 -1
  474. package/dist/src/utils/RAGIndexer.d.ts.map +0 -1
  475. package/dist/src/utils/RAGIndexer.js.map +0 -1
  476. package/dist/src/utils/RerankerClient.d.ts +0 -28
  477. package/dist/src/utils/RerankerClient.d.ts.map +0 -1
  478. package/dist/src/utils/RerankerClient.js.map +0 -1
  479. package/dist/src/utils/VaultManger/VaultManager.d.ts.map +0 -1
  480. package/dist/src/utils/VaultManger/VaultManager.js.map +0 -1
  481. package/dist/src/utils/VaultManger/VaultPathError.d.ts.map +0 -1
  482. package/dist/src/utils/VaultManger/VaultPathError.js.map +0 -1
  483. package/dist/src/utils/VaultManger/index.d.ts +0 -4
  484. package/dist/src/utils/VaultManger/index.d.ts.map +0 -1
  485. package/dist/src/utils/VaultManger/index.js +0 -3
  486. package/dist/src/utils/VaultManger/index.js.map +0 -1
  487. package/dist/src/utils/VaultManger/types.d.ts.map +0 -1
  488. package/dist/src/utils/VaultManger/types.js.map +0 -1
  489. package/dist/src/utils/VaultWatcher.d.ts.map +0 -1
  490. package/dist/src/utils/VaultWatcher.js.map +0 -1
  491. package/dist/src/utils/VectorDB.d.ts.map +0 -1
  492. package/dist/src/utils/VectorDB.js +0 -305
  493. package/dist/src/utils/VectorDB.js.map +0 -1
  494. package/dist/src/utils/constants.d.ts.map +0 -1
  495. package/dist/src/utils/constants.js.map +0 -1
  496. package/dist/src/utils/createToolError.d.ts.map +0 -1
  497. package/dist/src/utils/createToolError.js.map +0 -1
  498. package/dist/src/utils/getVaultManager.d.ts +0 -7
  499. package/dist/src/utils/getVaultManager.d.ts.map +0 -1
  500. package/dist/src/utils/getVaultManager.js.map +0 -1
  501. package/dist/src/utils/processor/LinkExtractor.d.ts.map +0 -1
  502. package/dist/src/utils/processor/LinkExtractor.js.map +0 -1
  503. package/dist/src/utils/processor/MatterParser.d.ts +0 -3
  504. package/dist/src/utils/processor/MatterParser.d.ts.map +0 -1
  505. package/dist/src/utils/processor/MatterParser.js +0 -27
  506. package/dist/src/utils/processor/MatterParser.js.map +0 -1
  507. package/dist/src/utils/processor/types.d.ts +0 -53
  508. package/dist/src/utils/processor/types.d.ts.map +0 -1
  509. package/dist/src/utils/processor/types.js.map +0 -1
  510. package/dist/src/utils/semaphore.d.ts.map +0 -1
  511. package/dist/src/utils/semaphore.js.map +0 -1
  512. package/dist/tsconfig.build.tsbuildinfo +0 -1
  513. /package/{dist/src/utils/VaultManger → build/cli/hooks/useLlmStream}/types.js +0 -0
  514. /package/{dist/src → build}/tools/generate_property/params.js +0 -0
  515. /package/{dist/src → build}/tools/organize_attachments/utils.js +0 -0
  516. /package/{dist/src → build}/tools/vault/metrics.js +0 -0
  517. /package/{dist/src → build}/tools/vault/utils/actions/index_rag.js +0 -0
  518. /package/{dist/src → build}/tools/vault/utils/actions/stats.js +0 -0
  519. /package/{dist/src → build}/tools/vault/utils/constants.js +0 -0
  520. /package/{dist/src → build}/tools/vault/utils/shared.js +0 -0
  521. /package/{dist/src → build}/tools/write_property/params.js +0 -0
  522. /package/{dist/src → build}/utils/DirectoryWalker.js +0 -0
  523. /package/{dist/src → build}/utils/VaultManger/VaultPathError.js +0 -0
  524. /package/{dist/src → build}/utils/constants.js +0 -0
  525. /package/{dist/src → build}/utils/createToolError.js +0 -0
  526. /package/{dist/src → build}/utils/processor/LinkExtractor.js +0 -0
  527. /package/{dist/src → build}/utils/semaphore.js +0 -0
@@ -0,0 +1,107 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { SemanticColors } from "../theme/semantic-tokens.js";
7
+ import type { CSSProperties } from "react";
8
+ export declare const INK_SUPPORTED_NAMES: Set<string>;
9
+ export declare const CSS_NAME_TO_HEX_MAP: {
10
+ [k: string]: string;
11
+ };
12
+ export declare const INK_NAME_TO_HEX_MAP: Readonly<Record<string, string>>;
13
+ /**
14
+ * Calculates the relative luminance of a color.
15
+ * See https://www.w3.org/TR/WCAG20/#relativeluminancedef
16
+ *
17
+ * @param color Color string (hex or Ink-supported name)
18
+ * @returns Luminance value (0-255)
19
+ */
20
+ export declare function getLuminance(color: string): number;
21
+ /**
22
+ * Resolves a CSS color value (name or hex) into an Ink-compatible color string.
23
+ * @param colorValue The raw color string (e.g., 'blue', '#ff0000', 'darkkhaki').
24
+ * @returns An Ink-compatible color string (hex or name), or undefined if not resolvable.
25
+ */
26
+ export declare function resolveColor(colorValue: string): string | undefined;
27
+ export declare function interpolateColor(color1: string, color2: string, factor: number): string;
28
+ export declare function getThemeTypeFromBackgroundColor(backgroundColor: string | undefined): "light" | "dark" | undefined;
29
+ export type ThemeType = "light" | "dark" | "ansi" | "custom";
30
+ export interface ColorsTheme {
31
+ type: ThemeType;
32
+ Background: string;
33
+ Foreground: string;
34
+ LightBlue: string;
35
+ AccentBlue: string;
36
+ AccentPurple: string;
37
+ AccentCyan: string;
38
+ AccentGreen: string;
39
+ AccentYellow: string;
40
+ AccentRed: string;
41
+ DiffAdded: string;
42
+ DiffRemoved: string;
43
+ Comment: string;
44
+ Gray: string;
45
+ DarkGray: string;
46
+ InputBackground?: string;
47
+ MessageBackground?: string;
48
+ FocusBackground?: string;
49
+ FocusColor?: string;
50
+ GradientColors?: string[];
51
+ }
52
+ export declare const lightTheme: ColorsTheme;
53
+ export declare const darkTheme: ColorsTheme;
54
+ export declare const ansiTheme: ColorsTheme;
55
+ export declare class Theme {
56
+ readonly name: string;
57
+ readonly type: ThemeType;
58
+ readonly colors: ColorsTheme;
59
+ /**
60
+ * The default foreground color for text when no specific highlight rule applies.
61
+ * This is an Ink-compatible color string (hex or name).
62
+ */
63
+ readonly defaultColor: string;
64
+ /**
65
+ * Stores the mapping from highlight.js class names (e.g., 'hljs-keyword')
66
+ * to Ink-compatible color strings (hex or name).
67
+ */
68
+ protected readonly _colorMap: Readonly<Record<string, string>>;
69
+ readonly semanticColors: SemanticColors;
70
+ /**
71
+ * Creates a new Theme instance.
72
+ * @param name The name of the theme.
73
+ * @param rawMappings The raw CSSProperties mappings from a react-syntax-highlighter theme object.
74
+ */
75
+ constructor(name: string, type: ThemeType, rawMappings: Record<string, CSSProperties>, colors: ColorsTheme, semanticColors?: SemanticColors);
76
+ /**
77
+ * Gets the Ink-compatible color string for a given highlight.js class name.
78
+ * @param hljsClass The highlight.js class name (e.g., 'hljs-keyword', 'hljs-string').
79
+ * @returns The corresponding Ink color string (hex or name) if it exists.
80
+ */
81
+ getInkColor(hljsClass: string): string | undefined;
82
+ /**
83
+ * Resolves a CSS color value (name or hex) into an Ink-compatible color string.
84
+ * @param colorValue The raw color string (e.g., 'blue', '#ff0000', 'darkkhaki').
85
+ * @returns An Ink-compatible color string (hex or name), or undefined if not resolvable.
86
+ */
87
+ private static _resolveColor;
88
+ /**
89
+ * Builds the internal map from highlight.js class names to Ink-compatible color strings.
90
+ * This method is protected and primarily intended for use by the constructor.
91
+ * @param hljsTheme The raw CSSProperties mappings from a react-syntax-highlighter theme object.
92
+ * @returns An Ink-compatible theme map (Record<string, string>).
93
+ */
94
+ protected _buildColorMap(hljsTheme: Record<string, CSSProperties>): Record<string, string>;
95
+ }
96
+ /**
97
+ * Picks a default theme name based on terminal background color.
98
+ * It first tries to find a theme with an exact background color match.
99
+ * If no match is found, it falls back to a light or dark theme based on the
100
+ * luminance of the background color.
101
+ * @param terminalBackground The hex color string of the terminal background.
102
+ * @param availableThemes A list of available themes to search through.
103
+ * @param defaultDarkThemeName The name of the fallback dark theme.
104
+ * @param defaultLightThemeName The name of the fallback light theme.
105
+ * @returns The name of the chosen theme.
106
+ */
107
+ export declare function pickDefaultThemeName(terminalBackground: string | undefined, availableThemes: readonly Theme[], defaultDarkThemeName: string, defaultLightThemeName: string): string;
@@ -0,0 +1,333 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { DEFAULT_INPUT_BACKGROUND_OPACITY, DEFAULT_SELECTION_OPACITY, } from "../constants.js";
7
+ import tinycolor from "tinycolor2";
8
+ import tinygradient from "tinygradient";
9
+ // Define the set of Ink's named colors for quick lookup
10
+ export const INK_SUPPORTED_NAMES = new Set([
11
+ "black",
12
+ "red",
13
+ "green",
14
+ "yellow",
15
+ "blue",
16
+ "cyan",
17
+ "magenta",
18
+ "white",
19
+ "gray",
20
+ "grey",
21
+ "blackbright",
22
+ "redbright",
23
+ "greenbright",
24
+ "yellowbright",
25
+ "bluebright",
26
+ "cyanbright",
27
+ "magentabright",
28
+ "whitebright",
29
+ ]);
30
+ // Use tinycolor's built-in names map for CSS colors, excluding ones Ink supports
31
+ export const CSS_NAME_TO_HEX_MAP = Object.fromEntries(Object.entries(tinycolor.names)
32
+ .filter(([name]) => !INK_SUPPORTED_NAMES.has(name))
33
+ .map(([name, hex]) => [name, `#${hex}`]));
34
+ // Mapping for ANSI bright colors that are not in tinycolor's standard CSS names
35
+ export const INK_NAME_TO_HEX_MAP = {
36
+ blackbright: "#555555",
37
+ redbright: "#ff5555",
38
+ greenbright: "#55ff55",
39
+ yellowbright: "#ffff55",
40
+ bluebright: "#5555ff",
41
+ magentabright: "#ff55ff",
42
+ cyanbright: "#55ffff",
43
+ whitebright: "#ffffff",
44
+ };
45
+ /**
46
+ * Calculates the relative luminance of a color.
47
+ * See https://www.w3.org/TR/WCAG20/#relativeluminancedef
48
+ *
49
+ * @param color Color string (hex or Ink-supported name)
50
+ * @returns Luminance value (0-255)
51
+ */
52
+ export function getLuminance(color) {
53
+ const resolved = color.toLowerCase();
54
+ const hex = INK_NAME_TO_HEX_MAP[resolved] || resolved;
55
+ const colorObj = tinycolor(hex);
56
+ if (!colorObj.isValid()) {
57
+ return 0;
58
+ }
59
+ // tinycolor returns 0-1, we need 0-255
60
+ return colorObj.getLuminance() * 255;
61
+ }
62
+ /**
63
+ * Resolves a CSS color value (name or hex) into an Ink-compatible color string.
64
+ * @param colorValue The raw color string (e.g., 'blue', '#ff0000', 'darkkhaki').
65
+ * @returns An Ink-compatible color string (hex or name), or undefined if not resolvable.
66
+ */
67
+ export function resolveColor(colorValue) {
68
+ const lowerColor = colorValue.toLowerCase();
69
+ // 1. Check if it's already a hex code and valid
70
+ if (lowerColor.startsWith("#")) {
71
+ if (/^#[0-9A-Fa-f]{3}([0-9A-Fa-f]{3})?$/.test(colorValue)) {
72
+ return lowerColor;
73
+ }
74
+ else {
75
+ return undefined;
76
+ }
77
+ }
78
+ // Handle hex codes without #
79
+ if (/^[0-9A-Fa-f]{3}([0-9A-Fa-f]{3})?$/.test(colorValue)) {
80
+ return `#${lowerColor}`;
81
+ }
82
+ // 2. Check if it's an Ink supported name (lowercase)
83
+ if (INK_SUPPORTED_NAMES.has(lowerColor)) {
84
+ return lowerColor; // Use Ink name directly
85
+ }
86
+ // 3. Check if it's a known CSS name we can map to hex
87
+ // We can't import CSS_NAME_TO_HEX_MAP here due to circular deps,
88
+ // but we can use tinycolor directly for named colors.
89
+ const colorObj = tinycolor(lowerColor);
90
+ if (colorObj.isValid()) {
91
+ return colorObj.toHexString();
92
+ }
93
+ // 4. Could not resolve
94
+ return undefined;
95
+ }
96
+ export function interpolateColor(color1, color2, factor) {
97
+ if (factor <= 0 && color1) {
98
+ return color1;
99
+ }
100
+ if (factor >= 1 && color2) {
101
+ return color2;
102
+ }
103
+ if (!color1 || !color2) {
104
+ return "";
105
+ }
106
+ try {
107
+ const gradient = tinygradient(color1, color2);
108
+ const color = gradient.rgbAt(factor);
109
+ return color.toHexString();
110
+ }
111
+ catch {
112
+ return color1;
113
+ }
114
+ }
115
+ export function getThemeTypeFromBackgroundColor(backgroundColor) {
116
+ if (!backgroundColor) {
117
+ return undefined;
118
+ }
119
+ const resolvedColor = resolveColor(backgroundColor);
120
+ if (!resolvedColor) {
121
+ return undefined;
122
+ }
123
+ const luminance = getLuminance(resolvedColor);
124
+ return luminance > 128 ? "light" : "dark";
125
+ }
126
+ export const lightTheme = {
127
+ type: "light",
128
+ Background: "#FFFFFF",
129
+ Foreground: "#000000",
130
+ LightBlue: "#005FAF",
131
+ AccentBlue: "#005FAF",
132
+ AccentPurple: "#5F00FF",
133
+ AccentCyan: "#005F87",
134
+ AccentGreen: "#005F00",
135
+ AccentYellow: "#875F00",
136
+ AccentRed: "#AF0000",
137
+ DiffAdded: "#D7FFD7",
138
+ DiffRemoved: "#FFD7D7",
139
+ Comment: "#008700",
140
+ Gray: "#5F5F5F",
141
+ DarkGray: "#5F5F5F",
142
+ InputBackground: "#E4E4E4",
143
+ MessageBackground: "#FAFAFA",
144
+ FocusBackground: "#D7FFD7",
145
+ GradientColors: ["#4796E4", "#847ACE", "#C3677F"],
146
+ };
147
+ export const darkTheme = {
148
+ type: "dark",
149
+ Background: "#000000",
150
+ Foreground: "#FFFFFF",
151
+ LightBlue: "#AFD7D7",
152
+ AccentBlue: "#87AFFF",
153
+ AccentPurple: "#D7AFFF",
154
+ AccentCyan: "#87D7D7",
155
+ AccentGreen: "#D7FFD7",
156
+ AccentYellow: "#FFFFAF",
157
+ AccentRed: "#FF87AF",
158
+ DiffAdded: "#005F00",
159
+ DiffRemoved: "#5F0000",
160
+ Comment: "#AFAFAF",
161
+ Gray: "#AFAFAF",
162
+ DarkGray: "#878787",
163
+ InputBackground: "#5F5F5F",
164
+ MessageBackground: "#5F5F5F",
165
+ FocusBackground: "#005F00",
166
+ GradientColors: ["#4796E4", "#847ACE", "#C3677F"],
167
+ };
168
+ export const ansiTheme = {
169
+ type: "ansi",
170
+ Background: "black",
171
+ Foreground: "",
172
+ LightBlue: "blue",
173
+ AccentBlue: "blue",
174
+ AccentPurple: "magenta",
175
+ AccentCyan: "cyan",
176
+ AccentGreen: "green",
177
+ AccentYellow: "yellow",
178
+ AccentRed: "red",
179
+ DiffAdded: "green",
180
+ DiffRemoved: "red",
181
+ Comment: "gray",
182
+ Gray: "gray",
183
+ DarkGray: "gray",
184
+ InputBackground: "black",
185
+ MessageBackground: "black",
186
+ FocusBackground: "black",
187
+ };
188
+ export class Theme {
189
+ name;
190
+ type;
191
+ colors;
192
+ /**
193
+ * The default foreground color for text when no specific highlight rule applies.
194
+ * This is an Ink-compatible color string (hex or name).
195
+ */
196
+ defaultColor;
197
+ /**
198
+ * Stores the mapping from highlight.js class names (e.g., 'hljs-keyword')
199
+ * to Ink-compatible color strings (hex or name).
200
+ */
201
+ _colorMap;
202
+ semanticColors;
203
+ /**
204
+ * Creates a new Theme instance.
205
+ * @param name The name of the theme.
206
+ * @param rawMappings The raw CSSProperties mappings from a react-syntax-highlighter theme object.
207
+ */
208
+ constructor(name, type, rawMappings, colors, semanticColors) {
209
+ this.name = name;
210
+ this.type = type;
211
+ this.colors = colors;
212
+ this.semanticColors = semanticColors ?? {
213
+ text: {
214
+ primary: this.colors.Foreground,
215
+ secondary: this.colors.Gray,
216
+ link: this.colors.AccentBlue,
217
+ accent: this.colors.AccentPurple,
218
+ response: this.colors.Foreground,
219
+ },
220
+ background: {
221
+ primary: this.colors.Background,
222
+ message: this.colors.MessageBackground ??
223
+ interpolateColor(this.colors.Background, this.colors.Gray, DEFAULT_INPUT_BACKGROUND_OPACITY),
224
+ input: this.colors.InputBackground ??
225
+ interpolateColor(this.colors.Background, this.colors.Gray, DEFAULT_INPUT_BACKGROUND_OPACITY),
226
+ focus: this.colors.FocusBackground ??
227
+ interpolateColor(this.colors.Background, this.colors.FocusColor ?? this.colors.AccentGreen, DEFAULT_SELECTION_OPACITY),
228
+ diff: {
229
+ added: this.colors.DiffAdded,
230
+ removed: this.colors.DiffRemoved,
231
+ },
232
+ },
233
+ border: {
234
+ default: this.colors.DarkGray,
235
+ },
236
+ ui: {
237
+ comment: this.colors.Gray,
238
+ symbol: this.colors.AccentCyan,
239
+ active: this.colors.AccentBlue,
240
+ dark: this.colors.DarkGray,
241
+ focus: this.colors.FocusColor ?? this.colors.AccentGreen,
242
+ gradient: this.colors.GradientColors,
243
+ },
244
+ status: {
245
+ error: this.colors.AccentRed,
246
+ success: this.colors.AccentGreen,
247
+ warning: this.colors.AccentYellow,
248
+ },
249
+ };
250
+ this._colorMap = Object.freeze(this._buildColorMap(rawMappings)); // Build and freeze the map
251
+ // Determine the default foreground color
252
+ const rawDefaultColor = rawMappings["hljs"]?.color;
253
+ this.defaultColor =
254
+ (rawDefaultColor
255
+ ? Theme._resolveColor(rawDefaultColor)
256
+ : undefined) ?? ""; // Default to empty string if not found or resolvable
257
+ }
258
+ /**
259
+ * Gets the Ink-compatible color string for a given highlight.js class name.
260
+ * @param hljsClass The highlight.js class name (e.g., 'hljs-keyword', 'hljs-string').
261
+ * @returns The corresponding Ink color string (hex or name) if it exists.
262
+ */
263
+ getInkColor(hljsClass) {
264
+ return this._colorMap[hljsClass];
265
+ }
266
+ /**
267
+ * Resolves a CSS color value (name or hex) into an Ink-compatible color string.
268
+ * @param colorValue The raw color string (e.g., 'blue', '#ff0000', 'darkkhaki').
269
+ * @returns An Ink-compatible color string (hex or name), or undefined if not resolvable.
270
+ */
271
+ static _resolveColor(colorValue) {
272
+ return resolveColor(colorValue);
273
+ }
274
+ /**
275
+ * Builds the internal map from highlight.js class names to Ink-compatible color strings.
276
+ * This method is protected and primarily intended for use by the constructor.
277
+ * @param hljsTheme The raw CSSProperties mappings from a react-syntax-highlighter theme object.
278
+ * @returns An Ink-compatible theme map (Record<string, string>).
279
+ */
280
+ _buildColorMap(hljsTheme) {
281
+ const inkTheme = {};
282
+ for (const key in hljsTheme) {
283
+ // Ensure the key starts with 'hljs-' or is 'hljs' for the base style
284
+ if (!key.startsWith("hljs-") && key !== "hljs") {
285
+ continue; // Skip keys not related to highlighting classes
286
+ }
287
+ const style = hljsTheme[key];
288
+ if (style?.color) {
289
+ const resolvedColor = Theme._resolveColor(style.color);
290
+ if (resolvedColor !== undefined) {
291
+ // Use the original key from the hljsTheme (e.g., 'hljs-keyword')
292
+ inkTheme[key] = resolvedColor;
293
+ }
294
+ // If color is not resolvable, it's omitted from the map,
295
+ // this enables falling back to the default foreground color.
296
+ }
297
+ // We currently only care about the 'color' property for Ink rendering.
298
+ // Other properties like background, fontStyle, etc., are ignored.
299
+ }
300
+ return inkTheme;
301
+ }
302
+ }
303
+ /**
304
+ * Picks a default theme name based on terminal background color.
305
+ * It first tries to find a theme with an exact background color match.
306
+ * If no match is found, it falls back to a light or dark theme based on the
307
+ * luminance of the background color.
308
+ * @param terminalBackground The hex color string of the terminal background.
309
+ * @param availableThemes A list of available themes to search through.
310
+ * @param defaultDarkThemeName The name of the fallback dark theme.
311
+ * @param defaultLightThemeName The name of the fallback light theme.
312
+ * @returns The name of the chosen theme.
313
+ */
314
+ export function pickDefaultThemeName(terminalBackground, availableThemes, defaultDarkThemeName, defaultLightThemeName) {
315
+ if (terminalBackground) {
316
+ const lowerTerminalBackground = terminalBackground.toLowerCase();
317
+ for (const theme of availableThemes) {
318
+ if (!theme.colors.Background)
319
+ continue;
320
+ // resolveColor can return undefined
321
+ const themeBg = resolveColor(theme.colors.Background)?.toLowerCase();
322
+ if (themeBg === lowerTerminalBackground) {
323
+ return theme.name;
324
+ }
325
+ }
326
+ }
327
+ const themeType = getThemeTypeFromBackgroundColor(terminalBackground);
328
+ if (themeType === "light") {
329
+ return defaultLightThemeName;
330
+ }
331
+ return defaultDarkThemeName;
332
+ }
333
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../../src/cli/theme/theme.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACN,gCAAgC,EAChC,yBAAyB,GACzB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,YAAY,MAAM,cAAc,CAAC;AAExC,wDAAwD;AACxD,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IAC1C,OAAO;IACP,KAAK;IACL,OAAO;IACP,QAAQ;IACR,MAAM;IACN,MAAM;IACN,SAAS;IACT,OAAO;IACP,MAAM;IACN,MAAM;IACN,aAAa;IACb,WAAW;IACX,aAAa;IACb,cAAc;IACd,YAAY;IACZ,YAAY;IACZ,eAAe;IACf,aAAa;CACb,CAAC,CAAC;AAEH,iFAAiF;AACjF,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,WAAW,CACpD,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC;KAC7B,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;KAClD,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC,CACzC,CAAC;AAEF,gFAAgF;AAChF,MAAM,CAAC,MAAM,mBAAmB,GAAqC;IACpE,WAAW,EAAE,SAAS;IACtB,SAAS,EAAE,SAAS;IACpB,WAAW,EAAE,SAAS;IACtB,YAAY,EAAE,SAAS;IACvB,UAAU,EAAE,SAAS;IACrB,aAAa,EAAE,SAAS;IACxB,UAAU,EAAE,SAAS;IACrB,WAAW,EAAE,SAAS;CACtB,CAAC;AAEF;;;;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C,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,WAAW,EAAE,CAAC;YACrE,IAAI,OAAO,KAAK,uBAAuB,EAAE,CAAC;gBACzC,OAAO,KAAK,CAAC,IAAI,CAAC;YACnB,CAAC;QACF,CAAC;IACF,CAAC;IAED,MAAM,SAAS,GAAG,+BAA+B,CAAC,kBAAkB,CAAC,CAAC;IACtE,IAAI,SAAS,KAAK,OAAO,EAAE,CAAC;QAC3B,OAAO,qBAAqB,CAAC;IAC9B,CAAC;IAED,OAAO,oBAAoB,CAAC;AAC7B,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,27 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ // @ts-nocheck
3
+ import { InputContext } from "./context/InputContext.js";
4
+ import { KeypressProvider } from "./context/KeypressContext.js";
5
+ import { useTextBuffer } from "./key/text-buffer.js";
6
+ import { InputPrompt } from "./ui/InputPrompt.js";
7
+ import { render, Text } from "ink";
8
+ import { useMemo, useState } from "react";
9
+ function App() {
10
+ const [submitText, setSubmitText] = useState("");
11
+ const buffer = useTextBuffer();
12
+ const inputState = useMemo(() => ({
13
+ buffer,
14
+ userMessages: inputHistory,
15
+ shellModeActive,
16
+ showEscapePrompt,
17
+ copyModeEnabled,
18
+ inputWidth,
19
+ suggestionsWidth,
20
+ }), [buffer]);
21
+ return (_jsx(KeypressProvider, { children: _jsxs(InputContext.Provider, { value: inputState, children: [_jsxs(Text, { children: ["You submitted: ", submitText] }), _jsx(InputPrompt, { onSubmit: (text) => setSubmitText(text) })] }) }));
22
+ }
23
+ function start() {
24
+ render(_jsx(App, {}));
25
+ }
26
+ start();
27
+ //# sourceMappingURL=tmp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tmp.js","sourceRoot":"","sources":["../../src/cli/tmp.tsx"],"names":[],"mappings":";AAAA,cAAc;AAEd,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1C,SAAS,GAAG;IACX,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAE/B,MAAM,UAAU,GAAG,OAAO,CACzB,GAAG,EAAE,CAAC,CAAC;QACN,MAAM;QACN,YAAY,EAAE,YAAY;QAC1B,eAAe;QACf,gBAAgB;QAChB,eAAe;QACf,UAAU;QACV,gBAAgB;KAChB,CAAC,EACF,CAAC,MAAM,CAAC,CACR,CAAC;IAEF,OAAO,CACN,KAAC,gBAAgB,cAChB,MAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,UAAU,aACvC,MAAC,IAAI,kCAAiB,UAAU,IAAQ,EACxC,KAAC,WAAW,IAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,GAAI,IACjC,GACN,CACnB,CAAC;AACH,CAAC;AACD,SAAS,KAAK;IACb,MAAM,CAAC,KAAC,GAAG,KAAG,CAAC,CAAC;AACjB,CAAC;AAED,KAAK,EAAE,CAAC"}
@@ -0,0 +1,97 @@
1
+ export type HistoryType = "user" | "assistant" | "error" | "info";
2
+ export interface HistoryItem {
3
+ id: number;
4
+ type: HistoryType;
5
+ content: string;
6
+ timestamp: number;
7
+ }
8
+ export interface HistoryItemBase {
9
+ text?: string;
10
+ }
11
+ export type HistoryItemUser = HistoryItemBase & {
12
+ type: "user";
13
+ text: string;
14
+ };
15
+ export type HistoryItemLLM = HistoryItemBase & {
16
+ type: "llm";
17
+ text: string;
18
+ };
19
+ export type HistoryItemLLMContent = HistoryItemBase & {
20
+ type: "llm_content";
21
+ text: string;
22
+ };
23
+ export type HistoryItemInfo = HistoryItemBase & {
24
+ type: "info";
25
+ text: string;
26
+ secondaryText?: string;
27
+ source?: string;
28
+ icon?: string;
29
+ color?: string;
30
+ marginBottom?: number;
31
+ };
32
+ export type HistoryItemError = HistoryItemBase & {
33
+ type: "error";
34
+ text: string;
35
+ };
36
+ export type HistoryItemWarning = HistoryItemBase & {
37
+ type: "warning";
38
+ text: string;
39
+ };
40
+ /**
41
+ * 현재 스트리밍 중인 응답의 상태.
42
+ *
43
+ * `<Static>` 바깥에서 활발히 리렌더링되며,
44
+ * `isComplete === true`가 되면 AppContainer가 history로 이관합니다.
45
+ */
46
+ export interface PendingItem {
47
+ type: "assistant";
48
+ /** 실시간으로 누적되는 텍스트 (thinking 제외) */
49
+ content: string;
50
+ /** 생각하는 과정 텍스트 */
51
+ thinkingContent?: string;
52
+ /** 현재 thinking 블록 안에 있는지 */
53
+ isThinking?: boolean;
54
+ /** 스트림이 완료되었는지 */
55
+ isComplete: boolean;
56
+ }
57
+ /**
58
+ * LLM 스트리밍의 전체 상태 머신.
59
+ *
60
+ * - `idle`: 대기 상태 (입력 가능)
61
+ * - `thinking`: 요청 전송 완료, 첫 번째 청크 대기 중
62
+ * - `streaming`: 청크가 도착하여 실시간 출력 중
63
+ * - `executing`: LLM이 도구(Tool)를 호출하여 실행 중인 상태
64
+ * - `error`: 스트리밍 중 에러 발생
65
+ */
66
+ export type StreamingState = "idle" | "thinking" | "streaming" | "executing" | "error";
67
+ /**
68
+ * 컨텐츠 렌더링 함수 시그니처.
69
+ * 향후 마크다운 렌더링 지원 시 이 타입의 구현체를 교체하면 됩니다.
70
+ */
71
+ export type ContentRenderer = (content: string, width: number) => string;
72
+ /** Ollama 대화 메시지 (멀티턴 히스토리용) */
73
+ export interface OllamaMessage {
74
+ role: "system" | "user" | "assistant";
75
+ content: string;
76
+ }
77
+ /** MCP 도구 호출 결과 (SDK의 CallToolResult 경량 재정의) */
78
+ export interface McpToolResult {
79
+ isError?: boolean;
80
+ content: Array<{
81
+ type: string;
82
+ text?: string;
83
+ }>;
84
+ }
85
+ /** MCP callTool 함수 시그니처 */
86
+ export type CallToolFn = (name: string, args: Record<string, unknown>) => Promise<McpToolResult>;
87
+ /** Dispatcher 슬래시 커맨드 처리 결과 */
88
+ export interface DispatchResult {
89
+ type: "tool_result" | "local_action" | "unknown_command" | "llm_required";
90
+ content: string;
91
+ /** llm_required 타입일 때 원본 사용자 입력 (LLM에게 보낼 의도) */
92
+ userIntent?: string;
93
+ }
94
+ /** MCP 클라이언트 연결 상태 */
95
+ export type McpConnectionState = "disconnected" | "connecting" | "connected" | "error";
96
+ /** LLM Health Check Status */
97
+ export type LLMHealthStatus = "checking" | "success" | "error";
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/cli/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * ConnectionStatus — 다중 MCP 서버 연결 상태 표시기
3
+ *
4
+ * 터미널 상단에 각 MCP 서버의 연결 상태를 시각적으로 표시합니다.
5
+ */
6
+ import type { ServerConnectionInfo } from "../services/McpManager.js";
7
+ import type React from "react";
8
+ interface ConnectionStatusProps {
9
+ connections: Map<string, ServerConnectionInfo>;
10
+ errors: Map<string, Error>;
11
+ }
12
+ export declare const ConnectionStatus: React.FC<ConnectionStatusProps>;
13
+ export {};
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text } from "ink";
3
+ const STATE_CONFIG = {
4
+ connected: { symbol: "●", color: "green", label: "Connected" },
5
+ connecting: { symbol: "○", color: "yellow", label: "Connecting..." },
6
+ disconnected: { symbol: "◌", color: "gray", label: "Disconnected" },
7
+ error: { symbol: "✖", color: "red", label: "Error" },
8
+ };
9
+ export const ConnectionStatus = ({ connections, errors, }) => {
10
+ if (connections.size === 0) {
11
+ return (_jsx(Box, { paddingX: 1, marginBottom: 1, children: _jsx(Text, { color: "gray", children: "\u25CC MCP \uC11C\uBC84\uAC00 \uC124\uC815\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4" }) }));
12
+ }
13
+ return (_jsx(Box, { paddingX: 1, marginBottom: 1, flexDirection: "column", children: Array.from(connections.entries()).map(([serverName, info]) => {
14
+ const config = STATE_CONFIG[info.state];
15
+ const serverError = errors.get(serverName);
16
+ return (_jsxs(Box, { flexDirection: "row", children: [_jsxs(Text, { color: config.color, children: [config.symbol, " ", serverName] }), _jsxs(Text, { color: "gray", children: [" — ", config.label] }), info.state === "connected" && info.toolCount > 0 && (_jsxs(Text, { color: "gray", children: [" (", info.toolCount, " tools)"] })), info.state === "error" && serverError && (_jsxs(Text, { color: "red", children: [" (", serverError.message, ")"] }))] }, serverName));
17
+ }) }));
18
+ };
19
+ //# sourceMappingURL=ConnectionStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConnectionStatus.js","sourceRoot":"","sources":["../../../src/cli/ui/ConnectionStatus.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAQhC,MAAM,YAAY,GAGd;IACH,SAAS,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE;IAC9D,UAAU,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,eAAe,EAAE;IACpE,YAAY,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE;IACnE,KAAK,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAA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CACN,CAAC;QACH,CAAC,CAAC,GACG,CACN,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type React from "react";
7
+ export interface HalfLinePaddedBoxProps {
8
+ backgroundBaseColor: string;
9
+ backgroundOpacity: number;
10
+ useBackgroundColor?: boolean;
11
+ children: React.ReactNode;
12
+ }
13
+ export declare const HalfLinePaddedBox: React.FC<HalfLinePaddedBoxProps>;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * @license
4
+ * Copyright 2025 Google LLC
5
+ * SPDX-License-Identifier: Apache-2.0
6
+ */
7
+ import { Box } from "ink";
8
+ export const HalfLinePaddedBox = (props) => {
9
+ return _jsx(Box, { flexDirection: "column", children: props.children });
10
+ };
11
+ //# sourceMappingURL=HalfPaddingBox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HalfPaddingBox.js","sourceRoot":"","sources":["../../../src/cli/ui/HalfPaddingBox.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAU1B,MAAM,CAAC,MAAM,iBAAiB,GAAqC,CAAC,KAAK,EAAE,EAAE;IAC5E,OAAO,KAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,YAAE,KAAK,CAAC,QAAQ,GAAO,CAAC;AAC3D,CAAC,CAAC"}