@pensar/apex 2.4.0 → 2.5.0-canary.0af37eb0

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 (94) hide show
  1. package/build/agent-2edb792c.js +12 -0
  2. package/build/agent-317v8mmz.js +12 -0
  3. package/build/agent-vzqc5vtn.js +14 -0
  4. package/build/{agent-5ejt5vpz.js → agent-y85zsera.js} +42 -42
  5. package/build/{apps-17wvz1d7.js → apps-qf8jww9t.js} +74 -43
  6. package/build/{auth-z3h9859n.js → auth-wf1r533f.js} +57 -61
  7. package/build/blackboxAgent-cb4na30e.js +12 -0
  8. package/build/blackboxPentest-bf7b9m36.js +58 -0
  9. package/build/{cli-9rhzhgx2.js → cli-079enner.js} +5 -5
  10. package/build/cli-4ptm7wgt.js +12188 -0
  11. package/build/{cli-tznv8pf1.js → cli-6hrf9z35.js} +4 -4
  12. package/build/{cli-mavved45.js → cli-80mx747a.js} +89 -96
  13. package/build/cli-8w8k4dph.js +15 -0
  14. package/build/{cli-2cbwdk78.js → cli-a4v5vwfw.js} +4 -4
  15. package/build/cli-ag6jtndp.js +32 -0
  16. package/build/cli-bb02pjt0.js +1485 -0
  17. package/build/{cli-k71t434r.js → cli-ec2hwkv3.js} +34 -76
  18. package/build/{cli-k8kc47pq.js → cli-f3sg3e9x.js} +118 -115
  19. package/build/{cli-bc05qbss.js → cli-h6y3bt60.js} +13 -21
  20. package/build/{cli-xshasbwe.js → cli-jzcsaygf.js} +31 -52
  21. package/build/{cli-vnynf0js.js → cli-k8hgxz61.js} +11 -5
  22. package/build/{cli-32z0017y.js → cli-kn55pk78.js} +36 -60
  23. package/build/{cli-tkc598ey.js → cli-q8pr0zqg.js} +10042 -7665
  24. package/build/{cli-j54qa6tm.js → cli-qktcyj48.js} +1 -1
  25. package/build/cli-retw3rw5.js +12 -0
  26. package/build/{cli-b1adytsy.js → cli-s2y86fd5.js} +67 -39
  27. package/build/{cli-vq52kp7j.js → cli-t6mngnwd.js} +150 -128
  28. package/build/cli-tjm77pmx.js +12075 -0
  29. package/build/{cli-dm0fc0bm.js → cli-v1sarr4y.js} +5 -9
  30. package/build/cli-wpmm960k.js +22 -0
  31. package/build/{cli-5k33webc.js → cli-x069hfr2.js} +355 -332
  32. package/build/{cli-ee3axgts.js → cli-xbhr5khz.js} +1 -1
  33. package/build/{cli-repbyhkk.js → cli-y212s0r8.js} +26315 -25555
  34. package/build/cli-z82n3qk1.js +6 -0
  35. package/build/{cli-gq40s5b3.js → cli-zky875st.js} +33 -46
  36. package/build/cli.js +696 -132
  37. package/build/{config-f1mj4nhd.js → config-g93k0986.js} +29 -29
  38. package/build/{doctor-ekneewa3.js → doctor-4fcx7g0h.js} +4 -9
  39. package/build/{fastStrike-8zka43xs.js → fastStrike-af31ggmt.js} +26 -28
  40. package/build/{fixes-b89s5haw.js → fixes-6kxes4g7.js} +22 -27
  41. package/build/getMachineId-bsd-zr67nd9p.js +36 -0
  42. package/build/getMachineId-darwin-fd1d562d.js +36 -0
  43. package/build/getMachineId-linux-kjmg243j.js +29 -0
  44. package/build/getMachineId-unsupported-n4r58vke.js +19 -0
  45. package/build/getMachineId-win-yzgpfsrb.js +38 -0
  46. package/build/{index-sf16jm0m.js → index-3dpcjj6e.js} +137 -162
  47. package/build/index-4b9nc9e8.js +36 -0
  48. package/build/index-9f0xagac.js +22 -0
  49. package/build/index-9y2bjhh2.js +100 -0
  50. package/build/index-a1bg29j1.js +1559 -0
  51. package/build/{index-cbwn03kz.js → index-a2xycbjs.js} +12 -31
  52. package/build/index-k1mb1edx.js +12 -0
  53. package/build/{index-psqjpw5m.js → index-nweqptgs.js} +7 -7
  54. package/build/{index-6d22pyxt.js → index-r8554acn.js} +3000 -2435
  55. package/build/index-rjmmakbh.js +17 -0
  56. package/build/index-yfcbhfc1.js +9 -0
  57. package/build/{issues-xx5bs4md.js → issues-vgfdw93j.js} +81 -35
  58. package/build/{logs-qtxe51w2.js → logs-czxxx0n0.js} +20 -25
  59. package/build/{multipart-parser-g2xxkezz.js → multipart-parser-vjjdbpd1.js} +10 -10
  60. package/build/{offesecAgent-b9e2xm6v.js → offesecAgent-jwnbnsqm.js} +6 -13
  61. package/build/{parse-rtccymzn.js → parse-cqecqrc5.js} +0 -4
  62. package/build/pentest-hbwbfw9w.js +21 -0
  63. package/build/{pentests-6ks3szc4.js → pentests-6pp1j1w5.js} +23 -28
  64. package/build/{targetedPentest-s1ptvq8e.js → targetedPentest-34zhke7a.js} +16 -20
  65. package/build/{targets-sxygyj87.js → targets-yvh0d0fr.js} +22 -27
  66. package/build/threatModel-r96hed1d.js +19 -0
  67. package/build/{token-3bbp59y6.js → token-n0tmq8n5.js} +2 -2
  68. package/build/{token-util-6xjme11b.js → token-util-bv80pj47.js} +1 -2
  69. package/build/{uninstall-tvsh81v8.js → uninstall-qdzsynrt.js} +7 -4
  70. package/build/{upload-7wdyyqmr.js → upload-twg8pvy7.js} +7 -13
  71. package/build/{utils-7fwdkqk6.js → utils-cnv9jj0h.js} +7 -29
  72. package/package.json +8 -2
  73. package/build/agent-mvpgvgks.js +0 -19
  74. package/build/agent-nhs1w5w0.js +0 -29
  75. package/build/authentication-3s97cpk4.js +0 -19
  76. package/build/blackboxAgent-gw0a1ca4.js +0 -19
  77. package/build/blackboxPentest-44333zss.js +0 -37
  78. package/build/cli-0n4r54hq.js +0 -414
  79. package/build/cli-72cvcqhg.js +0 -22
  80. package/build/cli-qqt4gj1w.js +0 -53
  81. package/build/cli-swpbx60z.js +0 -24441
  82. package/build/index-4ad3sdwk.js +0 -39
  83. package/build/index-ghwf5z3v.js +0 -12
  84. package/build/index-hqjdg6fg.js +0 -205
  85. package/build/index-mtq7kmxz.js +0 -12856
  86. package/build/index-rbzhk712.js +0 -33
  87. package/build/index-y5w6n3tb.js +0 -19
  88. package/build/main-mmjp338j.js +0 -324
  89. package/build/pentest-xtc1sjdw.js +0 -29
  90. package/build/threatModel-xsm6fwk5.js +0 -27
  91. /package/build/{cli-c8131c4q.js → cli-0wsh8j2t.js} +0 -0
  92. /package/build/{cli-e08r86zk.js → cli-b3dvxjgk.js} +0 -0
  93. /package/build/{cli-fw5r7pfj.js → cli-q126f6ef.js} +0 -0
  94. /package/build/{cli-9fsre5pt.js → cli-qba2x69h.js} +0 -0
