@pluno/product-agent-web 0.1.225 → 0.1.226
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/product-agent-sdk.js +175 -181
- package/dist/product-agent-widget.js +1405 -1411
- package/package.json +1 -1
|
@@ -65,15 +65,15 @@ function Fn(s, e) {
|
|
|
65
65
|
kt || (kt = new TextEncoder()), e(kt.encode(t));
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
const Os = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
|
68
|
+
const Os = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", De = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
|
|
69
69
|
for (let s = 0; s < Os.length; s++)
|
|
70
|
-
|
|
70
|
+
De[Os.charCodeAt(s)] = s;
|
|
71
71
|
const Hn = (s) => {
|
|
72
72
|
let e = s.length * 0.75, t = s.length, i, n = 0, r, o, a, c;
|
|
73
73
|
s[s.length - 1] === "=" && (e--, s[s.length - 2] === "=" && e--);
|
|
74
74
|
const l = new ArrayBuffer(e), d = new Uint8Array(l);
|
|
75
75
|
for (i = 0; i < t; i += 4)
|
|
76
|
-
r =
|
|
76
|
+
r = De[s.charCodeAt(i)], o = De[s.charCodeAt(i + 1)], a = De[s.charCodeAt(i + 2)], c = De[s.charCodeAt(i + 3)], d[n++] = r << 2 | o >> 4, d[n++] = (o & 15) << 4 | a >> 2, d[n++] = (a & 3) << 6 | c & 63;
|
|
77
77
|
return l;
|
|
78
78
|
}, jn = typeof ArrayBuffer == "function", ms = (s, e) => {
|
|
79
79
|
if (typeof s != "string")
|
|
@@ -519,7 +519,7 @@ class ar extends nr {
|
|
|
519
519
|
}), this.pollXhr = e;
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
|
-
let
|
|
522
|
+
let ye = class it extends C {
|
|
523
523
|
/**
|
|
524
524
|
* Request constructor
|
|
525
525
|
*
|
|
@@ -616,8 +616,8 @@ let me = class it extends C {
|
|
|
616
616
|
this._cleanup();
|
|
617
617
|
}
|
|
618
618
|
};
|
|
619
|
-
|
|
620
|
-
|
|
619
|
+
ye.requestsCount = 0;
|
|
620
|
+
ye.requests = {};
|
|
621
621
|
if (typeof document < "u") {
|
|
622
622
|
if (typeof attachEvent == "function")
|
|
623
623
|
attachEvent("onunload", xs);
|
|
@@ -627,8 +627,8 @@ if (typeof document < "u") {
|
|
|
627
627
|
}
|
|
628
628
|
}
|
|
629
629
|
function xs() {
|
|
630
|
-
for (let s in
|
|
631
|
-
|
|
630
|
+
for (let s in ye.requests)
|
|
631
|
+
ye.requests.hasOwnProperty(s) && ye.requests[s].abort();
|
|
632
632
|
}
|
|
633
633
|
const cr = (function() {
|
|
634
634
|
const s = Ki({
|
|
@@ -643,7 +643,7 @@ class lr extends ar {
|
|
|
643
643
|
this.supportsBinary = cr && !t;
|
|
644
644
|
}
|
|
645
645
|
request(e = {}) {
|
|
646
|
-
return Object.assign(e, { xd: this.xd }, this.opts), new
|
|
646
|
+
return Object.assign(e, { xd: this.xd }, this.opts), new ye(Ki, this.uri(), e);
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
649
|
function Ki(s) {
|
|
@@ -2057,10 +2057,10 @@ class Gi extends C {
|
|
|
2057
2057
|
}
|
|
2058
2058
|
}
|
|
2059
2059
|
}
|
|
2060
|
-
function
|
|
2060
|
+
function Se(s) {
|
|
2061
2061
|
s = s || {}, this.ms = s.min || 100, this.max = s.max || 1e4, this.factor = s.factor || 2, this.jitter = s.jitter > 0 && s.jitter <= 1 ? s.jitter : 0, this.attempts = 0;
|
|
2062
2062
|
}
|
|
2063
|
-
|
|
2063
|
+
Se.prototype.duration = function() {
|
|
2064
2064
|
var s = this.ms * Math.pow(this.factor, this.attempts++);
|
|
2065
2065
|
if (this.jitter) {
|
|
2066
2066
|
var e = Math.random(), t = Math.floor(e * this.jitter * s);
|
|
@@ -2068,22 +2068,22 @@ we.prototype.duration = function() {
|
|
|
2068
2068
|
}
|
|
2069
2069
|
return Math.min(s, this.max) | 0;
|
|
2070
2070
|
};
|
|
2071
|
-
|
|
2071
|
+
Se.prototype.reset = function() {
|
|
2072
2072
|
this.attempts = 0;
|
|
2073
2073
|
};
|
|
2074
|
-
|
|
2074
|
+
Se.prototype.setMin = function(s) {
|
|
2075
2075
|
this.ms = s;
|
|
2076
2076
|
};
|
|
2077
|
-
|
|
2077
|
+
Se.prototype.setMax = function(s) {
|
|
2078
2078
|
this.max = s;
|
|
2079
2079
|
};
|
|
2080
|
-
|
|
2080
|
+
Se.prototype.setJitter = function(s) {
|
|
2081
2081
|
this.jitter = s;
|
|
2082
2082
|
};
|
|
2083
2083
|
class Yt extends C {
|
|
2084
2084
|
constructor(e, t) {
|
|
2085
2085
|
var i;
|
|
2086
|
-
super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t, wt(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || 1 / 0), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor((i = t.randomizationFactor) !== null && i !== void 0 ? i : 0.5), this.backoff = new
|
|
2086
|
+
super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t, wt(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || 1 / 0), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor((i = t.randomizationFactor) !== null && i !== void 0 ? i : 0.5), this.backoff = new Se({
|
|
2087
2087
|
min: this.reconnectionDelay(),
|
|
2088
2088
|
max: this.reconnectionDelayMax(),
|
|
2089
2089
|
jitter: this.randomizationFactor()
|
|
@@ -2318,12 +2318,12 @@ class Yt extends C {
|
|
|
2318
2318
|
this._reconnecting = !1, this.backoff.reset(), this.emitReserved("reconnect", e);
|
|
2319
2319
|
}
|
|
2320
2320
|
}
|
|
2321
|
-
const
|
|
2321
|
+
const ke = {};
|
|
2322
2322
|
function at(s, e) {
|
|
2323
2323
|
typeof s == "object" && (e = s, s = void 0), e = e || {};
|
|
2324
|
-
const t = wr(s, e.path || "/socket.io"), i = t.source, n = t.id, r = t.path, o =
|
|
2324
|
+
const t = wr(s, e.path || "/socket.io"), i = t.source, n = t.id, r = t.path, o = ke[n] && r in ke[n].nsps, a = e.forceNew || e["force new connection"] || e.multiplex === !1 || o;
|
|
2325
2325
|
let c;
|
|
2326
|
-
return a ? c = new Yt(i, e) : (
|
|
2326
|
+
return a ? c = new Yt(i, e) : (ke[n] || (ke[n] = new Yt(i, e)), c = ke[n]), t.query && !e.query && (e.query = t.queryKey), c.socket(t.path, e);
|
|
2327
2327
|
}
|
|
2328
2328
|
Object.assign(at, {
|
|
2329
2329
|
Manager: Yt,
|
|
@@ -2755,11 +2755,11 @@ function z(s) {
|
|
|
2755
2755
|
const e = s.currentAuthority();
|
|
2756
2756
|
return e.authorityId === s.authority.authorityId && e.generation === s.authority.generation;
|
|
2757
2757
|
}
|
|
2758
|
-
function
|
|
2758
|
+
function Me(s, e) {
|
|
2759
2759
|
if (!z(s) || e.authorityId !== s.authority.authorityId || e.generation !== s.authority.generation)
|
|
2760
2760
|
throw new Error("Directory authority is no longer current.");
|
|
2761
2761
|
}
|
|
2762
|
-
function
|
|
2762
|
+
function Ue(s) {
|
|
2763
2763
|
if (s.origin === null) return s;
|
|
2764
2764
|
const e = s.origin.trim();
|
|
2765
2765
|
return { ...s, origin: e.includes("://") ? new URL(e).origin : e.toLowerCase() };
|
|
@@ -2790,18 +2790,18 @@ function Nr(s) {
|
|
|
2790
2790
|
return {
|
|
2791
2791
|
"directory.query": async (i) => {
|
|
2792
2792
|
try {
|
|
2793
|
-
|
|
2794
|
-
const n =
|
|
2793
|
+
Me(s, i);
|
|
2794
|
+
const n = Ue(i.query), r = { origin: n.origin, pinned: n.kind === "pinned", cursor: i.cursor, limit: n.limit };
|
|
2795
2795
|
let o;
|
|
2796
2796
|
if (s.http.auth.client_kind === "embed") {
|
|
2797
2797
|
const a = await s.http.request("/conversations", { ...r, page_url: n.origin ?? s.pageUrl() });
|
|
2798
|
-
|
|
2798
|
+
Me(s, i), o = { entries: await Promise.all(a.sessions.map(async (l) => ({
|
|
2799
2799
|
...await Yi(s.http, l.id),
|
|
2800
2800
|
...typeof l.isActive == "boolean" ? { is_active: l.isActive } : {}
|
|
2801
2801
|
}))), next_cursor: a.nextCursor };
|
|
2802
2802
|
} else
|
|
2803
2803
|
o = await s.http.request("/conversations", r, void 0, "GET", e);
|
|
2804
|
-
return
|
|
2804
|
+
return Me(s, i), { ...o, updatedAt: s.now() };
|
|
2805
2805
|
} catch (n) {
|
|
2806
2806
|
throw z({ authority: i, currentAuthority: s.currentAuthority }) && s.onError?.(n), n;
|
|
2807
2807
|
}
|
|
@@ -2810,9 +2810,9 @@ function Nr(s) {
|
|
|
2810
2810
|
const r = (t.get(i.sessionId) ?? Promise.resolve()).catch(() => {
|
|
2811
2811
|
}).then(async () => {
|
|
2812
2812
|
try {
|
|
2813
|
-
|
|
2813
|
+
Me(s, i);
|
|
2814
2814
|
const a = await s.http.request(`/conversations/${encodeURIComponent(i.sessionId)}`, {}, i.patch, "PATCH", e);
|
|
2815
|
-
return
|
|
2815
|
+
return Me(s, i), a;
|
|
2816
2816
|
} catch (a) {
|
|
2817
2817
|
throw z({ authority: i, currentAuthority: s.currentAuthority }) && s.onError?.(a), a;
|
|
2818
2818
|
}
|
|
@@ -2876,12 +2876,12 @@ class Lr {
|
|
|
2876
2876
|
}
|
|
2877
2877
|
open(e, t = "replace", i) {
|
|
2878
2878
|
if (this.disposed || !z(this.boundary)) return Promise.resolve();
|
|
2879
|
-
e =
|
|
2879
|
+
e = Ue(e);
|
|
2880
2880
|
const n = O(e);
|
|
2881
2881
|
return t === "replace" && this.options.runtime.engine.getState().slices.directory.queries[n]?.requestId ? (this.refreshAfterRequest.add(n), Promise.resolve()) : (this.requestPage(e, t, i).catch((r) => this.report(r)), Promise.resolve());
|
|
2882
2882
|
}
|
|
2883
2883
|
requestPage(e, t = "replace", i) {
|
|
2884
|
-
return e =
|
|
2884
|
+
return e = Ue(e), this.enqueueQuery(e, () => this.readPage(e, t, i));
|
|
2885
2885
|
}
|
|
2886
2886
|
enqueueQuery(e, t) {
|
|
2887
2887
|
const i = O(e), n = this.queryRequests.get(i), r = (async () => (await n?.catch(() => {
|
|
@@ -2915,7 +2915,7 @@ class Lr {
|
|
|
2915
2915
|
return this.refreshPages(e, e.kind === "pinned", () => this.isObserved(e));
|
|
2916
2916
|
}
|
|
2917
2917
|
refreshPages(e, t, i) {
|
|
2918
|
-
return e =
|
|
2918
|
+
return e = Ue(e), this.enqueueQuery(e, async () => {
|
|
2919
2919
|
if (!i() || (await this.readPage(e, "replace"), !t)) return;
|
|
2920
2920
|
let n = this.options.runtime.engine.getState().slices.directory.queries[O(e)]?.cursor ?? null;
|
|
2921
2921
|
for (; n !== null && i(); ) {
|
|
@@ -2942,7 +2942,7 @@ class Lr {
|
|
|
2942
2942
|
}
|
|
2943
2943
|
observedQueryStates() {
|
|
2944
2944
|
const e = this.options.runtime.engine.getState().slices.directory.queries;
|
|
2945
|
-
return this.options.observedQueries().flatMap((t) => e[O(
|
|
2945
|
+
return this.options.observedQueries().flatMap((t) => e[O(Ue(t))] ?? []);
|
|
2946
2946
|
}
|
|
2947
2947
|
isObserved(e) {
|
|
2948
2948
|
return !this.disposed && z(this.boundary) && (this.options.enabled?.() ?? !0) && this.observedQueryStates().some((t) => O(t.query) === O(e));
|
|
@@ -3431,10 +3431,6 @@ class N extends EventTarget {
|
|
|
3431
3431
|
this.hydration = null;
|
|
3432
3432
|
for (const a of o.events) this.receive(a);
|
|
3433
3433
|
}
|
|
3434
|
-
if (this.isCurrent(i) && this.options.currentSession(t.page) === e) {
|
|
3435
|
-
const a = await this.http(`/sessions/${encodeURIComponent(e)}/history`, { limit: 200 });
|
|
3436
|
-
this.isCurrent(i) && this.options.currentSession(t.page) === e && this.receive({ type: "conversation.routing", sessionId: e, turns: a.turns });
|
|
3437
|
-
}
|
|
3438
3434
|
});
|
|
3439
3435
|
return this.hydrations = r.catch(() => {
|
|
3440
3436
|
}), r;
|
|
@@ -4305,7 +4301,7 @@ function Js(s, e, t, i) {
|
|
|
4305
4301
|
});
|
|
4306
4302
|
}
|
|
4307
4303
|
const Pt = "pluno.productAgent.transportId", ko = "pluno.productAgent.transportIdentity", Dt = "pluno.productAgent.transportIdentity.event", Mo = 50, Eo = globalThis.setTimeout.bind(globalThis);
|
|
4308
|
-
let
|
|
4304
|
+
let Ee = null;
|
|
4309
4305
|
const ct = /* @__PURE__ */ new Set(), Ut = /* @__PURE__ */ new Map();
|
|
4310
4306
|
async function Co(s = on()) {
|
|
4311
4307
|
const e = s.randomUUID(), t = s.storage.getItem(Pt);
|
|
@@ -4346,16 +4342,16 @@ async function Co(s = on()) {
|
|
|
4346
4342
|
};
|
|
4347
4343
|
}
|
|
4348
4344
|
async function Po(s = !1) {
|
|
4349
|
-
|
|
4345
|
+
Ee || (Ee = Co({
|
|
4350
4346
|
...on(),
|
|
4351
4347
|
skipStoredIdentityCollisionCheck: s
|
|
4352
|
-
}),
|
|
4348
|
+
}), Ee.then((n) => {
|
|
4353
4349
|
const r = (o) => {
|
|
4354
|
-
o.persisted || (n.release(),
|
|
4350
|
+
o.persisted || (n.release(), Ee = null, ct.clear(), window.removeEventListener("pagehide", r));
|
|
4355
4351
|
};
|
|
4356
4352
|
window.addEventListener("pagehide", r);
|
|
4357
4353
|
}));
|
|
4358
|
-
const e = await
|
|
4354
|
+
const e = await Ee, t = Do();
|
|
4359
4355
|
ct.add(t);
|
|
4360
4356
|
let i = !1;
|
|
4361
4357
|
return {
|
|
@@ -4484,17 +4480,17 @@ function Fo(s) {
|
|
|
4484
4480
|
if (!(!ns(t) || !ns(i) || n !== "openrouter" && n !== "azure" && n !== "openai"))
|
|
4485
4481
|
return Object.freeze({ requestedModel: t, effectiveModel: i, provider: n });
|
|
4486
4482
|
}
|
|
4487
|
-
const
|
|
4483
|
+
const xe = (s, e) => Yr(
|
|
4488
4484
|
s.engine.getState().slices.modelSelection,
|
|
4489
4485
|
e
|
|
4490
|
-
), Ho = (s, e) => sn(
|
|
4486
|
+
), Ho = (s, e) => sn(xe(s, e));
|
|
4491
4487
|
function jo(s, e, t, i) {
|
|
4492
4488
|
return s.engine.dispatch({
|
|
4493
4489
|
type: "model.submission_capture",
|
|
4494
4490
|
clientScopeId: e,
|
|
4495
4491
|
clientMessageId: t,
|
|
4496
4492
|
requestedModel: i
|
|
4497
|
-
}),
|
|
4493
|
+
}), xe(s, e).submissions[t].requestedModel;
|
|
4498
4494
|
}
|
|
4499
4495
|
function cn(s, e, t, i, n, r) {
|
|
4500
4496
|
const o = Fo(n);
|
|
@@ -5757,7 +5753,7 @@ class vt {
|
|
|
5757
5753
|
));
|
|
5758
5754
|
} else
|
|
5759
5755
|
et(e.clientId, null);
|
|
5760
|
-
|
|
5756
|
+
$(e.clientId, this.queuedClientEvents);
|
|
5761
5757
|
}
|
|
5762
5758
|
options;
|
|
5763
5759
|
clientRuntime;
|
|
@@ -6227,7 +6223,7 @@ class vt {
|
|
|
6227
6223
|
const o = gc(r?.detail?.data);
|
|
6228
6224
|
o?.type === "chat.user_message" && o.clientMessageId === this.pendingClientMessageId && !this.queuedClientEvents.some(
|
|
6229
6225
|
(a) => a.type === "chat.user_message" && a.clientMessageId === o.clientMessageId
|
|
6230
|
-
) && (this.queuedClientEvents.push(o),
|
|
6226
|
+
) && (this.queuedClientEvents.push(o), $(this.options.clientId, this.queuedClientEvents), this.setState({ pendingMessageStatus: "reconnecting" })), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), n.readyState !== WebSocket.CLOSED && n.readyState !== WebSocket.CLOSING && n.close();
|
|
6231
6227
|
}), n.addEventListener("close", (r) => {
|
|
6232
6228
|
this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (M("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
|
|
6233
6229
|
code: typeof r?.code == "number" ? r.code : null,
|
|
@@ -6291,14 +6287,14 @@ class vt {
|
|
|
6291
6287
|
}
|
|
6292
6288
|
warmup(e = "panel_open") {
|
|
6293
6289
|
return this.clientRuntime.route("conversation", { legacy: () => {
|
|
6294
|
-
const t =
|
|
6290
|
+
const t = W(), i = `${this.state.sessionId ?? "draft"}:${t.url}`, n = e === "composer_input" && this.pendingComposerWarmup?.scope === i ? this.pendingComposerWarmup : null, r = {
|
|
6295
6291
|
type: "runtime.warmup",
|
|
6296
6292
|
reason: e,
|
|
6297
6293
|
...e === "composer_input" ? { warmupId: n?.event.warmupId ?? L() } : {},
|
|
6298
6294
|
entrySurface: this.options.entrySurface,
|
|
6299
6295
|
sessionId: this.state.sessionId ?? void 0,
|
|
6300
6296
|
page: t,
|
|
6301
|
-
model:
|
|
6297
|
+
model: xe(this.clientRuntime, this.modelClientScopeId).selectedModel
|
|
6302
6298
|
};
|
|
6303
6299
|
if (e === "composer_input") {
|
|
6304
6300
|
if (this.options.productVariant === "customer_embedded") {
|
|
@@ -6319,7 +6315,7 @@ class vt {
|
|
|
6319
6315
|
occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6320
6316
|
entrySurface: this.options.entrySurface,
|
|
6321
6317
|
...this.state.sessionId ? { sessionId: this.state.sessionId } : {},
|
|
6322
|
-
pageOrigin:
|
|
6318
|
+
pageOrigin: W().origin
|
|
6323
6319
|
}
|
|
6324
6320
|
};
|
|
6325
6321
|
this.authenticatedSocket === this.socket && this.sendNow(i) || (this.pendingWidgetLifecycleEvents.push(i), this.pendingWidgetLifecycleEvents.length > 20 && this.pendingWidgetLifecycleEvents.splice(0, this.pendingWidgetLifecycleEvents.length - 20));
|
|
@@ -6337,7 +6333,7 @@ class vt {
|
|
|
6337
6333
|
return null;
|
|
6338
6334
|
if (this.pendingClientMessageId)
|
|
6339
6335
|
throw new Error("Wait for the current message to finish sending before sending another.");
|
|
6340
|
-
const o =
|
|
6336
|
+
const o = W(), a = t.clientMessageId ?? L();
|
|
6341
6337
|
this.pendingClientMessageId = a;
|
|
6342
6338
|
const c = jo(this.clientRuntime, this.modelClientScopeId, a), l = t.proactiveSuggestionQuestion?.trim(), d = this.stagedProactiveSuggestionQuestionMessageId ? this.state.messages.find(
|
|
6343
6339
|
(R) => R.id === this.stagedProactiveSuggestionQuestionMessageId
|
|
@@ -6507,7 +6503,7 @@ class vt {
|
|
|
6507
6503
|
mimeType: i.mimeType,
|
|
6508
6504
|
sizeBytes: i.sizeBytes,
|
|
6509
6505
|
blob: e,
|
|
6510
|
-
origin:
|
|
6506
|
+
origin: W().origin,
|
|
6511
6507
|
sessionId: this.state.sessionId ?? void 0,
|
|
6512
6508
|
createdAt: n,
|
|
6513
6509
|
lastUsedAt: n
|
|
@@ -6539,8 +6535,8 @@ class vt {
|
|
|
6539
6535
|
name: e.name || "attachment",
|
|
6540
6536
|
mimeType: r,
|
|
6541
6537
|
sizeBytes: e.size,
|
|
6542
|
-
page:
|
|
6543
|
-
model:
|
|
6538
|
+
page: W(),
|
|
6539
|
+
model: xe(this.clientRuntime, this.modelClientScopeId).selectedModel,
|
|
6544
6540
|
metadata: hi(this.options.metadata),
|
|
6545
6541
|
entrySurface: this.options.entrySurface
|
|
6546
6542
|
};
|
|
@@ -6632,7 +6628,7 @@ class vt {
|
|
|
6632
6628
|
for (const n of [this.pendingClientMessageId, this.activeClientMessageId])
|
|
6633
6629
|
n && (this.cancelledSubmissions.set(n, this.state.sessionId), this.clearFirstResponseTimer(n));
|
|
6634
6630
|
for (; this.cancelledSubmissions.size > 100; ) this.cancelledSubmissions.delete(this.cancelledSubmissions.keys().next().value);
|
|
6635
|
-
this.queuedClientEvents = this.queuedClientEvents.filter((n) => !("clientMessageId" in n && typeof n.clientMessageId == "string" && this.cancelledSubmissions.has(n.clientMessageId))),
|
|
6631
|
+
this.queuedClientEvents = this.queuedClientEvents.filter((n) => !("clientMessageId" in n && typeof n.clientMessageId == "string" && this.cancelledSubmissions.has(n.clientMessageId))), $(this.options.clientId, this.queuedClientEvents);
|
|
6636
6632
|
const e = this.getStopClientMessageId();
|
|
6637
6633
|
this.state.sessionId && e && this.send({ type: "run.stop", sessionId: this.state.sessionId, expectedUserMessageId: e, reason: "user_requested" });
|
|
6638
6634
|
const t = this.pendingClientMessageId, i = ki(
|
|
@@ -6686,11 +6682,11 @@ class vt {
|
|
|
6686
6682
|
}
|
|
6687
6683
|
for (const [n, r] of this.cancelledSubmissions)
|
|
6688
6684
|
r === this.state.sessionId && this.detachedClientMessageIds.add(n);
|
|
6689
|
-
this.rememberCurrentRunAsBackground(), this.rememberCurrentRunAsDetached(), this.clearPendingComposerWarmup(), this.cleanupSessionBrowserApis(), this.queuedClientEvents = this.queuedClientEvents.filter((n) => n.type !== "chat.user_message"),
|
|
6685
|
+
this.rememberCurrentRunAsBackground(), this.rememberCurrentRunAsDetached(), this.clearPendingComposerWarmup(), this.cleanupSessionBrowserApis(), this.queuedClientEvents = this.queuedClientEvents.filter((n) => n.type !== "chat.user_message"), $(this.options.clientId, this.queuedClientEvents), et(this.options.clientId, null), this.pendingDeliveryIssued = !1, this.queuedDeliveryRetryAttempt = null, this.clearThinkingWatchdog(), this.clearAllFirstResponseTimers(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.retryableClientMessageId = null, this.stagedProactiveSuggestionQuestionMessageId = null, this.lastUserMessagePageUrl = null, this.clearSessionLoadRequest(), this.sessionActivityRequestId = null, this.retryAttemptsByClientMessageId = {}, this.thinkingWatchdogResyncAttemptsByClientMessageId = {}, this.nonTranscriptToolCallIds.clear(), this.clientRuntime.engine.dispatch({ type: "model.scope_navigate", clientScopeId: this.modelClientScopeId, sessionId: null }), t && this.send({
|
|
6690
6686
|
type: "session.reset",
|
|
6691
6687
|
sessionId: this.state.sessionId ?? void 0,
|
|
6692
6688
|
warmupId: i ?? void 0,
|
|
6693
|
-
page:
|
|
6689
|
+
page: W()
|
|
6694
6690
|
}), this.setState({
|
|
6695
6691
|
sessionId: null,
|
|
6696
6692
|
starterPrompts: [...this.state.starterPrompts],
|
|
@@ -7036,7 +7032,7 @@ class vt {
|
|
|
7036
7032
|
this.options.keepRunsActiveOnSessionNavigation && (this.rememberCurrentRunAsBackground(), this.backgroundSessionIds.delete(e), this.deferredSessionUpdatedSessionIds.delete(e)), this.clearPendingComposerWarmup(), i && this.send({
|
|
7037
7033
|
type: "session.reset",
|
|
7038
7034
|
warmupId: i,
|
|
7039
|
-
page:
|
|
7035
|
+
page: W()
|
|
7040
7036
|
}), this.clearThinkingWatchdog(), this.clearAllFirstResponseTimers(), this.clearPendingDeliveryTimers(), !this.options.keepRunsActiveOnSessionNavigation && n && this.clearPersistedPendingDelivery(n), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.lastUserMessagePageUrl = null, this.state.sessionId !== e && this.clientRuntime.engine.dispatch({ type: "model.scope_navigate", clientScopeId: this.modelClientScopeId, sessionId: e }), this.clearSessionLoadRequest(), this.sessionLoadRequestId = t, this.sessionActivityRequestId = null, this.setState({
|
|
7041
7037
|
sessionId: e,
|
|
7042
7038
|
// A session-keyed timeline can render immediately while the subscription handshake and authoritative
|
|
@@ -7059,7 +7055,7 @@ class vt {
|
|
|
7059
7055
|
type: "session.load",
|
|
7060
7056
|
requestId: t,
|
|
7061
7057
|
sessionId: e,
|
|
7062
|
-
page:
|
|
7058
|
+
page: W()
|
|
7063
7059
|
});
|
|
7064
7060
|
} });
|
|
7065
7061
|
}
|
|
@@ -7107,7 +7103,7 @@ class vt {
|
|
|
7107
7103
|
type: "session.load",
|
|
7108
7104
|
requestId: t,
|
|
7109
7105
|
sessionId: e,
|
|
7110
|
-
page:
|
|
7106
|
+
page: W(),
|
|
7111
7107
|
subscribeOnly: !0
|
|
7112
7108
|
}), i;
|
|
7113
7109
|
}
|
|
@@ -7207,7 +7203,7 @@ class vt {
|
|
|
7207
7203
|
const t = this.sendNow(V(e));
|
|
7208
7204
|
return t || (e.type === "chat.user_message" && typeof e.clientMessageId == "string" && this.queuedClientEvents.some(
|
|
7209
7205
|
(n) => n.type === "chat.user_message" && n.clientMessageId === e.clientMessageId
|
|
7210
|
-
) || this.queuedClientEvents.push(e),
|
|
7206
|
+
) || this.queuedClientEvents.push(e), $(this.options.clientId, this.queuedClientEvents), this.setState({
|
|
7211
7207
|
status: "reconnecting",
|
|
7212
7208
|
...e.type === "chat.user_message" && e.clientMessageId === this.pendingClientMessageId ? { pendingMessageStatus: "reconnecting" } : {}
|
|
7213
7209
|
}), this.scheduleReconnect()), t;
|
|
@@ -7226,8 +7222,8 @@ class vt {
|
|
|
7226
7222
|
const t = this.socket;
|
|
7227
7223
|
if ((e.type === "tool.result" || e.type === "run.stop") && t instanceof N) {
|
|
7228
7224
|
const i = this.queuedClientEvents.find((n) => "sessionId" in n && n.sessionId === e.sessionId && (e.type === "tool.result" && n.type === "tool.result" && n.callId === e.callId || e.type === "run.stop" && n.type === "run.stop" && n.expectedUserMessageId === e.expectedUserMessageId)) ?? e;
|
|
7229
|
-
return this.queuedClientEvents.includes(i) || this.queuedClientEvents.push(i),
|
|
7230
|
-
this.pendingRetainedCommandDeliveries.delete(i), n && (this.queuedClientEvents = this.queuedClientEvents.filter((r) => r !== i),
|
|
7225
|
+
return this.queuedClientEvents.includes(i) || this.queuedClientEvents.push(i), $(this.options.clientId, this.queuedClientEvents), this.pendingRetainedCommandDeliveries.has(i) || (this.pendingRetainedCommandDeliveries.add(i), t.sendRetainedCommand(V(i)).then((n) => {
|
|
7226
|
+
this.pendingRetainedCommandDeliveries.delete(i), n && (this.queuedClientEvents = this.queuedClientEvents.filter((r) => r !== i), $(this.options.clientId, this.queuedClientEvents));
|
|
7231
7227
|
})), !0;
|
|
7232
7228
|
}
|
|
7233
7229
|
try {
|
|
@@ -7342,7 +7338,7 @@ class vt {
|
|
|
7342
7338
|
rememberPendingDeliveryForRecovery(e) {
|
|
7343
7339
|
this.queuedClientEvents.some(
|
|
7344
7340
|
(t) => t.type === "chat.user_message" && t.clientMessageId === e.clientMessageId
|
|
7345
|
-
) || (this.queuedClientEvents.push(e),
|
|
7341
|
+
) || (this.queuedClientEvents.push(e), $(this.options.clientId, this.queuedClientEvents)), this.persistCurrentPendingDeliveryRecovery();
|
|
7346
7342
|
}
|
|
7347
7343
|
persistCurrentPendingDeliveryRecovery() {
|
|
7348
7344
|
const e = this.pendingClientMessageId, t = e ? this.firstResponseTimersByClientMessageId.get(e) : null;
|
|
@@ -7361,7 +7357,7 @@ class vt {
|
|
|
7361
7357
|
clearPersistedPendingDelivery(e) {
|
|
7362
7358
|
this.queuedClientEvents = this.queuedClientEvents.filter(
|
|
7363
7359
|
(t) => t.type !== "chat.user_message" || t.clientMessageId !== e
|
|
7364
|
-
),
|
|
7360
|
+
), $(this.options.clientId, this.queuedClientEvents), et(this.options.clientId, null), this.pendingDeliveryIssued = !1, this.queuedDeliveryRetryAttempt = null;
|
|
7365
7361
|
}
|
|
7366
7362
|
/** @internal */
|
|
7367
7363
|
reportTransportDiagnostic(e, t = {}) {
|
|
@@ -7491,18 +7487,18 @@ class vt {
|
|
|
7491
7487
|
if (this.socket?.readyState !== WebSocket.OPEN || this.queuedClientEvents.length === 0)
|
|
7492
7488
|
return;
|
|
7493
7489
|
const e = [...this.queuedClientEvents];
|
|
7494
|
-
this.queuedClientEvents = this.queuedClientEvents.filter((t) => (t.type === "tool.result" || t.type === "run.stop") && this.socket instanceof N),
|
|
7490
|
+
this.queuedClientEvents = this.queuedClientEvents.filter((t) => (t.type === "tool.result" || t.type === "run.stop") && this.socket instanceof N), $(this.options.clientId, this.queuedClientEvents);
|
|
7495
7491
|
for (let t = 0; t < e.length; t += 1) {
|
|
7496
7492
|
const i = e[t];
|
|
7497
7493
|
if (!this.sendNow(V(i))) {
|
|
7498
|
-
this.queuedClientEvents.unshift(...e.slice(t).filter((n) => !this.queuedClientEvents.includes(n))),
|
|
7494
|
+
this.queuedClientEvents.unshift(...e.slice(t).filter((n) => !this.queuedClientEvents.includes(n))), $(this.options.clientId, this.queuedClientEvents);
|
|
7499
7495
|
return;
|
|
7500
7496
|
}
|
|
7501
|
-
i.type === "chat.user_message" && i.clientMessageId === this.pendingClientMessageId && (this.queuedDeliveryRetryAttempt !== null ? (this.retryAttemptsByClientMessageId[i.clientMessageId] = this.queuedDeliveryRetryAttempt, this.queuedDeliveryRetryAttempt = null) : this.pendingDeliveryIssued && (this.retryAttemptsByClientMessageId[i.clientMessageId] = (this.retryAttemptsByClientMessageId[i.clientMessageId] ?? 0) + 1), this.pendingDeliveryIssued = !0, this.setState({ pendingMessageStatus: "sending" }), this.queuedClientEvents.push(i), this.persistCurrentPendingDeliveryRecovery(), this.schedulePendingDeliveryAck(i.clientMessageId)),
|
|
7497
|
+
i.type === "chat.user_message" && i.clientMessageId === this.pendingClientMessageId && (this.queuedDeliveryRetryAttempt !== null ? (this.retryAttemptsByClientMessageId[i.clientMessageId] = this.queuedDeliveryRetryAttempt, this.queuedDeliveryRetryAttempt = null) : this.pendingDeliveryIssued && (this.retryAttemptsByClientMessageId[i.clientMessageId] = (this.retryAttemptsByClientMessageId[i.clientMessageId] ?? 0) + 1), this.pendingDeliveryIssued = !0, this.setState({ pendingMessageStatus: "sending" }), this.queuedClientEvents.push(i), this.persistCurrentPendingDeliveryRecovery(), this.schedulePendingDeliveryAck(i.clientMessageId)), $(this.options.clientId, this.queuedClientEvents);
|
|
7502
7498
|
}
|
|
7503
7499
|
}
|
|
7504
7500
|
resetForAuthenticationScopeChange() {
|
|
7505
|
-
this.startNewSession({ notifyTransport: !1 }), this.queuedClientEvents = [],
|
|
7501
|
+
this.startNewSession({ notifyTransport: !1 }), this.queuedClientEvents = [], $(this.options.clientId, this.queuedClientEvents), this.pendingWidgetLifecycleEvents = [], this.backgroundSessionIds.clear(), this.backgroundClientMessageIds.clear(), this.deferredSessionUpdatedSessionIds.clear(), this.detachedSessionIds.clear(), this.detachedClientMessageIds.clear(), this.deferredDetachedSessionEvents.clear(), this.sessionTimelineCache.clear();
|
|
7506
7502
|
}
|
|
7507
7503
|
applyAuthenticatedDirectoryIdentity(e) {
|
|
7508
7504
|
const t = Si(e), i = A(e, "runtimeCommunityId") ?? this.directoryHttp.auth.community_id, n = !!(this.authenticatedUserId && t && (this.socket instanceof N || this.authenticatedSocket !== this.socket) && (this.authenticatedUserId !== t.id || this.directoryHttp.auth.community_id !== i));
|
|
@@ -7572,9 +7568,9 @@ class vt {
|
|
|
7572
7568
|
}
|
|
7573
7569
|
rememberDurablyStoppedTurn(e, t) {
|
|
7574
7570
|
const i = q(t);
|
|
7575
|
-
if (!e || !i || !
|
|
7571
|
+
if (!e || !i || !Oe(i) || this.findStoppedTurn(e, i))
|
|
7576
7572
|
return;
|
|
7577
|
-
const n =
|
|
7573
|
+
const n = H(i), r = E(i), o = typeof i.clientMessageId == "string" ? i.clientMessageId : n ? this.clientMessageIdsByUserMessageItemId.get(n) ?? null : null;
|
|
7578
7574
|
this.stoppedTurns.push({
|
|
7579
7575
|
sessionId: e,
|
|
7580
7576
|
clientMessageId: o,
|
|
@@ -7583,7 +7579,7 @@ class vt {
|
|
|
7583
7579
|
reason: A(i, "reason"),
|
|
7584
7580
|
stoppedItemId: A(t, "id"),
|
|
7585
7581
|
stoppedAt: A(t, "createdAt"),
|
|
7586
|
-
stoppedCausalSequence:
|
|
7582
|
+
stoppedCausalSequence: F(i),
|
|
7587
7583
|
toolCallIds: new Set(
|
|
7588
7584
|
this.state.messages.filter(
|
|
7589
7585
|
(a) => Ze(a, n, r)
|
|
@@ -7604,15 +7600,15 @@ class vt {
|
|
|
7604
7600
|
const i = typeof e.callId == "string" ? e.callId : null;
|
|
7605
7601
|
return !!(i && this.stoppedTurns.some((n) => n.toolCallIds.has(i)));
|
|
7606
7602
|
}
|
|
7607
|
-
return this.findStoppedTurnForEvent(e) ? e.type === "session.item" ? !
|
|
7603
|
+
return this.findStoppedTurnForEvent(e) ? e.type === "session.item" ? !Oe(q(e.item)) : e.type !== "conversation.state" : !1;
|
|
7608
7604
|
}
|
|
7609
7605
|
filterStoppedSnapshotItems(e, t) {
|
|
7610
7606
|
return e.filter((i) => {
|
|
7611
7607
|
const n = q(i), r = n ? this.findStoppedTurn(t, n) : null;
|
|
7612
|
-
if (!r || n?.type === "message" && n.role === "user" ||
|
|
7608
|
+
if (!r || n?.type === "message" && n.role === "user" || Oe(n))
|
|
7613
7609
|
return !0;
|
|
7614
7610
|
if (r.stoppedCausalSequence !== null) {
|
|
7615
|
-
const o = n ?
|
|
7611
|
+
const o = n ? F(n) : null;
|
|
7616
7612
|
return o === null || o <= r.stoppedCausalSequence;
|
|
7617
7613
|
}
|
|
7618
7614
|
if (r.stoppedAt) {
|
|
@@ -7640,7 +7636,7 @@ class vt {
|
|
|
7640
7636
|
this.pendingDeliveryReconciliationRequestId = null, this.pendingDeliveryRetryTimer !== null && (window.clearTimeout(this.pendingDeliveryRetryTimer), this.pendingDeliveryRetryTimer = null), this.flushQueuedClientEvents();
|
|
7641
7637
|
return;
|
|
7642
7638
|
}
|
|
7643
|
-
if (this.sessionHistoryHydration &&
|
|
7639
|
+
if (this.sessionHistoryHydration && Ce(e) && J(e) === this.sessionHistoryHydration.sessionId)
|
|
7644
7640
|
return this.sessionHistoryHydration.bufferedEvents.push(e), !0;
|
|
7645
7641
|
if (e.type === "session.item") {
|
|
7646
7642
|
const c = A(e.item, "sessionId") ?? this.state.sessionId;
|
|
@@ -7772,8 +7768,8 @@ class vt {
|
|
|
7772
7768
|
}), h && u.length === 0 && !p && !jt() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
|
|
7773
7769
|
type: "page.upsert",
|
|
7774
7770
|
sessionId: this.state.sessionId,
|
|
7775
|
-
page:
|
|
7776
|
-
model:
|
|
7771
|
+
page: W(),
|
|
7772
|
+
model: xe(this.clientRuntime, this.modelClientScopeId).selectedModel
|
|
7777
7773
|
});
|
|
7778
7774
|
return;
|
|
7779
7775
|
}
|
|
@@ -7804,11 +7800,11 @@ class vt {
|
|
|
7804
7800
|
this.updateAccountFallbackFromSession(e.session), this.updatePersonalModelFromSession(e.session);
|
|
7805
7801
|
const g = A(e.session, "id");
|
|
7806
7802
|
g && Ot(this.clientRuntime, this.modelClientScopeId, g, e.turns), u === this.state.sessionId && !p && this.clearSessionLoadRequest();
|
|
7807
|
-
for (const
|
|
7808
|
-
this.forgetSupersededTaskTabClosedTurn(u, q(
|
|
7809
|
-
for (const
|
|
7810
|
-
this.rememberDurablyStoppedTurn(u,
|
|
7811
|
-
const I =
|
|
7803
|
+
for (const j of l)
|
|
7804
|
+
this.forgetSupersededTaskTabClosedTurn(u, q(j));
|
|
7805
|
+
for (const j of l)
|
|
7806
|
+
this.rememberDurablyStoppedTurn(u, j);
|
|
7807
|
+
const I = Ie(l), w = I === null ? null : l[I], y = q(w), m = this.findStoppedTurn(u, {
|
|
7812
7808
|
clientMessageId: y?.clientMessageId,
|
|
7813
7809
|
respondsToUserMessageId: A(w, "id"),
|
|
7814
7810
|
runId: y?.runId
|
|
@@ -7823,31 +7819,31 @@ class vt {
|
|
|
7823
7819
|
}) && (b = void 0);
|
|
7824
7820
|
const B = b !== void 0;
|
|
7825
7821
|
this.rememberUserMessageClientMessageIds(S);
|
|
7826
|
-
const se = Hc(S), He = S.filter((
|
|
7827
|
-
const K = q(
|
|
7822
|
+
const se = Hc(S), He = S.filter((j) => {
|
|
7823
|
+
const K = q(j);
|
|
7828
7824
|
return Lc(K) ? !1 : !K || !se || !Ne(K) ? !0 : us(S, K) !== se;
|
|
7829
|
-
}),
|
|
7825
|
+
}), be = cs(
|
|
7830
7826
|
this.state.messages,
|
|
7831
7827
|
Wt(He, this.options.backendUrl)
|
|
7832
|
-
), ue = zt(
|
|
7833
|
-
(
|
|
7834
|
-
q(
|
|
7828
|
+
), ue = zt(be), he = B ? b?.content ?? "" : this.state.assistantDraft, ve = B ? b?.itemId ?? null : this.state.assistantDraftItemId, je = B ? b?.respondsToUserMessageId ?? null : this.state.assistantDraftRespondsToUserMessageId, $e = B ? b?.runId ?? null : this.state.assistantDraftRunId, pe = S.some(
|
|
7829
|
+
(j, K) => Ri(
|
|
7830
|
+
q(j),
|
|
7835
7831
|
he,
|
|
7836
|
-
|
|
7832
|
+
ve,
|
|
7837
7833
|
je,
|
|
7838
7834
|
$e,
|
|
7839
7835
|
jc(S, K)
|
|
7840
7836
|
)
|
|
7841
|
-
),
|
|
7837
|
+
), Te = B ? b?.content ?? "" : this.state.assistantDraft, _e = !!b?.content && !pe;
|
|
7842
7838
|
this.promotePendingDeliveryFromSnapshotResponseEvidence(S, u);
|
|
7843
|
-
const Z = ue && (!
|
|
7839
|
+
const Z = ue && (!Te || pe), ae = Bc(be), Re = Z && ae ? "completed" : m ? "stopped" : Z ? "failed" : null;
|
|
7844
7840
|
if (!ue && Fc(this.state.messages, S))
|
|
7845
7841
|
return;
|
|
7846
7842
|
this.lastUserMessagePageUrl = Nc(S);
|
|
7847
7843
|
const ce = Z || m ? null : ds(S);
|
|
7848
7844
|
if (this.latestRecoverableClientMessageId = ce, ae && this.clearRetryTimers(), this.setState({
|
|
7849
7845
|
sessionId: A(e.session, "id") ?? this.state.sessionId,
|
|
7850
|
-
messages:
|
|
7846
|
+
messages: be,
|
|
7851
7847
|
...d ? {
|
|
7852
7848
|
activeScheduledFollowUps: Ii(
|
|
7853
7849
|
e.activeScheduledFollowUps
|
|
@@ -7858,7 +7854,7 @@ class vt {
|
|
|
7858
7854
|
...R ? { turnPhase: R } : {},
|
|
7859
7855
|
isRetrying: k,
|
|
7860
7856
|
...R ? { taskStatus: "working" } : {},
|
|
7861
|
-
...
|
|
7857
|
+
...Re && this.state.taskStatus === "working" ? { taskStatus: Re } : {},
|
|
7862
7858
|
...pe ? {
|
|
7863
7859
|
assistantDraft: "",
|
|
7864
7860
|
assistantDraftItemId: null,
|
|
@@ -7872,7 +7868,7 @@ class vt {
|
|
|
7872
7868
|
assistantDraftRespondsToUserMessageId: b?.respondsToUserMessageId ?? null,
|
|
7873
7869
|
assistantDraftRunId: b?.runId ?? null
|
|
7874
7870
|
} : {},
|
|
7875
|
-
...
|
|
7871
|
+
..._e ? {
|
|
7876
7872
|
isThinking: !0,
|
|
7877
7873
|
turnPhase: "thinking",
|
|
7878
7874
|
lastError: null
|
|
@@ -7894,10 +7890,10 @@ class vt {
|
|
|
7894
7890
|
} : {}
|
|
7895
7891
|
}), Z)
|
|
7896
7892
|
this.retryableClientMessageId = se, this.clearThinkingWatchdog();
|
|
7897
|
-
else if (!m && (
|
|
7893
|
+
else if (!m && (_e || ce)) {
|
|
7898
7894
|
if (ce) {
|
|
7899
7895
|
this.activeClientMessageId = ce;
|
|
7900
|
-
const
|
|
7896
|
+
const j = Ie(S), K = j === null ? null : S[j];
|
|
7901
7897
|
this.activeResponseUserMessageId = A(K, "id");
|
|
7902
7898
|
}
|
|
7903
7899
|
this.markThinkingProgress();
|
|
@@ -7947,7 +7943,7 @@ class vt {
|
|
|
7947
7943
|
const c = q(e.item);
|
|
7948
7944
|
if (Ne(c)) {
|
|
7949
7945
|
typeof c?.runId == "string" && this.retryableFailureRunIdsAwaitingDone.add(c.runId);
|
|
7950
|
-
const d = c ?
|
|
7946
|
+
const d = c ? H(c) : null, u = d ? this.clientMessageIdsByUserMessageItemId.get(d) : null, h = typeof c?.clientMessageId == "string" ? c.clientMessageId : u ?? (d ? null : this.activeClientMessageId ?? this.latestRecoverableClientMessageId);
|
|
7951
7947
|
h && (this.retryableClientMessageId = h);
|
|
7952
7948
|
return;
|
|
7953
7949
|
}
|
|
@@ -7955,7 +7951,7 @@ class vt {
|
|
|
7955
7951
|
if (l) {
|
|
7956
7952
|
const d = Qc(c, l), u = l.callId ? this.pendingToolLoadingByCallId.get(l.callId) : void 0;
|
|
7957
7953
|
l.callId && u !== void 0 && (l.loading = u, this.pendingToolLoadingByCallId.delete(l.callId)), X(l) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), Wc(c) && this.clearRunAckResyncRetryTimer();
|
|
7958
|
-
const h =
|
|
7954
|
+
const h = Oe(c) ? this.state.messages.filter((y) => !(y.id.startsWith("local-interrupted:") && y.respondsToUserMessageId === l.respondsToUserMessageId)) : this.state.messages, p = qe(h, l), f = zt(p), g = Ri(
|
|
7959
7955
|
c,
|
|
7960
7956
|
this.state.assistantDraft,
|
|
7961
7957
|
this.state.assistantDraftItemId,
|
|
@@ -7994,7 +7990,7 @@ class vt {
|
|
|
7994
7990
|
this.clearRunAckResyncRetryTimer();
|
|
7995
7991
|
const c = typeof e.delta == "string" ? e.delta : "", l = typeof e.itemId == "string" ? e.itemId : null, d = l !== null && this.state.assistantDraftItemId !== l, u = `${d ? "" : this.state.assistantDraft}${c}`, h = l ?? this.state.assistantDraftItemId ?? "assistant-draft", p = this.state.messages.find((w) => w.id === h), f = e.phase === "commentary" || e.phase === "final_answer" ? e.phase : d ? null : this.state.assistantDraftPhase, g = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : this.state.assistantDraftRespondsToUserMessageId, I = typeof e.runId == "string" ? e.runId : this.state.assistantDraftRunId;
|
|
7996
7992
|
this.activeClientMessageId && (this.activeResponseUserMessageId = g, this.activeResponseRunId = I), this.setState({
|
|
7997
|
-
messages:
|
|
7993
|
+
messages: qe(this.state.messages, {
|
|
7998
7994
|
id: h,
|
|
7999
7995
|
role: "assistant",
|
|
8000
7996
|
content: u,
|
|
@@ -8203,13 +8199,13 @@ class vt {
|
|
|
8203
8199
|
}
|
|
8204
8200
|
}
|
|
8205
8201
|
shouldIgnoreBackgroundSessionEvent(e) {
|
|
8206
|
-
if (!this.options.keepRunsActiveOnSessionNavigation || !
|
|
8202
|
+
if (!this.options.keepRunsActiveOnSessionNavigation || !Ce(e))
|
|
8207
8203
|
return !1;
|
|
8208
8204
|
const t = J(e);
|
|
8209
8205
|
return t ? this.deferredSessionUpdatedSessionIds.has(t) ? !0 : this.state.sessionId ? t !== this.state.sessionId : this.backgroundSessionIds.has(t) || this.sessionTimelineCache.has(t) : !1;
|
|
8210
8206
|
}
|
|
8211
8207
|
updateInactiveSessionTimelineCache(e) {
|
|
8212
|
-
if (!
|
|
8208
|
+
if (!Ce(e))
|
|
8213
8209
|
return;
|
|
8214
8210
|
const t = J(e);
|
|
8215
8211
|
if (!t || t === this.state.sessionId)
|
|
@@ -8234,7 +8230,7 @@ class vt {
|
|
|
8234
8230
|
if (Ne(n))
|
|
8235
8231
|
return;
|
|
8236
8232
|
const r = ft(e.item, this.options.backendUrl);
|
|
8237
|
-
r && this.rememberSessionTimeline(t,
|
|
8233
|
+
r && this.rememberSessionTimeline(t, qe(i, r));
|
|
8238
8234
|
return;
|
|
8239
8235
|
}
|
|
8240
8236
|
if (e.type === "tool.call") {
|
|
@@ -8265,7 +8261,7 @@ class vt {
|
|
|
8265
8261
|
const r = (typeof e.itemId == "string" ? e.itemId : null) ?? "assistant-draft", o = i.find((l) => l.id === r), c = `${!o || o.dataType !== "assistant_draft" ? "" : o.content}${e.delta}`;
|
|
8266
8262
|
this.rememberSessionTimeline(
|
|
8267
8263
|
t,
|
|
8268
|
-
|
|
8264
|
+
qe(i, {
|
|
8269
8265
|
id: r,
|
|
8270
8266
|
role: "assistant",
|
|
8271
8267
|
content: c,
|
|
@@ -8321,13 +8317,13 @@ class vt {
|
|
|
8321
8317
|
}
|
|
8322
8318
|
}
|
|
8323
8319
|
shouldIgnoreDetachedSessionEvent(e) {
|
|
8324
|
-
if (this.options.keepRunsActiveOnSessionNavigation || !
|
|
8320
|
+
if (this.options.keepRunsActiveOnSessionNavigation || !Ce(e))
|
|
8325
8321
|
return !1;
|
|
8326
8322
|
const t = J(e);
|
|
8327
8323
|
return !!(t && this.detachedSessionIds.has(t));
|
|
8328
8324
|
}
|
|
8329
8325
|
shouldDeferDetachedSessionEvent(e) {
|
|
8330
|
-
if (this.options.keepRunsActiveOnSessionNavigation || e.type === "run.ack" || !
|
|
8326
|
+
if (this.options.keepRunsActiveOnSessionNavigation || e.type === "run.ack" || !Ce(e))
|
|
8331
8327
|
return !1;
|
|
8332
8328
|
const t = J(e);
|
|
8333
8329
|
if (!t || t === this.state.sessionId || this.detachedClientMessageIds.size === 0 && !this.deferredDetachedSessionEvents.has(t))
|
|
@@ -8457,7 +8453,7 @@ class vt {
|
|
|
8457
8453
|
if (t)
|
|
8458
8454
|
return t;
|
|
8459
8455
|
const i = e.type === "session.item" ? q(e.item) : null;
|
|
8460
|
-
return i ?
|
|
8456
|
+
return i ? H(i) : null;
|
|
8461
8457
|
}
|
|
8462
8458
|
getResponseEvidenceClientMessageId(e) {
|
|
8463
8459
|
const t = this.getResponseEvidenceUserMessageId(e);
|
|
@@ -8467,7 +8463,7 @@ class vt {
|
|
|
8467
8463
|
const i = this.pendingClientMessageId;
|
|
8468
8464
|
if (i)
|
|
8469
8465
|
for (const n of e) {
|
|
8470
|
-
const r = q(n), o = r ?
|
|
8466
|
+
const r = q(n), o = r ? H(r) : null;
|
|
8471
8467
|
if (!(!r || !o || this.clientMessageIdsByUserMessageItemId.get(o) !== i || !pi({ type: "session.item", item: n }))) {
|
|
8472
8468
|
this.promotePendingDelivery(
|
|
8473
8469
|
i,
|
|
@@ -8520,7 +8516,7 @@ class vt {
|
|
|
8520
8516
|
type: "session.load",
|
|
8521
8517
|
requestId: e,
|
|
8522
8518
|
sessionId: this.state.sessionId,
|
|
8523
|
-
page:
|
|
8519
|
+
page: W()
|
|
8524
8520
|
});
|
|
8525
8521
|
}
|
|
8526
8522
|
failPendingDelivery(e) {
|
|
@@ -8614,15 +8610,13 @@ class vt {
|
|
|
8614
8610
|
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(oi);
|
|
8615
8611
|
}
|
|
8616
8612
|
resyncThinkingSession() {
|
|
8617
|
-
this.state.sessionId
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
model: ge(this.clientRuntime, this.modelClientScopeId).selectedModel
|
|
8622
|
-
}) : (!this.socket || this.socket.readyState !== WebSocket.OPEN) && (this.setReconnectingState(), this.scheduleReconnect());
|
|
8613
|
+
if (this.state.sessionId) {
|
|
8614
|
+
const e = this.conversationRecoveries.get(this.state.sessionId);
|
|
8615
|
+
e?.transcript.refresh(), e?.activity.refresh();
|
|
8616
|
+
} else (!this.socket || this.socket.readyState !== WebSocket.OPEN) && (this.setReconnectingState(), this.scheduleReconnect());
|
|
8623
8617
|
}
|
|
8624
8618
|
async executeToolCall(e) {
|
|
8625
|
-
const t = typeof e.sessionId == "string" ? e.sessionId : null, i = typeof e.callId == "string" ? e.callId : null, n = typeof e.toolName == "string" ? e.toolName : null, r =
|
|
8619
|
+
const t = typeof e.sessionId == "string" ? e.sessionId : null, i = typeof e.callId == "string" ? e.callId : null, n = typeof e.toolName == "string" ? e.toolName : null, r = ge(
|
|
8626
8620
|
typeof e.summary == "string" ? e.summary : "Running browser tool"
|
|
8627
8621
|
), o = e.rawInput;
|
|
8628
8622
|
if (!t || !i || !n)
|
|
@@ -8743,7 +8737,7 @@ class vt {
|
|
|
8743
8737
|
t.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
|
|
8744
8738
|
type: "network.batch",
|
|
8745
8739
|
sessionId: this.state.sessionId ?? void 0,
|
|
8746
|
-
page:
|
|
8740
|
+
page: W(),
|
|
8747
8741
|
events: t
|
|
8748
8742
|
});
|
|
8749
8743
|
}, Ra)));
|
|
@@ -9119,7 +9113,7 @@ function Fa(s, e) {
|
|
|
9119
9113
|
};
|
|
9120
9114
|
return t[e] < t[s];
|
|
9121
9115
|
}
|
|
9122
|
-
function
|
|
9116
|
+
function Ce(s) {
|
|
9123
9117
|
return s.type === "run.steered" || s.type === "run.ack" || s.type === "run.model_started" || s.type === "conversation.state" || s.type === "scheduled_follow_ups.updated" || s.type === "session.updated" || s.type === "session.item" || s.type === "chat.assistant_delta" || s.type === "chat.assistant_done" || s.type === "tool.call" || s.type === "tool.status" || s.type === "error" && typeof s.requestId != "string";
|
|
9124
9118
|
}
|
|
9125
9119
|
function J(s) {
|
|
@@ -9361,7 +9355,7 @@ function rc(s) {
|
|
|
9361
9355
|
const e = new URL("/api/product-agent/embed/ws", s);
|
|
9362
9356
|
return e.protocol = e.protocol === "https:" ? "wss:" : "ws:", e.toString();
|
|
9363
9357
|
}
|
|
9364
|
-
function
|
|
9358
|
+
function W() {
|
|
9365
9359
|
const s = wn();
|
|
9366
9360
|
return {
|
|
9367
9361
|
url: location.href,
|
|
@@ -9404,7 +9398,7 @@ function ks() {
|
|
|
9404
9398
|
if (!document.body)
|
|
9405
9399
|
return "";
|
|
9406
9400
|
const s = [], e = [], t = (g, I) => {
|
|
9407
|
-
const w =
|
|
9401
|
+
const w = me(I);
|
|
9408
9402
|
!w || e.includes(w) || (s.push([g, w]), e.push(w));
|
|
9409
9403
|
};
|
|
9410
9404
|
t("Selected text", window.getSelection()?.toString() ?? "");
|
|
@@ -9428,7 +9422,7 @@ Visible page text:
|
|
|
9428
9422
|
function Be(s) {
|
|
9429
9423
|
return s.innerText ?? s.textContent ?? "";
|
|
9430
9424
|
}
|
|
9431
|
-
function
|
|
9425
|
+
function me(s) {
|
|
9432
9426
|
return (s ?? "").replace(/\u00a0/g, " ").replace(/\r\n?/g, `
|
|
9433
9427
|
`).split(`
|
|
9434
9428
|
`).map((e) => e.replace(/[ \t]+/g, " ").trim()).join(`
|
|
@@ -9437,10 +9431,10 @@ function Ie(s) {
|
|
|
9437
9431
|
`).trim();
|
|
9438
9432
|
}
|
|
9439
9433
|
function $t(s, e) {
|
|
9440
|
-
let t =
|
|
9434
|
+
let t = me(s);
|
|
9441
9435
|
for (const i of e)
|
|
9442
9436
|
t = t.replace(i, "");
|
|
9443
|
-
return
|
|
9437
|
+
return me(t);
|
|
9444
9438
|
}
|
|
9445
9439
|
function mn(s) {
|
|
9446
9440
|
const e = window.getComputedStyle(s);
|
|
@@ -9544,39 +9538,39 @@ function dc(s, e) {
|
|
|
9544
9538
|
if (p >= 1e3 && !se || P.has(k) || r.has(b) || k.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || B.display === "none" || B.visibility === "hidden")
|
|
9545
9539
|
return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
|
|
9546
9540
|
p += 1;
|
|
9547
|
-
const He = f(k),
|
|
9541
|
+
const He = f(k), we = Sn(k), be = a.has(He) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(b) || b === "a" && k.hasAttribute("href"), ue = Array.from(k.children).filter((_) => _ instanceof HTMLElement), he = /* @__PURE__ */ new Map();
|
|
9548
9542
|
for (const _ of ue) {
|
|
9549
9543
|
const U = g(_);
|
|
9550
9544
|
he.set(U, (he.get(U) ?? 0) + 1);
|
|
9551
9545
|
}
|
|
9552
|
-
const
|
|
9546
|
+
const ve = /* @__PURE__ */ new Map(), je = /* @__PURE__ */ new Map();
|
|
9553
9547
|
for (const _ of ue) {
|
|
9554
9548
|
const U = g(_), ie = je.get(U) ?? 0;
|
|
9555
|
-
je.set(U, ie + 1), (he.get(U) ?? 0) > 8 && ie >= 6 && !d.has(_) &&
|
|
9549
|
+
je.set(U, ie + 1), (he.get(U) ?? 0) > 8 && ie >= 6 && !d.has(_) && ve.set(U, (ve.get(U) ?? 0) + 1);
|
|
9556
9550
|
}
|
|
9557
|
-
const $e = /* @__PURE__ */ new Map(), pe = /* @__PURE__ */ new Set(),
|
|
9551
|
+
const $e = /* @__PURE__ */ new Map(), pe = /* @__PURE__ */ new Set(), Te = [], _e = [];
|
|
9558
9552
|
for (const _ of ue) {
|
|
9559
9553
|
const U = g(_), ie = he.get(U) ?? 0, Ps = $e.get(U) ?? 0;
|
|
9560
9554
|
if ($e.set(U, Ps + 1), ie > 8 && Ps >= 6 && !d.has(_)) {
|
|
9561
|
-
pe.has(U) || (
|
|
9555
|
+
pe.has(U) || (Te.push([`… ${ve.get(U) ?? 0} similar siblings omitted`]), pe.add(U));
|
|
9562
9556
|
continue;
|
|
9563
9557
|
}
|
|
9564
9558
|
const Ds = D(_, R);
|
|
9565
|
-
|
|
9559
|
+
_e.push(Ds), Te.push(Ds.lines);
|
|
9566
9560
|
}
|
|
9567
9561
|
const Z = [];
|
|
9568
9562
|
if (k.shadowRoot)
|
|
9569
9563
|
for (const _ of Array.from(k.shadowRoot.children))
|
|
9570
9564
|
_ instanceof HTMLElement && Z.push(D(_, R + 1));
|
|
9571
|
-
const ae = [...
|
|
9572
|
-
[
|
|
9573
|
-
).slice(0, 180), ce = k.hasAttribute("contenteditable") && (
|
|
9565
|
+
const ae = [..._e, ...Z], We = we.length > 0 || be || ae.some((_) => _.hasUsefulContent), Re = me(
|
|
9566
|
+
[we, ...ae.map((_) => _.textPreview)].filter(Boolean).join(" ")
|
|
9567
|
+
).slice(0, 180), ce = k.hasAttribute("contenteditable") && (we.length > 0 || !k.querySelector("[contenteditable]")), j = l.some((_) => k.hasAttribute(_)) || !!He || ce, K = (k.getClientRects().length > 0 || B.display === "contents") && (t.has(b) || j || se) && (We || se) && (!n.has(b) || We || j || se), Rt = K ? 1 : 0, Ae = [];
|
|
9574
9568
|
if (K) {
|
|
9575
|
-
const _ = ae.some((ie) => ie.containsTextElement), U = i.has(b) && !_ ?
|
|
9576
|
-
|
|
9569
|
+
const _ = ae.some((ie) => ie.containsTextElement), U = i.has(b) && !_ ? Re : we;
|
|
9570
|
+
Ae.push(In(k, c, o, U.slice(0, 180)));
|
|
9577
9571
|
}
|
|
9578
|
-
for (const _ of
|
|
9579
|
-
|
|
9572
|
+
for (const _ of Te)
|
|
9573
|
+
Ae.push(...Ye(_, Rt));
|
|
9580
9574
|
const At = Z.flatMap((_) => _.lines);
|
|
9581
9575
|
if (At.length > 0) {
|
|
9582
9576
|
const _ = At.slice(0, 20);
|
|
@@ -9584,20 +9578,20 @@ function dc(s, e) {
|
|
|
9584
9578
|
const U = b.includes("tooltip") || b.includes("popper") || b.includes("loader");
|
|
9585
9579
|
if (R < 2 && !U) {
|
|
9586
9580
|
const ie = K ? "#shadow-root" : `${b} #shadow-root`;
|
|
9587
|
-
|
|
9581
|
+
Ae.push(...Ye([ie, ...Ye(_, 1)], Rt));
|
|
9588
9582
|
} else
|
|
9589
|
-
|
|
9583
|
+
Ae.push(...Ye(_, Rt));
|
|
9590
9584
|
}
|
|
9591
9585
|
return {
|
|
9592
|
-
lines:
|
|
9586
|
+
lines: Ae,
|
|
9593
9587
|
hasUsefulContent: We,
|
|
9594
|
-
textPreview:
|
|
9588
|
+
textPreview: Re,
|
|
9595
9589
|
containsTextElement: i.has(b) || ae.some((_) => _.containsTextElement)
|
|
9596
9590
|
};
|
|
9597
9591
|
};
|
|
9598
9592
|
return [`--- ${S} ---`, ...D(m, 0).lines].join(`
|
|
9599
9593
|
`);
|
|
9600
|
-
}, w = [], y =
|
|
9594
|
+
}, w = [], y = me(window.getSelection()?.toString() ?? "");
|
|
9601
9595
|
y && w.push(`--- selected text ---
|
|
9602
9596
|
${JSON.stringify(y)}`), u.length > 0 && w.push(hc(u, t, c, o));
|
|
9603
9597
|
for (const m of s.slice(0, 3))
|
|
@@ -9702,7 +9696,7 @@ function Ye(s, e) {
|
|
|
9702
9696
|
return s.map((i) => `${t}${i}`);
|
|
9703
9697
|
}
|
|
9704
9698
|
function Sn(s) {
|
|
9705
|
-
return
|
|
9699
|
+
return me(
|
|
9706
9700
|
Array.from(s.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
|
|
9707
9701
|
);
|
|
9708
9702
|
}
|
|
@@ -9871,8 +9865,8 @@ function ft(s, e) {
|
|
|
9871
9865
|
),
|
|
9872
9866
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
9873
9867
|
...x(n) !== null ? { displaySequence: x(n) } : {},
|
|
9874
|
-
...
|
|
9875
|
-
respondsToUserMessageId:
|
|
9868
|
+
...F(n) !== null ? { causalSequence: F(n) } : {},
|
|
9869
|
+
respondsToUserMessageId: H(n) ?? void 0,
|
|
9876
9870
|
...E(n) ? { runId: E(n) } : {},
|
|
9877
9871
|
dataType: "assistant_draft",
|
|
9878
9872
|
...n.steered === !0 ? { steered: !0 } : {}
|
|
@@ -9888,8 +9882,8 @@ function ft(s, e) {
|
|
|
9888
9882
|
),
|
|
9889
9883
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
9890
9884
|
...x(n) !== null ? { displaySequence: x(n) } : {},
|
|
9891
|
-
...
|
|
9892
|
-
respondsToUserMessageId:
|
|
9885
|
+
...F(n) !== null ? { causalSequence: F(n) } : {},
|
|
9886
|
+
respondsToUserMessageId: H(n) ?? void 0,
|
|
9893
9887
|
...E(n) ? { runId: E(n) } : {},
|
|
9894
9888
|
attachments: kn(n.attachments, e),
|
|
9895
9889
|
...n.steered === !0 ? { steered: !0 } : {}
|
|
@@ -9914,11 +9908,11 @@ function ft(s, e) {
|
|
|
9914
9908
|
content: "",
|
|
9915
9909
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
9916
9910
|
...x(n) !== null ? { displaySequence: x(n) } : {},
|
|
9917
|
-
respondsToUserMessageId:
|
|
9911
|
+
respondsToUserMessageId: H(n) ?? void 0,
|
|
9918
9912
|
...E(n) ? { runId: E(n) } : {},
|
|
9919
9913
|
dataType: "function_call_output",
|
|
9920
9914
|
toolName: _s,
|
|
9921
|
-
callId:
|
|
9915
|
+
callId: Pe(n) ?? void 0,
|
|
9922
9916
|
sharePromptAllowed: r
|
|
9923
9917
|
};
|
|
9924
9918
|
const o = xo(n.output);
|
|
@@ -9929,11 +9923,11 @@ function ft(s, e) {
|
|
|
9929
9923
|
content: "",
|
|
9930
9924
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
9931
9925
|
...x(n) !== null ? { displaySequence: x(n) } : {},
|
|
9932
|
-
respondsToUserMessageId:
|
|
9926
|
+
respondsToUserMessageId: H(n) ?? void 0,
|
|
9933
9927
|
...E(n) ? { runId: E(n) } : {},
|
|
9934
9928
|
dataType: "scheduled_check_in",
|
|
9935
9929
|
toolName: an,
|
|
9936
|
-
callId:
|
|
9930
|
+
callId: Pe(n) ?? void 0,
|
|
9937
9931
|
scheduledCheckInId: o.id ?? void 0,
|
|
9938
9932
|
scheduledCheckInAt: o.dueAt
|
|
9939
9933
|
};
|
|
@@ -9944,12 +9938,12 @@ function ft(s, e) {
|
|
|
9944
9938
|
content: `Connect ${a.appName} to continue`,
|
|
9945
9939
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
9946
9940
|
...x(n) !== null ? { displaySequence: x(n) } : {},
|
|
9947
|
-
...
|
|
9948
|
-
respondsToUserMessageId:
|
|
9941
|
+
...F(n) !== null ? { causalSequence: F(n) } : {},
|
|
9942
|
+
respondsToUserMessageId: H(n) ?? void 0,
|
|
9949
9943
|
...E(n) ? { runId: E(n) } : {},
|
|
9950
9944
|
dataType: "function_call_output",
|
|
9951
9945
|
toolName: "authenticate_pipedream_app",
|
|
9952
|
-
callId:
|
|
9946
|
+
callId: Pe(n) ?? void 0,
|
|
9953
9947
|
integrationAuthRequest: a
|
|
9954
9948
|
} : c ? {
|
|
9955
9949
|
id: String(t.id ?? crypto.randomUUID()),
|
|
@@ -9957,12 +9951,12 @@ function ft(s, e) {
|
|
|
9957
9951
|
content: "Connect WhatsApp to continue",
|
|
9958
9952
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
9959
9953
|
...x(n) !== null ? { displaySequence: x(n) } : {},
|
|
9960
|
-
...
|
|
9961
|
-
respondsToUserMessageId:
|
|
9954
|
+
...F(n) !== null ? { causalSequence: F(n) } : {},
|
|
9955
|
+
respondsToUserMessageId: H(n) ?? void 0,
|
|
9962
9956
|
...E(n) ? { runId: E(n) } : {},
|
|
9963
9957
|
dataType: "function_call_output",
|
|
9964
9958
|
toolName: "request_personal_channel_connection",
|
|
9965
|
-
callId:
|
|
9959
|
+
callId: Pe(n) ?? void 0,
|
|
9966
9960
|
personalChannelConnectionRequest: c
|
|
9967
9961
|
} : null;
|
|
9968
9962
|
}
|
|
@@ -9972,12 +9966,12 @@ function ft(s, e) {
|
|
|
9972
9966
|
content: n.type === "mcp_call" ? vc(n) : Ac(n),
|
|
9973
9967
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
9974
9968
|
...x(n) !== null ? { displaySequence: x(n) } : {},
|
|
9975
|
-
...
|
|
9976
|
-
respondsToUserMessageId:
|
|
9969
|
+
...F(n) !== null ? { causalSequence: F(n) } : {},
|
|
9970
|
+
respondsToUserMessageId: H(n) ?? void 0,
|
|
9977
9971
|
...E(n) ? { runId: E(n) } : {},
|
|
9978
9972
|
dataType: String(n.type),
|
|
9979
9973
|
toolName: n.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof n.name == "string" ? n.name : void 0,
|
|
9980
|
-
callId:
|
|
9974
|
+
callId: Pe(n) ?? void 0,
|
|
9981
9975
|
loading: n.steered === !0 ? !1 : n.localExecutionStatus === "queued" || n.localExecutionStatus === "running" ? !0 : typeof n.localExecutionStatus == "string" ? !1 : void 0,
|
|
9982
9976
|
...n.steered === !0 ? { steered: !0 } : {}
|
|
9983
9977
|
} : n.type === "run_status" || n.type === "run_error" ? n.type === "run_error" && n.stage === "tool_execution" ? null : {
|
|
@@ -9986,8 +9980,8 @@ function ft(s, e) {
|
|
|
9986
9980
|
content: Rc(n),
|
|
9987
9981
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
9988
9982
|
...x(n) !== null ? { displaySequence: x(n) } : {},
|
|
9989
|
-
...
|
|
9990
|
-
respondsToUserMessageId:
|
|
9983
|
+
...F(n) !== null ? { causalSequence: F(n) } : {},
|
|
9984
|
+
respondsToUserMessageId: H(n) ?? void 0,
|
|
9991
9985
|
...E(n) ? { runId: E(n) } : {},
|
|
9992
9986
|
dataType: String(n.type),
|
|
9993
9987
|
loading: n.steered !== !0 && n.type === "run_status" && (n.status === "running" || n.status === "retrying"),
|
|
@@ -10051,18 +10045,18 @@ function Ac(s) {
|
|
|
10051
10045
|
}
|
|
10052
10046
|
function kc(s) {
|
|
10053
10047
|
if (typeof s.summary == "string" && s.summary.trim().length > 0)
|
|
10054
|
-
return
|
|
10048
|
+
return ge(s.summary);
|
|
10055
10049
|
if (typeof s.arguments == "string")
|
|
10056
10050
|
try {
|
|
10057
10051
|
const e = JSON.parse(s.arguments);
|
|
10058
10052
|
if (typeof e.summary == "string" && e.summary.trim().length > 0)
|
|
10059
|
-
return
|
|
10053
|
+
return ge(e.summary);
|
|
10060
10054
|
} catch {
|
|
10061
|
-
return typeof s.name == "string" && s.name.trim().length > 0 ?
|
|
10055
|
+
return typeof s.name == "string" && s.name.trim().length > 0 ? ge(s.name) : "🛠️ Run tool";
|
|
10062
10056
|
}
|
|
10063
|
-
return typeof s.name == "string" && s.name.trim().length > 0 ?
|
|
10057
|
+
return typeof s.name == "string" && s.name.trim().length > 0 ? ge(s.name) : "🛠️ Run tool";
|
|
10064
10058
|
}
|
|
10065
|
-
function
|
|
10059
|
+
function ge(s) {
|
|
10066
10060
|
const e = s.trim() || "Run tool", t = e.codePointAt(0) ?? 0;
|
|
10067
10061
|
return t >= 126976 && t <= 129791 || t >= 9728 && t <= 10175 || t >= 127462 && t <= 127487 ? e : `🛠️ ${e}`;
|
|
10068
10062
|
}
|
|
@@ -10081,11 +10075,11 @@ function Mc(s) {
|
|
|
10081
10075
|
runId: typeof e.runId == "string" ? e.runId : null
|
|
10082
10076
|
};
|
|
10083
10077
|
}
|
|
10084
|
-
function
|
|
10078
|
+
function Pe(s) {
|
|
10085
10079
|
const e = s.callId ?? s.call_id;
|
|
10086
10080
|
return typeof e == "string" && e ? e : null;
|
|
10087
10081
|
}
|
|
10088
|
-
function
|
|
10082
|
+
function F(s) {
|
|
10089
10083
|
return typeof s.causalSequence == "number" && Number.isSafeInteger(s.causalSequence) ? s.causalSequence : null;
|
|
10090
10084
|
}
|
|
10091
10085
|
function x(s) {
|
|
@@ -10099,7 +10093,7 @@ function wi(s) {
|
|
|
10099
10093
|
return typeof t.text == "string" ? t.text : typeof t.content == "string" ? t.content : "";
|
|
10100
10094
|
}).filter(Boolean).join("") : "";
|
|
10101
10095
|
}
|
|
10102
|
-
function
|
|
10096
|
+
function qe(s, e) {
|
|
10103
10097
|
const t = bn(
|
|
10104
10098
|
s,
|
|
10105
10099
|
Ms(s, e)
|
|
@@ -10172,7 +10166,7 @@ function vi(s, e) {
|
|
|
10172
10166
|
(n) => !n.id.startsWith("transient-activity:") && n.callId === e.callId
|
|
10173
10167
|
);
|
|
10174
10168
|
if (t === -1)
|
|
10175
|
-
return
|
|
10169
|
+
return qe(s, e);
|
|
10176
10170
|
const i = [...s];
|
|
10177
10171
|
return i[t] = {
|
|
10178
10172
|
...i[t],
|
|
@@ -10196,7 +10190,7 @@ function _i(s) {
|
|
|
10196
10190
|
return !e || !t ? null : {
|
|
10197
10191
|
id: `transient-activity:${e}`,
|
|
10198
10192
|
role: "tool",
|
|
10199
|
-
content:
|
|
10193
|
+
content: ge(
|
|
10200
10194
|
typeof s.summary == "string" ? s.summary : "Running browser tool"
|
|
10201
10195
|
),
|
|
10202
10196
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -10390,7 +10384,7 @@ function Tn(s) {
|
|
|
10390
10384
|
function gt(s) {
|
|
10391
10385
|
return X(s) ? !0 : s.role !== "system" ? !1 : s.dataType === "run_error" ? !0 : s.dataType === "run_status" && s.loading !== !0;
|
|
10392
10386
|
}
|
|
10393
|
-
function
|
|
10387
|
+
function Ie(s) {
|
|
10394
10388
|
for (let e = s.length - 1; e >= 0; e -= 1) {
|
|
10395
10389
|
const t = s[e];
|
|
10396
10390
|
if (!t || typeof t != "object")
|
|
@@ -10405,7 +10399,7 @@ function Se(s) {
|
|
|
10405
10399
|
return null;
|
|
10406
10400
|
}
|
|
10407
10401
|
function Nc(s) {
|
|
10408
|
-
const e =
|
|
10402
|
+
const e = Ie(s);
|
|
10409
10403
|
if (e === null)
|
|
10410
10404
|
return null;
|
|
10411
10405
|
const i = q(s[e])?.page;
|
|
@@ -10427,7 +10421,7 @@ function Lc(s) {
|
|
|
10427
10421
|
return s?.type === "run_status" && s.status === "interrupted" && s.reason === "backend_restart";
|
|
10428
10422
|
}
|
|
10429
10423
|
function Fc(s, e) {
|
|
10430
|
-
const t =
|
|
10424
|
+
const t = Ie(e);
|
|
10431
10425
|
if (t === null)
|
|
10432
10426
|
return !1;
|
|
10433
10427
|
const i = e[t], n = i && typeof i == "object" ? i.id : null;
|
|
@@ -10439,7 +10433,7 @@ function Fc(s, e) {
|
|
|
10439
10433
|
) : s.slice(r + 1).some(gt);
|
|
10440
10434
|
}
|
|
10441
10435
|
function ds(s) {
|
|
10442
|
-
const e =
|
|
10436
|
+
const e = Ie(s);
|
|
10443
10437
|
if (e === null)
|
|
10444
10438
|
return null;
|
|
10445
10439
|
const t = s[e];
|
|
@@ -10452,7 +10446,7 @@ function ds(s) {
|
|
|
10452
10446
|
return typeof n == "string" ? n : null;
|
|
10453
10447
|
}
|
|
10454
10448
|
function Hc(s) {
|
|
10455
|
-
const e =
|
|
10449
|
+
const e = Ie(s);
|
|
10456
10450
|
if (e === null)
|
|
10457
10451
|
return null;
|
|
10458
10452
|
for (let t = s.length - 1; t > e; t -= 1) {
|
|
@@ -10475,7 +10469,7 @@ function Hc(s) {
|
|
|
10475
10469
|
function us(s, e) {
|
|
10476
10470
|
if (typeof e.clientMessageId == "string")
|
|
10477
10471
|
return e.clientMessageId;
|
|
10478
|
-
const t =
|
|
10472
|
+
const t = H(e);
|
|
10479
10473
|
if (!t)
|
|
10480
10474
|
return null;
|
|
10481
10475
|
const i = s.find((r) => A(r, "id") === t), n = q(i);
|
|
@@ -10487,7 +10481,7 @@ function Ri(s, e, t, i, n, r) {
|
|
|
10487
10481
|
const o = s;
|
|
10488
10482
|
if (Ne(o) || t !== null && typeof o.id == "string" && o.id !== t)
|
|
10489
10483
|
return !1;
|
|
10490
|
-
const a =
|
|
10484
|
+
const a = H(o);
|
|
10491
10485
|
return i !== null ? a !== null ? a === i : n !== null && E(o) === n && r === i : n === null || E(o) === n;
|
|
10492
10486
|
}
|
|
10493
10487
|
function jc(s, e) {
|
|
@@ -10553,11 +10547,11 @@ function ki(s, e, t, i) {
|
|
|
10553
10547
|
runId: t ?? r?.runId ?? null
|
|
10554
10548
|
};
|
|
10555
10549
|
}
|
|
10556
|
-
function
|
|
10550
|
+
function Oe(s) {
|
|
10557
10551
|
return s?.type === "run_status" && s.status === "stopped";
|
|
10558
10552
|
}
|
|
10559
10553
|
function Qc(s, e) {
|
|
10560
|
-
return X(e) ? "completed" :
|
|
10554
|
+
return X(e) ? "completed" : Oe(s) ? "stopped" : !Ne(s) && (s?.type === "run_error" || s?.type === "run_status" && (s.status === "failed" || s.status === "interrupted")) ? "failed" : null;
|
|
10561
10555
|
}
|
|
10562
10556
|
function Mi(s, e, t) {
|
|
10563
10557
|
const i = new Set(
|
|
@@ -10736,7 +10730,7 @@ function rl(s) {
|
|
|
10736
10730
|
return [];
|
|
10737
10731
|
}
|
|
10738
10732
|
}
|
|
10739
|
-
function
|
|
10733
|
+
function $(s, e) {
|
|
10740
10734
|
try {
|
|
10741
10735
|
const t = e.filter(Es);
|
|
10742
10736
|
if (t.length === 0) {
|
|
@@ -10814,7 +10808,7 @@ function ol(s) {
|
|
|
10814
10808
|
const i = JSON.parse(t);
|
|
10815
10809
|
return Array.isArray(i) ? i.flatMap((n) => cl(n) ? [{
|
|
10816
10810
|
...n.event,
|
|
10817
|
-
page:
|
|
10811
|
+
page: W(),
|
|
10818
10812
|
rawOutput: {
|
|
10819
10813
|
pageContextRestarted: !0,
|
|
10820
10814
|
outcome: "unknown",
|
|
@@ -10953,7 +10947,7 @@ function yt(s) {
|
|
|
10953
10947
|
} = s;
|
|
10954
10948
|
return r;
|
|
10955
10949
|
}
|
|
10956
|
-
function
|
|
10950
|
+
function H(s) {
|
|
10957
10951
|
const e = s.respondsToUserMessageId;
|
|
10958
10952
|
return typeof e == "string" && e ? e : null;
|
|
10959
10953
|
}
|