@vpxa/kb 0.1.13 → 0.1.16

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 (490) hide show
  1. package/README.md +65 -12
  2. package/package.json +14 -7
  3. package/packages/analyzers/dist/blast-radius-analyzer.d.ts +17 -21
  4. package/packages/analyzers/dist/blast-radius-analyzer.js +5 -12
  5. package/packages/analyzers/dist/dependency-analyzer.d.ts +31 -28
  6. package/packages/analyzers/dist/dependency-analyzer.js +6 -9
  7. package/packages/analyzers/dist/diagram-generator.d.ts +12 -9
  8. package/packages/analyzers/dist/diagram-generator.js +2 -4
  9. package/packages/analyzers/dist/entry-point-analyzer.d.ts +39 -36
  10. package/packages/analyzers/dist/entry-point-analyzer.js +4 -6
  11. package/packages/analyzers/dist/index.d.ts +12 -14
  12. package/packages/analyzers/dist/index.js +1 -1
  13. package/packages/analyzers/dist/knowledge-producer.d.ts +34 -26
  14. package/packages/analyzers/dist/knowledge-producer.js +17 -15
  15. package/packages/analyzers/dist/pattern-analyzer.d.ts +14 -11
  16. package/packages/analyzers/dist/pattern-analyzer.js +2 -5
  17. package/packages/analyzers/dist/regex-call-graph.d.ts +6 -13
  18. package/packages/analyzers/dist/regex-call-graph.js +1 -1
  19. package/packages/analyzers/dist/structure-analyzer.d.ts +13 -10
  20. package/packages/analyzers/dist/structure-analyzer.js +2 -4
  21. package/packages/analyzers/dist/symbol-analyzer.d.ts +13 -9
  22. package/packages/analyzers/dist/symbol-analyzer.js +9 -13
  23. package/packages/analyzers/dist/ts-call-graph.d.ts +16 -14
  24. package/packages/analyzers/dist/ts-call-graph.js +1 -1
  25. package/packages/analyzers/dist/types.d.ts +82 -80
  26. package/packages/analyzers/dist/types.js +1 -0
  27. package/packages/chunker/dist/call-graph-extractor.d.ts +15 -12
  28. package/packages/chunker/dist/call-graph-extractor.js +1 -1
  29. package/packages/chunker/dist/chunker-factory.d.ts +16 -4
  30. package/packages/chunker/dist/chunker-factory.js +1 -1
  31. package/packages/chunker/dist/chunker.interface.d.ts +8 -5
  32. package/packages/chunker/dist/chunker.interface.js +1 -0
  33. package/packages/chunker/dist/code-chunker.d.ts +16 -13
  34. package/packages/chunker/dist/code-chunker.js +11 -14
  35. package/packages/chunker/dist/extractors/call-extractor.d.ts +24 -0
  36. package/packages/chunker/dist/extractors/call-extractor.js +1 -0
  37. package/packages/chunker/dist/extractors/entry-point-detector.d.ts +14 -0
  38. package/packages/chunker/dist/extractors/entry-point-detector.js +1 -0
  39. package/packages/chunker/dist/extractors/import-extractor.d.ts +14 -0
  40. package/packages/chunker/dist/extractors/import-extractor.js +1 -0
  41. package/packages/chunker/dist/extractors/pattern-detector.d.ts +14 -0
  42. package/packages/chunker/dist/extractors/pattern-detector.js +1 -0
  43. package/packages/chunker/dist/extractors/scope-resolver.d.ts +26 -0
  44. package/packages/chunker/dist/extractors/scope-resolver.js +1 -0
  45. package/packages/chunker/dist/extractors/symbol-extractor.d.ts +14 -0
  46. package/packages/chunker/dist/extractors/symbol-extractor.js +1 -0
  47. package/packages/chunker/dist/extractors/types.d.ts +36 -0
  48. package/packages/chunker/dist/extractors/types.js +1 -0
  49. package/packages/chunker/dist/generic-chunker.d.ts +14 -11
  50. package/packages/chunker/dist/generic-chunker.js +5 -5
  51. package/packages/chunker/dist/index.d.ts +19 -8
  52. package/packages/chunker/dist/index.js +1 -1
  53. package/packages/chunker/dist/markdown-chunker.d.ts +16 -13
  54. package/packages/chunker/dist/markdown-chunker.js +3 -10
  55. package/packages/chunker/dist/wasm/languages.d.ts +18 -0
  56. package/packages/chunker/dist/wasm/languages.js +1 -0
  57. package/packages/chunker/dist/wasm/query-executor.d.ts +70 -0
  58. package/packages/chunker/dist/wasm/query-executor.js +1 -0
  59. package/packages/chunker/dist/wasm/runtime.d.ts +44 -0
  60. package/packages/chunker/dist/wasm/runtime.js +1 -0
  61. package/packages/chunker/dist/wasm/types.d.ts +84 -0
  62. package/packages/chunker/dist/wasm/types.js +1 -0
  63. package/packages/chunker/dist/wasm-chunker.d.ts +23 -0
  64. package/packages/chunker/dist/wasm-chunker.js +6 -0
  65. package/packages/chunker/src/queries/go/calls.scm +11 -0
  66. package/packages/chunker/src/queries/go/entry-points.scm +20 -0
  67. package/packages/chunker/src/queries/go/imports.scm +6 -0
  68. package/packages/chunker/src/queries/go/patterns.scm +25 -0
  69. package/packages/chunker/src/queries/go/symbols.scm +26 -0
  70. package/packages/chunker/src/queries/java/calls.scm +10 -0
  71. package/packages/chunker/src/queries/java/entry-points.scm +27 -0
  72. package/packages/chunker/src/queries/java/imports.scm +11 -0
  73. package/packages/chunker/src/queries/java/patterns.scm +27 -0
  74. package/packages/chunker/src/queries/java/symbols.scm +28 -0
  75. package/packages/chunker/src/queries/javascript/calls.scm +21 -0
  76. package/packages/chunker/src/queries/javascript/entry-points.scm +31 -0
  77. package/packages/chunker/src/queries/javascript/imports.scm +32 -0
  78. package/packages/chunker/src/queries/javascript/patterns.scm +28 -0
  79. package/packages/chunker/src/queries/javascript/symbols.scm +52 -0
  80. package/packages/chunker/src/queries/python/calls.scm +11 -0
  81. package/packages/chunker/src/queries/python/entry-points.scm +21 -0
  82. package/packages/chunker/src/queries/python/imports.scm +14 -0
  83. package/packages/chunker/src/queries/python/patterns.scm +25 -0
  84. package/packages/chunker/src/queries/python/symbols.scm +17 -0
  85. package/packages/chunker/src/queries/rust/calls.scm +20 -0
  86. package/packages/chunker/src/queries/rust/entry-points.scm +7 -0
  87. package/packages/chunker/src/queries/rust/imports.scm +26 -0
  88. package/packages/chunker/src/queries/rust/patterns.scm +18 -0
  89. package/packages/chunker/src/queries/rust/symbols.scm +73 -0
  90. package/packages/chunker/src/queries/typescript/calls.scm +21 -0
  91. package/packages/chunker/src/queries/typescript/entry-points.scm +48 -0
  92. package/packages/chunker/src/queries/typescript/imports.scm +35 -0
  93. package/packages/chunker/src/queries/typescript/patterns.scm +47 -0
  94. package/packages/chunker/src/queries/typescript/symbols.scm +79 -0
  95. package/packages/chunker/wasm/tree-sitter-go.wasm +0 -0
  96. package/packages/chunker/wasm/tree-sitter-java.wasm +0 -0
  97. package/packages/chunker/wasm/tree-sitter-javascript.wasm +0 -0
  98. package/packages/chunker/wasm/tree-sitter-python.wasm +0 -0
  99. package/packages/chunker/wasm/tree-sitter-rust.wasm +0 -0
  100. package/packages/chunker/wasm/tree-sitter-typescript.wasm +0 -0
  101. package/packages/chunker/wasm/tree-sitter.wasm +0 -0
  102. package/packages/cli/dist/commands/analyze.d.ts +6 -3
  103. package/packages/cli/dist/commands/analyze.js +2 -3
  104. package/packages/cli/dist/commands/context-cmds.d.ts +6 -3
  105. package/packages/cli/dist/commands/context-cmds.js +1 -1
  106. package/packages/cli/dist/commands/environment.d.ts +6 -3
  107. package/packages/cli/dist/commands/environment.js +1 -2
  108. package/packages/cli/dist/commands/execution.d.ts +6 -3
  109. package/packages/cli/dist/commands/execution.js +1 -1
  110. package/packages/cli/dist/commands/graph.d.ts +6 -3
  111. package/packages/cli/dist/commands/graph.js +5 -6
  112. package/packages/cli/dist/commands/init/adapters.d.ts +28 -0
  113. package/packages/cli/dist/commands/init/adapters.js +1 -0
  114. package/packages/cli/dist/commands/init/config.d.ts +10 -0
  115. package/packages/cli/dist/commands/init/config.js +3 -0
  116. package/packages/cli/dist/commands/init/constants.d.ts +18 -0
  117. package/packages/cli/dist/commands/init/constants.js +1 -0
  118. package/packages/cli/dist/commands/init/curated.d.ts +7 -0
  119. package/packages/cli/dist/commands/init/curated.js +1 -0
  120. package/packages/cli/dist/commands/init/global.d.ts +34 -0
  121. package/packages/cli/dist/commands/init/global.js +5 -0
  122. package/packages/cli/dist/commands/init/index.d.ts +28 -0
  123. package/packages/cli/dist/commands/init/index.js +5 -0
  124. package/packages/cli/dist/commands/init/scaffold.d.ts +23 -0
  125. package/packages/cli/dist/commands/init/scaffold.js +1 -0
  126. package/packages/cli/dist/commands/init/templates.d.ts +9 -0
  127. package/packages/cli/dist/commands/init/templates.js +165 -0
  128. package/packages/cli/dist/commands/knowledge.d.ts +6 -3
  129. package/packages/cli/dist/commands/knowledge.js +1 -1
  130. package/packages/cli/dist/commands/search.d.ts +6 -3
  131. package/packages/cli/dist/commands/search.js +1 -8
  132. package/packages/cli/dist/commands/system.d.ts +6 -3
  133. package/packages/cli/dist/commands/system.js +4 -7
  134. package/packages/cli/dist/commands/workspace.d.ts +6 -3
  135. package/packages/cli/dist/commands/workspace.js +1 -2
  136. package/packages/cli/dist/context.d.ts +7 -5
  137. package/packages/cli/dist/context.js +1 -1
  138. package/packages/cli/dist/helpers.d.ts +51 -48
  139. package/packages/cli/dist/helpers.js +5 -5
  140. package/packages/cli/dist/index.d.ts +4 -2
  141. package/packages/cli/dist/index.js +2 -2
  142. package/packages/cli/dist/kb-init.d.ts +48 -51
  143. package/packages/cli/dist/kb-init.js +1 -1
  144. package/packages/cli/dist/types.d.ts +8 -6
  145. package/packages/cli/dist/types.js +1 -0
  146. package/packages/core/dist/constants.d.ts +58 -34
  147. package/packages/core/dist/constants.js +1 -1
  148. package/packages/core/dist/content-detector.d.ts +8 -8
  149. package/packages/core/dist/content-detector.js +1 -1
  150. package/packages/core/dist/errors.d.ts +15 -13
  151. package/packages/core/dist/errors.js +1 -1
  152. package/packages/core/dist/global-registry.d.ts +62 -0
  153. package/packages/core/dist/global-registry.js +1 -0
  154. package/packages/core/dist/index.d.ts +7 -6
  155. package/packages/core/dist/index.js +1 -1
  156. package/packages/core/dist/logger.d.ts +19 -8
  157. package/packages/core/dist/logger.js +1 -1
  158. package/packages/core/dist/types.d.ts +107 -92
  159. package/packages/core/dist/types.js +1 -0
  160. package/packages/embeddings/dist/embedder.interface.d.ts +22 -20
  161. package/packages/embeddings/dist/embedder.interface.js +1 -0
  162. package/packages/embeddings/dist/index.d.ts +3 -3
  163. package/packages/embeddings/dist/index.js +1 -1
  164. package/packages/embeddings/dist/onnx-embedder.d.ts +21 -23
  165. package/packages/embeddings/dist/onnx-embedder.js +1 -1
  166. package/packages/enterprise-bridge/dist/cache.d.ts +28 -0
  167. package/packages/enterprise-bridge/dist/cache.js +1 -0
  168. package/packages/enterprise-bridge/dist/er-client.d.ts +37 -0
  169. package/packages/enterprise-bridge/dist/er-client.js +1 -0
  170. package/packages/enterprise-bridge/dist/evolution-collector.d.ts +62 -0
  171. package/packages/enterprise-bridge/dist/evolution-collector.js +1 -0
  172. package/packages/enterprise-bridge/dist/index.d.ts +8 -0
  173. package/packages/enterprise-bridge/dist/index.js +1 -0
  174. package/packages/enterprise-bridge/dist/policy-store.d.ts +45 -0
  175. package/packages/enterprise-bridge/dist/policy-store.js +1 -0
  176. package/packages/enterprise-bridge/dist/push-adapter.d.ts +23 -0
  177. package/packages/enterprise-bridge/dist/push-adapter.js +1 -0
  178. package/packages/enterprise-bridge/dist/result-merger.d.ts +14 -0
  179. package/packages/enterprise-bridge/dist/result-merger.js +1 -0
  180. package/packages/enterprise-bridge/dist/types.d.ts +81 -0
  181. package/packages/enterprise-bridge/dist/types.js +1 -0
  182. package/packages/indexer/dist/file-hasher.d.ts +5 -3
  183. package/packages/indexer/dist/file-hasher.js +1 -1
  184. package/packages/indexer/dist/filesystem-crawler.d.ts +23 -21
  185. package/packages/indexer/dist/filesystem-crawler.js +1 -1
  186. package/packages/indexer/dist/graph-extractor.d.ts +9 -13
  187. package/packages/indexer/dist/graph-extractor.js +1 -1
  188. package/packages/indexer/dist/incremental-indexer.d.ts +49 -44
  189. package/packages/indexer/dist/incremental-indexer.js +1 -1
  190. package/packages/indexer/dist/index.d.ts +5 -5
  191. package/packages/indexer/dist/index.js +1 -1
  192. package/packages/server/dist/api.d.ts +3 -8
  193. package/packages/server/dist/api.js +1 -1
  194. package/packages/server/dist/config.d.ts +6 -3
  195. package/packages/server/dist/config.js +1 -1
  196. package/packages/server/dist/cross-workspace.d.ts +43 -0
  197. package/packages/server/dist/cross-workspace.js +1 -0
  198. package/packages/server/dist/curated-manager.d.ts +80 -78
  199. package/packages/server/dist/curated-manager.js +5 -10
  200. package/packages/server/dist/index.d.ts +1 -2
  201. package/packages/server/dist/index.js +1 -1
  202. package/packages/server/dist/replay-interceptor.d.ts +6 -7
  203. package/packages/server/dist/replay-interceptor.js +1 -1
  204. package/packages/server/dist/resources/resources.d.ts +7 -4
  205. package/packages/server/dist/resources/resources.js +2 -2
  206. package/packages/server/dist/server.d.ts +37 -25
  207. package/packages/server/dist/server.js +1 -1
  208. package/packages/server/dist/tools/analyze.tools.d.ts +14 -11
  209. package/packages/server/dist/tools/analyze.tools.js +1 -3
  210. package/packages/server/dist/tools/audit.tool.d.ts +8 -5
  211. package/packages/server/dist/tools/audit.tool.js +1 -4
  212. package/packages/server/dist/tools/bridge.tools.d.ts +34 -0
  213. package/packages/server/dist/tools/bridge.tools.js +15 -0
  214. package/packages/server/dist/tools/evolution.tools.d.ts +7 -0
  215. package/packages/server/dist/tools/evolution.tools.js +5 -0
  216. package/packages/server/dist/tools/forge.tools.d.ts +13 -12
  217. package/packages/server/dist/tools/forge.tools.js +10 -13
  218. package/packages/server/dist/tools/forget.tool.d.ts +7 -4
  219. package/packages/server/dist/tools/forget.tool.js +1 -7
  220. package/packages/server/dist/tools/graph.tool.d.ts +7 -4
  221. package/packages/server/dist/tools/graph.tool.js +4 -5
  222. package/packages/server/dist/tools/list.tool.d.ts +7 -4
  223. package/packages/server/dist/tools/list.tool.js +2 -8
  224. package/packages/server/dist/tools/lookup.tool.d.ts +7 -4
  225. package/packages/server/dist/tools/lookup.tool.js +2 -9
  226. package/packages/server/dist/tools/onboard.tool.d.ts +8 -5
  227. package/packages/server/dist/tools/onboard.tool.js +2 -2
  228. package/packages/server/dist/tools/policy.tools.d.ts +7 -0
  229. package/packages/server/dist/tools/policy.tools.js +2 -0
  230. package/packages/server/dist/tools/produce.tool.d.ts +6 -3
  231. package/packages/server/dist/tools/produce.tool.js +2 -2
  232. package/packages/server/dist/tools/read.tool.d.ts +7 -4
  233. package/packages/server/dist/tools/read.tool.js +2 -6
  234. package/packages/server/dist/tools/reindex.tool.d.ts +10 -7
  235. package/packages/server/dist/tools/reindex.tool.js +3 -2
  236. package/packages/server/dist/tools/remember.tool.d.ts +8 -4
  237. package/packages/server/dist/tools/remember.tool.js +3 -5
  238. package/packages/server/dist/tools/replay.tool.d.ts +6 -3
  239. package/packages/server/dist/tools/replay.tool.js +2 -6
  240. package/packages/server/dist/tools/search.tool.d.ts +10 -5
  241. package/packages/server/dist/tools/search.tool.js +6 -22
  242. package/packages/server/dist/tools/status.tool.d.ts +12 -4
  243. package/packages/server/dist/tools/status.tool.js +2 -3
  244. package/packages/server/dist/tools/toolkit.tools.d.ts +36 -35
  245. package/packages/server/dist/tools/toolkit.tools.js +20 -24
  246. package/packages/server/dist/tools/update.tool.d.ts +7 -4
  247. package/packages/server/dist/tools/update.tool.js +1 -6
  248. package/packages/server/dist/tools/utility.tools.d.ts +15 -15
  249. package/packages/server/dist/tools/utility.tools.js +10 -23
  250. package/packages/server/dist/version-check.d.ts +5 -2
  251. package/packages/server/dist/version-check.js +1 -1
  252. package/packages/store/dist/graph-store.interface.d.ts +89 -87
  253. package/packages/store/dist/graph-store.interface.js +1 -0
  254. package/packages/store/dist/index.d.ts +6 -6
  255. package/packages/store/dist/index.js +1 -1
  256. package/packages/store/dist/lance-store.d.ts +37 -31
  257. package/packages/store/dist/lance-store.js +1 -1
  258. package/packages/store/dist/sqlite-graph-store.d.ts +43 -47
  259. package/packages/store/dist/sqlite-graph-store.js +13 -13
  260. package/packages/store/dist/store-factory.d.ts +11 -8
  261. package/packages/store/dist/store-factory.js +1 -1
  262. package/packages/store/dist/store.interface.d.ts +47 -47
  263. package/packages/store/dist/store.interface.js +1 -0
  264. package/packages/tools/dist/audit.d.ts +61 -62
  265. package/packages/tools/dist/audit.js +4 -5
  266. package/packages/tools/dist/batch.d.ts +20 -18
  267. package/packages/tools/dist/batch.js +1 -1
  268. package/packages/tools/dist/changelog.d.ts +29 -27
  269. package/packages/tools/dist/changelog.js +2 -2
  270. package/packages/tools/dist/check.d.ts +42 -39
  271. package/packages/tools/dist/check.js +2 -2
  272. package/packages/tools/dist/checkpoint.d.ts +17 -15
  273. package/packages/tools/dist/checkpoint.js +1 -2
  274. package/packages/tools/dist/codemod.d.ts +35 -33
  275. package/packages/tools/dist/codemod.js +2 -2
  276. package/packages/tools/dist/compact.d.ts +34 -38
  277. package/packages/tools/dist/compact.js +2 -2
  278. package/packages/tools/dist/data-transform.d.ts +10 -8
  279. package/packages/tools/dist/data-transform.js +1 -1
  280. package/packages/tools/dist/dead-symbols.d.ts +29 -26
  281. package/packages/tools/dist/dead-symbols.js +2 -2
  282. package/packages/tools/dist/delegate.d.ts +26 -24
  283. package/packages/tools/dist/delegate.js +1 -5
  284. package/packages/tools/dist/diff-parse.d.ts +24 -22
  285. package/packages/tools/dist/diff-parse.js +3 -3
  286. package/packages/tools/dist/digest.d.ts +43 -46
  287. package/packages/tools/dist/digest.js +4 -5
  288. package/packages/tools/dist/dogfood-log.d.ts +49 -0
  289. package/packages/tools/dist/dogfood-log.js +2 -0
  290. package/packages/tools/dist/encode.d.ts +11 -9
  291. package/packages/tools/dist/encode.js +1 -1
  292. package/packages/tools/dist/env-info.d.ts +25 -23
  293. package/packages/tools/dist/env-info.js +1 -1
  294. package/packages/tools/dist/eval.d.ts +13 -11
  295. package/packages/tools/dist/eval.js +2 -3
  296. package/packages/tools/dist/evidence-map.d.ts +64 -62
  297. package/packages/tools/dist/evidence-map.js +2 -3
  298. package/packages/tools/dist/file-cache.d.ts +41 -0
  299. package/packages/tools/dist/file-cache.js +3 -0
  300. package/packages/tools/dist/file-summary.d.ts +50 -30
  301. package/packages/tools/dist/file-summary.js +2 -2
  302. package/packages/tools/dist/file-walk.d.ts +6 -4
  303. package/packages/tools/dist/file-walk.js +1 -1
  304. package/packages/tools/dist/find-examples.d.ts +26 -22
  305. package/packages/tools/dist/find-examples.js +3 -3
  306. package/packages/tools/dist/find.d.ts +39 -41
  307. package/packages/tools/dist/find.js +1 -1
  308. package/packages/tools/dist/forge-classify.d.ts +35 -39
  309. package/packages/tools/dist/forge-classify.js +2 -2
  310. package/packages/tools/dist/forge-ground.d.ts +58 -61
  311. package/packages/tools/dist/forge-ground.js +1 -1
  312. package/packages/tools/dist/git-context.d.ts +22 -20
  313. package/packages/tools/dist/git-context.js +3 -3
  314. package/packages/tools/dist/graph-query.d.ts +75 -79
  315. package/packages/tools/dist/graph-query.js +1 -1
  316. package/packages/tools/dist/guide.d.ts +14 -12
  317. package/packages/tools/dist/guide.js +1 -1
  318. package/packages/tools/dist/health.d.ts +13 -11
  319. package/packages/tools/dist/health.js +2 -2
  320. package/packages/tools/dist/http-request.d.ts +20 -18
  321. package/packages/tools/dist/http-request.js +1 -1
  322. package/packages/tools/dist/index.d.ts +55 -53
  323. package/packages/tools/dist/index.js +1 -1
  324. package/packages/tools/dist/lane.d.ts +28 -26
  325. package/packages/tools/dist/lane.js +6 -7
  326. package/packages/tools/dist/measure.d.ts +34 -30
  327. package/packages/tools/dist/measure.js +2 -2
  328. package/packages/tools/dist/onboard.d.ts +29 -27
  329. package/packages/tools/dist/onboard.js +17 -41
  330. package/packages/tools/dist/parse-output.d.ts +48 -46
  331. package/packages/tools/dist/parse-output.js +2 -2
  332. package/packages/tools/dist/path-resolver.d.ts +4 -2
  333. package/packages/tools/dist/path-resolver.js +1 -1
  334. package/packages/tools/dist/process-manager.d.ts +18 -16
  335. package/packages/tools/dist/process-manager.js +1 -1
  336. package/packages/tools/dist/queue.d.ts +28 -26
  337. package/packages/tools/dist/queue.js +1 -2
  338. package/packages/tools/dist/regex-test.d.ts +26 -24
  339. package/packages/tools/dist/regex-test.js +1 -1
  340. package/packages/tools/dist/rename.d.ts +28 -26
  341. package/packages/tools/dist/rename.js +2 -2
  342. package/packages/tools/dist/replay.d.ts +33 -31
  343. package/packages/tools/dist/replay.js +4 -6
  344. package/packages/tools/dist/response-envelope.d.ts +32 -30
  345. package/packages/tools/dist/response-envelope.js +1 -1
  346. package/packages/tools/dist/schema-validate.d.ts +15 -13
  347. package/packages/tools/dist/schema-validate.js +1 -1
  348. package/packages/tools/dist/scope-map.d.ts +45 -48
  349. package/packages/tools/dist/scope-map.js +1 -1
  350. package/packages/tools/dist/snippet.d.ts +26 -25
  351. package/packages/tools/dist/snippet.js +1 -1
  352. package/packages/tools/dist/stash.d.ts +13 -11
  353. package/packages/tools/dist/stash.js +1 -2
  354. package/packages/tools/dist/stratum-card.d.ts +27 -28
  355. package/packages/tools/dist/stratum-card.js +3 -5
  356. package/packages/tools/dist/symbol.d.ts +31 -26
  357. package/packages/tools/dist/symbol.js +3 -3
  358. package/packages/tools/dist/test-run.d.ts +19 -16
  359. package/packages/tools/dist/test-run.js +2 -2
  360. package/packages/tools/dist/text-utils.d.ts +6 -4
  361. package/packages/tools/dist/text-utils.js +2 -2
  362. package/packages/tools/dist/time-utils.d.ts +15 -13
  363. package/packages/tools/dist/time-utils.js +1 -1
  364. package/packages/tools/dist/trace.d.ts +26 -21
  365. package/packages/tools/dist/trace.js +2 -2
  366. package/packages/tools/dist/truncation.d.ts +6 -4
  367. package/packages/tools/dist/truncation.js +6 -13
  368. package/packages/tools/dist/watch.d.ts +28 -26
  369. package/packages/tools/dist/watch.js +1 -1
  370. package/packages/tools/dist/web-fetch.d.ts +35 -33
  371. package/packages/tools/dist/web-fetch.js +6 -12
  372. package/packages/tools/dist/web-search.d.ts +16 -14
  373. package/packages/tools/dist/web-search.js +1 -1
  374. package/packages/tools/dist/workset.d.ts +19 -17
  375. package/packages/tools/dist/workset.js +1 -2
  376. package/packages/tui/dist/App-CYLNJLr6.js +2 -0
  377. package/packages/tui/dist/App.d.ts +11 -6
  378. package/packages/tui/dist/App.js +1 -450
  379. package/packages/tui/dist/CuratedPanel-sYdZAICX.js +2 -0
  380. package/packages/tui/dist/LogPanel-DtMnoyXT.js +3 -0
  381. package/packages/tui/dist/SearchPanel-DREo6zgt.js +2 -0
  382. package/packages/tui/dist/StatusPanel-2ex8fLOO.js +2 -0
  383. package/packages/tui/dist/chunk-D6axbAb-.js +2 -0
  384. package/packages/tui/dist/devtools-DUyj952l.js +7 -0
  385. package/packages/tui/dist/embedder.interface-D4ew0HPW.d.ts +28 -0
  386. package/packages/tui/dist/index-B9VpfVPP.d.ts +13 -0
  387. package/packages/tui/dist/index.d.ts +3 -19
  388. package/packages/tui/dist/index.js +1 -476
  389. package/packages/tui/dist/jsx-runtime-Cof-kwFn.js +316 -0
  390. package/packages/tui/dist/panels/CuratedPanel.d.ts +11 -6
  391. package/packages/tui/dist/panels/CuratedPanel.js +1 -371
  392. package/packages/tui/dist/panels/LogPanel.d.ts +7 -3
  393. package/packages/tui/dist/panels/LogPanel.js +1 -449
  394. package/packages/tui/dist/panels/SearchPanel.d.ts +14 -8
  395. package/packages/tui/dist/panels/SearchPanel.js +1 -372
  396. package/packages/tui/dist/panels/StatusPanel.d.ts +11 -6
  397. package/packages/tui/dist/panels/StatusPanel.js +1 -371
  398. package/packages/tui/dist/store.interface-CnY6SPOH.d.ts +150 -0
  399. package/scaffold/adapters/claude-code.mjs +20 -0
  400. package/scaffold/adapters/copilot.mjs +320 -0
  401. package/scaffold/copilot/agents/Architect-Reviewer-Alpha.agent.md +21 -0
  402. package/scaffold/copilot/agents/Architect-Reviewer-Beta.agent.md +21 -0
  403. package/scaffold/copilot/agents/Documenter.agent.md +42 -0
  404. package/scaffold/copilot/agents/Orchestrator.agent.md +104 -0
  405. package/scaffold/copilot/agents/Planner.agent.md +54 -0
  406. package/scaffold/copilot/agents/Refactor.agent.md +36 -0
  407. package/scaffold/copilot/agents/Researcher-Alpha.agent.md +20 -0
  408. package/scaffold/copilot/agents/Researcher-Beta.agent.md +20 -0
  409. package/scaffold/copilot/agents/Researcher-Delta.agent.md +20 -0
  410. package/scaffold/copilot/agents/Researcher-Gamma.agent.md +20 -0
  411. package/scaffold/definitions/agents.mjs +165 -0
  412. package/scaffold/definitions/bodies.mjs +292 -0
  413. package/scaffold/definitions/hooks.mjs +43 -0
  414. package/scaffold/definitions/models.mjs +56 -0
  415. package/scaffold/definitions/plugins.mjs +24 -0
  416. package/scaffold/definitions/prompts.mjs +145 -0
  417. package/scaffold/definitions/protocols.mjs +322 -0
  418. package/scaffold/definitions/tools.mjs +176 -0
  419. package/scaffold/general/agents/Architect-Reviewer-Alpha.agent.md +21 -0
  420. package/scaffold/general/agents/Architect-Reviewer-Beta.agent.md +21 -0
  421. package/scaffold/general/agents/Code-Reviewer-Alpha.agent.md +12 -0
  422. package/scaffold/general/agents/Code-Reviewer-Beta.agent.md +12 -0
  423. package/scaffold/general/agents/Debugger.agent.md +31 -0
  424. package/scaffold/general/agents/Documenter.agent.md +42 -0
  425. package/scaffold/general/agents/Explorer.agent.md +50 -0
  426. package/scaffold/general/agents/Frontend.agent.md +29 -0
  427. package/scaffold/general/agents/Implementer.agent.md +31 -0
  428. package/scaffold/general/agents/Orchestrator.agent.md +104 -0
  429. package/scaffold/general/agents/Planner.agent.md +55 -0
  430. package/scaffold/general/agents/README.md +57 -0
  431. package/scaffold/general/agents/Refactor.agent.md +36 -0
  432. package/scaffold/general/agents/Researcher-Alpha.agent.md +20 -0
  433. package/scaffold/general/agents/Researcher-Beta.agent.md +20 -0
  434. package/scaffold/general/agents/Researcher-Delta.agent.md +20 -0
  435. package/scaffold/general/agents/Researcher-Gamma.agent.md +20 -0
  436. package/scaffold/general/agents/Security.agent.md +42 -0
  437. package/scaffold/general/agents/_shared/adr-protocol.md +91 -0
  438. package/scaffold/general/agents/_shared/architect-reviewer-base.md +50 -0
  439. package/scaffold/general/agents/_shared/code-agent-base.md +88 -0
  440. package/scaffold/general/agents/_shared/code-reviewer-base.md +54 -0
  441. package/scaffold/general/agents/_shared/decision-protocol.md +27 -0
  442. package/scaffold/general/agents/_shared/forge-protocol.md +46 -0
  443. package/scaffold/general/agents/_shared/researcher-base.md +61 -0
  444. package/scaffold/general/agents/templates/adr-template.md +27 -0
  445. package/scaffold/general/agents/templates/execution-state.md +25 -0
  446. package/scaffold/general/prompts/ask.prompt.md +20 -0
  447. package/scaffold/general/prompts/debug.prompt.md +25 -0
  448. package/scaffold/general/prompts/design.prompt.md +22 -0
  449. package/scaffold/general/prompts/implement.prompt.md +26 -0
  450. package/scaffold/general/prompts/plan.prompt.md +24 -0
  451. package/scaffold/general/prompts/review.prompt.md +31 -0
  452. package/scaffold/generate.mjs +74 -0
  453. package/skills/adr-skill/SKILL.md +329 -0
  454. package/skills/adr-skill/assets/templates/adr-madr.md +89 -0
  455. package/skills/adr-skill/assets/templates/adr-readme.md +20 -0
  456. package/skills/adr-skill/assets/templates/adr-simple.md +46 -0
  457. package/skills/adr-skill/references/adr-conventions.md +95 -0
  458. package/skills/adr-skill/references/examples.md +193 -0
  459. package/skills/adr-skill/references/review-checklist.md +77 -0
  460. package/skills/adr-skill/references/template-variants.md +52 -0
  461. package/skills/adr-skill/scripts/bootstrap_adr.js +259 -0
  462. package/skills/adr-skill/scripts/new_adr.js +391 -0
  463. package/skills/adr-skill/scripts/set_adr_status.js +169 -0
  464. package/skills/brainstorming/SKILL.md +259 -0
  465. package/skills/brainstorming/scripts/frame-template.html +365 -0
  466. package/skills/brainstorming/scripts/helper.js +216 -0
  467. package/skills/brainstorming/scripts/server.cjs +9 -0
  468. package/skills/brainstorming/scripts/server.src.cjs +249 -0
  469. package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  470. package/skills/brainstorming/visual-companion.md +430 -0
  471. package/skills/c4-architecture/SKILL.md +295 -0
  472. package/skills/c4-architecture/references/advanced-patterns.md +552 -0
  473. package/skills/c4-architecture/references/c4-syntax.md +492 -0
  474. package/skills/c4-architecture/references/common-mistakes.md +437 -0
  475. package/skills/knowledge-base/SKILL.md +100 -10
  476. package/skills/lesson-learned/SKILL.md +105 -0
  477. package/skills/lesson-learned/references/anti-patterns.md +55 -0
  478. package/skills/lesson-learned/references/se-principles.md +109 -0
  479. package/skills/requirements-clarity/SKILL.md +324 -0
  480. package/skills/session-handoff/SKILL.md +189 -0
  481. package/skills/session-handoff/references/handoff-template.md +139 -0
  482. package/skills/session-handoff/references/resume-checklist.md +80 -0
  483. package/skills/session-handoff/scripts/check_staleness.js +269 -0
  484. package/skills/session-handoff/scripts/create_handoff.js +299 -0
  485. package/skills/session-handoff/scripts/list_handoffs.js +113 -0
  486. package/skills/session-handoff/scripts/validate_handoff.js +241 -0
  487. package/packages/chunker/dist/treesitter-chunker.d.ts +0 -47
  488. package/packages/chunker/dist/treesitter-chunker.js +0 -8
  489. package/packages/cli/dist/commands/init.d.ts +0 -10
  490. package/packages/cli/dist/commands/init.js +0 -308
