@dikolab/kbdb 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +15 -0
- package/README.md +270 -0
- package/dist/chunk-QCCN7OZH.mjs +82 -0
- package/dist/chunk-QCCN7OZH.mjs.map +7 -0
- package/dist/cli.cjs +3598 -0
- package/dist/cli.cjs.map +7 -0
- package/dist/cli.mjs +3537 -0
- package/dist/cli.mjs.map +7 -0
- package/dist/kbdb-worker.cjs +1659 -0
- package/dist/kbdb-worker.cjs.map +7 -0
- package/dist/mod.cjs +538 -0
- package/dist/mod.cjs.map +7 -0
- package/dist/mod.d.ts +3 -0
- package/dist/mod.mjs +507 -0
- package/dist/mod.mjs.map +7 -0
- package/dist/src/cli.d.ts +1 -0
- package/dist/src/shared/cli/constants/defaults.constant.d.ts +11 -0
- package/dist/src/shared/cli/constants/help-text.constant.d.ts +2 -0
- package/dist/src/shared/cli/functions/dispatch-command.function.d.ts +37 -0
- package/dist/src/shared/cli/functions/ensure-db.function.d.ts +11 -0
- package/dist/src/shared/cli/functions/error-to-message.function.d.ts +7 -0
- package/dist/src/shared/cli/functions/find-db.function.d.ts +13 -0
- package/dist/src/shared/cli/functions/format-output.function.d.ts +15 -0
- package/dist/src/shared/cli/functions/generate-help.function.d.ts +31 -0
- package/dist/src/shared/cli/functions/is-stdin-tty.function.d.ts +7 -0
- package/dist/src/shared/cli/functions/parse-args.function.d.ts +25 -0
- package/dist/src/shared/cli/functions/prompt-user.function.d.ts +13 -0
- package/dist/src/shared/cli/functions/run-agent-create.function.d.ts +58 -0
- package/dist/src/shared/cli/functions/run-agent-delete.function.d.ts +32 -0
- package/dist/src/shared/cli/functions/run-agent-get.function.d.ts +46 -0
- package/dist/src/shared/cli/functions/run-agent-list.function.d.ts +45 -0
- package/dist/src/shared/cli/functions/run-check.function.d.ts +64 -0
- package/dist/src/shared/cli/functions/run-cli.function.d.ts +39 -0
- package/dist/src/shared/cli/functions/run-content.function.d.ts +40 -0
- package/dist/src/shared/cli/functions/run-db-init.function.d.ts +23 -0
- package/dist/src/shared/cli/functions/run-db-migrate.function.d.ts +32 -0
- package/dist/src/shared/cli/functions/run-gc.function.d.ts +38 -0
- package/dist/src/shared/cli/functions/run-init.function.d.ts +27 -0
- package/dist/src/shared/cli/functions/run-learn.function.d.ts +46 -0
- package/dist/src/shared/cli/functions/run-migrate.function.d.ts +57 -0
- package/dist/src/shared/cli/functions/run-rebuild.function.d.ts +40 -0
- package/dist/src/shared/cli/functions/run-search.function.d.ts +39 -0
- package/dist/src/shared/cli/functions/run-skill-delete.function.d.ts +30 -0
- package/dist/src/shared/cli/functions/run-skill-get.function.d.ts +49 -0
- package/dist/src/shared/cli/functions/run-skill-learn.function.d.ts +36 -0
- package/dist/src/shared/cli/functions/run-skill-list.function.d.ts +43 -0
- package/dist/src/shared/cli/functions/run-status.function.d.ts +22 -0
- package/dist/src/shared/cli/functions/run-unlearn.function.d.ts +45 -0
- package/dist/src/shared/cli/index.d.ts +35 -0
- package/dist/src/shared/cli/typings/cli-options.interface.d.ts +53 -0
- package/dist/src/shared/cli/typings/command-result.model.d.ts +15 -0
- package/dist/src/shared/cli/typings/learn-result.model.d.ts +11 -0
- package/dist/src/shared/cli/typings/search-display.model.d.ts +17 -0
- package/dist/src/shared/dir-resolver/functions/resolve-base-dir.function.d.ts +3 -0
- package/dist/src/shared/dir-resolver/functions/resolve-wasm-dir.function.d.ts +1 -0
- package/dist/src/shared/dir-resolver/functions/resolve-worker-script.function.d.ts +2 -0
- package/dist/src/shared/dir-resolver/index.d.ts +4 -0
- package/dist/src/shared/dir-resolver/typings/base-dir.interface.d.ts +4 -0
- package/dist/src/shared/hash/functions/compute-sha256.d.ts +10 -0
- package/dist/src/shared/hash/index.d.ts +1 -0
- package/dist/src/shared/mcp/classes/mcp-server.class.d.ts +55 -0
- package/dist/src/shared/mcp/constants/mcp-error-codes.constant.d.ts +26 -0
- package/dist/src/shared/mcp/functions/create-mcp-server.function.d.ts +11 -0
- package/dist/src/shared/mcp/functions/create-prompt-definitions.function.d.ts +41 -0
- package/dist/src/shared/mcp/functions/create-resource-templates.function.d.ts +7 -0
- package/dist/src/shared/mcp/functions/create-tool-definitions.function.d.ts +7 -0
- package/dist/src/shared/mcp/functions/extract-skill-arguments.function.d.ts +13 -0
- package/dist/src/shared/mcp/functions/handle-agent-create.function.d.ts +29 -0
- package/dist/src/shared/mcp/functions/handle-agent-delete.function.d.ts +28 -0
- package/dist/src/shared/mcp/functions/handle-agent-get.function.d.ts +29 -0
- package/dist/src/shared/mcp/functions/handle-agent-list.function.d.ts +31 -0
- package/dist/src/shared/mcp/functions/handle-completion.function.d.ts +58 -0
- package/dist/src/shared/mcp/functions/handle-prompt-get.function.d.ts +23 -0
- package/dist/src/shared/mcp/functions/handle-resource-read.function.d.ts +26 -0
- package/dist/src/shared/mcp/functions/handle-roots-list.function.d.ts +21 -0
- package/dist/src/shared/mcp/functions/handle-tool-call.function.d.ts +26 -0
- package/dist/src/shared/mcp/functions/parse-skill-content.function.d.ts +15 -0
- package/dist/src/shared/mcp/functions/serialize-skill-content.function.d.ts +9 -0
- package/dist/src/shared/mcp/functions/should-emit-log.function.d.ts +20 -0
- package/dist/src/shared/mcp/index.d.ts +9 -0
- package/dist/src/shared/mcp/typings/agent-types.interface.d.ts +38 -0
- package/dist/src/shared/mcp/typings/log-types.interface.d.ts +17 -0
- package/dist/src/shared/mcp/typings/mcp-client.interface.d.ts +217 -0
- package/dist/src/shared/mcp/typings/mcp-types.interface.d.ts +149 -0
- package/dist/src/shared/mcp/typings/prompt-types.interface.d.ts +37 -0
- package/dist/src/shared/mcp/typings/remove-section-result.model.d.ts +10 -0
- package/dist/src/shared/mcp/typings/sampling-types.interface.d.ts +46 -0
- package/dist/src/shared/mcp/typings/skill-types.interface.d.ts +28 -0
- package/dist/src/shared/mod.d.ts +1 -0
- package/dist/src/shared/platform/functions/get-ipc-path.function.d.ts +11 -0
- package/dist/src/shared/platform/functions/get-tmpdir.function.d.ts +4 -0
- package/dist/src/shared/platform/functions/is-process-alive.function.d.ts +10 -0
- package/dist/src/shared/platform/index.d.ts +3 -0
- package/dist/src/shared/runtime/functions/detect-runtime.d.ts +8 -0
- package/dist/src/shared/runtime/functions/get-args.d.ts +7 -0
- package/dist/src/shared/runtime/index.d.ts +3 -0
- package/dist/src/shared/runtime/typings/runtime.d.ts +2 -0
- package/dist/src/shared/version/constants/version.constant.d.ts +2 -0
- package/dist/src/shared/version/index.d.ts +1 -0
- package/dist/src/shared/wasm-codec/functions/decode-compose-output.function.d.ts +5 -0
- package/dist/src/shared/wasm-codec/functions/decode-document-manifest-list.function.d.ts +14 -0
- package/dist/src/shared/wasm-codec/functions/decode-document-manifest.function.d.ts +40 -0
- package/dist/src/shared/wasm-codec/functions/decode-f32.function.d.ts +2 -0
- package/dist/src/shared/wasm-codec/functions/decode-key-value-text.function.d.ts +1 -0
- package/dist/src/shared/wasm-codec/functions/decode-remove-flag.function.d.ts +1 -0
- package/dist/src/shared/wasm-codec/functions/decode-scored-results.function.d.ts +10 -0
- package/dist/src/shared/wasm-codec/functions/decode-section-record-list.function.d.ts +13 -0
- package/dist/src/shared/wasm-codec/functions/decode-section-records.function.d.ts +50 -0
- package/dist/src/shared/wasm-codec/functions/decode-string.function.d.ts +5 -0
- package/dist/src/shared/wasm-codec/functions/decode-u32.function.d.ts +2 -0
- package/dist/src/shared/wasm-codec/functions/decode-u64.function.d.ts +2 -0
- package/dist/src/shared/wasm-codec/functions/encode-add-section-params.function.d.ts +10 -0
- package/dist/src/shared/wasm-codec/functions/encode-group-params.function.d.ts +10 -0
- package/dist/src/shared/wasm-codec/functions/encode-identifier-list.function.d.ts +1 -0
- package/dist/src/shared/wasm-codec/functions/encode-kbid-list.function.d.ts +1 -0
- package/dist/src/shared/wasm-codec/functions/encode-option-string.function.d.ts +1 -0
- package/dist/src/shared/wasm-codec/functions/encode-search-params.function.d.ts +1 -0
- package/dist/src/shared/wasm-codec/functions/encode-section-type.function.d.ts +1 -0
- package/dist/src/shared/wasm-codec/functions/encode-string.function.d.ts +1 -0
- package/dist/src/shared/wasm-codec/functions/encode-type-filter-param.function.d.ts +11 -0
- package/dist/src/shared/wasm-codec/functions/encode-u32.function.d.ts +1 -0
- package/dist/src/shared/wasm-codec/functions/encode-update-section-params.function.d.ts +2 -0
- package/dist/src/shared/wasm-codec/index.d.ts +29 -0
- package/dist/src/shared/worker-client/classes/worker-client.class.d.ts +230 -0
- package/dist/src/shared/worker-client/functions/compute-context-id.function.d.ts +11 -0
- package/dist/src/shared/worker-client/functions/create-worker-client.function.d.ts +18 -0
- package/dist/src/shared/worker-client/functions/discover-daemon.function.d.ts +14 -0
- package/dist/src/shared/worker-client/functions/resolve-db-path.function.d.ts +11 -0
- package/dist/src/shared/worker-client/functions/spawn-daemon.function.d.ts +11 -0
- package/dist/src/shared/worker-client/functions/wait-for-daemon.function.d.ts +13 -0
- package/dist/src/shared/worker-client/index.d.ts +22 -0
- package/dist/src/shared/worker-client/typings/add-section-result.model.d.ts +22 -0
- package/dist/src/shared/worker-client/typings/content-result.model.d.ts +12 -0
- package/dist/src/shared/worker-client/typings/daemon-info.model.d.ts +7 -0
- package/dist/src/shared/worker-client/typings/gc-result.model.d.ts +12 -0
- package/dist/src/shared/worker-client/typings/integrity-check-result.model.d.ts +36 -0
- package/dist/src/shared/worker-client/typings/migrate-result.model.d.ts +11 -0
- package/dist/src/shared/worker-client/typings/rebuild-result.model.d.ts +12 -0
- package/dist/src/shared/worker-client/typings/remove-section-result.model.d.ts +7 -0
- package/dist/src/shared/worker-client/typings/search-params.model.d.ts +12 -0
- package/dist/src/shared/worker-client/typings/search-result.model.d.ts +14 -0
- package/dist/src/shared/worker-client/typings/section.model.d.ts +26 -0
- package/dist/src/shared/worker-client/typings/status-result.model.d.ts +14 -0
- package/dist/src/shared/worker-client/typings/version-status.model.d.ts +24 -0
- package/dist/src/shared/worker-client/typings/worker-client-error.interface.d.ts +8 -0
- package/dist/src/shared/worker-client/typings/worker-client-options.interface.d.ts +30 -0
- package/dist/src/shared/worker-daemon/classes/worker-daemon.class.d.ts +147 -0
- package/dist/src/shared/worker-daemon/constants/daemon-defaults.constant.d.ts +24 -0
- package/dist/src/shared/worker-daemon/functions/create-host-imports.function.d.ts +68 -0
- package/dist/src/shared/worker-daemon/functions/create-ipc-server.function.d.ts +18 -0
- package/dist/src/shared/worker-daemon/functions/load-wasm-modules.function.d.ts +19 -0
- package/dist/src/shared/worker-daemon/functions/read-config.function.d.ts +12 -0
- package/dist/src/shared/worker-daemon/functions/run-worker.function.d.ts +26 -0
- package/dist/src/shared/worker-daemon/functions/start-daemon.function.d.ts +13 -0
- package/dist/src/shared/worker-daemon/index.d.ts +9 -0
- package/dist/src/shared/worker-daemon/typings/daemon-config.interface.d.ts +13 -0
- package/dist/src/shared/worker-daemon/typings/ipc-handler.interface.d.ts +36 -0
- package/dist/src/shared/worker-daemon/typings/wasm-modules.interface.d.ts +7 -0
- package/dist/src/worker.d.ts +1 -0
- package/dist/vitest.config.d.ts +2 -0
- package/dist/worker.mjs +1615 -0
- package/dist/worker.mjs.map +7 -0
- package/mod.ts +17 -0
- package/package.json +85 -0
- package/src/cli.ts +62 -0
- package/src/shared/cli/constants/defaults.constant.ts +19 -0
- package/src/shared/cli/constants/help-text.constant.ts +4 -0
- package/src/shared/cli/functions/dispatch-command.function.ts +338 -0
- package/src/shared/cli/functions/ensure-db.function.ts +21 -0
- package/src/shared/cli/functions/error-to-message.function.ts +9 -0
- package/src/shared/cli/functions/find-db.function.ts +20 -0
- package/src/shared/cli/functions/format-output.function.ts +64 -0
- package/src/shared/cli/functions/generate-help.function.ts +599 -0
- package/src/shared/cli/functions/is-stdin-tty.function.ts +12 -0
- package/src/shared/cli/functions/parse-args.function.ts +133 -0
- package/src/shared/cli/functions/prompt-user.function.ts +36 -0
- package/src/shared/cli/functions/run-agent-create.function.ts +114 -0
- package/src/shared/cli/functions/run-agent-delete.function.ts +47 -0
- package/src/shared/cli/functions/run-agent-get.function.ts +166 -0
- package/src/shared/cli/functions/run-agent-list.function.ts +58 -0
- package/src/shared/cli/functions/run-check.function.ts +78 -0
- package/src/shared/cli/functions/run-cli.function.ts +299 -0
- package/src/shared/cli/functions/run-content.function.ts +47 -0
- package/src/shared/cli/functions/run-db-init.function.ts +44 -0
- package/src/shared/cli/functions/run-db-migrate.function.ts +40 -0
- package/src/shared/cli/functions/run-gc.function.ts +45 -0
- package/src/shared/cli/functions/run-init.function.ts +91 -0
- package/src/shared/cli/functions/run-learn.function.ts +171 -0
- package/src/shared/cli/functions/run-migrate.function.ts +85 -0
- package/src/shared/cli/functions/run-rebuild.function.ts +47 -0
- package/src/shared/cli/functions/run-search.function.ts +62 -0
- package/src/shared/cli/functions/run-skill-delete.function.ts +47 -0
- package/src/shared/cli/functions/run-skill-get.function.ts +90 -0
- package/src/shared/cli/functions/run-skill-learn.function.ts +70 -0
- package/src/shared/cli/functions/run-skill-list.function.ts +74 -0
- package/src/shared/cli/functions/run-status.function.ts +29 -0
- package/src/shared/cli/functions/run-unlearn.function.ts +58 -0
- package/src/shared/cli/index.ts +48 -0
- package/src/shared/cli/typings/cli-options.interface.ts +55 -0
- package/src/shared/cli/typings/command-result.model.ts +15 -0
- package/src/shared/cli/typings/learn-result.model.ts +11 -0
- package/src/shared/cli/typings/search-display.model.ts +17 -0
- package/src/shared/dir-resolver/functions/resolve-base-dir.function.ts +25 -0
- package/src/shared/dir-resolver/functions/resolve-wasm-dir.function.ts +5 -0
- package/src/shared/dir-resolver/functions/resolve-worker-script.function.ts +13 -0
- package/src/shared/dir-resolver/index.ts +7 -0
- package/src/shared/dir-resolver/typings/base-dir.interface.ts +4 -0
- package/src/shared/hash/functions/compute-sha256.ts +17 -0
- package/src/shared/hash/index.ts +1 -0
- package/src/shared/mcp/classes/mcp-server.class.ts +448 -0
- package/src/shared/mcp/constants/mcp-error-codes.constant.ts +30 -0
- package/src/shared/mcp/functions/create-mcp-server.function.ts +14 -0
- package/src/shared/mcp/functions/create-prompt-definitions.function.ts +102 -0
- package/src/shared/mcp/functions/create-resource-templates.function.ts +23 -0
- package/src/shared/mcp/functions/create-tool-definitions.function.ts +401 -0
- package/src/shared/mcp/functions/extract-skill-arguments.function.ts +27 -0
- package/src/shared/mcp/functions/handle-agent-create.function.ts +116 -0
- package/src/shared/mcp/functions/handle-agent-delete.function.ts +50 -0
- package/src/shared/mcp/functions/handle-agent-get.function.ts +160 -0
- package/src/shared/mcp/functions/handle-agent-list.function.ts +50 -0
- package/src/shared/mcp/functions/handle-completion.function.ts +114 -0
- package/src/shared/mcp/functions/handle-prompt-get.function.ts +214 -0
- package/src/shared/mcp/functions/handle-resource-read.function.ts +56 -0
- package/src/shared/mcp/functions/handle-roots-list.function.ts +29 -0
- package/src/shared/mcp/functions/handle-tool-call.function.ts +464 -0
- package/src/shared/mcp/functions/parse-skill-content.function.ts +38 -0
- package/src/shared/mcp/functions/serialize-skill-content.function.ts +12 -0
- package/src/shared/mcp/functions/should-emit-log.function.ts +38 -0
- package/src/shared/mcp/index.ts +28 -0
- package/src/shared/mcp/typings/agent-types.interface.ts +39 -0
- package/src/shared/mcp/typings/log-types.interface.ts +26 -0
- package/src/shared/mcp/typings/mcp-client.interface.ts +252 -0
- package/src/shared/mcp/typings/mcp-types.interface.ts +158 -0
- package/src/shared/mcp/typings/prompt-types.interface.ts +39 -0
- package/src/shared/mcp/typings/remove-section-result.model.ts +10 -0
- package/src/shared/mcp/typings/sampling-types.interface.ts +48 -0
- package/src/shared/mcp/typings/skill-types.interface.ts +29 -0
- package/src/shared/mod.ts +1 -0
- package/src/shared/platform/functions/get-ipc-path.function.ts +19 -0
- package/src/shared/platform/functions/get-tmpdir.function.ts +8 -0
- package/src/shared/platform/functions/is-process-alive.function.ts +17 -0
- package/src/shared/platform/index.ts +3 -0
- package/src/shared/runtime/functions/detect-runtime.ts +14 -0
- package/src/shared/runtime/functions/get-args.ts +16 -0
- package/src/shared/runtime/index.ts +3 -0
- package/src/shared/runtime/typings/runtime.ts +2 -0
- package/src/shared/version/constants/version.constant.ts +2 -0
- package/src/shared/version/index.ts +1 -0
- package/src/shared/wasm-codec/functions/decode-compose-output.function.ts +16 -0
- package/src/shared/wasm-codec/functions/decode-document-manifest-list.function.ts +70 -0
- package/src/shared/wasm-codec/functions/decode-document-manifest.function.ts +87 -0
- package/src/shared/wasm-codec/functions/decode-f32.function.ts +16 -0
- package/src/shared/wasm-codec/functions/decode-key-value-text.function.ts +15 -0
- package/src/shared/wasm-codec/functions/decode-remove-flag.function.ts +3 -0
- package/src/shared/wasm-codec/functions/decode-scored-results.function.ts +54 -0
- package/src/shared/wasm-codec/functions/decode-section-record-list.function.ts +20 -0
- package/src/shared/wasm-codec/functions/decode-section-records.function.ts +162 -0
- package/src/shared/wasm-codec/functions/decode-string.function.ts +22 -0
- package/src/shared/wasm-codec/functions/decode-u32.function.ts +16 -0
- package/src/shared/wasm-codec/functions/decode-u64.function.ts +16 -0
- package/src/shared/wasm-codec/functions/encode-add-section-params.function.ts +34 -0
- package/src/shared/wasm-codec/functions/encode-group-params.function.ts +28 -0
- package/src/shared/wasm-codec/functions/encode-identifier-list.function.ts +17 -0
- package/src/shared/wasm-codec/functions/encode-kbid-list.function.ts +17 -0
- package/src/shared/wasm-codec/functions/encode-option-string.function.ts +14 -0
- package/src/shared/wasm-codec/functions/encode-search-params.function.ts +9 -0
- package/src/shared/wasm-codec/functions/encode-section-type.function.ts +18 -0
- package/src/shared/wasm-codec/functions/encode-string.function.ts +9 -0
- package/src/shared/wasm-codec/functions/encode-type-filter-param.function.ts +13 -0
- package/src/shared/wasm-codec/functions/encode-u32.function.ts +5 -0
- package/src/shared/wasm-codec/functions/encode-update-section-params.function.ts +16 -0
- package/src/shared/wasm-codec/index.ts +36 -0
- package/src/shared/worker-client/classes/worker-client.class.ts +427 -0
- package/src/shared/worker-client/functions/compute-context-id.function.ts +18 -0
- package/src/shared/worker-client/functions/create-worker-client.function.ts +70 -0
- package/src/shared/worker-client/functions/discover-daemon.function.ts +47 -0
- package/src/shared/worker-client/functions/resolve-db-path.function.ts +21 -0
- package/src/shared/worker-client/functions/spawn-daemon.function.ts +35 -0
- package/src/shared/worker-client/functions/wait-for-daemon.function.ts +34 -0
- package/src/shared/worker-client/index.ts +31 -0
- package/src/shared/worker-client/typings/add-section-result.model.ts +22 -0
- package/src/shared/worker-client/typings/content-result.model.ts +12 -0
- package/src/shared/worker-client/typings/daemon-info.model.ts +7 -0
- package/src/shared/worker-client/typings/gc-result.model.ts +12 -0
- package/src/shared/worker-client/typings/integrity-check-result.model.ts +43 -0
- package/src/shared/worker-client/typings/migrate-result.model.ts +11 -0
- package/src/shared/worker-client/typings/rebuild-result.model.ts +12 -0
- package/src/shared/worker-client/typings/remove-section-result.model.ts +7 -0
- package/src/shared/worker-client/typings/search-params.model.ts +12 -0
- package/src/shared/worker-client/typings/search-result.model.ts +14 -0
- package/src/shared/worker-client/typings/section.model.ts +27 -0
- package/src/shared/worker-client/typings/status-result.model.ts +14 -0
- package/src/shared/worker-client/typings/version-status.model.ts +28 -0
- package/src/shared/worker-client/typings/worker-client-error.interface.ts +8 -0
- package/src/shared/worker-client/typings/worker-client-options.interface.ts +30 -0
- package/src/shared/worker-daemon/classes/worker-daemon.class.ts +1001 -0
- package/src/shared/worker-daemon/constants/daemon-defaults.constant.ts +29 -0
- package/src/shared/worker-daemon/functions/create-host-imports.function.ts +312 -0
- package/src/shared/worker-daemon/functions/create-ipc-server.function.ts +83 -0
- package/src/shared/worker-daemon/functions/load-wasm-modules.function.ts +98 -0
- package/src/shared/worker-daemon/functions/read-config.function.ts +83 -0
- package/src/shared/worker-daemon/functions/run-worker.function.ts +57 -0
- package/src/shared/worker-daemon/functions/start-daemon.function.ts +74 -0
- package/src/shared/worker-daemon/index.ts +16 -0
- package/src/shared/worker-daemon/typings/daemon-config.interface.ts +13 -0
- package/src/shared/worker-daemon/typings/ipc-handler.interface.ts +39 -0
- package/src/shared/worker-daemon/typings/wasm-modules.interface.ts +7 -0
- package/src/worker.ts +34 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import type { AddSectionResult } from '../../worker-client/typings/add-section-result.model.ts';
|
|
2
|
+
import type { RemoveSectionResult } from './remove-section-result.model.ts';
|
|
3
|
+
import type { SectionRecord } from '../../wasm-codec/functions/decode-section-records.function.ts';
|
|
4
|
+
import type { DocumentManifest } from '../../wasm-codec/functions/decode-document-manifest.function.ts';
|
|
5
|
+
/** Result returned by content composition. */
|
|
6
|
+
export interface McpContentResult {
|
|
7
|
+
/** MIME type of the composed output, always `'text/markdown'`. */
|
|
8
|
+
readonly type: 'text/markdown';
|
|
9
|
+
/** The composed Markdown string. */
|
|
10
|
+
readonly data: string;
|
|
11
|
+
/** Character count of `data` (not byte count). */
|
|
12
|
+
readonly total: number;
|
|
13
|
+
}
|
|
14
|
+
/** A single integrity error found during a database check. */
|
|
15
|
+
export interface McpIntegrityError {
|
|
16
|
+
/** The category of integrity violation detected. */
|
|
17
|
+
readonly type: 'checksum_mismatch' | 'orphan_section' | 'orphan_document' | 'broken_reference' | 'type_mismatch' | 'circular_reference';
|
|
18
|
+
/** Identifier of the entity (kbid or docid) that has the issue. */
|
|
19
|
+
readonly entity: string;
|
|
20
|
+
/** Human-readable description of the specific problem. */
|
|
21
|
+
readonly detail: string;
|
|
22
|
+
}
|
|
23
|
+
/** Integrity check report returned by the daemon. */
|
|
24
|
+
export interface McpIntegrityCheckResult {
|
|
25
|
+
/** `true` when all checks passed and no errors were found. */
|
|
26
|
+
readonly ok: boolean;
|
|
27
|
+
/** All integrity errors found; empty when `ok` is `true`. */
|
|
28
|
+
readonly errors: McpIntegrityError[];
|
|
29
|
+
/** Total number of sections examined. */
|
|
30
|
+
readonly sections_checked: number;
|
|
31
|
+
/** Total number of documents examined. */
|
|
32
|
+
readonly documents_checked: number;
|
|
33
|
+
/** Total number of marker references checked. */
|
|
34
|
+
readonly references_checked: number;
|
|
35
|
+
/** Time taken to complete the check, in milliseconds. */
|
|
36
|
+
readonly elapsed_ms: number;
|
|
37
|
+
}
|
|
38
|
+
/** Garbage collection report returned by the daemon. */
|
|
39
|
+
export interface McpGcResult {
|
|
40
|
+
/** Number of unreferenced sections removed. */
|
|
41
|
+
readonly removed_sections: number;
|
|
42
|
+
/** Total bytes freed by removing unreferenced sections. */
|
|
43
|
+
readonly removed_bytes: number;
|
|
44
|
+
/** Time taken to complete garbage collection, in milliseconds. */
|
|
45
|
+
readonly elapsed_ms: number;
|
|
46
|
+
}
|
|
47
|
+
/** Index rebuild report returned by the daemon. */
|
|
48
|
+
export interface McpRebuildResult {
|
|
49
|
+
/** Number of text and code sections that were re-indexed. */
|
|
50
|
+
readonly sections_reindexed: number;
|
|
51
|
+
/** Total number of unique terms written to the rebuilt indexes. */
|
|
52
|
+
readonly terms_indexed: number;
|
|
53
|
+
/** Time taken to complete the rebuild, in milliseconds. */
|
|
54
|
+
readonly elapsed_ms: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Interface for the worker client dependency consumed by the MCP
|
|
58
|
+
* server. Defines the knowledge-base operations the server exposes
|
|
59
|
+
* as MCP tools and resources without coupling to the concrete
|
|
60
|
+
* `WorkerClient` class.
|
|
61
|
+
*/
|
|
62
|
+
export interface McpWorkerClient {
|
|
63
|
+
/**
|
|
64
|
+
* Searches the knowledge base using the given parameters.
|
|
65
|
+
*
|
|
66
|
+
* @param params - query string and optional search options
|
|
67
|
+
* @returns ranked list of matching section summaries
|
|
68
|
+
*/
|
|
69
|
+
search(params: {
|
|
70
|
+
/** Natural language query text. */
|
|
71
|
+
readonly query: string;
|
|
72
|
+
/** Search mode: 'sections', 'documents', or 'stats'. */
|
|
73
|
+
readonly mode?: string;
|
|
74
|
+
/** Maximum number of results to return. */
|
|
75
|
+
readonly limit?: number;
|
|
76
|
+
}): Promise<{
|
|
77
|
+
/** Knowledge-base identifier of the matched section. */
|
|
78
|
+
kbid: string;
|
|
79
|
+
/** Relevance score assigned by the ranking engine. */
|
|
80
|
+
score: number;
|
|
81
|
+
/** Terms that matched within this section. */
|
|
82
|
+
readonly matches: readonly {
|
|
83
|
+
/** The matched term. */
|
|
84
|
+
readonly term: string;
|
|
85
|
+
/** Number of times the term appears in the section. */
|
|
86
|
+
readonly frequency: number;
|
|
87
|
+
}[];
|
|
88
|
+
}[]>;
|
|
89
|
+
/**
|
|
90
|
+
* Adds a new section to the knowledge base.
|
|
91
|
+
*
|
|
92
|
+
* @param params - content type, raw content, and optional metadata
|
|
93
|
+
* @returns the assigned knowledge-base identifier
|
|
94
|
+
*/
|
|
95
|
+
addSection(params: {
|
|
96
|
+
/** Semantic type label for the section content. */
|
|
97
|
+
readonly sectionType: string;
|
|
98
|
+
/** Raw text or base64-encoded content for the section. */
|
|
99
|
+
readonly content: string;
|
|
100
|
+
/** Optional section title. Required for image/* types. */
|
|
101
|
+
readonly title?: string;
|
|
102
|
+
/** Optional section description. */
|
|
103
|
+
readonly description?: string;
|
|
104
|
+
/** Optional document ID to group this section under. */
|
|
105
|
+
readonly docid?: string;
|
|
106
|
+
}): Promise<AddSectionResult>;
|
|
107
|
+
/**
|
|
108
|
+
* Removes a section from the knowledge base.
|
|
109
|
+
*
|
|
110
|
+
* @param kbid - knowledge-base identifier of the section to remove
|
|
111
|
+
* @returns removal result with `removed` flag and elapsed time
|
|
112
|
+
*/
|
|
113
|
+
removeSection(kbid: string): Promise<RemoveSectionResult>;
|
|
114
|
+
/**
|
|
115
|
+
* Retrieves one or more sections by their identifiers.
|
|
116
|
+
*
|
|
117
|
+
* @param kbids - list of knowledge-base identifiers to fetch
|
|
118
|
+
* @returns sections in the order their IDs were requested
|
|
119
|
+
*/
|
|
120
|
+
readSections(kbids: string[]): Promise<{
|
|
121
|
+
/** Knowledge-base identifier for this section. */
|
|
122
|
+
kbid: string;
|
|
123
|
+
/** Semantic type label assigned to the section. */
|
|
124
|
+
sectionType: string;
|
|
125
|
+
/** Raw text content of the section. */
|
|
126
|
+
content: string;
|
|
127
|
+
/** Byte size of the stored content. */
|
|
128
|
+
size: number;
|
|
129
|
+
}[]>;
|
|
130
|
+
/**
|
|
131
|
+
* Retrieves a full document record including its ordered sections.
|
|
132
|
+
*
|
|
133
|
+
* @param docid - identifier of the document to retrieve
|
|
134
|
+
* @returns the document record as returned by the daemon
|
|
135
|
+
*/
|
|
136
|
+
retrieveDocument(docid: string): Promise<unknown>;
|
|
137
|
+
/**
|
|
138
|
+
* Composes a rendered Markdown document from one or more kbid
|
|
139
|
+
* or docid identifiers.
|
|
140
|
+
*
|
|
141
|
+
* @param ids - list of kbid or docid identifiers (may be mixed)
|
|
142
|
+
* @returns composed Markdown result with character count
|
|
143
|
+
*/
|
|
144
|
+
content(ids: string[]): Promise<McpContentResult>;
|
|
145
|
+
/**
|
|
146
|
+
* Returns database metadata and status from the daemon.
|
|
147
|
+
*
|
|
148
|
+
* @returns document count, section count, and timing statistics
|
|
149
|
+
*/
|
|
150
|
+
dbStatus(): Promise<{
|
|
151
|
+
/** Whether the daemon has finished loading its WASM modules. */
|
|
152
|
+
initialized: boolean;
|
|
153
|
+
/** Absolute path to the context directory the daemon serves. */
|
|
154
|
+
contextPath: string;
|
|
155
|
+
/** In-memory cache statistics. */
|
|
156
|
+
cacheStats: {
|
|
157
|
+
/** Number of content entries currently cached. */
|
|
158
|
+
contentCount: number;
|
|
159
|
+
/** Number of index entries currently cached. */
|
|
160
|
+
indexCount: number;
|
|
161
|
+
};
|
|
162
|
+
}>;
|
|
163
|
+
/**
|
|
164
|
+
* Runs an integrity check on the knowledge-base database.
|
|
165
|
+
*
|
|
166
|
+
* @returns a report of all issues found; `ok` is `true` when
|
|
167
|
+
* no errors were detected
|
|
168
|
+
*/
|
|
169
|
+
integrityCheck(): Promise<McpIntegrityCheckResult>;
|
|
170
|
+
/**
|
|
171
|
+
* Removes unreferenced sections from the database.
|
|
172
|
+
*
|
|
173
|
+
* @returns a report of sections removed and bytes freed
|
|
174
|
+
*/
|
|
175
|
+
gc(): Promise<McpGcResult>;
|
|
176
|
+
/**
|
|
177
|
+
* Reconstructs all index files from section files and document
|
|
178
|
+
* manifests on disk.
|
|
179
|
+
*
|
|
180
|
+
* @returns a report of sections and terms re-indexed
|
|
181
|
+
*/
|
|
182
|
+
rebuildIndexes(): Promise<McpRebuildResult>;
|
|
183
|
+
/**
|
|
184
|
+
* Retrieves all sections whose type name matches the given string.
|
|
185
|
+
*
|
|
186
|
+
* @param sectionType - the application-level type name to filter by
|
|
187
|
+
* @returns all section records with a matching type name
|
|
188
|
+
*/
|
|
189
|
+
listByType(sectionType: string): Promise<SectionRecord[]>;
|
|
190
|
+
/**
|
|
191
|
+
* Retrieves all documents whose type name matches the given string.
|
|
192
|
+
*
|
|
193
|
+
* @param docType - the application-level document type to filter by
|
|
194
|
+
* @returns all document manifests with a matching type name
|
|
195
|
+
*/
|
|
196
|
+
listDocumentsByType(docType: string): Promise<DocumentManifest[]>;
|
|
197
|
+
/**
|
|
198
|
+
* Groups a set of sections under a named document.
|
|
199
|
+
*
|
|
200
|
+
* @param title - human-readable document title
|
|
201
|
+
* @param kbids - identifiers of the sections to group
|
|
202
|
+
* @returns the assigned document identifier
|
|
203
|
+
*/
|
|
204
|
+
groupSections(title: string, kbids: string[], docType?: string): Promise<string>;
|
|
205
|
+
/**
|
|
206
|
+
* Removes the document grouping for the given document.
|
|
207
|
+
*
|
|
208
|
+
* The sections themselves are not deleted; only the grouping
|
|
209
|
+
* record is removed.
|
|
210
|
+
*
|
|
211
|
+
* @param docid - identifier of the document grouping to remove
|
|
212
|
+
*/
|
|
213
|
+
removeGrouping(docid: string): Promise<void>;
|
|
214
|
+
/** Destroys the IPC socket and clears the connection state. */
|
|
215
|
+
disconnect(): void;
|
|
216
|
+
}
|
|
217
|
+
export type { RemoveSectionResult };
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/** A JSON-RPC 2.0 request message sent to the MCP server. */
|
|
2
|
+
export interface McpRequest {
|
|
3
|
+
/** JSON-RPC protocol version. Must always be '2.0'. */
|
|
4
|
+
readonly jsonrpc: '2.0';
|
|
5
|
+
/** Request identifier; absent for notifications. */
|
|
6
|
+
readonly id?: number | string;
|
|
7
|
+
/** RPC method name. */
|
|
8
|
+
readonly method: string;
|
|
9
|
+
/** Optional method parameters. */
|
|
10
|
+
readonly params?: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
/** A JSON-RPC 2.0 response message sent from the MCP server. */
|
|
13
|
+
export interface McpResponse {
|
|
14
|
+
/** JSON-RPC protocol version. Must always be '2.0'. */
|
|
15
|
+
readonly jsonrpc: '2.0';
|
|
16
|
+
/** Echoes the request identifier. */
|
|
17
|
+
readonly id: number | string;
|
|
18
|
+
/** Successful result payload; absent when error is set. */
|
|
19
|
+
readonly result?: unknown;
|
|
20
|
+
/** Error payload; absent when result is set. */
|
|
21
|
+
readonly error?: {
|
|
22
|
+
/** Numeric error code as defined by JSON-RPC or MCP. */
|
|
23
|
+
readonly code: number;
|
|
24
|
+
/** Human-readable error message. */
|
|
25
|
+
readonly message: string;
|
|
26
|
+
/** Optional additional error data. */
|
|
27
|
+
readonly data?: unknown;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** A JSON-RPC 2.0 notification with no expected response. */
|
|
31
|
+
export interface McpNotification {
|
|
32
|
+
/** JSON-RPC protocol version. Must always be '2.0'. */
|
|
33
|
+
readonly jsonrpc: '2.0';
|
|
34
|
+
/** Notification method name. */
|
|
35
|
+
readonly method: string;
|
|
36
|
+
/** Optional notification parameters. */
|
|
37
|
+
readonly params?: Record<string, unknown>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Optional behavioral hints for an MCP tool, used by clients to
|
|
41
|
+
* decide how to present or invoke the tool safely.
|
|
42
|
+
*/
|
|
43
|
+
export interface McpToolAnnotations {
|
|
44
|
+
/**
|
|
45
|
+
* Human-readable title for the tool, suitable for display
|
|
46
|
+
* in client UIs.
|
|
47
|
+
*/
|
|
48
|
+
readonly title?: string;
|
|
49
|
+
/**
|
|
50
|
+
* When `true`, the tool only reads data and does not modify
|
|
51
|
+
* any server-side state.
|
|
52
|
+
*/
|
|
53
|
+
readonly readOnlyHint?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* When `true`, the tool may cause data loss or irreversible
|
|
56
|
+
* changes.
|
|
57
|
+
*/
|
|
58
|
+
readonly destructiveHint?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* When `true`, calling the tool multiple times with the same
|
|
61
|
+
* arguments produces the same result with no additional side
|
|
62
|
+
* effects.
|
|
63
|
+
*/
|
|
64
|
+
readonly idempotentHint?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* When `true`, the tool may interact with systems or data
|
|
67
|
+
* outside the immediate knowledge base context.
|
|
68
|
+
*/
|
|
69
|
+
readonly openWorldHint?: boolean;
|
|
70
|
+
}
|
|
71
|
+
/** Definition of a single MCP tool exposed by the server. */
|
|
72
|
+
export interface McpToolDefinition {
|
|
73
|
+
/** Unique tool name used to invoke it. */
|
|
74
|
+
readonly name: string;
|
|
75
|
+
/** Human-readable description of what the tool does. */
|
|
76
|
+
readonly description: string;
|
|
77
|
+
/** JSON Schema object describing the tool's input parameters. */
|
|
78
|
+
readonly inputSchema: Record<string, unknown>;
|
|
79
|
+
/**
|
|
80
|
+
* Optional behavioral hints that describe how the tool
|
|
81
|
+
* interacts with state.
|
|
82
|
+
*/
|
|
83
|
+
readonly annotations?: McpToolAnnotations;
|
|
84
|
+
}
|
|
85
|
+
/** A URI template describing an MCP resource the server serves. */
|
|
86
|
+
export interface McpResourceTemplate {
|
|
87
|
+
/** RFC 6570 URI template for the resource. */
|
|
88
|
+
readonly uriTemplate: string;
|
|
89
|
+
/** Human-readable resource name. */
|
|
90
|
+
readonly name: string;
|
|
91
|
+
/** Human-readable description of the resource. */
|
|
92
|
+
readonly description: string;
|
|
93
|
+
/** Optional MIME type for the resource content. */
|
|
94
|
+
readonly mimeType?: string;
|
|
95
|
+
}
|
|
96
|
+
/** Identity information for the MCP server. */
|
|
97
|
+
export interface McpServerInfo {
|
|
98
|
+
/** Server name reported during MCP initialization. */
|
|
99
|
+
readonly name: string;
|
|
100
|
+
/** Server version string reported during MCP initialization. */
|
|
101
|
+
readonly version: string;
|
|
102
|
+
}
|
|
103
|
+
/** MCP capability flags advertised during initialization. */
|
|
104
|
+
export interface McpCapabilities {
|
|
105
|
+
/** Indicates the server supports the tools capability. */
|
|
106
|
+
readonly tools?: Record<string, unknown>;
|
|
107
|
+
/** Indicates the server supports the resources capability. */
|
|
108
|
+
readonly resources?: Record<string, unknown>;
|
|
109
|
+
/** Indicates the server supports the prompts capability. */
|
|
110
|
+
readonly prompts?: Record<string, unknown>;
|
|
111
|
+
/** Indicates the server supports the logging capability. */
|
|
112
|
+
readonly logging?: Record<string, unknown>;
|
|
113
|
+
/**
|
|
114
|
+
* Indicates the server supports the completions capability,
|
|
115
|
+
* providing argument auto-completion for prompts and resources.
|
|
116
|
+
*/
|
|
117
|
+
readonly completions?: Record<string, unknown>;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Result returned by `handleToolCall`. Successful tool responses
|
|
121
|
+
* carry `isError: true` for application-level failures rather than
|
|
122
|
+
* using JSON-RPC error responses.
|
|
123
|
+
*/
|
|
124
|
+
export interface McpToolResult {
|
|
125
|
+
/** One or more text content items describing the result. */
|
|
126
|
+
readonly content: readonly {
|
|
127
|
+
/** Content type identifier, always 'text'. */
|
|
128
|
+
readonly type: string;
|
|
129
|
+
/** Text payload of the content item. */
|
|
130
|
+
readonly text: string;
|
|
131
|
+
}[];
|
|
132
|
+
/**
|
|
133
|
+
* Set to `true` when the tool encountered an application-level
|
|
134
|
+
* error. Absent or `false` on success.
|
|
135
|
+
*/
|
|
136
|
+
readonly isError?: boolean;
|
|
137
|
+
}
|
|
138
|
+
/** Result returned by `handleResourceRead`. */
|
|
139
|
+
export interface McpResourceResult {
|
|
140
|
+
/** One or more content items for the requested resource URI. */
|
|
141
|
+
readonly contents: readonly {
|
|
142
|
+
/** The resource URI that was read. */
|
|
143
|
+
readonly uri: string;
|
|
144
|
+
/** MIME type of the content body. */
|
|
145
|
+
readonly mimeType: string;
|
|
146
|
+
/** Text body of the resource. */
|
|
147
|
+
readonly text: string;
|
|
148
|
+
}[];
|
|
149
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** A single argument definition for an MCP prompt. */
|
|
2
|
+
export interface McpPromptArgument {
|
|
3
|
+
/** Argument name used as the placeholder key. */
|
|
4
|
+
readonly name: string;
|
|
5
|
+
/** Human-readable description of the argument. */
|
|
6
|
+
readonly description?: string;
|
|
7
|
+
/** Whether the argument must be supplied at invocation time. */
|
|
8
|
+
readonly required?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** An MCP prompt entry returned by `prompts/list`. */
|
|
11
|
+
export interface McpPrompt {
|
|
12
|
+
/** Unique prompt name used to invoke it via `prompts/get`. */
|
|
13
|
+
readonly name: string;
|
|
14
|
+
/** Human-readable description of what the prompt does. */
|
|
15
|
+
readonly description?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Declared arguments the prompt accepts.
|
|
18
|
+
* Absent or empty when the prompt takes no arguments.
|
|
19
|
+
*/
|
|
20
|
+
readonly arguments?: readonly McpPromptArgument[];
|
|
21
|
+
}
|
|
22
|
+
/** A single message in an MCP prompt response. */
|
|
23
|
+
export interface McpPromptMessage {
|
|
24
|
+
/**
|
|
25
|
+
* Conversation role for this message.
|
|
26
|
+
* `'assistant'` for persona/system context, `'user'` for
|
|
27
|
+
* instructions directed at the model.
|
|
28
|
+
*/
|
|
29
|
+
readonly role: 'user' | 'assistant';
|
|
30
|
+
/** Text content of the message. */
|
|
31
|
+
readonly content: {
|
|
32
|
+
/** Content type identifier, always `'text'`. */
|
|
33
|
+
readonly type: 'text';
|
|
34
|
+
/** The text payload. */
|
|
35
|
+
readonly text: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result returned by `McpWorkerClient.removeSection`. Reports
|
|
3
|
+
* whether the section was removed and the elapsed operation time.
|
|
4
|
+
*/
|
|
5
|
+
export interface RemoveSectionResult {
|
|
6
|
+
/** `true` when the section was found and removed. */
|
|
7
|
+
readonly removed: boolean;
|
|
8
|
+
/** Elapsed time for the remove operation in milliseconds. */
|
|
9
|
+
readonly elapsed_ms: number;
|
|
10
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single message in an MCP sampling conversation, sent to or
|
|
3
|
+
* received from a language model.
|
|
4
|
+
*/
|
|
5
|
+
export interface McpSamplingMessage {
|
|
6
|
+
/** Originating role for this message. */
|
|
7
|
+
readonly role: 'user' | 'assistant';
|
|
8
|
+
/** Text content of the message. */
|
|
9
|
+
readonly content: {
|
|
10
|
+
/** Content type discriminant, always `'text'`. */
|
|
11
|
+
readonly type: 'text';
|
|
12
|
+
/** The text body of the message. */
|
|
13
|
+
readonly text: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Request sent by the MCP server to the client to sample a language
|
|
18
|
+
* model. The client is responsible for selecting the model and
|
|
19
|
+
* forwarding the request.
|
|
20
|
+
*/
|
|
21
|
+
export interface McpSamplingRequest {
|
|
22
|
+
/** Ordered list of messages forming the conversation context. */
|
|
23
|
+
readonly messages: readonly McpSamplingMessage[];
|
|
24
|
+
/**
|
|
25
|
+
* Maximum number of tokens the model should generate in its
|
|
26
|
+
* response.
|
|
27
|
+
*/
|
|
28
|
+
readonly maxTokens: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Result returned by the client after sampling a language model,
|
|
32
|
+
* containing the assistant's generated response.
|
|
33
|
+
*/
|
|
34
|
+
export interface McpSamplingResult {
|
|
35
|
+
/** Role of the response message, always `'assistant'`. */
|
|
36
|
+
readonly role: 'assistant';
|
|
37
|
+
/** Text content generated by the model. */
|
|
38
|
+
readonly content: {
|
|
39
|
+
/** Content type discriminant, always `'text'`. */
|
|
40
|
+
readonly type: 'text';
|
|
41
|
+
/** The generated text response. */
|
|
42
|
+
readonly text: string;
|
|
43
|
+
};
|
|
44
|
+
/** Identifier of the model that produced the response. */
|
|
45
|
+
readonly model: string;
|
|
46
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** A single argument definition for a skill. */
|
|
2
|
+
export interface SkillArgument {
|
|
3
|
+
/** Argument name, used as the placeholder key. */
|
|
4
|
+
readonly name: string;
|
|
5
|
+
/** The expected value type. Defaults to `'string'` when omitted. */
|
|
6
|
+
readonly type?: 'string' | 'number' | 'boolean';
|
|
7
|
+
/** Human-readable description of the argument. */
|
|
8
|
+
readonly description?: string;
|
|
9
|
+
/** Whether the argument must be supplied at invocation time. */
|
|
10
|
+
readonly required?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** A reusable AI agent capability stored in the knowledge base. */
|
|
13
|
+
export interface SkillDefinition {
|
|
14
|
+
/** Unique skill name used for lookup. */
|
|
15
|
+
readonly name: string;
|
|
16
|
+
/** Human-readable description of the skill. */
|
|
17
|
+
readonly description?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Declared arguments for the skill body template.
|
|
20
|
+
* Extracted from `{{argName}}` placeholders.
|
|
21
|
+
*/
|
|
22
|
+
readonly arguments?: readonly SkillArgument[];
|
|
23
|
+
/**
|
|
24
|
+
* Template body of the skill.
|
|
25
|
+
* May contain `{{argName}}` placeholders for variable substitution.
|
|
26
|
+
*/
|
|
27
|
+
readonly body: string;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { VERSION as version } from './version/constants/version.constant.ts';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the platform-appropriate IPC socket path for a given
|
|
3
|
+
* context identifier.
|
|
4
|
+
*
|
|
5
|
+
* On Windows, returns a named pipe path (`\\.\pipe\kbdb-<ctx>`).
|
|
6
|
+
* On POSIX systems, returns a Unix domain socket path under the
|
|
7
|
+
* system temp directory (`<tmpdir>/kbdb-<ctx>.sock`).
|
|
8
|
+
*
|
|
9
|
+
* @param ctx - unique context identifier embedded in the path
|
|
10
|
+
*/
|
|
11
|
+
export declare function getIpcPath(ctx: string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether a process with the given PID is alive.
|
|
3
|
+
*
|
|
4
|
+
* Sends signal `0` to the process, which performs a permission
|
|
5
|
+
* check without sending an actual signal. Returns `true` if the
|
|
6
|
+
* process exists and is reachable, `false` otherwise.
|
|
7
|
+
*
|
|
8
|
+
* @param pid - the process identifier to probe
|
|
9
|
+
*/
|
|
10
|
+
export declare function isProcessAlive(pid: number): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Runtime } from '../typings/runtime.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Detects the current JavaScript runtime environment.
|
|
4
|
+
*
|
|
5
|
+
* Returns `'deno'` when the global `Deno` object is present,
|
|
6
|
+
* otherwise returns `'node'`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function detectRuntime(): Runtime;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { VERSION } from './constants/version.constant.ts';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DocumentManifest, DocumentSection } from './decode-document-manifest.function.ts';
|
|
2
|
+
export type { DocumentManifest, DocumentSection };
|
|
3
|
+
/**
|
|
4
|
+
* Decodes a WASM byte slice into an array of `DocumentManifest` values.
|
|
5
|
+
*
|
|
6
|
+
* The binary format is: u32 count, followed by count × DocumentManifest
|
|
7
|
+
* entries. Each entry contains: docid (string), title (string),
|
|
8
|
+
* createdAt (u64), docType (string), section count (u32), then each
|
|
9
|
+
* section's kbid (string) and position (u32).
|
|
10
|
+
*
|
|
11
|
+
* @param bytes - raw bytes returned by `worker_list_docs_by_type`
|
|
12
|
+
* @returns decoded array of document manifests, empty when count is zero
|
|
13
|
+
*/
|
|
14
|
+
export declare function decodeDocumentManifestList(bytes: Uint8Array): DocumentManifest[];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single section reference within a document manifest.
|
|
3
|
+
*
|
|
4
|
+
* Associates a knowledge-base identifier with the section's
|
|
5
|
+
* ordinal position in the document.
|
|
6
|
+
*/
|
|
7
|
+
export interface DocumentSection {
|
|
8
|
+
/** Knowledge-base identifier of the referenced section. */
|
|
9
|
+
kbid: string;
|
|
10
|
+
/** Zero-based position of this section within its document. */
|
|
11
|
+
position: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A document manifest decoded from WASM binary output.
|
|
15
|
+
*
|
|
16
|
+
* Represents a grouped document record with its ordered list of
|
|
17
|
+
* section references as returned by `worker_retrieve_doc`.
|
|
18
|
+
*/
|
|
19
|
+
export interface DocumentManifest {
|
|
20
|
+
/** Unique document identifier. */
|
|
21
|
+
docid: string;
|
|
22
|
+
/** Human-readable document title. */
|
|
23
|
+
title: string;
|
|
24
|
+
/** Document creation timestamp as a Unix epoch value. */
|
|
25
|
+
createdAt: bigint;
|
|
26
|
+
/** Application-level type name assigned to this document. */
|
|
27
|
+
docType: string;
|
|
28
|
+
/** Ordered list of section references belonging to the document. */
|
|
29
|
+
sections: DocumentSection[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Decodes a single `DocumentManifest` from WASM binary output.
|
|
33
|
+
*
|
|
34
|
+
* Reads fields in the order: docid, title, createdAt, docType,
|
|
35
|
+
* section count, then each section's kbid and position.
|
|
36
|
+
*
|
|
37
|
+
* @param bytes - raw bytes returned by `worker_retrieve_doc`
|
|
38
|
+
* @returns the decoded document manifest
|
|
39
|
+
*/
|
|
40
|
+
export declare function decodeDocumentManifest(bytes: Uint8Array): DocumentManifest;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function decodeKeyValueText(text: string): Record<string, string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function decodeRemoveFlag(bytes: Uint8Array): boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SectionRecord } from './decode-section-records.function.ts';
|
|
2
|
+
export type { SectionRecord };
|
|
3
|
+
/**
|
|
4
|
+
* Decodes a WASM byte slice into an array of `SectionRecord` values.
|
|
5
|
+
*
|
|
6
|
+
* Thin wrapper around `decodeSectionRecords` provided as the
|
|
7
|
+
* canonical entry point for list-response decoding from WASM exports
|
|
8
|
+
* such as `worker_list_by_type`.
|
|
9
|
+
*
|
|
10
|
+
* @param bytes - raw bytes returned by a WASM section-list export
|
|
11
|
+
* @returns decoded array of section records
|
|
12
|
+
*/
|
|
13
|
+
export declare function decodeSectionRecordList(bytes: Uint8Array): SectionRecord[];
|