@pensar/apex 2.1.2 → 2.1.3-canary.0b888140

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 (57) hide show
  1. package/build/{agent-737mxp3v.js → agent-n8yfa2cc.js} +9 -8
  2. package/build/agent-y48rvewr.js +19 -0
  3. package/build/agent-ze5p1asw.js +27 -0
  4. package/build/{apps-j0bwey0w.js → apps-v04nd6vm.js} +16 -16
  5. package/build/{auth-5stxpmga.js → auth-hsw3vft6.js} +16 -16
  6. package/build/authentication-gcedx2a8.js +19 -0
  7. package/build/blackboxAgent-faefrq9c.js +19 -0
  8. package/build/{blackboxPentest-2edr9rj3.js → blackboxPentest-t6q90wst.js} +14 -14
  9. package/build/{cli-jd0c0b91.js → cli-17ng16p8.js} +1 -1
  10. package/build/{cli-f7d23ded.js → cli-29yqhrjq.js} +936 -1775
  11. package/build/{cli-whtdyc0e.js → cli-392r62e5.js} +6 -4
  12. package/build/{cli-xnnkeg5p.js → cli-4q0ztagc.js} +1 -1
  13. package/build/{cli-yjbkaqvy.js → cli-6fbhny5y.js} +79 -23
  14. package/build/{cli-6wwpk9d9.js → cli-840req7g.js} +1 -1
  15. package/build/{cli-tw3fe8bj.js → cli-c8n6gjbg.js} +2 -2
  16. package/build/{cli-0gk2x2sc.js → cli-fnx674a0.js} +18 -18
  17. package/build/{cli-v1aqbv58.js → cli-fyxdrpws.js} +23379 -25281
  18. package/build/{cli-ks60cc3h.js → cli-k6cyzj2y.js} +30 -30
  19. package/build/{cli-35czfv00.js → cli-sh1d5f84.js} +70834 -79383
  20. package/build/{cli-dqkdnd3c.js → cli-svyns7bq.js} +88 -49
  21. package/build/{cli-gbkj2has.js → cli-t4aygjwm.js} +5 -3
  22. package/build/{cli-hj3t87r2.js → cli-tmdgp58p.js} +1 -1
  23. package/build/{cli-9vzc18m5.js → cli-vaafhq79.js} +41 -17
  24. package/build/{cli-9z6vwf30.js → cli-xecc5fgb.js} +1 -1
  25. package/build/{cli-6vs0mtsb.js → cli-xjw661db.js} +4 -2
  26. package/build/cli.js +110 -88
  27. package/build/{config-s5ryv5ez.js → config-ybydaxvy.js} +3 -3
  28. package/build/{doctor-f08gegwc.js → doctor-1cv49qyd.js} +7 -7
  29. package/build/{fixes-qf4s92z2.js → fixes-vq3r0671.js} +16 -16
  30. package/build/{index-exvkbve0.js → index-73h1f0ee.js} +4 -4
  31. package/build/{index-c6qz0gve.js → index-9d6rdna8.js} +7 -7
  32. package/build/{index-sqjve2bm.js → index-f4j2dvza.js} +2 -2
  33. package/build/{index-s8gw83d6.js → index-kkev8e4x.js} +17 -11
  34. package/build/{index-gakk2t5q.js → index-mxgy0n60.js} +20 -18
  35. package/build/{index-mgng15va.js → index-n1yh9e86.js} +909 -456
  36. package/build/{index-5h1hjhzw.js → index-p0ge9ctv.js} +10 -10
  37. package/build/{index-x4xefngs.js → index-wdve6p4j.js} +3 -3
  38. package/build/{issues-5anqrh2j.js → issues-absynd7t.js} +16 -16
  39. package/build/{logs-q6ankt6m.js → logs-71wvy182.js} +16 -16
  40. package/build/{main-3zneyg7p.js → main-3d7dfdvs.js} +17 -93
  41. package/build/{offesecAgent-hsej0pfc.js → offesecAgent-3rvcmynm.js} +9 -9
  42. package/build/pentest-d3zqcth5.js +28 -0
  43. package/build/{pentests-hyx3c3qa.js → pentests-rxar1kh8.js} +16 -16
  44. package/build/targetedPentest-pkk863xy.js +44 -0
  45. package/build/{targets-9cqrshet.js → targets-05hzc6xf.js} +16 -16
  46. package/build/threatModel-rre32qf1.js +26 -0
  47. package/build/{uninstall-1j469qj7.js → uninstall-mf8p7h39.js} +1 -1
  48. package/build/{upload-ymvhkyq5.js → upload-c90wytbp.js} +7 -7
  49. package/build/{utils-d1ed6jzf.js → utils-exr1m4tq.js} +6 -6
  50. package/package.json +30 -30
  51. package/build/agent-8w9h3tnw.js +0 -19
  52. package/build/agent-vdrtakz4.js +0 -25
  53. package/build/authentication-qswvctj4.js +0 -19
  54. package/build/blackboxAgent-vwm9t3h4.js +0 -19
  55. package/build/pentest-1e30q7rs.js +0 -28
  56. package/build/targetedPentest-ws0a7frk.js +0 -36
  57. package/build/threatModel-z9b213x8.js +0 -26
