@pensar/apex 2.5.0-canary.ed17e75d → 2.5.0-canary.f6422df7

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 (51) hide show
  1. package/build/agent-ggkrtp29.js +12 -0
  2. package/build/{agent-avczsr68.js → agent-gq2rc4dr.js} +5 -5
  3. package/build/{agent-a6bxtbfy.js → agent-p6ga9jbq.js} +4 -4
  4. package/build/{agent-5s352akj.js → agent-rx8df4x3.js} +5 -5
  5. package/build/{apps-0vc4q8e3.js → apps-p49t71pt.js} +12 -12
  6. package/build/{auth-jgb4x41d.js → auth-0cb5wvg6.js} +12 -12
  7. package/build/{blackboxAgent-na50er6j.js → blackboxAgent-h2cjhkqp.js} +5 -5
  8. package/build/{blackboxPentest-s1a1dtt6.js → blackboxPentest-6zwn4hwy.js} +16 -19
  9. package/build/{cli-8r3wej3n.js → cli-0fhrs6em.js} +8 -8
  10. package/build/{cli-x34ddhpg.js → cli-1epshqbe.js} +1 -1
  11. package/build/{cli-9z9h5j53.js → cli-20qw5zdb.js} +2 -2
  12. package/build/{cli-7vby0hk6.js → cli-4ptm7wgt.js} +53 -1
  13. package/build/{cli-d2drez23.js → cli-5j464wrj.js} +1 -1
  14. package/build/{cli-68erc0pw.js → cli-6dgqvnng.js} +1 -1
  15. package/build/{cli-gdg11crm.js → cli-9vvrk0jh.js} +1 -1
  16. package/build/{cli-njt9ajx6.js → cli-aczvzy4v.js} +5 -2
  17. package/build/{cli-04vyq3p4.js → cli-b43gkt62.js} +19 -35
  18. package/build/{cli-jk34t4wj.js → cli-ddb03mt2.js} +25 -30
  19. package/build/{cli-p44jq8zs.js → cli-gvnncqb9.js} +1 -1
  20. package/build/{cli-rm2tsm83.js → cli-hxq1fc33.js} +2 -2
  21. package/build/{cli-e64w7a41.js → cli-mj2nwrx6.js} +2 -2
  22. package/build/{cli-97523caw.js → cli-w31m4gw0.js} +3 -3
  23. package/build/{cli-5zkb889f.js → cli-y56ht6ah.js} +3 -3
  24. package/build/{cli-xjbwt7v8.js → cli-z1v01hjt.js} +2 -2
  25. package/build/cli.js +41 -34
  26. package/build/{config-qvqxbr1z.js → config-ne2x8d8y.js} +1 -1
  27. package/build/{doctor-h9qbe2fw.js → doctor-ted7aagf.js} +3 -3
  28. package/build/{fastStrike-wvdpae0b.js → fastStrike-6dte80nx.js} +5 -5
  29. package/build/{fixes-9f6c50mf.js → fixes-nz6z06za.js} +12 -12
  30. package/build/{index-6dmw8a4x.js → index-0cczqzcv.js} +1 -1
  31. package/build/{index-vfsgq2yp.js → index-186jyth3.js} +4 -4
  32. package/build/{index-1pnjr4c1.js → index-1ad0t04m.js} +1 -1
  33. package/build/{index-sq1pjqpy.js → index-4y897zcg.js} +39 -37
  34. package/build/{index-7wgjqw44.js → index-9ezh2dr8.js} +3 -3
  35. package/build/{index-1sckfzft.js → index-pn0g8pzq.js} +2 -2
  36. package/build/{index-zz83xz69.js → index-w1y4tpt7.js} +4 -4
  37. package/build/{index-4gndz27q.js → index-x8040y0s.js} +5 -5
  38. package/build/{issues-v9d34e84.js → issues-fbvy45xc.js} +12 -12
  39. package/build/{logs-kj4cmx82.js → logs-p5985mcx.js} +12 -12
  40. package/build/{offesecAgent-e9pqwb6x.js → offesecAgent-2yh5qtxb.js} +4 -4
  41. package/build/{pentest-9e4brpjh.js → pentest-trx5r5cb.js} +10 -10
  42. package/build/{pentests-v8km079c.js → pentests-a15839rg.js} +12 -12
  43. package/build/{targetedPentest-cm974xqf.js → targetedPentest-rnp1295z.js} +5 -5
  44. package/build/{targets-yrhz438s.js → targets-ptara43c.js} +12 -12
  45. package/build/threatModel-2q3cqzd9.js +19 -0
  46. package/build/{uninstall-9pyvndsa.js → uninstall-2dks9b3n.js} +1 -1
  47. package/build/{upload-3w2kva4r.js → upload-bt9y3sxf.js} +3 -3
  48. package/build/{utils-w6tb96yk.js → utils-pq848qy5.js} +2 -2
  49. package/package.json +1 -1
  50. package/build/agent-d0s4vmry.js +0 -12
  51. package/build/threatModel-jbhmw72z.js +0 -19
