@noyrax/5d-database-plugin 0.1.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/ADR_VORSCHLAEGE.md +247 -0
- package/CHROMADB_SETUP.md +69 -0
- package/IMPROVEMENT_ROADMAP.md +435 -0
- package/INSTALLATION_READINESS.md +150 -0
- package/KNOWN_ISSUES.md +210 -0
- package/LICENSE +21 -0
- package/MCP_SERVER_SETUP.md +359 -0
- package/MCP_SERVER_TEST_REPORT.md +206 -0
- package/NOYRAX_INTEGRATION.md +224 -0
- package/QUICK_START.md +316 -0
- package/README.md +240 -0
- package/SETUP_NEW_PROJECT.md +260 -0
- package/SYSTEM_ANALYSIS_REPORT.md +341 -0
- package/out/api/adr-api.d.ts +22 -0
- package/out/api/adr-api.d.ts.map +1 -0
- package/out/api/adr-api.js +38 -0
- package/out/api/adr-api.js.map +1 -0
- package/out/api/bootstrap-api.d.ts +43 -0
- package/out/api/bootstrap-api.d.ts.map +1 -0
- package/out/api/bootstrap-api.js +88 -0
- package/out/api/bootstrap-api.js.map +1 -0
- package/out/api/change-api.d.ts +30 -0
- package/out/api/change-api.d.ts.map +1 -0
- package/out/api/change-api.js +54 -0
- package/out/api/change-api.js.map +1 -0
- package/out/api/context-builder.d.ts +81 -0
- package/out/api/context-builder.d.ts.map +1 -0
- package/out/api/context-builder.js +288 -0
- package/out/api/context-builder.js.map +1 -0
- package/out/api/cross-dimension-api.d.ts +43 -0
- package/out/api/cross-dimension-api.d.ts.map +1 -0
- package/out/api/cross-dimension-api.js +55 -0
- package/out/api/cross-dimension-api.js.map +1 -0
- package/out/api/dependency-api.d.ts +26 -0
- package/out/api/dependency-api.d.ts.map +1 -0
- package/out/api/dependency-api.js +46 -0
- package/out/api/dependency-api.js.map +1 -0
- package/out/api/learning-path-api.d.ts +49 -0
- package/out/api/learning-path-api.d.ts.map +1 -0
- package/out/api/learning-path-api.js +174 -0
- package/out/api/learning-path-api.js.map +1 -0
- package/out/api/module-api.d.ts +26 -0
- package/out/api/module-api.d.ts.map +1 -0
- package/out/api/module-api.js +46 -0
- package/out/api/module-api.js.map +1 -0
- package/out/api/search-api.d.ts +64 -0
- package/out/api/search-api.d.ts.map +1 -0
- package/out/api/search-api.js +235 -0
- package/out/api/search-api.js.map +1 -0
- package/out/api/self-explanation-api.d.ts +71 -0
- package/out/api/self-explanation-api.d.ts.map +1 -0
- package/out/api/self-explanation-api.js +153 -0
- package/out/api/self-explanation-api.js.map +1 -0
- package/out/api/semantic-search-api.d.ts +64 -0
- package/out/api/semantic-search-api.d.ts.map +1 -0
- package/out/api/semantic-search-api.js +205 -0
- package/out/api/semantic-search-api.js.map +1 -0
- package/out/api/symbol-api.d.ts +22 -0
- package/out/api/symbol-api.d.ts.map +1 -0
- package/out/api/symbol-api.js +38 -0
- package/out/api/symbol-api.js.map +1 -0
- package/out/api/vector-api.d.ts +26 -0
- package/out/api/vector-api.d.ts.map +1 -0
- package/out/api/vector-api.js +49 -0
- package/out/api/vector-api.js.map +1 -0
- package/out/cli/embedding-cli.d.ts +3 -0
- package/out/cli/embedding-cli.d.ts.map +1 -0
- package/out/cli/embedding-cli.js +151 -0
- package/out/cli/embedding-cli.js.map +1 -0
- package/out/cli/ingest-cli.d.ts +3 -0
- package/out/cli/ingest-cli.d.ts.map +1 -0
- package/out/cli/ingest-cli.js +145 -0
- package/out/cli/ingest-cli.js.map +1 -0
- package/out/cli/mcp-server-cli.d.ts +3 -0
- package/out/cli/mcp-server-cli.d.ts.map +1 -0
- package/out/cli/mcp-server-cli.js +159 -0
- package/out/cli/mcp-server-cli.js.map +1 -0
- package/out/cli/query-cli.d.ts +3 -0
- package/out/cli/query-cli.d.ts.map +1 -0
- package/out/cli/query-cli.js +217 -0
- package/out/cli/query-cli.js.map +1 -0
- package/out/cli/semantic-search-cli.d.ts +3 -0
- package/out/cli/semantic-search-cli.d.ts.map +1 -0
- package/out/cli/semantic-search-cli.js +196 -0
- package/out/cli/semantic-search-cli.js.map +1 -0
- package/out/cli/test-chromadb.d.ts +3 -0
- package/out/cli/test-chromadb.d.ts.map +1 -0
- package/out/cli/test-chromadb.js +204 -0
- package/out/cli/test-chromadb.js.map +1 -0
- package/out/cli/test-v-dimension.d.ts +3 -0
- package/out/cli/test-v-dimension.d.ts.map +1 -0
- package/out/cli/test-v-dimension.js +330 -0
- package/out/cli/test-v-dimension.js.map +1 -0
- package/out/cli/tool-cli.d.ts +3 -0
- package/out/cli/tool-cli.d.ts.map +1 -0
- package/out/cli/tool-cli.js +237 -0
- package/out/cli/tool-cli.js.map +1 -0
- package/out/cli/verify-openai-key.d.ts +3 -0
- package/out/cli/verify-openai-key.d.ts.map +1 -0
- package/out/cli/verify-openai-key.js +141 -0
- package/out/cli/verify-openai-key.js.map +1 -0
- package/out/cli/verify-vss-status.d.ts +3 -0
- package/out/cli/verify-vss-status.d.ts.map +1 -0
- package/out/cli/verify-vss-status.js +185 -0
- package/out/cli/verify-vss-status.js.map +1 -0
- package/out/core/chromadb-vector-database.d.ts +52 -0
- package/out/core/chromadb-vector-database.d.ts.map +1 -0
- package/out/core/chromadb-vector-database.js +276 -0
- package/out/core/chromadb-vector-database.js.map +1 -0
- package/out/core/docs-path-resolver.d.ts +43 -0
- package/out/core/docs-path-resolver.d.ts.map +1 -0
- package/out/core/docs-path-resolver.js +137 -0
- package/out/core/docs-path-resolver.js.map +1 -0
- package/out/core/id-mapper.d.ts +68 -0
- package/out/core/id-mapper.d.ts.map +1 -0
- package/out/core/id-mapper.js +132 -0
- package/out/core/id-mapper.js.map +1 -0
- package/out/core/migration-manager.d.ts +75 -0
- package/out/core/migration-manager.d.ts.map +1 -0
- package/out/core/migration-manager.js +212 -0
- package/out/core/migration-manager.js.map +1 -0
- package/out/core/multi-db-manager.d.ts +84 -0
- package/out/core/multi-db-manager.d.ts.map +1 -0
- package/out/core/multi-db-manager.js +206 -0
- package/out/core/multi-db-manager.js.map +1 -0
- package/out/core/transaction-manager.d.ts +69 -0
- package/out/core/transaction-manager.d.ts.map +1 -0
- package/out/core/transaction-manager.js +138 -0
- package/out/core/transaction-manager.js.map +1 -0
- package/out/core/vector-database-factory.d.ts +25 -0
- package/out/core/vector-database-factory.d.ts.map +1 -0
- package/out/core/vector-database-factory.js +82 -0
- package/out/core/vector-database-factory.js.map +1 -0
- package/out/core/vector-database-interface.d.ts +50 -0
- package/out/core/vector-database-interface.d.ts.map +1 -0
- package/out/core/vector-database-interface.js +3 -0
- package/out/core/vector-database-interface.js.map +1 -0
- package/out/core/vss-loader.d.ts +29 -0
- package/out/core/vss-loader.d.ts.map +1 -0
- package/out/core/vss-loader.js +150 -0
- package/out/core/vss-loader.js.map +1 -0
- package/out/core/vss-manager.d.ts +81 -0
- package/out/core/vss-manager.d.ts.map +1 -0
- package/out/core/vss-manager.js +323 -0
- package/out/core/vss-manager.js.map +1 -0
- package/out/core/vss-vector-database.d.ts +71 -0
- package/out/core/vss-vector-database.d.ts.map +1 -0
- package/out/core/vss-vector-database.js +284 -0
- package/out/core/vss-vector-database.js.map +1 -0
- package/out/embedding/embedding-generator.d.ts +45 -0
- package/out/embedding/embedding-generator.d.ts.map +1 -0
- package/out/embedding/embedding-generator.js +143 -0
- package/out/embedding/embedding-generator.js.map +1 -0
- package/out/embedding/embedding-pipeline.d.ts +42 -0
- package/out/embedding/embedding-pipeline.d.ts.map +1 -0
- package/out/embedding/embedding-pipeline.js +290 -0
- package/out/embedding/embedding-pipeline.js.map +1 -0
- package/out/extension.d.ts +10 -0
- package/out/extension.d.ts.map +1 -0
- package/out/extension.js +164 -0
- package/out/extension.js.map +1 -0
- package/out/ingestors/adr-ingestor.d.ts +41 -0
- package/out/ingestors/adr-ingestor.d.ts.map +1 -0
- package/out/ingestors/adr-ingestor.js +329 -0
- package/out/ingestors/adr-ingestor.js.map +1 -0
- package/out/ingestors/base-ingestor.d.ts +30 -0
- package/out/ingestors/base-ingestor.d.ts.map +1 -0
- package/out/ingestors/base-ingestor.js +3 -0
- package/out/ingestors/base-ingestor.js.map +1 -0
- package/out/ingestors/change-ingestor.d.ts +36 -0
- package/out/ingestors/change-ingestor.d.ts.map +1 -0
- package/out/ingestors/change-ingestor.js +216 -0
- package/out/ingestors/change-ingestor.js.map +1 -0
- package/out/ingestors/dependency-ingestor.d.ts +32 -0
- package/out/ingestors/dependency-ingestor.d.ts.map +1 -0
- package/out/ingestors/dependency-ingestor.js +194 -0
- package/out/ingestors/dependency-ingestor.js.map +1 -0
- package/out/ingestors/module-ingestor.d.ts +27 -0
- package/out/ingestors/module-ingestor.d.ts.map +1 -0
- package/out/ingestors/module-ingestor.js +137 -0
- package/out/ingestors/module-ingestor.js.map +1 -0
- package/out/ingestors/symbol-ingestor.d.ts +26 -0
- package/out/ingestors/symbol-ingestor.d.ts.map +1 -0
- package/out/ingestors/symbol-ingestor.js +183 -0
- package/out/ingestors/symbol-ingestor.js.map +1 -0
- package/out/mcp/resources/adrs.d.ts +13 -0
- package/out/mcp/resources/adrs.d.ts.map +1 -0
- package/out/mcp/resources/adrs.js +26 -0
- package/out/mcp/resources/adrs.js.map +1 -0
- package/out/mcp/resources/changes.d.ts +13 -0
- package/out/mcp/resources/changes.d.ts.map +1 -0
- package/out/mcp/resources/changes.js +26 -0
- package/out/mcp/resources/changes.js.map +1 -0
- package/out/mcp/resources/dependencies.d.ts +13 -0
- package/out/mcp/resources/dependencies.d.ts.map +1 -0
- package/out/mcp/resources/dependencies.js +26 -0
- package/out/mcp/resources/dependencies.js.map +1 -0
- package/out/mcp/resources/modules.d.ts +13 -0
- package/out/mcp/resources/modules.d.ts.map +1 -0
- package/out/mcp/resources/modules.js +26 -0
- package/out/mcp/resources/modules.js.map +1 -0
- package/out/mcp/resources/symbols.d.ts +13 -0
- package/out/mcp/resources/symbols.d.ts.map +1 -0
- package/out/mcp/resources/symbols.js +26 -0
- package/out/mcp/resources/symbols.js.map +1 -0
- package/out/mcp/server.d.ts +29 -0
- package/out/mcp/server.d.ts.map +1 -0
- package/out/mcp/server.js +300 -0
- package/out/mcp/server.js.map +1 -0
- package/out/mcp/tools/architecture-mining.d.ts +46 -0
- package/out/mcp/tools/architecture-mining.d.ts.map +1 -0
- package/out/mcp/tools/architecture-mining.js +272 -0
- package/out/mcp/tools/architecture-mining.js.map +1 -0
- package/out/mcp/tools/bootstrap.d.ts +9 -0
- package/out/mcp/tools/bootstrap.d.ts.map +1 -0
- package/out/mcp/tools/bootstrap.js +14 -0
- package/out/mcp/tools/bootstrap.js.map +1 -0
- package/out/mcp/tools/cross-analysis.d.ts +18 -0
- package/out/mcp/tools/cross-analysis.d.ts.map +1 -0
- package/out/mcp/tools/cross-analysis.js +23 -0
- package/out/mcp/tools/cross-analysis.js.map +1 -0
- package/out/mcp/tools/gap-analysis.d.ts +34 -0
- package/out/mcp/tools/gap-analysis.d.ts.map +1 -0
- package/out/mcp/tools/gap-analysis.js +106 -0
- package/out/mcp/tools/gap-analysis.js.map +1 -0
- package/out/mcp/tools/learning-path.d.ts +10 -0
- package/out/mcp/tools/learning-path.d.ts.map +1 -0
- package/out/mcp/tools/learning-path.js +18 -0
- package/out/mcp/tools/learning-path.js.map +1 -0
- package/out/mcp/tools/query-dependencies.d.ts +18 -0
- package/out/mcp/tools/query-dependencies.d.ts.map +1 -0
- package/out/mcp/tools/query-dependencies.js +31 -0
- package/out/mcp/tools/query-dependencies.js.map +1 -0
- package/out/mcp/tools/query-modules.d.ts +17 -0
- package/out/mcp/tools/query-modules.d.ts.map +1 -0
- package/out/mcp/tools/query-modules.js +22 -0
- package/out/mcp/tools/query-modules.js.map +1 -0
- package/out/mcp/tools/query-symbols.d.ts +18 -0
- package/out/mcp/tools/query-symbols.d.ts.map +1 -0
- package/out/mcp/tools/query-symbols.js +32 -0
- package/out/mcp/tools/query-symbols.js.map +1 -0
- package/out/mcp/tools/semantic-discovery.d.ts +12 -0
- package/out/mcp/tools/semantic-discovery.d.ts.map +1 -0
- package/out/mcp/tools/semantic-discovery.js +35 -0
- package/out/mcp/tools/semantic-discovery.js.map +1 -0
- package/out/mcp/tools/system-explanation.d.ts +9 -0
- package/out/mcp/tools/system-explanation.d.ts.map +1 -0
- package/out/mcp/tools/system-explanation.js +14 -0
- package/out/mcp/tools/system-explanation.js.map +1 -0
- package/out/mcp/types.d.ts +19 -0
- package/out/mcp/types.d.ts.map +1 -0
- package/out/mcp/types.js +6 -0
- package/out/mcp/types.js.map +1 -0
- package/out/models/adr.d.ts +26 -0
- package/out/models/adr.d.ts.map +1 -0
- package/out/models/adr.js +3 -0
- package/out/models/adr.js.map +1 -0
- package/out/models/change.d.ts +42 -0
- package/out/models/change.d.ts.map +1 -0
- package/out/models/change.js +3 -0
- package/out/models/change.js.map +1 -0
- package/out/models/dependency.d.ts +37 -0
- package/out/models/dependency.d.ts.map +1 -0
- package/out/models/dependency.js +3 -0
- package/out/models/dependency.js.map +1 -0
- package/out/models/entity-reference.d.ts +20 -0
- package/out/models/entity-reference.d.ts.map +1 -0
- package/out/models/entity-reference.js +19 -0
- package/out/models/entity-reference.js.map +1 -0
- package/out/models/module.d.ts +26 -0
- package/out/models/module.d.ts.map +1 -0
- package/out/models/module.js +3 -0
- package/out/models/module.js.map +1 -0
- package/out/models/symbol.d.ts +31 -0
- package/out/models/symbol.d.ts.map +1 -0
- package/out/models/symbol.js +3 -0
- package/out/models/symbol.js.map +1 -0
- package/out/repositories/adr-repository.d.ts +41 -0
- package/out/repositories/adr-repository.d.ts.map +1 -0
- package/out/repositories/adr-repository.js +128 -0
- package/out/repositories/adr-repository.js.map +1 -0
- package/out/repositories/base-repository.d.ts +86 -0
- package/out/repositories/base-repository.d.ts.map +1 -0
- package/out/repositories/base-repository.js +66 -0
- package/out/repositories/base-repository.js.map +1 -0
- package/out/repositories/change-repository.d.ts +40 -0
- package/out/repositories/change-repository.d.ts.map +1 -0
- package/out/repositories/change-repository.js +150 -0
- package/out/repositories/change-repository.js.map +1 -0
- package/out/repositories/dependency-repository.d.ts +40 -0
- package/out/repositories/dependency-repository.d.ts.map +1 -0
- package/out/repositories/dependency-repository.js +129 -0
- package/out/repositories/dependency-repository.js.map +1 -0
- package/out/repositories/embedding-repository.d.ts +64 -0
- package/out/repositories/embedding-repository.d.ts.map +1 -0
- package/out/repositories/embedding-repository.js +126 -0
- package/out/repositories/embedding-repository.js.map +1 -0
- package/out/repositories/importance-repository.d.ts +63 -0
- package/out/repositories/importance-repository.d.ts.map +1 -0
- package/out/repositories/importance-repository.js +117 -0
- package/out/repositories/importance-repository.js.map +1 -0
- package/out/repositories/module-repository.d.ts +37 -0
- package/out/repositories/module-repository.d.ts.map +1 -0
- package/out/repositories/module-repository.js +122 -0
- package/out/repositories/module-repository.js.map +1 -0
- package/out/repositories/navigation-repository.d.ts +117 -0
- package/out/repositories/navigation-repository.d.ts.map +1 -0
- package/out/repositories/navigation-repository.js +211 -0
- package/out/repositories/navigation-repository.js.map +1 -0
- package/out/repositories/symbol-repository.d.ts +37 -0
- package/out/repositories/symbol-repository.d.ts.map +1 -0
- package/out/repositories/symbol-repository.js +136 -0
- package/out/repositories/symbol-repository.js.map +1 -0
- package/out/services/cross-dimension-linker.d.ts +45 -0
- package/out/services/cross-dimension-linker.d.ts.map +1 -0
- package/out/services/cross-dimension-linker.js +98 -0
- package/out/services/cross-dimension-linker.js.map +1 -0
- package/out/services/importance-scorer.d.ts +47 -0
- package/out/services/importance-scorer.d.ts.map +1 -0
- package/out/services/importance-scorer.js +188 -0
- package/out/services/importance-scorer.js.map +1 -0
- package/out/services/ingestion-orchestrator.d.ts +49 -0
- package/out/services/ingestion-orchestrator.d.ts.map +1 -0
- package/out/services/ingestion-orchestrator.js +140 -0
- package/out/services/ingestion-orchestrator.js.map +1 -0
- package/out/services/navigation-builder.d.ts +29 -0
- package/out/services/navigation-builder.d.ts.map +1 -0
- package/out/services/navigation-builder.js +229 -0
- package/out/services/navigation-builder.js.map +1 -0
- package/out/services/system-model-builder.d.ts +40 -0
- package/out/services/system-model-builder.d.ts.map +1 -0
- package/out/services/system-model-builder.js +88 -0
- package/out/services/system-model-builder.js.map +1 -0
- package/out/ui/commands.d.ts +9 -0
- package/out/ui/commands.d.ts.map +1 -0
- package/out/ui/commands.js +123 -0
- package/out/ui/commands.js.map +1 -0
- package/out/ui/database-explorer.d.ts +27 -0
- package/out/ui/database-explorer.d.ts.map +1 -0
- package/out/ui/database-explorer.js +169 -0
- package/out/ui/database-explorer.js.map +1 -0
- package/out/ui/detail-view-provider.d.ts +86 -0
- package/out/ui/detail-view-provider.d.ts.map +1 -0
- package/out/ui/detail-view-provider.js +1037 -0
- package/out/ui/detail-view-provider.js.map +1 -0
- package/out/ui/search-provider.d.ts +30 -0
- package/out/ui/search-provider.d.ts.map +1 -0
- package/out/ui/search-provider.js +240 -0
- package/out/ui/search-provider.js.map +1 -0
- package/out/ui/status-provider.d.ts +17 -0
- package/out/ui/status-provider.d.ts.map +1 -0
- package/out/ui/status-provider.js +76 -0
- package/out/ui/status-provider.js.map +1 -0
- package/out/validators/consistency-validator.d.ts +37 -0
- package/out/validators/consistency-validator.d.ts.map +1 -0
- package/out/validators/consistency-validator.js +93 -0
- package/out/validators/consistency-validator.js.map +1 -0
- package/out/validators/integrity-validator.d.ts +45 -0
- package/out/validators/integrity-validator.d.ts.map +1 -0
- package/out/validators/integrity-validator.js +115 -0
- package/out/validators/integrity-validator.js.map +1 -0
- package/package.json +173 -0
- package/schemas/sqlite/001_initial_modules.sql +39 -0
- package/schemas/sqlite/002_initial_symbols.sql +46 -0
- package/schemas/sqlite/003_initial_dependencies.sql +51 -0
- package/schemas/sqlite/004_initial_adrs.sql +41 -0
- package/schemas/sqlite/005_initial_changes.sql +54 -0
- package/schemas/sqlite/006_initial_ingestion.sql +34 -0
- package/schemas/sqlite/006_vectors_schema.sql +73 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.MultiDbManager = void 0;
|
|
37
|
+
const sqlite3 = __importStar(require("sqlite3"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const fs = __importStar(require("fs"));
|
|
40
|
+
const crypto = __importStar(require("crypto"));
|
|
41
|
+
const vss_loader_1 = require("./vss-loader");
|
|
42
|
+
const vector_database_factory_1 = require("./vector-database-factory");
|
|
43
|
+
/**
|
|
44
|
+
* Database file names for each dimension
|
|
45
|
+
*/
|
|
46
|
+
const DIMENSION_DB_FILES = {
|
|
47
|
+
X: 'modules.db',
|
|
48
|
+
Y: 'symbols.db',
|
|
49
|
+
Z: 'dependencies.db',
|
|
50
|
+
W: 'adrs.db',
|
|
51
|
+
T: 'changes.db',
|
|
52
|
+
V: 'vectors.db'
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Manages 5 separate SQLite databases, one for each dimension.
|
|
56
|
+
* Each database is stored in the workspace-specific .database-plugin directory.
|
|
57
|
+
*/
|
|
58
|
+
class MultiDbManager {
|
|
59
|
+
/**
|
|
60
|
+
* Creates a new MultiDbManager instance.
|
|
61
|
+
* @param workspaceRoot The root directory of the workspace
|
|
62
|
+
*/
|
|
63
|
+
constructor(workspaceRoot) {
|
|
64
|
+
this.databases = new Map();
|
|
65
|
+
this.vectorDatabase = null;
|
|
66
|
+
this.workspaceRoot = workspaceRoot;
|
|
67
|
+
this.dbDirectory = path.join(workspaceRoot, '.database-plugin');
|
|
68
|
+
this.pluginId = this.computePluginId(workspaceRoot);
|
|
69
|
+
this.vssLoader = new vss_loader_1.VssLoader();
|
|
70
|
+
this.ensureDbDirectory();
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Computes a stable plugin_id from the workspace root path.
|
|
74
|
+
* Uses SHA256 hash of normalized path, takes first 16 characters.
|
|
75
|
+
*
|
|
76
|
+
* @param workspaceRoot The workspace root directory
|
|
77
|
+
* @returns Stable plugin ID (16 hex characters)
|
|
78
|
+
*/
|
|
79
|
+
computePluginId(workspaceRoot) {
|
|
80
|
+
const normalizedPath = path.resolve(workspaceRoot).replace(/\\/g, '/').toLowerCase();
|
|
81
|
+
const hash = crypto.createHash('sha256').update(normalizedPath).digest('hex');
|
|
82
|
+
return hash.substring(0, 16);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Ensures the database directory exists.
|
|
86
|
+
*/
|
|
87
|
+
ensureDbDirectory() {
|
|
88
|
+
if (!fs.existsSync(this.dbDirectory)) {
|
|
89
|
+
fs.mkdirSync(this.dbDirectory, { recursive: true });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Gets the plugin ID for this workspace.
|
|
94
|
+
*/
|
|
95
|
+
getPluginId() {
|
|
96
|
+
return this.pluginId;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Gets the database directory path.
|
|
100
|
+
*/
|
|
101
|
+
getDbDirectory() {
|
|
102
|
+
return this.dbDirectory;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Opens a database connection for the specified dimension.
|
|
106
|
+
* If the database is already open, returns the existing connection.
|
|
107
|
+
* For V-dimension (vectors.db), loads VSS extension before opening.
|
|
108
|
+
*
|
|
109
|
+
* @param dimension The dimension (X, Y, Z, W, T, or V)
|
|
110
|
+
* @returns Promise that resolves to the SQLite database instance
|
|
111
|
+
*/
|
|
112
|
+
async getDatabase(dimension) {
|
|
113
|
+
if (this.databases.has(dimension)) {
|
|
114
|
+
return this.databases.get(dimension);
|
|
115
|
+
}
|
|
116
|
+
const dbPath = path.join(this.dbDirectory, DIMENSION_DB_FILES[dimension]);
|
|
117
|
+
return new Promise((resolve, reject) => {
|
|
118
|
+
const db = new sqlite3.Database(dbPath, async (err) => {
|
|
119
|
+
if (err) {
|
|
120
|
+
reject(err);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
// Initialize vector database for V-dimension
|
|
124
|
+
if (dimension === 'V') {
|
|
125
|
+
try {
|
|
126
|
+
await this.vssLoader.loadExtension(db);
|
|
127
|
+
// Create vector database instance (VSS on macOS/Linux, ChromaDB on Windows)
|
|
128
|
+
if (!this.vectorDatabase) {
|
|
129
|
+
this.vectorDatabase = await vector_database_factory_1.VectorDatabaseFactory.create(db, this.vssLoader, this.workspaceRoot);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
catch (vssError) {
|
|
133
|
+
// VSS loading failed, but continue without it (will use ChromaDB or fallback)
|
|
134
|
+
console.warn(`[MultiDbManager] VSS extension loading failed for V-dimension: ${vssError}`);
|
|
135
|
+
// Still create vector database (ChromaDB on Windows, or fallback)
|
|
136
|
+
if (!this.vectorDatabase) {
|
|
137
|
+
this.vectorDatabase = await vector_database_factory_1.VectorDatabaseFactory.create(db, this.vssLoader, this.workspaceRoot);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
this.databases.set(dimension, db);
|
|
142
|
+
resolve(db);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Closes a database connection for the specified dimension.
|
|
148
|
+
*
|
|
149
|
+
* @param dimension The dimension to close
|
|
150
|
+
* @returns Promise that resolves when the database is closed
|
|
151
|
+
*/
|
|
152
|
+
async closeDatabase(dimension) {
|
|
153
|
+
const db = this.databases.get(dimension);
|
|
154
|
+
if (db) {
|
|
155
|
+
return new Promise((resolve, reject) => {
|
|
156
|
+
db.close((err) => {
|
|
157
|
+
if (err) {
|
|
158
|
+
reject(err);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
this.databases.delete(dimension);
|
|
162
|
+
resolve();
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Closes all database connections.
|
|
170
|
+
*
|
|
171
|
+
* @returns Promise that resolves when all databases are closed
|
|
172
|
+
*/
|
|
173
|
+
async closeAll() {
|
|
174
|
+
const closePromises = [];
|
|
175
|
+
for (const dimension of this.databases.keys()) {
|
|
176
|
+
closePromises.push(this.closeDatabase(dimension));
|
|
177
|
+
}
|
|
178
|
+
await Promise.all(closePromises);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Gets all open database connections.
|
|
182
|
+
*
|
|
183
|
+
* @returns Map of dimension to database instance
|
|
184
|
+
*/
|
|
185
|
+
getOpenDatabases() {
|
|
186
|
+
return new Map(this.databases);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Gets the Vector Database for vector similarity search.
|
|
190
|
+
* Only available for V-dimension after initialization.
|
|
191
|
+
*
|
|
192
|
+
* @returns Vector Database instance or null if not available
|
|
193
|
+
*/
|
|
194
|
+
getVectorDatabase() {
|
|
195
|
+
return this.vectorDatabase;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* @deprecated Use getVectorDatabase() instead
|
|
199
|
+
* Gets the VSS Manager for backward compatibility.
|
|
200
|
+
*/
|
|
201
|
+
getVssManager() {
|
|
202
|
+
return this.vectorDatabase;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
exports.MultiDbManager = MultiDbManager;
|
|
206
|
+
//# sourceMappingURL=multi-db-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-db-manager.js","sourceRoot":"","sources":["../../src/core/multi-db-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AACnC,2CAA6B;AAC7B,uCAAyB;AACzB,+CAAiC;AACjC,6CAAyC;AAEzC,uEAAkE;AAOlE;;GAEG;AACH,MAAM,kBAAkB,GAA8B;IAClD,CAAC,EAAE,YAAY;IACf,CAAC,EAAE,YAAY;IACf,CAAC,EAAE,iBAAiB;IACpB,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,YAAY;IACf,CAAC,EAAE,YAAY;CAClB,CAAC;AAEF;;;GAGG;AACH,MAAa,cAAc;IAQvB;;;OAGG;IACH,YAAY,aAAqB;QAXzB,cAAS,GAAqC,IAAI,GAAG,EAAE,CAAC;QAKxD,mBAAc,GAA0B,IAAI,CAAC;QAOjD,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;QAChE,IAAI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GAAG,CAAC,SAAS,CAAC,CAAC;QACzC,IAAI,EAAE,EAAE,CAAC;YACL,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBACnC,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;oBACb,IAAI,GAAG,EAAE,CAAC;wBACN,MAAM,CAAC,GAAG,CAAC,CAAC;oBAChB,CAAC;yBAAM,CAAC;wBACJ,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;wBACjC,OAAO,EAAE,CAAC;oBACd,CAAC;gBACL,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,QAAQ;QACjB,MAAM,aAAa,GAAoB,EAAE,CAAC;QAC1C,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC;YAC5C,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;QACtD,CAAC;QACD,MAAM,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACI,gBAAgB;QACnB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACI,iBAAiB;QACpB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,aAAa;QAChB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;CACJ;AAnKD,wCAmKC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as sqlite3 from 'sqlite3';
|
|
2
|
+
import { MultiDbManager, Dimension } from './multi-db-manager';
|
|
3
|
+
/**
|
|
4
|
+
* Transaction operation that can be executed within a transaction
|
|
5
|
+
*/
|
|
6
|
+
export type TransactionOperation = (db: sqlite3.Database) => Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Manages transactions across multiple databases (all 5 dimensions).
|
|
9
|
+
* Ensures atomicity: either all operations succeed or all are rolled back.
|
|
10
|
+
*/
|
|
11
|
+
export declare class TransactionManager {
|
|
12
|
+
private dbManager;
|
|
13
|
+
private activeTransactions;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new TransactionManager instance.
|
|
16
|
+
*
|
|
17
|
+
* @param dbManager The MultiDbManager instance
|
|
18
|
+
*/
|
|
19
|
+
constructor(dbManager: MultiDbManager);
|
|
20
|
+
/**
|
|
21
|
+
* Begins a transaction on a database.
|
|
22
|
+
*
|
|
23
|
+
* @param db The SQLite database instance
|
|
24
|
+
* @returns Promise that resolves when the transaction is begun
|
|
25
|
+
*/
|
|
26
|
+
private beginTransaction;
|
|
27
|
+
/**
|
|
28
|
+
* Commits a transaction on a database.
|
|
29
|
+
*
|
|
30
|
+
* @param db The SQLite database instance
|
|
31
|
+
* @returns Promise that resolves when the transaction is committed
|
|
32
|
+
*/
|
|
33
|
+
private commitTransaction;
|
|
34
|
+
/**
|
|
35
|
+
* Rolls back a transaction on a database.
|
|
36
|
+
*
|
|
37
|
+
* @param db The SQLite database instance
|
|
38
|
+
* @returns Promise that resolves when the transaction is rolled back
|
|
39
|
+
*/
|
|
40
|
+
private rollbackTransaction;
|
|
41
|
+
/**
|
|
42
|
+
* Executes operations in a transaction across multiple dimensions.
|
|
43
|
+
* If any operation fails, all transactions are rolled back.
|
|
44
|
+
*
|
|
45
|
+
* @param operations Map of dimension to operation function
|
|
46
|
+
* @returns Promise that resolves when all operations succeed, or rejects if any fail
|
|
47
|
+
*/
|
|
48
|
+
executeTransaction(operations: Map<Dimension, TransactionOperation>): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Executes operations in a transaction across all dimensions.
|
|
51
|
+
*
|
|
52
|
+
* @param operations Map of dimension to operation function
|
|
53
|
+
* @returns Promise that resolves when all operations succeed
|
|
54
|
+
*/
|
|
55
|
+
executeTransactionAll(operations: Map<Dimension, TransactionOperation>): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Checks if there are any active transactions.
|
|
58
|
+
*
|
|
59
|
+
* @returns True if there are active transactions
|
|
60
|
+
*/
|
|
61
|
+
hasActiveTransactions(): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Gets the list of dimensions with active transactions.
|
|
64
|
+
*
|
|
65
|
+
* @returns Array of dimensions with active transactions
|
|
66
|
+
*/
|
|
67
|
+
getActiveTransactionDimensions(): Dimension[];
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=transaction-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-manager.d.ts","sourceRoot":"","sources":["../../src/core/transaction-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE3E;;;GAGG;AACH,qBAAa,kBAAkB;IAC3B,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,kBAAkB,CAA+C;IAEzE;;;;OAIG;gBACS,SAAS,EAAE,cAAc;IAIrC;;;;;OAKG;YACW,gBAAgB;IAY9B;;;;;OAKG;YACW,iBAAiB;IAY/B;;;;;OAKG;YACW,mBAAmB;IAYjC;;;;;;OAMG;IACU,kBAAkB,CAC3B,UAAU,EAAE,GAAG,CAAC,SAAS,EAAE,oBAAoB,CAAC,GACjD,OAAO,CAAC,IAAI,CAAC;IAmChB;;;;;OAKG;IACU,qBAAqB,CAC9B,UAAU,EAAE,GAAG,CAAC,SAAS,EAAE,oBAAoB,CAAC,GACjD,OAAO,CAAC,IAAI,CAAC;IAIhB;;;;OAIG;IACI,qBAAqB,IAAI,OAAO;IAIvC;;;;OAIG;IACI,8BAA8B,IAAI,SAAS,EAAE;CAGvD"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionManager = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Manages transactions across multiple databases (all 5 dimensions).
|
|
6
|
+
* Ensures atomicity: either all operations succeed or all are rolled back.
|
|
7
|
+
*/
|
|
8
|
+
class TransactionManager {
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new TransactionManager instance.
|
|
11
|
+
*
|
|
12
|
+
* @param dbManager The MultiDbManager instance
|
|
13
|
+
*/
|
|
14
|
+
constructor(dbManager) {
|
|
15
|
+
this.activeTransactions = new Map();
|
|
16
|
+
this.dbManager = dbManager;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Begins a transaction on a database.
|
|
20
|
+
*
|
|
21
|
+
* @param db The SQLite database instance
|
|
22
|
+
* @returns Promise that resolves when the transaction is begun
|
|
23
|
+
*/
|
|
24
|
+
async beginTransaction(db) {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
db.run('BEGIN TRANSACTION', (err) => {
|
|
27
|
+
if (err) {
|
|
28
|
+
reject(err);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
resolve();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Commits a transaction on a database.
|
|
38
|
+
*
|
|
39
|
+
* @param db The SQLite database instance
|
|
40
|
+
* @returns Promise that resolves when the transaction is committed
|
|
41
|
+
*/
|
|
42
|
+
async commitTransaction(db) {
|
|
43
|
+
return new Promise((resolve, reject) => {
|
|
44
|
+
db.run('COMMIT', (err) => {
|
|
45
|
+
if (err) {
|
|
46
|
+
reject(err);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
resolve();
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Rolls back a transaction on a database.
|
|
56
|
+
*
|
|
57
|
+
* @param db The SQLite database instance
|
|
58
|
+
* @returns Promise that resolves when the transaction is rolled back
|
|
59
|
+
*/
|
|
60
|
+
async rollbackTransaction(db) {
|
|
61
|
+
return new Promise((resolve, reject) => {
|
|
62
|
+
db.run('ROLLBACK', (err) => {
|
|
63
|
+
if (err) {
|
|
64
|
+
reject(err);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
resolve();
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Executes operations in a transaction across multiple dimensions.
|
|
74
|
+
* If any operation fails, all transactions are rolled back.
|
|
75
|
+
*
|
|
76
|
+
* @param operations Map of dimension to operation function
|
|
77
|
+
* @returns Promise that resolves when all operations succeed, or rejects if any fail
|
|
78
|
+
*/
|
|
79
|
+
async executeTransaction(operations) {
|
|
80
|
+
const dimensions = Array.from(operations.keys());
|
|
81
|
+
const databases = new Map();
|
|
82
|
+
try {
|
|
83
|
+
for (const dimension of dimensions) {
|
|
84
|
+
const db = await this.dbManager.getDatabase(dimension);
|
|
85
|
+
databases.set(dimension, db);
|
|
86
|
+
await this.beginTransaction(db);
|
|
87
|
+
this.activeTransactions.set(dimension, db);
|
|
88
|
+
}
|
|
89
|
+
for (const [dimension, operation] of operations.entries()) {
|
|
90
|
+
const db = databases.get(dimension);
|
|
91
|
+
await operation(db);
|
|
92
|
+
}
|
|
93
|
+
for (const db of databases.values()) {
|
|
94
|
+
await this.commitTransaction(db);
|
|
95
|
+
}
|
|
96
|
+
this.activeTransactions.clear();
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
for (const db of databases.values()) {
|
|
100
|
+
try {
|
|
101
|
+
await this.rollbackTransaction(db);
|
|
102
|
+
}
|
|
103
|
+
catch (rollbackError) {
|
|
104
|
+
console.error('Failed to rollback transaction:', rollbackError);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
this.activeTransactions.clear();
|
|
108
|
+
throw error;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Executes operations in a transaction across all dimensions.
|
|
113
|
+
*
|
|
114
|
+
* @param operations Map of dimension to operation function
|
|
115
|
+
* @returns Promise that resolves when all operations succeed
|
|
116
|
+
*/
|
|
117
|
+
async executeTransactionAll(operations) {
|
|
118
|
+
return this.executeTransaction(operations);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Checks if there are any active transactions.
|
|
122
|
+
*
|
|
123
|
+
* @returns True if there are active transactions
|
|
124
|
+
*/
|
|
125
|
+
hasActiveTransactions() {
|
|
126
|
+
return this.activeTransactions.size > 0;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Gets the list of dimensions with active transactions.
|
|
130
|
+
*
|
|
131
|
+
* @returns Array of dimensions with active transactions
|
|
132
|
+
*/
|
|
133
|
+
getActiveTransactionDimensions() {
|
|
134
|
+
return Array.from(this.activeTransactions.keys());
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.TransactionManager = TransactionManager;
|
|
138
|
+
//# sourceMappingURL=transaction-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-manager.js","sourceRoot":"","sources":["../../src/core/transaction-manager.ts"],"names":[],"mappings":";;;AAQA;;;GAGG;AACH,MAAa,kBAAkB;IAI3B;;;;OAIG;IACH,YAAY,SAAyB;QAP7B,uBAAkB,GAAqC,IAAI,GAAG,EAAE,CAAC;QAQrE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,gBAAgB,CAAC,EAAoB;QAC/C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACn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AAC,CAAC;IAC/C,CAAC;IAED;;;;OAIG;IACI,qBAAqB;QACxB,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,GAAG,CAAC,CAAC;IAC5C,CAAC;IAED;;;;OAIG;IACI,8BAA8B;QACjC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;CACJ;AA5ID,gDA4IC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as sqlite3 from 'sqlite3';
|
|
2
|
+
import { VssLoader } from './vss-loader';
|
|
3
|
+
import { VectorDatabase } from './vector-database-interface';
|
|
4
|
+
/**
|
|
5
|
+
* Factory for creating vector database instances based on platform.
|
|
6
|
+
* Selects the appropriate implementation (VSS on macOS/Linux, ChromaDB on Windows).
|
|
7
|
+
*/
|
|
8
|
+
export declare class VectorDatabaseFactory {
|
|
9
|
+
/**
|
|
10
|
+
* Creates a vector database instance for the given database.
|
|
11
|
+
*
|
|
12
|
+
* @param db The SQLite database instance
|
|
13
|
+
* @param vssLoader The VSS loader instance
|
|
14
|
+
* @param workspaceRoot The workspace root directory (for ChromaDB path)
|
|
15
|
+
* @returns Promise that resolves to a VectorDatabase instance
|
|
16
|
+
*/
|
|
17
|
+
static create(db: sqlite3.Database, vssLoader: VssLoader, workspaceRoot: string): Promise<VectorDatabase>;
|
|
18
|
+
/**
|
|
19
|
+
* Checks if a platform-specific vector database is available.
|
|
20
|
+
*
|
|
21
|
+
* @returns true if an optimized vector database is available for the current platform
|
|
22
|
+
*/
|
|
23
|
+
static isOptimizedDatabaseAvailable(): boolean;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=vector-database-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector-database-factory.d.ts","sourceRoot":"","sources":["../../src/core/vector-database-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D;;;GAGG;AACH,qBAAa,qBAAqB;IAC9B;;;;;;;OAOG;WACU,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IA0C/G;;;;OAIG;IACH,MAAM,CAAC,4BAA4B,IAAI,OAAO;CAoBjD"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VectorDatabaseFactory = void 0;
|
|
4
|
+
const vss_vector_database_1 = require("./vss-vector-database");
|
|
5
|
+
const chromadb_vector_database_1 = require("./chromadb-vector-database");
|
|
6
|
+
/**
|
|
7
|
+
* Factory for creating vector database instances based on platform.
|
|
8
|
+
* Selects the appropriate implementation (VSS on macOS/Linux, ChromaDB on Windows).
|
|
9
|
+
*/
|
|
10
|
+
class VectorDatabaseFactory {
|
|
11
|
+
/**
|
|
12
|
+
* Creates a vector database instance for the given database.
|
|
13
|
+
*
|
|
14
|
+
* @param db The SQLite database instance
|
|
15
|
+
* @param vssLoader The VSS loader instance
|
|
16
|
+
* @param workspaceRoot The workspace root directory (for ChromaDB path)
|
|
17
|
+
* @returns Promise that resolves to a VectorDatabase instance
|
|
18
|
+
*/
|
|
19
|
+
static async create(db, vssLoader, workspaceRoot) {
|
|
20
|
+
const platform = process.platform;
|
|
21
|
+
const arch = process.arch;
|
|
22
|
+
// macOS and Linux: Use VSS
|
|
23
|
+
if (platform === 'darwin' || platform === 'linux') {
|
|
24
|
+
const vssDb = new vss_vector_database_1.VssVectorDatabase(db, vssLoader);
|
|
25
|
+
// Try to initialize VSS
|
|
26
|
+
try {
|
|
27
|
+
await vssDb.initialize();
|
|
28
|
+
if (vssDb.isAvailable()) {
|
|
29
|
+
console.log(`[VectorDatabaseFactory] Using VSS Vector Database (${platform}-${arch})`);
|
|
30
|
+
return vssDb;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
console.warn(`[VectorDatabaseFactory] VSS initialization failed: ${error}. Will use fallback.`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Windows: Use ChromaDB
|
|
38
|
+
if (platform === 'win32') {
|
|
39
|
+
const chromaDb = new chromadb_vector_database_1.ChromaDbVectorDatabase(db, workspaceRoot);
|
|
40
|
+
try {
|
|
41
|
+
await chromaDb.initialize();
|
|
42
|
+
if (chromaDb.isAvailable()) {
|
|
43
|
+
console.log(`[VectorDatabaseFactory] Using ChromaDB Vector Database (${platform}-${arch})`);
|
|
44
|
+
return chromaDb;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
console.warn(`[VectorDatabaseFactory] ChromaDB initialization failed: ${error}. Will use fallback.`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// Fallback: Use VSS (will fallback to cosine similarity if VSS not available)
|
|
52
|
+
console.warn(`[VectorDatabaseFactory] Optimized vector database not available. Using VSS with fallback to cosine similarity.`);
|
|
53
|
+
const vssDb = new vss_vector_database_1.VssVectorDatabase(db, vssLoader);
|
|
54
|
+
await vssDb.initialize(); // Will fail gracefully on Windows
|
|
55
|
+
return vssDb;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Checks if a platform-specific vector database is available.
|
|
59
|
+
*
|
|
60
|
+
* @returns true if an optimized vector database is available for the current platform
|
|
61
|
+
*/
|
|
62
|
+
static isOptimizedDatabaseAvailable() {
|
|
63
|
+
const platform = process.platform;
|
|
64
|
+
// VSS is available on macOS and Linux
|
|
65
|
+
if (platform === 'darwin' || platform === 'linux') {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
// ChromaDB is available on Windows (if installed)
|
|
69
|
+
if (platform === 'win32') {
|
|
70
|
+
try {
|
|
71
|
+
require('chromadb');
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.VectorDatabaseFactory = VectorDatabaseFactory;
|
|
82
|
+
//# sourceMappingURL=vector-database-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector-database-factory.js","sourceRoot":"","sources":["../../src/core/vector-database-factory.ts"],"names":[],"mappings":";;;AAGA,+DAA0D;AAC1D,yEAAoE;AAGpE;;;GAGG;AACH,MAAa,qBAAqB;IAC9B;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAoB,EAAE,SAAoB,EAAE,aAAqB;QACjF,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QAClC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAE1B,2BAA2B;QAC3B,IAAI,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;YAChD,MAAM,KAAK,GAAG,IAAI,uCAAiB,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;YAEnD,wBAAwB;YACxB,IAAI,CAAC;gBACD,MAAM,KAAK,CAAC,UAAU,EAAE,CAAC;gBACzB,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;oBACtB,OAAO,CAAC,GAAG,CAAC,sDAAsD,QAAQ,IAAI,IAAI,GAAG,CAAC,CAAC;oBACvF,OAAO,KAAK,CAAC;gBACjB,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,OAAO,CAAC,IAAI,CAAC,sDAAsD,KAAK,sBAAsB,CAAC,CAAC;YACpG,CAAC;QACL,CAAC;QAED,wBAAwB;QACxB,IAAI,QAAQ,KAAK,OAAO,EAAE,CA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3
|
+
* Abstracts VSS and external vector databases (e.g., ChromaDB).
|
|
4
|
+
*/
|
|
5
|
+
export interface VectorDatabase {
|
|
6
|
+
/**
|
|
7
|
+
* Checks if the vector database is available and ready to use.
|
|
8
|
+
*
|
|
9
|
+
* @returns true if available, false otherwise
|
|
10
|
+
*/
|
|
11
|
+
isAvailable(): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Initializes the vector database.
|
|
14
|
+
* Must be called before using other methods.
|
|
15
|
+
*
|
|
16
|
+
* @returns Promise that resolves when initialization is complete
|
|
17
|
+
*/
|
|
18
|
+
initialize(): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Upserts (inserts or updates) an embedding vector.
|
|
21
|
+
*
|
|
22
|
+
* @param embeddingId The unique identifier for the embedding
|
|
23
|
+
* @param embeddingVector The embedding vector (1536 dimensions)
|
|
24
|
+
* @returns Promise that resolves when the embedding is upserted
|
|
25
|
+
*/
|
|
26
|
+
upsertEmbedding(embeddingId: string, embeddingVector: Float32Array | number[]): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Searches for similar embeddings using vector similarity search.
|
|
29
|
+
*
|
|
30
|
+
* @param queryEmbedding The query embedding vector
|
|
31
|
+
* @param limit Maximum number of results to return
|
|
32
|
+
* @param dimension Optional: Filter by dimension (X, Y, Z, W, T)
|
|
33
|
+
* @param pluginId Optional: Filter by plugin ID
|
|
34
|
+
* @returns Promise that resolves to an array of search results with rowid and distance/similarity score
|
|
35
|
+
*/
|
|
36
|
+
search(queryEmbedding: Float32Array | number[], limit: number, dimension?: 'X' | 'Y' | 'Z' | 'W' | 'T', pluginId?: string): Promise<Array<{
|
|
37
|
+
rowid: number;
|
|
38
|
+
distance: number;
|
|
39
|
+
similarity?: number;
|
|
40
|
+
}>>;
|
|
41
|
+
/**
|
|
42
|
+
* Gets the embedding ID from a rowid.
|
|
43
|
+
* This is needed for mapping VSS rowids back to embedding IDs.
|
|
44
|
+
*
|
|
45
|
+
* @param rowid The rowid from the search result
|
|
46
|
+
* @returns Promise that resolves to the embedding ID, or null if not found
|
|
47
|
+
*/
|
|
48
|
+
getEmbeddingIdFromRowid(rowid: number): Promise<string | null>;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=vector-database-interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector-database-interface.d.ts","sourceRoot":"","sources":["../../src/core/vector-database-interface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC3B;;;;OAIG;IACH,WAAW,IAAI,OAAO,CAAC;IAEvB;;;;;OAKG;IACH,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5B;;;;;;OAMG;IACH,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,YAAY,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9F;;;;;;;;OAQG;IACH,MAAM,CACF,cAAc,EAAE,YAAY,GAAG,MAAM,EAAE,EACvC,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,EACvC,QAAQ,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;IAE5E;;;;;;OAMG;IACH,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAClE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector-database-interface.js","sourceRoot":"","sources":["../../src/core/vector-database-interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as sqlite3 from 'sqlite3';
|
|
2
|
+
/**
|
|
3
|
+
* Loads SQLite VSS Extension for vector similarity search.
|
|
4
|
+
* Uses sqlite-vss package if available, otherwise falls back to manual path resolution.
|
|
5
|
+
*/
|
|
6
|
+
export declare class VssLoader {
|
|
7
|
+
/**
|
|
8
|
+
* Loads the VSS extension into the given database.
|
|
9
|
+
*
|
|
10
|
+
* @param db The SQLite database instance
|
|
11
|
+
*/
|
|
12
|
+
loadExtension(db: sqlite3.Database): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Gets the path to the VSS extension binary for the current platform.
|
|
15
|
+
* Fallback method if sqlite-vss package is not available.
|
|
16
|
+
*
|
|
17
|
+
* @param platform The platform (win32, linux, darwin)
|
|
18
|
+
* @param arch The architecture (x64, arm64, etc.)
|
|
19
|
+
* @returns Path to the VSS extension binary
|
|
20
|
+
*/
|
|
21
|
+
private getVssPath;
|
|
22
|
+
/**
|
|
23
|
+
* Checks if VSS extension is available.
|
|
24
|
+
*
|
|
25
|
+
* @returns true if VSS extension is available, false otherwise
|
|
26
|
+
*/
|
|
27
|
+
isAvailable(): boolean;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=vss-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vss-loader.d.ts","sourceRoot":"","sources":["../../src/core/vss-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAYnC;;;GAGG;AACH,qBAAa,SAAS;IAClB;;;;OAIG;IACG,aAAa,CAAC,EAAE,EAAE,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IA2CxD;;;;;;;OAOG;IACH,OAAO,CAAC,UAAU;IAsBlB;;;;OAIG;IACH,WAAW,IAAI,OAAO;CAmBzB"}
|