@pensar/apex 2.6.1 → 2.7.0-canary.52c132f4

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 (221) hide show
  1. package/build/{agent-yby11zaq.js → agent-112gdg69.js} +6 -6
  2. package/build/agent-9bh42v64.js +13 -0
  3. package/build/agent-jg7v2yn0.js +13 -0
  4. package/build/{agent-runs-g37vkrjr.js → agent-runs-hhjzsysf.js} +18 -18
  5. package/build/{agent-ayreaj6z.js → agent-ydy5fq92.js} +5 -5
  6. package/build/{apps-xn6km9yn.js → apps-v4jc7eqb.js} +13 -13
  7. package/build/{auth-d105wc64.js → auth-bxkn5pcb.js} +13 -13
  8. package/build/{blackboxAgent-s56sgx9b.js → blackboxAgent-260yqknt.js} +6 -6
  9. package/build/{blackboxPentest-ps78v3w7.js → blackboxPentest-nbn588pb.js} +17 -12
  10. package/build/{cli-3sp6nd8d.js → cli-087apjgk.js} +2 -2
  11. package/build/{cli-1ve18npr.js → cli-1wtxf161.js} +3 -2
  12. package/build/{cli-d37a42dc.js → cli-3158x9wb.js} +101 -18
  13. package/build/{cli-fy6vh2a7.js → cli-35gz0ahm.js} +1 -1
  14. package/build/{cli-65g6rcat.js → cli-5xdefy58.js} +1 -1
  15. package/build/{cli-709rvekb.js → cli-6vpprmxb.js} +4 -2
  16. package/build/{cli-az3xq70v.js → cli-8hrdnq0e.js} +1 -1
  17. package/build/{cli-7eea4e2y.js → cli-ahk627k3.js} +6 -6
  18. package/build/{cli-c05y640n.js → cli-bc793xfp.js} +1 -1
  19. package/build/{cli-ae8jqxqr.js → cli-cs7hsb1w.js} +2 -2
  20. package/build/{cli-qgz1q9g5.js → cli-ene4g09p.js} +223 -76
  21. package/build/{cli-gx71jcke.js → cli-k8m6737j.js} +1 -1
  22. package/build/{cli-dpsw2fe6.js → cli-mm2vxyne.js} +360 -187
  23. package/build/{cli-ngq9dr8n.js → cli-mpmpfce6.js} +3 -3
  24. package/build/{cli-kb21qhvm.js → cli-np9x97h3.js} +4 -3
  25. package/build/{cli-k2nwxta0.js → cli-tb77javm.js} +2 -2
  26. package/build/{cli-xtc2t6me.js → cli-wa52mx4p.js} +103 -39
  27. package/build/{cli-n2en7j5b.js → cli-xe4wq07r.js} +1 -1
  28. package/build/cli.js +70 -40
  29. package/build/{config-zpqkd5cz.js → config-gpxx6m5z.js} +1 -1
  30. package/build/{fastStrike-mcjdvwez.js → fastStrike-v0r461wn.js} +67 -15
  31. package/build/{fixes-kytx5dmj.js → fixes-c51d83b4.js} +13 -13
  32. package/build/{index-qv4cc65p.js → index-269a90mm.js} +13 -13
  33. package/build/{index-wqetp6gq.js → index-3ggmqh6x.js} +12 -7
  34. package/build/{index-4vqdgb42.js → index-e97991ve.js} +1473 -1217
  35. package/build/{index-n65z6v7b.js → index-ffay4gb2.js} +6 -6
  36. package/build/{index-ns4m4s01.js → index-gw6t92t5.js} +4 -4
  37. package/build/{index-dr3tg1w3.js → index-kkt51z6t.js} +1 -1
  38. package/build/{index-fv64eb32.js → index-kmaq2ym2.js} +2 -2
  39. package/build/{index-je6hcsqr.js → index-wgas3zgb.js} +1 -1
  40. package/build/{index-r9yjkfrv.js → index-xfqh0wte.js} +4 -4
  41. package/build/{issues-eb3q9d3a.js → issues-sq3zya6y.js} +13 -13
  42. package/build/{knowledge-fqsvtx0f.js → knowledge-kzd0cgcm.js} +13 -13
  43. package/build/lib/{chunk-r4j8ybn9.js → chunk-0parq6kp.js} +87 -36
  44. package/build/lib/{chunk-v3dk9j7k.js → chunk-2rcfbtpx.js} +80 -21
  45. package/build/lib/{chunk-acgbyf5h.js → chunk-5axh2ztr.js} +3 -2
  46. package/build/lib/{chunk-yrnrbjes.js → chunk-5qdc4rc6.js} +4 -2
  47. package/build/lib/{chunk-xhdpgpkm.js → chunk-61pnyq94.js} +2 -2
  48. package/build/lib/{chunk-1azdancq.js → chunk-7p9f6cxx.js} +1 -1
  49. package/build/lib/{chunk-z137x08b.js → chunk-7sexq62c.js} +7 -5
  50. package/build/lib/{chunk-ba41jh41.js → chunk-7zayxxn6.js} +304 -129
  51. package/build/lib/{chunk-3c00n0cy.js → chunk-83nets1m.js} +8 -3
  52. package/build/lib/{chunk-e8yy2k73.js → chunk-ajfd3s37.js} +28 -2
  53. package/build/lib/{chunk-4hwzqthr.js → chunk-ay1fx18z.js} +3 -2
  54. package/build/lib/{chunk-1fy8azee.js → chunk-bgnq735r.js} +1 -1
  55. package/build/lib/{chunk-mg03jdmt.js → chunk-eaanxcjj.js} +1 -1
  56. package/build/lib/{chunk-w66ce82a.js → chunk-f28sa6x2.js} +4 -2
  57. package/build/lib/{chunk-z96pbjhd.js → chunk-f6xde44n.js} +13 -6
  58. package/build/lib/{chunk-1jvwqnem.js → chunk-fvgehnst.js} +104 -40
  59. package/build/lib/{chunk-2qsq76xq.js → chunk-fy2a1dm3.js} +128 -34
  60. package/build/lib/{chunk-7pwa92rn.js → chunk-jqy0ftnp.js} +1 -1
  61. package/build/lib/{chunk-bb0ekhkw.js → chunk-k6erk6fv.js} +69 -18
  62. package/build/lib/{chunk-9tt2021m.js → chunk-s338j54x.js} +9 -9
  63. package/build/lib/{chunk-1yct6cra.js → chunk-se6sk7e4.js} +1 -1
  64. package/build/lib/{chunk-nhfax4gb.js → chunk-tdprhz5x.js} +1 -1
  65. package/build/lib/{chunk-r2dkp4tb.js → chunk-wbt03786.js} +1 -1
  66. package/build/lib/{chunk-9yksqgzr.js → chunk-yk43cvgb.js} +20 -13
  67. package/build/lib/core/agents/agentRuntime.d.ts +2 -1
  68. package/build/lib/core/agents/defineAgent.d.ts +3 -2
  69. package/build/lib/core/agents/offSecAgent/index.d.ts +3 -1
  70. package/build/lib/core/agents/offSecAgent/index.js +10 -8
  71. package/build/lib/core/agents/offSecAgent/prompt.d.ts +3 -1
  72. package/build/lib/core/agents/offSecAgent/subagentSpawner.d.ts +2 -1
  73. package/build/lib/core/agents/offSecAgent/subagentSpawner.js +5 -5
  74. package/build/lib/core/agents/offSecAgent/tools/index.js +4 -4
  75. package/build/lib/core/agents/offSecAgent/tools/listMemories.d.ts +11 -1
  76. package/build/lib/core/agents/offSecAgent/tools/reportError.d.ts +2 -1
  77. package/build/lib/core/agents/offSecAgent/tools/runPentestWorkflow.d.ts +20 -1
  78. package/build/lib/core/agents/offSecAgent/tools/spawnPentestAgent.d.ts +4 -7
  79. package/build/lib/core/agents/offSecAgent/tools/spawnPentestSwarm.d.ts +7 -1
  80. package/build/lib/core/agents/offSecAgent/tools/types.d.ts +2 -1
  81. package/build/lib/core/agents/offSecAgent/types.d.ts +7 -1
  82. package/build/lib/core/agents/specialized/attackSurface/blackboxAgent.js +9 -9
  83. package/build/lib/core/agents/specialized/attackSurface/schemas.js +9 -9
  84. package/build/lib/core/agents/specialized/authenticationAgent/index.js +10 -10
  85. package/build/lib/core/agents/specialized/codeAgent/agent.js +9 -9
  86. package/build/lib/core/agents/specialized/codeAgent/prompts.d.ts +1 -0
  87. package/build/lib/core/agents/specialized/findingJudge/agent.js +8 -8
  88. package/build/lib/core/agents/specialized/findingJudge/index.js +3 -3
  89. package/build/lib/core/agents/specialized/patching/index.js +10 -10
  90. package/build/lib/core/agents/specialized/pentest/agent.d.ts +18 -4
  91. package/build/lib/core/agents/specialized/pentest/agent.js +11 -9
  92. package/build/lib/core/agents/specialized/whiteboxAttackSurface/index.js +9 -9
  93. package/build/lib/core/ai/ai.d.ts +23 -6
  94. package/build/lib/core/ai/ai.js +2 -2
  95. package/build/lib/core/ai/index.js +2 -2
  96. package/build/lib/core/ai/models/claude-capabilities.d.ts +3 -2
  97. package/build/lib/core/ai/models/index.d.ts +1 -1
  98. package/build/lib/core/ai/utils.d.ts +2 -0
  99. package/build/lib/core/ai/utils.js +4 -2
  100. package/build/lib/core/api/index.d.ts +3 -0
  101. package/build/lib/core/api/index.js +22 -19
  102. package/build/lib/core/api/targetedPentest.d.ts +1 -0
  103. package/build/lib/core/api/targetedPentest.js +10 -10
  104. package/build/lib/core/config/config.d.ts +3 -0
  105. package/build/lib/core/config/index.js +1 -1
  106. package/build/lib/core/findings/registry.js +3 -3
  107. package/build/lib/core/session/index.d.ts +12 -0
  108. package/build/lib/core/session/index.js +2 -2
  109. package/build/lib/core/session/persistence.d.ts +7 -0
  110. package/build/lib/core/session/persistence.js +7 -3
  111. package/build/lib/core/workflows/fastStrike.d.ts +3 -1
  112. package/build/lib/core/workflows/pentest.d.ts +8 -1
  113. package/build/lib/core/workflows/pentest.js +15 -15
  114. package/build/lib/core/workflows/seams.js +4 -4
  115. package/build/lib/core/workflows/whiteboxAttackSurface.js +11 -11
  116. package/build/lib/index.js +22 -22
  117. package/build/{logs-x62b7hk1.js → logs-yk8dk6aa.js} +13 -13
  118. package/build/{native-rollout-evidence-c9yhfqcs.js → native-rollout-evidence-krpdfdv7.js} +3 -3
  119. package/build/{offesecAgent-5whnpeta.js → offesecAgent-aw87gf37.js} +4 -4
  120. package/build/pentest-t0p4nw2a.js +22 -0
  121. package/build/{pentests-e0f32aqx.js → pentests-577n3x75.js} +13 -13
  122. package/build/recordedRunClient-d7947b0z.js +11 -0
  123. package/build/{targetedPentest-rcbs4nvp.js → targetedPentest-7v849dtm.js} +18 -11
  124. package/build/{targets-xj9g3q0z.js → targets-3vjxv3yj.js} +13 -13
  125. package/build/threatModel-n0grwkav.js +21 -0
  126. package/build/{uninstall-7s784q4a.js → uninstall-ctv33v8j.js} +1 -1
  127. package/build/{upload-4gvhwmvr.js → upload-rnec235r.js} +4 -4
  128. package/build/{utils-cjrz64pc.js → utils-6420gkkg.js} +3 -3
  129. package/package.json +1 -1
  130. package/src/cli.ts +48 -14
  131. package/src/core/agents/agentRuntime.test.ts +38 -0
  132. package/src/core/agents/agentRuntime.ts +5 -2
  133. package/src/core/agents/defineAgent.ts +3 -1
  134. package/src/core/agents/offSecAgent/index.ts +3 -0
  135. package/src/core/agents/offSecAgent/offensiveSecurityAgent.test.ts +92 -5
  136. package/src/core/agents/offSecAgent/offensiveSecurityAgent.ts +70 -31
  137. package/src/core/agents/offSecAgent/prompt.test.ts +46 -0
  138. package/src/core/agents/offSecAgent/prompt.ts +52 -8
  139. package/src/core/agents/offSecAgent/selectiveConstruction.publicPath.test.ts +38 -0
  140. package/src/core/agents/offSecAgent/selectiveConstruction.test.ts +64 -0
  141. package/src/core/agents/offSecAgent/subagentSpawner.ts +12 -1
  142. package/src/core/agents/offSecAgent/tools/delegateAuth.ts +1 -0
  143. package/src/core/agents/offSecAgent/tools/listMemories.test.ts +230 -0
  144. package/src/core/agents/offSecAgent/tools/listMemories.ts +73 -6
  145. package/src/core/agents/offSecAgent/tools/reportError.test.ts +6 -0
  146. package/src/core/agents/offSecAgent/tools/reportError.ts +10 -2
  147. package/src/core/agents/offSecAgent/tools/runAttackSurface.ts +2 -0
  148. package/src/core/agents/offSecAgent/tools/runPentestWorkflow.test.ts +57 -0
  149. package/src/core/agents/offSecAgent/tools/runPentestWorkflow.ts +19 -1
  150. package/src/core/agents/offSecAgent/tools/runWhiteboxScan.ts +5 -2
  151. package/src/core/agents/offSecAgent/tools/spawnCodingAgent.ts +1 -0
  152. package/src/core/agents/offSecAgent/tools/spawnPentestAgent.test.ts +72 -2
  153. package/src/core/agents/offSecAgent/tools/spawnPentestAgent.ts +32 -11
  154. package/src/core/agents/offSecAgent/tools/spawnPentestSwarm.ts +25 -5
  155. package/src/core/agents/offSecAgent/tools/threatModelGenerator.ts +1 -0
  156. package/src/core/agents/offSecAgent/tools/types.ts +6 -1
  157. package/src/core/agents/offSecAgent/tools/updateTask.ts +5 -1
  158. package/src/core/agents/offSecAgent/tools/whiteboxCandidates.ts +11 -4
  159. package/src/core/agents/offSecAgent/types.ts +9 -0
  160. package/src/core/agents/specialized/codeAgent/agent.test.ts +7 -0
  161. package/src/core/agents/specialized/codeAgent/agent.ts +9 -2
  162. package/src/core/agents/specialized/codeAgent/prompts.ts +6 -0
  163. package/src/core/agents/specialized/pentest/agent.test.ts +116 -0
  164. package/src/core/agents/specialized/pentest/agent.ts +178 -49
  165. package/src/core/agents/specialized/pentest/results.test.ts +59 -4
  166. package/src/core/agents/specialized/whiteboxAttackSurface/endpointDocumentationAgent.ts +1 -0
  167. package/src/core/ai/ai.operator-context.bench.test.ts +1408 -0
  168. package/src/core/ai/ai.recorded-context.test.ts +74 -0
  169. package/src/core/ai/ai.test.ts +54 -0
  170. package/src/core/ai/ai.ts +299 -80
  171. package/src/core/ai/compactionTelemetry.test.ts +2 -2
  172. package/src/core/ai/models/anthropic.ts +6 -0
  173. package/src/core/ai/models/bedrock.ts +18 -0
  174. package/src/core/ai/models/claude-capabilities.ts +29 -8
  175. package/src/core/ai/models/index.ts +4 -1
  176. package/src/core/ai/models/models.test.ts +23 -0
  177. package/src/core/ai/models/openrouter.ts +6 -0
  178. package/src/core/ai/providers/anthropic-models.test.ts +60 -1
  179. package/src/core/ai/providers/bedrock-models.test.ts +81 -0
  180. package/src/core/ai/providers/gateway-models.test.ts +16 -6
  181. package/src/core/ai/utils.native-rollout-evidence.test.ts +1 -0
  182. package/src/core/ai/utils.ts +189 -143
  183. package/src/core/api/blackboxPentest.ts +9 -1
  184. package/src/core/api/index.ts +9 -0
  185. package/src/core/api/targetedPentest.ts +19 -5
  186. package/src/core/config/config.test.ts +35 -0
  187. package/src/core/config/config.ts +5 -0
  188. package/src/core/observability/telemetry.test.ts +2 -3
  189. package/src/core/session/index.ts +5 -0
  190. package/src/core/session/persistence.test.ts +62 -0
  191. package/src/core/session/persistence.ts +56 -0
  192. package/src/core/workflows/fastStrike.seams.test.ts +149 -0
  193. package/src/core/workflows/fastStrike.test.ts +18 -1
  194. package/src/core/workflows/fastStrike.ts +103 -11
  195. package/src/core/workflows/pentest.test.ts +104 -0
  196. package/src/core/workflows/pentest.ts +110 -7
  197. package/src/core/workflows/seams.test.ts +13 -0
  198. package/src/core/workflows/seams.ts +5 -1
  199. package/src/core/workflows/whiteboxAttackSurface.ts +1 -0
  200. package/src/tui/components/chat/loading-indicator.tsx +20 -4
  201. package/src/tui/components/chat/message-list.tsx +1 -0
  202. package/src/tui/components/commands/__tests__/advanced-settings-lifecycle.tsx +176 -0
  203. package/src/tui/components/commands/advanced-settings.test.ts +28 -0
  204. package/src/tui/components/commands/advanced-settings.tsx +237 -19
  205. package/src/tui/components/operator-dashboard/index.tsx +46 -9
  206. package/src/tui/components/operator-dashboard/logic.test.ts +106 -0
  207. package/src/tui/components/operator-dashboard/logic.ts +42 -2
  208. package/src/tui/components/operator-dashboard/run-events.test.ts +3 -1
  209. package/src/tui/components/shared/__tests__/tool-renderer-lifecycle.tsx +18 -0
  210. package/src/tui/components/shared/action-label.test.ts +9 -0
  211. package/src/tui/components/shared/compacting-icon.tsx +18 -0
  212. package/src/tui/components/shared/index.ts +1 -0
  213. package/src/tui/components/shared/tool-registry.ts +1 -0
  214. package/src/tui/components/shared/tool-renderer.tsx +21 -7
  215. package/src/tui/context/route.tsx +1 -0
  216. package/src/tui/keybindings/registry.ts +2 -0
  217. package/build/agent-6w7egcf1.js +0 -13
  218. package/build/agent-9zx75feh.js +0 -13
  219. package/build/pentest-e61hc38s.js +0 -22
  220. package/build/recordedRunClient-dp032c32.js +0 -11
  221. package/build/threatModel-jkxfa40s.js +0 -21
