@pensar/apex 2.3.0 → 2.4.0-canary.09a8744f

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 (81) hide show
  1. package/build/{agent-9xna7jhw.js → agent-4gcavfr4.js} +12 -11
  2. package/build/agent-7x7b5hz1.js +30 -0
  3. package/build/agent-zx1cw89c.js +20 -0
  4. package/build/{apps-43pqbz7r.js → apps-xqecgcbn.js} +75 -34
  5. package/build/{auth-c1z670rx.js → auth-62z3kedh.js} +46 -23
  6. package/build/authentication-phbasmkj.js +20 -0
  7. package/build/blackboxAgent-3s34dabp.js +20 -0
  8. package/build/blackboxPentest-mg2p9s1m.js +70 -0
  9. package/build/{cli-zk1ch6qf.js → cli-4a1c4tkn.js} +61 -10
  10. package/build/{cli-zx8gk8xv.js → cli-51503njj.js} +661 -328
  11. package/build/cli-53rm0rrz.js +15 -0
  12. package/build/{cli-eveg9djy.js → cli-5tbg4dyb.js} +3 -2
  13. package/build/cli-68260ckj.js +12136 -0
  14. package/build/{cli-baqhqbe5.js → cli-7gcsfnw6.js} +3 -3
  15. package/build/cli-7q3ae3ft.js +6 -0
  16. package/build/{cli-72b18z0n.js → cli-8nj7pnew.js} +28 -5
  17. package/build/{cli-f7hanqbw.js → cli-9fds4ss0.js} +2 -2
  18. package/build/cli-9pbk8m32.js +32 -0
  19. package/build/{cli-3k1x5rn3.js → cli-avmhkjtv.js} +2970 -4450
  20. package/build/{cli-vckbhnyk.js → cli-b3d97zgc.js} +2 -2
  21. package/build/{cli-8rxa073f.js → cli-bc05qbss.js} +8 -6
  22. package/build/{cli-7tw4xfnw.js → cli-cdk877bx.js} +1 -1
  23. package/build/{cli-q24twygk.js → cli-dm0fc0bm.js} +1 -1
  24. package/build/{cli-barsn8br.js → cli-e1gmqsyh.js} +11 -5
  25. package/build/{cli-yz80qkzn.js → cli-ee3axgts.js} +7 -1
  26. package/build/{cli-f71s6kcw.js → cli-ex9r1x7c.js} +81 -215
  27. package/build/{cli-n2m2yy5b.js → cli-hc4w41as.js} +2105 -957
  28. package/build/{cli-gpnb45ck.js → cli-j54qa6tm.js} +7 -7
  29. package/build/{cli-j0n189ee.js → cli-j5p6jwm8.js} +2 -2
  30. package/build/{cli-wszshs5e.js → cli-k71t434r.js} +4 -4
  31. package/build/cli-knd276ed.js +1485 -0
  32. package/build/{cli-zm8tfpv7.js → cli-n36kxpcz.js} +62 -44
  33. package/build/{cli-bv2807tj.js → cli-n4cmzq79.js} +5 -3
  34. package/build/{cli-jyp2c6th.js → cli-nvqny4ej.js} +5 -3
  35. package/build/{cli-50906d27.js → cli-nw9ytp7z.js} +122 -43
  36. package/build/{cli-bnkgdywr.js → cli-ppj4c75j.js} +1 -1
  37. package/build/cli.js +546 -98
  38. package/build/{config-jzqjz606.js → config-7f07yemp.js} +20 -17
  39. package/build/{doctor-q3qws68e.js → doctor-gwvyn249.js} +11 -9
  40. package/build/{fastStrike-ebz1ph9a.js → fastStrike-zxsk2q40.js} +39 -16
  41. package/build/{fixes-86yebsj0.js → fixes-zqe8v8ye.js} +27 -22
  42. package/build/getMachineId-bsd-xj3bn2fv.js +36 -0
  43. package/build/getMachineId-darwin-07jzjcx6.js +36 -0
  44. package/build/getMachineId-linux-ahngynxd.js +29 -0
  45. package/build/getMachineId-unsupported-vy43b44z.js +19 -0
  46. package/build/getMachineId-win-8x66cynz.js +38 -0
  47. package/build/{index-32hn8rrw.js → index-4j14ssrg.js} +3 -3
  48. package/build/{index-gq9h8j5j.js → index-5wh7gq37.js} +135 -133
  49. package/build/{index-468j74f3.js → index-6s313ddp.js} +121 -97
  50. package/build/{index-e8c8zcrf.js → index-9j3pakz7.js} +32 -26
  51. package/build/{index-h2hj2hj9.js → index-cbwn03kz.js} +16 -16
  52. package/build/{index-8db1d2q3.js → index-cmvmnes1.js} +18 -18
  53. package/build/{index-tke6896d.js → index-psqjpw5m.js} +10 -10
  54. package/build/index-r4z6r7vf.js +12 -0
  55. package/build/{index-97vx1a24.js → index-rdqjtnp7.js} +2774 -2236
  56. package/build/{index-mr2cseg4.js → index-wddghhbd.js} +20 -19
  57. package/build/{issues-kh4wg8c5.js → issues-j7ybeaz9.js} +36 -28
  58. package/build/{logs-bj28xmbf.js → logs-qdceq54y.js} +27 -22
  59. package/build/{multipart-parser-6zd16497.js → multipart-parser-g2xxkezz.js} +2 -2
  60. package/build/{offesecAgent-8ky7gccp.js → offesecAgent-9tecezzm.js} +12 -11
  61. package/build/{parse-7djk9jyf.js → parse-rtccymzn.js} +3 -3
  62. package/build/pentest-qk82s64n.js +30 -0
  63. package/build/{pentests-62d6zw6p.js → pentests-97d3rwzr.js} +28 -23
  64. package/build/{targetedPentest-me4jnr3z.js → targetedPentest-g9x0g0zp.js} +15 -14
  65. package/build/{targets-e5k1mrky.js → targets-6m1cp1hx.js} +29 -24
  66. package/build/threatModel-a4gsw56r.js +29 -0
  67. package/build/{token-rdcbn380.js → token-3bbp59y6.js} +3 -3
  68. package/build/{token-util-sxb85ahn.js → token-util-6xjme11b.js} +2 -2
  69. package/build/{uninstall-jt1bca2p.js → uninstall-pkxkzt35.js} +7 -4
  70. package/build/{upload-krd8bnex.js → upload-w71jnkg0.js} +12 -11
  71. package/build/{utils-skmqhyfg.js → utils-846z7q2v.js} +18 -13
  72. package/package.json +8 -2
  73. package/build/agent-71z4e7jg.js +0 -19
  74. package/build/agent-ga5fecfs.js +0 -27
  75. package/build/authentication-hgs7ym0m.js +0 -19
  76. package/build/blackboxAgent-gem3mxa9.js +0 -19
  77. package/build/blackboxPentest-tgc2t3y6.js +0 -37
  78. package/build/index-ag14v3sg.js +0 -12
  79. package/build/main-3d7dfdvs.js +0 -324
  80. package/build/pentest-rs0181nf.js +0 -29
  81. package/build/threatModel-k4f3zgqd.js +0 -27
