@pluno/product-agent-web 0.1.207 → 0.1.209

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,13 @@
1
- const zs = "pluno-product-agent-attachments";
2
- const it = "files";
3
- async function Ks(s) {
1
+ function hs(s) {
2
+ const e = s.replace(/\n\s*at\s[\s\S]*$/, "").replace(/-----BEGIN [^-]*PRIVATE KEY-----[\s\S]*?(?:-----END [^-]*PRIVATE KEY-----|$)/g, "[REDACTED]").replace(/\b(?:set-cookie|cookie)\s*[:=]\s*[^\n]+/gi, "cookie=[REDACTED]").replace(/\bdata:[^\s<>"']+/gi, "[DATA]").replace(/\b(?:https?:\/\/|www\.)[^\s<>"']+/gi, "[URL]").replace(/\b(?:Bearer|Basic)\s+[^\s,;"']+/gi, "[REDACTED]").replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?/g, "[REDACTED]").replace(/\b(?:sk|pk|ghp|gho|github_pat|xoxb|xoxp)[-_][A-Za-z0-9_-]{8,}/g, "[REDACTED]").replace(/\b((?:access|refresh|id|auth)[_-]?token|api[_-]?key|client[_-]?secret|password|passwd|pwd|secret|token|jwt|authorization|cookie|set-cookie)\b["']?\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s,;}&]+)/gi, "$1=[REDACTED]").replace(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/gi, "[EMAIL]").replace(/(?:[A-Z]:[\\/]|\\\\|(?:~|\.\.?)?\/|[\w.-]+[\\/])[^\s<>"']+/gi, "[FILE]").replace(new RegExp("(?<![\\w.])(?:[\\w.-]+\\.[A-Z][A-Z0-9]{0,15}|\\.[A-Z][\\w.-]*)\\b", "gi"), "[FILE]").replace(/\s+/g, " ").trim();
3
+ return e.length > 500 ? `${e.slice(0, 499)}…` : e;
4
+ }
5
+ const Ks = "pluno-product-agent-attachments", Gs = 1, it = "files", Qs = 1440 * 60 * 1e3;
6
+ async function Vs(s) {
4
7
  const e = await mt();
5
- await Vs(e, "readwrite", (t) => t.put(s));
8
+ await Ys(e, "readwrite", (t) => t.put(s));
6
9
  }
7
- async function Gs(s, e) {
10
+ async function Xs(s, e) {
8
11
  const t = await mt();
9
12
  await yt(t, "readwrite", async (n) => {
10
13
  const i = await It(
@@ -16,7 +19,7 @@ async function Gs(s, e) {
16
19
  });
17
20
  });
18
21
  }
19
- async function Qs(s = 864e5) {
22
+ async function Js(s = Qs) {
20
23
  const e = await mt(), t = Date.now() - s;
21
24
  await yt(e, "readwrite", async (n) => {
22
25
  const i = n.index("lastUsedAt");
@@ -25,14 +28,14 @@ async function Qs(s = 864e5) {
25
28
  }
26
29
  function mt() {
27
30
  return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((s, e) => {
28
- const t = indexedDB.open(zs, 1);
31
+ const t = indexedDB.open(Ks, Gs);
29
32
  t.onupgradeneeded = () => {
30
33
  const i = t.result.createObjectStore(it, { keyPath: "attachmentId" });
31
34
  i.createIndex("lastUsedAt", "lastUsedAt", { unique: !1 }), i.createIndex("sessionId", "sessionId", { unique: !1 }), i.createIndex("origin", "origin", { unique: !1 });
32
35
  }, t.onsuccess = () => s(t.result), t.onerror = () => e(t.error ?? new Error("Failed to open Product Agent attachment storage"));
33
36
  });
34
37
  }
35
- async function Vs(s, e, t) {
38
+ async function Ys(s, e, t) {
36
39
  return await yt(s, e, async (n) => await It(t(n)));
37
40
  }
38
41
  function yt(s, e, t) {
@@ -62,11 +65,11 @@ function It(s) {
62
65
  s.onsuccess = () => e(s.result), s.onerror = () => t(s.error ?? new Error("Product Agent attachment storage request failed"));
63
66
  });
64
67
  }
65
- function Js(s) {
68
+ function Zs(s) {
66
69
  return s !== null && (typeof s == "object" || typeof s == "function");
67
70
  }
68
- function hs(s, e, t) {
69
- const n = Reflect.get(s, "pluno"), i = Js(n) ? n : {};
71
+ function ps(s, e, t) {
72
+ const n = Reflect.get(s, "pluno"), i = Zs(n) ? n : {};
70
73
  if (i !== n && !Reflect.set(s, "pluno", i))
71
74
  return null;
72
75
  const r = Object.getOwnPropertyDescriptor(i, e);
@@ -80,20 +83,20 @@ function hs(s, e, t) {
80
83
  }
81
84
  };
82
85
  }
83
- const Xs = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
86
+ const en = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
84
87
  function vt(s, e) {
85
88
  return e ? s.replace(
86
- Xs,
89
+ en,
87
90
  (t, n, i, r) => `${n}${new URL(i, e).toString()}${r}`
88
91
  ) : s;
89
92
  }
90
93
  const St = "suggest_share_on_socials";
91
- function Ys(s) {
94
+ function tn(s) {
92
95
  for (let e = s.length - 1; e >= 0; e -= 1) {
93
96
  const t = s[e];
94
97
  if (t.role !== "tool" || t.toolName !== St || t.sharePromptAllowed !== void 0)
95
98
  continue;
96
- if (en(s, e, t.callId) !== !0)
99
+ if (nn(s, e, t.callId) !== !0)
97
100
  return null;
98
101
  const n = Ut(s, e, "assistant");
99
102
  if (!n)
@@ -107,7 +110,7 @@ function Ys(s) {
107
110
  }
108
111
  return null;
109
112
  }
110
- function Zs(s) {
113
+ function sn(s) {
111
114
  let e = s;
112
115
  if (typeof s == "string")
113
116
  try {
@@ -115,10 +118,10 @@ function Zs(s) {
115
118
  } catch {
116
119
  return null;
117
120
  }
118
- const t = tn(e);
121
+ const t = rn(e);
119
122
  return t ? typeof t.showSharePrompt == "boolean" ? t.showSharePrompt : t.ok === !0 && typeof t.message == "string" && t.message.includes("social-sharing prompt") ? !0 : null : null;
120
123
  }
121
- function en(s, e, t) {
124
+ function nn(s, e, t) {
122
125
  if (!t)
123
126
  return null;
124
127
  for (let n = e + 1; n < s.length; n += 1) {
@@ -136,14 +139,14 @@ function Ut(s, e, t) {
136
139
  }
137
140
  return null;
138
141
  }
139
- function tn(s) {
142
+ function rn(s) {
140
143
  return s && typeof s == "object" && !Array.isArray(s) ? s : null;
141
144
  }
142
- const sn = "save_runtime_captured_skill";
143
- function nn(s) {
144
- return (s.type === "function_call" || s.type === "tool_call") && s.name === sn;
145
+ const on = "save_runtime_captured_skill";
146
+ function an(s) {
147
+ return (s.type === "function_call" || s.type === "tool_call") && s.name === on;
145
148
  }
146
- function rn(s, e, t) {
149
+ function ln(s, e, t) {
147
150
  const n = e.map((h) => ({ item: h, identity: t(h) })), i = new Set(
148
151
  n.flatMap(
149
152
  ({ identity: h }) => h.isActivity && !h.isTransient ? h.activityKeys ?? [] : []
@@ -187,10 +190,10 @@ function Dt(s, e, t, n) {
187
190
  return !r.isActivity || !r.isTransient ? !0 : e !== null && r.respondsToUserMessageId !== void 0 ? r.respondsToUserMessageId !== e : t === null || r.runId !== t;
188
191
  });
189
192
  }
190
- const Ke = "pluno.productAgent.transportId", on = "pluno.productAgent.transportIdentity", Ge = "pluno.productAgent.transportIdentity.event", an = 50, ln = globalThis.setTimeout.bind(globalThis);
193
+ const Ke = "pluno.productAgent.transportId", cn = "pluno.productAgent.transportIdentity", Ge = "pluno.productAgent.transportIdentity.event", un = 50, dn = globalThis.setTimeout.bind(globalThis);
191
194
  let le = null;
192
195
  const Re = /* @__PURE__ */ new Set(), Qe = /* @__PURE__ */ new Map();
193
- async function cn(s = ps()) {
196
+ async function hn(s = gs()) {
194
197
  const e = s.randomUUID(), t = s.storage.getItem(Ke);
195
198
  let n = t ?? s.randomUUID(), i = !1, r = !1;
196
199
  const o = s.channel.subscribe((l) => {
@@ -228,9 +231,9 @@ async function cn(s = ps()) {
228
231
  }
229
232
  };
230
233
  }
231
- async function un(s = !1) {
232
- le || (le = cn({
233
- ...ps(),
234
+ async function pn(s = !1) {
235
+ le || (le = hn({
236
+ ...gs(),
234
237
  skipStoredIdentityCollisionCheck: s
235
238
  }), le.then((i) => {
236
239
  const r = (o) => {
@@ -238,7 +241,7 @@ async function un(s = !1) {
238
241
  };
239
242
  window.addEventListener("pagehide", r);
240
243
  }));
241
- const e = await le, t = dn();
244
+ const e = await le, t = gn();
242
245
  Re.add(t);
243
246
  let n = !1;
244
247
  return {
@@ -249,21 +252,21 @@ async function un(s = !1) {
249
252
  }
250
253
  };
251
254
  }
252
- function dn() {
255
+ function gn() {
253
256
  let s = 0;
254
257
  for (; Re.has(s); )
255
258
  s += 1;
256
259
  return s;
257
260
  }
258
- function ps() {
261
+ function gs() {
259
262
  return {
260
- storage: hn(),
261
- channel: pn(),
263
+ storage: fn(),
264
+ channel: mn(),
262
265
  randomUUID: () => crypto.randomUUID(),
263
- settle: () => new Promise((s) => ln(s, an))
266
+ settle: () => new Promise((s) => dn(s, un))
264
267
  };
265
268
  }
266
- function hn() {
269
+ function fn() {
267
270
  return {
268
271
  getItem: (s) => {
269
272
  try {
@@ -281,9 +284,9 @@ function hn() {
281
284
  }
282
285
  };
283
286
  }
284
- function pn() {
287
+ function mn() {
285
288
  if (typeof BroadcastChannel < "u") {
286
- const s = new BroadcastChannel(on);
289
+ const s = new BroadcastChannel(cn);
287
290
  return {
288
291
  postMessage: (e) => s.postMessage(e),
289
292
  subscribe: (e) => {
@@ -293,9 +296,9 @@ function pn() {
293
296
  close: () => s.close()
294
297
  };
295
298
  }
296
- return gn();
299
+ return yn();
297
300
  }
298
- function gn() {
301
+ function yn() {
299
302
  const s = /* @__PURE__ */ new Set(), e = (t) => {
300
303
  if (t.key !== Ge || !t.newValue)
301
304
  return;
@@ -316,8 +319,8 @@ function gn() {
316
319
  }
317
320
  };
318
321
  }
319
- const gs = "schedule_follow_up";
320
- function fn(s) {
322
+ const fs = "schedule_follow_up";
323
+ function In(s) {
321
324
  let e = s;
322
325
  if (typeof e == "string")
323
326
  try {
@@ -328,48 +331,48 @@ function fn(s) {
328
331
  if (!e || typeof e != "object")
329
332
  return null;
330
333
  const t = e;
331
- return t.ok !== !0 || t.toolName !== gs || typeof t.dueAt != "string" || Number.isNaN(Date.parse(t.dueAt)) ? null : {
334
+ return t.ok !== !0 || t.toolName !== fs || typeof t.dueAt != "string" || Number.isNaN(Date.parse(t.dueAt)) ? null : {
332
335
  id: typeof t.taskId == "string" && t.taskId ? t.taskId : null,
333
336
  dueAt: t.dueAt
334
337
  };
335
338
  }
336
- const mn = [
339
+ const Sn = [
337
340
  { value: "gpt-5.6-sol", label: "gpt-5.6-sol", price: "$$" },
338
341
  { value: "anthropic/claude-sonnet-5", label: "Claude Sonnet 5", price: "$$" },
339
342
  { value: "deepseek/deepseek-v4-flash", label: "DeepSeek V4 Flash", price: "$" }
340
- ], yn = [
343
+ ], Tn = [
341
344
  { value: "anthropic/claude-opus-5", label: "Claude Opus 5", price: "$$$" },
342
345
  { value: "gpt-5.6-terra", label: "gpt-5.6-terra", price: "$$" }
343
- ], In = [
344
- ...mn,
345
- ...yn
346
- ], Ve = (s) => In.some((e) => e.value === s);
346
+ ], wn = [
347
+ ...Sn,
348
+ ...Tn
349
+ ], Ve = (s) => wn.some((e) => e.value === s);
347
350
  function qt(s, e) {
348
351
  return s.filter((t, n) => {
349
352
  const i = Ot(t);
350
- return fs(i) ? !s.slice(n + 1).some((r) => {
353
+ return ms(i) ? !s.slice(n + 1).some((r) => {
351
354
  const o = Ot(r);
352
- return ms(i, o) && ys(i, o);
355
+ return ys(i, o) && Is(i, o);
353
356
  }) : !0;
354
357
  });
355
358
  }
356
- function fs(s) {
359
+ function ms(s) {
357
360
  return s.type === "run_status" && s.status === "stopped" && s.reason === "task_tab_closed";
358
361
  }
359
- function Sn(s, e) {
360
- return s.reason === "task_tab_closed" && ys(s, e) && ms(s, e);
362
+ function An(s, e) {
363
+ return s.reason === "task_tab_closed" && Is(s, e) && ys(s, e);
361
364
  }
362
365
  function Ot(s) {
363
366
  return s.data && typeof s.data == "object" ? s.data : {};
364
367
  }
365
- function ms(s, e) {
368
+ function ys(s, e) {
366
369
  const t = typeof s.runId == "string" ? s.runId : null, n = typeof e.runId == "string" ? e.runId : null;
367
- return t && n && t === n ? !1 : e.type === "message" ? e.role === "assistant" : e.type === "run_status" ? !fs(e) : e.type === "run_error";
370
+ return t && n && t === n ? !1 : e.type === "message" ? e.role === "assistant" : e.type === "run_status" ? !ms(e) : e.type === "run_error";
368
371
  }
369
- function ys(s, e) {
372
+ function Is(s, e) {
370
373
  return typeof s.respondsToUserMessageId == "string" && typeof e.respondsToUserMessageId == "string" ? s.respondsToUserMessageId === e.respondsToUserMessageId : typeof s.clientMessageId == "string" && typeof e.clientMessageId == "string" ? s.clientMessageId === e.clientMessageId : typeof s.runId == "string" && typeof e.runId == "string" && s.runId === e.runId;
371
374
  }
372
- function ke(s) {
375
+ function Ee(s) {
373
376
  return {
374
377
  key: s,
375
378
  status: "not_requested",
@@ -381,7 +384,7 @@ function ke(s) {
381
384
  }
382
385
  class xt {
383
386
  constructor(e, t, n = (i, r) => r) {
384
- this.loader = t, this.merge = n, this.state = ke(e);
387
+ this.loader = t, this.merge = n, this.state = Ee(e);
385
388
  }
386
389
  loader;
387
390
  merge;
@@ -396,10 +399,10 @@ class xt {
396
399
  return this.listeners.add(e), e(this.state), () => this.listeners.delete(e);
397
400
  }
398
401
  setKey(e) {
399
- e !== this.state.key && (this.state = ke(e), this.trailingLoad = null, this.publish());
402
+ e !== this.state.key && (this.state = Ee(e), this.trailingLoad = null, this.publish());
400
403
  }
401
404
  reset() {
402
- this.state = ke(this.state.key), this.trailingLoad = null, this.publish();
405
+ this.state = Ee(this.state.key), this.trailingLoad = null, this.publish();
403
406
  }
404
407
  invalidate() {
405
408
  this.state = {
@@ -454,7 +457,7 @@ class xt {
454
457
  for (const e of this.listeners) e(this.state);
455
458
  }
456
459
  }
457
- function Ee(s) {
460
+ function ke(s) {
458
461
  const e = {}, t = [];
459
462
  for (const n of s.entities)
460
463
  e[n.id] || t.push(n.id), e[n.id] = n;
@@ -464,28 +467,28 @@ function Ee(s) {
464
467
  nextCursor: s.nextCursor
465
468
  };
466
469
  }
467
- function Tn(s, e, t) {
470
+ function Mn(s, e, t) {
468
471
  if (t === "replace" || s === null) return e;
469
472
  const n = { ...s.entitiesById, ...e.entitiesById }, i = [...s.ids];
470
473
  for (const r of e.ids)
471
474
  s.entitiesById[r] || i.push(r);
472
475
  return { entitiesById: n, ids: i, nextCursor: e.nextCursor };
473
476
  }
474
- function Is(s) {
477
+ function Ss(s) {
475
478
  return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
476
479
  }
477
- function Ao(s) {
480
+ function Ro(s) {
478
481
  return s.visible ? s.minimized ? { state: "minimized" } : { state: s.open ? "visible_open" : "visible_closed" } : { state: "hidden" };
479
482
  }
480
- function wn(s, e) {
483
+ function bn(s, e) {
481
484
  return e === "limit_exceeded" ? { allowed: !1, reason: "credits_exhausted", actions: ["upgrade", "earn_credits"] } : e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required" ? { allowed: !1, reason: "payment_issue", actions: ["upgrade"] } : s ?? { allowed: !0, reason: "allowed", actions: [] };
482
485
  }
483
- function An(s) {
486
+ function Rn(s) {
484
487
  if (!s || typeof s != "object") return !1;
485
488
  const e = s.paidCreditFallbackModel;
486
489
  return typeof e == "string" && e.length > 0;
487
490
  }
488
- function Mo(s) {
491
+ function Eo(s) {
489
492
  const e = s.hasDraftMessage || s.hasPreSubmittedAttachment;
490
493
  return s.hasRunningAssistantTurn && !e ? {
491
494
  action: "stop",
@@ -495,20 +498,20 @@ function Mo(s) {
495
498
  disabled: !e || !s.canSubmitMessage
496
499
  };
497
500
  }
498
- class Mn {
501
+ class En {
499
502
  constructor(e, t, n = 20) {
500
503
  this.loadPage = t, this.limit = n, this.recentQuery = new xt(
501
504
  `${e}:recent`,
502
- async ({ cursor: i }) => Ee(
505
+ async ({ cursor: i }) => ke(
503
506
  await this.loadPage({ cursor: i, limit: this.limit, pinned: !1 }).then((r) => ({
504
507
  entities: r.sessions,
505
508
  nextCursor: r.nextCursor
506
509
  }))
507
510
  ),
508
- Tn
511
+ Mn
509
512
  ), this.pinnedQuery = new xt(
510
513
  `${e}:pinned`,
511
- async () => Ee({
514
+ async () => ke({
512
515
  entities: await this.loadAllPinned(),
513
516
  nextCursor: null
514
517
  })
@@ -532,13 +535,13 @@ class Mn {
532
535
  ...Ie(e.data)
533
536
  ], i = new Map(n.map((l) => [l.id, l])), r = Array.from(i.values()).map(
534
537
  (l) => this.applyOverrides(l, this.completedRefreshSequence)
535
- ), o = Array.from(this.optimisticEntities.values()).filter((l) => !i.has(l.id)).reverse(), a = e.data || t.data || o.length > 0 ? Ee({
538
+ ), o = Array.from(this.optimisticEntities.values()).filter((l) => !i.has(l.id)).reverse(), a = e.data || t.data || o.length > 0 ? ke({
536
539
  entities: [...o, ...r],
537
540
  nextCursor: e.data?.nextCursor ?? null
538
541
  }) : null;
539
542
  return {
540
543
  key: e.key.slice(0, -7),
541
- status: bn(e, t),
544
+ status: kn(e, t),
542
545
  data: a,
543
546
  error: e.error ?? t.error,
544
547
  requestId: Math.max(e.requestId, t.requestId),
@@ -647,7 +650,7 @@ class Mn {
647
650
  function Ie(s) {
648
651
  return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
649
652
  }
650
- function bn(s, e) {
653
+ function kn(s, e) {
651
654
  return s.status === "error" || e.status === "error" ? "error" : s.status === "loading" || e.status === "loading" ? "loading" : s.status === "refreshing" || e.status === "refreshing" ? "refreshing" : s.status === "loading_more" ? "loading_more" : s.status === "ready" || e.status === "ready" ? "ready" : "not_requested";
652
655
  }
653
656
  class Lt {
@@ -694,7 +697,7 @@ class Lt {
694
697
  this.schedule(r, e);
695
698
  }
696
699
  }
697
- class Rn {
700
+ class Cn {
698
701
  constructor(e) {
699
702
  this.options = e;
700
703
  }
@@ -746,7 +749,7 @@ class Rn {
746
749
  );
747
750
  }
748
751
  }
749
- class kn {
752
+ class _n {
750
753
  constructor(e, t = null) {
751
754
  this.storage = e, t && (this.decisions = new Map(
752
755
  t.filter(rt).map((n) => [this.getDecisionKey(n), n])
@@ -799,7 +802,7 @@ class kn {
799
802
  async applyAction(e, t, n) {
800
803
  if (!e.allowedActions.includes(t))
801
804
  throw new Error(`Interaction ${e.key} does not allow ${t}.`);
802
- if (!Ss(t))
805
+ if (!Ts(t))
803
806
  throw new Error(`Interaction action ${t} is not a persistence decision.`);
804
807
  const i = n.now ?? /* @__PURE__ */ new Date(), r = {
805
808
  promptKey: e.key,
@@ -825,51 +828,51 @@ class kn {
825
828
  return null;
826
829
  }
827
830
  getDecisionKey(e) {
828
- const t = Je(e.scope);
831
+ const t = Xe(e.scope);
829
832
  return e.action === "dont_show_again" ? `${t}:category:${e.category}` : `${t}:interaction:${e.promptKey}`;
830
833
  }
831
834
  getExactKey(e) {
832
- return `${Je(e.scope)}:interaction:${e.key}`;
835
+ return `${Xe(e.scope)}:interaction:${e.key}`;
833
836
  }
834
837
  getCategoryKey(e) {
835
- return `${Je(e.scope)}:category:${e.category}`;
838
+ return `${Xe(e.scope)}:category:${e.category}`;
836
839
  }
837
840
  }
838
- function bo(s, e) {
841
+ function ko(s, e) {
839
842
  return {
840
- load: async () => En(s, e),
843
+ load: async () => Pn(s, e),
841
844
  save: async (t) => s.setItem(e, JSON.stringify(t))
842
845
  };
843
846
  }
844
- function En(s, e) {
847
+ function Pn(s, e) {
845
848
  const t = s.getItem(e);
846
849
  if (!t) return [];
847
850
  const n = JSON.parse(t);
848
851
  return Array.isArray(n) ? n.filter(rt) : [];
849
852
  }
850
- function Je(s) {
853
+ function Xe(s) {
851
854
  return `${s.level}:${s.key}`;
852
855
  }
853
- function Ss(s) {
856
+ function Ts(s) {
854
857
  return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
855
858
  }
856
859
  function rt(s) {
857
860
  if (!s || typeof s != "object") return !1;
858
861
  const e = s;
859
- return typeof e.promptKey == "string" && typeof e.category == "string" && typeof e.decidedAt == "string" && (e.nextEligibleAt === null || typeof e.nextEligibleAt == "string") && Ss(e.action) && !!(e.scope && typeof e.scope == "object" && typeof e.scope.level == "string" && typeof e.scope.key == "string");
862
+ return typeof e.promptKey == "string" && typeof e.category == "string" && typeof e.decidedAt == "string" && (e.nextEligibleAt === null || typeof e.nextEligibleAt == "string") && Ts(e.action) && !!(e.scope && typeof e.scope == "object" && typeof e.scope.level == "string" && typeof e.scope.key == "string");
860
863
  }
861
- const Cn = {
864
+ const vn = {
862
865
  working: "⏳",
863
866
  completed: "✅",
864
867
  failed: "❗",
865
868
  stopped: "⏹️"
866
- }, _n = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
867
- function Pn(s, e) {
869
+ }, Un = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
870
+ function Dn(s, e) {
868
871
  if (!e) return ve(s);
869
- const t = ve(s), n = `${Cn[e]} Pluno`;
872
+ const t = ve(s), n = `${vn[e]} Pluno`;
870
873
  return t ? `${n}: ${t}` : n;
871
874
  }
872
- class Ro {
875
+ class Co {
873
876
  constructor(e) {
874
877
  this.titleDocument = e;
875
878
  }
@@ -903,11 +906,11 @@ class Ro {
903
906
  applyTitle() {
904
907
  if (!this.status)
905
908
  return;
906
- const e = Pn(this.baseTitle, this.status);
909
+ const e = Dn(this.baseTitle, this.status);
907
910
  this.lastAppliedTitle = e, this.titleDocument.getTitle() !== e && this.titleDocument.setTitle(e);
908
911
  }
909
912
  }
910
- function ko(s) {
913
+ function _o(s) {
911
914
  return {
912
915
  getTitle: () => s.title,
913
916
  setTitle: (e) => {
@@ -924,9 +927,9 @@ function ko(s) {
924
927
  };
925
928
  }
926
929
  function ve(s) {
927
- return s.replace(_n, "");
930
+ return s.replace(Un, "");
928
931
  }
929
- function Eo(s) {
932
+ function Po(s) {
930
933
  if (!s || typeof s != "object" || !("type" in s)) return !1;
931
934
  const e = s;
932
935
  switch (e.type) {
@@ -938,7 +941,7 @@ function Eo(s) {
938
941
  case "runtime.warmup":
939
942
  return e.reason === "panel_open" || e.reason === "extension_install" || e.reason === "composer_input";
940
943
  case "runtime.report_displayed_error":
941
- return (e.reason === "conversation_error" || e.reason === "attachment_error" || e.reason === "history_error" || e.reason === "action_error") && typeof e.errorFingerprint == "string" && /^fnv1a-[0-9a-f]{8}$/.test(e.errorFingerprint);
944
+ return (e.reason === "conversation_error" || e.reason === "attachment_error" || e.reason === "history_error" || e.reason === "action_error") && typeof e.errorFingerprint == "string" && /^fnv1a-[0-9a-f]{8}$/.test(e.errorFingerprint) && (e.displayedMessage === void 0 || typeof e.displayedMessage == "string" && e.displayedMessage.length <= 500);
942
945
  case "runtime.report_invalid_state_transition":
943
946
  return (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll") && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
944
947
  case "runtime.widget_lifecycle":
@@ -967,9 +970,9 @@ function Eo(s) {
967
970
  return !1;
968
971
  }
969
972
  }
970
- class Co {
973
+ class vo {
971
974
  constructor(e, t, n) {
972
- this.adapter = t, this.state = Xe(e), this.model = n;
975
+ this.adapter = t, this.state = Je(e), this.model = n;
973
976
  }
974
977
  adapter;
975
978
  listeners = {};
@@ -978,7 +981,7 @@ class Co {
978
981
  interactionListeners = /* @__PURE__ */ new Set();
979
982
  accountListeners = /* @__PURE__ */ new Set();
980
983
  state;
981
- sessionHistoryState = ke("unavailable");
984
+ sessionHistoryState = Ee("unavailable");
982
985
  model;
983
986
  interactions = [];
984
987
  account = null;
@@ -990,11 +993,11 @@ class Co {
990
993
  return n.add(t), this.listeners[e] = n, () => n.delete(t);
991
994
  }
992
995
  getState() {
993
- return Xe(this.state);
996
+ return Je(this.state);
994
997
  }
995
998
  updateProjection(e, t, n, i, r) {
996
999
  if (!this.destroyed) {
997
- if (this.state = Xe(e), t !== void 0 && (this.model = t), n) {
1000
+ if (this.state = Je(e), t !== void 0 && (this.model = t), n) {
998
1001
  this.sessionHistoryState = Nt(n);
999
1002
  for (const o of this.sessionHistoryListeners)
1000
1003
  o(this.getSessionHistoryState());
@@ -1035,11 +1038,12 @@ class Co {
1035
1038
  }).catch(() => {
1036
1039
  });
1037
1040
  }
1038
- reportDisplayedError(e, t) {
1041
+ reportDisplayedError(e, t, n) {
1039
1042
  this.adapter.dispatch({
1040
1043
  type: "runtime.report_displayed_error",
1041
1044
  reason: e,
1042
- errorFingerprint: t
1045
+ errorFingerprint: t,
1046
+ ...n ? { displayedMessage: hs(n) } : {}
1043
1047
  }).catch(() => {
1044
1048
  });
1045
1049
  }
@@ -1154,7 +1158,7 @@ class Co {
1154
1158
  await this.dispatch({ type: "session.list", ...e });
1155
1159
  const t = this.sessionHistoryState.data;
1156
1160
  return {
1157
- sessions: Is(t),
1161
+ sessions: Ss(t),
1158
1162
  nextCursor: t?.nextCursor ?? null
1159
1163
  };
1160
1164
  }
@@ -1238,7 +1242,7 @@ class Co {
1238
1242
  for (const i of n ?? []) i(t);
1239
1243
  }
1240
1244
  }
1241
- function Xe(s) {
1245
+ function Je(s) {
1242
1246
  return {
1243
1247
  ...s,
1244
1248
  starterPrompts: [...s.starterPrompts],
@@ -1265,14 +1269,14 @@ function Xe(s) {
1265
1269
  function Nt(s) {
1266
1270
  return {
1267
1271
  ...s,
1268
- data: s.data ? Ee({
1269
- entities: Is(s.data).map((e) => ({ ...e })),
1272
+ data: s.data ? ke({
1273
+ entities: Ss(s.data).map((e) => ({ ...e })),
1270
1274
  nextCursor: s.data.nextCursor
1271
1275
  }) : null
1272
1276
  };
1273
1277
  }
1274
- const vn = globalThis.fetch.bind(globalThis), Ht = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', Un = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Dn = ".pluno-pa-widget__panel", qn = ".pluno-pa-widget__timeline", On = "__plunoExtensionWidgetOwner";
1275
- class J extends Error {
1278
+ const qn = globalThis.fetch.bind(globalThis), Ht = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', On = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', xn = ".pluno-pa-widget__panel", Ln = ".pluno-pa-widget__timeline", Nn = "__plunoExtensionWidgetOwner";
1279
+ class X extends Error {
1276
1280
  constructor(e, t, n, i) {
1277
1281
  super(e), this.retryable = t, this.status = n, this.retryAfterMs = i, this.name = "ProductAgentTokenProviderError";
1278
1282
  }
@@ -1280,10 +1284,10 @@ class J extends Error {
1280
1284
  status;
1281
1285
  retryAfterMs;
1282
1286
  }
1283
- function xn(s) {
1287
+ function Hn(s) {
1284
1288
  return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
1285
1289
  }
1286
- let Ln = 0;
1290
+ let Bn = 0;
1287
1291
  function Bt(s) {
1288
1292
  const e = {};
1289
1293
  for (const l of [
@@ -1361,7 +1365,7 @@ function Se(s, e, t) {
1361
1365
  source: "web_sdk",
1362
1366
  category: s,
1363
1367
  name: e,
1364
- sequence: ++Ln,
1368
+ sequence: ++Bn,
1365
1369
  wallTime: (/* @__PURE__ */ new Date()).toISOString(),
1366
1370
  monotonicMs: performance.now(),
1367
1371
  data: t
@@ -1370,27 +1374,27 @@ function Se(s, e, t) {
1370
1374
  }
1371
1375
  class Te extends Error {
1372
1376
  }
1373
- function Nn(s) {
1377
+ function Fn(s) {
1374
1378
  return s === 408 || s === 425 || s === 429 || s >= 500;
1375
1379
  }
1376
- const Hn = "https://app.pluno.ai", Bn = 2e4, Wn = 1e4, Fn = 6e4, $n = 6e4, jn = 1e4, zn = 1e4, Kn = 3e3, Gn = 3e4, Qn = 1e3, ot = 3e4, Wt = 0.2, Vn = 6e4, Ft = 15e3, Jn = 6e4, Xn = 8, Yn = "Browser connection was interrupted.", $t = 15e3, Zn = "Pluno could not send this message. Try it again.", ei = "Still connecting to Pluno. Retrying automatically.", ti = 2e3, si = 1e3, ni = 100, jt = 8e3, zt = 3, ii = [300, 1e3], Ts = 50 * 1024 * 1024, ri = /* @__PURE__ */ new Set([
1380
+ const Wn = "https://app.pluno.ai", $n = 2e4, jn = 1e4, zn = 6e4, Kn = 6e4, Gn = 1e4, Qn = 1e4, Vn = 3e3, Xn = 3e4, Jn = 1e3, ot = 3e4, Ft = 0.2, Yn = 6e4, Wt = 15e3, Zn = 6e4, ei = 8, ti = "Browser connection was interrupted.", $t = 15e3, si = "Pluno could not send this message. Try it again.", ni = "Still connecting to Pluno. Retrying automatically.", ii = 2e3, ri = 1e3, oi = 100, jt = 8e3, zt = 3, ai = [300, 1e3], ws = 50 * 1024 * 1024, li = /* @__PURE__ */ new Set([
1377
1381
  ".jpeg:image/jpeg",
1378
1382
  ".jpg:image/jpeg",
1379
1383
  ".pdf:application/pdf",
1380
1384
  ".png:image/png",
1381
1385
  ".webp:image/webp"
1382
- ]), _o = ".pdf,.png,.jpg,.jpeg,.webp", Tt = 64e3, Ye = 4e3, wt = 30, oi = 2e3, ai = 1e3, ws = "Image is too large for model vision input.", li = 100, ci = 20, As = "pluno.productAgent.state.", at = "pluno.productAgent.pendingEvents.", Le = "pluno.productAgent.activeToolCalls.", ui = 100;
1383
- function di(s, e = 0) {
1386
+ ]), Uo = ".pdf,.png,.jpg,.jpeg,.webp", Tt = 64e3, Ye = 4e3, wt = 30, ci = 2e3, ui = 1e3, As = "Image is too large for model vision input.", di = 100, hi = 20, Ms = "pluno.productAgent.state.", at = "pluno.productAgent.pendingEvents.", Le = "pluno.productAgent.activeToolCalls.", pi = 100;
1387
+ function gi(s, e = 0) {
1384
1388
  const t = s === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (s - 1));
1385
1389
  return Math.max(e, t);
1386
1390
  }
1387
1391
  const Ce = /* @__PURE__ */ new Set();
1388
1392
  let we = null;
1389
- function hi(s, e = Math.random) {
1390
- const t = Math.min(ot, Qn * 2 ** s), n = 1 - Wt + e() * Wt * 2;
1393
+ function fi(s, e = Math.random) {
1394
+ const t = Math.min(ot, Jn * 2 ** s), n = 1 - Ft + e() * Ft * 2;
1391
1395
  return Math.min(ot, Math.round(t * n));
1392
1396
  }
1393
- function pi(s) {
1397
+ function mi(s) {
1394
1398
  const e = s.split(".")[1];
1395
1399
  if (!e)
1396
1400
  return null;
@@ -1401,8 +1405,8 @@ function pi(s) {
1401
1405
  return null;
1402
1406
  }
1403
1407
  }
1404
- function gi(s) {
1405
- if (s instanceof J)
1408
+ function yi(s) {
1409
+ if (s instanceof X)
1406
1410
  return s.retryable;
1407
1411
  if (s && typeof s == "object") {
1408
1412
  const e = s.status;
@@ -1411,7 +1415,7 @@ function gi(s) {
1411
1415
  }
1412
1416
  return !0;
1413
1417
  }
1414
- function fi(s) {
1418
+ function Ii(s) {
1415
1419
  if (s instanceof Error)
1416
1420
  return s;
1417
1421
  if (s && typeof s == "object") {
@@ -1425,7 +1429,7 @@ function fi(s) {
1425
1429
  }
1426
1430
  class Ne {
1427
1431
  constructor(e, t) {
1428
- this.options = e, this.transportIdentity = t, this.sessionHistoryManager = new Mn(
1432
+ this.options = e, this.transportIdentity = t, this.sessionHistoryManager = new En(
1429
1433
  e.clientId,
1430
1434
  async ({ cursor: r, limit: o, pinned: a }) => await this.listSessions({ cursor: r, limit: o, pinned: a })
1431
1435
  ), this.sessionRecoveryPoller = new Lt({
@@ -1440,7 +1444,7 @@ class Ne {
1440
1444
  activeIntervalMs: 3e3,
1441
1445
  idleIntervalMs: 15e3,
1442
1446
  maxFailureIntervalMs: 3e4
1443
- }), this.sessionActivityRecovery = new Rn({
1447
+ }), this.sessionActivityRecovery = new Cn({
1444
1448
  fetchPage: async (r, o) => await this.fetchSessionHistoryPageOnce(
1445
1449
  r,
1446
1450
  "activity",
@@ -1468,9 +1472,9 @@ class Ne {
1468
1472
  maxFailureIntervalMs: 3e4
1469
1473
  }), this.personalModelSelectionOverride = e.productVariant === "personal" && Ve(e.model) ? e.model : null, this.state = {
1470
1474
  ...this.state,
1471
- starterPrompts: Ji(e.initialStarterPrompts)
1475
+ starterPrompts: Zi(e.initialStarterPrompts)
1472
1476
  }, this.account = e.initialAccount ? { ...e.initialAccount } : null;
1473
- const n = e.restorePersistedState === !1 ? null : Br(e.clientId, e.expectedPersistedSessionId);
1477
+ const n = e.restorePersistedState === !1 ? null : $r(e.clientId, e.expectedPersistedSessionId);
1474
1478
  n && (this.state = {
1475
1479
  ...this.state,
1476
1480
  ...n,
@@ -1491,9 +1495,9 @@ class Ne {
1491
1495
  taskStatus: null,
1492
1496
  isRetrying: !1,
1493
1497
  lastError: null
1494
- }, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents = Kr(
1495
- Fr(e.clientId),
1496
- $r(e.clientId)
1498
+ }, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents = Vr(
1499
+ zr(e.clientId),
1500
+ Kr(e.clientId)
1497
1501
  );
1498
1502
  const i = [...this.queuedClientEvents].reverse().find(
1499
1503
  (r) => r.type === "chat.user_message" && typeof r.clientMessageId == "string"
@@ -1539,7 +1543,7 @@ class Ne {
1539
1543
  accountRefresh = null;
1540
1544
  runtimeInteractions = [];
1541
1545
  interactionListeners = /* @__PURE__ */ new Set();
1542
- interactionManager = new kn(
1546
+ interactionManager = new _n(
1543
1547
  { load: async () => [], save: async () => {
1544
1548
  } },
1545
1549
  []
@@ -1639,17 +1643,17 @@ class Ne {
1639
1643
  lastErrorSecuritySettingsUrl: null
1640
1644
  };
1641
1645
  static async init(e) {
1642
- const t = e, n = await un(
1646
+ const t = e, n = await pn(
1643
1647
  t.skipStoredTransportIdentityCollisionCheck === !0
1644
1648
  ), i = new Ne({
1645
1649
  ...e,
1646
- backendUrl: Oi(e.backendUrl ?? Hn),
1647
- clientId: e.clientId ?? tr(),
1650
+ backendUrl: Ni(e.backendUrl ?? Wn),
1651
+ clientId: e.clientId ?? ir(),
1648
1652
  productVariant: e.productVariant ?? "customer_embedded",
1649
- entrySurface: xi(e.entrySurface)
1653
+ entrySurface: Hi(e.entrySurface)
1650
1654
  }, n);
1651
1655
  try {
1652
- Qs().catch((r) => {
1656
+ Js().catch((r) => {
1653
1657
  b("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
1654
1658
  message: r instanceof Error ? r.message : String(r)
1655
1659
  });
@@ -1695,7 +1699,7 @@ class Ne {
1695
1699
  return this.options.token;
1696
1700
  if (!this.options.tokenProvider)
1697
1701
  return this.token;
1698
- const n = Date.now(), i = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs - $n > n;
1702
+ const n = Date.now(), i = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs - Kn > n;
1699
1703
  if (!t.forceRefresh && (i || t.preferCached && this.token !== null))
1700
1704
  return this.token;
1701
1705
  if (this.tokenRequest && !t.forceRefresh)
@@ -1707,8 +1711,8 @@ class Ne {
1707
1711
  let a = null;
1708
1712
  const l = new Promise((c, u) => {
1709
1713
  a = window.setTimeout(() => {
1710
- r.abort(), u(new J("Pluno token provider timed out", !0));
1711
- }, Fn);
1714
+ r.abort(), u(new X("Pluno token provider timed out", !0));
1715
+ }, zn);
1712
1716
  });
1713
1717
  try {
1714
1718
  const c = await Promise.race([
@@ -1716,10 +1720,10 @@ class Ne {
1716
1720
  l
1717
1721
  ]);
1718
1722
  if (r.signal.aborted || this.tokenAbortController !== r)
1719
- throw new J("Pluno token request was cancelled", !0);
1723
+ throw new X("Pluno token request was cancelled", !0);
1720
1724
  if (!c)
1721
- throw new J("Pluno token provider did not return a token", !1);
1722
- return this.token = c, this.tokenExpiresAtMs = pi(c), c;
1725
+ throw new X("Pluno token provider did not return a token", !1);
1726
+ return this.token = c, this.tokenExpiresAtMs = mi(c), c;
1723
1727
  } finally {
1724
1728
  a !== null && window.clearTimeout(a);
1725
1729
  }
@@ -1743,11 +1747,11 @@ class Ne {
1743
1747
  if (this.token = await this.acquireToken("connect"), e !== this.connectionAttemptId || this.state.status === "closed")
1744
1748
  return;
1745
1749
  if (!this.token && !this.options.webSocketFactory)
1746
- throw new J("Pluno requires a token or tokenProvider", !1);
1747
- const t = Hi(this.options.backendUrl), n = this.options.webSocketFactory?.(t) ?? new WebSocket(t);
1750
+ throw new X("Pluno requires a token or tokenProvider", !1);
1751
+ const t = Wi(this.options.backendUrl), n = this.options.webSocketFactory?.(t) ?? new WebSocket(t);
1748
1752
  this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
1749
1753
  this.socket === n && n.readyState === WebSocket.CONNECTING && (b("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.reportTransportDiagnostic("connect_timeout"), this.replaceTimedOutSocket(n));
1750
- }, jn), n.addEventListener("open", () => {
1754
+ }, Gn), n.addEventListener("open", () => {
1751
1755
  this.socket !== n || (this.clearSocketConnectTimer(), b("web-sdk.agent", "Pluno socket opened", {
1752
1756
  queuedClientEventCount: this.queuedClientEvents.length,
1753
1757
  isThinking: this.state.isThinking
@@ -1759,13 +1763,13 @@ class Ne {
1759
1763
  pageUrl: location.href
1760
1764
  }) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
1761
1765
  this.socket === n && (b("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.reportTransportDiagnostic("auth_timeout"), this.replaceTimedOutSocket(n));
1762
- }, zn));
1766
+ }, Qn));
1763
1767
  }), n.addEventListener("message", (i) => {
1764
- this.socket === n && this.handleServerEvent(Qi(i.data));
1768
+ this.socket === n && this.handleServerEvent(Ji(i.data));
1765
1769
  }), n.addEventListener("sendfailure", (i) => {
1766
1770
  if (this.socket !== n)
1767
1771
  return;
1768
- const r = Vi(i?.detail?.data);
1772
+ const r = Yi(i?.detail?.data);
1769
1773
  r?.type === "chat.user_message" && r.clientMessageId === this.pendingClientMessageId && !this.queuedClientEvents.some(
1770
1774
  (o) => o.type === "chat.user_message" && o.clientMessageId === r.clientMessageId
1771
1775
  ) && (this.queuedClientEvents.push(r), V(this.options.clientId, this.queuedClientEvents), this.setState({ pendingMessageStatus: "reconnecting" })), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), n.readyState !== WebSocket.CLOSED && n.readyState !== WebSocket.CLOSING && n.close();
@@ -1789,17 +1793,17 @@ class Ne {
1789
1793
  } catch (t) {
1790
1794
  if (e !== this.connectionAttemptId || this.state.status === "closed")
1791
1795
  return;
1792
- const n = fi(t);
1793
- if (gi(t)) {
1796
+ const n = Ii(t);
1797
+ if (yi(t)) {
1794
1798
  b("web-sdk.agent", "Pluno connection attempt failed; retrying", {
1795
1799
  message: n.message,
1796
1800
  reconnectAttempt: this.reconnectAttempts
1797
- }), t instanceof J && this.reportTransportDiagnostic("auth_timeout"), this.setState({
1801
+ }), t instanceof X && this.reportTransportDiagnostic("auth_timeout"), this.setState({
1798
1802
  status: "reconnecting",
1799
- lastError: ei,
1803
+ lastError: ni,
1800
1804
  lastErrorCode: "connection_failed"
1801
1805
  }), this.emit("error", n), this.scheduleReconnect(
1802
- t instanceof J ? t.retryAfterMs : void 0
1806
+ t instanceof X ? t.retryAfterMs : void 0
1803
1807
  );
1804
1808
  return;
1805
1809
  }
@@ -1816,7 +1820,7 @@ class Ne {
1816
1820
  this.stopSessionRecoveryPolling(), this.connectionAttemptId += 1, this.setState({ status: "closed", pendingMessageStatus: null, isThinking: !1, isRetrying: !1 }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.clearStarterPromptUrlRefreshTimer(), this.clearRetryTimers(), this.clearThinkingWatchdog(), this.clearAllFirstResponseTimers(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.clearSessionLoadRequest(), this.rejectPendingSessionHistoryRequests("Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionPinRequests, "Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionRenameRequests, "Pluno disconnected."), this.tokenAbortController?.abort(), this.tokenAbortController = null, this.tokenRequest = null, this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.clientDiagnosticsRetryTimer !== null && (window.clearTimeout(this.clientDiagnosticsRetryTimer), this.clientDiagnosticsRetryTimer = null), this.pendingTransportDiagnostics = [], this.pendingHealthDiagnostics = [], this.queuedClientEvents = [], this.pendingWidgetLifecycleEvents = [], this.clearPendingWarmupAckTimer(), this.pendingPassiveWarmupEvent = null, this.pendingComposerWarmup = null, this.activeComposerWarmupId = null, this.activeComposerWarmupScope = null, this.nonTranscriptToolCallIds.clear(), this.socket?.close(), this.socket = null;
1817
1821
  }
1818
1822
  destroy() {
1819
- this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), Gr(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();
1823
+ this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), Xr(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [], this.detachedSessionIds.clear(), this.detachedClientMessageIds.clear(), this.deferredDetachedSessionEvents.clear();
1820
1824
  for (const e of Object.values(this.listeners))
1821
1825
  e?.clear();
1822
1826
  this.accountListeners.clear(), this.interactionListeners.clear();
@@ -1856,10 +1860,10 @@ class Ne {
1856
1860
  }
1857
1861
  async sendMessage(e, t = {}) {
1858
1862
  const n = e.trim(), i = t.attachments ?? [];
1859
- if (this.options.productVariant === "customer_embedded" && (i.forEach(Os), i.reduce(
1863
+ if (this.options.productVariant === "customer_embedded" && (i.forEach(xs), i.reduce(
1860
1864
  (T, N) => T + N.sizeBytes,
1861
1865
  0
1862
- ) > Ts))
1866
+ ) > ws))
1863
1867
  throw new Error("Embedded attachments must total at most 50 MB per message");
1864
1868
  let r = i.map(qe);
1865
1869
  if (!n && r.length === 0)
@@ -1952,7 +1956,7 @@ class Ne {
1952
1956
  sessionId: this.state.sessionId ?? void 0,
1953
1957
  clientMessageId: a,
1954
1958
  initiatedBy: t.initiatedBy,
1955
- invocation: Li(t.invocation ?? t.initiatedBy),
1959
+ invocation: Bi(t.invocation ?? t.initiatedBy),
1956
1960
  entrySurface: this.options.entrySurface,
1957
1961
  content: n,
1958
1962
  proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
@@ -1970,8 +1974,12 @@ class Ne {
1970
1974
  clientMessageId: t
1971
1975
  });
1972
1976
  }
1973
- reportDisplayedError(e, t) {
1974
- this.reportHealthSignal("user_visible_error", { reason: e, errorFingerprint: t });
1977
+ reportDisplayedError(e, t, n) {
1978
+ this.reportHealthSignal("user_visible_error", {
1979
+ reason: e,
1980
+ errorFingerprint: t,
1981
+ ...n ? { displayedMessage: hs(n) } : {}
1982
+ });
1975
1983
  }
1976
1984
  getModel() {
1977
1985
  return this.options.model;
@@ -1995,7 +2003,7 @@ class Ne {
1995
2003
  return e ? (this.retryAttemptsByClientMessageId[t] = 0, this.retryableClientMessageId = null, this.stagedProactiveSuggestionQuestionMessageId = null, this.activeClientMessageId = t, this.latestRecoverableClientMessageId = t, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), this.markThinkingProgress(), this.send({ type: "chat.retry_last_user_message", sessionId: e, clientMessageId: t, automatic: !1 }), !0) : !1;
1996
2004
  }
1997
2005
  createLocalAttachment(e) {
1998
- this.options.productVariant === "customer_embedded" && Qr(e);
2006
+ this.options.productVariant === "customer_embedded" && Jr(e);
1999
2007
  const t = x(), n = {
2000
2008
  id: t,
2001
2009
  name: e.name || "attachment",
@@ -2004,7 +2012,7 @@ class Ne {
2004
2012
  };
2005
2013
  this.attachmentFiles.set(t, e);
2006
2014
  const i = Date.now();
2007
- return Ks({
2015
+ return Vs({
2008
2016
  attachmentId: t,
2009
2017
  name: n.name,
2010
2018
  mimeType: n.mimeType,
@@ -2069,8 +2077,8 @@ class Ne {
2069
2077
  }, "Failed to upload attachment"), o = l;
2070
2078
  }
2071
2079
  this.setState({ sessionId: o.sessionId });
2072
- const a = qs(o.attachment, this.options.backendUrl);
2073
- return this.updateAttachmentInState(t.id, a), t.id && Gs(t.id, {
2080
+ const a = Os(o.attachment, this.options.backendUrl);
2081
+ return this.updateAttachmentInState(t.id, a), t.id && Xs(t.id, {
2074
2082
  sessionId: o.sessionId,
2075
2083
  fileUrl: a.fileUrl,
2076
2084
  sandboxPath: a.sandboxPath,
@@ -2101,7 +2109,7 @@ class Ne {
2101
2109
  const n = await this.fetchEmbedAttachmentUpload(e, !1);
2102
2110
  if (n.ok)
2103
2111
  return await n.json();
2104
- if (ho(n.status) && this.options.tokenProvider && !t) {
2112
+ if (fo(n.status) && this.options.tokenProvider && !t) {
2105
2113
  t = !0;
2106
2114
  const i = await this.fetchEmbedAttachmentUpload(e, !0);
2107
2115
  if (i.ok)
@@ -2126,7 +2134,7 @@ class Ne {
2126
2134
  if (!this.state.sessionId)
2127
2135
  return;
2128
2136
  this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "user_requested" });
2129
- const e = Pr(
2137
+ const e = Dr(
2130
2138
  this.state.messages,
2131
2139
  this.state.assistantDraftRespondsToUserMessageId,
2132
2140
  this.state.assistantDraftRunId,
@@ -2261,7 +2269,7 @@ class Ne {
2261
2269
  throw new Error("This interaction is no longer available.");
2262
2270
  if (!r.allowedActions.includes(t))
2263
2271
  throw new Error("This action is not available for the interaction.");
2264
- if (xn(t) && await this.interactionManager.act(
2272
+ if (Hn(t) && await this.interactionManager.act(
2265
2273
  {
2266
2274
  key: r.id,
2267
2275
  category: r.category,
@@ -2274,7 +2282,9 @@ class Ne {
2274
2282
  const o = r.payload.request;
2275
2283
  this.integrationAuthStatusByRequestId.set(o.authRequestId, "checking"), this.integrationAuthErrorByRequestId.delete(o.authRequestId), this.rebuildRuntimeInteractions();
2276
2284
  try {
2277
- await this.options.runtimeAdapters?.integrationAuthHandler?.(o), this.integrationAuthStatusByRequestId.set(o.authRequestId, "completed");
2285
+ await this.options.runtimeAdapters?.integrationAuthHandler?.(o);
2286
+ const a = await this.options.runtimeAdapters?.integrationAuthStatusLoader?.(o) ?? "completed";
2287
+ this.integrationAuthStatusByRequestId.set(o.authRequestId, a);
2278
2288
  } catch (a) {
2279
2289
  this.integrationAuthStatusByRequestId.set(o.authRequestId, "error"), this.integrationAuthErrorByRequestId.set(
2280
2290
  o.authRequestId,
@@ -2310,7 +2320,7 @@ class Ne {
2310
2320
  this.rebuildRuntimeInteractions();
2311
2321
  }
2312
2322
  rebuildRuntimeInteractions() {
2313
- const e = [], t = this.options.productVariant === "personal" && (this.options.entrySurface === "main_web_chat" || this.options.entrySurface === "automation") ? Ys(this.state.messages) : null;
2323
+ const e = [], t = this.options.productVariant === "personal" && (this.options.entrySurface === "main_web_chat" || this.options.entrySurface === "automation") ? tn(this.state.messages) : null;
2314
2324
  if (t) {
2315
2325
  const r = {
2316
2326
  key: t.id,
@@ -2436,7 +2446,7 @@ class Ne {
2436
2446
  loadSession(e) {
2437
2447
  const t = x(), n = this.activeComposerWarmupId;
2438
2448
  this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages);
2439
- const i = this.getCachedSessionTimeline(e), r = [...i ?? []].reverse().find((a) => a.dataType === "assistant_draft" && a.steered !== !0), o = Cr(i ?? []);
2449
+ const i = this.getCachedSessionTimeline(e), r = [...i ?? []].reverse().find((a) => a.dataType === "assistant_draft" && a.steered !== !0), o = vr(i ?? []);
2440
2450
  !this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId !== e && this.rememberCurrentRunAsDetached(), this.detachedSessionIds.delete(e), this.deferredDetachedSessionEvents.delete(e), !this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId && (this.state.isThinking || this.state.pendingMessageStatus !== null) && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "session_switch" }), this.options.keepRunsActiveOnSessionNavigation && (this.rememberCurrentRunAsBackground(), this.backgroundSessionIds.delete(e), this.deferredSessionUpdatedSessionIds.delete(e)), this.clearPendingComposerWarmup(), n && this.send({
2441
2451
  type: "session.reset",
2442
2452
  warmupId: n,
@@ -2570,7 +2580,7 @@ class Ne {
2570
2580
  });
2571
2581
  if (!c.ok) {
2572
2582
  const d = await c.text() || `History request failed (${c.status})`;
2573
- throw Nn(c.status) ? new Error(d) : new Te(d);
2583
+ throw Fn(c.status) ? new Error(d) : new Te(d);
2574
2584
  }
2575
2585
  const u = await c.json();
2576
2586
  if (!u?.session || !Array.isArray(u.items))
@@ -2675,7 +2685,7 @@ class Ne {
2675
2685
  clientMessageId: e,
2676
2686
  durationMs: Date.now() - n
2677
2687
  });
2678
- }, Math.max(0, Jn - (Date.now() - n)));
2688
+ }, Math.max(0, Zn - (Date.now() - n)));
2679
2689
  this.firstResponseTimersByClientMessageId.set(e, { submittedAt: n, timer: i });
2680
2690
  }
2681
2691
  clearFirstResponseTimer(e) {
@@ -2785,7 +2795,7 @@ class Ne {
2785
2795
  if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
2786
2796
  return;
2787
2797
  this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
2788
- const e = Bi();
2798
+ const e = $i();
2789
2799
  this.sendNow(
2790
2800
  L({
2791
2801
  type: "starter_prompts.page_context",
@@ -2796,13 +2806,13 @@ class Ne {
2796
2806
  ) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
2797
2807
  }
2798
2808
  startStarterPromptUrlWatcher() {
2799
- this.locationChangeCleanup || (this.locationChangeCleanup = Wi(() => this.handleStarterPromptUrlChange()));
2809
+ this.locationChangeCleanup || (this.locationChangeCleanup = ji(() => this.handleStarterPromptUrlChange()));
2800
2810
  }
2801
2811
  handleStarterPromptUrlChange() {
2802
2812
  const e = location.href;
2803
2813
  e !== this.lastStarterPromptPageUrl && (this.activeComposerWarmupScope && !this.activeComposerWarmupScope.endsWith(`:${e}`) && this.clearPendingComposerWarmup(), this.lastStarterPromptPageUrl = e, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
2804
2814
  this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
2805
- }, ui));
2815
+ }, pi));
2806
2816
  }
2807
2817
  refreshStarterPromptsForCurrentUrl() {
2808
2818
  this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
@@ -2832,7 +2842,7 @@ class Ne {
2832
2842
  }
2833
2843
  rememberSessionTimeline(e, t) {
2834
2844
  const n = [...t];
2835
- for (this.sessionTimelineCache.delete(e), this.sessionTimelineCache.set(e, n); this.sessionTimelineCache.size > ci; ) {
2845
+ for (this.sessionTimelineCache.delete(e), this.sessionTimelineCache.set(e, n); this.sessionTimelineCache.size > hi; ) {
2836
2846
  const i = this.sessionTimelineCache.keys().next().value;
2837
2847
  if (!i)
2838
2848
  break;
@@ -2862,8 +2872,8 @@ class Ne {
2862
2872
  return;
2863
2873
  this.clearPendingWarmupAckTimer();
2864
2874
  const t = Math.min(
2865
- Kn * 2 ** e.retryAttempt,
2866
- Gn
2875
+ Vn * 2 ** e.retryAttempt,
2876
+ Xn
2867
2877
  );
2868
2878
  e.retryAttempt += 1, this.pendingWarmupAckTimer = window.setTimeout(() => {
2869
2879
  this.pendingWarmupAckTimer = null, this.flushPendingComposerWarmup();
@@ -2886,7 +2896,7 @@ class Ne {
2886
2896
  const n = C(t);
2887
2897
  if (!e || !n || !_e(n) || this.findStoppedTurn(e, n))
2888
2898
  return;
2889
- const i = O(n), r = k(n), o = typeof n.clientMessageId == "string" ? n.clientMessageId : i ? this.clientMessageIdsByUserMessageItemId.get(i) ?? null : null;
2899
+ const i = O(n), r = E(n), o = typeof n.clientMessageId == "string" ? n.clientMessageId : i ? this.clientMessageIdsByUserMessageItemId.get(i) ?? null : null;
2890
2900
  this.stoppedTurns.push({
2891
2901
  sessionId: e,
2892
2902
  clientMessageId: o,
@@ -2907,7 +2917,7 @@ class Ne {
2907
2917
  if (!e || !t)
2908
2918
  return;
2909
2919
  const n = this.findStoppedTurn(e, t);
2910
- !n || n.reason !== "task_tab_closed" || Sn(n, t) && (this.stoppedTurns.splice(this.stoppedTurns.indexOf(n), 1), n.stoppedItemId && this.setState({
2920
+ !n || n.reason !== "task_tab_closed" || An(n, t) && (this.stoppedTurns.splice(this.stoppedTurns.indexOf(n), 1), n.stoppedItemId && this.setState({
2911
2921
  messages: this.state.messages.filter((i) => i.id !== n.stoppedItemId)
2912
2922
  }));
2913
2923
  }
@@ -2986,7 +2996,7 @@ class Ne {
2986
2996
  }
2987
2997
  }
2988
2998
  if (!this.shouldIgnoreStoppedTurnEvent(e) && (this.updateInactiveSessionTimelineCache(e), !this.shouldIgnoreBackgroundSessionEvent(e))) {
2989
- if (Si(e) && this.clearFirstResponseTimer(this.activeClientMessageId), e.type === "run.steered") {
2999
+ if (Ai(e) && this.clearFirstResponseTimer(this.activeClientMessageId), e.type === "run.steered") {
2990
3000
  this.handleRunSteered(e);
2991
3001
  return;
2992
3002
  }
@@ -3001,16 +3011,16 @@ class Ne {
3001
3011
  this.activeResponseRunId = t, this.setState({ turnPhase: "thinking", lastError: null }), this.markThinkingProgress();
3002
3012
  return;
3003
3013
  }
3004
- if (Ii(e) && this.markThinkingProgress(), e.type === "auth.ok") {
3014
+ if (wi(e) && this.markThinkingProgress(), e.type === "auth.ok") {
3005
3015
  this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.transportDiagnosticEpisodes.clear();
3006
- const t = sr(e.user);
3016
+ const t = rr(e.user);
3007
3017
  this.authenticatedSocket !== this.socket && this.authenticatedUserId && t && t.id !== this.authenticatedUserId && this.resetForAuthenticationScopeChange(), this.authenticatedUserId = t?.id ?? null, this.authenticatedSocket = this.socket, this.flushPendingWidgetLifecycleEvents(), this.flushPendingComposerWarmup(), this.flushQueuedClientEvents(), this.pendingClientMessageId && (this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(this.pendingClientMessageId)), this.flushPendingPassiveWarmup(), this.startHeartbeat();
3008
- const n = Xi(e), i = Object.prototype.hasOwnProperty.call(e, "appearance");
3018
+ const n = er(e), i = Object.prototype.hasOwnProperty.call(e, "appearance");
3009
3019
  b("web-sdk.agent", "Received auth.ok appearance", {
3010
3020
  hasAppearance: i,
3011
3021
  rawAppearance: e.appearance,
3012
3022
  normalizedAppearance: n
3013
- }), this.runtimeHelperJavascript = Yi(e.runtimeHelpers)?.javascript ?? null;
3023
+ }), this.runtimeHelperJavascript = tr(e.runtimeHelpers)?.javascript ?? null;
3014
3024
  const r = Vt(e, "starterPrompts"), o = Object.prototype.hasOwnProperty.call(e, "starterPrompts"), a = e.starterPromptsLoading === !0, l = {
3015
3025
  user: t,
3016
3026
  status: "connected",
@@ -3037,7 +3047,7 @@ class Ne {
3037
3047
  }
3038
3048
  if (e.type === "scheduled_follow_ups.updated") {
3039
3049
  typeof e.sessionId == "string" && e.sessionId === this.state.sessionId && this.setState({
3040
- activeScheduledFollowUps: Jt(
3050
+ activeScheduledFollowUps: Xt(
3041
3051
  e.activeScheduledFollowUps
3042
3052
  )
3043
3053
  });
@@ -3061,7 +3071,7 @@ class Ne {
3061
3071
  runId: u?.runId
3062
3072
  }), g = this.filterStoppedSnapshotItems(n, r), f = e.pendingMessageStatus === "sending" ? "sending" : e.pendingMessageStatus === "queued" ? "reconnecting" : null, h = typeof e.pendingClientMessageId == "string" ? e.pendingClientMessageId : null, p = e.isRetrying === !0, y = e.turnPhase === "sending" || e.turnPhase === "starting" || e.turnPhase === "thinking" ? e.turnPhase : null;
3063
3073
  f && h && (this.pendingClientMessageId = h);
3064
- let m = ur(
3074
+ let m = pr(
3065
3075
  e.assistantDraft
3066
3076
  );
3067
3077
  m && this.findStoppedTurn(r, {
@@ -3070,9 +3080,9 @@ class Ne {
3070
3080
  }) && (m = void 0);
3071
3081
  const M = m !== void 0;
3072
3082
  this.rememberUserMessageClientMessageIds(g);
3073
- const w = Mr(g), D = g.filter((U) => {
3083
+ const w = Er(g), D = g.filter((U) => {
3074
3084
  const q = C(U);
3075
- return wr(q) ? !1 : !q || !w || !pe(q) ? !0 : dt(g, q) !== w;
3085
+ return br(q) ? !1 : !q || !w || !pe(q) ? !0 : dt(g, q) !== w;
3076
3086
  }), S = lt(
3077
3087
  this.state.messages,
3078
3088
  st(D, this.options.backendUrl)
@@ -3083,18 +3093,18 @@ class Ne {
3083
3093
  v,
3084
3094
  re,
3085
3095
  Y,
3086
- br(g, q)
3096
+ kr(g, q)
3087
3097
  )
3088
- ), ee = M ? m?.content ?? "" : this.state.assistantDraft, fe = !!m?.content && !Z, B = T && (!ee || Z), Q = Sr(S), oe = B && Q ? "completed" : d ? "stopped" : B ? "failed" : null;
3089
- if (!T && Ar(this.state.messages, g))
3098
+ ), ee = M ? m?.content ?? "" : this.state.assistantDraft, fe = !!m?.content && !Z, B = T && (!ee || Z), Q = Ar(S), oe = B && Q ? "completed" : d ? "stopped" : B ? "failed" : null;
3099
+ if (!T && Rr(this.state.messages, g))
3090
3100
  return;
3091
- this.lastUserMessagePageUrl = Tr(g);
3101
+ this.lastUserMessagePageUrl = Mr(g);
3092
3102
  const j = B || d ? null : ut(g);
3093
3103
  if (this.latestRecoverableClientMessageId = j, Q && this.clearRetryTimers(), this.setState({
3094
3104
  sessionId: A(e.session, "id") ?? this.state.sessionId,
3095
3105
  messages: S,
3096
3106
  ...i ? {
3097
- activeScheduledFollowUps: Jt(
3107
+ activeScheduledFollowUps: Xt(
3098
3108
  e.activeScheduledFollowUps
3099
3109
  )
3100
3110
  } : {},
@@ -3161,14 +3171,14 @@ class Ne {
3161
3171
  this.options.backendUrl
3162
3172
  );
3163
3173
  t === this.sessionActivityRequestId && (this.sessionActivityRequestId = null), this.setState({
3164
- messages: gr(this.state.messages, i)
3174
+ messages: yr(this.state.messages, i)
3165
3175
  });
3166
3176
  return;
3167
3177
  }
3168
3178
  if (e.type === "sessions.page") {
3169
3179
  const t = typeof e.requestId == "string" ? e.requestId : null, n = t ? this.pendingSessionHistoryRequests.get(t) : null;
3170
3180
  t && n && (window.clearTimeout(n.timeout), this.pendingSessionHistoryRequests.delete(t), n.resolve({
3171
- sessions: nr(e.sessions),
3181
+ sessions: or(e.sessions),
3172
3182
  nextCursor: typeof e.nextCursor == "string" ? e.nextCursor : null
3173
3183
  }));
3174
3184
  return;
@@ -3203,19 +3213,19 @@ class Ne {
3203
3213
  }
3204
3214
  const n = Ue(e.item, this.options.backendUrl);
3205
3215
  if (n) {
3206
- const i = vr(t, n), r = n.callId ? this.pendingToolLoadingByCallId.get(n.callId) : void 0;
3207
- n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)), F(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), kr(t) && this.clearRunAckResyncRetryTimer();
3216
+ const i = qr(t, n), r = n.callId ? this.pendingToolLoadingByCallId.get(n.callId) : void 0;
3217
+ n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)), W(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), _r(t) && this.clearRunAckResyncRetryTimer();
3208
3218
  const o = de(this.state.messages, n), a = ss(o), l = ns(
3209
3219
  t,
3210
3220
  this.state.assistantDraft,
3211
3221
  this.state.assistantDraftItemId,
3212
3222
  this.state.assistantDraftRespondsToUserMessageId,
3213
3223
  this.state.assistantDraftRunId,
3214
- Ps(
3224
+ vs(
3215
3225
  o,
3216
3226
  o.findIndex((d) => d.id === n.id)
3217
3227
  )
3218
- ), c = a && (!this.state.assistantDraft || l), u = De(n) && (c || F(n) && !this.state.isThinking && this.activeClientMessageId === null);
3228
+ ), c = a && (!this.state.assistantDraft || l), u = De(n) && (c || W(n) && !this.state.isThinking && this.activeClientMessageId === null);
3219
3229
  this.setState({
3220
3230
  messages: o,
3221
3231
  ...l ? {
@@ -3380,13 +3390,13 @@ class Ne {
3380
3390
  return;
3381
3391
  }
3382
3392
  o && i && r && (this.retryableClientMessageId = r);
3383
- const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l = Ni(a.message);
3393
+ const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l = Fi(a.message);
3384
3394
  l && console.error(l);
3385
3395
  const c = r ?? this.activeClientMessageId, u = typeof e.runId == "string" ? e.runId : null, d = rs(
3386
3396
  this.state.messages,
3387
3397
  c,
3388
3398
  u
3389
- ), g = Ir(
3399
+ ), g = wr(
3390
3400
  d,
3391
3401
  c,
3392
3402
  u
@@ -3417,7 +3427,7 @@ class Ne {
3417
3427
  }
3418
3428
  applyAccountSubmissionError(e) {
3419
3429
  if (!this.account || !e) return;
3420
- const t = wn(this.account.submissionGate, e);
3430
+ const t = bn(this.account.submissionGate, e);
3421
3431
  if (!(t === this.account.submissionGate || t.allowed)) {
3422
3432
  this.account = {
3423
3433
  ...this.account,
@@ -3433,7 +3443,7 @@ class Ne {
3433
3443
  this.options.model = Ve(n) ? n : "gpt-5.6-sol";
3434
3444
  }
3435
3445
  updateAccountFallbackFromSession(e) {
3436
- const t = e && typeof e == "object" ? e.metadata : null, n = An(t);
3446
+ const t = e && typeof e == "object" ? e.metadata : null, n = Rn(t);
3437
3447
  if (this.usingPaidCreditFallback !== n && (this.usingPaidCreditFallback = n, !!this.account)) {
3438
3448
  this.account = { ...this.account, usingPaidCreditFallback: n };
3439
3449
  for (const i of this.accountListeners) i(this.getAccount());
@@ -3553,7 +3563,7 @@ class Ne {
3553
3563
  }
3554
3564
  e.type === "error" && typeof e.requestId != "string" && !is(e, t) && this.rememberSessionTimeline(
3555
3565
  t,
3556
- _r(n, e)
3566
+ Ur(n, e)
3557
3567
  );
3558
3568
  }
3559
3569
  }
@@ -3651,7 +3661,7 @@ class Ne {
3651
3661
  e.clear();
3652
3662
  }
3653
3663
  markThinkingProgress() {
3654
- !this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(Vn), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
3664
+ !this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(Yn), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
3655
3665
  }
3656
3666
  scheduleThinkingWatchdog(e) {
3657
3667
  this.thinkingWatchdogTimer !== null && window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = window.setTimeout(() => {
@@ -3715,13 +3725,13 @@ class Ne {
3715
3725
  if (this.state.status === "closed" || this.pendingClientMessageId !== e || !this.pendingUserMessageEvent)
3716
3726
  return;
3717
3727
  const t = this.retryAttemptsByClientMessageId[e] ?? 0;
3718
- if (t >= Xn) {
3728
+ if (t >= ei) {
3719
3729
  this.failPendingDelivery(e);
3720
3730
  return;
3721
3731
  }
3722
3732
  t === 0 && this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.retryAttemptsByClientMessageId[e] = t + 1, this.setState({ pendingMessageStatus: "reconnecting" }), this.pendingDeliveryRetryTimer = window.setTimeout(() => {
3723
3733
  this.pendingDeliveryRetryTimer = null, !(this.pendingClientMessageId !== e || !this.pendingUserMessageEvent) && (this.send(this.pendingUserMessageEvent), this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(e));
3724
- }, di(t, ti));
3734
+ }, gi(t, ii));
3725
3735
  }
3726
3736
  failPendingDelivery(e) {
3727
3737
  if (this.pendingClientMessageId !== e)
@@ -3734,7 +3744,7 @@ class Ne {
3734
3744
  ...this.state.isThinking ? {} : { turnPhase: null },
3735
3745
  isRetrying: !1,
3736
3746
  ...this.state.isThinking ? {} : { taskStatus: "failed" },
3737
- lastError: Zn,
3747
+ lastError: si,
3738
3748
  lastErrorCode: "message_delivery_failed"
3739
3749
  });
3740
3750
  }
@@ -3778,7 +3788,7 @@ class Ne {
3778
3788
  !this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== e || (b("web-sdk.agent", "Pluno run ack missed; resyncing session", {
3779
3789
  sessionId: this.state.sessionId,
3780
3790
  clientMessageId: e
3781
- }), this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(Ft));
3791
+ }), this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(Wt));
3782
3792
  }
3783
3793
  clearRunAckResyncRetryTimer() {
3784
3794
  this.runAckResyncRetryTimer !== null && (window.clearTimeout(this.runAckResyncRetryTimer), this.runAckResyncRetryTimer = null);
@@ -3801,7 +3811,7 @@ class Ne {
3801
3811
  ),
3802
3812
  isThinking: !1,
3803
3813
  taskStatus: "failed",
3804
- lastError: Yn,
3814
+ lastError: ti,
3805
3815
  lastErrorCode: "run_recovery_exhausted"
3806
3816
  }), this.clearThinkingWatchdog();
3807
3817
  return;
@@ -3811,7 +3821,7 @@ class Ne {
3811
3821
  sessionId: this.state.sessionId,
3812
3822
  clientMessageId: e,
3813
3823
  resyncAttempts: t + 1
3814
- }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(Ft);
3824
+ }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(Wt);
3815
3825
  }
3816
3826
  resyncThinkingSession() {
3817
3827
  this.state.sessionId ? this.send({
@@ -3828,7 +3838,7 @@ class Ne {
3828
3838
  if (!t || !n || !i)
3829
3839
  return;
3830
3840
  const a = i === "execute_code", l = i === "execute_code_in_browser_tab" && o !== null && typeof o == "object" && o.tabId === "local:current";
3831
- if (!a && !l || !Zr(o)) {
3841
+ if (!a && !l || !so(o)) {
3832
3842
  this.setToolMessageLoading(n, !1), this.send({
3833
3843
  type: "tool.result",
3834
3844
  sessionId: t,
@@ -3877,7 +3887,7 @@ class Ne {
3877
3887
  let c = null, u;
3878
3888
  c = await this.executeRuntimeHelper(), u = await Gt(
3879
3889
  o,
3880
- Di(e.runtimeContext, this.options.backendUrl)
3890
+ xi(e.runtimeContext, this.options.backendUrl)
3881
3891
  ).catch((d) => ({
3882
3892
  ok: !1,
3883
3893
  exception: {
@@ -3890,7 +3900,7 @@ class Ne {
3890
3900
  toolName: i,
3891
3901
  summary: o.summary,
3892
3902
  rawInput: L(o),
3893
- rawOutput: L(Zi(u, c))
3903
+ rawOutput: L(sr(u, c))
3894
3904
  }), ls(this.options.clientId, this.activeBrowserToolCalls.values()));
3895
3905
  }
3896
3906
  setToolMessageLoading(e, t) {
@@ -3905,17 +3915,17 @@ class Ne {
3905
3915
  if (this.pageLifecycleCleanup)
3906
3916
  return;
3907
3917
  const e = () => {
3908
- Us(this.options.clientId, this.activeBrowserToolCalls.values());
3918
+ Ds(this.options.clientId, this.activeBrowserToolCalls.values());
3909
3919
  };
3910
3920
  window.addEventListener("pagehide", e), window.addEventListener("beforeunload", e), this.pageLifecycleCleanup = () => {
3911
3921
  window.removeEventListener("pagehide", e), window.removeEventListener("beforeunload", e);
3912
3922
  };
3913
3923
  }
3914
3924
  installSessionBrowserApis() {
3915
- this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = Mi();
3925
+ this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = Ei();
3916
3926
  }
3917
3927
  cleanupSessionBrowserApis() {
3918
- this.sessionBrowserApisCleanup && (vi(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
3928
+ this.sessionBrowserApisCleanup && (qi(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
3919
3929
  }
3920
3930
  async executeRuntimeHelper() {
3921
3931
  if (!this.runtimeHelperJavascript?.trim())
@@ -3923,15 +3933,15 @@ class Ne {
3923
3933
  const e = await Gt({
3924
3934
  javascript: this.runtimeHelperJavascript
3925
3935
  });
3926
- return e.ok === !1 ? er(e) : null;
3936
+ return e.ok === !1 ? nr(e) : null;
3927
3937
  }
3928
3938
  enableNetworkCapture() {
3929
- this.networkCaptureCleanup || (this.networkCaptureCleanup = mi((e) => {
3930
- ro(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
3939
+ this.networkCaptureCleanup || (this.networkCaptureCleanup = Si((e) => {
3940
+ lo(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
3931
3941
  }));
3932
3942
  }
3933
3943
  enqueueNetworkEvent(e) {
3934
- this.queuedNetworkEvents.length >= ni || (this.queuedNetworkEvents.push(io(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
3944
+ this.queuedNetworkEvents.length >= oi || (this.queuedNetworkEvents.push(ao(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
3935
3945
  this.networkBatchTimer = null;
3936
3946
  const t = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
3937
3947
  t.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
@@ -3940,14 +3950,14 @@ class Ne {
3940
3950
  page: _(),
3941
3951
  events: t
3942
3952
  });
3943
- }, si)));
3953
+ }, ri)));
3944
3954
  }
3945
3955
  scheduleReconnect(e = 0) {
3946
3956
  if (this.reconnectTimer !== null || this.state.status === "closed")
3947
3957
  return;
3948
3958
  const t = Math.min(
3949
3959
  ot,
3950
- Math.max(hi(this.reconnectAttempts), e)
3960
+ Math.max(fi(this.reconnectAttempts), e)
3951
3961
  );
3952
3962
  this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
3953
3963
  this.reconnectTimer = null, this.connect().catch((n) => {
@@ -3964,8 +3974,8 @@ class Ne {
3964
3974
  const e = this.socket;
3965
3975
  !e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
3966
3976
  this.socket === e && (b("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
3967
- }, Wn));
3968
- }, Bn);
3977
+ }, jn));
3978
+ }, $n);
3969
3979
  }
3970
3980
  stopHeartbeat() {
3971
3981
  this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
@@ -4003,12 +4013,12 @@ class Ne {
4003
4013
  ...e.lastError === null && e.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
4004
4014
  ...e.lastError !== void 0 && e.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
4005
4015
  }, a = this.state.sessionId, l = this.state.isThinking || this.state.pendingMessageStatus !== null, c = o.isThinking || o.pendingMessageStatus !== null, u = this.activeClientMessageId ?? this.pendingClientMessageId;
4006
- u && u === this.lastProjectedTurnClientMessageId && c && Ti(this.lastProjectedTurnPhase, o.turnPhase) && this.reportHealthSignal("invalid_state_transition", {
4016
+ u && u === this.lastProjectedTurnClientMessageId && c && Mi(this.lastProjectedTurnPhase, o.turnPhase) && this.reportHealthSignal("invalid_state_transition", {
4007
4017
  clientMessageId: u,
4008
4018
  reason: "active_turn_phase_moved_backward",
4009
4019
  previousPhase: this.lastProjectedTurnPhase,
4010
4020
  nextPhase: o.turnPhase
4011
- }), this.state = o, this.lastProjectedTurnClientMessageId = u, this.lastProjectedTurnPhase = o.turnPhase, o.sessionId && (o.sessionId === a && c !== l || o.sessionId !== a && c) && this.sessionHistoryManager.setActivity(o.sessionId, c), this.rebuildRuntimeInteractions(), e.messages !== void 0 && this.refreshRuntimeInteractions(), this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages), Wr(this.options.clientId, this.state), this.emit("state", this.getState()), Se("state", this.state.status, {
4021
+ }), this.state = o, this.lastProjectedTurnClientMessageId = u, this.lastProjectedTurnPhase = o.turnPhase, o.sessionId && (o.sessionId === a && c !== l || o.sessionId !== a && c) && this.sessionHistoryManager.setActivity(o.sessionId, c), this.rebuildRuntimeInteractions(), e.messages !== void 0 && this.refreshRuntimeInteractions(), this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages), jr(this.options.clientId, this.state), this.emit("state", this.getState()), Se("state", this.state.status, {
4012
4022
  status: this.state.status,
4013
4023
  sessionId: this.state.sessionId,
4014
4024
  messageCount: this.state.messages.length,
@@ -4067,13 +4077,13 @@ class Ne {
4067
4077
  }
4068
4078
  }
4069
4079
  const Ze = /* @__PURE__ */ new WeakMap();
4070
- function mi(s) {
4071
- const e = window.__plunoProductAgentNetworkCapture ?? yi();
4080
+ function Si(s) {
4081
+ const e = window.__plunoProductAgentNetworkCapture ?? Ti();
4072
4082
  return e.subscribers.add(s), () => {
4073
4083
  e.subscribers.delete(s), !(e.subscribers.size > 0) && (e.destroy(), window.__plunoProductAgentNetworkCapture === e && delete window.__plunoProductAgentNetworkCapture);
4074
4084
  };
4075
4085
  }
4076
- function yi() {
4086
+ function Ti() {
4077
4087
  const s = /* @__PURE__ */ new Set(), e = (g) => {
4078
4088
  s.forEach((f) => {
4079
4089
  try {
@@ -4090,11 +4100,11 @@ function yi() {
4090
4100
  throw m;
4091
4101
  }
4092
4102
  try {
4093
- const m = f instanceof Request ? f : null, M = eo(f, m), w = xs(h?.headers ?? m?.headers);
4103
+ const m = f instanceof Request ? f : null, M = no(f, m), w = Ls(h?.headers ?? m?.headers);
4094
4104
  if (!te(M, w, h?.body)) {
4095
4105
  const H = {
4096
4106
  requestId: nt("fetch"),
4097
- url: W(M, Ye),
4107
+ url: F(M, Ye),
4098
4108
  method: (h?.method ?? m?.method ?? "GET").toUpperCase(),
4099
4109
  requestHeaders: w,
4100
4110
  requestBody: us(h?.body),
@@ -4103,7 +4113,7 @@ function yi() {
4103
4113
  };
4104
4114
  y.then(
4105
4115
  (S) => {
4106
- to(S, H, p, e).catch(() => {
4116
+ io(S, H, p, e).catch(() => {
4107
4117
  e({
4108
4118
  ...H,
4109
4119
  responseStatus: S.status,
@@ -4114,7 +4124,7 @@ function yi() {
4114
4124
  (S) => {
4115
4125
  e({
4116
4126
  ...H,
4117
- errorText: W(S instanceof Error ? S.message : String(S)),
4127
+ errorText: F(S instanceof Error ? S.message : String(S)),
4118
4128
  durationMs: Date.now() - p
4119
4129
  });
4120
4130
  }
@@ -4128,7 +4138,7 @@ function yi() {
4128
4138
  return Ze.set(this, {
4129
4139
  requestId: nt("xhr"),
4130
4140
  method: String(f ?? "GET").toUpperCase(),
4131
- url: W(w, Ye),
4141
+ url: F(w, Ye),
4132
4142
  requestHeaders: {},
4133
4143
  startedAtMs: Date.now(),
4134
4144
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -4145,7 +4155,7 @@ function yi() {
4145
4155
  () => {
4146
4156
  queueMicrotask(() => {
4147
4157
  try {
4148
- const p = ao(this.getAllResponseHeaders());
4158
+ const p = uo(this.getAllResponseHeaders());
4149
4159
  e({
4150
4160
  requestId: h.requestId,
4151
4161
  url: h.url,
@@ -4155,7 +4165,7 @@ function yi() {
4155
4165
  resourceType: "xhr",
4156
4166
  responseStatus: this.status,
4157
4167
  responseHeaders: p,
4158
- responseBody: no(this, p),
4168
+ responseBody: oo(this, p),
4159
4169
  errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
4160
4170
  startedAt: h.startedAt,
4161
4171
  durationMs: Date.now() - h.startedAtMs
@@ -4197,7 +4207,7 @@ function yi() {
4197
4207
  const p = performance.timeOrigin + h.startTime;
4198
4208
  e({
4199
4209
  requestId: nt("resource"),
4200
- url: W(h.name, Ye),
4210
+ url: F(h.name, Ye),
4201
4211
  method: "GET",
4202
4212
  resourceType: "resource",
4203
4213
  responseStatus: h.responseStatus,
@@ -4251,10 +4261,10 @@ function Kt(s) {
4251
4261
  const e = typeof s == "function" ? s() : s;
4252
4262
  return e && Object.keys(e).length > 0 ? e : void 0;
4253
4263
  }
4254
- function Ii(s) {
4264
+ function wi(s) {
4255
4265
  return s.type === "run.model_started" || s.type === "conversation.state" || s.type === "session.updated" || s.type === "session.item" || s.type === "chat.assistant_delta" || s.type === "chat.assistant_done" || s.type === "tool.call";
4256
4266
  }
4257
- function Si(s) {
4267
+ function Ai(s) {
4258
4268
  if (s.type === "chat.assistant_delta")
4259
4269
  return typeof s.delta == "string" && s.delta.trim().length > 0;
4260
4270
  if (s.type === "tool.call")
@@ -4264,7 +4274,7 @@ function Si(s) {
4264
4274
  const e = C(s.item);
4265
4275
  return e ? e.type === "message" && e.role === "assistant" ? typeof e.content == "string" && e.content.trim().length > 0 : e.type === "tool_call" || e.type === "function_call" : !1;
4266
4276
  }
4267
- function Ti(s, e) {
4277
+ function Mi(s, e) {
4268
4278
  if (!s || !e)
4269
4279
  return !1;
4270
4280
  const t = {
@@ -4292,31 +4302,31 @@ function K(s) {
4292
4302
  }
4293
4303
  return null;
4294
4304
  }
4295
- const wi = 5e3, Ai = 12e4;
4296
- function Mi() {
4305
+ const bi = 5e3, Ri = 12e4;
4306
+ function Ei() {
4297
4307
  const s = [
4298
- Ri(),
4299
- bi()
4308
+ Ci(),
4309
+ ki()
4300
4310
  ].filter((e) => typeof e == "function");
4301
4311
  return () => {
4302
4312
  for (const e of s.reverse())
4303
4313
  e();
4304
4314
  };
4305
4315
  }
4306
- function bi() {
4307
- return hs(globalThis, "getPageSnapshot", async () => At());
4316
+ function ki() {
4317
+ return ps(globalThis, "getPageSnapshot", async () => At());
4308
4318
  }
4309
- function Ri() {
4310
- return hs(globalThis, "pageImages", {
4311
- inspectImage: async (e, t) => await ki(e, t)
4319
+ function Ci() {
4320
+ return ps(globalThis, "pageImages", {
4321
+ inspectImage: async (e, t) => await _i(e, t)
4312
4322
  });
4313
4323
  }
4314
- async function ki(s, e = {}) {
4315
- const t = Pi(e.name), n = await Ei(s);
4324
+ async function _i(s, e = {}) {
4325
+ const t = Di(e.name), n = await Pi(s);
4316
4326
  return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
4317
4327
  type: "pluno.pageImages.inspectImage",
4318
4328
  imageAttached: !1,
4319
- imageAttachmentError: ws
4329
+ imageAttachmentError: As
4320
4330
  } : {
4321
4331
  type: "pluno.pageImages.inspectImage",
4322
4332
  imageAttached: !0,
@@ -4330,15 +4340,15 @@ async function ki(s, e = {}) {
4330
4340
  imageAttachmentError: n.error
4331
4341
  };
4332
4342
  }
4333
- async function Ei(s) {
4334
- return s instanceof Blob ? s.type.startsWith("image/") ? s.size === 0 ? { ok: !1, error: "Page image is empty." } : s.size > 8 * 1024 * 1024 ? { ok: !1, error: ws } : {
4343
+ async function Pi(s) {
4344
+ return s instanceof Blob ? s.type.startsWith("image/") ? s.size === 0 ? { ok: !1, error: "Page image is empty." } : s.size > 8 * 1024 * 1024 ? { ok: !1, error: As } : {
4335
4345
  ok: !0,
4336
4346
  mimeType: s.type,
4337
4347
  sizeBytes: s.size,
4338
- dataUrl: await Ui(s)
4339
- } : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof s != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : Ci(s);
4348
+ dataUrl: await Oi(s)
4349
+ } : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof s != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : vi(s);
4340
4350
  }
4341
- function Ci(s) {
4351
+ function vi(s) {
4342
4352
  if (!s.startsWith("data:") || !s.includes(","))
4343
4353
  return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
4344
4354
  const [e, t] = s.slice(5).split(",", 2), n = e.split(";").map((a) => a.trim()).filter(Boolean), i = n[0] ?? "";
@@ -4349,7 +4359,7 @@ function Ci(s) {
4349
4359
  const r = t.replace(/[ \t\r\n\f]+/g, "");
4350
4360
  if (!/^[A-Za-z0-9+/]*={0,2}$/.test(r))
4351
4361
  return { ok: !1, error: "Page image data URL has invalid base64." };
4352
- const o = _i(r);
4362
+ const o = Ui(r);
4353
4363
  return o === null ? { ok: !1, error: "Page image data URL has invalid base64." } : o === 0 ? { ok: !1, error: "Page image is empty." } : {
4354
4364
  ok: !0,
4355
4365
  mimeType: i,
@@ -4357,22 +4367,22 @@ function Ci(s) {
4357
4367
  dataUrl: `data:${i};base64,${r}`
4358
4368
  };
4359
4369
  }
4360
- function _i(s) {
4370
+ function Ui(s) {
4361
4371
  if (s.length === 0 || s.length % 4 !== 0)
4362
4372
  return null;
4363
4373
  const e = s.length - s.replace(/=+$/, "").length;
4364
4374
  return e > 2 ? null : s.length / 4 * 3 - e;
4365
4375
  }
4366
- function Pi(s) {
4376
+ function Di(s) {
4367
4377
  return (typeof s == "string" ? s.trim() : "") || "Page image";
4368
4378
  }
4369
- function vi(s) {
4379
+ function qi(s) {
4370
4380
  try {
4371
4381
  s();
4372
4382
  } catch {
4373
4383
  }
4374
4384
  }
4375
- function Ui(s) {
4385
+ function Oi(s) {
4376
4386
  return new Promise((e, t) => {
4377
4387
  const n = new FileReader();
4378
4388
  n.onload = () => {
@@ -4386,7 +4396,7 @@ function Ui(s) {
4386
4396
  }
4387
4397
  async function Gt(s, e) {
4388
4398
  const t = Object.getPrototypeOf(async function() {
4389
- }).constructor, n = s.timeoutMs ?? wi, i = Date.now(), r = [];
4399
+ }).constructor, n = s.timeoutMs ?? bi, i = Date.now(), r = [];
4390
4400
  let o;
4391
4401
  const a = {
4392
4402
  log: console.log,
@@ -4404,7 +4414,7 @@ async function Gt(s, e) {
4404
4414
  o = window.setTimeout(() => d(c), n);
4405
4415
  })
4406
4416
  ]);
4407
- return u === c ? qi(n) : {
4417
+ return u === c ? Li(n) : {
4408
4418
  ok: !0,
4409
4419
  result: u,
4410
4420
  console: r,
@@ -4433,7 +4443,7 @@ async function Gt(s, e) {
4433
4443
  e?.deactivate(), o !== void 0 && window.clearTimeout(o), console.log = a.log, console.info = a.info, console.warn = a.warn, console.error = a.error;
4434
4444
  }
4435
4445
  }
4436
- function Di(s, e) {
4446
+ function xi(s, e) {
4437
4447
  if (!s || typeof s != "object")
4438
4448
  return;
4439
4449
  const t = s.sandboxFilesToken;
@@ -4443,7 +4453,7 @@ function Di(s, e) {
4443
4453
  const i = () => {
4444
4454
  if (!n)
4445
4455
  throw new Error("sandboxFiles is only available during browser-code execution");
4446
- }, r = async (a, l) => await vn(`${e.replace(/\/$/, "")}${a}`, l);
4456
+ }, r = async (a, l) => await qn(`${e.replace(/\/$/, "")}${a}`, l);
4447
4457
  return {
4448
4458
  value: Object.freeze({
4449
4459
  upload: async (a) => {
@@ -4477,7 +4487,7 @@ function Di(s, e) {
4477
4487
  }
4478
4488
  };
4479
4489
  }
4480
- function qi(s) {
4490
+ function Li(s) {
4481
4491
  return {
4482
4492
  ok: !1,
4483
4493
  exception: {
@@ -4491,10 +4501,10 @@ function qi(s) {
4491
4501
  }
4492
4502
  };
4493
4503
  }
4494
- function Oi(s) {
4504
+ function Ni(s) {
4495
4505
  return s.replace(/\/+$/, "");
4496
4506
  }
4497
- function xi(s) {
4507
+ function Hi(s) {
4498
4508
  const e = {
4499
4509
  sidepanel: "extension_sidepanel",
4500
4510
  browser_extension_page_ui: "extension_widget",
@@ -4506,13 +4516,13 @@ function xi(s) {
4506
4516
  };
4507
4517
  return s && s in e ? e[s] : s ?? "embedded_custom_ui";
4508
4518
  }
4509
- function Li(s) {
4519
+ function Bi(s) {
4510
4520
  return s === "pluno" ? "scheduled_continuation" : s ?? "user";
4511
4521
  }
4512
- function Ni(s, e = location.origin) {
4522
+ function Fi(s, e = location.origin) {
4513
4523
  return /origin (?:is not allowed|does not match browser origin)/i.test(s) ? `Pluno widget blocked on ${e}: this domain is not allowed. Add ${e} in Pluno under Integration > Domains.` : null;
4514
4524
  }
4515
- function Hi(s) {
4525
+ function Wi(s) {
4516
4526
  const e = new URL("/api/product-agent/embed/ws", s);
4517
4527
  return e.protocol = e.protocol === "https:" ? "wss:" : "ws:", e.toString();
4518
4528
  }
@@ -4525,19 +4535,19 @@ function _() {
4525
4535
  ...s ? { plunoProductAgentUi: s } : {}
4526
4536
  };
4527
4537
  }
4528
- function Bi() {
4538
+ function $i() {
4529
4539
  return {
4530
4540
  pageUrl: location.href,
4531
4541
  pageTitle: document.title,
4532
4542
  htmlContent: At()
4533
4543
  };
4534
4544
  }
4535
- function Wi(s) {
4536
- return Ce.add(s), we || (we = Fi()), () => {
4545
+ function ji(s) {
4546
+ return Ce.add(s), we || (we = zi()), () => {
4537
4547
  Ce.delete(s), Ce.size === 0 && (we?.(), we = null);
4538
4548
  };
4539
4549
  }
4540
- function Fi() {
4550
+ function zi() {
4541
4551
  const s = () => {
4542
4552
  for (const r of Array.from(Ce))
4543
4553
  r();
@@ -4564,16 +4574,16 @@ function At() {
4564
4574
  };
4565
4575
  t("Selected text", window.getSelection()?.toString() ?? "");
4566
4576
  const n = "[role='dialog'], [role='alertdialog'], dialog[open], [aria-modal='true']", i = Array.from(document.querySelectorAll(n)).filter(
4567
- (p) => Ms(p) && !p.parentElement?.closest(n)
4577
+ (p) => bs(p) && !p.parentElement?.closest(n)
4568
4578
  );
4569
4579
  for (const p of i.slice(0, 3))
4570
4580
  t("Active overlay", tt(he(p), e));
4571
- const r = $i(), o = r ? tt(he(r), e) : "";
4581
+ const r = Ki(), o = r ? tt(he(r), e) : "";
4572
4582
  t("Main page content", o), t("Additional visible page text", tt(he(document.body), e));
4573
4583
  const a = s.map(([p, y]) => `${p}:
4574
4584
  ${y}`).join(`
4575
4585
 
4576
- `).trim().slice(0, 12e3), l = ji(i, r).trim(), c = `Simplified DOM outline:
4586
+ `).trim().slice(0, 12e3), l = Gi(i, r).trim(), c = `Simplified DOM outline:
4577
4587
  `, u = `
4578
4588
 
4579
4589
  Visible page text:
@@ -4597,14 +4607,14 @@ function tt(s, e) {
4597
4607
  t = t.replace(n, "");
4598
4608
  return ne(t);
4599
4609
  }
4600
- function Ms(s) {
4610
+ function bs(s) {
4601
4611
  const e = window.getComputedStyle(s);
4602
4612
  return e.display !== "none" && e.visibility !== "hidden" && s.getClientRects().length > 0;
4603
4613
  }
4604
- function $i() {
4605
- return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Ms).sort((s, e) => he(e).length - he(s).length)[0] ?? null;
4614
+ function Ki() {
4615
+ return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(bs).sort((s, e) => he(e).length - he(s).length)[0] ?? null;
4606
4616
  }
4607
- function ji(s, e) {
4617
+ function Gi(s, e) {
4608
4618
  const t = /* @__PURE__ */ new Set([
4609
4619
  "main",
4610
4620
  "nav",
@@ -4684,7 +4694,7 @@ function ji(s, e) {
4684
4694
  "data-test",
4685
4695
  "data-qa",
4686
4696
  "data-cy"
4687
- ], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: u, priorityTargets: d } = zi(), g = new Set(s);
4697
+ ], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: u, priorityTargets: d } = Qi(), g = new Set(s);
4688
4698
  e && g.add(e);
4689
4699
  let f = 0;
4690
4700
  const h = (w) => {
@@ -4699,7 +4709,7 @@ function ji(s, e) {
4699
4709
  if (f >= 1e3 && !Y || H.has(T) || r.has(v) || T.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || re.display === "none" || re.visibility === "hidden")
4700
4710
  return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
4701
4711
  f += 1;
4702
- const Z = h(T), ee = Rs(T), fe = a.has(Z) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(v) || v === "a" && T.hasAttribute("href"), B = Array.from(T.children).filter((I) => I instanceof HTMLElement), Q = /* @__PURE__ */ new Map();
4712
+ const Z = h(T), ee = Es(T), fe = a.has(Z) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(v) || v === "a" && T.hasAttribute("href"), B = Array.from(T.children).filter((I) => I instanceof HTMLElement), Q = /* @__PURE__ */ new Map();
4703
4713
  for (const I of B) {
4704
4714
  const R = p(I);
4705
4715
  Q.set(R, (Q.get(R) ?? 0) + 1);
@@ -4709,7 +4719,7 @@ function ji(s, e) {
4709
4719
  const R = p(I), z = oe.get(R) ?? 0;
4710
4720
  oe.set(R, z + 1), (Q.get(R) ?? 0) > 8 && z >= 6 && !u.has(I) && me.set(R, (me.get(R) ?? 0) + 1);
4711
4721
  }
4712
- const j = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Set(), q = [], kt = [];
4722
+ const j = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Set(), q = [], Et = [];
4713
4723
  for (const I of B) {
4714
4724
  const R = p(I), z = Q.get(R) ?? 0, _t = j.get(R) ?? 0;
4715
4725
  if (j.set(R, _t + 1), z > 8 && _t >= 6 && !u.has(I)) {
@@ -4717,22 +4727,22 @@ function ji(s, e) {
4717
4727
  continue;
4718
4728
  }
4719
4729
  const Pt = S(I, N);
4720
- kt.push(Pt), q.push(Pt.lines);
4730
+ Et.push(Pt), q.push(Pt.lines);
4721
4731
  }
4722
- const We = [];
4732
+ const Fe = [];
4723
4733
  if (T.shadowRoot)
4724
4734
  for (const I of Array.from(T.shadowRoot.children))
4725
- I instanceof HTMLElement && We.push(S(I, N + 1));
4726
- const ye = [...kt, ...We], Fe = ee.length > 0 || fe || ye.some((I) => I.hasUsefulContent), Et = ne(
4735
+ I instanceof HTMLElement && Fe.push(S(I, N + 1));
4736
+ const ye = [...Et, ...Fe], We = ee.length > 0 || fe || ye.some((I) => I.hasUsefulContent), kt = ne(
4727
4737
  [ee, ...ye.map((I) => I.textPreview)].filter(Boolean).join(" ")
4728
- ).slice(0, 180), js = T.hasAttribute("contenteditable") && (ee.length > 0 || !T.querySelector("[contenteditable]")), Ct = c.some((I) => T.hasAttribute(I)) || !!Z || js, $e = (T.getClientRects().length > 0 || re.display === "contents") && (t.has(v) || Ct || Y) && (Fe || Y) && (!i.has(v) || Fe || Ct || Y), je = $e ? 1 : 0, ae = [];
4738
+ ).slice(0, 180), zs = T.hasAttribute("contenteditable") && (ee.length > 0 || !T.querySelector("[contenteditable]")), Ct = c.some((I) => T.hasAttribute(I)) || !!Z || zs, $e = (T.getClientRects().length > 0 || re.display === "contents") && (t.has(v) || Ct || Y) && (We || Y) && (!i.has(v) || We || Ct || Y), je = $e ? 1 : 0, ae = [];
4729
4739
  if ($e) {
4730
- const I = ye.some((z) => z.containsTextElement), R = n.has(v) && !I ? Et : ee;
4731
- ae.push(bs(T, l, o, R.slice(0, 180)));
4740
+ const I = ye.some((z) => z.containsTextElement), R = n.has(v) && !I ? kt : ee;
4741
+ ae.push(Rs(T, l, o, R.slice(0, 180)));
4732
4742
  }
4733
4743
  for (const I of q)
4734
4744
  ae.push(...Ae(I, je));
4735
- const ze = We.flatMap((I) => I.lines);
4745
+ const ze = Fe.flatMap((I) => I.lines);
4736
4746
  if (ze.length > 0) {
4737
4747
  const I = ze.slice(0, 20);
4738
4748
  ze.length > I.length && I.push("… shadow DOM omitted");
@@ -4745,8 +4755,8 @@ function ji(s, e) {
4745
4755
  }
4746
4756
  return {
4747
4757
  lines: ae,
4748
- hasUsefulContent: Fe,
4749
- textPreview: Et,
4758
+ hasUsefulContent: We,
4759
+ textPreview: kt,
4750
4760
  containsTextElement: n.has(v) || ye.some((I) => I.containsTextElement)
4751
4761
  };
4752
4762
  };
@@ -4754,7 +4764,7 @@ function ji(s, e) {
4754
4764
  `);
4755
4765
  }, m = [], M = ne(window.getSelection()?.toString() ?? "");
4756
4766
  M && m.push(`--- selected text ---
4757
- ${JSON.stringify(M)}`), d.length > 0 && m.push(Ki(d, t, l, o));
4767
+ ${JSON.stringify(M)}`), d.length > 0 && m.push(Vi(d, t, l, o));
4758
4768
  for (const w of s.slice(0, 3))
4759
4769
  m.push(y(w, "active overlay DOM", /* @__PURE__ */ new Set()));
4760
4770
  if (e && m.push(y(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
@@ -4765,11 +4775,11 @@ ${JSON.stringify(M)}`), d.length > 0 && m.push(Ki(d, t, l, o));
4765
4775
 
4766
4776
  `);
4767
4777
  }
4768
- function bs(s, e, t, n) {
4778
+ function Rs(s, e, t, n) {
4769
4779
  const i = s.tagName.toLowerCase();
4770
4780
  let r = i;
4771
4781
  const o = s.getAttribute("id");
4772
- o && Gi(o) && (r += `#${o}`);
4782
+ o && Xi(o) && (r += `#${o}`);
4773
4783
  for (const a of e) {
4774
4784
  const l = s.getAttribute(a);
4775
4785
  l && l.length <= 160 && (a !== "role" || !t.has(l)) && (r += `[${a}=${JSON.stringify(l)}]`);
@@ -4782,7 +4792,7 @@ function bs(s, e, t, n) {
4782
4792
  s.hasAttribute(a) && (r += `[${a}]`);
4783
4793
  return `${r}${n ? ` ${JSON.stringify(n)}` : ""}`;
4784
4794
  }
4785
- function zi() {
4795
+ function Qi() {
4786
4796
  const s = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), t = (a, l) => {
4787
4797
  if (!a)
4788
4798
  return;
@@ -4825,7 +4835,7 @@ function zi() {
4825
4835
  priorityTargets: Array.from(e, ([a, l]) => ({ element: a, labels: Array.from(l) }))
4826
4836
  };
4827
4837
  }
4828
- function Ki(s, e, t, n) {
4838
+ function Vi(s, e, t, n) {
4829
4839
  const i = ["--- active/current elements ---"];
4830
4840
  for (const r of s) {
4831
4841
  const o = [];
@@ -4836,11 +4846,11 @@ function Ki(s, e, t, n) {
4836
4846
  const d = a.getRootNode();
4837
4847
  a = a.parentElement ?? (d instanceof ShadowRoot && d.host instanceof HTMLElement ? d.host : null);
4838
4848
  }
4839
- const l = o.length > 6 ? [o[0], ...o.slice(-5)] : o, c = l.map((u, d) => bs(
4849
+ const l = o.length > 6 ? [o[0], ...o.slice(-5)] : o, c = l.map((u, d) => Rs(
4840
4850
  u,
4841
4851
  t,
4842
4852
  n,
4843
- d === l.length - 1 ? Rs(u).slice(0, 180) : ""
4853
+ d === l.length - 1 ? Es(u).slice(0, 180) : ""
4844
4854
  ));
4845
4855
  o.length > l.length && c.splice(1, 0, "…"), i.push(`${r.labels.join(", ")}: ${c.join(" > ")}`);
4846
4856
  }
@@ -4856,17 +4866,17 @@ function Ae(s, e) {
4856
4866
  const t = " ".repeat(e);
4857
4867
  return s.map((n) => `${t}${n}`);
4858
4868
  }
4859
- function Rs(s) {
4869
+ function Es(s) {
4860
4870
  return ne(
4861
4871
  Array.from(s.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
4862
4872
  );
4863
4873
  }
4864
- function Gi(s) {
4874
+ function Xi(s) {
4865
4875
  return s.length <= 64 && /^[A-Za-z_][A-Za-z0-9_:.-]*$/.test(s) && !/[a-f0-9]{12,}/i.test(s) && !/:r[0-9a-z]+:/i.test(s);
4866
4876
  }
4867
4877
  function ks() {
4868
4878
  const s = Array.from(document.querySelectorAll(Ht)), e = s.find(
4869
- (r) => typeof r[On] == "string"
4879
+ (r) => typeof r[Nn] == "string"
4870
4880
  );
4871
4881
  if (!(e ?? s[0]))
4872
4882
  return;
@@ -4882,23 +4892,23 @@ function ks() {
4882
4892
  },
4883
4893
  {
4884
4894
  name: "widget_root",
4885
- selector: Un,
4895
+ selector: On,
4886
4896
  description: "Finds Pluno's widget root inside the widget host shadow root."
4887
4897
  },
4888
4898
  {
4889
4899
  name: "widget_panel",
4890
- selector: Dn,
4900
+ selector: xn,
4891
4901
  description: "Finds Pluno's open chat panel inside the widget host shadow root."
4892
4902
  },
4893
4903
  {
4894
4904
  name: "widget_timeline",
4895
- selector: qn,
4905
+ selector: Ln,
4896
4906
  description: "Finds Pluno's chat timeline inside the widget host shadow root."
4897
4907
  }
4898
4908
  ]
4899
4909
  };
4900
4910
  }
4901
- function Qi(s) {
4911
+ function Ji(s) {
4902
4912
  try {
4903
4913
  const e = JSON.parse(s);
4904
4914
  return e && typeof e == "object" ? e : { type: "error", message: "Invalid server event" };
@@ -4906,7 +4916,7 @@ function Qi(s) {
4906
4916
  return { type: "error", message: "Invalid server event" };
4907
4917
  }
4908
4918
  }
4909
- function Vi(s) {
4919
+ function Yi(s) {
4910
4920
  if (typeof s != "string")
4911
4921
  return null;
4912
4922
  try {
@@ -4922,7 +4932,7 @@ function Vt(s, e) {
4922
4932
  const t = s[e];
4923
4933
  return Array.isArray(t) ? t.filter((n) => typeof n == "string" && n.trim().length > 0) : [];
4924
4934
  }
4925
- function Jt(s) {
4935
+ function Xt(s) {
4926
4936
  return Array.isArray(s) ? s.flatMap((e) => {
4927
4937
  if (!e || typeof e != "object")
4928
4938
  return [];
@@ -4930,10 +4940,10 @@ function Jt(s) {
4930
4940
  return typeof t.taskId != "string" || !t.taskId || typeof t.dueAt != "string" || Number.isNaN(Date.parse(t.dueAt)) ? [] : [{ taskId: t.taskId, dueAt: t.dueAt }];
4931
4941
  }) : [];
4932
4942
  }
4933
- function Ji(s) {
4943
+ function Zi(s) {
4934
4944
  return Array.isArray(s) ? s.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
4935
4945
  }
4936
- function Xi(s) {
4946
+ function er(s) {
4937
4947
  if (!s || typeof s != "object")
4938
4948
  return null;
4939
4949
  const e = s, t = e.appearance, n = t && typeof t == "object" ? t : e, i = typeof n.accentColor == "string" ? n.accentColor : null, r = n.colorScheme === "dark" ? "dark" : n.colorScheme === "light" ? "light" : null, o = typeof n.fontFamily == "string" && n.fontFamily.trim() ? n.fontFamily : null, a = typeof n.scribbleStyle == "boolean" ? n.scribbleStyle : null;
@@ -4944,13 +4954,13 @@ function Xi(s) {
4944
4954
  ...a !== null ? { scribbleStyle: a } : {}
4945
4955
  };
4946
4956
  }
4947
- function Yi(s) {
4957
+ function tr(s) {
4948
4958
  if (!s || typeof s != "object")
4949
4959
  return null;
4950
4960
  const e = s.javascript;
4951
4961
  return typeof e != "string" || !e.trim() ? null : { javascript: e };
4952
4962
  }
4953
- function Zi(s, e) {
4963
+ function sr(s, e) {
4954
4964
  return e ? s && typeof s == "object" ? {
4955
4965
  ...s,
4956
4966
  helperError: e
@@ -4960,13 +4970,13 @@ function Zi(s, e) {
4960
4970
  helperError: e
4961
4971
  } : s;
4962
4972
  }
4963
- function er(s) {
4973
+ function nr(s) {
4964
4974
  if (!s || typeof s != "object")
4965
4975
  return s;
4966
4976
  const e = s;
4967
4977
  return typeof e.exception?.message == "string" ? e.exception.message : typeof e.error == "string" ? e.error : s;
4968
4978
  }
4969
- function tr() {
4979
+ function ir() {
4970
4980
  const s = "pluno.productAgent.clientId", e = window.localStorage.getItem(s);
4971
4981
  if (e)
4972
4982
  return e;
@@ -4976,7 +4986,7 @@ function tr() {
4976
4986
  function x() {
4977
4987
  return crypto.randomUUID();
4978
4988
  }
4979
- function sr(s) {
4989
+ function rr(s) {
4980
4990
  if (!s || typeof s != "object")
4981
4991
  return null;
4982
4992
  const e = s, t = typeof e.id == "string" ? e.id : null;
@@ -4992,7 +5002,7 @@ function st(s, e) {
4992
5002
  s.map((t) => Ue(t, e)).filter((t) => t !== null)
4993
5003
  ) : [];
4994
5004
  }
4995
- function nr(s) {
5005
+ function or(s) {
4996
5006
  return Array.isArray(s) ? s.flatMap((e) => {
4997
5007
  if (!e || typeof e != "object")
4998
5008
  return [];
@@ -5020,7 +5030,7 @@ function Ue(s, e) {
5020
5030
  if (!n || typeof n != "object")
5021
5031
  return null;
5022
5032
  const i = n;
5023
- if (i.hiddenFromTranscript === !0 || nn(i) || i.type === "tab_lifecycle_decision" && i.decision === "keep")
5033
+ if (i.hiddenFromTranscript === !0 || an(i) || i.type === "tab_lifecycle_decision" && i.decision === "keep")
5024
5034
  return null;
5025
5035
  if (i.type === "assistant_draft")
5026
5036
  return {
@@ -5028,14 +5038,14 @@ function Ue(s, e) {
5028
5038
  role: "assistant",
5029
5039
  ...i.phase === "commentary" || i.phase === "final_answer" ? { phase: i.phase } : {},
5030
5040
  content: vt(
5031
- Xt(i.content),
5041
+ Jt(i.content),
5032
5042
  e
5033
5043
  ),
5034
5044
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
5035
- ...E(i) !== null ? { displaySequence: E(i) } : {},
5045
+ ...k(i) !== null ? { displaySequence: k(i) } : {},
5036
5046
  ...P(i) !== null ? { causalSequence: P(i) } : {},
5037
5047
  respondsToUserMessageId: O(i) ?? void 0,
5038
- ...k(i) ? { runId: k(i) } : {},
5048
+ ...E(i) ? { runId: E(i) } : {},
5039
5049
  dataType: "assistant_draft",
5040
5050
  ...i.steered === !0 ? { steered: !0 } : {}
5041
5051
  };
@@ -5045,15 +5055,15 @@ function Ue(s, e) {
5045
5055
  role: r,
5046
5056
  ...i.phase === "commentary" || i.phase === "final_answer" ? { phase: i.phase } : {},
5047
5057
  content: vt(
5048
- Xt(i.content),
5058
+ Jt(i.content),
5049
5059
  e
5050
5060
  ),
5051
5061
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
5052
- ...E(i) !== null ? { displaySequence: E(i) } : {},
5062
+ ...k(i) !== null ? { displaySequence: k(i) } : {},
5053
5063
  ...P(i) !== null ? { causalSequence: P(i) } : {},
5054
5064
  respondsToUserMessageId: O(i) ?? void 0,
5055
- ...k(i) ? { runId: k(i) } : {},
5056
- attachments: Ds(i.attachments, e),
5065
+ ...E(i) ? { runId: E(i) } : {},
5066
+ attachments: qs(i.attachments, e),
5057
5067
  ...i.steered === !0 ? { steered: !0 } : {}
5058
5068
  };
5059
5069
  return r === "assistant" && typeof i.id == "string" && Object.defineProperty(o, "assistantDraftItemId", {
@@ -5068,47 +5078,47 @@ function Ue(s, e) {
5068
5078
  }), o;
5069
5079
  }
5070
5080
  if (i.type === "function_call_output") {
5071
- const r = Zs(i.output);
5081
+ const r = sn(i.output);
5072
5082
  if (r !== null)
5073
5083
  return {
5074
5084
  id: String(t.id ?? crypto.randomUUID()),
5075
5085
  role: "tool",
5076
5086
  content: "",
5077
5087
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
5078
- ...E(i) !== null ? { displaySequence: E(i) } : {},
5088
+ ...k(i) !== null ? { displaySequence: k(i) } : {},
5079
5089
  respondsToUserMessageId: O(i) ?? void 0,
5080
- ...k(i) ? { runId: k(i) } : {},
5090
+ ...E(i) ? { runId: E(i) } : {},
5081
5091
  dataType: "function_call_output",
5082
5092
  toolName: St,
5083
5093
  callId: ue(i) ?? void 0,
5084
5094
  sharePromptAllowed: r
5085
5095
  };
5086
- const o = fn(i.output);
5096
+ const o = In(i.output);
5087
5097
  if (o)
5088
5098
  return {
5089
5099
  id: String(t.id ?? crypto.randomUUID()),
5090
5100
  role: "tool",
5091
5101
  content: "",
5092
5102
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
5093
- ...E(i) !== null ? { displaySequence: E(i) } : {},
5103
+ ...k(i) !== null ? { displaySequence: k(i) } : {},
5094
5104
  respondsToUserMessageId: O(i) ?? void 0,
5095
- ...k(i) ? { runId: k(i) } : {},
5105
+ ...E(i) ? { runId: E(i) } : {},
5096
5106
  dataType: "scheduled_check_in",
5097
- toolName: gs,
5107
+ toolName: fs,
5098
5108
  callId: ue(i) ?? void 0,
5099
5109
  scheduledCheckInId: o.id ?? void 0,
5100
5110
  scheduledCheckInAt: o.dueAt
5101
5111
  };
5102
- const a = rr(i.output), l = or(i.output);
5112
+ const a = lr(i.output), l = cr(i.output);
5103
5113
  return a ? {
5104
5114
  id: String(t.id ?? crypto.randomUUID()),
5105
5115
  role: "tool",
5106
5116
  content: `Connect ${a.appName} to continue`,
5107
5117
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
5108
- ...E(i) !== null ? { displaySequence: E(i) } : {},
5118
+ ...k(i) !== null ? { displaySequence: k(i) } : {},
5109
5119
  ...P(i) !== null ? { causalSequence: P(i) } : {},
5110
5120
  respondsToUserMessageId: O(i) ?? void 0,
5111
- ...k(i) ? { runId: k(i) } : {},
5121
+ ...E(i) ? { runId: E(i) } : {},
5112
5122
  dataType: "function_call_output",
5113
5123
  toolName: "authenticate_pipedream_app",
5114
5124
  callId: ue(i) ?? void 0,
@@ -5118,10 +5128,10 @@ function Ue(s, e) {
5118
5128
  role: "tool",
5119
5129
  content: "Connect WhatsApp to continue",
5120
5130
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
5121
- ...E(i) !== null ? { displaySequence: E(i) } : {},
5131
+ ...k(i) !== null ? { displaySequence: k(i) } : {},
5122
5132
  ...P(i) !== null ? { causalSequence: P(i) } : {},
5123
5133
  respondsToUserMessageId: O(i) ?? void 0,
5124
- ...k(i) ? { runId: k(i) } : {},
5134
+ ...E(i) ? { runId: E(i) } : {},
5125
5135
  dataType: "function_call_output",
5126
5136
  toolName: "request_personal_channel_connection",
5127
5137
  callId: ue(i) ?? void 0,
@@ -5131,12 +5141,12 @@ function Ue(s, e) {
5131
5141
  return i.type === "function_call" || i.type === "tool_call" || i.type === "web_search_call" || i.type === "mcp_call" || i.type === "tab_lifecycle_decision" ? {
5132
5142
  id: String(t.id ?? crypto.randomUUID()),
5133
5143
  role: "tool",
5134
- content: i.type === "mcp_call" ? ir(i) : lr(i),
5144
+ content: i.type === "mcp_call" ? ar(i) : dr(i),
5135
5145
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
5136
- ...E(i) !== null ? { displaySequence: E(i) } : {},
5146
+ ...k(i) !== null ? { displaySequence: k(i) } : {},
5137
5147
  ...P(i) !== null ? { causalSequence: P(i) } : {},
5138
5148
  respondsToUserMessageId: O(i) ?? void 0,
5139
- ...k(i) ? { runId: k(i) } : {},
5149
+ ...E(i) ? { runId: E(i) } : {},
5140
5150
  dataType: String(i.type),
5141
5151
  toolName: i.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof i.name == "string" ? i.name : void 0,
5142
5152
  callId: ue(i) ?? void 0,
@@ -5145,12 +5155,12 @@ function Ue(s, e) {
5145
5155
  } : i.type === "run_status" || i.type === "run_error" ? i.type === "run_error" && i.stage === "tool_execution" ? null : {
5146
5156
  id: String(t.id ?? crypto.randomUUID()),
5147
5157
  role: "system",
5148
- content: ar(i),
5158
+ content: ur(i),
5149
5159
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
5150
- ...E(i) !== null ? { displaySequence: E(i) } : {},
5160
+ ...k(i) !== null ? { displaySequence: k(i) } : {},
5151
5161
  ...P(i) !== null ? { causalSequence: P(i) } : {},
5152
5162
  respondsToUserMessageId: O(i) ?? void 0,
5153
- ...k(i) ? { runId: k(i) } : {},
5163
+ ...E(i) ? { runId: E(i) } : {},
5154
5164
  dataType: String(i.type),
5155
5165
  loading: i.steered !== !0 && i.type === "run_status" && (i.status === "running" || i.status === "retrying"),
5156
5166
  ...i.steered === !0 || i.type === "run_status" && i.status === "steered" ? { steered: !0 } : {},
@@ -5158,11 +5168,11 @@ function Ue(s, e) {
5158
5168
  ...typeof i.securitySettingsUrl == "string" ? { securitySettingsUrl: i.securitySettingsUrl } : {}
5159
5169
  } : null;
5160
5170
  }
5161
- function ir(s) {
5171
+ function ar(s) {
5162
5172
  const t = (typeof s.server_label == "string" ? s.server_label : "").replace(/^pipedream_/, "").split(/[_-]+/).filter(Boolean).map((n) => `${n.charAt(0).toUpperCase()}${n.slice(1)}`).join(" ");
5163
5173
  return t ? `🔌 Using ${t}` : "🔌 Using connected integration";
5164
5174
  }
5165
- function rr(s) {
5175
+ function lr(s) {
5166
5176
  if (typeof s != "string")
5167
5177
  return null;
5168
5178
  try {
@@ -5179,7 +5189,7 @@ function rr(s) {
5179
5189
  return null;
5180
5190
  }
5181
5191
  }
5182
- function or(s) {
5192
+ function cr(s) {
5183
5193
  if (typeof s != "string")
5184
5194
  return null;
5185
5195
  try {
@@ -5194,10 +5204,10 @@ function or(s) {
5194
5204
  return null;
5195
5205
  }
5196
5206
  }
5197
- function ar(s) {
5207
+ function ur(s) {
5198
5208
  return s.type === "run_status" && s.status === "steered" ? "Steered" : typeof s.message == "string" && s.message.trim().length > 0 ? s.message : "";
5199
5209
  }
5200
- function lr(s) {
5210
+ function dr(s) {
5201
5211
  if (s.type === "web_search_call") {
5202
5212
  const e = s.action;
5203
5213
  if (e && typeof e == "object") {
@@ -5209,9 +5219,9 @@ function lr(s) {
5209
5219
  }
5210
5220
  return "🔎 Searching the web";
5211
5221
  }
5212
- return cr(s);
5222
+ return hr(s);
5213
5223
  }
5214
- function cr(s) {
5224
+ function hr(s) {
5215
5225
  if (typeof s.summary == "string" && s.summary.trim().length > 0)
5216
5226
  return se(s.summary);
5217
5227
  if (typeof s.arguments == "string")
@@ -5228,7 +5238,7 @@ function se(s) {
5228
5238
  const e = s.trim() || "Run tool", t = e.codePointAt(0) ?? 0;
5229
5239
  return t >= 126976 && t <= 129791 || t >= 9728 && t <= 10175 || t >= 127462 && t <= 127487 ? e : `🛠️ ${e}`;
5230
5240
  }
5231
- function ur(s) {
5241
+ function pr(s) {
5232
5242
  if (s == null)
5233
5243
  return s;
5234
5244
  if (typeof s != "object")
@@ -5250,10 +5260,10 @@ function ue(s) {
5250
5260
  function P(s) {
5251
5261
  return typeof s.causalSequence == "number" && Number.isSafeInteger(s.causalSequence) ? s.causalSequence : null;
5252
5262
  }
5253
- function E(s) {
5263
+ function k(s) {
5254
5264
  return typeof s.displaySequence == "number" && Number.isSafeInteger(s.displaySequence) ? s.displaySequence : null;
5255
5265
  }
5256
- function Xt(s) {
5266
+ function Jt(s) {
5257
5267
  return typeof s == "string" ? s : Array.isArray(s) ? s.map((e) => {
5258
5268
  if (!e || typeof e != "object")
5259
5269
  return "";
@@ -5262,13 +5272,13 @@ function Xt(s) {
5262
5272
  }).filter(Boolean).join("") : "";
5263
5273
  }
5264
5274
  function de(s, e) {
5265
- const t = Es(
5275
+ const t = Cs(
5266
5276
  s,
5267
5277
  Mt(s, e)
5268
- ), n = pr(
5269
- hr(
5270
- yr(
5271
- dr(s, e),
5278
+ ), n = mr(
5279
+ fr(
5280
+ Tr(
5281
+ gr(s, e),
5272
5282
  e
5273
5283
  ),
5274
5284
  t
@@ -5293,7 +5303,7 @@ function Mt(s, e, t = !0) {
5293
5303
  const i = s.flatMap((r) => (e.respondsToUserMessageId !== void 0 ? r.respondsToUserMessageId === e.respondsToUserMessageId : e.runId !== void 0 && r.respondsToUserMessageId === void 0 && r.runId === e.runId) && r.displaySequence !== void 0 ? [r.displaySequence] : []);
5294
5304
  return e.displaySequence = (i.length > 0 ? Math.max(...i) : 0) + 1, e;
5295
5305
  }
5296
- function dr(s, e) {
5306
+ function gr(s, e) {
5297
5307
  const t = e.proactiveSuggestionClientMessageId;
5298
5308
  if (!t)
5299
5309
  return s;
@@ -5303,7 +5313,7 @@ function dr(s, e) {
5303
5313
  const r = [...s];
5304
5314
  return r[i] = e, r;
5305
5315
  }
5306
- function hr(s, e) {
5316
+ function fr(s, e) {
5307
5317
  const t = e.assistantDraftItemId;
5308
5318
  return t ? s.map(
5309
5319
  (n) => n.dataType === "assistant_draft" && n.id === t ? e : n
@@ -5371,7 +5381,7 @@ function ts(s) {
5371
5381
  loading: !0
5372
5382
  };
5373
5383
  }
5374
- function pr(s, e) {
5384
+ function mr(s, e) {
5375
5385
  if (e.id.startsWith("transient-activity:"))
5376
5386
  return s;
5377
5387
  const t = e.toolName === "tab_lifecycle";
@@ -5385,19 +5395,19 @@ function lt(s, e) {
5385
5395
  for (const n of e) {
5386
5396
  const i = [...s, ...t];
5387
5397
  t.push(
5388
- Es(
5398
+ Cs(
5389
5399
  i,
5390
5400
  Mt(i, n, !1)
5391
5401
  )
5392
5402
  );
5393
5403
  }
5394
- return rn(
5404
+ return ln(
5395
5405
  s,
5396
5406
  t,
5397
5407
  ct
5398
5408
  );
5399
5409
  }
5400
- function gr(s, e) {
5410
+ function yr(s, e) {
5401
5411
  const t = new Map(s.map((r) => [r.id, r])), n = e.map(
5402
5412
  (r) => Mt(s, r, !1)
5403
5413
  );
@@ -5419,7 +5429,7 @@ function gr(s, e) {
5419
5429
  return i;
5420
5430
  }
5421
5431
  function ct(s) {
5422
- const e = X(s) ?? void 0, t = s.assistantDraftItemId, n = s.dataType === "function_call_output" || s.dataType === "scheduled_check_in", i = [
5432
+ const e = J(s) ?? void 0, t = s.assistantDraftItemId, n = s.dataType === "function_call_output" || s.dataType === "scheduled_check_in", i = [
5423
5433
  // Output-backed cards and their visible calls are separate durable rows. A distinct key keeps activity hydration
5424
5434
  // from substituting the call for its output and then appending a duplicate output at the end of the timeline.
5425
5435
  ...s.callId ? [`${n ? "call-output" : "call"}:${s.callId}`] : [],
@@ -5438,49 +5448,49 @@ function ct(s) {
5438
5448
  isTransient: s.id.startsWith("transient-activity:") || s.dataType === "assistant_draft"
5439
5449
  };
5440
5450
  }
5441
- function Es(s, e) {
5451
+ function Cs(s, e) {
5442
5452
  if (e.role !== "user" || !e.attachments?.length)
5443
5453
  return e;
5444
5454
  const t = s.find(
5445
- (o) => o.role === "user" && (o.id === e.id || He(o) && Cs(o, e))
5455
+ (o) => o.role === "user" && (o.id === e.id || He(o) && _s(o, e))
5446
5456
  );
5447
5457
  if (!t?.attachments?.length)
5448
5458
  return e;
5449
5459
  const n = e.attachments.map((o) => {
5450
- const a = fr(t.attachments ?? [], o);
5451
- return a ? mr(o, a) : o;
5452
- }), i = { ...e, attachments: n }, r = X(e);
5460
+ const a = Ir(t.attachments ?? [], o);
5461
+ return a ? Sr(o, a) : o;
5462
+ }), i = { ...e, attachments: n }, r = J(e);
5453
5463
  return r && Object.defineProperty(i, "clientMessageId", {
5454
5464
  value: r,
5455
5465
  enumerable: !1
5456
5466
  }), i;
5457
5467
  }
5458
- function fr(s, e) {
5468
+ function Ir(s, e) {
5459
5469
  return e.id ? s.find((t) => t.id === e.id) ?? null : null;
5460
5470
  }
5461
- function mr(s, e) {
5471
+ function Sr(s, e) {
5462
5472
  const { previewUrl: t } = e;
5463
5473
  return t ? { ...s, previewUrl: t } : s;
5464
5474
  }
5465
- function yr(s, e) {
5475
+ function Tr(s, e) {
5466
5476
  if (e.role !== "user")
5467
5477
  return s;
5468
5478
  const t = s.findIndex(
5469
- (i) => He(i) && Cs(i, e)
5479
+ (i) => He(i) && _s(i, e)
5470
5480
  );
5471
5481
  if (t === -1)
5472
5482
  return s;
5473
5483
  const n = [...s];
5474
5484
  return n.splice(t, 1), n;
5475
5485
  }
5476
- function Cs(s, e) {
5477
- const t = X(s), n = X(e);
5486
+ function _s(s, e) {
5487
+ const t = J(s), n = J(e);
5478
5488
  return t && n ? t === n : s.content === e.content;
5479
5489
  }
5480
5490
  function He(s) {
5481
5491
  return s.role === "user" && (s.id.startsWith("local-") || s.id.startsWith("optimistic-user-message:"));
5482
5492
  }
5483
- function X(s) {
5493
+ function J(s) {
5484
5494
  const e = s.clientMessageId;
5485
5495
  if (e)
5486
5496
  return e;
@@ -5490,7 +5500,7 @@ function X(s) {
5490
5500
  return n ? s.id.slice(n.length) : null;
5491
5501
  }
5492
5502
  function ss(s) {
5493
- const e = _s(s);
5503
+ const e = Ps(s);
5494
5504
  if (e === null)
5495
5505
  return !1;
5496
5506
  const t = s[e].id;
@@ -5501,7 +5511,7 @@ function ss(s) {
5501
5511
  for (let i = s.length - 1; i > e; i -= 1) {
5502
5512
  const r = s[i];
5503
5513
  if (!r.respondsToUserMessageId) {
5504
- if (F(r))
5514
+ if (W(r))
5505
5515
  return !0;
5506
5516
  if (r.role === "system") {
5507
5517
  if (r.dataType === "run_error")
@@ -5513,10 +5523,10 @@ function ss(s) {
5513
5523
  }
5514
5524
  return !1;
5515
5525
  }
5516
- function Ir(s, e, t) {
5526
+ function wr(s, e, t) {
5517
5527
  const n = new Set(
5518
5528
  s.filter(
5519
- (i) => i.role === "user" && e !== null && X(i) === e
5529
+ (i) => i.role === "user" && e !== null && J(i) === e
5520
5530
  ).map((i) => i.id)
5521
5531
  );
5522
5532
  return s.some((i, r) => {
@@ -5527,29 +5537,29 @@ function Ir(s, e, t) {
5527
5537
  if (t && i.runId === t) {
5528
5538
  if (n.size === 0)
5529
5539
  return !0;
5530
- const o = Ps(s, r);
5540
+ const o = vs(s, r);
5531
5541
  return !i.respondsToUserMessageId && o !== null && n.has(o);
5532
5542
  }
5533
5543
  return !1;
5534
5544
  });
5535
5545
  }
5536
- function Sr(s) {
5537
- const e = _s(s);
5546
+ function Ar(s) {
5547
+ const e = Ps(s);
5538
5548
  if (e === null)
5539
- return s.some(F);
5549
+ return s.some(W);
5540
5550
  const t = s[e].id;
5541
5551
  return s.some((n) => n.respondsToUserMessageId === t) ? s.some(
5542
- (n) => n.respondsToUserMessageId === t && F(n)
5543
- ) : s.slice(e + 1).some(F);
5552
+ (n) => n.respondsToUserMessageId === t && W(n)
5553
+ ) : s.slice(e + 1).some(W);
5544
5554
  }
5545
- function _s(s) {
5555
+ function Ps(s) {
5546
5556
  for (let e = s.length - 1; e >= 0; e -= 1)
5547
5557
  if (s[e].role === "user" && !He(s[e]))
5548
5558
  return e;
5549
5559
  return null;
5550
5560
  }
5551
5561
  function De(s) {
5552
- return F(s) ? !0 : s.role !== "system" ? !1 : s.dataType === "run_error" ? !0 : s.dataType === "run_status" && s.loading !== !0;
5562
+ return W(s) ? !0 : s.role !== "system" ? !1 : s.dataType === "run_error" ? !0 : s.dataType === "run_status" && s.loading !== !0;
5553
5563
  }
5554
5564
  function ie(s) {
5555
5565
  for (let e = s.length - 1; e >= 0; e -= 1) {
@@ -5565,7 +5575,7 @@ function ie(s) {
5565
5575
  }
5566
5576
  return null;
5567
5577
  }
5568
- function Tr(s) {
5578
+ function Mr(s) {
5569
5579
  const e = ie(s);
5570
5580
  if (e === null)
5571
5581
  return null;
@@ -5584,10 +5594,10 @@ function C(s) {
5584
5594
  function pe(s) {
5585
5595
  return s?.retryable !== !0 ? !1 : s.type === "run_error" ? !0 : s.type === "run_status" && s.status === "interrupted";
5586
5596
  }
5587
- function wr(s) {
5597
+ function br(s) {
5588
5598
  return s?.type === "run_status" && s.status === "interrupted" && s.reason === "backend_restart";
5589
5599
  }
5590
- function Ar(s, e) {
5600
+ function Rr(s, e) {
5591
5601
  const t = ie(e);
5592
5602
  if (t === null)
5593
5603
  return !1;
@@ -5612,7 +5622,7 @@ function ut(s) {
5612
5622
  const i = n.clientMessageId;
5613
5623
  return typeof i == "string" ? i : null;
5614
5624
  }
5615
- function Mr(s) {
5625
+ function Er(s) {
5616
5626
  const e = ie(s);
5617
5627
  if (e === null)
5618
5628
  return null;
@@ -5643,15 +5653,15 @@ function dt(s, e) {
5643
5653
  return i?.type === "message" && i.role === "user" && typeof i.clientMessageId == "string" ? i.clientMessageId : null;
5644
5654
  }
5645
5655
  function ns(s, e, t, n, i, r) {
5646
- if (!e || !Rr(s))
5656
+ if (!e || !Cr(s))
5647
5657
  return !1;
5648
5658
  const o = s;
5649
5659
  if (pe(o) || t !== null && typeof o.id == "string" && o.id !== t)
5650
5660
  return !1;
5651
5661
  const a = O(o);
5652
- return n !== null ? a !== null ? a === n : i !== null && k(o) === i && r === n : i === null || k(o) === i;
5662
+ return n !== null ? a !== null ? a === n : i !== null && E(o) === i && r === n : i === null || E(o) === i;
5653
5663
  }
5654
- function br(s, e) {
5664
+ function kr(s, e) {
5655
5665
  for (let t = e - 1; t >= 0; t -= 1) {
5656
5666
  const n = C(s[t]);
5657
5667
  if (n?.type === "message" && n.role === "user")
@@ -5659,31 +5669,31 @@ function br(s, e) {
5659
5669
  }
5660
5670
  return null;
5661
5671
  }
5662
- function Ps(s, e) {
5672
+ function vs(s, e) {
5663
5673
  for (let t = e - 1; t >= 0; t -= 1)
5664
5674
  if (s[t].role === "user")
5665
5675
  return s[t].id;
5666
5676
  return null;
5667
5677
  }
5668
- function Rr(s) {
5678
+ function Cr(s) {
5669
5679
  if (!s || typeof s != "object")
5670
5680
  return !1;
5671
5681
  const e = s;
5672
5682
  return e.type === "message" && e.role === "assistant" ? !0 : e.type === "run_error" ? e.stage !== "tool_execution" : e.type === "run_status" && (e.status === "stopped" || e.status === "interrupted" || e.status === "failed");
5673
5683
  }
5674
- function F(s) {
5684
+ function W(s) {
5675
5685
  return s.role === "assistant" && s.phase !== "commentary";
5676
5686
  }
5677
- function kr(s) {
5687
+ function _r(s) {
5678
5688
  if (!s || typeof s != "object")
5679
5689
  return !1;
5680
5690
  const e = s;
5681
5691
  return e.type === "message" && e.role === "user" ? !1 : e.type === "message" || e.type === "function_call" || e.type === "function_call_output" || e.type === "run_error" || e.type === "run_status";
5682
5692
  }
5683
5693
  function ht(s) {
5684
- return s.filter((e, t) => G(e) ? !Hr(s, t) && !vs(s, t) && !Lr(s, t) && !Nr(s, t) : Er(e) ? e.retryable === !0 && xr(s, t) ? !1 : !Or(s, t) : !0);
5694
+ return s.filter((e, t) => G(e) ? !Wr(s, t) && !Us(s, t) && !Br(s, t) && !Fr(s, t) : Pr(e) ? e.retryable === !0 && Hr(s, t) ? !1 : !Nr(s, t) : !0);
5685
5695
  }
5686
- function Er(s) {
5696
+ function Pr(s) {
5687
5697
  return s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.steered !== !0);
5688
5698
  }
5689
5699
  function G(s) {
@@ -5692,24 +5702,24 @@ function G(s) {
5692
5702
  function pt(s) {
5693
5703
  return s.steered !== !0 && (s.dataType === "assistant_draft" || s.loading === !0);
5694
5704
  }
5695
- function Cr(s) {
5705
+ function vr(s) {
5696
5706
  return s.some(pt);
5697
5707
  }
5698
5708
  function is(s, e) {
5699
5709
  return (s.retryable === !0 || s.code === "transient_model_error") && s.code !== "run_recovery_exhausted" && e !== null && typeof s.clientMessageId == "string";
5700
5710
  }
5701
- function _r(s, e) {
5711
+ function Ur(s, e) {
5702
5712
  const t = [...s].reverse().find(pt), n = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : t?.respondsToUserMessageId ?? null, i = typeof e.runId == "string" ? e.runId : t?.runId ?? null;
5703
5713
  return s.flatMap((r) => (n ? r.respondsToUserMessageId === n || !r.respondsToUserMessageId && i !== null && r.runId === i : i ? r.runId === i : pt(r)) ? r.dataType === "assistant_draft" || G(r) ? [] : r.loading === !0 ? [{ ...r, loading: !1 }] : [r] : [r]);
5704
5714
  }
5705
- function Pr(s, e, t, n) {
5715
+ function Dr(s, e, t, n) {
5706
5716
  const i = s.findIndex(
5707
- (l, c) => G(l) && !vs(s, c)
5717
+ (l, c) => G(l) && !Us(s, c)
5708
5718
  ), r = i === -1 ? null : s[i], o = e ?? r?.respondsToUserMessageId ?? null, a = o ? s.find(
5709
5719
  (l) => l.role === "user" && l.id === o
5710
5720
  ) : null;
5711
5721
  return {
5712
- clientMessageId: a ? X(a) : o ? null : n,
5722
+ clientMessageId: a ? J(a) : o ? null : n,
5713
5723
  respondsToUserMessageId: o,
5714
5724
  runId: t ?? r?.runId ?? null
5715
5725
  };
@@ -5717,29 +5727,29 @@ function Pr(s, e, t, n) {
5717
5727
  function _e(s) {
5718
5728
  return s?.type === "run_status" && s.status === "stopped";
5719
5729
  }
5720
- function vr(s, e) {
5721
- return F(e) ? "completed" : _e(s) ? "stopped" : !pe(s) && (s?.type === "run_error" || s?.type === "run_status" && (s.status === "failed" || s.status === "interrupted")) ? "failed" : null;
5730
+ function qr(s, e) {
5731
+ return W(e) ? "completed" : _e(s) ? "stopped" : !pe(s) && (s?.type === "run_error" || s?.type === "run_status" && (s.status === "failed" || s.status === "interrupted")) ? "failed" : null;
5722
5732
  }
5723
5733
  function rs(s, e, t) {
5724
5734
  const n = new Set(
5725
5735
  s.filter(
5726
- (i) => i.role === "user" && e !== null && X(i) === e
5736
+ (i) => i.role === "user" && e !== null && J(i) === e
5727
5737
  ).map((i) => i.id)
5728
5738
  );
5729
5739
  return s.filter(
5730
5740
  (i) => !G(i) || (n.size > 0 ? !i.respondsToUserMessageId || !n.has(i.respondsToUserMessageId) : !t || i.runId !== t)
5731
5741
  );
5732
5742
  }
5733
- function vs(s, e) {
5743
+ function Us(s, e) {
5734
5744
  return s.some(
5735
- (t, n) => n !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) && Ur(
5745
+ (t, n) => n !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) && Or(
5736
5746
  s,
5737
5747
  e,
5738
5748
  n
5739
5749
  )
5740
5750
  );
5741
5751
  }
5742
- function Ur(s, e, t) {
5752
+ function Or(s, e, t) {
5743
5753
  const n = s[e], i = s[t];
5744
5754
  if (ge(n, i))
5745
5755
  return !0;
@@ -5752,11 +5762,11 @@ function Ur(s, e, t) {
5752
5762
  }
5753
5763
  function os(s, e, t, n) {
5754
5764
  const i = (t && t !== e ? t : null) ?? [...s].reverse().find(
5755
- (l) => l.respondsToUserMessageId !== void 0 && l.respondsToUserMessageId !== e && as(l) && !qr(
5765
+ (l) => l.respondsToUserMessageId !== void 0 && l.respondsToUserMessageId !== e && as(l) && !Lr(
5756
5766
  s,
5757
5767
  l.respondsToUserMessageId
5758
5768
  )
5759
- )?.respondsToUserMessageId ?? Dr(
5769
+ )?.respondsToUserMessageId ?? xr(
5760
5770
  s,
5761
5771
  e
5762
5772
  );
@@ -5785,7 +5795,7 @@ function os(s, e, t, n) {
5785
5795
  }
5786
5796
  ];
5787
5797
  }
5788
- function Dr(s, e) {
5798
+ function xr(s, e) {
5789
5799
  const t = s.findIndex(
5790
5800
  (n) => n.role === "user" && n.id === e
5791
5801
  );
@@ -5799,12 +5809,12 @@ function Dr(s, e) {
5799
5809
  function as(s) {
5800
5810
  return s.role === "tool" || G(s) ? !0 : s.role === "assistant" && s.phase === "commentary";
5801
5811
  }
5802
- function qr(s, e) {
5812
+ function Lr(s, e) {
5803
5813
  return s.some(
5804
- (t) => t.respondsToUserMessageId === e && (F(t) || t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0))
5814
+ (t) => t.respondsToUserMessageId === e && (W(t) || t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0))
5805
5815
  );
5806
5816
  }
5807
- function Or(s, e) {
5817
+ function Nr(s, e) {
5808
5818
  const t = s[e];
5809
5819
  for (let n = e + 1; n < s.length; n += 1) {
5810
5820
  const i = s[n];
@@ -5813,7 +5823,7 @@ function Or(s, e) {
5813
5823
  }
5814
5824
  return !1;
5815
5825
  }
5816
- function xr(s, e) {
5826
+ function Hr(s, e) {
5817
5827
  const t = s[e];
5818
5828
  if (!t.respondsToUserMessageId)
5819
5829
  return !1;
@@ -5826,19 +5836,19 @@ function xr(s, e) {
5826
5836
  }
5827
5837
  return !1;
5828
5838
  }
5829
- function Lr(s, e) {
5839
+ function Br(s, e) {
5830
5840
  const t = s[e];
5831
5841
  return s.some(
5832
5842
  (n, i) => i !== e && n.role === "assistant" && ge(t, n)
5833
5843
  );
5834
5844
  }
5835
- function Nr(s, e) {
5845
+ function Fr(s, e) {
5836
5846
  const t = s[e];
5837
5847
  return s.some(
5838
5848
  (n, i) => i !== e && n.role === "tool" && ge(t, n)
5839
5849
  );
5840
5850
  }
5841
- function Hr(s, e) {
5851
+ function Wr(s, e) {
5842
5852
  const t = s[e];
5843
5853
  for (let n = e + 1; n < s.length; n += 1)
5844
5854
  if (G(s[n]) && ge(t, s[n]))
@@ -5851,15 +5861,15 @@ function ge(s, e) {
5851
5861
  function A(s, e) {
5852
5862
  return s && typeof s == "object" && typeof s[e] == "string" ? s[e] : null;
5853
5863
  }
5854
- function Br(s, e) {
5864
+ function $r(s, e) {
5855
5865
  try {
5856
- const t = window.localStorage.getItem(`${As}${s}`);
5866
+ const t = window.localStorage.getItem(`${Ms}${s}`);
5857
5867
  if (!t)
5858
5868
  return null;
5859
5869
  const n = JSON.parse(t), i = typeof n.sessionId == "string" ? n.sessionId : null;
5860
5870
  if (e !== void 0 && i !== e)
5861
5871
  return null;
5862
- const r = Array.isArray(n.messages) ? n.messages.map(Xr).filter((o) => !!o) : [];
5872
+ const r = Array.isArray(n.messages) ? n.messages.map(eo).filter((o) => !!o) : [];
5863
5873
  return {
5864
5874
  sessionId: i,
5865
5875
  messages: r
@@ -5873,20 +5883,20 @@ function gt(s) {
5873
5883
  // running tool or commentary history from disappearing while authoritative hydration is still in flight.
5874
5884
  s.role === "tool" || s.dataType === "run_status" || s.dataType === "run_error";
5875
5885
  }
5876
- function Wr(s, e) {
5886
+ function jr(s, e) {
5877
5887
  try {
5878
5888
  window.localStorage.setItem(
5879
- `${As}${s}`,
5889
+ `${Ms}${s}`,
5880
5890
  JSON.stringify({
5881
5891
  sessionId: e.sessionId,
5882
- messages: e.messages.filter(gt).slice(-li).map(Yr)
5892
+ messages: e.messages.filter(gt).slice(-di).map(to)
5883
5893
  })
5884
5894
  );
5885
5895
  } catch {
5886
5896
  return;
5887
5897
  }
5888
5898
  }
5889
- function Fr(s) {
5899
+ function zr(s) {
5890
5900
  try {
5891
5901
  const e = window.localStorage.getItem(`${at}${s}`);
5892
5902
  if (!e)
@@ -5912,7 +5922,7 @@ function V(s, e) {
5912
5922
  return;
5913
5923
  }
5914
5924
  }
5915
- function Us(s, e) {
5925
+ function Ds(s, e) {
5916
5926
  try {
5917
5927
  const t = `${Le}${s}`, n = location.href, i = location.origin, r = Array.from(e, (o) => ({
5918
5928
  ...o,
@@ -5935,21 +5945,21 @@ function ls(s, e) {
5935
5945
  } catch {
5936
5946
  return;
5937
5947
  }
5938
- Us(s, e);
5948
+ Ds(s, e);
5939
5949
  }
5940
- function $r(s) {
5950
+ function Kr(s) {
5941
5951
  try {
5942
5952
  const e = `${Le}${s}`, t = window.sessionStorage.getItem(e);
5943
5953
  if (window.sessionStorage.removeItem(e), !t)
5944
5954
  return [];
5945
5955
  const n = JSON.parse(t);
5946
- return Array.isArray(n) ? n.flatMap((i) => zr(i) ? [{
5956
+ return Array.isArray(n) ? n.flatMap((i) => Qr(i) ? [{
5947
5957
  ...i.event,
5948
5958
  page: _(),
5949
5959
  rawOutput: {
5950
5960
  pageContextRestarted: !0,
5951
5961
  outcome: "unknown",
5952
- message: jr(location.href),
5962
+ message: Gr(location.href),
5953
5963
  currentUrl: location.href,
5954
5964
  console: [],
5955
5965
  metadata: {
@@ -5966,17 +5976,17 @@ function $r(s) {
5966
5976
  return [];
5967
5977
  }
5968
5978
  }
5969
- function jr(s) {
5979
+ function Gr(s) {
5970
5980
  return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
5971
5981
  Current URL: ${s}`;
5972
5982
  }
5973
- function zr(s) {
5983
+ function Qr(s) {
5974
5984
  if (!s || typeof s != "object")
5975
5985
  return !1;
5976
5986
  const e = s, t = e.event;
5977
5987
  return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" && bt(t) && t.type === "tool.result";
5978
5988
  }
5979
- function Kr(s, e) {
5989
+ function Vr(s, e) {
5980
5990
  const t = new Set(
5981
5991
  s.flatMap((n) => n.type === "tool.result" ? [n.callId] : [])
5982
5992
  );
@@ -5985,7 +5995,7 @@ function Kr(s, e) {
5985
5995
  ...e.filter((n) => !t.has(n.callId))
5986
5996
  ];
5987
5997
  }
5988
- function Gr(s) {
5998
+ function Xr(s) {
5989
5999
  try {
5990
6000
  window.sessionStorage.removeItem(`${Le}${s}`);
5991
6001
  } catch {
@@ -6004,7 +6014,7 @@ function cs(s) {
6004
6014
  const e = s;
6005
6015
  return typeof e.url == "string" && typeof e.title == "string" && typeof e.origin == "string";
6006
6016
  }
6007
- function Ds(s, e) {
6017
+ function qs(s, e) {
6008
6018
  if (!Array.isArray(s))
6009
6019
  return;
6010
6020
  const t = s.filter((i) => {
@@ -6012,41 +6022,41 @@ function Ds(s, e) {
6012
6022
  return !1;
6013
6023
  const r = i;
6014
6024
  return typeof r.name == "string" && typeof r.mimeType == "string" && typeof r.sizeBytes == "number";
6015
- }), n = e ? t.map((i) => qs(i, e)) : t;
6025
+ }), n = e ? t.map((i) => Os(i, e)) : t;
6016
6026
  return n.length > 0 ? n : void 0;
6017
6027
  }
6018
- function qs(s, e) {
6028
+ function Os(s, e) {
6019
6029
  return s.fileUrl?.startsWith("/") ? {
6020
6030
  ...s,
6021
6031
  fileUrl: new URL(s.fileUrl, e).toString()
6022
6032
  } : s;
6023
6033
  }
6024
6034
  function ft(s) {
6025
- return s.type || Jr(s.name) || "application/octet-stream";
6035
+ return s.type || Zr(s.name) || "application/octet-stream";
6026
6036
  }
6027
- function Qr(s) {
6028
- Os({
6037
+ function Jr(s) {
6038
+ xs({
6029
6039
  name: s.name,
6030
6040
  mimeType: ft(s),
6031
6041
  sizeBytes: s.size
6032
6042
  });
6033
6043
  }
6034
- function Os(s) {
6035
- const e = Vr(s.name), t = s.mimeType.trim().toLowerCase();
6036
- if (!ri.has(`${e}:${t}`))
6044
+ function xs(s) {
6045
+ const e = Yr(s.name), t = s.mimeType.trim().toLowerCase();
6046
+ if (!li.has(`${e}:${t}`))
6037
6047
  throw new Error("This attachment type is not supported by the embedded model provider");
6038
- if (s.sizeBytes <= 0 || s.sizeBytes >= Ts)
6048
+ if (s.sizeBytes <= 0 || s.sizeBytes >= ws)
6039
6049
  throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
6040
6050
  }
6041
- function Vr(s) {
6051
+ function Yr(s) {
6042
6052
  const e = s.trim().toLowerCase(), t = e.lastIndexOf(".");
6043
6053
  return t >= 0 ? e.slice(t) : "";
6044
6054
  }
6045
- function Jr(s) {
6055
+ function Zr(s) {
6046
6056
  const e = s.toLowerCase();
6047
6057
  return e.endsWith(".png") ? "image/png" : e.endsWith(".jpg") || e.endsWith(".jpeg") ? "image/jpeg" : e.endsWith(".webp") ? "image/webp" : e.endsWith(".gif") ? "image/gif" : e.endsWith(".pdf") ? "application/pdf" : null;
6048
6058
  }
6049
- function Xr(s) {
6059
+ function eo(s) {
6050
6060
  if (!s || typeof s != "object")
6051
6061
  return null;
6052
6062
  const e = s;
@@ -6064,11 +6074,11 @@ function Xr(s) {
6064
6074
  scheduledCheckInId: typeof e.scheduledCheckInId == "string" ? e.scheduledCheckInId : void 0,
6065
6075
  scheduledCheckInAt: typeof e.scheduledCheckInAt == "string" ? e.scheduledCheckInAt : void 0,
6066
6076
  securitySettingsUrl: typeof e.securitySettingsUrl == "string" ? e.securitySettingsUrl : void 0,
6067
- attachments: Ds(e.attachments)?.map(qe),
6077
+ attachments: qs(e.attachments)?.map(qe),
6068
6078
  loading: typeof e.loading == "boolean" ? e.loading : void 0
6069
6079
  };
6070
6080
  }
6071
- function Yr(s) {
6081
+ function to(s) {
6072
6082
  return s.attachments?.length ? {
6073
6083
  ...s,
6074
6084
  attachments: s.attachments.map(qe)
@@ -6088,15 +6098,15 @@ function O(s) {
6088
6098
  const e = s.respondsToUserMessageId;
6089
6099
  return typeof e == "string" && e ? e : null;
6090
6100
  }
6091
- function k(s) {
6101
+ function E(s) {
6092
6102
  const e = s.runId;
6093
6103
  return typeof e == "string" && e ? e : null;
6094
6104
  }
6095
- function Zr(s) {
6105
+ function so(s) {
6096
6106
  const e = s?.timeoutMs;
6097
- return !!s && typeof s == "object" && typeof s.summary == "string" && typeof s.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <= Ai);
6107
+ return !!s && typeof s == "object" && typeof s.summary == "string" && typeof s.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <= Ri);
6098
6108
  }
6099
- function xs(s) {
6109
+ function Ls(s) {
6100
6110
  const e = {};
6101
6111
  try {
6102
6112
  new Headers(s).forEach((t, n) => {
@@ -6108,23 +6118,23 @@ function xs(s) {
6108
6118
  return e;
6109
6119
  }
6110
6120
  function Rt(s, e) {
6111
- return Fs(s) ? Be : W(xe(e), oi);
6121
+ return $s(s) ? Be : F(xe(e), ci);
6112
6122
  }
6113
- function eo(s, e) {
6123
+ function no(s, e) {
6114
6124
  return typeof s == "string" ? s : s instanceof URL ? s.toString() : e?.url ?? "";
6115
6125
  }
6116
- async function to(s, e, t, n) {
6117
- const i = xs(s.headers);
6126
+ async function io(s, e, t, n) {
6127
+ const i = Ls(s.headers);
6118
6128
  n({
6119
6129
  ...e,
6120
6130
  responseStatus: s.status,
6121
6131
  responseHeaders: i,
6122
- responseBody: await so(s),
6132
+ responseBody: await ro(s),
6123
6133
  durationMs: Date.now() - t
6124
6134
  });
6125
6135
  }
6126
- async function so(s) {
6127
- if (!Ls(s.headers))
6136
+ async function ro(s) {
6137
+ if (!Ns(s.headers))
6128
6138
  return;
6129
6139
  let e = null, t = null;
6130
6140
  try {
@@ -6133,7 +6143,7 @@ async function so(s) {
6133
6143
  const n = new Promise((a) => {
6134
6144
  t = window.setTimeout(() => {
6135
6145
  e?.cancel(), a("timeout");
6136
- }, ai);
6146
+ }, ui);
6137
6147
  }), i = new TextDecoder();
6138
6148
  let r = "", o = 0;
6139
6149
  for (; ; ) {
@@ -6142,10 +6152,10 @@ async function so(s) {
6142
6152
  return;
6143
6153
  const { done: l, value: c } = a;
6144
6154
  if (l)
6145
- return W(r + i.decode());
6155
+ return F(r + i.decode());
6146
6156
  const u = Tt - o;
6147
6157
  if (c.byteLength > u)
6148
- return r += i.decode(c.subarray(0, Math.max(u, 0)), { stream: !0 }), e.cancel(), `${W(r)}... [truncated]`;
6158
+ return r += i.decode(c.subarray(0, Math.max(u, 0)), { stream: !0 }), e.cancel(), `${F(r)}... [truncated]`;
6149
6159
  o += c.byteLength, r += i.decode(c, { stream: !0 });
6150
6160
  }
6151
6161
  } catch {
@@ -6155,19 +6165,19 @@ async function so(s) {
6155
6165
  t !== null && window.clearTimeout(t);
6156
6166
  }
6157
6167
  }
6158
- function no(s, e) {
6159
- if (Ls(new Headers(e)))
6168
+ function oo(s, e) {
6169
+ if (Ns(new Headers(e)))
6160
6170
  try {
6161
- return s.responseType === "" || s.responseType === "text" ? W(s.responseText ?? "") : void 0;
6171
+ return s.responseType === "" || s.responseType === "text" ? F(s.responseText ?? "") : void 0;
6162
6172
  } catch {
6163
6173
  return;
6164
6174
  }
6165
6175
  }
6166
6176
  function us(s) {
6167
6177
  if (typeof s == "string")
6168
- return W(s);
6178
+ return F(s);
6169
6179
  }
6170
- function io(s) {
6180
+ function ao(s) {
6171
6181
  return L({
6172
6182
  ...s,
6173
6183
  requestBody: ds(s.requestBody),
@@ -6186,14 +6196,14 @@ function ds(s) {
6186
6196
  return xe(s);
6187
6197
  }
6188
6198
  }
6189
- function Ls(s) {
6199
+ function Ns(s) {
6190
6200
  if (!s)
6191
6201
  return !1;
6192
6202
  const e = s.get("content-type")?.toLowerCase() ?? "", t = s.get("content-length"), n = Number(t);
6193
6203
  return t !== null && Number.isInteger(n) && n >= 0 && n <= Tt && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
6194
6204
  }
6195
6205
  function te(s, e = {}, t) {
6196
- if (oo(t))
6206
+ if (co(t))
6197
6207
  return !0;
6198
6208
  const n = Object.entries(e).find(([i]) => i.toLowerCase() === "content-type")?.[1]?.toLowerCase();
6199
6209
  if (n?.includes("multipart/form-data") || n?.includes("application/octet-stream"))
@@ -6208,7 +6218,7 @@ function te(s, e = {}, t) {
6208
6218
  return !0;
6209
6219
  }
6210
6220
  }
6211
- function ro(s, e) {
6221
+ function lo(s, e) {
6212
6222
  if (te(s))
6213
6223
  return !0;
6214
6224
  try {
@@ -6218,10 +6228,10 @@ function ro(s, e) {
6218
6228
  return !0;
6219
6229
  }
6220
6230
  }
6221
- function oo(s) {
6231
+ function co(s) {
6222
6232
  return s instanceof FormData || s instanceof Blob || s instanceof ArrayBuffer || ArrayBuffer.isView(s) || typeof ReadableStream < "u" && s instanceof ReadableStream;
6223
6233
  }
6224
- function ao(s) {
6234
+ function uo(s) {
6225
6235
  const e = {};
6226
6236
  for (const t of s.trim().split(/[\r\n]+/)) {
6227
6237
  const n = t.indexOf(":");
@@ -6234,7 +6244,7 @@ function ao(s) {
6234
6244
  }
6235
6245
  return e;
6236
6246
  }
6237
- function W(s, e = Tt) {
6247
+ function F(s, e = Tt) {
6238
6248
  return s.length <= e ? s : `${s.slice(0, e)}... [truncated ${s.length - e} chars]`;
6239
6249
  }
6240
6250
  function nt(s) {
@@ -6252,27 +6262,27 @@ async function be(s, e) {
6252
6262
  try {
6253
6263
  return await s();
6254
6264
  } catch (i) {
6255
- if (t = i, n >= zt - 1 || !co(i))
6265
+ if (t = i, n >= zt - 1 || !po(i))
6256
6266
  throw i;
6257
- await lo(n);
6267
+ await ho(n);
6258
6268
  }
6259
6269
  throw t instanceof Error ? t : new Error(e);
6260
6270
  }
6261
- function lo(s) {
6271
+ function ho(s) {
6262
6272
  return new Promise((e) => {
6263
- window.setTimeout(e, ii[s] ?? 0);
6273
+ window.setTimeout(e, ai[s] ?? 0);
6264
6274
  });
6265
6275
  }
6266
- function co(s) {
6267
- return s instanceof Pe ? uo(s.status) : s instanceof TypeError;
6276
+ function po(s) {
6277
+ return s instanceof Pe ? go(s.status) : s instanceof TypeError;
6268
6278
  }
6269
- function uo(s) {
6279
+ function go(s) {
6270
6280
  return s === 408 || s === 409 || s === 429 || s >= 500;
6271
6281
  }
6272
- function ho(s) {
6282
+ function fo(s) {
6273
6283
  return s === 401 || s === 403;
6274
6284
  }
6275
- const Be = "[REDACTED_SECRET]", $ = "[REDACTED_TOKEN]", po = "[REDACTED_SIGNED_URL]", go = 20, fo = /^(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, Ns = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Hs = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, Bs = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Ws = /\b(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|api_key|apiKey|apikey|client_secret|clientSecret|password|secret|token|jwt|csrf|csrfToken|xsrf|xsrfToken)\b\s*[:=]\s*["']?[^"',&\s}]+/gi, mo = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, yo = /\bhttps?:\/\/[^\s"'<>]+/gi, Io = /[),.;\]]+$/;
6285
+ const Be = "[REDACTED_SECRET]", $ = "[REDACTED_TOKEN]", mo = "[REDACTED_SIGNED_URL]", yo = 20, Io = /^(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|token|api_key|apiKey|apikey|key|secret|signature|sig|password|passwd|pwd|code|state|session|jwt|csrf|csrfToken|xsrf|xsrfToken)$/i, Hs = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Bs = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, Fs = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Ws = /\b(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|api_key|apiKey|apikey|client_secret|clientSecret|password|secret|token|jwt|csrf|csrfToken|xsrf|xsrfToken)\b\s*[:=]\s*["']?[^"',&\s}]+/gi, So = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, To = /\bhttps?:\/\/[^\s"'<>]+/gi, wo = /[),.;\]]+$/;
6276
6286
  function L(s) {
6277
6287
  return Oe(s, 0, /* @__PURE__ */ new WeakSet());
6278
6288
  }
@@ -6281,7 +6291,7 @@ function Oe(s, e, t) {
6281
6291
  return s.startsWith("data:image/") || s.startsWith("data:application/pdf;") ? s : xe(s);
6282
6292
  if (s === null || typeof s != "object")
6283
6293
  return s;
6284
- if (e >= go)
6294
+ if (e >= yo)
6285
6295
  return "[REDACTED_MAX_DEPTH]";
6286
6296
  if (t.has(s))
6287
6297
  return "[REDACTED_CIRCULAR]";
@@ -6289,71 +6299,71 @@ function Oe(s, e, t) {
6289
6299
  return s.map((i) => Oe(i, e + 1, t));
6290
6300
  const n = {};
6291
6301
  for (const [i, r] of Object.entries(s))
6292
- i === "pageContent" ? n[i] = r : Fs(i) ? n[i] = Be : n[i] = i.toLowerCase() === "url" ? So(r) : Oe(r, e + 1, t);
6302
+ i === "pageContent" ? n[i] = r : $s(i) ? n[i] = Be : n[i] = i.toLowerCase() === "url" ? Ao(r) : Oe(r, e + 1, t);
6293
6303
  return n;
6294
6304
  }
6295
- function Fs(s) {
6305
+ function $s(s) {
6296
6306
  const e = s.replace(/[^a-z0-9]/gi, "").toLowerCase();
6297
6307
  return e.includes("authorization") || e.includes("cookie") || e.includes("password") || e.includes("passwd") || e === "pwd" || e.includes("secret") || e === "token" || e.endsWith("token") || e.includes("apikey") || e.includes("csrf") || e.includes("xsrf") || e === "jwt" || e === "session" || e === "signature" || e.includes("privatekey");
6298
6308
  }
6299
- function So(s) {
6300
- return typeof s == "string" ? $s(s) : Oe(s, 0, /* @__PURE__ */ new WeakSet());
6309
+ function Ao(s) {
6310
+ return typeof s == "string" ? js(s) : Oe(s, 0, /* @__PURE__ */ new WeakSet());
6301
6311
  }
6302
- function $s(s) {
6312
+ function js(s) {
6303
6313
  try {
6304
6314
  const e = new URL(s, location.href);
6305
6315
  for (const t of Array.from(e.searchParams.keys()))
6306
- fo.test(t) && e.searchParams.set(t, $);
6316
+ Io.test(t) && e.searchParams.set(t, $);
6307
6317
  return e.username && (e.username = $), e.password && (e.password = $), e.toString();
6308
6318
  } catch {
6309
- return To(s);
6319
+ return Mo(s);
6310
6320
  }
6311
6321
  }
6312
6322
  function xe(s) {
6313
- return s.replace(mo, po).replace(yo, wo).replace(Ns, `Bearer ${$}`).replace(Hs, `Basic ${$}`).replace(Bs, $).replace(Ws, (e, t) => `${t}: ${Be}`);
6323
+ return s.replace(So, mo).replace(To, bo).replace(Hs, `Bearer ${$}`).replace(Bs, `Basic ${$}`).replace(Fs, $).replace(Ws, (e, t) => `${t}: ${Be}`);
6314
6324
  }
6315
- function To(s) {
6316
- return s.replace(Ns, `Bearer ${$}`).replace(Hs, `Basic ${$}`).replace(Bs, $).replace(Ws, (e, t) => `${t}: ${Be}`);
6325
+ function Mo(s) {
6326
+ return s.replace(Hs, `Bearer ${$}`).replace(Bs, `Basic ${$}`).replace(Fs, $).replace(Ws, (e, t) => `${t}: ${Be}`);
6317
6327
  }
6318
- function wo(s) {
6319
- const e = s.match(Io)?.[0] ?? "", t = e ? s.slice(0, -e.length) : s;
6320
- return `${$s(t)}${e}`;
6328
+ function bo(s) {
6329
+ const e = s.match(wo)?.[0] ?? "", t = e ? s.slice(0, -e.length) : s;
6330
+ return `${js(t)}${e}`;
6321
6331
  }
6322
- const Po = Object.freeze({
6332
+ const Do = Object.freeze({
6323
6333
  init: (s) => Ne.init(s)
6324
6334
  });
6325
- function vo(s) {
6335
+ function qo(s) {
6326
6336
  return Ne.init(s);
6327
6337
  }
6328
6338
  export {
6329
6339
  Ht as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
6330
- Dn as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
6331
- Un as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
6332
- qn as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
6333
- _o as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
6334
- Po as PlunoProductAgent,
6335
- kn as ProductAgentInteractionManager,
6340
+ xn as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
6341
+ On as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
6342
+ Ln as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
6343
+ Uo as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
6344
+ Do as PlunoProductAgent,
6345
+ _n as ProductAgentInteractionManager,
6336
6346
  xt as ProductAgentQueryController,
6337
- Co as ProductAgentRemoteRuntimeClient,
6347
+ vo as ProductAgentRemoteRuntimeClient,
6338
6348
  Ne as ProductAgentSessionEngine,
6339
- Mn as ProductAgentSessionHistoryManager,
6340
- Ro as ProductAgentTaskPageTitleController,
6341
- J as ProductAgentTokenProviderError,
6342
- hi as calculateReconnectDelay,
6343
- bo as createLocalStorageInteractionDecisionStorage,
6344
- ke as createProductAgentQueryState,
6345
- vo as createProductAgentRuntime,
6346
- ko as createProductAgentTaskPageTitleDocument,
6347
- Po as default,
6348
- Pn as formatProductAgentTaskPageTitle,
6349
- Ni as getProductAgentOriginAccessErrorMessage,
6350
- Eo as isProductAgentRuntimeCommand,
6351
- Tn as mergeProductAgentEntityPages,
6352
- Ee as normalizeProductAgentEntityPage,
6349
+ En as ProductAgentSessionHistoryManager,
6350
+ Co as ProductAgentTaskPageTitleController,
6351
+ X as ProductAgentTokenProviderError,
6352
+ fi as calculateReconnectDelay,
6353
+ ko as createLocalStorageInteractionDecisionStorage,
6354
+ Ee as createProductAgentQueryState,
6355
+ qo as createProductAgentRuntime,
6356
+ _o as createProductAgentTaskPageTitleDocument,
6357
+ Do as default,
6358
+ Dn as formatProductAgentTaskPageTitle,
6359
+ Fi as getProductAgentOriginAccessErrorMessage,
6360
+ Po as isProductAgentRuntimeCommand,
6361
+ Mn as mergeProductAgentEntityPages,
6362
+ ke as normalizeProductAgentEntityPage,
6353
6363
  st as normalizeProductAgentSessionItems,
6354
- En as readLocalStorageInteractionDecisions,
6355
- Mo as resolveProductAgentComposerAction,
6356
- Ao as resolveProductAgentWidgetPresentation,
6357
- Is as selectProductAgentQueryEntities,
6358
- Qr as validateProductAgentProviderInputFile
6364
+ Pn as readLocalStorageInteractionDecisions,
6365
+ Eo as resolveProductAgentComposerAction,
6366
+ Ro as resolveProductAgentWidgetPresentation,
6367
+ Ss as selectProductAgentQueryEntities,
6368
+ Jr as validateProductAgentProviderInputFile
6359
6369
  };