@pensar/apex 2.6.1 → 2.7.0-canary.6d9d1e0d

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-davhjnxc.js +13 -0
  2. package/build/{agent-yby11zaq.js → agent-gk4vmr2h.js} +6 -6
  3. package/build/agent-mqqd38dq.js +13 -0
  4. package/build/{agent-runs-g37vkrjr.js → agent-runs-12pmj6vc.js} +16 -16
  5. package/build/{agent-ayreaj6z.js → agent-xtn1masf.js} +5 -5
  6. package/build/{apps-xn6km9yn.js → apps-yjyvn8vk.js} +13 -13
  7. package/build/{auth-d105wc64.js → auth-xzp4f1bh.js} +13 -13
  8. package/build/{blackboxAgent-s56sgx9b.js → blackboxAgent-ettjqj45.js} +6 -6
  9. package/build/{blackboxPentest-ps78v3w7.js → blackboxPentest-kf0pbhp5.js} +11 -11
  10. package/build/{cli-c05y640n.js → cli-0cwdrrq7.js} +1 -1
  11. package/build/{cli-fy6vh2a7.js → cli-0ry9v2cb.js} +1 -1
  12. package/build/{cli-7eea4e2y.js → cli-4mar7kvr.js} +6 -6
  13. package/build/{cli-k2nwxta0.js → cli-5gaxk6hd.js} +2 -2
  14. package/build/{cli-d37a42dc.js → cli-8hxrn15h.js} +8 -8
  15. package/build/{cli-az3xq70v.js → cli-arxx5hbs.js} +1 -1
  16. package/build/{cli-n2en7j5b.js → cli-ge8q6nxr.js} +1 -1
  17. package/build/{cli-1ve18npr.js → cli-gr4az5sf.js} +1 -1
  18. package/build/{cli-709rvekb.js → cli-h5wkaqwe.js} +1 -1
  19. package/build/{cli-65g6rcat.js → cli-hprqe9j2.js} +1 -1
  20. package/build/{cli-kb21qhvm.js → cli-m5ryqeav.js} +2 -2
  21. package/build/{cli-xtc2t6me.js → cli-metec8r8.js} +3 -3
  22. package/build/{cli-dpsw2fe6.js → cli-nj73990n.js} +353 -185
  23. package/build/{cli-ae8jqxqr.js → cli-pchzt5f7.js} +2 -2
  24. package/build/{cli-3sp6nd8d.js → cli-t3m0e9t2.js} +2 -2
  25. package/build/{cli-qgz1q9g5.js → cli-tfaqp0ty.js} +105 -36
  26. package/build/{cli-gx71jcke.js → cli-xpspbhqs.js} +1 -1
  27. package/build/{cli-ngq9dr8n.js → cli-zmeb85er.js} +3 -3
  28. package/build/cli.js +37 -37
  29. package/build/{config-zpqkd5cz.js → config-n03g5jad.js} +1 -1
  30. package/build/{fastStrike-mcjdvwez.js → fastStrike-9mys4r1b.js} +5 -5
  31. package/build/{fixes-kytx5dmj.js → fixes-tcd29w2t.js} +13 -13
  32. package/build/{index-je6hcsqr.js → index-3n19dh6s.js} +1 -1
  33. package/build/{index-wqetp6gq.js → index-42dnvkns.js} +5 -5
  34. package/build/{index-fv64eb32.js → index-6ptkm3fe.js} +2 -2
  35. package/build/{index-qv4cc65p.js → index-93br69mn.js} +13 -13
  36. package/build/{index-4vqdgb42.js → index-hh9bqe4y.js} +1236 -1195
  37. package/build/{index-dr3tg1w3.js → index-k1pvqjaq.js} +1 -1
  38. package/build/{index-r9yjkfrv.js → index-mmmx59w3.js} +4 -4
  39. package/build/{index-n65z6v7b.js → index-msb8ht2s.js} +6 -6
  40. package/build/{index-ns4m4s01.js → index-qtpprc5a.js} +4 -4
  41. package/build/{issues-eb3q9d3a.js → issues-d0e1tzda.js} +13 -13
  42. package/build/{knowledge-fqsvtx0f.js → knowledge-vgvrzey3.js} +13 -13
  43. package/build/lib/{chunk-1azdancq.js → chunk-0ec46jyd.js} +1 -1
  44. package/build/lib/{chunk-9yksqgzr.js → chunk-29bvrw6m.js} +11 -11
  45. package/build/lib/{chunk-z137x08b.js → chunk-3ac8kcj9.js} +5 -5
  46. package/build/lib/{chunk-bb0ekhkw.js → chunk-3g3ksmsv.js} +8 -8
  47. package/build/lib/{chunk-9tt2021m.js → chunk-45nvxhrc.js} +9 -9
  48. package/build/lib/{chunk-w66ce82a.js → chunk-66t5k77r.js} +1 -1
  49. package/build/lib/{chunk-r4j8ybn9.js → chunk-74ddy2e7.js} +37 -20
  50. package/build/lib/{chunk-4hwzqthr.js → chunk-851r7zp8.js} +1 -1
  51. package/build/lib/{chunk-1fy8azee.js → chunk-8m15nv6s.js} +1 -1
  52. package/build/lib/{chunk-7pwa92rn.js → chunk-9etzp9n2.js} +1 -1
  53. package/build/lib/{chunk-xhdpgpkm.js → chunk-acfewabw.js} +2 -2
  54. package/build/lib/{chunk-ba41jh41.js → chunk-bdbd8d8q.js} +297 -127
  55. package/build/lib/{chunk-z96pbjhd.js → chunk-c6gj39ew.js} +1 -1
  56. package/build/lib/{chunk-yrnrbjes.js → chunk-fytt5jz7.js} +1 -1
  57. package/build/lib/{chunk-3c00n0cy.js → chunk-gv1p302b.js} +3 -3
  58. package/build/lib/{chunk-1yct6cra.js → chunk-j1ftnbgr.js} +1 -1
  59. package/build/lib/{chunk-nhfax4gb.js → chunk-mepzy07f.js} +1 -1
  60. package/build/lib/{chunk-e8yy2k73.js → chunk-mqcwxrnh.js} +1 -1
  61. package/build/lib/{chunk-v3dk9j7k.js → chunk-n3kr09mb.js} +11 -11
  62. package/build/lib/{chunk-acgbyf5h.js → chunk-pd487tpr.js} +1 -1
  63. package/build/lib/{chunk-1jvwqnem.js → chunk-rchnq1ez.js} +3 -3
  64. package/build/lib/{chunk-2qsq76xq.js → chunk-wa0q3smh.js} +62 -10
  65. package/build/lib/{chunk-mg03jdmt.js → chunk-xw8d7pv7.js} +1 -1
  66. package/build/lib/{chunk-r2dkp4tb.js → chunk-y9m8yw7k.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-mvrvrkfa.js} +13 -13
  98. package/build/{native-rollout-evidence-c9yhfqcs.js → native-rollout-evidence-h2za8fyf.js} +3 -3
  99. package/build/{offesecAgent-5whnpeta.js → offesecAgent-r4hz607z.js} +4 -4
  100. package/build/pentest-52s2dn28.js +22 -0
  101. package/build/{pentests-e0f32aqx.js → pentests-yvt9wvxd.js} +13 -13
  102. package/build/recordedRunClient-6z78az3b.js +11 -0
  103. package/build/{targetedPentest-rcbs4nvp.js → targetedPentest-6aeg3nxd.js} +6 -6
  104. package/build/{targets-xj9g3q0z.js → targets-a38xnsgm.js} +13 -13
  105. package/build/threatModel-1gsb7ytk.js +21 -0
  106. package/build/{uninstall-7s784q4a.js → uninstall-kt485ay4.js} +1 -1
  107. package/build/{upload-4gvhwmvr.js → upload-ahw3are7.js} +4 -4
  108. package/build/{utils-cjrz64pc.js → utils-yqdepzr3.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,7 +1,7 @@
1
1
  import {
2
2
  exports_eventBus
3
3
  } from "./chunk-7gjdygcx.js";
4
- import"./chunk-w66ce82a.js";
4
+ import"./chunk-66t5k77r.js";
5
5
  import {
6
6
  exports_id
7
7
  } from "./chunk-jdjagvgr.js";
@@ -11,27 +11,27 @@ import {
11
11
  import {
12
12
  exports_session,
13
13
  exports_ai
14
- } from "./chunk-ba41jh41.js";
14
+ } from "./chunk-bdbd8d8q.js";
15
15
  import"./chunk-8vhr65w3.js";
16
16
  import {
17
17
  exports_offSecAgent
18
- } from "./chunk-r4j8ybn9.js";
18
+ } from "./chunk-74ddy2e7.js";
19
19
  import {
20
20
  exports_backends
21
21
  } from "./chunk-fy3bbbqy.js";