@@ -1,28 +1,28 @@
1
+ import {
2
+ AppsDiscoveryResultSchema,
3
+ DiscoverySummarySchema,
4
+ EndpointSchema,
5
+ WHITEBOX_APPS_DISCOVERY_SYSTEM_PROMPT,
6
+ WHITEBOX_DISCOVERY_SYSTEM_PROMPT,
7
+ WHITEBOX_ENDPOINT_DOCUMENTATION_SYSTEM_PROMPT
8
+ } from "./cli-7gcsfnw6.js";
1
9
  import {
2
10
  BlackboxAttackSurfaceAgent
3
- } from "./cli-bv2807tj.js";
11
+ } from "./cli-n4cmzq79.js";
12
+ import {
13
+ TargetedPentestAgent,
14
+ buildPentestSystemPrompt
15
+ } from "./cli-nw9ytp7z.js";
4
16
  import {
5
17
  REPORT_FILENAME_JSON,
6
18
  REPORT_FILENAME_MD,
7
19
  buildPentestReport,
8
20
  renderJson,
9
21
  renderMarkdown
10
- } from "./cli-72b18z0n.js";
11
- import {
12
- TargetedPentestAgent,
13
- buildPentestSystemPrompt
14
- } from "./cli-50906d27.js";
22
+ } from "./cli-8nj7pnew.js";
15
23
  import {
16
24
  CodeAgent
17
- } from "./cli-j0n189ee.js";
18
- import {
19
- AppsDiscoveryResultSchema,
20
- DiscoverySummarySchema,
21
- EndpointSchema,
22
- WHITEBOX_APPS_DISCOVERY_SYSTEM_PROMPT,
23
- WHITEBOX_DISCOVERY_SYSTEM_PROMPT,
24
- WHITEBOX_ENDPOINT_DOCUMENTATION_SYSTEM_PROMPT
25
- } from "./cli-baqhqbe5.js";
25
+ } from "./cli-j5p6jwm8.js";
26
26
  import {
27
27
  FindingsRegistry,
28
28
  OffensiveSecurityAgent,
@@ -31,7 +31,7 @@ import {
31
31
  pLimit,
32
32
  runWithBoundedConcurrency,
33
33
  toGrpcPentestContext
34
- } from "./cli-n2m2yy5b.js";
34
+ } from "./cli-hc4w41as.js";
35
35
  import {
36
36
  createThreatModelPrompt
37
37
  } from "./cli-fw5r7pfj.js";
