@pensar/apex 2.4.0-canary.fbb66e97 → 2.5.0-canary.22f2eb52

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-7qtpem5z.js +12 -0
  2. package/build/agent-9khcyh5t.js +14 -0
  3. package/build/agent-bsyhck0a.js +12 -0
  4. package/build/{agent-4ts7armt.js → agent-ywewzc2h.js} +42 -42
  5. package/build/{apps-yfm59wch.js → apps-11akynyv.js} +40 -45
  6. package/build/{auth-1dct9tqf.js → auth-dd6r9mk4.js} +57 -61
  7. package/build/blackboxAgent-hbra4k00.js +12 -0
  8. package/build/blackboxPentest-bn5evs2z.js +61 -0
  9. package/build/{cli-s7bkeg8d.js → cli-3v9zs5wm.js} +31 -52
  10. package/build/{cli-n2dv2jxn.js → cli-4z46kyrk.js} +86 -93
  11. package/build/cli-7vby0hk6.js +12136 -0
  12. package/build/{cli-wdnf5jvs.js → cli-8kkaeb70.js} +33 -46
  13. package/build/cli-8w8k4dph.js +15 -0
  14. package/build/cli-ag6jtndp.js +32 -0
  15. package/build/{cli-rgk5ccs0.js → cli-ak78mweh.js} +4 -4
  16. package/build/cli-bb02pjt0.js +1485 -0
  17. package/build/{cli-k71t434r.js → cli-ec2hwkv3.js} +34 -76
  18. package/build/{cli-s5ky796g.js → cli-f5rw841m.js} +10 -4
  19. package/build/{cli-q2pshbky.js → cli-gamfs2yq.js} +118 -115
  20. package/build/{cli-a4vxda8s.js → cli-gq5sk2j3.js} +36 -60
  21. package/build/{cli-bc05qbss.js → cli-h6y3bt60.js} +13 -21
  22. package/build/{cli-7n5666p8.js → cli-j1916nvj.js} +10004 -7661
  23. package/build/{cli-n8c6cdwe.js → cli-jw1xftqm.js} +355 -332
  24. package/build/{cli-3ezbs9mw.js → cli-n4h7ygp5.js} +4 -4
  25. package/build/{cli-tdm8vj3v.js → cli-q45hcq3f.js} +67 -39
  26. package/build/{cli-9w6kmefp.js → cli-qkb3v2nw.js} +25378 -24978
  27. package/build/{cli-j54qa6tm.js → cli-qktcyj48.js} +1 -1
  28. package/build/cli-retw3rw5.js +12 -0
  29. package/build/cli-tjm77pmx.js +12075 -0
  30. package/build/{cli-dm0fc0bm.js → cli-v1sarr4y.js} +5 -9
  31. package/build/{cli-x96bafe8.js → cli-v8ph8hy2.js} +5 -5
  32. package/build/{cli-sms0a70d.js → cli-vkxx4jzv.js} +147 -128
  33. package/build/cli-wfb4gde1.js +22 -0
  34. package/build/{cli-ee3axgts.js → cli-xbhr5khz.js} +1 -1
  35. package/build/cli-z82n3qk1.js +6 -0
  36. package/build/cli.js +686 -131
  37. package/build/{config-16hfhn61.js → config-kv5v9ctn.js} +29 -29
  38. package/build/{doctor-6mtre40n.js → doctor-xs4s5km8.js} +4 -9
  39. package/build/{fastStrike-m3yx1gse.js → fastStrike-b8t8f916.js} +26 -28
  40. package/build/{fixes-0ve441kj.js → fixes-kcckqx3s.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-3mzr07h0.js +9 -0
  47. package/build/index-63zf8jxx.js +12 -0
  48. package/build/index-a1bg29j1.js +1559 -0
  49. package/build/{index-cbwn03kz.js → index-a2xycbjs.js} +12 -31
  50. package/build/{index-8j621csk.js → index-ae81pvwg.js} +1919 -1642
  51. package/build/index-cbajq2xy.js +17 -0
  52. package/build/index-cn4p95gh.js +100 -0
  53. package/build/index-kas88svr.js +36 -0
  54. package/build/index-mr20g8k4.js +22 -0
  55. package/build/{index-psqjpw5m.js → index-nweqptgs.js} +7 -7
  56. package/build/{index-xkjh989v.js → index-rx5jn1nz.js} +137 -162
  57. package/build/{issues-mprgd1fq.js → issues-jm28k288.js} +81 -35
  58. package/build/{logs-d5d3g58q.js → logs-r02tbz89.js} +20 -25
  59. package/build/{multipart-parser-g2xxkezz.js → multipart-parser-vjjdbpd1.js} +10 -10
  60. package/build/{offesecAgent-fmx9mbrp.js → offesecAgent-mmfejh1j.js} +6 -13
  61. package/build/{parse-rtccymzn.js → parse-cqecqrc5.js} +0 -4
  62. package/build/pentest-13jcm4cy.js +21 -0
  63. package/build/{pentests-4e8kv29y.js → pentests-jyn4zs7n.js} +23 -28
  64. package/build/{targetedPentest-ne2say29.js → targetedPentest-m3qkbpv6.js} +16 -20
  65. package/build/{targets-p166btjp.js → targets-rqv57as0.js} +22 -27
  66. package/build/threatModel-scmz36xr.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-73440c19.js → uninstall-bme62bdg.js} +7 -4
  70. package/build/{upload-7er3hpsb.js → upload-hwpgx1ha.js} +7 -13
  71. package/build/{utils-1q804s48.js → utils-abtz5mmk.js} +7 -29
  72. package/package.json +7 -1
  73. package/build/agent-shhafg9p.js +0 -29
  74. package/build/agent-yfqvpeqn.js +0 -19
  75. package/build/authentication-tc4snnr2.js +0 -19
  76. package/build/blackboxAgent-6yqmxsb6.js +0 -19
  77. package/build/blackboxPentest-d1kned1b.js +0 -37
  78. package/build/cli-ba9a23ap.js +0 -53
  79. package/build/cli-mkgfykpq.js +0 -22
  80. package/build/cli-swpbx60z.js +0 -24441
  81. package/build/cli-vphjaj1e.js +0 -414
  82. package/build/index-5qnfzz0z.js +0 -33
  83. package/build/index-7znkt8zb.js +0 -19
  84. package/build/index-a1hej78y.js +0 -39
  85. package/build/index-hp8bcbnv.js +0 -205
  86. package/build/index-mtq7kmxz.js +0 -12856
  87. package/build/index-r5aq2z34.js +0 -12
  88. package/build/main-mmjp338j.js +0 -324
  89. package/build/pentest-43v46yfk.js +0 -29
  90. package/build/threatModel-d2npk3zc.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