@@ -1 +1 @@
1
- import{existsSync as d,readFileSync as g}from"node:fs";import{dirname as p,resolve as o}from"node:path";import{initializeTreeSitter as m}from"../../chunker/dist/index.js";import{OnnxEmbedder as l}from"../../embeddings/dist/index.js";import{IncrementalIndexer as u}from"../../indexer/dist/index.js";import{createStore as f,SqliteGraphStore as h}from"../../store/dist/index.js";function y(){const t=process.env.KB_CONFIG_PATH??(d(o(process.cwd(),"kb.config.json"))?o(process.cwd(),"kb.config.json"):null);t||(console.error("No kb.config.json found in current directory."),console.error("Run `kb init` to create one, or set KB_CONFIG_PATH."),process.exit(1));const r=g(t,"utf-8"),e=JSON.parse(r),n=p(t);return e.sources=e.sources.map(s=>({...s,path:o(n,s.path)})),e.store.path=o(n,e.store.path),e.curated=e.curated??{path:"curated"},e.curated.path=o(n,e.curated.path),e}async function x(){const t=y(),r=new l({model:t.embedding.model,dimensions:t.embedding.dimensions});await r.initialize();const e=await f({backend:t.store.backend,path:t.store.path});await e.initialize();const n=new u(r,e),{CuratedKnowledgeManager:s}=await import("../../server/dist/curated-manager.js"),c=new s(t.curated.path,e,r);let i;try{const a=new h({path:t.store.path});await a.initialize(),i=a,n.setGraphStore(i)}catch(a){console.error(`[kb] Graph store init failed (non-fatal): ${a.message}`),i={initialize:async()=>{},upsertNode:async()=>{},upsertEdge:async()=>{},upsertNodes:async()=>{},upsertEdges:async()=>{},getNode:async()=>null,getNeighbors:async()=>({nodes:[],edges:[]}),traverse:async()=>({nodes:[],edges:[]}),findNodes:async()=>[],findEdges:async()=>[],deleteNode:async()=>{},deleteBySourcePath:async()=>0,clear:async()=>{},getStats:async()=>({nodeCount:0,edgeCount:0,nodeTypes:{},edgeTypes:{}}),close:async()=>{}}}return await m().catch(()=>{}),{config:t,embedder:r,store:e,graphStore:i,indexer:n,curated:c}}export{x as initKB};
1
+ import{existsSync as e,readFileSync as t}from"node:fs";import{dirname as n,resolve as r}from"node:path";import{initializeWasm as i}from"../../chunker/dist/index.js";import{OnnxEmbedder as a}from"../../embeddings/dist/index.js";import{IncrementalIndexer as o}from"../../indexer/dist/index.js";import{SqliteGraphStore as s,createStore as c}from"../../store/dist/index.js";function l(){let i=process.env.KB_CONFIG_PATH??(e(r(process.cwd(),`kb.config.json`))?r(process.cwd(),`kb.config.json`):null);i||(console.error(`No kb.config.json found in current directory.`),console.error("Run `kb init` to create one, or set KB_CONFIG_PATH."),process.exit(1));let a=t(i,`utf-8`),o;try{o=JSON.parse(a)}catch{console.error(`Failed to parse ${i} as JSON. Ensure the file contains valid JSON.`),process.exit(1)}let s=n(i);return o.sources=o.sources.map(e=>({...e,path:r(s,e.path)})),o.store.path=r(s,o.store.path),o.curated=o.curated??{path:`curated`},o.curated.path=r(s,o.curated.path),o}async function u(){let e=l(),t=new a({model:e.embedding.model,dimensions:e.embedding.dimensions});await t.initialize();let n=await c({backend:e.store.backend,path:e.store.path});await n.initialize();let r=new o(t,n),{CuratedKnowledgeManager:u}=await import(`../../server/dist/curated-manager.js`),d=new u(e.curated.path,n,t),f;try{let t=new s({path:e.store.path});await t.initialize(),f=t,r.setGraphStore(f)}catch(e){console.error(`[kb] Graph store init failed (non-fatal): ${e.message}`),f={initialize:async()=>{},upsertNode:async()=>{},upsertEdge:async()=>{},upsertNodes:async()=>{},upsertEdges:async()=>{},getNode:async()=>null,getNeighbors:async()=>({nodes:[],edges:[]}),traverse:async()=>({nodes:[],edges:[]}),findNodes:async()=>[],findEdges:async()=>[],deleteNode:async()=>{},deleteBySourcePath:async()=>0,clear:async()=>{},getStats:async()=>({nodeCount:0,edgeCount:0,nodeTypes:{},edgeTypes:{}}),close:async()=>{}}}return await i().catch(()=>{}),{config:e,embedder:t,store:n,graphStore:f,indexer:r,curated:d}}export{u as initKB};
@@ -1,7 +1,9 @@
1
- export interface Command {
2
- name: string;
3
- description: string;
4
- usage?: string;
5
- run: (args: string[]) => Promise<void>;
1
+ //#region packages/cli/src/types.d.ts
2
+ interface Command {
3
+ name: string;
4
+ description: string;
5
+ usage?: string;
6
+ run: (args: string[]) => Promise<void>;
6
7
  }
7
- //# sourceMappingURL=types.d.ts.map
8
+ //#endregion
9
+ export { Command };
@@ -0,0 +1 @@
1
+ export{};
@@ -1,49 +1,73 @@
1
+ //#region packages/core/src/constants.d.ts
1
2
  /**
2
3
  * Default constants for the Knowledge Base system.
3
4
  */
5
+ /**
6
+ * Centralized directory paths for all KB artifacts.
7
+ * Single source of truth — change here to update everywhere.
8
+ */
9
+ declare const KB_PATHS: {
10
+ /** AI artifacts root directory */readonly ai: ".ai"; /** Onboard / produce_knowledge output directory */
11
+ readonly aiKb: ".ai/kb"; /** Curated knowledge directory */
12
+ readonly aiCurated: ".ai/curated"; /** Vector store + graph data */
13
+ readonly data: ".kb-data"; /** Session state (stash, lanes, checkpoints, worksets, queues, replay, evidence-maps, snippets) */
14
+ readonly state: ".kb-state"; /** Persistent warn/error logs for dogfooding review */
15
+ readonly logs: ".kb-state/logs"; /** Brainstorming sessions */
16
+ readonly brainstorm: ".brainstorm"; /** Session handoff documents */
17
+ readonly handoffs: ".handoffs";
18
+ };
19
+ /**
20
+ * Global-mode directory paths (under ~/.kb-data/).
21
+ * Used when KB is installed at user level rather than per-workspace.
22
+ */
23
+ declare const KB_GLOBAL_PATHS: {
24
+ /** Root directory name for global data store */readonly root: ".kb-data"; /** Registry file tracking all enrolled workspaces */
25
+ readonly registry: "registry.json";
26
+ };
4
27
  /** Default chunk sizes by content type */
5
- export declare const CHUNK_SIZES: {
6
- readonly markdown: {
7
- readonly max: 1500;
8
- readonly min: 100;
9
- };
10
- readonly code: {
11
- readonly max: 2000;
12
- readonly min: 50;
13
- };
14
- readonly config: {
15
- readonly max: 3000;
16
- readonly min: 50;
17
- };
18
- readonly default: {
19
- readonly max: 1500;
20
- readonly min: 100;
21
- readonly overlap: 200;
22
- };
28
+ declare const CHUNK_SIZES: {
29
+ readonly markdown: {
30
+ readonly max: 1500;
31
+ readonly min: 100;
32
+ };
33
+ readonly code: {
34
+ readonly max: 2000;
35
+ readonly min: 50;
36
+ };
37
+ readonly config: {
38
+ readonly max: 3000;
39
+ readonly min: 50;
40
+ };
41
+ readonly default: {
42
+ readonly max: 1500;
43
+ readonly min: 100;
44
+ readonly overlap: 200;
45
+ };
23
46
  };
24
47
  /** Default embedding config */
25
- export declare const EMBEDDING_DEFAULTS: {
26
- readonly model: "mixedbread-ai/mxbai-embed-large-v1";
27
- readonly dimensions: 1024;
48
+ declare const EMBEDDING_DEFAULTS: {
49
+ readonly model: "mixedbread-ai/mxbai-embed-large-v1";
50
+ readonly dimensions: 1024;
28
51
  };
29
52
  /** Default store config */
30
- export declare const STORE_DEFAULTS: {
31
- readonly backend: "lancedb";
32
- readonly path: ".kb-data";
33
- readonly tableName: "knowledge";
53
+ declare const STORE_DEFAULTS: {
54
+ readonly backend: "lancedb";
55
+ readonly path: ".kb-data";
56
+ readonly tableName: "knowledge";
34
57
  };
35
58
  /** File size limits */
36
- export declare const FILE_LIMITS: {
37
- readonly maxFileSizeBytes: 1000000;
38
- readonly maxCuratedFileSizeBytes: 50000;
59
+ declare const FILE_LIMITS: {
60
+ readonly maxFileSizeBytes: 1000000;
61
+ readonly maxCuratedFileSizeBytes: 50000;
39
62
  };
40
63
  /** Search defaults */
41
- export declare const SEARCH_DEFAULTS: {
42
- readonly maxResults: 10;
43
- readonly minScore: 0.25;
64
+ declare const SEARCH_DEFAULTS: {
65
+ readonly maxResults: 10;
66
+ readonly minScore: 0.25;
44
67
  };
45
68
  /** Category validation regex */
46
- export declare const CATEGORY_PATTERN: RegExp;
69
+ declare const CATEGORY_PATTERN: RegExp;
47
70
  /** Default knowledge categories */
48
- export declare const DEFAULT_CATEGORIES: readonly ["decisions", "patterns", "troubleshooting", "conventions", "architecture"];
49
- //# sourceMappingURL=constants.d.ts.map
71
+ declare const DEFAULT_CATEGORIES: readonly ["decisions", "patterns", "troubleshooting", "conventions", "architecture"];
72
+ //#endregion
73
+ export { CATEGORY_PATTERN, CHUNK_SIZES, DEFAULT_CATEGORIES, EMBEDDING_DEFAULTS, FILE_LIMITS, KB_GLOBAL_PATHS, KB_PATHS, SEARCH_DEFAULTS, STORE_DEFAULTS };
@@ -1 +1 @@
1
- const e={markdown:{max:1500,min:100},code:{max:2e3,min:50},config:{max:3e3,min:50},default:{max:1500,min:100,overlap:200}},t={model:"mixedbread-ai/mxbai-embed-large-v1",dimensions:1024},o={backend:"lancedb",path:".kb-data",tableName:"knowledge"},a={maxFileSizeBytes:1e6,maxCuratedFileSizeBytes:5e4},n={maxResults:10,minScore:.25},s=/^[a-z][a-z0-9-]*$/,c=["decisions","patterns","troubleshooting","conventions","architecture"];export{s as CATEGORY_PATTERN,e as CHUNK_SIZES,c as DEFAULT_CATEGORIES,t as EMBEDDING_DEFAULTS,a as FILE_LIMITS,n as SEARCH_DEFAULTS,o as STORE_DEFAULTS};
1
+ const e={ai:`.ai`,aiKb:`.ai/kb`,aiCurated:`.ai/curated`,data:`.kb-data`,state:`.kb-state`,logs:`.kb-state/logs`,brainstorm:`.brainstorm`,handoffs:`.handoffs`},t={root:`.kb-data`,registry:`registry.json`},n={markdown:{max:1500,min:100},code:{max:2e3,min:50},config:{max:3e3,min:50},default:{max:1500,min:100,overlap:200}},r={model:`mixedbread-ai/mxbai-embed-large-v1`,dimensions:1024},i={backend:`lancedb`,path:e.data,tableName:`knowledge`},a={maxFileSizeBytes:1e6,maxCuratedFileSizeBytes:5e4},o={maxResults:10,minScore:.25},s=/^[a-z][a-z0-9-]*$/,c=[`decisions`,`patterns`,`troubleshooting`,`conventions`,`architecture`];export{s as CATEGORY_PATTERN,n as CHUNK_SIZES,c as DEFAULT_CATEGORIES,r as EMBEDDING_DEFAULTS,a as FILE_LIMITS,t as KB_GLOBAL_PATHS,e as KB_PATHS,o as SEARCH_DEFAULTS,i as STORE_DEFAULTS};
@@ -1,13 +1,13 @@
1
- /**
2
- * Detects content type from file path and extension.
3
- */
4
- import type { ContentType, SourceType } from './types.js';
1
+ import { ContentType, SourceType } from "./types.js";
2
+
3
+ //#region packages/core/src/content-detector.d.ts
5
4
  /**
6
5
  * Detect the content type of a file based on its path.
7
6
  */
8
- export declare function detectContentType(filePath: string): ContentType;
7
+ declare function detectContentType(filePath: string): ContentType;
9
8
  /** Derive the coarse SourceType from a ContentType. */
10
- export declare function contentTypeToSourceType(ct: ContentType): SourceType;
9
+ declare function contentTypeToSourceType(ct: ContentType): SourceType;
11
10
  /** Get all ContentTypes that belong to a given SourceType. */
12
- export declare function sourceTypeContentTypes(st: SourceType): ContentType[];
13
- //# sourceMappingURL=content-detector.d.ts.map
11
+ declare function sourceTypeContentTypes(st: SourceType): ContentType[];
12
+ //#endregion
13
+ export { contentTypeToSourceType, detectContentType, sourceTypeContentTypes };
@@ -1 +1 @@
1
- import{basename as r,extname as p}from"node:path";const n={".ts":"code-typescript",".tsx":"code-typescript",".mts":"code-typescript",".cts":"code-typescript",".js":"code-javascript",".jsx":"code-javascript",".mjs":"code-javascript",".cjs":"code-javascript",".py":"code-python",".json":"config-json",".yaml":"config-yaml",".yml":"config-yaml",".toml":"config-toml",".env":"config-env",".md":"markdown",".mdx":"markdown"},i=[/\.test\.[jt]sx?$/,/\.spec\.[jt]sx?$/,/(^|\/)__tests__\//,/(^|\/)test\//,/(^|\/)tests\//,/(^|\/)spec\//,/(^|\/)fixtures\//],d=[/\.stack\.[jt]s$/,/(^|\/)stacks\//,/(^|\/)constructs\//,/cdk\.json$/];function m(e){const t=p(e).toLowerCase(),s=r(e).toLowerCase();return e.includes("curated/")?"curated-knowledge":i.some(o=>o.test(e))?"test-code":d.some(o=>o.test(e))?"cdk-stack":t in n?n[t]:s.startsWith(".env")?"config-env":[".go",".rs",".java",".rb",".php",".sh",".ps1",".sql",".graphql",".proto",".css",".scss",".less",".html",".htm",".vue",".svelte",".astro",".hbs",".ejs",".svg"].includes(t)?"code-other":"unknown"}const c={"code-typescript":"source","code-javascript":"source","code-python":"source","code-other":"source","cdk-stack":"source","test-code":"test",markdown:"documentation",documentation:"documentation","curated-knowledge":"documentation","produced-knowledge":"documentation","config-json":"config","config-yaml":"config","config-toml":"config","config-env":"config",unknown:"source"};function y(e){return c[e]??"source"}function T(e){return Object.entries(c).filter(([,t])=>t===e).map(([t])=>t)}export{y as contentTypeToSourceType,m as detectContentType,T as sourceTypeContentTypes};
1
+ import{KB_PATHS as e}from"./constants.js";import{basename as t,extname as n}from"node:path";const r={".ts":`code-typescript`,".tsx":`code-typescript`,".mts":`code-typescript`,".cts":`code-typescript`,".js":`code-javascript`,".jsx":`code-javascript`,".mjs":`code-javascript`,".cjs":`code-javascript`,".py":`code-python`,".json":`config-json`,".yaml":`config-yaml`,".yml":`config-yaml`,".toml":`config-toml`,".env":`config-env`,".md":`markdown`,".mdx":`markdown`},i=[/\.test\.[jt]sx?$/,/\.spec\.[jt]sx?$/,/(^|\/)__tests__\//,/(^|\/)test\//,/(^|\/)tests\//,/(^|\/)spec\//,/(^|\/)fixtures\//],a=[/\.stack\.[jt]s$/,/(^|\/)stacks\//,/(^|\/)constructs\//,/cdk\.json$/];function o(o){let s=n(o).toLowerCase(),c=t(o).toLowerCase();return o.includes(`${e.aiKb}/`)?`produced-knowledge`:o.includes(`${e.aiCurated}/`)?`curated-knowledge`:i.some(e=>e.test(o))?`test-code`:a.some(e=>e.test(o))?`cdk-stack`:s in r?r[s]:c.startsWith(`.env`)?`config-env`:[`.go`,`.rs`,`.java`,`.rb`,`.php`,`.sh`,`.ps1`,`.sql`,`.graphql`,`.proto`,`.css`,`.scss`,`.less`,`.html`,`.htm`,`.vue`,`.svelte`,`.astro`,`.hbs`,`.ejs`,`.svg`].includes(s)?`code-other`:`unknown`}const s={"code-typescript":`source`,"code-javascript":`source`,"code-python":`source`,"code-other":`source`,"cdk-stack":`source`,"test-code":`test`,markdown:`documentation`,documentation:`documentation`,"curated-knowledge":`documentation`,"produced-knowledge":`documentation`,"config-json":`config`,"config-yaml":`config`,"config-toml":`config`,"config-env":`config`,unknown:`source`};function c(e){return s[e]??`source`}function l(e){return Object.entries(s).filter(([,t])=>t===e).map(([e])=>e)}export{c as contentTypeToSourceType,o as detectContentType,l as sourceTypeContentTypes};
@@ -1,18 +1,20 @@
1
- export declare class KBError extends Error {
2
- readonly code: string;
3
- readonly cause?: unknown | undefined;
4
- constructor(message: string, code: string, cause?: unknown | undefined);
1
+ //#region packages/core/src/errors.d.ts
2
+ declare class KBError extends Error {
3
+ readonly code: string;
4
+ readonly cause?: unknown | undefined;
5
+ constructor(message: string, code: string, cause?: unknown | undefined);
5
6
  }
6
- export declare class EmbeddingError extends KBError {
7
- constructor(message: string, cause?: unknown);
7
+ declare class EmbeddingError extends KBError {
8
+ constructor(message: string, cause?: unknown);
8
9
  }
9
- export declare class StoreError extends KBError {
10
- constructor(message: string, cause?: unknown);
10
+ declare class StoreError extends KBError {
11
+ constructor(message: string, cause?: unknown);
11
12
  }
12
- export declare class IndexError extends KBError {
13
- constructor(message: string, cause?: unknown);
13
+ declare class IndexError extends KBError {
14
+ constructor(message: string, cause?: unknown);
14
15
  }
15
- export declare class ConfigError extends KBError {
16
- constructor(message: string, cause?: unknown);
16
+ declare class ConfigError extends KBError {
17
+ constructor(message: string, cause?: unknown);
17
18
  }
18
- //# sourceMappingURL=errors.d.ts.map
19
+ //#endregion
20
+ export { ConfigError, EmbeddingError, IndexError, KBError, StoreError };
@@ -1 +1 @@
1
- class s extends Error{constructor(r,e,t){super(r);this.code=e;this.cause=t;this.name="KBError"}}class E extends s{constructor(n,r){super(n,"EMBEDDING_ERROR",r),this.name="EmbeddingError"}}class c extends s{constructor(n,r){super(n,"STORE_ERROR",r),this.name="StoreError"}}class u extends s{constructor(n,r){super(n,"INDEX_ERROR",r),this.name="IndexError"}}class i extends s{constructor(n,r){super(n,"CONFIG_ERROR",r),this.name="ConfigError"}}export{i as ConfigError,E as EmbeddingError,u as IndexError,s as KBError,c as StoreError};
1
+ var e=class extends Error{constructor(e,t,n){super(e),this.code=t,this.cause=n,this.name=`KBError`}},t=class extends e{constructor(e,t){super(e,`EMBEDDING_ERROR`,t),this.name=`EmbeddingError`}},n=class extends e{constructor(e,t){super(e,`STORE_ERROR`,t),this.name=`StoreError`}},r=class extends e{constructor(e,t){super(e,`INDEX_ERROR`,t),this.name=`IndexError`}},i=class extends e{constructor(e,t){super(e,`CONFIG_ERROR`,t),this.name=`ConfigError`}};export{i as ConfigError,t as EmbeddingError,r as IndexError,e as KBError,n as StoreError};
@@ -0,0 +1,62 @@
1
+ //#region packages/core/src/global-registry.d.ts
2
+ /**
3
+ * Global registry for tracking workspaces enrolled in global MCP install mode.
4
+ * Registry lives at ~/.kb-data/registry.json alongside per-workspace partition directories.
5
+ */
6
+ /** A single workspace entry in the global registry. */
7
+ interface RegistryEntry {
8
+ /** Partition key: <folder-name>-<sha256-8chars> */
9
+ partition: string;
10
+ /** Absolute path to workspace root */
11
+ workspacePath: string;
12
+ /** ISO timestamp of first registration */
13
+ registeredAt: string;
14
+ /** ISO timestamp of last server start */
15
+ lastAccessedAt: string;
16
+ }
17
+ /** Schema for ~/.kb-data/registry.json */
18
+ interface GlobalRegistry {
19
+ version: 1;
20
+ workspaces: Record<string, RegistryEntry>;
21
+ }
22
+ /**
23
+ * Get the global data directory root.
24
+ * Override with `KB_GLOBAL_DATA_DIR` env var for testing.
25
+ */
26
+ declare function getGlobalDataDir(): string;
27
+ /**
28
+ * Compute a deterministic partition key from a workspace path.
29
+ * Format: <folder-basename>-<sha256(absolutePath)-first8hex>
30
+ */
31
+ declare function computePartitionKey(cwd: string): string;
32
+ /**
33
+ * Load the global registry. Returns empty registry if file doesn't exist.
34
+ */
35
+ declare function loadRegistry(): GlobalRegistry;
36
+ /**
37
+ * Save the global registry atomically (write to .tmp then rename).
38
+ */
39
+ declare function saveRegistry(registry: GlobalRegistry): void;
40
+ /**
41
+ * Register a workspace in the global registry. Creates partition directory.
42
+ * If already registered, updates lastAccessedAt.
43
+ */
44
+ declare function registerWorkspace(cwd: string): RegistryEntry;
45
+ /**
46
+ * Look up a workspace in the registry by cwd.
47
+ */
48
+ declare function lookupWorkspace(cwd: string): RegistryEntry | undefined;
49
+ /**
50
+ * List all registered workspaces.
51
+ */
52
+ declare function listWorkspaces(): RegistryEntry[];
53
+ /**
54
+ * Get the absolute path to a partition's data directory.
55
+ */
56
+ declare function getPartitionDir(partition: string): string;
57
+ /**
58
+ * Check whether global mode is installed (registry.json exists in ~/.kb-data/).
59
+ */
60
+ declare function isGlobalInstalled(): boolean;
61
+ //#endregion
62
+ export { GlobalRegistry, RegistryEntry, computePartitionKey, getGlobalDataDir, getPartitionDir, isGlobalInstalled, listWorkspaces, loadRegistry, lookupWorkspace, registerWorkspace, saveRegistry };
@@ -0,0 +1 @@
1
+ import{KB_GLOBAL_PATHS as e}from"./constants.js";import{basename as t,resolve as n}from"node:path";import{createHash as r}from"node:crypto";import{existsSync as i,mkdirSync as a,readFileSync as o,renameSync as s,writeFileSync as c}from"node:fs";import{homedir as l}from"node:os";function u(){return process.env.KB_GLOBAL_DATA_DIR??n(l(),e.root)}function d(e){let i=n(e);return`${t(i).toLowerCase().replace(/[^a-z0-9-]/g,`-`)||`workspace`}-${r(`sha256`).update(i).digest(`hex`).slice(0,8)}`}function f(){let t=n(u(),e.registry);if(!i(t))return{version:1,workspaces:{}};let r=o(t,`utf-8`);return JSON.parse(r)}function p(t){let r=u();a(r,{recursive:!0});let i=n(r,e.registry),o=`${i}.tmp`;c(o,JSON.stringify(t,null,2),`utf-8`),s(o,i)}function m(e){let t=f(),r=d(e),i=new Date().toISOString();return t.workspaces[r]?t.workspaces[r].lastAccessedAt=i:t.workspaces[r]={partition:r,workspacePath:n(e),registeredAt:i,lastAccessedAt:i},a(_(r),{recursive:!0}),p(t),t.workspaces[r]}function h(e){let t=f(),n=d(e);return t.workspaces[n]}function g(){let e=f();return Object.values(e.workspaces)}function _(e){return n(u(),e)}function v(){return i(n(u(),e.registry))}export{d as computePartitionKey,u as getGlobalDataDir,_ as getPartitionDir,v as isGlobalInstalled,g as listWorkspaces,f as loadRegistry,h as lookupWorkspace,m as registerWorkspace,p as saveRegistry};
@@ -1,6 +1,7 @@
1
- export * from './constants.js';
2
- export { contentTypeToSourceType, detectContentType, sourceTypeContentTypes, } from './content-detector.js';
3
- export * from './errors.js';
4
- export * from './logger.js';
5
- export * from './types.js';
6
- //# sourceMappingURL=index.d.ts.map
1
+ import { CATEGORY_PATTERN, CHUNK_SIZES, DEFAULT_CATEGORIES, EMBEDDING_DEFAULTS, FILE_LIMITS, KB_GLOBAL_PATHS, KB_PATHS, SEARCH_DEFAULTS, STORE_DEFAULTS } from "./constants.js";
2
+ import { CONTENT_TYPES, ChunkMetadata, ContentType, IndexStats, KBConfig, KNOWLEDGE_ORIGINS, KnowledgeOrigin, KnowledgeRecord, RawChunk, SOURCE_TYPES, SearchResult, SourceType } from "./types.js";
3
+ import { contentTypeToSourceType, detectContentType, sourceTypeContentTypes } from "./content-detector.js";
4
+ import { ConfigError, EmbeddingError, IndexError, KBError, StoreError } from "./errors.js";
5
+ import { GlobalRegistry, RegistryEntry, computePartitionKey, getGlobalDataDir, getPartitionDir, isGlobalInstalled, listWorkspaces, loadRegistry, lookupWorkspace, registerWorkspace, saveRegistry } from "./global-registry.js";
6
+ import { LogLevel, createLogger, getLogLevel, resetLogDir, serializeError, setFileSinkEnabled, setLogLevel } from "./logger.js";
7
+ export { CATEGORY_PATTERN, CHUNK_SIZES, CONTENT_TYPES, ChunkMetadata, ConfigError, ContentType, DEFAULT_CATEGORIES, EMBEDDING_DEFAULTS, EmbeddingError, FILE_LIMITS, GlobalRegistry, IndexError, IndexStats, KBConfig, KBError, KB_GLOBAL_PATHS, KB_PATHS, KNOWLEDGE_ORIGINS, KnowledgeOrigin, KnowledgeRecord, LogLevel, RawChunk, RegistryEntry, SEARCH_DEFAULTS, SOURCE_TYPES, STORE_DEFAULTS, SearchResult, SourceType, StoreError, computePartitionKey, contentTypeToSourceType, createLogger, detectContentType, getGlobalDataDir, getLogLevel, getPartitionDir, isGlobalInstalled, listWorkspaces, loadRegistry, lookupWorkspace, registerWorkspace, resetLogDir, saveRegistry, serializeError, setFileSinkEnabled, setLogLevel, sourceTypeContentTypes };
@@ -1 +1 @@
1
- export*from"./constants.js";import{contentTypeToSourceType as r,detectContentType as p,sourceTypeContentTypes as n}from"./content-detector.js";export*from"./errors.js";export*from"./logger.js";export*from"./types.js";export{r as contentTypeToSourceType,p as detectContentType,n as sourceTypeContentTypes};
1
+ import{CATEGORY_PATTERN as e,CHUNK_SIZES as t,DEFAULT_CATEGORIES as n,EMBEDDING_DEFAULTS as r,FILE_LIMITS as i,KB_GLOBAL_PATHS as a,KB_PATHS as o,SEARCH_DEFAULTS as s,STORE_DEFAULTS as c}from"./constants.js";import{contentTypeToSourceType as l,detectContentType as u,sourceTypeContentTypes as d}from"./content-detector.js";import{ConfigError as f,EmbeddingError as p,IndexError as m,KBError as h,StoreError as g}from"./errors.js";import{computePartitionKey as _,getGlobalDataDir as v,getPartitionDir as y,isGlobalInstalled as b,listWorkspaces as x,loadRegistry as S,lookupWorkspace as C,registerWorkspace as w,saveRegistry as T}from"./global-registry.js";import{createLogger as E,getLogLevel as D,resetLogDir as O,serializeError as k,setFileSinkEnabled as A,setLogLevel as j}from"./logger.js";import{CONTENT_TYPES as M,KNOWLEDGE_ORIGINS as N,SOURCE_TYPES as P}from"./types.js";export{e as CATEGORY_PATTERN,t as CHUNK_SIZES,M as CONTENT_TYPES,f as ConfigError,n as DEFAULT_CATEGORIES,r as EMBEDDING_DEFAULTS,p as EmbeddingError,i as FILE_LIMITS,m as IndexError,h as KBError,a as KB_GLOBAL_PATHS,o as KB_PATHS,N as KNOWLEDGE_ORIGINS,s as SEARCH_DEFAULTS,P as SOURCE_TYPES,c as STORE_DEFAULTS,g as StoreError,_ as computePartitionKey,l as contentTypeToSourceType,E as createLogger,u as detectContentType,v as getGlobalDataDir,D as getLogLevel,y as getPartitionDir,b as isGlobalInstalled,x as listWorkspaces,S as loadRegistry,C as lookupWorkspace,w as registerWorkspace,O as resetLogDir,T as saveRegistry,k as serializeError,A as setFileSinkEnabled,j as setLogLevel,d as sourceTypeContentTypes};
@@ -1,9 +1,20 @@
1
- export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
2
- export declare function setLogLevel(level: LogLevel): void;
3
- export declare function createLogger(component: string): {
4
- debug: (msg: string, data?: Record<string, unknown>) => void;
5
- info: (msg: string, data?: Record<string, unknown>) => void;
6
- warn: (msg: string, data?: Record<string, unknown>) => void;
7
- error: (msg: string, data?: Record<string, unknown>) => void;
1
+ //#region packages/core/src/logger.d.ts
2
+ type LogLevel = 'debug' | 'info' | 'warn' | 'error';
3
+ declare function setLogLevel(level: LogLevel): void;
4
+ declare function getLogLevel(): LogLevel;
5
+ declare function setFileSinkEnabled(enabled: boolean): void;
6
+ /** Reset resolved log directory (for testing). */
7
+ declare function resetLogDir(): void;
8
+ /**
9
+ * Serialize an unknown error into a structured record suitable for JSON logging.
10
+ * Includes stack traces only at debug level to keep production logs concise.
11
+ */
12
+ declare function serializeError(err: unknown): Record<string, unknown>;
13
+ declare function createLogger(component: string): {
14
+ debug: (msg: string, data?: Record<string, unknown>) => void;
15
+ info: (msg: string, data?: Record<string, unknown>) => void;
16
+ warn: (msg: string, data?: Record<string, unknown>) => void;
17
+ error: (msg: string, data?: Record<string, unknown>) => void;
8
18
  };
9
- //# sourceMappingURL=logger.d.ts.map
19
+ //#endregion
20
+ export { LogLevel, createLogger, getLogLevel, resetLogDir, serializeError, setFileSinkEnabled, setLogLevel };
@@ -1 +1 @@
1
- const t={debug:0,info:1,warn:2,error:3};let g=process.env.KB_LOG_LEVEL??"info";function s(o){g=o}function u(o){function e(n,r,i){if(t[n]<t[g])return;const L={ts:new Date().toISOString(),level:n,component:o,msg:r,...i};console.error(JSON.stringify(L))}return{debug:(n,r)=>e("debug",n,r),info:(n,r)=>e("info",n,r),warn:(n,r)=>e("warn",n,r),error:(n,r)=>e("error",n,r)}}export{u as createLogger,s as setLogLevel};
1
+ import{KB_PATHS as e}from"./constants.js";import{join as t,resolve as n}from"node:path";import{appendFileSync as r,mkdirSync as i,readdirSync as a,unlinkSync as o}from"node:fs";const s={debug:0,info:1,warn:2,error:3};let c=process.env.KB_LOG_LEVEL??`info`,l=process.env.KB_LOG_FILE_SINK===`true`||process.env.KB_LOG_FILE_SINK!==`false`&&!process.env.VITEST&&process.env.NODE_ENV!==`test`;function u(){return l?process.env.VITEST||process.env.NODE_ENV===`test`?process.env.KB_LOG_FILE_SINK===`true`:!0:!1}let d;function f(){return d||=n(process.cwd(),e.logs),d}function p(e){let n=e.toISOString().slice(0,10);return t(f(),`${n}.jsonl`)}let m=0;function h(){let e=Date.now();if(!(e-m<36e5)){m=e;try{let n=f(),r=new Date(e-30*864e5).toISOString().slice(0,10);for(let e of a(n))if(e.endsWith(`.jsonl`)&&e.slice(0,10)<r)try{o(t(n,e))}catch{}}catch{}}}function g(e,t){try{i(f(),{recursive:!0}),r(p(t),`${e}\n`),h()}catch{}}function _(e){c=e}function v(){return c}function y(e){l=e}function b(){d=void 0}function x(e){if(e instanceof Error){let t={error:e.message};return c===`debug`&&e.stack&&(t.stack=e.stack),t}return{error:String(e)}}function S(e){function t(t,n,r){if(s[t]<s[c])return;let i=new Date,a={ts:i.toISOString(),level:t,component:e,msg:n,...r},o=JSON.stringify(a);console.error(o),u()&&(t===`warn`||t===`error`)&&g(o,i)}return{debug:(e,n)=>t(`debug`,e,n),info:(e,n)=>t(`info`,e,n),warn:(e,n)=>t(`warn`,e,n),error:(e,n)=>t(`error`,e,n)}}export{S as createLogger,v as getLogLevel,b as resetLogDir,x as serializeError,y as setFileSinkEnabled,_ as setLogLevel};
@@ -1,110 +1,125 @@
1
+ //#region packages/core/src/types.d.ts
1
2
  /**
2
3
  * Core types for the MCP Knowledge Base system.
3
4
  */
4
5
  /** The origin of a knowledge record — how it was created */
5
- export type KnowledgeOrigin = 'indexed' | 'curated' | 'produced';
6
+ declare const KNOWLEDGE_ORIGINS: readonly ["indexed", "curated", "produced"];
7
+ type KnowledgeOrigin = (typeof KNOWLEDGE_ORIGINS)[number];
6
8
  /** Coarse source classification derived from ContentType */
7
- export type SourceType = 'source' | 'documentation' | 'test' | 'config' | 'generated';
9
+ declare const SOURCE_TYPES: readonly ["source", "documentation", "test", "config", "generated"];
10
+ type SourceType = (typeof SOURCE_TYPES)[number];
8
11
  /** Content type classification */
9
- export type ContentType = 'documentation' | 'code-typescript' | 'code-javascript' | 'code-python' | 'code-other' | 'config-json' | 'config-yaml' | 'config-toml' | 'config-env' | 'test-code' | 'cdk-stack' | 'markdown' | 'curated-knowledge' | 'produced-knowledge' | 'unknown';
12
+ declare const CONTENT_TYPES: readonly ["documentation", "code-typescript", "code-javascript", "code-python", "code-other", "config-json", "config-yaml", "config-toml", "config-env", "test-code", "cdk-stack", "markdown", "curated-knowledge", "produced-knowledge", "unknown"];
13
+ type ContentType = (typeof CONTENT_TYPES)[number];
10
14
  /** A single knowledge record stored in the vector DB */
11
- export interface KnowledgeRecord {
12
- /** Unique identifier (deterministic hash of source + chunk index) */
13
- id: string;
14
- /** The text content of this chunk */
15
- content: string;
16
- /** Source file path relative to workspace root */
17
- sourcePath: string;
18
- /** Content type classification */
19
- contentType: ContentType;
20
- /** Heading path for markdown (e.g., "## Setup > ### Prerequisites") */
21
- headingPath?: string;
22
- /** Zero-based chunk index within the source file */
23
- chunkIndex: number;
24
- /** Total number of chunks from this source file */
25
- totalChunks: number;
26
- /** Start line in source file (1-based) */
27
- startLine: number;
28
- /** End line in source file (1-based) */
29
- endLine: number;
30
- /** File hash for incremental indexing */
31
- fileHash: string;
32
- /** ISO timestamp when this record was created/updated */
33
- indexedAt: string;
34
- /** How this record was created */
35
- origin: KnowledgeOrigin;
36
- /** User-defined tags for categorization */
37
- tags: string[];
38
- /** Category for curated/produced knowledge */
39
- category?: string;
40
- /** Version number for curated knowledge updates */
41
- version: number;
15
+ interface KnowledgeRecord {
16
+ /** Unique identifier (deterministic hash of source + chunk index) */
17
+ id: string;
18
+ /** The text content of this chunk */
19
+ content: string;
20
+ /** Source file path relative to workspace root */
21
+ sourcePath: string;
22
+ /** Content type classification */
23
+ contentType: ContentType;
24
+ /** Heading path for markdown (e.g., "## Setup > ### Prerequisites") */
25
+ headingPath?: string;
26
+ /** Zero-based chunk index within the source file */
27
+ chunkIndex: number;
28
+ /** Total number of chunks from this source file */
29
+ totalChunks: number;
30
+ /** Start line in source file (1-based) */
31
+ startLine: number;
32
+ /** End line in source file (1-based) */
33
+ endLine: number;
34
+ /** File hash for incremental indexing */
35
+ fileHash: string;
36
+ /** ISO timestamp when this record was created/updated */
37
+ indexedAt: string;
38
+ /** How this record was created */
39
+ origin: KnowledgeOrigin;
40
+ /** User-defined tags for categorization */
41
+ tags: string[];
42
+ /** Category for curated/produced knowledge */
43
+ category?: string;
44
+ /** Version number for curated knowledge updates */
45
+ version: number;
42
46
  }
43
47
  /** A raw chunk produced by a chunker before embedding */
44
- export interface RawChunk {
45
- /** The text content */
46
- text: string;
47
- /** Source file path */
48
- sourcePath: string;
49
- /** Content type */
50
- contentType: ContentType;
51
- /** Heading path (markdown only) */
52
- headingPath?: string;
53
- /** Chunk index */
54
- chunkIndex: number;
55
- /** Total chunks from this file */
56
- totalChunks: number;
57
- /** Start line (1-based) */
58
- startLine: number;
59
- /** End line (1-based) */
60
- endLine: number;
48
+ interface RawChunk {
49
+ /** The text content */
50
+ text: string;
51
+ /** Source file path */
52
+ sourcePath: string;
53
+ /** Content type */
54
+ contentType: ContentType;
55
+ /** Heading path (markdown only) */
56
+ headingPath?: string;
57
+ /** Chunk index */
58
+ chunkIndex: number;
59
+ /** Total chunks from this file */
60
+ totalChunks: number;
61
+ /** Start line (1-based) */
62
+ startLine: number;
63
+ /** End line (1-based) */
64
+ endLine: number;
61
65
  }
62
66
  /** Metadata passed to a chunker */
63
- export interface ChunkMetadata {
64
- /** File path relative to workspace root */
65
- sourcePath: string;
66
- /** Detected content type */
67
- contentType: ContentType;
67
+ interface ChunkMetadata {
68
+ /** File path relative to workspace root */
69
+ sourcePath: string;
70
+ /** Detected content type */
71
+ contentType: ContentType;
68
72
  }
69
73
  /** Search result returned by the store */
70
- export interface SearchResult {
71
- /** The matching knowledge record */
72
- record: KnowledgeRecord;
73
- /** Similarity score (0-1, higher = more similar) */
74
- score: number;
74
+ interface SearchResult {
75
+ /** The matching knowledge record */
76
+ record: KnowledgeRecord;
77
+ /** Similarity score (0-1, higher = more similar) */
78
+ score: number;
75
79
  }
76
80
  /** Configuration loaded from kb.config.json */
77
- export interface KBConfig {
78
- sources: Array<{
79
- path: string;
80
- excludePatterns: string[];
81
- }>;
82
- indexing: {
83
- chunkSize: number;
84
- chunkOverlap: number;
85
- minChunkSize: number;
86
- /** Max files processed concurrently. Defaults to half of available CPU cores. */
87
- concurrency?: number;
88
- };
89
- embedding: {
90
- model: string;
91
- dimensions: number;
92
- };
93
- store: {
94
- backend: string;
95
- path: string;
96
- };
97
- curated: {
98
- path: string;
99
- };
81
+ interface KBConfig {
82
+ /** MCP server name. Defaults to 'kb'. */
83
+ serverName?: string;
84
+ sources: Array<{
85
+ path: string;
86
+ excludePatterns: string[];
87
+ }>;
88
+ indexing: {
89
+ chunkSize: number;
90
+ chunkOverlap: number;
91
+ minChunkSize: number; /** Max files processed concurrently. Defaults to half of available CPU cores. */
92
+ concurrency?: number;
93
+ };
94
+ embedding: {
95
+ model: string;
96
+ dimensions: number;
97
+ };
98
+ store: {
99
+ backend: string;
100
+ path: string;
101
+ };
102
+ curated: {
103
+ path: string;
104
+ };
105
+ /** Enterprise RAG bridge configuration (optional) */
106
+ er?: {
107
+ /** Whether ER integration is enabled */enabled: boolean; /** Base URL of the ER API (e.g., https://xxx.execute-api.region.amazonaws.com/prod) */
108
+ baseUrl: string; /** Request timeout in milliseconds. Defaults to 5000. */
109
+ timeoutMs?: number; /** Cache TTL in milliseconds. Defaults to 21600000 (6 hours). */
110
+ cacheTtlMs?: number; /** Maximum cache entries. Defaults to 100. */
111
+ cacheMaxEntries?: number; /** Vector similarity threshold below which ER fallback triggers. Defaults to 0.45. */
112
+ fallbackThreshold?: number;
113
+ };
100
114
  }
101
115
  /** Index statistics */
102
- export interface IndexStats {
103
- totalRecords: number;
104
- totalFiles: number;
105
- contentTypeBreakdown: Record<string, number>;
106
- lastIndexedAt: string | null;
107
- storeBackend: string;
108
- embeddingModel: string;
116
+ interface IndexStats {
117
+ totalRecords: number;
118
+ totalFiles: number;
119
+ contentTypeBreakdown: Record<string, number>;
120
+ lastIndexedAt: string | null;
121
+ storeBackend: string;
122
+ embeddingModel: string;
109
123
  }
110
- //# sourceMappingURL=types.d.ts.map
124
+ //#endregion
125
+ export { CONTENT_TYPES, ChunkMetadata, ContentType, IndexStats, KBConfig, KNOWLEDGE_ORIGINS, KnowledgeOrigin, KnowledgeRecord, RawChunk, SOURCE_TYPES, SearchResult, SourceType };
@@ -0,0 +1 @@
1
+ const e=[`indexed`,`curated`,`produced`],t=[`source`,`documentation`,`test`,`config`,`generated`],n=[`documentation`,`code-typescript`,`code-javascript`,`code-python`,`code-other`,`config-json`,`config-yaml`,`config-toml`,`config-env`,`test-code`,`cdk-stack`,`markdown`,`curated-knowledge`,`produced-knowledge`,`unknown`];export{n as CONTENT_TYPES,e as KNOWLEDGE_ORIGINS,t as SOURCE_TYPES};