22
22
  import"./chunk-mv74mq5n.js";
23
- import"./chunk-yrnrbjes.js";
23
+ import"./chunk-fytt5jz7.js";
24
24
  import {
25
25
  exports_attackSurfaceRegistry
26
26
  } from "./chunk-b8eq85d2.js";
27
27
  import {
28
28
  exports_registry
29
- } from "./chunk-1azdancq.js";
29
+ } from "./chunk-0ec46jyd.js";
30
30
  import {
31
31
  exports_subagentSpawner
32
- } from "./chunk-3c00n0cy.js";
32
+ } from "./chunk-gv1p302b.js";
33
33
  import"./chunk-t5bt5vn1.js";
34
- import"./chunk-2qsq76xq.js";
34
+ import"./chunk-wa0q3smh.js";
35
35
  import {
36
36
  exports_prompt_injections
37
37
  } from "./chunk-eb4h4k1f.js";
@@ -43,36 +43,36 @@ import {
43
43
  import"./chunk-3q89v4xv.js";
44
44
  import"./chunk-zrbqn62x.js";
45
45
  import"./chunk-q5e23acz.js";
46
- import"./chunk-xhdpgpkm.js";
46
+ import"./chunk-acfewabw.js";
47
47
  import {
48
48
  exports_authenticationAgent
49
- } from "./chunk-7pwa92rn.js";
49
+ } from "./chunk-9etzp9n2.js";
50
50
  import {
51
51
  exports_findingJudge
52
- } from "./chunk-nhfax4gb.js";
53
- import"./chunk-1yct6cra.js";
52
+ } from "./chunk-mepzy07f.js";
53
+ import"./chunk-j1ftnbgr.js";
54
54
  import {
55
55
  exports_patching
56
- } from "./chunk-mg03jdmt.js";
56
+ } from "./chunk-xw8d7pv7.js";
57
57
  import {
58
58
  exports_whiteboxAttackSurface2
59
- } from "./chunk-r2dkp4tb.js";
59
+ } from "./chunk-y9m8yw7k.js";
60
60
  import"./chunk-xpfg2fbk.js";