@@ -45,10 +45,10 @@ import {
45
45
  init_structured,
46
46
  newSessionId,
47
47
  scopedLogger
48
- } from "./cli-zx8gk8xv.js";
48
+ } from "./cli-51503njj.js";
49
49
  import {
50
50
  __require
51
- } from "./cli-8rxa073f.js";
51
+ } from "./cli-bc05qbss.js";
52
52
 
53
53
  // src/core/workflows/pentest.ts
54
54
  init_dist();
@@ -126,9 +126,23 @@ function normalizeTokenUsage(value) {
126
126
  return {
127
127
  inputTokens,
128
128
  outputTokens,
129
+ cacheReadTokens: toNonNegativeInteger(value?.cacheReadTokens),
130
+ cacheWriteTokens: toNonNegativeInteger(value?.cacheWriteTokens),
129
131
  totalTokens: explicitTotal > 0 ? explicitTotal : derivedTotal
130
132
  };
131
133
  }
134
+ function normalizeContextUsage(value) {
135
+ if (typeof value !== "object" || value === null)
136
+ return;
137
+ const v = value;
138
+ if (typeof v.modelId !== "string" || v.modelId.length === 0)
139
+ return;
140
+ return {
141
+ modelId: v.modelId,
142
+ usedTokens: toNonNegativeInteger(v.usedTokens),
143
+ contextLimit: toNonNegativeInteger(v.contextLimit)
144
+ };
145
+ }
132
146
  function metricsPath(sessionRootPath) {
133
147
  return join(sessionRootPath, EXECUTION_METRICS_FILENAME);
134
148
  }
