@pensar/apex 2.7.0-canary.f6cdf7be → 2.7.0-canary.f7d630b6

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 (423) hide show
  1. package/README.md +37 -0
  2. package/build/{agent-rjyfyw0g.js → agent-25gwz2r5.js} +17 -9
  3. package/build/agent-2mbcdfnr.js +81 -0
  4. package/build/agent-8rym304q.js +14 -0
  5. package/build/agent-h4q2qbrd.js +14 -0
  6. package/build/{agent-3nyddsj2.js → agent-q1pp19sj.js} +7 -7
  7. package/build/{agent-runs-dhvj9n11.js → agent-runs-nkh6k5re.js} +19 -19
  8. package/build/{apps-xb4dwm8m.js → apps-9hhberd3.js} +16 -16
  9. package/build/{auth-3herxns4.js → auth-7h04pwxq.js} +16 -16
  10. package/build/blackboxAgent-9k41bnmd.js +14 -0
  11. package/build/{blackboxPentest-n73frjae.js → blackboxPentest-rw3t2jmx.js} +12 -12
  12. package/build/{cli-0wsh8j2t.js → cli-00nmqwmq.js} +6 -6
  13. package/build/{cli-h2r33z2v.js → cli-1sejsyt5.js} +42 -22
  14. package/build/{cli-nrz17r1p.js → cli-27sjhcnt.js} +2395 -436
  15. package/build/cli-2httdr6q.js +29 -0
  16. package/build/{cli-ebx3j3c5.js → cli-4pmek04p.js} +5 -5
  17. package/build/{cli-5nsn1vpx.js → cli-55jke7bk.js} +2 -2
  18. package/build/{cli-15df7cy4.js → cli-69vcn7a7.js} +70 -7
  19. package/build/{cli-1k414c58.js → cli-6b3fnw71.js} +1 -1
  20. package/build/{cli-f7v0fgc0.js → cli-76pqdrw5.js} +1 -1
  21. package/build/{cli-16jm0s8q.js → cli-9b3x3trx.js} +2 -2
  22. package/build/{cli-sy52tg90.js → cli-bjvcjes3.js} +78 -47
  23. package/build/{cli-67bcwpc2.js → cli-bk4x36vj.js} +1 -1
  24. package/build/{cli-d13d67ym.js → cli-bq2n4nd8.js} +2 -2
  25. package/build/{cli-xc4jc5g8.js → cli-bvwhhm6a.js} +1 -1
  26. package/build/{cli-0xvrtsac.js → cli-e1mks1dc.js} +155 -6
  27. package/build/{cli-cwmkbq45.js → cli-enqe6bcb.js} +23 -11
  28. package/build/{cli-jqf27aw9.js → cli-fw0r700s.js} +287 -24
  29. package/build/{cli-2r2agtre.js → cli-grkzfmsc.js} +2 -2
  30. package/build/{cli-730f1622.js → cli-hdtc520e.js} +1 -1
  31. package/build/{cli-3ne35gxp.js → cli-jrscs7aw.js} +1276 -227
  32. package/build/{cli-veyqzxra.js → cli-md8azc7a.js} +3 -3
  33. package/build/{cli-q9rsfw2a.js → cli-q6h43c9v.js} +2 -1
  34. package/build/{cli-rsdhzyxc.js → cli-vgbrtb0q.js} +1 -1
  35. package/build/cli-xs69gx66.js +100 -0
  36. package/build/cli.js +169 -91
  37. package/build/{config-csq1zxtv.js → config-regttqtz.js} +4 -4
  38. package/build/{fastStrike-d6ekb4qh.js → fastStrike-h6xdrh4n.js} +16 -9
  39. package/build/{fixes-3msn9pqm.js → fixes-sebrwnn8.js} +16 -16
  40. package/build/{index-mgq7hqhw.js → index-3z3y73bw.js} +5 -4
  41. package/build/{index-0hz1wzxq.js → index-44ezhe0c.js} +23 -8
  42. package/build/{index-xkdgbesy.js → index-7rv94pxs.js} +1340 -1139
  43. package/build/{index-j0wkw2yh.js → index-edyd3y71.js} +2 -2
  44. package/build/{index-kgssmyk2.js → index-kq7qxs2y.js} +1 -1
  45. package/build/{index-s12ksdnj.js → index-qf5dsf99.js} +1 -1
  46. package/build/{index-82q74kah.js → index-sk0w7023.js} +5 -5
  47. package/build/{index-f1a9x9ez.js → index-tnzz7fxt.js} +7 -7
  48. package/build/{index-th12cq1c.js → index-z2jt4tgv.js} +20 -16
  49. package/build/{issues-sx841383.js → issues-kyb5711j.js} +51 -24
  50. package/build/{knowledge-sqe5z2ar.js → knowledge-kaht3gx0.js} +16 -16
  51. package/build/{lance-43s36cr7.js → lance-272zk3sq.js} +7 -7
  52. package/build/lance-budget-ezkt15v5.js +52 -0
  53. package/build/lib/{chunk-86sya3w8.js → chunk-15pck5s4.js} +1330 -733
  54. package/build/lib/chunk-2fnyp7w4.js +107 -0
  55. package/build/lib/{chunk-tparpmzd.js → chunk-2n3kx849.js} +25 -14
  56. package/build/lib/{chunk-gn18j4fc.js → chunk-2nk6w459.js} +2 -2
  57. package/build/lib/{chunk-036v016g.js → chunk-3821y34j.js} +232 -49
  58. package/build/lib/{chunk-xebz8z2r.js → chunk-38rext6w.js} +2 -2
  59. package/build/lib/{chunk-3vvhjf9b.js → chunk-3dbq462d.js} +41 -4
  60. package/build/lib/chunk-3jhaybr5.js +8 -0
  61. package/build/lib/{chunk-w3c69y0y.js → chunk-46198c8f.js} +1 -1
  62. package/build/lib/chunk-7734wct9.js +100 -0
  63. package/build/lib/{chunk-q065dv8y.js → chunk-aks10fcy.js} +2 -1
  64. package/build/lib/{chunk-bakpxqpv.js → chunk-aphe9h5t.js} +1 -1
  65. package/build/lib/chunk-brcz9tw6.js +100 -0
  66. package/build/lib/{chunk-sbq4e99t.js → chunk-cp7vwv40.js} +2 -1
  67. package/build/lib/{chunk-vcwyb6ba.js → chunk-dvfastyn.js} +34 -16
  68. package/build/lib/chunk-esd67mhc.js +315 -0
  69. package/build/lib/{chunk-4m0zmj0b.js → chunk-f4z70mmf.js} +166 -43
  70. package/build/lib/chunk-gq2d4891.js +258 -0
  71. package/build/lib/chunk-h0rr779d.js +18 -0
  72. package/build/lib/{chunk-tqs67gqe.js → chunk-ht9c77k6.js} +13 -13
  73. package/build/lib/{chunk-9psbcps6.js → chunk-j3vadvd8.js} +1 -1
  74. package/build/lib/{chunk-vwr9w3ab.js → chunk-m6cb9zce.js} +26 -0
  75. package/build/lib/{chunk-88y6svhr.js → chunk-m8nxmvbt.js} +1 -1
  76. package/build/lib/{chunk-kh2p8hzh.js → chunk-mb9j4kwd.js} +24 -12
  77. package/build/lib/chunk-pgm6zjes.js +154 -0
  78. package/build/lib/{chunk-6nbh1eg1.js → chunk-pkftqdmx.js} +1 -1
  79. package/build/lib/{chunk-f0r8pb9d.js → chunk-rpyx8xkf.js} +1 -1
  80. package/build/lib/{chunk-sfcgtqfg.js → chunk-rtzgs3gx.js} +1 -1
  81. package/build/lib/{chunk-f2esp324.js → chunk-th4vs9mm.js} +1061 -226
  82. package/build/lib/{chunk-2zym7z9d.js → chunk-wnfcqxeb.js} +365 -148
  83. package/build/lib/{chunk-e0nhccd7.js → chunk-xzdky6sk.js} +234 -282
  84. package/build/lib/chunk-y2eqw6ha.js +1067 -0
  85. package/build/lib/{chunk-05qvh0kp.js → chunk-yeh3hr5k.js} +6 -10
  86. package/build/lib/{chunk-dn4zp4dr.js → chunk-yejp5mrj.js} +28 -4
  87. package/build/lib/{chunk-g20qjtah.js → chunk-zs4tcxt1.js} +20 -17
  88. package/build/lib/core/agents/agentRuntime.d.ts +2 -1
  89. package/build/lib/core/agents/lance.d.ts +19 -9
  90. package/build/lib/core/agents/lanceBudget.d.ts +11 -0
  91. package/build/lib/core/agents/offSecAgent/index.js +22 -19
  92. package/build/lib/core/agents/offSecAgent/offensiveSecurityAgent.d.ts +6 -1
  93. package/build/lib/core/agents/offSecAgent/subagentSpawner.d.ts +11 -2
  94. package/build/lib/core/agents/offSecAgent/subagentSpawner.js +7 -7
  95. package/build/lib/core/agents/offSecAgent/toolLifecycle.d.ts +3 -0
  96. package/build/lib/core/agents/offSecAgent/tools/browserHeaderRouting.d.ts +1 -1
  97. package/build/lib/core/agents/offSecAgent/tools/callbackHits.d.ts +34 -0
  98. package/build/lib/core/agents/offSecAgent/tools/cloneRepository.d.ts +30 -0
  99. package/build/lib/core/agents/offSecAgent/tools/createAttackSurfaceReport.d.ts +3 -2
  100. package/build/lib/core/agents/offSecAgent/tools/documentApp.d.ts +9 -0
  101. package/build/lib/core/agents/offSecAgent/tools/documentFinding.d.ts +22 -3
  102. package/build/lib/core/agents/offSecAgent/tools/documentTopology.d.ts +263 -0
  103. package/build/lib/core/agents/offSecAgent/tools/httpPoc.d.ts +30 -0
  104. package/build/lib/core/agents/offSecAgent/tools/httpRequest.d.ts +2 -2
  105. package/build/lib/core/agents/offSecAgent/tools/index.d.ts +48 -0
  106. package/build/lib/core/agents/offSecAgent/tools/index.js +41 -13
  107. package/build/lib/core/agents/offSecAgent/tools/listTasks.d.ts +1 -1
  108. package/build/lib/core/agents/offSecAgent/tools/scopeGuard.d.ts +6 -0
  109. package/build/lib/core/agents/offSecAgent/tools/spawnReconAgent.d.ts +36 -0
  110. package/build/lib/core/agents/offSecAgent/tools/toolOutput.d.ts +2 -1
  111. package/build/lib/core/agents/offSecAgent/tools/topologyDuplicates.d.ts +16 -0
  112. package/build/lib/core/agents/offSecAgent/tools/topologyMermaid.d.ts +37 -0
  113. package/build/lib/core/agents/offSecAgent/tools/topologyMermaid.js +6 -0
  114. package/build/lib/core/agents/offSecAgent/tools/topologyRecords.d.ts +91 -0
  115. package/build/lib/core/agents/offSecAgent/tools/topologyRecords.js +28 -0
  116. package/build/lib/core/agents/offSecAgent/tools/types.d.ts +5 -1
  117. package/build/lib/core/agents/offSecAgent/tools/updateTask.d.ts +1 -1
  118. package/build/lib/core/agents/offSecAgent/tools/webSearch.d.ts +1 -1
  119. package/build/lib/core/agents/offSecAgent/tools/whiteboxCandidates.d.ts +1 -1
  120. package/build/lib/core/agents/offSecAgent/types.d.ts +18 -5
  121. package/build/lib/core/agents/specialized/attackSurface/blackboxAgent.js +20 -17
  122. package/build/lib/core/agents/specialized/attackSurface/generalizedAgent.d.ts +68 -0
  123. package/build/lib/core/agents/specialized/attackSurface/generalizedAgent.js +40 -0
  124. package/build/lib/core/agents/specialized/attackSurface/generalizedPrompts.d.ts +10 -0
  125. package/build/lib/core/agents/specialized/attackSurface/reconToolset.d.ts +15 -0
  126. package/build/lib/core/agents/specialized/attackSurface/reconUpdate.d.ts +64 -0
  127. package/build/lib/core/agents/specialized/attackSurface/reconUpdate.js +19 -0
  128. package/build/lib/core/agents/specialized/attackSurface/schemas.js +15 -12
  129. package/build/lib/core/agents/specialized/authenticationAgent/index.js +21 -18
  130. package/build/lib/core/agents/specialized/authenticationAgent/types.d.ts +3 -3
  131. package/build/lib/core/agents/specialized/codeAgent/agent.js +20 -17
  132. package/build/lib/core/agents/specialized/environment/agent.d.ts +1 -1
  133. package/build/lib/core/agents/specialized/environment/types.d.ts +1 -1
  134. package/build/lib/core/agents/specialized/findingJudge/agent.js +25 -14
  135. package/build/lib/core/agents/specialized/findingJudge/index.d.ts +1 -1
  136. package/build/lib/core/agents/specialized/findingJudge/index.js +4 -4
  137. package/build/lib/core/agents/specialized/findingJudge/prompts.d.ts +2 -1
  138. package/build/lib/core/agents/specialized/patching/index.js +21 -18
  139. package/build/lib/core/agents/specialized/pentest/agent.d.ts +4 -2
  140. package/build/lib/core/agents/specialized/pentest/agent.js +20 -17
  141. package/build/lib/core/agents/specialized/reconWorker/agent.d.ts +23 -0
  142. package/build/lib/core/agents/specialized/reconWorker/agent.js +98 -0
  143. package/build/lib/core/agents/specialized/reconWorker/prompts.d.ts +2 -0
  144. package/build/lib/core/agents/specialized/siemTriage/agent.d.ts +225 -0
  145. package/build/lib/core/agents/specialized/siemTriage/aws.d.ts +22 -0
  146. package/build/lib/core/agents/specialized/siemTriage/aws.js +6 -0
  147. package/build/lib/core/agents/specialized/vulnerabilityReproduction/agent.d.ts +3 -3
  148. package/build/lib/core/agents/specialized/whiteboxAttackSurface/index.js +20 -17
  149. package/build/lib/core/ai/ai.d.ts +39 -4
  150. package/build/lib/core/ai/ai.js +10 -4
  151. package/build/lib/core/ai/compactionPrompts.d.ts +6 -0
  152. package/build/lib/core/ai/contextManagement.d.ts +19 -4
  153. package/build/lib/core/ai/failedToolCallHistory.d.ts +9 -0
  154. package/build/lib/core/ai/incompleteModelStream.d.ts +4 -0
  155. package/build/lib/core/ai/index.d.ts +5 -2
  156. package/build/lib/core/ai/index.js +11 -3
  157. package/build/lib/core/ai/inference-attempt/envelope.d.ts +1 -1
  158. package/build/lib/core/ai/inference-attempt/recording.d.ts +1 -1
  159. package/build/lib/core/ai/modelStreamDrain.d.ts +3 -0
  160. package/build/lib/core/ai/models/index.d.ts +2 -1
  161. package/build/lib/core/ai/models/openrouter.d.ts +1 -0
  162. package/build/lib/core/ai/native-rollout-evidence/schema.d.ts +3 -3
  163. package/build/lib/core/ai/providers/concentrate.d.ts +2 -0
  164. package/build/lib/core/ai/providers/ollama.d.ts +2 -0
  165. package/build/lib/core/ai/utils.d.ts +3 -0
  166. package/build/lib/core/ai/utils.js +3 -3
  167. package/build/lib/core/api/attackSurface.d.ts +9 -0
  168. package/build/lib/core/api/index.d.ts +5 -2
  169. package/build/lib/core/api/index.js +45 -27
  170. package/build/lib/core/api/issues.d.ts +125 -16
  171. package/build/lib/core/api/siemTriage.d.ts +4 -0
  172. package/build/lib/core/api/targetedPentest.js +21 -18
  173. package/build/lib/core/atif/schema.d.ts +2 -2
  174. package/build/lib/core/cli/model.d.ts +2 -0
  175. package/build/lib/core/config/config.d.ts +10 -0
  176. package/build/lib/core/config/index.js +1 -1
  177. package/build/lib/core/eventBus.d.ts +43 -0
  178. package/build/lib/core/eventBus.js +1 -1
  179. package/build/lib/core/findings/registry.js +4 -4
  180. package/build/lib/core/http/targetHeaders.d.ts +2 -0
  181. package/build/lib/core/http/targetScope.d.ts +17 -0
  182. package/build/lib/core/ollama.d.ts +28 -0
  183. package/build/lib/core/runtime/localWorkerProtocol.d.ts +4 -4
  184. package/build/lib/core/runtime/runStore.d.ts +2 -2
  185. package/build/lib/core/session/index.d.ts +41 -5
  186. package/build/lib/core/session/index.js +3 -3
  187. package/build/lib/core/session/persistence.d.ts +1 -1
  188. package/build/lib/core/session/persistence.js +4 -4
  189. package/build/lib/core/tools/backends/callbacks.d.ts +22 -0
  190. package/build/lib/core/tools/backends/index.d.ts +1 -1
  191. package/build/lib/core/tools/backends/index.js +3 -3
  192. package/build/lib/core/tools/backends/types.d.ts +67 -0
  193. package/build/lib/core/workflows/fastStrike.d.ts +1 -1
  194. package/build/lib/core/workflows/pentest.js +26 -23
  195. package/build/lib/core/workflows/seams.js +5 -5
  196. package/build/lib/core/workflows/whiteboxAttackSurface.d.ts +2 -0
  197. package/build/lib/core/workflows/whiteboxAttackSurface.js +22 -19
  198. package/build/lib/index.js +31 -25
  199. package/build/lib/util/url.d.ts +1 -0
  200. package/build/{logs-5a82dn40.js → logs-dj570g45.js} +16 -16
  201. package/build/{native-rollout-evidence-hcx5fq4d.js → native-rollout-evidence-vcmxkq9z.js} +3 -3
  202. package/build/{offesecAgent-36mp5t7n.js → offesecAgent-3fey7k6e.js} +6 -6
  203. package/build/pentest-a97cjbbg.js +23 -0
  204. package/build/{pentests-yr3am8eg.js → pentests-4b66eaa4.js} +16 -16
  205. package/build/recordedRunClient-w3ss08a7.js +11 -0
  206. package/build/{subagentSpawner-m17w7z4b.js → subagentSpawner-cfcwj7qg.js} +4 -4
  207. package/build/{targetedPentest-bmx2w41m.js → targetedPentest-vyrqzrvz.js} +8 -8
  208. package/build/{targets-8e2tmhsj.js → targets-b3b1n24h.js} +16 -16
  209. package/build/threatModel-kepg75h9.js +24 -0
  210. package/build/{uninstall-hgtqggvn.js → uninstall-wt0jqrsb.js} +1 -1
  211. package/build/{upload-dyzsg969.js → upload-1am959p4.js} +4 -4
  212. package/build/{utils-862v7pgy.js → utils-a1bfm0ep.js} +11 -3
  213. package/package.json +78 -47
  214. package/src/cli/issues.test.ts +217 -11
  215. package/src/cli/issues.ts +49 -9
  216. package/src/cli/lance-budget.test.ts +31 -0
  217. package/src/cli/lance-budget.ts +56 -0
  218. package/src/cli.ts +14 -9
  219. package/src/core/agents/agentRuntime.test.ts +2 -0
  220. package/src/core/agents/agentRuntime.ts +3 -1
  221. package/src/core/agents/lance.test.ts +2 -1
  222. package/src/core/agents/lance.ts +94 -21
  223. package/src/core/agents/lanceBudget.test.ts +166 -0
  224. package/src/core/agents/lanceBudget.ts +21 -0
  225. package/src/core/agents/offSecAgent/lance.test.ts +27 -2
  226. package/src/core/agents/offSecAgent/offensiveSecurityAgent.compaction.test.ts +257 -0
  227. package/src/core/agents/offSecAgent/offensiveSecurityAgent.ollama.test.ts +289 -0
  228. package/src/core/agents/offSecAgent/offensiveSecurityAgent.test.ts +34 -0
  229. package/src/core/agents/offSecAgent/offensiveSecurityAgent.toolApproval.test.ts +120 -0
  230. package/src/core/agents/offSecAgent/offensiveSecurityAgent.ts +102 -16
  231. package/src/core/agents/offSecAgent/prompt.test.ts +16 -0
  232. package/src/core/agents/offSecAgent/prompt.ts +2 -1
  233. package/src/core/agents/offSecAgent/recordedTools.test.ts +1 -0
  234. package/src/core/agents/offSecAgent/responseContext.test.ts +213 -0
  235. package/src/core/agents/offSecAgent/selectiveConstruction.test.ts +1 -0
  236. package/src/core/agents/offSecAgent/structuredResponse.test.ts +248 -0
  237. package/src/core/agents/offSecAgent/subagentSpawner.hooks.test.ts +67 -0
  238. package/src/core/agents/offSecAgent/subagentSpawner.reasoning.test.ts +8 -0
  239. package/src/core/agents/offSecAgent/subagentSpawner.test.ts +29 -0
  240. package/src/core/agents/offSecAgent/subagentSpawner.ts +55 -1
  241. package/src/core/agents/offSecAgent/toolExecutionContext.test.ts +178 -0
  242. package/src/core/agents/offSecAgent/toolExecutionContext.ts +52 -22
  243. package/src/core/agents/offSecAgent/toolLifecycle.test.ts +18 -0
  244. package/src/core/agents/offSecAgent/toolLifecycle.ts +5 -0
  245. package/src/core/agents/offSecAgent/tools/browserHeaderRouting.redirect.test.ts +57 -16
  246. package/src/core/agents/offSecAgent/tools/browserHeaderRouting.test.ts +53 -46
  247. package/src/core/agents/offSecAgent/tools/browserHeaderRouting.ts +23 -48
  248. package/src/core/agents/offSecAgent/tools/callbackHits.test.ts +220 -0
  249. package/src/core/agents/offSecAgent/tools/callbackHits.ts +118 -0
  250. package/src/core/agents/offSecAgent/tools/callbackListener.test.ts +10 -6
  251. package/src/core/agents/offSecAgent/tools/cloneRepository.test.ts +176 -0
  252. package/src/core/agents/offSecAgent/tools/cloneRepository.ts +108 -0
  253. package/src/core/agents/offSecAgent/tools/createAttackSurfaceReport.test.ts +95 -0
  254. package/src/core/agents/offSecAgent/tools/createAttackSurfaceReport.ts +12 -0
  255. package/src/core/agents/offSecAgent/tools/documentApp.ts +21 -0
  256. package/src/core/agents/offSecAgent/tools/documentFinding.test.ts +119 -0
  257. package/src/core/agents/offSecAgent/tools/documentFinding.ts +72 -12
  258. package/src/core/agents/offSecAgent/tools/documentTopology.test.ts +411 -0
  259. package/src/core/agents/offSecAgent/tools/documentTopology.ts +1510 -0
  260. package/src/core/agents/offSecAgent/tools/executeCommand.test.ts +1 -1
  261. package/src/core/agents/offSecAgent/tools/executeCommand.ts +2 -2
  262. package/src/core/agents/offSecAgent/tools/grep.ts +2 -2
  263. package/src/core/agents/offSecAgent/tools/httpPoc.test.ts +483 -0
  264. package/src/core/agents/offSecAgent/tools/httpPoc.ts +296 -0
  265. package/src/core/agents/offSecAgent/tools/httpRequest.ts +2 -2
  266. package/src/core/agents/offSecAgent/tools/index.ts +88 -3
  267. package/src/core/agents/offSecAgent/tools/playwrightMcp.test.ts +0 -2
  268. package/src/core/agents/offSecAgent/tools/playwrightMcp.ts +2 -4
  269. package/src/core/agents/offSecAgent/tools/runPentestWorkflow.ts +1 -0
  270. package/src/core/agents/offSecAgent/tools/sandboxPlaywright.test.ts +3 -13
  271. package/src/core/agents/offSecAgent/tools/sandboxPlaywright.ts +1 -59
  272. package/src/core/agents/offSecAgent/tools/scopeGuard.test.ts +77 -2
  273. package/src/core/agents/offSecAgent/tools/scopeGuard.ts +24 -3
  274. package/src/core/agents/offSecAgent/tools/selectiveFactories.test.ts +6 -6
  275. package/src/core/agents/offSecAgent/tools/spawnPentestAgent.ts +1 -0
  276. package/src/core/agents/offSecAgent/tools/spawnPentestSwarm.ts +1 -0
  277. package/src/core/agents/offSecAgent/tools/spawnReconAgent.test.ts +95 -0
  278. package/src/core/agents/offSecAgent/tools/spawnReconAgent.ts +193 -0
  279. package/src/core/agents/offSecAgent/tools/toolOutput.test.ts +96 -9
  280. package/src/core/agents/offSecAgent/tools/toolOutput.ts +100 -14
  281. package/src/core/agents/offSecAgent/tools/toolOutput.writeFailure.test.ts +180 -0
  282. package/src/core/agents/offSecAgent/tools/topologyDuplicates.test.ts +500 -0
  283. package/src/core/agents/offSecAgent/tools/topologyDuplicates.ts +153 -0
  284. package/src/core/agents/offSecAgent/tools/topologyMermaid.test.ts +174 -0
  285. package/src/core/agents/offSecAgent/tools/topologyMermaid.ts +179 -0
  286. package/src/core/agents/offSecAgent/tools/topologyRecords.test.ts +569 -0
  287. package/src/core/agents/offSecAgent/tools/topologyRecords.ts +427 -0
  288. package/src/core/agents/offSecAgent/tools/topologyThreats.test.ts +286 -0
  289. package/src/core/agents/offSecAgent/tools/types.ts +9 -1
  290. package/src/core/agents/offSecAgent/tools/webSearch.test.ts +204 -1
  291. package/src/core/agents/offSecAgent/tools/webSearch.ts +85 -4
  292. package/src/core/agents/offSecAgent/types.ts +16 -5
  293. package/src/core/agents/specialized/attackSurface/blackboxAgent.test.ts +101 -2
  294. package/src/core/agents/specialized/attackSurface/blackboxAgent.ts +2 -2
  295. package/src/core/agents/specialized/attackSurface/generalizedAgent.continuation.test.ts +81 -0
  296. package/src/core/agents/specialized/attackSurface/generalizedAgent.ts +195 -0
  297. package/src/core/agents/specialized/attackSurface/generalizedPrompts.test.ts +42 -0
  298. package/src/core/agents/specialized/attackSurface/generalizedPrompts.ts +112 -0
  299. package/src/core/agents/specialized/attackSurface/reconToolset.test.ts +122 -0
  300. package/src/core/agents/specialized/attackSurface/reconToolset.ts +60 -0
  301. package/src/core/agents/specialized/attackSurface/reconUpdate.test.ts +297 -0
  302. package/src/core/agents/specialized/attackSurface/reconUpdate.ts +270 -0
  303. package/src/core/agents/specialized/findingJudge/agent.ts +3 -5
  304. package/src/core/agents/specialized/findingJudge/index.test.ts +6 -6
  305. package/src/core/agents/specialized/findingJudge/index.ts +2 -0
  306. package/src/core/agents/specialized/findingJudge/prompts.test.ts +28 -0
  307. package/src/core/agents/specialized/findingJudge/prompts.ts +17 -2
  308. package/src/core/agents/specialized/pentest/agent.test.ts +44 -0
  309. package/src/core/agents/specialized/pentest/agent.ts +31 -4
  310. package/src/core/agents/specialized/reconWorker/agent.ts +61 -0
  311. package/src/core/agents/specialized/reconWorker/prompts.ts +28 -0
  312. package/src/core/agents/specialized/siemTriage/agent.test.ts +231 -0
  313. package/src/core/agents/specialized/siemTriage/agent.ts +311 -0
  314. package/src/core/agents/specialized/siemTriage/aws.ts +21 -0
  315. package/src/core/agents/specialized/whiteboxAttackSurface/endpointDocumentationAgent.hooks.test.ts +11 -0
  316. package/src/core/ai/ai.approval-compaction.test.ts +902 -0
  317. package/src/core/ai/ai.effective-tools.test.ts +3 -1
  318. package/src/core/ai/ai.invalid-tool-name-history.test.ts +264 -0
  319. package/src/core/ai/ai.operator-context.bench.test.ts +11 -2
  320. package/src/core/ai/ai.recorded-attempts.test.ts +49 -0
  321. package/src/core/ai/ai.stream-recovery.test.ts +758 -0
  322. package/src/core/ai/ai.tool-approval.test.ts +159 -0
  323. package/src/core/ai/ai.tool-repair-drain.test.ts +362 -0
  324. package/src/core/ai/ai.tool-repair-reasoning.test.ts +231 -0
  325. package/src/core/ai/ai.ts +565 -264
  326. package/src/core/ai/caching.test.ts +43 -0
  327. package/src/core/ai/caching.ts +7 -0
  328. package/src/core/ai/compactionPrompts.ts +12 -0
  329. package/src/core/ai/compactionTelemetry.test.ts +49 -9
  330. package/src/core/ai/contextManagement.toolOutput.test.ts +340 -0
  331. package/src/core/ai/contextManagement.ts +115 -37
  332. package/src/core/ai/contextManagement.unicode.test.ts +157 -0
  333. package/src/core/ai/failedToolCallHistory.test.ts +226 -0
  334. package/src/core/ai/failedToolCallHistory.ts +101 -0
  335. package/src/core/ai/incompleteModelStream.ts +17 -0
  336. package/src/core/ai/index.ts +6 -0
  337. package/src/core/ai/inference-attempt/recording.ts +1 -0
  338. package/src/core/ai/modelStreamDrain.ts +6 -0
  339. package/src/core/ai/models/concentrate.ts +119 -0
  340. package/src/core/ai/models/index.ts +13 -1
  341. package/src/core/ai/models/openrouter-reasoning.json +68 -2
  342. package/src/core/ai/models/openrouter.ts +132 -3
  343. package/src/core/ai/providers/anthropic-models.test.ts +4 -2
  344. package/src/core/ai/providers/anthropic.ts +2 -1
  345. package/src/core/ai/providers/bedrock-models.test.ts +212 -2
  346. package/src/core/ai/providers/concentrate.ts +95 -0
  347. package/src/core/ai/providers/ollama.test.ts +223 -0
  348. package/src/core/ai/providers/ollama.ts +21 -0
  349. package/src/core/ai/providers/qwen-models.test.ts +265 -0
  350. package/src/core/ai/reasoning.ts +4 -0
  351. package/src/core/ai/utils.native-rollout-evidence.test.ts +1 -0
  352. package/src/core/ai/utils.ts +104 -16
  353. package/src/core/api/attackSurface.test.ts +14 -16
  354. package/src/core/api/attackSurface.ts +26 -0
  355. package/src/core/api/index.ts +20 -0
  356. package/src/core/api/issues.test.ts +80 -6
  357. package/src/core/api/issues.ts +137 -16
  358. package/src/core/api/siemTriage.ts +40 -0
  359. package/src/core/cli/model.ts +6 -2
  360. package/src/core/config/config.test.ts +48 -0
  361. package/src/core/config/config.ts +14 -0
  362. package/src/core/eventBus.test.ts +63 -0
  363. package/src/core/eventBus.ts +69 -0
  364. package/src/core/http/headers.contract.test.ts +46 -0
  365. package/src/core/http/targetHeaders.ts +4 -1
  366. package/src/core/http/targetScope.ts +71 -0
  367. package/src/core/installation/installation.test.ts +1 -0
  368. package/src/core/ollama.test.ts +139 -0
  369. package/src/core/ollama.ts +184 -0
  370. package/src/core/providers/utils.ts +12 -1
  371. package/src/core/runtime/runTools.test.ts +6 -1
  372. package/src/core/runtime/sqliteModelStore.ts +1 -0
  373. package/src/core/session/index.ts +23 -0
  374. package/src/core/session/persistence.ts +65 -4
  375. package/src/core/session/rehydrate.test.ts +238 -0
  376. package/src/core/tools/backends/callbacks.ts +42 -0
  377. package/src/core/tools/backends/index.ts +4 -0
  378. package/src/core/tools/backends/local.test.ts +85 -1
  379. package/src/core/tools/backends/local.ts +44 -0
  380. package/src/core/tools/backends/policy.ts +2 -1
  381. package/src/core/tools/backends/types.ts +74 -0
  382. package/src/core/workflows/fastStrike.test.ts +10 -0
  383. package/src/core/workflows/fastStrike.ts +18 -2
  384. package/src/core/workflows/pentest.test.ts +93 -0
  385. package/src/core/workflows/pentest.ts +4 -2
  386. package/src/core/workflows/whiteboxAttackSurface.lifecycle.test.ts +269 -0
  387. package/src/core/workflows/whiteboxAttackSurface.test.ts +102 -0
  388. package/src/core/workflows/whiteboxAttackSurface.ts +37 -17
  389. package/src/tests/attackSurface.test.ts +20 -22
  390. package/src/tests/authCookieExport.test.ts +120 -122
  391. package/src/tests/authPentestHandoff.test.ts +192 -199
  392. package/src/tests/browserCookies.test.ts +106 -108
  393. package/src/tui/components/chat/__tests__/model-loading.tsx +110 -0
  394. package/src/tui/components/chat/loading-indicator.tsx +20 -6
  395. package/src/tui/components/chat/message-list.tsx +16 -10
  396. package/src/tui/components/chat/model-loading.test.ts +16 -0
  397. package/src/tui/components/commands/__tests__/advanced-settings-lifecycle.tsx +49 -6
  398. package/src/tui/components/commands/advanced-settings.test.ts +4 -0
  399. package/src/tui/components/commands/advanced-settings.tsx +161 -17
  400. package/src/tui/components/model-picker/ModelPicker.tsx +1 -0
  401. package/src/tui/components/model-picker/__tests__/ollama-discovery.tsx +141 -0
  402. package/src/tui/components/model-picker/model-search.ts +1 -0
  403. package/src/tui/components/model-picker/ollama-discovery.test.ts +13 -0
  404. package/src/tui/components/operator-dashboard/index.tsx +29 -12
  405. package/src/tui/components/operator-dashboard/run-events.test.ts +55 -0
  406. package/src/tui/components/operator-dashboard/run-events.ts +12 -0
  407. package/src/tui/components/operator-dashboard/subagent-detail-view.tsx +1 -0
  408. package/src/tui/components/operator-dashboard/subagent-state.test.ts +15 -0
  409. package/src/tui/components/operator-dashboard/subagent-state.ts +14 -0
  410. package/src/tui/components/shared/index.ts +1 -0
  411. package/src/tui/components/shared/model-loading-icon.tsx +21 -0
  412. package/src/tui/context/agent.tsx +4 -1
  413. package/src/tui/context/config.tsx +21 -0
  414. package/src/tui/context/route.tsx +2 -0
  415. package/src/tui/index.tsx +7 -1
  416. package/src/util/url.ts +6 -8
  417. package/build/agent-34gmbmct.js +0 -14
  418. package/build/agent-jdcbh4s0.js +0 -14
  419. package/build/blackboxAgent-d7xv0thk.js +0 -14
  420. package/build/lib/chunk-k5ck1jqf.js +0 -112
  421. package/build/pentest-p1tjfres.js +0 -23
  422. package/build/recordedRunClient-jrasfd3h.js +0 -11
  423. package/build/threatModel-ec0272nc.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