@@ -0,0 +1,12 @@
1
+ import {
2
+ CodeAgent2
3
+ } from "./cli-z1v01hjt.js";
4
+ import"./cli-qba2x69h.js";
5
+ import"./cli-b43gkt62.js";
6
+ import"./cli-9vvrk0jh.js";
7
+ import"./cli-ddb03mt2.js";
8
+ import"./cli-qktcyj48.js";
9
+ import"./cli-1epshqbe.js";
10
+ export {
11
+ CodeAgent2 as CodeAgent
12
+ };
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  runAuthenticationAgent2
3
- } from "./cli-5zkb889f.js";
3
+ } from "./cli-y56ht6ah.js";
4
4
  import"./cli-qba2x69h.js";
5
- import"./cli-04vyq3p4.js";
6
- import"./cli-gdg11crm.js";
7
- import"./cli-jk34t4wj.js";
5
+ import"./cli-b43gkt62.js";
6
+ import"./cli-9vvrk0jh.js";
7
+ import"./cli-ddb03mt2.js";
8
8
  import"./cli-qktcyj48.js";
9
- import"./cli-x34ddhpg.js";
9
+ import"./cli-1epshqbe.js";
10
10
  export {
11
11
  runAuthenticationAgent2 as runAuthenticationAgent
12
12
  };
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  OffensiveSecurityAgent
3
- } from "./cli-04vyq3p4.js";
4
- import"./cli-x34ddhpg.js";
3
+ } from "./cli-b43gkt62.js";
4
+ import"./cli-1epshqbe.js";
5
5
  import {
6
6
  init_zod,
7
7
  stepCountIs2,
8
8
  init_dist
9
- } from "./cli-jk34t4wj.js";
9
+ } from "./cli-ddb03mt2.js";
10
10
  import {
11
11
  detectOSAndEnhancePrompt
12
- } from "./cli-gdg11crm.js";
12
+ } from "./cli-9vvrk0jh.js";
13
13
  import"./cli-qba2x69h.js";
14
14
  import {
15
15
  string,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  TargetedPentestAgent2,
3
3
  buildPentestSystemPrompt2
4
- } from "./cli-9z9h5j53.js";
4
+ } from "./cli-20qw5zdb.js";
5
5
  import"./cli-qba2x69h.js";
6
- import"./cli-04vyq3p4.js";
7
- import"./cli-gdg11crm.js";
8
- import"./cli-jk34t4wj.js";
6
+ import"./cli-b43gkt62.js";
7
+ import"./cli-9vvrk0jh.js";
8
+ import"./cli-ddb03mt2.js";
9
9
  import"./cli-qktcyj48.js";