61
61
  import {
62
62
  exports_api
63
- } from "./chunk-9yksqgzr.js";
64
- import"./chunk-1fy8azee.js";
65
- import"./chunk-4hwzqthr.js";
63
+ } from "./chunk-29bvrw6m.js";
64
+ import"./chunk-8m15nv6s.js";
65
+ import"./chunk-851r7zp8.js";
66
66
  import {
67
67
  exports_whiteboxAttackSurface
68
- } from "./chunk-z137x08b.js";
69
- import"./chunk-1jvwqnem.js";
70
- import"./chunk-v3dk9j7k.js";
68
+ } from "./chunk-3ac8kcj9.js";
69
+ import"./chunk-rchnq1ez.js";
70
+ import"./chunk-n3kr09mb.js";
71
71
  import {
72
72
  exports_persistence
73
- } from "./chunk-e8yy2k73.js";
74
- import"./chunk-z96pbjhd.js";
75
- import"./chunk-acgbyf5h.js";
73
+ } from "./chunk-mqcwxrnh.js";
74
+ import"./chunk-c6gj39ew.js";
75
+ import"./chunk-pd487tpr.js";
76
76
  export {
77
77
  exports_ai as ai,
78
78
  exports_api as api,
@@ -1,25 +1,25 @@
1
1
  #!/usr/bin/env bun
2
- import"./cli-fy6vh2a7.js";
3
- import"./cli-c05y640n.js";
2
+ import"./cli-0ry9v2cb.js";
3
+ import"./cli-0cwdrrq7.js";
4
4
  import {
5
5
  listAgentLogs2,
6
6
  searchAgentLogs2
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-4mar7kvr.js";
8
+ import"./cli-tfaqp0ty.js";
9
+ import"./cli-5gaxk6hd.js";
10
+ import"./cli-m5ryqeav.js";
11
+ import"./cli-zmeb85er.js";
12
+ import"./cli-8hxrn15h.js";
13
+ import"./cli-t3m0e9t2.js";
14
+ import"./cli-metec8r8.js";
15
+ import"./cli-ge8q6nxr.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-gr4az5sf.js";
21
21
  import"./cli-qba2x69h.js";
22
- import"./cli-dpsw2fe6.js";
22
+ import"./cli-nj73990n.js";
23
23
  import"./cli-c2k4xxaw.js";
24
24
 
25
25
  // src/cli/logs.ts
@@ -1,8 +1,8 @@
1
- import"./cli-fy6vh2a7.js";
2
- import"./cli-c05y640n.js";
1
+ import"./cli-0ry9v2cb.js";
2
+ import"./cli-0cwdrrq7.js";
3
3
  import {
4
4
  init_ai
5
- } from "./cli-dpsw2fe6.js";
5
+ } from "./cli-nj73990n.js";
6
6
  import {
7
7
  toJsonValue,
8
8
  stringifyCanonicalJson,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  OffensiveSecurityAgent
3
- } from "./cli-qgz1q9g5.js";
4
- import"./cli-fy6vh2a7.js";
5
- import"./cli-c05y640n.js";
3
+ } from "./cli-tfaqp0ty.js";
4
+ import"./cli-0ry9v2cb.js";
5
+ import"./cli-0cwdrrq7.js";
6
6
  import {
7
7
  startAgentExecution
8
8
  } from "./cli-g06s7edq.js";