@@ -135,6 +156,22 @@ it with `--model-provider <id> --model <model>`, or choose its declared models i
135
156
  the operator's `/models` picker. See [custom inference setup](docs/custom-inference.md)
136
157
  for GLM settings, headless job configuration, and a live connection test.
137
158
 
159
+ ### Web search
160
+
161
+ Use your own Exa API key for direct web search with any model provider:
162
+
163
+ ```bash
164
+ export EXA_API_KEY=your-exa-api-key
165
+ pensar
166
+ ```
167
+
168
+ You can also save the key as `exaAPIKey` in your existing
169
+ `~/.pensar/config.json`. If a Brave key is configured (`BRAVE_API_KEY` or
170
+ `braveAPIKey`), Brave takes precedence; remove that key to use Exa. Without
171
+ either search key, Apex uses the existing Pensar web-search gateway, which
172
+ requires Pensar authentication. Exa errors are returned directly without
173
+ switching providers.
174
+
138
175
  ### Logging
139
176
 
140
177
  Apex routes diagnostic/operational logging through a centralized structured logger
@@ -1,16 +1,18 @@
1
- import"./cli-15df7cy4.js";
2
- import"./cli-rsdhzyxc.js";
3
- import"./cli-xc4jc5g8.js";
4
- import"./cli-nrz17r1p.js";
1
+ import {
2
+ callbackDomains
3
+ } from "./cli-27sjhcnt.js";
4
+ import"./cli-69vcn7a7.js";
5
+ import"./cli-vgbrtb0q.js";
6
+ import"./cli-bvwhhm6a.js";
5
7
  import {
6
8
  AgentRuntime,
7
9
  defineAgent
8
- } from "./cli-q9rsfw2a.js";
10
+ } from "./cli-q6h43c9v.js";
9
11
  import"./cli-qba2x69h.js";
