@pluno/product-agent-web 0.1.214 → 0.1.215
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Js {
|
|
2
2
|
constructor(e, t, n) {
|
|
3
3
|
this.handlers = e, this.accept = t, this.errorAdapter = n;
|
|
4
4
|
}
|
|
@@ -37,7 +37,7 @@ class Qs {
|
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
class
|
|
40
|
+
class Xs {
|
|
41
41
|
state;
|
|
42
42
|
reducer;
|
|
43
43
|
selector;
|
|
@@ -47,7 +47,7 @@ class Js {
|
|
|
47
47
|
draining = !1;
|
|
48
48
|
disposed = !1;
|
|
49
49
|
constructor(e) {
|
|
50
|
-
this.state = e.initialState, this.reducer = e.reducer, this.selector = e.selector, this.effectRunner = new
|
|
50
|
+
this.state = e.initialState, this.reducer = e.reducer, this.selector = e.selector, this.effectRunner = new Js(
|
|
51
51
|
e.effectHandlers,
|
|
52
52
|
(t) => this.acceptEffectResult(t),
|
|
53
53
|
e.errorAdapter
|
|
@@ -117,7 +117,7 @@ function it(s) {
|
|
|
117
117
|
const e = Object.getPrototypeOf(s);
|
|
118
118
|
return e !== Object.prototype && e !== null ? !1 : Object.values(s).every(it);
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function Ys(s) {
|
|
121
121
|
if (s.details !== void 0 && !it(s.details))
|
|
122
122
|
throw new TypeError("Product Agent transported error details must be JSON-safe.");
|
|
123
123
|
return {
|
|
@@ -127,7 +127,7 @@ function Xs(s) {
|
|
|
127
127
|
...s.details === void 0 ? {} : { details: s.details }
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
|
-
const
|
|
130
|
+
const Zs = Object.freeze({
|
|
131
131
|
modelSelection: "legacy",
|
|
132
132
|
directory: "legacy",
|
|
133
133
|
conversation: "legacy",
|
|
@@ -136,18 +136,18 @@ const Ys = Object.freeze({
|
|
|
136
136
|
browserExecution: "legacy"
|
|
137
137
|
});
|
|
138
138
|
function Ut(s, e) {
|
|
139
|
-
const t =
|
|
139
|
+
const t = Zs[s], n = e[t];
|
|
140
140
|
if (!n) throw new Error(`No ${t} implementation for ${s}.`);
|
|
141
141
|
return n();
|
|
142
142
|
}
|
|
143
|
-
class
|
|
143
|
+
class en {
|
|
144
144
|
// Stage 3 installs the Stage 1 engine/runner without shadow copies of legacy product slices.
|
|
145
|
-
engine = new
|
|
145
|
+
engine = new Xs({
|
|
146
146
|
initialState: Object.freeze({ revision: 0, slices: Object.freeze({}) }),
|
|
147
147
|
reducer: (e) => ({ state: e, effects: [] }),
|
|
148
148
|
selector: (e) => e,
|
|
149
149
|
effectHandlers: {},
|
|
150
|
-
errorAdapter: (e) =>
|
|
150
|
+
errorAdapter: (e) => Ys({
|
|
151
151
|
code: "runtime_error",
|
|
152
152
|
message: e instanceof Error ? e.message : String(e),
|
|
153
153
|
retryable: !1
|
|
@@ -169,16 +169,16 @@ class Zs {
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
const Dt = 500;
|
|
172
|
-
function
|
|
172
|
+
function ms(s) {
|
|
173
173
|
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();
|
|
174
174
|
return e.length > Dt ? `${e.slice(0, Dt - 1)}…` : e;
|
|
175
175
|
}
|
|
176
|
-
const
|
|
177
|
-
async function
|
|
176
|
+
const tn = "pluno-product-agent-attachments", sn = 1, rt = "files", nn = 1440 * 60 * 1e3;
|
|
177
|
+
async function rn(s) {
|
|
178
178
|
const e = await yt();
|
|
179
|
-
await
|
|
179
|
+
await ln(e, "readwrite", (t) => t.put(s));
|
|
180
180
|
}
|
|
181
|
-
async function
|
|
181
|
+
async function on(s, e) {
|
|
182
182
|
const t = await yt();
|
|
183
183
|
await It(t, "readwrite", async (n) => {
|
|
184
184
|
const i = await St(
|
|
@@ -190,7 +190,7 @@ async function rn(s, e) {
|
|
|
190
190
|
});
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
|
-
async function
|
|
193
|
+
async function an(s = nn) {
|
|
194
194
|
const e = await yt(), t = Date.now() - s;
|
|
195
195
|
await It(e, "readwrite", async (n) => {
|
|
196
196
|
const i = n.index("lastUsedAt");
|
|
@@ -199,14 +199,14 @@ async function on(s = sn) {
|
|
|
199
199
|
}
|
|
200
200
|
function yt() {
|
|
201
201
|
return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((s, e) => {
|
|
202
|
-
const t = indexedDB.open(
|
|
202
|
+
const t = indexedDB.open(tn, sn);
|
|
203
203
|
t.onupgradeneeded = () => {
|
|
204
204
|
const i = t.result.createObjectStore(rt, { keyPath: "attachmentId" });
|
|
205
205
|
i.createIndex("lastUsedAt", "lastUsedAt", { unique: !1 }), i.createIndex("sessionId", "sessionId", { unique: !1 }), i.createIndex("origin", "origin", { unique: !1 });
|
|
206
206
|
}, t.onsuccess = () => s(t.result), t.onerror = () => e(t.error ?? new Error("Failed to open Product Agent attachment storage"));
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
|
-
async function
|
|
209
|
+
async function ln(s, e, t) {
|
|
210
210
|
return await It(s, e, async (n) => await St(t(n)));
|
|
211
211
|
}
|
|
212
212
|
function It(s, e, t) {
|
|
@@ -236,11 +236,11 @@ function St(s) {
|
|
|
236
236
|
s.onsuccess = () => e(s.result), s.onerror = () => t(s.error ?? new Error("Product Agent attachment storage request failed"));
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function cn(s) {
|
|
240
240
|
return s !== null && (typeof s == "object" || typeof s == "function");
|
|
241
241
|
}
|
|
242
|
-
function
|
|
243
|
-
const n = Reflect.get(s, "pluno"), i =
|
|
242
|
+
function ys(s, e, t) {
|
|
243
|
+
const n = Reflect.get(s, "pluno"), i = cn(n) ? n : {};
|
|
244
244
|
if (i !== n && !Reflect.set(s, "pluno", i))
|
|
245
245
|
return null;
|
|
246
246
|
const r = Object.getOwnPropertyDescriptor(i, e);
|
|
@@ -254,20 +254,20 @@ function ms(s, e, t) {
|
|
|
254
254
|
}
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
|
-
const
|
|
257
|
+
const un = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
|
|
258
258
|
function qt(s, e) {
|
|
259
259
|
return e ? s.replace(
|
|
260
|
-
|
|
260
|
+
un,
|
|
261
261
|
(t, n, i, r) => `${n}${new URL(i, e).toString()}${r}`
|
|
262
262
|
) : s;
|
|
263
263
|
}
|
|
264
264
|
const Tt = "suggest_share_on_socials";
|
|
265
|
-
function
|
|
265
|
+
function dn(s) {
|
|
266
266
|
for (let e = s.length - 1; e >= 0; e -= 1) {
|
|
267
267
|
const t = s[e];
|
|
268
268
|
if (t.role !== "tool" || t.toolName !== Tt || t.sharePromptAllowed !== void 0)
|
|
269
269
|
continue;
|
|
270
|
-
if (
|
|
270
|
+
if (pn(s, e, t.callId) !== !0)
|
|
271
271
|
return null;
|
|
272
272
|
const n = Ot(s, e, "assistant");
|
|
273
273
|
if (!n)
|
|
@@ -281,7 +281,7 @@ function un(s) {
|
|
|
281
281
|
}
|
|
282
282
|
return null;
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function hn(s) {
|
|
285
285
|
let e = s;
|
|
286
286
|
if (typeof s == "string")
|
|
287
287
|
try {
|
|
@@ -289,10 +289,10 @@ function dn(s) {
|
|
|
289
289
|
} catch {
|
|
290
290
|
return null;
|
|
291
291
|
}
|
|
292
|
-
const t =
|
|
292
|
+
const t = gn(e);
|
|
293
293
|
return t ? typeof t.showSharePrompt == "boolean" ? t.showSharePrompt : t.ok === !0 && typeof t.message == "string" && t.message.includes("social-sharing prompt") ? !0 : null : null;
|
|
294
294
|
}
|
|
295
|
-
function
|
|
295
|
+
function pn(s, e, t) {
|
|
296
296
|
if (!t)
|
|
297
297
|
return null;
|
|
298
298
|
for (let n = e + 1; n < s.length; n += 1) {
|
|
@@ -310,14 +310,14 @@ function Ot(s, e, t) {
|
|
|
310
310
|
}
|
|
311
311
|
return null;
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function gn(s) {
|
|
314
314
|
return s && typeof s == "object" && !Array.isArray(s) ? s : null;
|
|
315
315
|
}
|
|
316
|
-
const
|
|
317
|
-
function
|
|
318
|
-
return (s.type === "function_call" || s.type === "tool_call") && s.name ===
|
|
316
|
+
const fn = "save_runtime_captured_skill";
|
|
317
|
+
function mn(s) {
|
|
318
|
+
return (s.type === "function_call" || s.type === "tool_call") && s.name === fn;
|
|
319
319
|
}
|
|
320
|
-
function
|
|
320
|
+
function yn(s, e, t) {
|
|
321
321
|
const n = e.map((h) => ({ item: h, identity: t(h) })), i = new Set(
|
|
322
322
|
n.flatMap(
|
|
323
323
|
({ identity: h }) => h.isActivity && !h.isTransient ? h.activityKeys ?? [] : []
|
|
@@ -361,10 +361,10 @@ function xt(s, e, t, n) {
|
|
|
361
361
|
return !r.isActivity || !r.isTransient ? !0 : e !== null && r.respondsToUserMessageId !== void 0 ? r.respondsToUserMessageId !== e : t === null || r.runId !== t;
|
|
362
362
|
});
|
|
363
363
|
}
|
|
364
|
-
const Ke = "pluno.productAgent.transportId",
|
|
364
|
+
const Ke = "pluno.productAgent.transportId", In = "pluno.productAgent.transportIdentity", Ge = "pluno.productAgent.transportIdentity.event", Sn = 50, Tn = globalThis.setTimeout.bind(globalThis);
|
|
365
365
|
let le = null;
|
|
366
366
|
const Re = /* @__PURE__ */ new Set(), Ve = /* @__PURE__ */ new Map();
|
|
367
|
-
async function
|
|
367
|
+
async function wn(s = Is()) {
|
|
368
368
|
const e = s.randomUUID(), t = s.storage.getItem(Ke);
|
|
369
369
|
let n = t ?? s.randomUUID(), i = !1, r = !1;
|
|
370
370
|
const o = s.channel.subscribe((l) => {
|
|
@@ -402,9 +402,9 @@ async function Tn(s = ys()) {
|
|
|
402
402
|
}
|
|
403
403
|
};
|
|
404
404
|
}
|
|
405
|
-
async function
|
|
406
|
-
le || (le =
|
|
407
|
-
...
|
|
405
|
+
async function An(s = !1) {
|
|
406
|
+
le || (le = wn({
|
|
407
|
+
...Is(),
|
|
408
408
|
skipStoredIdentityCollisionCheck: s
|
|
409
409
|
}), le.then((i) => {
|
|
410
410
|
const r = (o) => {
|
|
@@ -412,7 +412,7 @@ async function wn(s = !1) {
|
|
|
412
412
|
};
|
|
413
413
|
window.addEventListener("pagehide", r);
|
|
414
414
|
}));
|
|
415
|
-
const e = await le, t =
|
|
415
|
+
const e = await le, t = bn();
|
|
416
416
|
Re.add(t);
|
|
417
417
|
let n = !1;
|
|
418
418
|
return {
|
|
@@ -423,21 +423,21 @@ async function wn(s = !1) {
|
|
|
423
423
|
}
|
|
424
424
|
};
|
|
425
425
|
}
|
|
426
|
-
function
|
|
426
|
+
function bn() {
|
|
427
427
|
let s = 0;
|
|
428
428
|
for (; Re.has(s); )
|
|
429
429
|
s += 1;
|
|
430
430
|
return s;
|
|
431
431
|
}
|
|
432
|
-
function
|
|
432
|
+
function Is() {
|
|
433
433
|
return {
|
|
434
|
-
storage:
|
|
435
|
-
channel:
|
|
434
|
+
storage: Mn(),
|
|
435
|
+
channel: Rn(),
|
|
436
436
|
randomUUID: () => crypto.randomUUID(),
|
|
437
|
-
settle: () => new Promise((s) =>
|
|
437
|
+
settle: () => new Promise((s) => Tn(s, Sn))
|
|
438
438
|
};
|
|
439
439
|
}
|
|
440
|
-
function
|
|
440
|
+
function Mn() {
|
|
441
441
|
return {
|
|
442
442
|
getItem: (s) => {
|
|
443
443
|
try {
|
|
@@ -455,9 +455,9 @@ function bn() {
|
|
|
455
455
|
}
|
|
456
456
|
};
|
|
457
457
|
}
|
|
458
|
-
function
|
|
458
|
+
function Rn() {
|
|
459
459
|
if (typeof BroadcastChannel < "u") {
|
|
460
|
-
const s = new BroadcastChannel(
|
|
460
|
+
const s = new BroadcastChannel(In);
|
|
461
461
|
return {
|
|
462
462
|
postMessage: (e) => s.postMessage(e),
|
|
463
463
|
subscribe: (e) => {
|
|
@@ -467,9 +467,9 @@ function Mn() {
|
|
|
467
467
|
close: () => s.close()
|
|
468
468
|
};
|
|
469
469
|
}
|
|
470
|
-
return
|
|
470
|
+
return kn();
|
|
471
471
|
}
|
|
472
|
-
function
|
|
472
|
+
function kn() {
|
|
473
473
|
const s = /* @__PURE__ */ new Set(), e = (t) => {
|
|
474
474
|
if (t.key !== Ge || !t.newValue)
|
|
475
475
|
return;
|
|
@@ -490,8 +490,8 @@ function Rn() {
|
|
|
490
490
|
}
|
|
491
491
|
};
|
|
492
492
|
}
|
|
493
|
-
const
|
|
494
|
-
function
|
|
493
|
+
const Ss = "schedule_follow_up";
|
|
494
|
+
function En(s) {
|
|
495
495
|
let e = s;
|
|
496
496
|
if (typeof e == "string")
|
|
497
497
|
try {
|
|
@@ -502,45 +502,45 @@ function kn(s) {
|
|
|
502
502
|
if (!e || typeof e != "object")
|
|
503
503
|
return null;
|
|
504
504
|
const t = e;
|
|
505
|
-
return t.ok !== !0 || t.toolName !==
|
|
505
|
+
return t.ok !== !0 || t.toolName !== Ss || typeof t.dueAt != "string" || Number.isNaN(Date.parse(t.dueAt)) ? null : {
|
|
506
506
|
id: typeof t.taskId == "string" && t.taskId ? t.taskId : null,
|
|
507
507
|
dueAt: t.dueAt
|
|
508
508
|
};
|
|
509
509
|
}
|
|
510
|
-
const
|
|
510
|
+
const Cn = [
|
|
511
511
|
{ value: "gpt-5.6-sol", label: "gpt-5.6-sol", price: "$$" },
|
|
512
512
|
{ value: "anthropic/claude-sonnet-5", label: "Claude Sonnet 5", price: "$$" },
|
|
513
513
|
{ value: "deepseek/deepseek-v4-flash", label: "DeepSeek V4 Flash", price: "$" }
|
|
514
|
-
],
|
|
514
|
+
], _n = [
|
|
515
515
|
{ value: "anthropic/claude-opus-5", label: "Claude Opus 5", price: "$$$" },
|
|
516
516
|
{ value: "gpt-5.6-terra", label: "gpt-5.6-terra", price: "$$" }
|
|
517
|
-
],
|
|
518
|
-
...
|
|
519
|
-
...
|
|
520
|
-
], Qe = (s) =>
|
|
517
|
+
], Pn = [
|
|
518
|
+
...Cn,
|
|
519
|
+
..._n
|
|
520
|
+
], Qe = (s) => Pn.some((e) => e.value === s);
|
|
521
521
|
function Lt(s, e) {
|
|
522
522
|
return s.filter((t, n) => {
|
|
523
523
|
const i = Nt(t);
|
|
524
|
-
return
|
|
524
|
+
return Ts(i) ? !s.slice(n + 1).some((r) => {
|
|
525
525
|
const o = Nt(r);
|
|
526
|
-
return
|
|
526
|
+
return ws(i, o) && As(i, o);
|
|
527
527
|
}) : !0;
|
|
528
528
|
});
|
|
529
529
|
}
|
|
530
|
-
function
|
|
530
|
+
function Ts(s) {
|
|
531
531
|
return s.type === "run_status" && s.status === "stopped" && s.reason === "task_tab_closed";
|
|
532
532
|
}
|
|
533
|
-
function
|
|
534
|
-
return s.reason === "task_tab_closed" &&
|
|
533
|
+
function vn(s, e) {
|
|
534
|
+
return s.reason === "task_tab_closed" && As(s, e) && ws(s, e);
|
|
535
535
|
}
|
|
536
536
|
function Nt(s) {
|
|
537
537
|
return s.data && typeof s.data == "object" ? s.data : {};
|
|
538
538
|
}
|
|
539
|
-
function
|
|
539
|
+
function ws(s, e) {
|
|
540
540
|
const t = typeof s.runId == "string" ? s.runId : null, n = typeof e.runId == "string" ? e.runId : null;
|
|
541
|
-
return t && n && t === n ? !1 : e.type === "message" ? e.role === "assistant" : e.type === "run_status" ? !
|
|
541
|
+
return t && n && t === n ? !1 : e.type === "message" ? e.role === "assistant" : e.type === "run_status" ? !Ts(e) : e.type === "run_error";
|
|
542
542
|
}
|
|
543
|
-
function
|
|
543
|
+
function As(s, e) {
|
|
544
544
|
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;
|
|
545
545
|
}
|
|
546
546
|
function ke(s) {
|
|
@@ -638,28 +638,28 @@ function Ee(s) {
|
|
|
638
638
|
nextCursor: s.nextCursor
|
|
639
639
|
};
|
|
640
640
|
}
|
|
641
|
-
function
|
|
641
|
+
function Un(s, e, t) {
|
|
642
642
|
if (t === "replace" || s === null) return e;
|
|
643
643
|
const n = { ...s.entitiesById, ...e.entitiesById }, i = [...s.ids];
|
|
644
644
|
for (const r of e.ids)
|
|
645
645
|
s.entitiesById[r] || i.push(r);
|
|
646
646
|
return { entitiesById: n, ids: i, nextCursor: e.nextCursor };
|
|
647
647
|
}
|
|
648
|
-
function
|
|
648
|
+
function bs(s) {
|
|
649
649
|
return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
|
|
650
650
|
}
|
|
651
|
-
function
|
|
651
|
+
function Lo(s) {
|
|
652
652
|
return s.visible ? s.minimized ? { state: "minimized" } : { state: s.open ? "visible_open" : "visible_closed" } : { state: "hidden" };
|
|
653
653
|
}
|
|
654
|
-
function
|
|
654
|
+
function Dn(s, e) {
|
|
655
655
|
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: [] };
|
|
656
656
|
}
|
|
657
|
-
function
|
|
657
|
+
function qn(s) {
|
|
658
658
|
if (!s || typeof s != "object") return !1;
|
|
659
659
|
const e = s.paidCreditFallbackModel;
|
|
660
660
|
return typeof e == "string" && e.length > 0;
|
|
661
661
|
}
|
|
662
|
-
function
|
|
662
|
+
function No(s) {
|
|
663
663
|
const e = s.hasDraftMessage || s.hasPreSubmittedAttachment;
|
|
664
664
|
return s.hasRunningAssistantTurn && !e ? {
|
|
665
665
|
action: "stop",
|
|
@@ -669,7 +669,7 @@ function xo(s) {
|
|
|
669
669
|
disabled: !e || !s.canSubmitMessage
|
|
670
670
|
};
|
|
671
671
|
}
|
|
672
|
-
class
|
|
672
|
+
class On {
|
|
673
673
|
constructor(e, t, n = 20) {
|
|
674
674
|
this.loadPage = t, this.limit = n, this.recentQuery = new Ht(
|
|
675
675
|
`${e}:recent`,
|
|
@@ -679,7 +679,7 @@ class qn {
|
|
|
679
679
|
nextCursor: r.nextCursor
|
|
680
680
|
}))
|
|
681
681
|
),
|
|
682
|
-
|
|
682
|
+
Un
|
|
683
683
|
), this.pinnedQuery = new Ht(
|
|
684
684
|
`${e}:pinned`,
|
|
685
685
|
async () => Ee({
|
|
@@ -712,7 +712,7 @@ class qn {
|
|
|
712
712
|
}) : null;
|
|
713
713
|
return {
|
|
714
714
|
key: e.key.slice(0, -7),
|
|
715
|
-
status:
|
|
715
|
+
status: xn(e, t),
|
|
716
716
|
data: a,
|
|
717
717
|
error: e.error ?? t.error,
|
|
718
718
|
requestId: Math.max(e.requestId, t.requestId),
|
|
@@ -821,7 +821,7 @@ class qn {
|
|
|
821
821
|
function Ie(s) {
|
|
822
822
|
return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
|
|
823
823
|
}
|
|
824
|
-
function
|
|
824
|
+
function xn(s, e) {
|
|
825
825
|
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";
|
|
826
826
|
}
|
|
827
827
|
class Bt {
|
|
@@ -868,7 +868,7 @@ class Bt {
|
|
|
868
868
|
this.schedule(r, e);
|
|
869
869
|
}
|
|
870
870
|
}
|
|
871
|
-
class
|
|
871
|
+
class Ln {
|
|
872
872
|
constructor(e) {
|
|
873
873
|
this.options = e;
|
|
874
874
|
}
|
|
@@ -920,7 +920,7 @@ class xn {
|
|
|
920
920
|
);
|
|
921
921
|
}
|
|
922
922
|
}
|
|
923
|
-
class
|
|
923
|
+
class Nn {
|
|
924
924
|
constructor(e, t = null) {
|
|
925
925
|
this.storage = e, t && (this.decisions = new Map(
|
|
926
926
|
t.filter(ot).map((n) => [this.getDecisionKey(n), n])
|
|
@@ -973,7 +973,7 @@ class Ln {
|
|
|
973
973
|
async applyAction(e, t, n) {
|
|
974
974
|
if (!e.allowedActions.includes(t))
|
|
975
975
|
throw new Error(`Interaction ${e.key} does not allow ${t}.`);
|
|
976
|
-
if (!
|
|
976
|
+
if (!Ms(t))
|
|
977
977
|
throw new Error(`Interaction action ${t} is not a persistence decision.`);
|
|
978
978
|
const i = n.now ?? /* @__PURE__ */ new Date(), r = {
|
|
979
979
|
promptKey: e.key,
|
|
@@ -1009,13 +1009,13 @@ class Ln {
|
|
|
1009
1009
|
return `${Je(e.scope)}:category:${e.category}`;
|
|
1010
1010
|
}
|
|
1011
1011
|
}
|
|
1012
|
-
function
|
|
1012
|
+
function Ho(s, e) {
|
|
1013
1013
|
return {
|
|
1014
|
-
load: async () =>
|
|
1014
|
+
load: async () => Hn(s, e),
|
|
1015
1015
|
save: async (t) => s.setItem(e, JSON.stringify(t))
|
|
1016
1016
|
};
|
|
1017
1017
|
}
|
|
1018
|
-
function
|
|
1018
|
+
function Hn(s, e) {
|
|
1019
1019
|
const t = s.getItem(e);
|
|
1020
1020
|
if (!t) return [];
|
|
1021
1021
|
const n = JSON.parse(t);
|
|
@@ -1024,26 +1024,26 @@ function Nn(s, e) {
|
|
|
1024
1024
|
function Je(s) {
|
|
1025
1025
|
return `${s.level}:${s.key}`;
|
|
1026
1026
|
}
|
|
1027
|
-
function
|
|
1027
|
+
function Ms(s) {
|
|
1028
1028
|
return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
|
|
1029
1029
|
}
|
|
1030
1030
|
function ot(s) {
|
|
1031
1031
|
if (!s || typeof s != "object") return !1;
|
|
1032
1032
|
const e = s;
|
|
1033
|
-
return typeof e.promptKey == "string" && typeof e.category == "string" && typeof e.decidedAt == "string" && (e.nextEligibleAt === null || typeof e.nextEligibleAt == "string") &&
|
|
1033
|
+
return typeof e.promptKey == "string" && typeof e.category == "string" && typeof e.decidedAt == "string" && (e.nextEligibleAt === null || typeof e.nextEligibleAt == "string") && Ms(e.action) && !!(e.scope && typeof e.scope == "object" && typeof e.scope.level == "string" && typeof e.scope.key == "string");
|
|
1034
1034
|
}
|
|
1035
|
-
const
|
|
1035
|
+
const Bn = {
|
|
1036
1036
|
working: "⏳",
|
|
1037
1037
|
completed: "✅",
|
|
1038
1038
|
failed: "❗",
|
|
1039
1039
|
stopped: "⏹️"
|
|
1040
|
-
},
|
|
1041
|
-
function
|
|
1040
|
+
}, Fn = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
|
|
1041
|
+
function Wn(s, e) {
|
|
1042
1042
|
if (!e) return ve(s);
|
|
1043
|
-
const t = ve(s), n = `${
|
|
1043
|
+
const t = ve(s), n = `${Bn[e]} Pluno`;
|
|
1044
1044
|
return t ? `${n}: ${t}` : n;
|
|
1045
1045
|
}
|
|
1046
|
-
class
|
|
1046
|
+
class Bo {
|
|
1047
1047
|
constructor(e) {
|
|
1048
1048
|
this.titleDocument = e;
|
|
1049
1049
|
}
|
|
@@ -1077,11 +1077,11 @@ class No {
|
|
|
1077
1077
|
applyTitle() {
|
|
1078
1078
|
if (!this.status)
|
|
1079
1079
|
return;
|
|
1080
|
-
const e =
|
|
1080
|
+
const e = Wn(this.baseTitle, this.status);
|
|
1081
1081
|
this.lastAppliedTitle = e, this.titleDocument.getTitle() !== e && this.titleDocument.setTitle(e);
|
|
1082
1082
|
}
|
|
1083
1083
|
}
|
|
1084
|
-
function
|
|
1084
|
+
function Fo(s) {
|
|
1085
1085
|
return {
|
|
1086
1086
|
getTitle: () => s.title,
|
|
1087
1087
|
setTitle: (e) => {
|
|
@@ -1098,9 +1098,9 @@ function Ho(s) {
|
|
|
1098
1098
|
};
|
|
1099
1099
|
}
|
|
1100
1100
|
function ve(s) {
|
|
1101
|
-
return s.replace(
|
|
1101
|
+
return s.replace(Fn, "");
|
|
1102
1102
|
}
|
|
1103
|
-
const
|
|
1103
|
+
const $n = {
|
|
1104
1104
|
"duplicate-message-item": "A canonical message rendered more than once.",
|
|
1105
1105
|
"duplicate-canonical-item": "A canonical session item rendered more than once.",
|
|
1106
1106
|
"duplicate-tool-call": "A tool call rendered more than once.",
|
|
@@ -1113,10 +1113,21 @@ const Wn = {
|
|
|
1113
1113
|
"thinking-groups-without-user-message": "Multiple thinking groups appeared without a user message between them.",
|
|
1114
1114
|
"thinking-without-progress": "Thinking remained visible without progress for five minutes."
|
|
1115
1115
|
};
|
|
1116
|
-
function
|
|
1117
|
-
return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(
|
|
1116
|
+
function jn(s) {
|
|
1117
|
+
return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call($n, s.slice(13));
|
|
1118
|
+
}
|
|
1119
|
+
function Ft(s) {
|
|
1120
|
+
return {
|
|
1121
|
+
...s.id === void 0 ? {} : { id: s.id },
|
|
1122
|
+
name: s.name,
|
|
1123
|
+
mimeType: s.mimeType,
|
|
1124
|
+
sizeBytes: s.sizeBytes,
|
|
1125
|
+
...s.sandboxPath === void 0 ? {} : { sandboxPath: s.sandboxPath },
|
|
1126
|
+
...s.storageKey === void 0 ? {} : { storageKey: s.storageKey },
|
|
1127
|
+
...s.fileUrl === void 0 ? {} : { fileUrl: s.fileUrl }
|
|
1128
|
+
};
|
|
1118
1129
|
}
|
|
1119
|
-
function
|
|
1130
|
+
function Wo(s) {
|
|
1120
1131
|
if (!s || typeof s != "object" || !("type" in s)) return !1;
|
|
1121
1132
|
const e = s;
|
|
1122
1133
|
switch (e.type) {
|
|
@@ -1130,7 +1141,7 @@ function Bo(s) {
|
|
|
1130
1141
|
case "runtime.report_displayed_error":
|
|
1131
1142
|
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);
|
|
1132
1143
|
case "runtime.report_invalid_state_transition":
|
|
1133
|
-
return (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" ||
|
|
1144
|
+
return (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" || jn(e.reason)) && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
|
|
1134
1145
|
case "runtime.widget_lifecycle":
|
|
1135
1146
|
return (e.action === "opened" || e.action === "closed" || e.action === "minimized") && typeof e.trigger == "string";
|
|
1136
1147
|
case "session.load":
|
|
@@ -1157,7 +1168,7 @@ function Bo(s) {
|
|
|
1157
1168
|
return !1;
|
|
1158
1169
|
}
|
|
1159
1170
|
}
|
|
1160
|
-
class
|
|
1171
|
+
class $o {
|
|
1161
1172
|
constructor(e, t, n) {
|
|
1162
1173
|
this.adapter = t, this.state = Xe(e), this.model = n;
|
|
1163
1174
|
}
|
|
@@ -1187,16 +1198,24 @@ class Fo {
|
|
|
1187
1198
|
if (!this.destroyed) {
|
|
1188
1199
|
this.state = Xe(e);
|
|
1189
1200
|
for (const [o, a] of this.unacknowledgedSubmissions) {
|
|
1190
|
-
if (e.user?.id !== a.userId || a.sessionId !== null && e.sessionId !== a.sessionId
|
|
1191
|
-
(l) => l.clientMessageId === o
|
|
1192
|
-
)) {
|
|
1201
|
+
if (e.user?.id !== a.userId || a.sessionId !== null && e.sessionId !== a.sessionId) {
|
|
1193
1202
|
this.unacknowledgedSubmissions.delete(o);
|
|
1194
1203
|
continue;
|
|
1195
1204
|
}
|
|
1205
|
+
const l = this.state.messages.find(
|
|
1206
|
+
(c) => c.clientMessageId === o
|
|
1207
|
+
);
|
|
1208
|
+
if (l) {
|
|
1209
|
+
l.attachments = zn(
|
|
1210
|
+
a.message.attachments,
|
|
1211
|
+
l.attachments
|
|
1212
|
+
), this.unacknowledgedSubmissions.delete(o);
|
|
1213
|
+
continue;
|
|
1214
|
+
}
|
|
1196
1215
|
a.sessionId ??= e.sessionId, this.state.messages.push(a.message), this.state.pendingMessageStatus = "sending", this.state.turnPhase ??= "sending", this.state.taskStatus ??= "working";
|
|
1197
1216
|
}
|
|
1198
1217
|
if (t !== void 0 && (this.model = t), n) {
|
|
1199
|
-
this.sessionHistoryState =
|
|
1218
|
+
this.sessionHistoryState = Wt(n);
|
|
1200
1219
|
for (const o of this.sessionHistoryListeners)
|
|
1201
1220
|
o(this.getSessionHistoryState());
|
|
1202
1221
|
}
|
|
@@ -1241,7 +1260,7 @@ class Fo {
|
|
|
1241
1260
|
type: "runtime.report_displayed_error",
|
|
1242
1261
|
reason: e,
|
|
1243
1262
|
errorFingerprint: t,
|
|
1244
|
-
...n ? { displayedMessage:
|
|
1263
|
+
...n ? { displayedMessage: ms(n) } : {}
|
|
1245
1264
|
}).catch(() => {
|
|
1246
1265
|
});
|
|
1247
1266
|
}
|
|
@@ -1283,7 +1302,8 @@ class Fo {
|
|
|
1283
1302
|
content: i,
|
|
1284
1303
|
clientMessageId: r,
|
|
1285
1304
|
proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
|
|
1286
|
-
|
|
1305
|
+
// Preview URLs belong to the renderer's optimistic snapshot and are not valid runtime-command metadata.
|
|
1306
|
+
attachments: o.length > 0 ? o.map(Ft) : void 0,
|
|
1287
1307
|
submittedAt: t.submittedAt
|
|
1288
1308
|
}), a = !0, o.length > 0) {
|
|
1289
1309
|
if (!this.adapter.uploadAttachment)
|
|
@@ -1308,7 +1328,7 @@ class Fo {
|
|
|
1308
1328
|
invocation: t.invocation,
|
|
1309
1329
|
proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
|
|
1310
1330
|
...t.automationOnboarding ? { automationOnboarding: !0 } : {},
|
|
1311
|
-
attachments: o.length > 0 ? o : void 0
|
|
1331
|
+
attachments: o.length > 0 ? o.map(Ft) : void 0
|
|
1312
1332
|
});
|
|
1313
1333
|
for (const c of t.attachments ?? [])
|
|
1314
1334
|
c.id && this.attachmentFiles.delete(c.id);
|
|
@@ -1361,12 +1381,12 @@ class Fo {
|
|
|
1361
1381
|
await this.dispatch({ type: "session.list", ...e });
|
|
1362
1382
|
const t = this.sessionHistoryState.data;
|
|
1363
1383
|
return {
|
|
1364
|
-
sessions:
|
|
1384
|
+
sessions: bs(t),
|
|
1365
1385
|
nextCursor: t?.nextCursor ?? null
|
|
1366
1386
|
};
|
|
1367
1387
|
}
|
|
1368
1388
|
getSessionHistoryState() {
|
|
1369
|
-
return
|
|
1389
|
+
return Wt(this.sessionHistoryState);
|
|
1370
1390
|
}
|
|
1371
1391
|
subscribeSessionHistory(e) {
|
|
1372
1392
|
return this.sessionHistoryListeners.add(e), e(this.getSessionHistoryState()), () => this.sessionHistoryListeners.delete(e);
|
|
@@ -1445,6 +1465,18 @@ class Fo {
|
|
|
1445
1465
|
for (const i of n ?? []) i(t);
|
|
1446
1466
|
}
|
|
1447
1467
|
}
|
|
1468
|
+
function zn(s, e) {
|
|
1469
|
+
if (!e || !s) return e;
|
|
1470
|
+
const t = /* @__PURE__ */ new Map();
|
|
1471
|
+
for (const n of s) {
|
|
1472
|
+
const i = n.previewUrl;
|
|
1473
|
+
n.id && i && t.set(n.id, i);
|
|
1474
|
+
}
|
|
1475
|
+
return e.map((n) => {
|
|
1476
|
+
const i = n.id ? t.get(n.id) : void 0;
|
|
1477
|
+
return i ? { ...n, previewUrl: i } : n;
|
|
1478
|
+
});
|
|
1479
|
+
}
|
|
1448
1480
|
function Xe(s) {
|
|
1449
1481
|
return {
|
|
1450
1482
|
...s,
|
|
@@ -1469,16 +1501,16 @@ function Xe(s) {
|
|
|
1469
1501
|
activeScheduledFollowUps: s.activeScheduledFollowUps?.map((e) => ({ ...e })) ?? null
|
|
1470
1502
|
};
|
|
1471
1503
|
}
|
|
1472
|
-
function
|
|
1504
|
+
function Wt(s) {
|
|
1473
1505
|
return {
|
|
1474
1506
|
...s,
|
|
1475
1507
|
data: s.data ? Ee({
|
|
1476
|
-
entities:
|
|
1508
|
+
entities: bs(s.data).map((e) => ({ ...e })),
|
|
1477
1509
|
nextCursor: s.data.nextCursor
|
|
1478
1510
|
}) : null
|
|
1479
1511
|
};
|
|
1480
1512
|
}
|
|
1481
|
-
const
|
|
1513
|
+
const Kn = globalThis.fetch.bind(globalThis), $t = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', Gn = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Vn = ".pluno-pa-widget__panel", Qn = ".pluno-pa-widget__timeline", Jn = "__plunoExtensionWidgetOwner";
|
|
1482
1514
|
class J extends Error {
|
|
1483
1515
|
constructor(e, t, n, i) {
|
|
1484
1516
|
super(e), this.retryable = t, this.status = n, this.retryAfterMs = i, this.name = "ProductAgentTokenProviderError";
|
|
@@ -1487,11 +1519,11 @@ class J extends Error {
|
|
|
1487
1519
|
status;
|
|
1488
1520
|
retryAfterMs;
|
|
1489
1521
|
}
|
|
1490
|
-
function
|
|
1522
|
+
function Xn(s) {
|
|
1491
1523
|
return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
|
|
1492
1524
|
}
|
|
1493
|
-
let
|
|
1494
|
-
function
|
|
1525
|
+
let Yn = 0;
|
|
1526
|
+
function jt(s) {
|
|
1495
1527
|
const e = {};
|
|
1496
1528
|
for (const l of [
|
|
1497
1529
|
"type",
|
|
@@ -1569,7 +1601,7 @@ function Se(s, e, t) {
|
|
|
1569
1601
|
source: "web_sdk",
|
|
1570
1602
|
category: s,
|
|
1571
1603
|
name: e,
|
|
1572
|
-
sequence: ++
|
|
1604
|
+
sequence: ++Yn,
|
|
1573
1605
|
wallTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1574
1606
|
monotonicMs: performance.now(),
|
|
1575
1607
|
data: t
|
|
@@ -1578,27 +1610,27 @@ function Se(s, e, t) {
|
|
|
1578
1610
|
}
|
|
1579
1611
|
class Te extends Error {
|
|
1580
1612
|
}
|
|
1581
|
-
function
|
|
1613
|
+
function Zn(s) {
|
|
1582
1614
|
return s === 408 || s === 425 || s === 429 || s >= 500;
|
|
1583
1615
|
}
|
|
1584
|
-
const
|
|
1616
|
+
const ei = "https://app.pluno.ai", ti = 2e4, si = 1e4, ni = 6e4, ii = 6e4, ri = 1e4, oi = 1e4, ai = 3e3, li = 3e4, ci = 1e3, at = 3e4, zt = 0.2, ui = 6e4, Kt = 15e3, di = 6e4, hi = 8, pi = "Browser connection was interrupted.", Gt = 15e3, gi = "Pluno could not send this message. Try it again.", fi = "Still connecting to Pluno. Retrying automatically.", mi = 2e3, yi = 1e3, Ii = 100, Vt = 8e3, Qt = 3, Si = [300, 1e3], Rs = 50 * 1024 * 1024, Ti = /* @__PURE__ */ new Set([
|
|
1585
1617
|
".jpeg:image/jpeg",
|
|
1586
1618
|
".jpg:image/jpeg",
|
|
1587
1619
|
".pdf:application/pdf",
|
|
1588
1620
|
".png:image/png",
|
|
1589
1621
|
".webp:image/webp"
|
|
1590
|
-
]),
|
|
1591
|
-
function
|
|
1622
|
+
]), jo = ".pdf,.png,.jpg,.jpeg,.webp", wt = 64e3, Ye = 4e3, At = 30, wi = 2e3, Ai = 1e3, ks = "Image is too large for model vision input.", bi = 100, Mi = 20, Es = "pluno.productAgent.state.", lt = "pluno.productAgent.pendingEvents.", Le = "pluno.productAgent.activeToolCalls.", Ri = 100;
|
|
1623
|
+
function ki(s, e = 0) {
|
|
1592
1624
|
const t = s === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (s - 1));
|
|
1593
1625
|
return Math.max(e, t);
|
|
1594
1626
|
}
|
|
1595
1627
|
const Ce = /* @__PURE__ */ new Set();
|
|
1596
1628
|
let we = null;
|
|
1597
|
-
function
|
|
1598
|
-
const t = Math.min(at,
|
|
1629
|
+
function Ei(s, e = Math.random) {
|
|
1630
|
+
const t = Math.min(at, ci * 2 ** s), n = 1 - zt + e() * zt * 2;
|
|
1599
1631
|
return Math.min(at, Math.round(t * n));
|
|
1600
1632
|
}
|
|
1601
|
-
function
|
|
1633
|
+
function Ci(s) {
|
|
1602
1634
|
const e = s.split(".")[1];
|
|
1603
1635
|
if (!e)
|
|
1604
1636
|
return null;
|
|
@@ -1609,7 +1641,7 @@ function ki(s) {
|
|
|
1609
1641
|
return null;
|
|
1610
1642
|
}
|
|
1611
1643
|
}
|
|
1612
|
-
function
|
|
1644
|
+
function _i(s) {
|
|
1613
1645
|
if (s instanceof J)
|
|
1614
1646
|
return s.retryable;
|
|
1615
1647
|
if (s && typeof s == "object") {
|
|
@@ -1619,7 +1651,7 @@ function Ei(s) {
|
|
|
1619
1651
|
}
|
|
1620
1652
|
return !0;
|
|
1621
1653
|
}
|
|
1622
|
-
function
|
|
1654
|
+
function Pi(s) {
|
|
1623
1655
|
if (s instanceof Error)
|
|
1624
1656
|
return s;
|
|
1625
1657
|
if (s && typeof s == "object") {
|
|
@@ -1633,7 +1665,7 @@ function Ci(s) {
|
|
|
1633
1665
|
}
|
|
1634
1666
|
class Ne {
|
|
1635
1667
|
constructor(e, t) {
|
|
1636
|
-
this.options = e, this.transportIdentity = t, this.sessionHistoryManager = new
|
|
1668
|
+
this.options = e, this.transportIdentity = t, this.sessionHistoryManager = new On(
|
|
1637
1669
|
e.clientId,
|
|
1638
1670
|
async ({ cursor: r, limit: o, pinned: a }) => await this.listSessions({ cursor: r, limit: o, pinned: a })
|
|
1639
1671
|
), this.sessionRecoveryPoller = new Bt({
|
|
@@ -1648,7 +1680,7 @@ class Ne {
|
|
|
1648
1680
|
activeIntervalMs: 3e3,
|
|
1649
1681
|
idleIntervalMs: 15e3,
|
|
1650
1682
|
maxFailureIntervalMs: 3e4
|
|
1651
|
-
}), this.sessionActivityRecovery = new
|
|
1683
|
+
}), this.sessionActivityRecovery = new Ln({
|
|
1652
1684
|
fetchPage: async (r, o) => await this.fetchSessionHistoryPageOnce(
|
|
1653
1685
|
r,
|
|
1654
1686
|
"activity",
|
|
@@ -1676,9 +1708,9 @@ class Ne {
|
|
|
1676
1708
|
maxFailureIntervalMs: 3e4
|
|
1677
1709
|
}), this.personalModelSelectionOverride = e.productVariant === "personal" && Qe(e.model) ? e.model : null, this.state = {
|
|
1678
1710
|
...this.state,
|
|
1679
|
-
starterPrompts:
|
|
1711
|
+
starterPrompts: dr(e.initialStarterPrompts)
|
|
1680
1712
|
}, this.account = e.initialAccount ? { ...e.initialAccount } : null;
|
|
1681
|
-
const n = e.restorePersistedState === !1 ? null :
|
|
1713
|
+
const n = e.restorePersistedState === !1 ? null : to(e.clientId, e.expectedPersistedSessionId);
|
|
1682
1714
|
n && (this.state = {
|
|
1683
1715
|
...this.state,
|
|
1684
1716
|
...n,
|
|
@@ -1699,9 +1731,9 @@ class Ne {
|
|
|
1699
1731
|
taskStatus: null,
|
|
1700
1732
|
isRetrying: !1,
|
|
1701
1733
|
lastError: null
|
|
1702
|
-
}, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents =
|
|
1703
|
-
|
|
1704
|
-
|
|
1734
|
+
}, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents = ao(
|
|
1735
|
+
no(e.clientId),
|
|
1736
|
+
io(e.clientId)
|
|
1705
1737
|
);
|
|
1706
1738
|
const i = [...this.queuedClientEvents].reverse().find(
|
|
1707
1739
|
(r) => r.type === "chat.user_message" && typeof r.clientMessageId == "string"
|
|
@@ -1709,7 +1741,7 @@ class Ne {
|
|
|
1709
1741
|
i?.clientMessageId && (this.pendingClientMessageId = i.clientMessageId, this.pendingUserMessageEvent = i, this.state.pendingMessageStatus = "reconnecting", this.state.turnPhase = "sending"), Q(e.clientId, this.queuedClientEvents);
|
|
1710
1742
|
}
|
|
1711
1743
|
options;
|
|
1712
|
-
clientRuntime = new
|
|
1744
|
+
clientRuntime = new en();
|
|
1713
1745
|
listeners = {};
|
|
1714
1746
|
socket = null;
|
|
1715
1747
|
reconnectTimer = null;
|
|
@@ -1748,7 +1780,7 @@ class Ne {
|
|
|
1748
1780
|
accountRefresh = null;
|
|
1749
1781
|
runtimeInteractions = [];
|
|
1750
1782
|
interactionListeners = /* @__PURE__ */ new Set();
|
|
1751
|
-
interactionManager = new
|
|
1783
|
+
interactionManager = new Nn(
|
|
1752
1784
|
{ load: async () => [], save: async () => {
|
|
1753
1785
|
} },
|
|
1754
1786
|
[]
|
|
@@ -1848,17 +1880,17 @@ class Ne {
|
|
|
1848
1880
|
lastErrorSecuritySettingsUrl: null
|
|
1849
1881
|
};
|
|
1850
1882
|
static async init(e) {
|
|
1851
|
-
const t = e, n = await
|
|
1883
|
+
const t = e, n = await An(
|
|
1852
1884
|
t.skipStoredTransportIdentityCollisionCheck === !0
|
|
1853
1885
|
), i = new Ne({
|
|
1854
1886
|
...e,
|
|
1855
|
-
backendUrl:
|
|
1856
|
-
clientId: e.clientId ??
|
|
1887
|
+
backendUrl: Ji(e.backendUrl ?? ei),
|
|
1888
|
+
clientId: e.clientId ?? mr(),
|
|
1857
1889
|
productVariant: e.productVariant ?? "customer_embedded",
|
|
1858
|
-
entrySurface:
|
|
1890
|
+
entrySurface: Xi(e.entrySurface)
|
|
1859
1891
|
}, n);
|
|
1860
1892
|
try {
|
|
1861
|
-
|
|
1893
|
+
an().catch((r) => {
|
|
1862
1894
|
M("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
|
|
1863
1895
|
message: r instanceof Error ? r.message : String(r)
|
|
1864
1896
|
});
|
|
@@ -1906,7 +1938,7 @@ class Ne {
|
|
|
1906
1938
|
return this.options.token;
|
|
1907
1939
|
if (!this.options.tokenProvider)
|
|
1908
1940
|
return this.token;
|
|
1909
|
-
const n = Date.now(), i = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs -
|
|
1941
|
+
const n = Date.now(), i = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs - ii > n;
|
|
1910
1942
|
if (!t.forceRefresh && (i || t.preferCached && this.token !== null))
|
|
1911
1943
|
return this.token;
|
|
1912
1944
|
if (this.tokenRequest && !t.forceRefresh)
|
|
@@ -1919,7 +1951,7 @@ class Ne {
|
|
|
1919
1951
|
const l = new Promise((c, u) => {
|
|
1920
1952
|
a = window.setTimeout(() => {
|
|
1921
1953
|
r.abort(), u(new J("Pluno token provider timed out", !0));
|
|
1922
|
-
},
|
|
1954
|
+
}, ni);
|
|
1923
1955
|
});
|
|
1924
1956
|
try {
|
|
1925
1957
|
const c = await Promise.race([
|
|
@@ -1930,7 +1962,7 @@ class Ne {
|
|
|
1930
1962
|
throw new J("Pluno token request was cancelled", !0);
|
|
1931
1963
|
if (!c)
|
|
1932
1964
|
throw new J("Pluno token provider did not return a token", !1);
|
|
1933
|
-
return this.token = c, this.tokenExpiresAtMs =
|
|
1965
|
+
return this.token = c, this.tokenExpiresAtMs = Ci(c), c;
|
|
1934
1966
|
} finally {
|
|
1935
1967
|
a !== null && window.clearTimeout(a);
|
|
1936
1968
|
}
|
|
@@ -1956,10 +1988,10 @@ class Ne {
|
|
|
1956
1988
|
return;
|
|
1957
1989
|
if (!this.token && !this.options.webSocketFactory)
|
|
1958
1990
|
throw new J("Pluno requires a token or tokenProvider", !1);
|
|
1959
|
-
const t =
|
|
1991
|
+
const t = er(this.options.backendUrl), n = this.options.webSocketFactory?.(t) ?? new WebSocket(t);
|
|
1960
1992
|
this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
|
|
1961
1993
|
this.socket === n && n.readyState === WebSocket.CONNECTING && (M("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.reportTransportDiagnostic("connect_timeout"), this.replaceTimedOutSocket(n));
|
|
1962
|
-
},
|
|
1994
|
+
}, ri), n.addEventListener("open", () => {
|
|
1963
1995
|
this.socket !== n || (this.clearSocketConnectTimer(), M("web-sdk.agent", "Pluno socket opened", {
|
|
1964
1996
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
1965
1997
|
isThinking: this.state.isThinking
|
|
@@ -1971,13 +2003,13 @@ class Ne {
|
|
|
1971
2003
|
pageUrl: location.href
|
|
1972
2004
|
}) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
|
|
1973
2005
|
this.socket === n && (M("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.reportTransportDiagnostic("auth_timeout"), this.replaceTimedOutSocket(n));
|
|
1974
|
-
},
|
|
2006
|
+
}, oi));
|
|
1975
2007
|
}), n.addEventListener("message", (i) => {
|
|
1976
|
-
this.socket === n && this.handleServerEvent(
|
|
2008
|
+
this.socket === n && this.handleServerEvent(cr(i.data));
|
|
1977
2009
|
}), n.addEventListener("sendfailure", (i) => {
|
|
1978
2010
|
if (this.socket !== n)
|
|
1979
2011
|
return;
|
|
1980
|
-
const r =
|
|
2012
|
+
const r = ur(i?.detail?.data);
|
|
1981
2013
|
r?.type === "chat.user_message" && r.clientMessageId === this.pendingClientMessageId && !this.queuedClientEvents.some(
|
|
1982
2014
|
(o) => o.type === "chat.user_message" && o.clientMessageId === r.clientMessageId
|
|
1983
2015
|
) && (this.queuedClientEvents.push(r), Q(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();
|
|
@@ -2001,14 +2033,14 @@ class Ne {
|
|
|
2001
2033
|
} catch (t) {
|
|
2002
2034
|
if (e !== this.connectionAttemptId || this.state.status === "closed")
|
|
2003
2035
|
return;
|
|
2004
|
-
const n =
|
|
2005
|
-
if (
|
|
2036
|
+
const n = Pi(t);
|
|
2037
|
+
if (_i(t)) {
|
|
2006
2038
|
M("web-sdk.agent", "Pluno connection attempt failed; retrying", {
|
|
2007
2039
|
message: n.message,
|
|
2008
2040
|
reconnectAttempt: this.reconnectAttempts
|
|
2009
2041
|
}), t instanceof J && this.reportTransportDiagnostic("auth_timeout"), this.setState({
|
|
2010
2042
|
status: "reconnecting",
|
|
2011
|
-
lastError:
|
|
2043
|
+
lastError: fi,
|
|
2012
2044
|
lastErrorCode: "connection_failed"
|
|
2013
2045
|
}), this.emit("error", n), this.scheduleReconnect(
|
|
2014
2046
|
t instanceof J ? t.retryAfterMs : void 0
|
|
@@ -2032,7 +2064,7 @@ class Ne {
|
|
|
2032
2064
|
}
|
|
2033
2065
|
destroy() {
|
|
2034
2066
|
if (!this.clientRuntime.isDisposed) {
|
|
2035
|
-
this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(),
|
|
2067
|
+
this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), lo(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();
|
|
2036
2068
|
for (const e of Object.values(this.listeners))
|
|
2037
2069
|
e?.clear();
|
|
2038
2070
|
this.accountListeners.clear(), this.interactionListeners.clear(), this.clientRuntime.dispose();
|
|
@@ -2076,10 +2108,10 @@ class Ne {
|
|
|
2076
2108
|
async sendMessage(e, t = {}) {
|
|
2077
2109
|
return this.clientRuntime.route("conversation", { legacy: async () => {
|
|
2078
2110
|
const n = e.trim(), i = t.attachments ?? [];
|
|
2079
|
-
if (this.options.productVariant === "customer_embedded" && (i.forEach(
|
|
2111
|
+
if (this.options.productVariant === "customer_embedded" && (i.forEach(Bs), i.reduce(
|
|
2080
2112
|
(T, N) => T + N.sizeBytes,
|
|
2081
2113
|
0
|
|
2082
|
-
) >
|
|
2114
|
+
) > Rs))
|
|
2083
2115
|
throw new Error("Embedded attachments must total at most 50 MB per message");
|
|
2084
2116
|
let r = i.map(qe);
|
|
2085
2117
|
if (!n && r.length === 0)
|
|
@@ -2172,7 +2204,7 @@ class Ne {
|
|
|
2172
2204
|
sessionId: this.state.sessionId ?? void 0,
|
|
2173
2205
|
clientMessageId: a,
|
|
2174
2206
|
initiatedBy: t.initiatedBy,
|
|
2175
|
-
invocation:
|
|
2207
|
+
invocation: Yi(t.invocation ?? t.initiatedBy),
|
|
2176
2208
|
entrySurface: this.options.entrySurface,
|
|
2177
2209
|
content: n,
|
|
2178
2210
|
proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
|
|
@@ -2181,7 +2213,7 @@ class Ne {
|
|
|
2181
2213
|
page: o,
|
|
2182
2214
|
model: this.options.model,
|
|
2183
2215
|
metadata: {
|
|
2184
|
-
...
|
|
2216
|
+
...Jt(this.options.metadata),
|
|
2185
2217
|
...t.automationOnboarding ? { automationOnboarding: !0 } : {}
|
|
2186
2218
|
}
|
|
2187
2219
|
};
|
|
@@ -2198,7 +2230,7 @@ class Ne {
|
|
|
2198
2230
|
this.reportHealthSignal("user_visible_error", {
|
|
2199
2231
|
reason: e,
|
|
2200
2232
|
errorFingerprint: t,
|
|
2201
|
-
...n ? { displayedMessage:
|
|
2233
|
+
...n ? { displayedMessage: ms(n) } : {}
|
|
2202
2234
|
});
|
|
2203
2235
|
}
|
|
2204
2236
|
getModel() {
|
|
@@ -2227,7 +2259,7 @@ class Ne {
|
|
|
2227
2259
|
} });
|
|
2228
2260
|
}
|
|
2229
2261
|
createLocalAttachment(e) {
|
|
2230
|
-
this.options.productVariant === "customer_embedded" &&
|
|
2262
|
+
this.options.productVariant === "customer_embedded" && co(e);
|
|
2231
2263
|
const t = x(), n = {
|
|
2232
2264
|
id: t,
|
|
2233
2265
|
name: e.name || "attachment",
|
|
@@ -2236,7 +2268,7 @@ class Ne {
|
|
|
2236
2268
|
};
|
|
2237
2269
|
this.attachmentFiles.set(t, e);
|
|
2238
2270
|
const i = Date.now();
|
|
2239
|
-
return
|
|
2271
|
+
return rn({
|
|
2240
2272
|
attachmentId: t,
|
|
2241
2273
|
name: n.name,
|
|
2242
2274
|
mimeType: n.mimeType,
|
|
@@ -2275,7 +2307,7 @@ class Ne {
|
|
|
2275
2307
|
sizeBytes: e.size,
|
|
2276
2308
|
page: _(),
|
|
2277
2309
|
model: this.options.model,
|
|
2278
|
-
metadata:
|
|
2310
|
+
metadata: Jt(this.options.metadata),
|
|
2279
2311
|
entrySurface: this.options.entrySurface
|
|
2280
2312
|
};
|
|
2281
2313
|
let o;
|
|
@@ -2301,8 +2333,8 @@ class Ne {
|
|
|
2301
2333
|
}, "Failed to upload attachment"), o = l;
|
|
2302
2334
|
}
|
|
2303
2335
|
this.setState({ sessionId: o.sessionId });
|
|
2304
|
-
const a =
|
|
2305
|
-
return this.updateAttachmentInState(t.id, a), t.id &&
|
|
2336
|
+
const a = Hs(o.attachment, this.options.backendUrl);
|
|
2337
|
+
return this.updateAttachmentInState(t.id, a), t.id && on(t.id, {
|
|
2306
2338
|
sessionId: o.sessionId,
|
|
2307
2339
|
fileUrl: a.fileUrl,
|
|
2308
2340
|
sandboxPath: a.sandboxPath,
|
|
@@ -2333,7 +2365,7 @@ class Ne {
|
|
|
2333
2365
|
const n = await this.fetchEmbedAttachmentUpload(e, !1);
|
|
2334
2366
|
if (n.ok)
|
|
2335
2367
|
return await n.json();
|
|
2336
|
-
if (
|
|
2368
|
+
if (Eo(n.status) && this.options.tokenProvider && !t) {
|
|
2337
2369
|
t = !0;
|
|
2338
2370
|
const i = await this.fetchEmbedAttachmentUpload(e, !0);
|
|
2339
2371
|
if (i.ok)
|
|
@@ -2359,7 +2391,7 @@ class Ne {
|
|
|
2359
2391
|
if (!this.state.sessionId)
|
|
2360
2392
|
return;
|
|
2361
2393
|
this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "user_requested" });
|
|
2362
|
-
const e =
|
|
2394
|
+
const e = zr(
|
|
2363
2395
|
this.state.messages,
|
|
2364
2396
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
2365
2397
|
this.state.assistantDraftRunId,
|
|
@@ -2384,8 +2416,8 @@ class Ne {
|
|
|
2384
2416
|
}), this.stoppedTurns.splice(0, Math.max(0, this.stoppedTurns.length - 20));
|
|
2385
2417
|
for (const [t, n] of this.activeBrowserToolCalls)
|
|
2386
2418
|
n.event.sessionId === this.state.sessionId && this.activeBrowserToolCalls.delete(t);
|
|
2387
|
-
|
|
2388
|
-
messages:
|
|
2419
|
+
hs(this.options.clientId, this.activeBrowserToolCalls.values()), this.setState({
|
|
2420
|
+
messages: cs(
|
|
2389
2421
|
this.state.messages,
|
|
2390
2422
|
e.clientMessageId,
|
|
2391
2423
|
e.runId
|
|
@@ -2433,7 +2465,7 @@ class Ne {
|
|
|
2433
2465
|
const t = x(), n = new Promise((r, o) => {
|
|
2434
2466
|
const a = window.setTimeout(() => {
|
|
2435
2467
|
this.pendingSessionHistoryRequests.delete(t), o(new Error("Session history did not respond in time"));
|
|
2436
|
-
},
|
|
2468
|
+
}, Vt);
|
|
2437
2469
|
this.pendingSessionHistoryRequests.set(t, { resolve: r, reject: o, timeout: a });
|
|
2438
2470
|
}), i = {
|
|
2439
2471
|
type: "sessions.list",
|
|
@@ -2506,7 +2538,7 @@ class Ne {
|
|
|
2506
2538
|
throw new Error("This interaction is no longer available.");
|
|
2507
2539
|
if (!r.allowedActions.includes(t))
|
|
2508
2540
|
throw new Error("This action is not available for the interaction.");
|
|
2509
|
-
if (
|
|
2541
|
+
if (Xn(t) && await this.interactionManager.act(
|
|
2510
2542
|
{
|
|
2511
2543
|
key: r.id,
|
|
2512
2544
|
category: r.category,
|
|
@@ -2558,7 +2590,7 @@ class Ne {
|
|
|
2558
2590
|
this.rebuildRuntimeInteractions();
|
|
2559
2591
|
}
|
|
2560
2592
|
rebuildRuntimeInteractions() {
|
|
2561
|
-
const e = [], t = this.options.productVariant === "personal" && (this.options.entrySurface === "main_web_chat" || this.options.entrySurface === "automation") ?
|
|
2593
|
+
const e = [], t = this.options.productVariant === "personal" && (this.options.entrySurface === "main_web_chat" || this.options.entrySurface === "automation") ? dn(this.state.messages) : null;
|
|
2562
2594
|
if (t) {
|
|
2563
2595
|
const r = {
|
|
2564
2596
|
key: t.id,
|
|
@@ -2685,7 +2717,7 @@ class Ne {
|
|
|
2685
2717
|
return this.clientRuntime.route("directory", { legacy: () => {
|
|
2686
2718
|
const t = x(), n = this.activeComposerWarmupId;
|
|
2687
2719
|
this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages);
|
|
2688
|
-
const i = this.getCachedSessionTimeline(e), r = [...i ?? []].reverse().find((a) => a.dataType === "assistant_draft" && a.steered !== !0), o =
|
|
2720
|
+
const i = this.getCachedSessionTimeline(e), r = [...i ?? []].reverse().find((a) => a.dataType === "assistant_draft" && a.steered !== !0), o = $r(i ?? []);
|
|
2689
2721
|
!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({
|
|
2690
2722
|
type: "session.reset",
|
|
2691
2723
|
warmupId: n,
|
|
@@ -2820,7 +2852,7 @@ class Ne {
|
|
|
2820
2852
|
});
|
|
2821
2853
|
if (!c.ok) {
|
|
2822
2854
|
const d = await c.text() || `History request failed (${c.status})`;
|
|
2823
|
-
throw
|
|
2855
|
+
throw Zn(c.status) ? new Error(d) : new Te(d);
|
|
2824
2856
|
}
|
|
2825
2857
|
const u = await c.json();
|
|
2826
2858
|
if (!u?.session || !Array.isArray(u.items))
|
|
@@ -2875,7 +2907,7 @@ class Ne {
|
|
|
2875
2907
|
return !1;
|
|
2876
2908
|
const t = this.socket;
|
|
2877
2909
|
try {
|
|
2878
|
-
return t.send(JSON.stringify(e)), Se("client_event", e.type,
|
|
2910
|
+
return t.send(JSON.stringify(e)), Se("client_event", e.type, jt(e)), !0;
|
|
2879
2911
|
} catch (n) {
|
|
2880
2912
|
return M("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
|
|
2881
2913
|
message: n instanceof Error ? n.message : String(n),
|
|
@@ -2925,7 +2957,7 @@ class Ne {
|
|
|
2925
2957
|
clientMessageId: e,
|
|
2926
2958
|
durationMs: Date.now() - n
|
|
2927
2959
|
});
|
|
2928
|
-
}, Math.max(0,
|
|
2960
|
+
}, Math.max(0, di - (Date.now() - n)));
|
|
2929
2961
|
this.firstResponseTimersByClientMessageId.set(e, { submittedAt: n, timer: i });
|
|
2930
2962
|
}
|
|
2931
2963
|
clearFirstResponseTimer(e) {
|
|
@@ -3035,7 +3067,7 @@ class Ne {
|
|
|
3035
3067
|
if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
|
|
3036
3068
|
return;
|
|
3037
3069
|
this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
|
|
3038
|
-
const e =
|
|
3070
|
+
const e = tr();
|
|
3039
3071
|
this.sendNow(
|
|
3040
3072
|
L({
|
|
3041
3073
|
type: "starter_prompts.page_context",
|
|
@@ -3046,13 +3078,13 @@ class Ne {
|
|
|
3046
3078
|
) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
|
|
3047
3079
|
}
|
|
3048
3080
|
startStarterPromptUrlWatcher() {
|
|
3049
|
-
this.locationChangeCleanup || (this.locationChangeCleanup =
|
|
3081
|
+
this.locationChangeCleanup || (this.locationChangeCleanup = sr(() => this.handleStarterPromptUrlChange()));
|
|
3050
3082
|
}
|
|
3051
3083
|
handleStarterPromptUrlChange() {
|
|
3052
3084
|
const e = location.href;
|
|
3053
3085
|
e !== this.lastStarterPromptPageUrl && (this.activeComposerWarmupScope && !this.activeComposerWarmupScope.endsWith(`:${e}`) && this.clearPendingComposerWarmup(), this.lastStarterPromptPageUrl = e, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
|
|
3054
3086
|
this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
|
|
3055
|
-
},
|
|
3087
|
+
}, Ri));
|
|
3056
3088
|
}
|
|
3057
3089
|
refreshStarterPromptsForCurrentUrl() {
|
|
3058
3090
|
this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
|
|
@@ -3082,7 +3114,7 @@ class Ne {
|
|
|
3082
3114
|
}
|
|
3083
3115
|
rememberSessionTimeline(e, t) {
|
|
3084
3116
|
const n = [...t];
|
|
3085
|
-
for (this.sessionTimelineCache.delete(e), this.sessionTimelineCache.set(e, n); this.sessionTimelineCache.size >
|
|
3117
|
+
for (this.sessionTimelineCache.delete(e), this.sessionTimelineCache.set(e, n); this.sessionTimelineCache.size > Mi; ) {
|
|
3086
3118
|
const i = this.sessionTimelineCache.keys().next().value;
|
|
3087
3119
|
if (!i)
|
|
3088
3120
|
break;
|
|
@@ -3112,8 +3144,8 @@ class Ne {
|
|
|
3112
3144
|
return;
|
|
3113
3145
|
this.clearPendingWarmupAckTimer();
|
|
3114
3146
|
const t = Math.min(
|
|
3115
|
-
|
|
3116
|
-
|
|
3147
|
+
ai * 2 ** e.retryAttempt,
|
|
3148
|
+
li
|
|
3117
3149
|
);
|
|
3118
3150
|
e.retryAttempt += 1, this.pendingWarmupAckTimer = window.setTimeout(() => {
|
|
3119
3151
|
this.pendingWarmupAckTimer = null, this.flushPendingComposerWarmup();
|
|
@@ -3157,7 +3189,7 @@ class Ne {
|
|
|
3157
3189
|
if (!e || !t)
|
|
3158
3190
|
return;
|
|
3159
3191
|
const n = this.findStoppedTurn(e, t);
|
|
3160
|
-
!n || n.reason !== "task_tab_closed" ||
|
|
3192
|
+
!n || n.reason !== "task_tab_closed" || vn(n, t) && (this.stoppedTurns.splice(this.stoppedTurns.indexOf(n), 1), n.stoppedItemId && this.setState({
|
|
3161
3193
|
messages: this.state.messages.filter((i) => i.id !== n.stoppedItemId)
|
|
3162
3194
|
}));
|
|
3163
3195
|
}
|
|
@@ -3185,7 +3217,7 @@ class Ne {
|
|
|
3185
3217
|
});
|
|
3186
3218
|
}
|
|
3187
3219
|
handleServerEvent(e) {
|
|
3188
|
-
if (Se("server_event", e.type,
|
|
3220
|
+
if (Se("server_event", e.type, jt(e)), e.type === "session.subscribed") {
|
|
3189
3221
|
const t = typeof e.requestId == "string" ? e.requestId : null, n = typeof e.sessionId == "string" ? e.sessionId : null;
|
|
3190
3222
|
if (t && n && t === this.pendingSessionSubscription?.requestId && n === this.pendingSessionSubscription.sessionId) {
|
|
3191
3223
|
const i = this.pendingSessionSubscription;
|
|
@@ -3236,7 +3268,7 @@ class Ne {
|
|
|
3236
3268
|
}
|
|
3237
3269
|
}
|
|
3238
3270
|
if (!this.shouldIgnoreStoppedTurnEvent(e) && (this.updateInactiveSessionTimelineCache(e), !this.shouldIgnoreBackgroundSessionEvent(e))) {
|
|
3239
|
-
if (
|
|
3271
|
+
if (qi(e) && this.clearFirstResponseTimer(this.activeClientMessageId), e.type === "run.steered") {
|
|
3240
3272
|
this.handleRunSteered(e);
|
|
3241
3273
|
return;
|
|
3242
3274
|
}
|
|
@@ -3251,17 +3283,17 @@ class Ne {
|
|
|
3251
3283
|
this.activeResponseRunId = t, this.setState({ turnPhase: "thinking", lastError: null }), this.markThinkingProgress();
|
|
3252
3284
|
return;
|
|
3253
3285
|
}
|
|
3254
|
-
if (
|
|
3286
|
+
if (Di(e) && this.markThinkingProgress(), e.type === "auth.ok") {
|
|
3255
3287
|
this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.transportDiagnosticEpisodes.clear();
|
|
3256
|
-
const t =
|
|
3288
|
+
const t = yr(e.user);
|
|
3257
3289
|
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();
|
|
3258
|
-
const n =
|
|
3290
|
+
const n = hr(e), i = Object.prototype.hasOwnProperty.call(e, "appearance");
|
|
3259
3291
|
M("web-sdk.agent", "Received auth.ok appearance", {
|
|
3260
3292
|
hasAppearance: i,
|
|
3261
3293
|
rawAppearance: e.appearance,
|
|
3262
3294
|
normalizedAppearance: n
|
|
3263
|
-
}), this.runtimeHelperJavascript =
|
|
3264
|
-
const r =
|
|
3295
|
+
}), this.runtimeHelperJavascript = pr(e.runtimeHelpers)?.javascript ?? null;
|
|
3296
|
+
const r = Zt(e, "starterPrompts"), o = Object.prototype.hasOwnProperty.call(e, "starterPrompts"), a = e.starterPromptsLoading === !0, l = {
|
|
3265
3297
|
user: t,
|
|
3266
3298
|
status: "connected",
|
|
3267
3299
|
...this.state.lastErrorCode === "connection_failed" ? { lastError: null, lastErrorCode: null } : {}
|
|
@@ -3280,14 +3312,14 @@ class Ne {
|
|
|
3280
3312
|
}
|
|
3281
3313
|
if (e.type === "starterPrompts.updated") {
|
|
3282
3314
|
this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0, this.setState({
|
|
3283
|
-
starterPrompts:
|
|
3315
|
+
starterPrompts: Zt(e, "starterPrompts"),
|
|
3284
3316
|
starterPromptsLoading: !1
|
|
3285
3317
|
});
|
|
3286
3318
|
return;
|
|
3287
3319
|
}
|
|
3288
3320
|
if (e.type === "scheduled_follow_ups.updated") {
|
|
3289
3321
|
typeof e.sessionId == "string" && e.sessionId === this.state.sessionId && this.setState({
|
|
3290
|
-
activeScheduledFollowUps:
|
|
3322
|
+
activeScheduledFollowUps: es(
|
|
3291
3323
|
e.activeScheduledFollowUps
|
|
3292
3324
|
)
|
|
3293
3325
|
});
|
|
@@ -3311,7 +3343,7 @@ class Ne {
|
|
|
3311
3343
|
runId: u?.runId
|
|
3312
3344
|
}), 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;
|
|
3313
3345
|
f && h && (this.pendingClientMessageId = h);
|
|
3314
|
-
let m =
|
|
3346
|
+
let m = Rr(
|
|
3315
3347
|
e.assistantDraft
|
|
3316
3348
|
);
|
|
3317
3349
|
m && this.findStoppedTurn(r, {
|
|
@@ -3320,31 +3352,31 @@ class Ne {
|
|
|
3320
3352
|
}) && (m = void 0);
|
|
3321
3353
|
const b = m !== void 0;
|
|
3322
3354
|
this.rememberUserMessageClientMessageIds(g);
|
|
3323
|
-
const w =
|
|
3355
|
+
const w = Nr(g), D = g.filter((U) => {
|
|
3324
3356
|
const q = C(U);
|
|
3325
|
-
return
|
|
3357
|
+
return xr(q) ? !1 : !q || !w || !pe(q) ? !0 : ht(g, q) !== w;
|
|
3326
3358
|
}), S = ct(
|
|
3327
3359
|
this.state.messages,
|
|
3328
3360
|
st(D, this.options.backendUrl)
|
|
3329
|
-
), T =
|
|
3330
|
-
(U, q) =>
|
|
3361
|
+
), T = os(S), N = b ? m?.content ?? "" : this.state.assistantDraft, v = b ? m?.itemId ?? null : this.state.assistantDraftItemId, re = b ? m?.respondsToUserMessageId ?? null : this.state.assistantDraftRespondsToUserMessageId, Y = b ? m?.runId ?? null : this.state.assistantDraftRunId, Z = g.some(
|
|
3362
|
+
(U, q) => as(
|
|
3331
3363
|
C(U),
|
|
3332
3364
|
N,
|
|
3333
3365
|
v,
|
|
3334
3366
|
re,
|
|
3335
3367
|
Y,
|
|
3336
|
-
|
|
3368
|
+
Hr(g, q)
|
|
3337
3369
|
)
|
|
3338
|
-
), ee = b ? m?.content ?? "" : this.state.assistantDraft, fe = !!m?.content && !Z, B = T && (!ee || Z), V =
|
|
3339
|
-
if (!T &&
|
|
3370
|
+
), ee = b ? m?.content ?? "" : this.state.assistantDraft, fe = !!m?.content && !Z, B = T && (!ee || Z), V = qr(S), oe = B && V ? "completed" : d ? "stopped" : B ? "failed" : null;
|
|
3371
|
+
if (!T && Lr(this.state.messages, g))
|
|
3340
3372
|
return;
|
|
3341
|
-
this.lastUserMessagePageUrl =
|
|
3373
|
+
this.lastUserMessagePageUrl = Or(g);
|
|
3342
3374
|
const j = B || d ? null : dt(g);
|
|
3343
3375
|
if (this.latestRecoverableClientMessageId = j, V && this.clearRetryTimers(), this.setState({
|
|
3344
3376
|
sessionId: A(e.session, "id") ?? this.state.sessionId,
|
|
3345
3377
|
messages: S,
|
|
3346
3378
|
...i ? {
|
|
3347
|
-
activeScheduledFollowUps:
|
|
3379
|
+
activeScheduledFollowUps: es(
|
|
3348
3380
|
e.activeScheduledFollowUps
|
|
3349
3381
|
)
|
|
3350
3382
|
} : {},
|
|
@@ -3411,14 +3443,14 @@ class Ne {
|
|
|
3411
3443
|
this.options.backendUrl
|
|
3412
3444
|
);
|
|
3413
3445
|
t === this.sessionActivityRequestId && (this.sessionActivityRequestId = null), this.setState({
|
|
3414
|
-
messages:
|
|
3446
|
+
messages: _r(this.state.messages, i)
|
|
3415
3447
|
});
|
|
3416
3448
|
return;
|
|
3417
3449
|
}
|
|
3418
3450
|
if (e.type === "sessions.page") {
|
|
3419
3451
|
const t = typeof e.requestId == "string" ? e.requestId : null, n = t ? this.pendingSessionHistoryRequests.get(t) : null;
|
|
3420
3452
|
t && n && (window.clearTimeout(n.timeout), this.pendingSessionHistoryRequests.delete(t), n.resolve({
|
|
3421
|
-
sessions:
|
|
3453
|
+
sessions: Ir(e.sessions),
|
|
3422
3454
|
nextCursor: typeof e.nextCursor == "string" ? e.nextCursor : null
|
|
3423
3455
|
}));
|
|
3424
3456
|
return;
|
|
@@ -3453,15 +3485,15 @@ class Ne {
|
|
|
3453
3485
|
}
|
|
3454
3486
|
const n = Ue(e.item, this.options.backendUrl);
|
|
3455
3487
|
if (n) {
|
|
3456
|
-
const i =
|
|
3457
|
-
n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)), W(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()),
|
|
3458
|
-
const o = de(this.state.messages, n), a =
|
|
3488
|
+
const i = Kr(t, n), r = n.callId ? this.pendingToolLoadingByCallId.get(n.callId) : void 0;
|
|
3489
|
+
n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)), W(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), Fr(t) && this.clearRunAckResyncRetryTimer();
|
|
3490
|
+
const o = de(this.state.messages, n), a = os(o), l = as(
|
|
3459
3491
|
t,
|
|
3460
3492
|
this.state.assistantDraft,
|
|
3461
3493
|
this.state.assistantDraftItemId,
|
|
3462
3494
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
3463
3495
|
this.state.assistantDraftRunId,
|
|
3464
|
-
|
|
3496
|
+
Os(
|
|
3465
3497
|
o,
|
|
3466
3498
|
o.findIndex((d) => d.id === n.id)
|
|
3467
3499
|
)
|
|
@@ -3537,7 +3569,7 @@ class Ne {
|
|
|
3537
3569
|
);
|
|
3538
3570
|
this.setState({
|
|
3539
3571
|
sessionId: t,
|
|
3540
|
-
messages:
|
|
3572
|
+
messages: ss(
|
|
3541
3573
|
l,
|
|
3542
3574
|
typeof e.responseId == "string" ? e.responseId : null,
|
|
3543
3575
|
n,
|
|
@@ -3560,9 +3592,9 @@ class Ne {
|
|
|
3560
3592
|
if (t)
|
|
3561
3593
|
this.nonTranscriptToolCallIds.add(t);
|
|
3562
3594
|
else {
|
|
3563
|
-
const n =
|
|
3595
|
+
const n = rs(e);
|
|
3564
3596
|
if (n) {
|
|
3565
|
-
const i =
|
|
3597
|
+
const i = ns(
|
|
3566
3598
|
this.state.messages,
|
|
3567
3599
|
n
|
|
3568
3600
|
);
|
|
@@ -3630,13 +3662,13 @@ class Ne {
|
|
|
3630
3662
|
return;
|
|
3631
3663
|
}
|
|
3632
3664
|
o && i && r && (this.retryableClientMessageId = r);
|
|
3633
|
-
const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l =
|
|
3665
|
+
const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l = Zi(a.message);
|
|
3634
3666
|
l && console.error(l);
|
|
3635
|
-
const c = r ?? this.activeClientMessageId, u = typeof e.runId == "string" ? e.runId : null, d =
|
|
3667
|
+
const c = r ?? this.activeClientMessageId, u = typeof e.runId == "string" ? e.runId : null, d = cs(
|
|
3636
3668
|
this.state.messages,
|
|
3637
3669
|
c,
|
|
3638
3670
|
u
|
|
3639
|
-
), g =
|
|
3671
|
+
), g = Dr(
|
|
3640
3672
|
d,
|
|
3641
3673
|
c,
|
|
3642
3674
|
u
|
|
@@ -3667,7 +3699,7 @@ class Ne {
|
|
|
3667
3699
|
}
|
|
3668
3700
|
applyAccountSubmissionError(e) {
|
|
3669
3701
|
if (!this.account || !e) return;
|
|
3670
|
-
const t =
|
|
3702
|
+
const t = Dn(this.account.submissionGate, e);
|
|
3671
3703
|
if (!(t === this.account.submissionGate || t.allowed)) {
|
|
3672
3704
|
this.account = {
|
|
3673
3705
|
...this.account,
|
|
@@ -3683,7 +3715,7 @@ class Ne {
|
|
|
3683
3715
|
this.options.model = Qe(n) ? n : "gpt-5.6-sol";
|
|
3684
3716
|
}
|
|
3685
3717
|
updateAccountFallbackFromSession(e) {
|
|
3686
|
-
const t = e && typeof e == "object" ? e.metadata : null, n =
|
|
3718
|
+
const t = e && typeof e == "object" ? e.metadata : null, n = qn(t);
|
|
3687
3719
|
if (this.usingPaidCreditFallback !== n && (this.usingPaidCreditFallback = n, !!this.account)) {
|
|
3688
3720
|
this.account = { ...this.account, usingPaidCreditFallback: n };
|
|
3689
3721
|
for (const i of this.accountListeners) i(this.getAccount());
|
|
@@ -3725,10 +3757,10 @@ class Ne {
|
|
|
3725
3757
|
return;
|
|
3726
3758
|
}
|
|
3727
3759
|
if (e.type === "tool.call") {
|
|
3728
|
-
const i = e.hiddenFromTranscript === !0 ? null :
|
|
3760
|
+
const i = e.hiddenFromTranscript === !0 ? null : rs(e);
|
|
3729
3761
|
i && this.rememberSessionTimeline(
|
|
3730
3762
|
t,
|
|
3731
|
-
|
|
3763
|
+
ns(n, i)
|
|
3732
3764
|
);
|
|
3733
3765
|
return;
|
|
3734
3766
|
}
|
|
@@ -3740,7 +3772,7 @@ class Ne {
|
|
|
3740
3772
|
return;
|
|
3741
3773
|
this.rememberSessionTimeline(
|
|
3742
3774
|
t,
|
|
3743
|
-
|
|
3775
|
+
is(
|
|
3744
3776
|
n,
|
|
3745
3777
|
e.callId,
|
|
3746
3778
|
i
|
|
@@ -3777,7 +3809,7 @@ class Ne {
|
|
|
3777
3809
|
);
|
|
3778
3810
|
this.rememberSessionTimeline(
|
|
3779
3811
|
t,
|
|
3780
|
-
|
|
3812
|
+
ss(
|
|
3781
3813
|
o,
|
|
3782
3814
|
typeof e.responseId == "string" ? e.responseId : null,
|
|
3783
3815
|
i,
|
|
@@ -3792,7 +3824,7 @@ class Ne {
|
|
|
3792
3824
|
return;
|
|
3793
3825
|
this.rememberSessionTimeline(
|
|
3794
3826
|
t,
|
|
3795
|
-
|
|
3827
|
+
us(
|
|
3796
3828
|
n,
|
|
3797
3829
|
i,
|
|
3798
3830
|
null,
|
|
@@ -3801,9 +3833,9 @@ class Ne {
|
|
|
3801
3833
|
);
|
|
3802
3834
|
return;
|
|
3803
3835
|
}
|
|
3804
|
-
e.type === "error" && typeof e.requestId != "string" && !
|
|
3836
|
+
e.type === "error" && typeof e.requestId != "string" && !ls(e, t) && this.rememberSessionTimeline(
|
|
3805
3837
|
t,
|
|
3806
|
-
|
|
3838
|
+
jr(n, e)
|
|
3807
3839
|
);
|
|
3808
3840
|
}
|
|
3809
3841
|
}
|
|
@@ -3837,7 +3869,7 @@ class Ne {
|
|
|
3837
3869
|
}
|
|
3838
3870
|
handleRetryableRecoveryError(e) {
|
|
3839
3871
|
const t = typeof e.sessionId == "string" ? e.sessionId : this.state.sessionId, n = typeof e.clientMessageId == "string" ? e.clientMessageId : null;
|
|
3840
|
-
if (!
|
|
3872
|
+
if (!ls(e, t) || !n)
|
|
3841
3873
|
return !1;
|
|
3842
3874
|
if (et())
|
|
3843
3875
|
return this.retryableClientMessageId = n, this.activeClientMessageId = n, this.latestRecoverableClientMessageId = n, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), !0;
|
|
@@ -3878,7 +3910,7 @@ class Ne {
|
|
|
3878
3910
|
const i = new Promise((r, o) => {
|
|
3879
3911
|
const a = window.setTimeout(() => {
|
|
3880
3912
|
e.delete(t.requestId), o(new Error(n));
|
|
3881
|
-
},
|
|
3913
|
+
}, Vt);
|
|
3882
3914
|
e.set(t.requestId, { resolve: r, reject: o, timeout: a });
|
|
3883
3915
|
});
|
|
3884
3916
|
if (!this.sendNow(t)) {
|
|
@@ -3901,7 +3933,7 @@ class Ne {
|
|
|
3901
3933
|
e.clear();
|
|
3902
3934
|
}
|
|
3903
3935
|
markThinkingProgress() {
|
|
3904
|
-
!this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(
|
|
3936
|
+
!this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(ui), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
|
|
3905
3937
|
}
|
|
3906
3938
|
scheduleThinkingWatchdog(e) {
|
|
3907
3939
|
this.thinkingWatchdogTimer !== null && window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = window.setTimeout(() => {
|
|
@@ -3959,19 +3991,19 @@ class Ne {
|
|
|
3959
3991
|
schedulePendingDeliveryAck(e) {
|
|
3960
3992
|
this.clearPendingDeliveryTimers(), !et() && (this.pendingDeliveryAckTimer = window.setTimeout(() => {
|
|
3961
3993
|
this.pendingDeliveryAckTimer = null, this.retryPendingDelivery(e);
|
|
3962
|
-
},
|
|
3994
|
+
}, Gt));
|
|
3963
3995
|
}
|
|
3964
3996
|
retryPendingDelivery(e) {
|
|
3965
3997
|
if (this.state.status === "closed" || this.pendingClientMessageId !== e || !this.pendingUserMessageEvent)
|
|
3966
3998
|
return;
|
|
3967
3999
|
const t = this.retryAttemptsByClientMessageId[e] ?? 0;
|
|
3968
|
-
if (t >=
|
|
4000
|
+
if (t >= hi) {
|
|
3969
4001
|
this.failPendingDelivery(e);
|
|
3970
4002
|
return;
|
|
3971
4003
|
}
|
|
3972
4004
|
t === 0 && this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.retryAttemptsByClientMessageId[e] = t + 1, this.setState({ pendingMessageStatus: "reconnecting" }), this.pendingDeliveryRetryTimer = window.setTimeout(() => {
|
|
3973
4005
|
this.pendingDeliveryRetryTimer = null, !(this.pendingClientMessageId !== e || !this.pendingUserMessageEvent) && (this.send(this.pendingUserMessageEvent), this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(e));
|
|
3974
|
-
},
|
|
4006
|
+
}, ki(t, mi));
|
|
3975
4007
|
}
|
|
3976
4008
|
failPendingDelivery(e) {
|
|
3977
4009
|
if (this.pendingClientMessageId !== e)
|
|
@@ -3984,7 +4016,7 @@ class Ne {
|
|
|
3984
4016
|
...this.state.isThinking ? {} : { turnPhase: null },
|
|
3985
4017
|
isRetrying: !1,
|
|
3986
4018
|
...this.state.isThinking ? {} : { taskStatus: "failed" },
|
|
3987
|
-
lastError:
|
|
4019
|
+
lastError: gi,
|
|
3988
4020
|
lastErrorCode: "message_delivery_failed"
|
|
3989
4021
|
});
|
|
3990
4022
|
}
|
|
@@ -3996,7 +4028,7 @@ class Ne {
|
|
|
3996
4028
|
if (this.state.isThinking && t) {
|
|
3997
4029
|
const r = this.state.assistantDraftRespondsToUserMessageId !== null && this.state.assistantDraftRespondsToUserMessageId !== t;
|
|
3998
4030
|
this.setState({
|
|
3999
|
-
messages:
|
|
4031
|
+
messages: us(
|
|
4000
4032
|
this.state.messages,
|
|
4001
4033
|
t,
|
|
4002
4034
|
n,
|
|
@@ -4022,13 +4054,13 @@ class Ne {
|
|
|
4022
4054
|
scheduleRunAckWatchdog(e) {
|
|
4023
4055
|
this.runAckWatchdogTimer !== null && window.clearTimeout(this.runAckWatchdogTimer), this.runAckWatchdogTimer = window.setTimeout(() => {
|
|
4024
4056
|
this.runAckWatchdogTimer = null, this.recoverMissedRunAck(e);
|
|
4025
|
-
},
|
|
4057
|
+
}, Gt);
|
|
4026
4058
|
}
|
|
4027
4059
|
recoverMissedRunAck(e) {
|
|
4028
4060
|
!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== e || (M("web-sdk.agent", "Pluno run ack missed; resyncing session", {
|
|
4029
4061
|
sessionId: this.state.sessionId,
|
|
4030
4062
|
clientMessageId: e
|
|
4031
|
-
}), this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(
|
|
4063
|
+
}), this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(Kt));
|
|
4032
4064
|
}
|
|
4033
4065
|
clearRunAckResyncRetryTimer() {
|
|
4034
4066
|
this.runAckResyncRetryTimer !== null && (window.clearTimeout(this.runAckResyncRetryTimer), this.runAckResyncRetryTimer = null);
|
|
@@ -4051,7 +4083,7 @@ class Ne {
|
|
|
4051
4083
|
),
|
|
4052
4084
|
isThinking: !1,
|
|
4053
4085
|
taskStatus: "failed",
|
|
4054
|
-
lastError:
|
|
4086
|
+
lastError: pi,
|
|
4055
4087
|
lastErrorCode: "run_recovery_exhausted"
|
|
4056
4088
|
}), this.clearThinkingWatchdog();
|
|
4057
4089
|
return;
|
|
@@ -4061,7 +4093,7 @@ class Ne {
|
|
|
4061
4093
|
sessionId: this.state.sessionId,
|
|
4062
4094
|
clientMessageId: e,
|
|
4063
4095
|
resyncAttempts: t + 1
|
|
4064
|
-
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(
|
|
4096
|
+
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(Kt);
|
|
4065
4097
|
}
|
|
4066
4098
|
resyncThinkingSession() {
|
|
4067
4099
|
this.state.sessionId ? this.send({
|
|
@@ -4078,7 +4110,7 @@ class Ne {
|
|
|
4078
4110
|
if (!t || !n || !i)
|
|
4079
4111
|
return;
|
|
4080
4112
|
const a = i === "execute_code", l = i === "execute_code_in_browser_tab" && o !== null && typeof o == "object" && o.tabId === "local:current";
|
|
4081
|
-
if (!a && !l || !
|
|
4113
|
+
if (!a && !l || !fo(o)) {
|
|
4082
4114
|
this.setToolMessageLoading(n, !1), this.send({
|
|
4083
4115
|
type: "tool.result",
|
|
4084
4116
|
sessionId: t,
|
|
@@ -4125,9 +4157,9 @@ class Ne {
|
|
|
4125
4157
|
startedAtOrigin: location.origin
|
|
4126
4158
|
}), this.installSessionBrowserApis();
|
|
4127
4159
|
let c = null, u;
|
|
4128
|
-
c = await this.executeRuntimeHelper(), u = await
|
|
4160
|
+
c = await this.executeRuntimeHelper(), u = await Xt(
|
|
4129
4161
|
o,
|
|
4130
|
-
|
|
4162
|
+
Vi(e.runtimeContext, this.options.backendUrl)
|
|
4131
4163
|
).catch((d) => ({
|
|
4132
4164
|
ok: !1,
|
|
4133
4165
|
exception: {
|
|
@@ -4140,11 +4172,11 @@ class Ne {
|
|
|
4140
4172
|
toolName: i,
|
|
4141
4173
|
summary: o.summary,
|
|
4142
4174
|
rawInput: L(o),
|
|
4143
|
-
rawOutput: L(
|
|
4144
|
-
}),
|
|
4175
|
+
rawOutput: L(gr(u, c))
|
|
4176
|
+
}), hs(this.options.clientId, this.activeBrowserToolCalls.values()));
|
|
4145
4177
|
}
|
|
4146
4178
|
setToolMessageLoading(e, t) {
|
|
4147
|
-
const n =
|
|
4179
|
+
const n = is(
|
|
4148
4180
|
this.state.messages,
|
|
4149
4181
|
e,
|
|
4150
4182
|
t
|
|
@@ -4155,33 +4187,33 @@ class Ne {
|
|
|
4155
4187
|
if (this.pageLifecycleCleanup)
|
|
4156
4188
|
return;
|
|
4157
4189
|
const e = () => {
|
|
4158
|
-
|
|
4190
|
+
Ls(this.options.clientId, this.activeBrowserToolCalls.values());
|
|
4159
4191
|
};
|
|
4160
4192
|
window.addEventListener("pagehide", e), window.addEventListener("beforeunload", e), this.pageLifecycleCleanup = () => {
|
|
4161
4193
|
window.removeEventListener("pagehide", e), window.removeEventListener("beforeunload", e);
|
|
4162
4194
|
};
|
|
4163
4195
|
}
|
|
4164
4196
|
installSessionBrowserApis() {
|
|
4165
|
-
this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup =
|
|
4197
|
+
this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = Ni();
|
|
4166
4198
|
}
|
|
4167
4199
|
cleanupSessionBrowserApis() {
|
|
4168
|
-
this.sessionBrowserApisCleanup && (
|
|
4200
|
+
this.sessionBrowserApisCleanup && (Ki(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
|
|
4169
4201
|
}
|
|
4170
4202
|
async executeRuntimeHelper() {
|
|
4171
4203
|
if (!this.runtimeHelperJavascript?.trim())
|
|
4172
4204
|
return null;
|
|
4173
|
-
const e = await
|
|
4205
|
+
const e = await Xt({
|
|
4174
4206
|
javascript: this.runtimeHelperJavascript
|
|
4175
4207
|
});
|
|
4176
|
-
return e.ok === !1 ?
|
|
4208
|
+
return e.ok === !1 ? fr(e) : null;
|
|
4177
4209
|
}
|
|
4178
4210
|
enableNetworkCapture() {
|
|
4179
|
-
this.networkCaptureCleanup || (this.networkCaptureCleanup =
|
|
4180
|
-
|
|
4211
|
+
this.networkCaptureCleanup || (this.networkCaptureCleanup = vi((e) => {
|
|
4212
|
+
wo(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
|
|
4181
4213
|
}));
|
|
4182
4214
|
}
|
|
4183
4215
|
enqueueNetworkEvent(e) {
|
|
4184
|
-
this.queuedNetworkEvents.length >=
|
|
4216
|
+
this.queuedNetworkEvents.length >= Ii || (this.queuedNetworkEvents.push(To(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
|
|
4185
4217
|
this.networkBatchTimer = null;
|
|
4186
4218
|
const t = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
|
|
4187
4219
|
t.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
|
|
@@ -4190,14 +4222,14 @@ class Ne {
|
|
|
4190
4222
|
page: _(),
|
|
4191
4223
|
events: t
|
|
4192
4224
|
});
|
|
4193
|
-
},
|
|
4225
|
+
}, yi)));
|
|
4194
4226
|
}
|
|
4195
4227
|
scheduleReconnect(e = 0) {
|
|
4196
4228
|
if (this.reconnectTimer !== null || this.state.status === "closed")
|
|
4197
4229
|
return;
|
|
4198
4230
|
const t = Math.min(
|
|
4199
4231
|
at,
|
|
4200
|
-
Math.max(
|
|
4232
|
+
Math.max(Ei(this.reconnectAttempts), e)
|
|
4201
4233
|
);
|
|
4202
4234
|
this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
|
|
4203
4235
|
this.reconnectTimer = null, this.connect().catch((n) => {
|
|
@@ -4214,8 +4246,8 @@ class Ne {
|
|
|
4214
4246
|
const e = this.socket;
|
|
4215
4247
|
!e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
|
|
4216
4248
|
this.socket === e && (M("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
|
|
4217
|
-
},
|
|
4218
|
-
},
|
|
4249
|
+
}, si));
|
|
4250
|
+
}, ti);
|
|
4219
4251
|
}
|
|
4220
4252
|
stopHeartbeat() {
|
|
4221
4253
|
this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
|
|
@@ -4253,12 +4285,12 @@ class Ne {
|
|
|
4253
4285
|
...e.lastError === null && e.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
|
|
4254
4286
|
...e.lastError !== void 0 && e.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
|
|
4255
4287
|
}, a = this.state.sessionId, l = this.state.isThinking || this.state.pendingMessageStatus !== null, c = o.isThinking || o.pendingMessageStatus !== null, u = this.activeClientMessageId ?? this.pendingClientMessageId;
|
|
4256
|
-
u && u === this.lastProjectedTurnClientMessageId && c &&
|
|
4288
|
+
u && u === this.lastProjectedTurnClientMessageId && c && Oi(this.lastProjectedTurnPhase, o.turnPhase) && this.reportHealthSignal("invalid_state_transition", {
|
|
4257
4289
|
clientMessageId: u,
|
|
4258
4290
|
reason: "active_turn_phase_moved_backward",
|
|
4259
4291
|
previousPhase: this.lastProjectedTurnPhase,
|
|
4260
4292
|
nextPhase: o.turnPhase
|
|
4261
|
-
}), 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),
|
|
4293
|
+
}), 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), so(this.options.clientId, this.state), this.emit("state", this.getState()), Se("state", this.state.status, {
|
|
4262
4294
|
status: this.state.status,
|
|
4263
4295
|
sessionId: this.state.sessionId,
|
|
4264
4296
|
messageCount: this.state.messages.length,
|
|
@@ -4317,13 +4349,13 @@ class Ne {
|
|
|
4317
4349
|
}
|
|
4318
4350
|
}
|
|
4319
4351
|
const Ze = /* @__PURE__ */ new WeakMap();
|
|
4320
|
-
function
|
|
4321
|
-
const e = window.__plunoProductAgentNetworkCapture ??
|
|
4352
|
+
function vi(s) {
|
|
4353
|
+
const e = window.__plunoProductAgentNetworkCapture ?? Ui();
|
|
4322
4354
|
return e.subscribers.add(s), () => {
|
|
4323
4355
|
e.subscribers.delete(s), !(e.subscribers.size > 0) && (e.destroy(), window.__plunoProductAgentNetworkCapture === e && delete window.__plunoProductAgentNetworkCapture);
|
|
4324
4356
|
};
|
|
4325
4357
|
}
|
|
4326
|
-
function
|
|
4358
|
+
function Ui() {
|
|
4327
4359
|
const s = /* @__PURE__ */ new Set(), e = (g) => {
|
|
4328
4360
|
s.forEach((f) => {
|
|
4329
4361
|
try {
|
|
@@ -4340,20 +4372,20 @@ function Pi() {
|
|
|
4340
4372
|
throw m;
|
|
4341
4373
|
}
|
|
4342
4374
|
try {
|
|
4343
|
-
const m = f instanceof Request ? f : null, b =
|
|
4375
|
+
const m = f instanceof Request ? f : null, b = mo(f, m), w = Fs(h?.headers ?? m?.headers);
|
|
4344
4376
|
if (!te(b, w, h?.body)) {
|
|
4345
4377
|
const H = {
|
|
4346
4378
|
requestId: nt("fetch"),
|
|
4347
4379
|
url: F(b, Ye),
|
|
4348
4380
|
method: (h?.method ?? m?.method ?? "GET").toUpperCase(),
|
|
4349
4381
|
requestHeaders: w,
|
|
4350
|
-
requestBody:
|
|
4382
|
+
requestBody: gs(h?.body),
|
|
4351
4383
|
resourceType: "fetch",
|
|
4352
4384
|
startedAt: new Date(p).toISOString()
|
|
4353
4385
|
};
|
|
4354
4386
|
y.then(
|
|
4355
4387
|
(S) => {
|
|
4356
|
-
|
|
4388
|
+
yo(S, H, p, e).catch(() => {
|
|
4357
4389
|
e({
|
|
4358
4390
|
...H,
|
|
4359
4391
|
responseStatus: S.status,
|
|
@@ -4390,12 +4422,12 @@ function Pi() {
|
|
|
4390
4422
|
}, c = function(f) {
|
|
4391
4423
|
try {
|
|
4392
4424
|
const h = Ze.get(this);
|
|
4393
|
-
h && (h.excluded = h.excluded || te(h.url, h.requestHeaders, f), h.requestBody =
|
|
4425
|
+
h && (h.excluded = h.excluded || te(h.url, h.requestHeaders, f), h.requestBody = gs(f), h.excluded || this.addEventListener(
|
|
4394
4426
|
"loadend",
|
|
4395
4427
|
() => {
|
|
4396
4428
|
queueMicrotask(() => {
|
|
4397
4429
|
try {
|
|
4398
|
-
const p =
|
|
4430
|
+
const p = bo(this.getAllResponseHeaders());
|
|
4399
4431
|
e({
|
|
4400
4432
|
requestId: h.requestId,
|
|
4401
4433
|
url: h.url,
|
|
@@ -4405,7 +4437,7 @@ function Pi() {
|
|
|
4405
4437
|
resourceType: "xhr",
|
|
4406
4438
|
responseStatus: this.status,
|
|
4407
4439
|
responseHeaders: p,
|
|
4408
|
-
responseBody:
|
|
4440
|
+
responseBody: So(this, p),
|
|
4409
4441
|
errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
|
|
4410
4442
|
startedAt: h.startedAt,
|
|
4411
4443
|
durationMs: Date.now() - h.startedAtMs
|
|
@@ -4497,14 +4529,14 @@ function M(s, e, t) {
|
|
|
4497
4529
|
}, r = n.__plunoProductAgentDiagnostics__ ?? [];
|
|
4498
4530
|
r.push(i), r.length > 120 && r.splice(0, r.length - 120), n.__plunoProductAgentDiagnostics__ = r, n.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(new CustomEvent("product-agent:preview-diagnostic", { detail: i }));
|
|
4499
4531
|
}
|
|
4500
|
-
function
|
|
4532
|
+
function Jt(s) {
|
|
4501
4533
|
const e = typeof s == "function" ? s() : s;
|
|
4502
4534
|
return e && Object.keys(e).length > 0 ? e : void 0;
|
|
4503
4535
|
}
|
|
4504
|
-
function
|
|
4536
|
+
function Di(s) {
|
|
4505
4537
|
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";
|
|
4506
4538
|
}
|
|
4507
|
-
function
|
|
4539
|
+
function qi(s) {
|
|
4508
4540
|
if (s.type === "chat.assistant_delta")
|
|
4509
4541
|
return typeof s.delta == "string" && s.delta.trim().length > 0;
|
|
4510
4542
|
if (s.type === "tool.call")
|
|
@@ -4514,7 +4546,7 @@ function Ui(s) {
|
|
|
4514
4546
|
const e = C(s.item);
|
|
4515
4547
|
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;
|
|
4516
4548
|
}
|
|
4517
|
-
function
|
|
4549
|
+
function Oi(s, e) {
|
|
4518
4550
|
if (!s || !e)
|
|
4519
4551
|
return !1;
|
|
4520
4552
|
const t = {
|
|
@@ -4542,31 +4574,31 @@ function K(s) {
|
|
|
4542
4574
|
}
|
|
4543
4575
|
return null;
|
|
4544
4576
|
}
|
|
4545
|
-
const
|
|
4546
|
-
function
|
|
4577
|
+
const xi = 5e3, Li = 12e4;
|
|
4578
|
+
function Ni() {
|
|
4547
4579
|
const s = [
|
|
4548
|
-
|
|
4549
|
-
|
|
4580
|
+
Bi(),
|
|
4581
|
+
Hi()
|
|
4550
4582
|
].filter((e) => typeof e == "function");
|
|
4551
4583
|
return () => {
|
|
4552
4584
|
for (const e of s.reverse())
|
|
4553
4585
|
e();
|
|
4554
4586
|
};
|
|
4555
4587
|
}
|
|
4556
|
-
function
|
|
4557
|
-
return
|
|
4588
|
+
function Hi() {
|
|
4589
|
+
return ys(globalThis, "getPageSnapshot", async () => bt());
|
|
4558
4590
|
}
|
|
4559
|
-
function
|
|
4560
|
-
return
|
|
4561
|
-
inspectImage: async (e, t) => await
|
|
4591
|
+
function Bi() {
|
|
4592
|
+
return ys(globalThis, "pageImages", {
|
|
4593
|
+
inspectImage: async (e, t) => await Fi(e, t)
|
|
4562
4594
|
});
|
|
4563
4595
|
}
|
|
4564
|
-
async function
|
|
4565
|
-
const t =
|
|
4596
|
+
async function Fi(s, e = {}) {
|
|
4597
|
+
const t = zi(e.name), n = await Wi(s);
|
|
4566
4598
|
return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
|
|
4567
4599
|
type: "pluno.pageImages.inspectImage",
|
|
4568
4600
|
imageAttached: !1,
|
|
4569
|
-
imageAttachmentError:
|
|
4601
|
+
imageAttachmentError: ks
|
|
4570
4602
|
} : {
|
|
4571
4603
|
type: "pluno.pageImages.inspectImage",
|
|
4572
4604
|
imageAttached: !0,
|
|
@@ -4580,15 +4612,15 @@ async function Hi(s, e = {}) {
|
|
|
4580
4612
|
imageAttachmentError: n.error
|
|
4581
4613
|
};
|
|
4582
4614
|
}
|
|
4583
|
-
async function
|
|
4584
|
-
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:
|
|
4615
|
+
async function Wi(s) {
|
|
4616
|
+
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: ks } : {
|
|
4585
4617
|
ok: !0,
|
|
4586
4618
|
mimeType: s.type,
|
|
4587
4619
|
sizeBytes: s.size,
|
|
4588
|
-
dataUrl: await
|
|
4589
|
-
} : { 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." } :
|
|
4620
|
+
dataUrl: await Gi(s)
|
|
4621
|
+
} : { 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." } : $i(s);
|
|
4590
4622
|
}
|
|
4591
|
-
function
|
|
4623
|
+
function $i(s) {
|
|
4592
4624
|
if (!s.startsWith("data:") || !s.includes(","))
|
|
4593
4625
|
return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
|
|
4594
4626
|
const [e, t] = s.slice(5).split(",", 2), n = e.split(";").map((a) => a.trim()).filter(Boolean), i = n[0] ?? "";
|
|
@@ -4599,7 +4631,7 @@ function Fi(s) {
|
|
|
4599
4631
|
const r = t.replace(/[ \t\r\n\f]+/g, "");
|
|
4600
4632
|
if (!/^[A-Za-z0-9+/]*={0,2}$/.test(r))
|
|
4601
4633
|
return { ok: !1, error: "Page image data URL has invalid base64." };
|
|
4602
|
-
const o =
|
|
4634
|
+
const o = ji(r);
|
|
4603
4635
|
return o === null ? { ok: !1, error: "Page image data URL has invalid base64." } : o === 0 ? { ok: !1, error: "Page image is empty." } : {
|
|
4604
4636
|
ok: !0,
|
|
4605
4637
|
mimeType: i,
|
|
@@ -4607,22 +4639,22 @@ function Fi(s) {
|
|
|
4607
4639
|
dataUrl: `data:${i};base64,${r}`
|
|
4608
4640
|
};
|
|
4609
4641
|
}
|
|
4610
|
-
function
|
|
4642
|
+
function ji(s) {
|
|
4611
4643
|
if (s.length === 0 || s.length % 4 !== 0)
|
|
4612
4644
|
return null;
|
|
4613
4645
|
const e = s.length - s.replace(/=+$/, "").length;
|
|
4614
4646
|
return e > 2 ? null : s.length / 4 * 3 - e;
|
|
4615
4647
|
}
|
|
4616
|
-
function
|
|
4648
|
+
function zi(s) {
|
|
4617
4649
|
return (typeof s == "string" ? s.trim() : "") || "Page image";
|
|
4618
4650
|
}
|
|
4619
|
-
function
|
|
4651
|
+
function Ki(s) {
|
|
4620
4652
|
try {
|
|
4621
4653
|
s();
|
|
4622
4654
|
} catch {
|
|
4623
4655
|
}
|
|
4624
4656
|
}
|
|
4625
|
-
function
|
|
4657
|
+
function Gi(s) {
|
|
4626
4658
|
return new Promise((e, t) => {
|
|
4627
4659
|
const n = new FileReader();
|
|
4628
4660
|
n.onload = () => {
|
|
@@ -4634,9 +4666,9 @@ function zi(s) {
|
|
|
4634
4666
|
}, n.onerror = () => t(n.error ?? new Error("Failed to read page image")), n.readAsDataURL(s);
|
|
4635
4667
|
});
|
|
4636
4668
|
}
|
|
4637
|
-
async function
|
|
4669
|
+
async function Xt(s, e) {
|
|
4638
4670
|
const t = Object.getPrototypeOf(async function() {
|
|
4639
|
-
}).constructor, n = s.timeoutMs ??
|
|
4671
|
+
}).constructor, n = s.timeoutMs ?? xi, i = Date.now(), r = [];
|
|
4640
4672
|
let o;
|
|
4641
4673
|
const a = {
|
|
4642
4674
|
log: console.log,
|
|
@@ -4654,7 +4686,7 @@ async function Jt(s, e) {
|
|
|
4654
4686
|
o = window.setTimeout(() => d(c), n);
|
|
4655
4687
|
})
|
|
4656
4688
|
]);
|
|
4657
|
-
return u === c ?
|
|
4689
|
+
return u === c ? Qi(n) : {
|
|
4658
4690
|
ok: !0,
|
|
4659
4691
|
result: u,
|
|
4660
4692
|
console: r,
|
|
@@ -4683,7 +4715,7 @@ async function Jt(s, e) {
|
|
|
4683
4715
|
e?.deactivate(), o !== void 0 && window.clearTimeout(o), console.log = a.log, console.info = a.info, console.warn = a.warn, console.error = a.error;
|
|
4684
4716
|
}
|
|
4685
4717
|
}
|
|
4686
|
-
function
|
|
4718
|
+
function Vi(s, e) {
|
|
4687
4719
|
if (!s || typeof s != "object")
|
|
4688
4720
|
return;
|
|
4689
4721
|
const t = s.sandboxFilesToken;
|
|
@@ -4693,7 +4725,7 @@ function Ki(s, e) {
|
|
|
4693
4725
|
const i = () => {
|
|
4694
4726
|
if (!n)
|
|
4695
4727
|
throw new Error("sandboxFiles is only available during browser-code execution");
|
|
4696
|
-
}, r = async (a, l) => await
|
|
4728
|
+
}, r = async (a, l) => await Kn(`${e.replace(/\/$/, "")}${a}`, l);
|
|
4697
4729
|
return {
|
|
4698
4730
|
value: Object.freeze({
|
|
4699
4731
|
upload: async (a) => {
|
|
@@ -4727,7 +4759,7 @@ function Ki(s, e) {
|
|
|
4727
4759
|
}
|
|
4728
4760
|
};
|
|
4729
4761
|
}
|
|
4730
|
-
function
|
|
4762
|
+
function Qi(s) {
|
|
4731
4763
|
return {
|
|
4732
4764
|
ok: !1,
|
|
4733
4765
|
exception: {
|
|
@@ -4741,10 +4773,10 @@ function Gi(s) {
|
|
|
4741
4773
|
}
|
|
4742
4774
|
};
|
|
4743
4775
|
}
|
|
4744
|
-
function
|
|
4776
|
+
function Ji(s) {
|
|
4745
4777
|
return s.replace(/\/+$/, "");
|
|
4746
4778
|
}
|
|
4747
|
-
function
|
|
4779
|
+
function Xi(s) {
|
|
4748
4780
|
const e = {
|
|
4749
4781
|
sidepanel: "extension_sidepanel",
|
|
4750
4782
|
browser_extension_page_ui: "extension_widget",
|
|
@@ -4756,18 +4788,18 @@ function Qi(s) {
|
|
|
4756
4788
|
};
|
|
4757
4789
|
return s && s in e ? e[s] : s ?? "embedded_custom_ui";
|
|
4758
4790
|
}
|
|
4759
|
-
function
|
|
4791
|
+
function Yi(s) {
|
|
4760
4792
|
return s === "pluno" ? "scheduled_continuation" : s ?? "user";
|
|
4761
4793
|
}
|
|
4762
|
-
function
|
|
4794
|
+
function Zi(s, e = location.origin) {
|
|
4763
4795
|
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;
|
|
4764
4796
|
}
|
|
4765
|
-
function
|
|
4797
|
+
function er(s) {
|
|
4766
4798
|
const e = new URL("/api/product-agent/embed/ws", s);
|
|
4767
4799
|
return e.protocol = e.protocol === "https:" ? "wss:" : "ws:", e.toString();
|
|
4768
4800
|
}
|
|
4769
4801
|
function _() {
|
|
4770
|
-
const s =
|
|
4802
|
+
const s = vs();
|
|
4771
4803
|
return {
|
|
4772
4804
|
url: location.href,
|
|
4773
4805
|
title: document.title,
|
|
@@ -4775,19 +4807,19 @@ function _() {
|
|
|
4775
4807
|
...s ? { plunoProductAgentUi: s } : {}
|
|
4776
4808
|
};
|
|
4777
4809
|
}
|
|
4778
|
-
function
|
|
4810
|
+
function tr() {
|
|
4779
4811
|
return {
|
|
4780
4812
|
pageUrl: location.href,
|
|
4781
4813
|
pageTitle: document.title,
|
|
4782
4814
|
htmlContent: bt()
|
|
4783
4815
|
};
|
|
4784
4816
|
}
|
|
4785
|
-
function
|
|
4786
|
-
return Ce.add(s), we || (we =
|
|
4817
|
+
function sr(s) {
|
|
4818
|
+
return Ce.add(s), we || (we = nr()), () => {
|
|
4787
4819
|
Ce.delete(s), Ce.size === 0 && (we?.(), we = null);
|
|
4788
4820
|
};
|
|
4789
4821
|
}
|
|
4790
|
-
function
|
|
4822
|
+
function nr() {
|
|
4791
4823
|
const s = () => {
|
|
4792
4824
|
for (const r of Array.from(Ce))
|
|
4793
4825
|
r();
|
|
@@ -4803,7 +4835,7 @@ function tr() {
|
|
|
4803
4835
|
};
|
|
4804
4836
|
}
|
|
4805
4837
|
function et() {
|
|
4806
|
-
return
|
|
4838
|
+
return vs()?.surface === "browser_extension_sdk_preview";
|
|
4807
4839
|
}
|
|
4808
4840
|
function bt() {
|
|
4809
4841
|
if (!document.body)
|
|
@@ -4814,16 +4846,16 @@ function bt() {
|
|
|
4814
4846
|
};
|
|
4815
4847
|
t("Selected text", window.getSelection()?.toString() ?? "");
|
|
4816
4848
|
const n = "[role='dialog'], [role='alertdialog'], dialog[open], [aria-modal='true']", i = Array.from(document.querySelectorAll(n)).filter(
|
|
4817
|
-
(p) =>
|
|
4849
|
+
(p) => Cs(p) && !p.parentElement?.closest(n)
|
|
4818
4850
|
);
|
|
4819
4851
|
for (const p of i.slice(0, 3))
|
|
4820
4852
|
t("Active overlay", tt(he(p), e));
|
|
4821
|
-
const r =
|
|
4853
|
+
const r = ir(), o = r ? tt(he(r), e) : "";
|
|
4822
4854
|
t("Main page content", o), t("Additional visible page text", tt(he(document.body), e));
|
|
4823
4855
|
const a = s.map(([p, y]) => `${p}:
|
|
4824
4856
|
${y}`).join(`
|
|
4825
4857
|
|
|
4826
|
-
`).trim().slice(0, 12e3), l =
|
|
4858
|
+
`).trim().slice(0, 12e3), l = rr(i, r).trim(), c = `Simplified DOM outline:
|
|
4827
4859
|
`, u = `
|
|
4828
4860
|
|
|
4829
4861
|
Visible page text:
|
|
@@ -4847,14 +4879,14 @@ function tt(s, e) {
|
|
|
4847
4879
|
t = t.replace(n, "");
|
|
4848
4880
|
return ne(t);
|
|
4849
4881
|
}
|
|
4850
|
-
function
|
|
4882
|
+
function Cs(s) {
|
|
4851
4883
|
const e = window.getComputedStyle(s);
|
|
4852
4884
|
return e.display !== "none" && e.visibility !== "hidden" && s.getClientRects().length > 0;
|
|
4853
4885
|
}
|
|
4854
|
-
function
|
|
4855
|
-
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(
|
|
4886
|
+
function ir() {
|
|
4887
|
+
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Cs).sort((s, e) => he(e).length - he(s).length)[0] ?? null;
|
|
4856
4888
|
}
|
|
4857
|
-
function
|
|
4889
|
+
function rr(s, e) {
|
|
4858
4890
|
const t = /* @__PURE__ */ new Set([
|
|
4859
4891
|
"main",
|
|
4860
4892
|
"nav",
|
|
@@ -4934,7 +4966,7 @@ function nr(s, e) {
|
|
|
4934
4966
|
"data-test",
|
|
4935
4967
|
"data-qa",
|
|
4936
4968
|
"data-cy"
|
|
4937
|
-
], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: u, priorityTargets: d } =
|
|
4969
|
+
], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: u, priorityTargets: d } = or(), g = new Set(s);
|
|
4938
4970
|
e && g.add(e);
|
|
4939
4971
|
let f = 0;
|
|
4940
4972
|
const h = (w) => {
|
|
@@ -4949,7 +4981,7 @@ function nr(s, e) {
|
|
|
4949
4981
|
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")
|
|
4950
4982
|
return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
|
|
4951
4983
|
f += 1;
|
|
4952
|
-
const Z = h(T), ee =
|
|
4984
|
+
const Z = h(T), ee = Ps(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), V = /* @__PURE__ */ new Map();
|
|
4953
4985
|
for (const I of B) {
|
|
4954
4986
|
const R = p(I);
|
|
4955
4987
|
V.set(R, (V.get(R) ?? 0) + 1);
|
|
@@ -4975,10 +5007,10 @@ function nr(s, e) {
|
|
|
4975
5007
|
I instanceof HTMLElement && Fe.push(S(I, N + 1));
|
|
4976
5008
|
const ye = [...Et, ...Fe], We = ee.length > 0 || fe || ye.some((I) => I.hasUsefulContent), Ct = ne(
|
|
4977
5009
|
[ee, ...ye.map((I) => I.textPreview)].filter(Boolean).join(" ")
|
|
4978
|
-
).slice(0, 180),
|
|
5010
|
+
).slice(0, 180), Qs = T.hasAttribute("contenteditable") && (ee.length > 0 || !T.querySelector("[contenteditable]")), _t = c.some((I) => T.hasAttribute(I)) || !!Z || Qs, $e = (T.getClientRects().length > 0 || re.display === "contents") && (t.has(v) || _t || Y) && (We || Y) && (!i.has(v) || We || _t || Y), je = $e ? 1 : 0, ae = [];
|
|
4979
5011
|
if ($e) {
|
|
4980
5012
|
const I = ye.some((z) => z.containsTextElement), R = n.has(v) && !I ? Ct : ee;
|
|
4981
|
-
ae.push(
|
|
5013
|
+
ae.push(_s(T, l, o, R.slice(0, 180)));
|
|
4982
5014
|
}
|
|
4983
5015
|
for (const I of q)
|
|
4984
5016
|
ae.push(...Ae(I, je));
|
|
@@ -5004,7 +5036,7 @@ function nr(s, e) {
|
|
|
5004
5036
|
`);
|
|
5005
5037
|
}, m = [], b = ne(window.getSelection()?.toString() ?? "");
|
|
5006
5038
|
b && m.push(`--- selected text ---
|
|
5007
|
-
${JSON.stringify(b)}`), d.length > 0 && m.push(
|
|
5039
|
+
${JSON.stringify(b)}`), d.length > 0 && m.push(ar(d, t, l, o));
|
|
5008
5040
|
for (const w of s.slice(0, 3))
|
|
5009
5041
|
m.push(y(w, "active overlay DOM", /* @__PURE__ */ new Set()));
|
|
5010
5042
|
if (e && m.push(y(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
|
|
@@ -5015,11 +5047,11 @@ ${JSON.stringify(b)}`), d.length > 0 && m.push(rr(d, t, l, o));
|
|
|
5015
5047
|
|
|
5016
5048
|
`);
|
|
5017
5049
|
}
|
|
5018
|
-
function
|
|
5050
|
+
function _s(s, e, t, n) {
|
|
5019
5051
|
const i = s.tagName.toLowerCase();
|
|
5020
5052
|
let r = i;
|
|
5021
5053
|
const o = s.getAttribute("id");
|
|
5022
|
-
o &&
|
|
5054
|
+
o && lr(o) && (r += `#${o}`);
|
|
5023
5055
|
for (const a of e) {
|
|
5024
5056
|
const l = s.getAttribute(a);
|
|
5025
5057
|
l && l.length <= 160 && (a !== "role" || !t.has(l)) && (r += `[${a}=${JSON.stringify(l)}]`);
|
|
@@ -5032,7 +5064,7 @@ function Cs(s, e, t, n) {
|
|
|
5032
5064
|
s.hasAttribute(a) && (r += `[${a}]`);
|
|
5033
5065
|
return `${r}${n ? ` ${JSON.stringify(n)}` : ""}`;
|
|
5034
5066
|
}
|
|
5035
|
-
function
|
|
5067
|
+
function or() {
|
|
5036
5068
|
const s = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), t = (a, l) => {
|
|
5037
5069
|
if (!a)
|
|
5038
5070
|
return;
|
|
@@ -5053,7 +5085,7 @@ function ir() {
|
|
|
5053
5085
|
n = n.shadowRoot.activeElement;
|
|
5054
5086
|
n !== document.body && n !== document.documentElement && t(n, "focused");
|
|
5055
5087
|
const i = window.getSelection();
|
|
5056
|
-
i && !i.isCollapsed && (t(
|
|
5088
|
+
i && !i.isCollapsed && (t(Yt(i.anchorNode), "selected text"), t(Yt(i.focusNode), "selected text"));
|
|
5057
5089
|
const r = [
|
|
5058
5090
|
["[aria-selected='true']", "selected"],
|
|
5059
5091
|
["[aria-current]:not([aria-current='false'])", "current"],
|
|
@@ -5075,7 +5107,7 @@ function ir() {
|
|
|
5075
5107
|
priorityTargets: Array.from(e, ([a, l]) => ({ element: a, labels: Array.from(l) }))
|
|
5076
5108
|
};
|
|
5077
5109
|
}
|
|
5078
|
-
function
|
|
5110
|
+
function ar(s, e, t, n) {
|
|
5079
5111
|
const i = ["--- active/current elements ---"];
|
|
5080
5112
|
for (const r of s) {
|
|
5081
5113
|
const o = [];
|
|
@@ -5086,18 +5118,18 @@ function rr(s, e, t, n) {
|
|
|
5086
5118
|
const d = a.getRootNode();
|
|
5087
5119
|
a = a.parentElement ?? (d instanceof ShadowRoot && d.host instanceof HTMLElement ? d.host : null);
|
|
5088
5120
|
}
|
|
5089
|
-
const l = o.length > 6 ? [o[0], ...o.slice(-5)] : o, c = l.map((u, d) =>
|
|
5121
|
+
const l = o.length > 6 ? [o[0], ...o.slice(-5)] : o, c = l.map((u, d) => _s(
|
|
5090
5122
|
u,
|
|
5091
5123
|
t,
|
|
5092
5124
|
n,
|
|
5093
|
-
d === l.length - 1 ?
|
|
5125
|
+
d === l.length - 1 ? Ps(u).slice(0, 180) : ""
|
|
5094
5126
|
));
|
|
5095
5127
|
o.length > l.length && c.splice(1, 0, "…"), i.push(`${r.labels.join(", ")}: ${c.join(" > ")}`);
|
|
5096
5128
|
}
|
|
5097
5129
|
return i.join(`
|
|
5098
5130
|
`);
|
|
5099
5131
|
}
|
|
5100
|
-
function
|
|
5132
|
+
function Yt(s) {
|
|
5101
5133
|
return s instanceof HTMLElement ? s : s?.parentElement instanceof HTMLElement ? s.parentElement : null;
|
|
5102
5134
|
}
|
|
5103
5135
|
function Ae(s, e) {
|
|
@@ -5106,17 +5138,17 @@ function Ae(s, e) {
|
|
|
5106
5138
|
const t = " ".repeat(e);
|
|
5107
5139
|
return s.map((n) => `${t}${n}`);
|
|
5108
5140
|
}
|
|
5109
|
-
function
|
|
5141
|
+
function Ps(s) {
|
|
5110
5142
|
return ne(
|
|
5111
5143
|
Array.from(s.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
|
|
5112
5144
|
);
|
|
5113
5145
|
}
|
|
5114
|
-
function
|
|
5146
|
+
function lr(s) {
|
|
5115
5147
|
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);
|
|
5116
5148
|
}
|
|
5117
|
-
function
|
|
5118
|
-
const s = Array.from(document.querySelectorAll(
|
|
5119
|
-
(r) => typeof r[
|
|
5149
|
+
function vs() {
|
|
5150
|
+
const s = Array.from(document.querySelectorAll($t)), e = s.find(
|
|
5151
|
+
(r) => typeof r[Jn] == "string"
|
|
5120
5152
|
);
|
|
5121
5153
|
if (!(e ?? s[0]))
|
|
5122
5154
|
return;
|
|
@@ -5127,28 +5159,28 @@ function Ps() {
|
|
|
5127
5159
|
selectors: [
|
|
5128
5160
|
{
|
|
5129
5161
|
name: "widget_host",
|
|
5130
|
-
selector:
|
|
5162
|
+
selector: $t,
|
|
5131
5163
|
description: "Finds Pluno's shadow-host element in the host page DOM."
|
|
5132
5164
|
},
|
|
5133
5165
|
{
|
|
5134
5166
|
name: "widget_root",
|
|
5135
|
-
selector:
|
|
5167
|
+
selector: Gn,
|
|
5136
5168
|
description: "Finds Pluno's widget root inside the widget host shadow root."
|
|
5137
5169
|
},
|
|
5138
5170
|
{
|
|
5139
5171
|
name: "widget_panel",
|
|
5140
|
-
selector:
|
|
5172
|
+
selector: Vn,
|
|
5141
5173
|
description: "Finds Pluno's open chat panel inside the widget host shadow root."
|
|
5142
5174
|
},
|
|
5143
5175
|
{
|
|
5144
5176
|
name: "widget_timeline",
|
|
5145
|
-
selector:
|
|
5177
|
+
selector: Qn,
|
|
5146
5178
|
description: "Finds Pluno's chat timeline inside the widget host shadow root."
|
|
5147
5179
|
}
|
|
5148
5180
|
]
|
|
5149
5181
|
};
|
|
5150
5182
|
}
|
|
5151
|
-
function
|
|
5183
|
+
function cr(s) {
|
|
5152
5184
|
try {
|
|
5153
5185
|
const e = JSON.parse(s);
|
|
5154
5186
|
return e && typeof e == "object" ? e : { type: "error", message: "Invalid server event" };
|
|
@@ -5156,7 +5188,7 @@ function ar(s) {
|
|
|
5156
5188
|
return { type: "error", message: "Invalid server event" };
|
|
5157
5189
|
}
|
|
5158
5190
|
}
|
|
5159
|
-
function
|
|
5191
|
+
function ur(s) {
|
|
5160
5192
|
if (typeof s != "string")
|
|
5161
5193
|
return null;
|
|
5162
5194
|
try {
|
|
@@ -5166,13 +5198,13 @@ function lr(s) {
|
|
|
5166
5198
|
return null;
|
|
5167
5199
|
}
|
|
5168
5200
|
}
|
|
5169
|
-
function
|
|
5201
|
+
function Zt(s, e) {
|
|
5170
5202
|
if (!s || typeof s != "object")
|
|
5171
5203
|
return [];
|
|
5172
5204
|
const t = s[e];
|
|
5173
5205
|
return Array.isArray(t) ? t.filter((n) => typeof n == "string" && n.trim().length > 0) : [];
|
|
5174
5206
|
}
|
|
5175
|
-
function
|
|
5207
|
+
function es(s) {
|
|
5176
5208
|
return Array.isArray(s) ? s.flatMap((e) => {
|
|
5177
5209
|
if (!e || typeof e != "object")
|
|
5178
5210
|
return [];
|
|
@@ -5180,10 +5212,10 @@ function Zt(s) {
|
|
|
5180
5212
|
return typeof t.taskId != "string" || !t.taskId || typeof t.dueAt != "string" || Number.isNaN(Date.parse(t.dueAt)) ? [] : [{ taskId: t.taskId, dueAt: t.dueAt }];
|
|
5181
5213
|
}) : [];
|
|
5182
5214
|
}
|
|
5183
|
-
function
|
|
5215
|
+
function dr(s) {
|
|
5184
5216
|
return Array.isArray(s) ? s.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
|
|
5185
5217
|
}
|
|
5186
|
-
function
|
|
5218
|
+
function hr(s) {
|
|
5187
5219
|
if (!s || typeof s != "object")
|
|
5188
5220
|
return null;
|
|
5189
5221
|
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;
|
|
@@ -5194,13 +5226,13 @@ function ur(s) {
|
|
|
5194
5226
|
...a !== null ? { scribbleStyle: a } : {}
|
|
5195
5227
|
};
|
|
5196
5228
|
}
|
|
5197
|
-
function
|
|
5229
|
+
function pr(s) {
|
|
5198
5230
|
if (!s || typeof s != "object")
|
|
5199
5231
|
return null;
|
|
5200
5232
|
const e = s.javascript;
|
|
5201
5233
|
return typeof e != "string" || !e.trim() ? null : { javascript: e };
|
|
5202
5234
|
}
|
|
5203
|
-
function
|
|
5235
|
+
function gr(s, e) {
|
|
5204
5236
|
return e ? s && typeof s == "object" ? {
|
|
5205
5237
|
...s,
|
|
5206
5238
|
helperError: e
|
|
@@ -5210,13 +5242,13 @@ function hr(s, e) {
|
|
|
5210
5242
|
helperError: e
|
|
5211
5243
|
} : s;
|
|
5212
5244
|
}
|
|
5213
|
-
function
|
|
5245
|
+
function fr(s) {
|
|
5214
5246
|
if (!s || typeof s != "object")
|
|
5215
5247
|
return s;
|
|
5216
5248
|
const e = s;
|
|
5217
5249
|
return typeof e.exception?.message == "string" ? e.exception.message : typeof e.error == "string" ? e.error : s;
|
|
5218
5250
|
}
|
|
5219
|
-
function
|
|
5251
|
+
function mr() {
|
|
5220
5252
|
const s = "pluno.productAgent.clientId", e = window.localStorage.getItem(s);
|
|
5221
5253
|
if (e)
|
|
5222
5254
|
return e;
|
|
@@ -5226,7 +5258,7 @@ function gr() {
|
|
|
5226
5258
|
function x() {
|
|
5227
5259
|
return crypto.randomUUID();
|
|
5228
5260
|
}
|
|
5229
|
-
function
|
|
5261
|
+
function yr(s) {
|
|
5230
5262
|
if (!s || typeof s != "object")
|
|
5231
5263
|
return null;
|
|
5232
5264
|
const e = s, t = typeof e.id == "string" ? e.id : null;
|
|
@@ -5242,7 +5274,7 @@ function st(s, e) {
|
|
|
5242
5274
|
s.map((t) => Ue(t, e)).filter((t) => t !== null)
|
|
5243
5275
|
) : [];
|
|
5244
5276
|
}
|
|
5245
|
-
function
|
|
5277
|
+
function Ir(s) {
|
|
5246
5278
|
return Array.isArray(s) ? s.flatMap((e) => {
|
|
5247
5279
|
if (!e || typeof e != "object")
|
|
5248
5280
|
return [];
|
|
@@ -5270,7 +5302,7 @@ function Ue(s, e) {
|
|
|
5270
5302
|
if (!n || typeof n != "object")
|
|
5271
5303
|
return null;
|
|
5272
5304
|
const i = n;
|
|
5273
|
-
if (i.hiddenFromTranscript === !0 ||
|
|
5305
|
+
if (i.hiddenFromTranscript === !0 || mn(i) || i.type === "tab_lifecycle_decision" && i.decision === "keep")
|
|
5274
5306
|
return null;
|
|
5275
5307
|
if (i.type === "assistant_draft")
|
|
5276
5308
|
return {
|
|
@@ -5278,7 +5310,7 @@ function Ue(s, e) {
|
|
|
5278
5310
|
role: "assistant",
|
|
5279
5311
|
...i.phase === "commentary" || i.phase === "final_answer" ? { phase: i.phase } : {},
|
|
5280
5312
|
content: qt(
|
|
5281
|
-
|
|
5313
|
+
ts(i.content),
|
|
5282
5314
|
e
|
|
5283
5315
|
),
|
|
5284
5316
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -5295,7 +5327,7 @@ function Ue(s, e) {
|
|
|
5295
5327
|
role: r,
|
|
5296
5328
|
...i.phase === "commentary" || i.phase === "final_answer" ? { phase: i.phase } : {},
|
|
5297
5329
|
content: qt(
|
|
5298
|
-
|
|
5330
|
+
ts(i.content),
|
|
5299
5331
|
e
|
|
5300
5332
|
),
|
|
5301
5333
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -5303,7 +5335,7 @@ function Ue(s, e) {
|
|
|
5303
5335
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
5304
5336
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5305
5337
|
...k(i) ? { runId: k(i) } : {},
|
|
5306
|
-
attachments:
|
|
5338
|
+
attachments: Ns(i.attachments, e),
|
|
5307
5339
|
...i.steered === !0 ? { steered: !0 } : {}
|
|
5308
5340
|
};
|
|
5309
5341
|
return r === "assistant" && typeof i.id == "string" && Object.defineProperty(o, "assistantDraftItemId", {
|
|
@@ -5318,7 +5350,7 @@ function Ue(s, e) {
|
|
|
5318
5350
|
}), o;
|
|
5319
5351
|
}
|
|
5320
5352
|
if (i.type === "function_call_output") {
|
|
5321
|
-
const r =
|
|
5353
|
+
const r = hn(i.output);
|
|
5322
5354
|
if (r !== null)
|
|
5323
5355
|
return {
|
|
5324
5356
|
id: String(t.id ?? crypto.randomUUID()),
|
|
@@ -5333,7 +5365,7 @@ function Ue(s, e) {
|
|
|
5333
5365
|
callId: ue(i) ?? void 0,
|
|
5334
5366
|
sharePromptAllowed: r
|
|
5335
5367
|
};
|
|
5336
|
-
const o =
|
|
5368
|
+
const o = En(i.output);
|
|
5337
5369
|
if (o)
|
|
5338
5370
|
return {
|
|
5339
5371
|
id: String(t.id ?? crypto.randomUUID()),
|
|
@@ -5344,12 +5376,12 @@ function Ue(s, e) {
|
|
|
5344
5376
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5345
5377
|
...k(i) ? { runId: k(i) } : {},
|
|
5346
5378
|
dataType: "scheduled_check_in",
|
|
5347
|
-
toolName:
|
|
5379
|
+
toolName: Ss,
|
|
5348
5380
|
callId: ue(i) ?? void 0,
|
|
5349
5381
|
scheduledCheckInId: o.id ?? void 0,
|
|
5350
5382
|
scheduledCheckInAt: o.dueAt
|
|
5351
5383
|
};
|
|
5352
|
-
const a =
|
|
5384
|
+
const a = Tr(i.output), l = wr(i.output);
|
|
5353
5385
|
return a ? {
|
|
5354
5386
|
id: String(t.id ?? crypto.randomUUID()),
|
|
5355
5387
|
role: "tool",
|
|
@@ -5381,7 +5413,7 @@ function Ue(s, e) {
|
|
|
5381
5413
|
return i.type === "function_call" || i.type === "tool_call" || i.type === "web_search_call" || i.type === "mcp_call" || i.type === "tab_lifecycle_decision" ? {
|
|
5382
5414
|
id: String(t.id ?? crypto.randomUUID()),
|
|
5383
5415
|
role: "tool",
|
|
5384
|
-
content: i.type === "mcp_call" ?
|
|
5416
|
+
content: i.type === "mcp_call" ? Sr(i) : br(i),
|
|
5385
5417
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5386
5418
|
...E(i) !== null ? { displaySequence: E(i) } : {},
|
|
5387
5419
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
@@ -5395,7 +5427,7 @@ function Ue(s, e) {
|
|
|
5395
5427
|
} : i.type === "run_status" || i.type === "run_error" ? i.type === "run_error" && i.stage === "tool_execution" ? null : {
|
|
5396
5428
|
id: String(t.id ?? crypto.randomUUID()),
|
|
5397
5429
|
role: "system",
|
|
5398
|
-
content:
|
|
5430
|
+
content: Ar(i),
|
|
5399
5431
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5400
5432
|
...E(i) !== null ? { displaySequence: E(i) } : {},
|
|
5401
5433
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
@@ -5408,11 +5440,11 @@ function Ue(s, e) {
|
|
|
5408
5440
|
...typeof i.securitySettingsUrl == "string" ? { securitySettingsUrl: i.securitySettingsUrl } : {}
|
|
5409
5441
|
} : null;
|
|
5410
5442
|
}
|
|
5411
|
-
function
|
|
5443
|
+
function Sr(s) {
|
|
5412
5444
|
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(" ");
|
|
5413
5445
|
return t ? `🔌 Using ${t}` : "🔌 Using connected integration";
|
|
5414
5446
|
}
|
|
5415
|
-
function
|
|
5447
|
+
function Tr(s) {
|
|
5416
5448
|
if (typeof s != "string")
|
|
5417
5449
|
return null;
|
|
5418
5450
|
try {
|
|
@@ -5429,7 +5461,7 @@ function Ir(s) {
|
|
|
5429
5461
|
return null;
|
|
5430
5462
|
}
|
|
5431
5463
|
}
|
|
5432
|
-
function
|
|
5464
|
+
function wr(s) {
|
|
5433
5465
|
if (typeof s != "string")
|
|
5434
5466
|
return null;
|
|
5435
5467
|
try {
|
|
@@ -5444,10 +5476,10 @@ function Sr(s) {
|
|
|
5444
5476
|
return null;
|
|
5445
5477
|
}
|
|
5446
5478
|
}
|
|
5447
|
-
function
|
|
5479
|
+
function Ar(s) {
|
|
5448
5480
|
return s.type === "run_status" && s.status === "steered" ? "Steered" : typeof s.message == "string" && s.message.trim().length > 0 ? s.message : "";
|
|
5449
5481
|
}
|
|
5450
|
-
function
|
|
5482
|
+
function br(s) {
|
|
5451
5483
|
if (s.type === "web_search_call") {
|
|
5452
5484
|
const e = s.action;
|
|
5453
5485
|
if (e && typeof e == "object") {
|
|
@@ -5459,9 +5491,9 @@ function wr(s) {
|
|
|
5459
5491
|
}
|
|
5460
5492
|
return "🔎 Searching the web";
|
|
5461
5493
|
}
|
|
5462
|
-
return
|
|
5494
|
+
return Mr(s);
|
|
5463
5495
|
}
|
|
5464
|
-
function
|
|
5496
|
+
function Mr(s) {
|
|
5465
5497
|
if (typeof s.summary == "string" && s.summary.trim().length > 0)
|
|
5466
5498
|
return se(s.summary);
|
|
5467
5499
|
if (typeof s.arguments == "string")
|
|
@@ -5478,7 +5510,7 @@ function se(s) {
|
|
|
5478
5510
|
const e = s.trim() || "Run tool", t = e.codePointAt(0) ?? 0;
|
|
5479
5511
|
return t >= 126976 && t <= 129791 || t >= 9728 && t <= 10175 || t >= 127462 && t <= 127487 ? e : `🛠️ ${e}`;
|
|
5480
5512
|
}
|
|
5481
|
-
function
|
|
5513
|
+
function Rr(s) {
|
|
5482
5514
|
if (s == null)
|
|
5483
5515
|
return s;
|
|
5484
5516
|
if (typeof s != "object")
|
|
@@ -5503,7 +5535,7 @@ function P(s) {
|
|
|
5503
5535
|
function E(s) {
|
|
5504
5536
|
return typeof s.displaySequence == "number" && Number.isSafeInteger(s.displaySequence) ? s.displaySequence : null;
|
|
5505
5537
|
}
|
|
5506
|
-
function
|
|
5538
|
+
function ts(s) {
|
|
5507
5539
|
return typeof s == "string" ? s : Array.isArray(s) ? s.map((e) => {
|
|
5508
5540
|
if (!e || typeof e != "object")
|
|
5509
5541
|
return "";
|
|
@@ -5512,13 +5544,13 @@ function es(s) {
|
|
|
5512
5544
|
}).filter(Boolean).join("") : "";
|
|
5513
5545
|
}
|
|
5514
5546
|
function de(s, e) {
|
|
5515
|
-
const t =
|
|
5547
|
+
const t = Us(
|
|
5516
5548
|
s,
|
|
5517
5549
|
Mt(s, e)
|
|
5518
|
-
), n =
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5550
|
+
), n = Cr(
|
|
5551
|
+
Er(
|
|
5552
|
+
Ur(
|
|
5553
|
+
kr(s, e),
|
|
5522
5554
|
e
|
|
5523
5555
|
),
|
|
5524
5556
|
t
|
|
@@ -5543,7 +5575,7 @@ function Mt(s, e, t = !0) {
|
|
|
5543
5575
|
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] : []);
|
|
5544
5576
|
return e.displaySequence = (i.length > 0 ? Math.max(...i) : 0) + 1, e;
|
|
5545
5577
|
}
|
|
5546
|
-
function
|
|
5578
|
+
function kr(s, e) {
|
|
5547
5579
|
const t = e.proactiveSuggestionClientMessageId;
|
|
5548
5580
|
if (!t)
|
|
5549
5581
|
return s;
|
|
@@ -5553,7 +5585,7 @@ function Mr(s, e) {
|
|
|
5553
5585
|
const r = [...s];
|
|
5554
5586
|
return r[i] = e, r;
|
|
5555
5587
|
}
|
|
5556
|
-
function
|
|
5588
|
+
function Er(s, e) {
|
|
5557
5589
|
const t = e.assistantDraftItemId;
|
|
5558
5590
|
return t ? s.map(
|
|
5559
5591
|
(n) => n.dataType === "assistant_draft" && n.id === t ? e : n
|
|
@@ -5562,7 +5594,7 @@ function Rr(s, e) {
|
|
|
5562
5594
|
function be(s, e, t) {
|
|
5563
5595
|
return e !== null ? s.respondsToUserMessageId === e : t !== null && s.runId === t;
|
|
5564
5596
|
}
|
|
5565
|
-
function
|
|
5597
|
+
function ss(s, e, t, n) {
|
|
5566
5598
|
if (t === null) return s;
|
|
5567
5599
|
let i = -1;
|
|
5568
5600
|
for (let o = s.length - 1; o >= 0; o -= 1) {
|
|
@@ -5579,7 +5611,7 @@ function ts(s, e, t, n) {
|
|
|
5579
5611
|
respondsToUserMessageId: t
|
|
5580
5612
|
}, r;
|
|
5581
5613
|
}
|
|
5582
|
-
function
|
|
5614
|
+
function ns(s, e) {
|
|
5583
5615
|
const t = s.findIndex(
|
|
5584
5616
|
(i) => !i.id.startsWith("transient-activity:") && i.callId === e.callId
|
|
5585
5617
|
);
|
|
@@ -5596,12 +5628,12 @@ function ss(s, e) {
|
|
|
5596
5628
|
...n[t].runId ? {} : { runId: e.runId }
|
|
5597
5629
|
}, n;
|
|
5598
5630
|
}
|
|
5599
|
-
function
|
|
5631
|
+
function is(s, e, t) {
|
|
5600
5632
|
let n = !1;
|
|
5601
5633
|
const i = s.map((r) => r.callId !== e || r.loading === t ? r : (n = !0, { ...r, loading: t }));
|
|
5602
5634
|
return n ? i : s;
|
|
5603
5635
|
}
|
|
5604
|
-
function
|
|
5636
|
+
function rs(s) {
|
|
5605
5637
|
if (s.hiddenFromTranscript === !0)
|
|
5606
5638
|
return null;
|
|
5607
5639
|
const e = typeof s.callId == "string" ? s.callId : null, t = typeof s.toolName == "string" ? s.toolName : null;
|
|
@@ -5621,7 +5653,7 @@ function is(s) {
|
|
|
5621
5653
|
loading: !0
|
|
5622
5654
|
};
|
|
5623
5655
|
}
|
|
5624
|
-
function
|
|
5656
|
+
function Cr(s, e) {
|
|
5625
5657
|
if (e.id.startsWith("transient-activity:"))
|
|
5626
5658
|
return s;
|
|
5627
5659
|
const t = e.toolName === "tab_lifecycle";
|
|
@@ -5635,19 +5667,19 @@ function ct(s, e) {
|
|
|
5635
5667
|
for (const n of e) {
|
|
5636
5668
|
const i = [...s, ...t];
|
|
5637
5669
|
t.push(
|
|
5638
|
-
|
|
5670
|
+
Us(
|
|
5639
5671
|
i,
|
|
5640
5672
|
Mt(i, n, !1)
|
|
5641
5673
|
)
|
|
5642
5674
|
);
|
|
5643
5675
|
}
|
|
5644
|
-
return
|
|
5676
|
+
return yn(
|
|
5645
5677
|
s,
|
|
5646
5678
|
t,
|
|
5647
5679
|
ut
|
|
5648
5680
|
);
|
|
5649
5681
|
}
|
|
5650
|
-
function
|
|
5682
|
+
function _r(s, e) {
|
|
5651
5683
|
const t = new Map(s.map((r) => [r.id, r])), n = e.map(
|
|
5652
5684
|
(r) => Mt(s, r, !1)
|
|
5653
5685
|
);
|
|
@@ -5688,42 +5720,42 @@ function ut(s) {
|
|
|
5688
5720
|
isTransient: s.id.startsWith("transient-activity:") || s.dataType === "assistant_draft"
|
|
5689
5721
|
};
|
|
5690
5722
|
}
|
|
5691
|
-
function
|
|
5723
|
+
function Us(s, e) {
|
|
5692
5724
|
if (e.role !== "user" || !e.attachments?.length)
|
|
5693
5725
|
return e;
|
|
5694
5726
|
const t = s.find(
|
|
5695
|
-
(o) => o.role === "user" && (o.id === e.id || He(o) &&
|
|
5727
|
+
(o) => o.role === "user" && (o.id === e.id || He(o) && Ds(o, e))
|
|
5696
5728
|
);
|
|
5697
5729
|
if (!t?.attachments?.length)
|
|
5698
5730
|
return e;
|
|
5699
5731
|
const n = e.attachments.map((o) => {
|
|
5700
|
-
const a =
|
|
5701
|
-
return a ?
|
|
5732
|
+
const a = Pr(t.attachments ?? [], o);
|
|
5733
|
+
return a ? vr(o, a) : o;
|
|
5702
5734
|
}), i = { ...e, attachments: n }, r = X(e);
|
|
5703
5735
|
return r && Object.defineProperty(i, "clientMessageId", {
|
|
5704
5736
|
value: r,
|
|
5705
5737
|
enumerable: !1
|
|
5706
5738
|
}), i;
|
|
5707
5739
|
}
|
|
5708
|
-
function
|
|
5740
|
+
function Pr(s, e) {
|
|
5709
5741
|
return e.id ? s.find((t) => t.id === e.id) ?? null : null;
|
|
5710
5742
|
}
|
|
5711
|
-
function
|
|
5743
|
+
function vr(s, e) {
|
|
5712
5744
|
const { previewUrl: t } = e;
|
|
5713
5745
|
return t ? { ...s, previewUrl: t } : s;
|
|
5714
5746
|
}
|
|
5715
|
-
function
|
|
5747
|
+
function Ur(s, e) {
|
|
5716
5748
|
if (e.role !== "user")
|
|
5717
5749
|
return s;
|
|
5718
5750
|
const t = s.findIndex(
|
|
5719
|
-
(i) => He(i) &&
|
|
5751
|
+
(i) => He(i) && Ds(i, e)
|
|
5720
5752
|
);
|
|
5721
5753
|
if (t === -1)
|
|
5722
5754
|
return s;
|
|
5723
5755
|
const n = [...s];
|
|
5724
5756
|
return n.splice(t, 1), n;
|
|
5725
5757
|
}
|
|
5726
|
-
function
|
|
5758
|
+
function Ds(s, e) {
|
|
5727
5759
|
const t = X(s), n = X(e);
|
|
5728
5760
|
return t && n ? t === n : s.content === e.content;
|
|
5729
5761
|
}
|
|
@@ -5739,8 +5771,8 @@ function X(s) {
|
|
|
5739
5771
|
);
|
|
5740
5772
|
return n ? s.id.slice(n.length) : null;
|
|
5741
5773
|
}
|
|
5742
|
-
function
|
|
5743
|
-
const e =
|
|
5774
|
+
function os(s) {
|
|
5775
|
+
const e = qs(s);
|
|
5744
5776
|
if (e === null)
|
|
5745
5777
|
return !1;
|
|
5746
5778
|
const t = s[e].id;
|
|
@@ -5763,7 +5795,7 @@ function rs(s) {
|
|
|
5763
5795
|
}
|
|
5764
5796
|
return !1;
|
|
5765
5797
|
}
|
|
5766
|
-
function
|
|
5798
|
+
function Dr(s, e, t) {
|
|
5767
5799
|
const n = new Set(
|
|
5768
5800
|
s.filter(
|
|
5769
5801
|
(i) => i.role === "user" && e !== null && X(i) === e
|
|
@@ -5777,14 +5809,14 @@ function vr(s, e, t) {
|
|
|
5777
5809
|
if (t && i.runId === t) {
|
|
5778
5810
|
if (n.size === 0)
|
|
5779
5811
|
return !0;
|
|
5780
|
-
const o =
|
|
5812
|
+
const o = Os(s, r);
|
|
5781
5813
|
return !i.respondsToUserMessageId && o !== null && n.has(o);
|
|
5782
5814
|
}
|
|
5783
5815
|
return !1;
|
|
5784
5816
|
});
|
|
5785
5817
|
}
|
|
5786
|
-
function
|
|
5787
|
-
const e =
|
|
5818
|
+
function qr(s) {
|
|
5819
|
+
const e = qs(s);
|
|
5788
5820
|
if (e === null)
|
|
5789
5821
|
return s.some(W);
|
|
5790
5822
|
const t = s[e].id;
|
|
@@ -5792,7 +5824,7 @@ function Ur(s) {
|
|
|
5792
5824
|
(n) => n.respondsToUserMessageId === t && W(n)
|
|
5793
5825
|
) : s.slice(e + 1).some(W);
|
|
5794
5826
|
}
|
|
5795
|
-
function
|
|
5827
|
+
function qs(s) {
|
|
5796
5828
|
for (let e = s.length - 1; e >= 0; e -= 1)
|
|
5797
5829
|
if (s[e].role === "user" && !He(s[e]))
|
|
5798
5830
|
return e;
|
|
@@ -5815,7 +5847,7 @@ function ie(s) {
|
|
|
5815
5847
|
}
|
|
5816
5848
|
return null;
|
|
5817
5849
|
}
|
|
5818
|
-
function
|
|
5850
|
+
function Or(s) {
|
|
5819
5851
|
const e = ie(s);
|
|
5820
5852
|
if (e === null)
|
|
5821
5853
|
return null;
|
|
@@ -5834,10 +5866,10 @@ function C(s) {
|
|
|
5834
5866
|
function pe(s) {
|
|
5835
5867
|
return s?.retryable !== !0 ? !1 : s.type === "run_error" ? !0 : s.type === "run_status" && s.status === "interrupted";
|
|
5836
5868
|
}
|
|
5837
|
-
function
|
|
5869
|
+
function xr(s) {
|
|
5838
5870
|
return s?.type === "run_status" && s.status === "interrupted" && s.reason === "backend_restart";
|
|
5839
5871
|
}
|
|
5840
|
-
function
|
|
5872
|
+
function Lr(s, e) {
|
|
5841
5873
|
const t = ie(e);
|
|
5842
5874
|
if (t === null)
|
|
5843
5875
|
return !1;
|
|
@@ -5862,7 +5894,7 @@ function dt(s) {
|
|
|
5862
5894
|
const i = n.clientMessageId;
|
|
5863
5895
|
return typeof i == "string" ? i : null;
|
|
5864
5896
|
}
|
|
5865
|
-
function
|
|
5897
|
+
function Nr(s) {
|
|
5866
5898
|
const e = ie(s);
|
|
5867
5899
|
if (e === null)
|
|
5868
5900
|
return null;
|
|
@@ -5892,8 +5924,8 @@ function ht(s, e) {
|
|
|
5892
5924
|
const n = s.find((r) => A(r, "id") === t), i = C(n);
|
|
5893
5925
|
return i?.type === "message" && i.role === "user" && typeof i.clientMessageId == "string" ? i.clientMessageId : null;
|
|
5894
5926
|
}
|
|
5895
|
-
function
|
|
5896
|
-
if (!e || !
|
|
5927
|
+
function as(s, e, t, n, i, r) {
|
|
5928
|
+
if (!e || !Br(s))
|
|
5897
5929
|
return !1;
|
|
5898
5930
|
const o = s;
|
|
5899
5931
|
if (pe(o) || t !== null && typeof o.id == "string" && o.id !== t)
|
|
@@ -5901,7 +5933,7 @@ function os(s, e, t, n, i, r) {
|
|
|
5901
5933
|
const a = O(o);
|
|
5902
5934
|
return n !== null ? a !== null ? a === n : i !== null && k(o) === i && r === n : i === null || k(o) === i;
|
|
5903
5935
|
}
|
|
5904
|
-
function
|
|
5936
|
+
function Hr(s, e) {
|
|
5905
5937
|
for (let t = e - 1; t >= 0; t -= 1) {
|
|
5906
5938
|
const n = C(s[t]);
|
|
5907
5939
|
if (n?.type === "message" && n.role === "user")
|
|
@@ -5909,13 +5941,13 @@ function Lr(s, e) {
|
|
|
5909
5941
|
}
|
|
5910
5942
|
return null;
|
|
5911
5943
|
}
|
|
5912
|
-
function
|
|
5944
|
+
function Os(s, e) {
|
|
5913
5945
|
for (let t = e - 1; t >= 0; t -= 1)
|
|
5914
5946
|
if (s[t].role === "user")
|
|
5915
5947
|
return s[t].id;
|
|
5916
5948
|
return null;
|
|
5917
5949
|
}
|
|
5918
|
-
function
|
|
5950
|
+
function Br(s) {
|
|
5919
5951
|
if (!s || typeof s != "object")
|
|
5920
5952
|
return !1;
|
|
5921
5953
|
const e = s;
|
|
@@ -5924,16 +5956,16 @@ function Nr(s) {
|
|
|
5924
5956
|
function W(s) {
|
|
5925
5957
|
return s.role === "assistant" && s.phase !== "commentary";
|
|
5926
5958
|
}
|
|
5927
|
-
function
|
|
5959
|
+
function Fr(s) {
|
|
5928
5960
|
if (!s || typeof s != "object")
|
|
5929
5961
|
return !1;
|
|
5930
5962
|
const e = s;
|
|
5931
5963
|
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";
|
|
5932
5964
|
}
|
|
5933
5965
|
function pt(s) {
|
|
5934
|
-
return s.filter((e, t) => G(e) ? !
|
|
5966
|
+
return s.filter((e, t) => G(e) ? !eo(s, t) && !xs(s, t) && !Yr(s, t) && !Zr(s, t) : Wr(e) ? e.retryable === !0 && Xr(s, t) ? !1 : !Jr(s, t) : !0);
|
|
5935
5967
|
}
|
|
5936
|
-
function
|
|
5968
|
+
function Wr(s) {
|
|
5937
5969
|
return s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.steered !== !0);
|
|
5938
5970
|
}
|
|
5939
5971
|
function G(s) {
|
|
@@ -5942,19 +5974,19 @@ function G(s) {
|
|
|
5942
5974
|
function gt(s) {
|
|
5943
5975
|
return s.steered !== !0 && (s.dataType === "assistant_draft" || s.loading === !0);
|
|
5944
5976
|
}
|
|
5945
|
-
function
|
|
5977
|
+
function $r(s) {
|
|
5946
5978
|
return s.some(gt);
|
|
5947
5979
|
}
|
|
5948
|
-
function
|
|
5980
|
+
function ls(s, e) {
|
|
5949
5981
|
return (s.retryable === !0 || s.code === "transient_model_error") && s.code !== "run_recovery_exhausted" && e !== null && typeof s.clientMessageId == "string";
|
|
5950
5982
|
}
|
|
5951
|
-
function
|
|
5983
|
+
function jr(s, e) {
|
|
5952
5984
|
const t = [...s].reverse().find(gt), n = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : t?.respondsToUserMessageId ?? null, i = typeof e.runId == "string" ? e.runId : t?.runId ?? null;
|
|
5953
5985
|
return s.flatMap((r) => (n ? r.respondsToUserMessageId === n || !r.respondsToUserMessageId && i !== null && r.runId === i : i ? r.runId === i : gt(r)) ? r.dataType === "assistant_draft" || G(r) ? [] : r.loading === !0 ? [{ ...r, loading: !1 }] : [r] : [r]);
|
|
5954
5986
|
}
|
|
5955
|
-
function
|
|
5987
|
+
function zr(s, e, t, n) {
|
|
5956
5988
|
const i = s.findIndex(
|
|
5957
|
-
(l, c) => G(l) && !
|
|
5989
|
+
(l, c) => G(l) && !xs(s, c)
|
|
5958
5990
|
), r = i === -1 ? null : s[i], o = e ?? r?.respondsToUserMessageId ?? null, a = o ? s.find(
|
|
5959
5991
|
(l) => l.role === "user" && l.id === o
|
|
5960
5992
|
) : null;
|
|
@@ -5967,10 +5999,10 @@ function $r(s, e, t, n) {
|
|
|
5967
5999
|
function _e(s) {
|
|
5968
6000
|
return s?.type === "run_status" && s.status === "stopped";
|
|
5969
6001
|
}
|
|
5970
|
-
function
|
|
6002
|
+
function Kr(s, e) {
|
|
5971
6003
|
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;
|
|
5972
6004
|
}
|
|
5973
|
-
function
|
|
6005
|
+
function cs(s, e, t) {
|
|
5974
6006
|
const n = new Set(
|
|
5975
6007
|
s.filter(
|
|
5976
6008
|
(i) => i.role === "user" && e !== null && X(i) === e
|
|
@@ -5980,16 +6012,16 @@ function ls(s, e, t) {
|
|
|
5980
6012
|
(i) => !G(i) || (n.size > 0 ? !i.respondsToUserMessageId || !n.has(i.respondsToUserMessageId) : !t || i.runId !== t)
|
|
5981
6013
|
);
|
|
5982
6014
|
}
|
|
5983
|
-
function
|
|
6015
|
+
function xs(s, e) {
|
|
5984
6016
|
return s.some(
|
|
5985
|
-
(t, n) => n !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) &&
|
|
6017
|
+
(t, n) => n !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) && Gr(
|
|
5986
6018
|
s,
|
|
5987
6019
|
e,
|
|
5988
6020
|
n
|
|
5989
6021
|
)
|
|
5990
6022
|
);
|
|
5991
6023
|
}
|
|
5992
|
-
function
|
|
6024
|
+
function Gr(s, e, t) {
|
|
5993
6025
|
const n = s[e], i = s[t];
|
|
5994
6026
|
if (ge(n, i))
|
|
5995
6027
|
return !0;
|
|
@@ -6000,20 +6032,20 @@ function zr(s, e, t) {
|
|
|
6000
6032
|
return s[r].id === n.respondsToUserMessageId;
|
|
6001
6033
|
return !1;
|
|
6002
6034
|
}
|
|
6003
|
-
function
|
|
6035
|
+
function us(s, e, t, n) {
|
|
6004
6036
|
const i = (t && t !== e ? t : null) ?? [...s].reverse().find(
|
|
6005
|
-
(l) => l.respondsToUserMessageId !== void 0 && l.respondsToUserMessageId !== e &&
|
|
6037
|
+
(l) => l.respondsToUserMessageId !== void 0 && l.respondsToUserMessageId !== e && ds(l) && !Qr(
|
|
6006
6038
|
s,
|
|
6007
6039
|
l.respondsToUserMessageId
|
|
6008
6040
|
)
|
|
6009
|
-
)?.respondsToUserMessageId ??
|
|
6041
|
+
)?.respondsToUserMessageId ?? Vr(
|
|
6010
6042
|
s,
|
|
6011
6043
|
e
|
|
6012
6044
|
);
|
|
6013
6045
|
if (!i)
|
|
6014
6046
|
return s;
|
|
6015
6047
|
let r = !1;
|
|
6016
|
-
const o = s.map((l) => l.respondsToUserMessageId !== i || !
|
|
6048
|
+
const o = s.map((l) => l.respondsToUserMessageId !== i || !ds(l) ? l : (r = !0, { ...l, steered: !0 }));
|
|
6017
6049
|
if (r)
|
|
6018
6050
|
return o;
|
|
6019
6051
|
const a = s.find(
|
|
@@ -6035,7 +6067,7 @@ function cs(s, e, t, n) {
|
|
|
6035
6067
|
}
|
|
6036
6068
|
];
|
|
6037
6069
|
}
|
|
6038
|
-
function
|
|
6070
|
+
function Vr(s, e) {
|
|
6039
6071
|
const t = s.findIndex(
|
|
6040
6072
|
(n) => n.role === "user" && n.id === e
|
|
6041
6073
|
);
|
|
@@ -6046,15 +6078,15 @@ function Kr(s, e) {
|
|
|
6046
6078
|
return s[n].id;
|
|
6047
6079
|
return null;
|
|
6048
6080
|
}
|
|
6049
|
-
function
|
|
6081
|
+
function ds(s) {
|
|
6050
6082
|
return s.role === "tool" || G(s) ? !0 : s.role === "assistant" && s.phase === "commentary";
|
|
6051
6083
|
}
|
|
6052
|
-
function
|
|
6084
|
+
function Qr(s, e) {
|
|
6053
6085
|
return s.some(
|
|
6054
6086
|
(t) => t.respondsToUserMessageId === e && (W(t) || t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0))
|
|
6055
6087
|
);
|
|
6056
6088
|
}
|
|
6057
|
-
function
|
|
6089
|
+
function Jr(s, e) {
|
|
6058
6090
|
const t = s[e];
|
|
6059
6091
|
for (let n = e + 1; n < s.length; n += 1) {
|
|
6060
6092
|
const i = s[n];
|
|
@@ -6063,7 +6095,7 @@ function Vr(s, e) {
|
|
|
6063
6095
|
}
|
|
6064
6096
|
return !1;
|
|
6065
6097
|
}
|
|
6066
|
-
function
|
|
6098
|
+
function Xr(s, e) {
|
|
6067
6099
|
const t = s[e];
|
|
6068
6100
|
if (!t.respondsToUserMessageId)
|
|
6069
6101
|
return !1;
|
|
@@ -6076,19 +6108,19 @@ function Qr(s, e) {
|
|
|
6076
6108
|
}
|
|
6077
6109
|
return !1;
|
|
6078
6110
|
}
|
|
6079
|
-
function
|
|
6111
|
+
function Yr(s, e) {
|
|
6080
6112
|
const t = s[e];
|
|
6081
6113
|
return s.some(
|
|
6082
6114
|
(n, i) => i !== e && n.role === "assistant" && ge(t, n)
|
|
6083
6115
|
);
|
|
6084
6116
|
}
|
|
6085
|
-
function
|
|
6117
|
+
function Zr(s, e) {
|
|
6086
6118
|
const t = s[e];
|
|
6087
6119
|
return s.some(
|
|
6088
6120
|
(n, i) => i !== e && n.role === "tool" && ge(t, n)
|
|
6089
6121
|
);
|
|
6090
6122
|
}
|
|
6091
|
-
function
|
|
6123
|
+
function eo(s, e) {
|
|
6092
6124
|
const t = s[e];
|
|
6093
6125
|
for (let n = e + 1; n < s.length; n += 1)
|
|
6094
6126
|
if (G(s[n]) && ge(t, s[n]))
|
|
@@ -6101,15 +6133,15 @@ function ge(s, e) {
|
|
|
6101
6133
|
function A(s, e) {
|
|
6102
6134
|
return s && typeof s == "object" && typeof s[e] == "string" ? s[e] : null;
|
|
6103
6135
|
}
|
|
6104
|
-
function
|
|
6136
|
+
function to(s, e) {
|
|
6105
6137
|
try {
|
|
6106
|
-
const t = window.localStorage.getItem(`${
|
|
6138
|
+
const t = window.localStorage.getItem(`${Es}${s}`);
|
|
6107
6139
|
if (!t)
|
|
6108
6140
|
return null;
|
|
6109
6141
|
const n = JSON.parse(t), i = typeof n.sessionId == "string" ? n.sessionId : null;
|
|
6110
6142
|
if (e !== void 0 && i !== e)
|
|
6111
6143
|
return null;
|
|
6112
|
-
const r = Array.isArray(n.messages) ? n.messages.map(
|
|
6144
|
+
const r = Array.isArray(n.messages) ? n.messages.map(po).filter((o) => !!o) : [];
|
|
6113
6145
|
return {
|
|
6114
6146
|
sessionId: i,
|
|
6115
6147
|
messages: r
|
|
@@ -6123,20 +6155,20 @@ function ft(s) {
|
|
|
6123
6155
|
// running tool or commentary history from disappearing while authoritative hydration is still in flight.
|
|
6124
6156
|
s.role === "tool" || s.dataType === "run_status" || s.dataType === "run_error";
|
|
6125
6157
|
}
|
|
6126
|
-
function
|
|
6158
|
+
function so(s, e) {
|
|
6127
6159
|
try {
|
|
6128
6160
|
window.localStorage.setItem(
|
|
6129
|
-
`${
|
|
6161
|
+
`${Es}${s}`,
|
|
6130
6162
|
JSON.stringify({
|
|
6131
6163
|
sessionId: e.sessionId,
|
|
6132
|
-
messages: e.messages.filter(ft).slice(-
|
|
6164
|
+
messages: e.messages.filter(ft).slice(-bi).map(go)
|
|
6133
6165
|
})
|
|
6134
6166
|
);
|
|
6135
6167
|
} catch {
|
|
6136
6168
|
return;
|
|
6137
6169
|
}
|
|
6138
6170
|
}
|
|
6139
|
-
function
|
|
6171
|
+
function no(s) {
|
|
6140
6172
|
try {
|
|
6141
6173
|
const e = window.localStorage.getItem(`${lt}${s}`);
|
|
6142
6174
|
if (!e)
|
|
@@ -6162,7 +6194,7 @@ function Q(s, e) {
|
|
|
6162
6194
|
return;
|
|
6163
6195
|
}
|
|
6164
6196
|
}
|
|
6165
|
-
function
|
|
6197
|
+
function Ls(s, e) {
|
|
6166
6198
|
try {
|
|
6167
6199
|
const t = `${Le}${s}`, n = location.href, i = location.origin, r = Array.from(e, (o) => ({
|
|
6168
6200
|
...o,
|
|
@@ -6178,28 +6210,28 @@ function xs(s, e) {
|
|
|
6178
6210
|
} catch {
|
|
6179
6211
|
}
|
|
6180
6212
|
}
|
|
6181
|
-
function
|
|
6213
|
+
function hs(s, e) {
|
|
6182
6214
|
try {
|
|
6183
6215
|
if (window.sessionStorage.getItem(`${Le}${s}`) === null)
|
|
6184
6216
|
return;
|
|
6185
6217
|
} catch {
|
|
6186
6218
|
return;
|
|
6187
6219
|
}
|
|
6188
|
-
|
|
6220
|
+
Ls(s, e);
|
|
6189
6221
|
}
|
|
6190
|
-
function
|
|
6222
|
+
function io(s) {
|
|
6191
6223
|
try {
|
|
6192
6224
|
const e = `${Le}${s}`, t = window.sessionStorage.getItem(e);
|
|
6193
6225
|
if (window.sessionStorage.removeItem(e), !t)
|
|
6194
6226
|
return [];
|
|
6195
6227
|
const n = JSON.parse(t);
|
|
6196
|
-
return Array.isArray(n) ? n.flatMap((i) =>
|
|
6228
|
+
return Array.isArray(n) ? n.flatMap((i) => oo(i) ? [{
|
|
6197
6229
|
...i.event,
|
|
6198
6230
|
page: _(),
|
|
6199
6231
|
rawOutput: {
|
|
6200
6232
|
pageContextRestarted: !0,
|
|
6201
6233
|
outcome: "unknown",
|
|
6202
|
-
message:
|
|
6234
|
+
message: ro(location.href),
|
|
6203
6235
|
currentUrl: location.href,
|
|
6204
6236
|
console: [],
|
|
6205
6237
|
metadata: {
|
|
@@ -6216,17 +6248,17 @@ function so(s) {
|
|
|
6216
6248
|
return [];
|
|
6217
6249
|
}
|
|
6218
6250
|
}
|
|
6219
|
-
function
|
|
6251
|
+
function ro(s) {
|
|
6220
6252
|
return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
|
|
6221
6253
|
Current URL: ${s}`;
|
|
6222
6254
|
}
|
|
6223
|
-
function
|
|
6255
|
+
function oo(s) {
|
|
6224
6256
|
if (!s || typeof s != "object")
|
|
6225
6257
|
return !1;
|
|
6226
6258
|
const e = s, t = e.event;
|
|
6227
6259
|
return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" && Rt(t) && t.type === "tool.result";
|
|
6228
6260
|
}
|
|
6229
|
-
function
|
|
6261
|
+
function ao(s, e) {
|
|
6230
6262
|
const t = new Set(
|
|
6231
6263
|
s.flatMap((n) => n.type === "tool.result" ? [n.callId] : [])
|
|
6232
6264
|
);
|
|
@@ -6235,7 +6267,7 @@ function ro(s, e) {
|
|
|
6235
6267
|
...e.filter((n) => !t.has(n.callId))
|
|
6236
6268
|
];
|
|
6237
6269
|
}
|
|
6238
|
-
function
|
|
6270
|
+
function lo(s) {
|
|
6239
6271
|
try {
|
|
6240
6272
|
window.sessionStorage.removeItem(`${Le}${s}`);
|
|
6241
6273
|
} catch {
|
|
@@ -6246,15 +6278,15 @@ function Rt(s) {
|
|
|
6246
6278
|
if (!s || typeof s != "object")
|
|
6247
6279
|
return !1;
|
|
6248
6280
|
const e = s;
|
|
6249
|
-
return e.type === "chat.user_message" ? typeof e.content == "string" &&
|
|
6281
|
+
return e.type === "chat.user_message" ? typeof e.content == "string" && ps(e.page) : e.type === "page.upsert" || e.type === "session.reset" || e.type === "network.batch" ? ps(e.page) : e.type === "tool.result" ? typeof e.sessionId == "string" && typeof e.callId == "string" && (e.toolName === "execute_code" || e.toolName === "execute_code_in_browser_tab") : e.type === "chat.retry_last_user_message" ? typeof e.sessionId == "string" && typeof e.clientMessageId == "string" : e.type === "run.stop" ? typeof e.sessionId == "string" && (e.reason === "user_requested" || e.reason === "new_chat" || e.reason === "session_switch") : !1;
|
|
6250
6282
|
}
|
|
6251
|
-
function
|
|
6283
|
+
function ps(s) {
|
|
6252
6284
|
if (!s || typeof s != "object")
|
|
6253
6285
|
return !1;
|
|
6254
6286
|
const e = s;
|
|
6255
6287
|
return typeof e.url == "string" && typeof e.title == "string" && typeof e.origin == "string";
|
|
6256
6288
|
}
|
|
6257
|
-
function
|
|
6289
|
+
function Ns(s, e) {
|
|
6258
6290
|
if (!Array.isArray(s))
|
|
6259
6291
|
return;
|
|
6260
6292
|
const t = s.filter((i) => {
|
|
@@ -6262,41 +6294,41 @@ function Ls(s, e) {
|
|
|
6262
6294
|
return !1;
|
|
6263
6295
|
const r = i;
|
|
6264
6296
|
return typeof r.name == "string" && typeof r.mimeType == "string" && typeof r.sizeBytes == "number";
|
|
6265
|
-
}), n = e ? t.map((i) =>
|
|
6297
|
+
}), n = e ? t.map((i) => Hs(i, e)) : t;
|
|
6266
6298
|
return n.length > 0 ? n : void 0;
|
|
6267
6299
|
}
|
|
6268
|
-
function
|
|
6300
|
+
function Hs(s, e) {
|
|
6269
6301
|
return s.fileUrl?.startsWith("/") ? {
|
|
6270
6302
|
...s,
|
|
6271
6303
|
fileUrl: new URL(s.fileUrl, e).toString()
|
|
6272
6304
|
} : s;
|
|
6273
6305
|
}
|
|
6274
6306
|
function mt(s) {
|
|
6275
|
-
return s.type ||
|
|
6307
|
+
return s.type || ho(s.name) || "application/octet-stream";
|
|
6276
6308
|
}
|
|
6277
|
-
function
|
|
6278
|
-
|
|
6309
|
+
function co(s) {
|
|
6310
|
+
Bs({
|
|
6279
6311
|
name: s.name,
|
|
6280
6312
|
mimeType: mt(s),
|
|
6281
6313
|
sizeBytes: s.size
|
|
6282
6314
|
});
|
|
6283
6315
|
}
|
|
6284
|
-
function
|
|
6285
|
-
const e =
|
|
6286
|
-
if (!
|
|
6316
|
+
function Bs(s) {
|
|
6317
|
+
const e = uo(s.name), t = s.mimeType.trim().toLowerCase();
|
|
6318
|
+
if (!Ti.has(`${e}:${t}`))
|
|
6287
6319
|
throw new Error("This attachment type is not supported by the embedded model provider");
|
|
6288
|
-
if (s.sizeBytes <= 0 || s.sizeBytes >=
|
|
6320
|
+
if (s.sizeBytes <= 0 || s.sizeBytes >= Rs)
|
|
6289
6321
|
throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
|
|
6290
6322
|
}
|
|
6291
|
-
function
|
|
6323
|
+
function uo(s) {
|
|
6292
6324
|
const e = s.trim().toLowerCase(), t = e.lastIndexOf(".");
|
|
6293
6325
|
return t >= 0 ? e.slice(t) : "";
|
|
6294
6326
|
}
|
|
6295
|
-
function
|
|
6327
|
+
function ho(s) {
|
|
6296
6328
|
const e = s.toLowerCase();
|
|
6297
6329
|
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;
|
|
6298
6330
|
}
|
|
6299
|
-
function
|
|
6331
|
+
function po(s) {
|
|
6300
6332
|
if (!s || typeof s != "object")
|
|
6301
6333
|
return null;
|
|
6302
6334
|
const e = s;
|
|
@@ -6314,11 +6346,11 @@ function uo(s) {
|
|
|
6314
6346
|
scheduledCheckInId: typeof e.scheduledCheckInId == "string" ? e.scheduledCheckInId : void 0,
|
|
6315
6347
|
scheduledCheckInAt: typeof e.scheduledCheckInAt == "string" ? e.scheduledCheckInAt : void 0,
|
|
6316
6348
|
securitySettingsUrl: typeof e.securitySettingsUrl == "string" ? e.securitySettingsUrl : void 0,
|
|
6317
|
-
attachments:
|
|
6349
|
+
attachments: Ns(e.attachments)?.map(qe),
|
|
6318
6350
|
loading: typeof e.loading == "boolean" ? e.loading : void 0
|
|
6319
6351
|
};
|
|
6320
6352
|
}
|
|
6321
|
-
function
|
|
6353
|
+
function go(s) {
|
|
6322
6354
|
return s.attachments?.length ? {
|
|
6323
6355
|
...s,
|
|
6324
6356
|
attachments: s.attachments.map(qe)
|
|
@@ -6342,11 +6374,11 @@ function k(s) {
|
|
|
6342
6374
|
const e = s.runId;
|
|
6343
6375
|
return typeof e == "string" && e ? e : null;
|
|
6344
6376
|
}
|
|
6345
|
-
function
|
|
6377
|
+
function fo(s) {
|
|
6346
6378
|
const e = s?.timeoutMs;
|
|
6347
|
-
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 <=
|
|
6379
|
+
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 <= Li);
|
|
6348
6380
|
}
|
|
6349
|
-
function
|
|
6381
|
+
function Fs(s) {
|
|
6350
6382
|
const e = {};
|
|
6351
6383
|
try {
|
|
6352
6384
|
new Headers(s).forEach((t, n) => {
|
|
@@ -6358,23 +6390,23 @@ function Bs(s) {
|
|
|
6358
6390
|
return e;
|
|
6359
6391
|
}
|
|
6360
6392
|
function kt(s, e) {
|
|
6361
|
-
return
|
|
6393
|
+
return Gs(s) ? Be : F(xe(e), wi);
|
|
6362
6394
|
}
|
|
6363
|
-
function
|
|
6395
|
+
function mo(s, e) {
|
|
6364
6396
|
return typeof s == "string" ? s : s instanceof URL ? s.toString() : e?.url ?? "";
|
|
6365
6397
|
}
|
|
6366
|
-
async function
|
|
6367
|
-
const i =
|
|
6398
|
+
async function yo(s, e, t, n) {
|
|
6399
|
+
const i = Fs(s.headers);
|
|
6368
6400
|
n({
|
|
6369
6401
|
...e,
|
|
6370
6402
|
responseStatus: s.status,
|
|
6371
6403
|
responseHeaders: i,
|
|
6372
|
-
responseBody: await
|
|
6404
|
+
responseBody: await Io(s),
|
|
6373
6405
|
durationMs: Date.now() - t
|
|
6374
6406
|
});
|
|
6375
6407
|
}
|
|
6376
|
-
async function
|
|
6377
|
-
if (!
|
|
6408
|
+
async function Io(s) {
|
|
6409
|
+
if (!Ws(s.headers))
|
|
6378
6410
|
return;
|
|
6379
6411
|
let e = null, t = null;
|
|
6380
6412
|
try {
|
|
@@ -6383,7 +6415,7 @@ async function mo(s) {
|
|
|
6383
6415
|
const n = new Promise((a) => {
|
|
6384
6416
|
t = window.setTimeout(() => {
|
|
6385
6417
|
e?.cancel(), a("timeout");
|
|
6386
|
-
},
|
|
6418
|
+
}, Ai);
|
|
6387
6419
|
}), i = new TextDecoder();
|
|
6388
6420
|
let r = "", o = 0;
|
|
6389
6421
|
for (; ; ) {
|
|
@@ -6405,26 +6437,26 @@ async function mo(s) {
|
|
|
6405
6437
|
t !== null && window.clearTimeout(t);
|
|
6406
6438
|
}
|
|
6407
6439
|
}
|
|
6408
|
-
function
|
|
6409
|
-
if (
|
|
6440
|
+
function So(s, e) {
|
|
6441
|
+
if (Ws(new Headers(e)))
|
|
6410
6442
|
try {
|
|
6411
6443
|
return s.responseType === "" || s.responseType === "text" ? F(s.responseText ?? "") : void 0;
|
|
6412
6444
|
} catch {
|
|
6413
6445
|
return;
|
|
6414
6446
|
}
|
|
6415
6447
|
}
|
|
6416
|
-
function
|
|
6448
|
+
function gs(s) {
|
|
6417
6449
|
if (typeof s == "string")
|
|
6418
6450
|
return F(s);
|
|
6419
6451
|
}
|
|
6420
|
-
function
|
|
6452
|
+
function To(s) {
|
|
6421
6453
|
return L({
|
|
6422
6454
|
...s,
|
|
6423
|
-
requestBody:
|
|
6424
|
-
responseBody:
|
|
6455
|
+
requestBody: fs(s.requestBody),
|
|
6456
|
+
responseBody: fs(s.responseBody)
|
|
6425
6457
|
});
|
|
6426
6458
|
}
|
|
6427
|
-
function
|
|
6459
|
+
function fs(s) {
|
|
6428
6460
|
if (typeof s != "string")
|
|
6429
6461
|
return s;
|
|
6430
6462
|
const e = s.trim();
|
|
@@ -6436,14 +6468,14 @@ function gs(s) {
|
|
|
6436
6468
|
return xe(s);
|
|
6437
6469
|
}
|
|
6438
6470
|
}
|
|
6439
|
-
function
|
|
6471
|
+
function Ws(s) {
|
|
6440
6472
|
if (!s)
|
|
6441
6473
|
return !1;
|
|
6442
6474
|
const e = s.get("content-type")?.toLowerCase() ?? "", t = s.get("content-length"), n = Number(t);
|
|
6443
6475
|
return t !== null && Number.isInteger(n) && n >= 0 && n <= wt && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
|
|
6444
6476
|
}
|
|
6445
6477
|
function te(s, e = {}, t) {
|
|
6446
|
-
if (
|
|
6478
|
+
if (Ao(t))
|
|
6447
6479
|
return !0;
|
|
6448
6480
|
const n = Object.entries(e).find(([i]) => i.toLowerCase() === "content-type")?.[1]?.toLowerCase();
|
|
6449
6481
|
if (n?.includes("multipart/form-data") || n?.includes("application/octet-stream"))
|
|
@@ -6458,7 +6490,7 @@ function te(s, e = {}, t) {
|
|
|
6458
6490
|
return !0;
|
|
6459
6491
|
}
|
|
6460
6492
|
}
|
|
6461
|
-
function
|
|
6493
|
+
function wo(s, e) {
|
|
6462
6494
|
if (te(s))
|
|
6463
6495
|
return !0;
|
|
6464
6496
|
try {
|
|
@@ -6468,10 +6500,10 @@ function So(s, e) {
|
|
|
6468
6500
|
return !0;
|
|
6469
6501
|
}
|
|
6470
6502
|
}
|
|
6471
|
-
function
|
|
6503
|
+
function Ao(s) {
|
|
6472
6504
|
return s instanceof FormData || s instanceof Blob || s instanceof ArrayBuffer || ArrayBuffer.isView(s) || typeof ReadableStream < "u" && s instanceof ReadableStream;
|
|
6473
6505
|
}
|
|
6474
|
-
function
|
|
6506
|
+
function bo(s) {
|
|
6475
6507
|
const e = {};
|
|
6476
6508
|
for (const t of s.trim().split(/[\r\n]+/)) {
|
|
6477
6509
|
const n = t.indexOf(":");
|
|
@@ -6498,31 +6530,31 @@ class Pe extends Error {
|
|
|
6498
6530
|
}
|
|
6499
6531
|
async function Me(s, e) {
|
|
6500
6532
|
let t = null;
|
|
6501
|
-
for (let n = 0; n <
|
|
6533
|
+
for (let n = 0; n < Qt; n += 1)
|
|
6502
6534
|
try {
|
|
6503
6535
|
return await s();
|
|
6504
6536
|
} catch (i) {
|
|
6505
|
-
if (t = i, n >=
|
|
6537
|
+
if (t = i, n >= Qt - 1 || !Ro(i))
|
|
6506
6538
|
throw i;
|
|
6507
|
-
await
|
|
6539
|
+
await Mo(n);
|
|
6508
6540
|
}
|
|
6509
6541
|
throw t instanceof Error ? t : new Error(e);
|
|
6510
6542
|
}
|
|
6511
|
-
function
|
|
6543
|
+
function Mo(s) {
|
|
6512
6544
|
return new Promise((e) => {
|
|
6513
|
-
window.setTimeout(e,
|
|
6545
|
+
window.setTimeout(e, Si[s] ?? 0);
|
|
6514
6546
|
});
|
|
6515
6547
|
}
|
|
6516
|
-
function
|
|
6517
|
-
return s instanceof Pe ?
|
|
6548
|
+
function Ro(s) {
|
|
6549
|
+
return s instanceof Pe ? ko(s.status) : s instanceof TypeError;
|
|
6518
6550
|
}
|
|
6519
|
-
function
|
|
6551
|
+
function ko(s) {
|
|
6520
6552
|
return s === 408 || s === 409 || s === 429 || s >= 500;
|
|
6521
6553
|
}
|
|
6522
|
-
function
|
|
6554
|
+
function Eo(s) {
|
|
6523
6555
|
return s === 401 || s === 403;
|
|
6524
6556
|
}
|
|
6525
|
-
const Be = "[REDACTED_SECRET]", $ = "[REDACTED_TOKEN]",
|
|
6557
|
+
const Be = "[REDACTED_SECRET]", $ = "[REDACTED_TOKEN]", Co = "[REDACTED_SIGNED_URL]", _o = 20, Po = /^(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, $s = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, js = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, zs = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Ks = /\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, vo = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Uo = /\bhttps?:\/\/[^\s"'<>]+/gi, Do = /[),.;\]]+$/;
|
|
6526
6558
|
function L(s) {
|
|
6527
6559
|
return Oe(s, 0, /* @__PURE__ */ new WeakSet());
|
|
6528
6560
|
}
|
|
@@ -6531,7 +6563,7 @@ function Oe(s, e, t) {
|
|
|
6531
6563
|
return s.startsWith("data:image/") || s.startsWith("data:application/pdf;") ? s : xe(s);
|
|
6532
6564
|
if (s === null || typeof s != "object")
|
|
6533
6565
|
return s;
|
|
6534
|
-
if (e >=
|
|
6566
|
+
if (e >= _o)
|
|
6535
6567
|
return "[REDACTED_MAX_DEPTH]";
|
|
6536
6568
|
if (t.has(s))
|
|
6537
6569
|
return "[REDACTED_CIRCULAR]";
|
|
@@ -6539,71 +6571,71 @@ function Oe(s, e, t) {
|
|
|
6539
6571
|
return s.map((i) => Oe(i, e + 1, t));
|
|
6540
6572
|
const n = {};
|
|
6541
6573
|
for (const [i, r] of Object.entries(s))
|
|
6542
|
-
i === "pageContent" ? n[i] = r :
|
|
6574
|
+
i === "pageContent" ? n[i] = r : Gs(i) ? n[i] = Be : n[i] = i.toLowerCase() === "url" ? qo(r) : Oe(r, e + 1, t);
|
|
6543
6575
|
return n;
|
|
6544
6576
|
}
|
|
6545
|
-
function
|
|
6577
|
+
function Gs(s) {
|
|
6546
6578
|
const e = s.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
6547
6579
|
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");
|
|
6548
6580
|
}
|
|
6549
|
-
function
|
|
6550
|
-
return typeof s == "string" ?
|
|
6581
|
+
function qo(s) {
|
|
6582
|
+
return typeof s == "string" ? Vs(s) : Oe(s, 0, /* @__PURE__ */ new WeakSet());
|
|
6551
6583
|
}
|
|
6552
|
-
function
|
|
6584
|
+
function Vs(s) {
|
|
6553
6585
|
try {
|
|
6554
6586
|
const e = new URL(s, location.href);
|
|
6555
6587
|
for (const t of Array.from(e.searchParams.keys()))
|
|
6556
|
-
|
|
6588
|
+
Po.test(t) && e.searchParams.set(t, $);
|
|
6557
6589
|
return e.username && (e.username = $), e.password && (e.password = $), e.toString();
|
|
6558
6590
|
} catch {
|
|
6559
|
-
return
|
|
6591
|
+
return Oo(s);
|
|
6560
6592
|
}
|
|
6561
6593
|
}
|
|
6562
6594
|
function xe(s) {
|
|
6563
|
-
return s.replace(
|
|
6595
|
+
return s.replace(vo, Co).replace(Uo, xo).replace($s, `Bearer ${$}`).replace(js, `Basic ${$}`).replace(zs, $).replace(Ks, (e, t) => `${t}: ${Be}`);
|
|
6564
6596
|
}
|
|
6565
|
-
function
|
|
6566
|
-
return s.replace(
|
|
6597
|
+
function Oo(s) {
|
|
6598
|
+
return s.replace($s, `Bearer ${$}`).replace(js, `Basic ${$}`).replace(zs, $).replace(Ks, (e, t) => `${t}: ${Be}`);
|
|
6567
6599
|
}
|
|
6568
|
-
function
|
|
6569
|
-
const e = s.match(
|
|
6570
|
-
return `${
|
|
6600
|
+
function xo(s) {
|
|
6601
|
+
const e = s.match(Do)?.[0] ?? "", t = e ? s.slice(0, -e.length) : s;
|
|
6602
|
+
return `${Vs(t)}${e}`;
|
|
6571
6603
|
}
|
|
6572
|
-
const
|
|
6604
|
+
const zo = Object.freeze({
|
|
6573
6605
|
init: (s) => Ne.init(s)
|
|
6574
6606
|
});
|
|
6575
|
-
function
|
|
6607
|
+
function Ko(s) {
|
|
6576
6608
|
return Ne.init(s);
|
|
6577
6609
|
}
|
|
6578
6610
|
export {
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6611
|
+
$t as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
|
|
6612
|
+
Vn as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
|
|
6613
|
+
Gn as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
|
|
6614
|
+
Qn as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
|
|
6615
|
+
jo as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
|
|
6616
|
+
zo as PlunoProductAgent,
|
|
6617
|
+
Nn as ProductAgentInteractionManager,
|
|
6586
6618
|
Ht as ProductAgentQueryController,
|
|
6587
|
-
|
|
6619
|
+
$o as ProductAgentRemoteRuntimeClient,
|
|
6588
6620
|
Ne as ProductAgentSessionEngine,
|
|
6589
|
-
|
|
6590
|
-
|
|
6621
|
+
On as ProductAgentSessionHistoryManager,
|
|
6622
|
+
Bo as ProductAgentTaskPageTitleController,
|
|
6591
6623
|
J as ProductAgentTokenProviderError,
|
|
6592
|
-
|
|
6593
|
-
|
|
6624
|
+
Ei as calculateReconnectDelay,
|
|
6625
|
+
Ho as createLocalStorageInteractionDecisionStorage,
|
|
6594
6626
|
ke as createProductAgentQueryState,
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6627
|
+
Ko as createProductAgentRuntime,
|
|
6628
|
+
Fo as createProductAgentTaskPageTitleDocument,
|
|
6629
|
+
zo as default,
|
|
6630
|
+
Wn as formatProductAgentTaskPageTitle,
|
|
6631
|
+
Zi as getProductAgentOriginAccessErrorMessage,
|
|
6632
|
+
Wo as isProductAgentRuntimeCommand,
|
|
6633
|
+
Un as mergeProductAgentEntityPages,
|
|
6602
6634
|
Ee as normalizeProductAgentEntityPage,
|
|
6603
6635
|
st as normalizeProductAgentSessionItems,
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6636
|
+
Hn as readLocalStorageInteractionDecisions,
|
|
6637
|
+
No as resolveProductAgentComposerAction,
|
|
6638
|
+
Lo as resolveProductAgentWidgetPresentation,
|
|
6639
|
+
bs as selectProductAgentQueryEntities,
|
|
6640
|
+
co as validateProductAgentProviderInputFile
|
|
6609
6641
|
};
|