@pluno/product-agent-web 0.1.239 → 0.1.241
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.
|
@@ -28,7 +28,7 @@ type Options = {
|
|
|
28
28
|
backendUrl: string;
|
|
29
29
|
auth: ProductAgentSocketAuth;
|
|
30
30
|
onReady: (ready: Ready) => void;
|
|
31
|
-
onDisconnect: (intentional: boolean) => void;
|
|
31
|
+
onDisconnect: (intentional: boolean, reason: string) => void;
|
|
32
32
|
onEvent: (name: string, event: unknown) => void;
|
|
33
33
|
onToolCall: (event: unknown) => boolean | Promise<boolean>;
|
|
34
34
|
onError: (error: ProductAgentSocketError) => void;
|
|
@@ -78,7 +78,7 @@ export declare class ProductAgentSocketIOTransport {
|
|
|
78
78
|
get connectionAttempt(): ProductAgentConnectionAttempt | null;
|
|
79
79
|
markReady(): void;
|
|
80
80
|
private restoreBackoff;
|
|
81
|
-
recover(): void;
|
|
81
|
+
recover(reason?: string): void;
|
|
82
82
|
private beginAttempt;
|
|
83
83
|
private clearReadinessTimers;
|
|
84
84
|
retain(sessionId: string, owner: string): Promise<void>;
|
|
@@ -1248,7 +1248,7 @@ function Zn(s) {
|
|
|
1248
1248
|
}
|
|
1249
1249
|
}).catch((a) => {
|
|
1250
1250
|
const c = Ve(a);
|
|
1251
|
-
if (["connection_interrupted", "request_timed_out", "request_cancelled", "408", "425", "429", "500", "502", "503", "504"].includes(c.code))
|
|
1251
|
+
if (["display_projection_disabled", "409", "connection_interrupted", "request_timed_out", "request_cancelled", "408", "425", "429", "500", "502", "503", "504"].includes(c.code))
|
|
1252
1252
|
throw Object.assign(c, { code: "history_load_failed", message: "We couldn’t refresh this conversation. Try again.", retryable: !0 });
|
|
1253
1253
|
if (Oi(c.code)) throw Object.assign(c, { retryable: !0 });
|
|
1254
1254
|
return i(a, { operation: "conversation.snapshot", requestId: o.requestId, sessionId: o.sessionId });
|
|
@@ -1632,7 +1632,7 @@ function ar(s) {
|
|
|
1632
1632
|
return e() && i.directory.memberships[t]?.members.length ? i.conversation.sessions[t] ?? null : null;
|
|
1633
1633
|
}, s.invalidateAuth), async (t) => (!e() || t.authorityId !== s.authority.authorityId || t.generation !== s.authority.generation || !s.runtime().engine.getState().slices.directory.memberships[t.sessionId]?.members.length || (s.manager.receiveConversationSources(t.sources), s.notify()), null);
|
|
1634
1634
|
}
|
|
1635
|
-
const cr = "0.1.
|
|
1635
|
+
const cr = "0.1.241", dr = {
|
|
1636
1636
|
version: cr
|
|
1637
1637
|
};
|
|
1638
1638
|
function et(s) {
|
|
@@ -4104,8 +4104,11 @@ class uo {
|
|
|
4104
4104
|
forceNew: !0,
|
|
4105
4105
|
auth: { ...e.auth },
|
|
4106
4106
|
reconnection: e.reconnect ?? !0
|
|
4107
|
-
}), this.socket.io.on("reconnect_attempt", () => this.beginAttempt()), this.socket.io.on("close", () => {
|
|
4108
|
-
this.
|
|
4107
|
+
}), this.socket.io.on("reconnect_attempt", () => this.beginAttempt()), this.socket.io.on("close", (t) => {
|
|
4108
|
+
const i = this.generation, n = this.attempt;
|
|
4109
|
+
t === "forced close" ? queueMicrotask(() => {
|
|
4110
|
+
i === this.generation && n === this.attempt && this.invalidate(!1, t);
|
|
4111
|
+
}) : this.invalidate(!1, t), this.restoreBackoff();
|
|
4109
4112
|
}), this.socket.io.on("reconnect", () => this.restoreBackoff()), this.socket.on("connection.ready", (t) => {
|
|
4110
4113
|
if (t.protocol !== 1 || t.role !== this.options.auth.role || t.display_projection_ready !== !1) {
|
|
4111
4114
|
this.options.onError(new w("Unsupported Product Agent transport negotiation", "protocol_error")), this.disconnect();
|
|
@@ -4115,7 +4118,8 @@ class uo {
|
|
|
4115
4118
|
}), this.socket.on("connect", () => {
|
|
4116
4119
|
this.active = !0, this.activate();
|
|
4117
4120
|
}), this.socket.on("disconnect", (t) => this.invalidate(
|
|
4118
|
-
t === "io client disconnect" && !this.replacingCredentials
|
|
4121
|
+
t === "io client disconnect" && !this.replacingCredentials,
|
|
4122
|
+
t
|
|
4119
4123
|
)), this.socket.on("connect_error", (t) => {
|
|
4120
4124
|
const i = t.data?.code;
|
|
4121
4125
|
if (i === "unauthorized" && t.data?.reason === "token_expired" && t.data.retryable === !0) {
|
|
@@ -4123,7 +4127,7 @@ class uo {
|
|
|
4123
4127
|
return;
|
|
4124
4128
|
}
|
|
4125
4129
|
if (!i || t.data?.retryable === !0) {
|
|
4126
|
-
if (this.invalidate(!1), this.options.reconnect === !1)
|
|
4130
|
+
if (this.invalidate(!1, "connect_error"), this.options.reconnect === !1)
|
|
4127
4131
|
this.socket.disconnect();
|
|
4128
4132
|
else {
|
|
4129
4133
|
const n = this.socket.io;
|
|
@@ -4206,10 +4210,10 @@ class uo {
|
|
|
4206
4210
|
}
|
|
4207
4211
|
}
|
|
4208
4212
|
replaceCredentials(e, t) {
|
|
4209
|
-
this.replacingCredentials = !0, this.invalidate(!1), this.socket.disconnect(), this.replacingCredentials = !1, this.invalidate(!1), t && this.bindings.clear(), this.options.auth = { ...e }, this.socket.auth = { ...e }, this.connect();
|
|
4213
|
+
this.replacingCredentials = !0, this.invalidate(!1, "credential_replacement"), this.socket.disconnect(), this.replacingCredentials = !1, this.invalidate(!1, "credential_replacement"), t && this.bindings.clear(), this.options.auth = { ...e }, this.socket.auth = { ...e }, this.connect();
|
|
4210
4214
|
}
|
|
4211
4215
|
suspend() {
|
|
4212
|
-
this.replacingCredentials = !0, this.invalidate(!1), this.socket.disconnect(), this.replacingCredentials = !1, this.invalidate(!1);
|
|
4216
|
+
this.replacingCredentials = !0, this.invalidate(!1, "local_suspend"), this.socket.disconnect(), this.replacingCredentials = !1, this.invalidate(!1, "local_suspend");
|
|
4213
4217
|
}
|
|
4214
4218
|
disconnect() {
|
|
4215
4219
|
this.invalidate(!0), this.socket.disconnect();
|
|
@@ -4227,8 +4231,8 @@ class uo {
|
|
|
4227
4231
|
const e = this.socket.io;
|
|
4228
4232
|
e.backoff.attempts = Math.min(20, Math.max(0, this.attemptCount - 1));
|
|
4229
4233
|
}
|
|
4230
|
-
recover() {
|
|
4231
|
-
!this.active || this.retired || (this.invalidate(!1), this.socket.io.engine.close());
|
|
4234
|
+
recover(e = "local_recovery") {
|
|
4235
|
+
!this.active || this.retired || (this.invalidate(!1, e), this.socket.io.engine.close());
|
|
4232
4236
|
}
|
|
4233
4237
|
beginAttempt() {
|
|
4234
4238
|
this.clearReadinessTimers(), this.active = !0, this.attempt = { connectionAttemptId: crypto.randomUUID(), reconnectAttempt: this.attemptCount++, startedAt: Date.now() }, this.socket.auth = { ...this.options.auth, connection_attempt_id: this.attempt.connectionAttemptId }, this.options.onAttempt?.(this.attempt);
|
|
@@ -4237,7 +4241,7 @@ class uo {
|
|
|
4237
4241
|
retryable: !0,
|
|
4238
4242
|
...this.attempt,
|
|
4239
4243
|
readinessPhase: this.ready ? "bootstrap" : this.admitted ? "activation" : "namespace_ready"
|
|
4240
|
-
})), e === this.generation && this.recover());
|
|
4244
|
+
})), e === this.generation && this.recover(i));
|
|
4241
4245
|
};
|
|
4242
4246
|
this.admissionTimer = setTimeout(() => t("connect_timeout"), 15e3), this.readinessTimer = setTimeout(() => t("auth_timeout"), co);
|
|
4243
4247
|
}
|
|
@@ -4285,7 +4289,7 @@ class uo {
|
|
|
4285
4289
|
}
|
|
4286
4290
|
activationFailed(e) {
|
|
4287
4291
|
const t = this.generation;
|
|
4288
|
-
this.options.onError(e), t === this.generation && ((e.outcomeUnknown || e.detail?.retryable === !0) && this.options.reconnect !== !1 ? this.
|
|
4292
|
+
this.options.onError(e), t === this.generation && ((e.outcomeUnknown || e.detail?.retryable === !0) && this.options.reconnect !== !1 ? this.recover("local_activation_failure") : this.disconnect());
|
|
4289
4293
|
}
|
|
4290
4294
|
synchronize(e = !1) {
|
|
4291
4295
|
const t = this.generation;
|
|
@@ -4377,13 +4381,13 @@ class uo {
|
|
|
4377
4381
|
});
|
|
4378
4382
|
}
|
|
4379
4383
|
recoverUncertainDelivery(e, t) {
|
|
4380
|
-
e instanceof w && (e.outcomeUnknown || e.code === "backpressure" && !e.backendRefusal) && t === this.generation && this.active && this.
|
|
4384
|
+
e instanceof w && (e.outcomeUnknown || e.code === "backpressure" && !e.backendRefusal) && t === this.generation && this.active && this.recover(e.code === "backpressure" ? "local_backpressure" : "local_delivery_uncertain");
|
|
4381
4385
|
}
|
|
4382
|
-
invalidate(e = !1) {
|
|
4386
|
+
invalidate(e = !1, t = "local_invalidation") {
|
|
4383
4387
|
if (this.clearReadinessTimers(), !!this.active) {
|
|
4384
4388
|
this.active = !1, this.generation++, this.ready = null, this.admitted = null, this.activating = !1;
|
|
4385
|
-
for (const
|
|
4386
|
-
this.options.onDisconnect(e);
|
|
4389
|
+
for (const i of [...this.pending]) i(new w("Connection lost before acknowledgement", "delivery_unknown", !0));
|
|
4390
|
+
this.options.onDisconnect(e, t);
|
|
4387
4391
|
}
|
|
4388
4392
|
}
|
|
4389
4393
|
}
|
|
@@ -4926,12 +4930,12 @@ class D extends EventTarget {
|
|
|
4926
4930
|
onReady: () => {
|
|
4927
4931
|
this.readyState !== 3 && (this.readyState = 1, this.dispatchEvent(new Event("open")));
|
|
4928
4932
|
},
|
|
4929
|
-
onDisconnect: (t) => {
|
|
4933
|
+
onDisconnect: (t, i) => {
|
|
4930
4934
|
if (t) {
|
|
4931
4935
|
this.finishClose(!0);
|
|
4932
4936
|
return;
|
|
4933
4937
|
}
|
|
4934
|
-
this.readyState !== 3 && (this.resetBootstrap(), this.readyState = 0, this.initialized = !1, this.bootstrapped = !1, this.beforeBootstrap.length = 0, this.rejectToolReceipts(), this.dispatchEvent(new
|
|
4938
|
+
this.readyState !== 3 && (this.resetBootstrap(), this.readyState = 0, this.initialized = !1, this.bootstrapped = !1, this.beforeBootstrap.length = 0, this.rejectToolReceipts(), this.dispatchEvent(new CustomEvent("reconnecting", { detail: { reason: i } })));
|
|
4935
4939
|
},
|
|
4936
4940
|
onEvent: (t, i) => {
|
|
4937
4941
|
const n = i, r = n.sessionId ?? n.session?.id ?? n.item?.sessionId, o = this.hydration;
|
|
@@ -7987,8 +7991,8 @@ class bt {
|
|
|
7987
7991
|
});
|
|
7988
7992
|
this.socket = r, this.options.webSocketFactory && (this.socketConnectTimer = window.setTimeout(() => {
|
|
7989
7993
|
this.socket === r && r.readyState === WebSocket.CONNECTING && (N("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.reportTransportDiagnostic("connect_timeout"), this.replaceTimedOutSocket(r));
|
|
7990
|
-
}, Ua)), r.addEventListener("reconnecting", () => {
|
|
7991
|
-
this.socket === r && this.state.status !== "closed" && (this.refreshingDefaultCredentials || this.reportTransportDiagnostic("socket_closed", {
|
|
7994
|
+
}, Ua)), r.addEventListener("reconnecting", (o) => {
|
|
7995
|
+
this.socket === r && this.state.status !== "closed" && (this.refreshingDefaultCredentials || this.reportTransportDiagnostic("socket_closed", { disconnectReason: o.detail.reason }), this.setReconnectingState());
|
|
7992
7996
|
}), r.addEventListener("open", () => {
|
|
7993
7997
|
this.socket !== r || (this.clearSocketConnectTimer(), this.directoryObservation.reconnect().catch(() => {
|
|
7994
7998
|
}), this.conversationObservation?.wake(), N("web-sdk.agent", "Pluno socket opened", {
|
|
@@ -8890,7 +8894,7 @@ class bt {
|
|
|
8890
8894
|
}
|
|
8891
8895
|
/** @internal */
|
|
8892
8896
|
reportTransportDiagnostic(e, t = {}) {
|
|
8893
|
-
const i = typeof navigator > "u" ? "unknown" : navigator.onLine === !1 ? "offline" : "online", n = `${e}:${t.requestId ?? t.connectionAttemptId ?? "none"}:${t.closeCode ?? "none"}:${i}`, r = (/* @__PURE__ */ new Date()).toISOString(), o = this.transportDiagnosticEpisodes.get(n), a = {
|
|
8897
|
+
const i = typeof navigator > "u" ? "unknown" : navigator.onLine === !1 ? "offline" : "online", n = `${e}:${t.requestId ?? t.connectionAttemptId ?? "none"}:${t.closeCode ?? "none"}:${t.disconnectReason ?? "none"}:${i}`, r = (/* @__PURE__ */ new Date()).toISOString(), o = this.transportDiagnosticEpisodes.get(n), a = {
|
|
8894
8898
|
id: o?.id ?? crypto.randomUUID(),
|
|
8895
8899
|
phase: e,
|
|
8896
8900
|
entrySurface: this.options.entrySurface,
|
|
@@ -1371,7 +1371,7 @@ function Ip(t) {
|
|
|
1371
1371
|
}
|
|
1372
1372
|
}).catch((r) => {
|
|
1373
1373
|
const c = ss(r);
|
|
1374
|
-
if (["connection_interrupted", "request_timed_out", "request_cancelled", "408", "425", "429", "500", "502", "503", "504"].includes(c.code))
|
|
1374
|
+
if (["display_projection_disabled", "409", "connection_interrupted", "request_timed_out", "request_cancelled", "408", "425", "429", "500", "502", "503", "504"].includes(c.code))
|
|
1375
1375
|
throw Object.assign(c, { code: "history_load_failed", message: "We couldn’t refresh this conversation. Try again.", retryable: !0 });
|
|
1376
1376
|
if (Wl(c.code)) throw Object.assign(c, { retryable: !0 });
|
|
1377
1377
|
return i(r, { operation: "conversation.snapshot", requestId: a.requestId, sessionId: a.sessionId });
|
|
@@ -1820,7 +1820,7 @@ function Op(t) {
|
|
|
1820
1820
|
return e() && i.directory.memberships[n]?.members.length ? i.conversation.sessions[n] ?? null : null;
|
|
1821
1821
|
}, t.invalidateAuth), async (n) => (!e() || n.authorityId !== t.authority.authorityId || n.generation !== t.authority.generation || !t.runtime().engine.getState().slices.directory.memberships[n.sessionId]?.members.length || (t.manager.receiveConversationSources(n.sources), t.notify()), null);
|
|
1822
1822
|
}
|
|
1823
|
-
const Ql = "0.1.
|
|
1823
|
+
const Ql = "0.1.241", Np = {
|
|
1824
1824
|
version: Ql
|
|
1825
1825
|
}, Tt = /* @__PURE__ */ Object.create(null);
|
|
1826
1826
|
Tt.open = "0";
|
|
@@ -4158,8 +4158,11 @@ class qh {
|
|
|
4158
4158
|
forceNew: !0,
|
|
4159
4159
|
auth: { ...e.auth },
|
|
4160
4160
|
reconnection: e.reconnect ?? !0
|
|
4161
|
-
}), this.socket.io.on("reconnect_attempt", () => this.beginAttempt()), this.socket.io.on("close", () => {
|
|
4162
|
-
this.
|
|
4161
|
+
}), this.socket.io.on("reconnect_attempt", () => this.beginAttempt()), this.socket.io.on("close", (n) => {
|
|
4162
|
+
const i = this.generation, s = this.attempt;
|
|
4163
|
+
n === "forced close" ? queueMicrotask(() => {
|
|
4164
|
+
i === this.generation && s === this.attempt && this.invalidate(!1, n);
|
|
4165
|
+
}) : this.invalidate(!1, n), this.restoreBackoff();
|
|
4163
4166
|
}), this.socket.io.on("reconnect", () => this.restoreBackoff()), this.socket.on("connection.ready", (n) => {
|
|
4164
4167
|
if (n.protocol !== 1 || n.role !== this.options.auth.role || n.display_projection_ready !== !1) {
|
|
4165
4168
|
this.options.onError(new O("Unsupported Product Agent transport negotiation", "protocol_error")), this.disconnect();
|
|
@@ -4169,7 +4172,8 @@ class qh {
|
|
|
4169
4172
|
}), this.socket.on("connect", () => {
|
|
4170
4173
|
this.active = !0, this.activate();
|
|
4171
4174
|
}), this.socket.on("disconnect", (n) => this.invalidate(
|
|
4172
|
-
n === "io client disconnect" && !this.replacingCredentials
|
|
4175
|
+
n === "io client disconnect" && !this.replacingCredentials,
|
|
4176
|
+
n
|
|
4173
4177
|
)), this.socket.on("connect_error", (n) => {
|
|
4174
4178
|
const i = n.data?.code;
|
|
4175
4179
|
if (i === "unauthorized" && n.data?.reason === "token_expired" && n.data.retryable === !0) {
|
|
@@ -4177,7 +4181,7 @@ class qh {
|
|
|
4177
4181
|
return;
|
|
4178
4182
|
}
|
|
4179
4183
|
if (!i || n.data?.retryable === !0) {
|
|
4180
|
-
if (this.invalidate(!1), this.options.reconnect === !1)
|
|
4184
|
+
if (this.invalidate(!1, "connect_error"), this.options.reconnect === !1)
|
|
4181
4185
|
this.socket.disconnect();
|
|
4182
4186
|
else {
|
|
4183
4187
|
const s = this.socket.io;
|
|
@@ -4260,10 +4264,10 @@ class qh {
|
|
|
4260
4264
|
}
|
|
4261
4265
|
}
|
|
4262
4266
|
replaceCredentials(e, n) {
|
|
4263
|
-
this.replacingCredentials = !0, this.invalidate(!1), this.socket.disconnect(), this.replacingCredentials = !1, this.invalidate(!1), n && this.bindings.clear(), this.options.auth = { ...e }, this.socket.auth = { ...e }, this.connect();
|
|
4267
|
+
this.replacingCredentials = !0, this.invalidate(!1, "credential_replacement"), this.socket.disconnect(), this.replacingCredentials = !1, this.invalidate(!1, "credential_replacement"), n && this.bindings.clear(), this.options.auth = { ...e }, this.socket.auth = { ...e }, this.connect();
|
|
4264
4268
|
}
|
|
4265
4269
|
suspend() {
|
|
4266
|
-
this.replacingCredentials = !0, this.invalidate(!1), this.socket.disconnect(), this.replacingCredentials = !1, this.invalidate(!1);
|
|
4270
|
+
this.replacingCredentials = !0, this.invalidate(!1, "local_suspend"), this.socket.disconnect(), this.replacingCredentials = !1, this.invalidate(!1, "local_suspend");
|
|
4267
4271
|
}
|
|
4268
4272
|
disconnect() {
|
|
4269
4273
|
this.invalidate(!0), this.socket.disconnect();
|
|
@@ -4281,8 +4285,8 @@ class qh {
|
|
|
4281
4285
|
const e = this.socket.io;
|
|
4282
4286
|
e.backoff.attempts = Math.min(20, Math.max(0, this.attemptCount - 1));
|
|
4283
4287
|
}
|
|
4284
|
-
recover() {
|
|
4285
|
-
!this.active || this.retired || (this.invalidate(!1), this.socket.io.engine.close());
|
|
4288
|
+
recover(e = "local_recovery") {
|
|
4289
|
+
!this.active || this.retired || (this.invalidate(!1, e), this.socket.io.engine.close());
|
|
4286
4290
|
}
|
|
4287
4291
|
beginAttempt() {
|
|
4288
4292
|
this.clearReadinessTimers(), this.active = !0, this.attempt = { connectionAttemptId: crypto.randomUUID(), reconnectAttempt: this.attemptCount++, startedAt: Date.now() }, this.socket.auth = { ...this.options.auth, connection_attempt_id: this.attempt.connectionAttemptId }, this.options.onAttempt?.(this.attempt);
|
|
@@ -4291,7 +4295,7 @@ class qh {
|
|
|
4291
4295
|
retryable: !0,
|
|
4292
4296
|
...this.attempt,
|
|
4293
4297
|
readinessPhase: this.ready ? "bootstrap" : this.admitted ? "activation" : "namespace_ready"
|
|
4294
|
-
})), e === this.generation && this.recover());
|
|
4298
|
+
})), e === this.generation && this.recover(i));
|
|
4295
4299
|
};
|
|
4296
4300
|
this.admissionTimer = setTimeout(() => n("connect_timeout"), 15e3), this.readinessTimer = setTimeout(() => n("auth_timeout"), Ph);
|
|
4297
4301
|
}
|
|
@@ -4339,7 +4343,7 @@ class qh {
|
|
|
4339
4343
|
}
|
|
4340
4344
|
activationFailed(e) {
|
|
4341
4345
|
const n = this.generation;
|
|
4342
|
-
this.options.onError(e), n === this.generation && ((e.outcomeUnknown || e.detail?.retryable === !0) && this.options.reconnect !== !1 ? this.
|
|
4346
|
+
this.options.onError(e), n === this.generation && ((e.outcomeUnknown || e.detail?.retryable === !0) && this.options.reconnect !== !1 ? this.recover("local_activation_failure") : this.disconnect());
|
|
4343
4347
|
}
|
|
4344
4348
|
synchronize(e = !1) {
|
|
4345
4349
|
const n = this.generation;
|
|
@@ -4431,13 +4435,13 @@ class qh {
|
|
|
4431
4435
|
});
|
|
4432
4436
|
}
|
|
4433
4437
|
recoverUncertainDelivery(e, n) {
|
|
4434
|
-
e instanceof O && (e.outcomeUnknown || e.code === "backpressure" && !e.backendRefusal) && n === this.generation && this.active && this.
|
|
4438
|
+
e instanceof O && (e.outcomeUnknown || e.code === "backpressure" && !e.backendRefusal) && n === this.generation && this.active && this.recover(e.code === "backpressure" ? "local_backpressure" : "local_delivery_uncertain");
|
|
4435
4439
|
}
|
|
4436
|
-
invalidate(e = !1) {
|
|
4440
|
+
invalidate(e = !1, n = "local_invalidation") {
|
|
4437
4441
|
if (this.clearReadinessTimers(), !!this.active) {
|
|
4438
4442
|
this.active = !1, this.generation++, this.ready = null, this.admitted = null, this.activating = !1;
|
|
4439
|
-
for (const
|
|
4440
|
-
this.options.onDisconnect(e);
|
|
4443
|
+
for (const i of [...this.pending]) i(new O("Connection lost before acknowledgement", "delivery_unknown", !0));
|
|
4444
|
+
this.options.onDisconnect(e, n);
|
|
4441
4445
|
}
|
|
4442
4446
|
}
|
|
4443
4447
|
}
|
|
@@ -4980,12 +4984,12 @@ class Te extends EventTarget {
|
|
|
4980
4984
|
onReady: () => {
|
|
4981
4985
|
this.readyState !== 3 && (this.readyState = 1, this.dispatchEvent(new Event("open")));
|
|
4982
4986
|
},
|
|
4983
|
-
onDisconnect: (n) => {
|
|
4987
|
+
onDisconnect: (n, i) => {
|
|
4984
4988
|
if (n) {
|
|
4985
4989
|
this.finishClose(!0);
|
|
4986
4990
|
return;
|
|
4987
4991
|
}
|
|
4988
|
-
this.readyState !== 3 && (this.resetBootstrap(), this.readyState = 0, this.initialized = !1, this.bootstrapped = !1, this.beforeBootstrap.length = 0, this.rejectToolReceipts(), this.dispatchEvent(new
|
|
4992
|
+
this.readyState !== 3 && (this.resetBootstrap(), this.readyState = 0, this.initialized = !1, this.bootstrapped = !1, this.beforeBootstrap.length = 0, this.rejectToolReceipts(), this.dispatchEvent(new CustomEvent("reconnecting", { detail: { reason: i } })));
|
|
4989
4993
|
},
|
|
4990
4994
|
onEvent: (n, i) => {
|
|
4991
4995
|
const s = i, o = s.sessionId ?? s.session?.id ?? s.item?.sessionId, a = this.hydration;
|
|
@@ -7508,8 +7512,8 @@ class Qr {
|
|
|
7508
7512
|
});
|
|
7509
7513
|
this.socket = o, this.options.webSocketFactory && (this.socketConnectTimer = window.setTimeout(() => {
|
|
7510
7514
|
this.socket === o && o.readyState === WebSocket.CONNECTING && (Me("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.reportTransportDiagnostic("connect_timeout"), this.replaceTimedOutSocket(o));
|
|
7511
|
-
}, lf)), o.addEventListener("reconnecting", () => {
|
|
7512
|
-
this.socket === o && this.state.status !== "closed" && (this.refreshingDefaultCredentials || this.reportTransportDiagnostic("socket_closed", {
|
|
7515
|
+
}, lf)), o.addEventListener("reconnecting", (a) => {
|
|
7516
|
+
this.socket === o && this.state.status !== "closed" && (this.refreshingDefaultCredentials || this.reportTransportDiagnostic("socket_closed", { disconnectReason: a.detail.reason }), this.setReconnectingState());
|
|
7513
7517
|
}), o.addEventListener("open", () => {
|
|
7514
7518
|
this.socket !== o || (this.clearSocketConnectTimer(), this.directoryObservation.reconnect().catch(() => {
|
|
7515
7519
|
}), this.conversationObservation?.wake(), Me("web-sdk.agent", "Pluno socket opened", {
|
|
@@ -8411,7 +8415,7 @@ class Qr {
|
|
|
8411
8415
|
}
|
|
8412
8416
|
/** @internal */
|
|
8413
8417
|
reportTransportDiagnostic(e, n = {}) {
|
|
8414
|
-
const i = typeof navigator > "u" ? "unknown" : navigator.onLine === !1 ? "offline" : "online", s = `${e}:${n.requestId ?? n.connectionAttemptId ?? "none"}:${n.closeCode ?? "none"}:${i}`, o = (/* @__PURE__ */ new Date()).toISOString(), a = this.transportDiagnosticEpisodes.get(s), r = {
|
|
8418
|
+
const i = typeof navigator > "u" ? "unknown" : navigator.onLine === !1 ? "offline" : "online", s = `${e}:${n.requestId ?? n.connectionAttemptId ?? "none"}:${n.closeCode ?? "none"}:${n.disconnectReason ?? "none"}:${i}`, o = (/* @__PURE__ */ new Date()).toISOString(), a = this.transportDiagnosticEpisodes.get(s), r = {
|
|
8415
8419
|
id: a?.id ?? crypto.randomUUID(),
|
|
8416
8420
|
phase: e,
|
|
8417
8421
|
entrySurface: this.options.entrySurface,
|
package/package.json
CHANGED