@pensar/apex 2.7.0-canary.ac35c98e → 2.7.0-canary.b97c37de

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 (333) hide show
  1. package/README.md +21 -0
  2. package/build/{agent-zr55h1ct.js → agent-12rpyfq0.js} +7 -7
  3. package/build/{agent-pn562ztw.js → agent-h542r5ck.js} +6 -6
  4. package/build/agent-hng3b6td.js +14 -0
  5. package/build/agent-mqw7cepp.js +81 -0
  6. package/build/agent-mrvk3hhj.js +14 -0
  7. package/build/{agent-runs-4z2xjag4.js → agent-runs-mv346k72.js} +19 -19
  8. package/build/{apps-02wxxjp5.js → apps-hpqfrbra.js} +16 -16
  9. package/build/{auth-xgk3hsv7.js → auth-pg1vdh87.js} +16 -16
  10. package/build/blackboxAgent-qrw1jahh.js +14 -0
  11. package/build/{blackboxPentest-9fywsvsf.js → blackboxPentest-6jq62fxm.js} +12 -12
  12. package/build/{cli-0wsh8j2t.js → cli-00nmqwmq.js} +6 -6
  13. package/build/{cli-de3c55s8.js → cli-5javy3hh.js} +72 -21
  14. package/build/{cli-hw74c752.js → cli-a33pxtzn.js} +1887 -345
  15. package/build/{cli-zbzgsc9t.js → cli-b8r2pkgw.js} +42 -22
  16. package/build/{cli-4p1cc8s2.js → cli-bmg0b7b3.js} +1 -1
  17. package/build/{cli-z1g97d9q.js → cli-brhq6v81.js} +2 -2
  18. package/build/{cli-8bmtxm1y.js → cli-e2wraf40.js} +3 -3
  19. package/build/{cli-5y32wak1.js → cli-hzjbz23e.js} +1 -1
  20. package/build/{cli-kk069kb1.js → cli-k6asdvcm.js} +851 -219
  21. package/build/{cli-1atc8s3j.js → cli-nasa1mfr.js} +2 -2
  22. package/build/{cli-5k37vgyv.js → cli-ns1chzn0.js} +2 -2
  23. package/build/{cli-2eemgc6c.js → cli-nw8cqcjk.js} +5 -5
  24. package/build/{cli-tep61g51.js → cli-pwa01039.js} +3 -3
  25. package/build/{cli-6e6vzrn8.js → cli-pzpg8gb4.js} +68 -7
  26. package/build/{cli-d9z082ws.js → cli-ryegravt.js} +1 -1
  27. package/build/{cli-dkj2pt2g.js → cli-s587epth.js} +2 -2
  28. package/build/{cli-vveh2ad7.js → cli-v175dm5w.js} +1 -1
  29. package/build/{cli-87p4y3c4.js → cli-v2snvqzm.js} +1 -1
  30. package/build/{cli-97mchx07.js → cli-v5x18jwp.js} +144 -2
  31. package/build/{cli-zc41q8ck.js → cli-w4p21tz0.js} +1 -1
  32. package/build/{cli-4vxc62hh.js → cli-x9asejf1.js} +26 -1
  33. package/build/cli-xs69gx66.js +100 -0
  34. package/build/{cli-w933v060.js → cli-y1r2ft30.js} +1 -1
  35. package/build/cli.js +111 -40
  36. package/build/{config-89yv4f4n.js → config-807e4hvk.js} +1 -1
  37. package/build/{fastStrike-5t1rt338.js → fastStrike-eaqk315e.js} +6 -6
  38. package/build/{fixes-refgznx6.js → fixes-akpy3dmt.js} +16 -16
  39. package/build/{index-e49yt5sk.js → index-1qxgey71.js} +7 -7
  40. package/build/{index-fe7rqfac.js → index-afpype81.js} +2 -2
  41. package/build/{index-9c1k9thz.js → index-cns3r88k.js} +1 -1
  42. package/build/{index-49npcb2r.js → index-h2zaxzje.js} +11 -5
  43. package/build/{index-p04c5h1c.js → index-hn3ejm0t.js} +16 -16
  44. package/build/{index-mr9sf39a.js → index-pp1j2e43.js} +5 -5
  45. package/build/{index-mj1cmsmb.js → index-rq8c8xc2.js} +4 -4
  46. package/build/{index-408q8bam.js → index-thj8gd2h.js} +1223 -1140
  47. package/build/{index-y1v90gnm.js → index-vr2jnxwk.js} +1 -1
  48. package/build/{issues-p470ekt8.js → issues-mz3cdxhp.js} +16 -16
  49. package/build/{knowledge-57rchae0.js → knowledge-h4zv1shs.js} +16 -16
  50. package/build/{lance-1h7ssnnk.js → lance-ehcr2zm3.js} +7 -7
  51. package/build/lib/{chunk-kg6wpnpn.js → chunk-00vs23k0.js} +1 -1
  52. package/build/lib/{chunk-yv0k9xdz.js → chunk-0j8khhtg.js} +1 -1
  53. package/build/lib/{chunk-47jencdh.js → chunk-0zs0xw1t.js} +2 -2
  54. package/build/lib/{chunk-1mnrj4k0.js → chunk-1syspb4k.js} +13 -13
  55. package/build/lib/chunk-2fnyp7w4.js +107 -0
  56. package/build/lib/{chunk-4kfatk46.js → chunk-2gnf9h78.js} +645 -223
  57. package/build/lib/chunk-3jhaybr5.js +8 -0
  58. package/build/lib/{chunk-g2tpjcdh.js → chunk-4j487zgt.js} +6 -10
  59. package/build/lib/{chunk-p7dyzqvk.js → chunk-6rnt7z7x.js} +1 -1
  60. package/build/lib/{chunk-f2853917.js → chunk-ay993hmx.js} +1 -1
  61. package/build/lib/chunk-b6x8rhsy.js +100 -0
  62. package/build/lib/chunk-brcz9tw6.js +100 -0
  63. package/build/lib/{chunk-jswv4vrz.js → chunk-c1ycv02j.js} +1 -1
  64. package/build/lib/{chunk-xcev7z8s.js → chunk-c9x87hz0.js} +1 -1
  65. package/build/lib/{chunk-q5c1s9jn.js → chunk-d3xtxgnx.js} +4 -4
  66. package/build/lib/{chunk-gf6ssbd2.js → chunk-e9rn266j.js} +1 -1
  67. package/build/lib/{chunk-20n7hq4s.js → chunk-er3bs4r4.js} +990 -688
  68. package/build/lib/{chunk-2h63pdgv.js → chunk-fv8c1aw2.js} +21 -18
  69. package/build/lib/chunk-gq2d4891.js +258 -0
  70. package/build/lib/chunk-gzhqpsez.js +315 -0
  71. package/build/lib/{chunk-qkd6gywr.js → chunk-j4j2ay1g.js} +19 -18
  72. package/build/lib/{chunk-vwr9w3ab.js → chunk-m6cb9zce.js} +26 -0
  73. package/build/lib/{chunk-8558bjf3.js → chunk-nvbvrx8e.js} +94 -229
  74. package/build/lib/{chunk-vnrdhnjy.js → chunk-p3emq57b.js} +28 -4
  75. package/build/lib/chunk-pgm6zjes.js +154 -0
  76. package/build/lib/{chunk-tg4raham.js → chunk-q96stkb4.js} +164 -2
  77. package/build/lib/{chunk-3a37r69s.js → chunk-r2fxj6es.js} +39 -4
  78. package/build/lib/{chunk-7k99k0r9.js → chunk-s5h4xm4b.js} +1 -1
  79. package/build/lib/{chunk-9bpwhpjt.js → chunk-twa18fm5.js} +14 -11
  80. package/build/lib/{chunk-5pvwb7rd.js → chunk-vbcqwq8b.js} +34 -16
  81. package/build/lib/{chunk-vk8ex7nq.js → chunk-vwder9j8.js} +1 -1
  82. package/build/lib/{chunk-k4xe42rh.js → chunk-y0n7fx53.js} +111 -24
  83. package/build/lib/chunk-y2eqw6ha.js +1067 -0
  84. package/build/lib/{chunk-m46h0qz2.js → chunk-zr1sgbp3.js} +2 -2
  85. package/build/lib/core/agents/lance.d.ts +1 -1
  86. package/build/lib/core/agents/lanceBudget.d.ts +1 -1
  87. package/build/lib/core/agents/offSecAgent/index.js +23 -20
  88. package/build/lib/core/agents/offSecAgent/offensiveSecurityAgent.d.ts +6 -1
  89. package/build/lib/core/agents/offSecAgent/subagentSpawner.d.ts +8 -1
  90. package/build/lib/core/agents/offSecAgent/subagentSpawner.js +8 -8
  91. package/build/lib/core/agents/offSecAgent/toolLifecycle.d.ts +3 -0
  92. package/build/lib/core/agents/offSecAgent/tools/browserHeaderRouting.d.ts +1 -2
  93. package/build/lib/core/agents/offSecAgent/tools/cloneRepository.d.ts +30 -0
  94. package/build/lib/core/agents/offSecAgent/tools/createAttackSurfaceReport.d.ts +3 -2
  95. package/build/lib/core/agents/offSecAgent/tools/documentApp.d.ts +9 -0
  96. package/build/lib/core/agents/offSecAgent/tools/documentTopology.d.ts +263 -0
  97. package/build/lib/core/agents/offSecAgent/tools/httpRequest.d.ts +2 -2
  98. package/build/lib/core/agents/offSecAgent/tools/index.d.ts +39 -0
  99. package/build/lib/core/agents/offSecAgent/tools/index.js +41 -15
  100. package/build/lib/core/agents/offSecAgent/tools/listTasks.d.ts +1 -1
  101. package/build/lib/core/agents/offSecAgent/tools/spawnReconAgent.d.ts +36 -0
  102. package/build/lib/core/agents/offSecAgent/tools/toolOutput.d.ts +2 -1
  103. package/build/lib/core/agents/offSecAgent/tools/topologyDuplicates.d.ts +16 -0
  104. package/build/lib/core/agents/offSecAgent/tools/topologyMermaid.d.ts +37 -0
  105. package/build/lib/core/agents/offSecAgent/tools/topologyMermaid.js +6 -0
  106. package/build/lib/core/agents/offSecAgent/tools/topologyRecords.d.ts +91 -0
  107. package/build/lib/core/agents/offSecAgent/tools/topologyRecords.js +28 -0
  108. package/build/lib/core/agents/offSecAgent/tools/types.d.ts +2 -0
  109. package/build/lib/core/agents/offSecAgent/tools/updateTask.d.ts +1 -1
  110. package/build/lib/core/agents/offSecAgent/tools/whiteboxCandidates.d.ts +1 -1
  111. package/build/lib/core/agents/offSecAgent/types.d.ts +13 -4
  112. package/build/lib/core/agents/specialized/attackSurface/blackboxAgent.js +21 -18
  113. package/build/lib/core/agents/specialized/attackSurface/generalizedAgent.d.ts +68 -0
  114. package/build/lib/core/agents/specialized/attackSurface/generalizedAgent.js +40 -0
  115. package/build/lib/core/agents/specialized/attackSurface/generalizedPrompts.d.ts +10 -0
  116. package/build/lib/core/agents/specialized/attackSurface/reconToolset.d.ts +15 -0
  117. package/build/lib/core/agents/specialized/attackSurface/reconUpdate.d.ts +64 -0
  118. package/build/lib/core/agents/specialized/attackSurface/reconUpdate.js +19 -0
  119. package/build/lib/core/agents/specialized/attackSurface/schemas.js +15 -12
  120. package/build/lib/core/agents/specialized/authenticationAgent/index.js +22 -19
  121. package/build/lib/core/agents/specialized/authenticationAgent/types.d.ts +3 -3
  122. package/build/lib/core/agents/specialized/codeAgent/agent.js +21 -18
  123. package/build/lib/core/agents/specialized/environment/agent.d.ts +1 -1
  124. package/build/lib/core/agents/specialized/environment/types.d.ts +1 -1
  125. package/build/lib/core/agents/specialized/findingJudge/agent.js +14 -11
  126. package/build/lib/core/agents/specialized/findingJudge/index.js +5 -5
  127. package/build/lib/core/agents/specialized/patching/index.js +22 -19
  128. package/build/lib/core/agents/specialized/pentest/agent.js +21 -18
  129. package/build/lib/core/agents/specialized/reconWorker/agent.d.ts +23 -0
  130. package/build/lib/core/agents/specialized/reconWorker/agent.js +98 -0
  131. package/build/lib/core/agents/specialized/reconWorker/prompts.d.ts +2 -0
  132. package/build/lib/core/agents/specialized/siemTriage/agent.d.ts +6 -6
  133. package/build/lib/core/agents/specialized/whiteboxAttackSurface/index.js +21 -18
  134. package/build/lib/core/ai/ai.d.ts +39 -4
  135. package/build/lib/core/ai/ai.js +11 -5
  136. package/build/lib/core/ai/compactionPrompts.d.ts +6 -0
  137. package/build/lib/core/ai/contextManagement.d.ts +19 -4
  138. package/build/lib/core/ai/failedToolCallHistory.d.ts +9 -0
  139. package/build/lib/core/ai/incompleteModelStream.d.ts +4 -0
  140. package/build/lib/core/ai/index.d.ts +5 -2
  141. package/build/lib/core/ai/index.js +12 -4
  142. package/build/lib/core/ai/inference-attempt/envelope.d.ts +1 -1
  143. package/build/lib/core/ai/inference-attempt/recording.d.ts +1 -1
  144. package/build/lib/core/ai/modelStreamDrain.d.ts +3 -0
  145. package/build/lib/core/ai/models/index.d.ts +2 -1
  146. package/build/lib/core/ai/native-rollout-evidence/schema.d.ts +3 -3
  147. package/build/lib/core/ai/providers/ollama.d.ts +2 -0
  148. package/build/lib/core/ai/utils.d.ts +3 -0
  149. package/build/lib/core/ai/utils.js +4 -4
  150. package/build/lib/core/api/attackSurface.d.ts +9 -0
  151. package/build/lib/core/api/index.js +33 -28
  152. package/build/lib/core/api/targetedPentest.js +22 -19
  153. package/build/lib/core/atif/schema.d.ts +2 -2
  154. package/build/lib/core/cli/model.d.ts +2 -0
  155. package/build/lib/core/config/config.d.ts +5 -0
  156. package/build/lib/core/config/index.js +1 -1
  157. package/build/lib/core/eventBus.d.ts +43 -0
  158. package/build/lib/core/eventBus.js +1 -1
  159. package/build/lib/core/findings/registry.js +5 -5
  160. package/build/lib/core/ollama.d.ts +28 -0
  161. package/build/lib/core/runtime/localWorkerProtocol.d.ts +4 -4
  162. package/build/lib/core/runtime/runStore.d.ts +2 -2
  163. package/build/lib/core/session/index.d.ts +20 -8
  164. package/build/lib/core/session/index.js +4 -4
  165. package/build/lib/core/session/persistence.d.ts +1 -1
  166. package/build/lib/core/session/persistence.js +5 -5
  167. package/build/lib/core/tools/backends/index.js +3 -3
  168. package/build/lib/core/tools/backends/types.d.ts +30 -0
  169. package/build/lib/core/workflows/pentest.js +27 -24
  170. package/build/lib/core/workflows/seams.js +6 -6
  171. package/build/lib/core/workflows/whiteboxAttackSurface.d.ts +2 -0
  172. package/build/lib/core/workflows/whiteboxAttackSurface.js +23 -20
  173. package/build/lib/index.js +30 -25
  174. package/build/lib/util/url.d.ts +1 -0
  175. package/build/{logs-acava1xt.js → logs-srhdg5j8.js} +16 -16
  176. package/build/{native-rollout-evidence-px3z2kyj.js → native-rollout-evidence-eejrgmky.js} +3 -3
  177. package/build/{offesecAgent-20xn4fng.js → offesecAgent-mgy896re.js} +6 -6
  178. package/build/pentest-qz9cektb.js +23 -0
  179. package/build/{pentests-rg3r1fdq.js → pentests-7pq2ggf9.js} +16 -16
  180. package/build/recordedRunClient-8n1tfwrq.js +11 -0
  181. package/build/{subagentSpawner-qc4s7kpc.js → subagentSpawner-25yemark.js} +4 -4
  182. package/build/{targetedPentest-s2k2vyhr.js → targetedPentest-tbectqgj.js} +8 -8
  183. package/build/{targets-jkk6j9f3.js → targets-1mt4qyx9.js} +16 -16
  184. package/build/threatModel-ahcjqhn5.js +24 -0
  185. package/build/{uninstall-apwkes89.js → uninstall-53z5529h.js} +1 -1
  186. package/build/{upload-23x4njrj.js → upload-4b62gbd6.js} +4 -4
  187. package/build/{utils-cjpsykn0.js → utils-k912qjnv.js} +11 -3
  188. package/package.json +26 -1
  189. package/src/cli.ts +8 -0
  190. package/src/core/agents/offSecAgent/offensiveSecurityAgent.compaction.test.ts +257 -0
  191. package/src/core/agents/offSecAgent/offensiveSecurityAgent.ollama.test.ts +289 -0
  192. package/src/core/agents/offSecAgent/offensiveSecurityAgent.test.ts +34 -0
  193. package/src/core/agents/offSecAgent/offensiveSecurityAgent.toolApproval.test.ts +120 -0
  194. package/src/core/agents/offSecAgent/offensiveSecurityAgent.ts +97 -14
  195. package/src/core/agents/offSecAgent/recordedTools.test.ts +1 -0
  196. package/src/core/agents/offSecAgent/responseContext.test.ts +213 -0
  197. package/src/core/agents/offSecAgent/selectiveConstruction.test.ts +1 -0
  198. package/src/core/agents/offSecAgent/structuredResponse.test.ts +248 -0
  199. package/src/core/agents/offSecAgent/subagentSpawner.hooks.test.ts +20 -0
  200. package/src/core/agents/offSecAgent/subagentSpawner.reasoning.test.ts +8 -0
  201. package/src/core/agents/offSecAgent/subagentSpawner.test.ts +29 -0
  202. package/src/core/agents/offSecAgent/subagentSpawner.ts +50 -0
  203. package/src/core/agents/offSecAgent/toolExecutionContext.test.ts +178 -0
  204. package/src/core/agents/offSecAgent/toolExecutionContext.ts +52 -22
  205. package/src/core/agents/offSecAgent/toolLifecycle.test.ts +18 -0
  206. package/src/core/agents/offSecAgent/toolLifecycle.ts +5 -0
  207. package/src/core/agents/offSecAgent/tools/browserHeaderRouting.redirect.test.ts +51 -8
  208. package/src/core/agents/offSecAgent/tools/browserHeaderRouting.test.ts +53 -63
  209. package/src/core/agents/offSecAgent/tools/browserHeaderRouting.ts +23 -47
  210. package/src/core/agents/offSecAgent/tools/callbackListener.test.ts +10 -6
  211. package/src/core/agents/offSecAgent/tools/cloneRepository.test.ts +176 -0
  212. package/src/core/agents/offSecAgent/tools/cloneRepository.ts +108 -0
  213. package/src/core/agents/offSecAgent/tools/createAttackSurfaceReport.test.ts +95 -0
  214. package/src/core/agents/offSecAgent/tools/createAttackSurfaceReport.ts +12 -0
  215. package/src/core/agents/offSecAgent/tools/documentApp.ts +21 -0
  216. package/src/core/agents/offSecAgent/tools/documentTopology.test.ts +411 -0
  217. package/src/core/agents/offSecAgent/tools/documentTopology.ts +1510 -0
  218. package/src/core/agents/offSecAgent/tools/executeCommand.test.ts +1 -1
  219. package/src/core/agents/offSecAgent/tools/executeCommand.ts +2 -2
  220. package/src/core/agents/offSecAgent/tools/grep.ts +2 -2
  221. package/src/core/agents/offSecAgent/tools/index.ts +61 -0
  222. package/src/core/agents/offSecAgent/tools/playwrightMcp.test.ts +0 -2
  223. package/src/core/agents/offSecAgent/tools/playwrightMcp.ts +2 -4
  224. package/src/core/agents/offSecAgent/tools/sandboxPlaywright.test.ts +2 -3
  225. package/src/core/agents/offSecAgent/tools/sandboxPlaywright.ts +0 -1
  226. package/src/core/agents/offSecAgent/tools/selectiveFactories.test.ts +6 -6
  227. package/src/core/agents/offSecAgent/tools/spawnReconAgent.test.ts +95 -0
  228. package/src/core/agents/offSecAgent/tools/spawnReconAgent.ts +193 -0
  229. package/src/core/agents/offSecAgent/tools/toolOutput.test.ts +96 -9
  230. package/src/core/agents/offSecAgent/tools/toolOutput.ts +100 -14
  231. package/src/core/agents/offSecAgent/tools/toolOutput.writeFailure.test.ts +180 -0
  232. package/src/core/agents/offSecAgent/tools/topologyDuplicates.test.ts +500 -0
  233. package/src/core/agents/offSecAgent/tools/topologyDuplicates.ts +153 -0
  234. package/src/core/agents/offSecAgent/tools/topologyMermaid.test.ts +174 -0
  235. package/src/core/agents/offSecAgent/tools/topologyMermaid.ts +179 -0
  236. package/src/core/agents/offSecAgent/tools/topologyRecords.test.ts +569 -0
  237. package/src/core/agents/offSecAgent/tools/topologyRecords.ts +427 -0
  238. package/src/core/agents/offSecAgent/tools/topologyThreats.test.ts +286 -0
  239. package/src/core/agents/offSecAgent/tools/types.ts +2 -0
  240. package/src/core/agents/offSecAgent/types.ts +9 -4
  241. package/src/core/agents/specialized/attackSurface/blackboxAgent.test.ts +101 -2
  242. package/src/core/agents/specialized/attackSurface/blackboxAgent.ts +2 -2
  243. package/src/core/agents/specialized/attackSurface/generalizedAgent.continuation.test.ts +81 -0
  244. package/src/core/agents/specialized/attackSurface/generalizedAgent.ts +195 -0
  245. package/src/core/agents/specialized/attackSurface/generalizedPrompts.test.ts +42 -0
  246. package/src/core/agents/specialized/attackSurface/generalizedPrompts.ts +112 -0
  247. package/src/core/agents/specialized/attackSurface/reconToolset.test.ts +122 -0
  248. package/src/core/agents/specialized/attackSurface/reconToolset.ts +60 -0
  249. package/src/core/agents/specialized/attackSurface/reconUpdate.test.ts +297 -0
  250. package/src/core/agents/specialized/attackSurface/reconUpdate.ts +270 -0
  251. package/src/core/agents/specialized/reconWorker/agent.ts +61 -0
  252. package/src/core/agents/specialized/reconWorker/prompts.ts +28 -0
  253. package/src/core/agents/specialized/whiteboxAttackSurface/endpointDocumentationAgent.hooks.test.ts +11 -0
  254. package/src/core/ai/ai.approval-compaction.test.ts +902 -0
  255. package/src/core/ai/ai.effective-tools.test.ts +3 -1
  256. package/src/core/ai/ai.invalid-tool-name-history.test.ts +264 -0
  257. package/src/core/ai/ai.operator-context.bench.test.ts +11 -2
  258. package/src/core/ai/ai.recorded-attempts.test.ts +49 -0
  259. package/src/core/ai/ai.stream-recovery.test.ts +758 -0
  260. package/src/core/ai/ai.tool-approval.test.ts +159 -0
  261. package/src/core/ai/ai.tool-repair-drain.test.ts +362 -0
  262. package/src/core/ai/ai.tool-repair-reasoning.test.ts +231 -0
  263. package/src/core/ai/ai.ts +565 -264
  264. package/src/core/ai/caching.test.ts +43 -0
  265. package/src/core/ai/caching.ts +7 -0
  266. package/src/core/ai/compactionPrompts.ts +12 -0
  267. package/src/core/ai/compactionTelemetry.test.ts +49 -9
  268. package/src/core/ai/contextManagement.toolOutput.test.ts +340 -0
  269. package/src/core/ai/contextManagement.ts +115 -37
  270. package/src/core/ai/contextManagement.unicode.test.ts +157 -0
  271. package/src/core/ai/failedToolCallHistory.test.ts +226 -0
  272. package/src/core/ai/failedToolCallHistory.ts +101 -0
  273. package/src/core/ai/incompleteModelStream.ts +17 -0
  274. package/src/core/ai/index.ts +6 -0
  275. package/src/core/ai/inference-attempt/recording.ts +1 -0
  276. package/src/core/ai/modelStreamDrain.ts +6 -0
  277. package/src/core/ai/models/index.ts +10 -0
  278. package/src/core/ai/providers/anthropic-models.test.ts +4 -2
  279. package/src/core/ai/providers/anthropic.ts +2 -1
  280. package/src/core/ai/providers/bedrock-models.test.ts +212 -2
  281. package/src/core/ai/providers/ollama.test.ts +223 -0
  282. package/src/core/ai/providers/ollama.ts +21 -0
  283. package/src/core/ai/reasoning.ts +1 -0
  284. package/src/core/ai/utils.native-rollout-evidence.test.ts +1 -0
  285. package/src/core/ai/utils.ts +104 -16
  286. package/src/core/api/attackSurface.ts +26 -0
  287. package/src/core/cli/model.ts +6 -2
  288. package/src/core/config/config.test.ts +35 -0
  289. package/src/core/config/config.ts +6 -0
  290. package/src/core/eventBus.test.ts +63 -0
  291. package/src/core/eventBus.ts +69 -0
  292. package/src/core/ollama.test.ts +139 -0
  293. package/src/core/ollama.ts +184 -0
  294. package/src/core/providers/utils.ts +12 -1
  295. package/src/core/runtime/sqliteModelStore.ts +1 -0
  296. package/src/core/session/index.ts +16 -0
  297. package/src/core/session/persistence.ts +65 -4
  298. package/src/core/session/rehydrate.test.ts +238 -0
  299. package/src/core/tools/backends/local.test.ts +74 -1
  300. package/src/core/tools/backends/local.ts +43 -0
  301. package/src/core/tools/backends/types.ts +33 -0
  302. package/src/core/workflows/pentest.test.ts +93 -0
  303. package/src/core/workflows/pentest.ts +4 -2
  304. package/src/core/workflows/whiteboxAttackSurface.lifecycle.test.ts +269 -0
  305. package/src/core/workflows/whiteboxAttackSurface.test.ts +102 -0
  306. package/src/core/workflows/whiteboxAttackSurface.ts +37 -17
  307. package/src/tui/components/chat/__tests__/model-loading.tsx +110 -0
  308. package/src/tui/components/chat/loading-indicator.tsx +20 -6
  309. package/src/tui/components/chat/message-list.tsx +16 -10
  310. package/src/tui/components/chat/model-loading.test.ts +16 -0
  311. package/src/tui/components/model-picker/ModelPicker.tsx +1 -0
  312. package/src/tui/components/model-picker/__tests__/ollama-discovery.tsx +141 -0
  313. package/src/tui/components/model-picker/model-search.ts +1 -0
  314. package/src/tui/components/model-picker/ollama-discovery.test.ts +13 -0
  315. package/src/tui/components/operator-dashboard/index.tsx +11 -11
  316. package/src/tui/components/operator-dashboard/run-events.test.ts +55 -0
  317. package/src/tui/components/operator-dashboard/run-events.ts +12 -0
  318. package/src/tui/components/operator-dashboard/subagent-detail-view.tsx +1 -0
  319. package/src/tui/components/operator-dashboard/subagent-state.test.ts +15 -0
  320. package/src/tui/components/operator-dashboard/subagent-state.ts +14 -0
  321. package/src/tui/components/shared/index.ts +1 -0
  322. package/src/tui/components/shared/model-loading-icon.tsx +21 -0
  323. package/src/tui/context/agent.tsx +4 -1
  324. package/src/tui/context/config.tsx +21 -0
  325. package/src/tui/index.tsx +7 -1
  326. package/src/util/url.ts +6 -8
  327. package/build/agent-e9e061m1.js +0 -14
  328. package/build/agent-wepnyzrm.js +0 -14
  329. package/build/blackboxAgent-9xaahcbf.js +0 -14
  330. package/build/lib/chunk-ej30g42r.js +0 -112
  331. package/build/pentest-m3mfxvb7.js +0 -23
  332. package/build/recordedRunClient-fcmrnqvj.js +0 -11
  333. package/build/threatModel-q9gqd9hd.js +0 -24