10
12
  import {
11
13
  stepCountIs2,
12
14
  init_dist
13
- } from "./cli-3ne35gxp.js";
15
+ } from "./cli-jrscs7aw.js";
14
16
  import"./cli-c2k4xxaw.js";
15
17
  import {
16
18
  init_zod
@@ -38,7 +40,7 @@ function truncate(value, limit) {
38
40
  return `${value.substring(0, limit)}
39
41
  ... [truncated]`;
40
42
  }
41
- var FINDING_JUDGE_SYSTEM_PROMPT = `You are a security finding validation specialist running as an agentic verifier inside an automated penetration testing pipeline.
43
+ var judgeSystemPrompt = (outOfBandRule) => `You are a security finding validation specialist running as an agentic verifier inside an automated penetration testing pipeline.
42
44
 
43
45
  You are the last line of defense against false positives, hallucinated findings, fabricated evidence, and overstated impact. Your job is to independently verify whether a submitted proof-of-concept and its output support the claimed finding.
44
46
 
@@ -71,7 +73,7 @@ You are the last line of defense against false positives, hallucinated findings,
71
73
  - IDOR: output should show access to another user's/account's resource while authentication exists.
72
74
  - Authorization / access-control boundary bypass (RSC/prefetch/redirect-body leaks, missing per-route checks): the evidence must establish the access-model delta — which identity/role was used, and proof that the returned data is genuinely out of scope for that identity (cross-tenant, another user's, or admin-only data a member should not see). A 200 response, a leaked RSC payload, or a skipped redirect alone does NOT prove sensitive exposure. If the bypass is real but the returned data is non-sensitive or plausibly same-tenant/expected-visible, classify as a valid lower-impact finding and require the claim's impact/severity to match — do NOT accept it as high-confidence sensitive/cross-tenant exposure.
73
75
  - Authentication bypass: output should show protected access without valid credentials.
74
- - Email/HTML injection: ideally verify delivery and rendering. If only server acceptance is shown, confidence must stay below 0.7 and limitations must state rendering was not independently verified.
76
+ ${outOfBandRule}- Email/HTML injection: ideally verify delivery and rendering. If only server acceptance is shown, confidence must stay below 0.7 and limitations must state rendering was not independently verified.
75
77
  - Missing rate limiting / anti-automation: a modest burst (~20 requests) with no observed throttling, delays, or 429s is sufficient to demonstrate the gap. For endpoints with real-world side effects (sending email/SMS/push, creating tickets/notifications, contact/support/feedback forms, payments), as few as 2–3 attempts plus the observed response is sufficient — do NOT require volume-testing that would spam real recipients. Evidence must state exact request count, timing/distribution, and observed statuses.
76
78
 
77
79
  ### Common Low-Signal Patterns
@@ -112,6 +114,12 @@ Call the response tool exactly once. Include:
112
114
  - reproducedPoc: whether you reran or independently reproduced the PoC.
113
115
  - webResearchUsed: whether web research materially informed the judgment.
114
116
  - limitations: remaining gaps.`;
117
+ var FINDING_JUDGE_SYSTEM_PROMPT = judgeSystemPrompt("");
118
+ var OUT_OF_BAND_RULE = `- Out-of-band (blind SSRF, XXE, webhook, host-header or password-reset poisoning, blind injection): the target's own response won't show the impact. Accept a claim that cites a callback hit (hitId, method, path, source IP, user agent, time) read with read_callback_hits when its path carries the marker the PoC sends and the PoC makes the target, not the PoC itself, request that URL. You can't read callbacks yourself, so confidence must stay below 0.7 and limitations must state the callback was not independently re-observed. Reject an out-of-band claim with no cited hit, or one where the PoC requests the test domain directly.
119
+ `;
120
+ function findingJudgeSystemPrompt(callbackDomains) {
121
+ return judgeSystemPrompt(callbackDomains.length > 0 ? OUT_OF_BAND_RULE : "");
122
+ }
115
123
  function buildFindingJudgePrompt(input) {
116
124
  const { pocScript, pocType, pocOutput, claim } = input;
117
125
  return `# Finding Validation Request
@@ -202,7 +210,7 @@ function resolveTarget(opts) {
202
210
  var findingJudgeDefinition = defineAgent({
203
211
  name: "finding-judge",
204
212
  role: "judge",
205
- system: () => FINDING_JUDGE_SYSTEM_PROMPT,
213
+ system: (opts) => findingJudgeSystemPrompt(callbackDomains(opts)),
206
214
  activeTools: () => [...FINDING_JUDGE_ACTIVE_TOOLS],
207
215
  responseSchema: () => FindingJudgeOutputSchema,
208
216
  stopWhen: () => stepCountIs2(60),
@@ -0,0 +1,81 @@
1
+ import"./cli-69vcn7a7.js";
2
+ import"./cli-vgbrtb0q.js";
3
+ import"./cli-bvwhhm6a.js";
4
+ import {
5
+ RECON_WORKER_TOOLS
6
+ } from "./cli-27sjhcnt.js";
7
+ import {
8
+ buildCredentialsBlock
9
+ } from "./cli-xs69gx66.js";
10
+ import {
11
+ AgentRuntime,
12
+ defineAgent
13
+ } from "./cli-q6h43c9v.js";
14
+ import"./cli-qba2x69h.js";
15
+ import {
16
+ stepCountIs2,
17
+ init_dist
18
+ } from "./cli-jrscs7aw.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
+ CodeAgent2
3
+ } from "./cli-9b3x3trx.js";
4
+ import"./cli-q6h43c9v.js";
5
+ import"./cli-qba2x69h.js";
6
+ import"./cli-27sjhcnt.js";
7
+ import"./cli-69vcn7a7.js";
8
+ import"./cli-jrscs7aw.js";
9
+ import"./cli-bvwhhm6a.js";
10
+ import"./cli-c2k4xxaw.js";
11
+ import"./cli-vgbrtb0q.js";
12
+ export {
13
+ CodeAgent2 as CodeAgent
14
+ };
@@ -0,0 +1,14 @@
1
+ import {
2
+ runAuthenticationAgent2
3
+ } from "./cli-55jke7bk.js";
4
+ import"./cli-q6h43c9v.js";
5
+ import"./cli-qba2x69h.js";
6
+ import"./cli-27sjhcnt.js";
7
+ import"./cli-69vcn7a7.js";
8
+ import"./cli-jrscs7aw.js";
9
+ import"./cli-bvwhhm6a.js";
10
+ import"./cli-c2k4xxaw.js";
11
+ import"./cli-vgbrtb0q.js";
12
+ export {
13
+ runAuthenticationAgent2 as runAuthenticationAgent
14
+ };
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  TargetedPentestAgent2,
3
3
  buildPentestSystemPrompt2
4
- } from "./cli-cwmkbq45.js";
5
- import"./cli-q9rsfw2a.js";
4
+ } from "./cli-enqe6bcb.js";
5
+ import"./cli-q6h43c9v.js";
6
6
  import"./cli-qba2x69h.js";
7
- import"./cli-nrz17r1p.js";
8
- import"./cli-15df7cy4.js";
9
- import"./cli-3ne35gxp.js";
10
- import"./cli-xc4jc5g8.js";
7
+ import"./cli-27sjhcnt.js";
8
+ import"./cli-69vcn7a7.js";
9
+ import"./cli-jrscs7aw.js";
10
+ import"./cli-bvwhhm6a.js";
11
11
  import"./cli-c2k4xxaw.js";
12
- import"./cli-rsdhzyxc.js";
12
+ import"./cli-vgbrtb0q.js";
13
13
  export {
14
14
  TargetedPentestAgent2 as TargetedPentestAgent,
15
15
  buildPentestSystemPrompt2 as buildPentestSystemPrompt
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  config2,
3
3
  init_config
4
- } from "./cli-rsdhzyxc.js";
5
- import"./cli-xc4jc5g8.js";
6
- import"./cli-nrz17r1p.js";
4
+ } from "./cli-vgbrtb0q.js";
5
+ import"./cli-bvwhhm6a.js";
6
+ import"./cli-27sjhcnt.js";
7
7
  import {
8
8
  AgentEventBus
9
- } from "./cli-15df7cy4.js";
9
+ } from "./cli-69vcn7a7.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-jqf27aw9.js";
21
- import"./cli-ebx3j3c5.js";
22
- import"./cli-16jm0s8q.js";
23
- import"./cli-veyqzxra.js";
24
- import"./cli-h2r33z2v.js";
25
- import"./cli-5nsn1vpx.js";
26
- import"./cli-cwmkbq45.js";
27
- import"./cli-f7v0fgc0.js";
28
- import"./cli-1k414c58.js";
20
+ } from "./cli-fw0r700s.js";
21
+ import"./cli-4pmek04p.js";
22
+ import"./cli-9b3x3trx.js";
23
+ import"./cli-md8azc7a.js";
24
+ import"./cli-1sejsyt5.js";
25
+ import"./cli-55jke7bk.js";
26
+ import"./cli-enqe6bcb.js";
27
+ import"./cli-76pqdrw5.js";
28
+ import"./cli-6b3fnw71.js";
29
29
  import"./cli-ak23knae.js";
