@pensar/apex 2.3.0 → 2.4.0-canary.09a8744f

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 (81) hide show
  1. package/build/{agent-9xna7jhw.js → agent-4gcavfr4.js} +12 -11
  2. package/build/agent-7x7b5hz1.js +30 -0
  3. package/build/agent-zx1cw89c.js +20 -0
  4. package/build/{apps-43pqbz7r.js → apps-xqecgcbn.js} +75 -34
  5. package/build/{auth-c1z670rx.js → auth-62z3kedh.js} +46 -23
  6. package/build/authentication-phbasmkj.js +20 -0
  7. package/build/blackboxAgent-3s34dabp.js +20 -0
  8. package/build/blackboxPentest-mg2p9s1m.js +70 -0
  9. package/build/{cli-zk1ch6qf.js → cli-4a1c4tkn.js} +61 -10
  10. package/build/{cli-zx8gk8xv.js → cli-51503njj.js} +661 -328
  11. package/build/cli-53rm0rrz.js +15 -0
  12. package/build/{cli-eveg9djy.js → cli-5tbg4dyb.js} +3 -2
  13. package/build/cli-68260ckj.js +12136 -0
  14. package/build/{cli-baqhqbe5.js → cli-7gcsfnw6.js} +3 -3
  15. package/build/cli-7q3ae3ft.js +6 -0
  16. package/build/{cli-72b18z0n.js → cli-8nj7pnew.js} +28 -5
  17. package/build/{cli-f7hanqbw.js → cli-9fds4ss0.js} +2 -2
  18. package/build/cli-9pbk8m32.js +32 -0
  19. package/build/{cli-3k1x5rn3.js → cli-avmhkjtv.js} +2970 -4450
  20. package/build/{cli-vckbhnyk.js → cli-b3d97zgc.js} +2 -2
  21. package/build/{cli-8rxa073f.js → cli-bc05qbss.js} +8 -6
  22. package/build/{cli-7tw4xfnw.js → cli-cdk877bx.js} +1 -1
  23. package/build/{cli-q24twygk.js → cli-dm0fc0bm.js} +1 -1
  24. package/build/{cli-barsn8br.js → cli-e1gmqsyh.js} +11 -5
  25. package/build/{cli-yz80qkzn.js → cli-ee3axgts.js} +7 -1
  26. package/build/{cli-f71s6kcw.js → cli-ex9r1x7c.js} +81 -215
  27. package/build/{cli-n2m2yy5b.js → cli-hc4w41as.js} +2105 -957
  28. package/build/{cli-gpnb45ck.js → cli-j54qa6tm.js} +7 -7
  29. package/build/{cli-j0n189ee.js → cli-j5p6jwm8.js} +2 -2
  30. package/build/{cli-wszshs5e.js → cli-k71t434r.js} +4 -4
  31. package/build/cli-knd276ed.js +1485 -0
  32. package/build/{cli-zm8tfpv7.js → cli-n36kxpcz.js} +62 -44
  33. package/build/{cli-bv2807tj.js → cli-n4cmzq79.js} +5 -3
  34. package/build/{cli-jyp2c6th.js → cli-nvqny4ej.js} +5 -3
  35. package/build/{cli-50906d27.js → cli-nw9ytp7z.js} +122 -43
  36. package/build/{cli-bnkgdywr.js → cli-ppj4c75j.js} +1 -1
  37. package/build/cli.js +546 -98
  38. package/build/{config-jzqjz606.js → config-7f07yemp.js} +20 -17
  39. package/build/{doctor-q3qws68e.js → doctor-gwvyn249.js} +11 -9
  40. package/build/{fastStrike-ebz1ph9a.js → fastStrike-zxsk2q40.js} +39 -16
  41. package/build/{fixes-86yebsj0.js → fixes-zqe8v8ye.js} +27 -22
  42. package/build/getMachineId-bsd-xj3bn2fv.js +36 -0
  43. package/build/getMachineId-darwin-07jzjcx6.js +36 -0
  44. package/build/getMachineId-linux-ahngynxd.js +29 -0
  45. package/build/getMachineId-unsupported-vy43b44z.js +19 -0
  46. package/build/getMachineId-win-8x66cynz.js +38 -0
  47. package/build/{index-32hn8rrw.js → index-4j14ssrg.js} +3 -3
  48. package/build/{index-gq9h8j5j.js → index-5wh7gq37.js} +135 -133
  49. package/build/{index-468j74f3.js → index-6s313ddp.js} +121 -97
  50. package/build/{index-e8c8zcrf.js → index-9j3pakz7.js} +32 -26
  51. package/build/{index-h2hj2hj9.js → index-cbwn03kz.js} +16 -16
  52. package/build/{index-8db1d2q3.js → index-cmvmnes1.js} +18 -18
  53. package/build/{index-tke6896d.js → index-psqjpw5m.js} +10 -10
  54. package/build/index-r4z6r7vf.js +12 -0
  55. package/build/{index-97vx1a24.js → index-rdqjtnp7.js} +2774 -2236
  56. package/build/{index-mr2cseg4.js → index-wddghhbd.js} +20 -19
  57. package/build/{issues-kh4wg8c5.js → issues-j7ybeaz9.js} +36 -28
  58. package/build/{logs-bj28xmbf.js → logs-qdceq54y.js} +27 -22
  59. package/build/{multipart-parser-6zd16497.js → multipart-parser-g2xxkezz.js} +2 -2
  60. package/build/{offesecAgent-8ky7gccp.js → offesecAgent-9tecezzm.js} +12 -11
  61. package/build/{parse-7djk9jyf.js → parse-rtccymzn.js} +3 -3
  62. package/build/pentest-qk82s64n.js +30 -0
  63. package/build/{pentests-62d6zw6p.js → pentests-97d3rwzr.js} +28 -23
  64. package/build/{targetedPentest-me4jnr3z.js → targetedPentest-g9x0g0zp.js} +15 -14
  65. package/build/{targets-e5k1mrky.js → targets-6m1cp1hx.js} +29 -24
  66. package/build/threatModel-a4gsw56r.js +29 -0
  67. package/build/{token-rdcbn380.js → token-3bbp59y6.js} +3 -3
  68. package/build/{token-util-sxb85ahn.js → token-util-6xjme11b.js} +2 -2
  69. package/build/{uninstall-jt1bca2p.js → uninstall-pkxkzt35.js} +7 -4
  70. package/build/{upload-krd8bnex.js → upload-w71jnkg0.js} +12 -11
  71. package/build/{utils-skmqhyfg.js → utils-846z7q2v.js} +18 -13
  72. package/package.json +8 -2
  73. package/build/agent-71z4e7jg.js +0 -19
  74. package/build/agent-ga5fecfs.js +0 -27
  75. package/build/authentication-hgs7ym0m.js +0 -19
  76. package/build/blackboxAgent-gem3mxa9.js +0 -19
  77. package/build/blackboxPentest-tgc2t3y6.js +0 -37
  78. package/build/index-ag14v3sg.js +0 -12
  79. package/build/main-3d7dfdvs.js +0 -324
  80. package/build/pentest-rs0181nf.js +0 -29
  81. package/build/threatModel-k4f3zgqd.js +0 -27
