@pluno/product-agent-web 0.1.215 → 0.1.216

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- class Js {
1
+ class Xs {
2
2
  constructor(e, t, n) {
3
3
  this.handlers = e, this.accept = t, this.errorAdapter = n;
4
4
  }
@@ -37,7 +37,7 @@ class Js {
37
37
  );
38
38
  }
39
39
  }
40
- class Xs {
40
+ class Ys {
41
41
  state;
42
42
  reducer;
43
43
  selector;
@@ -47,7 +47,7 @@ class Xs {
47
47
  draining = !1;
48
48
  disposed = !1;
49
49
  constructor(e) {
50
- this.state = e.initialState, this.reducer = e.reducer, this.selector = e.selector, this.effectRunner = new Js(
50
+ this.state = e.initialState, this.reducer = e.reducer, this.selector = e.selector, this.effectRunner = new Xs(
51
51
  e.effectHandlers,
52
52
  (t) => this.acceptEffectResult(t),
53
53
  e.errorAdapter
@@ -117,7 +117,7 @@ function it(s) {
117
117
  const e = Object.getPrototypeOf(s);
118
118
  return e !== Object.prototype && e !== null ? !1 : Object.values(s).every(it);
119
119
  }
120
- function Ys(s) {
120
+ function Zs(s) {
121
121
  if (s.details !== void 0 && !it(s.details))
122
122
  throw new TypeError("Product Agent transported error details must be JSON-safe.");
123
123
  return {
@@ -127,7 +127,7 @@ function Ys(s) {
127
127
  ...s.details === void 0 ? {} : { details: s.details }
128
128
  };
129
129
  }
130
- const Zs = Object.freeze({
130
+ const en = Object.freeze({
131
131
  modelSelection: "legacy",
132
132
  directory: "legacy",
133
133
  conversation: "legacy",
@@ -136,18 +136,18 @@ const Zs = Object.freeze({
136
136
  browserExecution: "legacy"
137
137
  });
138
138
  function Ut(s, e) {
139
- const t = Zs[s], n = e[t];
139
+ const t = en[s], n = e[t];
140
140
  if (!n) throw new Error(`No ${t} implementation for ${s}.`);
141
141
  return n();
142
142
  }
143
- class en {
143
+ class tn {
144
144
  // Stage 3 installs the Stage 1 engine/runner without shadow copies of legacy product slices.
145
- engine = new Xs({
145
+ engine = new Ys({
146
146
  initialState: Object.freeze({ revision: 0, slices: Object.freeze({}) }),
147
147
  reducer: (e) => ({ state: e, effects: [] }),
148
148
  selector: (e) => e,
149
149
  effectHandlers: {},
150
- errorAdapter: (e) => Ys({
150
+ errorAdapter: (e) => Zs({
151
151
  code: "runtime_error",
152
152
  message: e instanceof Error ? e.message : String(e),
153
153
  retryable: !1
@@ -169,16 +169,16 @@ class en {
169
169
  }
170
170
  }
171
171
  const Dt = 500;
172
- function ms(s) {
172
+ function ys(s) {
173
173
  const e = s.replace(/\n\s*at\s[\s\S]*$/, "").replace(/-----BEGIN [^-]*PRIVATE KEY-----[\s\S]*?(?:-----END [^-]*PRIVATE KEY-----|$)/g, "[REDACTED]").replace(/\b(?:set-cookie|cookie)\s*[:=]\s*[^\n]+/gi, "cookie=[REDACTED]").replace(/\bdata:[^\s<>"']+/gi, "[DATA]").replace(/\b(?:https?:\/\/|www\.)[^\s<>"']+/gi, "[URL]").replace(/\b(?:Bearer|Basic)\s+[^\s,;"']+/gi, "[REDACTED]").replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?/g, "[REDACTED]").replace(/\b(?:sk|pk|ghp|gho|github_pat|xoxb|xoxp)[-_][A-Za-z0-9_-]{8,}/g, "[REDACTED]").replace(/\b((?:access|refresh|id|auth)[_-]?token|api[_-]?key|client[_-]?secret|password|passwd|pwd|secret|token|jwt|authorization|cookie|set-cookie)\b["']?\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s,;}&]+)/gi, "$1=[REDACTED]").replace(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/gi, "[EMAIL]").replace(/(?:[A-Z]:[\\/]|\\\\|(?:~|\.\.?)?\/|[\w.-]+[\\/])[^\s<>"']+/gi, "[FILE]").replace(new RegExp("(?<![\\w.])(?:[\\w.-]+\\.[A-Z][A-Z0-9]{0,15}|\\.[A-Z][\\w.-]*)\\b", "gi"), "[FILE]").replace(/\s+/g, " ").trim();
174
174
  return e.length > Dt ? `${e.slice(0, Dt - 1)}…` : e;
175
175
  }
176
- const tn = "pluno-product-agent-attachments", sn = 1, rt = "files", nn = 1440 * 60 * 1e3;
177
- async function rn(s) {
176
+ const sn = "pluno-product-agent-attachments", nn = 1, rt = "files", rn = 1440 * 60 * 1e3;
177
+ async function on(s) {
178
178
  const e = await yt();
179
- await ln(e, "readwrite", (t) => t.put(s));
179
+ await cn(e, "readwrite", (t) => t.put(s));
180
180
  }
181
- async function on(s, e) {
181
+ async function an(s, e) {
182
182
  const t = await yt();
183
183
  await It(t, "readwrite", async (n) => {
184
184
  const i = await St(
@@ -190,7 +190,7 @@ async function on(s, e) {
190
190
  });
191
191
  });
192
192
  }
193
- async function an(s = nn) {
193
+ async function ln(s = rn) {
194
194
  const e = await yt(), t = Date.now() - s;
195
195
  await It(e, "readwrite", async (n) => {
196
196
  const i = n.index("lastUsedAt");
@@ -199,14 +199,14 @@ async function an(s = nn) {
199
199
  }
200
200
  function yt() {
201
201
  return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((s, e) => {
202
- const t = indexedDB.open(tn, sn);
202
+ const t = indexedDB.open(sn, nn);
203
203
  t.onupgradeneeded = () => {
204
204
  const i = t.result.createObjectStore(rt, { keyPath: "attachmentId" });
205
205
  i.createIndex("lastUsedAt", "lastUsedAt", { unique: !1 }), i.createIndex("sessionId", "sessionId", { unique: !1 }), i.createIndex("origin", "origin", { unique: !1 });
206
206
  }, t.onsuccess = () => s(t.result), t.onerror = () => e(t.error ?? new Error("Failed to open Product Agent attachment storage"));
207
207
  });
208
208
  }
209
- async function ln(s, e, t) {
209
+ async function cn(s, e, t) {
210
210
  return await It(s, e, async (n) => await St(t(n)));
211
211
  }
212
212
  function It(s, e, t) {
@@ -236,11 +236,11 @@ function St(s) {
236
236
  s.onsuccess = () => e(s.result), s.onerror = () => t(s.error ?? new Error("Product Agent attachment storage request failed"));
237
237
  });
238
238
  }
239
- function cn(s) {
239
+ function un(s) {
240
240
  return s !== null && (typeof s == "object" || typeof s == "function");
241
241
  }
242
- function ys(s, e, t) {
243
- const n = Reflect.get(s, "pluno"), i = cn(n) ? n : {};
242
+ function Is(s, e, t) {
243
+ const n = Reflect.get(s, "pluno"), i = un(n) ? n : {};
244
244
  if (i !== n && !Reflect.set(s, "pluno", i))
245
245
  return null;
246
246
  const r = Object.getOwnPropertyDescriptor(i, e);
@@ -254,20 +254,20 @@ function ys(s, e, t) {
254
254
  }
255
255
  };
256
256
  }
257
- const un = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
257
+ const dn = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
258
258
  function qt(s, e) {
259
259
  return e ? s.replace(
260
- un,
260
+ dn,
261
261
  (t, n, i, r) => `${n}${new URL(i, e).toString()}${r}`
262
262
  ) : s;
263
263
  }
264
264
  const Tt = "suggest_share_on_socials";
265
- function dn(s) {
265
+ function hn(s) {
266
266
  for (let e = s.length - 1; e >= 0; e -= 1) {
267
267
  const t = s[e];
268
268
  if (t.role !== "tool" || t.toolName !== Tt || t.sharePromptAllowed !== void 0)
269
269
  continue;
270
- if (pn(s, e, t.callId) !== !0)
270
+ if (gn(s, e, t.callId) !== !0)
271
271
  return null;
272
272
  const n = Ot(s, e, "assistant");
273
273
  if (!n)
@@ -281,7 +281,7 @@ function dn(s) {
281
281
  }
282
282
  return null;
283
283
  }
284
- function hn(s) {
284
+ function pn(s) {
285
285
  let e = s;
286
286
  if (typeof s == "string")
287
287
  try {
@@ -289,10 +289,10 @@ function hn(s) {
289
289
  } catch {
290
290
  return null;
291
291
  }
292
- const t = gn(e);
292
+ const t = fn(e);
293
293
  return t ? typeof t.showSharePrompt == "boolean" ? t.showSharePrompt : t.ok === !0 && typeof t.message == "string" && t.message.includes("social-sharing prompt") ? !0 : null : null;
294
294
  }
295
- function pn(s, e, t) {
295
+ function gn(s, e, t) {
296
296
  if (!t)
297
297
  return null;
298
298
  for (let n = e + 1; n < s.length; n += 1) {
@@ -310,14 +310,14 @@ function Ot(s, e, t) {
310
310
  }
311
311
  return null;
312
312
  }
313
- function gn(s) {
313
+ function fn(s) {
314
314
  return s && typeof s == "object" && !Array.isArray(s) ? s : null;
315
315
  }
316
- const fn = "save_runtime_captured_skill";
317
- function mn(s) {
318
- return (s.type === "function_call" || s.type === "tool_call") && s.name === fn;
316
+ const mn = "save_runtime_captured_skill";
317
+ function yn(s) {
318
+ return (s.type === "function_call" || s.type === "tool_call") && s.name === mn;
319
319
  }
320
- function yn(s, e, t) {
320
+ function In(s, e, t) {
321
321
  const n = e.map((h) => ({ item: h, identity: t(h) })), i = new Set(
322
322
  n.flatMap(
323
323
  ({ identity: h }) => h.isActivity && !h.isTransient ? h.activityKeys ?? [] : []
@@ -361,10 +361,10 @@ function xt(s, e, t, n) {
361
361
  return !r.isActivity || !r.isTransient ? !0 : e !== null && r.respondsToUserMessageId !== void 0 ? r.respondsToUserMessageId !== e : t === null || r.runId !== t;
362
362
  });
363
363
  }
364
- const Ke = "pluno.productAgent.transportId", In = "pluno.productAgent.transportIdentity", Ge = "pluno.productAgent.transportIdentity.event", Sn = 50, Tn = globalThis.setTimeout.bind(globalThis);
364
+ const Ke = "pluno.productAgent.transportId", Sn = "pluno.productAgent.transportIdentity", Ge = "pluno.productAgent.transportIdentity.event", Tn = 50, wn = globalThis.setTimeout.bind(globalThis);
365
365
  let le = null;
366
366
  const Re = /* @__PURE__ */ new Set(), Ve = /* @__PURE__ */ new Map();
367
- async function wn(s = Is()) {
367
+ async function An(s = Ss()) {
368
368
  const e = s.randomUUID(), t = s.storage.getItem(Ke);
369
369
  let n = t ?? s.randomUUID(), i = !1, r = !1;
370
370
  const o = s.channel.subscribe((l) => {
@@ -402,9 +402,9 @@ async function wn(s = Is()) {
402
402
  }
403
403
  };
404
404
  }
405
- async function An(s = !1) {
406
- le || (le = wn({
407
- ...Is(),
405
+ async function bn(s = !1) {
406
+ le || (le = An({
407
+ ...Ss(),
408
408
  skipStoredIdentityCollisionCheck: s
409
409
  }), le.then((i) => {
410
410
  const r = (o) => {
@@ -412,7 +412,7 @@ async function An(s = !1) {
412
412
  };
413
413
  window.addEventListener("pagehide", r);
414
414
  }));
415
- const e = await le, t = bn();
415
+ const e = await le, t = Mn();
416
416
  Re.add(t);
417
417
  let n = !1;
418
418
  return {
@@ -423,21 +423,21 @@ async function An(s = !1) {
423
423
  }
424
424
  };
425
425
  }
426
- function bn() {
426
+ function Mn() {
427
427
  let s = 0;
428
428
  for (; Re.has(s); )
429
429
  s += 1;
430
430
  return s;
431
431
  }
432
- function Is() {
432
+ function Ss() {
433
433
  return {
434
- storage: Mn(),
435
- channel: Rn(),
434
+ storage: Rn(),
435
+ channel: kn(),
436
436
  randomUUID: () => crypto.randomUUID(),
437
- settle: () => new Promise((s) => Tn(s, Sn))
437
+ settle: () => new Promise((s) => wn(s, Tn))
438
438
  };
439
439
  }
440
- function Mn() {
440
+ function Rn() {
441
441
  return {
442
442
  getItem: (s) => {
443
443
  try {
@@ -455,9 +455,9 @@ function Mn() {
455
455
  }
456
456
  };
457
457
  }
458
- function Rn() {
458
+ function kn() {
459
459
  if (typeof BroadcastChannel < "u") {
460
- const s = new BroadcastChannel(In);
460
+ const s = new BroadcastChannel(Sn);
461
461
  return {
462
462
  postMessage: (e) => s.postMessage(e),
463
463
  subscribe: (e) => {
@@ -467,9 +467,9 @@ function Rn() {
467
467
  close: () => s.close()
468
468
  };
469
469
  }
470
- return kn();
470
+ return En();
471
471
  }
472
- function kn() {
472
+ function En() {
473
473
  const s = /* @__PURE__ */ new Set(), e = (t) => {
474
474
  if (t.key !== Ge || !t.newValue)
475
475
  return;
@@ -490,8 +490,8 @@ function kn() {
490
490
  }
491
491
  };
492
492
  }
493
- const Ss = "schedule_follow_up";
494
- function En(s) {
493
+ const Ts = "schedule_follow_up";
494
+ function Cn(s) {
495
495
  let e = s;
496
496
  if (typeof e == "string")
497
497
  try {
@@ -502,45 +502,45 @@ function En(s) {
502
502
  if (!e || typeof e != "object")
503
503
  return null;
504
504
  const t = e;
505
- return t.ok !== !0 || t.toolName !== Ss || typeof t.dueAt != "string" || Number.isNaN(Date.parse(t.dueAt)) ? null : {
505
+ return t.ok !== !0 || t.toolName !== Ts || typeof t.dueAt != "string" || Number.isNaN(Date.parse(t.dueAt)) ? null : {
506
506
  id: typeof t.taskId == "string" && t.taskId ? t.taskId : null,
507
507
  dueAt: t.dueAt
508
508
  };
509
509
  }
510
- const Cn = [
510
+ const _n = [
511
511
  { value: "gpt-5.6-sol", label: "gpt-5.6-sol", price: "$$" },
512
512
  { value: "anthropic/claude-sonnet-5", label: "Claude Sonnet 5", price: "$$" },
513
513
  { value: "deepseek/deepseek-v4-flash", label: "DeepSeek V4 Flash", price: "$" }
514
- ], _n = [
514
+ ], Pn = [
515
515
  { value: "anthropic/claude-opus-5", label: "Claude Opus 5", price: "$$$" },
516
516
  { value: "gpt-5.6-terra", label: "gpt-5.6-terra", price: "$$" }
517
- ], Pn = [
518
- ...Cn,
519
- ..._n
520
- ], Qe = (s) => Pn.some((e) => e.value === s);
517
+ ], vn = [
518
+ ..._n,
519
+ ...Pn
520
+ ], Qe = (s) => vn.some((e) => e.value === s);
521
521
  function Lt(s, e) {
522
522
  return s.filter((t, n) => {
523
523
  const i = Nt(t);
524
- return Ts(i) ? !s.slice(n + 1).some((r) => {
524
+ return ws(i) ? !s.slice(n + 1).some((r) => {
525
525
  const o = Nt(r);
526
- return ws(i, o) && As(i, o);
526
+ return As(i, o) && bs(i, o);
527
527
  }) : !0;
528
528
  });
529
529
  }
530
- function Ts(s) {
530
+ function ws(s) {
531
531
  return s.type === "run_status" && s.status === "stopped" && s.reason === "task_tab_closed";
532
532
  }
533
- function vn(s, e) {
534
- return s.reason === "task_tab_closed" && As(s, e) && ws(s, e);
533
+ function Un(s, e) {
534
+ return s.reason === "task_tab_closed" && bs(s, e) && As(s, e);
535
535
  }
536
536
  function Nt(s) {
537
537
  return s.data && typeof s.data == "object" ? s.data : {};
538
538
  }
539
- function ws(s, e) {
539
+ function As(s, e) {
540
540
  const t = typeof s.runId == "string" ? s.runId : null, n = typeof e.runId == "string" ? e.runId : null;
541
- return t && n && t === n ? !1 : e.type === "message" ? e.role === "assistant" : e.type === "run_status" ? !Ts(e) : e.type === "run_error";
541
+ return t && n && t === n ? !1 : e.type === "message" ? e.role === "assistant" : e.type === "run_status" ? !ws(e) : e.type === "run_error";
542
542
  }
543
- function As(s, e) {
543
+ function bs(s, e) {
544
544
  return typeof s.respondsToUserMessageId == "string" && typeof e.respondsToUserMessageId == "string" ? s.respondsToUserMessageId === e.respondsToUserMessageId : typeof s.clientMessageId == "string" && typeof e.clientMessageId == "string" ? s.clientMessageId === e.clientMessageId : typeof s.runId == "string" && typeof e.runId == "string" && s.runId === e.runId;
545
545
  }
546
546
  function ke(s) {
@@ -638,28 +638,28 @@ function Ee(s) {
638
638
  nextCursor: s.nextCursor
639
639
  };
640
640
  }
641
- function Un(s, e, t) {
641
+ function Dn(s, e, t) {
642
642
  if (t === "replace" || s === null) return e;
643
643
  const n = { ...s.entitiesById, ...e.entitiesById }, i = [...s.ids];
644
644
  for (const r of e.ids)
645
645
  s.entitiesById[r] || i.push(r);
646
646
  return { entitiesById: n, ids: i, nextCursor: e.nextCursor };
647
647
  }
648
- function bs(s) {
648
+ function Ms(s) {
649
649
  return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
650
650
  }
651
- function Lo(s) {
651
+ function No(s) {
652
652
  return s.visible ? s.minimized ? { state: "minimized" } : { state: s.open ? "visible_open" : "visible_closed" } : { state: "hidden" };
653
653
  }
654
- function Dn(s, e) {
654
+ function qn(s, e) {
655
655
  return e === "limit_exceeded" ? { allowed: !1, reason: "credits_exhausted", actions: ["upgrade", "earn_credits"] } : e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required" ? { allowed: !1, reason: "payment_issue", actions: ["upgrade"] } : s ?? { allowed: !0, reason: "allowed", actions: [] };
656
656
  }
657
- function qn(s) {
657
+ function On(s) {
658
658
  if (!s || typeof s != "object") return !1;
659
659
  const e = s.paidCreditFallbackModel;
660
660
  return typeof e == "string" && e.length > 0;
661
661
  }
662
- function No(s) {
662
+ function Ho(s) {
663
663
  const e = s.hasDraftMessage || s.hasPreSubmittedAttachment;
664
664
  return s.hasRunningAssistantTurn && !e ? {
665
665
  action: "stop",
@@ -669,7 +669,7 @@ function No(s) {
669
669
  disabled: !e || !s.canSubmitMessage
670
670
  };
671
671
  }
672
- class On {
672
+ class xn {
673
673
  constructor(e, t, n = 20) {
674
674
  this.loadPage = t, this.limit = n, this.recentQuery = new Ht(
675
675
  `${e}:recent`,
@@ -679,7 +679,7 @@ class On {
679
679
  nextCursor: r.nextCursor
680
680
  }))
681
681
  ),
682
- Un
682
+ Dn
683
683
  ), this.pinnedQuery = new Ht(
684
684
  `${e}:pinned`,
685
685
  async () => Ee({
@@ -712,7 +712,7 @@ class On {
712
712
  }) : null;
713
713
  return {
714
714
  key: e.key.slice(0, -7),
715
- status: xn(e, t),
715
+ status: Ln(e, t),
716
716
  data: a,
717
717
  error: e.error ?? t.error,
718
718
  requestId: Math.max(e.requestId, t.requestId),
@@ -821,7 +821,7 @@ class On {
821
821
  function Ie(s) {
822
822
  return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
823
823
  }
824
- function xn(s, e) {
824
+ function Ln(s, e) {
825
825
  return s.status === "error" || e.status === "error" ? "error" : s.status === "loading" || e.status === "loading" ? "loading" : s.status === "refreshing" || e.status === "refreshing" ? "refreshing" : s.status === "loading_more" ? "loading_more" : s.status === "ready" || e.status === "ready" ? "ready" : "not_requested";
826
826
  }
827
827
  class Bt {
@@ -868,7 +868,7 @@ class Bt {
868
868
  this.schedule(r, e);
869
869
  }
870
870
  }
871
- class Ln {
871
+ class Nn {
872
872
  constructor(e) {
873
873
  this.options = e;
874
874
  }
@@ -920,7 +920,7 @@ class Ln {
920
920
  );
921
921
  }
922
922
  }
923
- class Nn {
923
+ class Hn {
924
924
  constructor(e, t = null) {
925
925
  this.storage = e, t && (this.decisions = new Map(
926
926
  t.filter(ot).map((n) => [this.getDecisionKey(n), n])
@@ -973,7 +973,7 @@ class Nn {
973
973
  async applyAction(e, t, n) {
974
974
  if (!e.allowedActions.includes(t))
975
975
  throw new Error(`Interaction ${e.key} does not allow ${t}.`);
976
- if (!Ms(t))
976
+ if (!Rs(t))
977
977
  throw new Error(`Interaction action ${t} is not a persistence decision.`);
978
978
  const i = n.now ?? /* @__PURE__ */ new Date(), r = {
979
979
  promptKey: e.key,
@@ -1009,13 +1009,13 @@ class Nn {
1009
1009
  return `${Je(e.scope)}:category:${e.category}`;
1010
1010
  }
1011
1011
  }
1012
- function Ho(s, e) {
1012
+ function Bo(s, e) {
1013
1013
  return {
1014
- load: async () => Hn(s, e),
1014
+ load: async () => Bn(s, e),
1015
1015
  save: async (t) => s.setItem(e, JSON.stringify(t))
1016
1016
  };
1017
1017
  }
1018
- function Hn(s, e) {
1018
+ function Bn(s, e) {
1019
1019
  const t = s.getItem(e);
1020
1020
  if (!t) return [];
1021
1021
  const n = JSON.parse(t);
@@ -1024,26 +1024,26 @@ function Hn(s, e) {
1024
1024
  function Je(s) {
1025
1025
  return `${s.level}:${s.key}`;
1026
1026
  }
1027
- function Ms(s) {
1027
+ function Rs(s) {
1028
1028
  return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
1029
1029
  }
1030
1030
  function ot(s) {
1031
1031
  if (!s || typeof s != "object") return !1;
1032
1032
  const e = s;
1033
- return typeof e.promptKey == "string" && typeof e.category == "string" && typeof e.decidedAt == "string" && (e.nextEligibleAt === null || typeof e.nextEligibleAt == "string") && Ms(e.action) && !!(e.scope && typeof e.scope == "object" && typeof e.scope.level == "string" && typeof e.scope.key == "string");
1033
+ return typeof e.promptKey == "string" && typeof e.category == "string" && typeof e.decidedAt == "string" && (e.nextEligibleAt === null || typeof e.nextEligibleAt == "string") && Rs(e.action) && !!(e.scope && typeof e.scope == "object" && typeof e.scope.level == "string" && typeof e.scope.key == "string");
1034
1034
  }
1035
- const Bn = {
1035
+ const Fn = {
1036
1036
  working: "⏳",
1037
1037
  completed: "✅",
1038
1038
  failed: "❗",
1039
1039
  stopped: "⏹️"
1040
- }, Fn = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
1041
- function Wn(s, e) {
1040
+ }, Wn = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
1041
+ function $n(s, e) {
1042
1042
  if (!e) return ve(s);
1043
- const t = ve(s), n = `${Bn[e]} Pluno`;
1043
+ const t = ve(s), n = `${Fn[e]} Pluno`;
1044
1044
  return t ? `${n}: ${t}` : n;
1045
1045
  }
1046
- class Bo {
1046
+ class Fo {
1047
1047
  constructor(e) {
1048
1048
  this.titleDocument = e;
1049
1049
  }
@@ -1077,11 +1077,11 @@ class Bo {
1077
1077
  applyTitle() {
1078
1078
  if (!this.status)
1079
1079
  return;
1080
- const e = Wn(this.baseTitle, this.status);
1080
+ const e = $n(this.baseTitle, this.status);
1081
1081
  this.lastAppliedTitle = e, this.titleDocument.getTitle() !== e && this.titleDocument.setTitle(e);
1082
1082
  }
1083
1083
  }
1084
- function Fo(s) {
1084
+ function Wo(s) {
1085
1085
  return {
1086
1086
  getTitle: () => s.title,
1087
1087
  setTitle: (e) => {
@@ -1098,9 +1098,9 @@ function Fo(s) {
1098
1098
  };
1099
1099
  }
1100
1100
  function ve(s) {
1101
- return s.replace(Fn, "");
1101
+ return s.replace(Wn, "");
1102
1102
  }
1103
- const $n = {
1103
+ const jn = {
1104
1104
  "duplicate-message-item": "A canonical message rendered more than once.",
1105
1105
  "duplicate-canonical-item": "A canonical session item rendered more than once.",
1106
1106
  "duplicate-tool-call": "A tool call rendered more than once.",
@@ -1113,8 +1113,8 @@ const $n = {
1113
1113
  "thinking-groups-without-user-message": "Multiple thinking groups appeared without a user message between them.",
1114
1114
  "thinking-without-progress": "Thinking remained visible without progress for five minutes."
1115
1115
  };
1116
- function jn(s) {
1117
- return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call($n, s.slice(13));
1116
+ function zn(s) {
1117
+ return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(jn, s.slice(13));
1118
1118
  }
1119
1119
  function Ft(s) {
1120
1120
  return {
@@ -1127,7 +1127,7 @@ function Ft(s) {
1127
1127
  ...s.fileUrl === void 0 ? {} : { fileUrl: s.fileUrl }
1128
1128
  };
1129
1129
  }
1130
- function Wo(s) {
1130
+ function $o(s) {
1131
1131
  if (!s || typeof s != "object" || !("type" in s)) return !1;
1132
1132
  const e = s;
1133
1133
  switch (e.type) {
@@ -1141,7 +1141,7 @@ function Wo(s) {
1141
1141
  case "runtime.report_displayed_error":
1142
1142
  return (e.reason === "conversation_error" || e.reason === "attachment_error" || e.reason === "history_error" || e.reason === "action_error") && typeof e.errorFingerprint == "string" && /^fnv1a-[0-9a-f]{8}$/.test(e.errorFingerprint) && (e.displayedMessage === void 0 || typeof e.displayedMessage == "string" && e.displayedMessage.length <= 500);
1143
1143
  case "runtime.report_invalid_state_transition":
1144
- return (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" || jn(e.reason)) && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
1144
+ return (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" || zn(e.reason)) && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
1145
1145
  case "runtime.widget_lifecycle":
1146
1146
  return (e.action === "opened" || e.action === "closed" || e.action === "minimized") && typeof e.trigger == "string";
1147
1147
  case "session.load":
@@ -1168,7 +1168,7 @@ function Wo(s) {
1168
1168
  return !1;
1169
1169
  }
1170
1170
  }
1171
- class $o {
1171
+ class jo {
1172
1172
  constructor(e, t, n) {
1173
1173
  this.adapter = t, this.state = Xe(e), this.model = n;
1174
1174
  }
@@ -1206,7 +1206,7 @@ class $o {
1206
1206
  (c) => c.clientMessageId === o
1207
1207
  );
1208
1208
  if (l) {
1209
- l.attachments = zn(
1209
+ l.attachments = Kn(
1210
1210
  a.message.attachments,
1211
1211
  l.attachments
1212
1212
  ), this.unacknowledgedSubmissions.delete(o);
@@ -1260,7 +1260,7 @@ class $o {
1260
1260
  type: "runtime.report_displayed_error",
1261
1261
  reason: e,
1262
1262
  errorFingerprint: t,
1263
- ...n ? { displayedMessage: ms(n) } : {}
1263
+ ...n ? { displayedMessage: ys(n) } : {}
1264
1264
  }).catch(() => {
1265
1265
  });
1266
1266
  }
@@ -1381,7 +1381,7 @@ class $o {
1381
1381
  await this.dispatch({ type: "session.list", ...e });
1382
1382
  const t = this.sessionHistoryState.data;
1383
1383
  return {
1384
- sessions: bs(t),
1384
+ sessions: Ms(t),
1385
1385
  nextCursor: t?.nextCursor ?? null
1386
1386
  };
1387
1387
  }
@@ -1465,7 +1465,7 @@ class $o {
1465
1465
  for (const i of n ?? []) i(t);
1466
1466
  }
1467
1467
  }
1468
- function zn(s, e) {
1468
+ function Kn(s, e) {
1469
1469
  if (!e || !s) return e;
1470
1470
  const t = /* @__PURE__ */ new Map();
1471
1471
  for (const n of s) {
@@ -1505,12 +1505,12 @@ function Wt(s) {
1505
1505
  return {
1506
1506
  ...s,
1507
1507
  data: s.data ? Ee({
1508
- entities: bs(s.data).map((e) => ({ ...e })),
1508
+ entities: Ms(s.data).map((e) => ({ ...e })),
1509
1509
  nextCursor: s.data.nextCursor
1510
1510
  }) : null
1511
1511
  };
1512
1512
  }
1513
- const Kn = globalThis.fetch.bind(globalThis), $t = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', Gn = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Vn = ".pluno-pa-widget__panel", Qn = ".pluno-pa-widget__timeline", Jn = "__plunoExtensionWidgetOwner";
1513
+ const Gn = globalThis.fetch.bind(globalThis), $t = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', Vn = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Qn = ".pluno-pa-widget__panel", Jn = ".pluno-pa-widget__timeline", Xn = "__plunoExtensionWidgetOwner";
1514
1514
  class J extends Error {
1515
1515
  constructor(e, t, n, i) {
1516
1516
  super(e), this.retryable = t, this.status = n, this.retryAfterMs = i, this.name = "ProductAgentTokenProviderError";
@@ -1519,10 +1519,10 @@ class J extends Error {
1519
1519
  status;
1520
1520
  retryAfterMs;
1521
1521
  }
1522
- function Xn(s) {
1522
+ function Yn(s) {
1523
1523
  return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
1524
1524
  }
1525
- let Yn = 0;
1525
+ let Zn = 0;
1526
1526
  function jt(s) {
1527
1527
  const e = {};
1528
1528
  for (const l of [
@@ -1601,7 +1601,7 @@ function Se(s, e, t) {
1601
1601
  source: "web_sdk",
1602
1602
  category: s,
1603
1603
  name: e,
1604
- sequence: ++Yn,
1604
+ sequence: ++Zn,
1605
1605
  wallTime: (/* @__PURE__ */ new Date()).toISOString(),
1606
1606
  monotonicMs: performance.now(),
1607
1607
  data: t
@@ -1610,27 +1610,27 @@ function Se(s, e, t) {
1610
1610
  }
1611
1611
  class Te extends Error {
1612
1612
  }
1613
- function Zn(s) {
1613
+ function ei(s) {
1614
1614
  return s === 408 || s === 425 || s === 429 || s >= 500;
1615
1615
  }
1616
- const ei = "https://app.pluno.ai", ti = 2e4, si = 1e4, ni = 6e4, ii = 6e4, ri = 1e4, oi = 1e4, ai = 3e3, li = 3e4, ci = 1e3, at = 3e4, zt = 0.2, ui = 6e4, Kt = 15e3, di = 6e4, hi = 8, pi = "Browser connection was interrupted.", Gt = 15e3, gi = "Pluno could not send this message. Try it again.", fi = "Still connecting to Pluno. Retrying automatically.", mi = 2e3, yi = 1e3, Ii = 100, Vt = 8e3, Qt = 3, Si = [300, 1e3], Rs = 50 * 1024 * 1024, Ti = /* @__PURE__ */ new Set([
1616
+ const ti = "https://app.pluno.ai", si = 2e4, ni = 1e4, ii = 6e4, ri = 6e4, oi = 1e4, ai = 1e4, li = 3e3, ci = 3e4, ui = 1e3, at = 3e4, zt = 0.2, di = 6e4, Kt = 15e3, hi = 6e4, pi = 8, gi = "Browser connection was interrupted.", Gt = 15e3, fi = "Pluno could not send this message. Try it again.", mi = "Still connecting to Pluno. Retrying automatically.", yi = 2e3, Ii = 1e3, Si = 100, Vt = 8e3, Qt = 3, Ti = [300, 1e3], ks = 50 * 1024 * 1024, wi = /* @__PURE__ */ new Set([
1617
1617
  ".jpeg:image/jpeg",
1618
1618
  ".jpg:image/jpeg",
1619
1619
  ".pdf:application/pdf",
1620
1620
  ".png:image/png",
1621
1621
  ".webp:image/webp"
1622
- ]), jo = ".pdf,.png,.jpg,.jpeg,.webp", wt = 64e3, Ye = 4e3, At = 30, wi = 2e3, Ai = 1e3, ks = "Image is too large for model vision input.", bi = 100, Mi = 20, Es = "pluno.productAgent.state.", lt = "pluno.productAgent.pendingEvents.", Le = "pluno.productAgent.activeToolCalls.", Ri = 100;
1623
- function ki(s, e = 0) {
1622
+ ]), zo = ".pdf,.png,.jpg,.jpeg,.webp", wt = 64e3, Ye = 4e3, At = 30, Ai = 2e3, bi = 1e3, Es = "Image is too large for model vision input.", Mi = 100, Ri = 20, Cs = "pluno.productAgent.state.", lt = "pluno.productAgent.pendingEvents.", Le = "pluno.productAgent.activeToolCalls.", ki = 100;
1623
+ function Ei(s, e = 0) {
1624
1624
  const t = s === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (s - 1));
1625
1625
  return Math.max(e, t);
1626
1626
  }
1627
1627
  const Ce = /* @__PURE__ */ new Set();
1628
1628
  let we = null;
1629
- function Ei(s, e = Math.random) {
1630
- const t = Math.min(at, ci * 2 ** s), n = 1 - zt + e() * zt * 2;
1629
+ function Ci(s, e = Math.random) {
1630
+ const t = Math.min(at, ui * 2 ** s), n = 1 - zt + e() * zt * 2;
1631
1631
  return Math.min(at, Math.round(t * n));
1632
1632
  }
1633
- function Ci(s) {
1633
+ function _i(s) {
1634
1634
  const e = s.split(".")[1];
1635
1635
  if (!e)
1636
1636
  return null;
@@ -1641,7 +1641,7 @@ function Ci(s) {
1641
1641
  return null;
1642
1642
  }
1643
1643
  }
1644
- function _i(s) {
1644
+ function Pi(s) {
1645
1645
  if (s instanceof J)
1646
1646
  return s.retryable;
1647
1647
  if (s && typeof s == "object") {
@@ -1651,7 +1651,7 @@ function _i(s) {
1651
1651
  }
1652
1652
  return !0;
1653
1653
  }
1654
- function Pi(s) {
1654
+ function vi(s) {
1655
1655
  if (s instanceof Error)
1656
1656
  return s;
1657
1657
  if (s && typeof s == "object") {
@@ -1665,7 +1665,7 @@ function Pi(s) {
1665
1665
  }
1666
1666
  class Ne {
1667
1667
  constructor(e, t) {
1668
- this.options = e, this.transportIdentity = t, this.sessionHistoryManager = new On(
1668
+ this.options = e, this.transportIdentity = t, this.sessionHistoryManager = new xn(
1669
1669
  e.clientId,
1670
1670
  async ({ cursor: r, limit: o, pinned: a }) => await this.listSessions({ cursor: r, limit: o, pinned: a })
1671
1671
  ), this.sessionRecoveryPoller = new Bt({
@@ -1680,7 +1680,7 @@ class Ne {
1680
1680
  activeIntervalMs: 3e3,
1681
1681
  idleIntervalMs: 15e3,
1682
1682
  maxFailureIntervalMs: 3e4
1683
- }), this.sessionActivityRecovery = new Ln({
1683
+ }), this.sessionActivityRecovery = new Nn({
1684
1684
  fetchPage: async (r, o) => await this.fetchSessionHistoryPageOnce(
1685
1685
  r,
1686
1686
  "activity",
@@ -1708,9 +1708,9 @@ class Ne {
1708
1708
  maxFailureIntervalMs: 3e4
1709
1709
  }), this.personalModelSelectionOverride = e.productVariant === "personal" && Qe(e.model) ? e.model : null, this.state = {
1710
1710
  ...this.state,
1711
- starterPrompts: dr(e.initialStarterPrompts)
1711
+ starterPrompts: hr(e.initialStarterPrompts)
1712
1712
  }, this.account = e.initialAccount ? { ...e.initialAccount } : null;
1713
- const n = e.restorePersistedState === !1 ? null : to(e.clientId, e.expectedPersistedSessionId);
1713
+ const n = e.restorePersistedState === !1 ? null : so(e.clientId, e.expectedPersistedSessionId);
1714
1714
  n && (this.state = {
1715
1715
  ...this.state,
1716
1716
  ...n,
@@ -1731,9 +1731,9 @@ class Ne {
1731
1731
  taskStatus: null,
1732
1732
  isRetrying: !1,
1733
1733
  lastError: null
1734
- }, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents = ao(
1735
- no(e.clientId),
1736
- io(e.clientId)
1734
+ }, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents = lo(
1735
+ io(e.clientId),
1736
+ ro(e.clientId)
1737
1737
  );
1738
1738
  const i = [...this.queuedClientEvents].reverse().find(
1739
1739
  (r) => r.type === "chat.user_message" && typeof r.clientMessageId == "string"
@@ -1741,7 +1741,7 @@ class Ne {
1741
1741
  i?.clientMessageId && (this.pendingClientMessageId = i.clientMessageId, this.pendingUserMessageEvent = i, this.state.pendingMessageStatus = "reconnecting", this.state.turnPhase = "sending"), Q(e.clientId, this.queuedClientEvents);
1742
1742
  }
1743
1743
  options;
1744
- clientRuntime = new en();
1744
+ clientRuntime = new tn();
1745
1745
  listeners = {};
1746
1746
  socket = null;
1747
1747
  reconnectTimer = null;
@@ -1780,7 +1780,7 @@ class Ne {
1780
1780
  accountRefresh = null;
1781
1781
  runtimeInteractions = [];
1782
1782
  interactionListeners = /* @__PURE__ */ new Set();
1783
- interactionManager = new Nn(
1783
+ interactionManager = new Hn(
1784
1784
  { load: async () => [], save: async () => {
1785
1785
  } },
1786
1786
  []
@@ -1880,17 +1880,17 @@ class Ne {
1880
1880
  lastErrorSecuritySettingsUrl: null
1881
1881
  };
1882
1882
  static async init(e) {
1883
- const t = e, n = await An(
1883
+ const t = e, n = await bn(
1884
1884
  t.skipStoredTransportIdentityCollisionCheck === !0
1885
1885
  ), i = new Ne({
1886
1886
  ...e,
1887
- backendUrl: Ji(e.backendUrl ?? ei),
1888
- clientId: e.clientId ?? mr(),
1887
+ backendUrl: Xi(e.backendUrl ?? ti),
1888
+ clientId: e.clientId ?? yr(),
1889
1889
  productVariant: e.productVariant ?? "customer_embedded",
1890
- entrySurface: Xi(e.entrySurface)
1890
+ entrySurface: Yi(e.entrySurface)
1891
1891
  }, n);
1892
1892
  try {
1893
- an().catch((r) => {
1893
+ ln().catch((r) => {
1894
1894
  M("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
1895
1895
  message: r instanceof Error ? r.message : String(r)
1896
1896
  });
@@ -1938,7 +1938,7 @@ class Ne {
1938
1938
  return this.options.token;
1939
1939
  if (!this.options.tokenProvider)
1940
1940
  return this.token;
1941
- const n = Date.now(), i = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs - ii > n;
1941
+ const n = Date.now(), i = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs - ri > n;
1942
1942
  if (!t.forceRefresh && (i || t.preferCached && this.token !== null))
1943
1943
  return this.token;
1944
1944
  if (this.tokenRequest && !t.forceRefresh)
@@ -1951,7 +1951,7 @@ class Ne {
1951
1951
  const l = new Promise((c, u) => {
1952
1952
  a = window.setTimeout(() => {
1953
1953
  r.abort(), u(new J("Pluno token provider timed out", !0));
1954
- }, ni);
1954
+ }, ii);
1955
1955
  });
1956
1956
  try {
1957
1957
  const c = await Promise.race([
@@ -1962,7 +1962,7 @@ class Ne {
1962
1962
  throw new J("Pluno token request was cancelled", !0);
1963
1963
  if (!c)
1964
1964
  throw new J("Pluno token provider did not return a token", !1);
1965
- return this.token = c, this.tokenExpiresAtMs = Ci(c), c;
1965
+ return this.token = c, this.tokenExpiresAtMs = _i(c), c;
1966
1966
  } finally {
1967
1967
  a !== null && window.clearTimeout(a);
1968
1968
  }
@@ -1988,10 +1988,10 @@ class Ne {
1988
1988
  return;
1989
1989
  if (!this.token && !this.options.webSocketFactory)
1990
1990
  throw new J("Pluno requires a token or tokenProvider", !1);
1991
- const t = er(this.options.backendUrl), n = this.options.webSocketFactory?.(t) ?? new WebSocket(t);
1991
+ const t = tr(this.options.backendUrl), n = this.options.webSocketFactory?.(t) ?? new WebSocket(t);
1992
1992
  this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
1993
1993
  this.socket === n && n.readyState === WebSocket.CONNECTING && (M("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.reportTransportDiagnostic("connect_timeout"), this.replaceTimedOutSocket(n));
1994
- }, ri), n.addEventListener("open", () => {
1994
+ }, oi), n.addEventListener("open", () => {
1995
1995
  this.socket !== n || (this.clearSocketConnectTimer(), M("web-sdk.agent", "Pluno socket opened", {
1996
1996
  queuedClientEventCount: this.queuedClientEvents.length,
1997
1997
  isThinking: this.state.isThinking
@@ -2003,13 +2003,13 @@ class Ne {
2003
2003
  pageUrl: location.href
2004
2004
  }) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
2005
2005
  this.socket === n && (M("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.reportTransportDiagnostic("auth_timeout"), this.replaceTimedOutSocket(n));
2006
- }, oi));
2006
+ }, ai));
2007
2007
  }), n.addEventListener("message", (i) => {
2008
- this.socket === n && this.handleServerEvent(cr(i.data));
2008
+ this.socket === n && this.handleServerEvent(ur(i.data));
2009
2009
  }), n.addEventListener("sendfailure", (i) => {
2010
2010
  if (this.socket !== n)
2011
2011
  return;
2012
- const r = ur(i?.detail?.data);
2012
+ const r = dr(i?.detail?.data);
2013
2013
  r?.type === "chat.user_message" && r.clientMessageId === this.pendingClientMessageId && !this.queuedClientEvents.some(
2014
2014
  (o) => o.type === "chat.user_message" && o.clientMessageId === r.clientMessageId
2015
2015
  ) && (this.queuedClientEvents.push(r), Q(this.options.clientId, this.queuedClientEvents), this.setState({ pendingMessageStatus: "reconnecting" })), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), n.readyState !== WebSocket.CLOSED && n.readyState !== WebSocket.CLOSING && n.close();
@@ -2033,14 +2033,14 @@ class Ne {
2033
2033
  } catch (t) {
2034
2034
  if (e !== this.connectionAttemptId || this.state.status === "closed")
2035
2035
  return;
2036
- const n = Pi(t);
2037
- if (_i(t)) {
2036
+ const n = vi(t);
2037
+ if (Pi(t)) {
2038
2038
  M("web-sdk.agent", "Pluno connection attempt failed; retrying", {
2039
2039
  message: n.message,
2040
2040
  reconnectAttempt: this.reconnectAttempts
2041
2041
  }), t instanceof J && this.reportTransportDiagnostic("auth_timeout"), this.setState({
2042
2042
  status: "reconnecting",
2043
- lastError: fi,
2043
+ lastError: mi,
2044
2044
  lastErrorCode: "connection_failed"
2045
2045
  }), this.emit("error", n), this.scheduleReconnect(
2046
2046
  t instanceof J ? t.retryAfterMs : void 0
@@ -2064,7 +2064,7 @@ class Ne {
2064
2064
  }
2065
2065
  destroy() {
2066
2066
  if (!this.clientRuntime.isDisposed) {
2067
- this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), lo(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [], this.detachedSessionIds.clear(), this.detachedClientMessageIds.clear(), this.deferredDetachedSessionEvents.clear();
2067
+ this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), co(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();
2068
2068
  for (const e of Object.values(this.listeners))
2069
2069
  e?.clear();
2070
2070
  this.accountListeners.clear(), this.interactionListeners.clear(), this.clientRuntime.dispose();
@@ -2108,10 +2108,10 @@ class Ne {
2108
2108
  async sendMessage(e, t = {}) {
2109
2109
  return this.clientRuntime.route("conversation", { legacy: async () => {
2110
2110
  const n = e.trim(), i = t.attachments ?? [];
2111
- if (this.options.productVariant === "customer_embedded" && (i.forEach(Bs), i.reduce(
2111
+ if (this.options.productVariant === "customer_embedded" && (i.forEach(Fs), i.reduce(
2112
2112
  (T, N) => T + N.sizeBytes,
2113
2113
  0
2114
- ) > Rs))
2114
+ ) > ks))
2115
2115
  throw new Error("Embedded attachments must total at most 50 MB per message");
2116
2116
  let r = i.map(qe);
2117
2117
  if (!n && r.length === 0)
@@ -2204,7 +2204,7 @@ class Ne {
2204
2204
  sessionId: this.state.sessionId ?? void 0,
2205
2205
  clientMessageId: a,
2206
2206
  initiatedBy: t.initiatedBy,
2207
- invocation: Yi(t.invocation ?? t.initiatedBy),
2207
+ invocation: Zi(t.invocation ?? t.initiatedBy),
2208
2208
  entrySurface: this.options.entrySurface,
2209
2209
  content: n,
2210
2210
  proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
@@ -2230,7 +2230,7 @@ class Ne {
2230
2230
  this.reportHealthSignal("user_visible_error", {
2231
2231
  reason: e,
2232
2232
  errorFingerprint: t,
2233
- ...n ? { displayedMessage: ms(n) } : {}
2233
+ ...n ? { displayedMessage: ys(n) } : {}
2234
2234
  });
2235
2235
  }
2236
2236
  getModel() {
@@ -2259,7 +2259,7 @@ class Ne {
2259
2259
  } });
2260
2260
  }
2261
2261
  createLocalAttachment(e) {
2262
- this.options.productVariant === "customer_embedded" && co(e);
2262
+ this.options.productVariant === "customer_embedded" && uo(e);
2263
2263
  const t = x(), n = {
2264
2264
  id: t,
2265
2265
  name: e.name || "attachment",
@@ -2268,7 +2268,7 @@ class Ne {
2268
2268
  };
2269
2269
  this.attachmentFiles.set(t, e);
2270
2270
  const i = Date.now();
2271
- return rn({
2271
+ return on({
2272
2272
  attachmentId: t,
2273
2273
  name: n.name,
2274
2274
  mimeType: n.mimeType,
@@ -2333,8 +2333,8 @@ class Ne {
2333
2333
  }, "Failed to upload attachment"), o = l;
2334
2334
  }
2335
2335
  this.setState({ sessionId: o.sessionId });
2336
- const a = Hs(o.attachment, this.options.backendUrl);
2337
- return this.updateAttachmentInState(t.id, a), t.id && on(t.id, {
2336
+ const a = Bs(o.attachment, this.options.backendUrl);
2337
+ return this.updateAttachmentInState(t.id, a), t.id && an(t.id, {
2338
2338
  sessionId: o.sessionId,
2339
2339
  fileUrl: a.fileUrl,
2340
2340
  sandboxPath: a.sandboxPath,
@@ -2365,7 +2365,7 @@ class Ne {
2365
2365
  const n = await this.fetchEmbedAttachmentUpload(e, !1);
2366
2366
  if (n.ok)
2367
2367
  return await n.json();
2368
- if (Eo(n.status) && this.options.tokenProvider && !t) {
2368
+ if (Co(n.status) && this.options.tokenProvider && !t) {
2369
2369
  t = !0;
2370
2370
  const i = await this.fetchEmbedAttachmentUpload(e, !0);
2371
2371
  if (i.ok)
@@ -2391,7 +2391,7 @@ class Ne {
2391
2391
  if (!this.state.sessionId)
2392
2392
  return;
2393
2393
  this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "user_requested" });
2394
- const e = zr(
2394
+ const e = Kr(
2395
2395
  this.state.messages,
2396
2396
  this.state.assistantDraftRespondsToUserMessageId,
2397
2397
  this.state.assistantDraftRunId,
@@ -2538,7 +2538,7 @@ class Ne {
2538
2538
  throw new Error("This interaction is no longer available.");
2539
2539
  if (!r.allowedActions.includes(t))
2540
2540
  throw new Error("This action is not available for the interaction.");
2541
- if (Xn(t) && await this.interactionManager.act(
2541
+ if (Yn(t) && await this.interactionManager.act(
2542
2542
  {
2543
2543
  key: r.id,
2544
2544
  category: r.category,
@@ -2577,65 +2577,68 @@ class Ne {
2577
2577
  this.tabGroupsPermissionNeeded = (await e.getState()).permissionNeeded;
2578
2578
  } catch {
2579
2579
  }
2580
- const t = [...this.state.messages].reverse().map((n) => n.integrationAuthRequest).find((n) => !!n);
2581
- if (t && this.options.runtimeAdapters?.integrationAuthStatusLoader) {
2582
- this.integrationAuthStatusByRequestId.set(t.authRequestId, "checking"), this.rebuildRuntimeInteractions();
2583
- try {
2584
- const n = await this.options.runtimeAdapters.integrationAuthStatusLoader(t);
2585
- this.integrationAuthStatusByRequestId.set(t.authRequestId, n), this.integrationAuthErrorByRequestId.delete(t.authRequestId);
2586
- } catch {
2587
- this.integrationAuthStatusByRequestId.set(t.authRequestId, "error"), this.integrationAuthErrorByRequestId.set(t.authRequestId, "Could not check the connection status.");
2580
+ for (const t of ms(this.state.messages)) {
2581
+ if (!this.options.runtimeAdapters?.integrationAuthStatusLoader) break;
2582
+ const n = this.integrationAuthStatusByRequestId.get(t.authRequestId);
2583
+ if (!(n !== void 0 && n !== "pending")) {
2584
+ this.integrationAuthStatusByRequestId.set(t.authRequestId, "checking"), this.rebuildRuntimeInteractions();
2585
+ try {
2586
+ const i = await this.options.runtimeAdapters.integrationAuthStatusLoader(t);
2587
+ this.integrationAuthStatusByRequestId.set(t.authRequestId, i), this.integrationAuthErrorByRequestId.delete(t.authRequestId);
2588
+ } catch {
2589
+ this.integrationAuthStatusByRequestId.set(t.authRequestId, "error"), this.integrationAuthErrorByRequestId.set(t.authRequestId, "Could not check the connection status.");
2590
+ }
2588
2591
  }
2589
2592
  }
2590
2593
  this.rebuildRuntimeInteractions();
2591
2594
  }
2592
2595
  rebuildRuntimeInteractions() {
2593
- const e = [], t = this.options.productVariant === "personal" && (this.options.entrySurface === "main_web_chat" || this.options.entrySurface === "automation") ? dn(this.state.messages) : null;
2596
+ const e = [], t = this.options.productVariant === "personal" && (this.options.entrySurface === "main_web_chat" || this.options.entrySurface === "automation") ? hn(this.state.messages) : null;
2594
2597
  if (t) {
2595
- const r = {
2598
+ const i = {
2596
2599
  key: t.id,
2597
2600
  category: "social_share",
2598
2601
  scope: this.state.user ? { level: "user", key: this.state.user.id } : { level: "session", key: this.state.sessionId ?? this.options.clientId },
2599
2602
  allowedActions: ["dismiss", "dont_show_again"]
2600
- }, o = this.interactionManager.getStatus(r);
2603
+ }, r = this.interactionManager.getStatus(i);
2601
2604
  e.push({
2602
- id: r.key,
2605
+ id: i.key,
2603
2606
  kind: "social_share",
2604
- category: r.category,
2605
- scope: r.scope,
2607
+ category: i.category,
2608
+ scope: i.scope,
2606
2609
  payload: { candidate: t },
2607
2610
  presentation: {
2608
2611
  title: null,
2609
2612
  body: "Share what Pluno helped you accomplish.",
2610
2613
  actionLabels: { dismiss: "Not now", dont_show_again: "Don't show again" }
2611
2614
  },
2612
- eligible: o === "presentable",
2613
- status: o,
2614
- allowedActions: r.allowedActions,
2615
- decision: this.interactionManager.getDecision(r),
2615
+ eligible: r === "presentable",
2616
+ status: r,
2617
+ allowedActions: i.allowedActions,
2618
+ decision: this.interactionManager.getDecision(i),
2616
2619
  eligibleAt: null,
2617
2620
  expiresAt: null,
2618
2621
  revision: 0
2619
2622
  });
2620
2623
  }
2621
- const n = [...this.state.messages].reverse().map((r) => r.integrationAuthRequest).find((r) => !!r);
2622
- if (n && this.options.runtimeAdapters?.integrationAuthHandler) {
2623
- const r = this.integrationAuthStatusByRequestId.get(n.authRequestId) ?? "pending", o = r === "completed";
2624
+ for (const i of ms(this.state.messages)) {
2625
+ if (!this.options.runtimeAdapters?.integrationAuthHandler) break;
2626
+ const r = this.integrationAuthStatusByRequestId.get(i.authRequestId) ?? "pending", o = r === "completed";
2624
2627
  e.push({
2625
- id: `integration-connection:${n.authRequestId}`,
2628
+ id: `integration-connection:${i.authRequestId}`,
2626
2629
  kind: "integration_connection",
2627
2630
  category: "integration_connection",
2628
2631
  scope: { level: "session", key: this.state.sessionId ?? this.options.clientId },
2629
2632
  payload: {
2630
- request: n,
2633
+ request: i,
2631
2634
  status: r,
2632
- error: this.integrationAuthErrorByRequestId.get(n.authRequestId) ?? null
2635
+ error: this.integrationAuthErrorByRequestId.get(i.authRequestId) ?? null
2633
2636
  },
2634
2637
  presentation: {
2635
- title: `Connect ${n.appName}`,
2636
- body: `Connect ${n.appName} securely in Pluno, then this task will continue automatically.`,
2638
+ title: `Connect ${i.appName}`,
2639
+ body: `Connect ${i.appName} securely in Pluno, then this task will continue automatically.`,
2637
2640
  actionLabels: {
2638
- connect: r === "expired" || r === "cancelled" ? `Reconnect ${n.appName}` : r === "error" ? "Try again" : "Connect"
2641
+ connect: r === "expired" || r === "cancelled" ? `Reconnect ${i.appName}` : r === "error" ? "Try again" : "Connect"
2639
2642
  }
2640
2643
  },
2641
2644
  eligible: !o,
@@ -2643,17 +2646,17 @@ class Ne {
2643
2646
  allowedActions: ["connect"],
2644
2647
  decision: null,
2645
2648
  eligibleAt: null,
2646
- expiresAt: n.expiresAt,
2649
+ expiresAt: i.expiresAt,
2647
2650
  revision: 0
2648
2651
  });
2649
2652
  }
2650
- const i = [...this.state.messages].reverse().map((r) => r.personalChannelConnectionRequest).find((r) => !!r);
2651
- if (i && this.options.runtimeAdapters?.personalChannelConnectionHandler && e.push({
2652
- id: `personal-channel:${i.requestId}`,
2653
+ const n = [...this.state.messages].reverse().map((i) => i.personalChannelConnectionRequest).find((i) => !!i);
2654
+ if (n && this.options.runtimeAdapters?.personalChannelConnectionHandler && e.push({
2655
+ id: `personal-channel:${n.requestId}`,
2653
2656
  kind: "personal_channel_connection",
2654
2657
  category: "personal_channel_connection",
2655
2658
  scope: { level: "session", key: this.state.sessionId ?? this.options.clientId },
2656
- payload: { request: i },
2659
+ payload: { request: n },
2657
2660
  presentation: {
2658
2661
  title: "Connect WhatsApp",
2659
2662
  body: "Connect WhatsApp to continue this task.",
@@ -2667,34 +2670,34 @@ class Ne {
2667
2670
  expiresAt: null,
2668
2671
  revision: 0
2669
2672
  }), this.tabGroupsPermissionNeeded && this.state.sessionId) {
2670
- const r = {
2673
+ const i = {
2671
2674
  key: `tab-group-permission:${this.state.sessionId}`,
2672
2675
  category: "tab_group_permission",
2673
2676
  scope: { level: "session", key: this.state.sessionId },
2674
2677
  allowedActions: ["enable", "later"]
2675
- }, o = this.interactionManager.getStatus(r);
2678
+ }, r = this.interactionManager.getStatus(i);
2676
2679
  e.push({
2677
- id: r.key,
2680
+ id: i.key,
2678
2681
  kind: "tab_group_permission",
2679
- category: r.category,
2680
- scope: r.scope,
2682
+ category: i.category,
2683
+ scope: i.scope,
2681
2684
  payload: { permissionNeeded: !0 },
2682
2685
  presentation: {
2683
2686
  title: null,
2684
2687
  body: "Group the tabs used in this Pluno session?",
2685
2688
  actionLabels: { enable: "Enable grouping", later: "Not now" }
2686
2689
  },
2687
- eligible: o === "presentable",
2688
- status: o,
2689
- allowedActions: r.allowedActions,
2690
- decision: this.interactionManager.getDecision(r),
2690
+ eligible: r === "presentable",
2691
+ status: r,
2692
+ allowedActions: i.allowedActions,
2693
+ decision: this.interactionManager.getDecision(i),
2691
2694
  eligibleAt: null,
2692
2695
  expiresAt: null,
2693
2696
  revision: 0
2694
2697
  });
2695
2698
  }
2696
2699
  this.runtimeInteractions = e;
2697
- for (const r of this.interactionListeners) r(this.getInteractions());
2700
+ for (const i of this.interactionListeners) i(this.getInteractions());
2698
2701
  }
2699
2702
  getAccount() {
2700
2703
  return this.clientRuntime.project("account", { legacy: () => this.account ? { ...this.account } : null });
@@ -2717,7 +2720,7 @@ class Ne {
2717
2720
  return this.clientRuntime.route("directory", { legacy: () => {
2718
2721
  const t = x(), n = this.activeComposerWarmupId;
2719
2722
  this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages);
2720
- const i = this.getCachedSessionTimeline(e), r = [...i ?? []].reverse().find((a) => a.dataType === "assistant_draft" && a.steered !== !0), o = $r(i ?? []);
2723
+ const i = this.getCachedSessionTimeline(e), r = [...i ?? []].reverse().find((a) => a.dataType === "assistant_draft" && a.steered !== !0), o = jr(i ?? []);
2721
2724
  !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({
2722
2725
  type: "session.reset",
2723
2726
  warmupId: n,
@@ -2852,7 +2855,7 @@ class Ne {
2852
2855
  });
2853
2856
  if (!c.ok) {
2854
2857
  const d = await c.text() || `History request failed (${c.status})`;
2855
- throw Zn(c.status) ? new Error(d) : new Te(d);
2858
+ throw ei(c.status) ? new Error(d) : new Te(d);
2856
2859
  }
2857
2860
  const u = await c.json();
2858
2861
  if (!u?.session || !Array.isArray(u.items))
@@ -2957,7 +2960,7 @@ class Ne {
2957
2960
  clientMessageId: e,
2958
2961
  durationMs: Date.now() - n
2959
2962
  });
2960
- }, Math.max(0, di - (Date.now() - n)));
2963
+ }, Math.max(0, hi - (Date.now() - n)));
2961
2964
  this.firstResponseTimersByClientMessageId.set(e, { submittedAt: n, timer: i });
2962
2965
  }
2963
2966
  clearFirstResponseTimer(e) {
@@ -3067,7 +3070,7 @@ class Ne {
3067
3070
  if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
3068
3071
  return;
3069
3072
  this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
3070
- const e = tr();
3073
+ const e = sr();
3071
3074
  this.sendNow(
3072
3075
  L({
3073
3076
  type: "starter_prompts.page_context",
@@ -3078,13 +3081,13 @@ class Ne {
3078
3081
  ) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
3079
3082
  }
3080
3083
  startStarterPromptUrlWatcher() {
3081
- this.locationChangeCleanup || (this.locationChangeCleanup = sr(() => this.handleStarterPromptUrlChange()));
3084
+ this.locationChangeCleanup || (this.locationChangeCleanup = nr(() => this.handleStarterPromptUrlChange()));
3082
3085
  }
3083
3086
  handleStarterPromptUrlChange() {
3084
3087
  const e = location.href;
3085
3088
  e !== this.lastStarterPromptPageUrl && (this.activeComposerWarmupScope && !this.activeComposerWarmupScope.endsWith(`:${e}`) && this.clearPendingComposerWarmup(), this.lastStarterPromptPageUrl = e, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
3086
3089
  this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
3087
- }, Ri));
3090
+ }, ki));
3088
3091
  }
3089
3092
  refreshStarterPromptsForCurrentUrl() {
3090
3093
  this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
@@ -3114,7 +3117,7 @@ class Ne {
3114
3117
  }
3115
3118
  rememberSessionTimeline(e, t) {
3116
3119
  const n = [...t];
3117
- for (this.sessionTimelineCache.delete(e), this.sessionTimelineCache.set(e, n); this.sessionTimelineCache.size > Mi; ) {
3120
+ for (this.sessionTimelineCache.delete(e), this.sessionTimelineCache.set(e, n); this.sessionTimelineCache.size > Ri; ) {
3118
3121
  const i = this.sessionTimelineCache.keys().next().value;
3119
3122
  if (!i)
3120
3123
  break;
@@ -3144,8 +3147,8 @@ class Ne {
3144
3147
  return;
3145
3148
  this.clearPendingWarmupAckTimer();
3146
3149
  const t = Math.min(
3147
- ai * 2 ** e.retryAttempt,
3148
- li
3150
+ li * 2 ** e.retryAttempt,
3151
+ ci
3149
3152
  );
3150
3153
  e.retryAttempt += 1, this.pendingWarmupAckTimer = window.setTimeout(() => {
3151
3154
  this.pendingWarmupAckTimer = null, this.flushPendingComposerWarmup();
@@ -3189,7 +3192,7 @@ class Ne {
3189
3192
  if (!e || !t)
3190
3193
  return;
3191
3194
  const n = this.findStoppedTurn(e, t);
3192
- !n || n.reason !== "task_tab_closed" || vn(n, t) && (this.stoppedTurns.splice(this.stoppedTurns.indexOf(n), 1), n.stoppedItemId && this.setState({
3195
+ !n || n.reason !== "task_tab_closed" || Un(n, t) && (this.stoppedTurns.splice(this.stoppedTurns.indexOf(n), 1), n.stoppedItemId && this.setState({
3193
3196
  messages: this.state.messages.filter((i) => i.id !== n.stoppedItemId)
3194
3197
  }));
3195
3198
  }
@@ -3268,7 +3271,7 @@ class Ne {
3268
3271
  }
3269
3272
  }
3270
3273
  if (!this.shouldIgnoreStoppedTurnEvent(e) && (this.updateInactiveSessionTimelineCache(e), !this.shouldIgnoreBackgroundSessionEvent(e))) {
3271
- if (qi(e) && this.clearFirstResponseTimer(this.activeClientMessageId), e.type === "run.steered") {
3274
+ if (Oi(e) && this.clearFirstResponseTimer(this.activeClientMessageId), e.type === "run.steered") {
3272
3275
  this.handleRunSteered(e);
3273
3276
  return;
3274
3277
  }
@@ -3283,16 +3286,16 @@ class Ne {
3283
3286
  this.activeResponseRunId = t, this.setState({ turnPhase: "thinking", lastError: null }), this.markThinkingProgress();
3284
3287
  return;
3285
3288
  }
3286
- if (Di(e) && this.markThinkingProgress(), e.type === "auth.ok") {
3289
+ if (qi(e) && this.markThinkingProgress(), e.type === "auth.ok") {
3287
3290
  this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.transportDiagnosticEpisodes.clear();
3288
- const t = yr(e.user);
3291
+ const t = Ir(e.user);
3289
3292
  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();
3290
- const n = hr(e), i = Object.prototype.hasOwnProperty.call(e, "appearance");
3293
+ const n = pr(e), i = Object.prototype.hasOwnProperty.call(e, "appearance");
3291
3294
  M("web-sdk.agent", "Received auth.ok appearance", {
3292
3295
  hasAppearance: i,
3293
3296
  rawAppearance: e.appearance,
3294
3297
  normalizedAppearance: n
3295
- }), this.runtimeHelperJavascript = pr(e.runtimeHelpers)?.javascript ?? null;
3298
+ }), this.runtimeHelperJavascript = gr(e.runtimeHelpers)?.javascript ?? null;
3296
3299
  const r = Zt(e, "starterPrompts"), o = Object.prototype.hasOwnProperty.call(e, "starterPrompts"), a = e.starterPromptsLoading === !0, l = {
3297
3300
  user: t,
3298
3301
  status: "connected",
@@ -3343,7 +3346,7 @@ class Ne {
3343
3346
  runId: u?.runId
3344
3347
  }), 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;
3345
3348
  f && h && (this.pendingClientMessageId = h);
3346
- let m = Rr(
3349
+ let m = kr(
3347
3350
  e.assistantDraft
3348
3351
  );
3349
3352
  m && this.findStoppedTurn(r, {
@@ -3352,9 +3355,9 @@ class Ne {
3352
3355
  }) && (m = void 0);
3353
3356
  const b = m !== void 0;
3354
3357
  this.rememberUserMessageClientMessageIds(g);
3355
- const w = Nr(g), D = g.filter((U) => {
3358
+ const w = Hr(g), D = g.filter((U) => {
3356
3359
  const q = C(U);
3357
- return xr(q) ? !1 : !q || !w || !pe(q) ? !0 : ht(g, q) !== w;
3360
+ return Lr(q) ? !1 : !q || !w || !pe(q) ? !0 : ht(g, q) !== w;
3358
3361
  }), S = ct(
3359
3362
  this.state.messages,
3360
3363
  st(D, this.options.backendUrl)
@@ -3365,12 +3368,12 @@ class Ne {
3365
3368
  v,
3366
3369
  re,
3367
3370
  Y,
3368
- Hr(g, q)
3371
+ Br(g, q)
3369
3372
  )
3370
- ), ee = b ? m?.content ?? "" : this.state.assistantDraft, fe = !!m?.content && !Z, B = T && (!ee || Z), V = qr(S), oe = B && V ? "completed" : d ? "stopped" : B ? "failed" : null;
3371
- if (!T && Lr(this.state.messages, g))
3373
+ ), ee = b ? m?.content ?? "" : this.state.assistantDraft, fe = !!m?.content && !Z, B = T && (!ee || Z), V = Or(S), oe = B && V ? "completed" : d ? "stopped" : B ? "failed" : null;
3374
+ if (!T && Nr(this.state.messages, g))
3372
3375
  return;
3373
- this.lastUserMessagePageUrl = Or(g);
3376
+ this.lastUserMessagePageUrl = xr(g);
3374
3377
  const j = B || d ? null : dt(g);
3375
3378
  if (this.latestRecoverableClientMessageId = j, V && this.clearRetryTimers(), this.setState({
3376
3379
  sessionId: A(e.session, "id") ?? this.state.sessionId,
@@ -3443,14 +3446,14 @@ class Ne {
3443
3446
  this.options.backendUrl
3444
3447
  );
3445
3448
  t === this.sessionActivityRequestId && (this.sessionActivityRequestId = null), this.setState({
3446
- messages: _r(this.state.messages, i)
3449
+ messages: Pr(this.state.messages, i)
3447
3450
  });
3448
3451
  return;
3449
3452
  }
3450
3453
  if (e.type === "sessions.page") {
3451
3454
  const t = typeof e.requestId == "string" ? e.requestId : null, n = t ? this.pendingSessionHistoryRequests.get(t) : null;
3452
3455
  t && n && (window.clearTimeout(n.timeout), this.pendingSessionHistoryRequests.delete(t), n.resolve({
3453
- sessions: Ir(e.sessions),
3456
+ sessions: Sr(e.sessions),
3454
3457
  nextCursor: typeof e.nextCursor == "string" ? e.nextCursor : null
3455
3458
  }));
3456
3459
  return;
@@ -3485,15 +3488,15 @@ class Ne {
3485
3488
  }
3486
3489
  const n = Ue(e.item, this.options.backendUrl);
3487
3490
  if (n) {
3488
- const i = Kr(t, n), r = n.callId ? this.pendingToolLoadingByCallId.get(n.callId) : void 0;
3489
- n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)), W(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), Fr(t) && this.clearRunAckResyncRetryTimer();
3491
+ const i = Gr(t, n), r = n.callId ? this.pendingToolLoadingByCallId.get(n.callId) : void 0;
3492
+ n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)), W(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), Wr(t) && this.clearRunAckResyncRetryTimer();
3490
3493
  const o = de(this.state.messages, n), a = os(o), l = as(
3491
3494
  t,
3492
3495
  this.state.assistantDraft,
3493
3496
  this.state.assistantDraftItemId,
3494
3497
  this.state.assistantDraftRespondsToUserMessageId,
3495
3498
  this.state.assistantDraftRunId,
3496
- Os(
3499
+ xs(
3497
3500
  o,
3498
3501
  o.findIndex((d) => d.id === n.id)
3499
3502
  )
@@ -3662,13 +3665,13 @@ class Ne {
3662
3665
  return;
3663
3666
  }
3664
3667
  o && i && r && (this.retryableClientMessageId = r);
3665
- const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l = Zi(a.message);
3668
+ const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l = er(a.message);
3666
3669
  l && console.error(l);
3667
3670
  const c = r ?? this.activeClientMessageId, u = typeof e.runId == "string" ? e.runId : null, d = cs(
3668
3671
  this.state.messages,
3669
3672
  c,
3670
3673
  u
3671
- ), g = Dr(
3674
+ ), g = qr(
3672
3675
  d,
3673
3676
  c,
3674
3677
  u
@@ -3699,7 +3702,7 @@ class Ne {
3699
3702
  }
3700
3703
  applyAccountSubmissionError(e) {
3701
3704
  if (!this.account || !e) return;
3702
- const t = Dn(this.account.submissionGate, e);
3705
+ const t = qn(this.account.submissionGate, e);
3703
3706
  if (!(t === this.account.submissionGate || t.allowed)) {
3704
3707
  this.account = {
3705
3708
  ...this.account,
@@ -3715,7 +3718,7 @@ class Ne {
3715
3718
  this.options.model = Qe(n) ? n : "gpt-5.6-sol";
3716
3719
  }
3717
3720
  updateAccountFallbackFromSession(e) {
3718
- const t = e && typeof e == "object" ? e.metadata : null, n = qn(t);
3721
+ const t = e && typeof e == "object" ? e.metadata : null, n = On(t);
3719
3722
  if (this.usingPaidCreditFallback !== n && (this.usingPaidCreditFallback = n, !!this.account)) {
3720
3723
  this.account = { ...this.account, usingPaidCreditFallback: n };
3721
3724
  for (const i of this.accountListeners) i(this.getAccount());
@@ -3835,7 +3838,7 @@ class Ne {
3835
3838
  }
3836
3839
  e.type === "error" && typeof e.requestId != "string" && !ls(e, t) && this.rememberSessionTimeline(
3837
3840
  t,
3838
- jr(n, e)
3841
+ zr(n, e)
3839
3842
  );
3840
3843
  }
3841
3844
  }
@@ -3933,7 +3936,7 @@ class Ne {
3933
3936
  e.clear();
3934
3937
  }
3935
3938
  markThinkingProgress() {
3936
- !this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(ui), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
3939
+ !this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(di), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
3937
3940
  }
3938
3941
  scheduleThinkingWatchdog(e) {
3939
3942
  this.thinkingWatchdogTimer !== null && window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = window.setTimeout(() => {
@@ -3997,13 +4000,13 @@ class Ne {
3997
4000
  if (this.state.status === "closed" || this.pendingClientMessageId !== e || !this.pendingUserMessageEvent)
3998
4001
  return;
3999
4002
  const t = this.retryAttemptsByClientMessageId[e] ?? 0;
4000
- if (t >= hi) {
4003
+ if (t >= pi) {
4001
4004
  this.failPendingDelivery(e);
4002
4005
  return;
4003
4006
  }
4004
4007
  t === 0 && this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.retryAttemptsByClientMessageId[e] = t + 1, this.setState({ pendingMessageStatus: "reconnecting" }), this.pendingDeliveryRetryTimer = window.setTimeout(() => {
4005
4008
  this.pendingDeliveryRetryTimer = null, !(this.pendingClientMessageId !== e || !this.pendingUserMessageEvent) && (this.send(this.pendingUserMessageEvent), this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(e));
4006
- }, ki(t, mi));
4009
+ }, Ei(t, yi));
4007
4010
  }
4008
4011
  failPendingDelivery(e) {
4009
4012
  if (this.pendingClientMessageId !== e)
@@ -4016,7 +4019,7 @@ class Ne {
4016
4019
  ...this.state.isThinking ? {} : { turnPhase: null },
4017
4020
  isRetrying: !1,
4018
4021
  ...this.state.isThinking ? {} : { taskStatus: "failed" },
4019
- lastError: gi,
4022
+ lastError: fi,
4020
4023
  lastErrorCode: "message_delivery_failed"
4021
4024
  });
4022
4025
  }
@@ -4083,7 +4086,7 @@ class Ne {
4083
4086
  ),
4084
4087
  isThinking: !1,
4085
4088
  taskStatus: "failed",
4086
- lastError: pi,
4089
+ lastError: gi,
4087
4090
  lastErrorCode: "run_recovery_exhausted"
4088
4091
  }), this.clearThinkingWatchdog();
4089
4092
  return;
@@ -4110,7 +4113,7 @@ class Ne {
4110
4113
  if (!t || !n || !i)
4111
4114
  return;
4112
4115
  const a = i === "execute_code", l = i === "execute_code_in_browser_tab" && o !== null && typeof o == "object" && o.tabId === "local:current";
4113
- if (!a && !l || !fo(o)) {
4116
+ if (!a && !l || !mo(o)) {
4114
4117
  this.setToolMessageLoading(n, !1), this.send({
4115
4118
  type: "tool.result",
4116
4119
  sessionId: t,
@@ -4159,7 +4162,7 @@ class Ne {
4159
4162
  let c = null, u;
4160
4163
  c = await this.executeRuntimeHelper(), u = await Xt(
4161
4164
  o,
4162
- Vi(e.runtimeContext, this.options.backendUrl)
4165
+ Qi(e.runtimeContext, this.options.backendUrl)
4163
4166
  ).catch((d) => ({
4164
4167
  ok: !1,
4165
4168
  exception: {
@@ -4172,7 +4175,7 @@ class Ne {
4172
4175
  toolName: i,
4173
4176
  summary: o.summary,
4174
4177
  rawInput: L(o),
4175
- rawOutput: L(gr(u, c))
4178
+ rawOutput: L(fr(u, c))
4176
4179
  }), hs(this.options.clientId, this.activeBrowserToolCalls.values()));
4177
4180
  }
4178
4181
  setToolMessageLoading(e, t) {
@@ -4187,17 +4190,17 @@ class Ne {
4187
4190
  if (this.pageLifecycleCleanup)
4188
4191
  return;
4189
4192
  const e = () => {
4190
- Ls(this.options.clientId, this.activeBrowserToolCalls.values());
4193
+ Ns(this.options.clientId, this.activeBrowserToolCalls.values());
4191
4194
  };
4192
4195
  window.addEventListener("pagehide", e), window.addEventListener("beforeunload", e), this.pageLifecycleCleanup = () => {
4193
4196
  window.removeEventListener("pagehide", e), window.removeEventListener("beforeunload", e);
4194
4197
  };
4195
4198
  }
4196
4199
  installSessionBrowserApis() {
4197
- this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = Ni();
4200
+ this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = Hi();
4198
4201
  }
4199
4202
  cleanupSessionBrowserApis() {
4200
- this.sessionBrowserApisCleanup && (Ki(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
4203
+ this.sessionBrowserApisCleanup && (Gi(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
4201
4204
  }
4202
4205
  async executeRuntimeHelper() {
4203
4206
  if (!this.runtimeHelperJavascript?.trim())
@@ -4205,15 +4208,15 @@ class Ne {
4205
4208
  const e = await Xt({
4206
4209
  javascript: this.runtimeHelperJavascript
4207
4210
  });
4208
- return e.ok === !1 ? fr(e) : null;
4211
+ return e.ok === !1 ? mr(e) : null;
4209
4212
  }
4210
4213
  enableNetworkCapture() {
4211
- this.networkCaptureCleanup || (this.networkCaptureCleanup = vi((e) => {
4212
- wo(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
4214
+ this.networkCaptureCleanup || (this.networkCaptureCleanup = Ui((e) => {
4215
+ Ao(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
4213
4216
  }));
4214
4217
  }
4215
4218
  enqueueNetworkEvent(e) {
4216
- this.queuedNetworkEvents.length >= Ii || (this.queuedNetworkEvents.push(To(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
4219
+ this.queuedNetworkEvents.length >= Si || (this.queuedNetworkEvents.push(wo(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
4217
4220
  this.networkBatchTimer = null;
4218
4221
  const t = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
4219
4222
  t.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
@@ -4222,14 +4225,14 @@ class Ne {
4222
4225
  page: _(),
4223
4226
  events: t
4224
4227
  });
4225
- }, yi)));
4228
+ }, Ii)));
4226
4229
  }
4227
4230
  scheduleReconnect(e = 0) {
4228
4231
  if (this.reconnectTimer !== null || this.state.status === "closed")
4229
4232
  return;
4230
4233
  const t = Math.min(
4231
4234
  at,
4232
- Math.max(Ei(this.reconnectAttempts), e)
4235
+ Math.max(Ci(this.reconnectAttempts), e)
4233
4236
  );
4234
4237
  this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
4235
4238
  this.reconnectTimer = null, this.connect().catch((n) => {
@@ -4246,8 +4249,8 @@ class Ne {
4246
4249
  const e = this.socket;
4247
4250
  !e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
4248
4251
  this.socket === e && (M("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
4249
- }, si));
4250
- }, ti);
4252
+ }, ni));
4253
+ }, si);
4251
4254
  }
4252
4255
  stopHeartbeat() {
4253
4256
  this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
@@ -4285,12 +4288,12 @@ class Ne {
4285
4288
  ...e.lastError === null && e.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
4286
4289
  ...e.lastError !== void 0 && e.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
4287
4290
  }, a = this.state.sessionId, l = this.state.isThinking || this.state.pendingMessageStatus !== null, c = o.isThinking || o.pendingMessageStatus !== null, u = this.activeClientMessageId ?? this.pendingClientMessageId;
4288
- u && u === this.lastProjectedTurnClientMessageId && c && Oi(this.lastProjectedTurnPhase, o.turnPhase) && this.reportHealthSignal("invalid_state_transition", {
4291
+ u && u === this.lastProjectedTurnClientMessageId && c && xi(this.lastProjectedTurnPhase, o.turnPhase) && this.reportHealthSignal("invalid_state_transition", {
4289
4292
  clientMessageId: u,
4290
4293
  reason: "active_turn_phase_moved_backward",
4291
4294
  previousPhase: this.lastProjectedTurnPhase,
4292
4295
  nextPhase: o.turnPhase
4293
- }), this.state = o, this.lastProjectedTurnClientMessageId = u, this.lastProjectedTurnPhase = o.turnPhase, o.sessionId && (o.sessionId === a && c !== l || o.sessionId !== a && c) && this.sessionHistoryManager.setActivity(o.sessionId, c), this.rebuildRuntimeInteractions(), e.messages !== void 0 && this.refreshRuntimeInteractions(), this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages), so(this.options.clientId, this.state), this.emit("state", this.getState()), Se("state", this.state.status, {
4296
+ }), 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), no(this.options.clientId, this.state), this.emit("state", this.getState()), Se("state", this.state.status, {
4294
4297
  status: this.state.status,
4295
4298
  sessionId: this.state.sessionId,
4296
4299
  messageCount: this.state.messages.length,
@@ -4349,13 +4352,13 @@ class Ne {
4349
4352
  }
4350
4353
  }
4351
4354
  const Ze = /* @__PURE__ */ new WeakMap();
4352
- function vi(s) {
4353
- const e = window.__plunoProductAgentNetworkCapture ?? Ui();
4355
+ function Ui(s) {
4356
+ const e = window.__plunoProductAgentNetworkCapture ?? Di();
4354
4357
  return e.subscribers.add(s), () => {
4355
4358
  e.subscribers.delete(s), !(e.subscribers.size > 0) && (e.destroy(), window.__plunoProductAgentNetworkCapture === e && delete window.__plunoProductAgentNetworkCapture);
4356
4359
  };
4357
4360
  }
4358
- function Ui() {
4361
+ function Di() {
4359
4362
  const s = /* @__PURE__ */ new Set(), e = (g) => {
4360
4363
  s.forEach((f) => {
4361
4364
  try {
@@ -4372,7 +4375,7 @@ function Ui() {
4372
4375
  throw m;
4373
4376
  }
4374
4377
  try {
4375
- const m = f instanceof Request ? f : null, b = mo(f, m), w = Fs(h?.headers ?? m?.headers);
4378
+ const m = f instanceof Request ? f : null, b = yo(f, m), w = Ws(h?.headers ?? m?.headers);
4376
4379
  if (!te(b, w, h?.body)) {
4377
4380
  const H = {
4378
4381
  requestId: nt("fetch"),
@@ -4385,7 +4388,7 @@ function Ui() {
4385
4388
  };
4386
4389
  y.then(
4387
4390
  (S) => {
4388
- yo(S, H, p, e).catch(() => {
4391
+ Io(S, H, p, e).catch(() => {
4389
4392
  e({
4390
4393
  ...H,
4391
4394
  responseStatus: S.status,
@@ -4427,7 +4430,7 @@ function Ui() {
4427
4430
  () => {
4428
4431
  queueMicrotask(() => {
4429
4432
  try {
4430
- const p = bo(this.getAllResponseHeaders());
4433
+ const p = Mo(this.getAllResponseHeaders());
4431
4434
  e({
4432
4435
  requestId: h.requestId,
4433
4436
  url: h.url,
@@ -4437,7 +4440,7 @@ function Ui() {
4437
4440
  resourceType: "xhr",
4438
4441
  responseStatus: this.status,
4439
4442
  responseHeaders: p,
4440
- responseBody: So(this, p),
4443
+ responseBody: To(this, p),
4441
4444
  errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
4442
4445
  startedAt: h.startedAt,
4443
4446
  durationMs: Date.now() - h.startedAtMs
@@ -4533,10 +4536,10 @@ function Jt(s) {
4533
4536
  const e = typeof s == "function" ? s() : s;
4534
4537
  return e && Object.keys(e).length > 0 ? e : void 0;
4535
4538
  }
4536
- function Di(s) {
4539
+ function qi(s) {
4537
4540
  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";
4538
4541
  }
4539
- function qi(s) {
4542
+ function Oi(s) {
4540
4543
  if (s.type === "chat.assistant_delta")
4541
4544
  return typeof s.delta == "string" && s.delta.trim().length > 0;
4542
4545
  if (s.type === "tool.call")
@@ -4546,7 +4549,7 @@ function qi(s) {
4546
4549
  const e = C(s.item);
4547
4550
  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;
4548
4551
  }
4549
- function Oi(s, e) {
4552
+ function xi(s, e) {
4550
4553
  if (!s || !e)
4551
4554
  return !1;
4552
4555
  const t = {
@@ -4574,31 +4577,31 @@ function K(s) {
4574
4577
  }
4575
4578
  return null;
4576
4579
  }
4577
- const xi = 5e3, Li = 12e4;
4578
- function Ni() {
4580
+ const Li = 5e3, Ni = 12e4;
4581
+ function Hi() {
4579
4582
  const s = [
4580
- Bi(),
4581
- Hi()
4583
+ Fi(),
4584
+ Bi()
4582
4585
  ].filter((e) => typeof e == "function");
4583
4586
  return () => {
4584
4587
  for (const e of s.reverse())
4585
4588
  e();
4586
4589
  };
4587
4590
  }
4588
- function Hi() {
4589
- return ys(globalThis, "getPageSnapshot", async () => bt());
4590
- }
4591
4591
  function Bi() {
4592
- return ys(globalThis, "pageImages", {
4593
- inspectImage: async (e, t) => await Fi(e, t)
4592
+ return Is(globalThis, "getPageSnapshot", async () => bt());
4593
+ }
4594
+ function Fi() {
4595
+ return Is(globalThis, "pageImages", {
4596
+ inspectImage: async (e, t) => await Wi(e, t)
4594
4597
  });
4595
4598
  }
4596
- async function Fi(s, e = {}) {
4597
- const t = zi(e.name), n = await Wi(s);
4599
+ async function Wi(s, e = {}) {
4600
+ const t = Ki(e.name), n = await $i(s);
4598
4601
  return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
4599
4602
  type: "pluno.pageImages.inspectImage",
4600
4603
  imageAttached: !1,
4601
- imageAttachmentError: ks
4604
+ imageAttachmentError: Es
4602
4605
  } : {
4603
4606
  type: "pluno.pageImages.inspectImage",
4604
4607
  imageAttached: !0,
@@ -4612,15 +4615,15 @@ async function Fi(s, e = {}) {
4612
4615
  imageAttachmentError: n.error
4613
4616
  };
4614
4617
  }
4615
- async function Wi(s) {
4616
- return s instanceof Blob ? s.type.startsWith("image/") ? s.size === 0 ? { ok: !1, error: "Page image is empty." } : s.size > 8 * 1024 * 1024 ? { ok: !1, error: ks } : {
4618
+ async function $i(s) {
4619
+ 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: Es } : {
4617
4620
  ok: !0,
4618
4621
  mimeType: s.type,
4619
4622
  sizeBytes: s.size,
4620
- dataUrl: await Gi(s)
4621
- } : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof s != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : $i(s);
4623
+ dataUrl: await Vi(s)
4624
+ } : { 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." } : ji(s);
4622
4625
  }
4623
- function $i(s) {
4626
+ function ji(s) {
4624
4627
  if (!s.startsWith("data:") || !s.includes(","))
4625
4628
  return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
4626
4629
  const [e, t] = s.slice(5).split(",", 2), n = e.split(";").map((a) => a.trim()).filter(Boolean), i = n[0] ?? "";
@@ -4631,7 +4634,7 @@ function $i(s) {
4631
4634
  const r = t.replace(/[ \t\r\n\f]+/g, "");
4632
4635
  if (!/^[A-Za-z0-9+/]*={0,2}$/.test(r))
4633
4636
  return { ok: !1, error: "Page image data URL has invalid base64." };
4634
- const o = ji(r);
4637
+ const o = zi(r);
4635
4638
  return o === null ? { ok: !1, error: "Page image data URL has invalid base64." } : o === 0 ? { ok: !1, error: "Page image is empty." } : {
4636
4639
  ok: !0,
4637
4640
  mimeType: i,
@@ -4639,22 +4642,22 @@ function $i(s) {
4639
4642
  dataUrl: `data:${i};base64,${r}`
4640
4643
  };
4641
4644
  }
4642
- function ji(s) {
4645
+ function zi(s) {
4643
4646
  if (s.length === 0 || s.length % 4 !== 0)
4644
4647
  return null;
4645
4648
  const e = s.length - s.replace(/=+$/, "").length;
4646
4649
  return e > 2 ? null : s.length / 4 * 3 - e;
4647
4650
  }
4648
- function zi(s) {
4651
+ function Ki(s) {
4649
4652
  return (typeof s == "string" ? s.trim() : "") || "Page image";
4650
4653
  }
4651
- function Ki(s) {
4654
+ function Gi(s) {
4652
4655
  try {
4653
4656
  s();
4654
4657
  } catch {
4655
4658
  }
4656
4659
  }
4657
- function Gi(s) {
4660
+ function Vi(s) {
4658
4661
  return new Promise((e, t) => {
4659
4662
  const n = new FileReader();
4660
4663
  n.onload = () => {
@@ -4668,7 +4671,7 @@ function Gi(s) {
4668
4671
  }
4669
4672
  async function Xt(s, e) {
4670
4673
  const t = Object.getPrototypeOf(async function() {
4671
- }).constructor, n = s.timeoutMs ?? xi, i = Date.now(), r = [];
4674
+ }).constructor, n = s.timeoutMs ?? Li, i = Date.now(), r = [];
4672
4675
  let o;
4673
4676
  const a = {
4674
4677
  log: console.log,
@@ -4686,7 +4689,7 @@ async function Xt(s, e) {
4686
4689
  o = window.setTimeout(() => d(c), n);
4687
4690
  })
4688
4691
  ]);
4689
- return u === c ? Qi(n) : {
4692
+ return u === c ? Ji(n) : {
4690
4693
  ok: !0,
4691
4694
  result: u,
4692
4695
  console: r,
@@ -4715,7 +4718,7 @@ async function Xt(s, e) {
4715
4718
  e?.deactivate(), o !== void 0 && window.clearTimeout(o), console.log = a.log, console.info = a.info, console.warn = a.warn, console.error = a.error;
4716
4719
  }
4717
4720
  }
4718
- function Vi(s, e) {
4721
+ function Qi(s, e) {
4719
4722
  if (!s || typeof s != "object")
4720
4723
  return;
4721
4724
  const t = s.sandboxFilesToken;
@@ -4725,7 +4728,7 @@ function Vi(s, e) {
4725
4728
  const i = () => {
4726
4729
  if (!n)
4727
4730
  throw new Error("sandboxFiles is only available during browser-code execution");
4728
- }, r = async (a, l) => await Kn(`${e.replace(/\/$/, "")}${a}`, l);
4731
+ }, r = async (a, l) => await Gn(`${e.replace(/\/$/, "")}${a}`, l);
4729
4732
  return {
4730
4733
  value: Object.freeze({
4731
4734
  upload: async (a) => {
@@ -4759,7 +4762,7 @@ function Vi(s, e) {
4759
4762
  }
4760
4763
  };
4761
4764
  }
4762
- function Qi(s) {
4765
+ function Ji(s) {
4763
4766
  return {
4764
4767
  ok: !1,
4765
4768
  exception: {
@@ -4773,10 +4776,10 @@ function Qi(s) {
4773
4776
  }
4774
4777
  };
4775
4778
  }
4776
- function Ji(s) {
4779
+ function Xi(s) {
4777
4780
  return s.replace(/\/+$/, "");
4778
4781
  }
4779
- function Xi(s) {
4782
+ function Yi(s) {
4780
4783
  const e = {
4781
4784
  sidepanel: "extension_sidepanel",
4782
4785
  browser_extension_page_ui: "extension_widget",
@@ -4788,18 +4791,18 @@ function Xi(s) {
4788
4791
  };
4789
4792
  return s && s in e ? e[s] : s ?? "embedded_custom_ui";
4790
4793
  }
4791
- function Yi(s) {
4794
+ function Zi(s) {
4792
4795
  return s === "pluno" ? "scheduled_continuation" : s ?? "user";
4793
4796
  }
4794
- function Zi(s, e = location.origin) {
4797
+ function er(s, e = location.origin) {
4795
4798
  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;
4796
4799
  }
4797
- function er(s) {
4800
+ function tr(s) {
4798
4801
  const e = new URL("/api/product-agent/embed/ws", s);
4799
4802
  return e.protocol = e.protocol === "https:" ? "wss:" : "ws:", e.toString();
4800
4803
  }
4801
4804
  function _() {
4802
- const s = vs();
4805
+ const s = Us();
4803
4806
  return {
4804
4807
  url: location.href,
4805
4808
  title: document.title,
@@ -4807,19 +4810,19 @@ function _() {
4807
4810
  ...s ? { plunoProductAgentUi: s } : {}
4808
4811
  };
4809
4812
  }
4810
- function tr() {
4813
+ function sr() {
4811
4814
  return {
4812
4815
  pageUrl: location.href,
4813
4816
  pageTitle: document.title,
4814
4817
  htmlContent: bt()
4815
4818
  };
4816
4819
  }
4817
- function sr(s) {
4818
- return Ce.add(s), we || (we = nr()), () => {
4820
+ function nr(s) {
4821
+ return Ce.add(s), we || (we = ir()), () => {
4819
4822
  Ce.delete(s), Ce.size === 0 && (we?.(), we = null);
4820
4823
  };
4821
4824
  }
4822
- function nr() {
4825
+ function ir() {
4823
4826
  const s = () => {
4824
4827
  for (const r of Array.from(Ce))
4825
4828
  r();
@@ -4835,7 +4838,7 @@ function nr() {
4835
4838
  };
4836
4839
  }
4837
4840
  function et() {
4838
- return vs()?.surface === "browser_extension_sdk_preview";
4841
+ return Us()?.surface === "browser_extension_sdk_preview";
4839
4842
  }
4840
4843
  function bt() {
4841
4844
  if (!document.body)
@@ -4846,16 +4849,16 @@ function bt() {
4846
4849
  };
4847
4850
  t("Selected text", window.getSelection()?.toString() ?? "");
4848
4851
  const n = "[role='dialog'], [role='alertdialog'], dialog[open], [aria-modal='true']", i = Array.from(document.querySelectorAll(n)).filter(
4849
- (p) => Cs(p) && !p.parentElement?.closest(n)
4852
+ (p) => _s(p) && !p.parentElement?.closest(n)
4850
4853
  );
4851
4854
  for (const p of i.slice(0, 3))
4852
4855
  t("Active overlay", tt(he(p), e));
4853
- const r = ir(), o = r ? tt(he(r), e) : "";
4856
+ const r = rr(), o = r ? tt(he(r), e) : "";
4854
4857
  t("Main page content", o), t("Additional visible page text", tt(he(document.body), e));
4855
4858
  const a = s.map(([p, y]) => `${p}:
4856
4859
  ${y}`).join(`
4857
4860
 
4858
- `).trim().slice(0, 12e3), l = rr(i, r).trim(), c = `Simplified DOM outline:
4861
+ `).trim().slice(0, 12e3), l = or(i, r).trim(), c = `Simplified DOM outline:
4859
4862
  `, u = `
4860
4863
 
4861
4864
  Visible page text:
@@ -4879,14 +4882,14 @@ function tt(s, e) {
4879
4882
  t = t.replace(n, "");
4880
4883
  return ne(t);
4881
4884
  }
4882
- function Cs(s) {
4885
+ function _s(s) {
4883
4886
  const e = window.getComputedStyle(s);
4884
4887
  return e.display !== "none" && e.visibility !== "hidden" && s.getClientRects().length > 0;
4885
4888
  }
4886
- function ir() {
4887
- return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Cs).sort((s, e) => he(e).length - he(s).length)[0] ?? null;
4889
+ function rr() {
4890
+ return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(_s).sort((s, e) => he(e).length - he(s).length)[0] ?? null;
4888
4891
  }
4889
- function rr(s, e) {
4892
+ function or(s, e) {
4890
4893
  const t = /* @__PURE__ */ new Set([
4891
4894
  "main",
4892
4895
  "nav",
@@ -4966,7 +4969,7 @@ function rr(s, e) {
4966
4969
  "data-test",
4967
4970
  "data-qa",
4968
4971
  "data-cy"
4969
- ], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: u, priorityTargets: d } = or(), g = new Set(s);
4972
+ ], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: u, priorityTargets: d } = ar(), g = new Set(s);
4970
4973
  e && g.add(e);
4971
4974
  let f = 0;
4972
4975
  const h = (w) => {
@@ -4981,7 +4984,7 @@ function rr(s, e) {
4981
4984
  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")
4982
4985
  return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
4983
4986
  f += 1;
4984
- const Z = h(T), ee = Ps(T), fe = a.has(Z) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(v) || v === "a" && T.hasAttribute("href"), B = Array.from(T.children).filter((I) => I instanceof HTMLElement), V = /* @__PURE__ */ new Map();
4987
+ const Z = h(T), ee = vs(T), fe = a.has(Z) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(v) || v === "a" && T.hasAttribute("href"), B = Array.from(T.children).filter((I) => I instanceof HTMLElement), V = /* @__PURE__ */ new Map();
4985
4988
  for (const I of B) {
4986
4989
  const R = p(I);
4987
4990
  V.set(R, (V.get(R) ?? 0) + 1);
@@ -5007,10 +5010,10 @@ function rr(s, e) {
5007
5010
  I instanceof HTMLElement && Fe.push(S(I, N + 1));
5008
5011
  const ye = [...Et, ...Fe], We = ee.length > 0 || fe || ye.some((I) => I.hasUsefulContent), Ct = ne(
5009
5012
  [ee, ...ye.map((I) => I.textPreview)].filter(Boolean).join(" ")
5010
- ).slice(0, 180), Qs = T.hasAttribute("contenteditable") && (ee.length > 0 || !T.querySelector("[contenteditable]")), _t = c.some((I) => T.hasAttribute(I)) || !!Z || Qs, $e = (T.getClientRects().length > 0 || re.display === "contents") && (t.has(v) || _t || Y) && (We || Y) && (!i.has(v) || We || _t || Y), je = $e ? 1 : 0, ae = [];
5013
+ ).slice(0, 180), Js = T.hasAttribute("contenteditable") && (ee.length > 0 || !T.querySelector("[contenteditable]")), _t = c.some((I) => T.hasAttribute(I)) || !!Z || Js, $e = (T.getClientRects().length > 0 || re.display === "contents") && (t.has(v) || _t || Y) && (We || Y) && (!i.has(v) || We || _t || Y), je = $e ? 1 : 0, ae = [];
5011
5014
  if ($e) {
5012
5015
  const I = ye.some((z) => z.containsTextElement), R = n.has(v) && !I ? Ct : ee;
5013
- ae.push(_s(T, l, o, R.slice(0, 180)));
5016
+ ae.push(Ps(T, l, o, R.slice(0, 180)));
5014
5017
  }
5015
5018
  for (const I of q)
5016
5019
  ae.push(...Ae(I, je));
@@ -5036,7 +5039,7 @@ function rr(s, e) {
5036
5039
  `);
5037
5040
  }, m = [], b = ne(window.getSelection()?.toString() ?? "");
5038
5041
  b && m.push(`--- selected text ---
5039
- ${JSON.stringify(b)}`), d.length > 0 && m.push(ar(d, t, l, o));
5042
+ ${JSON.stringify(b)}`), d.length > 0 && m.push(lr(d, t, l, o));
5040
5043
  for (const w of s.slice(0, 3))
5041
5044
  m.push(y(w, "active overlay DOM", /* @__PURE__ */ new Set()));
5042
5045
  if (e && m.push(y(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
@@ -5047,11 +5050,11 @@ ${JSON.stringify(b)}`), d.length > 0 && m.push(ar(d, t, l, o));
5047
5050
 
5048
5051
  `);
5049
5052
  }
5050
- function _s(s, e, t, n) {
5053
+ function Ps(s, e, t, n) {
5051
5054
  const i = s.tagName.toLowerCase();
5052
5055
  let r = i;
5053
5056
  const o = s.getAttribute("id");
5054
- o && lr(o) && (r += `#${o}`);
5057
+ o && cr(o) && (r += `#${o}`);
5055
5058
  for (const a of e) {
5056
5059
  const l = s.getAttribute(a);
5057
5060
  l && l.length <= 160 && (a !== "role" || !t.has(l)) && (r += `[${a}=${JSON.stringify(l)}]`);
@@ -5064,7 +5067,7 @@ function _s(s, e, t, n) {
5064
5067
  s.hasAttribute(a) && (r += `[${a}]`);
5065
5068
  return `${r}${n ? ` ${JSON.stringify(n)}` : ""}`;
5066
5069
  }
5067
- function or() {
5070
+ function ar() {
5068
5071
  const s = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), t = (a, l) => {
5069
5072
  if (!a)
5070
5073
  return;
@@ -5107,7 +5110,7 @@ function or() {
5107
5110
  priorityTargets: Array.from(e, ([a, l]) => ({ element: a, labels: Array.from(l) }))
5108
5111
  };
5109
5112
  }
5110
- function ar(s, e, t, n) {
5113
+ function lr(s, e, t, n) {
5111
5114
  const i = ["--- active/current elements ---"];
5112
5115
  for (const r of s) {
5113
5116
  const o = [];
@@ -5118,11 +5121,11 @@ function ar(s, e, t, n) {
5118
5121
  const d = a.getRootNode();
5119
5122
  a = a.parentElement ?? (d instanceof ShadowRoot && d.host instanceof HTMLElement ? d.host : null);
5120
5123
  }
5121
- const l = o.length > 6 ? [o[0], ...o.slice(-5)] : o, c = l.map((u, d) => _s(
5124
+ const l = o.length > 6 ? [o[0], ...o.slice(-5)] : o, c = l.map((u, d) => Ps(
5122
5125
  u,
5123
5126
  t,
5124
5127
  n,
5125
- d === l.length - 1 ? Ps(u).slice(0, 180) : ""
5128
+ d === l.length - 1 ? vs(u).slice(0, 180) : ""
5126
5129
  ));
5127
5130
  o.length > l.length && c.splice(1, 0, "…"), i.push(`${r.labels.join(", ")}: ${c.join(" > ")}`);
5128
5131
  }
@@ -5138,17 +5141,17 @@ function Ae(s, e) {
5138
5141
  const t = " ".repeat(e);
5139
5142
  return s.map((n) => `${t}${n}`);
5140
5143
  }
5141
- function Ps(s) {
5144
+ function vs(s) {
5142
5145
  return ne(
5143
5146
  Array.from(s.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
5144
5147
  );
5145
5148
  }
5146
- function lr(s) {
5149
+ function cr(s) {
5147
5150
  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);
5148
5151
  }
5149
- function vs() {
5152
+ function Us() {
5150
5153
  const s = Array.from(document.querySelectorAll($t)), e = s.find(
5151
- (r) => typeof r[Jn] == "string"
5154
+ (r) => typeof r[Xn] == "string"
5152
5155
  );
5153
5156
  if (!(e ?? s[0]))
5154
5157
  return;
@@ -5164,23 +5167,23 @@ function vs() {
5164
5167
  },
5165
5168
  {
5166
5169
  name: "widget_root",
5167
- selector: Gn,
5170
+ selector: Vn,
5168
5171
  description: "Finds Pluno's widget root inside the widget host shadow root."
5169
5172
  },
5170
5173
  {
5171
5174
  name: "widget_panel",
5172
- selector: Vn,
5175
+ selector: Qn,
5173
5176
  description: "Finds Pluno's open chat panel inside the widget host shadow root."
5174
5177
  },
5175
5178
  {
5176
5179
  name: "widget_timeline",
5177
- selector: Qn,
5180
+ selector: Jn,
5178
5181
  description: "Finds Pluno's chat timeline inside the widget host shadow root."
5179
5182
  }
5180
5183
  ]
5181
5184
  };
5182
5185
  }
5183
- function cr(s) {
5186
+ function ur(s) {
5184
5187
  try {
5185
5188
  const e = JSON.parse(s);
5186
5189
  return e && typeof e == "object" ? e : { type: "error", message: "Invalid server event" };
@@ -5188,7 +5191,7 @@ function cr(s) {
5188
5191
  return { type: "error", message: "Invalid server event" };
5189
5192
  }
5190
5193
  }
5191
- function ur(s) {
5194
+ function dr(s) {
5192
5195
  if (typeof s != "string")
5193
5196
  return null;
5194
5197
  try {
@@ -5212,10 +5215,10 @@ function es(s) {
5212
5215
  return typeof t.taskId != "string" || !t.taskId || typeof t.dueAt != "string" || Number.isNaN(Date.parse(t.dueAt)) ? [] : [{ taskId: t.taskId, dueAt: t.dueAt }];
5213
5216
  }) : [];
5214
5217
  }
5215
- function dr(s) {
5218
+ function hr(s) {
5216
5219
  return Array.isArray(s) ? s.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
5217
5220
  }
5218
- function hr(s) {
5221
+ function pr(s) {
5219
5222
  if (!s || typeof s != "object")
5220
5223
  return null;
5221
5224
  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;
@@ -5226,13 +5229,13 @@ function hr(s) {
5226
5229
  ...a !== null ? { scribbleStyle: a } : {}
5227
5230
  };
5228
5231
  }
5229
- function pr(s) {
5232
+ function gr(s) {
5230
5233
  if (!s || typeof s != "object")
5231
5234
  return null;
5232
5235
  const e = s.javascript;
5233
5236
  return typeof e != "string" || !e.trim() ? null : { javascript: e };
5234
5237
  }
5235
- function gr(s, e) {
5238
+ function fr(s, e) {
5236
5239
  return e ? s && typeof s == "object" ? {
5237
5240
  ...s,
5238
5241
  helperError: e
@@ -5242,13 +5245,13 @@ function gr(s, e) {
5242
5245
  helperError: e
5243
5246
  } : s;
5244
5247
  }
5245
- function fr(s) {
5248
+ function mr(s) {
5246
5249
  if (!s || typeof s != "object")
5247
5250
  return s;
5248
5251
  const e = s;
5249
5252
  return typeof e.exception?.message == "string" ? e.exception.message : typeof e.error == "string" ? e.error : s;
5250
5253
  }
5251
- function mr() {
5254
+ function yr() {
5252
5255
  const s = "pluno.productAgent.clientId", e = window.localStorage.getItem(s);
5253
5256
  if (e)
5254
5257
  return e;
@@ -5258,7 +5261,7 @@ function mr() {
5258
5261
  function x() {
5259
5262
  return crypto.randomUUID();
5260
5263
  }
5261
- function yr(s) {
5264
+ function Ir(s) {
5262
5265
  if (!s || typeof s != "object")
5263
5266
  return null;
5264
5267
  const e = s, t = typeof e.id == "string" ? e.id : null;
@@ -5274,7 +5277,7 @@ function st(s, e) {
5274
5277
  s.map((t) => Ue(t, e)).filter((t) => t !== null)
5275
5278
  ) : [];
5276
5279
  }
5277
- function Ir(s) {
5280
+ function Sr(s) {
5278
5281
  return Array.isArray(s) ? s.flatMap((e) => {
5279
5282
  if (!e || typeof e != "object")
5280
5283
  return [];
@@ -5302,7 +5305,7 @@ function Ue(s, e) {
5302
5305
  if (!n || typeof n != "object")
5303
5306
  return null;
5304
5307
  const i = n;
5305
- if (i.hiddenFromTranscript === !0 || mn(i) || i.type === "tab_lifecycle_decision" && i.decision === "keep")
5308
+ if (i.hiddenFromTranscript === !0 || yn(i) || i.type === "tab_lifecycle_decision" && i.decision === "keep")
5306
5309
  return null;
5307
5310
  if (i.type === "assistant_draft")
5308
5311
  return {
@@ -5335,7 +5338,7 @@ function Ue(s, e) {
5335
5338
  ...P(i) !== null ? { causalSequence: P(i) } : {},
5336
5339
  respondsToUserMessageId: O(i) ?? void 0,
5337
5340
  ...k(i) ? { runId: k(i) } : {},
5338
- attachments: Ns(i.attachments, e),
5341
+ attachments: Hs(i.attachments, e),
5339
5342
  ...i.steered === !0 ? { steered: !0 } : {}
5340
5343
  };
5341
5344
  return r === "assistant" && typeof i.id == "string" && Object.defineProperty(o, "assistantDraftItemId", {
@@ -5350,7 +5353,7 @@ function Ue(s, e) {
5350
5353
  }), o;
5351
5354
  }
5352
5355
  if (i.type === "function_call_output") {
5353
- const r = hn(i.output);
5356
+ const r = pn(i.output);
5354
5357
  if (r !== null)
5355
5358
  return {
5356
5359
  id: String(t.id ?? crypto.randomUUID()),
@@ -5365,7 +5368,7 @@ function Ue(s, e) {
5365
5368
  callId: ue(i) ?? void 0,
5366
5369
  sharePromptAllowed: r
5367
5370
  };
5368
- const o = En(i.output);
5371
+ const o = Cn(i.output);
5369
5372
  if (o)
5370
5373
  return {
5371
5374
  id: String(t.id ?? crypto.randomUUID()),
@@ -5376,12 +5379,12 @@ function Ue(s, e) {
5376
5379
  respondsToUserMessageId: O(i) ?? void 0,
5377
5380
  ...k(i) ? { runId: k(i) } : {},
5378
5381
  dataType: "scheduled_check_in",
5379
- toolName: Ss,
5382
+ toolName: Ts,
5380
5383
  callId: ue(i) ?? void 0,
5381
5384
  scheduledCheckInId: o.id ?? void 0,
5382
5385
  scheduledCheckInAt: o.dueAt
5383
5386
  };
5384
- const a = Tr(i.output), l = wr(i.output);
5387
+ const a = wr(i.output), l = Ar(i.output);
5385
5388
  return a ? {
5386
5389
  id: String(t.id ?? crypto.randomUUID()),
5387
5390
  role: "tool",
@@ -5413,7 +5416,7 @@ function Ue(s, e) {
5413
5416
  return i.type === "function_call" || i.type === "tool_call" || i.type === "web_search_call" || i.type === "mcp_call" || i.type === "tab_lifecycle_decision" ? {
5414
5417
  id: String(t.id ?? crypto.randomUUID()),
5415
5418
  role: "tool",
5416
- content: i.type === "mcp_call" ? Sr(i) : br(i),
5419
+ content: i.type === "mcp_call" ? Tr(i) : Mr(i),
5417
5420
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
5418
5421
  ...E(i) !== null ? { displaySequence: E(i) } : {},
5419
5422
  ...P(i) !== null ? { causalSequence: P(i) } : {},
@@ -5427,7 +5430,7 @@ function Ue(s, e) {
5427
5430
  } : i.type === "run_status" || i.type === "run_error" ? i.type === "run_error" && i.stage === "tool_execution" ? null : {
5428
5431
  id: String(t.id ?? crypto.randomUUID()),
5429
5432
  role: "system",
5430
- content: Ar(i),
5433
+ content: br(i),
5431
5434
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
5432
5435
  ...E(i) !== null ? { displaySequence: E(i) } : {},
5433
5436
  ...P(i) !== null ? { causalSequence: P(i) } : {},
@@ -5440,11 +5443,11 @@ function Ue(s, e) {
5440
5443
  ...typeof i.securitySettingsUrl == "string" ? { securitySettingsUrl: i.securitySettingsUrl } : {}
5441
5444
  } : null;
5442
5445
  }
5443
- function Sr(s) {
5446
+ function Tr(s) {
5444
5447
  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(" ");
5445
5448
  return t ? `🔌 Using ${t}` : "🔌 Using connected integration";
5446
5449
  }
5447
- function Tr(s) {
5450
+ function wr(s) {
5448
5451
  if (typeof s != "string")
5449
5452
  return null;
5450
5453
  try {
@@ -5461,7 +5464,7 @@ function Tr(s) {
5461
5464
  return null;
5462
5465
  }
5463
5466
  }
5464
- function wr(s) {
5467
+ function Ar(s) {
5465
5468
  if (typeof s != "string")
5466
5469
  return null;
5467
5470
  try {
@@ -5476,10 +5479,10 @@ function wr(s) {
5476
5479
  return null;
5477
5480
  }
5478
5481
  }
5479
- function Ar(s) {
5482
+ function br(s) {
5480
5483
  return s.type === "run_status" && s.status === "steered" ? "Steered" : typeof s.message == "string" && s.message.trim().length > 0 ? s.message : "";
5481
5484
  }
5482
- function br(s) {
5485
+ function Mr(s) {
5483
5486
  if (s.type === "web_search_call") {
5484
5487
  const e = s.action;
5485
5488
  if (e && typeof e == "object") {
@@ -5491,9 +5494,9 @@ function br(s) {
5491
5494
  }
5492
5495
  return "🔎 Searching the web";
5493
5496
  }
5494
- return Mr(s);
5497
+ return Rr(s);
5495
5498
  }
5496
- function Mr(s) {
5499
+ function Rr(s) {
5497
5500
  if (typeof s.summary == "string" && s.summary.trim().length > 0)
5498
5501
  return se(s.summary);
5499
5502
  if (typeof s.arguments == "string")
@@ -5510,7 +5513,7 @@ function se(s) {
5510
5513
  const e = s.trim() || "Run tool", t = e.codePointAt(0) ?? 0;
5511
5514
  return t >= 126976 && t <= 129791 || t >= 9728 && t <= 10175 || t >= 127462 && t <= 127487 ? e : `🛠️ ${e}`;
5512
5515
  }
5513
- function Rr(s) {
5516
+ function kr(s) {
5514
5517
  if (s == null)
5515
5518
  return s;
5516
5519
  if (typeof s != "object")
@@ -5544,13 +5547,13 @@ function ts(s) {
5544
5547
  }).filter(Boolean).join("") : "";
5545
5548
  }
5546
5549
  function de(s, e) {
5547
- const t = Us(
5550
+ const t = Ds(
5548
5551
  s,
5549
5552
  Mt(s, e)
5550
- ), n = Cr(
5551
- Er(
5552
- Ur(
5553
- kr(s, e),
5553
+ ), n = _r(
5554
+ Cr(
5555
+ Dr(
5556
+ Er(s, e),
5554
5557
  e
5555
5558
  ),
5556
5559
  t
@@ -5575,7 +5578,7 @@ function Mt(s, e, t = !0) {
5575
5578
  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] : []);
5576
5579
  return e.displaySequence = (i.length > 0 ? Math.max(...i) : 0) + 1, e;
5577
5580
  }
5578
- function kr(s, e) {
5581
+ function Er(s, e) {
5579
5582
  const t = e.proactiveSuggestionClientMessageId;
5580
5583
  if (!t)
5581
5584
  return s;
@@ -5585,7 +5588,7 @@ function kr(s, e) {
5585
5588
  const r = [...s];
5586
5589
  return r[i] = e, r;
5587
5590
  }
5588
- function Er(s, e) {
5591
+ function Cr(s, e) {
5589
5592
  const t = e.assistantDraftItemId;
5590
5593
  return t ? s.map(
5591
5594
  (n) => n.dataType === "assistant_draft" && n.id === t ? e : n
@@ -5653,7 +5656,7 @@ function rs(s) {
5653
5656
  loading: !0
5654
5657
  };
5655
5658
  }
5656
- function Cr(s, e) {
5659
+ function _r(s, e) {
5657
5660
  if (e.id.startsWith("transient-activity:"))
5658
5661
  return s;
5659
5662
  const t = e.toolName === "tab_lifecycle";
@@ -5667,19 +5670,19 @@ function ct(s, e) {
5667
5670
  for (const n of e) {
5668
5671
  const i = [...s, ...t];
5669
5672
  t.push(
5670
- Us(
5673
+ Ds(
5671
5674
  i,
5672
5675
  Mt(i, n, !1)
5673
5676
  )
5674
5677
  );
5675
5678
  }
5676
- return yn(
5679
+ return In(
5677
5680
  s,
5678
5681
  t,
5679
5682
  ut
5680
5683
  );
5681
5684
  }
5682
- function _r(s, e) {
5685
+ function Pr(s, e) {
5683
5686
  const t = new Map(s.map((r) => [r.id, r])), n = e.map(
5684
5687
  (r) => Mt(s, r, !1)
5685
5688
  );
@@ -5720,42 +5723,42 @@ function ut(s) {
5720
5723
  isTransient: s.id.startsWith("transient-activity:") || s.dataType === "assistant_draft"
5721
5724
  };
5722
5725
  }
5723
- function Us(s, e) {
5726
+ function Ds(s, e) {
5724
5727
  if (e.role !== "user" || !e.attachments?.length)
5725
5728
  return e;
5726
5729
  const t = s.find(
5727
- (o) => o.role === "user" && (o.id === e.id || He(o) && Ds(o, e))
5730
+ (o) => o.role === "user" && (o.id === e.id || He(o) && qs(o, e))
5728
5731
  );
5729
5732
  if (!t?.attachments?.length)
5730
5733
  return e;
5731
5734
  const n = e.attachments.map((o) => {
5732
- const a = Pr(t.attachments ?? [], o);
5733
- return a ? vr(o, a) : o;
5735
+ const a = vr(t.attachments ?? [], o);
5736
+ return a ? Ur(o, a) : o;
5734
5737
  }), i = { ...e, attachments: n }, r = X(e);
5735
5738
  return r && Object.defineProperty(i, "clientMessageId", {
5736
5739
  value: r,
5737
5740
  enumerable: !1
5738
5741
  }), i;
5739
5742
  }
5740
- function Pr(s, e) {
5743
+ function vr(s, e) {
5741
5744
  return e.id ? s.find((t) => t.id === e.id) ?? null : null;
5742
5745
  }
5743
- function vr(s, e) {
5746
+ function Ur(s, e) {
5744
5747
  const { previewUrl: t } = e;
5745
5748
  return t ? { ...s, previewUrl: t } : s;
5746
5749
  }
5747
- function Ur(s, e) {
5750
+ function Dr(s, e) {
5748
5751
  if (e.role !== "user")
5749
5752
  return s;
5750
5753
  const t = s.findIndex(
5751
- (i) => He(i) && Ds(i, e)
5754
+ (i) => He(i) && qs(i, e)
5752
5755
  );
5753
5756
  if (t === -1)
5754
5757
  return s;
5755
5758
  const n = [...s];
5756
5759
  return n.splice(t, 1), n;
5757
5760
  }
5758
- function Ds(s, e) {
5761
+ function qs(s, e) {
5759
5762
  const t = X(s), n = X(e);
5760
5763
  return t && n ? t === n : s.content === e.content;
5761
5764
  }
@@ -5772,7 +5775,7 @@ function X(s) {
5772
5775
  return n ? s.id.slice(n.length) : null;
5773
5776
  }
5774
5777
  function os(s) {
5775
- const e = qs(s);
5778
+ const e = Os(s);
5776
5779
  if (e === null)
5777
5780
  return !1;
5778
5781
  const t = s[e].id;
@@ -5795,7 +5798,7 @@ function os(s) {
5795
5798
  }
5796
5799
  return !1;
5797
5800
  }
5798
- function Dr(s, e, t) {
5801
+ function qr(s, e, t) {
5799
5802
  const n = new Set(
5800
5803
  s.filter(
5801
5804
  (i) => i.role === "user" && e !== null && X(i) === e
@@ -5809,14 +5812,14 @@ function Dr(s, e, t) {
5809
5812
  if (t && i.runId === t) {
5810
5813
  if (n.size === 0)
5811
5814
  return !0;
5812
- const o = Os(s, r);
5815
+ const o = xs(s, r);
5813
5816
  return !i.respondsToUserMessageId && o !== null && n.has(o);
5814
5817
  }
5815
5818
  return !1;
5816
5819
  });
5817
5820
  }
5818
- function qr(s) {
5819
- const e = qs(s);
5821
+ function Or(s) {
5822
+ const e = Os(s);
5820
5823
  if (e === null)
5821
5824
  return s.some(W);
5822
5825
  const t = s[e].id;
@@ -5824,7 +5827,7 @@ function qr(s) {
5824
5827
  (n) => n.respondsToUserMessageId === t && W(n)
5825
5828
  ) : s.slice(e + 1).some(W);
5826
5829
  }
5827
- function qs(s) {
5830
+ function Os(s) {
5828
5831
  for (let e = s.length - 1; e >= 0; e -= 1)
5829
5832
  if (s[e].role === "user" && !He(s[e]))
5830
5833
  return e;
@@ -5847,7 +5850,7 @@ function ie(s) {
5847
5850
  }
5848
5851
  return null;
5849
5852
  }
5850
- function Or(s) {
5853
+ function xr(s) {
5851
5854
  const e = ie(s);
5852
5855
  if (e === null)
5853
5856
  return null;
@@ -5866,10 +5869,10 @@ function C(s) {
5866
5869
  function pe(s) {
5867
5870
  return s?.retryable !== !0 ? !1 : s.type === "run_error" ? !0 : s.type === "run_status" && s.status === "interrupted";
5868
5871
  }
5869
- function xr(s) {
5872
+ function Lr(s) {
5870
5873
  return s?.type === "run_status" && s.status === "interrupted" && s.reason === "backend_restart";
5871
5874
  }
5872
- function Lr(s, e) {
5875
+ function Nr(s, e) {
5873
5876
  const t = ie(e);
5874
5877
  if (t === null)
5875
5878
  return !1;
@@ -5894,7 +5897,7 @@ function dt(s) {
5894
5897
  const i = n.clientMessageId;
5895
5898
  return typeof i == "string" ? i : null;
5896
5899
  }
5897
- function Nr(s) {
5900
+ function Hr(s) {
5898
5901
  const e = ie(s);
5899
5902
  if (e === null)
5900
5903
  return null;
@@ -5925,7 +5928,7 @@ function ht(s, e) {
5925
5928
  return i?.type === "message" && i.role === "user" && typeof i.clientMessageId == "string" ? i.clientMessageId : null;
5926
5929
  }
5927
5930
  function as(s, e, t, n, i, r) {
5928
- if (!e || !Br(s))
5931
+ if (!e || !Fr(s))
5929
5932
  return !1;
5930
5933
  const o = s;
5931
5934
  if (pe(o) || t !== null && typeof o.id == "string" && o.id !== t)
@@ -5933,7 +5936,7 @@ function as(s, e, t, n, i, r) {
5933
5936
  const a = O(o);
5934
5937
  return n !== null ? a !== null ? a === n : i !== null && k(o) === i && r === n : i === null || k(o) === i;
5935
5938
  }
5936
- function Hr(s, e) {
5939
+ function Br(s, e) {
5937
5940
  for (let t = e - 1; t >= 0; t -= 1) {
5938
5941
  const n = C(s[t]);
5939
5942
  if (n?.type === "message" && n.role === "user")
@@ -5941,13 +5944,13 @@ function Hr(s, e) {
5941
5944
  }
5942
5945
  return null;
5943
5946
  }
5944
- function Os(s, e) {
5947
+ function xs(s, e) {
5945
5948
  for (let t = e - 1; t >= 0; t -= 1)
5946
5949
  if (s[t].role === "user")
5947
5950
  return s[t].id;
5948
5951
  return null;
5949
5952
  }
5950
- function Br(s) {
5953
+ function Fr(s) {
5951
5954
  if (!s || typeof s != "object")
5952
5955
  return !1;
5953
5956
  const e = s;
@@ -5956,16 +5959,16 @@ function Br(s) {
5956
5959
  function W(s) {
5957
5960
  return s.role === "assistant" && s.phase !== "commentary";
5958
5961
  }
5959
- function Fr(s) {
5962
+ function Wr(s) {
5960
5963
  if (!s || typeof s != "object")
5961
5964
  return !1;
5962
5965
  const e = s;
5963
5966
  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";
5964
5967
  }
5965
5968
  function pt(s) {
5966
- return s.filter((e, t) => G(e) ? !eo(s, t) && !xs(s, t) && !Yr(s, t) && !Zr(s, t) : Wr(e) ? e.retryable === !0 && Xr(s, t) ? !1 : !Jr(s, t) : !0);
5969
+ return s.filter((e, t) => G(e) ? !to(s, t) && !Ls(s, t) && !Zr(s, t) && !eo(s, t) : $r(e) ? e.retryable === !0 && Yr(s, t) ? !1 : !Xr(s, t) : !0);
5967
5970
  }
5968
- function Wr(s) {
5971
+ function $r(s) {
5969
5972
  return s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.steered !== !0);
5970
5973
  }
5971
5974
  function G(s) {
@@ -5974,19 +5977,19 @@ function G(s) {
5974
5977
  function gt(s) {
5975
5978
  return s.steered !== !0 && (s.dataType === "assistant_draft" || s.loading === !0);
5976
5979
  }
5977
- function $r(s) {
5980
+ function jr(s) {
5978
5981
  return s.some(gt);
5979
5982
  }
5980
5983
  function ls(s, e) {
5981
5984
  return (s.retryable === !0 || s.code === "transient_model_error") && s.code !== "run_recovery_exhausted" && e !== null && typeof s.clientMessageId == "string";
5982
5985
  }
5983
- function jr(s, e) {
5986
+ function zr(s, e) {
5984
5987
  const t = [...s].reverse().find(gt), n = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : t?.respondsToUserMessageId ?? null, i = typeof e.runId == "string" ? e.runId : t?.runId ?? null;
5985
5988
  return s.flatMap((r) => (n ? r.respondsToUserMessageId === n || !r.respondsToUserMessageId && i !== null && r.runId === i : i ? r.runId === i : gt(r)) ? r.dataType === "assistant_draft" || G(r) ? [] : r.loading === !0 ? [{ ...r, loading: !1 }] : [r] : [r]);
5986
5989
  }
5987
- function zr(s, e, t, n) {
5990
+ function Kr(s, e, t, n) {
5988
5991
  const i = s.findIndex(
5989
- (l, c) => G(l) && !xs(s, c)
5992
+ (l, c) => G(l) && !Ls(s, c)
5990
5993
  ), r = i === -1 ? null : s[i], o = e ?? r?.respondsToUserMessageId ?? null, a = o ? s.find(
5991
5994
  (l) => l.role === "user" && l.id === o
5992
5995
  ) : null;
@@ -5999,7 +6002,7 @@ function zr(s, e, t, n) {
5999
6002
  function _e(s) {
6000
6003
  return s?.type === "run_status" && s.status === "stopped";
6001
6004
  }
6002
- function Kr(s, e) {
6005
+ function Gr(s, e) {
6003
6006
  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;
6004
6007
  }
6005
6008
  function cs(s, e, t) {
@@ -6012,16 +6015,16 @@ function cs(s, e, t) {
6012
6015
  (i) => !G(i) || (n.size > 0 ? !i.respondsToUserMessageId || !n.has(i.respondsToUserMessageId) : !t || i.runId !== t)
6013
6016
  );
6014
6017
  }
6015
- function xs(s, e) {
6018
+ function Ls(s, e) {
6016
6019
  return s.some(
6017
- (t, n) => n !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) && Gr(
6020
+ (t, n) => n !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) && Vr(
6018
6021
  s,
6019
6022
  e,
6020
6023
  n
6021
6024
  )
6022
6025
  );
6023
6026
  }
6024
- function Gr(s, e, t) {
6027
+ function Vr(s, e, t) {
6025
6028
  const n = s[e], i = s[t];
6026
6029
  if (ge(n, i))
6027
6030
  return !0;
@@ -6034,11 +6037,11 @@ function Gr(s, e, t) {
6034
6037
  }
6035
6038
  function us(s, e, t, n) {
6036
6039
  const i = (t && t !== e ? t : null) ?? [...s].reverse().find(
6037
- (l) => l.respondsToUserMessageId !== void 0 && l.respondsToUserMessageId !== e && ds(l) && !Qr(
6040
+ (l) => l.respondsToUserMessageId !== void 0 && l.respondsToUserMessageId !== e && ds(l) && !Jr(
6038
6041
  s,
6039
6042
  l.respondsToUserMessageId
6040
6043
  )
6041
- )?.respondsToUserMessageId ?? Vr(
6044
+ )?.respondsToUserMessageId ?? Qr(
6042
6045
  s,
6043
6046
  e
6044
6047
  );
@@ -6067,7 +6070,7 @@ function us(s, e, t, n) {
6067
6070
  }
6068
6071
  ];
6069
6072
  }
6070
- function Vr(s, e) {
6073
+ function Qr(s, e) {
6071
6074
  const t = s.findIndex(
6072
6075
  (n) => n.role === "user" && n.id === e
6073
6076
  );
@@ -6081,12 +6084,12 @@ function Vr(s, e) {
6081
6084
  function ds(s) {
6082
6085
  return s.role === "tool" || G(s) ? !0 : s.role === "assistant" && s.phase === "commentary";
6083
6086
  }
6084
- function Qr(s, e) {
6087
+ function Jr(s, e) {
6085
6088
  return s.some(
6086
6089
  (t) => t.respondsToUserMessageId === e && (W(t) || t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0))
6087
6090
  );
6088
6091
  }
6089
- function Jr(s, e) {
6092
+ function Xr(s, e) {
6090
6093
  const t = s[e];
6091
6094
  for (let n = e + 1; n < s.length; n += 1) {
6092
6095
  const i = s[n];
@@ -6095,7 +6098,7 @@ function Jr(s, e) {
6095
6098
  }
6096
6099
  return !1;
6097
6100
  }
6098
- function Xr(s, e) {
6101
+ function Yr(s, e) {
6099
6102
  const t = s[e];
6100
6103
  if (!t.respondsToUserMessageId)
6101
6104
  return !1;
@@ -6108,19 +6111,19 @@ function Xr(s, e) {
6108
6111
  }
6109
6112
  return !1;
6110
6113
  }
6111
- function Yr(s, e) {
6114
+ function Zr(s, e) {
6112
6115
  const t = s[e];
6113
6116
  return s.some(
6114
6117
  (n, i) => i !== e && n.role === "assistant" && ge(t, n)
6115
6118
  );
6116
6119
  }
6117
- function Zr(s, e) {
6120
+ function eo(s, e) {
6118
6121
  const t = s[e];
6119
6122
  return s.some(
6120
6123
  (n, i) => i !== e && n.role === "tool" && ge(t, n)
6121
6124
  );
6122
6125
  }
6123
- function eo(s, e) {
6126
+ function to(s, e) {
6124
6127
  const t = s[e];
6125
6128
  for (let n = e + 1; n < s.length; n += 1)
6126
6129
  if (G(s[n]) && ge(t, s[n]))
@@ -6133,15 +6136,15 @@ function ge(s, e) {
6133
6136
  function A(s, e) {
6134
6137
  return s && typeof s == "object" && typeof s[e] == "string" ? s[e] : null;
6135
6138
  }
6136
- function to(s, e) {
6139
+ function so(s, e) {
6137
6140
  try {
6138
- const t = window.localStorage.getItem(`${Es}${s}`);
6141
+ const t = window.localStorage.getItem(`${Cs}${s}`);
6139
6142
  if (!t)
6140
6143
  return null;
6141
6144
  const n = JSON.parse(t), i = typeof n.sessionId == "string" ? n.sessionId : null;
6142
6145
  if (e !== void 0 && i !== e)
6143
6146
  return null;
6144
- const r = Array.isArray(n.messages) ? n.messages.map(po).filter((o) => !!o) : [];
6147
+ const r = Array.isArray(n.messages) ? n.messages.map(go).filter((o) => !!o) : [];
6145
6148
  return {
6146
6149
  sessionId: i,
6147
6150
  messages: r
@@ -6155,20 +6158,20 @@ function ft(s) {
6155
6158
  // running tool or commentary history from disappearing while authoritative hydration is still in flight.
6156
6159
  s.role === "tool" || s.dataType === "run_status" || s.dataType === "run_error";
6157
6160
  }
6158
- function so(s, e) {
6161
+ function no(s, e) {
6159
6162
  try {
6160
6163
  window.localStorage.setItem(
6161
- `${Es}${s}`,
6164
+ `${Cs}${s}`,
6162
6165
  JSON.stringify({
6163
6166
  sessionId: e.sessionId,
6164
- messages: e.messages.filter(ft).slice(-bi).map(go)
6167
+ messages: e.messages.filter(ft).slice(-Mi).map(fo)
6165
6168
  })
6166
6169
  );
6167
6170
  } catch {
6168
6171
  return;
6169
6172
  }
6170
6173
  }
6171
- function no(s) {
6174
+ function io(s) {
6172
6175
  try {
6173
6176
  const e = window.localStorage.getItem(`${lt}${s}`);
6174
6177
  if (!e)
@@ -6194,7 +6197,7 @@ function Q(s, e) {
6194
6197
  return;
6195
6198
  }
6196
6199
  }
6197
- function Ls(s, e) {
6200
+ function Ns(s, e) {
6198
6201
  try {
6199
6202
  const t = `${Le}${s}`, n = location.href, i = location.origin, r = Array.from(e, (o) => ({
6200
6203
  ...o,
@@ -6217,21 +6220,21 @@ function hs(s, e) {
6217
6220
  } catch {
6218
6221
  return;
6219
6222
  }
6220
- Ls(s, e);
6223
+ Ns(s, e);
6221
6224
  }
6222
- function io(s) {
6225
+ function ro(s) {
6223
6226
  try {
6224
6227
  const e = `${Le}${s}`, t = window.sessionStorage.getItem(e);
6225
6228
  if (window.sessionStorage.removeItem(e), !t)
6226
6229
  return [];
6227
6230
  const n = JSON.parse(t);
6228
- return Array.isArray(n) ? n.flatMap((i) => oo(i) ? [{
6231
+ return Array.isArray(n) ? n.flatMap((i) => ao(i) ? [{
6229
6232
  ...i.event,
6230
6233
  page: _(),
6231
6234
  rawOutput: {
6232
6235
  pageContextRestarted: !0,
6233
6236
  outcome: "unknown",
6234
- message: ro(location.href),
6237
+ message: oo(location.href),
6235
6238
  currentUrl: location.href,
6236
6239
  console: [],
6237
6240
  metadata: {
@@ -6248,17 +6251,17 @@ function io(s) {
6248
6251
  return [];
6249
6252
  }
6250
6253
  }
6251
- function ro(s) {
6254
+ function oo(s) {
6252
6255
  return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
6253
6256
  Current URL: ${s}`;
6254
6257
  }
6255
- function oo(s) {
6258
+ function ao(s) {
6256
6259
  if (!s || typeof s != "object")
6257
6260
  return !1;
6258
6261
  const e = s, t = e.event;
6259
6262
  return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" && Rt(t) && t.type === "tool.result";
6260
6263
  }
6261
- function ao(s, e) {
6264
+ function lo(s, e) {
6262
6265
  const t = new Set(
6263
6266
  s.flatMap((n) => n.type === "tool.result" ? [n.callId] : [])
6264
6267
  );
@@ -6267,7 +6270,7 @@ function ao(s, e) {
6267
6270
  ...e.filter((n) => !t.has(n.callId))
6268
6271
  ];
6269
6272
  }
6270
- function lo(s) {
6273
+ function co(s) {
6271
6274
  try {
6272
6275
  window.sessionStorage.removeItem(`${Le}${s}`);
6273
6276
  } catch {
@@ -6286,7 +6289,7 @@ function ps(s) {
6286
6289
  const e = s;
6287
6290
  return typeof e.url == "string" && typeof e.title == "string" && typeof e.origin == "string";
6288
6291
  }
6289
- function Ns(s, e) {
6292
+ function Hs(s, e) {
6290
6293
  if (!Array.isArray(s))
6291
6294
  return;
6292
6295
  const t = s.filter((i) => {
@@ -6294,41 +6297,41 @@ function Ns(s, e) {
6294
6297
  return !1;
6295
6298
  const r = i;
6296
6299
  return typeof r.name == "string" && typeof r.mimeType == "string" && typeof r.sizeBytes == "number";
6297
- }), n = e ? t.map((i) => Hs(i, e)) : t;
6300
+ }), n = e ? t.map((i) => Bs(i, e)) : t;
6298
6301
  return n.length > 0 ? n : void 0;
6299
6302
  }
6300
- function Hs(s, e) {
6303
+ function Bs(s, e) {
6301
6304
  return s.fileUrl?.startsWith("/") ? {
6302
6305
  ...s,
6303
6306
  fileUrl: new URL(s.fileUrl, e).toString()
6304
6307
  } : s;
6305
6308
  }
6306
6309
  function mt(s) {
6307
- return s.type || ho(s.name) || "application/octet-stream";
6310
+ return s.type || po(s.name) || "application/octet-stream";
6308
6311
  }
6309
- function co(s) {
6310
- Bs({
6312
+ function uo(s) {
6313
+ Fs({
6311
6314
  name: s.name,
6312
6315
  mimeType: mt(s),
6313
6316
  sizeBytes: s.size
6314
6317
  });
6315
6318
  }
6316
- function Bs(s) {
6317
- const e = uo(s.name), t = s.mimeType.trim().toLowerCase();
6318
- if (!Ti.has(`${e}:${t}`))
6319
+ function Fs(s) {
6320
+ const e = ho(s.name), t = s.mimeType.trim().toLowerCase();
6321
+ if (!wi.has(`${e}:${t}`))
6319
6322
  throw new Error("This attachment type is not supported by the embedded model provider");
6320
- if (s.sizeBytes <= 0 || s.sizeBytes >= Rs)
6323
+ if (s.sizeBytes <= 0 || s.sizeBytes >= ks)
6321
6324
  throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
6322
6325
  }
6323
- function uo(s) {
6326
+ function ho(s) {
6324
6327
  const e = s.trim().toLowerCase(), t = e.lastIndexOf(".");
6325
6328
  return t >= 0 ? e.slice(t) : "";
6326
6329
  }
6327
- function ho(s) {
6330
+ function po(s) {
6328
6331
  const e = s.toLowerCase();
6329
6332
  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;
6330
6333
  }
6331
- function po(s) {
6334
+ function go(s) {
6332
6335
  if (!s || typeof s != "object")
6333
6336
  return null;
6334
6337
  const e = s;
@@ -6346,11 +6349,11 @@ function po(s) {
6346
6349
  scheduledCheckInId: typeof e.scheduledCheckInId == "string" ? e.scheduledCheckInId : void 0,
6347
6350
  scheduledCheckInAt: typeof e.scheduledCheckInAt == "string" ? e.scheduledCheckInAt : void 0,
6348
6351
  securitySettingsUrl: typeof e.securitySettingsUrl == "string" ? e.securitySettingsUrl : void 0,
6349
- attachments: Ns(e.attachments)?.map(qe),
6352
+ attachments: Hs(e.attachments)?.map(qe),
6350
6353
  loading: typeof e.loading == "boolean" ? e.loading : void 0
6351
6354
  };
6352
6355
  }
6353
- function go(s) {
6356
+ function fo(s) {
6354
6357
  return s.attachments?.length ? {
6355
6358
  ...s,
6356
6359
  attachments: s.attachments.map(qe)
@@ -6374,11 +6377,11 @@ function k(s) {
6374
6377
  const e = s.runId;
6375
6378
  return typeof e == "string" && e ? e : null;
6376
6379
  }
6377
- function fo(s) {
6380
+ function mo(s) {
6378
6381
  const e = s?.timeoutMs;
6379
- return !!s && typeof s == "object" && typeof s.summary == "string" && typeof s.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <= Li);
6382
+ 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 <= Ni);
6380
6383
  }
6381
- function Fs(s) {
6384
+ function Ws(s) {
6382
6385
  const e = {};
6383
6386
  try {
6384
6387
  new Headers(s).forEach((t, n) => {
@@ -6390,23 +6393,23 @@ function Fs(s) {
6390
6393
  return e;
6391
6394
  }
6392
6395
  function kt(s, e) {
6393
- return Gs(s) ? Be : F(xe(e), wi);
6396
+ return Vs(s) ? Be : F(xe(e), Ai);
6394
6397
  }
6395
- function mo(s, e) {
6398
+ function yo(s, e) {
6396
6399
  return typeof s == "string" ? s : s instanceof URL ? s.toString() : e?.url ?? "";
6397
6400
  }
6398
- async function yo(s, e, t, n) {
6399
- const i = Fs(s.headers);
6401
+ async function Io(s, e, t, n) {
6402
+ const i = Ws(s.headers);
6400
6403
  n({
6401
6404
  ...e,
6402
6405
  responseStatus: s.status,
6403
6406
  responseHeaders: i,
6404
- responseBody: await Io(s),
6407
+ responseBody: await So(s),
6405
6408
  durationMs: Date.now() - t
6406
6409
  });
6407
6410
  }
6408
- async function Io(s) {
6409
- if (!Ws(s.headers))
6411
+ async function So(s) {
6412
+ if (!$s(s.headers))
6410
6413
  return;
6411
6414
  let e = null, t = null;
6412
6415
  try {
@@ -6415,7 +6418,7 @@ async function Io(s) {
6415
6418
  const n = new Promise((a) => {
6416
6419
  t = window.setTimeout(() => {
6417
6420
  e?.cancel(), a("timeout");
6418
- }, Ai);
6421
+ }, bi);
6419
6422
  }), i = new TextDecoder();
6420
6423
  let r = "", o = 0;
6421
6424
  for (; ; ) {
@@ -6437,8 +6440,8 @@ async function Io(s) {
6437
6440
  t !== null && window.clearTimeout(t);
6438
6441
  }
6439
6442
  }
6440
- function So(s, e) {
6441
- if (Ws(new Headers(e)))
6443
+ function To(s, e) {
6444
+ if ($s(new Headers(e)))
6442
6445
  try {
6443
6446
  return s.responseType === "" || s.responseType === "text" ? F(s.responseText ?? "") : void 0;
6444
6447
  } catch {
@@ -6449,7 +6452,7 @@ function gs(s) {
6449
6452
  if (typeof s == "string")
6450
6453
  return F(s);
6451
6454
  }
6452
- function To(s) {
6455
+ function wo(s) {
6453
6456
  return L({
6454
6457
  ...s,
6455
6458
  requestBody: fs(s.requestBody),
@@ -6468,14 +6471,14 @@ function fs(s) {
6468
6471
  return xe(s);
6469
6472
  }
6470
6473
  }
6471
- function Ws(s) {
6474
+ function $s(s) {
6472
6475
  if (!s)
6473
6476
  return !1;
6474
6477
  const e = s.get("content-type")?.toLowerCase() ?? "", t = s.get("content-length"), n = Number(t);
6475
6478
  return t !== null && Number.isInteger(n) && n >= 0 && n <= wt && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
6476
6479
  }
6477
6480
  function te(s, e = {}, t) {
6478
- if (Ao(t))
6481
+ if (bo(t))
6479
6482
  return !0;
6480
6483
  const n = Object.entries(e).find(([i]) => i.toLowerCase() === "content-type")?.[1]?.toLowerCase();
6481
6484
  if (n?.includes("multipart/form-data") || n?.includes("application/octet-stream"))
@@ -6490,7 +6493,7 @@ function te(s, e = {}, t) {
6490
6493
  return !0;
6491
6494
  }
6492
6495
  }
6493
- function wo(s, e) {
6496
+ function Ao(s, e) {
6494
6497
  if (te(s))
6495
6498
  return !0;
6496
6499
  try {
@@ -6500,10 +6503,10 @@ function wo(s, e) {
6500
6503
  return !0;
6501
6504
  }
6502
6505
  }
6503
- function Ao(s) {
6506
+ function bo(s) {
6504
6507
  return s instanceof FormData || s instanceof Blob || s instanceof ArrayBuffer || ArrayBuffer.isView(s) || typeof ReadableStream < "u" && s instanceof ReadableStream;
6505
6508
  }
6506
- function bo(s) {
6509
+ function Mo(s) {
6507
6510
  const e = {};
6508
6511
  for (const t of s.trim().split(/[\r\n]+/)) {
6509
6512
  const n = t.indexOf(":");
@@ -6534,27 +6537,27 @@ async function Me(s, e) {
6534
6537
  try {
6535
6538
  return await s();
6536
6539
  } catch (i) {
6537
- if (t = i, n >= Qt - 1 || !Ro(i))
6540
+ if (t = i, n >= Qt - 1 || !ko(i))
6538
6541
  throw i;
6539
- await Mo(n);
6542
+ await Ro(n);
6540
6543
  }
6541
6544
  throw t instanceof Error ? t : new Error(e);
6542
6545
  }
6543
- function Mo(s) {
6546
+ function Ro(s) {
6544
6547
  return new Promise((e) => {
6545
- window.setTimeout(e, Si[s] ?? 0);
6548
+ window.setTimeout(e, Ti[s] ?? 0);
6546
6549
  });
6547
6550
  }
6548
- function Ro(s) {
6549
- return s instanceof Pe ? ko(s.status) : s instanceof TypeError;
6550
- }
6551
6551
  function ko(s) {
6552
- return s === 408 || s === 409 || s === 429 || s >= 500;
6552
+ return s instanceof Pe ? Eo(s.status) : s instanceof TypeError;
6553
6553
  }
6554
6554
  function Eo(s) {
6555
+ return s === 408 || s === 409 || s === 429 || s >= 500;
6556
+ }
6557
+ function Co(s) {
6555
6558
  return s === 401 || s === 403;
6556
6559
  }
6557
- const Be = "[REDACTED_SECRET]", $ = "[REDACTED_TOKEN]", Co = "[REDACTED_SIGNED_URL]", _o = 20, Po = /^(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|token|api_key|apiKey|apikey|key|secret|signature|sig|password|passwd|pwd|code|state|session|jwt|csrf|csrfToken|xsrf|xsrfToken)$/i, $s = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, js = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, zs = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Ks = /\b(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|api_key|apiKey|apikey|client_secret|clientSecret|password|secret|token|jwt|csrf|csrfToken|xsrf|xsrfToken)\b\s*[:=]\s*["']?[^"',&\s}]+/gi, vo = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Uo = /\bhttps?:\/\/[^\s"'<>]+/gi, Do = /[),.;\]]+$/;
6560
+ const Be = "[REDACTED_SECRET]", $ = "[REDACTED_TOKEN]", _o = "[REDACTED_SIGNED_URL]", Po = 20, vo = /^(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, js = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, zs = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, Ks = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Gs = /\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, Uo = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Do = /\bhttps?:\/\/[^\s"'<>]+/gi, qo = /[),.;\]]+$/;
6558
6561
  function L(s) {
6559
6562
  return Oe(s, 0, /* @__PURE__ */ new WeakSet());
6560
6563
  }
@@ -6563,7 +6566,7 @@ function Oe(s, e, t) {
6563
6566
  return s.startsWith("data:image/") || s.startsWith("data:application/pdf;") ? s : xe(s);
6564
6567
  if (s === null || typeof s != "object")
6565
6568
  return s;
6566
- if (e >= _o)
6569
+ if (e >= Po)
6567
6570
  return "[REDACTED_MAX_DEPTH]";
6568
6571
  if (t.has(s))
6569
6572
  return "[REDACTED_CIRCULAR]";
@@ -6571,71 +6574,79 @@ function Oe(s, e, t) {
6571
6574
  return s.map((i) => Oe(i, e + 1, t));
6572
6575
  const n = {};
6573
6576
  for (const [i, r] of Object.entries(s))
6574
- i === "pageContent" ? n[i] = r : Gs(i) ? n[i] = Be : n[i] = i.toLowerCase() === "url" ? qo(r) : Oe(r, e + 1, t);
6577
+ i === "pageContent" ? n[i] = r : Vs(i) ? n[i] = Be : n[i] = i.toLowerCase() === "url" ? Oo(r) : Oe(r, e + 1, t);
6575
6578
  return n;
6576
6579
  }
6577
- function Gs(s) {
6580
+ function Vs(s) {
6578
6581
  const e = s.replace(/[^a-z0-9]/gi, "").toLowerCase();
6579
6582
  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");
6580
6583
  }
6581
- function qo(s) {
6582
- return typeof s == "string" ? Vs(s) : Oe(s, 0, /* @__PURE__ */ new WeakSet());
6584
+ function Oo(s) {
6585
+ return typeof s == "string" ? Qs(s) : Oe(s, 0, /* @__PURE__ */ new WeakSet());
6583
6586
  }
6584
- function Vs(s) {
6587
+ function Qs(s) {
6585
6588
  try {
6586
6589
  const e = new URL(s, location.href);
6587
6590
  for (const t of Array.from(e.searchParams.keys()))
6588
- Po.test(t) && e.searchParams.set(t, $);
6591
+ vo.test(t) && e.searchParams.set(t, $);
6589
6592
  return e.username && (e.username = $), e.password && (e.password = $), e.toString();
6590
6593
  } catch {
6591
- return Oo(s);
6594
+ return xo(s);
6592
6595
  }
6593
6596
  }
6594
6597
  function xe(s) {
6595
- return s.replace(vo, Co).replace(Uo, xo).replace($s, `Bearer ${$}`).replace(js, `Basic ${$}`).replace(zs, $).replace(Ks, (e, t) => `${t}: ${Be}`);
6596
- }
6597
- function Oo(s) {
6598
- return s.replace($s, `Bearer ${$}`).replace(js, `Basic ${$}`).replace(zs, $).replace(Ks, (e, t) => `${t}: ${Be}`);
6598
+ return s.replace(Uo, _o).replace(Do, Lo).replace(js, `Bearer ${$}`).replace(zs, `Basic ${$}`).replace(Ks, $).replace(Gs, (e, t) => `${t}: ${Be}`);
6599
6599
  }
6600
6600
  function xo(s) {
6601
- const e = s.match(Do)?.[0] ?? "", t = e ? s.slice(0, -e.length) : s;
6602
- return `${Vs(t)}${e}`;
6601
+ return s.replace(js, `Bearer ${$}`).replace(zs, `Basic ${$}`).replace(Ks, $).replace(Gs, (e, t) => `${t}: ${Be}`);
6603
6602
  }
6604
- const zo = Object.freeze({
6603
+ function Lo(s) {
6604
+ const e = s.match(qo)?.[0] ?? "", t = e ? s.slice(0, -e.length) : s;
6605
+ return `${Qs(t)}${e}`;
6606
+ }
6607
+ const Ko = Object.freeze({
6605
6608
  init: (s) => Ne.init(s)
6606
6609
  });
6607
- function Ko(s) {
6610
+ function Go(s) {
6608
6611
  return Ne.init(s);
6609
6612
  }
6613
+ function ms(s) {
6614
+ const e = /* @__PURE__ */ new Map();
6615
+ for (const t of [...s].reverse()) {
6616
+ const n = t.integrationAuthRequest;
6617
+ n && !e.has(n.authRequestId) && e.set(n.authRequestId, n);
6618
+ }
6619
+ return [...e.values()];
6620
+ }
6610
6621
  export {
6611
6622
  $t as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
6612
- Vn as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
6613
- Gn as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
6614
- Qn as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
6615
- jo as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
6616
- zo as PlunoProductAgent,
6617
- Nn as ProductAgentInteractionManager,
6623
+ Qn as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
6624
+ Vn as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
6625
+ Jn as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
6626
+ zo as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
6627
+ Ko as PlunoProductAgent,
6628
+ Hn as ProductAgentInteractionManager,
6618
6629
  Ht as ProductAgentQueryController,
6619
- $o as ProductAgentRemoteRuntimeClient,
6630
+ jo as ProductAgentRemoteRuntimeClient,
6620
6631
  Ne as ProductAgentSessionEngine,
6621
- On as ProductAgentSessionHistoryManager,
6622
- Bo as ProductAgentTaskPageTitleController,
6632
+ xn as ProductAgentSessionHistoryManager,
6633
+ Fo as ProductAgentTaskPageTitleController,
6623
6634
  J as ProductAgentTokenProviderError,
6624
- Ei as calculateReconnectDelay,
6625
- Ho as createLocalStorageInteractionDecisionStorage,
6635
+ Ci as calculateReconnectDelay,
6636
+ Bo as createLocalStorageInteractionDecisionStorage,
6626
6637
  ke as createProductAgentQueryState,
6627
- Ko as createProductAgentRuntime,
6628
- Fo as createProductAgentTaskPageTitleDocument,
6629
- zo as default,
6630
- Wn as formatProductAgentTaskPageTitle,
6631
- Zi as getProductAgentOriginAccessErrorMessage,
6632
- Wo as isProductAgentRuntimeCommand,
6633
- Un as mergeProductAgentEntityPages,
6638
+ Go as createProductAgentRuntime,
6639
+ Wo as createProductAgentTaskPageTitleDocument,
6640
+ Ko as default,
6641
+ $n as formatProductAgentTaskPageTitle,
6642
+ er as getProductAgentOriginAccessErrorMessage,
6643
+ $o as isProductAgentRuntimeCommand,
6644
+ Dn as mergeProductAgentEntityPages,
6634
6645
  Ee as normalizeProductAgentEntityPage,
6635
6646
  st as normalizeProductAgentSessionItems,
6636
- Hn as readLocalStorageInteractionDecisions,
6637
- No as resolveProductAgentComposerAction,
6638
- Lo as resolveProductAgentWidgetPresentation,
6639
- bs as selectProductAgentQueryEntities,
6640
- co as validateProductAgentProviderInputFile
6647
+ Bn as readLocalStorageInteractionDecisions,
6648
+ Ho as resolveProductAgentComposerAction,
6649
+ No as resolveProductAgentWidgetPresentation,
6650
+ Ms as selectProductAgentQueryEntities,
6651
+ uo as validateProductAgentProviderInputFile
6641
6652
  };