@@ -143,6 +157,7 @@ function readExecutionMetrics(sessionRootPath) {
143
157
  const parsed = JSON.parse(readFileSync(path, "utf-8"));
144
158
  return {
145
159
  tokenUsage: normalizeTokenUsage(parsed.tokenUsage),
160
+ contextUsage: normalizeContextUsage(parsed.contextUsage),
146
161
  runtime: typeof parsed.runtime === "string" ? parsed.runtime : undefined,
147
162
  elapsedSeconds: toNonNegativeInteger(parsed.elapsedSeconds) || undefined,
148
163
  updatedAt: typeof parsed.updatedAt === "string" ? parsed.updatedAt : new Date().toISOString()
@@ -167,10 +182,13 @@ function writeExecutionMetrics(input) {
167
182
  const nextTokenUsage = input.tokenUsage ? normalizeTokenUsage(input.tokenUsage) : existing?.tokenUsage ?? {
168
183
  inputTokens: 0,
169
184
  outputTokens: 0,
185
+ cacheReadTokens: 0,
186
+ cacheWriteTokens: 0,
170
187
  totalTokens: 0
171
188
  };
172
189
  const next = {
173
190
  tokenUsage: nextTokenUsage,
191
+ contextUsage: input.contextUsage ?? existing?.contextUsage,
174
192
  runtime: input.runtime ?? existing?.runtime,
175
193
  elapsedSeconds: input.elapsedSeconds ?? existing?.elapsedSeconds,
176
194
  updatedAt: new Date().toISOString()
@@ -7639,16 +7657,6 @@ When finished, call \`response\` with a summary of how many entry points you doc
7639
7657
  // src/core/workflows/pentest.ts
7640
7658
  var log5 = scopedLogger(() => createLogger("pentest-swarm"));
7641
7659
  var DEFAULT_CONCURRENCY2 = 10;
7642
- function addUsageTotals(totals, usage) {
7643
- if (!usage)
7644
- return;
7645
- const inputTokens = usage.inputTokens ?? 0;
7646
- const outputTokens = usage.outputTokens ?? 0;
7647
- const totalTokens = usage.totalTokens ?? inputTokens + outputTokens;
7648
- totals.inputTokens += inputTokens;
7649
- totals.outputTokens += outputTokens;
7650
- totals.totalTokens += totalTokens;
7651
- }
7652
7660
  async function runPentestSwarm(input) {
7653
7661
  const {
7654
7662
  targets,
@@ -7661,6 +7669,7 @@ async function runPentestSwarm(input) {
7661
7669
  onError,
7662
7670
  concurrency = DEFAULT_CONCURRENCY2,
7663
7671
  onStepFinish,
7672
+ onCacheMetrics,
7664
7673
  enableThinking,
7665
7674
  thinkingEffort,
7666
7675
  openAIReasoningEffort,
@@ -7692,6 +7701,12 @@ async function runPentestSwarm(input) {
7692
7701
  });
7693
7702
  if (session.config?.requirePlan && session.config?.taskDriven && previousMessages.length === 0) {
7694
7703
  try {
7704
+ eventBus?.emit("subagent-spawn", {
7705
+ subagentId: `${subagentId}-plan`,
7706
+ name: `${subagentName} (plan)`,
7707
+ input: { target: target.target, objectives: target.objectives },
7708
+ parentSubagentId: subagentId
7709
+ });
7695
7710
  const executionTasksDir = join18(session.rootPath, "subagents", `${subagentId}-tasks`);
7696
7711
  const planAgent = new OffensiveSecurityAgent({
7697
7712
  system: PLAN_PHASE_SYSTEM_PROMPT,
@@ -7711,13 +7726,25 @@ async function runPentestSwarm(input) {
7711
7726
  tasksDir: executionTasksDir,
7712
7727
  planSubagentId: subagentId,
7713
7728
  eventBus,
7729
+ onStepFinish,
7730
+ onCacheMetrics,
7714
7731
  enableThinking,
7715
7732
  thinkingEffort,
7716
7733
  openAIReasoningEffort,
7717
7734
  display
7718
7735
  });
7719
7736
  await planAgent.consume();
7737
+ eventBus?.emit("subagent-complete", {
7738
+ subagentId: `${subagentId}-plan`,
7739
+ status: "completed",
7740
+ parentSubagentId: subagentId
7741
+ });
7720
7742
  } catch (planErr) {
7743
+ eventBus?.emit("subagent-complete", {
7744
+ subagentId: `${subagentId}-plan`,
7745
+ status: "failed",
7746
+ parentSubagentId: subagentId
7747
+ });
7721
7748
  log5.warn(`Plan phase failed for ${subagentId}: ${planErr}`);
7722
7749
  }
7723
7750
  }
@@ -7734,6 +7761,8 @@ async function runPentestSwarm(input) {
7734
7761
  abortSignal,
7735
7762
  findingsRegistry,
7736
7763
  onStepFinish: handleStepFinish,
7764
+ onCacheMetrics,
7765
+ forwardUsageCallbacksToSpawnedAgents: true,
7737
7766
  messages: previousMessages.length > 0 ? previousMessages : undefined,
7738
7767
  eventBus,
7739
7768
  subagentId,
@@ -7786,7 +7815,7 @@ async function runPentestSwarm(input) {
7786
7815
  }
7787
7816
  async function runPentestWorkflow(input) {
7788
7817
  if (input.fastStrike) {
7789
- const { runFastStrike } = await import("./fastStrike-ebz1ph9a.js");
7818
+ const { runFastStrike } = await import("./fastStrike-zxsk2q40.js");
7790
7819
  return runFastStrike(input);
7791
7820
  }
7792
7821
  const {
@@ -7823,17 +7852,6 @@ async function runPentestWorkflow(input) {
7823
7852
  ${combined}` : combined;
7824
7853
  }
7825
7854
  const startedAt = Date.now();
7826
- const tokenUsageTotals = {
7827
- inputTokens: 0,
7828
- outputTokens: 0,
7829
- totalTokens: 0
7830
- };
7831
- const wrappedOnStepFinish = (event) => {
7832
- addUsageTotals(tokenUsageTotals, event.usage);
7833
- if (onStepFinish) {
7834
- onStepFinish(event);
7835
- }
7836
- };
7837
7855
  try {
7838
7856
  const mode = cwd ? "whitebox" : "blackbox";
7839
7857
  let swarmTargets;
@@ -7870,7 +7888,7 @@ ${combined}` : combined;
7870
7888
  authConfig,
7871
7889
  abortSignal,
7872
7890
  eventBus,
7873
- onStepFinish: wrappedOnStepFinish,
7891
+ onStepFinish,
7874
7892
  onCacheMetrics,
7875
7893
  openAIReasoningEffort,
7876
7894
  surfaceIntegrationEnabled
@@ -7883,7 +7901,7 @@ ${combined}` : combined;
7883
7901
  authConfig,
7884
7902
  abortSignal,
7885
7903
  eventBus,
7886
- onStepFinish: wrappedOnStepFinish,
7904
+ onStepFinish,
7887
7905
  onCacheMetrics,
7888
7906
  openAIReasoningEffort
7889
7907
  });
@@ -7936,7 +7954,8 @@ ${combined}` : combined;
7936
7954
  abortSignal,
7937
7955
  findingsRegistry,
7938
7956
  eventBus,
7939
- onStepFinish: wrappedOnStepFinish,
7957
+ onStepFinish,
7958
+ onCacheMetrics,
7940
7959
  enableThinking,
7941
7960
  thinkingEffort,
7942
7961
  openAIReasoningEffort
@@ -7984,7 +8003,6 @@ ${combined}` : combined;
7984
8003
  const runtime = formatDurationHmsFromMs(Date.now() - startedAt);
7985
8004
  writeExecutionMetrics({
7986
8005
  sessionRootPath: session.rootPath,
7987
- tokenUsage: tokenUsageTotals,
7988
8006
  runtime
7989
8007
  });
7990
8008
  }
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  OffensiveSecurityAgent
3
- } from "./cli-n2m2yy5b.js";
3
+ } from "./cli-hc4w41as.js";
4
4
  import {
5
5
  detectOSAndEnhancePrompt
6
- } from "./cli-7tw4xfnw.js";
6
+ } from "./cli-cdk877bx.js";
7
7
  import {
8
8
  hasToolCall,
9
9
  init_dist,
10
10
  stepCountIs
11
- } from "./cli-zx8gk8xv.js";
11
+ } from "./cli-51503njj.js";
12
12
 
