@djibrilm/lazy-review 0.0.1

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 (264) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +95 -0
  3. package/dist/bin.d.ts +3 -0
  4. package/dist/bin.d.ts.map +1 -0
  5. package/dist/bin.js +17 -0
  6. package/dist/bin.js.map +1 -0
  7. package/dist/client/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  8. package/dist/client/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  9. package/dist/client/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  10. package/dist/client/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  11. package/dist/client/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  12. package/dist/client/assets/index-4oL_AGyI.css +1 -0
  13. package/dist/client/assets/index-CJtKCyBg.js +848 -0
  14. package/dist/client/favicon.png +0 -0
  15. package/dist/client/favicon.svg +1 -0
  16. package/dist/client/icons.svg +24 -0
  17. package/dist/client/index.html +17 -0
  18. package/dist/client/resources/images/logo.png +0 -0
  19. package/dist/client/resources/images/openai.png +0 -0
  20. package/dist/constants.d.ts +3 -0
  21. package/dist/constants.d.ts.map +1 -0
  22. package/dist/constants.js +3 -0
  23. package/dist/constants.js.map +1 -0
  24. package/dist/dev.d.ts +2 -0
  25. package/dist/dev.d.ts.map +1 -0
  26. package/dist/dev.js +10 -0
  27. package/dist/dev.js.map +1 -0
  28. package/dist/modules/ai-agent/agent-context-manager.d.ts +57 -0
  29. package/dist/modules/ai-agent/agent-context-manager.d.ts.map +1 -0
  30. package/dist/modules/ai-agent/agent-context-manager.js +159 -0
  31. package/dist/modules/ai-agent/agent-context-manager.js.map +1 -0
  32. package/dist/modules/ai-agent/ai-agent.module.d.ts +17 -0
  33. package/dist/modules/ai-agent/ai-agent.module.d.ts.map +1 -0
  34. package/dist/modules/ai-agent/ai-agent.module.js +24 -0
  35. package/dist/modules/ai-agent/ai-agent.module.js.map +1 -0
  36. package/dist/modules/ai-agent/ai-agent.utils.d.ts +10 -0
  37. package/dist/modules/ai-agent/ai-agent.utils.d.ts.map +1 -0
  38. package/dist/modules/ai-agent/ai-agent.utils.js +389 -0
  39. package/dist/modules/ai-agent/ai-agent.utils.js.map +1 -0
  40. package/dist/modules/ai-agent/base.agent.d.ts +26 -0
  41. package/dist/modules/ai-agent/base.agent.d.ts.map +1 -0
  42. package/dist/modules/ai-agent/base.agent.js +101 -0
  43. package/dist/modules/ai-agent/base.agent.js.map +1 -0
  44. package/dist/modules/ai-agent/chat.agent.d.ts +35 -0
  45. package/dist/modules/ai-agent/chat.agent.d.ts.map +1 -0
  46. package/dist/modules/ai-agent/chat.agent.js +590 -0
  47. package/dist/modules/ai-agent/chat.agent.js.map +1 -0
  48. package/dist/modules/ai-agent/code-base-indexer.agent.d.ts +13 -0
  49. package/dist/modules/ai-agent/code-base-indexer.agent.d.ts.map +1 -0
  50. package/dist/modules/ai-agent/code-base-indexer.agent.js +506 -0
  51. package/dist/modules/ai-agent/code-base-indexer.agent.js.map +1 -0
  52. package/dist/modules/ai-agent/codebase-scanner.d.ts +37 -0
  53. package/dist/modules/ai-agent/codebase-scanner.d.ts.map +1 -0
  54. package/dist/modules/ai-agent/codebase-scanner.js +260 -0
  55. package/dist/modules/ai-agent/codebase-scanner.js.map +1 -0
  56. package/dist/modules/ai-agent/model-loader.d.ts +7 -0
  57. package/dist/modules/ai-agent/model-loader.d.ts.map +1 -0
  58. package/dist/modules/ai-agent/model-loader.js +129 -0
  59. package/dist/modules/ai-agent/model-loader.js.map +1 -0
  60. package/dist/modules/ai-agent/orientation-loader.d.ts +2 -0
  61. package/dist/modules/ai-agent/orientation-loader.d.ts.map +1 -0
  62. package/dist/modules/ai-agent/orientation-loader.js +70 -0
  63. package/dist/modules/ai-agent/orientation-loader.js.map +1 -0
  64. package/dist/modules/ai-agent/pr-review-session.manager.d.ts +36 -0
  65. package/dist/modules/ai-agent/pr-review-session.manager.d.ts.map +1 -0
  66. package/dist/modules/ai-agent/pr-review-session.manager.js +106 -0
  67. package/dist/modules/ai-agent/pr-review-session.manager.js.map +1 -0
  68. package/dist/modules/ai-agent/pr-review.agent.d.ts +22 -0
  69. package/dist/modules/ai-agent/pr-review.agent.d.ts.map +1 -0
  70. package/dist/modules/ai-agent/pr-review.agent.js +269 -0
  71. package/dist/modules/ai-agent/pr-review.agent.js.map +1 -0
  72. package/dist/modules/ai-agent/research-loop.d.ts +3 -0
  73. package/dist/modules/ai-agent/research-loop.d.ts.map +1 -0
  74. package/dist/modules/ai-agent/research-loop.js +691 -0
  75. package/dist/modules/ai-agent/research-loop.js.map +1 -0
  76. package/dist/modules/ai-agent/review-pipeline/agent-loop.d.ts +36 -0
  77. package/dist/modules/ai-agent/review-pipeline/agent-loop.d.ts.map +1 -0
  78. package/dist/modules/ai-agent/review-pipeline/agent-loop.js +178 -0
  79. package/dist/modules/ai-agent/review-pipeline/agent-loop.js.map +1 -0
  80. package/dist/modules/ai-agent/review-pipeline/change-analyzer.d.ts +8 -0
  81. package/dist/modules/ai-agent/review-pipeline/change-analyzer.d.ts.map +1 -0
  82. package/dist/modules/ai-agent/review-pipeline/change-analyzer.js +93 -0
  83. package/dist/modules/ai-agent/review-pipeline/change-analyzer.js.map +1 -0
  84. package/dist/modules/ai-agent/review-pipeline/finding-ranker.d.ts +47 -0
  85. package/dist/modules/ai-agent/review-pipeline/finding-ranker.d.ts.map +1 -0
  86. package/dist/modules/ai-agent/review-pipeline/finding-ranker.js +91 -0
  87. package/dist/modules/ai-agent/review-pipeline/finding-ranker.js.map +1 -0
  88. package/dist/modules/ai-agent/review-pipeline/finding-verifier.d.ts +29 -0
  89. package/dist/modules/ai-agent/review-pipeline/finding-verifier.d.ts.map +1 -0
  90. package/dist/modules/ai-agent/review-pipeline/finding-verifier.js +130 -0
  91. package/dist/modules/ai-agent/review-pipeline/finding-verifier.js.map +1 -0
  92. package/dist/modules/ai-agent/review-pipeline/repository-explorer.d.ts +21 -0
  93. package/dist/modules/ai-agent/review-pipeline/repository-explorer.d.ts.map +1 -0
  94. package/dist/modules/ai-agent/review-pipeline/repository-explorer.js +247 -0
  95. package/dist/modules/ai-agent/review-pipeline/repository-explorer.js.map +1 -0
  96. package/dist/modules/ai-agent/review-pipeline/review-controller.d.ts +22 -0
  97. package/dist/modules/ai-agent/review-pipeline/review-controller.d.ts.map +1 -0
  98. package/dist/modules/ai-agent/review-pipeline/review-controller.js +102 -0
  99. package/dist/modules/ai-agent/review-pipeline/review-controller.js.map +1 -0
  100. package/dist/modules/ai-agent/review-pipeline/review-writer.d.ts +4 -0
  101. package/dist/modules/ai-agent/review-pipeline/review-writer.d.ts.map +1 -0
  102. package/dist/modules/ai-agent/review-pipeline/review-writer.js +52 -0
  103. package/dist/modules/ai-agent/review-pipeline/review-writer.js.map +1 -0
  104. package/dist/modules/ai-agent/review-pipeline/secret-scanner.d.ts +25 -0
  105. package/dist/modules/ai-agent/review-pipeline/secret-scanner.d.ts.map +1 -0
  106. package/dist/modules/ai-agent/review-pipeline/secret-scanner.js +159 -0
  107. package/dist/modules/ai-agent/review-pipeline/secret-scanner.js.map +1 -0
  108. package/dist/modules/ai-agent/review-pipeline/specialist-reviewer.d.ts +9 -0
  109. package/dist/modules/ai-agent/review-pipeline/specialist-reviewer.d.ts.map +1 -0
  110. package/dist/modules/ai-agent/review-pipeline/specialist-reviewer.js +114 -0
  111. package/dist/modules/ai-agent/review-pipeline/specialist-reviewer.js.map +1 -0
  112. package/dist/modules/ai-agent/review-pipeline/types.d.ts +53 -0
  113. package/dist/modules/ai-agent/review-pipeline/types.d.ts.map +1 -0
  114. package/dist/modules/ai-agent/review-pipeline/types.js +45 -0
  115. package/dist/modules/ai-agent/review-pipeline/types.js.map +1 -0
  116. package/dist/modules/ai-agent/tool-executor.d.ts +37 -0
  117. package/dist/modules/ai-agent/tool-executor.d.ts.map +1 -0
  118. package/dist/modules/ai-agent/tool-executor.js +199 -0
  119. package/dist/modules/ai-agent/tool-executor.js.map +1 -0
  120. package/dist/modules/ai-agent/tool-types.d.ts +72 -0
  121. package/dist/modules/ai-agent/tool-types.d.ts.map +1 -0
  122. package/dist/modules/ai-agent/tool-types.js +2 -0
  123. package/dist/modules/ai-agent/tool-types.js.map +1 -0
  124. package/dist/modules/ai-agent/tools/fs-tools.d.ts +54 -0
  125. package/dist/modules/ai-agent/tools/fs-tools.d.ts.map +1 -0
  126. package/dist/modules/ai-agent/tools/fs-tools.js +237 -0
  127. package/dist/modules/ai-agent/tools/fs-tools.js.map +1 -0
  128. package/dist/modules/ai-agent/tools/git-tools.d.ts +322 -0
  129. package/dist/modules/ai-agent/tools/git-tools.d.ts.map +1 -0
  130. package/dist/modules/ai-agent/tools/git-tools.js +557 -0
  131. package/dist/modules/ai-agent/tools/git-tools.js.map +1 -0
  132. package/dist/modules/ai-agent/tools/pr-chat-tools.d.ts +15 -0
  133. package/dist/modules/ai-agent/tools/pr-chat-tools.d.ts.map +1 -0
  134. package/dist/modules/ai-agent/tools/pr-chat-tools.js +232 -0
  135. package/dist/modules/ai-agent/tools/pr-chat-tools.js.map +1 -0
  136. package/dist/modules/database/database.module.d.ts +10 -0
  137. package/dist/modules/database/database.module.d.ts.map +1 -0
  138. package/dist/modules/database/database.module.js +36 -0
  139. package/dist/modules/database/database.module.js.map +1 -0
  140. package/dist/modules/database/vector-database.service.d.ts +27 -0
  141. package/dist/modules/database/vector-database.service.d.ts.map +1 -0
  142. package/dist/modules/database/vector-database.service.js +170 -0
  143. package/dist/modules/database/vector-database.service.js.map +1 -0
  144. package/dist/modules/github/github.module.d.ts +964 -0
  145. package/dist/modules/github/github.module.d.ts.map +1 -0
  146. package/dist/modules/github/github.module.js +316 -0
  147. package/dist/modules/github/github.module.js.map +1 -0
  148. package/dist/modules/main.module.d.ts +20 -0
  149. package/dist/modules/main.module.d.ts.map +1 -0
  150. package/dist/modules/main.module.js +59 -0
  151. package/dist/modules/main.module.js.map +1 -0
  152. package/dist/modules/qvac/qvac.module.d.ts +28 -0
  153. package/dist/modules/qvac/qvac.module.d.ts.map +1 -0
  154. package/dist/modules/qvac/qvac.module.js +146 -0
  155. package/dist/modules/qvac/qvac.module.js.map +1 -0
  156. package/dist/modules/server/dtos/create-project.dto.d.ts +9 -0
  157. package/dist/modules/server/dtos/create-project.dto.d.ts.map +1 -0
  158. package/dist/modules/server/dtos/create-project.dto.js +2 -0
  159. package/dist/modules/server/dtos/create-project.dto.js.map +1 -0
  160. package/dist/modules/server/entities/agent-task.entity.d.ts +16 -0
  161. package/dist/modules/server/entities/agent-task.entity.d.ts.map +1 -0
  162. package/dist/modules/server/entities/agent-task.entity.js +72 -0
  163. package/dist/modules/server/entities/agent-task.entity.js.map +1 -0
  164. package/dist/modules/server/entities/ai-provider.entity.d.ts +11 -0
  165. package/dist/modules/server/entities/ai-provider.entity.d.ts.map +1 -0
  166. package/dist/modules/server/entities/ai-provider.entity.js +47 -0
  167. package/dist/modules/server/entities/ai-provider.entity.js.map +1 -0
  168. package/dist/modules/server/entities/deployment-plan-approval.entity.d.ts +10 -0
  169. package/dist/modules/server/entities/deployment-plan-approval.entity.d.ts.map +1 -0
  170. package/dist/modules/server/entities/deployment-plan-approval.entity.js +42 -0
  171. package/dist/modules/server/entities/deployment-plan-approval.entity.js.map +1 -0
  172. package/dist/modules/server/entities/deployment-plan-artifact.entity.d.ts +10 -0
  173. package/dist/modules/server/entities/deployment-plan-artifact.entity.d.ts.map +1 -0
  174. package/dist/modules/server/entities/deployment-plan-artifact.entity.js +42 -0
  175. package/dist/modules/server/entities/deployment-plan-artifact.entity.js.map +1 -0
  176. package/dist/modules/server/entities/deployment-plan-feedback.entity.d.ts +9 -0
  177. package/dist/modules/server/entities/deployment-plan-feedback.entity.d.ts.map +1 -0
  178. package/dist/modules/server/entities/deployment-plan-feedback.entity.js +37 -0
  179. package/dist/modules/server/entities/deployment-plan-feedback.entity.js.map +1 -0
  180. package/dist/modules/server/entities/deployment-plan-revision.entity.d.ts +11 -0
  181. package/dist/modules/server/entities/deployment-plan-revision.entity.d.ts.map +1 -0
  182. package/dist/modules/server/entities/deployment-plan-revision.entity.js +47 -0
  183. package/dist/modules/server/entities/deployment-plan-revision.entity.js.map +1 -0
  184. package/dist/modules/server/entities/deployment-plan.entity.d.ts +13 -0
  185. package/dist/modules/server/entities/deployment-plan.entity.d.ts.map +1 -0
  186. package/dist/modules/server/entities/deployment-plan.entity.js +58 -0
  187. package/dist/modules/server/entities/deployment-plan.entity.js.map +1 -0
  188. package/dist/modules/server/entities/project.entity.d.ts +26 -0
  189. package/dist/modules/server/entities/project.entity.d.ts.map +1 -0
  190. package/dist/modules/server/entities/project.entity.js +122 -0
  191. package/dist/modules/server/entities/project.entity.js.map +1 -0
  192. package/dist/modules/server/entities/settings.entity.d.ts +12 -0
  193. package/dist/modules/server/entities/settings.entity.d.ts.map +1 -0
  194. package/dist/modules/server/entities/settings.entity.js +62 -0
  195. package/dist/modules/server/entities/settings.entity.js.map +1 -0
  196. package/dist/modules/server/entities/terminal-log.entity.d.ts +10 -0
  197. package/dist/modules/server/entities/terminal-log.entity.d.ts.map +1 -0
  198. package/dist/modules/server/entities/terminal-log.entity.js +42 -0
  199. package/dist/modules/server/entities/terminal-log.entity.js.map +1 -0
  200. package/dist/modules/server/middleware/auth.middleware.d.ts +8 -0
  201. package/dist/modules/server/middleware/auth.middleware.d.ts.map +1 -0
  202. package/dist/modules/server/middleware/auth.middleware.js +26 -0
  203. package/dist/modules/server/middleware/auth.middleware.js.map +1 -0
  204. package/dist/modules/server/routes/auth.routes.d.ts +13 -0
  205. package/dist/modules/server/routes/auth.routes.d.ts.map +1 -0
  206. package/dist/modules/server/routes/auth.routes.js +59 -0
  207. package/dist/modules/server/routes/auth.routes.js.map +1 -0
  208. package/dist/modules/server/routes/github.routes.d.ts +14 -0
  209. package/dist/modules/server/routes/github.routes.d.ts.map +1 -0
  210. package/dist/modules/server/routes/github.routes.js +124 -0
  211. package/dist/modules/server/routes/github.routes.js.map +1 -0
  212. package/dist/modules/server/routes/project.routes.d.ts +11 -0
  213. package/dist/modules/server/routes/project.routes.d.ts.map +1 -0
  214. package/dist/modules/server/routes/project.routes.js +78 -0
  215. package/dist/modules/server/routes/project.routes.js.map +1 -0
  216. package/dist/modules/server/routes/qvac.routes.d.ts +11 -0
  217. package/dist/modules/server/routes/qvac.routes.d.ts.map +1 -0
  218. package/dist/modules/server/routes/qvac.routes.js +24 -0
  219. package/dist/modules/server/routes/qvac.routes.js.map +1 -0
  220. package/dist/modules/server/routes/routes.d.ts +20 -0
  221. package/dist/modules/server/routes/routes.d.ts.map +1 -0
  222. package/dist/modules/server/routes/routes.js +35 -0
  223. package/dist/modules/server/routes/routes.js.map +1 -0
  224. package/dist/modules/server/routes/settings.controller.d.ts +14 -0
  225. package/dist/modules/server/routes/settings.controller.d.ts.map +1 -0
  226. package/dist/modules/server/routes/settings.controller.js +65 -0
  227. package/dist/modules/server/routes/settings.controller.js.map +1 -0
  228. package/dist/modules/server/server.module.d.ts +19 -0
  229. package/dist/modules/server/server.module.d.ts.map +1 -0
  230. package/dist/modules/server/server.module.js +63 -0
  231. package/dist/modules/server/server.module.js.map +1 -0
  232. package/dist/modules/server/services/auth.services.d.ts +19 -0
  233. package/dist/modules/server/services/auth.services.d.ts.map +1 -0
  234. package/dist/modules/server/services/auth.services.js +87 -0
  235. package/dist/modules/server/services/auth.services.js.map +1 -0
  236. package/dist/modules/server/services/deployment-plan.services.d.ts +6 -0
  237. package/dist/modules/server/services/deployment-plan.services.d.ts.map +1 -0
  238. package/dist/modules/server/services/deployment-plan.services.js +8 -0
  239. package/dist/modules/server/services/deployment-plan.services.js.map +1 -0
  240. package/dist/modules/server/services/github.services.d.ts +939 -0
  241. package/dist/modules/server/services/github.services.d.ts.map +1 -0
  242. package/dist/modules/server/services/github.services.js +46 -0
  243. package/dist/modules/server/services/github.services.js.map +1 -0
  244. package/dist/modules/server/services/project.services.d.ts +41 -0
  245. package/dist/modules/server/services/project.services.d.ts.map +1 -0
  246. package/dist/modules/server/services/project.services.js +360 -0
  247. package/dist/modules/server/services/project.services.js.map +1 -0
  248. package/dist/modules/server/services/qvac.services.d.ts +10 -0
  249. package/dist/modules/server/services/qvac.services.d.ts.map +1 -0
  250. package/dist/modules/server/services/qvac.services.js +58 -0
  251. package/dist/modules/server/services/qvac.services.js.map +1 -0
  252. package/dist/modules/server/services/settings.service.d.ts +60 -0
  253. package/dist/modules/server/services/settings.service.d.ts.map +1 -0
  254. package/dist/modules/server/services/settings.service.js +125 -0
  255. package/dist/modules/server/services/settings.service.js.map +1 -0
  256. package/dist/modules/socket-gateway/interfaces/project-creation-log.interface.d.ts +14 -0
  257. package/dist/modules/socket-gateway/interfaces/project-creation-log.interface.d.ts.map +1 -0
  258. package/dist/modules/socket-gateway/interfaces/project-creation-log.interface.js +2 -0
  259. package/dist/modules/socket-gateway/interfaces/project-creation-log.interface.js.map +1 -0
  260. package/dist/modules/socket-gateway/socket-gateway.module.d.ts +28 -0
  261. package/dist/modules/socket-gateway/socket-gateway.module.d.ts.map +1 -0
  262. package/dist/modules/socket-gateway/socket-gateway.module.js +92 -0
  263. package/dist/modules/socket-gateway/socket-gateway.module.js.map +1 -0
  264. package/package.json +95 -0
