@nervekit/desktop 0.40.0 → 0.40.1
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/THIRD-PARTY-LICENSES.txt +5087 -463
- package/dist/{chunk-D5WJKB4R.js → chunk-24GQ74HM.js} +1 -0
- package/dist/{chunk-ET5RYBGZ.js → chunk-3DGBM7UW.js} +1 -1
- package/dist/{chunk-5UT23MT6.js → chunk-4MMJDHFX.js} +3 -3
- package/dist/{chunk-RWLLVZ7I.js → chunk-55OGZFNA.js} +1 -1
- package/dist/{chunk-BPOIFVQO.js → chunk-AJGPULMX.js} +2543 -124
- package/dist/{chunk-PUM6UCBT.js → chunk-CKVFGRVV.js} +4 -4
- package/dist/{chunk-GCSWN326.js → chunk-CWHAK2HX.js} +3 -3
- package/dist/{chunk-V7EAFXAX.js → chunk-D7WIIZAV.js} +4 -4
- package/dist/chunk-EJM4HMEL.js +45 -0
- package/dist/{chunk-4ZNLXHTH.js → chunk-FOFVPPPV.js} +4 -4
- package/dist/{chunk-UN3GLM4U.js → chunk-H5UKINTD.js} +2 -2
- package/dist/{chunk-LPCHTKEK.js → chunk-I6NVW4NX.js} +8 -133
- package/dist/chunk-JCF3ZRP4.js +481 -0
- package/dist/chunk-KAZFF2RD.js +22804 -0
- package/dist/{chunk-LZRPWVVJ.js → chunk-KIGB3FK6.js} +3 -3
- package/dist/{chunk-JDI4D5EM.js → chunk-KQPEOUCA.js} +4 -4
- package/dist/chunk-M7WTH5K5.js +822 -0
- package/dist/chunk-MH3SUHI2.js +135 -0
- package/dist/{chunk-5R3UAHXF.js → chunk-N5B2RRSS.js} +2 -1
- package/dist/{chunk-P2GSKP6N.js → chunk-ONWQH2W6.js} +4 -4
- package/dist/{chunk-Q7LPOIKN.js → chunk-OQC3F6JA.js} +3 -471
- package/dist/{chunk-H4CDZRIE.js → chunk-OY6PIAR7.js} +2 -2
- package/dist/{chunk-HHUSIAK3.js → chunk-QFXKQNMT.js} +4 -4
- package/dist/{chunk-U4DBQKHO.js → chunk-QWTKCUIZ.js} +1 -1
- package/dist/{chunk-RU6S57LK.js → chunk-TJR6ASRW.js} +4 -4
- package/dist/{chunk-YA2WJRUO.js → chunk-TW6FURZ7.js} +2 -2
- package/dist/{chunk-7FI3LC3O.js → chunk-V53CETNZ.js} +3 -3
- package/dist/{chunk-NSA42OOT.js → chunk-WXRYBXYR.js} +1 -1
- package/dist/{chunk-WTHP3VH6.js → chunk-XBHEYY65.js} +1 -1
- package/dist/chunk-YYLKI74V.js +8778 -0
- package/dist/daemon.js +5 -5
- package/dist/main.js +4 -4
- package/dist/worker.js +4 -4
- package/package.json +7 -7
- /package/dist/{chunk-PUM6UCBT.js.LEGAL.txt → chunk-CKVFGRVV.js.LEGAL.txt} +0 -0
- /package/dist/{chunk-YA2WJRUO.js.LEGAL.txt → chunk-TW6FURZ7.js.LEGAL.txt} +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { createRequire as __nerveCreateRequire } from "node:module";
|
|
2
|
+
const require = __nerveCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
getProviderEnvValue
|
|
5
|
+
} from "./chunk-FESN7DND.js";
|
|
6
|
+
|
|
7
|
+
// node_modules/.pnpm/@earendil-works+pi-ai@1.4.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js
|
|
8
|
+
var DEFAULT_PROXY_PORTS = {
|
|
9
|
+
ftp: 21,
|
|
10
|
+
gopher: 70,
|
|
11
|
+
http: 80,
|
|
12
|
+
https: 443,
|
|
13
|
+
ws: 80,
|
|
14
|
+
wss: 443
|
|
15
|
+
};
|
|
16
|
+
function getProxyEnv(key, env) {
|
|
17
|
+
const lowercaseKey = key.toLowerCase();
|
|
18
|
+
const uppercaseKey = key.toUpperCase();
|
|
19
|
+
return env?.[lowercaseKey] || env?.[uppercaseKey] || getProviderEnvValue(lowercaseKey) || getProviderEnvValue(uppercaseKey) || "";
|
|
20
|
+
}
|
|
21
|
+
function parseProxyTargetUrl(targetUrl) {
|
|
22
|
+
if (targetUrl instanceof URL) {
|
|
23
|
+
return targetUrl;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
return new URL(targetUrl);
|
|
27
|
+
} catch {
|
|
28
|
+
return void 0;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function stripBrackets(host) {
|
|
32
|
+
return host.startsWith("[") && host.endsWith("]") ? host.slice(1, -1) : host;
|
|
33
|
+
}
|
|
34
|
+
function parseNoProxyEntry(entry) {
|
|
35
|
+
const trimmed = entry.trim().toLowerCase();
|
|
36
|
+
if (!trimmed)
|
|
37
|
+
return void 0;
|
|
38
|
+
if (trimmed.startsWith("[")) {
|
|
39
|
+
const closingBracket = trimmed.indexOf("]");
|
|
40
|
+
if (closingBracket !== -1) {
|
|
41
|
+
const host = trimmed.slice(1, closingBracket);
|
|
42
|
+
const rest = trimmed.slice(closingBracket + 1);
|
|
43
|
+
if (rest.startsWith(":")) {
|
|
44
|
+
const port = Number.parseInt(rest.slice(1), 10);
|
|
45
|
+
return { host, port: Number.isNaN(port) ? 0 : port };
|
|
46
|
+
}
|
|
47
|
+
return { host, port: 0 };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (trimmed.includes(":") && trimmed.split(":").length > 2) {
|
|
51
|
+
return { host: trimmed, port: 0 };
|
|
52
|
+
}
|
|
53
|
+
const colonIndex = trimmed.lastIndexOf(":");
|
|
54
|
+
if (colonIndex !== -1 && colonIndex === trimmed.indexOf(":")) {
|
|
55
|
+
const host = trimmed.slice(0, colonIndex);
|
|
56
|
+
const port = Number.parseInt(trimmed.slice(colonIndex + 1), 10);
|
|
57
|
+
if (!Number.isNaN(port)) {
|
|
58
|
+
return { host, port };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return { host: trimmed, port: 0 };
|
|
62
|
+
}
|
|
63
|
+
function shouldProxyHostname(hostname, port, env) {
|
|
64
|
+
const noProxy = getProxyEnv("no_proxy", env).toLowerCase();
|
|
65
|
+
if (!noProxy) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
if (noProxy === "*") {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
const normalizedTargetHost = stripBrackets(hostname.toLowerCase());
|
|
72
|
+
return noProxy.split(/[,\s]/).every((entry) => {
|
|
73
|
+
const parsed = parseNoProxyEntry(entry);
|
|
74
|
+
if (!parsed) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
if (parsed.port && parsed.port !== port) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
let domain = stripBrackets(parsed.host);
|
|
81
|
+
if (domain.startsWith("*.")) {
|
|
82
|
+
domain = domain.slice(2);
|
|
83
|
+
} else if (domain.startsWith(".") || domain.startsWith("*")) {
|
|
84
|
+
domain = domain.slice(1);
|
|
85
|
+
}
|
|
86
|
+
if (!domain) {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
if (normalizedTargetHost === domain) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
if (normalizedTargetHost.endsWith(`.${domain}`)) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
return true;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function getProxyForUrl(targetUrl, env) {
|
|
99
|
+
const parsedUrl = parseProxyTargetUrl(targetUrl);
|
|
100
|
+
if (!parsedUrl?.protocol || !parsedUrl.host) {
|
|
101
|
+
return "";
|
|
102
|
+
}
|
|
103
|
+
const protocol = parsedUrl.protocol.split(":", 1)[0];
|
|
104
|
+
const hostname = stripBrackets(parsedUrl.hostname || parsedUrl.host.replace(/:\d*$/, ""));
|
|
105
|
+
const port = Number.parseInt(parsedUrl.port, 10) || DEFAULT_PROXY_PORTS[protocol] || 0;
|
|
106
|
+
if (!shouldProxyHostname(hostname, port, env)) {
|
|
107
|
+
return "";
|
|
108
|
+
}
|
|
109
|
+
let proxy = getProxyEnv(`${protocol}_proxy`, env) || getProxyEnv("all_proxy", env);
|
|
110
|
+
if (proxy && !proxy.includes("://")) {
|
|
111
|
+
proxy = `${protocol}://${proxy}`;
|
|
112
|
+
}
|
|
113
|
+
return proxy;
|
|
114
|
+
}
|
|
115
|
+
var UNSUPPORTED_PROXY_PROTOCOL_MESSAGE = "Unsupported proxy protocol. SOCKS and PAC proxy URLs are not supported; use an HTTP or HTTPS proxy URL.";
|
|
116
|
+
function resolveHttpProxyUrlForTarget(targetUrl, env) {
|
|
117
|
+
const proxy = getProxyForUrl(targetUrl, env);
|
|
118
|
+
if (!proxy) {
|
|
119
|
+
return void 0;
|
|
120
|
+
}
|
|
121
|
+
let proxyUrl;
|
|
122
|
+
try {
|
|
123
|
+
proxyUrl = new URL(proxy);
|
|
124
|
+
} catch (error) {
|
|
125
|
+
throw new Error(`Invalid proxy URL ${JSON.stringify(proxy)}: ${error instanceof Error ? error.message : String(error)}`);
|
|
126
|
+
}
|
|
127
|
+
if (proxyUrl.protocol !== "http:" && proxyUrl.protocol !== "https:") {
|
|
128
|
+
throw new Error(`${UNSUPPORTED_PROXY_PROTOCOL_MESSAGE} Got ${proxyUrl.protocol}`);
|
|
129
|
+
}
|
|
130
|
+
return proxyUrl;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export {
|
|
134
|
+
resolveHttpProxyUrlForTarget
|
|
135
|
+
};
|
|
@@ -3,7 +3,7 @@ const require = __nerveCreateRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
clampThinkingLevel,
|
|
5
5
|
getSystemMessageText
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WXRYBXYR.js";
|
|
7
7
|
|
|
8
8
|
// node_modules/.pnpm/@earendil-works+pi-ai@1.4.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.js
|
|
9
9
|
var UnsupportedStrictJsonSchemaError = class extends Error {
|
|
@@ -561,6 +561,7 @@ export {
|
|
|
561
561
|
clampMaxTokensToContext,
|
|
562
562
|
resolveSamplingParams,
|
|
563
563
|
buildBaseOptions,
|
|
564
|
+
clampReasoning,
|
|
564
565
|
thinkingBudgetForLevel,
|
|
565
566
|
clampThinkingBudgetToAnswerRoom,
|
|
566
567
|
adjustMaxTokensForThinking,
|
|
@@ -16,11 +16,11 @@ import {
|
|
|
16
16
|
toGoogleSdkThinkingLevel,
|
|
17
17
|
toGoogleThinkingLevel,
|
|
18
18
|
usesGoogleThinkingLevel
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-CKVFGRVV.js";
|
|
20
20
|
import "./chunk-MXYQOFZ5.js";
|
|
21
21
|
import {
|
|
22
22
|
buildBaseOptions
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-N5B2RRSS.js";
|
|
24
24
|
import {
|
|
25
25
|
sanitizeSurrogates
|
|
26
26
|
} from "./chunk-2Z5FLMLE.js";
|
|
@@ -42,13 +42,13 @@ import {
|
|
|
42
42
|
getCurrentTools,
|
|
43
43
|
getInitialSystemMessage,
|
|
44
44
|
getSystemMessageText
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-WXRYBXYR.js";
|
|
46
46
|
import {
|
|
47
47
|
AssistantMessageEventStream
|
|
48
48
|
} from "./chunk-MN7PZ2PH.js";
|
|
49
49
|
import {
|
|
50
50
|
getIdentityHeaders
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-24GQ74HM.js";
|
|
52
52
|
import "./chunk-CWESUMYQ.js";
|
|
53
53
|
|
|
54
54
|
// node_modules/.pnpm/@earendil-works+pi-ai@1.4.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js
|
|
@@ -768,474 +768,6 @@ var require_src = __commonJS({
|
|
|
768
768
|
}
|
|
769
769
|
});
|
|
770
770
|
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
"use strict";
|
|
775
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
776
|
-
if (k2 === void 0) k2 = k;
|
|
777
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
778
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
779
|
-
desc = { enumerable: true, get: function() {
|
|
780
|
-
return m[k];
|
|
781
|
-
} };
|
|
782
|
-
}
|
|
783
|
-
Object.defineProperty(o, k2, desc);
|
|
784
|
-
}) : (function(o, m, k, k2) {
|
|
785
|
-
if (k2 === void 0) k2 = k;
|
|
786
|
-
o[k2] = m[k];
|
|
787
|
-
}));
|
|
788
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
789
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
790
|
-
}) : function(o, v) {
|
|
791
|
-
o["default"] = v;
|
|
792
|
-
});
|
|
793
|
-
var __importStar = exports && exports.__importStar || function(mod) {
|
|
794
|
-
if (mod && mod.__esModule) return mod;
|
|
795
|
-
var result = {};
|
|
796
|
-
if (mod != null) {
|
|
797
|
-
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
798
|
-
}
|
|
799
|
-
__setModuleDefault(result, mod);
|
|
800
|
-
return result;
|
|
801
|
-
};
|
|
802
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
803
|
-
exports.req = exports.json = exports.toBuffer = void 0;
|
|
804
|
-
var http = __importStar(__require("http"));
|
|
805
|
-
var https = __importStar(__require("https"));
|
|
806
|
-
async function toBuffer(stream) {
|
|
807
|
-
let length = 0;
|
|
808
|
-
const chunks = [];
|
|
809
|
-
for await (const chunk of stream) {
|
|
810
|
-
length += chunk.length;
|
|
811
|
-
chunks.push(chunk);
|
|
812
|
-
}
|
|
813
|
-
return Buffer.concat(chunks, length);
|
|
814
|
-
}
|
|
815
|
-
exports.toBuffer = toBuffer;
|
|
816
|
-
async function json(stream) {
|
|
817
|
-
const buf = await toBuffer(stream);
|
|
818
|
-
const str = buf.toString("utf8");
|
|
819
|
-
try {
|
|
820
|
-
return JSON.parse(str);
|
|
821
|
-
} catch (_err) {
|
|
822
|
-
const err = _err;
|
|
823
|
-
err.message += ` (input: ${str})`;
|
|
824
|
-
throw err;
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
exports.json = json;
|
|
828
|
-
function req(url, opts = {}) {
|
|
829
|
-
const href = typeof url === "string" ? url : url.href;
|
|
830
|
-
const req2 = (href.startsWith("https:") ? https : http).request(url, opts);
|
|
831
|
-
const promise = new Promise((resolve, reject) => {
|
|
832
|
-
req2.once("response", resolve).once("error", reject).end();
|
|
833
|
-
});
|
|
834
|
-
req2.then = promise.then.bind(promise);
|
|
835
|
-
return req2;
|
|
836
|
-
}
|
|
837
|
-
exports.req = req;
|
|
838
|
-
}
|
|
839
|
-
});
|
|
840
|
-
|
|
841
|
-
// node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/index.js
|
|
842
|
-
var require_dist = __commonJS({
|
|
843
|
-
"node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/index.js"(exports) {
|
|
844
|
-
"use strict";
|
|
845
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
846
|
-
if (k2 === void 0) k2 = k;
|
|
847
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
848
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
849
|
-
desc = { enumerable: true, get: function() {
|
|
850
|
-
return m[k];
|
|
851
|
-
} };
|
|
852
|
-
}
|
|
853
|
-
Object.defineProperty(o, k2, desc);
|
|
854
|
-
}) : (function(o, m, k, k2) {
|
|
855
|
-
if (k2 === void 0) k2 = k;
|
|
856
|
-
o[k2] = m[k];
|
|
857
|
-
}));
|
|
858
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
859
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
860
|
-
}) : function(o, v) {
|
|
861
|
-
o["default"] = v;
|
|
862
|
-
});
|
|
863
|
-
var __importStar = exports && exports.__importStar || function(mod) {
|
|
864
|
-
if (mod && mod.__esModule) return mod;
|
|
865
|
-
var result = {};
|
|
866
|
-
if (mod != null) {
|
|
867
|
-
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
868
|
-
}
|
|
869
|
-
__setModuleDefault(result, mod);
|
|
870
|
-
return result;
|
|
871
|
-
};
|
|
872
|
-
var __exportStar = exports && exports.__exportStar || function(m, exports2) {
|
|
873
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
|
|
874
|
-
};
|
|
875
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
876
|
-
exports.Agent = void 0;
|
|
877
|
-
var net = __importStar(__require("net"));
|
|
878
|
-
var http = __importStar(__require("http"));
|
|
879
|
-
var https_1 = __require("https");
|
|
880
|
-
__exportStar(require_helpers(), exports);
|
|
881
|
-
var INTERNAL = /* @__PURE__ */ Symbol("AgentBaseInternalState");
|
|
882
|
-
var Agent = class extends http.Agent {
|
|
883
|
-
constructor(opts) {
|
|
884
|
-
super(opts);
|
|
885
|
-
this[INTERNAL] = {};
|
|
886
|
-
}
|
|
887
|
-
/**
|
|
888
|
-
* Determine whether this is an `http` or `https` request.
|
|
889
|
-
*/
|
|
890
|
-
isSecureEndpoint(options) {
|
|
891
|
-
if (options) {
|
|
892
|
-
if (typeof options.secureEndpoint === "boolean") {
|
|
893
|
-
return options.secureEndpoint;
|
|
894
|
-
}
|
|
895
|
-
if (typeof options.protocol === "string") {
|
|
896
|
-
return options.protocol === "https:";
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
const { stack } = new Error();
|
|
900
|
-
if (typeof stack !== "string")
|
|
901
|
-
return false;
|
|
902
|
-
return stack.split("\n").some((l) => l.indexOf("(https.js:") !== -1 || l.indexOf("node:https:") !== -1);
|
|
903
|
-
}
|
|
904
|
-
// In order to support async signatures in `connect()` and Node's native
|
|
905
|
-
// connection pooling in `http.Agent`, the array of sockets for each origin
|
|
906
|
-
// has to be updated synchronously. This is so the length of the array is
|
|
907
|
-
// accurate when `addRequest()` is next called. We achieve this by creating a
|
|
908
|
-
// fake socket and adding it to `sockets[origin]` and incrementing
|
|
909
|
-
// `totalSocketCount`.
|
|
910
|
-
incrementSockets(name) {
|
|
911
|
-
if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) {
|
|
912
|
-
return null;
|
|
913
|
-
}
|
|
914
|
-
if (!this.sockets[name]) {
|
|
915
|
-
this.sockets[name] = [];
|
|
916
|
-
}
|
|
917
|
-
const fakeSocket = new net.Socket({ writable: false });
|
|
918
|
-
this.sockets[name].push(fakeSocket);
|
|
919
|
-
this.totalSocketCount++;
|
|
920
|
-
return fakeSocket;
|
|
921
|
-
}
|
|
922
|
-
decrementSockets(name, socket) {
|
|
923
|
-
if (!this.sockets[name] || socket === null) {
|
|
924
|
-
return;
|
|
925
|
-
}
|
|
926
|
-
const sockets = this.sockets[name];
|
|
927
|
-
const index = sockets.indexOf(socket);
|
|
928
|
-
if (index !== -1) {
|
|
929
|
-
sockets.splice(index, 1);
|
|
930
|
-
this.totalSocketCount--;
|
|
931
|
-
if (sockets.length === 0) {
|
|
932
|
-
delete this.sockets[name];
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
// In order to properly update the socket pool, we need to call `getName()` on
|
|
937
|
-
// the core `https.Agent` if it is a secureEndpoint.
|
|
938
|
-
getName(options) {
|
|
939
|
-
const secureEndpoint = this.isSecureEndpoint(options);
|
|
940
|
-
if (secureEndpoint) {
|
|
941
|
-
return https_1.Agent.prototype.getName.call(this, options);
|
|
942
|
-
}
|
|
943
|
-
return super.getName(options);
|
|
944
|
-
}
|
|
945
|
-
createSocket(req, options, cb) {
|
|
946
|
-
const connectOpts = {
|
|
947
|
-
...options,
|
|
948
|
-
secureEndpoint: this.isSecureEndpoint(options)
|
|
949
|
-
};
|
|
950
|
-
const name = this.getName(connectOpts);
|
|
951
|
-
const fakeSocket = this.incrementSockets(name);
|
|
952
|
-
Promise.resolve().then(() => this.connect(req, connectOpts)).then((socket) => {
|
|
953
|
-
this.decrementSockets(name, fakeSocket);
|
|
954
|
-
if (socket instanceof http.Agent) {
|
|
955
|
-
try {
|
|
956
|
-
return socket.addRequest(req, connectOpts);
|
|
957
|
-
} catch (err) {
|
|
958
|
-
return cb(err);
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
this[INTERNAL].currentSocket = socket;
|
|
962
|
-
super.createSocket(req, options, cb);
|
|
963
|
-
}, (err) => {
|
|
964
|
-
this.decrementSockets(name, fakeSocket);
|
|
965
|
-
cb(err);
|
|
966
|
-
});
|
|
967
|
-
}
|
|
968
|
-
createConnection() {
|
|
969
|
-
const socket = this[INTERNAL].currentSocket;
|
|
970
|
-
this[INTERNAL].currentSocket = void 0;
|
|
971
|
-
if (!socket) {
|
|
972
|
-
throw new Error("No socket was returned in the `connect()` function");
|
|
973
|
-
}
|
|
974
|
-
return socket;
|
|
975
|
-
}
|
|
976
|
-
get defaultPort() {
|
|
977
|
-
return this[INTERNAL].defaultPort ?? (this.protocol === "https:" ? 443 : 80);
|
|
978
|
-
}
|
|
979
|
-
set defaultPort(v) {
|
|
980
|
-
if (this[INTERNAL]) {
|
|
981
|
-
this[INTERNAL].defaultPort = v;
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
get protocol() {
|
|
985
|
-
return this[INTERNAL].protocol ?? (this.isSecureEndpoint() ? "https:" : "http:");
|
|
986
|
-
}
|
|
987
|
-
set protocol(v) {
|
|
988
|
-
if (this[INTERNAL]) {
|
|
989
|
-
this[INTERNAL].protocol = v;
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
};
|
|
993
|
-
exports.Agent = Agent;
|
|
994
|
-
}
|
|
995
|
-
});
|
|
996
|
-
|
|
997
|
-
// node_modules/.pnpm/https-proxy-agent@7.0.6_supports-color@7.2.0/node_modules/https-proxy-agent/dist/parse-proxy-response.js
|
|
998
|
-
var require_parse_proxy_response = __commonJS({
|
|
999
|
-
"node_modules/.pnpm/https-proxy-agent@7.0.6_supports-color@7.2.0/node_modules/https-proxy-agent/dist/parse-proxy-response.js"(exports) {
|
|
1000
|
-
"use strict";
|
|
1001
|
-
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
1002
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1003
|
-
};
|
|
1004
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1005
|
-
exports.parseProxyResponse = void 0;
|
|
1006
|
-
var debug_1 = __importDefault(require_src());
|
|
1007
|
-
var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
|
1008
|
-
function parseProxyResponse(socket) {
|
|
1009
|
-
return new Promise((resolve, reject) => {
|
|
1010
|
-
let buffersLength = 0;
|
|
1011
|
-
const buffers = [];
|
|
1012
|
-
function read() {
|
|
1013
|
-
const b = socket.read();
|
|
1014
|
-
if (b)
|
|
1015
|
-
ondata(b);
|
|
1016
|
-
else
|
|
1017
|
-
socket.once("readable", read);
|
|
1018
|
-
}
|
|
1019
|
-
function cleanup() {
|
|
1020
|
-
socket.removeListener("end", onend);
|
|
1021
|
-
socket.removeListener("error", onerror);
|
|
1022
|
-
socket.removeListener("readable", read);
|
|
1023
|
-
}
|
|
1024
|
-
function onend() {
|
|
1025
|
-
cleanup();
|
|
1026
|
-
debug("onend");
|
|
1027
|
-
reject(new Error("Proxy connection ended before receiving CONNECT response"));
|
|
1028
|
-
}
|
|
1029
|
-
function onerror(err) {
|
|
1030
|
-
cleanup();
|
|
1031
|
-
debug("onerror %o", err);
|
|
1032
|
-
reject(err);
|
|
1033
|
-
}
|
|
1034
|
-
function ondata(b) {
|
|
1035
|
-
buffers.push(b);
|
|
1036
|
-
buffersLength += b.length;
|
|
1037
|
-
const buffered = Buffer.concat(buffers, buffersLength);
|
|
1038
|
-
const endOfHeaders = buffered.indexOf("\r\n\r\n");
|
|
1039
|
-
if (endOfHeaders === -1) {
|
|
1040
|
-
debug("have not received end of HTTP headers yet...");
|
|
1041
|
-
read();
|
|
1042
|
-
return;
|
|
1043
|
-
}
|
|
1044
|
-
const headerParts = buffered.slice(0, endOfHeaders).toString("ascii").split("\r\n");
|
|
1045
|
-
const firstLine = headerParts.shift();
|
|
1046
|
-
if (!firstLine) {
|
|
1047
|
-
socket.destroy();
|
|
1048
|
-
return reject(new Error("No header received from proxy CONNECT response"));
|
|
1049
|
-
}
|
|
1050
|
-
const firstLineParts = firstLine.split(" ");
|
|
1051
|
-
const statusCode = +firstLineParts[1];
|
|
1052
|
-
const statusText = firstLineParts.slice(2).join(" ");
|
|
1053
|
-
const headers = {};
|
|
1054
|
-
for (const header of headerParts) {
|
|
1055
|
-
if (!header)
|
|
1056
|
-
continue;
|
|
1057
|
-
const firstColon = header.indexOf(":");
|
|
1058
|
-
if (firstColon === -1) {
|
|
1059
|
-
socket.destroy();
|
|
1060
|
-
return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`));
|
|
1061
|
-
}
|
|
1062
|
-
const key = header.slice(0, firstColon).toLowerCase();
|
|
1063
|
-
const value = header.slice(firstColon + 1).trimStart();
|
|
1064
|
-
const current = headers[key];
|
|
1065
|
-
if (typeof current === "string") {
|
|
1066
|
-
headers[key] = [current, value];
|
|
1067
|
-
} else if (Array.isArray(current)) {
|
|
1068
|
-
current.push(value);
|
|
1069
|
-
} else {
|
|
1070
|
-
headers[key] = value;
|
|
1071
|
-
}
|
|
1072
|
-
}
|
|
1073
|
-
debug("got proxy server response: %o %o", firstLine, headers);
|
|
1074
|
-
cleanup();
|
|
1075
|
-
resolve({
|
|
1076
|
-
connect: {
|
|
1077
|
-
statusCode,
|
|
1078
|
-
statusText,
|
|
1079
|
-
headers
|
|
1080
|
-
},
|
|
1081
|
-
buffered
|
|
1082
|
-
});
|
|
1083
|
-
}
|
|
1084
|
-
socket.on("error", onerror);
|
|
1085
|
-
socket.on("end", onend);
|
|
1086
|
-
read();
|
|
1087
|
-
});
|
|
1088
|
-
}
|
|
1089
|
-
exports.parseProxyResponse = parseProxyResponse;
|
|
1090
|
-
}
|
|
1091
|
-
});
|
|
1092
|
-
|
|
1093
|
-
// node_modules/.pnpm/https-proxy-agent@7.0.6_supports-color@7.2.0/node_modules/https-proxy-agent/dist/index.js
|
|
1094
|
-
var require_dist2 = __commonJS({
|
|
1095
|
-
"node_modules/.pnpm/https-proxy-agent@7.0.6_supports-color@7.2.0/node_modules/https-proxy-agent/dist/index.js"(exports) {
|
|
1096
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
1097
|
-
if (k2 === void 0) k2 = k;
|
|
1098
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1099
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1100
|
-
desc = { enumerable: true, get: function() {
|
|
1101
|
-
return m[k];
|
|
1102
|
-
} };
|
|
1103
|
-
}
|
|
1104
|
-
Object.defineProperty(o, k2, desc);
|
|
1105
|
-
}) : (function(o, m, k, k2) {
|
|
1106
|
-
if (k2 === void 0) k2 = k;
|
|
1107
|
-
o[k2] = m[k];
|
|
1108
|
-
}));
|
|
1109
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
1110
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1111
|
-
}) : function(o, v) {
|
|
1112
|
-
o["default"] = v;
|
|
1113
|
-
});
|
|
1114
|
-
var __importStar = exports && exports.__importStar || function(mod) {
|
|
1115
|
-
if (mod && mod.__esModule) return mod;
|
|
1116
|
-
var result = {};
|
|
1117
|
-
if (mod != null) {
|
|
1118
|
-
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1119
|
-
}
|
|
1120
|
-
__setModuleDefault(result, mod);
|
|
1121
|
-
return result;
|
|
1122
|
-
};
|
|
1123
|
-
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
1124
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1125
|
-
};
|
|
1126
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1127
|
-
exports.HttpsProxyAgent = void 0;
|
|
1128
|
-
var net = __importStar(__require("net"));
|
|
1129
|
-
var tls = __importStar(__require("tls"));
|
|
1130
|
-
var assert_1 = __importDefault(__require("assert"));
|
|
1131
|
-
var debug_1 = __importDefault(require_src());
|
|
1132
|
-
var agent_base_1 = require_dist();
|
|
1133
|
-
var url_1 = __require("url");
|
|
1134
|
-
var parse_proxy_response_1 = require_parse_proxy_response();
|
|
1135
|
-
var debug = (0, debug_1.default)("https-proxy-agent");
|
|
1136
|
-
var setServernameFromNonIpHost = (options) => {
|
|
1137
|
-
if (options.servername === void 0 && options.host && !net.isIP(options.host)) {
|
|
1138
|
-
return {
|
|
1139
|
-
...options,
|
|
1140
|
-
servername: options.host
|
|
1141
|
-
};
|
|
1142
|
-
}
|
|
1143
|
-
return options;
|
|
1144
|
-
};
|
|
1145
|
-
var HttpsProxyAgent = class extends agent_base_1.Agent {
|
|
1146
|
-
constructor(proxy, opts) {
|
|
1147
|
-
super(opts);
|
|
1148
|
-
this.options = { path: void 0 };
|
|
1149
|
-
this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy;
|
|
1150
|
-
this.proxyHeaders = opts?.headers ?? {};
|
|
1151
|
-
debug("Creating new HttpsProxyAgent instance: %o", this.proxy.href);
|
|
1152
|
-
const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, "");
|
|
1153
|
-
const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80;
|
|
1154
|
-
this.connectOpts = {
|
|
1155
|
-
// Attempt to negotiate http/1.1 for proxy servers that support http/2
|
|
1156
|
-
ALPNProtocols: ["http/1.1"],
|
|
1157
|
-
...opts ? omit(opts, "headers") : null,
|
|
1158
|
-
host,
|
|
1159
|
-
port
|
|
1160
|
-
};
|
|
1161
|
-
}
|
|
1162
|
-
/**
|
|
1163
|
-
* Called when the node-core HTTP client library is creating a
|
|
1164
|
-
* new HTTP request.
|
|
1165
|
-
*/
|
|
1166
|
-
async connect(req, opts) {
|
|
1167
|
-
const { proxy } = this;
|
|
1168
|
-
if (!opts.host) {
|
|
1169
|
-
throw new TypeError('No "host" provided');
|
|
1170
|
-
}
|
|
1171
|
-
let socket;
|
|
1172
|
-
if (proxy.protocol === "https:") {
|
|
1173
|
-
debug("Creating `tls.Socket`: %o", this.connectOpts);
|
|
1174
|
-
socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));
|
|
1175
|
-
} else {
|
|
1176
|
-
debug("Creating `net.Socket`: %o", this.connectOpts);
|
|
1177
|
-
socket = net.connect(this.connectOpts);
|
|
1178
|
-
}
|
|
1179
|
-
const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders };
|
|
1180
|
-
const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
|
|
1181
|
-
let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r
|
|
1182
|
-
`;
|
|
1183
|
-
if (proxy.username || proxy.password) {
|
|
1184
|
-
const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
|
|
1185
|
-
headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`;
|
|
1186
|
-
}
|
|
1187
|
-
headers.Host = `${host}:${opts.port}`;
|
|
1188
|
-
if (!headers["Proxy-Connection"]) {
|
|
1189
|
-
headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close";
|
|
1190
|
-
}
|
|
1191
|
-
for (const name of Object.keys(headers)) {
|
|
1192
|
-
payload += `${name}: ${headers[name]}\r
|
|
1193
|
-
`;
|
|
1194
|
-
}
|
|
1195
|
-
const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket);
|
|
1196
|
-
socket.write(`${payload}\r
|
|
1197
|
-
`);
|
|
1198
|
-
const { connect, buffered } = await proxyResponsePromise;
|
|
1199
|
-
req.emit("proxyConnect", connect);
|
|
1200
|
-
this.emit("proxyConnect", connect, req);
|
|
1201
|
-
if (connect.statusCode === 200) {
|
|
1202
|
-
req.once("socket", resume);
|
|
1203
|
-
if (opts.secureEndpoint) {
|
|
1204
|
-
debug("Upgrading socket connection to TLS");
|
|
1205
|
-
return tls.connect({
|
|
1206
|
-
...omit(setServernameFromNonIpHost(opts), "host", "path", "port"),
|
|
1207
|
-
socket
|
|
1208
|
-
});
|
|
1209
|
-
}
|
|
1210
|
-
return socket;
|
|
1211
|
-
}
|
|
1212
|
-
socket.destroy();
|
|
1213
|
-
const fakeSocket = new net.Socket({ writable: false });
|
|
1214
|
-
fakeSocket.readable = true;
|
|
1215
|
-
req.once("socket", (s) => {
|
|
1216
|
-
debug("Replaying proxy buffer for failed request");
|
|
1217
|
-
(0, assert_1.default)(s.listenerCount("data") > 0);
|
|
1218
|
-
s.push(buffered);
|
|
1219
|
-
s.push(null);
|
|
1220
|
-
});
|
|
1221
|
-
return fakeSocket;
|
|
1222
|
-
}
|
|
1223
|
-
};
|
|
1224
|
-
HttpsProxyAgent.protocols = ["http", "https"];
|
|
1225
|
-
exports.HttpsProxyAgent = HttpsProxyAgent;
|
|
1226
|
-
function resume(socket) {
|
|
1227
|
-
socket.resume();
|
|
1228
|
-
}
|
|
1229
|
-
function omit(obj, ...keys) {
|
|
1230
|
-
const ret = {};
|
|
1231
|
-
let key;
|
|
1232
|
-
for (key in obj) {
|
|
1233
|
-
if (!keys.includes(key)) {
|
|
1234
|
-
ret[key] = obj[key];
|
|
1235
|
-
}
|
|
1236
|
-
}
|
|
1237
|
-
return ret;
|
|
1238
|
-
}
|
|
1239
|
-
}
|
|
1240
|
-
});
|
|
1241
|
-
export default require_dist2();
|
|
771
|
+
export {
|
|
772
|
+
require_src
|
|
773
|
+
};
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
} from "./chunk-CEX2GWGZ.js";
|
|
10
10
|
import {
|
|
11
11
|
calculateCost
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WXRYBXYR.js";
|
|
13
13
|
import {
|
|
14
14
|
getIdentityHeaders
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-24GQ74HM.js";
|
|
16
16
|
|
|
17
17
|
// node_modules/.pnpm/@earendil-works+pi-ai@1.4.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/api/classifier-shared.js
|
|
18
18
|
function httpError(label, response, body) {
|