@node9/proxy 2.12.0 → 2.13.0
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/dist/cli.js +25 -2
- package/dist/cli.mjs +25 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -20607,13 +20607,36 @@ function isPolicyStale(nowMs = Date.now(), health) {
|
|
|
20607
20607
|
if (Number.isNaN(last)) return false;
|
|
20608
20608
|
return nowMs - last > stalenessThresholdMs(effectiveSyncIntervalMs());
|
|
20609
20609
|
}
|
|
20610
|
-
function
|
|
20611
|
-
|
|
20610
|
+
function safeNode9Version() {
|
|
20611
|
+
let dir = __dirname;
|
|
20612
|
+
for (let up = 0; up < 5; up++) {
|
|
20613
|
+
try {
|
|
20614
|
+
const pkg = JSON.parse(import_fs38.default.readFileSync(import_path37.default.join(dir, "package.json"), "utf-8"));
|
|
20615
|
+
if (pkg.name === "@node9/proxy" || pkg.name === "node9-ai") {
|
|
20616
|
+
return pkg.version;
|
|
20617
|
+
}
|
|
20618
|
+
} catch {
|
|
20619
|
+
}
|
|
20620
|
+
const parent = import_path37.default.dirname(dir);
|
|
20621
|
+
if (parent === dir) break;
|
|
20622
|
+
dir = parent;
|
|
20623
|
+
}
|
|
20624
|
+
return void 0;
|
|
20625
|
+
}
|
|
20626
|
+
function buildPolicyPullHeaders(apiKey, ifNoneMatch, proxyVersion) {
|
|
20612
20627
|
const headers = {
|
|
20613
20628
|
Authorization: `Bearer ${apiKey}`,
|
|
20614
20629
|
"Content-Type": "application/json"
|
|
20615
20630
|
};
|
|
20616
20631
|
if (ifNoneMatch) headers["If-None-Match"] = `"${ifNoneMatch}"`;
|
|
20632
|
+
if (proxyVersion && proxyVersion !== "unknown") {
|
|
20633
|
+
headers["X-Node9-Version"] = proxyVersion;
|
|
20634
|
+
}
|
|
20635
|
+
return headers;
|
|
20636
|
+
}
|
|
20637
|
+
function fetchCloudPolicy(apiKey, apiUrl, ifNoneMatch) {
|
|
20638
|
+
const parsed = new URL(apiUrl);
|
|
20639
|
+
const headers = buildPolicyPullHeaders(apiKey, ifNoneMatch, safeNode9Version());
|
|
20617
20640
|
return new Promise((resolve2, reject) => {
|
|
20618
20641
|
const req = import_https4.default.request(
|
|
20619
20642
|
{
|
package/dist/cli.mjs
CHANGED
|
@@ -20604,13 +20604,36 @@ function isPolicyStale(nowMs = Date.now(), health) {
|
|
|
20604
20604
|
if (Number.isNaN(last)) return false;
|
|
20605
20605
|
return nowMs - last > stalenessThresholdMs(effectiveSyncIntervalMs());
|
|
20606
20606
|
}
|
|
20607
|
-
function
|
|
20608
|
-
|
|
20607
|
+
function safeNode9Version() {
|
|
20608
|
+
let dir = __dirname;
|
|
20609
|
+
for (let up = 0; up < 5; up++) {
|
|
20610
|
+
try {
|
|
20611
|
+
const pkg = JSON.parse(fs41.readFileSync(path40.join(dir, "package.json"), "utf-8"));
|
|
20612
|
+
if (pkg.name === "@node9/proxy" || pkg.name === "node9-ai") {
|
|
20613
|
+
return pkg.version;
|
|
20614
|
+
}
|
|
20615
|
+
} catch {
|
|
20616
|
+
}
|
|
20617
|
+
const parent = path40.dirname(dir);
|
|
20618
|
+
if (parent === dir) break;
|
|
20619
|
+
dir = parent;
|
|
20620
|
+
}
|
|
20621
|
+
return void 0;
|
|
20622
|
+
}
|
|
20623
|
+
function buildPolicyPullHeaders(apiKey, ifNoneMatch, proxyVersion) {
|
|
20609
20624
|
const headers = {
|
|
20610
20625
|
Authorization: `Bearer ${apiKey}`,
|
|
20611
20626
|
"Content-Type": "application/json"
|
|
20612
20627
|
};
|
|
20613
20628
|
if (ifNoneMatch) headers["If-None-Match"] = `"${ifNoneMatch}"`;
|
|
20629
|
+
if (proxyVersion && proxyVersion !== "unknown") {
|
|
20630
|
+
headers["X-Node9-Version"] = proxyVersion;
|
|
20631
|
+
}
|
|
20632
|
+
return headers;
|
|
20633
|
+
}
|
|
20634
|
+
function fetchCloudPolicy(apiKey, apiUrl, ifNoneMatch) {
|
|
20635
|
+
const parsed = new URL(apiUrl);
|
|
20636
|
+
const headers = buildPolicyPullHeaders(apiKey, ifNoneMatch, safeNode9Version());
|
|
20614
20637
|
return new Promise((resolve2, reject) => {
|
|
20615
20638
|
const req = https4.request(
|
|
20616
20639
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node9/proxy",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"description": "The Sudo Command for AI Agents. Execution Security for Claude Code, Codex, Gemini, Cursor, Opencode, Pi, and any MCP server.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|