@@ -4,27 +4,27 @@ import {
4
4
  OffensiveSecurityAgent,
5
5
  SKILL_TOOL_NAMES,
6
6
  buildBaseSystemPrompt
7
- } from "./cli-35czfv00.js";
7
+ } from "./cli-sh1d5f84.js";
8
8
  import {
9
9
  init_dist,
10
10
  init_session,
11
11
  sessions,
12
12
  stepCountIs
13
- } from "./cli-v1aqbv58.js";
13
+ } from "./cli-fyxdrpws.js";
14
14
  import {
15
15
  ensureValidToken,
16
16
  getPensarApiUrl,
17
17
  init_auth,
18
18
  init_constants
19
- } from "./cli-hj3t87r2.js";
19
+ } from "./cli-tmdgp58p.js";
20
20
  import {
21
21
  exports_external,
22
22
  init_zod
23
- } from "./cli-f7d23ded.js";
23
+ } from "./cli-29yqhrjq.js";
24
24
  import {
25
25
  config,
26
26
  init_config
27
- } from "./cli-9z6vwf30.js";
27
+ } from "./cli-xecc5fgb.js";
28
28
  import {
29
29
  __commonJS,
30
30
  __require
@@ -583,6 +583,8 @@ var require_Alias = __commonJS((exports) => {
583
583
  });
584
584
  }