package/README.md CHANGED
@@ -107,6 +107,27 @@ pensar targeted-pentest --target https://example.com --objective "Test authentic
107
107
  | `--threat-model <text\|@file>` | pentest | Threat model to guide testing |
108
108
  | `--objective <text>` | targeted-pentest | Testing objective (repeatable) |
109
109
 
110
+ ### Ollama (local models)
111
+
112
+ Start Ollama with a model installed, then open `/models` and select it under
113
+ **Ollama (local)**. Apex discovers models automatically at startup and refreshes
114
+ the list every five seconds, including when Ollama starts after Apex. No API key
115
+ or manual endpoint setup is needed. Running models appear first.
116
+
117
+ Discovery uses `http://127.0.0.1:11434` by default and honors `OLLAMA_HOST`.
118
+ Headless commands accept `--model-provider ollama --model <ollama-model-name>`
119
+ or `--model ollama:<ollama-model-name>`. Model names retain their full tags,
120
+ including Hugging Face paths. Existing manual local endpoints remain separate.
121
+
122
+ Apex loads the selected model on the first request if needed, showing **Loading
123
+ model weights** with a dedicated throbber. It then reads Ollama's allocated
124
+ context before fitting the prompt or deciding whether to compact the conversation.
125
+ Servers without context metadata use a conservative 4,096-token budget. Apex
126
+ does not download models or override Ollama's idle-unload settings; model lifetime
127
+ is managed by Ollama, independently of Apex sessions.
128
+ Agent workflows require a model and Ollama template that support tool calls;
129
+ discovery alone does not establish tool support.
130
+
110
131
  ### Hoonify inference
