@dikolab/kbdb 0.3.2 → 0.4.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.
Files changed (466) hide show
  1. package/README.md +83 -89
  2. package/dist/chunk-BJPSPNGX.mjs +223 -0
  3. package/dist/chunk-BJPSPNGX.mjs.map +7 -0
  4. package/dist/cli.cjs +956 -319
  5. package/dist/cli.cjs.map +4 -4
  6. package/dist/cli.d.ts +9 -0
  7. package/dist/cli.mjs +840 -321
  8. package/dist/cli.mjs.map +4 -4
  9. package/dist/kbdb-worker.cjs +714 -94
  10. package/dist/kbdb-worker.cjs.map +4 -4
  11. package/dist/mod.cjs +122 -16
  12. package/dist/mod.cjs.map +3 -3
  13. package/dist/mod.d.ts +23 -2
  14. package/dist/mod.mjs +121 -16
  15. package/dist/mod.mjs.map +3 -3
  16. package/dist/src/shared/cli/functions/dispatch-command.function.d.ts +2 -1
  17. package/dist/src/shared/cli/functions/find-db.function.d.ts +7 -8
  18. package/dist/src/shared/cli/functions/handle-mcp.function.d.ts +1 -1
  19. package/dist/src/shared/cli/functions/parse-args.function.d.ts +4 -3
  20. package/dist/src/shared/cli/functions/resolve-kbid-prefix.function.d.ts +27 -0
  21. package/dist/src/shared/cli/functions/resolve-raw-db-path.function.d.ts +10 -0
  22. package/dist/src/shared/cli/functions/run-cli.function.d.ts +3 -1
  23. package/dist/src/shared/cli/functions/run-content.function.d.ts +8 -3
  24. package/dist/src/shared/cli/functions/run-import.function.d.ts +27 -0
  25. package/dist/src/shared/cli/functions/run-recall.function.d.ts +10 -4
  26. package/dist/src/shared/cli/functions/run-search.function.d.ts +7 -0
  27. package/dist/src/shared/cli/functions/run-unlearn.function.d.ts +9 -4
  28. package/dist/src/shared/cli/functions/run-worker-restart.function.d.ts +11 -0
  29. package/dist/src/shared/cli/functions/run-worker-stop.function.d.ts +11 -0
  30. package/dist/src/shared/cli/index.d.ts +2 -0
  31. package/dist/src/shared/cli/typings/cli-deps.interface.d.ts +4 -1
  32. package/dist/src/shared/cli/typings/cli-options.interface.d.ts +17 -0
  33. package/dist/src/shared/cli/typings/dispatch-client.type.d.ts +2 -1
  34. package/dist/src/shared/cli/typings/search-display.model.d.ts +6 -0
  35. package/dist/src/shared/embedding/classes/api-embedding-provider.class.d.ts +33 -0
  36. package/dist/src/shared/embedding/classes/onnx-embedding-provider.class.d.ts +33 -0
  37. package/dist/src/shared/embedding/functions/append-vector-entry.function.d.ts +14 -0
  38. package/dist/src/shared/embedding/functions/create-embedding-provider.function.d.ts +12 -0
  39. package/dist/src/shared/embedding/functions/detect-stale-vectors.function.d.ts +16 -0
  40. package/dist/src/shared/embedding/functions/parse-api-embedding-response.function.d.ts +11 -0
  41. package/dist/src/shared/embedding/functions/rebuild-vectors.function.d.ts +15 -0
  42. package/dist/src/shared/embedding/functions/scan-semantic-contradictions.function.d.ts +13 -0
  43. package/dist/src/shared/embedding/index.d.ts +7 -0
  44. package/dist/src/shared/embedding/typings/semantic-contradiction.model.d.ts +21 -0
  45. package/dist/src/shared/embedding/typings/stale-vectors-report.model.d.ts +16 -0
  46. package/dist/src/shared/mcp/classes/mcp-server.class.d.ts +22 -2
  47. package/dist/src/shared/mcp/functions/create-mcp-server.function.d.ts +6 -1
  48. package/dist/src/shared/mcp/functions/has-sampling-capability.function.d.ts +8 -0
  49. package/dist/src/shared/mcp/functions/run-auto-capture.function.d.ts +26 -0
  50. package/dist/src/shared/mcp/typings/mcp-client.interface.d.ts +2 -0
  51. package/dist/src/shared/mcp/typings/mcp-integrity-check-result.model.d.ts +24 -0
  52. package/dist/src/shared/mcp/typings/mcp-worker-client.interface.d.ts +3 -1
  53. package/dist/src/shared/version/constants/version.constant.d.ts +1 -1
  54. package/dist/src/shared/wasm-codec/typings/paged-search-result.model.d.ts +2 -0
  55. package/dist/src/shared/worker-client/classes/worker-client.class.d.ts +31 -1
  56. package/dist/src/shared/worker-client/constants/request-timeout.constant.d.ts +2 -0
  57. package/dist/src/shared/worker-client/constants/retry-defaults.constant.d.ts +2 -0
  58. package/dist/src/shared/worker-client/functions/get-or-create-client.function.d.ts +20 -0
  59. package/dist/src/shared/worker-client/functions/retry-on-timeout.function.d.ts +17 -0
  60. package/dist/src/shared/worker-client/index.d.ts +4 -1
  61. package/dist/src/shared/worker-client/typings/import-result.model.d.ts +16 -0
  62. package/dist/src/shared/worker-client/typings/integrity-check-result.model.d.ts +24 -0
  63. package/dist/src/shared/worker-client/typings/search-params.model.d.ts +4 -0
  64. package/dist/src/shared/worker-client/typings/search-result.model.d.ts +6 -0
  65. package/dist/src/shared/worker-client/typings/worker-client-options.interface.d.ts +7 -0
  66. package/dist/src/shared/worker-daemon/classes/worker-daemon.class.d.ts +5 -0
  67. package/dist/src/shared/worker-daemon/functions/create-ipc-server.function.d.ts +11 -11
  68. package/dist/src/shared/worker-daemon/functions/embed-after-learn.function.d.ts +13 -0
  69. package/dist/src/shared/worker-daemon/functions/handle-hybrid-search.function.d.ts +44 -0
  70. package/dist/src/shared/worker-daemon/functions/handle-import.function.d.ts +14 -0
  71. package/dist/src/shared/worker-daemon/functions/handle-read-ops.function.d.ts +7 -1
  72. package/dist/src/shared/worker-daemon/functions/handle-write-ops.function.d.ts +9 -4
  73. package/dist/src/shared/worker-daemon/typings/handler-context.interface.d.ts +3 -0
  74. package/dist/wasm/fs-database/kbdb_fs_database.d.ts +16 -85
  75. package/dist/wasm/fs-database/kbdb_fs_database.js +16 -85
  76. package/dist/wasm/fs-database/kbdb_fs_database_bg.wasm +0 -0
  77. package/dist/wasm/kb-worker/kbdb_worker.d.ts +20 -115
  78. package/dist/wasm/kb-worker/kbdb_worker.js +20 -115
  79. package/dist/wasm/kb-worker/kbdb_worker_bg.wasm +0 -0
  80. package/dist/wasm/query-parser/kbdb_query_parser_bg.wasm +0 -0
  81. package/dist/worker.d.ts +8 -0
  82. package/dist/worker.mjs +606 -102
  83. package/dist/worker.mjs.map +4 -4
  84. package/docs/details/README.md +4 -0
  85. package/docs/details/agent-tooling.md +122 -0
  86. package/docs/details/cli.md +70 -13
  87. package/docs/details/knowledge-base.md +173 -0
  88. package/docs/details/library-api.md +42 -2
  89. package/docs/details/mcp-server.md +38 -7
  90. package/docs/details/search-and-ranking.md +11 -10
  91. package/docs/goals/cli.md +110 -34
  92. package/docs/goals/mcp.md +22 -19
  93. package/docs/goals/query-parser.md +8 -0
  94. package/docs/goals/worker-client.md +62 -1
  95. package/docs/goals/worker-daemon.md +52 -10
  96. package/docs/modules/typescript/cli.md +1 -1
  97. package/docs/modules/typescript/shared/cli/functions.md +116 -13
  98. package/docs/modules/typescript/shared/cli/module.md +33 -20
  99. package/docs/modules/typescript/shared/cli/typings.md +4 -0
  100. package/docs/modules/typescript/shared/embedding/functions.md +104 -25
  101. package/docs/modules/typescript/shared/mcp/module.md +1 -1
  102. package/docs/modules/typescript/shared/mcp/typings.md +8 -1
  103. package/docs/modules/typescript/shared/worker-client/module.md +9 -1
  104. package/docs/modules/typescript/shared/worker-client/typings.md +3 -0
  105. package/docs/modules/typescript/shared/worker-daemon/module.md +6 -3
  106. package/docs/overview.md +1 -2
  107. package/docs/release-notes/0.4.0.md +80 -0
  108. package/docs/release-notes/README.md +1 -0
  109. package/mod.ts +33 -15
  110. package/package.json +11 -10
  111. package/dist/chunk-JG2UCKLI.mjs +0 -95
  112. package/dist/chunk-JG2UCKLI.mjs.map +0 -7
  113. package/src/cli.ts +0 -71
  114. package/src/shared/auto-capture/classes/auto-capture-controller.class.ts +0 -62
  115. package/src/shared/auto-capture/constants/auto-capture-defaults.constant.ts +0 -15
  116. package/src/shared/auto-capture/functions/build-capture-prompt.function.ts +0 -27
  117. package/src/shared/auto-capture/functions/evaluate-trigger.function.ts +0 -50
  118. package/src/shared/auto-capture/index.ts +0 -7
  119. package/src/shared/auto-capture/typings/auto-capture-config.interface.ts +0 -13
  120. package/src/shared/auto-capture/typings/auto-capture-state.interface.ts +0 -13
  121. package/src/shared/auto-capture/typings/auto-capture-trigger.interface.ts +0 -7
  122. package/src/shared/cli/constants/defaults.constant.ts +0 -19
  123. package/src/shared/cli/constants/global-help.constant.ts +0 -73
  124. package/src/shared/cli/constants/help-text.constant.ts +0 -4
  125. package/src/shared/cli/constants/leaf-help.constant.ts +0 -219
  126. package/src/shared/cli/constants/memory-protocol-body.constant.ts +0 -39
  127. package/src/shared/cli/constants/query-guidance-body.constant.ts +0 -37
  128. package/src/shared/cli/constants/subcommand-help.constant.ts +0 -195
  129. package/src/shared/cli/functions/collect-files.function.ts +0 -55
  130. package/src/shared/cli/functions/compute-section-kbid.function.ts +0 -49
  131. package/src/shared/cli/functions/dispatch-command.function.ts +0 -390
  132. package/src/shared/cli/functions/ensure-db.function.ts +0 -21
  133. package/src/shared/cli/functions/error-to-message.function.ts +0 -9
  134. package/src/shared/cli/functions/find-db.function.ts +0 -20
  135. package/src/shared/cli/functions/format-mcp-output.function.ts +0 -41
  136. package/src/shared/cli/functions/format-output.function.ts +0 -95
  137. package/src/shared/cli/functions/format-text-output.function.ts +0 -42
  138. package/src/shared/cli/functions/generate-group-help.function.ts +0 -41
  139. package/src/shared/cli/functions/generate-help.function.ts +0 -654
  140. package/src/shared/cli/functions/handle-data-command.function.ts +0 -67
  141. package/src/shared/cli/functions/handle-mcp.function.ts +0 -56
  142. package/src/shared/cli/functions/handle-migrate.function.ts +0 -64
  143. package/src/shared/cli/functions/hydrate-search-previews.function.ts +0 -29
  144. package/src/shared/cli/functions/install-default-skills.function.ts +0 -296
  145. package/src/shared/cli/functions/is-stdin-tty.function.ts +0 -12
  146. package/src/shared/cli/functions/parse-args.function.ts +0 -156
  147. package/src/shared/cli/functions/prompt-user.function.ts +0 -36
  148. package/src/shared/cli/functions/resolve-skill-names.function.ts +0 -43
  149. package/src/shared/cli/functions/run-agent-create.function.ts +0 -114
  150. package/src/shared/cli/functions/run-agent-delete.function.ts +0 -47
  151. package/src/shared/cli/functions/run-agent-get.function.ts +0 -166
  152. package/src/shared/cli/functions/run-agent-list.function.ts +0 -58
  153. package/src/shared/cli/functions/run-check.function.ts +0 -159
  154. package/src/shared/cli/functions/run-cli.function.ts +0 -299
  155. package/src/shared/cli/functions/run-content.function.ts +0 -47
  156. package/src/shared/cli/functions/run-db-init.function.ts +0 -44
  157. package/src/shared/cli/functions/run-db-migrate.function.ts +0 -40
  158. package/src/shared/cli/functions/run-export.function.ts +0 -40
  159. package/src/shared/cli/functions/run-gc.function.ts +0 -51
  160. package/src/shared/cli/functions/run-init.function.ts +0 -93
  161. package/src/shared/cli/functions/run-learn.function.ts +0 -223
  162. package/src/shared/cli/functions/run-migrate.function.ts +0 -85
  163. package/src/shared/cli/functions/run-rebuild.function.ts +0 -47
  164. package/src/shared/cli/functions/run-recall.function.ts +0 -66
  165. package/src/shared/cli/functions/run-search.function.ts +0 -133
  166. package/src/shared/cli/functions/run-skill-delete.function.ts +0 -47
  167. package/src/shared/cli/functions/run-skill-get.function.ts +0 -90
  168. package/src/shared/cli/functions/run-skill-learn.function.ts +0 -70
  169. package/src/shared/cli/functions/run-skill-list.function.ts +0 -74
  170. package/src/shared/cli/functions/run-status.function.ts +0 -29
  171. package/src/shared/cli/functions/run-unlearn.function.ts +0 -58
  172. package/src/shared/cli/functions/version-gate.function.ts +0 -44
  173. package/src/shared/cli/functions/wrap-command.function.ts +0 -34
  174. package/src/shared/cli/index.ts +0 -55
  175. package/src/shared/cli/typings/agent-create-client.interface.ts +0 -47
  176. package/src/shared/cli/typings/agent-get-client.interface.ts +0 -39
  177. package/src/shared/cli/typings/check-client.interface.ts +0 -66
  178. package/src/shared/cli/typings/cli-deps.interface.ts +0 -54
  179. package/src/shared/cli/typings/cli-options.interface.ts +0 -72
  180. package/src/shared/cli/typings/command-result.model.ts +0 -15
  181. package/src/shared/cli/typings/disconnectable-client.interface.ts +0 -29
  182. package/src/shared/cli/typings/dispatch-client.type.ts +0 -46
  183. package/src/shared/cli/typings/learn-client.interface.ts +0 -53
  184. package/src/shared/cli/typings/learn-io.interface.ts +0 -5
  185. package/src/shared/cli/typings/learn-result.model.ts +0 -27
  186. package/src/shared/cli/typings/search-client.interface.ts +0 -73
  187. package/src/shared/cli/typings/search-display.model.ts +0 -54
  188. package/src/shared/dir-resolver/functions/join-path.function.ts +0 -13
  189. package/src/shared/dir-resolver/functions/resolve-base-dir.function.ts +0 -25
  190. package/src/shared/dir-resolver/functions/resolve-wasm-dir.function.ts +0 -5
  191. package/src/shared/dir-resolver/functions/resolve-worker-script.function.ts +0 -13
  192. package/src/shared/dir-resolver/index.ts +0 -11
  193. package/src/shared/dir-resolver/typings/base-dir.interface.ts +0 -4
  194. package/src/shared/embedding/classes/null-embedding-provider.class.ts +0 -29
  195. package/src/shared/embedding/constants/near-duplicate-thresholds.constant.ts +0 -17
  196. package/src/shared/embedding/functions/build-vector-index.function.ts +0 -79
  197. package/src/shared/embedding/functions/cosine-similarity.function.ts +0 -31
  198. package/src/shared/embedding/functions/detect-near-duplicates.function.ts +0 -69
  199. package/src/shared/embedding/functions/jaccard-coefficient.function.ts +0 -26
  200. package/src/shared/embedding/functions/read-vector-index-meta.function.ts +0 -44
  201. package/src/shared/embedding/functions/rrf-fuse.function.ts +0 -33
  202. package/src/shared/embedding/functions/search-vectors.function.ts +0 -59
  203. package/src/shared/embedding/index.ts +0 -20
  204. package/src/shared/embedding/typings/embedding-config.interface.ts +0 -23
  205. package/src/shared/embedding/typings/embedding-provider.interface.ts +0 -25
  206. package/src/shared/embedding/typings/near-duplicate-candidate.model.ts +0 -25
  207. package/src/shared/embedding/typings/near-duplicate-result.model.ts +0 -26
  208. package/src/shared/embedding/typings/vector-index-entry.model.ts +0 -13
  209. package/src/shared/embedding/typings/vector-index-meta.model.ts +0 -14
  210. package/src/shared/embedding/typings/vector-search-result.model.ts +0 -8
  211. package/src/shared/hash/functions/compute-sha256.ts +0 -17
  212. package/src/shared/hash/index.ts +0 -1
  213. package/src/shared/mcp/classes/mcp-server.class.ts +0 -480
  214. package/src/shared/mcp/constants/mcp-error-codes.constant.ts +0 -30
  215. package/src/shared/mcp/constants/tool-agent-create.constant.ts +0 -39
  216. package/src/shared/mcp/constants/tool-agent-delete.constant.ts +0 -26
  217. package/src/shared/mcp/constants/tool-agent-get.constant.ts +0 -24
  218. package/src/shared/mcp/constants/tool-agent-list.constant.ts +0 -18
  219. package/src/shared/mcp/constants/tool-auto-capture-review.constant.ts +0 -32
  220. package/src/shared/mcp/constants/tool-check.constant.ts +0 -21
  221. package/src/shared/mcp/constants/tool-content.constant.ts +0 -29
  222. package/src/shared/mcp/constants/tool-export.constant.ts +0 -27
  223. package/src/shared/mcp/constants/tool-gc.constant.ts +0 -21
  224. package/src/shared/mcp/constants/tool-learn.constant.ts +0 -58
  225. package/src/shared/mcp/constants/tool-rebuild.constant.ts +0 -21
  226. package/src/shared/mcp/constants/tool-recall.constant.ts +0 -36
  227. package/src/shared/mcp/constants/tool-retrieve.constant.ts +0 -31
  228. package/src/shared/mcp/constants/tool-search.constant.ts +0 -51
  229. package/src/shared/mcp/constants/tool-skill-delete.constant.ts +0 -24
  230. package/src/shared/mcp/constants/tool-skill-get.constant.ts +0 -27
  231. package/src/shared/mcp/constants/tool-skill-learn.constant.ts +0 -37
  232. package/src/shared/mcp/constants/tool-skill-list.constant.ts +0 -18
  233. package/src/shared/mcp/constants/tool-status.constant.ts +0 -20
  234. package/src/shared/mcp/constants/tool-unlearn.constant.ts +0 -25
  235. package/src/shared/mcp/functions/as-boolean-or-undefined.function.ts +0 -11
  236. package/src/shared/mcp/functions/as-string-array-or-undefined.function.ts +0 -17
  237. package/src/shared/mcp/functions/as-string-array.function.ts +0 -15
  238. package/src/shared/mcp/functions/as-string.function.ts +0 -10
  239. package/src/shared/mcp/functions/build-skills-text.function.ts +0 -43
  240. package/src/shared/mcp/functions/create-mcp-server.function.ts +0 -14
  241. package/src/shared/mcp/functions/create-prompt-definitions.function.ts +0 -102
  242. package/src/shared/mcp/functions/create-resource-templates.function.ts +0 -23
  243. package/src/shared/mcp/functions/create-tool-definitions.function.ts +0 -530
  244. package/src/shared/mcp/functions/extract-skill-arguments.function.ts +0 -27
  245. package/src/shared/mcp/functions/handle-agent-create.function.ts +0 -116
  246. package/src/shared/mcp/functions/handle-agent-delete.function.ts +0 -50
  247. package/src/shared/mcp/functions/handle-agent-get.function.ts +0 -160
  248. package/src/shared/mcp/functions/handle-agent-list.function.ts +0 -50
  249. package/src/shared/mcp/functions/handle-agent-prompt.function.ts +0 -68
  250. package/src/shared/mcp/functions/handle-completion.function.ts +0 -114
  251. package/src/shared/mcp/functions/handle-mcp-request.function.ts +0 -202
  252. package/src/shared/mcp/functions/handle-prompt-get.function.ts +0 -220
  253. package/src/shared/mcp/functions/handle-recall.function.ts +0 -66
  254. package/src/shared/mcp/functions/handle-resource-read.function.ts +0 -56
  255. package/src/shared/mcp/functions/handle-roots-list.function.ts +0 -29
  256. package/src/shared/mcp/functions/handle-skill-prompt.function.ts +0 -44
  257. package/src/shared/mcp/functions/handle-tool-auto-capture-review.function.ts +0 -24
  258. package/src/shared/mcp/functions/handle-tool-call.function.ts +0 -560
  259. package/src/shared/mcp/functions/handle-tool-check.function.ts +0 -21
  260. package/src/shared/mcp/functions/handle-tool-content.function.ts +0 -23
  261. package/src/shared/mcp/functions/handle-tool-export.function.ts +0 -25
  262. package/src/shared/mcp/functions/handle-tool-gc.function.ts +0 -21
  263. package/src/shared/mcp/functions/handle-tool-learn.function.ts +0 -69
  264. package/src/shared/mcp/functions/handle-tool-rebuild.function.ts +0 -21
  265. package/src/shared/mcp/functions/handle-tool-retrieve.function.ts +0 -40
  266. package/src/shared/mcp/functions/handle-tool-search.function.ts +0 -47
  267. package/src/shared/mcp/functions/handle-tool-skill-delete.function.ts +0 -34
  268. package/src/shared/mcp/functions/handle-tool-skill-get.function.ts +0 -59
  269. package/src/shared/mcp/functions/handle-tool-skill-learn.function.ts +0 -61
  270. package/src/shared/mcp/functions/handle-tool-skill-list.function.ts +0 -39
  271. package/src/shared/mcp/functions/handle-tool-status.function.ts +0 -21
  272. package/src/shared/mcp/functions/handle-tool-unlearn.function.ts +0 -24
  273. package/src/shared/mcp/functions/parse-agent-meta.function.ts +0 -27
  274. package/src/shared/mcp/functions/parse-skill-arguments.function.ts +0 -36
  275. package/src/shared/mcp/functions/parse-skill-content.function.ts +0 -38
  276. package/src/shared/mcp/functions/read-agent-meta.function.ts +0 -41
  277. package/src/shared/mcp/functions/resolve-skill-refs.function.ts +0 -50
  278. package/src/shared/mcp/functions/run-startup-health-check.function.ts +0 -34
  279. package/src/shared/mcp/functions/serialize-skill-content.function.ts +0 -12
  280. package/src/shared/mcp/functions/should-emit-log.function.ts +0 -38
  281. package/src/shared/mcp/index.ts +0 -28
  282. package/src/shared/mcp/typings/agent-types.interface.ts +0 -39
  283. package/src/shared/mcp/typings/log-types.interface.ts +0 -26
  284. package/src/shared/mcp/typings/mcp-capabilities.interface.ts +0 -16
  285. package/src/shared/mcp/typings/mcp-client.interface.ts +0 -317
  286. package/src/shared/mcp/typings/mcp-completion.interface.ts +0 -45
  287. package/src/shared/mcp/typings/mcp-content-result.model.ts +0 -9
  288. package/src/shared/mcp/typings/mcp-export-result.model.ts +0 -11
  289. package/src/shared/mcp/typings/mcp-gc-result.model.ts +0 -15
  290. package/src/shared/mcp/typings/mcp-integrity-check-result.model.ts +0 -17
  291. package/src/shared/mcp/typings/mcp-integrity-error.model.ts +0 -15
  292. package/src/shared/mcp/typings/mcp-notification.interface.ts +0 -9
  293. package/src/shared/mcp/typings/mcp-rebuild-result.model.ts +0 -9
  294. package/src/shared/mcp/typings/mcp-request.interface.ts +0 -11
  295. package/src/shared/mcp/typings/mcp-resource-result.interface.ts +0 -12
  296. package/src/shared/mcp/typings/mcp-resource-template.interface.ts +0 -11
  297. package/src/shared/mcp/typings/mcp-response.interface.ts +0 -18
  298. package/src/shared/mcp/typings/mcp-server-info.interface.ts +0 -7
  299. package/src/shared/mcp/typings/mcp-server-state.interface.ts +0 -17
  300. package/src/shared/mcp/typings/mcp-tool-annotations.interface.ts +0 -32
  301. package/src/shared/mcp/typings/mcp-tool-definition.interface.ts +0 -16
  302. package/src/shared/mcp/typings/mcp-tool-result.interface.ts +0 -19
  303. package/src/shared/mcp/typings/mcp-types.interface.ts +0 -158
  304. package/src/shared/mcp/typings/mcp-worker-client.interface.ts +0 -243
  305. package/src/shared/mcp/typings/prompt-types.interface.ts +0 -39
  306. package/src/shared/mcp/typings/remove-section-result.model.ts +0 -10
  307. package/src/shared/mcp/typings/sampling-types.interface.ts +0 -48
  308. package/src/shared/mcp/typings/skill-types.interface.ts +0 -29
  309. package/src/shared/mcp/typings/tool-call-result.model.ts +0 -18
  310. package/src/shared/mod.ts +0 -1
  311. package/src/shared/platform/functions/get-ipc-path.function.ts +0 -19
  312. package/src/shared/platform/functions/get-tmpdir.function.ts +0 -8
  313. package/src/shared/platform/functions/is-process-alive.function.ts +0 -17
  314. package/src/shared/platform/index.ts +0 -3
  315. package/src/shared/runtime/functions/detect-runtime.ts +0 -14
  316. package/src/shared/runtime/functions/get-args.ts +0 -16
  317. package/src/shared/runtime/index.ts +0 -3
  318. package/src/shared/runtime/typings/runtime.ts +0 -2
  319. package/src/shared/sync/functions/build-import-report.function.ts +0 -40
  320. package/src/shared/sync/functions/parse-export-entry.function.ts +0 -45
  321. package/src/shared/sync/functions/resolve-conflict.function.ts +0 -31
  322. package/src/shared/sync/functions/serialize-export-entry.function.ts +0 -18
  323. package/src/shared/sync/index.ts +0 -9
  324. package/src/shared/sync/typings/conflict-resolution.type.ts +0 -8
  325. package/src/shared/sync/typings/export-entry.interface.ts +0 -13
  326. package/src/shared/sync/typings/export-options.interface.ts +0 -9
  327. package/src/shared/sync/typings/import-options.interface.ts +0 -7
  328. package/src/shared/sync/typings/import-report.interface.ts +0 -15
  329. package/src/shared/version/constants/version.constant.ts +0 -2
  330. package/src/shared/version/index.ts +0 -1
  331. package/src/shared/wasm-codec/functions/decode-add-section-result.function.ts +0 -112
  332. package/src/shared/wasm-codec/functions/decode-compose-output.function.ts +0 -16
  333. package/src/shared/wasm-codec/functions/decode-document-manifest-list.function.ts +0 -70
  334. package/src/shared/wasm-codec/functions/decode-document-manifest.function.ts +0 -87
  335. package/src/shared/wasm-codec/functions/decode-f32.function.ts +0 -16
  336. package/src/shared/wasm-codec/functions/decode-key-value-text.function.ts +0 -15
  337. package/src/shared/wasm-codec/functions/decode-one-recall-result.function.ts +0 -86
  338. package/src/shared/wasm-codec/functions/decode-option-string.function.ts +0 -24
  339. package/src/shared/wasm-codec/functions/decode-recall-document.function.ts +0 -59
  340. package/src/shared/wasm-codec/functions/decode-recall-reference.function.ts +0 -52
  341. package/src/shared/wasm-codec/functions/decode-recall-result.function.ts +0 -267
  342. package/src/shared/wasm-codec/functions/decode-recall-sibling.function.ts +0 -43
  343. package/src/shared/wasm-codec/functions/decode-remove-flag.function.ts +0 -3
  344. package/src/shared/wasm-codec/functions/decode-scored-results.function.ts +0 -194
  345. package/src/shared/wasm-codec/functions/decode-section-match.function.ts +0 -80
  346. package/src/shared/wasm-codec/functions/decode-section-record-list.function.ts +0 -20
  347. package/src/shared/wasm-codec/functions/decode-section-record-trailing.function.ts +0 -75
  348. package/src/shared/wasm-codec/functions/decode-section-record.function.ts +0 -85
  349. package/src/shared/wasm-codec/functions/decode-section-records.function.ts +0 -249
  350. package/src/shared/wasm-codec/functions/decode-section-type.function.ts +0 -30
  351. package/src/shared/wasm-codec/functions/decode-string.function.ts +0 -22
  352. package/src/shared/wasm-codec/functions/decode-u32.function.ts +0 -16
  353. package/src/shared/wasm-codec/functions/decode-u64.function.ts +0 -16
  354. package/src/shared/wasm-codec/functions/decode-wasm-list.function.ts +0 -31
  355. package/src/shared/wasm-codec/functions/encode-add-section-params.function.ts +0 -102
  356. package/src/shared/wasm-codec/functions/encode-group-params.function.ts +0 -28
  357. package/src/shared/wasm-codec/functions/encode-identifier-list.function.ts +0 -17
  358. package/src/shared/wasm-codec/functions/encode-kbid-list.function.ts +0 -17
  359. package/src/shared/wasm-codec/functions/encode-option-string.function.ts +0 -14
  360. package/src/shared/wasm-codec/functions/encode-recall-params.function.ts +0 -68
  361. package/src/shared/wasm-codec/functions/encode-search-params.function.ts +0 -12
  362. package/src/shared/wasm-codec/functions/encode-section-type.function.ts +0 -18
  363. package/src/shared/wasm-codec/functions/encode-string.function.ts +0 -9
  364. package/src/shared/wasm-codec/functions/encode-type-filter-param.function.ts +0 -13
  365. package/src/shared/wasm-codec/functions/encode-u32.function.ts +0 -5
  366. package/src/shared/wasm-codec/functions/encode-update-section-params.function.ts +0 -16
  367. package/src/shared/wasm-codec/index.ts +0 -49
  368. package/src/shared/wasm-codec/typings/add-section-input.model.ts +0 -45
  369. package/src/shared/wasm-codec/typings/add-section-result.model.ts +0 -28
  370. package/src/shared/wasm-codec/typings/document-manifest.model.ts +0 -20
  371. package/src/shared/wasm-codec/typings/document-section.model.ts +0 -12
  372. package/src/shared/wasm-codec/typings/item-decoder.type.ts +0 -10
  373. package/src/shared/wasm-codec/typings/near-duplicate.model.ts +0 -16
  374. package/src/shared/wasm-codec/typings/paged-search-result.model.ts +0 -22
  375. package/src/shared/wasm-codec/typings/section-match.model.ts +0 -31
  376. package/src/shared/wasm-codec/typings/section-record-trailing.model.ts +0 -38
  377. package/src/shared/wasm-codec/typings/section-record.model.ts +0 -66
  378. package/src/shared/wasm-codec/typings/section-type-result.model.ts +0 -12
  379. package/src/shared/worker-client/classes/worker-client.class.ts +0 -466
  380. package/src/shared/worker-client/functions/compute-context-id.function.ts +0 -18
  381. package/src/shared/worker-client/functions/create-worker-client.function.ts +0 -70
  382. package/src/shared/worker-client/functions/discover-daemon.function.ts +0 -47
  383. package/src/shared/worker-client/functions/handle-ipc-data.function.ts +0 -49
  384. package/src/shared/worker-client/functions/resolve-db-path.function.ts +0 -21
  385. package/src/shared/worker-client/functions/send-ipc-request.function.ts +0 -39
  386. package/src/shared/worker-client/functions/spawn-daemon.function.ts +0 -35
  387. package/src/shared/worker-client/functions/wait-for-daemon.function.ts +0 -34
  388. package/src/shared/worker-client/index.ts +0 -44
  389. package/src/shared/worker-client/typings/add-section-result.model.ts +0 -39
  390. package/src/shared/worker-client/typings/content-result.model.ts +0 -12
  391. package/src/shared/worker-client/typings/daemon-info.model.ts +0 -7
  392. package/src/shared/worker-client/typings/export-result.model.ts +0 -14
  393. package/src/shared/worker-client/typings/gc-result.model.ts +0 -18
  394. package/src/shared/worker-client/typings/integrity-check-result.model.ts +0 -43
  395. package/src/shared/worker-client/typings/json-rpc-response.interface.ts +0 -17
  396. package/src/shared/worker-client/typings/migrate-result.model.ts +0 -11
  397. package/src/shared/worker-client/typings/pending-call.interface.ts +0 -7
  398. package/src/shared/worker-client/typings/rebuild-result.model.ts +0 -12
  399. package/src/shared/worker-client/typings/recall-document.model.ts +0 -16
  400. package/src/shared/worker-client/typings/recall-params.model.ts +0 -15
  401. package/src/shared/worker-client/typings/recall-reference.model.ts +0 -32
  402. package/src/shared/worker-client/typings/recall-result.model.ts +0 -98
  403. package/src/shared/worker-client/typings/recall-sibling.model.ts +0 -11
  404. package/src/shared/worker-client/typings/recall-single-result.model.ts +0 -41
  405. package/src/shared/worker-client/typings/remove-section-result.model.ts +0 -7
  406. package/src/shared/worker-client/typings/search-params.model.ts +0 -14
  407. package/src/shared/worker-client/typings/search-result.model.ts +0 -43
  408. package/src/shared/worker-client/typings/section.model.ts +0 -43
  409. package/src/shared/worker-client/typings/status-result.model.ts +0 -14
  410. package/src/shared/worker-client/typings/version-status.model.ts +0 -28
  411. package/src/shared/worker-client/typings/worker-client-error.interface.ts +0 -8
  412. package/src/shared/worker-client/typings/worker-client-options.interface.ts +0 -30
  413. package/src/shared/worker-daemon/classes/ipc-error.class.ts +0 -22
  414. package/src/shared/worker-daemon/classes/worker-daemon.class.ts +0 -1291
  415. package/src/shared/worker-daemon/constants/daemon-defaults.constant.ts +0 -29
  416. package/src/shared/worker-daemon/constants/wasm-method-map.constant.ts +0 -69
  417. package/src/shared/worker-daemon/functions/build-ipc-error-response.function.ts +0 -16
  418. package/src/shared/worker-daemon/functions/check-catalog-version.function.ts +0 -54
  419. package/src/shared/worker-daemon/functions/check-preconditions.function.ts +0 -28
  420. package/src/shared/worker-daemon/functions/create-host-imports.function.ts +0 -328
  421. package/src/shared/worker-daemon/functions/create-ipc-server.function.ts +0 -87
  422. package/src/shared/worker-daemon/functions/detect-stale-pid.function.ts +0 -33
  423. package/src/shared/worker-daemon/functions/dispatch-request.function.ts +0 -190
  424. package/src/shared/worker-daemon/functions/handle-check-version.function.ts +0 -74
  425. package/src/shared/worker-daemon/functions/handle-config-method.function.ts +0 -27
  426. package/src/shared/worker-daemon/functions/handle-read-ops.function.ts +0 -236
  427. package/src/shared/worker-daemon/functions/handle-write-ops.function.ts +0 -257
  428. package/src/shared/worker-daemon/functions/load-wasm-modules.function.ts +0 -95
  429. package/src/shared/worker-daemon/functions/parse-auto-capture-section.function.ts +0 -51
  430. package/src/shared/worker-daemon/functions/parse-catalog-version.function.ts +0 -20
  431. package/src/shared/worker-daemon/functions/parse-embedding-section.function.ts +0 -38
  432. package/src/shared/worker-daemon/functions/parse-worker-toml.function.ts +0 -104
  433. package/src/shared/worker-daemon/functions/read-config.function.ts +0 -83
  434. package/src/shared/worker-daemon/functions/run-startup-integrity-check.function.ts +0 -55
  435. package/src/shared/worker-daemon/functions/run-worker.function.ts +0 -57
  436. package/src/shared/worker-daemon/functions/scan-near-duplicates.function.ts +0 -92
  437. package/src/shared/worker-daemon/functions/start-daemon.function.ts +0 -74
  438. package/src/shared/worker-daemon/functions/wasm-bridge.function.ts +0 -144
  439. package/src/shared/worker-daemon/functions/wasm-memory-helpers.function.ts +0 -41
  440. package/src/shared/worker-daemon/functions/write-lock.function.ts +0 -49
  441. package/src/shared/worker-daemon/index.ts +0 -16
  442. package/src/shared/worker-daemon/typings/allocator-ref.interface.ts +0 -16
  443. package/src/shared/worker-daemon/typings/daemon-config.interface.ts +0 -20
  444. package/src/shared/worker-daemon/typings/fs-adapter.interface.ts +0 -22
  445. package/src/shared/worker-daemon/typings/handler-context.interface.ts +0 -19
  446. package/src/shared/worker-daemon/typings/ipc-handler.interface.ts +0 -39
  447. package/src/shared/worker-daemon/typings/memory-ref.interface.ts +0 -13
  448. package/src/shared/worker-daemon/typings/wasm-fn.type.ts +0 -2
  449. package/src/shared/worker-daemon/typings/wasm-modules.interface.ts +0 -7
  450. package/src/shared/worker-daemon/typings/write-lock.interface.ts +0 -13
  451. package/src/wasm/fs-database/kbdb_fs_database.d.ts +0 -259
  452. package/src/wasm/fs-database/kbdb_fs_database.js +0 -515
  453. package/src/wasm/fs-database/kbdb_fs_database_bg.wasm +0 -0
  454. package/src/wasm/fs-database/kbdb_fs_database_bg.wasm.d.ts +0 -35
  455. package/src/wasm/fs-database/package.json +0 -13
  456. package/src/wasm/kb-worker/kbdb_worker.d.ts +0 -650
  457. package/src/wasm/kb-worker/kbdb_worker.js +0 -1181
  458. package/src/wasm/kb-worker/kbdb_worker_bg.wasm +0 -0
  459. package/src/wasm/kb-worker/kbdb_worker_bg.wasm.d.ts +0 -77
  460. package/src/wasm/kb-worker/package.json +0 -13
  461. package/src/wasm/query-parser/kbdb_query_parser.d.ts +0 -195
  462. package/src/wasm/query-parser/kbdb_query_parser.js +0 -403
  463. package/src/wasm/query-parser/kbdb_query_parser_bg.wasm +0 -0
  464. package/src/wasm/query-parser/kbdb_query_parser_bg.wasm.d.ts +0 -25
  465. package/src/wasm/query-parser/package.json +0 -13
  466. package/src/worker.ts +0 -42