10
- import"./cli-x34ddhpg.js";
10
+ import"./cli-1epshqbe.js";
11
11
  export {
12
12
  TargetedPentestAgent2 as TargetedPentestAgent,
13
13
  buildPentestSystemPrompt2 as buildPentestSystemPrompt
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bun
2
- import"./cli-x34ddhpg.js";
3
- import"./cli-jk34t4wj.js";
2
+ import"./cli-1epshqbe.js";
3
+ import"./cli-ddb03mt2.js";
4
4
  import {
5
5
  ENDPOINT_TRANSPORTS,
6
6
  listApps,
@@ -17,16 +17,16 @@ import {
17
17
  searchEndpoints,
18
18
  listDomains,
19
19
  createDomain
20
- } from "./cli-04vyq3p4.js";
21
- import"./cli-gdg11crm.js";
22
- import"./cli-97523caw.js";
23
- import"./cli-xjbwt7v8.js";
24
- import"./cli-rm2tsm83.js";
25
- import"./cli-8r3wej3n.js";
26
- import"./cli-5zkb889f.js";
27
- import"./cli-9z9h5j53.js";
28
- import"./cli-e64w7a41.js";
29
- import"./cli-njt9ajx6.js";
20
+ } from "./cli-b43gkt62.js";
21
+ import"./cli-9vvrk0jh.js";
22
+ import"./cli-w31m4gw0.js";
23
+ import"./cli-z1v01hjt.js";
24
+ import"./cli-hxq1fc33.js";
25
+ import"./cli-0fhrs6em.js";
26
+ import"./cli-y56ht6ah.js";
27
+ import"./cli-20qw5zdb.js";
28
+ import"./cli-mj2nwrx6.js";
29
+ import"./cli-aczvzy4v.js";
30
30
  import {
31
31
  markCommandFailed
32
32
  } from "./cli-z82n3qk1.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  config2,
4
4
  init_config
5
- } from "./cli-x34ddhpg.js";
5
+ } from "./cli-1epshqbe.js";
6
6
  import {
7
7
  getPensarApiUrl,
8
8
  getPensarConsoleUrl,
@@ -18,17 +18,17 @@ import {
18
18
  createWorkspaceSelection2,
19
19
  pollWorkspaceSelection2,
20
20
  init_auth
21
- } from "./cli-jk34t4wj.js";
22
- import"./cli-04vyq3p4.js";
23
- import"./cli-gdg11crm.js";
24
- import"./cli-97523caw.js";
25
- import"./cli-xjbwt7v8.js";
26
- import"./cli-rm2tsm83.js";
27
- import"./cli-8r3wej3n.js";
28
- import"./cli-5zkb889f.js";
29
- import"./cli-9z9h5j53.js";
30
- import"./cli-e64w7a41.js";
31
- import"./cli-njt9ajx6.js";
21
+ } from "./cli-ddb03mt2.js";
22
+ import"./cli-b43gkt62.js";
23
+ import"./cli-9vvrk0jh.js";
24
+ import"./cli-w31m4gw0.js";
25
+ import"./cli-z1v01hjt.js";
26
+ import"./cli-hxq1fc33.js";
27
+ import"./cli-0fhrs6em.js";
28
+ import"./cli-y56ht6ah.js";
29
+ import"./cli-20qw5zdb.js";
30
+ import"./cli-mj2nwrx6.js";
31
+ import"./cli-aczvzy4v.js";
32
32
  import {
33
33
  markCommandFailed
34
34
  } from "./cli-z82n3qk1.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  BlackboxAttackSurfaceAgent2
3
- } from "./cli-97523caw.js";
3
+ } from "./cli-w31m4gw0.js";
4
4
  import"./cli-qba2x69h.js";
5
- import"./cli-04vyq3p4.js";
6
- import"./cli-gdg11crm.js";
7
- import"./cli-jk34t4wj.js";
5
+ import"./cli-b43gkt62.js";
6
+ import"./cli-9vvrk0jh.js";
7
+ import"./cli-ddb03mt2.js";
8
8
  import"./cli-qktcyj48.js";
9
- import"./cli-x34ddhpg.js";
9
+ import"./cli-1epshqbe.js";
10
10
  export {
11
11
  BlackboxAttackSurfaceAgent2 as BlackboxAttackSurfaceAgent
12
12
  };
