@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
package/README.md
CHANGED
|
@@ -6,56 +6,47 @@ required.
|
|
|
6
6
|
[GitLab](https://gitlab.com/tech-slaves/knowledge-base-db)
|
|
7
7
|
| [NPM](https://www.npmjs.com/package/@dikolab/kbdb)
|
|
8
8
|
| [JSR](https://jsr.io/@dikolab/kbdb)
|
|
9
|
-
| [License: ISC](
|
|
9
|
+
| [License: ISC](LICENSE)
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
13
|
## What is kbdb?
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
**kbdb** is a knowledge base that stores your docs
|
|
20
|
-
in a plain folder on disk. No server to install.
|
|
21
|
-
No cloud account to create. It handles indexing
|
|
22
|
-
and fast search out of the box -- just point it
|
|
23
|
-
at your files and start searching.
|
|
24
|
-
|
|
25
|
-
It runs anywhere Node.js or Deno runs. Import your
|
|
26
|
-
Markdown files, and kbdb indexes them automatically.
|
|
15
|
+
**kbdb** stores your docs in a plain folder on
|
|
16
|
+
disk and makes them searchable. No server to
|
|
17
|
+
install. No cloud account. Import your Markdown
|
|
18
|
+
files, and kbdb indexes them automatically.
|
|
27
19
|
Search returns ranked results instantly.
|
|
28
20
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
search works
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
effectively and what to store.
|
|
21
|
+
It runs anywhere Node.js or Deno runs, and also
|
|
22
|
+
works as an [MCP](https://modelcontextprotocol.io/)
|
|
23
|
+
server -- giving AI agents like Claude a searchable
|
|
24
|
+
second brain that persists between sessions.
|
|
25
|
+
|
|
26
|
+
**How search works:** kbdb searches by keywords --
|
|
27
|
+
it matches your query against indexed terms, expands
|
|
28
|
+
synonyms, and ranks results by relevance. This is
|
|
29
|
+
the default **lexical** mode: fast, works offline,
|
|
30
|
+
and gives consistent results every time.
|
|
31
|
+
|
|
32
|
+
When an exact query finds nothing, kbdb automatically
|
|
33
|
+
loosens the match so you still get the best available
|
|
34
|
+
results. Headings count for more in ranking, so
|
|
35
|
+
writing clear headings helps.
|
|
36
|
+
|
|
37
|
+
Want smarter matching? kbdb supports **hybrid search**
|
|
38
|
+
(`--algo hybrid`) that blends keyword matching with
|
|
39
|
+
AI-powered similarity. This catches results that use
|
|
40
|
+
different words for the same concept. Hybrid mode
|
|
41
|
+
needs an embedding provider -- without one, kbdb
|
|
42
|
+
sticks to keyword search.
|
|
43
|
+
|
|
44
|
+
**Knowledge stays fresh:** Re-learn a file and kbdb
|
|
45
|
+
replaces the old version automatically.
|
|
46
|
+
Near-duplicate detection warns you before content
|
|
47
|
+
drifts. Integrity checks catch contradictions.
|
|
48
|
+
Confidence scores help agents tell strong matches
|
|
49
|
+
from weak ones.
|
|
59
50
|
|
|
60
51
|
---
|
|
61
52
|
|
|
@@ -106,7 +97,7 @@ kbdb learn ./docs --db ./my-kb
|
|
|
106
97
|
Point it at a folder of Markdown files. kbdb reads
|
|
107
98
|
them, breaks them into sections, and builds a
|
|
108
99
|
search index. Add `--tags design,v2` to tag
|
|
109
|
-
sections for scoping, or `--replace` to
|
|
100
|
+
sections for scoping, or `--replace` to update
|
|
110
101
|
existing sections from the same source.
|
|
111
102
|
|
|
112
103
|
**3. Search**
|
|
@@ -115,11 +106,16 @@ existing sections from the same source.
|
|
|
115
106
|
kbdb search "how does auth work" --db ./my-kb
|
|
116
107
|
```
|
|
117
108
|
|
|
118
|
-
Results are ranked by relevance with
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
109
|
+
Results are ranked by relevance with snippets
|
|
110
|
+
showing where your terms matched. Use `--offset`
|
|
111
|
+
to page through large result sets.
|
|
112
|
+
|
|
113
|
+
To try hybrid search (keyword + AI similarity):
|
|
114
|
+
|
|
115
|
+
```sh
|
|
116
|
+
kbdb search "how does auth work" --algo hybrid \
|
|
117
|
+
--db ./my-kb
|
|
118
|
+
```
|
|
123
119
|
|
|
124
120
|
**4. Recall context**
|
|
125
121
|
|
|
@@ -140,25 +136,28 @@ referenced sections.
|
|
|
140
136
|
|
|
141
137
|
- **Import** Markdown files and other documents,
|
|
142
138
|
with tags and source tracking
|
|
143
|
-
- **
|
|
144
|
-
|
|
145
|
-
- **Search** with
|
|
146
|
-
|
|
147
|
-
- **
|
|
148
|
-
|
|
139
|
+
- **Smart updates** -- re-learning a file replaces
|
|
140
|
+
the old version instead of duplicating it
|
|
141
|
+
- **Search** with three modes: keyword (default),
|
|
142
|
+
AI similarity, or hybrid (both combined)
|
|
143
|
+
- **Auto-fallback** -- if your exact query finds
|
|
144
|
+
nothing, kbdb loosens the match automatically
|
|
149
145
|
- **Recall** sections with progressive context --
|
|
150
146
|
from a quick summary to full related content
|
|
151
|
-
- **Export
|
|
147
|
+
- **Export and sync** -- snapshot your knowledge
|
|
148
|
+
base for backup or sharing across machines
|
|
152
149
|
- **Skills** -- store reusable prompt templates
|
|
153
|
-
with
|
|
150
|
+
with fill-in-the-blank arguments
|
|
154
151
|
- **Agents** -- create AI agent profiles that
|
|
155
152
|
combine a persona with skills
|
|
156
|
-
- **
|
|
157
|
-
|
|
158
|
-
|
|
153
|
+
- **Auto-capture** -- the MCP server can
|
|
154
|
+
proactively suggest knowledge to store from
|
|
155
|
+
your conversations
|
|
156
|
+
- **Verify** database integrity and clean up
|
|
157
|
+
stale data
|
|
159
158
|
- **Rebuild** indexes if anything goes wrong
|
|
160
159
|
|
|
161
|
-
See the [CLI Reference](
|
|
160
|
+
See the [CLI Reference](docs/details/cli.md)
|
|
162
161
|
for the full command list and examples.
|
|
163
162
|
|
|
164
163
|
---
|
|
@@ -167,56 +166,22 @@ for the full command list and examples.
|
|
|
167
166
|
|
|
168
167
|
kbdb runs as an
|
|
169
168
|
[MCP](https://modelcontextprotocol.io/) server
|
|
170
|
-
with
|
|
169
|
+
with 20 tools, so AI agents can search your docs,
|
|
171
170
|
recall context progressively, export snapshots,
|
|
172
171
|
store reusable skills, and build agent profiles --
|
|
173
172
|
a second brain that persists between sessions.
|
|
174
173
|
|
|
175
|
-
###
|
|
174
|
+
### Setup
|
|
176
175
|
|
|
177
|
-
|
|
176
|
+
Add kbdb to your AI tool's MCP config. The setup
|
|
177
|
+
is the same for Claude Code, VS Code, Cursor, and
|
|
178
|
+
Claude Desktop -- just put the config in the right
|
|
179
|
+
file for your tool.
|
|
178
180
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
"command": "npx",
|
|
184
|
-
"args": [
|
|
185
|
-
"-y",
|
|
186
|
-
"@dikolab/kbdb",
|
|
187
|
-
"mcp",
|
|
188
|
-
"--db",
|
|
189
|
-
"/path/to/.kbdb"
|
|
190
|
-
]
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
### Claude for VS Code
|
|
197
|
-
|
|
198
|
-
Create `.vscode/mcp.json` in your project:
|
|
199
|
-
|
|
200
|
-
```json
|
|
201
|
-
{
|
|
202
|
-
"servers": {
|
|
203
|
-
"kbdb": {
|
|
204
|
-
"command": "npx",
|
|
205
|
-
"args": [
|
|
206
|
-
"-y",
|
|
207
|
-
"@dikolab/kbdb",
|
|
208
|
-
"mcp",
|
|
209
|
-
"--db",
|
|
210
|
-
"${workspaceFolder}/.kbdb"
|
|
211
|
-
]
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### Claude Desktop
|
|
218
|
-
|
|
219
|
-
Add to your `claude_desktop_config.json`:
|
|
181
|
+
**Claude Code** -- `.mcp.json` in your project root.
|
|
182
|
+
**VS Code / Cursor** -- `.vscode/mcp.json` in your
|
|
183
|
+
project. **Claude Desktop** --
|
|
184
|
+
`claude_desktop_config.json`.
|
|
220
185
|
|
|
221
186
|
```json
|
|
222
187
|
{
|
|
@@ -235,13 +200,18 @@ Add to your `claude_desktop_config.json`:
|
|
|
235
200
|
}
|
|
236
201
|
```
|
|
237
202
|
|
|
238
|
-
|
|
203
|
+
For VS Code / Cursor, wrap in `{"servers": ...}`
|
|
204
|
+
instead of `{"mcpServers": ...}`. Use
|
|
205
|
+
`"${workspaceFolder}/.kbdb"` for the db path.
|
|
239
206
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
207
|
+
**Deno users:** replace `npx` / `-y` /
|
|
208
|
+
`@dikolab/kbdb` with `deno` / `run` / `-A` /
|
|
209
|
+
`jsr:@dikolab/kbdb/cli`.
|
|
210
|
+
|
|
211
|
+
See the
|
|
212
|
+
[MCP Server Guide](docs/details/mcp-server.md)
|
|
213
|
+
for Deno examples, environment variable config,
|
|
214
|
+
multiple knowledge bases, and the full tool list.
|
|
245
215
|
|
|
246
216
|
---
|
|
247
217
|
|
|
@@ -265,13 +235,12 @@ const results = await client.search({
|
|
|
265
235
|
offset: 0,
|
|
266
236
|
});
|
|
267
237
|
|
|
268
|
-
// results = { items, total, offset, limit, has_more, relaxed }
|
|
269
238
|
console.log(results.items);
|
|
270
239
|
client.disconnect();
|
|
271
240
|
```
|
|
272
241
|
|
|
273
242
|
See the
|
|
274
|
-
[Library API Reference](
|
|
243
|
+
[Library API Reference](docs/details/library-api.md)
|
|
275
244
|
for the full API.
|
|
276
245
|
|
|
277
246
|
### Development Setup
|
|
@@ -292,7 +261,7 @@ A Docker setup is included with all build tools
|
|
|
292
261
|
HOST_UMASK=$(umask) docker compose run --rm dev bash
|
|
293
262
|
```
|
|
294
263
|
|
|
295
|
-
See the [Makefile](
|
|
264
|
+
See the [Makefile](Makefile) for all available
|
|
296
265
|
build targets.
|
|
297
266
|
|
|
298
267
|
### Contributing
|
|
@@ -307,17 +276,17 @@ build targets.
|
|
|
307
276
|
|
|
308
277
|
## Documentation
|
|
309
278
|
|
|
310
|
-
- [Detailed Guides](
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
- [Release Notes](
|
|
314
|
-
- [Architecture Overview](
|
|
279
|
+
- [Detailed Guides](docs/details/) -- CLI reference,
|
|
280
|
+
MCP setup, search internals, storage format,
|
|
281
|
+
library API
|
|
282
|
+
- [Release Notes](docs/release-notes/)
|
|
283
|
+
- [Architecture Overview](docs/overview.md)
|
|
315
284
|
|
|
316
285
|
---
|
|
317
286
|
|
|
318
287
|
## License
|
|
319
288
|
|
|
320
|
-
ISC License -- see [LICENSE](
|
|
289
|
+
ISC License -- see [LICENSE](LICENSE) for details.
|
|
321
290
|
|
|
322
291
|
---
|
|
323
292
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BenchSuiteResult } from '../typings/bench-suite-result.interface.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Formats benchmark results as a Markdown table.
|
|
4
|
+
*
|
|
5
|
+
* Renders a header row, a separator, and one data row per
|
|
6
|
+
* result in the suite.
|
|
7
|
+
*
|
|
8
|
+
* @param suite - completed benchmark suite to render
|
|
9
|
+
* @returns multi-line Markdown table string
|
|
10
|
+
*/
|
|
11
|
+
export declare function formatReport(suite: BenchSuiteResult): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CorpusConfig } from '../typings/corpus-config.interface.ts';
|
|
2
|
+
import type { CorpusSection } from '../typings/corpus-section.interface.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Generates a synthetic corpus of sections.
|
|
5
|
+
*
|
|
6
|
+
* Uses Zipfian word frequency distribution for realistic
|
|
7
|
+
* token patterns. Output is deterministic for the same seed.
|
|
8
|
+
*
|
|
9
|
+
* @param config - corpus generation parameters
|
|
10
|
+
* @returns array of generated corpus sections
|
|
11
|
+
*/
|
|
12
|
+
export declare function generateCorpus(config: CorpusConfig): CorpusSection[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BenchResult } from '../typings/bench-result.interface.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Measures the duration of an async operation.
|
|
4
|
+
*
|
|
5
|
+
* Runs one warmup call then measures N iterations, returning
|
|
6
|
+
* the median duration. Uses `performance.now()` for timing.
|
|
7
|
+
*
|
|
8
|
+
* @param name - label for the operation
|
|
9
|
+
* @param corpusSize - corpus size associated with this run
|
|
10
|
+
* @param operation - the function to benchmark
|
|
11
|
+
* @param iterations - number of measured iterations (default 3)
|
|
12
|
+
* @returns benchmark result with median timing
|
|
13
|
+
*/
|
|
14
|
+
export declare function measureOperation(name: string, corpusSize: number, operation: () => Promise<void> | void, iterations?: number): Promise<BenchResult>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a deterministic pseudo-random number generator
|
|
3
|
+
* using a linear congruential algorithm.
|
|
4
|
+
*
|
|
5
|
+
* Each call to the returned function advances the internal
|
|
6
|
+
* state and returns the next value in [0, 1).
|
|
7
|
+
*
|
|
8
|
+
* @param seed - initial state for the LCG sequence
|
|
9
|
+
* @returns a stateful RNG function producing values in [0, 1)
|
|
10
|
+
*/
|
|
11
|
+
export declare function seededRng(seed: number): () => number;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selects a word index using Zipfian distribution.
|
|
3
|
+
*
|
|
4
|
+
* Higher-ranked words (lower indices) appear more frequently,
|
|
5
|
+
* modeling natural language word frequencies. Uses inverse CDF
|
|
6
|
+
* approximation: `floor(vocabSize * (1 - rng()^(1/s)))` where
|
|
7
|
+
* s ≈ 1.07 maps uniform random values to rank-biased indices.
|
|
8
|
+
*
|
|
9
|
+
* @param rng - stateful random number generator in [0, 1)
|
|
10
|
+
* @param vocabSize - total vocabulary size (exclusive upper bound)
|
|
11
|
+
* @returns integer index in [0, vocabSize)
|
|
12
|
+
*/
|
|
13
|
+
export declare function zipfWord(rng: () => number, vocabSize: number): number;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type { CorpusConfig } from './typings/corpus-config.interface.ts';
|
|
2
|
+
export type { CorpusSection } from './typings/corpus-section.interface.ts';
|
|
3
|
+
export type { BenchResult } from './typings/bench-result.interface.ts';
|
|
4
|
+
export type { BenchSuiteResult } from './typings/bench-suite-result.interface.ts';
|
|
5
|
+
export { CORPUS_DEFAULTS } from './constants/corpus-defaults.constant.ts';
|
|
6
|
+
export { seededRng } from './functions/seeded-rng.function.ts';
|
|
7
|
+
export { zipfWord } from './functions/zipf-word.function.ts';
|
|
8
|
+
export { generateCorpus } from './functions/generate-corpus.function.ts';
|
|
9
|
+
export { measureOperation } from './functions/measure-operation.function.ts';
|
|
10
|
+
export { formatReport } from './functions/format-report.function.ts';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Result of a single benchmark run. */
|
|
2
|
+
export interface BenchResult {
|
|
3
|
+
/** Operation name. */
|
|
4
|
+
readonly operation: string;
|
|
5
|
+
/** Corpus size. */
|
|
6
|
+
readonly corpusSize: number;
|
|
7
|
+
/** Duration in milliseconds. */
|
|
8
|
+
readonly durationMs: number;
|
|
9
|
+
/** Operations per second. */
|
|
10
|
+
readonly opsPerSec: number;
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BenchResult } from './bench-result.interface.ts';
|
|
2
|
+
/** Results from a complete benchmark suite. */
|
|
3
|
+
export interface BenchSuiteResult {
|
|
4
|
+
/** Individual benchmark results. */
|
|
5
|
+
readonly results: BenchResult[];
|
|
6
|
+
/** Timestamp of the run. */
|
|
7
|
+
readonly timestamp: string;
|
|
8
|
+
/** System info. */
|
|
9
|
+
readonly system: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Configuration for synthetic corpus generation. */
|
|
2
|
+
export interface CorpusConfig {
|
|
3
|
+
/** Number of sections to generate. */
|
|
4
|
+
readonly count: number;
|
|
5
|
+
/** Seed for deterministic RNG. */
|
|
6
|
+
readonly seed: number;
|
|
7
|
+
/** Average tokens per section. */
|
|
8
|
+
readonly avgTokens: number;
|
|
9
|
+
/** Vocabulary size. */
|
|
10
|
+
readonly vocabSize: number;
|
|
11
|
+
}
|
package/dist/cli.cjs
CHANGED
|
@@ -125,6 +125,9 @@ function parseArgs(argv) {
|
|
|
125
125
|
parseInt(argv[++i] ?? "", 10) || 0
|
|
126
126
|
);
|
|
127
127
|
break;
|
|
128
|
+
case "--algo":
|
|
129
|
+
options.algo = argv[++i];
|
|
130
|
+
break;
|
|
128
131
|
case "--title":
|
|
129
132
|
options.title = argv[++i];
|
|
130
133
|
break;
|
|
@@ -254,7 +257,8 @@ async function runSearch(client, options) {
|
|
|
254
257
|
query,
|
|
255
258
|
mode: options.mode,
|
|
256
259
|
limit: options.limit,
|
|
257
|
-
offset: options.offset
|
|
260
|
+
offset: options.offset,
|
|
261
|
+
algo: options.algo
|
|
258
262
|
});
|
|
259
263
|
return {
|
|
260
264
|
items: results.items.map((r) => ({
|
|
@@ -2447,6 +2451,11 @@ function createToolDefinitions() {
|
|
|
2447
2451
|
offset: {
|
|
2448
2452
|
type: "number",
|
|
2449
2453
|
description: "Number of results to skip for pagination (default: 0)"
|
|
2454
|
+
},
|
|
2455
|
+
algo: {
|
|
2456
|
+
type: "string",
|
|
2457
|
+
enum: ["lexical", "vector", "hybrid"],
|
|
2458
|
+
description: "Search algorithm (default: lexical)"
|
|
2450
2459
|
}
|
|
2451
2460
|
},
|
|
2452
2461
|
required: ["query"]
|
|
@@ -2860,6 +2869,27 @@ function createToolDefinitions() {
|
|
|
2860
2869
|
idempotentHint: true,
|
|
2861
2870
|
openWorldHint: false
|
|
2862
2871
|
}
|
|
2872
|
+
},
|
|
2873
|
+
{
|
|
2874
|
+
name: "auto-capture-review",
|
|
2875
|
+
description: "Review and approve pending auto-captured knowledge before storage.",
|
|
2876
|
+
inputSchema: {
|
|
2877
|
+
type: "object",
|
|
2878
|
+
properties: {
|
|
2879
|
+
action: {
|
|
2880
|
+
type: "string",
|
|
2881
|
+
enum: ["list", "approve", "reject"],
|
|
2882
|
+
description: "Action to perform on pending captures"
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
},
|
|
2886
|
+
annotations: {
|
|
2887
|
+
title: "Auto-Capture Review",
|
|
2888
|
+
readOnlyHint: false,
|
|
2889
|
+
destructiveHint: false,
|
|
2890
|
+
idempotentHint: true,
|
|
2891
|
+
openWorldHint: false
|
|
2892
|
+
}
|
|
2863
2893
|
}
|
|
2864
2894
|
];
|
|
2865
2895
|
}
|
|
@@ -2933,7 +2963,7 @@ async function handleAgentCreate(client, args) {
|
|
|
2933
2963
|
description
|
|
2934
2964
|
});
|
|
2935
2965
|
const allKbids = [metaResult.kbid, ...skills];
|
|
2936
|
-
const docid = await client.groupSections(name, allKbids);
|
|
2966
|
+
const docid = await client.groupSections(name, allKbids, "agent");
|
|
2937
2967
|
return {
|
|
2938
2968
|
content: [
|
|
2939
2969
|
{
|
|
@@ -3146,6 +3176,8 @@ async function handleToolCall(client, name, args) {
|
|
|
3146
3176
|
return await handleAgentGet(client, args);
|
|
3147
3177
|
case "agent-delete":
|
|
3148
3178
|
return await handleAgentDelete(client, args);
|
|
3179
|
+
case "auto-capture-review":
|
|
3180
|
+
return handleAutoCaptureReview();
|
|
3149
3181
|
default:
|
|
3150
3182
|
return {
|
|
3151
3183
|
content: [
|
|
@@ -3174,7 +3206,8 @@ async function handleSearch2(client, args) {
|
|
|
3174
3206
|
query: asString2(args["query"], ""),
|
|
3175
3207
|
mode: args["mode"],
|
|
3176
3208
|
limit: args["limit"],
|
|
3177
|
-
offset: args["offset"]
|
|
3209
|
+
offset: args["offset"],
|
|
3210
|
+
algo: args["algo"]
|
|
3178
3211
|
});
|
|
3179
3212
|
const stripped = {
|
|
3180
3213
|
...results,
|
|
@@ -3230,7 +3263,8 @@ async function handleLearn2(client, args) {
|
|
|
3230
3263
|
warnings: result.warnings ?? [],
|
|
3231
3264
|
near_duplicates: (result.near_duplicates ?? []).map((d) => ({
|
|
3232
3265
|
kbid: d.kbid,
|
|
3233
|
-
similarity: d.similarity
|
|
3266
|
+
similarity: d.similarity,
|
|
3267
|
+
...d.method !== void 0 ? { method: d.method } : {}
|
|
3234
3268
|
}))
|
|
3235
3269
|
};
|
|
3236
3270
|
return {
|
|
@@ -3478,6 +3512,19 @@ async function handleSkillDelete(client, args) {
|
|
|
3478
3512
|
]
|
|
3479
3513
|
};
|
|
3480
3514
|
}
|
|
3515
|
+
function handleAutoCaptureReview() {
|
|
3516
|
+
return {
|
|
3517
|
+
content: [
|
|
3518
|
+
{
|
|
3519
|
+
type: "text",
|
|
3520
|
+
text: JSON.stringify({
|
|
3521
|
+
pending: [],
|
|
3522
|
+
message: "No pending auto-captured knowledge entries."
|
|
3523
|
+
})
|
|
3524
|
+
}
|
|
3525
|
+
]
|
|
3526
|
+
};
|
|
3527
|
+
}
|
|
3481
3528
|
async function handleExport2(client, args) {
|
|
3482
3529
|
const path = typeof args["path"] === "string" ? args["path"] : void 0;
|
|
3483
3530
|
const result = await client.export(
|
|
@@ -3588,8 +3635,12 @@ function buildSkillsText(skillSections) {
|
|
|
3588
3635
|
${lines.join("\n")}`;
|
|
3589
3636
|
}
|
|
3590
3637
|
async function handleAgentPrompt(name, client) {
|
|
3591
|
-
const
|
|
3592
|
-
const
|
|
3638
|
+
const agentName = name.slice(6);
|
|
3639
|
+
const agents = await client.listDocumentsByType("agent");
|
|
3640
|
+
const doc = agents.find((a) => a.title === agentName);
|
|
3641
|
+
if (!doc) {
|
|
3642
|
+
throw new Error("agent not found: " + agentName);
|
|
3643
|
+
}
|
|
3593
3644
|
const sections = doc.sections;
|
|
3594
3645
|
const metaSection = sections.at(0);
|
|
3595
3646
|
const skillRefs = sections.slice(1);
|
|
@@ -3747,13 +3798,16 @@ var McpServer = class {
|
|
|
3747
3798
|
input: process.stdin,
|
|
3748
3799
|
terminal: false
|
|
3749
3800
|
});
|
|
3801
|
+
let pending = Promise.resolve();
|
|
3750
3802
|
await new Promise((resolve4) => {
|
|
3751
3803
|
rl.on("line", (line) => {
|
|
3752
|
-
|
|
3804
|
+
pending = pending.then(() => this.dispatchLine(line));
|
|
3753
3805
|
});
|
|
3754
3806
|
rl.on("close", () => {
|
|
3755
|
-
|
|
3756
|
-
|
|
3807
|
+
void pending.then(() => {
|
|
3808
|
+
this.client.disconnect();
|
|
3809
|
+
resolve4();
|
|
3810
|
+
});
|
|
3757
3811
|
});
|
|
3758
3812
|
});
|
|
3759
3813
|
}
|