13
13
  // src/core/agents/specialized/attackSurface/blackboxAgent.ts
14
14
  init_dist();
@@ -438,6 +438,7 @@ class BlackboxAttackSurfaceAgent extends OffensiveSecurityAgent {
438
438
  "email_search_messages",
439
439
  "email_get_message",
440
440
  "send_email",
441
+ "sms_list_messages",
441
442
  "web_search",
442
443
  "get_page"
443
444
  ],
@@ -483,6 +484,7 @@ ${authenticationInstructions}
483
484
  Your FIRST tool call must be: browser_navigate to ${loginTarget}
484
485
  Then use browser tools to authenticate. Pass the credentialId to delegate_to_auth_subagent — secrets are resolved automatically.
485
486
  For browser_fill on password/secret fields, use credentialId + credentialField instead of raw values.
487
+ When a credential has a phoneNumber additional field (Mobile OTP / sms-passwordless), phone is the login identifier — not MFA-after-password. Fill credentialField="phoneNumber", click send-code, sleep with execute_command, then sms_list_messages with sinceMs from that click (claim=true once a message is present). If the list stays empty, stop and report — do not hang. Do not report phone_verification as a barrier. TOTP-via-env for authenticator MFA is unchanged.
486
488
 
487
489
  Do NOT run curl, nmap, dig, or any other command before completing login.
488
490
  Include authentication information with EVERY target that requires it in your final report.
@@ -1,11 +1,12 @@
1
1
  import {
2
+ AttackPathSchema,
2
3
  CweEntrySchema,
3
4
  ValidatedCweEntrySchema
4
- } from "./cli-n2m2yy5b.js";
5
+ } from "./cli-hc4w41as.js";
5
6
  import {
6
7
  exports_external,
7
8
  init_zod
8
- } from "./cli-3k1x5rn3.js";
9
+ } from "./cli-avmhkjtv.js";
9
10
 
10
11
  // src/core/agents/offSecAgent/types.ts
11
12
  init_zod();
@@ -47,7 +48,8 @@ var ApexFindingObject = exports_external.object({
47
48
  rootCauseGroup: exports_external.string().optional(),
48
49
  relatedFindings: exports_external.array(exports_external.string()).optional(),
49
50
  rootCauseLead: exports_external.boolean().optional(),
50
- evidenceFiles: exports_external.array(EvidenceFileEntrySchema).optional()
51
+ evidenceFiles: exports_external.array(EvidenceFileEntrySchema).optional(),
52
+ attackPath: AttackPathSchema.optional()
51
53
  });
52
54
 
53
55
  export { EvidenceFileEntrySchema, ApexFindingObject };