@@ -1,17 +1,20 @@
1
+ import {
2
+ hasToolCall,
3
+ init_dist,
4
+ scopedLogger,
5
+ init_lazyLogger,
6
+ createLogger,
7
+ init_structured
8
+ } from "./cli-q8pr0zqg.js";
1
9
  import {
2
10
  OffensiveSecurityAgent
3
- } from "./cli-repbyhkk.js";
11
+ } from "./cli-y212s0r8.js";
4
12
  import {
5
13
  detectOSAndEnhancePrompt
6
- } from "./cli-tznv8pf1.js";
14
+ } from "./cli-6hrf9z35.js";
7
15
  import {
8
- createLogger,
9
- hasToolCall,
10
- init_dist,
11
- init_lazyLogger,
12
- init_structured,
13
- scopedLogger
14
- } from "./cli-tkc598ey.js";
16
+ MOBILE_OTP_PROMPT_GUIDANCE
17
+ } from "./cli-retw3rw5.js";
15
18
 
16
19
  // src/core/agents/specialized/authenticationAgent/agent.ts
17
20
  init_dist();
@@ -141,6 +144,11 @@ every 30 seconds, so run this immediately before filling the field. If the code
141
144
  retry once (you may have crossed a period boundary). Only report an MFA barrier if no seed is available