30
30
  import {
31
31
  resolveWorkerExecutable,
32
32
  launchLocalWorker
33
- } from "./cli-730f1622.js";
34
- import"./cli-d13d67ym.js";
35
- import"./cli-q9rsfw2a.js";
33
+ } from "./cli-hdtc520e.js";
34
+ import"./cli-bq2n4nd8.js";
35
+ import"./cli-q6h43c9v.js";
36
36
  import"./cli-qba2x69h.js";
37
37
  import {
38
38
  buildAuthConfig,
39
39
  init_ai2
40
- } from "./cli-3ne35gxp.js";
40
+ } from "./cli-jrscs7aw.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-th12cq1c.js");
121
+ const { serveLocalRunWorker } = await import("./index-z2jt4tgv.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-jrasfd3h.js");
135
+ const { openRecordedRunClient } = await import("./recordedRunClient-w3ss08a7.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-nrz17r1p.js";
19
- import"./cli-15df7cy4.js";
20
- import"./cli-rsdhzyxc.js";
21
- import"./cli-xc4jc5g8.js";
22
- import"./cli-jqf27aw9.js";
23
- import"./cli-ebx3j3c5.js";
24
- import"./cli-16jm0s8q.js";
25
- import"./cli-veyqzxra.js";
26
- import"./cli-h2r33z2v.js";
27
- import"./cli-5nsn1vpx.js";
28
- import"./cli-cwmkbq45.js";
29
- import"./cli-f7v0fgc0.js";
30
- import"./cli-1k414c58.js";
18
+ } from "./cli-27sjhcnt.js";
19
+ import"./cli-69vcn7a7.js";
20
+ import"./cli-vgbrtb0q.js";
21
+ import"./cli-bvwhhm6a.js";
22
+ import"./cli-fw0r700s.js";
23
+ import"./cli-4pmek04p.js";
24
+ import"./cli-9b3x3trx.js";
25
+ import"./cli-md8azc7a.js";
26
+ import"./cli-1sejsyt5.js";
27
+ import"./cli-55jke7bk.js";
28
+ import"./cli-enqe6bcb.js";
29
+ import"./cli-76pqdrw5.js";
30
+ import"./cli-6b3fnw71.js";
31
31
  import"./cli-ak23knae.js";