@@ -1,17 +1,20 @@
1
- import"./cli-04vyq3p4.js";
2
- import"./cli-x34ddhpg.js";
3
- import"./cli-jk34t4wj.js";
4
- import"./cli-gdg11crm.js";
5
- import"./cli-97523caw.js";
6
- import"./cli-9z9h5j53.js";
7
- import"./cli-e64w7a41.js";
1
+ import"./cli-1epshqbe.js";
2
+ import {
3
+ init_ai,
4
+ normalizeStepUsage
5
+ } from "./cli-ddb03mt2.js";
6
+ import"./cli-b43gkt62.js";
7
+ import"./cli-9vvrk0jh.js";
8
+ import"./cli-w31m4gw0.js";
9
+ import"./cli-20qw5zdb.js";
10
+ import"./cli-mj2nwrx6.js";
8
11
  import {
9
12
  readExecutionMetrics,
10
13
  writeExecutionMetrics,
11
14
  runPentestWorkflow2
12
- } from "./cli-8r3wej3n.js";
13
- import"./cli-xjbwt7v8.js";
14
- import"./cli-rm2tsm83.js";
15
+ } from "./cli-0fhrs6em.js";
16
+ import"./cli-z1v01hjt.js";
17
+ import"./cli-hxq1fc33.js";
15
18
  import {
16
19
  EMPTY_SESSION_TOKEN_USAGE,
17
20
  accumulateSessionTokens
@@ -20,26 +23,20 @@ import"./cli-qba2x69h.js";
20
23
  import"./cli-qktcyj48.js";
21
24
 
22
25
  // src/core/api/blackboxPentest.ts
26
+ init_ai();
23
27
  async function runPentestAgent(input) {
24
28
  const persisted = readExecutionMetrics(input.session.rootPath)?.tokenUsage;
25
29
  let tokenUsage = persisted ?? EMPTY_SESSION_TOKEN_USAGE;
26
30
  const onStepFinish = async (event) => {
27
- tokenUsage = accumulateSessionTokens(tokenUsage, event.usage ?? {});
31
+ tokenUsage = accumulateSessionTokens(tokenUsage, normalizeStepUsage(event));
28
32
  await input.onStepFinish?.(event);
29
33
  };
30
- const onCacheMetrics = (metrics) => {
31
- tokenUsage = accumulateSessionTokens(tokenUsage, {
32
- cacheReadTokens: metrics.cacheReadInputTokens,
33
- cacheWriteTokens: metrics.cacheCreationInputTokens
34
- });
35
- input.onCacheMetrics?.(metrics);
36
- };
37
34
  let result;
38
35
  try {
39
36
  result = await runPentestWorkflow2({
40
37
  ...input,
41
38
  onStepFinish,
42
- onCacheMetrics
39
+ onCacheMetrics: input.onCacheMetrics
43
40
  });
44
41
  } finally {
45
42
  writeExecutionMetrics({
@@ -6,7 +6,7 @@ import {
6
6
  FindingsRegistry,
7
7
  PLAN_MODE_TOOL_NAMES,
8
8
  OffensiveSecurityAgent
9
- } from "./cli-04vyq3p4.js";
9
+ } from "./cli-b43gkt62.js";
10
10
  import {
11
11
  hasToolCall,
12
12
  init_dist,
@@ -17,24 +17,24 @@ import {
17
17
  init_session,
18
18
  createLogger,
19
19
  init_structured
20
- } from "./cli-jk34t4wj.js";
20
+ } from "./cli-ddb03mt2.js";
21
21
  import {
22
22
  BlackboxAttackSurfaceAgent2
23
- } from "./cli-97523caw.js";
23
+ } from "./cli-w31m4gw0.js";
24
24
  import {
25
25
  TargetedPentestAgent2,
26
26
  buildPentestSystemPrompt2
27
- } from "./cli-9z9h5j53.js";
27
+ } from "./cli-20qw5zdb.js";
28
28
  import {
29
29
  buildPentestReport,
30
30
  renderJson,
31
31
  renderMarkdown,
32
32
  REPORT_FILENAME_MD,
33
33
  REPORT_FILENAME_JSON
34
- } from "./cli-e64w7a41.js";
34
+ } from "./cli-mj2nwrx6.js";
35
35
  import {
36
36
  CodeAgent2
37
- } from "./cli-xjbwt7v8.js";
37
+ } from "./cli-z1v01hjt.js";
38
38
  import {
39
39
  WHITEBOX_APPS_DISCOVERY_SYSTEM_PROMPT2,
40
40
  WHITEBOX_ENDPOINT_DOCUMENTATION_SYSTEM_PROMPT,
@@ -42,7 +42,7 @@ import {
42
42
  EndpointSchema2,
43
43
  AppsDiscoveryResultSchema2,
44
44
  DiscoverySummarySchema2
45
- } from "./cli-rm2tsm83.js";
45
+ } from "./cli-hxq1fc33.js";
46
46
  import {
47
47
  createThreatModelPrompt
48
48
  } from "./cli-q126f6ef.js";