@@ -0,0 +1,25 @@
1
+ import type { ReviewerCandidate } from './types.js';
2
+ export interface SecretScannerOpts {
3
+ modelId: string;
4
+ kvCacheId?: string | undefined;
5
+ progress?: ((m: string) => void) | undefined;
6
+ }
7
+ /**
8
+ * File-name patterns that flag a changed file as a likely carrier of secrets.
9
+ * These are used to steer the Secret Scanner agent (and are matched over the
10
+ * PR diff file names) before it deep-dives into a file's diff content.
11
+ */
12
+ export declare const SENSITIVE_FILE_PATTERNS: RegExp[];
13
+ /**
14
+ * Secret Scanner agent.
15
+ *
16
+ * In charge of finding sensitive files and leaked secrets that should never reach
17
+ * GitHub (env files, private keys, credential bundles, etc.). It reviews the PR's
18
+ * changed file names; when a name may contain secrets it calls the
19
+ * `read_pr_file_diff` tool to read that file's diff and CONFIRM the secret exists.
20
+ *
21
+ * Returns confirmed findings as security ReviewerCandidates so they flow through
22
+ * the pipeline's verifier, ranker, and writer.
23
+ */
24
+ export declare function scanSensitiveFiles(opts: SecretScannerOpts, diffText: string): Promise<ReviewerCandidate[]>;
25
+ //# sourceMappingURL=secret-scanner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secret-scanner.d.ts","sourceRoot":"","sources":["../../../../src/modules/ai-agent/review-pipeline/secret-scanner.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CAC9C;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,EAY3C,CAAC;AAkBF;;;;;;;;;;GAUG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,iBAAiB,EACvB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,iBAAiB,EAAE,CAAC,CA2F9B"}
@@ -0,0 +1,159 @@
1
+ import { extractJson, parseDiff } from '../ai-agent.utils.js';
2
+ import { runAgentLoop } from './agent-loop.js';
3
+ /**
4
+ * File-name patterns that flag a changed file as a likely carrier of secrets.
5
+ * These are used to steer the Secret Scanner agent (and are matched over the
6
+ * PR diff file names) before it deep-dives into a file's diff content.
7
+ */
8
+ export const SENSITIVE_FILE_PATTERNS = [
9
+ /(^|\/)\.env([^/]*)$/i, // .env, .env.local, .env.production, ...
10
+ /\.env\.(local|dev|development|test|staging|prod|production|example)$/i,
11
+ /\.(pem|p12|pfx|p8|key|keystore|jks|ppk)$/i,
12
+ /(^|\/)(id_rsa|id_dsa|id_ecdsa|id_ed25519)(\.pub)?$/i,
13
+ /(^|\/)(credentials|secret|secrets)([^/]*)$/i,
14
+ /(^|\/)secret\.(ya?ml|json|env)$/i,
15
+ /service-account[^/]*\.json$/i,
16
+ /google-credentials[^/]*\.json$/i,
17
+ /(^|\/)\.(npmrc|pypirc|netrc|htpasswd)$/i,
18
+ /(^|\/)dockerconfigjson$/i,
19
+ /(^|\/)\.docker\/config\.json$/i,
20
+ ];
21
+ const BUDGET = 12;
22
+ const FILE_NAME_GUIDANCE = `
23
+ Watch carefully for file NAMES that commonly hold secrets and must NEVER be committed:
24
+ - Environment files: .env, .env.local, .env.production, .env.*
25
+ - Private key / certificate material: *.pem, *.key, *.p12, *.pfx, *.p8, *.keystore, *.jks, id_rsa, id_dsa, id_ecdsa, id_ed25519
26
+ - Credential / secret bundles: credentials*, secret(s).yaml|json|env, service-account*.json, google-credentials*.json, .npmrc, .pypirc, .netrc, .htpasswd, dockerconfigjson`;
27
+ const CONFIRMATION_RULE = `
28
+ Only report a finding when you CONFIRMED an actual secret in the file's diff content,
29
+ such as: KEY=VALUE assignments where the value looks like a credential, tokens,
30
+ passwords, connection strings, or an "-----BEGIN (RSA|OPENSSH|EC) PRIVATE KEY-----" block.
31
+ Do NOT report files whose diff contains only placeholders, empty values, or example data.
32
+ For each confirmed file, set evidence to the exact secret-bearing line(s) and
33
+ location to the file (and line when the diff reveals it).`;
34
+ /**
35
+ * Secret Scanner agent.
36
+ *
37
+ * In charge of finding sensitive files and leaked secrets that should never reach
38
+ * GitHub (env files, private keys, credential bundles, etc.). It reviews the PR's
39
+ * changed file names; when a name may contain secrets it calls the
40
+ * `read_pr_file_diff` tool to read that file's diff and CONFIRM the secret exists.
41
+ *
42
+ * Returns confirmed findings as security ReviewerCandidates so they flow through
43
+ * the pipeline's verifier, ranker, and writer.
44
+ */
45
+ export async function scanSensitiveFiles(opts, diffText) {
46
+ const parsedDiff = parseDiff(diffText);
47
+ if (parsedDiff.length === 0)
48
+ return [];
49
+ const byFile = new Map(parsedDiff.map((f) => [f.file, f.diff]));
50
+ const changedFiles = parsedDiff.map((f) => f.file);
51
+ const system = `You are the Secret Scanner agent in a code review pipeline.
52
+
53
+ Your ONLY job is to find files that should NEVER be committed to GitHub because
54
+ they contain secrets (API keys, passwords, tokens, private keys, database credentials).
55
+
56
+ You receive the list of file paths changed in this PR. Inspect every file NAME.
57
+ ${FILE_NAME_GUIDANCE}
58
+
59
+ If a file NAME looks like it may contain secrets, call the read_pr_file_diff tool
60
+ with its full path to read the actual diff content for that file.
61
+ ${CONFIRMATION_RULE}
62
+
63
+ Use "evidence" only from the diff content returned by read_pr_file_diff.
64
+
65
+ Output ONLY a JSON array of confirmed findings:
66
+ [{"hypothesis":"...","confidence":0.0-1.0,"impactScore":1-4,"likelihoodScore":1-4,"impactDescription":"...","recommendation":"...","invariant":"...","evidence":[{"fact":"...","source":"file:line"}],"location":{"file":"src/.env","line":3}}]`;
67
+ const tools = [
68
+ {
69
+ name: 'read_pr_file_diff',
70
+ description: 'Read the exact diff content for a specific file changed in this PR. Use this to confirm whether a sensitive-named file actually contains secrets.',
71
+ handler: async (a) => {
72
+ const p = String(a.file_path ?? a.filePath ?? '');
73
+ if (!p)
74
+ return { error: 'file_path (or filePath) is required.' };
75
+ const diff = byFile.get(p);
76
+ if (diff === undefined)
77
+ return { error: `File "${p}" is not in this PR's diff.` };
78
+ return { file: p, diff };
79
+ },
80
+ },
81
+ ];
82
+ const result = await runAgentLoop({
83
+ modelId: opts.modelId,
84
+ systemPrompt: system,
85
+ userMessage: `## Files changed in this PR\n${changedFiles
86
+ .map((f) => '- ' + f)
87
+ .join('\n')}\n\n${FILE_NAME_GUIDANCE}\n\nReview each file name above. For any name that may hold secrets, call read_pr_file_diff to read its diff and CONFIRM the secret. Output the JSON array of confirmed findings when done.`,
88
+ tools,
89
+ maxIterations: 10,
90
+ maxToolCalls: BUDGET + 1,
91
+ maxSourceTokens: 10_000,
92
+ kvCacheId: opts.kvCacheId,
93
+ progress: (m) => opts.progress?.('[SecretScanner] ' + m),
94
+ finalize: 'Output ONLY a JSON array (possibly empty) of confirmed findings. No markdown.',
95
+ });
96
+ try {
97
+ const parsed = extractJson(result.text);
98
+ const arr = Array.isArray(parsed)
99
+ ? parsed
100
+ : Array.isArray(parsed.findings)
101
+ ? parsed.findings
102
+ : [];
103
+ return arr
104
+ .filter((f) => f && typeof f.hypothesis === 'string')
105
+ .map((f) => {
106
+ const c = {
107
+ category: 'security',
108
+ hypothesis: String(f.hypothesis),
109
+ confidence: clamp(f.confidence),
110
+ evidence: Array.isArray(f.evidence)
111
+ ? f.evidence.map((e) => ({
112
+ fact: String(e.fact ?? ''),
113
+ source: String(e.source ?? ''),
114
+ }))
115
+ : [],
116
+ };
117
+ const impactScore = clampScore(f.impactScore);
118
+ if (impactScore !== undefined)
119
+ c.impactScore = impactScore;
120
+ const likelihoodScore = clampScore(f.likelihoodScore);
121
+ if (likelihoodScore !== undefined)
122
+ c.likelihoodScore = likelihoodScore;
123
+ if (f.impactDescription)
124
+ c.impactDescription = String(f.impactDescription);
125
+ if (f.recommendation)
126
+ c.recommendation = String(f.recommendation);
127
+ if (f.invariant)
128
+ c.invariant = String(f.invariant);
129
+ const loc = buildLocation(f.location);
130
+ if (loc)
131
+ c.location = loc;
132
+ return c;
133
+ });
134
+ }
135
+ catch {
136
+ return [];
137
+ }
138
+ }
139
+ function clamp(n) {
140
+ const v = Number(n);
141
+ return Number.isFinite(v) ? Math.min(1, Math.max(0, v)) : 0.5;
142
+ }
143
+ function clampScore(n) {
144
+ const v = Number(n);
145
+ if (!Number.isFinite(v))
146
+ return undefined;
147
+ return Math.min(4, Math.max(1, Math.round(v)));
148
+ }
149
+ function buildLocation(loc) {
150
+ if (!loc || typeof loc !== 'object')
151
+ return undefined;
152
+ const o = loc;
153
+ const file = String(o.file ?? '');
154
+ if (!file)
155
+ return undefined;
156
+ const line = Number(o.line);
157
+ return { file, ...(Number.isFinite(line) && line > 0 ? { line } : {}) };
158
+ }
159
+ //# sourceMappingURL=secret-scanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secret-scanner.js","sourceRoot":"","sources":["../../../../src/modules/ai-agent/review-pipeline/secret-scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAuB,MAAM,iBAAiB,CAAC;AASpE;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAa;IAC/C,sBAAsB,EAAE,yCAAyC;IACjE,uEAAuE;IACvE,2CAA2C;IAC3C,qDAAqD;IACrD,6CAA6C;IAC7C,kCAAkC;IAClC,8BAA8B;IAC9B,iCAAiC;IACjC,yCAAyC;IACzC,0BAA0B;IAC1B,gCAAgC;CACjC,CAAC;AAEF,MAAM,MAAM,GAAG,EAAE,CAAC;AAElB,MAAM,kBAAkB,GAAG;;;;4KAIiJ,CAAC;AAE7K,MAAM,iBAAiB,GAAG;;;;;;0DAMgC,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,IAAuB,EACvB,QAAgB;IAEhB,MAAM,UAAU,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEvC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAChE,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAEnD,MAAM,MAAM,GAAG;;;;;;EAMf,kBAAkB;;;;EAIlB,iBAAiB;;;;;gPAK6N,CAAC;IAE/O,MAAM,KAAK,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AAG,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;IAClC,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC5B,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAC1E,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { ExplorerAnswer, ReviewerCandidate, ReviewCategory } from './types.js';
2
+ export interface ReviewerOpts {
3
+ modelId: string;
4
+ kvCacheId?: string;
5
+ progress?: (m: string) => void;
6
+ askExplorer: (q: string) => Promise<ExplorerAnswer>;
7
+ }
8
+ export declare function reviewAsSpecialist(category: ReviewCategory, opts: ReviewerOpts, diffText: string, changeContext: string): Promise<ReviewerCandidate[]>;
9
+ //# sourceMappingURL=specialist-reviewer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specialist-reviewer.d.ts","sourceRoot":"","sources":["../../../../src/modules/ai-agent/review-pipeline/specialist-reviewer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEpF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CACrD;AAID,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,cAAc,EACxB,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAoF9B"}
@@ -0,0 +1,114 @@
1
+ import { extractJson } from '../ai-agent.utils.js';
2
+ import { runAgentLoop } from './agent-loop.js';
3
+ import { REVIEWER_DESCRIPTIONS } from './types.js';
4
+ const BUDGET = 5;
5
+ export async function reviewAsSpecialist(category, opts, diffText, changeContext) {
6
+ const { description, focus } = REVIEWER_DESCRIPTIONS[category];
7
+ const system = `You are a ${category} code reviewer.
8
+
9
+ ${description}
10
+ FOCUS: ${focus}
11
+
12
+ You do NOT have raw file access. To investigate, ask the Repository Explorer
13
+ precise questions via the ask_explorer tool. You have ${BUDGET} investigations.
14
+
15
+ LOOP: form hypothesis → ask precise question → review evidence → supported/rejected.
16
+ STOP when: confirmed, disproven, further exploration unlikely to change conclusion, or budget exhausted.
17
+
18
+ Output ONLY a JSON array of candidate findings:
19
+ [{"category":"${category}","hypothesis":"...","confidence":0.0-1.0,"impactScore":1-4,"likelihoodScore":1-4,"impactDescription":"...","recommendation":"...","invariant":"...","evidence":[{"fact":"...","source":"file:line"}],"location":{"file":"src/x.ts","line":42}}]
20
+ Use "evidence" only from Explorer answers.`;
21
+ const tools = [
22
+ {
23
+ name: 'ask_explorer',
24
+ description: 'Ask the Repository Explorer a precise question. Returns evidence facts.',
25
+ handler: async (a) => {
26
+ const q = String(a.question ?? a.q ?? '');
27
+ if (!q)
28
+ return { error: 'question required' };
29
+ const ans = await opts.askExplorer(q);
30
+ return {
31
+ question: ans.question,
32
+ facts: ans.facts,
33
+ confidence: ans.confidence,
34
+ missingEvidence: ans.missingEvidence,
35
+ };
36
+ },
37
+ },
38
+ ];
39
+ const result = await runAgentLoop({
40
+ modelId: opts.modelId,
41
+ systemPrompt: system,
42
+ userMessage: `## ${category.toUpperCase()} REVIEW\n## Diff\n\`\`\`diff\n${diffText.slice(0, 8000)}\n\`\`\`\n${changeContext ? `\n## Context\n${changeContext}` : ''}\n\nReview this change for ${category} issues. Ask the explorer for evidence. Output the JSON array when done.`,
43
+ tools,
44
+ maxIterations: 8,
45
+ maxToolCalls: BUDGET + 1,
46
+ maxSourceTokens: 10_000,
47
+ kvCacheId: opts.kvCacheId,
48
+ progress: (m) => opts.progress?.('[' + category + '] ' + m),
49
+ finalize: 'Output ONLY a JSON array (possibly empty) of candidate findings. No markdown.',
50
+ });
51
+ try {
52
+ const parsed = extractJson(result.text);
53
+ const arr = Array.isArray(parsed)
54
+ ? parsed
55
+ : Array.isArray(parsed.findings)
56
+ ? parsed.findings
57
+ : [];
58
+ return arr
59
+ .filter((f) => f && typeof f.hypothesis === 'string')
60
+ .map((f) => {
61
+ const c = {
62
+ category,
63
+ hypothesis: String(f.hypothesis),
64
+ confidence: clamp(f.confidence),
65
+ evidence: Array.isArray(f.evidence)
66
+ ? f.evidence.map((e) => ({
67
+ fact: String(e.fact ?? ''),
68
+ source: String(e.source ?? ''),
69
+ }))
70
+ : [],
71
+ };
72
+ const impactScore = clampScore(f.impactScore);
73
+ if (impactScore !== undefined)
74
+ c.impactScore = impactScore;
75
+ const likelihoodScore = clampScore(f.likelihoodScore);
76
+ if (likelihoodScore !== undefined)
77
+ c.likelihoodScore = likelihoodScore;
78
+ if (f.impactDescription)
79
+ c.impactDescription = String(f.impactDescription);
80
+ if (f.recommendation)
81
+ c.recommendation = String(f.recommendation);
82
+ if (f.invariant)
83
+ c.invariant = String(f.invariant);
84
+ const loc = buildLocation(f.location);
85
+ if (loc)
86
+ c.location = loc;
87
+ return c;
88
+ });
89
+ }
90
+ catch {
91
+ return [];
92
+ }
93
+ }
94
+ function clamp(n) {
95
+ const v = Number(n);
96
+ return Number.isFinite(v) ? Math.min(1, Math.max(0, v)) : 0.5;
97
+ }
98
+ function clampScore(n) {
99
+ const v = Number(n);
100
+ if (!Number.isFinite(v))
101
+ return undefined;
102
+ return Math.min(4, Math.max(1, Math.round(v)));
103
+ }
104
+ function buildLocation(loc) {
105
+ if (!loc || typeof loc !== 'object')
106
+ return undefined;
107
+ const o = loc;
108
+ const file = String(o.file ?? '');
109
+ if (!file)
110
+ return undefined;
111
+ const line = Number(o.line);
112
+ return { file, ...(Number.isFinite(line) && line > 0 ? { line } : {}) };
113
+ }
114
+ //# sourceMappingURL=specialist-reviewer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specialist-reviewer.js","sourceRoot":"","sources":["../../../../src/modules/ai-agent/review-pipeline/specialist-reviewer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAuB,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAUnD,MAAM,MAAM,GAAG,CAAC,CAAC;AAEjB,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,QAAwB,EACxB,IAAkB,EAClB,QAAgB,EAChB,aAAqB;IAErB,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAE/D,MAAM,MAAM,GAAG,aAAa,QAAQ;;EAEpC,WAAW;SACJ,KAAK;;;wDAG0C,MAAM;;;;;;gBAM9C,QAAQ;2CACmB,CAAC;IAE1C,MAAM,KAAK,GAAqB;QAC9B;YACE,IAAI,EAAE,cAAc;YACpB,WAAW,EAAE,yEAAyE;YACtF,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;gBACnB,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;gBAC1C,IAAI,CAAC,CAAC;oBAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC;gBAC9C,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;gBACtC,OAAO;oBACL,QAAQ,EAAE,GAAG,CAAC,QAAQ;oBACtB,KAAK,EAAE,GAAG,CA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E,CAAC"}
@@ -0,0 +1,53 @@
1
+ export type ReviewCategory = 'correctness' | 'security' | 'performance' | 'concurrency' | 'architecture' | 'maintainability';
2
+ export type Severity = 'info' | 'warning' | 'critical';
3
+ export interface Evidence {
4
+ fact: string;
5
+ source: string;
6
+ }
7
+ export interface ExplorerAnswer {
8
+ question: string;
9
+ facts: Evidence[];
10
+ confidence: number;
11
+ missingEvidence: boolean;
12
+ }
13
+ export interface ReviewerCandidate {
14
+ category: ReviewCategory;
15
+ hypothesis: string;
16
+ confidence: number;
17
+ impactScore?: 1 | 2 | 3 | 4;
18
+ likelihoodScore?: 1 | 2 | 3 | 4;
19
+ impactDescription?: string;
20
+ recommendation?: string;
21
+ invariant?: string;
22
+ evidence: Evidence[];
23
+ location?: {
24
+ file: string;
25
+ line?: number;
26
+ };
27
+ }
28
+ export interface VerifierVerdict {
29
+ verdict: 'confirmed' | 'disproven';
30
+ confidence: number;
31
+ supportingEvidence?: string[];
32
+ counterEvidence?: string[];
33
+ recommendation?: string;
34
+ invariant?: string;
35
+ }
36
+ export interface ChangeModel {
37
+ purpose: string;
38
+ changedComponents: string[];
39
+ behaviorsIntroduced: string[];
40
+ behaviorsModified: string[];
41
+ stateIntroduced: string[];
42
+ externalBoundaries: string[];
43
+ risks: string[];
44
+ investigationQuestions: string[];
45
+ reviewers: ReviewCategory[];
46
+ }
47
+ export declare const REVIEWER_DESCRIPTIONS: Record<ReviewCategory, {
48
+ description: string;
49
+ focus: string;
50
+ }>;
51
+ export declare function severityFromScore(impact: number, likelihood: number): Severity;
52
+ export declare function impactSeverityToLegacy(severity: Severity): 'critical' | 'warning' | 'suggestion';
53
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/modules/ai-agent/review-pipeline/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GACtB,aAAa,GACb,UAAU,GACV,aAAa,GACb,aAAa,GACb,cAAc,GACd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AAE,MAAM,EAAE,CAAC;IAC9B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,sBAAsB,EAAE,MAAM,EAAE,CAAC;IACjC,SAAS,EAAE,cAAc,EAAE,CAAC;CAC7B;AAED,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,cAAc,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAqC9F,CAAC;AAEJ,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,QAAQ,CAK9E;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,YAAY,CAShG"}
@@ -0,0 +1,45 @@
1
+ export const REVIEWER_DESCRIPTIONS = {
2
+ correctness: {
3
+ description: 'Detect correctness bugs: race conditions, null dereferences, stale state, incorrect edge-case handling, and logic errors.',
4
+ focus: 'Does this change behave correctly under edge cases, unusual inputs, or unexpected ordering?',
5
+ },
6
+ security: {
7
+ description: 'Detect security vulnerabilities: injection, broken authorization, missing validation, unsafe deserialization, and leaked secrets.',
8
+ focus: 'Can an attacker leverage this change to violate confidentiality, integrity, or availability?',
9
+ },
10
+ performance: {
11
+ description: 'Detect performance problems: quadratic loops, blocking work in hot paths, unbounded queues, and wasted computation.',
12
+ focus: 'Does this change introduce latency, memory growth, or throughput regressions under realistic load?',
13
+ },
14
+ concurrency: {
15
+ description: 'Detect concurrency bugs: shared-state races, missing synchronization, deadlock, and unsafe async ordering.',
16
+ focus: 'Can this change corrupt state when multiple requests, connections, or processes interleave?',
17
+ },
18
+ architecture: {
19
+ description: 'Detect architectural defects: layer violations, hidden coupling, missing abstractions, and design-level breakage.',
20
+ focus: 'Does this change respect the module boundaries and architecture, or does it introduce structural debt?',
21
+ },
22
+ maintainability: {
23
+ description: 'Detect maintainability issues: duplicated logic, dead branches, unclear naming, and untestable code.',
24
+ focus: 'Will maintainers be able to safely modify or extend this code later?',
25
+ },
26
+ };
27
+ export function severityFromScore(impact, likelihood) {
28
+ const score = impact * likelihood;
29
+ if (score >= 9)
30
+ return 'critical';
31
+ if (score >= 4)
32
+ return 'warning';
33
+ return 'info';
34
+ }
35
+ export function impactSeverityToLegacy(severity) {
36
+ switch (severity) {
37
+ case 'critical':
38
+ return 'critical';
39
+ case 'warning':
40
+ return 'warning';
41
+ case 'info':
42
+ return 'suggestion';
43
+ }
44
+ }
45
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/modules/ai-agent/review-pipeline/types.ts"],"names":[],"mappings":"AAwDA,MAAM,CAAC,MAAM,qBAAqB,GAChC;IACE,WAAW,EAAE;QACX,WAAW,EACT,2HAA2H;QAC7H,KAAK,EACH,6FAA6F;KAChG;IACD,QAAQ,EAAE;QACR,WAAW,EACT,mIAAmI;QACrI,KAAK,EACH,8FAA8F;KACjG;IACD,WAAW,EAAE;QACX,WAAW,EACT,qHAAqH;QACvH,KAAK,EACH,oGAAoG;KACvG;IACD,WAAW,EAAE;QACX,WAAW,EACT,4GAA4G;QAC9G,KAAK,EACH,6FAA6F;KAChG;IACD,YAAY,EAAE;QACZ,WAAW,EACT,mHAAmH;QACrH,KAAK,EACH,wGAAwG;KAC3G;IACD,eAAe,EAAE;QACf,WAAW,EACT,sGAAsG;QACxG,KAAK,EAAE,sEAAsE;KAC9E;CACF,CAAC;AAEJ,MAAM,UAAU,iBAAiB,CAAC,MAAc,EAAE,UAAkB;IAClE,MAAM,KAAK,GAAG,MAAM,GAAG,UAAU,CAAC;IAClC,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,UAAU,CAAC;IAClC,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IACjC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,QAAkB;IACvD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,UAAU;YACb,OAAO,UAAU,CAAC;QACpB,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,MAAM;YACT,OAAO,YAAY,CAAC;IACxB,CAAC;AACH,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { MainModule } from '../main.module.js';
2
+ import type { RuntimeTool, ToolContext } from './tool-types.js';
3
+ export declare function normalizeToolArguments(value: unknown): Record<string, unknown>;
4
+ export declare function serializeToolResult(result: unknown): string;
5
+ /**
6
+ * Validates that no duplicate tool names reach inference. Duplicate names
7
+ * cause silent, non-deterministic execution because the first match wins.
8
+ */
9
+ export declare function validateTools(tools: RuntimeTool[]): RuntimeTool[];
10
+ /**
11
+ * Resolves a model-emitted tool name (which may be an alias or hallucination)
12
+ * to the actual registered runtime tool name.
13
+ */
14
+ export declare function resolveToolName(name: string): string;
15
+ /**
16
+ * Centralizes tool execution. The LLM proposes an action; the runtime decides
17
+ * whether it is allowed to execute it.
18
+ *
19
+ * validate args → determine effect → build preview → ask confirmation if
20
+ * required → execute → record audit event
21
+ */
22
+ export declare class ToolExecutor {
23
+ private mainModule;
24
+ private tools;
25
+ constructor(tools: RuntimeTool[], mainModule: MainModule);
26
+ getTool(name: string): RuntimeTool | undefined;
27
+ hasTool(name: string): boolean;
28
+ get names(): string[];
29
+ /**
30
+ * Execute a single tool call. Mutation tools (effect !== 'read') that
31
+ * declare confirmation.required will be gated behind a structured
32
+ * confirmation request bound to the initiating socket.
33
+ */
34
+ execute(toolCall: any, context: ToolContext): Promise<unknown>;
35
+ private requestConfirmation;
36
+ }
37
+ //# sourceMappingURL=tool-executor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-executor.d.ts","sourceRoot":"","sources":["../../../src/modules/ai-agent/tool-executor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAA4B,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE1F,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgB9E;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAQ3D;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,WAAW,EAAE,CAWjE;AA6BD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;;GAMG;AACH,qBAAa,YAAY;IAKrB,OAAO,CAAC,UAAU;IAJpB,OAAO,CAAC,KAAK,CAAuC;gBAGlD,KAAK,EAAE,WAAW,EAAE,EACZ,UAAU,EAAE,UAAU;IAQhC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAM9C,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI9B,IAAI,KAAK,IAAI,MAAM,EAAE,CAEpB;IAED;;;;OAIG;IACG,OAAO,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;YAiEtD,mBAAmB;CAoDlC"}