@@ -6,14 +6,14 @@ import {
6
6
  AppsDiscoveryResultSchema2,
7
7
  DiscoverySummarySchema2,
8
8
  WhiteboxAttackSurfaceAgent2
9
- } from "./cli-ngq9dr8n.js";
10
- import"./cli-1ve18npr.js";
9
+ } from "./cli-mpmpfce6.js";
10
+ import"./cli-1wtxf161.js";
11
11
  import"./cli-qba2x69h.js";
12
- import"./cli-qgz1q9g5.js";
13
- import"./cli-dpsw2fe6.js";
14
- import"./cli-c05y640n.js";
12
+ import"./cli-ene4g09p.js";
13
+ import"./cli-mm2vxyne.js";
14
+ import"./cli-bc793xfp.js";
15
15
  import"./cli-c2k4xxaw.js";
16
- import"./cli-fy6vh2a7.js";
16
+ import"./cli-35gz0ahm.js";
17
17
  export {
18
18
  AppInfoSchema2 as AppInfoSchema,
19
19
  AppsDiscoveryResultSchema2 as AppsDiscoveryResultSchema,
@@ -1,11 +1,11 @@
1
- import"./cli-fy6vh2a7.js";
2
- import"./cli-c05y640n.js";
1
+ import"./cli-35gz0ahm.js";
2
+ import"./cli-bc793xfp.js";
3
3
  import {
4
4
  scopedLogger,
5
5
  init_lazyLogger,
6
6
  createLogger,
7
7
  init_structured
8
- } from "./cli-dpsw2fe6.js";
8
+ } from "./cli-mm2vxyne.js";
9
9
  import"./cli-c2k4xxaw.js";
