stellavault 0.1.0 → 0.2.1

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 (385) hide show
  1. package/package.json +1 -1
  2. package/packages/cli/bin/ekh.js +2 -2
  3. package/packages/cli/dist/commands/federate-cmd.js +61 -31
  4. package/packages/core/dist/api/dashboard.d.ts +3 -0
  5. package/packages/core/{src/api/dashboard.ts → dist/api/dashboard.js} +8 -11
  6. package/packages/core/dist/api/graph-data.d.ts +11 -0
  7. package/packages/core/dist/api/graph-data.js +255 -0
  8. package/packages/core/dist/api/pwa.d.ts +3 -0
  9. package/packages/core/{src/api/pwa.ts → dist/api/pwa.js} +27 -32
  10. package/packages/core/dist/api/server.d.ts +16 -0
  11. package/packages/core/dist/api/server.js +647 -0
  12. package/packages/core/dist/capture/voice.d.ts +24 -0
  13. package/packages/core/dist/capture/voice.js +135 -0
  14. package/packages/core/{src/cloud/index.ts → dist/cloud/index.d.ts} +1 -0
  15. package/packages/core/dist/cloud/index.js +2 -0
  16. package/packages/core/dist/cloud/sync.d.ts +29 -0
  17. package/packages/core/dist/cloud/sync.js +137 -0
  18. package/packages/core/dist/config.d.ts +27 -0
  19. package/packages/core/dist/config.js +55 -0
  20. package/packages/core/dist/federation/credits.d.ts +26 -0
  21. package/packages/core/dist/federation/credits.js +56 -0
  22. package/packages/core/dist/federation/identity.d.ts +14 -0
  23. package/packages/core/dist/federation/identity.js +74 -0
  24. package/packages/core/{src/federation/index.ts → dist/federation/index.d.ts} +1 -2
  25. package/packages/core/dist/federation/index.js +5 -0
  26. package/packages/core/dist/federation/node.d.ts +31 -0
  27. package/packages/core/dist/federation/node.js +216 -0
  28. package/packages/core/dist/federation/privacy.d.ts +8 -0
  29. package/packages/core/dist/federation/privacy.js +40 -0
  30. package/packages/core/dist/federation/reputation.d.ts +37 -0
  31. package/packages/core/dist/federation/reputation.js +139 -0
  32. package/packages/core/dist/federation/search.d.ts +19 -0
  33. package/packages/core/dist/federation/search.js +101 -0
  34. package/packages/core/dist/federation/sharing.d.ts +72 -0
  35. package/packages/core/dist/federation/sharing.js +246 -0
  36. package/packages/core/dist/federation/trust.d.ts +15 -0
  37. package/packages/core/dist/federation/trust.js +60 -0
  38. package/packages/core/dist/federation/types.d.ts +40 -0
  39. package/packages/core/dist/federation/types.js +3 -0
  40. package/packages/core/dist/i18n/index.d.ts +6 -0
  41. package/packages/core/dist/i18n/index.js +81 -0
  42. package/packages/core/{src/index.ts → dist/index.d.ts} +48 -67
  43. package/packages/core/dist/index.js +69 -0
  44. package/packages/core/dist/indexer/chunker.d.ts +14 -0
  45. package/packages/core/dist/indexer/chunker.js +148 -0
  46. package/packages/core/dist/indexer/embedder.d.ts +8 -0
  47. package/packages/core/dist/indexer/embedder.js +3 -0
  48. package/packages/core/dist/indexer/index.d.ts +28 -0
  49. package/packages/core/dist/indexer/index.js +74 -0
  50. package/packages/core/dist/indexer/local-embedder.d.ts +3 -0
  51. package/packages/core/dist/indexer/local-embedder.js +29 -0
  52. package/packages/core/dist/indexer/scanner.d.ts +11 -0
  53. package/packages/core/dist/indexer/scanner.js +137 -0
  54. package/packages/core/dist/indexer/watcher.d.ts +19 -0
  55. package/packages/core/dist/indexer/watcher.js +49 -0
  56. package/packages/core/dist/intelligence/contradiction-detector.d.ts +20 -0
  57. package/packages/core/dist/intelligence/contradiction-detector.js +115 -0
  58. package/packages/core/dist/intelligence/decay-engine.d.ts +27 -0
  59. package/packages/core/dist/intelligence/decay-engine.js +190 -0
  60. package/packages/core/dist/intelligence/duplicate-detector.d.ts +20 -0
  61. package/packages/core/dist/intelligence/duplicate-detector.js +55 -0
  62. package/packages/core/dist/intelligence/fsrs.d.ts +43 -0
  63. package/packages/core/dist/intelligence/fsrs.js +70 -0
  64. package/packages/core/dist/intelligence/gap-detector.d.ts +25 -0
  65. package/packages/core/dist/intelligence/gap-detector.js +78 -0
  66. package/packages/core/dist/intelligence/learning-path.d.ts +31 -0
  67. package/packages/core/dist/intelligence/learning-path.js +53 -0
  68. package/packages/core/dist/intelligence/notifications.d.ts +31 -0
  69. package/packages/core/dist/intelligence/notifications.js +65 -0
  70. package/packages/core/dist/intelligence/predictive-gaps.d.ts +14 -0
  71. package/packages/core/dist/intelligence/predictive-gaps.js +74 -0
  72. package/packages/core/dist/intelligence/semantic-versioning.d.ts +37 -0
  73. package/packages/core/dist/intelligence/semantic-versioning.js +68 -0
  74. package/packages/core/dist/intelligence/types.d.ts +28 -0
  75. package/packages/core/dist/intelligence/types.js +3 -0
  76. package/packages/core/dist/mcp/custom-tools.d.ts +29 -0
  77. package/packages/core/dist/mcp/custom-tools.js +70 -0
  78. package/packages/core/{src/mcp/index.ts → dist/mcp/index.d.ts} +1 -0
  79. package/packages/core/dist/mcp/index.js +2 -0
  80. package/packages/core/dist/mcp/server.d.ts +49 -0
  81. package/packages/core/dist/mcp/server.js +133 -0
  82. package/packages/core/dist/mcp/tools/agentic-graph.d.ts +87 -0
  83. package/packages/core/dist/mcp/tools/agentic-graph.js +88 -0
  84. package/packages/core/dist/mcp/tools/brief.d.ts +31 -0
  85. package/packages/core/dist/mcp/tools/brief.js +39 -0
  86. package/packages/core/dist/mcp/tools/decay.d.ts +33 -0
  87. package/packages/core/dist/mcp/tools/decay.js +32 -0
  88. package/packages/core/dist/mcp/tools/decision-journal.d.ts +78 -0
  89. package/packages/core/dist/mcp/tools/decision-journal.js +79 -0
  90. package/packages/core/dist/mcp/tools/export.d.ts +29 -0
  91. package/packages/core/dist/mcp/tools/export.js +60 -0
  92. package/packages/core/dist/mcp/tools/federated-search.d.ts +29 -0
  93. package/packages/core/dist/mcp/tools/federated-search.js +36 -0
  94. package/packages/core/dist/mcp/tools/generate-claude-md.d.ts +35 -0
  95. package/packages/core/dist/mcp/tools/generate-claude-md.js +107 -0
  96. package/packages/core/dist/mcp/tools/get-document.d.ts +35 -0
  97. package/packages/core/dist/mcp/tools/get-document.js +25 -0
  98. package/packages/core/dist/mcp/tools/get-related.d.ts +32 -0
  99. package/packages/core/dist/mcp/tools/get-related.js +33 -0
  100. package/packages/core/dist/mcp/tools/learning-path.d.ts +23 -0
  101. package/packages/core/dist/mcp/tools/learning-path.js +45 -0
  102. package/packages/core/dist/mcp/tools/list-topics.d.ts +15 -0
  103. package/packages/core/dist/mcp/tools/list-topics.js +18 -0
  104. package/packages/core/dist/mcp/tools/search.d.ts +39 -0
  105. package/packages/core/dist/mcp/tools/search.js +29 -0
  106. package/packages/core/dist/mcp/tools/snapshot.d.ts +47 -0
  107. package/packages/core/dist/mcp/tools/snapshot.js +84 -0
  108. package/packages/core/dist/multi-vault/index.d.ts +26 -0
  109. package/packages/core/dist/multi-vault/index.js +80 -0
  110. package/packages/core/dist/pack/creator.d.ts +21 -0
  111. package/packages/core/dist/pack/creator.js +105 -0
  112. package/packages/core/dist/pack/exporter.d.ts +4 -0
  113. package/packages/core/dist/pack/exporter.js +18 -0
  114. package/packages/core/dist/pack/importer.d.ts +10 -0
  115. package/packages/core/dist/pack/importer.js +55 -0
  116. package/packages/core/{src/pack/index.ts → dist/pack/index.d.ts} +1 -0
  117. package/packages/core/dist/pack/index.js +5 -0
  118. package/packages/core/dist/pack/marketplace.d.ts +14 -0
  119. package/packages/core/dist/pack/marketplace.js +90 -0
  120. package/packages/core/dist/pack/pii-masker.d.ts +7 -0
  121. package/packages/core/dist/pack/pii-masker.js +29 -0
  122. package/packages/core/dist/pack/types.d.ts +36 -0
  123. package/packages/core/dist/pack/types.js +3 -0
  124. package/packages/core/dist/plugins/index.d.ts +35 -0
  125. package/packages/core/dist/plugins/index.js +57 -0
  126. package/packages/core/dist/plugins/webhooks.d.ts +30 -0
  127. package/packages/core/dist/plugins/webhooks.js +79 -0
  128. package/packages/core/dist/search/bm25.d.ts +4 -0
  129. package/packages/core/dist/search/bm25.js +10 -0
  130. package/packages/core/dist/search/index.d.ts +13 -0
  131. package/packages/core/dist/search/index.js +63 -0
  132. package/packages/core/dist/search/rrf.d.ts +7 -0
  133. package/packages/core/dist/search/rrf.js +21 -0
  134. package/packages/core/dist/search/semantic.d.ts +5 -0
  135. package/packages/core/dist/search/semantic.js +6 -0
  136. package/packages/core/{src/store/index.ts → dist/store/index.d.ts} +1 -0
  137. package/packages/core/dist/store/index.js +2 -0
  138. package/packages/core/dist/store/sqlite-vec.d.ts +6 -0
  139. package/packages/core/dist/store/sqlite-vec.js +251 -0
  140. package/packages/core/dist/store/types.d.ts +20 -0
  141. package/packages/core/dist/store/types.js +3 -0
  142. package/packages/core/dist/team/index.d.ts +25 -0
  143. package/packages/core/dist/team/index.js +97 -0
  144. package/packages/core/dist/types/chunk.d.ts +23 -0
  145. package/packages/core/dist/types/chunk.js +3 -0
  146. package/packages/core/dist/types/document.d.ts +23 -0
  147. package/packages/core/dist/types/document.js +3 -0
  148. package/packages/core/dist/types/graph.d.ts +39 -0
  149. package/packages/core/dist/types/graph.js +3 -0
  150. package/packages/core/dist/types/index.d.ts +5 -0
  151. package/packages/core/dist/types/index.js +2 -0
  152. package/packages/core/dist/types/search.d.ts +39 -0
  153. package/packages/core/dist/types/search.js +3 -0
  154. package/packages/core/dist/utils/retry.d.ts +25 -0
  155. package/packages/core/dist/utils/retry.js +59 -0
  156. package/memory/MEMORY.md +0 -25
  157. package/packages/cli/dist/commands/brief-cmd.d.ts.map +0 -1
  158. package/packages/cli/dist/commands/brief-cmd.js.map +0 -1
  159. package/packages/cli/dist/commands/capture-cmd.d.ts.map +0 -1
  160. package/packages/cli/dist/commands/capture-cmd.js.map +0 -1
  161. package/packages/cli/dist/commands/card-cmd.d.ts.map +0 -1
  162. package/packages/cli/dist/commands/card-cmd.js.map +0 -1
  163. package/packages/cli/dist/commands/clip-cmd.d.ts.map +0 -1
  164. package/packages/cli/dist/commands/clip-cmd.js.map +0 -1
  165. package/packages/cli/dist/commands/cloud-cmd.d.ts.map +0 -1
  166. package/packages/cli/dist/commands/cloud-cmd.js.map +0 -1
  167. package/packages/cli/dist/commands/contradictions-cmd.d.ts.map +0 -1
  168. package/packages/cli/dist/commands/contradictions-cmd.js.map +0 -1
  169. package/packages/cli/dist/commands/decay-cmd.d.ts.map +0 -1
  170. package/packages/cli/dist/commands/decay-cmd.js.map +0 -1
  171. package/packages/cli/dist/commands/digest-cmd.d.ts.map +0 -1
  172. package/packages/cli/dist/commands/digest-cmd.js.map +0 -1
  173. package/packages/cli/dist/commands/duplicates-cmd.d.ts.map +0 -1
  174. package/packages/cli/dist/commands/duplicates-cmd.js.map +0 -1
  175. package/packages/cli/dist/commands/federate-cmd.d.ts.map +0 -1
  176. package/packages/cli/dist/commands/federate-cmd.js.map +0 -1
  177. package/packages/cli/dist/commands/gaps-cmd.d.ts.map +0 -1
  178. package/packages/cli/dist/commands/gaps-cmd.js.map +0 -1
  179. package/packages/cli/dist/commands/graph-cmd.d.ts.map +0 -1
  180. package/packages/cli/dist/commands/graph-cmd.js.map +0 -1
  181. package/packages/cli/dist/commands/index-cmd.d.ts.map +0 -1
  182. package/packages/cli/dist/commands/index-cmd.js.map +0 -1
  183. package/packages/cli/dist/commands/init-cmd.d.ts.map +0 -1
  184. package/packages/cli/dist/commands/init-cmd.js.map +0 -1
  185. package/packages/cli/dist/commands/learn-cmd.d.ts.map +0 -1
  186. package/packages/cli/dist/commands/learn-cmd.js.map +0 -1
  187. package/packages/cli/dist/commands/pack-cmd.d.ts.map +0 -1
  188. package/packages/cli/dist/commands/pack-cmd.js.map +0 -1
  189. package/packages/cli/dist/commands/review-cmd.d.ts.map +0 -1
  190. package/packages/cli/dist/commands/review-cmd.js.map +0 -1
  191. package/packages/cli/dist/commands/search-cmd.d.ts.map +0 -1
  192. package/packages/cli/dist/commands/search-cmd.js.map +0 -1
  193. package/packages/cli/dist/commands/serve-cmd.d.ts.map +0 -1
  194. package/packages/cli/dist/commands/serve-cmd.js.map +0 -1
  195. package/packages/cli/dist/commands/status-cmd.d.ts.map +0 -1
  196. package/packages/cli/dist/commands/status-cmd.js.map +0 -1
  197. package/packages/cli/dist/commands/sync-cmd.d.ts.map +0 -1
  198. package/packages/cli/dist/commands/sync-cmd.js.map +0 -1
  199. package/packages/cli/dist/commands/vault-cmd.d.ts.map +0 -1
  200. package/packages/cli/dist/commands/vault-cmd.js.map +0 -1
  201. package/packages/cli/dist/index.d.ts.map +0 -1
  202. package/packages/cli/dist/index.js.map +0 -1
  203. package/packages/cli/src/commands/brief-cmd.ts +0 -87
  204. package/packages/cli/src/commands/capture-cmd.ts +0 -34
  205. package/packages/cli/src/commands/card-cmd.ts +0 -29
  206. package/packages/cli/src/commands/clip-cmd.ts +0 -172
  207. package/packages/cli/src/commands/cloud-cmd.ts +0 -75
  208. package/packages/cli/src/commands/contradictions-cmd.ts +0 -41
  209. package/packages/cli/src/commands/decay-cmd.ts +0 -57
  210. package/packages/cli/src/commands/digest-cmd.ts +0 -89
  211. package/packages/cli/src/commands/duplicates-cmd.ts +0 -38
  212. package/packages/cli/src/commands/federate-cmd.ts +0 -236
  213. package/packages/cli/src/commands/gaps-cmd.ts +0 -40
  214. package/packages/cli/src/commands/graph-cmd.ts +0 -88
  215. package/packages/cli/src/commands/index-cmd.ts +0 -65
  216. package/packages/cli/src/commands/init-cmd.ts +0 -145
  217. package/packages/cli/src/commands/learn-cmd.ts +0 -56
  218. package/packages/cli/src/commands/pack-cmd.ts +0 -121
  219. package/packages/cli/src/commands/review-cmd.ts +0 -125
  220. package/packages/cli/src/commands/search-cmd.ts +0 -45
  221. package/packages/cli/src/commands/serve-cmd.ts +0 -17
  222. package/packages/cli/src/commands/status-cmd.ts +0 -37
  223. package/packages/cli/src/commands/sync-cmd.ts +0 -68
  224. package/packages/cli/src/commands/vault-cmd.ts +0 -64
  225. package/packages/cli/src/index.ts +0 -187
  226. package/packages/core/src/api/graph-data.ts +0 -286
  227. package/packages/core/src/api/server.ts +0 -660
  228. package/packages/core/src/capture/voice.ts +0 -168
  229. package/packages/core/src/cloud/sync.ts +0 -167
  230. package/packages/core/src/config.ts +0 -82
  231. package/packages/core/src/federation/credits.ts +0 -80
  232. package/packages/core/src/federation/hyperswarm.d.ts +0 -19
  233. package/packages/core/src/federation/identity.ts +0 -90
  234. package/packages/core/src/federation/node.ts +0 -235
  235. package/packages/core/src/federation/privacy.ts +0 -52
  236. package/packages/core/src/federation/reputation.ts +0 -202
  237. package/packages/core/src/federation/search.ts +0 -129
  238. package/packages/core/src/federation/sharing.ts +0 -165
  239. package/packages/core/src/federation/trust.ts +0 -76
  240. package/packages/core/src/federation/types.ts +0 -25
  241. package/packages/core/src/i18n/index.ts +0 -85
  242. package/packages/core/src/indexer/chunker.ts +0 -180
  243. package/packages/core/src/indexer/embedder.ts +0 -9
  244. package/packages/core/src/indexer/index.ts +0 -113
  245. package/packages/core/src/indexer/local-embedder.ts +0 -35
  246. package/packages/core/src/indexer/scanner.ts +0 -142
  247. package/packages/core/src/indexer/watcher.ts +0 -62
  248. package/packages/core/src/intelligence/contradiction-detector.ts +0 -134
  249. package/packages/core/src/intelligence/decay-engine.ts +0 -229
  250. package/packages/core/src/intelligence/duplicate-detector.ts +0 -71
  251. package/packages/core/src/intelligence/fsrs.ts +0 -79
  252. package/packages/core/src/intelligence/gap-detector.ts +0 -109
  253. package/packages/core/src/intelligence/learning-path.ts +0 -86
  254. package/packages/core/src/intelligence/notifications.ts +0 -106
  255. package/packages/core/src/intelligence/predictive-gaps.ts +0 -94
  256. package/packages/core/src/intelligence/semantic-versioning.ts +0 -97
  257. package/packages/core/src/intelligence/types.ts +0 -28
  258. package/packages/core/src/mcp/custom-tools.ts +0 -97
  259. package/packages/core/src/mcp/server.ts +0 -142
  260. package/packages/core/src/mcp/tools/agentic-graph.ts +0 -96
  261. package/packages/core/src/mcp/tools/brief.ts +0 -49
  262. package/packages/core/src/mcp/tools/decay.ts +0 -40
  263. package/packages/core/src/mcp/tools/decision-journal.ts +0 -95
  264. package/packages/core/src/mcp/tools/export.ts +0 -72
  265. package/packages/core/src/mcp/tools/federated-search.ts +0 -43
  266. package/packages/core/src/mcp/tools/generate-claude-md.ts +0 -130
  267. package/packages/core/src/mcp/tools/get-document.ts +0 -26
  268. package/packages/core/src/mcp/tools/get-related.ts +0 -41
  269. package/packages/core/src/mcp/tools/learning-path.ts +0 -52
  270. package/packages/core/src/mcp/tools/list-topics.ts +0 -20
  271. package/packages/core/src/mcp/tools/search.ts +0 -35
  272. package/packages/core/src/mcp/tools/snapshot.ts +0 -98
  273. package/packages/core/src/multi-vault/index.ts +0 -118
  274. package/packages/core/src/pack/creator.ts +0 -127
  275. package/packages/core/src/pack/exporter.ts +0 -21
  276. package/packages/core/src/pack/importer.ts +0 -82
  277. package/packages/core/src/pack/marketplace.ts +0 -103
  278. package/packages/core/src/pack/pii-masker.ts +0 -38
  279. package/packages/core/src/pack/types.ts +0 -39
  280. package/packages/core/src/plugins/index.ts +0 -100
  281. package/packages/core/src/plugins/webhooks.ts +0 -110
  282. package/packages/core/src/search/bm25.ts +0 -16
  283. package/packages/core/src/search/index.ts +0 -83
  284. package/packages/core/src/search/rrf.ts +0 -31
  285. package/packages/core/src/search/semantic.ts +0 -15
  286. package/packages/core/src/store/sqlite-vec.ts +0 -290
  287. package/packages/core/src/store/types.ts +0 -22
  288. package/packages/core/src/team/index.ts +0 -126
  289. package/packages/core/src/types/chunk.ts +0 -25
  290. package/packages/core/src/types/document.ts +0 -24
  291. package/packages/core/src/types/graph.ts +0 -44
  292. package/packages/core/src/types/index.ts +0 -15
  293. package/packages/core/src/types/search.ts +0 -38
  294. package/packages/core/src/utils/retry.ts +0 -85
  295. package/packages/core/tests/api-card.test.ts +0 -60
  296. package/packages/core/tests/api-routes.test.ts +0 -98
  297. package/packages/core/tests/bm25.test.ts +0 -87
  298. package/packages/core/tests/chunker.test.ts +0 -48
  299. package/packages/core/tests/cluster.test.ts +0 -75
  300. package/packages/core/tests/constellation.test.ts +0 -77
  301. package/packages/core/tests/export-utils.test.ts +0 -97
  302. package/packages/core/tests/fsrs.test.ts +0 -96
  303. package/packages/core/tests/gesture-detector.test.ts +0 -45
  304. package/packages/core/tests/graph-data.test.ts +0 -87
  305. package/packages/core/tests/layout.test.ts +0 -83
  306. package/packages/core/tests/mcp.test.ts +0 -148
  307. package/packages/core/tests/pack.test.ts +0 -127
  308. package/packages/core/tests/pii-masker.test.ts +0 -42
  309. package/packages/core/tests/profile-card.test.ts +0 -62
  310. package/packages/core/tests/rrf.test.ts +0 -29
  311. package/packages/core/tests/search-integration.test.ts +0 -139
  312. package/packages/core/tests/store.test.ts +0 -80
  313. package/packages/graph/click-result.png +0 -0
  314. package/packages/graph/index.html +0 -17
  315. package/packages/graph/package.json +0 -32
  316. package/packages/graph/src/App.tsx +0 -7
  317. package/packages/graph/src/api/client.ts +0 -39
  318. package/packages/graph/src/components/ClusterFilter.tsx +0 -73
  319. package/packages/graph/src/components/ConstellationView.tsx +0 -232
  320. package/packages/graph/src/components/ExportPanel.tsx +0 -177
  321. package/packages/graph/src/components/Graph3D.tsx +0 -230
  322. package/packages/graph/src/components/GraphEdges.tsx +0 -100
  323. package/packages/graph/src/components/GraphNodes.tsx +0 -386
  324. package/packages/graph/src/components/HealthDashboard.tsx +0 -173
  325. package/packages/graph/src/components/Layout.tsx +0 -214
  326. package/packages/graph/src/components/MotionOverlay.tsx +0 -81
  327. package/packages/graph/src/components/MotionToggle.tsx +0 -33
  328. package/packages/graph/src/components/MultiverseView.tsx +0 -286
  329. package/packages/graph/src/components/NodeDetail.tsx +0 -232
  330. package/packages/graph/src/components/PulseParticle.tsx +0 -232
  331. package/packages/graph/src/components/SearchBar.tsx +0 -107
  332. package/packages/graph/src/components/StarField.tsx +0 -197
  333. package/packages/graph/src/components/StatusBar.tsx +0 -53
  334. package/packages/graph/src/components/Timeline.tsx +0 -148
  335. package/packages/graph/src/components/ToolsPanel.tsx +0 -512
  336. package/packages/graph/src/components/Tooltip.tsx +0 -100
  337. package/packages/graph/src/components/TypeFilter.tsx +0 -131
  338. package/packages/graph/src/embed/EmbedGraph.tsx +0 -144
  339. package/packages/graph/src/hooks/useConstellationLOD.ts +0 -76
  340. package/packages/graph/src/hooks/useDecay.ts +0 -37
  341. package/packages/graph/src/hooks/useExport.ts +0 -165
  342. package/packages/graph/src/hooks/useGraph.ts +0 -69
  343. package/packages/graph/src/hooks/useKeyboardNav.ts +0 -122
  344. package/packages/graph/src/hooks/useLayout.ts +0 -45
  345. package/packages/graph/src/hooks/useMotion.ts +0 -120
  346. package/packages/graph/src/hooks/usePulse.ts +0 -58
  347. package/packages/graph/src/hooks/useSearch.ts +0 -71
  348. package/packages/graph/src/lib/constellation.ts +0 -107
  349. package/packages/graph/src/lib/export-utils.ts +0 -48
  350. package/packages/graph/src/lib/gesture-detector.ts +0 -123
  351. package/packages/graph/src/lib/layout.worker.ts +0 -153
  352. package/packages/graph/src/lib/motion-controller.ts +0 -83
  353. package/packages/graph/src/lib/profile-card.ts +0 -122
  354. package/packages/graph/src/main.tsx +0 -4
  355. package/packages/graph/src/stores/graph-store.ts +0 -155
  356. package/packages/graph/success.png +0 -0
  357. package/packages/graph/test-click.mjs +0 -49
  358. package/packages/graph/test-explore.mjs +0 -102
  359. package/packages/graph/test-final.mjs +0 -61
  360. package/packages/graph/test-graph.mjs +0 -139
  361. package/packages/graph/test-hover.mjs +0 -48
  362. package/packages/graph/test-pulse.mjs +0 -68
  363. package/packages/graph/test-screenshot.mjs +0 -56
  364. package/packages/graph/test-v2.mjs +0 -97
  365. package/packages/graph/vite.config.ts +0 -15
  366. package/packages/sync/.env.example +0 -11
  367. package/packages/sync/.sync-state.json +0 -317
  368. package/packages/sync/.upload-state.json +0 -1009
  369. package/packages/sync/create-stella-network-notion.mjs +0 -151
  370. package/packages/sync/create-stellavault-project-notion.mjs +0 -322
  371. package/packages/sync/logs/sync-2026-03-28.log +0 -6
  372. package/packages/sync/logs/sync-2026-03-29.log +0 -12
  373. package/packages/sync/logs/sync-2026-03-30.log +0 -6
  374. package/packages/sync/logs/sync-2026-03-31.log +0 -6
  375. package/packages/sync/logs/sync-2026-04-01.log +0 -6
  376. package/packages/sync/logs/sync-2026-04-02.log +0 -6
  377. package/packages/sync/package-lock.json +0 -373
  378. package/packages/sync/package.json +0 -16
  379. package/packages/sync/run-sync.bat +0 -18
  380. package/packages/sync/run-sync.mjs +0 -46
  381. package/packages/sync/setup-scheduler.mjs +0 -119
  382. package/packages/sync/structured-sync.mjs +0 -187
  383. package/packages/sync/sync-to-obsidian.mjs +0 -264
  384. package/packages/sync/upload-pdca-to-notion.mjs +0 -495
  385. package/tsconfig.base.json +0 -18