111
132
 
112
133
  Connect **Hoonify** in `/providers` or set `HOONIFY_API_KEY`, then select a
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  TargetedPentestAgent2,
3
3
  buildPentestSystemPrompt2
4
- } from "./cli-tep61g51.js";
5
- import"./cli-4p1cc8s2.js";
4
+ } from "./cli-pwa01039.js";
5
+ import"./cli-bmg0b7b3.js";
6
6
  import"./cli-qba2x69h.js";
7
- import"./cli-hw74c752.js";
8
- import"./cli-6e6vzrn8.js";
9
- import"./cli-kk069kb1.js";
10
- import"./cli-zc41q8ck.js";
7
+ import"./cli-a33pxtzn.js";
8
+ import"./cli-pzpg8gb4.js";
9
+ import"./cli-k6asdvcm.js";
10
+ import"./cli-w4p21tz0.js";
11
11
  import"./cli-c2k4xxaw.js";
12
- import"./cli-5y32wak1.js";
12
+ import"./cli-hzjbz23e.js";
13
13
  export {
14
14
  TargetedPentestAgent2 as TargetedPentestAgent,
15
15
  buildPentestSystemPrompt2 as buildPentestSystemPrompt
@@ -1,16 +1,16 @@
1
- import"./cli-6e6vzrn8.js";
2
- import"./cli-5y32wak1.js";
3
- import"./cli-zc41q8ck.js";
4
- import"./cli-hw74c752.js";
1
+ import"./cli-pzpg8gb4.js";
2
+ import"./cli-hzjbz23e.js";
3
+ import"./cli-w4p21tz0.js";
4
+ import"./cli-a33pxtzn.js";
5
5
  import {
6
6
  AgentRuntime,
7
7
  defineAgent
8
- } from "./cli-4p1cc8s2.js";
8
+ } from "./cli-bmg0b7b3.js";
9
9
  import"./cli-qba2x69h.js";
