@pensar/apex 0.0.112 → 0.0.113-canary.8a0cb7bc

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 (38) hide show
  1. package/README.md +36 -37
  2. package/build/agent-5nnw5gdw.js +16 -0
  3. package/build/{agent-5qdmmchx.js → agent-bmamdgbm.js} +9 -9
  4. package/build/{auth-jvq72ekc.js → auth-ynsrm9bf.js} +7 -6
  5. package/build/{authentication-nya4td5k.js → authentication-b5h01t7q.js} +8 -8
  6. package/build/blackboxAgent-91vnvpa8.js +17 -0
  7. package/build/{blackboxPentest-85hwznet.js → blackboxPentest-xtevpnvk.js} +13 -13
  8. package/build/{cli-hmrzx8am.js → cli-0atrar08.js} +9 -6
  9. package/build/{cli-15vxn9zj.js → cli-0tpx8khk.js} +30 -30
  10. package/build/{cli-bp6d08sg.js → cli-16m30n7b.js} +1 -1
  11. package/build/{cli-jb0gcnrs.js → cli-3tntsb59.js} +1 -1
  12. package/build/{cli-kqtgcdzn.js → cli-5ekr1ws4.js} +4418 -2241
  13. package/build/{cli-yj3dy0vg.js → cli-8q94bv77.js} +2 -2
  14. package/build/{cli-jh38b6zv.js → cli-8sm33f4k.js} +1 -1
  15. package/build/{cli-w04ggbe4.js → cli-8yze7t68.js} +2 -2
  16. package/build/{cli-j66pect7.js → cli-9tzcmrd4.js} +38 -3
  17. package/build/{cli-f9shhcxf.js → cli-ee7y516a.js} +6 -6
  18. package/build/{cli-r8r90gka.js → cli-khem6ept.js} +11 -10
  19. package/build/{cli-2ckm5es2.js → cli-renwxhw7.js} +1 -1
  20. package/build/{cli-x1msjf55.js → cli-rjfkex2j.js} +2 -2
  21. package/build/{cli-e20q3hqz.js → cli-vzq3vcqa.js} +2 -2
  22. package/build/cli.js +24 -24
  23. package/build/{fixes-1r6v7kh2.js → fixes-8dt41pqr.js} +4 -4
  24. package/build/{index-9ze42wn7.js → index-42y4vj9f.js} +40 -58
  25. package/build/{index-vwvh1rdw.js → index-7etzc7sn.js} +7 -7
  26. package/build/{index-5ke2yd32.js → index-c6x1x3cq.js} +2 -2
  27. package/build/{issues-kx721wja.js → issues-6dvz3xwg.js} +4 -4
  28. package/build/{logs-hav7d0nm.js → logs-21t24e4n.js} +4 -4
  29. package/build/pentest-5wc29t2w.js +25 -0
  30. package/build/{pentests-s9fwd71b.js → pentests-8yxnj9kr.js} +4 -4
  31. package/build/{projects-tr719twv.js → projects-hkmq4y05.js} +4 -4
  32. package/build/{targetedPentest-w2c85whf.js → targetedPentest-5zyade2x.js} +9 -9
  33. package/build/{uninstall-2j0pymb0.js → uninstall-s3r4kj3h.js} +1 -1
  34. package/build/{utils-jky0th19.js → utils-9fhmzzzh.js} +1 -1
  35. package/package.json +2 -2
  36. package/build/agent-s2z0dasf.js +0 -16
  37. package/build/blackboxAgent-qa9ze2hn.js +0 -17
  38. package/build/pentest-zzebnfa0.js +0 -25
@@ -3,7 +3,7 @@ import { spawnSync } from "child_process";
3
3
  // package.json
4
4
  var package_default = {
5
5
  name: "@pensar/apex",
6
- version: "0.0.112",
6
+ version: "0.0.113-canary.8a0cb7bc",
7
7
  description: "AI-powered penetration testing CLI tool with terminal UI",
8
8
  module: "src/tui/index.tsx",
9
9
  main: "build/cli.js",
@@ -83,7 +83,7 @@ var package_default = {
83
83
  "@ai-sdk/amazon-bedrock": "^4.0.69",
84
84
  "@ai-sdk/anthropic": "^3.0.50",
85
85
  "@ai-sdk/google": "^3.0.37",
86
- "@ai-sdk/openai": "^3.0.37",
86
+ "@ai-sdk/openai": "3.0.46",
87
87
  "@ai-sdk/openai-compatible": "^2.0.35",
88
88
  "@daytonaio/sdk": "^0.112.1",
89
89
  "@googleapis/gmail": "^16.1.1",
@@ -3,7 +3,7 @@ import {
3
3
  generateObjectResponse,
4
4
  init_zod,
5
5
  zod_default
6
- } from "./cli-kqtgcdzn.js";
6
+ } from "./cli-5ekr1ws4.js";
7
7
  import {
8
8
  __callDispose,
9
9
  __esm,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  OffensiveSecurityAgent
3
- } from "./cli-r8r90gka.js";
3
+ } from "./cli-khem6ept.js";
4
4
  import {
5
5
  stepCountIs
6
- } from "./cli-kqtgcdzn.js";
6
+ } from "./cli-5ekr1ws4.js";
7
7
 
