@kortix/agent-tunnel 0.13.10 → 0.13.12
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/agent-cli.js +38 -35
- package/package.json +1 -1
package/dist/agent-cli.js
CHANGED
|
@@ -19,7 +19,7 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
19
19
|
return cached;
|
|
20
20
|
}
|
|
21
21
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
22
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
22
|
+
const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
23
|
if (mod && typeof mod === "object" || typeof mod === "function") {
|
|
24
24
|
for (let key of __getOwnPropNames(mod))
|
|
25
25
|
if (!__hasOwnProp.call(to, key))
|
|
@@ -46,7 +46,17 @@ var __export = (target, all) => {
|
|
|
46
46
|
set: __exportSetter.bind(all, name)
|
|
47
47
|
});
|
|
48
48
|
};
|
|
49
|
-
var __esm = (fn, res) => () =>
|
|
49
|
+
var __esm = (fn, res, err) => () => {
|
|
50
|
+
if (fn)
|
|
51
|
+
try {
|
|
52
|
+
res = fn(fn = 0);
|
|
53
|
+
} catch (e) {
|
|
54
|
+
err = [e];
|
|
55
|
+
}
|
|
56
|
+
if (err)
|
|
57
|
+
throw err[0];
|
|
58
|
+
return res;
|
|
59
|
+
};
|
|
50
60
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
51
61
|
|
|
52
62
|
// ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/constants.js
|
|
@@ -131,11 +141,11 @@ var require_buffer_util = __commonJS(function(exports, module) {
|
|
|
131
141
|
if (!process.env.WS_NO_BUFFER_UTIL) {
|
|
132
142
|
try {
|
|
133
143
|
const bufferUtil = (()=>{throw new Error("Cannot require module "+"bufferutil");})();
|
|
134
|
-
module.exports.mask = function(source,
|
|
144
|
+
module.exports.mask = function(source, mask2, output, offset, length) {
|
|
135
145
|
if (length < 48)
|
|
136
|
-
_mask(source,
|
|
146
|
+
_mask(source, mask2, output, offset, length);
|
|
137
147
|
else
|
|
138
|
-
bufferUtil.mask(source,
|
|
148
|
+
bufferUtil.mask(source, mask2, output, offset, length);
|
|
139
149
|
};
|
|
140
150
|
module.exports.unmask = function(buffer, mask) {
|
|
141
151
|
if (buffer.length < 32)
|
|
@@ -368,7 +378,7 @@ var require_permessage_deflate = __commonJS(function(exports, module) {
|
|
|
368
378
|
callback(err);
|
|
369
379
|
return;
|
|
370
380
|
}
|
|
371
|
-
const
|
|
381
|
+
const data = bufferUtil.concat(this._inflate[kBuffers], this._inflate[kTotalLength]);
|
|
372
382
|
if (this._inflate._readableState.endEmitted) {
|
|
373
383
|
this._inflate.close();
|
|
374
384
|
this._inflate = null;
|
|
@@ -379,7 +389,7 @@ var require_permessage_deflate = __commonJS(function(exports, module) {
|
|
|
379
389
|
this._inflate.reset();
|
|
380
390
|
}
|
|
381
391
|
}
|
|
382
|
-
callback(null,
|
|
392
|
+
callback(null, data);
|
|
383
393
|
});
|
|
384
394
|
}
|
|
385
395
|
_compress(data, fin, callback) {
|
|
@@ -401,9 +411,9 @@ var require_permessage_deflate = __commonJS(function(exports, module) {
|
|
|
401
411
|
if (!this._deflate) {
|
|
402
412
|
return;
|
|
403
413
|
}
|
|
404
|
-
let
|
|
414
|
+
let data = bufferUtil.concat(this._deflate[kBuffers], this._deflate[kTotalLength]);
|
|
405
415
|
if (fin) {
|
|
406
|
-
|
|
416
|
+
data = new FastBuffer(data.buffer, data.byteOffset, data.length - 4);
|
|
407
417
|
}
|
|
408
418
|
this._deflate[kCallback] = null;
|
|
409
419
|
this._deflate[kTotalLength] = 0;
|
|
@@ -411,7 +421,7 @@ var require_permessage_deflate = __commonJS(function(exports, module) {
|
|
|
411
421
|
if (fin && this.params[`${endpoint}_no_context_takeover`]) {
|
|
412
422
|
this._deflate.reset();
|
|
413
423
|
}
|
|
414
|
-
callback(null,
|
|
424
|
+
callback(null, data);
|
|
415
425
|
});
|
|
416
426
|
}
|
|
417
427
|
}
|
|
@@ -2126,7 +2136,7 @@ var require_websocket = __commonJS(function(exports, module) {
|
|
|
2126
2136
|
}
|
|
2127
2137
|
const defaultPort = isSecure ? 443 : 80;
|
|
2128
2138
|
const key = randomBytes(16).toString("base64");
|
|
2129
|
-
const
|
|
2139
|
+
const request3 = isSecure ? https.request : http.request;
|
|
2130
2140
|
const protocolSet = new Set;
|
|
2131
2141
|
let perMessageDeflate;
|
|
2132
2142
|
opts.createConnection = opts.createConnection || (isSecure ? tlsConnect : netConnect);
|
|
@@ -2185,8 +2195,8 @@ var require_websocket = __commonJS(function(exports, module) {
|
|
|
2185
2195
|
const headers = options && options.headers;
|
|
2186
2196
|
options = { ...options, headers: {} };
|
|
2187
2197
|
if (headers) {
|
|
2188
|
-
for (const [
|
|
2189
|
-
options.headers[
|
|
2198
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
2199
|
+
options.headers[key.toLowerCase()] = value;
|
|
2190
2200
|
}
|
|
2191
2201
|
}
|
|
2192
2202
|
} else if (websocket.listenerCount("redirect") === 0) {
|
|
@@ -2202,12 +2212,12 @@ var require_websocket = __commonJS(function(exports, module) {
|
|
|
2202
2212
|
if (opts.auth && !options.headers.authorization) {
|
|
2203
2213
|
options.headers.authorization = "Basic " + Buffer.from(opts.auth).toString("base64");
|
|
2204
2214
|
}
|
|
2205
|
-
req = websocket._req =
|
|
2215
|
+
req = websocket._req = request3(opts);
|
|
2206
2216
|
if (websocket._redirects) {
|
|
2207
2217
|
websocket.emit("redirect", websocket.url, req);
|
|
2208
2218
|
}
|
|
2209
2219
|
} else {
|
|
2210
|
-
req = websocket._req =
|
|
2220
|
+
req = websocket._req = request3(opts);
|
|
2211
2221
|
}
|
|
2212
2222
|
if (opts.timeout) {
|
|
2213
2223
|
req.on("timeout", () => {
|
|
@@ -2525,9 +2535,9 @@ var require_stream = __commonJS(function(exports, module) {
|
|
|
2525
2535
|
return;
|
|
2526
2536
|
}
|
|
2527
2537
|
let called = false;
|
|
2528
|
-
ws.once("error", function error(
|
|
2538
|
+
ws.once("error", function error(err) {
|
|
2529
2539
|
called = true;
|
|
2530
|
-
callback(
|
|
2540
|
+
callback(err);
|
|
2531
2541
|
});
|
|
2532
2542
|
ws.once("close", function close() {
|
|
2533
2543
|
if (!called)
|
|
@@ -2599,11 +2609,11 @@ var require_subprotocol = __commonJS(function(exports, module) {
|
|
|
2599
2609
|
}
|
|
2600
2610
|
if (end === -1)
|
|
2601
2611
|
end = i;
|
|
2602
|
-
const
|
|
2603
|
-
if (protocols.has(
|
|
2604
|
-
throw new SyntaxError(`The "${
|
|
2612
|
+
const protocol = header.slice(start, end);
|
|
2613
|
+
if (protocols.has(protocol)) {
|
|
2614
|
+
throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`);
|
|
2605
2615
|
}
|
|
2606
|
-
protocols.add(
|
|
2616
|
+
protocols.add(protocol);
|
|
2607
2617
|
start = end = -1;
|
|
2608
2618
|
} else {
|
|
2609
2619
|
throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
@@ -2935,15 +2945,8 @@ var require_websocket_server = __commonJS(function(exports, module) {
|
|
|
2935
2945
|
// ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/wrapper.mjs
|
|
2936
2946
|
var exports_wrapper = {};
|
|
2937
2947
|
__export(exports_wrapper, {
|
|
2938
|
-
PerMessageDeflate: () => import_permessage_deflate.default,
|
|
2939
|
-
Receiver: () => import_receiver.default,
|
|
2940
|
-
Sender: () => import_sender.default,
|
|
2941
2948
|
WebSocket: () => import_websocket.default,
|
|
2942
|
-
|
|
2943
|
-
createWebSocketStream: () => import_stream.default,
|
|
2944
|
-
default: () => wrapper_default,
|
|
2945
|
-
extension: () => import_extension.default,
|
|
2946
|
-
subprotocol: () => import_subprotocol.default
|
|
2949
|
+
default: () => wrapper_default
|
|
2947
2950
|
});
|
|
2948
2951
|
var import_stream, import_extension, import_permessage_deflate, import_receiver, import_sender, import_subprotocol, import_websocket, import_websocket_server, wrapper_default;
|
|
2949
2952
|
var init_wrapper = __esm(() => {
|
|
@@ -2962,7 +2965,7 @@ var init_wrapper = __esm(() => {
|
|
|
2962
2965
|
if (typeof globalThis.WebSocket === "undefined") {
|
|
2963
2966
|
try {
|
|
2964
2967
|
const ws = await Promise.resolve().then(() => (init_wrapper(), exports_wrapper));
|
|
2965
|
-
const WebSocketImpl = ws.WebSocket ??
|
|
2968
|
+
const WebSocketImpl = ws.WebSocket ?? wrapper_default;
|
|
2966
2969
|
globalThis.WebSocket = WebSocketImpl;
|
|
2967
2970
|
} catch {
|
|
2968
2971
|
console.error('[agent-tunnel] WebSocket is not available. Install the "ws" package or use Node.js 22+.');
|
|
@@ -4667,7 +4670,7 @@ function createShellCapability(config) {
|
|
|
4667
4670
|
safeEnv[key] = process.env[key];
|
|
4668
4671
|
}
|
|
4669
4672
|
}
|
|
4670
|
-
return new Promise((
|
|
4673
|
+
return new Promise((resolve, reject) => {
|
|
4671
4674
|
const proc = spawn2(executable, args, {
|
|
4672
4675
|
cwd,
|
|
4673
4676
|
shell: false,
|
|
@@ -4710,7 +4713,7 @@ function createShellCapability(config) {
|
|
|
4710
4713
|
reject(new Error(`Command failed to start: ${err.message}`));
|
|
4711
4714
|
});
|
|
4712
4715
|
proc.on("close", (code, signal) => {
|
|
4713
|
-
|
|
4716
|
+
resolve({
|
|
4714
4717
|
exitCode: code,
|
|
4715
4718
|
signal,
|
|
4716
4719
|
stdout,
|
|
@@ -4800,12 +4803,12 @@ function clearSavedCredentials() {
|
|
|
4800
4803
|
// src/agent/credential-probe.ts
|
|
4801
4804
|
var DEFAULT_PROBE_TIMEOUT_MS = 1e4;
|
|
4802
4805
|
function probeCredentials(config, options = {}) {
|
|
4803
|
-
return new Promise((
|
|
4806
|
+
return new Promise((resolve) => {
|
|
4804
4807
|
let socket;
|
|
4805
4808
|
try {
|
|
4806
4809
|
socket = new WebSocket(new URL(buildTunnelWsUrl(config)));
|
|
4807
4810
|
} catch {
|
|
4808
|
-
|
|
4811
|
+
resolve("unreachable");
|
|
4809
4812
|
return;
|
|
4810
4813
|
}
|
|
4811
4814
|
const settle = (result) => {
|
|
@@ -4813,7 +4816,7 @@ function probeCredentials(config, options = {}) {
|
|
|
4813
4816
|
try {
|
|
4814
4817
|
socket.close(1000, "probe complete");
|
|
4815
4818
|
} catch {}
|
|
4816
|
-
|
|
4819
|
+
resolve(result);
|
|
4817
4820
|
};
|
|
4818
4821
|
const timer = setTimeout(() => settle("unreachable"), options.timeoutMs ?? DEFAULT_PROBE_TIMEOUT_MS);
|
|
4819
4822
|
socket.addEventListener("open", () => {
|
package/package.json
CHANGED