10
10
  import {
11
11
  stepCountIs2,
12
12
  init_dist
13
- } from "./cli-kk069kb1.js";
13
+ } from "./cli-k6asdvcm.js";
14
14
  import"./cli-c2k4xxaw.js";
15
15
  import {
16
16
  init_zod
@@ -0,0 +1,14 @@
1
+ import {
2
+ CodeAgent2
3
+ } from "./cli-brhq6v81.js";
4
+ import"./cli-bmg0b7b3.js";
5
+ import"./cli-qba2x69h.js";
6
+ import"./cli-a33pxtzn.js";
7
+ import"./cli-pzpg8gb4.js";
8
+ import"./cli-k6asdvcm.js";
9
+ import"./cli-w4p21tz0.js";
10
+ import"./cli-c2k4xxaw.js";
11
+ import"./cli-hzjbz23e.js";
12
+ export {
13
+ CodeAgent2 as CodeAgent
14
+ };
@@ -0,0 +1,81 @@
1
+ import"./cli-pzpg8gb4.js";
2
+ import"./cli-hzjbz23e.js";
3
+ import"./cli-w4p21tz0.js";
4
+ import {
5
+ RECON_WORKER_TOOLS
6
+ } from "./cli-a33pxtzn.js";
7
+ import {
8
+ buildCredentialsBlock
9
+ } from "./cli-xs69gx66.js";
10
+ import {
11
+ AgentRuntime,
12
+ defineAgent
13
+ } from "./cli-bmg0b7b3.js";
14
+ import"./cli-qba2x69h.js";
15
+ import {
16
+ stepCountIs2,
17
+ init_dist
18
+ } from "./cli-k6asdvcm.js";
19
+ import"./cli-c2k4xxaw.js";
20
+
21
+ // src/core/agents/specialized/reconWorker/agent.ts
22
+ init_dist();
23
+
24
+ // src/core/agents/specialized/reconWorker/prompts.ts
25
+ var RECON_WORKER_SYSTEM_PROMPT = `You are a reconnaissance worker sub-agent on an offensive-security team.
26
+
27
+ Your parent agent is mapping the system behind a set of origins as boundaries and components. You have been spawned to pursue ONE scoped goal and report what you find. You have the same primitives as your parent: browser automation, execute_command, http_request, the code tools (read_file, list_files, grep, glob), web_search/get_page, clone_repository (for connected repositories only), and the documentation tools (document_boundary, document_component, document_flow, document_control, document_threat, update_record).
28
+
29
+ Operating rules:
30
+ - Stay within your assigned goal and scope. Do not wander to unrelated hosts or objectives.
31
+ - Prefer evidence over assumption. Confirm a component exists, what it is, and whether it requires authentication before documenting it. Tag every piece of evidence observed, source, or inferred.
32
+ - When a component maps to a connected repository, clone it and read the source to raise fidelity.
33
+ - Use document_component for each component your goal surfaces, in a boundary the parent documented — including datastores and other components the origins do not expose — with what is at stake if it is compromised and what it trusts without verifying. To update a component the parent already documented, reuse its exact name. Document a new boundary only when your goal uncovers one.
34
+ - Use document_control for every control your goal touches — what it protects and, concretely, its gaps — attached to the boundaries and components it is enforced on.
35
+ - Use document_threat for the threats your goal surfaces on the components it covers: concrete scenarios that follow from the documented trust assumptions, control gaps, and flows — not generic categories. Make each testable: its exact entry point, the attack as ordered steps, and how a pentest confirms it.
36
+ - Be concise and factual in your final summary: what you found, how you confirmed it, and anything the parent should follow up on.`;
37
+ function buildReconWorkerPrompt(goal, target, codebasePath, credentials) {
38
+ const parts = [`# Goal
39
+
40
+ ${goal}`];
41
+ if (credentials)
42
+ parts.push(credentials.trim());
43
+ if (target)
44
+ parts.push(`## Target
45
+ - ${target}`);
46
+ if (codebasePath)
47
+ parts.push(`## Codebase
48
+ - ${codebasePath}`);
49
+ parts.push("Begin now. Pursue the goal, confirm your findings with evidence, document what you confirm, then report a concise summary.");
50
+ return parts.join(`
51
+
52
+ `);
53
+ }
54
+
55
+ // src/core/agents/specialized/reconWorker/agent.ts
56
+ function reconWorkerDefinition() {
57
+ return defineAgent({
58
+ name: "recon-worker",
59
+ role: "worker",
60
+ system: () => RECON_WORKER_SYSTEM_PROMPT,
61
+ activeTools: (opts) => {
62
+ if (!opts.excludeTools?.length)
63
+ return [...RECON_WORKER_TOOLS];
64
+ const excluded = new Set(opts.excludeTools);
65
+ return RECON_WORKER_TOOLS.filter((t) => !excluded.has(t));
66
+ },
67
+ resolveResult: async (_opts, _state, stream) => (await stream.text).trim(),
68
+ target: (opts) => opts.target,
69
+ stopWhen: (opts) => opts.stopWhen ?? stepCountIs2(1e4),
70
+ prompt: (opts) => buildReconWorkerPrompt(opts.goal, opts.target, opts.codebasePath, buildCredentialsBlock((opts.credentialManager ?? opts.session.credentialManager)?.formatForPrompt(), opts.session.config?.authenticationInstructions))
71
+ });
72
+ }
73
+
74
+ class ReconWorkerAgent extends AgentRuntime {
75
+ constructor(opts) {
76
+ super(reconWorkerDefinition(), opts);
77
+ }
78
+ }
79
+ export {
80
+ ReconWorkerAgent
81
+ };
@@ -0,0 +1,14 @@
1
+ import {
2
+ runAuthenticationAgent2
3
+ } from "./cli-nasa1mfr.js";
4
+ import"./cli-bmg0b7b3.js";
5
+ import"./cli-qba2x69h.js";
6
+ import"./cli-a33pxtzn.js";
7
+ import"./cli-pzpg8gb4.js";
8
+ import"./cli-k6asdvcm.js";
9
+ import"./cli-w4p21tz0.js";
10
+ import"./cli-c2k4xxaw.js";
11
+ import"./cli-hzjbz23e.js";
12
+ export {
13
+ runAuthenticationAgent2 as runAuthenticationAgent
14
+ };
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  config2,
3
3
  init_config
4
- } from "./cli-5y32wak1.js";
5
- import"./cli-zc41q8ck.js";
6
- import"./cli-hw74c752.js";
4
+ } from "./cli-hzjbz23e.js";
5
+ import"./cli-w4p21tz0.js";
6
+ import"./cli-a33pxtzn.js";
7
7
  import {
8
8
  AgentEventBus
9
- } from "./cli-6e6vzrn8.js";
9
+ } from "./cli-pzpg8gb4.js";
10
10
  import {
11
11
  inspectSessionEvidence2,
12
12
  RecordedRunSpecSchema,
@@ -17,27 +17,27 @@ import {
17
17
  runRecordedAgent2,
18
18
  RunRecoveryBlockedError2,
19
19
  resumeRecordedAgent2
20
- } from "./cli-de3c55s8.js";
21
- import"./cli-2eemgc6c.js";
22
- import"./cli-z1g97d9q.js";
23
- import"./cli-8bmtxm1y.js";
24
- import"./cli-zbzgsc9t.js";
25
- import"./cli-1atc8s3j.js";
26
- import"./cli-tep61g51.js";
27
- import"./cli-vveh2ad7.js";
28
- import"./cli-d9z082ws.js";
20
+ } from "./cli-5javy3hh.js";
21
+ import"./cli-nw8cqcjk.js";
22
+ import"./cli-brhq6v81.js";
23
+ import"./cli-e2wraf40.js";
24
+ import"./cli-b8r2pkgw.js";
25
+ import"./cli-nasa1mfr.js";
26
+ import"./cli-pwa01039.js";
27
+ import"./cli-v175dm5w.js";
28
+ import"./cli-ryegravt.js";
29
29
  import"./cli-ak23knae.js";
