@agiflowai/agent-cli 0.2.21 → 0.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/dist/daemon.js +1 -1
- package/dist/{index-CeY18u1c.mjs → index-736Cy0Dw.mjs} +2 -2
- package/dist/index-736Cy0Dw.mjs.map +1 -0
- package/dist/{index-CPRcxVr_.mjs → index-BrWZExLE.mjs} +2 -2
- package/dist/index-BrWZExLE.mjs.map +1 -0
- package/dist/{index-DUIR5RZ_.mjs → index-DF5PRoHl.mjs} +85 -58
- package/dist/{index-DUIR5RZ_.mjs.map → index-DF5PRoHl.mjs.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/package.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/index-CPRcxVr_.mjs.map +0 -1
- package/dist/index-CeY18u1c.mjs.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { bx as z, bl as H, by as P, bm as M } from "./index-
|
|
2
|
+
import { bx as z, bl as H, by as P, bm as M } from "./index-DF5PRoHl.mjs";
|
|
3
3
|
import Q from "node:events";
|
|
4
4
|
import X from "node:child_process";
|
|
5
5
|
import Z from "node:path";
|
package/dist/daemon.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e, jsxs as i, Fragment as F } from "react/jsx-runtime";
|
|
2
|
-
import { bj as f, bk as Y, bl as A, bm as D, bn as $, bo as X, bp as H, bq as J, br as Z, bs as ee, bt as re, bu as ne, bv as oe, bw as ie } from "./index-
|
|
2
|
+
import { bj as f, bk as Y, bl as A, bm as D, bn as $, bo as X, bp as H, bq as J, br as Z, bs as ee, bt as re, bu as ne, bv as oe, bw as ie } from "./index-DF5PRoHl.mjs";
|
|
3
3
|
import { useQueryClient as U, useQuery as te, useMutation as q, QueryClientProvider as ce, QueryClient as le } from "@tanstack/react-query";
|
|
4
4
|
import { useDispatch as de, useSelector as h, shallowEqual as ae, Provider as se } from "react-redux";
|
|
5
5
|
import P, { useRef as R, useEffect as B, useState as y, useCallback as ue, useMemo as he } from "react";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { am as s, al as t, ad as o, ai as c, ah as S, a4 as m, a8 as r, ak as n, ac as h, aa as g, ap as l, ab as p, ag as M, an as P, aj as T, a9 as u, a5 as i, ae as C, af as v, a7 as I, a6 as d, ao as x, aq as A, ar as R, at as f, as as q, au as V } from "./index-
|
|
1
|
+
import { am as s, al as t, ad as o, ai as c, ah as S, a4 as m, a8 as r, ak as n, ac as h, aa as g, ap as l, ab as p, ag as M, an as P, aj as T, a9 as u, a5 as i, ae as C, af as v, a7 as I, a6 as d, ao as x, aq as A, ar as R, at as f, as as q, au as V } from "./index-DF5PRoHl.mjs";
|
|
2
2
|
export {
|
|
3
3
|
s as AgentMessageCreateSchema,
|
|
4
4
|
t as AgentMessageTypeSchema,
|
|
@@ -28,4 +28,4 @@ export {
|
|
|
28
28
|
q as createTextPart,
|
|
29
29
|
V as createToolInvocationInput
|
|
30
30
|
};
|
|
31
|
-
//# sourceMappingURL=index-
|
|
31
|
+
//# sourceMappingURL=index-736Cy0Dw.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-736Cy0Dw.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as a, a as t, b as n, c as S, d as m, e as o, f as E, g as c, h as A, i as g, j as h, k as v, l as i, m as u, n as r, o as R, p, q as D, r as T, s as M, t as q, u as d, v as O, w as k, x as N, y as _, z as C, B as P, C as l, D as I, E as G, F as U, G as f, H as L, I as Y, J as B, K as V, L as x, M as y, N as z, O as b, P as j, Q as w, R as F, S as H, T as J, U as K, V as Q, W, X, Y as Z, Z as $, _ as ee, $ as se, a0 as ae, a1 as te, a2 as ne, a3 as Se } from "./index-
|
|
1
|
+
import { A as a, a as t, b as n, c as S, d as m, e as o, f as E, g as c, h as A, i as g, j as h, k as v, l as i, m as u, n as r, o as R, p, q as D, r as T, s as M, t as q, u as d, v as O, w as k, x as N, y as _, z as C, B as P, C as l, D as I, E as G, F as U, G as f, H as L, I as Y, J as B, K as V, L as x, M as y, N as z, O as b, P as j, Q as w, R as F, S as H, T as J, U as K, V as Q, W, X, Y as Z, Z as $, _ as ee, $ as se, a0 as ae, a1 as te, a2 as ne, a3 as Se } from "./index-DF5PRoHl.mjs";
|
|
2
2
|
export {
|
|
3
3
|
a as AGENT_EVENT_TYPES,
|
|
4
4
|
t as AGENT_STATUS,
|
|
@@ -59,4 +59,4 @@ export {
|
|
|
59
59
|
ne as OutputStreamSchema,
|
|
60
60
|
Se as TraceIdSchema
|
|
61
61
|
};
|
|
62
|
-
//# sourceMappingURL=index-
|
|
62
|
+
//# sourceMappingURL=index-BrWZExLE.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BrWZExLE.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -21,7 +21,7 @@ import Hk from "node:fs";
|
|
|
21
21
|
import An from "pino";
|
|
22
22
|
import { createServer as Kk } from "node:http";
|
|
23
23
|
import Wk, { createServer as Zk } from "node:net";
|
|
24
|
-
import
|
|
24
|
+
import yt, { WebSocketServer as ns, WebSocket as Vr } from "ws";
|
|
25
25
|
import { promisify as Jk } from "util";
|
|
26
26
|
import Xo, { mkdir as Yk } from "fs/promises";
|
|
27
27
|
import Ms, { randomUUID as rc } from "crypto";
|
|
@@ -293,9 +293,9 @@ function px() {
|
|
|
293
293
|
throw new TypeError();
|
|
294
294
|
return ve;
|
|
295
295
|
}
|
|
296
|
-
return
|
|
296
|
+
return St(G);
|
|
297
297
|
}
|
|
298
|
-
function
|
|
298
|
+
function St(G, J) {
|
|
299
299
|
var X, se, ve;
|
|
300
300
|
{
|
|
301
301
|
var Ge = G.toString;
|
|
@@ -18279,7 +18279,7 @@ let Dc = class {
|
|
|
18279
18279
|
* 2. Session ID is a ULID (from backend), not a UUID (locally generated)
|
|
18280
18280
|
*/
|
|
18281
18281
|
async connect(t) {
|
|
18282
|
-
if (this.ws && this.ws.readyState ===
|
|
18282
|
+
if (this.ws && this.ws.readyState === yt.OPEN)
|
|
18283
18283
|
return;
|
|
18284
18284
|
if (!this.resolveServerUrl()) {
|
|
18285
18285
|
this.logger.info("📡 No server URL configured - running in local-only mode (WebSocket disabled)"), this.currentSessionId = t;
|
|
@@ -18311,7 +18311,7 @@ let Dc = class {
|
|
|
18311
18311
|
);
|
|
18312
18312
|
const s = this.credentialsService.getSessionOrganizationId(t), a = s || await this.context.getOrganizationId();
|
|
18313
18313
|
return this.logger.info(`🏢 Organization ID (${s ? "session" : "global"}): ${a}`), new Promise((c, u) => {
|
|
18314
|
-
this.ws = new
|
|
18314
|
+
this.ws = new yt(r, { headers: i }), this.ws.on("open", () => {
|
|
18315
18315
|
this.isConnected = !0, this.connectionAttempts = 0, this.logger.info(`🔌 WebSocket connected to ${r}`), c();
|
|
18316
18316
|
}), this.ws.on("message", (l) => {
|
|
18317
18317
|
try {
|
|
@@ -18497,8 +18497,8 @@ let Dc = class {
|
|
|
18497
18497
|
* the message is transmitted before process exit (especially in headless/sandbox mode)
|
|
18498
18498
|
*/
|
|
18499
18499
|
async sendSessionEnded(t) {
|
|
18500
|
-
const e = this.getCurrentSessionId(), r = this.ws ? this.ws.readyState : "null", i = r ===
|
|
18501
|
-
if (this.logger.info(`📤 Sending SESSION_ENDED for ${e} (WebSocket state: ${i})`), !this.ws || this.ws.readyState !==
|
|
18500
|
+
const e = this.getCurrentSessionId(), r = this.ws ? this.ws.readyState : "null", i = r === yt.CONNECTING ? "CONNECTING" : r === yt.OPEN ? "OPEN" : r === yt.CLOSING ? "CLOSING" : r === yt.CLOSED ? "CLOSED" : String(r);
|
|
18501
|
+
if (this.logger.info(`📤 Sending SESSION_ENDED for ${e} (WebSocket state: ${i})`), !this.ws || this.ws.readyState !== yt.OPEN) {
|
|
18502
18502
|
this.logger.warn(
|
|
18503
18503
|
`⚠️ SESSION_ENDED cannot be sent via WebSocket (state: ${i}). Session: ${e}, reason: ${t.reason}. Backend will not receive cleanup notification!`
|
|
18504
18504
|
);
|
|
@@ -18524,7 +18524,7 @@ let Dc = class {
|
|
|
18524
18524
|
*/
|
|
18525
18525
|
sendMessageAndWait(t) {
|
|
18526
18526
|
return new Promise((e, r) => {
|
|
18527
|
-
if (!this.ws || this.ws.readyState !==
|
|
18527
|
+
if (!this.ws || this.ws.readyState !== yt.OPEN) {
|
|
18528
18528
|
e();
|
|
18529
18529
|
return;
|
|
18530
18530
|
}
|
|
@@ -18542,7 +18542,7 @@ let Dc = class {
|
|
|
18542
18542
|
* Send message through WebSocket or Redux store (for host mode)
|
|
18543
18543
|
*/
|
|
18544
18544
|
sendMessage(t) {
|
|
18545
|
-
if (t.eventType === pe.MESSAGE_STDOUT && this.dispatchToStore(t), this.ws && this.ws.readyState ===
|
|
18545
|
+
if (t.eventType === pe.MESSAGE_STDOUT && this.dispatchToStore(t), this.ws && this.ws.readyState === yt.OPEN) {
|
|
18546
18546
|
try {
|
|
18547
18547
|
this.ws.send(JSON.stringify(t)), this.logger.info(`📤 Sent message via WebSocket: ${t.eventType}`);
|
|
18548
18548
|
} catch (e) {
|
|
@@ -20662,7 +20662,7 @@ let Nc = class {
|
|
|
20662
20662
|
const t = this.agentConfigService.getStoredAgentSessionId();
|
|
20663
20663
|
if (t)
|
|
20664
20664
|
try {
|
|
20665
|
-
const { createGetAgentStatus: e } = await Promise.resolve().then(() => VA), { createSendAgentStatus: r } = await Promise.resolve().then(() => jT), { AGENT_STATUS: i } = await import("./index-
|
|
20665
|
+
const { createGetAgentStatus: e } = await Promise.resolve().then(() => VA), { createSendAgentStatus: r } = await Promise.resolve().then(() => jT), { AGENT_STATUS: i } = await import("./index-BrWZExLE.mjs"), n = e(t, t), a = (await this.multiplexClient.request(n))?.payload?.result || i.IDLE;
|
|
20666
20666
|
await this.multiplexClient.publish(
|
|
20667
20667
|
r(t, {
|
|
20668
20668
|
agentType: this.agentConfigService.getAgentType() ?? void 0,
|
|
@@ -22709,7 +22709,7 @@ let ws = class {
|
|
|
22709
22709
|
* Middleware layers wrap around this with setup (BEFORE) and cleanup (AFTER)
|
|
22710
22710
|
*/
|
|
22711
22711
|
async launchPty(t) {
|
|
22712
|
-
const { AGENT_STATUS: e } = await import("./index-
|
|
22712
|
+
const { AGENT_STATUS: e } = await import("./index-BrWZExLE.mjs"), r = t.metadata.agentCommand, i = t.metadata.agentArgs;
|
|
22713
22713
|
if (!r)
|
|
22714
22714
|
throw new Error("launchPty requires metadata.agentCommand to be set by middleware");
|
|
22715
22715
|
const n = await this.getAgentEnvironmentVariablesForContext(t);
|
|
@@ -23938,7 +23938,7 @@ class o$ extends Bb {
|
|
|
23938
23938
|
if (!e.length) return;
|
|
23939
23939
|
const i = (/* @__PURE__ */ new Date()).toISOString();
|
|
23940
23940
|
try {
|
|
23941
|
-
const { createSelectComponent: n, createToolInvocationInput: o } = await import("./index-
|
|
23941
|
+
const { createSelectComponent: n, createToolInvocationInput: o } = await import("./index-736Cy0Dw.mjs"), { createRequestApproval: s } = await Promise.resolve().then(() => Xi), a = e.map((m) => ({ label: m.text, value: m.number, selected: !!m.selected })), c = n(a), u = o(!1, c), l = s(r.agentSessionId, {
|
|
23942
23942
|
toolName: "selectOption",
|
|
23943
23943
|
toolArgs: { timestamp: i, options: a },
|
|
23944
23944
|
input: u
|
|
@@ -25424,7 +25424,7 @@ function S$() {
|
|
|
25424
25424
|
e(Cs).toSelf().inTransientScope(), e(Is).toSelf().inTransientScope(), e($s).toSelf().inTransientScope(), e(Rs).toSelf().inTransientScope(), e(Ce.ClaudeAgent).toFactory((r) => () => r.get(Cs)), e(Ce.GeminiAgent).toFactory((r) => () => r.get(Is)), e(Ce.ClaudeDockerAgent).toFactory((r) => () => r.get($s)), e(Ce.GeminiDockerAgent).toFactory((r) => () => r.get(Rs));
|
|
25425
25425
|
});
|
|
25426
25426
|
}
|
|
25427
|
-
const au = 10, Qf = (t = 0) => (e) => `\x1B[${e + t}m`, eh = (t = 0) => (e) => `\x1B[${38 + t};5;${e}m`, th = (t = 0) => (e, r, i) => `\x1B[${38 + t};2;${e};${r};${i}m`,
|
|
25427
|
+
const au = 10, Qf = (t = 0) => (e) => `\x1B[${e + t}m`, eh = (t = 0) => (e) => `\x1B[${38 + t};5;${e}m`, th = (t = 0) => (e, r, i) => `\x1B[${38 + t};2;${e};${r};${i}m`, bt = {
|
|
25428
25428
|
modifier: {
|
|
25429
25429
|
reset: [0, 0],
|
|
25430
25430
|
// 21 isn't widely supported and 22 does the same thing
|
|
@@ -25484,26 +25484,26 @@ const au = 10, Qf = (t = 0) => (e) => `\x1B[${e + t}m`, eh = (t = 0) => (e) => `
|
|
|
25484
25484
|
bgWhiteBright: [107, 49]
|
|
25485
25485
|
}
|
|
25486
25486
|
};
|
|
25487
|
-
Object.keys(
|
|
25488
|
-
const b$ = Object.keys(
|
|
25487
|
+
Object.keys(bt.modifier);
|
|
25488
|
+
const b$ = Object.keys(bt.color), k$ = Object.keys(bt.bgColor);
|
|
25489
25489
|
[...b$, ...k$];
|
|
25490
25490
|
function x$() {
|
|
25491
25491
|
const t = /* @__PURE__ */ new Map();
|
|
25492
|
-
for (const [e, r] of Object.entries(
|
|
25492
|
+
for (const [e, r] of Object.entries(bt)) {
|
|
25493
25493
|
for (const [i, n] of Object.entries(r))
|
|
25494
|
-
|
|
25494
|
+
bt[i] = {
|
|
25495
25495
|
open: `\x1B[${n[0]}m`,
|
|
25496
25496
|
close: `\x1B[${n[1]}m`
|
|
25497
|
-
}, r[i] =
|
|
25498
|
-
Object.defineProperty(
|
|
25497
|
+
}, r[i] = bt[i], t.set(n[0], n[1]);
|
|
25498
|
+
Object.defineProperty(bt, e, {
|
|
25499
25499
|
value: r,
|
|
25500
25500
|
enumerable: !1
|
|
25501
25501
|
});
|
|
25502
25502
|
}
|
|
25503
|
-
return Object.defineProperty(
|
|
25503
|
+
return Object.defineProperty(bt, "codes", {
|
|
25504
25504
|
value: t,
|
|
25505
25505
|
enumerable: !1
|
|
25506
|
-
}),
|
|
25506
|
+
}), bt.color.close = "\x1B[39m", bt.bgColor.close = "\x1B[49m", bt.color.ansi = Qf(), bt.color.ansi256 = eh(), bt.color.ansi16m = th(), bt.bgColor.ansi = Qf(au), bt.bgColor.ansi256 = eh(au), bt.bgColor.ansi16m = th(au), Object.defineProperties(bt, {
|
|
25507
25507
|
rgbToAnsi256: {
|
|
25508
25508
|
value(e, r, i) {
|
|
25509
25509
|
return e === r && r === i ? e < 8 ? 16 : e > 248 ? 231 : Math.round((e - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(e / 255 * 5) + 6 * Math.round(r / 255 * 5) + Math.round(i / 255 * 5);
|
|
@@ -25529,7 +25529,7 @@ function x$() {
|
|
|
25529
25529
|
enumerable: !1
|
|
25530
25530
|
},
|
|
25531
25531
|
hexToAnsi256: {
|
|
25532
|
-
value: (e) =>
|
|
25532
|
+
value: (e) => bt.rgbToAnsi256(...bt.hexToRgb(e)),
|
|
25533
25533
|
enumerable: !1
|
|
25534
25534
|
},
|
|
25535
25535
|
ansi256ToAnsi: {
|
|
@@ -25555,14 +25555,14 @@ function x$() {
|
|
|
25555
25555
|
enumerable: !1
|
|
25556
25556
|
},
|
|
25557
25557
|
rgbToAnsi: {
|
|
25558
|
-
value: (e, r, i) =>
|
|
25558
|
+
value: (e, r, i) => bt.ansi256ToAnsi(bt.rgbToAnsi256(e, r, i)),
|
|
25559
25559
|
enumerable: !1
|
|
25560
25560
|
},
|
|
25561
25561
|
hexToAnsi: {
|
|
25562
|
-
value: (e) =>
|
|
25562
|
+
value: (e) => bt.ansi256ToAnsi(bt.hexToAnsi256(e)),
|
|
25563
25563
|
enumerable: !1
|
|
25564
25564
|
}
|
|
25565
|
-
}),
|
|
25565
|
+
}), bt;
|
|
25566
25566
|
}
|
|
25567
25567
|
const Hr = x$(), rh = (() => {
|
|
25568
25568
|
if (!("navigator" in globalThis))
|
|
@@ -26856,6 +26856,7 @@ var h2 = Object.getOwnPropertyDescriptor, g2 = (t, e, r, i) => {
|
|
|
26856
26856
|
return n;
|
|
26857
26857
|
}, Oi = (t, e) => (r, i) => e(r, i, t);
|
|
26858
26858
|
let Wc = class {
|
|
26859
|
+
// 10 minutes
|
|
26859
26860
|
constructor(t, e, r, i, n) {
|
|
26860
26861
|
this.logger = t, this.credentials = e, this.context = r, this.configService = n, this.reduxStore = i;
|
|
26861
26862
|
}
|
|
@@ -26867,6 +26868,10 @@ let Wc = class {
|
|
|
26867
26868
|
serverUrl;
|
|
26868
26869
|
reconnectInterval = 3e4;
|
|
26869
26870
|
reduxStore;
|
|
26871
|
+
// Heartbeat mechanism to keep connection alive (10 min interval to minimize DO wakeups)
|
|
26872
|
+
pingTimer = null;
|
|
26873
|
+
pongReceived = !0;
|
|
26874
|
+
PING_INTERVAL_MS = 600 * 1e3;
|
|
26870
26875
|
/**
|
|
26871
26876
|
* Connect to WebSocket server
|
|
26872
26877
|
*/
|
|
@@ -26878,7 +26883,7 @@ let Wc = class {
|
|
|
26878
26883
|
* This notifies connected clients (controllers) that the daemon is going offline
|
|
26879
26884
|
*/
|
|
26880
26885
|
sendDisconnectNotification() {
|
|
26881
|
-
if (!this.ws || this.ws.readyState !==
|
|
26886
|
+
if (!this.ws || this.ws.readyState !== yt.OPEN) {
|
|
26882
26887
|
this.logger.warn("🛑 Cannot send disconnect notification - WebSocket not connected");
|
|
26883
26888
|
return;
|
|
26884
26889
|
}
|
|
@@ -26907,7 +26912,7 @@ let Wc = class {
|
|
|
26907
26912
|
* Disconnect from WebSocket server
|
|
26908
26913
|
*/
|
|
26909
26914
|
disconnect() {
|
|
26910
|
-
this.shouldReconnect = !1, this.reconnectTimer && (clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.ws && (this.ws.close(), this.ws = null), this.isConnected = !1;
|
|
26915
|
+
this.shouldReconnect = !1, this.stopPingTimer(), this.reconnectTimer && (clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.ws && (this.ws.close(), this.ws = null), this.isConnected = !1;
|
|
26911
26916
|
}
|
|
26912
26917
|
/**
|
|
26913
26918
|
* Check if WebSocket is connected
|
|
@@ -26925,7 +26930,7 @@ let Wc = class {
|
|
|
26925
26930
|
* Send message through WebSocket
|
|
26926
26931
|
*/
|
|
26927
26932
|
sendMessage(t) {
|
|
26928
|
-
this.ws && this.ws.readyState ===
|
|
26933
|
+
this.ws && this.ws.readyState === yt.OPEN ? this.ws.send(JSON.stringify(t)) : this.logger.warn("Cannot send message - WebSocket not connected");
|
|
26929
26934
|
}
|
|
26930
26935
|
/**
|
|
26931
26936
|
* Send error message through WebSocket
|
|
@@ -26974,7 +26979,7 @@ let Wc = class {
|
|
|
26974
26979
|
if (!a)
|
|
26975
26980
|
throw new Error("No API key available for WebSocket connection");
|
|
26976
26981
|
return this.logger.info(`Connecting to daemon WebSocket: ${i.toString()}`), new Promise((c, u) => {
|
|
26977
|
-
this.ws = new
|
|
26982
|
+
this.ws = new yt(i.toString(), { headers: s }), this.ws.on("open", () => {
|
|
26978
26983
|
this.isConnected = !0, this.logger.info("Daemon WebSocket connection established");
|
|
26979
26984
|
const l = ts.parse({
|
|
26980
26985
|
payload: {
|
|
@@ -26983,7 +26988,9 @@ let Wc = class {
|
|
|
26983
26988
|
status: Wr.IDLE
|
|
26984
26989
|
}
|
|
26985
26990
|
});
|
|
26986
|
-
this.sendMessage(l), this.callbacks.onConnect && this.callbacks.onConnect(), c();
|
|
26991
|
+
this.sendMessage(l), this.pongReceived = !0, this.schedulePing(t), this.callbacks.onConnect && this.callbacks.onConnect(), c();
|
|
26992
|
+
}), this.ws.on("pong", () => {
|
|
26993
|
+
this.pongReceived = !0, this.logger.debug("Received WebSocket pong");
|
|
26987
26994
|
}), this.ws.on("message", (l) => {
|
|
26988
26995
|
try {
|
|
26989
26996
|
const m = l.toString(), h = JSON.parse(m);
|
|
@@ -26992,7 +26999,7 @@ let Wc = class {
|
|
|
26992
26999
|
this.logger.error("Failed to parse server message:", m), this.logger.error(`Raw data: ${l.toString()}`);
|
|
26993
27000
|
}
|
|
26994
27001
|
}), this.ws.on("close", (l, m) => {
|
|
26995
|
-
this.isConnected = !1, this.logger.info(`Daemon WebSocket disconnected (${l}): ${m}`), this.callbacks.onDisconnect && this.callbacks.onDisconnect(l, m.toString()), this.shouldReconnect && this.scheduleReconnect(t);
|
|
27002
|
+
this.isConnected = !1, this.stopPingTimer(), this.logger.info(`Daemon WebSocket disconnected (${l}): ${m}`), this.callbacks.onDisconnect && this.callbacks.onDisconnect(l, m.toString()), this.shouldReconnect && this.scheduleReconnect(t);
|
|
26996
27003
|
}), this.ws.on("error", (l) => {
|
|
26997
27004
|
this.logger.error("WebSocket error:", l), this.callbacks.onError && this.callbacks.onError(l), this.isConnected || u(l);
|
|
26998
27005
|
}), this.ws.on("unexpected-response", async (l, m) => {
|
|
@@ -27014,6 +27021,26 @@ let Wc = class {
|
|
|
27014
27021
|
}, 1e4);
|
|
27015
27022
|
});
|
|
27016
27023
|
}
|
|
27024
|
+
/**
|
|
27025
|
+
* Schedule the next ping to keep connection alive (uses setTimeout for graceful exit)
|
|
27026
|
+
*/
|
|
27027
|
+
schedulePing(t) {
|
|
27028
|
+
this.stopPingTimer(), this.pingTimer = setTimeout(() => {
|
|
27029
|
+
if (this.pingTimer = null, !(!this.ws || this.ws.readyState !== yt.OPEN)) {
|
|
27030
|
+
if (!this.pongReceived) {
|
|
27031
|
+
this.logger.warn("No pong received, connection appears dead. Reconnecting..."), this.ws.terminate(), this.shouldReconnect && this.scheduleReconnect(t);
|
|
27032
|
+
return;
|
|
27033
|
+
}
|
|
27034
|
+
this.pongReceived = !1, this.ws.ping(), this.logger.debug("Sent WebSocket ping"), this.schedulePing(t);
|
|
27035
|
+
}
|
|
27036
|
+
}, this.PING_INTERVAL_MS), this.pingTimer.unref();
|
|
27037
|
+
}
|
|
27038
|
+
/**
|
|
27039
|
+
* Stop the heartbeat ping timer
|
|
27040
|
+
*/
|
|
27041
|
+
stopPingTimer() {
|
|
27042
|
+
this.pingTimer && (clearTimeout(this.pingTimer), this.pingTimer = null);
|
|
27043
|
+
}
|
|
27017
27044
|
/**
|
|
27018
27045
|
* Schedule reconnection attempt
|
|
27019
27046
|
*/
|
|
@@ -27157,7 +27184,7 @@ let Wc = class {
|
|
|
27157
27184
|
eventType: e.eventType,
|
|
27158
27185
|
command: e.command,
|
|
27159
27186
|
sessionId: e.payload.sessionId
|
|
27160
|
-
}), this.ws && this.ws.readyState ===
|
|
27187
|
+
}), this.ws && this.ws.readyState === yt.OPEN) {
|
|
27161
27188
|
const r = lb.parse({
|
|
27162
27189
|
traceId: e.traceId,
|
|
27163
27190
|
payload: {
|
|
@@ -32864,10 +32891,10 @@ function La() {
|
|
|
32864
32891
|
function Xe(C, $, N) {
|
|
32865
32892
|
C.multiplyTo($, N), this.reduce(N);
|
|
32866
32893
|
}
|
|
32867
|
-
function
|
|
32894
|
+
function St(C, $) {
|
|
32868
32895
|
C.squareTo($), this.reduce($);
|
|
32869
32896
|
}
|
|
32870
|
-
Z.prototype.convert = le, Z.prototype.revert = ke, Z.prototype.reduce = be, Z.prototype.mulTo = Xe, Z.prototype.sqrTo =
|
|
32897
|
+
Z.prototype.convert = le, Z.prototype.revert = ke, Z.prototype.reduce = be, Z.prototype.mulTo = Xe, Z.prototype.sqrTo = St;
|
|
32871
32898
|
function ue() {
|
|
32872
32899
|
if (this.t < 1) return 0;
|
|
32873
32900
|
var C = this.data[0];
|
|
@@ -34772,10 +34799,10 @@ function Kb() {
|
|
|
34772
34799
|
ke.putByte(Z.at(b % w));
|
|
34773
34800
|
var be = Math.ceil(T / I) + Math.ceil(f / I), Xe = new t.util.ByteBuffer();
|
|
34774
34801
|
for (S = 0; S < be; S++) {
|
|
34775
|
-
var
|
|
34802
|
+
var St = new t.util.ByteBuffer(q.getBytes(I)), ue = 511;
|
|
34776
34803
|
for (b = ke.length() - 1; b >= 0; b--)
|
|
34777
|
-
ue = ue >> 8, ue += ke.at(b) +
|
|
34778
|
-
Xe.putBuffer(
|
|
34804
|
+
ue = ue >> 8, ue += ke.at(b) + St.at(b), St.setAt(b, ue & 255);
|
|
34805
|
+
Xe.putBuffer(St);
|
|
34779
34806
|
}
|
|
34780
34807
|
q = Xe, x.putBuffer(Z);
|
|
34781
34808
|
}
|
|
@@ -36762,14 +36789,14 @@ function Ed() {
|
|
|
36762
36789
|
});
|
|
36763
36790
|
}
|
|
36764
36791
|
if (O === null && (!U || g.length === 0 && (!q || W))) {
|
|
36765
|
-
var Xe = V.getExtension("basicConstraints"),
|
|
36766
|
-
if (
|
|
36792
|
+
var Xe = V.getExtension("basicConstraints"), St = V.getExtension("keyUsage");
|
|
36793
|
+
if (St !== null && (!St.keyCertSign || Xe === null) && (O = {
|
|
36767
36794
|
message: "Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",
|
|
36768
36795
|
error: r.certificateError.bad_certificate
|
|
36769
36796
|
}), O === null && Xe !== null && !Xe.cA && (O = {
|
|
36770
36797
|
message: "Certificate basicConstraints indicates the certificate is not a CA.",
|
|
36771
36798
|
error: r.certificateError.bad_certificate
|
|
36772
|
-
}), O === null &&
|
|
36799
|
+
}), O === null && St !== null && "pathLenConstraint" in Xe) {
|
|
36773
36800
|
var ue = L - 1;
|
|
36774
36801
|
ue > Xe.pathLenConstraint && (O = {
|
|
36775
36802
|
message: "Certificate basicConstraints pathLenConstraint violated.",
|
|
@@ -37420,9 +37447,9 @@ function Jb() {
|
|
|
37420
37447
|
f
|
|
37421
37448
|
), Xe;
|
|
37422
37449
|
if (S.useMac) {
|
|
37423
|
-
var x = t.md.sha1.create(),
|
|
37450
|
+
var x = t.md.sha1.create(), St = new t.util.ByteBuffer(
|
|
37424
37451
|
t.random.getBytes(S.saltSize)
|
|
37425
|
-
), ue = S.count, v = i.generateKey(p,
|
|
37452
|
+
), ue = S.count, v = i.generateKey(p, St, 3, ue, 20), Fe = t.hmac.create();
|
|
37426
37453
|
Fe.start(x, v), Fe.update(e.toDer(be).getBytes());
|
|
37427
37454
|
var ce = Fe.getMac();
|
|
37428
37455
|
Xe = e.create(e.Class.UNIVERSAL, e.Type.SEQUENCE, !0, [
|
|
@@ -37453,7 +37480,7 @@ function Jb() {
|
|
|
37453
37480
|
e.Class.UNIVERSAL,
|
|
37454
37481
|
e.Type.OCTETSTRING,
|
|
37455
37482
|
!1,
|
|
37456
|
-
|
|
37483
|
+
St.getBytes()
|
|
37457
37484
|
),
|
|
37458
37485
|
// iterations INTEGER (XXX: Only support count < 65536)
|
|
37459
37486
|
e.create(
|
|
@@ -38254,11 +38281,11 @@ function Xb() {
|
|
|
38254
38281
|
/*SER*/
|
|
38255
38282
|
[q, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f]
|
|
38256
38283
|
];
|
|
38257
|
-
var
|
|
38284
|
+
var St = a.handleClientHello, ue = a.handleClientKeyExchange, Fe = a.handleCertificateVerify;
|
|
38258
38285
|
Xe[a.ConnectionEnd.server] = [
|
|
38259
38286
|
// 01,CH,02,03,04,05,06,07,08,09,10,CC,12,13,14,CV,CK,17,18,19,FI
|
|
38260
38287
|
/*CHE*/
|
|
38261
|
-
[f,
|
|
38288
|
+
[f, St, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f],
|
|
38262
38289
|
/*CCE*/
|
|
38263
38290
|
[f, f, f, f, f, f, f, f, f, f, f, ne, f, f, f, f, f, f, f, f, f],
|
|
38264
38291
|
/*CKE*/
|
|
@@ -39100,7 +39127,7 @@ function Qb() {
|
|
|
39100
39127
|
], n = !0;
|
|
39101
39128
|
}
|
|
39102
39129
|
function c(u, l, m) {
|
|
39103
|
-
for (var h, d, _, v, k, p, S, b, w, I, x, g, f, T, D, U, O, L, V, q, W, ne, Z, le, ke, be, Xe,
|
|
39130
|
+
for (var h, d, _, v, k, p, S, b, w, I, x, g, f, T, D, U, O, L, V, q, W, ne, Z, le, ke, be, Xe, St, ue, Fe, ce, Rt, Le, E, P, R = m.length(); R >= 128; ) {
|
|
39104
39131
|
for (ue = 0; ue < 16; ++ue)
|
|
39105
39132
|
l[ue][0] = m.getInt32() >>> 0, l[ue][1] = m.getInt32() >>> 0;
|
|
39106
39133
|
for (; ue < 80; ++ue)
|
|
@@ -39113,7 +39140,7 @@ function Qb() {
|
|
|
39113
39140
|
Fe >>> 7) >>> 0, v = ((Fe << 31 | ce >>> 1) ^ // ROTR 1
|
|
39114
39141
|
(Fe << 24 | ce >>> 8) ^ // ROTR 8
|
|
39115
39142
|
(Fe << 25 | ce >>> 7)) >>> 0, Le = l[ue - 7], P = l[ue - 16], ce = d + Le[1] + v + P[1], l[ue][0] = h + Le[0] + _ + P[0] + (ce / 4294967296 >>> 0) >>> 0, l[ue][1] = ce >>> 0;
|
|
39116
|
-
for (f = u[0][0], T = u[0][1], D = u[1][0], U = u[1][1], O = u[2][0], L = u[2][1], V = u[3][0], q = u[3][1], W = u[4][0], ne = u[4][1], Z = u[5][0], le = u[5][1], ke = u[6][0], be = u[6][1], Xe = u[7][0],
|
|
39143
|
+
for (f = u[0][0], T = u[0][1], D = u[1][0], U = u[1][1], O = u[2][0], L = u[2][1], V = u[3][0], q = u[3][1], W = u[4][0], ne = u[4][1], Z = u[5][0], le = u[5][1], ke = u[6][0], be = u[6][1], Xe = u[7][0], St = u[7][1], ue = 0; ue < 80; ++ue)
|
|
39117
39144
|
S = ((W >>> 14 | ne << 18) ^ // ROTR 14
|
|
39118
39145
|
(W >>> 18 | ne << 14) ^ // ROTR 18
|
|
39119
39146
|
(ne >>> 9 | W << 23)) >>> 0, b = ((W << 18 | ne >>> 14) ^ // ROTR 14
|
|
@@ -39122,8 +39149,8 @@ function Qb() {
|
|
|
39122
39149
|
(T >>> 2 | f << 30) ^ // ROTR 34/(swap + ROTR 2)
|
|
39123
39150
|
(T >>> 7 | f << 25)) >>> 0, p = ((f << 4 | T >>> 28) ^ // ROTR 28
|
|
39124
39151
|
(T << 30 | f >>> 2) ^ // ROTR 34/(swap + ROTR 2)
|
|
39125
|
-
(T << 25 | f >>> 7)) >>> 0, x = (f & D | O & (f ^ D)) >>> 0, g = (T & U | L & (T ^ U)) >>> 0, ce =
|
|
39126
|
-
ce = u[0][1] + T, u[0][0] = u[0][0] + f + (ce / 4294967296 >>> 0) >>> 0, u[0][1] = ce >>> 0, ce = u[1][1] + U, u[1][0] = u[1][0] + D + (ce / 4294967296 >>> 0) >>> 0, u[1][1] = ce >>> 0, ce = u[2][1] + L, u[2][0] = u[2][0] + O + (ce / 4294967296 >>> 0) >>> 0, u[2][1] = ce >>> 0, ce = u[3][1] + q, u[3][0] = u[3][0] + V + (ce / 4294967296 >>> 0) >>> 0, u[3][1] = ce >>> 0, ce = u[4][1] + ne, u[4][0] = u[4][0] + W + (ce / 4294967296 >>> 0) >>> 0, u[4][1] = ce >>> 0, ce = u[5][1] + le, u[5][0] = u[5][0] + Z + (ce / 4294967296 >>> 0) >>> 0, u[5][1] = ce >>> 0, ce = u[6][1] + be, u[6][0] = u[6][0] + ke + (ce / 4294967296 >>> 0) >>> 0, u[6][1] = ce >>> 0, ce = u[7][1] +
|
|
39152
|
+
(T << 25 | f >>> 7)) >>> 0, x = (f & D | O & (f ^ D)) >>> 0, g = (T & U | L & (T ^ U)) >>> 0, ce = St + b + I + o[ue][1] + l[ue][1], h = Xe + S + w + o[ue][0] + l[ue][0] + (ce / 4294967296 >>> 0) >>> 0, d = ce >>> 0, ce = p + g, _ = k + x + (ce / 4294967296 >>> 0) >>> 0, v = ce >>> 0, Xe = ke, St = be, ke = Z, be = le, Z = W, le = ne, ce = q + d, W = V + h + (ce / 4294967296 >>> 0) >>> 0, ne = ce >>> 0, V = O, q = L, O = D, L = U, D = f, U = T, ce = d + v, f = h + _ + (ce / 4294967296 >>> 0) >>> 0, T = ce >>> 0;
|
|
39153
|
+
ce = u[0][1] + T, u[0][0] = u[0][0] + f + (ce / 4294967296 >>> 0) >>> 0, u[0][1] = ce >>> 0, ce = u[1][1] + U, u[1][0] = u[1][0] + D + (ce / 4294967296 >>> 0) >>> 0, u[1][1] = ce >>> 0, ce = u[2][1] + L, u[2][0] = u[2][0] + O + (ce / 4294967296 >>> 0) >>> 0, u[2][1] = ce >>> 0, ce = u[3][1] + q, u[3][0] = u[3][0] + V + (ce / 4294967296 >>> 0) >>> 0, u[3][1] = ce >>> 0, ce = u[4][1] + ne, u[4][0] = u[4][0] + W + (ce / 4294967296 >>> 0) >>> 0, u[4][1] = ce >>> 0, ce = u[5][1] + le, u[5][0] = u[5][0] + Z + (ce / 4294967296 >>> 0) >>> 0, u[5][1] = ce >>> 0, ce = u[6][1] + be, u[6][0] = u[6][0] + ke + (ce / 4294967296 >>> 0) >>> 0, u[6][1] = ce >>> 0, ce = u[7][1] + St, u[7][0] = u[7][0] + Xe + (ce / 4294967296 >>> 0) >>> 0, u[7][1] = ce >>> 0, R -= 128;
|
|
39127
39154
|
}
|
|
39128
39155
|
}
|
|
39129
39156
|
return ju.exports;
|
|
@@ -39564,7 +39591,7 @@ function Z2() {
|
|
|
39564
39591
|
}
|
|
39565
39592
|
function f(E, P, R) {
|
|
39566
39593
|
for (var y = 0; y < 4; ++y)
|
|
39567
|
-
|
|
39594
|
+
St(E[y], P[y], R);
|
|
39568
39595
|
}
|
|
39569
39596
|
function T(E, P) {
|
|
39570
39597
|
var R = ue(), y = ue(), A = ue();
|
|
@@ -39577,7 +39604,7 @@ function Z2() {
|
|
|
39577
39604
|
for (Xe(B), Xe(B), Xe(B), y = 0; y < 2; ++y) {
|
|
39578
39605
|
for (z[0] = B[0] - 65517, R = 1; R < 15; ++R)
|
|
39579
39606
|
z[R] = B[R] - 65535 - (z[R - 1] >> 16 & 1), z[R - 1] &= 65535;
|
|
39580
|
-
z[15] = B[15] - 32767 - (z[14] >> 16 & 1), A = z[15] >> 16 & 1, z[14] &= 65535,
|
|
39607
|
+
z[15] = B[15] - 32767 - (z[14] >> 16 & 1), A = z[15] >> 16 & 1, z[14] &= 65535, St(B, z, 1 - A);
|
|
39581
39608
|
}
|
|
39582
39609
|
for (R = 0; R < 16; R++)
|
|
39583
39610
|
E[2 * R] = B[R] & 255, E[2 * R + 1] = B[R] >> 8;
|
|
@@ -39647,7 +39674,7 @@ function Z2() {
|
|
|
39647
39674
|
R = E[P] + y + 65535, y = Math.floor(R / 65536), E[P] = R - y * 65536;
|
|
39648
39675
|
E[0] += y - 1 + 37 * (y - 1);
|
|
39649
39676
|
}
|
|
39650
|
-
function
|
|
39677
|
+
function St(E, P, R) {
|
|
39651
39678
|
for (var y, A = ~(R - 1), z = 0; z < 16; ++z)
|
|
39652
39679
|
y = A & (E[z] ^ P[z]), E[z] ^= y, P[z] ^= y;
|
|
39653
39680
|
}
|
|
@@ -43036,11 +43063,11 @@ let tc = class ni {
|
|
|
43036
43063
|
headers: u
|
|
43037
43064
|
};
|
|
43038
43065
|
function m() {
|
|
43039
|
-
s.proxyToServerWebSocket = new
|
|
43066
|
+
s.proxyToServerWebSocket = new yt(
|
|
43040
43067
|
s.proxyToServerWebSocketOptions.url,
|
|
43041
43068
|
s.proxyToServerWebSocketOptions
|
|
43042
43069
|
), s.proxyToServerWebSocket.on("message", n._onWebSocketFrame.bind(n, s, "message", !0)), s.proxyToServerWebSocket.on("ping", n._onWebSocketFrame.bind(n, s, "ping", !0)), s.proxyToServerWebSocket.on("pong", n._onWebSocketFrame.bind(n, s, "pong", !0)), s.proxyToServerWebSocket.on("error", n._onWebSocketError.bind(n, s)), s.proxyToServerWebSocket.on("close", n._onWebSocketClose.bind(n, s, !0)), s.proxyToServerWebSocket.on("open", () => {
|
|
43043
|
-
s.proxyToServerWebSocket._socket.on("error", n._onWebSocketError.bind(n, s)), a.readyState ===
|
|
43070
|
+
s.proxyToServerWebSocket._socket.on("error", n._onWebSocketError.bind(n, s)), a.readyState === yt.OPEN && a._socket.resume();
|
|
43044
43071
|
});
|
|
43045
43072
|
}
|
|
43046
43073
|
return n._onWebSocketConnection(s, (h) => h ? n._onWebSocketError(s, h) : m());
|
|
@@ -43172,7 +43199,7 @@ let tc = class ni {
|
|
|
43172
43199
|
if (s)
|
|
43173
43200
|
return this._onWebSocketError(e, s);
|
|
43174
43201
|
const a = i ? e.clientToProxyWebSocket : e.proxyToServerWebSocket;
|
|
43175
|
-
if (a.readyState ===
|
|
43202
|
+
if (a.readyState === yt.OPEN)
|
|
43176
43203
|
switch (r) {
|
|
43177
43204
|
case "message":
|
|
43178
43205
|
a.send(n, { binary: o });
|
|
@@ -43204,7 +43231,7 @@ let tc = class ni {
|
|
|
43204
43231
|
const s = e.clientToProxyWebSocket, a = e.proxyToServerWebSocket;
|
|
43205
43232
|
if (s.readyState !== a.readyState)
|
|
43206
43233
|
try {
|
|
43207
|
-
s.readyState ===
|
|
43234
|
+
s.readyState === yt.CLOSED && a.readyState === yt.OPEN ? i === 1005 ? a.close() : a.close(i, n) : a.readyState === yt.CLOSED && s.readyState === yt.OPEN && (i === 1005 ? a.close() : s.close(i, n));
|
|
43208
43235
|
} catch (c) {
|
|
43209
43236
|
return this._onWebSocketError(e, c);
|
|
43210
43237
|
}
|
|
@@ -43216,7 +43243,7 @@ let tc = class ni {
|
|
|
43216
43243
|
const i = e.clientToProxyWebSocket, n = e.proxyToServerWebSocket;
|
|
43217
43244
|
if (n && i.readyState !== n.readyState)
|
|
43218
43245
|
try {
|
|
43219
|
-
i.readyState ===
|
|
43246
|
+
i.readyState === yt.CLOSED && n.readyState === yt.OPEN ? n.close() : n.readyState === yt.CLOSED && i.readyState === yt.OPEN && i.close();
|
|
43220
43247
|
} catch {
|
|
43221
43248
|
}
|
|
43222
43249
|
}
|
|
@@ -44005,4 +44032,4 @@ export {
|
|
|
44005
44032
|
QC as y,
|
|
44006
44033
|
FC as z
|
|
44007
44034
|
};
|
|
44008
|
-
//# sourceMappingURL=index-
|
|
44035
|
+
//# sourceMappingURL=index-DF5PRoHl.mjs.map
|