stellavault 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (400) hide show
  1. package/package.json +1 -1
  2. package/packages/core/dist/api/dashboard.d.ts +3 -0
  3. package/packages/core/{src/api/dashboard.ts → dist/api/dashboard.js} +8 -11
  4. package/packages/core/dist/api/graph-data.d.ts +11 -0
  5. package/packages/core/dist/api/graph-data.js +255 -0
  6. package/packages/core/dist/api/pwa.d.ts +3 -0
  7. package/packages/core/{src/api/pwa.ts → dist/api/pwa.js} +27 -32
  8. package/packages/core/dist/api/server.d.ts +16 -0
  9. package/packages/core/dist/api/server.js +718 -0
  10. package/packages/core/dist/capture/voice.d.ts +24 -0
  11. package/packages/core/dist/capture/voice.js +135 -0
  12. package/packages/core/{src/cloud/index.ts → dist/cloud/index.d.ts} +1 -0
  13. package/packages/core/dist/cloud/index.js +2 -0
  14. package/packages/core/dist/cloud/sync.d.ts +29 -0
  15. package/packages/core/dist/cloud/sync.js +137 -0
  16. package/packages/core/dist/config.d.ts +27 -0
  17. package/packages/core/dist/config.js +55 -0
  18. package/packages/core/dist/federation/credits.d.ts +26 -0
  19. package/packages/core/dist/federation/credits.js +56 -0
  20. package/packages/core/dist/federation/identity.d.ts +14 -0
  21. package/packages/core/dist/federation/identity.js +74 -0
  22. package/packages/core/{src/federation/index.ts → dist/federation/index.d.ts} +1 -2
  23. package/packages/core/dist/federation/index.js +5 -0
  24. package/packages/core/dist/federation/node.d.ts +31 -0
  25. package/packages/core/dist/federation/node.js +216 -0
  26. package/packages/core/dist/federation/privacy.d.ts +8 -0
  27. package/packages/core/dist/federation/privacy.js +40 -0
  28. package/packages/core/dist/federation/reputation.d.ts +37 -0
  29. package/packages/core/dist/federation/reputation.js +139 -0
  30. package/packages/core/dist/federation/search.d.ts +19 -0
  31. package/packages/core/dist/federation/search.js +101 -0
  32. package/packages/core/dist/federation/sharing.d.ts +72 -0
  33. package/packages/core/dist/federation/sharing.js +246 -0
  34. package/packages/core/dist/federation/trust.d.ts +15 -0
  35. package/packages/core/dist/federation/trust.js +60 -0
  36. package/packages/core/dist/federation/types.d.ts +40 -0
  37. package/packages/core/dist/federation/types.js +3 -0
  38. package/packages/core/dist/i18n/index.d.ts +6 -0
  39. package/packages/core/dist/i18n/index.js +81 -0
  40. package/packages/core/{src/index.ts → dist/index.d.ts} +46 -65
  41. package/packages/core/dist/index.js +69 -0
  42. package/packages/core/dist/indexer/chunker.d.ts +14 -0
  43. package/packages/core/dist/indexer/chunker.js +148 -0
  44. package/packages/core/dist/indexer/embedder.d.ts +8 -0
  45. package/packages/core/dist/indexer/embedder.js +3 -0
  46. package/packages/core/dist/indexer/index.d.ts +28 -0
  47. package/packages/core/dist/indexer/index.js +74 -0
  48. package/packages/core/dist/indexer/local-embedder.d.ts +3 -0
  49. package/packages/core/dist/indexer/local-embedder.js +29 -0
  50. package/packages/core/dist/indexer/scanner.d.ts +11 -0
  51. package/packages/core/dist/indexer/scanner.js +137 -0
  52. package/packages/core/dist/indexer/watcher.d.ts +19 -0
  53. package/packages/core/dist/indexer/watcher.js +49 -0
  54. package/packages/core/dist/intelligence/code-linker.d.ts +20 -0
  55. package/packages/core/dist/intelligence/code-linker.js +88 -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 +151 -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/detect-gaps.d.ts +24 -0
  91. package/packages/core/dist/mcp/tools/detect-gaps.js +47 -0
  92. package/packages/core/dist/mcp/tools/export.d.ts +29 -0
  93. package/packages/core/dist/mcp/tools/export.js +60 -0
  94. package/packages/core/dist/mcp/tools/federated-search.d.ts +29 -0
  95. package/packages/core/dist/mcp/tools/federated-search.js +36 -0
  96. package/packages/core/dist/mcp/tools/generate-claude-md.d.ts +35 -0
  97. package/packages/core/dist/mcp/tools/generate-claude-md.js +107 -0
  98. package/packages/core/dist/mcp/tools/get-document.d.ts +35 -0
  99. package/packages/core/dist/mcp/tools/get-document.js +25 -0
  100. package/packages/core/dist/mcp/tools/get-evolution.d.ts +28 -0
  101. package/packages/core/dist/mcp/tools/get-evolution.js +70 -0
  102. package/packages/core/dist/mcp/tools/get-related.d.ts +32 -0
  103. package/packages/core/dist/mcp/tools/get-related.js +33 -0
  104. package/packages/core/dist/mcp/tools/learning-path.d.ts +23 -0
  105. package/packages/core/dist/mcp/tools/learning-path.js +45 -0
  106. package/packages/core/dist/mcp/tools/link-code.d.ts +34 -0
  107. package/packages/core/dist/mcp/tools/link-code.js +44 -0
  108. package/packages/core/dist/mcp/tools/list-topics.d.ts +15 -0
  109. package/packages/core/dist/mcp/tools/list-topics.js +18 -0
  110. package/packages/core/dist/mcp/tools/search.d.ts +39 -0
  111. package/packages/core/dist/mcp/tools/search.js +29 -0
  112. package/packages/core/dist/mcp/tools/snapshot.d.ts +47 -0
  113. package/packages/core/dist/mcp/tools/snapshot.js +84 -0
  114. package/packages/core/dist/multi-vault/index.d.ts +26 -0
  115. package/packages/core/dist/multi-vault/index.js +80 -0
  116. package/packages/core/dist/pack/creator.d.ts +21 -0
  117. package/packages/core/dist/pack/creator.js +105 -0
  118. package/packages/core/dist/pack/exporter.d.ts +4 -0
  119. package/packages/core/dist/pack/exporter.js +18 -0
  120. package/packages/core/dist/pack/importer.d.ts +10 -0
  121. package/packages/core/dist/pack/importer.js +55 -0
  122. package/packages/core/{src/pack/index.ts → dist/pack/index.d.ts} +1 -0
  123. package/packages/core/dist/pack/index.js +5 -0
  124. package/packages/core/dist/pack/marketplace.d.ts +14 -0
  125. package/packages/core/dist/pack/marketplace.js +90 -0
  126. package/packages/core/dist/pack/pii-masker.d.ts +7 -0
  127. package/packages/core/dist/pack/pii-masker.js +29 -0
  128. package/packages/core/dist/pack/types.d.ts +36 -0
  129. package/packages/core/dist/pack/types.js +3 -0
  130. package/packages/core/dist/plugins/index.d.ts +35 -0
  131. package/packages/core/dist/plugins/index.js +57 -0
  132. package/packages/core/dist/plugins/webhooks.d.ts +30 -0
  133. package/packages/core/dist/plugins/webhooks.js +79 -0
  134. package/packages/core/dist/search/adaptive.d.ts +16 -0
  135. package/packages/core/dist/search/adaptive.js +67 -0
  136. package/packages/core/dist/search/bm25.d.ts +4 -0
  137. package/packages/core/dist/search/bm25.js +10 -0
  138. package/packages/core/dist/search/index.d.ts +15 -0
  139. package/packages/core/dist/search/index.js +64 -0
  140. package/packages/core/dist/search/rrf.d.ts +7 -0
  141. package/packages/core/dist/search/rrf.js +21 -0
  142. package/packages/core/dist/search/semantic.d.ts +5 -0
  143. package/packages/core/dist/search/semantic.js +6 -0
  144. package/packages/core/{src/store/index.ts → dist/store/index.d.ts} +1 -0
  145. package/packages/core/dist/store/index.js +2 -0
  146. package/packages/core/dist/store/sqlite-vec.d.ts +6 -0
  147. package/packages/core/dist/store/sqlite-vec.js +251 -0
  148. package/packages/core/dist/store/types.d.ts +20 -0
  149. package/packages/core/dist/store/types.js +3 -0
  150. package/packages/core/dist/team/index.d.ts +25 -0
  151. package/packages/core/dist/team/index.js +97 -0
  152. package/packages/core/dist/types/chunk.d.ts +23 -0
  153. package/packages/core/dist/types/chunk.js +3 -0
  154. package/packages/core/dist/types/document.d.ts +23 -0
  155. package/packages/core/dist/types/document.js +3 -0
  156. package/packages/core/dist/types/graph.d.ts +39 -0
  157. package/packages/core/dist/types/graph.js +3 -0
  158. package/packages/core/dist/types/index.d.ts +5 -0
  159. package/packages/core/dist/types/index.js +2 -0
  160. package/packages/core/dist/types/search.d.ts +39 -0
  161. package/packages/core/dist/types/search.js +3 -0
  162. package/packages/core/dist/utils/retry.d.ts +25 -0
  163. package/packages/core/dist/utils/retry.js +59 -0
  164. package/.github/workflows/pages.yml +0 -37
  165. package/memory/MEMORY.md +0 -25
  166. package/packages/cli/dist/commands/brief-cmd.d.ts.map +0 -1
  167. package/packages/cli/dist/commands/brief-cmd.js.map +0 -1
  168. package/packages/cli/dist/commands/capture-cmd.d.ts.map +0 -1
  169. package/packages/cli/dist/commands/capture-cmd.js.map +0 -1
  170. package/packages/cli/dist/commands/card-cmd.d.ts.map +0 -1
  171. package/packages/cli/dist/commands/card-cmd.js.map +0 -1
  172. package/packages/cli/dist/commands/clip-cmd.d.ts.map +0 -1
  173. package/packages/cli/dist/commands/clip-cmd.js.map +0 -1
  174. package/packages/cli/dist/commands/cloud-cmd.d.ts.map +0 -1
  175. package/packages/cli/dist/commands/cloud-cmd.js.map +0 -1
  176. package/packages/cli/dist/commands/contradictions-cmd.d.ts.map +0 -1
  177. package/packages/cli/dist/commands/contradictions-cmd.js.map +0 -1
  178. package/packages/cli/dist/commands/decay-cmd.d.ts.map +0 -1
  179. package/packages/cli/dist/commands/decay-cmd.js.map +0 -1
  180. package/packages/cli/dist/commands/digest-cmd.d.ts.map +0 -1
  181. package/packages/cli/dist/commands/digest-cmd.js.map +0 -1
  182. package/packages/cli/dist/commands/duplicates-cmd.d.ts.map +0 -1
  183. package/packages/cli/dist/commands/duplicates-cmd.js.map +0 -1
  184. package/packages/cli/dist/commands/federate-cmd.d.ts.map +0 -1
  185. package/packages/cli/dist/commands/federate-cmd.js.map +0 -1
  186. package/packages/cli/dist/commands/gaps-cmd.d.ts.map +0 -1
  187. package/packages/cli/dist/commands/gaps-cmd.js.map +0 -1
  188. package/packages/cli/dist/commands/graph-cmd.d.ts.map +0 -1
  189. package/packages/cli/dist/commands/graph-cmd.js.map +0 -1
  190. package/packages/cli/dist/commands/index-cmd.d.ts.map +0 -1
  191. package/packages/cli/dist/commands/index-cmd.js.map +0 -1
  192. package/packages/cli/dist/commands/init-cmd.d.ts.map +0 -1
  193. package/packages/cli/dist/commands/init-cmd.js.map +0 -1
  194. package/packages/cli/dist/commands/learn-cmd.d.ts.map +0 -1
  195. package/packages/cli/dist/commands/learn-cmd.js.map +0 -1
  196. package/packages/cli/dist/commands/pack-cmd.d.ts.map +0 -1
  197. package/packages/cli/dist/commands/pack-cmd.js.map +0 -1
  198. package/packages/cli/dist/commands/review-cmd.d.ts.map +0 -1
  199. package/packages/cli/dist/commands/review-cmd.js.map +0 -1
  200. package/packages/cli/dist/commands/search-cmd.d.ts.map +0 -1
  201. package/packages/cli/dist/commands/search-cmd.js.map +0 -1
  202. package/packages/cli/dist/commands/serve-cmd.d.ts.map +0 -1
  203. package/packages/cli/dist/commands/serve-cmd.js.map +0 -1
  204. package/packages/cli/dist/commands/status-cmd.d.ts.map +0 -1
  205. package/packages/cli/dist/commands/status-cmd.js.map +0 -1
  206. package/packages/cli/dist/commands/sync-cmd.d.ts.map +0 -1
  207. package/packages/cli/dist/commands/sync-cmd.js.map +0 -1
  208. package/packages/cli/dist/commands/vault-cmd.d.ts.map +0 -1
  209. package/packages/cli/dist/commands/vault-cmd.js.map +0 -1
  210. package/packages/cli/dist/index.d.ts.map +0 -1
  211. package/packages/cli/dist/index.js.map +0 -1
  212. package/packages/cli/src/commands/brief-cmd.ts +0 -87
  213. package/packages/cli/src/commands/capture-cmd.ts +0 -34
  214. package/packages/cli/src/commands/card-cmd.ts +0 -29
  215. package/packages/cli/src/commands/clip-cmd.ts +0 -172
  216. package/packages/cli/src/commands/cloud-cmd.ts +0 -75
  217. package/packages/cli/src/commands/contradictions-cmd.ts +0 -41
  218. package/packages/cli/src/commands/decay-cmd.ts +0 -57
  219. package/packages/cli/src/commands/digest-cmd.ts +0 -89
  220. package/packages/cli/src/commands/duplicates-cmd.ts +0 -38
  221. package/packages/cli/src/commands/federate-cmd.ts +0 -256
  222. package/packages/cli/src/commands/gaps-cmd.ts +0 -40
  223. package/packages/cli/src/commands/graph-cmd.ts +0 -88
  224. package/packages/cli/src/commands/index-cmd.ts +0 -65
  225. package/packages/cli/src/commands/init-cmd.ts +0 -145
  226. package/packages/cli/src/commands/learn-cmd.ts +0 -56
  227. package/packages/cli/src/commands/pack-cmd.ts +0 -121
  228. package/packages/cli/src/commands/review-cmd.ts +0 -125
  229. package/packages/cli/src/commands/search-cmd.ts +0 -45
  230. package/packages/cli/src/commands/serve-cmd.ts +0 -17
  231. package/packages/cli/src/commands/status-cmd.ts +0 -37
  232. package/packages/cli/src/commands/sync-cmd.ts +0 -68
  233. package/packages/cli/src/commands/vault-cmd.ts +0 -64
  234. package/packages/cli/src/index.ts +0 -187
  235. package/packages/core/src/api/graph-data.ts +0 -286
  236. package/packages/core/src/api/server.ts +0 -660
  237. package/packages/core/src/capture/voice.ts +0 -168
  238. package/packages/core/src/cloud/sync.ts +0 -167
  239. package/packages/core/src/config.ts +0 -82
  240. package/packages/core/src/federation/credits.ts +0 -80
  241. package/packages/core/src/federation/hyperswarm.d.ts +0 -19
  242. package/packages/core/src/federation/identity.ts +0 -90
  243. package/packages/core/src/federation/node.ts +0 -235
  244. package/packages/core/src/federation/privacy.ts +0 -52
  245. package/packages/core/src/federation/reputation.ts +0 -202
  246. package/packages/core/src/federation/search.ts +0 -129
  247. package/packages/core/src/federation/sharing.ts +0 -315
  248. package/packages/core/src/federation/trust.ts +0 -76
  249. package/packages/core/src/federation/types.ts +0 -25
  250. package/packages/core/src/i18n/index.ts +0 -85
  251. package/packages/core/src/indexer/chunker.ts +0 -180
  252. package/packages/core/src/indexer/embedder.ts +0 -9
  253. package/packages/core/src/indexer/index.ts +0 -113
  254. package/packages/core/src/indexer/local-embedder.ts +0 -35
  255. package/packages/core/src/indexer/scanner.ts +0 -142
  256. package/packages/core/src/indexer/watcher.ts +0 -62
  257. package/packages/core/src/intelligence/contradiction-detector.ts +0 -134
  258. package/packages/core/src/intelligence/decay-engine.ts +0 -229
  259. package/packages/core/src/intelligence/duplicate-detector.ts +0 -71
  260. package/packages/core/src/intelligence/fsrs.ts +0 -79
  261. package/packages/core/src/intelligence/gap-detector.ts +0 -109
  262. package/packages/core/src/intelligence/learning-path.ts +0 -86
  263. package/packages/core/src/intelligence/notifications.ts +0 -106
  264. package/packages/core/src/intelligence/predictive-gaps.ts +0 -94
  265. package/packages/core/src/intelligence/semantic-versioning.ts +0 -97
  266. package/packages/core/src/intelligence/types.ts +0 -28
  267. package/packages/core/src/mcp/custom-tools.ts +0 -97
  268. package/packages/core/src/mcp/server.ts +0 -142
  269. package/packages/core/src/mcp/tools/agentic-graph.ts +0 -96
  270. package/packages/core/src/mcp/tools/brief.ts +0 -49
  271. package/packages/core/src/mcp/tools/decay.ts +0 -40
  272. package/packages/core/src/mcp/tools/decision-journal.ts +0 -95
  273. package/packages/core/src/mcp/tools/export.ts +0 -72
  274. package/packages/core/src/mcp/tools/federated-search.ts +0 -43
  275. package/packages/core/src/mcp/tools/generate-claude-md.ts +0 -130
  276. package/packages/core/src/mcp/tools/get-document.ts +0 -26
  277. package/packages/core/src/mcp/tools/get-related.ts +0 -41
  278. package/packages/core/src/mcp/tools/learning-path.ts +0 -52
  279. package/packages/core/src/mcp/tools/list-topics.ts +0 -20
  280. package/packages/core/src/mcp/tools/search.ts +0 -35
  281. package/packages/core/src/mcp/tools/snapshot.ts +0 -98
  282. package/packages/core/src/multi-vault/index.ts +0 -118
  283. package/packages/core/src/pack/creator.ts +0 -127
  284. package/packages/core/src/pack/exporter.ts +0 -21
  285. package/packages/core/src/pack/importer.ts +0 -82
  286. package/packages/core/src/pack/marketplace.ts +0 -103
  287. package/packages/core/src/pack/pii-masker.ts +0 -38
  288. package/packages/core/src/pack/types.ts +0 -39
  289. package/packages/core/src/plugins/index.ts +0 -100
  290. package/packages/core/src/plugins/webhooks.ts +0 -110
  291. package/packages/core/src/search/bm25.ts +0 -16
  292. package/packages/core/src/search/index.ts +0 -83
  293. package/packages/core/src/search/rrf.ts +0 -31
  294. package/packages/core/src/search/semantic.ts +0 -15
  295. package/packages/core/src/store/sqlite-vec.ts +0 -290
  296. package/packages/core/src/store/types.ts +0 -22
  297. package/packages/core/src/team/index.ts +0 -126
  298. package/packages/core/src/types/chunk.ts +0 -25
  299. package/packages/core/src/types/document.ts +0 -24
  300. package/packages/core/src/types/graph.ts +0 -44
  301. package/packages/core/src/types/index.ts +0 -15
  302. package/packages/core/src/types/search.ts +0 -38
  303. package/packages/core/src/utils/retry.ts +0 -85
  304. package/packages/core/tests/api-card.test.ts +0 -60
  305. package/packages/core/tests/api-routes.test.ts +0 -98
  306. package/packages/core/tests/bm25.test.ts +0 -87
  307. package/packages/core/tests/chunker.test.ts +0 -48
  308. package/packages/core/tests/cluster.test.ts +0 -75
  309. package/packages/core/tests/constellation.test.ts +0 -77
  310. package/packages/core/tests/export-utils.test.ts +0 -97
  311. package/packages/core/tests/fsrs.test.ts +0 -96
  312. package/packages/core/tests/gesture-detector.test.ts +0 -45
  313. package/packages/core/tests/graph-data.test.ts +0 -87
  314. package/packages/core/tests/layout.test.ts +0 -83
  315. package/packages/core/tests/mcp.test.ts +0 -148
  316. package/packages/core/tests/pack.test.ts +0 -127
  317. package/packages/core/tests/pii-masker.test.ts +0 -42
  318. package/packages/core/tests/profile-card.test.ts +0 -62
  319. package/packages/core/tests/rrf.test.ts +0 -29
  320. package/packages/core/tests/search-integration.test.ts +0 -139
  321. package/packages/core/tests/store.test.ts +0 -80
  322. package/packages/graph/click-result.png +0 -0
  323. package/packages/graph/dist/assets/camera_utils-BMxqtvoZ.js +0 -1
  324. package/packages/graph/dist/assets/hands-DXA01_mx.js +0 -18
  325. package/packages/graph/dist/assets/index-DMEe2diW.js +0 -4192
  326. package/packages/graph/dist/assets/layout.worker-DbKCEFTz.js +0 -1
  327. package/packages/graph/dist/index.html +0 -17
  328. package/packages/graph/index.html +0 -17
  329. package/packages/graph/package.json +0 -32
  330. package/packages/graph/src/App.tsx +0 -7
  331. package/packages/graph/src/api/client.ts +0 -39
  332. package/packages/graph/src/components/ClusterFilter.tsx +0 -73
  333. package/packages/graph/src/components/ConstellationView.tsx +0 -232
  334. package/packages/graph/src/components/ExportPanel.tsx +0 -177
  335. package/packages/graph/src/components/Graph3D.tsx +0 -230
  336. package/packages/graph/src/components/GraphEdges.tsx +0 -100
  337. package/packages/graph/src/components/GraphNodes.tsx +0 -386
  338. package/packages/graph/src/components/HealthDashboard.tsx +0 -173
  339. package/packages/graph/src/components/Layout.tsx +0 -214
  340. package/packages/graph/src/components/MotionOverlay.tsx +0 -81
  341. package/packages/graph/src/components/MotionToggle.tsx +0 -33
  342. package/packages/graph/src/components/MultiverseView.tsx +0 -286
  343. package/packages/graph/src/components/NodeDetail.tsx +0 -232
  344. package/packages/graph/src/components/PulseParticle.tsx +0 -232
  345. package/packages/graph/src/components/SearchBar.tsx +0 -107
  346. package/packages/graph/src/components/StarField.tsx +0 -197
  347. package/packages/graph/src/components/StatusBar.tsx +0 -53
  348. package/packages/graph/src/components/Timeline.tsx +0 -148
  349. package/packages/graph/src/components/ToolsPanel.tsx +0 -512
  350. package/packages/graph/src/components/Tooltip.tsx +0 -100
  351. package/packages/graph/src/components/TypeFilter.tsx +0 -131
  352. package/packages/graph/src/embed/EmbedGraph.tsx +0 -144
  353. package/packages/graph/src/hooks/useConstellationLOD.ts +0 -76
  354. package/packages/graph/src/hooks/useDecay.ts +0 -37
  355. package/packages/graph/src/hooks/useExport.ts +0 -165
  356. package/packages/graph/src/hooks/useGraph.ts +0 -69
  357. package/packages/graph/src/hooks/useKeyboardNav.ts +0 -122
  358. package/packages/graph/src/hooks/useLayout.ts +0 -45
  359. package/packages/graph/src/hooks/useMotion.ts +0 -120
  360. package/packages/graph/src/hooks/usePulse.ts +0 -58
  361. package/packages/graph/src/hooks/useSearch.ts +0 -71
  362. package/packages/graph/src/lib/constellation.ts +0 -107
  363. package/packages/graph/src/lib/export-utils.ts +0 -48
  364. package/packages/graph/src/lib/gesture-detector.ts +0 -123
  365. package/packages/graph/src/lib/layout.worker.ts +0 -153
  366. package/packages/graph/src/lib/motion-controller.ts +0 -83
  367. package/packages/graph/src/lib/profile-card.ts +0 -122
  368. package/packages/graph/src/main.tsx +0 -4
  369. package/packages/graph/src/stores/graph-store.ts +0 -155
  370. package/packages/graph/success.png +0 -0
  371. package/packages/graph/test-click.mjs +0 -49
  372. package/packages/graph/test-explore.mjs +0 -102
  373. package/packages/graph/test-final.mjs +0 -61
  374. package/packages/graph/test-graph.mjs +0 -139
  375. package/packages/graph/test-hover.mjs +0 -48
  376. package/packages/graph/test-pulse.mjs +0 -68
  377. package/packages/graph/test-screenshot.mjs +0 -56
  378. package/packages/graph/test-v2.mjs +0 -97
  379. package/packages/graph/tsconfig.tsbuildinfo +0 -1
  380. package/packages/graph/vite.config.ts +0 -15
  381. package/packages/sync/.env.example +0 -11
  382. package/packages/sync/.sync-state.json +0 -317
  383. package/packages/sync/.upload-state.json +0 -1009
  384. package/packages/sync/create-stella-network-notion.mjs +0 -151
  385. package/packages/sync/create-stellavault-project-notion.mjs +0 -322
  386. package/packages/sync/logs/sync-2026-03-28.log +0 -6
  387. package/packages/sync/logs/sync-2026-03-29.log +0 -12
  388. package/packages/sync/logs/sync-2026-03-30.log +0 -6
  389. package/packages/sync/logs/sync-2026-03-31.log +0 -6
  390. package/packages/sync/logs/sync-2026-04-01.log +0 -6
  391. package/packages/sync/logs/sync-2026-04-02.log +0 -6
  392. package/packages/sync/package-lock.json +0 -373
  393. package/packages/sync/package.json +0 -16
  394. package/packages/sync/run-sync.bat +0 -18
  395. package/packages/sync/run-sync.mjs +0 -46
  396. package/packages/sync/setup-scheduler.mjs +0 -119
  397. package/packages/sync/structured-sync.mjs +0 -187
  398. package/packages/sync/sync-to-obsidian.mjs +0 -264
  399. package/packages/sync/upload-pdca-to-notion.mjs +0 -495
  400. package/tsconfig.base.json +0 -18