@@ -0,0 +1,12 @@
1
+ import {
2
+ runAuthenticationAgent2
3
+ } from "./cli-3v9zs5wm.js";
4
+ import"./cli-qba2x69h.js";
5
+ import"./cli-qkb3v2nw.js";
6
+ import"./cli-n4h7ygp5.js";
7
+ import"./cli-j1916nvj.js";
8
+ import"./cli-qktcyj48.js";
9
+ import"./cli-wfb4gde1.js";
10
+ export {
11
+ runAuthenticationAgent2 as runAuthenticationAgent
12
+ };
@@ -0,0 +1,14 @@
1
+ import {
2
+ TargetedPentestAgent2,
3
+ buildPentestSystemPrompt2
4
+ } from "./cli-4z46kyrk.js";
5
+ import"./cli-qba2x69h.js";
6
+ import"./cli-qkb3v2nw.js";
7
+ import"./cli-n4h7ygp5.js";
8
+ import"./cli-j1916nvj.js";
9
+ import"./cli-qktcyj48.js";
10
+ import"./cli-wfb4gde1.js";
11
+ export {
12
+ TargetedPentestAgent2 as TargetedPentestAgent,
13
+ buildPentestSystemPrompt2 as buildPentestSystemPrompt
14
+ };
@@ -0,0 +1,12 @@
1
+ import {
2
+ CodeAgent2
3
+ } from "./cli-gq5sk2j3.js";
4
+ import"./cli-qba2x69h.js";
5
+ import"./cli-qkb3v2nw.js";
6
+ import"./cli-n4h7ygp5.js";
7
+ import"./cli-j1916nvj.js";
8
+ import"./cli-qktcyj48.js";
9
+ import"./cli-wfb4gde1.js";
10
+ export {
11
+ CodeAgent2 as CodeAgent
12
+ };
@@ -1,24 +1,25 @@
1
1
  import {
2
2
  OffensiveSecurityAgent
3
- } from "./cli-9w6kmefp.js";
3
+ } from "./cli-qkb3v2nw.js";
4
+ import"./cli-wfb4gde1.js";
4
5
  import {
5
- detectOSAndEnhancePrompt
6
- } from "./cli-3ezbs9mw.js";
7
- import"./cli-c8131c4q.js";
6
+ init_zod,
7
+ stepCountIs2,
8
+ init_dist
9
+ } from "./cli-j1916nvj.js";
8
10
  import {
9
- init_dist,
10
- stepCountIs
11
- } from "./cli-7n5666p8.js";
12
- import"./cli-vphjaj1e.js";
11
+ detectOSAndEnhancePrompt
12
+ } from "./cli-n4h7ygp5.js";
13
+ import"./cli-qba2x69h.js";
13
14
  import {
14
- exports_external,
15
- init_zod
16
- } from "./cli-swpbx60z.js";
17
- import"./cli-j54qa6tm.js";
18
- import"./cli-mkgfykpq.js";
19
- import"./cli-x96bafe8.js";
20
- import"./cli-s5ky796g.js";
21
- import"./cli-bc05qbss.js";
15
+ string,
16
+ number,
17
+ boolean,
18
+ array,
19
+ object,
20
+ _enum
21
+ } from "./cli-tjm77pmx.js";
22
+ import"./cli-qktcyj48.js";
22
23
 