@@ -7829,7 +7829,7 @@ async function runPentestSwarm2(input) {
7829
7829
  }
7830
7830
  async function runPentestWorkflow2(input) {
7831
7831
  if (input.fastStrike) {
7832
- const { runFastStrike } = await import("./fastStrike-wvdpae0b.js");
7832
+ const { runFastStrike } = await import("./fastStrike-6dte80nx.js");
7833
7833
  return runFastStrike(input);
7834
7834
  }
7835
7835
  const {
@@ -3,7 +3,7 @@ import {
3
3
  get,
4
4
  update2,
5
5
  init_config2
6
- } from "./cli-d2drez23.js";
6
+ } from "./cli-5j464wrj.js";
7
7
  import {
8
8
  __esm
9
9
  } from "./cli-h6y3bt60.js";
@@ -6,7 +6,7 @@ import {
6
6
  init_lazyLogger,
7
7
  createLogger,
8
8
  init_structured
9
- } from "./cli-jk34t4wj.js";
9
+ } from "./cli-ddb03mt2.js";
10
10
  import {
11
11
  isMemoryEnabled,
12
12
  readPlan,
@@ -14,7 +14,7 @@ import {
14
14
  createReportErrorTool,
15
15
  PentestReportedError,
16
16
  OffensiveSecurityAgent
17
- } from "./cli-04vyq3p4.js";
17
+ } from "./cli-b43gkt62.js";
18
18
  import {
19
19
  MOBILE_OTP_PROMPT_GUIDANCE
20
20
  } from "./cli-retw3rw5.js";
@@ -12133,4 +12133,56 @@ var require_index_shim = __commonJS(function(exports) {
12133
12133
  } });
12134
12134
  });
12135
12135
 
12136
- export { require_src, require_src2, require_src3, require_src4, require_index_node_http, require_src5, require_index_shim };
12136
+ // src/core/observability/active-spans.ts
12137
+ var import_api = __toESM(require_src6(), 1);
12138
+ var INTERRUPTED_SPAN_ATTRIBUTE = "pensar.telemetry.interrupted";
12139
+ var INTERRUPTED_ERROR_TYPE = "ApexProcessInterrupted";
12140
+ var INTERRUPTED_SPAN_REASON = "Apex shut down before this span completed";
12141
+ var MAX_TRACKED_ACTIVE_SPANS = 1e4;
12142
+ function spanKey(span) {
12143
+ const context = span.spanContext();
12144
+ return `${context.traceId}:${context.spanId}`;
12145
+ }
12146
+
12147
+ class ActiveSpanProcessor {
12148
+ active = new Map;
12149
+ overflowWarned = false;
12150
+ onStart(span) {
12151
+ if (this.active.size >= MAX_TRACKED_ACTIVE_SPANS) {
12152
+ if (!this.overflowWarned) {
12153
+ this.overflowWarned = true;
12154
+ import_api.diag.warn(`Apex active-span shutdown tracking reached ${MAX_TRACKED_ACTIVE_SPANS} spans; newer spans will not be retained`);
12155
+ }
12156
+ return;
12157
+ }
12158
+ this.active.set(spanKey(span), span);
12159
+ }
12160
+ onEnd(span) {
12161
+ this.active.delete(spanKey(span));
12162
+ }
12163
+ endAll(reason = INTERRUPTED_SPAN_REASON) {
12164
+ const spans = [...this.active.entries()].reverse();
12165
+ for (const [key, span] of spans) {
12166
+ try {
12167
+ if (span.isRecording()) {
12168
+ span.setAttribute(INTERRUPTED_SPAN_ATTRIBUTE, true);
12169
+ if (span.attributes["error.type"] === undefined) {
12170
+ span.setAttribute("error.type", INTERRUPTED_ERROR_TYPE);
12171
+ }
12172
+ if (span.status.code !== import_api.SpanStatusCode.ERROR) {
12173
+ span.setStatus({ code: import_api.SpanStatusCode.ERROR, message: reason });
12174
+ }
12175
+ span.end();
12176
+ }
12177
+ } catch {} finally {
12178
+ this.active.delete(key);
12179
+ }
12180
+ }
12181
+ }
12182
+ async forceFlush() {}
12183
+ async shutdown() {
12184
+ this.endAll();
12185
+ }
12186
+ }
12187
+
12188
+ export { require_src, require_src2, require_src3, require_src4, require_index_node_http, require_src5, require_index_shim, ActiveSpanProcessor };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getCurrentVersion,
3
3
  init_installation