10
10
 
11
11
  // src/core/agents/specialized/findingJudge/index.ts
@@ -14,7 +14,7 @@ init_lazyLogger();
14
14
  var log = scopedLogger(() => createLogger("FindingJudge"));
15
15
  async function judgeFinding(input, ctx) {
16
16
  try {
17
- const { FindingJudgeAgent } = await import("./agent-ayreaj6z.js");
17
+ const { FindingJudgeAgent } = await import("./agent-ydy5fq92.js");
18
18
  const agent = new FindingJudgeAgent({
19
19
  finding: input,
20
20
  model: ctx.model,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  config2,
3
3
  init_config
4
- } from "./cli-fy6vh2a7.js";
4
+ } from "./cli-35gz0ahm.js";
5
5
  init_config();
6
6
 
7
7
  export {
@@ -14,8 +14,8 @@ import {
14
14
  createWorkspaceSelection2,
15
15
  pollWorkspaceSelection2,
16
16
  init_auth
17
- } from "./cli-c05y640n.js";
18
- import"./cli-fy6vh2a7.js";
17
+ } from "./cli-bc793xfp.js";
18
+ import"./cli-35gz0ahm.js";
19
19
  init_auth();
20
20
 
21
21
  export {
@@ -3,7 +3,7 @@ import {
3
3
  get2,
4
4
  update2,
5
5
  init_config2
6
- } from "./cli-709rvekb.js";
6
+ } from "./cli-6vpprmxb.js";
7
7
 
8
8
  // src/core/config/index.ts
9
9
  init_config2();
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  ALL_TOOL_NAMES2,
3
3
  SKILL_TOOL_NAMES2
4
- } from "./cli-qgz1q9g5.js";
5
- import"./cli-fy6vh2a7.js";
6
- import"./cli-c05y640n.js";
7
- import"./cli-dpsw2fe6.js";
4
+ } from "./cli-ene4g09p.js";
5
+ import"./cli-35gz0ahm.js";
6
+ import"./cli-bc793xfp.js";
7
+ import"./cli-mm2vxyne.js";
8
8
  import"./cli-c2k4xxaw.js";
