@vpxa/kb 0.1.13 → 0.1.15

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 (383) hide show
  1. package/README.md +8 -2
  2. package/package.json +10 -7
  3. package/packages/analyzers/dist/blast-radius-analyzer.d.ts +17 -20
  4. package/packages/analyzers/dist/blast-radius-analyzer.js +6 -12
  5. package/packages/analyzers/dist/dependency-analyzer.d.ts +31 -27
  6. package/packages/analyzers/dist/dependency-analyzer.js +7 -9
  7. package/packages/analyzers/dist/diagram-generator.d.ts +12 -8
  8. package/packages/analyzers/dist/diagram-generator.js +3 -4
  9. package/packages/analyzers/dist/entry-point-analyzer.d.ts +39 -35
  10. package/packages/analyzers/dist/entry-point-analyzer.js +5 -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 +29 -25
  14. package/packages/analyzers/dist/knowledge-producer.js +16 -15
  15. package/packages/analyzers/dist/pattern-analyzer.d.ts +14 -10
  16. package/packages/analyzers/dist/pattern-analyzer.js +3 -5
  17. package/packages/analyzers/dist/regex-call-graph.d.ts +6 -12
  18. package/packages/analyzers/dist/regex-call-graph.js +2 -1
  19. package/packages/analyzers/dist/structure-analyzer.d.ts +13 -9
  20. package/packages/analyzers/dist/structure-analyzer.js +3 -4
  21. package/packages/analyzers/dist/symbol-analyzer.d.ts +12 -8
  22. package/packages/analyzers/dist/symbol-analyzer.js +8 -13
  23. package/packages/analyzers/dist/ts-call-graph.d.ts +16 -13
  24. package/packages/analyzers/dist/ts-call-graph.js +2 -1
  25. package/packages/analyzers/dist/types.d.ts +82 -79
  26. package/packages/analyzers/dist/types.js +1 -0
  27. package/packages/chunker/dist/call-graph-extractor.d.ts +13 -10
  28. package/packages/chunker/dist/call-graph-extractor.js +2 -1
  29. package/packages/chunker/dist/chunker-factory.d.ts +6 -2
  30. package/packages/chunker/dist/chunker-factory.js +2 -1
  31. package/packages/chunker/dist/chunker.interface.d.ts +8 -4
  32. package/packages/chunker/dist/chunker.interface.js +1 -0
  33. package/packages/chunker/dist/code-chunker.d.ts +16 -12
  34. package/packages/chunker/dist/code-chunker.js +12 -14
  35. package/packages/chunker/dist/generic-chunker.d.ts +14 -10
  36. package/packages/chunker/dist/generic-chunker.js +6 -5
  37. package/packages/chunker/dist/index.d.ts +8 -8
  38. package/packages/chunker/dist/index.js +1 -1
  39. package/packages/chunker/dist/markdown-chunker.d.ts +16 -12
  40. package/packages/chunker/dist/markdown-chunker.js +4 -10
  41. package/packages/chunker/dist/treesitter-chunker.d.ts +28 -31
  42. package/packages/chunker/dist/treesitter-chunker.js +7 -8
  43. package/packages/cli/dist/commands/analyze.d.ts +6 -2
  44. package/packages/cli/dist/commands/analyze.js +3 -3
  45. package/packages/cli/dist/commands/context-cmds.d.ts +6 -2
  46. package/packages/cli/dist/commands/context-cmds.js +2 -1
  47. package/packages/cli/dist/commands/environment.d.ts +6 -2
  48. package/packages/cli/dist/commands/environment.js +2 -2
  49. package/packages/cli/dist/commands/execution.d.ts +6 -2
  50. package/packages/cli/dist/commands/execution.js +2 -1
  51. package/packages/cli/dist/commands/graph.d.ts +6 -2
  52. package/packages/cli/dist/commands/graph.js +6 -6
  53. package/packages/cli/dist/commands/init/adapters.d.ts +27 -0
  54. package/packages/cli/dist/commands/init/adapters.js +2 -0
  55. package/packages/cli/dist/commands/init/config.d.ts +11 -0
  56. package/packages/cli/dist/commands/init/config.js +4 -0
  57. package/packages/cli/dist/commands/init/curated.d.ts +8 -0
  58. package/packages/cli/dist/commands/init/curated.js +2 -0
  59. package/packages/cli/dist/commands/init/index.d.ts +23 -0
  60. package/packages/cli/dist/commands/init/index.js +3 -0
  61. package/packages/cli/dist/commands/init/scaffold.d.ts +24 -0
  62. package/packages/cli/dist/commands/init/scaffold.js +2 -0
  63. package/packages/cli/dist/commands/init/templates.d.ts +10 -0
  64. package/packages/cli/dist/commands/init/templates.js +302 -0
  65. package/packages/cli/dist/commands/init.d.ts +8 -3
  66. package/packages/cli/dist/commands/init.js +120 -123
  67. package/packages/cli/dist/commands/knowledge.d.ts +6 -2
  68. package/packages/cli/dist/commands/knowledge.js +2 -1
  69. package/packages/cli/dist/commands/search.d.ts +6 -2
  70. package/packages/cli/dist/commands/search.js +2 -8
  71. package/packages/cli/dist/commands/system.d.ts +6 -2
  72. package/packages/cli/dist/commands/system.js +5 -7
  73. package/packages/cli/dist/commands/workspace.d.ts +6 -2
  74. package/packages/cli/dist/commands/workspace.js +2 -2
  75. package/packages/cli/dist/context.d.ts +7 -4
  76. package/packages/cli/dist/context.js +2 -1
  77. package/packages/cli/dist/helpers.d.ts +51 -47
  78. package/packages/cli/dist/helpers.js +6 -5
  79. package/packages/cli/dist/index.d.ts +4 -1
  80. package/packages/cli/dist/index.js +3 -2
  81. package/packages/cli/dist/kb-init.d.ts +48 -50
  82. package/packages/cli/dist/kb-init.js +2 -1
  83. package/packages/cli/dist/types.d.ts +8 -5
  84. package/packages/cli/dist/types.js +1 -0
  85. package/packages/core/dist/constants.d.ts +36 -33
  86. package/packages/core/dist/constants.js +2 -1
  87. package/packages/core/dist/content-detector.d.ts +8 -7
  88. package/packages/core/dist/content-detector.js +2 -1
  89. package/packages/core/dist/errors.d.ts +15 -12
  90. package/packages/core/dist/errors.js +2 -1
  91. package/packages/core/dist/index.d.ts +6 -6
  92. package/packages/core/dist/index.js +1 -1
  93. package/packages/core/dist/logger.d.ts +16 -7
  94. package/packages/core/dist/logger.js +2 -1
  95. package/packages/core/dist/types.d.ts +107 -91
  96. package/packages/core/dist/types.js +2 -0
  97. package/packages/embeddings/dist/embedder.interface.d.ts +22 -19
  98. package/packages/embeddings/dist/embedder.interface.js +1 -0
  99. package/packages/embeddings/dist/index.d.ts +3 -3
  100. package/packages/embeddings/dist/index.js +1 -1
  101. package/packages/embeddings/dist/onnx-embedder.d.ts +21 -22
  102. package/packages/embeddings/dist/onnx-embedder.js +2 -1
  103. package/packages/enterprise-bridge/dist/cache.d.ts +29 -0
  104. package/packages/enterprise-bridge/dist/cache.js +2 -0
  105. package/packages/enterprise-bridge/dist/er-client.d.ts +38 -0
  106. package/packages/enterprise-bridge/dist/er-client.js +2 -0
  107. package/packages/enterprise-bridge/dist/evolution-collector.d.ts +63 -0
  108. package/packages/enterprise-bridge/dist/evolution-collector.js +2 -0
  109. package/packages/enterprise-bridge/dist/index.d.ts +8 -0
  110. package/packages/enterprise-bridge/dist/index.js +1 -0
  111. package/packages/enterprise-bridge/dist/policy-store.d.ts +46 -0
  112. package/packages/enterprise-bridge/dist/policy-store.js +2 -0
  113. package/packages/enterprise-bridge/dist/push-adapter.d.ts +24 -0
  114. package/packages/enterprise-bridge/dist/push-adapter.js +2 -0
  115. package/packages/enterprise-bridge/dist/result-merger.d.ts +15 -0
  116. package/packages/enterprise-bridge/dist/result-merger.js +2 -0
  117. package/packages/enterprise-bridge/dist/types.d.ts +82 -0
  118. package/packages/enterprise-bridge/dist/types.js +2 -0
  119. package/packages/indexer/dist/file-hasher.d.ts +5 -2
  120. package/packages/indexer/dist/file-hasher.js +2 -1
  121. package/packages/indexer/dist/filesystem-crawler.d.ts +23 -20
  122. package/packages/indexer/dist/filesystem-crawler.js +2 -1
  123. package/packages/indexer/dist/graph-extractor.d.ts +9 -12
  124. package/packages/indexer/dist/graph-extractor.js +2 -1
  125. package/packages/indexer/dist/incremental-indexer.d.ts +49 -43
  126. package/packages/indexer/dist/incremental-indexer.js +2 -1
  127. package/packages/indexer/dist/index.d.ts +5 -5
  128. package/packages/indexer/dist/index.js +1 -1
  129. package/packages/server/dist/api.d.ts +3 -8
  130. package/packages/server/dist/api.js +1 -1
  131. package/packages/server/dist/config.d.ts +6 -2
  132. package/packages/server/dist/config.js +2 -1
  133. package/packages/server/dist/curated-manager.d.ts +79 -76
  134. package/packages/server/dist/curated-manager.js +6 -10
  135. package/packages/server/dist/index.d.ts +1 -2
  136. package/packages/server/dist/index.js +2 -1
  137. package/packages/server/dist/replay-interceptor.d.ts +6 -6
  138. package/packages/server/dist/replay-interceptor.js +2 -1
  139. package/packages/server/dist/resources/resources.d.ts +7 -3
  140. package/packages/server/dist/resources/resources.js +3 -2
  141. package/packages/server/dist/server.d.ts +34 -24
  142. package/packages/server/dist/server.js +2 -1
  143. package/packages/server/dist/tools/analyze.tools.d.ts +14 -10
  144. package/packages/server/dist/tools/analyze.tools.js +2 -3
  145. package/packages/server/dist/tools/audit.tool.d.ts +8 -4
  146. package/packages/server/dist/tools/audit.tool.js +2 -4
  147. package/packages/server/dist/tools/bridge.tools.d.ts +35 -0
  148. package/packages/server/dist/tools/bridge.tools.js +16 -0
  149. package/packages/server/dist/tools/evolution.tools.d.ts +8 -0
  150. package/packages/server/dist/tools/evolution.tools.js +6 -0
  151. package/packages/server/dist/tools/forge.tools.d.ts +13 -11
  152. package/packages/server/dist/tools/forge.tools.js +11 -13
  153. package/packages/server/dist/tools/forget.tool.d.ts +7 -3
  154. package/packages/server/dist/tools/forget.tool.js +2 -7
  155. package/packages/server/dist/tools/graph.tool.d.ts +7 -3
  156. package/packages/server/dist/tools/graph.tool.js +5 -5
  157. package/packages/server/dist/tools/list.tool.d.ts +7 -3
  158. package/packages/server/dist/tools/list.tool.js +3 -8
  159. package/packages/server/dist/tools/lookup.tool.d.ts +7 -3
  160. package/packages/server/dist/tools/lookup.tool.js +3 -9
  161. package/packages/server/dist/tools/onboard.tool.d.ts +8 -4
  162. package/packages/server/dist/tools/onboard.tool.js +3 -2
  163. package/packages/server/dist/tools/policy.tools.d.ts +8 -0
  164. package/packages/server/dist/tools/policy.tools.js +3 -0
  165. package/packages/server/dist/tools/produce.tool.d.ts +6 -2
  166. package/packages/server/dist/tools/produce.tool.js +3 -2
  167. package/packages/server/dist/tools/read.tool.d.ts +7 -3
  168. package/packages/server/dist/tools/read.tool.js +3 -6
  169. package/packages/server/dist/tools/reindex.tool.d.ts +10 -6
  170. package/packages/server/dist/tools/reindex.tool.js +3 -2
  171. package/packages/server/dist/tools/remember.tool.d.ts +8 -3
  172. package/packages/server/dist/tools/remember.tool.js +4 -5
  173. package/packages/server/dist/tools/replay.tool.d.ts +6 -2
  174. package/packages/server/dist/tools/replay.tool.js +3 -6
  175. package/packages/server/dist/tools/search.tool.d.ts +10 -4
  176. package/packages/server/dist/tools/search.tool.js +7 -22
  177. package/packages/server/dist/tools/status.tool.d.ts +7 -3
  178. package/packages/server/dist/tools/status.tool.js +3 -3
  179. package/packages/server/dist/tools/toolkit.tools.d.ts +36 -34
  180. package/packages/server/dist/tools/toolkit.tools.js +20 -24
  181. package/packages/server/dist/tools/update.tool.d.ts +7 -3
  182. package/packages/server/dist/tools/update.tool.js +2 -6
  183. package/packages/server/dist/tools/utility.tools.d.ts +15 -14
  184. package/packages/server/dist/tools/utility.tools.js +11 -23
  185. package/packages/server/dist/version-check.d.ts +5 -1
  186. package/packages/server/dist/version-check.js +2 -1
  187. package/packages/store/dist/graph-store.interface.d.ts +89 -86
  188. package/packages/store/dist/graph-store.interface.js +1 -0
  189. package/packages/store/dist/index.d.ts +6 -6
  190. package/packages/store/dist/index.js +1 -1
  191. package/packages/store/dist/lance-store.d.ts +37 -30
  192. package/packages/store/dist/lance-store.js +2 -1
  193. package/packages/store/dist/sqlite-graph-store.d.ts +43 -46
  194. package/packages/store/dist/sqlite-graph-store.js +14 -13
  195. package/packages/store/dist/store-factory.d.ts +11 -7
  196. package/packages/store/dist/store-factory.js +2 -1
  197. package/packages/store/dist/store.interface.d.ts +47 -46
  198. package/packages/store/dist/store.interface.js +1 -0
  199. package/packages/tools/dist/audit.d.ts +61 -61
  200. package/packages/tools/dist/audit.js +5 -5
  201. package/packages/tools/dist/batch.d.ts +20 -17
  202. package/packages/tools/dist/batch.js +2 -1
  203. package/packages/tools/dist/changelog.d.ts +29 -26
  204. package/packages/tools/dist/changelog.js +3 -2
  205. package/packages/tools/dist/check.d.ts +42 -38
  206. package/packages/tools/dist/check.js +3 -2
  207. package/packages/tools/dist/checkpoint.d.ts +17 -14
  208. package/packages/tools/dist/checkpoint.js +2 -2
  209. package/packages/tools/dist/codemod.d.ts +35 -32
  210. package/packages/tools/dist/codemod.js +3 -2
  211. package/packages/tools/dist/compact.d.ts +34 -37
  212. package/packages/tools/dist/compact.js +3 -2
  213. package/packages/tools/dist/data-transform.d.ts +10 -7
  214. package/packages/tools/dist/data-transform.js +2 -1
  215. package/packages/tools/dist/dead-symbols.d.ts +29 -25
  216. package/packages/tools/dist/dead-symbols.js +3 -2
  217. package/packages/tools/dist/delegate.d.ts +26 -23
  218. package/packages/tools/dist/delegate.js +2 -5
  219. package/packages/tools/dist/diff-parse.d.ts +24 -21
  220. package/packages/tools/dist/diff-parse.js +4 -3
  221. package/packages/tools/dist/digest.d.ts +43 -45
  222. package/packages/tools/dist/digest.js +5 -5
  223. package/packages/tools/dist/encode.d.ts +11 -8
  224. package/packages/tools/dist/encode.js +2 -1
  225. package/packages/tools/dist/env-info.d.ts +25 -22
  226. package/packages/tools/dist/env-info.js +2 -1
  227. package/packages/tools/dist/eval.d.ts +13 -10
  228. package/packages/tools/dist/eval.js +3 -3
  229. package/packages/tools/dist/evidence-map.d.ts +64 -61
  230. package/packages/tools/dist/evidence-map.js +3 -3
  231. package/packages/tools/dist/file-cache.d.ts +42 -0
  232. package/packages/tools/dist/file-cache.js +4 -0
  233. package/packages/tools/dist/file-summary.d.ts +34 -29
  234. package/packages/tools/dist/file-summary.js +3 -2
  235. package/packages/tools/dist/file-walk.d.ts +6 -3
  236. package/packages/tools/dist/file-walk.js +2 -1
  237. package/packages/tools/dist/find-examples.d.ts +26 -21
  238. package/packages/tools/dist/find-examples.js +4 -3
  239. package/packages/tools/dist/find.d.ts +39 -40
  240. package/packages/tools/dist/find.js +2 -1
  241. package/packages/tools/dist/forge-classify.d.ts +35 -38
  242. package/packages/tools/dist/forge-classify.js +3 -2
  243. package/packages/tools/dist/forge-ground.d.ts +58 -60
  244. package/packages/tools/dist/forge-ground.js +2 -1
  245. package/packages/tools/dist/git-context.d.ts +22 -19
  246. package/packages/tools/dist/git-context.js +4 -3
  247. package/packages/tools/dist/graph-query.d.ts +75 -78
  248. package/packages/tools/dist/graph-query.js +2 -1
  249. package/packages/tools/dist/guide.d.ts +14 -11
  250. package/packages/tools/dist/guide.js +2 -1
  251. package/packages/tools/dist/health.d.ts +13 -10
  252. package/packages/tools/dist/health.js +3 -2
  253. package/packages/tools/dist/http-request.d.ts +20 -17
  254. package/packages/tools/dist/http-request.js +2 -1
  255. package/packages/tools/dist/index.d.ts +54 -53
  256. package/packages/tools/dist/index.js +1 -1
  257. package/packages/tools/dist/lane.d.ts +28 -25
  258. package/packages/tools/dist/lane.js +7 -7
  259. package/packages/tools/dist/measure.d.ts +32 -29
  260. package/packages/tools/dist/measure.js +3 -2
  261. package/packages/tools/dist/onboard.d.ts +29 -26
  262. package/packages/tools/dist/onboard.js +18 -41
  263. package/packages/tools/dist/parse-output.d.ts +48 -45
  264. package/packages/tools/dist/parse-output.js +3 -2
  265. package/packages/tools/dist/path-resolver.d.ts +4 -1
  266. package/packages/tools/dist/path-resolver.js +2 -1
  267. package/packages/tools/dist/process-manager.d.ts +18 -15
  268. package/packages/tools/dist/process-manager.js +2 -1
  269. package/packages/tools/dist/queue.d.ts +28 -25
  270. package/packages/tools/dist/queue.js +2 -2
  271. package/packages/tools/dist/regex-test.d.ts +26 -23
  272. package/packages/tools/dist/regex-test.js +2 -1
  273. package/packages/tools/dist/rename.d.ts +28 -25
  274. package/packages/tools/dist/rename.js +3 -2
  275. package/packages/tools/dist/replay.d.ts +32 -29
  276. package/packages/tools/dist/replay.js +5 -6
  277. package/packages/tools/dist/response-envelope.d.ts +32 -29
  278. package/packages/tools/dist/response-envelope.js +2 -1
  279. package/packages/tools/dist/schema-validate.d.ts +15 -12
  280. package/packages/tools/dist/schema-validate.js +2 -1
  281. package/packages/tools/dist/scope-map.d.ts +45 -47
  282. package/packages/tools/dist/scope-map.js +2 -1
  283. package/packages/tools/dist/snippet.d.ts +26 -24
  284. package/packages/tools/dist/snippet.js +2 -1
  285. package/packages/tools/dist/stash.d.ts +13 -10
  286. package/packages/tools/dist/stash.js +2 -2
  287. package/packages/tools/dist/stratum-card.d.ts +27 -27
  288. package/packages/tools/dist/stratum-card.js +4 -5
  289. package/packages/tools/dist/symbol.d.ts +29 -25
  290. package/packages/tools/dist/symbol.js +4 -3
  291. package/packages/tools/dist/test-run.d.ts +19 -15
  292. package/packages/tools/dist/test-run.js +3 -2
  293. package/packages/tools/dist/text-utils.d.ts +6 -3
  294. package/packages/tools/dist/text-utils.js +3 -2
  295. package/packages/tools/dist/time-utils.d.ts +15 -12
  296. package/packages/tools/dist/time-utils.js +2 -1
  297. package/packages/tools/dist/trace.d.ts +24 -20
  298. package/packages/tools/dist/trace.js +3 -2
  299. package/packages/tools/dist/truncation.d.ts +6 -3
  300. package/packages/tools/dist/truncation.js +8 -14
  301. package/packages/tools/dist/watch.d.ts +28 -25
  302. package/packages/tools/dist/watch.js +2 -1
  303. package/packages/tools/dist/web-fetch.d.ts +35 -32
  304. package/packages/tools/dist/web-fetch.js +7 -12
  305. package/packages/tools/dist/web-search.d.ts +16 -13
  306. package/packages/tools/dist/web-search.js +2 -1
  307. package/packages/tools/dist/workset.d.ts +19 -16
  308. package/packages/tools/dist/workset.js +2 -2
  309. package/packages/tui/dist/App-BAlmxCCw.js +3 -0
  310. package/packages/tui/dist/App.d.ts +11 -5
  311. package/packages/tui/dist/App.js +1 -450
  312. package/packages/tui/dist/CuratedPanel-sYdZAICX.js +3 -0
  313. package/packages/tui/dist/LogPanel-DVB8Sv46.js +4 -0
  314. package/packages/tui/dist/SearchPanel-DREo6zgt.js +3 -0
  315. package/packages/tui/dist/StatusPanel-2ex8fLOO.js +3 -0
  316. package/packages/tui/dist/chunk-D6axbAb-.js +2 -0
  317. package/packages/tui/dist/devtools-DUyj952l.js +8 -0
  318. package/packages/tui/dist/embedder.interface-D4ew0HPW.d.ts +29 -0
  319. package/packages/tui/dist/index-B9VpfVPP.d.ts +14 -0
  320. package/packages/tui/dist/index.d.ts +3 -19
  321. package/packages/tui/dist/index.js +2 -476
  322. package/packages/tui/dist/jsx-runtime-Cof-kwFn.js +317 -0
  323. package/packages/tui/dist/panels/CuratedPanel.d.ts +11 -5
  324. package/packages/tui/dist/panels/CuratedPanel.js +1 -371
  325. package/packages/tui/dist/panels/LogPanel.d.ts +7 -2
  326. package/packages/tui/dist/panels/LogPanel.js +1 -449
  327. package/packages/tui/dist/panels/SearchPanel.d.ts +14 -7
  328. package/packages/tui/dist/panels/SearchPanel.js +1 -372
  329. package/packages/tui/dist/panels/StatusPanel.d.ts +11 -5
  330. package/packages/tui/dist/panels/StatusPanel.js +1 -371
  331. package/packages/tui/dist/store.interface-CnY6SPOH.d.ts +151 -0
  332. package/scaffold/adapters/claude-code.mjs +20 -0
  333. package/scaffold/adapters/copilot.mjs +320 -0
  334. package/scaffold/copilot/agents/Architect-Reviewer-Alpha.agent.md +14 -0
  335. package/scaffold/copilot/agents/Architect-Reviewer-Beta.agent.md +14 -0
  336. package/scaffold/copilot/agents/Code-Reviewer-Alpha.agent.md +12 -0
  337. package/scaffold/copilot/agents/Code-Reviewer-Beta.agent.md +12 -0
  338. package/scaffold/copilot/agents/Debugger.agent.md +31 -0
  339. package/scaffold/copilot/agents/Documenter.agent.md +35 -0
  340. package/scaffold/copilot/agents/Explorer.agent.md +50 -0
  341. package/scaffold/copilot/agents/Frontend.agent.md +29 -0
  342. package/scaffold/copilot/agents/Implementer.agent.md +31 -0
  343. package/scaffold/copilot/agents/Orchestrator.agent.md +96 -0
  344. package/scaffold/copilot/agents/Planner.agent.md +45 -0
  345. package/scaffold/copilot/agents/README.md +57 -0
  346. package/scaffold/copilot/agents/Refactor.agent.md +30 -0
  347. package/scaffold/copilot/agents/Researcher-Alpha.agent.md +12 -0
  348. package/scaffold/copilot/agents/Researcher-Beta.agent.md +12 -0
  349. package/scaffold/copilot/agents/Researcher-Delta.agent.md +12 -0
  350. package/scaffold/copilot/agents/Researcher-Gamma.agent.md +12 -0
  351. package/scaffold/copilot/agents/Security.agent.md +42 -0
  352. package/scaffold/copilot/agents/_shared/adr-protocol.md +91 -0
  353. package/scaffold/copilot/agents/_shared/architect-reviewer-base.md +50 -0
  354. package/scaffold/copilot/agents/_shared/code-agent-base.md +70 -0
  355. package/scaffold/copilot/agents/_shared/code-reviewer-base.md +54 -0
  356. package/scaffold/copilot/agents/_shared/decision-protocol.md +27 -0
  357. package/scaffold/copilot/agents/_shared/forge-protocol.md +46 -0
  358. package/scaffold/copilot/agents/_shared/researcher-base.md +61 -0
  359. package/scaffold/copilot/agents/templates/adr-template.md +27 -0
  360. package/scaffold/copilot/agents/templates/execution-state.md +25 -0
  361. package/scaffold/copilot/prompts/ask.prompt.md +20 -0
  362. package/scaffold/copilot/prompts/debug.prompt.md +25 -0
  363. package/scaffold/copilot/prompts/design.prompt.md +22 -0
  364. package/scaffold/copilot/prompts/implement.prompt.md +26 -0
  365. package/scaffold/copilot/prompts/plan.prompt.md +24 -0
  366. package/scaffold/copilot/prompts/review.prompt.md +31 -0
  367. package/scaffold/definitions/agents.mjs +165 -0
  368. package/scaffold/definitions/bodies.mjs +292 -0
  369. package/scaffold/definitions/hooks.mjs +43 -0
  370. package/scaffold/definitions/models.mjs +56 -0
  371. package/scaffold/definitions/plugins.mjs +24 -0
  372. package/scaffold/definitions/prompts.mjs +145 -0
  373. package/scaffold/definitions/protocols.mjs +322 -0
  374. package/scaffold/definitions/tools.mjs +176 -0
  375. package/scaffold/generate.mjs +74 -0
  376. package/skills/brainstorming/SKILL.md +259 -0
  377. package/skills/brainstorming/scripts/frame-template.html +365 -0
  378. package/skills/brainstorming/scripts/helper.js +216 -0
  379. package/skills/brainstorming/scripts/server.cjs +9 -0
  380. package/skills/brainstorming/scripts/server.src.cjs +249 -0
  381. package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  382. package/skills/brainstorming/visual-companion.md +430 -0
  383. package/skills/knowledge-base/SKILL.md +22 -9
