agent-relay 6.0.19 → 6.0.21
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/index.cjs +853 -92
- package/dist/src/cli/commands/agent-management.d.ts.map +1 -1
- package/dist/src/cli/commands/agent-management.js +33 -3
- package/dist/src/cli/commands/agent-management.js.map +1 -1
- package/node_modules/@relaycast/sdk/dist/agent.d.ts +16 -1
- package/node_modules/@relaycast/sdk/dist/agent.d.ts.map +1 -1
- package/node_modules/@relaycast/sdk/dist/agent.js +143 -3
- package/node_modules/@relaycast/sdk/dist/agent.js.map +1 -1
- package/node_modules/@relaycast/sdk/dist/communicate/index.d.ts +3 -0
- package/node_modules/@relaycast/sdk/dist/communicate/index.d.ts.map +1 -0
- package/node_modules/@relaycast/sdk/dist/communicate/index.js +2 -0
- package/node_modules/@relaycast/sdk/dist/communicate/index.js.map +1 -0
- package/node_modules/@relaycast/sdk/dist/communicate/relay.d.ts +13 -0
- package/node_modules/@relaycast/sdk/dist/communicate/relay.d.ts.map +1 -0
- package/node_modules/@relaycast/sdk/dist/communicate/relay.js +73 -0
- package/node_modules/@relaycast/sdk/dist/communicate/relay.js.map +1 -0
- package/node_modules/@relaycast/sdk/dist/communicate/types.d.ts +23 -0
- package/node_modules/@relaycast/sdk/dist/communicate/types.d.ts.map +1 -0
- package/node_modules/@relaycast/sdk/dist/communicate/types.js +2 -0
- package/node_modules/@relaycast/sdk/dist/communicate/types.js.map +1 -0
- package/node_modules/@relaycast/sdk/dist/errors.d.ts +1 -1
- package/node_modules/@relaycast/sdk/dist/errors.d.ts.map +1 -1
- package/node_modules/@relaycast/sdk/dist/errors.js +10 -0
- package/node_modules/@relaycast/sdk/dist/errors.js.map +1 -1
- package/node_modules/@relaycast/sdk/dist/event-id.d.ts +2 -0
- package/node_modules/@relaycast/sdk/dist/event-id.d.ts.map +1 -0
- package/node_modules/@relaycast/sdk/dist/event-id.js +50 -0
- package/node_modules/@relaycast/sdk/dist/event-id.js.map +1 -0
- package/node_modules/@relaycast/sdk/dist/index.d.ts +9 -2
- package/node_modules/@relaycast/sdk/dist/index.d.ts.map +1 -1
- package/node_modules/@relaycast/sdk/dist/index.js +4 -1
- package/node_modules/@relaycast/sdk/dist/index.js.map +1 -1
- package/node_modules/@relaycast/sdk/dist/setup-errors.d.ts +55 -0
- package/node_modules/@relaycast/sdk/dist/setup-errors.d.ts.map +1 -0
- package/node_modules/@relaycast/sdk/dist/setup-errors.js +73 -0
- package/node_modules/@relaycast/sdk/dist/setup-errors.js.map +1 -0
- package/node_modules/@relaycast/sdk/dist/setup-types.d.ts +54 -0
- package/node_modules/@relaycast/sdk/dist/setup-types.d.ts.map +1 -0
- package/node_modules/@relaycast/sdk/dist/setup-types.js +2 -0
- package/node_modules/@relaycast/sdk/dist/setup-types.js.map +1 -0
- package/node_modules/@relaycast/sdk/dist/setup.d.ts +41 -0
- package/node_modules/@relaycast/sdk/dist/setup.d.ts.map +1 -0
- package/node_modules/@relaycast/sdk/dist/setup.js +320 -0
- package/node_modules/@relaycast/sdk/dist/setup.js.map +1 -0
- package/node_modules/@relaycast/sdk/dist/subscription.d.ts +5 -0
- package/node_modules/@relaycast/sdk/dist/subscription.d.ts.map +1 -0
- package/node_modules/@relaycast/sdk/dist/subscription.js +2 -0
- package/node_modules/@relaycast/sdk/dist/subscription.js.map +1 -0
- package/node_modules/@relaycast/sdk/dist/types.d.ts +1 -0
- package/node_modules/@relaycast/sdk/dist/types.d.ts.map +1 -1
- package/node_modules/@relaycast/sdk/dist/version.d.ts +1 -1
- package/node_modules/@relaycast/sdk/dist/version.js +1 -1
- package/node_modules/@relaycast/sdk/dist/ws.d.ts +1 -0
- package/node_modules/@relaycast/sdk/dist/ws.d.ts.map +1 -1
- package/node_modules/@relaycast/sdk/dist/ws.js +3 -0
- package/node_modules/@relaycast/sdk/dist/ws.js.map +1 -1
- package/node_modules/@relaycast/sdk/node_modules/@relaycast/types/dist/event-id.d.ts +2 -0
- package/node_modules/@relaycast/sdk/node_modules/@relaycast/types/dist/event-id.d.ts.map +1 -0
- package/node_modules/@relaycast/sdk/node_modules/@relaycast/types/dist/event-id.js +50 -0
- package/node_modules/@relaycast/sdk/node_modules/@relaycast/types/dist/event-id.js.map +1 -0
- package/node_modules/@relaycast/sdk/node_modules/@relaycast/types/dist/events.d.ts +95 -0
- package/node_modules/@relaycast/sdk/node_modules/@relaycast/types/dist/events.d.ts.map +1 -1
- package/node_modules/@relaycast/sdk/node_modules/@relaycast/types/dist/events.js +10 -0
- package/node_modules/@relaycast/sdk/node_modules/@relaycast/types/dist/events.js.map +1 -1
- package/node_modules/@relaycast/sdk/node_modules/@relaycast/types/dist/index.d.ts +1 -0
- package/node_modules/@relaycast/sdk/node_modules/@relaycast/types/dist/index.d.ts.map +1 -1
- package/node_modules/@relaycast/sdk/node_modules/@relaycast/types/dist/index.js +1 -0
- package/node_modules/@relaycast/sdk/node_modules/@relaycast/types/dist/index.js.map +1 -1
- package/node_modules/@relaycast/sdk/node_modules/@relaycast/types/package.json +1 -1
- package/node_modules/@relaycast/sdk/package.json +7 -2
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -32456,6 +32456,456 @@ var require_src = __commonJS({
|
|
|
32456
32456
|
}
|
|
32457
32457
|
});
|
|
32458
32458
|
|
|
32459
|
+
// node_modules/axios/node_modules/agent-base/dist/src/promisify.js
|
|
32460
|
+
var require_promisify = __commonJS({
|
|
32461
|
+
"node_modules/axios/node_modules/agent-base/dist/src/promisify.js"(exports2) {
|
|
32462
|
+
"use strict";
|
|
32463
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
32464
|
+
function promisify4(fn2) {
|
|
32465
|
+
return function(req, opts) {
|
|
32466
|
+
return new Promise((resolve4, reject) => {
|
|
32467
|
+
fn2.call(this, req, opts, (err, rtn) => {
|
|
32468
|
+
if (err) {
|
|
32469
|
+
reject(err);
|
|
32470
|
+
} else {
|
|
32471
|
+
resolve4(rtn);
|
|
32472
|
+
}
|
|
32473
|
+
});
|
|
32474
|
+
});
|
|
32475
|
+
};
|
|
32476
|
+
}
|
|
32477
|
+
exports2.default = promisify4;
|
|
32478
|
+
}
|
|
32479
|
+
});
|
|
32480
|
+
|
|
32481
|
+
// node_modules/axios/node_modules/agent-base/dist/src/index.js
|
|
32482
|
+
var require_src2 = __commonJS({
|
|
32483
|
+
"node_modules/axios/node_modules/agent-base/dist/src/index.js"(exports2, module2) {
|
|
32484
|
+
"use strict";
|
|
32485
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
32486
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
32487
|
+
};
|
|
32488
|
+
var events_1 = require("events");
|
|
32489
|
+
var debug_1 = __importDefault(require_src());
|
|
32490
|
+
var promisify_1 = __importDefault(require_promisify());
|
|
32491
|
+
var debug = debug_1.default("agent-base");
|
|
32492
|
+
function isAgent(v2) {
|
|
32493
|
+
return Boolean(v2) && typeof v2.addRequest === "function";
|
|
32494
|
+
}
|
|
32495
|
+
function isSecureEndpoint() {
|
|
32496
|
+
const { stack } = new Error();
|
|
32497
|
+
if (typeof stack !== "string")
|
|
32498
|
+
return false;
|
|
32499
|
+
return stack.split("\n").some((l) => l.indexOf("(https.js:") !== -1 || l.indexOf("node:https:") !== -1);
|
|
32500
|
+
}
|
|
32501
|
+
function createAgent(callback, opts) {
|
|
32502
|
+
return new createAgent.Agent(callback, opts);
|
|
32503
|
+
}
|
|
32504
|
+
(function(createAgent2) {
|
|
32505
|
+
class Agent extends events_1.EventEmitter {
|
|
32506
|
+
constructor(callback, _opts) {
|
|
32507
|
+
super();
|
|
32508
|
+
let opts = _opts;
|
|
32509
|
+
if (typeof callback === "function") {
|
|
32510
|
+
this.callback = callback;
|
|
32511
|
+
} else if (callback) {
|
|
32512
|
+
opts = callback;
|
|
32513
|
+
}
|
|
32514
|
+
this.timeout = null;
|
|
32515
|
+
if (opts && typeof opts.timeout === "number") {
|
|
32516
|
+
this.timeout = opts.timeout;
|
|
32517
|
+
}
|
|
32518
|
+
this.maxFreeSockets = 1;
|
|
32519
|
+
this.maxSockets = 1;
|
|
32520
|
+
this.maxTotalSockets = Infinity;
|
|
32521
|
+
this.sockets = {};
|
|
32522
|
+
this.freeSockets = {};
|
|
32523
|
+
this.requests = {};
|
|
32524
|
+
this.options = {};
|
|
32525
|
+
}
|
|
32526
|
+
get defaultPort() {
|
|
32527
|
+
if (typeof this.explicitDefaultPort === "number") {
|
|
32528
|
+
return this.explicitDefaultPort;
|
|
32529
|
+
}
|
|
32530
|
+
return isSecureEndpoint() ? 443 : 80;
|
|
32531
|
+
}
|
|
32532
|
+
set defaultPort(v2) {
|
|
32533
|
+
this.explicitDefaultPort = v2;
|
|
32534
|
+
}
|
|
32535
|
+
get protocol() {
|
|
32536
|
+
if (typeof this.explicitProtocol === "string") {
|
|
32537
|
+
return this.explicitProtocol;
|
|
32538
|
+
}
|
|
32539
|
+
return isSecureEndpoint() ? "https:" : "http:";
|
|
32540
|
+
}
|
|
32541
|
+
set protocol(v2) {
|
|
32542
|
+
this.explicitProtocol = v2;
|
|
32543
|
+
}
|
|
32544
|
+
callback(req, opts, fn2) {
|
|
32545
|
+
throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`');
|
|
32546
|
+
}
|
|
32547
|
+
/**
|
|
32548
|
+
* Called by node-core's "_http_client.js" module when creating
|
|
32549
|
+
* a new HTTP request with this Agent instance.
|
|
32550
|
+
*
|
|
32551
|
+
* @api public
|
|
32552
|
+
*/
|
|
32553
|
+
addRequest(req, _opts) {
|
|
32554
|
+
const opts = Object.assign({}, _opts);
|
|
32555
|
+
if (typeof opts.secureEndpoint !== "boolean") {
|
|
32556
|
+
opts.secureEndpoint = isSecureEndpoint();
|
|
32557
|
+
}
|
|
32558
|
+
if (opts.host == null) {
|
|
32559
|
+
opts.host = "localhost";
|
|
32560
|
+
}
|
|
32561
|
+
if (opts.port == null) {
|
|
32562
|
+
opts.port = opts.secureEndpoint ? 443 : 80;
|
|
32563
|
+
}
|
|
32564
|
+
if (opts.protocol == null) {
|
|
32565
|
+
opts.protocol = opts.secureEndpoint ? "https:" : "http:";
|
|
32566
|
+
}
|
|
32567
|
+
if (opts.host && opts.path) {
|
|
32568
|
+
delete opts.path;
|
|
32569
|
+
}
|
|
32570
|
+
delete opts.agent;
|
|
32571
|
+
delete opts.hostname;
|
|
32572
|
+
delete opts._defaultAgent;
|
|
32573
|
+
delete opts.defaultPort;
|
|
32574
|
+
delete opts.createConnection;
|
|
32575
|
+
req._last = true;
|
|
32576
|
+
req.shouldKeepAlive = false;
|
|
32577
|
+
let timedOut = false;
|
|
32578
|
+
let timeoutId = null;
|
|
32579
|
+
const timeoutMs = opts.timeout || this.timeout;
|
|
32580
|
+
const onerror = (err) => {
|
|
32581
|
+
if (req._hadError)
|
|
32582
|
+
return;
|
|
32583
|
+
req.emit("error", err);
|
|
32584
|
+
req._hadError = true;
|
|
32585
|
+
};
|
|
32586
|
+
const ontimeout = () => {
|
|
32587
|
+
timeoutId = null;
|
|
32588
|
+
timedOut = true;
|
|
32589
|
+
const err = new Error(`A "socket" was not created for HTTP request before ${timeoutMs}ms`);
|
|
32590
|
+
err.code = "ETIMEOUT";
|
|
32591
|
+
onerror(err);
|
|
32592
|
+
};
|
|
32593
|
+
const callbackError = (err) => {
|
|
32594
|
+
if (timedOut)
|
|
32595
|
+
return;
|
|
32596
|
+
if (timeoutId !== null) {
|
|
32597
|
+
clearTimeout(timeoutId);
|
|
32598
|
+
timeoutId = null;
|
|
32599
|
+
}
|
|
32600
|
+
onerror(err);
|
|
32601
|
+
};
|
|
32602
|
+
const onsocket = (socket) => {
|
|
32603
|
+
if (timedOut)
|
|
32604
|
+
return;
|
|
32605
|
+
if (timeoutId != null) {
|
|
32606
|
+
clearTimeout(timeoutId);
|
|
32607
|
+
timeoutId = null;
|
|
32608
|
+
}
|
|
32609
|
+
if (isAgent(socket)) {
|
|
32610
|
+
debug("Callback returned another Agent instance %o", socket.constructor.name);
|
|
32611
|
+
socket.addRequest(req, opts);
|
|
32612
|
+
return;
|
|
32613
|
+
}
|
|
32614
|
+
if (socket) {
|
|
32615
|
+
socket.once("free", () => {
|
|
32616
|
+
this.freeSocket(socket, opts);
|
|
32617
|
+
});
|
|
32618
|
+
req.onSocket(socket);
|
|
32619
|
+
return;
|
|
32620
|
+
}
|
|
32621
|
+
const err = new Error(`no Duplex stream was returned to agent-base for \`${req.method} ${req.path}\``);
|
|
32622
|
+
onerror(err);
|
|
32623
|
+
};
|
|
32624
|
+
if (typeof this.callback !== "function") {
|
|
32625
|
+
onerror(new Error("`callback` is not defined"));
|
|
32626
|
+
return;
|
|
32627
|
+
}
|
|
32628
|
+
if (!this.promisifiedCallback) {
|
|
32629
|
+
if (this.callback.length >= 3) {
|
|
32630
|
+
debug("Converting legacy callback function to promise");
|
|
32631
|
+
this.promisifiedCallback = promisify_1.default(this.callback);
|
|
32632
|
+
} else {
|
|
32633
|
+
this.promisifiedCallback = this.callback;
|
|
32634
|
+
}
|
|
32635
|
+
}
|
|
32636
|
+
if (typeof timeoutMs === "number" && timeoutMs > 0) {
|
|
32637
|
+
timeoutId = setTimeout(ontimeout, timeoutMs);
|
|
32638
|
+
}
|
|
32639
|
+
if ("port" in opts && typeof opts.port !== "number") {
|
|
32640
|
+
opts.port = Number(opts.port);
|
|
32641
|
+
}
|
|
32642
|
+
try {
|
|
32643
|
+
debug("Resolving socket for %o request: %o", opts.protocol, `${req.method} ${req.path}`);
|
|
32644
|
+
Promise.resolve(this.promisifiedCallback(req, opts)).then(onsocket, callbackError);
|
|
32645
|
+
} catch (err) {
|
|
32646
|
+
Promise.reject(err).catch(callbackError);
|
|
32647
|
+
}
|
|
32648
|
+
}
|
|
32649
|
+
freeSocket(socket, opts) {
|
|
32650
|
+
debug("Freeing socket %o %o", socket.constructor.name, opts);
|
|
32651
|
+
socket.destroy();
|
|
32652
|
+
}
|
|
32653
|
+
destroy() {
|
|
32654
|
+
debug("Destroying agent %o", this.constructor.name);
|
|
32655
|
+
}
|
|
32656
|
+
}
|
|
32657
|
+
createAgent2.Agent = Agent;
|
|
32658
|
+
createAgent2.prototype = createAgent2.Agent.prototype;
|
|
32659
|
+
})(createAgent || (createAgent = {}));
|
|
32660
|
+
module2.exports = createAgent;
|
|
32661
|
+
}
|
|
32662
|
+
});
|
|
32663
|
+
|
|
32664
|
+
// node_modules/axios/node_modules/https-proxy-agent/dist/parse-proxy-response.js
|
|
32665
|
+
var require_parse_proxy_response = __commonJS({
|
|
32666
|
+
"node_modules/axios/node_modules/https-proxy-agent/dist/parse-proxy-response.js"(exports2) {
|
|
32667
|
+
"use strict";
|
|
32668
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
32669
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
32670
|
+
};
|
|
32671
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
32672
|
+
var debug_1 = __importDefault(require_src());
|
|
32673
|
+
var debug = debug_1.default("https-proxy-agent:parse-proxy-response");
|
|
32674
|
+
function parseProxyResponse(socket) {
|
|
32675
|
+
return new Promise((resolve4, reject) => {
|
|
32676
|
+
let buffersLength = 0;
|
|
32677
|
+
const buffers = [];
|
|
32678
|
+
function read() {
|
|
32679
|
+
const b2 = socket.read();
|
|
32680
|
+
if (b2)
|
|
32681
|
+
ondata(b2);
|
|
32682
|
+
else
|
|
32683
|
+
socket.once("readable", read);
|
|
32684
|
+
}
|
|
32685
|
+
function cleanup() {
|
|
32686
|
+
socket.removeListener("end", onend);
|
|
32687
|
+
socket.removeListener("error", onerror);
|
|
32688
|
+
socket.removeListener("close", onclose);
|
|
32689
|
+
socket.removeListener("readable", read);
|
|
32690
|
+
}
|
|
32691
|
+
function onclose(err) {
|
|
32692
|
+
debug("onclose had error %o", err);
|
|
32693
|
+
}
|
|
32694
|
+
function onend() {
|
|
32695
|
+
debug("onend");
|
|
32696
|
+
}
|
|
32697
|
+
function onerror(err) {
|
|
32698
|
+
cleanup();
|
|
32699
|
+
debug("onerror %o", err);
|
|
32700
|
+
reject(err);
|
|
32701
|
+
}
|
|
32702
|
+
function ondata(b2) {
|
|
32703
|
+
buffers.push(b2);
|
|
32704
|
+
buffersLength += b2.length;
|
|
32705
|
+
const buffered = Buffer.concat(buffers, buffersLength);
|
|
32706
|
+
const endOfHeaders = buffered.indexOf("\r\n\r\n");
|
|
32707
|
+
if (endOfHeaders === -1) {
|
|
32708
|
+
debug("have not received end of HTTP headers yet...");
|
|
32709
|
+
read();
|
|
32710
|
+
return;
|
|
32711
|
+
}
|
|
32712
|
+
const firstLine = buffered.toString("ascii", 0, buffered.indexOf("\r\n"));
|
|
32713
|
+
const statusCode = +firstLine.split(" ")[1];
|
|
32714
|
+
debug("got proxy server response: %o", firstLine);
|
|
32715
|
+
resolve4({
|
|
32716
|
+
statusCode,
|
|
32717
|
+
buffered
|
|
32718
|
+
});
|
|
32719
|
+
}
|
|
32720
|
+
socket.on("error", onerror);
|
|
32721
|
+
socket.on("close", onclose);
|
|
32722
|
+
socket.on("end", onend);
|
|
32723
|
+
read();
|
|
32724
|
+
});
|
|
32725
|
+
}
|
|
32726
|
+
exports2.default = parseProxyResponse;
|
|
32727
|
+
}
|
|
32728
|
+
});
|
|
32729
|
+
|
|
32730
|
+
// node_modules/axios/node_modules/https-proxy-agent/dist/agent.js
|
|
32731
|
+
var require_agent = __commonJS({
|
|
32732
|
+
"node_modules/axios/node_modules/https-proxy-agent/dist/agent.js"(exports2) {
|
|
32733
|
+
"use strict";
|
|
32734
|
+
var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P2, generator) {
|
|
32735
|
+
function adopt(value) {
|
|
32736
|
+
return value instanceof P2 ? value : new P2(function(resolve4) {
|
|
32737
|
+
resolve4(value);
|
|
32738
|
+
});
|
|
32739
|
+
}
|
|
32740
|
+
return new (P2 || (P2 = Promise))(function(resolve4, reject) {
|
|
32741
|
+
function fulfilled(value) {
|
|
32742
|
+
try {
|
|
32743
|
+
step(generator.next(value));
|
|
32744
|
+
} catch (e) {
|
|
32745
|
+
reject(e);
|
|
32746
|
+
}
|
|
32747
|
+
}
|
|
32748
|
+
function rejected(value) {
|
|
32749
|
+
try {
|
|
32750
|
+
step(generator["throw"](value));
|
|
32751
|
+
} catch (e) {
|
|
32752
|
+
reject(e);
|
|
32753
|
+
}
|
|
32754
|
+
}
|
|
32755
|
+
function step(result) {
|
|
32756
|
+
result.done ? resolve4(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
32757
|
+
}
|
|
32758
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32759
|
+
});
|
|
32760
|
+
};
|
|
32761
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
32762
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
32763
|
+
};
|
|
32764
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
32765
|
+
var net_1 = __importDefault(require("net"));
|
|
32766
|
+
var tls_1 = __importDefault(require("tls"));
|
|
32767
|
+
var url_1 = __importDefault(require("url"));
|
|
32768
|
+
var assert_1 = __importDefault(require("assert"));
|
|
32769
|
+
var debug_1 = __importDefault(require_src());
|
|
32770
|
+
var agent_base_1 = require_src2();
|
|
32771
|
+
var parse_proxy_response_1 = __importDefault(require_parse_proxy_response());
|
|
32772
|
+
var debug = debug_1.default("https-proxy-agent:agent");
|
|
32773
|
+
var HttpsProxyAgent = class extends agent_base_1.Agent {
|
|
32774
|
+
constructor(_opts) {
|
|
32775
|
+
let opts;
|
|
32776
|
+
if (typeof _opts === "string") {
|
|
32777
|
+
opts = url_1.default.parse(_opts);
|
|
32778
|
+
} else {
|
|
32779
|
+
opts = _opts;
|
|
32780
|
+
}
|
|
32781
|
+
if (!opts) {
|
|
32782
|
+
throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");
|
|
32783
|
+
}
|
|
32784
|
+
debug("creating new HttpsProxyAgent instance: %o", opts);
|
|
32785
|
+
super(opts);
|
|
32786
|
+
const proxy = Object.assign({}, opts);
|
|
32787
|
+
this.secureProxy = opts.secureProxy || isHTTPS(proxy.protocol);
|
|
32788
|
+
proxy.host = proxy.hostname || proxy.host;
|
|
32789
|
+
if (typeof proxy.port === "string") {
|
|
32790
|
+
proxy.port = parseInt(proxy.port, 10);
|
|
32791
|
+
}
|
|
32792
|
+
if (!proxy.port && proxy.host) {
|
|
32793
|
+
proxy.port = this.secureProxy ? 443 : 80;
|
|
32794
|
+
}
|
|
32795
|
+
if (this.secureProxy && !("ALPNProtocols" in proxy)) {
|
|
32796
|
+
proxy.ALPNProtocols = ["http 1.1"];
|
|
32797
|
+
}
|
|
32798
|
+
if (proxy.host && proxy.path) {
|
|
32799
|
+
delete proxy.path;
|
|
32800
|
+
delete proxy.pathname;
|
|
32801
|
+
}
|
|
32802
|
+
this.proxy = proxy;
|
|
32803
|
+
}
|
|
32804
|
+
/**
|
|
32805
|
+
* Called when the node-core HTTP client library is creating a
|
|
32806
|
+
* new HTTP request.
|
|
32807
|
+
*
|
|
32808
|
+
* @api protected
|
|
32809
|
+
*/
|
|
32810
|
+
callback(req, opts) {
|
|
32811
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32812
|
+
const { proxy, secureProxy } = this;
|
|
32813
|
+
let socket;
|
|
32814
|
+
if (secureProxy) {
|
|
32815
|
+
debug("Creating `tls.Socket`: %o", proxy);
|
|
32816
|
+
socket = tls_1.default.connect(proxy);
|
|
32817
|
+
} else {
|
|
32818
|
+
debug("Creating `net.Socket`: %o", proxy);
|
|
32819
|
+
socket = net_1.default.connect(proxy);
|
|
32820
|
+
}
|
|
32821
|
+
const headers = Object.assign({}, proxy.headers);
|
|
32822
|
+
const hostname3 = `${opts.host}:${opts.port}`;
|
|
32823
|
+
let payload = `CONNECT ${hostname3} HTTP/1.1\r
|
|
32824
|
+
`;
|
|
32825
|
+
if (proxy.auth) {
|
|
32826
|
+
headers["Proxy-Authorization"] = `Basic ${Buffer.from(proxy.auth).toString("base64")}`;
|
|
32827
|
+
}
|
|
32828
|
+
let { host, port, secureEndpoint } = opts;
|
|
32829
|
+
if (!isDefaultPort(port, secureEndpoint)) {
|
|
32830
|
+
host += `:${port}`;
|
|
32831
|
+
}
|
|
32832
|
+
headers.Host = host;
|
|
32833
|
+
headers.Connection = "close";
|
|
32834
|
+
for (const name of Object.keys(headers)) {
|
|
32835
|
+
payload += `${name}: ${headers[name]}\r
|
|
32836
|
+
`;
|
|
32837
|
+
}
|
|
32838
|
+
const proxyResponsePromise = parse_proxy_response_1.default(socket);
|
|
32839
|
+
socket.write(`${payload}\r
|
|
32840
|
+
`);
|
|
32841
|
+
const { statusCode, buffered } = yield proxyResponsePromise;
|
|
32842
|
+
if (statusCode === 200) {
|
|
32843
|
+
req.once("socket", resume);
|
|
32844
|
+
if (opts.secureEndpoint) {
|
|
32845
|
+
debug("Upgrading socket connection to TLS");
|
|
32846
|
+
const servername = opts.servername || opts.host;
|
|
32847
|
+
return tls_1.default.connect(Object.assign(Object.assign({}, omit2(opts, "host", "hostname", "path", "port")), {
|
|
32848
|
+
socket,
|
|
32849
|
+
servername
|
|
32850
|
+
}));
|
|
32851
|
+
}
|
|
32852
|
+
return socket;
|
|
32853
|
+
}
|
|
32854
|
+
socket.destroy();
|
|
32855
|
+
const fakeSocket = new net_1.default.Socket({ writable: false });
|
|
32856
|
+
fakeSocket.readable = true;
|
|
32857
|
+
req.once("socket", (s3) => {
|
|
32858
|
+
debug("replaying proxy buffer for failed request");
|
|
32859
|
+
assert_1.default(s3.listenerCount("data") > 0);
|
|
32860
|
+
s3.push(buffered);
|
|
32861
|
+
s3.push(null);
|
|
32862
|
+
});
|
|
32863
|
+
return fakeSocket;
|
|
32864
|
+
});
|
|
32865
|
+
}
|
|
32866
|
+
};
|
|
32867
|
+
exports2.default = HttpsProxyAgent;
|
|
32868
|
+
function resume(socket) {
|
|
32869
|
+
socket.resume();
|
|
32870
|
+
}
|
|
32871
|
+
function isDefaultPort(port, secure) {
|
|
32872
|
+
return Boolean(!secure && port === 80 || secure && port === 443);
|
|
32873
|
+
}
|
|
32874
|
+
function isHTTPS(protocol) {
|
|
32875
|
+
return typeof protocol === "string" ? /^https:?$/i.test(protocol) : false;
|
|
32876
|
+
}
|
|
32877
|
+
function omit2(obj, ...keys) {
|
|
32878
|
+
const ret = {};
|
|
32879
|
+
let key;
|
|
32880
|
+
for (key in obj) {
|
|
32881
|
+
if (!keys.includes(key)) {
|
|
32882
|
+
ret[key] = obj[key];
|
|
32883
|
+
}
|
|
32884
|
+
}
|
|
32885
|
+
return ret;
|
|
32886
|
+
}
|
|
32887
|
+
}
|
|
32888
|
+
});
|
|
32889
|
+
|
|
32890
|
+
// node_modules/axios/node_modules/https-proxy-agent/dist/index.js
|
|
32891
|
+
var require_dist3 = __commonJS({
|
|
32892
|
+
"node_modules/axios/node_modules/https-proxy-agent/dist/index.js"(exports2, module2) {
|
|
32893
|
+
"use strict";
|
|
32894
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
32895
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
32896
|
+
};
|
|
32897
|
+
var agent_1 = __importDefault(require_agent());
|
|
32898
|
+
function createHttpsProxyAgent(opts) {
|
|
32899
|
+
return new agent_1.default(opts);
|
|
32900
|
+
}
|
|
32901
|
+
(function(createHttpsProxyAgent2) {
|
|
32902
|
+
createHttpsProxyAgent2.HttpsProxyAgent = agent_1.default;
|
|
32903
|
+
createHttpsProxyAgent2.prototype = agent_1.default.prototype;
|
|
32904
|
+
})(createHttpsProxyAgent || (createHttpsProxyAgent = {}));
|
|
32905
|
+
module2.exports = createHttpsProxyAgent;
|
|
32906
|
+
}
|
|
32907
|
+
});
|
|
32908
|
+
|
|
32459
32909
|
// node_modules/follow-redirects/debug.js
|
|
32460
32910
|
var require_debug = __commonJS({
|
|
32461
32911
|
"node_modules/follow-redirects/debug.js"(exports2, module2) {
|
|
@@ -32994,6 +33444,7 @@ var require_axios = __commonJS({
|
|
|
32994
33444
|
var FormData$1 = require_form_data();
|
|
32995
33445
|
var crypto3 = require("crypto");
|
|
32996
33446
|
var url2 = require("url");
|
|
33447
|
+
var HttpsProxyAgent = require_dist3();
|
|
32997
33448
|
var http2 = require("http");
|
|
32998
33449
|
var https3 = require("https");
|
|
32999
33450
|
var http22 = require("http2");
|
|
@@ -33346,29 +33797,29 @@ var require_axios = __commonJS({
|
|
|
33346
33797
|
return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
|
|
33347
33798
|
}
|
|
33348
33799
|
var toJSONObject = (obj) => {
|
|
33349
|
-
const
|
|
33350
|
-
const visit = (source
|
|
33800
|
+
const visited = /* @__PURE__ */ new WeakSet();
|
|
33801
|
+
const visit = (source) => {
|
|
33351
33802
|
if (isObject3(source)) {
|
|
33352
|
-
if (
|
|
33803
|
+
if (visited.has(source)) {
|
|
33353
33804
|
return;
|
|
33354
33805
|
}
|
|
33355
33806
|
if (isBuffer(source)) {
|
|
33356
33807
|
return source;
|
|
33357
33808
|
}
|
|
33358
33809
|
if (!("toJSON" in source)) {
|
|
33359
|
-
|
|
33810
|
+
visited.add(source);
|
|
33360
33811
|
const target = isArray(source) ? [] : {};
|
|
33361
33812
|
forEach(source, (value, key) => {
|
|
33362
|
-
const reducedValue = visit(value
|
|
33813
|
+
const reducedValue = visit(value);
|
|
33363
33814
|
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
33364
33815
|
});
|
|
33365
|
-
|
|
33816
|
+
visited.delete(source);
|
|
33366
33817
|
return target;
|
|
33367
33818
|
}
|
|
33368
33819
|
}
|
|
33369
33820
|
return source;
|
|
33370
33821
|
};
|
|
33371
|
-
return visit(obj
|
|
33822
|
+
return visit(obj);
|
|
33372
33823
|
};
|
|
33373
33824
|
var isAsyncFn = kindOfTest("AsyncFunction");
|
|
33374
33825
|
var isThenable = (thing) => thing && (isObject3(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
|
|
@@ -33480,8 +33931,6 @@ var require_axios = __commonJS({
|
|
|
33480
33931
|
});
|
|
33481
33932
|
return parsed;
|
|
33482
33933
|
};
|
|
33483
|
-
var $internals = /* @__PURE__ */ Symbol("internals");
|
|
33484
|
-
var INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
|
|
33485
33934
|
function trimSPorHTAB(str) {
|
|
33486
33935
|
let start = 0;
|
|
33487
33936
|
let end = str.length;
|
|
@@ -33501,12 +33950,27 @@ var require_axios = __commonJS({
|
|
|
33501
33950
|
}
|
|
33502
33951
|
return start === 0 && end === str.length ? str : str.slice(start, end);
|
|
33503
33952
|
}
|
|
33953
|
+
var INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+", "g");
|
|
33954
|
+
var INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+", "g");
|
|
33955
|
+
function sanitizeValue(value, invalidChars) {
|
|
33956
|
+
if (utils$1.isArray(value)) {
|
|
33957
|
+
return value.map((item) => sanitizeValue(item, invalidChars));
|
|
33958
|
+
}
|
|
33959
|
+
return trimSPorHTAB(String(value).replace(invalidChars, ""));
|
|
33960
|
+
}
|
|
33961
|
+
var sanitizeHeaderValue = (value) => sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);
|
|
33962
|
+
var sanitizeByteStringHeaderValue = (value) => sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);
|
|
33963
|
+
function toByteStringHeaderObject(headers) {
|
|
33964
|
+
const byteStringHeaders = /* @__PURE__ */ Object.create(null);
|
|
33965
|
+
utils$1.forEach(headers.toJSON(), (value, header) => {
|
|
33966
|
+
byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);
|
|
33967
|
+
});
|
|
33968
|
+
return byteStringHeaders;
|
|
33969
|
+
}
|
|
33970
|
+
var $internals = /* @__PURE__ */ Symbol("internals");
|
|
33504
33971
|
function normalizeHeader(header) {
|
|
33505
33972
|
return header && String(header).trim().toLowerCase();
|
|
33506
33973
|
}
|
|
33507
|
-
function sanitizeHeaderValue(str) {
|
|
33508
|
-
return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ""));
|
|
33509
|
-
}
|
|
33510
33974
|
function normalizeValue(value) {
|
|
33511
33975
|
if (value === false || value == null) {
|
|
33512
33976
|
return value;
|
|
@@ -34199,7 +34663,7 @@ var require_axios = __commonJS({
|
|
|
34199
34663
|
}
|
|
34200
34664
|
return !isNumericKey;
|
|
34201
34665
|
}
|
|
34202
|
-
if (!target
|
|
34666
|
+
if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
|
|
34203
34667
|
target[name] = [];
|
|
34204
34668
|
}
|
|
34205
34669
|
const result = buildPath(path29, value, target[name], index);
|
|
@@ -34444,12 +34908,12 @@ var require_axios = __commonJS({
|
|
|
34444
34908
|
function getEnv(key) {
|
|
34445
34909
|
return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || "";
|
|
34446
34910
|
}
|
|
34447
|
-
var VERSION = "1.16.
|
|
34911
|
+
var VERSION = "1.16.1";
|
|
34448
34912
|
function parseProtocol(url3) {
|
|
34449
34913
|
const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url3);
|
|
34450
34914
|
return match && match[1] || "";
|
|
34451
34915
|
}
|
|
34452
|
-
var DATA_URL_PATTERN = /^(
|
|
34916
|
+
var DATA_URL_PATTERN = /^([^,;]+\/[^,;]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;
|
|
34453
34917
|
function fromDataURI(uri, asBlob, options) {
|
|
34454
34918
|
const _Blob = options && options.Blob || platform2.classes.Blob;
|
|
34455
34919
|
const protocol = parseProtocol(uri);
|
|
@@ -34462,10 +34926,17 @@ var require_axios = __commonJS({
|
|
|
34462
34926
|
if (!match) {
|
|
34463
34927
|
throw new AxiosError("Invalid URL", AxiosError.ERR_INVALID_URL);
|
|
34464
34928
|
}
|
|
34465
|
-
const
|
|
34466
|
-
const
|
|
34467
|
-
const
|
|
34468
|
-
const
|
|
34929
|
+
const type = match[1];
|
|
34930
|
+
const params = match[2];
|
|
34931
|
+
const encoding = match[3] ? "base64" : "utf8";
|
|
34932
|
+
const body = match[4];
|
|
34933
|
+
let mime;
|
|
34934
|
+
if (type) {
|
|
34935
|
+
mime = params ? type + params : type;
|
|
34936
|
+
} else if (params) {
|
|
34937
|
+
mime = "text/plain" + params;
|
|
34938
|
+
}
|
|
34939
|
+
const buffer = Buffer.from(decodeURIComponent(body), encoding);
|
|
34469
34940
|
if (asBlob) {
|
|
34470
34941
|
if (!_Blob) {
|
|
34471
34942
|
throw new AxiosError("Blob is not supported", AxiosError.ERR_NOT_SUPPORT);
|
|
@@ -34903,6 +35374,9 @@ var require_axios = __commonJS({
|
|
|
34903
35374
|
let bytesNotified = 0;
|
|
34904
35375
|
const _speedometer = speedometer(50, 250);
|
|
34905
35376
|
return throttle((e) => {
|
|
35377
|
+
if (!e || typeof e.loaded !== "number") {
|
|
35378
|
+
return;
|
|
35379
|
+
}
|
|
34906
35380
|
const rawLoaded = e.loaded;
|
|
34907
35381
|
const total = e.lengthComputable ? e.total : void 0;
|
|
34908
35382
|
const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
|
|
@@ -35031,6 +35505,23 @@ var require_axios = __commonJS({
|
|
|
35031
35505
|
}
|
|
35032
35506
|
var kAxiosSocketListener = /* @__PURE__ */ Symbol("axios.http.socketListener");
|
|
35033
35507
|
var kAxiosCurrentReq = /* @__PURE__ */ Symbol("axios.http.currentReq");
|
|
35508
|
+
var kAxiosInstalledTunnel = /* @__PURE__ */ Symbol("axios.http.installedTunnel");
|
|
35509
|
+
var tunnelingAgentCache = /* @__PURE__ */ new Map();
|
|
35510
|
+
var tunnelingAgentCacheUser = /* @__PURE__ */ new WeakMap();
|
|
35511
|
+
function getTunnelingAgent(agentOptions, userHttpsAgent) {
|
|
35512
|
+
const key = agentOptions.protocol + "//" + agentOptions.hostname + ":" + (agentOptions.port || "") + "#" + (agentOptions.auth || "");
|
|
35513
|
+
const cache = userHttpsAgent ? tunnelingAgentCacheUser.get(userHttpsAgent) || tunnelingAgentCacheUser.set(userHttpsAgent, /* @__PURE__ */ new Map()).get(userHttpsAgent) : tunnelingAgentCache;
|
|
35514
|
+
let agent = cache.get(key);
|
|
35515
|
+
if (agent) return agent;
|
|
35516
|
+
const merged = userHttpsAgent && userHttpsAgent.options ? {
|
|
35517
|
+
...userHttpsAgent.options,
|
|
35518
|
+
...agentOptions
|
|
35519
|
+
} : agentOptions;
|
|
35520
|
+
agent = new HttpsProxyAgent(merged);
|
|
35521
|
+
agent[kAxiosInstalledTunnel] = true;
|
|
35522
|
+
cache.set(key, agent);
|
|
35523
|
+
return agent;
|
|
35524
|
+
}
|
|
35034
35525
|
var supportedProtocols = platform2.protocols.map((protocol) => {
|
|
35035
35526
|
return protocol + ":";
|
|
35036
35527
|
});
|
|
@@ -35128,7 +35619,7 @@ var require_axios = __commonJS({
|
|
|
35128
35619
|
options.beforeRedirects.config(options, responseDetails, requestDetails);
|
|
35129
35620
|
}
|
|
35130
35621
|
}
|
|
35131
|
-
function setProxy(options, configProxy, location, isRedirect) {
|
|
35622
|
+
function setProxy(options, configProxy, location, isRedirect, configHttpsAgent) {
|
|
35132
35623
|
let proxy = configProxy;
|
|
35133
35624
|
if (!proxy && proxy !== false) {
|
|
35134
35625
|
const proxyUrl = getProxyForUrl(location);
|
|
@@ -35145,6 +35636,9 @@ var require_axios = __commonJS({
|
|
|
35145
35636
|
}
|
|
35146
35637
|
}
|
|
35147
35638
|
}
|
|
35639
|
+
if (isRedirect && options.agent && options.agent[kAxiosInstalledTunnel]) {
|
|
35640
|
+
options.agent = void 0;
|
|
35641
|
+
}
|
|
35148
35642
|
if (proxy) {
|
|
35149
35643
|
const isProxyURL = proxy instanceof URL;
|
|
35150
35644
|
const readProxyField = (key) => isProxyURL || utils$1.hasOwnProp(proxy, key) ? proxy[key] : void 0;
|
|
@@ -35166,31 +35660,59 @@ var require_axios = __commonJS({
|
|
|
35166
35660
|
proxy
|
|
35167
35661
|
});
|
|
35168
35662
|
}
|
|
35169
|
-
const base643 = Buffer.from(proxyAuth, "utf8").toString("base64");
|
|
35170
|
-
options.headers["Proxy-Authorization"] = "Basic " + base643;
|
|
35171
35663
|
}
|
|
35172
|
-
|
|
35173
|
-
|
|
35174
|
-
if (
|
|
35175
|
-
|
|
35176
|
-
|
|
35664
|
+
const targetIsHttps = isHttps.test(options.protocol);
|
|
35665
|
+
if (targetIsHttps) {
|
|
35666
|
+
if (!(configHttpsAgent instanceof HttpsProxyAgent)) {
|
|
35667
|
+
const proxyHost = readProxyField("hostname") || readProxyField("host");
|
|
35668
|
+
const proxyPort = readProxyField("port");
|
|
35669
|
+
const rawProxyProtocol = readProxyField("protocol");
|
|
35670
|
+
const normalizedProtocol = rawProxyProtocol ? rawProxyProtocol.includes(":") ? rawProxyProtocol : `${rawProxyProtocol}:` : "http:";
|
|
35671
|
+
const proxyHostForURL = proxyHost && proxyHost.includes(":") && !proxyHost.startsWith("[") ? `[${proxyHost}]` : proxyHost;
|
|
35672
|
+
const proxyURL = new URL(`${normalizedProtocol}//${proxyHostForURL}${proxyPort ? ":" + proxyPort : ""}`);
|
|
35673
|
+
const agentOptions = {
|
|
35674
|
+
protocol: proxyURL.protocol,
|
|
35675
|
+
hostname: proxyURL.hostname.replace(/^\[|\]$/g, ""),
|
|
35676
|
+
port: proxyURL.port,
|
|
35677
|
+
auth: proxyAuth && typeof proxyAuth === "string" ? proxyAuth : void 0
|
|
35678
|
+
};
|
|
35679
|
+
if (proxyURL.protocol === "https:") {
|
|
35680
|
+
agentOptions.ALPNProtocols = ["http/1.1"];
|
|
35681
|
+
}
|
|
35682
|
+
const tunnelingAgent = getTunnelingAgent(agentOptions, configHttpsAgent);
|
|
35683
|
+
options.agent = tunnelingAgent;
|
|
35684
|
+
if (options.agents) {
|
|
35685
|
+
options.agents.https = tunnelingAgent;
|
|
35686
|
+
}
|
|
35687
|
+
}
|
|
35688
|
+
} else {
|
|
35689
|
+
if (proxyAuth) {
|
|
35690
|
+
const base643 = Buffer.from(proxyAuth, "utf8").toString("base64");
|
|
35691
|
+
options.headers["Proxy-Authorization"] = "Basic " + base643;
|
|
35692
|
+
}
|
|
35693
|
+
let hasUserHostHeader = false;
|
|
35694
|
+
for (const name of Object.keys(options.headers)) {
|
|
35695
|
+
if (name.toLowerCase() === "host") {
|
|
35696
|
+
hasUserHostHeader = true;
|
|
35697
|
+
break;
|
|
35698
|
+
}
|
|
35699
|
+
}
|
|
35700
|
+
if (!hasUserHostHeader) {
|
|
35701
|
+
options.headers.host = options.hostname + (options.port ? ":" + options.port : "");
|
|
35702
|
+
}
|
|
35703
|
+
const proxyHost = readProxyField("hostname") || readProxyField("host");
|
|
35704
|
+
options.hostname = proxyHost;
|
|
35705
|
+
options.host = proxyHost;
|
|
35706
|
+
options.port = readProxyField("port");
|
|
35707
|
+
options.path = location;
|
|
35708
|
+
const proxyProtocol = readProxyField("protocol");
|
|
35709
|
+
if (proxyProtocol) {
|
|
35710
|
+
options.protocol = proxyProtocol.includes(":") ? proxyProtocol : `${proxyProtocol}:`;
|
|
35177
35711
|
}
|
|
35178
|
-
}
|
|
35179
|
-
if (!hasUserHostHeader) {
|
|
35180
|
-
options.headers.host = options.hostname + (options.port ? ":" + options.port : "");
|
|
35181
|
-
}
|
|
35182
|
-
const proxyHost = readProxyField("hostname") || readProxyField("host");
|
|
35183
|
-
options.hostname = proxyHost;
|
|
35184
|
-
options.host = proxyHost;
|
|
35185
|
-
options.port = readProxyField("port");
|
|
35186
|
-
options.path = location;
|
|
35187
|
-
const proxyProtocol = readProxyField("protocol");
|
|
35188
|
-
if (proxyProtocol) {
|
|
35189
|
-
options.protocol = proxyProtocol.includes(":") ? proxyProtocol : `${proxyProtocol}:`;
|
|
35190
35712
|
}
|
|
35191
35713
|
}
|
|
35192
35714
|
options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {
|
|
35193
|
-
setProxy(redirectOptions, configProxy, redirectOptions.href, true);
|
|
35715
|
+
setProxy(redirectOptions, configProxy, redirectOptions.href, true, configHttpsAgent);
|
|
35194
35716
|
};
|
|
35195
35717
|
}
|
|
35196
35718
|
var isHttpAdapterSupported = typeof process !== "undefined" && utils$1.kindOf(process) === "process";
|
|
@@ -35495,7 +36017,7 @@ var require_axios = __commonJS({
|
|
|
35495
36017
|
const options = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
35496
36018
|
path: path$1,
|
|
35497
36019
|
method,
|
|
35498
|
-
headers: headers
|
|
36020
|
+
headers: toByteStringHeaderObject(headers),
|
|
35499
36021
|
agents: {
|
|
35500
36022
|
http: config2.httpAgent,
|
|
35501
36023
|
https: config2.httpsAgent
|
|
@@ -35524,12 +36046,14 @@ var require_axios = __commonJS({
|
|
|
35524
36046
|
} else {
|
|
35525
36047
|
options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
|
|
35526
36048
|
options.port = parsed.port;
|
|
35527
|
-
setProxy(options, config2.proxy, protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path);
|
|
36049
|
+
setProxy(options, config2.proxy, protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path, false, config2.httpsAgent);
|
|
35528
36050
|
}
|
|
35529
36051
|
let transport;
|
|
35530
36052
|
let isNativeTransport = false;
|
|
35531
36053
|
const isHttpsRequest = isHttps.test(options.protocol);
|
|
35532
|
-
options.agent
|
|
36054
|
+
if (options.agent == null) {
|
|
36055
|
+
options.agent = isHttpsRequest ? config2.httpsAgent : config2.httpAgent;
|
|
36056
|
+
}
|
|
35533
36057
|
if (isHttp2) {
|
|
35534
36058
|
transport = http2Transport;
|
|
35535
36059
|
} else {
|
|
@@ -36051,7 +36575,7 @@ var require_axios = __commonJS({
|
|
|
36051
36575
|
};
|
|
36052
36576
|
requestData === void 0 && requestHeaders.setContentType(null);
|
|
36053
36577
|
if ("setRequestHeader" in request) {
|
|
36054
|
-
utils$1.forEach(requestHeaders
|
|
36578
|
+
utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
|
|
36055
36579
|
request.setRequestHeader(key, val);
|
|
36056
36580
|
});
|
|
36057
36581
|
}
|
|
@@ -36094,41 +36618,41 @@ var require_axios = __commonJS({
|
|
|
36094
36618
|
});
|
|
36095
36619
|
};
|
|
36096
36620
|
var composeSignals = (signals2, timeout) => {
|
|
36097
|
-
|
|
36098
|
-
|
|
36099
|
-
|
|
36100
|
-
if (timeout || length) {
|
|
36101
|
-
let controller = new AbortController();
|
|
36102
|
-
let aborted2;
|
|
36103
|
-
const onabort = function(reason) {
|
|
36104
|
-
if (!aborted2) {
|
|
36105
|
-
aborted2 = true;
|
|
36106
|
-
unsubscribe();
|
|
36107
|
-
const err = reason instanceof Error ? reason : this.reason;
|
|
36108
|
-
controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
|
|
36109
|
-
}
|
|
36110
|
-
};
|
|
36111
|
-
let timer = timeout && setTimeout(() => {
|
|
36112
|
-
timer = null;
|
|
36113
|
-
onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
|
|
36114
|
-
}, timeout);
|
|
36115
|
-
const unsubscribe = () => {
|
|
36116
|
-
if (signals2) {
|
|
36117
|
-
timer && clearTimeout(timer);
|
|
36118
|
-
timer = null;
|
|
36119
|
-
signals2.forEach((signal2) => {
|
|
36120
|
-
signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
|
|
36121
|
-
});
|
|
36122
|
-
signals2 = null;
|
|
36123
|
-
}
|
|
36124
|
-
};
|
|
36125
|
-
signals2.forEach((signal2) => signal2.addEventListener("abort", onabort));
|
|
36126
|
-
const {
|
|
36127
|
-
signal
|
|
36128
|
-
} = controller;
|
|
36129
|
-
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
36130
|
-
return signal;
|
|
36621
|
+
signals2 = signals2 ? signals2.filter(Boolean) : [];
|
|
36622
|
+
if (!timeout && !signals2.length) {
|
|
36623
|
+
return;
|
|
36131
36624
|
}
|
|
36625
|
+
const controller = new AbortController();
|
|
36626
|
+
let aborted2 = false;
|
|
36627
|
+
const onabort = function(reason) {
|
|
36628
|
+
if (!aborted2) {
|
|
36629
|
+
aborted2 = true;
|
|
36630
|
+
unsubscribe();
|
|
36631
|
+
const err = reason instanceof Error ? reason : this.reason;
|
|
36632
|
+
controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
|
|
36633
|
+
}
|
|
36634
|
+
};
|
|
36635
|
+
let timer = timeout && setTimeout(() => {
|
|
36636
|
+
timer = null;
|
|
36637
|
+
onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
|
|
36638
|
+
}, timeout);
|
|
36639
|
+
const unsubscribe = () => {
|
|
36640
|
+
if (!signals2) {
|
|
36641
|
+
return;
|
|
36642
|
+
}
|
|
36643
|
+
timer && clearTimeout(timer);
|
|
36644
|
+
timer = null;
|
|
36645
|
+
signals2.forEach((signal2) => {
|
|
36646
|
+
signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
|
|
36647
|
+
});
|
|
36648
|
+
signals2 = null;
|
|
36649
|
+
};
|
|
36650
|
+
signals2.forEach((signal2) => signal2.addEventListener("abort", onabort));
|
|
36651
|
+
const {
|
|
36652
|
+
signal
|
|
36653
|
+
} = controller;
|
|
36654
|
+
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
36655
|
+
return signal;
|
|
36132
36656
|
};
|
|
36133
36657
|
var streamChunk = function* (chunk, chunkSize) {
|
|
36134
36658
|
let len = chunk.byteLength;
|
|
@@ -36223,8 +36747,7 @@ var require_axios = __commonJS({
|
|
|
36223
36747
|
}
|
|
36224
36748
|
};
|
|
36225
36749
|
var factory = (env) => {
|
|
36226
|
-
|
|
36227
|
-
const globalObject = (_utils$global = utils$1.global) !== null && _utils$global !== void 0 ? _utils$global : globalThis;
|
|
36750
|
+
const globalObject = utils$1.global !== void 0 && utils$1.global !== null ? utils$1.global : globalThis;
|
|
36228
36751
|
const {
|
|
36229
36752
|
ReadableStream: ReadableStream2,
|
|
36230
36753
|
TextEncoder: TextEncoder2
|
|
@@ -36377,7 +36900,7 @@ var require_axios = __commonJS({
|
|
|
36377
36900
|
...fetchOptions,
|
|
36378
36901
|
signal: composedSignal,
|
|
36379
36902
|
method: method.toUpperCase(),
|
|
36380
|
-
headers: headers.normalize()
|
|
36903
|
+
headers: toByteStringHeaderObject(headers.normalize()),
|
|
36381
36904
|
body: data,
|
|
36382
36905
|
duplex: "half",
|
|
36383
36906
|
credentials: isCredentialsSupported ? withCredentials : void 0
|
|
@@ -37369,7 +37892,7 @@ var require_priority_queue = __commonJS({
|
|
|
37369
37892
|
});
|
|
37370
37893
|
|
|
37371
37894
|
// node_modules/p-queue/dist/index.js
|
|
37372
|
-
var
|
|
37895
|
+
var require_dist4 = __commonJS({
|
|
37373
37896
|
"node_modules/p-queue/dist/index.js"(exports2) {
|
|
37374
37897
|
"use strict";
|
|
37375
37898
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -38749,7 +39272,7 @@ var require_views = __commonJS({
|
|
|
38749
39272
|
});
|
|
38750
39273
|
|
|
38751
39274
|
// node_modules/@slack/types/dist/index.js
|
|
38752
|
-
var
|
|
39275
|
+
var require_dist5 = __commonJS({
|
|
38753
39276
|
"node_modules/@slack/types/dist/index.js"(exports2) {
|
|
38754
39277
|
"use strict";
|
|
38755
39278
|
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m2, k2, k22) {
|
|
@@ -40414,7 +40937,7 @@ var require_methods = __commonJS({
|
|
|
40414
40937
|
}
|
|
40415
40938
|
};
|
|
40416
40939
|
exports2.Methods = Methods;
|
|
40417
|
-
__exportStar(
|
|
40940
|
+
__exportStar(require_dist5(), exports2);
|
|
40418
40941
|
}
|
|
40419
40942
|
});
|
|
40420
40943
|
|
|
@@ -40547,7 +41070,7 @@ var require_WebClient = __commonJS({
|
|
|
40547
41070
|
var form_data_1 = __importDefault(require_form_data());
|
|
40548
41071
|
var is_electron_1 = __importDefault(require_is_electron());
|
|
40549
41072
|
var is_stream_1 = __importDefault(require_is_stream());
|
|
40550
|
-
var p_queue_1 = __importDefault(
|
|
41073
|
+
var p_queue_1 = __importDefault(require_dist4());
|
|
40551
41074
|
var p_retry_1 = __importStar(require_p_retry());
|
|
40552
41075
|
var chat_stream_1 = require_chat_stream();
|
|
40553
41076
|
var errors_1 = require_errors2();
|
|
@@ -41148,7 +41671,7 @@ var require_WebClient = __commonJS({
|
|
|
41148
41671
|
});
|
|
41149
41672
|
|
|
41150
41673
|
// node_modules/@slack/web-api/dist/index.js
|
|
41151
|
-
var
|
|
41674
|
+
var require_dist6 = __commonJS({
|
|
41152
41675
|
"node_modules/@slack/web-api/dist/index.js"(exports2) {
|
|
41153
41676
|
"use strict";
|
|
41154
41677
|
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m2, k2, k22) {
|
|
@@ -41218,7 +41741,7 @@ var import_web_api, SlackWebApiClient;
|
|
|
41218
41741
|
var init_local_runtime2 = __esm({
|
|
41219
41742
|
"packages/slack-primitive/src/local-runtime.ts"() {
|
|
41220
41743
|
"use strict";
|
|
41221
|
-
import_web_api = __toESM(
|
|
41744
|
+
import_web_api = __toESM(require_dist6(), 1);
|
|
41222
41745
|
init_adapter2();
|
|
41223
41746
|
init_types2();
|
|
41224
41747
|
SlackWebApiClient = class extends BaseSlackAdapter {
|
|
@@ -43070,6 +43593,7 @@ __export(index_exports, {
|
|
|
43070
43593
|
findGitRoot: () => findGitRoot,
|
|
43071
43594
|
findLocalSdkWorkspace: () => findLocalSdkWorkspace,
|
|
43072
43595
|
findPersona: () => findPersona,
|
|
43596
|
+
findPrUrl: () => findPrUrl,
|
|
43073
43597
|
findRelayPtyBinary: () => findRelayPtyBinary,
|
|
43074
43598
|
followLogs: () => followLogs,
|
|
43075
43599
|
formatDryRunReport: () => formatDryRunReport,
|
|
@@ -50446,7 +50970,7 @@ var DefaultModels = {
|
|
|
50446
50970
|
};
|
|
50447
50971
|
|
|
50448
50972
|
// node_modules/@relaycast/sdk/dist/version.js
|
|
50449
|
-
var SDK_VERSION = "1.1.
|
|
50973
|
+
var SDK_VERSION = "1.1.7";
|
|
50450
50974
|
|
|
50451
50975
|
// node_modules/@relaycast/sdk/node_modules/zod/v4/classic/external.js
|
|
50452
50976
|
var external_exports2 = {};
|
|
@@ -65436,6 +65960,7 @@ var ChannelMessagePayloadSchema = CoreMessagePayloadSchema.extend({
|
|
|
65436
65960
|
attachments: external_exports2.array(FileAttachmentSchema)
|
|
65437
65961
|
});
|
|
65438
65962
|
var MessageCreatedEventSchema = external_exports2.object({
|
|
65963
|
+
id: external_exports2.string().uuid(),
|
|
65439
65964
|
type: external_exports2.literal("message.created"),
|
|
65440
65965
|
channel: external_exports2.string(),
|
|
65441
65966
|
message: ChannelMessagePayloadSchema
|
|
@@ -65446,6 +65971,7 @@ var MessageUpdatedEventSchema = external_exports2.object({
|
|
|
65446
65971
|
message: CoreMessagePayloadSchema
|
|
65447
65972
|
});
|
|
65448
65973
|
var ThreadReplyEventSchema = external_exports2.object({
|
|
65974
|
+
id: external_exports2.string().uuid(),
|
|
65449
65975
|
type: external_exports2.literal("thread.reply"),
|
|
65450
65976
|
channel: external_exports2.string(),
|
|
65451
65977
|
parent_id: external_exports2.string(),
|
|
@@ -65464,11 +65990,13 @@ var ReactionRemovedEventSchema = external_exports2.object({
|
|
|
65464
65990
|
agent_name: external_exports2.string()
|
|
65465
65991
|
});
|
|
65466
65992
|
var DmReceivedEventSchema = external_exports2.object({
|
|
65993
|
+
id: external_exports2.string().uuid(),
|
|
65467
65994
|
type: external_exports2.literal("dm.received"),
|
|
65468
65995
|
conversation_id: external_exports2.string(),
|
|
65469
65996
|
message: CoreMessagePayloadSchema
|
|
65470
65997
|
});
|
|
65471
65998
|
var GroupDmReceivedEventSchema = external_exports2.object({
|
|
65999
|
+
id: external_exports2.string().uuid(),
|
|
65472
66000
|
type: external_exports2.literal("group_dm.received"),
|
|
65473
66001
|
conversation_id: external_exports2.string(),
|
|
65474
66002
|
message: CoreMessagePayloadSchema
|
|
@@ -65599,6 +66127,12 @@ var ServerEventSchema = external_exports2.discriminatedUnion("type", [
|
|
|
65599
66127
|
CommandInvokedEventSchema,
|
|
65600
66128
|
PongEventSchema
|
|
65601
66129
|
]);
|
|
66130
|
+
var RelaycastMessageEventSchema = external_exports2.discriminatedUnion("type", [
|
|
66131
|
+
MessageCreatedEventSchema,
|
|
66132
|
+
ThreadReplyEventSchema,
|
|
66133
|
+
DmReceivedEventSchema,
|
|
66134
|
+
GroupDmReceivedEventSchema
|
|
66135
|
+
]);
|
|
65602
66136
|
var WsClientEventSchema = external_exports2.discriminatedUnion("type", [
|
|
65603
66137
|
// Server events
|
|
65604
66138
|
MessageCreatedEventSchema,
|
|
@@ -66147,6 +66681,9 @@ var WsClient = class {
|
|
|
66147
66681
|
off(event, handler) {
|
|
66148
66682
|
this.handlers.get(event)?.delete(handler);
|
|
66149
66683
|
}
|
|
66684
|
+
get connected() {
|
|
66685
|
+
return this.isOpen;
|
|
66686
|
+
}
|
|
66150
66687
|
emit(event, data) {
|
|
66151
66688
|
this.handlers.get(event)?.forEach((h) => h(data));
|
|
66152
66689
|
this.handlers.get("*")?.forEach((h) => h(data));
|
|
@@ -66213,6 +66750,55 @@ var WsClient = class {
|
|
|
66213
66750
|
}
|
|
66214
66751
|
};
|
|
66215
66752
|
|
|
66753
|
+
// node_modules/@relaycast/sdk/dist/event-id.js
|
|
66754
|
+
function hashStringParts(parts) {
|
|
66755
|
+
const input = JSON.stringify(parts);
|
|
66756
|
+
let h1 = 3735928559;
|
|
66757
|
+
let h2 = 1103547991;
|
|
66758
|
+
let h3 = 3235826430;
|
|
66759
|
+
let h4 = 2654435769;
|
|
66760
|
+
for (let i = 0; i < input.length; i += 1) {
|
|
66761
|
+
const code = input.charCodeAt(i);
|
|
66762
|
+
h1 = Math.imul(h1 ^ code, 2654435761);
|
|
66763
|
+
h2 = Math.imul(h2 ^ code, 1597334677);
|
|
66764
|
+
h3 = Math.imul(h3 ^ code, 2246822507);
|
|
66765
|
+
h4 = Math.imul(h4 ^ code, 3266489909);
|
|
66766
|
+
}
|
|
66767
|
+
h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507) ^ Math.imul(h2 ^ h2 >>> 13, 3266489909);
|
|
66768
|
+
h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507) ^ Math.imul(h3 ^ h3 >>> 13, 3266489909);
|
|
66769
|
+
h3 = Math.imul(h3 ^ h3 >>> 16, 2246822507) ^ Math.imul(h4 ^ h4 >>> 13, 3266489909);
|
|
66770
|
+
h4 = Math.imul(h4 ^ h4 >>> 16, 2246822507) ^ Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
66771
|
+
return [h1 >>> 0, h2 >>> 0, h3 >>> 0, h4 >>> 0];
|
|
66772
|
+
}
|
|
66773
|
+
function formatUuidFromWords(words) {
|
|
66774
|
+
const bytes = new Uint8Array(16);
|
|
66775
|
+
for (let i = 0; i < words.length; i += 1) {
|
|
66776
|
+
const word = words[i];
|
|
66777
|
+
const offset = i * 4;
|
|
66778
|
+
bytes[offset] = word >>> 24 & 255;
|
|
66779
|
+
bytes[offset + 1] = word >>> 16 & 255;
|
|
66780
|
+
bytes[offset + 2] = word >>> 8 & 255;
|
|
66781
|
+
bytes[offset + 3] = word & 255;
|
|
66782
|
+
}
|
|
66783
|
+
bytes[6] = bytes[6] & 15 | 80;
|
|
66784
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
66785
|
+
const hex3 = [...bytes].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
66786
|
+
return [
|
|
66787
|
+
hex3.slice(0, 8),
|
|
66788
|
+
hex3.slice(8, 12),
|
|
66789
|
+
hex3.slice(12, 16),
|
|
66790
|
+
hex3.slice(16, 20),
|
|
66791
|
+
hex3.slice(20, 32)
|
|
66792
|
+
].join("-");
|
|
66793
|
+
}
|
|
66794
|
+
function stableRelaycastEventId(...parts) {
|
|
66795
|
+
const normalized = parts.map((part) => part?.trim()).filter((part) => typeof part === "string" && part.length > 0);
|
|
66796
|
+
if (normalized.length === 0) {
|
|
66797
|
+
return formatUuidFromWords(hashStringParts(["relaycast", "empty-event"]));
|
|
66798
|
+
}
|
|
66799
|
+
return formatUuidFromWords(hashStringParts(["relaycast", ...normalized]));
|
|
66800
|
+
}
|
|
66801
|
+
|
|
66216
66802
|
// node_modules/@relaycast/sdk/dist/agent.js
|
|
66217
66803
|
function stripHash(channel) {
|
|
66218
66804
|
return channel.startsWith("#") ? channel.slice(1) : channel;
|
|
@@ -66241,6 +66827,21 @@ function idempotencyHeaders(opts) {
|
|
|
66241
66827
|
}
|
|
66242
66828
|
};
|
|
66243
66829
|
}
|
|
66830
|
+
function normalizeSubscriptionChannel(channel) {
|
|
66831
|
+
const trimmed = channel.trim();
|
|
66832
|
+
if (trimmed === "@self")
|
|
66833
|
+
return trimmed;
|
|
66834
|
+
return stripHash(trimmed);
|
|
66835
|
+
}
|
|
66836
|
+
function ensureRelaycastMessageEventId(event) {
|
|
66837
|
+
if (typeof event.id === "string" && event.id.length > 0) {
|
|
66838
|
+
return event;
|
|
66839
|
+
}
|
|
66840
|
+
return {
|
|
66841
|
+
...event,
|
|
66842
|
+
id: stableRelaycastEventId(event.message.id)
|
|
66843
|
+
};
|
|
66844
|
+
}
|
|
66244
66845
|
var AgentClient = class {
|
|
66245
66846
|
client;
|
|
66246
66847
|
ws = null;
|
|
@@ -66248,6 +66849,9 @@ var AgentClient = class {
|
|
|
66248
66849
|
autoHeartbeatTimer = null;
|
|
66249
66850
|
pendingHeartbeat = null;
|
|
66250
66851
|
wsOptions;
|
|
66852
|
+
manualSubscriptions = /* @__PURE__ */ new Set();
|
|
66853
|
+
managedSubscriptions = /* @__PURE__ */ new Map();
|
|
66854
|
+
activeWsChannels = /* @__PURE__ */ new Set();
|
|
66251
66855
|
constructor(client, options = {}) {
|
|
66252
66856
|
this.client = client;
|
|
66253
66857
|
this.autoHeartbeatMs = normalizeAutoHeartbeatMs(options.autoHeartbeatMs);
|
|
@@ -66305,12 +66909,15 @@ var AgentClient = class {
|
|
|
66305
66909
|
void this.presence.markOnline().catch(() => {
|
|
66306
66910
|
});
|
|
66307
66911
|
this.startAutoHeartbeat();
|
|
66912
|
+
this.syncDesiredSubscriptions({ resetRemoteState: true });
|
|
66308
66913
|
});
|
|
66309
66914
|
this.ws.on("close", () => {
|
|
66310
66915
|
this.stopAutoHeartbeat();
|
|
66916
|
+
this.activeWsChannels.clear();
|
|
66311
66917
|
});
|
|
66312
66918
|
this.ws.on("permanently_disconnected", () => {
|
|
66313
66919
|
this.stopAutoHeartbeat();
|
|
66920
|
+
this.activeWsChannels.clear();
|
|
66314
66921
|
});
|
|
66315
66922
|
this.ws.connect();
|
|
66316
66923
|
}
|
|
@@ -66324,18 +66931,80 @@ var AgentClient = class {
|
|
|
66324
66931
|
await this.pendingHeartbeat;
|
|
66325
66932
|
this.pendingHeartbeat = null;
|
|
66326
66933
|
}
|
|
66934
|
+
for (const subscription of this.managedSubscriptions.values()) {
|
|
66935
|
+
for (const stop of subscription.stops) {
|
|
66936
|
+
stop();
|
|
66937
|
+
}
|
|
66938
|
+
}
|
|
66939
|
+
this.managedSubscriptions.clear();
|
|
66940
|
+
this.manualSubscriptions.clear();
|
|
66327
66941
|
if (this.ws) {
|
|
66328
66942
|
this.ws.disconnect();
|
|
66329
66943
|
this.ws = null;
|
|
66330
66944
|
}
|
|
66945
|
+
this.activeWsChannels.clear();
|
|
66331
66946
|
await this.client.post("/v1/agents/disconnect", {}).catch(() => {
|
|
66332
66947
|
});
|
|
66333
66948
|
}
|
|
66334
|
-
subscribe(channels) {
|
|
66335
|
-
|
|
66949
|
+
subscribe(channels, onMessage) {
|
|
66950
|
+
const normalized = [...new Set(channels.map(normalizeSubscriptionChannel).filter(Boolean))];
|
|
66951
|
+
if (normalized.length === 0) {
|
|
66952
|
+
if (onMessage) {
|
|
66953
|
+
return { channels: [], unsubscribe() {
|
|
66954
|
+
} };
|
|
66955
|
+
}
|
|
66956
|
+
return;
|
|
66957
|
+
}
|
|
66958
|
+
if (!onMessage) {
|
|
66959
|
+
for (const channel of normalized) {
|
|
66960
|
+
this.manualSubscriptions.add(channel);
|
|
66961
|
+
}
|
|
66962
|
+
this.syncDesiredSubscriptions();
|
|
66963
|
+
return;
|
|
66964
|
+
}
|
|
66965
|
+
this.connect();
|
|
66966
|
+
const key = /* @__PURE__ */ Symbol("relaycast.subscription");
|
|
66967
|
+
const channelSet = new Set(normalized);
|
|
66968
|
+
const invoke = (event) => {
|
|
66969
|
+
if (!this.matchesSubscription(channelSet, event)) {
|
|
66970
|
+
return;
|
|
66971
|
+
}
|
|
66972
|
+
void Promise.resolve().then(() => onMessage(ensureRelaycastMessageEventId(event))).catch((err) => {
|
|
66973
|
+
console.error("[relaycast] Subscription handler failed", err);
|
|
66974
|
+
});
|
|
66975
|
+
};
|
|
66976
|
+
const stops = [
|
|
66977
|
+
this.on.messageCreated((event) => invoke(event)),
|
|
66978
|
+
this.on.threadReply((event) => invoke(event)),
|
|
66979
|
+
this.on.dmReceived((event) => invoke(event)),
|
|
66980
|
+
this.on.groupDmReceived((event) => invoke(event))
|
|
66981
|
+
];
|
|
66982
|
+
this.managedSubscriptions.set(key, {
|
|
66983
|
+
channels: channelSet,
|
|
66984
|
+
handler: onMessage,
|
|
66985
|
+
stops
|
|
66986
|
+
});
|
|
66987
|
+
this.syncDesiredSubscriptions();
|
|
66988
|
+
return {
|
|
66989
|
+
channels: Object.freeze([...normalized]),
|
|
66990
|
+
unsubscribe: () => {
|
|
66991
|
+
const current = this.managedSubscriptions.get(key);
|
|
66992
|
+
if (!current)
|
|
66993
|
+
return;
|
|
66994
|
+
this.managedSubscriptions.delete(key);
|
|
66995
|
+
for (const stop of current.stops) {
|
|
66996
|
+
stop();
|
|
66997
|
+
}
|
|
66998
|
+
this.syncDesiredSubscriptions();
|
|
66999
|
+
}
|
|
67000
|
+
};
|
|
66336
67001
|
}
|
|
66337
67002
|
unsubscribe(channels) {
|
|
66338
|
-
|
|
67003
|
+
const normalized = [...new Set(channels.map(normalizeSubscriptionChannel).filter(Boolean))];
|
|
67004
|
+
for (const channel of normalized) {
|
|
67005
|
+
this.manualSubscriptions.delete(channel);
|
|
67006
|
+
}
|
|
67007
|
+
this.syncDesiredSubscriptions();
|
|
66339
67008
|
}
|
|
66340
67009
|
onEvent(eventType, handler) {
|
|
66341
67010
|
if (!this.ws) {
|
|
@@ -66399,6 +67068,9 @@ var AgentClient = class {
|
|
|
66399
67068
|
};
|
|
66400
67069
|
return this.client.post(`/v1/channels/${encodeURIComponent(name)}/messages`, body, idempotencyHeaders(opts));
|
|
66401
67070
|
}
|
|
67071
|
+
post(channel, text, opts) {
|
|
67072
|
+
return this.send(channel, text, opts);
|
|
67073
|
+
}
|
|
66402
67074
|
async messages(channel, opts) {
|
|
66403
67075
|
const name = stripHash(channel);
|
|
66404
67076
|
const query = {};
|
|
@@ -66461,6 +67133,58 @@ var AgentClient = class {
|
|
|
66461
67133
|
addParticipant: (conversationId, agent) => this.client.post(`/v1/dm/${encodeURIComponent(conversationId)}/participants`, { agentName: agent }),
|
|
66462
67134
|
removeParticipant: (conversationId, agent) => this.client.delete(`/v1/dm/${encodeURIComponent(conversationId)}/participants/${encodeURIComponent(agent)}`)
|
|
66463
67135
|
};
|
|
67136
|
+
matchesSubscription(channels, event) {
|
|
67137
|
+
switch (event.type) {
|
|
67138
|
+
case "dm.received":
|
|
67139
|
+
case "group_dm.received":
|
|
67140
|
+
return channels.has("@self");
|
|
67141
|
+
case "message.created":
|
|
67142
|
+
case "thread.reply":
|
|
67143
|
+
return channels.has(stripHash(event.channel));
|
|
67144
|
+
default:
|
|
67145
|
+
return false;
|
|
67146
|
+
}
|
|
67147
|
+
}
|
|
67148
|
+
desiredWsChannels() {
|
|
67149
|
+
const desired = /* @__PURE__ */ new Set();
|
|
67150
|
+
for (const channel of this.manualSubscriptions) {
|
|
67151
|
+
if (channel !== "@self") {
|
|
67152
|
+
desired.add(channel);
|
|
67153
|
+
}
|
|
67154
|
+
}
|
|
67155
|
+
for (const subscription of this.managedSubscriptions.values()) {
|
|
67156
|
+
for (const channel of subscription.channels) {
|
|
67157
|
+
if (channel !== "@self") {
|
|
67158
|
+
desired.add(channel);
|
|
67159
|
+
}
|
|
67160
|
+
}
|
|
67161
|
+
}
|
|
67162
|
+
return desired;
|
|
67163
|
+
}
|
|
67164
|
+
syncDesiredSubscriptions(options = {}) {
|
|
67165
|
+
if (!this.ws) {
|
|
67166
|
+
return;
|
|
67167
|
+
}
|
|
67168
|
+
const desired = this.desiredWsChannels();
|
|
67169
|
+
if (!this.ws.connected) {
|
|
67170
|
+
if (options.resetRemoteState) {
|
|
67171
|
+
this.activeWsChannels.clear();
|
|
67172
|
+
}
|
|
67173
|
+
return;
|
|
67174
|
+
}
|
|
67175
|
+
if (options.resetRemoteState) {
|
|
67176
|
+
this.activeWsChannels.clear();
|
|
67177
|
+
}
|
|
67178
|
+
const toSubscribe = [...desired].filter((channel) => !this.activeWsChannels.has(channel));
|
|
67179
|
+
const toUnsubscribe = [...this.activeWsChannels].filter((channel) => !desired.has(channel));
|
|
67180
|
+
if (toSubscribe.length > 0) {
|
|
67181
|
+
this.ws.subscribe(toSubscribe);
|
|
67182
|
+
}
|
|
67183
|
+
if (toUnsubscribe.length > 0) {
|
|
67184
|
+
this.ws.unsubscribe(toUnsubscribe);
|
|
67185
|
+
}
|
|
67186
|
+
this.activeWsChannels = desired;
|
|
67187
|
+
}
|
|
66464
67188
|
// === Channels ===
|
|
66465
67189
|
channels = {
|
|
66466
67190
|
create: (data) => this.client.post("/v1/channels", data),
|
|
@@ -66557,6 +67281,10 @@ var RAW_CODE_MAP = {
|
|
|
66557
67281
|
agent_already_exists: "name_conflict",
|
|
66558
67282
|
not_found: "not_found",
|
|
66559
67283
|
agent_not_found: "not_found",
|
|
67284
|
+
rate_limit_exceeded: "rate_limited",
|
|
67285
|
+
backpressure: "backpressure",
|
|
67286
|
+
queue_overloaded: "backpressure",
|
|
67287
|
+
workspace_stream_backpressure: "backpressure",
|
|
66560
67288
|
unauthorized: "unauthorized",
|
|
66561
67289
|
workspace_mismatch: "workspace_mismatch",
|
|
66562
67290
|
workspace_not_found: "workspace_mismatch"
|
|
@@ -66572,12 +67300,18 @@ function normalizeRelayErrorCode(rawCode, statusCode) {
|
|
|
66572
67300
|
if (statusCode === 404) {
|
|
66573
67301
|
return "not_found";
|
|
66574
67302
|
}
|
|
67303
|
+
if (statusCode === 429) {
|
|
67304
|
+
return "rate_limited";
|
|
67305
|
+
}
|
|
66575
67306
|
if (statusCode === 409) {
|
|
66576
67307
|
return "name_conflict";
|
|
66577
67308
|
}
|
|
66578
67309
|
return "transport_error";
|
|
66579
67310
|
}
|
|
66580
67311
|
function relayErrorRetryable(code, statusCode) {
|
|
67312
|
+
if (code === "rate_limited" || code === "backpressure") {
|
|
67313
|
+
return true;
|
|
67314
|
+
}
|
|
66581
67315
|
if (code !== "transport_error") {
|
|
66582
67316
|
return false;
|
|
66583
67317
|
}
|
|
@@ -78611,6 +79345,14 @@ function runVerification(check2, output, stepName, injectedTaskText, options = {
|
|
|
78611
79345
|
}
|
|
78612
79346
|
break;
|
|
78613
79347
|
}
|
|
79348
|
+
case "pr_url": {
|
|
79349
|
+
const found = findPrUrl(output, check2.value, injectedTaskText);
|
|
79350
|
+
if (!found) {
|
|
79351
|
+
const repoQualifier = check2.value ? ` for repository "${check2.value}"` : "";
|
|
79352
|
+
return fail(`Verification failed for "${stepName}": step output does not contain a GitHub PR URL${repoQualifier}. Workers must open a pull request and include the URL in their output before reporting completion.`);
|
|
79353
|
+
}
|
|
79354
|
+
break;
|
|
79355
|
+
}
|
|
78614
79356
|
default:
|
|
78615
79357
|
break;
|
|
78616
79358
|
}
|
|
@@ -78663,6 +79405,24 @@ function checkOutputContains(output, token, injectedTaskText) {
|
|
|
78663
79405
|
}
|
|
78664
79406
|
return stripInjectedTaskEcho(output, injectedTaskText).includes(token);
|
|
78665
79407
|
}
|
|
79408
|
+
var PR_URL_PATTERN = /https?:\/\/github\.com\/([\w.-]+)\/([\w.-]+)\/pull\/(\d+)\b/gi;
|
|
79409
|
+
function findPrUrl(output, repoQualifier, injectedTaskText) {
|
|
79410
|
+
const sanitized = stripInjectedTaskEcho(output, injectedTaskText);
|
|
79411
|
+
const qualifier = repoQualifier?.trim().toLowerCase();
|
|
79412
|
+
PR_URL_PATTERN.lastIndex = 0;
|
|
79413
|
+
let match;
|
|
79414
|
+
while (match = PR_URL_PATTERN.exec(sanitized)) {
|
|
79415
|
+
if (!qualifier) {
|
|
79416
|
+
return match[0];
|
|
79417
|
+
}
|
|
79418
|
+
const owner = match[1]?.toLowerCase();
|
|
79419
|
+
const repo = match[2]?.toLowerCase();
|
|
79420
|
+
if (`${owner}/${repo}` === qualifier) {
|
|
79421
|
+
return match[0];
|
|
79422
|
+
}
|
|
79423
|
+
}
|
|
79424
|
+
return null;
|
|
79425
|
+
}
|
|
78666
79426
|
var DEFAULT_CUSTOM_VERIFY_TIMEOUT_MS = parseInt(process.env.CUSTOM_VERIFY_TIMEOUT_MS ?? "30000", 10);
|
|
78667
79427
|
var REGEX_PREFIX = "regex:";
|
|
78668
79428
|
function execCustomVerification(command, cwd, timeoutMs = DEFAULT_CUSTOM_VERIFY_TIMEOUT_MS) {
|
|
@@ -93531,6 +94291,7 @@ init_dist2();
|
|
|
93531
94291
|
findGitRoot,
|
|
93532
94292
|
findLocalSdkWorkspace,
|
|
93533
94293
|
findPersona,
|
|
94294
|
+
findPrUrl,
|
|
93534
94295
|
findRelayPtyBinary,
|
|
93535
94296
|
followLogs,
|
|
93536
94297
|
formatDryRunReport,
|
|
@@ -93666,5 +94427,5 @@ mime-types/index.js:
|
|
|
93666
94427
|
*)
|
|
93667
94428
|
|
|
93668
94429
|
axios/dist/node/axios.cjs:
|
|
93669
|
-
(*! Axios v1.16.
|
|
94430
|
+
(*! Axios v1.16.1 Copyright (c) 2026 Matt Zabriskie and contributors *)
|
|
93670
94431
|
*/
|