9
9
  export {
10
10
  ALL_TOOL_NAMES2 as ALL_TOOL_NAMES,
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env bun
2
- import"./cli-fy6vh2a7.js";
3
- import"./cli-c05y640n.js";
2
+ import"./cli-ene4g09p.js";
3
+ import"./cli-35gz0ahm.js";
4
+ import"./cli-bc793xfp.js";
4
5
  import {
5
6
  CLOSED_DISPOSITIONS2,
6
7
  listIssues2,
@@ -11,22 +12,21 @@ import {
11
12
  retestIssue2,
12
13
  linkPullRequest2,
13
14
  listIssuePullRequests2
14
- } from "./cli-7eea4e2y.js";
15
- import"./cli-qgz1q9g5.js";
16
- import"./cli-k2nwxta0.js";
17
- import"./cli-kb21qhvm.js";
18
- import"./cli-ngq9dr8n.js";
19
- import"./cli-d37a42dc.js";
20
- import"./cli-3sp6nd8d.js";
21
- import"./cli-xtc2t6me.js";
22
- import"./cli-n2en7j5b.js";
15
+ } from "./cli-ahk627k3.js";
16
+ import"./cli-tb77javm.js";
17
+ import"./cli-np9x97h3.js";
18
+ import"./cli-mpmpfce6.js";
19
+ import"./cli-3158x9wb.js";
20
+ import"./cli-087apjgk.js";
21
+ import"./cli-wa52mx4p.js";
22
+ import"./cli-xe4wq07r.js";
23
23
  import"./cli-xcy2vxj2.js";
24
24
  import {
25
25
  markCommandFailed
26
26
  } from "./cli-z82n3qk1.js";
27
- import"./cli-1ve18npr.js";
27
+ import"./cli-1wtxf161.js";
28
28
  import"./cli-qba2x69h.js";
29
- import"./cli-dpsw2fe6.js";
29
+ import"./cli-mm2vxyne.js";
30
30
  import"./cli-c2k4xxaw.js";
31
31
 
32
32
  // src/cli/issues.ts
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env bun
2
- import"./cli-fy6vh2a7.js";
3
- import"./cli-c05y640n.js";
2
+ import"./cli-ene4g09p.js";
3
+ import"./cli-35gz0ahm.js";
4
+ import"./cli-bc793xfp.js";
4
5
  import {
5
6
  KNOWLEDGE_CATEGORIES2,
6
7
  KNOWLEDGE_STATUSES2,
@@ -9,22 +10,21 @@ import {
9
10
  createKnowledge2,
10
11
  updateKnowledge2,
11
12
  archiveKnowledge2
12
- } from "./cli-7eea4e2y.js";
13
- import"./cli-qgz1q9g5.js";
14
- import"./cli-k2nwxta0.js";
15
- import"./cli-kb21qhvm.js";
16
- import"./cli-ngq9dr8n.js";
17
- import"./cli-d37a42dc.js";
18
- import"./cli-3sp6nd8d.js";
19
- import"./cli-xtc2t6me.js";
20
- import"./cli-n2en7j5b.js";
13
+ } from "./cli-ahk627k3.js";
14
+ import"./cli-tb77javm.js";
15
+ import"./cli-np9x97h3.js";
16
+ import"./cli-mpmpfce6.js";
17
+ import"./cli-3158x9wb.js";
18
+ import"./cli-087apjgk.js";
19
+ import"./cli-wa52mx4p.js";
20
+ import"./cli-xe4wq07r.js";
21
21
  import"./cli-xcy2vxj2.js";
22
22
  import {
23
23
  markCommandFailed
24
24
  } from "./cli-z82n3qk1.js";
25
- import"./cli-1ve18npr.js";
25
+ import"./cli-1wtxf161.js";
26
26
  import"./cli-qba2x69h.js";
27
- import"./cli-dpsw2fe6.js";
27
+ import"./cli-mm2vxyne.js";
28
28
  import"./cli-c2k4xxaw.js";
29
29
 
30
30
  // src/cli/knowledge.ts
@@ -19,7 +19,7 @@ import {
19
19
  scopedLogger,
20
20
  normalizeStepUsage2,
21
21
  streamResponse2
22
- } from "./chunk-ba41jh41.js";
22
+ } from "./chunk-7zayxxn6.js";
23
23
  import {
24
24
  PerCommandShell2,
25
25
  resolveBrowserHeaderPolicy2,
@@ -47,7 +47,7 @@ import {
47
47
  } from "./chunk-fy3bbbqy.js";
48
48
  import {
49
49
  inProcessSubagentSpawner2
50
- } from "./chunk-3c00n0cy.js";
50
+ } from "./chunk-83nets1m.js";
51
51
  import {
52
52
  addMemory2,
53
53
  ASK_USER_QUESTIONS_TOOL_NAME2,
@@ -120,7 +120,7 @@ import {
120
120
  FAST_STRIKE_EXCLUDED_TOOL_NAMES2,
121
121
  PLAN_MODE_TOOL_NAMES2,
122
122
  SKILL_TOOL_NAMES2
123
- } from "./chunk-2qsq76xq.js";
123
+ } from "./chunk-fy2a1dm3.js";
124
124
  import {
125
125
  ApexFindingObject2
126
126
  } from "./chunk-q5e23acz.js";