9
9
  import"./cli-qba2x69h.js";
10
- import"./cli-dpsw2fe6.js";
10
+ import"./cli-nj73990n.js";
11
11
  import"./cli-c2k4xxaw.js";
12
12
 
13
13
  // src/core/api/offesecAgent.ts
@@ -0,0 +1,22 @@
1
+ import {
2
+ DEFAULT_CONCURRENCY2,
3
+ runPentestSwarm2,
4
+ runPentestWorkflow2
5
+ } from "./cli-8hxrn15h.js";
6
+ import"./cli-ge8q6nxr.js";
7
+ import"./cli-zmeb85er.js";
8
+ import"./cli-5gaxk6hd.js";
9
+ import"./cli-metec8r8.js";
10
+ import"./cli-m5ryqeav.js";
11
+ import"./cli-gr4az5sf.js";
12
+ import"./cli-qba2x69h.js";
13
+ import"./cli-tfaqp0ty.js";
14
+ import"./cli-nj73990n.js";
15
+ import"./cli-0cwdrrq7.js";
16
+ import"./cli-c2k4xxaw.js";
17
+ import"./cli-0ry9v2cb.js";
18
+ export {
19
+ DEFAULT_CONCURRENCY2 as DEFAULT_CONCURRENCY,
20
+ runPentestSwarm2 as runPentestSwarm,
21
+ runPentestWorkflow2 as runPentestWorkflow
22
+ };
@@ -1,26 +1,26 @@
1
1
  #!/usr/bin/env bun
2
- import"./cli-fy6vh2a7.js";
3
- import"./cli-c05y640n.js";
2
+ import"./cli-0ry9v2cb.js";
3
+ import"./cli-0cwdrrq7.js";
4
4
  import {
5
5
  listScans2,
6
6
  getScan2,
7
7
  dispatchPentest2
8
- } from "./cli-7eea4e2y.js";
9
- import"./cli-qgz1q9g5.js";
10
- import"./cli-k2nwxta0.js";
11
- import"./cli-kb21qhvm.js";
12
- import"./cli-ngq9dr8n.js";
13
- import"./cli-d37a42dc.js";
14
- import"./cli-3sp6nd8d.js";
15
- import"./cli-xtc2t6me.js";
16
- import"./cli-n2en7j5b.js";
8
+ } from "./cli-4mar7kvr.js";
9
+ import"./cli-tfaqp0ty.js";
10
+ import"./cli-5gaxk6hd.js";
11
+ import"./cli-m5ryqeav.js";
12
+ import"./cli-zmeb85er.js";
13
+ import"./cli-8hxrn15h.js";
14
+ import"./cli-t3m0e9t2.js";
15
+ import"./cli-metec8r8.js";
16
+ import"./cli-ge8q6nxr.js";
17
17
  import"./cli-xcy2vxj2.js";
18
18
  import {
19
19
  markCommandFailed
20
20
  } from "./cli-z82n3qk1.js";