23
24
  // src/core/agents/specialized/findingJudge/agent.ts
24
25
  init_dist();
@@ -168,17 +169,17 @@ var FINDING_TYPES = [
168
169
  "informational",
169
170
  "expected-behavior"
170
171
  ];
171
- var FindingJudgeOutputSchema = exports_external.object({
172
- valid: exports_external.boolean().describe("Whether the POC demonstrates a currently exploitable vulnerability that should be persisted"),
173
- findingType: exports_external.enum(FINDING_TYPES).describe("Classification: 'vulnerability' for genuine security issues, 'informational' for low-risk observations worth noting, 'expected-behavior' for findings that describe intentional design decisions"),
174
- confidence: exports_external.number().min(0).max(1).describe("Confidence in the judgment, a decimal between 0.0 (no confidence) and 1.0 (certain)"),
175
- reasoning: exports_external.string().describe("Brief explanation of the key tool observations and analysis that led to this judgment"),
176
- concerns: exports_external.array(exports_external.string()).describe("Specific concerns identified. Empty array only when the finding is a valid high-confidence vulnerability."),
177
- verificationSteps: exports_external.array(exports_external.string()).describe("Concrete verification actions performed before deciding."),
178
- toolEvidence: exports_external.array(exports_external.string()).describe("Specific observations from tool output or provided artifacts."),
179
- reproducedPoc: exports_external.boolean().describe("Whether the judge reran or independently reproduced the POC."),
180
- webResearchUsed: exports_external.boolean().describe("Whether web_search/get_page materially informed the judgment."),
181
- limitations: exports_external.array(exports_external.string()).describe("Remaining verification gaps or environmental limitations.")
172
+ var FindingJudgeOutputSchema = object({
173
+ valid: boolean().describe("Whether the POC demonstrates a currently exploitable vulnerability that should be persisted"),
174
+ findingType: _enum(FINDING_TYPES).describe("Classification: 'vulnerability' for genuine security issues, 'informational' for low-risk observations worth noting, 'expected-behavior' for findings that describe intentional design decisions"),
175
+ confidence: number().min(0).max(1).describe("Confidence in the judgment, a decimal between 0.0 (no confidence) and 1.0 (certain)"),
176
+ reasoning: string().describe("Brief explanation of the key tool observations and analysis that led to this judgment"),
177
+ concerns: array(string()).describe("Specific concerns identified. Empty array only when the finding is a valid high-confidence vulnerability."),
178
+ verificationSteps: array(string()).describe("Concrete verification actions performed before deciding."),
179
+ toolEvidence: array(string()).describe("Specific observations from tool output or provided artifacts."),
180
+ reproducedPoc: boolean().describe("Whether the judge reran or independently reproduced the POC."),
181
+ webResearchUsed: boolean().describe("Whether web_search/get_page materially informed the judgment."),
182
+ limitations: array(string()).describe("Remaining verification gaps or environmental limitations.")
182
183
  });
183
184
 
184
185
  // src/core/agents/specialized/findingJudge/agent.ts
@@ -195,25 +196,24 @@ var FINDING_JUDGE_ACTIVE_TOOLS = [
195
196
 
196
197
  class FindingJudgeAgent extends OffensiveSecurityAgent {
197
198
  constructor(opts) {
198
- const target = opts.finding.target ?? opts.target ?? opts.session.targets[0];
199
+ const {
200
+ finding,
201
+ target: targetOpt,
202
+ subagentId,
203
+ subagentName,
204
+ ...base
205
+ } = opts;
206
+ const target = finding.target ?? targetOpt ?? base.session.targets[0];
199
207
  super({
208
+ ...base,
200
209
  system: detectOSAndEnhancePrompt(FINDING_JUDGE_SYSTEM_PROMPT),
201
- prompt: buildFindingJudgePrompt({ ...opts.finding, target }),
202
- model: opts.model,
203
- session: opts.session,
204
- target,
205
- authConfig: opts.authConfig,
206
- abortSignal: opts.abortSignal,
207
- eventBus: opts.eventBus,
208
- sandbox: opts.sandbox,
209
- enableThinking: opts.enableThinking,
210
- thinkingEffort: opts.thinkingEffort,
211
- openAIReasoningEffort: opts.openAIReasoningEffort,
212
- subagentId: opts.subagentId ?? "finding-judge",
213
- subagentName: opts.subagentName ?? "Finding Judge",
214
210
  activeTools: [...FINDING_JUDGE_ACTIVE_TOOLS],
215
211
  responseSchema: FindingJudgeOutputSchema,
216
- stopWhen: stepCountIs(60)
212
+ stopWhen: stepCountIs2(60),
213
+ target,
214
+ prompt: buildFindingJudgePrompt({ ...finding, target }),
215
+ subagentId: subagentId ?? "finding-judge",
216
+ subagentName: subagentName ?? "Finding Judge"
217
217
  });
218
218
  }
219
219
  }
@@ -1,42 +1,37 @@
1
1
  #!/usr/bin/env bun
2
- import"./cli-sms0a70d.js";
3
- import"./cli-n8c6cdwe.js";
4
- import"./cli-wdnf5jvs.js";
5
- import"./cli-tdm8vj3v.js";
6
- import"./cli-n2dv2jxn.js";
7
- import"./cli-s7bkeg8d.js";
8
- import"./cli-a4vxda8s.js";
9
- import"./cli-q2pshbky.js";
10
- import"./cli-9fsre5pt.js";
11
- import"./cli-ba9a23ap.js";
2
+ import"./cli-wfb4gde1.js";
3
+ import"./cli-j1916nvj.js";
12
4
  import {
13
5
  ENDPOINT_TRANSPORTS,
6
+ listApps,
7
+ getApp,
14
8
  createApp,
15
- createDomain,
16
- createEndpoint,
9
+ updateApp,
17
10
  deleteApp,
18
- deleteEndpoint,
19
- getApp,
20
- getEndpoint,
21
- listApps,
22
- listDomains,
23
11
  listEndpoints,
12
+ getEndpoint,
13
+ createEndpoint,
14
+ updateEndpoint,
15
+ deleteEndpoint,
24
16
  searchApps,
25
17
  searchEndpoints,
26
- updateApp,
27
- updateEndpoint
28
- } from "./cli-9w6kmefp.js";
29
- import"./cli-3ezbs9mw.js";
30
- import"./cli-fw5r7pfj.js";
31
- import"./cli-c8131c4q.js";
32
- import"./cli-7n5666p8.js";
33
- import"./cli-vphjaj1e.js";
34
- import"./cli-swpbx60z.js";
35
- import"./cli-j54qa6tm.js";
36
- import"./cli-mkgfykpq.js";
37
- import"./cli-x96bafe8.js";
38
- import"./cli-s5ky796g.js";
39
- import"./cli-bc05qbss.js";
18
+ listDomains,
19
+ createDomain
20
+ } from "./cli-qkb3v2nw.js";
21
+ import"./cli-n4h7ygp5.js";
22
+ import"./cli-8kkaeb70.js";
23
+ import"./cli-gq5sk2j3.js";
24
+ import"./cli-gamfs2yq.js";
25
+ import"./cli-jw1xftqm.js";
26
+ import"./cli-3v9zs5wm.js";
27
+ import"./cli-4z46kyrk.js";
28
+ import"./cli-q45hcq3f.js";
29
+ import"./cli-vkxx4jzv.js";
30
+ import {
31
+ markCommandFailed
32
+ } from "./cli-z82n3qk1.js";
33
+ import"./cli-qba2x69h.js";
34
+ import"./cli-qktcyj48.js";
40
35
 
41
36
  // src/cli/apps.ts
42
37
  var APPLICATION_TYPES = [
@@ -329,7 +324,7 @@ async function main() {
329
324
  if (!appId) {
330
325
  console.error("Error: app ID is required");
331
326
  console.error("Usage: pensar apps get <appId>");
332
- process.exit(1);
327
+ return markCommandFailed();
333
328
  }
334
329
  const app = await getApp(appId);
335
330
  console.log(JSON.stringify(app, null, 2));
@@ -342,7 +337,7 @@ async function main() {
342
337
  if (!appId) {
343
338
  console.error("Error: app ID is required");
344
339
  console.error("Usage: pensar apps update <appId> [options]");
345
- process.exit(1);
340
+ return markCommandFailed();
346
341
  }
347
342
  const opts = parseAppUpdateOptions(args);
348
343
  const result = await updateApp(appId, opts);
@@ -352,7 +347,7 @@ async function main() {
352
347
  if (!appId) {
353
348
  console.error("Error: app ID is required");
354
349
  console.error("Usage: pensar apps delete <appId>");
355
- process.exit(1);
350
+ return markCommandFailed();
356
351
  }
357
352
  const result = await deleteApp(appId);
358
353
  console.log(JSON.stringify(result, null, 2));
@@ -364,7 +359,7 @@ async function main() {
364
359
  if (!url) {
365
360
  console.error("Error: domain is required");
366
361
  console.error("Usage: pensar apps domain-create <domain>");
367
- process.exit(1);
362
+ return markCommandFailed();
368
363
  }
369
364
  const result = await createDomain({ url });
370
365
  console.log(JSON.stringify(result, null, 2));
@@ -373,7 +368,7 @@ async function main() {
373
368
  if (!appId) {
374
369
  console.error("Error: app ID is required");
375
370
  console.error("Usage: pensar apps endpoints <appId> [filters]");
376
- process.exit(1);
371
+ return markCommandFailed();
377
372
  }
378
373
  const type = parseEndpointType(getFlag("--type", args));
379
374
  const minRiskScore = parseNumber("--min-risk", getFlag("--min-risk", args));
@@ -392,7 +387,7 @@ async function main() {
392
387
  if (!endpointId) {
393
388
  console.error("Error: endpoint ID is required");
394
389
  console.error("Usage: pensar apps endpoint <endpointId>");
395
- process.exit(1);
390
+ return markCommandFailed();
396
391
  }
397
392
  const result = await getEndpoint(endpointId);
398
393
  console.log(JSON.stringify(result, null, 2));
@@ -401,7 +396,7 @@ async function main() {
401
396
  if (!appId) {
402
397
  console.error("Error: app ID is required");
403
398
  console.error("Usage: pensar apps endpoint-create <appId> --endpoint E --description D");
404
- process.exit(1);
399
+ return markCommandFailed();
405
400
  }
406
401
  const opts = parseEndpointCreateOptions(args);
407
402
  const result = await createEndpoint(appId, opts);
@@ -411,7 +406,7 @@ async function main() {
411
406
  if (!endpointId) {
412
407
  console.error("Error: endpoint ID is required");
413
408
  console.error("Usage: pensar apps endpoint-update <endpointId> [options]");
414
- process.exit(1);
409
+ return markCommandFailed();
415
410
  }
416
411
  const opts = parseEndpointUpdateOptions(args);
417
412
  const result = await updateEndpoint(endpointId, opts);
@@ -421,7 +416,7 @@ async function main() {
421
416
  if (!endpointId) {
422
417
  console.error("Error: endpoint ID is required");
423
418
  console.error("Usage: pensar apps endpoint-delete <endpointId>");
424
- process.exit(1);
419
+ return markCommandFailed();
425
420
  }
426
421
  const result = await deleteEndpoint(endpointId);
427
422
  console.log(JSON.stringify(result, null, 2));
@@ -430,7 +425,7 @@ async function main() {
430
425
  if (!query || query.startsWith("--")) {
431
426
  console.error("Error: search query is required");
432
427
  console.error("Usage: pensar apps search <query> [options]");
433
- process.exit(1);
428
+ return markCommandFailed();
434
429
  }
435
430
  const type = parseAppType(getFlag("--type", args));
436
431
  const limit = parseInteger("--limit", getFlag("--limit", args));
@@ -446,7 +441,7 @@ async function main() {
446
441
  if (!query || query.startsWith("--")) {
447
442
  console.error("Error: search query is required");
448
443
  console.error("Usage: pensar apps search-endpoints <query> [options]");
449
- process.exit(1);
444
+ return markCommandFailed();
450
445
  }
451
446
  const applicationId = getFlag("--app", args);
452
447
  const type = parseEndpointType(getFlag("--type", args));
@@ -474,12 +469,12 @@ async function main() {
474
469
  } else {
475
470
  console.error(`Error: Unknown subcommand "${sub}"`);
476
471
  showHelp();
477
- process.exit(1);
472
+ return markCommandFailed();
478
473
  }
479
474
  } catch (err) {
480
475
  console.error(`
481
476
  Error: ${err instanceof Error ? err.message : String(err)}`);
482
- process.exit(1);
477
+ return markCommandFailed();
483
478
  }
484
479
  }
485
- main();
480
+ await main();
@@ -1,46 +1,42 @@
1
1
  #!/usr/bin/env bun
2
- import"./cli-sms0a70d.js";
3
- import"./cli-n8c6cdwe.js";
4
- import"./cli-wdnf5jvs.js";
5
- import"./cli-tdm8vj3v.js";
6
- import"./cli-n2dv2jxn.js";
7
- import"./cli-s7bkeg8d.js";
8
- import"./cli-a4vxda8s.js";
9
- import"./cli-q2pshbky.js";
10
- import"./cli-9fsre5pt.js";
11
- import"./cli-ba9a23ap.js";
12
- import"./cli-9w6kmefp.js";
13
- import"./cli-3ezbs9mw.js";
14
- import"./cli-fw5r7pfj.js";
15
- import"./cli-c8131c4q.js";
16
- import"./cli-7n5666p8.js";
17
2
  import {
18
- createWorkspaceSelection,
19
- disconnect,
20
- ensureValidToken,
21
- fetchWorkspaces,
3
+ config2,
4
+ init_config
5
+ } from "./cli-wfb4gde1.js";
6
+ import {
22
7
  getPensarApiUrl,
23
8
  getPensarConsoleUrl,
24
- init_auth,
25
- isConnected,
26
- pollForWorkspaceCreation,
27
- pollLegacyToken,
28
- pollWorkOSToken,
29
- pollWorkspaceSelection,
30
- selectWorkspace,
31
- startDeviceFlow
32
- } from "./cli-vphjaj1e.js";
33
- import"./cli-swpbx60z.js";
34
- import"./cli-j54qa6tm.js";
9
+ isConnected2,
10
+ disconnect2,
11
+ startDeviceFlow2,
12
+ pollWorkOSToken2,
13
+ pollLegacyToken2,
14
+ ensureValidToken2,
15
+ fetchWorkspaces2,
16
+ pollForWorkspaceCreation2,
17
+ selectWorkspace2,
18
+ createWorkspaceSelection2,
19
+ pollWorkspaceSelection2,
20
+ init_auth
21
+ } from "./cli-j1916nvj.js";
22
+ import"./cli-qkb3v2nw.js";
23
+ import"./cli-n4h7ygp5.js";
24
+ import"./cli-8kkaeb70.js";
25
+ import"./cli-gq5sk2j3.js";
26
+ import"./cli-gamfs2yq.js";
27
+ import"./cli-jw1xftqm.js";
28
+ import"./cli-3v9zs5wm.js";
29
+ import"./cli-4z46kyrk.js";
30
+ import"./cli-q45hcq3f.js";
31
+ import"./cli-vkxx4jzv.js";
35
32
  import {
36
- config,
37
- init_config
38
- } from "./cli-mkgfykpq.js";
39
- import"./cli-x96bafe8.js";
40
- import"./cli-s5ky796g.js";
33
+ markCommandFailed
34
+ } from "./cli-z82n3qk1.js";
35
+ import"./cli-qba2x69h.js";
36
+ import"./cli-qktcyj48.js";
41
37
  import {
42
38
  __require
43
- } from "./cli-bc05qbss.js";
39
+ } from "./cli-h6y3bt60.js";
44
40
 
45
41
  // src/cli/auth.ts
46
42
  import * as readline from "node:readline";
@@ -74,7 +70,7 @@ function prompt(question) {
74
70
  });
75
71
  }
76
72
  async function selectWorkspaceInBrowser(apiUrl, accessToken) {
77
- const selection = await createWorkspaceSelection(apiUrl, accessToken);
73
+ const selection = await createWorkspaceSelection2(apiUrl, accessToken);
78
74
  openUrl(selection.selectionUrl);
79
75
  console.log(`
80
76
  You have multiple workspaces. Choose one in your browser to continue.
@@ -82,12 +78,12 @@ If the browser didn't open, visit:
82
78
  ${selection.selectionUrl}
83
79
 
84
80
  Waiting for workspace selection...`);
85
- return pollWorkspaceSelection(apiUrl, accessToken, selection.selectionId);
81
+ return pollWorkspaceSelection2(apiUrl, accessToken, selection.selectionId);
86
82
  }
87
83
  async function login() {
88
- const appConfig = await config.get();
89
- const hasStoredCredentials = isConnected(appConfig);
90
- const validToken = hasStoredCredentials ? await ensureValidToken({
84
+ const appConfig = await config2.get();
85
+ const hasStoredCredentials = isConnected2(appConfig);
86
+ const validToken = hasStoredCredentials ? await ensureValidToken2({
91
87
  accessToken: appConfig.accessToken,
92
88
  refreshToken: appConfig.refreshToken,
93
89
  pensarAPIKey: appConfig.pensarAPIKey
@@ -110,7 +106,7 @@ Pensar Console — Managed Inference
110
106
  Connect for usage-based AI inference. No API keys needed.
111
107
  `);
112
108
  const apiUrl = getPensarApiUrl();
113
- const flowInfo = await startDeviceFlow(apiUrl);
109
+ const flowInfo = await startDeviceFlow2(apiUrl);
114
110
  if (flowInfo.mode === "workos") {
115
111
  const { clientId, deviceInfo } = flowInfo;
116
112
  openUrl(deviceInfo.verification_uri_complete);
@@ -121,13 +117,13 @@ If not, open this URL:
121
117
  Your code: ${deviceInfo.user_code}
122
118
 
123
119
  Waiting for browser authorization...`);
124
- const tokens = await pollWorkOSToken({
120
+ const tokens = await pollWorkOSToken2({
125
121
  clientId,
126
122
  deviceCode: deviceInfo.device_code,
127
123
  interval: deviceInfo.interval,
128
124
  expiresIn: deviceInfo.expires_in
129
125
  });
130
- await config.update({
126
+ await config2.update({
131
127
  accessToken: tokens.accessToken,
132
128
  refreshToken: tokens.refreshToken
133
129
  });
@@ -144,7 +140,7 @@ If not, open this URL:
144
140
  Your code: ${deviceInfo.userCode}
145
141
 
146
142
  Waiting for browser authorization...`);
147
- const data = await pollLegacyToken({
143
+ const data = await pollLegacyToken2({
148
144
  apiUrl,
149
145
  deviceCode: deviceInfo.deviceCode,
150
146
  interval: deviceInfo.interval,
@@ -155,12 +151,12 @@ Waiting for browser authorization...`);
155
151
  if (!apiKey) {
156
152
  throw new Error("Pensar Console did not return an API key");
157
153
  }
158
- await config.update({
154
+ await config2.update({
159
155
  pensarAPIKey: apiKey,
160
156
  gatewaySigningKey: data.signingKey ?? null
161
157
  });
162
158
  if (data.workspace) {
163
- await config.update({
159
+ await config2.update({
164
160
  workspaceId: data.workspace.id,
165
161
  workspaceSlug: data.workspace.slug
166
162
  });
@@ -176,7 +172,7 @@ Waiting for browser authorization...`);
176
172
  }
177
173
  }
178
174
  async function handleWorkspaces(apiUrl, accessToken) {
179
- const wsResult = await fetchWorkspaces(apiUrl, accessToken);
175
+ const wsResult = await fetchWorkspaces2(apiUrl, accessToken);
180
176
  let workspaces = wsResult.workspaces;
181
177
  const consoleUrl = wsResult.consoleUrl ?? getPensarConsoleUrl();
182
178
  if (workspaces.length === 0) {
@@ -186,7 +182,7 @@ If the browser didn't open, visit: ${consoleUrl}/create-workspace?redirect=/cred
186
182
  `);
187
183
  openUrl(`${consoleUrl}/create-workspace?redirect=/credits`);
188
184
  console.log("Waiting for workspace creation...");
189
- workspaces = await pollForWorkspaceCreation(apiUrl, accessToken);
185
+ workspaces = await pollForWorkspaceCreation2(apiUrl, accessToken);
190
186
  }
191
187
  let workspaceId;
192
188
  if (workspaces.length === 1) {
@@ -198,9 +194,9 @@ If the browser didn't open, visit: ${consoleUrl}/create-workspace?redirect=/cred
198
194
  } else {
199
195
  workspaceId = await selectWorkspaceInBrowser(apiUrl, accessToken);
200
196
  }
201
- const result = await selectWorkspace(apiUrl, accessToken, workspaceId);
197
+ const result = await selectWorkspace2(apiUrl, accessToken, workspaceId);
202
198
  const workspace = result.workspace;
203
- await config.update({
199
+ await config2.update({
204
200
  workspaceId: workspace.id,
205
201
  workspaceSlug: workspace.slug,
206
202
  gatewaySigningKey: result.signingKey ?? null
@@ -223,21 +219,21 @@ If the browser didn't open, visit: ${consoleUrl}/create-workspace?redirect=/cred
223
219
  console.log("\nPensar models are now available. Run `pensar` to get started.");
224
220
  }
225
221
  async function logout() {
226
- const appConfig = await config.get();
227
- if (!isConnected(appConfig)) {
222
+ const appConfig = await config2.get();
223
+ if (!isConnected2(appConfig)) {
228
224
  console.log("Not currently connected to Pensar Console.");
229
225
  return;
230
226
  }
231
- await disconnect();
227
+ await disconnect2();
232
228
  console.log("✓ Disconnected from Pensar Console.");
233
229
  }
234
230
  async function status() {
235
- const appConfig = await config.get();
236
- if (!isConnected(appConfig)) {
231
+ const appConfig = await config2.get();
232
+ if (!isConnected2(appConfig)) {
237
233
  console.log("Not connected to Pensar Console.\n\nRun `pensar login` to connect.");
238
234
  return;
239
235
  }
240
- const validToken = await ensureValidToken({
236
+ const validToken = await ensureValidToken2({
241
237
  accessToken: appConfig.accessToken,
242
238
  refreshToken: appConfig.refreshToken,
243
239
  pensarAPIKey: appConfig.pensarAPIKey
@@ -255,7 +251,7 @@ async function status() {
255
251
  if (res.ok) {
256
252
  const data = await res.json();
257
253
  if (data.workspace) {
258
- await config.update({
254
+ await config2.update({
259
255
  workspaceId: data.workspace.id,
260
256
  workspaceSlug: data.workspace.slug
261
257
  });
@@ -300,12 +296,12 @@ async function main() {
300
296
  } else {
301
297
  console.error(`Unknown auth subcommand: ${subcommand}`);
302
298
  console.error("Run 'pensar login --help' for usage information");
303
- process.exit(1);
299
+ return markCommandFailed();
304
300
  }
305
301
  } catch (err) {
306
302
  console.error(`
307
303
  Error: ${err instanceof Error ? err.message : String(err)}`);
308
- process.exit(1);
304
+ return markCommandFailed();
309
305
  }
310
306
  }
311
- main();
307
+ await main();
@@ -0,0 +1,12 @@
1
+ import {
2
+ BlackboxAttackSurfaceAgent2
3
+ } from "./cli-8kkaeb70.js";
4
+ import"./cli-qba2x69h.js";
5
+ import"./cli-qkb3v2nw.js";
6
+ import"./cli-n4h7ygp5.js";
7
+ import"./cli-j1916nvj.js";
8
+ import"./cli-qktcyj48.js";
9
+ import"./cli-wfb4gde1.js";
10
+ export {
11
+ BlackboxAttackSurfaceAgent2 as BlackboxAttackSurfaceAgent
12
+ };
@@ -0,0 +1,61 @@
1
+ import"./cli-qkb3v2nw.js";
2
+ import"./cli-wfb4gde1.js";
3
+ import"./cli-j1916nvj.js";
4
+ import"./cli-n4h7ygp5.js";
5
+ import"./cli-8kkaeb70.js";
6
+ import"./cli-4z46kyrk.js";
7
+ import"./cli-q45hcq3f.js";
8
+ import {
9
+ readExecutionMetrics,
10
+ writeExecutionMetrics,
11
+ runPentestWorkflow2
12
+ } from "./cli-jw1xftqm.js";
13
+ import"./cli-gq5sk2j3.js";
14
+ import"./cli-gamfs2yq.js";
15
+ import {
16
+ EMPTY_SESSION_TOKEN_USAGE,
17
+ accumulateSessionTokens
18
+ } from "./cli-ag6jtndp.js";
19
+ import"./cli-qba2x69h.js";
20
+ import"./cli-qktcyj48.js";
21
+
22
+ // src/core/api/blackboxPentest.ts
23
+ async function runPentestAgent(input) {
24
+ const persisted = readExecutionMetrics(input.session.rootPath)?.tokenUsage;
25
+ let tokenUsage = persisted ?? EMPTY_SESSION_TOKEN_USAGE;
26
+ const onStepFinish = async (event) => {
27
+ tokenUsage = accumulateSessionTokens(tokenUsage, event.usage ?? {});
28
+ await input.onStepFinish?.(event);
29
+ };
30
+ const onCacheMetrics = (metrics) => {
31
+ tokenUsage = accumulateSessionTokens(tokenUsage, {
32
+ cacheReadTokens: metrics.cacheReadInputTokens,
33
+ cacheWriteTokens: metrics.cacheCreationInputTokens
34
+ });
35
+ input.onCacheMetrics?.(metrics);
36
+ };
37
+ let result;
38
+ try {
39
+ result = await runPentestWorkflow2({
40
+ ...input,
41
+ onStepFinish,
42
+ onCacheMetrics
43
+ });
44
+ } finally {
45
+ writeExecutionMetrics({
46
+ sessionRootPath: input.session.rootPath,
47
+ tokenUsage
48
+ });
49
+ }
50
+ const { findings, findingsPath, pocsPath, reportPath } = result;
51
+ console.log(`
52
+ Found ${findings.length} vulnerabilities`);
53
+ console.log(`Findings: ${findingsPath}`);
54
+ console.log(`POCs: ${pocsPath}`);
55
+ if (reportPath)
56
+ console.log(`Report: ${reportPath}`);
57
+ return { findings, findingsPath, pocsPath, reportPath };
58
+ }
59
+ export {
60
+ runPentestAgent
61
+ };