32
32
  import {
33
33
  markCommandFailed
34
34
  } from "./cli-z82n3qk1.js";
35
- import"./cli-d13d67ym.js";
36
- import"./cli-q9rsfw2a.js";
35
+ import"./cli-bq2n4nd8.js";
36
+ import"./cli-q6h43c9v.js";
37
37
  import"./cli-qba2x69h.js";
38
- import"./cli-3ne35gxp.js";
38
+ import"./cli-jrscs7aw.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-nrz17r1p.js";
3
- import"./cli-15df7cy4.js";
2
+ import"./cli-27sjhcnt.js";
3
+ import"./cli-69vcn7a7.js";
4
4
  import {
5
5
  config2,
6
6
  init_config
7
- } from "./cli-rsdhzyxc.js";
7
+ } from "./cli-vgbrtb0q.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-xc4jc5g8.js";
24
- import"./cli-jqf27aw9.js";
25
- import"./cli-ebx3j3c5.js";
26
- import"./cli-16jm0s8q.js";
27
- import"./cli-veyqzxra.js";
28
- import"./cli-h2r33z2v.js";
29
- import"./cli-5nsn1vpx.js";
30
- import"./cli-cwmkbq45.js";
31
- import"./cli-f7v0fgc0.js";
32
- import"./cli-1k414c58.js";
23
+ } from "./cli-bvwhhm6a.js";
24
+ import"./cli-fw0r700s.js";
25
+ import"./cli-4pmek04p.js";
26
+ import"./cli-9b3x3trx.js";
27
+ import"./cli-md8azc7a.js";
28
+ import"./cli-1sejsyt5.js";
29
+ import"./cli-55jke7bk.js";
30
+ import"./cli-enqe6bcb.js";
31
+ import"./cli-76pqdrw5.js";
32
+ import"./cli-6b3fnw71.js";
33
33
  import"./cli-ak23knae.js";