8
8
  // src/core/agents/specialized/codeAgent/prompts.ts
9
9
  var CODE_AGENT_SYSTEM_PROMPT = `You are an expert coding agent with direct filesystem access. You will be given a specific objective — focus exclusively on completing it.
@@ -1,7 +1,9 @@
1
1
  import {
2
2
  config,
3
- getPensarApiUrl
4
- } from "./cli-bp6d08sg.js";
3
+ ensureValidToken,
4
+ getPensarApiUrl,
5
+ getPensarGatewayUrl
6
+ } from "./cli-16m30n7b.js";
5
7
 
6
8
  // src/core/auth/device-flow.ts
7
9
  function sleep(ms) {
@@ -199,4 +201,37 @@ ${bodyHash}`;
199
201
  const signature = createHmac("sha256", signingKey).update(payload).digest("base64");
200
202
  return { signature, timestamp, nonce };
201
203
  }
202
- export { signGatewayRequest, startDeviceFlow, pollWorkOSToken, pollLegacyToken, fetchWorkspaces, pollForWorkspaceCreation, selectWorkspace, isConnected, disconnect };
204
+ // src/core/auth/gateway.ts
205
+ async function validateGateway() {
206
+ const cfg = await config.get();
207
+ const tokenResult = await ensureValidToken({
208
+ accessToken: cfg.accessToken,
209
+ refreshToken: cfg.refreshToken,
210
+ pensarAPIKey: cfg.pensarAPIKey
211
+ });
212
+ if (!tokenResult)
213
+ return null;
214
+ const gatewayUrl = cfg.gatewayUrl || getPensarGatewayUrl();
215
+ const headers = {
216
+ Authorization: `Bearer ${tokenResult.token}`
217
+ };
218
+ if (cfg.workspaceId) {
219
+ headers["X-Workspace-Id"] = cfg.workspaceId;
220
+ }
221
+ const response = await fetch(`${gatewayUrl}/gateway/validate`, {
222
+ method: "GET",
223
+ headers
224
+ });
225
+ if (!response.ok) {
226
+ throw new Error(`Gateway validation failed (${response.status})`);
227
+ }
228
+ const result = await response.json();
229
+ if (result.signingKey || result.gatewayUrl) {
230
+ await config.update({
231
+ gatewaySigningKey: result.signingKey ?? undefined,
232
+ gatewayUrl: result.gatewayUrl ?? undefined
233
+ });
234
+ }
235
+ return result;
236
+ }
237
+ export { signGatewayRequest, startDeviceFlow, pollWorkOSToken, pollLegacyToken, fetchWorkspaces, pollForWorkspaceCreation, selectWorkspace, isConnected, disconnect, validateGateway };
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  TargetedPentestAgent
3
- } from "./cli-e20q3hqz.js";
3
+ } from "./cli-vzq3vcqa.js";
4
4
  import {
5
5
  CodeAgent
6
- } from "./cli-w04ggbe4.js";
6
+ } from "./cli-8yze7t68.js";
7
7
  import {
8
8
  EndpointSchema
9
- } from "./cli-2ckm5es2.js";
9
+ } from "./cli-renwxhw7.js";
10
10
  import {
11
11
  BlackboxAttackSurfaceAgent
12
- } from "./cli-hmrzx8am.js";
12
+ } from "./cli-0atrar08.js";
13
13
  import {
14
14
  CweEntrySchema,
15
15
  FindingsRegistry
16
- } from "./cli-r8r90gka.js";
16
+ } from "./cli-khem6ept.js";
17
17
  import {
18
18
  exports_external,
19
19
  init_zod
20
- } from "./cli-kqtgcdzn.js";
20
+ } from "./cli-5ekr1ws4.js";
21
21
 
22
22
  // src/core/workflows/pentest.ts