4
- } from "./cli-p44jq8zs.js";
4
+ } from "./cli-gvnncqb9.js";
5
5
  import {
6
6
  __esm
7
7
  } from "./cli-h6y3bt60.js";
@@ -3,7 +3,7 @@ import {
3
3
  init_lazyLogger,
4
4
  createLogger,
5
5
  init_structured
6
- } from "./cli-jk34t4wj.js";
6
+ } from "./cli-ddb03mt2.js";
7
7
 
8
8
  // src/core/integrations/wandb/client.ts
9
9
  init_structured();
@@ -3,7 +3,7 @@ import {
3
3
  init_lazyLogger,
4
4
  createLogger,
5
5
  init_structured
6
- } from "./cli-jk34t4wj.js";
6
+ } from "./cli-ddb03mt2.js";
7
7
 
8
8
  // src/core/agents/specialized/utils.ts
9
9
  import { execSync } from "node:child_process";
@@ -3,9 +3,10 @@ import {
3
3
  stepCountIs2,
4
4
  init_dist,
5
5
  init_constants,
6
+ init_ai,
6
7
  sessions2,
7
8
  init_session
8
- } from "./cli-jk34t4wj.js";
9
+ } from "./cli-ddb03mt2.js";
9
10
  import {
10
11
  buildBaseSystemPrompt,
11
12
  ASK_USER_QUESTIONS_TOOL_NAME,
@@ -13,7 +14,7 @@ import {
13
14
  ALL_TOOL_NAMES2,
14
15
  SKILL_TOOL_NAMES2,
15
16
  OffensiveSecurityAgent
16
- } from "./cli-04vyq3p4.js";
17
+ } from "./cli-b43gkt62.js";
17
18
  import {
18
19
  string,
19
20
  array,
@@ -7062,6 +7063,8 @@ async function listTargetLogs(targetId, opts) {
7062
7063
  async function searchTargetLogs(targetId, query, opts) {
7063
7064
  return apiRequest("POST", `/targets/${targetId}/logs/search`, { query, ...opts });
7064
7065
  }
7066
+ // src/core/api/blackboxPentest.ts
7067
+ init_ai();
7065
7068
 
7066
7069
  // src/core/api/index.ts
7067
7070
  init_constants();
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  config2,
3
3
  init_config
4
- } from "./cli-x34ddhpg.js";
4
+ } from "./cli-1epshqbe.js";
5
5
  import {
6
6
  init_zod,
7
7
  stepCountIs2,
@@ -38,12 +38,13 @@ import {
38
38
  init_session,
39
39
  createLogger,
40
40
  init_structured,
41
+ normalizeStepUsage,
41
42
  streamResponse,
42
43
  generateObjectResponse
43
- } from "./cli-jk34t4wj.js";
44
+ } from "./cli-ddb03mt2.js";
44
45
  import {
45
46
  detectOSAndEnhancePrompt
46
- } from "./cli-gdg11crm.js";
47
+ } from "./cli-9vvrk0jh.js";
47
48
  import {
48
49
  parseTargetUrl
49
50
  } from "./cli-0wsh8j2t.js";
@@ -74,7 +75,7 @@ import {
74
75
  import {
75
76
  getCurrentVersion,
76
77
  init_installation
77
- } from "./cli-p44jq8zs.js";
78
+ } from "./cli-gvnncqb9.js";
78
79
  import {
79
80
  require_src6
80
81
  } from "./cli-bb02pjt0.js";