@@ -1,24 +1,25 @@
1
1
  import {
2
2
  OffensiveSecurityAgent
3
- } from "./cli-n2m2yy5b.js";
3
+ } from "./cli-hc4w41as.js";
4
4
  import {
5
5
  detectOSAndEnhancePrompt
6
- } from "./cli-7tw4xfnw.js";
6
+ } from "./cli-cdk877bx.js";
7
7
  import"./cli-c8131c4q.js";
8
8
  import {
9
9
  init_dist,
10
10
  stepCountIs
11
- } from "./cli-zx8gk8xv.js";
12
- import"./cli-vckbhnyk.js";
11
+ } from "./cli-51503njj.js";
12
+ import"./cli-b3d97zgc.js";
13
13
  import {
14
14
  exports_external,
15
15
  init_zod
16
- } from "./cli-3k1x5rn3.js";
17
- import"./cli-gpnb45ck.js";
18
- import"./cli-f7hanqbw.js";
19
- import"./cli-eveg9djy.js";
20
- import"./cli-barsn8br.js";
21
- import"./cli-8rxa073f.js";
16
+ } from "./cli-avmhkjtv.js";
17
+ import"./cli-j54qa6tm.js";
18
+ import"./cli-9fds4ss0.js";
19
+ import"./cli-5tbg4dyb.js";
20
+ import"./cli-e1gmqsyh.js";
21
+ import"./cli-knd276ed.js";
22
+ import"./cli-bc05qbss.js";
22
23
 
23
24
  // src/core/agents/specialized/findingJudge/agent.ts
24
25
  init_dist();
