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,168 +0,0 @@
1
- // Voice Knowledge Capture (P3-F25)
2
- // 음성 파일 → 텍스트 → 자동 분류 → vault 저장 → 인덱싱
3
-
4
- import { execFileSync, execSync } from 'node:child_process';
5
- import { writeFileSync, mkdirSync, existsSync } from 'node:fs';
6
- import { join, basename } from 'node:path';
7
-
8
- // CRIT-03: 화이트리스트 검증
9
- const ALLOWED_MODELS = ['tiny', 'base', 'small', 'medium', 'large'];
10
- const ALLOWED_LANGUAGES = ['auto', 'en', 'ko', 'ja', 'zh', 'es', 'fr', 'de', 'it', 'pt', 'ru', 'ar', 'hi'];
11
-
12
- function validateModel(model: string): string {
13
- if (!ALLOWED_MODELS.includes(model)) throw new Error(`Invalid model: ${model}. Allowed: ${ALLOWED_MODELS.join(', ')}`);
14
- return model;
15
- }
16
-
17
- function validateLanguage(lang: string): string {
18
- if (!ALLOWED_LANGUAGES.includes(lang)) throw new Error(`Invalid language: ${lang}. Allowed: ${ALLOWED_LANGUAGES.join(', ')}`);
19
- return lang;
20
- }
21
-
22
- export interface CaptureResult {
23
- title: string;
24
- filePath: string;
25
- transcript: string;
26
- duration?: number;
27
- tags: string[];
28
- success: boolean;
29
- error?: string;
30
- }
31
-
32
- export interface CaptureOptions {
33
- vaultPath: string;
34
- folder?: string; // default: 01_Knowledge/voice
35
- language?: string; // default: auto
36
- model?: string; // whisper model: tiny, base, small, medium, large
37
- tags?: string[];
38
- type?: string;
39
- }
40
-
41
- // Whisper CLI가 설치되어 있는지 확인
42
- export function isWhisperAvailable(): boolean {
43
- try {
44
- execSync('whisper --help', { stdio: 'ignore' });
45
- return true;
46
- } catch {
47
- return false;
48
- }
49
- }
50
-
51
- // 음성 파일 → 텍스트 변환 (Whisper CLI)
52
- export async function transcribeAudio(audioPath: string, options: { model?: string; language?: string } = {}): Promise<string> {
53
- const { model = 'base', language } = options;
54
-
55
- if (!existsSync(audioPath)) {
56
- throw new Error(`Audio file not found: ${audioPath}`);
57
- }
58
-
59
- // CRIT-03 fix: execFileSync + 화이트리스트 검증 (command injection 방지)
60
- if (isWhisperAvailable()) {
61
- const safeModel = validateModel(model);
62
- const args = [audioPath, '--model', safeModel, '--output_format', 'txt', '--output_dir', '/tmp/sv-whisper'];
63
- if (language) args.push('--language', validateLanguage(language));
64
- mkdirSync('/tmp/sv-whisper', { recursive: true });
65
-
66
- try {
67
- execFileSync('whisper', args, { stdio: 'pipe', timeout: 300000 });
68
- const outputName = basename(audioPath).replace(/\.[^.]+$/, '.txt');
69
- const { readFileSync } = await import('node:fs');
70
- return readFileSync(join('/tmp/sv-whisper', outputName), 'utf-8').trim();
71
- } catch (err) {
72
- throw new Error(`Whisper failed: ${err instanceof Error ? err.message : err}`);
73
- }
74
- }
75
-
76
- // Whisper 없으면 에러
77
- throw new Error('Whisper not installed. Install: pip install openai-whisper');
78
- }
79
-
80
- // 트랜스크립트에서 자동 태그 추출 (간단한 키워드 매칭)
81
- function autoTag(text: string): string[] {
82
- const tags: string[] = [];
83
- const lower = text.toLowerCase();
84
-
85
- const keywords: Record<string, string[]> = {
86
- 'meeting': ['meeting', 'discuss', '미팅', '회의'],
87
- 'decision': ['decide', 'agreed', '결정', '합의'],
88
- 'idea': ['idea', 'thought', '아이디어', '생각'],
89
- 'todo': ['todo', 'task', 'action item', '할 일'],
90
- 'bug': ['bug', 'error', 'fix', '버그', '에러'],
91
- 'architecture': ['architecture', 'design', 'system', '아키텍처', '설계'],
92
- };
93
-
94
- for (const [tag, words] of Object.entries(keywords)) {
95
- if (words.some(w => lower.includes(w))) tags.push(tag);
96
- }
97
-
98
- return tags;
99
- }
100
-
101
- // 음성 → vault 노트 생성
102
- export async function captureVoice(audioPath: string, options: CaptureOptions): Promise<CaptureResult> {
103
- const { vaultPath, folder = '01_Knowledge/voice', type = 'note', tags: userTags = [] } = options;
104
-
105
- try {
106
- // 1. 음성→텍스트
107
- const transcript = await transcribeAudio(audioPath, {
108
- model: options.model,
109
- language: options.language,
110
- });
111
-
112
- if (!transcript) {
113
- return { title: '', filePath: '', transcript: '', tags: [], success: false, error: 'Empty transcript' };
114
- }
115
-
116
- // 2. 제목 생성 (첫 문장 또는 첫 30자)
117
- const firstLine = transcript.split(/[.\n!?]/)[0]?.trim() || transcript.slice(0, 30);
118
- const title = firstLine.slice(0, 60);
119
- const safeTitle = title.replace(/[<>:"/\\|?*]/g, '').replace(/\s+/g, ' ').trim();
120
-
121
- // 3. 자동 태그
122
- const autoTags = autoTag(transcript);
123
- const allTags = [...new Set([...userTags, ...autoTags, 'voice'])];
124
-
125
- // 4. frontmatter + 마크다운 생성
126
- const date = new Date().toISOString();
127
- const content = [
128
- '---',
129
- `title: "${safeTitle}"`,
130
- `source: voice`,
131
- `type: ${type}`,
132
- `tags: [${allTags.map(t => `"${t}"`).join(', ')}]`,
133
- `captured: ${date}`,
134
- `audio: ${basename(audioPath)}`,
135
- '---',
136
- '',
137
- `# ${safeTitle}`,
138
- '',
139
- `> Voice capture: ${date.slice(0, 10)}`,
140
- '',
141
- transcript,
142
- '',
143
- ].join('\n');
144
-
145
- // 5. vault에 저장
146
- const dir = join(vaultPath, folder);
147
- mkdirSync(dir, { recursive: true });
148
- const filePath = join(dir, `${date.slice(0, 10)} ${safeTitle}.md`);
149
- writeFileSync(filePath, content, 'utf-8');
150
-
151
- return {
152
- title: safeTitle,
153
- filePath,
154
- transcript,
155
- tags: allTags,
156
- success: true,
157
- };
158
- } catch (err) {
159
- return {
160
- title: '',
161
- filePath: '',
162
- transcript: '',
163
- tags: [],
164
- success: false,
165
- error: err instanceof Error ? err.message : String(err),
166
- };
167
- }
168
- }
@@ -1,167 +0,0 @@
1
- // Cloud Sync (F-A04) — E2E encrypted SQLite backup
2
- // 서버리스: S3-compatible API로 직접 업로드 (R2, S3, MinIO)
3
- // Design Ref: PRD §7.1 Tier 2
4
-
5
- import { createCipheriv, createDecipheriv, randomBytes, createHash } from 'node:crypto';
6
- import { readFileSync, writeFileSync, existsSync, mkdirSync, chmodSync } from 'node:fs';
7
- import { join } from 'node:path';
8
- import { homedir } from 'node:os';
9
-
10
- export interface CloudConfig {
11
- endpoint: string; // S3-compatible endpoint (e.g., https://xxx.r2.cloudflarestorage.com)
12
- bucket: string;
13
- accessKeyId: string;
14
- secretAccessKey: string;
15
- encryptionKey?: string; // user-provided, or auto-generated
16
- }
17
-
18
- export interface SyncResult {
19
- action: 'upload' | 'download';
20
- dbSize: number;
21
- encryptedSize: number;
22
- timestamp: string;
23
- success: boolean;
24
- error?: string;
25
- }
26
-
27
- const CLOUD_DIR = join(homedir(), '.stellavault', 'cloud');
28
- const KEY_FILE = join(CLOUD_DIR, 'encryption.key');
29
- const SYNC_STATE_FILE = join(CLOUD_DIR, 'sync-state.json');
30
-
31
- // AES-256-GCM 암호화
32
- export function encrypt(data: Buffer, key: Buffer): { encrypted: Buffer; iv: Buffer; tag: Buffer } {
33
- const iv = randomBytes(16);
34
- const cipher = createCipheriv('aes-256-gcm', key, iv);
35
- const encrypted = Buffer.concat([cipher.update(data), cipher.final()]);
36
- const tag = cipher.getAuthTag();
37
- return { encrypted, iv, tag };
38
- }
39
-
40
- export function decrypt(encrypted: Buffer, key: Buffer, iv: Buffer, tag: Buffer): Buffer {
41
- const decipher = createDecipheriv('aes-256-gcm', key, iv);
42
- decipher.setAuthTag(tag);
43
- return Buffer.concat([decipher.update(encrypted), decipher.final()]);
44
- }
45
-
46
- // 암호화 키 관리
47
- export function getOrCreateEncryptionKey(userKey?: string): Buffer {
48
- mkdirSync(CLOUD_DIR, { recursive: true });
49
-
50
- if (userKey) {
51
- const key = createHash('sha256').update(userKey).digest();
52
- writeFileSync(KEY_FILE, key.toString('hex'), 'utf-8');
53
- return key;
54
- }
55
-
56
- if (existsSync(KEY_FILE)) {
57
- return Buffer.from(readFileSync(KEY_FILE, 'utf-8').trim(), 'hex');
58
- }
59
-
60
- const key = randomBytes(32);
61
- writeFileSync(KEY_FILE, key.toString('hex'), { encoding: 'utf-8', mode: 0o600 });
62
- try { chmodSync(KEY_FILE, 0o600); } catch { /* Windows may not support */ }
63
- return key;
64
- }
65
-
66
- // S3-compatible upload (presigned 불필요 — 직접 PUT)
67
- async function s3Put(config: CloudConfig, objectKey: string, data: Buffer, contentType = 'application/octet-stream'): Promise<boolean> {
68
- const { endpoint, bucket, accessKeyId, secretAccessKey } = config;
69
-
70
- // HIGH-05: endpoint 검증
71
- try {
72
- const parsed = new URL(endpoint);
73
- if (!['http:', 'https:'].includes(parsed.protocol)) throw new Error('Invalid protocol');
74
- if (parsed.hostname === 'localhost' || parsed.hostname === '127.0.0.1') throw new Error('Local endpoint');
75
- } catch (e) { throw new Error(`Invalid cloud endpoint: ${endpoint}. ${e instanceof Error ? e.message : ''}`); }
76
-
77
- const url = `${endpoint}/${bucket}/${objectKey}`;
78
- const date = new Date().toISOString().replace(/[-:]/g, '').slice(0, 15) + 'Z';
79
-
80
- const res = await fetch(url, {
81
- method: 'PUT',
82
- headers: {
83
- 'Content-Type': contentType,
84
- 'Content-Length': String(data.length),
85
- 'x-amz-date': date,
86
- 'x-amz-content-sha256': createHash('sha256').update(data).digest('hex'),
87
- // R2는 Bearer token 지원
88
- 'Authorization': `Bearer ${secretAccessKey}`,
89
- },
90
- body: data,
91
- });
92
-
93
- return res.ok;
94
- }
95
-
96
- async function s3Get(config: CloudConfig, objectKey: string): Promise<Buffer | null> {
97
- const url = `${config.endpoint}/${config.bucket}/${objectKey}`;
98
- const res = await fetch(url, {
99
- headers: { 'Authorization': `Bearer ${config.secretAccessKey}` },
100
- });
101
- if (!res.ok) return null;
102
- return Buffer.from(await res.arrayBuffer());
103
- }
104
-
105
- // Sync: 로컬 DB → 암호화 → 업로드
106
- export async function syncToCloud(dbPath: string, config: CloudConfig): Promise<SyncResult> {
107
- const timestamp = new Date().toISOString();
108
- try {
109
- if (!existsSync(dbPath)) {
110
- return { action: 'upload', dbSize: 0, encryptedSize: 0, timestamp, success: false, error: 'DB not found' };
111
- }
112
-
113
- const dbData = readFileSync(dbPath);
114
- const key = getOrCreateEncryptionKey(config.encryptionKey);
115
- const { encrypted, iv, tag } = encrypt(dbData, key);
116
-
117
- // 패키징: [iv(16)] + [tag(16)] + [encrypted data]
118
- const payload = Buffer.concat([iv, tag, encrypted]);
119
-
120
- const objectKey = `stellavault/index.db.enc`;
121
- const success = await s3Put(config, objectKey, payload);
122
-
123
- // 동기화 상태 저장
124
- const state = { lastSync: timestamp, dbSize: dbData.length, encryptedSize: payload.length, objectKey };
125
- mkdirSync(CLOUD_DIR, { recursive: true });
126
- writeFileSync(SYNC_STATE_FILE, JSON.stringify(state, null, 2), 'utf-8');
127
-
128
- return { action: 'upload', dbSize: dbData.length, encryptedSize: payload.length, timestamp, success };
129
- } catch (err) {
130
- return { action: 'upload', dbSize: 0, encryptedSize: 0, timestamp, success: false, error: err instanceof Error ? err.message : String(err) };
131
- }
132
- }
133
-
134
- // Restore: 다운로드 → 복호화 → 로컬 DB 덮어쓰기
135
- export async function restoreFromCloud(dbPath: string, config: CloudConfig): Promise<SyncResult> {
136
- const timestamp = new Date().toISOString();
137
- try {
138
- const objectKey = `stellavault/index.db.enc`;
139
- const payload = await s3Get(config, objectKey);
140
- if (!payload) {
141
- return { action: 'download', dbSize: 0, encryptedSize: 0, timestamp, success: false, error: 'No backup found in cloud' };
142
- }
143
-
144
- const key = getOrCreateEncryptionKey(config.encryptionKey);
145
- const iv = payload.subarray(0, 16);
146
- const tag = payload.subarray(16, 32);
147
- const encrypted = payload.subarray(32);
148
-
149
- const dbData = decrypt(encrypted, key, iv, tag);
150
-
151
- // 백업 후 덮어쓰기
152
- if (existsSync(dbPath)) {
153
- writeFileSync(dbPath + '.backup', readFileSync(dbPath));
154
- }
155
- writeFileSync(dbPath, dbData);
156
-
157
- return { action: 'download', dbSize: dbData.length, encryptedSize: payload.length, timestamp, success: true };
158
- } catch (err) {
159
- return { action: 'download', dbSize: 0, encryptedSize: 0, timestamp, success: false, error: err instanceof Error ? err.message : String(err) };
160
- }
161
- }
162
-
163
- // 동기화 상태 조회
164
- export function getSyncState(): { lastSync: string; dbSize: number } | null {
165
- if (!existsSync(SYNC_STATE_FILE)) return null;
166
- return JSON.parse(readFileSync(SYNC_STATE_FILE, 'utf-8'));
167
- }
@@ -1,82 +0,0 @@
1
- // Design Ref: §10.2 — 설정 파일 구조 (.stellavault.json 로더)
2
-
3
- import { readFileSync, existsSync } from 'node:fs';
4
- import { resolve, join } from 'node:path';
5
- import { homedir } from 'node:os';
6
-
7
- export interface StellavaultConfig {
8
- vaultPath: string;
9
- dbPath: string;
10
- embedding: {
11
- model: 'local' | 'openai';
12
- localModel: string;
13
- };
14
- chunking: {
15
- maxTokens: number;
16
- overlap: number;
17
- minTokens: number;
18
- };
19
- search: {
20
- defaultLimit: number;
21
- rrfK: number;
22
- };
23
- mcp: {
24
- mode: 'stdio' | 'sse';
25
- port: number;
26
- };
27
- }
28
-
29
- const DEFAULT_CONFIG: StellavaultConfig = {
30
- vaultPath: '',
31
- dbPath: join(homedir(), '.stellavault', 'index.db'),
32
- embedding: {
33
- model: 'local',
34
- localModel: 'all-MiniLM-L6-v2',
35
- },
36
- chunking: {
37
- maxTokens: 300,
38
- overlap: 50,
39
- minTokens: 50,
40
- },
41
- search: {
42
- defaultLimit: 10,
43
- rrfK: 60,
44
- },
45
- mcp: {
46
- mode: 'stdio',
47
- port: 3333,
48
- },
49
- };
50
-
51
- /**
52
- * .stellavault.json 파일을 찾아 로드합니다.
53
- * 탐색 순서: cwd → home directory → defaults
54
- */
55
- export function loadConfig(configPath?: string): StellavaultConfig {
56
- const paths = configPath
57
- ? [resolve(configPath)]
58
- : [
59
- resolve(process.cwd(), '.stellavault.json'),
60
- join(homedir(), '.stellavault.json'),
61
- ];
62
-
63
- for (const p of paths) {
64
- if (existsSync(p)) {
65
- const raw = JSON.parse(readFileSync(p, 'utf-8'));
66
- return mergeConfig(DEFAULT_CONFIG, raw);
67
- }
68
- }
69
-
70
- return { ...DEFAULT_CONFIG };
71
- }
72
-
73
- function mergeConfig(defaults: StellavaultConfig, overrides: Partial<StellavaultConfig>): StellavaultConfig {
74
- return {
75
- vaultPath: overrides.vaultPath ?? defaults.vaultPath,
76
- dbPath: overrides.dbPath ?? defaults.dbPath,
77
- embedding: { ...defaults.embedding, ...overrides.embedding },
78
- chunking: { ...defaults.chunking, ...overrides.chunking },
79
- search: { ...defaults.search, ...overrides.search },
80
- mcp: { ...defaults.mcp, ...overrides.mcp },
81
- };
82
- }
@@ -1,80 +0,0 @@
1
- // Federation Phase 2: Search Credits
2
- // 지식 공유 = 크레딧 획득, 연합 검색 = 크레딧 소모
3
-
4
- import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';
5
- import { join } from 'node:path';
6
- import { homedir } from 'node:os';
7
-
8
- export interface CreditAccount {
9
- balance: number;
10
- totalEarned: number;
11
- totalSpent: number;
12
- transactions: CreditTransaction[];
13
- }
14
-
15
- export interface CreditTransaction {
16
- type: 'earn' | 'spend';
17
- amount: number;
18
- reason: string;
19
- timestamp: string;
20
- }
21
-
22
- const CREDITS_FILE = join(homedir(), '.stellavault', 'federation', 'credits.json');
23
- const INITIAL_BALANCE = 100;
24
- const EARN_PER_SEARCH_RESPONSE = 10; // 검색 응답 시 획득
25
- const COST_PER_SEARCH = 1; // 검색 요청 시 소모
26
-
27
- function loadAccount(): CreditAccount {
28
- if (existsSync(CREDITS_FILE)) {
29
- return JSON.parse(readFileSync(CREDITS_FILE, 'utf-8'));
30
- }
31
- return { balance: INITIAL_BALANCE, totalEarned: 0, totalSpent: 0, transactions: [] };
32
- }
33
-
34
- function saveAccount(account: CreditAccount): void {
35
- mkdirSync(join(homedir(), '.stellavault', 'federation'), { recursive: true });
36
- // 최근 100개 트랜잭션만 유지
37
- account.transactions = account.transactions.slice(-100);
38
- writeFileSync(CREDITS_FILE, JSON.stringify(account, null, 2), 'utf-8');
39
- }
40
-
41
- export function getBalance(): number {
42
- return loadAccount().balance;
43
- }
44
-
45
- export function getAccount(): CreditAccount {
46
- return loadAccount();
47
- }
48
-
49
- export function earn(amount: number, reason: string): number {
50
- const account = loadAccount();
51
- account.balance += amount;
52
- account.totalEarned += amount;
53
- account.transactions.push({ type: 'earn', amount, reason, timestamp: new Date().toISOString() });
54
- saveAccount(account);
55
- return account.balance;
56
- }
57
-
58
- export function spend(amount: number, reason: string): { success: boolean; balance: number } {
59
- const account = loadAccount();
60
- if (account.balance < amount) {
61
- return { success: false, balance: account.balance };
62
- }
63
- account.balance -= amount;
64
- account.totalSpent += amount;
65
- account.transactions.push({ type: 'spend', amount, reason, timestamp: new Date().toISOString() });
66
- saveAccount(account);
67
- return { success: true, balance: account.balance };
68
- }
69
-
70
- export function earnForSearchResponse(peerId: string): number {
71
- return earn(EARN_PER_SEARCH_RESPONSE, `Search response to ${peerId}`);
72
- }
73
-
74
- export function spendForSearch(peerCount: number): { success: boolean; balance: number } {
75
- return spend(COST_PER_SEARCH * peerCount, `Search across ${peerCount} peers`);
76
- }
77
-
78
- export function getRecentTransactions(limit = 20): CreditTransaction[] {
79
- return loadAccount().transactions.slice(-limit).reverse();
80
- }
@@ -1,19 +0,0 @@
1
- declare module 'hyperswarm' {
2
- import { EventEmitter } from 'events';
3
-
4
- interface HyperswarmOptions {
5
- maxPeers?: number;
6
- }
7
-
8
- interface Discovery {
9
- flushed(): Promise<void>;
10
- }
11
-
12
- class Hyperswarm extends EventEmitter {
13
- constructor(options?: HyperswarmOptions);
14
- join(topic: Buffer, options?: { server?: boolean; client?: boolean }): Discovery;
15
- destroy(): Promise<void>;
16
- }
17
-
18
- export default Hyperswarm;
19
- }
@@ -1,90 +0,0 @@
1
- // Federation: Node Identity (HMAC-SHA256 signing)
2
- // CRIT-01 fix: 실제 서명 검증 구현 (placeholder 제거)
3
- // CRIT-04 fix: 키 파일 권한 0o600
4
-
5
- import { randomBytes, createHash, createHmac } from 'node:crypto';
6
- import { readFileSync, writeFileSync, existsSync, mkdirSync, chmodSync } from 'node:fs';
7
- import { join } from 'node:path';
8
- import { homedir } from 'node:os';
9
-
10
- export interface NodeIdentity {
11
- peerId: string; // hex-encoded public key hash (first 16 chars)
12
- publicKey: Buffer;
13
- secretKey: Buffer;
14
- displayName: string;
15
- createdAt: string;
16
- }
17
-
18
- const IDENTITY_DIR = join(homedir(), '.stellavault', 'federation');
19
- const IDENTITY_FILE = join(IDENTITY_DIR, 'identity.json');
20
-
21
- export function getOrCreateIdentity(displayName?: string): NodeIdentity {
22
- if (existsSync(IDENTITY_FILE)) {
23
- const raw = JSON.parse(readFileSync(IDENTITY_FILE, 'utf-8'));
24
- return {
25
- peerId: raw.peerId,
26
- publicKey: Buffer.from(raw.publicKey, 'hex'),
27
- secretKey: Buffer.from(raw.secretKey, 'hex'),
28
- displayName: raw.displayName,
29
- createdAt: raw.createdAt,
30
- };
31
- }
32
-
33
- const secretKey = randomBytes(32);
34
- const publicKey = createHash('sha256').update(secretKey).digest();
35
- const peerId = createHash('sha256').update(publicKey).digest('hex').slice(0, 16);
36
-
37
- const identity: NodeIdentity = {
38
- peerId,
39
- publicKey,
40
- secretKey,
41
- displayName: displayName ?? `node-${peerId.slice(0, 6)}`,
42
- createdAt: new Date().toISOString(),
43
- };
44
-
45
- mkdirSync(IDENTITY_DIR, { recursive: true });
46
- const content = JSON.stringify({
47
- peerId: identity.peerId,
48
- publicKey: publicKey.toString('hex'),
49
- secretKey: secretKey.toString('hex'),
50
- displayName: identity.displayName,
51
- createdAt: identity.createdAt,
52
- }, null, 2);
53
-
54
- writeFileSync(IDENTITY_FILE, content, { encoding: 'utf-8', mode: 0o600 });
55
- try { chmodSync(IDENTITY_FILE, 0o600); } catch { /* Windows may not support */ }
56
-
57
- return identity;
58
- }
59
-
60
- // CRIT-01 fix: 실제 HMAC-SHA256 서명
61
- export function signMessage(secretKey: Buffer, message: Buffer): Buffer {
62
- return createHmac('sha256', secretKey).update(message).digest();
63
- }
64
-
65
- // CRIT-01 fix: 실제 HMAC-SHA256 검증
66
- export function verifySignature(publicKey: Buffer, secretKey: Buffer, message: Buffer, signature: Buffer): boolean {
67
- const expected = createHmac('sha256', secretKey).update(message).digest();
68
- if (expected.length !== signature.length) return false;
69
- // Timing-safe comparison
70
- let diff = 0;
71
- for (let i = 0; i < expected.length; i++) {
72
- diff |= expected[i] ^ signature[i];
73
- }
74
- return diff === 0;
75
- }
76
-
77
- // Challenge-response 인증용 nonce 생성
78
- export function createChallenge(): Buffer {
79
- return randomBytes(32);
80
- }
81
-
82
- // Challenge에 대한 응답 생성
83
- export function respondToChallenge(secretKey: Buffer, challenge: Buffer): Buffer {
84
- return signMessage(secretKey, challenge);
85
- }
86
-
87
- // Challenge 응답 검증
88
- export function verifyChallenge(secretKey: Buffer, challenge: Buffer, response: Buffer): boolean {
89
- return verifySignature(Buffer.alloc(0), secretKey, challenge, response);
90
- }