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,458 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Configuration Validator
|
|
3
|
+
*
|
|
4
|
+
* This module provides validation utilities for plugin configurations,
|
|
5
|
+
* ensuring they meet required schemas and constraints.
|
|
6
|
+
*
|
|
7
|
+
* @module plugins/validator
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Plugin name regex (kebab-case)
|
|
11
|
+
*/
|
|
12
|
+
const PLUGIN_NAME_REGEX = /^[a-z0-9-]+$/;
|
|
13
|
+
/**
|
|
14
|
+
* Semantic version regex
|
|
15
|
+
*/
|
|
16
|
+
const VERSION_REGEX = /^\d+\.\d+\.\d+$/;
|
|
17
|
+
/**
|
|
18
|
+
* Validate plugin configuration
|
|
19
|
+
*
|
|
20
|
+
* @param config - Plugin configuration to validate
|
|
21
|
+
* @returns Validation result
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const result = validatePluginConfig(config);
|
|
26
|
+
* if (!result.valid) {
|
|
27
|
+
* console.error('Validation errors:', result.errors);
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export function validatePluginConfig(config) {
|
|
32
|
+
const errors = [];
|
|
33
|
+
const warnings = [];
|
|
34
|
+
// ============ Required Fields ============
|
|
35
|
+
if (!config.name) {
|
|
36
|
+
errors.push({
|
|
37
|
+
field: 'name',
|
|
38
|
+
message: 'Plugin name is required',
|
|
39
|
+
value: config.name
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
else if (!PLUGIN_NAME_REGEX.test(config.name)) {
|
|
43
|
+
errors.push({
|
|
44
|
+
field: 'name',
|
|
45
|
+
message: 'Plugin name must be kebab-case (lowercase letters, numbers, and hyphens)',
|
|
46
|
+
value: config.name,
|
|
47
|
+
expected: 'e.g., my-plugin-name'
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
else if (config.name.length < 3 || config.name.length > 50) {
|
|
51
|
+
errors.push({
|
|
52
|
+
field: 'name',
|
|
53
|
+
message: 'Plugin name must be between 3 and 50 characters',
|
|
54
|
+
value: config.name,
|
|
55
|
+
expected: '3-50 characters'
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (!config.version) {
|
|
59
|
+
errors.push({
|
|
60
|
+
field: 'version',
|
|
61
|
+
message: 'Plugin version is required',
|
|
62
|
+
value: config.version
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
else if (!VERSION_REGEX.test(config.version)) {
|
|
66
|
+
errors.push({
|
|
67
|
+
field: 'version',
|
|
68
|
+
message: 'Plugin version must follow semantic versioning (X.Y.Z)',
|
|
69
|
+
value: config.version,
|
|
70
|
+
expected: 'e.g., 1.0.0'
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (!config.description) {
|
|
74
|
+
errors.push({
|
|
75
|
+
field: 'description',
|
|
76
|
+
message: 'Plugin description is required',
|
|
77
|
+
value: config.description
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
else if (config.description.length < 10 || config.description.length > 200) {
|
|
81
|
+
errors.push({
|
|
82
|
+
field: 'description',
|
|
83
|
+
message: 'Description must be between 10 and 200 characters',
|
|
84
|
+
value: config.description,
|
|
85
|
+
expected: '10-200 characters'
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (!config.baseAlgorithm) {
|
|
89
|
+
errors.push({
|
|
90
|
+
field: 'baseAlgorithm',
|
|
91
|
+
message: 'Base algorithm is required',
|
|
92
|
+
value: config.baseAlgorithm
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
const validAlgorithms = ['decision_transformer', 'q_learning', 'sarsa', 'actor_critic', 'custom'];
|
|
97
|
+
if (!validAlgorithms.includes(config.baseAlgorithm)) {
|
|
98
|
+
errors.push({
|
|
99
|
+
field: 'baseAlgorithm',
|
|
100
|
+
message: 'Invalid base algorithm',
|
|
101
|
+
value: config.baseAlgorithm,
|
|
102
|
+
expected: validAlgorithms.join(', ')
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// ============ Algorithm Configuration ============
|
|
107
|
+
if (!config.algorithm) {
|
|
108
|
+
errors.push({
|
|
109
|
+
field: 'algorithm',
|
|
110
|
+
message: 'Algorithm configuration is required',
|
|
111
|
+
value: config.algorithm
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
if (!config.algorithm.type) {
|
|
116
|
+
errors.push({
|
|
117
|
+
field: 'algorithm.type',
|
|
118
|
+
message: 'Algorithm type is required',
|
|
119
|
+
value: config.algorithm.type
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
if (config.algorithm.learningRate !== undefined) {
|
|
123
|
+
if (config.algorithm.learningRate <= 0 || config.algorithm.learningRate > 1) {
|
|
124
|
+
errors.push({
|
|
125
|
+
field: 'algorithm.learningRate',
|
|
126
|
+
message: 'Learning rate must be between 0 and 1',
|
|
127
|
+
value: config.algorithm.learningRate,
|
|
128
|
+
expected: '0 < learningRate <= 1'
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (config.algorithm.discountFactor !== undefined) {
|
|
133
|
+
if (config.algorithm.discountFactor < 0 || config.algorithm.discountFactor > 1) {
|
|
134
|
+
errors.push({
|
|
135
|
+
field: 'algorithm.discountFactor',
|
|
136
|
+
message: 'Discount factor must be between 0 and 1',
|
|
137
|
+
value: config.algorithm.discountFactor,
|
|
138
|
+
expected: '0 <= discountFactor <= 1'
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// ============ State Configuration ============
|
|
144
|
+
if (config.state) {
|
|
145
|
+
if (!config.state.dimension || config.state.dimension <= 0) {
|
|
146
|
+
errors.push({
|
|
147
|
+
field: 'state.dimension',
|
|
148
|
+
message: 'State dimension must be a positive integer',
|
|
149
|
+
value: config.state.dimension,
|
|
150
|
+
expected: 'dimension > 0'
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
// ============ Action Configuration ============
|
|
155
|
+
if (config.action) {
|
|
156
|
+
if (!config.action.type) {
|
|
157
|
+
errors.push({
|
|
158
|
+
field: 'action.type',
|
|
159
|
+
message: 'Action type is required',
|
|
160
|
+
value: config.action.type
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
else if (!['discrete', 'continuous'].includes(config.action.type)) {
|
|
164
|
+
errors.push({
|
|
165
|
+
field: 'action.type',
|
|
166
|
+
message: 'Action type must be discrete or continuous',
|
|
167
|
+
value: config.action.type,
|
|
168
|
+
expected: 'discrete, continuous'
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
if (config.action.type === 'discrete' && !config.action.spaceSize) {
|
|
172
|
+
errors.push({
|
|
173
|
+
field: 'action.spaceSize',
|
|
174
|
+
message: 'Space size is required for discrete actions',
|
|
175
|
+
value: config.action.spaceSize
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
if (config.action.type === 'continuous' && !config.action.spaceBounds) {
|
|
179
|
+
warnings.push({
|
|
180
|
+
field: 'action.spaceBounds',
|
|
181
|
+
message: 'Space bounds recommended for continuous actions',
|
|
182
|
+
value: config.action.spaceBounds
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
if (!config.action.selectionStrategy) {
|
|
186
|
+
errors.push({
|
|
187
|
+
field: 'action.selectionStrategy',
|
|
188
|
+
message: 'Action selection strategy is required',
|
|
189
|
+
value: config.action.selectionStrategy
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
// ============ Reward Configuration ============
|
|
194
|
+
if (config.reward) {
|
|
195
|
+
const validRewardTypes = ['success_based', 'time_aware', 'token_aware', 'custom'];
|
|
196
|
+
if (!validRewardTypes.includes(config.reward.type)) {
|
|
197
|
+
errors.push({
|
|
198
|
+
field: 'reward.type',
|
|
199
|
+
message: 'Invalid reward type',
|
|
200
|
+
value: config.reward.type,
|
|
201
|
+
expected: validRewardTypes.join(', ')
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
if (config.reward.type === 'custom' && !config.reward.function) {
|
|
205
|
+
errors.push({
|
|
206
|
+
field: 'reward.function',
|
|
207
|
+
message: 'Custom reward function is required when type is custom',
|
|
208
|
+
value: config.reward.function
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
// ============ Experience Replay Configuration ============
|
|
213
|
+
if (config.experienceReplay) {
|
|
214
|
+
const validReplayTypes = ['none', 'uniform', 'prioritized'];
|
|
215
|
+
if (!validReplayTypes.includes(config.experienceReplay.type)) {
|
|
216
|
+
errors.push({
|
|
217
|
+
field: 'experienceReplay.type',
|
|
218
|
+
message: 'Invalid experience replay type',
|
|
219
|
+
value: config.experienceReplay.type,
|
|
220
|
+
expected: validReplayTypes.join(', ')
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
if (config.experienceReplay.type !== 'none') {
|
|
224
|
+
if (!config.experienceReplay.capacity || config.experienceReplay.capacity <= 0) {
|
|
225
|
+
errors.push({
|
|
226
|
+
field: 'experienceReplay.capacity',
|
|
227
|
+
message: 'Replay capacity must be a positive integer',
|
|
228
|
+
value: config.experienceReplay.capacity,
|
|
229
|
+
expected: 'capacity > 0'
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (config.experienceReplay.type === 'prioritized') {
|
|
234
|
+
if (config.experienceReplay.alpha !== undefined) {
|
|
235
|
+
if (config.experienceReplay.alpha < 0 || config.experienceReplay.alpha > 1) {
|
|
236
|
+
errors.push({
|
|
237
|
+
field: 'experienceReplay.alpha',
|
|
238
|
+
message: 'Priority alpha must be between 0 and 1',
|
|
239
|
+
value: config.experienceReplay.alpha,
|
|
240
|
+
expected: '0 <= alpha <= 1'
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
if (config.experienceReplay.beta !== undefined) {
|
|
245
|
+
if (config.experienceReplay.beta < 0 || config.experienceReplay.beta > 1) {
|
|
246
|
+
errors.push({
|
|
247
|
+
field: 'experienceReplay.beta',
|
|
248
|
+
message: 'Priority beta must be between 0 and 1',
|
|
249
|
+
value: config.experienceReplay.beta,
|
|
250
|
+
expected: '0 <= beta <= 1'
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
// ============ Storage Configuration ============
|
|
257
|
+
if (!config.storage) {
|
|
258
|
+
errors.push({
|
|
259
|
+
field: 'storage',
|
|
260
|
+
message: 'Storage configuration is required',
|
|
261
|
+
value: config.storage
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
if (!config.storage.backend) {
|
|
266
|
+
errors.push({
|
|
267
|
+
field: 'storage.backend',
|
|
268
|
+
message: 'Storage backend is required',
|
|
269
|
+
value: config.storage.backend
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
else if (config.storage.backend !== 'agentdb') {
|
|
273
|
+
errors.push({
|
|
274
|
+
field: 'storage.backend',
|
|
275
|
+
message: 'Only agentdb backend is supported',
|
|
276
|
+
value: config.storage.backend,
|
|
277
|
+
expected: 'agentdb'
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
if (!config.storage.path) {
|
|
281
|
+
errors.push({
|
|
282
|
+
field: 'storage.path',
|
|
283
|
+
message: 'Storage path is required',
|
|
284
|
+
value: config.storage.path
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
if (config.storage.hnsw) {
|
|
288
|
+
if (config.storage.hnsw.M && (config.storage.hnsw.M < 2 || config.storage.hnsw.M > 100)) {
|
|
289
|
+
warnings.push({
|
|
290
|
+
field: 'storage.hnsw.M',
|
|
291
|
+
message: 'HNSW M parameter typically between 2 and 100',
|
|
292
|
+
value: config.storage.hnsw.M,
|
|
293
|
+
expected: '2 <= M <= 100'
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
if (config.storage.hnsw.efConstruction && config.storage.hnsw.efConstruction < 10) {
|
|
297
|
+
warnings.push({
|
|
298
|
+
field: 'storage.hnsw.efConstruction',
|
|
299
|
+
message: 'HNSW efConstruction should be at least 10 for good quality',
|
|
300
|
+
value: config.storage.hnsw.efConstruction,
|
|
301
|
+
expected: 'efConstruction >= 10'
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
if (config.storage.quantization?.enabled && config.storage.quantization.bits) {
|
|
306
|
+
if (![8, 16].includes(config.storage.quantization.bits)) {
|
|
307
|
+
errors.push({
|
|
308
|
+
field: 'storage.quantization.bits',
|
|
309
|
+
message: 'Quantization bits must be 8 or 16',
|
|
310
|
+
value: config.storage.quantization.bits,
|
|
311
|
+
expected: '8, 16'
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
// ============ Training Configuration ============
|
|
317
|
+
if (!config.training) {
|
|
318
|
+
errors.push({
|
|
319
|
+
field: 'training',
|
|
320
|
+
message: 'Training configuration is required',
|
|
321
|
+
value: config.training
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
if (!config.training.batchSize || config.training.batchSize < 1) {
|
|
326
|
+
errors.push({
|
|
327
|
+
field: 'training.batchSize',
|
|
328
|
+
message: 'Batch size must be at least 1',
|
|
329
|
+
value: config.training.batchSize,
|
|
330
|
+
expected: 'batchSize >= 1'
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
else if (config.training.batchSize > 1024) {
|
|
334
|
+
warnings.push({
|
|
335
|
+
field: 'training.batchSize',
|
|
336
|
+
message: 'Large batch size may cause memory issues',
|
|
337
|
+
value: config.training.batchSize,
|
|
338
|
+
expected: 'batchSize <= 1024 recommended'
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
if (config.training.epochs && config.training.epochs < 1) {
|
|
342
|
+
errors.push({
|
|
343
|
+
field: 'training.epochs',
|
|
344
|
+
message: 'Epochs must be at least 1',
|
|
345
|
+
value: config.training.epochs,
|
|
346
|
+
expected: 'epochs >= 1'
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
if (config.training.validationSplit !== undefined) {
|
|
350
|
+
if (config.training.validationSplit < 0 || config.training.validationSplit >= 1) {
|
|
351
|
+
errors.push({
|
|
352
|
+
field: 'training.validationSplit',
|
|
353
|
+
message: 'Validation split must be between 0 and 1',
|
|
354
|
+
value: config.training.validationSplit,
|
|
355
|
+
expected: '0 <= validationSplit < 1'
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
if (!config.training.minExperiences || config.training.minExperiences < 1) {
|
|
360
|
+
errors.push({
|
|
361
|
+
field: 'training.minExperiences',
|
|
362
|
+
message: 'Minimum experiences must be at least 1',
|
|
363
|
+
value: config.training.minExperiences,
|
|
364
|
+
expected: 'minExperiences >= 1'
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
if (config.training.trainEvery && config.training.trainEvery < 1) {
|
|
368
|
+
errors.push({
|
|
369
|
+
field: 'training.trainEvery',
|
|
370
|
+
message: 'Train every must be at least 1',
|
|
371
|
+
value: config.training.trainEvery,
|
|
372
|
+
expected: 'trainEvery >= 1'
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
// ============ Monitoring Configuration ============
|
|
377
|
+
if (config.monitoring) {
|
|
378
|
+
if (!config.monitoring.trackMetrics || config.monitoring.trackMetrics.length === 0) {
|
|
379
|
+
warnings.push({
|
|
380
|
+
field: 'monitoring.trackMetrics',
|
|
381
|
+
message: 'No metrics are being tracked',
|
|
382
|
+
value: config.monitoring.trackMetrics
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
if (config.monitoring.logInterval && config.monitoring.logInterval < 1) {
|
|
386
|
+
errors.push({
|
|
387
|
+
field: 'monitoring.logInterval',
|
|
388
|
+
message: 'Log interval must be at least 1',
|
|
389
|
+
value: config.monitoring.logInterval,
|
|
390
|
+
expected: 'logInterval >= 1'
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
if (config.monitoring.saveCheckpoints && !config.monitoring.checkpointInterval) {
|
|
394
|
+
warnings.push({
|
|
395
|
+
field: 'monitoring.checkpointInterval',
|
|
396
|
+
message: 'Checkpoint interval not set, will checkpoint every episode',
|
|
397
|
+
value: config.monitoring.checkpointInterval
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
// ============ Extensions Configuration ============
|
|
402
|
+
if (config.extensions) {
|
|
403
|
+
config.extensions.forEach((ext, index) => {
|
|
404
|
+
if (!ext.name) {
|
|
405
|
+
errors.push({
|
|
406
|
+
field: `extensions[${index}].name`,
|
|
407
|
+
message: 'Extension name is required',
|
|
408
|
+
value: ext.name
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
if (ext.enabled === undefined) {
|
|
412
|
+
warnings.push({
|
|
413
|
+
field: `extensions[${index}].enabled`,
|
|
414
|
+
message: 'Extension enabled flag not set, defaulting to false',
|
|
415
|
+
value: ext.enabled
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
return {
|
|
421
|
+
valid: errors.length === 0,
|
|
422
|
+
errors,
|
|
423
|
+
warnings
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Validate required configuration fields only
|
|
428
|
+
*
|
|
429
|
+
* @param config - Partial plugin configuration
|
|
430
|
+
* @returns Whether required fields are present
|
|
431
|
+
*/
|
|
432
|
+
export function validateRequired(config) {
|
|
433
|
+
return !!(config.name &&
|
|
434
|
+
config.version &&
|
|
435
|
+
config.description &&
|
|
436
|
+
config.baseAlgorithm &&
|
|
437
|
+
config.algorithm &&
|
|
438
|
+
config.storage &&
|
|
439
|
+
config.training);
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Get validation error summary
|
|
443
|
+
*
|
|
444
|
+
* @param result - Validation result
|
|
445
|
+
* @returns Human-readable error summary
|
|
446
|
+
*/
|
|
447
|
+
export function getErrorSummary(result) {
|
|
448
|
+
if (result.valid) {
|
|
449
|
+
return 'Configuration is valid';
|
|
450
|
+
}
|
|
451
|
+
const errorList = result.errors.map(err => ` - ${err.field}: ${err.message}${err.expected ? ` (expected: ${err.expected})` : ''}`).join('\n');
|
|
452
|
+
let summary = `Found ${result.errors.length} validation error(s):\n${errorList}`;
|
|
453
|
+
if (result.warnings && result.warnings.length > 0) {
|
|
454
|
+
const warningList = result.warnings.map(warn => ` - ${warn.field}: ${warn.message}`).join('\n');
|
|
455
|
+
summary += `\n\nWarnings (${result.warnings.length}):\n${warningList}`;
|
|
456
|
+
}
|
|
457
|
+
return summary;
|
|
458
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Binary Quantization for Ultra-Fast Vector Search
|
|
3
|
+
*
|
|
4
|
+
* Achieves 256x compression by packing 8 dimensions into 1 byte.
|
|
5
|
+
* Uses Hamming distance for 32x faster search compared to cosine distance.
|
|
6
|
+
*
|
|
7
|
+
* @module binary-quantization
|
|
8
|
+
*/
|
|
9
|
+
export interface BinaryQuantizationConfig {
|
|
10
|
+
/** Quantization method: 'threshold' or 'median' */
|
|
11
|
+
method: 'threshold' | 'median';
|
|
12
|
+
/** Threshold value for 'threshold' method (default: 0.0) */
|
|
13
|
+
threshold?: number;
|
|
14
|
+
/** Enable asymmetric search (query vs codes) for better quality */
|
|
15
|
+
useAsymmetric?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface BinaryQuantizationStats {
|
|
18
|
+
/** Number of vectors trained */
|
|
19
|
+
vectorsTrained: number;
|
|
20
|
+
/** Original dimension size */
|
|
21
|
+
dimensions: number;
|
|
22
|
+
/** Compressed size in bytes */
|
|
23
|
+
compressedBytes: number;
|
|
24
|
+
/** Compression ratio (original / compressed) */
|
|
25
|
+
compressionRatio: number;
|
|
26
|
+
/** Average encoding time (ms) */
|
|
27
|
+
avgEncodeTime: number;
|
|
28
|
+
/** Average decoding time (ms) */
|
|
29
|
+
avgDecodeTime: number;
|
|
30
|
+
/** Average Hamming distance time (μs) */
|
|
31
|
+
avgHammingTime: number;
|
|
32
|
+
/** Quantization method used */
|
|
33
|
+
method: string;
|
|
34
|
+
}
|
|
35
|
+
export declare class BinaryQuantizer {
|
|
36
|
+
private config;
|
|
37
|
+
private trained;
|
|
38
|
+
private dimensions;
|
|
39
|
+
private threshold;
|
|
40
|
+
private stats;
|
|
41
|
+
constructor(config: BinaryQuantizationConfig);
|
|
42
|
+
/**
|
|
43
|
+
* Train the quantizer on a set of vectors
|
|
44
|
+
* For 'median' method, calculates per-dimension medians
|
|
45
|
+
* For 'threshold' method, uses configured threshold
|
|
46
|
+
*/
|
|
47
|
+
train(vectors: number[][]): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Calculate global median across all dimensions and vectors
|
|
50
|
+
*/
|
|
51
|
+
private calculateGlobalMedian;
|
|
52
|
+
/**
|
|
53
|
+
* Encode a vector into binary codes (Uint8Array)
|
|
54
|
+
* Packs 8 dimensions into 1 byte for 256x compression
|
|
55
|
+
*/
|
|
56
|
+
encode(vector: number[]): Uint8Array;
|
|
57
|
+
/**
|
|
58
|
+
* Decode binary codes back to approximate vector
|
|
59
|
+
* Maps 0 to -1 and 1 to +1
|
|
60
|
+
*/
|
|
61
|
+
decode(codes: Uint8Array): number[];
|
|
62
|
+
/**
|
|
63
|
+
* Calculate Hamming distance between two binary codes
|
|
64
|
+
* Uses bitwise XOR and popcount for ultra-fast computation
|
|
65
|
+
*/
|
|
66
|
+
hammingDistance(a: Uint8Array, b: Uint8Array): number;
|
|
67
|
+
/**
|
|
68
|
+
* Count number of set bits in a byte (population count)
|
|
69
|
+
* Uses Brian Kernighan's algorithm for efficiency
|
|
70
|
+
*/
|
|
71
|
+
private popcount;
|
|
72
|
+
/**
|
|
73
|
+
* Asymmetric search: compare float query vector with binary codes
|
|
74
|
+
* More accurate than symmetric Hamming distance
|
|
75
|
+
*
|
|
76
|
+
* Returns a distance score (lower is better)
|
|
77
|
+
*/
|
|
78
|
+
asymmetricSearch(query: number[], codes: Uint8Array): number;
|
|
79
|
+
/**
|
|
80
|
+
* Get quantizer statistics
|
|
81
|
+
*/
|
|
82
|
+
getStats(): BinaryQuantizationStats;
|
|
83
|
+
/**
|
|
84
|
+
* Reset statistics counters
|
|
85
|
+
*/
|
|
86
|
+
resetStats(): void;
|
|
87
|
+
/**
|
|
88
|
+
* Check if quantizer is trained
|
|
89
|
+
*/
|
|
90
|
+
isTrained(): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Get dimensions
|
|
93
|
+
*/
|
|
94
|
+
getDimensions(): number;
|
|
95
|
+
/**
|
|
96
|
+
* Get threshold value
|
|
97
|
+
*/
|
|
98
|
+
getThreshold(): number;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Helper function to create a binary quantizer
|
|
102
|
+
*/
|
|
103
|
+
export declare function createBinaryQuantizer(config: BinaryQuantizationConfig): BinaryQuantizer;
|
|
104
|
+
//# sourceMappingURL=binary-quantization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-quantization.d.ts","sourceRoot":"","sources":["../../src/quantization/binary-quantization.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,wBAAwB;IACvC,mDAAmD;IACnD,MAAM,EAAE,WAAW,GAAG,QAAQ,CAAC;IAC/B,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,uBAAuB;IACtC,gCAAgC;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,eAAe,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,gBAAgB,EAAE,MAAM,CAAC;IACzB,iCAAiC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,cAAc,EAAE,MAAM,CAAC;IACvB,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAqC;IACnD,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,SAAS,CAAa;IAG9B,OAAO,CAAC,KAAK,CAQX;gBAEU,MAAM,EAAE,wBAAwB;IAQ5C;;;;OAIG;IACG,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAyB/C;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAe7B;;;OAGG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU;IAkCpC;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,EAAE;IAyBnC;;;OAGG;IACH,eAAe,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,MAAM;IAsBrD;;;OAGG;IACH,OAAO,CAAC,QAAQ;IAShB;;;;;OAKG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM;IA0B5D;;OAEG;IACH,QAAQ,IAAI,uBAAuB;IAsBnC;;OAEG;IACH,UAAU,IAAI,IAAI;IAYlB;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,YAAY,IAAI,MAAM;CAGvB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,wBAAwB,GAAG,eAAe,CAEvF"}
|