@pluno/product-agent-web 0.1.228 → 0.1.229
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/assistantDeltaReplay.d.ts +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/product-agent-sdk.js +853 -828
- package/dist/product-agent-widget.js +1392 -1367
- package/package.json +1 -1
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
class Ln {
|
|
2
|
+
receivedBySession = /* @__PURE__ */ new Map();
|
|
3
|
+
accept(e) {
|
|
4
|
+
if (typeof e.sessionId != "string" || typeof e.runId != "string" || typeof e.e2bEventSequence != "number" || !Number.isSafeInteger(e.e2bEventSequence) || e.e2bEventSequence < 1)
|
|
5
|
+
return !0;
|
|
6
|
+
const t = JSON.stringify([e.runId, e.e2bEventSequence]), i = this.receivedBySession.get(e.sessionId) ?? /* @__PURE__ */ new Set();
|
|
7
|
+
return i.has(t) ? !1 : (i.add(t), this.receivedBySession.set(e.sessionId, i), !0);
|
|
8
|
+
}
|
|
9
|
+
forget(e) {
|
|
10
|
+
this.receivedBySession.delete(e);
|
|
11
|
+
}
|
|
12
|
+
clear() {
|
|
13
|
+
this.receivedBySession.clear();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function Fn(s, e = Math.random, t = Math.random) {
|
|
2
17
|
const i = () => Math.floor(t() * 21) - 10;
|
|
3
18
|
return {
|
|
4
19
|
"activeUsers.load": async () => ({ count: await s(), updatedAt: Date.now(), offset: i() }),
|
|
@@ -6,14 +21,14 @@ function Ln(s, e = Math.random, t = Math.random) {
|
|
|
6
21
|
"activeUsers.wait": ({ milliseconds: n }) => new Promise((r) => setTimeout(() => r(null), n + Math.round((e() - 0.5) * 1e3)))
|
|
7
22
|
};
|
|
8
23
|
}
|
|
9
|
-
async function
|
|
24
|
+
async function jn(s, e = fetch) {
|
|
10
25
|
const t = await e(new URL("/api/product-agent/embed/active-users", s), { cache: "no-store", credentials: "omit" });
|
|
11
26
|
if (!t.ok) throw new Error(`Active users request failed (${t.status})`);
|
|
12
27
|
const i = await t.json();
|
|
13
28
|
if (typeof i.count != "number" || !Number.isFinite(i.count) || i.count < 0) throw new Error("Invalid active users count");
|
|
14
29
|
return Math.round(i.count);
|
|
15
30
|
}
|
|
16
|
-
function
|
|
31
|
+
function Gt(s, e) {
|
|
17
32
|
const t = new Set([
|
|
18
33
|
s.assistantDraftRespondsToUserMessageId,
|
|
19
34
|
s.activeResponseUserMessageId,
|
|
@@ -45,37 +60,37 @@ const st = /* @__PURE__ */ Object.create(null);
|
|
|
45
60
|
Object.keys(Y).forEach((s) => {
|
|
46
61
|
st[Y[s]] = s;
|
|
47
62
|
});
|
|
48
|
-
const Qt = { type: "error", data: "parser error" }, Ni = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", Li = typeof ArrayBuffer == "function", Fi = (s) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(s) : s && s.buffer instanceof ArrayBuffer,
|
|
63
|
+
const Qt = { type: "error", data: "parser error" }, Ni = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", Li = typeof ArrayBuffer == "function", Fi = (s) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(s) : s && s.buffer instanceof ArrayBuffer, ms = ({ type: s, data: e }, t, i) => Ni && e instanceof Blob ? t ? i(e) : qs(e, i) : Li && (e instanceof ArrayBuffer || Fi(e)) ? t ? i(e) : qs(new Blob([e]), i) : i(Y[s] + (e || "")), qs = (s, e) => {
|
|
49
64
|
const t = new FileReader();
|
|
50
65
|
return t.onload = function() {
|
|
51
66
|
const i = t.result.split(",")[1];
|
|
52
67
|
e("b" + (i || ""));
|
|
53
68
|
}, t.readAsDataURL(s);
|
|
54
69
|
};
|
|
55
|
-
function
|
|
70
|
+
function Os(s) {
|
|
56
71
|
return s instanceof Uint8Array ? s : s instanceof ArrayBuffer ? new Uint8Array(s) : new Uint8Array(s.buffer, s.byteOffset, s.byteLength);
|
|
57
72
|
}
|
|
58
73
|
let kt;
|
|
59
|
-
function
|
|
74
|
+
function Hn(s, e) {
|
|
60
75
|
if (Ni && s.data instanceof Blob)
|
|
61
|
-
return s.data.arrayBuffer().then(
|
|
76
|
+
return s.data.arrayBuffer().then(Os).then(e);
|
|
62
77
|
if (Li && (s.data instanceof ArrayBuffer || Fi(s.data)))
|
|
63
|
-
return e(
|
|
64
|
-
|
|
78
|
+
return e(Os(s.data));
|
|
79
|
+
ms(s, !1, (t) => {
|
|
65
80
|
kt || (kt = new TextEncoder()), e(kt.encode(t));
|
|
66
81
|
});
|
|
67
82
|
}
|
|
68
|
-
const
|
|
69
|
-
for (let s = 0; s <
|
|
70
|
-
|
|
71
|
-
const
|
|
83
|
+
const xs = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Ue = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
|
|
84
|
+
for (let s = 0; s < xs.length; s++)
|
|
85
|
+
Ue[xs.charCodeAt(s)] = s;
|
|
86
|
+
const $n = (s) => {
|
|
72
87
|
let e = s.length * 0.75, t = s.length, i, n = 0, r, o, a, c;
|
|
73
88
|
s[s.length - 1] === "=" && (e--, s[s.length - 2] === "=" && e--);
|
|
74
89
|
const l = new ArrayBuffer(e), d = new Uint8Array(l);
|
|
75
90
|
for (i = 0; i < t; i += 4)
|
|
76
|
-
r =
|
|
91
|
+
r = Ue[s.charCodeAt(i)], o = Ue[s.charCodeAt(i + 1)], a = Ue[s.charCodeAt(i + 2)], c = Ue[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
92
|
return l;
|
|
78
|
-
},
|
|
93
|
+
}, Wn = typeof ArrayBuffer == "function", Is = (s, e) => {
|
|
79
94
|
if (typeof s != "string")
|
|
80
95
|
return {
|
|
81
96
|
type: "message",
|
|
@@ -84,40 +99,40 @@ const Hn = (s) => {
|
|
|
84
99
|
const t = s.charAt(0);
|
|
85
100
|
return t === "b" ? {
|
|
86
101
|
type: "message",
|
|
87
|
-
data:
|
|
102
|
+
data: zn(s.substring(1), e)
|
|
88
103
|
} : st[t] ? s.length > 1 ? {
|
|
89
104
|
type: st[t],
|
|
90
105
|
data: s.substring(1)
|
|
91
106
|
} : {
|
|
92
107
|
type: st[t]
|
|
93
108
|
} : Qt;
|
|
94
|
-
},
|
|
95
|
-
if (
|
|
96
|
-
const t =
|
|
109
|
+
}, zn = (s, e) => {
|
|
110
|
+
if (Wn) {
|
|
111
|
+
const t = $n(s);
|
|
97
112
|
return ji(t, e);
|
|
98
113
|
} else
|
|
99
114
|
return { base64: !0, data: s };
|
|
100
|
-
}, ji = (s, e) => e === "blob" ? s instanceof Blob ? s : new Blob([s]) : s instanceof ArrayBuffer ? s : s.buffer, Hi = "",
|
|
115
|
+
}, ji = (s, e) => e === "blob" ? s instanceof Blob ? s : new Blob([s]) : s instanceof ArrayBuffer ? s : s.buffer, Hi = "", Kn = (s, e) => {
|
|
101
116
|
const t = s.length, i = new Array(t);
|
|
102
117
|
let n = 0;
|
|
103
118
|
s.forEach((r, o) => {
|
|
104
|
-
|
|
119
|
+
ms(r, !1, (a) => {
|
|
105
120
|
i[o] = a, ++n === t && e(i.join(Hi));
|
|
106
121
|
});
|
|
107
122
|
});
|
|
108
|
-
},
|
|
123
|
+
}, Vn = (s, e) => {
|
|
109
124
|
const t = s.split(Hi), i = [];
|
|
110
125
|
for (let n = 0; n < t.length; n++) {
|
|
111
|
-
const r =
|
|
126
|
+
const r = Is(t[n], e);
|
|
112
127
|
if (i.push(r), r.type === "error")
|
|
113
128
|
break;
|
|
114
129
|
}
|
|
115
130
|
return i;
|
|
116
131
|
};
|
|
117
|
-
function
|
|
132
|
+
function Gn() {
|
|
118
133
|
return new TransformStream({
|
|
119
134
|
transform(s, e) {
|
|
120
|
-
|
|
135
|
+
Hn(s, (t) => {
|
|
121
136
|
const i = t.length;
|
|
122
137
|
let n;
|
|
123
138
|
if (i < 126)
|
|
@@ -137,10 +152,10 @@ function Vn() {
|
|
|
137
152
|
});
|
|
138
153
|
}
|
|
139
154
|
let Mt;
|
|
140
|
-
function
|
|
155
|
+
function Ke(s) {
|
|
141
156
|
return s.reduce((e, t) => e + t.length, 0);
|
|
142
157
|
}
|
|
143
|
-
function
|
|
158
|
+
function Ve(s, e) {
|
|
144
159
|
if (s[0].length === e)
|
|
145
160
|
return s.shift();
|
|
146
161
|
const t = new Uint8Array(e);
|
|
@@ -157,29 +172,29 @@ function Qn(s, e) {
|
|
|
157
172
|
transform(o, a) {
|
|
158
173
|
for (t.push(o); ; ) {
|
|
159
174
|
if (i === 0) {
|
|
160
|
-
if (
|
|
175
|
+
if (Ke(t) < 1)
|
|
161
176
|
break;
|
|
162
|
-
const c =
|
|
177
|
+
const c = Ve(t, 1);
|
|
163
178
|
r = (c[0] & 128) === 128, n = c[0] & 127, n < 126 ? i = 3 : n === 126 ? i = 1 : i = 2;
|
|
164
179
|
} else if (i === 1) {
|
|
165
|
-
if (
|
|
180
|
+
if (Ke(t) < 2)
|
|
166
181
|
break;
|
|
167
|
-
const c =
|
|
182
|
+
const c = Ve(t, 2);
|
|
168
183
|
n = new DataView(c.buffer, c.byteOffset, c.length).getUint16(0), i = 3;
|
|
169
184
|
} else if (i === 2) {
|
|
170
|
-
if (
|
|
185
|
+
if (Ke(t) < 8)
|
|
171
186
|
break;
|
|
172
|
-
const c =
|
|
187
|
+
const c = Ve(t, 8), l = new DataView(c.buffer, c.byteOffset, c.length), d = l.getUint32(0);
|
|
173
188
|
if (d > Math.pow(2, 21) - 1) {
|
|
174
189
|
a.enqueue(Qt);
|
|
175
190
|
break;
|
|
176
191
|
}
|
|
177
192
|
n = d * Math.pow(2, 32) + l.getUint32(4), i = 3;
|
|
178
193
|
} else {
|
|
179
|
-
if (
|
|
194
|
+
if (Ke(t) < n)
|
|
180
195
|
break;
|
|
181
|
-
const c =
|
|
182
|
-
a.enqueue(
|
|
196
|
+
const c = Ve(t, n);
|
|
197
|
+
a.enqueue(Is(r ? c : Mt.decode(c), e)), i = 0;
|
|
183
198
|
}
|
|
184
199
|
if (n === 0 || n > s) {
|
|
185
200
|
a.enqueue(Qt);
|
|
@@ -191,9 +206,9 @@ function Qn(s, e) {
|
|
|
191
206
|
}
|
|
192
207
|
const $i = 4;
|
|
193
208
|
function C(s) {
|
|
194
|
-
if (s) return
|
|
209
|
+
if (s) return Jn(s);
|
|
195
210
|
}
|
|
196
|
-
function
|
|
211
|
+
function Jn(s) {
|
|
197
212
|
for (var e in C.prototype)
|
|
198
213
|
s[e] = C.prototype[e];
|
|
199
214
|
return s;
|
|
@@ -239,19 +254,19 @@ C.prototype.listeners = function(s) {
|
|
|
239
254
|
C.prototype.hasListeners = function(s) {
|
|
240
255
|
return !!this.listeners(s).length;
|
|
241
256
|
};
|
|
242
|
-
const St = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0),
|
|
257
|
+
const St = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), G = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Xn = "arraybuffer";
|
|
243
258
|
function Wi(s, ...e) {
|
|
244
259
|
return e.reduce((t, i) => (s.hasOwnProperty(i) && (t[i] = s[i]), t), {});
|
|
245
260
|
}
|
|
246
|
-
const
|
|
261
|
+
const Yn = G.setTimeout, Zn = G.clearTimeout;
|
|
247
262
|
function wt(s, e) {
|
|
248
|
-
e.useNativeTimers ? (s.setTimeoutFn =
|
|
249
|
-
}
|
|
250
|
-
const Zn = 1.33;
|
|
251
|
-
function er(s) {
|
|
252
|
-
return typeof s == "string" ? tr(s) : Math.ceil((s.byteLength || s.size) * Zn);
|
|
263
|
+
e.useNativeTimers ? (s.setTimeoutFn = Yn.bind(G), s.clearTimeoutFn = Zn.bind(G)) : (s.setTimeoutFn = G.setTimeout.bind(G), s.clearTimeoutFn = G.clearTimeout.bind(G));
|
|
253
264
|
}
|
|
265
|
+
const er = 1.33;
|
|
254
266
|
function tr(s) {
|
|
267
|
+
return typeof s == "string" ? sr(s) : Math.ceil((s.byteLength || s.size) * er);
|
|
268
|
+
}
|
|
269
|
+
function sr(s) {
|
|
255
270
|
let e = 0, t = 0;
|
|
256
271
|
for (let i = 0, n = s.length; i < n; i++)
|
|
257
272
|
e = s.charCodeAt(i), e < 128 ? t += 1 : e < 2048 ? t += 2 : e < 55296 || e >= 57344 ? t += 3 : (i++, t += 4);
|
|
@@ -260,13 +275,13 @@ function tr(s) {
|
|
|
260
275
|
function zi() {
|
|
261
276
|
return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
|
|
262
277
|
}
|
|
263
|
-
function
|
|
278
|
+
function ir(s) {
|
|
264
279
|
let e = "";
|
|
265
280
|
for (let t in s)
|
|
266
281
|
s.hasOwnProperty(t) && (e.length && (e += "&"), e += encodeURIComponent(t) + "=" + encodeURIComponent(s[t]));
|
|
267
282
|
return e;
|
|
268
283
|
}
|
|
269
|
-
function
|
|
284
|
+
function nr(s) {
|
|
270
285
|
let e = {}, t = s.split("&");
|
|
271
286
|
for (let i = 0, n = t.length; i < n; i++) {
|
|
272
287
|
let r = t[i].split("=");
|
|
@@ -274,12 +289,12 @@ function ir(s) {
|
|
|
274
289
|
}
|
|
275
290
|
return e;
|
|
276
291
|
}
|
|
277
|
-
class
|
|
292
|
+
class rr extends Error {
|
|
278
293
|
constructor(e, t, i) {
|
|
279
294
|
super(e), this.description = t, this.context = i, this.type = "TransportError";
|
|
280
295
|
}
|
|
281
296
|
}
|
|
282
|
-
class
|
|
297
|
+
class Ss extends C {
|
|
283
298
|
/**
|
|
284
299
|
* Transport abstract constructor.
|
|
285
300
|
*
|
|
@@ -299,7 +314,7 @@ class Is extends C {
|
|
|
299
314
|
* @protected
|
|
300
315
|
*/
|
|
301
316
|
onError(e, t, i) {
|
|
302
|
-
return super.emitReserved("error", new
|
|
317
|
+
return super.emitReserved("error", new rr(e, t, i)), this;
|
|
303
318
|
}
|
|
304
319
|
/**
|
|
305
320
|
* Opens the transport.
|
|
@@ -336,7 +351,7 @@ class Is extends C {
|
|
|
336
351
|
* @protected
|
|
337
352
|
*/
|
|
338
353
|
onData(e) {
|
|
339
|
-
const t =
|
|
354
|
+
const t = Is(e, this.socket.binaryType);
|
|
340
355
|
this.onPacket(t);
|
|
341
356
|
}
|
|
342
357
|
/**
|
|
@@ -373,11 +388,11 @@ class Is extends C {
|
|
|
373
388
|
return this.opts.port && (this.opts.secure && Number(this.opts.port) !== 443 || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
|
|
374
389
|
}
|
|
375
390
|
_query(e) {
|
|
376
|
-
const t =
|
|
391
|
+
const t = ir(e);
|
|
377
392
|
return t.length ? "?" + t : "";
|
|
378
393
|
}
|
|
379
394
|
}
|
|
380
|
-
class
|
|
395
|
+
class or extends Ss {
|
|
381
396
|
constructor() {
|
|
382
397
|
super(...arguments), this._polling = !1;
|
|
383
398
|
}
|
|
@@ -433,7 +448,7 @@ class rr extends Is {
|
|
|
433
448
|
return this.onClose({ description: "transport closed by the server" }), !1;
|
|
434
449
|
this.onPacket(i);
|
|
435
450
|
};
|
|
436
|
-
|
|
451
|
+
Vn(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
|
|
437
452
|
}
|
|
438
453
|
/**
|
|
439
454
|
* For polling, send a close packet.
|
|
@@ -453,7 +468,7 @@ class rr extends Is {
|
|
|
453
468
|
* @protected
|
|
454
469
|
*/
|
|
455
470
|
write(e) {
|
|
456
|
-
this.writable = !1,
|
|
471
|
+
this.writable = !1, Kn(e, (t) => {
|
|
457
472
|
this.doWrite(t, () => {
|
|
458
473
|
this.writable = !0, this.emitReserved("drain");
|
|
459
474
|
});
|
|
@@ -474,10 +489,10 @@ try {
|
|
|
474
489
|
Ki = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
|
|
475
490
|
} catch {
|
|
476
491
|
}
|
|
477
|
-
const
|
|
478
|
-
function
|
|
492
|
+
const ar = Ki;
|
|
493
|
+
function cr() {
|
|
479
494
|
}
|
|
480
|
-
class
|
|
495
|
+
class lr extends or {
|
|
481
496
|
/**
|
|
482
497
|
* XHR Polling constructor.
|
|
483
498
|
*
|
|
@@ -590,7 +605,7 @@ let ye = class it extends C {
|
|
|
590
605
|
*/
|
|
591
606
|
_cleanup(e) {
|
|
592
607
|
if (!(typeof this._xhr > "u" || this._xhr === null)) {
|
|
593
|
-
if (this._xhr.onreadystatechange =
|
|
608
|
+
if (this._xhr.onreadystatechange = cr, e)
|
|
594
609
|
try {
|
|
595
610
|
this._xhr.abort();
|
|
596
611
|
} catch {
|
|
@@ -620,27 +635,27 @@ ye.requestsCount = 0;
|
|
|
620
635
|
ye.requests = {};
|
|
621
636
|
if (typeof document < "u") {
|
|
622
637
|
if (typeof attachEvent == "function")
|
|
623
|
-
attachEvent("onunload",
|
|
638
|
+
attachEvent("onunload", Bs);
|
|
624
639
|
else if (typeof addEventListener == "function") {
|
|
625
|
-
const s = "onpagehide" in
|
|
626
|
-
addEventListener(s,
|
|
640
|
+
const s = "onpagehide" in G ? "pagehide" : "unload";
|
|
641
|
+
addEventListener(s, Bs, !1);
|
|
627
642
|
}
|
|
628
643
|
}
|
|
629
|
-
function
|
|
644
|
+
function Bs() {
|
|
630
645
|
for (let s in ye.requests)
|
|
631
646
|
ye.requests.hasOwnProperty(s) && ye.requests[s].abort();
|
|
632
647
|
}
|
|
633
|
-
const
|
|
648
|
+
const dr = (function() {
|
|
634
649
|
const s = Vi({
|
|
635
650
|
xdomain: !1
|
|
636
651
|
});
|
|
637
652
|
return s && s.responseType !== null;
|
|
638
653
|
})();
|
|
639
|
-
class
|
|
654
|
+
class ur extends lr {
|
|
640
655
|
constructor(e) {
|
|
641
656
|
super(e);
|
|
642
657
|
const t = e && e.forceBase64;
|
|
643
|
-
this.supportsBinary =
|
|
658
|
+
this.supportsBinary = dr && !t;
|
|
644
659
|
}
|
|
645
660
|
request(e = {}) {
|
|
646
661
|
return Object.assign(e, { xd: this.xd }, this.opts), new ye(Vi, this.uri(), e);
|
|
@@ -649,23 +664,23 @@ class dr extends cr {
|
|
|
649
664
|
function Vi(s) {
|
|
650
665
|
const e = s.xdomain;
|
|
651
666
|
try {
|
|
652
|
-
if (typeof XMLHttpRequest < "u" && (!e ||
|
|
667
|
+
if (typeof XMLHttpRequest < "u" && (!e || ar))
|
|
653
668
|
return new XMLHttpRequest();
|
|
654
669
|
} catch {
|
|
655
670
|
}
|
|
656
671
|
if (!e)
|
|
657
672
|
try {
|
|
658
|
-
return new
|
|
673
|
+
return new G[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
|
|
659
674
|
} catch {
|
|
660
675
|
}
|
|
661
676
|
}
|
|
662
|
-
const
|
|
663
|
-
class
|
|
677
|
+
const Gi = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
|
|
678
|
+
class hr extends Ss {
|
|
664
679
|
get name() {
|
|
665
680
|
return "websocket";
|
|
666
681
|
}
|
|
667
682
|
doOpen() {
|
|
668
|
-
const e = this.uri(), t = this.opts.protocols, i =
|
|
683
|
+
const e = this.uri(), t = this.opts.protocols, i = Gi ? {} : Wi(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
|
|
669
684
|
this.opts.extraHeaders && (i.headers = this.opts.extraHeaders);
|
|
670
685
|
try {
|
|
671
686
|
this.ws = this.createSocket(e, t, i);
|
|
@@ -691,7 +706,7 @@ class ur extends Is {
|
|
|
691
706
|
this.writable = !1;
|
|
692
707
|
for (let t = 0; t < e.length; t++) {
|
|
693
708
|
const i = e[t], n = t === e.length - 1;
|
|
694
|
-
|
|
709
|
+
ms(i, this.supportsBinary, (r) => {
|
|
695
710
|
try {
|
|
696
711
|
this.doWrite(i, r);
|
|
697
712
|
} catch {
|
|
@@ -716,16 +731,16 @@ class ur extends Is {
|
|
|
716
731
|
return this.opts.timestampRequests && (t[this.opts.timestampParam] = zi()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
|
|
717
732
|
}
|
|
718
733
|
}
|
|
719
|
-
const Et =
|
|
720
|
-
class
|
|
734
|
+
const Et = G.WebSocket || G.MozWebSocket;
|
|
735
|
+
class pr extends hr {
|
|
721
736
|
createSocket(e, t, i) {
|
|
722
|
-
return
|
|
737
|
+
return Gi ? new Et(e, t, i) : t ? new Et(e, t) : new Et(e);
|
|
723
738
|
}
|
|
724
739
|
doWrite(e, t) {
|
|
725
740
|
this.ws.send(t);
|
|
726
741
|
}
|
|
727
742
|
}
|
|
728
|
-
class
|
|
743
|
+
class fr extends Ss {
|
|
729
744
|
get name() {
|
|
730
745
|
return "webtransport";
|
|
731
746
|
}
|
|
@@ -741,7 +756,7 @@ class pr extends Is {
|
|
|
741
756
|
this.onError("webtransport error", e);
|
|
742
757
|
}), this._transport.ready.then(() => {
|
|
743
758
|
this._transport.createBidirectionalStream().then((e) => {
|
|
744
|
-
const t = Qn(Number.MAX_SAFE_INTEGER, this.socket.binaryType), i = e.readable.pipeThrough(t).getReader(), n =
|
|
759
|
+
const t = Qn(Number.MAX_SAFE_INTEGER, this.socket.binaryType), i = e.readable.pipeThrough(t).getReader(), n = Gn();
|
|
745
760
|
n.readable.pipeTo(e.writable), this._writer = n.writable.getWriter();
|
|
746
761
|
const r = () => {
|
|
747
762
|
i.read().then(({ done: a, value: c }) => {
|
|
@@ -771,11 +786,11 @@ class pr extends Is {
|
|
|
771
786
|
(e = this._transport) === null || e === void 0 || e.close();
|
|
772
787
|
}
|
|
773
788
|
}
|
|
774
|
-
const
|
|
775
|
-
websocket:
|
|
776
|
-
webtransport:
|
|
777
|
-
polling:
|
|
778
|
-
},
|
|
789
|
+
const gr = {
|
|
790
|
+
websocket: pr,
|
|
791
|
+
webtransport: fr,
|
|
792
|
+
polling: ur
|
|
793
|
+
}, yr = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, mr = [
|
|
779
794
|
"source",
|
|
780
795
|
"protocol",
|
|
781
796
|
"authority",
|
|
@@ -791,28 +806,28 @@ const fr = {
|
|
|
791
806
|
"query",
|
|
792
807
|
"anchor"
|
|
793
808
|
];
|
|
794
|
-
function
|
|
809
|
+
function Jt(s) {
|
|
795
810
|
if (s.length > 8e3)
|
|
796
811
|
throw "URI too long";
|
|
797
812
|
const e = s, t = s.indexOf("["), i = s.indexOf("]");
|
|
798
813
|
t != -1 && i != -1 && (s = s.substring(0, t) + s.substring(t, i).replace(/:/g, ";") + s.substring(i, s.length));
|
|
799
|
-
let n =
|
|
814
|
+
let n = yr.exec(s || ""), r = {}, o = 14;
|
|
800
815
|
for (; o--; )
|
|
801
|
-
r[
|
|
802
|
-
return t != -1 && i != -1 && (r.source = e, r.host = r.host.substring(1, r.host.length - 1).replace(/;/g, ":"), r.authority = r.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), r.ipv6uri = !0), r.pathNames =
|
|
816
|
+
r[mr[o]] = n[o] || "";
|
|
817
|
+
return t != -1 && i != -1 && (r.source = e, r.host = r.host.substring(1, r.host.length - 1).replace(/;/g, ":"), r.authority = r.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), r.ipv6uri = !0), r.pathNames = Ir(r, r.path), r.queryKey = Sr(r, r.query), r;
|
|
803
818
|
}
|
|
804
|
-
function
|
|
819
|
+
function Ir(s, e) {
|
|
805
820
|
const t = /\/{2,9}/g, i = e.replace(t, "/").split("/");
|
|
806
821
|
return (e.slice(0, 1) == "/" || e.length === 0) && i.splice(0, 1), e.slice(-1) == "/" && i.splice(i.length - 1, 1), i;
|
|
807
822
|
}
|
|
808
|
-
function
|
|
823
|
+
function Sr(s, e) {
|
|
809
824
|
const t = {};
|
|
810
825
|
return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(i, n, r) {
|
|
811
826
|
n && (t[n] = r);
|
|
812
827
|
}), t;
|
|
813
828
|
}
|
|
814
|
-
const
|
|
815
|
-
|
|
829
|
+
const Xt = typeof addEventListener == "function" && typeof removeEventListener == "function", nt = [];
|
|
830
|
+
Xt && addEventListener("offline", () => {
|
|
816
831
|
nt.forEach((s) => s());
|
|
817
832
|
}, !1);
|
|
818
833
|
class re extends C {
|
|
@@ -823,10 +838,10 @@ class re extends C {
|
|
|
823
838
|
* @param {Object} opts - options
|
|
824
839
|
*/
|
|
825
840
|
constructor(e, t) {
|
|
826
|
-
if (super(), this.binaryType =
|
|
827
|
-
const i =
|
|
841
|
+
if (super(), this.binaryType = Xn, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, e && typeof e == "object" && (t = e, e = null), e) {
|
|
842
|
+
const i = Jt(e);
|
|
828
843
|
t.hostname = i.host, t.secure = i.protocol === "https" || i.protocol === "wss", t.port = i.port, i.query && (t.query = i.query);
|
|
829
|
-
} else t.host && (t.hostname =
|
|
844
|
+
} else t.host && (t.hostname = Jt(t.host).host);
|
|
830
845
|
wt(this, t), this.secure = t.secure != null ? t.secure : typeof location < "u" && location.protocol === "https:", t.hostname && !t.port && (t.port = this.secure ? "443" : "80"), this.hostname = t.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = t.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, t.transports.forEach((i) => {
|
|
831
846
|
const n = i.prototype.name;
|
|
832
847
|
this.transports.push(n), this._transportsByName[n] = i;
|
|
@@ -844,7 +859,7 @@ class re extends C {
|
|
|
844
859
|
},
|
|
845
860
|
transportOptions: {},
|
|
846
861
|
closeOnBeforeunload: !1
|
|
847
|
-
}, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query =
|
|
862
|
+
}, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = nr(this.opts.query)), Xt && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
|
|
848
863
|
this.transport && (this.transport.removeAllListeners(), this.transport.close());
|
|
849
864
|
}, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
|
|
850
865
|
this._onClose("transport close", {
|
|
@@ -979,7 +994,7 @@ class re extends C {
|
|
|
979
994
|
let t = 1;
|
|
980
995
|
for (let i = 0; i < this.writeBuffer.length; i++) {
|
|
981
996
|
const n = this.writeBuffer[i].data;
|
|
982
|
-
if (n && (t +=
|
|
997
|
+
if (n && (t += tr(n)), i > 0 && t > this._maxPayload)
|
|
983
998
|
return this.writeBuffer.slice(0, i);
|
|
984
999
|
t += 2;
|
|
985
1000
|
}
|
|
@@ -1077,7 +1092,7 @@ class re extends C {
|
|
|
1077
1092
|
*/
|
|
1078
1093
|
_onClose(e, t) {
|
|
1079
1094
|
if (this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing") {
|
|
1080
|
-
if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(),
|
|
1095
|
+
if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), Xt && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
|
|
1081
1096
|
const i = nt.indexOf(this._offlineEventListener);
|
|
1082
1097
|
i !== -1 && nt.splice(i, 1);
|
|
1083
1098
|
}
|
|
@@ -1086,7 +1101,7 @@ class re extends C {
|
|
|
1086
1101
|
}
|
|
1087
1102
|
}
|
|
1088
1103
|
re.protocol = $i;
|
|
1089
|
-
class
|
|
1104
|
+
class wr extends re {
|
|
1090
1105
|
constructor() {
|
|
1091
1106
|
super(...arguments), this._upgrades = [];
|
|
1092
1107
|
}
|
|
@@ -1158,21 +1173,21 @@ class Sr extends re {
|
|
|
1158
1173
|
return t;
|
|
1159
1174
|
}
|
|
1160
1175
|
}
|
|
1161
|
-
let
|
|
1176
|
+
let br = class extends wr {
|
|
1162
1177
|
constructor(e, t = {}) {
|
|
1163
1178
|
const i = typeof e == "object", n = i ? { ...e } : { ...t };
|
|
1164
|
-
(!n.transports || n.transports && typeof n.transports[0] == "string") && (n.transports = (n.transports || ["polling", "websocket", "webtransport"]).map((r) =>
|
|
1179
|
+
(!n.transports || n.transports && typeof n.transports[0] == "string") && (n.transports = (n.transports || ["polling", "websocket", "webtransport"]).map((r) => gr[r]).filter((r) => !!r)), super(i ? n : e, n);
|
|
1165
1180
|
}
|
|
1166
1181
|
};
|
|
1167
|
-
function
|
|
1182
|
+
function vr(s, e = "", t) {
|
|
1168
1183
|
let i = s;
|
|
1169
|
-
t = t || typeof location < "u" && location, s == null && (s = t.protocol + "//" + t.host), typeof s == "string" && (s.charAt(0) === "/" && (s.charAt(1) === "/" ? s = t.protocol + s : s = t.host + s), /^(https?|wss?):\/\//.test(s) || (typeof t < "u" ? s = t.protocol + "//" + s : s = "https://" + s), i =
|
|
1184
|
+
t = t || typeof location < "u" && location, s == null && (s = t.protocol + "//" + t.host), typeof s == "string" && (s.charAt(0) === "/" && (s.charAt(1) === "/" ? s = t.protocol + s : s = t.host + s), /^(https?|wss?):\/\//.test(s) || (typeof t < "u" ? s = t.protocol + "//" + s : s = "https://" + s), i = Jt(s)), i.port || (/^(http|ws)$/.test(i.protocol) ? i.port = "80" : /^(http|ws)s$/.test(i.protocol) && (i.port = "443")), i.path = i.path || "/";
|
|
1170
1185
|
const r = i.host.indexOf(":") !== -1 ? "[" + i.host + "]" : i.host;
|
|
1171
1186
|
return i.id = i.protocol + "://" + r + ":" + i.port + e, i.href = i.protocol + "://" + r + (t && t.port === i.port ? "" : ":" + i.port), i;
|
|
1172
1187
|
}
|
|
1173
|
-
const
|
|
1174
|
-
function
|
|
1175
|
-
return
|
|
1188
|
+
const Tr = typeof ArrayBuffer == "function", _r = (s) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(s) : s.buffer instanceof ArrayBuffer, Qi = Object.prototype.toString, Rr = typeof Blob == "function" || typeof Blob < "u" && Qi.call(Blob) === "[object BlobConstructor]", Ar = typeof File == "function" || typeof File < "u" && Qi.call(File) === "[object FileConstructor]";
|
|
1189
|
+
function ws(s) {
|
|
1190
|
+
return Tr && (s instanceof ArrayBuffer || _r(s)) || Rr && s instanceof Blob || Ar && s instanceof File;
|
|
1176
1191
|
}
|
|
1177
1192
|
function rt(s, e) {
|
|
1178
1193
|
if (!s || typeof s != "object")
|
|
@@ -1183,7 +1198,7 @@ function rt(s, e) {
|
|
|
1183
1198
|
return !0;
|
|
1184
1199
|
return !1;
|
|
1185
1200
|
}
|
|
1186
|
-
if (
|
|
1201
|
+
if (ws(s))
|
|
1187
1202
|
return !0;
|
|
1188
1203
|
if (s.toJSON && typeof s.toJSON == "function" && arguments.length === 1)
|
|
1189
1204
|
return rt(s.toJSON(), !0);
|
|
@@ -1192,14 +1207,14 @@ function rt(s, e) {
|
|
|
1192
1207
|
return !0;
|
|
1193
1208
|
return !1;
|
|
1194
1209
|
}
|
|
1195
|
-
function
|
|
1210
|
+
function kr(s) {
|
|
1196
1211
|
const e = [], t = s.data, i = s;
|
|
1197
1212
|
return i.data = ot(t, e), i.attachments = e.length, { packet: i, buffers: e };
|
|
1198
1213
|
}
|
|
1199
1214
|
function ot(s, e, t) {
|
|
1200
1215
|
if (!s)
|
|
1201
1216
|
return s;
|
|
1202
|
-
if (
|
|
1217
|
+
if (ws(s)) {
|
|
1203
1218
|
const i = { _placeholder: !0, num: e.length };
|
|
1204
1219
|
return e.push(s), i;
|
|
1205
1220
|
} else if (Array.isArray(s)) {
|
|
@@ -1217,10 +1232,10 @@ function ot(s, e, t) {
|
|
|
1217
1232
|
}
|
|
1218
1233
|
return s;
|
|
1219
1234
|
}
|
|
1220
|
-
function
|
|
1221
|
-
return s.data =
|
|
1235
|
+
function Mr(s, e) {
|
|
1236
|
+
return s.data = Yt(s.data, e), delete s.attachments, s;
|
|
1222
1237
|
}
|
|
1223
|
-
function
|
|
1238
|
+
function Yt(s, e) {
|
|
1224
1239
|
if (!s)
|
|
1225
1240
|
return s;
|
|
1226
1241
|
if (s && s._placeholder === !0) {
|
|
@@ -1229,13 +1244,13 @@ function Xt(s, e) {
|
|
|
1229
1244
|
throw new Error("illegal attachments");
|
|
1230
1245
|
} else if (Array.isArray(s))
|
|
1231
1246
|
for (let t = 0; t < s.length; t++)
|
|
1232
|
-
s[t] =
|
|
1247
|
+
s[t] = Yt(s[t], e);
|
|
1233
1248
|
else if (typeof s == "object")
|
|
1234
1249
|
for (const t in s)
|
|
1235
|
-
Object.prototype.hasOwnProperty.call(s, t) && (s[t] =
|
|
1250
|
+
Object.prototype.hasOwnProperty.call(s, t) && (s[t] = Yt(s[t], e));
|
|
1236
1251
|
return s;
|
|
1237
1252
|
}
|
|
1238
|
-
const
|
|
1253
|
+
const Er = [
|
|
1239
1254
|
"connect",
|
|
1240
1255
|
// used on the client side
|
|
1241
1256
|
"connect_error",
|
|
@@ -1253,7 +1268,7 @@ var T;
|
|
|
1253
1268
|
(function(s) {
|
|
1254
1269
|
s[s.CONNECT = 0] = "CONNECT", s[s.DISCONNECT = 1] = "DISCONNECT", s[s.EVENT = 2] = "EVENT", s[s.ACK = 3] = "ACK", s[s.CONNECT_ERROR = 4] = "CONNECT_ERROR", s[s.BINARY_EVENT = 5] = "BINARY_EVENT", s[s.BINARY_ACK = 6] = "BINARY_ACK";
|
|
1255
1270
|
})(T || (T = {}));
|
|
1256
|
-
class
|
|
1271
|
+
class Cr {
|
|
1257
1272
|
/**
|
|
1258
1273
|
* Encoder constructor
|
|
1259
1274
|
*
|
|
@@ -1289,11 +1304,11 @@ class Er {
|
|
|
1289
1304
|
* a list of buffers.
|
|
1290
1305
|
*/
|
|
1291
1306
|
encodeAsBinary(e) {
|
|
1292
|
-
const t =
|
|
1307
|
+
const t = kr(e), i = this.encodeAsString(t.packet), n = t.buffers;
|
|
1293
1308
|
return n.unshift(i), n;
|
|
1294
1309
|
}
|
|
1295
1310
|
}
|
|
1296
|
-
class
|
|
1311
|
+
class bs extends C {
|
|
1297
1312
|
/**
|
|
1298
1313
|
* Decoder constructor
|
|
1299
1314
|
*/
|
|
@@ -1315,8 +1330,8 @@ class ws extends C {
|
|
|
1315
1330
|
throw new Error("got plaintext data when reconstructing a packet");
|
|
1316
1331
|
t = this.decodeString(e);
|
|
1317
1332
|
const i = t.type === T.BINARY_EVENT;
|
|
1318
|
-
i || t.type === T.BINARY_ACK ? (t.type = i ? T.EVENT : T.ACK, this.reconstructor = new
|
|
1319
|
-
} else if (
|
|
1333
|
+
i || t.type === T.BINARY_ACK ? (t.type = i ? T.EVENT : T.ACK, this.reconstructor = new Pr(t)) : super.emitReserved("decoded", t);
|
|
1334
|
+
} else if (ws(e) || e.base64)
|
|
1320
1335
|
if (this.reconstructor)
|
|
1321
1336
|
t = this.reconstructor.takeBinaryData(e), t && (this.reconstructor = null, super.emitReserved("decoded", t));
|
|
1322
1337
|
else
|
|
@@ -1345,7 +1360,7 @@ class ws extends C {
|
|
|
1345
1360
|
if (o != Number(o) || e.charAt(t) !== "-")
|
|
1346
1361
|
throw new Error("Illegal attachments");
|
|
1347
1362
|
const a = Number(o);
|
|
1348
|
-
if (!
|
|
1363
|
+
if (!Dr(a) || a < 1)
|
|
1349
1364
|
throw new Error("Illegal attachments");
|
|
1350
1365
|
if (a > this.opts.maxAttachments)
|
|
1351
1366
|
throw new Error("too many attachments");
|
|
@@ -1374,7 +1389,7 @@ class ws extends C {
|
|
|
1374
1389
|
}
|
|
1375
1390
|
if (e.charAt(++t)) {
|
|
1376
1391
|
const r = this.tryParse(e.substr(t));
|
|
1377
|
-
if (
|
|
1392
|
+
if (bs.isPayloadValid(i.type, r))
|
|
1378
1393
|
i.data = r;
|
|
1379
1394
|
else
|
|
1380
1395
|
throw new Error("invalid payload");
|
|
@@ -1391,14 +1406,14 @@ class ws extends C {
|
|
|
1391
1406
|
static isPayloadValid(e, t) {
|
|
1392
1407
|
switch (e) {
|
|
1393
1408
|
case T.CONNECT:
|
|
1394
|
-
return
|
|
1409
|
+
return Ns(t);
|
|
1395
1410
|
case T.DISCONNECT:
|
|
1396
1411
|
return t === void 0;
|
|
1397
1412
|
case T.CONNECT_ERROR:
|
|
1398
|
-
return typeof t == "string" ||
|
|
1413
|
+
return typeof t == "string" || Ns(t);
|
|
1399
1414
|
case T.EVENT:
|
|
1400
1415
|
case T.BINARY_EVENT:
|
|
1401
|
-
return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" &&
|
|
1416
|
+
return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && Er.indexOf(t[0]) === -1);
|
|
1402
1417
|
case T.ACK:
|
|
1403
1418
|
case T.BINARY_ACK:
|
|
1404
1419
|
return Array.isArray(t);
|
|
@@ -1411,7 +1426,7 @@ class ws extends C {
|
|
|
1411
1426
|
this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
|
|
1412
1427
|
}
|
|
1413
1428
|
}
|
|
1414
|
-
class
|
|
1429
|
+
class Pr {
|
|
1415
1430
|
constructor(e) {
|
|
1416
1431
|
this.packet = e, this.buffers = [], this.reconPack = e;
|
|
1417
1432
|
}
|
|
@@ -1425,7 +1440,7 @@ class Cr {
|
|
|
1425
1440
|
*/
|
|
1426
1441
|
takeBinaryData(e) {
|
|
1427
1442
|
if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
|
|
1428
|
-
const t =
|
|
1443
|
+
const t = Mr(this.reconPack, this.buffers);
|
|
1429
1444
|
return this.finishedReconstruction(), t;
|
|
1430
1445
|
}
|
|
1431
1446
|
return null;
|
|
@@ -1437,26 +1452,26 @@ class Cr {
|
|
|
1437
1452
|
this.reconPack = null, this.buffers = [];
|
|
1438
1453
|
}
|
|
1439
1454
|
}
|
|
1440
|
-
const
|
|
1455
|
+
const Dr = Number.isInteger || function(s) {
|
|
1441
1456
|
return typeof s == "number" && isFinite(s) && Math.floor(s) === s;
|
|
1442
1457
|
};
|
|
1443
|
-
function
|
|
1458
|
+
function Ns(s) {
|
|
1444
1459
|
return Object.prototype.toString.call(s) === "[object Object]";
|
|
1445
1460
|
}
|
|
1446
|
-
const
|
|
1461
|
+
const Ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1447
1462
|
__proto__: null,
|
|
1448
|
-
Decoder:
|
|
1449
|
-
Encoder:
|
|
1463
|
+
Decoder: bs,
|
|
1464
|
+
Encoder: Cr,
|
|
1450
1465
|
get PacketType() {
|
|
1451
1466
|
return T;
|
|
1452
1467
|
}
|
|
1453
1468
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1454
|
-
function
|
|
1469
|
+
function Q(s, e, t) {
|
|
1455
1470
|
return s.on(e, t), function() {
|
|
1456
1471
|
s.off(e, t);
|
|
1457
1472
|
};
|
|
1458
1473
|
}
|
|
1459
|
-
const
|
|
1474
|
+
const qr = Object.freeze({
|
|
1460
1475
|
connect: 1,
|
|
1461
1476
|
connect_error: 1,
|
|
1462
1477
|
disconnect: 1,
|
|
@@ -1499,10 +1514,10 @@ class Ji extends C {
|
|
|
1499
1514
|
return;
|
|
1500
1515
|
const e = this.io;
|
|
1501
1516
|
this.subs = [
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1517
|
+
Q(e, "open", this.onopen.bind(this)),
|
|
1518
|
+
Q(e, "packet", this.onpacket.bind(this)),
|
|
1519
|
+
Q(e, "error", this.onerror.bind(this)),
|
|
1520
|
+
Q(e, "close", this.onclose.bind(this))
|
|
1506
1521
|
];
|
|
1507
1522
|
}
|
|
1508
1523
|
/**
|
|
@@ -1581,7 +1596,7 @@ class Ji extends C {
|
|
|
1581
1596
|
*/
|
|
1582
1597
|
emit(e, ...t) {
|
|
1583
1598
|
var i, n, r;
|
|
1584
|
-
if (
|
|
1599
|
+
if (qr.hasOwnProperty(e))
|
|
1585
1600
|
throw new Error('"' + e.toString() + '" is a reserved event name');
|
|
1586
1601
|
if (t.unshift(e), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
|
|
1587
1602
|
return this._addToQueue(t), this;
|
|
@@ -2080,7 +2095,7 @@ Se.prototype.setMax = function(s) {
|
|
|
2080
2095
|
Se.prototype.setJitter = function(s) {
|
|
2081
2096
|
this.jitter = s;
|
|
2082
2097
|
};
|
|
2083
|
-
class
|
|
2098
|
+
class Zt extends C {
|
|
2084
2099
|
constructor(e, t) {
|
|
2085
2100
|
var i;
|
|
2086
2101
|
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({
|
|
@@ -2088,7 +2103,7 @@ class Yt extends C {
|
|
|
2088
2103
|
max: this.reconnectionDelayMax(),
|
|
2089
2104
|
jitter: this.randomizationFactor()
|
|
2090
2105
|
}), this.timeout(t.timeout == null ? 2e4 : t.timeout), this._readyState = "closed", this.uri = e;
|
|
2091
|
-
const n = t.parser ||
|
|
2106
|
+
const n = t.parser || Ur;
|
|
2092
2107
|
this.encoder = new n.Encoder(), this.decoder = new n.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
|
|
2093
2108
|
}
|
|
2094
2109
|
reconnection(e) {
|
|
@@ -2131,14 +2146,14 @@ class Yt extends C {
|
|
|
2131
2146
|
open(e) {
|
|
2132
2147
|
if (~this._readyState.indexOf("open"))
|
|
2133
2148
|
return this;
|
|
2134
|
-
this.engine = new
|
|
2149
|
+
this.engine = new br(this.uri, this.opts);
|
|
2135
2150
|
const t = this.engine, i = this;
|
|
2136
2151
|
this._readyState = "opening", this.skipReconnect = !1;
|
|
2137
|
-
const n =
|
|
2152
|
+
const n = Q(t, "open", function() {
|
|
2138
2153
|
i.onopen(), e && e();
|
|
2139
2154
|
}), r = (a) => {
|
|
2140
2155
|
this.cleanup(), this._readyState = "closed", this.emitReserved("error", a), e ? e(a) : this.maybeReconnectOnOpen();
|
|
2141
|
-
}, o =
|
|
2156
|
+
}, o = Q(t, "error", r);
|
|
2142
2157
|
if (this._timeout !== !1) {
|
|
2143
2158
|
const a = this._timeout, c = this.setTimeoutFn(() => {
|
|
2144
2159
|
n(), r(new Error("timeout")), t.close();
|
|
@@ -2167,12 +2182,12 @@ class Yt extends C {
|
|
|
2167
2182
|
this.cleanup(), this._readyState = "open", this.emitReserved("open");
|
|
2168
2183
|
const e = this.engine;
|
|
2169
2184
|
this.subs.push(
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2185
|
+
Q(e, "ping", this.onping.bind(this)),
|
|
2186
|
+
Q(e, "data", this.ondata.bind(this)),
|
|
2187
|
+
Q(e, "error", this.onerror.bind(this)),
|
|
2188
|
+
Q(e, "close", this.onclose.bind(this)),
|
|
2174
2189
|
// @ts-ignore
|
|
2175
|
-
|
|
2190
|
+
Q(this.decoder, "decoded", this.ondecoded.bind(this))
|
|
2176
2191
|
);
|
|
2177
2192
|
}
|
|
2178
2193
|
/**
|
|
@@ -2321,17 +2336,17 @@ class Yt extends C {
|
|
|
2321
2336
|
const ke = {};
|
|
2322
2337
|
function at(s, e) {
|
|
2323
2338
|
typeof s == "object" && (e = s, s = void 0), e = e || {};
|
|
2324
|
-
const t =
|
|
2339
|
+
const t = vr(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
2340
|
let c;
|
|
2326
|
-
return a ? c = new
|
|
2341
|
+
return a ? c = new Zt(i, e) : (ke[n] || (ke[n] = new Zt(i, e)), c = ke[n]), t.query && !e.query && (e.query = t.queryKey), c.socket(t.path, e);
|
|
2327
2342
|
}
|
|
2328
2343
|
Object.assign(at, {
|
|
2329
|
-
Manager:
|
|
2344
|
+
Manager: Zt,
|
|
2330
2345
|
Socket: Ji,
|
|
2331
2346
|
io: at,
|
|
2332
2347
|
connect: at
|
|
2333
2348
|
});
|
|
2334
|
-
const
|
|
2349
|
+
const Or = 45e3, xr = /* @__PURE__ */ new Set([
|
|
2335
2350
|
"chat.user_message",
|
|
2336
2351
|
"chat.retry_last_user_message",
|
|
2337
2352
|
"run.stop",
|
|
@@ -2352,11 +2367,11 @@ class v extends Error {
|
|
|
2352
2367
|
detail;
|
|
2353
2368
|
backendRefusal;
|
|
2354
2369
|
}
|
|
2355
|
-
function
|
|
2370
|
+
function Ls(s, e) {
|
|
2356
2371
|
const t = s.result && typeof s.result == "object" ? s.result : void 0, i = typeof t?.message == "string" && t.message.trim() ? t.message : `${e} (${s.code ?? "request_rejected"})`;
|
|
2357
2372
|
return new v(i, s.code ?? "request_rejected", !1, s.result, !0);
|
|
2358
2373
|
}
|
|
2359
|
-
class
|
|
2374
|
+
class Br {
|
|
2360
2375
|
constructor(e) {
|
|
2361
2376
|
this.options = e, this.socket = at(`${e.backendUrl.replace(/\/$/, "")}/product-agent`, {
|
|
2362
2377
|
path: "/api/product-agent/socket.io",
|
|
@@ -2473,7 +2488,7 @@ class xr {
|
|
|
2473
2488
|
readinessPhase: this.ready ? "bootstrap" : this.admitted ? "activation" : "namespace_ready"
|
|
2474
2489
|
})), e === this.generation && this.recover());
|
|
2475
2490
|
};
|
|
2476
|
-
this.admissionTimer = setTimeout(() => t("connect_timeout"), 15e3), this.readinessTimer = setTimeout(() => t("auth_timeout"),
|
|
2491
|
+
this.admissionTimer = setTimeout(() => t("connect_timeout"), 15e3), this.readinessTimer = setTimeout(() => t("auth_timeout"), Or);
|
|
2477
2492
|
}
|
|
2478
2493
|
clearReadinessTimers() {
|
|
2479
2494
|
this.admissionTimer !== null && clearTimeout(this.admissionTimer), this.readinessTimer !== null && clearTimeout(this.readinessTimer), this.admissionTimer = null, this.readinessTimer = null;
|
|
@@ -2494,7 +2509,7 @@ class xr {
|
|
|
2494
2509
|
this.bindings.get(e)?.owners.delete(t), this.ready && await this.synchronize();
|
|
2495
2510
|
}
|
|
2496
2511
|
async rpc(e, t) {
|
|
2497
|
-
if (!
|
|
2512
|
+
if (!xr.has(e)) throw new v("Operation requires its HTTP adapter", "unsupported_rpc");
|
|
2498
2513
|
const i = this.generation, n = JSON.stringify(t);
|
|
2499
2514
|
return e === "run.stop" && this.uploadingResult ? (this.assertReady(i), this.request("runtime.rpc", { type: e, payload: JSON.parse(n) }, i)) : this.enqueue(async () => {
|
|
2500
2515
|
if (this.assertReady(i), e === "tool.result") {
|
|
@@ -2583,7 +2598,7 @@ class xr {
|
|
|
2583
2598
|
throw new v("Result upload outcome is unknown", "delivery_unknown", !0);
|
|
2584
2599
|
if (h?.request_id !== n || typeof h.ok != "boolean")
|
|
2585
2600
|
throw new v("Invalid result acknowledgement identity", "invalid_ack", !0);
|
|
2586
|
-
if (!h.ok) throw
|
|
2601
|
+
if (!h.ok) throw Ls(h, "Product Agent result rejected");
|
|
2587
2602
|
return h.result;
|
|
2588
2603
|
} catch (l) {
|
|
2589
2604
|
const d = l instanceof v ? l : new v("Result upload outcome is unknown", "delivery_unknown", !0);
|
|
@@ -2600,7 +2615,7 @@ class xr {
|
|
|
2600
2615
|
this.pending.delete(a), o(c);
|
|
2601
2616
|
};
|
|
2602
2617
|
this.pending.add(a), this.socket.timeout(this.options.requestTimeoutMs ?? 15e3).emit(e, { ...t, request_id: n }, (c, l) => {
|
|
2603
|
-
this.pending.delete(a) && (c || i !== this.generation ? o(new v("Delivery outcome is unknown; reconcile without repeating execution", "delivery_unknown", !0)) : l?.request_id !== n || typeof l.ok != "boolean" ? o(new v("Invalid acknowledgement identity", "invalid_ack", !0)) : l.ok ? r(l.result) : o(
|
|
2618
|
+
this.pending.delete(a) && (c || i !== this.generation ? o(new v("Delivery outcome is unknown; reconcile without repeating execution", "delivery_unknown", !0)) : l?.request_id !== n || typeof l.ok != "boolean" ? o(new v("Invalid acknowledgement identity", "invalid_ack", !0)) : l.ok ? r(l.result) : o(Ls(l, "Product Agent request rejected")));
|
|
2604
2619
|
});
|
|
2605
2620
|
}).catch((r) => {
|
|
2606
2621
|
throw this.recoverUncertainDelivery(r, i), r;
|
|
@@ -2659,15 +2674,15 @@ class Xi {
|
|
|
2659
2674
|
}
|
|
2660
2675
|
}
|
|
2661
2676
|
}
|
|
2662
|
-
function
|
|
2677
|
+
function Fe(s) {
|
|
2663
2678
|
if (s !== null && typeof s == "object" && !Object.isFrozen(s)) {
|
|
2664
|
-
for (const e of Object.values(s))
|
|
2679
|
+
for (const e of Object.values(s)) Fe(e);
|
|
2665
2680
|
Object.freeze(s);
|
|
2666
2681
|
}
|
|
2667
2682
|
return s;
|
|
2668
2683
|
}
|
|
2669
2684
|
function Yi() {
|
|
2670
|
-
return
|
|
2685
|
+
return Fe({
|
|
2671
2686
|
authorityId: null,
|
|
2672
2687
|
generation: 0,
|
|
2673
2688
|
entities: {},
|
|
@@ -2691,10 +2706,10 @@ function Yi() {
|
|
|
2691
2706
|
function O(s) {
|
|
2692
2707
|
return JSON.stringify([s.kind, s.origin, s.limit]);
|
|
2693
2708
|
}
|
|
2694
|
-
function
|
|
2709
|
+
function Nr(s) {
|
|
2695
2710
|
return s.find((e) => e.status === "loading_more" || e.status === "loading" || e.status === "refreshing") ?? s.find((e) => e.status === "error") ?? s.find((e) => e.query.kind === "recent") ?? s[0];
|
|
2696
2711
|
}
|
|
2697
|
-
class
|
|
2712
|
+
class es {
|
|
2698
2713
|
constructor(e) {
|
|
2699
2714
|
this.options = e;
|
|
2700
2715
|
}
|
|
@@ -2754,7 +2769,7 @@ class Zt {
|
|
|
2754
2769
|
this.schedule(r, e);
|
|
2755
2770
|
}
|
|
2756
2771
|
}
|
|
2757
|
-
const
|
|
2772
|
+
const Lr = { activeIntervalMs: 3e3, idleIntervalMs: 15e3, maxFailureIntervalMs: 3e4 };
|
|
2758
2773
|
function z(s) {
|
|
2759
2774
|
const e = s.currentAuthority();
|
|
2760
2775
|
return e.authorityId === s.authority.authorityId && e.generation === s.authority.generation;
|
|
@@ -2763,7 +2778,7 @@ function Me(s, e) {
|
|
|
2763
2778
|
if (!z(s) || e.authorityId !== s.authority.authorityId || e.generation !== s.authority.generation)
|
|
2764
2779
|
throw new Error("Directory authority is no longer current.");
|
|
2765
2780
|
}
|
|
2766
|
-
function
|
|
2781
|
+
function qe(s) {
|
|
2767
2782
|
if (s.origin === null) return s;
|
|
2768
2783
|
const e = s.origin.trim();
|
|
2769
2784
|
return { ...s, origin: e.includes("://") ? new URL(e).origin : e.toLowerCase() };
|
|
@@ -2771,7 +2786,7 @@ function Ue(s) {
|
|
|
2771
2786
|
function Zi(s, e) {
|
|
2772
2787
|
return s.request(`/conversations/${encodeURIComponent(e)}`, {}, void 0, "GET", s.auth.client_kind === "extension" ? "extension" : void 0);
|
|
2773
2788
|
}
|
|
2774
|
-
function
|
|
2789
|
+
function Fs(s) {
|
|
2775
2790
|
return new Promise((e, t) => {
|
|
2776
2791
|
let i = null, n = null, r = !1;
|
|
2777
2792
|
const o = () => {
|
|
@@ -2789,13 +2804,13 @@ function Ls(s) {
|
|
|
2789
2804
|
c() || (i = s.runtime.engine.subscribe(c), n = s.runtime.onDispose(a));
|
|
2790
2805
|
});
|
|
2791
2806
|
}
|
|
2792
|
-
function
|
|
2807
|
+
function Fr(s) {
|
|
2793
2808
|
const e = s.http.auth.client_kind === "extension" ? "extension" : void 0, t = /* @__PURE__ */ new Map();
|
|
2794
2809
|
return {
|
|
2795
2810
|
"directory.query": async (i) => {
|
|
2796
2811
|
try {
|
|
2797
2812
|
Me(s, i);
|
|
2798
|
-
const n =
|
|
2813
|
+
const n = qe(i.query), r = { origin: n.origin, pinned: n.kind === "pinned", cursor: i.cursor, limit: n.limit };
|
|
2799
2814
|
let o;
|
|
2800
2815
|
if (s.http.auth.client_kind === "embed") {
|
|
2801
2816
|
const a = await s.http.request("/conversations", { ...r, page_url: n.origin ?? s.pageUrl() });
|
|
@@ -2829,7 +2844,7 @@ function Lr(s) {
|
|
|
2829
2844
|
}
|
|
2830
2845
|
};
|
|
2831
2846
|
}
|
|
2832
|
-
class
|
|
2847
|
+
class jr {
|
|
2833
2848
|
constructor(e) {
|
|
2834
2849
|
this.options = e, this.owner = `directory:${e.authority.authorityId}:${e.authority.generation}`, this.boundary = { authority: e.authority, currentAuthority: () => e.runtime.engine.getState().slices.directory }, this.unsubscribe = e.runtime.engine.subscribe(() => this.reconcile());
|
|
2835
2850
|
}
|
|
@@ -2848,8 +2863,8 @@ class Fr {
|
|
|
2848
2863
|
t && e[i]?.observe || (n.metadata.stop(), n.recovery.transcript.stop(), n.recovery.activity.stop(), this.observations.delete(i), this.options.socket.release(i, this.owner).catch((r) => this.report(r)));
|
|
2849
2864
|
if (t) for (const [i, n] of Object.entries(e)) {
|
|
2850
2865
|
if (!n.observe || this.observations.has(i)) continue;
|
|
2851
|
-
const r = this.options.recovery(i), o = new
|
|
2852
|
-
...
|
|
2866
|
+
const r = this.options.recovery(i), o = new es({
|
|
2867
|
+
...Lr,
|
|
2853
2868
|
isActiveTurn: () => this.options.isActiveTurn(i),
|
|
2854
2869
|
poll: async () => {
|
|
2855
2870
|
try {
|
|
@@ -2880,12 +2895,12 @@ class Fr {
|
|
|
2880
2895
|
}
|
|
2881
2896
|
open(e, t = "replace", i) {
|
|
2882
2897
|
if (this.disposed || !z(this.boundary)) return Promise.resolve();
|
|
2883
|
-
e =
|
|
2898
|
+
e = qe(e);
|
|
2884
2899
|
const n = O(e);
|
|
2885
2900
|
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());
|
|
2886
2901
|
}
|
|
2887
2902
|
requestPage(e, t = "replace", i) {
|
|
2888
|
-
return e =
|
|
2903
|
+
return e = qe(e), this.enqueueQuery(e, () => this.readPage(e, t, i));
|
|
2889
2904
|
}
|
|
2890
2905
|
enqueueQuery(e, t) {
|
|
2891
2906
|
const i = O(e), n = this.queryRequests.get(i), r = (async () => (await n?.catch(() => {
|
|
@@ -2919,7 +2934,7 @@ class Fr {
|
|
|
2919
2934
|
return this.refreshPages(e, e.kind === "pinned", () => this.isObserved(e));
|
|
2920
2935
|
}
|
|
2921
2936
|
refreshPages(e, t, i) {
|
|
2922
|
-
return e =
|
|
2937
|
+
return e = qe(e), this.enqueueQuery(e, async () => {
|
|
2923
2938
|
if (!i() || (await this.readPage(e, "replace"), !t)) return;
|
|
2924
2939
|
let n = this.options.runtime.engine.getState().slices.directory.queries[O(e)]?.cursor ?? null;
|
|
2925
2940
|
for (; n !== null && i(); ) {
|
|
@@ -2946,7 +2961,7 @@ class Fr {
|
|
|
2946
2961
|
}
|
|
2947
2962
|
observedQueryStates() {
|
|
2948
2963
|
const e = this.options.runtime.engine.getState().slices.directory.queries;
|
|
2949
|
-
return this.options.observedQueries().flatMap((t) => e[O(
|
|
2964
|
+
return this.options.observedQueries().flatMap((t) => e[O(qe(t))] ?? []);
|
|
2950
2965
|
}
|
|
2951
2966
|
isObserved(e) {
|
|
2952
2967
|
return !this.disposed && z(this.boundary) && (this.options.enabled?.() ?? !0) && this.observedQueryStates().some((t) => O(t.query) === O(e));
|
|
@@ -2971,7 +2986,7 @@ class Fr {
|
|
|
2971
2986
|
this.unsubscribe(), this.reconcile();
|
|
2972
2987
|
}
|
|
2973
2988
|
}
|
|
2974
|
-
function
|
|
2989
|
+
function Hr(s) {
|
|
2975
2990
|
if (!s || typeof s != "object") return !1;
|
|
2976
2991
|
const e = s;
|
|
2977
2992
|
if (e.version !== 1 || typeof e.authorityId != "string" || typeof e.browserSessionId != "string" || !Array.isArray(e.bindings) || !e.mains || typeof e.mains != "object" || Array.isArray(e.mains)) return !1;
|
|
@@ -2987,8 +3002,8 @@ function jr(s) {
|
|
|
2987
3002
|
if (!e.bindings.some((o) => o.sessionId === n && o.clientScopeId === r)) return !1;
|
|
2988
3003
|
return !0;
|
|
2989
3004
|
}
|
|
2990
|
-
const
|
|
2991
|
-
class
|
|
3005
|
+
const js = /* @__PURE__ */ new WeakMap();
|
|
3006
|
+
class $r {
|
|
2992
3007
|
constructor(e) {
|
|
2993
3008
|
this.options = e;
|
|
2994
3009
|
}
|
|
@@ -3048,17 +3063,17 @@ class Hr {
|
|
|
3048
3063
|
browserSessionId: this.options.persistence.sessionId(),
|
|
3049
3064
|
bindings: Object.entries(e.clients).map(([n, r]) => ({ clientScopeId: n, conversationScopeId: r, ...e.selections[r] })),
|
|
3050
3065
|
mains: Object.fromEntries(Object.entries(e.memberships).flatMap(([n, r]) => r.mainClientScopeId ? [[n, r.mainClientScopeId]] : []))
|
|
3051
|
-
}, i = (
|
|
3066
|
+
}, i = (js.get(this.options.runtime) ?? Promise.resolve()).then(async () => {
|
|
3052
3067
|
this.current() && await this.options.persistence.write(t);
|
|
3053
3068
|
});
|
|
3054
|
-
return
|
|
3069
|
+
return js.set(this.options.runtime, i.catch(() => {
|
|
3055
3070
|
})), i;
|
|
3056
3071
|
}
|
|
3057
3072
|
async restore(e) {
|
|
3058
3073
|
const t = this.state();
|
|
3059
3074
|
if (!this.current() || Object.keys(t.clients).length || Object.keys(t.selections).length) return !1;
|
|
3060
3075
|
const i = await this.options.persistence.read();
|
|
3061
|
-
if (!
|
|
3076
|
+
if (!Hr(i) || i.authorityId !== this.options.authority.authorityId || i.browserSessionId !== this.options.persistence.sessionId()) return !1;
|
|
3062
3077
|
const n = new Set(await this.options.persistence.liveClients());
|
|
3063
3078
|
if (!this.current() || this.state().clients !== t.clients) return !1;
|
|
3064
3079
|
const r = i.bindings.filter((c) => n.has(c.clientScopeId));
|
|
@@ -3080,7 +3095,7 @@ class Hr {
|
|
|
3080
3095
|
return await Promise.all(o.map((c) => this.options.runtime.engine.dispatch(c))), !0;
|
|
3081
3096
|
}
|
|
3082
3097
|
}
|
|
3083
|
-
function
|
|
3098
|
+
function Wr(s, e, t, i = () => crypto.randomUUID()) {
|
|
3084
3099
|
const n = `pluno.productAgent.directory:${encodeURIComponent(t)}:${encodeURIComponent(e)}`, r = `${n}:tabSession`, o = s.getItem(r) ?? i();
|
|
3085
3100
|
return s.setItem(r, o), {
|
|
3086
3101
|
sessionId: () => o,
|
|
@@ -3091,18 +3106,18 @@ function $r(s, e, t, i = () => crypto.randomUUID()) {
|
|
|
3091
3106
|
liveClients: async () => [e]
|
|
3092
3107
|
};
|
|
3093
3108
|
}
|
|
3094
|
-
const
|
|
3095
|
-
function
|
|
3109
|
+
const Hs = /* @__PURE__ */ new Map(), $s = /* @__PURE__ */ new Map();
|
|
3110
|
+
function zr(s, e, t = () => crypto.randomUUID()) {
|
|
3096
3111
|
try {
|
|
3097
|
-
return
|
|
3112
|
+
return Wr(window.sessionStorage, s, e, t);
|
|
3098
3113
|
} catch (i) {
|
|
3099
3114
|
if (!(i instanceof DOMException) || i.name !== "SecurityError" && i.name !== "QuotaExceededError") throw i;
|
|
3100
|
-
const n = `${e}:${s}`, r =
|
|
3101
|
-
return
|
|
3115
|
+
const n = `${e}:${s}`, r = $s.get(n) ?? t();
|
|
3116
|
+
return $s.set(n, r), {
|
|
3102
3117
|
sessionId: () => r,
|
|
3103
|
-
read: async () =>
|
|
3118
|
+
read: async () => Hs.get(n),
|
|
3104
3119
|
write: async (o) => {
|
|
3105
|
-
|
|
3120
|
+
Hs.set(n, o);
|
|
3106
3121
|
},
|
|
3107
3122
|
liveClients: async () => [s]
|
|
3108
3123
|
};
|
|
@@ -3110,7 +3125,7 @@ function Wr(s, e, t = () => crypto.randomUUID()) {
|
|
|
3110
3125
|
}
|
|
3111
3126
|
class N extends EventTarget {
|
|
3112
3127
|
constructor(e) {
|
|
3113
|
-
super(), this.options = e, this.httpTransport = new Xi(e), this.transport = new
|
|
3128
|
+
super(), this.options = e, this.httpTransport = new Xi(e), this.transport = new Br({
|
|
3114
3129
|
backendUrl: e.backendUrl,
|
|
3115
3130
|
auth: e.auth,
|
|
3116
3131
|
bootstrapRequired: !0,
|
|
@@ -3440,15 +3455,15 @@ class N extends EventTarget {
|
|
|
3440
3455
|
}), r;
|
|
3441
3456
|
}
|
|
3442
3457
|
}
|
|
3443
|
-
const
|
|
3458
|
+
const ts = /* @__PURE__ */ new WeakMap(), le = (s) => s === null || typeof s == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(s);
|
|
3444
3459
|
function en(s) {
|
|
3445
3460
|
if (!s || typeof s != "object") return !1;
|
|
3446
3461
|
const e = s;
|
|
3447
3462
|
return typeof e.observedAt == "string" && e.observedAt.length <= 40 && Number.isFinite(Date.parse(e.observedAt)) && le(e.sessionId) && le(e.responseItemId) && le(e.respondsToUserMessageId) && typeof e.panelVisible == "boolean" && typeof e.documentVisible == "boolean" && typeof e.loading == "boolean";
|
|
3448
3463
|
}
|
|
3449
|
-
function
|
|
3464
|
+
function Kr(s, e, t) {
|
|
3450
3465
|
if (!en(t)) return;
|
|
3451
|
-
const i =
|
|
3466
|
+
const i = ts.get(s) ?? /* @__PURE__ */ new Map();
|
|
3452
3467
|
i.set(e, {
|
|
3453
3468
|
observedAt: t.observedAt,
|
|
3454
3469
|
sessionId: t.sessionId,
|
|
@@ -3457,13 +3472,13 @@ function zr(s, e, t) {
|
|
|
3457
3472
|
panelVisible: t.panelVisible,
|
|
3458
3473
|
documentVisible: t.documentVisible,
|
|
3459
3474
|
loading: t.loading
|
|
3460
|
-
}), i.size > 2 && i.delete(i.keys().next().value),
|
|
3475
|
+
}), i.size > 2 && i.delete(i.keys().next().value), ts.set(s, i);
|
|
3461
3476
|
}
|
|
3462
|
-
function
|
|
3463
|
-
const i =
|
|
3477
|
+
function Vr(s, e, t) {
|
|
3478
|
+
const i = ts.get(s)?.get(e);
|
|
3464
3479
|
return i?.sessionId === t ? i : null;
|
|
3465
3480
|
}
|
|
3466
|
-
function
|
|
3481
|
+
function Gr(s, e, t, i, n, r, o, a, c = null, l = !1) {
|
|
3467
3482
|
const d = i ? a.find((h) => h.role === "user" && h.clientMessageId === i) : void 0, u = d ? [...a].reverse().find((h) => h.role === "assistant" && h.respondsToUserMessageId === d.id) : void 0;
|
|
3468
3483
|
return {
|
|
3469
3484
|
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -3473,7 +3488,7 @@ function Vr(s, e, t, i, n, r, o, a, c = null, l = !1) {
|
|
|
3473
3488
|
clientUserMessageItemId: d && le(d.id) ? d.id : null,
|
|
3474
3489
|
clientResponseItemId: u && le(u.id) ? u.id : null,
|
|
3475
3490
|
clientDraftObserved: !!(d && l && c === d.id),
|
|
3476
|
-
renderer:
|
|
3491
|
+
renderer: Vr(s, e, t)
|
|
3477
3492
|
};
|
|
3478
3493
|
}
|
|
3479
3494
|
function tn(s) {
|
|
@@ -3500,20 +3515,20 @@ function Qr(s, e) {
|
|
|
3500
3515
|
updatedAt: t ? s.updatedAt : null
|
|
3501
3516
|
};
|
|
3502
3517
|
}
|
|
3503
|
-
const
|
|
3518
|
+
const Jr = 1e4, Xr = 3e3;
|
|
3504
3519
|
function sn() {
|
|
3505
3520
|
return { authenticated: !1, generation: 0, sequence: 0, displaySequence: 0, backendCount: null, query: tn("activeUsers") };
|
|
3506
3521
|
}
|
|
3507
|
-
function
|
|
3522
|
+
function Yr(s, e) {
|
|
3508
3523
|
if (e.type === "activeUsers.authenticate") {
|
|
3509
3524
|
if (s.authenticated === e.authenticated) return { state: s, effects: [] };
|
|
3510
3525
|
const i = { ...sn(), authenticated: e.authenticated, generation: s.generation + 1 };
|
|
3511
|
-
return e.authenticated ?
|
|
3526
|
+
return e.authenticated ? Ws(i) : { state: i, effects: [] };
|
|
3512
3527
|
}
|
|
3513
3528
|
if (!s.authenticated || !e.effectId.startsWith(`activeUsers:${s.generation}:`)) return { state: s, effects: [] };
|
|
3514
|
-
if (e.effectKind === "activeUsers.wait") return e.type === "effect.completed" ?
|
|
3529
|
+
if (e.effectKind === "activeUsers.wait") return e.type === "effect.completed" ? Ws(s) : { state: s, effects: [] };
|
|
3515
3530
|
if (e.effectKind === "activeUsers.displayWait")
|
|
3516
|
-
return e.type !== "effect.completed" || s.backendCount === null || String(e.effectId) !== `activeUsers:${s.generation}:display:${s.displaySequence}` ? { state: s, effects: [] } :
|
|
3531
|
+
return e.type !== "effect.completed" || s.backendCount === null || String(e.effectId) !== `activeUsers:${s.generation}:display:${s.displaySequence}` ? { state: s, effects: [] } : zs({ ...s, query: { ...s.query, data: Math.max(0, s.backendCount + e.output.offset) } });
|
|
3517
3532
|
if (String(e.effectId) !== s.query.requestId) return { state: s, effects: [] };
|
|
3518
3533
|
if (e.type === "effect.failed") return { state: { ...s, query: { ...s.query, status: "error", error: e.error } }, effects: [] };
|
|
3519
3534
|
const t = { ...s, backendCount: e.output.count, query: {
|
|
@@ -3523,22 +3538,22 @@ function Xr(s, e) {
|
|
|
3523
3538
|
updatedAt: e.output.updatedAt,
|
|
3524
3539
|
error: null
|
|
3525
3540
|
} };
|
|
3526
|
-
return s.backendCount === null ?
|
|
3541
|
+
return s.backendCount === null ? zs(t) : { state: t, effects: [] };
|
|
3527
3542
|
}
|
|
3528
|
-
function
|
|
3529
|
-
const e = s.sequence + 1, t = `activeUsers:${s.generation}:${e}`, i = [{ id: `${t}:wait`, kind: "activeUsers.wait", input: { milliseconds:
|
|
3543
|
+
function Ws(s) {
|
|
3544
|
+
const e = s.sequence + 1, t = `activeUsers:${s.generation}:${e}`, i = [{ id: `${t}:wait`, kind: "activeUsers.wait", input: { milliseconds: Jr } }];
|
|
3530
3545
|
return s.query.status === "loading" || s.query.status === "refreshing" ? { state: { ...s, sequence: e }, effects: i } : (i.push({ id: `${t}:load`, kind: "activeUsers.load", input: { generation: s.generation } }), { state: { ...s, sequence: e, query: { ...s.query, requestId: `${t}:load`, status: s.query.data === null ? "loading" : "refreshing", error: null } }, effects: i });
|
|
3531
3546
|
}
|
|
3532
|
-
function
|
|
3547
|
+
function zs(s) {
|
|
3533
3548
|
const e = s.displaySequence + 1;
|
|
3534
3549
|
return { state: { ...s, displaySequence: e }, effects: [{
|
|
3535
3550
|
id: `activeUsers:${s.generation}:display:${e}`,
|
|
3536
3551
|
kind: "activeUsers.displayWait",
|
|
3537
|
-
input: { milliseconds:
|
|
3552
|
+
input: { milliseconds: Xr }
|
|
3538
3553
|
}] };
|
|
3539
3554
|
}
|
|
3540
|
-
const
|
|
3541
|
-
function
|
|
3555
|
+
const Zr = () => Object.freeze({ scopes: Object.freeze({}) }), nn = (s) => s.selectedModel ?? s.historyModel ?? s.defaultModel, eo = (s, e) => s.scopes[e];
|
|
3556
|
+
function to(s, e) {
|
|
3542
3557
|
const t = s.scopes[e.clientScopeId];
|
|
3543
3558
|
let i;
|
|
3544
3559
|
if (e.type === "model.scope_close") {
|
|
@@ -3616,7 +3631,7 @@ function eo(s, e) {
|
|
|
3616
3631
|
})
|
|
3617
3632
|
});
|
|
3618
3633
|
}
|
|
3619
|
-
function
|
|
3634
|
+
function Ks(s, e, t) {
|
|
3620
3635
|
const i = s.clients[e];
|
|
3621
3636
|
if (!i) return s;
|
|
3622
3637
|
const n = s.selections[i].sessionId, r = { ...s.clients };
|
|
@@ -3634,7 +3649,7 @@ function zs(s, e, t) {
|
|
|
3634
3649
|
}
|
|
3635
3650
|
return { ...s, clients: r, memberships: o, membershipRevision: s.membershipRevision + 1 };
|
|
3636
3651
|
}
|
|
3637
|
-
function
|
|
3652
|
+
function Vs(s, e, t, i) {
|
|
3638
3653
|
let n = s.memberships;
|
|
3639
3654
|
if (i.sessionId !== null) {
|
|
3640
3655
|
const r = n[i.sessionId], o = r?.members ?? [];
|
|
@@ -3651,7 +3666,7 @@ function Ks(s, e, t, i) {
|
|
|
3651
3666
|
membershipRevision: s.membershipRevision + 1
|
|
3652
3667
|
};
|
|
3653
3668
|
}
|
|
3654
|
-
function
|
|
3669
|
+
function so(s, e) {
|
|
3655
3670
|
switch (e.type) {
|
|
3656
3671
|
case "directory.bind":
|
|
3657
3672
|
case "directory.provisional": {
|
|
@@ -3663,16 +3678,16 @@ function to(s, e) {
|
|
|
3663
3678
|
const n = s.clients[e.clientScopeId];
|
|
3664
3679
|
if (n === e.conversationScopeId) return s;
|
|
3665
3680
|
const r = s.selections[n];
|
|
3666
|
-
if (e.type === "directory.bind" && e.reason === "tool" && !
|
|
3681
|
+
if (e.type === "directory.bind" && e.reason === "tool" && !io(s, e.clientScopeId, e.sessionId))
|
|
3667
3682
|
throw new Error("Tool target is already bound to another conversation.");
|
|
3668
3683
|
return r && r.sessionId !== null && r.sessionId === t.sessionId ? {
|
|
3669
3684
|
...s,
|
|
3670
3685
|
clients: { ...s.clients, [e.clientScopeId]: e.conversationScopeId },
|
|
3671
3686
|
selections: { ...s.selections, [e.conversationScopeId]: t }
|
|
3672
|
-
} : Ks(
|
|
3687
|
+
} : Vs(Ks(s, e.clientScopeId, e.replacement), e.clientScopeId, e.conversationScopeId, t);
|
|
3673
3688
|
}
|
|
3674
3689
|
case "directory.detach":
|
|
3675
|
-
return
|
|
3690
|
+
return Ks(s, e.clientScopeId, e.replacement);
|
|
3676
3691
|
case "directory.accepted": {
|
|
3677
3692
|
const t = s.selections[e.conversationScopeId];
|
|
3678
3693
|
if (!t || t.provisionalId !== e.provisionalId) return s;
|
|
@@ -3684,7 +3699,7 @@ function to(s, e) {
|
|
|
3684
3699
|
if (i.length === 0) return s;
|
|
3685
3700
|
let n = s;
|
|
3686
3701
|
for (const [r] of i)
|
|
3687
|
-
n =
|
|
3702
|
+
n = Vs(n, r, e.conversationScopeId, { ...t, sessionId: e.sessionId });
|
|
3688
3703
|
return n;
|
|
3689
3704
|
}
|
|
3690
3705
|
case "directory.view_attach":
|
|
@@ -3698,11 +3713,11 @@ function to(s, e) {
|
|
|
3698
3713
|
return s;
|
|
3699
3714
|
}
|
|
3700
3715
|
}
|
|
3701
|
-
function
|
|
3716
|
+
function io(s, e, t) {
|
|
3702
3717
|
const i = s.clients[e];
|
|
3703
3718
|
return i === void 0 || s.selections[i].sessionId === t;
|
|
3704
3719
|
}
|
|
3705
|
-
function
|
|
3720
|
+
function ss(s) {
|
|
3706
3721
|
return {
|
|
3707
3722
|
...s,
|
|
3708
3723
|
metadataRevision: s.metadataRevision + 1,
|
|
@@ -3715,9 +3730,9 @@ function Ct(s, e, t) {
|
|
|
3715
3730
|
const i = s.entities[e.conversation_id];
|
|
3716
3731
|
if (i && i.version >= e.version) return s;
|
|
3717
3732
|
const n = { ...e, conversation: { ...e.conversation } }, r = { ...s, entities: { ...s.entities, [e.conversation_id]: n } };
|
|
3718
|
-
return t ?
|
|
3733
|
+
return t ? ss(r) : r;
|
|
3719
3734
|
}
|
|
3720
|
-
function
|
|
3735
|
+
function no(s, e) {
|
|
3721
3736
|
let t = s;
|
|
3722
3737
|
const i = [];
|
|
3723
3738
|
if (e.type === "directory.authority_replace") {
|
|
@@ -3729,7 +3744,7 @@ function io(s, e) {
|
|
|
3729
3744
|
const r = { ...s.requests };
|
|
3730
3745
|
if (delete r[e.effectId], t = { ...s, requests: r }, n.kind === "directory.query") {
|
|
3731
3746
|
const o = O(n.input.query), a = s.queries[o];
|
|
3732
|
-
if (a.requestId !== n.input.requestId) return { state:
|
|
3747
|
+
if (a.requestId !== n.input.requestId) return { state: Fe(t), effects: i };
|
|
3733
3748
|
if (e.type === "effect.failed")
|
|
3734
3749
|
t = { ...t, queries: { ...t.queries, [o]: { ...a, status: "error", error: { ...e.error }, requestId: null } } };
|
|
3735
3750
|
else if (e.effectKind === "directory.query") {
|
|
@@ -3775,7 +3790,7 @@ function io(s, e) {
|
|
|
3775
3790
|
if (e.type === "directory.metadata_received")
|
|
3776
3791
|
t = Ct(s, e.metadata, !0);
|
|
3777
3792
|
else if (e.type === "directory.invalidate")
|
|
3778
|
-
t =
|
|
3793
|
+
t = ss(s);
|
|
3779
3794
|
else if (e.type === "directory.optimistic_upsert")
|
|
3780
3795
|
t = { ...s, optimisticEntries: {
|
|
3781
3796
|
...s.optimisticEntries,
|
|
@@ -3840,15 +3855,15 @@ function io(s, e) {
|
|
|
3840
3855
|
const d = a[l];
|
|
3841
3856
|
d !== void 0 && (c[l] = { requestId: e.requestId, value: d, status: "pending", error: null });
|
|
3842
3857
|
}
|
|
3843
|
-
t =
|
|
3858
|
+
t = ss({ ...s, mutations: { ...s.mutations, [e.sessionId]: c } });
|
|
3844
3859
|
}
|
|
3845
3860
|
t = { ...t, requestSequence: s.requestSequence + 1, requests: { ...t.requests, [n]: o } }, i.push({ id: n, ...o });
|
|
3846
3861
|
} else
|
|
3847
|
-
t =
|
|
3862
|
+
t = so(s, e);
|
|
3848
3863
|
}
|
|
3849
|
-
return { state:
|
|
3864
|
+
return { state: Fe(t), effects: i };
|
|
3850
3865
|
}
|
|
3851
|
-
function
|
|
3866
|
+
function ro(s) {
|
|
3852
3867
|
const e = { ...s.entities };
|
|
3853
3868
|
for (const [o, a] of Object.entries(s.mutations)) {
|
|
3854
3869
|
if (!e[o]) continue;
|
|
@@ -3861,7 +3876,7 @@ function no(s) {
|
|
|
3861
3876
|
activityRevision: n,
|
|
3862
3877
|
...r
|
|
3863
3878
|
} = s;
|
|
3864
|
-
return
|
|
3879
|
+
return Fe({
|
|
3865
3880
|
...r,
|
|
3866
3881
|
entities: e,
|
|
3867
3882
|
activityBySessionId: { ...t, ...s.activityBySessionId },
|
|
@@ -3877,7 +3892,7 @@ function no(s) {
|
|
|
3877
3892
|
]))
|
|
3878
3893
|
});
|
|
3879
3894
|
}
|
|
3880
|
-
class
|
|
3895
|
+
class oo {
|
|
3881
3896
|
constructor(e, t, i) {
|
|
3882
3897
|
this.handlers = e, this.accept = t, this.errorAdapter = i;
|
|
3883
3898
|
}
|
|
@@ -3916,7 +3931,7 @@ class ro {
|
|
|
3916
3931
|
);
|
|
3917
3932
|
}
|
|
3918
3933
|
}
|
|
3919
|
-
class
|
|
3934
|
+
class ao {
|
|
3920
3935
|
state;
|
|
3921
3936
|
reducer;
|
|
3922
3937
|
selector;
|
|
@@ -3926,7 +3941,7 @@ class oo {
|
|
|
3926
3941
|
draining = !1;
|
|
3927
3942
|
disposed = !1;
|
|
3928
3943
|
constructor(e) {
|
|
3929
|
-
this.state = e.initialState, this.reducer = e.reducer, this.selector = e.selector, this.effectRunner = new
|
|
3944
|
+
this.state = e.initialState, this.reducer = e.reducer, this.selector = e.selector, this.effectRunner = new oo(
|
|
3930
3945
|
e.effectHandlers,
|
|
3931
3946
|
(t) => this.acceptEffectResult(t),
|
|
3932
3947
|
e.errorAdapter
|
|
@@ -3988,16 +4003,16 @@ class oo {
|
|
|
3988
4003
|
for (const t of this.listeners) t(e);
|
|
3989
4004
|
}
|
|
3990
4005
|
}
|
|
3991
|
-
function
|
|
4006
|
+
function is(s) {
|
|
3992
4007
|
if (s === null || typeof s == "string" || typeof s == "boolean") return !0;
|
|
3993
4008
|
if (typeof s == "number") return Number.isFinite(s);
|
|
3994
|
-
if (Array.isArray(s)) return s.every(
|
|
4009
|
+
if (Array.isArray(s)) return s.every(is);
|
|
3995
4010
|
if (typeof s != "object") return !1;
|
|
3996
4011
|
const e = Object.getPrototypeOf(s);
|
|
3997
|
-
return e !== Object.prototype && e !== null ? !1 : Object.values(s).every(
|
|
4012
|
+
return e !== Object.prototype && e !== null ? !1 : Object.values(s).every(is);
|
|
3998
4013
|
}
|
|
3999
|
-
function
|
|
4000
|
-
if (s.details !== void 0 && !
|
|
4014
|
+
function co(s) {
|
|
4015
|
+
if (s.details !== void 0 && !is(s.details))
|
|
4001
4016
|
throw new TypeError("Product Agent transported error details must be JSON-safe.");
|
|
4002
4017
|
return {
|
|
4003
4018
|
code: s.code,
|
|
@@ -4006,7 +4021,7 @@ function ao(s) {
|
|
|
4006
4021
|
...s.details === void 0 ? {} : { details: s.details }
|
|
4007
4022
|
};
|
|
4008
4023
|
}
|
|
4009
|
-
const
|
|
4024
|
+
const lo = Object.freeze({
|
|
4010
4025
|
modelSelection: "core",
|
|
4011
4026
|
directory: "core",
|
|
4012
4027
|
activeUsers: "core",
|
|
@@ -4015,12 +4030,12 @@ const co = Object.freeze({
|
|
|
4015
4030
|
interactions: "legacy",
|
|
4016
4031
|
browserExecution: "legacy"
|
|
4017
4032
|
});
|
|
4018
|
-
function
|
|
4019
|
-
const t =
|
|
4033
|
+
function Gs(s, e) {
|
|
4034
|
+
const t = lo[s], i = e[t];
|
|
4020
4035
|
if (!i) throw new Error(`No ${t} implementation for ${s}.`);
|
|
4021
4036
|
return i();
|
|
4022
4037
|
}
|
|
4023
|
-
const
|
|
4038
|
+
const uo = {
|
|
4024
4039
|
"directory.query": async () => {
|
|
4025
4040
|
throw new Error("Directory ports are not installed before S5-C.");
|
|
4026
4041
|
},
|
|
@@ -4028,36 +4043,36 @@ const lo = {
|
|
|
4028
4043
|
throw new Error("Directory ports are not installed before S5-C.");
|
|
4029
4044
|
}
|
|
4030
4045
|
};
|
|
4031
|
-
class
|
|
4046
|
+
class ho {
|
|
4032
4047
|
engine;
|
|
4033
4048
|
disposeListeners = /* @__PURE__ */ new Set();
|
|
4034
|
-
constructor(e =
|
|
4035
|
-
this.engine = new
|
|
4049
|
+
constructor(e = uo, t) {
|
|
4050
|
+
this.engine = new ao({
|
|
4036
4051
|
initialState: Object.freeze({ revision: 0, slices: Object.freeze({
|
|
4037
|
-
modelSelection:
|
|
4052
|
+
modelSelection: Zr(),
|
|
4038
4053
|
directory: Yi(),
|
|
4039
4054
|
activeUsers: sn()
|
|
4040
4055
|
}) }),
|
|
4041
4056
|
reducer: (i, n) => {
|
|
4042
4057
|
const r = n.value;
|
|
4043
4058
|
if (r.type.startsWith("activeUsers.") || (r.type === "effect.completed" || r.type === "effect.failed") && r.effectKind.startsWith("activeUsers.")) {
|
|
4044
|
-
const a =
|
|
4059
|
+
const a = Yr(i.slices.activeUsers, r);
|
|
4045
4060
|
return { state: a.state === i.slices.activeUsers ? i : Object.freeze({ revision: i.revision + 1, slices: Object.freeze({ ...i.slices, activeUsers: a.state }) }), effects: a.effects };
|
|
4046
4061
|
}
|
|
4047
4062
|
if (r.type.startsWith("directory.") || r.type === "effect.completed" || r.type === "effect.failed") {
|
|
4048
|
-
const a =
|
|
4063
|
+
const a = no(i.slices.directory, r);
|
|
4049
4064
|
return { state: a.state === i.slices.directory ? i : Object.freeze({
|
|
4050
4065
|
revision: i.revision + 1,
|
|
4051
4066
|
slices: Object.freeze({ ...i.slices, directory: a.state })
|
|
4052
4067
|
}), effects: a.effects };
|
|
4053
4068
|
}
|
|
4054
|
-
const o =
|
|
4069
|
+
const o = to(i.slices.modelSelection, r);
|
|
4055
4070
|
return { state: o === i.slices.modelSelection ? i : Object.freeze({
|
|
4056
4071
|
revision: i.revision + 1,
|
|
4057
4072
|
slices: Object.freeze({ ...i.slices, modelSelection: o })
|
|
4058
4073
|
}), effects: [] };
|
|
4059
4074
|
},
|
|
4060
|
-
selector: (i) => Object.freeze({ ...i.slices, directory:
|
|
4075
|
+
selector: (i) => Object.freeze({ ...i.slices, directory: ro(i.slices.directory) }),
|
|
4061
4076
|
effectHandlers: {
|
|
4062
4077
|
...e,
|
|
4063
4078
|
...t,
|
|
@@ -4071,7 +4086,7 @@ class uo {
|
|
|
4071
4086
|
throw new Error("Active users timer not installed");
|
|
4072
4087
|
})
|
|
4073
4088
|
},
|
|
4074
|
-
errorAdapter: (i) =>
|
|
4089
|
+
errorAdapter: (i) => co({
|
|
4075
4090
|
code: "runtime_error",
|
|
4076
4091
|
message: i instanceof Error ? i.message : String(i),
|
|
4077
4092
|
retryable: !1
|
|
@@ -4084,10 +4099,10 @@ class uo {
|
|
|
4084
4099
|
}
|
|
4085
4100
|
route(e, t) {
|
|
4086
4101
|
if (this.disposed) throw new Error("Product Agent runtime is disposed.");
|
|
4087
|
-
return
|
|
4102
|
+
return Gs(e, t);
|
|
4088
4103
|
}
|
|
4089
4104
|
project(e, t) {
|
|
4090
|
-
return
|
|
4105
|
+
return Gs(e, t);
|
|
4091
4106
|
}
|
|
4092
4107
|
onDispose(e) {
|
|
4093
4108
|
return this.disposed ? (e(), () => {
|
|
@@ -4106,15 +4121,15 @@ function rn(s) {
|
|
|
4106
4121
|
const e = s.replace(/\n\s*at\s[\s\S]*$/, "").replace(/-----BEGIN [^-]*PRIVATE KEY-----[\s\S]*?(?:-----END [^-]*PRIVATE KEY-----|$)/g, "[REDACTED]").replace(/\b(?:set-cookie|cookie)\s*[:=]\s*[^\n]+/gi, "cookie=[REDACTED]").replace(/\bdata:[^\s<>"']+/gi, "[DATA]").replace(/\b(?:https?:\/\/|www\.)[^\s<>"']+/gi, "[URL]").replace(/\b(?:Bearer|Basic)\s+[^\s,;"']+/gi, "[REDACTED]").replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?/g, "[REDACTED]").replace(/\b(?:sk|pk|ghp|gho|github_pat|xoxb|xoxp)[-_][A-Za-z0-9_-]{8,}/g, "[REDACTED]").replace(/\b((?:access|refresh|id|auth)[_-]?token|api[_-]?key|client[_-]?secret|password|passwd|pwd|secret|token|jwt|authorization|cookie|set-cookie)\b["']?\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s,;}&]+)/gi, "$1=[REDACTED]").replace(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/gi, "[EMAIL]").replace(/(?:[A-Z]:[\\/]|\\\\|(?:~|\.\.?)?\/|[\w.-]+[\\/])[^\s<>"']+/gi, "[FILE]").replace(new RegExp("(?<![\\w.])(?:[\\w.-]+\\.[A-Z][A-Z0-9]{0,15}|\\.[A-Z][\\w.-]*)\\b", "gi"), "[FILE]").replace(/\s+/g, " ").trim();
|
|
4107
4122
|
return e.length > Qs ? `${e.slice(0, Qs - 1)}…` : e;
|
|
4108
4123
|
}
|
|
4109
|
-
const
|
|
4110
|
-
async function
|
|
4111
|
-
const e = await
|
|
4112
|
-
await
|
|
4124
|
+
const po = "pluno-product-agent-attachments", fo = 1, ns = "files", go = 1440 * 60 * 1e3;
|
|
4125
|
+
async function yo(s) {
|
|
4126
|
+
const e = await vs();
|
|
4127
|
+
await So(e, "readwrite", (t) => t.put(s));
|
|
4113
4128
|
}
|
|
4114
|
-
async function
|
|
4115
|
-
const t = await
|
|
4116
|
-
await
|
|
4117
|
-
const n = await
|
|
4129
|
+
async function mo(s, e) {
|
|
4130
|
+
const t = await vs();
|
|
4131
|
+
await Ts(t, "readwrite", async (i) => {
|
|
4132
|
+
const n = await _s(
|
|
4118
4133
|
i.get(s)
|
|
4119
4134
|
);
|
|
4120
4135
|
n && i.put({
|
|
@@ -4123,28 +4138,28 @@ async function yo(s, e) {
|
|
|
4123
4138
|
});
|
|
4124
4139
|
});
|
|
4125
4140
|
}
|
|
4126
|
-
async function
|
|
4127
|
-
const e = await
|
|
4128
|
-
await
|
|
4141
|
+
async function Io(s = go) {
|
|
4142
|
+
const e = await vs(), t = Date.now() - s;
|
|
4143
|
+
await Ts(e, "readwrite", async (i) => {
|
|
4129
4144
|
const n = i.index("lastUsedAt");
|
|
4130
|
-
(await
|
|
4145
|
+
(await _s(n.getAllKeys(IDBKeyRange.upperBound(t)))).forEach((o) => i.delete(o));
|
|
4131
4146
|
});
|
|
4132
4147
|
}
|
|
4133
|
-
function
|
|
4148
|
+
function vs() {
|
|
4134
4149
|
return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((s, e) => {
|
|
4135
|
-
const t = indexedDB.open(
|
|
4150
|
+
const t = indexedDB.open(po, fo);
|
|
4136
4151
|
t.onupgradeneeded = () => {
|
|
4137
|
-
const n = t.result.createObjectStore(
|
|
4152
|
+
const n = t.result.createObjectStore(ns, { keyPath: "attachmentId" });
|
|
4138
4153
|
n.createIndex("lastUsedAt", "lastUsedAt", { unique: !1 }), n.createIndex("sessionId", "sessionId", { unique: !1 }), n.createIndex("origin", "origin", { unique: !1 });
|
|
4139
4154
|
}, t.onsuccess = () => s(t.result), t.onerror = () => e(t.error ?? new Error("Failed to open Product Agent attachment storage"));
|
|
4140
4155
|
});
|
|
4141
4156
|
}
|
|
4142
|
-
async function
|
|
4143
|
-
return await
|
|
4157
|
+
async function So(s, e, t) {
|
|
4158
|
+
return await Ts(s, e, async (i) => await _s(t(i)));
|
|
4144
4159
|
}
|
|
4145
|
-
function
|
|
4160
|
+
function Ts(s, e, t) {
|
|
4146
4161
|
return new Promise((i, n) => {
|
|
4147
|
-
const r = s.transaction(
|
|
4162
|
+
const r = s.transaction(ns, e), o = r.objectStore(ns);
|
|
4148
4163
|
let a, c = !1;
|
|
4149
4164
|
t(o).then((l) => {
|
|
4150
4165
|
a = l;
|
|
@@ -4164,16 +4179,16 @@ function vs(s, e, t) {
|
|
|
4164
4179
|
};
|
|
4165
4180
|
});
|
|
4166
4181
|
}
|
|
4167
|
-
function
|
|
4182
|
+
function _s(s) {
|
|
4168
4183
|
return new Promise((e, t) => {
|
|
4169
4184
|
s.onsuccess = () => e(s.result), s.onerror = () => t(s.error ?? new Error("Product Agent attachment storage request failed"));
|
|
4170
4185
|
});
|
|
4171
4186
|
}
|
|
4172
|
-
function
|
|
4187
|
+
function wo(s) {
|
|
4173
4188
|
return s !== null && (typeof s == "object" || typeof s == "function");
|
|
4174
4189
|
}
|
|
4175
4190
|
function on(s, e, t) {
|
|
4176
|
-
const i = Reflect.get(s, "pluno"), n =
|
|
4191
|
+
const i = Reflect.get(s, "pluno"), n = wo(i) ? i : {};
|
|
4177
4192
|
if (n !== i && !Reflect.set(s, "pluno", n))
|
|
4178
4193
|
return null;
|
|
4179
4194
|
const r = Object.getOwnPropertyDescriptor(n, e);
|
|
@@ -4187,25 +4202,25 @@ function on(s, e, t) {
|
|
|
4187
4202
|
}
|
|
4188
4203
|
};
|
|
4189
4204
|
}
|
|
4190
|
-
const
|
|
4191
|
-
function
|
|
4205
|
+
const bo = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
|
|
4206
|
+
function Js(s, e) {
|
|
4192
4207
|
return e ? s.replace(
|
|
4193
|
-
|
|
4208
|
+
bo,
|
|
4194
4209
|
(t, i, n, r) => `${i}${new URL(n, e).toString()}${r}`
|
|
4195
4210
|
) : s;
|
|
4196
4211
|
}
|
|
4197
|
-
const
|
|
4198
|
-
function
|
|
4212
|
+
const Rs = "suggest_share_on_socials";
|
|
4213
|
+
function vo(s) {
|
|
4199
4214
|
for (let e = s.length - 1; e >= 0; e -= 1) {
|
|
4200
4215
|
const t = s[e];
|
|
4201
|
-
if (t.role !== "tool" || t.toolName !==
|
|
4216
|
+
if (t.role !== "tool" || t.toolName !== Rs || t.sharePromptAllowed !== void 0)
|
|
4202
4217
|
continue;
|
|
4203
|
-
if (
|
|
4218
|
+
if (_o(s, e, t.callId) !== !0)
|
|
4204
4219
|
return null;
|
|
4205
|
-
const i =
|
|
4220
|
+
const i = Xs(s, e, "assistant");
|
|
4206
4221
|
if (!i)
|
|
4207
4222
|
return null;
|
|
4208
|
-
const n =
|
|
4223
|
+
const n = Xs(s, i.index, "user");
|
|
4209
4224
|
return n ? {
|
|
4210
4225
|
id: `share:${t.callId ?? t.id}`,
|
|
4211
4226
|
userPrompt: n.content,
|
|
@@ -4214,7 +4229,7 @@ function bo(s) {
|
|
|
4214
4229
|
}
|
|
4215
4230
|
return null;
|
|
4216
4231
|
}
|
|
4217
|
-
function
|
|
4232
|
+
function To(s) {
|
|
4218
4233
|
let e = s;
|
|
4219
4234
|
if (typeof s == "string")
|
|
4220
4235
|
try {
|
|
@@ -4222,10 +4237,10 @@ function vo(s) {
|
|
|
4222
4237
|
} catch {
|
|
4223
4238
|
return null;
|
|
4224
4239
|
}
|
|
4225
|
-
const t =
|
|
4240
|
+
const t = Ro(e);
|
|
4226
4241
|
return t ? typeof t.showSharePrompt == "boolean" ? t.showSharePrompt : t.ok === !0 && typeof t.message == "string" && t.message.includes("social-sharing prompt") ? !0 : null : null;
|
|
4227
4242
|
}
|
|
4228
|
-
function
|
|
4243
|
+
function _o(s, e, t) {
|
|
4229
4244
|
if (!t)
|
|
4230
4245
|
return null;
|
|
4231
4246
|
for (let i = e + 1; i < s.length; i += 1) {
|
|
@@ -4235,7 +4250,7 @@ function To(s, e, t) {
|
|
|
4235
4250
|
}
|
|
4236
4251
|
return null;
|
|
4237
4252
|
}
|
|
4238
|
-
function
|
|
4253
|
+
function Xs(s, e, t) {
|
|
4239
4254
|
for (let i = e - 1; i >= 0; i -= 1) {
|
|
4240
4255
|
const n = s[i];
|
|
4241
4256
|
if (n.role === t && n.content.trim())
|
|
@@ -4243,14 +4258,14 @@ function Js(s, e, t) {
|
|
|
4243
4258
|
}
|
|
4244
4259
|
return null;
|
|
4245
4260
|
}
|
|
4246
|
-
function
|
|
4261
|
+
function Ro(s) {
|
|
4247
4262
|
return s && typeof s == "object" && !Array.isArray(s) ? s : null;
|
|
4248
4263
|
}
|
|
4249
|
-
const
|
|
4250
|
-
function
|
|
4251
|
-
return (s.type === "function_call" || s.type === "tool_call") && s.name ===
|
|
4264
|
+
const Ao = "save_runtime_captured_skill";
|
|
4265
|
+
function ko(s) {
|
|
4266
|
+
return (s.type === "function_call" || s.type === "tool_call") && s.name === Ao;
|
|
4252
4267
|
}
|
|
4253
|
-
function
|
|
4268
|
+
function Mo(s, e, t) {
|
|
4254
4269
|
const i = e.map((y) => ({ item: y, identity: t(y) })), n = new Set(
|
|
4255
4270
|
i.flatMap(
|
|
4256
4271
|
({ identity: y }) => y.isActivity && !y.isTransient ? y.activityKeys ?? [] : []
|
|
@@ -4298,16 +4313,16 @@ function ko(s, e, t) {
|
|
|
4298
4313
|
}
|
|
4299
4314
|
return w;
|
|
4300
4315
|
}
|
|
4301
|
-
function
|
|
4316
|
+
function Ys(s, e, t, i) {
|
|
4302
4317
|
return s.filter((n) => {
|
|
4303
4318
|
const r = i(n);
|
|
4304
4319
|
return !r.isActivity || !r.isTransient ? !0 : e !== null && r.respondsToUserMessageId !== void 0 ? r.respondsToUserMessageId !== e : t === null || r.runId !== t;
|
|
4305
4320
|
});
|
|
4306
4321
|
}
|
|
4307
|
-
const Pt = "pluno.productAgent.transportId",
|
|
4322
|
+
const Pt = "pluno.productAgent.transportId", Eo = "pluno.productAgent.transportIdentity", Dt = "pluno.productAgent.transportIdentity.event", Co = 50, Po = globalThis.setTimeout.bind(globalThis);
|
|
4308
4323
|
let Ee = null;
|
|
4309
4324
|
const ct = /* @__PURE__ */ new Set(), Ut = /* @__PURE__ */ new Map();
|
|
4310
|
-
async function
|
|
4325
|
+
async function Do(s = an()) {
|
|
4311
4326
|
const e = s.randomUUID(), t = s.storage.getItem(Pt);
|
|
4312
4327
|
let i = t ?? s.randomUUID(), n = !1, r = !1;
|
|
4313
4328
|
const o = s.channel.subscribe((c) => {
|
|
@@ -4345,8 +4360,8 @@ async function Po(s = an()) {
|
|
|
4345
4360
|
}
|
|
4346
4361
|
};
|
|
4347
4362
|
}
|
|
4348
|
-
async function
|
|
4349
|
-
Ee || (Ee =
|
|
4363
|
+
async function Uo(s = !1) {
|
|
4364
|
+
Ee || (Ee = Do({
|
|
4350
4365
|
...an(),
|
|
4351
4366
|
skipStoredIdentityCollisionCheck: s
|
|
4352
4367
|
}), Ee.then((n) => {
|
|
@@ -4355,7 +4370,7 @@ async function Do(s = !1) {
|
|
|
4355
4370
|
};
|
|
4356
4371
|
window.addEventListener("pagehide", r);
|
|
4357
4372
|
}));
|
|
4358
|
-
const e = await Ee, t =
|
|
4373
|
+
const e = await Ee, t = qo();
|
|
4359
4374
|
ct.add(t);
|
|
4360
4375
|
let i = !1;
|
|
4361
4376
|
return {
|
|
@@ -4366,7 +4381,7 @@ async function Do(s = !1) {
|
|
|
4366
4381
|
}
|
|
4367
4382
|
};
|
|
4368
4383
|
}
|
|
4369
|
-
function
|
|
4384
|
+
function qo() {
|
|
4370
4385
|
let s = 0;
|
|
4371
4386
|
for (; ct.has(s); )
|
|
4372
4387
|
s += 1;
|
|
@@ -4374,13 +4389,13 @@ function Uo() {
|
|
|
4374
4389
|
}
|
|
4375
4390
|
function an() {
|
|
4376
4391
|
return {
|
|
4377
|
-
storage:
|
|
4378
|
-
channel:
|
|
4392
|
+
storage: Oo(),
|
|
4393
|
+
channel: xo(),
|
|
4379
4394
|
randomUUID: () => crypto.randomUUID(),
|
|
4380
|
-
settle: () => new Promise((s) =>
|
|
4395
|
+
settle: () => new Promise((s) => Po(s, Co))
|
|
4381
4396
|
};
|
|
4382
4397
|
}
|
|
4383
|
-
function
|
|
4398
|
+
function Oo() {
|
|
4384
4399
|
return {
|
|
4385
4400
|
getItem: (s) => {
|
|
4386
4401
|
try {
|
|
@@ -4398,9 +4413,9 @@ function qo() {
|
|
|
4398
4413
|
}
|
|
4399
4414
|
};
|
|
4400
4415
|
}
|
|
4401
|
-
function
|
|
4416
|
+
function xo() {
|
|
4402
4417
|
if (typeof BroadcastChannel < "u") {
|
|
4403
|
-
const s = new BroadcastChannel(
|
|
4418
|
+
const s = new BroadcastChannel(Eo);
|
|
4404
4419
|
return {
|
|
4405
4420
|
postMessage: (e) => s.postMessage(e),
|
|
4406
4421
|
subscribe: (e) => {
|
|
@@ -4410,9 +4425,9 @@ function Oo() {
|
|
|
4410
4425
|
close: () => s.close()
|
|
4411
4426
|
};
|
|
4412
4427
|
}
|
|
4413
|
-
return
|
|
4428
|
+
return Bo();
|
|
4414
4429
|
}
|
|
4415
|
-
function
|
|
4430
|
+
function Bo() {
|
|
4416
4431
|
const s = /* @__PURE__ */ new Set(), e = (t) => {
|
|
4417
4432
|
if (t.key !== Dt || !t.newValue)
|
|
4418
4433
|
return;
|
|
@@ -4434,7 +4449,7 @@ function xo() {
|
|
|
4434
4449
|
};
|
|
4435
4450
|
}
|
|
4436
4451
|
const cn = "schedule_follow_up";
|
|
4437
|
-
function
|
|
4452
|
+
function No(s) {
|
|
4438
4453
|
let e = s;
|
|
4439
4454
|
if (typeof e == "string")
|
|
4440
4455
|
try {
|
|
@@ -4450,7 +4465,7 @@ function Bo(s) {
|
|
|
4450
4465
|
dueAt: t.dueAt
|
|
4451
4466
|
};
|
|
4452
4467
|
}
|
|
4453
|
-
const
|
|
4468
|
+
const Lo = [
|
|
4454
4469
|
"anthropic/claude-opus-5",
|
|
4455
4470
|
"anthropic/claude-sonnet-5",
|
|
4456
4471
|
"deepseek/deepseek-chat-v3.1",
|
|
@@ -4461,16 +4476,16 @@ const No = [
|
|
|
4461
4476
|
"gpt-5.6-luna",
|
|
4462
4477
|
"gpt-5.6-terra",
|
|
4463
4478
|
"gpt-5.6-sol"
|
|
4464
|
-
],
|
|
4465
|
-
function
|
|
4479
|
+
], rs = (s) => typeof s == "string" && Lo.includes(s), qt = /* @__PURE__ */ new Map();
|
|
4480
|
+
function Fo(s, e, t) {
|
|
4466
4481
|
const i = `pluno.productAgent.modelClientScope:${e}`, n = s.getItem(i);
|
|
4467
4482
|
if (n) return n;
|
|
4468
4483
|
const r = t();
|
|
4469
4484
|
return s.setItem(i, r), r;
|
|
4470
4485
|
}
|
|
4471
|
-
function
|
|
4486
|
+
function jo(s, e) {
|
|
4472
4487
|
try {
|
|
4473
|
-
const t =
|
|
4488
|
+
const t = Fo(window.sessionStorage, s, e);
|
|
4474
4489
|
return qt.set(s, t), t;
|
|
4475
4490
|
} catch (t) {
|
|
4476
4491
|
if (!(t instanceof DOMException) || t.name !== "SecurityError" && t.name !== "QuotaExceededError") throw t;
|
|
@@ -4478,26 +4493,26 @@ function Fo(s, e) {
|
|
|
4478
4493
|
return qt.set(s, i), i;
|
|
4479
4494
|
}
|
|
4480
4495
|
}
|
|
4481
|
-
function
|
|
4496
|
+
function Ho(s) {
|
|
4482
4497
|
if (!s || typeof s != "object") return;
|
|
4483
4498
|
const e = s, t = e.requestedModel ?? e.requested_model, i = e.effectiveModel ?? e.effective_model, n = e.provider;
|
|
4484
|
-
if (!(!
|
|
4499
|
+
if (!(!rs(t) || !rs(i) || n !== "openrouter" && n !== "azure" && n !== "openai"))
|
|
4485
4500
|
return Object.freeze({ requestedModel: t, effectiveModel: i, provider: n });
|
|
4486
4501
|
}
|
|
4487
|
-
const
|
|
4502
|
+
const Be = (s, e) => eo(
|
|
4488
4503
|
s.engine.getState().slices.modelSelection,
|
|
4489
4504
|
e
|
|
4490
|
-
),
|
|
4491
|
-
function
|
|
4505
|
+
), $o = (s, e) => nn(Be(s, e));
|
|
4506
|
+
function Wo(s, e, t, i) {
|
|
4492
4507
|
return s.engine.dispatch({
|
|
4493
4508
|
type: "model.submission_capture",
|
|
4494
4509
|
clientScopeId: e,
|
|
4495
4510
|
clientMessageId: t,
|
|
4496
4511
|
requestedModel: i
|
|
4497
|
-
}),
|
|
4512
|
+
}), Be(s, e).submissions[t].requestedModel;
|
|
4498
4513
|
}
|
|
4499
4514
|
function ln(s, e, t, i, n, r) {
|
|
4500
|
-
const o =
|
|
4515
|
+
const o = Ho(n);
|
|
4501
4516
|
o && s.engine.accept({
|
|
4502
4517
|
type: "model.routing_accepted",
|
|
4503
4518
|
clientScopeId: e,
|
|
@@ -4522,11 +4537,11 @@ function Ot(s, e, t, i) {
|
|
|
4522
4537
|
);
|
|
4523
4538
|
}
|
|
4524
4539
|
}
|
|
4525
|
-
function
|
|
4540
|
+
function Zs(s, e) {
|
|
4526
4541
|
return s.filter((t, i) => {
|
|
4527
|
-
const n =
|
|
4542
|
+
const n = ei(t);
|
|
4528
4543
|
return dn(n) ? !s.slice(i + 1).some((r) => {
|
|
4529
|
-
const o =
|
|
4544
|
+
const o = ei(r);
|
|
4530
4545
|
return un(n, o) && hn(n, o);
|
|
4531
4546
|
}) : !0;
|
|
4532
4547
|
});
|
|
@@ -4534,10 +4549,10 @@ function Ys(s, e) {
|
|
|
4534
4549
|
function dn(s) {
|
|
4535
4550
|
return s.type === "run_status" && s.status === "stopped" && s.reason === "task_tab_closed";
|
|
4536
4551
|
}
|
|
4537
|
-
function
|
|
4552
|
+
function zo(s, e) {
|
|
4538
4553
|
return s.reason === "task_tab_closed" && hn(s, e) && un(s, e);
|
|
4539
4554
|
}
|
|
4540
|
-
function
|
|
4555
|
+
function ei(s) {
|
|
4541
4556
|
return s.data && typeof s.data == "object" ? s.data : {};
|
|
4542
4557
|
}
|
|
4543
4558
|
function un(s, e) {
|
|
@@ -4547,7 +4562,7 @@ function un(s, e) {
|
|
|
4547
4562
|
function hn(s, e) {
|
|
4548
4563
|
return typeof s.respondsToUserMessageId == "string" && typeof e.respondsToUserMessageId == "string" ? s.respondsToUserMessageId === e.respondsToUserMessageId : typeof s.clientMessageId == "string" && typeof e.clientMessageId == "string" ? s.clientMessageId === e.clientMessageId : typeof s.runId == "string" && typeof e.runId == "string" && s.runId === e.runId;
|
|
4549
4564
|
}
|
|
4550
|
-
class
|
|
4565
|
+
class Ko {
|
|
4551
4566
|
constructor(e) {
|
|
4552
4567
|
this.options = e;
|
|
4553
4568
|
}
|
|
@@ -4599,10 +4614,10 @@ class zo {
|
|
|
4599
4614
|
);
|
|
4600
4615
|
}
|
|
4601
4616
|
}
|
|
4602
|
-
class
|
|
4617
|
+
class Vo {
|
|
4603
4618
|
constructor(e, t = null) {
|
|
4604
4619
|
this.storage = e, t && (this.decisions = new Map(
|
|
4605
|
-
t.filter(
|
|
4620
|
+
t.filter(os).map((i) => [this.getDecisionKey(i), i])
|
|
4606
4621
|
), this.initialized = !0);
|
|
4607
4622
|
}
|
|
4608
4623
|
storage;
|
|
@@ -4614,7 +4629,7 @@ class Ko {
|
|
|
4614
4629
|
if (this.initialized) return;
|
|
4615
4630
|
const e = await this.storage.load();
|
|
4616
4631
|
this.decisions = new Map(
|
|
4617
|
-
e.filter(
|
|
4632
|
+
e.filter(os).map((t) => [this.getDecisionKey(t), t])
|
|
4618
4633
|
), this.initialized = !0;
|
|
4619
4634
|
}
|
|
4620
4635
|
isEligible(e, t = Date.now()) {
|
|
@@ -4686,17 +4701,17 @@ class Ko {
|
|
|
4686
4701
|
return `${xt(e.scope)}:category:${e.category}`;
|
|
4687
4702
|
}
|
|
4688
4703
|
}
|
|
4689
|
-
function
|
|
4704
|
+
function jl(s, e) {
|
|
4690
4705
|
return {
|
|
4691
|
-
load: async () =>
|
|
4706
|
+
load: async () => Go(s, e),
|
|
4692
4707
|
save: async (t) => s.setItem(e, JSON.stringify(t))
|
|
4693
4708
|
};
|
|
4694
4709
|
}
|
|
4695
|
-
function
|
|
4710
|
+
function Go(s, e) {
|
|
4696
4711
|
const t = s.getItem(e);
|
|
4697
4712
|
if (!t) return [];
|
|
4698
4713
|
const i = JSON.parse(t);
|
|
4699
|
-
return Array.isArray(i) ? i.filter(
|
|
4714
|
+
return Array.isArray(i) ? i.filter(os) : [];
|
|
4700
4715
|
}
|
|
4701
4716
|
function xt(s) {
|
|
4702
4717
|
return `${s.level}:${s.key}`;
|
|
@@ -4704,7 +4719,7 @@ function xt(s) {
|
|
|
4704
4719
|
function pn(s) {
|
|
4705
4720
|
return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
|
|
4706
4721
|
}
|
|
4707
|
-
function
|
|
4722
|
+
function os(s) {
|
|
4708
4723
|
if (!s || typeof s != "object") return !1;
|
|
4709
4724
|
const e = s;
|
|
4710
4725
|
return typeof e.promptKey == "string" && typeof e.category == "string" && typeof e.decidedAt == "string" && (e.nextEligibleAt === null || typeof e.nextEligibleAt == "string") && pn(e.action) && !!(e.scope && typeof e.scope == "object" && typeof e.scope.level == "string" && typeof e.scope.key == "string");
|
|
@@ -4719,7 +4734,7 @@ function lt(s) {
|
|
|
4719
4734
|
updatedAt: null
|
|
4720
4735
|
};
|
|
4721
4736
|
}
|
|
4722
|
-
class
|
|
4737
|
+
class ti {
|
|
4723
4738
|
constructor(e, t, i = (n, r) => r) {
|
|
4724
4739
|
this.loader = t, this.merge = i, this.state = lt(e);
|
|
4725
4740
|
}
|
|
@@ -4811,21 +4826,21 @@ function Qo(s, e, t) {
|
|
|
4811
4826
|
s.entitiesById[r] || n.push(r);
|
|
4812
4827
|
return { entitiesById: i, ids: n, nextCursor: e.nextCursor };
|
|
4813
4828
|
}
|
|
4814
|
-
function
|
|
4829
|
+
function Jo(s) {
|
|
4815
4830
|
return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
|
|
4816
4831
|
}
|
|
4817
|
-
function
|
|
4832
|
+
function Hl(s) {
|
|
4818
4833
|
return s.visible ? s.minimized ? { state: "minimized" } : { state: s.open ? "visible_open" : "visible_closed" } : { state: "hidden" };
|
|
4819
4834
|
}
|
|
4820
|
-
function
|
|
4835
|
+
function Xo(s, e) {
|
|
4821
4836
|
return e === "limit_exceeded" ? { allowed: !1, reason: "credits_exhausted", actions: ["upgrade", "earn_credits"] } : e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required" ? { allowed: !1, reason: "payment_issue", actions: ["upgrade"] } : s ?? { allowed: !0, reason: "allowed", actions: [] };
|
|
4822
4837
|
}
|
|
4823
|
-
function
|
|
4838
|
+
function Yo(s) {
|
|
4824
4839
|
if (!s || typeof s != "object") return !1;
|
|
4825
4840
|
const e = s.paidCreditFallbackModel;
|
|
4826
4841
|
return typeof e == "string" && e.length > 0;
|
|
4827
4842
|
}
|
|
4828
|
-
function
|
|
4843
|
+
function $l(s) {
|
|
4829
4844
|
const e = s.hasDraftMessage || s.hasPreSubmittedAttachment;
|
|
4830
4845
|
return s.hasRunningAssistantTurn && !s.hasDraftMessage ? {
|
|
4831
4846
|
action: "stop",
|
|
@@ -4835,9 +4850,9 @@ function Hl(s) {
|
|
|
4835
4850
|
disabled: !e || !s.canSubmitMessage
|
|
4836
4851
|
};
|
|
4837
4852
|
}
|
|
4838
|
-
class
|
|
4853
|
+
class Wl {
|
|
4839
4854
|
constructor(e, t, i = 20) {
|
|
4840
|
-
this.loadPage = t, this.limit = i, this.recentQuery = new
|
|
4855
|
+
this.loadPage = t, this.limit = i, this.recentQuery = new ti(
|
|
4841
4856
|
`${e}:recent`,
|
|
4842
4857
|
async ({ cursor: n }) => dt(
|
|
4843
4858
|
await this.loadPage({ cursor: n, limit: this.limit, pinned: !1 }).then((r) => ({
|
|
@@ -4846,7 +4861,7 @@ class $l {
|
|
|
4846
4861
|
}))
|
|
4847
4862
|
),
|
|
4848
4863
|
Qo
|
|
4849
|
-
), this.pinnedQuery = new
|
|
4864
|
+
), this.pinnedQuery = new ti(
|
|
4850
4865
|
`${e}:pinned`,
|
|
4851
4866
|
async () => dt({
|
|
4852
4867
|
entities: await this.loadAllPinned(),
|
|
@@ -4868,8 +4883,8 @@ class $l {
|
|
|
4868
4883
|
activityReconciliationScheduled = !1;
|
|
4869
4884
|
getState() {
|
|
4870
4885
|
const e = this.recentQuery.getState(), t = this.pinnedQuery.getState(), i = [
|
|
4871
|
-
...
|
|
4872
|
-
...
|
|
4886
|
+
...Ge(t.data),
|
|
4887
|
+
...Ge(e.data)
|
|
4873
4888
|
], n = new Map(i.map((c) => [c.id, c])), r = Array.from(n.values()).map(
|
|
4874
4889
|
(c) => this.applyOverrides(c, this.completedRefreshSequence)
|
|
4875
4890
|
), o = Array.from(this.optimisticEntities.values()).filter((c) => !n.has(c.id)).reverse(), a = e.data || t.data || o.length > 0 ? dt({
|
|
@@ -4878,7 +4893,7 @@ class $l {
|
|
|
4878
4893
|
}) : null;
|
|
4879
4894
|
return {
|
|
4880
4895
|
key: e.key.slice(0, -7),
|
|
4881
|
-
status:
|
|
4896
|
+
status: Zo(e, t),
|
|
4882
4897
|
data: a,
|
|
4883
4898
|
error: e.error ?? t.error,
|
|
4884
4899
|
requestId: Math.max(e.requestId, t.requestId),
|
|
@@ -4944,8 +4959,8 @@ class $l {
|
|
|
4944
4959
|
}
|
|
4945
4960
|
reconcileDurableEntities() {
|
|
4946
4961
|
const e = [
|
|
4947
|
-
...
|
|
4948
|
-
...
|
|
4962
|
+
...Ge(this.pinnedQuery.getState().data),
|
|
4963
|
+
...Ge(this.recentQuery.getState().data)
|
|
4949
4964
|
], t = new Set(e.map((i) => i.id));
|
|
4950
4965
|
for (const i of this.optimisticEntities.keys())
|
|
4951
4966
|
t.has(i) && this.optimisticEntities.delete(i);
|
|
@@ -4984,24 +4999,24 @@ class $l {
|
|
|
4984
4999
|
for (const e of this.listeners) e(this.getState());
|
|
4985
5000
|
}
|
|
4986
5001
|
}
|
|
4987
|
-
function
|
|
5002
|
+
function Ge(s) {
|
|
4988
5003
|
return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
|
|
4989
5004
|
}
|
|
4990
|
-
function
|
|
5005
|
+
function Zo(s, e) {
|
|
4991
5006
|
return s.status === "error" || e.status === "error" ? "error" : s.status === "loading" || e.status === "loading" ? "loading" : s.status === "refreshing" || e.status === "refreshing" ? "refreshing" : s.status === "loading_more" ? "loading_more" : s.status === "ready" || e.status === "ready" ? "ready" : "not_requested";
|
|
4992
5007
|
}
|
|
4993
|
-
const
|
|
5008
|
+
const ea = {
|
|
4994
5009
|
working: "⏳",
|
|
4995
5010
|
completed: "✅",
|
|
4996
5011
|
failed: "❗",
|
|
4997
5012
|
stopped: "⏹️"
|
|
4998
|
-
},
|
|
4999
|
-
function
|
|
5013
|
+
}, ta = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
|
|
5014
|
+
function sa(s, e) {
|
|
5000
5015
|
if (!e) return pt(s);
|
|
5001
|
-
const t = pt(s), i = `${
|
|
5016
|
+
const t = pt(s), i = `${ea[e]} Pluno`;
|
|
5002
5017
|
return t ? `${i}: ${t}` : i;
|
|
5003
5018
|
}
|
|
5004
|
-
class
|
|
5019
|
+
class zl {
|
|
5005
5020
|
constructor(e) {
|
|
5006
5021
|
this.titleDocument = e;
|
|
5007
5022
|
}
|
|
@@ -5035,11 +5050,11 @@ class Wl {
|
|
|
5035
5050
|
applyTitle() {
|
|
5036
5051
|
if (!this.status)
|
|
5037
5052
|
return;
|
|
5038
|
-
const e =
|
|
5053
|
+
const e = sa(this.baseTitle, this.status);
|
|
5039
5054
|
this.lastAppliedTitle = e, this.titleDocument.getTitle() !== e && this.titleDocument.setTitle(e);
|
|
5040
5055
|
}
|
|
5041
5056
|
}
|
|
5042
|
-
function
|
|
5057
|
+
function Kl(s) {
|
|
5043
5058
|
return {
|
|
5044
5059
|
getTitle: () => s.title,
|
|
5045
5060
|
setTitle: (e) => {
|
|
@@ -5056,9 +5071,9 @@ function zl(s) {
|
|
|
5056
5071
|
};
|
|
5057
5072
|
}
|
|
5058
5073
|
function pt(s) {
|
|
5059
|
-
return s.replace(
|
|
5074
|
+
return s.replace(ta, "");
|
|
5060
5075
|
}
|
|
5061
|
-
const
|
|
5076
|
+
const ia = {
|
|
5062
5077
|
"in-progress-stop-unavailable": "An in-progress response has no visible enabled interrupt control.",
|
|
5063
5078
|
"stop-did-not-interrupt": "The stopped response remained in progress after an interrupt click.",
|
|
5064
5079
|
"duplicate-message-item": "A canonical message rendered more than once.",
|
|
@@ -5073,10 +5088,10 @@ const sa = {
|
|
|
5073
5088
|
"thinking-groups-without-user-message": "Multiple thinking groups appeared without a user message between them.",
|
|
5074
5089
|
"thinking-without-progress": "Thinking remained visible without progress for five minutes."
|
|
5075
5090
|
};
|
|
5076
|
-
function
|
|
5077
|
-
return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(
|
|
5091
|
+
function na(s) {
|
|
5092
|
+
return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(ia, s.slice(13));
|
|
5078
5093
|
}
|
|
5079
|
-
function
|
|
5094
|
+
function si(s) {
|
|
5080
5095
|
return {
|
|
5081
5096
|
...s.id === void 0 ? {} : { id: s.id },
|
|
5082
5097
|
name: s.name,
|
|
@@ -5087,7 +5102,7 @@ function ti(s) {
|
|
|
5087
5102
|
...s.fileUrl === void 0 ? {} : { fileUrl: s.fileUrl }
|
|
5088
5103
|
};
|
|
5089
5104
|
}
|
|
5090
|
-
function
|
|
5105
|
+
function Vl(s) {
|
|
5091
5106
|
if (!s || typeof s != "object" || !("type" in s)) return !1;
|
|
5092
5107
|
const e = s;
|
|
5093
5108
|
switch (e.type) {
|
|
@@ -5104,7 +5119,7 @@ function Kl(s) {
|
|
|
5104
5119
|
case "runtime.report_displayed_error":
|
|
5105
5120
|
return (e.reason === "conversation_error" || e.reason === "attachment_error" || e.reason === "history_error" || e.reason === "action_error") && typeof e.errorFingerprint == "string" && /^fnv1a-[0-9a-f]{8}$/.test(e.errorFingerprint) && (e.displayedMessage === void 0 || typeof e.displayedMessage == "string" && e.displayedMessage.length <= 500);
|
|
5106
5121
|
case "runtime.report_invalid_state_transition":
|
|
5107
|
-
return (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" ||
|
|
5122
|
+
return (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" || na(e.reason)) && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
|
|
5108
5123
|
case "runtime.widget_lifecycle":
|
|
5109
5124
|
return (e.action === "opened" || e.action === "closed" || e.action === "minimized") && typeof e.trigger == "string";
|
|
5110
5125
|
case "session.load":
|
|
@@ -5132,7 +5147,7 @@ function Kl(s) {
|
|
|
5132
5147
|
return !1;
|
|
5133
5148
|
}
|
|
5134
5149
|
}
|
|
5135
|
-
class
|
|
5150
|
+
class Gl {
|
|
5136
5151
|
constructor(e, t, i) {
|
|
5137
5152
|
this.adapter = t, this.state = Bt(e), this.model = i;
|
|
5138
5153
|
}
|
|
@@ -5167,7 +5182,7 @@ class Vl {
|
|
|
5167
5182
|
for (const a of this.state.messages) {
|
|
5168
5183
|
if (a.role !== "user" || !a.attachments?.length) continue;
|
|
5169
5184
|
const c = a.clientMessageId, l = o.messages.find((d) => d.role === "user" && (d.id === a.id || c && d.clientMessageId === c));
|
|
5170
|
-
o.sessionId !== e.sessionId && !(o.sessionId === null && c && l?.clientMessageId === c) || (a.attachments =
|
|
5185
|
+
o.sessionId !== e.sessionId && !(o.sessionId === null && c && l?.clientMessageId === c) || (a.attachments = ii(l?.attachments, a.attachments));
|
|
5171
5186
|
}
|
|
5172
5187
|
if (this.stoppedProjection) {
|
|
5173
5188
|
const a = this.stoppedProjection, c = new Set(a.messages.filter((u) => u.role === "user").map((u) => u.id)), l = e.sessionId === a.sessionId && e.user?.id === a.user?.id, d = e.messages.some((u) => u.role === "user" && !c.has(u.id) && !a.messages.some((h) => h.clientMessageId && h.clientMessageId === u.clientMessageId));
|
|
@@ -5179,7 +5194,7 @@ class Vl {
|
|
|
5179
5194
|
a.assistantDraftRespondsToUserMessageId,
|
|
5180
5195
|
a.messages.filter((p) => p.role === "user").slice(-1)[0]?.id
|
|
5181
5196
|
].filter(Boolean), h = u.length > 0 && u.every((p) => e.messages.some((f) => f.respondsToUserMessageId === p && !f.loading && (f.dataType === "run_status" || f.dataType === "run_error" || f.role === "assistant" && f.phase !== "commentary")));
|
|
5182
|
-
this.state =
|
|
5197
|
+
this.state = Gt(h ? this.state : {
|
|
5183
5198
|
...this.state,
|
|
5184
5199
|
messages: a.messages,
|
|
5185
5200
|
assistantDraft: a.assistantDraft
|
|
@@ -5195,7 +5210,7 @@ class Vl {
|
|
|
5195
5210
|
(d) => d.clientMessageId === a
|
|
5196
5211
|
);
|
|
5197
5212
|
if (l) {
|
|
5198
|
-
l.attachments =
|
|
5213
|
+
l.attachments = ii(
|
|
5199
5214
|
c.message.attachments,
|
|
5200
5215
|
l.attachments
|
|
5201
5216
|
), this.unacknowledgedSubmissions.delete(a);
|
|
@@ -5204,7 +5219,7 @@ class Vl {
|
|
|
5204
5219
|
c.sessionId ??= e.sessionId, this.state.messages.push(c.message), this.state.pendingMessageStatus = "sending", this.state.turnPhase ??= "sending", this.state.taskStatus ??= "working";
|
|
5205
5220
|
}
|
|
5206
5221
|
if (t !== void 0 && (this.model = t), i && JSON.stringify(i) !== JSON.stringify(this.sessionHistoryState)) {
|
|
5207
|
-
this.sessionHistoryState =
|
|
5222
|
+
this.sessionHistoryState = ni(i);
|
|
5208
5223
|
for (const a of this.sessionHistoryListeners)
|
|
5209
5224
|
a(this.getSessionHistoryState());
|
|
5210
5225
|
}
|
|
@@ -5299,7 +5314,7 @@ class Vl {
|
|
|
5299
5314
|
clientMessageId: o,
|
|
5300
5315
|
proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
|
|
5301
5316
|
// Preview URLs belong to the renderer's optimistic snapshot and are not valid runtime-command metadata.
|
|
5302
|
-
attachments: a.length > 0 ? a.map(
|
|
5317
|
+
attachments: a.length > 0 ? a.map(si) : void 0,
|
|
5303
5318
|
submittedAt: t.submittedAt
|
|
5304
5319
|
}), n !== this.submissionGeneration) return null;
|
|
5305
5320
|
if (c = !0, a.length > 0) {
|
|
@@ -5325,7 +5340,7 @@ class Vl {
|
|
|
5325
5340
|
invocation: t.invocation,
|
|
5326
5341
|
proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
|
|
5327
5342
|
...t.automationOnboarding ? { automationOnboarding: !0 } : {},
|
|
5328
|
-
attachments: a.length > 0 ? a.map(
|
|
5343
|
+
attachments: a.length > 0 ? a.map(si) : void 0
|
|
5329
5344
|
});
|
|
5330
5345
|
if (n !== this.submissionGeneration) return null;
|
|
5331
5346
|
for (const d of t.attachments ?? [])
|
|
@@ -5370,7 +5385,7 @@ class Vl {
|
|
|
5370
5385
|
}
|
|
5371
5386
|
stop() {
|
|
5372
5387
|
const e = this.cancelPendingSubmissions();
|
|
5373
|
-
this.state =
|
|
5388
|
+
this.state = Gt(this.state, (/* @__PURE__ */ new Date()).toISOString()), this.stoppedProjection = this.getState(), this.emit("state", this.getState());
|
|
5374
5389
|
const t = this.adapter.dispatch({ type: "run.stop", ...e.length ? { clientMessageIds: e } : {} });
|
|
5375
5390
|
return this.operationQueue = t.then(() => {
|
|
5376
5391
|
}, () => {
|
|
@@ -5399,7 +5414,7 @@ class Vl {
|
|
|
5399
5414
|
return t.sessionHistoryPage;
|
|
5400
5415
|
}
|
|
5401
5416
|
getSessionHistoryState() {
|
|
5402
|
-
return
|
|
5417
|
+
return ni(this.sessionHistoryState);
|
|
5403
5418
|
}
|
|
5404
5419
|
subscribeSessionHistory(e) {
|
|
5405
5420
|
return this.sessionHistoryListeners.add(e), e(this.getSessionHistoryState()), () => this.sessionHistoryListeners.delete(e);
|
|
@@ -5478,7 +5493,7 @@ class Vl {
|
|
|
5478
5493
|
for (const n of i ?? []) n(t);
|
|
5479
5494
|
}
|
|
5480
5495
|
}
|
|
5481
|
-
function
|
|
5496
|
+
function ii(s, e) {
|
|
5482
5497
|
if (!e || !s) return e;
|
|
5483
5498
|
const t = /* @__PURE__ */ new Map();
|
|
5484
5499
|
for (const i of s) {
|
|
@@ -5514,16 +5529,16 @@ function Bt(s) {
|
|
|
5514
5529
|
activeScheduledFollowUps: s.activeScheduledFollowUps?.map((e) => ({ ...e })) ?? null
|
|
5515
5530
|
};
|
|
5516
5531
|
}
|
|
5517
|
-
function
|
|
5532
|
+
function ni(s) {
|
|
5518
5533
|
return {
|
|
5519
5534
|
...s,
|
|
5520
5535
|
data: s.data ? dt({
|
|
5521
|
-
entities:
|
|
5536
|
+
entities: Jo(s.data).map((e) => ({ ...e })),
|
|
5522
5537
|
nextCursor: s.data.nextCursor
|
|
5523
5538
|
}) : null
|
|
5524
5539
|
};
|
|
5525
5540
|
}
|
|
5526
|
-
const
|
|
5541
|
+
const ra = globalThis.fetch.bind(globalThis), ri = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', oa = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', aa = ".pluno-pa-widget__panel", ca = ".pluno-pa-widget__timeline", la = "__plunoExtensionWidgetOwner";
|
|
5527
5542
|
class ne extends Error {
|
|
5528
5543
|
constructor(e, t, i, n) {
|
|
5529
5544
|
super(e), this.retryable = t, this.status = i, this.retryAfterMs = n, this.name = "ProductAgentTokenProviderError";
|
|
@@ -5532,11 +5547,11 @@ class ne extends Error {
|
|
|
5532
5547
|
status;
|
|
5533
5548
|
retryAfterMs;
|
|
5534
5549
|
}
|
|
5535
|
-
function
|
|
5550
|
+
function da(s) {
|
|
5536
5551
|
return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
|
|
5537
5552
|
}
|
|
5538
|
-
let
|
|
5539
|
-
function
|
|
5553
|
+
let ua = 0;
|
|
5554
|
+
function Nt(s) {
|
|
5540
5555
|
const e = {};
|
|
5541
5556
|
for (const c of [
|
|
5542
5557
|
"type",
|
|
@@ -5552,7 +5567,8 @@ function ri(s) {
|
|
|
5552
5567
|
"status",
|
|
5553
5568
|
"reason",
|
|
5554
5569
|
"phase",
|
|
5555
|
-
"elapsedMs"
|
|
5570
|
+
"elapsedMs",
|
|
5571
|
+
"e2bEventSequence"
|
|
5556
5572
|
]) {
|
|
5557
5573
|
const l = s[c];
|
|
5558
5574
|
(typeof l == "string" || typeof l == "number" || typeof l == "boolean" || l === null) && (e[c] = l);
|
|
@@ -5579,7 +5595,7 @@ function ri(s) {
|
|
|
5579
5595
|
stage: typeof u.stage == "string" ? u.stage : null,
|
|
5580
5596
|
retryable: u.retryable === !0,
|
|
5581
5597
|
visible: !!(h && // Recovery-only failures are intentionally hidden, not missing transcript items.
|
|
5582
|
-
!(u.type === "run_error" && u.retryable === !0) && !h.scheduledCheckInAt && h.toolName !==
|
|
5598
|
+
!(u.type === "run_error" && u.retryable === !0) && !h.scheduledCheckInAt && h.toolName !== Rs && (u.type !== "run_status" || ["failed", "interrupted", "stopped"].includes(String(u.status))))
|
|
5583
5599
|
};
|
|
5584
5600
|
}, o = r(s.item);
|
|
5585
5601
|
if (o?.id && (e.itemId = o.id, o.type && (e.itemType = o.type), o.role && (e.itemRole = o.role), o.sessionId && typeof e.sessionId != "string" && (e.sessionId = o.sessionId), o.runId && typeof e.runId != "string" && (e.runId = o.runId), o.respondsToUserMessageId && typeof e.respondsToUserMessageId != "string" && (e.respondsToUserMessageId = o.respondsToUserMessageId), o.status && (e.itemStatus = o.status), o.stage && (e.itemStage = o.stage), o.retryable && (e.itemRetryable = !0), o.visible && (e.visibleItemId = o.id, o.streamId && (e.visibleItemAliases = JSON.stringify([[o.streamId, o.id]])))), Array.isArray(s.items)) {
|
|
@@ -5602,7 +5618,7 @@ function ri(s) {
|
|
|
5602
5618
|
}
|
|
5603
5619
|
return e;
|
|
5604
5620
|
}
|
|
5605
|
-
function
|
|
5621
|
+
function Ce(s, e, t) {
|
|
5606
5622
|
if (typeof window > "u")
|
|
5607
5623
|
return;
|
|
5608
5624
|
const i = window.__PLUNO_PRODUCT_AGENT_TRACE_ID__;
|
|
@@ -5614,36 +5630,36 @@ function Qe(s, e, t) {
|
|
|
5614
5630
|
source: "web_sdk",
|
|
5615
5631
|
category: s,
|
|
5616
5632
|
name: e,
|
|
5617
|
-
sequence: ++
|
|
5633
|
+
sequence: ++ua,
|
|
5618
5634
|
wallTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5619
5635
|
monotonicMs: performance.now(),
|
|
5620
5636
|
data: t
|
|
5621
5637
|
};
|
|
5622
5638
|
window.dispatchEvent(new CustomEvent("product-agent:trace", { detail: n }));
|
|
5623
5639
|
}
|
|
5624
|
-
class
|
|
5640
|
+
class Qe extends Error {
|
|
5625
5641
|
}
|
|
5626
|
-
function
|
|
5642
|
+
function ha(s) {
|
|
5627
5643
|
return s === 408 || s === 425 || s === 429 || s >= 500;
|
|
5628
5644
|
}
|
|
5629
|
-
const
|
|
5645
|
+
const pa = "https://app.pluno.ai", fa = 2e4, ga = 1e4, ya = 6e4, ma = 6e4, Ia = 1e4, Sa = 1e4, wa = 3e3, ba = 3e4, va = 1e3, as = 3e4, oi = 0.2, Ta = 6e4, ai = 15e3, Lt = 6e4, Je = 3, _a = 8, Ra = "Browser connection was interrupted.", ci = 15e3, li = "Pluno could not send this message. Try it again.", Aa = "Still connecting to Pluno. Retrying automatically.", di = 2e3, ka = 1e3, Ma = 100, ui = 3, Ea = [300, 1e3], fn = 50 * 1024 * 1024, Ca = /* @__PURE__ */ new Set([
|
|
5630
5646
|
".jpeg:image/jpeg",
|
|
5631
5647
|
".jpg:image/jpeg",
|
|
5632
5648
|
".pdf:application/pdf",
|
|
5633
5649
|
".png:image/png",
|
|
5634
5650
|
".webp:image/webp"
|
|
5635
|
-
]), Ql = ".pdf,.png,.jpg,.jpeg,.webp",
|
|
5636
|
-
function
|
|
5651
|
+
]), Ql = ".pdf,.png,.jpg,.jpeg,.webp", As = 64e3, Ft = 4e3, ks = 30, Pa = 2e3, Da = 1e3, gn = "Image is too large for model vision input.", Ua = 100, qa = 20, yn = "pluno.productAgent.state.", cs = "pluno.productAgent.pendingEvents.", mn = "pluno.productAgent.pendingDeliveryRecovery.", bt = "pluno.productAgent.activeToolCalls.", Oa = 100;
|
|
5652
|
+
function xa(s, e = 0) {
|
|
5637
5653
|
const t = s === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (s - 1));
|
|
5638
5654
|
return Math.max(e, t);
|
|
5639
5655
|
}
|
|
5640
5656
|
const ut = /* @__PURE__ */ new Set();
|
|
5641
5657
|
let Xe = null;
|
|
5642
|
-
function
|
|
5643
|
-
const t = Math.min(
|
|
5644
|
-
return Math.min(
|
|
5658
|
+
function Ba(s, e = Math.random) {
|
|
5659
|
+
const t = Math.min(as, va * 2 ** s), i = 1 - oi + e() * oi * 2;
|
|
5660
|
+
return Math.min(as, Math.round(t * i));
|
|
5645
5661
|
}
|
|
5646
|
-
function
|
|
5662
|
+
function Na(s) {
|
|
5647
5663
|
const e = s.split(".")[1];
|
|
5648
5664
|
if (!e)
|
|
5649
5665
|
return null;
|
|
@@ -5664,7 +5680,7 @@ function hi(s) {
|
|
|
5664
5680
|
}
|
|
5665
5681
|
return !0;
|
|
5666
5682
|
}
|
|
5667
|
-
function
|
|
5683
|
+
function jt(s) {
|
|
5668
5684
|
if (s instanceof Error)
|
|
5669
5685
|
return s;
|
|
5670
5686
|
if (s && typeof s == "object") {
|
|
@@ -5696,7 +5712,7 @@ class vt {
|
|
|
5696
5712
|
}
|
|
5697
5713
|
});
|
|
5698
5714
|
const i = this;
|
|
5699
|
-
this.clientRuntime = new
|
|
5715
|
+
this.clientRuntime = new ho(Fr({
|
|
5700
5716
|
http: this.directoryHttp,
|
|
5701
5717
|
get authority() {
|
|
5702
5718
|
return i.directoryAuthority;
|
|
@@ -5705,10 +5721,10 @@ class vt {
|
|
|
5705
5721
|
pageUrl: () => location.href,
|
|
5706
5722
|
now: () => Date.now(),
|
|
5707
5723
|
onError: (o) => this.handleDirectoryTransportError(o)
|
|
5708
|
-
}),
|
|
5724
|
+
}), Fn(async () => {
|
|
5709
5725
|
if (!this.token || !this.state.user || this.state.status === "closed") throw new Error("Product Agent is not authenticated");
|
|
5710
|
-
return this.options.activeUsersLoader ? (await this.options.activeUsersLoader()).count :
|
|
5711
|
-
})), this.modelClientScopeId =
|
|
5726
|
+
return this.options.activeUsersLoader ? (await this.options.activeUsersLoader()).count : jn(this.options.backendUrl);
|
|
5727
|
+
})), this.modelClientScopeId = jo(e.clientId, () => crypto.randomUUID()), this.directoryConversationScopeId = `conversation:${this.modelClientScopeId}`, this.createDirectoryAdapters(), this.clientRuntime.engine.dispatch({
|
|
5712
5728
|
type: "model.scope_open",
|
|
5713
5729
|
clientScopeId: this.modelClientScopeId,
|
|
5714
5730
|
sessionId: null,
|
|
@@ -5717,15 +5733,15 @@ class vt {
|
|
|
5717
5733
|
selectedModel: e.model
|
|
5718
5734
|
}), this.state = {
|
|
5719
5735
|
...this.state,
|
|
5720
|
-
starterPrompts:
|
|
5736
|
+
starterPrompts: Ic(e.initialStarterPrompts)
|
|
5721
5737
|
}, this.account = e.initialAccount ? { ...e.initialAccount } : null;
|
|
5722
|
-
const n = e.restorePersistedState === !1 ? null :
|
|
5738
|
+
const n = e.restorePersistedState === !1 ? null : rl(e.clientId, e.expectedPersistedSessionId);
|
|
5723
5739
|
n && (this.state = {
|
|
5724
5740
|
...this.state,
|
|
5725
5741
|
...n,
|
|
5726
5742
|
// Paint the readable same-session cache immediately while the complete transcript is revalidated. Tool
|
|
5727
5743
|
// activity is deliberately not restored here because it hydrates after the transcript is visible.
|
|
5728
|
-
messages: n.messages.filter(
|
|
5744
|
+
messages: n.messages.filter(gs),
|
|
5729
5745
|
isLoadingSession: n.sessionId !== null,
|
|
5730
5746
|
status: "idle",
|
|
5731
5747
|
user: null,
|
|
@@ -5740,9 +5756,9 @@ class vt {
|
|
|
5740
5756
|
taskStatus: null,
|
|
5741
5757
|
isRetrying: !1,
|
|
5742
5758
|
lastError: null
|
|
5743
|
-
}, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents =
|
|
5744
|
-
|
|
5745
|
-
|
|
5759
|
+
}, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents = ul(
|
|
5760
|
+
al(e.clientId),
|
|
5761
|
+
cl(e.clientId)
|
|
5746
5762
|
);
|
|
5747
5763
|
const r = [...this.queuedClientEvents].reverse().find(
|
|
5748
5764
|
(o) => o.type === "chat.user_message" && typeof o.clientMessageId == "string"
|
|
@@ -5760,6 +5776,7 @@ class vt {
|
|
|
5760
5776
|
$(e.clientId, this.queuedClientEvents);
|
|
5761
5777
|
}
|
|
5762
5778
|
options;
|
|
5779
|
+
assistantDeltaReplayGuard = new Ln();
|
|
5763
5780
|
clientRuntime;
|
|
5764
5781
|
listeners = {};
|
|
5765
5782
|
socket = null;
|
|
@@ -5803,7 +5820,7 @@ class vt {
|
|
|
5803
5820
|
accountRefresh = null;
|
|
5804
5821
|
runtimeInteractions = [];
|
|
5805
5822
|
interactionListeners = /* @__PURE__ */ new Set();
|
|
5806
|
-
interactionManager = new
|
|
5823
|
+
interactionManager = new Vo(
|
|
5807
5824
|
{ load: async () => [], save: async () => {
|
|
5808
5825
|
} },
|
|
5809
5826
|
[]
|
|
@@ -5906,17 +5923,17 @@ class vt {
|
|
|
5906
5923
|
lastErrorSecuritySettingsUrl: null
|
|
5907
5924
|
};
|
|
5908
5925
|
static async init(e) {
|
|
5909
|
-
const t = e, i = await
|
|
5926
|
+
const t = e, i = await Uo(
|
|
5910
5927
|
t.skipStoredTransportIdentityCollisionCheck === !0
|
|
5911
5928
|
), n = new vt({
|
|
5912
5929
|
...e,
|
|
5913
|
-
backendUrl:
|
|
5914
|
-
clientId: e.clientId ??
|
|
5930
|
+
backendUrl: ic(e.backendUrl ?? pa),
|
|
5931
|
+
clientId: e.clientId ?? Tc(),
|
|
5915
5932
|
productVariant: e.productVariant ?? "customer_embedded",
|
|
5916
|
-
entrySurface:
|
|
5933
|
+
entrySurface: nc(e.entrySurface)
|
|
5917
5934
|
}, i);
|
|
5918
5935
|
try {
|
|
5919
|
-
await n.initializeDirectory(),
|
|
5936
|
+
await n.initializeDirectory(), Io().catch((r) => {
|
|
5920
5937
|
M("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
|
|
5921
5938
|
message: r instanceof Error ? r.message : String(r)
|
|
5922
5939
|
});
|
|
@@ -5927,7 +5944,7 @@ class vt {
|
|
|
5927
5944
|
return n;
|
|
5928
5945
|
}
|
|
5929
5946
|
createConversationRecovery(e) {
|
|
5930
|
-
const t = new
|
|
5947
|
+
const t = new es({
|
|
5931
5948
|
poll: async ({ sessionId: r }) => await this.fetchSessionHistoryPageOnce(
|
|
5932
5949
|
r,
|
|
5933
5950
|
"transcript",
|
|
@@ -5939,7 +5956,7 @@ class vt {
|
|
|
5939
5956
|
activeIntervalMs: 3e3,
|
|
5940
5957
|
idleIntervalMs: 15e3,
|
|
5941
5958
|
maxFailureIntervalMs: 3e4
|
|
5942
|
-
}), i = new
|
|
5959
|
+
}), i = new Ko({
|
|
5943
5960
|
fetchPage: async (r, o) => await this.fetchSessionHistoryPageOnce(
|
|
5944
5961
|
r,
|
|
5945
5962
|
"activity",
|
|
@@ -5958,7 +5975,7 @@ class vt {
|
|
|
5958
5975
|
},
|
|
5959
5976
|
getItemId: (r) => A(r, "id"),
|
|
5960
5977
|
maxPagesPerPoll: 3
|
|
5961
|
-
}), n = new
|
|
5978
|
+
}), n = new es({
|
|
5962
5979
|
poll: async ({ sessionId: r }) => await i.poll(r),
|
|
5963
5980
|
apply: async (r) => await i.apply(r),
|
|
5964
5981
|
isActiveTurn: () => this.clientRuntime.engine.getProjection().directory.activityBySessionId[e] === !0,
|
|
@@ -5978,15 +5995,15 @@ class vt {
|
|
|
5978
5995
|
};
|
|
5979
5996
|
}
|
|
5980
5997
|
createDirectoryAdapters() {
|
|
5981
|
-
this.directoryScope = new
|
|
5998
|
+
this.directoryScope = new $r({
|
|
5982
5999
|
runtime: this.clientRuntime,
|
|
5983
6000
|
authority: this.directoryAuthority,
|
|
5984
6001
|
random: Math.random,
|
|
5985
|
-
persistence:
|
|
6002
|
+
persistence: zr(
|
|
5986
6003
|
this.modelClientScopeId,
|
|
5987
6004
|
this.directoryAuthority.authorityId
|
|
5988
6005
|
)
|
|
5989
|
-
}), this.directoryObservation = new
|
|
6006
|
+
}), this.directoryObservation = new jr({
|
|
5990
6007
|
runtime: this.clientRuntime,
|
|
5991
6008
|
authority: this.directoryAuthority,
|
|
5992
6009
|
http: this.directoryHttp,
|
|
@@ -6008,7 +6025,7 @@ class vt {
|
|
|
6008
6025
|
isActiveTurn: (t) => this.clientRuntime.engine.getProjection().directory.activityBySessionId[t] === !0,
|
|
6009
6026
|
nextRequestId: L,
|
|
6010
6027
|
onError: (t) => {
|
|
6011
|
-
this.handleDirectoryTransportError(t), this.emit("error",
|
|
6028
|
+
this.handleDirectoryTransportError(t), this.emit("error", jt(t));
|
|
6012
6029
|
},
|
|
6013
6030
|
wakeup: { start: () => {
|
|
6014
6031
|
}, stop: () => {
|
|
@@ -6056,7 +6073,7 @@ class vt {
|
|
|
6056
6073
|
), await this.directoryScope.persist();
|
|
6057
6074
|
}
|
|
6058
6075
|
async selectDirectorySession(e) {
|
|
6059
|
-
const i = [...e === this.state.sessionId ? this.state.messages : this.sessionTimelineCache.get(e) ?? []].reverse().find((a) => !
|
|
6076
|
+
const i = [...e === this.state.sessionId ? this.state.messages : this.sessionTimelineCache.get(e) ?? []].reverse().find((a) => !gs(a) && !a.id.startsWith("transient-activity:"));
|
|
6060
6077
|
this.conversationRecoveries.get(e)?.checkpoint.reset(i?.id ?? null);
|
|
6061
6078
|
const n = this.clientRuntime.engine.getState().slices.directory, r = n.clients[this.modelClientScopeId], o = r ? n.selections[r] : null;
|
|
6062
6079
|
o?.sessionId !== e && (r && o?.sessionId === null && o.provisionalId ? (await this.directoryScope.accepted(r, o.provisionalId, e), this.directoryProvisionalId = null) : (this.directoryConversationScopeId = `conversation:${this.modelClientScopeId}:${L()}`, await this.directoryScope.bind(
|
|
@@ -6104,7 +6121,7 @@ class vt {
|
|
|
6104
6121
|
return this.options.token;
|
|
6105
6122
|
if (!this.options.tokenProvider)
|
|
6106
6123
|
return this.token;
|
|
6107
|
-
const i = Date.now(), n = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs -
|
|
6124
|
+
const i = Date.now(), n = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs - ma > i;
|
|
6108
6125
|
if (!t.forceRefresh && (n || t.preferCached && this.token !== null))
|
|
6109
6126
|
return this.token;
|
|
6110
6127
|
if (this.tokenRequest && !t.forceRefresh)
|
|
@@ -6117,7 +6134,7 @@ class vt {
|
|
|
6117
6134
|
const c = new Promise((l, d) => {
|
|
6118
6135
|
a = window.setTimeout(() => {
|
|
6119
6136
|
r.abort(), d(new ne("Pluno token provider timed out", !0));
|
|
6120
|
-
},
|
|
6137
|
+
}, ya);
|
|
6121
6138
|
});
|
|
6122
6139
|
try {
|
|
6123
6140
|
const l = await Promise.race([
|
|
@@ -6128,7 +6145,7 @@ class vt {
|
|
|
6128
6145
|
throw new ne("Pluno token request was cancelled", !0);
|
|
6129
6146
|
if (!l)
|
|
6130
6147
|
throw new ne("Pluno token provider did not return a token", !1);
|
|
6131
|
-
return this.token = l, this.tokenExpiresAtMs =
|
|
6148
|
+
return this.token = l, this.tokenExpiresAtMs = Na(l), l;
|
|
6132
6149
|
} finally {
|
|
6133
6150
|
a !== null && window.clearTimeout(a);
|
|
6134
6151
|
}
|
|
@@ -6175,7 +6192,7 @@ class vt {
|
|
|
6175
6192
|
await this.replaceDefaultTransportCredentials(this.socket);
|
|
6176
6193
|
return;
|
|
6177
6194
|
}
|
|
6178
|
-
const i =
|
|
6195
|
+
const i = ac(this.options.backendUrl), n = this.options.webSocketFactory?.(i) ?? new N({
|
|
6179
6196
|
backendUrl: this.options.backendUrl,
|
|
6180
6197
|
entrySurface: this.options.entrySurface,
|
|
6181
6198
|
auth: {
|
|
@@ -6195,7 +6212,7 @@ class vt {
|
|
|
6195
6212
|
});
|
|
6196
6213
|
this.socket = n, this.options.webSocketFactory && (this.socketConnectTimer = window.setTimeout(() => {
|
|
6197
6214
|
this.socket === n && n.readyState === WebSocket.CONNECTING && (M("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.reportTransportDiagnostic("connect_timeout"), this.replaceTimedOutSocket(n));
|
|
6198
|
-
},
|
|
6215
|
+
}, Ia)), n.addEventListener("reconnecting", () => {
|
|
6199
6216
|
this.socket === n && this.state.status !== "closed" && (this.refreshingDefaultCredentials || this.reportTransportDiagnostic("socket_closed", { closeCode: 1006, wasClean: !1 }), this.setReconnectingState());
|
|
6200
6217
|
}), n.addEventListener("open", () => {
|
|
6201
6218
|
this.socket !== n || (this.clearSocketConnectTimer(), this.directoryObservation.reconnect().catch(() => {
|
|
@@ -6210,12 +6227,12 @@ class vt {
|
|
|
6210
6227
|
pageUrl: location.href
|
|
6211
6228
|
}) : !0)) || this.options.webSocketFactory && (this.socketAuthTimer = window.setTimeout(() => {
|
|
6212
6229
|
this.socket === n && (M("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.reportTransportDiagnostic("auth_timeout"), this.replaceTimedOutSocket(n));
|
|
6213
|
-
},
|
|
6230
|
+
}, Sa));
|
|
6214
6231
|
}), n.addEventListener("message", (r) => {
|
|
6215
6232
|
if (this.socket !== n)
|
|
6216
6233
|
return;
|
|
6217
6234
|
const o = mi(r.data);
|
|
6218
|
-
if (n instanceof N && o.type === "tool.call" && !
|
|
6235
|
+
if (n instanceof N && o.type === "tool.call" && !yc(o)) {
|
|
6219
6236
|
this.handleServerEvent({ type: "error", message: "Invalid tool-call envelope" });
|
|
6220
6237
|
return;
|
|
6221
6238
|
}
|
|
@@ -6224,7 +6241,7 @@ class vt {
|
|
|
6224
6241
|
}), n.addEventListener("sendfailure", (r) => {
|
|
6225
6242
|
if (this.socket !== n)
|
|
6226
6243
|
return;
|
|
6227
|
-
const o =
|
|
6244
|
+
const o = mc(r?.detail?.data);
|
|
6228
6245
|
o?.type === "chat.user_message" && o.clientMessageId === this.pendingClientMessageId && !this.queuedClientEvents.some(
|
|
6229
6246
|
(a) => a.type === "chat.user_message" && a.clientMessageId === o.clientMessageId
|
|
6230
6247
|
) && (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();
|
|
@@ -6252,14 +6269,14 @@ class vt {
|
|
|
6252
6269
|
this.handleDirectoryTransportError(i);
|
|
6253
6270
|
return;
|
|
6254
6271
|
}
|
|
6255
|
-
const n =
|
|
6272
|
+
const n = jt(i);
|
|
6256
6273
|
if (hi(i)) {
|
|
6257
6274
|
M("web-sdk.agent", "Pluno connection attempt failed; retrying", {
|
|
6258
6275
|
message: n.message,
|
|
6259
6276
|
reconnectAttempt: this.reconnectAttempts
|
|
6260
6277
|
}), i instanceof ne && this.reportTransportDiagnostic("auth_timeout"), this.setState({
|
|
6261
6278
|
status: "reconnecting",
|
|
6262
|
-
lastError:
|
|
6279
|
+
lastError: Aa,
|
|
6263
6280
|
lastErrorCode: "connection_failed"
|
|
6264
6281
|
}), this.emit("error", n), this.scheduleReconnect(
|
|
6265
6282
|
i instanceof ne ? i.retryAfterMs : void 0
|
|
@@ -6283,7 +6300,7 @@ class vt {
|
|
|
6283
6300
|
}
|
|
6284
6301
|
destroy() {
|
|
6285
6302
|
if (!this.clientRuntime.isDisposed) {
|
|
6286
|
-
this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(),
|
|
6303
|
+
this.assistantDeltaReplayGuard.clear(), this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), hl(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [], this.detachedSessionIds.clear(), this.detachedClientMessageIds.clear(), this.deferredDetachedSessionEvents.clear();
|
|
6287
6304
|
for (const e of Object.values(this.listeners))
|
|
6288
6305
|
e?.clear();
|
|
6289
6306
|
this.accountListeners.clear(), this.interactionListeners.clear(), this.directoryObservation.dispose(), this.directoryHttp.dispose(), this.clientRuntime.dispose();
|
|
@@ -6298,7 +6315,7 @@ class vt {
|
|
|
6298
6315
|
entrySurface: this.options.entrySurface,
|
|
6299
6316
|
sessionId: this.state.sessionId ?? void 0,
|
|
6300
6317
|
page: t,
|
|
6301
|
-
model:
|
|
6318
|
+
model: Be(this.clientRuntime, this.modelClientScopeId).selectedModel
|
|
6302
6319
|
};
|
|
6303
6320
|
if (e === "composer_input") {
|
|
6304
6321
|
if (this.options.productVariant === "customer_embedded") {
|
|
@@ -6339,7 +6356,7 @@ class vt {
|
|
|
6339
6356
|
throw new Error("Wait for the current message to finish sending before sending another.");
|
|
6340
6357
|
const o = W(), a = t.clientMessageId ?? L();
|
|
6341
6358
|
this.pendingClientMessageId = a;
|
|
6342
|
-
const c =
|
|
6359
|
+
const c = Wo(this.clientRuntime, this.modelClientScopeId, a), l = t.proactiveSuggestionQuestion?.trim(), d = this.stagedProactiveSuggestionQuestionMessageId ? this.state.messages.find(
|
|
6343
6360
|
(R) => R.id === this.stagedProactiveSuggestionQuestionMessageId
|
|
6344
6361
|
) ?? null : null, u = l ? {
|
|
6345
6362
|
id: `local-proactive-suggestion-question-${a}`,
|
|
@@ -6432,11 +6449,11 @@ class vt {
|
|
|
6432
6449
|
sessionId: this.state.sessionId ?? void 0,
|
|
6433
6450
|
clientMessageId: a,
|
|
6434
6451
|
initiatedBy: t.initiatedBy,
|
|
6435
|
-
invocation:
|
|
6452
|
+
invocation: rc(t.invocation ?? t.initiatedBy),
|
|
6436
6453
|
entrySurface: this.options.entrySurface,
|
|
6437
6454
|
content: i,
|
|
6438
6455
|
proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
|
|
6439
|
-
pageContent: D &&
|
|
6456
|
+
pageContent: D && Ms() || void 0,
|
|
6440
6457
|
attachments: r.length > 0 ? r.map(yt) : void 0,
|
|
6441
6458
|
page: o,
|
|
6442
6459
|
model: c,
|
|
@@ -6449,7 +6466,7 @@ class vt {
|
|
|
6449
6466
|
} });
|
|
6450
6467
|
}
|
|
6451
6468
|
reportResponseVisibility(e) {
|
|
6452
|
-
|
|
6469
|
+
Kr(this, this.options.entrySurface, e);
|
|
6453
6470
|
}
|
|
6454
6471
|
reportInvalidStateTransition(e, t) {
|
|
6455
6472
|
this.reportHealthSignal("invalid_state_transition", {
|
|
@@ -6466,7 +6483,7 @@ class vt {
|
|
|
6466
6483
|
}
|
|
6467
6484
|
getModel() {
|
|
6468
6485
|
return this.clientRuntime.project("modelSelection", {
|
|
6469
|
-
core: () =>
|
|
6486
|
+
core: () => $o(this.clientRuntime, this.modelClientScopeId)
|
|
6470
6487
|
});
|
|
6471
6488
|
}
|
|
6472
6489
|
setModel(e) {
|
|
@@ -6492,16 +6509,16 @@ class vt {
|
|
|
6492
6509
|
} });
|
|
6493
6510
|
}
|
|
6494
6511
|
createLocalAttachment(e) {
|
|
6495
|
-
this.options.productVariant === "customer_embedded" &&
|
|
6512
|
+
this.options.productVariant === "customer_embedded" && pl(e);
|
|
6496
6513
|
const t = L(), i = {
|
|
6497
6514
|
id: t,
|
|
6498
6515
|
name: e.name || "attachment",
|
|
6499
|
-
mimeType:
|
|
6516
|
+
mimeType: ys(e),
|
|
6500
6517
|
sizeBytes: e.size
|
|
6501
6518
|
};
|
|
6502
6519
|
this.attachmentFiles.set(t, e);
|
|
6503
6520
|
const n = Date.now();
|
|
6504
|
-
return
|
|
6521
|
+
return yo({
|
|
6505
6522
|
attachmentId: t,
|
|
6506
6523
|
name: i.name,
|
|
6507
6524
|
mimeType: i.mimeType,
|
|
@@ -6531,7 +6548,7 @@ class vt {
|
|
|
6531
6548
|
attachment: t,
|
|
6532
6549
|
clientMessageId: i
|
|
6533
6550
|
}) {
|
|
6534
|
-
const n = this.state.sessionId, r =
|
|
6551
|
+
const n = this.state.sessionId, r = ys(e), o = {
|
|
6535
6552
|
sessionId: n ?? void 0,
|
|
6536
6553
|
attachmentId: t.id,
|
|
6537
6554
|
clientId: this.options.clientId,
|
|
@@ -6540,7 +6557,7 @@ class vt {
|
|
|
6540
6557
|
mimeType: r,
|
|
6541
6558
|
sizeBytes: e.size,
|
|
6542
6559
|
page: W(),
|
|
6543
|
-
model:
|
|
6560
|
+
model: Be(this.clientRuntime, this.modelClientScopeId).selectedModel,
|
|
6544
6561
|
metadata: pi(this.options.metadata),
|
|
6545
6562
|
entrySurface: this.options.entrySurface
|
|
6546
6563
|
};
|
|
@@ -6567,7 +6584,7 @@ class vt {
|
|
|
6567
6584
|
}, "Failed to upload attachment"), a = l;
|
|
6568
6585
|
}
|
|
6569
6586
|
const c = En(a.attachment, this.options.backendUrl);
|
|
6570
|
-
return i && this.cancelledSubmissions.has(i) || (this.setState({ sessionId: a.sessionId }), this.updateAttachmentInState(t.id, c), t.id &&
|
|
6587
|
+
return i && this.cancelledSubmissions.has(i) || (this.setState({ sessionId: a.sessionId }), this.updateAttachmentInState(t.id, c), t.id && mo(t.id, {
|
|
6571
6588
|
sessionId: a.sessionId,
|
|
6572
6589
|
fileUrl: c.fileUrl,
|
|
6573
6590
|
sandboxPath: c.sandboxPath,
|
|
@@ -6598,7 +6615,7 @@ class vt {
|
|
|
6598
6615
|
const i = await this.fetchEmbedAttachmentUpload(e, !1);
|
|
6599
6616
|
if (i.ok)
|
|
6600
6617
|
return await i.json();
|
|
6601
|
-
if (
|
|
6618
|
+
if (Cl(i.status) && this.options.tokenProvider && !t) {
|
|
6602
6619
|
t = !0;
|
|
6603
6620
|
const n = await this.fetchEmbedAttachmentUpload(e, !0);
|
|
6604
6621
|
if (n.ok)
|
|
@@ -6660,7 +6677,7 @@ class vt {
|
|
|
6660
6677
|
}), this.stoppedTurns.splice(0, Math.max(0, this.stoppedTurns.length - 20));
|
|
6661
6678
|
for (const [n, r] of this.activeBrowserToolCalls)
|
|
6662
6679
|
r.event.sessionId === this.state.sessionId && this.activeBrowserToolCalls.delete(n);
|
|
6663
|
-
Ui(this.options.clientId, this.activeBrowserToolCalls.values()), this.setState(
|
|
6680
|
+
Ui(this.options.clientId, this.activeBrowserToolCalls.values()), this.setState(Gt({
|
|
6664
6681
|
...this.state,
|
|
6665
6682
|
messages: Ei(
|
|
6666
6683
|
this.state.messages,
|
|
@@ -6740,7 +6757,7 @@ class vt {
|
|
|
6740
6757
|
isPinned: !1
|
|
6741
6758
|
}]),
|
|
6742
6759
|
...o.filter((u) => !a.has(u)).map((u) => [u, this.toSessionHistoryEntry(e.entities[u])])
|
|
6743
|
-
]), d =
|
|
6760
|
+
]), d = Nr(n);
|
|
6744
6761
|
return {
|
|
6745
6762
|
key: `${this.options.clientId}:recent`,
|
|
6746
6763
|
status: d?.status ?? "not_requested",
|
|
@@ -6777,7 +6794,7 @@ class vt {
|
|
|
6777
6794
|
sessionId: e,
|
|
6778
6795
|
requestId: i,
|
|
6779
6796
|
patch: { pinned: t }
|
|
6780
|
-
}), await
|
|
6797
|
+
}), await Fs({
|
|
6781
6798
|
runtime: this.clientRuntime,
|
|
6782
6799
|
authority: this.directoryAuthority,
|
|
6783
6800
|
sessionId: e,
|
|
@@ -6797,7 +6814,7 @@ class vt {
|
|
|
6797
6814
|
sessionId: e,
|
|
6798
6815
|
requestId: i,
|
|
6799
6816
|
patch: { title: t }
|
|
6800
|
-
}), await
|
|
6817
|
+
}), await Fs({
|
|
6801
6818
|
runtime: this.clientRuntime,
|
|
6802
6819
|
authority: this.directoryAuthority,
|
|
6803
6820
|
sessionId: e,
|
|
@@ -6845,7 +6862,7 @@ class vt {
|
|
|
6845
6862
|
throw new Error("This interaction is no longer available.");
|
|
6846
6863
|
if (!r.allowedActions.includes(t))
|
|
6847
6864
|
throw new Error("This action is not available for the interaction.");
|
|
6848
|
-
if (
|
|
6865
|
+
if (da(t) && await this.interactionManager.act(
|
|
6849
6866
|
{
|
|
6850
6867
|
key: r.id,
|
|
6851
6868
|
category: r.category,
|
|
@@ -6900,7 +6917,7 @@ class vt {
|
|
|
6900
6917
|
this.rebuildRuntimeInteractions();
|
|
6901
6918
|
}
|
|
6902
6919
|
rebuildRuntimeInteractions() {
|
|
6903
|
-
const e = [], t = this.options.productVariant === "personal" && (this.options.entrySurface === "main_web_chat" || this.options.entrySurface === "automation") ?
|
|
6920
|
+
const e = [], t = this.options.productVariant === "personal" && (this.options.entrySurface === "main_web_chat" || this.options.entrySurface === "automation") ? vo(this.state.messages) : null;
|
|
6904
6921
|
if (t) {
|
|
6905
6922
|
const n = {
|
|
6906
6923
|
key: t.id,
|
|
@@ -7028,7 +7045,7 @@ class vt {
|
|
|
7028
7045
|
if (Object.values(this.clientRuntime.engine.getProjection().directory.optimisticEntries).some((c) => c.id === e && c.sessionId === null)) return;
|
|
7029
7046
|
const t = L(), i = this.activeComposerWarmupId, n = this.pendingClientMessageId;
|
|
7030
7047
|
this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages);
|
|
7031
|
-
const r = this.getCachedSessionTimeline(e), o = [...r ?? []].reverse().find((c) => c.dataType === "assistant_draft" && c.steered !== !0), a =
|
|
7048
|
+
const r = this.getCachedSessionTimeline(e), o = [...r ?? []].reverse().find((c) => c.dataType === "assistant_draft" && c.steered !== !0), a = Gc(r ?? []);
|
|
7032
7049
|
if (!this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId !== e && this.rememberCurrentRunAsDetached(), this.detachedSessionIds.delete(e), this.deferredDetachedSessionEvents.delete(e), !this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId && (this.state.isThinking || this.state.pendingMessageStatus !== null)) {
|
|
7033
7050
|
const c = this.getStopClientMessageId();
|
|
7034
7051
|
c && this.send({ type: "run.stop", sessionId: this.state.sessionId, expectedUserMessageId: c, reason: "session_switch" });
|
|
@@ -7140,7 +7157,7 @@ class vt {
|
|
|
7140
7157
|
try {
|
|
7141
7158
|
return await this.fetchSessionHistoryPageOnce(e, t, i);
|
|
7142
7159
|
} catch (o) {
|
|
7143
|
-
if (o instanceof
|
|
7160
|
+
if (o instanceof Qe)
|
|
7144
7161
|
throw o;
|
|
7145
7162
|
M("web-sdk.history", "HTTP session history page failed; retrying", {
|
|
7146
7163
|
sessionId: e,
|
|
@@ -7154,7 +7171,7 @@ class vt {
|
|
|
7154
7171
|
async fetchSessionHistoryPageOnce(e, t, i, n = !1) {
|
|
7155
7172
|
const r = await this.acquireToken("history", { preferCached: n });
|
|
7156
7173
|
if (!r)
|
|
7157
|
-
throw new
|
|
7174
|
+
throw new Qe("Product Agent history requires authentication");
|
|
7158
7175
|
this.token = r;
|
|
7159
7176
|
const o = new URLSearchParams({ limit: "200" });
|
|
7160
7177
|
i && o.set("cursor", i);
|
|
@@ -7168,11 +7185,11 @@ class vt {
|
|
|
7168
7185
|
});
|
|
7169
7186
|
if (!l.ok) {
|
|
7170
7187
|
const u = await l.text() || `History request failed (${l.status})`;
|
|
7171
|
-
throw
|
|
7188
|
+
throw ha(l.status) ? new Error(u) : new Qe(u);
|
|
7172
7189
|
}
|
|
7173
7190
|
const d = await l.json();
|
|
7174
7191
|
if (!d?.session || !Array.isArray(d.items))
|
|
7175
|
-
throw new
|
|
7192
|
+
throw new Qe("Invalid Product Agent session history response");
|
|
7176
7193
|
return {
|
|
7177
7194
|
session: d.session,
|
|
7178
7195
|
items: d.items,
|
|
@@ -7231,7 +7248,7 @@ class vt {
|
|
|
7231
7248
|
})), !0;
|
|
7232
7249
|
}
|
|
7233
7250
|
try {
|
|
7234
|
-
return t.send(JSON.stringify(e)),
|
|
7251
|
+
return t.send(JSON.stringify(e)), Ce("client_event", e.type, Nt(e)), !0;
|
|
7235
7252
|
} catch (i) {
|
|
7236
7253
|
return M("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
|
|
7237
7254
|
message: i instanceof Error ? i.message : String(i),
|
|
@@ -7254,7 +7271,7 @@ class vt {
|
|
|
7254
7271
|
occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7255
7272
|
source: "web_sdk",
|
|
7256
7273
|
entrySurface: this.options.entrySurface,
|
|
7257
|
-
...e === "first_response_slow" ? { responseDiagnostics:
|
|
7274
|
+
...e === "first_response_slow" ? { responseDiagnostics: Gr(
|
|
7258
7275
|
this,
|
|
7259
7276
|
this.options.entrySurface,
|
|
7260
7277
|
this.state.sessionId,
|
|
@@ -7270,7 +7287,7 @@ class vt {
|
|
|
7270
7287
|
...this.activeResponseRunId ? { runId: this.activeResponseRunId } : {},
|
|
7271
7288
|
...t
|
|
7272
7289
|
}, { responseDiagnostics: r, ...o } = n;
|
|
7273
|
-
if (
|
|
7290
|
+
if (Ce("client_event", "runtime.health", { ...o, signalName: e }), this.options.productVariant === "customer_embedded" || !this.socket || this.socket.readyState !== WebSocket.OPEN || this.authenticatedSocket !== this.socket) {
|
|
7274
7291
|
this.queueHealthDiagnostic(n);
|
|
7275
7292
|
return;
|
|
7276
7293
|
}
|
|
@@ -7294,7 +7311,7 @@ class vt {
|
|
|
7294
7311
|
missedResponseChecks: i,
|
|
7295
7312
|
timer: window.setTimeout(() => this.recordFirstResponseMiss(e), Math.max(
|
|
7296
7313
|
0,
|
|
7297
|
-
n + (i + 1) *
|
|
7314
|
+
n + (i + 1) * Lt - Date.now()
|
|
7298
7315
|
))
|
|
7299
7316
|
});
|
|
7300
7317
|
}
|
|
@@ -7305,12 +7322,12 @@ class vt {
|
|
|
7305
7322
|
const i = Date.now() - t.submittedAt;
|
|
7306
7323
|
if (t.missedResponseChecks = Math.min(
|
|
7307
7324
|
Je,
|
|
7308
|
-
Math.max(t.missedResponseChecks + 1, Math.floor(i /
|
|
7325
|
+
Math.max(t.missedResponseChecks + 1, Math.floor(i / Lt))
|
|
7309
7326
|
), this.persistCurrentPendingDeliveryRecovery(), t.missedResponseChecks >= Je) {
|
|
7310
7327
|
this.reportFirstResponseSlow(e);
|
|
7311
7328
|
return;
|
|
7312
7329
|
}
|
|
7313
|
-
const n = t.submittedAt + (t.missedResponseChecks + 1) *
|
|
7330
|
+
const n = t.submittedAt + (t.missedResponseChecks + 1) * Lt;
|
|
7314
7331
|
t.timer = window.setTimeout(
|
|
7315
7332
|
() => this.recordFirstResponseMiss(e),
|
|
7316
7333
|
Math.max(0, n - Date.now())
|
|
@@ -7459,7 +7476,7 @@ class vt {
|
|
|
7459
7476
|
if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
|
|
7460
7477
|
return;
|
|
7461
7478
|
this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
|
|
7462
|
-
const e =
|
|
7479
|
+
const e = cc();
|
|
7463
7480
|
this.sendNow(
|
|
7464
7481
|
V({
|
|
7465
7482
|
type: "starter_prompts.page_context",
|
|
@@ -7470,13 +7487,13 @@ class vt {
|
|
|
7470
7487
|
) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
|
|
7471
7488
|
}
|
|
7472
7489
|
startStarterPromptUrlWatcher() {
|
|
7473
|
-
this.locationChangeCleanup || (this.locationChangeCleanup =
|
|
7490
|
+
this.locationChangeCleanup || (this.locationChangeCleanup = lc(() => this.handleStarterPromptUrlChange()));
|
|
7474
7491
|
}
|
|
7475
7492
|
handleStarterPromptUrlChange() {
|
|
7476
7493
|
const e = location.href;
|
|
7477
7494
|
e !== this.lastStarterPromptPageUrl && (this.activeComposerWarmupScope && !this.activeComposerWarmupScope.endsWith(`:${e}`) && this.clearPendingComposerWarmup(), this.lastStarterPromptPageUrl = e, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
|
|
7478
7495
|
this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
|
|
7479
|
-
},
|
|
7496
|
+
}, Oa));
|
|
7480
7497
|
}
|
|
7481
7498
|
refreshStarterPromptsForCurrentUrl() {
|
|
7482
7499
|
this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
|
|
@@ -7502,7 +7519,7 @@ class vt {
|
|
|
7502
7519
|
}
|
|
7503
7520
|
}
|
|
7504
7521
|
resetForAuthenticationScopeChange() {
|
|
7505
|
-
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();
|
|
7522
|
+
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(), this.assistantDeltaReplayGuard.clear();
|
|
7506
7523
|
}
|
|
7507
7524
|
applyAuthenticatedDirectoryIdentity(e) {
|
|
7508
7525
|
const t = wi(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));
|
|
@@ -7520,11 +7537,11 @@ class vt {
|
|
|
7520
7537
|
}
|
|
7521
7538
|
rememberSessionTimeline(e, t) {
|
|
7522
7539
|
const i = [...t];
|
|
7523
|
-
for (this.sessionTimelineCache.delete(e), this.sessionTimelineCache.set(e, i); this.sessionTimelineCache.size >
|
|
7540
|
+
for (this.sessionTimelineCache.delete(e), this.sessionTimelineCache.set(e, i); this.sessionTimelineCache.size > qa; ) {
|
|
7524
7541
|
const n = this.sessionTimelineCache.keys().next().value;
|
|
7525
7542
|
if (!n)
|
|
7526
7543
|
break;
|
|
7527
|
-
this.sessionTimelineCache.delete(n);
|
|
7544
|
+
this.sessionTimelineCache.delete(n), this.assistantDeltaReplayGuard.forget(n);
|
|
7528
7545
|
}
|
|
7529
7546
|
}
|
|
7530
7547
|
getCachedSessionTimeline(e) {
|
|
@@ -7550,8 +7567,8 @@ class vt {
|
|
|
7550
7567
|
return;
|
|
7551
7568
|
this.clearPendingWarmupAckTimer();
|
|
7552
7569
|
const t = Math.min(
|
|
7553
|
-
|
|
7554
|
-
|
|
7570
|
+
wa * 2 ** e.retryAttempt,
|
|
7571
|
+
ba
|
|
7555
7572
|
);
|
|
7556
7573
|
e.retryAttempt += 1, this.pendingWarmupAckTimer = window.setTimeout(() => {
|
|
7557
7574
|
this.pendingWarmupAckTimer = null, this.flushPendingComposerWarmup();
|
|
@@ -7572,7 +7589,7 @@ class vt {
|
|
|
7572
7589
|
}
|
|
7573
7590
|
rememberDurablyStoppedTurn(e, t) {
|
|
7574
7591
|
const i = q(t);
|
|
7575
|
-
if (!e || !i || !
|
|
7592
|
+
if (!e || !i || !xe(i) || this.findStoppedTurn(e, i))
|
|
7576
7593
|
return;
|
|
7577
7594
|
const n = j(i), r = E(i), o = typeof i.clientMessageId == "string" ? i.clientMessageId : n ? this.clientMessageIdsByUserMessageItemId.get(n) ?? null : null;
|
|
7578
7595
|
this.stoppedTurns.push({
|
|
@@ -7595,7 +7612,7 @@ class vt {
|
|
|
7595
7612
|
if (!e || !t)
|
|
7596
7613
|
return;
|
|
7597
7614
|
const i = this.findStoppedTurn(e, t);
|
|
7598
|
-
!i || i.reason !== "task_tab_closed" ||
|
|
7615
|
+
!i || i.reason !== "task_tab_closed" || zo(i, t) && (this.stoppedTurns.splice(this.stoppedTurns.indexOf(i), 1), i.stoppedItemId && this.setState({
|
|
7599
7616
|
messages: this.state.messages.filter((n) => n.id !== i.stoppedItemId)
|
|
7600
7617
|
}));
|
|
7601
7618
|
}
|
|
@@ -7604,12 +7621,12 @@ class vt {
|
|
|
7604
7621
|
const i = typeof e.callId == "string" ? e.callId : null;
|
|
7605
7622
|
return !!(i && this.stoppedTurns.some((n) => n.toolCallIds.has(i)));
|
|
7606
7623
|
}
|
|
7607
|
-
return this.findStoppedTurnForEvent(e) ? e.type === "session.item" ? !
|
|
7624
|
+
return this.findStoppedTurnForEvent(e) ? e.type === "session.item" ? !xe(q(e.item)) : e.type !== "conversation.state" : !1;
|
|
7608
7625
|
}
|
|
7609
7626
|
filterStoppedSnapshotItems(e, t) {
|
|
7610
7627
|
return e.filter((i) => {
|
|
7611
7628
|
const n = q(i), r = n ? this.findStoppedTurn(t, n) : null;
|
|
7612
|
-
if (!r || n?.type === "message" && n.role === "user" ||
|
|
7629
|
+
if (!r || n?.type === "message" && n.role === "user" || xe(n))
|
|
7613
7630
|
return !0;
|
|
7614
7631
|
if (r.stoppedCausalSequence !== null) {
|
|
7615
7632
|
const o = n ? F(n) : null;
|
|
@@ -7623,7 +7640,7 @@ class vt {
|
|
|
7623
7640
|
});
|
|
7624
7641
|
}
|
|
7625
7642
|
handleServerEvent(e) {
|
|
7626
|
-
if (
|
|
7643
|
+
if (Ce("server_event", e.type, Nt(e)), e.type === "session.subscribed") {
|
|
7627
7644
|
const c = typeof e.requestId == "string" ? e.requestId : null, l = typeof e.sessionId == "string" ? e.sessionId : null;
|
|
7628
7645
|
if (c && l && c === this.pendingSessionSubscription?.requestId && l === this.pendingSessionSubscription.sessionId) {
|
|
7629
7646
|
const d = this.pendingSessionSubscription;
|
|
@@ -7640,7 +7657,7 @@ class vt {
|
|
|
7640
7657
|
this.pendingDeliveryReconciliationRequestId = null, this.pendingDeliveryRetryTimer !== null && (window.clearTimeout(this.pendingDeliveryRetryTimer), this.pendingDeliveryRetryTimer = null), this.flushQueuedClientEvents();
|
|
7641
7658
|
return;
|
|
7642
7659
|
}
|
|
7643
|
-
if (this.sessionHistoryHydration &&
|
|
7660
|
+
if (this.sessionHistoryHydration && Pe(e) && J(e) === this.sessionHistoryHydration.sessionId)
|
|
7644
7661
|
return this.sessionHistoryHydration.bufferedEvents.push(e), !0;
|
|
7645
7662
|
if (e.type === "session.item") {
|
|
7646
7663
|
const c = A(e.item, "sessionId") ?? this.state.sessionId;
|
|
@@ -7717,10 +7734,18 @@ class vt {
|
|
|
7717
7734
|
}
|
|
7718
7735
|
if (this.shouldIgnoreStoppedTurnEvent(e))
|
|
7719
7736
|
return;
|
|
7737
|
+
if (e.type === "chat.assistant_delta" && !this.assistantDeltaReplayGuard.accept({
|
|
7738
|
+
sessionId: e.sessionId,
|
|
7739
|
+
runId: e.runId,
|
|
7740
|
+
e2bEventSequence: e.e2bEventSequence
|
|
7741
|
+
})) {
|
|
7742
|
+
Ce("server_event", "assistant_delta_replay_ignored", Nt(e));
|
|
7743
|
+
return;
|
|
7744
|
+
}
|
|
7720
7745
|
const t = this.shouldIgnoreBackgroundSessionEvent(e);
|
|
7721
7746
|
this.updateInactiveSessionTimelineCache(e);
|
|
7722
7747
|
const i = J(e);
|
|
7723
|
-
if (i && this.backgroundSessionIds.has(i) &&
|
|
7748
|
+
if (i && this.backgroundSessionIds.has(i) && Kt(this.sessionTimelineCache.get(i) ?? []) && (this.backgroundSessionIds.delete(i), this.clientRuntime.engine.dispatch({
|
|
7724
7749
|
...this.directoryAuthority,
|
|
7725
7750
|
type: "directory.activity_set",
|
|
7726
7751
|
sessionId: i,
|
|
@@ -7747,19 +7772,19 @@ class vt {
|
|
|
7747
7772
|
this.activeResponseRunId = c, this.setState({ turnPhase: "thinking", lastError: null }), this.markThinkingProgress();
|
|
7748
7773
|
return;
|
|
7749
7774
|
}
|
|
7750
|
-
if (
|
|
7775
|
+
if (ja(e) && this.markThinkingProgress(), e.type === "auth.ok") {
|
|
7751
7776
|
this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.transportDiagnosticEpisodes.clear();
|
|
7752
7777
|
const c = wi(e.user);
|
|
7753
7778
|
this.applyAuthenticatedDirectoryIdentity(e.user), this.authenticatedSocket = this.socket, this.directoryObservation.reconnect().catch(() => {
|
|
7754
7779
|
}), this.flushPendingWidgetLifecycleEvents(), this.flushPendingComposerWarmup(), this.pendingClientMessageId && this.state.sessionId && this.pendingDeliveryIssued ? (this.requestPendingDeliveryReconciliation(), this.pendingDeliveryRetryTimer = window.setTimeout(() => {
|
|
7755
7780
|
this.pendingDeliveryRetryTimer = null, this.pendingDeliveryReconciliationRequestId = null, this.flushQueuedClientEvents();
|
|
7756
7781
|
}, di)) : this.flushQueuedClientEvents(), this.flushPendingPassiveWarmup(), this.startHeartbeat();
|
|
7757
|
-
const l =
|
|
7782
|
+
const l = Sc(e), d = Object.prototype.hasOwnProperty.call(e, "appearance");
|
|
7758
7783
|
M("web-sdk.agent", "Received auth.ok appearance", {
|
|
7759
7784
|
hasAppearance: d,
|
|
7760
7785
|
rawAppearance: e.appearance,
|
|
7761
7786
|
normalizedAppearance: l
|
|
7762
|
-
}), this.runtimeHelperJavascript =
|
|
7787
|
+
}), this.runtimeHelperJavascript = wc(e.runtimeHelpers)?.javascript ?? null;
|
|
7763
7788
|
const u = Ii(e, "starterPrompts"), h = Object.prototype.hasOwnProperty.call(e, "starterPrompts"), p = e.starterPromptsLoading === !0, f = {
|
|
7764
7789
|
user: c,
|
|
7765
7790
|
status: "connected",
|
|
@@ -7769,11 +7794,11 @@ class vt {
|
|
|
7769
7794
|
type: "runtime.auth_ack",
|
|
7770
7795
|
connectionAttempt: this.connectionAttemptId,
|
|
7771
7796
|
entrySurface: this.options.entrySurface
|
|
7772
|
-
}), h && u.length === 0 && !p &&
|
|
7797
|
+
}), h && u.length === 0 && !p && !$t() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
|
|
7773
7798
|
type: "page.upsert",
|
|
7774
7799
|
sessionId: this.state.sessionId,
|
|
7775
7800
|
page: W(),
|
|
7776
|
-
model:
|
|
7801
|
+
model: Be(this.clientRuntime, this.modelClientScopeId).selectedModel
|
|
7777
7802
|
});
|
|
7778
7803
|
return;
|
|
7779
7804
|
}
|
|
@@ -7793,7 +7818,7 @@ class vt {
|
|
|
7793
7818
|
return;
|
|
7794
7819
|
}
|
|
7795
7820
|
if (e.type === "conversation.state") {
|
|
7796
|
-
const c = Array.isArray(e.items) ? e.items : [], l =
|
|
7821
|
+
const c = Array.isArray(e.items) ? e.items : [], l = Zs(c), d = Object.prototype.hasOwnProperty.call(
|
|
7797
7822
|
e,
|
|
7798
7823
|
"activeScheduledFollowUps"
|
|
7799
7824
|
), u = A(e.session, "id") ?? this.state.sessionId;
|
|
@@ -7814,7 +7839,7 @@ class vt {
|
|
|
7814
7839
|
runId: y?.runId
|
|
7815
7840
|
}), S = this.filterStoppedSnapshotItems(l, u), P = e.pendingMessageStatus === "sending" ? "sending" : e.pendingMessageStatus === "queued" ? "reconnecting" : null, D = typeof e.pendingClientMessageId == "string" ? e.pendingClientMessageId : null, k = e.isRetrying === !0, R = e.turnPhase === "sending" || e.turnPhase === "starting" || e.turnPhase === "thinking" ? e.turnPhase : null;
|
|
7816
7841
|
P && D && (this.pendingClientMessageId = D);
|
|
7817
|
-
let b =
|
|
7842
|
+
let b = Cc(
|
|
7818
7843
|
e.assistantDraft
|
|
7819
7844
|
);
|
|
7820
7845
|
b && this.findStoppedTurn(u, {
|
|
@@ -7823,28 +7848,28 @@ class vt {
|
|
|
7823
7848
|
}) && (b = void 0);
|
|
7824
7849
|
const B = b !== void 0;
|
|
7825
7850
|
this.rememberUserMessageClientMessageIds(S);
|
|
7826
|
-
const se =
|
|
7851
|
+
const se = $c(S), He = S.filter((H) => {
|
|
7827
7852
|
const K = q(H);
|
|
7828
|
-
return
|
|
7829
|
-
}), be =
|
|
7853
|
+
return jc(K) ? !1 : !K || !se || !Le(K) ? !0 : hs(S, K) !== se;
|
|
7854
|
+
}), be = ls(
|
|
7830
7855
|
this.state.messages,
|
|
7831
|
-
|
|
7832
|
-
), ue =
|
|
7856
|
+
zt(He, this.options.backendUrl)
|
|
7857
|
+
), ue = Kt(be), he = B ? b?.content ?? "" : this.state.assistantDraft, ve = B ? b?.itemId ?? null : this.state.assistantDraftItemId, $e = B ? b?.respondsToUserMessageId ?? null : this.state.assistantDraftRespondsToUserMessageId, We = B ? b?.runId ?? null : this.state.assistantDraftRunId, pe = S.some(
|
|
7833
7858
|
(H, K) => Ai(
|
|
7834
7859
|
q(H),
|
|
7835
7860
|
he,
|
|
7836
7861
|
ve,
|
|
7837
|
-
He,
|
|
7838
7862
|
$e,
|
|
7839
|
-
|
|
7863
|
+
We,
|
|
7864
|
+
Wc(S, K)
|
|
7840
7865
|
)
|
|
7841
7866
|
), Te = B ? b?.content ?? "" : this.state.assistantDraft, _e = !!b?.content && !pe;
|
|
7842
7867
|
this.promotePendingDeliveryFromSnapshotResponseEvidence(S, u);
|
|
7843
|
-
const Z = ue && (!Te || pe), ae =
|
|
7844
|
-
if (!ue &&
|
|
7868
|
+
const Z = ue && (!Te || pe), ae = Lc(be), Re = Z && ae ? "completed" : m ? "stopped" : Z ? "failed" : null;
|
|
7869
|
+
if (!ue && Hc(this.state.messages, S))
|
|
7845
7870
|
return;
|
|
7846
|
-
this.lastUserMessagePageUrl =
|
|
7847
|
-
const ce = Z || m ? null :
|
|
7871
|
+
this.lastUserMessagePageUrl = Fc(S);
|
|
7872
|
+
const ce = Z || m ? null : us(S);
|
|
7848
7873
|
if (this.latestRecoverableClientMessageId = ce, ae && this.clearRetryTimers(), this.setState({
|
|
7849
7874
|
sessionId: A(e.session, "id") ?? this.state.sessionId,
|
|
7850
7875
|
messages: be,
|
|
@@ -7911,12 +7936,12 @@ class vt {
|
|
|
7911
7936
|
const c = typeof e.requestId == "string" ? e.requestId : null, l = typeof e.sessionId == "string" ? e.sessionId : null;
|
|
7912
7937
|
if (!c || l !== this.state.sessionId)
|
|
7913
7938
|
return;
|
|
7914
|
-
const d =
|
|
7939
|
+
const d = zt(
|
|
7915
7940
|
Array.isArray(e.items) ? e.items : [],
|
|
7916
7941
|
this.options.backendUrl
|
|
7917
7942
|
);
|
|
7918
7943
|
c === this.sessionActivityRequestId && (this.sessionActivityRequestId = null), this.setState({
|
|
7919
|
-
messages:
|
|
7944
|
+
messages: qc(this.state.messages, d)
|
|
7920
7945
|
});
|
|
7921
7946
|
return;
|
|
7922
7947
|
}
|
|
@@ -7945,7 +7970,7 @@ class vt {
|
|
|
7945
7970
|
if (e.type === "session.item") {
|
|
7946
7971
|
this.rememberUserMessageClientMessageIds([e.item]);
|
|
7947
7972
|
const c = q(e.item);
|
|
7948
|
-
if (
|
|
7973
|
+
if (Le(c)) {
|
|
7949
7974
|
typeof c?.runId == "string" && this.retryableFailureRunIdsAwaitingDone.add(c.runId);
|
|
7950
7975
|
const d = c ? j(c) : null, u = d ? this.clientMessageIdsByUserMessageItemId.get(d) : null, h = typeof c?.clientMessageId == "string" ? c.clientMessageId : u ?? (d ? null : this.activeClientMessageId ?? this.latestRecoverableClientMessageId);
|
|
7951
7976
|
h && (this.retryableClientMessageId = h);
|
|
@@ -7953,9 +7978,9 @@ class vt {
|
|
|
7953
7978
|
}
|
|
7954
7979
|
const l = ft(e.item, this.options.backendUrl);
|
|
7955
7980
|
if (l) {
|
|
7956
|
-
const d =
|
|
7957
|
-
l.callId && u !== void 0 && (l.loading = u, this.pendingToolLoadingByCallId.delete(l.callId)), X(l) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()),
|
|
7958
|
-
const h =
|
|
7981
|
+
const d = Jc(c, l), u = l.callId ? this.pendingToolLoadingByCallId.get(l.callId) : void 0;
|
|
7982
|
+
l.callId && u !== void 0 && (l.loading = u, this.pendingToolLoadingByCallId.delete(l.callId)), X(l) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), Kc(c) && this.clearRunAckResyncRetryTimer();
|
|
7983
|
+
const h = xe(c) ? this.state.messages.filter((y) => !(y.id.startsWith("local-interrupted:") && y.respondsToUserMessageId === l.respondsToUserMessageId)) : this.state.messages, p = Oe(h, l), f = Kt(p), g = Ai(
|
|
7959
7984
|
c,
|
|
7960
7985
|
this.state.assistantDraft,
|
|
7961
7986
|
this.state.assistantDraftItemId,
|
|
@@ -7994,7 +8019,7 @@ class vt {
|
|
|
7994
8019
|
this.clearRunAckResyncRetryTimer();
|
|
7995
8020
|
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
8021
|
this.activeClientMessageId && (this.activeResponseUserMessageId = g, this.activeResponseRunId = I), this.setState({
|
|
7997
|
-
messages:
|
|
8022
|
+
messages: Oe(this.state.messages, {
|
|
7998
8023
|
id: h,
|
|
7999
8024
|
role: "assistant",
|
|
8000
8025
|
content: u,
|
|
@@ -8023,7 +8048,7 @@ class vt {
|
|
|
8023
8048
|
const c = typeof e.sessionId == "string" ? e.sessionId : this.state.sessionId, l = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : null, d = typeof e.runId == "string" ? e.runId : null;
|
|
8024
8049
|
if (!(l && this.state.assistantDraftRespondsToUserMessageId ? l === this.state.assistantDraftRespondsToUserMessageId : !d || !this.state.assistantDraftRunId || d === this.state.assistantDraftRunId))
|
|
8025
8050
|
return;
|
|
8026
|
-
const h = l ? this.clientMessageIdsByUserMessageItemId.get(l) ?? null : null, p = !this.activeClientMessageId || (h ? h === this.activeClientMessageId : this.activeResponseUserMessageId ? !l || l === this.activeResponseUserMessageId : !this.activeResponseRunId || !d || d === this.activeResponseRunId), f =
|
|
8051
|
+
const h = l ? this.clientMessageIdsByUserMessageItemId.get(l) ?? null : null, p = !this.activeClientMessageId || (h ? h === this.activeClientMessageId : this.activeResponseUserMessageId ? !l || l === this.activeResponseUserMessageId : !this.activeResponseRunId || !d || d === this.activeResponseRunId), f = Ys(
|
|
8027
8052
|
this.state.messages.filter(
|
|
8028
8053
|
(g) => g.dataType !== "assistant_draft" || !Ze(
|
|
8029
8054
|
g,
|
|
@@ -8033,7 +8058,7 @@ class vt {
|
|
|
8033
8058
|
),
|
|
8034
8059
|
l,
|
|
8035
8060
|
d,
|
|
8036
|
-
|
|
8061
|
+
ds
|
|
8037
8062
|
);
|
|
8038
8063
|
this.setState({
|
|
8039
8064
|
sessionId: c,
|
|
@@ -8139,13 +8164,13 @@ class vt {
|
|
|
8139
8164
|
return;
|
|
8140
8165
|
}
|
|
8141
8166
|
u && l && d && (this.retryableClientMessageId = d);
|
|
8142
|
-
const h = new Error(typeof e.message == "string" ? e.message : "Pluno error"), p =
|
|
8167
|
+
const h = new Error(typeof e.message == "string" ? e.message : "Pluno error"), p = oc(h.message);
|
|
8143
8168
|
p && console.error(p);
|
|
8144
8169
|
const f = d ?? this.activeClientMessageId, g = typeof e.runId == "string" ? e.runId : null, I = Ei(
|
|
8145
8170
|
this.state.messages,
|
|
8146
8171
|
f,
|
|
8147
8172
|
g
|
|
8148
|
-
), w =
|
|
8173
|
+
), w = Nc(
|
|
8149
8174
|
I,
|
|
8150
8175
|
f,
|
|
8151
8176
|
g
|
|
@@ -8174,7 +8199,7 @@ class vt {
|
|
|
8174
8199
|
}
|
|
8175
8200
|
applyAccountSubmissionError(e) {
|
|
8176
8201
|
if (!this.account || !e) return;
|
|
8177
|
-
const t =
|
|
8202
|
+
const t = Xo(this.account.submissionGate, e);
|
|
8178
8203
|
if (!(t === this.account.submissionGate || t.allowed)) {
|
|
8179
8204
|
this.account = {
|
|
8180
8205
|
...this.account,
|
|
@@ -8192,49 +8217,49 @@ class vt {
|
|
|
8192
8217
|
type: "model.history_received",
|
|
8193
8218
|
clientScopeId: this.modelClientScopeId,
|
|
8194
8219
|
sessionId: t,
|
|
8195
|
-
model:
|
|
8220
|
+
model: rs(n) ? n : void 0
|
|
8196
8221
|
});
|
|
8197
8222
|
}
|
|
8198
8223
|
updateAccountFallbackFromSession(e) {
|
|
8199
|
-
const t = e && typeof e == "object" ? e.metadata : null, i =
|
|
8224
|
+
const t = e && typeof e == "object" ? e.metadata : null, i = Yo(t);
|
|
8200
8225
|
if (this.usingPaidCreditFallback !== i && (this.usingPaidCreditFallback = i, !!this.account)) {
|
|
8201
8226
|
this.account = { ...this.account, usingPaidCreditFallback: i };
|
|
8202
8227
|
for (const n of this.accountListeners) n(this.getAccount());
|
|
8203
8228
|
}
|
|
8204
8229
|
}
|
|
8205
8230
|
shouldIgnoreBackgroundSessionEvent(e) {
|
|
8206
|
-
if (!this.options.keepRunsActiveOnSessionNavigation || !
|
|
8231
|
+
if (!this.options.keepRunsActiveOnSessionNavigation || !Pe(e))
|
|
8207
8232
|
return !1;
|
|
8208
8233
|
const t = J(e);
|
|
8209
8234
|
return t ? this.deferredSessionUpdatedSessionIds.has(t) ? !0 : this.state.sessionId ? t !== this.state.sessionId : this.backgroundSessionIds.has(t) || this.sessionTimelineCache.has(t) : !1;
|
|
8210
8235
|
}
|
|
8211
8236
|
updateInactiveSessionTimelineCache(e) {
|
|
8212
|
-
if (!
|
|
8237
|
+
if (!Pe(e))
|
|
8213
8238
|
return;
|
|
8214
8239
|
const t = J(e);
|
|
8215
8240
|
if (!t || t === this.state.sessionId)
|
|
8216
8241
|
return;
|
|
8217
8242
|
const i = this.sessionTimelineCache.get(t);
|
|
8218
8243
|
if (e.type === "conversation.state") {
|
|
8219
|
-
const n =
|
|
8244
|
+
const n = Zs(
|
|
8220
8245
|
Array.isArray(e.items) ? e.items : []
|
|
8221
|
-
), r =
|
|
8246
|
+
), r = zt(
|
|
8222
8247
|
this.filterStoppedSnapshotItems(n, t),
|
|
8223
8248
|
this.options.backendUrl
|
|
8224
8249
|
);
|
|
8225
8250
|
(i || r.length > 0) && this.rememberSessionTimeline(
|
|
8226
8251
|
t,
|
|
8227
|
-
i ?
|
|
8252
|
+
i ? ls(i, r) : r
|
|
8228
8253
|
);
|
|
8229
8254
|
return;
|
|
8230
8255
|
}
|
|
8231
8256
|
if (i) {
|
|
8232
8257
|
if (e.type === "session.item") {
|
|
8233
8258
|
const n = q(e.item);
|
|
8234
|
-
if (
|
|
8259
|
+
if (Le(n))
|
|
8235
8260
|
return;
|
|
8236
8261
|
const r = ft(e.item, this.options.backendUrl);
|
|
8237
|
-
r && this.rememberSessionTimeline(t,
|
|
8262
|
+
r && this.rememberSessionTimeline(t, Oe(i, r));
|
|
8238
8263
|
return;
|
|
8239
8264
|
}
|
|
8240
8265
|
if (e.type === "tool.call") {
|
|
@@ -8265,7 +8290,7 @@ class vt {
|
|
|
8265
8290
|
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
8291
|
this.rememberSessionTimeline(
|
|
8267
8292
|
t,
|
|
8268
|
-
|
|
8293
|
+
Oe(i, {
|
|
8269
8294
|
id: r,
|
|
8270
8295
|
role: "assistant",
|
|
8271
8296
|
content: c,
|
|
@@ -8280,13 +8305,13 @@ class vt {
|
|
|
8280
8305
|
return;
|
|
8281
8306
|
}
|
|
8282
8307
|
if (e.type === "chat.assistant_done") {
|
|
8283
|
-
const n = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : null, r = typeof e.runId == "string" ? e.runId : null, o =
|
|
8308
|
+
const n = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : null, r = typeof e.runId == "string" ? e.runId : null, o = Ys(
|
|
8284
8309
|
i.filter(
|
|
8285
8310
|
(a) => a.dataType !== "assistant_draft" || !Ze(a, n, r)
|
|
8286
8311
|
),
|
|
8287
8312
|
n,
|
|
8288
8313
|
r,
|
|
8289
|
-
|
|
8314
|
+
ds
|
|
8290
8315
|
);
|
|
8291
8316
|
this.rememberSessionTimeline(
|
|
8292
8317
|
t,
|
|
@@ -8321,13 +8346,13 @@ class vt {
|
|
|
8321
8346
|
}
|
|
8322
8347
|
}
|
|
8323
8348
|
shouldIgnoreDetachedSessionEvent(e) {
|
|
8324
|
-
if (this.options.keepRunsActiveOnSessionNavigation || !
|
|
8349
|
+
if (this.options.keepRunsActiveOnSessionNavigation || !Pe(e))
|
|
8325
8350
|
return !1;
|
|
8326
8351
|
const t = J(e);
|
|
8327
8352
|
return !!(t && this.detachedSessionIds.has(t));
|
|
8328
8353
|
}
|
|
8329
8354
|
shouldDeferDetachedSessionEvent(e) {
|
|
8330
|
-
if (this.options.keepRunsActiveOnSessionNavigation || e.type === "run.ack" || !
|
|
8355
|
+
if (this.options.keepRunsActiveOnSessionNavigation || e.type === "run.ack" || !Pe(e))
|
|
8331
8356
|
return !1;
|
|
8332
8357
|
const t = J(e);
|
|
8333
8358
|
if (!t || t === this.state.sessionId || this.detachedClientMessageIds.size === 0 && !this.deferredDetachedSessionEvents.has(t))
|
|
@@ -8352,7 +8377,7 @@ class vt {
|
|
|
8352
8377
|
const t = typeof e.sessionId == "string" ? e.sessionId : this.state.sessionId, i = typeof e.clientMessageId == "string" ? e.clientMessageId : null;
|
|
8353
8378
|
if (!ki(e, t) || !i)
|
|
8354
8379
|
return !1;
|
|
8355
|
-
if (
|
|
8380
|
+
if ($t())
|
|
8356
8381
|
return this.retryableClientMessageId = i, this.activeClientMessageId = i, this.latestRecoverableClientMessageId = i, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), !0;
|
|
8357
8382
|
if (this.activeClientMessageId = i, this.latestRecoverableClientMessageId = i, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), this.retryTimersByClientMessageId[i] === void 0) {
|
|
8358
8383
|
const n = typeof e.retryAfterMs == "number" ? e.retryAfterMs : 2e3;
|
|
@@ -8383,7 +8408,7 @@ class vt {
|
|
|
8383
8408
|
this.sessionLoadRequestTimer !== null && (window.clearTimeout(this.sessionLoadRequestTimer), this.sessionLoadRequestTimer = null), this.sessionLoadRequestId = null, this.sessionHistoryHydration?.requestId === e && (this.sessionHistoryHydration = null, this.pendingSessionSubscription?.resolve(!1), this.pendingSessionSubscription = null);
|
|
8384
8409
|
}
|
|
8385
8410
|
markThinkingProgress() {
|
|
8386
|
-
!this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(
|
|
8411
|
+
!this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(Ta), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
|
|
8387
8412
|
}
|
|
8388
8413
|
scheduleThinkingWatchdog(e) {
|
|
8389
8414
|
this.thinkingWatchdogTimer !== null && window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = window.setTimeout(() => {
|
|
@@ -8489,7 +8514,7 @@ class vt {
|
|
|
8489
8514
|
return this.pendingClientMessageId === e && this.state.isThinking && this.activeClientMessageId !== null && this.activeClientMessageId !== e;
|
|
8490
8515
|
}
|
|
8491
8516
|
schedulePendingDeliveryAck(e) {
|
|
8492
|
-
this.clearPendingDeliveryTimers(),
|
|
8517
|
+
this.clearPendingDeliveryTimers(), !$t() && (this.pendingDeliveryAckTimer = window.setTimeout(() => {
|
|
8493
8518
|
this.pendingDeliveryAckTimer = null, this.retryPendingDelivery(e);
|
|
8494
8519
|
}, ci));
|
|
8495
8520
|
}
|
|
@@ -8497,7 +8522,7 @@ class vt {
|
|
|
8497
8522
|
if (this.state.status === "closed" || this.pendingClientMessageId !== e || this.state.pendingMessageStatus === null || !this.pendingUserMessageEvent)
|
|
8498
8523
|
return;
|
|
8499
8524
|
const t = this.retryAttemptsByClientMessageId[e] ?? 0;
|
|
8500
|
-
if (t >=
|
|
8525
|
+
if (t >= _a) {
|
|
8501
8526
|
this.failPendingDelivery(e);
|
|
8502
8527
|
return;
|
|
8503
8528
|
}
|
|
@@ -8510,7 +8535,7 @@ class vt {
|
|
|
8510
8535
|
return;
|
|
8511
8536
|
}
|
|
8512
8537
|
this.retryAttemptsByClientMessageId[e] = i, this.pendingDeliveryIssued = !0, this.queuedDeliveryRetryAttempt = null, this.persistCurrentPendingDeliveryRecovery(), this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(e);
|
|
8513
|
-
},
|
|
8538
|
+
}, xa(t, di));
|
|
8514
8539
|
}
|
|
8515
8540
|
requestPendingDeliveryReconciliation() {
|
|
8516
8541
|
if (!this.state.sessionId)
|
|
@@ -8601,7 +8626,7 @@ class vt {
|
|
|
8601
8626
|
),
|
|
8602
8627
|
isThinking: !1,
|
|
8603
8628
|
taskStatus: "failed",
|
|
8604
|
-
lastError:
|
|
8629
|
+
lastError: Ra,
|
|
8605
8630
|
lastErrorCode: "run_recovery_exhausted"
|
|
8606
8631
|
}), this.clearThinkingWatchdog();
|
|
8607
8632
|
return;
|
|
@@ -8632,7 +8657,7 @@ class vt {
|
|
|
8632
8657
|
}
|
|
8633
8658
|
if (this.activeBrowserToolCalls.has(i)) return;
|
|
8634
8659
|
const c = n === "execute_code", l = n === "execute_code_in_browser_tab" && o !== null && typeof o == "object" && o.tabId === "local:current";
|
|
8635
|
-
if (!c && !l || !
|
|
8660
|
+
if (!c && !l || !Il(o)) {
|
|
8636
8661
|
this.setToolMessageLoading(i, !1), this.send({
|
|
8637
8662
|
type: "tool.result",
|
|
8638
8663
|
sessionId: t,
|
|
@@ -8681,7 +8706,7 @@ class vt {
|
|
|
8681
8706
|
let d = null, u;
|
|
8682
8707
|
d = await this.executeRuntimeHelper(), u = await gi(
|
|
8683
8708
|
o,
|
|
8684
|
-
|
|
8709
|
+
tc(e.runtimeContext, this.options.backendUrl)
|
|
8685
8710
|
).catch((h) => ({
|
|
8686
8711
|
ok: !1,
|
|
8687
8712
|
exception: {
|
|
@@ -8694,7 +8719,7 @@ class vt {
|
|
|
8694
8719
|
toolName: n,
|
|
8695
8720
|
summary: o.summary,
|
|
8696
8721
|
rawInput: V(o),
|
|
8697
|
-
rawOutput: V(
|
|
8722
|
+
rawOutput: V(bc(u, d))
|
|
8698
8723
|
}), Ui(this.options.clientId, this.activeBrowserToolCalls.values()));
|
|
8699
8724
|
}
|
|
8700
8725
|
setToolMessageLoading(e, t) {
|
|
@@ -8716,10 +8741,10 @@ class vt {
|
|
|
8716
8741
|
};
|
|
8717
8742
|
}
|
|
8718
8743
|
installSessionBrowserApis() {
|
|
8719
|
-
this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup =
|
|
8744
|
+
this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = za();
|
|
8720
8745
|
}
|
|
8721
8746
|
cleanupSessionBrowserApis() {
|
|
8722
|
-
this.sessionBrowserApisCleanup && (
|
|
8747
|
+
this.sessionBrowserApisCleanup && (Za(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
|
|
8723
8748
|
}
|
|
8724
8749
|
async executeRuntimeHelper() {
|
|
8725
8750
|
if (!this.runtimeHelperJavascript?.trim())
|
|
@@ -8727,15 +8752,15 @@ class vt {
|
|
|
8727
8752
|
const e = await gi({
|
|
8728
8753
|
javascript: this.runtimeHelperJavascript
|
|
8729
8754
|
});
|
|
8730
|
-
return e.ok === !1 ?
|
|
8755
|
+
return e.ok === !1 ? vc(e) : null;
|
|
8731
8756
|
}
|
|
8732
8757
|
enableNetworkCapture() {
|
|
8733
|
-
this.networkCaptureCleanup || (this.networkCaptureCleanup =
|
|
8734
|
-
|
|
8758
|
+
this.networkCaptureCleanup || (this.networkCaptureCleanup = La((e) => {
|
|
8759
|
+
_l(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
|
|
8735
8760
|
}));
|
|
8736
8761
|
}
|
|
8737
8762
|
enqueueNetworkEvent(e) {
|
|
8738
|
-
this.queuedNetworkEvents.length >=
|
|
8763
|
+
this.queuedNetworkEvents.length >= Ma || (this.queuedNetworkEvents.push(Tl(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
|
|
8739
8764
|
this.networkBatchTimer = null;
|
|
8740
8765
|
const t = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
|
|
8741
8766
|
t.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
|
|
@@ -8744,14 +8769,14 @@ class vt {
|
|
|
8744
8769
|
page: W(),
|
|
8745
8770
|
events: t
|
|
8746
8771
|
});
|
|
8747
|
-
},
|
|
8772
|
+
}, ka)));
|
|
8748
8773
|
}
|
|
8749
8774
|
scheduleReconnect(e = 0) {
|
|
8750
8775
|
if (this.reconnectTimer !== null || this.state.status === "closed")
|
|
8751
8776
|
return;
|
|
8752
8777
|
const t = Math.min(
|
|
8753
|
-
|
|
8754
|
-
Math.max(
|
|
8778
|
+
as,
|
|
8779
|
+
Math.max(Ba(this.reconnectAttempts), e)
|
|
8755
8780
|
);
|
|
8756
8781
|
this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
|
|
8757
8782
|
this.reconnectTimer = null, (this.refreshingDefaultCredentials && this.socket instanceof N ? this.refreshDefaultTransportCredentials(this.socket) : this.connect()).catch((n) => {
|
|
@@ -8795,7 +8820,7 @@ class vt {
|
|
|
8795
8820
|
return;
|
|
8796
8821
|
}
|
|
8797
8822
|
if (!hi(t)) {
|
|
8798
|
-
const i =
|
|
8823
|
+
const i = jt(t);
|
|
8799
8824
|
this.socket = null, e.close(), this.refreshingDefaultCredentials = !1, this.setState({ status: "error", lastError: i.message, lastErrorCode: "connection_failed" }), this.emit("error", i);
|
|
8800
8825
|
return;
|
|
8801
8826
|
}
|
|
@@ -8809,8 +8834,8 @@ class vt {
|
|
|
8809
8834
|
const e = this.socket;
|
|
8810
8835
|
!e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
|
|
8811
8836
|
this.socket === e && (M("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
|
|
8812
|
-
},
|
|
8813
|
-
},
|
|
8837
|
+
}, ga));
|
|
8838
|
+
}, fa));
|
|
8814
8839
|
}
|
|
8815
8840
|
stopHeartbeat() {
|
|
8816
8841
|
this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
|
|
@@ -8848,7 +8873,7 @@ class vt {
|
|
|
8848
8873
|
...e.lastError === null && e.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
|
|
8849
8874
|
...e.lastError !== void 0 && e.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
|
|
8850
8875
|
}, a = this.state.sessionId, c = this.state.isThinking || this.state.pendingMessageStatus !== null, l = o.isThinking || o.pendingMessageStatus !== null, d = this.activeClientMessageId ?? this.pendingClientMessageId;
|
|
8851
|
-
d && d === this.lastProjectedTurnClientMessageId && l &&
|
|
8876
|
+
d && d === this.lastProjectedTurnClientMessageId && l && Ha(this.lastProjectedTurnPhase, o.turnPhase) && this.reportHealthSignal("invalid_state_transition", {
|
|
8852
8877
|
clientMessageId: d,
|
|
8853
8878
|
reason: "active_turn_phase_moved_backward",
|
|
8854
8879
|
previousPhase: this.lastProjectedTurnPhase,
|
|
@@ -8859,7 +8884,7 @@ class vt {
|
|
|
8859
8884
|
sessionId: o.sessionId,
|
|
8860
8885
|
active: l
|
|
8861
8886
|
}), this.directoryObservation.focus().catch(() => {
|
|
8862
|
-
})), this.rebuildRuntimeInteractions(), e.messages !== void 0 && this.refreshRuntimeInteractions(), this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages),
|
|
8887
|
+
})), this.rebuildRuntimeInteractions(), e.messages !== void 0 && this.refreshRuntimeInteractions(), this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages), ol(this.options.clientId, this.state), this.emit("state", this.getState()), Ce("state", this.state.status, {
|
|
8863
8888
|
status: this.state.status,
|
|
8864
8889
|
sessionId: this.state.sessionId,
|
|
8865
8890
|
messageCount: this.state.messages.length,
|
|
@@ -8909,14 +8934,14 @@ class vt {
|
|
|
8909
8934
|
this.listeners[e]?.forEach((n) => n(t));
|
|
8910
8935
|
}
|
|
8911
8936
|
}
|
|
8912
|
-
const
|
|
8913
|
-
function
|
|
8914
|
-
const e = window.__plunoProductAgentNetworkCapture ??
|
|
8937
|
+
const Ht = /* @__PURE__ */ new WeakMap();
|
|
8938
|
+
function La(s) {
|
|
8939
|
+
const e = window.__plunoProductAgentNetworkCapture ?? Fa();
|
|
8915
8940
|
return e.subscribers.add(s), () => {
|
|
8916
8941
|
e.subscribers.delete(s), !(e.subscribers.size > 0) && (e.destroy(), window.__plunoProductAgentNetworkCapture === e && delete window.__plunoProductAgentNetworkCapture);
|
|
8917
8942
|
};
|
|
8918
8943
|
}
|
|
8919
|
-
function
|
|
8944
|
+
function Fa() {
|
|
8920
8945
|
const s = /* @__PURE__ */ new Set(), e = (h) => {
|
|
8921
8946
|
s.forEach((p) => {
|
|
8922
8947
|
try {
|
|
@@ -8933,11 +8958,11 @@ function La() {
|
|
|
8933
8958
|
throw w;
|
|
8934
8959
|
}
|
|
8935
8960
|
try {
|
|
8936
|
-
const w = p instanceof Request ? p : null, y =
|
|
8961
|
+
const w = p instanceof Request ? p : null, y = Sl(p, w), m = Pn(f?.headers ?? w?.headers);
|
|
8937
8962
|
if (!fe(y, m, f?.body)) {
|
|
8938
8963
|
const P = {
|
|
8939
|
-
requestId:
|
|
8940
|
-
url: ee(y,
|
|
8964
|
+
requestId: Vt("fetch"),
|
|
8965
|
+
url: ee(y, Ft),
|
|
8941
8966
|
method: (f?.method ?? w?.method ?? "GET").toUpperCase(),
|
|
8942
8967
|
requestHeaders: m,
|
|
8943
8968
|
requestBody: Oi(f?.body),
|
|
@@ -8946,7 +8971,7 @@ function La() {
|
|
|
8946
8971
|
};
|
|
8947
8972
|
I.then(
|
|
8948
8973
|
(D) => {
|
|
8949
|
-
|
|
8974
|
+
wl(D, P, g, e).catch(() => {
|
|
8950
8975
|
e({
|
|
8951
8976
|
...P,
|
|
8952
8977
|
responseStatus: D.status,
|
|
@@ -8968,27 +8993,27 @@ function La() {
|
|
|
8968
8993
|
return I;
|
|
8969
8994
|
}, a = function(p, f, g, I, w) {
|
|
8970
8995
|
const y = i.call(this, p, f, g ?? !0, I ?? void 0, w ?? void 0), m = typeof f == "string" ? f : f.toString();
|
|
8971
|
-
return
|
|
8972
|
-
requestId:
|
|
8996
|
+
return Ht.set(this, {
|
|
8997
|
+
requestId: Vt("xhr"),
|
|
8973
8998
|
method: String(p ?? "GET").toUpperCase(),
|
|
8974
|
-
url: ee(m,
|
|
8999
|
+
url: ee(m, Ft),
|
|
8975
9000
|
requestHeaders: {},
|
|
8976
9001
|
startedAtMs: Date.now(),
|
|
8977
9002
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
8978
9003
|
excluded: fe(m)
|
|
8979
9004
|
}), y;
|
|
8980
9005
|
}, c = function(p, f) {
|
|
8981
|
-
const g = n.call(this, p, f), I =
|
|
8982
|
-
return I && Object.keys(I.requestHeaders).length <
|
|
9006
|
+
const g = n.call(this, p, f), I = Ht.get(this);
|
|
9007
|
+
return I && Object.keys(I.requestHeaders).length < ks && (I.requestHeaders[p] = Ps(p, f), I.excluded = I.excluded || fe(I.url, I.requestHeaders)), g;
|
|
8983
9008
|
}, l = function(p) {
|
|
8984
9009
|
try {
|
|
8985
|
-
const f =
|
|
9010
|
+
const f = Ht.get(this);
|
|
8986
9011
|
f && (f.excluded = f.excluded || fe(f.url, f.requestHeaders, p), f.requestBody = Oi(p), f.excluded || this.addEventListener(
|
|
8987
9012
|
"loadend",
|
|
8988
9013
|
() => {
|
|
8989
9014
|
queueMicrotask(() => {
|
|
8990
9015
|
try {
|
|
8991
|
-
const g =
|
|
9016
|
+
const g = Al(this.getAllResponseHeaders());
|
|
8992
9017
|
e({
|
|
8993
9018
|
requestId: f.requestId,
|
|
8994
9019
|
url: f.url,
|
|
@@ -8998,7 +9023,7 @@ function La() {
|
|
|
8998
9023
|
resourceType: "xhr",
|
|
8999
9024
|
responseStatus: this.status,
|
|
9000
9025
|
responseHeaders: g,
|
|
9001
|
-
responseBody:
|
|
9026
|
+
responseBody: vl(this, g),
|
|
9002
9027
|
errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
|
|
9003
9028
|
startedAt: f.startedAt,
|
|
9004
9029
|
durationMs: Date.now() - f.startedAtMs
|
|
@@ -9039,8 +9064,8 @@ function La() {
|
|
|
9039
9064
|
continue;
|
|
9040
9065
|
const g = performance.timeOrigin + f.startTime;
|
|
9041
9066
|
e({
|
|
9042
|
-
requestId:
|
|
9043
|
-
url: ee(f.name,
|
|
9067
|
+
requestId: Vt("resource"),
|
|
9068
|
+
url: ee(f.name, Ft),
|
|
9044
9069
|
method: "GET",
|
|
9045
9070
|
resourceType: "resource",
|
|
9046
9071
|
responseStatus: f.responseStatus,
|
|
@@ -9094,7 +9119,7 @@ function pi(s) {
|
|
|
9094
9119
|
const e = typeof s == "function" ? s() : s;
|
|
9095
9120
|
return e && Object.keys(e).length > 0 ? e : void 0;
|
|
9096
9121
|
}
|
|
9097
|
-
function
|
|
9122
|
+
function ja(s) {
|
|
9098
9123
|
return s.type === "run.model_started" || s.type === "conversation.state" || s.type === "session.updated" || s.type === "session.item" || s.type === "chat.assistant_delta" || s.type === "chat.assistant_done" || s.type === "tool.call";
|
|
9099
9124
|
}
|
|
9100
9125
|
function fi(s) {
|
|
@@ -9107,7 +9132,7 @@ function fi(s) {
|
|
|
9107
9132
|
const e = q(s.item);
|
|
9108
9133
|
return e ? e.type === "message" && e.role === "assistant" ? typeof e.content == "string" && e.content.trim().length > 0 : e.type === "tool_call" || e.type === "function_call" : !1;
|
|
9109
9134
|
}
|
|
9110
|
-
function
|
|
9135
|
+
function Ha(s, e) {
|
|
9111
9136
|
if (!s || !e)
|
|
9112
9137
|
return !1;
|
|
9113
9138
|
const t = {
|
|
@@ -9117,7 +9142,7 @@ function ja(s, e) {
|
|
|
9117
9142
|
};
|
|
9118
9143
|
return t[e] < t[s];
|
|
9119
9144
|
}
|
|
9120
|
-
function
|
|
9145
|
+
function Pe(s) {
|
|
9121
9146
|
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";
|
|
9122
9147
|
}
|
|
9123
9148
|
function J(s) {
|
|
@@ -9135,27 +9160,27 @@ function J(s) {
|
|
|
9135
9160
|
}
|
|
9136
9161
|
return null;
|
|
9137
9162
|
}
|
|
9138
|
-
const
|
|
9139
|
-
function
|
|
9163
|
+
const $a = 5e3, Wa = 12e4;
|
|
9164
|
+
function za() {
|
|
9140
9165
|
const s = [
|
|
9141
|
-
|
|
9142
|
-
|
|
9166
|
+
Va(),
|
|
9167
|
+
Ka()
|
|
9143
9168
|
].filter((e) => typeof e == "function");
|
|
9144
9169
|
return () => {
|
|
9145
9170
|
for (const e of s.reverse())
|
|
9146
9171
|
e();
|
|
9147
9172
|
};
|
|
9148
9173
|
}
|
|
9149
|
-
function za() {
|
|
9150
|
-
return on(globalThis, "getPageSnapshot", async () => ks());
|
|
9151
|
-
}
|
|
9152
9174
|
function Ka() {
|
|
9175
|
+
return on(globalThis, "getPageSnapshot", async () => Ms());
|
|
9176
|
+
}
|
|
9177
|
+
function Va() {
|
|
9153
9178
|
return on(globalThis, "pageImages", {
|
|
9154
|
-
inspectImage: async (e, t) => await
|
|
9179
|
+
inspectImage: async (e, t) => await Ga(e, t)
|
|
9155
9180
|
});
|
|
9156
9181
|
}
|
|
9157
|
-
async function
|
|
9158
|
-
const t =
|
|
9182
|
+
async function Ga(s, e = {}) {
|
|
9183
|
+
const t = Ya(e.name), i = await Qa(s);
|
|
9159
9184
|
return i.ok ? i.sizeBytes > 8 * 1024 * 1024 ? {
|
|
9160
9185
|
type: "pluno.pageImages.inspectImage",
|
|
9161
9186
|
imageAttached: !1,
|
|
@@ -9178,10 +9203,10 @@ async function Qa(s) {
|
|
|
9178
9203
|
ok: !0,
|
|
9179
9204
|
mimeType: s.type,
|
|
9180
9205
|
sizeBytes: s.size,
|
|
9181
|
-
dataUrl: await
|
|
9182
|
-
} : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof s != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } :
|
|
9206
|
+
dataUrl: await ec(s)
|
|
9207
|
+
} : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof s != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : Ja(s);
|
|
9183
9208
|
}
|
|
9184
|
-
function
|
|
9209
|
+
function Ja(s) {
|
|
9185
9210
|
if (!s.startsWith("data:") || !s.includes(","))
|
|
9186
9211
|
return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
|
|
9187
9212
|
const [e, t] = s.slice(5).split(",", 2), i = e.split(";").map((a) => a.trim()).filter(Boolean), n = i[0] ?? "";
|
|
@@ -9192,7 +9217,7 @@ function Ga(s) {
|
|
|
9192
9217
|
const r = t.replace(/[ \t\r\n\f]+/g, "");
|
|
9193
9218
|
if (!/^[A-Za-z0-9+/]*={0,2}$/.test(r))
|
|
9194
9219
|
return { ok: !1, error: "Page image data URL has invalid base64." };
|
|
9195
|
-
const o =
|
|
9220
|
+
const o = Xa(r);
|
|
9196
9221
|
return o === null ? { ok: !1, error: "Page image data URL has invalid base64." } : o === 0 ? { ok: !1, error: "Page image is empty." } : {
|
|
9197
9222
|
ok: !0,
|
|
9198
9223
|
mimeType: n,
|
|
@@ -9200,22 +9225,22 @@ function Ga(s) {
|
|
|
9200
9225
|
dataUrl: `data:${n};base64,${r}`
|
|
9201
9226
|
};
|
|
9202
9227
|
}
|
|
9203
|
-
function
|
|
9228
|
+
function Xa(s) {
|
|
9204
9229
|
if (s.length === 0 || s.length % 4 !== 0)
|
|
9205
9230
|
return null;
|
|
9206
9231
|
const e = s.length - s.replace(/=+$/, "").length;
|
|
9207
9232
|
return e > 2 ? null : s.length / 4 * 3 - e;
|
|
9208
9233
|
}
|
|
9209
|
-
function
|
|
9234
|
+
function Ya(s) {
|
|
9210
9235
|
return (typeof s == "string" ? s.trim() : "") || "Page image";
|
|
9211
9236
|
}
|
|
9212
|
-
function
|
|
9237
|
+
function Za(s) {
|
|
9213
9238
|
try {
|
|
9214
9239
|
s();
|
|
9215
9240
|
} catch {
|
|
9216
9241
|
}
|
|
9217
9242
|
}
|
|
9218
|
-
function
|
|
9243
|
+
function ec(s) {
|
|
9219
9244
|
return new Promise((e, t) => {
|
|
9220
9245
|
const i = new FileReader();
|
|
9221
9246
|
i.onload = () => {
|
|
@@ -9229,7 +9254,7 @@ function Za(s) {
|
|
|
9229
9254
|
}
|
|
9230
9255
|
async function gi(s, e) {
|
|
9231
9256
|
const t = Object.getPrototypeOf(async function() {
|
|
9232
|
-
}).constructor, i = s.timeoutMs ??
|
|
9257
|
+
}).constructor, i = s.timeoutMs ?? $a, n = Date.now(), r = [];
|
|
9233
9258
|
let o;
|
|
9234
9259
|
const a = {
|
|
9235
9260
|
log: console.log,
|
|
@@ -9247,7 +9272,7 @@ async function gi(s, e) {
|
|
|
9247
9272
|
o = window.setTimeout(() => u(l), i);
|
|
9248
9273
|
})
|
|
9249
9274
|
]);
|
|
9250
|
-
return d === l ?
|
|
9275
|
+
return d === l ? sc(i) : {
|
|
9251
9276
|
ok: !0,
|
|
9252
9277
|
result: d,
|
|
9253
9278
|
console: r,
|
|
@@ -9276,7 +9301,7 @@ async function gi(s, e) {
|
|
|
9276
9301
|
e?.deactivate(), o !== void 0 && window.clearTimeout(o), console.log = a.log, console.info = a.info, console.warn = a.warn, console.error = a.error;
|
|
9277
9302
|
}
|
|
9278
9303
|
}
|
|
9279
|
-
function
|
|
9304
|
+
function tc(s, e) {
|
|
9280
9305
|
if (!s || typeof s != "object")
|
|
9281
9306
|
return;
|
|
9282
9307
|
const t = s.sandboxFilesToken;
|
|
@@ -9286,7 +9311,7 @@ function ec(s, e) {
|
|
|
9286
9311
|
const n = () => {
|
|
9287
9312
|
if (!i)
|
|
9288
9313
|
throw new Error("sandboxFiles is only available during browser-code execution");
|
|
9289
|
-
}, r = async (a, c) => await
|
|
9314
|
+
}, r = async (a, c) => await ra(`${e.replace(/\/$/, "")}${a}`, c);
|
|
9290
9315
|
return {
|
|
9291
9316
|
value: Object.freeze({
|
|
9292
9317
|
upload: async (a) => {
|
|
@@ -9320,7 +9345,7 @@ function ec(s, e) {
|
|
|
9320
9345
|
}
|
|
9321
9346
|
};
|
|
9322
9347
|
}
|
|
9323
|
-
function
|
|
9348
|
+
function sc(s) {
|
|
9324
9349
|
return {
|
|
9325
9350
|
ok: !1,
|
|
9326
9351
|
exception: {
|
|
@@ -9334,10 +9359,10 @@ function tc(s) {
|
|
|
9334
9359
|
}
|
|
9335
9360
|
};
|
|
9336
9361
|
}
|
|
9337
|
-
function
|
|
9362
|
+
function ic(s) {
|
|
9338
9363
|
return s.replace(/\/+$/, "");
|
|
9339
9364
|
}
|
|
9340
|
-
function
|
|
9365
|
+
function nc(s) {
|
|
9341
9366
|
const e = {
|
|
9342
9367
|
sidepanel: "extension_sidepanel",
|
|
9343
9368
|
browser_extension_page_ui: "extension_widget",
|
|
@@ -9349,13 +9374,13 @@ function ic(s) {
|
|
|
9349
9374
|
};
|
|
9350
9375
|
return s && s in e ? e[s] : s ?? "embedded_custom_ui";
|
|
9351
9376
|
}
|
|
9352
|
-
function
|
|
9377
|
+
function rc(s) {
|
|
9353
9378
|
return s === "pluno" ? "scheduled_continuation" : s ?? "user";
|
|
9354
9379
|
}
|
|
9355
|
-
function
|
|
9380
|
+
function oc(s, e = location.origin) {
|
|
9356
9381
|
return /origin (?:is not allowed|does not match browser origin)/i.test(s) ? `Pluno widget blocked on ${e}: this domain is not allowed. Add ${e} in Pluno under Integration > Domains.` : null;
|
|
9357
9382
|
}
|
|
9358
|
-
function
|
|
9383
|
+
function ac(s) {
|
|
9359
9384
|
const e = new URL("/api/product-agent/embed/ws", s);
|
|
9360
9385
|
return e.protocol = e.protocol === "https:" ? "wss:" : "ws:", e.toString();
|
|
9361
9386
|
}
|
|
@@ -9368,19 +9393,19 @@ function W() {
|
|
|
9368
9393
|
...s ? { plunoProductAgentUi: s } : {}
|
|
9369
9394
|
};
|
|
9370
9395
|
}
|
|
9371
|
-
function
|
|
9396
|
+
function cc() {
|
|
9372
9397
|
return {
|
|
9373
9398
|
pageUrl: location.href,
|
|
9374
9399
|
pageTitle: document.title,
|
|
9375
|
-
htmlContent:
|
|
9400
|
+
htmlContent: Ms()
|
|
9376
9401
|
};
|
|
9377
9402
|
}
|
|
9378
|
-
function
|
|
9379
|
-
return ut.add(s), Xe || (Xe =
|
|
9403
|
+
function lc(s) {
|
|
9404
|
+
return ut.add(s), Xe || (Xe = dc()), () => {
|
|
9380
9405
|
ut.delete(s), ut.size === 0 && (Xe?.(), Xe = null);
|
|
9381
9406
|
};
|
|
9382
9407
|
}
|
|
9383
|
-
function
|
|
9408
|
+
function dc() {
|
|
9384
9409
|
const s = () => {
|
|
9385
9410
|
for (const r of Array.from(ut))
|
|
9386
9411
|
r();
|
|
@@ -9395,10 +9420,10 @@ function lc() {
|
|
|
9395
9420
|
window.history.pushState === i && (window.history.pushState = e), window.history.replaceState === n && (window.history.replaceState = t), window.removeEventListener("popstate", s), window.removeEventListener("hashchange", s);
|
|
9396
9421
|
};
|
|
9397
9422
|
}
|
|
9398
|
-
function
|
|
9423
|
+
function $t() {
|
|
9399
9424
|
return bn()?.surface === "browser_extension_sdk_preview";
|
|
9400
9425
|
}
|
|
9401
|
-
function
|
|
9426
|
+
function Ms() {
|
|
9402
9427
|
if (!document.body)
|
|
9403
9428
|
return "";
|
|
9404
9429
|
const s = [], e = [], t = (g, I) => {
|
|
@@ -9410,20 +9435,20 @@ function ks() {
|
|
|
9410
9435
|
(g) => In(g) && !g.parentElement?.closest(i)
|
|
9411
9436
|
);
|
|
9412
9437
|
for (const g of n.slice(0, 3))
|
|
9413
|
-
t("Active overlay",
|
|
9414
|
-
const r =
|
|
9415
|
-
t("Main page content", o), t("Additional visible page text",
|
|
9438
|
+
t("Active overlay", Wt(Ne(g), e));
|
|
9439
|
+
const r = uc(), o = r ? Wt(Ne(r), e) : "";
|
|
9440
|
+
t("Main page content", o), t("Additional visible page text", Wt(Ne(document.body), e));
|
|
9416
9441
|
const a = s.map(([g, I]) => `${g}:
|
|
9417
9442
|
${I}`).join(`
|
|
9418
9443
|
|
|
9419
|
-
`).trim().slice(0, 12e3), c =
|
|
9444
|
+
`).trim().slice(0, 12e3), c = hc(n, r).trim(), l = `Simplified DOM outline:
|
|
9420
9445
|
`, d = `
|
|
9421
9446
|
|
|
9422
9447
|
Visible page text:
|
|
9423
9448
|
`, u = 12e3 - l.length - d.length, h = Math.min(a.length, 7900), p = c.slice(0, u - h), f = a.slice(0, u - p.length);
|
|
9424
9449
|
return `${l}${p}${d}${f}`;
|
|
9425
9450
|
}
|
|
9426
|
-
function
|
|
9451
|
+
function Ne(s) {
|
|
9427
9452
|
return s.innerText ?? s.textContent ?? "";
|
|
9428
9453
|
}
|
|
9429
9454
|
function me(s) {
|
|
@@ -9434,7 +9459,7 @@ function me(s) {
|
|
|
9434
9459
|
|
|
9435
9460
|
`).trim();
|
|
9436
9461
|
}
|
|
9437
|
-
function
|
|
9462
|
+
function Wt(s, e) {
|
|
9438
9463
|
let t = me(s);
|
|
9439
9464
|
for (const i of e)
|
|
9440
9465
|
t = t.replace(i, "");
|
|
@@ -9444,10 +9469,10 @@ function In(s) {
|
|
|
9444
9469
|
const e = window.getComputedStyle(s);
|
|
9445
9470
|
return e.display !== "none" && e.visibility !== "hidden" && s.getClientRects().length > 0;
|
|
9446
9471
|
}
|
|
9447
|
-
function
|
|
9448
|
-
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(In).sort((s, e) =>
|
|
9472
|
+
function uc() {
|
|
9473
|
+
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(In).sort((s, e) => Ne(e).length - Ne(s).length)[0] ?? null;
|
|
9449
9474
|
}
|
|
9450
|
-
function
|
|
9475
|
+
function hc(s, e) {
|
|
9451
9476
|
const t = /* @__PURE__ */ new Set([
|
|
9452
9477
|
"main",
|
|
9453
9478
|
"nav",
|
|
@@ -9527,7 +9552,7 @@ function uc(s, e) {
|
|
|
9527
9552
|
"data-test",
|
|
9528
9553
|
"data-qa",
|
|
9529
9554
|
"data-cy"
|
|
9530
|
-
], l = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: d, priorityTargets: u } =
|
|
9555
|
+
], l = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: d, priorityTargets: u } = pc(), h = new Set(s);
|
|
9531
9556
|
e && h.add(e);
|
|
9532
9557
|
let p = 0;
|
|
9533
9558
|
const f = (m) => {
|
|
@@ -9542,33 +9567,33 @@ function uc(s, e) {
|
|
|
9542
9567
|
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")
|
|
9543
9568
|
return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
|
|
9544
9569
|
p += 1;
|
|
9545
|
-
const
|
|
9570
|
+
const He = f(k), we = wn(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();
|
|
9546
9571
|
for (const _ of ue) {
|
|
9547
9572
|
const U = g(_);
|
|
9548
9573
|
he.set(U, (he.get(U) ?? 0) + 1);
|
|
9549
9574
|
}
|
|
9550
|
-
const ve = /* @__PURE__ */ new Map(),
|
|
9575
|
+
const ve = /* @__PURE__ */ new Map(), $e = /* @__PURE__ */ new Map();
|
|
9551
9576
|
for (const _ of ue) {
|
|
9552
|
-
const U = g(_), ie =
|
|
9553
|
-
|
|
9577
|
+
const U = g(_), ie = $e.get(U) ?? 0;
|
|
9578
|
+
$e.set(U, ie + 1), (he.get(U) ?? 0) > 8 && ie >= 6 && !d.has(_) && ve.set(U, (ve.get(U) ?? 0) + 1);
|
|
9554
9579
|
}
|
|
9555
|
-
const
|
|
9580
|
+
const We = /* @__PURE__ */ new Map(), pe = /* @__PURE__ */ new Set(), Te = [], _e = [];
|
|
9556
9581
|
for (const _ of ue) {
|
|
9557
|
-
const U = g(_), ie = he.get(U) ?? 0,
|
|
9558
|
-
if (
|
|
9582
|
+
const U = g(_), ie = he.get(U) ?? 0, Ds = We.get(U) ?? 0;
|
|
9583
|
+
if (We.set(U, Ds + 1), ie > 8 && Ds >= 6 && !d.has(_)) {
|
|
9559
9584
|
pe.has(U) || (Te.push([`… ${ve.get(U) ?? 0} similar siblings omitted`]), pe.add(U));
|
|
9560
9585
|
continue;
|
|
9561
9586
|
}
|
|
9562
|
-
const
|
|
9563
|
-
_e.push(
|
|
9587
|
+
const Us = D(_, R);
|
|
9588
|
+
_e.push(Us), Te.push(Us.lines);
|
|
9564
9589
|
}
|
|
9565
9590
|
const Z = [];
|
|
9566
9591
|
if (k.shadowRoot)
|
|
9567
9592
|
for (const _ of Array.from(k.shadowRoot.children))
|
|
9568
9593
|
_ instanceof HTMLElement && Z.push(D(_, R + 1));
|
|
9569
|
-
const ae = [..._e, ...Z],
|
|
9594
|
+
const ae = [..._e, ...Z], ze = we.length > 0 || be || ae.some((_) => _.hasUsefulContent), Re = me(
|
|
9570
9595
|
[we, ...ae.map((_) => _.textPreview)].filter(Boolean).join(" ")
|
|
9571
|
-
).slice(0, 180), ce = k.hasAttribute("contenteditable") && (we.length > 0 || !k.querySelector("[contenteditable]")), H = l.some((_) => k.hasAttribute(_)) || !!
|
|
9596
|
+
).slice(0, 180), ce = k.hasAttribute("contenteditable") && (we.length > 0 || !k.querySelector("[contenteditable]")), H = l.some((_) => k.hasAttribute(_)) || !!He || ce, K = (k.getClientRects().length > 0 || B.display === "contents") && (t.has(b) || H || se) && (ze || se) && (!n.has(b) || ze || H || se), Rt = K ? 1 : 0, Ae = [];
|
|
9572
9597
|
if (K) {
|
|
9573
9598
|
const _ = ae.some((ie) => ie.containsTextElement), U = i.has(b) && !_ ? Re : we;
|
|
9574
9599
|
Ae.push(Sn(k, c, o, U.slice(0, 180)));
|
|
@@ -9588,7 +9613,7 @@ function uc(s, e) {
|
|
|
9588
9613
|
}
|
|
9589
9614
|
return {
|
|
9590
9615
|
lines: Ae,
|
|
9591
|
-
hasUsefulContent:
|
|
9616
|
+
hasUsefulContent: ze,
|
|
9592
9617
|
textPreview: Re,
|
|
9593
9618
|
containsTextElement: i.has(b) || ae.some((_) => _.containsTextElement)
|
|
9594
9619
|
};
|
|
@@ -9597,7 +9622,7 @@ function uc(s, e) {
|
|
|
9597
9622
|
`);
|
|
9598
9623
|
}, w = [], y = me(window.getSelection()?.toString() ?? "");
|
|
9599
9624
|
y && w.push(`--- selected text ---
|
|
9600
|
-
${JSON.stringify(y)}`), u.length > 0 && w.push(
|
|
9625
|
+
${JSON.stringify(y)}`), u.length > 0 && w.push(fc(u, t, c, o));
|
|
9601
9626
|
for (const m of s.slice(0, 3))
|
|
9602
9627
|
w.push(I(m, "active overlay DOM", /* @__PURE__ */ new Set()));
|
|
9603
9628
|
if (e && w.push(I(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
|
|
@@ -9612,7 +9637,7 @@ function Sn(s, e, t, i) {
|
|
|
9612
9637
|
const n = s.tagName.toLowerCase();
|
|
9613
9638
|
let r = n;
|
|
9614
9639
|
const o = s.getAttribute("id");
|
|
9615
|
-
o &&
|
|
9640
|
+
o && gc(o) && (r += `#${o}`);
|
|
9616
9641
|
for (const a of e) {
|
|
9617
9642
|
const c = s.getAttribute(a);
|
|
9618
9643
|
c && c.length <= 160 && (a !== "role" || !t.has(c)) && (r += `[${a}=${JSON.stringify(c)}]`);
|
|
@@ -9625,7 +9650,7 @@ function Sn(s, e, t, i) {
|
|
|
9625
9650
|
s.hasAttribute(a) && (r += `[${a}]`);
|
|
9626
9651
|
return `${r}${i ? ` ${JSON.stringify(i)}` : ""}`;
|
|
9627
9652
|
}
|
|
9628
|
-
function
|
|
9653
|
+
function pc() {
|
|
9629
9654
|
const s = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), t = (a, c) => {
|
|
9630
9655
|
if (!a)
|
|
9631
9656
|
return;
|
|
@@ -9668,7 +9693,7 @@ function hc() {
|
|
|
9668
9693
|
priorityTargets: Array.from(e, ([a, c]) => ({ element: a, labels: Array.from(c) }))
|
|
9669
9694
|
};
|
|
9670
9695
|
}
|
|
9671
|
-
function
|
|
9696
|
+
function fc(s, e, t, i) {
|
|
9672
9697
|
const n = ["--- active/current elements ---"];
|
|
9673
9698
|
for (const r of s) {
|
|
9674
9699
|
const o = [];
|
|
@@ -9704,12 +9729,12 @@ function wn(s) {
|
|
|
9704
9729
|
Array.from(s.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
|
|
9705
9730
|
);
|
|
9706
9731
|
}
|
|
9707
|
-
function
|
|
9732
|
+
function gc(s) {
|
|
9708
9733
|
return s.length <= 64 && /^[A-Za-z_][A-Za-z0-9_:.-]*$/.test(s) && !/[a-f0-9]{12,}/i.test(s) && !/:r[0-9a-z]+:/i.test(s);
|
|
9709
9734
|
}
|
|
9710
9735
|
function bn() {
|
|
9711
|
-
const s = Array.from(document.querySelectorAll(
|
|
9712
|
-
(r) => typeof r[
|
|
9736
|
+
const s = Array.from(document.querySelectorAll(ri)), e = s.find(
|
|
9737
|
+
(r) => typeof r[la] == "string"
|
|
9713
9738
|
);
|
|
9714
9739
|
if (!(e ?? s[0]))
|
|
9715
9740
|
return;
|
|
@@ -9720,28 +9745,28 @@ function bn() {
|
|
|
9720
9745
|
selectors: [
|
|
9721
9746
|
{
|
|
9722
9747
|
name: "widget_host",
|
|
9723
|
-
selector:
|
|
9748
|
+
selector: ri,
|
|
9724
9749
|
description: "Finds Pluno's shadow-host element in the host page DOM."
|
|
9725
9750
|
},
|
|
9726
9751
|
{
|
|
9727
9752
|
name: "widget_root",
|
|
9728
|
-
selector:
|
|
9753
|
+
selector: oa,
|
|
9729
9754
|
description: "Finds Pluno's widget root inside the widget host shadow root."
|
|
9730
9755
|
},
|
|
9731
9756
|
{
|
|
9732
9757
|
name: "widget_panel",
|
|
9733
|
-
selector:
|
|
9758
|
+
selector: aa,
|
|
9734
9759
|
description: "Finds Pluno's open chat panel inside the widget host shadow root."
|
|
9735
9760
|
},
|
|
9736
9761
|
{
|
|
9737
9762
|
name: "widget_timeline",
|
|
9738
|
-
selector:
|
|
9763
|
+
selector: ca,
|
|
9739
9764
|
description: "Finds Pluno's chat timeline inside the widget host shadow root."
|
|
9740
9765
|
}
|
|
9741
9766
|
]
|
|
9742
9767
|
};
|
|
9743
9768
|
}
|
|
9744
|
-
function
|
|
9769
|
+
function yc(s) {
|
|
9745
9770
|
if (s.runtimeContext !== void 0) {
|
|
9746
9771
|
if (!s.runtimeContext || typeof s.runtimeContext != "object" || Array.isArray(s.runtimeContext)) return !1;
|
|
9747
9772
|
const e = s.runtimeContext;
|
|
@@ -9763,7 +9788,7 @@ function mi(s) {
|
|
|
9763
9788
|
return { type: "error", message: "Invalid server event" };
|
|
9764
9789
|
}
|
|
9765
9790
|
}
|
|
9766
|
-
function
|
|
9791
|
+
function mc(s) {
|
|
9767
9792
|
if (typeof s != "string")
|
|
9768
9793
|
return null;
|
|
9769
9794
|
try {
|
|
@@ -9787,10 +9812,10 @@ function Si(s) {
|
|
|
9787
9812
|
return typeof t.taskId != "string" || !t.taskId || typeof t.dueAt != "string" || Number.isNaN(Date.parse(t.dueAt)) ? [] : [{ taskId: t.taskId, dueAt: t.dueAt }];
|
|
9788
9813
|
}) : [];
|
|
9789
9814
|
}
|
|
9790
|
-
function
|
|
9815
|
+
function Ic(s) {
|
|
9791
9816
|
return Array.isArray(s) ? s.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
|
|
9792
9817
|
}
|
|
9793
|
-
function
|
|
9818
|
+
function Sc(s) {
|
|
9794
9819
|
if (!s || typeof s != "object")
|
|
9795
9820
|
return null;
|
|
9796
9821
|
const e = s, t = e.appearance, i = t && typeof t == "object" ? t : e, n = typeof i.accentColor == "string" ? i.accentColor : null, r = i.colorScheme === "dark" ? "dark" : i.colorScheme === "light" ? "light" : null, o = typeof i.fontFamily == "string" && i.fontFamily.trim() ? i.fontFamily : null, a = typeof i.scribbleStyle == "boolean" ? i.scribbleStyle : null;
|
|
@@ -9801,13 +9826,13 @@ function Ic(s) {
|
|
|
9801
9826
|
...a !== null ? { scribbleStyle: a } : {}
|
|
9802
9827
|
};
|
|
9803
9828
|
}
|
|
9804
|
-
function
|
|
9829
|
+
function wc(s) {
|
|
9805
9830
|
if (!s || typeof s != "object")
|
|
9806
9831
|
return null;
|
|
9807
9832
|
const e = s.javascript;
|
|
9808
9833
|
return typeof e != "string" || !e.trim() ? null : { javascript: e };
|
|
9809
9834
|
}
|
|
9810
|
-
function
|
|
9835
|
+
function bc(s, e) {
|
|
9811
9836
|
return e ? s && typeof s == "object" ? {
|
|
9812
9837
|
...s,
|
|
9813
9838
|
helperError: e
|
|
@@ -9817,13 +9842,13 @@ function wc(s, e) {
|
|
|
9817
9842
|
helperError: e
|
|
9818
9843
|
} : s;
|
|
9819
9844
|
}
|
|
9820
|
-
function
|
|
9845
|
+
function vc(s) {
|
|
9821
9846
|
if (!s || typeof s != "object")
|
|
9822
9847
|
return s;
|
|
9823
9848
|
const e = s;
|
|
9824
9849
|
return typeof e.exception?.message == "string" ? e.exception.message : typeof e.error == "string" ? e.error : s;
|
|
9825
9850
|
}
|
|
9826
|
-
function
|
|
9851
|
+
function Tc() {
|
|
9827
9852
|
const s = "pluno.productAgent.clientId", e = window.localStorage.getItem(s);
|
|
9828
9853
|
if (e)
|
|
9829
9854
|
return e;
|
|
@@ -9844,8 +9869,8 @@ function wi(s) {
|
|
|
9844
9869
|
avatarUrl: typeof e.avatarUrl == "string" ? e.avatarUrl : null
|
|
9845
9870
|
} : null;
|
|
9846
9871
|
}
|
|
9847
|
-
function
|
|
9848
|
-
return Array.isArray(s) ?
|
|
9872
|
+
function zt(s, e) {
|
|
9873
|
+
return Array.isArray(s) ? ps(
|
|
9849
9874
|
s.map((t) => ft(t, e)).filter((t) => t !== null)
|
|
9850
9875
|
) : [];
|
|
9851
9876
|
}
|
|
@@ -9856,14 +9881,14 @@ function ft(s, e) {
|
|
|
9856
9881
|
if (!i || typeof i != "object")
|
|
9857
9882
|
return null;
|
|
9858
9883
|
const n = i;
|
|
9859
|
-
if (n.hiddenFromTranscript === !0 ||
|
|
9884
|
+
if (n.hiddenFromTranscript === !0 || ko(n) || n.type === "tab_lifecycle_decision" && n.decision === "keep")
|
|
9860
9885
|
return null;
|
|
9861
9886
|
if (n.type === "assistant_draft")
|
|
9862
9887
|
return {
|
|
9863
9888
|
id: typeof n.id == "string" ? n.id : String(t.id ?? crypto.randomUUID()),
|
|
9864
9889
|
role: "assistant",
|
|
9865
9890
|
...n.phase === "commentary" || n.phase === "final_answer" ? { phase: n.phase } : {},
|
|
9866
|
-
content:
|
|
9891
|
+
content: Js(
|
|
9867
9892
|
bi(n.content),
|
|
9868
9893
|
e
|
|
9869
9894
|
),
|
|
@@ -9880,7 +9905,7 @@ function ft(s, e) {
|
|
|
9880
9905
|
id: String(t.id ?? crypto.randomUUID()),
|
|
9881
9906
|
role: r,
|
|
9882
9907
|
...n.phase === "commentary" || n.phase === "final_answer" ? { phase: n.phase } : {},
|
|
9883
|
-
content:
|
|
9908
|
+
content: Js(
|
|
9884
9909
|
bi(n.content),
|
|
9885
9910
|
e
|
|
9886
9911
|
),
|
|
@@ -9904,7 +9929,7 @@ function ft(s, e) {
|
|
|
9904
9929
|
}), o;
|
|
9905
9930
|
}
|
|
9906
9931
|
if (n.type === "function_call_output") {
|
|
9907
|
-
const r =
|
|
9932
|
+
const r = To(n.output);
|
|
9908
9933
|
if (r !== null)
|
|
9909
9934
|
return {
|
|
9910
9935
|
id: String(t.id ?? crypto.randomUUID()),
|
|
@@ -9915,11 +9940,11 @@ function ft(s, e) {
|
|
|
9915
9940
|
respondsToUserMessageId: j(n) ?? void 0,
|
|
9916
9941
|
...E(n) ? { runId: E(n) } : {},
|
|
9917
9942
|
dataType: "function_call_output",
|
|
9918
|
-
toolName:
|
|
9919
|
-
callId:
|
|
9943
|
+
toolName: Rs,
|
|
9944
|
+
callId: De(n) ?? void 0,
|
|
9920
9945
|
sharePromptAllowed: r
|
|
9921
9946
|
};
|
|
9922
|
-
const o =
|
|
9947
|
+
const o = No(n.output);
|
|
9923
9948
|
if (o)
|
|
9924
9949
|
return {
|
|
9925
9950
|
id: String(t.id ?? crypto.randomUUID()),
|
|
@@ -9931,11 +9956,11 @@ function ft(s, e) {
|
|
|
9931
9956
|
...E(n) ? { runId: E(n) } : {},
|
|
9932
9957
|
dataType: "scheduled_check_in",
|
|
9933
9958
|
toolName: cn,
|
|
9934
|
-
callId:
|
|
9959
|
+
callId: De(n) ?? void 0,
|
|
9935
9960
|
scheduledCheckInId: o.id ?? void 0,
|
|
9936
9961
|
scheduledCheckInAt: o.dueAt
|
|
9937
9962
|
};
|
|
9938
|
-
const a =
|
|
9963
|
+
const a = Rc(n.output), c = Ac(n.output);
|
|
9939
9964
|
return a ? {
|
|
9940
9965
|
id: String(t.id ?? crypto.randomUUID()),
|
|
9941
9966
|
role: "tool",
|
|
@@ -9947,7 +9972,7 @@ function ft(s, e) {
|
|
|
9947
9972
|
...E(n) ? { runId: E(n) } : {},
|
|
9948
9973
|
dataType: "function_call_output",
|
|
9949
9974
|
toolName: "authenticate_pipedream_app",
|
|
9950
|
-
callId:
|
|
9975
|
+
callId: De(n) ?? void 0,
|
|
9951
9976
|
integrationAuthRequest: a
|
|
9952
9977
|
} : c ? {
|
|
9953
9978
|
id: String(t.id ?? crypto.randomUUID()),
|
|
@@ -9960,14 +9985,14 @@ function ft(s, e) {
|
|
|
9960
9985
|
...E(n) ? { runId: E(n) } : {},
|
|
9961
9986
|
dataType: "function_call_output",
|
|
9962
9987
|
toolName: "request_personal_channel_connection",
|
|
9963
|
-
callId:
|
|
9988
|
+
callId: De(n) ?? void 0,
|
|
9964
9989
|
personalChannelConnectionRequest: c
|
|
9965
9990
|
} : null;
|
|
9966
9991
|
}
|
|
9967
9992
|
return n.type === "function_call" || n.type === "tool_call" || n.type === "web_search_call" || n.type === "mcp_call" || n.type === "tab_lifecycle_decision" ? {
|
|
9968
9993
|
id: String(t.id ?? crypto.randomUUID()),
|
|
9969
9994
|
role: "tool",
|
|
9970
|
-
content: n.type === "mcp_call" ?
|
|
9995
|
+
content: n.type === "mcp_call" ? _c(n) : Mc(n),
|
|
9971
9996
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
9972
9997
|
...x(n) !== null ? { displaySequence: x(n) } : {},
|
|
9973
9998
|
...F(n) !== null ? { causalSequence: F(n) } : {},
|
|
@@ -9975,13 +10000,13 @@ function ft(s, e) {
|
|
|
9975
10000
|
...E(n) ? { runId: E(n) } : {},
|
|
9976
10001
|
dataType: String(n.type),
|
|
9977
10002
|
toolName: n.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof n.name == "string" ? n.name : void 0,
|
|
9978
|
-
callId:
|
|
10003
|
+
callId: De(n) ?? void 0,
|
|
9979
10004
|
loading: n.steered === !0 ? !1 : n.localExecutionStatus === "queued" || n.localExecutionStatus === "running" ? !0 : typeof n.localExecutionStatus == "string" ? !1 : void 0,
|
|
9980
10005
|
...n.steered === !0 ? { steered: !0 } : {}
|
|
9981
10006
|
} : n.type === "run_status" || n.type === "run_error" ? n.type === "run_error" && n.stage === "tool_execution" ? null : {
|
|
9982
10007
|
id: String(t.id ?? crypto.randomUUID()),
|
|
9983
10008
|
role: "system",
|
|
9984
|
-
content:
|
|
10009
|
+
content: kc(n),
|
|
9985
10010
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
9986
10011
|
...x(n) !== null ? { displaySequence: x(n) } : {},
|
|
9987
10012
|
...F(n) !== null ? { causalSequence: F(n) } : {},
|
|
@@ -9994,11 +10019,11 @@ function ft(s, e) {
|
|
|
9994
10019
|
...typeof n.securitySettingsUrl == "string" ? { securitySettingsUrl: n.securitySettingsUrl } : {}
|
|
9995
10020
|
} : null;
|
|
9996
10021
|
}
|
|
9997
|
-
function
|
|
10022
|
+
function _c(s) {
|
|
9998
10023
|
const t = (typeof s.server_label == "string" ? s.server_label : "").replace(/^pipedream_/, "").split(/[_-]+/).filter(Boolean).map((i) => `${i.charAt(0).toUpperCase()}${i.slice(1)}`).join(" ");
|
|
9999
10024
|
return t ? `🔌 Using ${t}` : "🔌 Using connected integration";
|
|
10000
10025
|
}
|
|
10001
|
-
function
|
|
10026
|
+
function Rc(s) {
|
|
10002
10027
|
if (typeof s != "string")
|
|
10003
10028
|
return null;
|
|
10004
10029
|
try {
|
|
@@ -10015,7 +10040,7 @@ function _c(s) {
|
|
|
10015
10040
|
return null;
|
|
10016
10041
|
}
|
|
10017
10042
|
}
|
|
10018
|
-
function
|
|
10043
|
+
function Ac(s) {
|
|
10019
10044
|
if (typeof s != "string")
|
|
10020
10045
|
return null;
|
|
10021
10046
|
try {
|
|
@@ -10030,10 +10055,10 @@ function Rc(s) {
|
|
|
10030
10055
|
return null;
|
|
10031
10056
|
}
|
|
10032
10057
|
}
|
|
10033
|
-
function
|
|
10058
|
+
function kc(s) {
|
|
10034
10059
|
return s.type === "run_status" && s.status === "steered" ? "Steered" : typeof s.message == "string" && s.message.trim().length > 0 ? s.message : "";
|
|
10035
10060
|
}
|
|
10036
|
-
function
|
|
10061
|
+
function Mc(s) {
|
|
10037
10062
|
if (s.type === "web_search_call") {
|
|
10038
10063
|
const e = s.action;
|
|
10039
10064
|
if (e && typeof e == "object") {
|
|
@@ -10045,9 +10070,9 @@ function kc(s) {
|
|
|
10045
10070
|
}
|
|
10046
10071
|
return "🔎 Searching the web";
|
|
10047
10072
|
}
|
|
10048
|
-
return
|
|
10073
|
+
return Ec(s);
|
|
10049
10074
|
}
|
|
10050
|
-
function
|
|
10075
|
+
function Ec(s) {
|
|
10051
10076
|
if (typeof s.summary == "string" && s.summary.trim().length > 0)
|
|
10052
10077
|
return ge(s.summary);
|
|
10053
10078
|
if (typeof s.arguments == "string")
|
|
@@ -10064,7 +10089,7 @@ function ge(s) {
|
|
|
10064
10089
|
const e = s.trim() || "Run tool", t = e.codePointAt(0) ?? 0;
|
|
10065
10090
|
return t >= 126976 && t <= 129791 || t >= 9728 && t <= 10175 || t >= 127462 && t <= 127487 ? e : `🛠️ ${e}`;
|
|
10066
10091
|
}
|
|
10067
|
-
function
|
|
10092
|
+
function Cc(s) {
|
|
10068
10093
|
if (s == null)
|
|
10069
10094
|
return s;
|
|
10070
10095
|
if (typeof s != "object")
|
|
@@ -10079,7 +10104,7 @@ function Ec(s) {
|
|
|
10079
10104
|
runId: typeof e.runId == "string" ? e.runId : null
|
|
10080
10105
|
};
|
|
10081
10106
|
}
|
|
10082
|
-
function
|
|
10107
|
+
function De(s) {
|
|
10083
10108
|
const e = s.callId ?? s.call_id;
|
|
10084
10109
|
return typeof e == "string" && e ? e : null;
|
|
10085
10110
|
}
|
|
@@ -10097,14 +10122,14 @@ function bi(s) {
|
|
|
10097
10122
|
return typeof t.text == "string" ? t.text : typeof t.content == "string" ? t.content : "";
|
|
10098
10123
|
}).filter(Boolean).join("") : "";
|
|
10099
10124
|
}
|
|
10100
|
-
function
|
|
10125
|
+
function Oe(s, e) {
|
|
10101
10126
|
const t = vn(
|
|
10102
10127
|
s,
|
|
10103
|
-
|
|
10104
|
-
), i =
|
|
10105
|
-
|
|
10106
|
-
|
|
10107
|
-
|
|
10128
|
+
Es(s, e)
|
|
10129
|
+
), i = Uc(
|
|
10130
|
+
Dc(
|
|
10131
|
+
Bc(
|
|
10132
|
+
Pc(s, e),
|
|
10108
10133
|
e
|
|
10109
10134
|
),
|
|
10110
10135
|
t
|
|
@@ -10112,13 +10137,13 @@ function qe(s, e) {
|
|
|
10112
10137
|
t
|
|
10113
10138
|
), n = i.findIndex((o) => o.id === t.id);
|
|
10114
10139
|
if (n === -1)
|
|
10115
|
-
return
|
|
10140
|
+
return ps(
|
|
10116
10141
|
[...i, t]
|
|
10117
10142
|
);
|
|
10118
10143
|
const r = [...i];
|
|
10119
|
-
return r[n] = t,
|
|
10144
|
+
return r[n] = t, ps(r);
|
|
10120
10145
|
}
|
|
10121
|
-
function
|
|
10146
|
+
function Es(s, e, t = !0) {
|
|
10122
10147
|
const i = s.find(
|
|
10123
10148
|
(r) => r.id === e.id || e.callId !== void 0 && r.callId === e.callId || e.assistantDraftItemId !== void 0 && (r.id === e.assistantDraftItemId || r.assistantDraftItemId === e.assistantDraftItemId)
|
|
10124
10149
|
);
|
|
@@ -10129,7 +10154,7 @@ function Ms(s, e, t = !0) {
|
|
|
10129
10154
|
const n = s.flatMap((r) => (e.respondsToUserMessageId !== void 0 ? r.respondsToUserMessageId === e.respondsToUserMessageId : e.runId !== void 0 && r.respondsToUserMessageId === void 0 && r.runId === e.runId) && r.displaySequence !== void 0 ? [r.displaySequence] : []);
|
|
10130
10155
|
return e.displaySequence = (n.length > 0 ? Math.max(...n) : 0) + 1, e;
|
|
10131
10156
|
}
|
|
10132
|
-
function
|
|
10157
|
+
function Pc(s, e) {
|
|
10133
10158
|
const t = e.proactiveSuggestionClientMessageId;
|
|
10134
10159
|
if (!t)
|
|
10135
10160
|
return s;
|
|
@@ -10139,7 +10164,7 @@ function Cc(s, e) {
|
|
|
10139
10164
|
const r = [...s];
|
|
10140
10165
|
return r[n] = e, r;
|
|
10141
10166
|
}
|
|
10142
|
-
function
|
|
10167
|
+
function Dc(s, e) {
|
|
10143
10168
|
const t = e.assistantDraftItemId;
|
|
10144
10169
|
return t ? s.map(
|
|
10145
10170
|
(i) => i.dataType === "assistant_draft" && i.id === t ? e : i
|
|
@@ -10170,7 +10195,7 @@ function Ti(s, e) {
|
|
|
10170
10195
|
(n) => !n.id.startsWith("transient-activity:") && n.callId === e.callId
|
|
10171
10196
|
);
|
|
10172
10197
|
if (t === -1)
|
|
10173
|
-
return
|
|
10198
|
+
return Oe(s, e);
|
|
10174
10199
|
const i = [...s];
|
|
10175
10200
|
return i[t] = {
|
|
10176
10201
|
...i[t],
|
|
@@ -10207,7 +10232,7 @@ function Ri(s) {
|
|
|
10207
10232
|
loading: !0
|
|
10208
10233
|
};
|
|
10209
10234
|
}
|
|
10210
|
-
function
|
|
10235
|
+
function Uc(s, e) {
|
|
10211
10236
|
if (e.id.startsWith("transient-activity:"))
|
|
10212
10237
|
return s;
|
|
10213
10238
|
const t = e.toolName === "tab_lifecycle";
|
|
@@ -10216,30 +10241,30 @@ function Dc(s, e) {
|
|
|
10216
10241
|
const i = (r) => r.id === `transient-activity:${e.callId}` && r.callId === e.callId || t && r.id.startsWith("transient-activity:") && r.toolName === "browser_tabs" && !!r.runId && r.runId === e.runId, n = s.findIndex(i);
|
|
10217
10242
|
return n === -1 ? s : s.flatMap((r, o) => i(r) ? o === n ? [e] : [] : r.id === e.id ? [] : [r]);
|
|
10218
10243
|
}
|
|
10219
|
-
function
|
|
10244
|
+
function ls(s, e) {
|
|
10220
10245
|
const t = [];
|
|
10221
10246
|
for (const i of e) {
|
|
10222
10247
|
const n = [...s, ...t];
|
|
10223
10248
|
t.push(
|
|
10224
10249
|
vn(
|
|
10225
10250
|
n,
|
|
10226
|
-
|
|
10251
|
+
Es(n, i, !1)
|
|
10227
10252
|
)
|
|
10228
10253
|
);
|
|
10229
10254
|
}
|
|
10230
|
-
return
|
|
10255
|
+
return Mo(
|
|
10231
10256
|
s,
|
|
10232
10257
|
t,
|
|
10233
|
-
|
|
10258
|
+
ds
|
|
10234
10259
|
);
|
|
10235
10260
|
}
|
|
10236
|
-
function
|
|
10261
|
+
function qc(s, e) {
|
|
10237
10262
|
const t = new Map(s.map((r) => [r.id, r])), i = e.map(
|
|
10238
|
-
(r) =>
|
|
10263
|
+
(r) => Es(s, r, !1)
|
|
10239
10264
|
);
|
|
10240
10265
|
for (const r of i)
|
|
10241
10266
|
t.set(r.id, r);
|
|
10242
|
-
const n =
|
|
10267
|
+
const n = ls(
|
|
10243
10268
|
s,
|
|
10244
10269
|
[...t.values()]
|
|
10245
10270
|
);
|
|
@@ -10254,7 +10279,7 @@ function Uc(s, e) {
|
|
|
10254
10279
|
}
|
|
10255
10280
|
return n;
|
|
10256
10281
|
}
|
|
10257
|
-
function
|
|
10282
|
+
function ds(s) {
|
|
10258
10283
|
const e = de(s) ?? void 0, t = s.assistantDraftItemId, i = s.dataType === "function_call_output" || s.dataType === "scheduled_check_in", n = [
|
|
10259
10284
|
// Output-backed cards and their visible calls are separate durable rows. A distinct key keeps activity hydration
|
|
10260
10285
|
// from substituting the call for its output and then appending a duplicate output at the end of the timeline.
|
|
@@ -10284,22 +10309,22 @@ function vn(s, e) {
|
|
|
10284
10309
|
if (!t?.attachments?.length)
|
|
10285
10310
|
return e;
|
|
10286
10311
|
const i = e.attachments.map((o) => {
|
|
10287
|
-
const a =
|
|
10288
|
-
return a ?
|
|
10312
|
+
const a = Oc(t.attachments ?? [], o);
|
|
10313
|
+
return a ? xc(o, a) : o;
|
|
10289
10314
|
}), n = { ...e, attachments: i }, r = de(e);
|
|
10290
10315
|
return r && Object.defineProperty(n, "clientMessageId", {
|
|
10291
10316
|
value: r,
|
|
10292
10317
|
enumerable: !1
|
|
10293
10318
|
}), n;
|
|
10294
10319
|
}
|
|
10295
|
-
function
|
|
10320
|
+
function Oc(s, e) {
|
|
10296
10321
|
return e.id ? s.find((t) => t.id === e.id) ?? null : null;
|
|
10297
10322
|
}
|
|
10298
|
-
function
|
|
10323
|
+
function xc(s, e) {
|
|
10299
10324
|
const { previewUrl: t } = e;
|
|
10300
10325
|
return t ? { ...s, previewUrl: t } : s;
|
|
10301
10326
|
}
|
|
10302
|
-
function
|
|
10327
|
+
function Bc(s, e) {
|
|
10303
10328
|
if (e.role !== "user")
|
|
10304
10329
|
return s;
|
|
10305
10330
|
const t = s.findIndex(
|
|
@@ -10326,7 +10351,7 @@ function de(s) {
|
|
|
10326
10351
|
);
|
|
10327
10352
|
return i ? s.id.slice(i.length) : null;
|
|
10328
10353
|
}
|
|
10329
|
-
function
|
|
10354
|
+
function Kt(s) {
|
|
10330
10355
|
const e = _n(s);
|
|
10331
10356
|
if (e === null)
|
|
10332
10357
|
return !1;
|
|
@@ -10350,7 +10375,7 @@ function zt(s) {
|
|
|
10350
10375
|
}
|
|
10351
10376
|
return !1;
|
|
10352
10377
|
}
|
|
10353
|
-
function
|
|
10378
|
+
function Nc(s, e, t) {
|
|
10354
10379
|
const i = new Set(
|
|
10355
10380
|
s.filter(
|
|
10356
10381
|
(n) => n.role === "user" && e !== null && de(n) === e
|
|
@@ -10370,7 +10395,7 @@ function Bc(s, e, t) {
|
|
|
10370
10395
|
return !1;
|
|
10371
10396
|
});
|
|
10372
10397
|
}
|
|
10373
|
-
function
|
|
10398
|
+
function Lc(s) {
|
|
10374
10399
|
const e = _n(s);
|
|
10375
10400
|
if (e === null)
|
|
10376
10401
|
return s.some(X);
|
|
@@ -10402,7 +10427,7 @@ function Ie(s) {
|
|
|
10402
10427
|
}
|
|
10403
10428
|
return null;
|
|
10404
10429
|
}
|
|
10405
|
-
function
|
|
10430
|
+
function Fc(s) {
|
|
10406
10431
|
const e = Ie(s);
|
|
10407
10432
|
if (e === null)
|
|
10408
10433
|
return null;
|
|
@@ -10418,13 +10443,13 @@ function q(s) {
|
|
|
10418
10443
|
const e = s.data;
|
|
10419
10444
|
return e && typeof e == "object" ? e : null;
|
|
10420
10445
|
}
|
|
10421
|
-
function
|
|
10446
|
+
function Le(s) {
|
|
10422
10447
|
return s?.retryable !== !0 ? !1 : s.type === "run_error" ? !0 : s.type === "run_status" && s.status === "interrupted";
|
|
10423
10448
|
}
|
|
10424
|
-
function
|
|
10449
|
+
function jc(s) {
|
|
10425
10450
|
return s?.type === "run_status" && s.status === "interrupted" && s.reason === "backend_restart";
|
|
10426
10451
|
}
|
|
10427
|
-
function
|
|
10452
|
+
function Hc(s, e) {
|
|
10428
10453
|
const t = Ie(e);
|
|
10429
10454
|
if (t === null)
|
|
10430
10455
|
return !1;
|
|
@@ -10436,7 +10461,7 @@ function jc(s, e) {
|
|
|
10436
10461
|
(o) => o.respondsToUserMessageId === n && gt(o)
|
|
10437
10462
|
) : s.slice(r + 1).some(gt);
|
|
10438
10463
|
}
|
|
10439
|
-
function
|
|
10464
|
+
function us(s) {
|
|
10440
10465
|
const e = Ie(s);
|
|
10441
10466
|
if (e === null)
|
|
10442
10467
|
return null;
|
|
@@ -10449,7 +10474,7 @@ function ds(s) {
|
|
|
10449
10474
|
const n = i.clientMessageId;
|
|
10450
10475
|
return typeof n == "string" ? n : null;
|
|
10451
10476
|
}
|
|
10452
|
-
function
|
|
10477
|
+
function $c(s) {
|
|
10453
10478
|
const e = Ie(s);
|
|
10454
10479
|
if (e === null)
|
|
10455
10480
|
return null;
|
|
@@ -10464,13 +10489,13 @@ function Hc(s) {
|
|
|
10464
10489
|
if (r.type === "message" && r.role === "assistant")
|
|
10465
10490
|
return null;
|
|
10466
10491
|
if (r.type === "run_error")
|
|
10467
|
-
return r.retryable !== !0 ? null :
|
|
10492
|
+
return r.retryable !== !0 ? null : hs(s, r) ?? us(s);
|
|
10468
10493
|
if (r.type === "run_status")
|
|
10469
|
-
return r.status === "interrupted" && r.retryable === !0 ?
|
|
10494
|
+
return r.status === "interrupted" && r.retryable === !0 ? hs(s, r) ?? us(s) : null;
|
|
10470
10495
|
}
|
|
10471
10496
|
return null;
|
|
10472
10497
|
}
|
|
10473
|
-
function
|
|
10498
|
+
function hs(s, e) {
|
|
10474
10499
|
if (typeof e.clientMessageId == "string")
|
|
10475
10500
|
return e.clientMessageId;
|
|
10476
10501
|
const t = j(e);
|
|
@@ -10480,15 +10505,15 @@ function us(s, e) {
|
|
|
10480
10505
|
return n?.type === "message" && n.role === "user" && typeof n.clientMessageId == "string" ? n.clientMessageId : null;
|
|
10481
10506
|
}
|
|
10482
10507
|
function Ai(s, e, t, i, n, r) {
|
|
10483
|
-
if (!e || !
|
|
10508
|
+
if (!e || !zc(s))
|
|
10484
10509
|
return !1;
|
|
10485
10510
|
const o = s;
|
|
10486
|
-
if (
|
|
10511
|
+
if (Le(o) || t !== null && typeof o.id == "string" && o.id !== t)
|
|
10487
10512
|
return !1;
|
|
10488
10513
|
const a = j(o);
|
|
10489
10514
|
return i !== null ? a !== null ? a === i : n !== null && E(o) === n && r === i : n === null || E(o) === n;
|
|
10490
10515
|
}
|
|
10491
|
-
function
|
|
10516
|
+
function Wc(s, e) {
|
|
10492
10517
|
for (let t = e - 1; t >= 0; t -= 1) {
|
|
10493
10518
|
const i = q(s[t]);
|
|
10494
10519
|
if (i?.type === "message" && i.role === "user")
|
|
@@ -10502,7 +10527,7 @@ function Rn(s, e) {
|
|
|
10502
10527
|
return s[t].id;
|
|
10503
10528
|
return null;
|
|
10504
10529
|
}
|
|
10505
|
-
function
|
|
10530
|
+
function zc(s) {
|
|
10506
10531
|
if (!s || typeof s != "object")
|
|
10507
10532
|
return !1;
|
|
10508
10533
|
const e = s;
|
|
@@ -10511,33 +10536,33 @@ function Wc(s) {
|
|
|
10511
10536
|
function X(s) {
|
|
10512
10537
|
return s.role === "assistant" && s.phase !== "commentary";
|
|
10513
10538
|
}
|
|
10514
|
-
function
|
|
10539
|
+
function Kc(s) {
|
|
10515
10540
|
if (!s || typeof s != "object")
|
|
10516
10541
|
return !1;
|
|
10517
10542
|
const e = s;
|
|
10518
10543
|
return e.type === "message" && e.role === "user" ? !1 : e.type === "message" || e.type === "function_call" || e.type === "function_call_output" || e.type === "run_error" || e.type === "run_status";
|
|
10519
10544
|
}
|
|
10520
|
-
function
|
|
10521
|
-
return s.filter((e, t) => oe(e) ? !
|
|
10545
|
+
function ps(s) {
|
|
10546
|
+
return s.filter((e, t) => oe(e) ? !nl(s, t) && !An(s, t) && !sl(s, t) && !il(s, t) : Vc(e) ? e.retryable === !0 && tl(s, t) ? !1 : !el(s, t) : !0);
|
|
10522
10547
|
}
|
|
10523
|
-
function
|
|
10548
|
+
function Vc(s) {
|
|
10524
10549
|
return s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.steered !== !0);
|
|
10525
10550
|
}
|
|
10526
10551
|
function oe(s) {
|
|
10527
10552
|
return s.role === "system" && s.dataType === "run_status" && s.loading === !0;
|
|
10528
10553
|
}
|
|
10529
|
-
function
|
|
10554
|
+
function fs(s) {
|
|
10530
10555
|
return s.steered !== !0 && (s.dataType === "assistant_draft" || s.loading === !0);
|
|
10531
10556
|
}
|
|
10532
|
-
function
|
|
10533
|
-
return s.some(
|
|
10557
|
+
function Gc(s) {
|
|
10558
|
+
return s.some(fs);
|
|
10534
10559
|
}
|
|
10535
10560
|
function ki(s, e) {
|
|
10536
10561
|
return (s.retryable === !0 || s.code === "transient_model_error") && s.code !== "run_recovery_exhausted" && e !== null && typeof s.clientMessageId == "string";
|
|
10537
10562
|
}
|
|
10538
10563
|
function Qc(s, e) {
|
|
10539
|
-
const t = [...s].reverse().find(
|
|
10540
|
-
return s.flatMap((r) => (i ? r.respondsToUserMessageId === i || !r.respondsToUserMessageId && n !== null && r.runId === n : n ? r.runId === n :
|
|
10564
|
+
const t = [...s].reverse().find(fs), i = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : t?.respondsToUserMessageId ?? null, n = typeof e.runId == "string" ? e.runId : t?.runId ?? null;
|
|
10565
|
+
return s.flatMap((r) => (i ? r.respondsToUserMessageId === i || !r.respondsToUserMessageId && n !== null && r.runId === n : n ? r.runId === n : fs(r)) ? r.dataType === "assistant_draft" || oe(r) ? [] : r.loading === !0 ? [{ ...r, loading: !1 }] : [r] : [r]);
|
|
10541
10566
|
}
|
|
10542
10567
|
function Mi(s, e, t, i) {
|
|
10543
10568
|
const n = s.findIndex(
|
|
@@ -10551,11 +10576,11 @@ function Mi(s, e, t, i) {
|
|
|
10551
10576
|
runId: t ?? r?.runId ?? null
|
|
10552
10577
|
};
|
|
10553
10578
|
}
|
|
10554
|
-
function
|
|
10579
|
+
function xe(s) {
|
|
10555
10580
|
return s?.type === "run_status" && s.status === "stopped";
|
|
10556
10581
|
}
|
|
10557
|
-
function
|
|
10558
|
-
return X(e) ? "completed" :
|
|
10582
|
+
function Jc(s, e) {
|
|
10583
|
+
return X(e) ? "completed" : xe(s) ? "stopped" : !Le(s) && (s?.type === "run_error" || s?.type === "run_status" && (s.status === "failed" || s.status === "interrupted")) ? "failed" : null;
|
|
10559
10584
|
}
|
|
10560
10585
|
function Ei(s, e, t) {
|
|
10561
10586
|
const i = new Set(
|
|
@@ -10569,16 +10594,16 @@ function Ei(s, e, t) {
|
|
|
10569
10594
|
}
|
|
10570
10595
|
function An(s, e) {
|
|
10571
10596
|
return s.some(
|
|
10572
|
-
(t, i) => i !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) &&
|
|
10597
|
+
(t, i) => i !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) && Xc(
|
|
10573
10598
|
s,
|
|
10574
10599
|
e,
|
|
10575
10600
|
i
|
|
10576
10601
|
)
|
|
10577
10602
|
);
|
|
10578
10603
|
}
|
|
10579
|
-
function
|
|
10604
|
+
function Xc(s, e, t) {
|
|
10580
10605
|
const i = s[e], n = s[t];
|
|
10581
|
-
if (
|
|
10606
|
+
if (je(i, n))
|
|
10582
10607
|
return !0;
|
|
10583
10608
|
if (!i.respondsToUserMessageId || n.respondsToUserMessageId || !i.runId || i.runId !== n.runId)
|
|
10584
10609
|
return !1;
|
|
@@ -10589,11 +10614,11 @@ function Jc(s, e, t) {
|
|
|
10589
10614
|
}
|
|
10590
10615
|
function Ci(s, e, t, i) {
|
|
10591
10616
|
const n = (t && t !== e ? t : null) ?? [...s].reverse().find(
|
|
10592
|
-
(c) => c.respondsToUserMessageId !== void 0 && c.respondsToUserMessageId !== e && Pi(c) && !
|
|
10617
|
+
(c) => c.respondsToUserMessageId !== void 0 && c.respondsToUserMessageId !== e && Pi(c) && !Zc(
|
|
10593
10618
|
s,
|
|
10594
10619
|
c.respondsToUserMessageId
|
|
10595
10620
|
)
|
|
10596
|
-
)?.respondsToUserMessageId ??
|
|
10621
|
+
)?.respondsToUserMessageId ?? Yc(
|
|
10597
10622
|
s,
|
|
10598
10623
|
e
|
|
10599
10624
|
);
|
|
@@ -10622,7 +10647,7 @@ function Ci(s, e, t, i) {
|
|
|
10622
10647
|
}
|
|
10623
10648
|
];
|
|
10624
10649
|
}
|
|
10625
|
-
function
|
|
10650
|
+
function Yc(s, e) {
|
|
10626
10651
|
const t = s.findIndex(
|
|
10627
10652
|
(i) => i.role === "user" && i.id === e
|
|
10628
10653
|
);
|
|
@@ -10636,21 +10661,21 @@ function Xc(s, e) {
|
|
|
10636
10661
|
function Pi(s) {
|
|
10637
10662
|
return s.role === "tool" || oe(s) ? !0 : s.role === "assistant" && s.phase === "commentary";
|
|
10638
10663
|
}
|
|
10639
|
-
function
|
|
10664
|
+
function Zc(s, e) {
|
|
10640
10665
|
return s.some(
|
|
10641
10666
|
(t) => t.respondsToUserMessageId === e && (X(t) || t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0))
|
|
10642
10667
|
);
|
|
10643
10668
|
}
|
|
10644
|
-
function
|
|
10669
|
+
function el(s, e) {
|
|
10645
10670
|
const t = s[e];
|
|
10646
10671
|
for (let i = e + 1; i < s.length; i += 1) {
|
|
10647
10672
|
const n = s[i];
|
|
10648
|
-
if (n.role === "assistant" &&
|
|
10673
|
+
if (n.role === "assistant" && je(t, n))
|
|
10649
10674
|
return !0;
|
|
10650
10675
|
}
|
|
10651
10676
|
return !1;
|
|
10652
10677
|
}
|
|
10653
|
-
function
|
|
10678
|
+
function tl(s, e) {
|
|
10654
10679
|
const t = s[e];
|
|
10655
10680
|
if (!t.respondsToUserMessageId)
|
|
10656
10681
|
return !1;
|
|
@@ -10663,32 +10688,32 @@ function el(s, e) {
|
|
|
10663
10688
|
}
|
|
10664
10689
|
return !1;
|
|
10665
10690
|
}
|
|
10666
|
-
function
|
|
10691
|
+
function sl(s, e) {
|
|
10667
10692
|
const t = s[e];
|
|
10668
10693
|
return s.some(
|
|
10669
|
-
(i, n) => n !== e && i.role === "assistant" &&
|
|
10694
|
+
(i, n) => n !== e && i.role === "assistant" && je(t, i)
|
|
10670
10695
|
);
|
|
10671
10696
|
}
|
|
10672
|
-
function
|
|
10697
|
+
function il(s, e) {
|
|
10673
10698
|
const t = s[e];
|
|
10674
10699
|
return s.some(
|
|
10675
|
-
(i, n) => n !== e && i.role === "tool" &&
|
|
10700
|
+
(i, n) => n !== e && i.role === "tool" && je(t, i)
|
|
10676
10701
|
);
|
|
10677
10702
|
}
|
|
10678
|
-
function
|
|
10703
|
+
function nl(s, e) {
|
|
10679
10704
|
const t = s[e];
|
|
10680
10705
|
for (let i = e + 1; i < s.length; i += 1)
|
|
10681
|
-
if (oe(s[i]) &&
|
|
10706
|
+
if (oe(s[i]) && je(t, s[i]))
|
|
10682
10707
|
return !0;
|
|
10683
10708
|
return !1;
|
|
10684
10709
|
}
|
|
10685
|
-
function
|
|
10710
|
+
function je(s, e) {
|
|
10686
10711
|
return !!(s.respondsToUserMessageId && s.respondsToUserMessageId === e.respondsToUserMessageId);
|
|
10687
10712
|
}
|
|
10688
10713
|
function A(s, e) {
|
|
10689
10714
|
return s && typeof s == "object" && typeof s[e] == "string" ? s[e] : null;
|
|
10690
10715
|
}
|
|
10691
|
-
function
|
|
10716
|
+
function rl(s, e) {
|
|
10692
10717
|
try {
|
|
10693
10718
|
const t = window.localStorage.getItem(`${yn}${s}`);
|
|
10694
10719
|
if (!t)
|
|
@@ -10696,7 +10721,7 @@ function nl(s, e) {
|
|
|
10696
10721
|
const i = JSON.parse(t), n = typeof i.sessionId == "string" ? i.sessionId : null;
|
|
10697
10722
|
if (e !== void 0 && n !== e)
|
|
10698
10723
|
return null;
|
|
10699
|
-
const r = Array.isArray(i.messages) ? i.messages.map(
|
|
10724
|
+
const r = Array.isArray(i.messages) ? i.messages.map(yl).filter((o) => !!o) : [];
|
|
10700
10725
|
return {
|
|
10701
10726
|
sessionId: n,
|
|
10702
10727
|
messages: r
|
|
@@ -10705,44 +10730,44 @@ function nl(s, e) {
|
|
|
10705
10730
|
return null;
|
|
10706
10731
|
}
|
|
10707
10732
|
}
|
|
10708
|
-
function
|
|
10733
|
+
function gs(s) {
|
|
10709
10734
|
return s.role === "user" || s.role === "assistant" || // Live activity is part of the readable conversation cache. Keeping it across host navigation prevents a
|
|
10710
10735
|
// running tool or commentary history from disappearing while authoritative hydration is still in flight.
|
|
10711
10736
|
s.role === "tool" || s.dataType === "run_status" || s.dataType === "run_error";
|
|
10712
10737
|
}
|
|
10713
|
-
function
|
|
10738
|
+
function ol(s, e) {
|
|
10714
10739
|
try {
|
|
10715
10740
|
window.localStorage.setItem(
|
|
10716
10741
|
`${yn}${s}`,
|
|
10717
10742
|
JSON.stringify({
|
|
10718
10743
|
sessionId: e.sessionId,
|
|
10719
|
-
messages: e.messages.filter(
|
|
10744
|
+
messages: e.messages.filter(gs).slice(-Ua).map(ml)
|
|
10720
10745
|
})
|
|
10721
10746
|
);
|
|
10722
10747
|
} catch {
|
|
10723
10748
|
return;
|
|
10724
10749
|
}
|
|
10725
10750
|
}
|
|
10726
|
-
function
|
|
10751
|
+
function al(s) {
|
|
10727
10752
|
try {
|
|
10728
|
-
const e = window.localStorage.getItem(`${
|
|
10753
|
+
const e = window.localStorage.getItem(`${cs}${s}`);
|
|
10729
10754
|
if (!e)
|
|
10730
10755
|
return [];
|
|
10731
10756
|
const t = JSON.parse(e);
|
|
10732
|
-
return Array.isArray(t) ? t.filter(
|
|
10757
|
+
return Array.isArray(t) ? t.filter(Cs) : [];
|
|
10733
10758
|
} catch {
|
|
10734
10759
|
return [];
|
|
10735
10760
|
}
|
|
10736
10761
|
}
|
|
10737
10762
|
function $(s, e) {
|
|
10738
10763
|
try {
|
|
10739
|
-
const t = e.filter(
|
|
10764
|
+
const t = e.filter(Cs);
|
|
10740
10765
|
if (t.length === 0) {
|
|
10741
|
-
window.localStorage.removeItem(`${
|
|
10766
|
+
window.localStorage.removeItem(`${cs}${s}`);
|
|
10742
10767
|
return;
|
|
10743
10768
|
}
|
|
10744
10769
|
window.localStorage.setItem(
|
|
10745
|
-
`${
|
|
10770
|
+
`${cs}${s}`,
|
|
10746
10771
|
JSON.stringify(t.slice(-25))
|
|
10747
10772
|
);
|
|
10748
10773
|
} catch {
|
|
@@ -10804,19 +10829,19 @@ function Ui(s, e) {
|
|
|
10804
10829
|
}
|
|
10805
10830
|
kn(s, e);
|
|
10806
10831
|
}
|
|
10807
|
-
function
|
|
10832
|
+
function cl(s) {
|
|
10808
10833
|
try {
|
|
10809
10834
|
const e = `${bt}${s}`, t = window.sessionStorage.getItem(e);
|
|
10810
10835
|
if (window.sessionStorage.removeItem(e), !t)
|
|
10811
10836
|
return [];
|
|
10812
10837
|
const i = JSON.parse(t);
|
|
10813
|
-
return Array.isArray(i) ? i.flatMap((n) =>
|
|
10838
|
+
return Array.isArray(i) ? i.flatMap((n) => dl(n) ? [{
|
|
10814
10839
|
...n.event,
|
|
10815
10840
|
page: W(),
|
|
10816
10841
|
rawOutput: {
|
|
10817
10842
|
pageContextRestarted: !0,
|
|
10818
10843
|
outcome: "unknown",
|
|
10819
|
-
message:
|
|
10844
|
+
message: ll(location.href),
|
|
10820
10845
|
currentUrl: location.href,
|
|
10821
10846
|
console: [],
|
|
10822
10847
|
metadata: {
|
|
@@ -10833,17 +10858,17 @@ function al(s) {
|
|
|
10833
10858
|
return [];
|
|
10834
10859
|
}
|
|
10835
10860
|
}
|
|
10836
|
-
function
|
|
10861
|
+
function ll(s) {
|
|
10837
10862
|
return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
|
|
10838
10863
|
Current URL: ${s}`;
|
|
10839
10864
|
}
|
|
10840
|
-
function
|
|
10865
|
+
function dl(s) {
|
|
10841
10866
|
if (!s || typeof s != "object")
|
|
10842
10867
|
return !1;
|
|
10843
10868
|
const e = s, t = e.event;
|
|
10844
|
-
return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" &&
|
|
10869
|
+
return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" && Cs(t) && t.type === "tool.result";
|
|
10845
10870
|
}
|
|
10846
|
-
function
|
|
10871
|
+
function ul(s, e) {
|
|
10847
10872
|
const t = new Set(
|
|
10848
10873
|
s.flatMap((i) => i.type === "tool.result" ? [i.callId] : [])
|
|
10849
10874
|
);
|
|
@@ -10852,14 +10877,14 @@ function dl(s, e) {
|
|
|
10852
10877
|
...e.filter((i) => !t.has(i.callId))
|
|
10853
10878
|
];
|
|
10854
10879
|
}
|
|
10855
|
-
function
|
|
10880
|
+
function hl(s) {
|
|
10856
10881
|
try {
|
|
10857
10882
|
window.sessionStorage.removeItem(`${bt}${s}`);
|
|
10858
10883
|
} catch {
|
|
10859
10884
|
return;
|
|
10860
10885
|
}
|
|
10861
10886
|
}
|
|
10862
|
-
function
|
|
10887
|
+
function Cs(s) {
|
|
10863
10888
|
if (!s || typeof s != "object")
|
|
10864
10889
|
return !1;
|
|
10865
10890
|
const e = s;
|
|
@@ -10888,32 +10913,32 @@ function En(s, e) {
|
|
|
10888
10913
|
fileUrl: new URL(s.fileUrl, e).toString()
|
|
10889
10914
|
} : s;
|
|
10890
10915
|
}
|
|
10891
|
-
function
|
|
10892
|
-
return s.type ||
|
|
10916
|
+
function ys(s) {
|
|
10917
|
+
return s.type || gl(s.name) || "application/octet-stream";
|
|
10893
10918
|
}
|
|
10894
|
-
function
|
|
10919
|
+
function pl(s) {
|
|
10895
10920
|
Cn({
|
|
10896
10921
|
name: s.name,
|
|
10897
|
-
mimeType:
|
|
10922
|
+
mimeType: ys(s),
|
|
10898
10923
|
sizeBytes: s.size
|
|
10899
10924
|
});
|
|
10900
10925
|
}
|
|
10901
10926
|
function Cn(s) {
|
|
10902
|
-
const e =
|
|
10903
|
-
if (!
|
|
10927
|
+
const e = fl(s.name), t = s.mimeType.trim().toLowerCase();
|
|
10928
|
+
if (!Ca.has(`${e}:${t}`))
|
|
10904
10929
|
throw new Error("This attachment type is not supported by the embedded model provider");
|
|
10905
10930
|
if (s.sizeBytes <= 0 || s.sizeBytes >= fn)
|
|
10906
10931
|
throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
|
|
10907
10932
|
}
|
|
10908
|
-
function
|
|
10933
|
+
function fl(s) {
|
|
10909
10934
|
const e = s.trim().toLowerCase(), t = e.lastIndexOf(".");
|
|
10910
10935
|
return t >= 0 ? e.slice(t) : "";
|
|
10911
10936
|
}
|
|
10912
|
-
function
|
|
10937
|
+
function gl(s) {
|
|
10913
10938
|
const e = s.toLowerCase();
|
|
10914
10939
|
return e.endsWith(".png") ? "image/png" : e.endsWith(".jpg") || e.endsWith(".jpeg") ? "image/jpeg" : e.endsWith(".webp") ? "image/webp" : e.endsWith(".gif") ? "image/gif" : e.endsWith(".pdf") ? "application/pdf" : null;
|
|
10915
10940
|
}
|
|
10916
|
-
function
|
|
10941
|
+
function yl(s) {
|
|
10917
10942
|
if (!s || typeof s != "object")
|
|
10918
10943
|
return null;
|
|
10919
10944
|
const e = s;
|
|
@@ -10935,7 +10960,7 @@ function gl(s) {
|
|
|
10935
10960
|
loading: typeof e.loading == "boolean" ? e.loading : void 0
|
|
10936
10961
|
};
|
|
10937
10962
|
}
|
|
10938
|
-
function
|
|
10963
|
+
function ml(s) {
|
|
10939
10964
|
return s.attachments?.length ? {
|
|
10940
10965
|
...s,
|
|
10941
10966
|
attachments: s.attachments.map(yt)
|
|
@@ -10959,38 +10984,38 @@ function E(s) {
|
|
|
10959
10984
|
const e = s.runId;
|
|
10960
10985
|
return typeof e == "string" && e ? e : null;
|
|
10961
10986
|
}
|
|
10962
|
-
function
|
|
10987
|
+
function Il(s) {
|
|
10963
10988
|
const e = s?.timeoutMs;
|
|
10964
|
-
return !!s && typeof s == "object" && typeof s.summary == "string" && typeof s.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <=
|
|
10989
|
+
return !!s && typeof s == "object" && typeof s.summary == "string" && typeof s.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <= Wa);
|
|
10965
10990
|
}
|
|
10966
10991
|
function Pn(s) {
|
|
10967
10992
|
const e = {};
|
|
10968
10993
|
try {
|
|
10969
10994
|
new Headers(s).forEach((t, i) => {
|
|
10970
|
-
Object.keys(e).length <
|
|
10995
|
+
Object.keys(e).length < ks && (e[i] = Ps(i, t));
|
|
10971
10996
|
});
|
|
10972
10997
|
} catch {
|
|
10973
10998
|
return {};
|
|
10974
10999
|
}
|
|
10975
11000
|
return e;
|
|
10976
11001
|
}
|
|
10977
|
-
function
|
|
10978
|
-
return Bn(s) ? _t : ee(It(e),
|
|
11002
|
+
function Ps(s, e) {
|
|
11003
|
+
return Bn(s) ? _t : ee(It(e), Pa);
|
|
10979
11004
|
}
|
|
10980
|
-
function
|
|
11005
|
+
function Sl(s, e) {
|
|
10981
11006
|
return typeof s == "string" ? s : s instanceof URL ? s.toString() : e?.url ?? "";
|
|
10982
11007
|
}
|
|
10983
|
-
async function
|
|
11008
|
+
async function wl(s, e, t, i) {
|
|
10984
11009
|
const n = Pn(s.headers);
|
|
10985
11010
|
i({
|
|
10986
11011
|
...e,
|
|
10987
11012
|
responseStatus: s.status,
|
|
10988
11013
|
responseHeaders: n,
|
|
10989
|
-
responseBody: await
|
|
11014
|
+
responseBody: await bl(s),
|
|
10990
11015
|
durationMs: Date.now() - t
|
|
10991
11016
|
});
|
|
10992
11017
|
}
|
|
10993
|
-
async function
|
|
11018
|
+
async function bl(s) {
|
|
10994
11019
|
if (!Dn(s.headers))
|
|
10995
11020
|
return;
|
|
10996
11021
|
let e = null, t = null;
|
|
@@ -11000,7 +11025,7 @@ async function wl(s) {
|
|
|
11000
11025
|
const i = new Promise((a) => {
|
|
11001
11026
|
t = window.setTimeout(() => {
|
|
11002
11027
|
e?.cancel(), a("timeout");
|
|
11003
|
-
},
|
|
11028
|
+
}, Da);
|
|
11004
11029
|
}), n = new TextDecoder();
|
|
11005
11030
|
let r = "", o = 0;
|
|
11006
11031
|
for (; ; ) {
|
|
@@ -11010,7 +11035,7 @@ async function wl(s) {
|
|
|
11010
11035
|
const { done: c, value: l } = a;
|
|
11011
11036
|
if (c)
|
|
11012
11037
|
return ee(r + n.decode());
|
|
11013
|
-
const d =
|
|
11038
|
+
const d = As - o;
|
|
11014
11039
|
if (l.byteLength > d)
|
|
11015
11040
|
return r += n.decode(l.subarray(0, Math.max(d, 0)), { stream: !0 }), e.cancel(), `${ee(r)}... [truncated]`;
|
|
11016
11041
|
o += l.byteLength, r += n.decode(l, { stream: !0 });
|
|
@@ -11022,7 +11047,7 @@ async function wl(s) {
|
|
|
11022
11047
|
t !== null && window.clearTimeout(t);
|
|
11023
11048
|
}
|
|
11024
11049
|
}
|
|
11025
|
-
function
|
|
11050
|
+
function vl(s, e) {
|
|
11026
11051
|
if (Dn(new Headers(e)))
|
|
11027
11052
|
try {
|
|
11028
11053
|
return s.responseType === "" || s.responseType === "text" ? ee(s.responseText ?? "") : void 0;
|
|
@@ -11034,7 +11059,7 @@ function Oi(s) {
|
|
|
11034
11059
|
if (typeof s == "string")
|
|
11035
11060
|
return ee(s);
|
|
11036
11061
|
}
|
|
11037
|
-
function
|
|
11062
|
+
function Tl(s) {
|
|
11038
11063
|
return V({
|
|
11039
11064
|
...s,
|
|
11040
11065
|
requestBody: xi(s.requestBody),
|
|
@@ -11057,10 +11082,10 @@ function Dn(s) {
|
|
|
11057
11082
|
if (!s)
|
|
11058
11083
|
return !1;
|
|
11059
11084
|
const e = s.get("content-type")?.toLowerCase() ?? "", t = s.get("content-length"), i = Number(t);
|
|
11060
|
-
return t !== null && Number.isInteger(i) && i >= 0 && i <=
|
|
11085
|
+
return t !== null && Number.isInteger(i) && i >= 0 && i <= As && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
|
|
11061
11086
|
}
|
|
11062
11087
|
function fe(s, e = {}, t) {
|
|
11063
|
-
if (
|
|
11088
|
+
if (Rl(t))
|
|
11064
11089
|
return !0;
|
|
11065
11090
|
const i = Object.entries(e).find(([n]) => n.toLowerCase() === "content-type")?.[1]?.toLowerCase();
|
|
11066
11091
|
if (i?.includes("multipart/form-data") || i?.includes("application/octet-stream"))
|
|
@@ -11075,7 +11100,7 @@ function fe(s, e = {}, t) {
|
|
|
11075
11100
|
return !0;
|
|
11076
11101
|
}
|
|
11077
11102
|
}
|
|
11078
|
-
function
|
|
11103
|
+
function _l(s, e) {
|
|
11079
11104
|
if (fe(s))
|
|
11080
11105
|
return !0;
|
|
11081
11106
|
try {
|
|
@@ -11085,26 +11110,26 @@ function Tl(s, e) {
|
|
|
11085
11110
|
return !0;
|
|
11086
11111
|
}
|
|
11087
11112
|
}
|
|
11088
|
-
function
|
|
11113
|
+
function Rl(s) {
|
|
11089
11114
|
return s instanceof FormData || s instanceof Blob || s instanceof ArrayBuffer || ArrayBuffer.isView(s) || typeof ReadableStream < "u" && s instanceof ReadableStream;
|
|
11090
11115
|
}
|
|
11091
|
-
function
|
|
11116
|
+
function Al(s) {
|
|
11092
11117
|
const e = {};
|
|
11093
11118
|
for (const t of s.trim().split(/[\r\n]+/)) {
|
|
11094
11119
|
const i = t.indexOf(":");
|
|
11095
11120
|
if (i <= 0)
|
|
11096
11121
|
continue;
|
|
11097
|
-
if (Object.keys(e).length >=
|
|
11122
|
+
if (Object.keys(e).length >= ks)
|
|
11098
11123
|
break;
|
|
11099
11124
|
const n = t.slice(0, i).trim();
|
|
11100
|
-
e[n] =
|
|
11125
|
+
e[n] = Ps(n, t.slice(i + 1).trim());
|
|
11101
11126
|
}
|
|
11102
11127
|
return e;
|
|
11103
11128
|
}
|
|
11104
|
-
function ee(s, e =
|
|
11129
|
+
function ee(s, e = As) {
|
|
11105
11130
|
return s.length <= e ? s : `${s.slice(0, e)}... [truncated ${s.length - e} chars]`;
|
|
11106
11131
|
}
|
|
11107
|
-
function
|
|
11132
|
+
function Vt(s) {
|
|
11108
11133
|
return `${s}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
11109
11134
|
}
|
|
11110
11135
|
class ht extends Error {
|
|
@@ -11119,27 +11144,27 @@ async function tt(s, e) {
|
|
|
11119
11144
|
try {
|
|
11120
11145
|
return await s();
|
|
11121
11146
|
} catch (n) {
|
|
11122
|
-
if (t = n, i >= ui - 1 || !
|
|
11147
|
+
if (t = n, i >= ui - 1 || !Ml(n))
|
|
11123
11148
|
throw n;
|
|
11124
|
-
await
|
|
11149
|
+
await kl(i);
|
|
11125
11150
|
}
|
|
11126
11151
|
throw t instanceof Error ? t : new Error(e);
|
|
11127
11152
|
}
|
|
11128
|
-
function
|
|
11153
|
+
function kl(s) {
|
|
11129
11154
|
return new Promise((e) => {
|
|
11130
|
-
window.setTimeout(e,
|
|
11155
|
+
window.setTimeout(e, Ea[s] ?? 0);
|
|
11131
11156
|
});
|
|
11132
11157
|
}
|
|
11133
|
-
function kl(s) {
|
|
11134
|
-
return s instanceof ht ? Ml(s.status) : s instanceof TypeError;
|
|
11135
|
-
}
|
|
11136
11158
|
function Ml(s) {
|
|
11137
|
-
return s
|
|
11159
|
+
return s instanceof ht ? El(s.status) : s instanceof TypeError;
|
|
11138
11160
|
}
|
|
11139
11161
|
function El(s) {
|
|
11162
|
+
return s === 408 || s === 409 || s === 429 || s >= 500;
|
|
11163
|
+
}
|
|
11164
|
+
function Cl(s) {
|
|
11140
11165
|
return s === 401 || s === 403;
|
|
11141
11166
|
}
|
|
11142
|
-
const _t = "[REDACTED_SECRET]", te = "[REDACTED_TOKEN]",
|
|
11167
|
+
const _t = "[REDACTED_SECRET]", te = "[REDACTED_TOKEN]", Pl = "[REDACTED_SIGNED_URL]", Dl = 20, Ul = /^(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|token|api_key|apiKey|apikey|key|secret|signature|sig|password|passwd|pwd|code|state|session|jwt|csrf|csrfToken|xsrf|xsrfToken)$/i, Un = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, qn = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, On = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, xn = /\b(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|api_key|apiKey|apikey|client_secret|clientSecret|password|secret|token|jwt|csrf|csrfToken|xsrf|xsrfToken)\b\s*[:=]\s*["']?[^"',&\s}]+/gi, ql = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Ol = /\bhttps?:\/\/[^\s"'<>]+/gi, xl = /[),.;\]]+$/;
|
|
11143
11168
|
function V(s) {
|
|
11144
11169
|
return mt(s, 0, /* @__PURE__ */ new WeakSet());
|
|
11145
11170
|
}
|
|
@@ -11148,7 +11173,7 @@ function mt(s, e, t) {
|
|
|
11148
11173
|
return s.startsWith("data:image/") || s.startsWith("data:application/pdf;") ? s : It(s);
|
|
11149
11174
|
if (s === null || typeof s != "object")
|
|
11150
11175
|
return s;
|
|
11151
|
-
if (e >=
|
|
11176
|
+
if (e >= Dl)
|
|
11152
11177
|
return "[REDACTED_MAX_DEPTH]";
|
|
11153
11178
|
if (t.has(s))
|
|
11154
11179
|
return "[REDACTED_CIRCULAR]";
|
|
@@ -11156,40 +11181,40 @@ function mt(s, e, t) {
|
|
|
11156
11181
|
return s.map((n) => mt(n, e + 1, t));
|
|
11157
11182
|
const i = {};
|
|
11158
11183
|
for (const [n, r] of Object.entries(s))
|
|
11159
|
-
n === "pageContent" ? i[n] = r : Bn(n) ? i[n] = _t : i[n] = n.toLowerCase() === "url" ?
|
|
11184
|
+
n === "pageContent" ? i[n] = r : Bn(n) ? i[n] = _t : i[n] = n.toLowerCase() === "url" ? Bl(r) : mt(r, e + 1, t);
|
|
11160
11185
|
return i;
|
|
11161
11186
|
}
|
|
11162
11187
|
function Bn(s) {
|
|
11163
11188
|
const e = s.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
11164
11189
|
return e.includes("authorization") || e.includes("cookie") || e.includes("password") || e.includes("passwd") || e === "pwd" || e.includes("secret") || e === "token" || e.endsWith("token") || e.includes("apikey") || e.includes("csrf") || e.includes("xsrf") || e === "jwt" || e === "session" || e === "signature" || e.includes("privatekey");
|
|
11165
11190
|
}
|
|
11166
|
-
function
|
|
11191
|
+
function Bl(s) {
|
|
11167
11192
|
return typeof s == "string" ? Nn(s) : mt(s, 0, /* @__PURE__ */ new WeakSet());
|
|
11168
11193
|
}
|
|
11169
11194
|
function Nn(s) {
|
|
11170
11195
|
try {
|
|
11171
11196
|
const e = new URL(s, location.href);
|
|
11172
11197
|
for (const t of Array.from(e.searchParams.keys()))
|
|
11173
|
-
|
|
11198
|
+
Ul.test(t) && e.searchParams.set(t, te);
|
|
11174
11199
|
return e.username && (e.username = te), e.password && (e.password = te), e.toString();
|
|
11175
11200
|
} catch {
|
|
11176
|
-
return
|
|
11201
|
+
return Nl(s);
|
|
11177
11202
|
}
|
|
11178
11203
|
}
|
|
11179
11204
|
function It(s) {
|
|
11180
|
-
return s.replace(
|
|
11205
|
+
return s.replace(ql, Pl).replace(Ol, Ll).replace(Un, `Bearer ${te}`).replace(qn, `Basic ${te}`).replace(On, te).replace(xn, (e, t) => `${t}: ${_t}`);
|
|
11181
11206
|
}
|
|
11182
|
-
function
|
|
11207
|
+
function Nl(s) {
|
|
11183
11208
|
return s.replace(Un, `Bearer ${te}`).replace(qn, `Basic ${te}`).replace(On, te).replace(xn, (e, t) => `${t}: ${_t}`);
|
|
11184
11209
|
}
|
|
11185
|
-
function
|
|
11186
|
-
const e = s.match(
|
|
11210
|
+
function Ll(s) {
|
|
11211
|
+
const e = s.match(xl)?.[0] ?? "", t = e ? s.slice(0, -e.length) : s;
|
|
11187
11212
|
return `${Nn(t)}${e}`;
|
|
11188
11213
|
}
|
|
11189
|
-
const
|
|
11214
|
+
const Jl = Object.freeze({
|
|
11190
11215
|
init: (s) => vt.init(s)
|
|
11191
11216
|
});
|
|
11192
|
-
function
|
|
11217
|
+
function Xl(s) {
|
|
11193
11218
|
return vt.init(s);
|
|
11194
11219
|
}
|
|
11195
11220
|
function Bi(s) {
|
|
@@ -11201,34 +11226,34 @@ function Bi(s) {
|
|
|
11201
11226
|
return [...e.values()];
|
|
11202
11227
|
}
|
|
11203
11228
|
export {
|
|
11204
|
-
|
|
11205
|
-
|
|
11206
|
-
|
|
11207
|
-
|
|
11229
|
+
ri as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
|
|
11230
|
+
aa as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
|
|
11231
|
+
oa as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
|
|
11232
|
+
ca as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
|
|
11208
11233
|
Ql as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
|
|
11209
|
-
|
|
11210
|
-
|
|
11211
|
-
|
|
11212
|
-
|
|
11234
|
+
Jl as PlunoProductAgent,
|
|
11235
|
+
Vo as ProductAgentInteractionManager,
|
|
11236
|
+
ti as ProductAgentQueryController,
|
|
11237
|
+
Gl as ProductAgentRemoteRuntimeClient,
|
|
11213
11238
|
vt as ProductAgentSessionEngine,
|
|
11214
|
-
|
|
11215
|
-
|
|
11239
|
+
Wl as ProductAgentSessionHistoryManager,
|
|
11240
|
+
zl as ProductAgentTaskPageTitleController,
|
|
11216
11241
|
ne as ProductAgentTokenProviderError,
|
|
11217
|
-
|
|
11218
|
-
|
|
11242
|
+
Ba as calculateReconnectDelay,
|
|
11243
|
+
jl as createLocalStorageInteractionDecisionStorage,
|
|
11219
11244
|
lt as createProductAgentQueryState,
|
|
11220
|
-
|
|
11221
|
-
|
|
11222
|
-
|
|
11223
|
-
|
|
11224
|
-
|
|
11225
|
-
|
|
11245
|
+
Xl as createProductAgentRuntime,
|
|
11246
|
+
Kl as createProductAgentTaskPageTitleDocument,
|
|
11247
|
+
Jl as default,
|
|
11248
|
+
sa as formatProductAgentTaskPageTitle,
|
|
11249
|
+
oc as getProductAgentOriginAccessErrorMessage,
|
|
11250
|
+
Vl as isProductAgentRuntimeCommand,
|
|
11226
11251
|
Qo as mergeProductAgentEntityPages,
|
|
11227
11252
|
dt as normalizeProductAgentEntityPage,
|
|
11228
|
-
|
|
11229
|
-
|
|
11230
|
-
|
|
11231
|
-
|
|
11232
|
-
|
|
11233
|
-
|
|
11253
|
+
zt as normalizeProductAgentSessionItems,
|
|
11254
|
+
Go as readLocalStorageInteractionDecisions,
|
|
11255
|
+
$l as resolveProductAgentComposerAction,
|
|
11256
|
+
Hl as resolveProductAgentWidgetPresentation,
|
|
11257
|
+
Jo as selectProductAgentQueryEntities,
|
|
11258
|
+
pl as validateProductAgentProviderInputFile
|
|
11234
11259
|
};
|