@@ -68,7 +69,7 @@ You are the last line of defense against false positives, hallucinated findings,
68
69
  - Authorization / access-control boundary bypass (RSC/prefetch/redirect-body leaks, missing per-route checks): the evidence must establish the access-model delta — which identity/role was used, and proof that the returned data is genuinely out of scope for that identity (cross-tenant, another user's, or admin-only data a member should not see). A 200 response, a leaked RSC payload, or a skipped redirect alone does NOT prove sensitive exposure. If the bypass is real but the returned data is non-sensitive or plausibly same-tenant/expected-visible, classify as a valid lower-impact finding and require the claim's impact/severity to match — do NOT accept it as high-confidence sensitive/cross-tenant exposure.
69
70
  - Authentication bypass: output should show protected access without valid credentials.
70
71
  - Email/HTML injection: ideally verify delivery and rendering. If only server acceptance is shown, confidence must stay below 0.7 and limitations must state rendering was not independently verified.
71
- - Missing rate limiting / anti-automation: fewer than 50 requests is insufficient. Evidence must state exact request count, timing/distribution, and observed statuses.
72
+ - Missing rate limiting / anti-automation: a modest burst (~20 requests) with no observed throttling, delays, or 429s is sufficient to demonstrate the gap. For endpoints with real-world side effects (sending email/SMS/push, creating tickets/notifications, contact/support/feedback forms, payments), as few as 2–3 attempts plus the observed response is sufficient — do NOT require volume-testing that would spam real recipients. Evidence must state exact request count, timing/distribution, and observed statuses.
72
73
 
73
74
  ### Common Low-Signal Patterns
74
75
  Reject these unless the submitted evidence demonstrates concrete harm:
@@ -0,0 +1,30 @@
1
+ import {
2
+ PentestResponseSchema,
3
+ TargetedPentestAgent,
4
+ buildPentestActiveTools,
5
+ buildPentestPrompt,
6
+ buildPentestSystemPrompt,
7
+ resolvePentestAgentRole
8
+ } from "./cli-nw9ytp7z.js";
9
+ import"./cli-9fsre5pt.js";
10
+ import"./cli-nvqny4ej.js";
11
+ import"./cli-hc4w41as.js";
12
+ import"./cli-cdk877bx.js";
13
+ import"./cli-c8131c4q.js";
14
+ import"./cli-51503njj.js";
15
+ import"./cli-b3d97zgc.js";
16
+ import"./cli-avmhkjtv.js";
17
+ import"./cli-j54qa6tm.js";
18
+ import"./cli-9fds4ss0.js";
19
+ import"./cli-5tbg4dyb.js";
20
+ import"./cli-e1gmqsyh.js";
21
+ import"./cli-knd276ed.js";
22
+ import"./cli-bc05qbss.js";
23
+ export {
24
+ PentestResponseSchema,
25
+ TargetedPentestAgent,
26
+ buildPentestActiveTools,
27
+ buildPentestPrompt,
28
+ buildPentestSystemPrompt,
29
+ resolvePentestAgentRole
30
+ };
@@ -0,0 +1,20 @@
1
+ import {
2
+ CodeAgent
3
+ } from "./cli-j5p6jwm8.js";
4
+ import"./cli-9fsre5pt.js";
5
+ import"./cli-nvqny4ej.js";
6
+ import"./cli-hc4w41as.js";
7
+ import"./cli-cdk877bx.js";
8
+ import"./cli-c8131c4q.js";
9
+ import"./cli-51503njj.js";
10
+ import"./cli-b3d97zgc.js";
11
+ import"./cli-avmhkjtv.js";
12
+ import"./cli-j54qa6tm.js";
13
+ import"./cli-9fds4ss0.js";
14
+ import"./cli-5tbg4dyb.js";
15
+ import"./cli-e1gmqsyh.js";
16
+ import"./cli-knd276ed.js";
17
+ import"./cli-bc05qbss.js";
18
+ export {
19
+ CodeAgent
20
+ };
@@ -1,39 +1,47 @@
1
1
  #!/usr/bin/env bun
2
2
  import {
3
+ markCommandFailed
4
+ } from "./cli-7q3ae3ft.js";
5
+ import"./cli-ex9r1x7c.js";
6
+ import"./cli-9pbk8m32.js";
7
+ import"./cli-n36kxpcz.js";
8
+ import"./cli-7gcsfnw6.js";
9
+ import"./cli-n4cmzq79.js";
10
+ import"./cli-nw9ytp7z.js";
11
+ import"./cli-8nj7pnew.js";
12
+ import"./cli-4a1c4tkn.js";
13
+ import"./cli-j5p6jwm8.js";
14
+ import"./cli-9fsre5pt.js";
15
+ import"./cli-nvqny4ej.js";
16
+ import {
17
+ ENDPOINT_TRANSPORTS,
3
18
  createApp,
19
+ createDomain,
4
20
  createEndpoint,
5
21
  deleteApp,
6
22
  deleteEndpoint,
7
23
  getApp,
8
24
  getEndpoint,
9
25
  listApps,
26
+ listDomains,
10
27
  listEndpoints,
11
28
  searchApps,
12
29
  searchEndpoints,
13
30
  updateApp,
14
31
  updateEndpoint
15
- } from "./cli-f71s6kcw.js";
16
- import"./cli-zm8tfpv7.js";
17
- import"./cli-bv2807tj.js";
18
- import"./cli-72b18z0n.js";
19
- import"./cli-50906d27.js";
20
- import"./cli-zk1ch6qf.js";
21
- import"./cli-j0n189ee.js";
22
- import"./cli-baqhqbe5.js";
23
- import"./cli-9fsre5pt.js";
24
- import"./cli-jyp2c6th.js";
25
- import"./cli-n2m2yy5b.js";
26
- import"./cli-7tw4xfnw.js";
32
+ } from "./cli-hc4w41as.js";
33
+ import"./cli-cdk877bx.js";
27
34
  import"./cli-fw5r7pfj.js";
