@pensar/apex 0.0.92 → 0.0.93
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/index.js +13 -17
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -31977,7 +31977,7 @@ var package_default2;
|
|
|
31977
31977
|
var init_package = __esm(() => {
|
|
31978
31978
|
package_default2 = {
|
|
31979
31979
|
name: "@pensar/apex",
|
|
31980
|
-
version: "0.0.
|
|
31980
|
+
version: "0.0.93",
|
|
31981
31981
|
description: "AI-powered penetration testing CLI tool with terminal UI",
|
|
31982
31982
|
module: "src/tui/index.tsx",
|
|
31983
31983
|
main: "build/index.js",
|
|
@@ -32171,7 +32171,6 @@ async function get() {
|
|
|
32171
32171
|
inceptionAPIKey: process.env.INCEPTION_API_KEY ?? parsedConfig.inceptionAPIKey,
|
|
32172
32172
|
bedrockAPIKey: process.env.BEDROCK_API_KEY ?? parsedConfig.bedrockAPIKey,
|
|
32173
32173
|
pensarAPIKey: process.env.PENSAR_API_KEY ?? parsedConfig.pensarAPIKey,
|
|
32174
|
-
pensarApiUrl: process.env.PENSAR_API_URL ?? parsedConfig.pensarApiUrl,
|
|
32175
32174
|
daytonaAPIKey: process.env.DAYTONA_API_KEY ?? parsedConfig.daytonaAPIKey,
|
|
32176
32175
|
daytonaOrgId: process.env.DAYTONA_ORG_ID ?? parsedConfig.daytonaOrgId,
|
|
32177
32176
|
runloopAPIKey: process.env.RUNLOOP_API_KEY ?? parsedConfig.runloopAPIKey
|
|
@@ -88136,13 +88135,13 @@ __export(exports_constants, {
|
|
|
88136
88135
|
PENSAR_CONSOLE_BASE_URL: () => PENSAR_CONSOLE_BASE_URL,
|
|
88137
88136
|
PENSAR_API_BASE_URL: () => PENSAR_API_BASE_URL
|
|
88138
88137
|
});
|
|
88139
|
-
function getPensarApiUrl(
|
|
88140
|
-
return
|
|
88138
|
+
function getPensarApiUrl() {
|
|
88139
|
+
return PENSAR_API_BASE_URL;
|
|
88141
88140
|
}
|
|
88142
88141
|
function getPensarConsoleUrl() {
|
|
88143
88142
|
return process.env.PENSAR_CONSOLE_URL || PENSAR_CONSOLE_BASE_URL;
|
|
88144
88143
|
}
|
|
88145
|
-
var PENSAR_API_BASE_URL = "https://api.
|
|
88144
|
+
var PENSAR_API_BASE_URL = "https://api.pensar.dev", PENSAR_CONSOLE_BASE_URL = "https://console.pensar.dev";
|
|
88146
88145
|
|
|
88147
88146
|
// src/core/config/index.ts
|
|
88148
88147
|
var config2;
|
|
@@ -88206,7 +88205,7 @@ async function ensureValidToken(cfg) {
|
|
|
88206
88205
|
return { token: cfg.accessToken, type: "workos" };
|
|
88207
88206
|
}
|
|
88208
88207
|
if (cfg.refreshToken) {
|
|
88209
|
-
const clientId = await fetchWorkOSClientId(
|
|
88208
|
+
const clientId = await fetchWorkOSClientId();
|
|
88210
88209
|
if (clientId) {
|
|
88211
88210
|
const newToken = await refreshAccessToken(clientId, cfg.refreshToken);
|
|
88212
88211
|
if (newToken) {
|
|
@@ -88220,12 +88219,12 @@ async function ensureValidToken(cfg) {
|
|
|
88220
88219
|
}
|
|
88221
88220
|
return null;
|
|
88222
88221
|
}
|
|
88223
|
-
async function fetchWorkOSClientId(
|
|
88222
|
+
async function fetchWorkOSClientId() {
|
|
88224
88223
|
if (cachedClientId)
|
|
88225
88224
|
return cachedClientId;
|
|
88226
88225
|
try {
|
|
88227
88226
|
const { getPensarApiUrl: getPensarApiUrl2 } = await Promise.resolve().then(() => exports_constants);
|
|
88228
|
-
const apiUrl = getPensarApiUrl2(
|
|
88227
|
+
const apiUrl = getPensarApiUrl2();
|
|
88229
88228
|
const response = await fetch(`${apiUrl}/api/cli/config`);
|
|
88230
88229
|
if (!response.ok)
|
|
88231
88230
|
return null;
|
|
@@ -88250,7 +88249,6 @@ function buildAuthConfig(cfg) {
|
|
|
88250
88249
|
openRouterAPIKey: cfg.openRouterAPIKey ?? undefined,
|
|
88251
88250
|
inceptionAPIKey: cfg.inceptionAPIKey ?? undefined,
|
|
88252
88251
|
pensarAPIKey: cfg.pensarAPIKey ?? undefined,
|
|
88253
|
-
pensarApiUrl: cfg.pensarApiUrl ?? undefined,
|
|
88254
88252
|
accessToken: cfg.accessToken ?? undefined,
|
|
88255
88253
|
refreshToken: cfg.refreshToken ?? undefined,
|
|
88256
88254
|
workspaceId: cfg.workspaceId ?? undefined,
|
|
@@ -88326,7 +88324,7 @@ function getProviderModel(model, authConfig) {
|
|
|
88326
88324
|
if (!pensarApiKey && !hasWorkOSAuth) {
|
|
88327
88325
|
throw new Error("Pensar not configured. Run /auth to connect to Pensar Console.");
|
|
88328
88326
|
}
|
|
88329
|
-
const pensarApiUrl =
|
|
88327
|
+
const pensarApiUrl = getPensarApiUrl();
|
|
88330
88328
|
const bedrockModelId = model.startsWith("pensar:") ? model.slice(7) : model;
|
|
88331
88329
|
if (process.env.PENSAR_DEBUG === "1" || process.env.PENSAR_DEBUG === "true") {
|
|
88332
88330
|
console.log(`[pensar] getProviderModel: ${model} → bedrock:${bedrockModelId} via ${pensarApiUrl}`);
|
|
@@ -88342,8 +88340,7 @@ function getProviderModel(model, authConfig) {
|
|
|
88342
88340
|
return ensureValidToken({
|
|
88343
88341
|
accessToken: freshConfig.accessToken,
|
|
88344
88342
|
refreshToken: freshConfig.refreshToken,
|
|
88345
|
-
pensarAPIKey: freshConfig.pensarAPIKey
|
|
88346
|
-
pensarApiUrl: freshConfig.pensarApiUrl
|
|
88343
|
+
pensarAPIKey: freshConfig.pensarAPIKey
|
|
88347
88344
|
});
|
|
88348
88345
|
};
|
|
88349
88346
|
}
|
|
@@ -279107,7 +279104,7 @@ function AuthFlow({ onClose }) {
|
|
|
279107
279104
|
setStep("requesting");
|
|
279108
279105
|
setError(null);
|
|
279109
279106
|
cancelledRef.current = false;
|
|
279110
|
-
const apiUrl = getPensarApiUrl(
|
|
279107
|
+
const apiUrl = getPensarApiUrl();
|
|
279111
279108
|
console.error(`[auth] apiUrl=${apiUrl}`);
|
|
279112
279109
|
try {
|
|
279113
279110
|
console.error(`[auth] fetching ${apiUrl}/api/cli/config`);
|
|
@@ -279377,7 +279374,7 @@ function AuthFlow({ onClose }) {
|
|
|
279377
279374
|
}
|
|
279378
279375
|
if (key.name === "return" && workspaces[selectedIndex]) {
|
|
279379
279376
|
const currentConfig = appConfig.data;
|
|
279380
|
-
const apiUrl = getPensarApiUrl(
|
|
279377
|
+
const apiUrl = getPensarApiUrl();
|
|
279381
279378
|
const accessToken = currentConfig.accessToken;
|
|
279382
279379
|
selectWorkspace(apiUrl, accessToken, workspaces[selectedIndex]);
|
|
279383
279380
|
}
|
|
@@ -279751,8 +279748,7 @@ function CreditsFlow({ onOpenAuthDialog }) {
|
|
|
279751
279748
|
const tokenResult = await ensureValidToken({
|
|
279752
279749
|
accessToken: appConfig.data.accessToken,
|
|
279753
279750
|
refreshToken: appConfig.data.refreshToken,
|
|
279754
|
-
pensarAPIKey: appConfig.data.pensarAPIKey
|
|
279755
|
-
pensarApiUrl: appConfig.data.pensarApiUrl
|
|
279751
|
+
pensarAPIKey: appConfig.data.pensarAPIKey
|
|
279756
279752
|
});
|
|
279757
279753
|
if (!tokenResult) {
|
|
279758
279754
|
setStep("no-auth");
|
|
@@ -279761,7 +279757,7 @@ function CreditsFlow({ onOpenAuthDialog }) {
|
|
|
279761
279757
|
setStep("loading");
|
|
279762
279758
|
setError(null);
|
|
279763
279759
|
try {
|
|
279764
|
-
const apiUrl = getPensarApiUrl(
|
|
279760
|
+
const apiUrl = getPensarApiUrl();
|
|
279765
279761
|
const headers = {
|
|
279766
279762
|
Authorization: `Bearer ${tokenResult.token}`
|
|
279767
279763
|
};
|