@@ -1,16 +1,19 @@
1
+ //#region packages/tools/src/text-utils.d.ts
1
2
  /**
2
3
  * Shared text utilities used by compact, digest, stratum-card, and other tools.
3
4
  */
4
5
  /**
5
6
  * Approximate token count from character count (~4 chars/token).
6
7
  */
7
- export declare function estimateTokens(text: string): number;
8
+ declare function estimateTokens(text: string): number;
8
9
  /**
9
10
  * Segment text into chunks for scoring.
10
11
  */
11
- export declare function segment(text: string, strategy: 'paragraph' | 'sentence' | 'line'): string[];
12
+ declare function segment(text: string, strategy: 'paragraph' | 'sentence' | 'line'): string[];
12
13
  /**
13
14
  * Cosine similarity between two vectors.
14
15
  */
15
- export declare function cosineSimilarity(a: Float32Array, b: Float32Array): number;
16
+ declare function cosineSimilarity(a: Float32Array, b: Float32Array): number;
17
+ //#endregion
18
+ export { cosineSimilarity, estimateTokens, segment };
16
19
  //# sourceMappingURL=text-utils.d.ts.map
@@ -1,2 +1,3 @@
1
- function a(e){return Math.ceil(e.length/4)}function o(e,n){switch(n){case"paragraph":return e.split(/\n\s*\n/).map(t=>t.trim()).filter(t=>t.length>0);case"sentence":return e.split(/(?<=[.!?])\s+/).map(t=>t.trim()).filter(t=>t.length>0);case"line":return e.split(`
2
- `).map(t=>t.trim()).filter(t=>t.length>0)}}function m(e,n){let t=0,i=0,l=0;for(let r=0;r<e.length;r++)t+=e[r]*n[r],i+=e[r]*e[r],l+=n[r]*n[r];const s=Math.sqrt(i)*Math.sqrt(l);return s===0?0:t/s}export{m as cosineSimilarity,a as estimateTokens,o as segment};
1
+ function e(e){return Math.ceil(e.length/4)}function t(e,t){switch(t){case`paragraph`:return e.split(/\n\s*\n/).map(e=>e.trim()).filter(e=>e.length>0);case`sentence`:return e.split(/(?<=[.!?])\s+/).map(e=>e.trim()).filter(e=>e.length>0);case`line`:return e.split(`
2
+ `).map(e=>e.trim()).filter(e=>e.length>0)}}function n(e,t){let n=0,r=0,i=0;for(let a=0;a<e.length;a++)n+=e[a]*t[a],r+=e[a]*e[a],i+=t[a]*t[a];let a=Math.sqrt(r)*Math.sqrt(i);return a===0?0:n/a}export{n as cosineSimilarity,e as estimateTokens,t as segment};
3
+ //# sourceMappingURL=text-utils.js.map
@@ -1,18 +1,21 @@
1
+ //#region packages/tools/src/time-utils.d.ts
1
2
  /**
2
3
  * kb_time — Timezone conversion, date parsing, duration calculation.
3
4
  */
