agentdb 1.0.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/LICENSE +38 -0
- package/LICENSE-APACHE +190 -0
- package/LICENSE-MIT +21 -0
- package/README.md +953 -0
- package/bin/agentdb.js +485 -0
- package/bin/plugin-cli-wrapper.mjs +21 -0
- package/dist/cache/query-cache.d.ts +105 -0
- package/dist/cache/query-cache.d.ts.map +1 -0
- package/dist/cache/query-cache.js +224 -0
- package/dist/cache/query-cache.js.map +1 -0
- package/dist/cache/query-cache.mjs +219 -0
- package/dist/cli/cache/query-cache.d.ts +104 -0
- package/dist/cli/cache/query-cache.js +244 -0
- package/dist/cli/cli/db-commands.d.ts +48 -0
- package/dist/cli/cli/db-commands.js +613 -0
- package/dist/cli/commands.d.ts +7 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +113 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/commands.mjs +104 -0
- package/dist/cli/core/backend-interface.d.ts +70 -0
- package/dist/cli/core/backend-interface.js +15 -0
- package/dist/cli/core/native-backend.d.ts +140 -0
- package/dist/cli/core/native-backend.js +432 -0
- package/dist/cli/core/vector-db.d.ts +126 -0
- package/dist/cli/core/vector-db.js +338 -0
- package/dist/cli/core/wasm-backend.d.ts +95 -0
- package/dist/cli/core/wasm-backend.js +418 -0
- package/dist/cli/db-commands.d.ts +49 -0
- package/dist/cli/db-commands.d.ts.map +1 -0
- package/dist/cli/db-commands.js +533 -0
- package/dist/cli/db-commands.js.map +1 -0
- package/dist/cli/db-commands.mjs +522 -0
- package/dist/cli/generator.d.ts +11 -0
- package/dist/cli/generator.d.ts.map +1 -0
- package/dist/cli/generator.js +567 -0
- package/dist/cli/generator.js.map +1 -0
- package/dist/cli/generator.mjs +527 -0
- package/dist/cli/help.d.ts +18 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/help.js +676 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/help.mjs +667 -0
- package/dist/cli/index/hnsw.d.ts +164 -0
- package/dist/cli/index/hnsw.js +558 -0
- package/dist/cli/plugin-cli.d.ts +7 -0
- package/dist/cli/plugin-cli.d.ts.map +1 -0
- package/dist/cli/plugin-cli.js +295 -0
- package/dist/cli/plugin-cli.js.map +1 -0
- package/dist/cli/plugin-cli.mjs +289 -0
- package/dist/cli/quantization/product-quantization.d.ts +108 -0
- package/dist/cli/quantization/product-quantization.js +350 -0
- package/dist/cli/query/query-builder.d.ts +322 -0
- package/dist/cli/query/query-builder.js +600 -0
- package/dist/cli/templates.d.ts +14 -0
- package/dist/cli/templates.d.ts.map +1 -0
- package/dist/cli/templates.js +182 -0
- package/dist/cli/templates.js.map +1 -0
- package/dist/cli/templates.mjs +176 -0
- package/dist/cli/types/index.d.ts +116 -0
- package/dist/cli/types/index.js +5 -0
- package/dist/cli/types.d.ts +91 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +6 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/types.mjs +4 -0
- package/dist/cli/wizard/index.d.ts +6 -0
- package/dist/cli/wizard/index.d.ts.map +1 -0
- package/dist/cli/wizard/index.js +138 -0
- package/dist/cli/wizard/index.js.map +1 -0
- package/dist/cli/wizard/index.mjs +131 -0
- package/dist/cli/wizard/prompts.d.ts +11 -0
- package/dist/cli/wizard/prompts.d.ts.map +1 -0
- package/dist/cli/wizard/prompts.js +482 -0
- package/dist/cli/wizard/prompts.js.map +1 -0
- package/dist/cli/wizard/prompts.mjs +470 -0
- package/dist/cli/wizard/validator.d.ts +13 -0
- package/dist/cli/wizard/validator.d.ts.map +1 -0
- package/dist/cli/wizard/validator.js +234 -0
- package/dist/cli/wizard/validator.js.map +1 -0
- package/dist/cli/wizard/validator.mjs +224 -0
- package/dist/core/backend-interface.d.ts +71 -0
- package/dist/core/backend-interface.d.ts.map +1 -0
- package/dist/core/backend-interface.js +16 -0
- package/dist/core/backend-interface.js.map +1 -0
- package/dist/core/backend-interface.mjs +12 -0
- package/dist/core/native-backend.d.ts +141 -0
- package/dist/core/native-backend.d.ts.map +1 -0
- package/dist/core/native-backend.js +457 -0
- package/dist/core/native-backend.js.map +1 -0
- package/dist/core/native-backend.mjs +449 -0
- package/dist/core/vector-db.d.ts +127 -0
- package/dist/core/vector-db.d.ts.map +1 -0
- package/dist/core/vector-db.js +266 -0
- package/dist/core/vector-db.js.map +1 -0
- package/dist/core/vector-db.mjs +261 -0
- package/dist/core/wasm-backend.d.ts +96 -0
- package/dist/core/wasm-backend.d.ts.map +1 -0
- package/dist/core/wasm-backend.js +393 -0
- package/dist/core/wasm-backend.js.map +1 -0
- package/dist/core/wasm-backend.mjs +385 -0
- package/dist/index/hnsw-optimized.d.ts +75 -0
- package/dist/index/hnsw-optimized.d.ts.map +1 -0
- package/dist/index/hnsw-optimized.js +412 -0
- package/dist/index/hnsw-optimized.js.map +1 -0
- package/dist/index/hnsw-optimized.mjs +407 -0
- package/dist/index/hnsw.d.ts +165 -0
- package/dist/index/hnsw.d.ts.map +1 -0
- package/dist/index/hnsw.js +521 -0
- package/dist/index/hnsw.js.map +1 -0
- package/dist/index/hnsw.mjs +516 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +82 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +63 -0
- package/dist/mcp-server.d.ts +27 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +789 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/mcp-server.mjs +784 -0
- package/dist/plugins/base-plugin.d.ts +114 -0
- package/dist/plugins/base-plugin.d.ts.map +1 -0
- package/dist/plugins/base-plugin.js +313 -0
- package/dist/plugins/base-plugin.js.map +1 -0
- package/dist/plugins/base-plugin.mjs +275 -0
- package/dist/plugins/implementations/active-learning.d.ts +135 -0
- package/dist/plugins/implementations/active-learning.d.ts.map +1 -0
- package/dist/plugins/implementations/active-learning.js +372 -0
- package/dist/plugins/implementations/active-learning.js.map +1 -0
- package/dist/plugins/implementations/active-learning.mjs +367 -0
- package/dist/plugins/implementations/actor-critic.d.ts +64 -0
- package/dist/plugins/implementations/actor-critic.d.ts.map +1 -0
- package/dist/plugins/implementations/actor-critic.js +363 -0
- package/dist/plugins/implementations/actor-critic.js.map +1 -0
- package/dist/plugins/implementations/actor-critic.mjs +358 -0
- package/dist/plugins/implementations/adversarial-training.d.ts +133 -0
- package/dist/plugins/implementations/adversarial-training.d.ts.map +1 -0
- package/dist/plugins/implementations/adversarial-training.js +409 -0
- package/dist/plugins/implementations/adversarial-training.js.map +1 -0
- package/dist/plugins/implementations/adversarial-training.mjs +404 -0
- package/dist/plugins/implementations/curriculum-learning.d.ts +132 -0
- package/dist/plugins/implementations/curriculum-learning.d.ts.map +1 -0
- package/dist/plugins/implementations/curriculum-learning.js +354 -0
- package/dist/plugins/implementations/curriculum-learning.js.map +1 -0
- package/dist/plugins/implementations/curriculum-learning.mjs +349 -0
- package/dist/plugins/implementations/decision-transformer.d.ts +77 -0
- package/dist/plugins/implementations/decision-transformer.d.ts.map +1 -0
- package/dist/plugins/implementations/decision-transformer.js +422 -0
- package/dist/plugins/implementations/decision-transformer.js.map +1 -0
- package/dist/plugins/implementations/decision-transformer.mjs +417 -0
- package/dist/plugins/implementations/federated-learning.d.ts +126 -0
- package/dist/plugins/implementations/federated-learning.d.ts.map +1 -0
- package/dist/plugins/implementations/federated-learning.js +436 -0
- package/dist/plugins/implementations/federated-learning.js.map +1 -0
- package/dist/plugins/implementations/federated-learning.mjs +431 -0
- package/dist/plugins/implementations/index.d.ts +30 -0
- package/dist/plugins/implementations/index.d.ts.map +1 -0
- package/dist/plugins/implementations/index.js +45 -0
- package/dist/plugins/implementations/index.js.map +1 -0
- package/dist/plugins/implementations/index.mjs +31 -0
- package/dist/plugins/implementations/multi-task-learning.d.ts +115 -0
- package/dist/plugins/implementations/multi-task-learning.d.ts.map +1 -0
- package/dist/plugins/implementations/multi-task-learning.js +369 -0
- package/dist/plugins/implementations/multi-task-learning.js.map +1 -0
- package/dist/plugins/implementations/multi-task-learning.mjs +364 -0
- package/dist/plugins/implementations/neural-architecture-search.d.ts +148 -0
- package/dist/plugins/implementations/neural-architecture-search.d.ts.map +1 -0
- package/dist/plugins/implementations/neural-architecture-search.js +379 -0
- package/dist/plugins/implementations/neural-architecture-search.js.map +1 -0
- package/dist/plugins/implementations/neural-architecture-search.mjs +374 -0
- package/dist/plugins/implementations/q-learning.d.ts +98 -0
- package/dist/plugins/implementations/q-learning.d.ts.map +1 -0
- package/dist/plugins/implementations/q-learning.js +435 -0
- package/dist/plugins/implementations/q-learning.js.map +1 -0
- package/dist/plugins/implementations/q-learning.mjs +430 -0
- package/dist/plugins/implementations/sarsa.d.ts +103 -0
- package/dist/plugins/implementations/sarsa.d.ts.map +1 -0
- package/dist/plugins/implementations/sarsa.js +347 -0
- package/dist/plugins/implementations/sarsa.js.map +1 -0
- package/dist/plugins/implementations/sarsa.mjs +342 -0
- package/dist/plugins/index.d.ts +107 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +179 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/index.mjs +168 -0
- package/dist/plugins/interface.d.ts +439 -0
- package/dist/plugins/interface.d.ts.map +1 -0
- package/dist/plugins/interface.js +12 -0
- package/dist/plugins/interface.js.map +1 -0
- package/dist/plugins/interface.mjs +10 -0
- package/dist/plugins/learning-plugin.interface.d.ts +257 -0
- package/dist/plugins/learning-plugin.interface.d.ts.map +1 -0
- package/dist/plugins/learning-plugin.interface.js +7 -0
- package/dist/plugins/learning-plugin.interface.js.map +1 -0
- package/dist/plugins/learning-plugin.interface.mjs +5 -0
- package/dist/plugins/plugin-exports.d.ts +71 -0
- package/dist/plugins/plugin-exports.d.ts.map +1 -0
- package/dist/plugins/plugin-exports.js +78 -0
- package/dist/plugins/plugin-exports.js.map +1 -0
- package/dist/plugins/plugin-exports.mjs +69 -0
- package/dist/plugins/registry.d.ts +206 -0
- package/dist/plugins/registry.d.ts.map +1 -0
- package/dist/plugins/registry.js +365 -0
- package/dist/plugins/registry.js.map +1 -0
- package/dist/plugins/registry.mjs +356 -0
- package/dist/plugins/validator.d.ts +63 -0
- package/dist/plugins/validator.d.ts.map +1 -0
- package/dist/plugins/validator.js +464 -0
- package/dist/plugins/validator.js.map +1 -0
- package/dist/plugins/validator.mjs +458 -0
- package/dist/quantization/binary-quantization.d.ts +104 -0
- package/dist/quantization/binary-quantization.d.ts.map +1 -0
- package/dist/quantization/binary-quantization.js +246 -0
- package/dist/quantization/binary-quantization.js.map +1 -0
- package/dist/quantization/binary-quantization.mjs +240 -0
- package/dist/quantization/optimized-pq.d.ts +138 -0
- package/dist/quantization/optimized-pq.d.ts.map +1 -0
- package/dist/quantization/optimized-pq.js +320 -0
- package/dist/quantization/optimized-pq.js.map +1 -0
- package/dist/quantization/optimized-pq.mjs +313 -0
- package/dist/quantization/product-quantization.d.ts +109 -0
- package/dist/quantization/product-quantization.d.ts.map +1 -0
- package/dist/quantization/product-quantization.js +287 -0
- package/dist/quantization/product-quantization.js.map +1 -0
- package/dist/quantization/product-quantization.mjs +282 -0
- package/dist/quantization/scalar-quantization.d.ts +100 -0
- package/dist/quantization/scalar-quantization.d.ts.map +1 -0
- package/dist/quantization/scalar-quantization.js +324 -0
- package/dist/quantization/scalar-quantization.js.map +1 -0
- package/dist/quantization/scalar-quantization.mjs +319 -0
- package/dist/query/index.d.ts +6 -0
- package/dist/query/index.d.ts.map +1 -0
- package/dist/query/index.js +9 -0
- package/dist/query/index.js.map +1 -0
- package/dist/query/index.mjs +4 -0
- package/dist/query/query-builder.d.ts +323 -0
- package/dist/query/query-builder.d.ts.map +1 -0
- package/dist/query/query-builder.js +524 -0
- package/dist/query/query-builder.js.map +1 -0
- package/dist/query/query-builder.mjs +519 -0
- package/dist/reasoning/context-synthesizer.d.ts +57 -0
- package/dist/reasoning/context-synthesizer.d.ts.map +1 -0
- package/dist/reasoning/context-synthesizer.js +224 -0
- package/dist/reasoning/context-synthesizer.js.map +1 -0
- package/dist/reasoning/context-synthesizer.mjs +219 -0
- package/dist/reasoning/experience-curator.d.ts +66 -0
- package/dist/reasoning/experience-curator.d.ts.map +1 -0
- package/dist/reasoning/experience-curator.js +288 -0
- package/dist/reasoning/experience-curator.js.map +1 -0
- package/dist/reasoning/experience-curator.mjs +283 -0
- package/dist/reasoning/memory-optimizer.d.ts +69 -0
- package/dist/reasoning/memory-optimizer.d.ts.map +1 -0
- package/dist/reasoning/memory-optimizer.js +331 -0
- package/dist/reasoning/memory-optimizer.js.map +1 -0
- package/dist/reasoning/memory-optimizer.mjs +326 -0
- package/dist/reasoning/pattern-matcher.d.ts +59 -0
- package/dist/reasoning/pattern-matcher.d.ts.map +1 -0
- package/dist/reasoning/pattern-matcher.js +229 -0
- package/dist/reasoning/pattern-matcher.js.map +1 -0
- package/dist/reasoning/pattern-matcher.mjs +224 -0
- package/dist/reasoningbank/adapter/agentdb-adapter.d.ts +118 -0
- package/dist/reasoningbank/adapter/agentdb-adapter.d.ts.map +1 -0
- package/dist/reasoningbank/adapter/agentdb-adapter.js +477 -0
- package/dist/reasoningbank/adapter/agentdb-adapter.js.map +1 -0
- package/dist/reasoningbank/adapter/types.d.ts +113 -0
- package/dist/reasoningbank/adapter/types.d.ts.map +1 -0
- package/dist/reasoningbank/adapter/types.js +9 -0
- package/dist/reasoningbank/adapter/types.js.map +1 -0
- package/dist/reasoningbank/cli/commands.d.ts +16 -0
- package/dist/reasoningbank/cli/commands.d.ts.map +1 -0
- package/dist/reasoningbank/cli/commands.js +272 -0
- package/dist/reasoningbank/cli/commands.js.map +1 -0
- package/dist/reasoningbank/mcp/agentdb-tools.d.ts +319 -0
- package/dist/reasoningbank/mcp/agentdb-tools.d.ts.map +1 -0
- package/dist/reasoningbank/mcp/agentdb-tools.js +301 -0
- package/dist/reasoningbank/mcp/agentdb-tools.js.map +1 -0
- package/dist/reasoningbank/migration/migrate.d.ts +25 -0
- package/dist/reasoningbank/migration/migrate.d.ts.map +1 -0
- package/dist/reasoningbank/migration/migrate.js +178 -0
- package/dist/reasoningbank/migration/migrate.js.map +1 -0
- package/dist/reasoningbank/reasoning/context-synthesizer.d.ts +37 -0
- package/dist/reasoningbank/reasoning/context-synthesizer.d.ts.map +1 -0
- package/dist/reasoningbank/reasoning/context-synthesizer.js +114 -0
- package/dist/reasoningbank/reasoning/context-synthesizer.js.map +1 -0
- package/dist/reasoningbank/reasoning/experience-curator.d.ts +39 -0
- package/dist/reasoningbank/reasoning/experience-curator.d.ts.map +1 -0
- package/dist/reasoningbank/reasoning/experience-curator.js +98 -0
- package/dist/reasoningbank/reasoning/experience-curator.js.map +1 -0
- package/dist/reasoningbank/reasoning/memory-optimizer.d.ts +44 -0
- package/dist/reasoningbank/reasoning/memory-optimizer.d.ts.map +1 -0
- package/dist/reasoningbank/reasoning/memory-optimizer.js +184 -0
- package/dist/reasoningbank/reasoning/memory-optimizer.js.map +1 -0
- package/dist/reasoningbank/reasoning/pattern-matcher.d.ts +40 -0
- package/dist/reasoningbank/reasoning/pattern-matcher.d.ts.map +1 -0
- package/dist/reasoningbank/reasoning/pattern-matcher.js +87 -0
- package/dist/reasoningbank/reasoning/pattern-matcher.js.map +1 -0
- package/dist/reasoningbank/sync/quic-sync.d.ts +77 -0
- package/dist/reasoningbank/sync/quic-sync.d.ts.map +1 -0
- package/dist/reasoningbank/sync/quic-sync.js +165 -0
- package/dist/reasoningbank/sync/quic-sync.js.map +1 -0
- package/dist/sync/conflict.d.ts +78 -0
- package/dist/sync/conflict.d.ts.map +1 -0
- package/dist/sync/conflict.js +202 -0
- package/dist/sync/conflict.js.map +1 -0
- package/dist/sync/conflict.mjs +196 -0
- package/dist/sync/coordinator.d.ts +111 -0
- package/dist/sync/coordinator.d.ts.map +1 -0
- package/dist/sync/coordinator.js +256 -0
- package/dist/sync/coordinator.js.map +1 -0
- package/dist/sync/coordinator.mjs +250 -0
- package/dist/sync/delta.d.ts +81 -0
- package/dist/sync/delta.d.ts.map +1 -0
- package/dist/sync/delta.js +245 -0
- package/dist/sync/delta.js.map +1 -0
- package/dist/sync/delta.mjs +238 -0
- package/dist/sync/index.d.ts +11 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +22 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/index.mjs +9 -0
- package/dist/sync/quic-sync.d.ts +81 -0
- package/dist/sync/quic-sync.d.ts.map +1 -0
- package/dist/sync/quic-sync.js +329 -0
- package/dist/sync/quic-sync.js.map +1 -0
- package/dist/sync/quic-sync.mjs +323 -0
- package/dist/sync/types.d.ts +168 -0
- package/dist/sync/types.d.ts.map +1 -0
- package/dist/sync/types.js +8 -0
- package/dist/sync/types.js.map +1 -0
- package/dist/sync/types.mjs +6 -0
- package/dist/types/index.d.ts +117 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +4 -0
- package/dist/wasm-loader.d.ts +32 -0
- package/dist/wasm-loader.d.ts.map +1 -0
- package/dist/wasm-loader.js +75 -0
- package/dist/wasm-loader.js.map +1 -0
- package/dist/wasm-loader.mjs +64 -0
- package/examples/adaptive-learning.ts +284 -0
- package/examples/browser/README.md +732 -0
- package/examples/browser/adaptive-recommendations/index.html +427 -0
- package/examples/browser/collaborative-filtering/index.html +310 -0
- package/examples/browser/continual-learning/index.html +736 -0
- package/examples/browser/experience-replay/index.html +616 -0
- package/examples/browser/index.html +369 -0
- package/examples/browser/meta-learning/index.html +789 -0
- package/examples/browser/neuro-symbolic/index.html +692 -0
- package/examples/browser/pattern-learning/index.html +620 -0
- package/examples/browser/quantum-inspired/index.html +728 -0
- package/examples/browser/rag/index.html +624 -0
- package/examples/browser/swarm-intelligence/index.html +811 -0
- package/examples/browser-basic.html +170 -0
- package/examples/hnsw-example.ts +148 -0
- package/examples/node-basic.js +70 -0
- package/examples/quic-sync-example.ts +310 -0
- package/examples/quick-start.js +68 -0
- package/examples/wasm-example.ts +222 -0
- package/package.json +118 -0
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* WASM backend implementation using sql.js
|
|
4
|
+
* Provides browser-compatible vector database operations
|
|
5
|
+
*/
|
|
6
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
16
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
17
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
18
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
19
|
+
function step(op) {
|
|
20
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
21
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
22
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
23
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
24
|
+
switch (op[0]) {
|
|
25
|
+
case 0: case 1: t = op; break;
|
|
26
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
27
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
28
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
29
|
+
default:
|
|
30
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
31
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
32
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
33
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
34
|
+
if (t[2]) _.ops.pop();
|
|
35
|
+
_.trys.pop(); continue;
|
|
36
|
+
}
|
|
37
|
+
op = body.call(thisArg, _);
|
|
38
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
39
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
43
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.WasmBackend = void 0;
|
|
47
|
+
var sql_js_1 = __importDefault(require("sql.js"));
|
|
48
|
+
/**
|
|
49
|
+
* WASM backend using sql.js
|
|
50
|
+
* Runs in both Node.js and browser environments
|
|
51
|
+
*/
|
|
52
|
+
var WasmBackend = /** @class */ (function () {
|
|
53
|
+
function WasmBackend() {
|
|
54
|
+
this.SQL = null;
|
|
55
|
+
this.db = null;
|
|
56
|
+
this.initialized = false;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Initialize the WASM backend
|
|
60
|
+
*/
|
|
61
|
+
WasmBackend.prototype.initializeAsync = function () {
|
|
62
|
+
return __awaiter(this, arguments, void 0, function (config) {
|
|
63
|
+
var _a;
|
|
64
|
+
if (config === void 0) { config = {}; }
|
|
65
|
+
return __generator(this, function (_b) {
|
|
66
|
+
switch (_b.label) {
|
|
67
|
+
case 0:
|
|
68
|
+
if (this.initialized) {
|
|
69
|
+
return [2 /*return*/];
|
|
70
|
+
}
|
|
71
|
+
// Load sql.js WASM module
|
|
72
|
+
_a = this;
|
|
73
|
+
return [4 /*yield*/, (0, sql_js_1.default)({
|
|
74
|
+
// Use CDN for WASM binary in browser, local file in Node.js
|
|
75
|
+
locateFile: function (file) {
|
|
76
|
+
if (typeof window !== 'undefined') {
|
|
77
|
+
return "https://sql.js.org/dist/".concat(file);
|
|
78
|
+
}
|
|
79
|
+
return "node_modules/sql.js/dist/".concat(file);
|
|
80
|
+
}
|
|
81
|
+
})];
|
|
82
|
+
case 1:
|
|
83
|
+
// Load sql.js WASM module
|
|
84
|
+
_a.SQL = _b.sent();
|
|
85
|
+
// Create database
|
|
86
|
+
this.db = new this.SQL.Database();
|
|
87
|
+
// Initialize schema and functions
|
|
88
|
+
this.initializeSchema(config);
|
|
89
|
+
this.registerCustomFunctions();
|
|
90
|
+
this.initialized = true;
|
|
91
|
+
return [2 /*return*/];
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Synchronous initialization (throws if not already initialized)
|
|
98
|
+
*/
|
|
99
|
+
WasmBackend.prototype.initialize = function (config) {
|
|
100
|
+
if (config === void 0) { config = {}; }
|
|
101
|
+
if (!this.initialized) {
|
|
102
|
+
throw new Error('WASM backend must be initialized asynchronously. Call initializeAsync() first.');
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Initialize database schema
|
|
107
|
+
*/
|
|
108
|
+
WasmBackend.prototype.initializeSchema = function (config) {
|
|
109
|
+
if (!this.db)
|
|
110
|
+
throw new Error('Database not initialized');
|
|
111
|
+
var _a = config.cacheSize, cacheSize = _a === void 0 ? 100 * 1024 : _a, _b = config.walMode, walMode = _b === void 0 ? false : _b, // WAL not supported in sql.js
|
|
112
|
+
_c = config.mmapSize, // WAL not supported in sql.js
|
|
113
|
+
mmapSize = _c === void 0 ? 256 * 1024 * 1024 : _c;
|
|
114
|
+
// Configure SQLite (limited options in sql.js)
|
|
115
|
+
this.db.run('PRAGMA journal_mode = MEMORY');
|
|
116
|
+
this.db.run('PRAGMA synchronous = OFF'); // Safe for in-memory
|
|
117
|
+
this.db.run("PRAGMA cache_size = -".concat(cacheSize));
|
|
118
|
+
this.db.run('PRAGMA temp_store = MEMORY');
|
|
119
|
+
this.db.run('PRAGMA page_size = 4096');
|
|
120
|
+
// Create vectors table
|
|
121
|
+
this.db.run("\n CREATE TABLE IF NOT EXISTS vectors (\n id TEXT PRIMARY KEY,\n embedding BLOB NOT NULL,\n norm REAL NOT NULL,\n metadata TEXT,\n timestamp INTEGER NOT NULL\n )\n ");
|
|
122
|
+
// Create indexes
|
|
123
|
+
this.db.run('CREATE INDEX IF NOT EXISTS idx_vectors_norm ON vectors(norm)');
|
|
124
|
+
this.db.run('CREATE INDEX IF NOT EXISTS idx_vectors_timestamp ON vectors(timestamp)');
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Register custom SQL functions for similarity calculations
|
|
128
|
+
*/
|
|
129
|
+
WasmBackend.prototype.registerCustomFunctions = function () {
|
|
130
|
+
if (!this.db)
|
|
131
|
+
throw new Error('Database not initialized');
|
|
132
|
+
// Cosine similarity function
|
|
133
|
+
this.db.create_function('cosine_similarity', function (embeddingA, embeddingB, normA, normB) {
|
|
134
|
+
var arrA = new Float32Array(embeddingA.buffer, embeddingA.byteOffset, embeddingA.byteLength / 4);
|
|
135
|
+
var arrB = new Float32Array(embeddingB.buffer, embeddingB.byteOffset, embeddingB.byteLength / 4);
|
|
136
|
+
var dotProduct = 0;
|
|
137
|
+
var len = Math.min(arrA.length, arrB.length);
|
|
138
|
+
for (var i = 0; i < len; i++) {
|
|
139
|
+
dotProduct += arrA[i] * arrB[i];
|
|
140
|
+
}
|
|
141
|
+
return dotProduct / (normA * normB);
|
|
142
|
+
});
|
|
143
|
+
// Euclidean distance function
|
|
144
|
+
this.db.create_function('euclidean_distance', function (embeddingA, embeddingB) {
|
|
145
|
+
var arrA = new Float32Array(embeddingA.buffer, embeddingA.byteOffset, embeddingA.byteLength / 4);
|
|
146
|
+
var arrB = new Float32Array(embeddingB.buffer, embeddingB.byteOffset, embeddingB.byteLength / 4);
|
|
147
|
+
var sum = 0;
|
|
148
|
+
var len = Math.min(arrA.length, arrB.length);
|
|
149
|
+
for (var i = 0; i < len; i++) {
|
|
150
|
+
var diff = arrA[i] - arrB[i];
|
|
151
|
+
sum += diff * diff;
|
|
152
|
+
}
|
|
153
|
+
return Math.sqrt(sum);
|
|
154
|
+
});
|
|
155
|
+
// Dot product function
|
|
156
|
+
this.db.create_function('dot_product', function (embeddingA, embeddingB) {
|
|
157
|
+
var arrA = new Float32Array(embeddingA.buffer, embeddingA.byteOffset, embeddingA.byteLength / 4);
|
|
158
|
+
var arrB = new Float32Array(embeddingB.buffer, embeddingB.byteOffset, embeddingB.byteLength / 4);
|
|
159
|
+
var dotProduct = 0;
|
|
160
|
+
var len = Math.min(arrA.length, arrB.length);
|
|
161
|
+
for (var i = 0; i < len; i++) {
|
|
162
|
+
dotProduct += arrA[i] * arrB[i];
|
|
163
|
+
}
|
|
164
|
+
return dotProduct;
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Calculate L2 norm of a vector
|
|
169
|
+
*/
|
|
170
|
+
WasmBackend.prototype.calculateNorm = function (embedding) {
|
|
171
|
+
var sum = 0;
|
|
172
|
+
for (var _i = 0, embedding_1 = embedding; _i < embedding_1.length; _i++) {
|
|
173
|
+
var val = embedding_1[_i];
|
|
174
|
+
sum += val * val;
|
|
175
|
+
}
|
|
176
|
+
return Math.sqrt(sum);
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Serialize embedding to Uint8Array (binary format)
|
|
180
|
+
*/
|
|
181
|
+
WasmBackend.prototype.serializeEmbedding = function (embedding) {
|
|
182
|
+
var buffer = new ArrayBuffer(embedding.length * 4);
|
|
183
|
+
var view = new Float32Array(buffer);
|
|
184
|
+
view.set(embedding);
|
|
185
|
+
return new Uint8Array(buffer);
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* Deserialize embedding from Uint8Array
|
|
189
|
+
*/
|
|
190
|
+
WasmBackend.prototype.deserializeEmbedding = function (buffer) {
|
|
191
|
+
var view = new Float32Array(buffer.buffer, buffer.byteOffset, buffer.byteLength / 4);
|
|
192
|
+
return Array.from(view);
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Generate unique ID
|
|
196
|
+
*/
|
|
197
|
+
WasmBackend.prototype.generateId = function () {
|
|
198
|
+
return "vec_".concat(Date.now(), "_").concat(Math.random().toString(36).substr(2, 9));
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Insert a single vector
|
|
202
|
+
*/
|
|
203
|
+
WasmBackend.prototype.insert = function (vector) {
|
|
204
|
+
if (!this.db)
|
|
205
|
+
throw new Error('Database not initialized');
|
|
206
|
+
var id = vector.id || this.generateId();
|
|
207
|
+
var norm = this.calculateNorm(vector.embedding);
|
|
208
|
+
var embedding = this.serializeEmbedding(vector.embedding);
|
|
209
|
+
var metadata = vector.metadata ? JSON.stringify(vector.metadata) : null;
|
|
210
|
+
var timestamp = vector.timestamp || Date.now();
|
|
211
|
+
this.db.run('INSERT OR REPLACE INTO vectors (id, embedding, norm, metadata, timestamp) VALUES (?, ?, ?, ?, ?)', [id, embedding, norm, metadata, timestamp]);
|
|
212
|
+
return id;
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Insert multiple vectors in a transaction with optimized batch processing
|
|
216
|
+
* Performance improvements:
|
|
217
|
+
* - Single transaction for all inserts
|
|
218
|
+
* - Prepared statement created once and reused
|
|
219
|
+
* - No wrapper function overhead
|
|
220
|
+
* - Chunked processing for large batches
|
|
221
|
+
*/
|
|
222
|
+
WasmBackend.prototype.insertBatch = function (vectors) {
|
|
223
|
+
var _this = this;
|
|
224
|
+
if (!this.db)
|
|
225
|
+
throw new Error('Database not initialized');
|
|
226
|
+
var ids = [];
|
|
227
|
+
var CHUNK_SIZE = 5000; // Process in chunks to avoid memory spikes
|
|
228
|
+
// Helper function to process a chunk of vectors
|
|
229
|
+
var processChunk = function (chunk) {
|
|
230
|
+
var chunkIds = [];
|
|
231
|
+
_this.db.run('BEGIN TRANSACTION');
|
|
232
|
+
try {
|
|
233
|
+
// Prepare statement once for all inserts in this chunk
|
|
234
|
+
var stmt = _this.db.prepare('INSERT OR REPLACE INTO vectors (id, embedding, norm, metadata, timestamp) VALUES (?, ?, ?, ?, ?)');
|
|
235
|
+
try {
|
|
236
|
+
// Reuse the prepared statement for all inserts
|
|
237
|
+
for (var _i = 0, chunk_1 = chunk; _i < chunk_1.length; _i++) {
|
|
238
|
+
var vector = chunk_1[_i];
|
|
239
|
+
var id = vector.id || _this.generateId();
|
|
240
|
+
var norm = _this.calculateNorm(vector.embedding);
|
|
241
|
+
var embedding = _this.serializeEmbedding(vector.embedding);
|
|
242
|
+
var metadata = vector.metadata ? JSON.stringify(vector.metadata) : null;
|
|
243
|
+
var timestamp = vector.timestamp || Date.now();
|
|
244
|
+
stmt.bind([id, embedding, norm, metadata, timestamp]);
|
|
245
|
+
stmt.step();
|
|
246
|
+
stmt.reset();
|
|
247
|
+
chunkIds.push(id);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
finally {
|
|
251
|
+
stmt.free();
|
|
252
|
+
}
|
|
253
|
+
_this.db.run('COMMIT');
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
_this.db.run('ROLLBACK');
|
|
257
|
+
throw error;
|
|
258
|
+
}
|
|
259
|
+
return chunkIds;
|
|
260
|
+
};
|
|
261
|
+
// Process vectors in chunks
|
|
262
|
+
if (vectors.length <= CHUNK_SIZE) {
|
|
263
|
+
// Small batch - process directly
|
|
264
|
+
ids.push.apply(ids, processChunk(vectors));
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
// Large batch - process in chunks to manage memory
|
|
268
|
+
for (var i = 0; i < vectors.length; i += CHUNK_SIZE) {
|
|
269
|
+
var chunk = vectors.slice(i, i + CHUNK_SIZE);
|
|
270
|
+
ids.push.apply(ids, processChunk(chunk));
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return ids;
|
|
274
|
+
};
|
|
275
|
+
/**
|
|
276
|
+
* Search for k-nearest neighbors
|
|
277
|
+
*/
|
|
278
|
+
WasmBackend.prototype.search = function (queryEmbedding, k, metric, threshold) {
|
|
279
|
+
if (k === void 0) { k = 5; }
|
|
280
|
+
if (metric === void 0) { metric = 'cosine'; }
|
|
281
|
+
if (threshold === void 0) { threshold = 0.0; }
|
|
282
|
+
if (!this.db)
|
|
283
|
+
throw new Error('Database not initialized');
|
|
284
|
+
var queryBuffer = this.serializeEmbedding(queryEmbedding);
|
|
285
|
+
var queryNorm = this.calculateNorm(queryEmbedding);
|
|
286
|
+
var sql;
|
|
287
|
+
var params;
|
|
288
|
+
switch (metric) {
|
|
289
|
+
case 'cosine':
|
|
290
|
+
sql = "\n SELECT\n id,\n embedding,\n metadata,\n cosine_similarity(embedding, ?, norm, ?) as score\n FROM vectors\n WHERE cosine_similarity(embedding, ?, norm, ?) >= ?\n ORDER BY score DESC\n LIMIT ?\n ";
|
|
291
|
+
params = [queryBuffer, queryNorm, queryBuffer, queryNorm, threshold, k];
|
|
292
|
+
break;
|
|
293
|
+
case 'euclidean':
|
|
294
|
+
sql = "\n SELECT\n id,\n embedding,\n metadata,\n euclidean_distance(embedding, ?) as score\n FROM vectors\n WHERE euclidean_distance(embedding, ?) <= ? OR ? = 0\n ORDER BY score ASC\n LIMIT ?\n ";
|
|
295
|
+
params = [queryBuffer, queryBuffer, threshold, threshold, k];
|
|
296
|
+
break;
|
|
297
|
+
case 'dot':
|
|
298
|
+
sql = "\n SELECT\n id,\n embedding,\n metadata,\n dot_product(embedding, ?) as score\n FROM vectors\n WHERE dot_product(embedding, ?) >= ?\n ORDER BY score DESC\n LIMIT ?\n ";
|
|
299
|
+
params = [queryBuffer, queryBuffer, threshold, k];
|
|
300
|
+
break;
|
|
301
|
+
default:
|
|
302
|
+
throw new Error("Unsupported similarity metric: ".concat(metric));
|
|
303
|
+
}
|
|
304
|
+
var stmt = this.db.prepare(sql);
|
|
305
|
+
stmt.bind(params);
|
|
306
|
+
var results = [];
|
|
307
|
+
while (stmt.step()) {
|
|
308
|
+
var row = stmt.getAsObject();
|
|
309
|
+
results.push({
|
|
310
|
+
id: row.id,
|
|
311
|
+
score: row.score,
|
|
312
|
+
embedding: this.deserializeEmbedding(row.embedding),
|
|
313
|
+
metadata: row.metadata ? JSON.parse(row.metadata) : undefined
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
stmt.free();
|
|
317
|
+
return results;
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
* Get vector by ID
|
|
321
|
+
*/
|
|
322
|
+
WasmBackend.prototype.get = function (id) {
|
|
323
|
+
if (!this.db)
|
|
324
|
+
throw new Error('Database not initialized');
|
|
325
|
+
var stmt = this.db.prepare('SELECT * FROM vectors WHERE id = ?');
|
|
326
|
+
stmt.bind([id]);
|
|
327
|
+
if (!stmt.step()) {
|
|
328
|
+
stmt.free();
|
|
329
|
+
return null;
|
|
330
|
+
}
|
|
331
|
+
var row = stmt.getAsObject();
|
|
332
|
+
stmt.free();
|
|
333
|
+
return {
|
|
334
|
+
id: row.id,
|
|
335
|
+
embedding: this.deserializeEmbedding(row.embedding),
|
|
336
|
+
metadata: row.metadata ? JSON.parse(row.metadata) : undefined,
|
|
337
|
+
norm: row.norm,
|
|
338
|
+
timestamp: row.timestamp
|
|
339
|
+
};
|
|
340
|
+
};
|
|
341
|
+
/**
|
|
342
|
+
* Delete vector by ID
|
|
343
|
+
*/
|
|
344
|
+
WasmBackend.prototype.delete = function (id) {
|
|
345
|
+
if (!this.db)
|
|
346
|
+
throw new Error('Database not initialized');
|
|
347
|
+
var stmt = this.db.prepare('DELETE FROM vectors WHERE id = ?');
|
|
348
|
+
stmt.bind([id]);
|
|
349
|
+
stmt.step();
|
|
350
|
+
var changes = this.db.getRowsModified();
|
|
351
|
+
stmt.free();
|
|
352
|
+
return changes > 0;
|
|
353
|
+
};
|
|
354
|
+
/**
|
|
355
|
+
* Get database statistics
|
|
356
|
+
*/
|
|
357
|
+
WasmBackend.prototype.stats = function () {
|
|
358
|
+
if (!this.db)
|
|
359
|
+
throw new Error('Database not initialized');
|
|
360
|
+
// Get count
|
|
361
|
+
var countStmt = this.db.prepare('SELECT COUNT(*) as count FROM vectors');
|
|
362
|
+
countStmt.step();
|
|
363
|
+
var countRow = countStmt.getAsObject();
|
|
364
|
+
var count = countRow.count;
|
|
365
|
+
countStmt.free();
|
|
366
|
+
// Get size (approximate from exported binary)
|
|
367
|
+
var exported = this.db.export();
|
|
368
|
+
var size = exported.byteLength;
|
|
369
|
+
return { count: count, size: size };
|
|
370
|
+
};
|
|
371
|
+
/**
|
|
372
|
+
* Export database to binary format (for persistence)
|
|
373
|
+
*/
|
|
374
|
+
WasmBackend.prototype.export = function () {
|
|
375
|
+
if (!this.db)
|
|
376
|
+
throw new Error('Database not initialized');
|
|
377
|
+
return this.db.export();
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* Import database from binary format
|
|
381
|
+
*/
|
|
382
|
+
WasmBackend.prototype.importAsync = function (data) {
|
|
383
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
384
|
+
return __generator(this, function (_a) {
|
|
385
|
+
if (!this.SQL) {
|
|
386
|
+
throw new Error('SQL.js not initialized');
|
|
387
|
+
}
|
|
388
|
+
// Close existing database
|
|
389
|
+
if (this.db) {
|
|
390
|
+
this.db.close();
|
|
391
|
+
}
|
|
392
|
+
// Load from binary data
|
|
393
|
+
this.db = new this.SQL.Database(data);
|
|
394
|
+
this.registerCustomFunctions();
|
|
395
|
+
this.initialized = true;
|
|
396
|
+
return [2 /*return*/];
|
|
397
|
+
});
|
|
398
|
+
});
|
|
399
|
+
};
|
|
400
|
+
/**
|
|
401
|
+
* Close database and cleanup resources
|
|
402
|
+
*/
|
|
403
|
+
WasmBackend.prototype.close = function () {
|
|
404
|
+
if (this.db) {
|
|
405
|
+
this.db.close();
|
|
406
|
+
this.db = null;
|
|
407
|
+
}
|
|
408
|
+
this.initialized = false;
|
|
409
|
+
};
|
|
410
|
+
/**
|
|
411
|
+
* Check if backend is initialized
|
|
412
|
+
*/
|
|
413
|
+
WasmBackend.prototype.isInitialized = function () {
|
|
414
|
+
return this.initialized;
|
|
415
|
+
};
|
|
416
|
+
return WasmBackend;
|
|
417
|
+
}());
|
|
418
|
+
exports.WasmBackend = WasmBackend;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database CLI Commands
|
|
3
|
+
* Full-featured CLI commands for database operations
|
|
4
|
+
*/
|
|
5
|
+
import { Command } from 'commander';
|
|
6
|
+
/**
|
|
7
|
+
* Format options for import/export
|
|
8
|
+
*/
|
|
9
|
+
type FileFormat = 'json' | 'csv';
|
|
10
|
+
/**
|
|
11
|
+
* Import vectors from file
|
|
12
|
+
*/
|
|
13
|
+
export declare function importVectors(dbPath: string, filePath: string, options?: {
|
|
14
|
+
format?: FileFormat;
|
|
15
|
+
batchSize?: number;
|
|
16
|
+
verbose?: boolean;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Export vectors to file
|
|
20
|
+
*/
|
|
21
|
+
export declare function exportVectors(dbPath: string, filePath: string, options?: {
|
|
22
|
+
format?: FileFormat;
|
|
23
|
+
limit?: number;
|
|
24
|
+
where?: string;
|
|
25
|
+
verbose?: boolean;
|
|
26
|
+
}): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Query database with vector
|
|
29
|
+
*/
|
|
30
|
+
export declare function queryVectors(dbPath: string, embeddingInput: string, options?: {
|
|
31
|
+
k?: number;
|
|
32
|
+
metric?: 'cosine' | 'euclidean' | 'dot';
|
|
33
|
+
threshold?: number;
|
|
34
|
+
format?: 'table' | 'json';
|
|
35
|
+
verbose?: boolean;
|
|
36
|
+
}): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Show database statistics
|
|
39
|
+
*/
|
|
40
|
+
export declare function showStats(dbPath: string, options?: {
|
|
41
|
+
detailed?: boolean;
|
|
42
|
+
format?: 'table' | 'json';
|
|
43
|
+
}): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Setup database CLI commands
|
|
46
|
+
*/
|
|
47
|
+
export declare function setupDatabaseCommands(program: Command): void;
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=db-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-commands.d.ts","sourceRoot":"","sources":["../../src/cli/db-commands.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC;;GAEG;AACH,KAAK,UAAU,GAAG,MAAM,GAAG,KAAK,CAAC;AAiFjC;;GAEG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACd,GACL,OAAO,CAAC,IAAI,CAAC,CA6Jf;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACd,GACL,OAAO,CAAC,IAAI,CAAC,CAsFf;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,MAAM,EACtB,OAAO,GAAE;IACP,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,KAAK,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;CACd,GACL,OAAO,CAAC,IAAI,CAAC,CAuFf;AAED;;GAEG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,MAAM,EACd,OAAO,GAAE;IACP,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACtB,GACL,OAAO,CAAC,IAAI,CAAC,CA4Ff;AAeD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgE5D"}
|