@@ -0,0 +1,69 @@
1
+ // Design Ref: §4.2 — Core Internal API (Facade)
2
+ // Design Ref: §9.3 — Dependency Injection Pattern
3
+ export { loadConfig } from './config.js';
4
+ // Store
5
+ export { createSqliteVecStore } from './store/index.js';
6
+ // Indexer
7
+ export { indexVault, scanVault, chunkDocument, createLocalEmbedder } from './indexer/index.js';
8
+ // Search
9
+ export { createSearchEngine } from './search/index.js';
10
+ // MCP
11
+ export { createMcpServer } from './mcp/index.js';
12
+ // Pack (Phase 3)
13
+ export { createPack, exportPack, importPack, packToSummary, maskPII } from './pack/index.js';
14
+ // API (Phase 2)
15
+ export { createApiServer } from './api/server.js';
16
+ // Intelligence (Phase 4b)
17
+ export { DecayEngine } from './intelligence/decay-engine.js';
18
+ export { computeRetrievability, updateStability, estimateInitialStability, elapsedDays } from './intelligence/fsrs.js';
19
+ export { detectDuplicates } from './intelligence/duplicate-detector.js';
20
+ export { detectKnowledgeGaps } from './intelligence/gap-detector.js';
21
+ export { detectContradictions } from './intelligence/contradiction-detector.js';
22
+ export { computeSemanticDrift, findMostDrifted, hashEmbedding } from './intelligence/semantic-versioning.js';
23
+ export { predictKnowledgeGaps } from './intelligence/predictive-gaps.js';
24
+ export { generateLearningPath } from './intelligence/learning-path.js';
25
+ export { checkNotifications } from './intelligence/notifications.js';
26
+ // Multi-Vault
27
+ export { addVault, removeVault, listVaults, getVault, searchAllVaults } from './multi-vault/index.js';
28
+ // Voice Capture
29
+ export { captureVoice, transcribeAudio, isWhisperAvailable } from './capture/voice.js';
30
+ // Dashboard + PWA
31
+ export { mountDashboard } from './api/dashboard.js';
32
+ export { mountPWA } from './api/pwa.js';
33
+ // Agentic Graph
34
+ export { createAgenticGraphTools } from './mcp/tools/agentic-graph.js';
35
+ // Cloud
36
+ export { syncToCloud, restoreFromCloud, getSyncState, encrypt, decrypt, getOrCreateEncryptionKey } from './cloud/index.js';
37
+ // Team
38
+ export { inviteMember, authenticateMember, hasPermission, listMembers, removeMember, createAuthMiddleware, loadTeamConfig, generateToken } from './team/index.js';
39
+ // Pack Marketplace
40
+ export { searchMarketplace, createPackageJson, getPublishInstructions } from './pack/marketplace.js';
41
+ // Federation
42
+ export { FederationNode, FederatedSearch, getOrCreateIdentity } from './federation/index.js';
43
+ export { vouch, revoke, block, getTrustLevel, isBlocked, listTrusted, computeTrustScore } from './federation/trust.js';
44
+ export { loadSharingConfig, saveSharingConfig, isDocumentShareable, sanitizeSnippet, getSharingSummary, addBlockedTag, removeBlockedTag, addBlockedFolder, blockDocument, unblockDocument, getDocumentLevel, getAccessibleLevel, buildLeveledResult, setTagLevel, setFolderLevel, setNodeLevel, setDefaultLevel, createFullTextRequest, approveRequest, denyRequest, getPendingRequests, LEVEL_LABELS, LEVEL_ICONS, LEVEL_CREDIT_MULTIPLIER } from './federation/sharing.js';
45
+ export { computeReputation, verifyConsensus, recordInteraction, recordConsistency, recordFeedback, recordConsensus, getReputationBoard, filterByReputation } from './federation/reputation.js';
46
+ export { addDPNoise, addDPNoiseNormalized, maskSnippet } from './federation/privacy.js';
47
+ export { getBalance, getAccount, earn, spend, earnForSearchResponse, spendForSearch, getRecentTransactions } from './federation/credits.js';
48
+ // Plugin SDK
49
+ export { PluginManager } from './plugins/index.js';
50
+ export { WebhookManager } from './plugins/webhooks.js';
51
+ export { loadCustomTools } from './mcp/custom-tools.js';
52
+ // i18n
53
+ export { t, setLocale, getLocale, detectLocale } from './i18n/index.js';
54
+ // Error Recovery
55
+ export { withRetry, StellavaultError, wrapError, errors } from './utils/retry.js';
56
+ // Factory — 전체 조립
57
+ import { createSqliteVecStore as _createStore } from './store/index.js';
58
+ import { createLocalEmbedder as _createEmbedder } from './indexer/index.js';
59
+ import { createSearchEngine as _createSearch } from './search/index.js';
60
+ import { createMcpServer as _createMcp } from './mcp/index.js';
61
+ export function createKnowledgeHub(config) {
62
+ const embedder = _createEmbedder(config.embedding.localModel);
63
+ const dims = embedder.dimensions;
64
+ const store = _createStore(config.dbPath, dims);
65
+ const searchEngine = _createSearch({ store, embedder, rrfK: config.search.rrfK });
66
+ const mcpServer = _createMcp({ store, searchEngine, vaultPath: config.vaultPath });
67
+ return { store, embedder, searchEngine, mcpServer, config };
68
+ }
69
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,14 @@
1
+ import type { Chunk } from '../types/chunk.js';
2
+ export interface ChunkOptions {
3
+ maxTokens: number;
4
+ overlap: number;
5
+ minTokens: number;
6
+ }
7
+ /**
8
+ * 문서를 heading 기반으로 청킹합니다.
9
+ * Step 1: heading 분할 → Step 2: 길이 검사 → Step 3: 메타데이터 → Step 4: 짧은 청크 병합
10
+ */
11
+ export declare function chunkDocument(documentId: string, content: string, options?: Partial<ChunkOptions>): Chunk[];
12
+ /** 간단한 토큰 수 추정 (영어: ~4chars/token, 한국어: ~2chars/token) */
13
+ export declare function estimateTokens(text: string): number;
14
+ //# sourceMappingURL=chunker.d.ts.map
@@ -0,0 +1,148 @@
1
+ // Design Ref: §6.1 — Chunking Strategy (heading 기반 + 오버랩)
2
+ const DEFAULT_OPTIONS = {
3
+ maxTokens: 300,
4
+ overlap: 50,
5
+ minTokens: 50,
6
+ };
7
+ /**
8
+ * 문서를 heading 기반으로 청킹합니다.
9
+ * Step 1: heading 분할 → Step 2: 길이 검사 → Step 3: 메타데이터 → Step 4: 짧은 청크 병합
10
+ */
11
+ export function chunkDocument(documentId, content, options = {}) {
12
+ const opts = { ...DEFAULT_OPTIONS, ...options };
13
+ const lines = content.split('\n');
14
+ // Step 1: heading 기반 섹션 분할
15
+ const sections = splitByHeadings(lines);
16
+ // Step 2-3: 길이 검사 + 메타데이터
17
+ const rawChunks = [];
18
+ for (const section of sections) {
19
+ const tokenCount = estimateTokens(section.content);
20
+ if (tokenCount <= opts.maxTokens) {
21
+ rawChunks.push(makeChunk(documentId, rawChunks.length, section));
22
+ }
23
+ else {
24
+ // 긴 섹션은 문장 단위로 재분할 + 오버랩
25
+ const subChunks = splitByTokenLimit(section, opts.maxTokens, opts.overlap);
26
+ for (const sub of subChunks) {
27
+ rawChunks.push(makeChunk(documentId, rawChunks.length, sub));
28
+ }
29
+ }
30
+ }
31
+ // Step 4: 짧은 청크 병합
32
+ return mergeShortChunks(rawChunks, opts.minTokens);
33
+ }
34
+ function splitByHeadings(lines) {
35
+ const sections = [];
36
+ let currentHeading = '';
37
+ let currentLines = [];
38
+ let startLine = 0;
39
+ for (let i = 0; i < lines.length; i++) {
40
+ const line = lines[i];
41
+ if (/^#{1,6}\s/.test(line)) {
42
+ if (currentLines.length > 0) {
43
+ sections.push({
44
+ heading: currentHeading,
45
+ content: currentLines.join('\n').trim(),
46
+ startLine,
47
+ endLine: i - 1,
48
+ });
49
+ }
50
+ currentHeading = line.replace(/^#{1,6}\s+/, '').trim();
51
+ currentLines = [line];
52
+ startLine = i;
53
+ }
54
+ else {
55
+ currentLines.push(line);
56
+ }
57
+ }
58
+ if (currentLines.length > 0) {
59
+ sections.push({
60
+ heading: currentHeading,
61
+ content: currentLines.join('\n').trim(),
62
+ startLine,
63
+ endLine: lines.length - 1,
64
+ });
65
+ }
66
+ return sections.filter(s => s.content.length > 0);
67
+ }
68
+ function splitByTokenLimit(section, maxTokens, overlap) {
69
+ const sentences = section.content.split(/(?<=[.!?。]\s)/);
70
+ const results = [];
71
+ let current = [];
72
+ let currentTokens = 0;
73
+ for (const sentence of sentences) {
74
+ const sentenceTokens = estimateTokens(sentence);
75
+ if (currentTokens + sentenceTokens > maxTokens && current.length > 0) {
76
+ results.push({
77
+ heading: section.heading,
78
+ content: current.join('').trim(),
79
+ startLine: section.startLine,
80
+ endLine: section.endLine,
81
+ });
82
+ // 오버랩: 마지막 문장들을 다음 청크에 포함
83
+ const overlapText = getOverlapText(current, overlap);
84
+ current = overlapText ? [overlapText, sentence] : [sentence];
85
+ currentTokens = estimateTokens(current.join(''));
86
+ }
87
+ else {
88
+ current.push(sentence);
89
+ currentTokens += sentenceTokens;
90
+ }
91
+ }
92
+ if (current.length > 0) {
93
+ results.push({
94
+ heading: section.heading,
95
+ content: current.join('').trim(),
96
+ startLine: section.startLine,
97
+ endLine: section.endLine,
98
+ });
99
+ }
100
+ return results;
101
+ }
102
+ function getOverlapText(sentences, overlapTokens) {
103
+ let tokens = 0;
104
+ const overlap = [];
105
+ for (let i = sentences.length - 1; i >= 0; i--) {
106
+ const t = estimateTokens(sentences[i]);
107
+ if (tokens + t > overlapTokens)
108
+ break;
109
+ overlap.unshift(sentences[i]);
110
+ tokens += t;
111
+ }
112
+ return overlap.join('');
113
+ }
114
+ function mergeShortChunks(chunks, minTokens) {
115
+ if (chunks.length <= 1)
116
+ return chunks;
117
+ const result = [];
118
+ for (const chunk of chunks) {
119
+ if (result.length > 0 && chunk.tokenCount < minTokens) {
120
+ const prev = result[result.length - 1];
121
+ prev.content += '\n\n' + chunk.content;
122
+ prev.endLine = chunk.endLine;
123
+ prev.tokenCount += chunk.tokenCount;
124
+ }
125
+ else {
126
+ result.push({ ...chunk });
127
+ }
128
+ }
129
+ return result;
130
+ }
131
+ function makeChunk(documentId, index, section) {
132
+ return {
133
+ id: `${documentId}#${index}`,
134
+ documentId,
135
+ content: section.content,
136
+ heading: section.heading,
137
+ startLine: section.startLine,
138
+ endLine: section.endLine,
139
+ tokenCount: estimateTokens(section.content),
140
+ };
141
+ }
142
+ /** 간단한 토큰 수 추정 (영어: ~4chars/token, 한국어: ~2chars/token) */
143
+ export function estimateTokens(text) {
144
+ const koreanChars = (text.match(/[가-힣]/g) || []).length;
145
+ const otherChars = text.length - koreanChars;
146
+ return Math.ceil(koreanChars / 2 + otherChars / 4);
147
+ }
148
+ //# sourceMappingURL=chunker.js.map
@@ -0,0 +1,8 @@
1
+ export interface Embedder {
2
+ initialize(): Promise<void>;
3
+ embed(text: string): Promise<number[]>;
4
+ embedBatch(texts: string[]): Promise<number[][]>;
5
+ readonly dimensions: number;
6
+ readonly modelName: string;
7
+ }
8
+ //# sourceMappingURL=embedder.d.ts.map
@@ -0,0 +1,3 @@
1
+ // Design Ref: §3.2 — 교체 가능 설계 (Embedder 인터페이스)
2
+ export {};
3
+ //# sourceMappingURL=embedder.js.map
@@ -0,0 +1,28 @@
1
+ import type { Embedder } from './embedder.js';
2
+ import type { VectorStore } from '../store/types.js';
3
+ import type { Document } from '../types/document.js';
4
+ import { type ChunkOptions } from './chunker.js';
5
+ export { type Embedder } from './embedder.js';
6
+ export { createLocalEmbedder } from './local-embedder.js';
7
+ export { scanVault } from './scanner.js';
8
+ export { chunkDocument, estimateTokens } from './chunker.js';
9
+ export { createWatcher } from './watcher.js';
10
+ export interface IndexerOptions {
11
+ store: VectorStore;
12
+ embedder: Embedder;
13
+ chunkOptions?: Partial<ChunkOptions>;
14
+ onProgress?: (current: number, total: number, doc: Document) => void;
15
+ }
16
+ export interface IndexResult {
17
+ indexed: number;
18
+ skipped: number;
19
+ deleted: number;
20
+ failed: number;
21
+ totalChunks: number;
22
+ elapsedMs: number;
23
+ }
24
+ /**
25
+ * vault를 스캔하여 변경된 문서만 벡터화하는 증분 인덱서
26
+ */
27
+ export declare function indexVault(vaultPath: string, options: IndexerOptions): Promise<IndexResult>;
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,74 @@
1
+ // Design Ref: §6.3 — Incremental Indexing + Pipeline
2
+ import { scanVault } from './scanner.js';
3
+ import { chunkDocument } from './chunker.js';
4
+ import { withRetry, errors } from '../utils/retry.js';
5
+ export { createLocalEmbedder } from './local-embedder.js';
6
+ export { scanVault } from './scanner.js';
7
+ export { chunkDocument, estimateTokens } from './chunker.js';
8
+ export { createWatcher } from './watcher.js';
9
+ /**
10
+ * vault를 스캔하여 변경된 문서만 벡터화하는 증분 인덱서
11
+ */
12
+ export async function indexVault(vaultPath, options) {
13
+ const start = Date.now();
14
+ const { store, embedder, chunkOptions, onProgress } = options;
15
+ // 1. 스캔
16
+ const { documents } = scanVault(vaultPath);
17
+ // 2. 기존 인덱스 상태 조회
18
+ const existingDocs = await store.getAllDocuments();
19
+ const existingMap = new Map(existingDocs.map(d => [d.id, d.contentHash]));
20
+ let indexed = 0;
21
+ let skipped = 0;
22
+ let failed = 0;
23
+ let totalChunks = 0;
24
+ // 3. 증분 처리 (에러 복구 포함)
25
+ const scannedIds = new Set();
26
+ for (let i = 0; i < documents.length; i++) {
27
+ const doc = documents[i];
28
+ scannedIds.add(doc.id);
29
+ onProgress?.(i + 1, documents.length, doc);
30
+ // content_hash 비교 → 변경 없으면 SKIP
31
+ if (existingMap.get(doc.id) === doc.contentHash) {
32
+ skipped++;
33
+ continue;
34
+ }
35
+ try {
36
+ // 청킹
37
+ const chunks = chunkDocument(doc.id, doc.content, chunkOptions);
38
+ // 임베딩 (retry with backoff)
39
+ const texts = chunks.map(c => c.content);
40
+ const embeddings = await withRetry(() => embedder.embedBatch(texts), { maxRetries: 2, baseDelayMs: 1000 });
41
+ const chunksWithEmbeddings = chunks.map((c, j) => ({
42
+ ...c,
43
+ embedding: embeddings[j],
44
+ }));
45
+ // 저장 (document → chunks)
46
+ await store.upsertDocument(doc);
47
+ await store.upsertChunks(chunksWithEmbeddings);
48
+ indexed++;
49
+ totalChunks += chunks.length;
50
+ }
51
+ catch (err) {
52
+ // Graceful degradation: skip failed file, continue with rest
53
+ failed++;
54
+ console.error(errors.indexingFailed(doc.filePath, err).format());
55
+ }
56
+ }
57
+ // 4. 삭제된 파일 처리
58
+ let deleted = 0;
59
+ for (const [existingId] of existingMap) {
60
+ if (!scannedIds.has(existingId)) {
61
+ await store.deleteByDocumentId(existingId);
62
+ deleted++;
63
+ }
64
+ }
65
+ return {
66
+ indexed,
67
+ skipped,
68
+ deleted,
69
+ failed,
70
+ totalChunks,
71
+ elapsedMs: Date.now() - start,
72
+ };
73
+ }
74
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,3 @@
1
+ import type { Embedder } from './embedder.js';
2
+ export declare function createLocalEmbedder(modelName?: string): Embedder;
3
+ //# sourceMappingURL=local-embedder.d.ts.map
@@ -0,0 +1,29 @@
1
+ // Design Ref: §3.2 — Embedder 로컬 구현 (nomic-embed-text via @xenova/transformers)
2
+ export function createLocalEmbedder(modelName = 'nomic-embed-text-v1.5') {
3
+ let pipeline;
4
+ // all-MiniLM-L6-v2: 384, nomic-embed-text: 768
5
+ let dims = modelName.includes('MiniLM') ? 384 : 768;
6
+ return {
7
+ async initialize() {
8
+ const { pipeline: createPipeline } = await import('@xenova/transformers');
9
+ pipeline = await createPipeline('feature-extraction', `Xenova/${modelName}`, {
10
+ quantized: true,
11
+ });
12
+ },
13
+ async embed(text) {
14
+ const output = await pipeline(text, { pooling: 'mean', normalize: true });
15
+ return Array.from(output.data).slice(0, dims);
16
+ },
17
+ async embedBatch(texts) {
18
+ const results = [];
19
+ // 순차 처리 (메모리 절약)
20
+ for (const text of texts) {
21
+ results.push(await this.embed(text));
22
+ }
23
+ return results;
24
+ },
25
+ get dimensions() { return dims; },
26
+ get modelName() { return modelName; },
27
+ };
28
+ }
29
+ //# sourceMappingURL=local-embedder.js.map
@@ -0,0 +1,11 @@
1
+ import type { Document } from '../types/document.js';
2
+ export interface ScanResult {
3
+ documents: Document[];
4
+ scannedFiles: number;
5
+ skippedFiles: number;
6
+ }
7
+ /**
8
+ * vault 디렉토리에서 모든 .md 파일을 스캔하여 Document 목록 반환
9
+ */
10
+ export declare function scanVault(vaultPath: string): ScanResult;
11
+ //# sourceMappingURL=scanner.d.ts.map
@@ -0,0 +1,137 @@
1
+ // Design Ref: §6 — Indexer (scanner: glob + frontmatter 파싱)
2
+ import { readdirSync, readFileSync, statSync } from 'node:fs';
3
+ import { join, relative, extname } from 'node:path';
4
+ import { createHash } from 'node:crypto';
5
+ import matter from 'gray-matter';
6
+ /**
7
+ * vault 디렉토리에서 모든 .md 파일을 스캔하여 Document 목록 반환
8
+ */
9
+ export function scanVault(vaultPath) {
10
+ const documents = [];
11
+ let skippedFiles = 0;
12
+ const mdFiles = findMdFiles(vaultPath);
13
+ for (const filePath of mdFiles) {
14
+ try {
15
+ const doc = parseDocument(vaultPath, filePath);
16
+ documents.push(doc);
17
+ }
18
+ catch {
19
+ skippedFiles++;
20
+ }
21
+ }
22
+ return { documents, scannedFiles: mdFiles.length, skippedFiles };
23
+ }
24
+ function findMdFiles(dir, files = []) {
25
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
26
+ const fullPath = join(dir, entry.name);
27
+ if (entry.isDirectory()) {
28
+ if (entry.name.startsWith('.') || entry.name === 'node_modules' || entry.name === 'zh-CN')
29
+ continue;
30
+ findMdFiles(fullPath, files);
31
+ }
32
+ else if (extname(entry.name) === '.md') {
33
+ files.push(fullPath);
34
+ }
35
+ }
36
+ return files;
37
+ }
38
+ function parseDocument(vaultPath, filePath) {
39
+ const raw = readFileSync(filePath, 'utf-8');
40
+ const stat = statSync(filePath);
41
+ const { data: frontmatter, content } = matter(raw);
42
+ const relativePath = relative(vaultPath, filePath).replace(/\\/g, '/');
43
+ const id = createHash('sha256').update(relativePath).digest('hex').slice(0, 16);
44
+ const contentHash = createHash('sha256').update(raw).digest('hex').slice(0, 16);
45
+ const title = frontmatter.title
46
+ ?? extractFirstHeading(content)
47
+ ?? relativePath.replace(/\.md$/, '');
48
+ const tags = extractTags(frontmatter, content);
49
+ // source/type 자동 추출 (원본 파일 수정 없이 DB에만 저장)
50
+ const source = inferSource(frontmatter, relativePath);
51
+ const type = inferType(frontmatter, relativePath);
52
+ return {
53
+ id,
54
+ filePath: relativePath,
55
+ title,
56
+ content,
57
+ frontmatter,
58
+ tags,
59
+ lastModified: stat.mtime.toISOString(),
60
+ contentHash,
61
+ source,
62
+ type,
63
+ };
64
+ }
65
+ function inferSource(frontmatter, filePath) {
66
+ // frontmatter에 명시된 경우
67
+ if (frontmatter.source && typeof frontmatter.source === 'string') {
68
+ if (frontmatter.source.startsWith('http'))
69
+ return 'clip';
70
+ return frontmatter.source;
71
+ }
72
+ // 경로 기반 추론
73
+ if (filePath.includes('clips/') || filePath.includes('clip/'))
74
+ return 'clip';
75
+ if (filePath.includes('PDCA') || filePath.includes('pdca'))
76
+ return 'local';
77
+ if (frontmatter['x-i18n'])
78
+ return 'notion'; // Notion 번역 문서
79
+ if (frontmatter.clipped)
80
+ return 'clip';
81
+ return 'local';
82
+ }
83
+ function inferType(frontmatter, filePath) {
84
+ // frontmatter에 명시된 경우
85
+ if (frontmatter.type && typeof frontmatter.type === 'string')
86
+ return frontmatter.type;
87
+ // tags 기반
88
+ const tags = Array.isArray(frontmatter.tags) ? frontmatter.tags : [];
89
+ if (tags.includes('bridge') || tags.includes('auto-generated'))
90
+ return 'bridge';
91
+ if (tags.includes('clip') || tags.includes('youtube'))
92
+ return 'clip';
93
+ if (tags.includes('decision'))
94
+ return 'decision';
95
+ // 경로 기반
96
+ if (filePath.includes('clips/'))
97
+ return 'clip';
98
+ if (filePath.includes('Decisions/') || filePath.includes('decisions/'))
99
+ return 'decision';
100
+ if (filePath.includes('Sessions/') || filePath.includes('sessions/'))
101
+ return 'session';
102
+ if (filePath.includes('Research/'))
103
+ return 'research';
104
+ if (filePath.includes('Lessons/'))
105
+ return 'lesson';
106
+ if (filePath.includes('Templates/'))
107
+ return 'template';
108
+ return 'note';
109
+ }
110
+ function extractFirstHeading(content) {
111
+ const match = content.match(/^#\s+(.+)$/m);
112
+ return match ? match[1].trim() : null;
113
+ }
114
+ function extractTags(frontmatter, content) {
115
+ const tags = new Set();
116
+ // frontmatter tags
117
+ const fmTags = frontmatter.tags;
118
+ if (Array.isArray(fmTags)) {
119
+ fmTags.forEach(t => tags.add(String(t)));
120
+ }
121
+ else if (typeof fmTags === 'string') {
122
+ fmTags.split(',').map(t => t.trim()).filter(Boolean).forEach(t => tags.add(t));
123
+ }
124
+ // inline #tags (CSS 컬러코드, 순수 숫자, heading # 제외)
125
+ const inlineTags = content.match(/(?:^|\s)#([a-zA-Z가-힣][a-zA-Z가-힣\w-]*)/g);
126
+ if (inlineTags) {
127
+ for (const raw of inlineTags) {
128
+ const tag = raw.trim().slice(1);
129
+ // CSS hex 컬러 (#fff, #6c5ce7 등) 제외
130
+ if (/^[0-9a-fA-F]{3,8}$/.test(tag))
131
+ continue;
132
+ tags.add(tag);
133
+ }
134
+ }
135
+ return [...tags];
136
+ }
137
+ //# sourceMappingURL=scanner.js.map
@@ -0,0 +1,19 @@
1
+ import type { Embedder } from './embedder.js';
2
+ import type { VectorStore } from '../store/types.js';
3
+ import type { ChunkOptions } from './chunker.js';
4
+ export interface WatcherOptions {
5
+ vaultPath: string;
6
+ store: VectorStore;
7
+ embedder: Embedder;
8
+ chunkOptions?: Partial<ChunkOptions>;
9
+ debounceMs?: number;
10
+ onReindex?: (result: {
11
+ indexed: number;
12
+ skipped: number;
13
+ }) => void;
14
+ }
15
+ export declare function createWatcher(options: WatcherOptions): {
16
+ start(): void;
17
+ stop(): void;
18
+ };
19
+ //# sourceMappingURL=watcher.d.ts.map
@@ -0,0 +1,49 @@
1
+ // Design Ref: §6.3 — 파일 감시 + 증분 인덱싱 (debounce 5s)
2
+ import { watch } from 'chokidar';
3
+ import { extname } from 'node:path';
4
+ import { indexVault } from './index.js';
5
+ export function createWatcher(options) {
6
+ const { vaultPath, store, embedder, chunkOptions, debounceMs = 5000, onReindex } = options;
7
+ let watcher = null;
8
+ let debounceTimer = null;
9
+ let reindexing = false;
10
+ async function triggerReindex() {
11
+ if (reindexing)
12
+ return;
13
+ reindexing = true;
14
+ try {
15
+ const result = await indexVault(vaultPath, { store, embedder, chunkOptions });
16
+ onReindex?.({ indexed: result.indexed, skipped: result.skipped });
17
+ }
18
+ finally {
19
+ reindexing = false;
20
+ }
21
+ }
22
+ function scheduleReindex() {
23
+ if (debounceTimer)
24
+ clearTimeout(debounceTimer);
25
+ debounceTimer = setTimeout(() => triggerReindex(), debounceMs);
26
+ }
27
+ return {
28
+ start() {
29
+ watcher = watch(vaultPath, {
30
+ ignored: /(^|[\/\\])\.|node_modules/,
31
+ persistent: true,
32
+ ignoreInitial: true,
33
+ });
34
+ watcher.on('all', (event, path) => {
35
+ if (extname(path) !== '.md')
36
+ return;
37
+ if (['add', 'change', 'unlink'].includes(event)) {
38
+ scheduleReindex();
39
+ }
40
+ });
41
+ },
42
+ stop() {
43
+ if (debounceTimer)
44
+ clearTimeout(debounceTimer);
45
+ watcher?.close();
46
+ },
47
+ };
48
+ }
49
+ //# sourceMappingURL=watcher.js.map
@@ -0,0 +1,20 @@
1
+ import type { VectorStore } from '../store/types.js';
2
+ export interface ContradictionPair {
3
+ docA: {
4
+ id: string;
5
+ title: string;
6
+ filePath: string;
7
+ statement: string;
8
+ };
9
+ docB: {
10
+ id: string;
11
+ title: string;
12
+ filePath: string;
13
+ statement: string;
14
+ };
15
+ similarity: number;
16
+ confidence: number;
17
+ type: 'negation' | 'value_conflict' | 'temporal' | 'semantic';
18
+ }
19
+ export declare function detectContradictions(store: VectorStore, limit?: number): Promise<ContradictionPair[]>;
20
+ //# sourceMappingURL=contradiction-detector.d.ts.map