aspectcode 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/dist/cli.d.ts +15 -47
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +18 -17
  4. package/dist/cli.js.map +1 -1
  5. package/dist/config.d.ts +14 -24
  6. package/dist/config.d.ts.map +1 -1
  7. package/dist/config.js +5 -60
  8. package/dist/config.js.map +1 -1
  9. package/dist/kbBuilder.d.ts +14 -0
  10. package/dist/kbBuilder.d.ts.map +1 -0
  11. package/dist/kbBuilder.js +106 -0
  12. package/dist/kbBuilder.js.map +1 -0
  13. package/dist/main.d.ts +4 -5
  14. package/dist/main.d.ts.map +1 -1
  15. package/dist/main.js +45 -124
  16. package/dist/main.js.map +1 -1
  17. package/dist/optimize.d.ts +14 -0
  18. package/dist/optimize.d.ts.map +1 -0
  19. package/dist/optimize.js +131 -0
  20. package/dist/optimize.js.map +1 -0
  21. package/dist/pipeline.d.ts +15 -0
  22. package/dist/pipeline.d.ts.map +1 -0
  23. package/dist/pipeline.js +212 -0
  24. package/dist/pipeline.js.map +1 -0
  25. package/dist/toolIngestion.d.ts +15 -0
  26. package/dist/toolIngestion.d.ts.map +1 -0
  27. package/dist/toolIngestion.js +47 -0
  28. package/dist/toolIngestion.js.map +1 -0
  29. package/dist/writer.d.ts +17 -0
  30. package/dist/writer.d.ts.map +1 -0
  31. package/dist/writer.js +26 -0
  32. package/dist/writer.js.map +1 -0
  33. package/node_modules/@aspectcode/core/dist/analysis/analyzer.d.ts +34 -0
  34. package/node_modules/@aspectcode/core/dist/analysis/analyzer.d.ts.map +1 -0
  35. package/node_modules/@aspectcode/core/dist/analysis/analyzer.js +240 -0
  36. package/node_modules/@aspectcode/core/dist/analysis/analyzer.js.map +1 -0
  37. package/node_modules/@aspectcode/core/dist/analysis/dependencyAdapters.d.ts +32 -0
  38. package/node_modules/@aspectcode/core/dist/analysis/dependencyAdapters.d.ts.map +1 -0
  39. package/node_modules/@aspectcode/core/dist/analysis/dependencyAdapters.js +133 -0
  40. package/node_modules/@aspectcode/core/dist/analysis/dependencyAdapters.js.map +1 -0
  41. package/node_modules/@aspectcode/core/dist/analysis/importParsers.d.ts +30 -0
  42. package/node_modules/@aspectcode/core/dist/analysis/importParsers.d.ts.map +1 -0
  43. package/node_modules/@aspectcode/core/dist/analysis/importParsers.js +92 -0
  44. package/node_modules/@aspectcode/core/dist/analysis/importParsers.js.map +1 -0
  45. package/node_modules/@aspectcode/core/dist/analysis/index.d.ts +9 -0
  46. package/node_modules/@aspectcode/core/dist/analysis/index.d.ts.map +1 -0
  47. package/node_modules/@aspectcode/core/dist/analysis/index.js +9 -0
  48. package/node_modules/@aspectcode/core/dist/analysis/index.js.map +1 -0
  49. package/node_modules/@aspectcode/core/dist/analysis/moduleResolver.d.ts +34 -0
  50. package/node_modules/@aspectcode/core/dist/analysis/moduleResolver.d.ts.map +1 -0
  51. package/node_modules/@aspectcode/core/dist/analysis/moduleResolver.js +240 -0
  52. package/node_modules/@aspectcode/core/dist/analysis/moduleResolver.js.map +1 -0
  53. package/node_modules/@aspectcode/core/dist/analysis/repo.d.ts +33 -0
  54. package/node_modules/@aspectcode/core/dist/analysis/repo.d.ts.map +1 -0
  55. package/node_modules/@aspectcode/core/dist/analysis/repo.js +246 -0
  56. package/node_modules/@aspectcode/core/dist/analysis/repo.js.map +1 -0
  57. package/node_modules/@aspectcode/core/dist/classifiers.d.ts +24 -0
  58. package/node_modules/@aspectcode/core/dist/classifiers.d.ts.map +1 -0
  59. package/node_modules/@aspectcode/core/dist/classifiers.js +119 -0
  60. package/node_modules/@aspectcode/core/dist/classifiers.js.map +1 -0
  61. package/node_modules/@aspectcode/core/dist/fs/exclusions.d.ts +26 -0
  62. package/node_modules/@aspectcode/core/dist/fs/exclusions.d.ts.map +1 -0
  63. package/node_modules/@aspectcode/core/dist/fs/exclusions.js +130 -0
  64. package/node_modules/@aspectcode/core/dist/fs/exclusions.js.map +1 -0
  65. package/node_modules/@aspectcode/core/dist/fs/fingerprint.d.ts +42 -0
  66. package/node_modules/@aspectcode/core/dist/fs/fingerprint.d.ts.map +1 -0
  67. package/node_modules/@aspectcode/core/dist/fs/fingerprint.js +125 -0
  68. package/node_modules/@aspectcode/core/dist/fs/fingerprint.js.map +1 -0
  69. package/node_modules/@aspectcode/core/dist/fs/index.d.ts +9 -0
  70. package/node_modules/@aspectcode/core/dist/fs/index.d.ts.map +1 -0
  71. package/node_modules/@aspectcode/core/dist/fs/index.js +26 -0
  72. package/node_modules/@aspectcode/core/dist/fs/index.js.map +1 -0
  73. package/node_modules/@aspectcode/core/dist/fs/walker.d.ts +23 -0
  74. package/node_modules/@aspectcode/core/dist/fs/walker.d.ts.map +1 -0
  75. package/node_modules/@aspectcode/core/dist/fs/walker.js +94 -0
  76. package/node_modules/@aspectcode/core/dist/fs/walker.js.map +1 -0
  77. package/node_modules/@aspectcode/core/dist/host.d.ts +38 -0
  78. package/node_modules/@aspectcode/core/dist/host.d.ts.map +1 -0
  79. package/node_modules/@aspectcode/core/dist/host.js +110 -0
  80. package/node_modules/@aspectcode/core/dist/host.js.map +1 -0
  81. package/node_modules/@aspectcode/core/dist/index.d.ts +23 -0
  82. package/node_modules/@aspectcode/core/dist/index.d.ts.map +1 -0
  83. package/node_modules/@aspectcode/core/dist/index.js +59 -0
  84. package/node_modules/@aspectcode/core/dist/index.js.map +1 -0
  85. package/node_modules/@aspectcode/core/dist/model.d.ts +90 -0
  86. package/node_modules/@aspectcode/core/dist/model.d.ts.map +1 -0
  87. package/node_modules/@aspectcode/core/dist/model.js +9 -0
  88. package/node_modules/@aspectcode/core/dist/model.js.map +1 -0
  89. package/node_modules/@aspectcode/core/dist/parsers/csharpExtractors.d.ts +17 -0
  90. package/node_modules/@aspectcode/core/dist/parsers/csharpExtractors.d.ts.map +1 -0
  91. package/node_modules/@aspectcode/core/dist/parsers/csharpExtractors.js +225 -0
  92. package/node_modules/@aspectcode/core/dist/parsers/csharpExtractors.js.map +1 -0
  93. package/node_modules/@aspectcode/core/dist/parsers/grammarLoader.d.ts +30 -0
  94. package/node_modules/@aspectcode/core/dist/parsers/grammarLoader.d.ts.map +1 -0
  95. package/node_modules/@aspectcode/core/dist/parsers/grammarLoader.js +71 -0
  96. package/node_modules/@aspectcode/core/dist/parsers/grammarLoader.js.map +1 -0
  97. package/node_modules/@aspectcode/core/dist/parsers/index.d.ts +13 -0
  98. package/node_modules/@aspectcode/core/dist/parsers/index.d.ts.map +1 -0
  99. package/node_modules/@aspectcode/core/dist/parsers/index.js +32 -0
  100. package/node_modules/@aspectcode/core/dist/parsers/index.js.map +1 -0
  101. package/node_modules/@aspectcode/core/dist/parsers/javaExtractors.d.ts +17 -0
  102. package/node_modules/@aspectcode/core/dist/parsers/javaExtractors.d.ts.map +1 -0
  103. package/node_modules/@aspectcode/core/dist/parsers/javaExtractors.js +182 -0
  104. package/node_modules/@aspectcode/core/dist/parsers/javaExtractors.js.map +1 -0
  105. package/node_modules/@aspectcode/core/dist/parsers/languages.d.ts +44 -0
  106. package/node_modules/@aspectcode/core/dist/parsers/languages.d.ts.map +1 -0
  107. package/node_modules/@aspectcode/core/dist/parsers/languages.js +64 -0
  108. package/node_modules/@aspectcode/core/dist/parsers/languages.js.map +1 -0
  109. package/node_modules/@aspectcode/core/dist/parsers/pythonExtractors.d.ts +18 -0
  110. package/node_modules/@aspectcode/core/dist/parsers/pythonExtractors.d.ts.map +1 -0
  111. package/node_modules/@aspectcode/core/dist/parsers/pythonExtractors.js +139 -0
  112. package/node_modules/@aspectcode/core/dist/parsers/pythonExtractors.js.map +1 -0
  113. package/node_modules/@aspectcode/core/dist/parsers/tsJsExtractors.d.ts +22 -0
  114. package/node_modules/@aspectcode/core/dist/parsers/tsJsExtractors.d.ts.map +1 -0
  115. package/node_modules/@aspectcode/core/dist/parsers/tsJsExtractors.js +240 -0
  116. package/node_modules/@aspectcode/core/dist/parsers/tsJsExtractors.js.map +1 -0
  117. package/node_modules/@aspectcode/core/dist/parsers/utils.d.ts +7 -0
  118. package/node_modules/@aspectcode/core/dist/parsers/utils.d.ts.map +1 -0
  119. package/node_modules/@aspectcode/core/dist/parsers/utils.js +11 -0
  120. package/node_modules/@aspectcode/core/dist/parsers/utils.js.map +1 -0
  121. package/node_modules/@aspectcode/core/dist/paths.d.ts +27 -0
  122. package/node_modules/@aspectcode/core/dist/paths.d.ts.map +1 -0
  123. package/node_modules/@aspectcode/core/dist/paths.js +45 -0
  124. package/node_modules/@aspectcode/core/dist/paths.js.map +1 -0
  125. package/node_modules/@aspectcode/core/dist/stats.d.ts +41 -0
  126. package/node_modules/@aspectcode/core/dist/stats.d.ts.map +1 -0
  127. package/node_modules/@aspectcode/core/dist/stats.js +88 -0
  128. package/node_modules/@aspectcode/core/dist/stats.js.map +1 -0
  129. package/node_modules/@aspectcode/core/package.json +41 -0
  130. package/node_modules/@aspectcode/core/parsers/c_sharp.wasm +0 -0
  131. package/node_modules/@aspectcode/core/parsers/java.wasm +0 -0
  132. package/node_modules/@aspectcode/core/parsers/javascript.wasm +0 -0
  133. package/node_modules/@aspectcode/core/parsers/python.wasm +0 -0
  134. package/node_modules/@aspectcode/core/parsers/tree-sitter.wasm +0 -0
  135. package/node_modules/@aspectcode/core/parsers/tsx.wasm +0 -0
  136. package/node_modules/@aspectcode/core/parsers/typescript.wasm +0 -0
  137. package/node_modules/@aspectcode/emitters/dist/emitter.d.ts +72 -0
  138. package/node_modules/@aspectcode/emitters/dist/emitter.d.ts.map +1 -0
  139. package/node_modules/@aspectcode/emitters/dist/emitter.js +10 -0
  140. package/node_modules/@aspectcode/emitters/dist/emitter.js.map +1 -0
  141. package/node_modules/@aspectcode/emitters/dist/host.d.ts +31 -0
  142. package/node_modules/@aspectcode/emitters/dist/host.d.ts.map +1 -0
  143. package/node_modules/@aspectcode/emitters/dist/host.js +86 -0
  144. package/node_modules/@aspectcode/emitters/dist/host.js.map +1 -0
  145. package/node_modules/@aspectcode/emitters/dist/index.d.ts +27 -0
  146. package/node_modules/@aspectcode/emitters/dist/index.d.ts.map +1 -0
  147. package/node_modules/@aspectcode/emitters/dist/index.js +116 -0
  148. package/node_modules/@aspectcode/emitters/dist/index.js.map +1 -0
  149. package/node_modules/@aspectcode/emitters/dist/instructions/content.d.ts +15 -0
  150. package/node_modules/@aspectcode/emitters/dist/instructions/content.d.ts.map +1 -0
  151. package/node_modules/@aspectcode/emitters/dist/instructions/content.js +289 -0
  152. package/node_modules/@aspectcode/emitters/dist/instructions/content.js.map +1 -0
  153. package/node_modules/@aspectcode/emitters/dist/instructions/detection.d.ts +13 -0
  154. package/node_modules/@aspectcode/emitters/dist/instructions/detection.d.ts.map +1 -0
  155. package/node_modules/@aspectcode/emitters/dist/instructions/detection.js +55 -0
  156. package/node_modules/@aspectcode/emitters/dist/instructions/detection.js.map +1 -0
  157. package/node_modules/@aspectcode/emitters/dist/instructions/formats.d.ts +17 -0
  158. package/node_modules/@aspectcode/emitters/dist/instructions/formats.d.ts.map +1 -0
  159. package/node_modules/@aspectcode/emitters/dist/instructions/formats.js +23 -0
  160. package/node_modules/@aspectcode/emitters/dist/instructions/formats.js.map +1 -0
  161. package/node_modules/@aspectcode/emitters/dist/instructions/index.d.ts +5 -0
  162. package/node_modules/@aspectcode/emitters/dist/instructions/index.d.ts.map +1 -0
  163. package/node_modules/@aspectcode/emitters/dist/instructions/index.js +12 -0
  164. package/node_modules/@aspectcode/emitters/dist/instructions/index.js.map +1 -0
  165. package/node_modules/@aspectcode/emitters/dist/instructions/instructionsEmitter.d.ts +9 -0
  166. package/node_modules/@aspectcode/emitters/dist/instructions/instructionsEmitter.d.ts.map +1 -0
  167. package/node_modules/@aspectcode/emitters/dist/instructions/instructionsEmitter.js +30 -0
  168. package/node_modules/@aspectcode/emitters/dist/instructions/instructionsEmitter.js.map +1 -0
  169. package/node_modules/@aspectcode/emitters/dist/kb/analyzers.d.ts +64 -0
  170. package/node_modules/@aspectcode/emitters/dist/kb/analyzers.d.ts.map +1 -0
  171. package/node_modules/@aspectcode/emitters/dist/kb/analyzers.js +504 -0
  172. package/node_modules/@aspectcode/emitters/dist/kb/analyzers.js.map +1 -0
  173. package/node_modules/@aspectcode/emitters/dist/kb/architectureEmitter.d.ts +24 -0
  174. package/node_modules/@aspectcode/emitters/dist/kb/architectureEmitter.d.ts.map +1 -0
  175. package/node_modules/@aspectcode/emitters/dist/kb/architectureEmitter.js +238 -0
  176. package/node_modules/@aspectcode/emitters/dist/kb/architectureEmitter.js.map +1 -0
  177. package/node_modules/@aspectcode/emitters/dist/kb/classifiers.d.ts +8 -0
  178. package/node_modules/@aspectcode/emitters/dist/kb/classifiers.d.ts.map +1 -0
  179. package/node_modules/@aspectcode/emitters/dist/kb/classifiers.js +14 -0
  180. package/node_modules/@aspectcode/emitters/dist/kb/classifiers.js.map +1 -0
  181. package/node_modules/@aspectcode/emitters/dist/kb/constants.d.ts +35 -0
  182. package/node_modules/@aspectcode/emitters/dist/kb/constants.d.ts.map +1 -0
  183. package/node_modules/@aspectcode/emitters/dist/kb/constants.js +38 -0
  184. package/node_modules/@aspectcode/emitters/dist/kb/constants.js.map +1 -0
  185. package/node_modules/@aspectcode/emitters/dist/kb/contextEmitter.d.ts +20 -0
  186. package/node_modules/@aspectcode/emitters/dist/kb/contextEmitter.d.ts.map +1 -0
  187. package/node_modules/@aspectcode/emitters/dist/kb/contextEmitter.js +155 -0
  188. package/node_modules/@aspectcode/emitters/dist/kb/contextEmitter.js.map +1 -0
  189. package/node_modules/@aspectcode/emitters/dist/kb/conventions.d.ts +52 -0
  190. package/node_modules/@aspectcode/emitters/dist/kb/conventions.d.ts.map +1 -0
  191. package/node_modules/@aspectcode/emitters/dist/kb/conventions.js +391 -0
  192. package/node_modules/@aspectcode/emitters/dist/kb/conventions.js.map +1 -0
  193. package/node_modules/@aspectcode/emitters/dist/kb/depData.d.ts +18 -0
  194. package/node_modules/@aspectcode/emitters/dist/kb/depData.d.ts.map +1 -0
  195. package/node_modules/@aspectcode/emitters/dist/kb/depData.js +31 -0
  196. package/node_modules/@aspectcode/emitters/dist/kb/depData.js.map +1 -0
  197. package/node_modules/@aspectcode/emitters/dist/kb/detectors.d.ts +18 -0
  198. package/node_modules/@aspectcode/emitters/dist/kb/detectors.d.ts.map +1 -0
  199. package/node_modules/@aspectcode/emitters/dist/kb/detectors.js +317 -0
  200. package/node_modules/@aspectcode/emitters/dist/kb/detectors.js.map +1 -0
  201. package/node_modules/@aspectcode/emitters/dist/kb/entryPoints.d.ts +33 -0
  202. package/node_modules/@aspectcode/emitters/dist/kb/entryPoints.d.ts.map +1 -0
  203. package/node_modules/@aspectcode/emitters/dist/kb/entryPoints.js +323 -0
  204. package/node_modules/@aspectcode/emitters/dist/kb/entryPoints.js.map +1 -0
  205. package/node_modules/@aspectcode/emitters/dist/kb/helpers.d.ts +27 -0
  206. package/node_modules/@aspectcode/emitters/dist/kb/helpers.d.ts.map +1 -0
  207. package/node_modules/@aspectcode/emitters/dist/kb/helpers.js +63 -0
  208. package/node_modules/@aspectcode/emitters/dist/kb/helpers.js.map +1 -0
  209. package/node_modules/@aspectcode/emitters/dist/kb/index.d.ts +27 -0
  210. package/node_modules/@aspectcode/emitters/dist/kb/index.d.ts.map +1 -0
  211. package/node_modules/@aspectcode/emitters/dist/kb/index.js +72 -0
  212. package/node_modules/@aspectcode/emitters/dist/kb/index.js.map +1 -0
  213. package/node_modules/@aspectcode/emitters/dist/kb/kbEmitter.d.ts +21 -0
  214. package/node_modules/@aspectcode/emitters/dist/kb/kbEmitter.d.ts.map +1 -0
  215. package/node_modules/@aspectcode/emitters/dist/kb/kbEmitter.js +125 -0
  216. package/node_modules/@aspectcode/emitters/dist/kb/kbEmitter.js.map +1 -0
  217. package/node_modules/@aspectcode/emitters/dist/kb/mapEmitter.d.ts +26 -0
  218. package/node_modules/@aspectcode/emitters/dist/kb/mapEmitter.d.ts.map +1 -0
  219. package/node_modules/@aspectcode/emitters/dist/kb/mapEmitter.js +255 -0
  220. package/node_modules/@aspectcode/emitters/dist/kb/mapEmitter.js.map +1 -0
  221. package/node_modules/@aspectcode/emitters/dist/kb/policy.d.ts +12 -0
  222. package/node_modules/@aspectcode/emitters/dist/kb/policy.d.ts.map +1 -0
  223. package/node_modules/@aspectcode/emitters/dist/kb/policy.js +29 -0
  224. package/node_modules/@aspectcode/emitters/dist/kb/policy.js.map +1 -0
  225. package/node_modules/@aspectcode/emitters/dist/kb/symbols.d.ts +43 -0
  226. package/node_modules/@aspectcode/emitters/dist/kb/symbols.d.ts.map +1 -0
  227. package/node_modules/@aspectcode/emitters/dist/kb/symbols.js +343 -0
  228. package/node_modules/@aspectcode/emitters/dist/kb/symbols.js.map +1 -0
  229. package/node_modules/@aspectcode/emitters/dist/manifest.d.ts +37 -0
  230. package/node_modules/@aspectcode/emitters/dist/manifest.d.ts.map +1 -0
  231. package/node_modules/@aspectcode/emitters/dist/manifest.js +50 -0
  232. package/node_modules/@aspectcode/emitters/dist/manifest.js.map +1 -0
  233. package/node_modules/@aspectcode/emitters/dist/report.d.ts +22 -0
  234. package/node_modules/@aspectcode/emitters/dist/report.d.ts.map +1 -0
  235. package/node_modules/@aspectcode/emitters/dist/report.js +3 -0
  236. package/node_modules/@aspectcode/emitters/dist/report.js.map +1 -0
  237. package/node_modules/@aspectcode/emitters/dist/stableJson.d.ts +14 -0
  238. package/node_modules/@aspectcode/emitters/dist/stableJson.d.ts.map +1 -0
  239. package/node_modules/@aspectcode/emitters/dist/stableJson.js +40 -0
  240. package/node_modules/@aspectcode/emitters/dist/stableJson.js.map +1 -0
  241. package/node_modules/@aspectcode/emitters/dist/transaction.d.ts +29 -0
  242. package/node_modules/@aspectcode/emitters/dist/transaction.d.ts.map +1 -0
  243. package/node_modules/@aspectcode/emitters/dist/transaction.js +104 -0
  244. package/node_modules/@aspectcode/emitters/dist/transaction.js.map +1 -0
  245. package/node_modules/@aspectcode/emitters/package.json +39 -0
  246. package/node_modules/@aspectcode/optimizer/dist/agent.d.ts +18 -0
  247. package/node_modules/@aspectcode/optimizer/dist/agent.d.ts.map +1 -0
  248. package/node_modules/@aspectcode/optimizer/dist/agent.js +123 -0
  249. package/node_modules/@aspectcode/optimizer/dist/agent.js.map +1 -0
  250. package/node_modules/@aspectcode/optimizer/dist/index.d.ts +15 -0
  251. package/node_modules/@aspectcode/optimizer/dist/index.d.ts.map +1 -0
  252. package/node_modules/@aspectcode/optimizer/dist/index.js +31 -0
  253. package/node_modules/@aspectcode/optimizer/dist/index.js.map +1 -0
  254. package/node_modules/@aspectcode/optimizer/dist/prompts.d.ts +39 -0
  255. package/node_modules/@aspectcode/optimizer/dist/prompts.d.ts.map +1 -0
  256. package/node_modules/@aspectcode/optimizer/dist/prompts.js +156 -0
  257. package/node_modules/@aspectcode/optimizer/dist/prompts.js.map +1 -0
  258. package/node_modules/@aspectcode/optimizer/dist/providers/anthropic.d.ts +20 -0
  259. package/node_modules/@aspectcode/optimizer/dist/providers/anthropic.d.ts.map +1 -0
  260. package/node_modules/@aspectcode/optimizer/dist/providers/anthropic.js +126 -0
  261. package/node_modules/@aspectcode/optimizer/dist/providers/anthropic.js.map +1 -0
  262. package/node_modules/@aspectcode/optimizer/dist/providers/index.d.ts +28 -0
  263. package/node_modules/@aspectcode/optimizer/dist/providers/index.d.ts.map +1 -0
  264. package/node_modules/@aspectcode/optimizer/dist/providers/index.js +142 -0
  265. package/node_modules/@aspectcode/optimizer/dist/providers/index.js.map +1 -0
  266. package/node_modules/@aspectcode/optimizer/dist/providers/openai.d.ts +19 -0
  267. package/node_modules/@aspectcode/optimizer/dist/providers/openai.d.ts.map +1 -0
  268. package/node_modules/@aspectcode/optimizer/dist/providers/openai.js +98 -0
  269. package/node_modules/@aspectcode/optimizer/dist/providers/openai.js.map +1 -0
  270. package/node_modules/@aspectcode/optimizer/dist/providers/retry.d.ts +19 -0
  271. package/node_modules/@aspectcode/optimizer/dist/providers/retry.d.ts.map +1 -0
  272. package/node_modules/@aspectcode/optimizer/dist/providers/retry.js +87 -0
  273. package/node_modules/@aspectcode/optimizer/dist/providers/retry.js.map +1 -0
  274. package/node_modules/@aspectcode/optimizer/dist/types.d.ts +93 -0
  275. package/node_modules/@aspectcode/optimizer/dist/types.d.ts.map +1 -0
  276. package/node_modules/@aspectcode/optimizer/dist/types.js +20 -0
  277. package/node_modules/@aspectcode/optimizer/dist/types.js.map +1 -0
  278. package/node_modules/@aspectcode/optimizer/package.json +41 -0
  279. package/package.json +11 -3
  280. package/dist/commands/deps.d.ts +0 -11
  281. package/dist/commands/deps.d.ts.map +0 -1
  282. package/dist/commands/deps.js +0 -197
  283. package/dist/commands/deps.js.map +0 -1
  284. package/dist/commands/generate.d.ts +0 -8
  285. package/dist/commands/generate.d.ts.map +0 -1
  286. package/dist/commands/generate.js +0 -162
  287. package/dist/commands/generate.js.map +0 -1
  288. package/dist/commands/settings.d.ts +0 -9
  289. package/dist/commands/settings.d.ts.map +0 -1
  290. package/dist/commands/settings.js +0 -165
  291. package/dist/commands/settings.js.map +0 -1
  292. package/dist/commands/watch.d.ts +0 -6
  293. package/dist/commands/watch.d.ts.map +0 -1
  294. package/dist/commands/watch.js +0 -180
  295. package/dist/commands/watch.js.map +0 -1
  296. package/dist/connections.d.ts +0 -24
  297. package/dist/connections.d.ts.map +0 -1
  298. package/dist/connections.js +0 -89
  299. package/dist/connections.js.map +0 -1
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GenerationTransaction = void 0;
4
+ /**
5
+ * Transaction wrapper around an EmitterHost.
6
+ *
7
+ * It stages writes to temp files and only replaces target files on commit.
8
+ * This reduces the chance of partially-written outputs on crashes.
9
+ */
10
+ class GenerationTransaction {
11
+ constructor(baseHost) {
12
+ this.baseHost = baseHost;
13
+ this.staged = new Map();
14
+ this.id = `${Date.now()}-${Math.random().toString(16).slice(2)}`;
15
+ }
16
+ /** Host view used by emitters to stage writes. */
17
+ get host() {
18
+ const tx = this;
19
+ return {
20
+ readFile: async (filePath) => {
21
+ const staged = tx.staged.get(filePath);
22
+ if (staged)
23
+ return tx.baseHost.readFile(staged.tempPath);
24
+ return tx.baseHost.readFile(filePath);
25
+ },
26
+ writeFile: async (filePath, content) => {
27
+ const tempPath = `${filePath}.__aspect_tmp__${tx.id}`;
28
+ const bytes = Buffer.byteLength(content, 'utf8');
29
+ await tx.baseHost.writeFile(tempPath, content);
30
+ tx.staged.set(filePath, { finalPath: filePath, tempPath, bytes });
31
+ },
32
+ exists: (filePath) => tx.baseHost.exists(filePath),
33
+ mkdirp: (dirPath) => tx.baseHost.mkdirp(dirPath),
34
+ rename: (fromPath, toPath) => tx.baseHost.rename(fromPath, toPath),
35
+ rmrf: (targetPath) => tx.baseHost.rmrf(targetPath),
36
+ join: (...segments) => tx.baseHost.join(...segments),
37
+ relative: (from, to) => tx.baseHost.relative(from, to),
38
+ };
39
+ }
40
+ /** All staged writes (final paths + bytes). */
41
+ getWrites() {
42
+ return Array.from(this.staged.values());
43
+ }
44
+ /**
45
+ * Commit staged files into place.
46
+ *
47
+ * Writes are committed in deterministic (sorted) order.
48
+ */
49
+ async commit() {
50
+ const writes = this.getWrites();
51
+ if (writes.length === 0)
52
+ return;
53
+ const commitOrder = [...writes].sort((a, b) => a.finalPath.localeCompare(b.finalPath));
54
+ const backups = [];
55
+ const committedFinals = [];
56
+ try {
57
+ for (const w of commitOrder) {
58
+ const finalPath = w.finalPath;
59
+ const backupPath = `${finalPath}.__aspect_bak__${this.id}`;
60
+ if (await this.baseHost.exists(finalPath)) {
61
+ await this.baseHost.rename(finalPath, backupPath);
62
+ backups.push({ finalPath, backupPath });
63
+ }
64
+ await this.baseHost.rename(w.tempPath, finalPath);
65
+ committedFinals.push(finalPath);
66
+ }
67
+ // Clean backups
68
+ await Promise.all(backups.map((b) => this.baseHost.rmrf(b.backupPath)));
69
+ }
70
+ catch (err) {
71
+ // Best-effort rollback
72
+ for (const finalPath of committedFinals.reverse()) {
73
+ const b = backups.find((x) => x.finalPath === finalPath);
74
+ if (!b)
75
+ continue;
76
+ try {
77
+ if (await this.baseHost.exists(finalPath)) {
78
+ await this.baseHost.rmrf(finalPath);
79
+ }
80
+ await this.baseHost.rename(b.backupPath, finalPath);
81
+ }
82
+ catch {
83
+ // Ignore rollback failures
84
+ }
85
+ }
86
+ throw err;
87
+ }
88
+ finally {
89
+ // Best-effort cleanup of any remaining temp files
90
+ await Promise.all(writes.map(async (w) => {
91
+ try {
92
+ if (await this.baseHost.exists(w.tempPath)) {
93
+ await this.baseHost.rmrf(w.tempPath);
94
+ }
95
+ }
96
+ catch {
97
+ // Ignore
98
+ }
99
+ }));
100
+ }
101
+ }
102
+ }
103
+ exports.GenerationTransaction = GenerationTransaction;
104
+ //# sourceMappingURL=transaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":";;;AAQA;;;;;GAKG;AACH,MAAa,qBAAqB;IAIhC,YAA6B,QAAqB;QAArB,aAAQ,GAAR,QAAQ,CAAa;QAFjC,WAAM,GAAG,IAAI,GAAG,EAA4B,CAAC;QAG5D,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACnE,CAAC;IAED,kDAAkD;IAClD,IAAI,IAAI;QACN,MAAM,EAAE,GAAG,IAAI,CAAC;QAChB,OAAO;YACL,QAAQ,EAAE,KAAK,EAAE,QAAgB,EAAE,EAAE;gBACnC,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBACvC,IAAI,MAAM;oBAAE,OAAO,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;gBACzD,OAAO,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC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AAO,GAAG,EAAE,CAAC;YACb,uBAAuB;YACvB,KAAK,MAAM,SAAS,IAAI,eAAe,CAAC,OAAO,EAAE,EAAE,CAAC;gBAClD,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;gBACzD,IAAI,CAAC,CAAC;oBAAE,SAAS;gBAEjB,IAAI,CAAC;oBACH,IAAI,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;wBAC1C,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;oBACtC,CAAC;oBACD,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;gBACtD,CAAC;gBAAC,MAAM,CAAC;oBACP,2BAA2B;gBAC7B,CAAC;YACH,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;gBAAS,CAAC;YACT,kDAAkD;YAClD,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;gBACrB,IAAI,CAAC;oBACH,IAAI,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;wBAC3C,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;oBACvC,CAAC;gBACH,CAAC;gBAAC,MAAM,CAAC;oBACP,SAAS;gBACX,CAAC;YACH,CAAC,CAAC,CACH,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AApGD,sDAoGC"}
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@aspectcode/emitters",
3
+ "version": "0.3.0",
4
+ "private": true,
5
+ "description": "Artifact emitters for Aspect Code — KB, instructions, manifest",
6
+ "license": "MIT",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "engines": {
13
+ "node": ">=18"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/asashepard/aspectcode.git",
21
+ "directory": "packages/emitters"
22
+ },
23
+ "scripts": {
24
+ "build": "tsc",
25
+ "typecheck": "tsc --noEmit",
26
+ "prepublishOnly": "npm run build",
27
+ "test": "mocha --require ts-node/register 'test/**/*.test.ts'"
28
+ },
29
+ "dependencies": {
30
+ "@aspectcode/core": "0.3.0"
31
+ },
32
+ "devDependencies": {
33
+ "@types/mocha": "^10.0.0",
34
+ "@types/node": "^22.0.0",
35
+ "mocha": "^10.4.0",
36
+ "ts-node": "^10.9.2",
37
+ "typescript": "^5.5.4"
38
+ }
39
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Optimization agent — iterative optimize → evaluate → refine loop.
3
+ *
4
+ * The agent:
5
+ * 1. Sends KB + current instructions to the LLM for optimization.
6
+ * 2. Evaluates the candidate with a self-eval prompt.
7
+ * 3. If the score exceeds the threshold, returns the candidate.
8
+ * 4. Otherwise feeds the eval feedback back and tries again.
9
+ * 5. After maxIterations, returns the best candidate seen.
10
+ */
11
+ import type { OptimizeOptions, OptimizeResult } from './types';
12
+ /**
13
+ * Run the optimization agent loop.
14
+ *
15
+ * @returns The best optimized instructions found within maxIterations.
16
+ */
17
+ export declare function runOptimizeAgent(options: OptimizeOptions): Promise<OptimizeResult>;
18
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAe,eAAe,EAAE,cAAc,EAAc,MAAM,SAAS,CAAC;AAgBxF;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CA2HxF"}
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ /**
3
+ * Optimization agent — iterative optimize → evaluate → refine loop.
4
+ *
5
+ * The agent:
6
+ * 1. Sends KB + current instructions to the LLM for optimization.
7
+ * 2. Evaluates the candidate with a self-eval prompt.
8
+ * 3. If the score exceeds the threshold, returns the candidate.
9
+ * 4. Otherwise feeds the eval feedback back and tries again.
10
+ * 5. After maxIterations, returns the best candidate seen.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.runOptimizeAgent = runOptimizeAgent;
14
+ const prompts_1 = require("./prompts");
15
+ /** Default minimum eval score to accept a candidate without further iteration. */
16
+ const DEFAULT_ACCEPT_THRESHOLD = 8;
17
+ /** Helper: sleep for `ms` milliseconds. */
18
+ function sleep(ms) {
19
+ return new Promise((resolve) => setTimeout(resolve, ms));
20
+ }
21
+ /**
22
+ * Run the optimization agent loop.
23
+ *
24
+ * @returns The best optimized instructions found within maxIterations.
25
+ */
26
+ async function runOptimizeAgent(options) {
27
+ const { currentInstructions, kb, kbDiff, toolInstructions, maxIterations, provider, log, acceptThreshold = DEFAULT_ACCEPT_THRESHOLD, signal, iterationDelayMs = 0, kbCharBudget, } = options;
28
+ const systemPrompt = (0, prompts_1.buildSystemPrompt)(kb, kbCharBudget, toolInstructions);
29
+ const reasoning = [];
30
+ let bestCandidate = currentInstructions;
31
+ let bestScore = 0;
32
+ let priorFeedback;
33
+ for (let i = 0; i < maxIterations; i++) {
34
+ // ── Check cancellation ───────────────────────────────
35
+ if (signal?.aborted) {
36
+ log?.info('Optimization cancelled.');
37
+ reasoning.push(`Iteration ${i + 1}: cancelled by user`);
38
+ break;
39
+ }
40
+ // ── Inter-iteration delay (skip before first) ────────
41
+ if (i > 0 && iterationDelayMs > 0) {
42
+ log?.debug(`Waiting ${iterationDelayMs}ms before next iteration…`);
43
+ await sleep(iterationDelayMs);
44
+ if (signal?.aborted) {
45
+ log?.info('Optimization cancelled during delay.');
46
+ reasoning.push(`Iteration ${i + 1}: cancelled by user`);
47
+ break;
48
+ }
49
+ }
50
+ log?.info(`Optimize iteration ${i + 1}/${maxIterations}…`);
51
+ // ── Step 1: Generate optimized candidate ─────────────
52
+ const optimizeMessages = [
53
+ { role: 'system', content: systemPrompt },
54
+ { role: 'user', content: (0, prompts_1.buildOptimizePrompt)(currentInstructions, kbDiff, priorFeedback) },
55
+ ];
56
+ let candidate;
57
+ try {
58
+ candidate = await provider.chat(optimizeMessages);
59
+ }
60
+ catch (err) {
61
+ const msg = err instanceof Error ? err.message : String(err);
62
+ log?.error(`LLM call failed: ${msg}`);
63
+ reasoning.push(`Iteration ${i + 1}: LLM error — ${msg}`);
64
+ break;
65
+ }
66
+ // ── Step 2: Self-evaluate ────────────────────────────
67
+ if (signal?.aborted) {
68
+ // Accept the candidate we just got since we can't eval
69
+ if (bestScore === 0) {
70
+ bestCandidate = candidate;
71
+ }
72
+ reasoning.push(`Iteration ${i + 1}: cancelled before eval`);
73
+ break;
74
+ }
75
+ log?.debug(`Evaluating candidate (iteration ${i + 1})…`);
76
+ let evalResult;
77
+ try {
78
+ const evalMessages = [
79
+ { role: 'user', content: (0, prompts_1.buildEvalPrompt)(candidate, kb, kbCharBudget) },
80
+ ];
81
+ const evalResponse = await provider.chat(evalMessages);
82
+ evalResult = (0, prompts_1.parseEvalResponse)(evalResponse);
83
+ }
84
+ catch (err) {
85
+ const msg = err instanceof Error ? err.message : String(err);
86
+ log?.warn(`Eval call failed: ${msg}. Tracking candidate as best-effort.`);
87
+ reasoning.push(`Iteration ${i + 1}: eval error — ${msg}`);
88
+ // Track as best candidate if nothing better exists, but don't auto-accept
89
+ if (bestScore === 0) {
90
+ bestCandidate = candidate;
91
+ }
92
+ continue;
93
+ }
94
+ reasoning.push(`Iteration ${i + 1}: score=${evalResult.score}/10 — ${evalResult.feedback}`);
95
+ log?.info(` Score: ${evalResult.score}/10`);
96
+ // Track best candidate
97
+ if (evalResult.score > bestScore) {
98
+ bestScore = evalResult.score;
99
+ bestCandidate = candidate;
100
+ }
101
+ // ── Step 3: Accept or refine ─────────────────────────
102
+ if (evalResult.score >= acceptThreshold) {
103
+ log?.info(` Accepted (score ≥ ${acceptThreshold})`);
104
+ return {
105
+ optimizedInstructions: candidate,
106
+ iterations: i + 1,
107
+ reasoning,
108
+ };
109
+ }
110
+ // Build feedback for next iteration
111
+ priorFeedback =
112
+ `Score: ${evalResult.score}/10\n${evalResult.feedback}\n\nSuggestions:\n` +
113
+ evalResult.suggestions.map((s) => `- ${s}`).join('\n');
114
+ }
115
+ // Exhausted iterations or cancelled — return best seen
116
+ log?.info(`Returning best candidate (score ${bestScore}/10).`);
117
+ return {
118
+ optimizedInstructions: bestCandidate,
119
+ iterations: maxIterations,
120
+ reasoning,
121
+ };
122
+ }
123
+ //# sourceMappingURL=agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAuBH,4CA2HC;AA/ID,uCAKmB;AAEnB,kFAAkF;AAClF,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAEnC,2CAA2C;AAC3C,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,gBAAgB,CAAC,OAAwB;IAC7D,MAAM,EACJ,mBAAmB,EACnB,EAAE,EACF,MAAM,EACN,gBAAgB,EAChB,aAAa,EACb,QAAQ,EACR,GAAG,EACH,eAAe,GAAG,wBAAwB,EAC1C,MAAM,EACN,gBAAgB,GAAG,CAAC,EACpB,YAAY,GACb,GAAG,OAAO,CAAC;IAEZ,MAAM,YAAY,GAAG,IAAA,2BAAiB,EAAC,EAAE,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAA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C"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @aspectcode/optimizer — public API.
3
+ *
4
+ * Re-exports types and provides the top-level `optimizeInstructions` entry point.
5
+ */
6
+ export type { LlmProvider, ChatMessage, ProviderOptions, OptimizeOptions, OptimizeResult, EvalResult, OptLogger, ProviderName, } from './types';
7
+ export { PROVIDER_ENV_KEYS, LLM_PROVIDER_ENV, LLM_MODEL_ENV } from './types';
8
+ export { resolveProvider, loadEnvFile, parseDotenv } from './providers/index';
9
+ export { createOpenAiProvider } from './providers/openai';
10
+ export { createAnthropicProvider } from './providers/anthropic';
11
+ export { withRetry } from './providers/retry';
12
+ export type { RetryOptions } from './providers/retry';
13
+ export { runOptimizeAgent } from './agent';
14
+ export { buildSystemPrompt, buildOptimizePrompt, buildEvalPrompt, parseEvalResponse, truncateKb, } from './prompts';
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EACV,WAAW,EACX,WAAW,EACX,eAAe,EACf,eAAe,EACf,cAAc,EACd,UAAU,EACV,SAAS,EACT,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7E,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,UAAU,GACX,MAAM,WAAW,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ /**
3
+ * @aspectcode/optimizer — public API.
4
+ *
5
+ * Re-exports types and provides the top-level `optimizeInstructions` entry point.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.truncateKb = exports.parseEvalResponse = exports.buildEvalPrompt = exports.buildOptimizePrompt = exports.buildSystemPrompt = exports.runOptimizeAgent = exports.withRetry = exports.createAnthropicProvider = exports.createOpenAiProvider = exports.parseDotenv = exports.loadEnvFile = exports.resolveProvider = exports.LLM_MODEL_ENV = exports.LLM_PROVIDER_ENV = exports.PROVIDER_ENV_KEYS = void 0;
9
+ var types_1 = require("./types");
10
+ Object.defineProperty(exports, "PROVIDER_ENV_KEYS", { enumerable: true, get: function () { return types_1.PROVIDER_ENV_KEYS; } });
11
+ Object.defineProperty(exports, "LLM_PROVIDER_ENV", { enumerable: true, get: function () { return types_1.LLM_PROVIDER_ENV; } });
12
+ Object.defineProperty(exports, "LLM_MODEL_ENV", { enumerable: true, get: function () { return types_1.LLM_MODEL_ENV; } });
13
+ var index_1 = require("./providers/index");
14
+ Object.defineProperty(exports, "resolveProvider", { enumerable: true, get: function () { return index_1.resolveProvider; } });
15
+ Object.defineProperty(exports, "loadEnvFile", { enumerable: true, get: function () { return index_1.loadEnvFile; } });
16
+ Object.defineProperty(exports, "parseDotenv", { enumerable: true, get: function () { return index_1.parseDotenv; } });
17
+ var openai_1 = require("./providers/openai");
18
+ Object.defineProperty(exports, "createOpenAiProvider", { enumerable: true, get: function () { return openai_1.createOpenAiProvider; } });
19
+ var anthropic_1 = require("./providers/anthropic");
20
+ Object.defineProperty(exports, "createAnthropicProvider", { enumerable: true, get: function () { return anthropic_1.createAnthropicProvider; } });
21
+ var retry_1 = require("./providers/retry");
22
+ Object.defineProperty(exports, "withRetry", { enumerable: true, get: function () { return retry_1.withRetry; } });
23
+ var agent_1 = require("./agent");
24
+ Object.defineProperty(exports, "runOptimizeAgent", { enumerable: true, get: function () { return agent_1.runOptimizeAgent; } });
25
+ var prompts_1 = require("./prompts");
26
+ Object.defineProperty(exports, "buildSystemPrompt", { enumerable: true, get: function () { return prompts_1.buildSystemPrompt; } });
27
+ Object.defineProperty(exports, "buildOptimizePrompt", { enumerable: true, get: function () { return prompts_1.buildOptimizePrompt; } });
28
+ Object.defineProperty(exports, "buildEvalPrompt", { enumerable: true, get: function () { return prompts_1.buildEvalPrompt; } });
29
+ Object.defineProperty(exports, "parseEvalResponse", { enumerable: true, get: function () { return prompts_1.parseEvalResponse; } });
30
+ Object.defineProperty(exports, "truncateKb", { enumerable: true, get: function () { return prompts_1.truncateKb; } });
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAYH,iCAA6E;AAApE,0GAAA,iBAAiB,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AAAE,sGAAA,aAAa,OAAA;AAE3D,2CAA8E;AAArE,wGAAA,eAAe,OAAA;AAAE,oGAAA,WAAW,OAAA;AAAE,oGAAA,WAAW,OAAA;AAClD,6CAA0D;AAAjD,8GAAA,oBAAoB,OAAA;AAC7B,mDAAgE;AAAvD,oHAAA,uBAAuB,OAAA;AAChC,2CAA8C;AAArC,kGAAA,SAAS,OAAA;AAElB,iCAA2C;AAAlC,yGAAA,gBAAgB,OAAA;AACzB,qCAMmB;AALjB,4GAAA,iBAAiB,OAAA;AACjB,8GAAA,mBAAmB,OAAA;AACnB,0GAAA,eAAe,OAAA;AACf,4GAAA,iBAAiB,OAAA;AACjB,qGAAA,UAAU,OAAA"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Prompt templates for the optimization agent.
3
+ *
4
+ * Three prompts:
5
+ * 1. System prompt — sets context with KB content.
6
+ * 2. Optimize prompt — asks the LLM to refine instructions.
7
+ * 3. Eval prompt — asks the LLM to score and critique a candidate.
8
+ */
9
+ /**
10
+ * Truncate KB content to fit within the character budget.
11
+ * Preserves the Architecture section (most valuable) and trims Map/Context.
12
+ */
13
+ export declare function truncateKb(kb: string, charBudget?: number): string;
14
+ /**
15
+ * Build the system prompt that establishes the agent's role and
16
+ * provides the full knowledge base as context.
17
+ */
18
+ export declare function buildSystemPrompt(kb: string, kbCharBudget?: number, toolInstructions?: string): string;
19
+ /**
20
+ * Build the user prompt for instruction optimization.
21
+ *
22
+ * Includes the current instructions and optionally a KB diff showing
23
+ * what changed in the codebase since the last generation.
24
+ */
25
+ export declare function buildOptimizePrompt(currentInstructions: string, kbDiff?: string, priorFeedback?: string): string;
26
+ /**
27
+ * Build the evaluation prompt that asks the LLM to score and critique
28
+ * a candidate set of instructions.
29
+ */
30
+ export declare function buildEvalPrompt(candidateInstructions: string, kb: string, kbCharBudget?: number): string;
31
+ /**
32
+ * Parse the structured evaluation response into an EvalResult.
33
+ */
34
+ export declare function parseEvalResponse(response: string): {
35
+ score: number;
36
+ feedback: string;
37
+ suggestions: string[];
38
+ };
39
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,GAAE,MAA+B,GAAG,MAAM,CAe1F;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAmCtG;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,mBAAmB,EAAE,MAAM,EAC3B,MAAM,CAAC,EAAE,MAAM,EACf,aAAa,CAAC,EAAE,MAAM,GACrB,MAAM,CAgCR;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,qBAAqB,EAAE,MAAM,EAC7B,EAAE,EAAE,MAAM,EACV,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CAyBR;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAiBA"}
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ /**
3
+ * Prompt templates for the optimization agent.
4
+ *
5
+ * Three prompts:
6
+ * 1. System prompt — sets context with KB content.
7
+ * 2. Optimize prompt — asks the LLM to refine instructions.
8
+ * 3. Eval prompt — asks the LLM to score and critique a candidate.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.truncateKb = truncateKb;
12
+ exports.buildSystemPrompt = buildSystemPrompt;
13
+ exports.buildOptimizePrompt = buildOptimizePrompt;
14
+ exports.buildEvalPrompt = buildEvalPrompt;
15
+ exports.parseEvalResponse = parseEvalResponse;
16
+ /** Default maximum KB characters to include before truncation. */
17
+ const DEFAULT_KB_CHAR_BUDGET = 60000;
18
+ /**
19
+ * Truncate KB content to fit within the character budget.
20
+ * Preserves the Architecture section (most valuable) and trims Map/Context.
21
+ */
22
+ function truncateKb(kb, charBudget = DEFAULT_KB_CHAR_BUDGET) {
23
+ if (kb.length <= charBudget)
24
+ return kb;
25
+ // Try to keep the Architecture section intact
26
+ const archEnd = kb.indexOf('## Map');
27
+ if (archEnd > 0 && archEnd < charBudget) {
28
+ const remaining = charBudget - archEnd;
29
+ return (kb.slice(0, archEnd) +
30
+ kb.slice(archEnd, archEnd + remaining) +
31
+ '\n\n[... KB truncated for token budget ...]\n');
32
+ }
33
+ return kb.slice(0, charBudget) + '\n\n[... KB truncated for token budget ...]\n';
34
+ }
35
+ /**
36
+ * Build the system prompt that establishes the agent's role and
37
+ * provides the full knowledge base as context.
38
+ */
39
+ function buildSystemPrompt(kb, kbCharBudget, toolInstructions) {
40
+ const trimmedKb = truncateKb(kb, kbCharBudget);
41
+ let prompt = `You are an expert AI coding assistant instruction optimizer.
42
+
43
+ Your job is to improve AGENTS.md instructions — the guidelines that AI coding
44
+ assistants follow when working in a codebase. You optimize these instructions
45
+ so they are maximally useful, precise, and aligned with the actual codebase.
46
+
47
+ You have access to the project's knowledge base which contains:
48
+ - Architecture: high-risk files, directory layout, entry points
49
+ - Map: data models, symbol index, naming conventions
50
+ - Context: module clusters, external integrations, data flows
51
+
52
+ Use this knowledge to make the instructions specific, actionable, and grounded
53
+ in the real structure of the codebase. Remove vague advice, strengthen specific
54
+ guidance, and add project-specific rules that an AI assistant would benefit from.
55
+
56
+ ## Knowledge Base
57
+ ${trimmedKb}`;
58
+ if (toolInstructions) {
59
+ prompt += `
60
+
61
+ ## Existing AI Tool Instructions (Context)
62
+
63
+ The following are instructions from other AI coding tools already present in
64
+ this workspace. Use them as additional context to understand the project's
65
+ coding standards, conventions, and any domain-specific guidelines. Your
66
+ optimized AGENTS.md should complement (not duplicate) this content.
67
+
68
+ ${toolInstructions}`;
69
+ }
70
+ return prompt;
71
+ }
72
+ /**
73
+ * Build the user prompt for instruction optimization.
74
+ *
75
+ * Includes the current instructions and optionally a KB diff showing
76
+ * what changed in the codebase since the last generation.
77
+ */
78
+ function buildOptimizePrompt(currentInstructions, kbDiff, priorFeedback) {
79
+ let prompt = `Optimize the following AGENTS.md instructions. Make them more specific,
80
+ actionable, and aligned with the knowledge base provided in the system prompt.
81
+
82
+ ## Rules
83
+ - Keep the same overall structure (sections, headers) unless restructuring improves clarity.
84
+ - Remove generic advice that any developer already knows.
85
+ - Add project-specific guidance derived from the knowledge base.
86
+ - Be concise — every line should earn its place.
87
+ - Output ONLY the optimized instruction content (no explanations or markdown fences).
88
+
89
+ ## Current Instructions
90
+ ${currentInstructions}`;
91
+ if (kbDiff) {
92
+ prompt += `
93
+
94
+ ## Recent KB Changes (diff)
95
+ The following diff shows what changed in the knowledge base since the last generation.
96
+ Focus your optimization on areas affected by these changes:
97
+ ${kbDiff}`;
98
+ }
99
+ if (priorFeedback) {
100
+ prompt += `
101
+
102
+ ## Prior Evaluation Feedback
103
+ A previous iteration received this feedback. Address these points:
104
+ ${priorFeedback}`;
105
+ }
106
+ return prompt;
107
+ }
108
+ /**
109
+ * Build the evaluation prompt that asks the LLM to score and critique
110
+ * a candidate set of instructions.
111
+ */
112
+ function buildEvalPrompt(candidateInstructions, kb, kbCharBudget) {
113
+ const trimmedKb = truncateKb(kb, kbCharBudget);
114
+ return `You are evaluating AI coding assistant instructions (AGENTS.md) for quality.
115
+
116
+ Score the following candidate instructions on a scale of 1–10 based on:
117
+ 1. **Specificity** — Are rules grounded in the actual codebase, not generic?
118
+ 2. **Actionability** — Can an AI assistant follow each rule unambiguously?
119
+ 3. **Completeness** — Are key architectural patterns and conventions covered?
120
+ 4. **Conciseness** — Is every line valuable, with no filler?
121
+ 5. **Alignment** — Do the instructions match the knowledge base accurately?
122
+
123
+ Respond in EXACTLY this format (no other text):
124
+ SCORE: <number 1-10>
125
+ FEEDBACK: <one paragraph of overall assessment>
126
+ SUGGESTIONS:
127
+ - <specific improvement 1>
128
+ - <specific improvement 2>
129
+ - <specific improvement 3>
130
+
131
+ ## Knowledge Base (for reference)
132
+ ${trimmedKb}
133
+
134
+ ## Candidate Instructions
135
+ ${candidateInstructions}`;
136
+ }
137
+ /**
138
+ * Parse the structured evaluation response into an EvalResult.
139
+ */
140
+ function parseEvalResponse(response) {
141
+ const scoreMatch = response.match(/SCORE:\s*(\d+)/i);
142
+ const score = scoreMatch ? Math.min(10, Math.max(1, parseInt(scoreMatch[1], 10))) : 5;
143
+ const feedbackMatch = response.match(/FEEDBACK:\s*(.+?)(?=SUGGESTIONS:|$)/is);
144
+ const feedback = feedbackMatch ? feedbackMatch[1].trim() : 'No feedback provided.';
145
+ const suggestionsMatch = response.match(/SUGGESTIONS:\s*([\s\S]*)/i);
146
+ const suggestions = [];
147
+ if (suggestionsMatch) {
148
+ for (const line of suggestionsMatch[1].split('\n')) {
149
+ const trimmed = line.replace(/^[-*]\s*/, '').trim();
150
+ if (trimmed)
151
+ suggestions.push(trimmed);
152
+ }
153
+ }
154
+ return { score, feedback, suggestions };
155
+ }
156
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AASH,gCAeC;AAMD,8CAmCC;AAQD,kDAoCC;AAMD,0CA6BC;AAKD,8CAqBC;AAxKD,kEAAkE;AAClE,MAAM,sBAAsB,GAAG,KAAM,CAAC;AAEtC;;;GAGG;AACH,SAAgB,UAAU,CAAC,EAAU,EAAE,aAAqB,sBAAsB;IAChF,IAAI,EAAE,CAAC,MAAM,IAAI,UAAU;QAAE,OAAO,EAAE,CAAC;IAEvC,8CAA8C;IAC9C,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrC,IAAI,OAAO,GAAG,CAAC,IAAI,OAAO,GAAG,UAAU,EAAE,CAAC;QACxC,MAAM,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;QACvC,OAAO,CACL,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC;YACpB,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;YACtC,+CAA+C,CAChD,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,+CAA+C,CAAC;AACnF,CAAC;AAED;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,EAAU,EAAE,YAAqB,EAAE,gBAAyB;IAC5F,MAAM,SAAS,GAAG,UAAU,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC;IAE/C,IAAI,MAAM,GAAG;;;;;;;;;;;;;;;;EAgBb,SAAS,EAAE,CAAC;IAEZ,IAAI,gBAAgB,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AM,gBAAgB,GAAG,QAAQ,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;IACrE,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,IAAI,gBAAgB,EAAE,CAAC;QACrB,KAAK,MAAM,IAAI,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YACnD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;YACpD,IAAI,OAAO;gBAAE,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Anthropic provider — implements LlmProvider using the Anthropic SDK.
3
+ *
4
+ * Features:
5
+ * - Cached client instance (created once per provider, not per call)
6
+ * - Configurable model, temperature, and max_tokens via ProviderOptions
7
+ * - Retry with exponential backoff on transient errors
8
+ * - Truncation detection (warns when stop_reason is 'max_tokens')
9
+ * - Proper system prompt handling (Anthropic uses a separate `system` field)
10
+ */
11
+ import type { LlmProvider, ProviderOptions } from '../types';
12
+ /**
13
+ * Create an Anthropic-backed LlmProvider.
14
+ *
15
+ * Uses dynamic import so the `@anthropic-ai/sdk` package is only loaded
16
+ * when this provider is actually used. The client is created once
17
+ * and reused across all calls.
18
+ */
19
+ export declare function createAnthropicProvider(apiKey: string, options?: ProviderOptions): LlmProvider;
20
+ //# sourceMappingURL=anthropic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAe,WAAW,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAO1E;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,WAAW,CAqF9F"}