@pluno/product-agent-web 0.1.207 → 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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/product-agent-runtime.cjs +1 -1
- package/dist/product-agent-runtime.js +54 -48
- package/dist/product-agent-sdk.js +540 -532
- package/dist/product-agent-widget.js +849 -839
- 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,10 +190,10 @@ 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 Ke = "pluno.productAgent.transportId",
|
|
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
195
|
const Re = /* @__PURE__ */ new Set(), Qe = /* @__PURE__ */ new Map();
|
|
193
|
-
async function
|
|
196
|
+
async function hn(s = gs()) {
|
|
194
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) => {
|
|
@@ -228,9 +231,9 @@ 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) => {
|
|
@@ -238,7 +241,7 @@ async function un(s = !1) {
|
|
|
238
241
|
};
|
|
239
242
|
window.addEventListener("pagehide", r);
|
|
240
243
|
}));
|
|
241
|
-
const e = await le, t =
|
|
244
|
+
const e = await le, t = gn();
|
|
242
245
|
Re.add(t);
|
|
243
246
|
let n = !1;
|
|
244
247
|
return {
|
|
@@ -249,21 +252,21 @@ async function un(s = !1) {
|
|
|
249
252
|
}
|
|
250
253
|
};
|
|
251
254
|
}
|
|
252
|
-
function
|
|
255
|
+
function gn() {
|
|
253
256
|
let s = 0;
|
|
254
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 {
|
|
@@ -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,9 +296,9 @@ 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
303
|
if (t.key !== Ge || !t.newValue)
|
|
301
304
|
return;
|
|
@@ -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
|
-
], Ve = (s) =>
|
|
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 ke(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 = {
|
|
@@ -454,7 +457,7 @@ class xt {
|
|
|
454
457
|
for (const e of this.listeners) e(this.state);
|
|
455
458
|
}
|
|
456
459
|
}
|
|
457
|
-
function
|
|
460
|
+
function ke(s) {
|
|
458
461
|
const e = {}, t = [];
|
|
459
462
|
for (const n of s.entities)
|
|
460
463
|
e[n.id] || t.push(n.id), e[n.id] = n;
|
|
@@ -464,28 +467,28 @@ function Ee(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,20 +498,20 @@ 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`,
|
|
502
|
-
async ({ cursor: i }) =>
|
|
505
|
+
async ({ cursor: i }) => ke(
|
|
503
506
|
await this.loadPage({ cursor: i, limit: this.limit, pinned: !1 }).then((r) => ({
|
|
504
507
|
entities: r.sessions,
|
|
505
508
|
nextCursor: r.nextCursor
|
|
506
509
|
}))
|
|
507
510
|
),
|
|
508
|
-
|
|
511
|
+
Mn
|
|
509
512
|
), this.pinnedQuery = new xt(
|
|
510
513
|
`${e}:pinned`,
|
|
511
|
-
async () =>
|
|
514
|
+
async () => ke({
|
|
512
515
|
entities: await this.loadAllPinned(),
|
|
513
516
|
nextCursor: null
|
|
514
517
|
})
|
|
@@ -532,13 +535,13 @@ class Mn {
|
|
|
532
535
|
...Ie(e.data)
|
|
533
536
|
], i = new Map(n.map((l) => [l.id, l])), r = Array.from(i.values()).map(
|
|
534
537
|
(l) => this.applyOverrides(l, this.completedRefreshSequence)
|
|
535
|
-
), o = Array.from(this.optimisticEntities.values()).filter((l) => !i.has(l.id)).reverse(), a = e.data || t.data || o.length > 0 ?
|
|
538
|
+
), o = Array.from(this.optimisticEntities.values()).filter((l) => !i.has(l.id)).reverse(), a = e.data || t.data || o.length > 0 ? ke({
|
|
536
539
|
entities: [...o, ...r],
|
|
537
540
|
nextCursor: e.data?.nextCursor ?? null
|
|
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
|
|
869
|
+
}, Un = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
|
|
870
|
+
function Dn(s, e) {
|
|
868
871
|
if (!e) return ve(s);
|
|
869
|
-
const t = ve(s), n = `${
|
|
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
|
}
|
|
@@ -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) => {
|
|
@@ -924,9 +927,9 @@ function ko(s) {
|
|
|
924
927
|
};
|
|
925
928
|
}
|
|
926
929
|
function ve(s) {
|
|
927
|
-
return s.replace(
|
|
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],
|
|
@@ -1265,14 +1269,14 @@ function Xe(s) {
|
|
|
1265
1269
|
function Nt(s) {
|
|
1266
1270
|
return {
|
|
1267
1271
|
...s,
|
|
1268
|
-
data: s.data ?
|
|
1269
|
-
entities:
|
|
1272
|
+
data: s.data ? ke({
|
|
1273
|
+
entities: Ss(s.data).map((e) => ({ ...e })),
|
|
1270
1274
|
nextCursor: s.data.nextCursor
|
|
1271
1275
|
}) : null
|
|
1272
1276
|
};
|
|
1273
1277
|
}
|
|
1274
|
-
const
|
|
1275
|
-
class
|
|
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";
|
|
1279
|
+
class X extends Error {
|
|
1276
1280
|
constructor(e, t, n, i) {
|
|
1277
1281
|
super(e), this.retryable = t, this.status = n, this.retryAfterMs = i, this.name = "ProductAgentTokenProviderError";
|
|
1278
1282
|
}
|
|
@@ -1280,10 +1284,10 @@ class J extends Error {
|
|
|
1280
1284
|
status;
|
|
1281
1285
|
retryAfterMs;
|
|
1282
1286
|
}
|
|
1283
|
-
function
|
|
1287
|
+
function Hn(s) {
|
|
1284
1288
|
return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
|
|
1285
1289
|
}
|
|
1286
|
-
let
|
|
1290
|
+
let Bn = 0;
|
|
1287
1291
|
function Bt(s) {
|
|
1288
1292
|
const e = {};
|
|
1289
1293
|
for (const l of [
|
|
@@ -1361,7 +1365,7 @@ function Se(s, e, t) {
|
|
|
1361
1365
|
source: "web_sdk",
|
|
1362
1366
|
category: s,
|
|
1363
1367
|
name: e,
|
|
1364
|
-
sequence: ++
|
|
1368
|
+
sequence: ++Bn,
|
|
1365
1369
|
wallTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1366
1370
|
monotonicMs: performance.now(),
|
|
1367
1371
|
data: t
|
|
@@ -1370,27 +1374,27 @@ function Se(s, e, t) {
|
|
|
1370
1374
|
}
|
|
1371
1375
|
class Te extends Error {
|
|
1372
1376
|
}
|
|
1373
|
-
function
|
|
1377
|
+
function Fn(s) {
|
|
1374
1378
|
return s === 408 || s === 425 || s === 429 || s >= 500;
|
|
1375
1379
|
}
|
|
1376
|
-
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([
|
|
1377
1381
|
".jpeg:image/jpeg",
|
|
1378
1382
|
".jpg:image/jpeg",
|
|
1379
1383
|
".pdf:application/pdf",
|
|
1380
1384
|
".png:image/png",
|
|
1381
1385
|
".webp:image/webp"
|
|
1382
|
-
]),
|
|
1383
|
-
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) {
|
|
1384
1388
|
const t = s === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (s - 1));
|
|
1385
1389
|
return Math.max(e, t);
|
|
1386
1390
|
}
|
|
1387
1391
|
const Ce = /* @__PURE__ */ new Set();
|
|
1388
1392
|
let we = null;
|
|
1389
|
-
function
|
|
1390
|
-
const t = Math.min(ot,
|
|
1393
|
+
function fi(s, e = Math.random) {
|
|
1394
|
+
const t = Math.min(ot, Jn * 2 ** s), n = 1 - Ft + e() * Ft * 2;
|
|
1391
1395
|
return Math.min(ot, Math.round(t * n));
|
|
1392
1396
|
}
|
|
1393
|
-
function
|
|
1397
|
+
function mi(s) {
|
|
1394
1398
|
const e = s.split(".")[1];
|
|
1395
1399
|
if (!e)
|
|
1396
1400
|
return null;
|
|
@@ -1401,8 +1405,8 @@ function pi(s) {
|
|
|
1401
1405
|
return null;
|
|
1402
1406
|
}
|
|
1403
1407
|
}
|
|
1404
|
-
function
|
|
1405
|
-
if (s instanceof
|
|
1408
|
+
function yi(s) {
|
|
1409
|
+
if (s instanceof X)
|
|
1406
1410
|
return s.retryable;
|
|
1407
1411
|
if (s && typeof s == "object") {
|
|
1408
1412
|
const e = s.status;
|
|
@@ -1411,7 +1415,7 @@ function gi(s) {
|
|
|
1411
1415
|
}
|
|
1412
1416
|
return !0;
|
|
1413
1417
|
}
|
|
1414
|
-
function
|
|
1418
|
+
function Ii(s) {
|
|
1415
1419
|
if (s instanceof Error)
|
|
1416
1420
|
return s;
|
|
1417
1421
|
if (s && typeof s == "object") {
|
|
@@ -1425,7 +1429,7 @@ function fi(s) {
|
|
|
1425
1429
|
}
|
|
1426
1430
|
class Ne {
|
|
1427
1431
|
constructor(e, t) {
|
|
1428
|
-
this.options = e, this.transportIdentity = t, this.sessionHistoryManager = new
|
|
1432
|
+
this.options = e, this.transportIdentity = t, this.sessionHistoryManager = new En(
|
|
1429
1433
|
e.clientId,
|
|
1430
1434
|
async ({ cursor: r, limit: o, pinned: a }) => await this.listSessions({ cursor: r, limit: o, pinned: a })
|
|
1431
1435
|
), this.sessionRecoveryPoller = new Lt({
|
|
@@ -1440,7 +1444,7 @@ class Ne {
|
|
|
1440
1444
|
activeIntervalMs: 3e3,
|
|
1441
1445
|
idleIntervalMs: 15e3,
|
|
1442
1446
|
maxFailureIntervalMs: 3e4
|
|
1443
|
-
}), this.sessionActivityRecovery = new
|
|
1447
|
+
}), this.sessionActivityRecovery = new Cn({
|
|
1444
1448
|
fetchPage: async (r, o) => await this.fetchSessionHistoryPageOnce(
|
|
1445
1449
|
r,
|
|
1446
1450
|
"activity",
|
|
@@ -1468,9 +1472,9 @@ class Ne {
|
|
|
1468
1472
|
maxFailureIntervalMs: 3e4
|
|
1469
1473
|
}), this.personalModelSelectionOverride = e.productVariant === "personal" && Ve(e.model) ? e.model : null, this.state = {
|
|
1470
1474
|
...this.state,
|
|
1471
|
-
starterPrompts:
|
|
1475
|
+
starterPrompts: Zi(e.initialStarterPrompts)
|
|
1472
1476
|
}, this.account = e.initialAccount ? { ...e.initialAccount } : null;
|
|
1473
|
-
const n = e.restorePersistedState === !1 ? null :
|
|
1477
|
+
const n = e.restorePersistedState === !1 ? null : $r(e.clientId, e.expectedPersistedSessionId);
|
|
1474
1478
|
n && (this.state = {
|
|
1475
1479
|
...this.state,
|
|
1476
1480
|
...n,
|
|
@@ -1491,9 +1495,9 @@ class Ne {
|
|
|
1491
1495
|
taskStatus: null,
|
|
1492
1496
|
isRetrying: !1,
|
|
1493
1497
|
lastError: null
|
|
1494
|
-
}, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents =
|
|
1495
|
-
|
|
1496
|
-
|
|
1498
|
+
}, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents = Vr(
|
|
1499
|
+
zr(e.clientId),
|
|
1500
|
+
Kr(e.clientId)
|
|
1497
1501
|
);
|
|
1498
1502
|
const i = [...this.queuedClientEvents].reverse().find(
|
|
1499
1503
|
(r) => r.type === "chat.user_message" && typeof r.clientMessageId == "string"
|
|
@@ -1539,7 +1543,7 @@ class Ne {
|
|
|
1539
1543
|
accountRefresh = null;
|
|
1540
1544
|
runtimeInteractions = [];
|
|
1541
1545
|
interactionListeners = /* @__PURE__ */ new Set();
|
|
1542
|
-
interactionManager = new
|
|
1546
|
+
interactionManager = new _n(
|
|
1543
1547
|
{ load: async () => [], save: async () => {
|
|
1544
1548
|
} },
|
|
1545
1549
|
[]
|
|
@@ -1639,17 +1643,17 @@ class Ne {
|
|
|
1639
1643
|
lastErrorSecuritySettingsUrl: null
|
|
1640
1644
|
};
|
|
1641
1645
|
static async init(e) {
|
|
1642
|
-
const t = e, n = await
|
|
1646
|
+
const t = e, n = await pn(
|
|
1643
1647
|
t.skipStoredTransportIdentityCollisionCheck === !0
|
|
1644
1648
|
), i = new Ne({
|
|
1645
1649
|
...e,
|
|
1646
|
-
backendUrl:
|
|
1647
|
-
clientId: e.clientId ??
|
|
1650
|
+
backendUrl: Ni(e.backendUrl ?? Wn),
|
|
1651
|
+
clientId: e.clientId ?? ir(),
|
|
1648
1652
|
productVariant: e.productVariant ?? "customer_embedded",
|
|
1649
|
-
entrySurface:
|
|
1653
|
+
entrySurface: Hi(e.entrySurface)
|
|
1650
1654
|
}, n);
|
|
1651
1655
|
try {
|
|
1652
|
-
|
|
1656
|
+
Js().catch((r) => {
|
|
1653
1657
|
b("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
|
|
1654
1658
|
message: r instanceof Error ? r.message : String(r)
|
|
1655
1659
|
});
|
|
@@ -1695,7 +1699,7 @@ class Ne {
|
|
|
1695
1699
|
return this.options.token;
|
|
1696
1700
|
if (!this.options.tokenProvider)
|
|
1697
1701
|
return this.token;
|
|
1698
|
-
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;
|
|
1699
1703
|
if (!t.forceRefresh && (i || t.preferCached && this.token !== null))
|
|
1700
1704
|
return this.token;
|
|
1701
1705
|
if (this.tokenRequest && !t.forceRefresh)
|
|
@@ -1707,8 +1711,8 @@ class Ne {
|
|
|
1707
1711
|
let a = null;
|
|
1708
1712
|
const l = new Promise((c, u) => {
|
|
1709
1713
|
a = window.setTimeout(() => {
|
|
1710
|
-
r.abort(), u(new
|
|
1711
|
-
},
|
|
1714
|
+
r.abort(), u(new X("Pluno token provider timed out", !0));
|
|
1715
|
+
}, zn);
|
|
1712
1716
|
});
|
|
1713
1717
|
try {
|
|
1714
1718
|
const c = await Promise.race([
|
|
@@ -1716,10 +1720,10 @@ class Ne {
|
|
|
1716
1720
|
l
|
|
1717
1721
|
]);
|
|
1718
1722
|
if (r.signal.aborted || this.tokenAbortController !== r)
|
|
1719
|
-
throw new
|
|
1723
|
+
throw new X("Pluno token request was cancelled", !0);
|
|
1720
1724
|
if (!c)
|
|
1721
|
-
throw new
|
|
1722
|
-
return this.token = c, this.tokenExpiresAtMs =
|
|
1725
|
+
throw new X("Pluno token provider did not return a token", !1);
|
|
1726
|
+
return this.token = c, this.tokenExpiresAtMs = mi(c), c;
|
|
1723
1727
|
} finally {
|
|
1724
1728
|
a !== null && window.clearTimeout(a);
|
|
1725
1729
|
}
|
|
@@ -1743,11 +1747,11 @@ class Ne {
|
|
|
1743
1747
|
if (this.token = await this.acquireToken("connect"), e !== this.connectionAttemptId || this.state.status === "closed")
|
|
1744
1748
|
return;
|
|
1745
1749
|
if (!this.token && !this.options.webSocketFactory)
|
|
1746
|
-
throw new
|
|
1747
|
-
const t =
|
|
1750
|
+
throw new X("Pluno requires a token or tokenProvider", !1);
|
|
1751
|
+
const t = Wi(this.options.backendUrl), n = this.options.webSocketFactory?.(t) ?? new WebSocket(t);
|
|
1748
1752
|
this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
|
|
1749
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));
|
|
1750
|
-
},
|
|
1754
|
+
}, Gn), n.addEventListener("open", () => {
|
|
1751
1755
|
this.socket !== n || (this.clearSocketConnectTimer(), b("web-sdk.agent", "Pluno socket opened", {
|
|
1752
1756
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
1753
1757
|
isThinking: this.state.isThinking
|
|
@@ -1759,13 +1763,13 @@ class Ne {
|
|
|
1759
1763
|
pageUrl: location.href
|
|
1760
1764
|
}) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
|
|
1761
1765
|
this.socket === n && (b("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.reportTransportDiagnostic("auth_timeout"), this.replaceTimedOutSocket(n));
|
|
1762
|
-
},
|
|
1766
|
+
}, Qn));
|
|
1763
1767
|
}), n.addEventListener("message", (i) => {
|
|
1764
|
-
this.socket === n && this.handleServerEvent(
|
|
1768
|
+
this.socket === n && this.handleServerEvent(Ji(i.data));
|
|
1765
1769
|
}), n.addEventListener("sendfailure", (i) => {
|
|
1766
1770
|
if (this.socket !== n)
|
|
1767
1771
|
return;
|
|
1768
|
-
const r =
|
|
1772
|
+
const r = Yi(i?.detail?.data);
|
|
1769
1773
|
r?.type === "chat.user_message" && r.clientMessageId === this.pendingClientMessageId && !this.queuedClientEvents.some(
|
|
1770
1774
|
(o) => o.type === "chat.user_message" && o.clientMessageId === r.clientMessageId
|
|
1771
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();
|
|
@@ -1789,17 +1793,17 @@ class Ne {
|
|
|
1789
1793
|
} catch (t) {
|
|
1790
1794
|
if (e !== this.connectionAttemptId || this.state.status === "closed")
|
|
1791
1795
|
return;
|
|
1792
|
-
const n =
|
|
1793
|
-
if (
|
|
1796
|
+
const n = Ii(t);
|
|
1797
|
+
if (yi(t)) {
|
|
1794
1798
|
b("web-sdk.agent", "Pluno connection attempt failed; retrying", {
|
|
1795
1799
|
message: n.message,
|
|
1796
1800
|
reconnectAttempt: this.reconnectAttempts
|
|
1797
|
-
}), t instanceof
|
|
1801
|
+
}), t instanceof X && this.reportTransportDiagnostic("auth_timeout"), this.setState({
|
|
1798
1802
|
status: "reconnecting",
|
|
1799
|
-
lastError:
|
|
1803
|
+
lastError: ni,
|
|
1800
1804
|
lastErrorCode: "connection_failed"
|
|
1801
1805
|
}), this.emit("error", n), this.scheduleReconnect(
|
|
1802
|
-
t instanceof
|
|
1806
|
+
t instanceof X ? t.retryAfterMs : void 0
|
|
1803
1807
|
);
|
|
1804
1808
|
return;
|
|
1805
1809
|
}
|
|
@@ -1816,7 +1820,7 @@ class Ne {
|
|
|
1816
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;
|
|
1817
1821
|
}
|
|
1818
1822
|
destroy() {
|
|
1819
|
-
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();
|
|
1820
1824
|
for (const e of Object.values(this.listeners))
|
|
1821
1825
|
e?.clear();
|
|
1822
1826
|
this.accountListeners.clear(), this.interactionListeners.clear();
|
|
@@ -1856,10 +1860,10 @@ class Ne {
|
|
|
1856
1860
|
}
|
|
1857
1861
|
async sendMessage(e, t = {}) {
|
|
1858
1862
|
const n = e.trim(), i = t.attachments ?? [];
|
|
1859
|
-
if (this.options.productVariant === "customer_embedded" && (i.forEach(
|
|
1863
|
+
if (this.options.productVariant === "customer_embedded" && (i.forEach(xs), i.reduce(
|
|
1860
1864
|
(T, N) => T + N.sizeBytes,
|
|
1861
1865
|
0
|
|
1862
|
-
) >
|
|
1866
|
+
) > ws))
|
|
1863
1867
|
throw new Error("Embedded attachments must total at most 50 MB per message");
|
|
1864
1868
|
let r = i.map(qe);
|
|
1865
1869
|
if (!n && r.length === 0)
|
|
@@ -1952,7 +1956,7 @@ class Ne {
|
|
|
1952
1956
|
sessionId: this.state.sessionId ?? void 0,
|
|
1953
1957
|
clientMessageId: a,
|
|
1954
1958
|
initiatedBy: t.initiatedBy,
|
|
1955
|
-
invocation:
|
|
1959
|
+
invocation: Bi(t.invocation ?? t.initiatedBy),
|
|
1956
1960
|
entrySurface: this.options.entrySurface,
|
|
1957
1961
|
content: n,
|
|
1958
1962
|
proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
|
|
@@ -1970,8 +1974,12 @@ class Ne {
|
|
|
1970
1974
|
clientMessageId: t
|
|
1971
1975
|
});
|
|
1972
1976
|
}
|
|
1973
|
-
reportDisplayedError(e, t) {
|
|
1974
|
-
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
|
+
});
|
|
1975
1983
|
}
|
|
1976
1984
|
getModel() {
|
|
1977
1985
|
return this.options.model;
|
|
@@ -1995,7 +2003,7 @@ class Ne {
|
|
|
1995
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;
|
|
1996
2004
|
}
|
|
1997
2005
|
createLocalAttachment(e) {
|
|
1998
|
-
this.options.productVariant === "customer_embedded" &&
|
|
2006
|
+
this.options.productVariant === "customer_embedded" && Jr(e);
|
|
1999
2007
|
const t = x(), n = {
|
|
2000
2008
|
id: t,
|
|
2001
2009
|
name: e.name || "attachment",
|
|
@@ -2004,7 +2012,7 @@ class Ne {
|
|
|
2004
2012
|
};
|
|
2005
2013
|
this.attachmentFiles.set(t, e);
|
|
2006
2014
|
const i = Date.now();
|
|
2007
|
-
return
|
|
2015
|
+
return Vs({
|
|
2008
2016
|
attachmentId: t,
|
|
2009
2017
|
name: n.name,
|
|
2010
2018
|
mimeType: n.mimeType,
|
|
@@ -2069,8 +2077,8 @@ class Ne {
|
|
|
2069
2077
|
}, "Failed to upload attachment"), o = l;
|
|
2070
2078
|
}
|
|
2071
2079
|
this.setState({ sessionId: o.sessionId });
|
|
2072
|
-
const a =
|
|
2073
|
-
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, {
|
|
2074
2082
|
sessionId: o.sessionId,
|
|
2075
2083
|
fileUrl: a.fileUrl,
|
|
2076
2084
|
sandboxPath: a.sandboxPath,
|
|
@@ -2101,7 +2109,7 @@ class Ne {
|
|
|
2101
2109
|
const n = await this.fetchEmbedAttachmentUpload(e, !1);
|
|
2102
2110
|
if (n.ok)
|
|
2103
2111
|
return await n.json();
|
|
2104
|
-
if (
|
|
2112
|
+
if (fo(n.status) && this.options.tokenProvider && !t) {
|
|
2105
2113
|
t = !0;
|
|
2106
2114
|
const i = await this.fetchEmbedAttachmentUpload(e, !0);
|
|
2107
2115
|
if (i.ok)
|
|
@@ -2126,7 +2134,7 @@ class Ne {
|
|
|
2126
2134
|
if (!this.state.sessionId)
|
|
2127
2135
|
return;
|
|
2128
2136
|
this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "user_requested" });
|
|
2129
|
-
const e =
|
|
2137
|
+
const e = Dr(
|
|
2130
2138
|
this.state.messages,
|
|
2131
2139
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
2132
2140
|
this.state.assistantDraftRunId,
|
|
@@ -2261,7 +2269,7 @@ class Ne {
|
|
|
2261
2269
|
throw new Error("This interaction is no longer available.");
|
|
2262
2270
|
if (!r.allowedActions.includes(t))
|
|
2263
2271
|
throw new Error("This action is not available for the interaction.");
|
|
2264
|
-
if (
|
|
2272
|
+
if (Hn(t) && await this.interactionManager.act(
|
|
2265
2273
|
{
|
|
2266
2274
|
key: r.id,
|
|
2267
2275
|
category: r.category,
|
|
@@ -2310,7 +2318,7 @@ class Ne {
|
|
|
2310
2318
|
this.rebuildRuntimeInteractions();
|
|
2311
2319
|
}
|
|
2312
2320
|
rebuildRuntimeInteractions() {
|
|
2313
|
-
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;
|
|
2314
2322
|
if (t) {
|
|
2315
2323
|
const r = {
|
|
2316
2324
|
key: t.id,
|
|
@@ -2436,7 +2444,7 @@ class Ne {
|
|
|
2436
2444
|
loadSession(e) {
|
|
2437
2445
|
const t = x(), n = this.activeComposerWarmupId;
|
|
2438
2446
|
this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages);
|
|
2439
|
-
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 ?? []);
|
|
2440
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({
|
|
2441
2449
|
type: "session.reset",
|
|
2442
2450
|
warmupId: n,
|
|
@@ -2570,7 +2578,7 @@ class Ne {
|
|
|
2570
2578
|
});
|
|
2571
2579
|
if (!c.ok) {
|
|
2572
2580
|
const d = await c.text() || `History request failed (${c.status})`;
|
|
2573
|
-
throw
|
|
2581
|
+
throw Fn(c.status) ? new Error(d) : new Te(d);
|
|
2574
2582
|
}
|
|
2575
2583
|
const u = await c.json();
|
|
2576
2584
|
if (!u?.session || !Array.isArray(u.items))
|
|
@@ -2675,7 +2683,7 @@ class Ne {
|
|
|
2675
2683
|
clientMessageId: e,
|
|
2676
2684
|
durationMs: Date.now() - n
|
|
2677
2685
|
});
|
|
2678
|
-
}, Math.max(0,
|
|
2686
|
+
}, Math.max(0, Zn - (Date.now() - n)));
|
|
2679
2687
|
this.firstResponseTimersByClientMessageId.set(e, { submittedAt: n, timer: i });
|
|
2680
2688
|
}
|
|
2681
2689
|
clearFirstResponseTimer(e) {
|
|
@@ -2785,7 +2793,7 @@ class Ne {
|
|
|
2785
2793
|
if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
|
|
2786
2794
|
return;
|
|
2787
2795
|
this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
|
|
2788
|
-
const e =
|
|
2796
|
+
const e = $i();
|
|
2789
2797
|
this.sendNow(
|
|
2790
2798
|
L({
|
|
2791
2799
|
type: "starter_prompts.page_context",
|
|
@@ -2796,13 +2804,13 @@ class Ne {
|
|
|
2796
2804
|
) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
|
|
2797
2805
|
}
|
|
2798
2806
|
startStarterPromptUrlWatcher() {
|
|
2799
|
-
this.locationChangeCleanup || (this.locationChangeCleanup =
|
|
2807
|
+
this.locationChangeCleanup || (this.locationChangeCleanup = ji(() => this.handleStarterPromptUrlChange()));
|
|
2800
2808
|
}
|
|
2801
2809
|
handleStarterPromptUrlChange() {
|
|
2802
2810
|
const e = location.href;
|
|
2803
2811
|
e !== this.lastStarterPromptPageUrl && (this.activeComposerWarmupScope && !this.activeComposerWarmupScope.endsWith(`:${e}`) && this.clearPendingComposerWarmup(), this.lastStarterPromptPageUrl = e, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
|
|
2804
2812
|
this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
|
|
2805
|
-
},
|
|
2813
|
+
}, pi));
|
|
2806
2814
|
}
|
|
2807
2815
|
refreshStarterPromptsForCurrentUrl() {
|
|
2808
2816
|
this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
|
|
@@ -2832,7 +2840,7 @@ class Ne {
|
|
|
2832
2840
|
}
|
|
2833
2841
|
rememberSessionTimeline(e, t) {
|
|
2834
2842
|
const n = [...t];
|
|
2835
|
-
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; ) {
|
|
2836
2844
|
const i = this.sessionTimelineCache.keys().next().value;
|
|
2837
2845
|
if (!i)
|
|
2838
2846
|
break;
|
|
@@ -2862,8 +2870,8 @@ class Ne {
|
|
|
2862
2870
|
return;
|
|
2863
2871
|
this.clearPendingWarmupAckTimer();
|
|
2864
2872
|
const t = Math.min(
|
|
2865
|
-
|
|
2866
|
-
|
|
2873
|
+
Vn * 2 ** e.retryAttempt,
|
|
2874
|
+
Xn
|
|
2867
2875
|
);
|
|
2868
2876
|
e.retryAttempt += 1, this.pendingWarmupAckTimer = window.setTimeout(() => {
|
|
2869
2877
|
this.pendingWarmupAckTimer = null, this.flushPendingComposerWarmup();
|
|
@@ -2886,7 +2894,7 @@ class Ne {
|
|
|
2886
2894
|
const n = C(t);
|
|
2887
2895
|
if (!e || !n || !_e(n) || this.findStoppedTurn(e, n))
|
|
2888
2896
|
return;
|
|
2889
|
-
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;
|
|
2890
2898
|
this.stoppedTurns.push({
|
|
2891
2899
|
sessionId: e,
|
|
2892
2900
|
clientMessageId: o,
|
|
@@ -2907,7 +2915,7 @@ class Ne {
|
|
|
2907
2915
|
if (!e || !t)
|
|
2908
2916
|
return;
|
|
2909
2917
|
const n = this.findStoppedTurn(e, t);
|
|
2910
|
-
!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({
|
|
2911
2919
|
messages: this.state.messages.filter((i) => i.id !== n.stoppedItemId)
|
|
2912
2920
|
}));
|
|
2913
2921
|
}
|
|
@@ -2986,7 +2994,7 @@ class Ne {
|
|
|
2986
2994
|
}
|
|
2987
2995
|
}
|
|
2988
2996
|
if (!this.shouldIgnoreStoppedTurnEvent(e) && (this.updateInactiveSessionTimelineCache(e), !this.shouldIgnoreBackgroundSessionEvent(e))) {
|
|
2989
|
-
if (
|
|
2997
|
+
if (Ai(e) && this.clearFirstResponseTimer(this.activeClientMessageId), e.type === "run.steered") {
|
|
2990
2998
|
this.handleRunSteered(e);
|
|
2991
2999
|
return;
|
|
2992
3000
|
}
|
|
@@ -3001,16 +3009,16 @@ class Ne {
|
|
|
3001
3009
|
this.activeResponseRunId = t, this.setState({ turnPhase: "thinking", lastError: null }), this.markThinkingProgress();
|
|
3002
3010
|
return;
|
|
3003
3011
|
}
|
|
3004
|
-
if (
|
|
3012
|
+
if (wi(e) && this.markThinkingProgress(), e.type === "auth.ok") {
|
|
3005
3013
|
this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.transportDiagnosticEpisodes.clear();
|
|
3006
|
-
const t =
|
|
3014
|
+
const t = rr(e.user);
|
|
3007
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();
|
|
3008
|
-
const n =
|
|
3016
|
+
const n = er(e), i = Object.prototype.hasOwnProperty.call(e, "appearance");
|
|
3009
3017
|
b("web-sdk.agent", "Received auth.ok appearance", {
|
|
3010
3018
|
hasAppearance: i,
|
|
3011
3019
|
rawAppearance: e.appearance,
|
|
3012
3020
|
normalizedAppearance: n
|
|
3013
|
-
}), this.runtimeHelperJavascript =
|
|
3021
|
+
}), this.runtimeHelperJavascript = tr(e.runtimeHelpers)?.javascript ?? null;
|
|
3014
3022
|
const r = Vt(e, "starterPrompts"), o = Object.prototype.hasOwnProperty.call(e, "starterPrompts"), a = e.starterPromptsLoading === !0, l = {
|
|
3015
3023
|
user: t,
|
|
3016
3024
|
status: "connected",
|
|
@@ -3037,7 +3045,7 @@ class Ne {
|
|
|
3037
3045
|
}
|
|
3038
3046
|
if (e.type === "scheduled_follow_ups.updated") {
|
|
3039
3047
|
typeof e.sessionId == "string" && e.sessionId === this.state.sessionId && this.setState({
|
|
3040
|
-
activeScheduledFollowUps:
|
|
3048
|
+
activeScheduledFollowUps: Xt(
|
|
3041
3049
|
e.activeScheduledFollowUps
|
|
3042
3050
|
)
|
|
3043
3051
|
});
|
|
@@ -3061,7 +3069,7 @@ class Ne {
|
|
|
3061
3069
|
runId: u?.runId
|
|
3062
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;
|
|
3063
3071
|
f && h && (this.pendingClientMessageId = h);
|
|
3064
|
-
let m =
|
|
3072
|
+
let m = pr(
|
|
3065
3073
|
e.assistantDraft
|
|
3066
3074
|
);
|
|
3067
3075
|
m && this.findStoppedTurn(r, {
|
|
@@ -3070,9 +3078,9 @@ class Ne {
|
|
|
3070
3078
|
}) && (m = void 0);
|
|
3071
3079
|
const M = m !== void 0;
|
|
3072
3080
|
this.rememberUserMessageClientMessageIds(g);
|
|
3073
|
-
const w =
|
|
3081
|
+
const w = Er(g), D = g.filter((U) => {
|
|
3074
3082
|
const q = C(U);
|
|
3075
|
-
return
|
|
3083
|
+
return br(q) ? !1 : !q || !w || !pe(q) ? !0 : dt(g, q) !== w;
|
|
3076
3084
|
}), S = lt(
|
|
3077
3085
|
this.state.messages,
|
|
3078
3086
|
st(D, this.options.backendUrl)
|
|
@@ -3083,18 +3091,18 @@ class Ne {
|
|
|
3083
3091
|
v,
|
|
3084
3092
|
re,
|
|
3085
3093
|
Y,
|
|
3086
|
-
|
|
3094
|
+
kr(g, q)
|
|
3087
3095
|
)
|
|
3088
|
-
), ee = M ? m?.content ?? "" : this.state.assistantDraft, fe = !!m?.content && !Z, B = T && (!ee || Z), Q =
|
|
3089
|
-
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))
|
|
3090
3098
|
return;
|
|
3091
|
-
this.lastUserMessagePageUrl =
|
|
3099
|
+
this.lastUserMessagePageUrl = Mr(g);
|
|
3092
3100
|
const j = B || d ? null : ut(g);
|
|
3093
3101
|
if (this.latestRecoverableClientMessageId = j, Q && this.clearRetryTimers(), this.setState({
|
|
3094
3102
|
sessionId: A(e.session, "id") ?? this.state.sessionId,
|
|
3095
3103
|
messages: S,
|
|
3096
3104
|
...i ? {
|
|
3097
|
-
activeScheduledFollowUps:
|
|
3105
|
+
activeScheduledFollowUps: Xt(
|
|
3098
3106
|
e.activeScheduledFollowUps
|
|
3099
3107
|
)
|
|
3100
3108
|
} : {},
|
|
@@ -3161,14 +3169,14 @@ class Ne {
|
|
|
3161
3169
|
this.options.backendUrl
|
|
3162
3170
|
);
|
|
3163
3171
|
t === this.sessionActivityRequestId && (this.sessionActivityRequestId = null), this.setState({
|
|
3164
|
-
messages:
|
|
3172
|
+
messages: yr(this.state.messages, i)
|
|
3165
3173
|
});
|
|
3166
3174
|
return;
|
|
3167
3175
|
}
|
|
3168
3176
|
if (e.type === "sessions.page") {
|
|
3169
3177
|
const t = typeof e.requestId == "string" ? e.requestId : null, n = t ? this.pendingSessionHistoryRequests.get(t) : null;
|
|
3170
3178
|
t && n && (window.clearTimeout(n.timeout), this.pendingSessionHistoryRequests.delete(t), n.resolve({
|
|
3171
|
-
sessions:
|
|
3179
|
+
sessions: or(e.sessions),
|
|
3172
3180
|
nextCursor: typeof e.nextCursor == "string" ? e.nextCursor : null
|
|
3173
3181
|
}));
|
|
3174
3182
|
return;
|
|
@@ -3203,19 +3211,19 @@ class Ne {
|
|
|
3203
3211
|
}
|
|
3204
3212
|
const n = Ue(e.item, this.options.backendUrl);
|
|
3205
3213
|
if (n) {
|
|
3206
|
-
const i =
|
|
3207
|
-
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();
|
|
3208
3216
|
const o = de(this.state.messages, n), a = ss(o), l = ns(
|
|
3209
3217
|
t,
|
|
3210
3218
|
this.state.assistantDraft,
|
|
3211
3219
|
this.state.assistantDraftItemId,
|
|
3212
3220
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
3213
3221
|
this.state.assistantDraftRunId,
|
|
3214
|
-
|
|
3222
|
+
vs(
|
|
3215
3223
|
o,
|
|
3216
3224
|
o.findIndex((d) => d.id === n.id)
|
|
3217
3225
|
)
|
|
3218
|
-
), c = a && (!this.state.assistantDraft || l), u = De(n) && (c ||
|
|
3226
|
+
), c = a && (!this.state.assistantDraft || l), u = De(n) && (c || W(n) && !this.state.isThinking && this.activeClientMessageId === null);
|
|
3219
3227
|
this.setState({
|
|
3220
3228
|
messages: o,
|
|
3221
3229
|
...l ? {
|
|
@@ -3380,13 +3388,13 @@ class Ne {
|
|
|
3380
3388
|
return;
|
|
3381
3389
|
}
|
|
3382
3390
|
o && i && r && (this.retryableClientMessageId = r);
|
|
3383
|
-
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);
|
|
3384
3392
|
l && console.error(l);
|
|
3385
3393
|
const c = r ?? this.activeClientMessageId, u = typeof e.runId == "string" ? e.runId : null, d = rs(
|
|
3386
3394
|
this.state.messages,
|
|
3387
3395
|
c,
|
|
3388
3396
|
u
|
|
3389
|
-
), g =
|
|
3397
|
+
), g = wr(
|
|
3390
3398
|
d,
|
|
3391
3399
|
c,
|
|
3392
3400
|
u
|
|
@@ -3417,7 +3425,7 @@ class Ne {
|
|
|
3417
3425
|
}
|
|
3418
3426
|
applyAccountSubmissionError(e) {
|
|
3419
3427
|
if (!this.account || !e) return;
|
|
3420
|
-
const t =
|
|
3428
|
+
const t = bn(this.account.submissionGate, e);
|
|
3421
3429
|
if (!(t === this.account.submissionGate || t.allowed)) {
|
|
3422
3430
|
this.account = {
|
|
3423
3431
|
...this.account,
|
|
@@ -3433,7 +3441,7 @@ class Ne {
|
|
|
3433
3441
|
this.options.model = Ve(n) ? n : "gpt-5.6-sol";
|
|
3434
3442
|
}
|
|
3435
3443
|
updateAccountFallbackFromSession(e) {
|
|
3436
|
-
const t = e && typeof e == "object" ? e.metadata : null, n =
|
|
3444
|
+
const t = e && typeof e == "object" ? e.metadata : null, n = Rn(t);
|
|
3437
3445
|
if (this.usingPaidCreditFallback !== n && (this.usingPaidCreditFallback = n, !!this.account)) {
|
|
3438
3446
|
this.account = { ...this.account, usingPaidCreditFallback: n };
|
|
3439
3447
|
for (const i of this.accountListeners) i(this.getAccount());
|
|
@@ -3553,7 +3561,7 @@ class Ne {
|
|
|
3553
3561
|
}
|
|
3554
3562
|
e.type === "error" && typeof e.requestId != "string" && !is(e, t) && this.rememberSessionTimeline(
|
|
3555
3563
|
t,
|
|
3556
|
-
|
|
3564
|
+
Ur(n, e)
|
|
3557
3565
|
);
|
|
3558
3566
|
}
|
|
3559
3567
|
}
|
|
@@ -3651,7 +3659,7 @@ class Ne {
|
|
|
3651
3659
|
e.clear();
|
|
3652
3660
|
}
|
|
3653
3661
|
markThinkingProgress() {
|
|
3654
|
-
!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));
|
|
3655
3663
|
}
|
|
3656
3664
|
scheduleThinkingWatchdog(e) {
|
|
3657
3665
|
this.thinkingWatchdogTimer !== null && window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = window.setTimeout(() => {
|
|
@@ -3715,13 +3723,13 @@ class Ne {
|
|
|
3715
3723
|
if (this.state.status === "closed" || this.pendingClientMessageId !== e || !this.pendingUserMessageEvent)
|
|
3716
3724
|
return;
|
|
3717
3725
|
const t = this.retryAttemptsByClientMessageId[e] ?? 0;
|
|
3718
|
-
if (t >=
|
|
3726
|
+
if (t >= ei) {
|
|
3719
3727
|
this.failPendingDelivery(e);
|
|
3720
3728
|
return;
|
|
3721
3729
|
}
|
|
3722
3730
|
t === 0 && this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.retryAttemptsByClientMessageId[e] = t + 1, this.setState({ pendingMessageStatus: "reconnecting" }), this.pendingDeliveryRetryTimer = window.setTimeout(() => {
|
|
3723
3731
|
this.pendingDeliveryRetryTimer = null, !(this.pendingClientMessageId !== e || !this.pendingUserMessageEvent) && (this.send(this.pendingUserMessageEvent), this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(e));
|
|
3724
|
-
},
|
|
3732
|
+
}, gi(t, ii));
|
|
3725
3733
|
}
|
|
3726
3734
|
failPendingDelivery(e) {
|
|
3727
3735
|
if (this.pendingClientMessageId !== e)
|
|
@@ -3734,7 +3742,7 @@ class Ne {
|
|
|
3734
3742
|
...this.state.isThinking ? {} : { turnPhase: null },
|
|
3735
3743
|
isRetrying: !1,
|
|
3736
3744
|
...this.state.isThinking ? {} : { taskStatus: "failed" },
|
|
3737
|
-
lastError:
|
|
3745
|
+
lastError: si,
|
|
3738
3746
|
lastErrorCode: "message_delivery_failed"
|
|
3739
3747
|
});
|
|
3740
3748
|
}
|
|
@@ -3778,7 +3786,7 @@ class Ne {
|
|
|
3778
3786
|
!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== e || (b("web-sdk.agent", "Pluno run ack missed; resyncing session", {
|
|
3779
3787
|
sessionId: this.state.sessionId,
|
|
3780
3788
|
clientMessageId: e
|
|
3781
|
-
}), this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(
|
|
3789
|
+
}), this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(Wt));
|
|
3782
3790
|
}
|
|
3783
3791
|
clearRunAckResyncRetryTimer() {
|
|
3784
3792
|
this.runAckResyncRetryTimer !== null && (window.clearTimeout(this.runAckResyncRetryTimer), this.runAckResyncRetryTimer = null);
|
|
@@ -3801,7 +3809,7 @@ class Ne {
|
|
|
3801
3809
|
),
|
|
3802
3810
|
isThinking: !1,
|
|
3803
3811
|
taskStatus: "failed",
|
|
3804
|
-
lastError:
|
|
3812
|
+
lastError: ti,
|
|
3805
3813
|
lastErrorCode: "run_recovery_exhausted"
|
|
3806
3814
|
}), this.clearThinkingWatchdog();
|
|
3807
3815
|
return;
|
|
@@ -3811,7 +3819,7 @@ class Ne {
|
|
|
3811
3819
|
sessionId: this.state.sessionId,
|
|
3812
3820
|
clientMessageId: e,
|
|
3813
3821
|
resyncAttempts: t + 1
|
|
3814
|
-
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(
|
|
3822
|
+
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(Wt);
|
|
3815
3823
|
}
|
|
3816
3824
|
resyncThinkingSession() {
|
|
3817
3825
|
this.state.sessionId ? this.send({
|
|
@@ -3828,7 +3836,7 @@ class Ne {
|
|
|
3828
3836
|
if (!t || !n || !i)
|
|
3829
3837
|
return;
|
|
3830
3838
|
const a = i === "execute_code", l = i === "execute_code_in_browser_tab" && o !== null && typeof o == "object" && o.tabId === "local:current";
|
|
3831
|
-
if (!a && !l || !
|
|
3839
|
+
if (!a && !l || !so(o)) {
|
|
3832
3840
|
this.setToolMessageLoading(n, !1), this.send({
|
|
3833
3841
|
type: "tool.result",
|
|
3834
3842
|
sessionId: t,
|
|
@@ -3877,7 +3885,7 @@ class Ne {
|
|
|
3877
3885
|
let c = null, u;
|
|
3878
3886
|
c = await this.executeRuntimeHelper(), u = await Gt(
|
|
3879
3887
|
o,
|
|
3880
|
-
|
|
3888
|
+
xi(e.runtimeContext, this.options.backendUrl)
|
|
3881
3889
|
).catch((d) => ({
|
|
3882
3890
|
ok: !1,
|
|
3883
3891
|
exception: {
|
|
@@ -3890,7 +3898,7 @@ class Ne {
|
|
|
3890
3898
|
toolName: i,
|
|
3891
3899
|
summary: o.summary,
|
|
3892
3900
|
rawInput: L(o),
|
|
3893
|
-
rawOutput: L(
|
|
3901
|
+
rawOutput: L(sr(u, c))
|
|
3894
3902
|
}), ls(this.options.clientId, this.activeBrowserToolCalls.values()));
|
|
3895
3903
|
}
|
|
3896
3904
|
setToolMessageLoading(e, t) {
|
|
@@ -3905,17 +3913,17 @@ class Ne {
|
|
|
3905
3913
|
if (this.pageLifecycleCleanup)
|
|
3906
3914
|
return;
|
|
3907
3915
|
const e = () => {
|
|
3908
|
-
|
|
3916
|
+
Ds(this.options.clientId, this.activeBrowserToolCalls.values());
|
|
3909
3917
|
};
|
|
3910
3918
|
window.addEventListener("pagehide", e), window.addEventListener("beforeunload", e), this.pageLifecycleCleanup = () => {
|
|
3911
3919
|
window.removeEventListener("pagehide", e), window.removeEventListener("beforeunload", e);
|
|
3912
3920
|
};
|
|
3913
3921
|
}
|
|
3914
3922
|
installSessionBrowserApis() {
|
|
3915
|
-
this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup =
|
|
3923
|
+
this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = Ei();
|
|
3916
3924
|
}
|
|
3917
3925
|
cleanupSessionBrowserApis() {
|
|
3918
|
-
this.sessionBrowserApisCleanup && (
|
|
3926
|
+
this.sessionBrowserApisCleanup && (qi(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
|
|
3919
3927
|
}
|
|
3920
3928
|
async executeRuntimeHelper() {
|
|
3921
3929
|
if (!this.runtimeHelperJavascript?.trim())
|
|
@@ -3923,15 +3931,15 @@ class Ne {
|
|
|
3923
3931
|
const e = await Gt({
|
|
3924
3932
|
javascript: this.runtimeHelperJavascript
|
|
3925
3933
|
});
|
|
3926
|
-
return e.ok === !1 ?
|
|
3934
|
+
return e.ok === !1 ? nr(e) : null;
|
|
3927
3935
|
}
|
|
3928
3936
|
enableNetworkCapture() {
|
|
3929
|
-
this.networkCaptureCleanup || (this.networkCaptureCleanup =
|
|
3930
|
-
|
|
3937
|
+
this.networkCaptureCleanup || (this.networkCaptureCleanup = Si((e) => {
|
|
3938
|
+
lo(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
|
|
3931
3939
|
}));
|
|
3932
3940
|
}
|
|
3933
3941
|
enqueueNetworkEvent(e) {
|
|
3934
|
-
this.queuedNetworkEvents.length >=
|
|
3942
|
+
this.queuedNetworkEvents.length >= oi || (this.queuedNetworkEvents.push(ao(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
|
|
3935
3943
|
this.networkBatchTimer = null;
|
|
3936
3944
|
const t = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
|
|
3937
3945
|
t.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
|
|
@@ -3940,14 +3948,14 @@ class Ne {
|
|
|
3940
3948
|
page: _(),
|
|
3941
3949
|
events: t
|
|
3942
3950
|
});
|
|
3943
|
-
},
|
|
3951
|
+
}, ri)));
|
|
3944
3952
|
}
|
|
3945
3953
|
scheduleReconnect(e = 0) {
|
|
3946
3954
|
if (this.reconnectTimer !== null || this.state.status === "closed")
|
|
3947
3955
|
return;
|
|
3948
3956
|
const t = Math.min(
|
|
3949
3957
|
ot,
|
|
3950
|
-
Math.max(
|
|
3958
|
+
Math.max(fi(this.reconnectAttempts), e)
|
|
3951
3959
|
);
|
|
3952
3960
|
this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
|
|
3953
3961
|
this.reconnectTimer = null, this.connect().catch((n) => {
|
|
@@ -3964,8 +3972,8 @@ class Ne {
|
|
|
3964
3972
|
const e = this.socket;
|
|
3965
3973
|
!e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
|
|
3966
3974
|
this.socket === e && (b("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
|
|
3967
|
-
},
|
|
3968
|
-
},
|
|
3975
|
+
}, jn));
|
|
3976
|
+
}, $n);
|
|
3969
3977
|
}
|
|
3970
3978
|
stopHeartbeat() {
|
|
3971
3979
|
this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
|
|
@@ -4003,12 +4011,12 @@ class Ne {
|
|
|
4003
4011
|
...e.lastError === null && e.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
|
|
4004
4012
|
...e.lastError !== void 0 && e.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
|
|
4005
4013
|
}, a = this.state.sessionId, l = this.state.isThinking || this.state.pendingMessageStatus !== null, c = o.isThinking || o.pendingMessageStatus !== null, u = this.activeClientMessageId ?? this.pendingClientMessageId;
|
|
4006
|
-
u && u === this.lastProjectedTurnClientMessageId && c &&
|
|
4014
|
+
u && u === this.lastProjectedTurnClientMessageId && c && Mi(this.lastProjectedTurnPhase, o.turnPhase) && this.reportHealthSignal("invalid_state_transition", {
|
|
4007
4015
|
clientMessageId: u,
|
|
4008
4016
|
reason: "active_turn_phase_moved_backward",
|
|
4009
4017
|
previousPhase: this.lastProjectedTurnPhase,
|
|
4010
4018
|
nextPhase: o.turnPhase
|
|
4011
|
-
}), 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, {
|
|
4012
4020
|
status: this.state.status,
|
|
4013
4021
|
sessionId: this.state.sessionId,
|
|
4014
4022
|
messageCount: this.state.messages.length,
|
|
@@ -4067,13 +4075,13 @@ class Ne {
|
|
|
4067
4075
|
}
|
|
4068
4076
|
}
|
|
4069
4077
|
const Ze = /* @__PURE__ */ new WeakMap();
|
|
4070
|
-
function
|
|
4071
|
-
const e = window.__plunoProductAgentNetworkCapture ??
|
|
4078
|
+
function Si(s) {
|
|
4079
|
+
const e = window.__plunoProductAgentNetworkCapture ?? Ti();
|
|
4072
4080
|
return e.subscribers.add(s), () => {
|
|
4073
4081
|
e.subscribers.delete(s), !(e.subscribers.size > 0) && (e.destroy(), window.__plunoProductAgentNetworkCapture === e && delete window.__plunoProductAgentNetworkCapture);
|
|
4074
4082
|
};
|
|
4075
4083
|
}
|
|
4076
|
-
function
|
|
4084
|
+
function Ti() {
|
|
4077
4085
|
const s = /* @__PURE__ */ new Set(), e = (g) => {
|
|
4078
4086
|
s.forEach((f) => {
|
|
4079
4087
|
try {
|
|
@@ -4090,11 +4098,11 @@ function yi() {
|
|
|
4090
4098
|
throw m;
|
|
4091
4099
|
}
|
|
4092
4100
|
try {
|
|
4093
|
-
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);
|
|
4094
4102
|
if (!te(M, w, h?.body)) {
|
|
4095
4103
|
const H = {
|
|
4096
4104
|
requestId: nt("fetch"),
|
|
4097
|
-
url:
|
|
4105
|
+
url: F(M, Ye),
|
|
4098
4106
|
method: (h?.method ?? m?.method ?? "GET").toUpperCase(),
|
|
4099
4107
|
requestHeaders: w,
|
|
4100
4108
|
requestBody: us(h?.body),
|
|
@@ -4103,7 +4111,7 @@ function yi() {
|
|
|
4103
4111
|
};
|
|
4104
4112
|
y.then(
|
|
4105
4113
|
(S) => {
|
|
4106
|
-
|
|
4114
|
+
io(S, H, p, e).catch(() => {
|
|
4107
4115
|
e({
|
|
4108
4116
|
...H,
|
|
4109
4117
|
responseStatus: S.status,
|
|
@@ -4114,7 +4122,7 @@ function yi() {
|
|
|
4114
4122
|
(S) => {
|
|
4115
4123
|
e({
|
|
4116
4124
|
...H,
|
|
4117
|
-
errorText:
|
|
4125
|
+
errorText: F(S instanceof Error ? S.message : String(S)),
|
|
4118
4126
|
durationMs: Date.now() - p
|
|
4119
4127
|
});
|
|
4120
4128
|
}
|
|
@@ -4128,7 +4136,7 @@ function yi() {
|
|
|
4128
4136
|
return Ze.set(this, {
|
|
4129
4137
|
requestId: nt("xhr"),
|
|
4130
4138
|
method: String(f ?? "GET").toUpperCase(),
|
|
4131
|
-
url:
|
|
4139
|
+
url: F(w, Ye),
|
|
4132
4140
|
requestHeaders: {},
|
|
4133
4141
|
startedAtMs: Date.now(),
|
|
4134
4142
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -4145,7 +4153,7 @@ function yi() {
|
|
|
4145
4153
|
() => {
|
|
4146
4154
|
queueMicrotask(() => {
|
|
4147
4155
|
try {
|
|
4148
|
-
const p =
|
|
4156
|
+
const p = uo(this.getAllResponseHeaders());
|
|
4149
4157
|
e({
|
|
4150
4158
|
requestId: h.requestId,
|
|
4151
4159
|
url: h.url,
|
|
@@ -4155,7 +4163,7 @@ function yi() {
|
|
|
4155
4163
|
resourceType: "xhr",
|
|
4156
4164
|
responseStatus: this.status,
|
|
4157
4165
|
responseHeaders: p,
|
|
4158
|
-
responseBody:
|
|
4166
|
+
responseBody: oo(this, p),
|
|
4159
4167
|
errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
|
|
4160
4168
|
startedAt: h.startedAt,
|
|
4161
4169
|
durationMs: Date.now() - h.startedAtMs
|
|
@@ -4197,7 +4205,7 @@ function yi() {
|
|
|
4197
4205
|
const p = performance.timeOrigin + h.startTime;
|
|
4198
4206
|
e({
|
|
4199
4207
|
requestId: nt("resource"),
|
|
4200
|
-
url:
|
|
4208
|
+
url: F(h.name, Ye),
|
|
4201
4209
|
method: "GET",
|
|
4202
4210
|
resourceType: "resource",
|
|
4203
4211
|
responseStatus: h.responseStatus,
|
|
@@ -4251,10 +4259,10 @@ function Kt(s) {
|
|
|
4251
4259
|
const e = typeof s == "function" ? s() : s;
|
|
4252
4260
|
return e && Object.keys(e).length > 0 ? e : void 0;
|
|
4253
4261
|
}
|
|
4254
|
-
function
|
|
4262
|
+
function wi(s) {
|
|
4255
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";
|
|
4256
4264
|
}
|
|
4257
|
-
function
|
|
4265
|
+
function Ai(s) {
|
|
4258
4266
|
if (s.type === "chat.assistant_delta")
|
|
4259
4267
|
return typeof s.delta == "string" && s.delta.trim().length > 0;
|
|
4260
4268
|
if (s.type === "tool.call")
|
|
@@ -4264,7 +4272,7 @@ function Si(s) {
|
|
|
4264
4272
|
const e = C(s.item);
|
|
4265
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;
|
|
4266
4274
|
}
|
|
4267
|
-
function
|
|
4275
|
+
function Mi(s, e) {
|
|
4268
4276
|
if (!s || !e)
|
|
4269
4277
|
return !1;
|
|
4270
4278
|
const t = {
|
|
@@ -4292,31 +4300,31 @@ function K(s) {
|
|
|
4292
4300
|
}
|
|
4293
4301
|
return null;
|
|
4294
4302
|
}
|
|
4295
|
-
const
|
|
4296
|
-
function
|
|
4303
|
+
const bi = 5e3, Ri = 12e4;
|
|
4304
|
+
function Ei() {
|
|
4297
4305
|
const s = [
|
|
4298
|
-
|
|
4299
|
-
|
|
4306
|
+
Ci(),
|
|
4307
|
+
ki()
|
|
4300
4308
|
].filter((e) => typeof e == "function");
|
|
4301
4309
|
return () => {
|
|
4302
4310
|
for (const e of s.reverse())
|
|
4303
4311
|
e();
|
|
4304
4312
|
};
|
|
4305
4313
|
}
|
|
4306
|
-
function
|
|
4307
|
-
return
|
|
4314
|
+
function ki() {
|
|
4315
|
+
return ps(globalThis, "getPageSnapshot", async () => At());
|
|
4308
4316
|
}
|
|
4309
|
-
function
|
|
4310
|
-
return
|
|
4311
|
-
inspectImage: async (e, t) => await
|
|
4317
|
+
function Ci() {
|
|
4318
|
+
return ps(globalThis, "pageImages", {
|
|
4319
|
+
inspectImage: async (e, t) => await _i(e, t)
|
|
4312
4320
|
});
|
|
4313
4321
|
}
|
|
4314
|
-
async function
|
|
4315
|
-
const t =
|
|
4322
|
+
async function _i(s, e = {}) {
|
|
4323
|
+
const t = Di(e.name), n = await Pi(s);
|
|
4316
4324
|
return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
|
|
4317
4325
|
type: "pluno.pageImages.inspectImage",
|
|
4318
4326
|
imageAttached: !1,
|
|
4319
|
-
imageAttachmentError:
|
|
4327
|
+
imageAttachmentError: As
|
|
4320
4328
|
} : {
|
|
4321
4329
|
type: "pluno.pageImages.inspectImage",
|
|
4322
4330
|
imageAttached: !0,
|
|
@@ -4330,15 +4338,15 @@ async function ki(s, e = {}) {
|
|
|
4330
4338
|
imageAttachmentError: n.error
|
|
4331
4339
|
};
|
|
4332
4340
|
}
|
|
4333
|
-
async function
|
|
4334
|
-
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 } : {
|
|
4335
4343
|
ok: !0,
|
|
4336
4344
|
mimeType: s.type,
|
|
4337
4345
|
sizeBytes: s.size,
|
|
4338
|
-
dataUrl: await
|
|
4339
|
-
} : { 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);
|
|
4340
4348
|
}
|
|
4341
|
-
function
|
|
4349
|
+
function vi(s) {
|
|
4342
4350
|
if (!s.startsWith("data:") || !s.includes(","))
|
|
4343
4351
|
return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
|
|
4344
4352
|
const [e, t] = s.slice(5).split(",", 2), n = e.split(";").map((a) => a.trim()).filter(Boolean), i = n[0] ?? "";
|
|
@@ -4349,7 +4357,7 @@ function Ci(s) {
|
|
|
4349
4357
|
const r = t.replace(/[ \t\r\n\f]+/g, "");
|
|
4350
4358
|
if (!/^[A-Za-z0-9+/]*={0,2}$/.test(r))
|
|
4351
4359
|
return { ok: !1, error: "Page image data URL has invalid base64." };
|
|
4352
|
-
const o =
|
|
4360
|
+
const o = Ui(r);
|
|
4353
4361
|
return o === null ? { ok: !1, error: "Page image data URL has invalid base64." } : o === 0 ? { ok: !1, error: "Page image is empty." } : {
|
|
4354
4362
|
ok: !0,
|
|
4355
4363
|
mimeType: i,
|
|
@@ -4357,22 +4365,22 @@ function Ci(s) {
|
|
|
4357
4365
|
dataUrl: `data:${i};base64,${r}`
|
|
4358
4366
|
};
|
|
4359
4367
|
}
|
|
4360
|
-
function
|
|
4368
|
+
function Ui(s) {
|
|
4361
4369
|
if (s.length === 0 || s.length % 4 !== 0)
|
|
4362
4370
|
return null;
|
|
4363
4371
|
const e = s.length - s.replace(/=+$/, "").length;
|
|
4364
4372
|
return e > 2 ? null : s.length / 4 * 3 - e;
|
|
4365
4373
|
}
|
|
4366
|
-
function
|
|
4374
|
+
function Di(s) {
|
|
4367
4375
|
return (typeof s == "string" ? s.trim() : "") || "Page image";
|
|
4368
4376
|
}
|
|
4369
|
-
function
|
|
4377
|
+
function qi(s) {
|
|
4370
4378
|
try {
|
|
4371
4379
|
s();
|
|
4372
4380
|
} catch {
|
|
4373
4381
|
}
|
|
4374
4382
|
}
|
|
4375
|
-
function
|
|
4383
|
+
function Oi(s) {
|
|
4376
4384
|
return new Promise((e, t) => {
|
|
4377
4385
|
const n = new FileReader();
|
|
4378
4386
|
n.onload = () => {
|
|
@@ -4386,7 +4394,7 @@ function Ui(s) {
|
|
|
4386
4394
|
}
|
|
4387
4395
|
async function Gt(s, e) {
|
|
4388
4396
|
const t = Object.getPrototypeOf(async function() {
|
|
4389
|
-
}).constructor, n = s.timeoutMs ??
|
|
4397
|
+
}).constructor, n = s.timeoutMs ?? bi, i = Date.now(), r = [];
|
|
4390
4398
|
let o;
|
|
4391
4399
|
const a = {
|
|
4392
4400
|
log: console.log,
|
|
@@ -4404,7 +4412,7 @@ async function Gt(s, e) {
|
|
|
4404
4412
|
o = window.setTimeout(() => d(c), n);
|
|
4405
4413
|
})
|
|
4406
4414
|
]);
|
|
4407
|
-
return u === c ?
|
|
4415
|
+
return u === c ? Li(n) : {
|
|
4408
4416
|
ok: !0,
|
|
4409
4417
|
result: u,
|
|
4410
4418
|
console: r,
|
|
@@ -4433,7 +4441,7 @@ async function Gt(s, e) {
|
|
|
4433
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;
|
|
4434
4442
|
}
|
|
4435
4443
|
}
|
|
4436
|
-
function
|
|
4444
|
+
function xi(s, e) {
|
|
4437
4445
|
if (!s || typeof s != "object")
|
|
4438
4446
|
return;
|
|
4439
4447
|
const t = s.sandboxFilesToken;
|
|
@@ -4443,7 +4451,7 @@ function Di(s, e) {
|
|
|
4443
4451
|
const i = () => {
|
|
4444
4452
|
if (!n)
|
|
4445
4453
|
throw new Error("sandboxFiles is only available during browser-code execution");
|
|
4446
|
-
}, r = async (a, l) => await
|
|
4454
|
+
}, r = async (a, l) => await qn(`${e.replace(/\/$/, "")}${a}`, l);
|
|
4447
4455
|
return {
|
|
4448
4456
|
value: Object.freeze({
|
|
4449
4457
|
upload: async (a) => {
|
|
@@ -4477,7 +4485,7 @@ function Di(s, e) {
|
|
|
4477
4485
|
}
|
|
4478
4486
|
};
|
|
4479
4487
|
}
|
|
4480
|
-
function
|
|
4488
|
+
function Li(s) {
|
|
4481
4489
|
return {
|
|
4482
4490
|
ok: !1,
|
|
4483
4491
|
exception: {
|
|
@@ -4491,10 +4499,10 @@ function qi(s) {
|
|
|
4491
4499
|
}
|
|
4492
4500
|
};
|
|
4493
4501
|
}
|
|
4494
|
-
function
|
|
4502
|
+
function Ni(s) {
|
|
4495
4503
|
return s.replace(/\/+$/, "");
|
|
4496
4504
|
}
|
|
4497
|
-
function
|
|
4505
|
+
function Hi(s) {
|
|
4498
4506
|
const e = {
|
|
4499
4507
|
sidepanel: "extension_sidepanel",
|
|
4500
4508
|
browser_extension_page_ui: "extension_widget",
|
|
@@ -4506,13 +4514,13 @@ function xi(s) {
|
|
|
4506
4514
|
};
|
|
4507
4515
|
return s && s in e ? e[s] : s ?? "embedded_custom_ui";
|
|
4508
4516
|
}
|
|
4509
|
-
function
|
|
4517
|
+
function Bi(s) {
|
|
4510
4518
|
return s === "pluno" ? "scheduled_continuation" : s ?? "user";
|
|
4511
4519
|
}
|
|
4512
|
-
function
|
|
4520
|
+
function Fi(s, e = location.origin) {
|
|
4513
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;
|
|
4514
4522
|
}
|
|
4515
|
-
function
|
|
4523
|
+
function Wi(s) {
|
|
4516
4524
|
const e = new URL("/api/product-agent/embed/ws", s);
|
|
4517
4525
|
return e.protocol = e.protocol === "https:" ? "wss:" : "ws:", e.toString();
|
|
4518
4526
|
}
|
|
@@ -4525,19 +4533,19 @@ function _() {
|
|
|
4525
4533
|
...s ? { plunoProductAgentUi: s } : {}
|
|
4526
4534
|
};
|
|
4527
4535
|
}
|
|
4528
|
-
function
|
|
4536
|
+
function $i() {
|
|
4529
4537
|
return {
|
|
4530
4538
|
pageUrl: location.href,
|
|
4531
4539
|
pageTitle: document.title,
|
|
4532
4540
|
htmlContent: At()
|
|
4533
4541
|
};
|
|
4534
4542
|
}
|
|
4535
|
-
function
|
|
4536
|
-
return Ce.add(s), we || (we =
|
|
4543
|
+
function ji(s) {
|
|
4544
|
+
return Ce.add(s), we || (we = zi()), () => {
|
|
4537
4545
|
Ce.delete(s), Ce.size === 0 && (we?.(), we = null);
|
|
4538
4546
|
};
|
|
4539
4547
|
}
|
|
4540
|
-
function
|
|
4548
|
+
function zi() {
|
|
4541
4549
|
const s = () => {
|
|
4542
4550
|
for (const r of Array.from(Ce))
|
|
4543
4551
|
r();
|
|
@@ -4564,16 +4572,16 @@ function At() {
|
|
|
4564
4572
|
};
|
|
4565
4573
|
t("Selected text", window.getSelection()?.toString() ?? "");
|
|
4566
4574
|
const n = "[role='dialog'], [role='alertdialog'], dialog[open], [aria-modal='true']", i = Array.from(document.querySelectorAll(n)).filter(
|
|
4567
|
-
(p) =>
|
|
4575
|
+
(p) => bs(p) && !p.parentElement?.closest(n)
|
|
4568
4576
|
);
|
|
4569
4577
|
for (const p of i.slice(0, 3))
|
|
4570
4578
|
t("Active overlay", tt(he(p), e));
|
|
4571
|
-
const r =
|
|
4579
|
+
const r = Ki(), o = r ? tt(he(r), e) : "";
|
|
4572
4580
|
t("Main page content", o), t("Additional visible page text", tt(he(document.body), e));
|
|
4573
4581
|
const a = s.map(([p, y]) => `${p}:
|
|
4574
4582
|
${y}`).join(`
|
|
4575
4583
|
|
|
4576
|
-
`).trim().slice(0, 12e3), l =
|
|
4584
|
+
`).trim().slice(0, 12e3), l = Gi(i, r).trim(), c = `Simplified DOM outline:
|
|
4577
4585
|
`, u = `
|
|
4578
4586
|
|
|
4579
4587
|
Visible page text:
|
|
@@ -4597,14 +4605,14 @@ function tt(s, e) {
|
|
|
4597
4605
|
t = t.replace(n, "");
|
|
4598
4606
|
return ne(t);
|
|
4599
4607
|
}
|
|
4600
|
-
function
|
|
4608
|
+
function bs(s) {
|
|
4601
4609
|
const e = window.getComputedStyle(s);
|
|
4602
4610
|
return e.display !== "none" && e.visibility !== "hidden" && s.getClientRects().length > 0;
|
|
4603
4611
|
}
|
|
4604
|
-
function
|
|
4605
|
-
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;
|
|
4606
4614
|
}
|
|
4607
|
-
function
|
|
4615
|
+
function Gi(s, e) {
|
|
4608
4616
|
const t = /* @__PURE__ */ new Set([
|
|
4609
4617
|
"main",
|
|
4610
4618
|
"nav",
|
|
@@ -4684,7 +4692,7 @@ function ji(s, e) {
|
|
|
4684
4692
|
"data-test",
|
|
4685
4693
|
"data-qa",
|
|
4686
4694
|
"data-cy"
|
|
4687
|
-
], 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);
|
|
4688
4696
|
e && g.add(e);
|
|
4689
4697
|
let f = 0;
|
|
4690
4698
|
const h = (w) => {
|
|
@@ -4699,7 +4707,7 @@ function ji(s, e) {
|
|
|
4699
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")
|
|
4700
4708
|
return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
|
|
4701
4709
|
f += 1;
|
|
4702
|
-
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();
|
|
4703
4711
|
for (const I of B) {
|
|
4704
4712
|
const R = p(I);
|
|
4705
4713
|
Q.set(R, (Q.get(R) ?? 0) + 1);
|
|
@@ -4709,7 +4717,7 @@ function ji(s, e) {
|
|
|
4709
4717
|
const R = p(I), z = oe.get(R) ?? 0;
|
|
4710
4718
|
oe.set(R, z + 1), (Q.get(R) ?? 0) > 8 && z >= 6 && !u.has(I) && me.set(R, (me.get(R) ?? 0) + 1);
|
|
4711
4719
|
}
|
|
4712
|
-
const j = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Set(), q = [],
|
|
4720
|
+
const j = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Set(), q = [], Et = [];
|
|
4713
4721
|
for (const I of B) {
|
|
4714
4722
|
const R = p(I), z = Q.get(R) ?? 0, _t = j.get(R) ?? 0;
|
|
4715
4723
|
if (j.set(R, _t + 1), z > 8 && _t >= 6 && !u.has(I)) {
|
|
@@ -4717,22 +4725,22 @@ function ji(s, e) {
|
|
|
4717
4725
|
continue;
|
|
4718
4726
|
}
|
|
4719
4727
|
const Pt = S(I, N);
|
|
4720
|
-
|
|
4728
|
+
Et.push(Pt), q.push(Pt.lines);
|
|
4721
4729
|
}
|
|
4722
|
-
const
|
|
4730
|
+
const Fe = [];
|
|
4723
4731
|
if (T.shadowRoot)
|
|
4724
4732
|
for (const I of Array.from(T.shadowRoot.children))
|
|
4725
|
-
I instanceof HTMLElement &&
|
|
4726
|
-
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(
|
|
4727
4735
|
[ee, ...ye.map((I) => I.textPreview)].filter(Boolean).join(" ")
|
|
4728
|
-
).slice(0, 180),
|
|
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 = [];
|
|
4729
4737
|
if ($e) {
|
|
4730
|
-
const I = ye.some((z) => z.containsTextElement), R = n.has(v) && !I ?
|
|
4731
|
-
ae.push(
|
|
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)));
|
|
4732
4740
|
}
|
|
4733
4741
|
for (const I of q)
|
|
4734
4742
|
ae.push(...Ae(I, je));
|
|
4735
|
-
const ze =
|
|
4743
|
+
const ze = Fe.flatMap((I) => I.lines);
|
|
4736
4744
|
if (ze.length > 0) {
|
|
4737
4745
|
const I = ze.slice(0, 20);
|
|
4738
4746
|
ze.length > I.length && I.push("… shadow DOM omitted");
|
|
@@ -4745,8 +4753,8 @@ function ji(s, e) {
|
|
|
4745
4753
|
}
|
|
4746
4754
|
return {
|
|
4747
4755
|
lines: ae,
|
|
4748
|
-
hasUsefulContent:
|
|
4749
|
-
textPreview:
|
|
4756
|
+
hasUsefulContent: We,
|
|
4757
|
+
textPreview: kt,
|
|
4750
4758
|
containsTextElement: n.has(v) || ye.some((I) => I.containsTextElement)
|
|
4751
4759
|
};
|
|
4752
4760
|
};
|
|
@@ -4754,7 +4762,7 @@ function ji(s, e) {
|
|
|
4754
4762
|
`);
|
|
4755
4763
|
}, m = [], M = ne(window.getSelection()?.toString() ?? "");
|
|
4756
4764
|
M && m.push(`--- selected text ---
|
|
4757
|
-
${JSON.stringify(M)}`), d.length > 0 && m.push(
|
|
4765
|
+
${JSON.stringify(M)}`), d.length > 0 && m.push(Vi(d, t, l, o));
|
|
4758
4766
|
for (const w of s.slice(0, 3))
|
|
4759
4767
|
m.push(y(w, "active overlay DOM", /* @__PURE__ */ new Set()));
|
|
4760
4768
|
if (e && m.push(y(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
|
|
@@ -4765,11 +4773,11 @@ ${JSON.stringify(M)}`), d.length > 0 && m.push(Ki(d, t, l, o));
|
|
|
4765
4773
|
|
|
4766
4774
|
`);
|
|
4767
4775
|
}
|
|
4768
|
-
function
|
|
4776
|
+
function Rs(s, e, t, n) {
|
|
4769
4777
|
const i = s.tagName.toLowerCase();
|
|
4770
4778
|
let r = i;
|
|
4771
4779
|
const o = s.getAttribute("id");
|
|
4772
|
-
o &&
|
|
4780
|
+
o && Xi(o) && (r += `#${o}`);
|
|
4773
4781
|
for (const a of e) {
|
|
4774
4782
|
const l = s.getAttribute(a);
|
|
4775
4783
|
l && l.length <= 160 && (a !== "role" || !t.has(l)) && (r += `[${a}=${JSON.stringify(l)}]`);
|
|
@@ -4782,7 +4790,7 @@ function bs(s, e, t, n) {
|
|
|
4782
4790
|
s.hasAttribute(a) && (r += `[${a}]`);
|
|
4783
4791
|
return `${r}${n ? ` ${JSON.stringify(n)}` : ""}`;
|
|
4784
4792
|
}
|
|
4785
|
-
function
|
|
4793
|
+
function Qi() {
|
|
4786
4794
|
const s = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), t = (a, l) => {
|
|
4787
4795
|
if (!a)
|
|
4788
4796
|
return;
|
|
@@ -4825,7 +4833,7 @@ function zi() {
|
|
|
4825
4833
|
priorityTargets: Array.from(e, ([a, l]) => ({ element: a, labels: Array.from(l) }))
|
|
4826
4834
|
};
|
|
4827
4835
|
}
|
|
4828
|
-
function
|
|
4836
|
+
function Vi(s, e, t, n) {
|
|
4829
4837
|
const i = ["--- active/current elements ---"];
|
|
4830
4838
|
for (const r of s) {
|
|
4831
4839
|
const o = [];
|
|
@@ -4836,11 +4844,11 @@ function Ki(s, e, t, n) {
|
|
|
4836
4844
|
const d = a.getRootNode();
|
|
4837
4845
|
a = a.parentElement ?? (d instanceof ShadowRoot && d.host instanceof HTMLElement ? d.host : null);
|
|
4838
4846
|
}
|
|
4839
|
-
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(
|
|
4840
4848
|
u,
|
|
4841
4849
|
t,
|
|
4842
4850
|
n,
|
|
4843
|
-
d === l.length - 1 ?
|
|
4851
|
+
d === l.length - 1 ? Es(u).slice(0, 180) : ""
|
|
4844
4852
|
));
|
|
4845
4853
|
o.length > l.length && c.splice(1, 0, "…"), i.push(`${r.labels.join(", ")}: ${c.join(" > ")}`);
|
|
4846
4854
|
}
|
|
@@ -4856,17 +4864,17 @@ function Ae(s, e) {
|
|
|
4856
4864
|
const t = " ".repeat(e);
|
|
4857
4865
|
return s.map((n) => `${t}${n}`);
|
|
4858
4866
|
}
|
|
4859
|
-
function
|
|
4867
|
+
function Es(s) {
|
|
4860
4868
|
return ne(
|
|
4861
4869
|
Array.from(s.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
|
|
4862
4870
|
);
|
|
4863
4871
|
}
|
|
4864
|
-
function
|
|
4872
|
+
function Xi(s) {
|
|
4865
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);
|
|
4866
4874
|
}
|
|
4867
4875
|
function ks() {
|
|
4868
4876
|
const s = Array.from(document.querySelectorAll(Ht)), e = s.find(
|
|
4869
|
-
(r) => typeof r[
|
|
4877
|
+
(r) => typeof r[Nn] == "string"
|
|
4870
4878
|
);
|
|
4871
4879
|
if (!(e ?? s[0]))
|
|
4872
4880
|
return;
|
|
@@ -4882,23 +4890,23 @@ function ks() {
|
|
|
4882
4890
|
},
|
|
4883
4891
|
{
|
|
4884
4892
|
name: "widget_root",
|
|
4885
|
-
selector:
|
|
4893
|
+
selector: On,
|
|
4886
4894
|
description: "Finds Pluno's widget root inside the widget host shadow root."
|
|
4887
4895
|
},
|
|
4888
4896
|
{
|
|
4889
4897
|
name: "widget_panel",
|
|
4890
|
-
selector:
|
|
4898
|
+
selector: xn,
|
|
4891
4899
|
description: "Finds Pluno's open chat panel inside the widget host shadow root."
|
|
4892
4900
|
},
|
|
4893
4901
|
{
|
|
4894
4902
|
name: "widget_timeline",
|
|
4895
|
-
selector:
|
|
4903
|
+
selector: Ln,
|
|
4896
4904
|
description: "Finds Pluno's chat timeline inside the widget host shadow root."
|
|
4897
4905
|
}
|
|
4898
4906
|
]
|
|
4899
4907
|
};
|
|
4900
4908
|
}
|
|
4901
|
-
function
|
|
4909
|
+
function Ji(s) {
|
|
4902
4910
|
try {
|
|
4903
4911
|
const e = JSON.parse(s);
|
|
4904
4912
|
return e && typeof e == "object" ? e : { type: "error", message: "Invalid server event" };
|
|
@@ -4906,7 +4914,7 @@ function Qi(s) {
|
|
|
4906
4914
|
return { type: "error", message: "Invalid server event" };
|
|
4907
4915
|
}
|
|
4908
4916
|
}
|
|
4909
|
-
function
|
|
4917
|
+
function Yi(s) {
|
|
4910
4918
|
if (typeof s != "string")
|
|
4911
4919
|
return null;
|
|
4912
4920
|
try {
|
|
@@ -4922,7 +4930,7 @@ function Vt(s, e) {
|
|
|
4922
4930
|
const t = s[e];
|
|
4923
4931
|
return Array.isArray(t) ? t.filter((n) => typeof n == "string" && n.trim().length > 0) : [];
|
|
4924
4932
|
}
|
|
4925
|
-
function
|
|
4933
|
+
function Xt(s) {
|
|
4926
4934
|
return Array.isArray(s) ? s.flatMap((e) => {
|
|
4927
4935
|
if (!e || typeof e != "object")
|
|
4928
4936
|
return [];
|
|
@@ -4930,10 +4938,10 @@ function Jt(s) {
|
|
|
4930
4938
|
return typeof t.taskId != "string" || !t.taskId || typeof t.dueAt != "string" || Number.isNaN(Date.parse(t.dueAt)) ? [] : [{ taskId: t.taskId, dueAt: t.dueAt }];
|
|
4931
4939
|
}) : [];
|
|
4932
4940
|
}
|
|
4933
|
-
function
|
|
4941
|
+
function Zi(s) {
|
|
4934
4942
|
return Array.isArray(s) ? s.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
|
|
4935
4943
|
}
|
|
4936
|
-
function
|
|
4944
|
+
function er(s) {
|
|
4937
4945
|
if (!s || typeof s != "object")
|
|
4938
4946
|
return null;
|
|
4939
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;
|
|
@@ -4944,13 +4952,13 @@ function Xi(s) {
|
|
|
4944
4952
|
...a !== null ? { scribbleStyle: a } : {}
|
|
4945
4953
|
};
|
|
4946
4954
|
}
|
|
4947
|
-
function
|
|
4955
|
+
function tr(s) {
|
|
4948
4956
|
if (!s || typeof s != "object")
|
|
4949
4957
|
return null;
|
|
4950
4958
|
const e = s.javascript;
|
|
4951
4959
|
return typeof e != "string" || !e.trim() ? null : { javascript: e };
|
|
4952
4960
|
}
|
|
4953
|
-
function
|
|
4961
|
+
function sr(s, e) {
|
|
4954
4962
|
return e ? s && typeof s == "object" ? {
|
|
4955
4963
|
...s,
|
|
4956
4964
|
helperError: e
|
|
@@ -4960,13 +4968,13 @@ function Zi(s, e) {
|
|
|
4960
4968
|
helperError: e
|
|
4961
4969
|
} : s;
|
|
4962
4970
|
}
|
|
4963
|
-
function
|
|
4971
|
+
function nr(s) {
|
|
4964
4972
|
if (!s || typeof s != "object")
|
|
4965
4973
|
return s;
|
|
4966
4974
|
const e = s;
|
|
4967
4975
|
return typeof e.exception?.message == "string" ? e.exception.message : typeof e.error == "string" ? e.error : s;
|
|
4968
4976
|
}
|
|
4969
|
-
function
|
|
4977
|
+
function ir() {
|
|
4970
4978
|
const s = "pluno.productAgent.clientId", e = window.localStorage.getItem(s);
|
|
4971
4979
|
if (e)
|
|
4972
4980
|
return e;
|
|
@@ -4976,7 +4984,7 @@ function tr() {
|
|
|
4976
4984
|
function x() {
|
|
4977
4985
|
return crypto.randomUUID();
|
|
4978
4986
|
}
|
|
4979
|
-
function
|
|
4987
|
+
function rr(s) {
|
|
4980
4988
|
if (!s || typeof s != "object")
|
|
4981
4989
|
return null;
|
|
4982
4990
|
const e = s, t = typeof e.id == "string" ? e.id : null;
|
|
@@ -4992,7 +5000,7 @@ function st(s, e) {
|
|
|
4992
5000
|
s.map((t) => Ue(t, e)).filter((t) => t !== null)
|
|
4993
5001
|
) : [];
|
|
4994
5002
|
}
|
|
4995
|
-
function
|
|
5003
|
+
function or(s) {
|
|
4996
5004
|
return Array.isArray(s) ? s.flatMap((e) => {
|
|
4997
5005
|
if (!e || typeof e != "object")
|
|
4998
5006
|
return [];
|
|
@@ -5020,7 +5028,7 @@ function Ue(s, e) {
|
|
|
5020
5028
|
if (!n || typeof n != "object")
|
|
5021
5029
|
return null;
|
|
5022
5030
|
const i = n;
|
|
5023
|
-
if (i.hiddenFromTranscript === !0 ||
|
|
5031
|
+
if (i.hiddenFromTranscript === !0 || an(i) || i.type === "tab_lifecycle_decision" && i.decision === "keep")
|
|
5024
5032
|
return null;
|
|
5025
5033
|
if (i.type === "assistant_draft")
|
|
5026
5034
|
return {
|
|
@@ -5028,14 +5036,14 @@ function Ue(s, e) {
|
|
|
5028
5036
|
role: "assistant",
|
|
5029
5037
|
...i.phase === "commentary" || i.phase === "final_answer" ? { phase: i.phase } : {},
|
|
5030
5038
|
content: vt(
|
|
5031
|
-
|
|
5039
|
+
Jt(i.content),
|
|
5032
5040
|
e
|
|
5033
5041
|
),
|
|
5034
5042
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5035
|
-
...
|
|
5043
|
+
...k(i) !== null ? { displaySequence: k(i) } : {},
|
|
5036
5044
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
5037
5045
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5038
|
-
...
|
|
5046
|
+
...E(i) ? { runId: E(i) } : {},
|
|
5039
5047
|
dataType: "assistant_draft",
|
|
5040
5048
|
...i.steered === !0 ? { steered: !0 } : {}
|
|
5041
5049
|
};
|
|
@@ -5045,15 +5053,15 @@ function Ue(s, e) {
|
|
|
5045
5053
|
role: r,
|
|
5046
5054
|
...i.phase === "commentary" || i.phase === "final_answer" ? { phase: i.phase } : {},
|
|
5047
5055
|
content: vt(
|
|
5048
|
-
|
|
5056
|
+
Jt(i.content),
|
|
5049
5057
|
e
|
|
5050
5058
|
),
|
|
5051
5059
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5052
|
-
...
|
|
5060
|
+
...k(i) !== null ? { displaySequence: k(i) } : {},
|
|
5053
5061
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
5054
5062
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5055
|
-
...
|
|
5056
|
-
attachments:
|
|
5063
|
+
...E(i) ? { runId: E(i) } : {},
|
|
5064
|
+
attachments: qs(i.attachments, e),
|
|
5057
5065
|
...i.steered === !0 ? { steered: !0 } : {}
|
|
5058
5066
|
};
|
|
5059
5067
|
return r === "assistant" && typeof i.id == "string" && Object.defineProperty(o, "assistantDraftItemId", {
|
|
@@ -5068,47 +5076,47 @@ function Ue(s, e) {
|
|
|
5068
5076
|
}), o;
|
|
5069
5077
|
}
|
|
5070
5078
|
if (i.type === "function_call_output") {
|
|
5071
|
-
const r =
|
|
5079
|
+
const r = sn(i.output);
|
|
5072
5080
|
if (r !== null)
|
|
5073
5081
|
return {
|
|
5074
5082
|
id: String(t.id ?? crypto.randomUUID()),
|
|
5075
5083
|
role: "tool",
|
|
5076
5084
|
content: "",
|
|
5077
5085
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5078
|
-
...
|
|
5086
|
+
...k(i) !== null ? { displaySequence: k(i) } : {},
|
|
5079
5087
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5080
|
-
...
|
|
5088
|
+
...E(i) ? { runId: E(i) } : {},
|
|
5081
5089
|
dataType: "function_call_output",
|
|
5082
5090
|
toolName: St,
|
|
5083
5091
|
callId: ue(i) ?? void 0,
|
|
5084
5092
|
sharePromptAllowed: r
|
|
5085
5093
|
};
|
|
5086
|
-
const o =
|
|
5094
|
+
const o = In(i.output);
|
|
5087
5095
|
if (o)
|
|
5088
5096
|
return {
|
|
5089
5097
|
id: String(t.id ?? crypto.randomUUID()),
|
|
5090
5098
|
role: "tool",
|
|
5091
5099
|
content: "",
|
|
5092
5100
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5093
|
-
...
|
|
5101
|
+
...k(i) !== null ? { displaySequence: k(i) } : {},
|
|
5094
5102
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5095
|
-
...
|
|
5103
|
+
...E(i) ? { runId: E(i) } : {},
|
|
5096
5104
|
dataType: "scheduled_check_in",
|
|
5097
|
-
toolName:
|
|
5105
|
+
toolName: fs,
|
|
5098
5106
|
callId: ue(i) ?? void 0,
|
|
5099
5107
|
scheduledCheckInId: o.id ?? void 0,
|
|
5100
5108
|
scheduledCheckInAt: o.dueAt
|
|
5101
5109
|
};
|
|
5102
|
-
const a =
|
|
5110
|
+
const a = lr(i.output), l = cr(i.output);
|
|
5103
5111
|
return a ? {
|
|
5104
5112
|
id: String(t.id ?? crypto.randomUUID()),
|
|
5105
5113
|
role: "tool",
|
|
5106
5114
|
content: `Connect ${a.appName} to continue`,
|
|
5107
5115
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5108
|
-
...
|
|
5116
|
+
...k(i) !== null ? { displaySequence: k(i) } : {},
|
|
5109
5117
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
5110
5118
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5111
|
-
...
|
|
5119
|
+
...E(i) ? { runId: E(i) } : {},
|
|
5112
5120
|
dataType: "function_call_output",
|
|
5113
5121
|
toolName: "authenticate_pipedream_app",
|
|
5114
5122
|
callId: ue(i) ?? void 0,
|
|
@@ -5118,10 +5126,10 @@ function Ue(s, e) {
|
|
|
5118
5126
|
role: "tool",
|
|
5119
5127
|
content: "Connect WhatsApp to continue",
|
|
5120
5128
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5121
|
-
...
|
|
5129
|
+
...k(i) !== null ? { displaySequence: k(i) } : {},
|
|
5122
5130
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
5123
5131
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5124
|
-
...
|
|
5132
|
+
...E(i) ? { runId: E(i) } : {},
|
|
5125
5133
|
dataType: "function_call_output",
|
|
5126
5134
|
toolName: "request_personal_channel_connection",
|
|
5127
5135
|
callId: ue(i) ?? void 0,
|
|
@@ -5131,12 +5139,12 @@ function Ue(s, e) {
|
|
|
5131
5139
|
return i.type === "function_call" || i.type === "tool_call" || i.type === "web_search_call" || i.type === "mcp_call" || i.type === "tab_lifecycle_decision" ? {
|
|
5132
5140
|
id: String(t.id ?? crypto.randomUUID()),
|
|
5133
5141
|
role: "tool",
|
|
5134
|
-
content: i.type === "mcp_call" ?
|
|
5142
|
+
content: i.type === "mcp_call" ? ar(i) : dr(i),
|
|
5135
5143
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5136
|
-
...
|
|
5144
|
+
...k(i) !== null ? { displaySequence: k(i) } : {},
|
|
5137
5145
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
5138
5146
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5139
|
-
...
|
|
5147
|
+
...E(i) ? { runId: E(i) } : {},
|
|
5140
5148
|
dataType: String(i.type),
|
|
5141
5149
|
toolName: i.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof i.name == "string" ? i.name : void 0,
|
|
5142
5150
|
callId: ue(i) ?? void 0,
|
|
@@ -5145,12 +5153,12 @@ function Ue(s, e) {
|
|
|
5145
5153
|
} : i.type === "run_status" || i.type === "run_error" ? i.type === "run_error" && i.stage === "tool_execution" ? null : {
|
|
5146
5154
|
id: String(t.id ?? crypto.randomUUID()),
|
|
5147
5155
|
role: "system",
|
|
5148
|
-
content:
|
|
5156
|
+
content: ur(i),
|
|
5149
5157
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5150
|
-
...
|
|
5158
|
+
...k(i) !== null ? { displaySequence: k(i) } : {},
|
|
5151
5159
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
5152
5160
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5153
|
-
...
|
|
5161
|
+
...E(i) ? { runId: E(i) } : {},
|
|
5154
5162
|
dataType: String(i.type),
|
|
5155
5163
|
loading: i.steered !== !0 && i.type === "run_status" && (i.status === "running" || i.status === "retrying"),
|
|
5156
5164
|
...i.steered === !0 || i.type === "run_status" && i.status === "steered" ? { steered: !0 } : {},
|
|
@@ -5158,11 +5166,11 @@ function Ue(s, e) {
|
|
|
5158
5166
|
...typeof i.securitySettingsUrl == "string" ? { securitySettingsUrl: i.securitySettingsUrl } : {}
|
|
5159
5167
|
} : null;
|
|
5160
5168
|
}
|
|
5161
|
-
function
|
|
5169
|
+
function ar(s) {
|
|
5162
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(" ");
|
|
5163
5171
|
return t ? `🔌 Using ${t}` : "🔌 Using connected integration";
|
|
5164
5172
|
}
|
|
5165
|
-
function
|
|
5173
|
+
function lr(s) {
|
|
5166
5174
|
if (typeof s != "string")
|
|
5167
5175
|
return null;
|
|
5168
5176
|
try {
|
|
@@ -5179,7 +5187,7 @@ function rr(s) {
|
|
|
5179
5187
|
return null;
|
|
5180
5188
|
}
|
|
5181
5189
|
}
|
|
5182
|
-
function
|
|
5190
|
+
function cr(s) {
|
|
5183
5191
|
if (typeof s != "string")
|
|
5184
5192
|
return null;
|
|
5185
5193
|
try {
|
|
@@ -5194,10 +5202,10 @@ function or(s) {
|
|
|
5194
5202
|
return null;
|
|
5195
5203
|
}
|
|
5196
5204
|
}
|
|
5197
|
-
function
|
|
5205
|
+
function ur(s) {
|
|
5198
5206
|
return s.type === "run_status" && s.status === "steered" ? "Steered" : typeof s.message == "string" && s.message.trim().length > 0 ? s.message : "";
|
|
5199
5207
|
}
|
|
5200
|
-
function
|
|
5208
|
+
function dr(s) {
|
|
5201
5209
|
if (s.type === "web_search_call") {
|
|
5202
5210
|
const e = s.action;
|
|
5203
5211
|
if (e && typeof e == "object") {
|
|
@@ -5209,9 +5217,9 @@ function lr(s) {
|
|
|
5209
5217
|
}
|
|
5210
5218
|
return "🔎 Searching the web";
|
|
5211
5219
|
}
|
|
5212
|
-
return
|
|
5220
|
+
return hr(s);
|
|
5213
5221
|
}
|
|
5214
|
-
function
|
|
5222
|
+
function hr(s) {
|
|
5215
5223
|
if (typeof s.summary == "string" && s.summary.trim().length > 0)
|
|
5216
5224
|
return se(s.summary);
|
|
5217
5225
|
if (typeof s.arguments == "string")
|
|
@@ -5228,7 +5236,7 @@ function se(s) {
|
|
|
5228
5236
|
const e = s.trim() || "Run tool", t = e.codePointAt(0) ?? 0;
|
|
5229
5237
|
return t >= 126976 && t <= 129791 || t >= 9728 && t <= 10175 || t >= 127462 && t <= 127487 ? e : `🛠️ ${e}`;
|
|
5230
5238
|
}
|
|
5231
|
-
function
|
|
5239
|
+
function pr(s) {
|
|
5232
5240
|
if (s == null)
|
|
5233
5241
|
return s;
|
|
5234
5242
|
if (typeof s != "object")
|
|
@@ -5250,10 +5258,10 @@ function ue(s) {
|
|
|
5250
5258
|
function P(s) {
|
|
5251
5259
|
return typeof s.causalSequence == "number" && Number.isSafeInteger(s.causalSequence) ? s.causalSequence : null;
|
|
5252
5260
|
}
|
|
5253
|
-
function
|
|
5261
|
+
function k(s) {
|
|
5254
5262
|
return typeof s.displaySequence == "number" && Number.isSafeInteger(s.displaySequence) ? s.displaySequence : null;
|
|
5255
5263
|
}
|
|
5256
|
-
function
|
|
5264
|
+
function Jt(s) {
|
|
5257
5265
|
return typeof s == "string" ? s : Array.isArray(s) ? s.map((e) => {
|
|
5258
5266
|
if (!e || typeof e != "object")
|
|
5259
5267
|
return "";
|
|
@@ -5262,13 +5270,13 @@ function Xt(s) {
|
|
|
5262
5270
|
}).filter(Boolean).join("") : "";
|
|
5263
5271
|
}
|
|
5264
5272
|
function de(s, e) {
|
|
5265
|
-
const t =
|
|
5273
|
+
const t = Cs(
|
|
5266
5274
|
s,
|
|
5267
5275
|
Mt(s, e)
|
|
5268
|
-
), n =
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5276
|
+
), n = mr(
|
|
5277
|
+
fr(
|
|
5278
|
+
Tr(
|
|
5279
|
+
gr(s, e),
|
|
5272
5280
|
e
|
|
5273
5281
|
),
|
|
5274
5282
|
t
|
|
@@ -5293,7 +5301,7 @@ function Mt(s, e, t = !0) {
|
|
|
5293
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] : []);
|
|
5294
5302
|
return e.displaySequence = (i.length > 0 ? Math.max(...i) : 0) + 1, e;
|
|
5295
5303
|
}
|
|
5296
|
-
function
|
|
5304
|
+
function gr(s, e) {
|
|
5297
5305
|
const t = e.proactiveSuggestionClientMessageId;
|
|
5298
5306
|
if (!t)
|
|
5299
5307
|
return s;
|
|
@@ -5303,7 +5311,7 @@ function dr(s, e) {
|
|
|
5303
5311
|
const r = [...s];
|
|
5304
5312
|
return r[i] = e, r;
|
|
5305
5313
|
}
|
|
5306
|
-
function
|
|
5314
|
+
function fr(s, e) {
|
|
5307
5315
|
const t = e.assistantDraftItemId;
|
|
5308
5316
|
return t ? s.map(
|
|
5309
5317
|
(n) => n.dataType === "assistant_draft" && n.id === t ? e : n
|
|
@@ -5371,7 +5379,7 @@ function ts(s) {
|
|
|
5371
5379
|
loading: !0
|
|
5372
5380
|
};
|
|
5373
5381
|
}
|
|
5374
|
-
function
|
|
5382
|
+
function mr(s, e) {
|
|
5375
5383
|
if (e.id.startsWith("transient-activity:"))
|
|
5376
5384
|
return s;
|
|
5377
5385
|
const t = e.toolName === "tab_lifecycle";
|
|
@@ -5385,19 +5393,19 @@ function lt(s, e) {
|
|
|
5385
5393
|
for (const n of e) {
|
|
5386
5394
|
const i = [...s, ...t];
|
|
5387
5395
|
t.push(
|
|
5388
|
-
|
|
5396
|
+
Cs(
|
|
5389
5397
|
i,
|
|
5390
5398
|
Mt(i, n, !1)
|
|
5391
5399
|
)
|
|
5392
5400
|
);
|
|
5393
5401
|
}
|
|
5394
|
-
return
|
|
5402
|
+
return ln(
|
|
5395
5403
|
s,
|
|
5396
5404
|
t,
|
|
5397
5405
|
ct
|
|
5398
5406
|
);
|
|
5399
5407
|
}
|
|
5400
|
-
function
|
|
5408
|
+
function yr(s, e) {
|
|
5401
5409
|
const t = new Map(s.map((r) => [r.id, r])), n = e.map(
|
|
5402
5410
|
(r) => Mt(s, r, !1)
|
|
5403
5411
|
);
|
|
@@ -5419,7 +5427,7 @@ function gr(s, e) {
|
|
|
5419
5427
|
return i;
|
|
5420
5428
|
}
|
|
5421
5429
|
function ct(s) {
|
|
5422
|
-
const e =
|
|
5430
|
+
const e = J(s) ?? void 0, t = s.assistantDraftItemId, n = s.dataType === "function_call_output" || s.dataType === "scheduled_check_in", i = [
|
|
5423
5431
|
// Output-backed cards and their visible calls are separate durable rows. A distinct key keeps activity hydration
|
|
5424
5432
|
// from substituting the call for its output and then appending a duplicate output at the end of the timeline.
|
|
5425
5433
|
...s.callId ? [`${n ? "call-output" : "call"}:${s.callId}`] : [],
|
|
@@ -5438,49 +5446,49 @@ function ct(s) {
|
|
|
5438
5446
|
isTransient: s.id.startsWith("transient-activity:") || s.dataType === "assistant_draft"
|
|
5439
5447
|
};
|
|
5440
5448
|
}
|
|
5441
|
-
function
|
|
5449
|
+
function Cs(s, e) {
|
|
5442
5450
|
if (e.role !== "user" || !e.attachments?.length)
|
|
5443
5451
|
return e;
|
|
5444
5452
|
const t = s.find(
|
|
5445
|
-
(o) => o.role === "user" && (o.id === e.id || He(o) &&
|
|
5453
|
+
(o) => o.role === "user" && (o.id === e.id || He(o) && _s(o, e))
|
|
5446
5454
|
);
|
|
5447
5455
|
if (!t?.attachments?.length)
|
|
5448
5456
|
return e;
|
|
5449
5457
|
const n = e.attachments.map((o) => {
|
|
5450
|
-
const a =
|
|
5451
|
-
return a ?
|
|
5452
|
-
}), i = { ...e, attachments: n }, r =
|
|
5458
|
+
const a = Ir(t.attachments ?? [], o);
|
|
5459
|
+
return a ? Sr(o, a) : o;
|
|
5460
|
+
}), i = { ...e, attachments: n }, r = J(e);
|
|
5453
5461
|
return r && Object.defineProperty(i, "clientMessageId", {
|
|
5454
5462
|
value: r,
|
|
5455
5463
|
enumerable: !1
|
|
5456
5464
|
}), i;
|
|
5457
5465
|
}
|
|
5458
|
-
function
|
|
5466
|
+
function Ir(s, e) {
|
|
5459
5467
|
return e.id ? s.find((t) => t.id === e.id) ?? null : null;
|
|
5460
5468
|
}
|
|
5461
|
-
function
|
|
5469
|
+
function Sr(s, e) {
|
|
5462
5470
|
const { previewUrl: t } = e;
|
|
5463
5471
|
return t ? { ...s, previewUrl: t } : s;
|
|
5464
5472
|
}
|
|
5465
|
-
function
|
|
5473
|
+
function Tr(s, e) {
|
|
5466
5474
|
if (e.role !== "user")
|
|
5467
5475
|
return s;
|
|
5468
5476
|
const t = s.findIndex(
|
|
5469
|
-
(i) => He(i) &&
|
|
5477
|
+
(i) => He(i) && _s(i, e)
|
|
5470
5478
|
);
|
|
5471
5479
|
if (t === -1)
|
|
5472
5480
|
return s;
|
|
5473
5481
|
const n = [...s];
|
|
5474
5482
|
return n.splice(t, 1), n;
|
|
5475
5483
|
}
|
|
5476
|
-
function
|
|
5477
|
-
const t =
|
|
5484
|
+
function _s(s, e) {
|
|
5485
|
+
const t = J(s), n = J(e);
|
|
5478
5486
|
return t && n ? t === n : s.content === e.content;
|
|
5479
5487
|
}
|
|
5480
5488
|
function He(s) {
|
|
5481
5489
|
return s.role === "user" && (s.id.startsWith("local-") || s.id.startsWith("optimistic-user-message:"));
|
|
5482
5490
|
}
|
|
5483
|
-
function
|
|
5491
|
+
function J(s) {
|
|
5484
5492
|
const e = s.clientMessageId;
|
|
5485
5493
|
if (e)
|
|
5486
5494
|
return e;
|
|
@@ -5490,7 +5498,7 @@ function X(s) {
|
|
|
5490
5498
|
return n ? s.id.slice(n.length) : null;
|
|
5491
5499
|
}
|
|
5492
5500
|
function ss(s) {
|
|
5493
|
-
const e =
|
|
5501
|
+
const e = Ps(s);
|
|
5494
5502
|
if (e === null)
|
|
5495
5503
|
return !1;
|
|
5496
5504
|
const t = s[e].id;
|
|
@@ -5501,7 +5509,7 @@ function ss(s) {
|
|
|
5501
5509
|
for (let i = s.length - 1; i > e; i -= 1) {
|
|
5502
5510
|
const r = s[i];
|
|
5503
5511
|
if (!r.respondsToUserMessageId) {
|
|
5504
|
-
if (
|
|
5512
|
+
if (W(r))
|
|
5505
5513
|
return !0;
|
|
5506
5514
|
if (r.role === "system") {
|
|
5507
5515
|
if (r.dataType === "run_error")
|
|
@@ -5513,10 +5521,10 @@ function ss(s) {
|
|
|
5513
5521
|
}
|
|
5514
5522
|
return !1;
|
|
5515
5523
|
}
|
|
5516
|
-
function
|
|
5524
|
+
function wr(s, e, t) {
|
|
5517
5525
|
const n = new Set(
|
|
5518
5526
|
s.filter(
|
|
5519
|
-
(i) => i.role === "user" && e !== null &&
|
|
5527
|
+
(i) => i.role === "user" && e !== null && J(i) === e
|
|
5520
5528
|
).map((i) => i.id)
|
|
5521
5529
|
);
|
|
5522
5530
|
return s.some((i, r) => {
|
|
@@ -5527,29 +5535,29 @@ function Ir(s, e, t) {
|
|
|
5527
5535
|
if (t && i.runId === t) {
|
|
5528
5536
|
if (n.size === 0)
|
|
5529
5537
|
return !0;
|
|
5530
|
-
const o =
|
|
5538
|
+
const o = vs(s, r);
|
|
5531
5539
|
return !i.respondsToUserMessageId && o !== null && n.has(o);
|
|
5532
5540
|
}
|
|
5533
5541
|
return !1;
|
|
5534
5542
|
});
|
|
5535
5543
|
}
|
|
5536
|
-
function
|
|
5537
|
-
const e =
|
|
5544
|
+
function Ar(s) {
|
|
5545
|
+
const e = Ps(s);
|
|
5538
5546
|
if (e === null)
|
|
5539
|
-
return s.some(
|
|
5547
|
+
return s.some(W);
|
|
5540
5548
|
const t = s[e].id;
|
|
5541
5549
|
return s.some((n) => n.respondsToUserMessageId === t) ? s.some(
|
|
5542
|
-
(n) => n.respondsToUserMessageId === t &&
|
|
5543
|
-
) : s.slice(e + 1).some(
|
|
5550
|
+
(n) => n.respondsToUserMessageId === t && W(n)
|
|
5551
|
+
) : s.slice(e + 1).some(W);
|
|
5544
5552
|
}
|
|
5545
|
-
function
|
|
5553
|
+
function Ps(s) {
|
|
5546
5554
|
for (let e = s.length - 1; e >= 0; e -= 1)
|
|
5547
5555
|
if (s[e].role === "user" && !He(s[e]))
|
|
5548
5556
|
return e;
|
|
5549
5557
|
return null;
|
|
5550
5558
|
}
|
|
5551
5559
|
function De(s) {
|
|
5552
|
-
return
|
|
5560
|
+
return W(s) ? !0 : s.role !== "system" ? !1 : s.dataType === "run_error" ? !0 : s.dataType === "run_status" && s.loading !== !0;
|
|
5553
5561
|
}
|
|
5554
5562
|
function ie(s) {
|
|
5555
5563
|
for (let e = s.length - 1; e >= 0; e -= 1) {
|
|
@@ -5565,7 +5573,7 @@ function ie(s) {
|
|
|
5565
5573
|
}
|
|
5566
5574
|
return null;
|
|
5567
5575
|
}
|
|
5568
|
-
function
|
|
5576
|
+
function Mr(s) {
|
|
5569
5577
|
const e = ie(s);
|
|
5570
5578
|
if (e === null)
|
|
5571
5579
|
return null;
|
|
@@ -5584,10 +5592,10 @@ function C(s) {
|
|
|
5584
5592
|
function pe(s) {
|
|
5585
5593
|
return s?.retryable !== !0 ? !1 : s.type === "run_error" ? !0 : s.type === "run_status" && s.status === "interrupted";
|
|
5586
5594
|
}
|
|
5587
|
-
function
|
|
5595
|
+
function br(s) {
|
|
5588
5596
|
return s?.type === "run_status" && s.status === "interrupted" && s.reason === "backend_restart";
|
|
5589
5597
|
}
|
|
5590
|
-
function
|
|
5598
|
+
function Rr(s, e) {
|
|
5591
5599
|
const t = ie(e);
|
|
5592
5600
|
if (t === null)
|
|
5593
5601
|
return !1;
|
|
@@ -5612,7 +5620,7 @@ function ut(s) {
|
|
|
5612
5620
|
const i = n.clientMessageId;
|
|
5613
5621
|
return typeof i == "string" ? i : null;
|
|
5614
5622
|
}
|
|
5615
|
-
function
|
|
5623
|
+
function Er(s) {
|
|
5616
5624
|
const e = ie(s);
|
|
5617
5625
|
if (e === null)
|
|
5618
5626
|
return null;
|
|
@@ -5643,15 +5651,15 @@ function dt(s, e) {
|
|
|
5643
5651
|
return i?.type === "message" && i.role === "user" && typeof i.clientMessageId == "string" ? i.clientMessageId : null;
|
|
5644
5652
|
}
|
|
5645
5653
|
function ns(s, e, t, n, i, r) {
|
|
5646
|
-
if (!e || !
|
|
5654
|
+
if (!e || !Cr(s))
|
|
5647
5655
|
return !1;
|
|
5648
5656
|
const o = s;
|
|
5649
5657
|
if (pe(o) || t !== null && typeof o.id == "string" && o.id !== t)
|
|
5650
5658
|
return !1;
|
|
5651
5659
|
const a = O(o);
|
|
5652
|
-
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;
|
|
5653
5661
|
}
|
|
5654
|
-
function
|
|
5662
|
+
function kr(s, e) {
|
|
5655
5663
|
for (let t = e - 1; t >= 0; t -= 1) {
|
|
5656
5664
|
const n = C(s[t]);
|
|
5657
5665
|
if (n?.type === "message" && n.role === "user")
|
|
@@ -5659,31 +5667,31 @@ function br(s, e) {
|
|
|
5659
5667
|
}
|
|
5660
5668
|
return null;
|
|
5661
5669
|
}
|
|
5662
|
-
function
|
|
5670
|
+
function vs(s, e) {
|
|
5663
5671
|
for (let t = e - 1; t >= 0; t -= 1)
|
|
5664
5672
|
if (s[t].role === "user")
|
|
5665
5673
|
return s[t].id;
|
|
5666
5674
|
return null;
|
|
5667
5675
|
}
|
|
5668
|
-
function
|
|
5676
|
+
function Cr(s) {
|
|
5669
5677
|
if (!s || typeof s != "object")
|
|
5670
5678
|
return !1;
|
|
5671
5679
|
const e = s;
|
|
5672
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");
|
|
5673
5681
|
}
|
|
5674
|
-
function
|
|
5682
|
+
function W(s) {
|
|
5675
5683
|
return s.role === "assistant" && s.phase !== "commentary";
|
|
5676
5684
|
}
|
|
5677
|
-
function
|
|
5685
|
+
function _r(s) {
|
|
5678
5686
|
if (!s || typeof s != "object")
|
|
5679
5687
|
return !1;
|
|
5680
5688
|
const e = s;
|
|
5681
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";
|
|
5682
5690
|
}
|
|
5683
5691
|
function ht(s) {
|
|
5684
|
-
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);
|
|
5685
5693
|
}
|
|
5686
|
-
function
|
|
5694
|
+
function Pr(s) {
|
|
5687
5695
|
return s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.steered !== !0);
|
|
5688
5696
|
}
|
|
5689
5697
|
function G(s) {
|
|
@@ -5692,24 +5700,24 @@ function G(s) {
|
|
|
5692
5700
|
function pt(s) {
|
|
5693
5701
|
return s.steered !== !0 && (s.dataType === "assistant_draft" || s.loading === !0);
|
|
5694
5702
|
}
|
|
5695
|
-
function
|
|
5703
|
+
function vr(s) {
|
|
5696
5704
|
return s.some(pt);
|
|
5697
5705
|
}
|
|
5698
5706
|
function is(s, e) {
|
|
5699
5707
|
return (s.retryable === !0 || s.code === "transient_model_error") && s.code !== "run_recovery_exhausted" && e !== null && typeof s.clientMessageId == "string";
|
|
5700
5708
|
}
|
|
5701
|
-
function
|
|
5709
|
+
function Ur(s, e) {
|
|
5702
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;
|
|
5703
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]);
|
|
5704
5712
|
}
|
|
5705
|
-
function
|
|
5713
|
+
function Dr(s, e, t, n) {
|
|
5706
5714
|
const i = s.findIndex(
|
|
5707
|
-
(l, c) => G(l) && !
|
|
5715
|
+
(l, c) => G(l) && !Us(s, c)
|
|
5708
5716
|
), r = i === -1 ? null : s[i], o = e ?? r?.respondsToUserMessageId ?? null, a = o ? s.find(
|
|
5709
5717
|
(l) => l.role === "user" && l.id === o
|
|
5710
5718
|
) : null;
|
|
5711
5719
|
return {
|
|
5712
|
-
clientMessageId: a ?
|
|
5720
|
+
clientMessageId: a ? J(a) : o ? null : n,
|
|
5713
5721
|
respondsToUserMessageId: o,
|
|
5714
5722
|
runId: t ?? r?.runId ?? null
|
|
5715
5723
|
};
|
|
@@ -5717,29 +5725,29 @@ function Pr(s, e, t, n) {
|
|
|
5717
5725
|
function _e(s) {
|
|
5718
5726
|
return s?.type === "run_status" && s.status === "stopped";
|
|
5719
5727
|
}
|
|
5720
|
-
function
|
|
5721
|
-
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;
|
|
5722
5730
|
}
|
|
5723
5731
|
function rs(s, e, t) {
|
|
5724
5732
|
const n = new Set(
|
|
5725
5733
|
s.filter(
|
|
5726
|
-
(i) => i.role === "user" && e !== null &&
|
|
5734
|
+
(i) => i.role === "user" && e !== null && J(i) === e
|
|
5727
5735
|
).map((i) => i.id)
|
|
5728
5736
|
);
|
|
5729
5737
|
return s.filter(
|
|
5730
5738
|
(i) => !G(i) || (n.size > 0 ? !i.respondsToUserMessageId || !n.has(i.respondsToUserMessageId) : !t || i.runId !== t)
|
|
5731
5739
|
);
|
|
5732
5740
|
}
|
|
5733
|
-
function
|
|
5741
|
+
function Us(s, e) {
|
|
5734
5742
|
return s.some(
|
|
5735
|
-
(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(
|
|
5736
5744
|
s,
|
|
5737
5745
|
e,
|
|
5738
5746
|
n
|
|
5739
5747
|
)
|
|
5740
5748
|
);
|
|
5741
5749
|
}
|
|
5742
|
-
function
|
|
5750
|
+
function Or(s, e, t) {
|
|
5743
5751
|
const n = s[e], i = s[t];
|
|
5744
5752
|
if (ge(n, i))
|
|
5745
5753
|
return !0;
|
|
@@ -5752,11 +5760,11 @@ function Ur(s, e, t) {
|
|
|
5752
5760
|
}
|
|
5753
5761
|
function os(s, e, t, n) {
|
|
5754
5762
|
const i = (t && t !== e ? t : null) ?? [...s].reverse().find(
|
|
5755
|
-
(l) => l.respondsToUserMessageId !== void 0 && l.respondsToUserMessageId !== e && as(l) && !
|
|
5763
|
+
(l) => l.respondsToUserMessageId !== void 0 && l.respondsToUserMessageId !== e && as(l) && !Lr(
|
|
5756
5764
|
s,
|
|
5757
5765
|
l.respondsToUserMessageId
|
|
5758
5766
|
)
|
|
5759
|
-
)?.respondsToUserMessageId ??
|
|
5767
|
+
)?.respondsToUserMessageId ?? xr(
|
|
5760
5768
|
s,
|
|
5761
5769
|
e
|
|
5762
5770
|
);
|
|
@@ -5785,7 +5793,7 @@ function os(s, e, t, n) {
|
|
|
5785
5793
|
}
|
|
5786
5794
|
];
|
|
5787
5795
|
}
|
|
5788
|
-
function
|
|
5796
|
+
function xr(s, e) {
|
|
5789
5797
|
const t = s.findIndex(
|
|
5790
5798
|
(n) => n.role === "user" && n.id === e
|
|
5791
5799
|
);
|
|
@@ -5799,12 +5807,12 @@ function Dr(s, e) {
|
|
|
5799
5807
|
function as(s) {
|
|
5800
5808
|
return s.role === "tool" || G(s) ? !0 : s.role === "assistant" && s.phase === "commentary";
|
|
5801
5809
|
}
|
|
5802
|
-
function
|
|
5810
|
+
function Lr(s, e) {
|
|
5803
5811
|
return s.some(
|
|
5804
|
-
(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))
|
|
5805
5813
|
);
|
|
5806
5814
|
}
|
|
5807
|
-
function
|
|
5815
|
+
function Nr(s, e) {
|
|
5808
5816
|
const t = s[e];
|
|
5809
5817
|
for (let n = e + 1; n < s.length; n += 1) {
|
|
5810
5818
|
const i = s[n];
|
|
@@ -5813,7 +5821,7 @@ function Or(s, e) {
|
|
|
5813
5821
|
}
|
|
5814
5822
|
return !1;
|
|
5815
5823
|
}
|
|
5816
|
-
function
|
|
5824
|
+
function Hr(s, e) {
|
|
5817
5825
|
const t = s[e];
|
|
5818
5826
|
if (!t.respondsToUserMessageId)
|
|
5819
5827
|
return !1;
|
|
@@ -5826,19 +5834,19 @@ function xr(s, e) {
|
|
|
5826
5834
|
}
|
|
5827
5835
|
return !1;
|
|
5828
5836
|
}
|
|
5829
|
-
function
|
|
5837
|
+
function Br(s, e) {
|
|
5830
5838
|
const t = s[e];
|
|
5831
5839
|
return s.some(
|
|
5832
5840
|
(n, i) => i !== e && n.role === "assistant" && ge(t, n)
|
|
5833
5841
|
);
|
|
5834
5842
|
}
|
|
5835
|
-
function
|
|
5843
|
+
function Fr(s, e) {
|
|
5836
5844
|
const t = s[e];
|
|
5837
5845
|
return s.some(
|
|
5838
5846
|
(n, i) => i !== e && n.role === "tool" && ge(t, n)
|
|
5839
5847
|
);
|
|
5840
5848
|
}
|
|
5841
|
-
function
|
|
5849
|
+
function Wr(s, e) {
|
|
5842
5850
|
const t = s[e];
|
|
5843
5851
|
for (let n = e + 1; n < s.length; n += 1)
|
|
5844
5852
|
if (G(s[n]) && ge(t, s[n]))
|
|
@@ -5851,15 +5859,15 @@ function ge(s, e) {
|
|
|
5851
5859
|
function A(s, e) {
|
|
5852
5860
|
return s && typeof s == "object" && typeof s[e] == "string" ? s[e] : null;
|
|
5853
5861
|
}
|
|
5854
|
-
function
|
|
5862
|
+
function $r(s, e) {
|
|
5855
5863
|
try {
|
|
5856
|
-
const t = window.localStorage.getItem(`${
|
|
5864
|
+
const t = window.localStorage.getItem(`${Ms}${s}`);
|
|
5857
5865
|
if (!t)
|
|
5858
5866
|
return null;
|
|
5859
5867
|
const n = JSON.parse(t), i = typeof n.sessionId == "string" ? n.sessionId : null;
|
|
5860
5868
|
if (e !== void 0 && i !== e)
|
|
5861
5869
|
return null;
|
|
5862
|
-
const r = Array.isArray(n.messages) ? n.messages.map(
|
|
5870
|
+
const r = Array.isArray(n.messages) ? n.messages.map(eo).filter((o) => !!o) : [];
|
|
5863
5871
|
return {
|
|
5864
5872
|
sessionId: i,
|
|
5865
5873
|
messages: r
|
|
@@ -5873,20 +5881,20 @@ function gt(s) {
|
|
|
5873
5881
|
// running tool or commentary history from disappearing while authoritative hydration is still in flight.
|
|
5874
5882
|
s.role === "tool" || s.dataType === "run_status" || s.dataType === "run_error";
|
|
5875
5883
|
}
|
|
5876
|
-
function
|
|
5884
|
+
function jr(s, e) {
|
|
5877
5885
|
try {
|
|
5878
5886
|
window.localStorage.setItem(
|
|
5879
|
-
`${
|
|
5887
|
+
`${Ms}${s}`,
|
|
5880
5888
|
JSON.stringify({
|
|
5881
5889
|
sessionId: e.sessionId,
|
|
5882
|
-
messages: e.messages.filter(gt).slice(-
|
|
5890
|
+
messages: e.messages.filter(gt).slice(-di).map(to)
|
|
5883
5891
|
})
|
|
5884
5892
|
);
|
|
5885
5893
|
} catch {
|
|
5886
5894
|
return;
|
|
5887
5895
|
}
|
|
5888
5896
|
}
|
|
5889
|
-
function
|
|
5897
|
+
function zr(s) {
|
|
5890
5898
|
try {
|
|
5891
5899
|
const e = window.localStorage.getItem(`${at}${s}`);
|
|
5892
5900
|
if (!e)
|
|
@@ -5912,7 +5920,7 @@ function V(s, e) {
|
|
|
5912
5920
|
return;
|
|
5913
5921
|
}
|
|
5914
5922
|
}
|
|
5915
|
-
function
|
|
5923
|
+
function Ds(s, e) {
|
|
5916
5924
|
try {
|
|
5917
5925
|
const t = `${Le}${s}`, n = location.href, i = location.origin, r = Array.from(e, (o) => ({
|
|
5918
5926
|
...o,
|
|
@@ -5935,21 +5943,21 @@ function ls(s, e) {
|
|
|
5935
5943
|
} catch {
|
|
5936
5944
|
return;
|
|
5937
5945
|
}
|
|
5938
|
-
|
|
5946
|
+
Ds(s, e);
|
|
5939
5947
|
}
|
|
5940
|
-
function
|
|
5948
|
+
function Kr(s) {
|
|
5941
5949
|
try {
|
|
5942
5950
|
const e = `${Le}${s}`, t = window.sessionStorage.getItem(e);
|
|
5943
5951
|
if (window.sessionStorage.removeItem(e), !t)
|
|
5944
5952
|
return [];
|
|
5945
5953
|
const n = JSON.parse(t);
|
|
5946
|
-
return Array.isArray(n) ? n.flatMap((i) =>
|
|
5954
|
+
return Array.isArray(n) ? n.flatMap((i) => Qr(i) ? [{
|
|
5947
5955
|
...i.event,
|
|
5948
5956
|
page: _(),
|
|
5949
5957
|
rawOutput: {
|
|
5950
5958
|
pageContextRestarted: !0,
|
|
5951
5959
|
outcome: "unknown",
|
|
5952
|
-
message:
|
|
5960
|
+
message: Gr(location.href),
|
|
5953
5961
|
currentUrl: location.href,
|
|
5954
5962
|
console: [],
|
|
5955
5963
|
metadata: {
|
|
@@ -5966,17 +5974,17 @@ function $r(s) {
|
|
|
5966
5974
|
return [];
|
|
5967
5975
|
}
|
|
5968
5976
|
}
|
|
5969
|
-
function
|
|
5977
|
+
function Gr(s) {
|
|
5970
5978
|
return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
|
|
5971
5979
|
Current URL: ${s}`;
|
|
5972
5980
|
}
|
|
5973
|
-
function
|
|
5981
|
+
function Qr(s) {
|
|
5974
5982
|
if (!s || typeof s != "object")
|
|
5975
5983
|
return !1;
|
|
5976
5984
|
const e = s, t = e.event;
|
|
5977
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";
|
|
5978
5986
|
}
|
|
5979
|
-
function
|
|
5987
|
+
function Vr(s, e) {
|
|
5980
5988
|
const t = new Set(
|
|
5981
5989
|
s.flatMap((n) => n.type === "tool.result" ? [n.callId] : [])
|
|
5982
5990
|
);
|
|
@@ -5985,7 +5993,7 @@ function Kr(s, e) {
|
|
|
5985
5993
|
...e.filter((n) => !t.has(n.callId))
|
|
5986
5994
|
];
|
|
5987
5995
|
}
|
|
5988
|
-
function
|
|
5996
|
+
function Xr(s) {
|
|
5989
5997
|
try {
|
|
5990
5998
|
window.sessionStorage.removeItem(`${Le}${s}`);
|
|
5991
5999
|
} catch {
|
|
@@ -6004,7 +6012,7 @@ function cs(s) {
|
|
|
6004
6012
|
const e = s;
|
|
6005
6013
|
return typeof e.url == "string" && typeof e.title == "string" && typeof e.origin == "string";
|
|
6006
6014
|
}
|
|
6007
|
-
function
|
|
6015
|
+
function qs(s, e) {
|
|
6008
6016
|
if (!Array.isArray(s))
|
|
6009
6017
|
return;
|
|
6010
6018
|
const t = s.filter((i) => {
|
|
@@ -6012,41 +6020,41 @@ function Ds(s, e) {
|
|
|
6012
6020
|
return !1;
|
|
6013
6021
|
const r = i;
|
|
6014
6022
|
return typeof r.name == "string" && typeof r.mimeType == "string" && typeof r.sizeBytes == "number";
|
|
6015
|
-
}), n = e ? t.map((i) =>
|
|
6023
|
+
}), n = e ? t.map((i) => Os(i, e)) : t;
|
|
6016
6024
|
return n.length > 0 ? n : void 0;
|
|
6017
6025
|
}
|
|
6018
|
-
function
|
|
6026
|
+
function Os(s, e) {
|
|
6019
6027
|
return s.fileUrl?.startsWith("/") ? {
|
|
6020
6028
|
...s,
|
|
6021
6029
|
fileUrl: new URL(s.fileUrl, e).toString()
|
|
6022
6030
|
} : s;
|
|
6023
6031
|
}
|
|
6024
6032
|
function ft(s) {
|
|
6025
|
-
return s.type ||
|
|
6033
|
+
return s.type || Zr(s.name) || "application/octet-stream";
|
|
6026
6034
|
}
|
|
6027
|
-
function
|
|
6028
|
-
|
|
6035
|
+
function Jr(s) {
|
|
6036
|
+
xs({
|
|
6029
6037
|
name: s.name,
|
|
6030
6038
|
mimeType: ft(s),
|
|
6031
6039
|
sizeBytes: s.size
|
|
6032
6040
|
});
|
|
6033
6041
|
}
|
|
6034
|
-
function
|
|
6035
|
-
const e =
|
|
6036
|
-
if (!
|
|
6042
|
+
function xs(s) {
|
|
6043
|
+
const e = Yr(s.name), t = s.mimeType.trim().toLowerCase();
|
|
6044
|
+
if (!li.has(`${e}:${t}`))
|
|
6037
6045
|
throw new Error("This attachment type is not supported by the embedded model provider");
|
|
6038
|
-
if (s.sizeBytes <= 0 || s.sizeBytes >=
|
|
6046
|
+
if (s.sizeBytes <= 0 || s.sizeBytes >= ws)
|
|
6039
6047
|
throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
|
|
6040
6048
|
}
|
|
6041
|
-
function
|
|
6049
|
+
function Yr(s) {
|
|
6042
6050
|
const e = s.trim().toLowerCase(), t = e.lastIndexOf(".");
|
|
6043
6051
|
return t >= 0 ? e.slice(t) : "";
|
|
6044
6052
|
}
|
|
6045
|
-
function
|
|
6053
|
+
function Zr(s) {
|
|
6046
6054
|
const e = s.toLowerCase();
|
|
6047
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;
|
|
6048
6056
|
}
|
|
6049
|
-
function
|
|
6057
|
+
function eo(s) {
|
|
6050
6058
|
if (!s || typeof s != "object")
|
|
6051
6059
|
return null;
|
|
6052
6060
|
const e = s;
|
|
@@ -6064,11 +6072,11 @@ function Xr(s) {
|
|
|
6064
6072
|
scheduledCheckInId: typeof e.scheduledCheckInId == "string" ? e.scheduledCheckInId : void 0,
|
|
6065
6073
|
scheduledCheckInAt: typeof e.scheduledCheckInAt == "string" ? e.scheduledCheckInAt : void 0,
|
|
6066
6074
|
securitySettingsUrl: typeof e.securitySettingsUrl == "string" ? e.securitySettingsUrl : void 0,
|
|
6067
|
-
attachments:
|
|
6075
|
+
attachments: qs(e.attachments)?.map(qe),
|
|
6068
6076
|
loading: typeof e.loading == "boolean" ? e.loading : void 0
|
|
6069
6077
|
};
|
|
6070
6078
|
}
|
|
6071
|
-
function
|
|
6079
|
+
function to(s) {
|
|
6072
6080
|
return s.attachments?.length ? {
|
|
6073
6081
|
...s,
|
|
6074
6082
|
attachments: s.attachments.map(qe)
|
|
@@ -6088,15 +6096,15 @@ function O(s) {
|
|
|
6088
6096
|
const e = s.respondsToUserMessageId;
|
|
6089
6097
|
return typeof e == "string" && e ? e : null;
|
|
6090
6098
|
}
|
|
6091
|
-
function
|
|
6099
|
+
function E(s) {
|
|
6092
6100
|
const e = s.runId;
|
|
6093
6101
|
return typeof e == "string" && e ? e : null;
|
|
6094
6102
|
}
|
|
6095
|
-
function
|
|
6103
|
+
function so(s) {
|
|
6096
6104
|
const e = s?.timeoutMs;
|
|
6097
|
-
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);
|
|
6098
6106
|
}
|
|
6099
|
-
function
|
|
6107
|
+
function Ls(s) {
|
|
6100
6108
|
const e = {};
|
|
6101
6109
|
try {
|
|
6102
6110
|
new Headers(s).forEach((t, n) => {
|
|
@@ -6108,23 +6116,23 @@ function xs(s) {
|
|
|
6108
6116
|
return e;
|
|
6109
6117
|
}
|
|
6110
6118
|
function Rt(s, e) {
|
|
6111
|
-
return
|
|
6119
|
+
return $s(s) ? Be : F(xe(e), ci);
|
|
6112
6120
|
}
|
|
6113
|
-
function
|
|
6121
|
+
function no(s, e) {
|
|
6114
6122
|
return typeof s == "string" ? s : s instanceof URL ? s.toString() : e?.url ?? "";
|
|
6115
6123
|
}
|
|
6116
|
-
async function
|
|
6117
|
-
const i =
|
|
6124
|
+
async function io(s, e, t, n) {
|
|
6125
|
+
const i = Ls(s.headers);
|
|
6118
6126
|
n({
|
|
6119
6127
|
...e,
|
|
6120
6128
|
responseStatus: s.status,
|
|
6121
6129
|
responseHeaders: i,
|
|
6122
|
-
responseBody: await
|
|
6130
|
+
responseBody: await ro(s),
|
|
6123
6131
|
durationMs: Date.now() - t
|
|
6124
6132
|
});
|
|
6125
6133
|
}
|
|
6126
|
-
async function
|
|
6127
|
-
if (!
|
|
6134
|
+
async function ro(s) {
|
|
6135
|
+
if (!Ns(s.headers))
|
|
6128
6136
|
return;
|
|
6129
6137
|
let e = null, t = null;
|
|
6130
6138
|
try {
|
|
@@ -6133,7 +6141,7 @@ async function so(s) {
|
|
|
6133
6141
|
const n = new Promise((a) => {
|
|
6134
6142
|
t = window.setTimeout(() => {
|
|
6135
6143
|
e?.cancel(), a("timeout");
|
|
6136
|
-
},
|
|
6144
|
+
}, ui);
|
|
6137
6145
|
}), i = new TextDecoder();
|
|
6138
6146
|
let r = "", o = 0;
|
|
6139
6147
|
for (; ; ) {
|
|
@@ -6142,10 +6150,10 @@ async function so(s) {
|
|
|
6142
6150
|
return;
|
|
6143
6151
|
const { done: l, value: c } = a;
|
|
6144
6152
|
if (l)
|
|
6145
|
-
return
|
|
6153
|
+
return F(r + i.decode());
|
|
6146
6154
|
const u = Tt - o;
|
|
6147
6155
|
if (c.byteLength > u)
|
|
6148
|
-
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]`;
|
|
6149
6157
|
o += c.byteLength, r += i.decode(c, { stream: !0 });
|
|
6150
6158
|
}
|
|
6151
6159
|
} catch {
|
|
@@ -6155,19 +6163,19 @@ async function so(s) {
|
|
|
6155
6163
|
t !== null && window.clearTimeout(t);
|
|
6156
6164
|
}
|
|
6157
6165
|
}
|
|
6158
|
-
function
|
|
6159
|
-
if (
|
|
6166
|
+
function oo(s, e) {
|
|
6167
|
+
if (Ns(new Headers(e)))
|
|
6160
6168
|
try {
|
|
6161
|
-
return s.responseType === "" || s.responseType === "text" ?
|
|
6169
|
+
return s.responseType === "" || s.responseType === "text" ? F(s.responseText ?? "") : void 0;
|
|
6162
6170
|
} catch {
|
|
6163
6171
|
return;
|
|
6164
6172
|
}
|
|
6165
6173
|
}
|
|
6166
6174
|
function us(s) {
|
|
6167
6175
|
if (typeof s == "string")
|
|
6168
|
-
return
|
|
6176
|
+
return F(s);
|
|
6169
6177
|
}
|
|
6170
|
-
function
|
|
6178
|
+
function ao(s) {
|
|
6171
6179
|
return L({
|
|
6172
6180
|
...s,
|
|
6173
6181
|
requestBody: ds(s.requestBody),
|
|
@@ -6186,14 +6194,14 @@ function ds(s) {
|
|
|
6186
6194
|
return xe(s);
|
|
6187
6195
|
}
|
|
6188
6196
|
}
|
|
6189
|
-
function
|
|
6197
|
+
function Ns(s) {
|
|
6190
6198
|
if (!s)
|
|
6191
6199
|
return !1;
|
|
6192
6200
|
const e = s.get("content-type")?.toLowerCase() ?? "", t = s.get("content-length"), n = Number(t);
|
|
6193
6201
|
return t !== null && Number.isInteger(n) && n >= 0 && n <= Tt && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
|
|
6194
6202
|
}
|
|
6195
6203
|
function te(s, e = {}, t) {
|
|
6196
|
-
if (
|
|
6204
|
+
if (co(t))
|
|
6197
6205
|
return !0;
|
|
6198
6206
|
const n = Object.entries(e).find(([i]) => i.toLowerCase() === "content-type")?.[1]?.toLowerCase();
|
|
6199
6207
|
if (n?.includes("multipart/form-data") || n?.includes("application/octet-stream"))
|
|
@@ -6208,7 +6216,7 @@ function te(s, e = {}, t) {
|
|
|
6208
6216
|
return !0;
|
|
6209
6217
|
}
|
|
6210
6218
|
}
|
|
6211
|
-
function
|
|
6219
|
+
function lo(s, e) {
|
|
6212
6220
|
if (te(s))
|
|
6213
6221
|
return !0;
|
|
6214
6222
|
try {
|
|
@@ -6218,10 +6226,10 @@ function ro(s, e) {
|
|
|
6218
6226
|
return !0;
|
|
6219
6227
|
}
|
|
6220
6228
|
}
|
|
6221
|
-
function
|
|
6229
|
+
function co(s) {
|
|
6222
6230
|
return s instanceof FormData || s instanceof Blob || s instanceof ArrayBuffer || ArrayBuffer.isView(s) || typeof ReadableStream < "u" && s instanceof ReadableStream;
|
|
6223
6231
|
}
|
|
6224
|
-
function
|
|
6232
|
+
function uo(s) {
|
|
6225
6233
|
const e = {};
|
|
6226
6234
|
for (const t of s.trim().split(/[\r\n]+/)) {
|
|
6227
6235
|
const n = t.indexOf(":");
|
|
@@ -6234,7 +6242,7 @@ function ao(s) {
|
|
|
6234
6242
|
}
|
|
6235
6243
|
return e;
|
|
6236
6244
|
}
|
|
6237
|
-
function
|
|
6245
|
+
function F(s, e = Tt) {
|
|
6238
6246
|
return s.length <= e ? s : `${s.slice(0, e)}... [truncated ${s.length - e} chars]`;
|
|
6239
6247
|
}
|
|
6240
6248
|
function nt(s) {
|
|
@@ -6252,27 +6260,27 @@ async function be(s, e) {
|
|
|
6252
6260
|
try {
|
|
6253
6261
|
return await s();
|
|
6254
6262
|
} catch (i) {
|
|
6255
|
-
if (t = i, n >= zt - 1 || !
|
|
6263
|
+
if (t = i, n >= zt - 1 || !po(i))
|
|
6256
6264
|
throw i;
|
|
6257
|
-
await
|
|
6265
|
+
await ho(n);
|
|
6258
6266
|
}
|
|
6259
6267
|
throw t instanceof Error ? t : new Error(e);
|
|
6260
6268
|
}
|
|
6261
|
-
function
|
|
6269
|
+
function ho(s) {
|
|
6262
6270
|
return new Promise((e) => {
|
|
6263
|
-
window.setTimeout(e,
|
|
6271
|
+
window.setTimeout(e, ai[s] ?? 0);
|
|
6264
6272
|
});
|
|
6265
6273
|
}
|
|
6266
|
-
function
|
|
6267
|
-
return s instanceof Pe ?
|
|
6274
|
+
function po(s) {
|
|
6275
|
+
return s instanceof Pe ? go(s.status) : s instanceof TypeError;
|
|
6268
6276
|
}
|
|
6269
|
-
function
|
|
6277
|
+
function go(s) {
|
|
6270
6278
|
return s === 408 || s === 409 || s === 429 || s >= 500;
|
|
6271
6279
|
}
|
|
6272
|
-
function
|
|
6280
|
+
function fo(s) {
|
|
6273
6281
|
return s === 401 || s === 403;
|
|
6274
6282
|
}
|
|
6275
|
-
const Be = "[REDACTED_SECRET]", $ = "[REDACTED_TOKEN]",
|
|
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 = /[),.;\]]+$/;
|
|
6276
6284
|
function L(s) {
|
|
6277
6285
|
return Oe(s, 0, /* @__PURE__ */ new WeakSet());
|
|
6278
6286
|
}
|
|
@@ -6281,7 +6289,7 @@ function Oe(s, e, t) {
|
|
|
6281
6289
|
return s.startsWith("data:image/") || s.startsWith("data:application/pdf;") ? s : xe(s);
|
|
6282
6290
|
if (s === null || typeof s != "object")
|
|
6283
6291
|
return s;
|
|
6284
|
-
if (e >=
|
|
6292
|
+
if (e >= yo)
|
|
6285
6293
|
return "[REDACTED_MAX_DEPTH]";
|
|
6286
6294
|
if (t.has(s))
|
|
6287
6295
|
return "[REDACTED_CIRCULAR]";
|
|
@@ -6289,71 +6297,71 @@ function Oe(s, e, t) {
|
|
|
6289
6297
|
return s.map((i) => Oe(i, e + 1, t));
|
|
6290
6298
|
const n = {};
|
|
6291
6299
|
for (const [i, r] of Object.entries(s))
|
|
6292
|
-
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);
|
|
6293
6301
|
return n;
|
|
6294
6302
|
}
|
|
6295
|
-
function
|
|
6303
|
+
function $s(s) {
|
|
6296
6304
|
const e = s.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
6297
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");
|
|
6298
6306
|
}
|
|
6299
|
-
function
|
|
6300
|
-
return typeof s == "string" ?
|
|
6307
|
+
function Ao(s) {
|
|
6308
|
+
return typeof s == "string" ? js(s) : Oe(s, 0, /* @__PURE__ */ new WeakSet());
|
|
6301
6309
|
}
|
|
6302
|
-
function
|
|
6310
|
+
function js(s) {
|
|
6303
6311
|
try {
|
|
6304
6312
|
const e = new URL(s, location.href);
|
|
6305
6313
|
for (const t of Array.from(e.searchParams.keys()))
|
|
6306
|
-
|
|
6314
|
+
Io.test(t) && e.searchParams.set(t, $);
|
|
6307
6315
|
return e.username && (e.username = $), e.password && (e.password = $), e.toString();
|
|
6308
6316
|
} catch {
|
|
6309
|
-
return
|
|
6317
|
+
return Mo(s);
|
|
6310
6318
|
}
|
|
6311
6319
|
}
|
|
6312
6320
|
function xe(s) {
|
|
6313
|
-
return s.replace(
|
|
6321
|
+
return s.replace(So, mo).replace(To, bo).replace(Hs, `Bearer ${$}`).replace(Bs, `Basic ${$}`).replace(Fs, $).replace(Ws, (e, t) => `${t}: ${Be}`);
|
|
6314
6322
|
}
|
|
6315
|
-
function
|
|
6316
|
-
return s.replace(
|
|
6323
|
+
function Mo(s) {
|
|
6324
|
+
return s.replace(Hs, `Bearer ${$}`).replace(Bs, `Basic ${$}`).replace(Fs, $).replace(Ws, (e, t) => `${t}: ${Be}`);
|
|
6317
6325
|
}
|
|
6318
|
-
function
|
|
6319
|
-
const e = s.match(
|
|
6320
|
-
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}`;
|
|
6321
6329
|
}
|
|
6322
|
-
const
|
|
6330
|
+
const Do = Object.freeze({
|
|
6323
6331
|
init: (s) => Ne.init(s)
|
|
6324
6332
|
});
|
|
6325
|
-
function
|
|
6333
|
+
function qo(s) {
|
|
6326
6334
|
return Ne.init(s);
|
|
6327
6335
|
}
|
|
6328
6336
|
export {
|
|
6329
6337
|
Ht as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
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,
|
|
6336
6344
|
xt as ProductAgentQueryController,
|
|
6337
|
-
|
|
6345
|
+
vo as ProductAgentRemoteRuntimeClient,
|
|
6338
6346
|
Ne as ProductAgentSessionEngine,
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6347
|
+
En as ProductAgentSessionHistoryManager,
|
|
6348
|
+
Co as ProductAgentTaskPageTitleController,
|
|
6349
|
+
X as ProductAgentTokenProviderError,
|
|
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,
|
|
6360
|
+
ke as normalizeProductAgentEntityPage,
|
|
6353
6361
|
st as normalizeProductAgentSessionItems,
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6362
|
+
Pn as readLocalStorageInteractionDecisions,
|
|
6363
|
+
Eo as resolveProductAgentComposerAction,
|
|
6364
|
+
Ro as resolveProductAgentWidgetPresentation,
|
|
6365
|
+
Ss as selectProductAgentQueryEntities,
|
|
6366
|
+
Jr as validateProductAgentProviderInputFile
|
|
6359
6367
|
};
|