@@ -140,6 +140,7 @@ __export(exports_offSecAgent, {
140
140
  BROWSER_TOOL_NAMES: () => BROWSER_TOOL_NAMES2,
141
141
  EMAIL_TOOL_NAMES: () => EMAIL_TOOL_NAMES2,
142
142
  EMAIL_TOOL_NAMES_ACTIVE: () => EMAIL_TOOL_NAMES2,
143
+ EXTERNAL_FINDING_POLICY_CAPABILITY: () => EXTERNAL_FINDING_POLICY_CAPABILITY2,
143
144
  FAST_STRIKE_EXCLUDED_TOOL_NAMES: () => FAST_STRIKE_EXCLUDED_TOOL_NAMES2,
144
145
  OffensiveSecurityAgent: () => OffensiveSecurityAgent2,
145
146
  PLAN_MODE_TOOL_NAMES: () => PLAN_MODE_TOOL_NAMES2,
@@ -516,11 +517,12 @@ ${lines.join(`
516
517
 
517
518
  ${readGuidance} A \`README.md\` inside \`provided_files/\` may include per-file descriptions supplied by the user — check it first before diving into individual files.`;
518
519
  }
519
- function buildSessionWorkspaceSection2(session, agentCwd, activeTools, fileWorkspaceRoot) {
520
+ function buildSessionWorkspaceSection2(session, agentCwd, activeTools, fileWorkspaceRoot, findingPolicy = "native") {
520
521
  const sandboxMode = agentCwd === session.rootPath;
521
522
  const providedFilesSection = buildProvidedFilesSection2(session.rootPath, fileWorkspaceRoot);
522
- const sourceAssessmentSection = buildSourceAssessmentSection(session, agentCwd, { sandboxMode, activeTools, fileWorkspaceRoot });
523
+ const sourceAssessmentSection = buildSourceAssessmentSection(session, agentCwd, { sandboxMode, activeTools, fileWorkspaceRoot }, findingPolicy);
523
524
  if (fileWorkspaceRoot) {
525
+ const artifactsGuidance = findingPolicy === "external" ? `Session artifacts live at ${session.rootPath}. Follow the caller's output contract for findings; browser tools save their own evidence.` : `Session artifacts live at ${session.rootPath}. Findings and published PoCs are written by \`document_vulnerability\`, and browser tools save their own evidence.`;
524
526
  return `
525
527
 
526
528
  # Working Directory and File Workspace
@@ -529,9 +531,16 @@ Your shell starts in ${agentCwd}. Native file tools are confined to ${fileWorksp
529
531
 
530
532
  Create and edit helper scripts inside the file workspace. Use absolute helper paths with \`execute_command\` to check and run them. Do not prefix native file-tool paths with \`scratchpad/\` or \`provided_files/\` to reach session directories outside the file workspace.
531
533
 
532
- Session artifacts live at ${session.rootPath}. Findings and published PoCs are written by \`document_vulnerability\`, and browser tools save their own evidence. Session logs and provided files outside the file workspace must be inspected through command tools or copied into the file workspace before native file tools can read them.${providedFilesSection}${sourceAssessmentSection}`;
534
+ ${artifactsGuidance} Session logs and provided files outside the file workspace must be inspected through command tools or copied into the file workspace before native file tools can read them.${providedFilesSection}${sourceAssessmentSection}`;
533
535
  }
534
536
  if (sandboxMode) {
537
+ if (findingPolicy === "external") {
538
+ return `
539
+
540
+ # Session Workspace
541
+
542
+ Your shell is already set to the session directory. Use relative paths for session files. The session provides scratchpad/ for temporary work, logs/ for execution logs, evidence/ for browser evidence, and provided_files/ for supplied inputs. Follow the caller's output contract for findings.${providedFilesSection}${sourceAssessmentSection}`;
543
+ }
535
544
  return `
536
545
 
537
546
  # Session Workspace
@@ -547,6 +556,14 @@ The session directory (${session.rootPath}) contains these subdirectories:
547
556
  - **provided_files/** — user-uploaded files (sample payloads, docs, test data); populated when the project has workspace files configured.
548
557
 
549
558
  Tools like \`document_vulnerability\` and browser evidence capture write to the correct subdirectories automatically.${providedFilesSection}${sourceAssessmentSection}`;
559
+ }
560
+ if (findingPolicy === "external") {
561
+ return `
562
+
563
+ # Working Directory
564
+
565
+ Your shell starts in the user's project directory: ${agentCwd}
566
+ Use relative paths to reference project files. Session artifacts are stored at ${session.rootPath}; use scratchpad/ for temporary work, logs/ for execution logs, and evidence/ for browser evidence. Follow the caller's output contract for findings.${providedFilesSection}${sourceAssessmentSection}`;
550
567
  }
551
568
  return `
552
569
 
@@ -581,7 +598,7 @@ function buildSourceAssessmentSection(session, agentCwd, {
581
598
  sandboxMode,
582
599
  activeTools,
583
600
  fileWorkspaceRoot
584
- }) {
601
+ }, findingPolicy) {
585
602
  const codebasePath = session.config?.codebasePath;
586
603
  const hasSourceAccess = Boolean(codebasePath) || !sandboxMode && !fileWorkspaceRoot;
587
604
  if (!hasSourceAccess)
@@ -605,7 +622,7 @@ The configured codebase path is ${codebasePath}, while your shell starts in ${ag
605
622
  hasTool("run_whitebox_scan") && "- Use `run_whitebox_scan` for installed scanners.",
606
623
  hasTool("spawn_coding_agent") && "- Use `spawn_coding_agent` for independent deep dives.",
607
624
  hasTool("create_whitebox_candidate") && "- Track unverified hypotheses with `create_whitebox_candidate`.",
608
- hasTool("document_vulnerability") && "- Only call `document_vulnerability` after a PoC, crash reproducer, or dynamic check confirms exploitability.",
625
+ findingPolicy !== "external" && hasTool("document_vulnerability") && "- Only call `document_vulnerability` after a PoC, crash reproducer, or dynamic check confirms exploitability.",
609
626
  hasTool("start_whitebox_job") && hasTool("poll_whitebox_job") && "- Run builds, local servers, sanitizer runs, and microfuzzers through bounded whitebox jobs so logs and crashes are preserved as artifacts."
610
627
  ].filter(Boolean).join(`
611
628
  `);
@@ -621,6 +638,14 @@ ${toolGuidance}${repoEditBullet}`;
621
638
  }
622
639
  function buildBaseSystemPrompt2(options) {
623
640
  const sandboxMode = options?.sandboxMode ?? true;
641
+ const externalFindings = options?.findingPolicy === "external";
642
+ const exploitationCapability = externalFindings ? "- **Exploitation and proof development** — use the available tools only as far as the assigned objective requires" : "- **Exploitation & proof-of-concept development** — provide PoC scripts inline to document_vulnerability which executes and validates them";
643
+ const reportingCapability = externalFindings ? "- **Reporting** — submit concise findings through the caller's requested output contract; the caller grades them after the run" : "- **Reporting** — document confirmed findings with evidence, impact, and remediation";
644
+ const findingToolReference = externalFindings ? `## Findings
645
+ - Use the caller's requested output format for any discovered vulnerabilities. Include the affected surface, observed behavior, and likely security impact.` : `## Findings & PoCs
646
+ - **document_vulnerability** — Create, execute, and validate a proof-of-concept script, then document the confirmed vulnerability with CVSS 4.0 scoring. Provide your POC script inline via pocContent. The tool handles execution, validation, scoring, and persistence.`;
647
+ const findingWorkRule = externalFindings ? "6. **Report findings through the requested output.** Focus on discovering vulnerabilities and gathering the evidence required by the user's task. Do not spend time on a separate in-run finding review." : "6. **Document security work as you go.** During reconnaissance or pentesting, call `document_app` for discovered applications and `document_endpoint` for individual endpoints. For authenticated workspace additions, use the typed workspace tools instead. Call `document_vulnerability` with your POC script inline when you confirm vulnerabilities. Don't defer documentation to the end.";
648
+ const reportRule = externalFindings ? "5. **Follow the caller's output contract.** Keep intermediate files in scratchpad/ and submit final finding artifacts only where the caller requested." : "5. **No reports in scratchpad.** Do NOT write synthesized report documents to scratchpad/ (e.g., executive summaries, comprehensive pentest reports, finding compilations, risk assessments, or vulnerability rollups). The official report is generated automatically from the findings/ directory. Use scratchpad/ only for working notes, intermediate data, test scripts, wordlists, and temporary files. Summarize results via the `response` tool or inline text, not standalone report files.";
624
649
  const stayInSessionParagraph = sandboxMode ? `
625
650
 
626
651
  **Stay in the session folder.** Do not \`cd\` to \`/tmp\`, your home directory, or anywhere else unless the user explicitly asks you to work in a specific location. Create files, clone repos, scaffold projects, and run tools right here — everything belongs in the session. Use relative paths (e.g. \`scratchpad/notes.txt\`, \`test-app/\`) rather than absolute paths to external directories.` : "";
@@ -633,9 +658,9 @@ You work interactively with the user. Execute the task they ask for, report your
633
658
  You can perform the full lifecycle of a penetration test and support a wide range of cybersecurity tasks:
634
659
  - **Reconnaissance & attack surface mapping** — subdomain enumeration, endpoint discovery, JS analysis, authenticated crawling
635
660
  - **Vulnerability testing** — injection flaws, auth bypasses, access control issues, misconfigurations, business logic flaws
636
- - **Exploitation & proof-of-concept development** — provide PoC scripts inline to document_vulnerability which executes and validates them
661
+ ${exploitationCapability}
637
662
  - **Source code analysis** — read and search codebases for security-relevant patterns, misconfigurations, and vulnerabilities
638
- - **Reporting** — document confirmed findings with evidence, impact, and remediation
663
+ ${reportingCapability}
639
664
 
640
665
  # Tool Reference
641
666
 
@@ -686,8 +711,7 @@ You can perform the full lifecycle of a penetration test and support a wide rang
686
711
 
687
712
  These tools use the authenticated API client in the running Apex process. Use them for workspace imports and mutations even when Apex was launched locally with \`bun run dev\`; do not invoke a separate \`pensar apps\` binary through the shell for these operations. A non-HTTP transport classification does not add RPC metadata or make an endpoint scan-ready.
688
713
 
689
- ## Findings & PoCs
690
- - **document_vulnerability** — Create, execute, and validate a proof-of-concept script, then document the confirmed vulnerability with CVSS 4.0 scoring. Provide your POC script inline via pocContent. The tool handles execution, validation, scoring, and persistence.
714
+ ${findingToolReference}
691
715
 
692
716
  ## Orchestration
693
717
  - **run_attack_surface** — Launch a full attack surface discovery workflow. Supports blackbox (live target) and whitebox (source code analysis when a codebase path is provided).
@@ -715,7 +739,7 @@ Run \`pensar --help\` or \`pensar <command> --help\` for exact flags — the CLI
715
739
  3. **Be thorough within the ask.** When given a task, see it through completely. Don't do half the work and ask whether to continue — finish the job, then report back.
716
740
  4. **Use the right level of automation.** For large tasks (e.g., "pentest this entire application"), use orchestration tools like \`run_attack_surface\` and \`spawn_pentest_swarm\` to parallelize the work. For focused tasks (e.g., "check if this parameter is vulnerable to XSS"), work directly with \`http_request\`, \`execute_command\`, or the browser tools.
717
741
  5. **Authenticate when needed.** If the user provides credentials or auth instructions, use them. Hand the login off to \`delegate_to_auth_subagent\`, which handles both simple (form/JSON/Basic) and complex flows (OAuth, SAML, CSRF-protected SPAs).
718
- 6. **Document security work as you go.** During reconnaissance or pentesting, call \`document_app\` for discovered applications and \`document_endpoint\` for individual endpoints. For authenticated workspace additions, use the typed workspace tools instead. Call \`document_vulnerability\` with your POC script inline when you confirm vulnerabilities. Don't defer documentation to the end.
742
+ ${findingWorkRule}
719
743
  7. **Consult memories first.** When you begin testing a specific application, framework, or path, call \`list_memories\` to check for saved knowledge from previous sessions — past findings, useful payloads, endpoint patterns, or target-specific notes. Use relevant memories to inform your approach before starting from scratch.
720
744
 
721
745
  # Command Execution
@@ -733,7 +757,7 @@ For long-running services (servers, listeners, watchers), background them with *
733
757
  2. **Stay in scope.** Only test targets and systems explicitly provided by the user or discovered within the authorized scope. Respect any scope constraints in the session config.
734
758
  3. **Handle failures gracefully.** If a tool call fails or a technique doesn't work, try alternative approaches. If your PoC approach fails repeatedly, pivot to a different technique.
735
759
  4. **Summarize results.** After completing a task, give the user a clear summary of what you found, what you tried, and what the next steps could be.
736
- 5. **No reports in scratchpad.** Do NOT write synthesized report documents to scratchpad/ (e.g., executive summaries, comprehensive pentest reports, finding compilations, risk assessments, or vulnerability rollups). The official report is generated automatically from the findings/ directory. Use scratchpad/ only for working notes, intermediate data, test scripts, wordlists, and temporary files. Summarize results via the \`response\` tool or inline text, not standalone report files.`;
760
+ ${reportRule}`;
737
761
  }
738
762
  var BASE_SYSTEM_PROMPT2 = buildBaseSystemPrompt2();
739
763
 
@@ -1769,6 +1793,7 @@ class OffensiveSecurityAgent2 {
1769
1793
  const tasksDir = input.tasksDir ?? (taskDriven ? input.subagentId ? join3(input.session.rootPath, "subagents", `${input.subagentId}-tasks`) : join3(input.session.rootPath, "tasks") : undefined);
1770
1794
  const credentialManager = input.credentialManager ?? input.session.credentialManager;
1771
1795
  const toolCtx = {
1796
+ findingPolicy: input.findingPolicy,
1772
1797
  ...input.attackSurfaceArtifactsPath ? { attackSurfaceArtifactsPath: input.attackSurfaceArtifactsPath } : {},
1773
1798
  session: input.session,
1774
1799
  agentCwd,
@@ -1845,9 +1870,13 @@ class OffensiveSecurityAgent2 {
1845
1870
  activeTools = [...activeTools, RESPONSE_TOOL_NAME2];
1846
1871
  }
1847
1872
  }
1873
+ if (input.findingPolicy === "external") {
1874
+ activeTools = activeTools.filter((name) => name !== "document_vulnerability");
1875
+ }
1848
1876
  activeTools = filterWorkspaceToolsForRun(activeTools, input.prompt, input.approvalGate !== undefined);
1849
1877
  const builtinTools = createToolsForNames2(toolCtx, activeTools);
1850
- let tools = input.extraTools ? { ...builtinTools, ...input.extraTools } : { ...builtinTools };
1878
+ const extraTools = input.findingPolicy === "external" && input.extraTools ? Object.fromEntries(Object.entries(input.extraTools).filter(([name]) => name !== "document_vulnerability")) : input.extraTools;
1879
+ let tools = extraTools ? { ...builtinTools, ...extraTools } : { ...builtinTools };
1851
1880
  if (input.toolExecutionRecorder) {
1852
1881
  tools = wrapRecordedTools(tools, input.toolExecutionRecorder);
1853
1882
  }
@@ -1872,7 +1901,7 @@ class OffensiveSecurityAgent2 {
1872
1901
  get: () => Promise.race([sr.response, this._drainRejection])
1873
1902
  }
1874
1903
  });
1875
- return customResolve(guarded);
1904
+ return customResolve(guarded, result);
1876
1905
  }).then((resolved) => {
1877
1906
  this._capturedResponse = resolved;
1878
1907
  this._resolveResponseCaptured(resolved);
@@ -1910,13 +1939,27 @@ class OffensiveSecurityAgent2 {
1910
1939
  mkdirSync2(messagesDir, { recursive: true });
1911
1940
  }
1912
1941
  this.messagesPath = join3(messagesDir, "messages.json");
1913
- const initialMessagesRef = {
1914
- current: input.messages ? [...input.messages] : [
1915
- {
1916
- role: "user",
1917
- content: [{ type: "text", text: input.prompt }]
1918
- }
1919
- ]
1942
+ const preparedContextRef = {
1943
+ current: {
1944
+ messages: input.messages ? [...input.messages] : [
1945
+ {
1946
+ role: "user",
1947
+ content: [{ type: "text", text: input.prompt }]
1948
+ }
1949
+ ],
1950
+ responseMessageOffset: 0
1951
+ }
1952
+ };
1953
+ const legacyMessages = (responseMessages) => [
1954
+ ...preparedContextRef.current.messages,
1955
+ ...responseMessages.slice(preparedContextRef.current.responseMessageOffset)
1956
+ ];
1957
+ const persistedMessages = (messages) => {
1958
+ let first = 0;
1959
+ while (messages[first]?.role === "system" && messages[first]?.providerOptions) {
1960
+ first++;
1961
+ }
1962
+ return first === 0 ? messages : messages.slice(first);
1920
1963
  };
1921
1964
  this.writer = new AgentMessageWriter({ messagesPath: this.messagesPath });
1922
1965
  this.finalizeInterruptedStep = createInterruptedStepFinalizer({
@@ -1930,10 +1973,11 @@ class OffensiveSecurityAgent2 {
1930
1973
  });
1931
1974
  const schedulePersist = () => this.writer.schedulePersist();
1932
1975
  const baseSystemPrompt = input.system ?? buildBaseSystemPrompt2({
1933
- sandboxMode: agentCwd === input.session.rootPath
1976
+ sandboxMode: agentCwd === input.session.rootPath,
1977
+ findingPolicy: input.findingPolicy
1934
1978
  });
1935
1979
  const commandPlatform = resolveCommandPlatform(toolCtx);
1936
- const workspaceSection = buildSessionWorkspaceSection2(input.session, agentCwd, activeTools, fileWorkspaceRoot);
1980
+ const workspaceSection = buildSessionWorkspaceSection2(input.session, agentCwd, activeTools, fileWorkspaceRoot, input.findingPolicy);
1937
1981
  const bundledAssets = input.backends || input.sandbox ? null : buildBundledAssetsSection();
1938
1982
  const assembleBaseSystemPrompt = (facts) => {
1939
1983
  const sections = [baseSystemPrompt];
@@ -1970,6 +2014,12 @@ class OffensiveSecurityAgent2 {
1970
2014
  usageRecorder: input.usageRecorder,
1971
2015
  contextRecorder: input.contextRecorder,
1972
2016
  inferenceRecorder: input.inferenceRecorder,
2017
+ onContextPrepared: (context) => {
2018
+ preparedContextRef.current = {
2019
+ messages: [...context.messages],
2020
+ responseMessageOffset: context.responseMessageOffset
2021
+ };
2022
+ },
1973
2023
  sessionPath: messagesDir,
1974
2024
  sessionId: this.busSessionId,
1975
2025
  onStepFinish: async (event) => {
@@ -1980,11 +2030,8 @@ class OffensiveSecurityAgent2 {
1980
2030
  await input.onStepFinish?.(event);
1981
2031
  return;
1982
2032
  }
1983
- const canonical = input.contextRecorder?.latest() ?? [
1984
- ...initialMessagesRef.current,
1985
- ...event.response.messages
1986
- ];
1987
- this.writer.setLatest(canonical);
2033
+ const canonical = input.contextRecorder?.latest() ?? legacyMessages(event.response.messages);
2034
+ this.writer.setLatest(persistedMessages(canonical));
1988
2035
  schedulePersist();
1989
2036
  traceWriter.recordStep(event.response.messages, stepUsage);
1990
2037
  this.eventBus.emit("step-finish", {
@@ -1997,16 +2044,16 @@ class OffensiveSecurityAgent2 {
1997
2044
  await input.onStepFinish?.(event);
1998
2045
  },
1999
2046
  onSummarized: () => {
2000
- initialMessagesRef.current = [];
2047
+ preparedContextRef.current = {
2048
+ messages: [],
2049
+ responseMessageOffset: 0
2050
+ };
2001
2051
  traceWriter.markSummarized();
2002
2052
  },
2003
2053
  onFinish: async (event) => {
2004
2054
  this.writer.cancelTimer();
2005
2055
  if (!this.writer.syntheticsPersisted) {
2006
- const finalMessages = input.contextRecorder?.latest() ?? this.writer.latest ?? [
2007
- ...initialMessagesRef.current,
2008
- ...event.response.messages
2009
- ];
2056
+ const finalMessages = persistedMessages(input.contextRecorder?.latest() ?? this.writer.latest ?? legacyMessages(event.response.messages));
2010
2057
  this.writer.setLatest(finalMessages);
2011
2058
  await this.writer.enqueueWrite(finalMessages).catch(() => {});
2012
2059
  }
@@ -2426,4 +2473,8 @@ function safePreview(value) {
2426
2473
  return "[unserializable result]";
2427
2474
  }
2428
2475
  }
2429
- export { buildProvidedFilesSection2, buildSessionWorkspaceSection2, buildBaseSystemPrompt2, BASE_SYSTEM_PROMPT2, StepTraceWriter2, OffensiveSecurityAgent2, exports_offSecAgent };
2476
+
2477
+ // src/core/agents/offSecAgent/index.ts
2478
+ var EXTERNAL_FINDING_POLICY_CAPABILITY2 = "v1";
2479
+
2480
+ export { buildProvidedFilesSection2, buildSessionWorkspaceSection2, buildBaseSystemPrompt2, BASE_SYSTEM_PROMPT2, StepTraceWriter2, OffensiveSecurityAgent2, EXTERNAL_FINDING_POLICY_CAPABILITY2, exports_offSecAgent };