585
585
  resolve(doc, ctx) {
586
+ if (ctx?.maxAliasCount === 0)
587
+ throw new ReferenceError("Alias resolution is disabled");
586
588
  let nodes;
587
589
  if (ctx?.aliasResolveCache) {
588
590
  nodes = ctx.aliasResolveCache;
@@ -1362,6 +1364,7 @@ var require_stringify = __commonJS((exports) => {
1362
1364
  nullStr: "null",
1363
1365
  simpleKeys: false,
1364
1366
  singleQuote: null,
1367
+ trailingComma: false,
1365
1368
  trueStr: "true",
1366
1369
  verifyAliasOrder: true
1367
1370
  }, doc.schema.toStringOptions, options);
@@ -1631,18 +1634,18 @@ var require_merge = __commonJS((exports) => {
1631
1634
  };
1632
1635
  var isMergeKey = (ctx, key) => (merge.identify(key) || identity.isScalar(key) && (!key.type || key.type === Scalar.Scalar.PLAIN) && merge.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge.tag && tag.default);
1633
1636
  function addMergeToJSMap(ctx, map, value) {
1634
- value = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
1635
- if (identity.isSeq(value))
1636
- for (const it of value.items)
1637
+ const source = resolveAliasValue(ctx, value);
1638
+ if (identity.isSeq(source))
1639
+ for (const it of source.items)
1637
1640
  mergeValue(ctx, map, it);
1638
- else if (Array.isArray(value))
1639
- for (const it of value)
1641
+ else if (Array.isArray(source))
1642
+ for (const it of source)
1640
1643
  mergeValue(ctx, map, it);
1641
1644
  else
1642
- mergeValue(ctx, map, value);
1645
+ mergeValue(ctx, map, source);
1643
1646
  }
1644
1647
  function mergeValue(ctx, map, value) {
1645
- const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
1648
+ const source = resolveAliasValue(ctx, value);
1646
1649
  if (!identity.isMap(source))
1647
1650
  throw new Error("Merge sources must be maps or map aliases");
1648
1651
  const srcMap = source.toJSON(null, ctx, Map);
@@ -1663,6 +1666,9 @@ var require_merge = __commonJS((exports) => {
1663
1666
  }
1664
1667
  return map;
1665
1668
  }
1669
+ function resolveAliasValue(ctx, value) {
1670
+ return ctx && identity.isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
1671
+ }
1666
1672
  exports.addMergeToJSMap = addMergeToJSMap;
1667
1673
  exports.isMergeKey = isMergeKey;
1668
1674
  exports.merge = merge;
@@ -1870,13 +1876,20 @@ ${indent}${line}` : `
1870
1876
  if (comment)
1871
1877
  reqNewline = true;
1872
1878
  let str = stringify.stringify(item, itemCtx, () => comment = null);
1873
- if (i < items.length - 1)
1879
+ reqNewline || (reqNewline = lines.length > linesAtValue || str.includes(`
1880
+ `));
1881
+ if (i < items.length - 1) {
1874
1882
  str += ",";
1883
+ } else if (ctx.options.trailingComma) {
1884
+ if (ctx.options.lineWidth > 0) {
1885
+ reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) + (str.length + 2) > ctx.options.lineWidth);
1886
+ }
1887
+ if (reqNewline) {
1888
+ str += ",";
1889
+ }
1890
+ }
1875
1891
  if (comment)
1876
1892
  str += stringifyComment.lineComment(str, itemIndent, commentString(comment));
1877
- if (!reqNewline && (lines.length > linesAtValue || str.includes(`
1878
- `)))
1879
- reqNewline = true;
1880
1893
  lines.push(str);
1881
1894
  linesAtValue = lines.length;
1882
1895
  }
@@ -2231,7 +2244,7 @@ var require_stringifyNumber = __commonJS((exports) => {
2231
2244
  if (!isFinite(num))
2232
2245
  return isNaN(num) ? ".nan" : num < 0 ? "-.inf" : ".inf";
2233
2246
  let n = Object.is(value, -0) ? "-0" : JSON.stringify(value);
2234
- if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^\d/.test(n)) {
2247
+ if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^-?\d/.test(n) && !n.includes("e")) {
2235
2248
  let i = n.indexOf(".");
2236
2249
  if (i < 0) {
2237
2250
  i = n.length;
@@ -4456,7 +4469,7 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
4456
4469
  while (next === " " || next === "\t")
4457
4470
  next = source[++i + 1];
4458
4471
  } else if (next === "x" || next === "u" || next === "U") {
4459
- const length = { x: 2, u: 4, U: 8 }[next];
4472
+ const length = next === "x" ? 2 : next === "u" ? 4 : 8;
4460
4473
  res += parseCharCode(source, i + 1, length, onError);
4461
4474
  i += length;
4462
4475
  } else {
@@ -4525,12 +4538,13 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
4525
4538
  const cc = source.substr(offset, length);
4526
4539
  const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
4527
4540
  const code = ok ? parseInt(cc, 16) : NaN;
4528
- if (isNaN(code)) {
4541
+ try {
4542
+ return String.fromCodePoint(code);
4543
+ } catch {
4529
4544
  const raw = source.substr(offset - 2, length + 2);
4530
4545
  onError(offset - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${raw}`);
4531
4546
  return raw;
4532
4547
  }
4533
- return String.fromCodePoint(code);
4534
4548
  }
4535
4549
  exports.resolveFlowScalar = resolveFlowScalar;
4536
4550
  });
@@ -4671,17 +4685,22 @@ var require_compose_node = __commonJS((exports) => {
4671
4685
  case "block-map":
4672
4686
  case "block-seq":
4673
4687
  case "flow-collection":
4674
- node = composeCollection.composeCollection(CN, ctx, token, props, onError);
4675
- if (anchor)
4676
- node.anchor = anchor.source.substring(1);
4688
+ try {
4689
+ node = composeCollection.composeCollection(CN, ctx, token, props, onError);
4690
+ if (anchor)
4691
+ node.anchor = anchor.source.substring(1);
4692
+ } catch (error) {
4693
+ const message = error instanceof Error ? error.message : String(error);
4694
+ onError(token, "RESOURCE_EXHAUSTION", message);
4695
+ }
4677
4696
  break;
4678
4697
  default: {
4679
4698
  const message = token.type === "error" ? token.message : `Unsupported token (type: ${token.type})`;
4680
4699
  onError(token, "UNEXPECTED_TOKEN", message);
4681
- node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError);
4682
4700
  isSrcToken = false;
4683
4701
  }
4684
4702
  }
4703
+ node ?? (node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError));
4685
4704
  if (anchor && node.anchor === "")
4686
4705
  onError(anchor, "BAD_ALIAS", "Anchor cannot be an empty string");
4687
4706
  if (atKey && ctx.options.stringKeys && (!identity.isScalar(node) || typeof node.value !== "string" || node.tag && node.tag !== "tag:yaml.org,2002:str")) {
@@ -4864,8 +4883,10 @@ ${cb}` : comment;
4864
4883
  }
4865
4884
  }
4866
4885
  if (afterDoc) {
4867
- Array.prototype.push.apply(doc.errors, this.errors);
4868
- Array.prototype.push.apply(doc.warnings, this.warnings);
4886
+ for (let i = 0;i < this.errors.length; ++i)
4887
+ doc.errors.push(this.errors[i]);
4888
+ for (let i = 0;i < this.warnings.length; ++i)
4889
+ doc.warnings.push(this.warnings[i]);
4869
4890
  } else {
4870
4891
  doc.errors = this.errors;
4871
4892
  doc.warnings = this.warnings;
@@ -5577,7 +5598,7 @@ var require_lexer = __commonJS((exports) => {
5577
5598
  const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
5578
5599
  this.indentNext = this.indentValue + 1;
5579
5600
  this.indentValue += n;
5580
- return yield* this.parseBlockStart();
5601
+ return "block-start";
5581
5602
  }
5582
5603
  return "doc";
5583
5604
  }
@@ -5884,26 +5905,37 @@ var require_lexer = __commonJS((exports) => {
5884
5905
  return 0;
5885
5906
  }
5886
5907
  *pushIndicators() {
5887
- switch (this.charAt(0)) {
5888
- case "!":
5889
- return (yield* this.pushTag()) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators());
5890
- case "&":
5891
- return (yield* this.pushUntil(isNotAnchorChar)) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators());
5892
- case "-":
5893
- case "?":
5894
- case ":": {
5895
- const inFlow = this.flowLevel > 0;
5896
- const ch1 = this.charAt(1);
5897
- if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) {
5898
- if (!inFlow)
5899
- this.indentNext = this.indentValue + 1;
5900
- else if (this.flowKey)
5901
- this.flowKey = false;
5902
- return (yield* this.pushCount(1)) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators());
5908
+ let n = 0;
5909
+ loop:
5910
+ while (true) {
5911
+ switch (this.charAt(0)) {
5912
+ case "!":
5913
+ n += yield* this.pushTag();
5914
+ n += yield* this.pushSpaces(true);
5915
+ continue loop;
5916
+ case "&":
5917
+ n += yield* this.pushUntil(isNotAnchorChar);
5918
+ n += yield* this.pushSpaces(true);
5919
+ continue loop;
5920
+ case "-":
5921
+ case "?":
5922
+ case ":": {
5923
+ const inFlow = this.flowLevel > 0;
5924
+ const ch1 = this.charAt(1);
5925
+ if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) {
5926
+ if (!inFlow)
5927
+ this.indentNext = this.indentValue + 1;
5928
+ else if (this.flowKey)
5929
+ this.flowKey = false;
5930
+ n += yield* this.pushCount(1);
5931
+ n += yield* this.pushSpaces(true);
5932
+ continue loop;
5933
+ }
5934
+ }
5903
5935
  }
5936
+ break loop;
5904
5937
  }
5905
- }
5906
- return 0;
5938
+ return n;
5907
5939
  }
5908
5940
  *pushTag() {
5909
5941
  if (this.charAt(1) === "<") {
@@ -6057,6 +6089,13 @@ var require_parser = __commonJS((exports) => {
6057
6089
  while (prev[++i]?.type === "space") {}
6058
6090
  return prev.splice(i, prev.length);
6059
6091
  }
6092
+ function arrayPushArray(target, source) {
6093
+ if (source.length < 1e5)
6094
+ Array.prototype.push.apply(target, source);
6095
+ else
6096
+ for (let i = 0;i < source.length; ++i)
6097
+ target.push(source[i]);
6098
+ }
6060
6099
  function fixFlowSeqItems(fc) {
6061
6100
  if (fc.start.type === "flow-seq-start") {
6062
6101
  for (const it of fc.items) {
@@ -6066,11 +6105,11 @@ var require_parser = __commonJS((exports) => {
6066
6105
  delete it.key;
6067
6106
  if (isFlowToken(it.value)) {
6068
6107
  if (it.value.end)
6069
- Array.prototype.push.apply(it.value.end, it.sep);
6108
+ arrayPushArray(it.value.end, it.sep);
6070
6109
  else
6071
6110
  it.value.end = it.sep;
6072
6111
  } else
6073
- Array.prototype.push.apply(it.start, it.sep);
6112
+ arrayPushArray(it.start, it.sep);
6074
6113
  delete it.sep;
6075
6114
  }
6076
6115
  }
@@ -6410,7 +6449,7 @@ var require_parser = __commonJS((exports) => {
6410
6449
  const prev = map.items[map.items.length - 2];
6411
6450
  const end = prev?.value?.end;
6412
6451
  if (Array.isArray(end)) {
6413
- Array.prototype.push.apply(end, it.start);
6452
+ arrayPushArray(end, it.start);
6414
6453
  end.push(this.sourceToken);
6415
6454
  map.items.pop();
6416
6455
  return;
@@ -6598,7 +6637,7 @@ var require_parser = __commonJS((exports) => {
6598
6637
  const prev = seq.items[seq.items.length - 2];
6599
6638
  const end = prev?.value?.end;
6600
6639
  if (Array.isArray(end)) {
6601
- Array.prototype.push.apply(end, it.start);
6640
+ arrayPushArray(end, it.start);
6602
6641
  end.push(this.sourceToken);
6603
6642
  seq.items.pop();
6604
6643
  return;
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  OffensiveSecurityAgent
3
- } from "./cli-35czfv00.js";
3
+ } from "./cli-sh1d5f84.js";
4
4
  import {
5
5
  hasToolCall,
6
6
  init_dist
7
- } from "./cli-v1aqbv58.js";
7
+ } from "./cli-fyxdrpws.js";
8
8
  import {
9
9
  exports_external,
10
10
  init_zod,
11
11
  tool
12
- } from "./cli-f7d23ded.js";
12
+ } from "./cli-29yqhrjq.js";
13
13
 
14
14
  // src/core/agents/specialized/whiteboxAttackSurface/agent.ts
15
15
  init_dist();
@@ -400,6 +400,7 @@ class WhiteboxAttackSurfaceAgent extends OffensiveSecurityAgent {
400
400
  attackSurfaceRegistry,
401
401
  domains,
402
402
  enableThinking,
403
+ thinkingEffort,
403
404
  openAIReasoningEffort
404
405
  } = opts;
405
406
  let capturedResult = null;
@@ -426,6 +427,7 @@ This ends the agent run — make sure all data is included.`,
426
427
  subagentId,
427
428
  attackSurfaceRegistry,
428
429
  enableThinking,
430
+ thinkingEffort,
429
431
  openAIReasoningEffort,
430
432
  activeTools: [
431
433
  "read_file",
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  config,
3
3
  init_config
4
- } from "./cli-9z6vwf30.js";
4
+ } from "./cli-xecc5fgb.js";
5
5
  import {
6
6
  __esm
7
7
  } from "./cli-8rxa073f.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  BlackboxAttackSurfaceAgent
3
- } from "./cli-whtdyc0e.js";
3
+ } from "./cli-392r62e5.js";
4
4
  import {
5
5
  TargetedPentestAgent,
6
6
  buildPentestSystemPrompt
7
- } from "./cli-yjbkaqvy.js";
7
+ } from "./cli-6fbhny5y.js";
8
8
  import {
9
9
  CodeAgent
10
- } from "./cli-6vs0mtsb.js";
10
+ } from "./cli-xjw661db.js";
11
11
  import {
12
12
  AppsDiscoveryResultSchema,
13
13
  DiscoverySummarySchema,
@@ -15,10 +15,10 @@ import {
15
15
  WHITEBOX_APPS_DISCOVERY_SYSTEM_PROMPT,
16
16
  WHITEBOX_DISCOVERY_SYSTEM_PROMPT,
17
17
  WHITEBOX_ENDPOINT_DOCUMENTATION_SYSTEM_PROMPT
18
- } from "./cli-gbkj2has.js";
18
+ } from "./cli-t4aygjwm.js";
19
19
  import {
20
20
  EvidenceFileEntrySchema
21
- } from "./cli-tw3fe8bj.js";
21
+ } from "./cli-c8n6gjbg.js";
22
22
  import {
23
23
  CweEntrySchema,
24
24
  FindingsRegistry,
@@ -26,8 +26,9 @@ import {
26
26
  PLAN_MODE_TOOL_NAMES,
27
27
  ValidatedCweEntrySchema,
28
28
  hasCanonicalName,
29
+ pLimit,
29
30
  runWithBoundedConcurrency
30
- } from "./cli-35czfv00.js";
31
+ } from "./cli-sh1d5f84.js";
31
32
  import {
32
33
  createThreatModelPrompt
33
34
  } from "./cli-fw5r7pfj.js";
@@ -36,13 +37,14 @@ import {
36
37
  hasToolCall,
37
38
  init_dist,
38
39
  init_lazyLogger,
40
+ init_session,
39
41
  init_structured,
40
42
  scopedLogger
41
- } from "./cli-v1aqbv58.js";
43
+ } from "./cli-fyxdrpws.js";
42
44
  import {
43
45
  exports_external,
44
46
  init_zod
45
- } from "./cli-f7d23ded.js";
47
+ } from "./cli-29yqhrjq.js";
46
48
 
47
49
  // src/core/workflows/pentest.ts
48
50
  init_dist();
@@ -360,11 +362,13 @@ init_lazyLogger();
360
362
  // src/core/session/persistence.ts
361
363
  init_structured();
362
364
  init_lazyLogger();
365
+ init_session();
363
366
  import {
364
367
  existsSync as existsSync2,
365
368
  mkdirSync,
366
369
  readdirSync,
367
370
  readFileSync as readFileSync2,
371
+ renameSync,
368
372
  statSync,
369
373
  writeFileSync as writeFileSync2
370
374
  } from "node:fs";
@@ -372,14 +376,14 @@ import { join as join2 } from "node:path";
372
376
  var log = scopedLogger(() => createLogger("session:persistence"));
373
377
  var SUBAGENTS_DIR = "subagents";
374
378
  var MANIFEST_FILE = "agent-manifest.json";
375
- function loadSubagentMessages(session, agentName) {
376
- const stepPath = join2(session.rootPath, SUBAGENTS_DIR, agentName, "messages.json");
379
+ function loadSubagentMessages(session, key) {
380
+ const stepPath = join2(session.rootPath, SUBAGENTS_DIR, key, "messages.json");
377
381
  if (existsSync2(stepPath)) {
378
382
  try {
379
383
  return JSON.parse(readFileSync2(stepPath, "utf-8"));
380
384
  } catch {}
381
385
  }
382
- const snapshotPath = join2(session.rootPath, SUBAGENTS_DIR, `${agentName}.json`);
386
+ const snapshotPath = join2(session.rootPath, SUBAGENTS_DIR, `${key}.json`);
383
387
  if (!existsSync2(snapshotPath))
384
388
  return [];
385
389
  try {
@@ -523,6 +527,9 @@ function parseSubagentFilename(filename) {
523
527
  if (filename.startsWith("orchestrator-")) {
524
528
  return { agentType: "pentest", name: "Orchestrator Summary" };
525
529
  }
530
+ if (filename.startsWith("ses_")) {
531
+ return { agentType: "pentest", name: "Pentest Worker" };
532
+ }
526
533
  return { agentType: "pentest", name: filename.split("-")[0] || "Unknown" };
527
534
  }
528
535
  function unwrapAiSdkToolOutput(output) {
@@ -833,8 +840,10 @@ async function runEndpointDocumentationAgent(opts) {
833
840
  onCacheMetrics,
834
841
  openAIReasoningEffort,
835
842
  enableThinking,
843
+ thinkingEffort,
836
844
  projectThreatModel,
837
- parentSubagentId
845
+ parentSubagentId,
846
+ agentLimiter
838
847
  } = opts;
839
848
  const subagentId = `endpoint-doc-${slug(app.name)}-${slug(endpoint.path)}`;
840
849
  const displayMethod = getDocumentMethod(endpoint);
@@ -871,12 +880,13 @@ async function runEndpointDocumentationAgent(opts) {
871
880
  onCacheMetrics,
872
881
  openAIReasoningEffort,
873
882
  enableThinking,
883
+ thinkingEffort,
874
884
  responseSchema: DiscoverySummarySchema,
875
885
  excludeTools: ["document_app", "list_files", "grep"],
876
886
  projectThreatModel
877
887
  });
878
888
  try {
879
- await agent.consume();
889
+ await (agentLimiter ? agentLimiter(() => agent.consume()) : agent.consume());
880
890
  eventBus?.emit("subagent-complete", {
881
891
  subagentId,
882
892
  status: "completed",
@@ -6195,6 +6205,7 @@ init_structured();
6195
6205
  init_lazyLogger();
6196
6206
  var log4 = scopedLogger(() => createLogger("whitebox-workflow"));
6197
6207
  var DEFAULT_CONCURRENCY = 5;
6208
+ var MAX_CONCURRENT_AGENTS = 12;
6198
6209
  var TASK_TYPE_LABELS = {
6199
6210
  pages: "Pages",
6200
6211
  apiEndpoints: "API Endpoints",
@@ -6225,11 +6236,15 @@ async function runWhiteboxAttackSurfaceWorkflow(input) {
6225
6236
  onCacheMetrics,
6226
6237
  openAIReasoningEffort,
6227
6238
  enableThinking,
6239
+ thinkingEffort,
6228
6240
  domains,
6229
6241
  projectThreatModel,
6230
6242
  environments,
6231
- surfaceIntegrationEnabled = true
6243
+ surfaceIntegrationEnabled = true,
6244
+ maxConcurrentAgents = MAX_CONCURRENT_AGENTS
6232
6245
  } = input;
6246
+ const agentSlots = pLimit(Math.max(1, maxConcurrentAgents));
6247
+ const agentLimiter = (fn) => agentSlots(fn);
6233
6248
  const appsAgent = new CodeAgent({
6234
6249
  codebasePath,
6235
6250
  objective: buildAppsDiscoveryObjective(codebasePath, domains, environments),
@@ -6245,6 +6260,7 @@ async function runWhiteboxAttackSurfaceWorkflow(input) {
6245
6260
  onCacheMetrics,
6246
6261
  openAIReasoningEffort,
6247
6262
  enableThinking,
6263
+ thinkingEffort,
6248
6264
  responseSchema: AppsDiscoveryResultSchema,
6249
6265
  projectThreatModel,
6250
6266
  excludeTools: ["document_endpoint"]
@@ -6256,7 +6272,7 @@ async function runWhiteboxAttackSurfaceWorkflow(input) {
6256
6272
  name: "Whitebox Apps Discovery",
6257
6273
  input: { codebasePath }
6258
6274
  });
6259
- const appsResult = await appsAgent.consume();
6275
+ const appsResult = await agentLimiter(() => appsAgent.consume());
6260
6276
  log4.info(`Phase 1 complete: ${appsResult?.apps.length ?? 0} apps discovered` + (appsResult ? ` (repoType=${appsResult.repoType}, packageManager=${appsResult.packageManager})` : " (no result returned)"));
6261
6277
  if (appsResult?.apps.length) {
6262
6278
  for (const app of appsResult.apps) {
@@ -6335,12 +6351,13 @@ async function runWhiteboxAttackSurfaceWorkflow(input) {
6335
6351
  onCacheMetrics,
6336
6352
  openAIReasoningEffort,
6337
6353
  enableThinking,
6354
+ thinkingEffort,
6338
6355
  responseSchema: DiscoverySummarySchema,
6339
6356
  excludeTools: ["document_app"],
6340
6357
  projectThreatModel
6341
6358
  });
6342
6359
  try {
6343
- await agent.consume();
6360
+ await agentLimiter(() => agent.consume());
6344
6361
  log4.debug(`Phase 2: agent "${subagentId}" completed`);
6345
6362
  eventBus?.emit("subagent-complete", {
6346
6363
  subagentId,
@@ -6390,8 +6407,10 @@ async function runWhiteboxAttackSurfaceWorkflow(input) {
6390
6407
  onCacheMetrics,
6391
6408
  openAIReasoningEffort,
6392
6409
  enableThinking,
6410
+ thinkingEffort,
6393
6411
  projectThreatModel,
6394
- parentSubagentId: appNodeId
6412
+ parentSubagentId: appNodeId,
6413
+ agentLimiter
6395
6414
  });
6396
6415
  } else {
6397
6416
  log4.debug(`${app.name}: fallback (${surfaceResult.reason})`);
@@ -6852,6 +6871,7 @@ async function runPentestSwarm(input) {
6852
6871
  concurrency = DEFAULT_CONCURRENCY2,
6853
6872
  onStepFinish,
6854
6873
  enableThinking,
6874
+ thinkingEffort,
6855
6875
  openAIReasoningEffort,
6856
6876
  display
6857
6877
  } = input;
@@ -6902,6 +6922,7 @@ async function runPentestSwarm(input) {
6902
6922
  planSubagentId: subagentId,
6903
6923
  eventBus,
6904
6924
  enableThinking,
6925
+ thinkingEffort,
6905
6926
  openAIReasoningEffort,
6906
6927
  display
6907
6928
  });
@@ -6926,6 +6947,7 @@ async function runPentestSwarm(input) {
6926
6947
  eventBus,
6927
6948
  subagentId,
6928
6949
  enableThinking,
6950
+ thinkingEffort,
6929
6951
  openAIReasoningEffort,
6930
6952
  display
6931
6953
  });
@@ -6982,6 +7004,7 @@ async function runPentestWorkflow(input) {
6982
7004
  onStepFinish,
6983
7005
  onCacheMetrics,
6984
7006
  enableThinking,
7007
+ thinkingEffort,
6985
7008
  openAIReasoningEffort,
6986
7009
  prompt,
6987
7010
  threatModel,
@@ -7119,6 +7142,7 @@ ${combined}` : combined;
7119
7142
  eventBus,
7120
7143
  onStepFinish: wrappedOnStepFinish,
7121
7144
  enableThinking,
7145
+ thinkingEffort,
7122
7146
  openAIReasoningEffort
7123
7147
  });
7124
7148
  }
@@ -3,7 +3,7 @@ import {
3
3
  init,
4
4
  init_config,
5
5
  update
6
- } from "./cli-xnnkeg5p.js";
6
+ } from "./cli-4q0ztagc.js";
7
7
  import {
8
8
  __esm
9
9
  } from "./cli-8rxa073f.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  OffensiveSecurityAgent
3
- } from "./cli-35czfv00.js";
3
+ } from "./cli-sh1d5f84.js";
4
4
  import {
5
5
  init_dist,
6
6
  stepCountIs
7
- } from "./cli-v1aqbv58.js";
7
+ } from "./cli-fyxdrpws.js";
8
8
 
9
9
  // src/core/agents/specialized/codeAgent/agent.ts
10
10
  init_dist();
@@ -79,6 +79,7 @@ class CodeAgent extends OffensiveSecurityAgent {
79
79
  attackSurfaceRegistry,
80
80
  excludeTools,
81
81
  enableThinking,
82
+ thinkingEffort,
82
83
  openAIReasoningEffort,
83
84
  projectThreatModel
84
85
  } = opts;
@@ -124,6 +125,7 @@ class CodeAgent extends OffensiveSecurityAgent {
124
125
  subagentId,
125
126
  attackSurfaceRegistry,
126
127
  enableThinking,
128
+ thinkingEffort,
127
129
  openAIReasoningEffort,
128
130
  projectThreatModel,
129
131
  stopWhen: stopWhen ?? stepCountIs(1e4),