@pluno/product-agent-web 0.1.206 → 0.1.208
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/displayedErrorMessage.d.ts +2 -0
- package/dist/displayedErrors.d.ts +3 -1
- package/dist/index.d.ts +1 -1
- package/dist/product-agent-runtime.cjs +1 -1
- package/dist/product-agent-runtime.js +62 -53
- package/dist/product-agent-sdk.js +613 -601
- package/dist/product-agent-widget.js +3217 -3166
- package/dist/runtimeClient.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
|
|
1
|
+
function hs(s) {
|
|
2
|
+
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();
|
|
3
|
+
return e.length > 500 ? `${e.slice(0, 499)}…` : e;
|
|
4
|
+
}
|
|
5
|
+
const Ks = "pluno-product-agent-attachments", Gs = 1, it = "files", Qs = 1440 * 60 * 1e3;
|
|
6
|
+
async function Vs(s) {
|
|
4
7
|
const e = await mt();
|
|
5
|
-
await
|
|
8
|
+
await Ys(e, "readwrite", (t) => t.put(s));
|
|
6
9
|
}
|
|
7
|
-
async function
|
|
10
|
+
async function Xs(s, e) {
|
|
8
11
|
const t = await mt();
|
|
9
12
|
await yt(t, "readwrite", async (n) => {
|
|
10
13
|
const i = await It(
|
|
@@ -16,7 +19,7 @@ async function Gs(s, e) {
|
|
|
16
19
|
});
|
|
17
20
|
});
|
|
18
21
|
}
|
|
19
|
-
async function
|
|
22
|
+
async function Js(s = Qs) {
|
|
20
23
|
const e = await mt(), t = Date.now() - s;
|
|
21
24
|
await yt(e, "readwrite", async (n) => {
|
|
22
25
|
const i = n.index("lastUsedAt");
|
|
@@ -25,14 +28,14 @@ async function Qs(s = 864e5) {
|
|
|
25
28
|
}
|
|
26
29
|
function mt() {
|
|
27
30
|
return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((s, e) => {
|
|
28
|
-
const t = indexedDB.open(
|
|
31
|
+
const t = indexedDB.open(Ks, Gs);
|
|
29
32
|
t.onupgradeneeded = () => {
|
|
30
33
|
const i = t.result.createObjectStore(it, { keyPath: "attachmentId" });
|
|
31
34
|
i.createIndex("lastUsedAt", "lastUsedAt", { unique: !1 }), i.createIndex("sessionId", "sessionId", { unique: !1 }), i.createIndex("origin", "origin", { unique: !1 });
|
|
32
35
|
}, t.onsuccess = () => s(t.result), t.onerror = () => e(t.error ?? new Error("Failed to open Product Agent attachment storage"));
|
|
33
36
|
});
|
|
34
37
|
}
|
|
35
|
-
async function
|
|
38
|
+
async function Ys(s, e, t) {
|
|
36
39
|
return await yt(s, e, async (n) => await It(t(n)));
|
|
37
40
|
}
|
|
38
41
|
function yt(s, e, t) {
|
|
@@ -62,11 +65,11 @@ function It(s) {
|
|
|
62
65
|
s.onsuccess = () => e(s.result), s.onerror = () => t(s.error ?? new Error("Product Agent attachment storage request failed"));
|
|
63
66
|
});
|
|
64
67
|
}
|
|
65
|
-
function
|
|
68
|
+
function Zs(s) {
|
|
66
69
|
return s !== null && (typeof s == "object" || typeof s == "function");
|
|
67
70
|
}
|
|
68
|
-
function
|
|
69
|
-
const n = Reflect.get(s, "pluno"), i =
|
|
71
|
+
function ps(s, e, t) {
|
|
72
|
+
const n = Reflect.get(s, "pluno"), i = Zs(n) ? n : {};
|
|
70
73
|
if (i !== n && !Reflect.set(s, "pluno", i))
|
|
71
74
|
return null;
|
|
72
75
|
const r = Object.getOwnPropertyDescriptor(i, e);
|
|
@@ -80,20 +83,20 @@ function hs(s, e, t) {
|
|
|
80
83
|
}
|
|
81
84
|
};
|
|
82
85
|
}
|
|
83
|
-
const
|
|
86
|
+
const en = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
|
|
84
87
|
function vt(s, e) {
|
|
85
88
|
return e ? s.replace(
|
|
86
|
-
|
|
89
|
+
en,
|
|
87
90
|
(t, n, i, r) => `${n}${new URL(i, e).toString()}${r}`
|
|
88
91
|
) : s;
|
|
89
92
|
}
|
|
90
93
|
const St = "suggest_share_on_socials";
|
|
91
|
-
function
|
|
94
|
+
function tn(s) {
|
|
92
95
|
for (let e = s.length - 1; e >= 0; e -= 1) {
|
|
93
96
|
const t = s[e];
|
|
94
97
|
if (t.role !== "tool" || t.toolName !== St || t.sharePromptAllowed !== void 0)
|
|
95
98
|
continue;
|
|
96
|
-
if (
|
|
99
|
+
if (nn(s, e, t.callId) !== !0)
|
|
97
100
|
return null;
|
|
98
101
|
const n = Ut(s, e, "assistant");
|
|
99
102
|
if (!n)
|
|
@@ -107,7 +110,7 @@ function Ys(s) {
|
|
|
107
110
|
}
|
|
108
111
|
return null;
|
|
109
112
|
}
|
|
110
|
-
function
|
|
113
|
+
function sn(s) {
|
|
111
114
|
let e = s;
|
|
112
115
|
if (typeof s == "string")
|
|
113
116
|
try {
|
|
@@ -115,10 +118,10 @@ function Zs(s) {
|
|
|
115
118
|
} catch {
|
|
116
119
|
return null;
|
|
117
120
|
}
|
|
118
|
-
const t =
|
|
121
|
+
const t = rn(e);
|
|
119
122
|
return t ? typeof t.showSharePrompt == "boolean" ? t.showSharePrompt : t.ok === !0 && typeof t.message == "string" && t.message.includes("social-sharing prompt") ? !0 : null : null;
|
|
120
123
|
}
|
|
121
|
-
function
|
|
124
|
+
function nn(s, e, t) {
|
|
122
125
|
if (!t)
|
|
123
126
|
return null;
|
|
124
127
|
for (let n = e + 1; n < s.length; n += 1) {
|
|
@@ -136,14 +139,14 @@ function Ut(s, e, t) {
|
|
|
136
139
|
}
|
|
137
140
|
return null;
|
|
138
141
|
}
|
|
139
|
-
function
|
|
142
|
+
function rn(s) {
|
|
140
143
|
return s && typeof s == "object" && !Array.isArray(s) ? s : null;
|
|
141
144
|
}
|
|
142
|
-
const
|
|
143
|
-
function
|
|
144
|
-
return (s.type === "function_call" || s.type === "tool_call") && s.name ===
|
|
145
|
+
const on = "save_runtime_captured_skill";
|
|
146
|
+
function an(s) {
|
|
147
|
+
return (s.type === "function_call" || s.type === "tool_call") && s.name === on;
|
|
145
148
|
}
|
|
146
|
-
function
|
|
149
|
+
function ln(s, e, t) {
|
|
147
150
|
const n = e.map((h) => ({ item: h, identity: t(h) })), i = new Set(
|
|
148
151
|
n.flatMap(
|
|
149
152
|
({ identity: h }) => h.isActivity && !h.isTransient ? h.activityKeys ?? [] : []
|
|
@@ -187,11 +190,11 @@ function Dt(s, e, t, n) {
|
|
|
187
190
|
return !r.isActivity || !r.isTransient ? !0 : e !== null && r.respondsToUserMessageId !== void 0 ? r.respondsToUserMessageId !== e : t === null || r.runId !== t;
|
|
188
191
|
});
|
|
189
192
|
}
|
|
190
|
-
const
|
|
193
|
+
const Ke = "pluno.productAgent.transportId", cn = "pluno.productAgent.transportIdentity", Ge = "pluno.productAgent.transportIdentity.event", un = 50, dn = globalThis.setTimeout.bind(globalThis);
|
|
191
194
|
let le = null;
|
|
192
|
-
const
|
|
193
|
-
async function
|
|
194
|
-
const e = s.randomUUID(), t = s.storage.getItem(
|
|
195
|
+
const Re = /* @__PURE__ */ new Set(), Qe = /* @__PURE__ */ new Map();
|
|
196
|
+
async function hn(s = gs()) {
|
|
197
|
+
const e = s.randomUUID(), t = s.storage.getItem(Ke);
|
|
195
198
|
let n = t ?? s.randomUUID(), i = !1, r = !1;
|
|
196
199
|
const o = s.channel.subscribe((l) => {
|
|
197
200
|
if (!(l.senderId === e || l.transportId !== n)) {
|
|
@@ -209,7 +212,7 @@ async function cn(s = ps()) {
|
|
|
209
212
|
}
|
|
210
213
|
});
|
|
211
214
|
if (!t)
|
|
212
|
-
s.storage.setItem(
|
|
215
|
+
s.storage.setItem(Ke, n), i = !0;
|
|
213
216
|
else if (s.skipStoredIdentityCollisionCheck)
|
|
214
217
|
i = !0;
|
|
215
218
|
else
|
|
@@ -218,7 +221,7 @@ async function cn(s = ps()) {
|
|
|
218
221
|
i = !0;
|
|
219
222
|
break;
|
|
220
223
|
}
|
|
221
|
-
n = s.randomUUID(), s.storage.setItem(
|
|
224
|
+
n = s.randomUUID(), s.storage.setItem(Ke, n);
|
|
222
225
|
}
|
|
223
226
|
let a = !1;
|
|
224
227
|
return {
|
|
@@ -228,52 +231,52 @@ async function cn(s = ps()) {
|
|
|
228
231
|
}
|
|
229
232
|
};
|
|
230
233
|
}
|
|
231
|
-
async function
|
|
232
|
-
le || (le =
|
|
233
|
-
...
|
|
234
|
+
async function pn(s = !1) {
|
|
235
|
+
le || (le = hn({
|
|
236
|
+
...gs(),
|
|
234
237
|
skipStoredIdentityCollisionCheck: s
|
|
235
238
|
}), le.then((i) => {
|
|
236
239
|
const r = (o) => {
|
|
237
|
-
o.persisted || (i.release(), le = null,
|
|
240
|
+
o.persisted || (i.release(), le = null, Re.clear(), window.removeEventListener("pagehide", r));
|
|
238
241
|
};
|
|
239
242
|
window.addEventListener("pagehide", r);
|
|
240
243
|
}));
|
|
241
|
-
const e = await le, t =
|
|
242
|
-
|
|
244
|
+
const e = await le, t = gn();
|
|
245
|
+
Re.add(t);
|
|
243
246
|
let n = !1;
|
|
244
247
|
return {
|
|
245
248
|
// A stable per-tab base keeps reload routing intact, while slots isolate multiple live SDK instances in one tab.
|
|
246
249
|
transportId: t === 0 ? e.transportId : `${e.transportId}.${t}`,
|
|
247
250
|
release: () => {
|
|
248
|
-
n || (n = !0,
|
|
251
|
+
n || (n = !0, Re.delete(t));
|
|
249
252
|
}
|
|
250
253
|
};
|
|
251
254
|
}
|
|
252
|
-
function
|
|
255
|
+
function gn() {
|
|
253
256
|
let s = 0;
|
|
254
|
-
for (;
|
|
257
|
+
for (; Re.has(s); )
|
|
255
258
|
s += 1;
|
|
256
259
|
return s;
|
|
257
260
|
}
|
|
258
|
-
function
|
|
261
|
+
function gs() {
|
|
259
262
|
return {
|
|
260
|
-
storage:
|
|
261
|
-
channel:
|
|
263
|
+
storage: fn(),
|
|
264
|
+
channel: mn(),
|
|
262
265
|
randomUUID: () => crypto.randomUUID(),
|
|
263
|
-
settle: () => new Promise((s) =>
|
|
266
|
+
settle: () => new Promise((s) => dn(s, un))
|
|
264
267
|
};
|
|
265
268
|
}
|
|
266
|
-
function
|
|
269
|
+
function fn() {
|
|
267
270
|
return {
|
|
268
271
|
getItem: (s) => {
|
|
269
272
|
try {
|
|
270
|
-
return window.sessionStorage?.getItem(s) ??
|
|
273
|
+
return window.sessionStorage?.getItem(s) ?? Qe.get(s) ?? null;
|
|
271
274
|
} catch {
|
|
272
|
-
return
|
|
275
|
+
return Qe.get(s) ?? null;
|
|
273
276
|
}
|
|
274
277
|
},
|
|
275
278
|
setItem: (s, e) => {
|
|
276
|
-
|
|
279
|
+
Qe.set(s, e);
|
|
277
280
|
try {
|
|
278
281
|
window.sessionStorage?.setItem(s, e);
|
|
279
282
|
} catch {
|
|
@@ -281,9 +284,9 @@ function hn() {
|
|
|
281
284
|
}
|
|
282
285
|
};
|
|
283
286
|
}
|
|
284
|
-
function
|
|
287
|
+
function mn() {
|
|
285
288
|
if (typeof BroadcastChannel < "u") {
|
|
286
|
-
const s = new BroadcastChannel(
|
|
289
|
+
const s = new BroadcastChannel(cn);
|
|
287
290
|
return {
|
|
288
291
|
postMessage: (e) => s.postMessage(e),
|
|
289
292
|
subscribe: (e) => {
|
|
@@ -293,11 +296,11 @@ function pn() {
|
|
|
293
296
|
close: () => s.close()
|
|
294
297
|
};
|
|
295
298
|
}
|
|
296
|
-
return
|
|
299
|
+
return yn();
|
|
297
300
|
}
|
|
298
|
-
function
|
|
301
|
+
function yn() {
|
|
299
302
|
const s = /* @__PURE__ */ new Set(), e = (t) => {
|
|
300
|
-
if (t.key !==
|
|
303
|
+
if (t.key !== Ge || !t.newValue)
|
|
301
304
|
return;
|
|
302
305
|
const n = JSON.parse(t.newValue);
|
|
303
306
|
for (const i of s)
|
|
@@ -306,9 +309,9 @@ function gn() {
|
|
|
306
309
|
return window.addEventListener("storage", e), {
|
|
307
310
|
postMessage: (t) => {
|
|
308
311
|
window.localStorage.setItem(
|
|
309
|
-
|
|
312
|
+
Ge,
|
|
310
313
|
JSON.stringify({ ...t, eventId: crypto.randomUUID() })
|
|
311
|
-
), window.localStorage.removeItem(
|
|
314
|
+
), window.localStorage.removeItem(Ge);
|
|
312
315
|
},
|
|
313
316
|
subscribe: (t) => (s.add(t), () => s.delete(t)),
|
|
314
317
|
close: () => {
|
|
@@ -316,8 +319,8 @@ function gn() {
|
|
|
316
319
|
}
|
|
317
320
|
};
|
|
318
321
|
}
|
|
319
|
-
const
|
|
320
|
-
function
|
|
322
|
+
const fs = "schedule_follow_up";
|
|
323
|
+
function In(s) {
|
|
321
324
|
let e = s;
|
|
322
325
|
if (typeof e == "string")
|
|
323
326
|
try {
|
|
@@ -328,48 +331,48 @@ function fn(s) {
|
|
|
328
331
|
if (!e || typeof e != "object")
|
|
329
332
|
return null;
|
|
330
333
|
const t = e;
|
|
331
|
-
return t.ok !== !0 || t.toolName !==
|
|
334
|
+
return t.ok !== !0 || t.toolName !== fs || typeof t.dueAt != "string" || Number.isNaN(Date.parse(t.dueAt)) ? null : {
|
|
332
335
|
id: typeof t.taskId == "string" && t.taskId ? t.taskId : null,
|
|
333
336
|
dueAt: t.dueAt
|
|
334
337
|
};
|
|
335
338
|
}
|
|
336
|
-
const
|
|
339
|
+
const Sn = [
|
|
337
340
|
{ value: "gpt-5.6-sol", label: "gpt-5.6-sol", price: "$$" },
|
|
338
341
|
{ value: "anthropic/claude-sonnet-5", label: "Claude Sonnet 5", price: "$$" },
|
|
339
342
|
{ value: "deepseek/deepseek-v4-flash", label: "DeepSeek V4 Flash", price: "$" }
|
|
340
|
-
],
|
|
343
|
+
], Tn = [
|
|
341
344
|
{ value: "anthropic/claude-opus-5", label: "Claude Opus 5", price: "$$$" },
|
|
342
345
|
{ value: "gpt-5.6-terra", label: "gpt-5.6-terra", price: "$$" }
|
|
343
|
-
],
|
|
344
|
-
...
|
|
345
|
-
...
|
|
346
|
-
],
|
|
346
|
+
], wn = [
|
|
347
|
+
...Sn,
|
|
348
|
+
...Tn
|
|
349
|
+
], Ve = (s) => wn.some((e) => e.value === s);
|
|
347
350
|
function qt(s, e) {
|
|
348
351
|
return s.filter((t, n) => {
|
|
349
352
|
const i = Ot(t);
|
|
350
|
-
return
|
|
353
|
+
return ms(i) ? !s.slice(n + 1).some((r) => {
|
|
351
354
|
const o = Ot(r);
|
|
352
|
-
return
|
|
355
|
+
return ys(i, o) && Is(i, o);
|
|
353
356
|
}) : !0;
|
|
354
357
|
});
|
|
355
358
|
}
|
|
356
|
-
function
|
|
359
|
+
function ms(s) {
|
|
357
360
|
return s.type === "run_status" && s.status === "stopped" && s.reason === "task_tab_closed";
|
|
358
361
|
}
|
|
359
|
-
function
|
|
360
|
-
return s.reason === "task_tab_closed" &&
|
|
362
|
+
function An(s, e) {
|
|
363
|
+
return s.reason === "task_tab_closed" && Is(s, e) && ys(s, e);
|
|
361
364
|
}
|
|
362
365
|
function Ot(s) {
|
|
363
366
|
return s.data && typeof s.data == "object" ? s.data : {};
|
|
364
367
|
}
|
|
365
|
-
function
|
|
368
|
+
function ys(s, e) {
|
|
366
369
|
const t = typeof s.runId == "string" ? s.runId : null, n = typeof e.runId == "string" ? e.runId : null;
|
|
367
|
-
return t && n && t === n ? !1 : e.type === "message" ? e.role === "assistant" : e.type === "run_status" ? !
|
|
370
|
+
return t && n && t === n ? !1 : e.type === "message" ? e.role === "assistant" : e.type === "run_status" ? !ms(e) : e.type === "run_error";
|
|
368
371
|
}
|
|
369
|
-
function
|
|
372
|
+
function Is(s, e) {
|
|
370
373
|
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;
|
|
371
374
|
}
|
|
372
|
-
function
|
|
375
|
+
function Ee(s) {
|
|
373
376
|
return {
|
|
374
377
|
key: s,
|
|
375
378
|
status: "not_requested",
|
|
@@ -381,7 +384,7 @@ function Re(s) {
|
|
|
381
384
|
}
|
|
382
385
|
class xt {
|
|
383
386
|
constructor(e, t, n = (i, r) => r) {
|
|
384
|
-
this.loader = t, this.merge = n, this.state =
|
|
387
|
+
this.loader = t, this.merge = n, this.state = Ee(e);
|
|
385
388
|
}
|
|
386
389
|
loader;
|
|
387
390
|
merge;
|
|
@@ -396,10 +399,10 @@ class xt {
|
|
|
396
399
|
return this.listeners.add(e), e(this.state), () => this.listeners.delete(e);
|
|
397
400
|
}
|
|
398
401
|
setKey(e) {
|
|
399
|
-
e !== this.state.key && (this.state =
|
|
402
|
+
e !== this.state.key && (this.state = Ee(e), this.trailingLoad = null, this.publish());
|
|
400
403
|
}
|
|
401
404
|
reset() {
|
|
402
|
-
this.state =
|
|
405
|
+
this.state = Ee(this.state.key), this.trailingLoad = null, this.publish();
|
|
403
406
|
}
|
|
404
407
|
invalidate() {
|
|
405
408
|
this.state = {
|
|
@@ -464,28 +467,28 @@ function ke(s) {
|
|
|
464
467
|
nextCursor: s.nextCursor
|
|
465
468
|
};
|
|
466
469
|
}
|
|
467
|
-
function
|
|
470
|
+
function Mn(s, e, t) {
|
|
468
471
|
if (t === "replace" || s === null) return e;
|
|
469
472
|
const n = { ...s.entitiesById, ...e.entitiesById }, i = [...s.ids];
|
|
470
473
|
for (const r of e.ids)
|
|
471
474
|
s.entitiesById[r] || i.push(r);
|
|
472
475
|
return { entitiesById: n, ids: i, nextCursor: e.nextCursor };
|
|
473
476
|
}
|
|
474
|
-
function
|
|
477
|
+
function Ss(s) {
|
|
475
478
|
return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
|
|
476
479
|
}
|
|
477
|
-
function
|
|
480
|
+
function Ro(s) {
|
|
478
481
|
return s.visible ? s.minimized ? { state: "minimized" } : { state: s.open ? "visible_open" : "visible_closed" } : { state: "hidden" };
|
|
479
482
|
}
|
|
480
|
-
function
|
|
483
|
+
function bn(s, e) {
|
|
481
484
|
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: [] };
|
|
482
485
|
}
|
|
483
|
-
function
|
|
486
|
+
function Rn(s) {
|
|
484
487
|
if (!s || typeof s != "object") return !1;
|
|
485
488
|
const e = s.paidCreditFallbackModel;
|
|
486
489
|
return typeof e == "string" && e.length > 0;
|
|
487
490
|
}
|
|
488
|
-
function
|
|
491
|
+
function Eo(s) {
|
|
489
492
|
const e = s.hasDraftMessage || s.hasPreSubmittedAttachment;
|
|
490
493
|
return s.hasRunningAssistantTurn && !e ? {
|
|
491
494
|
action: "stop",
|
|
@@ -495,7 +498,7 @@ function Mo(s) {
|
|
|
495
498
|
disabled: !e || !s.canSubmitMessage
|
|
496
499
|
};
|
|
497
500
|
}
|
|
498
|
-
class
|
|
501
|
+
class En {
|
|
499
502
|
constructor(e, t, n = 20) {
|
|
500
503
|
this.loadPage = t, this.limit = n, this.recentQuery = new xt(
|
|
501
504
|
`${e}:recent`,
|
|
@@ -505,7 +508,7 @@ class Mn {
|
|
|
505
508
|
nextCursor: r.nextCursor
|
|
506
509
|
}))
|
|
507
510
|
),
|
|
508
|
-
|
|
511
|
+
Mn
|
|
509
512
|
), this.pinnedQuery = new xt(
|
|
510
513
|
`${e}:pinned`,
|
|
511
514
|
async () => ke({
|
|
@@ -538,7 +541,7 @@ class Mn {
|
|
|
538
541
|
}) : null;
|
|
539
542
|
return {
|
|
540
543
|
key: e.key.slice(0, -7),
|
|
541
|
-
status:
|
|
544
|
+
status: kn(e, t),
|
|
542
545
|
data: a,
|
|
543
546
|
error: e.error ?? t.error,
|
|
544
547
|
requestId: Math.max(e.requestId, t.requestId),
|
|
@@ -647,7 +650,7 @@ class Mn {
|
|
|
647
650
|
function Ie(s) {
|
|
648
651
|
return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
|
|
649
652
|
}
|
|
650
|
-
function
|
|
653
|
+
function kn(s, e) {
|
|
651
654
|
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";
|
|
652
655
|
}
|
|
653
656
|
class Lt {
|
|
@@ -694,7 +697,7 @@ class Lt {
|
|
|
694
697
|
this.schedule(r, e);
|
|
695
698
|
}
|
|
696
699
|
}
|
|
697
|
-
class
|
|
700
|
+
class Cn {
|
|
698
701
|
constructor(e) {
|
|
699
702
|
this.options = e;
|
|
700
703
|
}
|
|
@@ -746,7 +749,7 @@ class Rn {
|
|
|
746
749
|
);
|
|
747
750
|
}
|
|
748
751
|
}
|
|
749
|
-
class
|
|
752
|
+
class _n {
|
|
750
753
|
constructor(e, t = null) {
|
|
751
754
|
this.storage = e, t && (this.decisions = new Map(
|
|
752
755
|
t.filter(rt).map((n) => [this.getDecisionKey(n), n])
|
|
@@ -799,7 +802,7 @@ class kn {
|
|
|
799
802
|
async applyAction(e, t, n) {
|
|
800
803
|
if (!e.allowedActions.includes(t))
|
|
801
804
|
throw new Error(`Interaction ${e.key} does not allow ${t}.`);
|
|
802
|
-
if (!
|
|
805
|
+
if (!Ts(t))
|
|
803
806
|
throw new Error(`Interaction action ${t} is not a persistence decision.`);
|
|
804
807
|
const i = n.now ?? /* @__PURE__ */ new Date(), r = {
|
|
805
808
|
promptKey: e.key,
|
|
@@ -825,51 +828,51 @@ class kn {
|
|
|
825
828
|
return null;
|
|
826
829
|
}
|
|
827
830
|
getDecisionKey(e) {
|
|
828
|
-
const t =
|
|
831
|
+
const t = Xe(e.scope);
|
|
829
832
|
return e.action === "dont_show_again" ? `${t}:category:${e.category}` : `${t}:interaction:${e.promptKey}`;
|
|
830
833
|
}
|
|
831
834
|
getExactKey(e) {
|
|
832
|
-
return `${
|
|
835
|
+
return `${Xe(e.scope)}:interaction:${e.key}`;
|
|
833
836
|
}
|
|
834
837
|
getCategoryKey(e) {
|
|
835
|
-
return `${
|
|
838
|
+
return `${Xe(e.scope)}:category:${e.category}`;
|
|
836
839
|
}
|
|
837
840
|
}
|
|
838
|
-
function
|
|
841
|
+
function ko(s, e) {
|
|
839
842
|
return {
|
|
840
|
-
load: async () =>
|
|
843
|
+
load: async () => Pn(s, e),
|
|
841
844
|
save: async (t) => s.setItem(e, JSON.stringify(t))
|
|
842
845
|
};
|
|
843
846
|
}
|
|
844
|
-
function
|
|
847
|
+
function Pn(s, e) {
|
|
845
848
|
const t = s.getItem(e);
|
|
846
849
|
if (!t) return [];
|
|
847
850
|
const n = JSON.parse(t);
|
|
848
851
|
return Array.isArray(n) ? n.filter(rt) : [];
|
|
849
852
|
}
|
|
850
|
-
function
|
|
853
|
+
function Xe(s) {
|
|
851
854
|
return `${s.level}:${s.key}`;
|
|
852
855
|
}
|
|
853
|
-
function
|
|
856
|
+
function Ts(s) {
|
|
854
857
|
return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
|
|
855
858
|
}
|
|
856
859
|
function rt(s) {
|
|
857
860
|
if (!s || typeof s != "object") return !1;
|
|
858
861
|
const e = s;
|
|
859
|
-
return typeof e.promptKey == "string" && typeof e.category == "string" && typeof e.decidedAt == "string" && (e.nextEligibleAt === null || typeof e.nextEligibleAt == "string") &&
|
|
862
|
+
return typeof e.promptKey == "string" && typeof e.category == "string" && typeof e.decidedAt == "string" && (e.nextEligibleAt === null || typeof e.nextEligibleAt == "string") && Ts(e.action) && !!(e.scope && typeof e.scope == "object" && typeof e.scope.level == "string" && typeof e.scope.key == "string");
|
|
860
863
|
}
|
|
861
|
-
const
|
|
864
|
+
const vn = {
|
|
862
865
|
working: "⏳",
|
|
863
866
|
completed: "✅",
|
|
864
867
|
failed: "❗",
|
|
865
868
|
stopped: "⏹️"
|
|
866
|
-
},
|
|
867
|
-
function
|
|
868
|
-
if (!e) return
|
|
869
|
-
const t =
|
|
869
|
+
}, Un = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
|
|
870
|
+
function Dn(s, e) {
|
|
871
|
+
if (!e) return ve(s);
|
|
872
|
+
const t = ve(s), n = `${vn[e]} Pluno`;
|
|
870
873
|
return t ? `${n}: ${t}` : n;
|
|
871
874
|
}
|
|
872
|
-
class
|
|
875
|
+
class Co {
|
|
873
876
|
constructor(e) {
|
|
874
877
|
this.titleDocument = e;
|
|
875
878
|
}
|
|
@@ -891,10 +894,10 @@ class Ro {
|
|
|
891
894
|
}
|
|
892
895
|
applyStatus(e) {
|
|
893
896
|
const t = this.titleDocument.getTitle();
|
|
894
|
-
t !== this.lastAppliedTitle && (this.baseTitle =
|
|
897
|
+
t !== this.lastAppliedTitle && (this.baseTitle = ve(t)), this.status = e, this.stopObserving || (this.stopObserving = this.titleDocument.observeTitle(() => this.handleTitleChanged())), this.applyTitle();
|
|
895
898
|
}
|
|
896
899
|
applyClear() {
|
|
897
|
-
const e = this.titleDocument.getTitle(), t = this.lastAppliedTitle !== null && e === this.lastAppliedTitle, n = this.lastAppliedTitle === null ?
|
|
900
|
+
const e = this.titleDocument.getTitle(), t = this.lastAppliedTitle !== null && e === this.lastAppliedTitle, n = this.lastAppliedTitle === null ? ve(e) : e;
|
|
898
901
|
this.status = null, this.lastAppliedTitle = null, this.stopObserving?.(), this.stopObserving = null, t ? this.titleDocument.setTitle(this.baseTitle) : n !== e && this.titleDocument.setTitle(n);
|
|
899
902
|
}
|
|
900
903
|
handleTitleChanged() {
|
|
@@ -903,11 +906,11 @@ class Ro {
|
|
|
903
906
|
applyTitle() {
|
|
904
907
|
if (!this.status)
|
|
905
908
|
return;
|
|
906
|
-
const e =
|
|
909
|
+
const e = Dn(this.baseTitle, this.status);
|
|
907
910
|
this.lastAppliedTitle = e, this.titleDocument.getTitle() !== e && this.titleDocument.setTitle(e);
|
|
908
911
|
}
|
|
909
912
|
}
|
|
910
|
-
function
|
|
913
|
+
function _o(s) {
|
|
911
914
|
return {
|
|
912
915
|
getTitle: () => s.title,
|
|
913
916
|
setTitle: (e) => {
|
|
@@ -923,10 +926,10 @@ function ko(s) {
|
|
|
923
926
|
}
|
|
924
927
|
};
|
|
925
928
|
}
|
|
926
|
-
function
|
|
927
|
-
return s.replace(
|
|
929
|
+
function ve(s) {
|
|
930
|
+
return s.replace(Un, "");
|
|
928
931
|
}
|
|
929
|
-
function
|
|
932
|
+
function Po(s) {
|
|
930
933
|
if (!s || typeof s != "object" || !("type" in s)) return !1;
|
|
931
934
|
const e = s;
|
|
932
935
|
switch (e.type) {
|
|
@@ -938,7 +941,7 @@ function Eo(s) {
|
|
|
938
941
|
case "runtime.warmup":
|
|
939
942
|
return e.reason === "panel_open" || e.reason === "extension_install" || e.reason === "composer_input";
|
|
940
943
|
case "runtime.report_displayed_error":
|
|
941
|
-
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);
|
|
944
|
+
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);
|
|
942
945
|
case "runtime.report_invalid_state_transition":
|
|
943
946
|
return (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll") && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
|
|
944
947
|
case "runtime.widget_lifecycle":
|
|
@@ -967,9 +970,9 @@ function Eo(s) {
|
|
|
967
970
|
return !1;
|
|
968
971
|
}
|
|
969
972
|
}
|
|
970
|
-
class
|
|
973
|
+
class vo {
|
|
971
974
|
constructor(e, t, n) {
|
|
972
|
-
this.adapter = t, this.state =
|
|
975
|
+
this.adapter = t, this.state = Je(e), this.model = n;
|
|
973
976
|
}
|
|
974
977
|
adapter;
|
|
975
978
|
listeners = {};
|
|
@@ -978,7 +981,7 @@ class Co {
|
|
|
978
981
|
interactionListeners = /* @__PURE__ */ new Set();
|
|
979
982
|
accountListeners = /* @__PURE__ */ new Set();
|
|
980
983
|
state;
|
|
981
|
-
sessionHistoryState =
|
|
984
|
+
sessionHistoryState = Ee("unavailable");
|
|
982
985
|
model;
|
|
983
986
|
interactions = [];
|
|
984
987
|
account = null;
|
|
@@ -990,11 +993,11 @@ class Co {
|
|
|
990
993
|
return n.add(t), this.listeners[e] = n, () => n.delete(t);
|
|
991
994
|
}
|
|
992
995
|
getState() {
|
|
993
|
-
return
|
|
996
|
+
return Je(this.state);
|
|
994
997
|
}
|
|
995
998
|
updateProjection(e, t, n, i, r) {
|
|
996
999
|
if (!this.destroyed) {
|
|
997
|
-
if (this.state =
|
|
1000
|
+
if (this.state = Je(e), t !== void 0 && (this.model = t), n) {
|
|
998
1001
|
this.sessionHistoryState = Nt(n);
|
|
999
1002
|
for (const o of this.sessionHistoryListeners)
|
|
1000
1003
|
o(this.getSessionHistoryState());
|
|
@@ -1035,11 +1038,12 @@ class Co {
|
|
|
1035
1038
|
}).catch(() => {
|
|
1036
1039
|
});
|
|
1037
1040
|
}
|
|
1038
|
-
reportDisplayedError(e, t) {
|
|
1041
|
+
reportDisplayedError(e, t, n) {
|
|
1039
1042
|
this.adapter.dispatch({
|
|
1040
1043
|
type: "runtime.report_displayed_error",
|
|
1041
1044
|
reason: e,
|
|
1042
|
-
errorFingerprint: t
|
|
1045
|
+
errorFingerprint: t,
|
|
1046
|
+
...n ? { displayedMessage: hs(n) } : {}
|
|
1043
1047
|
}).catch(() => {
|
|
1044
1048
|
});
|
|
1045
1049
|
}
|
|
@@ -1154,7 +1158,7 @@ class Co {
|
|
|
1154
1158
|
await this.dispatch({ type: "session.list", ...e });
|
|
1155
1159
|
const t = this.sessionHistoryState.data;
|
|
1156
1160
|
return {
|
|
1157
|
-
sessions:
|
|
1161
|
+
sessions: Ss(t),
|
|
1158
1162
|
nextCursor: t?.nextCursor ?? null
|
|
1159
1163
|
};
|
|
1160
1164
|
}
|
|
@@ -1238,7 +1242,7 @@ class Co {
|
|
|
1238
1242
|
for (const i of n ?? []) i(t);
|
|
1239
1243
|
}
|
|
1240
1244
|
}
|
|
1241
|
-
function
|
|
1245
|
+
function Je(s) {
|
|
1242
1246
|
return {
|
|
1243
1247
|
...s,
|
|
1244
1248
|
starterPrompts: [...s.starterPrompts],
|
|
@@ -1246,9 +1250,12 @@ function Xe(s) {
|
|
|
1246
1250
|
messages: s.messages.map((e) => {
|
|
1247
1251
|
const t = {
|
|
1248
1252
|
...e,
|
|
1249
|
-
attachments: e.attachments?.map((
|
|
1250
|
-
}, n = e.assistantDraftItemId, i = e.clientMessageId;
|
|
1251
|
-
return
|
|
1253
|
+
attachments: e.attachments?.map((o) => ({ ...o }))
|
|
1254
|
+
}, n = e.assistantDraftItemId, i = e.clientMessageId, r = e.proactiveSuggestionClientMessageId;
|
|
1255
|
+
return r && Object.defineProperty(t, "proactiveSuggestionClientMessageId", {
|
|
1256
|
+
value: r,
|
|
1257
|
+
enumerable: !1
|
|
1258
|
+
}), n && Object.defineProperty(t, "assistantDraftItemId", {
|
|
1252
1259
|
value: n,
|
|
1253
1260
|
enumerable: !1
|
|
1254
1261
|
}), i && Object.defineProperty(t, "clientMessageId", {
|
|
@@ -1263,12 +1270,12 @@ function Nt(s) {
|
|
|
1263
1270
|
return {
|
|
1264
1271
|
...s,
|
|
1265
1272
|
data: s.data ? ke({
|
|
1266
|
-
entities:
|
|
1273
|
+
entities: Ss(s.data).map((e) => ({ ...e })),
|
|
1267
1274
|
nextCursor: s.data.nextCursor
|
|
1268
1275
|
}) : null
|
|
1269
1276
|
};
|
|
1270
1277
|
}
|
|
1271
|
-
const
|
|
1278
|
+
const qn = globalThis.fetch.bind(globalThis), Ht = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', On = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', xn = ".pluno-pa-widget__panel", Ln = ".pluno-pa-widget__timeline", Nn = "__plunoExtensionWidgetOwner";
|
|
1272
1279
|
class X extends Error {
|
|
1273
1280
|
constructor(e, t, n, i) {
|
|
1274
1281
|
super(e), this.retryable = t, this.status = n, this.retryAfterMs = i, this.name = "ProductAgentTokenProviderError";
|
|
@@ -1277,10 +1284,10 @@ class X extends Error {
|
|
|
1277
1284
|
status;
|
|
1278
1285
|
retryAfterMs;
|
|
1279
1286
|
}
|
|
1280
|
-
function
|
|
1287
|
+
function Hn(s) {
|
|
1281
1288
|
return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
|
|
1282
1289
|
}
|
|
1283
|
-
let
|
|
1290
|
+
let Bn = 0;
|
|
1284
1291
|
function Bt(s) {
|
|
1285
1292
|
const e = {};
|
|
1286
1293
|
for (const l of [
|
|
@@ -1311,9 +1318,10 @@ function Bt(s) {
|
|
|
1311
1318
|
const r = (l) => {
|
|
1312
1319
|
if (!l || typeof l != "object")
|
|
1313
1320
|
return null;
|
|
1314
|
-
const c = l, u = c.data, d = u && typeof u == "object" ? u : {}, g =
|
|
1321
|
+
const c = l, u = c.data, d = u && typeof u == "object" ? u : {}, g = Ue(l);
|
|
1315
1322
|
return {
|
|
1316
1323
|
id: typeof c.id == "string" ? c.id : null,
|
|
1324
|
+
streamId: d.type === "message" && d.role === "assistant" && typeof d.id == "string" ? d.id : null,
|
|
1317
1325
|
type: typeof d.type == "string" ? d.type : null,
|
|
1318
1326
|
role: typeof d.role == "string" ? d.role : null,
|
|
1319
1327
|
sessionId: typeof c.sessionId == "string" ? c.sessionId : null,
|
|
@@ -1325,9 +1333,9 @@ function Bt(s) {
|
|
|
1325
1333
|
visible: !!(g && !g.scheduledCheckInAt && g.toolName !== St && (d.type !== "run_status" || ["failed", "interrupted", "stopped"].includes(String(d.status))))
|
|
1326
1334
|
};
|
|
1327
1335
|
}, o = r(s.item);
|
|
1328
|
-
if (o?.id && (e.itemId = o.id, o.type && (e.itemType = o.type), o.role && (e.itemRole = o.role), o.sessionId && typeof e.sessionId != "string" && (e.sessionId = o.sessionId), o.runId && typeof e.runId != "string" && (e.runId = o.runId), o.respondsToUserMessageId && typeof e.respondsToUserMessageId != "string" && (e.respondsToUserMessageId = o.respondsToUserMessageId), o.status && (e.itemStatus = o.status), o.stage && (e.itemStage = o.stage), o.retryable && (e.itemRetryable = !0), o.visible && (e.visibleItemId = o.id)), Array.isArray(s.items)) {
|
|
1329
|
-
const l = s.items.map(r).filter((c) => c !== null && c.visible && !!c.id)
|
|
1330
|
-
e.visibleItemIds = JSON.stringify(l);
|
|
1336
|
+
if (o?.id && (e.itemId = o.id, o.type && (e.itemType = o.type), o.role && (e.itemRole = o.role), o.sessionId && typeof e.sessionId != "string" && (e.sessionId = o.sessionId), o.runId && typeof e.runId != "string" && (e.runId = o.runId), o.respondsToUserMessageId && typeof e.respondsToUserMessageId != "string" && (e.respondsToUserMessageId = o.respondsToUserMessageId), o.status && (e.itemStatus = o.status), o.stage && (e.itemStage = o.stage), o.retryable && (e.itemRetryable = !0), o.visible && (e.visibleItemId = o.id, o.streamId && (e.visibleItemAliases = JSON.stringify([[o.streamId, o.id]])))), Array.isArray(s.items)) {
|
|
1337
|
+
const l = s.items.map(r).filter((c) => c !== null && c.visible && !!c.id);
|
|
1338
|
+
e.visibleItemIds = JSON.stringify(l.map((c) => c.id)), e.visibleItemAliases = JSON.stringify(l.flatMap((c) => c.streamId ? [[c.streamId, c.id]] : []));
|
|
1331
1339
|
}
|
|
1332
1340
|
s.type === "chat.assistant_delta" && typeof s.itemId == "string" && (e.visibleItemId = s.itemId);
|
|
1333
1341
|
const a = s.session;
|
|
@@ -1345,7 +1353,7 @@ function Bt(s) {
|
|
|
1345
1353
|
}
|
|
1346
1354
|
return e;
|
|
1347
1355
|
}
|
|
1348
|
-
function
|
|
1356
|
+
function Se(s, e, t) {
|
|
1349
1357
|
if (typeof window > "u")
|
|
1350
1358
|
return;
|
|
1351
1359
|
const n = window.__PLUNO_PRODUCT_AGENT_TRACE_ID__;
|
|
@@ -1357,36 +1365,36 @@ function Je(s, e, t) {
|
|
|
1357
1365
|
source: "web_sdk",
|
|
1358
1366
|
category: s,
|
|
1359
1367
|
name: e,
|
|
1360
|
-
sequence: ++
|
|
1368
|
+
sequence: ++Bn,
|
|
1361
1369
|
wallTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1362
1370
|
monotonicMs: performance.now(),
|
|
1363
1371
|
data: t
|
|
1364
1372
|
};
|
|
1365
1373
|
window.dispatchEvent(new CustomEvent("product-agent:trace", { detail: i }));
|
|
1366
1374
|
}
|
|
1367
|
-
class
|
|
1375
|
+
class Te extends Error {
|
|
1368
1376
|
}
|
|
1369
|
-
function
|
|
1377
|
+
function Fn(s) {
|
|
1370
1378
|
return s === 408 || s === 425 || s === 429 || s >= 500;
|
|
1371
1379
|
}
|
|
1372
|
-
const
|
|
1380
|
+
const Wn = "https://app.pluno.ai", $n = 2e4, jn = 1e4, zn = 6e4, Kn = 6e4, Gn = 1e4, Qn = 1e4, Vn = 3e3, Xn = 3e4, Jn = 1e3, ot = 3e4, Ft = 0.2, Yn = 6e4, Wt = 15e3, Zn = 6e4, ei = 8, ti = "Browser connection was interrupted.", $t = 15e3, si = "Pluno could not send this message. Try it again.", ni = "Still connecting to Pluno. Retrying automatically.", ii = 2e3, ri = 1e3, oi = 100, jt = 8e3, zt = 3, ai = [300, 1e3], ws = 50 * 1024 * 1024, li = /* @__PURE__ */ new Set([
|
|
1373
1381
|
".jpeg:image/jpeg",
|
|
1374
1382
|
".jpg:image/jpeg",
|
|
1375
1383
|
".pdf:application/pdf",
|
|
1376
1384
|
".png:image/png",
|
|
1377
1385
|
".webp:image/webp"
|
|
1378
|
-
]),
|
|
1379
|
-
function
|
|
1386
|
+
]), Uo = ".pdf,.png,.jpg,.jpeg,.webp", Tt = 64e3, Ye = 4e3, wt = 30, ci = 2e3, ui = 1e3, As = "Image is too large for model vision input.", di = 100, hi = 20, Ms = "pluno.productAgent.state.", at = "pluno.productAgent.pendingEvents.", Le = "pluno.productAgent.activeToolCalls.", pi = 100;
|
|
1387
|
+
function gi(s, e = 0) {
|
|
1380
1388
|
const t = s === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (s - 1));
|
|
1381
1389
|
return Math.max(e, t);
|
|
1382
1390
|
}
|
|
1383
|
-
const
|
|
1384
|
-
let
|
|
1385
|
-
function
|
|
1386
|
-
const t = Math.min(ot,
|
|
1391
|
+
const Ce = /* @__PURE__ */ new Set();
|
|
1392
|
+
let we = null;
|
|
1393
|
+
function fi(s, e = Math.random) {
|
|
1394
|
+
const t = Math.min(ot, Jn * 2 ** s), n = 1 - Ft + e() * Ft * 2;
|
|
1387
1395
|
return Math.min(ot, Math.round(t * n));
|
|
1388
1396
|
}
|
|
1389
|
-
function
|
|
1397
|
+
function mi(s) {
|
|
1390
1398
|
const e = s.split(".")[1];
|
|
1391
1399
|
if (!e)
|
|
1392
1400
|
return null;
|
|
@@ -1397,7 +1405,7 @@ function pi(s) {
|
|
|
1397
1405
|
return null;
|
|
1398
1406
|
}
|
|
1399
1407
|
}
|
|
1400
|
-
function
|
|
1408
|
+
function yi(s) {
|
|
1401
1409
|
if (s instanceof X)
|
|
1402
1410
|
return s.retryable;
|
|
1403
1411
|
if (s && typeof s == "object") {
|
|
@@ -1407,7 +1415,7 @@ function gi(s) {
|
|
|
1407
1415
|
}
|
|
1408
1416
|
return !0;
|
|
1409
1417
|
}
|
|
1410
|
-
function
|
|
1418
|
+
function Ii(s) {
|
|
1411
1419
|
if (s instanceof Error)
|
|
1412
1420
|
return s;
|
|
1413
1421
|
if (s && typeof s == "object") {
|
|
@@ -1419,9 +1427,9 @@ function fi(s) {
|
|
|
1419
1427
|
}
|
|
1420
1428
|
return new Error(String(s));
|
|
1421
1429
|
}
|
|
1422
|
-
class
|
|
1430
|
+
class Ne {
|
|
1423
1431
|
constructor(e, t) {
|
|
1424
|
-
this.options = e, this.transportIdentity = t, this.sessionHistoryManager = new
|
|
1432
|
+
this.options = e, this.transportIdentity = t, this.sessionHistoryManager = new En(
|
|
1425
1433
|
e.clientId,
|
|
1426
1434
|
async ({ cursor: r, limit: o, pinned: a }) => await this.listSessions({ cursor: r, limit: o, pinned: a })
|
|
1427
1435
|
), this.sessionRecoveryPoller = new Lt({
|
|
@@ -1436,7 +1444,7 @@ class Le {
|
|
|
1436
1444
|
activeIntervalMs: 3e3,
|
|
1437
1445
|
idleIntervalMs: 15e3,
|
|
1438
1446
|
maxFailureIntervalMs: 3e4
|
|
1439
|
-
}), this.sessionActivityRecovery = new
|
|
1447
|
+
}), this.sessionActivityRecovery = new Cn({
|
|
1440
1448
|
fetchPage: async (r, o) => await this.fetchSessionHistoryPageOnce(
|
|
1441
1449
|
r,
|
|
1442
1450
|
"activity",
|
|
@@ -1462,11 +1470,11 @@ class Le {
|
|
|
1462
1470
|
activeIntervalMs: 3e3,
|
|
1463
1471
|
idleIntervalMs: 15e3,
|
|
1464
1472
|
maxFailureIntervalMs: 3e4
|
|
1465
|
-
}), this.personalModelSelectionOverride = e.productVariant === "personal" &&
|
|
1473
|
+
}), this.personalModelSelectionOverride = e.productVariant === "personal" && Ve(e.model) ? e.model : null, this.state = {
|
|
1466
1474
|
...this.state,
|
|
1467
|
-
starterPrompts:
|
|
1475
|
+
starterPrompts: Zi(e.initialStarterPrompts)
|
|
1468
1476
|
}, this.account = e.initialAccount ? { ...e.initialAccount } : null;
|
|
1469
|
-
const n = e.restorePersistedState === !1 ? null :
|
|
1477
|
+
const n = e.restorePersistedState === !1 ? null : $r(e.clientId, e.expectedPersistedSessionId);
|
|
1470
1478
|
n && (this.state = {
|
|
1471
1479
|
...this.state,
|
|
1472
1480
|
...n,
|
|
@@ -1487,9 +1495,9 @@ class Le {
|
|
|
1487
1495
|
taskStatus: null,
|
|
1488
1496
|
isRetrying: !1,
|
|
1489
1497
|
lastError: null
|
|
1490
|
-
}, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents =
|
|
1491
|
-
|
|
1492
|
-
|
|
1498
|
+
}, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents = Vr(
|
|
1499
|
+
zr(e.clientId),
|
|
1500
|
+
Kr(e.clientId)
|
|
1493
1501
|
);
|
|
1494
1502
|
const i = [...this.queuedClientEvents].reverse().find(
|
|
1495
1503
|
(r) => r.type === "chat.user_message" && typeof r.clientMessageId == "string"
|
|
@@ -1535,7 +1543,7 @@ class Le {
|
|
|
1535
1543
|
accountRefresh = null;
|
|
1536
1544
|
runtimeInteractions = [];
|
|
1537
1545
|
interactionListeners = /* @__PURE__ */ new Set();
|
|
1538
|
-
interactionManager = new
|
|
1546
|
+
interactionManager = new _n(
|
|
1539
1547
|
{ load: async () => [], save: async () => {
|
|
1540
1548
|
} },
|
|
1541
1549
|
[]
|
|
@@ -1635,17 +1643,17 @@ class Le {
|
|
|
1635
1643
|
lastErrorSecuritySettingsUrl: null
|
|
1636
1644
|
};
|
|
1637
1645
|
static async init(e) {
|
|
1638
|
-
const t = e, n = await
|
|
1646
|
+
const t = e, n = await pn(
|
|
1639
1647
|
t.skipStoredTransportIdentityCollisionCheck === !0
|
|
1640
|
-
), i = new
|
|
1648
|
+
), i = new Ne({
|
|
1641
1649
|
...e,
|
|
1642
|
-
backendUrl:
|
|
1643
|
-
clientId: e.clientId ??
|
|
1650
|
+
backendUrl: Ni(e.backendUrl ?? Wn),
|
|
1651
|
+
clientId: e.clientId ?? ir(),
|
|
1644
1652
|
productVariant: e.productVariant ?? "customer_embedded",
|
|
1645
|
-
entrySurface:
|
|
1653
|
+
entrySurface: Hi(e.entrySurface)
|
|
1646
1654
|
}, n);
|
|
1647
1655
|
try {
|
|
1648
|
-
|
|
1656
|
+
Js().catch((r) => {
|
|
1649
1657
|
b("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
|
|
1650
1658
|
message: r instanceof Error ? r.message : String(r)
|
|
1651
1659
|
});
|
|
@@ -1691,7 +1699,7 @@ class Le {
|
|
|
1691
1699
|
return this.options.token;
|
|
1692
1700
|
if (!this.options.tokenProvider)
|
|
1693
1701
|
return this.token;
|
|
1694
|
-
const n = Date.now(), i = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs -
|
|
1702
|
+
const n = Date.now(), i = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs - Kn > n;
|
|
1695
1703
|
if (!t.forceRefresh && (i || t.preferCached && this.token !== null))
|
|
1696
1704
|
return this.token;
|
|
1697
1705
|
if (this.tokenRequest && !t.forceRefresh)
|
|
@@ -1704,7 +1712,7 @@ class Le {
|
|
|
1704
1712
|
const l = new Promise((c, u) => {
|
|
1705
1713
|
a = window.setTimeout(() => {
|
|
1706
1714
|
r.abort(), u(new X("Pluno token provider timed out", !0));
|
|
1707
|
-
},
|
|
1715
|
+
}, zn);
|
|
1708
1716
|
});
|
|
1709
1717
|
try {
|
|
1710
1718
|
const c = await Promise.race([
|
|
@@ -1715,7 +1723,7 @@ class Le {
|
|
|
1715
1723
|
throw new X("Pluno token request was cancelled", !0);
|
|
1716
1724
|
if (!c)
|
|
1717
1725
|
throw new X("Pluno token provider did not return a token", !1);
|
|
1718
|
-
return this.token = c, this.tokenExpiresAtMs =
|
|
1726
|
+
return this.token = c, this.tokenExpiresAtMs = mi(c), c;
|
|
1719
1727
|
} finally {
|
|
1720
1728
|
a !== null && window.clearTimeout(a);
|
|
1721
1729
|
}
|
|
@@ -1740,10 +1748,10 @@ class Le {
|
|
|
1740
1748
|
return;
|
|
1741
1749
|
if (!this.token && !this.options.webSocketFactory)
|
|
1742
1750
|
throw new X("Pluno requires a token or tokenProvider", !1);
|
|
1743
|
-
const t =
|
|
1751
|
+
const t = Wi(this.options.backendUrl), n = this.options.webSocketFactory?.(t) ?? new WebSocket(t);
|
|
1744
1752
|
this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
|
|
1745
1753
|
this.socket === n && n.readyState === WebSocket.CONNECTING && (b("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.reportTransportDiagnostic("connect_timeout"), this.replaceTimedOutSocket(n));
|
|
1746
|
-
},
|
|
1754
|
+
}, Gn), n.addEventListener("open", () => {
|
|
1747
1755
|
this.socket !== n || (this.clearSocketConnectTimer(), b("web-sdk.agent", "Pluno socket opened", {
|
|
1748
1756
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
1749
1757
|
isThinking: this.state.isThinking
|
|
@@ -1755,13 +1763,13 @@ class Le {
|
|
|
1755
1763
|
pageUrl: location.href
|
|
1756
1764
|
}) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
|
|
1757
1765
|
this.socket === n && (b("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.reportTransportDiagnostic("auth_timeout"), this.replaceTimedOutSocket(n));
|
|
1758
|
-
},
|
|
1766
|
+
}, Qn));
|
|
1759
1767
|
}), n.addEventListener("message", (i) => {
|
|
1760
|
-
this.socket === n && this.handleServerEvent(
|
|
1768
|
+
this.socket === n && this.handleServerEvent(Ji(i.data));
|
|
1761
1769
|
}), n.addEventListener("sendfailure", (i) => {
|
|
1762
1770
|
if (this.socket !== n)
|
|
1763
1771
|
return;
|
|
1764
|
-
const r =
|
|
1772
|
+
const r = Yi(i?.detail?.data);
|
|
1765
1773
|
r?.type === "chat.user_message" && r.clientMessageId === this.pendingClientMessageId && !this.queuedClientEvents.some(
|
|
1766
1774
|
(o) => o.type === "chat.user_message" && o.clientMessageId === r.clientMessageId
|
|
1767
1775
|
) && (this.queuedClientEvents.push(r), V(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();
|
|
@@ -1785,14 +1793,14 @@ class Le {
|
|
|
1785
1793
|
} catch (t) {
|
|
1786
1794
|
if (e !== this.connectionAttemptId || this.state.status === "closed")
|
|
1787
1795
|
return;
|
|
1788
|
-
const n =
|
|
1789
|
-
if (
|
|
1796
|
+
const n = Ii(t);
|
|
1797
|
+
if (yi(t)) {
|
|
1790
1798
|
b("web-sdk.agent", "Pluno connection attempt failed; retrying", {
|
|
1791
1799
|
message: n.message,
|
|
1792
1800
|
reconnectAttempt: this.reconnectAttempts
|
|
1793
1801
|
}), t instanceof X && this.reportTransportDiagnostic("auth_timeout"), this.setState({
|
|
1794
1802
|
status: "reconnecting",
|
|
1795
|
-
lastError:
|
|
1803
|
+
lastError: ni,
|
|
1796
1804
|
lastErrorCode: "connection_failed"
|
|
1797
1805
|
}), this.emit("error", n), this.scheduleReconnect(
|
|
1798
1806
|
t instanceof X ? t.retryAfterMs : void 0
|
|
@@ -1812,7 +1820,7 @@ class Le {
|
|
|
1812
1820
|
this.stopSessionRecoveryPolling(), this.connectionAttemptId += 1, this.setState({ status: "closed", pendingMessageStatus: null, isThinking: !1, isRetrying: !1 }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.clearStarterPromptUrlRefreshTimer(), this.clearRetryTimers(), this.clearThinkingWatchdog(), this.clearAllFirstResponseTimers(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.clearSessionLoadRequest(), this.rejectPendingSessionHistoryRequests("Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionPinRequests, "Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionRenameRequests, "Pluno disconnected."), this.tokenAbortController?.abort(), this.tokenAbortController = null, this.tokenRequest = null, this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.clientDiagnosticsRetryTimer !== null && (window.clearTimeout(this.clientDiagnosticsRetryTimer), this.clientDiagnosticsRetryTimer = null), this.pendingTransportDiagnostics = [], this.pendingHealthDiagnostics = [], this.queuedClientEvents = [], this.pendingWidgetLifecycleEvents = [], this.clearPendingWarmupAckTimer(), this.pendingPassiveWarmupEvent = null, this.pendingComposerWarmup = null, this.activeComposerWarmupId = null, this.activeComposerWarmupScope = null, this.nonTranscriptToolCallIds.clear(), this.socket?.close(), this.socket = null;
|
|
1813
1821
|
}
|
|
1814
1822
|
destroy() {
|
|
1815
|
-
this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(),
|
|
1823
|
+
this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), Xr(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();
|
|
1816
1824
|
for (const e of Object.values(this.listeners))
|
|
1817
1825
|
e?.clear();
|
|
1818
1826
|
this.accountListeners.clear(), this.interactionListeners.clear();
|
|
@@ -1852,12 +1860,12 @@ class Le {
|
|
|
1852
1860
|
}
|
|
1853
1861
|
async sendMessage(e, t = {}) {
|
|
1854
1862
|
const n = e.trim(), i = t.attachments ?? [];
|
|
1855
|
-
if (this.options.productVariant === "customer_embedded" && (i.forEach(
|
|
1863
|
+
if (this.options.productVariant === "customer_embedded" && (i.forEach(xs), i.reduce(
|
|
1856
1864
|
(T, N) => T + N.sizeBytes,
|
|
1857
1865
|
0
|
|
1858
|
-
) >
|
|
1866
|
+
) > ws))
|
|
1859
1867
|
throw new Error("Embedded attachments must total at most 50 MB per message");
|
|
1860
|
-
let r = i.map(
|
|
1868
|
+
let r = i.map(qe);
|
|
1861
1869
|
if (!n && r.length === 0)
|
|
1862
1870
|
return null;
|
|
1863
1871
|
if (this.pendingClientMessageId)
|
|
@@ -1948,12 +1956,12 @@ class Le {
|
|
|
1948
1956
|
sessionId: this.state.sessionId ?? void 0,
|
|
1949
1957
|
clientMessageId: a,
|
|
1950
1958
|
initiatedBy: t.initiatedBy,
|
|
1951
|
-
invocation:
|
|
1959
|
+
invocation: Bi(t.invocation ?? t.initiatedBy),
|
|
1952
1960
|
entrySurface: this.options.entrySurface,
|
|
1953
1961
|
content: n,
|
|
1954
1962
|
proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
|
|
1955
1963
|
pageContent: D && At() || void 0,
|
|
1956
|
-
attachments: r.length > 0 ? r.map(
|
|
1964
|
+
attachments: r.length > 0 ? r.map(qe) : void 0,
|
|
1957
1965
|
page: o,
|
|
1958
1966
|
model: this.options.model,
|
|
1959
1967
|
metadata: Kt(this.options.metadata)
|
|
@@ -1966,14 +1974,18 @@ class Le {
|
|
|
1966
1974
|
clientMessageId: t
|
|
1967
1975
|
});
|
|
1968
1976
|
}
|
|
1969
|
-
reportDisplayedError(e, t) {
|
|
1970
|
-
this.reportHealthSignal("user_visible_error", {
|
|
1977
|
+
reportDisplayedError(e, t, n) {
|
|
1978
|
+
this.reportHealthSignal("user_visible_error", {
|
|
1979
|
+
reason: e,
|
|
1980
|
+
errorFingerprint: t,
|
|
1981
|
+
...n ? { displayedMessage: hs(n) } : {}
|
|
1982
|
+
});
|
|
1971
1983
|
}
|
|
1972
1984
|
getModel() {
|
|
1973
1985
|
return this.options.model;
|
|
1974
1986
|
}
|
|
1975
1987
|
setModel(e) {
|
|
1976
|
-
this.options.model = e, this.options.productVariant === "personal" &&
|
|
1988
|
+
this.options.model = e, this.options.productVariant === "personal" && Ve(e) && (this.personalModelSelectionOverride = e);
|
|
1977
1989
|
}
|
|
1978
1990
|
retryLastMessage() {
|
|
1979
1991
|
const e = this.state.sessionId, t = this.retryableClientMessageId;
|
|
@@ -1991,7 +2003,7 @@ class Le {
|
|
|
1991
2003
|
return e ? (this.retryAttemptsByClientMessageId[t] = 0, this.retryableClientMessageId = null, this.stagedProactiveSuggestionQuestionMessageId = null, this.activeClientMessageId = t, this.latestRecoverableClientMessageId = t, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), this.markThinkingProgress(), this.send({ type: "chat.retry_last_user_message", sessionId: e, clientMessageId: t, automatic: !1 }), !0) : !1;
|
|
1992
2004
|
}
|
|
1993
2005
|
createLocalAttachment(e) {
|
|
1994
|
-
this.options.productVariant === "customer_embedded" &&
|
|
2006
|
+
this.options.productVariant === "customer_embedded" && Jr(e);
|
|
1995
2007
|
const t = x(), n = {
|
|
1996
2008
|
id: t,
|
|
1997
2009
|
name: e.name || "attachment",
|
|
@@ -2000,7 +2012,7 @@ class Le {
|
|
|
2000
2012
|
};
|
|
2001
2013
|
this.attachmentFiles.set(t, e);
|
|
2002
2014
|
const i = Date.now();
|
|
2003
|
-
return
|
|
2015
|
+
return Vs({
|
|
2004
2016
|
attachmentId: t,
|
|
2005
2017
|
name: n.name,
|
|
2006
2018
|
mimeType: n.mimeType,
|
|
@@ -2044,29 +2056,29 @@ class Le {
|
|
|
2044
2056
|
};
|
|
2045
2057
|
let o;
|
|
2046
2058
|
if (this.options.persistAttachmentUpload)
|
|
2047
|
-
o = await
|
|
2059
|
+
o = await be(
|
|
2048
2060
|
() => this.options.persistAttachmentUpload(r, e),
|
|
2049
2061
|
"Failed to upload attachment"
|
|
2050
2062
|
);
|
|
2051
2063
|
else {
|
|
2052
|
-
const l = this.options.prepareAttachmentUpload ? await
|
|
2064
|
+
const l = this.options.prepareAttachmentUpload ? await be(
|
|
2053
2065
|
() => this.options.prepareAttachmentUpload(r),
|
|
2054
2066
|
"Failed to prepare attachment upload"
|
|
2055
2067
|
) : await this.prepareEmbedAttachmentUpload(r);
|
|
2056
|
-
await
|
|
2068
|
+
await be(async () => {
|
|
2057
2069
|
const c = await fetch(new URL(l.uploadUrl, this.options.backendUrl), {
|
|
2058
2070
|
method: l.uploadMethod,
|
|
2059
2071
|
headers: l.uploadHeaders,
|
|
2060
2072
|
body: e
|
|
2061
2073
|
});
|
|
2062
2074
|
if (!c.ok)
|
|
2063
|
-
throw new
|
|
2075
|
+
throw new Pe("Failed to upload attachment", c.status);
|
|
2064
2076
|
return c;
|
|
2065
2077
|
}, "Failed to upload attachment"), o = l;
|
|
2066
2078
|
}
|
|
2067
2079
|
this.setState({ sessionId: o.sessionId });
|
|
2068
|
-
const a =
|
|
2069
|
-
return this.updateAttachmentInState(t.id, a), t.id &&
|
|
2080
|
+
const a = Os(o.attachment, this.options.backendUrl);
|
|
2081
|
+
return this.updateAttachmentInState(t.id, a), t.id && Xs(t.id, {
|
|
2070
2082
|
sessionId: o.sessionId,
|
|
2071
2083
|
fileUrl: a.fileUrl,
|
|
2072
2084
|
sandboxPath: a.sandboxPath,
|
|
@@ -2093,18 +2105,18 @@ class Le {
|
|
|
2093
2105
|
}
|
|
2094
2106
|
async prepareEmbedAttachmentUpload(e) {
|
|
2095
2107
|
let t = !1;
|
|
2096
|
-
return await
|
|
2108
|
+
return await be(async () => {
|
|
2097
2109
|
const n = await this.fetchEmbedAttachmentUpload(e, !1);
|
|
2098
2110
|
if (n.ok)
|
|
2099
2111
|
return await n.json();
|
|
2100
|
-
if (
|
|
2112
|
+
if (fo(n.status) && this.options.tokenProvider && !t) {
|
|
2101
2113
|
t = !0;
|
|
2102
2114
|
const i = await this.fetchEmbedAttachmentUpload(e, !0);
|
|
2103
2115
|
if (i.ok)
|
|
2104
2116
|
return await i.json();
|
|
2105
|
-
throw new
|
|
2117
|
+
throw new Pe("Failed to prepare attachment upload", i.status);
|
|
2106
2118
|
}
|
|
2107
|
-
throw new
|
|
2119
|
+
throw new Pe("Failed to prepare attachment upload", n.status);
|
|
2108
2120
|
}, "Failed to prepare attachment upload");
|
|
2109
2121
|
}
|
|
2110
2122
|
async fetchEmbedAttachmentUpload(e, t) {
|
|
@@ -2122,7 +2134,7 @@ class Le {
|
|
|
2122
2134
|
if (!this.state.sessionId)
|
|
2123
2135
|
return;
|
|
2124
2136
|
this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "user_requested" });
|
|
2125
|
-
const e =
|
|
2137
|
+
const e = Dr(
|
|
2126
2138
|
this.state.messages,
|
|
2127
2139
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
2128
2140
|
this.state.assistantDraftRunId,
|
|
@@ -2137,7 +2149,7 @@ class Le {
|
|
|
2137
2149
|
stoppedCausalSequence: null,
|
|
2138
2150
|
toolCallIds: new Set(
|
|
2139
2151
|
this.state.messages.filter(
|
|
2140
|
-
(t) =>
|
|
2152
|
+
(t) => Me(
|
|
2141
2153
|
t,
|
|
2142
2154
|
e.respondsToUserMessageId,
|
|
2143
2155
|
e.runId
|
|
@@ -2257,7 +2269,7 @@ class Le {
|
|
|
2257
2269
|
throw new Error("This interaction is no longer available.");
|
|
2258
2270
|
if (!r.allowedActions.includes(t))
|
|
2259
2271
|
throw new Error("This action is not available for the interaction.");
|
|
2260
|
-
if (
|
|
2272
|
+
if (Hn(t) && await this.interactionManager.act(
|
|
2261
2273
|
{
|
|
2262
2274
|
key: r.id,
|
|
2263
2275
|
category: r.category,
|
|
@@ -2306,7 +2318,7 @@ class Le {
|
|
|
2306
2318
|
this.rebuildRuntimeInteractions();
|
|
2307
2319
|
}
|
|
2308
2320
|
rebuildRuntimeInteractions() {
|
|
2309
|
-
const e = [], t = this.options.productVariant === "personal" && (this.options.entrySurface === "main_web_chat" || this.options.entrySurface === "automation") ?
|
|
2321
|
+
const e = [], t = this.options.productVariant === "personal" && (this.options.entrySurface === "main_web_chat" || this.options.entrySurface === "automation") ? tn(this.state.messages) : null;
|
|
2310
2322
|
if (t) {
|
|
2311
2323
|
const r = {
|
|
2312
2324
|
key: t.id,
|
|
@@ -2432,7 +2444,7 @@ class Le {
|
|
|
2432
2444
|
loadSession(e) {
|
|
2433
2445
|
const t = x(), n = this.activeComposerWarmupId;
|
|
2434
2446
|
this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages);
|
|
2435
|
-
const i = this.getCachedSessionTimeline(e), r = [...i ?? []].reverse().find((a) => a.dataType === "assistant_draft" && a.steered !== !0), o =
|
|
2447
|
+
const i = this.getCachedSessionTimeline(e), r = [...i ?? []].reverse().find((a) => a.dataType === "assistant_draft" && a.steered !== !0), o = vr(i ?? []);
|
|
2436
2448
|
!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) && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "session_switch" }), this.options.keepRunsActiveOnSessionNavigation && (this.rememberCurrentRunAsBackground(), this.backgroundSessionIds.delete(e), this.deferredSessionUpdatedSessionIds.delete(e)), this.clearPendingComposerWarmup(), n && this.send({
|
|
2437
2449
|
type: "session.reset",
|
|
2438
2450
|
warmupId: n,
|
|
@@ -2538,7 +2550,7 @@ class Le {
|
|
|
2538
2550
|
try {
|
|
2539
2551
|
return await this.fetchSessionHistoryPageOnce(e, t, n);
|
|
2540
2552
|
} catch (o) {
|
|
2541
|
-
if (o instanceof
|
|
2553
|
+
if (o instanceof Te)
|
|
2542
2554
|
throw o;
|
|
2543
2555
|
b("web-sdk.history", "HTTP session history page failed; retrying", {
|
|
2544
2556
|
sessionId: e,
|
|
@@ -2552,7 +2564,7 @@ class Le {
|
|
|
2552
2564
|
async fetchSessionHistoryPageOnce(e, t, n, i = !1) {
|
|
2553
2565
|
const r = await this.acquireToken("history", { preferCached: i });
|
|
2554
2566
|
if (!r)
|
|
2555
|
-
throw new
|
|
2567
|
+
throw new Te("Product Agent history requires authentication");
|
|
2556
2568
|
this.token = r;
|
|
2557
2569
|
const o = new URLSearchParams({ limit: "200" });
|
|
2558
2570
|
n && o.set("cursor", n);
|
|
@@ -2566,11 +2578,11 @@ class Le {
|
|
|
2566
2578
|
});
|
|
2567
2579
|
if (!c.ok) {
|
|
2568
2580
|
const d = await c.text() || `History request failed (${c.status})`;
|
|
2569
|
-
throw
|
|
2581
|
+
throw Fn(c.status) ? new Error(d) : new Te(d);
|
|
2570
2582
|
}
|
|
2571
2583
|
const u = await c.json();
|
|
2572
2584
|
if (!u?.session || !Array.isArray(u.items))
|
|
2573
|
-
throw new
|
|
2585
|
+
throw new Te("Invalid Product Agent session history response");
|
|
2574
2586
|
return {
|
|
2575
2587
|
session: u.session,
|
|
2576
2588
|
items: u.items,
|
|
@@ -2621,7 +2633,7 @@ class Le {
|
|
|
2621
2633
|
return !1;
|
|
2622
2634
|
const t = this.socket;
|
|
2623
2635
|
try {
|
|
2624
|
-
return t.send(JSON.stringify(e)),
|
|
2636
|
+
return t.send(JSON.stringify(e)), Se("client_event", e.type, Bt(e)), !0;
|
|
2625
2637
|
} catch (n) {
|
|
2626
2638
|
return b("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
|
|
2627
2639
|
message: n instanceof Error ? n.message : String(n),
|
|
@@ -2648,7 +2660,7 @@ class Le {
|
|
|
2648
2660
|
...this.activeResponseRunId ? { runId: this.activeResponseRunId } : {},
|
|
2649
2661
|
...t
|
|
2650
2662
|
};
|
|
2651
|
-
if (this.options.productVariant === "customer_embedded" || !this.socket || this.socket.readyState !== WebSocket.OPEN || this.authenticatedSocket !== this.socket) {
|
|
2663
|
+
if (Se("client_event", "runtime.health", { ...i, signalName: e }), this.options.productVariant === "customer_embedded" || !this.socket || this.socket.readyState !== WebSocket.OPEN || this.authenticatedSocket !== this.socket) {
|
|
2652
2664
|
this.queueHealthDiagnostic(i);
|
|
2653
2665
|
return;
|
|
2654
2666
|
}
|
|
@@ -2671,7 +2683,7 @@ class Le {
|
|
|
2671
2683
|
clientMessageId: e,
|
|
2672
2684
|
durationMs: Date.now() - n
|
|
2673
2685
|
});
|
|
2674
|
-
}, Math.max(0,
|
|
2686
|
+
}, Math.max(0, Zn - (Date.now() - n)));
|
|
2675
2687
|
this.firstResponseTimersByClientMessageId.set(e, { submittedAt: n, timer: i });
|
|
2676
2688
|
}
|
|
2677
2689
|
clearFirstResponseTimer(e) {
|
|
@@ -2781,7 +2793,7 @@ class Le {
|
|
|
2781
2793
|
if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
|
|
2782
2794
|
return;
|
|
2783
2795
|
this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
|
|
2784
|
-
const e =
|
|
2796
|
+
const e = $i();
|
|
2785
2797
|
this.sendNow(
|
|
2786
2798
|
L({
|
|
2787
2799
|
type: "starter_prompts.page_context",
|
|
@@ -2792,13 +2804,13 @@ class Le {
|
|
|
2792
2804
|
) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
|
|
2793
2805
|
}
|
|
2794
2806
|
startStarterPromptUrlWatcher() {
|
|
2795
|
-
this.locationChangeCleanup || (this.locationChangeCleanup =
|
|
2807
|
+
this.locationChangeCleanup || (this.locationChangeCleanup = ji(() => this.handleStarterPromptUrlChange()));
|
|
2796
2808
|
}
|
|
2797
2809
|
handleStarterPromptUrlChange() {
|
|
2798
2810
|
const e = location.href;
|
|
2799
2811
|
e !== this.lastStarterPromptPageUrl && (this.activeComposerWarmupScope && !this.activeComposerWarmupScope.endsWith(`:${e}`) && this.clearPendingComposerWarmup(), this.lastStarterPromptPageUrl = e, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
|
|
2800
2812
|
this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
|
|
2801
|
-
},
|
|
2813
|
+
}, pi));
|
|
2802
2814
|
}
|
|
2803
2815
|
refreshStarterPromptsForCurrentUrl() {
|
|
2804
2816
|
this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
|
|
@@ -2828,7 +2840,7 @@ class Le {
|
|
|
2828
2840
|
}
|
|
2829
2841
|
rememberSessionTimeline(e, t) {
|
|
2830
2842
|
const n = [...t];
|
|
2831
|
-
for (this.sessionTimelineCache.delete(e), this.sessionTimelineCache.set(e, n); this.sessionTimelineCache.size >
|
|
2843
|
+
for (this.sessionTimelineCache.delete(e), this.sessionTimelineCache.set(e, n); this.sessionTimelineCache.size > hi; ) {
|
|
2832
2844
|
const i = this.sessionTimelineCache.keys().next().value;
|
|
2833
2845
|
if (!i)
|
|
2834
2846
|
break;
|
|
@@ -2858,8 +2870,8 @@ class Le {
|
|
|
2858
2870
|
return;
|
|
2859
2871
|
this.clearPendingWarmupAckTimer();
|
|
2860
2872
|
const t = Math.min(
|
|
2861
|
-
|
|
2862
|
-
|
|
2873
|
+
Vn * 2 ** e.retryAttempt,
|
|
2874
|
+
Xn
|
|
2863
2875
|
);
|
|
2864
2876
|
e.retryAttempt += 1, this.pendingWarmupAckTimer = window.setTimeout(() => {
|
|
2865
2877
|
this.pendingWarmupAckTimer = null, this.flushPendingComposerWarmup();
|
|
@@ -2880,9 +2892,9 @@ class Le {
|
|
|
2880
2892
|
}
|
|
2881
2893
|
rememberDurablyStoppedTurn(e, t) {
|
|
2882
2894
|
const n = C(t);
|
|
2883
|
-
if (!e || !n || !
|
|
2895
|
+
if (!e || !n || !_e(n) || this.findStoppedTurn(e, n))
|
|
2884
2896
|
return;
|
|
2885
|
-
const i = O(n), r =
|
|
2897
|
+
const i = O(n), r = E(n), o = typeof n.clientMessageId == "string" ? n.clientMessageId : i ? this.clientMessageIdsByUserMessageItemId.get(i) ?? null : null;
|
|
2886
2898
|
this.stoppedTurns.push({
|
|
2887
2899
|
sessionId: e,
|
|
2888
2900
|
clientMessageId: o,
|
|
@@ -2894,7 +2906,7 @@ class Le {
|
|
|
2894
2906
|
stoppedCausalSequence: P(n),
|
|
2895
2907
|
toolCallIds: new Set(
|
|
2896
2908
|
this.state.messages.filter(
|
|
2897
|
-
(a) =>
|
|
2909
|
+
(a) => Me(a, i, r)
|
|
2898
2910
|
).map((a) => a.callId).filter((a) => typeof a == "string")
|
|
2899
2911
|
)
|
|
2900
2912
|
}), this.stoppedTurns.splice(0, Math.max(0, this.stoppedTurns.length - 20));
|
|
@@ -2903,7 +2915,7 @@ class Le {
|
|
|
2903
2915
|
if (!e || !t)
|
|
2904
2916
|
return;
|
|
2905
2917
|
const n = this.findStoppedTurn(e, t);
|
|
2906
|
-
!n || n.reason !== "task_tab_closed" ||
|
|
2918
|
+
!n || n.reason !== "task_tab_closed" || An(n, t) && (this.stoppedTurns.splice(this.stoppedTurns.indexOf(n), 1), n.stoppedItemId && this.setState({
|
|
2907
2919
|
messages: this.state.messages.filter((i) => i.id !== n.stoppedItemId)
|
|
2908
2920
|
}));
|
|
2909
2921
|
}
|
|
@@ -2912,12 +2924,12 @@ class Le {
|
|
|
2912
2924
|
const n = typeof e.callId == "string" ? e.callId : null;
|
|
2913
2925
|
return !!(n && this.stoppedTurns.some((i) => i.toolCallIds.has(n)));
|
|
2914
2926
|
}
|
|
2915
|
-
return this.findStoppedTurnForEvent(e) ? e.type === "session.item" ? !
|
|
2927
|
+
return this.findStoppedTurnForEvent(e) ? e.type === "session.item" ? !_e(C(e.item)) : e.type !== "conversation.state" : !1;
|
|
2916
2928
|
}
|
|
2917
2929
|
filterStoppedSnapshotItems(e, t) {
|
|
2918
2930
|
return e.filter((n) => {
|
|
2919
2931
|
const i = C(n), r = i ? this.findStoppedTurn(t, i) : null;
|
|
2920
|
-
if (!r || i?.type === "message" && i.role === "user" ||
|
|
2932
|
+
if (!r || i?.type === "message" && i.role === "user" || _e(i))
|
|
2921
2933
|
return !0;
|
|
2922
2934
|
if (r.stoppedCausalSequence !== null) {
|
|
2923
2935
|
const o = i ? P(i) : null;
|
|
@@ -2931,7 +2943,7 @@ class Le {
|
|
|
2931
2943
|
});
|
|
2932
2944
|
}
|
|
2933
2945
|
handleServerEvent(e) {
|
|
2934
|
-
if (
|
|
2946
|
+
if (Se("server_event", e.type, Bt(e)), e.type === "session.subscribed") {
|
|
2935
2947
|
const t = typeof e.requestId == "string" ? e.requestId : null, n = typeof e.sessionId == "string" ? e.sessionId : null;
|
|
2936
2948
|
if (t && n && t === this.pendingSessionSubscription?.requestId && n === this.pendingSessionSubscription.sessionId) {
|
|
2937
2949
|
const i = this.pendingSessionSubscription;
|
|
@@ -2982,7 +2994,7 @@ class Le {
|
|
|
2982
2994
|
}
|
|
2983
2995
|
}
|
|
2984
2996
|
if (!this.shouldIgnoreStoppedTurnEvent(e) && (this.updateInactiveSessionTimelineCache(e), !this.shouldIgnoreBackgroundSessionEvent(e))) {
|
|
2985
|
-
if (
|
|
2997
|
+
if (Ai(e) && this.clearFirstResponseTimer(this.activeClientMessageId), e.type === "run.steered") {
|
|
2986
2998
|
this.handleRunSteered(e);
|
|
2987
2999
|
return;
|
|
2988
3000
|
}
|
|
@@ -2997,16 +3009,16 @@ class Le {
|
|
|
2997
3009
|
this.activeResponseRunId = t, this.setState({ turnPhase: "thinking", lastError: null }), this.markThinkingProgress();
|
|
2998
3010
|
return;
|
|
2999
3011
|
}
|
|
3000
|
-
if (
|
|
3012
|
+
if (wi(e) && this.markThinkingProgress(), e.type === "auth.ok") {
|
|
3001
3013
|
this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.transportDiagnosticEpisodes.clear();
|
|
3002
|
-
const t =
|
|
3014
|
+
const t = rr(e.user);
|
|
3003
3015
|
this.authenticatedSocket !== this.socket && this.authenticatedUserId && t && t.id !== this.authenticatedUserId && this.resetForAuthenticationScopeChange(), this.authenticatedUserId = t?.id ?? null, this.authenticatedSocket = this.socket, this.flushPendingWidgetLifecycleEvents(), this.flushPendingComposerWarmup(), this.flushQueuedClientEvents(), this.pendingClientMessageId && (this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(this.pendingClientMessageId)), this.flushPendingPassiveWarmup(), this.startHeartbeat();
|
|
3004
|
-
const n =
|
|
3016
|
+
const n = er(e), i = Object.prototype.hasOwnProperty.call(e, "appearance");
|
|
3005
3017
|
b("web-sdk.agent", "Received auth.ok appearance", {
|
|
3006
3018
|
hasAppearance: i,
|
|
3007
3019
|
rawAppearance: e.appearance,
|
|
3008
3020
|
normalizedAppearance: n
|
|
3009
|
-
}), this.runtimeHelperJavascript =
|
|
3021
|
+
}), this.runtimeHelperJavascript = tr(e.runtimeHelpers)?.javascript ?? null;
|
|
3010
3022
|
const r = Vt(e, "starterPrompts"), o = Object.prototype.hasOwnProperty.call(e, "starterPrompts"), a = e.starterPromptsLoading === !0, l = {
|
|
3011
3023
|
user: t,
|
|
3012
3024
|
status: "connected",
|
|
@@ -3057,7 +3069,7 @@ class Le {
|
|
|
3057
3069
|
runId: u?.runId
|
|
3058
3070
|
}), g = this.filterStoppedSnapshotItems(n, r), f = e.pendingMessageStatus === "sending" ? "sending" : e.pendingMessageStatus === "queued" ? "reconnecting" : null, h = typeof e.pendingClientMessageId == "string" ? e.pendingClientMessageId : null, p = e.isRetrying === !0, y = e.turnPhase === "sending" || e.turnPhase === "starting" || e.turnPhase === "thinking" ? e.turnPhase : null;
|
|
3059
3071
|
f && h && (this.pendingClientMessageId = h);
|
|
3060
|
-
let m =
|
|
3072
|
+
let m = pr(
|
|
3061
3073
|
e.assistantDraft
|
|
3062
3074
|
);
|
|
3063
3075
|
m && this.findStoppedTurn(r, {
|
|
@@ -3066,9 +3078,9 @@ class Le {
|
|
|
3066
3078
|
}) && (m = void 0);
|
|
3067
3079
|
const M = m !== void 0;
|
|
3068
3080
|
this.rememberUserMessageClientMessageIds(g);
|
|
3069
|
-
const w =
|
|
3081
|
+
const w = Er(g), D = g.filter((U) => {
|
|
3070
3082
|
const q = C(U);
|
|
3071
|
-
return
|
|
3083
|
+
return br(q) ? !1 : !q || !w || !pe(q) ? !0 : dt(g, q) !== w;
|
|
3072
3084
|
}), S = lt(
|
|
3073
3085
|
this.state.messages,
|
|
3074
3086
|
st(D, this.options.backendUrl)
|
|
@@ -3079,12 +3091,12 @@ class Le {
|
|
|
3079
3091
|
v,
|
|
3080
3092
|
re,
|
|
3081
3093
|
Y,
|
|
3082
|
-
|
|
3094
|
+
kr(g, q)
|
|
3083
3095
|
)
|
|
3084
|
-
), ee = M ? m?.content ?? "" : this.state.assistantDraft, fe = !!m?.content && !Z, B = T && (!ee || Z), Q =
|
|
3085
|
-
if (!T &&
|
|
3096
|
+
), ee = M ? m?.content ?? "" : this.state.assistantDraft, fe = !!m?.content && !Z, B = T && (!ee || Z), Q = Ar(S), oe = B && Q ? "completed" : d ? "stopped" : B ? "failed" : null;
|
|
3097
|
+
if (!T && Rr(this.state.messages, g))
|
|
3086
3098
|
return;
|
|
3087
|
-
this.lastUserMessagePageUrl =
|
|
3099
|
+
this.lastUserMessagePageUrl = Mr(g);
|
|
3088
3100
|
const j = B || d ? null : ut(g);
|
|
3089
3101
|
if (this.latestRecoverableClientMessageId = j, Q && this.clearRetryTimers(), this.setState({
|
|
3090
3102
|
sessionId: A(e.session, "id") ?? this.state.sessionId,
|
|
@@ -3157,14 +3169,14 @@ class Le {
|
|
|
3157
3169
|
this.options.backendUrl
|
|
3158
3170
|
);
|
|
3159
3171
|
t === this.sessionActivityRequestId && (this.sessionActivityRequestId = null), this.setState({
|
|
3160
|
-
messages:
|
|
3172
|
+
messages: yr(this.state.messages, i)
|
|
3161
3173
|
});
|
|
3162
3174
|
return;
|
|
3163
3175
|
}
|
|
3164
3176
|
if (e.type === "sessions.page") {
|
|
3165
3177
|
const t = typeof e.requestId == "string" ? e.requestId : null, n = t ? this.pendingSessionHistoryRequests.get(t) : null;
|
|
3166
3178
|
t && n && (window.clearTimeout(n.timeout), this.pendingSessionHistoryRequests.delete(t), n.resolve({
|
|
3167
|
-
sessions:
|
|
3179
|
+
sessions: or(e.sessions),
|
|
3168
3180
|
nextCursor: typeof e.nextCursor == "string" ? e.nextCursor : null
|
|
3169
3181
|
}));
|
|
3170
3182
|
return;
|
|
@@ -3197,21 +3209,21 @@ class Le {
|
|
|
3197
3209
|
o && (this.retryableClientMessageId = o);
|
|
3198
3210
|
return;
|
|
3199
3211
|
}
|
|
3200
|
-
const n =
|
|
3212
|
+
const n = Ue(e.item, this.options.backendUrl);
|
|
3201
3213
|
if (n) {
|
|
3202
|
-
const i =
|
|
3203
|
-
n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)),
|
|
3214
|
+
const i = qr(t, n), r = n.callId ? this.pendingToolLoadingByCallId.get(n.callId) : void 0;
|
|
3215
|
+
n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)), W(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), _r(t) && this.clearRunAckResyncRetryTimer();
|
|
3204
3216
|
const o = de(this.state.messages, n), a = ss(o), l = ns(
|
|
3205
3217
|
t,
|
|
3206
3218
|
this.state.assistantDraft,
|
|
3207
3219
|
this.state.assistantDraftItemId,
|
|
3208
3220
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
3209
3221
|
this.state.assistantDraftRunId,
|
|
3210
|
-
|
|
3222
|
+
vs(
|
|
3211
3223
|
o,
|
|
3212
3224
|
o.findIndex((d) => d.id === n.id)
|
|
3213
3225
|
)
|
|
3214
|
-
), c = a && (!this.state.assistantDraft || l), u =
|
|
3226
|
+
), c = a && (!this.state.assistantDraft || l), u = De(n) && (c || W(n) && !this.state.isThinking && this.activeClientMessageId === null);
|
|
3215
3227
|
this.setState({
|
|
3216
3228
|
messages: o,
|
|
3217
3229
|
...l ? {
|
|
@@ -3271,7 +3283,7 @@ class Le {
|
|
|
3271
3283
|
return;
|
|
3272
3284
|
const o = n ? this.clientMessageIdsByUserMessageItemId.get(n) ?? null : null, a = !this.activeClientMessageId || (o ? o === this.activeClientMessageId : this.activeResponseUserMessageId ? !n || n === this.activeResponseUserMessageId : !this.activeResponseRunId || !i || i === this.activeResponseRunId), l = Dt(
|
|
3273
3285
|
this.state.messages.filter(
|
|
3274
|
-
(c) => c.dataType !== "assistant_draft" || !
|
|
3286
|
+
(c) => c.dataType !== "assistant_draft" || !Me(
|
|
3275
3287
|
c,
|
|
3276
3288
|
n,
|
|
3277
3289
|
i
|
|
@@ -3376,13 +3388,13 @@ class Le {
|
|
|
3376
3388
|
return;
|
|
3377
3389
|
}
|
|
3378
3390
|
o && i && r && (this.retryableClientMessageId = r);
|
|
3379
|
-
const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l =
|
|
3391
|
+
const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l = Fi(a.message);
|
|
3380
3392
|
l && console.error(l);
|
|
3381
3393
|
const c = r ?? this.activeClientMessageId, u = typeof e.runId == "string" ? e.runId : null, d = rs(
|
|
3382
3394
|
this.state.messages,
|
|
3383
3395
|
c,
|
|
3384
3396
|
u
|
|
3385
|
-
), g =
|
|
3397
|
+
), g = wr(
|
|
3386
3398
|
d,
|
|
3387
3399
|
c,
|
|
3388
3400
|
u
|
|
@@ -3413,7 +3425,7 @@ class Le {
|
|
|
3413
3425
|
}
|
|
3414
3426
|
applyAccountSubmissionError(e) {
|
|
3415
3427
|
if (!this.account || !e) return;
|
|
3416
|
-
const t =
|
|
3428
|
+
const t = bn(this.account.submissionGate, e);
|
|
3417
3429
|
if (!(t === this.account.submissionGate || t.allowed)) {
|
|
3418
3430
|
this.account = {
|
|
3419
3431
|
...this.account,
|
|
@@ -3426,10 +3438,10 @@ class Le {
|
|
|
3426
3438
|
if (this.options.productVariant !== "personal" || !e || typeof e != "object" || this.personalModelSelectionOverride !== null)
|
|
3427
3439
|
return;
|
|
3428
3440
|
const t = e.metadata, n = t && typeof t == "object" ? t.model : void 0;
|
|
3429
|
-
this.options.model =
|
|
3441
|
+
this.options.model = Ve(n) ? n : "gpt-5.6-sol";
|
|
3430
3442
|
}
|
|
3431
3443
|
updateAccountFallbackFromSession(e) {
|
|
3432
|
-
const t = e && typeof e == "object" ? e.metadata : null, n =
|
|
3444
|
+
const t = e && typeof e == "object" ? e.metadata : null, n = Rn(t);
|
|
3433
3445
|
if (this.usingPaidCreditFallback !== n && (this.usingPaidCreditFallback = n, !!this.account)) {
|
|
3434
3446
|
this.account = { ...this.account, usingPaidCreditFallback: n };
|
|
3435
3447
|
for (const i of this.accountListeners) i(this.getAccount());
|
|
@@ -3466,7 +3478,7 @@ class Le {
|
|
|
3466
3478
|
const i = C(e.item);
|
|
3467
3479
|
if (pe(i))
|
|
3468
3480
|
return;
|
|
3469
|
-
const r =
|
|
3481
|
+
const r = Ue(e.item, this.options.backendUrl);
|
|
3470
3482
|
r && this.rememberSessionTimeline(t, de(n, r));
|
|
3471
3483
|
return;
|
|
3472
3484
|
}
|
|
@@ -3515,7 +3527,7 @@ class Le {
|
|
|
3515
3527
|
if (e.type === "chat.assistant_done") {
|
|
3516
3528
|
const i = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : null, r = typeof e.runId == "string" ? e.runId : null, o = Dt(
|
|
3517
3529
|
n.filter(
|
|
3518
|
-
(a) => a.dataType !== "assistant_draft" || !
|
|
3530
|
+
(a) => a.dataType !== "assistant_draft" || !Me(a, i, r)
|
|
3519
3531
|
),
|
|
3520
3532
|
i,
|
|
3521
3533
|
r,
|
|
@@ -3549,7 +3561,7 @@ class Le {
|
|
|
3549
3561
|
}
|
|
3550
3562
|
e.type === "error" && typeof e.requestId != "string" && !is(e, t) && this.rememberSessionTimeline(
|
|
3551
3563
|
t,
|
|
3552
|
-
|
|
3564
|
+
Ur(n, e)
|
|
3553
3565
|
);
|
|
3554
3566
|
}
|
|
3555
3567
|
}
|
|
@@ -3647,7 +3659,7 @@ class Le {
|
|
|
3647
3659
|
e.clear();
|
|
3648
3660
|
}
|
|
3649
3661
|
markThinkingProgress() {
|
|
3650
|
-
!this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(
|
|
3662
|
+
!this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(Yn), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
|
|
3651
3663
|
}
|
|
3652
3664
|
scheduleThinkingWatchdog(e) {
|
|
3653
3665
|
this.thinkingWatchdogTimer !== null && window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = window.setTimeout(() => {
|
|
@@ -3711,13 +3723,13 @@ class Le {
|
|
|
3711
3723
|
if (this.state.status === "closed" || this.pendingClientMessageId !== e || !this.pendingUserMessageEvent)
|
|
3712
3724
|
return;
|
|
3713
3725
|
const t = this.retryAttemptsByClientMessageId[e] ?? 0;
|
|
3714
|
-
if (t >=
|
|
3726
|
+
if (t >= ei) {
|
|
3715
3727
|
this.failPendingDelivery(e);
|
|
3716
3728
|
return;
|
|
3717
3729
|
}
|
|
3718
3730
|
t === 0 && this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.retryAttemptsByClientMessageId[e] = t + 1, this.setState({ pendingMessageStatus: "reconnecting" }), this.pendingDeliveryRetryTimer = window.setTimeout(() => {
|
|
3719
3731
|
this.pendingDeliveryRetryTimer = null, !(this.pendingClientMessageId !== e || !this.pendingUserMessageEvent) && (this.send(this.pendingUserMessageEvent), this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(e));
|
|
3720
|
-
},
|
|
3732
|
+
}, gi(t, ii));
|
|
3721
3733
|
}
|
|
3722
3734
|
failPendingDelivery(e) {
|
|
3723
3735
|
if (this.pendingClientMessageId !== e)
|
|
@@ -3730,7 +3742,7 @@ class Le {
|
|
|
3730
3742
|
...this.state.isThinking ? {} : { turnPhase: null },
|
|
3731
3743
|
isRetrying: !1,
|
|
3732
3744
|
...this.state.isThinking ? {} : { taskStatus: "failed" },
|
|
3733
|
-
lastError:
|
|
3745
|
+
lastError: si,
|
|
3734
3746
|
lastErrorCode: "message_delivery_failed"
|
|
3735
3747
|
});
|
|
3736
3748
|
}
|
|
@@ -3774,7 +3786,7 @@ class Le {
|
|
|
3774
3786
|
!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== e || (b("web-sdk.agent", "Pluno run ack missed; resyncing session", {
|
|
3775
3787
|
sessionId: this.state.sessionId,
|
|
3776
3788
|
clientMessageId: e
|
|
3777
|
-
}), this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(
|
|
3789
|
+
}), this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(Wt));
|
|
3778
3790
|
}
|
|
3779
3791
|
clearRunAckResyncRetryTimer() {
|
|
3780
3792
|
this.runAckResyncRetryTimer !== null && (window.clearTimeout(this.runAckResyncRetryTimer), this.runAckResyncRetryTimer = null);
|
|
@@ -3797,7 +3809,7 @@ class Le {
|
|
|
3797
3809
|
),
|
|
3798
3810
|
isThinking: !1,
|
|
3799
3811
|
taskStatus: "failed",
|
|
3800
|
-
lastError:
|
|
3812
|
+
lastError: ti,
|
|
3801
3813
|
lastErrorCode: "run_recovery_exhausted"
|
|
3802
3814
|
}), this.clearThinkingWatchdog();
|
|
3803
3815
|
return;
|
|
@@ -3807,7 +3819,7 @@ class Le {
|
|
|
3807
3819
|
sessionId: this.state.sessionId,
|
|
3808
3820
|
clientMessageId: e,
|
|
3809
3821
|
resyncAttempts: t + 1
|
|
3810
|
-
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(
|
|
3822
|
+
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(Wt);
|
|
3811
3823
|
}
|
|
3812
3824
|
resyncThinkingSession() {
|
|
3813
3825
|
this.state.sessionId ? this.send({
|
|
@@ -3824,7 +3836,7 @@ class Le {
|
|
|
3824
3836
|
if (!t || !n || !i)
|
|
3825
3837
|
return;
|
|
3826
3838
|
const a = i === "execute_code", l = i === "execute_code_in_browser_tab" && o !== null && typeof o == "object" && o.tabId === "local:current";
|
|
3827
|
-
if (!a && !l || !
|
|
3839
|
+
if (!a && !l || !so(o)) {
|
|
3828
3840
|
this.setToolMessageLoading(n, !1), this.send({
|
|
3829
3841
|
type: "tool.result",
|
|
3830
3842
|
sessionId: t,
|
|
@@ -3873,7 +3885,7 @@ class Le {
|
|
|
3873
3885
|
let c = null, u;
|
|
3874
3886
|
c = await this.executeRuntimeHelper(), u = await Gt(
|
|
3875
3887
|
o,
|
|
3876
|
-
|
|
3888
|
+
xi(e.runtimeContext, this.options.backendUrl)
|
|
3877
3889
|
).catch((d) => ({
|
|
3878
3890
|
ok: !1,
|
|
3879
3891
|
exception: {
|
|
@@ -3886,7 +3898,7 @@ class Le {
|
|
|
3886
3898
|
toolName: i,
|
|
3887
3899
|
summary: o.summary,
|
|
3888
3900
|
rawInput: L(o),
|
|
3889
|
-
rawOutput: L(
|
|
3901
|
+
rawOutput: L(sr(u, c))
|
|
3890
3902
|
}), ls(this.options.clientId, this.activeBrowserToolCalls.values()));
|
|
3891
3903
|
}
|
|
3892
3904
|
setToolMessageLoading(e, t) {
|
|
@@ -3901,17 +3913,17 @@ class Le {
|
|
|
3901
3913
|
if (this.pageLifecycleCleanup)
|
|
3902
3914
|
return;
|
|
3903
3915
|
const e = () => {
|
|
3904
|
-
|
|
3916
|
+
Ds(this.options.clientId, this.activeBrowserToolCalls.values());
|
|
3905
3917
|
};
|
|
3906
3918
|
window.addEventListener("pagehide", e), window.addEventListener("beforeunload", e), this.pageLifecycleCleanup = () => {
|
|
3907
3919
|
window.removeEventListener("pagehide", e), window.removeEventListener("beforeunload", e);
|
|
3908
3920
|
};
|
|
3909
3921
|
}
|
|
3910
3922
|
installSessionBrowserApis() {
|
|
3911
|
-
this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup =
|
|
3923
|
+
this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = Ei();
|
|
3912
3924
|
}
|
|
3913
3925
|
cleanupSessionBrowserApis() {
|
|
3914
|
-
this.sessionBrowserApisCleanup && (
|
|
3926
|
+
this.sessionBrowserApisCleanup && (qi(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
|
|
3915
3927
|
}
|
|
3916
3928
|
async executeRuntimeHelper() {
|
|
3917
3929
|
if (!this.runtimeHelperJavascript?.trim())
|
|
@@ -3919,15 +3931,15 @@ class Le {
|
|
|
3919
3931
|
const e = await Gt({
|
|
3920
3932
|
javascript: this.runtimeHelperJavascript
|
|
3921
3933
|
});
|
|
3922
|
-
return e.ok === !1 ?
|
|
3934
|
+
return e.ok === !1 ? nr(e) : null;
|
|
3923
3935
|
}
|
|
3924
3936
|
enableNetworkCapture() {
|
|
3925
|
-
this.networkCaptureCleanup || (this.networkCaptureCleanup =
|
|
3926
|
-
|
|
3937
|
+
this.networkCaptureCleanup || (this.networkCaptureCleanup = Si((e) => {
|
|
3938
|
+
lo(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
|
|
3927
3939
|
}));
|
|
3928
3940
|
}
|
|
3929
3941
|
enqueueNetworkEvent(e) {
|
|
3930
|
-
this.queuedNetworkEvents.length >=
|
|
3942
|
+
this.queuedNetworkEvents.length >= oi || (this.queuedNetworkEvents.push(ao(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
|
|
3931
3943
|
this.networkBatchTimer = null;
|
|
3932
3944
|
const t = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
|
|
3933
3945
|
t.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
|
|
@@ -3936,14 +3948,14 @@ class Le {
|
|
|
3936
3948
|
page: _(),
|
|
3937
3949
|
events: t
|
|
3938
3950
|
});
|
|
3939
|
-
},
|
|
3951
|
+
}, ri)));
|
|
3940
3952
|
}
|
|
3941
3953
|
scheduleReconnect(e = 0) {
|
|
3942
3954
|
if (this.reconnectTimer !== null || this.state.status === "closed")
|
|
3943
3955
|
return;
|
|
3944
3956
|
const t = Math.min(
|
|
3945
3957
|
ot,
|
|
3946
|
-
Math.max(
|
|
3958
|
+
Math.max(fi(this.reconnectAttempts), e)
|
|
3947
3959
|
);
|
|
3948
3960
|
this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
|
|
3949
3961
|
this.reconnectTimer = null, this.connect().catch((n) => {
|
|
@@ -3960,8 +3972,8 @@ class Le {
|
|
|
3960
3972
|
const e = this.socket;
|
|
3961
3973
|
!e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
|
|
3962
3974
|
this.socket === e && (b("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
|
|
3963
|
-
},
|
|
3964
|
-
},
|
|
3975
|
+
}, jn));
|
|
3976
|
+
}, $n);
|
|
3965
3977
|
}
|
|
3966
3978
|
stopHeartbeat() {
|
|
3967
3979
|
this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
|
|
@@ -3999,12 +4011,12 @@ class Le {
|
|
|
3999
4011
|
...e.lastError === null && e.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
|
|
4000
4012
|
...e.lastError !== void 0 && e.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
|
|
4001
4013
|
}, a = this.state.sessionId, l = this.state.isThinking || this.state.pendingMessageStatus !== null, c = o.isThinking || o.pendingMessageStatus !== null, u = this.activeClientMessageId ?? this.pendingClientMessageId;
|
|
4002
|
-
u && u === this.lastProjectedTurnClientMessageId && c &&
|
|
4014
|
+
u && u === this.lastProjectedTurnClientMessageId && c && Mi(this.lastProjectedTurnPhase, o.turnPhase) && this.reportHealthSignal("invalid_state_transition", {
|
|
4003
4015
|
clientMessageId: u,
|
|
4004
4016
|
reason: "active_turn_phase_moved_backward",
|
|
4005
4017
|
previousPhase: this.lastProjectedTurnPhase,
|
|
4006
4018
|
nextPhase: o.turnPhase
|
|
4007
|
-
}), this.state = o, this.lastProjectedTurnClientMessageId = u, this.lastProjectedTurnPhase = o.turnPhase, o.sessionId && (o.sessionId === a && c !== l || o.sessionId !== a && c) && this.sessionHistoryManager.setActivity(o.sessionId, c), this.rebuildRuntimeInteractions(), e.messages !== void 0 && this.refreshRuntimeInteractions(), this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages),
|
|
4019
|
+
}), this.state = o, this.lastProjectedTurnClientMessageId = u, this.lastProjectedTurnPhase = o.turnPhase, o.sessionId && (o.sessionId === a && c !== l || o.sessionId !== a && c) && this.sessionHistoryManager.setActivity(o.sessionId, c), this.rebuildRuntimeInteractions(), e.messages !== void 0 && this.refreshRuntimeInteractions(), this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages), jr(this.options.clientId, this.state), this.emit("state", this.getState()), Se("state", this.state.status, {
|
|
4008
4020
|
status: this.state.status,
|
|
4009
4021
|
sessionId: this.state.sessionId,
|
|
4010
4022
|
messageCount: this.state.messages.length,
|
|
@@ -4063,13 +4075,13 @@ class Le {
|
|
|
4063
4075
|
}
|
|
4064
4076
|
}
|
|
4065
4077
|
const Ze = /* @__PURE__ */ new WeakMap();
|
|
4066
|
-
function
|
|
4067
|
-
const e = window.__plunoProductAgentNetworkCapture ??
|
|
4078
|
+
function Si(s) {
|
|
4079
|
+
const e = window.__plunoProductAgentNetworkCapture ?? Ti();
|
|
4068
4080
|
return e.subscribers.add(s), () => {
|
|
4069
4081
|
e.subscribers.delete(s), !(e.subscribers.size > 0) && (e.destroy(), window.__plunoProductAgentNetworkCapture === e && delete window.__plunoProductAgentNetworkCapture);
|
|
4070
4082
|
};
|
|
4071
4083
|
}
|
|
4072
|
-
function
|
|
4084
|
+
function Ti() {
|
|
4073
4085
|
const s = /* @__PURE__ */ new Set(), e = (g) => {
|
|
4074
4086
|
s.forEach((f) => {
|
|
4075
4087
|
try {
|
|
@@ -4086,11 +4098,11 @@ function yi() {
|
|
|
4086
4098
|
throw m;
|
|
4087
4099
|
}
|
|
4088
4100
|
try {
|
|
4089
|
-
const m = f instanceof Request ? f : null, M =
|
|
4101
|
+
const m = f instanceof Request ? f : null, M = no(f, m), w = Ls(h?.headers ?? m?.headers);
|
|
4090
4102
|
if (!te(M, w, h?.body)) {
|
|
4091
4103
|
const H = {
|
|
4092
4104
|
requestId: nt("fetch"),
|
|
4093
|
-
url:
|
|
4105
|
+
url: F(M, Ye),
|
|
4094
4106
|
method: (h?.method ?? m?.method ?? "GET").toUpperCase(),
|
|
4095
4107
|
requestHeaders: w,
|
|
4096
4108
|
requestBody: us(h?.body),
|
|
@@ -4099,7 +4111,7 @@ function yi() {
|
|
|
4099
4111
|
};
|
|
4100
4112
|
y.then(
|
|
4101
4113
|
(S) => {
|
|
4102
|
-
|
|
4114
|
+
io(S, H, p, e).catch(() => {
|
|
4103
4115
|
e({
|
|
4104
4116
|
...H,
|
|
4105
4117
|
responseStatus: S.status,
|
|
@@ -4110,7 +4122,7 @@ function yi() {
|
|
|
4110
4122
|
(S) => {
|
|
4111
4123
|
e({
|
|
4112
4124
|
...H,
|
|
4113
|
-
errorText:
|
|
4125
|
+
errorText: F(S instanceof Error ? S.message : String(S)),
|
|
4114
4126
|
durationMs: Date.now() - p
|
|
4115
4127
|
});
|
|
4116
4128
|
}
|
|
@@ -4124,7 +4136,7 @@ function yi() {
|
|
|
4124
4136
|
return Ze.set(this, {
|
|
4125
4137
|
requestId: nt("xhr"),
|
|
4126
4138
|
method: String(f ?? "GET").toUpperCase(),
|
|
4127
|
-
url:
|
|
4139
|
+
url: F(w, Ye),
|
|
4128
4140
|
requestHeaders: {},
|
|
4129
4141
|
startedAtMs: Date.now(),
|
|
4130
4142
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -4141,7 +4153,7 @@ function yi() {
|
|
|
4141
4153
|
() => {
|
|
4142
4154
|
queueMicrotask(() => {
|
|
4143
4155
|
try {
|
|
4144
|
-
const p =
|
|
4156
|
+
const p = uo(this.getAllResponseHeaders());
|
|
4145
4157
|
e({
|
|
4146
4158
|
requestId: h.requestId,
|
|
4147
4159
|
url: h.url,
|
|
@@ -4151,7 +4163,7 @@ function yi() {
|
|
|
4151
4163
|
resourceType: "xhr",
|
|
4152
4164
|
responseStatus: this.status,
|
|
4153
4165
|
responseHeaders: p,
|
|
4154
|
-
responseBody:
|
|
4166
|
+
responseBody: oo(this, p),
|
|
4155
4167
|
errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
|
|
4156
4168
|
startedAt: h.startedAt,
|
|
4157
4169
|
durationMs: Date.now() - h.startedAtMs
|
|
@@ -4193,7 +4205,7 @@ function yi() {
|
|
|
4193
4205
|
const p = performance.timeOrigin + h.startTime;
|
|
4194
4206
|
e({
|
|
4195
4207
|
requestId: nt("resource"),
|
|
4196
|
-
url:
|
|
4208
|
+
url: F(h.name, Ye),
|
|
4197
4209
|
method: "GET",
|
|
4198
4210
|
resourceType: "resource",
|
|
4199
4211
|
responseStatus: h.responseStatus,
|
|
@@ -4247,10 +4259,10 @@ function Kt(s) {
|
|
|
4247
4259
|
const e = typeof s == "function" ? s() : s;
|
|
4248
4260
|
return e && Object.keys(e).length > 0 ? e : void 0;
|
|
4249
4261
|
}
|
|
4250
|
-
function
|
|
4262
|
+
function wi(s) {
|
|
4251
4263
|
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";
|
|
4252
4264
|
}
|
|
4253
|
-
function
|
|
4265
|
+
function Ai(s) {
|
|
4254
4266
|
if (s.type === "chat.assistant_delta")
|
|
4255
4267
|
return typeof s.delta == "string" && s.delta.trim().length > 0;
|
|
4256
4268
|
if (s.type === "tool.call")
|
|
@@ -4260,7 +4272,7 @@ function Si(s) {
|
|
|
4260
4272
|
const e = C(s.item);
|
|
4261
4273
|
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;
|
|
4262
4274
|
}
|
|
4263
|
-
function
|
|
4275
|
+
function Mi(s, e) {
|
|
4264
4276
|
if (!s || !e)
|
|
4265
4277
|
return !1;
|
|
4266
4278
|
const t = {
|
|
@@ -4288,31 +4300,31 @@ function K(s) {
|
|
|
4288
4300
|
}
|
|
4289
4301
|
return null;
|
|
4290
4302
|
}
|
|
4291
|
-
const
|
|
4292
|
-
function
|
|
4303
|
+
const bi = 5e3, Ri = 12e4;
|
|
4304
|
+
function Ei() {
|
|
4293
4305
|
const s = [
|
|
4294
|
-
|
|
4295
|
-
|
|
4306
|
+
Ci(),
|
|
4307
|
+
ki()
|
|
4296
4308
|
].filter((e) => typeof e == "function");
|
|
4297
4309
|
return () => {
|
|
4298
4310
|
for (const e of s.reverse())
|
|
4299
4311
|
e();
|
|
4300
4312
|
};
|
|
4301
4313
|
}
|
|
4302
|
-
function
|
|
4303
|
-
return
|
|
4314
|
+
function ki() {
|
|
4315
|
+
return ps(globalThis, "getPageSnapshot", async () => At());
|
|
4304
4316
|
}
|
|
4305
|
-
function
|
|
4306
|
-
return
|
|
4307
|
-
inspectImage: async (e, t) => await
|
|
4317
|
+
function Ci() {
|
|
4318
|
+
return ps(globalThis, "pageImages", {
|
|
4319
|
+
inspectImage: async (e, t) => await _i(e, t)
|
|
4308
4320
|
});
|
|
4309
4321
|
}
|
|
4310
|
-
async function
|
|
4311
|
-
const t =
|
|
4322
|
+
async function _i(s, e = {}) {
|
|
4323
|
+
const t = Di(e.name), n = await Pi(s);
|
|
4312
4324
|
return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
|
|
4313
4325
|
type: "pluno.pageImages.inspectImage",
|
|
4314
4326
|
imageAttached: !1,
|
|
4315
|
-
imageAttachmentError:
|
|
4327
|
+
imageAttachmentError: As
|
|
4316
4328
|
} : {
|
|
4317
4329
|
type: "pluno.pageImages.inspectImage",
|
|
4318
4330
|
imageAttached: !0,
|
|
@@ -4326,15 +4338,15 @@ async function ki(s, e = {}) {
|
|
|
4326
4338
|
imageAttachmentError: n.error
|
|
4327
4339
|
};
|
|
4328
4340
|
}
|
|
4329
|
-
async function
|
|
4330
|
-
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:
|
|
4341
|
+
async function Pi(s) {
|
|
4342
|
+
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: As } : {
|
|
4331
4343
|
ok: !0,
|
|
4332
4344
|
mimeType: s.type,
|
|
4333
4345
|
sizeBytes: s.size,
|
|
4334
|
-
dataUrl: await
|
|
4335
|
-
} : { 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." } :
|
|
4346
|
+
dataUrl: await Oi(s)
|
|
4347
|
+
} : { 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." } : vi(s);
|
|
4336
4348
|
}
|
|
4337
|
-
function
|
|
4349
|
+
function vi(s) {
|
|
4338
4350
|
if (!s.startsWith("data:") || !s.includes(","))
|
|
4339
4351
|
return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
|
|
4340
4352
|
const [e, t] = s.slice(5).split(",", 2), n = e.split(";").map((a) => a.trim()).filter(Boolean), i = n[0] ?? "";
|
|
@@ -4345,7 +4357,7 @@ function Ci(s) {
|
|
|
4345
4357
|
const r = t.replace(/[ \t\r\n\f]+/g, "");
|
|
4346
4358
|
if (!/^[A-Za-z0-9+/]*={0,2}$/.test(r))
|
|
4347
4359
|
return { ok: !1, error: "Page image data URL has invalid base64." };
|
|
4348
|
-
const o =
|
|
4360
|
+
const o = Ui(r);
|
|
4349
4361
|
return o === null ? { ok: !1, error: "Page image data URL has invalid base64." } : o === 0 ? { ok: !1, error: "Page image is empty." } : {
|
|
4350
4362
|
ok: !0,
|
|
4351
4363
|
mimeType: i,
|
|
@@ -4353,22 +4365,22 @@ function Ci(s) {
|
|
|
4353
4365
|
dataUrl: `data:${i};base64,${r}`
|
|
4354
4366
|
};
|
|
4355
4367
|
}
|
|
4356
|
-
function
|
|
4368
|
+
function Ui(s) {
|
|
4357
4369
|
if (s.length === 0 || s.length % 4 !== 0)
|
|
4358
4370
|
return null;
|
|
4359
4371
|
const e = s.length - s.replace(/=+$/, "").length;
|
|
4360
4372
|
return e > 2 ? null : s.length / 4 * 3 - e;
|
|
4361
4373
|
}
|
|
4362
|
-
function
|
|
4374
|
+
function Di(s) {
|
|
4363
4375
|
return (typeof s == "string" ? s.trim() : "") || "Page image";
|
|
4364
4376
|
}
|
|
4365
|
-
function
|
|
4377
|
+
function qi(s) {
|
|
4366
4378
|
try {
|
|
4367
4379
|
s();
|
|
4368
4380
|
} catch {
|
|
4369
4381
|
}
|
|
4370
4382
|
}
|
|
4371
|
-
function
|
|
4383
|
+
function Oi(s) {
|
|
4372
4384
|
return new Promise((e, t) => {
|
|
4373
4385
|
const n = new FileReader();
|
|
4374
4386
|
n.onload = () => {
|
|
@@ -4382,7 +4394,7 @@ function Ui(s) {
|
|
|
4382
4394
|
}
|
|
4383
4395
|
async function Gt(s, e) {
|
|
4384
4396
|
const t = Object.getPrototypeOf(async function() {
|
|
4385
|
-
}).constructor, n = s.timeoutMs ??
|
|
4397
|
+
}).constructor, n = s.timeoutMs ?? bi, i = Date.now(), r = [];
|
|
4386
4398
|
let o;
|
|
4387
4399
|
const a = {
|
|
4388
4400
|
log: console.log,
|
|
@@ -4400,7 +4412,7 @@ async function Gt(s, e) {
|
|
|
4400
4412
|
o = window.setTimeout(() => d(c), n);
|
|
4401
4413
|
})
|
|
4402
4414
|
]);
|
|
4403
|
-
return u === c ?
|
|
4415
|
+
return u === c ? Li(n) : {
|
|
4404
4416
|
ok: !0,
|
|
4405
4417
|
result: u,
|
|
4406
4418
|
console: r,
|
|
@@ -4429,7 +4441,7 @@ async function Gt(s, e) {
|
|
|
4429
4441
|
e?.deactivate(), o !== void 0 && window.clearTimeout(o), console.log = a.log, console.info = a.info, console.warn = a.warn, console.error = a.error;
|
|
4430
4442
|
}
|
|
4431
4443
|
}
|
|
4432
|
-
function
|
|
4444
|
+
function xi(s, e) {
|
|
4433
4445
|
if (!s || typeof s != "object")
|
|
4434
4446
|
return;
|
|
4435
4447
|
const t = s.sandboxFilesToken;
|
|
@@ -4439,7 +4451,7 @@ function Di(s, e) {
|
|
|
4439
4451
|
const i = () => {
|
|
4440
4452
|
if (!n)
|
|
4441
4453
|
throw new Error("sandboxFiles is only available during browser-code execution");
|
|
4442
|
-
}, r = async (a, l) => await
|
|
4454
|
+
}, r = async (a, l) => await qn(`${e.replace(/\/$/, "")}${a}`, l);
|
|
4443
4455
|
return {
|
|
4444
4456
|
value: Object.freeze({
|
|
4445
4457
|
upload: async (a) => {
|
|
@@ -4473,7 +4485,7 @@ function Di(s, e) {
|
|
|
4473
4485
|
}
|
|
4474
4486
|
};
|
|
4475
4487
|
}
|
|
4476
|
-
function
|
|
4488
|
+
function Li(s) {
|
|
4477
4489
|
return {
|
|
4478
4490
|
ok: !1,
|
|
4479
4491
|
exception: {
|
|
@@ -4487,10 +4499,10 @@ function qi(s) {
|
|
|
4487
4499
|
}
|
|
4488
4500
|
};
|
|
4489
4501
|
}
|
|
4490
|
-
function
|
|
4502
|
+
function Ni(s) {
|
|
4491
4503
|
return s.replace(/\/+$/, "");
|
|
4492
4504
|
}
|
|
4493
|
-
function
|
|
4505
|
+
function Hi(s) {
|
|
4494
4506
|
const e = {
|
|
4495
4507
|
sidepanel: "extension_sidepanel",
|
|
4496
4508
|
browser_extension_page_ui: "extension_widget",
|
|
@@ -4502,13 +4514,13 @@ function xi(s) {
|
|
|
4502
4514
|
};
|
|
4503
4515
|
return s && s in e ? e[s] : s ?? "embedded_custom_ui";
|
|
4504
4516
|
}
|
|
4505
|
-
function
|
|
4517
|
+
function Bi(s) {
|
|
4506
4518
|
return s === "pluno" ? "scheduled_continuation" : s ?? "user";
|
|
4507
4519
|
}
|
|
4508
|
-
function
|
|
4520
|
+
function Fi(s, e = location.origin) {
|
|
4509
4521
|
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;
|
|
4510
4522
|
}
|
|
4511
|
-
function
|
|
4523
|
+
function Wi(s) {
|
|
4512
4524
|
const e = new URL("/api/product-agent/embed/ws", s);
|
|
4513
4525
|
return e.protocol = e.protocol === "https:" ? "wss:" : "ws:", e.toString();
|
|
4514
4526
|
}
|
|
@@ -4521,21 +4533,21 @@ function _() {
|
|
|
4521
4533
|
...s ? { plunoProductAgentUi: s } : {}
|
|
4522
4534
|
};
|
|
4523
4535
|
}
|
|
4524
|
-
function
|
|
4536
|
+
function $i() {
|
|
4525
4537
|
return {
|
|
4526
4538
|
pageUrl: location.href,
|
|
4527
4539
|
pageTitle: document.title,
|
|
4528
4540
|
htmlContent: At()
|
|
4529
4541
|
};
|
|
4530
4542
|
}
|
|
4531
|
-
function
|
|
4532
|
-
return
|
|
4533
|
-
|
|
4543
|
+
function ji(s) {
|
|
4544
|
+
return Ce.add(s), we || (we = zi()), () => {
|
|
4545
|
+
Ce.delete(s), Ce.size === 0 && (we?.(), we = null);
|
|
4534
4546
|
};
|
|
4535
4547
|
}
|
|
4536
|
-
function
|
|
4548
|
+
function zi() {
|
|
4537
4549
|
const s = () => {
|
|
4538
|
-
for (const r of Array.from(
|
|
4550
|
+
for (const r of Array.from(Ce))
|
|
4539
4551
|
r();
|
|
4540
4552
|
}, e = window.history.pushState.bind(window.history), t = window.history.replaceState.bind(window.history), n = ((...r) => {
|
|
4541
4553
|
const o = e(...r);
|
|
@@ -4560,16 +4572,16 @@ function At() {
|
|
|
4560
4572
|
};
|
|
4561
4573
|
t("Selected text", window.getSelection()?.toString() ?? "");
|
|
4562
4574
|
const n = "[role='dialog'], [role='alertdialog'], dialog[open], [aria-modal='true']", i = Array.from(document.querySelectorAll(n)).filter(
|
|
4563
|
-
(p) =>
|
|
4575
|
+
(p) => bs(p) && !p.parentElement?.closest(n)
|
|
4564
4576
|
);
|
|
4565
4577
|
for (const p of i.slice(0, 3))
|
|
4566
4578
|
t("Active overlay", tt(he(p), e));
|
|
4567
|
-
const r =
|
|
4579
|
+
const r = Ki(), o = r ? tt(he(r), e) : "";
|
|
4568
4580
|
t("Main page content", o), t("Additional visible page text", tt(he(document.body), e));
|
|
4569
4581
|
const a = s.map(([p, y]) => `${p}:
|
|
4570
4582
|
${y}`).join(`
|
|
4571
4583
|
|
|
4572
|
-
`).trim().slice(0, 12e3), l =
|
|
4584
|
+
`).trim().slice(0, 12e3), l = Gi(i, r).trim(), c = `Simplified DOM outline:
|
|
4573
4585
|
`, u = `
|
|
4574
4586
|
|
|
4575
4587
|
Visible page text:
|
|
@@ -4593,14 +4605,14 @@ function tt(s, e) {
|
|
|
4593
4605
|
t = t.replace(n, "");
|
|
4594
4606
|
return ne(t);
|
|
4595
4607
|
}
|
|
4596
|
-
function
|
|
4608
|
+
function bs(s) {
|
|
4597
4609
|
const e = window.getComputedStyle(s);
|
|
4598
4610
|
return e.display !== "none" && e.visibility !== "hidden" && s.getClientRects().length > 0;
|
|
4599
4611
|
}
|
|
4600
|
-
function
|
|
4601
|
-
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(
|
|
4612
|
+
function Ki() {
|
|
4613
|
+
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(bs).sort((s, e) => he(e).length - he(s).length)[0] ?? null;
|
|
4602
4614
|
}
|
|
4603
|
-
function
|
|
4615
|
+
function Gi(s, e) {
|
|
4604
4616
|
const t = /* @__PURE__ */ new Set([
|
|
4605
4617
|
"main",
|
|
4606
4618
|
"nav",
|
|
@@ -4680,7 +4692,7 @@ function ji(s, e) {
|
|
|
4680
4692
|
"data-test",
|
|
4681
4693
|
"data-qa",
|
|
4682
4694
|
"data-cy"
|
|
4683
|
-
], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: u, priorityTargets: d } =
|
|
4695
|
+
], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: u, priorityTargets: d } = Qi(), g = new Set(s);
|
|
4684
4696
|
e && g.add(e);
|
|
4685
4697
|
let f = 0;
|
|
4686
4698
|
const h = (w) => {
|
|
@@ -4695,7 +4707,7 @@ function ji(s, e) {
|
|
|
4695
4707
|
if (f >= 1e3 && !Y || H.has(T) || r.has(v) || T.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || re.display === "none" || re.visibility === "hidden")
|
|
4696
4708
|
return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
|
|
4697
4709
|
f += 1;
|
|
4698
|
-
const Z = h(T), ee =
|
|
4710
|
+
const Z = h(T), ee = Es(T), fe = a.has(Z) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(v) || v === "a" && T.hasAttribute("href"), B = Array.from(T.children).filter((I) => I instanceof HTMLElement), Q = /* @__PURE__ */ new Map();
|
|
4699
4711
|
for (const I of B) {
|
|
4700
4712
|
const R = p(I);
|
|
4701
4713
|
Q.set(R, (Q.get(R) ?? 0) + 1);
|
|
@@ -4705,7 +4717,7 @@ function ji(s, e) {
|
|
|
4705
4717
|
const R = p(I), z = oe.get(R) ?? 0;
|
|
4706
4718
|
oe.set(R, z + 1), (Q.get(R) ?? 0) > 8 && z >= 6 && !u.has(I) && me.set(R, (me.get(R) ?? 0) + 1);
|
|
4707
4719
|
}
|
|
4708
|
-
const j = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Set(), q = [],
|
|
4720
|
+
const j = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Set(), q = [], Et = [];
|
|
4709
4721
|
for (const I of B) {
|
|
4710
4722
|
const R = p(I), z = Q.get(R) ?? 0, _t = j.get(R) ?? 0;
|
|
4711
4723
|
if (j.set(R, _t + 1), z > 8 && _t >= 6 && !u.has(I)) {
|
|
@@ -4713,36 +4725,36 @@ function ji(s, e) {
|
|
|
4713
4725
|
continue;
|
|
4714
4726
|
}
|
|
4715
4727
|
const Pt = S(I, N);
|
|
4716
|
-
|
|
4728
|
+
Et.push(Pt), q.push(Pt.lines);
|
|
4717
4729
|
}
|
|
4718
|
-
const
|
|
4730
|
+
const Fe = [];
|
|
4719
4731
|
if (T.shadowRoot)
|
|
4720
4732
|
for (const I of Array.from(T.shadowRoot.children))
|
|
4721
|
-
I instanceof HTMLElement &&
|
|
4722
|
-
const ye = [...
|
|
4733
|
+
I instanceof HTMLElement && Fe.push(S(I, N + 1));
|
|
4734
|
+
const ye = [...Et, ...Fe], We = ee.length > 0 || fe || ye.some((I) => I.hasUsefulContent), kt = ne(
|
|
4723
4735
|
[ee, ...ye.map((I) => I.textPreview)].filter(Boolean).join(" ")
|
|
4724
|
-
).slice(0, 180),
|
|
4725
|
-
if (
|
|
4726
|
-
const I = ye.some((z) => z.containsTextElement), R = n.has(v) && !I ?
|
|
4727
|
-
ae.push(
|
|
4736
|
+
).slice(0, 180), zs = T.hasAttribute("contenteditable") && (ee.length > 0 || !T.querySelector("[contenteditable]")), Ct = c.some((I) => T.hasAttribute(I)) || !!Z || zs, $e = (T.getClientRects().length > 0 || re.display === "contents") && (t.has(v) || Ct || Y) && (We || Y) && (!i.has(v) || We || Ct || Y), je = $e ? 1 : 0, ae = [];
|
|
4737
|
+
if ($e) {
|
|
4738
|
+
const I = ye.some((z) => z.containsTextElement), R = n.has(v) && !I ? kt : ee;
|
|
4739
|
+
ae.push(Rs(T, l, o, R.slice(0, 180)));
|
|
4728
4740
|
}
|
|
4729
4741
|
for (const I of q)
|
|
4730
|
-
ae.push(...
|
|
4731
|
-
const
|
|
4732
|
-
if (
|
|
4733
|
-
const I =
|
|
4734
|
-
|
|
4742
|
+
ae.push(...Ae(I, je));
|
|
4743
|
+
const ze = Fe.flatMap((I) => I.lines);
|
|
4744
|
+
if (ze.length > 0) {
|
|
4745
|
+
const I = ze.slice(0, 20);
|
|
4746
|
+
ze.length > I.length && I.push("… shadow DOM omitted");
|
|
4735
4747
|
const R = v.includes("tooltip") || v.includes("popper") || v.includes("loader");
|
|
4736
4748
|
if (N < 2 && !R) {
|
|
4737
|
-
const z =
|
|
4738
|
-
ae.push(...
|
|
4749
|
+
const z = $e ? "#shadow-root" : `${v} #shadow-root`;
|
|
4750
|
+
ae.push(...Ae([z, ...Ae(I, 1)], je));
|
|
4739
4751
|
} else
|
|
4740
|
-
ae.push(...
|
|
4752
|
+
ae.push(...Ae(I, je));
|
|
4741
4753
|
}
|
|
4742
4754
|
return {
|
|
4743
4755
|
lines: ae,
|
|
4744
4756
|
hasUsefulContent: We,
|
|
4745
|
-
textPreview:
|
|
4757
|
+
textPreview: kt,
|
|
4746
4758
|
containsTextElement: n.has(v) || ye.some((I) => I.containsTextElement)
|
|
4747
4759
|
};
|
|
4748
4760
|
};
|
|
@@ -4750,7 +4762,7 @@ function ji(s, e) {
|
|
|
4750
4762
|
`);
|
|
4751
4763
|
}, m = [], M = ne(window.getSelection()?.toString() ?? "");
|
|
4752
4764
|
M && m.push(`--- selected text ---
|
|
4753
|
-
${JSON.stringify(M)}`), d.length > 0 && m.push(
|
|
4765
|
+
${JSON.stringify(M)}`), d.length > 0 && m.push(Vi(d, t, l, o));
|
|
4754
4766
|
for (const w of s.slice(0, 3))
|
|
4755
4767
|
m.push(y(w, "active overlay DOM", /* @__PURE__ */ new Set()));
|
|
4756
4768
|
if (e && m.push(y(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
|
|
@@ -4761,11 +4773,11 @@ ${JSON.stringify(M)}`), d.length > 0 && m.push(Ki(d, t, l, o));
|
|
|
4761
4773
|
|
|
4762
4774
|
`);
|
|
4763
4775
|
}
|
|
4764
|
-
function
|
|
4776
|
+
function Rs(s, e, t, n) {
|
|
4765
4777
|
const i = s.tagName.toLowerCase();
|
|
4766
4778
|
let r = i;
|
|
4767
4779
|
const o = s.getAttribute("id");
|
|
4768
|
-
o &&
|
|
4780
|
+
o && Xi(o) && (r += `#${o}`);
|
|
4769
4781
|
for (const a of e) {
|
|
4770
4782
|
const l = s.getAttribute(a);
|
|
4771
4783
|
l && l.length <= 160 && (a !== "role" || !t.has(l)) && (r += `[${a}=${JSON.stringify(l)}]`);
|
|
@@ -4778,7 +4790,7 @@ function bs(s, e, t, n) {
|
|
|
4778
4790
|
s.hasAttribute(a) && (r += `[${a}]`);
|
|
4779
4791
|
return `${r}${n ? ` ${JSON.stringify(n)}` : ""}`;
|
|
4780
4792
|
}
|
|
4781
|
-
function
|
|
4793
|
+
function Qi() {
|
|
4782
4794
|
const s = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), t = (a, l) => {
|
|
4783
4795
|
if (!a)
|
|
4784
4796
|
return;
|
|
@@ -4821,7 +4833,7 @@ function zi() {
|
|
|
4821
4833
|
priorityTargets: Array.from(e, ([a, l]) => ({ element: a, labels: Array.from(l) }))
|
|
4822
4834
|
};
|
|
4823
4835
|
}
|
|
4824
|
-
function
|
|
4836
|
+
function Vi(s, e, t, n) {
|
|
4825
4837
|
const i = ["--- active/current elements ---"];
|
|
4826
4838
|
for (const r of s) {
|
|
4827
4839
|
const o = [];
|
|
@@ -4832,11 +4844,11 @@ function Ki(s, e, t, n) {
|
|
|
4832
4844
|
const d = a.getRootNode();
|
|
4833
4845
|
a = a.parentElement ?? (d instanceof ShadowRoot && d.host instanceof HTMLElement ? d.host : null);
|
|
4834
4846
|
}
|
|
4835
|
-
const l = o.length > 6 ? [o[0], ...o.slice(-5)] : o, c = l.map((u, d) =>
|
|
4847
|
+
const l = o.length > 6 ? [o[0], ...o.slice(-5)] : o, c = l.map((u, d) => Rs(
|
|
4836
4848
|
u,
|
|
4837
4849
|
t,
|
|
4838
4850
|
n,
|
|
4839
|
-
d === l.length - 1 ?
|
|
4851
|
+
d === l.length - 1 ? Es(u).slice(0, 180) : ""
|
|
4840
4852
|
));
|
|
4841
4853
|
o.length > l.length && c.splice(1, 0, "…"), i.push(`${r.labels.join(", ")}: ${c.join(" > ")}`);
|
|
4842
4854
|
}
|
|
@@ -4846,23 +4858,23 @@ function Ki(s, e, t, n) {
|
|
|
4846
4858
|
function Qt(s) {
|
|
4847
4859
|
return s instanceof HTMLElement ? s : s?.parentElement instanceof HTMLElement ? s.parentElement : null;
|
|
4848
4860
|
}
|
|
4849
|
-
function
|
|
4861
|
+
function Ae(s, e) {
|
|
4850
4862
|
if (e === 0)
|
|
4851
4863
|
return s;
|
|
4852
4864
|
const t = " ".repeat(e);
|
|
4853
4865
|
return s.map((n) => `${t}${n}`);
|
|
4854
4866
|
}
|
|
4855
|
-
function
|
|
4867
|
+
function Es(s) {
|
|
4856
4868
|
return ne(
|
|
4857
4869
|
Array.from(s.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
|
|
4858
4870
|
);
|
|
4859
4871
|
}
|
|
4860
|
-
function
|
|
4872
|
+
function Xi(s) {
|
|
4861
4873
|
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);
|
|
4862
4874
|
}
|
|
4863
4875
|
function ks() {
|
|
4864
4876
|
const s = Array.from(document.querySelectorAll(Ht)), e = s.find(
|
|
4865
|
-
(r) => typeof r[
|
|
4877
|
+
(r) => typeof r[Nn] == "string"
|
|
4866
4878
|
);
|
|
4867
4879
|
if (!(e ?? s[0]))
|
|
4868
4880
|
return;
|
|
@@ -4878,23 +4890,23 @@ function ks() {
|
|
|
4878
4890
|
},
|
|
4879
4891
|
{
|
|
4880
4892
|
name: "widget_root",
|
|
4881
|
-
selector:
|
|
4893
|
+
selector: On,
|
|
4882
4894
|
description: "Finds Pluno's widget root inside the widget host shadow root."
|
|
4883
4895
|
},
|
|
4884
4896
|
{
|
|
4885
4897
|
name: "widget_panel",
|
|
4886
|
-
selector:
|
|
4898
|
+
selector: xn,
|
|
4887
4899
|
description: "Finds Pluno's open chat panel inside the widget host shadow root."
|
|
4888
4900
|
},
|
|
4889
4901
|
{
|
|
4890
4902
|
name: "widget_timeline",
|
|
4891
|
-
selector:
|
|
4903
|
+
selector: Ln,
|
|
4892
4904
|
description: "Finds Pluno's chat timeline inside the widget host shadow root."
|
|
4893
4905
|
}
|
|
4894
4906
|
]
|
|
4895
4907
|
};
|
|
4896
4908
|
}
|
|
4897
|
-
function
|
|
4909
|
+
function Ji(s) {
|
|
4898
4910
|
try {
|
|
4899
4911
|
const e = JSON.parse(s);
|
|
4900
4912
|
return e && typeof e == "object" ? e : { type: "error", message: "Invalid server event" };
|
|
@@ -4902,7 +4914,7 @@ function Qi(s) {
|
|
|
4902
4914
|
return { type: "error", message: "Invalid server event" };
|
|
4903
4915
|
}
|
|
4904
4916
|
}
|
|
4905
|
-
function
|
|
4917
|
+
function Yi(s) {
|
|
4906
4918
|
if (typeof s != "string")
|
|
4907
4919
|
return null;
|
|
4908
4920
|
try {
|
|
@@ -4926,10 +4938,10 @@ function Xt(s) {
|
|
|
4926
4938
|
return typeof t.taskId != "string" || !t.taskId || typeof t.dueAt != "string" || Number.isNaN(Date.parse(t.dueAt)) ? [] : [{ taskId: t.taskId, dueAt: t.dueAt }];
|
|
4927
4939
|
}) : [];
|
|
4928
4940
|
}
|
|
4929
|
-
function
|
|
4941
|
+
function Zi(s) {
|
|
4930
4942
|
return Array.isArray(s) ? s.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
|
|
4931
4943
|
}
|
|
4932
|
-
function
|
|
4944
|
+
function er(s) {
|
|
4933
4945
|
if (!s || typeof s != "object")
|
|
4934
4946
|
return null;
|
|
4935
4947
|
const e = s, t = e.appearance, n = t && typeof t == "object" ? t : e, i = typeof n.accentColor == "string" ? n.accentColor : null, r = n.colorScheme === "dark" ? "dark" : n.colorScheme === "light" ? "light" : null, o = typeof n.fontFamily == "string" && n.fontFamily.trim() ? n.fontFamily : null, a = typeof n.scribbleStyle == "boolean" ? n.scribbleStyle : null;
|
|
@@ -4940,13 +4952,13 @@ function Ji(s) {
|
|
|
4940
4952
|
...a !== null ? { scribbleStyle: a } : {}
|
|
4941
4953
|
};
|
|
4942
4954
|
}
|
|
4943
|
-
function
|
|
4955
|
+
function tr(s) {
|
|
4944
4956
|
if (!s || typeof s != "object")
|
|
4945
4957
|
return null;
|
|
4946
4958
|
const e = s.javascript;
|
|
4947
4959
|
return typeof e != "string" || !e.trim() ? null : { javascript: e };
|
|
4948
4960
|
}
|
|
4949
|
-
function
|
|
4961
|
+
function sr(s, e) {
|
|
4950
4962
|
return e ? s && typeof s == "object" ? {
|
|
4951
4963
|
...s,
|
|
4952
4964
|
helperError: e
|
|
@@ -4956,13 +4968,13 @@ function Zi(s, e) {
|
|
|
4956
4968
|
helperError: e
|
|
4957
4969
|
} : s;
|
|
4958
4970
|
}
|
|
4959
|
-
function
|
|
4971
|
+
function nr(s) {
|
|
4960
4972
|
if (!s || typeof s != "object")
|
|
4961
4973
|
return s;
|
|
4962
4974
|
const e = s;
|
|
4963
4975
|
return typeof e.exception?.message == "string" ? e.exception.message : typeof e.error == "string" ? e.error : s;
|
|
4964
4976
|
}
|
|
4965
|
-
function
|
|
4977
|
+
function ir() {
|
|
4966
4978
|
const s = "pluno.productAgent.clientId", e = window.localStorage.getItem(s);
|
|
4967
4979
|
if (e)
|
|
4968
4980
|
return e;
|
|
@@ -4972,7 +4984,7 @@ function tr() {
|
|
|
4972
4984
|
function x() {
|
|
4973
4985
|
return crypto.randomUUID();
|
|
4974
4986
|
}
|
|
4975
|
-
function
|
|
4987
|
+
function rr(s) {
|
|
4976
4988
|
if (!s || typeof s != "object")
|
|
4977
4989
|
return null;
|
|
4978
4990
|
const e = s, t = typeof e.id == "string" ? e.id : null;
|
|
@@ -4985,10 +4997,10 @@ function sr(s) {
|
|
|
4985
4997
|
}
|
|
4986
4998
|
function st(s, e) {
|
|
4987
4999
|
return Array.isArray(s) ? ht(
|
|
4988
|
-
s.map((t) =>
|
|
5000
|
+
s.map((t) => Ue(t, e)).filter((t) => t !== null)
|
|
4989
5001
|
) : [];
|
|
4990
5002
|
}
|
|
4991
|
-
function
|
|
5003
|
+
function or(s) {
|
|
4992
5004
|
return Array.isArray(s) ? s.flatMap((e) => {
|
|
4993
5005
|
if (!e || typeof e != "object")
|
|
4994
5006
|
return [];
|
|
@@ -5009,14 +5021,14 @@ function nr(s) {
|
|
|
5009
5021
|
];
|
|
5010
5022
|
}) : [];
|
|
5011
5023
|
}
|
|
5012
|
-
function
|
|
5024
|
+
function Ue(s, e) {
|
|
5013
5025
|
if (!s || typeof s != "object")
|
|
5014
5026
|
return null;
|
|
5015
5027
|
const t = s, n = t.data;
|
|
5016
5028
|
if (!n || typeof n != "object")
|
|
5017
5029
|
return null;
|
|
5018
5030
|
const i = n;
|
|
5019
|
-
if (i.hiddenFromTranscript === !0 ||
|
|
5031
|
+
if (i.hiddenFromTranscript === !0 || an(i) || i.type === "tab_lifecycle_decision" && i.decision === "keep")
|
|
5020
5032
|
return null;
|
|
5021
5033
|
if (i.type === "assistant_draft")
|
|
5022
5034
|
return {
|
|
@@ -5028,10 +5040,10 @@ function ve(s, e) {
|
|
|
5028
5040
|
e
|
|
5029
5041
|
),
|
|
5030
5042
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5031
|
-
...
|
|
5043
|
+
...k(i) !== null ? { displaySequence: k(i) } : {},
|
|
5032
5044
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
5033
5045
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5034
|
-
...
|
|
5046
|
+
...E(i) ? { runId: E(i) } : {},
|
|
5035
5047
|
dataType: "assistant_draft",
|
|
5036
5048
|
...i.steered === !0 ? { steered: !0 } : {}
|
|
5037
5049
|
};
|
|
@@ -5045,11 +5057,11 @@ function ve(s, e) {
|
|
|
5045
5057
|
e
|
|
5046
5058
|
),
|
|
5047
5059
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5048
|
-
...
|
|
5060
|
+
...k(i) !== null ? { displaySequence: k(i) } : {},
|
|
5049
5061
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
5050
5062
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5051
|
-
...
|
|
5052
|
-
attachments:
|
|
5063
|
+
...E(i) ? { runId: E(i) } : {},
|
|
5064
|
+
attachments: qs(i.attachments, e),
|
|
5053
5065
|
...i.steered === !0 ? { steered: !0 } : {}
|
|
5054
5066
|
};
|
|
5055
5067
|
return r === "assistant" && typeof i.id == "string" && Object.defineProperty(o, "assistantDraftItemId", {
|
|
@@ -5064,47 +5076,47 @@ function ve(s, e) {
|
|
|
5064
5076
|
}), o;
|
|
5065
5077
|
}
|
|
5066
5078
|
if (i.type === "function_call_output") {
|
|
5067
|
-
const r =
|
|
5079
|
+
const r = sn(i.output);
|
|
5068
5080
|
if (r !== null)
|
|
5069
5081
|
return {
|
|
5070
5082
|
id: String(t.id ?? crypto.randomUUID()),
|
|
5071
5083
|
role: "tool",
|
|
5072
5084
|
content: "",
|
|
5073
5085
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5074
|
-
...
|
|
5086
|
+
...k(i) !== null ? { displaySequence: k(i) } : {},
|
|
5075
5087
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5076
|
-
...
|
|
5088
|
+
...E(i) ? { runId: E(i) } : {},
|
|
5077
5089
|
dataType: "function_call_output",
|
|
5078
5090
|
toolName: St,
|
|
5079
5091
|
callId: ue(i) ?? void 0,
|
|
5080
5092
|
sharePromptAllowed: r
|
|
5081
5093
|
};
|
|
5082
|
-
const o =
|
|
5094
|
+
const o = In(i.output);
|
|
5083
5095
|
if (o)
|
|
5084
5096
|
return {
|
|
5085
5097
|
id: String(t.id ?? crypto.randomUUID()),
|
|
5086
5098
|
role: "tool",
|
|
5087
5099
|
content: "",
|
|
5088
5100
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5089
|
-
...
|
|
5101
|
+
...k(i) !== null ? { displaySequence: k(i) } : {},
|
|
5090
5102
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5091
|
-
...
|
|
5103
|
+
...E(i) ? { runId: E(i) } : {},
|
|
5092
5104
|
dataType: "scheduled_check_in",
|
|
5093
|
-
toolName:
|
|
5105
|
+
toolName: fs,
|
|
5094
5106
|
callId: ue(i) ?? void 0,
|
|
5095
5107
|
scheduledCheckInId: o.id ?? void 0,
|
|
5096
5108
|
scheduledCheckInAt: o.dueAt
|
|
5097
5109
|
};
|
|
5098
|
-
const a =
|
|
5110
|
+
const a = lr(i.output), l = cr(i.output);
|
|
5099
5111
|
return a ? {
|
|
5100
5112
|
id: String(t.id ?? crypto.randomUUID()),
|
|
5101
5113
|
role: "tool",
|
|
5102
5114
|
content: `Connect ${a.appName} to continue`,
|
|
5103
5115
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5104
|
-
...
|
|
5116
|
+
...k(i) !== null ? { displaySequence: k(i) } : {},
|
|
5105
5117
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
5106
5118
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5107
|
-
...
|
|
5119
|
+
...E(i) ? { runId: E(i) } : {},
|
|
5108
5120
|
dataType: "function_call_output",
|
|
5109
5121
|
toolName: "authenticate_pipedream_app",
|
|
5110
5122
|
callId: ue(i) ?? void 0,
|
|
@@ -5114,10 +5126,10 @@ function ve(s, e) {
|
|
|
5114
5126
|
role: "tool",
|
|
5115
5127
|
content: "Connect WhatsApp to continue",
|
|
5116
5128
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5117
|
-
...
|
|
5129
|
+
...k(i) !== null ? { displaySequence: k(i) } : {},
|
|
5118
5130
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
5119
5131
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5120
|
-
...
|
|
5132
|
+
...E(i) ? { runId: E(i) } : {},
|
|
5121
5133
|
dataType: "function_call_output",
|
|
5122
5134
|
toolName: "request_personal_channel_connection",
|
|
5123
5135
|
callId: ue(i) ?? void 0,
|
|
@@ -5127,12 +5139,12 @@ function ve(s, e) {
|
|
|
5127
5139
|
return i.type === "function_call" || i.type === "tool_call" || i.type === "web_search_call" || i.type === "mcp_call" || i.type === "tab_lifecycle_decision" ? {
|
|
5128
5140
|
id: String(t.id ?? crypto.randomUUID()),
|
|
5129
5141
|
role: "tool",
|
|
5130
|
-
content: i.type === "mcp_call" ?
|
|
5142
|
+
content: i.type === "mcp_call" ? ar(i) : dr(i),
|
|
5131
5143
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5132
|
-
...
|
|
5144
|
+
...k(i) !== null ? { displaySequence: k(i) } : {},
|
|
5133
5145
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
5134
5146
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5135
|
-
...
|
|
5147
|
+
...E(i) ? { runId: E(i) } : {},
|
|
5136
5148
|
dataType: String(i.type),
|
|
5137
5149
|
toolName: i.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof i.name == "string" ? i.name : void 0,
|
|
5138
5150
|
callId: ue(i) ?? void 0,
|
|
@@ -5141,12 +5153,12 @@ function ve(s, e) {
|
|
|
5141
5153
|
} : i.type === "run_status" || i.type === "run_error" ? i.type === "run_error" && i.stage === "tool_execution" ? null : {
|
|
5142
5154
|
id: String(t.id ?? crypto.randomUUID()),
|
|
5143
5155
|
role: "system",
|
|
5144
|
-
content:
|
|
5156
|
+
content: ur(i),
|
|
5145
5157
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5146
|
-
...
|
|
5158
|
+
...k(i) !== null ? { displaySequence: k(i) } : {},
|
|
5147
5159
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
5148
5160
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5149
|
-
...
|
|
5161
|
+
...E(i) ? { runId: E(i) } : {},
|
|
5150
5162
|
dataType: String(i.type),
|
|
5151
5163
|
loading: i.steered !== !0 && i.type === "run_status" && (i.status === "running" || i.status === "retrying"),
|
|
5152
5164
|
...i.steered === !0 || i.type === "run_status" && i.status === "steered" ? { steered: !0 } : {},
|
|
@@ -5154,11 +5166,11 @@ function ve(s, e) {
|
|
|
5154
5166
|
...typeof i.securitySettingsUrl == "string" ? { securitySettingsUrl: i.securitySettingsUrl } : {}
|
|
5155
5167
|
} : null;
|
|
5156
5168
|
}
|
|
5157
|
-
function
|
|
5169
|
+
function ar(s) {
|
|
5158
5170
|
const t = (typeof s.server_label == "string" ? s.server_label : "").replace(/^pipedream_/, "").split(/[_-]+/).filter(Boolean).map((n) => `${n.charAt(0).toUpperCase()}${n.slice(1)}`).join(" ");
|
|
5159
5171
|
return t ? `🔌 Using ${t}` : "🔌 Using connected integration";
|
|
5160
5172
|
}
|
|
5161
|
-
function
|
|
5173
|
+
function lr(s) {
|
|
5162
5174
|
if (typeof s != "string")
|
|
5163
5175
|
return null;
|
|
5164
5176
|
try {
|
|
@@ -5175,7 +5187,7 @@ function rr(s) {
|
|
|
5175
5187
|
return null;
|
|
5176
5188
|
}
|
|
5177
5189
|
}
|
|
5178
|
-
function
|
|
5190
|
+
function cr(s) {
|
|
5179
5191
|
if (typeof s != "string")
|
|
5180
5192
|
return null;
|
|
5181
5193
|
try {
|
|
@@ -5190,10 +5202,10 @@ function or(s) {
|
|
|
5190
5202
|
return null;
|
|
5191
5203
|
}
|
|
5192
5204
|
}
|
|
5193
|
-
function
|
|
5205
|
+
function ur(s) {
|
|
5194
5206
|
return s.type === "run_status" && s.status === "steered" ? "Steered" : typeof s.message == "string" && s.message.trim().length > 0 ? s.message : "";
|
|
5195
5207
|
}
|
|
5196
|
-
function
|
|
5208
|
+
function dr(s) {
|
|
5197
5209
|
if (s.type === "web_search_call") {
|
|
5198
5210
|
const e = s.action;
|
|
5199
5211
|
if (e && typeof e == "object") {
|
|
@@ -5205,9 +5217,9 @@ function lr(s) {
|
|
|
5205
5217
|
}
|
|
5206
5218
|
return "🔎 Searching the web";
|
|
5207
5219
|
}
|
|
5208
|
-
return
|
|
5220
|
+
return hr(s);
|
|
5209
5221
|
}
|
|
5210
|
-
function
|
|
5222
|
+
function hr(s) {
|
|
5211
5223
|
if (typeof s.summary == "string" && s.summary.trim().length > 0)
|
|
5212
5224
|
return se(s.summary);
|
|
5213
5225
|
if (typeof s.arguments == "string")
|
|
@@ -5224,7 +5236,7 @@ function se(s) {
|
|
|
5224
5236
|
const e = s.trim() || "Run tool", t = e.codePointAt(0) ?? 0;
|
|
5225
5237
|
return t >= 126976 && t <= 129791 || t >= 9728 && t <= 10175 || t >= 127462 && t <= 127487 ? e : `🛠️ ${e}`;
|
|
5226
5238
|
}
|
|
5227
|
-
function
|
|
5239
|
+
function pr(s) {
|
|
5228
5240
|
if (s == null)
|
|
5229
5241
|
return s;
|
|
5230
5242
|
if (typeof s != "object")
|
|
@@ -5246,7 +5258,7 @@ function ue(s) {
|
|
|
5246
5258
|
function P(s) {
|
|
5247
5259
|
return typeof s.causalSequence == "number" && Number.isSafeInteger(s.causalSequence) ? s.causalSequence : null;
|
|
5248
5260
|
}
|
|
5249
|
-
function
|
|
5261
|
+
function k(s) {
|
|
5250
5262
|
return typeof s.displaySequence == "number" && Number.isSafeInteger(s.displaySequence) ? s.displaySequence : null;
|
|
5251
5263
|
}
|
|
5252
5264
|
function Jt(s) {
|
|
@@ -5258,13 +5270,13 @@ function Jt(s) {
|
|
|
5258
5270
|
}).filter(Boolean).join("") : "";
|
|
5259
5271
|
}
|
|
5260
5272
|
function de(s, e) {
|
|
5261
|
-
const t =
|
|
5273
|
+
const t = Cs(
|
|
5262
5274
|
s,
|
|
5263
5275
|
Mt(s, e)
|
|
5264
|
-
), n =
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5276
|
+
), n = mr(
|
|
5277
|
+
fr(
|
|
5278
|
+
Tr(
|
|
5279
|
+
gr(s, e),
|
|
5268
5280
|
e
|
|
5269
5281
|
),
|
|
5270
5282
|
t
|
|
@@ -5289,7 +5301,7 @@ function Mt(s, e, t = !0) {
|
|
|
5289
5301
|
const i = 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] : []);
|
|
5290
5302
|
return e.displaySequence = (i.length > 0 ? Math.max(...i) : 0) + 1, e;
|
|
5291
5303
|
}
|
|
5292
|
-
function
|
|
5304
|
+
function gr(s, e) {
|
|
5293
5305
|
const t = e.proactiveSuggestionClientMessageId;
|
|
5294
5306
|
if (!t)
|
|
5295
5307
|
return s;
|
|
@@ -5299,13 +5311,13 @@ function dr(s, e) {
|
|
|
5299
5311
|
const r = [...s];
|
|
5300
5312
|
return r[i] = e, r;
|
|
5301
5313
|
}
|
|
5302
|
-
function
|
|
5314
|
+
function fr(s, e) {
|
|
5303
5315
|
const t = e.assistantDraftItemId;
|
|
5304
5316
|
return t ? s.map(
|
|
5305
5317
|
(n) => n.dataType === "assistant_draft" && n.id === t ? e : n
|
|
5306
5318
|
) : s;
|
|
5307
5319
|
}
|
|
5308
|
-
function
|
|
5320
|
+
function Me(s, e, t) {
|
|
5309
5321
|
return e !== null ? s.respondsToUserMessageId === e : t !== null && s.runId === t;
|
|
5310
5322
|
}
|
|
5311
5323
|
function Yt(s, e, t, n) {
|
|
@@ -5367,7 +5379,7 @@ function ts(s) {
|
|
|
5367
5379
|
loading: !0
|
|
5368
5380
|
};
|
|
5369
5381
|
}
|
|
5370
|
-
function
|
|
5382
|
+
function mr(s, e) {
|
|
5371
5383
|
if (e.id.startsWith("transient-activity:"))
|
|
5372
5384
|
return s;
|
|
5373
5385
|
const t = e.toolName === "tab_lifecycle";
|
|
@@ -5381,19 +5393,19 @@ function lt(s, e) {
|
|
|
5381
5393
|
for (const n of e) {
|
|
5382
5394
|
const i = [...s, ...t];
|
|
5383
5395
|
t.push(
|
|
5384
|
-
|
|
5396
|
+
Cs(
|
|
5385
5397
|
i,
|
|
5386
5398
|
Mt(i, n, !1)
|
|
5387
5399
|
)
|
|
5388
5400
|
);
|
|
5389
5401
|
}
|
|
5390
|
-
return
|
|
5402
|
+
return ln(
|
|
5391
5403
|
s,
|
|
5392
5404
|
t,
|
|
5393
5405
|
ct
|
|
5394
5406
|
);
|
|
5395
5407
|
}
|
|
5396
|
-
function
|
|
5408
|
+
function yr(s, e) {
|
|
5397
5409
|
const t = new Map(s.map((r) => [r.id, r])), n = e.map(
|
|
5398
5410
|
(r) => Mt(s, r, !1)
|
|
5399
5411
|
);
|
|
@@ -5428,52 +5440,52 @@ function ct(s) {
|
|
|
5428
5440
|
...i.length > 0 ? { activityKeys: i } : {},
|
|
5429
5441
|
...s.respondsToUserMessageId ? { respondsToUserMessageId: s.respondsToUserMessageId } : {},
|
|
5430
5442
|
...s.runId ? { runId: s.runId } : {},
|
|
5431
|
-
isOptimistic:
|
|
5443
|
+
isOptimistic: He(s),
|
|
5432
5444
|
isAssistantDraft: s.dataType === "assistant_draft",
|
|
5433
5445
|
isActivity: s.role === "tool" || s.phase === "commentary" || s.dataType === "assistant_draft",
|
|
5434
5446
|
isTransient: s.id.startsWith("transient-activity:") || s.dataType === "assistant_draft"
|
|
5435
5447
|
};
|
|
5436
5448
|
}
|
|
5437
|
-
function
|
|
5449
|
+
function Cs(s, e) {
|
|
5438
5450
|
if (e.role !== "user" || !e.attachments?.length)
|
|
5439
5451
|
return e;
|
|
5440
5452
|
const t = s.find(
|
|
5441
|
-
(o) => o.role === "user" && (o.id === e.id ||
|
|
5453
|
+
(o) => o.role === "user" && (o.id === e.id || He(o) && _s(o, e))
|
|
5442
5454
|
);
|
|
5443
5455
|
if (!t?.attachments?.length)
|
|
5444
5456
|
return e;
|
|
5445
5457
|
const n = e.attachments.map((o) => {
|
|
5446
|
-
const a =
|
|
5447
|
-
return a ?
|
|
5458
|
+
const a = Ir(t.attachments ?? [], o);
|
|
5459
|
+
return a ? Sr(o, a) : o;
|
|
5448
5460
|
}), i = { ...e, attachments: n }, r = J(e);
|
|
5449
5461
|
return r && Object.defineProperty(i, "clientMessageId", {
|
|
5450
5462
|
value: r,
|
|
5451
5463
|
enumerable: !1
|
|
5452
5464
|
}), i;
|
|
5453
5465
|
}
|
|
5454
|
-
function
|
|
5466
|
+
function Ir(s, e) {
|
|
5455
5467
|
return e.id ? s.find((t) => t.id === e.id) ?? null : null;
|
|
5456
5468
|
}
|
|
5457
|
-
function
|
|
5469
|
+
function Sr(s, e) {
|
|
5458
5470
|
const { previewUrl: t } = e;
|
|
5459
5471
|
return t ? { ...s, previewUrl: t } : s;
|
|
5460
5472
|
}
|
|
5461
|
-
function
|
|
5473
|
+
function Tr(s, e) {
|
|
5462
5474
|
if (e.role !== "user")
|
|
5463
5475
|
return s;
|
|
5464
5476
|
const t = s.findIndex(
|
|
5465
|
-
(i) =>
|
|
5477
|
+
(i) => He(i) && _s(i, e)
|
|
5466
5478
|
);
|
|
5467
5479
|
if (t === -1)
|
|
5468
5480
|
return s;
|
|
5469
5481
|
const n = [...s];
|
|
5470
5482
|
return n.splice(t, 1), n;
|
|
5471
5483
|
}
|
|
5472
|
-
function
|
|
5484
|
+
function _s(s, e) {
|
|
5473
5485
|
const t = J(s), n = J(e);
|
|
5474
5486
|
return t && n ? t === n : s.content === e.content;
|
|
5475
5487
|
}
|
|
5476
|
-
function
|
|
5488
|
+
function He(s) {
|
|
5477
5489
|
return s.role === "user" && (s.id.startsWith("local-") || s.id.startsWith("optimistic-user-message:"));
|
|
5478
5490
|
}
|
|
5479
5491
|
function J(s) {
|
|
@@ -5486,18 +5498,18 @@ function J(s) {
|
|
|
5486
5498
|
return n ? s.id.slice(n.length) : null;
|
|
5487
5499
|
}
|
|
5488
5500
|
function ss(s) {
|
|
5489
|
-
const e =
|
|
5501
|
+
const e = Ps(s);
|
|
5490
5502
|
if (e === null)
|
|
5491
5503
|
return !1;
|
|
5492
5504
|
const t = s[e].id;
|
|
5493
5505
|
if (s.some(
|
|
5494
|
-
(i) => i.respondsToUserMessageId === t &&
|
|
5506
|
+
(i) => i.respondsToUserMessageId === t && De(i)
|
|
5495
5507
|
))
|
|
5496
5508
|
return !0;
|
|
5497
5509
|
for (let i = s.length - 1; i > e; i -= 1) {
|
|
5498
5510
|
const r = s[i];
|
|
5499
5511
|
if (!r.respondsToUserMessageId) {
|
|
5500
|
-
if (
|
|
5512
|
+
if (W(r))
|
|
5501
5513
|
return !0;
|
|
5502
5514
|
if (r.role === "system") {
|
|
5503
5515
|
if (r.dataType === "run_error")
|
|
@@ -5509,7 +5521,7 @@ function ss(s) {
|
|
|
5509
5521
|
}
|
|
5510
5522
|
return !1;
|
|
5511
5523
|
}
|
|
5512
|
-
function
|
|
5524
|
+
function wr(s, e, t) {
|
|
5513
5525
|
const n = new Set(
|
|
5514
5526
|
s.filter(
|
|
5515
5527
|
(i) => i.role === "user" && e !== null && J(i) === e
|
|
@@ -5523,29 +5535,29 @@ function Ir(s, e, t) {
|
|
|
5523
5535
|
if (t && i.runId === t) {
|
|
5524
5536
|
if (n.size === 0)
|
|
5525
5537
|
return !0;
|
|
5526
|
-
const o =
|
|
5538
|
+
const o = vs(s, r);
|
|
5527
5539
|
return !i.respondsToUserMessageId && o !== null && n.has(o);
|
|
5528
5540
|
}
|
|
5529
5541
|
return !1;
|
|
5530
5542
|
});
|
|
5531
5543
|
}
|
|
5532
|
-
function
|
|
5533
|
-
const e =
|
|
5544
|
+
function Ar(s) {
|
|
5545
|
+
const e = Ps(s);
|
|
5534
5546
|
if (e === null)
|
|
5535
|
-
return s.some(
|
|
5547
|
+
return s.some(W);
|
|
5536
5548
|
const t = s[e].id;
|
|
5537
5549
|
return s.some((n) => n.respondsToUserMessageId === t) ? s.some(
|
|
5538
|
-
(n) => n.respondsToUserMessageId === t &&
|
|
5539
|
-
) : s.slice(e + 1).some(
|
|
5550
|
+
(n) => n.respondsToUserMessageId === t && W(n)
|
|
5551
|
+
) : s.slice(e + 1).some(W);
|
|
5540
5552
|
}
|
|
5541
|
-
function
|
|
5553
|
+
function Ps(s) {
|
|
5542
5554
|
for (let e = s.length - 1; e >= 0; e -= 1)
|
|
5543
|
-
if (s[e].role === "user" && !
|
|
5555
|
+
if (s[e].role === "user" && !He(s[e]))
|
|
5544
5556
|
return e;
|
|
5545
5557
|
return null;
|
|
5546
5558
|
}
|
|
5547
|
-
function
|
|
5548
|
-
return
|
|
5559
|
+
function De(s) {
|
|
5560
|
+
return W(s) ? !0 : s.role !== "system" ? !1 : s.dataType === "run_error" ? !0 : s.dataType === "run_status" && s.loading !== !0;
|
|
5549
5561
|
}
|
|
5550
5562
|
function ie(s) {
|
|
5551
5563
|
for (let e = s.length - 1; e >= 0; e -= 1) {
|
|
@@ -5561,7 +5573,7 @@ function ie(s) {
|
|
|
5561
5573
|
}
|
|
5562
5574
|
return null;
|
|
5563
5575
|
}
|
|
5564
|
-
function
|
|
5576
|
+
function Mr(s) {
|
|
5565
5577
|
const e = ie(s);
|
|
5566
5578
|
if (e === null)
|
|
5567
5579
|
return null;
|
|
@@ -5580,10 +5592,10 @@ function C(s) {
|
|
|
5580
5592
|
function pe(s) {
|
|
5581
5593
|
return s?.retryable !== !0 ? !1 : s.type === "run_error" ? !0 : s.type === "run_status" && s.status === "interrupted";
|
|
5582
5594
|
}
|
|
5583
|
-
function
|
|
5595
|
+
function br(s) {
|
|
5584
5596
|
return s?.type === "run_status" && s.status === "interrupted" && s.reason === "backend_restart";
|
|
5585
5597
|
}
|
|
5586
|
-
function
|
|
5598
|
+
function Rr(s, e) {
|
|
5587
5599
|
const t = ie(e);
|
|
5588
5600
|
if (t === null)
|
|
5589
5601
|
return !1;
|
|
@@ -5592,8 +5604,8 @@ function Ar(s, e) {
|
|
|
5592
5604
|
return !1;
|
|
5593
5605
|
const r = s.findIndex((o) => o.role === "user" && o.id === i);
|
|
5594
5606
|
return r === -1 ? !1 : s.some((o) => o.respondsToUserMessageId === i) ? s.some(
|
|
5595
|
-
(o) => o.respondsToUserMessageId === i &&
|
|
5596
|
-
) : s.slice(r + 1).some(
|
|
5607
|
+
(o) => o.respondsToUserMessageId === i && De(o)
|
|
5608
|
+
) : s.slice(r + 1).some(De);
|
|
5597
5609
|
}
|
|
5598
5610
|
function ut(s) {
|
|
5599
5611
|
const e = ie(s);
|
|
@@ -5608,7 +5620,7 @@ function ut(s) {
|
|
|
5608
5620
|
const i = n.clientMessageId;
|
|
5609
5621
|
return typeof i == "string" ? i : null;
|
|
5610
5622
|
}
|
|
5611
|
-
function
|
|
5623
|
+
function Er(s) {
|
|
5612
5624
|
const e = ie(s);
|
|
5613
5625
|
if (e === null)
|
|
5614
5626
|
return null;
|
|
@@ -5639,15 +5651,15 @@ function dt(s, e) {
|
|
|
5639
5651
|
return i?.type === "message" && i.role === "user" && typeof i.clientMessageId == "string" ? i.clientMessageId : null;
|
|
5640
5652
|
}
|
|
5641
5653
|
function ns(s, e, t, n, i, r) {
|
|
5642
|
-
if (!e || !
|
|
5654
|
+
if (!e || !Cr(s))
|
|
5643
5655
|
return !1;
|
|
5644
5656
|
const o = s;
|
|
5645
5657
|
if (pe(o) || t !== null && typeof o.id == "string" && o.id !== t)
|
|
5646
5658
|
return !1;
|
|
5647
5659
|
const a = O(o);
|
|
5648
|
-
return n !== null ? a !== null ? a === n : i !== null &&
|
|
5660
|
+
return n !== null ? a !== null ? a === n : i !== null && E(o) === i && r === n : i === null || E(o) === i;
|
|
5649
5661
|
}
|
|
5650
|
-
function
|
|
5662
|
+
function kr(s, e) {
|
|
5651
5663
|
for (let t = e - 1; t >= 0; t -= 1) {
|
|
5652
5664
|
const n = C(s[t]);
|
|
5653
5665
|
if (n?.type === "message" && n.role === "user")
|
|
@@ -5655,31 +5667,31 @@ function br(s, e) {
|
|
|
5655
5667
|
}
|
|
5656
5668
|
return null;
|
|
5657
5669
|
}
|
|
5658
|
-
function
|
|
5670
|
+
function vs(s, e) {
|
|
5659
5671
|
for (let t = e - 1; t >= 0; t -= 1)
|
|
5660
5672
|
if (s[t].role === "user")
|
|
5661
5673
|
return s[t].id;
|
|
5662
5674
|
return null;
|
|
5663
5675
|
}
|
|
5664
|
-
function
|
|
5676
|
+
function Cr(s) {
|
|
5665
5677
|
if (!s || typeof s != "object")
|
|
5666
5678
|
return !1;
|
|
5667
5679
|
const e = s;
|
|
5668
5680
|
return e.type === "message" && e.role === "assistant" ? !0 : e.type === "run_error" ? e.stage !== "tool_execution" : e.type === "run_status" && (e.status === "stopped" || e.status === "interrupted" || e.status === "failed");
|
|
5669
5681
|
}
|
|
5670
|
-
function
|
|
5682
|
+
function W(s) {
|
|
5671
5683
|
return s.role === "assistant" && s.phase !== "commentary";
|
|
5672
5684
|
}
|
|
5673
|
-
function
|
|
5685
|
+
function _r(s) {
|
|
5674
5686
|
if (!s || typeof s != "object")
|
|
5675
5687
|
return !1;
|
|
5676
5688
|
const e = s;
|
|
5677
5689
|
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";
|
|
5678
5690
|
}
|
|
5679
5691
|
function ht(s) {
|
|
5680
|
-
return s.filter((e, t) => G(e) ? !
|
|
5692
|
+
return s.filter((e, t) => G(e) ? !Wr(s, t) && !Us(s, t) && !Br(s, t) && !Fr(s, t) : Pr(e) ? e.retryable === !0 && Hr(s, t) ? !1 : !Nr(s, t) : !0);
|
|
5681
5693
|
}
|
|
5682
|
-
function
|
|
5694
|
+
function Pr(s) {
|
|
5683
5695
|
return s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.steered !== !0);
|
|
5684
5696
|
}
|
|
5685
5697
|
function G(s) {
|
|
@@ -5688,19 +5700,19 @@ function G(s) {
|
|
|
5688
5700
|
function pt(s) {
|
|
5689
5701
|
return s.steered !== !0 && (s.dataType === "assistant_draft" || s.loading === !0);
|
|
5690
5702
|
}
|
|
5691
|
-
function
|
|
5703
|
+
function vr(s) {
|
|
5692
5704
|
return s.some(pt);
|
|
5693
5705
|
}
|
|
5694
5706
|
function is(s, e) {
|
|
5695
5707
|
return (s.retryable === !0 || s.code === "transient_model_error") && s.code !== "run_recovery_exhausted" && e !== null && typeof s.clientMessageId == "string";
|
|
5696
5708
|
}
|
|
5697
|
-
function
|
|
5709
|
+
function Ur(s, e) {
|
|
5698
5710
|
const t = [...s].reverse().find(pt), n = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : t?.respondsToUserMessageId ?? null, i = typeof e.runId == "string" ? e.runId : t?.runId ?? null;
|
|
5699
5711
|
return s.flatMap((r) => (n ? r.respondsToUserMessageId === n || !r.respondsToUserMessageId && i !== null && r.runId === i : i ? r.runId === i : pt(r)) ? r.dataType === "assistant_draft" || G(r) ? [] : r.loading === !0 ? [{ ...r, loading: !1 }] : [r] : [r]);
|
|
5700
5712
|
}
|
|
5701
|
-
function
|
|
5713
|
+
function Dr(s, e, t, n) {
|
|
5702
5714
|
const i = s.findIndex(
|
|
5703
|
-
(l, c) => G(l) && !
|
|
5715
|
+
(l, c) => G(l) && !Us(s, c)
|
|
5704
5716
|
), r = i === -1 ? null : s[i], o = e ?? r?.respondsToUserMessageId ?? null, a = o ? s.find(
|
|
5705
5717
|
(l) => l.role === "user" && l.id === o
|
|
5706
5718
|
) : null;
|
|
@@ -5710,11 +5722,11 @@ function Pr(s, e, t, n) {
|
|
|
5710
5722
|
runId: t ?? r?.runId ?? null
|
|
5711
5723
|
};
|
|
5712
5724
|
}
|
|
5713
|
-
function
|
|
5725
|
+
function _e(s) {
|
|
5714
5726
|
return s?.type === "run_status" && s.status === "stopped";
|
|
5715
5727
|
}
|
|
5716
|
-
function
|
|
5717
|
-
return
|
|
5728
|
+
function qr(s, e) {
|
|
5729
|
+
return W(e) ? "completed" : _e(s) ? "stopped" : !pe(s) && (s?.type === "run_error" || s?.type === "run_status" && (s.status === "failed" || s.status === "interrupted")) ? "failed" : null;
|
|
5718
5730
|
}
|
|
5719
5731
|
function rs(s, e, t) {
|
|
5720
5732
|
const n = new Set(
|
|
@@ -5726,16 +5738,16 @@ function rs(s, e, t) {
|
|
|
5726
5738
|
(i) => !G(i) || (n.size > 0 ? !i.respondsToUserMessageId || !n.has(i.respondsToUserMessageId) : !t || i.runId !== t)
|
|
5727
5739
|
);
|
|
5728
5740
|
}
|
|
5729
|
-
function
|
|
5741
|
+
function Us(s, e) {
|
|
5730
5742
|
return s.some(
|
|
5731
|
-
(t, n) => n !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) &&
|
|
5743
|
+
(t, n) => n !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) && Or(
|
|
5732
5744
|
s,
|
|
5733
5745
|
e,
|
|
5734
5746
|
n
|
|
5735
5747
|
)
|
|
5736
5748
|
);
|
|
5737
5749
|
}
|
|
5738
|
-
function
|
|
5750
|
+
function Or(s, e, t) {
|
|
5739
5751
|
const n = s[e], i = s[t];
|
|
5740
5752
|
if (ge(n, i))
|
|
5741
5753
|
return !0;
|
|
@@ -5748,11 +5760,11 @@ function Ur(s, e, t) {
|
|
|
5748
5760
|
}
|
|
5749
5761
|
function os(s, e, t, n) {
|
|
5750
5762
|
const i = (t && t !== e ? t : null) ?? [...s].reverse().find(
|
|
5751
|
-
(l) => l.respondsToUserMessageId !== void 0 && l.respondsToUserMessageId !== e && as(l) && !
|
|
5763
|
+
(l) => l.respondsToUserMessageId !== void 0 && l.respondsToUserMessageId !== e && as(l) && !Lr(
|
|
5752
5764
|
s,
|
|
5753
5765
|
l.respondsToUserMessageId
|
|
5754
5766
|
)
|
|
5755
|
-
)?.respondsToUserMessageId ??
|
|
5767
|
+
)?.respondsToUserMessageId ?? xr(
|
|
5756
5768
|
s,
|
|
5757
5769
|
e
|
|
5758
5770
|
);
|
|
@@ -5781,7 +5793,7 @@ function os(s, e, t, n) {
|
|
|
5781
5793
|
}
|
|
5782
5794
|
];
|
|
5783
5795
|
}
|
|
5784
|
-
function
|
|
5796
|
+
function xr(s, e) {
|
|
5785
5797
|
const t = s.findIndex(
|
|
5786
5798
|
(n) => n.role === "user" && n.id === e
|
|
5787
5799
|
);
|
|
@@ -5795,12 +5807,12 @@ function Dr(s, e) {
|
|
|
5795
5807
|
function as(s) {
|
|
5796
5808
|
return s.role === "tool" || G(s) ? !0 : s.role === "assistant" && s.phase === "commentary";
|
|
5797
5809
|
}
|
|
5798
|
-
function
|
|
5810
|
+
function Lr(s, e) {
|
|
5799
5811
|
return s.some(
|
|
5800
|
-
(t) => t.respondsToUserMessageId === e && (
|
|
5812
|
+
(t) => t.respondsToUserMessageId === e && (W(t) || t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0))
|
|
5801
5813
|
);
|
|
5802
5814
|
}
|
|
5803
|
-
function
|
|
5815
|
+
function Nr(s, e) {
|
|
5804
5816
|
const t = s[e];
|
|
5805
5817
|
for (let n = e + 1; n < s.length; n += 1) {
|
|
5806
5818
|
const i = s[n];
|
|
@@ -5809,7 +5821,7 @@ function Or(s, e) {
|
|
|
5809
5821
|
}
|
|
5810
5822
|
return !1;
|
|
5811
5823
|
}
|
|
5812
|
-
function
|
|
5824
|
+
function Hr(s, e) {
|
|
5813
5825
|
const t = s[e];
|
|
5814
5826
|
if (!t.respondsToUserMessageId)
|
|
5815
5827
|
return !1;
|
|
@@ -5822,19 +5834,19 @@ function xr(s, e) {
|
|
|
5822
5834
|
}
|
|
5823
5835
|
return !1;
|
|
5824
5836
|
}
|
|
5825
|
-
function
|
|
5837
|
+
function Br(s, e) {
|
|
5826
5838
|
const t = s[e];
|
|
5827
5839
|
return s.some(
|
|
5828
5840
|
(n, i) => i !== e && n.role === "assistant" && ge(t, n)
|
|
5829
5841
|
);
|
|
5830
5842
|
}
|
|
5831
|
-
function
|
|
5843
|
+
function Fr(s, e) {
|
|
5832
5844
|
const t = s[e];
|
|
5833
5845
|
return s.some(
|
|
5834
5846
|
(n, i) => i !== e && n.role === "tool" && ge(t, n)
|
|
5835
5847
|
);
|
|
5836
5848
|
}
|
|
5837
|
-
function
|
|
5849
|
+
function Wr(s, e) {
|
|
5838
5850
|
const t = s[e];
|
|
5839
5851
|
for (let n = e + 1; n < s.length; n += 1)
|
|
5840
5852
|
if (G(s[n]) && ge(t, s[n]))
|
|
@@ -5847,15 +5859,15 @@ function ge(s, e) {
|
|
|
5847
5859
|
function A(s, e) {
|
|
5848
5860
|
return s && typeof s == "object" && typeof s[e] == "string" ? s[e] : null;
|
|
5849
5861
|
}
|
|
5850
|
-
function
|
|
5862
|
+
function $r(s, e) {
|
|
5851
5863
|
try {
|
|
5852
|
-
const t = window.localStorage.getItem(`${
|
|
5864
|
+
const t = window.localStorage.getItem(`${Ms}${s}`);
|
|
5853
5865
|
if (!t)
|
|
5854
5866
|
return null;
|
|
5855
5867
|
const n = JSON.parse(t), i = typeof n.sessionId == "string" ? n.sessionId : null;
|
|
5856
5868
|
if (e !== void 0 && i !== e)
|
|
5857
5869
|
return null;
|
|
5858
|
-
const r = Array.isArray(n.messages) ? n.messages.map(
|
|
5870
|
+
const r = Array.isArray(n.messages) ? n.messages.map(eo).filter((o) => !!o) : [];
|
|
5859
5871
|
return {
|
|
5860
5872
|
sessionId: i,
|
|
5861
5873
|
messages: r
|
|
@@ -5869,20 +5881,20 @@ function gt(s) {
|
|
|
5869
5881
|
// running tool or commentary history from disappearing while authoritative hydration is still in flight.
|
|
5870
5882
|
s.role === "tool" || s.dataType === "run_status" || s.dataType === "run_error";
|
|
5871
5883
|
}
|
|
5872
|
-
function
|
|
5884
|
+
function jr(s, e) {
|
|
5873
5885
|
try {
|
|
5874
5886
|
window.localStorage.setItem(
|
|
5875
|
-
`${
|
|
5887
|
+
`${Ms}${s}`,
|
|
5876
5888
|
JSON.stringify({
|
|
5877
5889
|
sessionId: e.sessionId,
|
|
5878
|
-
messages: e.messages.filter(gt).slice(-
|
|
5890
|
+
messages: e.messages.filter(gt).slice(-di).map(to)
|
|
5879
5891
|
})
|
|
5880
5892
|
);
|
|
5881
5893
|
} catch {
|
|
5882
5894
|
return;
|
|
5883
5895
|
}
|
|
5884
5896
|
}
|
|
5885
|
-
function
|
|
5897
|
+
function zr(s) {
|
|
5886
5898
|
try {
|
|
5887
5899
|
const e = window.localStorage.getItem(`${at}${s}`);
|
|
5888
5900
|
if (!e)
|
|
@@ -5908,9 +5920,9 @@ function V(s, e) {
|
|
|
5908
5920
|
return;
|
|
5909
5921
|
}
|
|
5910
5922
|
}
|
|
5911
|
-
function
|
|
5923
|
+
function Ds(s, e) {
|
|
5912
5924
|
try {
|
|
5913
|
-
const t = `${
|
|
5925
|
+
const t = `${Le}${s}`, n = location.href, i = location.origin, r = Array.from(e, (o) => ({
|
|
5914
5926
|
...o,
|
|
5915
5927
|
storedAt: Date.now(),
|
|
5916
5928
|
unloadUrl: n,
|
|
@@ -5926,26 +5938,26 @@ function Us(s, e) {
|
|
|
5926
5938
|
}
|
|
5927
5939
|
function ls(s, e) {
|
|
5928
5940
|
try {
|
|
5929
|
-
if (window.sessionStorage.getItem(`${
|
|
5941
|
+
if (window.sessionStorage.getItem(`${Le}${s}`) === null)
|
|
5930
5942
|
return;
|
|
5931
5943
|
} catch {
|
|
5932
5944
|
return;
|
|
5933
5945
|
}
|
|
5934
|
-
|
|
5946
|
+
Ds(s, e);
|
|
5935
5947
|
}
|
|
5936
|
-
function
|
|
5948
|
+
function Kr(s) {
|
|
5937
5949
|
try {
|
|
5938
|
-
const e = `${
|
|
5950
|
+
const e = `${Le}${s}`, t = window.sessionStorage.getItem(e);
|
|
5939
5951
|
if (window.sessionStorage.removeItem(e), !t)
|
|
5940
5952
|
return [];
|
|
5941
5953
|
const n = JSON.parse(t);
|
|
5942
|
-
return Array.isArray(n) ? n.flatMap((i) =>
|
|
5954
|
+
return Array.isArray(n) ? n.flatMap((i) => Qr(i) ? [{
|
|
5943
5955
|
...i.event,
|
|
5944
5956
|
page: _(),
|
|
5945
5957
|
rawOutput: {
|
|
5946
5958
|
pageContextRestarted: !0,
|
|
5947
5959
|
outcome: "unknown",
|
|
5948
|
-
message:
|
|
5960
|
+
message: Gr(location.href),
|
|
5949
5961
|
currentUrl: location.href,
|
|
5950
5962
|
console: [],
|
|
5951
5963
|
metadata: {
|
|
@@ -5962,17 +5974,17 @@ function $r(s) {
|
|
|
5962
5974
|
return [];
|
|
5963
5975
|
}
|
|
5964
5976
|
}
|
|
5965
|
-
function
|
|
5977
|
+
function Gr(s) {
|
|
5966
5978
|
return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
|
|
5967
5979
|
Current URL: ${s}`;
|
|
5968
5980
|
}
|
|
5969
|
-
function
|
|
5981
|
+
function Qr(s) {
|
|
5970
5982
|
if (!s || typeof s != "object")
|
|
5971
5983
|
return !1;
|
|
5972
5984
|
const e = s, t = e.event;
|
|
5973
5985
|
return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" && bt(t) && t.type === "tool.result";
|
|
5974
5986
|
}
|
|
5975
|
-
function
|
|
5987
|
+
function Vr(s, e) {
|
|
5976
5988
|
const t = new Set(
|
|
5977
5989
|
s.flatMap((n) => n.type === "tool.result" ? [n.callId] : [])
|
|
5978
5990
|
);
|
|
@@ -5981,9 +5993,9 @@ function Kr(s, e) {
|
|
|
5981
5993
|
...e.filter((n) => !t.has(n.callId))
|
|
5982
5994
|
];
|
|
5983
5995
|
}
|
|
5984
|
-
function
|
|
5996
|
+
function Xr(s) {
|
|
5985
5997
|
try {
|
|
5986
|
-
window.sessionStorage.removeItem(`${
|
|
5998
|
+
window.sessionStorage.removeItem(`${Le}${s}`);
|
|
5987
5999
|
} catch {
|
|
5988
6000
|
return;
|
|
5989
6001
|
}
|
|
@@ -6000,7 +6012,7 @@ function cs(s) {
|
|
|
6000
6012
|
const e = s;
|
|
6001
6013
|
return typeof e.url == "string" && typeof e.title == "string" && typeof e.origin == "string";
|
|
6002
6014
|
}
|
|
6003
|
-
function
|
|
6015
|
+
function qs(s, e) {
|
|
6004
6016
|
if (!Array.isArray(s))
|
|
6005
6017
|
return;
|
|
6006
6018
|
const t = s.filter((i) => {
|
|
@@ -6008,41 +6020,41 @@ function Ds(s, e) {
|
|
|
6008
6020
|
return !1;
|
|
6009
6021
|
const r = i;
|
|
6010
6022
|
return typeof r.name == "string" && typeof r.mimeType == "string" && typeof r.sizeBytes == "number";
|
|
6011
|
-
}), n = e ? t.map((i) =>
|
|
6023
|
+
}), n = e ? t.map((i) => Os(i, e)) : t;
|
|
6012
6024
|
return n.length > 0 ? n : void 0;
|
|
6013
6025
|
}
|
|
6014
|
-
function
|
|
6026
|
+
function Os(s, e) {
|
|
6015
6027
|
return s.fileUrl?.startsWith("/") ? {
|
|
6016
6028
|
...s,
|
|
6017
6029
|
fileUrl: new URL(s.fileUrl, e).toString()
|
|
6018
6030
|
} : s;
|
|
6019
6031
|
}
|
|
6020
6032
|
function ft(s) {
|
|
6021
|
-
return s.type ||
|
|
6033
|
+
return s.type || Zr(s.name) || "application/octet-stream";
|
|
6022
6034
|
}
|
|
6023
|
-
function
|
|
6024
|
-
|
|
6035
|
+
function Jr(s) {
|
|
6036
|
+
xs({
|
|
6025
6037
|
name: s.name,
|
|
6026
6038
|
mimeType: ft(s),
|
|
6027
6039
|
sizeBytes: s.size
|
|
6028
6040
|
});
|
|
6029
6041
|
}
|
|
6030
|
-
function
|
|
6031
|
-
const e =
|
|
6032
|
-
if (!
|
|
6042
|
+
function xs(s) {
|
|
6043
|
+
const e = Yr(s.name), t = s.mimeType.trim().toLowerCase();
|
|
6044
|
+
if (!li.has(`${e}:${t}`))
|
|
6033
6045
|
throw new Error("This attachment type is not supported by the embedded model provider");
|
|
6034
|
-
if (s.sizeBytes <= 0 || s.sizeBytes >=
|
|
6046
|
+
if (s.sizeBytes <= 0 || s.sizeBytes >= ws)
|
|
6035
6047
|
throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
|
|
6036
6048
|
}
|
|
6037
|
-
function
|
|
6049
|
+
function Yr(s) {
|
|
6038
6050
|
const e = s.trim().toLowerCase(), t = e.lastIndexOf(".");
|
|
6039
6051
|
return t >= 0 ? e.slice(t) : "";
|
|
6040
6052
|
}
|
|
6041
|
-
function
|
|
6053
|
+
function Zr(s) {
|
|
6042
6054
|
const e = s.toLowerCase();
|
|
6043
6055
|
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;
|
|
6044
6056
|
}
|
|
6045
|
-
function
|
|
6057
|
+
function eo(s) {
|
|
6046
6058
|
if (!s || typeof s != "object")
|
|
6047
6059
|
return null;
|
|
6048
6060
|
const e = s;
|
|
@@ -6060,17 +6072,17 @@ function Jr(s) {
|
|
|
6060
6072
|
scheduledCheckInId: typeof e.scheduledCheckInId == "string" ? e.scheduledCheckInId : void 0,
|
|
6061
6073
|
scheduledCheckInAt: typeof e.scheduledCheckInAt == "string" ? e.scheduledCheckInAt : void 0,
|
|
6062
6074
|
securitySettingsUrl: typeof e.securitySettingsUrl == "string" ? e.securitySettingsUrl : void 0,
|
|
6063
|
-
attachments:
|
|
6075
|
+
attachments: qs(e.attachments)?.map(qe),
|
|
6064
6076
|
loading: typeof e.loading == "boolean" ? e.loading : void 0
|
|
6065
6077
|
};
|
|
6066
6078
|
}
|
|
6067
|
-
function
|
|
6079
|
+
function to(s) {
|
|
6068
6080
|
return s.attachments?.length ? {
|
|
6069
6081
|
...s,
|
|
6070
|
-
attachments: s.attachments.map(
|
|
6082
|
+
attachments: s.attachments.map(qe)
|
|
6071
6083
|
} : s;
|
|
6072
6084
|
}
|
|
6073
|
-
function
|
|
6085
|
+
function qe(s) {
|
|
6074
6086
|
const {
|
|
6075
6087
|
dataUrl: e,
|
|
6076
6088
|
objectUrl: t,
|
|
@@ -6084,15 +6096,15 @@ function O(s) {
|
|
|
6084
6096
|
const e = s.respondsToUserMessageId;
|
|
6085
6097
|
return typeof e == "string" && e ? e : null;
|
|
6086
6098
|
}
|
|
6087
|
-
function
|
|
6099
|
+
function E(s) {
|
|
6088
6100
|
const e = s.runId;
|
|
6089
6101
|
return typeof e == "string" && e ? e : null;
|
|
6090
6102
|
}
|
|
6091
|
-
function
|
|
6103
|
+
function so(s) {
|
|
6092
6104
|
const e = s?.timeoutMs;
|
|
6093
|
-
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 <=
|
|
6105
|
+
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 <= Ri);
|
|
6094
6106
|
}
|
|
6095
|
-
function
|
|
6107
|
+
function Ls(s) {
|
|
6096
6108
|
const e = {};
|
|
6097
6109
|
try {
|
|
6098
6110
|
new Headers(s).forEach((t, n) => {
|
|
@@ -6104,23 +6116,23 @@ function xs(s) {
|
|
|
6104
6116
|
return e;
|
|
6105
6117
|
}
|
|
6106
6118
|
function Rt(s, e) {
|
|
6107
|
-
return
|
|
6119
|
+
return $s(s) ? Be : F(xe(e), ci);
|
|
6108
6120
|
}
|
|
6109
|
-
function
|
|
6121
|
+
function no(s, e) {
|
|
6110
6122
|
return typeof s == "string" ? s : s instanceof URL ? s.toString() : e?.url ?? "";
|
|
6111
6123
|
}
|
|
6112
|
-
async function
|
|
6113
|
-
const i =
|
|
6124
|
+
async function io(s, e, t, n) {
|
|
6125
|
+
const i = Ls(s.headers);
|
|
6114
6126
|
n({
|
|
6115
6127
|
...e,
|
|
6116
6128
|
responseStatus: s.status,
|
|
6117
6129
|
responseHeaders: i,
|
|
6118
|
-
responseBody: await
|
|
6130
|
+
responseBody: await ro(s),
|
|
6119
6131
|
durationMs: Date.now() - t
|
|
6120
6132
|
});
|
|
6121
6133
|
}
|
|
6122
|
-
async function
|
|
6123
|
-
if (!
|
|
6134
|
+
async function ro(s) {
|
|
6135
|
+
if (!Ns(s.headers))
|
|
6124
6136
|
return;
|
|
6125
6137
|
let e = null, t = null;
|
|
6126
6138
|
try {
|
|
@@ -6129,7 +6141,7 @@ async function so(s) {
|
|
|
6129
6141
|
const n = new Promise((a) => {
|
|
6130
6142
|
t = window.setTimeout(() => {
|
|
6131
6143
|
e?.cancel(), a("timeout");
|
|
6132
|
-
},
|
|
6144
|
+
}, ui);
|
|
6133
6145
|
}), i = new TextDecoder();
|
|
6134
6146
|
let r = "", o = 0;
|
|
6135
6147
|
for (; ; ) {
|
|
@@ -6138,10 +6150,10 @@ async function so(s) {
|
|
|
6138
6150
|
return;
|
|
6139
6151
|
const { done: l, value: c } = a;
|
|
6140
6152
|
if (l)
|
|
6141
|
-
return
|
|
6153
|
+
return F(r + i.decode());
|
|
6142
6154
|
const u = Tt - o;
|
|
6143
6155
|
if (c.byteLength > u)
|
|
6144
|
-
return r += i.decode(c.subarray(0, Math.max(u, 0)), { stream: !0 }), e.cancel(), `${
|
|
6156
|
+
return r += i.decode(c.subarray(0, Math.max(u, 0)), { stream: !0 }), e.cancel(), `${F(r)}... [truncated]`;
|
|
6145
6157
|
o += c.byteLength, r += i.decode(c, { stream: !0 });
|
|
6146
6158
|
}
|
|
6147
6159
|
} catch {
|
|
@@ -6151,19 +6163,19 @@ async function so(s) {
|
|
|
6151
6163
|
t !== null && window.clearTimeout(t);
|
|
6152
6164
|
}
|
|
6153
6165
|
}
|
|
6154
|
-
function
|
|
6155
|
-
if (
|
|
6166
|
+
function oo(s, e) {
|
|
6167
|
+
if (Ns(new Headers(e)))
|
|
6156
6168
|
try {
|
|
6157
|
-
return s.responseType === "" || s.responseType === "text" ?
|
|
6169
|
+
return s.responseType === "" || s.responseType === "text" ? F(s.responseText ?? "") : void 0;
|
|
6158
6170
|
} catch {
|
|
6159
6171
|
return;
|
|
6160
6172
|
}
|
|
6161
6173
|
}
|
|
6162
6174
|
function us(s) {
|
|
6163
6175
|
if (typeof s == "string")
|
|
6164
|
-
return
|
|
6176
|
+
return F(s);
|
|
6165
6177
|
}
|
|
6166
|
-
function
|
|
6178
|
+
function ao(s) {
|
|
6167
6179
|
return L({
|
|
6168
6180
|
...s,
|
|
6169
6181
|
requestBody: ds(s.requestBody),
|
|
@@ -6175,21 +6187,21 @@ function ds(s) {
|
|
|
6175
6187
|
return s;
|
|
6176
6188
|
const e = s.trim();
|
|
6177
6189
|
if (!e.startsWith("{") && !e.startsWith("["))
|
|
6178
|
-
return
|
|
6190
|
+
return xe(s);
|
|
6179
6191
|
try {
|
|
6180
6192
|
return JSON.stringify(L(JSON.parse(s)));
|
|
6181
6193
|
} catch {
|
|
6182
|
-
return
|
|
6194
|
+
return xe(s);
|
|
6183
6195
|
}
|
|
6184
6196
|
}
|
|
6185
|
-
function
|
|
6197
|
+
function Ns(s) {
|
|
6186
6198
|
if (!s)
|
|
6187
6199
|
return !1;
|
|
6188
6200
|
const e = s.get("content-type")?.toLowerCase() ?? "", t = s.get("content-length"), n = Number(t);
|
|
6189
6201
|
return t !== null && Number.isInteger(n) && n >= 0 && n <= Tt && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
|
|
6190
6202
|
}
|
|
6191
6203
|
function te(s, e = {}, t) {
|
|
6192
|
-
if (
|
|
6204
|
+
if (co(t))
|
|
6193
6205
|
return !0;
|
|
6194
6206
|
const n = Object.entries(e).find(([i]) => i.toLowerCase() === "content-type")?.[1]?.toLowerCase();
|
|
6195
6207
|
if (n?.includes("multipart/form-data") || n?.includes("application/octet-stream"))
|
|
@@ -6204,7 +6216,7 @@ function te(s, e = {}, t) {
|
|
|
6204
6216
|
return !0;
|
|
6205
6217
|
}
|
|
6206
6218
|
}
|
|
6207
|
-
function
|
|
6219
|
+
function lo(s, e) {
|
|
6208
6220
|
if (te(s))
|
|
6209
6221
|
return !0;
|
|
6210
6222
|
try {
|
|
@@ -6214,10 +6226,10 @@ function ro(s, e) {
|
|
|
6214
6226
|
return !0;
|
|
6215
6227
|
}
|
|
6216
6228
|
}
|
|
6217
|
-
function
|
|
6229
|
+
function co(s) {
|
|
6218
6230
|
return s instanceof FormData || s instanceof Blob || s instanceof ArrayBuffer || ArrayBuffer.isView(s) || typeof ReadableStream < "u" && s instanceof ReadableStream;
|
|
6219
6231
|
}
|
|
6220
|
-
function
|
|
6232
|
+
function uo(s) {
|
|
6221
6233
|
const e = {};
|
|
6222
6234
|
for (const t of s.trim().split(/[\r\n]+/)) {
|
|
6223
6235
|
const n = t.indexOf(":");
|
|
@@ -6230,126 +6242,126 @@ function ao(s) {
|
|
|
6230
6242
|
}
|
|
6231
6243
|
return e;
|
|
6232
6244
|
}
|
|
6233
|
-
function
|
|
6245
|
+
function F(s, e = Tt) {
|
|
6234
6246
|
return s.length <= e ? s : `${s.slice(0, e)}... [truncated ${s.length - e} chars]`;
|
|
6235
6247
|
}
|
|
6236
6248
|
function nt(s) {
|
|
6237
6249
|
return `${s}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
6238
6250
|
}
|
|
6239
|
-
class
|
|
6251
|
+
class Pe extends Error {
|
|
6240
6252
|
constructor(e, t) {
|
|
6241
6253
|
super(`${e} (${t})`), this.status = t, this.name = "AttachmentUploadHttpError";
|
|
6242
6254
|
}
|
|
6243
6255
|
status;
|
|
6244
6256
|
}
|
|
6245
|
-
async function
|
|
6257
|
+
async function be(s, e) {
|
|
6246
6258
|
let t = null;
|
|
6247
6259
|
for (let n = 0; n < zt; n += 1)
|
|
6248
6260
|
try {
|
|
6249
6261
|
return await s();
|
|
6250
6262
|
} catch (i) {
|
|
6251
|
-
if (t = i, n >= zt - 1 || !
|
|
6263
|
+
if (t = i, n >= zt - 1 || !po(i))
|
|
6252
6264
|
throw i;
|
|
6253
|
-
await
|
|
6265
|
+
await ho(n);
|
|
6254
6266
|
}
|
|
6255
6267
|
throw t instanceof Error ? t : new Error(e);
|
|
6256
6268
|
}
|
|
6257
|
-
function
|
|
6269
|
+
function ho(s) {
|
|
6258
6270
|
return new Promise((e) => {
|
|
6259
|
-
window.setTimeout(e,
|
|
6271
|
+
window.setTimeout(e, ai[s] ?? 0);
|
|
6260
6272
|
});
|
|
6261
6273
|
}
|
|
6262
|
-
function
|
|
6263
|
-
return s instanceof
|
|
6274
|
+
function po(s) {
|
|
6275
|
+
return s instanceof Pe ? go(s.status) : s instanceof TypeError;
|
|
6264
6276
|
}
|
|
6265
|
-
function
|
|
6277
|
+
function go(s) {
|
|
6266
6278
|
return s === 408 || s === 409 || s === 429 || s >= 500;
|
|
6267
6279
|
}
|
|
6268
|
-
function
|
|
6280
|
+
function fo(s) {
|
|
6269
6281
|
return s === 401 || s === 403;
|
|
6270
6282
|
}
|
|
6271
|
-
const
|
|
6283
|
+
const Be = "[REDACTED_SECRET]", $ = "[REDACTED_TOKEN]", mo = "[REDACTED_SIGNED_URL]", yo = 20, Io = /^(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, Hs = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Bs = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, Fs = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Ws = /\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, So = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, To = /\bhttps?:\/\/[^\s"'<>]+/gi, wo = /[),.;\]]+$/;
|
|
6272
6284
|
function L(s) {
|
|
6273
|
-
return
|
|
6285
|
+
return Oe(s, 0, /* @__PURE__ */ new WeakSet());
|
|
6274
6286
|
}
|
|
6275
|
-
function
|
|
6287
|
+
function Oe(s, e, t) {
|
|
6276
6288
|
if (typeof s == "string")
|
|
6277
|
-
return s.startsWith("data:image/") || s.startsWith("data:application/pdf;") ? s :
|
|
6289
|
+
return s.startsWith("data:image/") || s.startsWith("data:application/pdf;") ? s : xe(s);
|
|
6278
6290
|
if (s === null || typeof s != "object")
|
|
6279
6291
|
return s;
|
|
6280
|
-
if (e >=
|
|
6292
|
+
if (e >= yo)
|
|
6281
6293
|
return "[REDACTED_MAX_DEPTH]";
|
|
6282
6294
|
if (t.has(s))
|
|
6283
6295
|
return "[REDACTED_CIRCULAR]";
|
|
6284
6296
|
if (t.add(s), Array.isArray(s))
|
|
6285
|
-
return s.map((i) =>
|
|
6297
|
+
return s.map((i) => Oe(i, e + 1, t));
|
|
6286
6298
|
const n = {};
|
|
6287
6299
|
for (const [i, r] of Object.entries(s))
|
|
6288
|
-
i === "pageContent" ? n[i] = r :
|
|
6300
|
+
i === "pageContent" ? n[i] = r : $s(i) ? n[i] = Be : n[i] = i.toLowerCase() === "url" ? Ao(r) : Oe(r, e + 1, t);
|
|
6289
6301
|
return n;
|
|
6290
6302
|
}
|
|
6291
|
-
function
|
|
6303
|
+
function $s(s) {
|
|
6292
6304
|
const e = s.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
6293
6305
|
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");
|
|
6294
6306
|
}
|
|
6295
|
-
function
|
|
6296
|
-
return typeof s == "string" ?
|
|
6307
|
+
function Ao(s) {
|
|
6308
|
+
return typeof s == "string" ? js(s) : Oe(s, 0, /* @__PURE__ */ new WeakSet());
|
|
6297
6309
|
}
|
|
6298
|
-
function
|
|
6310
|
+
function js(s) {
|
|
6299
6311
|
try {
|
|
6300
6312
|
const e = new URL(s, location.href);
|
|
6301
6313
|
for (const t of Array.from(e.searchParams.keys()))
|
|
6302
|
-
|
|
6314
|
+
Io.test(t) && e.searchParams.set(t, $);
|
|
6303
6315
|
return e.username && (e.username = $), e.password && (e.password = $), e.toString();
|
|
6304
6316
|
} catch {
|
|
6305
|
-
return
|
|
6317
|
+
return Mo(s);
|
|
6306
6318
|
}
|
|
6307
6319
|
}
|
|
6308
|
-
function
|
|
6309
|
-
return s.replace(
|
|
6320
|
+
function xe(s) {
|
|
6321
|
+
return s.replace(So, mo).replace(To, bo).replace(Hs, `Bearer ${$}`).replace(Bs, `Basic ${$}`).replace(Fs, $).replace(Ws, (e, t) => `${t}: ${Be}`);
|
|
6310
6322
|
}
|
|
6311
|
-
function
|
|
6312
|
-
return s.replace(
|
|
6323
|
+
function Mo(s) {
|
|
6324
|
+
return s.replace(Hs, `Bearer ${$}`).replace(Bs, `Basic ${$}`).replace(Fs, $).replace(Ws, (e, t) => `${t}: ${Be}`);
|
|
6313
6325
|
}
|
|
6314
|
-
function
|
|
6315
|
-
const e = s.match(
|
|
6316
|
-
return `${
|
|
6326
|
+
function bo(s) {
|
|
6327
|
+
const e = s.match(wo)?.[0] ?? "", t = e ? s.slice(0, -e.length) : s;
|
|
6328
|
+
return `${js(t)}${e}`;
|
|
6317
6329
|
}
|
|
6318
|
-
const
|
|
6319
|
-
init: (s) =>
|
|
6330
|
+
const Do = Object.freeze({
|
|
6331
|
+
init: (s) => Ne.init(s)
|
|
6320
6332
|
});
|
|
6321
|
-
function
|
|
6322
|
-
return
|
|
6333
|
+
function qo(s) {
|
|
6334
|
+
return Ne.init(s);
|
|
6323
6335
|
}
|
|
6324
6336
|
export {
|
|
6325
6337
|
Ht as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6338
|
+
xn as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
|
|
6339
|
+
On as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
|
|
6340
|
+
Ln as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
|
|
6341
|
+
Uo as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
|
|
6342
|
+
Do as PlunoProductAgent,
|
|
6343
|
+
_n as ProductAgentInteractionManager,
|
|
6332
6344
|
xt as ProductAgentQueryController,
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6345
|
+
vo as ProductAgentRemoteRuntimeClient,
|
|
6346
|
+
Ne as ProductAgentSessionEngine,
|
|
6347
|
+
En as ProductAgentSessionHistoryManager,
|
|
6348
|
+
Co as ProductAgentTaskPageTitleController,
|
|
6337
6349
|
X as ProductAgentTokenProviderError,
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6350
|
+
fi as calculateReconnectDelay,
|
|
6351
|
+
ko as createLocalStorageInteractionDecisionStorage,
|
|
6352
|
+
Ee as createProductAgentQueryState,
|
|
6353
|
+
qo as createProductAgentRuntime,
|
|
6354
|
+
_o as createProductAgentTaskPageTitleDocument,
|
|
6355
|
+
Do as default,
|
|
6356
|
+
Dn as formatProductAgentTaskPageTitle,
|
|
6357
|
+
Fi as getProductAgentOriginAccessErrorMessage,
|
|
6358
|
+
Po as isProductAgentRuntimeCommand,
|
|
6359
|
+
Mn as mergeProductAgentEntityPages,
|
|
6348
6360
|
ke as normalizeProductAgentEntityPage,
|
|
6349
6361
|
st as normalizeProductAgentSessionItems,
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6362
|
+
Pn as readLocalStorageInteractionDecisions,
|
|
6363
|
+
Eo as resolveProductAgentComposerAction,
|
|
6364
|
+
Ro as resolveProductAgentWidgetPresentation,
|
|
6365
|
+
Ss as selectProductAgentQueryEntities,
|
|
6366
|
+
Jr as validateProductAgentProviderInputFile
|
|
6355
6367
|
};
|