@pluno/product-agent-web 0.1.184 → 0.1.185
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/product-agent-sdk.js +328 -327
- package/dist/product-agent-widget.js +834 -833
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
async function
|
|
4
|
-
const e = await
|
|
5
|
-
await
|
|
6
|
-
}
|
|
7
|
-
async function
|
|
8
|
-
const s = await
|
|
9
|
-
await
|
|
10
|
-
const r = await
|
|
1
|
+
const Ts = "pluno-product-agent-attachments";
|
|
2
|
+
const Ke = "files";
|
|
3
|
+
async function Ss(t) {
|
|
4
|
+
const e = await et();
|
|
5
|
+
await As(e, "readwrite", (s) => s.put(t));
|
|
6
|
+
}
|
|
7
|
+
async function ws(t, e) {
|
|
8
|
+
const s = await et();
|
|
9
|
+
await tt(s, "readwrite", async (n) => {
|
|
10
|
+
const r = await st(
|
|
11
11
|
n.get(t)
|
|
12
12
|
);
|
|
13
13
|
r && n.put({
|
|
@@ -16,28 +16,28 @@ async function Ss(t, e) {
|
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
async function
|
|
20
|
-
const e = await
|
|
21
|
-
await
|
|
19
|
+
async function Ms(t = 864e5) {
|
|
20
|
+
const e = await et(), s = Date.now() - t;
|
|
21
|
+
await tt(e, "readwrite", async (n) => {
|
|
22
22
|
const r = n.index("lastUsedAt");
|
|
23
|
-
(await
|
|
23
|
+
(await st(r.getAllKeys(IDBKeyRange.upperBound(s)))).forEach((o) => n.delete(o));
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function et() {
|
|
27
27
|
return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((t, e) => {
|
|
28
|
-
const s = indexedDB.open(
|
|
28
|
+
const s = indexedDB.open(Ts, 1);
|
|
29
29
|
s.onupgradeneeded = () => {
|
|
30
|
-
const r = s.result.createObjectStore(
|
|
30
|
+
const r = s.result.createObjectStore(Ke, { keyPath: "attachmentId" });
|
|
31
31
|
r.createIndex("lastUsedAt", "lastUsedAt", { unique: !1 }), r.createIndex("sessionId", "sessionId", { unique: !1 }), r.createIndex("origin", "origin", { unique: !1 });
|
|
32
32
|
}, s.onsuccess = () => t(s.result), s.onerror = () => e(s.error ?? new Error("Failed to open Product Agent attachment storage"));
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
async function
|
|
36
|
-
return await
|
|
35
|
+
async function As(t, e, s) {
|
|
36
|
+
return await tt(t, e, async (n) => await st(s(n)));
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function tt(t, e, s) {
|
|
39
39
|
return new Promise((n, r) => {
|
|
40
|
-
const i = t.transaction(
|
|
40
|
+
const i = t.transaction(Ke, e), o = i.objectStore(Ke);
|
|
41
41
|
let a, l = !1;
|
|
42
42
|
s(o).then((c) => {
|
|
43
43
|
a = c;
|
|
@@ -57,16 +57,16 @@ function et(t, e, s) {
|
|
|
57
57
|
};
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function st(t) {
|
|
61
61
|
return new Promise((e, s) => {
|
|
62
62
|
t.onsuccess = () => e(t.result), t.onerror = () => s(t.error ?? new Error("Product Agent attachment storage request failed"));
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function Rs(t) {
|
|
66
66
|
return t !== null && (typeof t == "object" || typeof t == "function");
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
const n = Reflect.get(t, "pluno"), r =
|
|
68
|
+
function Wt(t, e, s) {
|
|
69
|
+
const n = Reflect.get(t, "pluno"), r = Rs(n) ? n : {};
|
|
70
70
|
if (r !== n && !Reflect.set(t, "pluno", r))
|
|
71
71
|
return null;
|
|
72
72
|
const i = Object.getOwnPropertyDescriptor(r, e);
|
|
@@ -80,15 +80,15 @@ function Bt(t, e, s) {
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
const
|
|
84
|
-
function
|
|
83
|
+
const Es = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
|
|
84
|
+
function ks(t, e) {
|
|
85
85
|
return e ? t.replace(
|
|
86
|
-
|
|
86
|
+
Es,
|
|
87
87
|
(s, n, r, i) => `${n}${new URL(r, e).toString()}${i}`
|
|
88
88
|
) : t;
|
|
89
89
|
}
|
|
90
|
-
const
|
|
91
|
-
function
|
|
90
|
+
const Cs = "suggest_share_on_socials";
|
|
91
|
+
function bs(t) {
|
|
92
92
|
let e = t;
|
|
93
93
|
if (typeof t == "string")
|
|
94
94
|
try {
|
|
@@ -96,17 +96,17 @@ function Cs(t) {
|
|
|
96
96
|
} catch {
|
|
97
97
|
return null;
|
|
98
98
|
}
|
|
99
|
-
const s =
|
|
99
|
+
const s = _s(e);
|
|
100
100
|
return s ? typeof s.showSharePrompt == "boolean" ? s.showSharePrompt : s.ok === !0 && typeof s.message == "string" && s.message.includes("social-sharing prompt") ? !0 : null : null;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function _s(t) {
|
|
103
103
|
return t && typeof t == "object" && !Array.isArray(t) ? t : null;
|
|
104
104
|
}
|
|
105
|
-
const
|
|
106
|
-
function
|
|
107
|
-
return (t.type === "function_call" || t.type === "tool_call") && t.name ===
|
|
105
|
+
const Ps = "save_runtime_captured_skill";
|
|
106
|
+
function Us(t) {
|
|
107
|
+
return (t.type === "function_call" || t.type === "tool_call") && t.name === Ps;
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function vs(t, e, s) {
|
|
110
110
|
const n = e.map((u) => ({ item: u, identity: s(u) })), r = new Set(
|
|
111
111
|
n.flatMap(
|
|
112
112
|
({ identity: u }) => u.isActivity && !u.isTransient ? u.activityKeys ?? [] : []
|
|
@@ -144,17 +144,17 @@ function Us(t, e, s) {
|
|
|
144
144
|
y.has(u) || f.push(u);
|
|
145
145
|
return f;
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function Ds(t, e, s, n) {
|
|
148
148
|
return t.filter((r) => {
|
|
149
149
|
const i = n(r);
|
|
150
150
|
return !i.isActivity || !i.isTransient ? !0 : e !== null && i.respondsToUserMessageId !== void 0 ? i.respondsToUserMessageId !== e : s === null || i.runId !== s;
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
|
-
const
|
|
153
|
+
const Le = "pluno.productAgent.transportId", qs = "pluno.productAgent.transportIdentity", Ne = "pluno.productAgent.transportIdentity.event", Os = 50, Ls = globalThis.setTimeout.bind(globalThis);
|
|
154
154
|
let ne = null;
|
|
155
155
|
const Ie = /* @__PURE__ */ new Set(), xe = /* @__PURE__ */ new Map();
|
|
156
|
-
async function
|
|
157
|
-
const e = t.randomUUID(), s = t.storage.getItem(
|
|
156
|
+
async function Ns(t = Ht()) {
|
|
157
|
+
const e = t.randomUUID(), s = t.storage.getItem(Le);
|
|
158
158
|
let n = s ?? t.randomUUID(), r = !1, i = !1;
|
|
159
159
|
const o = t.channel.subscribe((l) => {
|
|
160
160
|
if (!(l.senderId === e || l.transportId !== n)) {
|
|
@@ -172,7 +172,7 @@ async function Os(t = Wt()) {
|
|
|
172
172
|
}
|
|
173
173
|
});
|
|
174
174
|
if (!s)
|
|
175
|
-
t.storage.setItem(
|
|
175
|
+
t.storage.setItem(Le, n), r = !0;
|
|
176
176
|
else if (t.skipStoredIdentityCollisionCheck)
|
|
177
177
|
r = !0;
|
|
178
178
|
else
|
|
@@ -181,7 +181,7 @@ async function Os(t = Wt()) {
|
|
|
181
181
|
r = !0;
|
|
182
182
|
break;
|
|
183
183
|
}
|
|
184
|
-
n = t.randomUUID(), t.storage.setItem(
|
|
184
|
+
n = t.randomUUID(), t.storage.setItem(Le, n);
|
|
185
185
|
}
|
|
186
186
|
let a = !1;
|
|
187
187
|
return {
|
|
@@ -191,9 +191,9 @@ async function Os(t = Wt()) {
|
|
|
191
191
|
}
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
|
-
async function
|
|
195
|
-
ne || (ne =
|
|
196
|
-
...
|
|
194
|
+
async function xs(t = !1) {
|
|
195
|
+
ne || (ne = Ns({
|
|
196
|
+
...Ht(),
|
|
197
197
|
skipStoredIdentityCollisionCheck: t
|
|
198
198
|
}), ne.then((r) => {
|
|
199
199
|
const i = (o) => {
|
|
@@ -201,7 +201,7 @@ async function Ns(t = !1) {
|
|
|
201
201
|
};
|
|
202
202
|
window.addEventListener("pagehide", i);
|
|
203
203
|
}));
|
|
204
|
-
const e = await ne, s =
|
|
204
|
+
const e = await ne, s = Bs();
|
|
205
205
|
Ie.add(s);
|
|
206
206
|
let n = !1;
|
|
207
207
|
return {
|
|
@@ -212,21 +212,21 @@ async function Ns(t = !1) {
|
|
|
212
212
|
}
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function Bs() {
|
|
216
216
|
let t = 0;
|
|
217
217
|
for (; Ie.has(t); )
|
|
218
218
|
t += 1;
|
|
219
219
|
return t;
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function Ht() {
|
|
222
222
|
return {
|
|
223
|
-
storage:
|
|
224
|
-
channel:
|
|
223
|
+
storage: Ws(),
|
|
224
|
+
channel: Hs(),
|
|
225
225
|
randomUUID: () => crypto.randomUUID(),
|
|
226
|
-
settle: () => new Promise((t) => Ls(t,
|
|
226
|
+
settle: () => new Promise((t) => Ls(t, Os))
|
|
227
227
|
};
|
|
228
228
|
}
|
|
229
|
-
function
|
|
229
|
+
function Ws() {
|
|
230
230
|
return {
|
|
231
231
|
getItem: (t) => {
|
|
232
232
|
try {
|
|
@@ -244,9 +244,9 @@ function Bs() {
|
|
|
244
244
|
}
|
|
245
245
|
};
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function Hs() {
|
|
248
248
|
if (typeof BroadcastChannel < "u") {
|
|
249
|
-
const t = new BroadcastChannel(
|
|
249
|
+
const t = new BroadcastChannel(qs);
|
|
250
250
|
return {
|
|
251
251
|
postMessage: (e) => t.postMessage(e),
|
|
252
252
|
subscribe: (e) => {
|
|
@@ -256,9 +256,9 @@ function Ws() {
|
|
|
256
256
|
close: () => t.close()
|
|
257
257
|
};
|
|
258
258
|
}
|
|
259
|
-
return
|
|
259
|
+
return $s();
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function $s() {
|
|
262
262
|
const t = /* @__PURE__ */ new Set(), e = (s) => {
|
|
263
263
|
if (s.key !== Ne || !s.newValue)
|
|
264
264
|
return;
|
|
@@ -279,8 +279,8 @@ function Hs() {
|
|
|
279
279
|
}
|
|
280
280
|
};
|
|
281
281
|
}
|
|
282
|
-
const
|
|
283
|
-
function
|
|
282
|
+
const $t = "schedule_follow_up";
|
|
283
|
+
function js(t) {
|
|
284
284
|
let e = t;
|
|
285
285
|
if (typeof e == "string")
|
|
286
286
|
try {
|
|
@@ -291,21 +291,21 @@ function $s(t) {
|
|
|
291
291
|
if (!e || typeof e != "object")
|
|
292
292
|
return null;
|
|
293
293
|
const s = e;
|
|
294
|
-
return s.ok !== !0 || s.toolName !==
|
|
294
|
+
return s.ok !== !0 || s.toolName !== $t || typeof s.dueAt != "string" || Number.isNaN(Date.parse(s.dueAt)) ? null : s.dueAt;
|
|
295
295
|
}
|
|
296
|
-
const
|
|
296
|
+
const Fs = [
|
|
297
297
|
{ value: "gpt-5.6-sol", label: "gpt-5.6-sol" },
|
|
298
298
|
{ value: "anthropic/claude-sonnet-5", label: "Claude Sonnet 5" },
|
|
299
299
|
{ value: "deepseek/deepseek-v4-flash", label: "DeepSeek V4 Flash" }
|
|
300
|
-
],
|
|
300
|
+
], zs = [
|
|
301
301
|
{ value: "anthropic/claude-opus-5", label: "Claude Opus 5" },
|
|
302
302
|
{ value: "gpt-5.6-terra", label: "gpt-5.6-terra" }
|
|
303
|
-
],
|
|
304
|
-
...
|
|
305
|
-
...
|
|
306
|
-
],
|
|
303
|
+
], Ks = [
|
|
304
|
+
...Fs,
|
|
305
|
+
...zs
|
|
306
|
+
], Be = (t) => Ks.some((e) => e.value === t), Gs = globalThis.fetch.bind(globalThis), Ge = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', Vs = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Xs = ".pluno-pa-widget__panel", Js = ".pluno-pa-widget__timeline", gt = `${Ge}[data-pluno-sdk-preview-channel]`;
|
|
307
307
|
let Ys = 0;
|
|
308
|
-
function
|
|
308
|
+
function ft(t) {
|
|
309
309
|
const e = {};
|
|
310
310
|
for (const o of [
|
|
311
311
|
"type",
|
|
@@ -343,7 +343,7 @@ function gt(t) {
|
|
|
343
343
|
}
|
|
344
344
|
return e;
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function We(t, e, s) {
|
|
347
347
|
if (typeof window > "u")
|
|
348
348
|
return;
|
|
349
349
|
const n = window.__PLUNO_PRODUCT_AGENT_TRACE_ID__;
|
|
@@ -367,13 +367,13 @@ class he extends Error {
|
|
|
367
367
|
function Qs(t) {
|
|
368
368
|
return t === 408 || t === 425 || t === 429 || t >= 500;
|
|
369
369
|
}
|
|
370
|
-
const Zs = "https://app.pluno.ai", en = 2e4, tn = 1e4, sn = 1e4, nn = 1e4, rn = 1e4, on = 3e3, an = 3e4, ln = 1e3,
|
|
370
|
+
const Zs = "https://app.pluno.ai", en = 2e4, tn = 1e4, sn = 1e4, nn = 1e4, rn = 1e4, on = 3e3, an = 3e4, ln = 1e3, mt = 3e4, yt = 0.2, It = 6e4, Tt = 15e3, re = 8, St = "Browser connection was interrupted.", wt = 15e3, cn = "Pluno could not send this message. Try it again.", Mt = 2e3, un = 1e3, dn = 100, At = 8e3, Rt = 3, pn = [300, 1e3], jt = 50 * 1024 * 1024, hn = /* @__PURE__ */ new Set([
|
|
371
371
|
".jpeg:image/jpeg",
|
|
372
372
|
".jpg:image/jpeg",
|
|
373
373
|
".pdf:application/pdf",
|
|
374
374
|
".png:image/png",
|
|
375
375
|
".webp:image/webp"
|
|
376
|
-
]), ki = ".pdf,.png,.jpg,.jpeg,.webp",
|
|
376
|
+
]), ki = ".pdf,.png,.jpg,.jpeg,.webp", nt = 64e3, He = 4e3, rt = 30, gn = 2e3, fn = 1e3, Ft = "Image is too large for model vision input.", mn = 100, zt = "pluno.productAgent.state.", Ve = "pluno.productAgent.pendingEvents.", Ce = "pluno.productAgent.activeToolCalls.", yn = 100;
|
|
377
377
|
function ie(t, e = 0) {
|
|
378
378
|
const s = t === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (t - 1));
|
|
379
379
|
return Math.max(e, s);
|
|
@@ -381,8 +381,8 @@ function ie(t, e = 0) {
|
|
|
381
381
|
const Te = /* @__PURE__ */ new Set();
|
|
382
382
|
let ge = null;
|
|
383
383
|
function In(t, e = Math.random) {
|
|
384
|
-
const s = Math.min(
|
|
385
|
-
return Math.min(
|
|
384
|
+
const s = Math.min(mt, ln * 2 ** t), n = 1 - yt + e() * yt * 2;
|
|
385
|
+
return Math.min(mt, Math.round(s * n));
|
|
386
386
|
}
|
|
387
387
|
function Tn(t, e, s) {
|
|
388
388
|
return new Promise((n, r) => {
|
|
@@ -397,9 +397,9 @@ function Tn(t, e, s) {
|
|
|
397
397
|
);
|
|
398
398
|
});
|
|
399
399
|
}
|
|
400
|
-
class
|
|
400
|
+
class Kt {
|
|
401
401
|
constructor(e, s) {
|
|
402
|
-
this.options = e, this.transportIdentity = s, this.state = {
|
|
402
|
+
this.options = e, this.transportIdentity = s, this.personalModelSelectionOverride = e.productVariant === "personal" && Be(e.model) ? e.model : null, this.state = {
|
|
403
403
|
...this.state,
|
|
404
404
|
starterPrompts: Qn(e.initialStarterPrompts)
|
|
405
405
|
};
|
|
@@ -409,7 +409,7 @@ class zt {
|
|
|
409
409
|
...n,
|
|
410
410
|
// Paint the readable same-session cache immediately while the complete transcript is revalidated. Tool
|
|
411
411
|
// activity is deliberately not restored here because it hydrates after the transcript is visible.
|
|
412
|
-
messages: n.messages.filter(
|
|
412
|
+
messages: n.messages.filter(is),
|
|
413
413
|
isLoadingSession: n.sessionId !== null,
|
|
414
414
|
status: "idle",
|
|
415
415
|
user: null,
|
|
@@ -485,6 +485,7 @@ class zt {
|
|
|
485
485
|
pendingClientMessageId = null;
|
|
486
486
|
pendingUserMessageEvent = null;
|
|
487
487
|
failedUserMessageEvent = null;
|
|
488
|
+
personalModelSelectionOverride = null;
|
|
488
489
|
activeClientMessageId = null;
|
|
489
490
|
activeResponseUserMessageId = null;
|
|
490
491
|
activeResponseRunId = null;
|
|
@@ -531,9 +532,9 @@ class zt {
|
|
|
531
532
|
lastErrorSecuritySettingsUrl: null
|
|
532
533
|
};
|
|
533
534
|
static async init(e) {
|
|
534
|
-
const s = e, n = await
|
|
535
|
+
const s = e, n = await xs(
|
|
535
536
|
s.skipStoredTransportIdentityCollisionCheck === !0
|
|
536
|
-
), r = new
|
|
537
|
+
), r = new Kt({
|
|
537
538
|
...e,
|
|
538
539
|
backendUrl: Nn(e.backendUrl ?? Zs),
|
|
539
540
|
clientId: e.clientId ?? nr(),
|
|
@@ -541,7 +542,7 @@ class zt {
|
|
|
541
542
|
entrySurface: xn(e.entrySurface)
|
|
542
543
|
}, n);
|
|
543
544
|
try {
|
|
544
|
-
|
|
545
|
+
Ms().catch((i) => {
|
|
545
546
|
w("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
|
|
546
547
|
message: i instanceof Error ? i.message : String(i)
|
|
547
548
|
});
|
|
@@ -672,10 +673,10 @@ class zt {
|
|
|
672
673
|
}
|
|
673
674
|
async sendMessage(e, s = {}) {
|
|
674
675
|
const n = e.trim(), r = s.attachments ?? [];
|
|
675
|
-
if (this.options.productVariant === "customer_embedded" && (r.forEach(
|
|
676
|
+
if (this.options.productVariant === "customer_embedded" && (r.forEach(cs), r.reduce(
|
|
676
677
|
(S, _) => S + _.sizeBytes,
|
|
677
678
|
0
|
|
678
|
-
) >
|
|
679
|
+
) > jt))
|
|
679
680
|
throw new Error("Embedded attachments must total at most 50 MB per message");
|
|
680
681
|
let i = r.map(Re);
|
|
681
682
|
if (!n && i.length === 0)
|
|
@@ -743,11 +744,11 @@ class zt {
|
|
|
743
744
|
invocation: Bn(s.invocation ?? s.initiatedBy),
|
|
744
745
|
entrySurface: this.options.entrySurface,
|
|
745
746
|
content: n,
|
|
746
|
-
pageContent: m &&
|
|
747
|
+
pageContent: m && it() || void 0,
|
|
747
748
|
attachments: i.length > 0 ? i.map(Re) : void 0,
|
|
748
749
|
page: o,
|
|
749
750
|
model: this.options.model,
|
|
750
|
-
metadata:
|
|
751
|
+
metadata: Et(this.options.metadata)
|
|
751
752
|
};
|
|
752
753
|
return s.initiatedBy || (this.lastUserMessagePageUrl = o.url), this.pendingClientMessageId = a, this.pendingUserMessageEvent = C, this.send(C), this.schedulePendingDeliveryAck(a), a;
|
|
753
754
|
}
|
|
@@ -755,7 +756,7 @@ class zt {
|
|
|
755
756
|
return this.options.model;
|
|
756
757
|
}
|
|
757
758
|
setModel(e) {
|
|
758
|
-
this.options.model = e;
|
|
759
|
+
this.options.model = e, this.options.productVariant === "personal" && Be(e) && (this.personalModelSelectionOverride = e);
|
|
759
760
|
}
|
|
760
761
|
retryLastMessage() {
|
|
761
762
|
const e = this.state.sessionId, s = this.retryableClientMessageId;
|
|
@@ -777,12 +778,12 @@ class zt {
|
|
|
777
778
|
const s = B(), n = {
|
|
778
779
|
id: s,
|
|
779
780
|
name: e.name || "attachment",
|
|
780
|
-
mimeType:
|
|
781
|
+
mimeType: Ze(e),
|
|
781
782
|
sizeBytes: e.size
|
|
782
783
|
};
|
|
783
784
|
this.attachmentFiles.set(s, e);
|
|
784
785
|
const r = Date.now();
|
|
785
|
-
return
|
|
786
|
+
return Ss({
|
|
786
787
|
attachmentId: s,
|
|
787
788
|
name: n.name,
|
|
788
789
|
mimeType: n.mimeType,
|
|
@@ -811,7 +812,7 @@ class zt {
|
|
|
811
812
|
file: e,
|
|
812
813
|
attachment: s
|
|
813
814
|
}) {
|
|
814
|
-
const n = this.state.sessionId, r =
|
|
815
|
+
const n = this.state.sessionId, r = Ze(e), i = {
|
|
815
816
|
sessionId: n ?? void 0,
|
|
816
817
|
attachmentId: s.id,
|
|
817
818
|
clientId: this.options.clientId,
|
|
@@ -821,7 +822,7 @@ class zt {
|
|
|
821
822
|
sizeBytes: e.size,
|
|
822
823
|
page: b(),
|
|
823
824
|
model: this.options.model,
|
|
824
|
-
metadata:
|
|
825
|
+
metadata: Et(this.options.metadata),
|
|
825
826
|
entrySurface: this.options.entrySurface
|
|
826
827
|
};
|
|
827
828
|
let o;
|
|
@@ -847,8 +848,8 @@ class zt {
|
|
|
847
848
|
}, "Failed to upload attachment"), o = l;
|
|
848
849
|
}
|
|
849
850
|
this.setState({ sessionId: o.sessionId });
|
|
850
|
-
const a =
|
|
851
|
-
return this.updateAttachmentInState(s.id, a), s.id &&
|
|
851
|
+
const a = ls(o.attachment, this.options.backendUrl);
|
|
852
|
+
return this.updateAttachmentInState(s.id, a), s.id && ws(s.id, {
|
|
852
853
|
sessionId: o.sessionId,
|
|
853
854
|
fileUrl: a.fileUrl,
|
|
854
855
|
sandboxPath: a.sandboxPath,
|
|
@@ -904,7 +905,7 @@ class zt {
|
|
|
904
905
|
if (!this.state.sessionId)
|
|
905
906
|
return;
|
|
906
907
|
this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "user_requested" });
|
|
907
|
-
const e =
|
|
908
|
+
const e = Or(
|
|
908
909
|
this.state.messages,
|
|
909
910
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
910
911
|
this.state.assistantDraftRunId,
|
|
@@ -917,7 +918,7 @@ class zt {
|
|
|
917
918
|
stoppedCausalSequence: null,
|
|
918
919
|
toolCallIds: new Set(
|
|
919
920
|
this.state.messages.filter(
|
|
920
|
-
(s) =>
|
|
921
|
+
(s) => Fe(
|
|
921
922
|
s,
|
|
922
923
|
e.respondsToUserMessageId,
|
|
923
924
|
e.runId
|
|
@@ -928,7 +929,7 @@ class zt {
|
|
|
928
929
|
for (const [s, n] of this.activeBrowserToolCalls)
|
|
929
930
|
n.event.sessionId === this.state.sessionId && this.activeBrowserToolCalls.delete(s);
|
|
930
931
|
Lt(this.options.clientId, this.activeBrowserToolCalls.values()), this.setState({
|
|
931
|
-
messages:
|
|
932
|
+
messages: qt(
|
|
932
933
|
this.state.messages,
|
|
933
934
|
e.clientMessageId,
|
|
934
935
|
e.runId
|
|
@@ -944,7 +945,7 @@ class zt {
|
|
|
944
945
|
}
|
|
945
946
|
startNewSession(e = {}) {
|
|
946
947
|
const s = e.notifyTransport !== !1, n = this.activeComposerWarmupId;
|
|
947
|
-
!this.options.keepRunsActiveOnSessionNavigation && s && this.state.sessionId && (this.state.isThinking || this.state.pendingMessageStatus !== null) && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "new_chat" }), this.rememberCurrentRunAsBackground(), this.clearPendingComposerWarmup(), this.cleanupSessionBrowserApis(), this.queuedClientEvents = this.queuedClientEvents.filter((r) => r.type !== "chat.user_message"), this.clearThinkingWatchdog(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.retryableClientMessageId = null, this.lastUserMessagePageUrl = null, this.clearSessionLoadRequest(), this.sessionActivityRequestId = null, this.retryAttemptsByClientMessageId = {}, this.thinkingWatchdogResyncAttemptsByClientMessageId = {}, this.nonTranscriptToolCallIds.clear(), this.options.productVariant === "personal" && (this.options.model = void 0), s && this.send({
|
|
948
|
+
!this.options.keepRunsActiveOnSessionNavigation && s && this.state.sessionId && (this.state.isThinking || this.state.pendingMessageStatus !== null) && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "new_chat" }), this.rememberCurrentRunAsBackground(), this.clearPendingComposerWarmup(), this.cleanupSessionBrowserApis(), this.queuedClientEvents = this.queuedClientEvents.filter((r) => r.type !== "chat.user_message"), this.clearThinkingWatchdog(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.retryableClientMessageId = null, this.lastUserMessagePageUrl = null, this.clearSessionLoadRequest(), this.sessionActivityRequestId = null, this.retryAttemptsByClientMessageId = {}, this.thinkingWatchdogResyncAttemptsByClientMessageId = {}, this.nonTranscriptToolCallIds.clear(), this.options.productVariant === "personal" && (this.personalModelSelectionOverride = null, this.options.model = void 0), s && this.send({
|
|
948
949
|
type: "session.reset",
|
|
949
950
|
sessionId: this.state.sessionId ?? void 0,
|
|
950
951
|
warmupId: n ?? void 0,
|
|
@@ -970,7 +971,7 @@ class zt {
|
|
|
970
971
|
const s = B(), n = new Promise((i, o) => {
|
|
971
972
|
const a = window.setTimeout(() => {
|
|
972
973
|
this.pendingSessionHistoryRequests.delete(s), o(new Error("Session history did not respond in time"));
|
|
973
|
-
},
|
|
974
|
+
}, At);
|
|
974
975
|
this.pendingSessionHistoryRequests.set(s, { resolve: i, reject: o, timeout: a });
|
|
975
976
|
}), r = {
|
|
976
977
|
type: "sessions.list",
|
|
@@ -1006,7 +1007,7 @@ class zt {
|
|
|
1006
1007
|
type: "session.reset",
|
|
1007
1008
|
warmupId: n,
|
|
1008
1009
|
page: b()
|
|
1009
|
-
}), this.clearThinkingWatchdog(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.lastUserMessagePageUrl = null, this.clearSessionLoadRequest(), this.sessionLoadRequestId = s, this.sessionActivityRequestId = null, this.setState({
|
|
1010
|
+
}), this.clearThinkingWatchdog(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.lastUserMessagePageUrl = null, this.options.productVariant === "personal" && this.state.sessionId !== e && (this.personalModelSelectionOverride = null, this.options.model = void 0), this.clearSessionLoadRequest(), this.sessionLoadRequestId = s, this.sessionActivityRequestId = null, this.setState({
|
|
1010
1011
|
sessionId: e,
|
|
1011
1012
|
messages: [],
|
|
1012
1013
|
isLoadingSession: !0,
|
|
@@ -1157,7 +1158,7 @@ class zt {
|
|
|
1157
1158
|
});
|
|
1158
1159
|
}
|
|
1159
1160
|
send(e) {
|
|
1160
|
-
this.sendNow(
|
|
1161
|
+
this.sendNow(O(e)) || (e.type === "chat.user_message" && typeof e.clientMessageId == "string" && this.queuedClientEvents.some(
|
|
1161
1162
|
(r) => r.type === "chat.user_message" && r.clientMessageId === e.clientMessageId
|
|
1162
1163
|
) || this.queuedClientEvents.push(e), K(this.options.clientId, this.queuedClientEvents), this.setState({
|
|
1163
1164
|
status: "reconnecting",
|
|
@@ -1175,7 +1176,7 @@ class zt {
|
|
|
1175
1176
|
return !1;
|
|
1176
1177
|
const s = this.socket;
|
|
1177
1178
|
try {
|
|
1178
|
-
return s.send(JSON.stringify(e)),
|
|
1179
|
+
return s.send(JSON.stringify(e)), We("client_event", e.type, ft(e)), !0;
|
|
1179
1180
|
} catch (n) {
|
|
1180
1181
|
return w("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
|
|
1181
1182
|
message: n instanceof Error ? n.message : String(n),
|
|
@@ -1221,7 +1222,7 @@ class zt {
|
|
|
1221
1222
|
this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
|
|
1222
1223
|
const e = $n();
|
|
1223
1224
|
this.sendNow(
|
|
1224
|
-
|
|
1225
|
+
O({
|
|
1225
1226
|
type: "starter_prompts.page_context",
|
|
1226
1227
|
pageUrl: e.pageUrl,
|
|
1227
1228
|
pageTitle: e.pageTitle,
|
|
@@ -1254,7 +1255,7 @@ class zt {
|
|
|
1254
1255
|
K(this.options.clientId, this.queuedClientEvents);
|
|
1255
1256
|
for (let s = 0; s < e.length; s += 1) {
|
|
1256
1257
|
const n = e[s];
|
|
1257
|
-
if (!this.sendNow(
|
|
1258
|
+
if (!this.sendNow(O(n))) {
|
|
1258
1259
|
this.queuedClientEvents.unshift(n, ...e.slice(s + 1)), K(this.options.clientId, this.queuedClientEvents);
|
|
1259
1260
|
return;
|
|
1260
1261
|
}
|
|
@@ -1306,7 +1307,7 @@ class zt {
|
|
|
1306
1307
|
rememberDurablyStoppedTurn(e, s, n) {
|
|
1307
1308
|
if (!e || !s || !Se(s) || this.findStoppedTurn(e, s))
|
|
1308
1309
|
return;
|
|
1309
|
-
const r =
|
|
1310
|
+
const r = L(s), i = k(s), o = typeof s.clientMessageId == "string" ? s.clientMessageId : r ? this.clientMessageIdsByUserMessageItemId.get(r) ?? null : null;
|
|
1310
1311
|
this.stoppedTurns.push({
|
|
1311
1312
|
sessionId: e,
|
|
1312
1313
|
clientMessageId: o,
|
|
@@ -1316,7 +1317,7 @@ class zt {
|
|
|
1316
1317
|
stoppedCausalSequence: D(s),
|
|
1317
1318
|
toolCallIds: new Set(
|
|
1318
1319
|
this.state.messages.filter(
|
|
1319
|
-
(a) =>
|
|
1320
|
+
(a) => Fe(a, r, i)
|
|
1320
1321
|
).map((a) => a.callId).filter((a) => typeof a == "string")
|
|
1321
1322
|
)
|
|
1322
1323
|
}), this.stoppedTurns.splice(0, Math.max(0, this.stoppedTurns.length - 20));
|
|
@@ -1345,7 +1346,7 @@ class zt {
|
|
|
1345
1346
|
});
|
|
1346
1347
|
}
|
|
1347
1348
|
handleServerEvent(e) {
|
|
1348
|
-
if (
|
|
1349
|
+
if (We("server_event", e.type, ft(e)), e.type === "session.subscribed") {
|
|
1349
1350
|
const s = typeof e.requestId == "string" ? e.requestId : null, n = typeof e.sessionId == "string" ? e.sessionId : null;
|
|
1350
1351
|
if (s && n && s === this.pendingSessionSubscription?.requestId && n === this.pendingSessionSubscription.sessionId) {
|
|
1351
1352
|
const r = this.pendingSessionSubscription;
|
|
@@ -1358,7 +1359,7 @@ class zt {
|
|
|
1358
1359
|
this.pendingSessionSubscription = null, s.resolve(!1), n && (this.sessionHistoryHydration = null, this.handleServerEvent({ ...e, requestId: n.requestId }));
|
|
1359
1360
|
return;
|
|
1360
1361
|
}
|
|
1361
|
-
if (this.sessionHistoryHydration &&
|
|
1362
|
+
if (this.sessionHistoryHydration && kt(e) && oe(e) === this.sessionHistoryHydration.sessionId) {
|
|
1362
1363
|
this.sessionHistoryHydration.bufferedEvents.push(e);
|
|
1363
1364
|
return;
|
|
1364
1365
|
}
|
|
@@ -1411,7 +1412,7 @@ class zt {
|
|
|
1411
1412
|
rawAppearance: e.appearance,
|
|
1412
1413
|
normalizedAppearance: n
|
|
1413
1414
|
}), this.runtimeHelperJavascript = er(e.runtimeHelpers)?.javascript ?? null;
|
|
1414
|
-
const i =
|
|
1415
|
+
const i = _t(e, "starterPrompts"), o = Object.prototype.hasOwnProperty.call(e, "starterPrompts"), a = e.starterPromptsLoading === !0, l = {
|
|
1415
1416
|
user: s,
|
|
1416
1417
|
status: "connected",
|
|
1417
1418
|
...this.state.lastErrorCode === "connection_failed" ? { lastError: null, lastErrorCode: null } : {}
|
|
@@ -1426,7 +1427,7 @@ class zt {
|
|
|
1426
1427
|
}
|
|
1427
1428
|
if (e.type === "starterPrompts.updated") {
|
|
1428
1429
|
this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0, this.setState({
|
|
1429
|
-
starterPrompts:
|
|
1430
|
+
starterPrompts: _t(e, "starterPrompts"),
|
|
1430
1431
|
starterPromptsLoading: !1
|
|
1431
1432
|
});
|
|
1432
1433
|
return;
|
|
@@ -1467,12 +1468,12 @@ class zt {
|
|
|
1467
1468
|
}
|
|
1468
1469
|
const C = d.filter((E) => {
|
|
1469
1470
|
const q = U(E);
|
|
1470
|
-
return
|
|
1471
|
-
}), S =
|
|
1471
|
+
return vt(q) ? !1 : !q || !m || !Ae(q) ? !0 : Ye(d, q) !== m;
|
|
1472
|
+
}), S = Qt(
|
|
1472
1473
|
this.state.messages,
|
|
1473
|
-
|
|
1474
|
-
), _ =
|
|
1475
|
-
(E, q) =>
|
|
1474
|
+
Pt(C, this.options.backendUrl)
|
|
1475
|
+
), _ = Ut(S), v = g ? p?.content ?? "" : this.state.assistantDraft, R = g ? p?.itemId ?? null : this.state.assistantDraftItemId, ee = g ? p?.respondsToUserMessageId ?? null : this.state.assistantDraftRespondsToUserMessageId, P = g ? p?.runId ?? null : this.state.assistantDraftRunId, F = d.some(
|
|
1476
|
+
(E, q) => Dt(
|
|
1476
1477
|
U(E),
|
|
1477
1478
|
v,
|
|
1478
1479
|
R,
|
|
@@ -1484,7 +1485,7 @@ class zt {
|
|
|
1484
1485
|
if (!_ && br(this.state.messages, d))
|
|
1485
1486
|
return;
|
|
1486
1487
|
this.lastUserMessagePageUrl = Cr(d);
|
|
1487
|
-
const x = N || c ? null :
|
|
1488
|
+
const x = N || c ? null : Je(d);
|
|
1488
1489
|
if (this.latestRecoverableClientMessageId = x, ue && this.clearRetryTimers(), this.setState({
|
|
1489
1490
|
sessionId: M(e.session, "id") ?? this.state.sessionId,
|
|
1490
1491
|
messages: S,
|
|
@@ -1544,7 +1545,7 @@ class zt {
|
|
|
1544
1545
|
const s = typeof e.requestId == "string" ? e.requestId : null, n = typeof e.sessionId == "string" ? e.sessionId : null;
|
|
1545
1546
|
if (!s || n !== this.state.sessionId)
|
|
1546
1547
|
return;
|
|
1547
|
-
const r =
|
|
1548
|
+
const r = Pt(
|
|
1548
1549
|
Array.isArray(e.items) ? e.items : [],
|
|
1549
1550
|
this.options.backendUrl
|
|
1550
1551
|
);
|
|
@@ -1585,7 +1586,7 @@ class zt {
|
|
|
1585
1586
|
const s = U(e.item);
|
|
1586
1587
|
if (Ae(s)) {
|
|
1587
1588
|
typeof s?.runId == "string" && this.retryableFailureRunIdsAwaitingDone.add(s.runId);
|
|
1588
|
-
const r = M(e.item, "sessionId") ?? this.state.sessionId, i = s ?
|
|
1589
|
+
const r = M(e.item, "sessionId") ?? this.state.sessionId, i = s ? L(s) : null, o = i ? this.clientMessageIdsByUserMessageItemId.get(i) : null, a = typeof s?.clientMessageId == "string" ? s.clientMessageId : o ?? (i ? null : this.activeClientMessageId ?? this.latestRecoverableClientMessageId);
|
|
1589
1590
|
if (r && a) {
|
|
1590
1591
|
this.retryAfterInterruptedRun(r, a);
|
|
1591
1592
|
return;
|
|
@@ -1595,19 +1596,19 @@ class zt {
|
|
|
1595
1596
|
return;
|
|
1596
1597
|
}
|
|
1597
1598
|
}
|
|
1598
|
-
if (
|
|
1599
|
+
if (vt(s))
|
|
1599
1600
|
return;
|
|
1600
|
-
const n =
|
|
1601
|
+
const n = Yt(e.item, this.options.backendUrl);
|
|
1601
1602
|
if (n) {
|
|
1602
|
-
const r =
|
|
1603
|
+
const r = Lr(s, n), i = n.callId ? this.pendingToolLoadingByCallId.get(n.callId) : void 0;
|
|
1603
1604
|
n.callId && i !== void 0 && (n.loading = i, this.pendingToolLoadingByCallId.delete(n.callId)), H(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), Dr(s) && this.clearRunAckResyncRetryTimer();
|
|
1604
|
-
const o =
|
|
1605
|
+
const o = Xe(this.state.messages, n), a = Ut(o), l = Dt(
|
|
1605
1606
|
s,
|
|
1606
1607
|
this.state.assistantDraft,
|
|
1607
1608
|
this.state.assistantDraftItemId,
|
|
1608
1609
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
1609
1610
|
this.state.assistantDraftRunId,
|
|
1610
|
-
|
|
1611
|
+
ns(
|
|
1611
1612
|
o,
|
|
1612
1613
|
o.findIndex((h) => h.id === n.id)
|
|
1613
1614
|
)
|
|
@@ -1640,7 +1641,7 @@ class zt {
|
|
|
1640
1641
|
this.clearRunAckResyncRetryTimer();
|
|
1641
1642
|
const s = typeof e.delta == "string" ? e.delta : "", n = typeof e.itemId == "string" ? e.itemId : null, r = n !== null && this.state.assistantDraftItemId !== n, i = `${r ? "" : this.state.assistantDraft}${s}`, o = n ?? this.state.assistantDraftItemId ?? "assistant-draft", a = this.state.messages.find((h) => h.id === o), l = e.phase === "commentary" || e.phase === "final_answer" ? e.phase : r ? null : this.state.assistantDraftPhase, c = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : this.state.assistantDraftRespondsToUserMessageId, d = typeof e.runId == "string" ? e.runId : this.state.assistantDraftRunId;
|
|
1642
1643
|
this.activeClientMessageId && (this.activeResponseUserMessageId = c, this.activeResponseRunId = d), this.setState({
|
|
1643
|
-
messages:
|
|
1644
|
+
messages: Xe(this.state.messages, {
|
|
1644
1645
|
id: o,
|
|
1645
1646
|
role: "assistant",
|
|
1646
1647
|
content: i,
|
|
@@ -1669,9 +1670,9 @@ class zt {
|
|
|
1669
1670
|
const s = typeof e.sessionId == "string" ? e.sessionId : this.state.sessionId, n = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : null, r = typeof e.runId == "string" ? e.runId : null;
|
|
1670
1671
|
if (!(n && this.state.assistantDraftRespondsToUserMessageId ? n === this.state.assistantDraftRespondsToUserMessageId : !r || !this.state.assistantDraftRunId || r === this.state.assistantDraftRunId))
|
|
1671
1672
|
return;
|
|
1672
|
-
const o = n ? this.clientMessageIdsByUserMessageItemId.get(n) ?? null : null, a = !this.activeClientMessageId || (o ? o === this.activeClientMessageId : this.activeResponseUserMessageId ? !n || n === this.activeResponseUserMessageId : !this.activeResponseRunId || !r || r === this.activeResponseRunId), l =
|
|
1673
|
+
const o = n ? this.clientMessageIdsByUserMessageItemId.get(n) ?? null : null, a = !this.activeClientMessageId || (o ? o === this.activeClientMessageId : this.activeResponseUserMessageId ? !n || n === this.activeResponseUserMessageId : !this.activeResponseRunId || !r || r === this.activeResponseRunId), l = Ds(
|
|
1673
1674
|
this.state.messages.filter(
|
|
1674
|
-
(c) => c.dataType !== "assistant_draft" || !
|
|
1675
|
+
(c) => c.dataType !== "assistant_draft" || !Fe(
|
|
1675
1676
|
c,
|
|
1676
1677
|
n,
|
|
1677
1678
|
r
|
|
@@ -1679,7 +1680,7 @@ class zt {
|
|
|
1679
1680
|
),
|
|
1680
1681
|
n,
|
|
1681
1682
|
r,
|
|
1682
|
-
|
|
1683
|
+
Zt
|
|
1683
1684
|
);
|
|
1684
1685
|
this.setState({
|
|
1685
1686
|
sessionId: s,
|
|
@@ -1771,7 +1772,7 @@ class zt {
|
|
|
1771
1772
|
o && r && i && (this.retryableClientMessageId = i);
|
|
1772
1773
|
const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l = Wn(a.message);
|
|
1773
1774
|
l && console.error(l);
|
|
1774
|
-
const c = i ?? this.activeClientMessageId, d = typeof e.runId == "string" ? e.runId : null, h =
|
|
1775
|
+
const c = i ?? this.activeClientMessageId, d = typeof e.runId == "string" ? e.runId : null, h = qt(
|
|
1775
1776
|
this.state.messages,
|
|
1776
1777
|
c,
|
|
1777
1778
|
d
|
|
@@ -1800,13 +1801,13 @@ class zt {
|
|
|
1800
1801
|
}
|
|
1801
1802
|
}
|
|
1802
1803
|
updatePersonalModelFromSession(e) {
|
|
1803
|
-
if (this.options.productVariant !== "personal" || !e || typeof e != "object")
|
|
1804
|
+
if (this.options.productVariant !== "personal" || !e || typeof e != "object" || this.personalModelSelectionOverride !== null)
|
|
1804
1805
|
return;
|
|
1805
1806
|
const s = e.metadata, n = s && typeof s == "object" ? s.model : void 0;
|
|
1806
|
-
this.options.model =
|
|
1807
|
+
this.options.model = Be(n) ? n : "gpt-5.6-sol";
|
|
1807
1808
|
}
|
|
1808
1809
|
shouldIgnoreBackgroundSessionEvent(e) {
|
|
1809
|
-
if (!this.options.keepRunsActiveOnSessionNavigation || !
|
|
1810
|
+
if (!this.options.keepRunsActiveOnSessionNavigation || !kt(e))
|
|
1810
1811
|
return !1;
|
|
1811
1812
|
const s = oe(e);
|
|
1812
1813
|
return s ? this.deferredSessionUpdatedSessionIds.has(s) ? !0 : this.state.sessionId ? s !== this.state.sessionId : this.backgroundSessionIds.has(s) : !1;
|
|
@@ -1865,7 +1866,7 @@ class zt {
|
|
|
1865
1866
|
}, ie(n));
|
|
1866
1867
|
}
|
|
1867
1868
|
requestSessionRecoveryExhaustion(e, s) {
|
|
1868
|
-
this.retryableClientMessageId = s, this.setState({ status: "connected", isThinking: !0, lastError: null, lastErrorCode: null }), this.recoveryExhaustionRequestedClientMessageIds.has(s) ? this.resyncThinkingSession() : (this.recoveryExhaustionRequestedClientMessageIds.add(s), this.send({ type: "chat.retry_last_user_message", sessionId: e, clientMessageId: s, automatic: !0 })), this.scheduleThinkingWatchdog(
|
|
1869
|
+
this.retryableClientMessageId = s, this.setState({ status: "connected", isThinking: !0, lastError: null, lastErrorCode: null }), this.recoveryExhaustionRequestedClientMessageIds.has(s) ? this.resyncThinkingSession() : (this.recoveryExhaustionRequestedClientMessageIds.add(s), this.send({ type: "chat.retry_last_user_message", sessionId: e, clientMessageId: s, automatic: !0 })), this.scheduleThinkingWatchdog(Tt);
|
|
1869
1870
|
}
|
|
1870
1871
|
clearRetryTimers() {
|
|
1871
1872
|
for (const e of Object.values(this.retryTimersByClientMessageId))
|
|
@@ -1896,7 +1897,7 @@ class zt {
|
|
|
1896
1897
|
const r = new Promise((i, o) => {
|
|
1897
1898
|
const a = window.setTimeout(() => {
|
|
1898
1899
|
e.delete(s.requestId), o(new Error(n));
|
|
1899
|
-
},
|
|
1900
|
+
}, At);
|
|
1900
1901
|
e.set(s.requestId, { resolve: i, reject: o, timeout: a });
|
|
1901
1902
|
});
|
|
1902
1903
|
if (!this.sendNow(s)) {
|
|
@@ -1919,7 +1920,7 @@ class zt {
|
|
|
1919
1920
|
e.clear();
|
|
1920
1921
|
}
|
|
1921
1922
|
markThinkingProgress() {
|
|
1922
|
-
!this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(
|
|
1923
|
+
!this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(It), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
|
|
1923
1924
|
}
|
|
1924
1925
|
scheduleThinkingWatchdog(e) {
|
|
1925
1926
|
this.thinkingWatchdogTimer !== null && window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = window.setTimeout(() => {
|
|
@@ -1965,7 +1966,7 @@ class zt {
|
|
|
1965
1966
|
schedulePendingDeliveryAck(e) {
|
|
1966
1967
|
this.clearPendingDeliveryTimers(), !fe() && (this.pendingDeliveryAckTimer = window.setTimeout(() => {
|
|
1967
1968
|
this.pendingDeliveryAckTimer = null, this.retryPendingDelivery(e);
|
|
1968
|
-
},
|
|
1969
|
+
}, wt));
|
|
1969
1970
|
}
|
|
1970
1971
|
retryPendingDelivery(e) {
|
|
1971
1972
|
if (this.state.status === "closed" || this.pendingClientMessageId !== e || !this.pendingUserMessageEvent)
|
|
@@ -1977,7 +1978,7 @@ class zt {
|
|
|
1977
1978
|
}
|
|
1978
1979
|
s === 0 && this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.retryAttemptsByClientMessageId[e] = s + 1, this.setState({ pendingMessageStatus: "reconnecting" }), this.pendingDeliveryRetryTimer = window.setTimeout(() => {
|
|
1979
1980
|
this.pendingDeliveryRetryTimer = null, !(this.pendingClientMessageId !== e || !this.pendingUserMessageEvent) && (this.send(this.pendingUserMessageEvent), this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(e));
|
|
1980
|
-
}, ie(s,
|
|
1981
|
+
}, ie(s, Mt));
|
|
1981
1982
|
}
|
|
1982
1983
|
failPendingDelivery(e) {
|
|
1983
1984
|
if (this.pendingClientMessageId !== e)
|
|
@@ -2013,7 +2014,7 @@ class zt {
|
|
|
2013
2014
|
scheduleRunAckWatchdog(e) {
|
|
2014
2015
|
this.runAckWatchdogTimer !== null && window.clearTimeout(this.runAckWatchdogTimer), this.runAckWatchdogTimer = window.setTimeout(() => {
|
|
2015
2016
|
this.runAckWatchdogTimer = null, this.recoverMissedRunAck(e);
|
|
2016
|
-
},
|
|
2017
|
+
}, wt);
|
|
2017
2018
|
}
|
|
2018
2019
|
recoverMissedRunAck(e) {
|
|
2019
2020
|
!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== e || (w("web-sdk.agent", "Pluno run ack missed; resyncing session", {
|
|
@@ -2037,8 +2038,8 @@ class zt {
|
|
|
2037
2038
|
sessionId: this.state.sessionId,
|
|
2038
2039
|
clientMessageId: e,
|
|
2039
2040
|
automatic: !0
|
|
2040
|
-
}) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.scheduleThinkingWatchdog(
|
|
2041
|
-
}, ie(s,
|
|
2041
|
+
}) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.scheduleThinkingWatchdog(It)));
|
|
2042
|
+
}, ie(s, Mt)));
|
|
2042
2043
|
}
|
|
2043
2044
|
clearRunAckResyncRetryTimer() {
|
|
2044
2045
|
this.runAckResyncRetryTimer !== null && (window.clearTimeout(this.runAckResyncRetryTimer), this.runAckResyncRetryTimer = null);
|
|
@@ -2061,7 +2062,7 @@ class zt {
|
|
|
2061
2062
|
),
|
|
2062
2063
|
isThinking: !1,
|
|
2063
2064
|
taskStatus: "failed",
|
|
2064
|
-
lastError:
|
|
2065
|
+
lastError: St,
|
|
2065
2066
|
lastErrorCode: "run_recovery_exhausted"
|
|
2066
2067
|
}), this.clearThinkingWatchdog();
|
|
2067
2068
|
return;
|
|
@@ -2074,7 +2075,7 @@ class zt {
|
|
|
2074
2075
|
}), this.state.sessionId ? this.requestSessionRecoveryExhaustion(this.state.sessionId, e) : (this.setState({
|
|
2075
2076
|
isThinking: !1,
|
|
2076
2077
|
taskStatus: "failed",
|
|
2077
|
-
lastError:
|
|
2078
|
+
lastError: St,
|
|
2078
2079
|
lastErrorCode: "connection_failed"
|
|
2079
2080
|
}), this.clearThinkingWatchdog());
|
|
2080
2081
|
return;
|
|
@@ -2084,7 +2085,7 @@ class zt {
|
|
|
2084
2085
|
sessionId: this.state.sessionId,
|
|
2085
2086
|
clientMessageId: e,
|
|
2086
2087
|
resyncAttempts: s + 1
|
|
2087
|
-
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(
|
|
2088
|
+
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(Tt);
|
|
2088
2089
|
return;
|
|
2089
2090
|
}
|
|
2090
2091
|
this.setState({
|
|
@@ -2126,8 +2127,8 @@ class zt {
|
|
|
2126
2127
|
callId: n,
|
|
2127
2128
|
toolName: r,
|
|
2128
2129
|
summary: i,
|
|
2129
|
-
rawInput:
|
|
2130
|
-
rawOutput:
|
|
2130
|
+
rawInput: O(o),
|
|
2131
|
+
rawOutput: O({
|
|
2131
2132
|
ok: !1,
|
|
2132
2133
|
toolName: r,
|
|
2133
2134
|
error: `Unsupported browser tool: ${r}`
|
|
@@ -2142,7 +2143,7 @@ class zt {
|
|
|
2142
2143
|
callId: n,
|
|
2143
2144
|
toolName: r,
|
|
2144
2145
|
summary: i,
|
|
2145
|
-
rawInput:
|
|
2146
|
+
rawInput: O(o),
|
|
2146
2147
|
rawOutput: {
|
|
2147
2148
|
ok: !1,
|
|
2148
2149
|
toolName: r,
|
|
@@ -2158,7 +2159,7 @@ class zt {
|
|
|
2158
2159
|
callId: n,
|
|
2159
2160
|
toolName: r,
|
|
2160
2161
|
summary: i,
|
|
2161
|
-
rawInput:
|
|
2162
|
+
rawInput: O(o),
|
|
2162
2163
|
rawOutput: null
|
|
2163
2164
|
},
|
|
2164
2165
|
startedAtMs: Date.now(),
|
|
@@ -2166,9 +2167,9 @@ class zt {
|
|
|
2166
2167
|
startedAtOrigin: location.origin
|
|
2167
2168
|
}), this.installSessionBrowserApis();
|
|
2168
2169
|
let c = null, d;
|
|
2169
|
-
c = await this.executeRuntimeHelper(), d = await
|
|
2170
|
+
c = await this.executeRuntimeHelper(), d = await Ct(
|
|
2170
2171
|
o,
|
|
2171
|
-
|
|
2172
|
+
On(e.runtimeContext, this.options.backendUrl)
|
|
2172
2173
|
).catch((h) => ({
|
|
2173
2174
|
ok: !1,
|
|
2174
2175
|
exception: {
|
|
@@ -2180,8 +2181,8 @@ class zt {
|
|
|
2180
2181
|
callId: n,
|
|
2181
2182
|
toolName: r,
|
|
2182
2183
|
summary: o.summary,
|
|
2183
|
-
rawInput:
|
|
2184
|
-
rawOutput:
|
|
2184
|
+
rawInput: O(o),
|
|
2185
|
+
rawOutput: O(tr(d, c))
|
|
2185
2186
|
}), Lt(this.options.clientId, this.activeBrowserToolCalls.values()));
|
|
2186
2187
|
}
|
|
2187
2188
|
setToolMessageLoading(e, s) {
|
|
@@ -2196,7 +2197,7 @@ class zt {
|
|
|
2196
2197
|
if (this.pageLifecycleCleanup)
|
|
2197
2198
|
return;
|
|
2198
2199
|
const e = () => {
|
|
2199
|
-
|
|
2200
|
+
os(this.options.clientId, this.activeBrowserToolCalls.values());
|
|
2200
2201
|
};
|
|
2201
2202
|
window.addEventListener("pagehide", e), window.addEventListener("beforeunload", e), this.pageLifecycleCleanup = () => {
|
|
2202
2203
|
window.removeEventListener("pagehide", e), window.removeEventListener("beforeunload", e);
|
|
@@ -2211,7 +2212,7 @@ class zt {
|
|
|
2211
2212
|
async executeRuntimeHelper() {
|
|
2212
2213
|
if (!this.runtimeHelperJavascript?.trim())
|
|
2213
2214
|
return null;
|
|
2214
|
-
const e = await
|
|
2215
|
+
const e = await Ct({
|
|
2215
2216
|
javascript: this.runtimeHelperJavascript
|
|
2216
2217
|
});
|
|
2217
2218
|
return e.ok === !1 ? sr(e) : null;
|
|
@@ -2291,7 +2292,7 @@ class zt {
|
|
|
2291
2292
|
...e.lastError === null && e.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
|
|
2292
2293
|
...e.lastError !== void 0 && e.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
|
|
2293
2294
|
};
|
|
2294
|
-
this.state = o, Kr(this.options.clientId, this.state), this.emit("state", this.getState()),
|
|
2295
|
+
this.state = o, Kr(this.options.clientId, this.state), this.emit("state", this.getState()), We("state", this.state.status, {
|
|
2295
2296
|
status: this.state.status,
|
|
2296
2297
|
sessionId: this.state.sessionId,
|
|
2297
2298
|
messageCount: this.state.messages.length,
|
|
@@ -2313,7 +2314,7 @@ class zt {
|
|
|
2313
2314
|
this.listeners[e]?.forEach((r) => r(s));
|
|
2314
2315
|
}
|
|
2315
2316
|
}
|
|
2316
|
-
const
|
|
2317
|
+
const $e = /* @__PURE__ */ new WeakMap();
|
|
2317
2318
|
function Sn(t) {
|
|
2318
2319
|
const e = window.__plunoProductAgentNetworkCapture ?? wn();
|
|
2319
2320
|
return e.subscribers.add(t), () => {
|
|
@@ -2337,14 +2338,14 @@ function wn() {
|
|
|
2337
2338
|
throw m;
|
|
2338
2339
|
}
|
|
2339
2340
|
try {
|
|
2340
|
-
const m = f instanceof Request ? f : null, C = ii(f, m), T =
|
|
2341
|
+
const m = f instanceof Request ? f : null, C = ii(f, m), T = us(u?.headers ?? m?.headers);
|
|
2341
2342
|
if (!J(C, T, u?.body)) {
|
|
2342
2343
|
const _ = {
|
|
2343
|
-
requestId:
|
|
2344
|
-
url: W(C,
|
|
2344
|
+
requestId: ze("fetch"),
|
|
2345
|
+
url: W(C, He),
|
|
2345
2346
|
method: (u?.method ?? m?.method ?? "GET").toUpperCase(),
|
|
2346
2347
|
requestHeaders: T,
|
|
2347
|
-
requestBody:
|
|
2348
|
+
requestBody: xt(u?.body),
|
|
2348
2349
|
resourceType: "fetch",
|
|
2349
2350
|
startedAt: new Date(p).toISOString()
|
|
2350
2351
|
};
|
|
@@ -2372,22 +2373,22 @@ function wn() {
|
|
|
2372
2373
|
return g;
|
|
2373
2374
|
}, a = function(f, u, p, g, m) {
|
|
2374
2375
|
const C = n.call(this, f, u, p ?? !0, g ?? void 0, m ?? void 0), T = typeof u == "string" ? u : u.toString();
|
|
2375
|
-
return
|
|
2376
|
-
requestId:
|
|
2376
|
+
return $e.set(this, {
|
|
2377
|
+
requestId: ze("xhr"),
|
|
2377
2378
|
method: String(f ?? "GET").toUpperCase(),
|
|
2378
|
-
url: W(T,
|
|
2379
|
+
url: W(T, He),
|
|
2379
2380
|
requestHeaders: {},
|
|
2380
2381
|
startedAtMs: Date.now(),
|
|
2381
2382
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2382
2383
|
excluded: J(T)
|
|
2383
2384
|
}), C;
|
|
2384
2385
|
}, l = function(f, u) {
|
|
2385
|
-
const p = r.call(this, f, u), g =
|
|
2386
|
-
return g && Object.keys(g.requestHeaders).length <
|
|
2386
|
+
const p = r.call(this, f, u), g = $e.get(this);
|
|
2387
|
+
return g && Object.keys(g.requestHeaders).length < rt && (g.requestHeaders[f] = at(f, u), g.excluded = g.excluded || J(g.url, g.requestHeaders)), p;
|
|
2387
2388
|
}, c = function(f) {
|
|
2388
2389
|
try {
|
|
2389
|
-
const u =
|
|
2390
|
-
u && (u.excluded = u.excluded || J(u.url, u.requestHeaders, f), u.requestBody =
|
|
2390
|
+
const u = $e.get(this);
|
|
2391
|
+
u && (u.excluded = u.excluded || J(u.url, u.requestHeaders, f), u.requestBody = xt(f), u.excluded || this.addEventListener(
|
|
2391
2392
|
"loadend",
|
|
2392
2393
|
() => {
|
|
2393
2394
|
queueMicrotask(() => {
|
|
@@ -2443,8 +2444,8 @@ function wn() {
|
|
|
2443
2444
|
continue;
|
|
2444
2445
|
const p = performance.timeOrigin + u.startTime;
|
|
2445
2446
|
e({
|
|
2446
|
-
requestId:
|
|
2447
|
-
url: W(u.name,
|
|
2447
|
+
requestId: ze("resource"),
|
|
2448
|
+
url: W(u.name, He),
|
|
2448
2449
|
method: "GET",
|
|
2449
2450
|
resourceType: "resource",
|
|
2450
2451
|
responseStatus: u.responseStatus,
|
|
@@ -2494,14 +2495,14 @@ function w(t, e, s) {
|
|
|
2494
2495
|
}, i = n.__plunoProductAgentDiagnostics__ ?? [];
|
|
2495
2496
|
i.push(r), i.length > 120 && i.splice(0, i.length - 120), n.__plunoProductAgentDiagnostics__ = i, n.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent("product-agent:preview-diagnostic", { detail: r }));
|
|
2496
2497
|
}
|
|
2497
|
-
function
|
|
2498
|
+
function Et(t) {
|
|
2498
2499
|
const e = typeof t == "function" ? t() : t;
|
|
2499
2500
|
return e && Object.keys(e).length > 0 ? e : void 0;
|
|
2500
2501
|
}
|
|
2501
2502
|
function Mn(t) {
|
|
2502
2503
|
return t.type === "run.model_started" || t.type === "conversation.state" || t.type === "session.updated" || t.type === "session.item" || t.type === "chat.assistant_delta" || t.type === "chat.assistant_done" || t.type === "tool.call";
|
|
2503
2504
|
}
|
|
2504
|
-
function
|
|
2505
|
+
function kt(t) {
|
|
2505
2506
|
return t.type === "run.steered" || t.type === "run.ack" || t.type === "run.model_started" || t.type === "conversation.state" || t.type === "session.updated" || t.type === "session.item" || t.type === "chat.assistant_delta" || t.type === "chat.assistant_done" || t.type === "tool.call" || t.type === "tool.status" || t.type === "error" && typeof t.requestId != "string";
|
|
2506
2507
|
}
|
|
2507
2508
|
function oe(t) {
|
|
@@ -2531,10 +2532,10 @@ function En() {
|
|
|
2531
2532
|
};
|
|
2532
2533
|
}
|
|
2533
2534
|
function kn() {
|
|
2534
|
-
return
|
|
2535
|
+
return Wt(globalThis, "getPageSnapshot", async () => it());
|
|
2535
2536
|
}
|
|
2536
2537
|
function Cn() {
|
|
2537
|
-
return
|
|
2538
|
+
return Wt(globalThis, "pageImages", {
|
|
2538
2539
|
inspectImage: async (e, s) => await bn(e, s)
|
|
2539
2540
|
});
|
|
2540
2541
|
}
|
|
@@ -2543,7 +2544,7 @@ async function bn(t, e = {}) {
|
|
|
2543
2544
|
return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
|
|
2544
2545
|
type: "pluno.pageImages.inspectImage",
|
|
2545
2546
|
imageAttached: !1,
|
|
2546
|
-
imageAttachmentError:
|
|
2547
|
+
imageAttachmentError: Ft
|
|
2547
2548
|
} : {
|
|
2548
2549
|
type: "pluno.pageImages.inspectImage",
|
|
2549
2550
|
imageAttached: !0,
|
|
@@ -2558,7 +2559,7 @@ async function bn(t, e = {}) {
|
|
|
2558
2559
|
};
|
|
2559
2560
|
}
|
|
2560
2561
|
async function _n(t) {
|
|
2561
|
-
return t instanceof Blob ? t.type.startsWith("image/") ? t.size === 0 ? { ok: !1, error: "Page image is empty." } : t.size > 8 * 1024 * 1024 ? { ok: !1, error:
|
|
2562
|
+
return t instanceof Blob ? t.type.startsWith("image/") ? t.size === 0 ? { ok: !1, error: "Page image is empty." } : t.size > 8 * 1024 * 1024 ? { ok: !1, error: Ft } : {
|
|
2562
2563
|
ok: !0,
|
|
2563
2564
|
mimeType: t.type,
|
|
2564
2565
|
sizeBytes: t.size,
|
|
@@ -2611,7 +2612,7 @@ function qn(t) {
|
|
|
2611
2612
|
}, n.onerror = () => s(n.error ?? new Error("Failed to read page image")), n.readAsDataURL(t);
|
|
2612
2613
|
});
|
|
2613
2614
|
}
|
|
2614
|
-
async function
|
|
2615
|
+
async function Ct(t, e) {
|
|
2615
2616
|
const s = Object.getPrototypeOf(async function() {
|
|
2616
2617
|
}).constructor, n = t.timeoutMs ?? An, r = Date.now(), i = [];
|
|
2617
2618
|
let o;
|
|
@@ -2631,7 +2632,7 @@ async function kt(t, e) {
|
|
|
2631
2632
|
o = window.setTimeout(() => h(c), n);
|
|
2632
2633
|
})
|
|
2633
2634
|
]);
|
|
2634
|
-
return d === c ?
|
|
2635
|
+
return d === c ? Ln(n) : {
|
|
2635
2636
|
ok: !0,
|
|
2636
2637
|
result: d,
|
|
2637
2638
|
console: i,
|
|
@@ -2660,7 +2661,7 @@ async function kt(t, e) {
|
|
|
2660
2661
|
e?.deactivate(), o !== void 0 && window.clearTimeout(o), console.log = a.log, console.info = a.info, console.warn = a.warn, console.error = a.error;
|
|
2661
2662
|
}
|
|
2662
2663
|
}
|
|
2663
|
-
function
|
|
2664
|
+
function On(t, e) {
|
|
2664
2665
|
if (!t || typeof t != "object")
|
|
2665
2666
|
return;
|
|
2666
2667
|
const s = t.sandboxFilesToken;
|
|
@@ -2704,7 +2705,7 @@ function Ln(t, e) {
|
|
|
2704
2705
|
}
|
|
2705
2706
|
};
|
|
2706
2707
|
}
|
|
2707
|
-
function
|
|
2708
|
+
function Ln(t) {
|
|
2708
2709
|
return {
|
|
2709
2710
|
ok: !1,
|
|
2710
2711
|
exception: {
|
|
@@ -2744,7 +2745,7 @@ function Hn(t) {
|
|
|
2744
2745
|
return e.protocol = e.protocol === "https:" ? "wss:" : "ws:", e.toString();
|
|
2745
2746
|
}
|
|
2746
2747
|
function b() {
|
|
2747
|
-
const t =
|
|
2748
|
+
const t = Jt();
|
|
2748
2749
|
return {
|
|
2749
2750
|
url: location.href,
|
|
2750
2751
|
title: document.title,
|
|
@@ -2756,7 +2757,7 @@ function $n() {
|
|
|
2756
2757
|
return {
|
|
2757
2758
|
pageUrl: location.href,
|
|
2758
2759
|
pageTitle: document.title,
|
|
2759
|
-
htmlContent:
|
|
2760
|
+
htmlContent: it()
|
|
2760
2761
|
};
|
|
2761
2762
|
}
|
|
2762
2763
|
function jn(t) {
|
|
@@ -2780,9 +2781,9 @@ function Fn() {
|
|
|
2780
2781
|
};
|
|
2781
2782
|
}
|
|
2782
2783
|
function fe() {
|
|
2783
|
-
return
|
|
2784
|
+
return Jt()?.surface === "browser_extension_sdk_preview";
|
|
2784
2785
|
}
|
|
2785
|
-
function
|
|
2786
|
+
function it() {
|
|
2786
2787
|
if (!document.body)
|
|
2787
2788
|
return "";
|
|
2788
2789
|
const t = [], e = [], s = (p, g) => {
|
|
@@ -2791,12 +2792,12 @@ function rt() {
|
|
|
2791
2792
|
};
|
|
2792
2793
|
s("Selected text", window.getSelection()?.toString() ?? "");
|
|
2793
2794
|
const n = "[role='dialog'], [role='alertdialog'], dialog[open], [aria-modal='true']", r = Array.from(document.querySelectorAll(n)).filter(
|
|
2794
|
-
(p) =>
|
|
2795
|
+
(p) => Gt(p) && !p.parentElement?.closest(n)
|
|
2795
2796
|
);
|
|
2796
2797
|
for (const p of r.slice(0, 3))
|
|
2797
|
-
s("Active overlay",
|
|
2798
|
-
const i = zn(), o = i ?
|
|
2799
|
-
s("Main page content", o), s("Additional visible page text",
|
|
2798
|
+
s("Active overlay", je(le(p), e));
|
|
2799
|
+
const i = zn(), o = i ? je(le(i), e) : "";
|
|
2800
|
+
s("Main page content", o), s("Additional visible page text", je(le(document.body), e));
|
|
2800
2801
|
const a = t.map(([p, g]) => `${p}:
|
|
2801
2802
|
${g}`).join(`
|
|
2802
2803
|
|
|
@@ -2818,18 +2819,18 @@ function Q(t) {
|
|
|
2818
2819
|
|
|
2819
2820
|
`).trim();
|
|
2820
2821
|
}
|
|
2821
|
-
function
|
|
2822
|
+
function je(t, e) {
|
|
2822
2823
|
let s = Q(t);
|
|
2823
2824
|
for (const n of e)
|
|
2824
2825
|
s = s.replace(n, "");
|
|
2825
2826
|
return Q(s);
|
|
2826
2827
|
}
|
|
2827
|
-
function
|
|
2828
|
+
function Gt(t) {
|
|
2828
2829
|
const e = window.getComputedStyle(t);
|
|
2829
2830
|
return e.display !== "none" && e.visibility !== "hidden" && t.getClientRects().length > 0;
|
|
2830
2831
|
}
|
|
2831
2832
|
function zn() {
|
|
2832
|
-
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(
|
|
2833
|
+
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Gt).sort((t, e) => le(e).length - le(t).length)[0] ?? null;
|
|
2833
2834
|
}
|
|
2834
2835
|
function Kn(t, e) {
|
|
2835
2836
|
const s = /* @__PURE__ */ new Set([
|
|
@@ -2926,7 +2927,7 @@ function Kn(t, e) {
|
|
|
2926
2927
|
if (f >= 1e3 && !X || _.has(R) || i.has(P) || R.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || F.display === "none" || F.visibility === "hidden")
|
|
2927
2928
|
return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
|
|
2928
2929
|
f += 1;
|
|
2929
|
-
const te = u(R), N =
|
|
2930
|
+
const te = u(R), N = Xt(R), ue = a.has(te) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(P) || P === "a" && R.hasAttribute("href"), de = Array.from(R.children).filter((I) => I instanceof HTMLElement), z = /* @__PURE__ */ new Map();
|
|
2930
2931
|
for (const I of de) {
|
|
2931
2932
|
const A = p(I);
|
|
2932
2933
|
z.set(A, (z.get(A) ?? 0) + 1);
|
|
@@ -2936,33 +2937,33 @@ function Kn(t, e) {
|
|
|
2936
2937
|
const A = p(I), j = E.get(A) ?? 0;
|
|
2937
2938
|
E.set(A, j + 1), (z.get(A) ?? 0) > 8 && j >= 6 && !d.has(I) && x.set(A, (x.get(A) ?? 0) + 1);
|
|
2938
2939
|
}
|
|
2939
|
-
const q = /* @__PURE__ */ new Map(),
|
|
2940
|
+
const q = /* @__PURE__ */ new Map(), lt = /* @__PURE__ */ new Set(), Pe = [], ct = [];
|
|
2940
2941
|
for (const I of de) {
|
|
2941
|
-
const A = p(I), j = z.get(A) ?? 0,
|
|
2942
|
-
if (q.set(A,
|
|
2943
|
-
|
|
2942
|
+
const A = p(I), j = z.get(A) ?? 0, pt = q.get(A) ?? 0;
|
|
2943
|
+
if (q.set(A, pt + 1), j > 8 && pt >= 6 && !d.has(I)) {
|
|
2944
|
+
lt.has(A) || (Pe.push([`… ${x.get(A) ?? 0} similar siblings omitted`]), lt.add(A));
|
|
2944
2945
|
continue;
|
|
2945
2946
|
}
|
|
2946
|
-
const
|
|
2947
|
-
|
|
2947
|
+
const ht = v(I, ee);
|
|
2948
|
+
ct.push(ht), Pe.push(ht.lines);
|
|
2948
2949
|
}
|
|
2949
2950
|
const Ue = [];
|
|
2950
2951
|
if (R.shadowRoot)
|
|
2951
2952
|
for (const I of Array.from(R.shadowRoot.children))
|
|
2952
2953
|
I instanceof HTMLElement && Ue.push(v(I, ee + 1));
|
|
2953
|
-
const pe = [...
|
|
2954
|
+
const pe = [...ct, ...Ue], ve = N.length > 0 || ue || pe.some((I) => I.hasUsefulContent), ut = Q(
|
|
2954
2955
|
[N, ...pe.map((I) => I.textPreview)].filter(Boolean).join(" ")
|
|
2955
|
-
).slice(0, 180),
|
|
2956
|
+
).slice(0, 180), Is = R.hasAttribute("contenteditable") && (N.length > 0 || !R.querySelector("[contenteditable]")), dt = c.some((I) => R.hasAttribute(I)) || !!te || Is, De = (R.getClientRects().length > 0 || F.display === "contents") && (s.has(P) || dt || X) && (ve || X) && (!r.has(P) || ve || dt || X), qe = De ? 1 : 0, se = [];
|
|
2956
2957
|
if (De) {
|
|
2957
|
-
const I = pe.some((j) => j.containsTextElement), A = n.has(P) && !I ?
|
|
2958
|
-
se.push(
|
|
2958
|
+
const I = pe.some((j) => j.containsTextElement), A = n.has(P) && !I ? ut : N;
|
|
2959
|
+
se.push(Vt(R, l, o, A.slice(0, 180)));
|
|
2959
2960
|
}
|
|
2960
2961
|
for (const I of Pe)
|
|
2961
2962
|
se.push(...me(I, qe));
|
|
2962
|
-
const
|
|
2963
|
-
if (
|
|
2964
|
-
const I =
|
|
2965
|
-
|
|
2963
|
+
const Oe = Ue.flatMap((I) => I.lines);
|
|
2964
|
+
if (Oe.length > 0) {
|
|
2965
|
+
const I = Oe.slice(0, 20);
|
|
2966
|
+
Oe.length > I.length && I.push("… shadow DOM omitted");
|
|
2966
2967
|
const A = P.includes("tooltip") || P.includes("popper") || P.includes("loader");
|
|
2967
2968
|
if (ee < 2 && !A) {
|
|
2968
2969
|
const j = De ? "#shadow-root" : `${P} #shadow-root`;
|
|
@@ -2973,7 +2974,7 @@ function Kn(t, e) {
|
|
|
2973
2974
|
return {
|
|
2974
2975
|
lines: se,
|
|
2975
2976
|
hasUsefulContent: ve,
|
|
2976
|
-
textPreview:
|
|
2977
|
+
textPreview: ut,
|
|
2977
2978
|
containsTextElement: n.has(P) || pe.some((I) => I.containsTextElement)
|
|
2978
2979
|
};
|
|
2979
2980
|
};
|
|
@@ -2992,7 +2993,7 @@ ${JSON.stringify(C)}`), h.length > 0 && m.push(Vn(h, s, l, o));
|
|
|
2992
2993
|
|
|
2993
2994
|
`);
|
|
2994
2995
|
}
|
|
2995
|
-
function
|
|
2996
|
+
function Vt(t, e, s, n) {
|
|
2996
2997
|
const r = t.tagName.toLowerCase();
|
|
2997
2998
|
let i = r;
|
|
2998
2999
|
const o = t.getAttribute("id");
|
|
@@ -3030,7 +3031,7 @@ function Gn() {
|
|
|
3030
3031
|
n = n.shadowRoot.activeElement;
|
|
3031
3032
|
n !== document.body && n !== document.documentElement && s(n, "focused");
|
|
3032
3033
|
const r = window.getSelection();
|
|
3033
|
-
r && !r.isCollapsed && (s(
|
|
3034
|
+
r && !r.isCollapsed && (s(bt(r.anchorNode), "selected text"), s(bt(r.focusNode), "selected text"));
|
|
3034
3035
|
const i = [
|
|
3035
3036
|
["[aria-selected='true']", "selected"],
|
|
3036
3037
|
["[aria-current]:not([aria-current='false'])", "current"],
|
|
@@ -3063,18 +3064,18 @@ function Vn(t, e, s, n) {
|
|
|
3063
3064
|
const h = a.getRootNode();
|
|
3064
3065
|
a = a.parentElement ?? (h instanceof ShadowRoot && h.host instanceof HTMLElement ? h.host : null);
|
|
3065
3066
|
}
|
|
3066
|
-
const l = o.length > 6 ? [o[0], ...o.slice(-5)] : o, c = l.map((d, h) =>
|
|
3067
|
+
const l = o.length > 6 ? [o[0], ...o.slice(-5)] : o, c = l.map((d, h) => Vt(
|
|
3067
3068
|
d,
|
|
3068
3069
|
s,
|
|
3069
3070
|
n,
|
|
3070
|
-
h === l.length - 1 ?
|
|
3071
|
+
h === l.length - 1 ? Xt(d).slice(0, 180) : ""
|
|
3071
3072
|
));
|
|
3072
3073
|
o.length > l.length && c.splice(1, 0, "…"), r.push(`${i.labels.join(", ")}: ${c.join(" > ")}`);
|
|
3073
3074
|
}
|
|
3074
3075
|
return r.join(`
|
|
3075
3076
|
`);
|
|
3076
3077
|
}
|
|
3077
|
-
function
|
|
3078
|
+
function bt(t) {
|
|
3078
3079
|
return t instanceof HTMLElement ? t : t?.parentElement instanceof HTMLElement ? t.parentElement : null;
|
|
3079
3080
|
}
|
|
3080
3081
|
function me(t, e) {
|
|
@@ -3083,7 +3084,7 @@ function me(t, e) {
|
|
|
3083
3084
|
const s = " ".repeat(e);
|
|
3084
3085
|
return t.map((n) => `${s}${n}`);
|
|
3085
3086
|
}
|
|
3086
|
-
function
|
|
3087
|
+
function Xt(t) {
|
|
3087
3088
|
return Q(
|
|
3088
3089
|
Array.from(t.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
|
|
3089
3090
|
);
|
|
@@ -3091,9 +3092,9 @@ function Vt(t) {
|
|
|
3091
3092
|
function Xn(t) {
|
|
3092
3093
|
return t.length <= 64 && /^[A-Za-z_][A-Za-z0-9_:.-]*$/.test(t) && !/[a-f0-9]{12,}/i.test(t) && !/:r[0-9a-z]+:/i.test(t);
|
|
3093
3094
|
}
|
|
3094
|
-
function
|
|
3095
|
-
const t = document.querySelector(
|
|
3096
|
-
if (!(t ?? document.querySelector(
|
|
3095
|
+
function Jt() {
|
|
3096
|
+
const t = document.querySelector(gt);
|
|
3097
|
+
if (!(t ?? document.querySelector(Ge)))
|
|
3097
3098
|
return;
|
|
3098
3099
|
const s = t ? "browser_extension_sdk_preview" : "embedded_widget";
|
|
3099
3100
|
return {
|
|
@@ -3102,7 +3103,7 @@ function Xt() {
|
|
|
3102
3103
|
selectors: [
|
|
3103
3104
|
{
|
|
3104
3105
|
name: "widget_host",
|
|
3105
|
-
selector: s === "browser_extension_sdk_preview" ?
|
|
3106
|
+
selector: s === "browser_extension_sdk_preview" ? gt : Ge,
|
|
3106
3107
|
description: "Finds Pluno's shadow-host element in the host page DOM."
|
|
3107
3108
|
},
|
|
3108
3109
|
{
|
|
@@ -3141,7 +3142,7 @@ function Yn(t) {
|
|
|
3141
3142
|
return null;
|
|
3142
3143
|
}
|
|
3143
3144
|
}
|
|
3144
|
-
function
|
|
3145
|
+
function _t(t, e) {
|
|
3145
3146
|
if (!t || typeof t != "object")
|
|
3146
3147
|
return [];
|
|
3147
3148
|
const s = t[e];
|
|
@@ -3204,9 +3205,9 @@ function rr(t) {
|
|
|
3204
3205
|
avatarUrl: typeof e.avatarUrl == "string" ? e.avatarUrl : null
|
|
3205
3206
|
} : null;
|
|
3206
3207
|
}
|
|
3207
|
-
function
|
|
3208
|
-
return Array.isArray(t) ?
|
|
3209
|
-
t.map((s) =>
|
|
3208
|
+
function Pt(t, e) {
|
|
3209
|
+
return Array.isArray(t) ? Qe(
|
|
3210
|
+
t.map((s) => Yt(s, e)).filter((s) => s !== null)
|
|
3210
3211
|
) : [];
|
|
3211
3212
|
}
|
|
3212
3213
|
function ir(t) {
|
|
@@ -3230,29 +3231,29 @@ function ir(t) {
|
|
|
3230
3231
|
];
|
|
3231
3232
|
}) : [];
|
|
3232
3233
|
}
|
|
3233
|
-
function
|
|
3234
|
+
function Yt(t, e) {
|
|
3234
3235
|
if (!t || typeof t != "object")
|
|
3235
3236
|
return null;
|
|
3236
3237
|
const s = t, n = s.data;
|
|
3237
3238
|
if (!n || typeof n != "object")
|
|
3238
3239
|
return null;
|
|
3239
3240
|
const r = n;
|
|
3240
|
-
if (r.hiddenFromTranscript === !0 ||
|
|
3241
|
+
if (r.hiddenFromTranscript === !0 || Us(r) || r.type === "tab_lifecycle_decision" && r.decision === "keep")
|
|
3241
3242
|
return null;
|
|
3242
3243
|
if (r.type === "message") {
|
|
3243
3244
|
const i = r.role === "assistant" ? "assistant" : r.role === "user" ? "user" : "system", o = {
|
|
3244
3245
|
id: String(s.id ?? crypto.randomUUID()),
|
|
3245
3246
|
role: i,
|
|
3246
3247
|
...r.phase === "commentary" || r.phase === "final_answer" ? { phase: r.phase } : {},
|
|
3247
|
-
content:
|
|
3248
|
+
content: ks(
|
|
3248
3249
|
hr(r.content),
|
|
3249
3250
|
e
|
|
3250
3251
|
),
|
|
3251
3252
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
3252
3253
|
...D(r) !== null ? { causalSequence: D(r) } : {},
|
|
3253
|
-
respondsToUserMessageId:
|
|
3254
|
+
respondsToUserMessageId: L(r) ?? void 0,
|
|
3254
3255
|
...k(r) ? { runId: k(r) } : {},
|
|
3255
|
-
attachments:
|
|
3256
|
+
attachments: as(r.attachments, e)
|
|
3256
3257
|
};
|
|
3257
3258
|
return i === "assistant" && typeof r.id == "string" && Object.defineProperty(o, "assistantDraftItemId", {
|
|
3258
3259
|
value: r.id,
|
|
@@ -3263,31 +3264,31 @@ function Jt(t, e) {
|
|
|
3263
3264
|
}), o;
|
|
3264
3265
|
}
|
|
3265
3266
|
if (r.type === "function_call_output") {
|
|
3266
|
-
const i =
|
|
3267
|
+
const i = bs(r.output);
|
|
3267
3268
|
if (i !== null)
|
|
3268
3269
|
return {
|
|
3269
3270
|
id: String(s.id ?? crypto.randomUUID()),
|
|
3270
3271
|
role: "tool",
|
|
3271
3272
|
content: "",
|
|
3272
3273
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
3273
|
-
respondsToUserMessageId:
|
|
3274
|
+
respondsToUserMessageId: L(r) ?? void 0,
|
|
3274
3275
|
...k(r) ? { runId: k(r) } : {},
|
|
3275
3276
|
dataType: "function_call_output",
|
|
3276
|
-
toolName:
|
|
3277
|
+
toolName: Cs,
|
|
3277
3278
|
callId: ae(r) ?? void 0,
|
|
3278
3279
|
sharePromptAllowed: i
|
|
3279
3280
|
};
|
|
3280
|
-
const o =
|
|
3281
|
+
const o = js(r.output);
|
|
3281
3282
|
if (o)
|
|
3282
3283
|
return {
|
|
3283
3284
|
id: String(s.id ?? crypto.randomUUID()),
|
|
3284
3285
|
role: "tool",
|
|
3285
3286
|
content: "",
|
|
3286
3287
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
3287
|
-
respondsToUserMessageId:
|
|
3288
|
+
respondsToUserMessageId: L(r) ?? void 0,
|
|
3288
3289
|
...k(r) ? { runId: k(r) } : {},
|
|
3289
3290
|
dataType: "scheduled_check_in",
|
|
3290
|
-
toolName:
|
|
3291
|
+
toolName: $t,
|
|
3291
3292
|
callId: ae(r) ?? void 0,
|
|
3292
3293
|
scheduledCheckInAt: o
|
|
3293
3294
|
};
|
|
@@ -3298,7 +3299,7 @@ function Jt(t, e) {
|
|
|
3298
3299
|
content: `Connect ${a.appName} to continue`,
|
|
3299
3300
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
3300
3301
|
...D(r) !== null ? { causalSequence: D(r) } : {},
|
|
3301
|
-
respondsToUserMessageId:
|
|
3302
|
+
respondsToUserMessageId: L(r) ?? void 0,
|
|
3302
3303
|
...k(r) ? { runId: k(r) } : {},
|
|
3303
3304
|
dataType: "function_call_output",
|
|
3304
3305
|
toolName: "authenticate_pipedream_app",
|
|
@@ -3310,7 +3311,7 @@ function Jt(t, e) {
|
|
|
3310
3311
|
content: "Connect WhatsApp to continue",
|
|
3311
3312
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
3312
3313
|
...D(r) !== null ? { causalSequence: D(r) } : {},
|
|
3313
|
-
respondsToUserMessageId:
|
|
3314
|
+
respondsToUserMessageId: L(r) ?? void 0,
|
|
3314
3315
|
...k(r) ? { runId: k(r) } : {},
|
|
3315
3316
|
dataType: "function_call_output",
|
|
3316
3317
|
toolName: "request_personal_channel_connection",
|
|
@@ -3324,7 +3325,7 @@ function Jt(t, e) {
|
|
|
3324
3325
|
content: r.type === "mcp_call" ? or(r) : ur(r),
|
|
3325
3326
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
3326
3327
|
...D(r) !== null ? { causalSequence: D(r) } : {},
|
|
3327
|
-
respondsToUserMessageId:
|
|
3328
|
+
respondsToUserMessageId: L(r) ?? void 0,
|
|
3328
3329
|
...k(r) ? { runId: k(r) } : {},
|
|
3329
3330
|
dataType: String(r.type),
|
|
3330
3331
|
toolName: r.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof r.name == "string" ? r.name : void 0,
|
|
@@ -3336,7 +3337,7 @@ function Jt(t, e) {
|
|
|
3336
3337
|
content: cr(r),
|
|
3337
3338
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
3338
3339
|
...D(r) !== null ? { causalSequence: D(r) } : {},
|
|
3339
|
-
respondsToUserMessageId:
|
|
3340
|
+
respondsToUserMessageId: L(r) ?? void 0,
|
|
3340
3341
|
...k(r) ? { runId: k(r) } : {},
|
|
3341
3342
|
dataType: String(r.type),
|
|
3342
3343
|
loading: r.type === "run_status" && (r.status === "running" || r.status === "retrying"),
|
|
@@ -3445,8 +3446,8 @@ function hr(t) {
|
|
|
3445
3446
|
return typeof s.text == "string" ? s.text : typeof s.content == "string" ? s.content : "";
|
|
3446
3447
|
}).filter(Boolean).join("") : "";
|
|
3447
3448
|
}
|
|
3448
|
-
function
|
|
3449
|
-
const s =
|
|
3449
|
+
function Xe(t, e) {
|
|
3450
|
+
const s = es(t, e), n = Tr(
|
|
3450
3451
|
gr(
|
|
3451
3452
|
Rr(t, e),
|
|
3452
3453
|
s
|
|
@@ -3454,11 +3455,11 @@ function Ve(t, e) {
|
|
|
3454
3455
|
s
|
|
3455
3456
|
), r = n.findIndex((o) => o.id === s.id);
|
|
3456
3457
|
if (r === -1)
|
|
3457
|
-
return
|
|
3458
|
+
return Qe(
|
|
3458
3459
|
[...n, s]
|
|
3459
3460
|
);
|
|
3460
3461
|
const i = [...n];
|
|
3461
|
-
return i[r] = s,
|
|
3462
|
+
return i[r] = s, Qe(i);
|
|
3462
3463
|
}
|
|
3463
3464
|
function gr(t, e) {
|
|
3464
3465
|
const s = e.assistantDraftItemId;
|
|
@@ -3466,7 +3467,7 @@ function gr(t, e) {
|
|
|
3466
3467
|
(n) => n.dataType === "assistant_draft" && n.id === s ? e : n
|
|
3467
3468
|
) : t;
|
|
3468
3469
|
}
|
|
3469
|
-
function
|
|
3470
|
+
function Fe(t, e, s) {
|
|
3470
3471
|
return e !== null ? t.respondsToUserMessageId === e : s !== null && t.runId === s;
|
|
3471
3472
|
}
|
|
3472
3473
|
function fr(t, e, s, n) {
|
|
@@ -3491,7 +3492,7 @@ function mr(t, e) {
|
|
|
3491
3492
|
(r) => !r.id.startsWith("transient-activity:") && r.callId === e.callId
|
|
3492
3493
|
);
|
|
3493
3494
|
if (s === -1)
|
|
3494
|
-
return
|
|
3495
|
+
return Xe(t, e);
|
|
3495
3496
|
const n = [...t];
|
|
3496
3497
|
return n[s] = {
|
|
3497
3498
|
...n[s],
|
|
@@ -3537,20 +3538,20 @@ function Tr(t, e) {
|
|
|
3537
3538
|
const n = (i) => i.id === `transient-activity:${e.callId}` && i.callId === e.callId || s && i.id.startsWith("transient-activity:") && i.toolName === "browser_tabs" && !!i.runId && i.runId === e.runId, r = t.findIndex(n);
|
|
3538
3539
|
return r === -1 ? t : t.flatMap((i, o) => n(i) ? o === r ? [e] : [] : i.id === e.id ? [] : [i]);
|
|
3539
3540
|
}
|
|
3540
|
-
function
|
|
3541
|
-
return
|
|
3541
|
+
function Qt(t, e) {
|
|
3542
|
+
return vs(
|
|
3542
3543
|
t,
|
|
3543
3544
|
e.map(
|
|
3544
|
-
(s) =>
|
|
3545
|
+
(s) => es(t, s)
|
|
3545
3546
|
),
|
|
3546
|
-
|
|
3547
|
+
Zt
|
|
3547
3548
|
);
|
|
3548
3549
|
}
|
|
3549
3550
|
function Sr(t, e) {
|
|
3550
3551
|
const s = new Map(t.map((n) => [n.id, n]));
|
|
3551
3552
|
for (const n of e)
|
|
3552
3553
|
s.set(n.id, n);
|
|
3553
|
-
return
|
|
3554
|
+
return Qt(
|
|
3554
3555
|
t,
|
|
3555
3556
|
[...s.values()]
|
|
3556
3557
|
).sort(wr);
|
|
@@ -3561,7 +3562,7 @@ function wr(t, e) {
|
|
|
3561
3562
|
const n = Date.parse(t.createdAt) - Date.parse(e.createdAt);
|
|
3562
3563
|
return Number.isNaN(n) ? 0 : n;
|
|
3563
3564
|
}
|
|
3564
|
-
function
|
|
3565
|
+
function Zt(t) {
|
|
3565
3566
|
const e = G(t) ?? void 0, s = t.assistantDraftItemId, n = [
|
|
3566
3567
|
...t.callId ? [`call:${t.callId}`] : [],
|
|
3567
3568
|
...t.runId && (t.toolName === "browser_tabs" || t.toolName === "tab_lifecycle") ? [`tab-lifecycle:${t.runId}`] : []
|
|
@@ -3579,11 +3580,11 @@ function Qt(t) {
|
|
|
3579
3580
|
isTransient: t.id.startsWith("transient-activity:") || t.dataType === "assistant_draft"
|
|
3580
3581
|
};
|
|
3581
3582
|
}
|
|
3582
|
-
function
|
|
3583
|
+
function es(t, e) {
|
|
3583
3584
|
if (e.role !== "user" || !e.attachments?.length)
|
|
3584
3585
|
return e;
|
|
3585
3586
|
const s = t.find(
|
|
3586
|
-
(o) => o.role === "user" && (o.id === e.id || be(o) &&
|
|
3587
|
+
(o) => o.role === "user" && (o.id === e.id || be(o) && ts(o, e))
|
|
3587
3588
|
);
|
|
3588
3589
|
if (!s?.attachments?.length)
|
|
3589
3590
|
return e;
|
|
@@ -3607,14 +3608,14 @@ function Rr(t, e) {
|
|
|
3607
3608
|
if (e.role !== "user")
|
|
3608
3609
|
return t;
|
|
3609
3610
|
const s = t.findIndex(
|
|
3610
|
-
(r) => be(r) &&
|
|
3611
|
+
(r) => be(r) && ts(r, e)
|
|
3611
3612
|
);
|
|
3612
3613
|
if (s === -1)
|
|
3613
3614
|
return t;
|
|
3614
3615
|
const n = [...t];
|
|
3615
3616
|
return n.splice(s, 1), n;
|
|
3616
3617
|
}
|
|
3617
|
-
function
|
|
3618
|
+
function ts(t, e) {
|
|
3618
3619
|
const s = G(t), n = G(e);
|
|
3619
3620
|
return s && n ? s === n : t.content === e.content;
|
|
3620
3621
|
}
|
|
@@ -3630,8 +3631,8 @@ function G(t) {
|
|
|
3630
3631
|
);
|
|
3631
3632
|
return n ? t.id.slice(n.length) : null;
|
|
3632
3633
|
}
|
|
3633
|
-
function
|
|
3634
|
-
const e =
|
|
3634
|
+
function Ut(t) {
|
|
3635
|
+
const e = ss(t);
|
|
3635
3636
|
if (e === null)
|
|
3636
3637
|
return !1;
|
|
3637
3638
|
const s = t[e].id;
|
|
@@ -3668,14 +3669,14 @@ function Er(t, e, s) {
|
|
|
3668
3669
|
if (s && r.runId === s) {
|
|
3669
3670
|
if (n.size === 0)
|
|
3670
3671
|
return !0;
|
|
3671
|
-
const o =
|
|
3672
|
+
const o = ns(t, i);
|
|
3672
3673
|
return !r.respondsToUserMessageId && o !== null && n.has(o);
|
|
3673
3674
|
}
|
|
3674
3675
|
return !1;
|
|
3675
3676
|
});
|
|
3676
3677
|
}
|
|
3677
3678
|
function kr(t) {
|
|
3678
|
-
const e =
|
|
3679
|
+
const e = ss(t);
|
|
3679
3680
|
if (e === null)
|
|
3680
3681
|
return t.some(H);
|
|
3681
3682
|
const s = t[e].id;
|
|
@@ -3683,7 +3684,7 @@ function kr(t) {
|
|
|
3683
3684
|
(n) => n.respondsToUserMessageId === s && H(n)
|
|
3684
3685
|
) : t.slice(e + 1).some(H);
|
|
3685
3686
|
}
|
|
3686
|
-
function
|
|
3687
|
+
function ss(t) {
|
|
3687
3688
|
for (let e = t.length - 1; e >= 0; e -= 1)
|
|
3688
3689
|
if (t[e].role === "user" && !be(t[e]))
|
|
3689
3690
|
return e;
|
|
@@ -3725,7 +3726,7 @@ function U(t) {
|
|
|
3725
3726
|
function Ae(t) {
|
|
3726
3727
|
return t?.retryable !== !0 ? !1 : t.type === "run_error" ? !0 : t.type === "run_status" && t.status === "interrupted";
|
|
3727
3728
|
}
|
|
3728
|
-
function
|
|
3729
|
+
function vt(t) {
|
|
3729
3730
|
return t?.type === "run_status" && t.status === "interrupted" && t.reason === "backend_restart";
|
|
3730
3731
|
}
|
|
3731
3732
|
function br(t, e) {
|
|
@@ -3740,7 +3741,7 @@ function br(t, e) {
|
|
|
3740
3741
|
(o) => o.respondsToUserMessageId === r && Me(o)
|
|
3741
3742
|
) : t.slice(i + 1).some(Me);
|
|
3742
3743
|
}
|
|
3743
|
-
function
|
|
3744
|
+
function Je(t) {
|
|
3744
3745
|
const e = Z(t);
|
|
3745
3746
|
if (e === null)
|
|
3746
3747
|
return null;
|
|
@@ -3768,16 +3769,16 @@ function _r(t) {
|
|
|
3768
3769
|
if (i.type === "message" && i.role === "assistant")
|
|
3769
3770
|
return null;
|
|
3770
3771
|
if (i.type === "run_error")
|
|
3771
|
-
return i.retryable !== !0 ? null :
|
|
3772
|
+
return i.retryable !== !0 ? null : Ye(t, i) ?? Je(t);
|
|
3772
3773
|
if (i.type === "run_status")
|
|
3773
|
-
return i.status === "interrupted" && i.retryable === !0 ?
|
|
3774
|
+
return i.status === "interrupted" && i.retryable === !0 ? Ye(t, i) ?? Je(t) : null;
|
|
3774
3775
|
}
|
|
3775
3776
|
return null;
|
|
3776
3777
|
}
|
|
3777
|
-
function
|
|
3778
|
+
function Ye(t, e) {
|
|
3778
3779
|
if (typeof e.clientMessageId == "string")
|
|
3779
3780
|
return e.clientMessageId;
|
|
3780
|
-
const s =
|
|
3781
|
+
const s = L(e);
|
|
3781
3782
|
if (!s)
|
|
3782
3783
|
return null;
|
|
3783
3784
|
const n = t.find((i) => M(i, "id") === s), r = U(n);
|
|
@@ -3796,13 +3797,13 @@ function Pr(t, e) {
|
|
|
3796
3797
|
}
|
|
3797
3798
|
return s;
|
|
3798
3799
|
}
|
|
3799
|
-
function
|
|
3800
|
+
function Dt(t, e, s, n, r, i) {
|
|
3800
3801
|
if (!e || !vr(t))
|
|
3801
3802
|
return !1;
|
|
3802
3803
|
const o = t;
|
|
3803
3804
|
if (Ae(o) || s !== null && typeof o.id == "string" && o.id !== s)
|
|
3804
3805
|
return !1;
|
|
3805
|
-
const a =
|
|
3806
|
+
const a = L(o);
|
|
3806
3807
|
return n !== null ? a !== null ? a === n : r !== null && k(o) === r && i === n : r === null || k(o) === r;
|
|
3807
3808
|
}
|
|
3808
3809
|
function Ur(t, e) {
|
|
@@ -3813,7 +3814,7 @@ function Ur(t, e) {
|
|
|
3813
3814
|
}
|
|
3814
3815
|
return null;
|
|
3815
3816
|
}
|
|
3816
|
-
function
|
|
3817
|
+
function ns(t, e) {
|
|
3817
3818
|
for (let s = e - 1; s >= 0; s -= 1)
|
|
3818
3819
|
if (t[s].role === "user")
|
|
3819
3820
|
return t[s].id;
|
|
@@ -3834,8 +3835,8 @@ function Dr(t) {
|
|
|
3834
3835
|
const e = t;
|
|
3835
3836
|
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";
|
|
3836
3837
|
}
|
|
3837
|
-
function
|
|
3838
|
-
return t.filter((e, s) => V(e) ? !Fr(t, s) && !
|
|
3838
|
+
function Qe(t) {
|
|
3839
|
+
return t.filter((e, s) => V(e) ? !Fr(t, s) && !rs(t, s) && !$r(t, s) && !jr(t, s) : qr(e) ? e.retryable === !0 && Hr(t, s) ? !1 : !Wr(t, s) : !0);
|
|
3839
3840
|
}
|
|
3840
3841
|
function qr(t) {
|
|
3841
3842
|
return t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.steered !== !0);
|
|
@@ -3843,9 +3844,9 @@ function qr(t) {
|
|
|
3843
3844
|
function V(t) {
|
|
3844
3845
|
return t.role === "system" && t.dataType === "run_status" && t.loading === !0;
|
|
3845
3846
|
}
|
|
3846
|
-
function
|
|
3847
|
+
function Or(t, e, s, n) {
|
|
3847
3848
|
const r = t.findIndex(
|
|
3848
|
-
(l, c) => V(l) && !
|
|
3849
|
+
(l, c) => V(l) && !rs(t, c)
|
|
3849
3850
|
), i = r === -1 ? null : t[r], o = e ?? i?.respondsToUserMessageId ?? null, a = o ? t.find(
|
|
3850
3851
|
(l) => l.role === "user" && l.id === o
|
|
3851
3852
|
) : null;
|
|
@@ -3858,10 +3859,10 @@ function Lr(t, e, s, n) {
|
|
|
3858
3859
|
function Se(t) {
|
|
3859
3860
|
return t?.type === "run_status" && t.status === "stopped";
|
|
3860
3861
|
}
|
|
3861
|
-
function
|
|
3862
|
+
function Lr(t, e) {
|
|
3862
3863
|
return H(e) ? "completed" : Se(t) ? "stopped" : !Ae(t) && (t?.type === "run_error" || t?.type === "run_status" && (t.status === "failed" || t.status === "interrupted")) ? "failed" : null;
|
|
3863
3864
|
}
|
|
3864
|
-
function
|
|
3865
|
+
function qt(t, e, s) {
|
|
3865
3866
|
const n = new Set(
|
|
3866
3867
|
t.filter(
|
|
3867
3868
|
(r) => r.role === "user" && e !== null && G(r) === e
|
|
@@ -3871,7 +3872,7 @@ function Dt(t, e, s) {
|
|
|
3871
3872
|
(r) => !V(r) || (n.size > 0 ? !r.respondsToUserMessageId || !n.has(r.respondsToUserMessageId) : !s || r.runId !== s)
|
|
3872
3873
|
);
|
|
3873
3874
|
}
|
|
3874
|
-
function
|
|
3875
|
+
function rs(t, e) {
|
|
3875
3876
|
return t.some(
|
|
3876
3877
|
(s, n) => n !== e && s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.loading !== !0 && s.steered !== !0) && Nr(
|
|
3877
3878
|
t,
|
|
@@ -3893,16 +3894,16 @@ function Nr(t, e, s) {
|
|
|
3893
3894
|
}
|
|
3894
3895
|
function xr(t, e) {
|
|
3895
3896
|
const s = [...t].reverse().find(
|
|
3896
|
-
(n) => n.respondsToUserMessageId !== void 0 && n.respondsToUserMessageId !== e &&
|
|
3897
|
+
(n) => n.respondsToUserMessageId !== void 0 && n.respondsToUserMessageId !== e && Ot(n) && !Br(
|
|
3897
3898
|
t,
|
|
3898
3899
|
n.respondsToUserMessageId
|
|
3899
3900
|
)
|
|
3900
3901
|
)?.respondsToUserMessageId;
|
|
3901
3902
|
return s ? t.map(
|
|
3902
|
-
(n) => n.respondsToUserMessageId === s &&
|
|
3903
|
+
(n) => n.respondsToUserMessageId === s && Ot(n) ? { ...n, steered: !0 } : n
|
|
3903
3904
|
) : t;
|
|
3904
3905
|
}
|
|
3905
|
-
function
|
|
3906
|
+
function Ot(t) {
|
|
3906
3907
|
return t.role === "tool" || V(t) ? !0 : t.role === "assistant" && t.phase === "commentary";
|
|
3907
3908
|
}
|
|
3908
3909
|
function Br(t, e) {
|
|
@@ -3959,7 +3960,7 @@ function M(t, e) {
|
|
|
3959
3960
|
}
|
|
3960
3961
|
function zr(t, e) {
|
|
3961
3962
|
try {
|
|
3962
|
-
const s = window.localStorage.getItem(`${
|
|
3963
|
+
const s = window.localStorage.getItem(`${zt}${t}`);
|
|
3963
3964
|
if (!s)
|
|
3964
3965
|
return null;
|
|
3965
3966
|
const n = JSON.parse(s), r = typeof n.sessionId == "string" ? n.sessionId : null;
|
|
@@ -3974,16 +3975,16 @@ function zr(t, e) {
|
|
|
3974
3975
|
return null;
|
|
3975
3976
|
}
|
|
3976
3977
|
}
|
|
3977
|
-
function
|
|
3978
|
+
function is(t) {
|
|
3978
3979
|
return t.role === "user" || t.role === "assistant" || t.dataType === "run_status" || t.dataType === "run_error";
|
|
3979
3980
|
}
|
|
3980
3981
|
function Kr(t, e) {
|
|
3981
3982
|
try {
|
|
3982
3983
|
window.localStorage.setItem(
|
|
3983
|
-
`${
|
|
3984
|
+
`${zt}${t}`,
|
|
3984
3985
|
JSON.stringify({
|
|
3985
3986
|
sessionId: e.sessionId,
|
|
3986
|
-
messages: e.messages.filter(
|
|
3987
|
+
messages: e.messages.filter(is).slice(-mn).map(ni)
|
|
3987
3988
|
})
|
|
3988
3989
|
);
|
|
3989
3990
|
} catch {
|
|
@@ -3992,31 +3993,31 @@ function Kr(t, e) {
|
|
|
3992
3993
|
}
|
|
3993
3994
|
function Gr(t) {
|
|
3994
3995
|
try {
|
|
3995
|
-
const e = window.localStorage.getItem(`${
|
|
3996
|
+
const e = window.localStorage.getItem(`${Ve}${t}`);
|
|
3996
3997
|
if (!e)
|
|
3997
3998
|
return [];
|
|
3998
3999
|
const s = JSON.parse(e);
|
|
3999
|
-
return Array.isArray(s) ? s.filter(
|
|
4000
|
+
return Array.isArray(s) ? s.filter(ot) : [];
|
|
4000
4001
|
} catch {
|
|
4001
4002
|
return [];
|
|
4002
4003
|
}
|
|
4003
4004
|
}
|
|
4004
4005
|
function K(t, e) {
|
|
4005
4006
|
try {
|
|
4006
|
-
const s = e.filter(
|
|
4007
|
+
const s = e.filter(ot);
|
|
4007
4008
|
if (s.length === 0) {
|
|
4008
|
-
window.localStorage.removeItem(`${
|
|
4009
|
+
window.localStorage.removeItem(`${Ve}${t}`);
|
|
4009
4010
|
return;
|
|
4010
4011
|
}
|
|
4011
4012
|
window.localStorage.setItem(
|
|
4012
|
-
`${
|
|
4013
|
+
`${Ve}${t}`,
|
|
4013
4014
|
JSON.stringify(s.slice(-25))
|
|
4014
4015
|
);
|
|
4015
4016
|
} catch {
|
|
4016
4017
|
return;
|
|
4017
4018
|
}
|
|
4018
4019
|
}
|
|
4019
|
-
function
|
|
4020
|
+
function os(t, e) {
|
|
4020
4021
|
try {
|
|
4021
4022
|
const s = `${Ce}${t}`, n = location.href, r = location.origin, i = Array.from(e, (o) => ({
|
|
4022
4023
|
...o,
|
|
@@ -4039,7 +4040,7 @@ function Lt(t, e) {
|
|
|
4039
4040
|
} catch {
|
|
4040
4041
|
return;
|
|
4041
4042
|
}
|
|
4042
|
-
|
|
4043
|
+
os(t, e);
|
|
4043
4044
|
}
|
|
4044
4045
|
function Vr(t) {
|
|
4045
4046
|
try {
|
|
@@ -4078,7 +4079,7 @@ function Jr(t) {
|
|
|
4078
4079
|
if (!t || typeof t != "object")
|
|
4079
4080
|
return !1;
|
|
4080
4081
|
const e = t, s = e.event;
|
|
4081
|
-
return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" &&
|
|
4082
|
+
return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" && ot(s) && s.type === "tool.result";
|
|
4082
4083
|
}
|
|
4083
4084
|
function Yr(t, e) {
|
|
4084
4085
|
const s = new Set(
|
|
@@ -4096,19 +4097,19 @@ function Qr(t) {
|
|
|
4096
4097
|
return;
|
|
4097
4098
|
}
|
|
4098
4099
|
}
|
|
4099
|
-
function
|
|
4100
|
+
function ot(t) {
|
|
4100
4101
|
if (!t || typeof t != "object")
|
|
4101
4102
|
return !1;
|
|
4102
4103
|
const e = t;
|
|
4103
|
-
return e.type === "chat.user_message" ? typeof e.content == "string" &&
|
|
4104
|
+
return e.type === "chat.user_message" ? typeof e.content == "string" && Nt(e.page) : e.type === "page.upsert" || e.type === "session.reset" || e.type === "network.batch" ? Nt(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;
|
|
4104
4105
|
}
|
|
4105
|
-
function
|
|
4106
|
+
function Nt(t) {
|
|
4106
4107
|
if (!t || typeof t != "object")
|
|
4107
4108
|
return !1;
|
|
4108
4109
|
const e = t;
|
|
4109
4110
|
return typeof e.url == "string" && typeof e.title == "string" && typeof e.origin == "string";
|
|
4110
4111
|
}
|
|
4111
|
-
function
|
|
4112
|
+
function as(t, e) {
|
|
4112
4113
|
if (!Array.isArray(t))
|
|
4113
4114
|
return;
|
|
4114
4115
|
const s = t.filter((r) => {
|
|
@@ -4116,30 +4117,30 @@ function os(t, e) {
|
|
|
4116
4117
|
return !1;
|
|
4117
4118
|
const i = r;
|
|
4118
4119
|
return typeof i.name == "string" && typeof i.mimeType == "string" && typeof i.sizeBytes == "number";
|
|
4119
|
-
}), n = e ? s.map((r) =>
|
|
4120
|
+
}), n = e ? s.map((r) => ls(r, e)) : s;
|
|
4120
4121
|
return n.length > 0 ? n : void 0;
|
|
4121
4122
|
}
|
|
4122
|
-
function
|
|
4123
|
+
function ls(t, e) {
|
|
4123
4124
|
return t.fileUrl?.startsWith("/") ? {
|
|
4124
4125
|
...t,
|
|
4125
4126
|
fileUrl: new URL(t.fileUrl, e).toString()
|
|
4126
4127
|
} : t;
|
|
4127
4128
|
}
|
|
4128
|
-
function
|
|
4129
|
+
function Ze(t) {
|
|
4129
4130
|
return t.type || ti(t.name) || "application/octet-stream";
|
|
4130
4131
|
}
|
|
4131
4132
|
function Zr(t) {
|
|
4132
|
-
|
|
4133
|
+
cs({
|
|
4133
4134
|
name: t.name,
|
|
4134
|
-
mimeType:
|
|
4135
|
+
mimeType: Ze(t),
|
|
4135
4136
|
sizeBytes: t.size
|
|
4136
4137
|
});
|
|
4137
4138
|
}
|
|
4138
|
-
function
|
|
4139
|
+
function cs(t) {
|
|
4139
4140
|
const e = ei(t.name), s = t.mimeType.trim().toLowerCase();
|
|
4140
4141
|
if (!hn.has(`${e}:${s}`))
|
|
4141
4142
|
throw new Error("This attachment type is not supported by the embedded model provider");
|
|
4142
|
-
if (t.sizeBytes <= 0 || t.sizeBytes >=
|
|
4143
|
+
if (t.sizeBytes <= 0 || t.sizeBytes >= jt)
|
|
4143
4144
|
throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
|
|
4144
4145
|
}
|
|
4145
4146
|
function ei(t) {
|
|
@@ -4167,7 +4168,7 @@ function si(t) {
|
|
|
4167
4168
|
dataType: typeof e.dataType == "string" ? e.dataType : void 0,
|
|
4168
4169
|
scheduledCheckInAt: typeof e.scheduledCheckInAt == "string" ? e.scheduledCheckInAt : void 0,
|
|
4169
4170
|
securitySettingsUrl: typeof e.securitySettingsUrl == "string" ? e.securitySettingsUrl : void 0,
|
|
4170
|
-
attachments:
|
|
4171
|
+
attachments: as(e.attachments)?.map(Re),
|
|
4171
4172
|
loading: typeof e.loading == "boolean" ? e.loading : void 0
|
|
4172
4173
|
};
|
|
4173
4174
|
}
|
|
@@ -4187,7 +4188,7 @@ function Re(t) {
|
|
|
4187
4188
|
} = t;
|
|
4188
4189
|
return i;
|
|
4189
4190
|
}
|
|
4190
|
-
function
|
|
4191
|
+
function L(t) {
|
|
4191
4192
|
const e = t.respondsToUserMessageId;
|
|
4192
4193
|
return typeof e == "string" && e ? e : null;
|
|
4193
4194
|
}
|
|
@@ -4199,25 +4200,25 @@ function ri(t) {
|
|
|
4199
4200
|
const e = t?.timeoutMs;
|
|
4200
4201
|
return !!t && typeof t == "object" && typeof t.summary == "string" && typeof t.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <= Rn);
|
|
4201
4202
|
}
|
|
4202
|
-
function
|
|
4203
|
+
function us(t) {
|
|
4203
4204
|
const e = {};
|
|
4204
4205
|
try {
|
|
4205
4206
|
new Headers(t).forEach((s, n) => {
|
|
4206
|
-
Object.keys(e).length <
|
|
4207
|
+
Object.keys(e).length < rt && (e[n] = at(n, s));
|
|
4207
4208
|
});
|
|
4208
4209
|
} catch {
|
|
4209
4210
|
return {};
|
|
4210
4211
|
}
|
|
4211
4212
|
return e;
|
|
4212
4213
|
}
|
|
4213
|
-
function
|
|
4214
|
-
return
|
|
4214
|
+
function at(t, e) {
|
|
4215
|
+
return ms(t) ? _e : W(ke(e), gn);
|
|
4215
4216
|
}
|
|
4216
4217
|
function ii(t, e) {
|
|
4217
4218
|
return typeof t == "string" ? t : t instanceof URL ? t.toString() : e?.url ?? "";
|
|
4218
4219
|
}
|
|
4219
4220
|
async function oi(t, e, s, n) {
|
|
4220
|
-
const r =
|
|
4221
|
+
const r = us(t.headers);
|
|
4221
4222
|
n({
|
|
4222
4223
|
...e,
|
|
4223
4224
|
responseStatus: t.status,
|
|
@@ -4227,7 +4228,7 @@ async function oi(t, e, s, n) {
|
|
|
4227
4228
|
});
|
|
4228
4229
|
}
|
|
4229
4230
|
async function ai(t) {
|
|
4230
|
-
if (!
|
|
4231
|
+
if (!ds(t.headers))
|
|
4231
4232
|
return;
|
|
4232
4233
|
let e = null, s = null;
|
|
4233
4234
|
try {
|
|
@@ -4246,7 +4247,7 @@ async function ai(t) {
|
|
|
4246
4247
|
const { done: l, value: c } = a;
|
|
4247
4248
|
if (l)
|
|
4248
4249
|
return W(i + r.decode());
|
|
4249
|
-
const d =
|
|
4250
|
+
const d = nt - o;
|
|
4250
4251
|
if (c.byteLength > d)
|
|
4251
4252
|
return i += r.decode(c.subarray(0, Math.max(d, 0)), { stream: !0 }), e.cancel(), `${W(i)}... [truncated]`;
|
|
4252
4253
|
o += c.byteLength, i += r.decode(c, { stream: !0 });
|
|
@@ -4259,41 +4260,41 @@ async function ai(t) {
|
|
|
4259
4260
|
}
|
|
4260
4261
|
}
|
|
4261
4262
|
function li(t, e) {
|
|
4262
|
-
if (
|
|
4263
|
+
if (ds(new Headers(e)))
|
|
4263
4264
|
try {
|
|
4264
4265
|
return t.responseType === "" || t.responseType === "text" ? W(t.responseText ?? "") : void 0;
|
|
4265
4266
|
} catch {
|
|
4266
4267
|
return;
|
|
4267
4268
|
}
|
|
4268
4269
|
}
|
|
4269
|
-
function
|
|
4270
|
+
function xt(t) {
|
|
4270
4271
|
if (typeof t == "string")
|
|
4271
4272
|
return W(t);
|
|
4272
4273
|
}
|
|
4273
4274
|
function ci(t) {
|
|
4274
|
-
return
|
|
4275
|
+
return O({
|
|
4275
4276
|
...t,
|
|
4276
|
-
requestBody:
|
|
4277
|
-
responseBody:
|
|
4277
|
+
requestBody: Bt(t.requestBody),
|
|
4278
|
+
responseBody: Bt(t.responseBody)
|
|
4278
4279
|
});
|
|
4279
4280
|
}
|
|
4280
|
-
function
|
|
4281
|
+
function Bt(t) {
|
|
4281
4282
|
if (typeof t != "string")
|
|
4282
4283
|
return t;
|
|
4283
4284
|
const e = t.trim();
|
|
4284
4285
|
if (!e.startsWith("{") && !e.startsWith("["))
|
|
4285
4286
|
return ke(t);
|
|
4286
4287
|
try {
|
|
4287
|
-
return JSON.stringify(
|
|
4288
|
+
return JSON.stringify(O(JSON.parse(t)));
|
|
4288
4289
|
} catch {
|
|
4289
4290
|
return ke(t);
|
|
4290
4291
|
}
|
|
4291
4292
|
}
|
|
4292
|
-
function
|
|
4293
|
+
function ds(t) {
|
|
4293
4294
|
if (!t)
|
|
4294
4295
|
return !1;
|
|
4295
4296
|
const e = t.get("content-type")?.toLowerCase() ?? "", s = t.get("content-length"), n = Number(s);
|
|
4296
|
-
return s !== null && Number.isInteger(n) && n >= 0 && n <=
|
|
4297
|
+
return s !== null && Number.isInteger(n) && n >= 0 && n <= nt && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
|
|
4297
4298
|
}
|
|
4298
4299
|
function J(t, e = {}, s) {
|
|
4299
4300
|
if (di(s))
|
|
@@ -4330,17 +4331,17 @@ function pi(t) {
|
|
|
4330
4331
|
const n = s.indexOf(":");
|
|
4331
4332
|
if (n <= 0)
|
|
4332
4333
|
continue;
|
|
4333
|
-
if (Object.keys(e).length >=
|
|
4334
|
+
if (Object.keys(e).length >= rt)
|
|
4334
4335
|
break;
|
|
4335
4336
|
const r = s.slice(0, n).trim();
|
|
4336
|
-
e[r] =
|
|
4337
|
+
e[r] = at(r, s.slice(n + 1).trim());
|
|
4337
4338
|
}
|
|
4338
4339
|
return e;
|
|
4339
4340
|
}
|
|
4340
|
-
function W(t, e =
|
|
4341
|
+
function W(t, e = nt) {
|
|
4341
4342
|
return t.length <= e ? t : `${t.slice(0, e)}... [truncated ${t.length - e} chars]`;
|
|
4342
4343
|
}
|
|
4343
|
-
function
|
|
4344
|
+
function ze(t) {
|
|
4344
4345
|
return `${t}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
4345
4346
|
}
|
|
4346
4347
|
class we extends Error {
|
|
@@ -4351,11 +4352,11 @@ class we extends Error {
|
|
|
4351
4352
|
}
|
|
4352
4353
|
async function ye(t, e) {
|
|
4353
4354
|
let s = null;
|
|
4354
|
-
for (let n = 0; n <
|
|
4355
|
+
for (let n = 0; n < Rt; n += 1)
|
|
4355
4356
|
try {
|
|
4356
4357
|
return await t();
|
|
4357
4358
|
} catch (r) {
|
|
4358
|
-
if (s = r, n >=
|
|
4359
|
+
if (s = r, n >= Rt - 1 || !gi(r))
|
|
4359
4360
|
throw r;
|
|
4360
4361
|
await hi(n);
|
|
4361
4362
|
}
|
|
@@ -4375,8 +4376,8 @@ function fi(t) {
|
|
|
4375
4376
|
function mi(t) {
|
|
4376
4377
|
return t === 401 || t === 403;
|
|
4377
4378
|
}
|
|
4378
|
-
const _e = "[REDACTED_SECRET]", $ = "[REDACTED_TOKEN]", yi = "[REDACTED_SIGNED_URL]", Ii = 20, Ti = /^(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,
|
|
4379
|
-
function
|
|
4379
|
+
const _e = "[REDACTED_SECRET]", $ = "[REDACTED_TOKEN]", yi = "[REDACTED_SIGNED_URL]", Ii = 20, Ti = /^(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, ps = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, hs = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, gs = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, fs = /\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, Si = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, wi = /\bhttps?:\/\/[^\s"'<>]+/gi, Mi = /[),.;\]]+$/;
|
|
4380
|
+
function O(t) {
|
|
4380
4381
|
return Ee(t, 0, /* @__PURE__ */ new WeakSet());
|
|
4381
4382
|
}
|
|
4382
4383
|
function Ee(t, e, s) {
|
|
@@ -4392,17 +4393,17 @@ function Ee(t, e, s) {
|
|
|
4392
4393
|
return t.map((r) => Ee(r, e + 1, s));
|
|
4393
4394
|
const n = {};
|
|
4394
4395
|
for (const [r, i] of Object.entries(t))
|
|
4395
|
-
r === "pageContent" ? n[r] = i :
|
|
4396
|
+
r === "pageContent" ? n[r] = i : ms(r) ? n[r] = _e : n[r] = r.toLowerCase() === "url" ? Ai(i) : Ee(i, e + 1, s);
|
|
4396
4397
|
return n;
|
|
4397
4398
|
}
|
|
4398
|
-
function
|
|
4399
|
+
function ms(t) {
|
|
4399
4400
|
const e = t.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
4400
4401
|
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");
|
|
4401
4402
|
}
|
|
4402
4403
|
function Ai(t) {
|
|
4403
|
-
return typeof t == "string" ?
|
|
4404
|
+
return typeof t == "string" ? ys(t) : Ee(t, 0, /* @__PURE__ */ new WeakSet());
|
|
4404
4405
|
}
|
|
4405
|
-
function
|
|
4406
|
+
function ys(t) {
|
|
4406
4407
|
try {
|
|
4407
4408
|
const e = new URL(t, location.href);
|
|
4408
4409
|
for (const s of Array.from(e.searchParams.keys()))
|
|
@@ -4413,25 +4414,25 @@ function ms(t) {
|
|
|
4413
4414
|
}
|
|
4414
4415
|
}
|
|
4415
4416
|
function ke(t) {
|
|
4416
|
-
return t.replace(Si, yi).replace(wi, Ei).replace(
|
|
4417
|
+
return t.replace(Si, yi).replace(wi, Ei).replace(ps, `Bearer ${$}`).replace(hs, `Basic ${$}`).replace(gs, $).replace(fs, (e, s) => `${s}: ${_e}`);
|
|
4417
4418
|
}
|
|
4418
4419
|
function Ri(t) {
|
|
4419
|
-
return t.replace(
|
|
4420
|
+
return t.replace(ps, `Bearer ${$}`).replace(hs, `Basic ${$}`).replace(gs, $).replace(fs, (e, s) => `${s}: ${_e}`);
|
|
4420
4421
|
}
|
|
4421
4422
|
function Ei(t) {
|
|
4422
4423
|
const e = t.match(Mi)?.[0] ?? "", s = e ? t.slice(0, -e.length) : t;
|
|
4423
|
-
return `${
|
|
4424
|
+
return `${ys(s)}${e}`;
|
|
4424
4425
|
}
|
|
4425
4426
|
export {
|
|
4426
|
-
|
|
4427
|
-
|
|
4427
|
+
gt as PLUNO_PRODUCT_AGENT_SDK_PREVIEW_HOST_SELECTOR,
|
|
4428
|
+
Ge as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
|
|
4428
4429
|
Xs as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
|
|
4429
4430
|
Vs as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
|
|
4430
4431
|
Js as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
|
|
4431
4432
|
ki as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
|
|
4432
|
-
|
|
4433
|
+
Kt as PlunoProductAgent,
|
|
4433
4434
|
In as calculateReconnectDelay,
|
|
4434
|
-
|
|
4435
|
+
Kt as default,
|
|
4435
4436
|
Wn as getProductAgentOriginAccessErrorMessage,
|
|
4436
4437
|
Zr as validateProductAgentProviderInputFile
|
|
4437
4438
|
};
|