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