@pensar/apex 0.0.100 → 0.0.101
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/bin/pensar.js +16 -0
- package/build/auth.js +1 -1
- package/build/index.js +51 -37
- package/package.json +1 -1
package/bin/pensar.js
CHANGED
|
@@ -66,6 +66,13 @@ if (command === "benchmark") {
|
|
|
66
66
|
|
|
67
67
|
// Import and run auth
|
|
68
68
|
await import(authPath);
|
|
69
|
+
} else if (command === "uninstall") {
|
|
70
|
+
// Run uninstall CLI
|
|
71
|
+
const uninstallPath = join(__dirname, "..", "build", "uninstall.js");
|
|
72
|
+
|
|
73
|
+
process.argv = [process.argv[0], uninstallPath, ...args.slice(1)];
|
|
74
|
+
|
|
75
|
+
await import(uninstallPath);
|
|
69
76
|
} else if (command === "upgrade" || command === "update") {
|
|
70
77
|
const currentVersion = getCurrentVersion();
|
|
71
78
|
console.log(`Current version: v${currentVersion}`);
|
|
@@ -89,6 +96,7 @@ if (command === "benchmark") {
|
|
|
89
96
|
console.log();
|
|
90
97
|
console.log("Usage:");
|
|
91
98
|
console.log(" pensar Launch the TUI (Terminal User Interface)");
|
|
99
|
+
console.log(" pensar uninstall Uninstall Pensar (keeps sessions, memories, skills)");
|
|
92
100
|
console.log(" pensar upgrade Update pensar to the latest version");
|
|
93
101
|
console.log(" pensar help Show this help message");
|
|
94
102
|
console.log(" pensar version Show version number");
|
|
@@ -181,6 +189,14 @@ if (command === "benchmark") {
|
|
|
181
189
|
console.log(" pensar auth logout Disconnect from Pensar Console");
|
|
182
190
|
console.log(" pensar auth status Show connection status");
|
|
183
191
|
console.log();
|
|
192
|
+
console.log("Uninstall Usage:");
|
|
193
|
+
console.log(
|
|
194
|
+
" pensar uninstall Fully uninstall Pensar"
|
|
195
|
+
);
|
|
196
|
+
console.log(
|
|
197
|
+
" pensar uninstall --force Skip confirmation prompt"
|
|
198
|
+
);
|
|
199
|
+
console.log();
|
|
184
200
|
console.log("Header Modes (for quicktest, pentest, swarm):");
|
|
185
201
|
console.log(" none No custom headers added to requests");
|
|
186
202
|
console.log(
|
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.101",
|
|
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",
|
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.101",
|
|
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",
|
|
@@ -193797,6 +193797,19 @@ COMMON SEARCH PATTERNS:
|
|
|
193797
193797
|
execute: async ({ query }) => {
|
|
193798
193798
|
try {
|
|
193799
193799
|
const cfg = await config2.get();
|
|
193800
|
+
const apiUrl = getPensarApiUrl();
|
|
193801
|
+
const body = JSON.stringify({ query });
|
|
193802
|
+
if (cfg.pensarAPIKey && !cfg.accessToken) {
|
|
193803
|
+
const response2 = await fetch(`${apiUrl}/agents/web_search`, {
|
|
193804
|
+
method: "POST",
|
|
193805
|
+
headers: {
|
|
193806
|
+
"Content-Type": "application/json",
|
|
193807
|
+
"x-api-key": cfg.pensarAPIKey
|
|
193808
|
+
},
|
|
193809
|
+
body
|
|
193810
|
+
});
|
|
193811
|
+
return handleSearchResponse(response2);
|
|
193812
|
+
}
|
|
193800
193813
|
const tokenResult = await ensureValidToken({
|
|
193801
193814
|
accessToken: cfg.accessToken,
|
|
193802
193815
|
refreshToken: cfg.refreshToken,
|
|
@@ -193823,8 +193836,6 @@ COMMON SEARCH PATTERNS:
|
|
|
193823
193836
|
error: "Web search requires authentication. Please sign in again to your Pensar account."
|
|
193824
193837
|
};
|
|
193825
193838
|
}
|
|
193826
|
-
const apiUrl = getPensarApiUrl();
|
|
193827
|
-
const body = JSON.stringify({ query });
|
|
193828
193839
|
const { signature, timestamp, nonce } = signGatewayRequest(cfg.gatewaySigningKey, "web_search", body);
|
|
193829
193840
|
const response = await fetch(`${apiUrl}/agents/web_search`, {
|
|
193830
193841
|
method: "POST",
|
|
@@ -193838,40 +193849,7 @@ COMMON SEARCH PATTERNS:
|
|
|
193838
193849
|
},
|
|
193839
193850
|
body
|
|
193840
193851
|
});
|
|
193841
|
-
|
|
193842
|
-
if (response.status === 401) {
|
|
193843
|
-
return {
|
|
193844
|
-
success: false,
|
|
193845
|
-
results: [],
|
|
193846
|
-
error: "Authentication failed. Please sign in again to your Pensar account."
|
|
193847
|
-
};
|
|
193848
|
-
}
|
|
193849
|
-
if (response.status === 429) {
|
|
193850
|
-
return {
|
|
193851
|
-
success: false,
|
|
193852
|
-
results: [],
|
|
193853
|
-
error: "Rate limit exceeded. Please wait a moment before searching again."
|
|
193854
|
-
};
|
|
193855
|
-
}
|
|
193856
|
-
const errorText = await response.text().catch(() => "Unknown error");
|
|
193857
|
-
return {
|
|
193858
|
-
success: false,
|
|
193859
|
-
results: [],
|
|
193860
|
-
error: `Web search failed: ${response.status} ${response.statusText}. ${errorText}`
|
|
193861
|
-
};
|
|
193862
|
-
}
|
|
193863
|
-
const data = await response.json();
|
|
193864
|
-
if (data.error) {
|
|
193865
|
-
return {
|
|
193866
|
-
success: false,
|
|
193867
|
-
results: [],
|
|
193868
|
-
error: data.error
|
|
193869
|
-
};
|
|
193870
|
-
}
|
|
193871
|
-
return {
|
|
193872
|
-
success: true,
|
|
193873
|
-
results: data.results || []
|
|
193874
|
-
};
|
|
193852
|
+
return handleSearchResponse(response);
|
|
193875
193853
|
} catch (error40) {
|
|
193876
193854
|
const errorMsg = error40 instanceof Error ? error40.message : String(error40);
|
|
193877
193855
|
return {
|
|
@@ -193883,6 +193861,42 @@ COMMON SEARCH PATTERNS:
|
|
|
193883
193861
|
}
|
|
193884
193862
|
});
|
|
193885
193863
|
}
|
|
193864
|
+
async function handleSearchResponse(response) {
|
|
193865
|
+
if (!response.ok) {
|
|
193866
|
+
if (response.status === 401) {
|
|
193867
|
+
return {
|
|
193868
|
+
success: false,
|
|
193869
|
+
results: [],
|
|
193870
|
+
error: "Authentication failed. Please sign in again to your Pensar account."
|
|
193871
|
+
};
|
|
193872
|
+
}
|
|
193873
|
+
if (response.status === 429) {
|
|
193874
|
+
return {
|
|
193875
|
+
success: false,
|
|
193876
|
+
results: [],
|
|
193877
|
+
error: "Rate limit exceeded. Please wait a moment before searching again."
|
|
193878
|
+
};
|
|
193879
|
+
}
|
|
193880
|
+
const errorText = await response.text().catch(() => "Unknown error");
|
|
193881
|
+
return {
|
|
193882
|
+
success: false,
|
|
193883
|
+
results: [],
|
|
193884
|
+
error: `Web search failed: ${response.status} ${response.statusText}. ${errorText}`
|
|
193885
|
+
};
|
|
193886
|
+
}
|
|
193887
|
+
const data = await response.json();
|
|
193888
|
+
if (data.error) {
|
|
193889
|
+
return {
|
|
193890
|
+
success: false,
|
|
193891
|
+
results: [],
|
|
193892
|
+
error: data.error
|
|
193893
|
+
};
|
|
193894
|
+
}
|
|
193895
|
+
return {
|
|
193896
|
+
success: true,
|
|
193897
|
+
results: data.results || []
|
|
193898
|
+
};
|
|
193899
|
+
}
|
|
193886
193900
|
var webSearchInputSchema2;
|
|
193887
193901
|
var init_webSearch = __esm(() => {
|
|
193888
193902
|
init_dist5();
|