agentdb 2.0.0-alpha.2 → 2.0.0-alpha.2.2
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/dist/agentdb.min.js +4 -4
- package/dist/simulation/cli.js +0 -0
- package/dist/src/cli/agentdb-cli.d.ts.map +1 -1
- package/dist/src/cli/agentdb-cli.js +78 -0
- package/dist/src/cli/agentdb-cli.js.map +1 -1
- package/dist/src/cli/commands/init.js +3 -3
- package/dist/src/cli/commands/init.js.map +1 -1
- package/package.json +3 -3
- package/src/cli/agentdb-cli.ts +78 -0
- package/src/cli/commands/init.ts +3 -3
- package/dist/agentdb-advanced.js +0 -2110
- package/dist/agentdb-advanced.min.js +0 -1
- package/dist/backends/GraphBackend.d.ts +0 -196
- package/dist/backends/GraphBackend.d.ts.map +0 -1
- package/dist/backends/GraphBackend.js +0 -33
- package/dist/backends/GraphBackend.js.map +0 -1
- package/dist/backends/LearningBackend.d.ts +0 -148
- package/dist/backends/LearningBackend.d.ts.map +0 -1
- package/dist/backends/LearningBackend.js +0 -27
- package/dist/backends/LearningBackend.js.map +0 -1
- package/dist/backends/VectorBackend.d.ts +0 -119
- package/dist/backends/VectorBackend.d.ts.map +0 -1
- package/dist/backends/VectorBackend.js +0 -14
- package/dist/backends/VectorBackend.js.map +0 -1
- package/dist/backends/detector.d.ts +0 -81
- package/dist/backends/detector.d.ts.map +0 -1
- package/dist/backends/detector.js +0 -192
- package/dist/backends/detector.js.map +0 -1
- package/dist/backends/factory.d.ts +0 -50
- package/dist/backends/factory.d.ts.map +0 -1
- package/dist/backends/factory.js +0 -161
- package/dist/backends/factory.js.map +0 -1
- package/dist/backends/graph/GraphDatabaseAdapter.d.ts +0 -139
- package/dist/backends/graph/GraphDatabaseAdapter.d.ts.map +0 -1
- package/dist/backends/graph/GraphDatabaseAdapter.js +0 -194
- package/dist/backends/graph/GraphDatabaseAdapter.js.map +0 -1
- package/dist/backends/hnswlib/HNSWLibBackend.d.ts +0 -92
- package/dist/backends/hnswlib/HNSWLibBackend.d.ts.map +0 -1
- package/dist/backends/hnswlib/HNSWLibBackend.js +0 -316
- package/dist/backends/hnswlib/HNSWLibBackend.js.map +0 -1
- package/dist/backends/hnswlib/index.d.ts +0 -7
- package/dist/backends/hnswlib/index.d.ts.map +0 -1
- package/dist/backends/hnswlib/index.js +0 -7
- package/dist/backends/hnswlib/index.js.map +0 -1
- package/dist/backends/index.d.ts +0 -14
- package/dist/backends/index.d.ts.map +0 -1
- package/dist/backends/index.js +0 -13
- package/dist/backends/index.js.map +0 -1
- package/dist/backends/ruvector/RuVectorBackend.d.ts +0 -75
- package/dist/backends/ruvector/RuVectorBackend.d.ts.map +0 -1
- package/dist/backends/ruvector/RuVectorBackend.js +0 -198
- package/dist/backends/ruvector/RuVectorBackend.js.map +0 -1
- package/dist/backends/ruvector/RuVectorLearning.d.ts +0 -104
- package/dist/backends/ruvector/RuVectorLearning.d.ts.map +0 -1
- package/dist/backends/ruvector/RuVectorLearning.js +0 -177
- package/dist/backends/ruvector/RuVectorLearning.js.map +0 -1
- package/dist/backends/ruvector/index.d.ts +0 -9
- package/dist/backends/ruvector/index.d.ts.map +0 -1
- package/dist/backends/ruvector/index.js +0 -8
- package/dist/backends/ruvector/index.js.map +0 -1
- package/dist/benchmarks/wasm-vector-benchmark.d.ts +0 -10
- package/dist/benchmarks/wasm-vector-benchmark.d.ts.map +0 -1
- package/dist/benchmarks/wasm-vector-benchmark.js +0 -196
- package/dist/benchmarks/wasm-vector-benchmark.js.map +0 -1
- package/dist/browser/AdvancedFeatures.d.ts +0 -144
- package/dist/browser/AdvancedFeatures.d.ts.map +0 -1
- package/dist/browser/AdvancedFeatures.js +0 -430
- package/dist/browser/AdvancedFeatures.js.map +0 -1
- package/dist/browser/HNSWIndex.d.ts +0 -117
- package/dist/browser/HNSWIndex.d.ts.map +0 -1
- package/dist/browser/HNSWIndex.js +0 -402
- package/dist/browser/HNSWIndex.js.map +0 -1
- package/dist/browser/ProductQuantization.d.ts +0 -107
- package/dist/browser/ProductQuantization.d.ts.map +0 -1
- package/dist/browser/ProductQuantization.js +0 -337
- package/dist/browser/ProductQuantization.js.map +0 -1
- package/dist/browser/browser/AdvancedFeatures.d.ts +0 -144
- package/dist/browser/browser/AdvancedFeatures.d.ts.map +0 -1
- package/dist/browser/browser/AdvancedFeatures.js +0 -427
- package/dist/browser/browser/HNSWIndex.d.ts +0 -117
- package/dist/browser/browser/HNSWIndex.d.ts.map +0 -1
- package/dist/browser/browser/HNSWIndex.js +0 -402
- package/dist/browser/browser/ProductQuantization.d.ts +0 -107
- package/dist/browser/browser/ProductQuantization.d.ts.map +0 -1
- package/dist/browser/browser/ProductQuantization.js +0 -348
- package/dist/browser/browser/index.d.ts +0 -223
- package/dist/browser/browser/index.d.ts.map +0 -1
- package/dist/browser/browser/index.js +0 -233
- package/dist/browser/index.d.ts +0 -223
- package/dist/browser/index.d.ts.map +0 -1
- package/dist/browser/index.js +0 -225
- package/dist/browser/index.js.map +0 -1
- package/dist/cli/agentdb-cli.d.ts +0 -154
- package/dist/cli/agentdb-cli.d.ts.map +0 -1
- package/dist/cli/agentdb-cli.js +0 -2273
- package/dist/cli/agentdb-cli.js.map +0 -1
- package/dist/cli/agentdb.db +0 -0
- package/dist/cli/commands/init.d.ts +0 -12
- package/dist/cli/commands/init.d.ts.map +0 -1
- package/dist/cli/commands/init.js +0 -115
- package/dist/cli/commands/init.js.map +0 -1
- package/dist/cli/commands/install-embeddings.d.ts +0 -10
- package/dist/cli/commands/install-embeddings.d.ts.map +0 -1
- package/dist/cli/commands/install-embeddings.js +0 -68
- package/dist/cli/commands/install-embeddings.js.map +0 -1
- package/dist/cli/commands/migrate.d.ts +0 -15
- package/dist/cli/commands/migrate.d.ts.map +0 -1
- package/dist/cli/commands/migrate.js +0 -425
- package/dist/cli/commands/migrate.js.map +0 -1
- package/dist/cli/commands/status.d.ts +0 -10
- package/dist/cli/commands/status.d.ts.map +0 -1
- package/dist/cli/commands/status.js +0 -129
- package/dist/cli/commands/status.js.map +0 -1
- package/dist/controllers/CausalMemoryGraph.d.ts +0 -126
- package/dist/controllers/CausalMemoryGraph.d.ts.map +0 -1
- package/dist/controllers/CausalMemoryGraph.js +0 -323
- package/dist/controllers/CausalMemoryGraph.js.map +0 -1
- package/dist/controllers/CausalRecall.d.ts +0 -139
- package/dist/controllers/CausalRecall.d.ts.map +0 -1
- package/dist/controllers/CausalRecall.js +0 -356
- package/dist/controllers/CausalRecall.js.map +0 -1
- package/dist/controllers/ContextSynthesizer.d.ts +0 -65
- package/dist/controllers/ContextSynthesizer.d.ts.map +0 -1
- package/dist/controllers/ContextSynthesizer.js +0 -208
- package/dist/controllers/ContextSynthesizer.js.map +0 -1
- package/dist/controllers/EmbeddingService.d.ts +0 -37
- package/dist/controllers/EmbeddingService.d.ts.map +0 -1
- package/dist/controllers/EmbeddingService.js +0 -136
- package/dist/controllers/EmbeddingService.js.map +0 -1
- package/dist/controllers/EnhancedEmbeddingService.d.ts +0 -50
- package/dist/controllers/EnhancedEmbeddingService.d.ts.map +0 -1
- package/dist/controllers/EnhancedEmbeddingService.js +0 -119
- package/dist/controllers/EnhancedEmbeddingService.js.map +0 -1
- package/dist/controllers/ExplainableRecall.d.ts +0 -163
- package/dist/controllers/ExplainableRecall.d.ts.map +0 -1
- package/dist/controllers/ExplainableRecall.js +0 -485
- package/dist/controllers/ExplainableRecall.js.map +0 -1
- package/dist/controllers/HNSWIndex.d.ts +0 -128
- package/dist/controllers/HNSWIndex.d.ts.map +0 -1
- package/dist/controllers/HNSWIndex.js +0 -361
- package/dist/controllers/HNSWIndex.js.map +0 -1
- package/dist/controllers/LearningSystem.d.ts +0 -195
- package/dist/controllers/LearningSystem.d.ts.map +0 -1
- package/dist/controllers/LearningSystem.js +0 -929
- package/dist/controllers/LearningSystem.js.map +0 -1
- package/dist/controllers/MMRDiversityRanker.d.ts +0 -50
- package/dist/controllers/MMRDiversityRanker.d.ts.map +0 -1
- package/dist/controllers/MMRDiversityRanker.js +0 -130
- package/dist/controllers/MMRDiversityRanker.js.map +0 -1
- package/dist/controllers/MetadataFilter.d.ts +0 -70
- package/dist/controllers/MetadataFilter.d.ts.map +0 -1
- package/dist/controllers/MetadataFilter.js +0 -243
- package/dist/controllers/MetadataFilter.js.map +0 -1
- package/dist/controllers/NightlyLearner.d.ts +0 -114
- package/dist/controllers/NightlyLearner.d.ts.map +0 -1
- package/dist/controllers/NightlyLearner.js +0 -394
- package/dist/controllers/NightlyLearner.js.map +0 -1
- package/dist/controllers/QUICClient.d.ts +0 -109
- package/dist/controllers/QUICClient.d.ts.map +0 -1
- package/dist/controllers/QUICClient.js +0 -299
- package/dist/controllers/QUICClient.js.map +0 -1
- package/dist/controllers/QUICServer.d.ts +0 -121
- package/dist/controllers/QUICServer.d.ts.map +0 -1
- package/dist/controllers/QUICServer.js +0 -383
- package/dist/controllers/QUICServer.js.map +0 -1
- package/dist/controllers/ReasoningBank.d.ts +0 -196
- package/dist/controllers/ReasoningBank.d.ts.map +0 -1
- package/dist/controllers/ReasoningBank.js +0 -494
- package/dist/controllers/ReasoningBank.js.map +0 -1
- package/dist/controllers/ReflexionMemory.d.ts +0 -125
- package/dist/controllers/ReflexionMemory.d.ts.map +0 -1
- package/dist/controllers/ReflexionMemory.js +0 -521
- package/dist/controllers/ReflexionMemory.js.map +0 -1
- package/dist/controllers/SkillLibrary.d.ts +0 -149
- package/dist/controllers/SkillLibrary.d.ts.map +0 -1
- package/dist/controllers/SkillLibrary.js +0 -547
- package/dist/controllers/SkillLibrary.js.map +0 -1
- package/dist/controllers/SyncCoordinator.d.ts +0 -120
- package/dist/controllers/SyncCoordinator.d.ts.map +0 -1
- package/dist/controllers/SyncCoordinator.js +0 -441
- package/dist/controllers/SyncCoordinator.js.map +0 -1
- package/dist/controllers/WASMVectorSearch.d.ts +0 -89
- package/dist/controllers/WASMVectorSearch.d.ts.map +0 -1
- package/dist/controllers/WASMVectorSearch.js +0 -234
- package/dist/controllers/WASMVectorSearch.js.map +0 -1
- package/dist/controllers/frontier-index.d.ts +0 -14
- package/dist/controllers/frontier-index.d.ts.map +0 -1
- package/dist/controllers/frontier-index.js +0 -10
- package/dist/controllers/frontier-index.js.map +0 -1
- package/dist/controllers/index.d.ts +0 -30
- package/dist/controllers/index.d.ts.map +0 -1
- package/dist/controllers/index.js +0 -18
- package/dist/controllers/index.js.map +0 -1
- package/dist/db-fallback.d.ts +0 -26
- package/dist/db-fallback.d.ts.map +0 -1
- package/dist/db-fallback.js +0 -264
- package/dist/db-fallback.js.map +0 -1
- package/dist/db-test.d.ts +0 -13
- package/dist/db-test.d.ts.map +0 -1
- package/dist/db-test.js +0 -55
- package/dist/db-test.js.map +0 -1
- package/dist/db-unified.d.ts +0 -76
- package/dist/db-unified.d.ts.map +0 -1
- package/dist/db-unified.js +0 -278
- package/dist/db-unified.js.map +0 -1
- package/dist/examples/quic-sync-example.d.ts +0 -9
- package/dist/examples/quic-sync-example.d.ts.map +0 -1
- package/dist/examples/quic-sync-example.js +0 -169
- package/dist/examples/quic-sync-example.js.map +0 -1
- package/dist/examples/wasm-vector-usage.d.ts +0 -12
- package/dist/examples/wasm-vector-usage.d.ts.map +0 -1
- package/dist/examples/wasm-vector-usage.js +0 -190
- package/dist/examples/wasm-vector-usage.js.map +0 -1
- package/dist/index.d.ts +0 -28
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -35
- package/dist/index.js.map +0 -1
- package/dist/malp/core/ccc.d.ts +0 -99
- package/dist/malp/core/ccc.d.ts.map +0 -1
- package/dist/malp/core/ccc.js +0 -181
- package/dist/malp/core/ccc.js.map +0 -1
- package/dist/malp/core/index.d.ts +0 -9
- package/dist/malp/core/index.d.ts.map +0 -1
- package/dist/malp/core/index.js +0 -9
- package/dist/malp/core/index.js.map +0 -1
- package/dist/malp/core/linalg.d.ts +0 -101
- package/dist/malp/core/linalg.d.ts.map +0 -1
- package/dist/malp/core/linalg.js +0 -278
- package/dist/malp/core/linalg.js.map +0 -1
- package/dist/malp/core/optimizer.d.ts +0 -68
- package/dist/malp/core/optimizer.d.ts.map +0 -1
- package/dist/malp/core/optimizer.js +0 -160
- package/dist/malp/core/optimizer.js.map +0 -1
- package/dist/malp/index.d.ts +0 -33
- package/dist/malp/index.d.ts.map +0 -1
- package/dist/malp/index.js +0 -37
- package/dist/malp/index.js.map +0 -1
- package/dist/malp/metrics/agreement.d.ts +0 -106
- package/dist/malp/metrics/agreement.d.ts.map +0 -1
- package/dist/malp/metrics/agreement.js +0 -199
- package/dist/malp/metrics/agreement.js.map +0 -1
- package/dist/malp/metrics/comparison.d.ts +0 -93
- package/dist/malp/metrics/comparison.d.ts.map +0 -1
- package/dist/malp/metrics/comparison.js +0 -256
- package/dist/malp/metrics/comparison.js.map +0 -1
- package/dist/malp/metrics/index.d.ts +0 -8
- package/dist/malp/metrics/index.d.ts.map +0 -1
- package/dist/malp/metrics/index.js +0 -8
- package/dist/malp/metrics/index.js.map +0 -1
- package/dist/malp/metrics/performance.d.ts +0 -61
- package/dist/malp/metrics/performance.d.ts.map +0 -1
- package/dist/malp/metrics/performance.js +0 -190
- package/dist/malp/metrics/performance.js.map +0 -1
- package/dist/malp/models/index.d.ts +0 -7
- package/dist/malp/models/index.d.ts.map +0 -1
- package/dist/malp/models/index.js +0 -7
- package/dist/malp/models/index.js.map +0 -1
- package/dist/malp/models/malp.d.ts +0 -116
- package/dist/malp/models/malp.d.ts.map +0 -1
- package/dist/malp/models/malp.js +0 -206
- package/dist/malp/models/malp.js.map +0 -1
- package/dist/malp/models/regressor.d.ts +0 -80
- package/dist/malp/models/regressor.d.ts.map +0 -1
- package/dist/malp/models/regressor.js +0 -229
- package/dist/malp/models/regressor.js.map +0 -1
- package/dist/malp/reasoningbank_validator.d.ts +0 -187
- package/dist/malp/reasoningbank_validator.d.ts.map +0 -1
- package/dist/malp/reasoningbank_validator.js +0 -246
- package/dist/malp/reasoningbank_validator.js.map +0 -1
- package/dist/malp/wasm_bindings.d.ts +0 -344
- package/dist/malp/wasm_bindings.d.ts.map +0 -1
- package/dist/malp/wasm_bindings.js +0 -9
- package/dist/malp/wasm_bindings.js.map +0 -1
- package/dist/mcp/agentdb-mcp-server.d.ts +0 -8
- package/dist/mcp/agentdb-mcp-server.d.ts.map +0 -1
- package/dist/mcp/agentdb-mcp-server.js +0 -2116
- package/dist/mcp/agentdb-mcp-server.js.map +0 -1
- package/dist/mcp/learning-tools-handlers.d.ts +0 -16
- package/dist/mcp/learning-tools-handlers.d.ts.map +0 -1
- package/dist/mcp/learning-tools-handlers.js +0 -105
- package/dist/mcp/learning-tools-handlers.js.map +0 -1
- package/dist/optimizations/BatchOperations.d.ts +0 -109
- package/dist/optimizations/BatchOperations.d.ts.map +0 -1
- package/dist/optimizations/BatchOperations.js +0 -407
- package/dist/optimizations/BatchOperations.js.map +0 -1
- package/dist/optimizations/QueryOptimizer.d.ts +0 -83
- package/dist/optimizations/QueryOptimizer.d.ts.map +0 -1
- package/dist/optimizations/QueryOptimizer.js +0 -228
- package/dist/optimizations/QueryOptimizer.js.map +0 -1
- package/dist/optimizations/ToolCache.d.ts +0 -137
- package/dist/optimizations/ToolCache.d.ts.map +0 -1
- package/dist/optimizations/ToolCache.js +0 -281
- package/dist/optimizations/ToolCache.js.map +0 -1
- package/dist/optimizations/index.d.ts +0 -10
- package/dist/optimizations/index.d.ts.map +0 -1
- package/dist/optimizations/index.js +0 -8
- package/dist/optimizations/index.js.map +0 -1
- package/dist/security/input-validation.d.ts +0 -109
- package/dist/security/input-validation.d.ts.map +0 -1
- package/dist/security/input-validation.js +0 -398
- package/dist/security/input-validation.js.map +0 -1
- package/dist/security/limits.d.ts +0 -150
- package/dist/security/limits.d.ts.map +0 -1
- package/dist/security/limits.js +0 -288
- package/dist/security/limits.js.map +0 -1
- package/dist/security/path-security.d.ts +0 -100
- package/dist/security/path-security.d.ts.map +0 -1
- package/dist/security/path-security.js +0 -337
- package/dist/security/path-security.js.map +0 -1
- package/dist/security/validation.d.ts +0 -95
- package/dist/security/validation.d.ts.map +0 -1
- package/dist/security/validation.js +0 -315
- package/dist/security/validation.js.map +0 -1
- package/dist/types/quic.d.ts +0 -518
- package/dist/types/quic.d.ts.map +0 -1
- package/dist/types/quic.js +0 -272
- package/dist/types/quic.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(e){"use strict";var t=void 0,n=function(e){return t||(t=new Promise(function(t,n){var r,i=void 0!==e?e:{},o=i.onAbort;i.onAbort=function(e){n(new Error(e)),o&&o(e)},i.postRun=i.postRun||[],i.postRun.push(function(){t(i)}),module=void 0,r||=void 0!==i?i:{};var s="object"==typeof window,a="undefined"!=typeof WorkerGlobalScope,u="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&"renderer"!=process.type;r.onRuntimeInitialized=function(){function e(e,t){switch(typeof t){case"boolean":K(e,t?1:0);break;case"number":Q(e,t);break;case"string":Y(e,t,-1,-1);break;case"object":if(null===t)G(e);else if(null!=t.length){var n=gt(t,pt);V(e,n,t.length,-1),Tt(n)}else Z(e,"Wrong API use : tried to return a value of an unknown type ("+t+").",-1);break;default:G(e)}}function t(e,t){for(var n=[],r=0;r<e;r+=1){var i=W(t+4*r,"i32"),o=x(i);if(1===o||2===o)i=z(i);else if(3===o)i=F(i);else if(4===o){i=U(o=i),o=B(o);for(var s=new Uint8Array(i),a=0;a<i;a+=1)s[a]=y[o+a];i=s}else i=null;n.push(i)}return n}function n(e,t){this.Qa=e,this.db=t,this.Oa=1,this.lb=[]}function i(e,t){if(this.db=t,t=ee(e)+1,this.eb=At(t),null===this.eb)throw Error("Unable to allocate memory for the SQL string");te(e,_,this.eb,t),this.kb=this.eb,this.Za=this.pb=null}function o(e){if(this.filename="dbfile_"+(4294967295*Math.random()>>>0),null!=e){var t=this.filename,n="/",r=t;if(n&&(n="string"==typeof n?n:Ee(n),r=t?X(n+"/"+t):n),r=function(e,t=438){return Fe(e,4095&t|32768,0)}(r,t=le(!0,!0)),e){if("string"==typeof e){n=Array(e.length);for(var i=0,o=e.length;i<o;++i)n[i]=e.charCodeAt(i);e=n}je(r,146|t),Je(n=Xe(r,577),e,0,e.length,0),Ve(n),je(r,t)}}this.handleError(u(this.filename,s)),this.db=W(s,"i32"),re(this.db),this.fb={},this.Sa={}}var s=kt(4),a=r.cwrap,u=a("sqlite3_open","number",["string","number"]),l=a("sqlite3_close_v2","number",["number"]),c=a("sqlite3_exec","number",["number","string","number","number","number"]),h=a("sqlite3_changes","number",["number"]),f=a("sqlite3_prepare_v2","number",["number","string","number","number","number"]),d=a("sqlite3_sql","string",["number"]),m=a("sqlite3_normalized_sql","string",["number"]),b=a("sqlite3_prepare_v2","number",["number","number","number","number","number"]),p=a("sqlite3_bind_text","number",["number","number","number","number","number"]),g=a("sqlite3_bind_blob","number",["number","number","number","number","number"]),v=a("sqlite3_bind_double","number",["number","number","number"]),w=a("sqlite3_bind_int","number",["number","number","number"]),E=a("sqlite3_bind_parameter_index","number",["number","string"]),A=a("sqlite3_step","number",["number"]),T=a("sqlite3_errmsg","string",["number"]),N=a("sqlite3_column_count","number",["number"]),M=a("sqlite3_data_count","number",["number"]),S=a("sqlite3_column_double","number",["number","number"]),k=a("sqlite3_column_text","string",["number","number"]),q=a("sqlite3_column_blob","number",["number","number"]),L=a("sqlite3_column_bytes","number",["number","number"]),R=a("sqlite3_column_type","number",["number","number"]),I=a("sqlite3_column_name","string",["number","number"]),O=a("sqlite3_reset","number",["number"]),D=a("sqlite3_clear_bindings","number",["number"]),C=a("sqlite3_finalize","number",["number"]),P=a("sqlite3_create_function_v2","number","number string number number number number number number number".split(" ")),x=a("sqlite3_value_type","number",["number"]),U=a("sqlite3_value_bytes","number",["number"]),F=a("sqlite3_value_text","string",["number"]),B=a("sqlite3_value_blob","number",["number"]),z=a("sqlite3_value_double","number",["number"]),Q=a("sqlite3_result_double","",["number","number"]),G=a("sqlite3_result_null","",["number"]),Y=a("sqlite3_result_text","",["number","string","number","number"]),V=a("sqlite3_result_blob","",["number","number","number","number"]),K=a("sqlite3_result_int","",["number","number"]),Z=a("sqlite3_result_error","",["number","string","number"]),J=a("sqlite3_aggregate_context","number",["number","number"]),re=a("RegisterExtensionFunctions","number",["number"]),ie=a("sqlite3_update_hook","number",["number","number","number"]);n.prototype.bind=function(e){if(!this.Qa)throw"Statement closed";return this.reset(),Array.isArray(e)?this.Cb(e):null==e||"object"!=typeof e||this.Db(e)},n.prototype.step=function(){if(!this.Qa)throw"Statement closed";this.Oa=1;var e=A(this.Qa);switch(e){case 100:return!0;case 101:return!1;default:throw this.db.handleError(e)}},n.prototype.wb=function(e){return null==e&&(e=this.Oa,this.Oa+=1),S(this.Qa,e)},n.prototype.Gb=function(e){if(null==e&&(e=this.Oa,this.Oa+=1),e=k(this.Qa,e),"function"!=typeof BigInt)throw Error("BigInt is not supported");return BigInt(e)},n.prototype.Hb=function(e){return null==e&&(e=this.Oa,this.Oa+=1),k(this.Qa,e)},n.prototype.getBlob=function(e){null==e&&(e=this.Oa,this.Oa+=1);var t=L(this.Qa,e);e=q(this.Qa,e);for(var n=new Uint8Array(t),r=0;r<t;r+=1)n[r]=y[e+r];return n},n.prototype.get=function(e,t){t=t||{},null!=e&&this.bind(e)&&this.step(),e=[];for(var n=M(this.Qa),r=0;r<n;r+=1)switch(R(this.Qa,r)){case 1:var i=t.useBigInt?this.Gb(r):this.wb(r);e.push(i);break;case 2:e.push(this.wb(r));break;case 3:e.push(this.Hb(r));break;case 4:e.push(this.getBlob(r));break;default:e.push(null)}return e},n.prototype.getColumnNames=function(){for(var e=[],t=N(this.Qa),n=0;n<t;n+=1)e.push(I(this.Qa,n));return e},n.prototype.getAsObject=function(e,t){e=this.get(e,t),t=this.getColumnNames();for(var n={},r=0;r<t.length;r+=1)n[t[r]]=e[r];return n},n.prototype.getSQL=function(){return d(this.Qa)},n.prototype.getNormalizedSQL=function(){return m(this.Qa)},n.prototype.run=function(e){return null!=e&&this.bind(e),this.step(),this.reset()},n.prototype.sb=function(e,t){null==t&&(t=this.Oa,this.Oa+=1),e=ne(e);var n=gt(e,pt);this.lb.push(n),this.db.handleError(p(this.Qa,t,n,e.length-1,0))},n.prototype.Bb=function(e,t){null==t&&(t=this.Oa,this.Oa+=1);var n=gt(e,pt);this.lb.push(n),this.db.handleError(g(this.Qa,t,n,e.length,0))},n.prototype.rb=function(e,t){null==t&&(t=this.Oa,this.Oa+=1),this.db.handleError((e===(0|e)?w:v)(this.Qa,t,e))},n.prototype.Eb=function(e){null==e&&(e=this.Oa,this.Oa+=1),g(this.Qa,e,0,0,0)},n.prototype.tb=function(e,t){switch(null==t&&(t=this.Oa,this.Oa+=1),typeof e){case"string":return void this.sb(e,t);case"number":return void this.rb(e,t);case"bigint":return void this.sb(e.toString(),t);case"boolean":return void this.rb(e+0,t);case"object":if(null===e)return void this.Eb(t);if(null!=e.length)return void this.Bb(e,t)}throw"Wrong API use : tried to bind a value of an unknown type ("+e+")."},n.prototype.Db=function(e){var t=this;return Object.keys(e).forEach(function(n){var r=E(t.Qa,n);0!==r&&t.tb(e[n],r)}),!0},n.prototype.Cb=function(e){for(var t=0;t<e.length;t+=1)this.tb(e[t],t+1);return!0},n.prototype.reset=function(){return this.freemem(),0===D(this.Qa)&&0===O(this.Qa)},n.prototype.freemem=function(){for(var e;void 0!==(e=this.lb.pop());)Tt(e)},n.prototype.free=function(){this.freemem();var e=0===C(this.Qa);return delete this.db.fb[this.Qa],this.Qa=0,e},i.prototype.next=function(){if(null===this.eb)return{done:!0};if(null!==this.Za&&(this.Za.free(),this.Za=null),!this.db.db)throw this.mb(),Error("Database closed");var e=qt(),t=kt(4);H(s),H(t);try{this.db.handleError(b(this.db.db,this.kb,-1,s,t)),this.kb=W(t,"i32");var r=W(s,"i32");return 0===r?(this.mb(),{done:!0}):(this.Za=new n(r,this.db),this.db.fb[r]=this.Za,{value:this.Za,done:!1})}catch(e){throw this.pb=j(this.kb),this.mb(),e}finally{St(e)}},i.prototype.mb=function(){Tt(this.eb),this.eb=null},i.prototype.getRemainingSQL=function(){return null!==this.pb?this.pb:j(this.kb)},"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator&&(i.prototype[Symbol.iterator]=function(){return this}),o.prototype.run=function(e,t){if(!this.db)throw"Database closed";if(t){e=this.prepare(e,t);try{e.step()}finally{e.free()}}else this.handleError(c(this.db,e,0,0,s));return this},o.prototype.exec=function(e,t,r){if(!this.db)throw"Database closed";var i=qt(),o=null;try{var a=bt(e),u=kt(4);for(e=[];0!==W(a,"i8");){H(s),H(u),this.handleError(b(this.db,a,-1,s,u));var l=W(s,"i32");if(a=W(u,"i32"),0!==l){var c=null;for(o=new n(l,this),null!=t&&o.bind(t);o.step();)null===c&&(c={columns:o.getColumnNames(),values:[]},e.push(c)),c.values.push(o.get(null,r));o.free()}}return e}catch(e){throw o&&o.free(),e}finally{St(i)}},o.prototype.each=function(e,t,n,r,i){"function"==typeof t&&(r=n,n=t,t=void 0),e=this.prepare(e,t);try{for(;e.step();)n(e.getAsObject(null,i))}finally{e.free()}if("function"==typeof r)return r()},o.prototype.prepare=function(e,t){if(H(s),this.handleError(f(this.db,e,-1,s,0)),0===(e=W(s,"i32")))throw"Nothing to prepare";var r=new n(e,this);return null!=t&&r.bind(t),this.fb[e]=r},o.prototype.iterateStatements=function(e){return new i(e,this)},o.prototype.export=function(){Object.values(this.fb).forEach(function(e){e.free()}),Object.values(this.Sa).forEach(wt),this.Sa={},this.handleError(l(this.db));var e=function(e){var t,n="binary";if("utf8"!==n&&"binary"!==n)throw Error(`Invalid encoding type "${n}"`);var r=Xe(e,r||0);e=Ge(e).size;var i=new Uint8Array(e);return Ze(r,i,0,e,0),"utf8"===n?t=$(i):"binary"===n&&(t=i),Ve(r),t}(this.filename);return this.handleError(u(this.filename,s)),this.db=W(s,"i32"),re(this.db),e},o.prototype.close=function(){null!==this.db&&(Object.values(this.fb).forEach(function(e){e.free()}),Object.values(this.Sa).forEach(wt),this.Sa={},this.Ya&&(wt(this.Ya),this.Ya=void 0),this.handleError(l(this.db)),He("/"+this.filename),this.db=null)},o.prototype.handleError=function(e){if(0===e)return null;throw e=T(this.db),Error(e)},o.prototype.getRowsModified=function(){return h(this.db)},o.prototype.create_function=function(n,r){Object.prototype.hasOwnProperty.call(this.Sa,n)&&(wt(this.Sa[n]),delete this.Sa[n]);var i=yt(function(n,i,o){i=t(i,o);try{var s=r.apply(null,i)}catch(e){return void Z(n,e,-1)}e(n,s)},"viii");return this.Sa[n]=i,this.handleError(P(this.db,n,r.length,1,0,i,0,0,0)),this},o.prototype.create_aggregate=function(n,r){var i=r.init||function(){return null},o=r.finalize||function(e){return e},s=r.step;if(!s)throw"An aggregate function must have a step function in "+n;var a={};Object.hasOwnProperty.call(this.Sa,n)&&(wt(this.Sa[n]),delete this.Sa[n]),r=n+"__finalize",Object.hasOwnProperty.call(this.Sa,r)&&(wt(this.Sa[r]),delete this.Sa[r]);var u=yt(function(e,n,r){var o=J(e,1);Object.hasOwnProperty.call(a,o)||(a[o]=i()),n=t(n,r),n=[a[o]].concat(n);try{a[o]=s.apply(null,n)}catch(t){delete a[o],Z(e,t,-1)}},"viii"),l=yt(function(t){var n=J(t,1);try{var r=o(a[n])}catch(e){return delete a[n],void Z(t,e,-1)}e(t,r),delete a[n]},"vi");return this.Sa[n]=u,this.Sa[r]=l,this.handleError(P(this.db,n,s.length-1,1,0,0,u,l,0)),this},o.prototype.updateHook=function(e){this.Ya&&(ie(this.db,0,0),wt(this.Ya),this.Ya=void 0),e&&(this.Ya=yt(function(t,n,r,i,o){switch(n){case 18:t="insert";break;case 23:t="update";break;case 9:t="delete";break;default:throw"unknown operationCode in updateHook callback: "+n}if(r=r?$(_,r):"",i=i?$(_,i):"",o>Number.MAX_SAFE_INTEGER)throw"rowId too big to fit inside a Number";e(t,r,i,Number(o))},"viiiij"),ie(this.db,this.Ya,0))},r.Database=o};var l,c,h={...r},f="./this.program",d=(e,t)=>{throw t},m="";if(u){var b=require("fs");require("path"),m=__dirname+"/",c=e=>(e=L(e)?new URL(e):e,b.readFileSync(e)),l=async e=>(e=L(e)?new URL(e):e,b.readFileSync(e,void 0)),!r.thisProgram&&1<process.argv.length&&(f=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),"undefined"!=typeof module&&(module.exports=r),d=(e,t)=>{throw process.exitCode=e,t}}else(s||a)&&(a?m=self.location.href:"undefined"!=typeof document&&document.currentScript&&(m=document.currentScript.src),m=m.startsWith("blob:")?"":m.slice(0,m.replace(/[?#].*/,"").lastIndexOf("/")+1),a&&(c=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),l=async e=>{if(L(e))return new Promise((t,n)=>{var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?t(r.response):n(r.status)},r.onerror=n,r.send(null)});var t=await fetch(e,{credentials:"same-origin"});if(t.ok)return t.arrayBuffer();throw Error(t.status+" : "+t.url)});var p=r.print||console.log.bind(console),g=r.printErr||console.error.bind(console);Object.assign(r,h),h=null,r.thisProgram&&(f=r.thisProgram);var v,w,y,_,E,A,T,N,M,S,k=r.wasmBinary,q=!1,L=e=>e.startsWith("file://");function R(){var e=v.buffer;r.HEAP8=y=new Int8Array(e),r.HEAP16=E=new Int16Array(e),r.HEAPU8=_=new Uint8Array(e),r.HEAPU16=new Uint16Array(e),r.HEAP32=A=new Int32Array(e),r.HEAPU32=T=new Uint32Array(e),r.HEAPF32=N=new Float32Array(e),r.HEAPF64=S=new Float64Array(e),r.HEAP64=M=new BigInt64Array(e),r.HEAPU64=new BigUint64Array(e)}var I,O=0,D=null;function C(e){throw r.onAbort?.(e),g(e="Aborted("+e+")"),q=!0,new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info.")}async function P(e,t){try{var n=await async function(e){if(!k)try{var t=await l(e);return new Uint8Array(t)}catch{}if(e==I&&k)e=new Uint8Array(k);else{if(!c)throw"both async and sync fetching of the wasm failed";e=c(e)}return e}(e);return await WebAssembly.instantiate(n,t)}catch(e){g(`failed to asynchronously prepare wasm: ${e}`),C(e)}}class x{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var U=e=>{for(;0<e.length;)e.shift()(r)},F=[],B=[],z=()=>{var e=r.preRun.shift();B.unshift(e)};function W(e,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":case"i8":return y[e];case"i16":return E[e>>1];case"i32":return A[e>>2];case"i64":return M[e>>3];case"float":return N[e>>2];case"double":return S[e>>3];case"*":return T[e>>2];default:C(`invalid type for getValue: ${t}`)}}var Q=r.noExitRuntime||!0;function H(e){var t="i32";switch(t.endsWith("*")&&(t="*"),t){case"i1":case"i8":y[e]=0;break;case"i16":E[e>>1]=0;break;case"i32":A[e>>2]=0;break;case"i64":M[e>>3]=BigInt(0);break;case"float":N[e>>2]=0;break;case"double":S[e>>3]=0;break;case"*":T[e>>2]=0;break;default:C(`invalid type for setValue: ${t}`)}}var G="undefined"!=typeof TextDecoder?new TextDecoder:void 0,$=(e,t=0,n=NaN)=>{var r=t+n;for(n=t;e[n]&&!(n>=r);)++n;if(16<n-t&&e.buffer&&G)return G.decode(e.subarray(t,n));for(r="";t<n;){var i=e[t++];if(128&i){var o=63&e[t++];if(192==(224&i))r+=String.fromCharCode((31&i)<<6|o);else{var s=63&e[t++];65536>(i=224==(240&i)?(15&i)<<12|o<<6|s:(7&i)<<18|o<<12|s<<6|63&e[t++])?r+=String.fromCharCode(i):(i-=65536,r+=String.fromCharCode(55296|i>>10,56320|1023&i))}}else r+=String.fromCharCode(i)}return r},j=(e,t)=>e?$(_,e,t):"",Y=(e,t)=>{for(var n=0,r=e.length-1;0<=r;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n;n--)e.unshift("..");return e},X=e=>{var t="/"===e.charAt(0),n="/"===e.slice(-1);return(e=Y(e.split("/").filter(e=>!!e),!t).join("/"))||t||(e="."),e&&n&&(e+="/"),(t?"/":"")+e},V=e=>{var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1);return e=t[0],t=t[1],e||t?(t&&=t.slice(0,-1),e+t):"."},K=e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],Z=e=>{(Z=(()=>{if(u){var e=require("crypto");return t=>e.randomFillSync(t)}return e=>crypto.getRandomValues(e)})())(e)},J=[],ee=e=>{for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);127>=r?t++:2047>=r?t+=2:55296<=r&&57343>=r?(t+=4,++n):t+=3}return t},te=(e,t,n,r)=>{if(!(0<r))return 0;var i=n;r=n+r-1;for(var o=0;o<e.length;++o){var s=e.charCodeAt(o);if(55296<=s&&57343>=s)s=65536+((1023&s)<<10)|1023&e.charCodeAt(++o);if(127>=s){if(n>=r)break;t[n++]=s}else{if(2047>=s){if(n+1>=r)break;t[n++]=192|s>>6}else{if(65535>=s){if(n+2>=r)break;t[n++]=224|s>>12}else{if(n+3>=r)break;t[n++]=240|s>>18,t[n++]=128|s>>12&63}t[n++]=128|s>>6&63}t[n++]=128|63&s}}return t[n]=0,n-i},ne=(e,t)=>{var n=Array(ee(e)+1);return e=te(e,n,0,n.length),t&&(n.length=e),n},re=[];function ie(e,t){re[e]={input:[],output:[],cb:t},xe(e,oe)}var oe={open(e){var t=re[e.node.rdev];if(!t)throw new ve(43);e.tty=t,e.seekable=!1},close(e){e.tty.cb.fsync(e.tty)},fsync(e){e.tty.cb.fsync(e.tty)},read(e,t,n,r){if(!e.tty||!e.tty.cb.xb)throw new ve(60);for(var i=0,o=0;o<r;o++){try{var s=e.tty.cb.xb(e.tty)}catch(e){throw new ve(29)}if(void 0===s&&0===i)throw new ve(6);if(null==s)break;i++,t[n+o]=s}return i&&(e.node.atime=Date.now()),i},write(e,t,n,r){if(!e.tty||!e.tty.cb.qb)throw new ve(60);try{for(var i=0;i<r;i++)e.tty.cb.qb(e.tty,t[n+i])}catch(e){throw new ve(29)}return r&&(e.node.mtime=e.node.ctime=Date.now()),i}},se={xb(){e:{if(!J.length){var e=null;if(u){var t=Buffer.alloc(256),n=0,r=process.stdin.fd;try{n=b.readSync(r,t,0,256)}catch(e){if(!e.toString().includes("EOF"))throw e;n=0}0<n&&(e=t.slice(0,n).toString("utf-8"))}else"undefined"!=typeof window&&"function"==typeof window.prompt&&(null!==(e=window.prompt("Input: "))&&(e+="\n"));if(!e){e=null;break e}J=ne(e,!0)}e=J.shift()}return e},qb(e,t){null===t||10===t?(p($(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){0<e.output?.length&&(p($(e.output)),e.output=[])},Tb:()=>({Ob:25856,Qb:5,Nb:191,Pb:35387,Mb:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),Ub:()=>0,Vb:()=>[24,80]},ae={qb(e,t){null===t||10===t?(g($(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){0<e.output?.length&&(g($(e.output)),e.output=[])}},ue={Wa:null,Xa:()=>ue.createNode(null,"/",16895,0),createNode(e,t,n,r){if(24576==(61440&n)||4096==(61440&n))throw new ve(63);return ue.Wa||(ue.Wa={dir:{node:{Ta:ue.La.Ta,Ua:ue.La.Ua,lookup:ue.La.lookup,hb:ue.La.hb,rename:ue.La.rename,unlink:ue.La.unlink,rmdir:ue.La.rmdir,readdir:ue.La.readdir,symlink:ue.La.symlink},stream:{Va:ue.Ma.Va}},file:{node:{Ta:ue.La.Ta,Ua:ue.La.Ua},stream:{Va:ue.Ma.Va,read:ue.Ma.read,write:ue.Ma.write,ib:ue.Ma.ib,jb:ue.Ma.jb}},link:{node:{Ta:ue.La.Ta,Ua:ue.La.Ua,readlink:ue.La.readlink},stream:{}},ub:{node:{Ta:ue.La.Ta,Ua:ue.La.Ua},stream:Pe}}),Se((n=Me(e,t,n,r)).mode)?(n.La=ue.Wa.dir.node,n.Ma=ue.Wa.dir.stream,n.Na={}):32768==(61440&n.mode)?(n.La=ue.Wa.file.node,n.Ma=ue.Wa.file.stream,n.Ra=0,n.Na=null):40960==(61440&n.mode)?(n.La=ue.Wa.link.node,n.Ma=ue.Wa.link.stream):8192==(61440&n.mode)&&(n.La=ue.Wa.ub.node,n.Ma=ue.Wa.ub.stream),n.atime=n.mtime=n.ctime=Date.now(),e&&(e.Na[t]=n,e.atime=e.mtime=e.ctime=n.atime),n},Sb:e=>e.Na?e.Na.subarray?e.Na.subarray(0,e.Ra):new Uint8Array(e.Na):new Uint8Array(0),La:{Ta(e){var t={};return t.dev=8192==(61440&e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,Se(e.mode)?t.size=4096:32768==(61440&e.mode)?t.size=e.Ra:40960==(61440&e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.atime),t.mtime=new Date(e.mtime),t.ctime=new Date(e.ctime),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},Ua(e,t){for(var n of["mode","atime","mtime","ctime"])null!=t[n]&&(e[n]=t[n]);void 0!==t.size&&(t=t.size,e.Ra!=t&&(0==t?(e.Na=null,e.Ra=0):(n=e.Na,e.Na=new Uint8Array(t),n&&e.Na.set(n.subarray(0,Math.min(t,e.Ra))),e.Ra=t)))},lookup(){throw ue.vb},hb:(e,t,n,r)=>ue.createNode(e,t,n,r),rename(e,t,n){try{var r=Ne(t,n)}catch(e){}if(r){if(Se(e.mode))for(var i in r.Na)throw new ve(55);Te(r)}delete e.parent.Na[e.name],t.Na[n]=e,e.name=n,t.ctime=t.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,t){delete e.Na[t],e.ctime=e.mtime=Date.now()},rmdir(e,t){var n,r=Ne(e,t);for(n in r.Na)throw new ve(55);delete e.Na[t],e.ctime=e.mtime=Date.now()},readdir:e=>[".","..",...Object.keys(e.Na)],symlink:(e,t,n)=>((e=ue.createNode(e,t,41471,0)).link=n,e),readlink(e){if(40960!=(61440&e.mode))throw new ve(28);return e.link}},Ma:{read(e,t,n,r,i){var o=e.node.Na;if(i>=e.node.Ra)return 0;if(8<(e=Math.min(e.node.Ra-i,r))&&o.subarray)t.set(o.subarray(i,i+e),n);else for(r=0;r<e;r++)t[n+r]=o[i+r];return e},write(e,t,n,r,i,o){if(t.buffer===y.buffer&&(o=!1),!r)return 0;if((e=e.node).mtime=e.ctime=Date.now(),t.subarray&&(!e.Na||e.Na.subarray)){if(o)return e.Na=t.subarray(n,n+r),e.Ra=r;if(0===e.Ra&&0===i)return e.Na=t.slice(n,n+r),e.Ra=r;if(i+r<=e.Ra)return e.Na.set(t.subarray(n,n+r),i),r}o=i+r;var s=e.Na?e.Na.length:0;if(s>=o||(o=Math.max(o,s*(1048576>s?2:1.125)>>>0),0!=s&&(o=Math.max(o,256)),s=e.Na,e.Na=new Uint8Array(o),0<e.Ra&&e.Na.set(s.subarray(0,e.Ra),0)),e.Na.subarray&&t.subarray)e.Na.set(t.subarray(n,n+r),i);else for(o=0;o<r;o++)e.Na[i+o]=t[n+o];return e.Ra=Math.max(e.Ra,i+r),r},Va(e,t,n){if(1===n?t+=e.position:2===n&&32768==(61440&e.node.mode)&&(t+=e.node.Ra),0>t)throw new ve(28);return t},ib(e,t,n,r,i){if(32768!=(61440&e.node.mode))throw new ve(43);if(e=e.node.Na,2&i||!e||e.buffer!==y.buffer){i=!0,r=65536*Math.ceil(t/65536);var o=Nt(65536,r);if(o&&_.fill(0,o,o+r),!(r=o))throw new ve(48);e&&((0<n||n+t<e.length)&&(e=e.subarray?e.subarray(n,n+t):Array.prototype.slice.call(e,n,n+t)),y.set(e,r))}else i=!1,r=e.byteOffset;return{Kb:r,Ab:i}},jb:(e,t,n,r)=>(ue.Ma.write(e,t,0,r,n,!1),0)}},le=(e,t)=>{var n=0;return e&&(n|=365),t&&(n|=146),n},ce=null,he={},fe=[],de=1,me=null,be=!1,pe=!0,ge={},ve=class{name="ErrnoError";constructor(e){this.Pa=e}},we=class{gb={};node=null;get flags(){return this.gb.flags}set flags(e){this.gb.flags=e}get position(){return this.gb.position}set position(e){this.gb.position=e}},ye=class{La={};Ma={};ab=null;constructor(e,t,n,r){e||=this,this.parent=e,this.Xa=e.Xa,this.id=de++,this.name=t,this.mode=n,this.rdev=r,this.atime=this.mtime=this.ctime=Date.now()}get read(){return!(365&~this.mode)}set read(e){e?this.mode|=365:this.mode&=-366}get write(){return!(146&~this.mode)}set write(e){e?this.mode|=146:this.mode&=-147}};function _e(e,t={}){if(!e)throw new ve(44);t.nb??(t.nb=!0),"/"===e.charAt(0)||(e="//"+e);var n=0;e:for(;40>n;n++){e=e.split("/").filter(e=>!!e);for(var r=ce,i="/",o=0;o<e.length;o++){var s=o===e.length-1;if(s&&t.parent)break;if("."!==e[o])if(".."===e[o])i=V(i),r=r.parent;else{i=X(i+"/"+e[o]);try{r=Ne(r,e[o])}catch(e){if(44===e?.Pa&&s&&t.Jb)return{path:i};throw e}if(!r.ab||s&&!t.nb||(r=r.ab.root),40960==(61440&r.mode)&&(!s||t.$a)){if(!r.La.readlink)throw new ve(52);"/"===(r=r.La.readlink(r)).charAt(0)||(r=V(i)+"/"+r),e=r+"/"+e.slice(o+1).join("/");continue e}}}return{path:i,node:r}}throw new ve(32)}function Ee(e){for(var t;;){if(e===e.parent)return e=e.Xa.zb,t?"/"!==e[e.length-1]?`${e}/${t}`:e+t:e;t=t?`${e.name}/${t}`:e.name,e=e.parent}}function Ae(e,t){for(var n=0,r=0;r<t.length;r++)n=(n<<5)-n+t.charCodeAt(r)|0;return(e+n>>>0)%me.length}function Te(e){var t=Ae(e.parent.id,e.name);if(me[t]===e)me[t]=e.bb;else for(t=me[t];t;){if(t.bb===e){t.bb=e.bb;break}t=t.bb}}function Ne(e,t){var n=Se(e.mode)?(n=qe(e,"x"))?n:e.La.lookup?0:2:54;if(n)throw new ve(n);for(n=me[Ae(e.id,t)];n;n=n.bb){var r=n.name;if(n.parent.id===e.id&&r===t)return n}return e.La.lookup(e,t)}function Me(e,t,n,r){return t=Ae((e=new ye(e,t,n,r)).parent.id,e.name),e.bb=me[t],me[t]=e}function Se(e){return 16384==(61440&e)}function ke(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t}function qe(e,t){return pe?0:!t.includes("r")||292&e.mode?t.includes("w")&&!(146&e.mode)||t.includes("x")&&!(73&e.mode)?2:0:2}function Le(e,t){if(!Se(e.mode))return 54;try{return Ne(e,t),20}catch(e){}return qe(e,"wx")}function Re(e,t,n){try{var r=Ne(e,t)}catch(e){return e.Pa}if(e=qe(e,"wx"))return e;if(n){if(!Se(r.mode))return 54;if(r===r.parent||"/"===Ee(r))return 10}else if(Se(r.mode))return 31;return 0}function Ie(e){if(!e)throw new ve(63);return e}function Oe(e){if(!(e=fe[e]))throw new ve(8);return e}function De(e,t=-1){if(e=Object.assign(new we,e),-1==t)e:{for(t=0;4096>=t;t++)if(!fe[t])break e;throw new ve(33)}return e.fd=t,fe[t]=e}function Ce(e,t,n){var r=e?.Ma.Ua;e=r?e:t,r??=t.La.Ua,Ie(r),r(e,n)}var Pe={open(e){e.Ma=he[e.node.rdev].Ma,e.Ma.open?.(e)},Va(){throw new ve(70)}};function xe(e,t){he[e]={Ma:t}}function Ue(e,t){var n="/"===t;if(n&&ce)throw new ve(10);if(!n&&t){var r=_e(t,{nb:!1});if(t=r.path,(r=r.node).ab)throw new ve(10);if(!Se(r.mode))throw new ve(54)}t={type:e,Wb:{},zb:t,Ib:[]},(e=e.Xa(t)).Xa=t,t.root=e,n?ce=e:r&&(r.ab=t,r.Xa&&r.Xa.Ib.push(t))}function Fe(e,t,n){var r=_e(e,{parent:!0}).node;if(!(e=K(e)))throw new ve(28);if("."===e||".."===e)throw new ve(20);var i=Le(r,e);if(i)throw new ve(i);if(!r.La.hb)throw new ve(63);return r.La.hb(r,e,t,n)}function Be(e,t=511){return Fe(e,1023&t|16384,0)}function ze(e,t,n){void 0===n&&(n=t,t=438),Fe(e,8192|t,n)}function We(e,t){if(!((...e)=>{for(var t="",n=!1,r=e.length-1;-1<=r&&!n;r--){if("string"!=typeof(n=0<=r?e[r]:"/"))throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";t=n+"/"+t,n="/"===n.charAt(0)}return(n?"/":"")+(t=Y(t.split("/").filter(e=>!!e),!n).join("/"))||"."})(e))throw new ve(44);var n=_e(t,{parent:!0}).node;if(!n)throw new ve(44);var r=Le(n,t=K(t));if(r)throw new ve(r);if(!n.La.symlink)throw new ve(63);n.La.symlink(n,t,e)}function Qe(e){var t=_e(e,{parent:!0}).node,n=Ne(t,e=K(e)),r=Re(t,e,!0);if(r)throw new ve(r);if(!t.La.rmdir)throw new ve(63);if(n.ab)throw new ve(10);t.La.rmdir(t,e),Te(n)}function He(e){var t=_e(e,{parent:!0}).node;if(!t)throw new ve(44);var n=Ne(t,e=K(e)),r=Re(t,e,!1);if(r)throw new ve(r);if(!t.La.unlink)throw new ve(63);if(n.ab)throw new ve(10);t.La.unlink(t,e),Te(n)}function Ge(e,t){return Ie((e=_e(e,{$a:!t}).node).La.Ta)(e)}function $e(e,t,n,r){Ce(e,t,{mode:4095&n|-4096&t.mode,ctime:Date.now(),Fb:r})}function je(e,t){$e(null,e="string"==typeof e?_e(e,{$a:!0}).node:e,t)}function Ye(e,t,n){if(Se(t.mode))throw new ve(31);if(32768!=(61440&t.mode))throw new ve(28);var r=qe(t,"w");if(r)throw new ve(r);Ce(e,t,{size:n,timestamp:Date.now()})}function Xe(e,t,n=438){if(""===e)throw new ve(44);if("string"==typeof t){var i={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[t];if(void 0===i)throw Error(`Unknown file open mode: ${t}`);t=i}if(n=64&t?4095&n|32768:0,"object"==typeof e)i=e;else{var o=e.endsWith("/");i=(e=_e(e,{$a:!(131072&t),Jb:!0})).node,e=e.path}var s=!1;if(64&t)if(i){if(128&t)throw new ve(20)}else{if(o)throw new ve(31);i=Fe(e,511|n,0),s=!0}if(!i)throw new ve(44);if(8192==(61440&i.mode)&&(t&=-513),65536&t&&!Se(i.mode))throw new ve(54);if(!s&&(o=i?40960==(61440&i.mode)?32:Se(i.mode)&&("r"!==ke(t)||576&t)?31:qe(i,ke(t)):44))throw new ve(o);return 512&t&&!s&&Ye(null,o="string"==typeof(o=i)?_e(o,{$a:!0}).node:o,0),t&=-131713,(o=De({node:i,path:Ee(i),flags:t,seekable:!0,position:0,Ma:i.Ma,Lb:[],error:!1})).Ma.open&&o.Ma.open(o),s&&je(i,511&n),!r.logReadFiles||1&t||e in ge||(ge[e]=1),o}function Ve(e){if(null===e.fd)throw new ve(8);e.ob&&(e.ob=null);try{e.Ma.close&&e.Ma.close(e)}catch(e){throw e}finally{fe[e.fd]=null}e.fd=null}function Ke(e,t,n){if(null===e.fd)throw new ve(8);if(!e.seekable||!e.Ma.Va)throw new ve(70);if(0!=n&&1!=n&&2!=n)throw new ve(28);e.position=e.Ma.Va(e,t,n),e.Lb=[]}function Ze(e,t,n,r,i){if(0>r||0>i)throw new ve(28);if(null===e.fd)throw new ve(8);if(1==(2097155&e.flags))throw new ve(8);if(Se(e.node.mode))throw new ve(31);if(!e.Ma.read)throw new ve(28);var o=void 0!==i;if(o){if(!e.seekable)throw new ve(70)}else i=e.position;return t=e.Ma.read(e,t,n,r,i),o||(e.position+=t),t}function Je(e,t,n,r,i){if(0>r||0>i)throw new ve(28);if(null===e.fd)throw new ve(8);if(!(2097155&e.flags))throw new ve(8);if(Se(e.node.mode))throw new ve(31);if(!e.Ma.write)throw new ve(28);e.seekable&&1024&e.flags&&Ke(e,0,2);var o=void 0!==i;if(o){if(!e.seekable)throw new ve(70)}else i=e.position;return t=e.Ma.write(e,t,n,r,i,void 0),o||(e.position+=t),t}function et(e,t,n){e=X("/dev/"+e);var r=le(!!t,!!n);et.yb??(et.yb=64);var i=et.yb++<<8;xe(i,{open(e){e.seekable=!1},close(){n?.buffer?.length&&n(10)},read(e,n,r,i){for(var o=0,s=0;s<i;s++){try{var a=t()}catch(e){throw new ve(29)}if(void 0===a&&0===o)throw new ve(6);if(null==a)break;o++,n[r+s]=a}return o&&(e.node.atime=Date.now()),o},write(e,t,r,i){for(var o=0;o<i;o++)try{n(t[r+o])}catch(e){throw new ve(29)}return i&&(e.node.mtime=e.node.ctime=Date.now()),o}}),ze(e,r,i)}function tt(e,t,n){if("/"===t.charAt(0))return t;if(e=-100===e?"/":Oe(e).path,0==t.length){if(!n)throw new ve(44);return e}return e+"/"+t}function nt(e,t){A[e>>2]=t.dev,A[e+4>>2]=t.mode,T[e+8>>2]=t.nlink,A[e+12>>2]=t.uid,A[e+16>>2]=t.gid,A[e+20>>2]=t.rdev,M[e+24>>3]=BigInt(t.size),A[e+32>>2]=4096,A[e+36>>2]=t.blocks;var n=t.atime.getTime(),r=t.mtime.getTime(),i=t.ctime.getTime();return M[e+40>>3]=BigInt(Math.floor(n/1e3)),T[e+48>>2]=n%1e3*1e6,M[e+56>>3]=BigInt(Math.floor(r/1e3)),T[e+64>>2]=r%1e3*1e6,M[e+72>>3]=BigInt(Math.floor(i/1e3)),T[e+80>>2]=i%1e3*1e6,M[e+88>>3]=BigInt(t.ino),0}var rt,it,ot,st=void 0,at=()=>{var e=A[+st>>2];return st+=4,e},ut=0,lt=[0,31,60,91,121,152,182,213,244,274,305,335],ct=[0,31,59,90,120,151,181,212,243,273,304,334],ht={},ft=e=>{w=e,Q||0<ut||(r.onExit?.(e),q=!0),d(e,new x(e))},dt={},mt=()=>{if(!rt){var e,t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:f||"./this.program"};for(e in dt)void 0===dt[e]?delete t[e]:t[e]=dt[e];var n=[];for(e in t)n.push(`${e}=${t[e]}`);rt=n}return rt},bt=e=>{var t=ee(e)+1,n=kt(t);return te(e,_,n,t),n},pt=0,gt=(e,t)=>(t=1==t?kt(e.length):At(e.length),e.subarray||e.slice||(e=new Uint8Array(e)),_.set(e,t),t),vt=[],wt=e=>{it.delete(ot.get(e)),ot.set(e,null),vt.push(e)},yt=(e,t)=>{if(!it){it=new WeakMap;var n=ot.length;if(it)for(var r=0;r<0+n;r++){var i=ot.get(r);i&&it.set(i,r)}}if(n=it.get(e)||0)return n;if(vt.length)n=vt.pop();else{try{ot.grow(1)}catch(e){if(!(e instanceof RangeError))throw e;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."}n=ot.length-1}try{ot.set(n,e)}catch(u){if(!(u instanceof TypeError))throw u;if("function"==typeof WebAssembly.Function){var o=WebAssembly.Function;r={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"},i={parameters:[],results:"v"==t[0]?[]:[r[t[0]]]};for(var s=1;s<t.length;++s)i.parameters.push(r[t[s]]);t=new o(i,e)}else{r=[1],i=t.slice(0,1),t=t.slice(1),s={i:127,p:127,j:126,f:125,d:124,e:111},r.push(96);var a=t.length;for(o of(128>a?r.push(a):r.push(a%128|128,a>>7),t))r.push(s[o]);"v"==i?r.push(0):r.push(1,s[i]),t=[0,97,115,109,1,0,0,0,1],128>(o=r.length)?t.push(o):t.push(o%128|128,o>>7),t.push(...r),t.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),t=new WebAssembly.Module(new Uint8Array(t)),t=new WebAssembly.Instance(t,{e:{f:e}}).exports.f}ot.set(n,t)}return it.set(e,n),n};me=Array(4096),Ue(ue,"/"),Be("/tmp"),Be("/home"),Be("/home/web_user"),function(){Be("/dev"),xe(259,{read:()=>0,write:(e,t,n,r)=>r,Va:()=>0}),ze("/dev/null",259),ie(1280,se),ie(1536,ae),ze("/dev/tty",1280),ze("/dev/tty1",1536);var e=new Uint8Array(1024),t=0,n=()=>(0===t&&(Z(e),t=e.byteLength),e[--t]);et("random",n),et("urandom",n),Be("/dev/shm"),Be("/dev/shm/tmp")}(),function(){Be("/proc");var e=Be("/proc/self");Be("/proc/self/fd"),Ue({Xa(){var t=Me(e,"fd",16895,73);return t.Ma={Va:ue.Ma.Va},t.La={lookup(e,t){var n=Oe(e=+t);return(e={parent:null,Xa:{zb:"fake"},La:{readlink:()=>n.path},id:e+1}).parent=e},readdir:()=>Array.from(fe.entries()).filter(([,e])=>e).map(([e])=>e.toString())},t}},"/proc/self/fd")}(),ue.vb=new ve(44),ue.vb.stack="<generic error, no stack>";var _t,Et={a:(e,t,n,r)=>C(`Assertion failed: ${e?$(_,e):""}, at: `+[t?t?$(_,t):"":"unknown filename",n,r?r?$(_,r):"":"unknown function"]),i:function(e,t){try{return je(e=e?$(_,e):"",t),0}catch(e){if("ErrnoError"!==e.name)throw e;return-e.Pa}},L:function(e,t,n){try{if(t=tt(e,t=t?$(_,t):""),-8&n)return-28;var r=_e(t,{$a:!0}).node;return r?(e="",4&n&&(e+="r"),2&n&&(e+="w"),1&n&&(e+="x"),e&&qe(r,e)?-2:0):-44}catch(e){if("ErrnoError"!==e.name)throw e;return-e.Pa}},j:function(e,t){try{var n=Oe(e);return $e(n,n.node,t,!1),0}catch(e){if("ErrnoError"!==e.name)throw e;return-e.Pa}},h:function(e){try{var t=Oe(e);return Ce(t,t.node,{timestamp:Date.now(),Fb:!1}),0}catch(e){if("ErrnoError"!==e.name)throw e;return-e.Pa}},b:function(e,t,n){st=n;try{var r=Oe(e);switch(t){case 0:var i=at();if(0>i)break;for(;fe[i];)i++;return function(e,t=-1){return e=De(e,t),e.Ma?.Rb?.(e),e}(r,i).fd;case 1:case 2:case 13:case 14:return 0;case 3:return r.flags;case 4:return i=at(),r.flags|=i,0;case 12:return i=at(),E[i+0>>1]=2,0}return-28}catch(e){if("ErrnoError"!==e.name)throw e;return-e.Pa}},g:function(e,t){try{var n=Oe(e),r=n.node,i=n.Ma.Ta;return e=i?n:r,i??=r.La.Ta,Ie(i),nt(t,i(e))}catch(e){if("ErrnoError"!==e.name)throw e;return-e.Pa}},H:function(e,t){t=-9007199254740992>t||9007199254740992<t?NaN:Number(t);try{if(isNaN(t))return 61;var n=Oe(e);if(0>t||!(2097155&n.flags))throw new ve(28);return Ye(n,n.node,t),0}catch(e){if("ErrnoError"!==e.name)throw e;return-e.Pa}},G:function(e,t){try{if(0===t)return-28;var n=ee("/")+1;return t<n?-68:(te("/",_,e,t),n)}catch(e){if("ErrnoError"!==e.name)throw e;return-e.Pa}},K:function(e,t){try{return nt(t,Ge(e=e?$(_,e):"",!0))}catch(e){if("ErrnoError"!==e.name)throw e;return-e.Pa}},C:function(e,t,n){try{return Be(t=tt(e,t=t?$(_,t):""),n),0}catch(e){if("ErrnoError"!==e.name)throw e;return-e.Pa}},J:function(e,t,n,r){try{t=t?$(_,t):"";var i=256&r;return t=tt(e,t,4096&r),nt(n,i?Ge(t,!0):Ge(t))}catch(e){if("ErrnoError"!==e.name)throw e;return-e.Pa}},x:function(e,t,n,r){st=r;try{return Xe(t=tt(e,t=t?$(_,t):""),n,r?at():0).fd}catch(e){if("ErrnoError"!==e.name)throw e;return-e.Pa}},v:function(e,t,n,r){try{if(t=tt(e,t=t?$(_,t):""),0>=r)return-28;var i=_e(t).node;if(!i)throw new ve(44);if(!i.La.readlink)throw new ve(28);var o=i.La.readlink(i),s=Math.min(r,ee(o)),a=y[n+s];return te(o,_,n,r+1),y[n+s]=a,s}catch(e){if("ErrnoError"!==e.name)throw e;return-e.Pa}},u:function(e){try{return Qe(e=e?$(_,e):""),0}catch(e){if("ErrnoError"!==e.name)throw e;return-e.Pa}},f:function(e,t){try{return nt(t,Ge(e=e?$(_,e):""))}catch(e){if("ErrnoError"!==e.name)throw e;return-e.Pa}},r:function(e,t,n){try{return t=tt(e,t=t?$(_,t):""),0===n?He(t):512===n?Qe(t):C("Invalid flags passed to unlinkat"),0}catch(e){if("ErrnoError"!==e.name)throw e;return-e.Pa}},q:function(e,t,n){try{t=tt(e,t=t?$(_,t):"",!0);var r,i,o=Date.now();if(n){var s=T[n>>2]+4294967296*A[n+4>>2],a=A[n+8>>2];r=1073741823==a?o:1073741822==a?null:1e3*s+a/1e6,s=T[(n+=16)>>2]+4294967296*A[n+4>>2],i=1073741823==(a=A[n+8>>2])?o:1073741822==a?null:1e3*s+a/1e6}else i=r=o;if(null!==(i??r)){e=r;var u=_e(t,{$a:!0}).node;Ie(u.La.Ua)(u,{atime:e,mtime:i})}return 0}catch(e){if("ErrnoError"!==e.name)throw e;return-e.Pa}},m:()=>C(""),l:()=>{Q=!1,ut=0},A:function(e,t){e=-9007199254740992>e||9007199254740992<e?NaN:Number(e),e=new Date(1e3*e),A[t>>2]=e.getSeconds(),A[t+4>>2]=e.getMinutes(),A[t+8>>2]=e.getHours(),A[t+12>>2]=e.getDate(),A[t+16>>2]=e.getMonth(),A[t+20>>2]=e.getFullYear()-1900,A[t+24>>2]=e.getDay();var n=e.getFullYear();A[t+28>>2]=(0!=n%4||0==n%100&&0!=n%400?ct:lt)[e.getMonth()]+e.getDate()-1|0,A[t+36>>2]=-60*e.getTimezoneOffset(),n=new Date(e.getFullYear(),6,1).getTimezoneOffset();var r=new Date(e.getFullYear(),0,1).getTimezoneOffset();A[t+32>>2]=0|(n!=r&&e.getTimezoneOffset()==Math.min(r,n))},y:function(e,t,n,r,i,o,s){i=-9007199254740992>i||9007199254740992<i?NaN:Number(i);try{if(isNaN(i))return 61;var a=Oe(r);if(2&t&&!(2&n)&&2!=(2097155&a.flags))throw new ve(2);if(1==(2097155&a.flags))throw new ve(2);if(!a.Ma.ib)throw new ve(43);if(!e)throw new ve(28);var u=a.Ma.ib(a,e,i,t,n),l=u.Kb;return A[o>>2]=u.Ab,T[s>>2]=l,0}catch(e){if("ErrnoError"!==e.name)throw e;return-e.Pa}},z:function(e,t,n,r,i,o){o=-9007199254740992>o||9007199254740992<o?NaN:Number(o);try{var s=Oe(i);if(2&n){if(n=o,32768!=(61440&s.node.mode))throw new ve(43);if(!(2&r)){var a=_.slice(e,e+t);s.Ma.jb&&s.Ma.jb(s,a,n,t,r)}}}catch(e){if("ErrnoError"!==e.name)throw e;return-e.Pa}},n:(e,t)=>{if(ht[e]&&(clearTimeout(ht[e].id),delete ht[e]),!t)return 0;var n=setTimeout(()=>{delete ht[e],(e=>{if(!q)try{if(e(),!(Q||0<ut))try{w=e=w,ft(e)}catch(e){e instanceof x||"unwind"==e||d(1,e)}}catch(e){e instanceof x||"unwind"==e||d(1,e)}})(()=>Mt(e,performance.now()))},t);return ht[e]={id:n,Xb:t},0},B:(e,t,n,r)=>{var i=(new Date).getFullYear(),o=new Date(i,0,1).getTimezoneOffset();i=new Date(i,6,1).getTimezoneOffset(),T[e>>2]=60*Math.max(o,i),A[t>>2]=Number(o!=i),e=(t=e=>{var t=Math.abs(e);return`UTC${0<=e?"-":"+"}${String(Math.floor(t/60)).padStart(2,"0")}${String(t%60).padStart(2,"0")}`})(o),t=t(i),i<o?(te(e,_,n,17),te(t,_,r,17)):(te(e,_,r,17),te(t,_,n,17))},d:()=>Date.now(),s:()=>2147483648,c:()=>performance.now(),o:e=>{var t=_.length;if(2147483648<(e>>>=0))return!1;for(var n=1;4>=n;n*=2){var r=t*(1+.2/n);r=Math.min(r,e+100663296);e:{r=(Math.min(2147483648,65536*Math.ceil(Math.max(e,r)/65536))-v.buffer.byteLength+65535)/65536|0;try{v.grow(r),R();var i=1;break e}catch(e){}i=void 0}if(i)return!0}return!1},E:(e,t)=>{var n=0;return mt().forEach((r,i)=>{var o=t+n;for(i=T[e+4*i>>2]=o,o=0;o<r.length;++o)y[i++]=r.charCodeAt(o);y[i]=0,n+=r.length+1}),0},F:(e,t)=>{var n=mt();T[e>>2]=n.length;var r=0;return n.forEach(e=>r+=e.length+1),T[t>>2]=r,0},e:function(e){try{return Ve(Oe(e)),0}catch(e){if("ErrnoError"!==e.name)throw e;return e.Pa}},p:function(e,t){try{var n=Oe(e);return y[t]=n.tty?2:Se(n.mode)?3:40960==(61440&n.mode)?7:4,E[t+2>>1]=0,M[t+8>>3]=BigInt(0),M[t+16>>3]=BigInt(0),0}catch(e){if("ErrnoError"!==e.name)throw e;return e.Pa}},w:function(e,t,n,r){try{e:{var i=Oe(e);e=t;for(var o,s=t=0;s<n;s++){var a=T[e>>2],u=T[e+4>>2];e+=8;var l=Ze(i,y,a,u,o);if(0>l){var c=-1;break e}if(t+=l,l<u)break;void 0!==o&&(o+=l)}c=t}return T[r>>2]=c,0}catch(e){if("ErrnoError"!==e.name)throw e;return e.Pa}},D:function(e,t,n,r){t=-9007199254740992>t||9007199254740992<t?NaN:Number(t);try{if(isNaN(t))return 61;var i=Oe(e);return Ke(i,t,n),M[r>>3]=BigInt(i.position),i.ob&&0===t&&0===n&&(i.ob=null),0}catch(e){if("ErrnoError"!==e.name)throw e;return e.Pa}},I:function(e){try{var t=Oe(e);return t.Ma?.fsync?t.Ma.fsync(t):0}catch(e){if("ErrnoError"!==e.name)throw e;return e.Pa}},t:function(e,t,n,r){try{e:{var i=Oe(e);e=t;for(var o,s=t=0;s<n;s++){var a=T[e>>2],u=T[e+4>>2];e+=8;var l=Je(i,y,a,u,o);if(0>l){var c=-1;break e}if(t+=l,l<u)break;void 0!==o&&(o+=l)}c=t}return T[r>>2]=c,0}catch(e){if("ErrnoError"!==e.name)throw e;return e.Pa}},k:ft};!async function(){function e(e){return _t=e.exports,v=_t.M,R(),ot=_t.O,O--,r.monitorRunDependencies?.(O),0==O&&D&&(e=D,D=null,e()),_t}O++,r.monitorRunDependencies?.(O);var t={a:Et};r.instantiateWasm?new Promise(n=>{r.instantiateWasm(t,(t,r)=>{e(t),n(t.exports)})}):(I??=r.locateFile?r.locateFile("sql-wasm.wasm",m):m+"sql-wasm.wasm",e((await async function(e){var t=I;if(!k&&"function"==typeof WebAssembly.instantiateStreaming&&!L(t)&&!u)try{var n=fetch(t,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(n,e)}catch(e){g(`wasm streaming compile failed: ${e}`),g("falling back to ArrayBuffer instantiation")}return P(t,e)}(t)).instance))}(),r._sqlite3_free=e=>(r._sqlite3_free=_t.P)(e),r._sqlite3_value_text=e=>(r._sqlite3_value_text=_t.Q)(e),r._sqlite3_prepare_v2=(e,t,n,i,o)=>(r._sqlite3_prepare_v2=_t.R)(e,t,n,i,o),r._sqlite3_step=e=>(r._sqlite3_step=_t.S)(e),r._sqlite3_reset=e=>(r._sqlite3_reset=_t.T)(e),r._sqlite3_exec=(e,t,n,i,o)=>(r._sqlite3_exec=_t.U)(e,t,n,i,o),r._sqlite3_finalize=e=>(r._sqlite3_finalize=_t.V)(e),r._sqlite3_column_name=(e,t)=>(r._sqlite3_column_name=_t.W)(e,t),r._sqlite3_column_text=(e,t)=>(r._sqlite3_column_text=_t.X)(e,t),r._sqlite3_column_type=(e,t)=>(r._sqlite3_column_type=_t.Y)(e,t),r._sqlite3_errmsg=e=>(r._sqlite3_errmsg=_t.Z)(e),r._sqlite3_clear_bindings=e=>(r._sqlite3_clear_bindings=_t._)(e),r._sqlite3_value_blob=e=>(r._sqlite3_value_blob=_t.$)(e),r._sqlite3_value_bytes=e=>(r._sqlite3_value_bytes=_t.aa)(e),r._sqlite3_value_double=e=>(r._sqlite3_value_double=_t.ba)(e),r._sqlite3_value_int=e=>(r._sqlite3_value_int=_t.ca)(e),r._sqlite3_value_type=e=>(r._sqlite3_value_type=_t.da)(e),r._sqlite3_result_blob=(e,t,n,i)=>(r._sqlite3_result_blob=_t.ea)(e,t,n,i),r._sqlite3_result_double=(e,t)=>(r._sqlite3_result_double=_t.fa)(e,t),r._sqlite3_result_error=(e,t,n)=>(r._sqlite3_result_error=_t.ga)(e,t,n),r._sqlite3_result_int=(e,t)=>(r._sqlite3_result_int=_t.ha)(e,t),r._sqlite3_result_int64=(e,t)=>(r._sqlite3_result_int64=_t.ia)(e,t),r._sqlite3_result_null=e=>(r._sqlite3_result_null=_t.ja)(e),r._sqlite3_result_text=(e,t,n,i)=>(r._sqlite3_result_text=_t.ka)(e,t,n,i),r._sqlite3_aggregate_context=(e,t)=>(r._sqlite3_aggregate_context=_t.la)(e,t),r._sqlite3_column_count=e=>(r._sqlite3_column_count=_t.ma)(e),r._sqlite3_data_count=e=>(r._sqlite3_data_count=_t.na)(e),r._sqlite3_column_blob=(e,t)=>(r._sqlite3_column_blob=_t.oa)(e,t),r._sqlite3_column_bytes=(e,t)=>(r._sqlite3_column_bytes=_t.pa)(e,t),r._sqlite3_column_double=(e,t)=>(r._sqlite3_column_double=_t.qa)(e,t),r._sqlite3_bind_blob=(e,t,n,i,o)=>(r._sqlite3_bind_blob=_t.ra)(e,t,n,i,o),r._sqlite3_bind_double=(e,t,n)=>(r._sqlite3_bind_double=_t.sa)(e,t,n),r._sqlite3_bind_int=(e,t,n)=>(r._sqlite3_bind_int=_t.ta)(e,t,n),r._sqlite3_bind_text=(e,t,n,i,o)=>(r._sqlite3_bind_text=_t.ua)(e,t,n,i,o),r._sqlite3_bind_parameter_index=(e,t)=>(r._sqlite3_bind_parameter_index=_t.va)(e,t),r._sqlite3_sql=e=>(r._sqlite3_sql=_t.wa)(e),r._sqlite3_normalized_sql=e=>(r._sqlite3_normalized_sql=_t.xa)(e),r._sqlite3_changes=e=>(r._sqlite3_changes=_t.ya)(e),r._sqlite3_close_v2=e=>(r._sqlite3_close_v2=_t.za)(e),r._sqlite3_create_function_v2=(e,t,n,i,o,s,a,u,l)=>(r._sqlite3_create_function_v2=_t.Aa)(e,t,n,i,o,s,a,u,l),r._sqlite3_update_hook=(e,t,n)=>(r._sqlite3_update_hook=_t.Ba)(e,t,n),r._sqlite3_open=(e,t)=>(r._sqlite3_open=_t.Ca)(e,t);var At=r._malloc=e=>(At=r._malloc=_t.Da)(e),Tt=r._free=e=>(Tt=r._free=_t.Ea)(e);r._RegisterExtensionFunctions=e=>(r._RegisterExtensionFunctions=_t.Fa)(e);var Nt=(e,t)=>(Nt=_t.Ga)(e,t),Mt=(e,t)=>(Mt=_t.Ha)(e,t),St=e=>(St=_t.Ia)(e),kt=e=>(kt=_t.Ja)(e),qt=()=>(qt=_t.Ka)();if(r.stackSave=()=>qt(),r.stackRestore=e=>St(e),r.stackAlloc=e=>kt(e),r.cwrap=(e,t,n,i)=>{var o=!n||n.every(e=>"number"===e||"boolean"===e);return"string"!==t&&o&&!i?r["_"+e]:(...i)=>((e,t,n,i)=>{var o={string:e=>{var t=0;return null!=e&&0!==e&&(t=bt(e)),t},array:e=>{var t=kt(e.length);return y.set(e,t),t}};e=r["_"+e];var s,a=[],u=0;if(i)for(var l=0;l<i.length;l++){var c=o[n[l]];c?(0===u&&(u=qt()),a[l]=c(i[l])):a[l]=i[l]}return n=e(...a),s=n,0!==u&&St(u),"string"===t?s?$(_,s):"":"boolean"===t?!!s:s})(e,t,n,i)},r.addFunction=yt,r.removeFunction=wt,r.UTF8ToString=j,r.ALLOC_NORMAL=pt,r.allocate=gt,r.allocateUTF8OnStack=bt,r.preInit)for("function"==typeof r.preInit&&(r.preInit=[r.preInit]);0<r.preInit.length;)r.preInit.pop()();return function e(){function t(){if(r.calledRun=!0,!q){var e,t;if(!r.noFSInit&&!be)be=!0,n??=r.stdin,e??=r.stdout,t??=r.stderr,n?et("stdin",n):We("/dev/tty","/dev/stdin"),e?et("stdout",null,e):We("/dev/tty","/dev/stdout"),t?et("stderr",null,t):We("/dev/tty1","/dev/stderr"),Xe("/dev/stdin",0),Xe("/dev/stdout",1),Xe("/dev/stderr",1);if(_t.N(),pe=!1,r.onRuntimeInitialized?.(),r.postRun)for("function"==typeof r.postRun&&(r.postRun=[r.postRun]);r.postRun.length;){var n=r.postRun.shift();F.unshift(n)}U(F)}}if(0<O)D=e;else{if(r.preRun)for("function"==typeof r.preRun&&(r.preRun=[r.preRun]);r.preRun.length;)z();U(B),0<O?D=e:r.setStatus?(r.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>r.setStatus(""),1),t()},1)):t()}}(),i}))};"object"==typeof exports&&"object"==typeof module?(module.exports=n,module.exports.default=n):"function"==typeof define&&define.amd?define([],function(){return n}):"object"==typeof exports&&(exports.Module=n);var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})};class i{constructor(e){if(this.codebook=null,this.trained=!1,this.config={dimension:e.dimension,numSubvectors:e.numSubvectors,numCentroids:e.numCentroids,maxIterations:e.maxIterations||50,convergenceThreshold:e.convergenceThreshold||1e-4},this.config.dimension%this.config.numSubvectors!==0)throw new Error(`Dimension ${this.config.dimension} must be divisible by numSubvectors ${this.config.numSubvectors}`)}train(e){return r(this,void 0,void 0,function*(){if(0===e.length)throw new Error("Training requires at least one vector");const t=this.config.dimension/this.config.numSubvectors,n=[];console.log(`[PQ] Training ${this.config.numSubvectors} subvectors with ${this.config.numCentroids} centroids each...`);for(let r=0;r<this.config.numSubvectors;r++){const i=r*t,o=i+t,s=e.map(e=>e.slice(i,o)),a=yield this.kMeans(s,this.config.numCentroids);n.push(...a),(r+1)%4!=0&&r!==this.config.numSubvectors-1||console.log(`[PQ] Trained ${r+1}/${this.config.numSubvectors} subvectors`)}this.codebook={subvectorDim:t,numSubvectors:this.config.numSubvectors,numCentroids:this.config.numCentroids,centroids:n},this.trained=!0,console.log("[PQ] Training complete")})}kMeans(e,t){return r(this,void 0,void 0,function*(){const n=e[0].length,r=e.length,i=this.kMeansPlusPlus(e,t),o=new Uint32Array(r);let s=1/0;for(let a=0;a<this.config.maxIterations;a++){let a=0;for(let n=0;n<r;n++){let r=1/0,s=0;for(let o=0;o<t;o++){const t=this.squaredDistance(e[n],i[o]);t<r&&(r=t,s=o)}o[n]=s,a+=r}if(Math.abs(s-a)<this.config.convergenceThreshold)break;s=a;const u=new Uint32Array(t),l=Array.from({length:t},()=>new Float32Array(n));for(let t=0;t<r;t++){const r=o[t];u[r]++;for(let i=0;i<n;i++)l[r][i]+=e[t][i]}for(let e=0;e<t;e++)if(u[e]>0)for(let t=0;t<n;t++)i[e][t]=l[e][t]/u[e]}return i})}kMeansPlusPlus(e,t){const n=e.length,r=(e[0].length,[]),i=Math.floor(Math.random()*n);r.push(new Float32Array(e[i]));for(let i=1;i<t;i++){const t=new Float32Array(n);let i=0;for(let o=0;o<n;o++){let n=1/0;for(const t of r){const r=this.squaredDistance(e[o],t);n=Math.min(n,r)}t[o]=n,i+=n}let o=Math.random()*i;for(let i=0;i<n;i++)if(o-=t[i],o<=0){r.push(new Float32Array(e[i]));break}}return r}compress(e){if(!this.trained||!this.codebook)throw new Error("Codebook must be trained before compression");const t=new Uint8Array(this.config.numSubvectors),n=this.codebook.subvectorDim;let r=0;for(let t=0;t<e.length;t++)r+=e[t]*e[t];r=Math.sqrt(r);for(let r=0;r<this.config.numSubvectors;r++){const i=r*n,o=e.slice(i,i+n);let s=1/0,a=0;const u=r*this.config.numCentroids;for(let e=0;e<this.config.numCentroids;e++){const t=this.codebook.centroids[u+e],n=this.squaredDistance(o,t);n<s&&(s=n,a=e)}t[r]=a}return{codes:t,norm:r}}decompress(e){if(!this.codebook)throw new Error("Codebook not available");const t=new Float32Array(this.config.dimension),n=this.codebook.subvectorDim;for(let r=0;r<this.config.numSubvectors;r++){const i=e.codes[r],o=r*this.config.numCentroids,s=this.codebook.centroids[o+i],a=r*n;for(let e=0;e<n;e++)t[a+e]=s[e]}return t}asymmetricDistance(e,t){if(!this.codebook)throw new Error("Codebook not available");let n=0;const r=this.codebook.subvectorDim;for(let i=0;i<this.config.numSubvectors;i++){const o=t.codes[i],s=i*this.config.numCentroids,a=this.codebook.centroids[s+o],u=i*r,l=e.slice(u,u+r);n+=this.squaredDistance(l,a)}return Math.sqrt(n)}batchCompress(e){return e.map(e=>this.compress(e))}getCompressionRatio(){return 4*this.config.dimension/(this.config.numSubvectors+4)}exportCodebook(){if(!this.codebook)throw new Error("No codebook to export");return JSON.stringify({config:this.config,codebook:{subvectorDim:this.codebook.subvectorDim,numSubvectors:this.codebook.numSubvectors,numCentroids:this.codebook.numCentroids,centroids:this.codebook.centroids.map(e=>Array.from(e))}})}importCodebook(e){const t=JSON.parse(e);this.config=t.config,this.codebook={subvectorDim:t.codebook.subvectorDim,numSubvectors:t.codebook.numSubvectors,numCentroids:t.codebook.numCentroids,centroids:t.codebook.centroids.map(e=>new Float32Array(e))},this.trained=!0}squaredDistance(e,t){let n=0;for(let r=0;r<e.length;r++){const i=e[r]-t[r];n+=i*i}return n}getStats(){const e=this.getCompressionRatio(),t=this.config.numSubvectors+4,n=this.codebook?this.config.numSubvectors*this.config.numCentroids*(this.config.dimension/this.config.numSubvectors)*4:0;return{trained:this.trained,compressionRatio:e,memoryPerVector:t,codebookSize:n}}}class o{constructor(){this.items=[]}push(e,t){this.items.push({item:e,priority:t}),this.bubbleUp(this.items.length-1)}pop(){if(0===this.items.length)return;const e=this.items[0].item,t=this.items.pop();return this.items.length>0&&(this.items[0]=t,this.bubbleDown(0)),e}peek(){var e;return null===(e=this.items[0])||void 0===e?void 0:e.item}size(){return this.items.length}bubbleUp(e){for(;e>0;){const t=Math.floor((e-1)/2);if(this.items[e].priority>=this.items[t].priority)break;[this.items[e],this.items[t]]=[this.items[t],this.items[e]],e=t}}bubbleDown(e){for(;;){const t=2*e+1,n=2*e+2;let r=e;if(t<this.items.length&&this.items[t].priority<this.items[r].priority&&(r=t),n<this.items.length&&this.items[n].priority<this.items[r].priority&&(r=n),r===e)break;[this.items[e],this.items[r]]=[this.items[r],this.items[e]],e=r}}}class s{constructor(e={}){this.nodes=new Map,this.entryPoint=null,this.currentId=0,this.config={dimension:e.dimension||384,M:e.M||16,efConstruction:e.efConstruction||200,efSearch:e.efSearch||50,ml:e.ml||1/Math.log(2),maxLayers:e.maxLayers||16,distanceFunction:e.distanceFunction||"cosine"},this.ml=this.config.ml}add(e,t){const n=void 0!==t?t:this.currentId++,r=this.randomLevel(),i={id:n,vector:e,level:r,connections:new Map};for(let e=0;e<=r;e++)i.connections.set(e,[]);if(null===this.entryPoint)return this.entryPoint=n,this.nodes.set(n,i),n;const o=this.entryPoint;let s=o;for(let t=this.nodes.get(o).level;t>r;t--)s=this.searchLayer(e,s,1,t)[0];for(let t=Math.min(r,this.nodes.get(o).level);t>=0;t--){const r=this.searchLayer(e,s,this.config.efConstruction,t),i=0===t?2*this.config.M:this.config.M,o=this.selectNeighbors(e,r,i);for(const e of o){this.connect(n,e,t),this.connect(e,n,t);const r=this.nodes.get(e),o=r.connections.get(t);if(o.length>i){const e=this.selectNeighbors(r.vector,o,i);r.connections.set(t,e)}}s=r[0]}return r>this.nodes.get(this.entryPoint).level&&(this.entryPoint=n),this.nodes.set(n,i),n}search(e,t,n){if(null===this.entryPoint)return[];n=n||Math.max(this.config.efSearch,t);let r=this.entryPoint,i=r;for(let t=this.nodes.get(r).level;t>0;t--)i=this.searchLayer(e,i,1,t)[0];return this.searchLayer(e,i,n,0).slice(0,t).map(t=>({id:t,distance:this.distance(e,this.nodes.get(t).vector),vector:this.nodes.get(t).vector}))}searchLayer(e,t,n,r){const i=new Set,s=new o,a=new o,u=this.distance(e,this.nodes.get(t).vector);for(s.push(t,u),a.push(t,-u),i.add(t);s.size()>0;){const t=s.pop(),o=-a.peek();if(this.distance(e,this.nodes.get(t).vector)>o)break;const u=this.nodes.get(t).connections.get(r)||[];for(const t of u){if(i.has(t))continue;i.add(t);const r=this.distance(e,this.nodes.get(t).vector);(r<-a.peek()||a.size()<n)&&(s.push(t,r),a.push(t,-r),a.size()>n&&a.pop())}}const l=[];for(;a.size()>0;)l.unshift(a.pop());return l}selectNeighbors(e,t,n){if(t.length<=n)return t;return t.map(t=>({id:t,distance:this.distance(e,this.nodes.get(t).vector)})).sort((e,t)=>e.distance-t.distance).slice(0,n).map(e=>e.id)}connect(e,t,n){const r=this.nodes.get(e).connections.get(n);r.includes(t)||r.push(t)}randomLevel(){let e=0;for(;Math.random()<this.ml&&e<this.config.maxLayers-1;)e++;return e}distance(e,t){switch(this.config.distanceFunction){case"cosine":default:return 1-this.cosineSimilarity(e,t);case"euclidean":return this.euclideanDistance(e,t);case"manhattan":return this.manhattanDistance(e,t)}}cosineSimilarity(e,t){let n=0,r=0,i=0;for(let o=0;o<e.length;o++)n+=e[o]*t[o],r+=e[o]*e[o],i+=t[o]*t[o];return n/(Math.sqrt(r)*Math.sqrt(i))}euclideanDistance(e,t){let n=0;for(let r=0;r<e.length;r++){const i=e[r]-t[r];n+=i*i}return Math.sqrt(n)}manhattanDistance(e,t){let n=0;for(let r=0;r<e.length;r++)n+=Math.abs(e[r]-t[r]);return n}getStats(){if(0===this.nodes.size)return{numNodes:0,numLayers:0,avgConnections:0,entryPointLevel:0,memoryBytes:0};const e=Math.max(...Array.from(this.nodes.values()).map(e=>e.level));let t=0;for(const e of this.nodes.values())for(const n of e.connections.values())t+=n.length;const n=t/this.nodes.size,r=4*this.config.dimension,i=4*n,o=this.nodes.size*(r+i+100);return{numNodes:this.nodes.size,numLayers:e+1,avgConnections:n,entryPointLevel:this.entryPoint?this.nodes.get(this.entryPoint).level:0,memoryBytes:o}}export(){const e={config:this.config,entryPoint:this.entryPoint,currentId:this.currentId,nodes:Array.from(this.nodes.entries()).map(([e,t])=>({id:e,vector:Array.from(t.vector),level:t.level,connections:Array.from(t.connections.entries())}))};return JSON.stringify(e)}import(e){const t=JSON.parse(e);this.config=t.config,this.entryPoint=t.entryPoint,this.currentId=t.currentId,this.nodes.clear();for(const e of t.nodes){const t={id:e.id,vector:new Float32Array(e.vector),level:e.level,connections:new Map(e.connections)};this.nodes.set(e.id,t)}}clear(){this.nodes.clear(),this.entryPoint=null,this.currentId=0}size(){return this.nodes.size}}r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})};function a(){return r(this,void 0,void 0,function*(){try{const e=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,253,12,253,12,253,84,11]);return(yield WebAssembly.instantiate(e))instanceof WebAssembly.Instance}catch(e){return!1}})}const u={pq:{enabled:!1},hnsw:{enabled:!1},gnn:{enabled:!0,numHeads:2},mmr:{enabled:!0,lambda:.7},svd:{enabled:!1}},l={pq:{enabled:!0,subvectors:8},hnsw:{enabled:!0,M:16},gnn:{enabled:!0,numHeads:4},mmr:{enabled:!0,lambda:.7},svd:{enabled:!1}},c={pq:{enabled:!0,subvectors:16},hnsw:{enabled:!0,M:32},gnn:{enabled:!0,numHeads:4},mmr:{enabled:!0,lambda:.7},svd:{enabled:!0,targetDim:128}};const h={ProductQuantization:i,createPQ8:function(e){return new i({dimension:e,numSubvectors:8,numCentroids:256,maxIterations:50})},createPQ16:function(e){return new i({dimension:e,numSubvectors:16,numCentroids:256,maxIterations:50})},createPQ32:function(e){return new i({dimension:e,numSubvectors:32,numCentroids:256,maxIterations:50})},HNSWIndex:s,createHNSW:function(e){return new s({dimension:e,M:16,efConstruction:200,efSearch:50})},createFastHNSW:function(e){return new s({dimension:e,M:8,efConstruction:100,efSearch:30})},createAccurateHNSW:function(e){return new s({dimension:e,M:32,efConstruction:400,efSearch:100})},GraphNeuralNetwork:class{constructor(e={}){this.nodes=new Map,this.edges=[],this.attentionWeights=new Map,this.config={hiddenDim:e.hiddenDim||64,numHeads:e.numHeads||4,dropout:e.dropout||.1,learningRate:e.learningRate||.01,attentionType:e.attentionType||"gat"}}addNode(e,t){this.nodes.set(e,{id:e,features:t,neighbors:[]})}addEdge(e,t,n=1){this.edges.push({from:e,to:t,weight:n});const r=this.nodes.get(e),i=this.nodes.get(t);r&&!r.neighbors.includes(t)&&r.neighbors.push(t),i&&!i.neighbors.includes(e)&&i.neighbors.push(e)}graphAttention(e){const t=this.nodes.get(e);if(!t)throw new Error(`Node ${e} not found`);const n=t.neighbors;if(0===n.length)return t.features;const r=Math.floor(this.config.hiddenDim/this.config.numHeads),i=new Float32Array(this.config.hiddenDim);for(let e=0;e<this.config.numHeads;e++){let o=0;const s=new Float32Array(r);for(const i of n){const n=this.nodes.get(i),a=this.computeAttentionScore(t.features,n.features,e);o+=a;for(let e=0;e<r&&e<n.features.length;e++)s[e]+=a*n.features[e]}if(o>0)for(let e=0;e<r;e++)s[e]/=o;const a=e*r;for(let e=0;e<r;e++)i[a+e]=s[e]}for(let e=0;e<i.length;e++)i[e]=i[e]>0?i[e]:.01*i[e];return i}computeAttentionScore(e,t,n){let r=0;const i=Math.min(e.length,t.length);for(let n=0;n<i;n++)r+=e[n]*t[n];return Math.exp(r/Math.sqrt(i))}messagePass(){const e=new Map;for(const[t]of this.nodes)e.set(t,this.graphAttention(t));return e}update(e){for(const[t,n]of e){const e=this.nodes.get(t);e&&(e.features=n)}}computeGraphEmbedding(e,t=2){(new Map).set(e,this.nodes.get(e).features);for(let e=0;e<t;e++){const e=this.messagePass();this.update(e)}return this.nodes.get(e).features}getStats(){return{numNodes:this.nodes.size,numEdges:this.edges.length,avgDegree:this.edges.length/Math.max(this.nodes.size,1),config:this.config}}},MaximalMarginalRelevance:class{constructor(e={}){this.config={lambda:e.lambda||.7,metric:e.metric||"cosine"}}rerank(e,t,n){if(0===t.length)return[];const r=[],i=new Set(t.map((e,t)=>t));let o=0,s=-1/0;for(let e=0;e<t.length;e++)t[e].score>s&&(s=t[e].score,o=e);for(r.push(t[o].id),i.delete(o);r.length<n&&i.size>0;){let n=-1/0,o=-1;for(const s of i){const i=t[s],a=this.similarity(e,i.vector);let u=-1/0;for(const e of r){const n=t.find(t=>t.id===e),r=this.similarity(i.vector,n.vector);u=Math.max(u,r)}const l=this.config.lambda*a-(1-this.config.lambda)*u;l>n&&(n=l,o=s)}if(-1===o)break;r.push(t[o].id),i.delete(o)}return r}similarity(e,t){if("cosine"===this.config.metric)return this.cosineSimilarity(e,t);return 1/(1+this.euclideanDistance(e,t))}cosineSimilarity(e,t){let n=0,r=0,i=0;for(let o=0;o<e.length;o++)n+=e[o]*t[o],r+=e[o]*e[o],i+=t[o]*t[o];return n/(Math.sqrt(r)*Math.sqrt(i))}euclideanDistance(e,t){let n=0;for(let r=0;r<e.length;r++){const i=e[r]-t[r];n+=i*i}return Math.sqrt(n)}setLambda(e){this.config.lambda=Math.max(0,Math.min(1,e))}},TensorCompression:class{static compress(e,t){if(0===e.length)return[];const n=e[0].length;if(t>=n)return e;const r=e.map(e=>Array.from(e)),i=this.computeMean(r),o=r.map(e=>e.map((e,t)=>e-i[t])),s=this.computeCovariance(o),a=this.powerIteration(s,t);return o.map(e=>{const r=new Float32Array(t);for(let i=0;i<t;i++){let t=0;for(let r=0;r<n;r++)t+=e[r]*a[i][r];r[i]=t}return r})}static computeMean(e){const t=e.length,n=e[0].length,r=new Array(n).fill(0);for(const t of e)for(let e=0;e<n;e++)r[e]+=t[e];return r.map(e=>e/t)}static computeCovariance(e){const t=e.length,n=e[0].length,r=Array.from({length:n},()=>new Array(n).fill(0));for(let i=0;i<n;i++)for(let n=0;n<=i;n++){let o=0;for(const t of e)o+=t[i]*t[n];r[i][n]=r[n][i]=o/t}return r}static powerIteration(e,t,n=100){const r=e.length,i=[];for(let o=0;o<t;o++){let t=new Array(r).fill(0).map(()=>Math.random()-.5);for(let o=0;o<n;o++){const n=new Array(r).fill(0);for(let i=0;i<r;i++)for(let o=0;o<r;o++)n[i]+=e[i][o]*t[o];for(const e of i){let t=0;for(let i=0;i<r;i++)t+=n[i]*e[i];for(let i=0;i<r;i++)n[i]-=t*e[i]}let o=0;for(const e of n)o+=e*e;if(o=Math.sqrt(o),o<1e-10)break;t=n.map(e=>e/o)}i.push(t)}return i}},BatchProcessor:class{static batchCosineSimilarity(e,t){const n=new Float32Array(t.length);let r=0;for(let t=0;t<e.length;t++)r+=e[t]*e[t];r=Math.sqrt(r);for(let i=0;i<t.length;i++){const o=t[i];let s=0,a=0;for(let t=0;t<e.length;t++)s+=e[t]*o[t],a+=o[t]*o[t];a=Math.sqrt(a),n[i]=s/(r*a)}return n}static batchNormalize(e){return e.map(e=>{let t=0;for(let n=0;n<e.length;n++)t+=e[n]*e[n];t=Math.sqrt(t);const n=new Float32Array(e.length);for(let r=0;r<e.length;r++)n[r]=e[r]/t;return n})}},detectFeatures:function(){return{indexedDB:"indexedDB"in globalThis,broadcastChannel:"BroadcastChannel"in globalThis,webWorkers:"undefined"!=typeof Worker,wasmSIMD:a(),sharedArrayBuffer:"undefined"!=typeof SharedArrayBuffer}},estimateMemoryUsage:function(e,t,n){var r,i,o;let s=e*t*4;if(null===(r=n.pq)||void 0===r?void 0:r.enabled){s=e*((n.pq.subvectors||8)+4)}if(null===(i=n.svd)||void 0===i?void 0:i.enabled){s=e*(n.svd.targetDim||t/2)*4}let a=0;if(null===(o=n.hnsw)||void 0===o?void 0:o.enabled){a=e*(1.5*(n.hnsw.M||16))*4}const u=s+a;return{vectors:s,index:a,total:u,totalMB:u/1048576}},recommendConfig:function(e,t){return e<1e3?{name:"SMALL_DATASET",config:u,reason:"Small dataset, linear search is fast enough"}:e<1e4?{name:"MEDIUM_DATASET",config:l,reason:"Medium dataset, HNSW + PQ8 recommended"}:{name:"LARGE_DATASET",config:c,reason:"Large dataset, aggressive compression + HNSW recommended"}},benchmarkSearch:function(e){return r(this,arguments,void 0,function*(e,t=100,n=10,r=384){const i=[];for(let o=0;o<t;o++){const t=new Float32Array(r);for(let e=0;e<r;e++)t[e]=Math.random()-.5;const o=performance.now();e(t,n);const s=performance.now();i.push(s-o)}return i.sort((e,t)=>e-t),{avgTimeMs:i.reduce((e,t)=>e+t,0)/i.length,minTimeMs:i[0],maxTimeMs:i[i.length-1],p50Ms:i[Math.floor(.5*i.length)],p95Ms:i[Math.floor(.95*i.length)],p99Ms:i[Math.floor(.99*i.length)]}})},SMALL_DATASET_CONFIG:u,MEDIUM_DATASET_CONFIG:l,LARGE_DATASET_CONFIG:c,MEMORY_OPTIMIZED_CONFIG:{pq:{enabled:!0,subvectors:32},hnsw:{enabled:!0,M:8},gnn:{enabled:!1},mmr:{enabled:!1},svd:{enabled:!0,targetDim:64}},SPEED_OPTIMIZED_CONFIG:{pq:{enabled:!1},hnsw:{enabled:!0,M:32,efSearch:100},gnn:{enabled:!1},mmr:{enabled:!1},svd:{enabled:!1}},QUALITY_OPTIMIZED_CONFIG:{pq:{enabled:!1},hnsw:{enabled:!0,M:48,efConstruction:400},gnn:{enabled:!0,numHeads:8},mmr:{enabled:!0,lambda:.8},svd:{enabled:!1}},VERSION:{major:2,minor:0,patch:0,prerelease:"alpha.2",features:"advanced",full:"2.0.0-alpha.2+advanced"}};e.AgentDBAdvanced=h;const f={SQLiteVectorDB:function(t){const n=this,r=!1!==(t=t||{}).enablePQ,i=!1!==t.enableHNSW,o=!1!==t.enableGNN,s=!1!==t.enableMMR;t.enableSVD,t.enableIndexedDB,t.enableCrossTab;let a=null,u=null,l=null,c=null,h=null;function f(e){const t=new Float32Array(384);let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n&=n;for(let e=0;e<384;e++){const r=n+997*e;t[e]=.5*(Math.sin(r)+Math.cos(1.618*r))}const r=Math.sqrt(t.reduce((e,t)=>e+t*t,0));for(let e=0;e<384;e++)t[e]/=r;return t}this.initializeAsync=function(){return new Promise(function(t,f){e.initSqlJs().then(function(f){a=new f.Database,a.run("CREATE TABLE IF NOT EXISTS episodes (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n session_id TEXT NOT NULL,\n task TEXT NOT NULL,\n input TEXT,\n output TEXT,\n critique TEXT,\n reward REAL NOT NULL,\n tokens_used INTEGER,\n latency_ms REAL,\n success BOOLEAN NOT NULL,\n timestamp DATETIME DEFAULT CURRENT_TIMESTAMP\n )"),a.run("CREATE TABLE IF NOT EXISTS episode_embeddings (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n episode_id INTEGER NOT NULL,\n embedding BLOB NOT NULL,\n FOREIGN KEY (episode_id) REFERENCES episodes(id) ON DELETE CASCADE\n )"),a.run("CREATE TABLE IF NOT EXISTS skills (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name TEXT UNIQUE NOT NULL,\n code TEXT NOT NULL,\n signature TEXT NOT NULL,\n success_rate REAL DEFAULT 0.0,\n uses INTEGER DEFAULT 0,\n timestamp DATETIME DEFAULT CURRENT_TIMESTAMP\n )"),a.run("CREATE TABLE IF NOT EXISTS skill_embeddings (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n skill_id INTEGER NOT NULL,\n embedding BLOB NOT NULL,\n FOREIGN KEY (skill_id) REFERENCES skills(id) ON DELETE CASCADE\n )"),a.run("CREATE TABLE IF NOT EXISTS causal_edges (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n from_memory_id INTEGER NOT NULL,\n to_memory_id INTEGER NOT NULL,\n similarity REAL NOT NULL,\n timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,\n FOREIGN KEY (from_memory_id) REFERENCES episodes(id) ON DELETE CASCADE,\n FOREIGN KEY (to_memory_id) REFERENCES episodes(id) ON DELETE CASCADE\n )"),a.run("CREATE TABLE IF NOT EXISTS vectors (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n content TEXT,\n embedding BLOB\n )"),a.run("CREATE TABLE IF NOT EXISTS patterns (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n pattern TEXT,\n metadata TEXT\n )"),r&&(u=e.AgentDBAdvanced.createPQ8(384),console.log("[AgentDB] Product Quantization (PQ8) enabled")),i&&(l=e.AgentDBAdvanced.createHNSW(384),console.log("[AgentDB] HNSW Indexing enabled")),o&&(c=new e.AgentDBAdvanced.GraphNeuralNetwork({numHeads:4}),console.log("[AgentDB] Graph Neural Networks enabled")),s&&(h=new e.AgentDBAdvanced.MaximalMarginalRelevance({lambda:.7}),console.log("[AgentDB] MMR Diversity enabled")),console.log("[AgentDB] Initialized with advanced features"),t(n)}).catch(f)})},this.episodes={store:async function(e){a.prepare("\n INSERT INTO episodes (session_id, task, input, output, critique, reward, tokens_used, latency_ms, success)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)\n ").run([e.sessionId||"default",e.task,e.input||"",e.output||"",e.critique||"",e.reward,e.tokensUsed||0,e.latencyMs||0,e.success?1:0]);const t=a.exec("SELECT last_insert_rowid()")[0].values[0][0],n=f(e.task),r=new Uint8Array(n.buffer);return a.prepare("INSERT INTO episode_embeddings (episode_id, embedding) VALUES (?, ?)").run([t,r]),i&&l&&l.add(n,t),o&&c&&c.addNode(t,n),t},search:async function(e){const t=e.task,r=e.k||10,o=e.minReward,u=e.onlySuccesses,c=e.diversify&&s,d=f(t);let m;m=i&&l&&l.size()>0?l.search(d,2*r):n._linearSearch(d,2*r,"episodes");let b=m.map(e=>{const t=a.exec(`SELECT * FROM episodes WHERE id = ${e.id}`)[0];if(!t||!t.values.length)return null;const n=t.values[0],r={id:n[0],session_id:n[1],task:n[2],reward:n[5],success:1===n[8],distance:e.distance,similarity:1-e.distance};return o&&r.reward<o||u&&!r.success?null:r}).filter(e=>null!==e);if(c&&h&&b.length>r){const e=b.map(e=>({id:e.id,vector:m.find(t=>t.id===e.id).vector,score:e.similarity})),t=h.rerank(d,e,r);b=t.map(e=>b.find(t=>t.id===e))}else b=b.slice(0,r);return b}},this.skills={store:async function(e){a.prepare("\n INSERT INTO skills (name, code, signature, success_rate, uses)\n VALUES (?, ?, ?, ?, ?)\n ON CONFLICT(name) DO UPDATE SET\n code = excluded.code,\n signature = excluded.signature,\n success_rate = excluded.success_rate,\n uses = excluded.uses\n ").run([e.name,e.code,e.signature,e.successRate||0,e.uses||0]);const t=a.exec("SELECT last_insert_rowid()")[0].values[0][0],n=f(e.name+" "+e.signature),r=new Uint8Array(n.buffer);return a.prepare("INSERT INTO skill_embeddings (skill_id, embedding) VALUES (?, ?)").run([t,r]),t},search:async function(e){const t=e.query,r=e.k||10,i=f(t);return n._linearSearch(i,r,"skills").map(e=>{const t=a.exec(`SELECT * FROM skills WHERE id = ${e.id}`)[0];if(!t||!t.values.length)return null;const n=t.values[0];return{id:n[0],name:n[1],code:n[2],signature:n[3],success_rate:n[4],uses:n[5],similarity:1-e.distance}}).filter(e=>null!==e)}},this.causal_edges={add:async function(e){return a.prepare("\n INSERT INTO causal_edges (from_memory_id, to_memory_id, similarity)\n VALUES (?, ?, ?)\n ").run([e.fromMemoryId,e.toMemoryId,e.similarity]),o&&c&&c.addEdge(e.fromMemoryId,e.toMemoryId,e.similarity),a.exec("SELECT last_insert_rowid()")[0].values[0][0]},get:async function(e){const t=a.exec(`\n SELECT * FROM causal_edges\n WHERE from_memory_id = ${e} OR to_memory_id = ${e}\n `);return t.length&&t[0].values.length?t[0].values.map(e=>({id:e[0],from_memory_id:e[1],to_memory_id:e[2],similarity:e[3]})):[]}},this._linearSearch=function(e,t,n){const r="episodes"===n?"episode_embeddings":"skill_embeddings",i="episodes"===n?"episode_id":"skill_id",o=a.exec(`SELECT id, ${i}, embedding FROM ${r}`);if(!o.length||!o[0].values.length)return[];const s=o[0].values.map(t=>{const n=t[1],r=t[2],i=new Float32Array(r.buffer);let o=0;for(let t=0;t<e.length;t++){const n=e[t]-i[t];o+=n*n}return o=Math.sqrt(o),{id:n,distance:o,vector:i}});return s.sort((e,t)=>e.distance-t.distance),s.slice(0,t)},this.storeVector=function(e,t){const n=new Uint8Array(t.buffer);return a.prepare("INSERT INTO vectors (content, embedding) VALUES (?, ?)").run([e,n]),a.exec("SELECT last_insert_rowid()")[0].values[0][0]},this.storePattern=function(e,t){return a.prepare("INSERT INTO patterns (pattern, metadata) VALUES (?, ?)").run([e,JSON.stringify(t)]),a.exec("SELECT last_insert_rowid()")[0].values[0][0]},this.searchVectors=function(e,t){return n._linearSearch(e,t,"vectors")},this.advanced={getPQ:()=>u,getHNSW:()=>l,getGNN:()=>c,getMMR:()=>h,stats:function(){return{pq:u?u.getStats():null,hnsw:l?l.getStats():null,gnn:c?c.getStats():null}}},this.export=function(){return a.export()},this.close=function(){a&&(a.close(),a=null)},this.run=function(e,t){return a.run(e,t)},this.exec=function(e){return a.exec(e)}}};f.Advanced=e.AgentDBAdvanced,"undefined"!=typeof module&&module.exports?module.exports=f:e.AgentDB=f}("undefined"!=typeof window?window:global);
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GraphBackend Interface - Graph database capabilities (Optional)
|
|
3
|
-
*
|
|
4
|
-
* Provides property graph storage and Cypher-like query capabilities.
|
|
5
|
-
* Available when @ruvector/graph-node is installed.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Node and relationship management
|
|
9
|
-
* - Cypher query execution
|
|
10
|
-
* - Graph traversal and pattern matching
|
|
11
|
-
* - Integration with vector search
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Graph node representation
|
|
15
|
-
*/
|
|
16
|
-
export interface GraphNode {
|
|
17
|
-
/** Unique node identifier */
|
|
18
|
-
id: string;
|
|
19
|
-
/** Node labels (types) */
|
|
20
|
-
labels: string[];
|
|
21
|
-
/** Node properties */
|
|
22
|
-
properties: Record<string, any>;
|
|
23
|
-
/** Optional vector embedding for hybrid search */
|
|
24
|
-
embedding?: Float32Array;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Graph relationship representation
|
|
28
|
-
*/
|
|
29
|
-
export interface GraphRelationship {
|
|
30
|
-
/** Unique relationship identifier */
|
|
31
|
-
id: string;
|
|
32
|
-
/** Source node ID */
|
|
33
|
-
from: string;
|
|
34
|
-
/** Target node ID */
|
|
35
|
-
to: string;
|
|
36
|
-
/** Relationship type */
|
|
37
|
-
type: string;
|
|
38
|
-
/** Relationship properties */
|
|
39
|
-
properties?: Record<string, any>;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Cypher query result
|
|
43
|
-
*/
|
|
44
|
-
export interface QueryResult {
|
|
45
|
-
/** Result rows */
|
|
46
|
-
rows: Record<string, any>[];
|
|
47
|
-
/** Result columns */
|
|
48
|
-
columns: string[];
|
|
49
|
-
/** Number of rows returned */
|
|
50
|
-
count: number;
|
|
51
|
-
/** Query execution time in milliseconds */
|
|
52
|
-
executionTime: number;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Graph traversal options
|
|
56
|
-
*/
|
|
57
|
-
export interface TraversalOptions {
|
|
58
|
-
/** Maximum traversal depth */
|
|
59
|
-
maxDepth?: number;
|
|
60
|
-
/** Relationship types to follow (empty = all) */
|
|
61
|
-
relationshipTypes?: string[];
|
|
62
|
-
/** Node label filter */
|
|
63
|
-
nodeLabels?: string[];
|
|
64
|
-
/** Direction: 'outgoing', 'incoming', 'both' */
|
|
65
|
-
direction?: 'outgoing' | 'incoming' | 'both';
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Graph statistics
|
|
69
|
-
*/
|
|
70
|
-
export interface GraphStats {
|
|
71
|
-
/** Total number of nodes */
|
|
72
|
-
nodeCount: number;
|
|
73
|
-
/** Total number of relationships */
|
|
74
|
-
relationshipCount: number;
|
|
75
|
-
/** Node label distribution */
|
|
76
|
-
nodeLabelCounts: Record<string, number>;
|
|
77
|
-
/** Relationship type distribution */
|
|
78
|
-
relationshipTypeCounts: Record<string, number>;
|
|
79
|
-
/** Estimated memory usage in bytes */
|
|
80
|
-
memoryUsage: number;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* GraphBackend - Optional graph database interface
|
|
84
|
-
*
|
|
85
|
-
* Implementations:
|
|
86
|
-
* - RuVectorGraph: Native Rust graph with @ruvector/graph-node
|
|
87
|
-
* - MockGraphBackend: No-op implementation for testing
|
|
88
|
-
*/
|
|
89
|
-
export interface GraphBackend {
|
|
90
|
-
/**
|
|
91
|
-
* Execute a Cypher query
|
|
92
|
-
*
|
|
93
|
-
* @param cypher - Cypher query string
|
|
94
|
-
* @param params - Query parameters
|
|
95
|
-
* @returns Query result with rows and metadata
|
|
96
|
-
*/
|
|
97
|
-
execute(cypher: string, params?: Record<string, any>): Promise<QueryResult>;
|
|
98
|
-
/**
|
|
99
|
-
* Create a new node
|
|
100
|
-
*
|
|
101
|
-
* @param labels - Node labels (types)
|
|
102
|
-
* @param properties - Node properties
|
|
103
|
-
* @returns Created node ID
|
|
104
|
-
*/
|
|
105
|
-
createNode(labels: string[], properties: Record<string, any>): Promise<string>;
|
|
106
|
-
/**
|
|
107
|
-
* Get a node by ID
|
|
108
|
-
*
|
|
109
|
-
* @param id - Node identifier
|
|
110
|
-
* @returns Node or null if not found
|
|
111
|
-
*/
|
|
112
|
-
getNode(id: string): Promise<GraphNode | null>;
|
|
113
|
-
/**
|
|
114
|
-
* Update node properties
|
|
115
|
-
*
|
|
116
|
-
* @param id - Node identifier
|
|
117
|
-
* @param properties - Properties to update
|
|
118
|
-
* @returns True if updated, false if not found
|
|
119
|
-
*/
|
|
120
|
-
updateNode(id: string, properties: Record<string, any>): Promise<boolean>;
|
|
121
|
-
/**
|
|
122
|
-
* Delete a node and its relationships
|
|
123
|
-
*
|
|
124
|
-
* @param id - Node identifier
|
|
125
|
-
* @returns True if deleted, false if not found
|
|
126
|
-
*/
|
|
127
|
-
deleteNode(id: string): Promise<boolean>;
|
|
128
|
-
/**
|
|
129
|
-
* Create a relationship between nodes
|
|
130
|
-
*
|
|
131
|
-
* @param from - Source node ID
|
|
132
|
-
* @param to - Target node ID
|
|
133
|
-
* @param type - Relationship type
|
|
134
|
-
* @param properties - Optional relationship properties
|
|
135
|
-
* @returns Created relationship ID
|
|
136
|
-
*/
|
|
137
|
-
createRelationship(from: string, to: string, type: string, properties?: Record<string, any>): Promise<string>;
|
|
138
|
-
/**
|
|
139
|
-
* Get a relationship by ID
|
|
140
|
-
*
|
|
141
|
-
* @param id - Relationship identifier
|
|
142
|
-
* @returns Relationship or null if not found
|
|
143
|
-
*/
|
|
144
|
-
getRelationship(id: string): Promise<GraphRelationship | null>;
|
|
145
|
-
/**
|
|
146
|
-
* Delete a relationship
|
|
147
|
-
*
|
|
148
|
-
* @param id - Relationship identifier
|
|
149
|
-
* @returns True if deleted, false if not found
|
|
150
|
-
*/
|
|
151
|
-
deleteRelationship(id: string): Promise<boolean>;
|
|
152
|
-
/**
|
|
153
|
-
* Traverse the graph from a starting node
|
|
154
|
-
*
|
|
155
|
-
* @param startId - Starting node ID
|
|
156
|
-
* @param pattern - Traversal pattern (e.g., "()-[:RELATES_TO]->(:Entity)")
|
|
157
|
-
* @param options - Traversal options
|
|
158
|
-
* @returns Array of nodes found during traversal
|
|
159
|
-
*/
|
|
160
|
-
traverse(startId: string, pattern: string, options?: TraversalOptions): Promise<GraphNode[]>;
|
|
161
|
-
/**
|
|
162
|
-
* Find shortest path between two nodes
|
|
163
|
-
*
|
|
164
|
-
* @param fromId - Source node ID
|
|
165
|
-
* @param toId - Target node ID
|
|
166
|
-
* @param options - Traversal options
|
|
167
|
-
* @returns Array of nodes representing the path, or empty if no path exists
|
|
168
|
-
*/
|
|
169
|
-
shortestPath(fromId: string, toId: string, options?: TraversalOptions): Promise<GraphNode[]>;
|
|
170
|
-
/**
|
|
171
|
-
* Find nodes similar to a query vector within a graph context
|
|
172
|
-
*
|
|
173
|
-
* Combines vector similarity search with graph structure
|
|
174
|
-
*
|
|
175
|
-
* @param query - Query vector
|
|
176
|
-
* @param k - Number of results
|
|
177
|
-
* @param contextNodeId - Optional context node for graph-based filtering
|
|
178
|
-
* @returns Array of nodes sorted by similarity
|
|
179
|
-
*/
|
|
180
|
-
vectorSearch(query: Float32Array, k: number, contextNodeId?: string): Promise<GraphNode[]>;
|
|
181
|
-
/**
|
|
182
|
-
* Get graph statistics
|
|
183
|
-
*
|
|
184
|
-
* @returns Current statistics of the graph
|
|
185
|
-
*/
|
|
186
|
-
getStats(): GraphStats;
|
|
187
|
-
/**
|
|
188
|
-
* Clear the entire graph
|
|
189
|
-
*/
|
|
190
|
-
clear(): Promise<void>;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Type guard to check if an object implements GraphBackend
|
|
194
|
-
*/
|
|
195
|
-
export declare function isGraphBackend(obj: any): obj is GraphBackend;
|
|
196
|
-
//# sourceMappingURL=GraphBackend.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GraphBackend.d.ts","sourceRoot":"","sources":["../../src/backends/GraphBackend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IAEX,0BAA0B;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAC;IAEjB,sBAAsB;IACtB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEhC,kDAAkD;IAClD,SAAS,CAAC,EAAE,YAAY,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,qCAAqC;IACrC,EAAE,EAAE,MAAM,CAAC;IAEX,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IAEb,qBAAqB;IACrB,EAAE,EAAE,MAAM,CAAC;IAEX,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IAEb,8BAA8B;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;IAE5B,qBAAqB;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IAEd,2CAA2C;IAC3C,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,iDAAiD;IACjD,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE7B,wBAAwB;IACxB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB,gDAAgD;IAChD,SAAS,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;IAElB,oCAAoC;IACpC,iBAAiB,EAAE,MAAM,CAAC;IAE1B,8BAA8B;IAC9B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAExC,qCAAqC;IACrC,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE/C,sCAAsC;IACtC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAK3B;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAM5E;;;;;;OAMG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE/E;;;;;OAKG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IAE/C;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE1E;;;;;OAKG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAMzC;;;;;;;;OAQG;IACH,kBAAkB,CAChB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC/B,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;IAE/D;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAMjD;;;;;;;OAOG;IACH,QAAQ,CACN,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAExB;;;;;;;OAOG;IACH,YAAY,CACV,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAMxB;;;;;;;;;OASG;IACH,YAAY,CACV,KAAK,EAAE,YAAY,EACnB,CAAC,EAAE,MAAM,EACT,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAMxB;;;;OAIG;IACH,QAAQ,IAAI,UAAU,CAAC;IAEvB;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,YAAY,CAkB5D"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GraphBackend Interface - Graph database capabilities (Optional)
|
|
3
|
-
*
|
|
4
|
-
* Provides property graph storage and Cypher-like query capabilities.
|
|
5
|
-
* Available when @ruvector/graph-node is installed.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Node and relationship management
|
|
9
|
-
* - Cypher query execution
|
|
10
|
-
* - Graph traversal and pattern matching
|
|
11
|
-
* - Integration with vector search
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Type guard to check if an object implements GraphBackend
|
|
15
|
-
*/
|
|
16
|
-
export function isGraphBackend(obj) {
|
|
17
|
-
return (typeof obj === 'object' &&
|
|
18
|
-
obj !== null &&
|
|
19
|
-
typeof obj.execute === 'function' &&
|
|
20
|
-
typeof obj.createNode === 'function' &&
|
|
21
|
-
typeof obj.getNode === 'function' &&
|
|
22
|
-
typeof obj.updateNode === 'function' &&
|
|
23
|
-
typeof obj.deleteNode === 'function' &&
|
|
24
|
-
typeof obj.createRelationship === 'function' &&
|
|
25
|
-
typeof obj.getRelationship === 'function' &&
|
|
26
|
-
typeof obj.deleteRelationship === 'function' &&
|
|
27
|
-
typeof obj.traverse === 'function' &&
|
|
28
|
-
typeof obj.shortestPath === 'function' &&
|
|
29
|
-
typeof obj.vectorSearch === 'function' &&
|
|
30
|
-
typeof obj.getStats === 'function' &&
|
|
31
|
-
typeof obj.clear === 'function');
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=GraphBackend.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GraphBackend.js","sourceRoot":"","sources":["../../src/backends/GraphBackend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAiQH;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,GAAQ;IACrC,OAAO,CACL,OAAO,GAAG,KAAK,QAAQ;QACvB,GAAG,KAAK,IAAI;QACZ,OAAO,GAAG,CAAC,OAAO,KAAK,UAAU;QACjC,OAAO,GAAG,CAAC,UAAU,KAAK,UAAU;QACpC,OAAO,GAAG,CAAC,OAAO,KAAK,UAAU;QACjC,OAAO,GAAG,CAAC,UAAU,KAAK,UAAU;QACpC,OAAO,GAAG,CAAC,UAAU,KAAK,UAAU;QACpC,OAAO,GAAG,CAAC,kBAAkB,KAAK,UAAU;QAC5C,OAAO,GAAG,CAAC,eAAe,KAAK,UAAU;QACzC,OAAO,GAAG,CAAC,kBAAkB,KAAK,UAAU;QAC5C,OAAO,GAAG,CAAC,QAAQ,KAAK,UAAU;QAClC,OAAO,GAAG,CAAC,YAAY,KAAK,UAAU;QACtC,OAAO,GAAG,CAAC,YAAY,KAAK,UAAU;QACtC,OAAO,GAAG,CAAC,QAAQ,KAAK,UAAU;QAClC,OAAO,GAAG,CAAC,KAAK,KAAK,UAAU,CAChC,CAAC;AACJ,CAAC"}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LearningBackend Interface - GNN self-learning capabilities (Optional)
|
|
3
|
-
*
|
|
4
|
-
* Provides Graph Neural Network (GNN) based learning for query enhancement
|
|
5
|
-
* and adaptive pattern recognition. Available when @ruvector/gnn is installed.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Query enhancement using attention mechanisms
|
|
9
|
-
* - Automatic learning from search patterns
|
|
10
|
-
* - Model persistence and versioning
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Learning backend configuration
|
|
14
|
-
*/
|
|
15
|
-
export interface LearningConfig {
|
|
16
|
-
/** Enable learning features */
|
|
17
|
-
enabled: boolean;
|
|
18
|
-
/** Input dimension (must match vector dimension) */
|
|
19
|
-
inputDim: number;
|
|
20
|
-
/** Output dimension (defaults to inputDim) */
|
|
21
|
-
outputDim?: number;
|
|
22
|
-
/** Number of attention heads for GNN */
|
|
23
|
-
heads?: number;
|
|
24
|
-
/** Learning rate for training */
|
|
25
|
-
learningRate?: number;
|
|
26
|
-
/** Batch size for training */
|
|
27
|
-
batchSize?: number;
|
|
28
|
-
/** Path for model persistence */
|
|
29
|
-
modelPath?: string;
|
|
30
|
-
/** Auto-train interval in seconds (0 = disabled) */
|
|
31
|
-
autoTrainInterval?: number;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Training sample for supervised learning
|
|
35
|
-
*/
|
|
36
|
-
export interface TrainingSample {
|
|
37
|
-
/** Input embedding */
|
|
38
|
-
embedding: Float32Array;
|
|
39
|
-
/** Label or class (for classification) */
|
|
40
|
-
label: number;
|
|
41
|
-
/** Sample weight (importance) */
|
|
42
|
-
weight?: number;
|
|
43
|
-
/** Additional context for learning */
|
|
44
|
-
context?: Record<string, any>;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Training result metrics
|
|
48
|
-
*/
|
|
49
|
-
export interface TrainingResult {
|
|
50
|
-
/** Number of training epochs completed */
|
|
51
|
-
epochs: number;
|
|
52
|
-
/** Final loss value */
|
|
53
|
-
finalLoss: number;
|
|
54
|
-
/** Improvement percentage from initial loss */
|
|
55
|
-
improvement: number;
|
|
56
|
-
/** Training duration in milliseconds */
|
|
57
|
-
duration: number;
|
|
58
|
-
/** Additional metrics */
|
|
59
|
-
metrics?: Record<string, number>;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Learning backend statistics
|
|
63
|
-
*/
|
|
64
|
-
export interface LearningStats {
|
|
65
|
-
/** Whether learning is enabled */
|
|
66
|
-
enabled: boolean;
|
|
67
|
-
/** Number of samples collected */
|
|
68
|
-
samplesCollected: number;
|
|
69
|
-
/** Timestamp of last training (null if never trained) */
|
|
70
|
-
lastTrainingTime: number | null;
|
|
71
|
-
/** Current model version */
|
|
72
|
-
modelVersion: number;
|
|
73
|
-
/** Average training loss */
|
|
74
|
-
avgLoss?: number;
|
|
75
|
-
/** Model accuracy (if applicable) */
|
|
76
|
-
accuracy?: number;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* LearningBackend - Optional GNN-based learning interface
|
|
80
|
-
*
|
|
81
|
-
* Implementations:
|
|
82
|
-
* - RuVectorLearning: Native Rust GNN with @ruvector/gnn
|
|
83
|
-
* - MockLearningBackend: No-op implementation for testing
|
|
84
|
-
*/
|
|
85
|
-
export interface LearningBackend {
|
|
86
|
-
/**
|
|
87
|
-
* Enhance query vector using GNN attention mechanism
|
|
88
|
-
*
|
|
89
|
-
* Takes a query vector and its k-nearest neighbors, applies graph attention,
|
|
90
|
-
* and returns an enhanced query vector with better semantic representation.
|
|
91
|
-
*
|
|
92
|
-
* @param query - Query vector to enhance
|
|
93
|
-
* @param neighbors - Neighbor vectors for context
|
|
94
|
-
* @param weights - Importance weights for each neighbor (0-1)
|
|
95
|
-
* @returns Enhanced query vector
|
|
96
|
-
*/
|
|
97
|
-
enhance(query: Float32Array, neighbors: Float32Array[], weights: number[]): Float32Array;
|
|
98
|
-
/**
|
|
99
|
-
* Add a training sample for future learning
|
|
100
|
-
*
|
|
101
|
-
* Samples are accumulated and used during the next training cycle.
|
|
102
|
-
*
|
|
103
|
-
* @param sample - Training sample with embedding and label
|
|
104
|
-
*/
|
|
105
|
-
addSample(sample: TrainingSample): void;
|
|
106
|
-
/**
|
|
107
|
-
* Train the model on accumulated samples
|
|
108
|
-
*
|
|
109
|
-
* @param options - Training options (epochs, etc.)
|
|
110
|
-
* @returns Training result with metrics
|
|
111
|
-
*/
|
|
112
|
-
train(options?: {
|
|
113
|
-
epochs?: number;
|
|
114
|
-
}): Promise<TrainingResult>;
|
|
115
|
-
/**
|
|
116
|
-
* Clear accumulated training samples
|
|
117
|
-
*/
|
|
118
|
-
clearSamples(): void;
|
|
119
|
-
/**
|
|
120
|
-
* Save trained model to disk
|
|
121
|
-
*
|
|
122
|
-
* @param path - File path to save the model
|
|
123
|
-
* @returns Promise that resolves when model is saved
|
|
124
|
-
*/
|
|
125
|
-
saveModel(path: string): Promise<void>;
|
|
126
|
-
/**
|
|
127
|
-
* Load trained model from disk
|
|
128
|
-
*
|
|
129
|
-
* @param path - File path to load the model from
|
|
130
|
-
* @returns Promise that resolves when model is loaded
|
|
131
|
-
*/
|
|
132
|
-
loadModel(path: string): Promise<void>;
|
|
133
|
-
/**
|
|
134
|
-
* Get learning statistics and metadata
|
|
135
|
-
*
|
|
136
|
-
* @returns Current statistics of the learning backend
|
|
137
|
-
*/
|
|
138
|
-
getStats(): LearningStats;
|
|
139
|
-
/**
|
|
140
|
-
* Reset learning state (clear samples, reset model)
|
|
141
|
-
*/
|
|
142
|
-
reset(): void;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Type guard to check if an object implements LearningBackend
|
|
146
|
-
*/
|
|
147
|
-
export declare function isLearningBackend(obj: any): obj is LearningBackend;
|
|
148
|
-
//# sourceMappingURL=LearningBackend.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LearningBackend.d.ts","sourceRoot":"","sources":["../../src/backends/LearningBackend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,+BAA+B;IAC/B,OAAO,EAAE,OAAO,CAAC;IAEjB,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAC;IAEjB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,iCAAiC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,oDAAoD;IACpD,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,sBAAsB;IACtB,SAAS,EAAE,YAAY,CAAC;IAExB,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IAEd,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IAEf,uBAAuB;IACvB,SAAS,EAAE,MAAM,CAAC;IAElB,+CAA+C;IAC/C,WAAW,EAAE,MAAM,CAAC;IAEpB,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;IAEjB,yBAAyB;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,kCAAkC;IAClC,OAAO,EAAE,OAAO,CAAC;IAEjB,kCAAkC;IAClC,gBAAgB,EAAE,MAAM,CAAC;IAEzB,yDAAyD;IACzD,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC,4BAA4B;IAC5B,YAAY,EAAE,MAAM,CAAC;IAErB,4BAA4B;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAK9B;;;;;;;;;;OAUG;IACH,OAAO,CACL,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,YAAY,EAAE,EACzB,OAAO,EAAE,MAAM,EAAE,GAChB,YAAY,CAAC;IAMhB;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAExC;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE9D;;OAEG;IACH,YAAY,IAAI,IAAI,CAAC;IAMrB;;;;;OAKG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvC;;;;;OAKG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAMvC;;;;OAIG;IACH,QAAQ,IAAI,aAAa,CAAC;IAE1B;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,eAAe,CAalE"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LearningBackend Interface - GNN self-learning capabilities (Optional)
|
|
3
|
-
*
|
|
4
|
-
* Provides Graph Neural Network (GNN) based learning for query enhancement
|
|
5
|
-
* and adaptive pattern recognition. Available when @ruvector/gnn is installed.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Query enhancement using attention mechanisms
|
|
9
|
-
* - Automatic learning from search patterns
|
|
10
|
-
* - Model persistence and versioning
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Type guard to check if an object implements LearningBackend
|
|
14
|
-
*/
|
|
15
|
-
export function isLearningBackend(obj) {
|
|
16
|
-
return (typeof obj === 'object' &&
|
|
17
|
-
obj !== null &&
|
|
18
|
-
typeof obj.enhance === 'function' &&
|
|
19
|
-
typeof obj.addSample === 'function' &&
|
|
20
|
-
typeof obj.train === 'function' &&
|
|
21
|
-
typeof obj.clearSamples === 'function' &&
|
|
22
|
-
typeof obj.saveModel === 'function' &&
|
|
23
|
-
typeof obj.loadModel === 'function' &&
|
|
24
|
-
typeof obj.getStats === 'function' &&
|
|
25
|
-
typeof obj.reset === 'function');
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=LearningBackend.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LearningBackend.js","sourceRoot":"","sources":["../../src/backends/LearningBackend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAuLH;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAQ;IACxC,OAAO,CACL,OAAO,GAAG,KAAK,QAAQ;QACvB,GAAG,KAAK,IAAI;QACZ,OAAO,GAAG,CAAC,OAAO,KAAK,UAAU;QACjC,OAAO,GAAG,CAAC,SAAS,KAAK,UAAU;QACnC,OAAO,GAAG,CAAC,KAAK,KAAK,UAAU;QAC/B,OAAO,GAAG,CAAC,YAAY,KAAK,UAAU;QACtC,OAAO,GAAG,CAAC,SAAS,KAAK,UAAU;QACnC,OAAO,GAAG,CAAC,SAAS,KAAK,UAAU;QACnC,OAAO,GAAG,CAAC,QAAQ,KAAK,UAAU;QAClC,OAAO,GAAG,CAAC,KAAK,KAAK,UAAU,CAChC,CAAC;AACJ,CAAC"}
|