34
34
  import {
35
35
  markCommandFailed
36
36
  } from "./cli-z82n3qk1.js";
37
- import"./cli-d13d67ym.js";
38
- import"./cli-q9rsfw2a.js";
37
+ import"./cli-bq2n4nd8.js";
38
+ import"./cli-q6h43c9v.js";
39
39
  import"./cli-qba2x69h.js";
40
- import"./cli-3ne35gxp.js";
40
+ import"./cli-jrscs7aw.js";
41
41
  import"./cli-c2k4xxaw.js";
42
42
  import {
43
43
  __require
@@ -0,0 +1,14 @@
1
+ import {
2
+ BlackboxAttackSurfaceAgent2
3
+ } from "./cli-4pmek04p.js";
4
+ import"./cli-q6h43c9v.js";
5
+ import"./cli-qba2x69h.js";
6
+ import"./cli-27sjhcnt.js";
7
+ import"./cli-69vcn7a7.js";
8
+ import"./cli-jrscs7aw.js";
9
+ import"./cli-bvwhhm6a.js";
10
+ import"./cli-c2k4xxaw.js";
11
+ import"./cli-vgbrtb0q.js";
12
+ export {
13
+ BlackboxAttackSurfaceAgent2 as BlackboxAttackSurfaceAgent
14
+ };
@@ -1,27 +1,27 @@
1
- import"./cli-rsdhzyxc.js";
2
- import"./cli-xc4jc5g8.js";
3
- import"./cli-15df7cy4.js";
4
- import"./cli-nrz17r1p.js";
5
- import"./cli-ebx3j3c5.js";
6
- import"./cli-cwmkbq45.js";
7
- import"./cli-f7v0fgc0.js";
1
+ import"./cli-vgbrtb0q.js";
2
+ import"./cli-bvwhhm6a.js";
3
+ import"./cli-69vcn7a7.js";
4
+ import"./cli-27sjhcnt.js";
5
+ import"./cli-4pmek04p.js";
6
+ import"./cli-enqe6bcb.js";
7
+ import"./cli-76pqdrw5.js";
8
8
  import {
9
9
  readExecutionMetrics,
10
10
  writeExecutionMetrics,
11
11
  runPentestWorkflow2
12
- } from "./cli-h2r33z2v.js";
13
- import"./cli-16jm0s8q.js";
14
- import"./cli-veyqzxra.js";
12
+ } from "./cli-1sejsyt5.js";
13
+ import"./cli-9b3x3trx.js";
14
+ import"./cli-md8azc7a.js";
15
15
  import {
16
16
  EMPTY_SESSION_TOKEN_USAGE,
17
17
  accumulateSessionTokens
18
18
  } from "./cli-ag6jtndp.js";
