@pluno/product-agent-web 0.1.226 → 0.1.227
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/product-agent-sdk.js +796 -792
- package/dist/product-agent-widget.js +1252 -1248
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function Ln(s, e = Math.random, t = Math.random) {
|
|
2
2
|
const i = () => Math.floor(t() * 21) - 10;
|
|
3
3
|
return {
|
|
4
4
|
"activeUsers.load": async () => ({ count: await s(), updatedAt: Date.now(), offset: i() }),
|
|
@@ -6,7 +6,7 @@ function Nn(s, e = Math.random, t = Math.random) {
|
|
|
6
6
|
"activeUsers.wait": ({ milliseconds: n }) => new Promise((r) => setTimeout(() => r(null), n + Math.round((e() - 0.5) * 1e3)))
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
|
-
async function
|
|
9
|
+
async function Fn(s, e = fetch) {
|
|
10
10
|
const t = await e(new URL("/api/product-agent/embed/active-users", s), { cache: "no-store", credentials: "omit" });
|
|
11
11
|
if (!t.ok) throw new Error(`Active users request failed (${t.status})`);
|
|
12
12
|
const i = await t.json();
|
|
@@ -45,7 +45,7 @@ const st = /* @__PURE__ */ Object.create(null);
|
|
|
45
45
|
Object.keys(Y).forEach((s) => {
|
|
46
46
|
st[Y[s]] = s;
|
|
47
47
|
});
|
|
48
|
-
const Qt = { type: "error", data: "parser error" },
|
|
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, ys = ({ type: s, data: e }, t, i) => Ni && e instanceof Blob ? t ? i(e) : Us(e, i) : Li && (e instanceof ArrayBuffer || Fi(e)) ? t ? i(e) : Us(new Blob([e]), i) : i(Y[s] + (e || "")), Us = (s, e) => {
|
|
49
49
|
const t = new FileReader();
|
|
50
50
|
return t.onload = function() {
|
|
51
51
|
const i = t.result.split(",")[1];
|
|
@@ -56,10 +56,10 @@ function qs(s) {
|
|
|
56
56
|
return s instanceof Uint8Array ? s : s instanceof ArrayBuffer ? new Uint8Array(s) : new Uint8Array(s.buffer, s.byteOffset, s.byteLength);
|
|
57
57
|
}
|
|
58
58
|
let kt;
|
|
59
|
-
function
|
|
60
|
-
if (
|
|
59
|
+
function jn(s, e) {
|
|
60
|
+
if (Ni && s.data instanceof Blob)
|
|
61
61
|
return s.data.arrayBuffer().then(qs).then(e);
|
|
62
|
-
if (
|
|
62
|
+
if (Li && (s.data instanceof ArrayBuffer || Fi(s.data)))
|
|
63
63
|
return e(qs(s.data));
|
|
64
64
|
ys(s, !1, (t) => {
|
|
65
65
|
kt || (kt = new TextEncoder()), e(kt.encode(t));
|
|
@@ -75,29 +75,29 @@ const Hn = (s) => {
|
|
|
75
75
|
for (i = 0; i < t; i += 4)
|
|
76
76
|
r = De[s.charCodeAt(i)], o = De[s.charCodeAt(i + 1)], a = De[s.charCodeAt(i + 2)], c = De[s.charCodeAt(i + 3)], d[n++] = r << 2 | o >> 4, d[n++] = (o & 15) << 4 | a >> 2, d[n++] = (a & 3) << 6 | c & 63;
|
|
77
77
|
return l;
|
|
78
|
-
},
|
|
78
|
+
}, $n = typeof ArrayBuffer == "function", ms = (s, e) => {
|
|
79
79
|
if (typeof s != "string")
|
|
80
80
|
return {
|
|
81
81
|
type: "message",
|
|
82
|
-
data:
|
|
82
|
+
data: ji(s, e)
|
|
83
83
|
};
|
|
84
84
|
const t = s.charAt(0);
|
|
85
85
|
return t === "b" ? {
|
|
86
86
|
type: "message",
|
|
87
|
-
data:
|
|
87
|
+
data: Wn(s.substring(1), e)
|
|
88
88
|
} : st[t] ? s.length > 1 ? {
|
|
89
89
|
type: st[t],
|
|
90
90
|
data: s.substring(1)
|
|
91
91
|
} : {
|
|
92
92
|
type: st[t]
|
|
93
93
|
} : Qt;
|
|
94
|
-
},
|
|
95
|
-
if (
|
|
94
|
+
}, Wn = (s, e) => {
|
|
95
|
+
if ($n) {
|
|
96
96
|
const t = Hn(s);
|
|
97
|
-
return
|
|
97
|
+
return ji(t, e);
|
|
98
98
|
} else
|
|
99
99
|
return { base64: !0, data: s };
|
|
100
|
-
},
|
|
100
|
+
}, ji = (s, e) => e === "blob" ? s instanceof Blob ? s : new Blob([s]) : s instanceof ArrayBuffer ? s : s.buffer, Hi = "", zn = (s, e) => {
|
|
101
101
|
const t = s.length, i = new Array(t);
|
|
102
102
|
let n = 0;
|
|
103
103
|
s.forEach((r, o) => {
|
|
@@ -105,7 +105,7 @@ const Hn = (s) => {
|
|
|
105
105
|
i[o] = a, ++n === t && e(i.join(Hi));
|
|
106
106
|
});
|
|
107
107
|
});
|
|
108
|
-
},
|
|
108
|
+
}, Kn = (s, e) => {
|
|
109
109
|
const t = s.split(Hi), i = [];
|
|
110
110
|
for (let n = 0; n < t.length; n++) {
|
|
111
111
|
const r = ms(t[n], e);
|
|
@@ -114,10 +114,10 @@ const Hn = (s) => {
|
|
|
114
114
|
}
|
|
115
115
|
return i;
|
|
116
116
|
};
|
|
117
|
-
function
|
|
117
|
+
function Vn() {
|
|
118
118
|
return new TransformStream({
|
|
119
119
|
transform(s, e) {
|
|
120
|
-
|
|
120
|
+
jn(s, (t) => {
|
|
121
121
|
const i = t.length;
|
|
122
122
|
let n;
|
|
123
123
|
if (i < 126)
|
|
@@ -149,7 +149,7 @@ function Ke(s, e) {
|
|
|
149
149
|
t[n] = s[0][i++], i === s[0].length && (s.shift(), i = 0);
|
|
150
150
|
return s.length && i < s[0].length && (s[0] = s[0].slice(i)), t;
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function Qn(s, e) {
|
|
153
153
|
Mt || (Mt = new TextDecoder());
|
|
154
154
|
const t = [];
|
|
155
155
|
let i = 0, n = -1, r = !1;
|
|
@@ -189,11 +189,11 @@ function Vn(s, e) {
|
|
|
189
189
|
}
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
|
-
const
|
|
192
|
+
const $i = 4;
|
|
193
193
|
function C(s) {
|
|
194
|
-
if (s) return
|
|
194
|
+
if (s) return Gn(s);
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function Gn(s) {
|
|
197
197
|
for (var e in C.prototype)
|
|
198
198
|
s[e] = C.prototype[e];
|
|
199
199
|
return s;
|
|
@@ -239,34 +239,34 @@ C.prototype.listeners = function(s) {
|
|
|
239
239
|
C.prototype.hasListeners = function(s) {
|
|
240
240
|
return !!this.listeners(s).length;
|
|
241
241
|
};
|
|
242
|
-
const St = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), Q = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(),
|
|
243
|
-
function
|
|
242
|
+
const St = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), Q = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Jn = "arraybuffer";
|
|
243
|
+
function Wi(s, ...e) {
|
|
244
244
|
return e.reduce((t, i) => (s.hasOwnProperty(i) && (t[i] = s[i]), t), {});
|
|
245
245
|
}
|
|
246
|
-
const
|
|
246
|
+
const Xn = Q.setTimeout, Yn = Q.clearTimeout;
|
|
247
247
|
function wt(s, e) {
|
|
248
|
-
e.useNativeTimers ? (s.setTimeoutFn =
|
|
249
|
-
}
|
|
250
|
-
const Yn = 1.33;
|
|
251
|
-
function Zn(s) {
|
|
252
|
-
return typeof s == "string" ? er(s) : Math.ceil((s.byteLength || s.size) * Yn);
|
|
248
|
+
e.useNativeTimers ? (s.setTimeoutFn = Xn.bind(Q), s.clearTimeoutFn = Yn.bind(Q)) : (s.setTimeoutFn = Q.setTimeout.bind(Q), s.clearTimeoutFn = Q.clearTimeout.bind(Q));
|
|
253
249
|
}
|
|
250
|
+
const Zn = 1.33;
|
|
254
251
|
function er(s) {
|
|
252
|
+
return typeof s == "string" ? tr(s) : Math.ceil((s.byteLength || s.size) * Zn);
|
|
253
|
+
}
|
|
254
|
+
function tr(s) {
|
|
255
255
|
let e = 0, t = 0;
|
|
256
256
|
for (let i = 0, n = s.length; i < n; i++)
|
|
257
257
|
e = s.charCodeAt(i), e < 128 ? t += 1 : e < 2048 ? t += 2 : e < 55296 || e >= 57344 ? t += 3 : (i++, t += 4);
|
|
258
258
|
return t;
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function zi() {
|
|
261
261
|
return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
|
|
262
262
|
}
|
|
263
|
-
function
|
|
263
|
+
function sr(s) {
|
|
264
264
|
let e = "";
|
|
265
265
|
for (let t in s)
|
|
266
266
|
s.hasOwnProperty(t) && (e.length && (e += "&"), e += encodeURIComponent(t) + "=" + encodeURIComponent(s[t]));
|
|
267
267
|
return e;
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function ir(s) {
|
|
270
270
|
let e = {}, t = s.split("&");
|
|
271
271
|
for (let i = 0, n = t.length; i < n; i++) {
|
|
272
272
|
let r = t[i].split("=");
|
|
@@ -274,7 +274,7 @@ function sr(s) {
|
|
|
274
274
|
}
|
|
275
275
|
return e;
|
|
276
276
|
}
|
|
277
|
-
class
|
|
277
|
+
class nr extends Error {
|
|
278
278
|
constructor(e, t, i) {
|
|
279
279
|
super(e), this.description = t, this.context = i, this.type = "TransportError";
|
|
280
280
|
}
|
|
@@ -299,7 +299,7 @@ class Is extends C {
|
|
|
299
299
|
* @protected
|
|
300
300
|
*/
|
|
301
301
|
onError(e, t, i) {
|
|
302
|
-
return super.emitReserved("error", new
|
|
302
|
+
return super.emitReserved("error", new nr(e, t, i)), this;
|
|
303
303
|
}
|
|
304
304
|
/**
|
|
305
305
|
* Opens the transport.
|
|
@@ -373,11 +373,11 @@ class Is extends C {
|
|
|
373
373
|
return this.opts.port && (this.opts.secure && Number(this.opts.port) !== 443 || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
|
|
374
374
|
}
|
|
375
375
|
_query(e) {
|
|
376
|
-
const t =
|
|
376
|
+
const t = sr(e);
|
|
377
377
|
return t.length ? "?" + t : "";
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
|
-
class
|
|
380
|
+
class rr extends Is {
|
|
381
381
|
constructor() {
|
|
382
382
|
super(...arguments), this._polling = !1;
|
|
383
383
|
}
|
|
@@ -433,7 +433,7 @@ class nr extends Is {
|
|
|
433
433
|
return this.onClose({ description: "transport closed by the server" }), !1;
|
|
434
434
|
this.onPacket(i);
|
|
435
435
|
};
|
|
436
|
-
|
|
436
|
+
Kn(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
|
|
437
437
|
}
|
|
438
438
|
/**
|
|
439
439
|
* For polling, send a close packet.
|
|
@@ -453,7 +453,7 @@ class nr extends Is {
|
|
|
453
453
|
* @protected
|
|
454
454
|
*/
|
|
455
455
|
write(e) {
|
|
456
|
-
this.writable = !1,
|
|
456
|
+
this.writable = !1, zn(e, (t) => {
|
|
457
457
|
this.doWrite(t, () => {
|
|
458
458
|
this.writable = !0, this.emitReserved("drain");
|
|
459
459
|
});
|
|
@@ -466,18 +466,18 @@ class nr extends Is {
|
|
|
466
466
|
*/
|
|
467
467
|
uri() {
|
|
468
468
|
const e = this.opts.secure ? "https" : "http", t = this.query || {};
|
|
469
|
-
return this.opts.timestampRequests !== !1 && (t[this.opts.timestampParam] =
|
|
469
|
+
return this.opts.timestampRequests !== !1 && (t[this.opts.timestampParam] = zi()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t);
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
|
-
let
|
|
472
|
+
let Ki = !1;
|
|
473
473
|
try {
|
|
474
|
-
|
|
474
|
+
Ki = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
|
|
475
475
|
} catch {
|
|
476
476
|
}
|
|
477
|
-
const
|
|
478
|
-
function
|
|
477
|
+
const or = Ki;
|
|
478
|
+
function ar() {
|
|
479
479
|
}
|
|
480
|
-
class
|
|
480
|
+
class cr extends rr {
|
|
481
481
|
/**
|
|
482
482
|
* XHR Polling constructor.
|
|
483
483
|
*
|
|
@@ -536,7 +536,7 @@ let ye = class it extends C {
|
|
|
536
536
|
*/
|
|
537
537
|
_create() {
|
|
538
538
|
var e;
|
|
539
|
-
const t =
|
|
539
|
+
const t = Wi(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
|
|
540
540
|
t.xdomain = !!this._opts.xd;
|
|
541
541
|
const i = this._xhr = this.createRequest(t);
|
|
542
542
|
try {
|
|
@@ -590,7 +590,7 @@ let ye = class it extends C {
|
|
|
590
590
|
*/
|
|
591
591
|
_cleanup(e) {
|
|
592
592
|
if (!(typeof this._xhr > "u" || this._xhr === null)) {
|
|
593
|
-
if (this._xhr.onreadystatechange =
|
|
593
|
+
if (this._xhr.onreadystatechange = ar, e)
|
|
594
594
|
try {
|
|
595
595
|
this._xhr.abort();
|
|
596
596
|
} catch {
|
|
@@ -630,26 +630,26 @@ function xs() {
|
|
|
630
630
|
for (let s in ye.requests)
|
|
631
631
|
ye.requests.hasOwnProperty(s) && ye.requests[s].abort();
|
|
632
632
|
}
|
|
633
|
-
const
|
|
634
|
-
const s =
|
|
633
|
+
const lr = (function() {
|
|
634
|
+
const s = Vi({
|
|
635
635
|
xdomain: !1
|
|
636
636
|
});
|
|
637
637
|
return s && s.responseType !== null;
|
|
638
638
|
})();
|
|
639
|
-
class
|
|
639
|
+
class dr extends cr {
|
|
640
640
|
constructor(e) {
|
|
641
641
|
super(e);
|
|
642
642
|
const t = e && e.forceBase64;
|
|
643
|
-
this.supportsBinary =
|
|
643
|
+
this.supportsBinary = lr && !t;
|
|
644
644
|
}
|
|
645
645
|
request(e = {}) {
|
|
646
|
-
return Object.assign(e, { xd: this.xd }, this.opts), new ye(
|
|
646
|
+
return Object.assign(e, { xd: this.xd }, this.opts), new ye(Vi, this.uri(), e);
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
|
-
function
|
|
649
|
+
function Vi(s) {
|
|
650
650
|
const e = s.xdomain;
|
|
651
651
|
try {
|
|
652
|
-
if (typeof XMLHttpRequest < "u" && (!e ||
|
|
652
|
+
if (typeof XMLHttpRequest < "u" && (!e || or))
|
|
653
653
|
return new XMLHttpRequest();
|
|
654
654
|
} catch {
|
|
655
655
|
}
|
|
@@ -659,13 +659,13 @@ function Ki(s) {
|
|
|
659
659
|
} catch {
|
|
660
660
|
}
|
|
661
661
|
}
|
|
662
|
-
const
|
|
663
|
-
class
|
|
662
|
+
const Qi = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
|
|
663
|
+
class ur extends Is {
|
|
664
664
|
get name() {
|
|
665
665
|
return "websocket";
|
|
666
666
|
}
|
|
667
667
|
doOpen() {
|
|
668
|
-
const e = this.uri(), t = this.opts.protocols, i =
|
|
668
|
+
const e = this.uri(), t = this.opts.protocols, i = Qi ? {} : Wi(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
|
|
669
669
|
this.opts.extraHeaders && (i.headers = this.opts.extraHeaders);
|
|
670
670
|
try {
|
|
671
671
|
this.ws = this.createSocket(e, t, i);
|
|
@@ -713,19 +713,19 @@ class dr extends Is {
|
|
|
713
713
|
*/
|
|
714
714
|
uri() {
|
|
715
715
|
const e = this.opts.secure ? "wss" : "ws", t = this.query || {};
|
|
716
|
-
return this.opts.timestampRequests && (t[this.opts.timestampParam] =
|
|
716
|
+
return this.opts.timestampRequests && (t[this.opts.timestampParam] = zi()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
|
|
717
717
|
}
|
|
718
718
|
}
|
|
719
719
|
const Et = Q.WebSocket || Q.MozWebSocket;
|
|
720
|
-
class
|
|
720
|
+
class hr extends ur {
|
|
721
721
|
createSocket(e, t, i) {
|
|
722
|
-
return
|
|
722
|
+
return Qi ? new Et(e, t, i) : t ? new Et(e, t) : new Et(e);
|
|
723
723
|
}
|
|
724
724
|
doWrite(e, t) {
|
|
725
725
|
this.ws.send(t);
|
|
726
726
|
}
|
|
727
727
|
}
|
|
728
|
-
class
|
|
728
|
+
class pr extends Is {
|
|
729
729
|
get name() {
|
|
730
730
|
return "webtransport";
|
|
731
731
|
}
|
|
@@ -741,7 +741,7 @@ class hr extends Is {
|
|
|
741
741
|
this.onError("webtransport error", e);
|
|
742
742
|
}), this._transport.ready.then(() => {
|
|
743
743
|
this._transport.createBidirectionalStream().then((e) => {
|
|
744
|
-
const t =
|
|
744
|
+
const t = Qn(Number.MAX_SAFE_INTEGER, this.socket.binaryType), i = e.readable.pipeThrough(t).getReader(), n = Vn();
|
|
745
745
|
n.readable.pipeTo(e.writable), this._writer = n.writable.getWriter();
|
|
746
746
|
const r = () => {
|
|
747
747
|
i.read().then(({ done: a, value: c }) => {
|
|
@@ -771,11 +771,11 @@ class hr extends Is {
|
|
|
771
771
|
(e = this._transport) === null || e === void 0 || e.close();
|
|
772
772
|
}
|
|
773
773
|
}
|
|
774
|
-
const
|
|
775
|
-
websocket:
|
|
776
|
-
webtransport:
|
|
777
|
-
polling:
|
|
778
|
-
},
|
|
774
|
+
const fr = {
|
|
775
|
+
websocket: hr,
|
|
776
|
+
webtransport: pr,
|
|
777
|
+
polling: dr
|
|
778
|
+
}, gr = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, yr = [
|
|
779
779
|
"source",
|
|
780
780
|
"protocol",
|
|
781
781
|
"authority",
|
|
@@ -796,16 +796,16 @@ function Gt(s) {
|
|
|
796
796
|
throw "URI too long";
|
|
797
797
|
const e = s, t = s.indexOf("["), i = s.indexOf("]");
|
|
798
798
|
t != -1 && i != -1 && (s = s.substring(0, t) + s.substring(t, i).replace(/:/g, ";") + s.substring(i, s.length));
|
|
799
|
-
let n =
|
|
799
|
+
let n = gr.exec(s || ""), r = {}, o = 14;
|
|
800
800
|
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 =
|
|
801
|
+
r[yr[o]] = n[o] || "";
|
|
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 = mr(r, r.path), r.queryKey = Ir(r, r.query), r;
|
|
803
803
|
}
|
|
804
|
-
function
|
|
804
|
+
function mr(s, e) {
|
|
805
805
|
const t = /\/{2,9}/g, i = e.replace(t, "/").split("/");
|
|
806
806
|
return (e.slice(0, 1) == "/" || e.length === 0) && i.splice(0, 1), e.slice(-1) == "/" && i.splice(i.length - 1, 1), i;
|
|
807
807
|
}
|
|
808
|
-
function
|
|
808
|
+
function Ir(s, e) {
|
|
809
809
|
const t = {};
|
|
810
810
|
return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(i, n, r) {
|
|
811
811
|
n && (t[n] = r);
|
|
@@ -823,7 +823,7 @@ class re extends C {
|
|
|
823
823
|
* @param {Object} opts - options
|
|
824
824
|
*/
|
|
825
825
|
constructor(e, t) {
|
|
826
|
-
if (super(), this.binaryType =
|
|
826
|
+
if (super(), this.binaryType = Jn, 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) {
|
|
827
827
|
const i = Gt(e);
|
|
828
828
|
t.hostname = i.host, t.secure = i.protocol === "https" || i.protocol === "wss", t.port = i.port, i.query && (t.query = i.query);
|
|
829
829
|
} else t.host && (t.hostname = Gt(t.host).host);
|
|
@@ -844,7 +844,7 @@ class re extends C {
|
|
|
844
844
|
},
|
|
845
845
|
transportOptions: {},
|
|
846
846
|
closeOnBeforeunload: !1
|
|
847
|
-
}, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query =
|
|
847
|
+
}, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = ir(this.opts.query)), Jt && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
|
|
848
848
|
this.transport && (this.transport.removeAllListeners(), this.transport.close());
|
|
849
849
|
}, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
|
|
850
850
|
this._onClose("transport close", {
|
|
@@ -861,7 +861,7 @@ class re extends C {
|
|
|
861
861
|
*/
|
|
862
862
|
createTransport(e) {
|
|
863
863
|
const t = Object.assign({}, this.opts.query);
|
|
864
|
-
t.EIO =
|
|
864
|
+
t.EIO = $i, t.transport = e, this.id && (t.sid = this.id);
|
|
865
865
|
const i = Object.assign({}, this.opts, {
|
|
866
866
|
query: t,
|
|
867
867
|
socket: this,
|
|
@@ -979,7 +979,7 @@ class re extends C {
|
|
|
979
979
|
let t = 1;
|
|
980
980
|
for (let i = 0; i < this.writeBuffer.length; i++) {
|
|
981
981
|
const n = this.writeBuffer[i].data;
|
|
982
|
-
if (n && (t +=
|
|
982
|
+
if (n && (t += er(n)), i > 0 && t > this._maxPayload)
|
|
983
983
|
return this.writeBuffer.slice(0, i);
|
|
984
984
|
t += 2;
|
|
985
985
|
}
|
|
@@ -1085,8 +1085,8 @@ class re extends C {
|
|
|
1085
1085
|
}
|
|
1086
1086
|
}
|
|
1087
1087
|
}
|
|
1088
|
-
re.protocol =
|
|
1089
|
-
class
|
|
1088
|
+
re.protocol = $i;
|
|
1089
|
+
class Sr extends re {
|
|
1090
1090
|
constructor() {
|
|
1091
1091
|
super(...arguments), this._upgrades = [];
|
|
1092
1092
|
}
|
|
@@ -1158,21 +1158,21 @@ class Ir extends re {
|
|
|
1158
1158
|
return t;
|
|
1159
1159
|
}
|
|
1160
1160
|
}
|
|
1161
|
-
let
|
|
1161
|
+
let wr = class extends Sr {
|
|
1162
1162
|
constructor(e, t = {}) {
|
|
1163
1163
|
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) =>
|
|
1164
|
+
(!n.transports || n.transports && typeof n.transports[0] == "string") && (n.transports = (n.transports || ["polling", "websocket", "webtransport"]).map((r) => fr[r]).filter((r) => !!r)), super(i ? n : e, n);
|
|
1165
1165
|
}
|
|
1166
1166
|
};
|
|
1167
|
-
function
|
|
1167
|
+
function br(s, e = "", t) {
|
|
1168
1168
|
let i = s;
|
|
1169
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 = Gt(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
1170
|
const r = i.host.indexOf(":") !== -1 ? "[" + i.host + "]" : i.host;
|
|
1171
1171
|
return i.id = i.protocol + "://" + r + ":" + i.port + e, i.href = i.protocol + "://" + r + (t && t.port === i.port ? "" : ":" + i.port), i;
|
|
1172
1172
|
}
|
|
1173
|
-
const
|
|
1173
|
+
const vr = typeof ArrayBuffer == "function", Tr = (s) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(s) : s.buffer instanceof ArrayBuffer, Gi = Object.prototype.toString, _r = typeof Blob == "function" || typeof Blob < "u" && Gi.call(Blob) === "[object BlobConstructor]", Rr = typeof File == "function" || typeof File < "u" && Gi.call(File) === "[object FileConstructor]";
|
|
1174
1174
|
function Ss(s) {
|
|
1175
|
-
return
|
|
1175
|
+
return vr && (s instanceof ArrayBuffer || Tr(s)) || _r && s instanceof Blob || Rr && s instanceof File;
|
|
1176
1176
|
}
|
|
1177
1177
|
function rt(s, e) {
|
|
1178
1178
|
if (!s || typeof s != "object")
|
|
@@ -1192,7 +1192,7 @@ function rt(s, e) {
|
|
|
1192
1192
|
return !0;
|
|
1193
1193
|
return !1;
|
|
1194
1194
|
}
|
|
1195
|
-
function
|
|
1195
|
+
function Ar(s) {
|
|
1196
1196
|
const e = [], t = s.data, i = s;
|
|
1197
1197
|
return i.data = ot(t, e), i.attachments = e.length, { packet: i, buffers: e };
|
|
1198
1198
|
}
|
|
@@ -1217,7 +1217,7 @@ function ot(s, e, t) {
|
|
|
1217
1217
|
}
|
|
1218
1218
|
return s;
|
|
1219
1219
|
}
|
|
1220
|
-
function
|
|
1220
|
+
function kr(s, e) {
|
|
1221
1221
|
return s.data = Xt(s.data, e), delete s.attachments, s;
|
|
1222
1222
|
}
|
|
1223
1223
|
function Xt(s, e) {
|
|
@@ -1235,7 +1235,7 @@ function Xt(s, e) {
|
|
|
1235
1235
|
Object.prototype.hasOwnProperty.call(s, t) && (s[t] = Xt(s[t], e));
|
|
1236
1236
|
return s;
|
|
1237
1237
|
}
|
|
1238
|
-
const
|
|
1238
|
+
const Mr = [
|
|
1239
1239
|
"connect",
|
|
1240
1240
|
// used on the client side
|
|
1241
1241
|
"connect_error",
|
|
@@ -1253,7 +1253,7 @@ var T;
|
|
|
1253
1253
|
(function(s) {
|
|
1254
1254
|
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
1255
|
})(T || (T = {}));
|
|
1256
|
-
class
|
|
1256
|
+
class Er {
|
|
1257
1257
|
/**
|
|
1258
1258
|
* Encoder constructor
|
|
1259
1259
|
*
|
|
@@ -1289,7 +1289,7 @@ class Mr {
|
|
|
1289
1289
|
* a list of buffers.
|
|
1290
1290
|
*/
|
|
1291
1291
|
encodeAsBinary(e) {
|
|
1292
|
-
const t =
|
|
1292
|
+
const t = Ar(e), i = this.encodeAsString(t.packet), n = t.buffers;
|
|
1293
1293
|
return n.unshift(i), n;
|
|
1294
1294
|
}
|
|
1295
1295
|
}
|
|
@@ -1315,7 +1315,7 @@ class ws extends C {
|
|
|
1315
1315
|
throw new Error("got plaintext data when reconstructing a packet");
|
|
1316
1316
|
t = this.decodeString(e);
|
|
1317
1317
|
const i = t.type === T.BINARY_EVENT;
|
|
1318
|
-
i || t.type === T.BINARY_ACK ? (t.type = i ? T.EVENT : T.ACK, this.reconstructor = new
|
|
1318
|
+
i || t.type === T.BINARY_ACK ? (t.type = i ? T.EVENT : T.ACK, this.reconstructor = new Cr(t)) : super.emitReserved("decoded", t);
|
|
1319
1319
|
} else if (Ss(e) || e.base64)
|
|
1320
1320
|
if (this.reconstructor)
|
|
1321
1321
|
t = this.reconstructor.takeBinaryData(e), t && (this.reconstructor = null, super.emitReserved("decoded", t));
|
|
@@ -1345,7 +1345,7 @@ class ws extends C {
|
|
|
1345
1345
|
if (o != Number(o) || e.charAt(t) !== "-")
|
|
1346
1346
|
throw new Error("Illegal attachments");
|
|
1347
1347
|
const a = Number(o);
|
|
1348
|
-
if (!
|
|
1348
|
+
if (!Pr(a) || a < 1)
|
|
1349
1349
|
throw new Error("Illegal attachments");
|
|
1350
1350
|
if (a > this.opts.maxAttachments)
|
|
1351
1351
|
throw new Error("too many attachments");
|
|
@@ -1398,7 +1398,7 @@ class ws extends C {
|
|
|
1398
1398
|
return typeof t == "string" || Bs(t);
|
|
1399
1399
|
case T.EVENT:
|
|
1400
1400
|
case T.BINARY_EVENT:
|
|
1401
|
-
return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" &&
|
|
1401
|
+
return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && Mr.indexOf(t[0]) === -1);
|
|
1402
1402
|
case T.ACK:
|
|
1403
1403
|
case T.BINARY_ACK:
|
|
1404
1404
|
return Array.isArray(t);
|
|
@@ -1411,7 +1411,7 @@ class ws extends C {
|
|
|
1411
1411
|
this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
|
|
1412
1412
|
}
|
|
1413
1413
|
}
|
|
1414
|
-
class
|
|
1414
|
+
class Cr {
|
|
1415
1415
|
constructor(e) {
|
|
1416
1416
|
this.packet = e, this.buffers = [], this.reconPack = e;
|
|
1417
1417
|
}
|
|
@@ -1425,7 +1425,7 @@ class Er {
|
|
|
1425
1425
|
*/
|
|
1426
1426
|
takeBinaryData(e) {
|
|
1427
1427
|
if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
|
|
1428
|
-
const t =
|
|
1428
|
+
const t = kr(this.reconPack, this.buffers);
|
|
1429
1429
|
return this.finishedReconstruction(), t;
|
|
1430
1430
|
}
|
|
1431
1431
|
return null;
|
|
@@ -1437,16 +1437,16 @@ class Er {
|
|
|
1437
1437
|
this.reconPack = null, this.buffers = [];
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
|
-
const
|
|
1440
|
+
const Pr = Number.isInteger || function(s) {
|
|
1441
1441
|
return typeof s == "number" && isFinite(s) && Math.floor(s) === s;
|
|
1442
1442
|
};
|
|
1443
1443
|
function Bs(s) {
|
|
1444
1444
|
return Object.prototype.toString.call(s) === "[object Object]";
|
|
1445
1445
|
}
|
|
1446
|
-
const
|
|
1446
|
+
const Dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1447
1447
|
__proto__: null,
|
|
1448
1448
|
Decoder: ws,
|
|
1449
|
-
Encoder:
|
|
1449
|
+
Encoder: Er,
|
|
1450
1450
|
get PacketType() {
|
|
1451
1451
|
return T;
|
|
1452
1452
|
}
|
|
@@ -1456,7 +1456,7 @@ function G(s, e, t) {
|
|
|
1456
1456
|
s.off(e, t);
|
|
1457
1457
|
};
|
|
1458
1458
|
}
|
|
1459
|
-
const
|
|
1459
|
+
const Ur = Object.freeze({
|
|
1460
1460
|
connect: 1,
|
|
1461
1461
|
connect_error: 1,
|
|
1462
1462
|
disconnect: 1,
|
|
@@ -1465,7 +1465,7 @@ const Dr = Object.freeze({
|
|
|
1465
1465
|
newListener: 1,
|
|
1466
1466
|
removeListener: 1
|
|
1467
1467
|
});
|
|
1468
|
-
class
|
|
1468
|
+
class Ji extends C {
|
|
1469
1469
|
/**
|
|
1470
1470
|
* `Socket` constructor.
|
|
1471
1471
|
*/
|
|
@@ -1581,7 +1581,7 @@ class Gi extends C {
|
|
|
1581
1581
|
*/
|
|
1582
1582
|
emit(e, ...t) {
|
|
1583
1583
|
var i, n, r;
|
|
1584
|
-
if (
|
|
1584
|
+
if (Ur.hasOwnProperty(e))
|
|
1585
1585
|
throw new Error('"' + e.toString() + '" is a reserved event name');
|
|
1586
1586
|
if (t.unshift(e), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
|
|
1587
1587
|
return this._addToQueue(t), this;
|
|
@@ -2088,7 +2088,7 @@ class Yt extends C {
|
|
|
2088
2088
|
max: this.reconnectionDelayMax(),
|
|
2089
2089
|
jitter: this.randomizationFactor()
|
|
2090
2090
|
}), this.timeout(t.timeout == null ? 2e4 : t.timeout), this._readyState = "closed", this.uri = e;
|
|
2091
|
-
const n = t.parser ||
|
|
2091
|
+
const n = t.parser || Dr;
|
|
2092
2092
|
this.encoder = new n.Encoder(), this.decoder = new n.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
|
|
2093
2093
|
}
|
|
2094
2094
|
reconnection(e) {
|
|
@@ -2131,7 +2131,7 @@ class Yt extends C {
|
|
|
2131
2131
|
open(e) {
|
|
2132
2132
|
if (~this._readyState.indexOf("open"))
|
|
2133
2133
|
return this;
|
|
2134
|
-
this.engine = new
|
|
2134
|
+
this.engine = new wr(this.uri, this.opts);
|
|
2135
2135
|
const t = this.engine, i = this;
|
|
2136
2136
|
this._readyState = "opening", this.skipReconnect = !1;
|
|
2137
2137
|
const n = G(t, "open", function() {
|
|
@@ -2221,7 +2221,7 @@ class Yt extends C {
|
|
|
2221
2221
|
*/
|
|
2222
2222
|
socket(e, t) {
|
|
2223
2223
|
let i = this.nsps[e];
|
|
2224
|
-
return i ? this._autoConnect && !i.active && i.connect() : (i = new
|
|
2224
|
+
return i ? this._autoConnect && !i.active && i.connect() : (i = new Ji(this, e, t), this.nsps[e] = i), i;
|
|
2225
2225
|
}
|
|
2226
2226
|
/**
|
|
2227
2227
|
* Called upon a socket close.
|
|
@@ -2321,17 +2321,17 @@ class Yt extends C {
|
|
|
2321
2321
|
const ke = {};
|
|
2322
2322
|
function at(s, e) {
|
|
2323
2323
|
typeof s == "object" && (e = s, s = void 0), e = e || {};
|
|
2324
|
-
const t =
|
|
2324
|
+
const t = br(s, e.path || "/socket.io"), i = t.source, n = t.id, r = t.path, o = ke[n] && r in ke[n].nsps, a = e.forceNew || e["force new connection"] || e.multiplex === !1 || o;
|
|
2325
2325
|
let c;
|
|
2326
2326
|
return a ? c = new Yt(i, e) : (ke[n] || (ke[n] = new Yt(i, e)), c = ke[n]), t.query && !e.query && (e.query = t.queryKey), c.socket(t.path, e);
|
|
2327
2327
|
}
|
|
2328
2328
|
Object.assign(at, {
|
|
2329
2329
|
Manager: Yt,
|
|
2330
|
-
Socket:
|
|
2330
|
+
Socket: Ji,
|
|
2331
2331
|
io: at,
|
|
2332
2332
|
connect: at
|
|
2333
2333
|
});
|
|
2334
|
-
const
|
|
2334
|
+
const qr = 45e3, Or = /* @__PURE__ */ new Set([
|
|
2335
2335
|
"chat.user_message",
|
|
2336
2336
|
"chat.retry_last_user_message",
|
|
2337
2337
|
"run.stop",
|
|
@@ -2352,7 +2352,11 @@ class v extends Error {
|
|
|
2352
2352
|
detail;
|
|
2353
2353
|
backendRefusal;
|
|
2354
2354
|
}
|
|
2355
|
-
|
|
2355
|
+
function Ns(s, e) {
|
|
2356
|
+
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
|
+
return new v(i, s.code ?? "request_rejected", !1, s.result, !0);
|
|
2358
|
+
}
|
|
2359
|
+
class xr {
|
|
2356
2360
|
constructor(e) {
|
|
2357
2361
|
this.options = e, this.socket = at(`${e.backendUrl.replace(/\/$/, "")}/product-agent`, {
|
|
2358
2362
|
path: "/api/product-agent/socket.io",
|
|
@@ -2469,7 +2473,7 @@ class Or {
|
|
|
2469
2473
|
readinessPhase: this.ready ? "bootstrap" : this.admitted ? "activation" : "namespace_ready"
|
|
2470
2474
|
})), e === this.generation && this.recover());
|
|
2471
2475
|
};
|
|
2472
|
-
this.admissionTimer = setTimeout(() => t("connect_timeout"), 15e3), this.readinessTimer = setTimeout(() => t("auth_timeout"),
|
|
2476
|
+
this.admissionTimer = setTimeout(() => t("connect_timeout"), 15e3), this.readinessTimer = setTimeout(() => t("auth_timeout"), qr);
|
|
2473
2477
|
}
|
|
2474
2478
|
clearReadinessTimers() {
|
|
2475
2479
|
this.admissionTimer !== null && clearTimeout(this.admissionTimer), this.readinessTimer !== null && clearTimeout(this.readinessTimer), this.admissionTimer = null, this.readinessTimer = null;
|
|
@@ -2490,7 +2494,7 @@ class Or {
|
|
|
2490
2494
|
this.bindings.get(e)?.owners.delete(t), this.ready && await this.synchronize();
|
|
2491
2495
|
}
|
|
2492
2496
|
async rpc(e, t) {
|
|
2493
|
-
if (!
|
|
2497
|
+
if (!Or.has(e)) throw new v("Operation requires its HTTP adapter", "unsupported_rpc");
|
|
2494
2498
|
const i = this.generation, n = JSON.stringify(t);
|
|
2495
2499
|
return e === "run.stop" && this.uploadingResult ? (this.assertReady(i), this.request("runtime.rpc", { type: e, payload: JSON.parse(n) }, i)) : this.enqueue(async () => {
|
|
2496
2500
|
if (this.assertReady(i), e === "tool.result") {
|
|
@@ -2579,7 +2583,7 @@ class Or {
|
|
|
2579
2583
|
throw new v("Result upload outcome is unknown", "delivery_unknown", !0);
|
|
2580
2584
|
if (h?.request_id !== n || typeof h.ok != "boolean")
|
|
2581
2585
|
throw new v("Invalid result acknowledgement identity", "invalid_ack", !0);
|
|
2582
|
-
if (!h.ok) throw
|
|
2586
|
+
if (!h.ok) throw Ns(h, "Product Agent result rejected");
|
|
2583
2587
|
return h.result;
|
|
2584
2588
|
} catch (l) {
|
|
2585
2589
|
const d = l instanceof v ? l : new v("Result upload outcome is unknown", "delivery_unknown", !0);
|
|
@@ -2596,7 +2600,7 @@ class Or {
|
|
|
2596
2600
|
this.pending.delete(a), o(c);
|
|
2597
2601
|
};
|
|
2598
2602
|
this.pending.add(a), this.socket.timeout(this.options.requestTimeoutMs ?? 15e3).emit(e, { ...t, request_id: n }, (c, l) => {
|
|
2599
|
-
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(
|
|
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(Ns(l, "Product Agent request rejected")));
|
|
2600
2604
|
});
|
|
2601
2605
|
}).catch((r) => {
|
|
2602
2606
|
throw this.recoverUncertainDelivery(r, i), r;
|
|
@@ -2613,7 +2617,7 @@ class Or {
|
|
|
2613
2617
|
}
|
|
2614
2618
|
}
|
|
2615
2619
|
}
|
|
2616
|
-
class
|
|
2620
|
+
class Xi {
|
|
2617
2621
|
constructor(e) {
|
|
2618
2622
|
this.options = e, this.auth = e.auth;
|
|
2619
2623
|
}
|
|
@@ -2662,7 +2666,7 @@ function Le(s) {
|
|
|
2662
2666
|
}
|
|
2663
2667
|
return s;
|
|
2664
2668
|
}
|
|
2665
|
-
function
|
|
2669
|
+
function Yi() {
|
|
2666
2670
|
return Le({
|
|
2667
2671
|
authorityId: null,
|
|
2668
2672
|
generation: 0,
|
|
@@ -2687,7 +2691,7 @@ function Xi() {
|
|
|
2687
2691
|
function O(s) {
|
|
2688
2692
|
return JSON.stringify([s.kind, s.origin, s.limit]);
|
|
2689
2693
|
}
|
|
2690
|
-
function
|
|
2694
|
+
function Br(s) {
|
|
2691
2695
|
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];
|
|
2692
2696
|
}
|
|
2693
2697
|
class Zt {
|
|
@@ -2750,7 +2754,7 @@ class Zt {
|
|
|
2750
2754
|
this.schedule(r, e);
|
|
2751
2755
|
}
|
|
2752
2756
|
}
|
|
2753
|
-
const
|
|
2757
|
+
const Nr = { activeIntervalMs: 3e3, idleIntervalMs: 15e3, maxFailureIntervalMs: 3e4 };
|
|
2754
2758
|
function z(s) {
|
|
2755
2759
|
const e = s.currentAuthority();
|
|
2756
2760
|
return e.authorityId === s.authority.authorityId && e.generation === s.authority.generation;
|
|
@@ -2764,10 +2768,10 @@ function Ue(s) {
|
|
|
2764
2768
|
const e = s.origin.trim();
|
|
2765
2769
|
return { ...s, origin: e.includes("://") ? new URL(e).origin : e.toLowerCase() };
|
|
2766
2770
|
}
|
|
2767
|
-
function
|
|
2771
|
+
function Zi(s, e) {
|
|
2768
2772
|
return s.request(`/conversations/${encodeURIComponent(e)}`, {}, void 0, "GET", s.auth.client_kind === "extension" ? "extension" : void 0);
|
|
2769
2773
|
}
|
|
2770
|
-
function
|
|
2774
|
+
function Ls(s) {
|
|
2771
2775
|
return new Promise((e, t) => {
|
|
2772
2776
|
let i = null, n = null, r = !1;
|
|
2773
2777
|
const o = () => {
|
|
@@ -2785,7 +2789,7 @@ function Ns(s) {
|
|
|
2785
2789
|
c() || (i = s.runtime.engine.subscribe(c), n = s.runtime.onDispose(a));
|
|
2786
2790
|
});
|
|
2787
2791
|
}
|
|
2788
|
-
function
|
|
2792
|
+
function Lr(s) {
|
|
2789
2793
|
const e = s.http.auth.client_kind === "extension" ? "extension" : void 0, t = /* @__PURE__ */ new Map();
|
|
2790
2794
|
return {
|
|
2791
2795
|
"directory.query": async (i) => {
|
|
@@ -2796,7 +2800,7 @@ function Nr(s) {
|
|
|
2796
2800
|
if (s.http.auth.client_kind === "embed") {
|
|
2797
2801
|
const a = await s.http.request("/conversations", { ...r, page_url: n.origin ?? s.pageUrl() });
|
|
2798
2802
|
Me(s, i), o = { entries: await Promise.all(a.sessions.map(async (l) => ({
|
|
2799
|
-
...await
|
|
2803
|
+
...await Zi(s.http, l.id),
|
|
2800
2804
|
...typeof l.isActive == "boolean" ? { is_active: l.isActive } : {}
|
|
2801
2805
|
}))), next_cursor: a.nextCursor };
|
|
2802
2806
|
} else
|
|
@@ -2825,7 +2829,7 @@ function Nr(s) {
|
|
|
2825
2829
|
}
|
|
2826
2830
|
};
|
|
2827
2831
|
}
|
|
2828
|
-
class
|
|
2832
|
+
class Fr {
|
|
2829
2833
|
constructor(e) {
|
|
2830
2834
|
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());
|
|
2831
2835
|
}
|
|
@@ -2845,11 +2849,11 @@ class Lr {
|
|
|
2845
2849
|
if (t) for (const [i, n] of Object.entries(e)) {
|
|
2846
2850
|
if (!n.observe || this.observations.has(i)) continue;
|
|
2847
2851
|
const r = this.options.recovery(i), o = new Zt({
|
|
2848
|
-
...
|
|
2852
|
+
...Nr,
|
|
2849
2853
|
isActiveTurn: () => this.options.isActiveTurn(i),
|
|
2850
2854
|
poll: async () => {
|
|
2851
2855
|
try {
|
|
2852
|
-
return await
|
|
2856
|
+
return await Zi(this.options.http, i);
|
|
2853
2857
|
} catch (a) {
|
|
2854
2858
|
throw this.options.onError(a), a;
|
|
2855
2859
|
}
|
|
@@ -2967,7 +2971,7 @@ class Lr {
|
|
|
2967
2971
|
this.unsubscribe(), this.reconcile();
|
|
2968
2972
|
}
|
|
2969
2973
|
}
|
|
2970
|
-
function
|
|
2974
|
+
function jr(s) {
|
|
2971
2975
|
if (!s || typeof s != "object") return !1;
|
|
2972
2976
|
const e = s;
|
|
2973
2977
|
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;
|
|
@@ -2983,7 +2987,7 @@ function Fr(s) {
|
|
|
2983
2987
|
if (!e.bindings.some((o) => o.sessionId === n && o.clientScopeId === r)) return !1;
|
|
2984
2988
|
return !0;
|
|
2985
2989
|
}
|
|
2986
|
-
const
|
|
2990
|
+
const Fs = /* @__PURE__ */ new WeakMap();
|
|
2987
2991
|
class Hr {
|
|
2988
2992
|
constructor(e) {
|
|
2989
2993
|
this.options = e;
|
|
@@ -3044,17 +3048,17 @@ class Hr {
|
|
|
3044
3048
|
browserSessionId: this.options.persistence.sessionId(),
|
|
3045
3049
|
bindings: Object.entries(e.clients).map(([n, r]) => ({ clientScopeId: n, conversationScopeId: r, ...e.selections[r] })),
|
|
3046
3050
|
mains: Object.fromEntries(Object.entries(e.memberships).flatMap(([n, r]) => r.mainClientScopeId ? [[n, r.mainClientScopeId]] : []))
|
|
3047
|
-
}, i = (
|
|
3051
|
+
}, i = (Fs.get(this.options.runtime) ?? Promise.resolve()).then(async () => {
|
|
3048
3052
|
this.current() && await this.options.persistence.write(t);
|
|
3049
3053
|
});
|
|
3050
|
-
return
|
|
3054
|
+
return Fs.set(this.options.runtime, i.catch(() => {
|
|
3051
3055
|
})), i;
|
|
3052
3056
|
}
|
|
3053
3057
|
async restore(e) {
|
|
3054
3058
|
const t = this.state();
|
|
3055
3059
|
if (!this.current() || Object.keys(t.clients).length || Object.keys(t.selections).length) return !1;
|
|
3056
3060
|
const i = await this.options.persistence.read();
|
|
3057
|
-
if (!
|
|
3061
|
+
if (!jr(i) || i.authorityId !== this.options.authority.authorityId || i.browserSessionId !== this.options.persistence.sessionId()) return !1;
|
|
3058
3062
|
const n = new Set(await this.options.persistence.liveClients());
|
|
3059
3063
|
if (!this.current() || this.state().clients !== t.clients) return !1;
|
|
3060
3064
|
const r = i.bindings.filter((c) => n.has(c.clientScopeId));
|
|
@@ -3076,7 +3080,7 @@ class Hr {
|
|
|
3076
3080
|
return await Promise.all(o.map((c) => this.options.runtime.engine.dispatch(c))), !0;
|
|
3077
3081
|
}
|
|
3078
3082
|
}
|
|
3079
|
-
function
|
|
3083
|
+
function $r(s, e, t, i = () => crypto.randomUUID()) {
|
|
3080
3084
|
const n = `pluno.productAgent.directory:${encodeURIComponent(t)}:${encodeURIComponent(e)}`, r = `${n}:tabSession`, o = s.getItem(r) ?? i();
|
|
3081
3085
|
return s.setItem(r, o), {
|
|
3082
3086
|
sessionId: () => o,
|
|
@@ -3087,18 +3091,18 @@ function jr(s, e, t, i = () => crypto.randomUUID()) {
|
|
|
3087
3091
|
liveClients: async () => [e]
|
|
3088
3092
|
};
|
|
3089
3093
|
}
|
|
3090
|
-
const
|
|
3091
|
-
function
|
|
3094
|
+
const js = /* @__PURE__ */ new Map(), Hs = /* @__PURE__ */ new Map();
|
|
3095
|
+
function Wr(s, e, t = () => crypto.randomUUID()) {
|
|
3092
3096
|
try {
|
|
3093
|
-
return
|
|
3097
|
+
return $r(window.sessionStorage, s, e, t);
|
|
3094
3098
|
} catch (i) {
|
|
3095
3099
|
if (!(i instanceof DOMException) || i.name !== "SecurityError" && i.name !== "QuotaExceededError") throw i;
|
|
3096
3100
|
const n = `${e}:${s}`, r = Hs.get(n) ?? t();
|
|
3097
3101
|
return Hs.set(n, r), {
|
|
3098
3102
|
sessionId: () => r,
|
|
3099
|
-
read: async () =>
|
|
3103
|
+
read: async () => js.get(n),
|
|
3100
3104
|
write: async (o) => {
|
|
3101
|
-
|
|
3105
|
+
js.set(n, o);
|
|
3102
3106
|
},
|
|
3103
3107
|
liveClients: async () => [s]
|
|
3104
3108
|
};
|
|
@@ -3106,7 +3110,7 @@ function $r(s, e, t = () => crypto.randomUUID()) {
|
|
|
3106
3110
|
}
|
|
3107
3111
|
class N extends EventTarget {
|
|
3108
3112
|
constructor(e) {
|
|
3109
|
-
super(), this.options = e, this.httpTransport = new
|
|
3113
|
+
super(), this.options = e, this.httpTransport = new Xi(e), this.transport = new xr({
|
|
3110
3114
|
backendUrl: e.backendUrl,
|
|
3111
3115
|
auth: e.auth,
|
|
3112
3116
|
bootstrapRequired: !0,
|
|
@@ -3437,13 +3441,13 @@ class N extends EventTarget {
|
|
|
3437
3441
|
}
|
|
3438
3442
|
}
|
|
3439
3443
|
const es = /* @__PURE__ */ new WeakMap(), le = (s) => s === null || typeof s == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(s);
|
|
3440
|
-
function
|
|
3444
|
+
function en(s) {
|
|
3441
3445
|
if (!s || typeof s != "object") return !1;
|
|
3442
3446
|
const e = s;
|
|
3443
3447
|
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";
|
|
3444
3448
|
}
|
|
3445
|
-
function
|
|
3446
|
-
if (!
|
|
3449
|
+
function zr(s, e, t) {
|
|
3450
|
+
if (!en(t)) return;
|
|
3447
3451
|
const i = es.get(s) ?? /* @__PURE__ */ new Map();
|
|
3448
3452
|
i.set(e, {
|
|
3449
3453
|
observedAt: t.observedAt,
|
|
@@ -3455,11 +3459,11 @@ function Wr(s, e, t) {
|
|
|
3455
3459
|
loading: t.loading
|
|
3456
3460
|
}), i.size > 2 && i.delete(i.keys().next().value), es.set(s, i);
|
|
3457
3461
|
}
|
|
3458
|
-
function
|
|
3462
|
+
function Kr(s, e, t) {
|
|
3459
3463
|
const i = es.get(s)?.get(e);
|
|
3460
3464
|
return i?.sessionId === t ? i : null;
|
|
3461
3465
|
}
|
|
3462
|
-
function
|
|
3466
|
+
function Vr(s, e, t, i, n, r, o, a, c = null, l = !1) {
|
|
3463
3467
|
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;
|
|
3464
3468
|
return {
|
|
3465
3469
|
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -3469,10 +3473,10 @@ function Kr(s, e, t, i, n, r, o, a, c = null, l = !1) {
|
|
|
3469
3473
|
clientUserMessageItemId: d && le(d.id) ? d.id : null,
|
|
3470
3474
|
clientResponseItemId: u && le(u.id) ? u.id : null,
|
|
3471
3475
|
clientDraftObserved: !!(d && l && c === d.id),
|
|
3472
|
-
renderer:
|
|
3476
|
+
renderer: Kr(s, e, t)
|
|
3473
3477
|
};
|
|
3474
3478
|
}
|
|
3475
|
-
function
|
|
3479
|
+
function tn(s) {
|
|
3476
3480
|
return {
|
|
3477
3481
|
key: s,
|
|
3478
3482
|
status: "not_requested",
|
|
@@ -3483,7 +3487,7 @@ function en(s) {
|
|
|
3483
3487
|
updatedAt: null
|
|
3484
3488
|
};
|
|
3485
3489
|
}
|
|
3486
|
-
function
|
|
3490
|
+
function Qr(s, e) {
|
|
3487
3491
|
const t = s.key === e.key, i = t ? s.data : null;
|
|
3488
3492
|
return {
|
|
3489
3493
|
...s,
|
|
@@ -3496,20 +3500,20 @@ function Vr(s, e) {
|
|
|
3496
3500
|
updatedAt: t ? s.updatedAt : null
|
|
3497
3501
|
};
|
|
3498
3502
|
}
|
|
3499
|
-
const
|
|
3500
|
-
function
|
|
3501
|
-
return { authenticated: !1, generation: 0, sequence: 0, displaySequence: 0, backendCount: null, query:
|
|
3503
|
+
const Gr = 1e4, Jr = 3e3;
|
|
3504
|
+
function sn() {
|
|
3505
|
+
return { authenticated: !1, generation: 0, sequence: 0, displaySequence: 0, backendCount: null, query: tn("activeUsers") };
|
|
3502
3506
|
}
|
|
3503
|
-
function
|
|
3507
|
+
function Xr(s, e) {
|
|
3504
3508
|
if (e.type === "activeUsers.authenticate") {
|
|
3505
3509
|
if (s.authenticated === e.authenticated) return { state: s, effects: [] };
|
|
3506
|
-
const i = { ...
|
|
3507
|
-
return e.authenticated ?
|
|
3510
|
+
const i = { ...sn(), authenticated: e.authenticated, generation: s.generation + 1 };
|
|
3511
|
+
return e.authenticated ? $s(i) : { state: i, effects: [] };
|
|
3508
3512
|
}
|
|
3509
3513
|
if (!s.authenticated || !e.effectId.startsWith(`activeUsers:${s.generation}:`)) return { state: s, effects: [] };
|
|
3510
|
-
if (e.effectKind === "activeUsers.wait") return e.type === "effect.completed" ?
|
|
3514
|
+
if (e.effectKind === "activeUsers.wait") return e.type === "effect.completed" ? $s(s) : { state: s, effects: [] };
|
|
3511
3515
|
if (e.effectKind === "activeUsers.displayWait")
|
|
3512
|
-
return e.type !== "effect.completed" || s.backendCount === null || String(e.effectId) !== `activeUsers:${s.generation}:display:${s.displaySequence}` ? { state: s, effects: [] } :
|
|
3516
|
+
return e.type !== "effect.completed" || s.backendCount === null || String(e.effectId) !== `activeUsers:${s.generation}:display:${s.displaySequence}` ? { state: s, effects: [] } : Ws({ ...s, query: { ...s.query, data: Math.max(0, s.backendCount + e.output.offset) } });
|
|
3513
3517
|
if (String(e.effectId) !== s.query.requestId) return { state: s, effects: [] };
|
|
3514
3518
|
if (e.type === "effect.failed") return { state: { ...s, query: { ...s.query, status: "error", error: e.error } }, effects: [] };
|
|
3515
3519
|
const t = { ...s, backendCount: e.output.count, query: {
|
|
@@ -3519,22 +3523,22 @@ function Jr(s, e) {
|
|
|
3519
3523
|
updatedAt: e.output.updatedAt,
|
|
3520
3524
|
error: null
|
|
3521
3525
|
} };
|
|
3522
|
-
return s.backendCount === null ?
|
|
3526
|
+
return s.backendCount === null ? Ws(t) : { state: t, effects: [] };
|
|
3523
3527
|
}
|
|
3524
|
-
function
|
|
3525
|
-
const e = s.sequence + 1, t = `activeUsers:${s.generation}:${e}`, i = [{ id: `${t}:wait`, kind: "activeUsers.wait", input: { milliseconds:
|
|
3528
|
+
function $s(s) {
|
|
3529
|
+
const e = s.sequence + 1, t = `activeUsers:${s.generation}:${e}`, i = [{ id: `${t}:wait`, kind: "activeUsers.wait", input: { milliseconds: Gr } }];
|
|
3526
3530
|
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 });
|
|
3527
3531
|
}
|
|
3528
|
-
function
|
|
3532
|
+
function Ws(s) {
|
|
3529
3533
|
const e = s.displaySequence + 1;
|
|
3530
3534
|
return { state: { ...s, displaySequence: e }, effects: [{
|
|
3531
3535
|
id: `activeUsers:${s.generation}:display:${e}`,
|
|
3532
3536
|
kind: "activeUsers.displayWait",
|
|
3533
|
-
input: { milliseconds:
|
|
3537
|
+
input: { milliseconds: Jr }
|
|
3534
3538
|
}] };
|
|
3535
3539
|
}
|
|
3536
|
-
const
|
|
3537
|
-
function
|
|
3540
|
+
const Yr = () => Object.freeze({ scopes: Object.freeze({}) }), nn = (s) => s.selectedModel ?? s.historyModel ?? s.defaultModel, Zr = (s, e) => s.scopes[e];
|
|
3541
|
+
function eo(s, e) {
|
|
3538
3542
|
const t = s.scopes[e.clientScopeId];
|
|
3539
3543
|
let i;
|
|
3540
3544
|
if (e.type === "model.scope_close") {
|
|
@@ -3578,7 +3582,7 @@ function Zr(s, e) {
|
|
|
3578
3582
|
submissions: Object.freeze({
|
|
3579
3583
|
...t.submissions,
|
|
3580
3584
|
[e.clientMessageId]: Object.freeze({
|
|
3581
|
-
requestedModel: e.requestedModel ??
|
|
3585
|
+
requestedModel: e.requestedModel ?? nn(t)
|
|
3582
3586
|
})
|
|
3583
3587
|
})
|
|
3584
3588
|
};
|
|
@@ -3612,7 +3616,7 @@ function Zr(s, e) {
|
|
|
3612
3616
|
})
|
|
3613
3617
|
});
|
|
3614
3618
|
}
|
|
3615
|
-
function
|
|
3619
|
+
function zs(s, e, t) {
|
|
3616
3620
|
const i = s.clients[e];
|
|
3617
3621
|
if (!i) return s;
|
|
3618
3622
|
const n = s.selections[i].sessionId, r = { ...s.clients };
|
|
@@ -3630,7 +3634,7 @@ function Ws(s, e, t) {
|
|
|
3630
3634
|
}
|
|
3631
3635
|
return { ...s, clients: r, memberships: o, membershipRevision: s.membershipRevision + 1 };
|
|
3632
3636
|
}
|
|
3633
|
-
function
|
|
3637
|
+
function Ks(s, e, t, i) {
|
|
3634
3638
|
let n = s.memberships;
|
|
3635
3639
|
if (i.sessionId !== null) {
|
|
3636
3640
|
const r = n[i.sessionId], o = r?.members ?? [];
|
|
@@ -3647,7 +3651,7 @@ function zs(s, e, t, i) {
|
|
|
3647
3651
|
membershipRevision: s.membershipRevision + 1
|
|
3648
3652
|
};
|
|
3649
3653
|
}
|
|
3650
|
-
function
|
|
3654
|
+
function to(s, e) {
|
|
3651
3655
|
switch (e.type) {
|
|
3652
3656
|
case "directory.bind":
|
|
3653
3657
|
case "directory.provisional": {
|
|
@@ -3659,16 +3663,16 @@ function eo(s, e) {
|
|
|
3659
3663
|
const n = s.clients[e.clientScopeId];
|
|
3660
3664
|
if (n === e.conversationScopeId) return s;
|
|
3661
3665
|
const r = s.selections[n];
|
|
3662
|
-
if (e.type === "directory.bind" && e.reason === "tool" && !
|
|
3666
|
+
if (e.type === "directory.bind" && e.reason === "tool" && !so(s, e.clientScopeId, e.sessionId))
|
|
3663
3667
|
throw new Error("Tool target is already bound to another conversation.");
|
|
3664
3668
|
return r && r.sessionId !== null && r.sessionId === t.sessionId ? {
|
|
3665
3669
|
...s,
|
|
3666
3670
|
clients: { ...s.clients, [e.clientScopeId]: e.conversationScopeId },
|
|
3667
3671
|
selections: { ...s.selections, [e.conversationScopeId]: t }
|
|
3668
|
-
} : zs(
|
|
3672
|
+
} : Ks(zs(s, e.clientScopeId, e.replacement), e.clientScopeId, e.conversationScopeId, t);
|
|
3669
3673
|
}
|
|
3670
3674
|
case "directory.detach":
|
|
3671
|
-
return
|
|
3675
|
+
return zs(s, e.clientScopeId, e.replacement);
|
|
3672
3676
|
case "directory.accepted": {
|
|
3673
3677
|
const t = s.selections[e.conversationScopeId];
|
|
3674
3678
|
if (!t || t.provisionalId !== e.provisionalId) return s;
|
|
@@ -3680,7 +3684,7 @@ function eo(s, e) {
|
|
|
3680
3684
|
if (i.length === 0) return s;
|
|
3681
3685
|
let n = s;
|
|
3682
3686
|
for (const [r] of i)
|
|
3683
|
-
n =
|
|
3687
|
+
n = Ks(n, r, e.conversationScopeId, { ...t, sessionId: e.sessionId });
|
|
3684
3688
|
return n;
|
|
3685
3689
|
}
|
|
3686
3690
|
case "directory.view_attach":
|
|
@@ -3694,7 +3698,7 @@ function eo(s, e) {
|
|
|
3694
3698
|
return s;
|
|
3695
3699
|
}
|
|
3696
3700
|
}
|
|
3697
|
-
function
|
|
3701
|
+
function so(s, e, t) {
|
|
3698
3702
|
const i = s.clients[e];
|
|
3699
3703
|
return i === void 0 || s.selections[i].sessionId === t;
|
|
3700
3704
|
}
|
|
@@ -3713,12 +3717,12 @@ function Ct(s, e, t) {
|
|
|
3713
3717
|
const n = { ...e, conversation: { ...e.conversation } }, r = { ...s, entities: { ...s.entities, [e.conversation_id]: n } };
|
|
3714
3718
|
return t ? ts(r) : r;
|
|
3715
3719
|
}
|
|
3716
|
-
function
|
|
3720
|
+
function io(s, e) {
|
|
3717
3721
|
let t = s;
|
|
3718
3722
|
const i = [];
|
|
3719
3723
|
if (e.type === "directory.authority_replace") {
|
|
3720
3724
|
if (e.expectedGeneration !== s.generation || e.generation <= s.generation) return { state: s, effects: i };
|
|
3721
|
-
t = { ...
|
|
3725
|
+
t = { ...Yi(), authorityId: e.authorityId, generation: e.generation };
|
|
3722
3726
|
} else if (e.type === "effect.completed" || e.type === "effect.failed") {
|
|
3723
3727
|
const n = s.requests[e.effectId];
|
|
3724
3728
|
if (!n || n.kind !== e.effectKind) return { state: s, effects: i };
|
|
@@ -3818,7 +3822,7 @@ function so(s, e) {
|
|
|
3818
3822
|
query: l,
|
|
3819
3823
|
cursor: e.cursor !== void 0 ? e.cursor : e.mode === "append" ? c?.cursor ?? null : null
|
|
3820
3824
|
} }, t = { ...s, queries: { ...s.queries, [a]: {
|
|
3821
|
-
...
|
|
3825
|
+
...Qr(c ?? tn(a), { key: a, requestId: e.requestId, mode: e.mode }),
|
|
3822
3826
|
query: l,
|
|
3823
3827
|
requestSequence: s.requestSequence + 1,
|
|
3824
3828
|
mode: e.mode,
|
|
@@ -3840,11 +3844,11 @@ function so(s, e) {
|
|
|
3840
3844
|
}
|
|
3841
3845
|
t = { ...t, requestSequence: s.requestSequence + 1, requests: { ...t.requests, [n]: o } }, i.push({ id: n, ...o });
|
|
3842
3846
|
} else
|
|
3843
|
-
t =
|
|
3847
|
+
t = to(s, e);
|
|
3844
3848
|
}
|
|
3845
3849
|
return { state: Le(t), effects: i };
|
|
3846
3850
|
}
|
|
3847
|
-
function
|
|
3851
|
+
function no(s) {
|
|
3848
3852
|
const e = { ...s.entities };
|
|
3849
3853
|
for (const [o, a] of Object.entries(s.mutations)) {
|
|
3850
3854
|
if (!e[o]) continue;
|
|
@@ -3873,7 +3877,7 @@ function io(s) {
|
|
|
3873
3877
|
]))
|
|
3874
3878
|
});
|
|
3875
3879
|
}
|
|
3876
|
-
class
|
|
3880
|
+
class ro {
|
|
3877
3881
|
constructor(e, t, i) {
|
|
3878
3882
|
this.handlers = e, this.accept = t, this.errorAdapter = i;
|
|
3879
3883
|
}
|
|
@@ -3912,7 +3916,7 @@ class no {
|
|
|
3912
3916
|
);
|
|
3913
3917
|
}
|
|
3914
3918
|
}
|
|
3915
|
-
class
|
|
3919
|
+
class oo {
|
|
3916
3920
|
state;
|
|
3917
3921
|
reducer;
|
|
3918
3922
|
selector;
|
|
@@ -3922,7 +3926,7 @@ class ro {
|
|
|
3922
3926
|
draining = !1;
|
|
3923
3927
|
disposed = !1;
|
|
3924
3928
|
constructor(e) {
|
|
3925
|
-
this.state = e.initialState, this.reducer = e.reducer, this.selector = e.selector, this.effectRunner = new
|
|
3929
|
+
this.state = e.initialState, this.reducer = e.reducer, this.selector = e.selector, this.effectRunner = new ro(
|
|
3926
3930
|
e.effectHandlers,
|
|
3927
3931
|
(t) => this.acceptEffectResult(t),
|
|
3928
3932
|
e.errorAdapter
|
|
@@ -3992,7 +3996,7 @@ function ss(s) {
|
|
|
3992
3996
|
const e = Object.getPrototypeOf(s);
|
|
3993
3997
|
return e !== Object.prototype && e !== null ? !1 : Object.values(s).every(ss);
|
|
3994
3998
|
}
|
|
3995
|
-
function
|
|
3999
|
+
function ao(s) {
|
|
3996
4000
|
if (s.details !== void 0 && !ss(s.details))
|
|
3997
4001
|
throw new TypeError("Product Agent transported error details must be JSON-safe.");
|
|
3998
4002
|
return {
|
|
@@ -4002,7 +4006,7 @@ function oo(s) {
|
|
|
4002
4006
|
...s.details === void 0 ? {} : { details: s.details }
|
|
4003
4007
|
};
|
|
4004
4008
|
}
|
|
4005
|
-
const
|
|
4009
|
+
const co = Object.freeze({
|
|
4006
4010
|
modelSelection: "core",
|
|
4007
4011
|
directory: "core",
|
|
4008
4012
|
activeUsers: "core",
|
|
@@ -4011,12 +4015,12 @@ const ao = Object.freeze({
|
|
|
4011
4015
|
interactions: "legacy",
|
|
4012
4016
|
browserExecution: "legacy"
|
|
4013
4017
|
});
|
|
4014
|
-
function
|
|
4015
|
-
const t =
|
|
4018
|
+
function Vs(s, e) {
|
|
4019
|
+
const t = co[s], i = e[t];
|
|
4016
4020
|
if (!i) throw new Error(`No ${t} implementation for ${s}.`);
|
|
4017
4021
|
return i();
|
|
4018
4022
|
}
|
|
4019
|
-
const
|
|
4023
|
+
const lo = {
|
|
4020
4024
|
"directory.query": async () => {
|
|
4021
4025
|
throw new Error("Directory ports are not installed before S5-C.");
|
|
4022
4026
|
},
|
|
@@ -4024,36 +4028,36 @@ const co = {
|
|
|
4024
4028
|
throw new Error("Directory ports are not installed before S5-C.");
|
|
4025
4029
|
}
|
|
4026
4030
|
};
|
|
4027
|
-
class
|
|
4031
|
+
class uo {
|
|
4028
4032
|
engine;
|
|
4029
4033
|
disposeListeners = /* @__PURE__ */ new Set();
|
|
4030
|
-
constructor(e =
|
|
4031
|
-
this.engine = new
|
|
4034
|
+
constructor(e = lo, t) {
|
|
4035
|
+
this.engine = new oo({
|
|
4032
4036
|
initialState: Object.freeze({ revision: 0, slices: Object.freeze({
|
|
4033
|
-
modelSelection:
|
|
4034
|
-
directory:
|
|
4035
|
-
activeUsers:
|
|
4037
|
+
modelSelection: Yr(),
|
|
4038
|
+
directory: Yi(),
|
|
4039
|
+
activeUsers: sn()
|
|
4036
4040
|
}) }),
|
|
4037
4041
|
reducer: (i, n) => {
|
|
4038
4042
|
const r = n.value;
|
|
4039
4043
|
if (r.type.startsWith("activeUsers.") || (r.type === "effect.completed" || r.type === "effect.failed") && r.effectKind.startsWith("activeUsers.")) {
|
|
4040
|
-
const a =
|
|
4044
|
+
const a = Xr(i.slices.activeUsers, r);
|
|
4041
4045
|
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 };
|
|
4042
4046
|
}
|
|
4043
4047
|
if (r.type.startsWith("directory.") || r.type === "effect.completed" || r.type === "effect.failed") {
|
|
4044
|
-
const a =
|
|
4048
|
+
const a = io(i.slices.directory, r);
|
|
4045
4049
|
return { state: a.state === i.slices.directory ? i : Object.freeze({
|
|
4046
4050
|
revision: i.revision + 1,
|
|
4047
4051
|
slices: Object.freeze({ ...i.slices, directory: a.state })
|
|
4048
4052
|
}), effects: a.effects };
|
|
4049
4053
|
}
|
|
4050
|
-
const o =
|
|
4054
|
+
const o = eo(i.slices.modelSelection, r);
|
|
4051
4055
|
return { state: o === i.slices.modelSelection ? i : Object.freeze({
|
|
4052
4056
|
revision: i.revision + 1,
|
|
4053
4057
|
slices: Object.freeze({ ...i.slices, modelSelection: o })
|
|
4054
4058
|
}), effects: [] };
|
|
4055
4059
|
},
|
|
4056
|
-
selector: (i) => Object.freeze({ ...i.slices, directory:
|
|
4060
|
+
selector: (i) => Object.freeze({ ...i.slices, directory: no(i.slices.directory) }),
|
|
4057
4061
|
effectHandlers: {
|
|
4058
4062
|
...e,
|
|
4059
4063
|
...t,
|
|
@@ -4067,7 +4071,7 @@ class lo {
|
|
|
4067
4071
|
throw new Error("Active users timer not installed");
|
|
4068
4072
|
})
|
|
4069
4073
|
},
|
|
4070
|
-
errorAdapter: (i) =>
|
|
4074
|
+
errorAdapter: (i) => ao({
|
|
4071
4075
|
code: "runtime_error",
|
|
4072
4076
|
message: i instanceof Error ? i.message : String(i),
|
|
4073
4077
|
retryable: !1
|
|
@@ -4080,10 +4084,10 @@ class lo {
|
|
|
4080
4084
|
}
|
|
4081
4085
|
route(e, t) {
|
|
4082
4086
|
if (this.disposed) throw new Error("Product Agent runtime is disposed.");
|
|
4083
|
-
return
|
|
4087
|
+
return Vs(e, t);
|
|
4084
4088
|
}
|
|
4085
4089
|
project(e, t) {
|
|
4086
|
-
return
|
|
4090
|
+
return Vs(e, t);
|
|
4087
4091
|
}
|
|
4088
4092
|
onDispose(e) {
|
|
4089
4093
|
return this.disposed ? (e(), () => {
|
|
@@ -4097,17 +4101,17 @@ class lo {
|
|
|
4097
4101
|
}
|
|
4098
4102
|
}
|
|
4099
4103
|
}
|
|
4100
|
-
const
|
|
4101
|
-
function
|
|
4104
|
+
const Qs = 500;
|
|
4105
|
+
function rn(s) {
|
|
4102
4106
|
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();
|
|
4103
|
-
return e.length >
|
|
4107
|
+
return e.length > Qs ? `${e.slice(0, Qs - 1)}…` : e;
|
|
4104
4108
|
}
|
|
4105
|
-
const
|
|
4106
|
-
async function
|
|
4109
|
+
const ho = "pluno-product-agent-attachments", po = 1, is = "files", fo = 1440 * 60 * 1e3;
|
|
4110
|
+
async function go(s) {
|
|
4107
4111
|
const e = await bs();
|
|
4108
|
-
await
|
|
4112
|
+
await Io(e, "readwrite", (t) => t.put(s));
|
|
4109
4113
|
}
|
|
4110
|
-
async function
|
|
4114
|
+
async function yo(s, e) {
|
|
4111
4115
|
const t = await bs();
|
|
4112
4116
|
await vs(t, "readwrite", async (i) => {
|
|
4113
4117
|
const n = await Ts(
|
|
@@ -4119,7 +4123,7 @@ async function go(s, e) {
|
|
|
4119
4123
|
});
|
|
4120
4124
|
});
|
|
4121
4125
|
}
|
|
4122
|
-
async function
|
|
4126
|
+
async function mo(s = fo) {
|
|
4123
4127
|
const e = await bs(), t = Date.now() - s;
|
|
4124
4128
|
await vs(e, "readwrite", async (i) => {
|
|
4125
4129
|
const n = i.index("lastUsedAt");
|
|
@@ -4128,14 +4132,14 @@ async function yo(s = po) {
|
|
|
4128
4132
|
}
|
|
4129
4133
|
function bs() {
|
|
4130
4134
|
return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((s, e) => {
|
|
4131
|
-
const t = indexedDB.open(
|
|
4135
|
+
const t = indexedDB.open(ho, po);
|
|
4132
4136
|
t.onupgradeneeded = () => {
|
|
4133
4137
|
const n = t.result.createObjectStore(is, { keyPath: "attachmentId" });
|
|
4134
4138
|
n.createIndex("lastUsedAt", "lastUsedAt", { unique: !1 }), n.createIndex("sessionId", "sessionId", { unique: !1 }), n.createIndex("origin", "origin", { unique: !1 });
|
|
4135
4139
|
}, t.onsuccess = () => s(t.result), t.onerror = () => e(t.error ?? new Error("Failed to open Product Agent attachment storage"));
|
|
4136
4140
|
});
|
|
4137
4141
|
}
|
|
4138
|
-
async function
|
|
4142
|
+
async function Io(s, e, t) {
|
|
4139
4143
|
return await vs(s, e, async (i) => await Ts(t(i)));
|
|
4140
4144
|
}
|
|
4141
4145
|
function vs(s, e, t) {
|
|
@@ -4165,11 +4169,11 @@ function Ts(s) {
|
|
|
4165
4169
|
s.onsuccess = () => e(s.result), s.onerror = () => t(s.error ?? new Error("Product Agent attachment storage request failed"));
|
|
4166
4170
|
});
|
|
4167
4171
|
}
|
|
4168
|
-
function
|
|
4172
|
+
function So(s) {
|
|
4169
4173
|
return s !== null && (typeof s == "object" || typeof s == "function");
|
|
4170
4174
|
}
|
|
4171
|
-
function
|
|
4172
|
-
const i = Reflect.get(s, "pluno"), n =
|
|
4175
|
+
function on(s, e, t) {
|
|
4176
|
+
const i = Reflect.get(s, "pluno"), n = So(i) ? i : {};
|
|
4173
4177
|
if (n !== i && !Reflect.set(s, "pluno", n))
|
|
4174
4178
|
return null;
|
|
4175
4179
|
const r = Object.getOwnPropertyDescriptor(n, e);
|
|
@@ -4183,25 +4187,25 @@ function rn(s, e, t) {
|
|
|
4183
4187
|
}
|
|
4184
4188
|
};
|
|
4185
4189
|
}
|
|
4186
|
-
const
|
|
4187
|
-
function
|
|
4190
|
+
const wo = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
|
|
4191
|
+
function Gs(s, e) {
|
|
4188
4192
|
return e ? s.replace(
|
|
4189
|
-
|
|
4193
|
+
wo,
|
|
4190
4194
|
(t, i, n, r) => `${i}${new URL(n, e).toString()}${r}`
|
|
4191
4195
|
) : s;
|
|
4192
4196
|
}
|
|
4193
4197
|
const _s = "suggest_share_on_socials";
|
|
4194
|
-
function
|
|
4198
|
+
function bo(s) {
|
|
4195
4199
|
for (let e = s.length - 1; e >= 0; e -= 1) {
|
|
4196
4200
|
const t = s[e];
|
|
4197
4201
|
if (t.role !== "tool" || t.toolName !== _s || t.sharePromptAllowed !== void 0)
|
|
4198
4202
|
continue;
|
|
4199
|
-
if (
|
|
4203
|
+
if (To(s, e, t.callId) !== !0)
|
|
4200
4204
|
return null;
|
|
4201
|
-
const i =
|
|
4205
|
+
const i = Js(s, e, "assistant");
|
|
4202
4206
|
if (!i)
|
|
4203
4207
|
return null;
|
|
4204
|
-
const n =
|
|
4208
|
+
const n = Js(s, i.index, "user");
|
|
4205
4209
|
return n ? {
|
|
4206
4210
|
id: `share:${t.callId ?? t.id}`,
|
|
4207
4211
|
userPrompt: n.content,
|
|
@@ -4210,7 +4214,7 @@ function wo(s) {
|
|
|
4210
4214
|
}
|
|
4211
4215
|
return null;
|
|
4212
4216
|
}
|
|
4213
|
-
function
|
|
4217
|
+
function vo(s) {
|
|
4214
4218
|
let e = s;
|
|
4215
4219
|
if (typeof s == "string")
|
|
4216
4220
|
try {
|
|
@@ -4218,10 +4222,10 @@ function bo(s) {
|
|
|
4218
4222
|
} catch {
|
|
4219
4223
|
return null;
|
|
4220
4224
|
}
|
|
4221
|
-
const t =
|
|
4225
|
+
const t = _o(e);
|
|
4222
4226
|
return t ? typeof t.showSharePrompt == "boolean" ? t.showSharePrompt : t.ok === !0 && typeof t.message == "string" && t.message.includes("social-sharing prompt") ? !0 : null : null;
|
|
4223
4227
|
}
|
|
4224
|
-
function
|
|
4228
|
+
function To(s, e, t) {
|
|
4225
4229
|
if (!t)
|
|
4226
4230
|
return null;
|
|
4227
4231
|
for (let i = e + 1; i < s.length; i += 1) {
|
|
@@ -4231,7 +4235,7 @@ function vo(s, e, t) {
|
|
|
4231
4235
|
}
|
|
4232
4236
|
return null;
|
|
4233
4237
|
}
|
|
4234
|
-
function
|
|
4238
|
+
function Js(s, e, t) {
|
|
4235
4239
|
for (let i = e - 1; i >= 0; i -= 1) {
|
|
4236
4240
|
const n = s[i];
|
|
4237
4241
|
if (n.role === t && n.content.trim())
|
|
@@ -4239,14 +4243,14 @@ function Gs(s, e, t) {
|
|
|
4239
4243
|
}
|
|
4240
4244
|
return null;
|
|
4241
4245
|
}
|
|
4242
|
-
function
|
|
4246
|
+
function _o(s) {
|
|
4243
4247
|
return s && typeof s == "object" && !Array.isArray(s) ? s : null;
|
|
4244
4248
|
}
|
|
4245
|
-
const
|
|
4246
|
-
function
|
|
4247
|
-
return (s.type === "function_call" || s.type === "tool_call") && s.name ===
|
|
4249
|
+
const Ro = "save_runtime_captured_skill";
|
|
4250
|
+
function Ao(s) {
|
|
4251
|
+
return (s.type === "function_call" || s.type === "tool_call") && s.name === Ro;
|
|
4248
4252
|
}
|
|
4249
|
-
function
|
|
4253
|
+
function ko(s, e, t) {
|
|
4250
4254
|
const i = e.map((y) => ({ item: y, identity: t(y) })), n = new Set(
|
|
4251
4255
|
i.flatMap(
|
|
4252
4256
|
({ identity: y }) => y.isActivity && !y.isTransient ? y.activityKeys ?? [] : []
|
|
@@ -4294,16 +4298,16 @@ function Ao(s, e, t) {
|
|
|
4294
4298
|
}
|
|
4295
4299
|
return w;
|
|
4296
4300
|
}
|
|
4297
|
-
function
|
|
4301
|
+
function Xs(s, e, t, i) {
|
|
4298
4302
|
return s.filter((n) => {
|
|
4299
4303
|
const r = i(n);
|
|
4300
4304
|
return !r.isActivity || !r.isTransient ? !0 : e !== null && r.respondsToUserMessageId !== void 0 ? r.respondsToUserMessageId !== e : t === null || r.runId !== t;
|
|
4301
4305
|
});
|
|
4302
4306
|
}
|
|
4303
|
-
const Pt = "pluno.productAgent.transportId",
|
|
4307
|
+
const Pt = "pluno.productAgent.transportId", Mo = "pluno.productAgent.transportIdentity", Dt = "pluno.productAgent.transportIdentity.event", Eo = 50, Co = globalThis.setTimeout.bind(globalThis);
|
|
4304
4308
|
let Ee = null;
|
|
4305
4309
|
const ct = /* @__PURE__ */ new Set(), Ut = /* @__PURE__ */ new Map();
|
|
4306
|
-
async function
|
|
4310
|
+
async function Po(s = an()) {
|
|
4307
4311
|
const e = s.randomUUID(), t = s.storage.getItem(Pt);
|
|
4308
4312
|
let i = t ?? s.randomUUID(), n = !1, r = !1;
|
|
4309
4313
|
const o = s.channel.subscribe((c) => {
|
|
@@ -4341,9 +4345,9 @@ async function Co(s = on()) {
|
|
|
4341
4345
|
}
|
|
4342
4346
|
};
|
|
4343
4347
|
}
|
|
4344
|
-
async function
|
|
4345
|
-
Ee || (Ee =
|
|
4346
|
-
...
|
|
4348
|
+
async function Do(s = !1) {
|
|
4349
|
+
Ee || (Ee = Po({
|
|
4350
|
+
...an(),
|
|
4347
4351
|
skipStoredIdentityCollisionCheck: s
|
|
4348
4352
|
}), Ee.then((n) => {
|
|
4349
4353
|
const r = (o) => {
|
|
@@ -4351,7 +4355,7 @@ async function Po(s = !1) {
|
|
|
4351
4355
|
};
|
|
4352
4356
|
window.addEventListener("pagehide", r);
|
|
4353
4357
|
}));
|
|
4354
|
-
const e = await Ee, t =
|
|
4358
|
+
const e = await Ee, t = Uo();
|
|
4355
4359
|
ct.add(t);
|
|
4356
4360
|
let i = !1;
|
|
4357
4361
|
return {
|
|
@@ -4362,21 +4366,21 @@ async function Po(s = !1) {
|
|
|
4362
4366
|
}
|
|
4363
4367
|
};
|
|
4364
4368
|
}
|
|
4365
|
-
function
|
|
4369
|
+
function Uo() {
|
|
4366
4370
|
let s = 0;
|
|
4367
4371
|
for (; ct.has(s); )
|
|
4368
4372
|
s += 1;
|
|
4369
4373
|
return s;
|
|
4370
4374
|
}
|
|
4371
|
-
function
|
|
4375
|
+
function an() {
|
|
4372
4376
|
return {
|
|
4373
|
-
storage:
|
|
4374
|
-
channel:
|
|
4377
|
+
storage: qo(),
|
|
4378
|
+
channel: Oo(),
|
|
4375
4379
|
randomUUID: () => crypto.randomUUID(),
|
|
4376
|
-
settle: () => new Promise((s) =>
|
|
4380
|
+
settle: () => new Promise((s) => Co(s, Eo))
|
|
4377
4381
|
};
|
|
4378
4382
|
}
|
|
4379
|
-
function
|
|
4383
|
+
function qo() {
|
|
4380
4384
|
return {
|
|
4381
4385
|
getItem: (s) => {
|
|
4382
4386
|
try {
|
|
@@ -4394,9 +4398,9 @@ function Uo() {
|
|
|
4394
4398
|
}
|
|
4395
4399
|
};
|
|
4396
4400
|
}
|
|
4397
|
-
function
|
|
4401
|
+
function Oo() {
|
|
4398
4402
|
if (typeof BroadcastChannel < "u") {
|
|
4399
|
-
const s = new BroadcastChannel(
|
|
4403
|
+
const s = new BroadcastChannel(Mo);
|
|
4400
4404
|
return {
|
|
4401
4405
|
postMessage: (e) => s.postMessage(e),
|
|
4402
4406
|
subscribe: (e) => {
|
|
@@ -4406,9 +4410,9 @@ function qo() {
|
|
|
4406
4410
|
close: () => s.close()
|
|
4407
4411
|
};
|
|
4408
4412
|
}
|
|
4409
|
-
return
|
|
4413
|
+
return xo();
|
|
4410
4414
|
}
|
|
4411
|
-
function
|
|
4415
|
+
function xo() {
|
|
4412
4416
|
const s = /* @__PURE__ */ new Set(), e = (t) => {
|
|
4413
4417
|
if (t.key !== Dt || !t.newValue)
|
|
4414
4418
|
return;
|
|
@@ -4429,8 +4433,8 @@ function Oo() {
|
|
|
4429
4433
|
}
|
|
4430
4434
|
};
|
|
4431
4435
|
}
|
|
4432
|
-
const
|
|
4433
|
-
function
|
|
4436
|
+
const cn = "schedule_follow_up";
|
|
4437
|
+
function Bo(s) {
|
|
4434
4438
|
let e = s;
|
|
4435
4439
|
if (typeof e == "string")
|
|
4436
4440
|
try {
|
|
@@ -4441,12 +4445,12 @@ function xo(s) {
|
|
|
4441
4445
|
if (!e || typeof e != "object")
|
|
4442
4446
|
return null;
|
|
4443
4447
|
const t = e;
|
|
4444
|
-
return t.ok !== !0 || t.toolName !==
|
|
4448
|
+
return t.ok !== !0 || t.toolName !== cn || typeof t.dueAt != "string" || Number.isNaN(Date.parse(t.dueAt)) ? null : {
|
|
4445
4449
|
id: typeof t.taskId == "string" && t.taskId ? t.taskId : null,
|
|
4446
4450
|
dueAt: t.dueAt
|
|
4447
4451
|
};
|
|
4448
4452
|
}
|
|
4449
|
-
const
|
|
4453
|
+
const No = [
|
|
4450
4454
|
"anthropic/claude-opus-5",
|
|
4451
4455
|
"anthropic/claude-sonnet-5",
|
|
4452
4456
|
"deepseek/deepseek-chat-v3.1",
|
|
@@ -4457,16 +4461,16 @@ const Bo = [
|
|
|
4457
4461
|
"gpt-5.6-luna",
|
|
4458
4462
|
"gpt-5.6-terra",
|
|
4459
4463
|
"gpt-5.6-sol"
|
|
4460
|
-
], ns = (s) => typeof s == "string" &&
|
|
4461
|
-
function
|
|
4464
|
+
], ns = (s) => typeof s == "string" && No.includes(s), qt = /* @__PURE__ */ new Map();
|
|
4465
|
+
function Lo(s, e, t) {
|
|
4462
4466
|
const i = `pluno.productAgent.modelClientScope:${e}`, n = s.getItem(i);
|
|
4463
4467
|
if (n) return n;
|
|
4464
4468
|
const r = t();
|
|
4465
4469
|
return s.setItem(i, r), r;
|
|
4466
4470
|
}
|
|
4467
|
-
function
|
|
4471
|
+
function Fo(s, e) {
|
|
4468
4472
|
try {
|
|
4469
|
-
const t =
|
|
4473
|
+
const t = Lo(window.sessionStorage, s, e);
|
|
4470
4474
|
return qt.set(s, t), t;
|
|
4471
4475
|
} catch (t) {
|
|
4472
4476
|
if (!(t instanceof DOMException) || t.name !== "SecurityError" && t.name !== "QuotaExceededError") throw t;
|
|
@@ -4474,17 +4478,17 @@ function Lo(s, e) {
|
|
|
4474
4478
|
return qt.set(s, i), i;
|
|
4475
4479
|
}
|
|
4476
4480
|
}
|
|
4477
|
-
function
|
|
4481
|
+
function jo(s) {
|
|
4478
4482
|
if (!s || typeof s != "object") return;
|
|
4479
4483
|
const e = s, t = e.requestedModel ?? e.requested_model, i = e.effectiveModel ?? e.effective_model, n = e.provider;
|
|
4480
4484
|
if (!(!ns(t) || !ns(i) || n !== "openrouter" && n !== "azure" && n !== "openai"))
|
|
4481
4485
|
return Object.freeze({ requestedModel: t, effectiveModel: i, provider: n });
|
|
4482
4486
|
}
|
|
4483
|
-
const xe = (s, e) =>
|
|
4487
|
+
const xe = (s, e) => Zr(
|
|
4484
4488
|
s.engine.getState().slices.modelSelection,
|
|
4485
4489
|
e
|
|
4486
|
-
), Ho = (s, e) =>
|
|
4487
|
-
function
|
|
4490
|
+
), Ho = (s, e) => nn(xe(s, e));
|
|
4491
|
+
function $o(s, e, t, i) {
|
|
4488
4492
|
return s.engine.dispatch({
|
|
4489
4493
|
type: "model.submission_capture",
|
|
4490
4494
|
clientScopeId: e,
|
|
@@ -4492,8 +4496,8 @@ function jo(s, e, t, i) {
|
|
|
4492
4496
|
requestedModel: i
|
|
4493
4497
|
}), xe(s, e).submissions[t].requestedModel;
|
|
4494
4498
|
}
|
|
4495
|
-
function
|
|
4496
|
-
const o =
|
|
4499
|
+
function ln(s, e, t, i, n, r) {
|
|
4500
|
+
const o = jo(n);
|
|
4497
4501
|
o && s.engine.accept({
|
|
4498
4502
|
type: "model.routing_accepted",
|
|
4499
4503
|
clientScopeId: e,
|
|
@@ -4508,7 +4512,7 @@ function Ot(s, e, t, i) {
|
|
|
4508
4512
|
for (const n of i) {
|
|
4509
4513
|
if (!n || typeof n != "object") continue;
|
|
4510
4514
|
const r = n, o = r.clientMessageId ?? r.client_message_id, a = r.updatedAt ?? r.updated_at;
|
|
4511
|
-
typeof o == "string" &&
|
|
4515
|
+
typeof o == "string" && ln(
|
|
4512
4516
|
s,
|
|
4513
4517
|
e,
|
|
4514
4518
|
t,
|
|
@@ -4518,32 +4522,32 @@ function Ot(s, e, t, i) {
|
|
|
4518
4522
|
);
|
|
4519
4523
|
}
|
|
4520
4524
|
}
|
|
4521
|
-
function
|
|
4525
|
+
function Ys(s, e) {
|
|
4522
4526
|
return s.filter((t, i) => {
|
|
4523
|
-
const n =
|
|
4524
|
-
return
|
|
4525
|
-
const o =
|
|
4526
|
-
return
|
|
4527
|
+
const n = Zs(t);
|
|
4528
|
+
return dn(n) ? !s.slice(i + 1).some((r) => {
|
|
4529
|
+
const o = Zs(r);
|
|
4530
|
+
return un(n, o) && hn(n, o);
|
|
4527
4531
|
}) : !0;
|
|
4528
4532
|
});
|
|
4529
4533
|
}
|
|
4530
|
-
function
|
|
4534
|
+
function dn(s) {
|
|
4531
4535
|
return s.type === "run_status" && s.status === "stopped" && s.reason === "task_tab_closed";
|
|
4532
4536
|
}
|
|
4533
|
-
function
|
|
4534
|
-
return s.reason === "task_tab_closed" &&
|
|
4537
|
+
function Wo(s, e) {
|
|
4538
|
+
return s.reason === "task_tab_closed" && hn(s, e) && un(s, e);
|
|
4535
4539
|
}
|
|
4536
|
-
function
|
|
4540
|
+
function Zs(s) {
|
|
4537
4541
|
return s.data && typeof s.data == "object" ? s.data : {};
|
|
4538
4542
|
}
|
|
4539
|
-
function
|
|
4543
|
+
function un(s, e) {
|
|
4540
4544
|
const t = typeof s.runId == "string" ? s.runId : null, i = typeof e.runId == "string" ? e.runId : null;
|
|
4541
|
-
return t && i && t === i ? !1 : e.type === "message" ? e.role === "assistant" : e.type === "run_status" ? !
|
|
4545
|
+
return t && i && t === i ? !1 : e.type === "message" ? e.role === "assistant" : e.type === "run_status" ? !dn(e) : e.type === "run_error";
|
|
4542
4546
|
}
|
|
4543
|
-
function
|
|
4547
|
+
function hn(s, e) {
|
|
4544
4548
|
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;
|
|
4545
4549
|
}
|
|
4546
|
-
class
|
|
4550
|
+
class zo {
|
|
4547
4551
|
constructor(e) {
|
|
4548
4552
|
this.options = e;
|
|
4549
4553
|
}
|
|
@@ -4595,7 +4599,7 @@ class Wo {
|
|
|
4595
4599
|
);
|
|
4596
4600
|
}
|
|
4597
4601
|
}
|
|
4598
|
-
class
|
|
4602
|
+
class Ko {
|
|
4599
4603
|
constructor(e, t = null) {
|
|
4600
4604
|
this.storage = e, t && (this.decisions = new Map(
|
|
4601
4605
|
t.filter(rs).map((i) => [this.getDecisionKey(i), i])
|
|
@@ -4646,7 +4650,7 @@ class zo {
|
|
|
4646
4650
|
async applyAction(e, t, i) {
|
|
4647
4651
|
if (!e.allowedActions.includes(t))
|
|
4648
4652
|
throw new Error(`Interaction ${e.key} does not allow ${t}.`);
|
|
4649
|
-
if (!
|
|
4653
|
+
if (!pn(t))
|
|
4650
4654
|
throw new Error(`Interaction action ${t} is not a persistence decision.`);
|
|
4651
4655
|
const n = i.now ?? /* @__PURE__ */ new Date(), r = {
|
|
4652
4656
|
promptKey: e.key,
|
|
@@ -4682,13 +4686,13 @@ class zo {
|
|
|
4682
4686
|
return `${xt(e.scope)}:category:${e.category}`;
|
|
4683
4687
|
}
|
|
4684
4688
|
}
|
|
4685
|
-
function
|
|
4689
|
+
function Fl(s, e) {
|
|
4686
4690
|
return {
|
|
4687
|
-
load: async () =>
|
|
4691
|
+
load: async () => Vo(s, e),
|
|
4688
4692
|
save: async (t) => s.setItem(e, JSON.stringify(t))
|
|
4689
4693
|
};
|
|
4690
4694
|
}
|
|
4691
|
-
function
|
|
4695
|
+
function Vo(s, e) {
|
|
4692
4696
|
const t = s.getItem(e);
|
|
4693
4697
|
if (!t) return [];
|
|
4694
4698
|
const i = JSON.parse(t);
|
|
@@ -4697,13 +4701,13 @@ function Ko(s, e) {
|
|
|
4697
4701
|
function xt(s) {
|
|
4698
4702
|
return `${s.level}:${s.key}`;
|
|
4699
4703
|
}
|
|
4700
|
-
function
|
|
4704
|
+
function pn(s) {
|
|
4701
4705
|
return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
|
|
4702
4706
|
}
|
|
4703
4707
|
function rs(s) {
|
|
4704
4708
|
if (!s || typeof s != "object") return !1;
|
|
4705
4709
|
const e = s;
|
|
4706
|
-
return typeof e.promptKey == "string" && typeof e.category == "string" && typeof e.decidedAt == "string" && (e.nextEligibleAt === null || typeof e.nextEligibleAt == "string") &&
|
|
4710
|
+
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");
|
|
4707
4711
|
}
|
|
4708
4712
|
function lt(s) {
|
|
4709
4713
|
return {
|
|
@@ -4715,7 +4719,7 @@ function lt(s) {
|
|
|
4715
4719
|
updatedAt: null
|
|
4716
4720
|
};
|
|
4717
4721
|
}
|
|
4718
|
-
class
|
|
4722
|
+
class ei {
|
|
4719
4723
|
constructor(e, t, i = (n, r) => r) {
|
|
4720
4724
|
this.loader = t, this.merge = i, this.state = lt(e);
|
|
4721
4725
|
}
|
|
@@ -4800,23 +4804,23 @@ function dt(s) {
|
|
|
4800
4804
|
nextCursor: s.nextCursor
|
|
4801
4805
|
};
|
|
4802
4806
|
}
|
|
4803
|
-
function
|
|
4807
|
+
function Qo(s, e, t) {
|
|
4804
4808
|
if (t === "replace" || s === null) return e;
|
|
4805
4809
|
const i = { ...s.entitiesById, ...e.entitiesById }, n = [...s.ids];
|
|
4806
4810
|
for (const r of e.ids)
|
|
4807
4811
|
s.entitiesById[r] || n.push(r);
|
|
4808
4812
|
return { entitiesById: i, ids: n, nextCursor: e.nextCursor };
|
|
4809
4813
|
}
|
|
4810
|
-
function
|
|
4814
|
+
function Go(s) {
|
|
4811
4815
|
return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
|
|
4812
4816
|
}
|
|
4813
|
-
function
|
|
4817
|
+
function jl(s) {
|
|
4814
4818
|
return s.visible ? s.minimized ? { state: "minimized" } : { state: s.open ? "visible_open" : "visible_closed" } : { state: "hidden" };
|
|
4815
4819
|
}
|
|
4816
|
-
function
|
|
4820
|
+
function Jo(s, e) {
|
|
4817
4821
|
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: [] };
|
|
4818
4822
|
}
|
|
4819
|
-
function
|
|
4823
|
+
function Xo(s) {
|
|
4820
4824
|
if (!s || typeof s != "object") return !1;
|
|
4821
4825
|
const e = s.paidCreditFallbackModel;
|
|
4822
4826
|
return typeof e == "string" && e.length > 0;
|
|
@@ -4831,9 +4835,9 @@ function Hl(s) {
|
|
|
4831
4835
|
disabled: !e || !s.canSubmitMessage
|
|
4832
4836
|
};
|
|
4833
4837
|
}
|
|
4834
|
-
class
|
|
4838
|
+
class $l {
|
|
4835
4839
|
constructor(e, t, i = 20) {
|
|
4836
|
-
this.loadPage = t, this.limit = i, this.recentQuery = new
|
|
4840
|
+
this.loadPage = t, this.limit = i, this.recentQuery = new ei(
|
|
4837
4841
|
`${e}:recent`,
|
|
4838
4842
|
async ({ cursor: n }) => dt(
|
|
4839
4843
|
await this.loadPage({ cursor: n, limit: this.limit, pinned: !1 }).then((r) => ({
|
|
@@ -4841,8 +4845,8 @@ class jl {
|
|
|
4841
4845
|
nextCursor: r.nextCursor
|
|
4842
4846
|
}))
|
|
4843
4847
|
),
|
|
4844
|
-
|
|
4845
|
-
), this.pinnedQuery = new
|
|
4848
|
+
Qo
|
|
4849
|
+
), this.pinnedQuery = new ei(
|
|
4846
4850
|
`${e}:pinned`,
|
|
4847
4851
|
async () => dt({
|
|
4848
4852
|
entities: await this.loadAllPinned(),
|
|
@@ -4874,7 +4878,7 @@ class jl {
|
|
|
4874
4878
|
}) : null;
|
|
4875
4879
|
return {
|
|
4876
4880
|
key: e.key.slice(0, -7),
|
|
4877
|
-
status:
|
|
4881
|
+
status: Yo(e, t),
|
|
4878
4882
|
data: a,
|
|
4879
4883
|
error: e.error ?? t.error,
|
|
4880
4884
|
requestId: Math.max(e.requestId, t.requestId),
|
|
@@ -4983,21 +4987,21 @@ class jl {
|
|
|
4983
4987
|
function Ve(s) {
|
|
4984
4988
|
return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
|
|
4985
4989
|
}
|
|
4986
|
-
function
|
|
4990
|
+
function Yo(s, e) {
|
|
4987
4991
|
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";
|
|
4988
4992
|
}
|
|
4989
|
-
const
|
|
4993
|
+
const Zo = {
|
|
4990
4994
|
working: "⏳",
|
|
4991
4995
|
completed: "✅",
|
|
4992
4996
|
failed: "❗",
|
|
4993
4997
|
stopped: "⏹️"
|
|
4994
|
-
},
|
|
4995
|
-
function
|
|
4998
|
+
}, ea = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
|
|
4999
|
+
function ta(s, e) {
|
|
4996
5000
|
if (!e) return pt(s);
|
|
4997
|
-
const t = pt(s), i = `${
|
|
5001
|
+
const t = pt(s), i = `${Zo[e]} Pluno`;
|
|
4998
5002
|
return t ? `${i}: ${t}` : i;
|
|
4999
5003
|
}
|
|
5000
|
-
class
|
|
5004
|
+
class Wl {
|
|
5001
5005
|
constructor(e) {
|
|
5002
5006
|
this.titleDocument = e;
|
|
5003
5007
|
}
|
|
@@ -5031,11 +5035,11 @@ class $l {
|
|
|
5031
5035
|
applyTitle() {
|
|
5032
5036
|
if (!this.status)
|
|
5033
5037
|
return;
|
|
5034
|
-
const e =
|
|
5038
|
+
const e = ta(this.baseTitle, this.status);
|
|
5035
5039
|
this.lastAppliedTitle = e, this.titleDocument.getTitle() !== e && this.titleDocument.setTitle(e);
|
|
5036
5040
|
}
|
|
5037
5041
|
}
|
|
5038
|
-
function
|
|
5042
|
+
function zl(s) {
|
|
5039
5043
|
return {
|
|
5040
5044
|
getTitle: () => s.title,
|
|
5041
5045
|
setTitle: (e) => {
|
|
@@ -5052,9 +5056,9 @@ function Wl(s) {
|
|
|
5052
5056
|
};
|
|
5053
5057
|
}
|
|
5054
5058
|
function pt(s) {
|
|
5055
|
-
return s.replace(
|
|
5059
|
+
return s.replace(ea, "");
|
|
5056
5060
|
}
|
|
5057
|
-
const
|
|
5061
|
+
const sa = {
|
|
5058
5062
|
"in-progress-stop-unavailable": "An in-progress response has no visible enabled interrupt control.",
|
|
5059
5063
|
"stop-did-not-interrupt": "The stopped response remained in progress after an interrupt click.",
|
|
5060
5064
|
"duplicate-message-item": "A canonical message rendered more than once.",
|
|
@@ -5069,10 +5073,10 @@ const ta = {
|
|
|
5069
5073
|
"thinking-groups-without-user-message": "Multiple thinking groups appeared without a user message between them.",
|
|
5070
5074
|
"thinking-without-progress": "Thinking remained visible without progress for five minutes."
|
|
5071
5075
|
};
|
|
5072
|
-
function
|
|
5073
|
-
return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(
|
|
5076
|
+
function ia(s) {
|
|
5077
|
+
return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(sa, s.slice(13));
|
|
5074
5078
|
}
|
|
5075
|
-
function
|
|
5079
|
+
function ti(s) {
|
|
5076
5080
|
return {
|
|
5077
5081
|
...s.id === void 0 ? {} : { id: s.id },
|
|
5078
5082
|
name: s.name,
|
|
@@ -5083,7 +5087,7 @@ function ei(s) {
|
|
|
5083
5087
|
...s.fileUrl === void 0 ? {} : { fileUrl: s.fileUrl }
|
|
5084
5088
|
};
|
|
5085
5089
|
}
|
|
5086
|
-
function
|
|
5090
|
+
function Kl(s) {
|
|
5087
5091
|
if (!s || typeof s != "object" || !("type" in s)) return !1;
|
|
5088
5092
|
const e = s;
|
|
5089
5093
|
switch (e.type) {
|
|
@@ -5094,13 +5098,13 @@ function zl(s) {
|
|
|
5094
5098
|
case "run.stop":
|
|
5095
5099
|
return e.clientMessageIds === void 0 || Array.isArray(e.clientMessageIds) && e.clientMessageIds.length <= 100 && e.clientMessageIds.every((t) => typeof t == "string" && t.length > 0 && t.length <= 160);
|
|
5096
5100
|
case "runtime.report_response_visibility":
|
|
5097
|
-
return
|
|
5101
|
+
return en(e.observation);
|
|
5098
5102
|
case "runtime.warmup":
|
|
5099
5103
|
return e.reason === "panel_open" || e.reason === "extension_install" || e.reason === "composer_input";
|
|
5100
5104
|
case "runtime.report_displayed_error":
|
|
5101
5105
|
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);
|
|
5102
5106
|
case "runtime.report_invalid_state_transition":
|
|
5103
|
-
return (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" ||
|
|
5107
|
+
return (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" || ia(e.reason)) && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
|
|
5104
5108
|
case "runtime.widget_lifecycle":
|
|
5105
5109
|
return (e.action === "opened" || e.action === "closed" || e.action === "minimized") && typeof e.trigger == "string";
|
|
5106
5110
|
case "session.load":
|
|
@@ -5128,7 +5132,7 @@ function zl(s) {
|
|
|
5128
5132
|
return !1;
|
|
5129
5133
|
}
|
|
5130
5134
|
}
|
|
5131
|
-
class
|
|
5135
|
+
class Vl {
|
|
5132
5136
|
constructor(e, t, i) {
|
|
5133
5137
|
this.adapter = t, this.state = Bt(e), this.model = i;
|
|
5134
5138
|
}
|
|
@@ -5163,7 +5167,7 @@ class Kl {
|
|
|
5163
5167
|
for (const a of this.state.messages) {
|
|
5164
5168
|
if (a.role !== "user" || !a.attachments?.length) continue;
|
|
5165
5169
|
const c = a.clientMessageId, l = o.messages.find((d) => d.role === "user" && (d.id === a.id || c && d.clientMessageId === c));
|
|
5166
|
-
o.sessionId !== e.sessionId && !(o.sessionId === null && c && l?.clientMessageId === c) || (a.attachments =
|
|
5170
|
+
o.sessionId !== e.sessionId && !(o.sessionId === null && c && l?.clientMessageId === c) || (a.attachments = si(l?.attachments, a.attachments));
|
|
5167
5171
|
}
|
|
5168
5172
|
if (this.stoppedProjection) {
|
|
5169
5173
|
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));
|
|
@@ -5191,7 +5195,7 @@ class Kl {
|
|
|
5191
5195
|
(d) => d.clientMessageId === a
|
|
5192
5196
|
);
|
|
5193
5197
|
if (l) {
|
|
5194
|
-
l.attachments =
|
|
5198
|
+
l.attachments = si(
|
|
5195
5199
|
c.message.attachments,
|
|
5196
5200
|
l.attachments
|
|
5197
5201
|
), this.unacknowledgedSubmissions.delete(a);
|
|
@@ -5200,7 +5204,7 @@ class Kl {
|
|
|
5200
5204
|
c.sessionId ??= e.sessionId, this.state.messages.push(c.message), this.state.pendingMessageStatus = "sending", this.state.turnPhase ??= "sending", this.state.taskStatus ??= "working";
|
|
5201
5205
|
}
|
|
5202
5206
|
if (t !== void 0 && (this.model = t), i && JSON.stringify(i) !== JSON.stringify(this.sessionHistoryState)) {
|
|
5203
|
-
this.sessionHistoryState =
|
|
5207
|
+
this.sessionHistoryState = ii(i);
|
|
5204
5208
|
for (const a of this.sessionHistoryListeners)
|
|
5205
5209
|
a(this.getSessionHistoryState());
|
|
5206
5210
|
}
|
|
@@ -5248,7 +5252,7 @@ class Kl {
|
|
|
5248
5252
|
type: "runtime.report_displayed_error",
|
|
5249
5253
|
reason: e,
|
|
5250
5254
|
errorFingerprint: t,
|
|
5251
|
-
...i ? { displayedMessage:
|
|
5255
|
+
...i ? { displayedMessage: rn(i) } : {}
|
|
5252
5256
|
}).catch(() => {
|
|
5253
5257
|
});
|
|
5254
5258
|
}
|
|
@@ -5295,7 +5299,7 @@ class Kl {
|
|
|
5295
5299
|
clientMessageId: o,
|
|
5296
5300
|
proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
|
|
5297
5301
|
// Preview URLs belong to the renderer's optimistic snapshot and are not valid runtime-command metadata.
|
|
5298
|
-
attachments: a.length > 0 ? a.map(
|
|
5302
|
+
attachments: a.length > 0 ? a.map(ti) : void 0,
|
|
5299
5303
|
submittedAt: t.submittedAt
|
|
5300
5304
|
}), n !== this.submissionGeneration) return null;
|
|
5301
5305
|
if (c = !0, a.length > 0) {
|
|
@@ -5321,7 +5325,7 @@ class Kl {
|
|
|
5321
5325
|
invocation: t.invocation,
|
|
5322
5326
|
proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
|
|
5323
5327
|
...t.automationOnboarding ? { automationOnboarding: !0 } : {},
|
|
5324
|
-
attachments: a.length > 0 ? a.map(
|
|
5328
|
+
attachments: a.length > 0 ? a.map(ti) : void 0
|
|
5325
5329
|
});
|
|
5326
5330
|
if (n !== this.submissionGeneration) return null;
|
|
5327
5331
|
for (const d of t.attachments ?? [])
|
|
@@ -5395,7 +5399,7 @@ class Kl {
|
|
|
5395
5399
|
return t.sessionHistoryPage;
|
|
5396
5400
|
}
|
|
5397
5401
|
getSessionHistoryState() {
|
|
5398
|
-
return
|
|
5402
|
+
return ii(this.sessionHistoryState);
|
|
5399
5403
|
}
|
|
5400
5404
|
subscribeSessionHistory(e) {
|
|
5401
5405
|
return this.sessionHistoryListeners.add(e), e(this.getSessionHistoryState()), () => this.sessionHistoryListeners.delete(e);
|
|
@@ -5474,7 +5478,7 @@ class Kl {
|
|
|
5474
5478
|
for (const n of i ?? []) n(t);
|
|
5475
5479
|
}
|
|
5476
5480
|
}
|
|
5477
|
-
function
|
|
5481
|
+
function si(s, e) {
|
|
5478
5482
|
if (!e || !s) return e;
|
|
5479
5483
|
const t = /* @__PURE__ */ new Map();
|
|
5480
5484
|
for (const i of s) {
|
|
@@ -5510,16 +5514,16 @@ function Bt(s) {
|
|
|
5510
5514
|
activeScheduledFollowUps: s.activeScheduledFollowUps?.map((e) => ({ ...e })) ?? null
|
|
5511
5515
|
};
|
|
5512
5516
|
}
|
|
5513
|
-
function
|
|
5517
|
+
function ii(s) {
|
|
5514
5518
|
return {
|
|
5515
5519
|
...s,
|
|
5516
5520
|
data: s.data ? dt({
|
|
5517
|
-
entities:
|
|
5521
|
+
entities: Go(s.data).map((e) => ({ ...e })),
|
|
5518
5522
|
nextCursor: s.data.nextCursor
|
|
5519
5523
|
}) : null
|
|
5520
5524
|
};
|
|
5521
5525
|
}
|
|
5522
|
-
const
|
|
5526
|
+
const na = globalThis.fetch.bind(globalThis), ni = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', ra = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', oa = ".pluno-pa-widget__panel", aa = ".pluno-pa-widget__timeline", ca = "__plunoExtensionWidgetOwner";
|
|
5523
5527
|
class ne extends Error {
|
|
5524
5528
|
constructor(e, t, i, n) {
|
|
5525
5529
|
super(e), this.retryable = t, this.status = i, this.retryAfterMs = n, this.name = "ProductAgentTokenProviderError";
|
|
@@ -5528,11 +5532,11 @@ class ne extends Error {
|
|
|
5528
5532
|
status;
|
|
5529
5533
|
retryAfterMs;
|
|
5530
5534
|
}
|
|
5531
|
-
function
|
|
5535
|
+
function la(s) {
|
|
5532
5536
|
return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
|
|
5533
5537
|
}
|
|
5534
|
-
let
|
|
5535
|
-
function
|
|
5538
|
+
let da = 0;
|
|
5539
|
+
function ri(s) {
|
|
5536
5540
|
const e = {};
|
|
5537
5541
|
for (const c of [
|
|
5538
5542
|
"type",
|
|
@@ -5610,7 +5614,7 @@ function Qe(s, e, t) {
|
|
|
5610
5614
|
source: "web_sdk",
|
|
5611
5615
|
category: s,
|
|
5612
5616
|
name: e,
|
|
5613
|
-
sequence: ++
|
|
5617
|
+
sequence: ++da,
|
|
5614
5618
|
wallTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5615
5619
|
monotonicMs: performance.now(),
|
|
5616
5620
|
data: t
|
|
@@ -5619,27 +5623,27 @@ function Qe(s, e, t) {
|
|
|
5619
5623
|
}
|
|
5620
5624
|
class Ge extends Error {
|
|
5621
5625
|
}
|
|
5622
|
-
function
|
|
5626
|
+
function ua(s) {
|
|
5623
5627
|
return s === 408 || s === 425 || s === 429 || s >= 500;
|
|
5624
5628
|
}
|
|
5625
|
-
const
|
|
5629
|
+
const ha = "https://app.pluno.ai", pa = 2e4, fa = 1e4, ga = 6e4, ya = 6e4, ma = 1e4, Ia = 1e4, Sa = 3e3, wa = 3e4, ba = 1e3, os = 3e4, oi = 0.2, va = 6e4, ai = 15e3, Nt = 6e4, Je = 3, Ta = 8, _a = "Browser connection was interrupted.", ci = 15e3, li = "Pluno could not send this message. Try it again.", Ra = "Still connecting to Pluno. Retrying automatically.", di = 2e3, Aa = 1e3, ka = 100, ui = 3, Ma = [300, 1e3], fn = 50 * 1024 * 1024, Ea = /* @__PURE__ */ new Set([
|
|
5626
5630
|
".jpeg:image/jpeg",
|
|
5627
5631
|
".jpg:image/jpeg",
|
|
5628
5632
|
".pdf:application/pdf",
|
|
5629
5633
|
".png:image/png",
|
|
5630
5634
|
".webp:image/webp"
|
|
5631
|
-
]),
|
|
5632
|
-
function
|
|
5635
|
+
]), Ql = ".pdf,.png,.jpg,.jpeg,.webp", Rs = 64e3, Lt = 4e3, As = 30, Ca = 2e3, Pa = 1e3, gn = "Image is too large for model vision input.", Da = 100, Ua = 20, yn = "pluno.productAgent.state.", as = "pluno.productAgent.pendingEvents.", mn = "pluno.productAgent.pendingDeliveryRecovery.", bt = "pluno.productAgent.activeToolCalls.", qa = 100;
|
|
5636
|
+
function Oa(s, e = 0) {
|
|
5633
5637
|
const t = s === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (s - 1));
|
|
5634
5638
|
return Math.max(e, t);
|
|
5635
5639
|
}
|
|
5636
5640
|
const ut = /* @__PURE__ */ new Set();
|
|
5637
5641
|
let Xe = null;
|
|
5638
|
-
function
|
|
5639
|
-
const t = Math.min(os,
|
|
5642
|
+
function xa(s, e = Math.random) {
|
|
5643
|
+
const t = Math.min(os, ba * 2 ** s), i = 1 - oi + e() * oi * 2;
|
|
5640
5644
|
return Math.min(os, Math.round(t * i));
|
|
5641
5645
|
}
|
|
5642
|
-
function
|
|
5646
|
+
function Ba(s) {
|
|
5643
5647
|
const e = s.split(".")[1];
|
|
5644
5648
|
if (!e)
|
|
5645
5649
|
return null;
|
|
@@ -5650,7 +5654,7 @@ function xa(s) {
|
|
|
5650
5654
|
return null;
|
|
5651
5655
|
}
|
|
5652
5656
|
}
|
|
5653
|
-
function
|
|
5657
|
+
function hi(s) {
|
|
5654
5658
|
if (s instanceof ne)
|
|
5655
5659
|
return s.retryable;
|
|
5656
5660
|
if (s && typeof s == "object") {
|
|
@@ -5677,7 +5681,7 @@ class vt {
|
|
|
5677
5681
|
this.options = e, this.transportIdentity = t, this.directoryAuthority = {
|
|
5678
5682
|
authorityId: `${e.clientId}:${e.runtimeCommunityId ?? e.productVariant}`,
|
|
5679
5683
|
generation: 1
|
|
5680
|
-
}, this.directoryHttp = new
|
|
5684
|
+
}, this.directoryHttp = new Xi({
|
|
5681
5685
|
backendUrl: e.backendUrl,
|
|
5682
5686
|
auth: {
|
|
5683
5687
|
protocol: 1,
|
|
@@ -5692,7 +5696,7 @@ class vt {
|
|
|
5692
5696
|
}
|
|
5693
5697
|
});
|
|
5694
5698
|
const i = this;
|
|
5695
|
-
this.clientRuntime = new
|
|
5699
|
+
this.clientRuntime = new uo(Lr({
|
|
5696
5700
|
http: this.directoryHttp,
|
|
5697
5701
|
get authority() {
|
|
5698
5702
|
return i.directoryAuthority;
|
|
@@ -5701,10 +5705,10 @@ class vt {
|
|
|
5701
5705
|
pageUrl: () => location.href,
|
|
5702
5706
|
now: () => Date.now(),
|
|
5703
5707
|
onError: (o) => this.handleDirectoryTransportError(o)
|
|
5704
|
-
}),
|
|
5708
|
+
}), Ln(async () => {
|
|
5705
5709
|
if (!this.token || !this.state.user || this.state.status === "closed") throw new Error("Product Agent is not authenticated");
|
|
5706
|
-
return this.options.activeUsersLoader ? (await this.options.activeUsersLoader()).count :
|
|
5707
|
-
})), this.modelClientScopeId =
|
|
5710
|
+
return this.options.activeUsersLoader ? (await this.options.activeUsersLoader()).count : Fn(this.options.backendUrl);
|
|
5711
|
+
})), this.modelClientScopeId = Fo(e.clientId, () => crypto.randomUUID()), this.directoryConversationScopeId = `conversation:${this.modelClientScopeId}`, this.createDirectoryAdapters(), this.clientRuntime.engine.dispatch({
|
|
5708
5712
|
type: "model.scope_open",
|
|
5709
5713
|
clientScopeId: this.modelClientScopeId,
|
|
5710
5714
|
sessionId: null,
|
|
@@ -5713,9 +5717,9 @@ class vt {
|
|
|
5713
5717
|
selectedModel: e.model
|
|
5714
5718
|
}), this.state = {
|
|
5715
5719
|
...this.state,
|
|
5716
|
-
starterPrompts:
|
|
5720
|
+
starterPrompts: mc(e.initialStarterPrompts)
|
|
5717
5721
|
}, this.account = e.initialAccount ? { ...e.initialAccount } : null;
|
|
5718
|
-
const n = e.restorePersistedState === !1 ? null :
|
|
5722
|
+
const n = e.restorePersistedState === !1 ? null : nl(e.clientId, e.expectedPersistedSessionId);
|
|
5719
5723
|
n && (this.state = {
|
|
5720
5724
|
...this.state,
|
|
5721
5725
|
...n,
|
|
@@ -5736,16 +5740,16 @@ class vt {
|
|
|
5736
5740
|
taskStatus: null,
|
|
5737
5741
|
isRetrying: !1,
|
|
5738
5742
|
lastError: null
|
|
5739
|
-
}, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents =
|
|
5740
|
-
|
|
5741
|
-
|
|
5743
|
+
}, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents = dl(
|
|
5744
|
+
ol(e.clientId),
|
|
5745
|
+
al(e.clientId)
|
|
5742
5746
|
);
|
|
5743
5747
|
const r = [...this.queuedClientEvents].reverse().find(
|
|
5744
5748
|
(o) => o.type === "chat.user_message" && typeof o.clientMessageId == "string"
|
|
5745
5749
|
);
|
|
5746
5750
|
if (r?.clientMessageId) {
|
|
5747
5751
|
this.pendingClientMessageId = r.clientMessageId, this.pendingUserMessageEvent = r, this.state.pendingMessageStatus = "reconnecting", this.state.turnPhase = "sending";
|
|
5748
|
-
const o =
|
|
5752
|
+
const o = Di(e.clientId);
|
|
5749
5753
|
o?.clientMessageId === r.clientMessageId && (this.retryAttemptsByClientMessageId[o.clientMessageId] = o.retryAttempts, this.pendingDeliveryIssued = o.deliveryIssued, this.queuedDeliveryRetryAttempt = o.queuedRetryAttempt, o.missedResponseChecks < Je && this.startFirstResponseTimer(
|
|
5750
5754
|
o.clientMessageId,
|
|
5751
5755
|
o.submittedAt,
|
|
@@ -5799,7 +5803,7 @@ class vt {
|
|
|
5799
5803
|
accountRefresh = null;
|
|
5800
5804
|
runtimeInteractions = [];
|
|
5801
5805
|
interactionListeners = /* @__PURE__ */ new Set();
|
|
5802
|
-
interactionManager = new
|
|
5806
|
+
interactionManager = new Ko(
|
|
5803
5807
|
{ load: async () => [], save: async () => {
|
|
5804
5808
|
} },
|
|
5805
5809
|
[]
|
|
@@ -5902,17 +5906,17 @@ class vt {
|
|
|
5902
5906
|
lastErrorSecuritySettingsUrl: null
|
|
5903
5907
|
};
|
|
5904
5908
|
static async init(e) {
|
|
5905
|
-
const t = e, i = await
|
|
5909
|
+
const t = e, i = await Do(
|
|
5906
5910
|
t.skipStoredTransportIdentityCollisionCheck === !0
|
|
5907
5911
|
), n = new vt({
|
|
5908
5912
|
...e,
|
|
5909
|
-
backendUrl:
|
|
5910
|
-
clientId: e.clientId ??
|
|
5913
|
+
backendUrl: sc(e.backendUrl ?? ha),
|
|
5914
|
+
clientId: e.clientId ?? vc(),
|
|
5911
5915
|
productVariant: e.productVariant ?? "customer_embedded",
|
|
5912
|
-
entrySurface:
|
|
5916
|
+
entrySurface: ic(e.entrySurface)
|
|
5913
5917
|
}, i);
|
|
5914
5918
|
try {
|
|
5915
|
-
await n.initializeDirectory(),
|
|
5919
|
+
await n.initializeDirectory(), mo().catch((r) => {
|
|
5916
5920
|
M("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
|
|
5917
5921
|
message: r instanceof Error ? r.message : String(r)
|
|
5918
5922
|
});
|
|
@@ -5935,7 +5939,7 @@ class vt {
|
|
|
5935
5939
|
activeIntervalMs: 3e3,
|
|
5936
5940
|
idleIntervalMs: 15e3,
|
|
5937
5941
|
maxFailureIntervalMs: 3e4
|
|
5938
|
-
}), i = new
|
|
5942
|
+
}), i = new zo({
|
|
5939
5943
|
fetchPage: async (r, o) => await this.fetchSessionHistoryPageOnce(
|
|
5940
5944
|
r,
|
|
5941
5945
|
"activity",
|
|
@@ -5978,11 +5982,11 @@ class vt {
|
|
|
5978
5982
|
runtime: this.clientRuntime,
|
|
5979
5983
|
authority: this.directoryAuthority,
|
|
5980
5984
|
random: Math.random,
|
|
5981
|
-
persistence:
|
|
5985
|
+
persistence: Wr(
|
|
5982
5986
|
this.modelClientScopeId,
|
|
5983
5987
|
this.directoryAuthority.authorityId
|
|
5984
5988
|
)
|
|
5985
|
-
}), this.directoryObservation = new
|
|
5989
|
+
}), this.directoryObservation = new Fr({
|
|
5986
5990
|
runtime: this.clientRuntime,
|
|
5987
5991
|
authority: this.directoryAuthority,
|
|
5988
5992
|
http: this.directoryHttp,
|
|
@@ -6100,7 +6104,7 @@ class vt {
|
|
|
6100
6104
|
return this.options.token;
|
|
6101
6105
|
if (!this.options.tokenProvider)
|
|
6102
6106
|
return this.token;
|
|
6103
|
-
const i = Date.now(), n = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs -
|
|
6107
|
+
const i = Date.now(), n = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs - ya > i;
|
|
6104
6108
|
if (!t.forceRefresh && (n || t.preferCached && this.token !== null))
|
|
6105
6109
|
return this.token;
|
|
6106
6110
|
if (this.tokenRequest && !t.forceRefresh)
|
|
@@ -6113,7 +6117,7 @@ class vt {
|
|
|
6113
6117
|
const c = new Promise((l, d) => {
|
|
6114
6118
|
a = window.setTimeout(() => {
|
|
6115
6119
|
r.abort(), d(new ne("Pluno token provider timed out", !0));
|
|
6116
|
-
},
|
|
6120
|
+
}, ga);
|
|
6117
6121
|
});
|
|
6118
6122
|
try {
|
|
6119
6123
|
const l = await Promise.race([
|
|
@@ -6124,7 +6128,7 @@ class vt {
|
|
|
6124
6128
|
throw new ne("Pluno token request was cancelled", !0);
|
|
6125
6129
|
if (!l)
|
|
6126
6130
|
throw new ne("Pluno token provider did not return a token", !1);
|
|
6127
|
-
return this.token = l, this.tokenExpiresAtMs =
|
|
6131
|
+
return this.token = l, this.tokenExpiresAtMs = Ba(l), l;
|
|
6128
6132
|
} finally {
|
|
6129
6133
|
a !== null && window.clearTimeout(a);
|
|
6130
6134
|
}
|
|
@@ -6144,7 +6148,7 @@ class vt {
|
|
|
6144
6148
|
const r = () => {
|
|
6145
6149
|
i.removeEventListener("message", o), i.removeEventListener("close", r), n();
|
|
6146
6150
|
}, o = (a) => {
|
|
6147
|
-
const c =
|
|
6151
|
+
const c = mi(a.data);
|
|
6148
6152
|
(c.type === "auth.ok" || c.type === "error") && r();
|
|
6149
6153
|
};
|
|
6150
6154
|
i.addEventListener("message", o), i.addEventListener("close", r), this.setState({ status: "reconnecting" }), i.retryReadiness();
|
|
@@ -6171,7 +6175,7 @@ class vt {
|
|
|
6171
6175
|
await this.replaceDefaultTransportCredentials(this.socket);
|
|
6172
6176
|
return;
|
|
6173
6177
|
}
|
|
6174
|
-
const i =
|
|
6178
|
+
const i = oc(this.options.backendUrl), n = this.options.webSocketFactory?.(i) ?? new N({
|
|
6175
6179
|
backendUrl: this.options.backendUrl,
|
|
6176
6180
|
entrySurface: this.options.entrySurface,
|
|
6177
6181
|
auth: {
|
|
@@ -6191,7 +6195,7 @@ class vt {
|
|
|
6191
6195
|
});
|
|
6192
6196
|
this.socket = n, this.options.webSocketFactory && (this.socketConnectTimer = window.setTimeout(() => {
|
|
6193
6197
|
this.socket === n && n.readyState === WebSocket.CONNECTING && (M("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.reportTransportDiagnostic("connect_timeout"), this.replaceTimedOutSocket(n));
|
|
6194
|
-
},
|
|
6198
|
+
}, ma)), n.addEventListener("reconnecting", () => {
|
|
6195
6199
|
this.socket === n && this.state.status !== "closed" && (this.refreshingDefaultCredentials || this.reportTransportDiagnostic("socket_closed", { closeCode: 1006, wasClean: !1 }), this.setReconnectingState());
|
|
6196
6200
|
}), n.addEventListener("open", () => {
|
|
6197
6201
|
this.socket !== n || (this.clearSocketConnectTimer(), this.directoryObservation.reconnect().catch(() => {
|
|
@@ -6206,12 +6210,12 @@ class vt {
|
|
|
6206
6210
|
pageUrl: location.href
|
|
6207
6211
|
}) : !0)) || this.options.webSocketFactory && (this.socketAuthTimer = window.setTimeout(() => {
|
|
6208
6212
|
this.socket === n && (M("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.reportTransportDiagnostic("auth_timeout"), this.replaceTimedOutSocket(n));
|
|
6209
|
-
},
|
|
6213
|
+
}, Ia));
|
|
6210
6214
|
}), n.addEventListener("message", (r) => {
|
|
6211
6215
|
if (this.socket !== n)
|
|
6212
6216
|
return;
|
|
6213
|
-
const o =
|
|
6214
|
-
if (n instanceof N && o.type === "tool.call" && !
|
|
6217
|
+
const o = mi(r.data);
|
|
6218
|
+
if (n instanceof N && o.type === "tool.call" && !gc(o)) {
|
|
6215
6219
|
this.handleServerEvent({ type: "error", message: "Invalid tool-call envelope" });
|
|
6216
6220
|
return;
|
|
6217
6221
|
}
|
|
@@ -6220,7 +6224,7 @@ class vt {
|
|
|
6220
6224
|
}), n.addEventListener("sendfailure", (r) => {
|
|
6221
6225
|
if (this.socket !== n)
|
|
6222
6226
|
return;
|
|
6223
|
-
const o =
|
|
6227
|
+
const o = yc(r?.detail?.data);
|
|
6224
6228
|
o?.type === "chat.user_message" && o.clientMessageId === this.pendingClientMessageId && !this.queuedClientEvents.some(
|
|
6225
6229
|
(a) => a.type === "chat.user_message" && a.clientMessageId === o.clientMessageId
|
|
6226
6230
|
) && (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();
|
|
@@ -6249,13 +6253,13 @@ class vt {
|
|
|
6249
6253
|
return;
|
|
6250
6254
|
}
|
|
6251
6255
|
const n = Ft(i);
|
|
6252
|
-
if (
|
|
6256
|
+
if (hi(i)) {
|
|
6253
6257
|
M("web-sdk.agent", "Pluno connection attempt failed; retrying", {
|
|
6254
6258
|
message: n.message,
|
|
6255
6259
|
reconnectAttempt: this.reconnectAttempts
|
|
6256
6260
|
}), i instanceof ne && this.reportTransportDiagnostic("auth_timeout"), this.setState({
|
|
6257
6261
|
status: "reconnecting",
|
|
6258
|
-
lastError:
|
|
6262
|
+
lastError: Ra,
|
|
6259
6263
|
lastErrorCode: "connection_failed"
|
|
6260
6264
|
}), this.emit("error", n), this.scheduleReconnect(
|
|
6261
6265
|
i instanceof ne ? i.retryAfterMs : void 0
|
|
@@ -6279,7 +6283,7 @@ class vt {
|
|
|
6279
6283
|
}
|
|
6280
6284
|
destroy() {
|
|
6281
6285
|
if (!this.clientRuntime.isDisposed) {
|
|
6282
|
-
this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(),
|
|
6286
|
+
this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), ul(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();
|
|
6283
6287
|
for (const e of Object.values(this.listeners))
|
|
6284
6288
|
e?.clear();
|
|
6285
6289
|
this.accountListeners.clear(), this.interactionListeners.clear(), this.directoryObservation.dispose(), this.directoryHttp.dispose(), this.clientRuntime.dispose();
|
|
@@ -6323,10 +6327,10 @@ class vt {
|
|
|
6323
6327
|
async sendMessage(e, t = {}) {
|
|
6324
6328
|
return this.clientRuntime.route("conversation", { legacy: async () => {
|
|
6325
6329
|
const i = e.trim(), n = t.attachments ?? [];
|
|
6326
|
-
if (this.options.productVariant === "customer_embedded" && (n.forEach(
|
|
6330
|
+
if (this.options.productVariant === "customer_embedded" && (n.forEach(Cn), n.reduce(
|
|
6327
6331
|
(b, B) => b + B.sizeBytes,
|
|
6328
6332
|
0
|
|
6329
|
-
) >
|
|
6333
|
+
) > fn))
|
|
6330
6334
|
throw new Error("Embedded attachments must total at most 50 MB per message");
|
|
6331
6335
|
let r = n.map(yt);
|
|
6332
6336
|
if (!i && r.length === 0)
|
|
@@ -6335,7 +6339,7 @@ class vt {
|
|
|
6335
6339
|
throw new Error("Wait for the current message to finish sending before sending another.");
|
|
6336
6340
|
const o = W(), a = t.clientMessageId ?? L();
|
|
6337
6341
|
this.pendingClientMessageId = a;
|
|
6338
|
-
const c =
|
|
6342
|
+
const c = $o(this.clientRuntime, this.modelClientScopeId, a), l = t.proactiveSuggestionQuestion?.trim(), d = this.stagedProactiveSuggestionQuestionMessageId ? this.state.messages.find(
|
|
6339
6343
|
(R) => R.id === this.stagedProactiveSuggestionQuestionMessageId
|
|
6340
6344
|
) ?? null : null, u = l ? {
|
|
6341
6345
|
id: `local-proactive-suggestion-question-${a}`,
|
|
@@ -6428,7 +6432,7 @@ class vt {
|
|
|
6428
6432
|
sessionId: this.state.sessionId ?? void 0,
|
|
6429
6433
|
clientMessageId: a,
|
|
6430
6434
|
initiatedBy: t.initiatedBy,
|
|
6431
|
-
invocation:
|
|
6435
|
+
invocation: nc(t.invocation ?? t.initiatedBy),
|
|
6432
6436
|
entrySurface: this.options.entrySurface,
|
|
6433
6437
|
content: i,
|
|
6434
6438
|
proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
|
|
@@ -6437,7 +6441,7 @@ class vt {
|
|
|
6437
6441
|
page: o,
|
|
6438
6442
|
model: c,
|
|
6439
6443
|
metadata: {
|
|
6440
|
-
...
|
|
6444
|
+
...pi(this.options.metadata),
|
|
6441
6445
|
...t.automationOnboarding ? { automationOnboarding: !0 } : {}
|
|
6442
6446
|
}
|
|
6443
6447
|
};
|
|
@@ -6445,7 +6449,7 @@ class vt {
|
|
|
6445
6449
|
} });
|
|
6446
6450
|
}
|
|
6447
6451
|
reportResponseVisibility(e) {
|
|
6448
|
-
|
|
6452
|
+
zr(this, this.options.entrySurface, e);
|
|
6449
6453
|
}
|
|
6450
6454
|
reportInvalidStateTransition(e, t) {
|
|
6451
6455
|
this.reportHealthSignal("invalid_state_transition", {
|
|
@@ -6457,7 +6461,7 @@ class vt {
|
|
|
6457
6461
|
this.reportHealthSignal("user_visible_error", {
|
|
6458
6462
|
reason: e,
|
|
6459
6463
|
errorFingerprint: t,
|
|
6460
|
-
...i ? { displayedMessage:
|
|
6464
|
+
...i ? { displayedMessage: rn(i) } : {}
|
|
6461
6465
|
});
|
|
6462
6466
|
}
|
|
6463
6467
|
getModel() {
|
|
@@ -6488,7 +6492,7 @@ class vt {
|
|
|
6488
6492
|
} });
|
|
6489
6493
|
}
|
|
6490
6494
|
createLocalAttachment(e) {
|
|
6491
|
-
this.options.productVariant === "customer_embedded" &&
|
|
6495
|
+
this.options.productVariant === "customer_embedded" && hl(e);
|
|
6492
6496
|
const t = L(), i = {
|
|
6493
6497
|
id: t,
|
|
6494
6498
|
name: e.name || "attachment",
|
|
@@ -6497,7 +6501,7 @@ class vt {
|
|
|
6497
6501
|
};
|
|
6498
6502
|
this.attachmentFiles.set(t, e);
|
|
6499
6503
|
const n = Date.now();
|
|
6500
|
-
return
|
|
6504
|
+
return go({
|
|
6501
6505
|
attachmentId: t,
|
|
6502
6506
|
name: i.name,
|
|
6503
6507
|
mimeType: i.mimeType,
|
|
@@ -6537,7 +6541,7 @@ class vt {
|
|
|
6537
6541
|
sizeBytes: e.size,
|
|
6538
6542
|
page: W(),
|
|
6539
6543
|
model: xe(this.clientRuntime, this.modelClientScopeId).selectedModel,
|
|
6540
|
-
metadata:
|
|
6544
|
+
metadata: pi(this.options.metadata),
|
|
6541
6545
|
entrySurface: this.options.entrySurface
|
|
6542
6546
|
};
|
|
6543
6547
|
let a;
|
|
@@ -6562,8 +6566,8 @@ class vt {
|
|
|
6562
6566
|
return d;
|
|
6563
6567
|
}, "Failed to upload attachment"), a = l;
|
|
6564
6568
|
}
|
|
6565
|
-
const c =
|
|
6566
|
-
return i && this.cancelledSubmissions.has(i) || (this.setState({ sessionId: a.sessionId }), this.updateAttachmentInState(t.id, c), t.id &&
|
|
6569
|
+
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 && yo(t.id, {
|
|
6567
6571
|
sessionId: a.sessionId,
|
|
6568
6572
|
fileUrl: c.fileUrl,
|
|
6569
6573
|
sandboxPath: c.sandboxPath,
|
|
@@ -6594,7 +6598,7 @@ class vt {
|
|
|
6594
6598
|
const i = await this.fetchEmbedAttachmentUpload(e, !1);
|
|
6595
6599
|
if (i.ok)
|
|
6596
6600
|
return await i.json();
|
|
6597
|
-
if (
|
|
6601
|
+
if (El(i.status) && this.options.tokenProvider && !t) {
|
|
6598
6602
|
t = !0;
|
|
6599
6603
|
const n = await this.fetchEmbedAttachmentUpload(e, !0);
|
|
6600
6604
|
if (n.ok)
|
|
@@ -6616,7 +6620,7 @@ class vt {
|
|
|
6616
6620
|
});
|
|
6617
6621
|
}
|
|
6618
6622
|
getStopClientMessageId() {
|
|
6619
|
-
return
|
|
6623
|
+
return Mi(
|
|
6620
6624
|
this.state.messages,
|
|
6621
6625
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
6622
6626
|
this.state.assistantDraftRunId,
|
|
@@ -6631,7 +6635,7 @@ class vt {
|
|
|
6631
6635
|
this.queuedClientEvents = this.queuedClientEvents.filter((n) => !("clientMessageId" in n && typeof n.clientMessageId == "string" && this.cancelledSubmissions.has(n.clientMessageId))), $(this.options.clientId, this.queuedClientEvents);
|
|
6632
6636
|
const e = this.getStopClientMessageId();
|
|
6633
6637
|
this.state.sessionId && e && this.send({ type: "run.stop", sessionId: this.state.sessionId, expectedUserMessageId: e, reason: "user_requested" });
|
|
6634
|
-
const t = this.pendingClientMessageId, i =
|
|
6638
|
+
const t = this.pendingClientMessageId, i = Mi(
|
|
6635
6639
|
this.state.messages,
|
|
6636
6640
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
6637
6641
|
this.state.assistantDraftRunId,
|
|
@@ -6656,9 +6660,9 @@ class vt {
|
|
|
6656
6660
|
}), this.stoppedTurns.splice(0, Math.max(0, this.stoppedTurns.length - 20));
|
|
6657
6661
|
for (const [n, r] of this.activeBrowserToolCalls)
|
|
6658
6662
|
r.event.sessionId === this.state.sessionId && this.activeBrowserToolCalls.delete(n);
|
|
6659
|
-
|
|
6663
|
+
Ui(this.options.clientId, this.activeBrowserToolCalls.values()), this.setState(Vt({
|
|
6660
6664
|
...this.state,
|
|
6661
|
-
messages:
|
|
6665
|
+
messages: Ei(
|
|
6662
6666
|
this.state.messages,
|
|
6663
6667
|
i.clientMessageId,
|
|
6664
6668
|
i.runId
|
|
@@ -6736,7 +6740,7 @@ class vt {
|
|
|
6736
6740
|
isPinned: !1
|
|
6737
6741
|
}]),
|
|
6738
6742
|
...o.filter((u) => !a.has(u)).map((u) => [u, this.toSessionHistoryEntry(e.entities[u])])
|
|
6739
|
-
]), d =
|
|
6743
|
+
]), d = Br(n);
|
|
6740
6744
|
return {
|
|
6741
6745
|
key: `${this.options.clientId}:recent`,
|
|
6742
6746
|
status: d?.status ?? "not_requested",
|
|
@@ -6773,7 +6777,7 @@ class vt {
|
|
|
6773
6777
|
sessionId: e,
|
|
6774
6778
|
requestId: i,
|
|
6775
6779
|
patch: { pinned: t }
|
|
6776
|
-
}), await
|
|
6780
|
+
}), await Ls({
|
|
6777
6781
|
runtime: this.clientRuntime,
|
|
6778
6782
|
authority: this.directoryAuthority,
|
|
6779
6783
|
sessionId: e,
|
|
@@ -6793,7 +6797,7 @@ class vt {
|
|
|
6793
6797
|
sessionId: e,
|
|
6794
6798
|
requestId: i,
|
|
6795
6799
|
patch: { title: t }
|
|
6796
|
-
}), await
|
|
6800
|
+
}), await Ls({
|
|
6797
6801
|
runtime: this.clientRuntime,
|
|
6798
6802
|
authority: this.directoryAuthority,
|
|
6799
6803
|
sessionId: e,
|
|
@@ -6841,7 +6845,7 @@ class vt {
|
|
|
6841
6845
|
throw new Error("This interaction is no longer available.");
|
|
6842
6846
|
if (!r.allowedActions.includes(t))
|
|
6843
6847
|
throw new Error("This action is not available for the interaction.");
|
|
6844
|
-
if (
|
|
6848
|
+
if (la(t) && await this.interactionManager.act(
|
|
6845
6849
|
{
|
|
6846
6850
|
key: r.id,
|
|
6847
6851
|
category: r.category,
|
|
@@ -6880,7 +6884,7 @@ class vt {
|
|
|
6880
6884
|
this.tabGroupsPermissionNeeded = (await e.getState()).permissionNeeded;
|
|
6881
6885
|
} catch {
|
|
6882
6886
|
}
|
|
6883
|
-
for (const t of
|
|
6887
|
+
for (const t of Bi(this.state.messages)) {
|
|
6884
6888
|
if (!this.options.runtimeAdapters?.integrationAuthStatusLoader) break;
|
|
6885
6889
|
const i = this.integrationAuthStatusByRequestId.get(t.authRequestId);
|
|
6886
6890
|
if (!(i !== void 0 && i !== "pending")) {
|
|
@@ -6896,7 +6900,7 @@ class vt {
|
|
|
6896
6900
|
this.rebuildRuntimeInteractions();
|
|
6897
6901
|
}
|
|
6898
6902
|
rebuildRuntimeInteractions() {
|
|
6899
|
-
const e = [], t = this.options.productVariant === "personal" && (this.options.entrySurface === "main_web_chat" || this.options.entrySurface === "automation") ?
|
|
6903
|
+
const e = [], t = this.options.productVariant === "personal" && (this.options.entrySurface === "main_web_chat" || this.options.entrySurface === "automation") ? bo(this.state.messages) : null;
|
|
6900
6904
|
if (t) {
|
|
6901
6905
|
const n = {
|
|
6902
6906
|
key: t.id,
|
|
@@ -6924,7 +6928,7 @@ class vt {
|
|
|
6924
6928
|
revision: 0
|
|
6925
6929
|
});
|
|
6926
6930
|
}
|
|
6927
|
-
for (const n of
|
|
6931
|
+
for (const n of Bi(this.state.messages)) {
|
|
6928
6932
|
if (!this.options.runtimeAdapters?.integrationAuthHandler) break;
|
|
6929
6933
|
const r = this.integrationAuthStatusByRequestId.get(n.authRequestId) ?? "pending", o = r === "completed";
|
|
6930
6934
|
e.push({
|
|
@@ -7024,7 +7028,7 @@ class vt {
|
|
|
7024
7028
|
if (Object.values(this.clientRuntime.engine.getProjection().directory.optimisticEntries).some((c) => c.id === e && c.sessionId === null)) return;
|
|
7025
7029
|
const t = L(), i = this.activeComposerWarmupId, n = this.pendingClientMessageId;
|
|
7026
7030
|
this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages);
|
|
7027
|
-
const r = this.getCachedSessionTimeline(e), o = [...r ?? []].reverse().find((c) => c.dataType === "assistant_draft" && c.steered !== !0), a =
|
|
7031
|
+
const r = this.getCachedSessionTimeline(e), o = [...r ?? []].reverse().find((c) => c.dataType === "assistant_draft" && c.steered !== !0), a = Vc(r ?? []);
|
|
7028
7032
|
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)) {
|
|
7029
7033
|
const c = this.getStopClientMessageId();
|
|
7030
7034
|
c && this.send({ type: "run.stop", sessionId: this.state.sessionId, expectedUserMessageId: c, reason: "session_switch" });
|
|
@@ -7164,7 +7168,7 @@ class vt {
|
|
|
7164
7168
|
});
|
|
7165
7169
|
if (!l.ok) {
|
|
7166
7170
|
const u = await l.text() || `History request failed (${l.status})`;
|
|
7167
|
-
throw
|
|
7171
|
+
throw ua(l.status) ? new Error(u) : new Ge(u);
|
|
7168
7172
|
}
|
|
7169
7173
|
const d = await l.json();
|
|
7170
7174
|
if (!d?.session || !Array.isArray(d.items))
|
|
@@ -7227,7 +7231,7 @@ class vt {
|
|
|
7227
7231
|
})), !0;
|
|
7228
7232
|
}
|
|
7229
7233
|
try {
|
|
7230
|
-
return t.send(JSON.stringify(e)), Qe("client_event", e.type,
|
|
7234
|
+
return t.send(JSON.stringify(e)), Qe("client_event", e.type, ri(e)), !0;
|
|
7231
7235
|
} catch (i) {
|
|
7232
7236
|
return M("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
|
|
7233
7237
|
message: i instanceof Error ? i.message : String(i),
|
|
@@ -7250,7 +7254,7 @@ class vt {
|
|
|
7250
7254
|
occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7251
7255
|
source: "web_sdk",
|
|
7252
7256
|
entrySurface: this.options.entrySurface,
|
|
7253
|
-
...e === "first_response_slow" ? { responseDiagnostics:
|
|
7257
|
+
...e === "first_response_slow" ? { responseDiagnostics: Vr(
|
|
7254
7258
|
this,
|
|
7255
7259
|
this.options.entrySurface,
|
|
7256
7260
|
this.state.sessionId,
|
|
@@ -7344,7 +7348,7 @@ class vt {
|
|
|
7344
7348
|
const e = this.pendingClientMessageId, t = e ? this.firstResponseTimersByClientMessageId.get(e) : null;
|
|
7345
7349
|
if (!e)
|
|
7346
7350
|
return;
|
|
7347
|
-
const i =
|
|
7351
|
+
const i = Di(this.options.clientId);
|
|
7348
7352
|
!t && i?.clientMessageId !== e || et(this.options.clientId, {
|
|
7349
7353
|
clientMessageId: e,
|
|
7350
7354
|
retryAttempts: this.retryAttemptsByClientMessageId[e] ?? 0,
|
|
@@ -7455,7 +7459,7 @@ class vt {
|
|
|
7455
7459
|
if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
|
|
7456
7460
|
return;
|
|
7457
7461
|
this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
|
|
7458
|
-
const e =
|
|
7462
|
+
const e = ac();
|
|
7459
7463
|
this.sendNow(
|
|
7460
7464
|
V({
|
|
7461
7465
|
type: "starter_prompts.page_context",
|
|
@@ -7466,13 +7470,13 @@ class vt {
|
|
|
7466
7470
|
) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
|
|
7467
7471
|
}
|
|
7468
7472
|
startStarterPromptUrlWatcher() {
|
|
7469
|
-
this.locationChangeCleanup || (this.locationChangeCleanup =
|
|
7473
|
+
this.locationChangeCleanup || (this.locationChangeCleanup = cc(() => this.handleStarterPromptUrlChange()));
|
|
7470
7474
|
}
|
|
7471
7475
|
handleStarterPromptUrlChange() {
|
|
7472
7476
|
const e = location.href;
|
|
7473
7477
|
e !== this.lastStarterPromptPageUrl && (this.activeComposerWarmupScope && !this.activeComposerWarmupScope.endsWith(`:${e}`) && this.clearPendingComposerWarmup(), this.lastStarterPromptPageUrl = e, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
|
|
7474
7478
|
this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
|
|
7475
|
-
},
|
|
7479
|
+
}, qa));
|
|
7476
7480
|
}
|
|
7477
7481
|
refreshStarterPromptsForCurrentUrl() {
|
|
7478
7482
|
this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
|
|
@@ -7501,7 +7505,7 @@ class vt {
|
|
|
7501
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();
|
|
7502
7506
|
}
|
|
7503
7507
|
applyAuthenticatedDirectoryIdentity(e) {
|
|
7504
|
-
const t =
|
|
7508
|
+
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));
|
|
7505
7509
|
if (n) {
|
|
7506
7510
|
const r = this.directoryAuthority;
|
|
7507
7511
|
this.directoryObservation.dispose(), this.directoryAuthority = { ...r, generation: r.generation + 1 }, this.clientRuntime.engine.dispatch({
|
|
@@ -7516,7 +7520,7 @@ class vt {
|
|
|
7516
7520
|
}
|
|
7517
7521
|
rememberSessionTimeline(e, t) {
|
|
7518
7522
|
const i = [...t];
|
|
7519
|
-
for (this.sessionTimelineCache.delete(e), this.sessionTimelineCache.set(e, i); this.sessionTimelineCache.size >
|
|
7523
|
+
for (this.sessionTimelineCache.delete(e), this.sessionTimelineCache.set(e, i); this.sessionTimelineCache.size > Ua; ) {
|
|
7520
7524
|
const n = this.sessionTimelineCache.keys().next().value;
|
|
7521
7525
|
if (!n)
|
|
7522
7526
|
break;
|
|
@@ -7546,8 +7550,8 @@ class vt {
|
|
|
7546
7550
|
return;
|
|
7547
7551
|
this.clearPendingWarmupAckTimer();
|
|
7548
7552
|
const t = Math.min(
|
|
7549
|
-
|
|
7550
|
-
|
|
7553
|
+
Sa * 2 ** e.retryAttempt,
|
|
7554
|
+
wa
|
|
7551
7555
|
);
|
|
7552
7556
|
e.retryAttempt += 1, this.pendingWarmupAckTimer = window.setTimeout(() => {
|
|
7553
7557
|
this.pendingWarmupAckTimer = null, this.flushPendingComposerWarmup();
|
|
@@ -7570,7 +7574,7 @@ class vt {
|
|
|
7570
7574
|
const i = q(t);
|
|
7571
7575
|
if (!e || !i || !Oe(i) || this.findStoppedTurn(e, i))
|
|
7572
7576
|
return;
|
|
7573
|
-
const n =
|
|
7577
|
+
const n = j(i), r = E(i), o = typeof i.clientMessageId == "string" ? i.clientMessageId : n ? this.clientMessageIdsByUserMessageItemId.get(n) ?? null : null;
|
|
7574
7578
|
this.stoppedTurns.push({
|
|
7575
7579
|
sessionId: e,
|
|
7576
7580
|
clientMessageId: o,
|
|
@@ -7591,7 +7595,7 @@ class vt {
|
|
|
7591
7595
|
if (!e || !t)
|
|
7592
7596
|
return;
|
|
7593
7597
|
const i = this.findStoppedTurn(e, t);
|
|
7594
|
-
!i || i.reason !== "task_tab_closed" ||
|
|
7598
|
+
!i || i.reason !== "task_tab_closed" || Wo(i, t) && (this.stoppedTurns.splice(this.stoppedTurns.indexOf(i), 1), i.stoppedItemId && this.setState({
|
|
7595
7599
|
messages: this.state.messages.filter((n) => n.id !== i.stoppedItemId)
|
|
7596
7600
|
}));
|
|
7597
7601
|
}
|
|
@@ -7619,7 +7623,7 @@ class vt {
|
|
|
7619
7623
|
});
|
|
7620
7624
|
}
|
|
7621
7625
|
handleServerEvent(e) {
|
|
7622
|
-
if (Qe("server_event", e.type,
|
|
7626
|
+
if (Qe("server_event", e.type, ri(e)), e.type === "session.subscribed") {
|
|
7623
7627
|
const c = typeof e.requestId == "string" ? e.requestId : null, l = typeof e.sessionId == "string" ? e.sessionId : null;
|
|
7624
7628
|
if (c && l && c === this.pendingSessionSubscription?.requestId && l === this.pendingSessionSubscription.sessionId) {
|
|
7625
7629
|
const d = this.pendingSessionSubscription;
|
|
@@ -7692,7 +7696,7 @@ class vt {
|
|
|
7692
7696
|
const l = J(e), d = typeof e.clientMessageId == "string" ? e.clientMessageId : null, u = l ? this.deferredDetachedSessionEvents.get(l) ?? [] : [];
|
|
7693
7697
|
l && this.deferredDetachedSessionEvents.delete(l);
|
|
7694
7698
|
const h = !!(l && d && this.backgroundClientMessageIds.delete(d));
|
|
7695
|
-
l && h ? (this.backgroundSessionIds.add(l), this.deferredSessionUpdatedSessionIds.delete(l)) : l && (d === this.activeClientMessageId || d === this.pendingClientMessageId) && this.deferredSessionUpdatedSessionIds.delete(l) && this.state.sessionId === null && this.setState({ sessionId: l }), e.type === "run.ack" && l && d && l === this.state.sessionId &&
|
|
7699
|
+
l && h ? (this.backgroundSessionIds.add(l), this.deferredSessionUpdatedSessionIds.delete(l)) : l && (d === this.activeClientMessageId || d === this.pendingClientMessageId) && this.deferredSessionUpdatedSessionIds.delete(l) && this.state.sessionId === null && this.setState({ sessionId: l }), e.type === "run.ack" && l && d && l === this.state.sessionId && ln(
|
|
7696
7700
|
this.clientRuntime,
|
|
7697
7701
|
this.modelClientScopeId,
|
|
7698
7702
|
l,
|
|
@@ -7723,7 +7727,7 @@ class vt {
|
|
|
7723
7727
|
active: !1
|
|
7724
7728
|
}), this.socket instanceof N && this.socket.synchronizeReferences()), t)
|
|
7725
7729
|
return;
|
|
7726
|
-
const n =
|
|
7730
|
+
const n = fi(e), r = this.pendingClientMessageId, o = n ? this.getResponseEvidenceClientMessageId(e) : null, a = n ? this.promotePendingDeliveryFromResponseEvidence(e) : !1;
|
|
7727
7731
|
if (n) {
|
|
7728
7732
|
const c = a ? r : o === this.activeClientMessageId ? this.activeClientMessageId : r === null ? this.activeClientMessageId : null;
|
|
7729
7733
|
this.clearFirstResponseTimer(c, !0);
|
|
@@ -7743,20 +7747,20 @@ class vt {
|
|
|
7743
7747
|
this.activeResponseRunId = c, this.setState({ turnPhase: "thinking", lastError: null }), this.markThinkingProgress();
|
|
7744
7748
|
return;
|
|
7745
7749
|
}
|
|
7746
|
-
if (
|
|
7750
|
+
if (Fa(e) && this.markThinkingProgress(), e.type === "auth.ok") {
|
|
7747
7751
|
this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.transportDiagnosticEpisodes.clear();
|
|
7748
|
-
const c =
|
|
7752
|
+
const c = wi(e.user);
|
|
7749
7753
|
this.applyAuthenticatedDirectoryIdentity(e.user), this.authenticatedSocket = this.socket, this.directoryObservation.reconnect().catch(() => {
|
|
7750
7754
|
}), this.flushPendingWidgetLifecycleEvents(), this.flushPendingComposerWarmup(), this.pendingClientMessageId && this.state.sessionId && this.pendingDeliveryIssued ? (this.requestPendingDeliveryReconciliation(), this.pendingDeliveryRetryTimer = window.setTimeout(() => {
|
|
7751
7755
|
this.pendingDeliveryRetryTimer = null, this.pendingDeliveryReconciliationRequestId = null, this.flushQueuedClientEvents();
|
|
7752
|
-
},
|
|
7753
|
-
const l =
|
|
7756
|
+
}, di)) : this.flushQueuedClientEvents(), this.flushPendingPassiveWarmup(), this.startHeartbeat();
|
|
7757
|
+
const l = Ic(e), d = Object.prototype.hasOwnProperty.call(e, "appearance");
|
|
7754
7758
|
M("web-sdk.agent", "Received auth.ok appearance", {
|
|
7755
7759
|
hasAppearance: d,
|
|
7756
7760
|
rawAppearance: e.appearance,
|
|
7757
7761
|
normalizedAppearance: l
|
|
7758
|
-
}), this.runtimeHelperJavascript =
|
|
7759
|
-
const u =
|
|
7762
|
+
}), this.runtimeHelperJavascript = Sc(e.runtimeHelpers)?.javascript ?? null;
|
|
7763
|
+
const u = Ii(e, "starterPrompts"), h = Object.prototype.hasOwnProperty.call(e, "starterPrompts"), p = e.starterPromptsLoading === !0, f = {
|
|
7760
7764
|
user: c,
|
|
7761
7765
|
status: "connected",
|
|
7762
7766
|
...this.state.lastErrorCode === "connection_failed" ? { lastError: null, lastErrorCode: null } : {}
|
|
@@ -7765,7 +7769,7 @@ class vt {
|
|
|
7765
7769
|
type: "runtime.auth_ack",
|
|
7766
7770
|
connectionAttempt: this.connectionAttemptId,
|
|
7767
7771
|
entrySurface: this.options.entrySurface
|
|
7768
|
-
}), h && u.length === 0 && !p && !
|
|
7772
|
+
}), h && u.length === 0 && !p && !Ht() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
|
|
7769
7773
|
type: "page.upsert",
|
|
7770
7774
|
sessionId: this.state.sessionId,
|
|
7771
7775
|
page: W(),
|
|
@@ -7775,21 +7779,21 @@ class vt {
|
|
|
7775
7779
|
}
|
|
7776
7780
|
if (e.type === "starterPrompts.updated") {
|
|
7777
7781
|
this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0, this.setState({
|
|
7778
|
-
starterPrompts:
|
|
7782
|
+
starterPrompts: Ii(e, "starterPrompts"),
|
|
7779
7783
|
starterPromptsLoading: !1
|
|
7780
7784
|
});
|
|
7781
7785
|
return;
|
|
7782
7786
|
}
|
|
7783
7787
|
if (e.type === "scheduled_follow_ups.updated") {
|
|
7784
7788
|
typeof e.sessionId == "string" && e.sessionId === this.state.sessionId && this.setState({
|
|
7785
|
-
activeScheduledFollowUps:
|
|
7789
|
+
activeScheduledFollowUps: Si(
|
|
7786
7790
|
e.activeScheduledFollowUps
|
|
7787
7791
|
)
|
|
7788
7792
|
});
|
|
7789
7793
|
return;
|
|
7790
7794
|
}
|
|
7791
7795
|
if (e.type === "conversation.state") {
|
|
7792
|
-
const c = Array.isArray(e.items) ? e.items : [], l =
|
|
7796
|
+
const c = Array.isArray(e.items) ? e.items : [], l = Ys(c), d = Object.prototype.hasOwnProperty.call(
|
|
7793
7797
|
e,
|
|
7794
7798
|
"activeScheduledFollowUps"
|
|
7795
7799
|
), u = A(e.session, "id") ?? this.state.sessionId;
|
|
@@ -7800,17 +7804,17 @@ class vt {
|
|
|
7800
7804
|
this.updateAccountFallbackFromSession(e.session), this.updatePersonalModelFromSession(e.session);
|
|
7801
7805
|
const g = A(e.session, "id");
|
|
7802
7806
|
g && Ot(this.clientRuntime, this.modelClientScopeId, g, e.turns), u === this.state.sessionId && !p && this.clearSessionLoadRequest();
|
|
7803
|
-
for (const
|
|
7804
|
-
this.forgetSupersededTaskTabClosedTurn(u, q(
|
|
7805
|
-
for (const
|
|
7806
|
-
this.rememberDurablyStoppedTurn(u,
|
|
7807
|
+
for (const H of l)
|
|
7808
|
+
this.forgetSupersededTaskTabClosedTurn(u, q(H));
|
|
7809
|
+
for (const H of l)
|
|
7810
|
+
this.rememberDurablyStoppedTurn(u, H);
|
|
7807
7811
|
const I = Ie(l), w = I === null ? null : l[I], y = q(w), m = this.findStoppedTurn(u, {
|
|
7808
7812
|
clientMessageId: y?.clientMessageId,
|
|
7809
7813
|
respondsToUserMessageId: A(w, "id"),
|
|
7810
7814
|
runId: y?.runId
|
|
7811
7815
|
}), 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;
|
|
7812
7816
|
P && D && (this.pendingClientMessageId = D);
|
|
7813
|
-
let b =
|
|
7817
|
+
let b = Ec(
|
|
7814
7818
|
e.assistantDraft
|
|
7815
7819
|
);
|
|
7816
7820
|
b && this.findStoppedTurn(u, {
|
|
@@ -7819,33 +7823,33 @@ class vt {
|
|
|
7819
7823
|
}) && (b = void 0);
|
|
7820
7824
|
const B = b !== void 0;
|
|
7821
7825
|
this.rememberUserMessageClientMessageIds(S);
|
|
7822
|
-
const se = Hc(S),
|
|
7823
|
-
const K = q(
|
|
7824
|
-
return
|
|
7826
|
+
const se = Hc(S), je = S.filter((H) => {
|
|
7827
|
+
const K = q(H);
|
|
7828
|
+
return Fc(K) ? !1 : !K || !se || !Ne(K) ? !0 : us(S, K) !== se;
|
|
7825
7829
|
}), be = cs(
|
|
7826
7830
|
this.state.messages,
|
|
7827
|
-
Wt(
|
|
7828
|
-
), ue = zt(be), he = B ? b?.content ?? "" : this.state.assistantDraft, ve = B ? b?.itemId ?? null : this.state.assistantDraftItemId,
|
|
7829
|
-
(
|
|
7830
|
-
q(
|
|
7831
|
+
Wt(je, this.options.backendUrl)
|
|
7832
|
+
), ue = zt(be), he = B ? b?.content ?? "" : this.state.assistantDraft, ve = B ? b?.itemId ?? null : this.state.assistantDraftItemId, He = B ? b?.respondsToUserMessageId ?? null : this.state.assistantDraftRespondsToUserMessageId, $e = B ? b?.runId ?? null : this.state.assistantDraftRunId, pe = S.some(
|
|
7833
|
+
(H, K) => Ai(
|
|
7834
|
+
q(H),
|
|
7831
7835
|
he,
|
|
7832
7836
|
ve,
|
|
7833
|
-
|
|
7837
|
+
He,
|
|
7834
7838
|
$e,
|
|
7835
|
-
|
|
7839
|
+
$c(S, K)
|
|
7836
7840
|
)
|
|
7837
7841
|
), Te = B ? b?.content ?? "" : this.state.assistantDraft, _e = !!b?.content && !pe;
|
|
7838
7842
|
this.promotePendingDeliveryFromSnapshotResponseEvidence(S, u);
|
|
7839
|
-
const Z = ue && (!Te || pe), ae =
|
|
7840
|
-
if (!ue &&
|
|
7843
|
+
const Z = ue && (!Te || pe), ae = Nc(be), Re = Z && ae ? "completed" : m ? "stopped" : Z ? "failed" : null;
|
|
7844
|
+
if (!ue && jc(this.state.messages, S))
|
|
7841
7845
|
return;
|
|
7842
|
-
this.lastUserMessagePageUrl =
|
|
7846
|
+
this.lastUserMessagePageUrl = Lc(S);
|
|
7843
7847
|
const ce = Z || m ? null : ds(S);
|
|
7844
7848
|
if (this.latestRecoverableClientMessageId = ce, ae && this.clearRetryTimers(), this.setState({
|
|
7845
7849
|
sessionId: A(e.session, "id") ?? this.state.sessionId,
|
|
7846
7850
|
messages: be,
|
|
7847
7851
|
...d ? {
|
|
7848
|
-
activeScheduledFollowUps:
|
|
7852
|
+
activeScheduledFollowUps: Si(
|
|
7849
7853
|
e.activeScheduledFollowUps
|
|
7850
7854
|
)
|
|
7851
7855
|
} : {},
|
|
@@ -7893,7 +7897,7 @@ class vt {
|
|
|
7893
7897
|
else if (!m && (_e || ce)) {
|
|
7894
7898
|
if (ce) {
|
|
7895
7899
|
this.activeClientMessageId = ce;
|
|
7896
|
-
const
|
|
7900
|
+
const H = Ie(S), K = H === null ? null : S[H];
|
|
7897
7901
|
this.activeResponseUserMessageId = A(K, "id");
|
|
7898
7902
|
}
|
|
7899
7903
|
this.markThinkingProgress();
|
|
@@ -7912,7 +7916,7 @@ class vt {
|
|
|
7912
7916
|
this.options.backendUrl
|
|
7913
7917
|
);
|
|
7914
7918
|
c === this.sessionActivityRequestId && (this.sessionActivityRequestId = null), this.setState({
|
|
7915
|
-
messages:
|
|
7919
|
+
messages: Uc(this.state.messages, d)
|
|
7916
7920
|
});
|
|
7917
7921
|
return;
|
|
7918
7922
|
}
|
|
@@ -7943,21 +7947,21 @@ class vt {
|
|
|
7943
7947
|
const c = q(e.item);
|
|
7944
7948
|
if (Ne(c)) {
|
|
7945
7949
|
typeof c?.runId == "string" && this.retryableFailureRunIdsAwaitingDone.add(c.runId);
|
|
7946
|
-
const d = c ?
|
|
7950
|
+
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);
|
|
7947
7951
|
h && (this.retryableClientMessageId = h);
|
|
7948
7952
|
return;
|
|
7949
7953
|
}
|
|
7950
7954
|
const l = ft(e.item, this.options.backendUrl);
|
|
7951
7955
|
if (l) {
|
|
7952
|
-
const d =
|
|
7953
|
-
l.callId && u !== void 0 && (l.loading = u, this.pendingToolLoadingByCallId.delete(l.callId)), X(l) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()),
|
|
7954
|
-
const h = Oe(c) ? this.state.messages.filter((y) => !(y.id.startsWith("local-interrupted:") && y.respondsToUserMessageId === l.respondsToUserMessageId)) : this.state.messages, p = qe(h, l), f = zt(p), g =
|
|
7956
|
+
const d = Gc(c, l), u = l.callId ? this.pendingToolLoadingByCallId.get(l.callId) : void 0;
|
|
7957
|
+
l.callId && u !== void 0 && (l.loading = u, this.pendingToolLoadingByCallId.delete(l.callId)), X(l) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), zc(c) && this.clearRunAckResyncRetryTimer();
|
|
7958
|
+
const h = Oe(c) ? this.state.messages.filter((y) => !(y.id.startsWith("local-interrupted:") && y.respondsToUserMessageId === l.respondsToUserMessageId)) : this.state.messages, p = qe(h, l), f = zt(p), g = Ai(
|
|
7955
7959
|
c,
|
|
7956
7960
|
this.state.assistantDraft,
|
|
7957
7961
|
this.state.assistantDraftItemId,
|
|
7958
7962
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
7959
7963
|
this.state.assistantDraftRunId,
|
|
7960
|
-
|
|
7964
|
+
Rn(
|
|
7961
7965
|
p,
|
|
7962
7966
|
p.findIndex((y) => y.id === l.id)
|
|
7963
7967
|
)
|
|
@@ -8019,7 +8023,7 @@ class vt {
|
|
|
8019
8023
|
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;
|
|
8020
8024
|
if (!(l && this.state.assistantDraftRespondsToUserMessageId ? l === this.state.assistantDraftRespondsToUserMessageId : !d || !this.state.assistantDraftRunId || d === this.state.assistantDraftRunId))
|
|
8021
8025
|
return;
|
|
8022
|
-
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 =
|
|
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 = Xs(
|
|
8023
8027
|
this.state.messages.filter(
|
|
8024
8028
|
(g) => g.dataType !== "assistant_draft" || !Ze(
|
|
8025
8029
|
g,
|
|
@@ -8033,7 +8037,7 @@ class vt {
|
|
|
8033
8037
|
);
|
|
8034
8038
|
this.setState({
|
|
8035
8039
|
sessionId: c,
|
|
8036
|
-
messages:
|
|
8040
|
+
messages: vi(
|
|
8037
8041
|
f,
|
|
8038
8042
|
typeof e.responseId == "string" ? e.responseId : null,
|
|
8039
8043
|
l,
|
|
@@ -8056,9 +8060,9 @@ class vt {
|
|
|
8056
8060
|
if (c)
|
|
8057
8061
|
this.nonTranscriptToolCallIds.add(c);
|
|
8058
8062
|
else {
|
|
8059
|
-
const l =
|
|
8063
|
+
const l = Ri(e);
|
|
8060
8064
|
if (l) {
|
|
8061
|
-
const d =
|
|
8065
|
+
const d = Ti(
|
|
8062
8066
|
this.state.messages,
|
|
8063
8067
|
l
|
|
8064
8068
|
);
|
|
@@ -8120,7 +8124,7 @@ class vt {
|
|
|
8120
8124
|
}
|
|
8121
8125
|
if (e.requestType === "chat.user_message" && d && d === this.pendingClientMessageId) {
|
|
8122
8126
|
this.failPendingDelivery(d), this.setState({
|
|
8123
|
-
lastError: typeof e.message == "string" ? e.message :
|
|
8127
|
+
lastError: typeof e.message == "string" ? e.message : li,
|
|
8124
8128
|
lastErrorCode: typeof e.code == "string" ? e.code : "message_delivery_failed"
|
|
8125
8129
|
});
|
|
8126
8130
|
return;
|
|
@@ -8135,13 +8139,13 @@ class vt {
|
|
|
8135
8139
|
return;
|
|
8136
8140
|
}
|
|
8137
8141
|
u && l && d && (this.retryableClientMessageId = d);
|
|
8138
|
-
const h = new Error(typeof e.message == "string" ? e.message : "Pluno error"), p =
|
|
8142
|
+
const h = new Error(typeof e.message == "string" ? e.message : "Pluno error"), p = rc(h.message);
|
|
8139
8143
|
p && console.error(p);
|
|
8140
|
-
const f = d ?? this.activeClientMessageId, g = typeof e.runId == "string" ? e.runId : null, I =
|
|
8144
|
+
const f = d ?? this.activeClientMessageId, g = typeof e.runId == "string" ? e.runId : null, I = Ei(
|
|
8141
8145
|
this.state.messages,
|
|
8142
8146
|
f,
|
|
8143
8147
|
g
|
|
8144
|
-
), w =
|
|
8148
|
+
), w = Bc(
|
|
8145
8149
|
I,
|
|
8146
8150
|
f,
|
|
8147
8151
|
g
|
|
@@ -8170,7 +8174,7 @@ class vt {
|
|
|
8170
8174
|
}
|
|
8171
8175
|
applyAccountSubmissionError(e) {
|
|
8172
8176
|
if (!this.account || !e) return;
|
|
8173
|
-
const t =
|
|
8177
|
+
const t = Jo(this.account.submissionGate, e);
|
|
8174
8178
|
if (!(t === this.account.submissionGate || t.allowed)) {
|
|
8175
8179
|
this.account = {
|
|
8176
8180
|
...this.account,
|
|
@@ -8192,7 +8196,7 @@ class vt {
|
|
|
8192
8196
|
});
|
|
8193
8197
|
}
|
|
8194
8198
|
updateAccountFallbackFromSession(e) {
|
|
8195
|
-
const t = e && typeof e == "object" ? e.metadata : null, i =
|
|
8199
|
+
const t = e && typeof e == "object" ? e.metadata : null, i = Xo(t);
|
|
8196
8200
|
if (this.usingPaidCreditFallback !== i && (this.usingPaidCreditFallback = i, !!this.account)) {
|
|
8197
8201
|
this.account = { ...this.account, usingPaidCreditFallback: i };
|
|
8198
8202
|
for (const n of this.accountListeners) n(this.getAccount());
|
|
@@ -8212,7 +8216,7 @@ class vt {
|
|
|
8212
8216
|
return;
|
|
8213
8217
|
const i = this.sessionTimelineCache.get(t);
|
|
8214
8218
|
if (e.type === "conversation.state") {
|
|
8215
|
-
const n =
|
|
8219
|
+
const n = Ys(
|
|
8216
8220
|
Array.isArray(e.items) ? e.items : []
|
|
8217
8221
|
), r = Wt(
|
|
8218
8222
|
this.filterStoppedSnapshotItems(n, t),
|
|
@@ -8234,10 +8238,10 @@ class vt {
|
|
|
8234
8238
|
return;
|
|
8235
8239
|
}
|
|
8236
8240
|
if (e.type === "tool.call") {
|
|
8237
|
-
const n = e.hiddenFromTranscript === !0 ? null :
|
|
8241
|
+
const n = e.hiddenFromTranscript === !0 ? null : Ri(e);
|
|
8238
8242
|
n && this.rememberSessionTimeline(
|
|
8239
8243
|
t,
|
|
8240
|
-
|
|
8244
|
+
Ti(i, n)
|
|
8241
8245
|
);
|
|
8242
8246
|
return;
|
|
8243
8247
|
}
|
|
@@ -8249,7 +8253,7 @@ class vt {
|
|
|
8249
8253
|
return;
|
|
8250
8254
|
this.rememberSessionTimeline(
|
|
8251
8255
|
t,
|
|
8252
|
-
|
|
8256
|
+
_i(
|
|
8253
8257
|
i,
|
|
8254
8258
|
e.callId,
|
|
8255
8259
|
n
|
|
@@ -8276,7 +8280,7 @@ class vt {
|
|
|
8276
8280
|
return;
|
|
8277
8281
|
}
|
|
8278
8282
|
if (e.type === "chat.assistant_done") {
|
|
8279
|
-
const n = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : null, r = typeof e.runId == "string" ? e.runId : null, o =
|
|
8283
|
+
const n = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : null, r = typeof e.runId == "string" ? e.runId : null, o = Xs(
|
|
8280
8284
|
i.filter(
|
|
8281
8285
|
(a) => a.dataType !== "assistant_draft" || !Ze(a, n, r)
|
|
8282
8286
|
),
|
|
@@ -8286,7 +8290,7 @@ class vt {
|
|
|
8286
8290
|
);
|
|
8287
8291
|
this.rememberSessionTimeline(
|
|
8288
8292
|
t,
|
|
8289
|
-
|
|
8293
|
+
vi(
|
|
8290
8294
|
o,
|
|
8291
8295
|
typeof e.responseId == "string" ? e.responseId : null,
|
|
8292
8296
|
n,
|
|
@@ -8301,7 +8305,7 @@ class vt {
|
|
|
8301
8305
|
return;
|
|
8302
8306
|
this.rememberSessionTimeline(
|
|
8303
8307
|
t,
|
|
8304
|
-
|
|
8308
|
+
Ci(
|
|
8305
8309
|
i,
|
|
8306
8310
|
n,
|
|
8307
8311
|
null,
|
|
@@ -8310,9 +8314,9 @@ class vt {
|
|
|
8310
8314
|
);
|
|
8311
8315
|
return;
|
|
8312
8316
|
}
|
|
8313
|
-
e.type === "error" && typeof e.requestId != "string" && !
|
|
8317
|
+
e.type === "error" && typeof e.requestId != "string" && !ki(e, t) && this.rememberSessionTimeline(
|
|
8314
8318
|
t,
|
|
8315
|
-
|
|
8319
|
+
Qc(i, e)
|
|
8316
8320
|
);
|
|
8317
8321
|
}
|
|
8318
8322
|
}
|
|
@@ -8346,9 +8350,9 @@ class vt {
|
|
|
8346
8350
|
}
|
|
8347
8351
|
handleRetryableRecoveryError(e) {
|
|
8348
8352
|
const t = typeof e.sessionId == "string" ? e.sessionId : this.state.sessionId, i = typeof e.clientMessageId == "string" ? e.clientMessageId : null;
|
|
8349
|
-
if (!
|
|
8353
|
+
if (!ki(e, t) || !i)
|
|
8350
8354
|
return !1;
|
|
8351
|
-
if (
|
|
8355
|
+
if (Ht())
|
|
8352
8356
|
return this.retryableClientMessageId = i, this.activeClientMessageId = i, this.latestRecoverableClientMessageId = i, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), !0;
|
|
8353
8357
|
if (this.activeClientMessageId = i, this.latestRecoverableClientMessageId = i, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), this.retryTimersByClientMessageId[i] === void 0) {
|
|
8354
8358
|
const n = typeof e.retryAfterMs == "number" ? e.retryAfterMs : 2e3;
|
|
@@ -8379,7 +8383,7 @@ class vt {
|
|
|
8379
8383
|
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);
|
|
8380
8384
|
}
|
|
8381
8385
|
markThinkingProgress() {
|
|
8382
|
-
!this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(
|
|
8386
|
+
!this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(va), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
|
|
8383
8387
|
}
|
|
8384
8388
|
scheduleThinkingWatchdog(e) {
|
|
8385
8389
|
this.thinkingWatchdogTimer !== null && window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = window.setTimeout(() => {
|
|
@@ -8453,7 +8457,7 @@ class vt {
|
|
|
8453
8457
|
if (t)
|
|
8454
8458
|
return t;
|
|
8455
8459
|
const i = e.type === "session.item" ? q(e.item) : null;
|
|
8456
|
-
return i ?
|
|
8460
|
+
return i ? j(i) : null;
|
|
8457
8461
|
}
|
|
8458
8462
|
getResponseEvidenceClientMessageId(e) {
|
|
8459
8463
|
const t = this.getResponseEvidenceUserMessageId(e);
|
|
@@ -8463,8 +8467,8 @@ class vt {
|
|
|
8463
8467
|
const i = this.pendingClientMessageId;
|
|
8464
8468
|
if (i)
|
|
8465
8469
|
for (const n of e) {
|
|
8466
|
-
const r = q(n), o = r ?
|
|
8467
|
-
if (!(!r || !o || this.clientMessageIdsByUserMessageItemId.get(o) !== i || !
|
|
8470
|
+
const r = q(n), o = r ? j(r) : null;
|
|
8471
|
+
if (!(!r || !o || this.clientMessageIdsByUserMessageItemId.get(o) !== i || !fi({ type: "session.item", item: n }))) {
|
|
8468
8472
|
this.promotePendingDelivery(
|
|
8469
8473
|
i,
|
|
8470
8474
|
t,
|
|
@@ -8485,15 +8489,15 @@ class vt {
|
|
|
8485
8489
|
return this.pendingClientMessageId === e && this.state.isThinking && this.activeClientMessageId !== null && this.activeClientMessageId !== e;
|
|
8486
8490
|
}
|
|
8487
8491
|
schedulePendingDeliveryAck(e) {
|
|
8488
|
-
this.clearPendingDeliveryTimers(), !
|
|
8492
|
+
this.clearPendingDeliveryTimers(), !Ht() && (this.pendingDeliveryAckTimer = window.setTimeout(() => {
|
|
8489
8493
|
this.pendingDeliveryAckTimer = null, this.retryPendingDelivery(e);
|
|
8490
|
-
},
|
|
8494
|
+
}, ci));
|
|
8491
8495
|
}
|
|
8492
8496
|
retryPendingDelivery(e) {
|
|
8493
8497
|
if (this.state.status === "closed" || this.pendingClientMessageId !== e || this.state.pendingMessageStatus === null || !this.pendingUserMessageEvent)
|
|
8494
8498
|
return;
|
|
8495
8499
|
const t = this.retryAttemptsByClientMessageId[e] ?? 0;
|
|
8496
|
-
if (t >=
|
|
8500
|
+
if (t >= Ta) {
|
|
8497
8501
|
this.failPendingDelivery(e);
|
|
8498
8502
|
return;
|
|
8499
8503
|
}
|
|
@@ -8506,7 +8510,7 @@ class vt {
|
|
|
8506
8510
|
return;
|
|
8507
8511
|
}
|
|
8508
8512
|
this.retryAttemptsByClientMessageId[e] = i, this.pendingDeliveryIssued = !0, this.queuedDeliveryRetryAttempt = null, this.persistCurrentPendingDeliveryRecovery(), this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(e);
|
|
8509
|
-
},
|
|
8513
|
+
}, Oa(t, di));
|
|
8510
8514
|
}
|
|
8511
8515
|
requestPendingDeliveryReconciliation() {
|
|
8512
8516
|
if (!this.state.sessionId)
|
|
@@ -8530,7 +8534,7 @@ class vt {
|
|
|
8530
8534
|
...this.state.isThinking ? {} : { turnPhase: null },
|
|
8531
8535
|
isRetrying: !1,
|
|
8532
8536
|
...this.state.isThinking ? {} : { taskStatus: "failed" },
|
|
8533
|
-
lastError:
|
|
8537
|
+
lastError: li,
|
|
8534
8538
|
lastErrorCode: "message_delivery_failed"
|
|
8535
8539
|
});
|
|
8536
8540
|
}
|
|
@@ -8542,7 +8546,7 @@ class vt {
|
|
|
8542
8546
|
if (this.state.isThinking && t) {
|
|
8543
8547
|
const r = this.state.assistantDraftRespondsToUserMessageId !== null && this.state.assistantDraftRespondsToUserMessageId !== t;
|
|
8544
8548
|
this.setState({
|
|
8545
|
-
messages:
|
|
8549
|
+
messages: Ci(
|
|
8546
8550
|
this.state.messages,
|
|
8547
8551
|
t,
|
|
8548
8552
|
i,
|
|
@@ -8568,13 +8572,13 @@ class vt {
|
|
|
8568
8572
|
scheduleRunAckWatchdog(e) {
|
|
8569
8573
|
this.runAckWatchdogTimer !== null && window.clearTimeout(this.runAckWatchdogTimer), this.runAckWatchdogTimer = window.setTimeout(() => {
|
|
8570
8574
|
this.runAckWatchdogTimer = null, this.recoverMissedRunAck(e);
|
|
8571
|
-
},
|
|
8575
|
+
}, ci);
|
|
8572
8576
|
}
|
|
8573
8577
|
recoverMissedRunAck(e) {
|
|
8574
8578
|
!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== e || (M("web-sdk.agent", "Pluno run ack missed; resyncing session", {
|
|
8575
8579
|
sessionId: this.state.sessionId,
|
|
8576
8580
|
clientMessageId: e
|
|
8577
|
-
}), this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(
|
|
8581
|
+
}), this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(ai));
|
|
8578
8582
|
}
|
|
8579
8583
|
clearRunAckResyncRetryTimer() {
|
|
8580
8584
|
this.runAckResyncRetryTimer !== null && (window.clearTimeout(this.runAckResyncRetryTimer), this.runAckResyncRetryTimer = null);
|
|
@@ -8597,7 +8601,7 @@ class vt {
|
|
|
8597
8601
|
),
|
|
8598
8602
|
isThinking: !1,
|
|
8599
8603
|
taskStatus: "failed",
|
|
8600
|
-
lastError:
|
|
8604
|
+
lastError: _a,
|
|
8601
8605
|
lastErrorCode: "run_recovery_exhausted"
|
|
8602
8606
|
}), this.clearThinkingWatchdog();
|
|
8603
8607
|
return;
|
|
@@ -8607,7 +8611,7 @@ class vt {
|
|
|
8607
8611
|
sessionId: this.state.sessionId,
|
|
8608
8612
|
clientMessageId: e,
|
|
8609
8613
|
resyncAttempts: t + 1
|
|
8610
|
-
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(
|
|
8614
|
+
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(ai);
|
|
8611
8615
|
}
|
|
8612
8616
|
resyncThinkingSession() {
|
|
8613
8617
|
if (this.state.sessionId) {
|
|
@@ -8628,7 +8632,7 @@ class vt {
|
|
|
8628
8632
|
}
|
|
8629
8633
|
if (this.activeBrowserToolCalls.has(i)) return;
|
|
8630
8634
|
const c = n === "execute_code", l = n === "execute_code_in_browser_tab" && o !== null && typeof o == "object" && o.tabId === "local:current";
|
|
8631
|
-
if (!c && !l || !
|
|
8635
|
+
if (!c && !l || !ml(o)) {
|
|
8632
8636
|
this.setToolMessageLoading(i, !1), this.send({
|
|
8633
8637
|
type: "tool.result",
|
|
8634
8638
|
sessionId: t,
|
|
@@ -8675,9 +8679,9 @@ class vt {
|
|
|
8675
8679
|
startedAtOrigin: location.origin
|
|
8676
8680
|
}), this.installSessionBrowserApis();
|
|
8677
8681
|
let d = null, u;
|
|
8678
|
-
d = await this.executeRuntimeHelper(), u = await
|
|
8682
|
+
d = await this.executeRuntimeHelper(), u = await gi(
|
|
8679
8683
|
o,
|
|
8680
|
-
|
|
8684
|
+
ec(e.runtimeContext, this.options.backendUrl)
|
|
8681
8685
|
).catch((h) => ({
|
|
8682
8686
|
ok: !1,
|
|
8683
8687
|
exception: {
|
|
@@ -8690,11 +8694,11 @@ class vt {
|
|
|
8690
8694
|
toolName: n,
|
|
8691
8695
|
summary: o.summary,
|
|
8692
8696
|
rawInput: V(o),
|
|
8693
|
-
rawOutput: V(
|
|
8694
|
-
}),
|
|
8697
|
+
rawOutput: V(wc(u, d))
|
|
8698
|
+
}), Ui(this.options.clientId, this.activeBrowserToolCalls.values()));
|
|
8695
8699
|
}
|
|
8696
8700
|
setToolMessageLoading(e, t) {
|
|
8697
|
-
const i =
|
|
8701
|
+
const i = _i(
|
|
8698
8702
|
this.state.messages,
|
|
8699
8703
|
e,
|
|
8700
8704
|
t
|
|
@@ -8705,33 +8709,33 @@ class vt {
|
|
|
8705
8709
|
if (this.pageLifecycleCleanup)
|
|
8706
8710
|
return;
|
|
8707
8711
|
const e = () => {
|
|
8708
|
-
|
|
8712
|
+
kn(this.options.clientId, this.activeBrowserToolCalls.values());
|
|
8709
8713
|
};
|
|
8710
8714
|
window.addEventListener("pagehide", e), window.addEventListener("beforeunload", e), this.pageLifecycleCleanup = () => {
|
|
8711
8715
|
window.removeEventListener("pagehide", e), window.removeEventListener("beforeunload", e);
|
|
8712
8716
|
};
|
|
8713
8717
|
}
|
|
8714
8718
|
installSessionBrowserApis() {
|
|
8715
|
-
this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup =
|
|
8719
|
+
this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = Wa();
|
|
8716
8720
|
}
|
|
8717
8721
|
cleanupSessionBrowserApis() {
|
|
8718
|
-
this.sessionBrowserApisCleanup && (
|
|
8722
|
+
this.sessionBrowserApisCleanup && (Ya(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
|
|
8719
8723
|
}
|
|
8720
8724
|
async executeRuntimeHelper() {
|
|
8721
8725
|
if (!this.runtimeHelperJavascript?.trim())
|
|
8722
8726
|
return null;
|
|
8723
|
-
const e = await
|
|
8727
|
+
const e = await gi({
|
|
8724
8728
|
javascript: this.runtimeHelperJavascript
|
|
8725
8729
|
});
|
|
8726
|
-
return e.ok === !1 ?
|
|
8730
|
+
return e.ok === !1 ? bc(e) : null;
|
|
8727
8731
|
}
|
|
8728
8732
|
enableNetworkCapture() {
|
|
8729
|
-
this.networkCaptureCleanup || (this.networkCaptureCleanup =
|
|
8730
|
-
|
|
8733
|
+
this.networkCaptureCleanup || (this.networkCaptureCleanup = Na((e) => {
|
|
8734
|
+
Tl(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
|
|
8731
8735
|
}));
|
|
8732
8736
|
}
|
|
8733
8737
|
enqueueNetworkEvent(e) {
|
|
8734
|
-
this.queuedNetworkEvents.length >=
|
|
8738
|
+
this.queuedNetworkEvents.length >= ka || (this.queuedNetworkEvents.push(vl(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
|
|
8735
8739
|
this.networkBatchTimer = null;
|
|
8736
8740
|
const t = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
|
|
8737
8741
|
t.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
|
|
@@ -8740,14 +8744,14 @@ class vt {
|
|
|
8740
8744
|
page: W(),
|
|
8741
8745
|
events: t
|
|
8742
8746
|
});
|
|
8743
|
-
},
|
|
8747
|
+
}, Aa)));
|
|
8744
8748
|
}
|
|
8745
8749
|
scheduleReconnect(e = 0) {
|
|
8746
8750
|
if (this.reconnectTimer !== null || this.state.status === "closed")
|
|
8747
8751
|
return;
|
|
8748
8752
|
const t = Math.min(
|
|
8749
8753
|
os,
|
|
8750
|
-
Math.max(
|
|
8754
|
+
Math.max(xa(this.reconnectAttempts), e)
|
|
8751
8755
|
);
|
|
8752
8756
|
this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
|
|
8753
8757
|
this.reconnectTimer = null, (this.refreshingDefaultCredentials && this.socket instanceof N ? this.refreshDefaultTransportCredentials(this.socket) : this.connect()).catch((n) => {
|
|
@@ -8790,7 +8794,7 @@ class vt {
|
|
|
8790
8794
|
this.handleDirectoryTransportError(t);
|
|
8791
8795
|
return;
|
|
8792
8796
|
}
|
|
8793
|
-
if (!
|
|
8797
|
+
if (!hi(t)) {
|
|
8794
8798
|
const i = Ft(t);
|
|
8795
8799
|
this.socket = null, e.close(), this.refreshingDefaultCredentials = !1, this.setState({ status: "error", lastError: i.message, lastErrorCode: "connection_failed" }), this.emit("error", i);
|
|
8796
8800
|
return;
|
|
@@ -8805,8 +8809,8 @@ class vt {
|
|
|
8805
8809
|
const e = this.socket;
|
|
8806
8810
|
!e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
|
|
8807
8811
|
this.socket === e && (M("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
|
|
8808
|
-
},
|
|
8809
|
-
},
|
|
8812
|
+
}, fa));
|
|
8813
|
+
}, pa));
|
|
8810
8814
|
}
|
|
8811
8815
|
stopHeartbeat() {
|
|
8812
8816
|
this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
|
|
@@ -8844,7 +8848,7 @@ class vt {
|
|
|
8844
8848
|
...e.lastError === null && e.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
|
|
8845
8849
|
...e.lastError !== void 0 && e.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
|
|
8846
8850
|
}, a = this.state.sessionId, c = this.state.isThinking || this.state.pendingMessageStatus !== null, l = o.isThinking || o.pendingMessageStatus !== null, d = this.activeClientMessageId ?? this.pendingClientMessageId;
|
|
8847
|
-
d && d === this.lastProjectedTurnClientMessageId && l &&
|
|
8851
|
+
d && d === this.lastProjectedTurnClientMessageId && l && ja(this.lastProjectedTurnPhase, o.turnPhase) && this.reportHealthSignal("invalid_state_transition", {
|
|
8848
8852
|
clientMessageId: d,
|
|
8849
8853
|
reason: "active_turn_phase_moved_backward",
|
|
8850
8854
|
previousPhase: this.lastProjectedTurnPhase,
|
|
@@ -8855,7 +8859,7 @@ class vt {
|
|
|
8855
8859
|
sessionId: o.sessionId,
|
|
8856
8860
|
active: l
|
|
8857
8861
|
}), this.directoryObservation.focus().catch(() => {
|
|
8858
|
-
})), this.rebuildRuntimeInteractions(), e.messages !== void 0 && this.refreshRuntimeInteractions(), this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages),
|
|
8862
|
+
})), this.rebuildRuntimeInteractions(), e.messages !== void 0 && this.refreshRuntimeInteractions(), this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages), rl(this.options.clientId, this.state), this.emit("state", this.getState()), Qe("state", this.state.status, {
|
|
8859
8863
|
status: this.state.status,
|
|
8860
8864
|
sessionId: this.state.sessionId,
|
|
8861
8865
|
messageCount: this.state.messages.length,
|
|
@@ -8905,14 +8909,14 @@ class vt {
|
|
|
8905
8909
|
this.listeners[e]?.forEach((n) => n(t));
|
|
8906
8910
|
}
|
|
8907
8911
|
}
|
|
8908
|
-
const
|
|
8909
|
-
function
|
|
8910
|
-
const e = window.__plunoProductAgentNetworkCapture ??
|
|
8912
|
+
const jt = /* @__PURE__ */ new WeakMap();
|
|
8913
|
+
function Na(s) {
|
|
8914
|
+
const e = window.__plunoProductAgentNetworkCapture ?? La();
|
|
8911
8915
|
return e.subscribers.add(s), () => {
|
|
8912
8916
|
e.subscribers.delete(s), !(e.subscribers.size > 0) && (e.destroy(), window.__plunoProductAgentNetworkCapture === e && delete window.__plunoProductAgentNetworkCapture);
|
|
8913
8917
|
};
|
|
8914
8918
|
}
|
|
8915
|
-
function
|
|
8919
|
+
function La() {
|
|
8916
8920
|
const s = /* @__PURE__ */ new Set(), e = (h) => {
|
|
8917
8921
|
s.forEach((p) => {
|
|
8918
8922
|
try {
|
|
@@ -8929,20 +8933,20 @@ function Na() {
|
|
|
8929
8933
|
throw w;
|
|
8930
8934
|
}
|
|
8931
8935
|
try {
|
|
8932
|
-
const w = p instanceof Request ? p : null, y =
|
|
8936
|
+
const w = p instanceof Request ? p : null, y = Il(p, w), m = Pn(f?.headers ?? w?.headers);
|
|
8933
8937
|
if (!fe(y, m, f?.body)) {
|
|
8934
8938
|
const P = {
|
|
8935
8939
|
requestId: Kt("fetch"),
|
|
8936
8940
|
url: ee(y, Lt),
|
|
8937
8941
|
method: (f?.method ?? w?.method ?? "GET").toUpperCase(),
|
|
8938
8942
|
requestHeaders: m,
|
|
8939
|
-
requestBody:
|
|
8943
|
+
requestBody: Oi(f?.body),
|
|
8940
8944
|
resourceType: "fetch",
|
|
8941
8945
|
startedAt: new Date(g).toISOString()
|
|
8942
8946
|
};
|
|
8943
8947
|
I.then(
|
|
8944
8948
|
(D) => {
|
|
8945
|
-
|
|
8949
|
+
Sl(D, P, g, e).catch(() => {
|
|
8946
8950
|
e({
|
|
8947
8951
|
...P,
|
|
8948
8952
|
responseStatus: D.status,
|
|
@@ -8964,7 +8968,7 @@ function Na() {
|
|
|
8964
8968
|
return I;
|
|
8965
8969
|
}, a = function(p, f, g, I, w) {
|
|
8966
8970
|
const y = i.call(this, p, f, g ?? !0, I ?? void 0, w ?? void 0), m = typeof f == "string" ? f : f.toString();
|
|
8967
|
-
return
|
|
8971
|
+
return jt.set(this, {
|
|
8968
8972
|
requestId: Kt("xhr"),
|
|
8969
8973
|
method: String(p ?? "GET").toUpperCase(),
|
|
8970
8974
|
url: ee(m, Lt),
|
|
@@ -8974,17 +8978,17 @@ function Na() {
|
|
|
8974
8978
|
excluded: fe(m)
|
|
8975
8979
|
}), y;
|
|
8976
8980
|
}, c = function(p, f) {
|
|
8977
|
-
const g = n.call(this, p, f), I =
|
|
8981
|
+
const g = n.call(this, p, f), I = jt.get(this);
|
|
8978
8982
|
return I && Object.keys(I.requestHeaders).length < As && (I.requestHeaders[p] = Cs(p, f), I.excluded = I.excluded || fe(I.url, I.requestHeaders)), g;
|
|
8979
8983
|
}, l = function(p) {
|
|
8980
8984
|
try {
|
|
8981
|
-
const f =
|
|
8982
|
-
f && (f.excluded = f.excluded || fe(f.url, f.requestHeaders, p), f.requestBody =
|
|
8985
|
+
const f = jt.get(this);
|
|
8986
|
+
f && (f.excluded = f.excluded || fe(f.url, f.requestHeaders, p), f.requestBody = Oi(p), f.excluded || this.addEventListener(
|
|
8983
8987
|
"loadend",
|
|
8984
8988
|
() => {
|
|
8985
8989
|
queueMicrotask(() => {
|
|
8986
8990
|
try {
|
|
8987
|
-
const g =
|
|
8991
|
+
const g = Rl(this.getAllResponseHeaders());
|
|
8988
8992
|
e({
|
|
8989
8993
|
requestId: f.requestId,
|
|
8990
8994
|
url: f.url,
|
|
@@ -8994,7 +8998,7 @@ function Na() {
|
|
|
8994
8998
|
resourceType: "xhr",
|
|
8995
8999
|
responseStatus: this.status,
|
|
8996
9000
|
responseHeaders: g,
|
|
8997
|
-
responseBody:
|
|
9001
|
+
responseBody: bl(this, g),
|
|
8998
9002
|
errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
|
|
8999
9003
|
startedAt: f.startedAt,
|
|
9000
9004
|
durationMs: Date.now() - f.startedAtMs
|
|
@@ -9086,14 +9090,14 @@ function M(s, e, t) {
|
|
|
9086
9090
|
}, r = i.__plunoProductAgentDiagnostics__ ?? [];
|
|
9087
9091
|
r.push(n), r.length > 120 && r.splice(0, r.length - 120), i.__plunoProductAgentDiagnostics__ = r, i.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(new CustomEvent("product-agent:preview-diagnostic", { detail: n }));
|
|
9088
9092
|
}
|
|
9089
|
-
function
|
|
9093
|
+
function pi(s) {
|
|
9090
9094
|
const e = typeof s == "function" ? s() : s;
|
|
9091
9095
|
return e && Object.keys(e).length > 0 ? e : void 0;
|
|
9092
9096
|
}
|
|
9093
|
-
function
|
|
9097
|
+
function Fa(s) {
|
|
9094
9098
|
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";
|
|
9095
9099
|
}
|
|
9096
|
-
function
|
|
9100
|
+
function fi(s) {
|
|
9097
9101
|
if (s.type === "chat.assistant_delta")
|
|
9098
9102
|
return typeof s.delta == "string" && s.delta.trim().length > 0;
|
|
9099
9103
|
if (s.type === "tool.call")
|
|
@@ -9103,7 +9107,7 @@ function pi(s) {
|
|
|
9103
9107
|
const e = q(s.item);
|
|
9104
9108
|
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;
|
|
9105
9109
|
}
|
|
9106
|
-
function
|
|
9110
|
+
function ja(s, e) {
|
|
9107
9111
|
if (!s || !e)
|
|
9108
9112
|
return !1;
|
|
9109
9113
|
const t = {
|
|
@@ -9131,31 +9135,31 @@ function J(s) {
|
|
|
9131
9135
|
}
|
|
9132
9136
|
return null;
|
|
9133
9137
|
}
|
|
9134
|
-
const Ha = 5e3,
|
|
9135
|
-
function
|
|
9138
|
+
const Ha = 5e3, $a = 12e4;
|
|
9139
|
+
function Wa() {
|
|
9136
9140
|
const s = [
|
|
9137
|
-
|
|
9138
|
-
|
|
9141
|
+
Ka(),
|
|
9142
|
+
za()
|
|
9139
9143
|
].filter((e) => typeof e == "function");
|
|
9140
9144
|
return () => {
|
|
9141
9145
|
for (const e of s.reverse())
|
|
9142
9146
|
e();
|
|
9143
9147
|
};
|
|
9144
9148
|
}
|
|
9145
|
-
function Wa() {
|
|
9146
|
-
return rn(globalThis, "getPageSnapshot", async () => ks());
|
|
9147
|
-
}
|
|
9148
9149
|
function za() {
|
|
9149
|
-
return
|
|
9150
|
-
|
|
9150
|
+
return on(globalThis, "getPageSnapshot", async () => ks());
|
|
9151
|
+
}
|
|
9152
|
+
function Ka() {
|
|
9153
|
+
return on(globalThis, "pageImages", {
|
|
9154
|
+
inspectImage: async (e, t) => await Va(e, t)
|
|
9151
9155
|
});
|
|
9152
9156
|
}
|
|
9153
|
-
async function
|
|
9154
|
-
const t =
|
|
9157
|
+
async function Va(s, e = {}) {
|
|
9158
|
+
const t = Xa(e.name), i = await Qa(s);
|
|
9155
9159
|
return i.ok ? i.sizeBytes > 8 * 1024 * 1024 ? {
|
|
9156
9160
|
type: "pluno.pageImages.inspectImage",
|
|
9157
9161
|
imageAttached: !1,
|
|
9158
|
-
imageAttachmentError:
|
|
9162
|
+
imageAttachmentError: gn
|
|
9159
9163
|
} : {
|
|
9160
9164
|
type: "pluno.pageImages.inspectImage",
|
|
9161
9165
|
imageAttached: !0,
|
|
@@ -9169,15 +9173,15 @@ async function Ka(s, e = {}) {
|
|
|
9169
9173
|
imageAttachmentError: i.error
|
|
9170
9174
|
};
|
|
9171
9175
|
}
|
|
9172
|
-
async function
|
|
9173
|
-
return s instanceof Blob ? s.type.startsWith("image/") ? s.size === 0 ? { ok: !1, error: "Page image is empty." } : s.size > 8 * 1024 * 1024 ? { ok: !1, error:
|
|
9176
|
+
async function Qa(s) {
|
|
9177
|
+
return s instanceof Blob ? s.type.startsWith("image/") ? s.size === 0 ? { ok: !1, error: "Page image is empty." } : s.size > 8 * 1024 * 1024 ? { ok: !1, error: gn } : {
|
|
9174
9178
|
ok: !0,
|
|
9175
9179
|
mimeType: s.type,
|
|
9176
9180
|
sizeBytes: s.size,
|
|
9177
|
-
dataUrl: await
|
|
9178
|
-
} : { 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." } :
|
|
9181
|
+
dataUrl: await Za(s)
|
|
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." } : Ga(s);
|
|
9179
9183
|
}
|
|
9180
|
-
function
|
|
9184
|
+
function Ga(s) {
|
|
9181
9185
|
if (!s.startsWith("data:") || !s.includes(","))
|
|
9182
9186
|
return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
|
|
9183
9187
|
const [e, t] = s.slice(5).split(",", 2), i = e.split(";").map((a) => a.trim()).filter(Boolean), n = i[0] ?? "";
|
|
@@ -9188,7 +9192,7 @@ function Qa(s) {
|
|
|
9188
9192
|
const r = t.replace(/[ \t\r\n\f]+/g, "");
|
|
9189
9193
|
if (!/^[A-Za-z0-9+/]*={0,2}$/.test(r))
|
|
9190
9194
|
return { ok: !1, error: "Page image data URL has invalid base64." };
|
|
9191
|
-
const o =
|
|
9195
|
+
const o = Ja(r);
|
|
9192
9196
|
return o === null ? { ok: !1, error: "Page image data URL has invalid base64." } : o === 0 ? { ok: !1, error: "Page image is empty." } : {
|
|
9193
9197
|
ok: !0,
|
|
9194
9198
|
mimeType: n,
|
|
@@ -9196,22 +9200,22 @@ function Qa(s) {
|
|
|
9196
9200
|
dataUrl: `data:${n};base64,${r}`
|
|
9197
9201
|
};
|
|
9198
9202
|
}
|
|
9199
|
-
function
|
|
9203
|
+
function Ja(s) {
|
|
9200
9204
|
if (s.length === 0 || s.length % 4 !== 0)
|
|
9201
9205
|
return null;
|
|
9202
9206
|
const e = s.length - s.replace(/=+$/, "").length;
|
|
9203
9207
|
return e > 2 ? null : s.length / 4 * 3 - e;
|
|
9204
9208
|
}
|
|
9205
|
-
function
|
|
9209
|
+
function Xa(s) {
|
|
9206
9210
|
return (typeof s == "string" ? s.trim() : "") || "Page image";
|
|
9207
9211
|
}
|
|
9208
|
-
function
|
|
9212
|
+
function Ya(s) {
|
|
9209
9213
|
try {
|
|
9210
9214
|
s();
|
|
9211
9215
|
} catch {
|
|
9212
9216
|
}
|
|
9213
9217
|
}
|
|
9214
|
-
function
|
|
9218
|
+
function Za(s) {
|
|
9215
9219
|
return new Promise((e, t) => {
|
|
9216
9220
|
const i = new FileReader();
|
|
9217
9221
|
i.onload = () => {
|
|
@@ -9223,7 +9227,7 @@ function Ya(s) {
|
|
|
9223
9227
|
}, i.onerror = () => t(i.error ?? new Error("Failed to read page image")), i.readAsDataURL(s);
|
|
9224
9228
|
});
|
|
9225
9229
|
}
|
|
9226
|
-
async function
|
|
9230
|
+
async function gi(s, e) {
|
|
9227
9231
|
const t = Object.getPrototypeOf(async function() {
|
|
9228
9232
|
}).constructor, i = s.timeoutMs ?? Ha, n = Date.now(), r = [];
|
|
9229
9233
|
let o;
|
|
@@ -9243,7 +9247,7 @@ async function fi(s, e) {
|
|
|
9243
9247
|
o = window.setTimeout(() => u(l), i);
|
|
9244
9248
|
})
|
|
9245
9249
|
]);
|
|
9246
|
-
return d === l ?
|
|
9250
|
+
return d === l ? tc(i) : {
|
|
9247
9251
|
ok: !0,
|
|
9248
9252
|
result: d,
|
|
9249
9253
|
console: r,
|
|
@@ -9272,7 +9276,7 @@ async function fi(s, e) {
|
|
|
9272
9276
|
e?.deactivate(), o !== void 0 && window.clearTimeout(o), console.log = a.log, console.info = a.info, console.warn = a.warn, console.error = a.error;
|
|
9273
9277
|
}
|
|
9274
9278
|
}
|
|
9275
|
-
function
|
|
9279
|
+
function ec(s, e) {
|
|
9276
9280
|
if (!s || typeof s != "object")
|
|
9277
9281
|
return;
|
|
9278
9282
|
const t = s.sandboxFilesToken;
|
|
@@ -9282,7 +9286,7 @@ function Za(s, e) {
|
|
|
9282
9286
|
const n = () => {
|
|
9283
9287
|
if (!i)
|
|
9284
9288
|
throw new Error("sandboxFiles is only available during browser-code execution");
|
|
9285
|
-
}, r = async (a, c) => await
|
|
9289
|
+
}, r = async (a, c) => await na(`${e.replace(/\/$/, "")}${a}`, c);
|
|
9286
9290
|
return {
|
|
9287
9291
|
value: Object.freeze({
|
|
9288
9292
|
upload: async (a) => {
|
|
@@ -9316,7 +9320,7 @@ function Za(s, e) {
|
|
|
9316
9320
|
}
|
|
9317
9321
|
};
|
|
9318
9322
|
}
|
|
9319
|
-
function
|
|
9323
|
+
function tc(s) {
|
|
9320
9324
|
return {
|
|
9321
9325
|
ok: !1,
|
|
9322
9326
|
exception: {
|
|
@@ -9330,10 +9334,10 @@ function ec(s) {
|
|
|
9330
9334
|
}
|
|
9331
9335
|
};
|
|
9332
9336
|
}
|
|
9333
|
-
function
|
|
9337
|
+
function sc(s) {
|
|
9334
9338
|
return s.replace(/\/+$/, "");
|
|
9335
9339
|
}
|
|
9336
|
-
function
|
|
9340
|
+
function ic(s) {
|
|
9337
9341
|
const e = {
|
|
9338
9342
|
sidepanel: "extension_sidepanel",
|
|
9339
9343
|
browser_extension_page_ui: "extension_widget",
|
|
@@ -9345,18 +9349,18 @@ function sc(s) {
|
|
|
9345
9349
|
};
|
|
9346
9350
|
return s && s in e ? e[s] : s ?? "embedded_custom_ui";
|
|
9347
9351
|
}
|
|
9348
|
-
function
|
|
9352
|
+
function nc(s) {
|
|
9349
9353
|
return s === "pluno" ? "scheduled_continuation" : s ?? "user";
|
|
9350
9354
|
}
|
|
9351
|
-
function
|
|
9355
|
+
function rc(s, e = location.origin) {
|
|
9352
9356
|
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;
|
|
9353
9357
|
}
|
|
9354
|
-
function
|
|
9358
|
+
function oc(s) {
|
|
9355
9359
|
const e = new URL("/api/product-agent/embed/ws", s);
|
|
9356
9360
|
return e.protocol = e.protocol === "https:" ? "wss:" : "ws:", e.toString();
|
|
9357
9361
|
}
|
|
9358
9362
|
function W() {
|
|
9359
|
-
const s =
|
|
9363
|
+
const s = bn();
|
|
9360
9364
|
return {
|
|
9361
9365
|
url: location.href,
|
|
9362
9366
|
title: document.title,
|
|
@@ -9364,19 +9368,19 @@ function W() {
|
|
|
9364
9368
|
...s ? { plunoProductAgentUi: s } : {}
|
|
9365
9369
|
};
|
|
9366
9370
|
}
|
|
9367
|
-
function
|
|
9371
|
+
function ac() {
|
|
9368
9372
|
return {
|
|
9369
9373
|
pageUrl: location.href,
|
|
9370
9374
|
pageTitle: document.title,
|
|
9371
9375
|
htmlContent: ks()
|
|
9372
9376
|
};
|
|
9373
9377
|
}
|
|
9374
|
-
function
|
|
9375
|
-
return ut.add(s), Xe || (Xe =
|
|
9378
|
+
function cc(s) {
|
|
9379
|
+
return ut.add(s), Xe || (Xe = lc()), () => {
|
|
9376
9380
|
ut.delete(s), ut.size === 0 && (Xe?.(), Xe = null);
|
|
9377
9381
|
};
|
|
9378
9382
|
}
|
|
9379
|
-
function
|
|
9383
|
+
function lc() {
|
|
9380
9384
|
const s = () => {
|
|
9381
9385
|
for (const r of Array.from(ut))
|
|
9382
9386
|
r();
|
|
@@ -9391,8 +9395,8 @@ function cc() {
|
|
|
9391
9395
|
window.history.pushState === i && (window.history.pushState = e), window.history.replaceState === n && (window.history.replaceState = t), window.removeEventListener("popstate", s), window.removeEventListener("hashchange", s);
|
|
9392
9396
|
};
|
|
9393
9397
|
}
|
|
9394
|
-
function
|
|
9395
|
-
return
|
|
9398
|
+
function Ht() {
|
|
9399
|
+
return bn()?.surface === "browser_extension_sdk_preview";
|
|
9396
9400
|
}
|
|
9397
9401
|
function ks() {
|
|
9398
9402
|
if (!document.body)
|
|
@@ -9403,16 +9407,16 @@ function ks() {
|
|
|
9403
9407
|
};
|
|
9404
9408
|
t("Selected text", window.getSelection()?.toString() ?? "");
|
|
9405
9409
|
const i = "[role='dialog'], [role='alertdialog'], dialog[open], [aria-modal='true']", n = Array.from(document.querySelectorAll(i)).filter(
|
|
9406
|
-
(g) =>
|
|
9410
|
+
(g) => In(g) && !g.parentElement?.closest(i)
|
|
9407
9411
|
);
|
|
9408
9412
|
for (const g of n.slice(0, 3))
|
|
9409
9413
|
t("Active overlay", $t(Be(g), e));
|
|
9410
|
-
const r =
|
|
9414
|
+
const r = dc(), o = r ? $t(Be(r), e) : "";
|
|
9411
9415
|
t("Main page content", o), t("Additional visible page text", $t(Be(document.body), e));
|
|
9412
9416
|
const a = s.map(([g, I]) => `${g}:
|
|
9413
9417
|
${I}`).join(`
|
|
9414
9418
|
|
|
9415
|
-
`).trim().slice(0, 12e3), c =
|
|
9419
|
+
`).trim().slice(0, 12e3), c = uc(n, r).trim(), l = `Simplified DOM outline:
|
|
9416
9420
|
`, d = `
|
|
9417
9421
|
|
|
9418
9422
|
Visible page text:
|
|
@@ -9436,14 +9440,14 @@ function $t(s, e) {
|
|
|
9436
9440
|
t = t.replace(i, "");
|
|
9437
9441
|
return me(t);
|
|
9438
9442
|
}
|
|
9439
|
-
function
|
|
9443
|
+
function In(s) {
|
|
9440
9444
|
const e = window.getComputedStyle(s);
|
|
9441
9445
|
return e.display !== "none" && e.visibility !== "hidden" && s.getClientRects().length > 0;
|
|
9442
9446
|
}
|
|
9443
|
-
function
|
|
9444
|
-
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(
|
|
9447
|
+
function dc() {
|
|
9448
|
+
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(In).sort((s, e) => Be(e).length - Be(s).length)[0] ?? null;
|
|
9445
9449
|
}
|
|
9446
|
-
function
|
|
9450
|
+
function uc(s, e) {
|
|
9447
9451
|
const t = /* @__PURE__ */ new Set([
|
|
9448
9452
|
"main",
|
|
9449
9453
|
"nav",
|
|
@@ -9523,7 +9527,7 @@ function dc(s, e) {
|
|
|
9523
9527
|
"data-test",
|
|
9524
9528
|
"data-qa",
|
|
9525
9529
|
"data-cy"
|
|
9526
|
-
], l = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: d, priorityTargets: u } =
|
|
9530
|
+
], l = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: d, priorityTargets: u } = hc(), h = new Set(s);
|
|
9527
9531
|
e && h.add(e);
|
|
9528
9532
|
let p = 0;
|
|
9529
9533
|
const f = (m) => {
|
|
@@ -9538,15 +9542,15 @@ function dc(s, e) {
|
|
|
9538
9542
|
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")
|
|
9539
9543
|
return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
|
|
9540
9544
|
p += 1;
|
|
9541
|
-
const
|
|
9545
|
+
const je = f(k), we = wn(k), be = a.has(je) || ["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();
|
|
9542
9546
|
for (const _ of ue) {
|
|
9543
9547
|
const U = g(_);
|
|
9544
9548
|
he.set(U, (he.get(U) ?? 0) + 1);
|
|
9545
9549
|
}
|
|
9546
|
-
const ve = /* @__PURE__ */ new Map(),
|
|
9550
|
+
const ve = /* @__PURE__ */ new Map(), He = /* @__PURE__ */ new Map();
|
|
9547
9551
|
for (const _ of ue) {
|
|
9548
|
-
const U = g(_), ie =
|
|
9549
|
-
|
|
9552
|
+
const U = g(_), ie = He.get(U) ?? 0;
|
|
9553
|
+
He.set(U, ie + 1), (he.get(U) ?? 0) > 8 && ie >= 6 && !d.has(_) && ve.set(U, (ve.get(U) ?? 0) + 1);
|
|
9550
9554
|
}
|
|
9551
9555
|
const $e = /* @__PURE__ */ new Map(), pe = /* @__PURE__ */ new Set(), Te = [], _e = [];
|
|
9552
9556
|
for (const _ of ue) {
|
|
@@ -9564,10 +9568,10 @@ function dc(s, e) {
|
|
|
9564
9568
|
_ instanceof HTMLElement && Z.push(D(_, R + 1));
|
|
9565
9569
|
const ae = [..._e, ...Z], We = we.length > 0 || be || ae.some((_) => _.hasUsefulContent), Re = me(
|
|
9566
9570
|
[we, ...ae.map((_) => _.textPreview)].filter(Boolean).join(" ")
|
|
9567
|
-
).slice(0, 180), ce = k.hasAttribute("contenteditable") && (we.length > 0 || !k.querySelector("[contenteditable]")),
|
|
9571
|
+
).slice(0, 180), ce = k.hasAttribute("contenteditable") && (we.length > 0 || !k.querySelector("[contenteditable]")), H = l.some((_) => k.hasAttribute(_)) || !!je || ce, K = (k.getClientRects().length > 0 || B.display === "contents") && (t.has(b) || H || se) && (We || se) && (!n.has(b) || We || H || se), Rt = K ? 1 : 0, Ae = [];
|
|
9568
9572
|
if (K) {
|
|
9569
9573
|
const _ = ae.some((ie) => ie.containsTextElement), U = i.has(b) && !_ ? Re : we;
|
|
9570
|
-
Ae.push(
|
|
9574
|
+
Ae.push(Sn(k, c, o, U.slice(0, 180)));
|
|
9571
9575
|
}
|
|
9572
9576
|
for (const _ of Te)
|
|
9573
9577
|
Ae.push(...Ye(_, Rt));
|
|
@@ -9593,7 +9597,7 @@ function dc(s, e) {
|
|
|
9593
9597
|
`);
|
|
9594
9598
|
}, w = [], y = me(window.getSelection()?.toString() ?? "");
|
|
9595
9599
|
y && w.push(`--- selected text ---
|
|
9596
|
-
${JSON.stringify(y)}`), u.length > 0 && w.push(
|
|
9600
|
+
${JSON.stringify(y)}`), u.length > 0 && w.push(pc(u, t, c, o));
|
|
9597
9601
|
for (const m of s.slice(0, 3))
|
|
9598
9602
|
w.push(I(m, "active overlay DOM", /* @__PURE__ */ new Set()));
|
|
9599
9603
|
if (e && w.push(I(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
|
|
@@ -9604,11 +9608,11 @@ ${JSON.stringify(y)}`), u.length > 0 && w.push(hc(u, t, c, o));
|
|
|
9604
9608
|
|
|
9605
9609
|
`);
|
|
9606
9610
|
}
|
|
9607
|
-
function
|
|
9611
|
+
function Sn(s, e, t, i) {
|
|
9608
9612
|
const n = s.tagName.toLowerCase();
|
|
9609
9613
|
let r = n;
|
|
9610
9614
|
const o = s.getAttribute("id");
|
|
9611
|
-
o &&
|
|
9615
|
+
o && fc(o) && (r += `#${o}`);
|
|
9612
9616
|
for (const a of e) {
|
|
9613
9617
|
const c = s.getAttribute(a);
|
|
9614
9618
|
c && c.length <= 160 && (a !== "role" || !t.has(c)) && (r += `[${a}=${JSON.stringify(c)}]`);
|
|
@@ -9621,7 +9625,7 @@ function In(s, e, t, i) {
|
|
|
9621
9625
|
s.hasAttribute(a) && (r += `[${a}]`);
|
|
9622
9626
|
return `${r}${i ? ` ${JSON.stringify(i)}` : ""}`;
|
|
9623
9627
|
}
|
|
9624
|
-
function
|
|
9628
|
+
function hc() {
|
|
9625
9629
|
const s = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), t = (a, c) => {
|
|
9626
9630
|
if (!a)
|
|
9627
9631
|
return;
|
|
@@ -9642,7 +9646,7 @@ function uc() {
|
|
|
9642
9646
|
i = i.shadowRoot.activeElement;
|
|
9643
9647
|
i !== document.body && i !== document.documentElement && t(i, "focused");
|
|
9644
9648
|
const n = window.getSelection();
|
|
9645
|
-
n && !n.isCollapsed && (t(
|
|
9649
|
+
n && !n.isCollapsed && (t(yi(n.anchorNode), "selected text"), t(yi(n.focusNode), "selected text"));
|
|
9646
9650
|
const r = [
|
|
9647
9651
|
["[aria-selected='true']", "selected"],
|
|
9648
9652
|
["[aria-current]:not([aria-current='false'])", "current"],
|
|
@@ -9664,7 +9668,7 @@ function uc() {
|
|
|
9664
9668
|
priorityTargets: Array.from(e, ([a, c]) => ({ element: a, labels: Array.from(c) }))
|
|
9665
9669
|
};
|
|
9666
9670
|
}
|
|
9667
|
-
function
|
|
9671
|
+
function pc(s, e, t, i) {
|
|
9668
9672
|
const n = ["--- active/current elements ---"];
|
|
9669
9673
|
for (const r of s) {
|
|
9670
9674
|
const o = [];
|
|
@@ -9675,18 +9679,18 @@ function hc(s, e, t, i) {
|
|
|
9675
9679
|
const u = a.getRootNode();
|
|
9676
9680
|
a = a.parentElement ?? (u instanceof ShadowRoot && u.host instanceof HTMLElement ? u.host : null);
|
|
9677
9681
|
}
|
|
9678
|
-
const c = o.length > 6 ? [o[0], ...o.slice(-5)] : o, l = c.map((d, u) =>
|
|
9682
|
+
const c = o.length > 6 ? [o[0], ...o.slice(-5)] : o, l = c.map((d, u) => Sn(
|
|
9679
9683
|
d,
|
|
9680
9684
|
t,
|
|
9681
9685
|
i,
|
|
9682
|
-
u === c.length - 1 ?
|
|
9686
|
+
u === c.length - 1 ? wn(d).slice(0, 180) : ""
|
|
9683
9687
|
));
|
|
9684
9688
|
o.length > c.length && l.splice(1, 0, "…"), n.push(`${r.labels.join(", ")}: ${l.join(" > ")}`);
|
|
9685
9689
|
}
|
|
9686
9690
|
return n.join(`
|
|
9687
9691
|
`);
|
|
9688
9692
|
}
|
|
9689
|
-
function
|
|
9693
|
+
function yi(s) {
|
|
9690
9694
|
return s instanceof HTMLElement ? s : s?.parentElement instanceof HTMLElement ? s.parentElement : null;
|
|
9691
9695
|
}
|
|
9692
9696
|
function Ye(s, e) {
|
|
@@ -9695,17 +9699,17 @@ function Ye(s, e) {
|
|
|
9695
9699
|
const t = " ".repeat(e);
|
|
9696
9700
|
return s.map((i) => `${t}${i}`);
|
|
9697
9701
|
}
|
|
9698
|
-
function
|
|
9702
|
+
function wn(s) {
|
|
9699
9703
|
return me(
|
|
9700
9704
|
Array.from(s.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
|
|
9701
9705
|
);
|
|
9702
9706
|
}
|
|
9703
|
-
function
|
|
9707
|
+
function fc(s) {
|
|
9704
9708
|
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);
|
|
9705
9709
|
}
|
|
9706
|
-
function
|
|
9707
|
-
const s = Array.from(document.querySelectorAll(
|
|
9708
|
-
(r) => typeof r[
|
|
9710
|
+
function bn() {
|
|
9711
|
+
const s = Array.from(document.querySelectorAll(ni)), e = s.find(
|
|
9712
|
+
(r) => typeof r[ca] == "string"
|
|
9709
9713
|
);
|
|
9710
9714
|
if (!(e ?? s[0]))
|
|
9711
9715
|
return;
|
|
@@ -9716,28 +9720,28 @@ function wn() {
|
|
|
9716
9720
|
selectors: [
|
|
9717
9721
|
{
|
|
9718
9722
|
name: "widget_host",
|
|
9719
|
-
selector:
|
|
9723
|
+
selector: ni,
|
|
9720
9724
|
description: "Finds Pluno's shadow-host element in the host page DOM."
|
|
9721
9725
|
},
|
|
9722
9726
|
{
|
|
9723
9727
|
name: "widget_root",
|
|
9724
|
-
selector:
|
|
9728
|
+
selector: ra,
|
|
9725
9729
|
description: "Finds Pluno's widget root inside the widget host shadow root."
|
|
9726
9730
|
},
|
|
9727
9731
|
{
|
|
9728
9732
|
name: "widget_panel",
|
|
9729
|
-
selector:
|
|
9733
|
+
selector: oa,
|
|
9730
9734
|
description: "Finds Pluno's open chat panel inside the widget host shadow root."
|
|
9731
9735
|
},
|
|
9732
9736
|
{
|
|
9733
9737
|
name: "widget_timeline",
|
|
9734
|
-
selector:
|
|
9738
|
+
selector: aa,
|
|
9735
9739
|
description: "Finds Pluno's chat timeline inside the widget host shadow root."
|
|
9736
9740
|
}
|
|
9737
9741
|
]
|
|
9738
9742
|
};
|
|
9739
9743
|
}
|
|
9740
|
-
function
|
|
9744
|
+
function gc(s) {
|
|
9741
9745
|
if (s.runtimeContext !== void 0) {
|
|
9742
9746
|
if (!s.runtimeContext || typeof s.runtimeContext != "object" || Array.isArray(s.runtimeContext)) return !1;
|
|
9743
9747
|
const e = s.runtimeContext;
|
|
@@ -9751,7 +9755,7 @@ function fc(s) {
|
|
|
9751
9755
|
return t === void 0 || typeof t == "number" && Number.isInteger(t) && t >= 0;
|
|
9752
9756
|
});
|
|
9753
9757
|
}
|
|
9754
|
-
function
|
|
9758
|
+
function mi(s) {
|
|
9755
9759
|
try {
|
|
9756
9760
|
const e = JSON.parse(s);
|
|
9757
9761
|
return e && typeof e == "object" ? e : { type: "error", message: "Invalid server event" };
|
|
@@ -9759,7 +9763,7 @@ function yi(s) {
|
|
|
9759
9763
|
return { type: "error", message: "Invalid server event" };
|
|
9760
9764
|
}
|
|
9761
9765
|
}
|
|
9762
|
-
function
|
|
9766
|
+
function yc(s) {
|
|
9763
9767
|
if (typeof s != "string")
|
|
9764
9768
|
return null;
|
|
9765
9769
|
try {
|
|
@@ -9769,13 +9773,13 @@ function gc(s) {
|
|
|
9769
9773
|
return null;
|
|
9770
9774
|
}
|
|
9771
9775
|
}
|
|
9772
|
-
function
|
|
9776
|
+
function Ii(s, e) {
|
|
9773
9777
|
if (!s || typeof s != "object")
|
|
9774
9778
|
return [];
|
|
9775
9779
|
const t = s[e];
|
|
9776
9780
|
return Array.isArray(t) ? t.filter((i) => typeof i == "string" && i.trim().length > 0) : [];
|
|
9777
9781
|
}
|
|
9778
|
-
function
|
|
9782
|
+
function Si(s) {
|
|
9779
9783
|
return Array.isArray(s) ? s.flatMap((e) => {
|
|
9780
9784
|
if (!e || typeof e != "object")
|
|
9781
9785
|
return [];
|
|
@@ -9783,10 +9787,10 @@ function Ii(s) {
|
|
|
9783
9787
|
return typeof t.taskId != "string" || !t.taskId || typeof t.dueAt != "string" || Number.isNaN(Date.parse(t.dueAt)) ? [] : [{ taskId: t.taskId, dueAt: t.dueAt }];
|
|
9784
9788
|
}) : [];
|
|
9785
9789
|
}
|
|
9786
|
-
function
|
|
9790
|
+
function mc(s) {
|
|
9787
9791
|
return Array.isArray(s) ? s.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
|
|
9788
9792
|
}
|
|
9789
|
-
function
|
|
9793
|
+
function Ic(s) {
|
|
9790
9794
|
if (!s || typeof s != "object")
|
|
9791
9795
|
return null;
|
|
9792
9796
|
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;
|
|
@@ -9797,13 +9801,13 @@ function mc(s) {
|
|
|
9797
9801
|
...a !== null ? { scribbleStyle: a } : {}
|
|
9798
9802
|
};
|
|
9799
9803
|
}
|
|
9800
|
-
function
|
|
9804
|
+
function Sc(s) {
|
|
9801
9805
|
if (!s || typeof s != "object")
|
|
9802
9806
|
return null;
|
|
9803
9807
|
const e = s.javascript;
|
|
9804
9808
|
return typeof e != "string" || !e.trim() ? null : { javascript: e };
|
|
9805
9809
|
}
|
|
9806
|
-
function
|
|
9810
|
+
function wc(s, e) {
|
|
9807
9811
|
return e ? s && typeof s == "object" ? {
|
|
9808
9812
|
...s,
|
|
9809
9813
|
helperError: e
|
|
@@ -9813,13 +9817,13 @@ function Sc(s, e) {
|
|
|
9813
9817
|
helperError: e
|
|
9814
9818
|
} : s;
|
|
9815
9819
|
}
|
|
9816
|
-
function
|
|
9820
|
+
function bc(s) {
|
|
9817
9821
|
if (!s || typeof s != "object")
|
|
9818
9822
|
return s;
|
|
9819
9823
|
const e = s;
|
|
9820
9824
|
return typeof e.exception?.message == "string" ? e.exception.message : typeof e.error == "string" ? e.error : s;
|
|
9821
9825
|
}
|
|
9822
|
-
function
|
|
9826
|
+
function vc() {
|
|
9823
9827
|
const s = "pluno.productAgent.clientId", e = window.localStorage.getItem(s);
|
|
9824
9828
|
if (e)
|
|
9825
9829
|
return e;
|
|
@@ -9829,7 +9833,7 @@ function bc() {
|
|
|
9829
9833
|
function L() {
|
|
9830
9834
|
return crypto.randomUUID();
|
|
9831
9835
|
}
|
|
9832
|
-
function
|
|
9836
|
+
function wi(s) {
|
|
9833
9837
|
if (!s || typeof s != "object")
|
|
9834
9838
|
return null;
|
|
9835
9839
|
const e = s, t = typeof e.id == "string" ? e.id : null;
|
|
@@ -9852,21 +9856,21 @@ function ft(s, e) {
|
|
|
9852
9856
|
if (!i || typeof i != "object")
|
|
9853
9857
|
return null;
|
|
9854
9858
|
const n = i;
|
|
9855
|
-
if (n.hiddenFromTranscript === !0 ||
|
|
9859
|
+
if (n.hiddenFromTranscript === !0 || Ao(n) || n.type === "tab_lifecycle_decision" && n.decision === "keep")
|
|
9856
9860
|
return null;
|
|
9857
9861
|
if (n.type === "assistant_draft")
|
|
9858
9862
|
return {
|
|
9859
9863
|
id: typeof n.id == "string" ? n.id : String(t.id ?? crypto.randomUUID()),
|
|
9860
9864
|
role: "assistant",
|
|
9861
9865
|
...n.phase === "commentary" || n.phase === "final_answer" ? { phase: n.phase } : {},
|
|
9862
|
-
content:
|
|
9863
|
-
|
|
9866
|
+
content: Gs(
|
|
9867
|
+
bi(n.content),
|
|
9864
9868
|
e
|
|
9865
9869
|
),
|
|
9866
9870
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
9867
9871
|
...x(n) !== null ? { displaySequence: x(n) } : {},
|
|
9868
9872
|
...F(n) !== null ? { causalSequence: F(n) } : {},
|
|
9869
|
-
respondsToUserMessageId:
|
|
9873
|
+
respondsToUserMessageId: j(n) ?? void 0,
|
|
9870
9874
|
...E(n) ? { runId: E(n) } : {},
|
|
9871
9875
|
dataType: "assistant_draft",
|
|
9872
9876
|
...n.steered === !0 ? { steered: !0 } : {}
|
|
@@ -9876,16 +9880,16 @@ function ft(s, e) {
|
|
|
9876
9880
|
id: String(t.id ?? crypto.randomUUID()),
|
|
9877
9881
|
role: r,
|
|
9878
9882
|
...n.phase === "commentary" || n.phase === "final_answer" ? { phase: n.phase } : {},
|
|
9879
|
-
content:
|
|
9880
|
-
|
|
9883
|
+
content: Gs(
|
|
9884
|
+
bi(n.content),
|
|
9881
9885
|
e
|
|
9882
9886
|
),
|
|
9883
9887
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
9884
9888
|
...x(n) !== null ? { displaySequence: x(n) } : {},
|
|
9885
9889
|
...F(n) !== null ? { causalSequence: F(n) } : {},
|
|
9886
|
-
respondsToUserMessageId:
|
|
9890
|
+
respondsToUserMessageId: j(n) ?? void 0,
|
|
9887
9891
|
...E(n) ? { runId: E(n) } : {},
|
|
9888
|
-
attachments:
|
|
9892
|
+
attachments: Mn(n.attachments, e),
|
|
9889
9893
|
...n.steered === !0 ? { steered: !0 } : {}
|
|
9890
9894
|
};
|
|
9891
9895
|
return r === "assistant" && typeof n.id == "string" && Object.defineProperty(o, "assistantDraftItemId", {
|
|
@@ -9900,7 +9904,7 @@ function ft(s, e) {
|
|
|
9900
9904
|
}), o;
|
|
9901
9905
|
}
|
|
9902
9906
|
if (n.type === "function_call_output") {
|
|
9903
|
-
const r =
|
|
9907
|
+
const r = vo(n.output);
|
|
9904
9908
|
if (r !== null)
|
|
9905
9909
|
return {
|
|
9906
9910
|
id: String(t.id ?? crypto.randomUUID()),
|
|
@@ -9908,14 +9912,14 @@ function ft(s, e) {
|
|
|
9908
9912
|
content: "",
|
|
9909
9913
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
9910
9914
|
...x(n) !== null ? { displaySequence: x(n) } : {},
|
|
9911
|
-
respondsToUserMessageId:
|
|
9915
|
+
respondsToUserMessageId: j(n) ?? void 0,
|
|
9912
9916
|
...E(n) ? { runId: E(n) } : {},
|
|
9913
9917
|
dataType: "function_call_output",
|
|
9914
9918
|
toolName: _s,
|
|
9915
9919
|
callId: Pe(n) ?? void 0,
|
|
9916
9920
|
sharePromptAllowed: r
|
|
9917
9921
|
};
|
|
9918
|
-
const o =
|
|
9922
|
+
const o = Bo(n.output);
|
|
9919
9923
|
if (o)
|
|
9920
9924
|
return {
|
|
9921
9925
|
id: String(t.id ?? crypto.randomUUID()),
|
|
@@ -9923,15 +9927,15 @@ function ft(s, e) {
|
|
|
9923
9927
|
content: "",
|
|
9924
9928
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
9925
9929
|
...x(n) !== null ? { displaySequence: x(n) } : {},
|
|
9926
|
-
respondsToUserMessageId:
|
|
9930
|
+
respondsToUserMessageId: j(n) ?? void 0,
|
|
9927
9931
|
...E(n) ? { runId: E(n) } : {},
|
|
9928
9932
|
dataType: "scheduled_check_in",
|
|
9929
|
-
toolName:
|
|
9933
|
+
toolName: cn,
|
|
9930
9934
|
callId: Pe(n) ?? void 0,
|
|
9931
9935
|
scheduledCheckInId: o.id ?? void 0,
|
|
9932
9936
|
scheduledCheckInAt: o.dueAt
|
|
9933
9937
|
};
|
|
9934
|
-
const a =
|
|
9938
|
+
const a = _c(n.output), c = Rc(n.output);
|
|
9935
9939
|
return a ? {
|
|
9936
9940
|
id: String(t.id ?? crypto.randomUUID()),
|
|
9937
9941
|
role: "tool",
|
|
@@ -9939,7 +9943,7 @@ function ft(s, e) {
|
|
|
9939
9943
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
9940
9944
|
...x(n) !== null ? { displaySequence: x(n) } : {},
|
|
9941
9945
|
...F(n) !== null ? { causalSequence: F(n) } : {},
|
|
9942
|
-
respondsToUserMessageId:
|
|
9946
|
+
respondsToUserMessageId: j(n) ?? void 0,
|
|
9943
9947
|
...E(n) ? { runId: E(n) } : {},
|
|
9944
9948
|
dataType: "function_call_output",
|
|
9945
9949
|
toolName: "authenticate_pipedream_app",
|
|
@@ -9952,7 +9956,7 @@ function ft(s, e) {
|
|
|
9952
9956
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
9953
9957
|
...x(n) !== null ? { displaySequence: x(n) } : {},
|
|
9954
9958
|
...F(n) !== null ? { causalSequence: F(n) } : {},
|
|
9955
|
-
respondsToUserMessageId:
|
|
9959
|
+
respondsToUserMessageId: j(n) ?? void 0,
|
|
9956
9960
|
...E(n) ? { runId: E(n) } : {},
|
|
9957
9961
|
dataType: "function_call_output",
|
|
9958
9962
|
toolName: "request_personal_channel_connection",
|
|
@@ -9963,11 +9967,11 @@ function ft(s, e) {
|
|
|
9963
9967
|
return n.type === "function_call" || n.type === "tool_call" || n.type === "web_search_call" || n.type === "mcp_call" || n.type === "tab_lifecycle_decision" ? {
|
|
9964
9968
|
id: String(t.id ?? crypto.randomUUID()),
|
|
9965
9969
|
role: "tool",
|
|
9966
|
-
content: n.type === "mcp_call" ?
|
|
9970
|
+
content: n.type === "mcp_call" ? Tc(n) : kc(n),
|
|
9967
9971
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
9968
9972
|
...x(n) !== null ? { displaySequence: x(n) } : {},
|
|
9969
9973
|
...F(n) !== null ? { causalSequence: F(n) } : {},
|
|
9970
|
-
respondsToUserMessageId:
|
|
9974
|
+
respondsToUserMessageId: j(n) ?? void 0,
|
|
9971
9975
|
...E(n) ? { runId: E(n) } : {},
|
|
9972
9976
|
dataType: String(n.type),
|
|
9973
9977
|
toolName: n.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof n.name == "string" ? n.name : void 0,
|
|
@@ -9977,11 +9981,11 @@ function ft(s, e) {
|
|
|
9977
9981
|
} : n.type === "run_status" || n.type === "run_error" ? n.type === "run_error" && n.stage === "tool_execution" ? null : {
|
|
9978
9982
|
id: String(t.id ?? crypto.randomUUID()),
|
|
9979
9983
|
role: "system",
|
|
9980
|
-
content:
|
|
9984
|
+
content: Ac(n),
|
|
9981
9985
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
9982
9986
|
...x(n) !== null ? { displaySequence: x(n) } : {},
|
|
9983
9987
|
...F(n) !== null ? { causalSequence: F(n) } : {},
|
|
9984
|
-
respondsToUserMessageId:
|
|
9988
|
+
respondsToUserMessageId: j(n) ?? void 0,
|
|
9985
9989
|
...E(n) ? { runId: E(n) } : {},
|
|
9986
9990
|
dataType: String(n.type),
|
|
9987
9991
|
loading: n.steered !== !0 && n.type === "run_status" && (n.status === "running" || n.status === "retrying"),
|
|
@@ -9990,11 +9994,11 @@ function ft(s, e) {
|
|
|
9990
9994
|
...typeof n.securitySettingsUrl == "string" ? { securitySettingsUrl: n.securitySettingsUrl } : {}
|
|
9991
9995
|
} : null;
|
|
9992
9996
|
}
|
|
9993
|
-
function
|
|
9997
|
+
function Tc(s) {
|
|
9994
9998
|
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(" ");
|
|
9995
9999
|
return t ? `🔌 Using ${t}` : "🔌 Using connected integration";
|
|
9996
10000
|
}
|
|
9997
|
-
function
|
|
10001
|
+
function _c(s) {
|
|
9998
10002
|
if (typeof s != "string")
|
|
9999
10003
|
return null;
|
|
10000
10004
|
try {
|
|
@@ -10011,7 +10015,7 @@ function Tc(s) {
|
|
|
10011
10015
|
return null;
|
|
10012
10016
|
}
|
|
10013
10017
|
}
|
|
10014
|
-
function
|
|
10018
|
+
function Rc(s) {
|
|
10015
10019
|
if (typeof s != "string")
|
|
10016
10020
|
return null;
|
|
10017
10021
|
try {
|
|
@@ -10026,10 +10030,10 @@ function _c(s) {
|
|
|
10026
10030
|
return null;
|
|
10027
10031
|
}
|
|
10028
10032
|
}
|
|
10029
|
-
function
|
|
10033
|
+
function Ac(s) {
|
|
10030
10034
|
return s.type === "run_status" && s.status === "steered" ? "Steered" : typeof s.message == "string" && s.message.trim().length > 0 ? s.message : "";
|
|
10031
10035
|
}
|
|
10032
|
-
function
|
|
10036
|
+
function kc(s) {
|
|
10033
10037
|
if (s.type === "web_search_call") {
|
|
10034
10038
|
const e = s.action;
|
|
10035
10039
|
if (e && typeof e == "object") {
|
|
@@ -10041,9 +10045,9 @@ function Ac(s) {
|
|
|
10041
10045
|
}
|
|
10042
10046
|
return "🔎 Searching the web";
|
|
10043
10047
|
}
|
|
10044
|
-
return
|
|
10048
|
+
return Mc(s);
|
|
10045
10049
|
}
|
|
10046
|
-
function
|
|
10050
|
+
function Mc(s) {
|
|
10047
10051
|
if (typeof s.summary == "string" && s.summary.trim().length > 0)
|
|
10048
10052
|
return ge(s.summary);
|
|
10049
10053
|
if (typeof s.arguments == "string")
|
|
@@ -10060,7 +10064,7 @@ function ge(s) {
|
|
|
10060
10064
|
const e = s.trim() || "Run tool", t = e.codePointAt(0) ?? 0;
|
|
10061
10065
|
return t >= 126976 && t <= 129791 || t >= 9728 && t <= 10175 || t >= 127462 && t <= 127487 ? e : `🛠️ ${e}`;
|
|
10062
10066
|
}
|
|
10063
|
-
function
|
|
10067
|
+
function Ec(s) {
|
|
10064
10068
|
if (s == null)
|
|
10065
10069
|
return s;
|
|
10066
10070
|
if (typeof s != "object")
|
|
@@ -10085,7 +10089,7 @@ function F(s) {
|
|
|
10085
10089
|
function x(s) {
|
|
10086
10090
|
return typeof s.displaySequence == "number" && Number.isSafeInteger(s.displaySequence) ? s.displaySequence : null;
|
|
10087
10091
|
}
|
|
10088
|
-
function
|
|
10092
|
+
function bi(s) {
|
|
10089
10093
|
return typeof s == "string" ? s : Array.isArray(s) ? s.map((e) => {
|
|
10090
10094
|
if (!e || typeof e != "object")
|
|
10091
10095
|
return "";
|
|
@@ -10094,13 +10098,13 @@ function wi(s) {
|
|
|
10094
10098
|
}).filter(Boolean).join("") : "";
|
|
10095
10099
|
}
|
|
10096
10100
|
function qe(s, e) {
|
|
10097
|
-
const t =
|
|
10101
|
+
const t = vn(
|
|
10098
10102
|
s,
|
|
10099
10103
|
Ms(s, e)
|
|
10100
|
-
), i =
|
|
10101
|
-
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
+
), i = Dc(
|
|
10105
|
+
Pc(
|
|
10106
|
+
xc(
|
|
10107
|
+
Cc(s, e),
|
|
10104
10108
|
e
|
|
10105
10109
|
),
|
|
10106
10110
|
t
|
|
@@ -10125,7 +10129,7 @@ function Ms(s, e, t = !0) {
|
|
|
10125
10129
|
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] : []);
|
|
10126
10130
|
return e.displaySequence = (n.length > 0 ? Math.max(...n) : 0) + 1, e;
|
|
10127
10131
|
}
|
|
10128
|
-
function
|
|
10132
|
+
function Cc(s, e) {
|
|
10129
10133
|
const t = e.proactiveSuggestionClientMessageId;
|
|
10130
10134
|
if (!t)
|
|
10131
10135
|
return s;
|
|
@@ -10135,7 +10139,7 @@ function Ec(s, e) {
|
|
|
10135
10139
|
const r = [...s];
|
|
10136
10140
|
return r[n] = e, r;
|
|
10137
10141
|
}
|
|
10138
|
-
function
|
|
10142
|
+
function Pc(s, e) {
|
|
10139
10143
|
const t = e.assistantDraftItemId;
|
|
10140
10144
|
return t ? s.map(
|
|
10141
10145
|
(i) => i.dataType === "assistant_draft" && i.id === t ? e : i
|
|
@@ -10144,7 +10148,7 @@ function Cc(s, e) {
|
|
|
10144
10148
|
function Ze(s, e, t) {
|
|
10145
10149
|
return e !== null ? s.respondsToUserMessageId === e : t !== null && s.runId === t;
|
|
10146
10150
|
}
|
|
10147
|
-
function
|
|
10151
|
+
function vi(s, e, t, i) {
|
|
10148
10152
|
if (t === null) return s;
|
|
10149
10153
|
let n = -1;
|
|
10150
10154
|
for (let o = s.length - 1; o >= 0; o -= 1) {
|
|
@@ -10161,7 +10165,7 @@ function bi(s, e, t, i) {
|
|
|
10161
10165
|
respondsToUserMessageId: t
|
|
10162
10166
|
}, r;
|
|
10163
10167
|
}
|
|
10164
|
-
function
|
|
10168
|
+
function Ti(s, e) {
|
|
10165
10169
|
const t = s.findIndex(
|
|
10166
10170
|
(n) => !n.id.startsWith("transient-activity:") && n.callId === e.callId
|
|
10167
10171
|
);
|
|
@@ -10178,12 +10182,12 @@ function vi(s, e) {
|
|
|
10178
10182
|
...i[t].runId ? {} : { runId: e.runId }
|
|
10179
10183
|
}, i;
|
|
10180
10184
|
}
|
|
10181
|
-
function
|
|
10185
|
+
function _i(s, e, t) {
|
|
10182
10186
|
let i = !1;
|
|
10183
10187
|
const n = s.map((r) => r.callId !== e || r.loading === t ? r : (i = !0, { ...r, loading: t }));
|
|
10184
10188
|
return i ? n : s;
|
|
10185
10189
|
}
|
|
10186
|
-
function
|
|
10190
|
+
function Ri(s) {
|
|
10187
10191
|
if (s.hiddenFromTranscript === !0)
|
|
10188
10192
|
return null;
|
|
10189
10193
|
const e = typeof s.callId == "string" ? s.callId : null, t = typeof s.toolName == "string" ? s.toolName : null;
|
|
@@ -10203,7 +10207,7 @@ function _i(s) {
|
|
|
10203
10207
|
loading: !0
|
|
10204
10208
|
};
|
|
10205
10209
|
}
|
|
10206
|
-
function
|
|
10210
|
+
function Dc(s, e) {
|
|
10207
10211
|
if (e.id.startsWith("transient-activity:"))
|
|
10208
10212
|
return s;
|
|
10209
10213
|
const t = e.toolName === "tab_lifecycle";
|
|
@@ -10217,19 +10221,19 @@ function cs(s, e) {
|
|
|
10217
10221
|
for (const i of e) {
|
|
10218
10222
|
const n = [...s, ...t];
|
|
10219
10223
|
t.push(
|
|
10220
|
-
|
|
10224
|
+
vn(
|
|
10221
10225
|
n,
|
|
10222
10226
|
Ms(n, i, !1)
|
|
10223
10227
|
)
|
|
10224
10228
|
);
|
|
10225
10229
|
}
|
|
10226
|
-
return
|
|
10230
|
+
return ko(
|
|
10227
10231
|
s,
|
|
10228
10232
|
t,
|
|
10229
10233
|
ls
|
|
10230
10234
|
);
|
|
10231
10235
|
}
|
|
10232
|
-
function
|
|
10236
|
+
function Uc(s, e) {
|
|
10233
10237
|
const t = new Map(s.map((r) => [r.id, r])), i = e.map(
|
|
10234
10238
|
(r) => Ms(s, r, !1)
|
|
10235
10239
|
);
|
|
@@ -10271,42 +10275,42 @@ function ls(s) {
|
|
|
10271
10275
|
isTransient: s.id.startsWith("transient-activity:") || s.dataType === "assistant_draft"
|
|
10272
10276
|
};
|
|
10273
10277
|
}
|
|
10274
|
-
function
|
|
10278
|
+
function vn(s, e) {
|
|
10275
10279
|
if (e.role !== "user" || !e.attachments?.length)
|
|
10276
10280
|
return e;
|
|
10277
10281
|
const t = s.find(
|
|
10278
|
-
(o) => o.role === "user" && (o.id === e.id || Tt(o) &&
|
|
10282
|
+
(o) => o.role === "user" && (o.id === e.id || Tt(o) && Tn(o, e))
|
|
10279
10283
|
);
|
|
10280
10284
|
if (!t?.attachments?.length)
|
|
10281
10285
|
return e;
|
|
10282
10286
|
const i = e.attachments.map((o) => {
|
|
10283
|
-
const a =
|
|
10284
|
-
return a ?
|
|
10287
|
+
const a = qc(t.attachments ?? [], o);
|
|
10288
|
+
return a ? Oc(o, a) : o;
|
|
10285
10289
|
}), n = { ...e, attachments: i }, r = de(e);
|
|
10286
10290
|
return r && Object.defineProperty(n, "clientMessageId", {
|
|
10287
10291
|
value: r,
|
|
10288
10292
|
enumerable: !1
|
|
10289
10293
|
}), n;
|
|
10290
10294
|
}
|
|
10291
|
-
function
|
|
10295
|
+
function qc(s, e) {
|
|
10292
10296
|
return e.id ? s.find((t) => t.id === e.id) ?? null : null;
|
|
10293
10297
|
}
|
|
10294
|
-
function
|
|
10298
|
+
function Oc(s, e) {
|
|
10295
10299
|
const { previewUrl: t } = e;
|
|
10296
10300
|
return t ? { ...s, previewUrl: t } : s;
|
|
10297
10301
|
}
|
|
10298
|
-
function
|
|
10302
|
+
function xc(s, e) {
|
|
10299
10303
|
if (e.role !== "user")
|
|
10300
10304
|
return s;
|
|
10301
10305
|
const t = s.findIndex(
|
|
10302
|
-
(n) => Tt(n) &&
|
|
10306
|
+
(n) => Tt(n) && Tn(n, e)
|
|
10303
10307
|
);
|
|
10304
10308
|
if (t === -1)
|
|
10305
10309
|
return s;
|
|
10306
10310
|
const i = [...s];
|
|
10307
10311
|
return i.splice(t, 1), i;
|
|
10308
10312
|
}
|
|
10309
|
-
function
|
|
10313
|
+
function Tn(s, e) {
|
|
10310
10314
|
const t = de(s), i = de(e);
|
|
10311
10315
|
return t && i ? t === i : s.content === e.content;
|
|
10312
10316
|
}
|
|
@@ -10323,7 +10327,7 @@ function de(s) {
|
|
|
10323
10327
|
return i ? s.id.slice(i.length) : null;
|
|
10324
10328
|
}
|
|
10325
10329
|
function zt(s) {
|
|
10326
|
-
const e =
|
|
10330
|
+
const e = _n(s);
|
|
10327
10331
|
if (e === null)
|
|
10328
10332
|
return !1;
|
|
10329
10333
|
const t = s[e].id;
|
|
@@ -10346,7 +10350,7 @@ function zt(s) {
|
|
|
10346
10350
|
}
|
|
10347
10351
|
return !1;
|
|
10348
10352
|
}
|
|
10349
|
-
function
|
|
10353
|
+
function Bc(s, e, t) {
|
|
10350
10354
|
const i = new Set(
|
|
10351
10355
|
s.filter(
|
|
10352
10356
|
(n) => n.role === "user" && e !== null && de(n) === e
|
|
@@ -10360,14 +10364,14 @@ function xc(s, e, t) {
|
|
|
10360
10364
|
if (t && n.runId === t) {
|
|
10361
10365
|
if (i.size === 0)
|
|
10362
10366
|
return !0;
|
|
10363
|
-
const o =
|
|
10367
|
+
const o = Rn(s, r);
|
|
10364
10368
|
return !n.respondsToUserMessageId && o !== null && i.has(o);
|
|
10365
10369
|
}
|
|
10366
10370
|
return !1;
|
|
10367
10371
|
});
|
|
10368
10372
|
}
|
|
10369
|
-
function
|
|
10370
|
-
const e =
|
|
10373
|
+
function Nc(s) {
|
|
10374
|
+
const e = _n(s);
|
|
10371
10375
|
if (e === null)
|
|
10372
10376
|
return s.some(X);
|
|
10373
10377
|
const t = s[e].id;
|
|
@@ -10375,7 +10379,7 @@ function Bc(s) {
|
|
|
10375
10379
|
(i) => i.respondsToUserMessageId === t && X(i)
|
|
10376
10380
|
) : s.slice(e + 1).some(X);
|
|
10377
10381
|
}
|
|
10378
|
-
function
|
|
10382
|
+
function _n(s) {
|
|
10379
10383
|
for (let e = s.length - 1; e >= 0; e -= 1)
|
|
10380
10384
|
if (s[e].role === "user" && !Tt(s[e]))
|
|
10381
10385
|
return e;
|
|
@@ -10398,7 +10402,7 @@ function Ie(s) {
|
|
|
10398
10402
|
}
|
|
10399
10403
|
return null;
|
|
10400
10404
|
}
|
|
10401
|
-
function
|
|
10405
|
+
function Lc(s) {
|
|
10402
10406
|
const e = Ie(s);
|
|
10403
10407
|
if (e === null)
|
|
10404
10408
|
return null;
|
|
@@ -10417,10 +10421,10 @@ function q(s) {
|
|
|
10417
10421
|
function Ne(s) {
|
|
10418
10422
|
return s?.retryable !== !0 ? !1 : s.type === "run_error" ? !0 : s.type === "run_status" && s.status === "interrupted";
|
|
10419
10423
|
}
|
|
10420
|
-
function
|
|
10424
|
+
function Fc(s) {
|
|
10421
10425
|
return s?.type === "run_status" && s.status === "interrupted" && s.reason === "backend_restart";
|
|
10422
10426
|
}
|
|
10423
|
-
function
|
|
10427
|
+
function jc(s, e) {
|
|
10424
10428
|
const t = Ie(e);
|
|
10425
10429
|
if (t === null)
|
|
10426
10430
|
return !1;
|
|
@@ -10469,22 +10473,22 @@ function Hc(s) {
|
|
|
10469
10473
|
function us(s, e) {
|
|
10470
10474
|
if (typeof e.clientMessageId == "string")
|
|
10471
10475
|
return e.clientMessageId;
|
|
10472
|
-
const t =
|
|
10476
|
+
const t = j(e);
|
|
10473
10477
|
if (!t)
|
|
10474
10478
|
return null;
|
|
10475
10479
|
const i = s.find((r) => A(r, "id") === t), n = q(i);
|
|
10476
10480
|
return n?.type === "message" && n.role === "user" && typeof n.clientMessageId == "string" ? n.clientMessageId : null;
|
|
10477
10481
|
}
|
|
10478
|
-
function
|
|
10479
|
-
if (!e ||
|
|
10482
|
+
function Ai(s, e, t, i, n, r) {
|
|
10483
|
+
if (!e || !Wc(s))
|
|
10480
10484
|
return !1;
|
|
10481
10485
|
const o = s;
|
|
10482
10486
|
if (Ne(o) || t !== null && typeof o.id == "string" && o.id !== t)
|
|
10483
10487
|
return !1;
|
|
10484
|
-
const a =
|
|
10488
|
+
const a = j(o);
|
|
10485
10489
|
return i !== null ? a !== null ? a === i : n !== null && E(o) === n && r === i : n === null || E(o) === n;
|
|
10486
10490
|
}
|
|
10487
|
-
function
|
|
10491
|
+
function $c(s, e) {
|
|
10488
10492
|
for (let t = e - 1; t >= 0; t -= 1) {
|
|
10489
10493
|
const i = q(s[t]);
|
|
10490
10494
|
if (i?.type === "message" && i.role === "user")
|
|
@@ -10492,13 +10496,13 @@ function jc(s, e) {
|
|
|
10492
10496
|
}
|
|
10493
10497
|
return null;
|
|
10494
10498
|
}
|
|
10495
|
-
function
|
|
10499
|
+
function Rn(s, e) {
|
|
10496
10500
|
for (let t = e - 1; t >= 0; t -= 1)
|
|
10497
10501
|
if (s[t].role === "user")
|
|
10498
10502
|
return s[t].id;
|
|
10499
10503
|
return null;
|
|
10500
10504
|
}
|
|
10501
|
-
function
|
|
10505
|
+
function Wc(s) {
|
|
10502
10506
|
if (!s || typeof s != "object")
|
|
10503
10507
|
return !1;
|
|
10504
10508
|
const e = s;
|
|
@@ -10507,16 +10511,16 @@ function $c(s) {
|
|
|
10507
10511
|
function X(s) {
|
|
10508
10512
|
return s.role === "assistant" && s.phase !== "commentary";
|
|
10509
10513
|
}
|
|
10510
|
-
function
|
|
10514
|
+
function zc(s) {
|
|
10511
10515
|
if (!s || typeof s != "object")
|
|
10512
10516
|
return !1;
|
|
10513
10517
|
const e = s;
|
|
10514
10518
|
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";
|
|
10515
10519
|
}
|
|
10516
10520
|
function hs(s) {
|
|
10517
|
-
return s.filter((e, t) => oe(e) ? !
|
|
10521
|
+
return s.filter((e, t) => oe(e) ? !il(s, t) && !An(s, t) && !tl(s, t) && !sl(s, t) : Kc(e) ? e.retryable === !0 && el(s, t) ? !1 : !Zc(s, t) : !0);
|
|
10518
10522
|
}
|
|
10519
|
-
function
|
|
10523
|
+
function Kc(s) {
|
|
10520
10524
|
return s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.steered !== !0);
|
|
10521
10525
|
}
|
|
10522
10526
|
function oe(s) {
|
|
@@ -10525,19 +10529,19 @@ function oe(s) {
|
|
|
10525
10529
|
function ps(s) {
|
|
10526
10530
|
return s.steered !== !0 && (s.dataType === "assistant_draft" || s.loading === !0);
|
|
10527
10531
|
}
|
|
10528
|
-
function
|
|
10532
|
+
function Vc(s) {
|
|
10529
10533
|
return s.some(ps);
|
|
10530
10534
|
}
|
|
10531
|
-
function
|
|
10535
|
+
function ki(s, e) {
|
|
10532
10536
|
return (s.retryable === !0 || s.code === "transient_model_error") && s.code !== "run_recovery_exhausted" && e !== null && typeof s.clientMessageId == "string";
|
|
10533
10537
|
}
|
|
10534
|
-
function
|
|
10538
|
+
function Qc(s, e) {
|
|
10535
10539
|
const t = [...s].reverse().find(ps), i = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : t?.respondsToUserMessageId ?? null, n = typeof e.runId == "string" ? e.runId : t?.runId ?? null;
|
|
10536
10540
|
return s.flatMap((r) => (i ? r.respondsToUserMessageId === i || !r.respondsToUserMessageId && n !== null && r.runId === n : n ? r.runId === n : ps(r)) ? r.dataType === "assistant_draft" || oe(r) ? [] : r.loading === !0 ? [{ ...r, loading: !1 }] : [r] : [r]);
|
|
10537
10541
|
}
|
|
10538
|
-
function
|
|
10542
|
+
function Mi(s, e, t, i) {
|
|
10539
10543
|
const n = s.findIndex(
|
|
10540
|
-
(c, l) => oe(c) && !
|
|
10544
|
+
(c, l) => oe(c) && !An(s, l)
|
|
10541
10545
|
), r = n === -1 ? null : s[n], o = e ?? r?.respondsToUserMessageId ?? null, a = o ? s.find(
|
|
10542
10546
|
(c) => c.role === "user" && c.id === o
|
|
10543
10547
|
) : null;
|
|
@@ -10550,10 +10554,10 @@ function ki(s, e, t, i) {
|
|
|
10550
10554
|
function Oe(s) {
|
|
10551
10555
|
return s?.type === "run_status" && s.status === "stopped";
|
|
10552
10556
|
}
|
|
10553
|
-
function
|
|
10557
|
+
function Gc(s, e) {
|
|
10554
10558
|
return X(e) ? "completed" : Oe(s) ? "stopped" : !Ne(s) && (s?.type === "run_error" || s?.type === "run_status" && (s.status === "failed" || s.status === "interrupted")) ? "failed" : null;
|
|
10555
10559
|
}
|
|
10556
|
-
function
|
|
10560
|
+
function Ei(s, e, t) {
|
|
10557
10561
|
const i = new Set(
|
|
10558
10562
|
s.filter(
|
|
10559
10563
|
(n) => n.role === "user" && e !== null && de(n) === e
|
|
@@ -10563,16 +10567,16 @@ function Mi(s, e, t) {
|
|
|
10563
10567
|
(n) => !oe(n) || (i.size > 0 ? !n.respondsToUserMessageId || !i.has(n.respondsToUserMessageId) : !t || n.runId !== t)
|
|
10564
10568
|
);
|
|
10565
10569
|
}
|
|
10566
|
-
function
|
|
10570
|
+
function An(s, e) {
|
|
10567
10571
|
return s.some(
|
|
10568
|
-
(t, i) => i !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) &&
|
|
10572
|
+
(t, i) => i !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) && Jc(
|
|
10569
10573
|
s,
|
|
10570
10574
|
e,
|
|
10571
10575
|
i
|
|
10572
10576
|
)
|
|
10573
10577
|
);
|
|
10574
10578
|
}
|
|
10575
|
-
function
|
|
10579
|
+
function Jc(s, e, t) {
|
|
10576
10580
|
const i = s[e], n = s[t];
|
|
10577
10581
|
if (Fe(i, n))
|
|
10578
10582
|
return !0;
|
|
@@ -10583,20 +10587,20 @@ function Gc(s, e, t) {
|
|
|
10583
10587
|
return s[r].id === i.respondsToUserMessageId;
|
|
10584
10588
|
return !1;
|
|
10585
10589
|
}
|
|
10586
|
-
function
|
|
10590
|
+
function Ci(s, e, t, i) {
|
|
10587
10591
|
const n = (t && t !== e ? t : null) ?? [...s].reverse().find(
|
|
10588
|
-
(c) => c.respondsToUserMessageId !== void 0 && c.respondsToUserMessageId !== e &&
|
|
10592
|
+
(c) => c.respondsToUserMessageId !== void 0 && c.respondsToUserMessageId !== e && Pi(c) && !Yc(
|
|
10589
10593
|
s,
|
|
10590
10594
|
c.respondsToUserMessageId
|
|
10591
10595
|
)
|
|
10592
|
-
)?.respondsToUserMessageId ??
|
|
10596
|
+
)?.respondsToUserMessageId ?? Xc(
|
|
10593
10597
|
s,
|
|
10594
10598
|
e
|
|
10595
10599
|
);
|
|
10596
10600
|
if (!n)
|
|
10597
10601
|
return s;
|
|
10598
10602
|
let r = !1;
|
|
10599
|
-
const o = s.map((c) => c.respondsToUserMessageId !== n || !
|
|
10603
|
+
const o = s.map((c) => c.respondsToUserMessageId !== n || !Pi(c) ? c : (r = !0, { ...c, steered: !0 }));
|
|
10600
10604
|
if (r)
|
|
10601
10605
|
return o;
|
|
10602
10606
|
const a = s.find(
|
|
@@ -10618,7 +10622,7 @@ function Ei(s, e, t, i) {
|
|
|
10618
10622
|
}
|
|
10619
10623
|
];
|
|
10620
10624
|
}
|
|
10621
|
-
function
|
|
10625
|
+
function Xc(s, e) {
|
|
10622
10626
|
const t = s.findIndex(
|
|
10623
10627
|
(i) => i.role === "user" && i.id === e
|
|
10624
10628
|
);
|
|
@@ -10629,15 +10633,15 @@ function Jc(s, e) {
|
|
|
10629
10633
|
return s[i].id;
|
|
10630
10634
|
return null;
|
|
10631
10635
|
}
|
|
10632
|
-
function
|
|
10636
|
+
function Pi(s) {
|
|
10633
10637
|
return s.role === "tool" || oe(s) ? !0 : s.role === "assistant" && s.phase === "commentary";
|
|
10634
10638
|
}
|
|
10635
|
-
function
|
|
10639
|
+
function Yc(s, e) {
|
|
10636
10640
|
return s.some(
|
|
10637
10641
|
(t) => t.respondsToUserMessageId === e && (X(t) || t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0))
|
|
10638
10642
|
);
|
|
10639
10643
|
}
|
|
10640
|
-
function
|
|
10644
|
+
function Zc(s, e) {
|
|
10641
10645
|
const t = s[e];
|
|
10642
10646
|
for (let i = e + 1; i < s.length; i += 1) {
|
|
10643
10647
|
const n = s[i];
|
|
@@ -10646,7 +10650,7 @@ function Yc(s, e) {
|
|
|
10646
10650
|
}
|
|
10647
10651
|
return !1;
|
|
10648
10652
|
}
|
|
10649
|
-
function
|
|
10653
|
+
function el(s, e) {
|
|
10650
10654
|
const t = s[e];
|
|
10651
10655
|
if (!t.respondsToUserMessageId)
|
|
10652
10656
|
return !1;
|
|
@@ -10659,19 +10663,19 @@ function Zc(s, e) {
|
|
|
10659
10663
|
}
|
|
10660
10664
|
return !1;
|
|
10661
10665
|
}
|
|
10662
|
-
function
|
|
10666
|
+
function tl(s, e) {
|
|
10663
10667
|
const t = s[e];
|
|
10664
10668
|
return s.some(
|
|
10665
10669
|
(i, n) => n !== e && i.role === "assistant" && Fe(t, i)
|
|
10666
10670
|
);
|
|
10667
10671
|
}
|
|
10668
|
-
function
|
|
10672
|
+
function sl(s, e) {
|
|
10669
10673
|
const t = s[e];
|
|
10670
10674
|
return s.some(
|
|
10671
10675
|
(i, n) => n !== e && i.role === "tool" && Fe(t, i)
|
|
10672
10676
|
);
|
|
10673
10677
|
}
|
|
10674
|
-
function
|
|
10678
|
+
function il(s, e) {
|
|
10675
10679
|
const t = s[e];
|
|
10676
10680
|
for (let i = e + 1; i < s.length; i += 1)
|
|
10677
10681
|
if (oe(s[i]) && Fe(t, s[i]))
|
|
@@ -10684,15 +10688,15 @@ function Fe(s, e) {
|
|
|
10684
10688
|
function A(s, e) {
|
|
10685
10689
|
return s && typeof s == "object" && typeof s[e] == "string" ? s[e] : null;
|
|
10686
10690
|
}
|
|
10687
|
-
function
|
|
10691
|
+
function nl(s, e) {
|
|
10688
10692
|
try {
|
|
10689
|
-
const t = window.localStorage.getItem(`${
|
|
10693
|
+
const t = window.localStorage.getItem(`${yn}${s}`);
|
|
10690
10694
|
if (!t)
|
|
10691
10695
|
return null;
|
|
10692
10696
|
const i = JSON.parse(t), n = typeof i.sessionId == "string" ? i.sessionId : null;
|
|
10693
10697
|
if (e !== void 0 && n !== e)
|
|
10694
10698
|
return null;
|
|
10695
|
-
const r = Array.isArray(i.messages) ? i.messages.map(
|
|
10699
|
+
const r = Array.isArray(i.messages) ? i.messages.map(gl).filter((o) => !!o) : [];
|
|
10696
10700
|
return {
|
|
10697
10701
|
sessionId: n,
|
|
10698
10702
|
messages: r
|
|
@@ -10706,20 +10710,20 @@ function fs(s) {
|
|
|
10706
10710
|
// running tool or commentary history from disappearing while authoritative hydration is still in flight.
|
|
10707
10711
|
s.role === "tool" || s.dataType === "run_status" || s.dataType === "run_error";
|
|
10708
10712
|
}
|
|
10709
|
-
function
|
|
10713
|
+
function rl(s, e) {
|
|
10710
10714
|
try {
|
|
10711
10715
|
window.localStorage.setItem(
|
|
10712
|
-
`${
|
|
10716
|
+
`${yn}${s}`,
|
|
10713
10717
|
JSON.stringify({
|
|
10714
10718
|
sessionId: e.sessionId,
|
|
10715
|
-
messages: e.messages.filter(fs).slice(-
|
|
10719
|
+
messages: e.messages.filter(fs).slice(-Da).map(yl)
|
|
10716
10720
|
})
|
|
10717
10721
|
);
|
|
10718
10722
|
} catch {
|
|
10719
10723
|
return;
|
|
10720
10724
|
}
|
|
10721
10725
|
}
|
|
10722
|
-
function
|
|
10726
|
+
function ol(s) {
|
|
10723
10727
|
try {
|
|
10724
10728
|
const e = window.localStorage.getItem(`${as}${s}`);
|
|
10725
10729
|
if (!e)
|
|
@@ -10745,9 +10749,9 @@ function $(s, e) {
|
|
|
10745
10749
|
return;
|
|
10746
10750
|
}
|
|
10747
10751
|
}
|
|
10748
|
-
function
|
|
10752
|
+
function Di(s) {
|
|
10749
10753
|
try {
|
|
10750
|
-
const e = window.localStorage.getItem(`${
|
|
10754
|
+
const e = window.localStorage.getItem(`${mn}${s}`);
|
|
10751
10755
|
if (!e)
|
|
10752
10756
|
return null;
|
|
10753
10757
|
const t = JSON.parse(e);
|
|
@@ -10765,7 +10769,7 @@ function Pi(s) {
|
|
|
10765
10769
|
}
|
|
10766
10770
|
function et(s, e) {
|
|
10767
10771
|
try {
|
|
10768
|
-
const t = `${
|
|
10772
|
+
const t = `${mn}${s}`;
|
|
10769
10773
|
if (!e) {
|
|
10770
10774
|
window.localStorage.removeItem(t);
|
|
10771
10775
|
return;
|
|
@@ -10775,7 +10779,7 @@ function et(s, e) {
|
|
|
10775
10779
|
return;
|
|
10776
10780
|
}
|
|
10777
10781
|
}
|
|
10778
|
-
function
|
|
10782
|
+
function kn(s, e) {
|
|
10779
10783
|
try {
|
|
10780
10784
|
const t = `${bt}${s}`, i = location.href, n = location.origin, r = Array.from(e, (o) => ({
|
|
10781
10785
|
...o,
|
|
@@ -10791,28 +10795,28 @@ function An(s, e) {
|
|
|
10791
10795
|
} catch {
|
|
10792
10796
|
}
|
|
10793
10797
|
}
|
|
10794
|
-
function
|
|
10798
|
+
function Ui(s, e) {
|
|
10795
10799
|
try {
|
|
10796
10800
|
if (window.sessionStorage.getItem(`${bt}${s}`) === null)
|
|
10797
10801
|
return;
|
|
10798
10802
|
} catch {
|
|
10799
10803
|
return;
|
|
10800
10804
|
}
|
|
10801
|
-
|
|
10805
|
+
kn(s, e);
|
|
10802
10806
|
}
|
|
10803
|
-
function
|
|
10807
|
+
function al(s) {
|
|
10804
10808
|
try {
|
|
10805
10809
|
const e = `${bt}${s}`, t = window.sessionStorage.getItem(e);
|
|
10806
10810
|
if (window.sessionStorage.removeItem(e), !t)
|
|
10807
10811
|
return [];
|
|
10808
10812
|
const i = JSON.parse(t);
|
|
10809
|
-
return Array.isArray(i) ? i.flatMap((n) =>
|
|
10813
|
+
return Array.isArray(i) ? i.flatMap((n) => ll(n) ? [{
|
|
10810
10814
|
...n.event,
|
|
10811
10815
|
page: W(),
|
|
10812
10816
|
rawOutput: {
|
|
10813
10817
|
pageContextRestarted: !0,
|
|
10814
10818
|
outcome: "unknown",
|
|
10815
|
-
message:
|
|
10819
|
+
message: cl(location.href),
|
|
10816
10820
|
currentUrl: location.href,
|
|
10817
10821
|
console: [],
|
|
10818
10822
|
metadata: {
|
|
@@ -10829,17 +10833,17 @@ function ol(s) {
|
|
|
10829
10833
|
return [];
|
|
10830
10834
|
}
|
|
10831
10835
|
}
|
|
10832
|
-
function
|
|
10836
|
+
function cl(s) {
|
|
10833
10837
|
return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
|
|
10834
10838
|
Current URL: ${s}`;
|
|
10835
10839
|
}
|
|
10836
|
-
function
|
|
10840
|
+
function ll(s) {
|
|
10837
10841
|
if (!s || typeof s != "object")
|
|
10838
10842
|
return !1;
|
|
10839
10843
|
const e = s, t = e.event;
|
|
10840
10844
|
return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" && Es(t) && t.type === "tool.result";
|
|
10841
10845
|
}
|
|
10842
|
-
function
|
|
10846
|
+
function dl(s, e) {
|
|
10843
10847
|
const t = new Set(
|
|
10844
10848
|
s.flatMap((i) => i.type === "tool.result" ? [i.callId] : [])
|
|
10845
10849
|
);
|
|
@@ -10848,7 +10852,7 @@ function ll(s, e) {
|
|
|
10848
10852
|
...e.filter((i) => !t.has(i.callId))
|
|
10849
10853
|
];
|
|
10850
10854
|
}
|
|
10851
|
-
function
|
|
10855
|
+
function ul(s) {
|
|
10852
10856
|
try {
|
|
10853
10857
|
window.sessionStorage.removeItem(`${bt}${s}`);
|
|
10854
10858
|
} catch {
|
|
@@ -10859,15 +10863,15 @@ function Es(s) {
|
|
|
10859
10863
|
if (!s || typeof s != "object")
|
|
10860
10864
|
return !1;
|
|
10861
10865
|
const e = s;
|
|
10862
|
-
return e.type === "chat.user_message" ? typeof e.content == "string" &&
|
|
10866
|
+
return e.type === "chat.user_message" ? typeof e.content == "string" && qi(e.page) : e.type === "page.upsert" || e.type === "session.reset" || e.type === "network.batch" ? qi(e.page) : e.type === "tool.result" ? typeof e.sessionId == "string" && typeof e.callId == "string" && (e.toolName === "execute_code" || e.toolName === "execute_code_in_browser_tab") : e.type === "chat.retry_last_user_message" ? typeof e.sessionId == "string" && typeof e.clientMessageId == "string" : e.type === "run.stop" ? typeof e.sessionId == "string" && (e.reason === "user_requested" || e.reason === "new_chat" || e.reason === "session_switch") : !1;
|
|
10863
10867
|
}
|
|
10864
|
-
function
|
|
10868
|
+
function qi(s) {
|
|
10865
10869
|
if (!s || typeof s != "object")
|
|
10866
10870
|
return !1;
|
|
10867
10871
|
const e = s;
|
|
10868
10872
|
return typeof e.url == "string" && typeof e.title == "string" && typeof e.origin == "string";
|
|
10869
10873
|
}
|
|
10870
|
-
function
|
|
10874
|
+
function Mn(s, e) {
|
|
10871
10875
|
if (!Array.isArray(s))
|
|
10872
10876
|
return;
|
|
10873
10877
|
const t = s.filter((n) => {
|
|
@@ -10875,41 +10879,41 @@ function kn(s, e) {
|
|
|
10875
10879
|
return !1;
|
|
10876
10880
|
const r = n;
|
|
10877
10881
|
return typeof r.name == "string" && typeof r.mimeType == "string" && typeof r.sizeBytes == "number";
|
|
10878
|
-
}), i = e ? t.map((n) =>
|
|
10882
|
+
}), i = e ? t.map((n) => En(n, e)) : t;
|
|
10879
10883
|
return i.length > 0 ? i : void 0;
|
|
10880
10884
|
}
|
|
10881
|
-
function
|
|
10885
|
+
function En(s, e) {
|
|
10882
10886
|
return s.fileUrl?.startsWith("/") ? {
|
|
10883
10887
|
...s,
|
|
10884
10888
|
fileUrl: new URL(s.fileUrl, e).toString()
|
|
10885
10889
|
} : s;
|
|
10886
10890
|
}
|
|
10887
10891
|
function gs(s) {
|
|
10888
|
-
return s.type ||
|
|
10892
|
+
return s.type || fl(s.name) || "application/octet-stream";
|
|
10889
10893
|
}
|
|
10890
|
-
function
|
|
10891
|
-
|
|
10894
|
+
function hl(s) {
|
|
10895
|
+
Cn({
|
|
10892
10896
|
name: s.name,
|
|
10893
10897
|
mimeType: gs(s),
|
|
10894
10898
|
sizeBytes: s.size
|
|
10895
10899
|
});
|
|
10896
10900
|
}
|
|
10897
|
-
function
|
|
10898
|
-
const e =
|
|
10899
|
-
if (!
|
|
10901
|
+
function Cn(s) {
|
|
10902
|
+
const e = pl(s.name), t = s.mimeType.trim().toLowerCase();
|
|
10903
|
+
if (!Ea.has(`${e}:${t}`))
|
|
10900
10904
|
throw new Error("This attachment type is not supported by the embedded model provider");
|
|
10901
|
-
if (s.sizeBytes <= 0 || s.sizeBytes >=
|
|
10905
|
+
if (s.sizeBytes <= 0 || s.sizeBytes >= fn)
|
|
10902
10906
|
throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
|
|
10903
10907
|
}
|
|
10904
|
-
function
|
|
10908
|
+
function pl(s) {
|
|
10905
10909
|
const e = s.trim().toLowerCase(), t = e.lastIndexOf(".");
|
|
10906
10910
|
return t >= 0 ? e.slice(t) : "";
|
|
10907
10911
|
}
|
|
10908
|
-
function
|
|
10912
|
+
function fl(s) {
|
|
10909
10913
|
const e = s.toLowerCase();
|
|
10910
10914
|
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;
|
|
10911
10915
|
}
|
|
10912
|
-
function
|
|
10916
|
+
function gl(s) {
|
|
10913
10917
|
if (!s || typeof s != "object")
|
|
10914
10918
|
return null;
|
|
10915
10919
|
const e = s;
|
|
@@ -10927,11 +10931,11 @@ function fl(s) {
|
|
|
10927
10931
|
scheduledCheckInId: typeof e.scheduledCheckInId == "string" ? e.scheduledCheckInId : void 0,
|
|
10928
10932
|
scheduledCheckInAt: typeof e.scheduledCheckInAt == "string" ? e.scheduledCheckInAt : void 0,
|
|
10929
10933
|
securitySettingsUrl: typeof e.securitySettingsUrl == "string" ? e.securitySettingsUrl : void 0,
|
|
10930
|
-
attachments:
|
|
10934
|
+
attachments: Mn(e.attachments)?.map(yt),
|
|
10931
10935
|
loading: typeof e.loading == "boolean" ? e.loading : void 0
|
|
10932
10936
|
};
|
|
10933
10937
|
}
|
|
10934
|
-
function
|
|
10938
|
+
function yl(s) {
|
|
10935
10939
|
return s.attachments?.length ? {
|
|
10936
10940
|
...s,
|
|
10937
10941
|
attachments: s.attachments.map(yt)
|
|
@@ -10947,7 +10951,7 @@ function yt(s) {
|
|
|
10947
10951
|
} = s;
|
|
10948
10952
|
return r;
|
|
10949
10953
|
}
|
|
10950
|
-
function
|
|
10954
|
+
function j(s) {
|
|
10951
10955
|
const e = s.respondsToUserMessageId;
|
|
10952
10956
|
return typeof e == "string" && e ? e : null;
|
|
10953
10957
|
}
|
|
@@ -10955,11 +10959,11 @@ function E(s) {
|
|
|
10955
10959
|
const e = s.runId;
|
|
10956
10960
|
return typeof e == "string" && e ? e : null;
|
|
10957
10961
|
}
|
|
10958
|
-
function
|
|
10962
|
+
function ml(s) {
|
|
10959
10963
|
const e = s?.timeoutMs;
|
|
10960
|
-
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 <=
|
|
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 <= $a);
|
|
10961
10965
|
}
|
|
10962
|
-
function
|
|
10966
|
+
function Pn(s) {
|
|
10963
10967
|
const e = {};
|
|
10964
10968
|
try {
|
|
10965
10969
|
new Headers(s).forEach((t, i) => {
|
|
@@ -10971,23 +10975,23 @@ function Cn(s) {
|
|
|
10971
10975
|
return e;
|
|
10972
10976
|
}
|
|
10973
10977
|
function Cs(s, e) {
|
|
10974
|
-
return
|
|
10978
|
+
return Bn(s) ? _t : ee(It(e), Ca);
|
|
10975
10979
|
}
|
|
10976
|
-
function
|
|
10980
|
+
function Il(s, e) {
|
|
10977
10981
|
return typeof s == "string" ? s : s instanceof URL ? s.toString() : e?.url ?? "";
|
|
10978
10982
|
}
|
|
10979
|
-
async function
|
|
10980
|
-
const n =
|
|
10983
|
+
async function Sl(s, e, t, i) {
|
|
10984
|
+
const n = Pn(s.headers);
|
|
10981
10985
|
i({
|
|
10982
10986
|
...e,
|
|
10983
10987
|
responseStatus: s.status,
|
|
10984
10988
|
responseHeaders: n,
|
|
10985
|
-
responseBody: await
|
|
10989
|
+
responseBody: await wl(s),
|
|
10986
10990
|
durationMs: Date.now() - t
|
|
10987
10991
|
});
|
|
10988
10992
|
}
|
|
10989
|
-
async function
|
|
10990
|
-
if (!
|
|
10993
|
+
async function wl(s) {
|
|
10994
|
+
if (!Dn(s.headers))
|
|
10991
10995
|
return;
|
|
10992
10996
|
let e = null, t = null;
|
|
10993
10997
|
try {
|
|
@@ -10996,7 +11000,7 @@ async function Sl(s) {
|
|
|
10996
11000
|
const i = new Promise((a) => {
|
|
10997
11001
|
t = window.setTimeout(() => {
|
|
10998
11002
|
e?.cancel(), a("timeout");
|
|
10999
|
-
},
|
|
11003
|
+
}, Pa);
|
|
11000
11004
|
}), n = new TextDecoder();
|
|
11001
11005
|
let r = "", o = 0;
|
|
11002
11006
|
for (; ; ) {
|
|
@@ -11018,26 +11022,26 @@ async function Sl(s) {
|
|
|
11018
11022
|
t !== null && window.clearTimeout(t);
|
|
11019
11023
|
}
|
|
11020
11024
|
}
|
|
11021
|
-
function
|
|
11022
|
-
if (
|
|
11025
|
+
function bl(s, e) {
|
|
11026
|
+
if (Dn(new Headers(e)))
|
|
11023
11027
|
try {
|
|
11024
11028
|
return s.responseType === "" || s.responseType === "text" ? ee(s.responseText ?? "") : void 0;
|
|
11025
11029
|
} catch {
|
|
11026
11030
|
return;
|
|
11027
11031
|
}
|
|
11028
11032
|
}
|
|
11029
|
-
function
|
|
11033
|
+
function Oi(s) {
|
|
11030
11034
|
if (typeof s == "string")
|
|
11031
11035
|
return ee(s);
|
|
11032
11036
|
}
|
|
11033
|
-
function
|
|
11037
|
+
function vl(s) {
|
|
11034
11038
|
return V({
|
|
11035
11039
|
...s,
|
|
11036
|
-
requestBody:
|
|
11037
|
-
responseBody:
|
|
11040
|
+
requestBody: xi(s.requestBody),
|
|
11041
|
+
responseBody: xi(s.responseBody)
|
|
11038
11042
|
});
|
|
11039
11043
|
}
|
|
11040
|
-
function
|
|
11044
|
+
function xi(s) {
|
|
11041
11045
|
if (typeof s != "string")
|
|
11042
11046
|
return s;
|
|
11043
11047
|
const e = s.trim();
|
|
@@ -11049,14 +11053,14 @@ function Oi(s) {
|
|
|
11049
11053
|
return It(s);
|
|
11050
11054
|
}
|
|
11051
11055
|
}
|
|
11052
|
-
function
|
|
11056
|
+
function Dn(s) {
|
|
11053
11057
|
if (!s)
|
|
11054
11058
|
return !1;
|
|
11055
11059
|
const e = s.get("content-type")?.toLowerCase() ?? "", t = s.get("content-length"), i = Number(t);
|
|
11056
11060
|
return t !== null && Number.isInteger(i) && i >= 0 && i <= Rs && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
|
|
11057
11061
|
}
|
|
11058
11062
|
function fe(s, e = {}, t) {
|
|
11059
|
-
if (
|
|
11063
|
+
if (_l(t))
|
|
11060
11064
|
return !0;
|
|
11061
11065
|
const i = Object.entries(e).find(([n]) => n.toLowerCase() === "content-type")?.[1]?.toLowerCase();
|
|
11062
11066
|
if (i?.includes("multipart/form-data") || i?.includes("application/octet-stream"))
|
|
@@ -11071,7 +11075,7 @@ function fe(s, e = {}, t) {
|
|
|
11071
11075
|
return !0;
|
|
11072
11076
|
}
|
|
11073
11077
|
}
|
|
11074
|
-
function
|
|
11078
|
+
function Tl(s, e) {
|
|
11075
11079
|
if (fe(s))
|
|
11076
11080
|
return !0;
|
|
11077
11081
|
try {
|
|
@@ -11081,10 +11085,10 @@ function vl(s, e) {
|
|
|
11081
11085
|
return !0;
|
|
11082
11086
|
}
|
|
11083
11087
|
}
|
|
11084
|
-
function
|
|
11088
|
+
function _l(s) {
|
|
11085
11089
|
return s instanceof FormData || s instanceof Blob || s instanceof ArrayBuffer || ArrayBuffer.isView(s) || typeof ReadableStream < "u" && s instanceof ReadableStream;
|
|
11086
11090
|
}
|
|
11087
|
-
function
|
|
11091
|
+
function Rl(s) {
|
|
11088
11092
|
const e = {};
|
|
11089
11093
|
for (const t of s.trim().split(/[\r\n]+/)) {
|
|
11090
11094
|
const i = t.indexOf(":");
|
|
@@ -11111,31 +11115,31 @@ class ht extends Error {
|
|
|
11111
11115
|
}
|
|
11112
11116
|
async function tt(s, e) {
|
|
11113
11117
|
let t = null;
|
|
11114
|
-
for (let i = 0; i <
|
|
11118
|
+
for (let i = 0; i < ui; i += 1)
|
|
11115
11119
|
try {
|
|
11116
11120
|
return await s();
|
|
11117
11121
|
} catch (n) {
|
|
11118
|
-
if (t = n, i >=
|
|
11122
|
+
if (t = n, i >= ui - 1 || !kl(n))
|
|
11119
11123
|
throw n;
|
|
11120
|
-
await
|
|
11124
|
+
await Al(i);
|
|
11121
11125
|
}
|
|
11122
11126
|
throw t instanceof Error ? t : new Error(e);
|
|
11123
11127
|
}
|
|
11124
|
-
function
|
|
11128
|
+
function Al(s) {
|
|
11125
11129
|
return new Promise((e) => {
|
|
11126
|
-
window.setTimeout(e,
|
|
11130
|
+
window.setTimeout(e, Ma[s] ?? 0);
|
|
11127
11131
|
});
|
|
11128
11132
|
}
|
|
11129
|
-
function Al(s) {
|
|
11130
|
-
return s instanceof ht ? kl(s.status) : s instanceof TypeError;
|
|
11131
|
-
}
|
|
11132
11133
|
function kl(s) {
|
|
11133
|
-
return s
|
|
11134
|
+
return s instanceof ht ? Ml(s.status) : s instanceof TypeError;
|
|
11134
11135
|
}
|
|
11135
11136
|
function Ml(s) {
|
|
11137
|
+
return s === 408 || s === 409 || s === 429 || s >= 500;
|
|
11138
|
+
}
|
|
11139
|
+
function El(s) {
|
|
11136
11140
|
return s === 401 || s === 403;
|
|
11137
11141
|
}
|
|
11138
|
-
const _t = "[REDACTED_SECRET]", te = "[REDACTED_TOKEN]",
|
|
11142
|
+
const _t = "[REDACTED_SECRET]", te = "[REDACTED_TOKEN]", Cl = "[REDACTED_SIGNED_URL]", Pl = 20, Dl = /^(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, Ul = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, ql = /\bhttps?:\/\/[^\s"'<>]+/gi, Ol = /[),.;\]]+$/;
|
|
11139
11143
|
function V(s) {
|
|
11140
11144
|
return mt(s, 0, /* @__PURE__ */ new WeakSet());
|
|
11141
11145
|
}
|
|
@@ -11144,7 +11148,7 @@ function mt(s, e, t) {
|
|
|
11144
11148
|
return s.startsWith("data:image/") || s.startsWith("data:application/pdf;") ? s : It(s);
|
|
11145
11149
|
if (s === null || typeof s != "object")
|
|
11146
11150
|
return s;
|
|
11147
|
-
if (e >=
|
|
11151
|
+
if (e >= Pl)
|
|
11148
11152
|
return "[REDACTED_MAX_DEPTH]";
|
|
11149
11153
|
if (t.has(s))
|
|
11150
11154
|
return "[REDACTED_CIRCULAR]";
|
|
@@ -11152,43 +11156,43 @@ function mt(s, e, t) {
|
|
|
11152
11156
|
return s.map((n) => mt(n, e + 1, t));
|
|
11153
11157
|
const i = {};
|
|
11154
11158
|
for (const [n, r] of Object.entries(s))
|
|
11155
|
-
n === "pageContent" ? i[n] = r :
|
|
11159
|
+
n === "pageContent" ? i[n] = r : Bn(n) ? i[n] = _t : i[n] = n.toLowerCase() === "url" ? xl(r) : mt(r, e + 1, t);
|
|
11156
11160
|
return i;
|
|
11157
11161
|
}
|
|
11158
|
-
function
|
|
11162
|
+
function Bn(s) {
|
|
11159
11163
|
const e = s.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
11160
11164
|
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");
|
|
11161
11165
|
}
|
|
11162
|
-
function
|
|
11163
|
-
return typeof s == "string" ?
|
|
11166
|
+
function xl(s) {
|
|
11167
|
+
return typeof s == "string" ? Nn(s) : mt(s, 0, /* @__PURE__ */ new WeakSet());
|
|
11164
11168
|
}
|
|
11165
|
-
function
|
|
11169
|
+
function Nn(s) {
|
|
11166
11170
|
try {
|
|
11167
11171
|
const e = new URL(s, location.href);
|
|
11168
11172
|
for (const t of Array.from(e.searchParams.keys()))
|
|
11169
|
-
|
|
11173
|
+
Dl.test(t) && e.searchParams.set(t, te);
|
|
11170
11174
|
return e.username && (e.username = te), e.password && (e.password = te), e.toString();
|
|
11171
11175
|
} catch {
|
|
11172
|
-
return
|
|
11176
|
+
return Bl(s);
|
|
11173
11177
|
}
|
|
11174
11178
|
}
|
|
11175
11179
|
function It(s) {
|
|
11176
|
-
return s.replace(
|
|
11177
|
-
}
|
|
11178
|
-
function xl(s) {
|
|
11179
|
-
return s.replace(Dn, `Bearer ${te}`).replace(Un, `Basic ${te}`).replace(qn, te).replace(On, (e, t) => `${t}: ${_t}`);
|
|
11180
|
+
return s.replace(Ul, Cl).replace(ql, Nl).replace(Un, `Bearer ${te}`).replace(qn, `Basic ${te}`).replace(On, te).replace(xn, (e, t) => `${t}: ${_t}`);
|
|
11180
11181
|
}
|
|
11181
11182
|
function Bl(s) {
|
|
11182
|
-
|
|
11183
|
-
|
|
11183
|
+
return s.replace(Un, `Bearer ${te}`).replace(qn, `Basic ${te}`).replace(On, te).replace(xn, (e, t) => `${t}: ${_t}`);
|
|
11184
|
+
}
|
|
11185
|
+
function Nl(s) {
|
|
11186
|
+
const e = s.match(Ol)?.[0] ?? "", t = e ? s.slice(0, -e.length) : s;
|
|
11187
|
+
return `${Nn(t)}${e}`;
|
|
11184
11188
|
}
|
|
11185
|
-
const
|
|
11189
|
+
const Gl = Object.freeze({
|
|
11186
11190
|
init: (s) => vt.init(s)
|
|
11187
11191
|
});
|
|
11188
|
-
function
|
|
11192
|
+
function Jl(s) {
|
|
11189
11193
|
return vt.init(s);
|
|
11190
11194
|
}
|
|
11191
|
-
function
|
|
11195
|
+
function Bi(s) {
|
|
11192
11196
|
const e = /* @__PURE__ */ new Map();
|
|
11193
11197
|
for (const t of [...s].reverse()) {
|
|
11194
11198
|
const i = t.integrationAuthRequest;
|
|
@@ -11197,34 +11201,34 @@ function xi(s) {
|
|
|
11197
11201
|
return [...e.values()];
|
|
11198
11202
|
}
|
|
11199
11203
|
export {
|
|
11200
|
-
|
|
11201
|
-
|
|
11202
|
-
|
|
11203
|
-
|
|
11204
|
-
|
|
11205
|
-
|
|
11206
|
-
|
|
11207
|
-
|
|
11208
|
-
|
|
11204
|
+
ni as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
|
|
11205
|
+
oa as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
|
|
11206
|
+
ra as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
|
|
11207
|
+
aa as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
|
|
11208
|
+
Ql as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
|
|
11209
|
+
Gl as PlunoProductAgent,
|
|
11210
|
+
Ko as ProductAgentInteractionManager,
|
|
11211
|
+
ei as ProductAgentQueryController,
|
|
11212
|
+
Vl as ProductAgentRemoteRuntimeClient,
|
|
11209
11213
|
vt as ProductAgentSessionEngine,
|
|
11210
|
-
|
|
11211
|
-
|
|
11214
|
+
$l as ProductAgentSessionHistoryManager,
|
|
11215
|
+
Wl as ProductAgentTaskPageTitleController,
|
|
11212
11216
|
ne as ProductAgentTokenProviderError,
|
|
11213
|
-
|
|
11214
|
-
|
|
11217
|
+
xa as calculateReconnectDelay,
|
|
11218
|
+
Fl as createLocalStorageInteractionDecisionStorage,
|
|
11215
11219
|
lt as createProductAgentQueryState,
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
|
|
11220
|
-
|
|
11221
|
-
|
|
11222
|
-
|
|
11220
|
+
Jl as createProductAgentRuntime,
|
|
11221
|
+
zl as createProductAgentTaskPageTitleDocument,
|
|
11222
|
+
Gl as default,
|
|
11223
|
+
ta as formatProductAgentTaskPageTitle,
|
|
11224
|
+
rc as getProductAgentOriginAccessErrorMessage,
|
|
11225
|
+
Kl as isProductAgentRuntimeCommand,
|
|
11226
|
+
Qo as mergeProductAgentEntityPages,
|
|
11223
11227
|
dt as normalizeProductAgentEntityPage,
|
|
11224
11228
|
Wt as normalizeProductAgentSessionItems,
|
|
11225
|
-
|
|
11229
|
+
Vo as readLocalStorageInteractionDecisions,
|
|
11226
11230
|
Hl as resolveProductAgentComposerAction,
|
|
11227
|
-
|
|
11228
|
-
|
|
11229
|
-
|
|
11231
|
+
jl as resolveProductAgentWidgetPresentation,
|
|
11232
|
+
Go as selectProductAgentQueryEntities,
|
|
11233
|
+
hl as validateProductAgentProviderInputFile
|
|
11230
11234
|
};
|