28
35
  import"./cli-c8131c4q.js";
29
- import"./cli-zx8gk8xv.js";
30
- import"./cli-vckbhnyk.js";
31
- import"./cli-3k1x5rn3.js";
32
- import"./cli-gpnb45ck.js";
33
- import"./cli-f7hanqbw.js";
34
- import"./cli-eveg9djy.js";
35
- import"./cli-barsn8br.js";
36
- import"./cli-8rxa073f.js";
36
+ import"./cli-51503njj.js";
37
+ import"./cli-b3d97zgc.js";
38
+ import"./cli-avmhkjtv.js";
39
+ import"./cli-j54qa6tm.js";
40
+ import"./cli-9fds4ss0.js";
41
+ import"./cli-5tbg4dyb.js";
42
+ import"./cli-e1gmqsyh.js";
43
+ import"./cli-knd276ed.js";
44
+ import"./cli-bc05qbss.js";
37
45
 
38
46
  // src/cli/apps.ts
39
47
  var APPLICATION_TYPES = [
@@ -88,6 +96,14 @@ function parseEndpointType(value) {
88
96
  }
89
97
  return value;
90
98
  }
99
+ function parseTransport(value) {
100
+ if (value === undefined)
101
+ return;
102
+ if (!ENDPOINT_TRANSPORTS.includes(value)) {
103
+ throw new Error(`Invalid --transport "${value}". Must be one of: ${ENDPOINT_TRANSPORTS.join(", ")}`);
104
+ }
105
+ return value;
106
+ }
91
107
  function parseInteger(flag, value) {
92
108
  if (value === undefined)
93
109
  return;
@@ -117,6 +133,8 @@ Usage:
117
133
  pensar apps create [options] Create an app
118
134
  pensar apps update <appId> [options] Update an app
119
135
  pensar apps delete <appId> Delete an app
136
+ pensar apps domains List workspace domains
137
+ pensar apps domain-create <domain> Create/resolve a domain
120
138
  pensar apps endpoints <appId> [filters] List endpoints
121
139
  pensar apps endpoint <endpointId> Show endpoint details
122
140
  pensar apps endpoint-create <appId> [options] Create an endpoint
@@ -130,9 +148,13 @@ App fields (create requires --name and --description):
130
148
  --description <text> Application description
131
149
  --type <type> One of: ${APPLICATION_TYPES.join(", ")}
132
150
  --framework <text> Framework / runtime hint
133
- --domain <id> Linked domain UUID
151
+ --domain <id> Linked domain UUID (see "apps domains")
134
152
  --disallowed-actions <text> Free-form disallowed actions notes
135
153
 
154
+ Domains:
155
+ API-created domains are canonicalized and created idempotently by Console.
156
+ They stay unverified and do not start reconnaissance.
157
+
136
158
  List pagination (for "apps" and "endpoints <appId>"):
137
159
  --limit <n> Page size (default 100, max 200)
138
160
  --offset <n> Page offset (default 0)
@@ -158,6 +180,8 @@ Endpoint fields (create requires --endpoint and --description):
158
180
  --endpoint <text> Endpoint path / URL / route
159
181
  --description <text> Endpoint description
160
182
  --type <type> One of: ${ENDPOINT_TYPES.join(", ")}
183
+ --transport <transport> One of: ${ENDPOINT_TRANSPORTS.join(", ")}
184
+ (defaults to http when omitted)
161
185
  --location <text> Source file (whitebox)
162
186
  --start-line <n> Start line number
163
187
  --end-line <n> End line number
@@ -235,6 +259,7 @@ function parseEndpointCreateOptions(argv) {
235
259
  if (description === undefined)
236
260
  throw new Error("--description is required");
237
261
  const type = parseEndpointType(getFlag("--type", argv));
262
+ const transport = parseTransport(getFlag("--transport", argv));
238
263
  const location = getFlag("--location", argv);
239
264
  const startLineNumber = parseInteger("--start-line", getFlag("--start-line", argv));
240
265
  const endLineNumber = parseInteger("--end-line", getFlag("--end-line", argv));
@@ -246,6 +271,7 @@ function parseEndpointCreateOptions(argv) {
246
271
  endpoint,
247
272
  description,
248
273
  ...type !== undefined ? { type } : {},
274
+ ...transport !== undefined ? { transport } : {},
249
275
  ...location !== undefined ? { location } : {},
250
276
  ...startLineNumber !== undefined ? { startLineNumber } : {},
251
277
  ...endLineNumber !== undefined ? { endLineNumber } : {},
@@ -269,6 +295,9 @@ function parseEndpointUpdateOptions(argv) {
269
295
  const type = parseEndpointType(getFlag("--type", argv));
270
296
  if (type !== undefined)
271
297
  update.type = type;
298
+ const transport = parseTransport(getFlag("--transport", argv));
299
+ if (transport !== undefined)
300
+ update.transport = transport;
272
301
  const location = getFlag("--location", argv);
273
302
  if (location !== undefined)
274
303
  update.location = location;
@@ -305,7 +334,7 @@ async function main() {
305
334
  if (!appId) {
306
335
  console.error("Error: app ID is required");
307
336
  console.error("Usage: pensar apps get <appId>");
308
- process.exit(1);
337
+ return markCommandFailed();
309
338
  }
310
339
  const app = await getApp(appId);
311
340
  console.log(JSON.stringify(app, null, 2));
@@ -318,7 +347,7 @@ async function main() {
318
347
  if (!appId) {
319
348
  console.error("Error: app ID is required");
320
349
  console.error("Usage: pensar apps update <appId> [options]");
321
- process.exit(1);
350
+ return markCommandFailed();
322
351
  }
323
352
  const opts = parseAppUpdateOptions(args);
324
353
  const result = await updateApp(appId, opts);
@@ -328,16 +357,28 @@ async function main() {
328
357
  if (!appId) {
329
358
  console.error("Error: app ID is required");
330
359
  console.error("Usage: pensar apps delete <appId>");
331
- process.exit(1);
360
+ return markCommandFailed();
332
361
  }
333
362
  const result = await deleteApp(appId);
334
363
  console.log(JSON.stringify(result, null, 2));
364
+ } else if (sub === "domains") {
365
+ const result = await listDomains();
366
+ console.log(JSON.stringify(result, null, 2));
367
+ } else if (sub === "domain-create") {
368
+ const url = args[1];
369
+ if (!url) {
370
+ console.error("Error: domain is required");
371
+ console.error("Usage: pensar apps domain-create <domain>");
372
+ return markCommandFailed();
373
+ }
374
+ const result = await createDomain({ url });
375
+ console.log(JSON.stringify(result, null, 2));
335
376
  } else if (sub === "endpoints") {
336
377
  const appId = args[1];
337
378
  if (!appId) {
338
379
  console.error("Error: app ID is required");
339
380
  console.error("Usage: pensar apps endpoints <appId> [filters]");
340
- process.exit(1);
381
+ return markCommandFailed();
341
382
  }
342
383
  const type = parseEndpointType(getFlag("--type", args));
343
384
  const minRiskScore = parseNumber("--min-risk", getFlag("--min-risk", args));
@@ -356,7 +397,7 @@ async function main() {
356
397
  if (!endpointId) {
357
398
  console.error("Error: endpoint ID is required");
358
399
  console.error("Usage: pensar apps endpoint <endpointId>");
359
- process.exit(1);
400
+ return markCommandFailed();
360
401
  }
361
402
  const result = await getEndpoint(endpointId);
362
403
  console.log(JSON.stringify(result, null, 2));
@@ -365,7 +406,7 @@ async function main() {
365
406
  if (!appId) {
366
407
  console.error("Error: app ID is required");
367
408
  console.error("Usage: pensar apps endpoint-create <appId> --endpoint E --description D");
368
- process.exit(1);
409
+ return markCommandFailed();
369
410
  }
370
411
  const opts = parseEndpointCreateOptions(args);
371
412
  const result = await createEndpoint(appId, opts);
@@ -375,7 +416,7 @@ async function main() {
375
416
  if (!endpointId) {
376
417
  console.error("Error: endpoint ID is required");
377
418
  console.error("Usage: pensar apps endpoint-update <endpointId> [options]");
378
- process.exit(1);
419
+ return markCommandFailed();
379
420
  }
380
421
  const opts = parseEndpointUpdateOptions(args);
381
422
  const result = await updateEndpoint(endpointId, opts);
@@ -385,7 +426,7 @@ async function main() {
385
426
  if (!endpointId) {
386
427
  console.error("Error: endpoint ID is required");
387
428
  console.error("Usage: pensar apps endpoint-delete <endpointId>");
388
- process.exit(1);
429
+ return markCommandFailed();
389
430
  }
390
431
  const result = await deleteEndpoint(endpointId);
391
432
  console.log(JSON.stringify(result, null, 2));
@@ -394,7 +435,7 @@ async function main() {
394
435
  if (!query || query.startsWith("--")) {
395
436
  console.error("Error: search query is required");
396
437
  console.error("Usage: pensar apps search <query> [options]");
397
- process.exit(1);
438
+ return markCommandFailed();
398
439
  }
399
440
  const type = parseAppType(getFlag("--type", args));
400
441
  const limit = parseInteger("--limit", getFlag("--limit", args));
@@ -410,7 +451,7 @@ async function main() {
410
451
  if (!query || query.startsWith("--")) {
411
452
  console.error("Error: search query is required");
412
453
  console.error("Usage: pensar apps search-endpoints <query> [options]");
413
- process.exit(1);
454
+ return markCommandFailed();
414
455
  }
415
456
  const applicationId = getFlag("--app", args);
416
457
  const type = parseEndpointType(getFlag("--type", args));
@@ -438,12 +479,12 @@ async function main() {
438
479
  } else {
439
480
  console.error(`Error: Unknown subcommand "${sub}"`);
440
481
  showHelp();
441
- process.exit(1);
482
+ return markCommandFailed();
442
483
  }
443
484
  } catch (err) {
444
485
  console.error(`
445
486
  Error: ${err instanceof Error ? err.message : String(err)}`);
446
- process.exit(1);
487
+ return markCommandFailed();
447
488
  }
448
489
  }
449
- main();
490
+ await main();
@@ -1,22 +1,27 @@
1
1
  #!/usr/bin/env bun
2
- import"./cli-f71s6kcw.js";
3
- import"./cli-zm8tfpv7.js";
4
- import"./cli-bv2807tj.js";
5
- import"./cli-72b18z0n.js";
6
- import"./cli-50906d27.js";
7
- import"./cli-zk1ch6qf.js";
8
- import"./cli-j0n189ee.js";
9
- import"./cli-baqhqbe5.js";
2
+ import {
3
+ markCommandFailed
4
+ } from "./cli-7q3ae3ft.js";
5
+ import"./cli-ex9r1x7c.js";
6
+ import"./cli-9pbk8m32.js";
7
+ import"./cli-n36kxpcz.js";
8
+ import"./cli-7gcsfnw6.js";
9
+ import"./cli-n4cmzq79.js";
10
+ import"./cli-nw9ytp7z.js";
11
+ import"./cli-8nj7pnew.js";
12
+ import"./cli-4a1c4tkn.js";
13
+ import"./cli-j5p6jwm8.js";
10
14
  import"./cli-9fsre5pt.js";
11
- import"./cli-jyp2c6th.js";
12
- import"./cli-n2m2yy5b.js";
13
- import"./cli-7tw4xfnw.js";
15
+ import"./cli-nvqny4ej.js";
16
+ import"./cli-hc4w41as.js";
17
+ import"./cli-cdk877bx.js";
14
18
  import"./cli-fw5r7pfj.js";
15
19
  import"./cli-c8131c4q.js";
16
- import"./cli-zx8gk8xv.js";
20
+ import"./cli-51503njj.js";
17
21
  import {
18
22
  createWorkspaceSelection,
19
23
  disconnect,
24
+ ensureValidToken,
20
25
  fetchWorkspaces,
21
26
  getPensarApiUrl,
22
27
  getPensarConsoleUrl,
@@ -28,18 +33,19 @@ import {
28
33
  pollWorkspaceSelection,
29
34
  selectWorkspace,
30
35
  startDeviceFlow
31
- } from "./cli-vckbhnyk.js";
32
- import"./cli-3k1x5rn3.js";
33
- import"./cli-gpnb45ck.js";
36
+ } from "./cli-b3d97zgc.js";
37
+ import"./cli-avmhkjtv.js";
38
+ import"./cli-j54qa6tm.js";
34
39
  import {
35
40
  config,
36
41
  init_config
37
- } from "./cli-f7hanqbw.js";
38
- import"./cli-eveg9djy.js";
39
- import"./cli-barsn8br.js";
42
+ } from "./cli-9fds4ss0.js";
43
+ import"./cli-5tbg4dyb.js";
44
+ import"./cli-e1gmqsyh.js";
45
+ import"./cli-knd276ed.js";
40
46
  import {
41
47
  __require
42
- } from "./cli-8rxa073f.js";
48
+ } from "./cli-bc05qbss.js";
43
49
 
44
50
  // src/cli/auth.ts
45
51
  import * as readline from "node:readline";
@@ -85,7 +91,13 @@ Waiting for workspace selection...`);
85
91
  }
86
92
  async function login() {
87
93
  const appConfig = await config.get();
88
- if (isConnected(appConfig)) {
94
+ const hasStoredCredentials = isConnected(appConfig);
95
+ const validToken = hasStoredCredentials ? await ensureValidToken({
96
+ accessToken: appConfig.accessToken,
97
+ refreshToken: appConfig.refreshToken,
98
+ pensarAPIKey: appConfig.pensarAPIKey
99
+ }) : null;
100
+ if (validToken) {
89
101
  console.log("Already connected to Pensar Console.");
90
102
  if (appConfig.workspaceSlug) {
91
103
  console.log(` Workspace: ${appConfig.workspaceSlug}`);
@@ -95,6 +107,8 @@ Reconnect? (y/N): `);
95
107
  if (answer.toLowerCase() !== "y") {
96
108
  return;
97
109
  }
110
+ } else if (hasStoredCredentials) {
111
+ console.log("Your saved Pensar Console session has expired. Reconnecting.");
98
112
  }
99
113
  console.log(`
100
114
  Pensar Console — Managed Inference
@@ -228,6 +242,15 @@ async function status() {
228
242
  console.log("Not connected to Pensar Console.\n\nRun `pensar login` to connect.");
229
243
  return;
230
244
  }
245
+ const validToken = await ensureValidToken({
246
+ accessToken: appConfig.accessToken,
247
+ refreshToken: appConfig.refreshToken,
248
+ pensarAPIKey: appConfig.pensarAPIKey
249
+ });
250
+ if (!validToken) {
251
+ console.log("Your Pensar Console session has expired.\n\nRun `pensar login` to reconnect.");
252
+ return;
253
+ }
231
254
  if (!appConfig.accessToken && appConfig.pensarAPIKey && !appConfig.workspaceSlug) {
232
255
  try {
233
256
  const apiUrl = getPensarApiUrl();
@@ -282,12 +305,12 @@ async function main() {
282
305
  } else {
283
306
  console.error(`Unknown auth subcommand: ${subcommand}`);
284
307
  console.error("Run 'pensar login --help' for usage information");
285
- process.exit(1);
308
+ return markCommandFailed();
286
309
  }
287
310
  } catch (err) {
288
311
  console.error(`
289
312
  Error: ${err instanceof Error ? err.message : String(err)}`);
290
- process.exit(1);
313
+ return markCommandFailed();
291
314
  }
292
315
  }
293
- main();
316
+ await main();
@@ -0,0 +1,20 @@
1
+ import {
2
+ runAuthenticationAgent
3
+ } from "./cli-4a1c4tkn.js";
4
+ import"./cli-9fsre5pt.js";
5
+ import"./cli-nvqny4ej.js";
6
+ import"./cli-hc4w41as.js";
7
+ import"./cli-cdk877bx.js";
8
+ import"./cli-c8131c4q.js";
9
+ import"./cli-51503njj.js";
10
+ import"./cli-b3d97zgc.js";
11
+ import"./cli-avmhkjtv.js";
12
+ import"./cli-j54qa6tm.js";
13
+ import"./cli-9fds4ss0.js";
14
+ import"./cli-5tbg4dyb.js";
15
+ import"./cli-e1gmqsyh.js";
16
+ import"./cli-knd276ed.js";
17
+ import"./cli-bc05qbss.js";
18
+ export {
19
+ runAuthenticationAgent
20
+ };
@@ -0,0 +1,20 @@
1
+ import {
2
+ BlackboxAttackSurfaceAgent
3
+ } from "./cli-n4cmzq79.js";
4
+ import"./cli-9fsre5pt.js";
5
+ import"./cli-nvqny4ej.js";
6
+ import"./cli-hc4w41as.js";
7
+ import"./cli-cdk877bx.js";
8
+ import"./cli-c8131c4q.js";
9
+ import"./cli-51503njj.js";
10
+ import"./cli-b3d97zgc.js";
11
+ import"./cli-avmhkjtv.js";
12
+ import"./cli-j54qa6tm.js";
13
+ import"./cli-9fds4ss0.js";
14
+ import"./cli-5tbg4dyb.js";
15
+ import"./cli-e1gmqsyh.js";
16
+ import"./cli-knd276ed.js";
17
+ import"./cli-bc05qbss.js";
18
+ export {
19
+ BlackboxAttackSurfaceAgent
20
+ };
@@ -0,0 +1,70 @@
1
+ import {
2
+ EMPTY_SESSION_TOKEN_USAGE,
3
+ accumulateSessionTokens
4
+ } from "./cli-9pbk8m32.js";
5
+ import {
6
+ readExecutionMetrics,
7
+ runPentestWorkflow,
8
+ writeExecutionMetrics
9
+ } from "./cli-n36kxpcz.js";
10
+ import"./cli-7gcsfnw6.js";
11
+ import"./cli-n4cmzq79.js";
12
+ import"./cli-nw9ytp7z.js";
13
+ import"./cli-8nj7pnew.js";
14
+ import"./cli-j5p6jwm8.js";
15
+ import"./cli-9fsre5pt.js";
16
+ import"./cli-nvqny4ej.js";
17
+ import"./cli-hc4w41as.js";
18
+ import"./cli-cdk877bx.js";
19
+ import"./cli-fw5r7pfj.js";
20
+ import"./cli-c8131c4q.js";
21
+ import"./cli-51503njj.js";
22
+ import"./cli-b3d97zgc.js";
23
+ import"./cli-avmhkjtv.js";
24
+ import"./cli-j54qa6tm.js";
25
+ import"./cli-9fds4ss0.js";
26
+ import"./cli-5tbg4dyb.js";
27
+ import"./cli-e1gmqsyh.js";
28
+ import"./cli-knd276ed.js";
29
+ import"./cli-bc05qbss.js";
30
+
31
+ // src/core/api/blackboxPentest.ts
32
+ async function runPentestAgent(input) {
33
+ const persisted = readExecutionMetrics(input.session.rootPath)?.tokenUsage;
34
+ let tokenUsage = persisted ?? EMPTY_SESSION_TOKEN_USAGE;
35
+ const onStepFinish = async (event) => {
36
+ tokenUsage = accumulateSessionTokens(tokenUsage, event.usage ?? {});
37
+ await input.onStepFinish?.(event);
38
+ };
39
+ const onCacheMetrics = (metrics) => {
40
+ tokenUsage = accumulateSessionTokens(tokenUsage, {
41
+ cacheReadTokens: metrics.cacheReadInputTokens,
42
+ cacheWriteTokens: metrics.cacheCreationInputTokens
43
+ });
44
+ input.onCacheMetrics?.(metrics);
45
+ };
46
+ let result;
47
+ try {
48
+ result = await runPentestWorkflow({
49
+ ...input,
50
+ onStepFinish,
51
+ onCacheMetrics
52
+ });
53
+ } finally {
54
+ writeExecutionMetrics({
55
+ sessionRootPath: input.session.rootPath,
56
+ tokenUsage
57
+ });
58
+ }
59
+ const { findings, findingsPath, pocsPath, reportPath } = result;
60
+ console.log(`
61
+ Found ${findings.length} vulnerabilities`);
62
+ console.log(`Findings: ${findingsPath}`);
63
+ console.log(`POCs: ${pocsPath}`);
64
+ if (reportPath)
65
+ console.log(`Report: ${reportPath}`);
66
+ return { findings, findingsPath, pocsPath, reportPath };
67
+ }
68
+ export {
69
+ runPentestAgent
70
+ };