19
- import"./cli-q9rsfw2a.js";
19
+ import"./cli-q6h43c9v.js";
20
20
  import"./cli-qba2x69h.js";
21
21
  import {
22
22
  normalizeStepUsage,
23
23
  init_ai2
24
- } from "./cli-3ne35gxp.js";
24
+ } from "./cli-jrscs7aw.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 };
@@ -7,7 +7,7 @@ import {
7
7
  resolveItemHooks,
8
8
  spawnBatch2,
9
9
  inProcessSubagentSpawner2
10
- } from "./cli-15df7cy4.js";
10
+ } from "./cli-69vcn7a7.js";
11
11
  import {
12
12
  collectCommand,
13
13
  toGrpcPentestContext,
@@ -15,24 +15,24 @@ import {
15
15
  pLimit,
16
16
  PLAN_MODE_TOOL_NAMES,
17
17
  OffensiveSecurityAgent
18
- } from "./cli-nrz17r1p.js";
18
+ } from "./cli-27sjhcnt.js";
19
19
  import {
20
20
  BlackboxAttackSurfaceAgent2
21
- } from "./cli-ebx3j3c5.js";
21
+ } from "./cli-4pmek04p.js";
22
22
  import {
23
23
  TargetedPentestAgent2,
24
24
  buildPentestSystemPrompt2
25
- } from "./cli-cwmkbq45.js";
25
+ } from "./cli-enqe6bcb.js";
26
26
  import {
27
27
  buildPentestReport,
28
28
  renderJson,
29
29
  renderMarkdown,
30
30
  REPORT_FILENAME_MD,
31
31
  REPORT_FILENAME_JSON
32
- } from "./cli-f7v0fgc0.js";
32
+ } from "./cli-76pqdrw5.js";
33
33
  import {
34
34
  CodeAgent2
35
- } from "./cli-16jm0s8q.js";
35
+ } from "./cli-9b3x3trx.js";
36
36
  import {
37
37
  WHITEBOX_APPS_DISCOVERY_SYSTEM_PROMPT2,
38
38
  WHITEBOX_ENDPOINT_DOCUMENTATION_SYSTEM_PROMPT,
@@ -41,7 +41,7 @@ import {
41
41
  AppInfoSchema2,
42
42
  AppsDiscoveryResultSchema2,
43
43
  DiscoverySummarySchema2
44
- } from "./cli-veyqzxra.js";
44
+ } from "./cli-md8azc7a.js";
45
45
  import {
46
46
  createThreatModelPrompt
47
47
  } from "./cli-q126f6ef.js";
