@pensar/apex 0.0.97 → 0.0.99-canary.ca4d9191
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.
- package/build/auth.js +12 -8
- package/build/index.js +27 -16
- package/package.json +1 -1
package/build/auth.js
CHANGED
|
@@ -8,7 +8,7 @@ import fs from "fs/promises";
|
|
|
8
8
|
// package.json
|
|
9
9
|
var package_default = {
|
|
10
10
|
name: "@pensar/apex",
|
|
11
|
-
version: "0.0.
|
|
11
|
+
version: "0.0.99-canary.ca4d9191",
|
|
12
12
|
description: "AI-powered penetration testing CLI tool with terminal UI",
|
|
13
13
|
module: "src/tui/index.tsx",
|
|
14
14
|
main: "build/index.js",
|
|
@@ -183,7 +183,7 @@ var config = {
|
|
|
183
183
|
var PENSAR_API_BASE_URL = "https://api.pensar.dev";
|
|
184
184
|
var PENSAR_CONSOLE_BASE_URL = "https://console.pensar.dev";
|
|
185
185
|
function getPensarApiUrl() {
|
|
186
|
-
return PENSAR_API_BASE_URL;
|
|
186
|
+
return process.env.PENSAR_API_URL || PENSAR_API_BASE_URL;
|
|
187
187
|
}
|
|
188
188
|
function getPensarConsoleUrl() {
|
|
189
189
|
return process.env.PENSAR_CONSOLE_URL || PENSAR_CONSOLE_BASE_URL;
|
|
@@ -198,7 +198,7 @@ var config2 = {
|
|
|
198
198
|
// src/core/api/constants.ts
|
|
199
199
|
var PENSAR_API_BASE_URL2 = "https://api.pensar.dev";
|
|
200
200
|
function getPensarApiUrl2() {
|
|
201
|
-
return PENSAR_API_BASE_URL2;
|
|
201
|
+
return process.env.PENSAR_API_URL || PENSAR_API_BASE_URL2;
|
|
202
202
|
}
|
|
203
203
|
// src/core/auth/device-flow.ts
|
|
204
204
|
function sleep(ms) {
|
|
@@ -323,7 +323,10 @@ async function fetchWorkspaces(apiUrl, accessToken) {
|
|
|
323
323
|
throw new Error(`Failed to fetch workspaces (${response.status})`);
|
|
324
324
|
}
|
|
325
325
|
const data = await response.json();
|
|
326
|
-
return
|
|
326
|
+
return {
|
|
327
|
+
workspaces: data.workspaces,
|
|
328
|
+
consoleUrl: data.consoleUrl
|
|
329
|
+
};
|
|
327
330
|
}
|
|
328
331
|
async function pollForWorkspaceCreation(apiUrl, accessToken, signal) {
|
|
329
332
|
const POLL_INTERVAL = 3000;
|
|
@@ -498,14 +501,15 @@ Authenticated successfully. Fetching workspaces...`);
|
|
|
498
501
|
}
|
|
499
502
|
}
|
|
500
503
|
async function handleWorkspaces(apiUrl, accessToken) {
|
|
501
|
-
|
|
504
|
+
const wsResult = await fetchWorkspaces(apiUrl, accessToken);
|
|
505
|
+
let workspaces = wsResult.workspaces;
|
|
506
|
+
const consoleUrl = wsResult.consoleUrl ?? getPensarConsoleUrl();
|
|
502
507
|
if (workspaces.length === 0) {
|
|
503
|
-
const consoleUrl = getPensarConsoleUrl();
|
|
504
508
|
console.log(`
|
|
505
509
|
No workspaces found. Opening browser to create one...`);
|
|
506
|
-
console.log(`If the browser didn't open, visit: ${consoleUrl}/credits
|
|
510
|
+
console.log(`If the browser didn't open, visit: ${consoleUrl}/create-workspace?redirect=/credits
|
|
507
511
|
`);
|
|
508
|
-
openUrl(`${consoleUrl}/credits`);
|
|
512
|
+
openUrl(`${consoleUrl}/create-workspace?redirect=/credits`);
|
|
509
513
|
console.log("Waiting for workspace creation...");
|
|
510
514
|
workspaces = await pollForWorkspaceCreation(apiUrl, accessToken);
|
|
511
515
|
}
|
package/build/index.js
CHANGED
|
@@ -31880,12 +31880,6 @@ var init_openrouter = __esm(() => {
|
|
|
31880
31880
|
var PENSAR_MODELS;
|
|
31881
31881
|
var init_pensar = __esm(() => {
|
|
31882
31882
|
PENSAR_MODELS = [
|
|
31883
|
-
{
|
|
31884
|
-
id: "pensar:anthropic.claude-opus-4-6-v1",
|
|
31885
|
-
name: "Claude Opus 4.6 (Pensar)",
|
|
31886
|
-
provider: "pensar",
|
|
31887
|
-
contextLength: 200000
|
|
31888
|
-
},
|
|
31889
31883
|
{
|
|
31890
31884
|
id: "pensar:anthropic.claude-sonnet-4-5-20250929-v1:0",
|
|
31891
31885
|
name: "Claude Sonnet 4.5 (Pensar)",
|
|
@@ -31977,7 +31971,7 @@ var package_default2;
|
|
|
31977
31971
|
var init_package = __esm(() => {
|
|
31978
31972
|
package_default2 = {
|
|
31979
31973
|
name: "@pensar/apex",
|
|
31980
|
-
version: "0.0.
|
|
31974
|
+
version: "0.0.99-canary.ca4d9191",
|
|
31981
31975
|
description: "AI-powered penetration testing CLI tool with terminal UI",
|
|
31982
31976
|
module: "src/tui/index.tsx",
|
|
31983
31977
|
main: "build/index.js",
|
|
@@ -88173,7 +88167,7 @@ var init_pensar2 = __esm(() => {
|
|
|
88173
88167
|
|
|
88174
88168
|
// src/core/api/constants.ts
|
|
88175
88169
|
function getPensarApiUrl() {
|
|
88176
|
-
return PENSAR_API_BASE_URL;
|
|
88170
|
+
return process.env.PENSAR_API_URL || PENSAR_API_BASE_URL;
|
|
88177
88171
|
}
|
|
88178
88172
|
function getPensarGatewayUrl() {
|
|
88179
88173
|
return process.env.PENSAR_GATEWAY_URL || PENSAR_GATEWAY_BASE_URL;
|
|
@@ -88404,7 +88398,10 @@ async function fetchWorkspaces(apiUrl, accessToken) {
|
|
|
88404
88398
|
throw new Error(`Failed to fetch workspaces (${response.status})`);
|
|
88405
88399
|
}
|
|
88406
88400
|
const data = await response.json();
|
|
88407
|
-
return
|
|
88401
|
+
return {
|
|
88402
|
+
workspaces: data.workspaces,
|
|
88403
|
+
consoleUrl: data.consoleUrl
|
|
88404
|
+
};
|
|
88408
88405
|
}
|
|
88409
88406
|
async function pollForWorkspaceCreation(apiUrl, accessToken, signal) {
|
|
88410
88407
|
const POLL_INTERVAL = 3000;
|
|
@@ -278734,6 +278731,7 @@ function AuthFlow({ onClose }) {
|
|
|
278734
278731
|
}
|
|
278735
278732
|
} catch {}
|
|
278736
278733
|
};
|
|
278734
|
+
const consoleUrlRef = import_react48.useRef(getPensarConsoleUrl());
|
|
278737
278735
|
const startFlow = async () => {
|
|
278738
278736
|
setStep("requesting");
|
|
278739
278737
|
setError(null);
|
|
@@ -278742,6 +278740,15 @@ function AuthFlow({ onClose }) {
|
|
|
278742
278740
|
abortRef.current = ac;
|
|
278743
278741
|
const apiUrl = getPensarApiUrl();
|
|
278744
278742
|
try {
|
|
278743
|
+
try {
|
|
278744
|
+
const configResponse = await fetch(`${apiUrl}/api/cli/config`);
|
|
278745
|
+
if (configResponse.ok) {
|
|
278746
|
+
const cliConfig = await configResponse.json();
|
|
278747
|
+
if (cliConfig.consoleUrl) {
|
|
278748
|
+
consoleUrlRef.current = cliConfig.consoleUrl;
|
|
278749
|
+
}
|
|
278750
|
+
}
|
|
278751
|
+
} catch {}
|
|
278745
278752
|
const info = await startDeviceFlow(apiUrl);
|
|
278746
278753
|
if (ac.signal.aborted)
|
|
278747
278754
|
return;
|
|
@@ -278827,12 +278834,16 @@ function AuthFlow({ onClose }) {
|
|
|
278827
278834
|
};
|
|
278828
278835
|
const handleFetchWorkspaces = async (apiUrl, accessToken, ac) => {
|
|
278829
278836
|
try {
|
|
278830
|
-
const
|
|
278837
|
+
const wsResult = await fetchWorkspaces(apiUrl, accessToken);
|
|
278831
278838
|
if (ac.signal.aborted)
|
|
278832
278839
|
return;
|
|
278840
|
+
if (wsResult.consoleUrl) {
|
|
278841
|
+
consoleUrlRef.current = wsResult.consoleUrl;
|
|
278842
|
+
}
|
|
278843
|
+
const ws = wsResult.workspaces;
|
|
278833
278844
|
if (ws.length === 0) {
|
|
278834
|
-
const consoleUrl =
|
|
278835
|
-
openUrl(`${consoleUrl}/credits`);
|
|
278845
|
+
const consoleUrl = consoleUrlRef.current;
|
|
278846
|
+
openUrl(`${consoleUrl}/create-workspace?redirect=/credits`);
|
|
278836
278847
|
setStep("creating-workspace");
|
|
278837
278848
|
handleWorkspaceCreationPoll(apiUrl, accessToken, ac);
|
|
278838
278849
|
return;
|
|
@@ -278906,7 +278917,7 @@ function AuthFlow({ onClose }) {
|
|
|
278906
278917
|
setStep("start");
|
|
278907
278918
|
};
|
|
278908
278919
|
const hasLowBalance = balance !== null && balance < 1;
|
|
278909
|
-
const effectiveBillingUrl = billingUrl || (selectedWorkspace?.slug ? `${
|
|
278920
|
+
const effectiveBillingUrl = billingUrl || (selectedWorkspace?.slug ? `${consoleUrlRef.current}/${selectedWorkspace.slug}/settings/billing` : connectedWorkspace?.slug ? `${consoleUrlRef.current}/${connectedWorkspace.slug}/settings/billing` : `${consoleUrlRef.current}/credits`);
|
|
278910
278921
|
const openBillingPage = () => {
|
|
278911
278922
|
openUrl(effectiveBillingUrl);
|
|
278912
278923
|
goHome();
|
|
@@ -279154,7 +279165,7 @@ function AuthFlow({ onClose }) {
|
|
|
279154
279165
|
marginTop: 1,
|
|
279155
279166
|
children: /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("text", {
|
|
279156
279167
|
fg: colors2.text,
|
|
279157
|
-
children: "Create a workspace
|
|
279168
|
+
children: "Create a workspace in your browser to get started."
|
|
279158
279169
|
}, undefined, false, undefined, this)
|
|
279159
279170
|
}, undefined, false, undefined, this),
|
|
279160
279171
|
/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
|
|
@@ -279172,8 +279183,8 @@ function AuthFlow({ onClose }) {
|
|
|
279172
279183
|
"If the browser didn't open, visit:",
|
|
279173
279184
|
`
|
|
279174
279185
|
`,
|
|
279175
|
-
|
|
279176
|
-
"/
|
|
279186
|
+
consoleUrlRef.current,
|
|
279187
|
+
"/create-workspace"
|
|
279177
279188
|
]
|
|
279178
279189
|
}, undefined, true, undefined, this)
|
|
279179
279190
|
}, undefined, false, undefined, this),
|