4
- export type TimeOperation = 'now' | 'parse' | 'convert' | 'diff' | 'add';
5
- export interface TimeOptions {
6
- operation: TimeOperation;
7
- input?: string;
8
- timezone?: string;
9
- duration?: string;
5
+ type TimeOperation = 'now' | 'parse' | 'convert' | 'diff' | 'add';
6
+ interface TimeOptions {
7
+ operation: TimeOperation;
8
+ input?: string;
9
+ timezone?: string;
10
+ duration?: string;
10
11
  }
11
- export interface TimeResult {
12
- output: string;
13
- iso: string;
14
- unix: number;
15
- details?: Record<string, string | number>;
12
+ interface TimeResult {
13
+ output: string;
14
+ iso: string;
15
+ unix: number;
16
+ details?: Record<string, string | number>;
16
17
  }
17
- export declare function timeUtils(options: TimeOptions): TimeResult;
18
+ declare function timeUtils(options: TimeOptions): TimeResult;
19
+ //#endregion
20
+ export { TimeOperation, TimeOptions, TimeResult, timeUtils };
18
21
  //# sourceMappingURL=time-utils.d.ts.map
@@ -1 +1,2 @@
1
- function h(o){const{operation:e,input:t,timezone:n}=o;switch(e){case"now":return m(new Date,n);case"parse":{if(!t)throw new Error("input required for parse");return m(u(t),n)}case"convert":{if(!t)throw new Error("input required for convert");if(!n)throw new Error("timezone required for convert");return m(u(t),n)}case"diff":{if(!t)throw new Error("input required for diff (two comma-separated dates)");const r=t.split(",").map(c=>c.trim());if(r.length<2)throw new Error("diff requires two comma-separated dates");const i=u(r[0]),a=u(r[1]),s=Math.abs(a.getTime()-i.getTime());return{output:f(s),iso:`PT${Math.floor(s/1e3)}S`,unix:s,details:{milliseconds:s,seconds:Math.floor(s/1e3),minutes:Math.floor(s/6e4),hours:Math.floor(s/36e5),days:Math.floor(s/864e5)}}}case"add":{if(!t)throw new Error("input required for add");const{duration:r}=o;if(!r)throw new Error('duration required for add (e.g., "2h30m")');const i=u(t),a=d(r);return m(new Date(i.getTime()+a),n)}default:throw new Error(`Unknown operation: ${e}`)}}function u(o){const e=Number(o);if(!Number.isNaN(e))return new Date(e>1e12?e:e*1e3);const t=new Date(o);if(Number.isNaN(t.getTime()))throw new Error(`Cannot parse date: ${o}`);return t}function m(o,e){const t=e??"UTC",n=o.toLocaleString("en-US",{timeZone:t,dateStyle:"full",timeStyle:"long"}),r=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}).formatToParts(o).reduce((i,a)=>(a.type!=="literal"&&(i[a.type]=Number.parseInt(a.value,10)),i),{});return{output:n,iso:o.toISOString(),unix:Math.floor(o.getTime()/1e3),details:{timezone:t,year:r.year,month:r.month,day:r.day,hour:r.hour===24?0:r.hour,minute:r.minute,second:r.second}}}function f(o){const e=[],t=Math.floor(o/864e5);t&&e.push(`${t}d`);const n=Math.floor(o%864e5/36e5);n&&e.push(`${n}h`);const r=Math.floor(o%36e5/6e4);r&&e.push(`${r}m`);const i=Math.floor(o%6e4/1e3);return(i||e.length===0)&&e.push(`${i}s`),e.join(" ")}function d(o){let e=0;const t=o.matchAll(/(\d+)\s*(d|h|m|s|ms)/gi);for(const n of t){const r=Number(n[1]);switch(n[2].toLowerCase()){case"d":e+=r*864e5;break;case"h":e+=r*36e5;break;case"m":e+=r*6e4;break;case"s":e+=r*1e3;break;case"ms":e+=r;break}}if(e===0)throw new Error(`Cannot parse duration: ${o}`);return e}export{h as timeUtils};
1
+ function e(e){let{operation:a,input:o,timezone:s}=e;switch(a){case`now`:return n(new Date,s);case`parse`:if(!o)throw Error(`input required for parse`);return n(t(o),s);case`convert`:if(!o)throw Error(`input required for convert`);if(!s)throw Error(`timezone required for convert`);return n(t(o),s);case`diff`:{if(!o)throw Error(`input required for diff (two comma-separated dates)`);let e=o.split(`,`).map(e=>e.trim());if(e.length<2)throw Error(`diff requires two comma-separated dates`);let n=t(e[0]),i=t(e[1]),a=Math.abs(i.getTime()-n.getTime());return{output:r(a),iso:`PT${Math.floor(a/1e3)}S`,unix:a,details:{milliseconds:a,seconds:Math.floor(a/1e3),minutes:Math.floor(a/6e4),hours:Math.floor(a/36e5),days:Math.floor(a/864e5)}}}case`add`:{if(!o)throw Error(`input required for add`);let{duration:r}=e;if(!r)throw Error(`duration required for add (e.g., "2h30m")`);let a=t(o),c=i(r);return n(new Date(a.getTime()+c),s)}default:throw Error(`Unknown operation: ${a}`)}}function t(e){let t=Number(e);if(!Number.isNaN(t))return new Date(t>0xe8d4a51000?t:t*1e3);let n=new Date(e);if(Number.isNaN(n.getTime()))throw Error(`Cannot parse date: ${e}`);return n}function n(e,t){let n=t??`UTC`,r=e.toLocaleString(`en-US`,{timeZone:n,dateStyle:`full`,timeStyle:`long`}),i=new Intl.DateTimeFormat(`en-US`,{timeZone:n,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,hour12:!1}).formatToParts(e).reduce((e,t)=>(t.type!==`literal`&&(e[t.type]=Number.parseInt(t.value,10)),e),{});return{output:r,iso:e.toISOString(),unix:Math.floor(e.getTime()/1e3),details:{timezone:n,year:i.year,month:i.month,day:i.day,hour:i.hour===24?0:i.hour,minute:i.minute,second:i.second}}}function r(e){let t=[],n=Math.floor(e/864e5);n&&t.push(`${n}d`);let r=Math.floor(e%864e5/36e5);r&&t.push(`${r}h`);let i=Math.floor(e%36e5/6e4);i&&t.push(`${i}m`);let a=Math.floor(e%6e4/1e3);return(a||t.length===0)&&t.push(`${a}s`),t.join(` `)}function i(e){let t=0,n=e.matchAll(/(\d+)\s*(d|h|m|s|ms)/gi);for(let e of n){let n=Number(e[1]);switch(e[2].toLowerCase()){case`d`:t+=n*864e5;break;case`h`:t+=n*36e5;break;case`m`:t+=n*6e4;break;case`s`:t+=n*1e3;break;case`ms`:t+=n;break}}if(t===0)throw Error(`Cannot parse duration: ${e}`);return t}export{e as timeUtils};
2
+ //# sourceMappingURL=time-utils.js.map
@@ -1,24 +1,28 @@
1
- import type { IEmbedder } from '@kb/embeddings';
2
- import type { IKnowledgeStore } from '@kb/store';
3
- export interface TraceOptions {
4
- /** Starting point — a symbol or file:line reference */
5
- start: string;
6
- /** Direction */
7
- direction: 'forward' | 'backward' | 'both';
8
- /** Max depth (default: 3) */
9
- maxDepth?: number;
1
+ import { IEmbedder } from "@kb/embeddings";
2
+ import { IKnowledgeStore } from "@kb/store";
3
+
4
+ //#region packages/tools/src/trace.d.ts
5
+ interface TraceOptions {
6
+ /** Starting point — a symbol or file:line reference */
7
+ start: string;
8
+ /** Direction */
9
+ direction: 'forward' | 'backward' | 'both';
10
+ /** Max depth (default: 3) */
11
+ maxDepth?: number;
10
12
  }
11
- export interface TraceNode {
12
- path: string;
13
- symbol: string;
14
- line: number;
15
- relationship: 'calls' | 'called-by' | 'imports' | 'imported-by' | 'references';
13
+ interface TraceNode {
14
+ path: string;
15
+ symbol: string;
16
+ line: number;
17
+ relationship: 'calls' | 'called-by' | 'imports' | 'imported-by' | 'references';
16
18
  }
17
- export interface TraceResult {
18
- start: string;
19
- direction: string;
20
- nodes: TraceNode[];
21
- depth: number;
19
+ interface TraceResult {
20
+ start: string;
21
+ direction: string;
22
+ nodes: TraceNode[];
23
+ depth: number;
22
24
  }
23
- export declare function trace(embedder: IEmbedder, store: IKnowledgeStore, options: TraceOptions): Promise<TraceResult>;
25
+ declare function trace(embedder: IEmbedder, store: IKnowledgeStore, options: TraceOptions): Promise<TraceResult>;
26
+ //#endregion
27
+ export { TraceNode, TraceOptions, TraceResult, trace };
24
28
  //# sourceMappingURL=trace.d.ts.map
@@ -1,2 +1,3 @@
1
- async function v(e,a,r){const{start:s,direction:d,maxDepth:T=3}=r,i=[],x=new Set,p=new Set,R=await e.embed(s);if((await a.search(R,{limit:10})).length===0)return{start:s,direction:d,nodes:i,depth:0};const u=[{target:s,depth:0}];let n=0;for(;u.length>0;){const t=u.shift();if(!t)break;if(t.depth>=T||x.has(t.target))continue;x.add(t.target);const N=await e.embed(t.target),P=await a.search(N,{limit:20}),c=E(t.target),l=k(t.target);for(const b of P){const w=b.record.content.split(`
2
- `);for(let h=0;h<w.length;h+=1){const o=w[h],m=b.record.startLine+h,f=b.record.sourcePath;if(d!=="forward"&&(l?new RegExp(`from\\s+['"]${c}['"]`):new RegExp(`import\\s+.*\\b${c}\\b.*from\\s+`)).test(o)){g(p,i,{path:f,symbol:t.target,line:m,relationship:"imported-by"}),n=Math.max(n,t.depth+1);const $=o.match(/from\s+['"]([^'"]+)['"]/);!l&&$&&u.push({target:$[1],depth:t.depth+1})}d!=="backward"&&(l?new RegExp(`from\\s+['"]${c}['"]`).test(o)&&(g(p,i,{path:f,symbol:t.target,line:m,relationship:"imports"}),n=Math.max(n,t.depth+1)):new RegExp(`\\b${c}\\s*\\(`).test(o)&&!/^\s*(?:export\s+)?(?:async\s+)?function\s/.test(o)&&(g(p,i,{path:f,symbol:t.target,line:m,relationship:"calls"}),n=Math.max(n,t.depth+1))),(l?new RegExp(`['"]${c}['"]`):new RegExp(`\\b${c}\\b`)).test(o)&&!/^\s*import\s/.test(o)&&!/^\s*(?:export\s+)?(?:async\s+)?function\s/.test(o)&&(g(p,i,{path:f,symbol:t.target,line:m,relationship:"references"}),n=Math.max(n,t.depth+1))}}}return{start:s,direction:d,nodes:M(i),depth:n}}function g(e,a,r){const s=`${r.path}:${r.line}:${r.relationship}`;e.has(s)||(e.add(s),a.push(r))}function E(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function k(e){return/[./\\]/.test(e)}function M(e){const a=new Set;return e.filter(r=>{const s=`${r.path}:${r.line}:${r.relationship}`;return a.has(s)?!1:(a.add(s),!0)})}export{v as trace};
1
+ async function e(e,a,o){let{start:s,direction:c,maxDepth:l=3}=o,u=[],d=new Set,f=new Set,p=await e.embed(s);if((await a.search(p,{limit:10})).length===0)return{start:s,direction:c,nodes:u,depth:0};let m=[{target:s,depth:0}],h=0;for(;m.length>0;){let i=m.shift();if(!i)break;if(i.depth>=l||d.has(i.target))continue;d.add(i.target);let o=await e.embed(i.target),s=await a.search(o,{limit:20}),p=n(i.target),g=r(i.target);for(let e of s){let n=e.record.content.split(`
2
+ `);for(let r=0;r<n.length;r+=1){let a=n[r],o=e.record.startLine+r,s=e.record.sourcePath;if(c!==`forward`&&RegExp(g?`from\\s+['"]${p}['"]`:`import\\s+.*\\b${p}\\b.*from\\s+`).test(a)){t(f,u,{path:s,symbol:i.target,line:o,relationship:`imported-by`}),h=Math.max(h,i.depth+1);let e=a.match(/from\s+['"]([^'"]+)['"]/);!g&&e&&m.push({target:e[1],depth:i.depth+1})}c!==`backward`&&(g?RegExp(`from\\s+['"]${p}['"]`).test(a)&&(t(f,u,{path:s,symbol:i.target,line:o,relationship:`imports`}),h=Math.max(h,i.depth+1)):RegExp(`\\b${p}\\s*\\(`).test(a)&&!/^\s*(?:export\s+)?(?:async\s+)?function\s/.test(a)&&(t(f,u,{path:s,symbol:i.target,line:o,relationship:`calls`}),h=Math.max(h,i.depth+1))),RegExp(g?`['"]${p}['"]`:`\\b${p}\\b`).test(a)&&!/^\s*import\s/.test(a)&&!/^\s*(?:export\s+)?(?:async\s+)?function\s/.test(a)&&(t(f,u,{path:s,symbol:i.target,line:o,relationship:`references`}),h=Math.max(h,i.depth+1))}}}return{start:s,direction:c,nodes:i(u),depth:h}}function t(e,t,n){let r=`${n.path}:${n.line}:${n.relationship}`;e.has(r)||(e.add(r),t.push(n))}function n(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function r(e){return/[./\\]/.test(e)}function i(e){let t=new Set;return e.filter(e=>{let n=`${e.path}:${e.line}:${e.relationship}`;return t.has(n)?!1:(t.add(n),!0)})}export{e as trace};
3
+ //# sourceMappingURL=trace.js.map
@@ -1,3 +1,4 @@
1
+ //#region packages/tools/src/truncation.d.ts
1
2
  /**
2
3
  * Smart truncation utilities.
3
4
  *
@@ -13,12 +14,12 @@
13
14
  * @param headRatio - Fraction for head portion (default 0.6)
14
15
  * @returns Truncated text with separator showing omitted line/char count
15
16
  */
16
- export declare function headTailTruncate(text: string, maxLen: number, headRatio?: number): string;
17
+ declare function headTailTruncate(text: string, maxLen: number, headRatio?: number): string;
17
18
  /**
18
19
  * Truncate at a paragraph boundary near maxLength (head-only).
19
20
  * Best for web content and markdown where structure is at the top.
20
21
  */
21
- export declare function paragraphTruncate(text: string, maxLen: number): string;
22
+ declare function paragraphTruncate(text: string, maxLen: number): string;
22
23
  /**
23
24
  * Truncate text to fit within a token budget.
24
25
  * Uses ~4 chars/token approximation. Snaps to line boundaries.
@@ -27,5 +28,7 @@ export declare function paragraphTruncate(text: string, maxLen: number): string;
27
28
  * @param maxTokens - Maximum token count
28
29
  * @returns Original text if within budget, or truncated with notice
29
30
  */
30
- export declare function truncateToTokenBudget(text: string, maxTokens: number): string;
31
+ declare function truncateToTokenBudget(text: string, maxTokens: number): string;
32
+ //#endregion
33
+ export { headTailTruncate, paragraphTruncate, truncateToTokenBudget };
31
34
  //# sourceMappingURL=truncation.d.ts.map
@@ -1,14 +1,8 @@
1
- const R=.6;function m(n,t,e=.6){if(n.length<=t)return n;const r=Math.max(0,t-120),o=Math.floor(r*e),a=r-o,s=n.slice(0,o),h=s.lastIndexOf(`
2
- `),i=h>0?s.slice(0,h):s,p=n.length-a,l=n.slice(p),u=l.indexOf(`
3
- `),c=u>=0?l.slice(u+1):l,$=n.length-i.length-c.length;let d=1;const B=i.length,T=n.length-c.length;for(let g=B;g<T;g++)n.charCodeAt(g)===10&&d++;return`${i}
4
-
5
- [\u2026 ${d} lines / ${($/1024).toFixed(1)}KB truncated \u2014 showing first ${i.split(`
6
- `).length} + last ${c.split(`
7
- `).length} lines]
8
-
9
- ${c}`}function A(n,t){if(n.length<=t)return n;const e=Math.max(0,t-200),r=n.slice(e,t).lastIndexOf(`
10
-
11
- `),o=r>=0?e+r:t,a=n.slice(0,o).trimEnd(),s=Math.round(o/n.length*100);return`${a}
12
-
13
- ---
14
- *[Truncated at ${o.toLocaleString()} chars \u2014 ${s}% of original content]*`}function C(n,t){const e=t*4;return n.length<=e?n:m(n,e)}export{m as headTailTruncate,A as paragraphTruncate,C as truncateToTokenBudget};
1
+ function e(e,t,n=.6){if(e.length<=t)return e;let r=Math.max(0,t-120),i=Math.floor(r*n),a=r-i,o=e.slice(0,i),s=o.lastIndexOf(`
2
+ `),c=s>0?o.slice(0,s):o,l=e.length-a,u=e.slice(l),d=u.indexOf(`
3
+ `),f=d>=0?u.slice(d+1):u,p=e.length-c.length-f.length,m=1,h=c.length,g=e.length-f.length;for(let t=h;t<g;t++)e.charCodeAt(t)===10&&m++;return`${c}\n\n[… ${m} lines / ${(p/1024).toFixed(1)}KB truncated — showing first ${c.split(`
4
+ `).length} + last ${f.split(`
5
+ `).length} lines]\n\n${f}`}function t(e,t){if(e.length<=t)return e;let n=Math.max(0,t-200),r=e.slice(n,t).lastIndexOf(`
6
+
7
+ `),i=r>=0?n+r:t,a=e.slice(0,i).trimEnd(),o=Math.round(i/e.length*100);return`${a}\n\n---\n*[Truncated at ${i.toLocaleString()} chars — ${o}% of original content]*`}function n(t,n){let r=n*4;return t.length<=r?t:e(t,r)}export{e as headTailTruncate,t as paragraphTruncate,n as truncateToTokenBudget};
8
+ //# sourceMappingURL=truncation.js.map
@@ -1,30 +1,33 @@
1
- export interface WatchEvent {
2
- type: 'change' | 'rename';
3
- path: string;
4
- timestamp: string;
1
+ //#region packages/tools/src/watch.d.ts
2
+ interface WatchEvent {
3
+ type: 'change' | 'rename';
4
+ path: string;
5
+ timestamp: string;
5
6
  }
6
- export interface WatchOptions {
7
- /** Directory to watch */
8
- path: string;
9
- /** Glob patterns to exclude */
10
- exclude?: string[];
11
- /** Max events to buffer (default: 100) */
12
- maxEvents?: number;
7
+ interface WatchOptions {
8
+ /** Directory to watch */
9
+ path: string;
10
+ /** Glob patterns to exclude */
11
+ exclude?: string[];
12
+ /** Max events to buffer (default: 100) */
13
+ maxEvents?: number;
13
14
  }
14
- export interface WatchHandle {
15
- id: string;
16
- path: string;
17
- events: WatchEvent[];
18
- status: 'watching' | 'stopped';
19
- stop: () => void;
20
- getEvents: (since?: string) => WatchEvent[];
15
+ interface WatchHandle {
16
+ id: string;
17
+ path: string;
18
+ events: WatchEvent[];
19
+ status: 'watching' | 'stopped';
20
+ stop: () => void;
21
+ getEvents: (since?: string) => WatchEvent[];
21
22
  }
22
- export declare function watchStart(options: WatchOptions): WatchHandle;
23
- export declare function watchStop(id: string): boolean;
24
- export declare function watchList(): Array<{
25
- id: string;
26
- path: string;
27
- status: string;
28
- eventCount: number;
23
+ declare function watchStart(options: WatchOptions): WatchHandle;
24
+ declare function watchStop(id: string): boolean;
25
+ declare function watchList(): Array<{
26
+ id: string;
27
+ path: string;
28
+ status: string;
29
+ eventCount: number;
29
30
  }>;
31
+ //#endregion
32
+ export { WatchEvent, WatchHandle, WatchOptions, watchList, watchStart, watchStop };
30
33
  //# sourceMappingURL=watch.d.ts.map
@@ -1 +1,2 @@
1
- import{watch as g}from"node:fs";const r=new Map,m=["node_modules",".git","dist",".turbo",".kb-data","cdk.out"];function v(t){const{path:s,maxEvents:p=100}=t,d=t.exclude??m,c=`watch-${Date.now()}`,e=[],l=n=>d.some(a=>o(n).includes(o(a))),u=g(s,{recursive:!0},(n,a)=>{if(a==null)return;const h=String(a);!h||l(h)||(e.push({type:n,path:o(h),timestamp:new Date().toISOString()}),e.length>p&&e.shift())}),i={id:c,path:s,events:e,status:"watching",stop:()=>{u.close(),i.status="stopped",r.delete(c)},getEvents:n=>n?e.filter(a=>a.timestamp>n):e};return r.set(c,{watcher:u,handle:i}),i}function w(t){const s=r.get(t);return s?(s.handle.stop(),!0):!1}function x(){return[...r.values()].map(t=>({id:t.handle.id,path:t.handle.path,status:t.handle.status,eventCount:t.handle.events.length}))}function o(t){return t.replace(/\\/g,"/")}export{x as watchList,v as watchStart,w as watchStop};
1
+ import{watch as e}from"node:fs";const t=new Map,n=[`node_modules`,`.git`,`dist`,`.turbo`,`.kb-data`,`cdk.out`];function r(r){if(t.size>=20)throw Error(`Watcher limit reached (20). Stop existing watchers first.`);let{path:i,maxEvents:a=100}=r,s=r.exclude??n,c=`watch-${Date.now()}`,l=[],u=e=>s.some(t=>o(e).includes(o(t))),d=e(i,{recursive:!0},(e,t)=>{if(t==null)return;let n=String(t);!n||u(n)||(l.push({type:e,path:o(n),timestamp:new Date().toISOString()}),l.length>a&&l.shift())});d.on(`error`,()=>{f.status=`stopped`,t.delete(c);try{d.close()}catch{}});let f={id:c,path:i,events:l,status:`watching`,stop:()=>{d.close(),f.status=`stopped`,t.delete(c)},getEvents:e=>e?l.filter(t=>t.timestamp>e):l};return t.set(c,{watcher:d,handle:f}),f}function i(e){let n=t.get(e);return n?(n.handle.stop(),!0):!1}function a(){return[...t.values()].map(e=>({id:e.handle.id,path:e.handle.path,status:e.handle.status,eventCount:e.handle.events.length}))}function o(e){return e.replace(/\\/g,`/`)}export{a as watchList,r as watchStart,i as watchStop};
2
+ //# sourceMappingURL=watch.js.map
@@ -1,3 +1,4 @@
1
+ //#region packages/tools/src/web-fetch.d.ts
1
2
  /**
2
3
  * kb_web_fetch — Fetch a web page and convert to LLM-friendly format.
3
4
  *
@@ -5,41 +6,43 @@
5
6
  * extracted links, or heading outline. Strips scripts, styles,
6
7
  * and non-content elements for compact, token-efficient output.
7
8
  */
8
- export type WebFetchMode = 'markdown' | 'raw' | 'links' | 'outline';
9
- export interface WebFetchOptions {
10
- /** URL to fetch */
11
- url: string;
12
- /** Output mode */
13
- mode?: WebFetchMode;
14
- /** CSS selector to extract specific element (default: auto-detect main content) */
15
- selector?: string;
16
- /** Max characters in output — smart truncation at paragraph boundaries */
17
- maxLength?: number;
18
- /** Include page metadata header (title, description, URL) */
19
- includeMetadata?: boolean;
20
- /** Append extracted links list at the end */
21
- includeLinks?: boolean;
22
- /** Include image alt texts inline */
23
- includeImages?: boolean;
24
- /** Request timeout in milliseconds */
25
- timeout?: number;
9
+ type WebFetchMode = 'markdown' | 'raw' | 'links' | 'outline';
10
+ interface WebFetchOptions {
11
+ /** URL to fetch */
12
+ url: string;
13
+ /** Output mode */
14
+ mode?: WebFetchMode;
15
+ /** CSS selector to extract specific element (default: auto-detect main content) */
16
+ selector?: string;
17
+ /** Max characters in output — smart truncation at paragraph boundaries */
18
+ maxLength?: number;
19
+ /** Include page metadata header (title, description, URL) */
20
+ includeMetadata?: boolean;
21
+ /** Append extracted links list at the end */
22
+ includeLinks?: boolean;
23
+ /** Include image alt texts inline */
24
+ includeImages?: boolean;
25
+ /** Request timeout in milliseconds */
26
+ timeout?: number;
26
27
  }
27
- export interface WebFetchResult {
28
- /** The converted content */
29
- content: string;
30
- /** Page title */
31
- title: string;
32
- /** Page description (from meta) */
33
- description: string;
34
- /** Final URL after redirects */
35
- url: string;
36
- /** Content length before truncation */
37
- originalLength: number;
38
- /** Whether content was truncated */
39
- truncated: boolean;
28
+ interface WebFetchResult {
29
+ /** The converted content */
30
+ content: string;
31
+ /** Page title */
32
+ title: string;
33
+ /** Page description (from meta) */
34
+ description: string;
35
+ /** Final URL after redirects */
36
+ url: string;
37
+ /** Content length before truncation */
38
+ originalLength: number;
39
+ /** Whether content was truncated */
40
+ truncated: boolean;
40
41
  }
41
42
  /**
42
43
  * Fetch a web page and convert to an LLM-friendly format.
43
44
  */
44
- export declare function webFetch(options: WebFetchOptions): Promise<WebFetchResult>;
45
+ declare function webFetch(options: WebFetchOptions): Promise<WebFetchResult>;
46
+ //#endregion
47
+ export { WebFetchMode, WebFetchOptions, WebFetchResult, webFetch };
45
48
  //# sourceMappingURL=web-fetch.d.ts.map
@@ -1,14 +1,9 @@
1
- import N from"turndown";import{paragraphTruncate as W}from"./truncation.js";const _=15e3,C=15e3,H=["script","style","noscript","iframe","svg","nav","footer","header","aside","form","button","input","select","textarea",'[role="navigation"]','[role="banner"]','[role="contentinfo"]','[aria-hidden="true"]',".sidebar",".nav",".menu",".footer",".header",".ad",".advertisement",".cookie-banner",".popup",".modal"],I=["article",'[role="main"]',"main",".post-content",".article-content",".entry-content",".content","#content",".prose",".markdown-body",".documentation",".doc-content"];async function X(r){const{url:o,mode:e="markdown",selector:t,maxLength:c=_,includeMetadata:d=!0,includeLinks:p=!1,includeImages:y=!1,timeout:v=C}=r,g=new URL(o);if(g.protocol!=="http:"&&g.protocol!=="https:")throw new Error(`Unsupported protocol: ${g.protocol} \u2014 only http/https allowed`);const k=new AbortController,$=setTimeout(()=>k.abort(),v);let l;try{l=await fetch(o,{signal:k.signal,headers:{"User-Agent":"kb-web-fetch/1.0 (LLM context tool)",Accept:"text/html,application/xhtml+xml,text/plain"},redirect:"follow"})}finally{clearTimeout($)}if(!l.ok)throw new Error(`HTTP ${l.status}: ${l.statusText}`);const R=l.headers.get("content-type")??"",U=/text\/html|application\/xhtml\+xml/i.test(R),L=await l.text(),u=l.url;if(!U){let n=L;const m=u.split("/").pop()??"";d&&(n=M(m,"",u)+n);const f=n.length,E=f>c;return E&&(n=q(n,c)),{content:n,title:m,description:"",url:u,originalLength:f,truncated:E}}const{parseHTML:F}=await import("linkedom"),{document:a}=F(L),b=a.querySelector("title")?.textContent?.trim()??a.querySelector('meta[property="og:title"]')?.getAttribute("content")?.trim()??"",x=a.querySelector('meta[name="description"]')?.getAttribute("content")?.trim()??a.querySelector('meta[property="og:description"]')?.getAttribute("content")?.trim()??"";for(const n of H)for(const m of a.querySelectorAll(n))m.remove();if(!y)for(const n of a.querySelectorAll("img"))n.remove();let s=null;if(t){if(s=a.querySelector(t),!s)throw new Error(`Selector "${t}" matched no elements on the page`)}else{for(const n of I)if(s=a.querySelector(n),s)break;s||(s=a.querySelector("body"))}if(!s)return{content:"(empty page \u2014 no content found)",title:b,description:x,url:u,originalLength:0,truncated:!1};const w=s.innerHTML,h=[];if(p||e==="links")for(const n of s.querySelectorAll("a[href]")){const m=n.textContent?.trim(),f=n.getAttribute("href");m&&f&&!f.startsWith("#")&&!f.startsWith("javascript:")&&h.push({text:m,href:P(f,u)})}let i;switch(e){case"raw":i=w;break;case"links":i=A(h);break;case"outline":i=j(s);break;default:i=O(w,y);break}d&&e!=="links"&&(i=M(b,x,u)+i),p&&e!=="links"&&h.length>0&&(i+=`
1
+ import{paragraphTruncate as e}from"./truncation.js";import t from"turndown";const n=`script,style,noscript,iframe,svg,nav,footer,header,aside,form,button,input,select,textarea,[role="navigation"],[role="banner"],[role="contentinfo"],[aria-hidden="true"],.sidebar,.nav,.menu,.footer,.header,.ad,.advertisement,.cookie-banner,.popup,.modal`.split(`,`),r=[`article`,`[role="main"]`,`main`,`.post-content`,`.article-content`,`.entry-content`,`.content`,`#content`,`.prose`,`.markdown-body`,`.documentation`,`.doc-content`];async function i(e){let{url:t,mode:i=`markdown`,selector:d,maxLength:f=15e3,includeMetadata:p=!0,includeLinks:m=!1,includeImages:h=!1,timeout:g=15e3}=e,_=new URL(t);if(_.protocol!==`http:`&&_.protocol!==`https:`)throw Error(`Unsupported protocol: ${_.protocol} only http/https allowed`);let v=new AbortController,y=setTimeout(()=>v.abort(),g),b;try{b=await fetch(t,{signal:v.signal,headers:{"User-Agent":`kb-web-fetch/1.0 (LLM context tool)`,Accept:`text/html,application/xhtml+xml,text/plain`},redirect:`follow`})}finally{clearTimeout(y)}if(!b.ok)throw Error(`HTTP ${b.status}: ${b.statusText}`);let x=b.headers.get(`content-type`)??``,S=/text\/html|application\/xhtml\+xml/i.test(x),C=await b.text(),w=b.url;if(!S){let e=C,t=w.split(`/`).pop()??``;p&&(e=c(t,``,w)+e);let n=e.length,r=n>f;return r&&(e=u(e,f)),{content:e,title:t,description:``,url:w,originalLength:n,truncated:r}}let{parseHTML:T}=await import(`linkedom`),{document:E}=T(C),D=E.querySelector(`title`)?.textContent?.trim()??E.querySelector(`meta[property="og:title"]`)?.getAttribute(`content`)?.trim()??``,O=E.querySelector(`meta[name="description"]`)?.getAttribute(`content`)?.trim()??E.querySelector(`meta[property="og:description"]`)?.getAttribute(`content`)?.trim()??``;for(let e of n)for(let t of E.querySelectorAll(e))t.remove();if(!h)for(let e of E.querySelectorAll(`img`))e.remove();let k=null;if(d){if(k=E.querySelector(d),!k)throw Error(`Selector "${d}" matched no elements on the page`)}else{for(let e of r)if(k=E.querySelector(e),k)break;k||=E.querySelector(`body`)}if(!k)return{content:`(empty page no content found)`,title:D,description:O,url:w,originalLength:0,truncated:!1};let A=k.innerHTML,j=[];if(m||i===`links`)for(let e of k.querySelectorAll(`a[href]`)){let t=e.textContent?.trim(),n=e.getAttribute(`href`);t&&n&&!n.startsWith(`#`)&&!n.startsWith(`javascript:`)&&j.push({text:t,href:l(n,w)})}let M;switch(i){case`raw`:M=A;break;case`links`:M=s(j);break;case`outline`:M=o(k);break;default:M=a(A,h);break}p&&i!==`links`&&(M=c(D,O,w)+M),m&&i!==`links`&&j.length>0&&(M+=`\n\n---\n\n## Links\n\n${s(j)}`);let N=M.length,P=N>f;return P&&(M=u(M,f)),{content:M,title:D,description:O,url:w,originalLength:N,truncated:P}}function a(e,n){let r=new t({headingStyle:`atx`,codeBlockStyle:`fenced`,bulletListMarker:`-`});r.addRule(`emptyLinks`,{filter:e=>e.nodeName===`A`&&!e.textContent?.trim(),replacement:()=>``}),n||r.addRule(`removeImages`,{filter:`img`,replacement:()=>``});let i=r.turndown(e);return i=i.replace(/\n{3,}/g,`
2
2
 
3
- ---
3
+ `).trim(),i}function o(e){let t=e.querySelectorAll(`h1, h2, h3, h4, h5, h6`),n=[];for(let e of t){let t=Number.parseInt(e.tagName.slice(1),10),r=` `.repeat(t-1),i=e.textContent?.trim()??``;i&&n.push(`${r}- ${i}`)}return n.length>0?n.join(`
4
+ `):`(no headings found)`}function s(e){if(e.length===0)return`(no links found)`;let t=new Set,n=[];for(let r of e)t.has(r.href)||(t.add(r.href),n.push(r));return n.map(e=>`- [${e.text}](${e.href})`).join(`
5
+ `)}function c(e,t,n){let r=[`---`];return e&&r.push(`**${e}**`),r.push(`URL: ${n}`),t&&r.push(`> ${t}`),r.push(`---
4
6
 
5
- ## Links
6
-
7
- ${A(h)}`);const T=i.length,S=T>c;return S&&(i=q(i,c)),{content:i,title:b,description:x,url:u,originalLength:T,truncated:S}}function O(r,o){const e=new N({headingStyle:"atx",codeBlockStyle:"fenced",bulletListMarker:"-"});e.addRule("emptyLinks",{filter:c=>c.nodeName==="A"&&!c.textContent?.trim(),replacement:()=>""}),o||e.addRule("removeImages",{filter:"img",replacement:()=>""});let t=e.turndown(r);return t=t.replace(/\n{3,}/g,`
8
-
9
- `).trim(),t}function j(r){const o=r.querySelectorAll("h1, h2, h3, h4, h5, h6"),e=[];for(const t of o){const c=Number.parseInt(t.tagName.slice(1),10),d=" ".repeat(c-1),p=t.textContent?.trim()??"";p&&e.push(`${d}- ${p}`)}return e.length>0?e.join(`
10
- `):"(no headings found)"}function A(r){if(r.length===0)return"(no links found)";const o=new Set,e=[];for(const t of r)o.has(t.href)||(o.add(t.href),e.push(t));return e.map(t=>`- [${t.text}](${t.href})`).join(`
11
- `)}function M(r,o,e){const t=["---"];return r&&t.push(`**${r}**`),t.push(`URL: ${e}`),o&&t.push(`> ${o}`),t.push(`---
12
-
13
- `),t.join(`
14
- `)}function P(r,o){try{return new URL(r,o).href}catch{return r}}const q=W;export{X as webFetch};
7
+ `),r.join(`
8
+ `)}function l(e,t){try{return new URL(e,t).href}catch{return e}}const u=e;export{i as webFetch};
9
+ //# sourceMappingURL=web-fetch.js.map
@@ -1,23 +1,26 @@
1
+ //#region packages/tools/src/web-search.d.ts
1
2
  /**
2
3
  * kb_web_search — Search the web and return structured results.
3
4
  *
4
5
  * Uses DuckDuckGo HTML search (no API key required).
5
6
  */
6
- export interface WebSearchOptions {
7
- query: string;
8
- limit?: number;
9
- site?: string;
7
+ interface WebSearchOptions {
8
+ query: string;
9
+ limit?: number;
10
+ site?: string;
10
11
  }
11
- export interface WebSearchResultItem {
12
- title: string;
13
- url: string;
14
- snippet: string;
12
+ interface WebSearchResultItem {
13
+ title: string;
14
+ url: string;
15
+ snippet: string;
15
16
  }
16
- export interface WebSearchResult {
17
- results: WebSearchResultItem[];
18
- query: string;
17
+ interface WebSearchResult {
18
+ results: WebSearchResultItem[];
19
+ query: string;
19
20
  }
20
- export declare function webSearch(options: WebSearchOptions): Promise<WebSearchResult>;
21
+ declare function webSearch(options: WebSearchOptions): Promise<WebSearchResult>;
21
22
  /** Parse search results from DuckDuckGo HTML. Exported for testing. */
22
- export declare function parseSearchResults(html: string, query: string, limit: number): WebSearchResult;
23
+ declare function parseSearchResults(html: string, query: string, limit: number): WebSearchResult;
24
+ //#endregion
25
+ export { WebSearchOptions, WebSearchResult, WebSearchResultItem, parseSearchResults, webSearch };
23
26
  //# sourceMappingURL=web-search.d.ts.map
@@ -1 +1,2 @@
1
- const h=5;async function g(r){const{query:n,limit:i=5,site:s}=r;if(!n.trim())throw new Error("Search query cannot be empty");const c=s?`${n} site:${s}`:n,e=await fetch("https://html.duckduckgo.com/html/",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","User-Agent":"kb-web-search/1.0 (LLM developer tool)"},body:`q=${encodeURIComponent(c)}`});if(!e.ok)throw new Error(`Search failed: HTTP ${e.status}`);const t=await e.text();return p(t,c,i)}function p(r,n,i){const s=[],c=/<a[^>]+class="result__a"[^>]*href="([^"]*)"[^>]*>([\s\S]*?)<\/a>[\s\S]*?<a[^>]+class="result__snippet"[^>]*>([\s\S]*?)<\/a>/gi;let e=c.exec(r);for(;e!==null&&s.length<i;){let t=e[1];const o=l(e[2]).trim(),u=l(e[3]).trim();if(t.includes("uddg=")){const a=t.match(/uddg=([^&]+)/)?.[1];a&&(t=decodeURIComponent(a))}o&&t?.startsWith("http")&&s.push({title:o,url:t,snippet:u}),e=c.exec(r)}return{results:s,query:n}}function l(r){return r.replace(/<[^>]+>/g,"").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'")}export{p as parseSearchResults,g as webSearch};
1
+ async function e(e){let{query:n,limit:r=5,site:i}=e;if(!n.trim())throw Error(`Search query cannot be empty`);let a=i?`${n} site:${i}`:n,o=new AbortController,s=setTimeout(()=>o.abort(),15e3),c;try{c=await fetch(`https://html.duckduckgo.com/html/`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`,"User-Agent":`kb-web-search/1.0 (LLM developer tool)`},body:`q=${encodeURIComponent(a)}`,signal:o.signal})}finally{clearTimeout(s)}if(!c.ok)throw Error(`Search failed: HTTP ${c.status}`);return t(await c.text(),a,r)}function t(e,t,r){let i=[],a=/<a[^>]+class="result__a"[^>]*href="([^"]*)"[^>]*>([\s\S]*?)<\/a>[\s\S]*?<a[^>]+class="result__snippet"[^>]*>([\s\S]*?)<\/a>/gi,o=a.exec(e);for(;o!==null&&i.length<r;){let t=o[1],r=n(o[2]).trim(),s=n(o[3]).trim();if(t.includes(`uddg=`)){let e=t.match(/uddg=([^&]+)/)?.[1];e&&(t=decodeURIComponent(e))}r&&t?.startsWith(`http`)&&i.push({title:r,url:t,snippet:s}),o=a.exec(e)}return{results:i,query:t}}function n(e){return e.replace(/<[^>]+>/g,``).replace(/&amp;/g,`&`).replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&quot;/g,`"`).replace(/&#x27;/g,`'`)}export{t as parseSearchResults,e as webSearch};
2
+ //# sourceMappingURL=web-search.js.map
@@ -1,3 +1,4 @@
1
+ //#region packages/tools/src/workset.d.ts
1
2
  /**
2
3
  * kb_workset — Named file set management.
3
4
  *
@@ -5,41 +6,43 @@
5
6
  * Use cases: "remember this set of files I'm working on",
6
7
  * "load my previous context", "share file sets between sessions".
7
8
  */
8
- export interface Workset {
9
- name: string;
10
- files: string[];
11
- created: string;
12
- updated: string;
13
- description?: string;
9
+ interface Workset {
10
+ name: string;
11
+ files: string[];
12
+ created: string;
13
+ updated: string;
14
+ description?: string;
14
15
  }
15
- export interface WorksetStore {
16
- worksets: Record<string, Workset>;
16
+ interface WorksetStore {
17
+ worksets: Record<string, Workset>;
17
18
  }
18
19
  /**
19
20
  * Create or update a workset.
20
21
  */
21
- export declare function saveWorkset(name: string, files: string[], options?: {
22
- description?: string;
23
- cwd?: string;
22
+ declare function saveWorkset(name: string, files: string[], options?: {
23
+ description?: string;
24
+ cwd?: string;
24
25
  }): Workset;
25
26
  /**
26
27
  * Get a workset by name.
27
28
  */
28
- export declare function getWorkset(name: string, cwd?: string): Workset | null;
29
+ declare function getWorkset(name: string, cwd?: string): Workset | null;
29
30
  /**
30
31
  * List all worksets.
31
32
  */
32
- export declare function listWorksets(cwd?: string): Workset[];
33
+ declare function listWorksets(cwd?: string): Workset[];
33
34
  /**
34
35
  * Delete a workset.
35
36
  */
36
- export declare function deleteWorkset(name: string, cwd?: string): boolean;
37
+ declare function deleteWorkset(name: string, cwd?: string): boolean;
37
38
  /**
38
39
  * Add files to an existing workset (creates if not exists).
39
40
  */
40
- export declare function addToWorkset(name: string, files: string[], cwd?: string): Workset;
41
+ declare function addToWorkset(name: string, files: string[], cwd?: string): Workset;
41
42
  /**
42
43
  * Remove files from a workset.
43
44
  */
44
- export declare function removeFromWorkset(name: string, files: string[], cwd?: string): Workset | null;
45
+ declare function removeFromWorkset(name: string, files: string[], cwd?: string): Workset | null;
46
+ //#endregion
47
+ export { Workset, WorksetStore, addToWorkset, deleteWorkset, getWorkset, listWorksets, removeFromWorkset, saveWorkset };
45
48
  //# sourceMappingURL=workset.d.ts.map
@@ -1,2 +1,2 @@
1
- import{existsSync as g,mkdirSync as l,readFileSync as a,writeFileSync as p}from"node:fs";import{dirname as w,resolve as S}from"node:path";const W=".kb-state",x="worksets.json";function u(t){const r=t??process.cwd();return S(r,W,x)}function c(t){const r=u(t);if(!g(r))return{worksets:{}};const e=a(r,"utf-8");return JSON.parse(e)}function k(t,r){const e=u(r),s=w(e);g(s)||l(s,{recursive:!0}),p(e,`${JSON.stringify(t,null,2)}
2
- `,"utf-8")}function d(t,r,e){const s=c(e?.cwd),o=new Date().toISOString(),n=s.worksets[t],i={name:t,files:r,created:n?.created??o,updated:o,description:e?.description??n?.description};return s.worksets[t]=i,k(s,e?.cwd),i}function T(t,r){return c(r).worksets[t]??null}function y(t){const r=c(t);return Object.values(r.worksets).sort((e,s)=>new Date(s.updated).getTime()-new Date(e.updated).getTime())}function F(t,r){const e=c(r);return e.worksets[t]?(delete e.worksets[t],k(e,r),!0):!1}function O(t,r,e){const n=c(e).worksets[t]?.files??[],i=[...new Set([...n,...r])];return d(t,i,{cwd:e})}function h(t,r,e){const o=c(e).worksets[t];if(!o)return null;const n=new Set(r),i=o.files.filter(f=>!n.has(f));return d(t,i,{cwd:e})}export{O as addToWorkset,F as deleteWorkset,T as getWorkset,y as listWorksets,h as removeFromWorkset,d as saveWorkset};
1
+ import{dirname as e,resolve as t}from"node:path";import{existsSync as n,mkdirSync as r,readFileSync as i,writeFileSync as a}from"node:fs";function o(e){return t(e??process.cwd(),`.kb-state`,`worksets.json`)}function s(e){let t=o(e);if(!n(t))return{worksets:{}};try{let e=i(t,`utf-8`);return JSON.parse(e)}catch{return{worksets:{}}}}function c(t,i){let s=o(i),c=e(s);n(c)||r(c,{recursive:!0}),a(s,`${JSON.stringify(t,null,2)}\n`,`utf-8`)}function l(e,t,n){let r=s(n?.cwd),i=new Date().toISOString(),a=r.worksets[e],o={name:e,files:t,created:a?.created??i,updated:i,description:n?.description??a?.description};return r.worksets[e]=o,c(r,n?.cwd),o}function u(e,t){return s(t).worksets[e]??null}function d(e){let t=s(e);return Object.values(t.worksets).sort((e,t)=>new Date(t.updated).getTime()-new Date(e.updated).getTime())}function f(e,t){let n=s(t);return n.worksets[e]?(delete n.worksets[e],c(n,t),!0):!1}function p(e,t,n){let r=s(n).worksets[e]?.files??[];return l(e,[...new Set([...r,...t])],{cwd:n})}function m(e,t,n){let r=s(n).worksets[e];if(!r)return null;let i=new Set(t);return l(e,r.files.filter(e=>!i.has(e)),{cwd:n})}export{p as addToWorkset,f as deleteWorkset,u as getWorkset,d as listWorksets,m as removeFromWorkset,l as saveWorkset};
2
+ //# sourceMappingURL=workset.js.map
@@ -0,0 +1,3 @@
1
+ import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
+ import{r as e}from"./chunk-D6axbAb-.js";import{a as t,i as n,n as r,s as i,t as a}from"./jsx-runtime-Cof-kwFn.js";import{t as o}from"./StatusPanel-2ex8fLOO.js";import{t as s}from"./SearchPanel-DREo6zgt.js";import{t as c}from"./CuratedPanel-sYdZAICX.js";import{t as l}from"./LogPanel-DVB8Sv46.js";var u=e(i()),d=a();const f=[`status`,`search`,`curated`,`log`];function p({context:e}){let[i,a]=(0,u.useState)(`status`);return r((e,t)=>{t.tab&&a(f[(f.indexOf(i)+1)%f.length]),e===`1`&&a(`status`),e===`2`&&a(`search`),e===`3`&&a(`curated`),e===`4`&&a(`log`)}),(0,d.jsxs)(t,{flexDirection:`column`,width:`100%`,children:[(0,d.jsxs)(t,{borderStyle:`single`,paddingX:1,children:[(0,d.jsx)(n,{bold:!0,color:`cyan`,children:`KB Dashboard`}),(0,d.jsx)(n,{children:` │ `}),f.map(e=>(0,d.jsxs)(u.Fragment,{children:[(0,d.jsxs)(n,{color:e===i?`green`:`gray`,bold:e===i,children:[`[`,f.indexOf(e)+1,`] `,e]}),(0,d.jsx)(n,{children:` `})]},e)),(0,d.jsx)(n,{color:`gray`,children:` │ Tab: switch │ Ctrl+C: quit`})]}),(0,d.jsxs)(t,{flexGrow:1,minHeight:10,children:[i===`status`&&(0,d.jsx)(o,{store:e.store}),i===`search`&&(0,d.jsx)(s,{store:e.store,embedder:e.embedder}),i===`curated`&&(0,d.jsx)(c,{store:e.store}),i===`log`&&(0,d.jsx)(l,{})]})]})}export{p as t};
3
+ //# sourceMappingURL=App-BAlmxCCw.js.map
@@ -1,8 +1,14 @@
1
- import React from 'react';
2
- import type { TUIContext } from './index.js';
1
+ import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
+ import { t as TUIContext } from "./index-B9VpfVPP.js";
3
+ import React from "react";
4
+
5
+ //#region packages/tui/src/App.d.ts
3
6
  interface AppProps {
4
- context: TUIContext;
7
+ context: TUIContext;
5
8
  }
6
- export declare function App({ context }: AppProps): React.ReactElement;
7
- export {};
9
+ declare function App({
10
+ context
11
+ }: AppProps): React.ReactElement;
12
+ //#endregion
13
+ export { App };
8
14
  //# sourceMappingURL=App.d.ts.map