21
- import"./cli-1ve18npr.js";
21
+ import"./cli-gr4az5sf.js";
22
22
  import"./cli-qba2x69h.js";
23
- import"./cli-dpsw2fe6.js";
23
+ import"./cli-nj73990n.js";
24
24
  import"./cli-c2k4xxaw.js";
25
25
  import {
26
26
  init_zod
@@ -0,0 +1,11 @@
1
+ import {
2
+ openRecordedRunClient2
3
+ } from "./cli-pchzt5f7.js";
4
+ import"./cli-xpspbhqs.js";
5
+ import"./cli-nj73990n.js";
6
+ import"./cli-0cwdrrq7.js";
7
+ import"./cli-c2k4xxaw.js";
8
+ import"./cli-0ry9v2cb.js";
9
+ export {
10
+ openRecordedRunClient2 as openRecordedRunClient
11
+ };
@@ -1,15 +1,15 @@
1
- import"./cli-fy6vh2a7.js";
2
- import"./cli-c05y640n.js";
3
- import"./cli-qgz1q9g5.js";
1
+ import"./cli-0ry9v2cb.js";
2
+ import"./cli-0cwdrrq7.js";
3
+ import"./cli-tfaqp0ty.js";
4
4
  import {
5
5
  TargetedPentestAgent2
6
- } from "./cli-xtc2t6me.js";
6
+ } from "./cli-metec8r8.js";
7
7
  import {
8
8
  startAgentExecution
9
9
  } from "./cli-g06s7edq.js";
10
- import"./cli-1ve18npr.js";
10
+ import"./cli-gr4az5sf.js";
11
11
  import"./cli-qba2x69h.js";
12
- import"./cli-dpsw2fe6.js";
12
+ import"./cli-nj73990n.js";
13
13
  import"./cli-c2k4xxaw.js";
14
14
 
15
15
  // src/core/api/targetedPentest.ts
@@ -1,26 +1,26 @@
1
1
  #!/usr/bin/env bun
2
- import"./cli-fy6vh2a7.js";
3
- import"./cli-c05y640n.js";
2
+ import"./cli-0ry9v2cb.js";
3
+ import"./cli-0cwdrrq7.js";
4
4
  import {
5
5
  listPentestTargets2,
6
6
  listTargetLogs2,
7
7
  searchTargetLogs2
8
- } from "./cli-7eea4e2y.js";
9
- import"./cli-qgz1q9g5.js";
10
- import"./cli-k2nwxta0.js";
11
- import"./cli-kb21qhvm.js";
12
- import"./cli-ngq9dr8n.js";
13
- import"./cli-d37a42dc.js";
14
- import"./cli-3sp6nd8d.js";
15
- import"./cli-xtc2t6me.js";
16
- import"./cli-n2en7j5b.js";
8
+ } from "./cli-4mar7kvr.js";
9
+ import"./cli-tfaqp0ty.js";
10
+ import"./cli-5gaxk6hd.js";
11
+ import"./cli-m5ryqeav.js";
12
+ import"./cli-zmeb85er.js";
13
+ import"./cli-8hxrn15h.js";
14
+ import"./cli-t3m0e9t2.js";
15
+ import"./cli-metec8r8.js";
16
+ import"./cli-ge8q6nxr.js";
17
17
  import"./cli-xcy2vxj2.js";
18
18
  import {
19
19
  markCommandFailed
20
20
  } from "./cli-z82n3qk1.js";
21
- import"./cli-1ve18npr.js";
21
+ import"./cli-gr4az5sf.js";
22
22
  import"./cli-qba2x69h.js";
23
- import"./cli-dpsw2fe6.js";
23
+ import"./cli-nj73990n.js";
24
24
  import"./cli-c2k4xxaw.js";
25
25
 
26
26
  // src/cli/targets.ts
