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.
- package/package.json +1 -1
- package/packages/core/dist/api/dashboard.d.ts +3 -0
- package/packages/core/{src/api/dashboard.ts → dist/api/dashboard.js} +8 -11
- package/packages/core/dist/api/graph-data.d.ts +11 -0
- package/packages/core/dist/api/graph-data.js +255 -0
- package/packages/core/dist/api/pwa.d.ts +3 -0
- package/packages/core/{src/api/pwa.ts → dist/api/pwa.js} +27 -32
- package/packages/core/dist/api/server.d.ts +16 -0
- package/packages/core/dist/api/server.js +718 -0
- package/packages/core/dist/capture/voice.d.ts +24 -0
- package/packages/core/dist/capture/voice.js +135 -0
- package/packages/core/{src/cloud/index.ts → dist/cloud/index.d.ts} +1 -0
- package/packages/core/dist/cloud/index.js +2 -0
- package/packages/core/dist/cloud/sync.d.ts +29 -0
- package/packages/core/dist/cloud/sync.js +137 -0
- package/packages/core/dist/config.d.ts +27 -0
- package/packages/core/dist/config.js +55 -0
- package/packages/core/dist/federation/credits.d.ts +26 -0
- package/packages/core/dist/federation/credits.js +56 -0
- package/packages/core/dist/federation/identity.d.ts +14 -0
- package/packages/core/dist/federation/identity.js +74 -0
- package/packages/core/{src/federation/index.ts → dist/federation/index.d.ts} +1 -2
- package/packages/core/dist/federation/index.js +5 -0
- package/packages/core/dist/federation/node.d.ts +31 -0
- package/packages/core/dist/federation/node.js +216 -0
- package/packages/core/dist/federation/privacy.d.ts +8 -0
- package/packages/core/dist/federation/privacy.js +40 -0
- package/packages/core/dist/federation/reputation.d.ts +37 -0
- package/packages/core/dist/federation/reputation.js +139 -0
- package/packages/core/dist/federation/search.d.ts +19 -0
- package/packages/core/dist/federation/search.js +101 -0
- package/packages/core/dist/federation/sharing.d.ts +72 -0
- package/packages/core/dist/federation/sharing.js +246 -0
- package/packages/core/dist/federation/trust.d.ts +15 -0
- package/packages/core/dist/federation/trust.js +60 -0
- package/packages/core/dist/federation/types.d.ts +40 -0
- package/packages/core/dist/federation/types.js +3 -0
- package/packages/core/dist/i18n/index.d.ts +6 -0
- package/packages/core/dist/i18n/index.js +81 -0
- package/packages/core/{src/index.ts → dist/index.d.ts} +46 -65
- package/packages/core/dist/index.js +69 -0
- package/packages/core/dist/indexer/chunker.d.ts +14 -0
- package/packages/core/dist/indexer/chunker.js +148 -0
- package/packages/core/dist/indexer/embedder.d.ts +8 -0
- package/packages/core/dist/indexer/embedder.js +3 -0
- package/packages/core/dist/indexer/index.d.ts +28 -0
- package/packages/core/dist/indexer/index.js +74 -0
- package/packages/core/dist/indexer/local-embedder.d.ts +3 -0
- package/packages/core/dist/indexer/local-embedder.js +29 -0
- package/packages/core/dist/indexer/scanner.d.ts +11 -0
- package/packages/core/dist/indexer/scanner.js +137 -0
- package/packages/core/dist/indexer/watcher.d.ts +19 -0
- package/packages/core/dist/indexer/watcher.js +49 -0
- package/packages/core/dist/intelligence/code-linker.d.ts +20 -0
- package/packages/core/dist/intelligence/code-linker.js +88 -0
- package/packages/core/dist/intelligence/contradiction-detector.d.ts +20 -0
- package/packages/core/dist/intelligence/contradiction-detector.js +115 -0
- package/packages/core/dist/intelligence/decay-engine.d.ts +27 -0
- package/packages/core/dist/intelligence/decay-engine.js +190 -0
- package/packages/core/dist/intelligence/duplicate-detector.d.ts +20 -0
- package/packages/core/dist/intelligence/duplicate-detector.js +55 -0
- package/packages/core/dist/intelligence/fsrs.d.ts +43 -0
- package/packages/core/dist/intelligence/fsrs.js +70 -0
- package/packages/core/dist/intelligence/gap-detector.d.ts +25 -0
- package/packages/core/dist/intelligence/gap-detector.js +78 -0
- package/packages/core/dist/intelligence/learning-path.d.ts +31 -0
- package/packages/core/dist/intelligence/learning-path.js +53 -0
- package/packages/core/dist/intelligence/notifications.d.ts +31 -0
- package/packages/core/dist/intelligence/notifications.js +65 -0
- package/packages/core/dist/intelligence/predictive-gaps.d.ts +14 -0
- package/packages/core/dist/intelligence/predictive-gaps.js +74 -0
- package/packages/core/dist/intelligence/semantic-versioning.d.ts +37 -0
- package/packages/core/dist/intelligence/semantic-versioning.js +68 -0
- package/packages/core/dist/intelligence/types.d.ts +28 -0
- package/packages/core/dist/intelligence/types.js +3 -0
- package/packages/core/dist/mcp/custom-tools.d.ts +29 -0
- package/packages/core/dist/mcp/custom-tools.js +70 -0
- package/packages/core/{src/mcp/index.ts → dist/mcp/index.d.ts} +1 -0
- package/packages/core/dist/mcp/index.js +2 -0
- package/packages/core/dist/mcp/server.d.ts +49 -0
- package/packages/core/dist/mcp/server.js +151 -0
- package/packages/core/dist/mcp/tools/agentic-graph.d.ts +87 -0
- package/packages/core/dist/mcp/tools/agentic-graph.js +88 -0
- package/packages/core/dist/mcp/tools/brief.d.ts +31 -0
- package/packages/core/dist/mcp/tools/brief.js +39 -0
- package/packages/core/dist/mcp/tools/decay.d.ts +33 -0
- package/packages/core/dist/mcp/tools/decay.js +32 -0
- package/packages/core/dist/mcp/tools/decision-journal.d.ts +78 -0
- package/packages/core/dist/mcp/tools/decision-journal.js +79 -0
- package/packages/core/dist/mcp/tools/detect-gaps.d.ts +24 -0
- package/packages/core/dist/mcp/tools/detect-gaps.js +47 -0
- package/packages/core/dist/mcp/tools/export.d.ts +29 -0
- package/packages/core/dist/mcp/tools/export.js +60 -0
- package/packages/core/dist/mcp/tools/federated-search.d.ts +29 -0
- package/packages/core/dist/mcp/tools/federated-search.js +36 -0
- package/packages/core/dist/mcp/tools/generate-claude-md.d.ts +35 -0
- package/packages/core/dist/mcp/tools/generate-claude-md.js +107 -0
- package/packages/core/dist/mcp/tools/get-document.d.ts +35 -0
- package/packages/core/dist/mcp/tools/get-document.js +25 -0
- package/packages/core/dist/mcp/tools/get-evolution.d.ts +28 -0
- package/packages/core/dist/mcp/tools/get-evolution.js +70 -0
- package/packages/core/dist/mcp/tools/get-related.d.ts +32 -0
- package/packages/core/dist/mcp/tools/get-related.js +33 -0
- package/packages/core/dist/mcp/tools/learning-path.d.ts +23 -0
- package/packages/core/dist/mcp/tools/learning-path.js +45 -0
- package/packages/core/dist/mcp/tools/link-code.d.ts +34 -0
- package/packages/core/dist/mcp/tools/link-code.js +44 -0
- package/packages/core/dist/mcp/tools/list-topics.d.ts +15 -0
- package/packages/core/dist/mcp/tools/list-topics.js +18 -0
- package/packages/core/dist/mcp/tools/search.d.ts +39 -0
- package/packages/core/dist/mcp/tools/search.js +29 -0
- package/packages/core/dist/mcp/tools/snapshot.d.ts +47 -0
- package/packages/core/dist/mcp/tools/snapshot.js +84 -0
- package/packages/core/dist/multi-vault/index.d.ts +26 -0
- package/packages/core/dist/multi-vault/index.js +80 -0
- package/packages/core/dist/pack/creator.d.ts +21 -0
- package/packages/core/dist/pack/creator.js +105 -0
- package/packages/core/dist/pack/exporter.d.ts +4 -0
- package/packages/core/dist/pack/exporter.js +18 -0
- package/packages/core/dist/pack/importer.d.ts +10 -0
- package/packages/core/dist/pack/importer.js +55 -0
- package/packages/core/{src/pack/index.ts → dist/pack/index.d.ts} +1 -0
- package/packages/core/dist/pack/index.js +5 -0
- package/packages/core/dist/pack/marketplace.d.ts +14 -0
- package/packages/core/dist/pack/marketplace.js +90 -0
- package/packages/core/dist/pack/pii-masker.d.ts +7 -0
- package/packages/core/dist/pack/pii-masker.js +29 -0
- package/packages/core/dist/pack/types.d.ts +36 -0
- package/packages/core/dist/pack/types.js +3 -0
- package/packages/core/dist/plugins/index.d.ts +35 -0
- package/packages/core/dist/plugins/index.js +57 -0
- package/packages/core/dist/plugins/webhooks.d.ts +30 -0
- package/packages/core/dist/plugins/webhooks.js +79 -0
- package/packages/core/dist/search/adaptive.d.ts +16 -0
- package/packages/core/dist/search/adaptive.js +67 -0
- package/packages/core/dist/search/bm25.d.ts +4 -0
- package/packages/core/dist/search/bm25.js +10 -0
- package/packages/core/dist/search/index.d.ts +15 -0
- package/packages/core/dist/search/index.js +64 -0
- package/packages/core/dist/search/rrf.d.ts +7 -0
- package/packages/core/dist/search/rrf.js +21 -0
- package/packages/core/dist/search/semantic.d.ts +5 -0
- package/packages/core/dist/search/semantic.js +6 -0
- package/packages/core/{src/store/index.ts → dist/store/index.d.ts} +1 -0
- package/packages/core/dist/store/index.js +2 -0
- package/packages/core/dist/store/sqlite-vec.d.ts +6 -0
- package/packages/core/dist/store/sqlite-vec.js +251 -0
- package/packages/core/dist/store/types.d.ts +20 -0
- package/packages/core/dist/store/types.js +3 -0
- package/packages/core/dist/team/index.d.ts +25 -0
- package/packages/core/dist/team/index.js +97 -0
- package/packages/core/dist/types/chunk.d.ts +23 -0
- package/packages/core/dist/types/chunk.js +3 -0
- package/packages/core/dist/types/document.d.ts +23 -0
- package/packages/core/dist/types/document.js +3 -0
- package/packages/core/dist/types/graph.d.ts +39 -0
- package/packages/core/dist/types/graph.js +3 -0
- package/packages/core/dist/types/index.d.ts +5 -0
- package/packages/core/dist/types/index.js +2 -0
- package/packages/core/dist/types/search.d.ts +39 -0
- package/packages/core/dist/types/search.js +3 -0
- package/packages/core/dist/utils/retry.d.ts +25 -0
- package/packages/core/dist/utils/retry.js +59 -0
- package/.github/workflows/pages.yml +0 -37
- package/memory/MEMORY.md +0 -25
- package/packages/cli/dist/commands/brief-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/brief-cmd.js.map +0 -1
- package/packages/cli/dist/commands/capture-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/capture-cmd.js.map +0 -1
- package/packages/cli/dist/commands/card-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/card-cmd.js.map +0 -1
- package/packages/cli/dist/commands/clip-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/clip-cmd.js.map +0 -1
- package/packages/cli/dist/commands/cloud-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/cloud-cmd.js.map +0 -1
- package/packages/cli/dist/commands/contradictions-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/contradictions-cmd.js.map +0 -1
- package/packages/cli/dist/commands/decay-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/decay-cmd.js.map +0 -1
- package/packages/cli/dist/commands/digest-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/digest-cmd.js.map +0 -1
- package/packages/cli/dist/commands/duplicates-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/duplicates-cmd.js.map +0 -1
- package/packages/cli/dist/commands/federate-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/federate-cmd.js.map +0 -1
- package/packages/cli/dist/commands/gaps-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/gaps-cmd.js.map +0 -1
- package/packages/cli/dist/commands/graph-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/graph-cmd.js.map +0 -1
- package/packages/cli/dist/commands/index-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/index-cmd.js.map +0 -1
- package/packages/cli/dist/commands/init-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/init-cmd.js.map +0 -1
- package/packages/cli/dist/commands/learn-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/learn-cmd.js.map +0 -1
- package/packages/cli/dist/commands/pack-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/pack-cmd.js.map +0 -1
- package/packages/cli/dist/commands/review-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/review-cmd.js.map +0 -1
- package/packages/cli/dist/commands/search-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/search-cmd.js.map +0 -1
- package/packages/cli/dist/commands/serve-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/serve-cmd.js.map +0 -1
- package/packages/cli/dist/commands/status-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/status-cmd.js.map +0 -1
- package/packages/cli/dist/commands/sync-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/sync-cmd.js.map +0 -1
- package/packages/cli/dist/commands/vault-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/vault-cmd.js.map +0 -1
- package/packages/cli/dist/index.d.ts.map +0 -1
- package/packages/cli/dist/index.js.map +0 -1
- package/packages/cli/src/commands/brief-cmd.ts +0 -87
- package/packages/cli/src/commands/capture-cmd.ts +0 -34
- package/packages/cli/src/commands/card-cmd.ts +0 -29
- package/packages/cli/src/commands/clip-cmd.ts +0 -172
- package/packages/cli/src/commands/cloud-cmd.ts +0 -75
- package/packages/cli/src/commands/contradictions-cmd.ts +0 -41
- package/packages/cli/src/commands/decay-cmd.ts +0 -57
- package/packages/cli/src/commands/digest-cmd.ts +0 -89
- package/packages/cli/src/commands/duplicates-cmd.ts +0 -38
- package/packages/cli/src/commands/federate-cmd.ts +0 -256
- package/packages/cli/src/commands/gaps-cmd.ts +0 -40
- package/packages/cli/src/commands/graph-cmd.ts +0 -88
- package/packages/cli/src/commands/index-cmd.ts +0 -65
- package/packages/cli/src/commands/init-cmd.ts +0 -145
- package/packages/cli/src/commands/learn-cmd.ts +0 -56
- package/packages/cli/src/commands/pack-cmd.ts +0 -121
- package/packages/cli/src/commands/review-cmd.ts +0 -125
- package/packages/cli/src/commands/search-cmd.ts +0 -45
- package/packages/cli/src/commands/serve-cmd.ts +0 -17
- package/packages/cli/src/commands/status-cmd.ts +0 -37
- package/packages/cli/src/commands/sync-cmd.ts +0 -68
- package/packages/cli/src/commands/vault-cmd.ts +0 -64
- package/packages/cli/src/index.ts +0 -187
- package/packages/core/src/api/graph-data.ts +0 -286
- package/packages/core/src/api/server.ts +0 -660
- package/packages/core/src/capture/voice.ts +0 -168
- package/packages/core/src/cloud/sync.ts +0 -167
- package/packages/core/src/config.ts +0 -82
- package/packages/core/src/federation/credits.ts +0 -80
- package/packages/core/src/federation/hyperswarm.d.ts +0 -19
- package/packages/core/src/federation/identity.ts +0 -90
- package/packages/core/src/federation/node.ts +0 -235
- package/packages/core/src/federation/privacy.ts +0 -52
- package/packages/core/src/federation/reputation.ts +0 -202
- package/packages/core/src/federation/search.ts +0 -129
- package/packages/core/src/federation/sharing.ts +0 -315
- package/packages/core/src/federation/trust.ts +0 -76
- package/packages/core/src/federation/types.ts +0 -25
- package/packages/core/src/i18n/index.ts +0 -85
- package/packages/core/src/indexer/chunker.ts +0 -180
- package/packages/core/src/indexer/embedder.ts +0 -9
- package/packages/core/src/indexer/index.ts +0 -113
- package/packages/core/src/indexer/local-embedder.ts +0 -35
- package/packages/core/src/indexer/scanner.ts +0 -142
- package/packages/core/src/indexer/watcher.ts +0 -62
- package/packages/core/src/intelligence/contradiction-detector.ts +0 -134
- package/packages/core/src/intelligence/decay-engine.ts +0 -229
- package/packages/core/src/intelligence/duplicate-detector.ts +0 -71
- package/packages/core/src/intelligence/fsrs.ts +0 -79
- package/packages/core/src/intelligence/gap-detector.ts +0 -109
- package/packages/core/src/intelligence/learning-path.ts +0 -86
- package/packages/core/src/intelligence/notifications.ts +0 -106
- package/packages/core/src/intelligence/predictive-gaps.ts +0 -94
- package/packages/core/src/intelligence/semantic-versioning.ts +0 -97
- package/packages/core/src/intelligence/types.ts +0 -28
- package/packages/core/src/mcp/custom-tools.ts +0 -97
- package/packages/core/src/mcp/server.ts +0 -142
- package/packages/core/src/mcp/tools/agentic-graph.ts +0 -96
- package/packages/core/src/mcp/tools/brief.ts +0 -49
- package/packages/core/src/mcp/tools/decay.ts +0 -40
- package/packages/core/src/mcp/tools/decision-journal.ts +0 -95
- package/packages/core/src/mcp/tools/export.ts +0 -72
- package/packages/core/src/mcp/tools/federated-search.ts +0 -43
- package/packages/core/src/mcp/tools/generate-claude-md.ts +0 -130
- package/packages/core/src/mcp/tools/get-document.ts +0 -26
- package/packages/core/src/mcp/tools/get-related.ts +0 -41
- package/packages/core/src/mcp/tools/learning-path.ts +0 -52
- package/packages/core/src/mcp/tools/list-topics.ts +0 -20
- package/packages/core/src/mcp/tools/search.ts +0 -35
- package/packages/core/src/mcp/tools/snapshot.ts +0 -98
- package/packages/core/src/multi-vault/index.ts +0 -118
- package/packages/core/src/pack/creator.ts +0 -127
- package/packages/core/src/pack/exporter.ts +0 -21
- package/packages/core/src/pack/importer.ts +0 -82
- package/packages/core/src/pack/marketplace.ts +0 -103
- package/packages/core/src/pack/pii-masker.ts +0 -38
- package/packages/core/src/pack/types.ts +0 -39
- package/packages/core/src/plugins/index.ts +0 -100
- package/packages/core/src/plugins/webhooks.ts +0 -110
- package/packages/core/src/search/bm25.ts +0 -16
- package/packages/core/src/search/index.ts +0 -83
- package/packages/core/src/search/rrf.ts +0 -31
- package/packages/core/src/search/semantic.ts +0 -15
- package/packages/core/src/store/sqlite-vec.ts +0 -290
- package/packages/core/src/store/types.ts +0 -22
- package/packages/core/src/team/index.ts +0 -126
- package/packages/core/src/types/chunk.ts +0 -25
- package/packages/core/src/types/document.ts +0 -24
- package/packages/core/src/types/graph.ts +0 -44
- package/packages/core/src/types/index.ts +0 -15
- package/packages/core/src/types/search.ts +0 -38
- package/packages/core/src/utils/retry.ts +0 -85
- package/packages/core/tests/api-card.test.ts +0 -60
- package/packages/core/tests/api-routes.test.ts +0 -98
- package/packages/core/tests/bm25.test.ts +0 -87
- package/packages/core/tests/chunker.test.ts +0 -48
- package/packages/core/tests/cluster.test.ts +0 -75
- package/packages/core/tests/constellation.test.ts +0 -77
- package/packages/core/tests/export-utils.test.ts +0 -97
- package/packages/core/tests/fsrs.test.ts +0 -96
- package/packages/core/tests/gesture-detector.test.ts +0 -45
- package/packages/core/tests/graph-data.test.ts +0 -87
- package/packages/core/tests/layout.test.ts +0 -83
- package/packages/core/tests/mcp.test.ts +0 -148
- package/packages/core/tests/pack.test.ts +0 -127
- package/packages/core/tests/pii-masker.test.ts +0 -42
- package/packages/core/tests/profile-card.test.ts +0 -62
- package/packages/core/tests/rrf.test.ts +0 -29
- package/packages/core/tests/search-integration.test.ts +0 -139
- package/packages/core/tests/store.test.ts +0 -80
- package/packages/graph/click-result.png +0 -0
- package/packages/graph/dist/assets/camera_utils-BMxqtvoZ.js +0 -1
- package/packages/graph/dist/assets/hands-DXA01_mx.js +0 -18
- package/packages/graph/dist/assets/index-DMEe2diW.js +0 -4192
- package/packages/graph/dist/assets/layout.worker-DbKCEFTz.js +0 -1
- package/packages/graph/dist/index.html +0 -17
- package/packages/graph/index.html +0 -17
- package/packages/graph/package.json +0 -32
- package/packages/graph/src/App.tsx +0 -7
- package/packages/graph/src/api/client.ts +0 -39
- package/packages/graph/src/components/ClusterFilter.tsx +0 -73
- package/packages/graph/src/components/ConstellationView.tsx +0 -232
- package/packages/graph/src/components/ExportPanel.tsx +0 -177
- package/packages/graph/src/components/Graph3D.tsx +0 -230
- package/packages/graph/src/components/GraphEdges.tsx +0 -100
- package/packages/graph/src/components/GraphNodes.tsx +0 -386
- package/packages/graph/src/components/HealthDashboard.tsx +0 -173
- package/packages/graph/src/components/Layout.tsx +0 -214
- package/packages/graph/src/components/MotionOverlay.tsx +0 -81
- package/packages/graph/src/components/MotionToggle.tsx +0 -33
- package/packages/graph/src/components/MultiverseView.tsx +0 -286
- package/packages/graph/src/components/NodeDetail.tsx +0 -232
- package/packages/graph/src/components/PulseParticle.tsx +0 -232
- package/packages/graph/src/components/SearchBar.tsx +0 -107
- package/packages/graph/src/components/StarField.tsx +0 -197
- package/packages/graph/src/components/StatusBar.tsx +0 -53
- package/packages/graph/src/components/Timeline.tsx +0 -148
- package/packages/graph/src/components/ToolsPanel.tsx +0 -512
- package/packages/graph/src/components/Tooltip.tsx +0 -100
- package/packages/graph/src/components/TypeFilter.tsx +0 -131
- package/packages/graph/src/embed/EmbedGraph.tsx +0 -144
- package/packages/graph/src/hooks/useConstellationLOD.ts +0 -76
- package/packages/graph/src/hooks/useDecay.ts +0 -37
- package/packages/graph/src/hooks/useExport.ts +0 -165
- package/packages/graph/src/hooks/useGraph.ts +0 -69
- package/packages/graph/src/hooks/useKeyboardNav.ts +0 -122
- package/packages/graph/src/hooks/useLayout.ts +0 -45
- package/packages/graph/src/hooks/useMotion.ts +0 -120
- package/packages/graph/src/hooks/usePulse.ts +0 -58
- package/packages/graph/src/hooks/useSearch.ts +0 -71
- package/packages/graph/src/lib/constellation.ts +0 -107
- package/packages/graph/src/lib/export-utils.ts +0 -48
- package/packages/graph/src/lib/gesture-detector.ts +0 -123
- package/packages/graph/src/lib/layout.worker.ts +0 -153
- package/packages/graph/src/lib/motion-controller.ts +0 -83
- package/packages/graph/src/lib/profile-card.ts +0 -122
- package/packages/graph/src/main.tsx +0 -4
- package/packages/graph/src/stores/graph-store.ts +0 -155
- package/packages/graph/success.png +0 -0
- package/packages/graph/test-click.mjs +0 -49
- package/packages/graph/test-explore.mjs +0 -102
- package/packages/graph/test-final.mjs +0 -61
- package/packages/graph/test-graph.mjs +0 -139
- package/packages/graph/test-hover.mjs +0 -48
- package/packages/graph/test-pulse.mjs +0 -68
- package/packages/graph/test-screenshot.mjs +0 -56
- package/packages/graph/test-v2.mjs +0 -97
- package/packages/graph/tsconfig.tsbuildinfo +0 -1
- package/packages/graph/vite.config.ts +0 -15
- package/packages/sync/.env.example +0 -11
- package/packages/sync/.sync-state.json +0 -317
- package/packages/sync/.upload-state.json +0 -1009
- package/packages/sync/create-stella-network-notion.mjs +0 -151
- package/packages/sync/create-stellavault-project-notion.mjs +0 -322
- package/packages/sync/logs/sync-2026-03-28.log +0 -6
- package/packages/sync/logs/sync-2026-03-29.log +0 -12
- package/packages/sync/logs/sync-2026-03-30.log +0 -6
- package/packages/sync/logs/sync-2026-03-31.log +0 -6
- package/packages/sync/logs/sync-2026-04-01.log +0 -6
- package/packages/sync/logs/sync-2026-04-02.log +0 -6
- package/packages/sync/package-lock.json +0 -373
- package/packages/sync/package.json +0 -16
- package/packages/sync/run-sync.bat +0 -18
- package/packages/sync/run-sync.mjs +0 -46
- package/packages/sync/setup-scheduler.mjs +0 -119
- package/packages/sync/structured-sync.mjs +0 -187
- package/packages/sync/sync-to-obsidian.mjs +0 -264
- package/packages/sync/upload-pdca-to-notion.mjs +0 -495
- package/tsconfig.base.json +0 -18
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Pack Marketplace (F-A07) — npm registry + GitHub Releases 기반
|
|
2
|
+
// 서버 불필요: npm/GitHub를 마켓플레이스로 활용
|
|
3
|
+
// npm에서 @stellavault/pack-* 패키지 검색
|
|
4
|
+
export async function searchMarketplace(query, limit = 10) {
|
|
5
|
+
const results = [];
|
|
6
|
+
try {
|
|
7
|
+
// npm registry search
|
|
8
|
+
const safeLimit = Math.min(limit, 20); // MED: 최대 20개 제한
|
|
9
|
+
const npmUrl = `https://registry.npmjs.org/-/v1/search?text=stellavault-pack+${encodeURIComponent(query)}&size=${safeLimit}`;
|
|
10
|
+
const res = await fetch(npmUrl, { signal: AbortSignal.timeout(5000) });
|
|
11
|
+
if (res.ok) {
|
|
12
|
+
const data = await res.json();
|
|
13
|
+
for (const pkg of data.objects ?? []) {
|
|
14
|
+
results.push({
|
|
15
|
+
name: pkg.package.name,
|
|
16
|
+
version: pkg.package.version,
|
|
17
|
+
description: pkg.package.description ?? '',
|
|
18
|
+
author: pkg.package.author?.name ?? pkg.package.publisher?.username ?? 'unknown',
|
|
19
|
+
downloads: pkg.downloads?.weekly ?? 0,
|
|
20
|
+
tags: pkg.package.keywords ?? [],
|
|
21
|
+
source: 'npm',
|
|
22
|
+
installCommand: `npm install ${pkg.package.name}`,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch { /* npm search failed — continue */ }
|
|
28
|
+
try {
|
|
29
|
+
// GitHub search for stellavault-pack repos
|
|
30
|
+
const ghUrl = `https://api.github.com/search/repositories?q=stellavault-pack+${encodeURIComponent(query)}&per_page=${limit}`;
|
|
31
|
+
const res = await fetch(ghUrl, {
|
|
32
|
+
headers: { 'Accept': 'application/vnd.github.v3+json', 'User-Agent': 'stellavault-marketplace' },
|
|
33
|
+
signal: AbortSignal.timeout(5000),
|
|
34
|
+
});
|
|
35
|
+
if (res.ok) {
|
|
36
|
+
const data = await res.json();
|
|
37
|
+
for (const repo of data.items ?? []) {
|
|
38
|
+
// npm과 중복 방지
|
|
39
|
+
if (results.some(r => r.name === repo.name))
|
|
40
|
+
continue;
|
|
41
|
+
results.push({
|
|
42
|
+
name: repo.full_name,
|
|
43
|
+
version: 'latest',
|
|
44
|
+
description: repo.description ?? '',
|
|
45
|
+
author: repo.owner?.login ?? 'unknown',
|
|
46
|
+
downloads: repo.stargazers_count,
|
|
47
|
+
tags: repo.topics ?? [],
|
|
48
|
+
source: 'github',
|
|
49
|
+
installCommand: `sv pack import <(curl -sL ${repo.html_url}/releases/latest/download/pack.sv-pack)`,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch { /* GitHub search failed — continue */ }
|
|
55
|
+
return results;
|
|
56
|
+
}
|
|
57
|
+
// sv-pack 파일을 npm에 publish할 수 있도록 패키지 생성
|
|
58
|
+
export function createPackageJson(packName, description, author, version = '1.0.0') {
|
|
59
|
+
return JSON.stringify({
|
|
60
|
+
name: `stellavault-pack-${packName}`,
|
|
61
|
+
version,
|
|
62
|
+
description,
|
|
63
|
+
author,
|
|
64
|
+
license: 'CC-BY-4.0',
|
|
65
|
+
keywords: ['stellavault', 'knowledge-pack', packName],
|
|
66
|
+
files: ['*.sv-pack', 'README.md'],
|
|
67
|
+
stellavault: { type: 'knowledge-pack' },
|
|
68
|
+
}, null, 2);
|
|
69
|
+
}
|
|
70
|
+
// GitHub Release로 pack 배포용 명령어 생성
|
|
71
|
+
export function getPublishInstructions(packName) {
|
|
72
|
+
return `
|
|
73
|
+
To publish your Knowledge Pack:
|
|
74
|
+
|
|
75
|
+
Option A: npm
|
|
76
|
+
1. cd your-pack-directory/
|
|
77
|
+
2. npm init (or use: sv pack prepare ${packName})
|
|
78
|
+
3. npm publish
|
|
79
|
+
|
|
80
|
+
Option B: GitHub Release
|
|
81
|
+
1. Create a GitHub repo: stellavault-pack-${packName}
|
|
82
|
+
2. Add your .sv-pack file
|
|
83
|
+
3. Create a release with the .sv-pack as an asset
|
|
84
|
+
|
|
85
|
+
Users install with:
|
|
86
|
+
npm: sv pack install stellavault-pack-${packName}
|
|
87
|
+
GitHub: sv pack import <url-to-sv-pack-file>
|
|
88
|
+
`.trim();
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=marketplace.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Design Ref: Phase 3 FR-04 — PII 감지 + 마스킹
|
|
2
|
+
const PII_PATTERNS = [
|
|
3
|
+
{ name: 'email', regex: /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g },
|
|
4
|
+
{ name: 'api_key', regex: /(?:sk|pk|api|key|token|secret|password)[_\-a-zA-Z]*[_\-][a-zA-Z0-9]{16,}/gi },
|
|
5
|
+
{ name: 'aws_key', regex: /AKIA[0-9A-Z]{16}/g },
|
|
6
|
+
{ name: 'url_with_auth', regex: /https?:\/\/[^:]+:[^@]+@[^\s]+/g },
|
|
7
|
+
{ name: 'ip_address', regex: /\b(?:\d{1,3}\.){3}\d{1,3}\b/g },
|
|
8
|
+
{ name: 'phone', regex: /\b0\d{1,2}[-.\s]?\d{3,4}[-.\s]?\d{4}\b/g },
|
|
9
|
+
{ name: 'jwt', regex: /eyJ[a-zA-Z0-9_-]{10,}\.[a-zA-Z0-9_-]{10,}\.[a-zA-Z0-9_-]{10,}/g },
|
|
10
|
+
];
|
|
11
|
+
export function maskPII(text) {
|
|
12
|
+
let masked = text;
|
|
13
|
+
let redactedCount = 0;
|
|
14
|
+
const redactedTypes = new Set();
|
|
15
|
+
for (const { name, regex } of PII_PATTERNS) {
|
|
16
|
+
const matches = masked.match(regex);
|
|
17
|
+
if (matches) {
|
|
18
|
+
redactedCount += matches.length;
|
|
19
|
+
redactedTypes.add(name);
|
|
20
|
+
masked = masked.replace(regex, `[REDACTED:${name}]`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
masked,
|
|
25
|
+
redactedCount,
|
|
26
|
+
redactedTypes: [...redactedTypes],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=pii-masker.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface KnowledgePack {
|
|
2
|
+
name: string;
|
|
3
|
+
version: string;
|
|
4
|
+
author: string;
|
|
5
|
+
license: string;
|
|
6
|
+
description: string;
|
|
7
|
+
tags: string[];
|
|
8
|
+
embeddingModel: string;
|
|
9
|
+
embeddingDimensions: number;
|
|
10
|
+
schemaVersion: string;
|
|
11
|
+
chunks: PackChunk[];
|
|
12
|
+
createdAt: string;
|
|
13
|
+
}
|
|
14
|
+
export interface PackChunk {
|
|
15
|
+
id: string;
|
|
16
|
+
content: string;
|
|
17
|
+
heading: string;
|
|
18
|
+
embedding: number[];
|
|
19
|
+
metadata: {
|
|
20
|
+
sourceFile: string;
|
|
21
|
+
category: string;
|
|
22
|
+
language?: string;
|
|
23
|
+
framework?: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface PackInfo {
|
|
27
|
+
name: string;
|
|
28
|
+
version: string;
|
|
29
|
+
author: string;
|
|
30
|
+
license: string;
|
|
31
|
+
description: string;
|
|
32
|
+
chunkCount: number;
|
|
33
|
+
embeddingModel: string;
|
|
34
|
+
createdAt: string;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface PluginContext {
|
|
2
|
+
store: {
|
|
3
|
+
search(query: string, limit?: number): Promise<any[]>;
|
|
4
|
+
getDocument(id: string): Promise<any>;
|
|
5
|
+
getStats(): Promise<any>;
|
|
6
|
+
};
|
|
7
|
+
config: Record<string, unknown>;
|
|
8
|
+
log: (message: string) => void;
|
|
9
|
+
}
|
|
10
|
+
export type PluginEvent = 'onIndex' | 'onSearch' | 'onDecay' | 'onGapDetected' | 'onStartup' | 'onShutdown';
|
|
11
|
+
export interface PluginManifest {
|
|
12
|
+
name: string;
|
|
13
|
+
version: string;
|
|
14
|
+
description: string;
|
|
15
|
+
author?: string;
|
|
16
|
+
events: PluginEvent[];
|
|
17
|
+
}
|
|
18
|
+
export interface StellavaultPlugin {
|
|
19
|
+
manifest: PluginManifest;
|
|
20
|
+
activate(context: PluginContext): Promise<void>;
|
|
21
|
+
deactivate?(): Promise<void>;
|
|
22
|
+
onEvent?(event: PluginEvent, data: unknown): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
export declare class PluginManager {
|
|
25
|
+
private plugins;
|
|
26
|
+
private handlers;
|
|
27
|
+
private context;
|
|
28
|
+
constructor(context: PluginContext);
|
|
29
|
+
register(plugin: StellavaultPlugin): Promise<void>;
|
|
30
|
+
unregister(name: string): Promise<void>;
|
|
31
|
+
emit(event: PluginEvent, data: unknown): Promise<void>;
|
|
32
|
+
listPlugins(): PluginManifest[];
|
|
33
|
+
getPlugin(name: string): StellavaultPlugin | undefined;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Plugin SDK (F-A15) — Event-driven plugin system
|
|
2
|
+
export class PluginManager {
|
|
3
|
+
plugins = new Map();
|
|
4
|
+
handlers = new Map();
|
|
5
|
+
context;
|
|
6
|
+
constructor(context) {
|
|
7
|
+
this.context = context;
|
|
8
|
+
}
|
|
9
|
+
async register(plugin) {
|
|
10
|
+
if (this.plugins.has(plugin.manifest.name)) {
|
|
11
|
+
throw new Error(`Plugin "${plugin.manifest.name}" is already registered`);
|
|
12
|
+
}
|
|
13
|
+
this.plugins.set(plugin.manifest.name, plugin);
|
|
14
|
+
// Register event handlers (MED fix: track by plugin name for proper unregister)
|
|
15
|
+
for (const event of plugin.manifest.events) {
|
|
16
|
+
if (!this.handlers.has(event))
|
|
17
|
+
this.handlers.set(event, []);
|
|
18
|
+
if (plugin.onEvent) {
|
|
19
|
+
this.handlers.get(event).push({
|
|
20
|
+
pluginName: plugin.manifest.name,
|
|
21
|
+
handler: (data) => plugin.onEvent(event, data),
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
await plugin.activate(this.context);
|
|
26
|
+
this.context.log(`Plugin "${plugin.manifest.name}" v${plugin.manifest.version} activated`);
|
|
27
|
+
}
|
|
28
|
+
async unregister(name) {
|
|
29
|
+
const plugin = this.plugins.get(name);
|
|
30
|
+
if (!plugin)
|
|
31
|
+
return;
|
|
32
|
+
await plugin.deactivate?.();
|
|
33
|
+
this.plugins.delete(name);
|
|
34
|
+
// MED fix: properly remove handlers by plugin name
|
|
35
|
+
for (const [event, entries] of this.handlers) {
|
|
36
|
+
this.handlers.set(event, entries.filter(e => e.pluginName !== name));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async emit(event, data) {
|
|
40
|
+
const entries = this.handlers.get(event) ?? [];
|
|
41
|
+
for (const { handler } of entries) {
|
|
42
|
+
try {
|
|
43
|
+
await handler(data);
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
this.context.log(`Plugin error on ${event}: ${err instanceof Error ? err.message : String(err)}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
listPlugins() {
|
|
51
|
+
return [...this.plugins.values()].map(p => p.manifest);
|
|
52
|
+
}
|
|
53
|
+
getPlugin(name) {
|
|
54
|
+
return this.plugins.get(name);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { PluginEvent } from './index.js';
|
|
2
|
+
export interface WebhookConfig {
|
|
3
|
+
url: string;
|
|
4
|
+
events: PluginEvent[];
|
|
5
|
+
secret?: string;
|
|
6
|
+
retries?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface WebhookDelivery {
|
|
9
|
+
id: string;
|
|
10
|
+
event: PluginEvent;
|
|
11
|
+
url: string;
|
|
12
|
+
status: 'pending' | 'success' | 'failed';
|
|
13
|
+
attempts: number;
|
|
14
|
+
lastAttempt?: string;
|
|
15
|
+
response?: {
|
|
16
|
+
status: number;
|
|
17
|
+
body: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare class WebhookManager {
|
|
21
|
+
private configs;
|
|
22
|
+
private deliveries;
|
|
23
|
+
register(config: WebhookConfig): void;
|
|
24
|
+
unregister(url: string): void;
|
|
25
|
+
emit(event: PluginEvent, data: unknown): Promise<WebhookDelivery[]>;
|
|
26
|
+
private deliver;
|
|
27
|
+
getRecentDeliveries(limit?: number): WebhookDelivery[];
|
|
28
|
+
listWebhooks(): WebhookConfig[];
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=webhooks.d.ts.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// Webhook/Event System (F-A17)
|
|
2
|
+
// Emit events on index, decay, gap detection → deliver via HTTP webhook
|
|
3
|
+
export class WebhookManager {
|
|
4
|
+
configs = [];
|
|
5
|
+
deliveries = [];
|
|
6
|
+
register(config) {
|
|
7
|
+
// MED: webhook URL 검증
|
|
8
|
+
try {
|
|
9
|
+
const parsed = new URL(config.url);
|
|
10
|
+
if (!['http:', 'https:'].includes(parsed.protocol))
|
|
11
|
+
throw new Error('Invalid protocol');
|
|
12
|
+
const host = parsed.hostname.toLowerCase();
|
|
13
|
+
if (host === 'localhost' || host === '127.0.0.1' || host.startsWith('192.168.') || host.startsWith('10.')) {
|
|
14
|
+
throw new Error('Internal URLs not allowed for webhooks');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
throw new Error(`Invalid webhook URL: ${e instanceof Error ? e.message : e}`);
|
|
19
|
+
}
|
|
20
|
+
this.configs.push(config);
|
|
21
|
+
}
|
|
22
|
+
unregister(url) {
|
|
23
|
+
this.configs = this.configs.filter(c => c.url !== url);
|
|
24
|
+
}
|
|
25
|
+
async emit(event, data) {
|
|
26
|
+
const matching = this.configs.filter(c => c.events.includes(event));
|
|
27
|
+
const results = [];
|
|
28
|
+
for (const config of matching) {
|
|
29
|
+
const delivery = await this.deliver(config, event, data);
|
|
30
|
+
results.push(delivery);
|
|
31
|
+
this.deliveries.push(delivery);
|
|
32
|
+
}
|
|
33
|
+
// Keep last 100 deliveries
|
|
34
|
+
if (this.deliveries.length > 100) {
|
|
35
|
+
this.deliveries = this.deliveries.slice(-100);
|
|
36
|
+
}
|
|
37
|
+
return results;
|
|
38
|
+
}
|
|
39
|
+
async deliver(config, event, data) {
|
|
40
|
+
const id = `wh-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
41
|
+
const maxRetries = config.retries ?? 3;
|
|
42
|
+
const delivery = { id, event, url: config.url, status: 'pending', attempts: 0 };
|
|
43
|
+
const payload = JSON.stringify({ event, data, timestamp: new Date().toISOString(), source: 'stellavault' });
|
|
44
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
45
|
+
delivery.attempts = attempt + 1;
|
|
46
|
+
delivery.lastAttempt = new Date().toISOString();
|
|
47
|
+
try {
|
|
48
|
+
const headers = { 'Content-Type': 'application/json', 'User-Agent': 'stellavault-webhook/1.0' };
|
|
49
|
+
if (config.secret) {
|
|
50
|
+
const { createHmac } = await import('node:crypto');
|
|
51
|
+
const sig = createHmac('sha256', config.secret).update(payload).digest('hex');
|
|
52
|
+
headers['X-Stellavault-Signature'] = `sha256=${sig}`;
|
|
53
|
+
}
|
|
54
|
+
const res = await fetch(config.url, { method: 'POST', headers, body: payload, signal: AbortSignal.timeout(10000) });
|
|
55
|
+
delivery.response = { status: res.status, body: (await res.text()).slice(0, 500) };
|
|
56
|
+
if (res.ok) {
|
|
57
|
+
delivery.status = 'success';
|
|
58
|
+
return delivery;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
delivery.response = { status: 0, body: err instanceof Error ? err.message : String(err) };
|
|
63
|
+
}
|
|
64
|
+
// Exponential backoff
|
|
65
|
+
if (attempt < maxRetries) {
|
|
66
|
+
await new Promise(r => setTimeout(r, 1000 * Math.pow(2, attempt)));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
delivery.status = 'failed';
|
|
70
|
+
return delivery;
|
|
71
|
+
}
|
|
72
|
+
getRecentDeliveries(limit = 20) {
|
|
73
|
+
return this.deliveries.slice(-limit).reverse();
|
|
74
|
+
}
|
|
75
|
+
listWebhooks() {
|
|
76
|
+
return [...this.configs];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=webhooks.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SearchEngine } from './index.js';
|
|
2
|
+
import type { SearchResult, SearchOptions } from '../types/search.js';
|
|
3
|
+
export interface SearchContext {
|
|
4
|
+
recentSearches?: string[];
|
|
5
|
+
recentDocTags?: string[];
|
|
6
|
+
currentFilePath?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface AdaptiveSearchEngine extends SearchEngine {
|
|
9
|
+
search(options: SearchOptions & {
|
|
10
|
+
context?: SearchContext;
|
|
11
|
+
}): Promise<SearchResult[]>;
|
|
12
|
+
}
|
|
13
|
+
export declare function createAdaptiveSearch(deps: {
|
|
14
|
+
baseSearch: SearchEngine;
|
|
15
|
+
}): AdaptiveSearchEngine;
|
|
16
|
+
//# sourceMappingURL=adaptive.d.ts.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Design Ref: §4.1 — 컨텍스트 수집 + reranking
|
|
2
|
+
// Plan SC: SC-05 NDCG 15%+ 향상, SC-06 기존 116 tests 통과
|
|
3
|
+
export function createAdaptiveSearch(deps) {
|
|
4
|
+
const { baseSearch } = deps;
|
|
5
|
+
// In-memory context (session-scoped)
|
|
6
|
+
const searchHistory = [];
|
|
7
|
+
const recentTags = [];
|
|
8
|
+
return {
|
|
9
|
+
async search(options) {
|
|
10
|
+
const { context, ...baseOptions } = options;
|
|
11
|
+
// 1. Base search
|
|
12
|
+
const results = await baseSearch.search(baseOptions);
|
|
13
|
+
// 2. No context → return as-is (backwards compatible)
|
|
14
|
+
if (!context && searchHistory.length === 0)
|
|
15
|
+
return results;
|
|
16
|
+
// 3. Build effective context
|
|
17
|
+
const ctx = {
|
|
18
|
+
recentSearches: context?.recentSearches ?? searchHistory.slice(-5),
|
|
19
|
+
recentDocTags: context?.recentDocTags ?? recentTags.slice(-10),
|
|
20
|
+
currentFilePath: context?.currentFilePath,
|
|
21
|
+
};
|
|
22
|
+
// 4. Rerank based on context
|
|
23
|
+
const reranked = results.map((r) => {
|
|
24
|
+
let boost = 0;
|
|
25
|
+
// Tag overlap boost (0 ~ 0.3)
|
|
26
|
+
const docTags = ctx.recentDocTags ?? [];
|
|
27
|
+
if (docTags.length > 0 && r.document.tags.length > 0) {
|
|
28
|
+
const docTagSet = new Set(r.document.tags);
|
|
29
|
+
const overlap = docTags.filter((t) => docTagSet.has(t)).length;
|
|
30
|
+
boost += Math.min(overlap / Math.max(docTags.length, 1), 1) * 0.3;
|
|
31
|
+
}
|
|
32
|
+
// File path proximity boost (0 ~ 0.2)
|
|
33
|
+
if (ctx.currentFilePath && r.document.filePath) {
|
|
34
|
+
const ctxParts = ctx.currentFilePath.split('/');
|
|
35
|
+
const docParts = r.document.filePath.split('/');
|
|
36
|
+
let common = 0;
|
|
37
|
+
for (let i = 0; i < Math.min(ctxParts.length, docParts.length); i++) {
|
|
38
|
+
if (ctxParts[i] === docParts[i])
|
|
39
|
+
common++;
|
|
40
|
+
else
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
if (common > 0) {
|
|
44
|
+
boost += Math.min(common / Math.max(ctxParts.length - 1, 1), 1) * 0.2;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return { ...r, score: r.score * (1 + boost) };
|
|
48
|
+
});
|
|
49
|
+
// 5. Re-sort
|
|
50
|
+
reranked.sort((a, b) => b.score - a.score);
|
|
51
|
+
// 6. Update history
|
|
52
|
+
searchHistory.push(options.query);
|
|
53
|
+
if (searchHistory.length > 20)
|
|
54
|
+
searchHistory.shift();
|
|
55
|
+
// Track tags from top results for future context
|
|
56
|
+
for (const r of reranked.slice(0, 3)) {
|
|
57
|
+
for (const t of r.document.tags) {
|
|
58
|
+
recentTags.push(t);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
while (recentTags.length > 30)
|
|
62
|
+
recentTags.shift();
|
|
63
|
+
return reranked;
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=adaptive.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Design Ref: §6.2 — BM25 키워드 검색 (FTS5)
|
|
2
|
+
export async function searchBm25(store, query, limit) {
|
|
3
|
+
// FTS5 쿼리 전처리: 특수문자 제거, 공백으로 OR 검색
|
|
4
|
+
const sanitized = query.replace(/[^\w\s가-힣]/g, ' ').trim();
|
|
5
|
+
if (!sanitized)
|
|
6
|
+
return [];
|
|
7
|
+
const ftsQuery = sanitized.split(/\s+/).join(' OR ');
|
|
8
|
+
return store.searchKeyword(ftsQuery, limit);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=bm25.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Embedder } from '../indexer/embedder.js';
|
|
2
|
+
import type { VectorStore } from '../store/types.js';
|
|
3
|
+
import type { SearchResult, SearchOptions } from '../types/search.js';
|
|
4
|
+
export { rrfFusion } from './rrf.js';
|
|
5
|
+
export { createAdaptiveSearch } from './adaptive.js';
|
|
6
|
+
export type { SearchContext, AdaptiveSearchEngine } from './adaptive.js';
|
|
7
|
+
export interface SearchEngine {
|
|
8
|
+
search(options: SearchOptions): Promise<SearchResult[]>;
|
|
9
|
+
}
|
|
10
|
+
export declare function createSearchEngine(deps: {
|
|
11
|
+
store: VectorStore;
|
|
12
|
+
embedder: Embedder;
|
|
13
|
+
rrfK?: number;
|
|
14
|
+
}): SearchEngine;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Design Ref: §4.2 — createSearchEngine
|
|
2
|
+
import { searchBm25 } from './bm25.js';
|
|
3
|
+
import { searchSemantic } from './semantic.js';
|
|
4
|
+
import { rrfFusion } from './rrf.js';
|
|
5
|
+
export { rrfFusion } from './rrf.js';
|
|
6
|
+
export { createAdaptiveSearch } from './adaptive.js';
|
|
7
|
+
export function createSearchEngine(deps) {
|
|
8
|
+
const { store, embedder, rrfK = 60 } = deps;
|
|
9
|
+
const FETCH_LIMIT = 30; // 각 검색에서 가져올 후보 수
|
|
10
|
+
return {
|
|
11
|
+
async search(options) {
|
|
12
|
+
const { query, limit = 10, threshold = 0.0, tags } = options;
|
|
13
|
+
// 병렬로 BM25 + Semantic 검색
|
|
14
|
+
const [bm25Results, semanticResults] = await Promise.all([
|
|
15
|
+
searchBm25(store, query, FETCH_LIMIT),
|
|
16
|
+
searchSemantic(store, embedder, query, FETCH_LIMIT),
|
|
17
|
+
]);
|
|
18
|
+
// RRF Fusion
|
|
19
|
+
const fused = rrfFusion(semanticResults, bm25Results, rrfK, limit * 2);
|
|
20
|
+
// 청크+문서 조회 + 필터링
|
|
21
|
+
const results = [];
|
|
22
|
+
for (const scored of fused) {
|
|
23
|
+
if (scored.score < threshold)
|
|
24
|
+
continue;
|
|
25
|
+
const chunk = await store.getChunk(scored.chunkId);
|
|
26
|
+
if (!chunk)
|
|
27
|
+
continue;
|
|
28
|
+
const document = await store.getDocument(chunk.documentId);
|
|
29
|
+
if (!document)
|
|
30
|
+
continue;
|
|
31
|
+
// 태그 필터
|
|
32
|
+
if (tags && tags.length > 0) {
|
|
33
|
+
const docTags = new Set(document.tags);
|
|
34
|
+
if (!tags.some(t => docTags.has(t)))
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
results.push({
|
|
38
|
+
chunk,
|
|
39
|
+
document,
|
|
40
|
+
score: scored.score,
|
|
41
|
+
highlights: extractHighlights(chunk.content, query),
|
|
42
|
+
});
|
|
43
|
+
if (results.length >= limit)
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
return results;
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function extractHighlights(content, query) {
|
|
51
|
+
const words = query.toLowerCase().split(/\s+/).filter(w => w.length > 1);
|
|
52
|
+
const lines = content.split('\n');
|
|
53
|
+
const highlights = [];
|
|
54
|
+
for (const line of lines) {
|
|
55
|
+
const lower = line.toLowerCase();
|
|
56
|
+
if (words.some(w => lower.includes(w))) {
|
|
57
|
+
highlights.push(line.trim());
|
|
58
|
+
if (highlights.length >= 3)
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return highlights;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ScoredChunk } from '../types/chunk.js';
|
|
2
|
+
/**
|
|
3
|
+
* RRF: 두 랭킹 리스트를 통합하여 최종 점수를 산출합니다.
|
|
4
|
+
* score(d) = Σ 1/(k + rank_i) for each ranker i
|
|
5
|
+
*/
|
|
6
|
+
export declare function rrfFusion(listA: ScoredChunk[], listB: ScoredChunk[], k?: number, limit?: number): ScoredChunk[];
|
|
7
|
+
//# sourceMappingURL=rrf.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Design Ref: §6.2 — Reciprocal Rank Fusion (k=60)
|
|
2
|
+
/**
|
|
3
|
+
* RRF: 두 랭킹 리스트를 통합하여 최종 점수를 산출합니다.
|
|
4
|
+
* score(d) = Σ 1/(k + rank_i) for each ranker i
|
|
5
|
+
*/
|
|
6
|
+
export function rrfFusion(listA, listB, k = 60, limit = 10) {
|
|
7
|
+
const scores = new Map();
|
|
8
|
+
for (let i = 0; i < listA.length; i++) {
|
|
9
|
+
const id = listA[i].chunkId;
|
|
10
|
+
scores.set(id, (scores.get(id) ?? 0) + 1 / (k + i + 1));
|
|
11
|
+
}
|
|
12
|
+
for (let i = 0; i < listB.length; i++) {
|
|
13
|
+
const id = listB[i].chunkId;
|
|
14
|
+
scores.set(id, (scores.get(id) ?? 0) + 1 / (k + i + 1));
|
|
15
|
+
}
|
|
16
|
+
return [...scores.entries()]
|
|
17
|
+
.sort((a, b) => b[1] - a[1])
|
|
18
|
+
.slice(0, limit)
|
|
19
|
+
.map(([chunkId, score]) => ({ chunkId, score }));
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=rrf.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Embedder } from '../indexer/embedder.js';
|
|
2
|
+
import type { VectorStore } from '../store/types.js';
|
|
3
|
+
import type { ScoredChunk } from '../types/chunk.js';
|
|
4
|
+
export declare function searchSemantic(store: VectorStore, embedder: Embedder, query: string, limit: number): Promise<ScoredChunk[]>;
|
|
5
|
+
//# sourceMappingURL=semantic.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import Database from 'better-sqlite3';
|
|
2
|
+
import type { VectorStore } from './types.js';
|
|
3
|
+
import type { Document } from '../types/index.js';
|
|
4
|
+
export declare function createSqliteVecStore(dbPath: string, dimensions?: number): VectorStore;
|
|
5
|
+
export declare function upsertDocument(db: Database.Database, doc: Document): void;
|
|
6
|
+
//# sourceMappingURL=sqlite-vec.d.ts.map
|