@@ -1,38 +0,0 @@
1
- import type { McpLogLevel } from '../typings/log-types.interface.ts';
2
-
3
- /**
4
- * Ordered list of MCP log severity levels, from least severe
5
- * (`debug`) to most severe (`emergency`). Used to compare levels
6
- * when filtering log output.
7
- */
8
- export const LOG_LEVEL_ORDER: McpLogLevel[] = [
9
- 'debug',
10
- 'info',
11
- 'notice',
12
- 'warning',
13
- 'error',
14
- 'critical',
15
- 'alert',
16
- 'emergency',
17
- ];
18
-
19
- /**
20
- * Determines whether a log message at `messageLevel` should be
21
- * emitted when the server's log threshold is `threshold`.
22
- *
23
- * Returns `true` when `messageLevel` is at the same severity as
24
- * `threshold` or higher. Returns `false` when the message level is
25
- * below the threshold.
26
- *
27
- * @param messageLevel - severity of the log message to evaluate
28
- * @param threshold - minimum severity level required to emit
29
- * @returns `true` if the message meets or exceeds the threshold
30
- */
31
- export function shouldEmitLog(
32
- messageLevel: McpLogLevel,
33
- threshold: McpLogLevel,
34
- ): boolean {
35
- const messageIndex = LOG_LEVEL_ORDER.indexOf(messageLevel);
36
- const thresholdIndex = LOG_LEVEL_ORDER.indexOf(threshold);
37
- return messageIndex >= thresholdIndex;
38
- }
@@ -1,28 +0,0 @@
1
- export { McpServer } from './classes/mcp-server.class.ts';
2
- export { createMcpServer } from './functions/create-mcp-server.function.ts';
3
- export { createToolDefinitions } from './functions/create-tool-definitions.function.ts';
4
- export { createResourceTemplates } from './functions/create-resource-templates.function.ts';
5
- export { handleToolCall } from './functions/handle-tool-call.function.ts';
6
- export { handleResourceRead } from './functions/handle-resource-read.function.ts';
7
- export {
8
- PARSE_ERROR,
9
- METHOD_NOT_FOUND,
10
- INVALID_PARAMS,
11
- INTERNAL_ERROR,
12
- RESOURCE_NOT_FOUND,
13
- } from './constants/mcp-error-codes.constant.ts';
14
- export type {
15
- McpRequest,
16
- McpResponse,
17
- McpNotification,
18
- McpToolDefinition,
19
- McpResourceTemplate,
20
- McpServerInfo,
21
- McpCapabilities,
22
- McpToolResult,
23
- McpResourceResult,
24
- } from './typings/mcp-types.interface.ts';
25
- export type {
26
- McpWorkerClient,
27
- RemoveSectionResult,
28
- } from './typings/mcp-client.interface.ts';
@@ -1,39 +0,0 @@
1
- /**
2
- * A reference from an agent document to a skill section,
3
- * carrying the skill's position within the agent's ordered
4
- * skill list.
5
- */
6
- export interface AgentSkillRef {
7
- /** Knowledge-base identifier of the referenced skill section. */
8
- readonly kbid: string;
9
- /**
10
- * Human-readable name of the skill, or `null` when the
11
- * referenced section no longer exists (dangling reference).
12
- */
13
- readonly name: string | null;
14
- /** Zero-based position of this skill within the agent's list. */
15
- readonly position: number;
16
- }
17
-
18
- /**
19
- * Full definition of an agent, including its persona text and
20
- * ordered list of skill references.
21
- */
22
- export interface AgentDefinition {
23
- /** Unique document identifier for the agent. */
24
- readonly docid: string;
25
- /** Human-readable name of the agent. */
26
- readonly name: string;
27
- /**
28
- * Short description of what the agent does, used for discovery
29
- * and disambiguation.
30
- */
31
- readonly description: string;
32
- /**
33
- * Persona text that governs how the agent behaves when
34
- * executing tasks.
35
- */
36
- readonly persona: string;
37
- /** Ordered list of skill references the agent can delegate to. */
38
- readonly skills: readonly AgentSkillRef[];
39
- }
@@ -1,26 +0,0 @@
1
- /**
2
- * Severity levels for MCP log messages, ordered from least severe
3
- * (`debug`) to most severe (`emergency`).
4
- */
5
- export type McpLogLevel =
6
- | 'debug'
7
- | 'info'
8
- | 'notice'
9
- | 'warning'
10
- | 'error'
11
- | 'critical'
12
- | 'alert'
13
- | 'emergency';
14
-
15
- /**
16
- * A structured log message emitted by the MCP server via the
17
- * `notifications/message` notification method.
18
- */
19
- export interface McpLogMessage {
20
- /** Severity level of the log entry. */
21
- readonly level: McpLogLevel;
22
- /** Optional logger name identifying the source component. */
23
- readonly logger?: string;
24
- /** Optional structured payload associated with the log entry. */
25
- readonly data?: unknown;
26
- }
@@ -1,16 +0,0 @@
1
- /** MCP capability flags advertised during initialization. */
2
- export interface McpCapabilities {
3
- /** Indicates the server supports the tools capability. */
4
- readonly tools?: Record<string, unknown>;
5
- /** Indicates the server supports the resources capability. */
6
- readonly resources?: Record<string, unknown>;
7
- /** Indicates the server supports the prompts capability. */
8
- readonly prompts?: Record<string, unknown>;
9
- /** Indicates the server supports the logging capability. */
10
- readonly logging?: Record<string, unknown>;
11
- /**
12
- * Indicates the server supports the completions capability,
13
- * providing argument auto-completion for prompts and resources.
14
- */
15
- readonly completions?: Record<string, unknown>;
16
- }
@@ -1,317 +0,0 @@
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
-
6
- /** Result returned by content composition. */
7
- export interface McpContentResult {
8
- /** MIME type of the composed output, always `'text/markdown'`. */
9
- readonly type: 'text/markdown';
10
- /** The composed Markdown string. */
11
- readonly data: string;
12
- /** Character count of `data` (not byte count). */
13
- readonly total: number;
14
- }
15
-
16
- /** A single integrity error found during a database check. */
17
- export interface McpIntegrityError {
18
- /** The category of integrity violation detected. */
19
- readonly type:
20
- | 'checksum_mismatch'
21
- | 'orphan_section'
22
- | 'orphan_document'
23
- | 'broken_reference'
24
- | 'type_mismatch'
25
- | 'circular_reference';
26
- /** Identifier of the entity (kbid or docid) that has the issue. */
27
- readonly entity: string;
28
- /** Human-readable description of the specific problem. */
29
- readonly detail: string;
30
- }
31
-
32
- /** Integrity check report returned by the daemon. */
33
- export interface McpIntegrityCheckResult {
34
- /** `true` when all checks passed and no errors were found. */
35
- readonly ok: boolean;
36
- /** All integrity errors found; empty when `ok` is `true`. */
37
- readonly errors: McpIntegrityError[];
38
- /** Total number of sections examined. */
39
- readonly sections_checked: number;
40
- /** Total number of documents examined. */
41
- readonly documents_checked: number;
42
- /** Total number of marker references checked. */
43
- readonly references_checked: number;
44
- /** Time taken to complete the check, in milliseconds. */
45
- readonly elapsed_ms: number;
46
- }
47
-
48
- /** Export report returned by the daemon. */
49
- export interface McpExportResult {
50
- /** Absolute path to the directory where files were written. */
51
- readonly path: string;
52
- /** Number of section files copied to the export directory. */
53
- readonly sections_exported: number;
54
- /** Number of document manifest files copied. */
55
- readonly documents_exported: number;
56
- /** Time taken to complete the export, in milliseconds. */
57
- readonly elapsed_ms: number;
58
- }
59
-
60
- /** Garbage collection report returned by the daemon. */
61
- export interface McpGcResult {
62
- /** Number of unreferenced sections removed. */
63
- readonly removed_sections: number;
64
- /** Total bytes freed by removing unreferenced sections. */
65
- readonly removed_bytes: number;
66
- /** Time taken to complete garbage collection, in milliseconds. */
67
- readonly elapsed_ms: number;
68
- /**
69
- * Number of sections whose source_path file no longer contains
70
- * their heading text. Advisory; not auto-removed by gc.
71
- * Absent on older daemon versions.
72
- */
73
- readonly stale_sources?: number;
74
- }
75
-
76
- /** Index rebuild report returned by the daemon. */
77
- export interface McpRebuildResult {
78
- /** Number of text and code sections that were re-indexed. */
79
- readonly sections_reindexed: number;
80
- /** Total number of unique terms written to the rebuilt indexes. */
81
- readonly terms_indexed: number;
82
- /** Time taken to complete the rebuild, in milliseconds. */
83
- readonly elapsed_ms: number;
84
- }
85
-
86
- /**
87
- * Interface for the worker client dependency consumed by the MCP
88
- * server. Defines the knowledge-base operations the server exposes
89
- * as MCP tools and resources without coupling to the concrete
90
- * `WorkerClient` class.
91
- */
92
- export interface McpWorkerClient {
93
- /**
94
- * Searches the knowledge base using the given parameters.
95
- *
96
- * @param params - query string and optional search options
97
- * @returns ranked list of matching section summaries
98
- */
99
- search(params: {
100
- /** Natural language query text. */
101
- readonly query: string;
102
- /** Search mode: 'sections', 'documents', or 'stats'. */
103
- readonly mode?: string;
104
- /** Maximum number of results to return. */
105
- readonly limit?: number;
106
- /** Number of results to skip for pagination. */
107
- readonly offset?: number;
108
- /** Search algorithm: 'lexical', 'vector', or 'hybrid'. */
109
- readonly algo?: string;
110
- }): Promise<{
111
- readonly items: readonly {
112
- readonly kbid: string;
113
- readonly heading: string | null;
114
- readonly type: string;
115
- readonly docids: readonly string[];
116
- readonly score: number;
117
- readonly snippet: string;
118
- readonly matched_terms: readonly string[];
119
- /** Fields that contained matches (heading, body, code). */
120
- readonly matched_fields?: readonly string[];
121
- /** ISO 8601 creation timestamp of the section. */
122
- readonly created_at?: string;
123
- }[];
124
- readonly total: number;
125
- readonly offset: number;
126
- readonly limit: number;
127
- readonly has_more: boolean;
128
- /**
129
- * `true` when results came from an automatic AND-to-OR
130
- * fallback query relaxation.
131
- */
132
- readonly relaxed?: boolean;
133
- }>;
134
-
135
- /**
136
- * Adds a new section to the knowledge base.
137
- *
138
- * @param params - content type, raw content, and optional metadata
139
- * @returns the assigned knowledge-base identifier
140
- */
141
- addSection(params: {
142
- /** Semantic type label for the section content. */
143
- readonly sectionType: string;
144
- /** Raw text or base64-encoded content for the section. */
145
- readonly content: string;
146
- /** Optional section title. Required for image/* types. */
147
- readonly title?: string;
148
- /** Optional section description. */
149
- readonly description?: string;
150
- /** Optional document ID to group this section under. */
151
- readonly docid?: string;
152
- /** Optional tags for scoping and filtering. */
153
- readonly tags?: string[];
154
- /**
155
- * When `true`, replaces an existing section that has the same
156
- * source key (supersession).
157
- */
158
- readonly replace?: boolean;
159
- }): Promise<AddSectionResult>;
160
-
161
- /**
162
- * Removes a section from the knowledge base.
163
- *
164
- * @param kbid - knowledge-base identifier of the section to remove
165
- * @returns removal result with `removed` flag and elapsed time
166
- */
167
- removeSection(kbid: string): Promise<RemoveSectionResult>;
168
-
169
- /**
170
- * Retrieves one or more sections by their identifiers.
171
- *
172
- * @param kbids - list of knowledge-base identifiers to fetch
173
- * @returns sections in the order their IDs were requested
174
- */
175
- readSections(kbids: string[]): Promise<
176
- {
177
- /** Knowledge-base identifier for this section. */
178
- kbid: string;
179
- /** Semantic type label assigned to the section. */
180
- sectionType: string;
181
- /** Raw text content of the section. */
182
- content: string;
183
- /** Byte size of the stored content. */
184
- size: number;
185
- }[]
186
- >;
187
-
188
- /**
189
- * Retrieves a full document record including its ordered sections.
190
- *
191
- * @param docid - identifier of the document to retrieve
192
- * @returns the document record as returned by the daemon
193
- */
194
- retrieveDocument(docid: string): Promise<unknown>;
195
-
196
- /**
197
- * Composes a rendered Markdown document from one or more kbid
198
- * or docid identifiers.
199
- *
200
- * @param ids - list of kbid or docid identifiers (may be mixed)
201
- * @returns composed Markdown result with character count
202
- */
203
- content(ids: string[]): Promise<McpContentResult>;
204
-
205
- /**
206
- * Returns database metadata and status from the daemon.
207
- *
208
- * @returns document count, section count, and timing statistics
209
- */
210
- dbStatus(): Promise<{
211
- /** Whether the daemon has finished loading its WASM modules. */
212
- initialized: boolean;
213
- /** Absolute path to the context directory the daemon serves. */
214
- contextPath: string;
215
- /** In-memory cache statistics. */
216
- cacheStats: {
217
- /** Number of content entries currently cached. */
218
- contentCount: number;
219
- /** Number of index entries currently cached. */
220
- indexCount: number;
221
- };
222
- }>;
223
-
224
- /**
225
- * Runs an integrity check on the knowledge-base database.
226
- *
227
- * @returns a report of all issues found; `ok` is `true` when
228
- * no errors were detected
229
- */
230
- integrityCheck(): Promise<McpIntegrityCheckResult>;
231
-
232
- /**
233
- * Removes unreferenced sections from the database.
234
- *
235
- * @returns a report of sections removed and bytes freed
236
- */
237
- gc(): Promise<McpGcResult>;
238
-
239
- /**
240
- * Reconstructs all index files from section files and document
241
- * manifests on disk.
242
- *
243
- * @returns a report of sections and terms re-indexed
244
- */
245
- rebuildIndexes(): Promise<McpRebuildResult>;
246
-
247
- /**
248
- * Retrieves all sections whose type name matches the given string.
249
- *
250
- * @param sectionType - the application-level type name to filter by
251
- * @returns all section records with a matching type name
252
- */
253
- listByType(sectionType: string): Promise<SectionRecord[]>;
254
-
255
- /**
256
- * Retrieves all documents whose type name matches the given string.
257
- *
258
- * @param docType - the application-level document type to filter by
259
- * @returns all document manifests with a matching type name
260
- */
261
- listDocumentsByType(docType: string): Promise<DocumentManifest[]>;
262
-
263
- /**
264
- * Groups a set of sections under a named document.
265
- *
266
- * @param title - human-readable document title
267
- * @param kbids - identifiers of the sections to group
268
- * @returns the assigned document identifier
269
- */
270
- groupSections(
271
- title: string,
272
- kbids: string[],
273
- docType?: string,
274
- ): Promise<string>;
275
-
276
- /**
277
- * Removes the document grouping for the given document.
278
- *
279
- * The sections themselves are not deleted; only the grouping
280
- * record is removed.
281
- *
282
- * @param docid - identifier of the document grouping to remove
283
- */
284
- removeGrouping(docid: string): Promise<void>;
285
-
286
- /**
287
- * Retrieves full content and context for one or more sections by
288
- * their knowledge-base identifiers.
289
- *
290
- * @param params - section identifier(s) and optional expansion depth
291
- * @returns a single result or array of results depending on input
292
- */
293
- recall(params: {
294
- /** Single section identifier. */
295
- readonly kbid?: string;
296
- /** Batch section identifiers. */
297
- readonly kbids?: readonly string[];
298
- /** Expansion depth (0-3, default: 0). */
299
- readonly depth?: number;
300
- }): Promise<unknown>;
301
-
302
- /**
303
- * Exports the database to a target directory as a self-contained
304
- * snapshot (sections, documents, catalog -- no indexes).
305
- *
306
- * @param params - optional export parameters
307
- * @returns export report with the resolved path and file counts
308
- */
309
- export(params?: {
310
- readonly path?: string;
311
- }): Promise<McpExportResult>;
312
-
313
- /** Destroys the IPC socket and clears the connection state. */
314
- disconnect(): void;
315
- }
316
-
317
- export type { RemoveSectionResult };
@@ -1,45 +0,0 @@
1
- /**
2
- * Discriminated reference used in MCP completion requests.
3
- * Identifies whether the completion target is a prompt or a resource.
4
- */
5
- export interface McpCompletionRef {
6
- /**
7
- * The reference type: `'ref/prompt'` for named prompts (skills
8
- * and agents) or `'ref/resource'` for resource URIs.
9
- */
10
- readonly type: 'ref/prompt' | 'ref/resource';
11
- /** Prompt name, present when `type` is `'ref/prompt'`. */
12
- readonly name?: string;
13
- /** Resource URI, present when `type` is `'ref/resource'`. */
14
- readonly uri?: string;
15
- }
16
-
17
- /**
18
- * Completion argument supplied by the client, describing which
19
- * argument is being completed and the current partial value.
20
- */
21
- export interface McpCompletionArgument {
22
- /** The argument name being completed. */
23
- readonly name: string;
24
- /** The partial value typed so far; used for prefix filtering. */
25
- readonly value: string;
26
- }
27
-
28
- /**
29
- * Result returned by `handleCompletion`, containing the list of
30
- * matching completion values and pagination metadata.
31
- */
32
- export interface McpCompletionResult {
33
- /** Completion payload. */
34
- readonly completion: {
35
- /** Matching completion strings for the given prefix. */
36
- readonly values: string[];
37
- /**
38
- * Whether more results are available beyond what is returned.
39
- * Always `false` in this implementation.
40
- */
41
- readonly hasMore: boolean;
42
- /** Total number of values returned. */
43
- readonly total: number;
44
- };
45
- }
@@ -1,9 +0,0 @@
1
- /** Result returned by content composition. */
2
- export interface McpContentResult {
3
- /** MIME type of the composed output, always `'text/markdown'`. */
4
- readonly type: 'text/markdown';
5
- /** The composed Markdown string. */
6
- readonly data: string;
7
- /** Character count of `data` (not byte count). */
8
- readonly total: number;
9
- }
@@ -1,11 +0,0 @@
1
- /** Export report returned by the daemon. */
2
- export interface McpExportResult {
3
- /** Absolute path to the directory where files were written. */
4
- readonly path: string;
5
- /** Number of section files copied to the export directory. */
6
- readonly sections_exported: number;
7
- /** Number of document manifest files copied. */
8
- readonly documents_exported: number;
9
- /** Time taken to complete the export, in milliseconds. */
10
- readonly elapsed_ms: number;
11
- }
@@ -1,15 +0,0 @@
1
- /** Garbage collection report returned by the daemon. */
2
- export interface McpGcResult {
3
- /** Number of unreferenced sections removed. */
4
- readonly removed_sections: number;
5
- /** Total bytes freed by removing unreferenced sections. */
6
- readonly removed_bytes: number;
7
- /** Time taken to complete garbage collection, in milliseconds. */
8
- readonly elapsed_ms: number;
9
- /**
10
- * Number of sections whose source_path file no longer contains
11
- * their heading text. Advisory; not auto-removed by gc.
12
- * Absent on older daemon versions.
13
- */
14
- readonly stale_sources?: number;
15
- }
@@ -1,17 +0,0 @@
1
- import type { McpIntegrityError } from './mcp-integrity-error.model.ts';
2
-
3
- /** Integrity check report returned by the daemon. */
4
- export interface McpIntegrityCheckResult {
5
- /** `true` when all checks passed and no errors were found. */
6
- readonly ok: boolean;
7
- /** All integrity errors found; empty when `ok` is `true`. */
8
- readonly errors: McpIntegrityError[];
9
- /** Total number of sections examined. */
10
- readonly sections_checked: number;
11
- /** Total number of documents examined. */
12
- readonly documents_checked: number;
13
- /** Total number of marker references checked. */
14
- readonly references_checked: number;
15
- /** Time taken to complete the check, in milliseconds. */
16
- readonly elapsed_ms: number;
17
- }
@@ -1,15 +0,0 @@
1
- /** A single integrity error found during a database check. */
2
- export interface McpIntegrityError {
3
- /** The category of integrity violation detected. */
4
- readonly type:
5
- | 'checksum_mismatch'
6
- | 'orphan_section'
7
- | 'orphan_document'
8
- | 'broken_reference'
9
- | 'type_mismatch'
10
- | 'circular_reference';
11
- /** Identifier of the entity (kbid or docid) that has the issue. */
12
- readonly entity: string;
13
- /** Human-readable description of the specific problem. */
14
- readonly detail: string;
15
- }
@@ -1,9 +0,0 @@
1
- /** A JSON-RPC 2.0 notification with no expected response. */
2
- export interface McpNotification {
3
- /** JSON-RPC protocol version. Must always be '2.0'. */
4
- readonly jsonrpc: '2.0';
5
- /** Notification method name. */
6
- readonly method: string;
7
- /** Optional notification parameters. */
8
- readonly params?: Record<string, unknown>;
9
- }
@@ -1,9 +0,0 @@
1
- /** Index rebuild report returned by the daemon. */
2
- export interface McpRebuildResult {
3
- /** Number of text and code sections that were re-indexed. */
4
- readonly sections_reindexed: number;
5
- /** Total number of unique terms written to the rebuilt indexes. */
6
- readonly terms_indexed: number;
7
- /** Time taken to complete the rebuild, in milliseconds. */
8
- readonly elapsed_ms: number;
9
- }
@@ -1,11 +0,0 @@
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
- }
@@ -1,12 +0,0 @@
1
- /** Result returned by `handleResourceRead`. */
2
- export interface McpResourceResult {
3
- /** One or more content items for the requested resource URI. */
4
- readonly contents: readonly {
5
- /** The resource URI that was read. */
6
- readonly uri: string;
7
- /** MIME type of the content body. */
8
- readonly mimeType: string;
9
- /** Text body of the resource. */
10
- readonly text: string;
11
- }[];
12
- }
@@ -1,11 +0,0 @@
1
- /** A URI template describing an MCP resource the server serves. */
2
- export interface McpResourceTemplate {
3
- /** RFC 6570 URI template for the resource. */
4
- readonly uriTemplate: string;
5
- /** Human-readable resource name. */
6
- readonly name: string;
7
- /** Human-readable description of the resource. */
8
- readonly description: string;
9
- /** Optional MIME type for the resource content. */
10
- readonly mimeType?: string;
11
- }
@@ -1,18 +0,0 @@
1
- /** A JSON-RPC 2.0 response message sent from the MCP server. */
2
- export interface McpResponse {
3
- /** JSON-RPC protocol version. Must always be '2.0'. */
4
- readonly jsonrpc: '2.0';
5
- /** Echoes the request identifier. */
6
- readonly id: number | string;
7
- /** Successful result payload; absent when error is set. */
8
- readonly result?: unknown;
9
- /** Error payload; absent when result is set. */
10
- readonly error?: {
11
- /** Numeric error code as defined by JSON-RPC or MCP. */
12
- readonly code: number;
13
- /** Human-readable error message. */
14
- readonly message: string;
15
- /** Optional additional error data. */
16
- readonly data?: unknown;
17
- };
18
- }
@@ -1,7 +0,0 @@
1
- /** Identity information for the MCP server. */
2
- export interface McpServerInfo {
3
- /** Server name reported during MCP initialization. */
4
- readonly name: string;
5
- /** Server version string reported during MCP initialization. */
6
- readonly version: string;
7
- }