142
145
  or two fresh codes are both rejected.
143
146
 
147
+ ${MOBILE_OTP_PROMPT_GUIDANCE}
148
+
149
+ TOTP-via-environment-variable above is unchanged and still applies when the login asks for an authenticator
150
+ app code.
151
+
144
152
  # Error Recovery
145
153
 
146
154
  If authentication fails, try these mechanical fixes (they are login mechanics, not credential changes):
@@ -191,42 +199,12 @@ var log = scopedLogger(() => createLogger("authentication-agent"));
191
199
 
192
200
  class AuthenticationAgent extends OffensiveSecurityAgent {
193
201
  constructor(opts) {
194
- const {
195
- model,
196
- target,
197
- session,
198
- authHints,
199
- authConfig,
200
- onStepFinish,
201
- abortSignal,
202
- eventBus,
203
- subagentId,
204
- context,
205
- environmentVariables,
206
- secretValues,
207
- enableThinking,
208
- thinkingEffort,
209
- openAIReasoningEffort
210
- } = opts;
202
+ const { target, authHints, context, ...base } = opts;
203
+ const { session } = base;
211
204
  const cm = session.credentialManager;
212
205
  super({
206
+ ...base,
213
207
  system: detectOSAndEnhancePrompt(AUTH_SUBAGENT_SYSTEM_PROMPT),
214
- prompt: buildAuthPrompt(target, authHints, cm, context, environmentVariables ? Object.keys(environmentVariables) : undefined),
215
- model,
216
- session,
217
- target,
218
- authConfig,
219
- onStepFinish,
220
- abortSignal,
221
- eventBus,
222
- subagentId,
223
- subagentName: opts.subagentName,
224
- environmentVariables,
225
- secretValues,
226
- enableThinking,
227
- thinkingEffort,
228
- openAIReasoningEffort,
229
- toolChoice: "auto",
230
208
  activeTools: [
231
209
  "execute_command",
232
210
  "complete_authentication",
@@ -243,14 +221,14 @@ class AuthenticationAgent extends OffensiveSecurityAgent {
243
221
  "email_search_messages",
244
222
  "email_get_message",
245
223
  "send_email",
224
+ "sms_list_messages",
246
225
  "web_search",
247
226
  "get_page"
248
227
  ],
249
228
  stopWhen: hasToolCall("complete_authentication"),
250
- resolveResult: () => {
251
- const authDataPath = join(session.rootPath, "auth", "auth-data.json");
252
- return loadAuthResult(authDataPath);
253
- }
229
+ resolveResult: () => loadAuthResult(join(session.rootPath, "auth", "auth-data.json")),
230
+ target,
231
+ prompt: buildAuthPrompt(target, authHints, cm, context, base.environmentVariables ? Object.keys(base.environmentVariables) : undefined)
254
232
  });
255
233
  }
256
234
  }
@@ -328,6 +306,10 @@ function buildAuthPrompt(target, authHints, credentialManager, context, envVarNa
328
306
  parts.push("");
329
307
  }
330
308
  if (credBlock) {
309
+ const hasMobileOtp = credentialManager?.listReferences().some((ref) => ref.additionalFieldKeys?.includes("phoneNumber"));
310
+ const smsInstructions = hasMobileOtp ? `
311
+ ${MOBILE_OTP_PROMPT_GUIDANCE}
312
+ ` : "";
331
313
  parts.push(`INSTRUCTIONS:
332
314
  You have credentials available via credential IDs — authenticate immediately.
333
315
  1. For API/form logins, use execute_command (curl) to submit credentials and capture the Set-Cookie / token response
@@ -335,7 +317,7 @@ You have credentials available via credential IDs — authenticate immediately.
335
317
  pass credentialId + credentialField (e.g. credentialField="password") instead of the raw value —
336
318
  the secret is resolved securely at execution time. NEVER type a password directly.
337
319
  3. Call complete_authentication with exported cookies/headers to persist credentials and end the run
338
-
320
+ ${smsInstructions}
339
321
  The credentials above were provided to you and have already been verified — they are SHARED across runs, so
340
322
  do not modify them or their account settings. NEVER change the password, complete a password reset /
341
323
  forced-password-change / account-recovery flow, or modify MFA/2FA settings (enrolling, disabling, or
@@ -354,14 +336,11 @@ and only pollutes results — fail fast with success=false instead.`);
354
336
  return parts.join(`
355
337
  `);
356
338
  }
357
- async function runAuthenticationAgent(input) {
339
+ async function runAuthenticationAgent2(input) {
358
340
  const agent = new AuthenticationAgent(input);
359
341
  const result = await agent.consume();
360
342
  log.info(`Authentication ${result.success ? "succeeded" : "failed"}: ${result.summary}`);
361
343
  return result;
362
344
  }
363
345
 
364
- // src/core/api/authentication.ts
365
- var runAuthenticationAgent2 = runAuthenticationAgent;
366
-
367
- export { runAuthenticationAgent2 as runAuthenticationAgent };
346
+ export { runAuthenticationAgent2 };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  __esm
3
- } from "./cli-bc05qbss.js";
3
+ } from "./cli-h6y3bt60.js";
4
4
 
