@pensar/apex 2.6.1 → 2.7.0

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 (144) hide show
  1. package/build/agent-4f87bydg.js +13 -0
  2. package/build/{agent-ayreaj6z.js → agent-6h49fhz1.js} +5 -5
  3. package/build/{agent-yby11zaq.js → agent-a5vq5fsm.js} +6 -6
  4. package/build/{agent-runs-g37vkrjr.js → agent-runs-9nncftzk.js} +16 -16
  5. package/build/agent-sa0ty54v.js +13 -0
  6. package/build/{apps-xn6km9yn.js → apps-rh90z2nb.js} +13 -13
  7. package/build/{auth-d105wc64.js → auth-hshx11mc.js} +13 -13
  8. package/build/{blackboxAgent-s56sgx9b.js → blackboxAgent-t6zq0ekj.js} +6 -6
  9. package/build/{blackboxPentest-ps78v3w7.js → blackboxPentest-eskvsmez.js} +11 -11
  10. package/build/{cli-d37a42dc.js → cli-29179gt8.js} +8 -8
  11. package/build/{cli-gx71jcke.js → cli-2etfgtj3.js} +1 -1
  12. package/build/{cli-ngq9dr8n.js → cli-6r1ntbmf.js} +3 -3
  13. package/build/{cli-709rvekb.js → cli-9eyk8rhx.js} +1 -1
  14. package/build/{cli-ae8jqxqr.js → cli-c4x5b3q4.js} +2 -2
  15. package/build/{cli-az3xq70v.js → cli-c9nnxr52.js} +1 -1
  16. package/build/{cli-1ve18npr.js → cli-dawkcveq.js} +1 -1
  17. package/build/{cli-3sp6nd8d.js → cli-dqrqgfrp.js} +2 -2
  18. package/build/{cli-7eea4e2y.js → cli-e0v6hd3d.js} +6 -6
  19. package/build/{cli-k2nwxta0.js → cli-ewav0q78.js} +2 -2
  20. package/build/{cli-kb21qhvm.js → cli-fk5e62a6.js} +2 -2
  21. package/build/{cli-65g6rcat.js → cli-gzgyjs36.js} +1 -1
  22. package/build/{cli-c05y640n.js → cli-mrk3hg6f.js} +1 -1
  23. package/build/{cli-dpsw2fe6.js → cli-prw2dfje.js} +353 -185
  24. package/build/{cli-qgz1q9g5.js → cli-pwhx13h3.js} +105 -36
  25. package/build/{cli-n2en7j5b.js → cli-q0wmet0t.js} +1 -1
  26. package/build/{cli-xtc2t6me.js → cli-tf2kp8s4.js} +3 -3
  27. package/build/{cli-fy6vh2a7.js → cli-vdbnh2ha.js} +1 -1
  28. package/build/cli.js +37 -37
  29. package/build/{config-zpqkd5cz.js → config-srw06gyv.js} +1 -1
  30. package/build/{fastStrike-mcjdvwez.js → fastStrike-gaphkhrs.js} +5 -5
  31. package/build/{fixes-kytx5dmj.js → fixes-j99tce5t.js} +13 -13
  32. package/build/{index-wqetp6gq.js → index-3rsrzfje.js} +5 -5
  33. package/build/{index-fv64eb32.js → index-652yqmn2.js} +2 -2
  34. package/build/{index-n65z6v7b.js → index-6fxag2h2.js} +6 -6
  35. package/build/{index-r9yjkfrv.js → index-a9yy0fe3.js} +4 -4
  36. package/build/{index-dr3tg1w3.js → index-c1tgca1w.js} +1 -1
  37. package/build/{index-qv4cc65p.js → index-fsv57ssp.js} +13 -13
  38. package/build/{index-ns4m4s01.js → index-y9h10rfq.js} +4 -4
  39. package/build/{index-4vqdgb42.js → index-yj0ye642.js} +1236 -1195
  40. package/build/{index-je6hcsqr.js → index-ynsam8mg.js} +1 -1
  41. package/build/{issues-eb3q9d3a.js → issues-267ytycy.js} +13 -13
  42. package/build/{knowledge-fqsvtx0f.js → knowledge-44acmwfw.js} +13 -13
  43. package/build/lib/{chunk-yrnrbjes.js → chunk-2015fqpw.js} +1 -1
  44. package/build/lib/{chunk-acgbyf5h.js → chunk-3jr0sp3v.js} +1 -1
  45. package/build/lib/{chunk-7pwa92rn.js → chunk-45ne0t6e.js} +1 -1
  46. package/build/lib/{chunk-nhfax4gb.js → chunk-5ma2ns65.js} +1 -1
  47. package/build/lib/{chunk-z96pbjhd.js → chunk-8zfn4feq.js} +1 -1
  48. package/build/lib/{chunk-1jvwqnem.js → chunk-93b8vp9x.js} +3 -3
  49. package/build/lib/{chunk-r4j8ybn9.js → chunk-9kmc9yp6.js} +37 -20
  50. package/build/lib/{chunk-9yksqgzr.js → chunk-bb2sekn4.js} +11 -11
  51. package/build/lib/{chunk-e8yy2k73.js → chunk-c3e9aen5.js} +1 -1
  52. package/build/lib/{chunk-v3dk9j7k.js → chunk-db0bmkrv.js} +11 -11
  53. package/build/lib/{chunk-1yct6cra.js → chunk-dm8yvkdy.js} +1 -1
  54. package/build/lib/{chunk-xhdpgpkm.js → chunk-dvn6bg2m.js} +2 -2
  55. package/build/lib/{chunk-9tt2021m.js → chunk-fwe0fdb5.js} +9 -9
  56. package/build/lib/{chunk-3c00n0cy.js → chunk-gfzspfyd.js} +3 -3
  57. package/build/lib/{chunk-ba41jh41.js → chunk-hw0vcs3m.js} +297 -127
  58. package/build/lib/{chunk-r2dkp4tb.js → chunk-m8w0npxg.js} +1 -1
  59. package/build/lib/{chunk-z137x08b.js → chunk-mbm9w4ac.js} +5 -5
  60. package/build/lib/{chunk-4hwzqthr.js → chunk-mjey3y7s.js} +1 -1
  61. package/build/lib/{chunk-mg03jdmt.js → chunk-mw108bmx.js} +1 -1
  62. package/build/lib/{chunk-1azdancq.js → chunk-njn4tjsr.js} +1 -1
  63. package/build/lib/{chunk-bb0ekhkw.js → chunk-p8jd9s8k.js} +8 -8
  64. package/build/lib/{chunk-2qsq76xq.js → chunk-t6yh604c.js} +62 -10
  65. package/build/lib/{chunk-1fy8azee.js → chunk-yqengqce.js} +1 -1
  66. package/build/lib/{chunk-w66ce82a.js → chunk-ysmhn1p6.js} +1 -1
  67. package/build/lib/core/agents/offSecAgent/index.js +7 -7
  68. package/build/lib/core/agents/offSecAgent/subagentSpawner.js +5 -5
  69. package/build/lib/core/agents/offSecAgent/tools/index.js +4 -4
  70. package/build/lib/core/agents/offSecAgent/tools/listMemories.d.ts +11 -1
  71. package/build/lib/core/agents/specialized/attackSurface/blackboxAgent.js +9 -9
  72. package/build/lib/core/agents/specialized/attackSurface/schemas.js +9 -9
  73. package/build/lib/core/agents/specialized/authenticationAgent/index.js +10 -10
  74. package/build/lib/core/agents/specialized/codeAgent/agent.js +9 -9
  75. package/build/lib/core/agents/specialized/findingJudge/agent.js +8 -8
  76. package/build/lib/core/agents/specialized/findingJudge/index.js +3 -3
  77. package/build/lib/core/agents/specialized/patching/index.js +10 -10
  78. package/build/lib/core/agents/specialized/pentest/agent.js +9 -9
  79. package/build/lib/core/agents/specialized/whiteboxAttackSurface/index.js +9 -9
  80. package/build/lib/core/ai/ai.d.ts +23 -6
  81. package/build/lib/core/ai/ai.js +2 -2
  82. package/build/lib/core/ai/index.js +2 -2
  83. package/build/lib/core/ai/models/claude-capabilities.d.ts +3 -2
  84. package/build/lib/core/ai/models/index.d.ts +1 -1
  85. package/build/lib/core/ai/utils.d.ts +2 -0
  86. package/build/lib/core/ai/utils.js +4 -2
  87. package/build/lib/core/api/index.js +19 -19
  88. package/build/lib/core/api/targetedPentest.js +10 -10
  89. package/build/lib/core/config/index.js +1 -1
  90. package/build/lib/core/findings/registry.js +3 -3
  91. package/build/lib/core/session/index.js +2 -2
  92. package/build/lib/core/session/persistence.js +3 -3
  93. package/build/lib/core/workflows/pentest.js +15 -15
  94. package/build/lib/core/workflows/seams.js +4 -4
  95. package/build/lib/core/workflows/whiteboxAttackSurface.js +11 -11
  96. package/build/lib/index.js +22 -22
  97. package/build/{logs-x62b7hk1.js → logs-wx69vy65.js} +13 -13
  98. package/build/{native-rollout-evidence-c9yhfqcs.js → native-rollout-evidence-2akrepvz.js} +3 -3
  99. package/build/{offesecAgent-5whnpeta.js → offesecAgent-zewvmk98.js} +4 -4
  100. package/build/pentest-n2mjksg2.js +22 -0
  101. package/build/{pentests-e0f32aqx.js → pentests-xvj8g8h4.js} +13 -13
  102. package/build/recordedRunClient-a0ye97sw.js +11 -0
  103. package/build/{targetedPentest-rcbs4nvp.js → targetedPentest-p3cdq712.js} +6 -6
  104. package/build/{targets-xj9g3q0z.js → targets-1wajqhm7.js} +13 -13
  105. package/build/threatModel-g9pbtnt1.js +21 -0
  106. package/build/{uninstall-7s784q4a.js → uninstall-jpm5ppfb.js} +1 -1
  107. package/build/{upload-4gvhwmvr.js → upload-csny5mns.js} +4 -4
  108. package/build/{utils-cjrz64pc.js → utils-tzbr4bxg.js} +3 -3
  109. package/package.json +1 -1
  110. package/src/core/agents/offSecAgent/offensiveSecurityAgent.test.ts +92 -5
  111. package/src/core/agents/offSecAgent/offensiveSecurityAgent.ts +49 -28
  112. package/src/core/agents/offSecAgent/tools/listMemories.test.ts +230 -0
  113. package/src/core/agents/offSecAgent/tools/listMemories.ts +73 -6
  114. package/src/core/ai/ai.operator-context.bench.test.ts +1408 -0
  115. package/src/core/ai/ai.recorded-context.test.ts +74 -0
  116. package/src/core/ai/ai.test.ts +54 -0
  117. package/src/core/ai/ai.ts +299 -80
  118. package/src/core/ai/compactionTelemetry.test.ts +2 -2
  119. package/src/core/ai/models/anthropic.ts +6 -0
  120. package/src/core/ai/models/bedrock.ts +18 -0
  121. package/src/core/ai/models/claude-capabilities.ts +29 -8
  122. package/src/core/ai/models/index.ts +4 -1
  123. package/src/core/ai/models/models.test.ts +23 -0
  124. package/src/core/ai/models/openrouter.ts +6 -0
  125. package/src/core/ai/providers/anthropic-models.test.ts +60 -1
  126. package/src/core/ai/providers/bedrock-models.test.ts +81 -0
  127. package/src/core/ai/providers/gateway-models.test.ts +16 -6
  128. package/src/core/ai/utils.native-rollout-evidence.test.ts +1 -0
  129. package/src/core/ai/utils.ts +189 -143
  130. package/src/core/observability/telemetry.test.ts +2 -3
  131. package/src/tui/components/chat/loading-indicator.tsx +20 -4
  132. package/src/tui/components/chat/message-list.tsx +1 -0
  133. package/src/tui/components/operator-dashboard/run-events.test.ts +3 -1
  134. package/src/tui/components/shared/__tests__/tool-renderer-lifecycle.tsx +18 -0
  135. package/src/tui/components/shared/action-label.test.ts +9 -0
  136. package/src/tui/components/shared/compacting-icon.tsx +18 -0
  137. package/src/tui/components/shared/index.ts +1 -0
  138. package/src/tui/components/shared/tool-registry.ts +1 -0
  139. package/src/tui/components/shared/tool-renderer.tsx +21 -7
  140. package/build/agent-6w7egcf1.js +0 -13
  141. package/build/agent-9zx75feh.js +0 -13
  142. package/build/pentest-e61hc38s.js +0 -22
  143. package/build/recordedRunClient-dp032c32.js +0 -11
  144. package/build/threatModel-jkxfa40s.js +0 -21
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  config2,
3
3
  init_config
