@dikolab/kbdb 0.3.0 → 0.3.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/README.md +89 -120
- package/dist/bench/constants/corpus-defaults.constant.d.ts +3 -0
- package/dist/bench/functions/format-report.function.d.ts +11 -0
- package/dist/bench/functions/generate-corpus.function.d.ts +12 -0
- package/dist/bench/functions/measure-operation.function.d.ts +14 -0
- package/dist/bench/functions/seeded-rng.function.d.ts +11 -0
- package/dist/bench/functions/zipf-word.function.d.ts +13 -0
- package/dist/bench/index.d.ts +10 -0
- package/dist/bench/typings/bench-result.interface.d.ts +11 -0
- package/dist/bench/typings/bench-suite-result.interface.d.ts +10 -0
- package/dist/bench/typings/corpus-config.interface.d.ts +11 -0
- package/dist/bench/typings/corpus-section.interface.d.ts +9 -0
- package/dist/cli.cjs +63 -9
- package/dist/cli.cjs.map +2 -2
- package/dist/cli.mjs +63 -9
- package/dist/cli.mjs.map +2 -2
- package/dist/src/shared/auto-capture/classes/auto-capture-controller.class.d.ts +33 -0
- package/dist/src/shared/auto-capture/constants/auto-capture-defaults.constant.d.ts +8 -0
- package/dist/src/shared/auto-capture/functions/build-capture-prompt.function.d.ts +11 -0
- package/dist/src/shared/auto-capture/functions/evaluate-trigger.function.d.ts +12 -0
- package/dist/src/shared/auto-capture/index.d.ts +7 -0
- package/dist/src/shared/auto-capture/typings/auto-capture-config.interface.d.ts +13 -0
- package/dist/src/shared/auto-capture/typings/auto-capture-state.interface.d.ts +13 -0
- package/dist/src/shared/auto-capture/typings/auto-capture-trigger.interface.d.ts +7 -0
- package/dist/src/shared/cli/constants/global-help.constant.d.ts +8 -0
- package/dist/src/shared/cli/constants/leaf-help.constant.d.ts +7 -0
- package/dist/src/shared/cli/constants/memory-protocol-body.constant.d.ts +7 -0
- package/dist/src/shared/cli/constants/query-guidance-body.constant.d.ts +7 -0
- package/dist/src/shared/cli/constants/subcommand-help.constant.d.ts +8 -0
- package/dist/src/shared/cli/functions/collect-files.function.d.ts +13 -0
- package/dist/src/shared/cli/functions/compute-section-kbid.function.d.ts +15 -0
- package/dist/src/shared/cli/functions/format-mcp-output.function.d.ts +9 -0
- package/dist/src/shared/cli/functions/format-text-output.function.d.ts +9 -0
- package/dist/src/shared/cli/functions/generate-group-help.function.d.ts +11 -0
- package/dist/src/shared/cli/functions/handle-data-command.function.d.ts +16 -0
- package/dist/src/shared/cli/functions/handle-mcp.function.d.ts +15 -0
- package/dist/src/shared/cli/functions/handle-migrate.function.d.ts +15 -0
- package/dist/src/shared/cli/functions/hydrate-search-previews.function.d.ts +14 -0
- package/dist/src/shared/cli/functions/resolve-skill-names.function.d.ts +16 -0
- package/dist/src/shared/cli/functions/run-search.function.d.ts +1 -0
- package/dist/src/shared/cli/functions/version-gate.function.d.ts +15 -0
- package/dist/src/shared/cli/functions/wrap-command.function.d.ts +15 -0
- package/dist/src/shared/cli/typings/agent-create-client.interface.d.ts +42 -0
- package/dist/src/shared/cli/typings/agent-get-client.interface.d.ts +36 -0
- package/dist/src/shared/cli/typings/check-client.interface.d.ts +58 -0
- package/dist/src/shared/cli/typings/cli-deps.interface.d.ts +48 -0
- package/dist/src/shared/cli/typings/cli-options.interface.d.ts +2 -0
- package/dist/src/shared/cli/typings/disconnectable-client.interface.d.ts +26 -0
- package/dist/src/shared/cli/typings/dispatch-client.type.d.ts +27 -0
- package/dist/src/shared/cli/typings/learn-client.interface.d.ts +52 -0
- package/dist/src/shared/cli/typings/learn-io.interface.d.ts +5 -0
- package/dist/src/shared/cli/typings/search-client.interface.d.ts +71 -0
- package/dist/src/shared/embedding/classes/null-embedding-provider.class.d.ts +20 -0
- package/dist/src/shared/embedding/constants/near-duplicate-thresholds.constant.d.ts +15 -0
- package/dist/src/shared/embedding/functions/build-vector-index.function.d.ts +14 -0
- package/dist/src/shared/embedding/functions/cosine-similarity.function.d.ts +10 -0
- package/dist/src/shared/embedding/functions/detect-near-duplicates.function.d.ts +18 -0
- package/dist/src/shared/embedding/functions/jaccard-coefficient.function.d.ts +9 -0
- package/dist/src/shared/embedding/functions/read-vector-index-meta.function.d.ts +10 -0
- package/dist/src/shared/embedding/functions/rrf-fuse.function.d.ts +14 -0
- package/dist/src/shared/embedding/functions/search-vectors.function.d.ts +14 -0
- package/dist/src/shared/embedding/index.d.ts +16 -0
- package/dist/src/shared/embedding/typings/embedding-config.interface.d.ts +20 -0
- package/dist/src/shared/embedding/typings/embedding-provider.interface.d.ts +23 -0
- package/dist/src/shared/embedding/typings/near-duplicate-candidate.model.d.ts +23 -0
- package/dist/src/shared/embedding/typings/near-duplicate-result.model.d.ts +24 -0
- package/dist/src/shared/embedding/typings/vector-index-entry.model.d.ts +12 -0
- package/dist/src/shared/embedding/typings/vector-index-meta.model.d.ts +11 -0
- package/dist/src/shared/embedding/typings/vector-search-result.model.d.ts +7 -0
- package/dist/src/shared/mcp/constants/tool-agent-create.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-agent-delete.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-agent-get.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-agent-list.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-auto-capture-review.constant.d.ts +8 -0
- package/dist/src/shared/mcp/constants/tool-check.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-content.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-export.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-gc.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-learn.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-rebuild.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-recall.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-retrieve.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-search.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-skill-delete.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-skill-get.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-skill-learn.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-skill-list.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-status.constant.d.ts +3 -0
- package/dist/src/shared/mcp/constants/tool-unlearn.constant.d.ts +3 -0
- package/dist/src/shared/mcp/functions/as-boolean-or-undefined.function.d.ts +7 -0
- package/dist/src/shared/mcp/functions/as-string-array-or-undefined.function.d.ts +7 -0
- package/dist/src/shared/mcp/functions/as-string-array.function.d.ts +7 -0
- package/dist/src/shared/mcp/functions/as-string.function.d.ts +8 -0
- package/dist/src/shared/mcp/functions/build-skills-text.function.d.ts +18 -0
- package/dist/src/shared/mcp/functions/handle-agent-prompt.function.d.ts +14 -0
- package/dist/src/shared/mcp/functions/handle-mcp-request.function.d.ts +14 -0
- package/dist/src/shared/mcp/functions/handle-prompt-get.function.d.ts +4 -3
- package/dist/src/shared/mcp/functions/handle-skill-prompt.function.d.ts +16 -0
- package/dist/src/shared/mcp/functions/handle-tool-auto-capture-review.function.d.ts +12 -0
- package/dist/src/shared/mcp/functions/handle-tool-check.function.d.ts +11 -0
- package/dist/src/shared/mcp/functions/handle-tool-content.function.d.ts +12 -0
- package/dist/src/shared/mcp/functions/handle-tool-export.function.d.ts +12 -0
- package/dist/src/shared/mcp/functions/handle-tool-gc.function.d.ts +11 -0
- package/dist/src/shared/mcp/functions/handle-tool-learn.function.d.ts +12 -0
- package/dist/src/shared/mcp/functions/handle-tool-rebuild.function.d.ts +11 -0
- package/dist/src/shared/mcp/functions/handle-tool-retrieve.function.d.ts +12 -0
- package/dist/src/shared/mcp/functions/handle-tool-search.function.d.ts +13 -0
- package/dist/src/shared/mcp/functions/handle-tool-skill-delete.function.d.ts +12 -0
- package/dist/src/shared/mcp/functions/handle-tool-skill-get.function.d.ts +13 -0
- package/dist/src/shared/mcp/functions/handle-tool-skill-learn.function.d.ts +13 -0
- package/dist/src/shared/mcp/functions/handle-tool-skill-list.function.d.ts +11 -0
- package/dist/src/shared/mcp/functions/handle-tool-status.function.d.ts +11 -0
- package/dist/src/shared/mcp/functions/handle-tool-unlearn.function.d.ts +12 -0
- package/dist/src/shared/mcp/functions/parse-agent-meta.function.d.ts +14 -0
- package/dist/src/shared/mcp/functions/parse-skill-arguments.function.d.ts +11 -0
- package/dist/src/shared/mcp/functions/read-agent-meta.function.d.ts +17 -0
- package/dist/src/shared/mcp/functions/resolve-skill-refs.function.d.ts +23 -0
- package/dist/src/shared/mcp/functions/run-startup-health-check.function.d.ts +14 -0
- package/dist/src/shared/mcp/typings/mcp-capabilities.interface.d.ts +16 -0
- package/dist/src/shared/mcp/typings/mcp-client.interface.d.ts +2 -0
- package/dist/src/shared/mcp/typings/mcp-completion.interface.d.ts +43 -0
- package/dist/src/shared/mcp/typings/mcp-content-result.model.d.ts +9 -0
- package/dist/src/shared/mcp/typings/mcp-export-result.model.d.ts +11 -0
- package/dist/src/shared/mcp/typings/mcp-gc-result.model.d.ts +15 -0
- package/dist/src/shared/mcp/typings/mcp-integrity-check-result.model.d.ts +16 -0
- package/dist/src/shared/mcp/typings/mcp-integrity-error.model.d.ts +9 -0
- package/dist/src/shared/mcp/typings/mcp-notification.interface.d.ts +9 -0
- package/dist/src/shared/mcp/typings/mcp-rebuild-result.model.d.ts +9 -0
- package/dist/src/shared/mcp/typings/mcp-request.interface.d.ts +11 -0
- package/dist/src/shared/mcp/typings/mcp-resource-result.interface.d.ts +12 -0
- package/dist/src/shared/mcp/typings/mcp-resource-template.interface.d.ts +11 -0
- package/dist/src/shared/mcp/typings/mcp-response.interface.d.ts +18 -0
- package/dist/src/shared/mcp/typings/mcp-server-info.interface.d.ts +7 -0
- package/dist/src/shared/mcp/typings/mcp-server-state.interface.d.ts +16 -0
- package/dist/src/shared/mcp/typings/mcp-tool-annotations.interface.d.ts +32 -0
- package/dist/src/shared/mcp/typings/mcp-tool-definition.interface.d.ts +15 -0
- package/dist/src/shared/mcp/typings/mcp-tool-result.interface.d.ts +19 -0
- package/dist/src/shared/mcp/typings/mcp-worker-client.interface.d.ts +220 -0
- package/dist/src/shared/mcp/typings/tool-call-result.model.d.ts +17 -0
- package/dist/src/shared/sync/functions/build-import-report.function.d.ts +18 -0
- package/dist/src/shared/sync/functions/parse-export-entry.function.d.ts +11 -0
- package/dist/src/shared/sync/functions/resolve-conflict.function.d.ts +13 -0
- package/dist/src/shared/sync/functions/serialize-export-entry.function.d.ts +8 -0
- package/dist/src/shared/sync/index.d.ts +9 -0
- package/dist/src/shared/sync/typings/conflict-resolution.type.d.ts +8 -0
- package/dist/src/shared/sync/typings/export-entry.interface.d.ts +13 -0
- package/dist/src/shared/sync/typings/export-options.interface.d.ts +9 -0
- package/dist/src/shared/sync/typings/import-options.interface.d.ts +7 -0
- package/dist/src/shared/sync/typings/import-report.interface.d.ts +15 -0
- package/dist/src/shared/wasm-codec/functions/decode-one-recall-result.function.d.ts +14 -0
- package/dist/src/shared/wasm-codec/functions/decode-option-string.function.d.ts +12 -0
- package/dist/src/shared/wasm-codec/functions/decode-recall-document.function.d.ts +14 -0
- package/dist/src/shared/wasm-codec/functions/decode-recall-reference.function.d.ts +14 -0
- package/dist/src/shared/wasm-codec/functions/decode-recall-sibling.function.d.ts +13 -0
- package/dist/src/shared/wasm-codec/functions/decode-section-match.function.d.ts +15 -0
- package/dist/src/shared/wasm-codec/functions/decode-section-record-trailing.function.d.ts +14 -0
- package/dist/src/shared/wasm-codec/functions/decode-section-record.function.d.ts +14 -0
- package/dist/src/shared/wasm-codec/functions/decode-section-type.function.d.ts +13 -0
- package/dist/src/shared/wasm-codec/functions/decode-wasm-list.function.d.ts +17 -0
- package/dist/src/shared/wasm-codec/typings/add-section-input.model.d.ts +45 -0
- package/dist/src/shared/wasm-codec/typings/add-section-result.model.d.ts +27 -0
- package/dist/src/shared/wasm-codec/typings/document-manifest.model.d.ts +19 -0
- package/dist/src/shared/wasm-codec/typings/document-section.model.d.ts +12 -0
- package/dist/src/shared/wasm-codec/typings/item-decoder.type.d.ts +6 -0
- package/dist/src/shared/wasm-codec/typings/near-duplicate.model.d.ts +16 -0
- package/dist/src/shared/wasm-codec/typings/paged-search-result.model.d.ts +21 -0
- package/dist/src/shared/wasm-codec/typings/section-match.model.d.ts +31 -0
- package/dist/src/shared/wasm-codec/typings/section-record-trailing.model.d.ts +38 -0
- package/dist/src/shared/wasm-codec/typings/section-record.model.d.ts +66 -0
- package/dist/src/shared/wasm-codec/typings/section-type-result.model.d.ts +12 -0
- package/dist/src/shared/worker-client/functions/handle-ipc-data.function.d.ts +16 -0
- package/dist/src/shared/worker-client/functions/send-ipc-request.function.d.ts +19 -0
- package/dist/src/shared/worker-client/typings/add-section-result.model.d.ts +2 -0
- package/dist/src/shared/worker-client/typings/json-rpc-response.interface.d.ts +16 -0
- package/dist/src/shared/worker-client/typings/pending-call.interface.d.ts +7 -0
- package/dist/src/shared/worker-client/typings/recall-document.model.d.ts +16 -0
- package/dist/src/shared/worker-client/typings/recall-params.model.d.ts +15 -0
- package/dist/src/shared/worker-client/typings/recall-reference.model.d.ts +32 -0
- package/dist/src/shared/worker-client/typings/recall-sibling.model.d.ts +11 -0
- package/dist/src/shared/worker-client/typings/recall-single-result.model.d.ts +40 -0
- package/dist/src/shared/worker-daemon/classes/ipc-error.class.d.ts +17 -0
- package/dist/src/shared/worker-daemon/constants/wasm-method-map.constant.d.ts +16 -0
- package/dist/src/shared/worker-daemon/functions/build-ipc-error-response.function.d.ts +9 -0
- package/dist/src/shared/worker-daemon/functions/check-catalog-version.function.d.ts +9 -0
- package/dist/src/shared/worker-daemon/functions/check-preconditions.function.d.ts +10 -0
- package/dist/src/shared/worker-daemon/functions/detect-stale-pid.function.d.ts +15 -0
- package/dist/src/shared/worker-daemon/functions/dispatch-request.function.d.ts +35 -0
- package/dist/src/shared/worker-daemon/functions/handle-check-version.function.d.ts +23 -0
- package/dist/src/shared/worker-daemon/functions/handle-config-method.function.d.ts +11 -0
- package/dist/src/shared/worker-daemon/functions/handle-read-ops.function.d.ts +52 -0
- package/dist/src/shared/worker-daemon/functions/handle-write-ops.function.d.ts +44 -0
- package/dist/src/shared/worker-daemon/functions/parse-auto-capture-section.function.d.ts +14 -0
- package/dist/src/shared/worker-daemon/functions/parse-catalog-version.function.d.ts +10 -0
- package/dist/src/shared/worker-daemon/functions/parse-embedding-section.function.d.ts +13 -0
- package/dist/src/shared/worker-daemon/functions/parse-worker-toml.function.d.ts +11 -0
- package/dist/src/shared/worker-daemon/functions/run-startup-integrity-check.function.d.ts +18 -0
- package/dist/src/shared/worker-daemon/functions/scan-near-duplicates.function.d.ts +21 -0
- package/dist/src/shared/worker-daemon/functions/wasm-bridge.function.d.ts +51 -0
- package/dist/src/shared/worker-daemon/functions/wasm-memory-helpers.function.d.ts +22 -0
- package/dist/src/shared/worker-daemon/functions/write-lock.function.d.ts +32 -0
- package/dist/src/shared/worker-daemon/typings/allocator-ref.interface.d.ts +16 -0
- package/dist/src/shared/worker-daemon/typings/daemon-config.interface.d.ts +6 -0
- package/dist/src/shared/worker-daemon/typings/fs-adapter.interface.d.ts +22 -0
- package/dist/src/shared/worker-daemon/typings/handler-context.interface.d.ts +18 -0
- package/dist/src/shared/worker-daemon/typings/memory-ref.interface.d.ts +13 -0
- package/dist/src/shared/worker-daemon/typings/wasm-fn.type.d.ts +2 -0
- package/dist/src/shared/worker-daemon/typings/write-lock.interface.d.ts +15 -0
- package/dist/wasm/fs-database/kbdb_fs_database_bg.wasm +0 -0
- package/dist/wasm/kb-worker/kbdb_worker_bg.wasm +0 -0
- package/docs/details/cli.md +9 -0
- package/docs/details/mcp-server.md +5 -3
- package/docs/details/search-and-ranking.md +55 -0
- package/docs/goals/auto-capture.md +378 -0
- package/docs/goals/benchmarking.md +296 -0
- package/docs/goals/concurrency.md +259 -0
- package/docs/goals/hybrid-search.md +436 -0
- package/docs/goals/semantic-dedup.md +229 -0
- package/docs/goals/sync.md +217 -0
- package/docs/modules/rust/fs-database/indexes/vectors.md +110 -0
- package/docs/modules/typescript/shared/auto-capture/module.md +73 -0
- package/docs/modules/typescript/shared/embedding/functions.md +94 -0
- package/docs/modules/typescript/shared/embedding/module.md +71 -0
- package/docs/modules/typescript/shared/embedding/typings.md +122 -0
- package/docs/overview.md +171 -167
- package/docs/release-notes/0.2.0.md +3 -3
- package/docs/release-notes/0.3.0.md +89 -0
- package/docs/release-notes/0.3.1.md +121 -0
- package/docs/release-notes/0.3.2.md +64 -0
- package/docs/release-notes/README.md +3 -0
- package/package.json +1 -1
- package/src/shared/auto-capture/classes/auto-capture-controller.class.ts +62 -0
- package/src/shared/auto-capture/constants/auto-capture-defaults.constant.ts +15 -0
- package/src/shared/auto-capture/functions/build-capture-prompt.function.ts +27 -0
- package/src/shared/auto-capture/functions/evaluate-trigger.function.ts +50 -0
- package/src/shared/auto-capture/index.ts +7 -0
- package/src/shared/auto-capture/typings/auto-capture-config.interface.ts +13 -0
- package/src/shared/auto-capture/typings/auto-capture-state.interface.ts +13 -0
- package/src/shared/auto-capture/typings/auto-capture-trigger.interface.ts +7 -0
- package/src/shared/cli/constants/global-help.constant.ts +73 -0
- package/src/shared/cli/constants/leaf-help.constant.ts +219 -0
- package/src/shared/cli/constants/memory-protocol-body.constant.ts +39 -0
- package/src/shared/cli/constants/query-guidance-body.constant.ts +37 -0
- package/src/shared/cli/constants/subcommand-help.constant.ts +195 -0
- package/src/shared/cli/functions/collect-files.function.ts +55 -0
- package/src/shared/cli/functions/compute-section-kbid.function.ts +49 -0
- package/src/shared/cli/functions/format-mcp-output.function.ts +41 -0
- package/src/shared/cli/functions/format-text-output.function.ts +42 -0
- package/src/shared/cli/functions/generate-group-help.function.ts +41 -0
- package/src/shared/cli/functions/handle-data-command.function.ts +67 -0
- package/src/shared/cli/functions/handle-mcp.function.ts +56 -0
- package/src/shared/cli/functions/handle-migrate.function.ts +64 -0
- package/src/shared/cli/functions/hydrate-search-previews.function.ts +29 -0
- package/src/shared/cli/functions/parse-args.function.ts +3 -0
- package/src/shared/cli/functions/resolve-skill-names.function.ts +43 -0
- package/src/shared/cli/functions/run-search.function.ts +2 -0
- package/src/shared/cli/functions/version-gate.function.ts +44 -0
- package/src/shared/cli/functions/wrap-command.function.ts +34 -0
- package/src/shared/cli/typings/agent-create-client.interface.ts +47 -0
- package/src/shared/cli/typings/agent-get-client.interface.ts +39 -0
- package/src/shared/cli/typings/check-client.interface.ts +66 -0
- package/src/shared/cli/typings/cli-deps.interface.ts +54 -0
- package/src/shared/cli/typings/cli-options.interface.ts +2 -0
- package/src/shared/cli/typings/disconnectable-client.interface.ts +29 -0
- package/src/shared/cli/typings/dispatch-client.type.ts +46 -0
- package/src/shared/cli/typings/learn-client.interface.ts +53 -0
- package/src/shared/cli/typings/learn-io.interface.ts +5 -0
- package/src/shared/cli/typings/search-client.interface.ts +73 -0
- package/src/shared/embedding/classes/null-embedding-provider.class.ts +29 -0
- package/src/shared/embedding/constants/near-duplicate-thresholds.constant.ts +17 -0
- package/src/shared/embedding/functions/build-vector-index.function.ts +79 -0
- package/src/shared/embedding/functions/cosine-similarity.function.ts +31 -0
- package/src/shared/embedding/functions/detect-near-duplicates.function.ts +69 -0
- package/src/shared/embedding/functions/jaccard-coefficient.function.ts +26 -0
- package/src/shared/embedding/functions/read-vector-index-meta.function.ts +44 -0
- package/src/shared/embedding/functions/rrf-fuse.function.ts +33 -0
- package/src/shared/embedding/functions/search-vectors.function.ts +59 -0
- package/src/shared/embedding/index.ts +20 -0
- package/src/shared/embedding/typings/embedding-config.interface.ts +23 -0
- package/src/shared/embedding/typings/embedding-provider.interface.ts +25 -0
- package/src/shared/embedding/typings/near-duplicate-candidate.model.ts +25 -0
- package/src/shared/embedding/typings/near-duplicate-result.model.ts +26 -0
- package/src/shared/embedding/typings/vector-index-entry.model.ts +13 -0
- package/src/shared/embedding/typings/vector-index-meta.model.ts +14 -0
- package/src/shared/embedding/typings/vector-search-result.model.ts +8 -0
- package/src/shared/mcp/classes/mcp-server.class.ts +6 -3
- package/src/shared/mcp/constants/tool-agent-create.constant.ts +39 -0
- package/src/shared/mcp/constants/tool-agent-delete.constant.ts +26 -0
- package/src/shared/mcp/constants/tool-agent-get.constant.ts +24 -0
- package/src/shared/mcp/constants/tool-agent-list.constant.ts +18 -0
- package/src/shared/mcp/constants/tool-auto-capture-review.constant.ts +32 -0
- package/src/shared/mcp/constants/tool-check.constant.ts +21 -0
- package/src/shared/mcp/constants/tool-content.constant.ts +29 -0
- package/src/shared/mcp/constants/tool-export.constant.ts +27 -0
- package/src/shared/mcp/constants/tool-gc.constant.ts +21 -0
- package/src/shared/mcp/constants/tool-learn.constant.ts +58 -0
- package/src/shared/mcp/constants/tool-rebuild.constant.ts +21 -0
- package/src/shared/mcp/constants/tool-recall.constant.ts +36 -0
- package/src/shared/mcp/constants/tool-retrieve.constant.ts +31 -0
- package/src/shared/mcp/constants/tool-search.constant.ts +51 -0
- package/src/shared/mcp/constants/tool-skill-delete.constant.ts +24 -0
- package/src/shared/mcp/constants/tool-skill-get.constant.ts +27 -0
- package/src/shared/mcp/constants/tool-skill-learn.constant.ts +37 -0
- package/src/shared/mcp/constants/tool-skill-list.constant.ts +18 -0
- package/src/shared/mcp/constants/tool-status.constant.ts +20 -0
- package/src/shared/mcp/constants/tool-unlearn.constant.ts +25 -0
- package/src/shared/mcp/functions/as-boolean-or-undefined.function.ts +11 -0
- package/src/shared/mcp/functions/as-string-array-or-undefined.function.ts +17 -0
- package/src/shared/mcp/functions/as-string-array.function.ts +15 -0
- package/src/shared/mcp/functions/as-string.function.ts +10 -0
- package/src/shared/mcp/functions/build-skills-text.function.ts +43 -0
- package/src/shared/mcp/functions/create-tool-definitions.function.ts +28 -0
- package/src/shared/mcp/functions/handle-agent-create.function.ts +1 -1
- package/src/shared/mcp/functions/handle-agent-prompt.function.ts +68 -0
- package/src/shared/mcp/functions/handle-mcp-request.function.ts +202 -0
- package/src/shared/mcp/functions/handle-prompt-get.function.ts +18 -12
- package/src/shared/mcp/functions/handle-skill-prompt.function.ts +44 -0
- package/src/shared/mcp/functions/handle-tool-auto-capture-review.function.ts +24 -0
- package/src/shared/mcp/functions/handle-tool-call.function.ts +18 -0
- package/src/shared/mcp/functions/handle-tool-check.function.ts +21 -0
- package/src/shared/mcp/functions/handle-tool-content.function.ts +23 -0
- package/src/shared/mcp/functions/handle-tool-export.function.ts +25 -0
- package/src/shared/mcp/functions/handle-tool-gc.function.ts +21 -0
- package/src/shared/mcp/functions/handle-tool-learn.function.ts +69 -0
- package/src/shared/mcp/functions/handle-tool-rebuild.function.ts +21 -0
- package/src/shared/mcp/functions/handle-tool-retrieve.function.ts +40 -0
- package/src/shared/mcp/functions/handle-tool-search.function.ts +47 -0
- package/src/shared/mcp/functions/handle-tool-skill-delete.function.ts +34 -0
- package/src/shared/mcp/functions/handle-tool-skill-get.function.ts +59 -0
- package/src/shared/mcp/functions/handle-tool-skill-learn.function.ts +61 -0
- package/src/shared/mcp/functions/handle-tool-skill-list.function.ts +39 -0
- package/src/shared/mcp/functions/handle-tool-status.function.ts +21 -0
- package/src/shared/mcp/functions/handle-tool-unlearn.function.ts +24 -0
- package/src/shared/mcp/functions/parse-agent-meta.function.ts +27 -0
- package/src/shared/mcp/functions/parse-skill-arguments.function.ts +36 -0
- package/src/shared/mcp/functions/read-agent-meta.function.ts +41 -0
- package/src/shared/mcp/functions/resolve-skill-refs.function.ts +50 -0
- package/src/shared/mcp/functions/run-startup-health-check.function.ts +34 -0
- package/src/shared/mcp/typings/mcp-capabilities.interface.ts +16 -0
- package/src/shared/mcp/typings/mcp-client.interface.ts +2 -0
- package/src/shared/mcp/typings/mcp-completion.interface.ts +45 -0
- package/src/shared/mcp/typings/mcp-content-result.model.ts +9 -0
- package/src/shared/mcp/typings/mcp-export-result.model.ts +11 -0
- package/src/shared/mcp/typings/mcp-gc-result.model.ts +15 -0
- package/src/shared/mcp/typings/mcp-integrity-check-result.model.ts +17 -0
- package/src/shared/mcp/typings/mcp-integrity-error.model.ts +15 -0
- package/src/shared/mcp/typings/mcp-notification.interface.ts +9 -0
- package/src/shared/mcp/typings/mcp-rebuild-result.model.ts +9 -0
- package/src/shared/mcp/typings/mcp-request.interface.ts +11 -0
- package/src/shared/mcp/typings/mcp-resource-result.interface.ts +12 -0
- package/src/shared/mcp/typings/mcp-resource-template.interface.ts +11 -0
- package/src/shared/mcp/typings/mcp-response.interface.ts +18 -0
- package/src/shared/mcp/typings/mcp-server-info.interface.ts +7 -0
- package/src/shared/mcp/typings/mcp-server-state.interface.ts +17 -0
- package/src/shared/mcp/typings/mcp-tool-annotations.interface.ts +32 -0
- package/src/shared/mcp/typings/mcp-tool-definition.interface.ts +16 -0
- package/src/shared/mcp/typings/mcp-tool-result.interface.ts +19 -0
- package/src/shared/mcp/typings/mcp-worker-client.interface.ts +243 -0
- package/src/shared/mcp/typings/tool-call-result.model.ts +18 -0
- package/src/shared/sync/functions/build-import-report.function.ts +40 -0
- package/src/shared/sync/functions/parse-export-entry.function.ts +45 -0
- package/src/shared/sync/functions/resolve-conflict.function.ts +31 -0
- package/src/shared/sync/functions/serialize-export-entry.function.ts +18 -0
- package/src/shared/sync/index.ts +9 -0
- package/src/shared/sync/typings/conflict-resolution.type.ts +8 -0
- package/src/shared/sync/typings/export-entry.interface.ts +13 -0
- package/src/shared/sync/typings/export-options.interface.ts +9 -0
- package/src/shared/sync/typings/import-options.interface.ts +7 -0
- package/src/shared/sync/typings/import-report.interface.ts +15 -0
- package/src/shared/wasm-codec/functions/decode-one-recall-result.function.ts +86 -0
- package/src/shared/wasm-codec/functions/decode-option-string.function.ts +24 -0
- package/src/shared/wasm-codec/functions/decode-recall-document.function.ts +59 -0
- package/src/shared/wasm-codec/functions/decode-recall-reference.function.ts +52 -0
- package/src/shared/wasm-codec/functions/decode-recall-sibling.function.ts +43 -0
- package/src/shared/wasm-codec/functions/decode-section-match.function.ts +80 -0
- package/src/shared/wasm-codec/functions/decode-section-record-trailing.function.ts +75 -0
- package/src/shared/wasm-codec/functions/decode-section-record.function.ts +85 -0
- package/src/shared/wasm-codec/functions/decode-section-type.function.ts +30 -0
- package/src/shared/wasm-codec/functions/decode-wasm-list.function.ts +31 -0
- package/src/shared/wasm-codec/typings/add-section-input.model.ts +45 -0
- package/src/shared/wasm-codec/typings/add-section-result.model.ts +28 -0
- package/src/shared/wasm-codec/typings/document-manifest.model.ts +20 -0
- package/src/shared/wasm-codec/typings/document-section.model.ts +12 -0
- package/src/shared/wasm-codec/typings/item-decoder.type.ts +10 -0
- package/src/shared/wasm-codec/typings/near-duplicate.model.ts +16 -0
- package/src/shared/wasm-codec/typings/paged-search-result.model.ts +22 -0
- package/src/shared/wasm-codec/typings/section-match.model.ts +31 -0
- package/src/shared/wasm-codec/typings/section-record-trailing.model.ts +38 -0
- package/src/shared/wasm-codec/typings/section-record.model.ts +66 -0
- package/src/shared/wasm-codec/typings/section-type-result.model.ts +12 -0
- package/src/shared/worker-client/functions/handle-ipc-data.function.ts +49 -0
- package/src/shared/worker-client/functions/send-ipc-request.function.ts +39 -0
- package/src/shared/worker-client/typings/add-section-result.model.ts +2 -0
- package/src/shared/worker-client/typings/json-rpc-response.interface.ts +17 -0
- package/src/shared/worker-client/typings/pending-call.interface.ts +7 -0
- package/src/shared/worker-client/typings/recall-document.model.ts +16 -0
- package/src/shared/worker-client/typings/recall-params.model.ts +15 -0
- package/src/shared/worker-client/typings/recall-reference.model.ts +32 -0
- package/src/shared/worker-client/typings/recall-sibling.model.ts +11 -0
- package/src/shared/worker-client/typings/recall-single-result.model.ts +41 -0
- package/src/shared/worker-daemon/classes/ipc-error.class.ts +22 -0
- package/src/shared/worker-daemon/constants/wasm-method-map.constant.ts +69 -0
- package/src/shared/worker-daemon/functions/build-ipc-error-response.function.ts +16 -0
- package/src/shared/worker-daemon/functions/check-catalog-version.function.ts +54 -0
- package/src/shared/worker-daemon/functions/check-preconditions.function.ts +28 -0
- package/src/shared/worker-daemon/functions/detect-stale-pid.function.ts +33 -0
- package/src/shared/worker-daemon/functions/dispatch-request.function.ts +190 -0
- package/src/shared/worker-daemon/functions/handle-check-version.function.ts +74 -0
- package/src/shared/worker-daemon/functions/handle-config-method.function.ts +27 -0
- package/src/shared/worker-daemon/functions/handle-read-ops.function.ts +236 -0
- package/src/shared/worker-daemon/functions/handle-write-ops.function.ts +257 -0
- package/src/shared/worker-daemon/functions/parse-auto-capture-section.function.ts +51 -0
- package/src/shared/worker-daemon/functions/parse-catalog-version.function.ts +20 -0
- package/src/shared/worker-daemon/functions/parse-embedding-section.function.ts +38 -0
- package/src/shared/worker-daemon/functions/parse-worker-toml.function.ts +104 -0
- package/src/shared/worker-daemon/functions/run-startup-integrity-check.function.ts +55 -0
- package/src/shared/worker-daemon/functions/scan-near-duplicates.function.ts +92 -0
- package/src/shared/worker-daemon/functions/wasm-bridge.function.ts +144 -0
- package/src/shared/worker-daemon/functions/wasm-memory-helpers.function.ts +41 -0
- package/src/shared/worker-daemon/functions/write-lock.function.ts +49 -0
- package/src/shared/worker-daemon/typings/allocator-ref.interface.ts +16 -0
- package/src/shared/worker-daemon/typings/daemon-config.interface.ts +7 -0
- package/src/shared/worker-daemon/typings/fs-adapter.interface.ts +22 -0
- package/src/shared/worker-daemon/typings/handler-context.interface.ts +19 -0
- package/src/shared/worker-daemon/typings/memory-ref.interface.ts +13 -0
- package/src/shared/worker-daemon/typings/wasm-fn.type.ts +2 -0
- package/src/shared/worker-daemon/typings/write-lock.interface.ts +13 -0
- package/src/wasm/fs-database/kbdb_fs_database_bg.wasm +0 -0
- package/src/wasm/kb-worker/kbdb_worker_bg.wasm +0 -0
|
@@ -62,7 +62,7 @@ at once.
|
|
|
62
62
|
scores are kept in CLI and IPC output for
|
|
63
63
|
debugging.
|
|
64
64
|
|
|
65
|
-
- **Tool annotations** -- All
|
|
65
|
+
- **Tool annotations** -- All 20 MCP tool
|
|
66
66
|
definitions now include `openWorldHint: false`,
|
|
67
67
|
`readOnlyHint`, `destructiveHint`, and
|
|
68
68
|
`idempotentHint` annotations per the MCP spec.
|
|
@@ -84,8 +84,8 @@ at once.
|
|
|
84
84
|
|
|
85
85
|
## Testing
|
|
86
86
|
|
|
87
|
-
- **
|
|
88
|
-
|
|
87
|
+
- **548 e2e assertions** on both Node.js and Deno --
|
|
88
|
+
all passing with 0 failures and 0 skips.
|
|
89
89
|
|
|
90
90
|
- **Recall depth testing** -- Cross-referenced
|
|
91
91
|
test data (sections with `$(link: ...)` markers)
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# 0.3.0
|
|
2
|
+
|
|
3
|
+
*Minor release -- 2026-06-23*
|
|
4
|
+
|
|
5
|
+
Adds supersession, relaxed queries, database export,
|
|
6
|
+
tags, and confidence scoring. The Rust engine gains
|
|
7
|
+
source tracking, near-duplicate detection, and
|
|
8
|
+
synonym expansion.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## New Features
|
|
13
|
+
|
|
14
|
+
- **Supersession** -- Re-learning from the same
|
|
15
|
+
source automatically replaces outdated sections
|
|
16
|
+
instead of duplicating them. Source key identity
|
|
17
|
+
tracked via SHA-256.
|
|
18
|
+
|
|
19
|
+
- **Relaxed OR fallback** -- When an exact AND
|
|
20
|
+
query returns no results, kbdb automatically
|
|
21
|
+
retries with relaxed OR matching so you always
|
|
22
|
+
get the best available results.
|
|
23
|
+
|
|
24
|
+
- **Database export** -- New `export` CLI command
|
|
25
|
+
and MCP tool. Copies sections, documents, and
|
|
26
|
+
catalog as a self-contained directory snapshot.
|
|
27
|
+
|
|
28
|
+
- **Tags and replace on learn** -- `--tags` attaches
|
|
29
|
+
labels to imported sections for scoped queries.
|
|
30
|
+
`--replace` supersedes existing sections from the
|
|
31
|
+
same source in one step.
|
|
32
|
+
|
|
33
|
+
- **Confidence scoring** -- Search results include
|
|
34
|
+
a normalized BM25F confidence score and
|
|
35
|
+
`matched_fields` (heading, body, code) so agents
|
|
36
|
+
can tell strong matches from weak ones.
|
|
37
|
+
|
|
38
|
+
- **Near-duplicate detection** -- Jaccard similarity
|
|
39
|
+
warns when imported content closely matches an
|
|
40
|
+
existing section, preventing silent drift.
|
|
41
|
+
|
|
42
|
+
- **Default skills** -- `db init` installs
|
|
43
|
+
`query-guidance` and `memory-protocol` skills
|
|
44
|
+
that teach agents how to search and what to store.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Improvements
|
|
49
|
+
|
|
50
|
+
- **Synonym expansion pipeline** in the Rust engine
|
|
51
|
+
broadens keyword coverage automatically.
|
|
52
|
+
|
|
53
|
+
- **Matched field tracking** -- Results show which
|
|
54
|
+
fields (heading, body, code) matched the query.
|
|
55
|
+
|
|
56
|
+
- **`created_at` timestamps** in search results.
|
|
57
|
+
|
|
58
|
+
- **Divergent content detection** via integrity
|
|
59
|
+
check catches contradictions between versions.
|
|
60
|
+
|
|
61
|
+
- **GC fix** -- Garbage collection now only removes
|
|
62
|
+
superseded sections, not active ones.
|
|
63
|
+
|
|
64
|
+
- **Reference graph rebuild** included in `rebuild`
|
|
65
|
+
command.
|
|
66
|
+
|
|
67
|
+
- **Writer lock** prevents concurrent WASM writes.
|
|
68
|
+
|
|
69
|
+
- **Worker daemon startup health check** verifies
|
|
70
|
+
WASM modules load correctly.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Testing
|
|
75
|
+
|
|
76
|
+
- **517 e2e assertions (Node.js), 514 (Deno)** --
|
|
77
|
+
all pass with 0 failures.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Upgrade
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
# Node.js
|
|
85
|
+
npm install -g @dikolab/kbdb@0.3.0
|
|
86
|
+
|
|
87
|
+
# Deno
|
|
88
|
+
deno install -Agf jsr:@dikolab/kbdb/cli
|
|
89
|
+
```
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# 0.3.1
|
|
2
|
+
|
|
3
|
+
*Patch release -- 2026-06-23*
|
|
4
|
+
|
|
5
|
+
Fixes MCP request processing reliability, agent
|
|
6
|
+
document persistence, WASM memory safety, and
|
|
7
|
+
eliminates all e2e test skips. Adds the 20th MCP
|
|
8
|
+
tool (`auto-capture-review`).
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **MCP sequential request processing** -- The MCP
|
|
15
|
+
server previously dispatched JSON-RPC requests
|
|
16
|
+
concurrently (fire-and-forget). When multiple
|
|
17
|
+
requests arrived in a batch, later requests could
|
|
18
|
+
execute before earlier ones finished -- for
|
|
19
|
+
example, reading an agent document before it was
|
|
20
|
+
fully written. Requests are now processed
|
|
21
|
+
sequentially via a promise chain, ensuring each
|
|
22
|
+
completes before the next begins.
|
|
23
|
+
|
|
24
|
+
- **Agent document type persistence** -- Agent
|
|
25
|
+
documents created via `agent-create` were missing
|
|
26
|
+
their `doc_type` field, so `listDocumentsByType`
|
|
27
|
+
could not find them. `handleAgentCreate` now
|
|
28
|
+
passes `'agent'` as the document type.
|
|
29
|
+
|
|
30
|
+
- **Agent prompt lookup** -- `prompts/get` for
|
|
31
|
+
agent prompts treated the agent title as a
|
|
32
|
+
document ID, which failed because document IDs
|
|
33
|
+
are content hashes. Now looks up agents by title
|
|
34
|
+
via `listDocumentsByType('agent')`.
|
|
35
|
+
|
|
36
|
+
- **WASM `worker_remove_grouping` double-free** --
|
|
37
|
+
The WASM export returned success without calling
|
|
38
|
+
`set_return`, leaving stale memory in the return
|
|
39
|
+
slot. The next `readReturnSlot` call freed
|
|
40
|
+
already-freed memory, causing a WASM trap. Now
|
|
41
|
+
sets the return slot to null before returning.
|
|
42
|
+
|
|
43
|
+
- **WASM defensive `set_return` calls** -- Added
|
|
44
|
+
null return slot initialization to `worker_init`
|
|
45
|
+
and `worker_init_directory` to prevent the same
|
|
46
|
+
stale-memory pattern from surfacing in edge cases.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## New Features
|
|
51
|
+
|
|
52
|
+
- **`auto-capture-review` MCP tool** -- Review and
|
|
53
|
+
approve pending auto-captured knowledge before
|
|
54
|
+
storage. Accepts `action` parameter with values
|
|
55
|
+
`list`, `approve`, or `reject`. This brings the
|
|
56
|
+
MCP server to 20 tools.
|
|
57
|
+
|
|
58
|
+
- **Hybrid search infrastructure** -- New `--algo`
|
|
59
|
+
flag (CLI) and `algo` parameter (MCP/IPC) with
|
|
60
|
+
values `lexical`, `vector`, `hybrid`. Embedding
|
|
61
|
+
module with pluggable provider interface, vector
|
|
62
|
+
index binary format (KBVX), cosine similarity,
|
|
63
|
+
and RRF score fusion. Defaults to `lexical`.
|
|
64
|
+
Concrete embedding providers are deferred -- a
|
|
65
|
+
`NullEmbeddingProvider` is used until one is
|
|
66
|
+
configured.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Testing
|
|
71
|
+
|
|
72
|
+
- **548 e2e assertions** on both Node.js and Deno,
|
|
73
|
+
all passing with **0 failures and 0 skips** (up
|
|
74
|
+
from 517/514 with some skips in 0.3.0).
|
|
75
|
+
|
|
76
|
+
- **E2E test restructuring** -- Test databases
|
|
77
|
+
isolated by category (CLI, MCP, Worker) instead
|
|
78
|
+
of sharing a flat directory. Worker recall tests
|
|
79
|
+
now seed their own cross-reference data instead
|
|
80
|
+
of depending on CLI test data.
|
|
81
|
+
|
|
82
|
+
- **Pre-built WASM in Docker** -- E2E test
|
|
83
|
+
container caches WASM binaries at build time,
|
|
84
|
+
reducing test startup from ~30 seconds to
|
|
85
|
+
sub-second.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Documentation
|
|
90
|
+
|
|
91
|
+
- **README.md** reorganized for clarity -- shorter
|
|
92
|
+
intro, labeled paragraphs ("How search works",
|
|
93
|
+
"Knowledge stays fresh"), accessible to both
|
|
94
|
+
technical and non-technical readers.
|
|
95
|
+
|
|
96
|
+
- **Architecture overview** rewritten -- simplified
|
|
97
|
+
prose, ASCII architecture diagram, removed stale
|
|
98
|
+
"Remaining" section (WASM host I/O is fully
|
|
99
|
+
implemented).
|
|
100
|
+
|
|
101
|
+
- **MCP server guide** updated with
|
|
102
|
+
`auto-capture-review` tool in reference tables
|
|
103
|
+
and annotations summary.
|
|
104
|
+
|
|
105
|
+
- **Tool counts corrected** across all docs
|
|
106
|
+
(19 -> 20).
|
|
107
|
+
|
|
108
|
+
- **Assertion counts updated** across all docs
|
|
109
|
+
(380+/383 -> 548).
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Upgrade
|
|
114
|
+
|
|
115
|
+
```sh
|
|
116
|
+
# Node.js
|
|
117
|
+
npm install -g @dikolab/kbdb@0.3.1
|
|
118
|
+
|
|
119
|
+
# Deno
|
|
120
|
+
deno install -Agf jsr:@dikolab/kbdb/cli
|
|
121
|
+
```
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# 0.3.2
|
|
2
|
+
|
|
3
|
+
*Patch release -- 2026-06-23*
|
|
4
|
+
|
|
5
|
+
Documentation alignment, hybrid search highlight,
|
|
6
|
+
and readability improvements for non-technical users.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Documentation
|
|
11
|
+
|
|
12
|
+
- **Internal doc links use relative paths** --
|
|
13
|
+
README.md links to CLI reference, MCP guide,
|
|
14
|
+
library API, Makefile, release notes, overview,
|
|
15
|
+
and LICENSE now use relative paths instead of
|
|
16
|
+
absolute GitLab URLs. External links (NPM, JSR,
|
|
17
|
+
GitLab homepage) remain absolute.
|
|
18
|
+
|
|
19
|
+
- **Fixed repository URL in overview.md** --
|
|
20
|
+
Corrected `tech-slaves-internal` to `tech-slaves`.
|
|
21
|
+
|
|
22
|
+
- **`--algo` added to CLI reference** -- Search
|
|
23
|
+
Options table now documents the `--algo` flag with
|
|
24
|
+
values `lexical`, `vector`, `hybrid` and a new
|
|
25
|
+
Search Algorithms subsection.
|
|
26
|
+
|
|
27
|
+
- **Hybrid search section in search-and-ranking.md**
|
|
28
|
+
-- New section explains lexical, vector, and hybrid
|
|
29
|
+
algorithms with plain-language descriptions of
|
|
30
|
+
how each works and when to use it.
|
|
31
|
+
|
|
32
|
+
- **Beginner summary in search-and-ranking.md** --
|
|
33
|
+
Three-sentence intro at the top so non-technical
|
|
34
|
+
readers know what the page covers without reading
|
|
35
|
+
the full technical deep-dive.
|
|
36
|
+
|
|
37
|
+
- **Feature lists updated** -- README and overview
|
|
38
|
+
now include auto-capture, sync/export, and
|
|
39
|
+
near-duplicate detection. Design Documents section
|
|
40
|
+
in overview now links to hybrid search,
|
|
41
|
+
auto-capture, and sync goal docs.
|
|
42
|
+
|
|
43
|
+
- **Readability pass** -- Simplified jargon across
|
|
44
|
+
README and overview. "RRF score fusion" becomes
|
|
45
|
+
"blends keyword matching with AI-powered
|
|
46
|
+
similarity". Technology stack table simplified.
|
|
47
|
+
MCP setup examples consolidated from three
|
|
48
|
+
nearly-identical blocks into one with platform
|
|
49
|
+
notes.
|
|
50
|
+
|
|
51
|
+
- **"Vibe coders" added to audience list** in
|
|
52
|
+
overview.md.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Upgrade
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
# Node.js
|
|
60
|
+
npm install -g @dikolab/kbdb@0.3.2
|
|
61
|
+
|
|
62
|
+
# Deno
|
|
63
|
+
deno install -Agf jsr:@dikolab/kbdb/cli
|
|
64
|
+
```
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
## Releases
|
|
4
4
|
|
|
5
|
+
- [0.3.2](0.3.2.md) -- Docs alignment, hybrid search highlight, readability
|
|
6
|
+
- [0.3.1](0.3.1.md) -- MCP reliability fixes, 20 tools, zero test skips
|
|
7
|
+
- [0.3.0](0.3.0.md) -- Supersession, relaxed queries, export, tags, confidence
|
|
5
8
|
- [0.2.0](0.2.0.md) -- Recall, paginated search, reference graph
|
|
6
9
|
- [0.1.3](0.1.3.md) -- Include WASM binaries in JSR package
|
|
7
10
|
- [0.1.2](0.1.2.md) -- Fix WASM loading from JSR
|
package/package.json
CHANGED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { AutoCaptureConfig } from '../typings/auto-capture-config.interface.ts';
|
|
2
|
+
import type { AutoCaptureState } from '../typings/auto-capture-state.interface.ts';
|
|
3
|
+
import type { AutoCaptureTrigger } from '../typings/auto-capture-trigger.interface.ts';
|
|
4
|
+
import { evaluateTrigger } from '../functions/evaluate-trigger.function.ts';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Controls the auto-capture lifecycle.
|
|
8
|
+
*
|
|
9
|
+
* Tracks tool call counts, evaluates trigger conditions, and
|
|
10
|
+
* advances session state when a capture fires. Reset state on
|
|
11
|
+
* disconnect or session end via `reset()`.
|
|
12
|
+
*/
|
|
13
|
+
export class AutoCaptureController {
|
|
14
|
+
private toolCallsSinceLastCapture = 0;
|
|
15
|
+
private lastCaptureTimestamp = 0;
|
|
16
|
+
private totalCapturesThisSession = 0;
|
|
17
|
+
private readonly config: AutoCaptureConfig;
|
|
18
|
+
|
|
19
|
+
/** @param config - the auto-capture configuration to use */
|
|
20
|
+
constructor(config: AutoCaptureConfig) {
|
|
21
|
+
this.config = config;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Record one tool call for trigger counting. */
|
|
25
|
+
recordToolCall(): void {
|
|
26
|
+
this.toolCallsSinceLastCapture += 1;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Evaluates the current state against the trigger criteria.
|
|
31
|
+
*
|
|
32
|
+
* When the trigger fires, advances the session counters so the
|
|
33
|
+
* next evaluation respects rate limiting and the session cap.
|
|
34
|
+
*
|
|
35
|
+
* @returns the trigger decision with a human-readable reason
|
|
36
|
+
*/
|
|
37
|
+
evaluate(): AutoCaptureTrigger {
|
|
38
|
+
const trigger = evaluateTrigger(this.config, this.state());
|
|
39
|
+
if (trigger.shouldCapture) {
|
|
40
|
+
this.totalCapturesThisSession += 1;
|
|
41
|
+
this.lastCaptureTimestamp = Date.now();
|
|
42
|
+
this.toolCallsSinceLastCapture = 0;
|
|
43
|
+
}
|
|
44
|
+
return trigger;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Reset all counters, e.g. on client disconnect. */
|
|
48
|
+
reset(): void {
|
|
49
|
+
this.toolCallsSinceLastCapture = 0;
|
|
50
|
+
this.lastCaptureTimestamp = 0;
|
|
51
|
+
this.totalCapturesThisSession = 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Returns a snapshot of the current controller state. */
|
|
55
|
+
state(): AutoCaptureState {
|
|
56
|
+
return {
|
|
57
|
+
toolCallsSinceLastCapture: this.toolCallsSinceLastCapture,
|
|
58
|
+
lastCaptureTimestamp: this.lastCaptureTimestamp,
|
|
59
|
+
totalCapturesThisSession: this.totalCapturesThisSession,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AutoCaptureConfig } from '../typings/auto-capture-config.interface.ts';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Default configuration for the auto-capture feature.
|
|
5
|
+
*
|
|
6
|
+
* Auto-capture is disabled by default. Enable it in
|
|
7
|
+
* `worker.toml` under `[auto_capture]`.
|
|
8
|
+
*/
|
|
9
|
+
export const AUTO_CAPTURE_DEFAULTS: AutoCaptureConfig = {
|
|
10
|
+
enabled: false,
|
|
11
|
+
triggerAfterToolCalls: 5,
|
|
12
|
+
minIntervalMs: 60_000,
|
|
13
|
+
maxCapturesPerSession: 10,
|
|
14
|
+
dryRun: false,
|
|
15
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds the MCP sampling prompt for knowledge extraction.
|
|
3
|
+
*
|
|
4
|
+
* Instructs the host LLM to identify durable factual knowledge
|
|
5
|
+
* from the recent conversation context, filter out ephemeral or
|
|
6
|
+
* task-specific information, and format the result for storage
|
|
7
|
+
* following memory-protocol criteria.
|
|
8
|
+
*
|
|
9
|
+
* @param recentContext - the conversation excerpt to analyse
|
|
10
|
+
*/
|
|
11
|
+
export function buildCapturePrompt(recentContext: string): string {
|
|
12
|
+
return (
|
|
13
|
+
'Review the following conversation context and identify' +
|
|
14
|
+
' factual knowledge worth storing in the knowledge base.\n\n' +
|
|
15
|
+
'Rules:\n' +
|
|
16
|
+
'- Include durable facts, decisions, preferences, and' +
|
|
17
|
+
' corrections that would be useful in future sessions.\n' +
|
|
18
|
+
'- Exclude ephemeral, task-specific, or temporary information' +
|
|
19
|
+
' that has no lasting value.\n' +
|
|
20
|
+
'- Format each piece of extracted knowledge as a concise' +
|
|
21
|
+
' statement suitable for direct storage.\n' +
|
|
22
|
+
'- If no durable knowledge is found, respond with an empty' +
|
|
23
|
+
' list.\n\n' +
|
|
24
|
+
'Conversation context:\n' +
|
|
25
|
+
recentContext
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { AutoCaptureConfig } from '../typings/auto-capture-config.interface.ts';
|
|
2
|
+
import type { AutoCaptureState } from '../typings/auto-capture-state.interface.ts';
|
|
3
|
+
import type { AutoCaptureTrigger } from '../typings/auto-capture-trigger.interface.ts';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Evaluates whether auto-capture should fire given the current
|
|
7
|
+
* configuration and runtime state.
|
|
8
|
+
*
|
|
9
|
+
* Checks (in order): feature flag, session cap, rate limit,
|
|
10
|
+
* and tool-call count threshold. Returns the first failing
|
|
11
|
+
* condition as the reason.
|
|
12
|
+
*/
|
|
13
|
+
export function evaluateTrigger(
|
|
14
|
+
config: AutoCaptureConfig,
|
|
15
|
+
state: AutoCaptureState,
|
|
16
|
+
): AutoCaptureTrigger {
|
|
17
|
+
if (!config.enabled) {
|
|
18
|
+
return {
|
|
19
|
+
shouldCapture: false,
|
|
20
|
+
reason: 'auto-capture is disabled',
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (state.totalCapturesThisSession >= config.maxCapturesPerSession) {
|
|
25
|
+
return {
|
|
26
|
+
shouldCapture: false,
|
|
27
|
+
reason: 'session capture limit reached',
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const elapsed = state.lastCaptureTimestamp
|
|
32
|
+
? Date.now() - state.lastCaptureTimestamp
|
|
33
|
+
: Infinity;
|
|
34
|
+
|
|
35
|
+
if (elapsed < config.minIntervalMs) {
|
|
36
|
+
return {
|
|
37
|
+
shouldCapture: false,
|
|
38
|
+
reason: 'within minimum interval',
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (state.toolCallsSinceLastCapture < config.triggerAfterToolCalls) {
|
|
43
|
+
return {
|
|
44
|
+
shouldCapture: false,
|
|
45
|
+
reason: 'tool call threshold not yet reached',
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return { shouldCapture: true, reason: 'trigger threshold met' };
|
|
50
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { AutoCaptureController } from './classes/auto-capture-controller.class.ts';
|
|
2
|
+
export { AUTO_CAPTURE_DEFAULTS } from './constants/auto-capture-defaults.constant.ts';
|
|
3
|
+
export { evaluateTrigger } from './functions/evaluate-trigger.function.ts';
|
|
4
|
+
export { buildCapturePrompt } from './functions/build-capture-prompt.function.ts';
|
|
5
|
+
export type { AutoCaptureConfig } from './typings/auto-capture-config.interface.ts';
|
|
6
|
+
export type { AutoCaptureTrigger } from './typings/auto-capture-trigger.interface.ts';
|
|
7
|
+
export type { AutoCaptureState } from './typings/auto-capture-state.interface.ts';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Configuration for auto-capture behavior. */
|
|
2
|
+
export interface AutoCaptureConfig {
|
|
3
|
+
/** Enable or disable auto-capture. */
|
|
4
|
+
readonly enabled: boolean;
|
|
5
|
+
/** Trigger a capture after this many tool calls. */
|
|
6
|
+
readonly triggerAfterToolCalls: number;
|
|
7
|
+
/** Minimum time in milliseconds between captures. */
|
|
8
|
+
readonly minIntervalMs: number;
|
|
9
|
+
/** Maximum number of captures allowed per session. */
|
|
10
|
+
readonly maxCapturesPerSession: number;
|
|
11
|
+
/** Log without writing when true. */
|
|
12
|
+
readonly dryRun: boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Runtime state tracked by the auto-capture controller. */
|
|
2
|
+
export interface AutoCaptureState {
|
|
3
|
+
/** Tool calls recorded since the last successful capture. */
|
|
4
|
+
readonly toolCallsSinceLastCapture: number;
|
|
5
|
+
/**
|
|
6
|
+
* Unix epoch milliseconds of the most recent capture.
|
|
7
|
+
*
|
|
8
|
+
* Zero when no capture has occurred this session.
|
|
9
|
+
*/
|
|
10
|
+
readonly lastCaptureTimestamp: number;
|
|
11
|
+
/** Total captures completed during the current session. */
|
|
12
|
+
readonly totalCapturesThisSession: number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { VERSION } from '../../version/index.ts';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Top-level help text displayed when no command is given or when
|
|
5
|
+
* `--help` is passed without a command name.
|
|
6
|
+
*
|
|
7
|
+
* Lists all available commands grouped by category and describes
|
|
8
|
+
* global options.
|
|
9
|
+
*/
|
|
10
|
+
export const GLOBAL_HELP =
|
|
11
|
+
`kbdb v${VERSION} - File-based knowledge base` +
|
|
12
|
+
` database for AI agents\n` +
|
|
13
|
+
`\n` +
|
|
14
|
+
`Usage: kbdb [options]\n` +
|
|
15
|
+
` kbdb <command> [options] ...[parameters]\n` +
|
|
16
|
+
` kbdb <command> <subcommand> [options]` +
|
|
17
|
+
` ...[params]\n` +
|
|
18
|
+
`\n` +
|
|
19
|
+
`Knowledge Base:\n` +
|
|
20
|
+
` learn Import content from` +
|
|
21
|
+
` files/stdin\n` +
|
|
22
|
+
` unlearn Remove sections by kbid\n` +
|
|
23
|
+
` search Query the knowledge base\n` +
|
|
24
|
+
` recall Retrieve section context` +
|
|
25
|
+
` by kbid\n` +
|
|
26
|
+
` content Compose rendered content` +
|
|
27
|
+
` from ids\n` +
|
|
28
|
+
`\n` +
|
|
29
|
+
`Database:\n` +
|
|
30
|
+
` db init Initialise a new .kbdb` +
|
|
31
|
+
` directory\n` +
|
|
32
|
+
` db migrate Migrate database to current` +
|
|
33
|
+
` format\n` +
|
|
34
|
+
`\n` +
|
|
35
|
+
`Maintenance:\n` +
|
|
36
|
+
` check Verify knowledge base` +
|
|
37
|
+
` integrity\n` +
|
|
38
|
+
` gc Garbage collect unreferenced\n` +
|
|
39
|
+
` sections\n` +
|
|
40
|
+
` rebuild Reconstruct all index` +
|
|
41
|
+
` files\n` +
|
|
42
|
+
` status Show database status\n` +
|
|
43
|
+
` export Snapshot database for` +
|
|
44
|
+
` backup\n` +
|
|
45
|
+
`\n` +
|
|
46
|
+
`Skills:\n` +
|
|
47
|
+
` skill learn Create a new skill` +
|
|
48
|
+
` definition\n` +
|
|
49
|
+
` skill list List all skills\n` +
|
|
50
|
+
` skill get Retrieve a skill by name` +
|
|
51
|
+
` or kbid\n` +
|
|
52
|
+
` skill delete Remove a skill\n` +
|
|
53
|
+
`\n` +
|
|
54
|
+
`Agents:\n` +
|
|
55
|
+
` agent create Create an agent with skill` +
|
|
56
|
+
` refs\n` +
|
|
57
|
+
` agent list List all agents\n` +
|
|
58
|
+
` agent get Retrieve an agent by docid\n` +
|
|
59
|
+
` agent delete Remove an agent\n` +
|
|
60
|
+
`\n` +
|
|
61
|
+
`Server:\n` +
|
|
62
|
+
` mcp Start MCP server mode` +
|
|
63
|
+
` (stdio)\n` +
|
|
64
|
+
`\n` +
|
|
65
|
+
`Global Options:\n` +
|
|
66
|
+
` -h, --help Show this help message\n` +
|
|
67
|
+
` -v, --version Show version information\n` +
|
|
68
|
+
` --db <path> Path to .kbdb directory\n` +
|
|
69
|
+
` --format <fmt> Output format` +
|
|
70
|
+
` (json|text|mcp)\n` +
|
|
71
|
+
`\n` +
|
|
72
|
+
`Run "kbdb <command> --help" for detailed` +
|
|
73
|
+
` information.\n`;
|