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
@@ -1,131 +0,0 @@
1
- // source/type 필터 — ClusterFilter 패턴 재활용
2
-
3
- import { useState, useMemo } from 'react';
4
- import { useGraphStore } from '../stores/graph-store.js';
5
-
6
- const TYPE_ICONS: Record<string, string> = {
7
- note: '📝', clip: '📎', sync: '🔄', bridge: '🌉',
8
- decision: '⚖️', snapshot: '📸',
9
- };
10
-
11
- const SOURCE_COLORS: Record<string, string> = {
12
- local: '#10b981', notion: '#3b82f6', clip: '#f59e0b',
13
- bridge: '#8b5cf6', pack: '#ec4899',
14
- };
15
-
16
- export function TypeFilter() {
17
- const nodes = useGraphStore((s) => s.nodes);
18
- const hiddenTypes = useGraphStore((s) => s.hiddenTypes);
19
- const toggleHiddenType = useGraphStore((s) => s.toggleHiddenType);
20
- const theme = useGraphStore((s) => s.theme);
21
- const isDark = theme === 'dark';
22
- const [open, setOpen] = useState(false);
23
-
24
- // source와 type별 노드 수 집계
25
- const { typeCounts, sourceCounts } = useMemo(() => {
26
- const tc = new Map<string, number>();
27
- const sc = new Map<string, number>();
28
- for (const n of nodes) {
29
- const t = n.type ?? 'note';
30
- const s = n.source ?? 'local';
31
- tc.set(t, (tc.get(t) ?? 0) + 1);
32
- sc.set(s, (sc.get(s) ?? 0) + 1);
33
- }
34
- return {
35
- typeCounts: [...tc.entries()].sort((a, b) => b[1] - a[1]),
36
- sourceCounts: [...sc.entries()].sort((a, b) => b[1] - a[1]),
37
- };
38
- }, [nodes]);
39
-
40
- const totalTypes = typeCounts.length + sourceCounts.length;
41
- if (totalTypes <= 1 && sourceCounts.length <= 1) return null;
42
-
43
- const activeFilters = hiddenTypes.size;
44
-
45
- return (
46
- <div style={{ position: 'relative' }}>
47
- <button
48
- onClick={() => setOpen(!open)}
49
- style={{
50
- padding: '4px 10px', fontSize: '11px',
51
- border: `1px solid ${isDark ? 'rgba(100,120,255,0.15)' : 'rgba(0,0,0,0.12)'}`,
52
- borderRadius: '4px', cursor: 'pointer',
53
- background: open
54
- ? (isDark ? 'rgba(100,120,255,0.2)' : 'rgba(0,0,0,0.08)')
55
- : (isDark ? 'rgba(100,120,255,0.06)' : 'rgba(0,0,0,0.03)'),
56
- color: isDark ? '#aab' : '#555',
57
- }}
58
- >
59
- Types {activeFilters > 0 ? `(-${activeFilters})` : ''}
60
- </button>
61
-
62
- {open && (
63
- <div style={{
64
- position: 'absolute', top: '100%', right: 0, marginTop: '6px',
65
- background: isDark ? 'rgba(10,10,20,0.95)' : 'rgba(255,255,255,0.97)',
66
- border: `1px solid ${isDark ? 'rgba(100,120,255,0.15)' : 'rgba(0,0,0,0.1)'}`,
67
- borderRadius: '8px', padding: '8px', minWidth: '200px',
68
- backdropFilter: 'blur(8px)', zIndex: 100,
69
- boxShadow: isDark ? 'none' : '0 4px 16px rgba(0,0,0,0.08)',
70
- }}>
71
- {/* Source section */}
72
- <div style={{ fontSize: '9px', color: isDark ? '#667' : '#999', padding: '2px 6px', textTransform: 'uppercase', letterSpacing: '0.5px' }}>
73
- Source
74
- </div>
75
- {sourceCounts.map(([source, count]) => {
76
- const key = `source:${source}`;
77
- const hidden = hiddenTypes.has(key);
78
- return (
79
- <label key={key} style={{
80
- display: 'flex', alignItems: 'center', gap: '8px',
81
- padding: '4px 6px', borderRadius: '4px', cursor: 'pointer',
82
- opacity: hidden ? 0.3 : 1,
83
- fontSize: '11px', color: isDark ? '#aab' : '#444',
84
- }}>
85
- <div style={{
86
- width: '10px', height: '10px', borderRadius: '50%',
87
- background: hidden ? '#333' : (SOURCE_COLORS[source] ?? '#666'),
88
- flexShrink: 0,
89
- }} />
90
- <span style={{ flex: 1 }}>{source}</span>
91
- <span style={{ color: '#556', fontSize: '10px' }}>{count}</span>
92
- <input
93
- type="checkbox"
94
- checked={!hidden}
95
- onChange={() => toggleHiddenType(key)}
96
- style={{ accentColor: SOURCE_COLORS[source] ?? '#666' }}
97
- />
98
- </label>
99
- );
100
- })}
101
-
102
- {/* Type section */}
103
- <div style={{ fontSize: '9px', color: isDark ? '#667' : '#999', padding: '6px 6px 2px', textTransform: 'uppercase', letterSpacing: '0.5px', borderTop: `1px solid ${isDark ? 'rgba(100,120,255,0.08)' : 'rgba(0,0,0,0.06)'}`, marginTop: '4px' }}>
104
- Type
105
- </div>
106
- {typeCounts.map(([type, count]) => {
107
- const key = `type:${type}`;
108
- const hidden = hiddenTypes.has(key);
109
- return (
110
- <label key={key} style={{
111
- display: 'flex', alignItems: 'center', gap: '8px',
112
- padding: '4px 6px', borderRadius: '4px', cursor: 'pointer',
113
- opacity: hidden ? 0.3 : 1,
114
- fontSize: '11px', color: isDark ? '#aab' : '#444',
115
- }}>
116
- <span style={{ fontSize: '12px', flexShrink: 0 }}>{TYPE_ICONS[type] ?? '📄'}</span>
117
- <span style={{ flex: 1 }}>{type}</span>
118
- <span style={{ color: '#556', fontSize: '10px' }}>{count}</span>
119
- <input
120
- type="checkbox"
121
- checked={!hidden}
122
- onChange={() => toggleHiddenType(key)}
123
- />
124
- </label>
125
- );
126
- })}
127
- </div>
128
- )}
129
- </div>
130
- );
131
- }
@@ -1,144 +0,0 @@
1
- // Embeddable 3D mini-graph widget (F-A08)
2
- // Lightweight version for iframe embedding
3
-
4
- import { useEffect, useRef, useMemo } from 'react';
5
- import { Canvas, useFrame } from '@react-three/fiber';
6
- import { OrbitControls } from '@react-three/drei';
7
- import * as THREE from 'three';
8
-
9
- interface EmbedNode {
10
- id: string;
11
- label: string;
12
- clusterId: number;
13
- position: [number, number, number];
14
- size: number;
15
- }
16
-
17
- interface EmbedEdge {
18
- source: string;
19
- target: string;
20
- weight: number;
21
- }
22
-
23
- interface EmbedData {
24
- nodes: EmbedNode[];
25
- edges: EmbedEdge[];
26
- title?: string;
27
- }
28
-
29
- const PALETTE = [
30
- [0.49, 0.23, 0.93], [0.93, 0.27, 0.60], [0.96, 0.62, 0.04],
31
- [0.06, 0.72, 0.51], [0.23, 0.51, 0.96], [0.94, 0.27, 0.27],
32
- [0.02, 0.71, 0.83], [0.52, 0.80, 0.09], [0.98, 0.57, 0.09],
33
- [0.55, 0.36, 0.96],
34
- ] as number[][];
35
-
36
- function EmbedNodes({ nodes }: { nodes: EmbedNode[] }) {
37
- const ref = useRef<THREE.Points>(null);
38
-
39
- const { positions, colors, sizes } = useMemo(() => {
40
- const n = nodes.length;
41
- const pos = new Float32Array(n * 3);
42
- const col = new Float32Array(n * 3);
43
- const sz = new Float32Array(n);
44
-
45
- for (let i = 0; i < n; i++) {
46
- const node = nodes[i];
47
- pos[i * 3] = node.position[0];
48
- pos[i * 3 + 1] = node.position[1];
49
- pos[i * 3 + 2] = node.position[2];
50
-
51
- const pal = PALETTE[node.clusterId % PALETTE.length];
52
- col[i * 3] = pal[0];
53
- col[i * 3 + 1] = pal[1];
54
- col[i * 3 + 2] = pal[2];
55
-
56
- sz[i] = 3 + node.size * 3;
57
- }
58
- return { positions: pos, colors: col, sizes: sz };
59
- }, [nodes]);
60
-
61
- return (
62
- <points ref={ref}>
63
- <bufferGeometry>
64
- <bufferAttribute attach="attributes-position" args={[positions, 3]} />
65
- <bufferAttribute attach="attributes-color" args={[colors, 3]} />
66
- <bufferAttribute attach="attributes-size" args={[sizes, 1]} />
67
- </bufferGeometry>
68
- <pointsMaterial vertexColors transparent opacity={0.9} depthWrite={false} sizeAttenuation size={6} />
69
- </points>
70
- );
71
- }
72
-
73
- function EmbedEdges({ nodes, edges }: { nodes: EmbedNode[]; edges: EmbedEdge[] }) {
74
- const nodeMap = useMemo(() => new Map(nodes.map(n => [n.id, n])), [nodes]);
75
-
76
- const positions = useMemo(() => {
77
- const pos: number[] = [];
78
- for (const e of edges) {
79
- const s = nodeMap.get(e.source);
80
- const t = nodeMap.get(e.target);
81
- if (s && t) {
82
- pos.push(...s.position, ...t.position);
83
- }
84
- }
85
- return new Float32Array(pos);
86
- }, [edges, nodeMap]);
87
-
88
- return (
89
- <lineSegments>
90
- <bufferGeometry>
91
- <bufferAttribute attach="attributes-position" args={[positions, 3]} />
92
- </bufferGeometry>
93
- <lineBasicMaterial color="#6366f1" transparent opacity={0.15} />
94
- </lineSegments>
95
- );
96
- }
97
-
98
- function AutoRotate() {
99
- useFrame(({ camera }) => {
100
- camera.position.applyAxisAngle(new THREE.Vector3(0, 1, 0), 0.002);
101
- });
102
- return null;
103
- }
104
-
105
- function Scene({ data, interactive }: { data: EmbedData; interactive: boolean }) {
106
- return (
107
- <>
108
- <ambientLight intensity={0.5} />
109
- <EmbedNodes nodes={data.nodes} />
110
- <EmbedEdges nodes={data.nodes} edges={data.edges} />
111
- {interactive ? (
112
- <OrbitControls enablePan={false} enableZoom={true} autoRotate autoRotateSpeed={0.5} />
113
- ) : (
114
- <AutoRotate />
115
- )}
116
- </>
117
- );
118
- }
119
-
120
- export function EmbedGraph({ data, interactive = true, theme = 'dark' }: {
121
- data: EmbedData;
122
- interactive?: boolean;
123
- theme?: 'dark' | 'light';
124
- }) {
125
- const bg = theme === 'dark' ? '#050510' : '#f0f2f8';
126
-
127
- return (
128
- <div style={{ width: '100%', height: '100%', position: 'relative', background: bg }}>
129
- <Canvas camera={{ position: [0, 0, 500], fov: 50 }}>
130
- <color attach="background" args={[bg]} />
131
- <Scene data={data} interactive={interactive} />
132
- </Canvas>
133
- {data.title && (
134
- <div style={{
135
- position: 'absolute', bottom: '8px', left: '8px',
136
- fontSize: '10px', color: theme === 'dark' ? '#556' : '#999',
137
- fontFamily: 'system-ui, sans-serif',
138
- }}>
139
- {data.title} — stellavault
140
- </div>
141
- )}
142
- </div>
143
- );
144
- }
@@ -1,76 +0,0 @@
1
- // Design Ref: §5.2 — 카메라 거리 기반 LOD 레벨 결정
2
- // Plan SC: SC-03 (줌 3단계 부드러운 전환)
3
-
4
- import { useRef } from 'react';
5
- import { useFrame } from '@react-three/fiber';
6
- import { useGraphStore } from '../stores/graph-store.js';
7
-
8
- const LOD_THRESHOLDS = {
9
- UNIVERSE_MIN: 800,
10
- NOTE_MAX: 300,
11
- LERP_SPEED: 0.05,
12
- } as const;
13
-
14
- export interface LODState {
15
- lodLevel: 'universe' | 'constellation' | 'note';
16
- constellationOpacity: number; // 0~1
17
- edgeOpacity: number; // 0~1
18
- nodeScale: number; // 1~3
19
- }
20
-
21
- export function useConstellationLOD(): LODState {
22
- const setLodLevel = useGraphStore((s) => s.setLodLevel);
23
- const opacityRef = useRef(0.5);
24
- const edgeOpRef = useRef(0.5);
25
- const scaleRef = useRef(2);
26
- const currentLevelRef = useRef<'universe' | 'constellation' | 'note'>('constellation');
27
-
28
- useFrame(({ camera }) => {
29
- const dist = camera.position.length();
30
-
31
- // Determine target LOD level
32
- let targetLevel: 'universe' | 'constellation' | 'note';
33
- let targetConstellationOp: number;
34
- let targetEdgeOp: number;
35
- let targetScale: number;
36
-
37
- if (dist > LOD_THRESHOLDS.UNIVERSE_MIN) {
38
- targetLevel = 'universe';
39
- targetConstellationOp = 1;
40
- targetEdgeOp = 0;
41
- targetScale = 1;
42
- } else if (dist < LOD_THRESHOLDS.NOTE_MAX) {
43
- targetLevel = 'note';
44
- targetConstellationOp = 0;
45
- targetEdgeOp = 1;
46
- targetScale = 3;
47
- } else {
48
- targetLevel = 'constellation';
49
- // Interpolate within constellation range (300~800)
50
- const t = (dist - LOD_THRESHOLDS.NOTE_MAX) /
51
- (LOD_THRESHOLDS.UNIVERSE_MIN - LOD_THRESHOLDS.NOTE_MAX);
52
- targetConstellationOp = t;
53
- targetEdgeOp = 1 - t * 0.5; // edges fade partially at distance
54
- targetScale = 1 + (1 - t) * 2; // 1 at far, 3 at close
55
- }
56
-
57
- // Lerp for smooth transitions
58
- const speed = LOD_THRESHOLDS.LERP_SPEED;
59
- opacityRef.current += (targetConstellationOp - opacityRef.current) * speed;
60
- edgeOpRef.current += (targetEdgeOp - edgeOpRef.current) * speed;
61
- scaleRef.current += (targetScale - scaleRef.current) * speed;
62
-
63
- // Update store only when level actually changes
64
- if (targetLevel !== currentLevelRef.current) {
65
- currentLevelRef.current = targetLevel;
66
- setLodLevel(targetLevel);
67
- }
68
- });
69
-
70
- return {
71
- lodLevel: currentLevelRef.current,
72
- constellationOpacity: opacityRef.current,
73
- edgeOpacity: edgeOpRef.current,
74
- nodeScale: scaleRef.current,
75
- };
76
- }
@@ -1,37 +0,0 @@
1
- // Design Ref: §5 — 감쇠 데이터 로딩 훅
2
-
3
- import { useEffect, useRef } from 'react';
4
- import { useGraphStore } from '../stores/graph-store.js';
5
-
6
- export interface DecayData {
7
- [documentId: string]: number; // retrievability 0~1
8
- }
9
-
10
- export function useDecay() {
11
- const showDecay = useGraphStore((s) => s.showDecayOverlay);
12
- const dataRef = useRef<DecayData>({});
13
- const loadedRef = useRef(false);
14
-
15
- useEffect(() => {
16
- if (!showDecay || loadedRef.current) return;
17
-
18
- fetch('http://127.0.0.1:3333/api/decay')
19
- .then(r => r.json())
20
- .then(report => {
21
- if (!report.topDecaying) return;
22
- // Build map from all decaying notes
23
- const map: DecayData = {};
24
- // Default R=1 for all, then override with actual values
25
- for (const d of report.topDecaying) {
26
- map[d.documentId] = d.retrievability;
27
- }
28
- dataRef.current = map;
29
- loadedRef.current = true;
30
- // Force re-render
31
- useGraphStore.getState().setDecayData(map);
32
- })
33
- .catch(() => {});
34
- }, [showDecay]);
35
-
36
- return dataRef.current;
37
- }
@@ -1,165 +0,0 @@
1
- // Design Ref: §5.1 — 스크린샷/녹화 로직
2
- // Plan SC: SC-01 (PNG 캡처), SC-02 (WebM 녹화)
3
-
4
- import { useRef, useState, useCallback } from 'react';
5
- import { useGraphStore } from '../stores/graph-store.js';
6
- import {
7
- generateFilename,
8
- downloadBlob,
9
- addWatermark,
10
- canvasToBlob,
11
- isMediaRecorderSupported,
12
- } from '../lib/export-utils.js';
13
-
14
- export interface ScreenshotOptions {
15
- watermark?: boolean;
16
- width?: number; // default: canvas width (max 4096)
17
- height?: number; // default: canvas height (max 4096)
18
- }
19
-
20
- export interface RecordingOptions {
21
- duration?: number; // seconds, default 5
22
- rotation?: boolean; // auto-rotate, default true
23
- }
24
-
25
- export function useExport() {
26
- const recorderRef = useRef<MediaRecorder | null>(null);
27
- const chunksRef = useRef<Blob[]>([]);
28
- const timerRef = useRef<number | null>(null);
29
- const [recordingDuration, setRecordingDuration] = useState(0);
30
- const startTimeRef = useRef<number>(0);
31
- const animFrameRef = useRef<number>(0);
32
-
33
- const getCanvas = useCallback((): HTMLCanvasElement | null => {
34
- return document.querySelector('canvas');
35
- }, []);
36
-
37
- const takeScreenshot = useCallback(async (options: ScreenshotOptions = {}) => {
38
- const canvas = getCanvas();
39
- if (!canvas) return;
40
-
41
- const store = useGraphStore.getState();
42
- store.setExporting(true);
43
-
44
- try {
45
- // High-res capture: resize canvas temporarily if requested
46
- const targetW = Math.min(options.width ?? canvas.width, 4096);
47
- const targetH = Math.min(options.height ?? canvas.height, 4096);
48
- const origW = canvas.width;
49
- const origH = canvas.height;
50
- const needsResize = targetW !== origW || targetH !== origH;
51
-
52
- if (needsResize) {
53
- canvas.width = targetW;
54
- canvas.height = targetH;
55
- canvas.style.width = origW + 'px';
56
- canvas.style.height = origH + 'px';
57
- // Force one frame render at new resolution
58
- await new Promise(r => requestAnimationFrame(() => requestAnimationFrame(r)));
59
- }
60
-
61
- const offscreen = document.createElement('canvas');
62
- offscreen.width = canvas.width;
63
- offscreen.height = canvas.height;
64
- const ctx = offscreen.getContext('2d');
65
- if (!ctx) return;
66
-
67
- ctx.drawImage(canvas, 0, 0);
68
-
69
- if (needsResize) {
70
- canvas.width = origW;
71
- canvas.height = origH;
72
- canvas.style.width = '';
73
- canvas.style.height = '';
74
- }
75
-
76
- if (options.watermark !== false) {
77
- addWatermark(offscreen, 'Stellavault');
78
- }
79
-
80
- const blob = await canvasToBlob(offscreen);
81
- downloadBlob(blob, generateFilename('screenshot', 'png'));
82
- } catch (err) {
83
- console.error('Screenshot failed:', err);
84
- } finally {
85
- store.setExporting(false);
86
- }
87
- }, [getCanvas]);
88
-
89
- const startRecording = useCallback((options: RecordingOptions = {}) => {
90
- const canvas = getCanvas();
91
- if (!canvas || !isMediaRecorderSupported()) {
92
- console.error('WebM recording is not supported in this browser');
93
- return;
94
- }
95
-
96
- const store = useGraphStore.getState();
97
- const duration = options.duration ?? 5;
98
- const rotation = options.rotation ?? true;
99
-
100
- // Start auto-rotation if requested
101
- if (rotation) {
102
- const controls = (window as any).__sv_controls?.current;
103
- if (controls) {
104
- (window as any).__sv_autoRotate = true;
105
- }
106
- }
107
-
108
- const stream = canvas.captureStream(60);
109
- const recorder = new MediaRecorder(stream, {
110
- mimeType: 'video/webm;codecs=vp9',
111
- videoBitsPerSecond: 8_000_000,
112
- });
113
-
114
- chunksRef.current = [];
115
- recorder.ondataavailable = (e) => {
116
- if (e.data.size > 0) chunksRef.current.push(e.data);
117
- };
118
-
119
- recorder.onstop = () => {
120
- const blob = new Blob(chunksRef.current, { type: 'video/webm' });
121
- downloadBlob(blob, generateFilename('recording', 'webm'));
122
- chunksRef.current = [];
123
- store.setRecording(false);
124
- (window as any).__sv_autoRotate = false;
125
-
126
- if (timerRef.current) cancelAnimationFrame(timerRef.current);
127
- setRecordingDuration(0);
128
- };
129
-
130
- recorderRef.current = recorder;
131
- recorder.start();
132
- store.setRecording(true);
133
- startTimeRef.current = performance.now();
134
-
135
- // Duration timer with RAF
136
- function updateTimer() {
137
- const elapsed = (performance.now() - startTimeRef.current) / 1000;
138
- setRecordingDuration(elapsed);
139
- if (elapsed >= duration) {
140
- stopRecording();
141
- return;
142
- }
143
- timerRef.current = requestAnimationFrame(updateTimer);
144
- }
145
- timerRef.current = requestAnimationFrame(updateTimer);
146
- }, [getCanvas]);
147
-
148
- const stopRecording = useCallback(() => {
149
- if (recorderRef.current && recorderRef.current.state === 'recording') {
150
- recorderRef.current.stop();
151
- }
152
- if (timerRef.current) {
153
- cancelAnimationFrame(timerRef.current);
154
- timerRef.current = null;
155
- }
156
- }, []);
157
-
158
- return {
159
- takeScreenshot,
160
- startRecording,
161
- stopRecording,
162
- recordingDuration,
163
- isMediaRecorderSupported: isMediaRecorderSupported(),
164
- };
165
- }
@@ -1,69 +0,0 @@
1
- // 그래프 데이터 로딩 — mode 전환 시 위치 유지, 색상만 변경
2
-
3
- import { useEffect, useRef } from 'react';
4
- import { useGraphStore } from '../stores/graph-store.js';
5
-
6
- export function useGraph() {
7
- const { setGraphData, setLoading, setError } = useGraphStore();
8
- const mode = useGraphStore((s) => s.mode);
9
- const initialLoadDone = useRef(false);
10
- const savedPositions = useRef<Map<string, [number, number, number]>>(new Map());
11
-
12
- useEffect(() => {
13
- let cancelled = false;
14
-
15
- async function load() {
16
- setLoading(true);
17
- setError(null);
18
- try {
19
- const res = await fetch(`/api/graph?mode=${mode}`);
20
- if (!res.ok) throw new Error(`API error: ${res.status}`);
21
- const json: any = await res.json();
22
- if (cancelled) return;
23
- const { nodes, edges, clusters } = json.data;
24
-
25
- let positioned;
26
- if (!initialLoadDone.current) {
27
- // 첫 로드: 랜덤 위치 (force layout이 이후 정리)
28
- positioned = nodes.map((n: any) => {
29
- const pos: [number, number, number] = [
30
- (Math.random() - 0.5) * 500,
31
- (Math.random() - 0.5) * 500,
32
- (Math.random() - 0.5) * 500,
33
- ];
34
- savedPositions.current.set(n.id, pos);
35
- return { ...n, position: pos };
36
- });
37
- initialLoadDone.current = true;
38
- } else {
39
- // 모드 전환: 기존 위치 유지, clusterId만 변경
40
- positioned = nodes.map((n: any) => ({
41
- ...n,
42
- position: savedPositions.current.get(n.id) ?? [
43
- (Math.random() - 0.5) * 500,
44
- (Math.random() - 0.5) * 500,
45
- (Math.random() - 0.5) * 500,
46
- ],
47
- }));
48
- }
49
-
50
- setGraphData(positioned, edges, clusters);
51
- } catch (err) {
52
- if (!cancelled) setError(String(err));
53
- } finally {
54
- if (!cancelled) setLoading(false);
55
- }
56
- }
57
-
58
- load();
59
- return () => { cancelled = true; };
60
- }, [mode, setGraphData, setLoading, setError]);
61
-
62
- // force layout이 위치를 업데이트할 때마다 저장
63
- const nodes = useGraphStore((s) => s.nodes);
64
- useEffect(() => {
65
- for (const n of nodes) {
66
- if (n.position) savedPositions.current.set(n.id, n.position);
67
- }
68
- }, [nodes]);
69
- }