@swmansion/argent 0.16.2-next.1 → 0.16.2-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-cmds.mjs +1 -1
- package/dist/installer.mjs +1 -1
- package/dist/mcp-server.mjs +1 -1
- package/dist/tool-server.cjs +120 -79
- package/package.json +1 -1
package/dist/cli-cmds.mjs
CHANGED
|
@@ -6620,7 +6620,7 @@ var ALLOWED = {
|
|
|
6620
6620
|
},
|
|
6621
6621
|
"toolserver:start": {},
|
|
6622
6622
|
"toolserver:stop": {
|
|
6623
|
-
reason: oneOf(["idle", "signal", "crash"]),
|
|
6623
|
+
reason: oneOf(["idle", "signal", "crash", "deferred"]),
|
|
6624
6624
|
uptime_ms: DURATION_MS,
|
|
6625
6625
|
total_tool_calls: COUNT,
|
|
6626
6626
|
...FAILURE_SIGNAL,
|
package/dist/installer.mjs
CHANGED
|
@@ -16514,7 +16514,7 @@ var ALLOWED = {
|
|
|
16514
16514
|
},
|
|
16515
16515
|
"toolserver:start": {},
|
|
16516
16516
|
"toolserver:stop": {
|
|
16517
|
-
reason: oneOf(["idle", "signal", "crash"]),
|
|
16517
|
+
reason: oneOf(["idle", "signal", "crash", "deferred"]),
|
|
16518
16518
|
uptime_ms: DURATION_MS,
|
|
16519
16519
|
total_tool_calls: COUNT,
|
|
16520
16520
|
...FAILURE_SIGNAL,
|
package/dist/mcp-server.mjs
CHANGED
|
@@ -18067,7 +18067,7 @@ var ALLOWED = {
|
|
|
18067
18067
|
},
|
|
18068
18068
|
"toolserver:start": {},
|
|
18069
18069
|
"toolserver:stop": {
|
|
18070
|
-
reason: oneOf(["idle", "signal", "crash"]),
|
|
18070
|
+
reason: oneOf(["idle", "signal", "crash", "deferred"]),
|
|
18071
18071
|
uptime_ms: DURATION_MS,
|
|
18072
18072
|
total_tool_calls: COUNT,
|
|
18073
18073
|
...FAILURE_SIGNAL,
|
package/dist/tool-server.cjs
CHANGED
|
@@ -46737,7 +46737,7 @@ var require_application = __commonJS({
|
|
|
46737
46737
|
var finalhandler = require_finalhandler();
|
|
46738
46738
|
var debug = require_src()("express:application");
|
|
46739
46739
|
var View = require_view();
|
|
46740
|
-
var
|
|
46740
|
+
var http4 = require("node:http");
|
|
46741
46741
|
var methods = require_utils3().methods;
|
|
46742
46742
|
var compileETag = require_utils3().compileETag;
|
|
46743
46743
|
var compileQueryParser = require_utils3().compileQueryParser;
|
|
@@ -46970,7 +46970,7 @@ var require_application = __commonJS({
|
|
|
46970
46970
|
tryRender(view, renderOptions, done);
|
|
46971
46971
|
};
|
|
46972
46972
|
app.listen = function listen() {
|
|
46973
|
-
var server =
|
|
46973
|
+
var server = http4.createServer(this);
|
|
46974
46974
|
var args = slice.call(arguments);
|
|
46975
46975
|
if (typeof args[args.length - 1] === "function") {
|
|
46976
46976
|
var done = args[args.length - 1] = once(args[args.length - 1]);
|
|
@@ -47458,11 +47458,11 @@ var require_negotiator = __commonJS({
|
|
|
47458
47458
|
var preferredMediaTypes = require_mediaType();
|
|
47459
47459
|
module2.exports = Negotiator;
|
|
47460
47460
|
module2.exports.Negotiator = Negotiator;
|
|
47461
|
-
function Negotiator(
|
|
47461
|
+
function Negotiator(request3) {
|
|
47462
47462
|
if (!(this instanceof Negotiator)) {
|
|
47463
|
-
return new Negotiator(
|
|
47463
|
+
return new Negotiator(request3);
|
|
47464
47464
|
}
|
|
47465
|
-
this.request =
|
|
47465
|
+
this.request = request3;
|
|
47466
47466
|
}
|
|
47467
47467
|
Negotiator.prototype.charset = function charset(available) {
|
|
47468
47468
|
var set2 = this.charsets(available);
|
|
@@ -57250,12 +57250,12 @@ var require_request = __commonJS({
|
|
|
57250
57250
|
var accepts = require_accepts();
|
|
57251
57251
|
var isIP = require("node:net").isIP;
|
|
57252
57252
|
var typeis = require_type_is();
|
|
57253
|
-
var
|
|
57253
|
+
var http4 = require("node:http");
|
|
57254
57254
|
var fresh = require_fresh();
|
|
57255
57255
|
var parseRange = require_range_parser();
|
|
57256
57256
|
var parse4 = require_parseurl();
|
|
57257
57257
|
var proxyaddr = require_proxy_addr();
|
|
57258
|
-
var req = Object.create(
|
|
57258
|
+
var req = Object.create(http4.IncomingMessage.prototype);
|
|
57259
57259
|
module2.exports = req;
|
|
57260
57260
|
req.get = req.header = function header(name) {
|
|
57261
57261
|
if (!name) {
|
|
@@ -67854,7 +67854,7 @@ var require_response = __commonJS({
|
|
|
67854
67854
|
var deprecate = require_depd()("express");
|
|
67855
67855
|
var encodeUrl = require_encodeurl();
|
|
67856
67856
|
var escapeHtml = require_escape_html();
|
|
67857
|
-
var
|
|
67857
|
+
var http4 = require("node:http");
|
|
67858
67858
|
var onFinished = require_on_finished();
|
|
67859
67859
|
var mime = require_mime_types2();
|
|
67860
67860
|
var path36 = require("node:path");
|
|
@@ -67870,7 +67870,7 @@ var require_response = __commonJS({
|
|
|
67870
67870
|
var resolve7 = path36.resolve;
|
|
67871
67871
|
var vary = require_vary();
|
|
67872
67872
|
var { Buffer: Buffer2 } = require("node:buffer");
|
|
67873
|
-
var res = Object.create(
|
|
67873
|
+
var res = Object.create(http4.ServerResponse.prototype);
|
|
67874
67874
|
module2.exports = res;
|
|
67875
67875
|
res.status = function status(code) {
|
|
67876
67876
|
if (!Number.isInteger(code)) {
|
|
@@ -74627,12 +74627,12 @@ var require_service = __commonJS({
|
|
|
74627
74627
|
this.requestDelimited = Boolean(requestDelimited);
|
|
74628
74628
|
this.responseDelimited = Boolean(responseDelimited);
|
|
74629
74629
|
}
|
|
74630
|
-
Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor,
|
|
74631
|
-
if (!
|
|
74630
|
+
Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request3, callback) {
|
|
74631
|
+
if (!request3)
|
|
74632
74632
|
throw TypeError("request must be specified");
|
|
74633
74633
|
var self2 = this;
|
|
74634
74634
|
if (!callback)
|
|
74635
|
-
return util.asPromise(rpcCall, self2, method, requestCtor, responseCtor,
|
|
74635
|
+
return util.asPromise(rpcCall, self2, method, requestCtor, responseCtor, request3);
|
|
74636
74636
|
if (!self2.rpcImpl) {
|
|
74637
74637
|
setTimeout(function() {
|
|
74638
74638
|
callback(Error("already ended"));
|
|
@@ -74642,7 +74642,7 @@ var require_service = __commonJS({
|
|
|
74642
74642
|
try {
|
|
74643
74643
|
return self2.rpcImpl(
|
|
74644
74644
|
method,
|
|
74645
|
-
requestCtor[self2.requestDelimited ? "encodeDelimited" : "encode"](
|
|
74645
|
+
requestCtor[self2.requestDelimited ? "encodeDelimited" : "encode"](request3).finish(),
|
|
74646
74646
|
function rpcCallback(err, response) {
|
|
74647
74647
|
if (err) {
|
|
74648
74648
|
self2.emit("error", err, method);
|
|
@@ -75457,8 +75457,8 @@ var require_service2 = __commonJS({
|
|
|
75457
75457
|
this.methodsArray.length; ++i) {
|
|
75458
75458
|
var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\w_]/g, "");
|
|
75459
75459
|
rpcService[methodName] = /* @__PURE__ */ (function(method2, requestType, responseType) {
|
|
75460
|
-
return function rpcMethod(
|
|
75461
|
-
return rpc.Service.prototype.rpcCall.call(this, method2, requestType, responseType,
|
|
75460
|
+
return function rpcMethod(request3, callback) {
|
|
75461
|
+
return rpc.Service.prototype.rpcCall.call(this, method2, requestType, responseType, request3, callback);
|
|
75462
75462
|
};
|
|
75463
75463
|
})(method, method.resolvedRequestType.ctor, method.resolvedResponseType.ctor);
|
|
75464
75464
|
}
|
|
@@ -81142,7 +81142,7 @@ var require_websocket = __commonJS({
|
|
|
81142
81142
|
"use strict";
|
|
81143
81143
|
var EventEmitter2 = require("events");
|
|
81144
81144
|
var https = require("https");
|
|
81145
|
-
var
|
|
81145
|
+
var http4 = require("http");
|
|
81146
81146
|
var net6 = require("net");
|
|
81147
81147
|
var tls = require("tls");
|
|
81148
81148
|
var { randomBytes, createHash: createHash3 } = require("crypto");
|
|
@@ -81684,7 +81684,7 @@ var require_websocket = __commonJS({
|
|
|
81684
81684
|
}
|
|
81685
81685
|
const defaultPort = isSecure ? 443 : 80;
|
|
81686
81686
|
const key = randomBytes(16).toString("base64");
|
|
81687
|
-
const
|
|
81687
|
+
const request3 = isSecure ? https.request : http4.request;
|
|
81688
81688
|
const protocolSet = /* @__PURE__ */ new Set();
|
|
81689
81689
|
let perMessageDeflate;
|
|
81690
81690
|
opts.createConnection = opts.createConnection || (isSecure ? tlsConnect : netConnect);
|
|
@@ -81761,12 +81761,12 @@ var require_websocket = __commonJS({
|
|
|
81761
81761
|
if (opts.auth && !options.headers.authorization) {
|
|
81762
81762
|
options.headers.authorization = "Basic " + Buffer.from(opts.auth).toString("base64");
|
|
81763
81763
|
}
|
|
81764
|
-
req = websocket._req =
|
|
81764
|
+
req = websocket._req = request3(opts);
|
|
81765
81765
|
if (websocket._redirects) {
|
|
81766
81766
|
websocket.emit("redirect", websocket.url, req);
|
|
81767
81767
|
}
|
|
81768
81768
|
} else {
|
|
81769
|
-
req = websocket._req =
|
|
81769
|
+
req = websocket._req = request3(opts);
|
|
81770
81770
|
}
|
|
81771
81771
|
if (opts.timeout) {
|
|
81772
81772
|
req.on("timeout", () => {
|
|
@@ -82180,7 +82180,7 @@ var require_websocket_server = __commonJS({
|
|
|
82180
82180
|
"../../node_modules/ws/lib/websocket-server.js"(exports2, module2) {
|
|
82181
82181
|
"use strict";
|
|
82182
82182
|
var EventEmitter2 = require("events");
|
|
82183
|
-
var
|
|
82183
|
+
var http4 = require("http");
|
|
82184
82184
|
var { Duplex } = require("stream");
|
|
82185
82185
|
var { createHash: createHash3 } = require("crypto");
|
|
82186
82186
|
var extension2 = require_extension();
|
|
@@ -82261,8 +82261,8 @@ var require_websocket_server = __commonJS({
|
|
|
82261
82261
|
);
|
|
82262
82262
|
}
|
|
82263
82263
|
if (options.port != null) {
|
|
82264
|
-
this._server =
|
|
82265
|
-
const body =
|
|
82264
|
+
this._server = http4.createServer((req, res) => {
|
|
82265
|
+
const body = http4.STATUS_CODES[426];
|
|
82266
82266
|
res.writeHead(426, {
|
|
82267
82267
|
"Content-Length": body.length,
|
|
82268
82268
|
"Content-Type": "text/plain"
|
|
@@ -82551,7 +82551,7 @@ var require_websocket_server = __commonJS({
|
|
|
82551
82551
|
this.destroy();
|
|
82552
82552
|
}
|
|
82553
82553
|
function abortHandshake(socket, code, message, headers) {
|
|
82554
|
-
message = message ||
|
|
82554
|
+
message = message || http4.STATUS_CODES[code];
|
|
82555
82555
|
headers = {
|
|
82556
82556
|
Connection: "close",
|
|
82557
82557
|
"Content-Type": "text/html",
|
|
@@ -82560,7 +82560,7 @@ var require_websocket_server = __commonJS({
|
|
|
82560
82560
|
};
|
|
82561
82561
|
socket.once("finish", socket.destroy);
|
|
82562
82562
|
socket.end(
|
|
82563
|
-
`HTTP/1.1 ${code} ${
|
|
82563
|
+
`HTTP/1.1 ${code} ${http4.STATUS_CODES[code]}\r
|
|
82564
82564
|
` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message
|
|
82565
82565
|
);
|
|
82566
82566
|
}
|
|
@@ -103928,7 +103928,7 @@ var ALLOWED = {
|
|
|
103928
103928
|
},
|
|
103929
103929
|
"toolserver:start": {},
|
|
103930
103930
|
"toolserver:stop": {
|
|
103931
|
-
reason: oneOf(["idle", "signal", "crash"]),
|
|
103931
|
+
reason: oneOf(["idle", "signal", "crash", "deferred"]),
|
|
103932
103932
|
uptime_ms: DURATION_MS,
|
|
103933
103933
|
total_tool_calls: COUNT,
|
|
103934
103934
|
...FAILURE_SIGNAL2,
|
|
@@ -109786,22 +109786,22 @@ var Subscriber = class {
|
|
|
109786
109786
|
const broadcast = new Broadcast();
|
|
109787
109787
|
void (async () => {
|
|
109788
109788
|
for (; ; ) {
|
|
109789
|
-
const
|
|
109790
|
-
if (!
|
|
109789
|
+
const request3 = await broadcast.requested();
|
|
109790
|
+
if (!request3)
|
|
109791
109791
|
break;
|
|
109792
|
-
void this.#runSubscribe(path36,
|
|
109792
|
+
void this.#runSubscribe(path36, request3);
|
|
109793
109793
|
}
|
|
109794
109794
|
})();
|
|
109795
109795
|
return broadcast;
|
|
109796
109796
|
}
|
|
109797
|
-
async #runSubscribe(broadcast,
|
|
109797
|
+
async #runSubscribe(broadcast, request3) {
|
|
109798
109798
|
const version4 = this.#session.version;
|
|
109799
109799
|
const requestId = await this.#session.nextRequestId();
|
|
109800
109800
|
if (requestId === void 0) {
|
|
109801
|
-
|
|
109801
|
+
request3.track.close(new Error("session closed"));
|
|
109802
109802
|
return;
|
|
109803
109803
|
}
|
|
109804
|
-
console.debug(`subscribe start: id=${requestId} broadcast=${broadcast} track=${
|
|
109804
|
+
console.debug(`subscribe start: id=${requestId} broadcast=${broadcast} track=${request3.track.name}`);
|
|
109805
109805
|
try {
|
|
109806
109806
|
const stream = await this.#session.openBi();
|
|
109807
109807
|
try {
|
|
@@ -109809,22 +109809,22 @@ var Subscriber = class {
|
|
|
109809
109809
|
const msg = new Subscribe({
|
|
109810
109810
|
requestId,
|
|
109811
109811
|
trackNamespace: broadcast,
|
|
109812
|
-
trackName:
|
|
109813
|
-
subscriberPriority:
|
|
109812
|
+
trackName: request3.track.name,
|
|
109813
|
+
subscriberPriority: request3.priority
|
|
109814
109814
|
});
|
|
109815
109815
|
await msg.encode(stream.writer, version4);
|
|
109816
|
-
console.debug(`subscribe written: id=${requestId} broadcast=${broadcast} track=${
|
|
109817
|
-
this.#subscribes.set(requestId,
|
|
109816
|
+
console.debug(`subscribe written: id=${requestId} broadcast=${broadcast} track=${request3.track.name}`);
|
|
109817
|
+
this.#subscribes.set(requestId, request3.track);
|
|
109818
109818
|
const respTypeId = await stream.reader.u53();
|
|
109819
109819
|
if (respTypeId === SubscribeOk.id) {
|
|
109820
109820
|
const ok = await SubscribeOk.decode(stream.reader, version4);
|
|
109821
109821
|
if (ok.trackAlias !== requestId) {
|
|
109822
109822
|
this.#subscribes.delete(requestId);
|
|
109823
|
-
this.#subscribes.set(ok.trackAlias,
|
|
109823
|
+
this.#subscribes.set(ok.trackAlias, request3.track);
|
|
109824
109824
|
}
|
|
109825
|
-
console.debug(`subscribe ok: id=${requestId} broadcast=${broadcast} track=${
|
|
109825
|
+
console.debug(`subscribe ok: id=${requestId} broadcast=${broadcast} track=${request3.track.name}`);
|
|
109826
109826
|
try {
|
|
109827
|
-
await Promise.race([stream.reader.closed,
|
|
109827
|
+
await Promise.race([stream.reader.closed, request3.track.closed]);
|
|
109828
109828
|
if (version4 === Version.DRAFT_14 || version4 === Version.DRAFT_15 || version4 === Version.DRAFT_16) {
|
|
109829
109829
|
try {
|
|
109830
109830
|
await stream.writer.u53(Unsubscribe.id);
|
|
@@ -109833,9 +109833,9 @@ var Subscriber = class {
|
|
|
109833
109833
|
} catch {
|
|
109834
109834
|
}
|
|
109835
109835
|
}
|
|
109836
|
-
|
|
109836
|
+
request3.track.close();
|
|
109837
109837
|
stream.close();
|
|
109838
|
-
console.debug(`subscribe close: id=${requestId} broadcast=${broadcast} track=${
|
|
109838
|
+
console.debug(`subscribe close: id=${requestId} broadcast=${broadcast} track=${request3.track.name}`);
|
|
109839
109839
|
} finally {
|
|
109840
109840
|
this.#subscribes.delete(ok.trackAlias);
|
|
109841
109841
|
}
|
|
@@ -109858,8 +109858,8 @@ var Subscriber = class {
|
|
|
109858
109858
|
}
|
|
109859
109859
|
} catch (err) {
|
|
109860
109860
|
const e = error51(err);
|
|
109861
|
-
|
|
109862
|
-
console.warn(`subscribe error: id=${requestId} broadcast=${broadcast} track=${
|
|
109861
|
+
request3.track.close(e);
|
|
109862
|
+
console.warn(`subscribe error: id=${requestId} broadcast=${broadcast} track=${request3.track.name} error=${e.message}`);
|
|
109863
109863
|
}
|
|
109864
109864
|
}
|
|
109865
109865
|
/**
|
|
@@ -111401,19 +111401,19 @@ var Subscriber2 = class {
|
|
|
111401
111401
|
const broadcast = new Broadcast();
|
|
111402
111402
|
void (async () => {
|
|
111403
111403
|
for (; ; ) {
|
|
111404
|
-
const
|
|
111405
|
-
if (!
|
|
111404
|
+
const request3 = await broadcast.requested();
|
|
111405
|
+
if (!request3)
|
|
111406
111406
|
break;
|
|
111407
|
-
void this.#runSubscribe(path36,
|
|
111407
|
+
void this.#runSubscribe(path36, request3);
|
|
111408
111408
|
}
|
|
111409
111409
|
})();
|
|
111410
111410
|
return broadcast;
|
|
111411
111411
|
}
|
|
111412
|
-
async #runSubscribe(broadcast,
|
|
111412
|
+
async #runSubscribe(broadcast, request3) {
|
|
111413
111413
|
const id = this.#subscribeNext++;
|
|
111414
|
-
this.#subscribes.set(id,
|
|
111415
|
-
console.debug(`subscribe start: id=${id} broadcast=${broadcast} track=${
|
|
111416
|
-
const msg = new Subscribe2({ id, broadcast, track:
|
|
111414
|
+
this.#subscribes.set(id, request3.track);
|
|
111415
|
+
console.debug(`subscribe start: id=${id} broadcast=${broadcast} track=${request3.track.name}`);
|
|
111416
|
+
const msg = new Subscribe2({ id, broadcast, track: request3.track.name, priority: request3.priority });
|
|
111417
111417
|
const stream = await Stream.open(this.#quic);
|
|
111418
111418
|
await stream.writer.u53(StreamId.Subscribe);
|
|
111419
111419
|
await msg.encode(stream.writer, this.version);
|
|
@@ -111422,24 +111422,24 @@ var Subscriber2 = class {
|
|
|
111422
111422
|
if (!("ok" in resp)) {
|
|
111423
111423
|
throw new Error("first subscribe response must be SUBSCRIBE_OK");
|
|
111424
111424
|
}
|
|
111425
|
-
console.debug(`subscribe ok: id=${id} broadcast=${broadcast} track=${
|
|
111426
|
-
const waits = [stream.reader.closed,
|
|
111425
|
+
console.debug(`subscribe ok: id=${id} broadcast=${broadcast} track=${request3.track.name}`);
|
|
111426
|
+
const waits = [stream.reader.closed, request3.track.closed];
|
|
111427
111427
|
switch (this.version) {
|
|
111428
111428
|
case Version2.DRAFT_01:
|
|
111429
111429
|
case Version2.DRAFT_02:
|
|
111430
111430
|
break;
|
|
111431
111431
|
default:
|
|
111432
|
-
waits.push(this.#runPriorityUpdates(id, broadcast,
|
|
111432
|
+
waits.push(this.#runPriorityUpdates(id, broadcast, request3.track, msg, stream));
|
|
111433
111433
|
break;
|
|
111434
111434
|
}
|
|
111435
111435
|
await Promise.race(waits);
|
|
111436
|
-
|
|
111436
|
+
request3.track.close();
|
|
111437
111437
|
stream.close();
|
|
111438
|
-
console.debug(`subscribe close: id=${id} broadcast=${broadcast} track=${
|
|
111438
|
+
console.debug(`subscribe close: id=${id} broadcast=${broadcast} track=${request3.track.name}`);
|
|
111439
111439
|
} catch (err) {
|
|
111440
111440
|
const e = error51(err);
|
|
111441
|
-
|
|
111442
|
-
console.warn(`subscribe error: id=${id} broadcast=${broadcast} track=${
|
|
111441
|
+
request3.track.close(e);
|
|
111442
|
+
console.warn(`subscribe error: id=${id} broadcast=${broadcast} track=${request3.track.name} error=${e.message}`);
|
|
111443
111443
|
stream.abort(e);
|
|
111444
111444
|
} finally {
|
|
111445
111445
|
this.#subscribes.delete(id);
|
|
@@ -151001,6 +151001,27 @@ function createRegistry() {
|
|
|
151001
151001
|
return registry2;
|
|
151002
151002
|
}
|
|
151003
151003
|
|
|
151004
|
+
// ../tool-server/src/utils/probe-argent-tool-server.ts
|
|
151005
|
+
var http3 = __toESM(require("node:http"));
|
|
151006
|
+
function probeArgentToolServer(host, port, timeoutMs = 500) {
|
|
151007
|
+
return new Promise((resolve7) => {
|
|
151008
|
+
const req = http3.request(
|
|
151009
|
+
{ host, port, path: "/tools", method: "GET", timeout: timeoutMs },
|
|
151010
|
+
(res) => {
|
|
151011
|
+
const isArgentPeer = res.statusCode === 200 || res.statusCode === 401;
|
|
151012
|
+
res.resume();
|
|
151013
|
+
resolve7(isArgentPeer);
|
|
151014
|
+
}
|
|
151015
|
+
);
|
|
151016
|
+
req.on("error", () => resolve7(false));
|
|
151017
|
+
req.on("timeout", () => {
|
|
151018
|
+
req.destroy();
|
|
151019
|
+
resolve7(false);
|
|
151020
|
+
});
|
|
151021
|
+
req.end();
|
|
151022
|
+
});
|
|
151023
|
+
}
|
|
151024
|
+
|
|
151004
151025
|
// ../tool-server/src/utils/simulator-watcher.ts
|
|
151005
151026
|
var import_node_child_process29 = require("node:child_process");
|
|
151006
151027
|
var import_node_util20 = require("node:util");
|
|
@@ -151480,31 +151501,51 @@ function start() {
|
|
|
151480
151501
|
} catch {
|
|
151481
151502
|
}
|
|
151482
151503
|
});
|
|
151504
|
+
const bindSignal = {
|
|
151505
|
+
error_code: FAILURE_CODES.ARGENT_UNCLASSIFIED_FAILURE,
|
|
151506
|
+
failure_stage: "toolserver_bind",
|
|
151507
|
+
failure_area: "tool_server",
|
|
151508
|
+
error_kind: "crash"
|
|
151509
|
+
};
|
|
151483
151510
|
server.on("error", (err) => {
|
|
151484
|
-
eventLog?.error({
|
|
151485
|
-
type: "tool_server.bind_failed",
|
|
151486
|
-
msg: `Tool server failed to bind ${HOST}:${PORT}.`,
|
|
151487
|
-
host: HOST,
|
|
151488
|
-
port: PORT,
|
|
151489
|
-
failureSignal: {
|
|
151490
|
-
error_code: FAILURE_CODES.ARGENT_UNCLASSIFIED_FAILURE,
|
|
151491
|
-
failure_stage: "toolserver_bind",
|
|
151492
|
-
failure_area: "tool_server",
|
|
151493
|
-
error_kind: "crash"
|
|
151494
|
-
}
|
|
151495
|
-
});
|
|
151496
151511
|
const code = err.code ? `${err.code}: ` : "";
|
|
151497
|
-
|
|
151498
|
-
|
|
151499
|
-
|
|
151500
|
-
|
|
151501
|
-
|
|
151502
|
-
|
|
151503
|
-
|
|
151504
|
-
|
|
151505
|
-
|
|
151506
|
-
|
|
151507
|
-
|
|
151512
|
+
const crashBind = () => {
|
|
151513
|
+
eventLog?.error({
|
|
151514
|
+
type: "tool_server.bind_failed",
|
|
151515
|
+
msg: `Tool server failed to bind ${HOST}:${PORT}.`,
|
|
151516
|
+
host: HOST,
|
|
151517
|
+
port: PORT,
|
|
151518
|
+
failureSignal: {
|
|
151519
|
+
error_code: bindSignal.error_code,
|
|
151520
|
+
failure_stage: bindSignal.failure_stage,
|
|
151521
|
+
failure_area: bindSignal.failure_area,
|
|
151522
|
+
error_kind: bindSignal.error_kind
|
|
151523
|
+
}
|
|
151524
|
+
});
|
|
151525
|
+
crashShutdown(`Failed to bind ${HOST}:${PORT}`, `${code}${err.message}`, bindSignal, err);
|
|
151526
|
+
};
|
|
151527
|
+
if (err.code === "EADDRINUSE") {
|
|
151528
|
+
void probeArgentToolServer(HOST, PORT).then((isArgentPeer) => {
|
|
151529
|
+
if (!isArgentPeer) {
|
|
151530
|
+
crashBind();
|
|
151531
|
+
return;
|
|
151532
|
+
}
|
|
151533
|
+
process.stderr.write(
|
|
151534
|
+
`Another argent tool-server already owns ${HOST}:${PORT}; deferring to it (redundant instance).
|
|
151535
|
+
`
|
|
151536
|
+
);
|
|
151537
|
+
eventLog?.info({
|
|
151538
|
+
type: "tool_server.deferred_to_existing",
|
|
151539
|
+
msg: `Deferred to an existing tool-server on ${HOST}:${PORT}.`,
|
|
151540
|
+
host: HOST,
|
|
151541
|
+
port: PORT
|
|
151542
|
+
});
|
|
151543
|
+
shutdownReason = "deferred";
|
|
151544
|
+
void shutdown2?.(0);
|
|
151545
|
+
});
|
|
151546
|
+
return;
|
|
151547
|
+
}
|
|
151548
|
+
crashBind();
|
|
151508
151549
|
});
|
|
151509
151550
|
httpHandle.attachChromiumWebsockets(server);
|
|
151510
151551
|
}).catch((err) => {
|