5
5
  // package.json
6
- var package_default;
6
+ var version = "2.5.0-canary.0af37eb0", package_default;
7
7
  var init_package = __esm(() => {
8
8
  package_default = {
9
9
  author: "Pensar",
@@ -23,6 +23,10 @@ var init_package = __esm(() => {
23
23
  "@modelcontextprotocol/sdk": "^1.29.0",
24
24
  "@openrouter/ai-sdk-provider": "^2.9.1",
25
25
  "@opentelemetry/api": "^1.9.1",
26
+ "@opentelemetry/exporter-trace-otlp-http": "^0.221.0",
27
+ "@opentelemetry/otlp-exporter-base": "^0.221.0",
28
+ "@opentelemetry/otlp-transformer": "^0.221.0",
29
+ "@opentelemetry/resources": "^2.10.0",
26
30
  "@opentui/core": "^0.1.107",
27
31
  "@opentui/react": "^0.1.107",
28
32
  "@pensar/surface": "0.3.0",
@@ -46,6 +50,8 @@ var init_package = __esm(() => {
46
50
  description: "AI-powered penetration testing CLI tool with terminal UI",
47
51
  devDependencies: {
48
52
  "@biomejs/biome": "2.4.14",
53
+ "@opentelemetry/context-async-hooks": "^2.10.0",
54
+ "@opentelemetry/sdk-trace-base": "^2.10.0",
49
55
  "@types/bun": "^1.3.14",
50
56
  "@types/mailparser": "^3.4.6",
51
57
  "@types/mime-types": "^3.0.1",
@@ -92,7 +98,7 @@ var init_package = __esm(() => {
92
98
  url: "https://github.com/pensarai/apex.git"
93
99
  },
94
100
  scripts: {
95
- build: "bun build src/cli.ts --outdir build --target node --format esm --splitting --external @opentui/core --external @opentui/react --external @opentui/react/* --external react --external react/jsx-runtime --external react/jsx-dev-runtime --external react-reconciler --external weave --external electron --external chromium-bidi --external camoufox-js",
101
+ build: "rm -rf build && bun build src/cli.ts --outdir build --target node --format esm --splitting --external @opentui/core --external @opentui/react --external @opentui/react/* --external react --external react/jsx-runtime --external react/jsx-dev-runtime --external react-reconciler --external weave --external electron --external chromium-bidi --external camoufox-js",
96
102
  "build:binaries": "bun run generate:ascii && mkdir -p dist && bun run build:binary:macos-arm64 && bun run build:binary:macos-x64 && bun run build:binary:linux-x64 && bun run build:binary:linux-arm64",
97
103
  "build:binary": "bun run generate:ascii && bun build src/cli.ts --compile --external electron --external chromium-bidi --external camoufox-js --outfile pensar",
98
104
  "build:binary:linux-arm64": "bun build src/cli.ts --compile --external electron --external chromium-bidi --external camoufox-js --target=bun-linux-arm64 --outfile dist/pensar-linux-arm64",
@@ -120,7 +126,7 @@ var init_package = __esm(() => {
120
126
  tsc: "tsc --noEmit"
121
127
  },
122
128
  type: "module",
123
- version: "2.4.0"
129
+ version
124
130
  };
125
131
  });
126
132
 
@@ -195,4 +201,4 @@ var init_installation = __esm(() => {
195
201
  init_package();
196
202
  });
197
203
 
198
- export { init_package, package_default, getCurrentVersion, detectInstallMethod, checkForUpdate, init_installation };
204
+ export { init_package, version, package_default, getCurrentVersion, detectInstallMethod, checkForUpdate, init_installation };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  OffensiveSecurityAgent
3
- } from "./cli-repbyhkk.js";
3
+ } from "./cli-y212s0r8.js";
4
4
  import {
5
- init_dist,
6
- stepCountIs
7
- } from "./cli-tkc598ey.js";
5
+ stepCountIs2,
6
+ init_dist
7
+ } from "./cli-q8pr0zqg.js";
8
8
 
9
9
  // src/core/agents/specialized/codeAgent/agent.ts
10
10
  init_dist();
@@ -60,51 +60,40 @@ Prefer catalog + code_query for sink-first work; use candidates to separate unve
60
60
  `;
61
61
 
62
62
  // src/core/agents/specialized/codeAgent/agent.ts
63
- class CodeAgent extends OffensiveSecurityAgent {
63
+ var CODE_AGENT_TOOLS = [
64
+ "read_file",
65
+ "list_files",
66
+ "grep",
67
+ "execute_command",
68
+ "profile_codebase",
69
+ "query_whitebox_catalog",
70
+ "run_code_query",
71
+ "run_whitebox_scan",
72
+ "create_whitebox_candidate",
73
+ "update_whitebox_candidate",
74
+ "list_whitebox_candidates",
75
+ "start_whitebox_job",
76
+ "poll_whitebox_job",
77
+ "stop_whitebox_job",
78
+ "read_whitebox_artifact",
79
+ "http_request",
80
+ "document_app",
81
+ "document_endpoint",
82
+ "web_search",
83
+ "get_page"
84
+ ];
85
+
86
+ class CodeAgent2 extends OffensiveSecurityAgent {
64
87
  constructor(opts) {
65
88
  const {
66
- model,
67
89
  codebasePath,
68
90
  objective,
69
- session,
70
- authConfig,
71
- onStepFinish,
72
- onCacheMetrics,
73
- abortSignal,
74
- eventBus,
75
- subagentId,
76
- stopWhen,
77
- responseSchema,
78
91
  system,
79
- attackSurfaceRegistry,
92
+ responseSchema,
80
93
  excludeTools,
81
- enableThinking,
82
- thinkingEffort,
83
- openAIReasoningEffort,
84
- projectThreatModel
94
+ ...base
85
95
  } = opts;
86
- let activeTools = [
87
- "read_file",
88
- "list_files",
89
- "grep",
90
- "execute_command",
91
- "profile_codebase",
92
- "query_whitebox_catalog",
93
- "run_code_query",
94
- "run_whitebox_scan",
95
- "create_whitebox_candidate",
96
- "update_whitebox_candidate",
97
- "list_whitebox_candidates",
98
- "start_whitebox_job",
99
- "poll_whitebox_job",
100
- "stop_whitebox_job",
101
- "read_whitebox_artifact",
102
- "http_request",
103
- "document_app",
104
- "document_endpoint",
105
- "web_search",
106
- "get_page"
107
- ];
96
+ let activeTools = [...CODE_AGENT_TOOLS];
108
97
  if (excludeTools?.length) {
109
98
  const excluded = new Set(excludeTools);
110
99
  activeTools = activeTools.filter((t) => !excluded.has(t));
@@ -113,25 +102,12 @@ class CodeAgent extends OffensiveSecurityAgent {
113
102
  activeTools.push("response");
114
103
  }
115
104
  super({
116
- system: system ?? CODE_AGENT_SYSTEM_PROMPT,
105
+ ...base,
117
106
  prompt: buildPrompt(codebasePath, objective),
118
- model,
119
- session,
120
- authConfig,
121
- onStepFinish,
122
- onCacheMetrics,
123
- abortSignal,
124
- eventBus,
125
- subagentId,
126
- subagentName: opts.subagentName,
127
- attackSurfaceRegistry,
128
- enableThinking,
129
- thinkingEffort,
130
- openAIReasoningEffort,
131
- projectThreatModel,
132
- stopWhen: stopWhen ?? stepCountIs(1e4),
107
+ system: system ?? CODE_AGENT_SYSTEM_PROMPT,
133
108
  activeTools,
134
- responseSchema
109
+ responseSchema,
110
+ stopWhen: base.stopWhen ?? stepCountIs2(1e4)
135
111
  });
136
112
  }
137
113
  }
@@ -146,4 +122,4 @@ ${objective}
146
122
  Begin now. Orient yourself in the codebase, then accomplish the objective.`;
147
123
  }
148
124
 
149
- export { CodeAgent };
125
+ export { CodeAgent2 };