agentdb 1.0.11 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +196 -838
- package/dist/benchmarks/comprehensive-benchmark.js +664 -0
- package/dist/benchmarks/frontier-benchmark.js +419 -0
- package/dist/benchmarks/reflexion-benchmark.js +370 -0
- package/dist/cli/agentdb-cli.d.ts +117 -0
- package/dist/cli/agentdb-cli.d.ts.map +1 -0
- package/dist/cli/agentdb-cli.js +718 -0
- package/dist/cli/agentdb-cli.js.map +1 -0
- package/dist/controllers/CausalMemoryGraph.d.ts +125 -0
- package/dist/controllers/CausalMemoryGraph.d.ts.map +1 -0
- package/dist/controllers/CausalMemoryGraph.js +323 -0
- package/dist/controllers/CausalMemoryGraph.js.map +1 -0
- package/dist/controllers/CausalRecall.d.ts +111 -0
- package/dist/controllers/CausalRecall.d.ts.map +1 -0
- package/dist/controllers/CausalRecall.js +282 -0
- package/dist/controllers/CausalRecall.js.map +1 -0
- package/dist/controllers/EmbeddingService.d.ts +37 -0
- package/dist/controllers/EmbeddingService.d.ts.map +1 -0
- package/dist/controllers/EmbeddingService.js +119 -0
- package/dist/controllers/EmbeddingService.js.map +1 -0
- package/dist/controllers/ExplainableRecall.d.ts +138 -0
- package/dist/controllers/ExplainableRecall.d.ts.map +1 -0
- package/dist/controllers/ExplainableRecall.js +388 -0
- package/dist/controllers/ExplainableRecall.js.map +1 -0
- package/dist/controllers/NightlyLearner.d.ts +113 -0
- package/dist/controllers/NightlyLearner.d.ts.map +1 -0
- package/dist/controllers/NightlyLearner.js +383 -0
- package/dist/controllers/NightlyLearner.js.map +1 -0
- package/dist/controllers/ReflexionMemory.d.ts +84 -0
- package/dist/controllers/ReflexionMemory.d.ts.map +1 -0
- package/dist/controllers/ReflexionMemory.js +240 -0
- package/dist/controllers/ReflexionMemory.js.map +1 -0
- package/dist/controllers/SkillLibrary.d.ts +96 -0
- package/dist/controllers/SkillLibrary.d.ts.map +1 -0
- package/dist/controllers/SkillLibrary.js +277 -0
- package/dist/controllers/SkillLibrary.js.map +1 -0
- package/dist/controllers/frontier-index.d.ts +14 -0
- package/dist/controllers/frontier-index.d.ts.map +1 -0
- package/dist/controllers/frontier-index.js +10 -0
- package/dist/controllers/frontier-index.js.map +1 -0
- package/dist/controllers/index.d.ts +12 -0
- package/dist/controllers/index.d.ts.map +1 -0
- package/dist/controllers/index.js +9 -0
- package/dist/controllers/index.js.map +1 -0
- package/dist/optimizations/BatchOperations.d.ts +61 -0
- package/dist/optimizations/BatchOperations.d.ts.map +1 -0
- package/dist/optimizations/BatchOperations.js +199 -0
- package/dist/optimizations/BatchOperations.js.map +1 -0
- package/dist/optimizations/QueryOptimizer.d.ts +82 -0
- package/dist/optimizations/QueryOptimizer.d.ts.map +1 -0
- package/dist/optimizations/QueryOptimizer.js +226 -0
- package/dist/optimizations/QueryOptimizer.js.map +1 -0
- package/dist/optimizations/index.d.ts +10 -0
- package/dist/optimizations/index.d.ts.map +1 -0
- package/dist/optimizations/index.js +8 -0
- package/dist/optimizations/index.js.map +1 -0
- package/dist/schemas/frontier-schema.sql +341 -0
- package/dist/schemas/schema.sql +382 -0
- package/dist/tests/frontier-features.test.js +665 -0
- package/package.json +54 -117
- package/src/cli/agentdb-cli.ts +861 -0
- package/src/cli/examples.sh +83 -0
- package/src/controllers/CausalMemoryGraph.ts +504 -0
- package/src/controllers/CausalRecall.ts +395 -0
- package/src/controllers/EmbeddingService.ts +141 -0
- package/src/controllers/ExplainableRecall.ts +577 -0
- package/src/controllers/NightlyLearner.ts +475 -0
- package/src/controllers/ReflexionMemory.ts +349 -0
- package/src/controllers/SkillLibrary.ts +391 -0
- package/src/controllers/frontier-index.ts +35 -0
- package/src/controllers/index.ts +13 -0
- package/src/optimizations/BatchOperations.ts +292 -0
- package/src/optimizations/QueryOptimizer.ts +294 -0
- package/src/optimizations/index.ts +11 -0
- package/src/schemas/frontier-schema.sql +341 -0
- package/src/schemas/schema.sql +382 -0
- package/CHANGELOG.md +0 -166
- package/LICENSE +0 -38
- package/LICENSE-APACHE +0 -190
- package/LICENSE-MIT +0 -21
- package/bin/agentdb.js +0 -733
- package/bin/benchmark.js +0 -162
- package/bin/plugin-cli-wrapper.mjs +0 -21
- package/dist/agentdb.js +0 -5352
- package/dist/agentdb.js.map +0 -7
- package/dist/agentdb.min.js +0 -143
- package/dist/agentdb.min.js.map +0 -7
- package/dist/cache/query-cache.d.ts +0 -105
- package/dist/cache/query-cache.d.ts.map +0 -1
- package/dist/cache/query-cache.js +0 -224
- package/dist/cache/query-cache.js.map +0 -1
- package/dist/cache/query-cache.mjs +0 -219
- package/dist/cli/cache/query-cache.d.ts +0 -104
- package/dist/cli/cache/query-cache.js +0 -244
- package/dist/cli/cli/db-commands.d.ts +0 -48
- package/dist/cli/cli/db-commands.js +0 -613
- package/dist/cli/commands.d.ts +0 -7
- package/dist/cli/commands.d.ts.map +0 -1
- package/dist/cli/commands.js +0 -113
- package/dist/cli/commands.js.map +0 -1
- package/dist/cli/commands.mjs +0 -104
- package/dist/cli/core/backend-interface.d.ts +0 -70
- package/dist/cli/core/backend-interface.js +0 -15
- package/dist/cli/core/native-backend.d.ts +0 -140
- package/dist/cli/core/native-backend.js +0 -432
- package/dist/cli/core/vector-db.d.ts +0 -126
- package/dist/cli/core/vector-db.js +0 -338
- package/dist/cli/core/wasm-backend.d.ts +0 -95
- package/dist/cli/core/wasm-backend.js +0 -418
- package/dist/cli/db-commands.d.ts +0 -49
- package/dist/cli/db-commands.d.ts.map +0 -1
- package/dist/cli/db-commands.js +0 -533
- package/dist/cli/db-commands.js.map +0 -1
- package/dist/cli/db-commands.mjs +0 -522
- package/dist/cli/generator.d.ts +0 -11
- package/dist/cli/generator.d.ts.map +0 -1
- package/dist/cli/generator.js +0 -567
- package/dist/cli/generator.js.map +0 -1
- package/dist/cli/generator.mjs +0 -527
- package/dist/cli/help.d.ts +0 -18
- package/dist/cli/help.d.ts.map +0 -1
- package/dist/cli/help.js +0 -676
- package/dist/cli/help.js.map +0 -1
- package/dist/cli/help.mjs +0 -667
- package/dist/cli/index/hnsw.d.ts +0 -164
- package/dist/cli/index/hnsw.js +0 -558
- package/dist/cli/plugin-cli.d.ts +0 -7
- package/dist/cli/plugin-cli.d.ts.map +0 -1
- package/dist/cli/plugin-cli.js +0 -295
- package/dist/cli/plugin-cli.js.map +0 -1
- package/dist/cli/plugin-cli.mjs +0 -289
- package/dist/cli/quantization/product-quantization.d.ts +0 -108
- package/dist/cli/quantization/product-quantization.js +0 -350
- package/dist/cli/query/query-builder.d.ts +0 -322
- package/dist/cli/query/query-builder.js +0 -600
- package/dist/cli/templates.d.ts +0 -14
- package/dist/cli/templates.d.ts.map +0 -1
- package/dist/cli/templates.js +0 -182
- package/dist/cli/templates.js.map +0 -1
- package/dist/cli/templates.mjs +0 -176
- package/dist/cli/types/index.d.ts +0 -116
- package/dist/cli/types/index.js +0 -5
- package/dist/cli/types.d.ts +0 -91
- package/dist/cli/types.d.ts.map +0 -1
- package/dist/cli/types.js +0 -6
- package/dist/cli/types.js.map +0 -1
- package/dist/cli/types.mjs +0 -4
- package/dist/cli/wizard/index.d.ts +0 -6
- package/dist/cli/wizard/index.d.ts.map +0 -1
- package/dist/cli/wizard/index.js +0 -138
- package/dist/cli/wizard/index.js.map +0 -1
- package/dist/cli/wizard/index.mjs +0 -131
- package/dist/cli/wizard/prompts.d.ts +0 -11
- package/dist/cli/wizard/prompts.d.ts.map +0 -1
- package/dist/cli/wizard/prompts.js +0 -482
- package/dist/cli/wizard/prompts.js.map +0 -1
- package/dist/cli/wizard/prompts.mjs +0 -470
- package/dist/cli/wizard/validator.d.ts +0 -13
- package/dist/cli/wizard/validator.d.ts.map +0 -1
- package/dist/cli/wizard/validator.js +0 -234
- package/dist/cli/wizard/validator.js.map +0 -1
- package/dist/cli/wizard/validator.mjs +0 -224
- package/dist/core/backend-interface.d.ts +0 -71
- package/dist/core/backend-interface.d.ts.map +0 -1
- package/dist/core/backend-interface.js +0 -16
- package/dist/core/backend-interface.js.map +0 -1
- package/dist/core/backend-interface.mjs +0 -12
- package/dist/core/native-backend.d.ts +0 -141
- package/dist/core/native-backend.d.ts.map +0 -1
- package/dist/core/native-backend.js +0 -457
- package/dist/core/native-backend.js.map +0 -1
- package/dist/core/native-backend.mjs +0 -449
- package/dist/core/vector-db.d.ts +0 -127
- package/dist/core/vector-db.d.ts.map +0 -1
- package/dist/core/vector-db.js +0 -270
- package/dist/core/vector-db.js.map +0 -1
- package/dist/core/vector-db.mjs +0 -265
- package/dist/core/wasm-backend.d.ts +0 -96
- package/dist/core/wasm-backend.d.ts.map +0 -1
- package/dist/core/wasm-backend.js +0 -393
- package/dist/core/wasm-backend.js.map +0 -1
- package/dist/core/wasm-backend.mjs +0 -385
- package/dist/index/hnsw-optimized.d.ts +0 -75
- package/dist/index/hnsw-optimized.d.ts.map +0 -1
- package/dist/index/hnsw-optimized.js +0 -412
- package/dist/index/hnsw-optimized.js.map +0 -1
- package/dist/index/hnsw-optimized.mjs +0 -407
- package/dist/index/hnsw.d.ts +0 -165
- package/dist/index/hnsw.d.ts.map +0 -1
- package/dist/index/hnsw.js +0 -521
- package/dist/index/hnsw.js.map +0 -1
- package/dist/index/hnsw.mjs +0 -516
- package/dist/index.browser.d.ts +0 -47
- package/dist/index.browser.d.ts.map +0 -1
- package/dist/index.browser.js +0 -72
- package/dist/index.browser.js.map +0 -1
- package/dist/index.browser.mjs +0 -54
- package/dist/index.d.ts +0 -59
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -84
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -65
- package/dist/mcp/learning/core/experience-buffer.d.ts +0 -61
- package/dist/mcp/learning/core/experience-buffer.d.ts.map +0 -1
- package/dist/mcp/learning/core/experience-buffer.js +0 -175
- package/dist/mcp/learning/core/experience-buffer.js.map +0 -1
- package/dist/mcp/learning/core/experience-buffer.mjs +0 -170
- package/dist/mcp/learning/core/experience-recorder.d.ts +0 -40
- package/dist/mcp/learning/core/experience-recorder.d.ts.map +0 -1
- package/dist/mcp/learning/core/experience-recorder.js +0 -200
- package/dist/mcp/learning/core/experience-recorder.js.map +0 -1
- package/dist/mcp/learning/core/experience-recorder.mjs +0 -195
- package/dist/mcp/learning/core/learning-manager.d.ts +0 -66
- package/dist/mcp/learning/core/learning-manager.d.ts.map +0 -1
- package/dist/mcp/learning/core/learning-manager.js +0 -252
- package/dist/mcp/learning/core/learning-manager.js.map +0 -1
- package/dist/mcp/learning/core/learning-manager.mjs +0 -247
- package/dist/mcp/learning/core/policy-optimizer.d.ts +0 -53
- package/dist/mcp/learning/core/policy-optimizer.d.ts.map +0 -1
- package/dist/mcp/learning/core/policy-optimizer.js +0 -251
- package/dist/mcp/learning/core/policy-optimizer.js.map +0 -1
- package/dist/mcp/learning/core/policy-optimizer.mjs +0 -246
- package/dist/mcp/learning/core/reward-estimator.d.ts +0 -44
- package/dist/mcp/learning/core/reward-estimator.d.ts.map +0 -1
- package/dist/mcp/learning/core/reward-estimator.js +0 -158
- package/dist/mcp/learning/core/reward-estimator.js.map +0 -1
- package/dist/mcp/learning/core/reward-estimator.mjs +0 -153
- package/dist/mcp/learning/core/session-manager.d.ts +0 -63
- package/dist/mcp/learning/core/session-manager.d.ts.map +0 -1
- package/dist/mcp/learning/core/session-manager.js +0 -202
- package/dist/mcp/learning/core/session-manager.js.map +0 -1
- package/dist/mcp/learning/core/session-manager.mjs +0 -197
- package/dist/mcp/learning/index.d.ts +0 -19
- package/dist/mcp/learning/index.d.ts.map +0 -1
- package/dist/mcp/learning/index.js +0 -30
- package/dist/mcp/learning/index.js.map +0 -1
- package/dist/mcp/learning/index.mjs +0 -19
- package/dist/mcp/learning/tools/mcp-learning-tools.d.ts +0 -369
- package/dist/mcp/learning/tools/mcp-learning-tools.d.ts.map +0 -1
- package/dist/mcp/learning/tools/mcp-learning-tools.js +0 -361
- package/dist/mcp/learning/tools/mcp-learning-tools.js.map +0 -1
- package/dist/mcp/learning/tools/mcp-learning-tools.mjs +0 -356
- package/dist/mcp/learning/types/index.d.ts +0 -138
- package/dist/mcp/learning/types/index.d.ts.map +0 -1
- package/dist/mcp/learning/types/index.js +0 -6
- package/dist/mcp/learning/types/index.js.map +0 -1
- package/dist/mcp/learning/types/index.mjs +0 -4
- package/dist/mcp-server.d.ts +0 -29
- package/dist/mcp-server.d.ts.map +0 -1
- package/dist/mcp-server.js +0 -862
- package/dist/mcp-server.js.map +0 -1
- package/dist/mcp-server.mjs +0 -857
- package/dist/plugins/base-plugin.d.ts +0 -114
- package/dist/plugins/base-plugin.d.ts.map +0 -1
- package/dist/plugins/base-plugin.js +0 -313
- package/dist/plugins/base-plugin.js.map +0 -1
- package/dist/plugins/base-plugin.mjs +0 -275
- package/dist/plugins/implementations/active-learning.d.ts +0 -135
- package/dist/plugins/implementations/active-learning.d.ts.map +0 -1
- package/dist/plugins/implementations/active-learning.js +0 -372
- package/dist/plugins/implementations/active-learning.js.map +0 -1
- package/dist/plugins/implementations/active-learning.mjs +0 -367
- package/dist/plugins/implementations/actor-critic.d.ts +0 -64
- package/dist/plugins/implementations/actor-critic.d.ts.map +0 -1
- package/dist/plugins/implementations/actor-critic.js +0 -363
- package/dist/plugins/implementations/actor-critic.js.map +0 -1
- package/dist/plugins/implementations/actor-critic.mjs +0 -358
- package/dist/plugins/implementations/adversarial-training.d.ts +0 -133
- package/dist/plugins/implementations/adversarial-training.d.ts.map +0 -1
- package/dist/plugins/implementations/adversarial-training.js +0 -409
- package/dist/plugins/implementations/adversarial-training.js.map +0 -1
- package/dist/plugins/implementations/adversarial-training.mjs +0 -404
- package/dist/plugins/implementations/curriculum-learning.d.ts +0 -132
- package/dist/plugins/implementations/curriculum-learning.d.ts.map +0 -1
- package/dist/plugins/implementations/curriculum-learning.js +0 -354
- package/dist/plugins/implementations/curriculum-learning.js.map +0 -1
- package/dist/plugins/implementations/curriculum-learning.mjs +0 -349
- package/dist/plugins/implementations/decision-transformer.d.ts +0 -77
- package/dist/plugins/implementations/decision-transformer.d.ts.map +0 -1
- package/dist/plugins/implementations/decision-transformer.js +0 -422
- package/dist/plugins/implementations/decision-transformer.js.map +0 -1
- package/dist/plugins/implementations/decision-transformer.mjs +0 -417
- package/dist/plugins/implementations/federated-learning.d.ts +0 -126
- package/dist/plugins/implementations/federated-learning.d.ts.map +0 -1
- package/dist/plugins/implementations/federated-learning.js +0 -436
- package/dist/plugins/implementations/federated-learning.js.map +0 -1
- package/dist/plugins/implementations/federated-learning.mjs +0 -431
- package/dist/plugins/implementations/index.d.ts +0 -30
- package/dist/plugins/implementations/index.d.ts.map +0 -1
- package/dist/plugins/implementations/index.js +0 -45
- package/dist/plugins/implementations/index.js.map +0 -1
- package/dist/plugins/implementations/index.mjs +0 -31
- package/dist/plugins/implementations/multi-task-learning.d.ts +0 -115
- package/dist/plugins/implementations/multi-task-learning.d.ts.map +0 -1
- package/dist/plugins/implementations/multi-task-learning.js +0 -369
- package/dist/plugins/implementations/multi-task-learning.js.map +0 -1
- package/dist/plugins/implementations/multi-task-learning.mjs +0 -364
- package/dist/plugins/implementations/neural-architecture-search.d.ts +0 -148
- package/dist/plugins/implementations/neural-architecture-search.d.ts.map +0 -1
- package/dist/plugins/implementations/neural-architecture-search.js +0 -379
- package/dist/plugins/implementations/neural-architecture-search.js.map +0 -1
- package/dist/plugins/implementations/neural-architecture-search.mjs +0 -374
- package/dist/plugins/implementations/q-learning.d.ts +0 -98
- package/dist/plugins/implementations/q-learning.d.ts.map +0 -1
- package/dist/plugins/implementations/q-learning.js +0 -435
- package/dist/plugins/implementations/q-learning.js.map +0 -1
- package/dist/plugins/implementations/q-learning.mjs +0 -430
- package/dist/plugins/implementations/sarsa.d.ts +0 -103
- package/dist/plugins/implementations/sarsa.d.ts.map +0 -1
- package/dist/plugins/implementations/sarsa.js +0 -347
- package/dist/plugins/implementations/sarsa.js.map +0 -1
- package/dist/plugins/implementations/sarsa.mjs +0 -342
- package/dist/plugins/index.d.ts +0 -107
- package/dist/plugins/index.d.ts.map +0 -1
- package/dist/plugins/index.js +0 -179
- package/dist/plugins/index.js.map +0 -1
- package/dist/plugins/index.mjs +0 -168
- package/dist/plugins/interface.d.ts +0 -439
- package/dist/plugins/interface.d.ts.map +0 -1
- package/dist/plugins/interface.js +0 -12
- package/dist/plugins/interface.js.map +0 -1
- package/dist/plugins/interface.mjs +0 -10
- package/dist/plugins/learning-plugin.interface.d.ts +0 -257
- package/dist/plugins/learning-plugin.interface.d.ts.map +0 -1
- package/dist/plugins/learning-plugin.interface.js +0 -7
- package/dist/plugins/learning-plugin.interface.js.map +0 -1
- package/dist/plugins/learning-plugin.interface.mjs +0 -5
- package/dist/plugins/plugin-exports.d.ts +0 -71
- package/dist/plugins/plugin-exports.d.ts.map +0 -1
- package/dist/plugins/plugin-exports.js +0 -78
- package/dist/plugins/plugin-exports.js.map +0 -1
- package/dist/plugins/plugin-exports.mjs +0 -69
- package/dist/plugins/registry.d.ts +0 -206
- package/dist/plugins/registry.d.ts.map +0 -1
- package/dist/plugins/registry.js +0 -365
- package/dist/plugins/registry.js.map +0 -1
- package/dist/plugins/registry.mjs +0 -356
- package/dist/plugins/validator.d.ts +0 -63
- package/dist/plugins/validator.d.ts.map +0 -1
- package/dist/plugins/validator.js +0 -464
- package/dist/plugins/validator.js.map +0 -1
- package/dist/plugins/validator.mjs +0 -458
- package/dist/presets.d.ts +0 -65
- package/dist/presets.d.ts.map +0 -1
- package/dist/presets.js +0 -145
- package/dist/presets.js.map +0 -1
- package/dist/presets.mjs +0 -140
- package/dist/quantization/binary-quantization.d.ts +0 -104
- package/dist/quantization/binary-quantization.d.ts.map +0 -1
- package/dist/quantization/binary-quantization.js +0 -246
- package/dist/quantization/binary-quantization.js.map +0 -1
- package/dist/quantization/binary-quantization.mjs +0 -240
- package/dist/quantization/optimized-pq.d.ts +0 -138
- package/dist/quantization/optimized-pq.d.ts.map +0 -1
- package/dist/quantization/optimized-pq.js +0 -320
- package/dist/quantization/optimized-pq.js.map +0 -1
- package/dist/quantization/optimized-pq.mjs +0 -313
- package/dist/quantization/product-quantization.d.ts +0 -109
- package/dist/quantization/product-quantization.d.ts.map +0 -1
- package/dist/quantization/product-quantization.js +0 -287
- package/dist/quantization/product-quantization.js.map +0 -1
- package/dist/quantization/product-quantization.mjs +0 -282
- package/dist/quantization/scalar-quantization.d.ts +0 -100
- package/dist/quantization/scalar-quantization.d.ts.map +0 -1
- package/dist/quantization/scalar-quantization.js +0 -324
- package/dist/quantization/scalar-quantization.js.map +0 -1
- package/dist/quantization/scalar-quantization.mjs +0 -319
- package/dist/query/index.d.ts +0 -6
- package/dist/query/index.d.ts.map +0 -1
- package/dist/query/index.js +0 -9
- package/dist/query/index.js.map +0 -1
- package/dist/query/index.mjs +0 -4
- package/dist/query/query-builder.d.ts +0 -323
- package/dist/query/query-builder.d.ts.map +0 -1
- package/dist/query/query-builder.js +0 -524
- package/dist/query/query-builder.js.map +0 -1
- package/dist/query/query-builder.mjs +0 -519
- package/dist/reasoning/context-synthesizer.d.ts +0 -57
- package/dist/reasoning/context-synthesizer.d.ts.map +0 -1
- package/dist/reasoning/context-synthesizer.js +0 -224
- package/dist/reasoning/context-synthesizer.js.map +0 -1
- package/dist/reasoning/context-synthesizer.mjs +0 -219
- package/dist/reasoning/experience-curator.d.ts +0 -66
- package/dist/reasoning/experience-curator.d.ts.map +0 -1
- package/dist/reasoning/experience-curator.js +0 -288
- package/dist/reasoning/experience-curator.js.map +0 -1
- package/dist/reasoning/experience-curator.mjs +0 -283
- package/dist/reasoning/memory-optimizer.d.ts +0 -69
- package/dist/reasoning/memory-optimizer.d.ts.map +0 -1
- package/dist/reasoning/memory-optimizer.js +0 -331
- package/dist/reasoning/memory-optimizer.js.map +0 -1
- package/dist/reasoning/memory-optimizer.mjs +0 -326
- package/dist/reasoning/pattern-matcher.d.ts +0 -59
- package/dist/reasoning/pattern-matcher.d.ts.map +0 -1
- package/dist/reasoning/pattern-matcher.js +0 -229
- package/dist/reasoning/pattern-matcher.js.map +0 -1
- package/dist/reasoning/pattern-matcher.mjs +0 -224
- package/dist/reasoningbank/adapter/agentdb-adapter.d.ts +0 -118
- package/dist/reasoningbank/adapter/agentdb-adapter.d.ts.map +0 -1
- package/dist/reasoningbank/adapter/agentdb-adapter.js +0 -477
- package/dist/reasoningbank/adapter/agentdb-adapter.js.map +0 -1
- package/dist/reasoningbank/adapter/types.d.ts +0 -113
- package/dist/reasoningbank/adapter/types.d.ts.map +0 -1
- package/dist/reasoningbank/adapter/types.js +0 -9
- package/dist/reasoningbank/adapter/types.js.map +0 -1
- package/dist/reasoningbank/cli/commands.d.ts +0 -16
- package/dist/reasoningbank/cli/commands.d.ts.map +0 -1
- package/dist/reasoningbank/cli/commands.js +0 -272
- package/dist/reasoningbank/cli/commands.js.map +0 -1
- package/dist/reasoningbank/mcp/agentdb-tools.d.ts +0 -319
- package/dist/reasoningbank/mcp/agentdb-tools.d.ts.map +0 -1
- package/dist/reasoningbank/mcp/agentdb-tools.js +0 -301
- package/dist/reasoningbank/mcp/agentdb-tools.js.map +0 -1
- package/dist/reasoningbank/migration/migrate.d.ts +0 -25
- package/dist/reasoningbank/migration/migrate.d.ts.map +0 -1
- package/dist/reasoningbank/migration/migrate.js +0 -178
- package/dist/reasoningbank/migration/migrate.js.map +0 -1
- package/dist/reasoningbank/reasoning/context-synthesizer.d.ts +0 -37
- package/dist/reasoningbank/reasoning/context-synthesizer.d.ts.map +0 -1
- package/dist/reasoningbank/reasoning/context-synthesizer.js +0 -114
- package/dist/reasoningbank/reasoning/context-synthesizer.js.map +0 -1
- package/dist/reasoningbank/reasoning/experience-curator.d.ts +0 -39
- package/dist/reasoningbank/reasoning/experience-curator.d.ts.map +0 -1
- package/dist/reasoningbank/reasoning/experience-curator.js +0 -98
- package/dist/reasoningbank/reasoning/experience-curator.js.map +0 -1
- package/dist/reasoningbank/reasoning/memory-optimizer.d.ts +0 -44
- package/dist/reasoningbank/reasoning/memory-optimizer.d.ts.map +0 -1
- package/dist/reasoningbank/reasoning/memory-optimizer.js +0 -184
- package/dist/reasoningbank/reasoning/memory-optimizer.js.map +0 -1
- package/dist/reasoningbank/reasoning/pattern-matcher.d.ts +0 -40
- package/dist/reasoningbank/reasoning/pattern-matcher.d.ts.map +0 -1
- package/dist/reasoningbank/reasoning/pattern-matcher.js +0 -87
- package/dist/reasoningbank/reasoning/pattern-matcher.js.map +0 -1
- package/dist/reasoningbank/sync/quic-sync.d.ts +0 -77
- package/dist/reasoningbank/sync/quic-sync.d.ts.map +0 -1
- package/dist/reasoningbank/sync/quic-sync.js +0 -165
- package/dist/reasoningbank/sync/quic-sync.js.map +0 -1
- package/dist/sync/conflict.d.ts +0 -78
- package/dist/sync/conflict.d.ts.map +0 -1
- package/dist/sync/conflict.js +0 -202
- package/dist/sync/conflict.js.map +0 -1
- package/dist/sync/conflict.mjs +0 -196
- package/dist/sync/coordinator.d.ts +0 -111
- package/dist/sync/coordinator.d.ts.map +0 -1
- package/dist/sync/coordinator.js +0 -256
- package/dist/sync/coordinator.js.map +0 -1
- package/dist/sync/coordinator.mjs +0 -250
- package/dist/sync/delta.d.ts +0 -81
- package/dist/sync/delta.d.ts.map +0 -1
- package/dist/sync/delta.js +0 -245
- package/dist/sync/delta.js.map +0 -1
- package/dist/sync/delta.mjs +0 -238
- package/dist/sync/index.d.ts +0 -11
- package/dist/sync/index.d.ts.map +0 -1
- package/dist/sync/index.js +0 -22
- package/dist/sync/index.js.map +0 -1
- package/dist/sync/index.mjs +0 -9
- package/dist/sync/quic-sync.d.ts +0 -81
- package/dist/sync/quic-sync.d.ts.map +0 -1
- package/dist/sync/quic-sync.js +0 -329
- package/dist/sync/quic-sync.js.map +0 -1
- package/dist/sync/quic-sync.mjs +0 -323
- package/dist/sync/types.d.ts +0 -168
- package/dist/sync/types.d.ts.map +0 -1
- package/dist/sync/types.js +0 -8
- package/dist/sync/types.js.map +0 -1
- package/dist/sync/types.mjs +0 -6
- package/dist/types/index.d.ts +0 -117
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -6
- package/dist/types/index.js.map +0 -1
- package/dist/types/index.mjs +0 -4
- package/dist/wasm/sql-wasm-debug.js +0 -6989
- package/dist/wasm/sql-wasm-debug.wasm +0 -0
- package/dist/wasm/sql-wasm.js +0 -188
- package/dist/wasm/sql-wasm.wasm +0 -0
- package/dist/wasm-loader.d.ts +0 -32
- package/dist/wasm-loader.d.ts.map +0 -1
- package/dist/wasm-loader.js +0 -78
- package/dist/wasm-loader.js.map +0 -1
- package/dist/wasm-loader.mjs +0 -67
- package/examples/adaptive-learning.ts +0 -284
- package/examples/browser/README.md +0 -732
- package/examples/browser/adaptive-recommendations/index.html +0 -427
- package/examples/browser/collaborative-filtering/index.html +0 -310
- package/examples/browser/continual-learning/index.html +0 -736
- package/examples/browser/experience-replay/index.html +0 -616
- package/examples/browser/index.html +0 -369
- package/examples/browser/meta-learning/index.html +0 -789
- package/examples/browser/neuro-symbolic/index.html +0 -692
- package/examples/browser/pattern-learning/index.html +0 -620
- package/examples/browser/quantum-inspired/index.html +0 -728
- package/examples/browser/rag/index.html +0 -624
- package/examples/browser/swarm-intelligence/index.html +0 -811
- package/examples/browser-basic.html +0 -170
- package/examples/browser-wasm-real.html +0 -231
- package/examples/hnsw-example.ts +0 -148
- package/examples/mcp-learning-example.ts +0 -220
- package/examples/node-basic.js +0 -70
- package/examples/quic-sync-example.ts +0 -310
- package/examples/quick-start.js +0 -68
- package/examples/test-v1.0.7-cdn.html +0 -190
- package/examples/wasm-example.ts +0 -222
|
@@ -1,427 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>Adaptive Recommendations - AgentDB</title>
|
|
7
|
-
<style>
|
|
8
|
-
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
9
|
-
body {
|
|
10
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
11
|
-
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
12
|
-
min-height: 100vh;
|
|
13
|
-
padding: 2rem;
|
|
14
|
-
}
|
|
15
|
-
.container { max-width: 1200px; margin: 0 auto; }
|
|
16
|
-
header {
|
|
17
|
-
background: white;
|
|
18
|
-
border-radius: 12px;
|
|
19
|
-
padding: 2rem;
|
|
20
|
-
margin-bottom: 2rem;
|
|
21
|
-
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
|
|
22
|
-
}
|
|
23
|
-
h1 { color: #333; margin-bottom: 0.5rem; }
|
|
24
|
-
.subtitle { color: #666; }
|
|
25
|
-
.grid { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; }
|
|
26
|
-
.card {
|
|
27
|
-
background: white;
|
|
28
|
-
border-radius: 12px;
|
|
29
|
-
padding: 2rem;
|
|
30
|
-
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
|
|
31
|
-
}
|
|
32
|
-
.card h2 { color: #333; margin-bottom: 1rem; }
|
|
33
|
-
.content-card {
|
|
34
|
-
background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
|
|
35
|
-
border: 2px solid #e0e0e0;
|
|
36
|
-
border-radius: 8px;
|
|
37
|
-
padding: 1.5rem;
|
|
38
|
-
margin-bottom: 1rem;
|
|
39
|
-
cursor: pointer;
|
|
40
|
-
transition: all 0.2s ease;
|
|
41
|
-
}
|
|
42
|
-
.content-card:hover {
|
|
43
|
-
border-color: #667eea;
|
|
44
|
-
transform: translateY(-2px);
|
|
45
|
-
}
|
|
46
|
-
.content-card.shown { border-color: #28a745; background: #d4edda22; }
|
|
47
|
-
.content-header {
|
|
48
|
-
display: flex;
|
|
49
|
-
justify-content: space-between;
|
|
50
|
-
align-items: start;
|
|
51
|
-
margin-bottom: 0.75rem;
|
|
52
|
-
}
|
|
53
|
-
.content-title {
|
|
54
|
-
font-weight: 600;
|
|
55
|
-
color: #333;
|
|
56
|
-
font-size: 1.1rem;
|
|
57
|
-
}
|
|
58
|
-
.content-score {
|
|
59
|
-
background: #667eea;
|
|
60
|
-
color: white;
|
|
61
|
-
padding: 0.25rem 0.75rem;
|
|
62
|
-
border-radius: 12px;
|
|
63
|
-
font-size: 0.85rem;
|
|
64
|
-
font-weight: 600;
|
|
65
|
-
}
|
|
66
|
-
.content-description {
|
|
67
|
-
color: #666;
|
|
68
|
-
line-height: 1.6;
|
|
69
|
-
margin-bottom: 0.75rem;
|
|
70
|
-
}
|
|
71
|
-
.content-tags {
|
|
72
|
-
display: flex;
|
|
73
|
-
flex-wrap: wrap;
|
|
74
|
-
gap: 0.5rem;
|
|
75
|
-
}
|
|
76
|
-
.tag {
|
|
77
|
-
background: #f0f0f0;
|
|
78
|
-
padding: 0.25rem 0.75rem;
|
|
79
|
-
border-radius: 12px;
|
|
80
|
-
font-size: 0.85rem;
|
|
81
|
-
color: #666;
|
|
82
|
-
}
|
|
83
|
-
.feedback-buttons {
|
|
84
|
-
display: flex;
|
|
85
|
-
gap: 0.5rem;
|
|
86
|
-
margin-top: 1rem;
|
|
87
|
-
}
|
|
88
|
-
.feedback-btn {
|
|
89
|
-
flex: 1;
|
|
90
|
-
padding: 0.5rem;
|
|
91
|
-
border: none;
|
|
92
|
-
border-radius: 6px;
|
|
93
|
-
font-weight: 600;
|
|
94
|
-
cursor: pointer;
|
|
95
|
-
transition: all 0.2s ease;
|
|
96
|
-
}
|
|
97
|
-
.feedback-btn.like {
|
|
98
|
-
background: #28a745;
|
|
99
|
-
color: white;
|
|
100
|
-
}
|
|
101
|
-
.feedback-btn.dislike {
|
|
102
|
-
background: #dc3545;
|
|
103
|
-
color: white;
|
|
104
|
-
}
|
|
105
|
-
.feedback-btn:hover { opacity: 0.8; }
|
|
106
|
-
.stat-card {
|
|
107
|
-
background: #f8f9fa;
|
|
108
|
-
border-radius: 6px;
|
|
109
|
-
padding: 1rem;
|
|
110
|
-
margin-bottom: 0.5rem;
|
|
111
|
-
}
|
|
112
|
-
.stat-label { color: #666; font-size: 0.9rem; }
|
|
113
|
-
.stat-value {
|
|
114
|
-
color: #333;
|
|
115
|
-
font-size: 1.5rem;
|
|
116
|
-
font-weight: bold;
|
|
117
|
-
margin-top: 0.25rem;
|
|
118
|
-
}
|
|
119
|
-
.algorithm-info {
|
|
120
|
-
background: #e3f2fd;
|
|
121
|
-
border-left: 4px solid #2196f3;
|
|
122
|
-
padding: 1rem;
|
|
123
|
-
border-radius: 4px;
|
|
124
|
-
margin-top: 1rem;
|
|
125
|
-
}
|
|
126
|
-
.algorithm-info h3 {
|
|
127
|
-
color: #2196f3;
|
|
128
|
-
margin-bottom: 0.5rem;
|
|
129
|
-
font-size: 1rem;
|
|
130
|
-
}
|
|
131
|
-
.algorithm-info p {
|
|
132
|
-
color: #666;
|
|
133
|
-
font-size: 0.9rem;
|
|
134
|
-
line-height: 1.5;
|
|
135
|
-
}
|
|
136
|
-
.progress-indicator {
|
|
137
|
-
margin-top: 1rem;
|
|
138
|
-
}
|
|
139
|
-
.progress-label {
|
|
140
|
-
display: flex;
|
|
141
|
-
justify-content: space-between;
|
|
142
|
-
margin-bottom: 0.5rem;
|
|
143
|
-
font-size: 0.9rem;
|
|
144
|
-
color: #666;
|
|
145
|
-
}
|
|
146
|
-
.progress-bar {
|
|
147
|
-
width: 100%;
|
|
148
|
-
height: 8px;
|
|
149
|
-
background: #e0e0e0;
|
|
150
|
-
border-radius: 4px;
|
|
151
|
-
overflow: hidden;
|
|
152
|
-
}
|
|
153
|
-
.progress-fill {
|
|
154
|
-
height: 100%;
|
|
155
|
-
background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
|
|
156
|
-
transition: width 0.3s ease;
|
|
157
|
-
}
|
|
158
|
-
</style>
|
|
159
|
-
</head>
|
|
160
|
-
<body>
|
|
161
|
-
<div class="container">
|
|
162
|
-
<header>
|
|
163
|
-
<h1>🎨 Adaptive Recommendation System</h1>
|
|
164
|
-
<p class="subtitle">Multi-Armed Bandit with Thompson Sampling - Real-time Learning</p>
|
|
165
|
-
</header>
|
|
166
|
-
|
|
167
|
-
<div class="grid">
|
|
168
|
-
<div class="card">
|
|
169
|
-
<h2>Content Feed</h2>
|
|
170
|
-
<p style="color: #666; margin-bottom: 1rem;">
|
|
171
|
-
Click on content to view. Like or dislike to help the system learn your preferences!
|
|
172
|
-
</p>
|
|
173
|
-
<div id="contentFeed"></div>
|
|
174
|
-
</div>
|
|
175
|
-
|
|
176
|
-
<div>
|
|
177
|
-
<div class="card" style="margin-bottom: 1rem;">
|
|
178
|
-
<h2>Learning Stats</h2>
|
|
179
|
-
|
|
180
|
-
<div class="stat-card">
|
|
181
|
-
<div class="stat-label">Content Viewed</div>
|
|
182
|
-
<div class="stat-value" id="viewedCount">0</div>
|
|
183
|
-
</div>
|
|
184
|
-
|
|
185
|
-
<div class="stat-card">
|
|
186
|
-
<div class="stat-label">Positive Feedback</div>
|
|
187
|
-
<div class="stat-value" id="likeCount">0</div>
|
|
188
|
-
</div>
|
|
189
|
-
|
|
190
|
-
<div class="stat-card">
|
|
191
|
-
<div class="stat-label">Learning Rate</div>
|
|
192
|
-
<div class="stat-value" id="learningRate">0%</div>
|
|
193
|
-
</div>
|
|
194
|
-
|
|
195
|
-
<div class="stat-card">
|
|
196
|
-
<div class="stat-label">Exploration Rate</div>
|
|
197
|
-
<div class="stat-value" id="exploreRate">50%</div>
|
|
198
|
-
</div>
|
|
199
|
-
</div>
|
|
200
|
-
|
|
201
|
-
<div class="card">
|
|
202
|
-
<h2>Category Preferences</h2>
|
|
203
|
-
<div id="categoryStats"></div>
|
|
204
|
-
</div>
|
|
205
|
-
</div>
|
|
206
|
-
</div>
|
|
207
|
-
|
|
208
|
-
<div class="card" style="margin-top: 2rem;">
|
|
209
|
-
<h2>How It Works</h2>
|
|
210
|
-
<div class="algorithm-info">
|
|
211
|
-
<h3>🎰 Multi-Armed Bandit (Thompson Sampling)</h3>
|
|
212
|
-
<p>
|
|
213
|
-
This system uses Thompson Sampling to balance exploration (trying new content categories)
|
|
214
|
-
and exploitation (showing categories you've liked before). It maintains a Beta distribution
|
|
215
|
-
for each category and samples from it to decide what to recommend next. Your feedback
|
|
216
|
-
updates the distributions in real-time, making recommendations increasingly personalized.
|
|
217
|
-
</p>
|
|
218
|
-
</div>
|
|
219
|
-
</div>
|
|
220
|
-
</div>
|
|
221
|
-
|
|
222
|
-
<script type="module">
|
|
223
|
-
const CONTENT_POOL = [
|
|
224
|
-
{ id: 1, category: 'tech', title: 'Latest AI Breakthroughs', description: 'Discover cutting-edge developments in artificial intelligence', tags: ['AI', 'Research', 'Innovation'] },
|
|
225
|
-
{ id: 2, category: 'tech', title: 'Cloud Computing Guide', description: 'Complete guide to modern cloud architecture', tags: ['Cloud', 'DevOps', 'Architecture'] },
|
|
226
|
-
{ id: 3, category: 'tech', title: 'Quantum Computing 101', description: 'Introduction to quantum computing principles', tags: ['Quantum', 'Physics', 'Computing'] },
|
|
227
|
-
{ id: 4, category: 'business', title: 'Startup Success Stories', description: 'Learn from founders who built billion-dollar companies', tags: ['Startup', 'Entrepreneurship'] },
|
|
228
|
-
{ id: 5, category: 'business', title: 'Marketing Strategies 2024', description: 'Latest trends in digital marketing', tags: ['Marketing', 'Strategy', 'Growth'] },
|
|
229
|
-
{ id: 6, category: 'business', title: 'Leadership Best Practices', description: 'How to build and lead high-performing teams', tags: ['Leadership', 'Management'] },
|
|
230
|
-
{ id: 7, category: 'science', title: 'Space Exploration Update', description: 'Recent discoveries from Mars missions', tags: ['Space', 'Mars', 'Exploration'] },
|
|
231
|
-
{ id: 8, category: 'science', title: 'Climate Change Research', description: 'Latest findings on climate science', tags: ['Climate', 'Environment', 'Research'] },
|
|
232
|
-
{ id: 9, category: 'science', title: 'Neuroscience Insights', description: 'How the brain processes information', tags: ['Neuroscience', 'Brain', 'Psychology'] },
|
|
233
|
-
{ id: 10, category: 'lifestyle', title: 'Healthy Living Tips', description: 'Science-backed health and wellness advice', tags: ['Health', 'Wellness', 'Fitness'] },
|
|
234
|
-
{ id: 11, category: 'lifestyle', title: 'Travel Destinations 2024', description: 'Must-visit places around the world', tags: ['Travel', 'Adventure', 'Culture'] },
|
|
235
|
-
{ id: 12, category: 'lifestyle', title: 'Mindfulness Practices', description: 'Meditation and stress reduction techniques', tags: ['Mindfulness', 'Mental Health'] },
|
|
236
|
-
];
|
|
237
|
-
|
|
238
|
-
let viewedContent = new Set();
|
|
239
|
-
let categoryBandits = {
|
|
240
|
-
tech: { alpha: 1, beta: 1 },
|
|
241
|
-
business: { alpha: 1, beta: 1 },
|
|
242
|
-
science: { alpha: 1, beta: 1 },
|
|
243
|
-
lifestyle: { alpha: 1, beta: 1 }
|
|
244
|
-
};
|
|
245
|
-
let feedbackHistory = [];
|
|
246
|
-
|
|
247
|
-
function betaSample(alpha, beta) {
|
|
248
|
-
// Approximate Beta distribution sampling using gamma distributions
|
|
249
|
-
const x = gammaSample(alpha, 1);
|
|
250
|
-
const y = gammaSample(beta, 1);
|
|
251
|
-
return x / (x + y);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
function gammaSample(shape, scale) {
|
|
255
|
-
// Marsaglia and Tsang method for gamma sampling
|
|
256
|
-
if (shape < 1) {
|
|
257
|
-
return gammaSample(shape + 1, scale) * Math.pow(Math.random(), 1 / shape);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
const d = shape - 1/3;
|
|
261
|
-
const c = 1 / Math.sqrt(9 * d);
|
|
262
|
-
|
|
263
|
-
while (true) {
|
|
264
|
-
let x, v;
|
|
265
|
-
do {
|
|
266
|
-
x = normalSample(0, 1);
|
|
267
|
-
v = 1 + c * x;
|
|
268
|
-
} while (v <= 0);
|
|
269
|
-
|
|
270
|
-
v = v * v * v;
|
|
271
|
-
x = x * x;
|
|
272
|
-
const u = Math.random();
|
|
273
|
-
|
|
274
|
-
if (u < 1 - 0.0331 * x * x) {
|
|
275
|
-
return scale * d * v;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
if (Math.log(u) < 0.5 * x + d * (1 - v + Math.log(v))) {
|
|
279
|
-
return scale * d * v;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
function normalSample(mean, variance) {
|
|
285
|
-
// Box-Muller transform
|
|
286
|
-
const u1 = Math.random();
|
|
287
|
-
const u2 = Math.random();
|
|
288
|
-
const z = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
|
|
289
|
-
return mean + Math.sqrt(variance) * z;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
function selectCategory() {
|
|
293
|
-
const samples = {};
|
|
294
|
-
|
|
295
|
-
Object.entries(categoryBandits).forEach(([category, { alpha, beta }]) => {
|
|
296
|
-
samples[category] = betaSample(alpha, beta);
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
return Object.entries(samples).reduce((a, b) => a[1] > b[1] ? a : b)[0];
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
function getRandomContent(category) {
|
|
303
|
-
const available = CONTENT_POOL.filter(c => c.category === category && !viewedContent.has(c.id));
|
|
304
|
-
|
|
305
|
-
if (available.length === 0) {
|
|
306
|
-
viewedContent.clear();
|
|
307
|
-
return getRandomContent(category);
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
return available[Math.floor(Math.random() * available.length)];
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
function renderFeed() {
|
|
314
|
-
const feed = document.getElementById('contentFeed');
|
|
315
|
-
const category = selectCategory();
|
|
316
|
-
const content = getRandomContent(category);
|
|
317
|
-
|
|
318
|
-
const card = document.createElement('div');
|
|
319
|
-
card.className = 'content-card';
|
|
320
|
-
card.innerHTML = `
|
|
321
|
-
<div class="content-header">
|
|
322
|
-
<div class="content-title">${content.title}</div>
|
|
323
|
-
<div class="content-score">${category}</div>
|
|
324
|
-
</div>
|
|
325
|
-
<div class="content-description">${content.description}</div>
|
|
326
|
-
<div class="content-tags">
|
|
327
|
-
${content.tags.map(tag => `<span class="tag">${tag}</span>`).join('')}
|
|
328
|
-
</div>
|
|
329
|
-
<div class="feedback-buttons">
|
|
330
|
-
<button class="feedback-btn like">👍 Like</button>
|
|
331
|
-
<button class="feedback-btn dislike">👎 Not Interested</button>
|
|
332
|
-
</div>
|
|
333
|
-
`;
|
|
334
|
-
|
|
335
|
-
card.querySelector('.like').addEventListener('click', (e) => {
|
|
336
|
-
e.stopPropagation();
|
|
337
|
-
handleFeedback(content, true);
|
|
338
|
-
card.classList.add('shown');
|
|
339
|
-
setTimeout(renderFeed, 500);
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
card.querySelector('.dislike').addEventListener('click', (e) => {
|
|
343
|
-
e.stopPropagation();
|
|
344
|
-
handleFeedback(content, false);
|
|
345
|
-
card.classList.add('shown');
|
|
346
|
-
setTimeout(renderFeed, 500);
|
|
347
|
-
});
|
|
348
|
-
|
|
349
|
-
feed.insertBefore(card, feed.firstChild);
|
|
350
|
-
|
|
351
|
-
while (feed.children.length > 5) {
|
|
352
|
-
feed.removeChild(feed.lastChild);
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
viewedContent.add(content.id);
|
|
356
|
-
updateStats();
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
function handleFeedback(content, liked) {
|
|
360
|
-
feedbackHistory.push({
|
|
361
|
-
content: content,
|
|
362
|
-
liked: liked,
|
|
363
|
-
timestamp: Date.now()
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
// Update bandit
|
|
367
|
-
if (liked) {
|
|
368
|
-
categoryBandits[content.category].alpha += 1;
|
|
369
|
-
} else {
|
|
370
|
-
categoryBandits[content.category].beta += 1;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
updateStats();
|
|
374
|
-
renderCategoryStats();
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
function updateStats() {
|
|
378
|
-
document.getElementById('viewedCount').textContent = feedbackHistory.length;
|
|
379
|
-
|
|
380
|
-
const likes = feedbackHistory.filter(f => f.liked).length;
|
|
381
|
-
document.getElementById('likeCount').textContent = likes;
|
|
382
|
-
|
|
383
|
-
if (feedbackHistory.length > 0) {
|
|
384
|
-
const rate = (likes / feedbackHistory.length * 100).toFixed(0);
|
|
385
|
-
document.getElementById('learningRate').textContent = `${rate}%`;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
// Calculate exploration rate (entropy of category distribution)
|
|
389
|
-
const totalFeedback = Object.values(categoryBandits).reduce((sum, b) => sum + b.alpha + b.beta, 0);
|
|
390
|
-
const entropy = Object.values(categoryBandits).reduce((sum, b) => {
|
|
391
|
-
const prob = (b.alpha + b.beta) / totalFeedback;
|
|
392
|
-
return sum - (prob > 0 ? prob * Math.log2(prob) : 0);
|
|
393
|
-
}, 0);
|
|
394
|
-
const maxEntropy = Math.log2(Object.keys(categoryBandits).length);
|
|
395
|
-
const exploreRate = ((entropy / maxEntropy) * 100).toFixed(0);
|
|
396
|
-
document.getElementById('exploreRate').textContent = `${exploreRate}%`;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
function renderCategoryStats() {
|
|
400
|
-
const container = document.getElementById('categoryStats');
|
|
401
|
-
|
|
402
|
-
container.innerHTML = Object.entries(categoryBandits)
|
|
403
|
-
.map(([category, { alpha, beta }]) => {
|
|
404
|
-
const total = alpha + beta;
|
|
405
|
-
const mean = alpha / total;
|
|
406
|
-
const percentage = (mean * 100).toFixed(0);
|
|
407
|
-
|
|
408
|
-
return `
|
|
409
|
-
<div class="progress-indicator">
|
|
410
|
-
<div class="progress-label">
|
|
411
|
-
<span>${category.charAt(0).toUpperCase() + category.slice(1)}</span>
|
|
412
|
-
<span>${percentage}%</span>
|
|
413
|
-
</div>
|
|
414
|
-
<div class="progress-bar">
|
|
415
|
-
<div class="progress-fill" style="width: ${percentage}%"></div>
|
|
416
|
-
</div>
|
|
417
|
-
</div>
|
|
418
|
-
`;
|
|
419
|
-
}).join('');
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
// Initialize
|
|
423
|
-
renderFeed();
|
|
424
|
-
renderCategoryStats();
|
|
425
|
-
</script>
|
|
426
|
-
</body>
|
|
427
|
-
</html>
|