@@ -0,0 +1,21 @@
1
+ import"./cli-tfaqp0ty.js";
2
+ import"./cli-0ry9v2cb.js";
3
+ import"./cli-0cwdrrq7.js";
4
+ import {
5
+ runThreatModelWorkflow2
6
+ } from "./cli-4mar7kvr.js";
7
+ import"./cli-5gaxk6hd.js";
8
+ import"./cli-m5ryqeav.js";
9
+ import"./cli-zmeb85er.js";
10
+ import"./cli-8hxrn15h.js";
11
+ import"./cli-t3m0e9t2.js";
12
+ import"./cli-metec8r8.js";
13
+ import"./cli-ge8q6nxr.js";
14
+ import"./cli-xcy2vxj2.js";
15
+ import"./cli-gr4az5sf.js";
16
+ import"./cli-qba2x69h.js";
17
+ import"./cli-nj73990n.js";
18
+ import"./cli-c2k4xxaw.js";
19
+ export {
20
+ runThreatModelWorkflow2 as runThreatModelWorkflow
21
+ };
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  detectInstallMethod,
7
7
  init_installation
8
- } from "./cli-65g6rcat.js";
8
+ } from "./cli-hprqe9j2.js";
9
9
  import {
10
10
  __require
11
11
  } from "./cli-h6y3bt60.js";
@@ -1,10 +1,10 @@
1
- import"./cli-fy6vh2a7.js";
2
- import"./cli-c05y640n.js";
1
+ import"./cli-0ry9v2cb.js";
2
+ import"./cli-0cwdrrq7.js";
3
3
  import {
4
4
  resolveConfig,
5
5
  createWeaveTracer
6
- } from "./cli-az3xq70v.js";
7
- import"./cli-dpsw2fe6.js";
6
+ } from "./cli-arxx5hbs.js";
7
+ import"./cli-nj73990n.js";
8
8
  import"./cli-c2k4xxaw.js";
9
9
 
10
10
  // src/core/integrations/wandb/upload.ts
@@ -1,12 +1,12 @@
1
- import"./cli-fy6vh2a7.js";
2
- import"./cli-c05y640n.js";
1
+ import"./cli-0ry9v2cb.js";
2
+ import"./cli-0cwdrrq7.js";
3
3
  import {
4
4
  init_types
5
5
  } from "./cli-3gt761d2.js";
6
6
  import {
7
7
  AVAILABLE_MODELS,
8
8
  init_ai
9
- } from "./cli-dpsw2fe6.js";
9
+ } from "./cli-nj73990n.js";
10
10
  import"./cli-c2k4xxaw.js";
11
11
 
12
12
  // src/core/providers/utils.ts
package/package.json CHANGED
@@ -344,5 +344,5 @@
344
344
  "tsc": "tsc --noEmit"
345
345
  },
346
346
  "type": "module",
347
- "version": "2.6.1"
347
+ "version": "2.7.0-canary.6d9d1e0d"
348
348
  }
@@ -361,6 +361,86 @@ describe("spawned-agent usage callbacks", () => {
361
361
  });
362
362
 