4
- } from "./cli-fy6vh2a7.js";
4
+ } from "./cli-vdbnh2ha.js";
5
5
  import {
6
6
  getPensarApiUrl2,
7
7
  init_constants,
8
8
  ensureValidToken2,
9
9
  signGatewayRequest2,
10
10
  init_auth
11
- } from "./cli-c05y640n.js";
11
+ } from "./cli-mrk3hg6f.js";
12
12
  import {
13
13
  parseTargetUrl
14
14
  } from "./cli-0wsh8j2t.js";
@@ -42,7 +42,7 @@ import {
42
42
  normalizeStepUsage,
43
43
  streamResponse,
44
44
  generateObjectResponse
45
- } from "./cli-dpsw2fe6.js";
45
+ } from "./cli-prw2dfje.js";
46
46
  import {
47
47
  init_v4,
48
48
  tool
@@ -82,7 +82,7 @@ import {
82
82
  import {
83
83
  getCurrentVersion,
84
84
  init_installation
85
- } from "./cli-65g6rcat.js";
85
+ } from "./cli-gzgyjs36.js";
86
86
  import {
87
87
  require_src6
88
88
  } from "./cli-bb02pjt0.js";
@@ -112618,7 +112618,7 @@ function resolveItemHooks(hooks, seams, item, index) {
112618
112618
 
112619
112619
  // src/core/agents/offSecAgent/subagentSpawner.ts
112620
112620
  async function runSpawnedPentestWorker(spec, input) {
112621
- const { TargetedPentestAgent } = await import("./agent-yby11zaq.js");
112621
+ const { TargetedPentestAgent } = await import("./agent-a5vq5fsm.js");
112622
112622
  const hooks = resolveItemHooks(input.hooks, input.seams, spec, 0);
112623
112623
  const agent = new TargetedPentestAgent({
112624
112624
  target: spec.target,
@@ -112695,7 +112695,7 @@ var runPentestChild = async (spec, ctx) => {
112695
112695
  };
112696
112696
  };
112697
112697
  var runCodeChild = async (spec, ctx) => {
112698
- const { CodeAgent } = await import("./agent-9zx75feh.js");
112698
+ const { CodeAgent } = await import("./agent-sa0ty54v.js");
112699
112699
  const agent = new CodeAgent({
112700
112700
  codebasePath: spec.codebasePath,
112701
112701
  objective: spec.objective,
@@ -112727,7 +112727,7 @@ var runCodeChild = async (spec, ctx) => {
112727
112727
  return { run: () => agent.consume(), drained: () => agent.drained };
112728
112728
  };
112729
112729
  var runWhiteboxChild = async (spec, ctx) => {
112730
- const { WhiteboxAttackSurfaceAgent } = await import("./index-n65z6v7b.js");
112730
+ const { WhiteboxAttackSurfaceAgent } = await import("./index-6fxag2h2.js");
112731
112731
  const agent = new WhiteboxAttackSurfaceAgent({
112732
112732
  codebasePath: spec.codebasePath,
112733
112733
  attackSurfaceRegistry: spec.attackSurfaceRegistry,
@@ -112747,7 +112747,7 @@ var runWhiteboxChild = async (spec, ctx) => {
112747
112747
  return { run: () => agent.consume(), drained: () => agent.drained };
112748
112748
  };
112749
112749
  var runBlackboxChild = async (spec, ctx) => {
112750
- const { BlackboxAttackSurfaceAgent } = await import("./blackboxAgent-s56sgx9b.js");
112750
+ const { BlackboxAttackSurfaceAgent } = await import("./blackboxAgent-t6zq0ekj.js");
112751
112751
  const agent = new BlackboxAttackSurfaceAgent({
112752
112752
  target: spec.target,
112753
112753
  attackSurfaceRegistry: spec.attackSurfaceRegistry,
@@ -112766,7 +112766,7 @@ var runBlackboxChild = async (spec, ctx) => {
112766
112766
  return { run: () => agent.consume(), drained: () => agent.drained };
112767
112767
  };
112768
112768
  var runAuthChild = async (spec, ctx) => {
112769
- const { runAuthenticationAgent } = await import("./agent-6w7egcf1.js");
112769
+ const { runAuthenticationAgent } = await import("./agent-4f87bydg.js");
112770
112770
  return {
112771
112771
  run: () => runAuthenticationAgent({
112772
112772
  target: spec.target,
@@ -112788,7 +112788,7 @@ var runAuthChild = async (spec, ctx) => {
112788
112788
  };
112789
112789
  };
112790
112790
  var runJudgeChild = async (spec, ctx) => {
112791
- const { judgeFinding } = await import("./index-ns4m4s01.js");
112791
+ const { judgeFinding } = await import("./index-y9h10rfq.js");
112792
112792
  return {
112793
112793
  run: () => judgeFinding(spec.judgeInput, {
112794
112794
  model: ctx.model,
@@ -124836,34 +124836,86 @@ Each directory entry is suffixed with "/" for easy identification.`,
124836
124836
  // src/core/agents/offSecAgent/tools/listMemories.ts
124837
124837
  init_dist();
124838
124838
  init_zod();
124839
+ var PAGE_SIZE = 20;
124840
+ var PAGE_CHAR_BUDGET = 12000;
124839
124841
  var listMemoriesInputSchema = object({
124840
124842
  category: _enum(MEMORY_CATEGORIES).optional().describe('Filter by category: "app", "framework", or "general". ' + "Omit to list memories across all categories."),
124841
124843
  tag: string().optional().describe("Optional tag to filter memories by (exact match)"),
124844
+ cursor: object({
124845
+ createdAt: string(),
124846
+ category: _enum(MEMORY_CATEGORIES),
124847
+ id: string()
124848
+ }).optional().describe("Pass the previous nextCursor to continue a listing"),
124842
124849
  toolCallDescription: string().describe("A concise, human-readable description of what this tool call is doing (e.g., 'Listing stored recon notes')")
124843
124850
  });
124851
+ function compareMemories(a, b) {
124852
+ const byCreatedAt = Date.parse(b.createdAt) - Date.parse(a.createdAt);
124853
+ if (byCreatedAt > 0 || byCreatedAt < 0)
124854
+ return byCreatedAt;
124855
+ return a.category.localeCompare(b.category) || a.id.localeCompare(b.id);
124856
+ }
124857
+ function previewSummary(memory) {
124858
+ const title = memory.title.slice(0, 160);
124859
+ const tags = memory.tags.slice(0, 8).map((tag) => tag.slice(0, 48));
124860
+ const truncated = title.length < memory.title.length || tags.length < memory.tags.length || tags.some((tag, index) => tag.length < (memory.tags[index]?.length ?? tag.length));
124861
+ return {
124862
+ id: memory.id,
124863
+ category: memory.category,
124864
+ title,
124865
+ tags,
124866
+ createdAt: memory.createdAt,
124867
+ ...truncated ? { truncated: true } : {}
124868
+ };
124869
+ }
124844
124870
  function listMemories2(ctx) {
124845
124871
  return tool({
124846
124872
  description: `List saved memories, optionally filtered by category and/or tag.
124847
124873
 
124848
- Returns lightweight summaries (id, category, title, tags, createdAt) sorted by
124849
- most recent first. Use the returned category + id with get_memory to retrieve
124850
- full content.`,
124874
+ Returns up to 20 lightweight summaries (id, category, title, tags, createdAt)
124875
+ sorted by most recent first. Use nextCursor to continue until it is null;
124876
+ count is the current total matching memories. A fresh listing includes newer
124877
+ memories added ahead of a cursor. Titles and tags may be abbreviated in the
124878
+ listing. Use category + id with get_memory to retrieve full content.`,
124851
124879
  inputSchema: listMemoriesInputSchema,
124852
- execute: async ({ category, tag }, { toolCallId }) => {
124880
+ execute: async ({ category, tag, cursor }, { toolCallId }) => {
124853
124881
  try {
124854
124882
  const memories = await listMemories({ category, tag }, { sessionId: ctx.session.id, toolCallId });
124883
+ const ordered = [...memories].sort(compareMemories);
124884
+ let start = 0;
124885
+ if (cursor) {
124886
+ start = ordered.findIndex((memory) => compareMemories(memory, cursor) > 0);
124887
+ if (start < 0)
124888
+ start = ordered.length;
124889
+ }
124890
+ const page = [];
124891
+ let pageChars = 0;
124892
+ for (const memory of ordered.slice(start, start + PAGE_SIZE)) {
124893
+ const summary = previewSummary(memory);
124894
+ const chars = JSON.stringify(summary).length + 1;
124895
+ if (page.length > 0 && pageChars + chars > PAGE_CHAR_BUDGET)
124896
+ break;
124897
+ page.push(summary);
124898
+ pageChars += chars;
124899
+ }
124900
+ const last = page.at(-1);
124855
124901
  return {
124856
124902
  success: true,
124857
124903
  error: "",
124858
- memories,
124859
- count: memories.length
124904
+ memories: page,
124905
+ count: memories.length,
124906
+ nextCursor: start + page.length < ordered.length && last ? {
124907
+ createdAt: last.createdAt,
124908
+ category: last.category,
124909
+ id: last.id
124910
+ } : null
124860
124911
  };
124861
124912
  } catch (err) {
124862
124913
  return {
124863
124914
  success: false,
124864
124915
  error: err instanceof Error ? err.message : String(err),
124865
124916
  memories: [],
124866
- count: 0
124917
+ count: 0,
124918
+ nextCursor: null
124867
124919
  };
124868
124920
  }
124869
124921
  }
@@ -125868,7 +125920,7 @@ Omit \`cwd\` for blackbox mode (live target probing only).`,
125868
125920
  toolCallDescription: string().describe("A concise, human-readable description of what this tool call is doing")
125869
125921
  }),
125870
125922
  execute: async ({ target, cwd }) => {
125871
- const { runPentestWorkflow: workflow } = await import("./pentest-e61hc38s.js");
125923
+ const { runPentestWorkflow: workflow } = await import("./pentest-n2mjksg2.js");
125872
125924
  if (!ctx.model) {
125873
125925
  return {
125874
125926
  success: false,
@@ -126453,7 +126505,7 @@ Pass every target you want tested — the swarm handles concurrency automaticall
126453
126505
  toolCallDescription: string().describe("A concise, human-readable description of what this tool call is doing")
126454
126506
  }),
126455
126507
  execute: async ({ targets }) => {
126456
- const { runPentestSwarm, DEFAULT_CONCURRENCY } = await import("./pentest-e61hc38s.js");
126508
+ const { runPentestSwarm, DEFAULT_CONCURRENCY } = await import("./pentest-n2mjksg2.js");
126457
126509
  if (!ctx.model) {
126458
126510
  return {
126459
126511
  success: false,
@@ -128803,13 +128855,27 @@ class OffensiveSecurityAgent {
128803
128855
  mkdirSync10(messagesDir, { recursive: true });
128804
128856
  }
128805
128857
  this.messagesPath = join28(messagesDir, "messages.json");
128806
- const initialMessagesRef = {
128807
- current: input.messages ? [...input.messages] : [
128808
- {
128809
- role: "user",
128810
- content: [{ type: "text", text: input.prompt }]
128811
- }
128812
- ]
128858
+ const preparedContextRef = {
128859
+ current: {
128860
+ messages: input.messages ? [...input.messages] : [
128861
+ {
128862
+ role: "user",
128863
+ content: [{ type: "text", text: input.prompt }]
128864
+ }
128865
+ ],
128866
+ responseMessageOffset: 0
128867
+ }
128868
+ };
128869
+ const legacyMessages = (responseMessages) => [
128870
+ ...preparedContextRef.current.messages,
128871
+ ...responseMessages.slice(preparedContextRef.current.responseMessageOffset)
128872
+ ];
128873
+ const persistedMessages = (messages) => {
128874
+ let first = 0;
128875
+ while (messages[first]?.role === "system" && messages[first]?.providerOptions) {
128876
+ first++;
128877
+ }
128878
+ return first === 0 ? messages : messages.slice(first);
128813
128879
  };
128814
128880
  this.writer = new AgentMessageWriter({ messagesPath: this.messagesPath });
128815
128881
  this.finalizeInterruptedStep = createInterruptedStepFinalizer({
@@ -128863,6 +128929,12 @@ class OffensiveSecurityAgent {
128863
128929
  usageRecorder: input.usageRecorder,
128864
128930
  contextRecorder: input.contextRecorder,
128865
128931
  inferenceRecorder: input.inferenceRecorder,
128932
+ onContextPrepared: (context) => {
128933
+ preparedContextRef.current = {
128934
+ messages: [...context.messages],
128935
+ responseMessageOffset: context.responseMessageOffset
128936
+ };
128937
+ },
128866
128938
  sessionPath: messagesDir,
128867
128939
  sessionId: this.busSessionId,
128868
128940
  onStepFinish: async (event) => {
@@ -128873,11 +128945,8 @@ class OffensiveSecurityAgent {
128873
128945
  await input.onStepFinish?.(event);
128874
128946
  return;
128875
128947
  }
128876
- const canonical = input.contextRecorder?.latest() ?? [
128877
- ...initialMessagesRef.current,
128878
- ...event.response.messages
128879
- ];
128880
- this.writer.setLatest(canonical);
128948
+ const canonical = input.contextRecorder?.latest() ?? legacyMessages(event.response.messages);
128949
+ this.writer.setLatest(persistedMessages(canonical));
128881
128950
  schedulePersist();
128882
128951
  traceWriter.recordStep(event.response.messages, stepUsage);
128883
128952
  this.eventBus.emit("step-finish", {
@@ -128890,16 +128959,16 @@ class OffensiveSecurityAgent {
128890
128959
  await input.onStepFinish?.(event);
128891
128960
  },
128892
128961
  onSummarized: () => {
128893
- initialMessagesRef.current = [];
128962
+ preparedContextRef.current = {
128963
+ messages: [],
128964
+ responseMessageOffset: 0
128965
+ };
128894
128966
  traceWriter.markSummarized();
128895
128967
  },
128896
128968
  onFinish: async (event) => {
128897
128969
  this.writer.cancelTimer();
128898
128970
  if (!this.writer.syntheticsPersisted) {
128899
- const finalMessages = input.contextRecorder?.latest() ?? this.writer.latest ?? [
128900
- ...initialMessagesRef.current,
128901
- ...event.response.messages
128902
- ];
128971
+ const finalMessages = persistedMessages(input.contextRecorder?.latest() ?? this.writer.latest ?? legacyMessages(event.response.messages));
128903
128972
  this.writer.setLatest(finalMessages);
128904
128973
  await this.writer.enqueueWrite(finalMessages).catch(() => {});
128905
128974
  }
@@ -4,7 +4,7 @@ import {
4
4
  ValidatedCweEntrySchema,
5
5
  hasCanonicalName,
6
6
  EvidenceFileEntrySchema
7
- } from "./cli-qgz1q9g5.js";
7
+ } from "./cli-pwhx13h3.js";
8
8
  import {
9
9
  init_zod
10
10
  } from "./cli-3qznjsnr.js";
@@ -7,7 +7,7 @@ import {
7
7
  REPORT_ERROR_TOOL_NAME,
8
8
  createReportErrorTool,
9
9
  PentestReportedError
10
- } from "./cli-qgz1q9g5.js";
10
+ } from "./cli-pwhx13h3.js";
11
11
  import {
12
12
  GOOGLE_SIGNIN_PROMPT_GUIDANCE,
13
13
  browserEngineForGoogleSignIn
@@ -18,7 +18,7 @@ import {
18
18
  import {
19
19
  AgentRuntime,
20
20
  defineAgent
21
- } from "./cli-1ve18npr.js";
21
+ } from "./cli-dawkcveq.js";
22
22
  import {
23
23
  hasToolCall,
24
24
  init_dist,
@@ -26,7 +26,7 @@ import {
26
26
  init_lazyLogger,
27
27
  createLogger,
28
28
  init_structured
29
- } from "./cli-dpsw2fe6.js";
29
+ } from "./cli-prw2dfje.js";
30
30
  import {
31
31
  init_zod
32
32
  } from "./cli-3qznjsnr.js";
@@ -3,7 +3,7 @@ import {
3
3
  get2,
4
4
  update2,
5
5
  init_config2
6
- } from "./cli-709rvekb.js";
6
+ } from "./cli-9eyk8rhx.js";
7
7
  import {
8
8
  __esm
9
9
  } from "./cli-h6y3bt60.js";
package/build/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- import"./cli-fy6vh2a7.js";
4
- import"./cli-c05y640n.js";
3
+ import"./cli-vdbnh2ha.js";
4
+ import"./cli-mrk3hg6f.js";
5
5
  import {
6
6
  require_src,
7
7
  require_src2,
@@ -27,7 +27,7 @@ import {
27
27
  logger,
28
28
  init_structured,
29
29
  init_ai2
30
- } from "./cli-dpsw2fe6.js";
30
+ } from "./cli-prw2dfje.js";
31
31
  import {
32
32
  init_inference_attempt,
33
33
  init_native_rollout_evidence
@@ -40,13 +40,13 @@ import {
40
40
  init_customProviders,
41
41
  resolveHoonifyModel,
42
42
  init_hoonify
43
- } from "./cli-709rvekb.js";
43
+ } from "./cli-9eyk8rhx.js";
44
44
  import {
45
45
  init_package,
46
46
  version,
47
47
  package_default,
48
48
  init_installation
49
- } from "./cli-65g6rcat.js";
49
+ } from "./cli-gzgyjs36.js";
50
50
  import {
51
51
  require_src6
52
52
  } from "./cli-bb02pjt0.js";
@@ -725,7 +725,7 @@ var package_default2 = {
725
725
  tsc: "tsc --noEmit"
726
726
  },
727
727
  type: "module",
728
- version: "2.6.1"
728
+ version: "2.7.0"
729
729
  };
730
730
 
731
731
  // src/core/ai/index.ts
@@ -1584,7 +1584,7 @@ async function createInstrumentedBus(session, model) {
1584
1584
  reportHerdrState("working");
1585
1585
  const bus = new AgentEventBus;
1586
1586
  attachCliAgentStreamListeners(bus);
1587
- const { attachWandbToEventBus } = await import("./upload-4gvhwmvr.js");
1587
+ const { attachWandbToEventBus } = await import("./upload-csny5mns.js");
1588
1588
  const wandbCleanup = await attachWandbToEventBus(session, bus).catch((e) => {
1589
1589
  console.warn("[wandb] Tracing disabled:", e.message);
1590
1590
  return null;
@@ -1604,7 +1604,7 @@ async function resolveCliHeaders() {
1604
1604
  const { parseHeaderLine, parseHeadersFromFile, formatParseError } = await import("./parse-cqecqrc5.js");
1605
1605
  const merged = {};
1606
1606
  if (!noGlobal) {
1607
- const { config: appConfig } = await import("./index-je6hcsqr.js");
1607
+ const { config: appConfig } = await import("./index-ynsam8mg.js");
1608
1608
  const cfg = await appConfig.get();
1609
1609
  if (cfg.defaultHeaders) {
1610
1610
  Object.assign(merged, cfg.defaultHeaders);
@@ -1635,8 +1635,8 @@ ${formatParseError(parsed.error)}`);
1635
1635
  return merged;
1636
1636
  }
1637
1637
  async function resolveCliModel() {
1638
- const { config: appConfig } = await import("./index-je6hcsqr.js");
1639
- const { getDefaultModelForConfig } = await import("./utils-cjrz64pc.js");
1638
+ const { config: appConfig } = await import("./index-ynsam8mg.js");
1639
+ const { getDefaultModelForConfig } = await import("./utils-tzbr4bxg.js");
1640
1640
  const pensarConfig = await appConfig.get();
1641
1641
  const explicit = resolveExplicitCliModel({
1642
1642
  model: getArg("--model"),
@@ -1769,9 +1769,9 @@ Custom inference:
1769
1769
  `);
1770
1770
  }
1771
1771
  async function runPentest() {
1772
- const { runPentestAgent } = await import("./blackboxPentest-ps78v3w7.js");
1773
- const { sessions } = await import("./index-wqetp6gq.js");
1774
- const { config: appConfig } = await import("./index-je6hcsqr.js");
1772
+ const { runPentestAgent } = await import("./blackboxPentest-eskvsmez.js");
1773
+ const { sessions } = await import("./index-3rsrzfje.js");
1774
+ const { config: appConfig } = await import("./index-ynsam8mg.js");
1775
1775
  const target = getArgRequired("--target");
1776
1776
  const cwd = getArg("--cwd");
1777
1777
  const mode = getArg("--mode");
@@ -1820,7 +1820,7 @@ Headers: ${Object.keys(headers).length} configured` : ""}
1820
1820
  }
1821
1821
  });
1822
1822
  console.log(`PENSAR_SESSION_PATH:${session.rootPath}`);
1823
- const { runWithCliNativeRolloutEvidence } = await import("./native-rollout-evidence-c9yhfqcs.js");
1823
+ const { runWithCliNativeRolloutEvidence } = await import("./native-rollout-evidence-2akrepvz.js");
1824
1824
  const evidence = await runWithCliNativeRolloutEvidence({
1825
1825
  session,
1826
1826
  outputDirectory: evidenceOutput,
@@ -1856,9 +1856,9 @@ Report: ${reportPath}` : ""}`);
1856
1856
  }
1857
1857
  }
1858
1858
  async function runTargetedPentest() {
1859
- const { runTargetedPentestAgent } = await import("./targetedPentest-rcbs4nvp.js");
1860
- const { sessions } = await import("./index-wqetp6gq.js");
1861
- const { config: appConfig } = await import("./index-je6hcsqr.js");
1859
+ const { runTargetedPentestAgent } = await import("./targetedPentest-p3cdq712.js");
1860
+ const { sessions } = await import("./index-3rsrzfje.js");
1861
+ const { config: appConfig } = await import("./index-ynsam8mg.js");
1862
1862
  const target = getArgRequired("--target");
1863
1863
  const objectives = getAllArgs("--objective");
1864
1864
  const evidenceOutput = nativeRolloutEvidenceOutput();
@@ -1891,7 +1891,7 @@ ${objectivesList}
1891
1891
  } : {}
1892
1892
  });
1893
1893
  console.log(`PENSAR_SESSION_PATH:${session.rootPath}`);
1894
- const { runWithCliNativeRolloutEvidence } = await import("./native-rollout-evidence-c9yhfqcs.js");
1894
+ const { runWithCliNativeRolloutEvidence } = await import("./native-rollout-evidence-2akrepvz.js");
1895
1895
  const evidence = await runWithCliNativeRolloutEvidence({
1896
1896
  session,
1897
1897
  outputDirectory: evidenceOutput,
@@ -1923,8 +1923,8 @@ POCs: ${pocsPath}`);
1923
1923
  }
1924
1924
  }
1925
1925
  async function runThreatModel() {
1926
- const { runThreatModelWorkflow } = await import("./threatModel-jkxfa40s.js");
1927
- const { config: appConfig } = await import("./index-je6hcsqr.js");
1926
+ const { runThreatModelWorkflow } = await import("./threatModel-g9pbtnt1.js");
1927
+ const { config: appConfig } = await import("./index-ynsam8mg.js");
1928
1928
  const path = await import("path");
1929
1929
  const pensarConfig = await appConfig.get();
1930
1930
  const model = await resolveCliModel();
@@ -1959,10 +1959,10 @@ ${sep}
1959
1959
  Threat model written to: ${resolvedPath}`);
1960
1960
  }
1961
1961
  async function runOperator() {
1962
- const { runOffensiveSecurityAgent } = await import("./offesecAgent-5whnpeta.js");
1963
- const { sessions, normalizeMessages, getResumeMessages } = await import("./index-wqetp6gq.js");
1964
- const { ALL_TOOL_NAMES, SKILL_TOOL_NAMES } = await import("./index-r9yjkfrv.js");
1965
- const { config: appConfig } = await import("./index-je6hcsqr.js");
1962
+ const { runOffensiveSecurityAgent } = await import("./offesecAgent-zewvmk98.js");
1963
+ const { sessions, normalizeMessages, getResumeMessages } = await import("./index-3rsrzfje.js");
1964
+ const { ALL_TOOL_NAMES, SKILL_TOOL_NAMES } = await import("./index-a9yy0fe3.js");
1965
+ const { config: appConfig } = await import("./index-ynsam8mg.js");
1966
1966
  const { createInterface } = await import("readline");
1967
1967
  const { readFileSync, existsSync } = await import("fs");
1968
1968
  const path = await import("path");
@@ -2003,7 +2003,7 @@ ${sep}
2003
2003
  ...evidenceOutput ? { nativeRolloutEvidence: { outputDirectory: evidenceOutput } } : {}
2004
2004
  }
2005
2005
  });
2006
- const { runWithCliNativeRolloutEvidence } = await import("./native-rollout-evidence-c9yhfqcs.js");
2006
+ const { runWithCliNativeRolloutEvidence } = await import("./native-rollout-evidence-2akrepvz.js");
2007
2007
  const evidence = await runWithCliNativeRolloutEvidence({
2008
2008
  session,
2009
2009
  outputDirectory: evidenceOutput,
@@ -2105,7 +2105,7 @@ try {
2105
2105
  await standaloneRuntime?.shutdown();
2106
2106
  process.exitCode = 1;
2107
2107
  } else {
2108
- const { startTui } = await import("./index-4vqdgb42.js");
2108
+ const { startTui } = await import("./index-yj0ye642.js");
2109
2109
  await startTui(options);
2110
2110
  }
2111
2111
  } else if (hasFlag("-p") || command === "--prompt") {
@@ -2125,37 +2125,37 @@ try {
2125
2125
  await runTargetedPentest();
2126
2126
  } else if (command === "login" || command === "auth") {
2127
2127
  process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
2128
- await import("./auth-d105wc64.js");
2128
+ await import("./auth-hshx11mc.js");
2129
2129
  } else if (command === "uninstall") {
2130
2130
  process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
2131
- await import("./uninstall-7s784q4a.js");
2131
+ await import("./uninstall-jpm5ppfb.js");
2132
2132
  } else if (command === "apps") {
2133
2133
  process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
2134
- await import("./apps-xn6km9yn.js");
2134
+ await import("./apps-rh90z2nb.js");
2135
2135
  } else if (command === "pentests") {
2136
2136
  process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
2137
- await import("./pentests-e0f32aqx.js");
2137
+ await import("./pentests-xvj8g8h4.js");
2138
2138
  } else if (command === "agent-runs") {
2139
- const { runAgentRunsCommand } = await import("./agent-runs-g37vkrjr.js");
2139
+ const { runAgentRunsCommand } = await import("./agent-runs-9nncftzk.js");
2140
2140
  await runAgentRunsCommand(args.slice(1));
2141
2141
  } else if (command === "targets") {
2142
2142
  process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
2143
- await import("./targets-xj9g3q0z.js");
2143
+ await import("./targets-1wajqhm7.js");
2144
2144
  } else if (command === "issues") {
2145
2145
  process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
2146
- await import("./issues-eb3q9d3a.js");
2146
+ await import("./issues-267ytycy.js");
2147
2147
  } else if (command === "knowledge") {
2148
2148
  process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
2149
- await import("./knowledge-fqsvtx0f.js");
2149
+ await import("./knowledge-44acmwfw.js");
2150
2150
  } else if (command === "fixes") {
2151
2151
  process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
2152
- await import("./fixes-kytx5dmj.js");
2152
+ await import("./fixes-j99tce5t.js");
2153
2153
  } else if (command === "logs") {
2154
2154
  process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
2155
- await import("./logs-x62b7hk1.js");
2155
+ await import("./logs-wx69vy65.js");
2156
2156
  } else if (command === "config") {
2157
2157
  process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
2158
- await import("./config-zpqkd5cz.js");
2158
+ await import("./config-srw06gyv.js");
2159
2159
  } else if (command === "threat-model") {
2160
2160
  await runThreatModel();
2161
2161
  } else if (command === "doctor") {
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  config2,
4
4
  init_config
5
- } from "./cli-fy6vh2a7.js";
5
+ } from "./cli-vdbnh2ha.js";
6
6
  import {
7
7
  isSensitiveHeaderName,
8
8
  renderHeaderValue
@@ -5,21 +5,21 @@ import {
5
5
  assertDepth,
6
6
  inProcessSeams,
7
7
  OffensiveSecurityAgent
8
- } from "./cli-qgz1q9g5.js";
9
- import"./cli-fy6vh2a7.js";
10
- import"./cli-c05y640n.js";
8
+ } from "./cli-pwhx13h3.js";
9
+ import"./cli-vdbnh2ha.js";
10
+ import"./cli-mrk3hg6f.js";
11
11
  import {
12
12
  buildPentestReport,
13
13
  renderJson,
14
14
  renderMarkdown,
15
15
  REPORT_FILENAME_MD,
16
16
  REPORT_FILENAME_JSON
17
- } from "./cli-n2en7j5b.js";
17
+ } from "./cli-q0wmet0t.js";
18
18
  import"./cli-qba2x69h.js";
19
19
  import {
20
20
  createThreatModelPrompt
21
21
  } from "./cli-q126f6ef.js";
22
- import"./cli-dpsw2fe6.js";
22
+ import"./cli-prw2dfje.js";
23
23
  import"./cli-c2k4xxaw.js";
24
24
  import {
25
25
  init_zod
@@ -1,25 +1,25 @@
1
1
  #!/usr/bin/env bun
2
- import"./cli-fy6vh2a7.js";
3
- import"./cli-c05y640n.js";
2
+ import"./cli-vdbnh2ha.js";
3
+ import"./cli-mrk3hg6f.js";
4
4
  import {
5
5
  listFixes2,
6
6
  getFix2
7
- } from "./cli-7eea4e2y.js";
8
- import"./cli-qgz1q9g5.js";
9
- import"./cli-k2nwxta0.js";
10
- import"./cli-kb21qhvm.js";
11
- import"./cli-ngq9dr8n.js";
12
- import"./cli-d37a42dc.js";
13
- import"./cli-3sp6nd8d.js";
14
- import"./cli-xtc2t6me.js";
15
- import"./cli-n2en7j5b.js";
7
+ } from "./cli-e0v6hd3d.js";
8
+ import"./cli-pwhx13h3.js";
9
+ import"./cli-ewav0q78.js";
10
+ import"./cli-fk5e62a6.js";
11
+ import"./cli-6r1ntbmf.js";
12
+ import"./cli-29179gt8.js";
13
+ import"./cli-dqrqgfrp.js";
14
+ import"./cli-tf2kp8s4.js";
15
+ import"./cli-q0wmet0t.js";
16
16
  import"./cli-xcy2vxj2.js";
17
17
  import {
18
18
  markCommandFailed
19
19
  } from "./cli-z82n3qk1.js";
20
- import"./cli-1ve18npr.js";
20
+ import"./cli-dawkcveq.js";
21
21
  import"./cli-qba2x69h.js";
22
- import"./cli-dpsw2fe6.js";
22
+ import"./cli-prw2dfje.js";
23
23
  import"./cli-c2k4xxaw.js";
24
24
 
25
25
  // src/cli/fixes.ts
@@ -1,5 +1,5 @@
1
- import"./cli-fy6vh2a7.js";
2
- import"./cli-c05y640n.js";
1
+ import"./cli-vdbnh2ha.js";
2
+ import"./cli-mrk3hg6f.js";
3
3
  import {
4
4
  generateRandomName,
5
5
  generateSessionName,
@@ -16,7 +16,7 @@ import {
16
16
  init_storage,
17
17
  ToolsetStateSchema,
18
18
  init_toolset
19
- } from "./cli-dpsw2fe6.js";
19
+ } from "./cli-prw2dfje.js";
20
20
  import {
21
21
  schema,
22
22
  descending,
@@ -41,7 +41,7 @@ import {
41
41
  import {
42
42
  getCurrentVersion,
43
43
  init_installation
44
- } from "./cli-65g6rcat.js";
44
+ } from "./cli-gzgyjs36.js";
45
45
 
46
46
  // src/core/session/index.ts
47
47
  init_zod();
@@ -336,7 +336,7 @@ async function create(input) {
336
336
  } else if (input.inheritEnvironmentConfig === false) {
337
337
  snapshotHeaders = {};
338
338
  } else {
339
- const { config: appConfig } = await import("./index-dr3tg1w3.js");
339
+ const { config: appConfig } = await import("./index-c1tgca1w.js");
340
340
  const cfg = await appConfig.get();
341
341
  snapshotHeaders = cfg.defaultHeaders ? { ...cfg.defaultHeaders } : { ...DEFAULT_HEADER_RECORD };
342
342
  }
@@ -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-mrk3hg6f.js";
18
+ import"./cli-vdbnh2ha.js";
19
19
  init_auth();
20
20
 
21
21
  export {