@ton/mcp 0.1.15-alpha.3 → 0.1.15-alpha.4
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 +109 -87
- package/dist/index.cjs +109 -87
- package/dist/index.js +109 -87
- package/dist/serverless.cjs +109 -87
- package/dist/serverless.js +109 -87
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -81201,37 +81201,37 @@ var import_blakejs = /* @__PURE__ */ __toESM(require_blakejs(), 1);
|
|
|
81201
81201
|
function P() {
|
|
81202
81202
|
return typeof process < "u" && !!process.env;
|
|
81203
81203
|
}
|
|
81204
|
-
function B(
|
|
81205
|
-
return process?.env?.[
|
|
81204
|
+
function B(i) {
|
|
81205
|
+
return process?.env?.[i];
|
|
81206
81206
|
}
|
|
81207
|
-
var O = P() && !B("TONBRIDGE_DEBUG"), s = (...
|
|
81208
|
-
O || console.debug("[TON_CONNECT_BRIDGE_SDK]", ...
|
|
81209
|
-
}, b = (...
|
|
81210
|
-
console.error("[TON_CONNECT_BRIDGE_SDK]", ...
|
|
81207
|
+
var O = P() && !B("TONBRIDGE_DEBUG"), s = (...i) => {
|
|
81208
|
+
O || console.debug("[TON_CONNECT_BRIDGE_SDK]", ...i);
|
|
81209
|
+
}, b = (...i) => {
|
|
81210
|
+
console.error("[TON_CONNECT_BRIDGE_SDK]", ...i);
|
|
81211
81211
|
};
|
|
81212
|
-
var a = class
|
|
81212
|
+
var a = class i extends Error {
|
|
81213
81213
|
static prefix = "[BRIDGE_SDK_ERROR]";
|
|
81214
81214
|
constructor(e, t) {
|
|
81215
|
-
super(e, t), this.message = `${
|
|
81216
|
-
` + e : ""}`, s(this.message), Object.setPrototypeOf(this,
|
|
81215
|
+
super(e, t), this.message = `${i.prefix} ${e ? `
|
|
81216
|
+
` + e : ""}`, s(this.message), Object.setPrototypeOf(this, i.prototype);
|
|
81217
81217
|
}
|
|
81218
81218
|
};
|
|
81219
|
-
function k(
|
|
81220
|
-
return
|
|
81219
|
+
function k(i) {
|
|
81220
|
+
return i.slice(-1) === "/" ? i.slice(0, -1) : i;
|
|
81221
81221
|
}
|
|
81222
|
-
function
|
|
81223
|
-
return k(
|
|
81222
|
+
function v(i, e) {
|
|
81223
|
+
return k(i) + "/" + e;
|
|
81224
81224
|
}
|
|
81225
|
-
function p(
|
|
81225
|
+
function p(i) {
|
|
81226
81226
|
let e = new AbortController();
|
|
81227
|
-
return
|
|
81227
|
+
return i?.aborted ? e.abort() : i?.addEventListener("abort", () => e.abort(), { once: true }), e;
|
|
81228
81228
|
}
|
|
81229
|
-
function
|
|
81229
|
+
function M(i, e) {
|
|
81230
81230
|
let t = null, r = null, n = null;
|
|
81231
81231
|
return {
|
|
81232
81232
|
create: async (d, ...u) => {
|
|
81233
81233
|
if (n?.abort(), n = p(d), n.signal.aborted) throw new a("Resource creation was aborted");
|
|
81234
|
-
let m =
|
|
81234
|
+
let m = i(n.signal, ...u);
|
|
81235
81235
|
r = m;
|
|
81236
81236
|
let g = await m;
|
|
81237
81237
|
if (r !== m && g !== t) throw await e(g), new a("Resource creation was aborted by a new resource creation");
|
|
@@ -81252,9 +81252,9 @@ function D(o, e) {
|
|
|
81252
81252
|
}
|
|
81253
81253
|
};
|
|
81254
81254
|
}
|
|
81255
|
-
function
|
|
81255
|
+
function D(i, e) {
|
|
81256
81256
|
let t = e?.timeout, r = e?.signal, n = p(r);
|
|
81257
|
-
return new Promise(async (
|
|
81257
|
+
return new Promise(async (o, c) => {
|
|
81258
81258
|
if (r?.aborted) {
|
|
81259
81259
|
c(new a("Timeout aborted before setTimeout"));
|
|
81260
81260
|
return;
|
|
@@ -81264,8 +81264,8 @@ function M(o, e) {
|
|
|
81264
81264
|
n.abort(), c(new a(`Timeout after ${t}ms`));
|
|
81265
81265
|
}, t)), n.signal.addEventListener("abort", () => {
|
|
81266
81266
|
l && (clearTimeout(l), l = void 0, c(new a("Timeout aborted after setTimeout")));
|
|
81267
|
-
}, { once: true }), await
|
|
81268
|
-
clearTimeout(l), l = void 0,
|
|
81267
|
+
}, { once: true }), await i((...d) => {
|
|
81268
|
+
clearTimeout(l), l = void 0, o(...d);
|
|
81269
81269
|
}, (d) => {
|
|
81270
81270
|
clearTimeout(l), l = void 0, c(d);
|
|
81271
81271
|
}, {
|
|
@@ -81274,22 +81274,23 @@ function M(o, e) {
|
|
|
81274
81274
|
});
|
|
81275
81275
|
});
|
|
81276
81276
|
}
|
|
81277
|
-
var
|
|
81278
|
-
constructor(e, t, r, n,
|
|
81277
|
+
var y = class i {
|
|
81278
|
+
constructor(e, t, r, n, o, c, l) {
|
|
81279
81279
|
this.bridgeUrl = e;
|
|
81280
81280
|
this.sessionIds = t;
|
|
81281
81281
|
this.listener = r;
|
|
81282
81282
|
this.errorsListener = n;
|
|
81283
|
-
this.lastEventId =
|
|
81283
|
+
this.lastEventId = o;
|
|
81284
81284
|
this.heartbeatFormat = c;
|
|
81285
81285
|
this.enableQueueDoneEvent = l;
|
|
81286
81286
|
}
|
|
81287
81287
|
static ssePath = "events";
|
|
81288
81288
|
static postPath = "message";
|
|
81289
|
+
static verifyPath = "verify";
|
|
81289
81290
|
static defaultTtl = 300;
|
|
81290
|
-
eventSource =
|
|
81291
|
+
eventSource = M(async (e, t) => await U({
|
|
81291
81292
|
bridgeUrl: this.bridgeUrl,
|
|
81292
|
-
ssePath:
|
|
81293
|
+
ssePath: i.ssePath,
|
|
81293
81294
|
sessionIds: this.sessionIds,
|
|
81294
81295
|
errorHandler: this.errorsHandler.bind(this),
|
|
81295
81296
|
messageHandler: this.messagesHandler.bind(this),
|
|
@@ -81311,7 +81312,7 @@ var v = class o {
|
|
|
81311
81312
|
return this.eventSource.current()?.readyState === EventSource.CONNECTING;
|
|
81312
81313
|
}
|
|
81313
81314
|
static async open(e) {
|
|
81314
|
-
let t = new
|
|
81315
|
+
let t = new i(e.bridgeUrl, e.sessionIds, e.listener, e.errorsListener, e.lastEventId, e.heartbeatFormat, e.enableQueueDoneEvent);
|
|
81315
81316
|
try {
|
|
81316
81317
|
return await t.registerSession(e.options), t;
|
|
81317
81318
|
} catch (r) {
|
|
@@ -81321,14 +81322,25 @@ var v = class o {
|
|
|
81321
81322
|
async registerSession(e) {
|
|
81322
81323
|
await this.eventSource.create(e?.signal, e?.connectingDeadlineMS);
|
|
81323
81324
|
}
|
|
81324
|
-
static async
|
|
81325
|
-
let
|
|
81326
|
-
|
|
81327
|
-
|
|
81328
|
-
|
|
81325
|
+
static async verifyRequest(e, t, r) {
|
|
81326
|
+
let n = new URL(v(e, this.verifyPath));
|
|
81327
|
+
return { status: (await (await this.post(n, {
|
|
81328
|
+
client_id: t.clientId,
|
|
81329
|
+
url: t.url,
|
|
81330
|
+
type: t.type
|
|
81331
|
+
}, r?.signal)).json()).status };
|
|
81332
|
+
}
|
|
81333
|
+
static async sendRequest(e, t, r, n, o) {
|
|
81334
|
+
let c = new URL(v(e, this.postPath));
|
|
81335
|
+
c.searchParams.append("client_id", r), c.searchParams.append("to", n), c.searchParams.append("ttl", (o?.ttl ?? i.defaultTtl).toString()), o?.topic && c.searchParams.append("topic", o.topic), o?.traceId && c.searchParams.append("trace_id", o.traceId);
|
|
81336
|
+
let l = Base64.encode(t);
|
|
81337
|
+
await this.post(c, l, o?.signal);
|
|
81338
|
+
}
|
|
81339
|
+
async verify(e, t) {
|
|
81340
|
+
return i.verifyRequest(this.bridgeUrl, e, t);
|
|
81329
81341
|
}
|
|
81330
81342
|
async send(e, t, r, n) {
|
|
81331
|
-
return
|
|
81343
|
+
return i.sendRequest(this.bridgeUrl, e, t, r, n);
|
|
81332
81344
|
}
|
|
81333
81345
|
async close() {
|
|
81334
81346
|
await this.eventSource.dispose().catch((e) => {
|
|
@@ -81344,10 +81356,11 @@ var v = class o {
|
|
|
81344
81356
|
static async post(e, t, r) {
|
|
81345
81357
|
let n = await fetch(e, {
|
|
81346
81358
|
method: "post",
|
|
81347
|
-
body: t,
|
|
81348
|
-
signal: r
|
|
81359
|
+
body: typeof t == "object" ? JSON.stringify(t) : t,
|
|
81360
|
+
signal: r,
|
|
81361
|
+
headers: typeof t == "object" ? { "Content-Type": "application/json" } : void 0
|
|
81349
81362
|
});
|
|
81350
|
-
if (!n.ok) throw new a(`Bridge
|
|
81363
|
+
if (!n.ok) throw new a(`Bridge post failed, status ${n.status}`);
|
|
81351
81364
|
return n;
|
|
81352
81365
|
}
|
|
81353
81366
|
async errorsHandler(e, t) {
|
|
@@ -81357,96 +81370,96 @@ var v = class o {
|
|
|
81357
81370
|
this.listener(e);
|
|
81358
81371
|
}
|
|
81359
81372
|
};
|
|
81360
|
-
async function U(
|
|
81361
|
-
let { lastEventId: e, heartbeatFormat: t, enableQueueDoneEvent: r } =
|
|
81362
|
-
return await
|
|
81373
|
+
async function U(i) {
|
|
81374
|
+
let { lastEventId: e, heartbeatFormat: t, enableQueueDoneEvent: r } = i;
|
|
81375
|
+
return await D(async (n, o, c) => {
|
|
81363
81376
|
let { signal: l } = c;
|
|
81364
81377
|
if (s("[BridgeGateway] Connecting to bridge SSE..."), l?.aborted) {
|
|
81365
|
-
|
|
81378
|
+
o(new a("Bridge connection aborted before connection"));
|
|
81366
81379
|
return;
|
|
81367
81380
|
}
|
|
81368
|
-
let d = new URL(
|
|
81369
|
-
if (d.searchParams.append("client_id",
|
|
81370
|
-
|
|
81381
|
+
let d = new URL(v(i.bridgeUrl, i.ssePath));
|
|
81382
|
+
if (d.searchParams.append("client_id", i.sessionIds.join(",")), e && d.searchParams.append("last_event_id", e), t && d.searchParams.append("heartbeat", t), r && d.searchParams.append("enable_queue_done_event", "true"), l?.aborted) {
|
|
81383
|
+
o(new a("Bridge connection aborted after building url"));
|
|
81371
81384
|
return;
|
|
81372
81385
|
}
|
|
81373
81386
|
s("[BridgeGateway] Initializing EventSource instance...");
|
|
81374
81387
|
let u = new EventSource(d.toString()), m = false;
|
|
81375
81388
|
u.onerror = async (g) => {
|
|
81376
81389
|
if (s("[BridgeGateway] EventSource error occurred:", JSON.stringify(g)), l?.aborted) {
|
|
81377
|
-
u.close(),
|
|
81390
|
+
u.close(), o(new a("Bridge connection aborted on error callback"));
|
|
81378
81391
|
return;
|
|
81379
81392
|
}
|
|
81380
81393
|
if (!m) {
|
|
81381
|
-
u.close(),
|
|
81394
|
+
u.close(), o(new a("Bridge error before connecting"));
|
|
81382
81395
|
return;
|
|
81383
81396
|
}
|
|
81384
81397
|
try {
|
|
81385
|
-
u.close(), await
|
|
81386
|
-
} catch (
|
|
81387
|
-
u.close(),
|
|
81398
|
+
u.close(), await i.errorHandler(u, g);
|
|
81399
|
+
} catch (I) {
|
|
81400
|
+
u.close(), o(I);
|
|
81388
81401
|
}
|
|
81389
81402
|
}, u.onopen = () => {
|
|
81390
81403
|
if (l?.aborted) {
|
|
81391
|
-
u.close(),
|
|
81404
|
+
u.close(), o(new a("Bridge connection aborted on open"));
|
|
81392
81405
|
return;
|
|
81393
81406
|
}
|
|
81394
81407
|
m = true, s("[BridgeGateway] EventSource connection established."), n(u);
|
|
81395
81408
|
}, u.onmessage = (g) => {
|
|
81396
81409
|
if (l?.aborted) {
|
|
81397
|
-
u.close(),
|
|
81410
|
+
u.close(), o(new a("Bridge connection aborted on message"));
|
|
81398
81411
|
return;
|
|
81399
81412
|
}
|
|
81400
|
-
e = g.lastEventId,
|
|
81401
|
-
},
|
|
81402
|
-
u.close(),
|
|
81413
|
+
e = g.lastEventId, i.messageHandler(g);
|
|
81414
|
+
}, i.signal?.addEventListener("abort", () => {
|
|
81415
|
+
u.close(), o(new a("Bridge connection aborted"));
|
|
81403
81416
|
}, { once: true });
|
|
81404
81417
|
}, {
|
|
81405
|
-
timeout:
|
|
81406
|
-
signal:
|
|
81418
|
+
timeout: i.connectingDeadlineMS,
|
|
81419
|
+
signal: i.signal
|
|
81407
81420
|
});
|
|
81408
81421
|
}
|
|
81409
|
-
async function
|
|
81422
|
+
async function h(i, e) {
|
|
81410
81423
|
if (e?.signal?.aborted) throw new a("Delay aborted before setTimeout");
|
|
81411
81424
|
return new Promise((t, r) => {
|
|
81412
|
-
let n = setTimeout(t,
|
|
81425
|
+
let n = setTimeout(t, i);
|
|
81413
81426
|
e?.signal?.addEventListener("abort", () => {
|
|
81414
81427
|
clearTimeout(n), r(new a("Delay aborted after setTimeout"));
|
|
81415
81428
|
}, { once: true });
|
|
81416
81429
|
});
|
|
81417
81430
|
}
|
|
81418
|
-
async function
|
|
81431
|
+
async function f(i, e) {
|
|
81419
81432
|
let { signal: t, attempts: r = 10, delayMs: n = 100 } = e ?? {};
|
|
81420
|
-
if (typeof
|
|
81421
|
-
let
|
|
81422
|
-
for (;
|
|
81423
|
-
if (s(`[callForSuccess] Attempt: ${
|
|
81433
|
+
if (typeof i != "function") throw new a(`Expected a function, got ${typeof i}`);
|
|
81434
|
+
let o = 0, c;
|
|
81435
|
+
for (; o < r;) {
|
|
81436
|
+
if (s(`[callForSuccess] Attempt: ${o}`), t?.aborted) throw new a(`Aborted after attempts ${o}`);
|
|
81424
81437
|
try {
|
|
81425
|
-
return await
|
|
81438
|
+
return await i({ signal: t });
|
|
81426
81439
|
} catch (l) {
|
|
81427
|
-
s(`[callForSuccess], error after attempt ${
|
|
81440
|
+
s(`[callForSuccess], error after attempt ${o}, ${/* @__PURE__ */ new Date()}: ${JSON.stringify(l)}`, l), c = l, o++, o < r && (await h(n, { signal: t }), e?.exponential && (n = Math.min(n * 2, e.maxDelayMs ?? Number.MAX_SAFE_INTEGER)));
|
|
81428
81441
|
}
|
|
81429
81442
|
}
|
|
81430
81443
|
throw c;
|
|
81431
81444
|
}
|
|
81432
|
-
function
|
|
81433
|
-
return [...new Set(
|
|
81445
|
+
function x(i) {
|
|
81446
|
+
return [...new Set(i)];
|
|
81434
81447
|
}
|
|
81435
|
-
function
|
|
81436
|
-
let t = new Set(
|
|
81448
|
+
function T(i, e) {
|
|
81449
|
+
let t = new Set(i), r = new Set(e);
|
|
81437
81450
|
if (t.size !== r.size) return false;
|
|
81438
81451
|
for (let n of t) if (!r.has(n)) return false;
|
|
81439
81452
|
return true;
|
|
81440
81453
|
}
|
|
81441
|
-
function G(
|
|
81454
|
+
function G(i, e) {
|
|
81442
81455
|
let t = import_blakejs.default.blake2bInit(import_nacl_fast.default.box.nonceLength);
|
|
81443
|
-
return import_blakejs.default.blake2bUpdate(t,
|
|
81456
|
+
return import_blakejs.default.blake2bUpdate(t, i), import_blakejs.default.blake2bUpdate(t, e), import_blakejs.default.blake2bFinal(t);
|
|
81444
81457
|
}
|
|
81445
|
-
function
|
|
81446
|
-
let r =
|
|
81447
|
-
return import_nacl_fast.default.box.open(
|
|
81458
|
+
function R(i, e, t) {
|
|
81459
|
+
let r = i.subarray(0, import_nacl_fast.default.box.publicKeyLength), n = G(r, e), o = i.subarray(import_nacl_fast.default.box.publicKeyLength);
|
|
81460
|
+
return import_nacl_fast.default.box.open(o, n, r, t);
|
|
81448
81461
|
}
|
|
81449
|
-
var C = class
|
|
81462
|
+
var C = class i {
|
|
81450
81463
|
constructor(e, t = null, r = null, n = void 0) {
|
|
81451
81464
|
this.bridgeUrl = e;
|
|
81452
81465
|
this.listener = t;
|
|
@@ -81469,7 +81482,7 @@ var C = class o {
|
|
|
81469
81482
|
heartbeatTimer = null;
|
|
81470
81483
|
connectionOptions = {};
|
|
81471
81484
|
static async open(e) {
|
|
81472
|
-
let t = new
|
|
81485
|
+
let t = new i(e.bridgeUrl, e.listener, e.errorListener, e.options?.heartbeatReconnectIntervalMs);
|
|
81473
81486
|
e.onConnecting && (t.onConnecting = e.onConnecting), e.onQueueDone && (t.onQueueDone = e.onQueueDone);
|
|
81474
81487
|
try {
|
|
81475
81488
|
return await t.restoreConnection(e.clients, e.options), t;
|
|
@@ -81492,8 +81505,8 @@ var C = class o {
|
|
|
81492
81505
|
let { signal: r } = p(e);
|
|
81493
81506
|
this.lastHeartbeatAt = Date.now();
|
|
81494
81507
|
let n = (c) => {
|
|
81495
|
-
this.heartbeatTimer = setTimeout(
|
|
81496
|
-
},
|
|
81508
|
+
this.heartbeatTimer = setTimeout(o, c);
|
|
81509
|
+
}, o = async () => {
|
|
81497
81510
|
if (r.aborted) {
|
|
81498
81511
|
this.stopHeartbeatWatcher();
|
|
81499
81512
|
return;
|
|
@@ -81502,7 +81515,7 @@ var C = class o {
|
|
|
81502
81515
|
n(this.heartbeatReconnectIntervalMs / 2);
|
|
81503
81516
|
return;
|
|
81504
81517
|
}
|
|
81505
|
-
if (await
|
|
81518
|
+
if (await h(this.missedHeartbeatDelay, { signal: r }), r.aborted) {
|
|
81506
81519
|
this.stopHeartbeatWatcher();
|
|
81507
81520
|
return;
|
|
81508
81521
|
}
|
|
@@ -81548,7 +81561,7 @@ var C = class o {
|
|
|
81548
81561
|
this.startHeartbeatWatcher(t?.signal);
|
|
81549
81562
|
}
|
|
81550
81563
|
async updateClients(e, t) {
|
|
81551
|
-
|
|
81564
|
+
T(this.clients.map((o) => o.session.sessionId), e.map((o) => o.session.sessionId)) || (this.clients = e, await this.restoreConnection(e, {
|
|
81552
81565
|
...this.connectionOptions,
|
|
81553
81566
|
signal: t?.signal
|
|
81554
81567
|
}));
|
|
@@ -81564,7 +81577,7 @@ var C = class o {
|
|
|
81564
81577
|
return;
|
|
81565
81578
|
}
|
|
81566
81579
|
let t = this.connectionOptions;
|
|
81567
|
-
await
|
|
81580
|
+
await f(({ signal: r }) => this.openGateway(this.clients.map((n) => n.session), {
|
|
81568
81581
|
lastEventId: this.lastEventId,
|
|
81569
81582
|
connectingDeadlineMS: t?.connectingDeadlineMs ?? this.defaultConnectingDeadlineMS,
|
|
81570
81583
|
signal: r
|
|
@@ -81576,14 +81589,23 @@ var C = class o {
|
|
|
81576
81589
|
maxDelayMs: t?.maxDelayMs ?? this.defaultMaxExponentialDelayMS
|
|
81577
81590
|
});
|
|
81578
81591
|
}
|
|
81592
|
+
async verify(e, t) {
|
|
81593
|
+
return f(async ({ signal: r }) => y.verifyRequest(this.bridgeUrl, e, { signal: r }), {
|
|
81594
|
+
attempts: t?.attempts ?? Number.MAX_SAFE_INTEGER,
|
|
81595
|
+
delayMs: t?.delayMs ?? this.defaultRetryDelayMs,
|
|
81596
|
+
signal: t?.signal,
|
|
81597
|
+
exponential: t?.exponential ?? true,
|
|
81598
|
+
maxDelayMs: t?.maxDelayMs ?? this.defaultMaxExponentialDelayMS
|
|
81599
|
+
});
|
|
81600
|
+
}
|
|
81579
81601
|
async send(e, t, r, n) {
|
|
81580
81602
|
if (n?.signal?.aborted) {
|
|
81581
81603
|
s("[BridgeProvider] Send aborted before encryption.");
|
|
81582
81604
|
return;
|
|
81583
81605
|
}
|
|
81584
|
-
let
|
|
81585
|
-
await
|
|
81586
|
-
await
|
|
81606
|
+
let o = t.encrypt(JSON.stringify(e), hexToByteArray(r)), c = n?.topic ?? ("method" in e ? e.method : void 0);
|
|
81607
|
+
await f(async ({ signal: l }) => {
|
|
81608
|
+
await y.sendRequest(this.bridgeUrl, o, t.sessionId, r, {
|
|
81587
81609
|
traceId: n?.traceId,
|
|
81588
81610
|
topic: c,
|
|
81589
81611
|
signal: l,
|
|
@@ -81628,7 +81650,7 @@ var C = class o {
|
|
|
81628
81650
|
}
|
|
81629
81651
|
loadMaybeSource(e, t) {
|
|
81630
81652
|
if (!t) return;
|
|
81631
|
-
let r =
|
|
81653
|
+
let r = R(Base64.decode(t).toUint8Array(), hexToByteArray(e.sessionId), hexToByteArray(e.stringifyKeypair().secretKey));
|
|
81632
81654
|
if (!r) throw new Error("Decrypt error ");
|
|
81633
81655
|
let n = JSON.parse(new TextDecoder().decode(r));
|
|
81634
81656
|
return {
|
|
@@ -81655,13 +81677,13 @@ var C = class o {
|
|
|
81655
81677
|
this.errorListener?.(new a(`Failed to parse message: ${e.data}`));
|
|
81656
81678
|
return;
|
|
81657
81679
|
}
|
|
81658
|
-
let r = this.getCryptoSession(t.from), n = JSON.parse(r.decrypt(Base64.decode(t.message).toUint8Array(), hexToByteArray(t.from))),
|
|
81680
|
+
let r = this.getCryptoSession(t.from), n = JSON.parse(r.decrypt(Base64.decode(t.message).toUint8Array(), hexToByteArray(t.from))), o = this.loadMaybeSource(r, t.request_source);
|
|
81659
81681
|
s("[BridgeProvider] Incoming message decrypted:", n), this.lastEventId = e.lastEventId, this.listener?.({
|
|
81660
81682
|
lastEventId: e.lastEventId,
|
|
81661
81683
|
traceId: t.trace_id,
|
|
81662
81684
|
...n,
|
|
81663
81685
|
from: t.from,
|
|
81664
|
-
requestSource:
|
|
81686
|
+
requestSource: o,
|
|
81665
81687
|
connectSource: t.connect_source
|
|
81666
81688
|
});
|
|
81667
81689
|
}
|
|
@@ -81686,7 +81708,7 @@ var C = class o {
|
|
|
81686
81708
|
s("[BridgeProvider] Open gateway aborted after close.");
|
|
81687
81709
|
return;
|
|
81688
81710
|
}
|
|
81689
|
-
this.gateway = new
|
|
81711
|
+
this.gateway = new y(this.bridgeUrl, x(e.map(({ sessionId: r }) => r)), this.gatewayListener.bind(this), this.gatewayErrorsListener.bind(this), this.lastEventId, "message", true), s("[BridgeProvider] BridgeGateway created. Connecting to bridge..."), this.onConnectingCallback?.(), await this.gateway.registerSession({
|
|
81690
81712
|
connectingDeadlineMS: t?.connectingDeadlineMS,
|
|
81691
81713
|
signal: t?.signal
|
|
81692
81714
|
}), s("[BridgeProvider] Connected to bridge successfully.");
|