363
363
  describe("auxiliary model events", () => {
364
+ it("persists prepared context instead of restoring a fitted-away prefix", async () => {
365
+ streamResponseCalls.length = 0;
366
+ const rootPath = mkdtempSync(join(tmpdir(), "apex-fitted-history-"));
367
+ try {
368
+ const agent = new OffensiveSecurityAgent({
369
+ prompt: "test",
370
+ model: "test-model",
371
+ messages: [{ role: "user", content: "old large prefix" }],
372
+ session: { id: "ses_fitted_history", rootPath },
373
+ activeTools: [],
374
+ sandbox: {},
375
+ } as never);
376
+ void agent.streamResult;
377
+ const call = streamResponseCalls[0] as {
378
+ onContextPrepared: (context: {
379
+ messages: Array<{ role: string; content: unknown }>;
380
+ responseMessageOffset: number;
381
+ }) => void;
382
+ onStepFinish: (event: unknown) => Promise<void>;
383
+ };
384
+ const firstStep = [
385
+ { role: "assistant", content: "first call" },
386
+ { role: "tool", content: "full first result" },
387
+ ];
388
+ const cachedSystem = {
389
+ role: "system",
390
+ content: "cached effective system prompt",
391
+ providerOptions: {
392
+ anthropic: { cacheControl: { type: "ephemeral" } },
393
+ },
394
+ };
395
+ const historySystem = {
396
+ role: "system",
397
+ content: "caller-supplied history instruction",
398
+ };
399
+ call.onContextPrepared({
400
+ messages: [
401
+ cachedSystem,
402
+ cachedSystem,
403
+ historySystem,
404
+ { role: "user", content: "fitted prefix" },
405
+ ],
406
+ responseMessageOffset: 0,
407
+ });
408
+ await call.onStepFinish({
409
+ response: { id: "step-1", messages: firstStep },
410
+ usage: { inputTokens: 10, outputTokens: 2 },
411
+ });
412
+
413
+ const compacted = [
414
+ historySystem,
415
+ { role: "user", content: "fitted prefix" },
416
+ { role: "assistant", content: "first call" },
417
+ { role: "tool", content: "short first result" },
418
+ ];
419
+ call.onContextPrepared({
420
+ messages: [cachedSystem, cachedSystem, ...compacted],
421
+ responseMessageOffset: 2,
422
+ });
423
+ const secondStep = [
424
+ { role: "assistant", content: "second call" },
425
+ { role: "tool", content: "second result" },
426
+ ];
427
+ await call.onStepFinish({
428
+ response: {
429
+ id: "step-2",
430
+ messages: [...firstStep, ...secondStep],
431
+ },
432
+ usage: { inputTokens: 10, outputTokens: 2 },
433
+ });
434
+
435
+ const writer = (agent as unknown as { writer: AgentMessageWriter })
436
+ .writer;
437
+ expect(writer.latest).toEqual([...compacted, ...secondStep]);
438
+ writer.cancelTimer();
439
+ } finally {
440
+ rmSync(rootPath, { recursive: true, force: true });
441
+ }
442
+ });
443
+
364
444
  it("keeps the last complete message snapshot while forwarding usage", async () => {
365
445
  streamResponseCalls.length = 0;
366
446
  traceRecordStepCalls.length = 0;
@@ -2806,6 +2886,11 @@ describe("trace identity and root IO", () => {
2806
2886
  describe("contextRecorder integration", () => {
2807
2887
  const streamTextChunk = { type: "text-delta", id: "t1", delta: "hi" };
2808
2888
  const CANONICAL = [
2889
+ {
2890
+ role: "system",
2891
+ content: "cached effective system prompt",
2892
+ providerOptions: { anthropic: { cacheControl: { type: "ephemeral" } } },
2893
+ },
2809
2894
  { role: "user", content: "recorded prompt" },
2810
2895
  { role: "assistant", content: "recorded answer" },
2811
2896
  ] as never[];
@@ -2874,14 +2959,13 @@ describe("contextRecorder integration", () => {
2874
2959
  expect(streamResponseCalls[0]?.inferenceRecorder).toBe(inferenceRecorder);
2875
2960
 
2876
2961
  const stepEvent = {
2877
- response: { id: "resp_1", messages: CANONICAL.slice(1) },
2962
+ response: { id: "resp_1", messages: CANONICAL.slice(2) },
2878
2963
  usage: {},
2879
2964
  };
2880
2965
  await streamOpts.onStepFinish(stepEvent);
2881
2966
 
2882
- // Writer snapshot equals canonical latest() exactly — the step's
2883
- // response.messages are already part of the committed context, so the
2884
- // projection must not re-prepend a base or duplicate them.
2967
+ // The cached system message is transport-only; it must not enter the
2968
+ // transcript reloaded with a fresh system prompt on the next turn.
2885
2969
  const writer = agent["writer" as keyof typeof agent] as unknown as {
2886
2970
  waitForPendingWrites: () => Promise<void>;
2887
2971
  latest: unknown[] | null;
@@ -2894,6 +2978,9 @@ describe("contextRecorder integration", () => {
2894
2978
  await streamOpts.onFinish(finishEvent);
2895
2979
 
2896
2980
  expect(recorder.latest).toHaveBeenCalled();
2897
- expect((captured as unknown[]).length).toBe(CANONICAL.length);
2981
+ expect(captured).toEqual(CANONICAL.slice(1));
2982
+ expect(
2983
+ JSON.parse(readFileSync(join(rootPath, "messages.json"), "utf8")),
2984
+ ).toEqual(CANONICAL.slice(1));
2898
2985
  });
2899
2986
  });
@@ -759,16 +759,36 @@ export class OffensiveSecurityAgent<TResult = void> {
759
759
  }
760
760
  this.messagesPath = join(messagesDir, "messages.json");
761
761
 
762
- // Mutable so that summarization can clear stale history.
763
- const initialMessagesRef: { current: ModelMessage[] } = {
764
- current: input.messages
765
- ? [...input.messages]
766
- : [
767
- {
768
- role: "user" as const,
769
- content: [{ type: "text", text: input.prompt }],
770
- },
771
- ],
762
+ const preparedContextRef = {
763
+ current: {
764
+ messages: input.messages
765
+ ? [...input.messages]
766
+ : [
767
+ {
768
+ role: "user" as const,
769
+ content: [{ type: "text" as const, text: input.prompt }],
770
+ },
771
+ ],
772
+ responseMessageOffset: 0,
773
+ },
774
+ };
775
+ const legacyMessages = (responseMessages: ModelMessage[]) => [
776
+ ...preparedContextRef.current.messages,
777
+ ...responseMessages.slice(
778
+ preparedContextRef.current.responseMessageOffset,
779
+ ),
780
+ ];
781
+ const persistedMessages = (messages: ModelMessage[]) => {
782
+ // Cache-marked system messages are transport context; the next turn
783
+ // supplies a fresh system prompt and must not replay saved copies.
784
+ let first = 0;
785
+ while (
786
+ messages[first]?.role === "system" &&
787
+ messages[first]?.providerOptions
788
+ ) {
789
+ first++;
790
+ }
791
+ return first === 0 ? messages : messages.slice(first);
772
792
  };
773
793
 
774
794
  // Agent-local persistence: debounce, latest snapshot, and the
@@ -861,6 +881,12 @@ export class OffensiveSecurityAgent<TResult = void> {
861
881
  usageRecorder: input.usageRecorder,
862
882
  contextRecorder: input.contextRecorder,
863
883
  inferenceRecorder: input.inferenceRecorder,
884
+ onContextPrepared: (context) => {
885
+ preparedContextRef.current = {
886
+ messages: [...context.messages],
887
+ responseMessageOffset: context.responseMessageOffset,
888
+ };
889
+ },
864
890
  // Per-subagent so the overflow tool-result dumps land next to this
865
891
  // agent's messages.json (`subagents/{id}/tool-results/`) and a host
866
892
  // can reclaim them when the subagent finishes, instead of piling up
@@ -880,16 +906,10 @@ export class OffensiveSecurityAgent<TResult = void> {
880
906
  return;
881
907
  }
882
908
 
883
- // Recorded runs project the canonical committed context; the
884
- // legacy path reconstructs from the (possibly stale after a fit)
885
- // initial prefix. Canonical latest() already includes this step's
886
- // messages — committing happens upstream in the ai layer's
887
- // onStepFinish wrapper, before this user callback runs.
888
- const canonical = input.contextRecorder?.latest() ?? [
889
- ...initialMessagesRef.current,
890
- ...event.response.messages,
891
- ];
892
- this.writer.setLatest(canonical);
909
+ const canonical =
910
+ input.contextRecorder?.latest() ??
911
+ legacyMessages(event.response.messages);
912
+ this.writer.setLatest(persistedMessages(canonical));
893
913
  schedulePersist();
894
914
  traceWriter.recordStep(
895
915
  event.response.messages as ModelMessage[],
@@ -905,9 +925,10 @@ export class OffensiveSecurityAgent<TResult = void> {
905
925
  await input.onStepFinish?.(event);
906
926
  },
907
927
  onSummarized: () => {
908
- // Context was reset by summarization — discard the old history so
909
- // subsequent onStepFinish writes only persist post-summary messages.
910
- initialMessagesRef.current = [];
928
+ preparedContextRef.current = {
929
+ messages: [],
930
+ responseMessageOffset: 0,
931
+ };
911
932
  traceWriter.markSummarized();
912
933
  },
913
934
  onFinish: async (event) => {
@@ -915,11 +936,11 @@ export class OffensiveSecurityAgent<TResult = void> {
915
936
  this.writer.cancelTimer();
916
937
  // Skip if the interrupted-step finalizer already wrote the abort snapshot.
917
938
  if (!this.writer.syntheticsPersisted) {
918
- const finalMessages = input.contextRecorder?.latest() ??
919
- this.writer.latest ?? [
920
- ...initialMessagesRef.current,
921
- ...event.response.messages,
922
- ];
939
+ const finalMessages = persistedMessages(
940
+ input.contextRecorder?.latest() ??
941
+ this.writer.latest ??
942
+ legacyMessages(event.response.messages),
943
+ );
923
944
  this.writer.setLatest(finalMessages);
924
945
  await this.writer.enqueueWrite(finalMessages).catch(() => {});
925
946
  }