30
30
  import {
31
31
  resolveWorkerExecutable,
32
32
  launchLocalWorker
33
- } from "./cli-w933v060.js";
34
- import"./cli-dkj2pt2g.js";
35
- import"./cli-4p1cc8s2.js";
33
+ } from "./cli-y1r2ft30.js";
34
+ import"./cli-s587epth.js";
35
+ import"./cli-bmg0b7b3.js";
36
36
  import"./cli-qba2x69h.js";
37
37
  import {
38
38
  buildAuthConfig,
39
39
  init_ai2
40
- } from "./cli-kk069kb1.js";
40
+ } from "./cli-k6asdvcm.js";
41
41
  import"./cli-c2k4xxaw.js";
42
42
 
43
43
  // src/cli/agent-runs.ts
@@ -118,7 +118,7 @@ async function runAgentRunsCommand(args) {
118
118
  if (!isAbsolute(values.store)) {
119
119
  throw new Error("agent-runs worker requires --store <absolute database>");
120
120
  }
121
- const { serveLocalRunWorker } = await import("./index-p04c5h1c.js");
121
+ const { serveLocalRunWorker } = await import("./index-hn3ejm0t.js");
122
122
  await serveLocalRunWorker({
123
123
  runId: values.run,
124
124
  databasePath: resolve(values.store)
@@ -132,7 +132,7 @@ async function runAgentRunsCommand(args) {
132
132
  ${HELP}`);
133
133
  }
134
134
  if (command === "attach") {
135
- const { openRecordedRunClient } = await import("./recordedRunClient-fcmrnqvj.js");
135
+ const { openRecordedRunClient } = await import("./recordedRunClient-8n1tfwrq.js");
136
136
  const client = await openRecordedRunClient(values.store);
137
137
  const controller = new AbortController;
138
138
  const detach = () => controller.abort();
@@ -15,27 +15,27 @@ import {
15
15
  searchEndpoints2,
16
16
  listDomains2,
17
17
  createDomain2
18
- } from "./cli-hw74c752.js";
19
- import"./cli-6e6vzrn8.js";
20
- import"./cli-5y32wak1.js";
21
- import"./cli-zc41q8ck.js";
22
- import"./cli-de3c55s8.js";
23
- import"./cli-2eemgc6c.js";
24
- import"./cli-z1g97d9q.js";
25
- import"./cli-8bmtxm1y.js";
26
- import"./cli-zbzgsc9t.js";
27
- import"./cli-1atc8s3j.js";
28
- import"./cli-tep61g51.js";
29
- import"./cli-vveh2ad7.js";
30
- import"./cli-d9z082ws.js";
18
+ } from "./cli-a33pxtzn.js";
19
+ import"./cli-pzpg8gb4.js";
20
+ import"./cli-hzjbz23e.js";
21
+ import"./cli-w4p21tz0.js";
22
+ import"./cli-5javy3hh.js";
23
+ import"./cli-nw8cqcjk.js";
24
+ import"./cli-brhq6v81.js";
25
+ import"./cli-e2wraf40.js";
26
+ import"./cli-b8r2pkgw.js";
27
+ import"./cli-nasa1mfr.js";
28
+ import"./cli-pwa01039.js";
29
+ import"./cli-v175dm5w.js";
30
+ import"./cli-ryegravt.js";
31
31
  import"./cli-ak23knae.js";
32
32
  import {
33
33
  markCommandFailed
34
34
  } from "./cli-z82n3qk1.js";
35
- import"./cli-dkj2pt2g.js";
36
- import"./cli-4p1cc8s2.js";
35
+ import"./cli-s587epth.js";
36
+ import"./cli-bmg0b7b3.js";
37
37
  import"./cli-qba2x69h.js";
38
- import"./cli-kk069kb1.js";
38
+ import"./cli-k6asdvcm.js";
39
39
  import"./cli-c2k4xxaw.js";
40
40
 
41
41
  // src/cli/apps.ts
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env bun
2
- import"./cli-hw74c752.js";
3
- import"./cli-6e6vzrn8.js";
2
+ import"./cli-a33pxtzn.js";
3
+ import"./cli-pzpg8gb4.js";
4
4
  import {
5
5
  config2,
6
6
  init_config
7
- } from "./cli-5y32wak1.js";
7
+ } from "./cli-hzjbz23e.js";
8
8
  import {
9
9
  getPensarApiUrl2,
10
10
  getPensarConsoleUrl2,
@@ -20,24 +20,24 @@ import {
20
20
  createWorkspaceSelection2,
21
21
  pollWorkspaceSelection2,
22
22
  init_auth
23
- } from "./cli-zc41q8ck.js";
24
- import"./cli-de3c55s8.js";
25
- import"./cli-2eemgc6c.js";
26
- import"./cli-z1g97d9q.js";
27
- import"./cli-8bmtxm1y.js";
28
- import"./cli-zbzgsc9t.js";
29
- import"./cli-1atc8s3j.js";
30
- import"./cli-tep61g51.js";
31
- import"./cli-vveh2ad7.js";
32
- import"./cli-d9z082ws.js";
23
+ } from "./cli-w4p21tz0.js";
24
+ import"./cli-5javy3hh.js";
25
+ import"./cli-nw8cqcjk.js";
26
+ import"./cli-brhq6v81.js";
27
+ import"./cli-e2wraf40.js";
28
+ import"./cli-b8r2pkgw.js";
29
+ import"./cli-nasa1mfr.js";
30
+ import"./cli-pwa01039.js";
31
+ import"./cli-v175dm5w.js";
32
+ import"./cli-ryegravt.js";
33
33
  import"./cli-ak23knae.js";
34
34
  import {
35
35
  markCommandFailed
36
36
  } from "./cli-z82n3qk1.js";
37
- import"./cli-dkj2pt2g.js";
38
- import"./cli-4p1cc8s2.js";
37
+ import"./cli-s587epth.js";
38
+ import"./cli-bmg0b7b3.js";
39
39
  import"./cli-qba2x69h.js";
40
- import"./cli-kk069kb1.js";
40
+ import"./cli-k6asdvcm.js";
41
41
  import"./cli-c2k4xxaw.js";
42
42
  import {
43
43
  __require
@@ -0,0 +1,14 @@
1
+ import {
2
+ BlackboxAttackSurfaceAgent2
3
+ } from "./cli-nw8cqcjk.js";
4
+ import"./cli-bmg0b7b3.js";
5
+ import"./cli-qba2x69h.js";
6
+ import"./cli-a33pxtzn.js";
7
+ import"./cli-pzpg8gb4.js";
8
+ import"./cli-k6asdvcm.js";
9
+ import"./cli-w4p21tz0.js";
10
+ import"./cli-c2k4xxaw.js";
11
+ import"./cli-hzjbz23e.js";
12
+ export {
13
+ BlackboxAttackSurfaceAgent2 as BlackboxAttackSurfaceAgent
14
+ };
@@ -1,27 +1,27 @@
1
- import"./cli-5y32wak1.js";
2
- import"./cli-zc41q8ck.js";
3
- import"./cli-6e6vzrn8.js";
4
- import"./cli-hw74c752.js";
5
- import"./cli-2eemgc6c.js";
6
- import"./cli-tep61g51.js";
7
- import"./cli-vveh2ad7.js";
1
+ import"./cli-hzjbz23e.js";
2
+ import"./cli-w4p21tz0.js";
3
+ import"./cli-pzpg8gb4.js";
4
+ import"./cli-a33pxtzn.js";
5
+ import"./cli-nw8cqcjk.js";
6
+ import"./cli-pwa01039.js";
7
+ import"./cli-v175dm5w.js";
8
8
  import {
9
9
  readExecutionMetrics,
10
10
  writeExecutionMetrics,
11
11
  runPentestWorkflow2
12
- } from "./cli-zbzgsc9t.js";
13
- import"./cli-z1g97d9q.js";
14
- import"./cli-8bmtxm1y.js";
12
+ } from "./cli-b8r2pkgw.js";
13
+ import"./cli-brhq6v81.js";
14
+ import"./cli-e2wraf40.js";
15
15
  import {
16
16
  EMPTY_SESSION_TOKEN_USAGE,
17
17
  accumulateSessionTokens
18
18
  } from "./cli-ag6jtndp.js";
19
- import"./cli-4p1cc8s2.js";
19
+ import"./cli-bmg0b7b3.js";
20
20
  import"./cli-qba2x69h.js";
21
21
  import {
22
22
  normalizeStepUsage,
23
23
  init_ai2
24
- } from "./cli-kk069kb1.js";
24
+ } from "./cli-k6asdvcm.js";
25
25
  import"./cli-c2k4xxaw.js";
26
26
 
27
27
  // src/core/api/blackboxPentest.ts
@@ -1,14 +1,14 @@
1
1
  // src/util/url.ts
2
+ function withHttpScheme(target) {
3
+ const value = target.trim();
4
+ return /^https?:\/\//i.test(value) ? value : `https://${value}`;
5
+ }
2
6
  function parseTargetUrl(target) {
3
7
  if (!target?.trim()) {
4
8
  return null;
5
9
  }
6
- let urlString = target.trim();
7
- if (!urlString.match(/^https?:\/\//i)) {
8
- urlString = `https://${urlString}`;
9
- }
10
10
  try {
11
- const url = new URL(urlString);
11
+ const url = new URL(withHttpScheme(target));
12
12
  const hostname = url.hostname;
13
13
  let port;
14
14
  if (url.port) {
@@ -45,4 +45,4 @@ function getAutoPopulatedPorts(target, initialPorts = []) {
45
45
  return ports;
46
46
  }
47
47
 
48
- export { parseTargetUrl, getAutoPopulatedHosts, getAutoPopulatedPorts };
48
+ export { withHttpScheme, parseTargetUrl, getAutoPopulatedHosts, getAutoPopulatedPorts };
@@ -1,24 +1,33 @@
1
1
  import {
2
2
  config2,
3
3
  init_config
4
- } from "./cli-5y32wak1.js";
4
+ } from "./cli-hzjbz23e.js";
5
5
  import {
6
6
  init_constants
7
- } from "./cli-zc41q8ck.js";
7
+ } from "./cli-w4p21tz0.js";
8
8
  import {
9
+ GENERALIZED_ATTACK_SURFACE_TOOLS,
9
10
  buildSessionWorkspaceSection,
10
11
  buildBaseSystemPrompt,
11
12
  ASK_USER_QUESTIONS_TOOL_NAME,
12
13
  apiRequest,
13
14
  ALL_TOOL_NAMES2,
14
15
  SKILL_TOOL_NAMES2
15
- } from "./cli-hw74c752.js";
16
+ } from "./cli-a33pxtzn.js";
17
+ import {
18
+ loadAttackSurfaceResults
19
+ } from "./cli-nw8cqcjk.js";
16
20
  import {
17
21
  runOffensiveSecurityAgent2
18
- } from "./cli-dkj2pt2g.js";
22
+ } from "./cli-s587epth.js";
23
+ import {
24
+ GENERALIZED_ATTACK_SURFACE_SYSTEM_PROMPT,
25
+ buildCredentialsBlock,
26
+ buildGeneralizedAttackSurfacePrompt
27
+ } from "./cli-xs69gx66.js";
19
28
  import {
20
29
  defineAgent
21
- } from "./cli-4p1cc8s2.js";
30
+ } from "./cli-bmg0b7b3.js";
22
31
  import {
23
32
  toolModelMessageSchema,
24
33
  modelMessageSchema,
@@ -41,7 +50,7 @@ import {
41
50
  getModelInfo,
42
51
  buildAuthConfig,
43
52
  init_ai2
44
- } from "./cli-kk069kb1.js";
53
+ } from "./cli-k6asdvcm.js";
45
54
  import {
46
55
  newSessionId,
47
56
  isSessionId,
@@ -56,7 +65,7 @@ import {
56
65
  import {
57
66
  getCurrentVersion,
58
67
  init_installation
59
- } from "./cli-4vxc62hh.js";
68
+ } from "./cli-x9asejf1.js";
60
69
  import {
61
70
  init_zod
62
71
  } from "./cli-3qznjsnr.js";
@@ -7770,6 +7779,7 @@ var RetryDecisionSchema = object({
7770
7779
  authority: _enum([
7771
7780
  "stream-rate-limit",
7772
7781
  "stream-idle",
7782
+ "stream-incomplete",
7773
7783
  "object-rate-limit",
7774
7784
  "context-restart"
7775
7785
  ]),
@@ -8882,10 +8892,51 @@ async function openSqliteRunStore(filename = resolveRunDatabasePath()) {
8882
8892
  throw error;
8883
8893
  }
8884
8894
  }
8885
- // src/core/agents/specialized/benchmarkComparisonAgent.ts
8895
+ // src/core/agents/specialized/attackSurface/generalizedAgent.ts
8886
8896
  init_dist();
8887
- import { existsSync, readdirSync, readFileSync } from "node:fs";
8897
+ import { existsSync, mkdirSync } from "node:fs";
8888
8898
  import { join as join3 } from "node:path";
8899
+ var generalizedAttackSurfaceDefinition = defineAgent({
8900
+ name: "generalized-attack-surface",
8901
+ role: "orchestrator",
8902
+ createState: (opts) => {
8903
+ const subagentFolder = join3(opts.session.rootPath, "subagents", "generalized-attack-surface");
8904
+ if (!existsSync(subagentFolder)) {
8905
+ mkdirSync(subagentFolder, { recursive: true });
8906
+ }
8907
+ return { target: opts.target, subagentFolder };
8908
+ },
8909
+ system: () => GENERALIZED_ATTACK_SURFACE_SYSTEM_PROMPT,
8910
+ activeTools: (opts) => {
8911
+ if (!opts.excludeTools?.length)
8912
+ return [...GENERALIZED_ATTACK_SURFACE_TOOLS];
8913
+ const excluded = new Set(opts.excludeTools);
8914
+ return GENERALIZED_ATTACK_SURFACE_TOOLS.filter((t) => !excluded.has(t));
8915
+ },
8916
+ stopWhen: () => [
8917
+ hasToolCall("create_attack_surface_report"),
8918
+ stepCountIs2(1e4)
8919
+ ],
8920
+ target: (_opts, state) => state.target,
8921
+ prompt: (opts, state) => buildGeneralizedAttackSurfacePrompt([...new Set([state.target, ...opts.session.targets])], opts.session.config?.connectedRepositories ?? [], opts.session.config?.prompt, opts.continuation, opts.updateBrief, buildCredentialsBlock((opts.credentialManager ?? opts.session.credentialManager)?.formatForPrompt(), opts.session.config?.authenticationInstructions)),
8922
+ resolveResult: (opts) => {
8923
+ const resultsPath = join3(opts.session.rootPath, "attack-surface-results.json");
8924
+ const assetsPath = join3(opts.session.rootPath, "assets");
8925
+ let results = null;
8926
+ let targets = [];
8927
+ if (existsSync(resultsPath)) {
8928
+ try {
8929
+ results = loadAttackSurfaceResults(resultsPath);
8930
+ targets = results.targets || [];
8931
+ } catch {}
8932
+ }
8933
+ return { results, targets, resultsPath, assetsPath };
8934
+ }
8935
+ });
8936
+ // src/core/agents/specialized/benchmarkComparisonAgent.ts
8937
+ init_dist();
8938
+ import { existsSync as existsSync2, readdirSync, readFileSync } from "node:fs";
8939
+ import { join as join4 } from "node:path";
8889
8940
  var benchmarkComparisonDefinition = defineAgent({
8890
8941
  name: "benchmark-comparison",
8891
8942
  role: "analyst",
@@ -8897,9 +8948,9 @@ var benchmarkComparisonDefinition = defineAgent({
8897
8948
  ],
8898
8949
  prompt: (opts) => buildComparisonPrompt(loadExpectedResults(opts.repoPath), loadActualFindings(opts.session.rootPath)),
8899
8950
  resolveResult: (opts) => {
8900
- const resultsPath = join3(opts.session.rootPath, "comparison-results.json");
8951
+ const resultsPath = join4(opts.session.rootPath, "comparison-results.json");
8901
8952
  let comparison = null;
8902
- if (existsSync(resultsPath)) {
8953
+ if (existsSync2(resultsPath)) {
8903
8954
  try {
8904
8955
  comparison = JSON.parse(readFileSync(resultsPath, "utf-8"));
8905
8956
  } catch {}
@@ -8954,13 +9005,13 @@ ${actualFindings || "No actual findings found."}
8954
9005
  Analyze the findings above and call provide_comparison_results with your assessment.`;
8955
9006
  }
8956
9007
  function loadExpectedResults(repoPath) {
8957
- const expectedDir = join3(repoPath, "expected_results");
8958
- if (!existsSync(expectedDir))
9008
+ const expectedDir = join4(repoPath, "expected_results");
9009
+ if (!existsSync2(expectedDir))
8959
9010
  return [];
8960
9011
  const results = [];
8961
9012
  for (const f of readdirSync(expectedDir).filter((f) => f.endsWith(".json"))) {
8962
9013
  try {
8963
- const parsed = JSON.parse(readFileSync(join3(expectedDir, f), "utf-8"));
9014
+ const parsed = JSON.parse(readFileSync(join4(expectedDir, f), "utf-8"));
8964
9015
  if (parsed?.vulnerabilities && Array.isArray(parsed.vulnerabilities)) {
8965
9016
  for (const vuln of parsed.vulnerabilities) {
8966
9017
  results.push({
@@ -8978,12 +9029,12 @@ function loadExpectedResults(repoPath) {
8978
9029
  return results;
8979
9030
  }
8980
9031
  function loadActualFindings(sessionPath) {
8981
- const findingsDir = join3(sessionPath, "findings");
8982
- if (!existsSync(findingsDir))
9032
+ const findingsDir = join4(sessionPath, "findings");
9033
+ if (!existsSync2(findingsDir))
8983
9034
  return "No findings directory found.";
8984
9035
  const findings = readdirSync(findingsDir).filter((f) => f.endsWith(".json")).map((f) => {
8985
9036
  try {
8986
- const finding = JSON.parse(readFileSync(join3(findingsDir, f), "utf-8"));
9037
+ const finding = JSON.parse(readFileSync(join4(findingsDir, f), "utf-8"));
8987
9038
  return `### ${finding.title}
8988
9039
  - **Severity:** ${finding.severity}
8989
9040
  - **Endpoint:** ${finding.endpoint || "N/A"}
@@ -10539,7 +10590,7 @@ function createRunInferenceRecorder(options) {
10539
10590
  }
10540
10591
 
10541
10592
  // src/core/runtime/runRecoveryContext.ts
10542
- import { join as join4 } from "node:path";
10593
+ import { join as join5 } from "node:path";
10543
10594
  import { isDeepStrictEqual as isDeepStrictEqual6 } from "node:util";
10544
10595
  var TASK_TOOL_NAMES = new Set(["create_task", "update_task", "list_tasks"]);
10545
10596
  function blocker(message) {
@@ -10583,7 +10634,7 @@ function requireSessionConsistency(record, session) {
10583
10634
  ["logsPath", "logs"],
10584
10635
  ["pocsPath", "pocs"]
10585
10636
  ]) {
10586
- if (session[field] !== join4(session.rootPath, leaf)) {
10637
+ if (session[field] !== join5(session.rootPath, leaf)) {
10587
10638
  throw blocker(`session ${field} ${session[field]} is not the standard ${leaf}/ location under the session root`);
10588
10639
  }
10589
10640
  }
@@ -11454,7 +11505,7 @@ async function serveLocalRunWorker2(input) {
11454
11505
  }
11455
11506
  // src/core/agents/specialized/patching/agent.ts
11456
11507
  import { readFileSync as readFileSync2 } from "node:fs";
11457
- import { join as join5 } from "node:path";
11508
+ import { join as join6 } from "node:path";
11458
11509
 
11459
11510
  // src/core/agents/specialized/patching/prompts.ts
11460
11511
  var PREAMBLE2 = `You are an expert security vulnerability patching agent — an autonomous coding agent specialized in fixing security issues. Your goal is to analyze security vulnerabilities, apply high-quality fixes, verify they don't break existing functionality, and return structured PR metadata.`;
@@ -11731,7 +11782,7 @@ var PATCHING_ACTIVE_TOOLS = [
11731
11782
  function readAgentsMd(cwd) {
11732
11783
  for (const name of AGENTS_MD_FILENAMES) {
11733
11784
  try {
11734
- const content = readFileSync2(join5(cwd, name), "utf-8");
11785
+ const content = readFileSync2(join6(cwd, name), "utf-8");
11735
11786
  if (content.length > MAX_AGENTS_MD_SIZE) {
11736
11787
  return `${content.slice(0, MAX_AGENTS_MD_SIZE)}
11737
11788