23
23
  import { existsSync as existsSync4, readdirSync as readdirSync2, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
@@ -17,7 +17,7 @@ import {
17
17
  update,
18
18
  write,
19
19
  writeRaw
20
- } from "./cli-jh38b6zv.js";
20
+ } from "./cli-8sm33f4k.js";
21
21
  import {
22
22
  _enum,
23
23
  _null,
@@ -46,18 +46,18 @@ import {
46
46
  union,
47
47
  unknown,
48
48
  zod_default
49
- } from "./cli-kqtgcdzn.js";
49
+ } from "./cli-5ekr1ws4.js";
50
50
  import {
51
51
  signGatewayRequest
52
- } from "./cli-j66pect7.js";
52
+ } from "./cli-9tzcmrd4.js";
53
53
  import {
54
54
  config,
55
55
  ensureValidToken,
56
56
  getPensarApiUrl
57
- } from "./cli-bp6d08sg.js";
57
+ } from "./cli-16m30n7b.js";
58
58
  import {
59
59
  getCurrentVersion
60
- } from "./cli-yj3dy0vg.js";
60
+ } from "./cli-8q94bv77.js";
61
61
  import {
62
62
  __commonJS,
63
63
  __require,
@@ -90321,6 +90321,7 @@ Each asset creates a JSON file in the assets directory for tracking and analysis
90321
90321
  return val;
90322
90322
  }, exports_external.enum(["LOW", "MEDIUM", "HIGH", "CRITICAL"])).describe("Risk level: LOW-CRITICAL (exposed/sensitive)"),
90323
90323
  notes: exports_external.string().optional().describe("Additional notes or observations about the asset"),
90324
+ pentestObjectives: exports_external.array(exports_external.string()).describe("Specific pentest objectives for this asset — what a pentest agent should test (e.g., 'Test for IDOR in /api/orders/{id}')"),
90324
90325
  toolCallDescription: exports_external.string().describe("A concise, human-readable description of what this tool call is doing")
90325
90326
  }),
90326
90327
  execute: async (asset) => {
@@ -90665,7 +90666,7 @@ When to use delegate_to_auth_subagent vs authenticate_session:
90665
90666
  if (credentials) {
90666
90667
  ctx.session.credentialManager.addFromAuthCredentials(credentials);
90667
90668
  }
90668
- const { runAuthenticationAgent } = await import("./authentication-nya4td5k.js");
90669
+ const { runAuthenticationAgent } = await import("./authentication-b5h01t7q.js");
90669
90670
  const subagentCallbacks = cbs ? {
90670
90671
  onTextDelta: (d) => cbs.onTextDelta?.({ ...d, subagentId }),
90671
90672
  onToolCall: (d) => cbs.onToolCall?.({ ...d, subagentId }),
@@ -91567,7 +91568,7 @@ should be passed directly to spawn_pentest_swarm for deep testing.`,
91567
91568
  });
91568
91569
  if (cwd) {
91569
91570
  try {
91570
- const { WhiteboxAttackSurfaceAgent } = await import("./agent-5qdmmchx.js");
91571
+ const { WhiteboxAttackSurfaceAgent } = await import("./agent-bmamdgbm.js");
91571
91572
  const agent = new WhiteboxAttackSurfaceAgent({
91572
91573
  codebasePath: cwd,
91573
91574
  model: ctx.model,
@@ -91619,7 +91620,7 @@ should be passed directly to spawn_pentest_swarm for deep testing.`,
91619
91620
  }
91620
91621
  }