@@ -1,118 +0,0 @@
1
- // Cross-Vault Federation (P3-F24)
2
- // 한 사람의 여러 vault를 통합 검색
3
-
4
- import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';
5
- import { join } from 'node:path';
6
- import { homedir } from 'node:os';
7
- import type { VectorStore } from '../store/types.js';
8
- import type { Embedder } from '../indexer/embedder.js';
9
- import type { ScoredChunk } from '../types/chunk.js';
10
-
11
- export interface VaultEntry {
12
- id: string; // short alias
13
- name: string; // display name
14
- path: string; // vault path
15
- dbPath: string; // index.db path
16
- shared: boolean; // 공유 허용 여부 (Federation에서)
17
- addedAt: string;
18
- }
19
-
20
- export interface CrossVaultSearchResult {
21
- vaultId: string;
22
- vaultName: string;
23
- title: string;
24
- score: number;
25
- snippet: string;
26
- filePath: string;
27
- }
28
-
29
- const VAULTS_FILE = join(homedir(), '.stellavault', 'vaults.json');
30
-
31
- function loadVaults(): VaultEntry[] {
32
- if (!existsSync(VAULTS_FILE)) return [];
33
- return JSON.parse(readFileSync(VAULTS_FILE, 'utf-8'));
34
- }
35
-
36
- function saveVaults(vaults: VaultEntry[]): void {
37
- mkdirSync(join(homedir(), '.stellavault'), { recursive: true });
38
- writeFileSync(VAULTS_FILE, JSON.stringify(vaults, null, 2), 'utf-8');
39
- }
40
-
41
- export function addVault(id: string, name: string, vaultPath: string, dbPath: string, shared = false): VaultEntry {
42
- const vaults = loadVaults();
43
- if (vaults.some(v => v.id === id)) {
44
- throw new Error(`Vault "${id}" already exists`);
45
- }
46
- const entry: VaultEntry = { id, name, path: vaultPath, dbPath, shared, addedAt: new Date().toISOString() };
47
- vaults.push(entry);
48
- saveVaults(vaults);
49
- return entry;
50
- }
51
-
52
- export function removeVault(id: string): boolean {
53
- const vaults = loadVaults();
54
- const filtered = vaults.filter(v => v.id !== id);
55
- if (filtered.length === vaults.length) return false;
56
- saveVaults(filtered);
57
- return true;
58
- }
59
-
60
- export function listVaults(): VaultEntry[] {
61
- return loadVaults();
62
- }
63
-
64
- export function getVault(id: string): VaultEntry | undefined {
65
- return loadVaults().find(v => v.id === id);
66
- }
67
-
68
- // 모든 vault를 통합 검색
69
- export async function searchAllVaults(
70
- query: string,
71
- embedder: Embedder,
72
- createStore: (dbPath: string) => VectorStore,
73
- options: { limit?: number } = {},
74
- ): Promise<CrossVaultSearchResult[]> {
75
- const { limit = 10 } = options;
76
- const vaults = loadVaults();
77
- const results: CrossVaultSearchResult[] = [];
78
-
79
- // 쿼리 임베딩 (한 번만)
80
- const embedding = await embedder.embed(query);
81
-
82
- // 각 vault에서 병렬 검색
83
- const searches = vaults.map(async (vault) => {
84
- try {
85
- if (!existsSync(vault.dbPath)) return;
86
-
87
- const store = createStore(vault.dbPath);
88
- await store.initialize();
89
-
90
- const scored = await store.searchSemantic(embedding, limit);
91
-
92
- for (const s of scored) {
93
- const chunk = await store.getChunk(s.chunkId);
94
- if (!chunk) continue;
95
- const doc = await store.getDocument(chunk.documentId);
96
-
97
- results.push({
98
- vaultId: vault.id,
99
- vaultName: vault.name,
100
- title: doc?.title ?? 'Untitled',
101
- score: s.score,
102
- snippet: chunk.content.slice(0, 80),
103
- filePath: doc?.filePath ?? '',
104
- });
105
- }
106
-
107
- await store.close();
108
- } catch {
109
- // vault 접근 실패 시 건너뜀
110
- }
111
- });
112
-
113
- await Promise.allSettled(searches);
114
-
115
- return results
116
- .sort((a, b) => b.score - a.score)
117
- .slice(0, limit);
118
- }
@@ -1,127 +0,0 @@
1
- // Design Ref: Phase 3 FR-01~03 — 검색/클러스터 기반 팩 생성
2
-
3
- import type { VectorStore } from '../store/types.js';
4
- import type { SearchEngine } from '../search/index.js';
5
- import type { Embedder } from '../indexer/embedder.js';
6
- import type { KnowledgePack, PackChunk } from './types.js';
7
- import { maskPII } from './pii-masker.js';
8
-
9
- export interface CreatePackOptions {
10
- name: string;
11
- author?: string;
12
- license?: string;
13
- description?: string;
14
- fromSearch?: string;
15
- fromCluster?: number;
16
- limit?: number;
17
- }
18
-
19
- export async function createPack(
20
- store: VectorStore,
21
- searchEngine: SearchEngine,
22
- embedder: Embedder,
23
- options: CreatePackOptions,
24
- ): Promise<{ pack: KnowledgePack; piiReport: { redactedCount: number; types: string[] } }> {
25
- const { name, author = 'anonymous', license = 'CC-BY-4.0', description = '', limit = 100 } = options;
26
-
27
- let chunkIds: string[] = [];
28
-
29
- if (options.fromSearch) {
30
- // 검색 결과에서 청크 수집
31
- const results = await searchEngine.search({ query: options.fromSearch, limit });
32
- chunkIds = results.map(r => r.chunk.id);
33
- } else if (options.fromCluster !== undefined) {
34
- // 클러스터의 문서에서 청크 수집
35
- const docs = await store.getAllDocuments();
36
- const embeddings = await store.getDocumentEmbeddings();
37
-
38
- // 간단한 클러스터 매칭: graph-data의 K-means 결과를 재활용할 수 없으므로
39
- // 해당 클러스터 문서의 모든 청크를 가져옴
40
- // 여기서는 fromSearch를 권장하되, fromCluster는 문서 ID 기반으로 처리
41
- const clusterDocs = docs.slice(0, limit);
42
- for (const doc of clusterDocs) {
43
- const chunk = await store.getChunk(`${doc.id}#0`);
44
- if (chunk) chunkIds.push(chunk.id);
45
- }
46
- }
47
-
48
- // 청크 데이터 수집 + PII 마스킹
49
- const chunks: PackChunk[] = [];
50
- let totalRedacted = 0;
51
- const allTypes = new Set<string>();
52
-
53
- for (const chunkId of chunkIds) {
54
- const chunk = await store.getChunk(chunkId);
55
- if (!chunk) continue;
56
-
57
- const doc = await store.getDocument(chunk.documentId);
58
- if (!doc) continue;
59
-
60
- // PII 마스킹
61
- const { masked, redactedCount, redactedTypes } = maskPII(chunk.content);
62
- totalRedacted += redactedCount;
63
- redactedTypes.forEach(t => allTypes.add(t));
64
-
65
- // 임베딩 재생성 (마스킹된 텍스트로)
66
- const embedding = await embedder.embed(masked);
67
-
68
- chunks.push({
69
- id: chunkId,
70
- content: masked,
71
- heading: chunk.heading,
72
- embedding,
73
- metadata: {
74
- sourceFile: doc.filePath,
75
- category: detectCategory(doc.filePath, chunk.content),
76
- language: detectLanguage(chunk.content),
77
- },
78
- });
79
- }
80
-
81
- const pack: KnowledgePack = {
82
- name,
83
- version: '1.0.0',
84
- author,
85
- license,
86
- description: description || `Knowledge pack: ${name}`,
87
- tags: extractPackTags(chunks),
88
- embeddingModel: embedder.modelName,
89
- embeddingDimensions: embedder.dimensions,
90
- schemaVersion: '1.0',
91
- chunks,
92
- createdAt: new Date().toISOString(),
93
- };
94
-
95
- return {
96
- pack,
97
- piiReport: { redactedCount: totalRedacted, types: [...allTypes] },
98
- };
99
- }
100
-
101
- function detectCategory(filePath: string, content: string): string {
102
- const lower = filePath.toLowerCase() + ' ' + content.slice(0, 200).toLowerCase();
103
- if (lower.includes('lesson') || lower.includes('교훈')) return 'lesson';
104
- if (lower.includes('pattern') || lower.includes('패턴')) return 'pattern';
105
- if (lower.includes('decision') || lower.includes('결정')) return 'decision';
106
- if (lower.includes('design') || lower.includes('설계')) return 'reference';
107
- return 'reference';
108
- }
109
-
110
- function detectLanguage(content: string): string | undefined {
111
- if (content.includes('typescript') || content.includes('.ts')) return 'typescript';
112
- if (content.includes('python') || content.includes('.py')) return 'python';
113
- if (content.includes('react') || content.includes('jsx')) return 'react';
114
- return undefined;
115
- }
116
-
117
- function extractPackTags(chunks: PackChunk[]): string[] {
118
- const wordCounts = new Map<string, number>();
119
- for (const c of chunks) {
120
- const words = c.heading.split(/\s+/).filter(w => w.length > 2);
121
- for (const w of words) wordCounts.set(w, (wordCounts.get(w) ?? 0) + 1);
122
- }
123
- return [...wordCounts.entries()]
124
- .sort((a, b) => b[1] - a[1])
125
- .slice(0, 10)
126
- .map(([w]) => w);
127
- }
@@ -1,21 +0,0 @@
1
- // Design Ref: Phase 3 FR-05 — .sv-pack 파일 내보내기
2
-
3
- import { writeFileSync, mkdirSync } from 'node:fs';
4
- import { dirname } from 'node:path';
5
- import type { KnowledgePack } from './types.js';
6
-
7
- export function exportPack(pack: KnowledgePack, outputPath: string): void {
8
- mkdirSync(dirname(outputPath), { recursive: true });
9
- writeFileSync(outputPath, JSON.stringify(pack, null, 2), 'utf-8');
10
- }
11
-
12
- export function packToSummary(pack: KnowledgePack): string {
13
- return [
14
- `Name: ${pack.name} v${pack.version}`,
15
- `Author: ${pack.author} (${pack.license})`,
16
- `Chunks: ${pack.chunks.length}`,
17
- `Model: ${pack.embeddingModel} (${pack.embeddingDimensions}d)`,
18
- `Tags: ${pack.tags.join(', ')}`,
19
- `Created: ${pack.createdAt}`,
20
- ].join('\n');
21
- }
@@ -1,82 +0,0 @@
1
- // Design Ref: Phase 3 FR-06~07 — .sv-pack 가져오기 + 벡터 DB 병합
2
-
3
- import { readFileSync } from 'node:fs';
4
- import type { VectorStore } from '../store/types.js';
5
- import type { Embedder } from '../indexer/embedder.js';
6
- import type { KnowledgePack } from './types.js';
7
-
8
- export interface ImportResult {
9
- imported: number;
10
- skipped: number;
11
- reEmbedded: number;
12
- modelMismatch: boolean;
13
- }
14
-
15
- export async function importPack(
16
- store: VectorStore,
17
- embedder: Embedder,
18
- filePath: string,
19
- ): Promise<ImportResult> {
20
- const raw = readFileSync(filePath, 'utf-8');
21
- const pack: KnowledgePack = JSON.parse(raw);
22
-
23
- // 임베딩 모델 불일치 감지
24
- const modelMismatch = pack.embeddingModel !== embedder.modelName ||
25
- pack.embeddingDimensions !== embedder.dimensions;
26
-
27
- let imported = 0;
28
- let skipped = 0;
29
- let reEmbedded = 0;
30
-
31
- // 팩 문서를 pack_{name} prefix로 저장
32
- const packDocId = `pack_${pack.name}`;
33
-
34
- await store.upsertDocument({
35
- id: packDocId,
36
- filePath: `[pack] ${pack.name}`,
37
- title: `${pack.name} (Knowledge Pack)`,
38
- content: `Imported pack: ${pack.description}\nChunks: ${pack.chunks.length}\nAuthor: ${pack.author}`,
39
- frontmatter: { pack: pack.name, license: pack.license },
40
- tags: pack.tags,
41
- lastModified: pack.createdAt,
42
- contentHash: `pack_${pack.name}_${pack.version}`,
43
- });
44
-
45
- const chunks = [];
46
- for (let i = 0; i < pack.chunks.length; i++) {
47
- const pc = pack.chunks[i];
48
-
49
- let embedding = pc.embedding;
50
-
51
- // 모델 불일치 시 재임베딩
52
- if (modelMismatch) {
53
- embedding = await embedder.embed(pc.content);
54
- reEmbedded++;
55
- }
56
-
57
- // 차원 검증
58
- if (embedding.length !== embedder.dimensions) {
59
- skipped++;
60
- continue;
61
- }
62
-
63
- chunks.push({
64
- id: `${packDocId}#${i}`,
65
- documentId: packDocId,
66
- content: pc.content,
67
- heading: pc.heading || pack.name,
68
- startLine: 0,
69
- endLine: 0,
70
- tokenCount: Math.ceil(pc.content.length / 4),
71
- embedding,
72
- });
73
-
74
- imported++;
75
- }
76
-
77
- if (chunks.length > 0) {
78
- await store.upsertChunks(chunks);
79
- }
80
-
81
- return { imported, skipped, reEmbedded, modelMismatch };
82
- }
@@ -1,103 +0,0 @@
1
- // Pack Marketplace (F-A07) — npm registry + GitHub Releases 기반
2
- // 서버 불필요: npm/GitHub를 마켓플레이스로 활용
3
-
4
- export interface PackListing {
5
- name: string;
6
- version: string;
7
- description: string;
8
- author: string;
9
- downloads?: number;
10
- tags: string[];
11
- source: 'npm' | 'github';
12
- installCommand: string;
13
- }
14
-
15
- // npm에서 @stellavault/pack-* 패키지 검색
16
- export async function searchMarketplace(query: string, limit = 10): Promise<PackListing[]> {
17
- const results: PackListing[] = [];
18
-
19
- try {
20
- // npm registry search
21
- const safeLimit = Math.min(limit, 20); // MED: 최대 20개 제한
22
- const npmUrl = `https://registry.npmjs.org/-/v1/search?text=stellavault-pack+${encodeURIComponent(query)}&size=${safeLimit}`;
23
- const res = await fetch(npmUrl, { signal: AbortSignal.timeout(5000) });
24
- if (res.ok) {
25
- const data = await res.json() as any;
26
- for (const pkg of data.objects ?? []) {
27
- results.push({
28
- name: pkg.package.name,
29
- version: pkg.package.version,
30
- description: pkg.package.description ?? '',
31
- author: pkg.package.author?.name ?? pkg.package.publisher?.username ?? 'unknown',
32
- downloads: pkg.downloads?.weekly ?? 0,
33
- tags: pkg.package.keywords ?? [],
34
- source: 'npm',
35
- installCommand: `npm install ${pkg.package.name}`,
36
- });
37
- }
38
- }
39
- } catch { /* npm search failed — continue */ }
40
-
41
- try {
42
- // GitHub search for stellavault-pack repos
43
- const ghUrl = `https://api.github.com/search/repositories?q=stellavault-pack+${encodeURIComponent(query)}&per_page=${limit}`;
44
- const res = await fetch(ghUrl, {
45
- headers: { 'Accept': 'application/vnd.github.v3+json', 'User-Agent': 'stellavault-marketplace' },
46
- signal: AbortSignal.timeout(5000),
47
- });
48
- if (res.ok) {
49
- const data = await res.json() as any;
50
- for (const repo of data.items ?? []) {
51
- // npm과 중복 방지
52
- if (results.some(r => r.name === repo.name)) continue;
53
- results.push({
54
- name: repo.full_name,
55
- version: 'latest',
56
- description: repo.description ?? '',
57
- author: repo.owner?.login ?? 'unknown',
58
- downloads: repo.stargazers_count,
59
- tags: repo.topics ?? [],
60
- source: 'github',
61
- installCommand: `sv pack import <(curl -sL ${repo.html_url}/releases/latest/download/pack.sv-pack)`,
62
- });
63
- }
64
- }
65
- } catch { /* GitHub search failed — continue */ }
66
-
67
- return results;
68
- }
69
-
70
- // sv-pack 파일을 npm에 publish할 수 있도록 패키지 생성
71
- export function createPackageJson(packName: string, description: string, author: string, version = '1.0.0'): string {
72
- return JSON.stringify({
73
- name: `stellavault-pack-${packName}`,
74
- version,
75
- description,
76
- author,
77
- license: 'CC-BY-4.0',
78
- keywords: ['stellavault', 'knowledge-pack', packName],
79
- files: ['*.sv-pack', 'README.md'],
80
- stellavault: { type: 'knowledge-pack' },
81
- }, null, 2);
82
- }
83
-
84
- // GitHub Release로 pack 배포용 명령어 생성
85
- export function getPublishInstructions(packName: string): string {
86
- return `
87
- To publish your Knowledge Pack:
88
-
89
- Option A: npm
90
- 1. cd your-pack-directory/
91
- 2. npm init (or use: sv pack prepare ${packName})
92
- 3. npm publish
93
-
94
- Option B: GitHub Release
95
- 1. Create a GitHub repo: stellavault-pack-${packName}
96
- 2. Add your .sv-pack file
97
- 3. Create a release with the .sv-pack as an asset
98
-
99
- Users install with:
100
- npm: sv pack install stellavault-pack-${packName}
101
- GitHub: sv pack import <url-to-sv-pack-file>
102
- `.trim();
103
- }
@@ -1,38 +0,0 @@
1
- // Design Ref: Phase 3 FR-04 — PII 감지 + 마스킹
2
-
3
- const PII_PATTERNS: Array<{ name: string; regex: RegExp }> = [
4
- { name: 'email', regex: /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g },
5
- { name: 'api_key', regex: /(?:sk|pk|api|key|token|secret|password)[_\-a-zA-Z]*[_\-][a-zA-Z0-9]{16,}/gi },
6
- { name: 'aws_key', regex: /AKIA[0-9A-Z]{16}/g },
7
- { name: 'url_with_auth', regex: /https?:\/\/[^:]+:[^@]+@[^\s]+/g },
8
- { name: 'ip_address', regex: /\b(?:\d{1,3}\.){3}\d{1,3}\b/g },
9
- { name: 'phone', regex: /\b0\d{1,2}[-.\s]?\d{3,4}[-.\s]?\d{4}\b/g },
10
- { name: 'jwt', regex: /eyJ[a-zA-Z0-9_-]{10,}\.[a-zA-Z0-9_-]{10,}\.[a-zA-Z0-9_-]{10,}/g },
11
- ];
12
-
13
- export interface MaskResult {
14
- masked: string;
15
- redactedCount: number;
16
- redactedTypes: string[];
17
- }
18
-
19
- export function maskPII(text: string): MaskResult {
20
- let masked = text;
21
- let redactedCount = 0;
22
- const redactedTypes = new Set<string>();
23
-
24
- for (const { name, regex } of PII_PATTERNS) {
25
- const matches = masked.match(regex);
26
- if (matches) {
27
- redactedCount += matches.length;
28
- redactedTypes.add(name);
29
- masked = masked.replace(regex, `[REDACTED:${name}]`);
30
- }
31
- }
32
-
33
- return {
34
- masked,
35
- redactedCount,
36
- redactedTypes: [...redactedTypes],
37
- };
38
- }
@@ -1,39 +0,0 @@
1
- // Design Ref: Phase 3 §1 — .sv-pack.json 표준 포맷
2
-
3
- export interface KnowledgePack {
4
- name: string;
5
- version: string;
6
- author: string;
7
- license: string;
8
- description: string;
9
- tags: string[];
10
- embeddingModel: string;
11
- embeddingDimensions: number;
12
- schemaVersion: string;
13
- chunks: PackChunk[];
14
- createdAt: string;
15
- }
16
-
17
- export interface PackChunk {
18
- id: string;
19
- content: string;
20
- heading: string;
21
- embedding: number[];
22
- metadata: {
23
- sourceFile: string;
24
- category: string;
25
- language?: string;
26
- framework?: string;
27
- };
28
- }
29
-
30
- export interface PackInfo {
31
- name: string;
32
- version: string;
33
- author: string;
34
- license: string;
35
- description: string;
36
- chunkCount: number;
37
- embeddingModel: string;
38
- createdAt: string;
39
- }
@@ -1,100 +0,0 @@
1
- // Plugin SDK (F-A15) — Event-driven plugin system
2
-
3
- export interface PluginContext {
4
- store: {
5
- search(query: string, limit?: number): Promise<any[]>;
6
- getDocument(id: string): Promise<any>;
7
- getStats(): Promise<any>;
8
- };
9
- config: Record<string, unknown>;
10
- log: (message: string) => void;
11
- }
12
-
13
- export type PluginEvent =
14
- | 'onIndex' // After a document is indexed
15
- | 'onSearch' // After a search is performed
16
- | 'onDecay' // When decay check runs
17
- | 'onGapDetected' // When a knowledge gap is found
18
- | 'onStartup' // When stellavault starts
19
- | 'onShutdown'; // When stellavault stops
20
-
21
- export interface PluginManifest {
22
- name: string;
23
- version: string;
24
- description: string;
25
- author?: string;
26
- events: PluginEvent[];
27
- }
28
-
29
- export interface StellavaultPlugin {
30
- manifest: PluginManifest;
31
- activate(context: PluginContext): Promise<void>;
32
- deactivate?(): Promise<void>;
33
- onEvent?(event: PluginEvent, data: unknown): Promise<void>;
34
- }
35
-
36
- type EventHandler = (data: unknown) => Promise<void>;
37
-
38
- export class PluginManager {
39
- private plugins = new Map<string, StellavaultPlugin>();
40
- private handlers = new Map<PluginEvent, Array<{ pluginName: string; handler: EventHandler }>>();
41
- private context: PluginContext;
42
-
43
- constructor(context: PluginContext) {
44
- this.context = context;
45
- }
46
-
47
- async register(plugin: StellavaultPlugin): Promise<void> {
48
- if (this.plugins.has(plugin.manifest.name)) {
49
- throw new Error(`Plugin "${plugin.manifest.name}" is already registered`);
50
- }
51
-
52
- this.plugins.set(plugin.manifest.name, plugin);
53
-
54
- // Register event handlers (MED fix: track by plugin name for proper unregister)
55
- for (const event of plugin.manifest.events) {
56
- if (!this.handlers.has(event)) this.handlers.set(event, []);
57
- if (plugin.onEvent) {
58
- this.handlers.get(event)!.push({
59
- pluginName: plugin.manifest.name,
60
- handler: (data) => plugin.onEvent!(event, data),
61
- });
62
- }
63
- }
64
-
65
- await plugin.activate(this.context);
66
- this.context.log(`Plugin "${plugin.manifest.name}" v${plugin.manifest.version} activated`);
67
- }
68
-
69
- async unregister(name: string): Promise<void> {
70
- const plugin = this.plugins.get(name);
71
- if (!plugin) return;
72
-
73
- await plugin.deactivate?.();
74
- this.plugins.delete(name);
75
-
76
- // MED fix: properly remove handlers by plugin name
77
- for (const [event, entries] of this.handlers) {
78
- this.handlers.set(event, entries.filter(e => e.pluginName !== name));
79
- }
80
- }
81
-
82
- async emit(event: PluginEvent, data: unknown): Promise<void> {
83
- const entries = this.handlers.get(event) ?? [];
84
- for (const { handler } of entries) {
85
- try {
86
- await handler(data);
87
- } catch (err) {
88
- this.context.log(`Plugin error on ${event}: ${err instanceof Error ? err.message : String(err)}`);
89
- }
90
- }
91
- }
92
-
93
- listPlugins(): PluginManifest[] {
94
- return [...this.plugins.values()].map(p => p.manifest);
95
- }
96
-
97
- getPlugin(name: string): StellavaultPlugin | undefined {
98
- return this.plugins.get(name);
99
- }
100
- }