@@ -52,8 +52,9 @@ import {
52
52
  createLogger,
53
53
  init_structured,
54
54
  scopedLogger,
55
- init_lazyLogger
56
- } from "./cli-3ne35gxp.js";
55
+ init_lazyLogger,
56
+ init_ai2
57
+ } from "./cli-jrscs7aw.js";
57
58
  import {
58
59
  newSessionId,
59
60
  init_id
@@ -231,6 +232,7 @@ import { join as join3 } from "node:path";
231
232
  init_lazyLogger();
232
233
 
233
234
  // src/core/session/persistence.ts
235
+ init_ai2();
234
236
  init_structured();
235
237
  init_lazyLogger();
236
238
  init_session();
@@ -7259,13 +7261,23 @@ Trace changed shared libraries, deleted files, and root/build/deployment configu
7259
7261
  ...input.incremental ? { attackSurfaceArtifactsPath: input.incremental.assetsPath } : {},
7260
7262
  abortSignal
7261
7263
  });
7264
+ input.registerOwnedAgentDrain?.(() => appsAgent.abortAndDrain());
7262
7265
  log4.info(`Phase 1: discovering apps in ${codebasePath}${domains?.length ? ` (${domains.length} known domains)` : ""}`);
7263
7266
  eventBus?.emit("subagent-spawn", {
7264
7267
  subagentId: WORKFLOW_UMBRELLA_ID,
7265
7268
  name: "Whitebox Apps Discovery",
7266
7269
  input: { codebasePath }
7267
7270
  });
7268
- const appsResult = await agentLimiter(() => appsAgent.consume());
7271
+ let appsResult;
7272
+ try {
7273
+ appsResult = await agentLimiter(() => appsAgent.consume());
7274
+ } catch (error) {
7275
+ eventBus?.emit("subagent-complete", {
7276
+ subagentId: WORKFLOW_UMBRELLA_ID,
7277
+ status: "failed"
7278
+ });
7279
+ throw error;
7280
+ }
7269
7281
  if (input.incremental) {
7270
7282
  if (!hooks?.backends)
7271
7283
  throw new Error("Incremental recon requires owned artifact backends");
@@ -7349,16 +7361,24 @@ Trace changed shared libraries, deleted files, and root/build/deployment configu
7349
7361
  hooks: sharedHooks,
7350
7362
  seams
7351
7363
  };
7352
- assertDepth(1, seams.limits);
7353
- await seams.fanOut.spawnMany(appsResult.apps, async (app, appIndex) => {
7354
- await runWhiteboxAttackSurfaceApp(app, appIndex, appWorkerInput);
7355
- completedAppCount++;
7356
- eventBus?.emit("app-analysis-progress", {
7357
- totalApps,
7358
- completedApps: completedAppCount,
7359
- appName: app.name
7364
+ try {
7365
+ assertDepth(1, seams.limits);
7366
+ await seams.fanOut.spawnMany(appsResult.apps, async (app, appIndex) => {
7367
+ await runWhiteboxAttackSurfaceApp(app, appIndex, appWorkerInput);
7368
+ completedAppCount++;
7369
+ eventBus?.emit("app-analysis-progress", {
7370
+ totalApps,
7371
+ completedApps: completedAppCount,
7372
+ appName: app.name
7373
+ });
7374
+ }, { concurrency: DEFAULT_CONCURRENCY });
7375
+ } catch (error) {
7376
+ eventBus?.emit("subagent-complete", {
7377
+ subagentId: WORKFLOW_UMBRELLA_ID,
7378
+ status: "failed"
7360
7379
  });
7361
- }, { concurrency: DEFAULT_CONCURRENCY });
7380
+ throw error;
7381
+ }
7362
7382
  eventBus?.emit("subagent-complete", {
7363
7383
  subagentId: WORKFLOW_UMBRELLA_ID,
7364
7384
  status: "completed"
@@ -8005,11 +8025,11 @@ async function runPentestSwarmTarget(target, index, input) {
8005
8025
  const childSignal = abortSignal && itemHooks.abortSignal ? AbortSignal.any([abortSignal, itemHooks.abortSignal]) : abortSignal ?? itemHooks.abortSignal;
8006
8026
  const previousMessages = loadSubagentMessages(session, subagentId);
8007
8027
  let lastMessages = [];
8008
- const handleStepFinish = (e) => {
8028
+ const handleStepFinish = async (e) => {
8009
8029
  if (e.response.messages) {
8010
8030
  lastMessages = e.response.messages;
8011
8031
  }
8012
- onStepFinish?.(e);
8032
+ await onStepFinish?.(e);
8013
8033
  };
8014
8034
  await seams.hooks.onEndpointStart?.({
8015
8035
  subagentId,
@@ -8216,7 +8236,7 @@ async function runPentestSwarm2(input) {
8216
8236
  }
8217
8237
  async function runPentestWorkflow2(input) {
8218
8238
  if (input.fastStrike) {
8219
- const { runFastStrike } = await import("./fastStrike-d6ekb4qh.js");
8239
+ const { runFastStrike } = await import("./fastStrike-h6xdrh4n.js");
8220
8240
  return runFastStrike(input);
8221
8241
  }
8222
8242
  const {