91621
91622
  try {
91622
- const { BlackboxAttackSurfaceAgent } = await import("./blackboxAgent-qa9ze2hn.js");
91623
+ const { BlackboxAttackSurfaceAgent } = await import("./blackboxAgent-91vnvpa8.js");
91623
91624
  const agent = new BlackboxAttackSurfaceAgent({
91624
91625
  target,
91625
91626
  model: ctx.model,
@@ -91698,7 +91699,7 @@ Pass every target you want tested — the swarm handles concurrency automaticall
91698
91699
  toolCallDescription: exports_external.string().describe("A concise, human-readable description of what this tool call is doing")
91699
91700
  }),
91700
91701
  execute: async ({ targets }) => {
91701
- const { runPentestSwarm, DEFAULT_CONCURRENCY } = await import("./pentest-zzebnfa0.js");
91702
+ const { runPentestSwarm, DEFAULT_CONCURRENCY } = await import("./pentest-5wc29t2w.js");
91702
91703
  if (!ctx.model) {
91703
91704
  return {
91704
91705
  success: false,
@@ -91825,7 +91826,7 @@ Returns an array of results with the text output from each agent.`,
91825
91826
  });
91826
91827
  }
91827
91828
  async function runSingleCodingAgent(ctx, codebasePath, objective, agentIndex, name) {
91828
- const { CodeAgent } = await import("./agent-s2z0dasf.js");
91829
+ const { CodeAgent } = await import("./agent-5nnw5gdw.js");
91829
91830
  const subagentId = `coding-agent-${agentIndex}`;
91830
91831
  ctx.subagentCallbacks?.onSubagentSpawn?.({
91831
91832
  subagentId,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  exports_external,
3
3
  init_zod
4
- } from "./cli-kqtgcdzn.js";
4
+ } from "./cli-5ekr1ws4.js";
5
5
 
6
6
  // src/core/agents/specialized/whiteboxAttackSurface/types.ts
7
7
  init_zod();
@@ -2,7 +2,7 @@ import {
2
2
  config,
3
3
  ensureValidToken,
4
4
  getPensarApiUrl
5
- } from "./cli-bp6d08sg.js";
5
+ } from "./cli-16m30n7b.js";
6
6
 
7
7
  // src/core/api/issues.ts
8
8
  async function getAuthHeaders() {
@@ -19,7 +19,7 @@ async function getAuthHeaders() {
19
19
  "Content-Type": "application/json",
20
20
  Authorization: `Bearer ${validToken.token}`
21
21
  };
22
- if (validToken.type === "workos" && cfg.workspaceId) {
22
+ if (cfg.workspaceId) {
23
23
  headers["X-Workspace-Id"] = cfg.workspaceId;
24
24
  }
25
25
  return headers;
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  OffensiveSecurityAgent
3
- } from "./cli-r8r90gka.js";
3
+ } from "./cli-khem6ept.js";
4
4
  import {
5
5
  exports_external,
6
6
  init_zod
7
- } from "./cli-kqtgcdzn.js";
7
+ } from "./cli-5ekr1ws4.js";
8
8
 
9
9
  // src/core/agents/specialized/pentest/agent.ts
10
10
  init_zod();
package/build/cli.js CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- import"./cli-kqtgcdzn.js";
4
- import"./cli-j66pect7.js";
5
- import"./cli-bp6d08sg.js";
6
- import"./cli-jb0gcnrs.js";
3
+ import"./cli-5ekr1ws4.js";
4
+ import"./cli-9tzcmrd4.js";
5
+ import"./cli-16m30n7b.js";
6
+ import"./cli-3tntsb59.js";
7
7
  import {
8
8
  package_default
9
- } from "./cli-yj3dy0vg.js";
10
- import"./cli-15vxn9zj.js";
9
+ } from "./cli-8q94bv77.js";
10
+ import"./cli-0tpx8khk.js";
11
11
  import"./cli-7ckctq7a.js";
12
12
  import {
13
13
  __require,
@@ -16,7 +16,7 @@ import {
16
16
  // package.json
17
17
  var package_default2 = {
18
18
  name: "@pensar/apex",
19
- version: "0.0.112",
19
+ version: "0.0.113-canary.8a0cb7bc",
20
20
  description: "AI-powered penetration testing CLI tool with terminal UI",
21
21
  module: "src/tui/index.tsx",
22
22
  main: "build/cli.js",
@@ -96,7 +96,7 @@ var package_default2 = {
96
96
  "@ai-sdk/amazon-bedrock": "^4.0.69",
97
97
  "@ai-sdk/anthropic": "^3.0.50",
98
98
  "@ai-sdk/google": "^3.0.37",
99
- "@ai-sdk/openai": "^3.0.37",
99
+ "@ai-sdk/openai": "3.0.46",
100
100
  "@ai-sdk/openai-compatible": "^2.0.35",
101
101
  "@daytonaio/sdk": "^0.112.1",
102
102
  "@googleapis/gmail": "^16.1.1",
@@ -351,10 +351,10 @@ Global options:
351
351
  async function runPentest() {
352
352
  const { config: config2 } = await import("./main-2483qzbq.js").then((m)=>__toESM(m.default,1));
353
353
  config2();
354
- const { runPentestAgent } = await import("./blackboxPentest-85hwznet.js");
355
- const { sessions } = await import("./index-vwvh1rdw.js");
356
- const { config: appConfig } = await import("./index-5ke2yd32.js");
357
- const { getDefaultModelForConfig } = await import("./utils-jky0th19.js");
354
+ const { runPentestAgent } = await import("./blackboxPentest-xtevpnvk.js");
355
+ const { sessions } = await import("./index-7etzc7sn.js");
356
+ const { config: appConfig } = await import("./index-c6x1x3cq.js");
357
+ const { getDefaultModelForConfig } = await import("./utils-9fhmzzzh.js");
358
358
  const target = getArgRequired("--target");
359
359
  const cwd = getArg("--cwd");
360
360
  const mode = getArg("--mode");
@@ -408,10 +408,10 @@ Report: ${reportPath}` : ""}`);
408
408
  async function runTargetedPentest() {
409
409
  const { config: config2 } = await import("./main-2483qzbq.js").then((m)=>__toESM(m.default,1));
410
410
  config2();
411
- const { runTargetedPentestAgent } = await import("./targetedPentest-w2c85whf.js");
412
- const { sessions } = await import("./index-vwvh1rdw.js");
413
- const { config: appConfig } = await import("./index-5ke2yd32.js");
414
- const { getDefaultModelForConfig } = await import("./utils-jky0th19.js");
411
+ const { runTargetedPentestAgent } = await import("./targetedPentest-5zyade2x.js");
412
+ const { sessions } = await import("./index-7etzc7sn.js");
413
+ const { config: appConfig } = await import("./index-c6x1x3cq.js");
414
+ const { getDefaultModelForConfig } = await import("./utils-9fhmzzzh.js");
415
415
  const target = getArgRequired("--target");
416
416
  const objectives = getAllArgs("--objective");
417
417
  const pensarConfig = await appConfig.get();
@@ -472,25 +472,25 @@ if (command === "version" || command === "--version" || command === "-v") {
472
472
  await runTargetedPentest();
473
473
  } else if (command === "auth") {
474
474
  process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
475
- await import("./auth-jvq72ekc.js");
475
+ await import("./auth-ynsrm9bf.js");
476
476
  } else if (command === "uninstall") {
477
477
  process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
478
- await import("./uninstall-2j0pymb0.js");
478
+ await import("./uninstall-s3r4kj3h.js");
479
479
  } else if (command === "projects") {
480
480
  process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
481
- await import("./projects-tr719twv.js");
481
+ await import("./projects-hkmq4y05.js");
482
482
  } else if (command === "pentests") {
483
483
  process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
484
- await import("./pentests-s9fwd71b.js");
484
+ await import("./pentests-8yxnj9kr.js");
485
485
  } else if (command === "issues") {
486
486
  process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
487
- await import("./issues-kx721wja.js");
487
+ await import("./issues-6dvz3xwg.js");
488
488
  } else if (command === "fixes") {
489
489
  process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
490
- await import("./fixes-1r6v7kh2.js");
490
+ await import("./fixes-8dt41pqr.js");
491
491
  } else if (command === "logs") {
492
492
  process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
493
- await import("./logs-hav7d0nm.js");
493
+ await import("./logs-21t24e4n.js");
494
494
  } else if (command === "doctor") {
495
495
  const { runDoctor } = await import("./doctor-b7612pzw.js");
496
496
  await runDoctor();
@@ -500,7 +500,7 @@ if (command === "version" || command === "--version" || command === "-v") {
500
500
  console.error("All other commands work with Node \u2014 run 'pensar --help'.");
501
501
  process.exit(1);
502
502
  }
503
- await import("./index-9ze42wn7.js");
503
+ await import("./index-42y4vj9f.js");
504
504
  } else {
505
505
  console.error(`Error: Unknown command '${command}'`);
506
506
  console.error();
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  getFix,
4
4
  listFixes
5
- } from "./cli-x1msjf55.js";
6
- import"./cli-bp6d08sg.js";
7
- import"./cli-jb0gcnrs.js";
8
- import"./cli-yj3dy0vg.js";
5
+ } from "./cli-rjfkex2j.js";
6
+ import"./cli-16m30n7b.js";
7
+ import"./cli-3tntsb59.js";
8
+ import"./cli-8q94bv77.js";
9
9
  import"./cli-8rxa073f.js";
10
10
 
11
11
  // src/cli/fixes.ts
@@ -8,11 +8,11 @@ import {
8
8
  readExecutionMetrics,
9
9
  runPentestWorkflow,
10
10
  writeExecutionMetrics
11
- } from "./cli-f9shhcxf.js";
12
- import"./cli-e20q3hqz.js";
13
- import"./cli-w04ggbe4.js";
14
- import"./cli-2ckm5es2.js";
15
- import"./cli-hmrzx8am.js";
11
+ } from "./cli-ee7y516a.js";
12
+ import"./cli-vzq3vcqa.js";
13
+ import"./cli-8yze7t68.js";
14
+ import"./cli-renwxhw7.js";
15
+ import"./cli-0atrar08.js";
16
16
  import"./cli-6gtnyaqf.js";
17
17
  import {
18
18
  ALL_TOOL_NAMES,
@@ -23,17 +23,17 @@ import {
23
23
  createInitialOperatorState,
24
24
  normalizeMessages,
25
25
  sessions
26
- } from "./cli-r8r90gka.js";
26
+ } from "./cli-khem6ept.js";
27
27
  import {
28
28
  createToolsetState,
29
29
  init_toolset,
30
30
  read,
31
31
  write
32
- } from "./cli-jh38b6zv.js";
32
+ } from "./cli-8sm33f4k.js";
33
33
  import {
34
34
  buildAuthConfig,
35
35
  stepCountIs
36
- } from "./cli-kqtgcdzn.js";
36
+ } from "./cli-5ekr1ws4.js";
37
37
  import {
38
38
  disconnect,
39
39
  fetchWorkspaces,
@@ -42,23 +42,23 @@ import {
42
42
  pollLegacyToken,
43
43
  pollWorkOSToken,
44
44
  selectWorkspace,
45
- startDeviceFlow
46
- } from "./cli-j66pect7.js";
45
+ startDeviceFlow,
46
+ validateGateway
47
+ } from "./cli-9tzcmrd4.js";
47
48
  import {
48
49
  config,
49
- ensureValidToken,
50
50
  getPensarApiUrl,
51
51
  getPensarConsoleUrl
52
- } from "./cli-bp6d08sg.js";
52
+ } from "./cli-16m30n7b.js";
53
53
  import {
54
54
  update
55
- } from "./cli-jb0gcnrs.js";
55
+ } from "./cli-3tntsb59.js";
56
56
  import {
57
57
  checkForUpdate
58
- } from "./cli-yj3dy0vg.js";
58
+ } from "./cli-8q94bv77.js";
59
59
  import {
60
60
  AVAILABLE_MODELS
61
- } from "./cli-15vxn9zj.js";
61
+ } from "./cli-0tpx8khk.js";
62
62
  import"./cli-7ckctq7a.js";
63
63
  import {
64
64
  __commonJS,
@@ -50346,6 +50346,7 @@ var commands = [
50346
50346
  name: "config",
50347
50347
  description: "Show config dialog",
50348
50348
  category: "General",
50349
+ hidden: true,
50349
50350
  handler: async (args, ctx4) => {
50350
50351
  ctx4.navigate({
50351
50352
  type: "base",
@@ -55543,6 +55544,7 @@ function AuthFlow({ onClose }) {
55543
55544
  const [selectedIndex, setSelectedIndex] = useState24(0);
55544
55545
  const [billingUrl, setBillingUrl] = useState24(null);
55545
55546
  const [balance, setBalance] = useState24(null);
55547
+ const [billingStatus, setBillingStatus] = useState24(null);
55546
55548
  const abortRef = useRef9(null);
55547
55549
  const connectedWorkspace = appConfig.data.workspaceSlug ? {
55548
55550
  name: appConfig.data.workspaceSlug,
@@ -55663,6 +55665,7 @@ function AuthFlow({ onClose }) {
55663
55665
  hasPaymentMethod: true
55664
55666
  } : null);
55665
55667
  setBalance(data.credits?.balance ?? null);
55668
+ setBillingStatus(null);
55666
55669
  setStep("success");
55667
55670
  } catch (err) {
55668
55671
  if (ac.signal.aborted)
@@ -55735,6 +55738,11 @@ function AuthFlow({ onClose }) {
55735
55738
  });
55736
55739
  appConfig.reload();
55737
55740
  setBalance(data.billing.balance);
55741
+ setBillingStatus({
55742
+ confirmed: data.confirmed,
55743
+ ready: data.billing.ready,
55744
+ hasPaymentMethod: data.billing.hasPaymentMethod
55745
+ });
55738
55746
  if (!data.confirmed && data.billingUrl) {
55739
55747
  setBillingUrl(data.billingUrl);
55740
55748
  }
@@ -55761,9 +55769,12 @@ function AuthFlow({ onClose }) {
55761
55769
  setSelectedWorkspace(null);
55762
55770
  setBalance(null);
55763
55771
  setBillingUrl(null);
55772
+ setBillingStatus(null);
55764
55773
  setStep("start");
55765
55774
  };
55766
55775
  const hasLowBalance = balance !== null && balance < 1;
55776
+ const needsBillingSetup = billingStatus !== null && !billingStatus.ready && (balance ?? 0) <= 0;
55777
+ const showBillingWarning = hasLowBalance || needsBillingSetup;
55767
55778
  const effectiveBillingUrl = billingUrl || (selectedWorkspace?.slug ? `${consoleUrlRef.current}/${selectedWorkspace.slug}/settings/billing` : connectedWorkspace?.slug ? `${consoleUrlRef.current}/${connectedWorkspace.slug}/settings/billing` : `${consoleUrlRef.current}/credits`);
55768
55779
  const openBillingPage = () => {
55769
55780
  openUrl(effectiveBillingUrl);
@@ -55808,7 +55819,7 @@ function AuthFlow({ onClose }) {
55808
55819
  }
55809
55820
  if (step === "success") {
55810
55821
  if (key.name === "return") {
55811
- if (hasLowBalance || billingUrl) {
55822
+ if (showBillingWarning) {
55812
55823
  openBillingPage();
55813
55824
  } else {
55814
55825
  goHome();
@@ -56106,15 +56117,15 @@ function AuthFlow({ onClose }) {
56106
56117
  }, undefined, true, undefined, this)
56107
56118
  ]
56108
56119
  }, undefined, true, undefined, this),
56109
- (hasLowBalance || billingUrl) && /* @__PURE__ */ jsxDEV29("box", {
56120
+ showBillingWarning && /* @__PURE__ */ jsxDEV29("box", {
56110
56121
  marginTop: 1,
56111
56122
  children: /* @__PURE__ */ jsxDEV29("text", {
56112
56123
  fg: colors2.warning,
56113
56124
  children: [
56114
- billingUrl ? "Your workspace needs credits to use Apex CLI." : "Your credit balance is very low. We recommend at least $30 to run",
56125
+ needsBillingSetup ? "Your workspace billing setup is not ready yet." : "Your credit balance is very low. We recommend at least $30 to run",
56115
56126
  `
56116
56127
  `,
56117
- billingUrl ? "Press ENTER to open billing and add credits." : "pentests without interruptions. Press ENTER to open billing."
56128
+ needsBillingSetup ? "Press ENTER to open billing and finish setup." : "pentests without interruptions. Press ENTER to open billing."
56118
56129
  ]
56119
56130
  }, undefined, true, undefined, this)
56120
56131
  }, undefined, false, undefined, this),
@@ -56141,7 +56152,7 @@ function AuthFlow({ onClose }) {
56141
56152
  children: "[ENTER]"
56142
56153
  }, undefined, false, undefined, this),
56143
56154
  " ",
56144
- hasLowBalance || billingUrl ? "Open billing" : "Done",
56155
+ showBillingWarning ? "Open billing" : "Done",
56145
56156
  " ·",
56146
56157
  " ",
56147
56158
  /* @__PURE__ */ jsxDEV29("span", {
@@ -56777,9 +56788,10 @@ function HelpDialog() {
56777
56788
  const [selectedIndex, setSelectedIndex] = useState26(0);
56778
56789
  const [showDetail, setShowDetail] = useState26(false);
56779
56790
  const scrollboxRef = useRef10(null);
56791
+ const visibleCommands = useMemo14(() => commands2.filter((cmd) => !cmd.hidden), [commands2]);
56780
56792
  const commandsByCategory = useMemo14(() => {
56781
56793
  const grouped = {};
56782
- for (const cmd of commands2) {
56794
+ for (const cmd of visibleCommands) {
56783
56795
  const category = cmd.category || "Other";
56784
56796
  if (!grouped[category]) {
56785
56797
  grouped[category] = [];
@@ -56787,10 +56799,10 @@ function HelpDialog() {
56787
56799
  grouped[category].push(cmd);
56788
56800
  }
56789
56801
  return grouped;
56790
- }, [commands2]);
56802
+ }, [visibleCommands]);
56791
56803
  const flatCommands = useMemo14(() => {
56792
- return commands2;
56793
- }, [commands2]);
56804
+ return visibleCommands;
56805
+ }, [visibleCommands]);
56794
56806
  useEffect16(() => {
56795
56807
  if (selectedIndex >= flatCommands.length) {
56796
56808
  setSelectedIndex(Math.max(0, flatCommands.length - 1));
@@ -57267,7 +57279,6 @@ import { useKeyboard as useKeyboard18 } from "@opentui/react";
57267
57279
  import { jsxDEV as jsxDEV37, Fragment as Fragment7 } from "@opentui/react/jsx-dev-runtime";
57268
57280
  function CreditsFlow({ onOpenAuthDialog }) {
57269
57281
  const route = useRoute();
57270
- const appConfig = useConfig();
57271
57282
  const [step, setStep] = useState27("loading");
57272
57283
  const [credits, setCredits] = useState27(null);
57273
57284
  const [error, setError] = useState27(null);
@@ -57290,38 +57301,13 @@ function CreditsFlow({ onOpenAuthDialog }) {
57290
57301
  setStep("browser-opened");
57291
57302
  };
57292
57303
  const fetchBalance = async () => {
57293
- const tokenResult = await ensureValidToken({
57294
- accessToken: appConfig.data.accessToken,
57295
- refreshToken: appConfig.data.refreshToken,
57296
- pensarAPIKey: appConfig.data.pensarAPIKey
57297
- });
57298
- if (!tokenResult) {
57299
- setStep("no-auth");
57300
- return;
57301
- }
57302
57304
  setStep("loading");
57303
57305
  setError(null);
57304
57306
  try {
57305
- const apiUrl = getPensarApiUrl();
57306
- const headers = {
57307
- Authorization: `Bearer ${tokenResult.token}`
57308
- };
57309
- if (tokenResult.type === "workos" && appConfig.data.workspaceId) {
57310
- headers["X-Workspace-Id"] = appConfig.data.workspaceId;
57311
- }
57312
- const response = await fetch(`${apiUrl}/gateway/validate`, {
57313
- method: "GET",
57314
- headers
57315
- });
57316
- if (!response.ok) {
57317
- throw new Error("Failed to fetch balance");
57318
- }
57319
- const result = await response.json();
57320
- if (result.signingKey || result.gatewayUrl) {
57321
- await config.update({
57322
- gatewaySigningKey: result.signingKey ?? undefined,
57323
- gatewayUrl: result.gatewayUrl ?? undefined
57324
- });
57307
+ const result = await validateGateway();
57308
+ if (!result) {
57309
+ setStep("no-auth");
57310
+ return;
57325
57311
  }
57326
57312
  setCredits({
57327
57313
  balance: result.credits.balance,
@@ -61826,7 +61812,6 @@ function Pentest({
61826
61812
  onTextDelta: (d2) => {
61827
61813
  if (!d2.subagentId)
61828
61814
  return;
61829
- setThinking(false);
61830
61815
  if (d2.subagentId === "attack-surface-agent") {
61831
61816
  appendPanelText(d2.subagentId, d2.text);
61832
61817
  } else {
@@ -61836,7 +61821,6 @@ function Pentest({
61836
61821
  onToolCallStreaming: (d2) => {
61837
61822
  if (!d2.subagentId)
61838
61823
  return;
61839
- setThinking(false);
61840
61824
  if (d2.subagentId === "attack-surface-agent") {
61841
61825
  addPanelStreamingToolCall(d2.toolCallId, d2.toolName);
61842
61826
  } else {
@@ -61855,7 +61839,6 @@ function Pentest({
61855
61839
  onToolCall: (d2) => {
61856
61840
  if (!d2.subagentId)
61857
61841
  return;
61858
- setThinking(false);
61859
61842
  if (d2.subagentId === "attack-surface-agent") {
61860
61843
  addPanelToolCall(d2.toolCallId, d2.toolName, d2.input);
61861
61844
  } else {
@@ -61865,7 +61848,6 @@ function Pentest({
61865
61848
  onToolResult: (d2) => {
61866
61849
  if (!d2.subagentId)
61867
61850
  return;
61868
- setThinking(true);
61869
61851
  if (d2.subagentId === "attack-surface-agent") {
61870
61852
  updatePanelToolResult(d2.toolCallId, d2.toolName, d2.output);
61871
61853
  } else {
@@ -17,18 +17,18 @@ import {
17
17
  update,
18
18
  write,
19
19
  writeRaw
20
- } from "./cli-jh38b6zv.js";
20
+ } from "./cli-8sm33f4k.js";
21
21
  import {
22
22
  init_zod,
23
23
  zod_default
24
- } from "./cli-kqtgcdzn.js";
25
- import"./cli-j66pect7.js";
26
- import"./cli-bp6d08sg.js";
27
- import"./cli-jb0gcnrs.js";
24
+ } from "./cli-5ekr1ws4.js";
25
+ import"./cli-9tzcmrd4.js";
26
+ import"./cli-16m30n7b.js";
27
+ import"./cli-3tntsb59.js";
28
28
  import {
29
29
  getCurrentVersion
30
- } from "./cli-yj3dy0vg.js";
31
- import"./cli-15vxn9zj.js";
30
+ } from "./cli-8q94bv77.js";
31
+ import"./cli-0tpx8khk.js";
32
32
  import"./cli-7ckctq7a.js";
33
33
  import {
34
34
  __require,