@@ -100215,7 +100216,7 @@ async function runWithBoundedConcurrency(items, concurrency, fn, abortSignal) {
100215
100216
 
100216
100217
  // src/core/agents/offSecAgent/subagentSpawner.ts
100217
100218
  var runPentestChild = async (spec, ctx) => {
100218
- const { TargetedPentestAgent } = await import("./agent-5s352akj.js");
100219
+ const { TargetedPentestAgent } = await import("./agent-rx8df4x3.js");
100219
100220
  const agent = new TargetedPentestAgent({
100220
100221
  target: spec.target,
100221
100222
  grpc: spec.grpc,
@@ -100248,7 +100249,7 @@ var runPentestChild = async (spec, ctx) => {
100248
100249
  return { run: () => agent.consume(), drained: () => agent.drained };
100249
100250
  };
100250
100251
  var runCodeChild = async (spec, ctx) => {
100251
- const { CodeAgent } = await import("./agent-d0s4vmry.js");
100252
+ const { CodeAgent } = await import("./agent-ggkrtp29.js");
100252
100253
  const agent = new CodeAgent({
100253
100254
  codebasePath: spec.codebasePath,
100254
100255
  objective: spec.objective,
@@ -100275,7 +100276,7 @@ var runCodeChild = async (spec, ctx) => {
100275
100276
  return { run: () => agent.consume(), drained: () => agent.drained };
100276
100277
  };
100277
100278
  var runWhiteboxChild = async (spec, ctx) => {
100278
- const { WhiteboxAttackSurfaceAgent } = await import("./index-4gndz27q.js");
100279
+ const { WhiteboxAttackSurfaceAgent } = await import("./index-x8040y0s.js");
100279
100280
  const agent = new WhiteboxAttackSurfaceAgent({
100280
100281
  codebasePath: spec.codebasePath,
100281
100282
  attackSurfaceRegistry: spec.attackSurfaceRegistry,
@@ -100294,7 +100295,7 @@ var runWhiteboxChild = async (spec, ctx) => {
100294
100295
  return { run: () => agent.consume(), drained: () => agent.drained };
100295
100296
  };
100296
100297
  var runBlackboxChild = async (spec, ctx) => {
100297
- const { BlackboxAttackSurfaceAgent } = await import("./blackboxAgent-na50er6j.js");
100298
+ const { BlackboxAttackSurfaceAgent } = await import("./blackboxAgent-h2cjhkqp.js");
100298
100299
  const agent = new BlackboxAttackSurfaceAgent({
100299
100300
  target: spec.target,
100300
100301
  attackSurfaceRegistry: spec.attackSurfaceRegistry,
@@ -100312,7 +100313,7 @@ var runBlackboxChild = async (spec, ctx) => {
100312
100313
  return { run: () => agent.consume(), drained: () => agent.drained };
100313
100314
  };
100314
100315
  var runAuthChild = async (spec, ctx) => {
100315
- const { runAuthenticationAgent } = await import("./agent-avczsr68.js");
100316
+ const { runAuthenticationAgent } = await import("./agent-gq2rc4dr.js");
100316
100317
  return {
100317
100318
  run: () => runAuthenticationAgent({
100318
100319
  target: spec.target,
@@ -100333,7 +100334,7 @@ var runAuthChild = async (spec, ctx) => {
100333
100334
  };
100334
100335
  };
100335
100336
  var runJudgeChild = async (spec, ctx) => {
100336
- const { judgeFinding } = await import("./index-7wgjqw44.js");
100337
+ const { judgeFinding } = await import("./index-9ezh2dr8.js");
100337
100338
  return {
100338
100339
  run: () => judgeFinding(spec.judgeInput, {
100339
100340
  model: ctx.model,
@@ -122680,7 +122681,7 @@ Omit \`cwd\` for blackbox mode (live target probing only).`,
122680
122681
  toolCallDescription: string().describe("A concise, human-readable description of what this tool call is doing")
122681
122682
  }),
122682
122683
  execute: async ({ target, cwd }) => {
122683
- const { runPentestWorkflow: workflow } = await import("./pentest-9e4brpjh.js");
122684
+ const { runPentestWorkflow: workflow } = await import("./pentest-trx5r5cb.js");
122684
122685
  if (!ctx.model) {
122685
122686
  return {
122686
122687
  success: false,
@@ -123287,7 +123288,7 @@ Pass every target you want tested — the swarm handles concurrency automaticall
123287
123288
  toolCallDescription: string().describe("A concise, human-readable description of what this tool call is doing")
123288
123289
  }),
123289
123290
  execute: async ({ targets }) => {
123290
- const { runPentestSwarm, DEFAULT_CONCURRENCY } = await import("./pentest-9e4brpjh.js");
123291
+ const { runPentestSwarm, DEFAULT_CONCURRENCY } = await import("./pentest-trx5r5cb.js");
123291
123292
  if (!ctx.model) {
123292
123293
  return {
123293
123294
  success: false,
@@ -126131,7 +126132,6 @@ class OffensiveSecurityAgent {
126131
126132
  sessionId: input.session.id,
126132
126133
  target: input.target
126133
126134
  });
126134
- let lastCacheMetrics = null;
126135
126135
  this.createStream = () => streamResponse({
126136
126136
  prompt: input.prompt,
126137
126137
  system: systemPrompt,
@@ -126147,15 +126147,9 @@ class OffensiveSecurityAgent {
126147
126147
  sessionId: this.busSessionId,
126148
126148
  onStepFinish: async (event) => {
126149
126149
  const auxiliaryModelEvent = event.response.id === "summarization" || event.response.id === "tool-repair";
126150
+ const stepUsage = normalizeStepUsage(event);
126150
126151
  if (auxiliaryModelEvent) {
126151
- const cacheDetails = event.usage.inputTokenDetails;
126152
- traceWriter.recordStep([], {
126153
- inputTokens: event.usage.inputTokens ?? 0,
126154
- outputTokens: event.usage.outputTokens ?? 0,
126155
- cacheReadTokens: lastCacheMetrics?.cacheReadTokens ?? cacheDetails?.cacheReadTokens,
126156
- cacheWriteTokens: lastCacheMetrics?.cacheWriteTokens ?? cacheDetails?.cacheWriteTokens
126157
- }, { usageOnly: true });
126158
- lastCacheMetrics = null;
126152
+ traceWriter.recordStep([], stepUsage, { usageOnly: true });
126159
126153
  await input.onStepFinish?.(event);
126160
126154
  return;
126161
126155
  }
@@ -126164,12 +126158,7 @@ class OffensiveSecurityAgent {
126164
126158
  ...event.response.messages
126165
126159
  ]);
126166
126160
  schedulePersist();
126167
- traceWriter.recordStep(event.response.messages, {
126168
- inputTokens: event.usage.inputTokens ?? 0,
126169
- outputTokens: event.usage.outputTokens ?? 0,
126170
- ...lastCacheMetrics
126171
- });
126172
- lastCacheMetrics = null;
126161
+ traceWriter.recordStep(event.response.messages, stepUsage);
126173
126162
  this.eventBus.emit("step-finish", {
126174
126163
  messages: event.response.messages,
126175
126164
  subagentId: this.subagentId,
@@ -126197,13 +126186,7 @@ class OffensiveSecurityAgent {
126197
126186
  },
126198
126187
  abortSignal: input.abortSignal,
126199
126188
  authConfig: input.authConfig,
126200
- onCacheMetrics: (metrics) => {
126201
- lastCacheMetrics = {
126202
- cacheReadTokens: metrics.cacheReadInputTokens,
126203
- cacheWriteTokens: metrics.cacheCreationInputTokens
126204
- };
126205
- input.onCacheMetrics?.(metrics);
126206
- },
126189
+ onCacheMetrics: input.onCacheMetrics,
126207
126190
  enableThinking: input.enableThinking,
126208
126191
  thinkingEffort: input.thinkingEffort,
126209
126192
  openAIReasoningEffort: input.openAIReasoningEffort,
@@ -126326,7 +126309,8 @@ class OffensiveSecurityAgent {
126326
126309
  throw err;
126327
126310
  } finally {
126328
126311
  unregisterActiveRootSpan(span);
126329
- span.end();
126312
+ if (span.isRecording())
126313
+ span.end();
126330
126314
  }
126331
126315
  });
126332
126316
  const drain = !isSubagent ? runInSpan() : withSubagentSessionBaggage(sid, runInSpan);