@pluno/product-agent-web 0.1.182 → 0.1.184

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.
@@ -87,11 +87,26 @@ function Es(t, e) {
87
87
  (s, n, r, i) => `${n}${new URL(r, e).toString()}${i}`
88
88
  ) : t;
89
89
  }
90
- const ks = "save_runtime_captured_skill";
90
+ const ks = "suggest_share_on_socials";
91
91
  function Cs(t) {
92
- return (t.type === "function_call" || t.type === "tool_call") && t.name === ks;
92
+ let e = t;
93
+ if (typeof t == "string")
94
+ try {
95
+ e = JSON.parse(t);
96
+ } catch {
97
+ return null;
98
+ }
99
+ const s = bs(e);
100
+ return s ? typeof s.showSharePrompt == "boolean" ? s.showSharePrompt : s.ok === !0 && typeof s.message == "string" && s.message.includes("social-sharing prompt") ? !0 : null : null;
101
+ }
102
+ function bs(t) {
103
+ return t && typeof t == "object" && !Array.isArray(t) ? t : null;
93
104
  }
94
- function bs(t, e, s) {
105
+ const _s = "save_runtime_captured_skill";
106
+ function Ps(t) {
107
+ return (t.type === "function_call" || t.type === "tool_call") && t.name === _s;
108
+ }
109
+ function Us(t, e, s) {
95
110
  const n = e.map((u) => ({ item: u, identity: s(u) })), r = new Set(
96
111
  n.flatMap(
97
112
  ({ identity: u }) => u.isActivity && !u.isTransient ? u.activityKeys ?? [] : []
@@ -118,7 +133,7 @@ function bs(t, e, s) {
118
133
  for (const u of t) {
119
134
  const p = s(u);
120
135
  let g = o.get(p.id);
121
- if (p.isOptimistic && p.optimisticKey ? g = a.get(p.optimisticKey) : p.isAssistantDraft && p.assistantDraftKey ? g = l.get(p.assistantDraftKey) : p.isActivity && (g = p.activityKeys?.map((k) => c.get(k)).find((k) => k !== void 0) ?? g), g && !y.has(g)) {
136
+ if (p.isOptimistic && p.optimisticKey ? g = a.get(p.optimisticKey) : p.isAssistantDraft && p.assistantDraftKey ? g = l.get(p.assistantDraftKey) : p.isActivity && (g = p.activityKeys?.map((C) => c.get(C)).find((C) => C !== void 0) ?? g), g && !y.has(g)) {
122
137
  f.push(g), y.add(g);
123
138
  continue;
124
139
  }
@@ -129,16 +144,16 @@ function bs(t, e, s) {
129
144
  y.has(u) || f.push(u);
130
145
  return f;
131
146
  }
132
- function _s(t, e, s, n) {
147
+ function vs(t, e, s, n) {
133
148
  return t.filter((r) => {
134
149
  const i = n(r);
135
150
  return !i.isActivity || !i.isTransient ? !0 : e !== null && i.respondsToUserMessageId !== void 0 ? i.respondsToUserMessageId !== e : s === null || i.runId !== s;
136
151
  });
137
152
  }
138
- const Oe = "pluno.productAgent.transportId", Ps = "pluno.productAgent.transportIdentity", Ne = "pluno.productAgent.transportIdentity.event", Us = 50, vs = globalThis.setTimeout.bind(globalThis);
153
+ const Oe = "pluno.productAgent.transportId", Ds = "pluno.productAgent.transportIdentity", Ne = "pluno.productAgent.transportIdentity.event", qs = 50, Ls = globalThis.setTimeout.bind(globalThis);
139
154
  let ne = null;
140
155
  const Ie = /* @__PURE__ */ new Set(), xe = /* @__PURE__ */ new Map();
141
- async function Ds(t = Wt()) {
156
+ async function Os(t = Wt()) {
142
157
  const e = t.randomUUID(), s = t.storage.getItem(Oe);
143
158
  let n = s ?? t.randomUUID(), r = !1, i = !1;
144
159
  const o = t.channel.subscribe((l) => {
@@ -176,8 +191,8 @@ async function Ds(t = Wt()) {
176
191
  }
177
192
  };
178
193
  }
179
- async function qs(t = !1) {
180
- ne || (ne = Ds({
194
+ async function Ns(t = !1) {
195
+ ne || (ne = Os({
181
196
  ...Wt(),
182
197
  skipStoredIdentityCollisionCheck: t
183
198
  }), ne.then((r) => {
@@ -186,7 +201,7 @@ async function qs(t = !1) {
186
201
  };
187
202
  window.addEventListener("pagehide", i);
188
203
  }));
189
- const e = await ne, s = Ls();
204
+ const e = await ne, s = xs();
190
205
  Ie.add(s);
191
206
  let n = !1;
192
207
  return {
@@ -197,7 +212,7 @@ async function qs(t = !1) {
197
212
  }
198
213
  };
199
214
  }
200
- function Ls() {
215
+ function xs() {
201
216
  let t = 0;
202
217
  for (; Ie.has(t); )
203
218
  t += 1;
@@ -205,13 +220,13 @@ function Ls() {
205
220
  }
206
221
  function Wt() {
207
222
  return {
208
- storage: Os(),
209
- channel: Ns(),
223
+ storage: Bs(),
224
+ channel: Ws(),
210
225
  randomUUID: () => crypto.randomUUID(),
211
- settle: () => new Promise((t) => vs(t, Us))
226
+ settle: () => new Promise((t) => Ls(t, qs))
212
227
  };
213
228
  }
214
- function Os() {
229
+ function Bs() {
215
230
  return {
216
231
  getItem: (t) => {
217
232
  try {
@@ -229,9 +244,9 @@ function Os() {
229
244
  }
230
245
  };
231
246
  }
232
- function Ns() {
247
+ function Ws() {
233
248
  if (typeof BroadcastChannel < "u") {
234
- const t = new BroadcastChannel(Ps);
249
+ const t = new BroadcastChannel(Ds);
235
250
  return {
236
251
  postMessage: (e) => t.postMessage(e),
237
252
  subscribe: (e) => {
@@ -241,9 +256,9 @@ function Ns() {
241
256
  close: () => t.close()
242
257
  };
243
258
  }
244
- return xs();
259
+ return Hs();
245
260
  }
246
- function xs() {
261
+ function Hs() {
247
262
  const t = /* @__PURE__ */ new Set(), e = (s) => {
248
263
  if (s.key !== Ne || !s.newValue)
249
264
  return;
@@ -265,7 +280,7 @@ function xs() {
265
280
  };
266
281
  }
267
282
  const Ht = "schedule_follow_up";
268
- function Bs(t) {
283
+ function $s(t) {
269
284
  let e = t;
270
285
  if (typeof e == "string")
271
286
  try {
@@ -278,18 +293,18 @@ function Bs(t) {
278
293
  const s = e;
279
294
  return s.ok !== !0 || s.toolName !== Ht || typeof s.dueAt != "string" || Number.isNaN(Date.parse(s.dueAt)) ? null : s.dueAt;
280
295
  }
281
- const Ws = [
282
- { value: "gpt-5.6-terra", label: "gpt-5.6-terra" },
296
+ const js = [
297
+ { value: "gpt-5.6-sol", label: "gpt-5.6-sol" },
283
298
  { value: "anthropic/claude-sonnet-5", label: "Claude Sonnet 5" },
284
299
  { value: "deepseek/deepseek-v4-flash", label: "DeepSeek V4 Flash" }
285
- ], Hs = [
300
+ ], Fs = [
286
301
  { value: "anthropic/claude-opus-5", label: "Claude Opus 5" },
287
- { value: "gpt-5.6-sol", label: "gpt-5.6-sol" }
288
- ], $s = [
289
- ...Ws,
290
- ...Hs
291
- ], js = (t) => $s.some((e) => e.value === t), Fs = globalThis.fetch.bind(globalThis), Ke = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', zs = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Ks = ".pluno-pa-widget__panel", Gs = ".pluno-pa-widget__timeline", ht = `${Ke}[data-pluno-sdk-preview-channel]`;
292
- let Vs = 0;
302
+ { value: "gpt-5.6-terra", label: "gpt-5.6-terra" }
303
+ ], zs = [
304
+ ...js,
305
+ ...Fs
306
+ ], Ks = (t) => zs.some((e) => e.value === t), Gs = globalThis.fetch.bind(globalThis), Ke = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', Vs = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Xs = ".pluno-pa-widget__panel", Js = ".pluno-pa-widget__timeline", ht = `${Ke}[data-pluno-sdk-preview-channel]`;
307
+ let Ys = 0;
293
308
  function gt(t) {
294
309
  const e = {};
295
310
  for (const o of [
@@ -340,36 +355,36 @@ function Be(t, e, s) {
340
355
  source: "web_sdk",
341
356
  category: t,
342
357
  name: e,
343
- sequence: ++Vs,
358
+ sequence: ++Ys,
344
359
  wallTime: (/* @__PURE__ */ new Date()).toISOString(),
345
360
  monotonicMs: performance.now(),
346
361
  data: s
347
362
  };
348
363
  window.dispatchEvent(new CustomEvent("product-agent:trace", { detail: r }));
349
364
  }
350
- class pe extends Error {
365
+ class he extends Error {
351
366
  }
352
- function Xs(t) {
367
+ function Qs(t) {
353
368
  return t === 408 || t === 425 || t === 429 || t >= 500;
354
369
  }
355
- const Js = "https://app.pluno.ai", Ys = 2e4, Qs = 1e4, Zs = 1e4, en = 1e4, tn = 1e4, sn = 3e3, nn = 3e4, rn = 1e3, ft = 3e4, mt = 0.2, yt = 6e4, It = 15e3, re = 8, Tt = "Browser connection was interrupted.", St = 15e3, on = "Pluno could not send this message. Try it again.", wt = 2e3, an = 1e3, ln = 100, Mt = 8e3, At = 3, cn = [300, 1e3], $t = 50 * 1024 * 1024, un = /* @__PURE__ */ new Set([
370
+ const Zs = "https://app.pluno.ai", en = 2e4, tn = 1e4, sn = 1e4, nn = 1e4, rn = 1e4, on = 3e3, an = 3e4, ln = 1e3, ft = 3e4, mt = 0.2, yt = 6e4, It = 15e3, re = 8, Tt = "Browser connection was interrupted.", St = 15e3, cn = "Pluno could not send this message. Try it again.", wt = 2e3, un = 1e3, dn = 100, Mt = 8e3, At = 3, pn = [300, 1e3], $t = 50 * 1024 * 1024, hn = /* @__PURE__ */ new Set([
356
371
  ".jpeg:image/jpeg",
357
372
  ".jpg:image/jpeg",
358
373
  ".pdf:application/pdf",
359
374
  ".png:image/png",
360
375
  ".webp:image/webp"
361
- ]), Ai = ".pdf,.png,.jpg,.jpeg,.webp", st = 64e3, We = 4e3, nt = 30, dn = 2e3, pn = 1e3, jt = "Image is too large for model vision input.", hn = 100, Ft = "pluno.productAgent.state.", Ge = "pluno.productAgent.pendingEvents.", Ce = "pluno.productAgent.activeToolCalls.", gn = 100;
376
+ ]), ki = ".pdf,.png,.jpg,.jpeg,.webp", st = 64e3, We = 4e3, nt = 30, gn = 2e3, fn = 1e3, jt = "Image is too large for model vision input.", mn = 100, Ft = "pluno.productAgent.state.", Ge = "pluno.productAgent.pendingEvents.", Ce = "pluno.productAgent.activeToolCalls.", yn = 100;
362
377
  function ie(t, e = 0) {
363
378
  const s = t === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (t - 1));
364
379
  return Math.max(e, s);
365
380
  }
366
381
  const Te = /* @__PURE__ */ new Set();
367
- let he = null;
368
- function fn(t, e = Math.random) {
369
- const s = Math.min(ft, rn * 2 ** t), n = 1 - mt + e() * mt * 2;
382
+ let ge = null;
383
+ function In(t, e = Math.random) {
384
+ const s = Math.min(ft, ln * 2 ** t), n = 1 - mt + e() * mt * 2;
370
385
  return Math.min(ft, Math.round(s * n));
371
386
  }
372
- function mn(t, e, s) {
387
+ function Tn(t, e, s) {
373
388
  return new Promise((n, r) => {
374
389
  const i = setTimeout(() => r(new Error(s)), e);
375
390
  t.then(
@@ -386,9 +401,9 @@ class zt {
386
401
  constructor(e, s) {
387
402
  this.options = e, this.transportIdentity = s, this.state = {
388
403
  ...this.state,
389
- starterPrompts: Xn(e.initialStarterPrompts)
404
+ starterPrompts: Qn(e.initialStarterPrompts)
390
405
  };
391
- const n = e.restorePersistedState === !1 ? null : $r(e.clientId, e.expectedPersistedSessionId);
406
+ const n = e.restorePersistedState === !1 ? null : zr(e.clientId, e.expectedPersistedSessionId);
392
407
  n && (this.state = {
393
408
  ...this.state,
394
409
  ...n,
@@ -409,9 +424,9 @@ class zt {
409
424
  taskStatus: null,
410
425
  isRetrying: !1,
411
426
  lastError: null
412
- }), this.queuedClientEvents = Vr(
413
- Fr(e.clientId),
414
- zr(e.clientId)
427
+ }), this.queuedClientEvents = Yr(
428
+ Gr(e.clientId),
429
+ Vr(e.clientId)
415
430
  );
416
431
  const r = [...this.queuedClientEvents].reverse().find(
417
432
  (i) => i.type === "chat.user_message" && typeof i.clientMessageId == "string"
@@ -516,14 +531,14 @@ class zt {
516
531
  lastErrorSecuritySettingsUrl: null
517
532
  };
518
533
  static async init(e) {
519
- const s = e, n = await qs(
534
+ const s = e, n = await Ns(
520
535
  s.skipStoredTransportIdentityCollisionCheck === !0
521
536
  ), r = new zt({
522
537
  ...e,
523
- backendUrl: qn(e.backendUrl ?? Js),
524
- clientId: e.clientId ?? er(),
538
+ backendUrl: Nn(e.backendUrl ?? Zs),
539
+ clientId: e.clientId ?? nr(),
525
540
  productVariant: e.productVariant ?? "customer_embedded",
526
- entrySurface: Ln(e.entrySurface)
541
+ entrySurface: xn(e.entrySurface)
527
542
  }, n);
528
543
  try {
529
544
  ws().catch((i) => {
@@ -557,14 +572,14 @@ class zt {
557
572
  this.state.status === "reconnecting" ? { status: "reconnecting" } : { status: "connecting", lastError: null }
558
573
  );
559
574
  try {
560
- if (this.token = this.options.token ?? (this.options.tokenProvider ? await mn(this.options.tokenProvider(), Zs, "Pluno token provider timed out") : null), e !== this.connectionAttemptId || this.state.status === "closed")
575
+ if (this.token = this.options.token ?? (this.options.tokenProvider ? await Tn(this.options.tokenProvider(), sn, "Pluno token provider timed out") : null), e !== this.connectionAttemptId || this.state.status === "closed")
561
576
  return;
562
577
  if (!this.token && !this.options.webSocketFactory)
563
578
  throw new Error("Pluno requires a token or tokenProvider");
564
- const s = xn(this.options.backendUrl), n = this.options.webSocketFactory?.(s) ?? new WebSocket(s);
579
+ const s = Hn(this.options.backendUrl), n = this.options.webSocketFactory?.(s) ?? new WebSocket(s);
565
580
  this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
566
581
  this.socket === n && n.readyState === WebSocket.CONNECTING && (w("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.replaceTimedOutSocket(n));
567
- }, en), n.addEventListener("open", () => {
582
+ }, nn), n.addEventListener("open", () => {
568
583
  this.socket !== n || (this.clearSocketConnectTimer(), w("web-sdk.agent", "Pluno socket opened", {
569
584
  queuedClientEventCount: this.queuedClientEvents.length,
570
585
  isThinking: this.state.isThinking
@@ -576,13 +591,13 @@ class zt {
576
591
  pageUrl: location.href
577
592
  }) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
578
593
  this.socket === n && (w("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.replaceTimedOutSocket(n));
579
- }, tn));
594
+ }, rn));
580
595
  }), n.addEventListener("message", (r) => {
581
- this.socket === n && this.handleServerEvent(Gn(r.data));
596
+ this.socket === n && this.handleServerEvent(Jn(r.data));
582
597
  }), n.addEventListener("sendfailure", (r) => {
583
598
  if (this.socket !== n)
584
599
  return;
585
- const i = Vn(r?.detail?.data);
600
+ const i = Yn(r?.detail?.data);
586
601
  i?.type === "chat.user_message" && i.clientMessageId === this.pendingClientMessageId && !this.queuedClientEvents.some(
587
602
  (o) => o.type === "chat.user_message" && o.clientMessageId === i.clientMessageId
588
603
  ) && (this.queuedClientEvents.push(i), K(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();
@@ -618,7 +633,7 @@ class zt {
618
633
  this.connectionAttemptId += 1, this.setState({ status: "closed", pendingMessageStatus: null, isThinking: !1, isRetrying: !1 }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.clearStarterPromptUrlRefreshTimer(), this.clearRetryTimers(), this.clearThinkingWatchdog(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.clearSessionLoadRequest(), this.rejectPendingSessionHistoryRequests("Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionPinRequests, "Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionRenameRequests, "Pluno disconnected."), this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.queuedClientEvents = [], this.pendingWidgetLifecycleEvents = [], this.clearPendingWarmupAckTimer(), this.pendingPassiveWarmupEvent = null, this.pendingComposerWarmup = null, this.activeComposerWarmupId = null, this.activeComposerWarmupScope = null, this.nonTranscriptToolCallIds.clear(), this.socket?.close(), this.socket = null;
619
634
  }
620
635
  destroy() {
621
- this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), Xr(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
636
+ this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), Qr(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
622
637
  for (const e of Object.values(this.listeners))
623
638
  e?.clear();
624
639
  }
@@ -720,12 +735,12 @@ class zt {
720
735
  }), T;
721
736
  }
722
737
  this.retryableClientMessageId = null;
723
- const m = !s.initiatedBy && this.options.capturePageContent !== !1 && this.lastUserMessagePageUrl !== o.url, k = {
738
+ const m = !s.initiatedBy && this.options.capturePageContent !== !1 && this.lastUserMessagePageUrl !== o.url, C = {
724
739
  type: "chat.user_message",
725
740
  sessionId: this.state.sessionId ?? void 0,
726
741
  clientMessageId: a,
727
742
  initiatedBy: s.initiatedBy,
728
- invocation: On(s.invocation ?? s.initiatedBy),
743
+ invocation: Bn(s.invocation ?? s.initiatedBy),
729
744
  entrySurface: this.options.entrySurface,
730
745
  content: n,
731
746
  pageContent: m && rt() || void 0,
@@ -734,7 +749,7 @@ class zt {
734
749
  model: this.options.model,
735
750
  metadata: Rt(this.options.metadata)
736
751
  };
737
- return s.initiatedBy || (this.lastUserMessagePageUrl = o.url), this.pendingClientMessageId = a, this.pendingUserMessageEvent = k, this.send(k), this.schedulePendingDeliveryAck(a), a;
752
+ return s.initiatedBy || (this.lastUserMessagePageUrl = o.url), this.pendingClientMessageId = a, this.pendingUserMessageEvent = C, this.send(C), this.schedulePendingDeliveryAck(a), a;
738
753
  }
739
754
  getModel() {
740
755
  return this.options.model;
@@ -758,7 +773,7 @@ class zt {
758
773
  return e ? (this.retryAttemptsByClientMessageId[s] = 0, this.recoveryExhaustionRequestedClientMessageIds.delete(s), this.retryableClientMessageId = null, this.activeClientMessageId = s, this.latestRecoverableClientMessageId = s, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), this.markThinkingProgress(), this.send({ type: "chat.retry_last_user_message", sessionId: e, clientMessageId: s, automatic: !1 }), !0) : !1;
759
774
  }
760
775
  createLocalAttachment(e) {
761
- this.options.productVariant === "customer_embedded" && Jr(e);
776
+ this.options.productVariant === "customer_embedded" && Zr(e);
762
777
  const s = B(), n = {
763
778
  id: s,
764
779
  name: e.name || "attachment",
@@ -864,7 +879,7 @@ class zt {
864
879
  const n = await this.fetchEmbedAttachmentUpload(e);
865
880
  if (n.ok)
866
881
  return await n.json();
867
- if (hi(n.status) && this.options.tokenProvider && !s) {
882
+ if (mi(n.status) && this.options.tokenProvider && !s) {
868
883
  s = !0;
869
884
  const r = await this.fetchEmbedAttachmentUpload(e);
870
885
  if (r.ok)
@@ -889,7 +904,7 @@ class zt {
889
904
  if (!this.state.sessionId)
890
905
  return;
891
906
  this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "user_requested" });
892
- const e = vr(
907
+ const e = Lr(
893
908
  this.state.messages,
894
909
  this.state.assistantDraftRespondsToUserMessageId,
895
910
  this.state.assistantDraftRunId,
@@ -1083,7 +1098,7 @@ class zt {
1083
1098
  try {
1084
1099
  const o = this.options.token ?? await this.options.tokenProvider?.() ?? this.token;
1085
1100
  if (!o)
1086
- throw new pe("Product Agent history requires authentication");
1101
+ throw new he("Product Agent history requires authentication");
1087
1102
  this.token = o;
1088
1103
  const a = new URLSearchParams();
1089
1104
  s === "activity" && a.set("limit", "200"), n && a.set("cursor", n);
@@ -1097,18 +1112,18 @@ class zt {
1097
1112
  });
1098
1113
  if (!d.ok) {
1099
1114
  const y = await d.text() || `History request failed (${d.status})`;
1100
- throw Xs(d.status) ? new Error(y) : new pe(y);
1115
+ throw Qs(d.status) ? new Error(y) : new he(y);
1101
1116
  }
1102
1117
  const h = await d.json();
1103
1118
  if (!h?.session || !Array.isArray(h.items))
1104
- throw new pe("Invalid Product Agent session history response");
1119
+ throw new he("Invalid Product Agent session history response");
1105
1120
  return {
1106
1121
  session: h.session,
1107
1122
  items: h.items,
1108
1123
  nextCursor: typeof h.nextCursor == "string" ? h.nextCursor : null
1109
1124
  };
1110
1125
  } catch (o) {
1111
- if (o instanceof pe)
1126
+ if (o instanceof he)
1112
1127
  throw o;
1113
1128
  w("web-sdk.history", "HTTP session history page failed; retrying", {
1114
1129
  sessionId: e,
@@ -1204,7 +1219,7 @@ class zt {
1204
1219
  if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
1205
1220
  return;
1206
1221
  this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
1207
- const e = Bn();
1222
+ const e = $n();
1208
1223
  this.sendNow(
1209
1224
  L({
1210
1225
  type: "starter_prompts.page_context",
@@ -1215,13 +1230,13 @@ class zt {
1215
1230
  ) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
1216
1231
  }
1217
1232
  startStarterPromptUrlWatcher() {
1218
- this.locationChangeCleanup || (this.locationChangeCleanup = Wn(() => this.handleStarterPromptUrlChange()));
1233
+ this.locationChangeCleanup || (this.locationChangeCleanup = jn(() => this.handleStarterPromptUrlChange()));
1219
1234
  }
1220
1235
  handleStarterPromptUrlChange() {
1221
1236
  const e = location.href;
1222
1237
  e !== this.lastStarterPromptPageUrl && (this.activeComposerWarmupScope && !this.activeComposerWarmupScope.endsWith(`:${e}`) && this.clearPendingComposerWarmup(), this.lastStarterPromptPageUrl = e, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
1223
1238
  this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
1224
- }, gn));
1239
+ }, yn));
1225
1240
  }
1226
1241
  refreshStarterPromptsForCurrentUrl() {
1227
1242
  this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
@@ -1268,8 +1283,8 @@ class zt {
1268
1283
  return;
1269
1284
  this.clearPendingWarmupAckTimer();
1270
1285
  const s = Math.min(
1271
- sn * 2 ** e.retryAttempt,
1272
- nn
1286
+ on * 2 ** e.retryAttempt,
1287
+ an
1273
1288
  );
1274
1289
  e.retryAttempt += 1, this.pendingWarmupAckTimer = window.setTimeout(() => {
1275
1290
  this.pendingWarmupAckTimer = null, this.flushPendingComposerWarmup();
@@ -1291,7 +1306,7 @@ class zt {
1291
1306
  rememberDurablyStoppedTurn(e, s, n) {
1292
1307
  if (!e || !s || !Se(s) || this.findStoppedTurn(e, s))
1293
1308
  return;
1294
- const r = N(s), i = C(s), o = typeof s.clientMessageId == "string" ? s.clientMessageId : r ? this.clientMessageIdsByUserMessageItemId.get(r) ?? null : null;
1309
+ const r = O(s), i = k(s), o = typeof s.clientMessageId == "string" ? s.clientMessageId : r ? this.clientMessageIdsByUserMessageItemId.get(r) ?? null : null;
1295
1310
  this.stoppedTurns.push({
1296
1311
  sessionId: e,
1297
1312
  clientMessageId: o,
@@ -1386,22 +1401,22 @@ class zt {
1386
1401
  this.activeResponseRunId = s, this.setState({ turnPhase: "thinking", lastError: null }), this.markThinkingProgress();
1387
1402
  return;
1388
1403
  }
1389
- if (Tn(e) && this.markThinkingProgress(), e.type === "auth.ok") {
1404
+ if (Mn(e) && this.markThinkingProgress(), e.type === "auth.ok") {
1390
1405
  this.clearSocketAuthTimer(), this.reconnectAttempts = 0;
1391
- const s = tr(e.user);
1406
+ const s = rr(e.user);
1392
1407
  this.authenticatedSocket !== this.socket && this.authenticatedUserId && s && s.id !== this.authenticatedUserId && this.resetForAuthenticationScopeChange(), this.authenticatedUserId = s?.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();
1393
- const n = Jn(e), r = Object.prototype.hasOwnProperty.call(e, "appearance");
1408
+ const n = Zn(e), r = Object.prototype.hasOwnProperty.call(e, "appearance");
1394
1409
  w("web-sdk.agent", "Received auth.ok appearance", {
1395
1410
  hasAppearance: r,
1396
1411
  rawAppearance: e.appearance,
1397
1412
  normalizedAppearance: n
1398
- }), this.runtimeHelperJavascript = Yn(e.runtimeHelpers)?.javascript ?? null;
1413
+ }), this.runtimeHelperJavascript = er(e.runtimeHelpers)?.javascript ?? null;
1399
1414
  const i = bt(e, "starterPrompts"), o = Object.prototype.hasOwnProperty.call(e, "starterPrompts"), a = e.starterPromptsLoading === !0, l = {
1400
1415
  user: s,
1401
1416
  status: "connected",
1402
1417
  ...this.state.lastErrorCode === "connection_failed" ? { lastError: null, lastErrorCode: null } : {}
1403
1418
  };
1404
- (o || this.state.starterPrompts.length === 0) && (l.starterPrompts = i, l.starterPromptsLoading = i.length > 0 ? !1 : a), o && i.length > 0 && (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0), (r || n) && (l.appearance = n), this.setState(l), o && i.length === 0 && !a && !ge() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
1419
+ (o || this.state.starterPrompts.length === 0) && (l.starterPrompts = i, l.starterPromptsLoading = i.length > 0 ? !1 : a), o && i.length > 0 && (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0), (r || n) && (l.appearance = n), this.setState(l), o && i.length === 0 && !a && !fe() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
1405
1420
  type: "page.upsert",
1406
1421
  sessionId: this.state.sessionId,
1407
1422
  page: b(),
@@ -1433,7 +1448,7 @@ class zt {
1433
1448
  runId: l?.runId
1434
1449
  }), d = this.filterStoppedSnapshotItems(s, n), h = e.pendingMessageStatus === "sending" ? "sending" : e.pendingMessageStatus === "queued" ? "reconnecting" : null, y = typeof e.pendingClientMessageId == "string" ? e.pendingClientMessageId : null, f = e.isRetrying === !0, u = e.turnPhase === "sending" || e.turnPhase === "starting" || e.turnPhase === "thinking" ? e.turnPhase : null;
1435
1450
  h && y && (this.pendingClientMessageId = y);
1436
- let p = cr(
1451
+ let p = pr(
1437
1452
  e.assistantDraft
1438
1453
  );
1439
1454
  p && this.findStoppedTurn(n, {
@@ -1442,20 +1457,20 @@ class zt {
1442
1457
  }) && (p = void 0);
1443
1458
  const g = p !== void 0;
1444
1459
  this.rememberUserMessageClientMessageIds(d);
1445
- const m = kr(d);
1460
+ const m = _r(d);
1446
1461
  if (m) {
1447
- const E = Cr(d, m);
1462
+ const E = Pr(d, m);
1448
1463
  this.retryAttemptsByClientMessageId[m] = Math.max(
1449
1464
  this.retryAttemptsByClientMessageId[m] ?? 0,
1450
1465
  E
1451
1466
  );
1452
1467
  }
1453
- const k = d.filter((E) => {
1468
+ const C = d.filter((E) => {
1454
1469
  const q = U(E);
1455
1470
  return Ut(q) ? !1 : !q || !m || !Ae(q) ? !0 : Je(d, q) !== m;
1456
1471
  }), S = Yt(
1457
1472
  this.state.messages,
1458
- _t(k, this.options.backendUrl)
1473
+ _t(C, this.options.backendUrl)
1459
1474
  ), _ = Pt(S), v = g ? p?.content ?? "" : this.state.assistantDraft, R = g ? p?.itemId ?? null : this.state.assistantDraftItemId, ee = g ? p?.respondsToUserMessageId ?? null : this.state.assistantDraftRespondsToUserMessageId, P = g ? p?.runId ?? null : this.state.assistantDraftRunId, F = d.some(
1460
1475
  (E, q) => vt(
1461
1476
  U(E),
@@ -1463,14 +1478,14 @@ class zt {
1463
1478
  R,
1464
1479
  ee,
1465
1480
  P,
1466
- br(d, q)
1481
+ Ur(d, q)
1467
1482
  )
1468
- ), X = g ? p?.content ?? "" : this.state.assistantDraft, te = !!p?.content && !F, O = _ && (!X || F), ce = Ar(S), z = O && ce ? "completed" : c ? "stopped" : O ? "failed" : null;
1469
- if (!_ && Er(this.state.messages, d))
1483
+ ), X = g ? p?.content ?? "" : this.state.assistantDraft, te = !!p?.content && !F, N = _ && (!X || F), ue = kr(S), z = N && ue ? "completed" : c ? "stopped" : N ? "failed" : null;
1484
+ if (!_ && br(this.state.messages, d))
1470
1485
  return;
1471
- this.lastUserMessagePageUrl = Rr(d);
1472
- const x = O || c ? null : Xe(d);
1473
- if (this.latestRecoverableClientMessageId = x, ce && this.clearRetryTimers(), this.setState({
1486
+ this.lastUserMessagePageUrl = Cr(d);
1487
+ const x = N || c ? null : Xe(d);
1488
+ if (this.latestRecoverableClientMessageId = x, ue && this.clearRetryTimers(), this.setState({
1474
1489
  sessionId: M(e.session, "id") ?? this.state.sessionId,
1475
1490
  messages: S,
1476
1491
  isLoadingSession: !1,
@@ -1495,7 +1510,7 @@ class zt {
1495
1510
  isThinking: !0,
1496
1511
  turnPhase: "thinking",
1497
1512
  lastError: null
1498
- } : O ? {
1513
+ } : N ? {
1499
1514
  isThinking: !1,
1500
1515
  status: "connected",
1501
1516
  lastError: null,
@@ -1506,7 +1521,7 @@ class zt {
1506
1521
  turnPhase: u ?? this.state.turnPhase ?? "starting",
1507
1522
  lastError: null
1508
1523
  } : {}
1509
- }), O)
1524
+ }), N)
1510
1525
  this.retryableClientMessageId = null, this.clearThinkingWatchdog();
1511
1526
  else if (!c && (te || x)) {
1512
1527
  if (x) {
@@ -1534,14 +1549,14 @@ class zt {
1534
1549
  this.options.backendUrl
1535
1550
  );
1536
1551
  s === this.sessionActivityRequestId && (this.sessionActivityRequestId = null), this.setState({
1537
- messages: yr(this.state.messages, r)
1552
+ messages: Sr(this.state.messages, r)
1538
1553
  });
1539
1554
  return;
1540
1555
  }
1541
1556
  if (e.type === "sessions.page") {
1542
1557
  const s = typeof e.requestId == "string" ? e.requestId : null, n = s ? this.pendingSessionHistoryRequests.get(s) : null;
1543
1558
  s && n && (window.clearTimeout(n.timeout), this.pendingSessionHistoryRequests.delete(s), n.resolve({
1544
- sessions: sr(e.sessions),
1559
+ sessions: ir(e.sessions),
1545
1560
  nextCursor: typeof e.nextCursor == "string" ? e.nextCursor : null
1546
1561
  }));
1547
1562
  return;
@@ -1570,7 +1585,7 @@ class zt {
1570
1585
  const s = U(e.item);
1571
1586
  if (Ae(s)) {
1572
1587
  typeof s?.runId == "string" && this.retryableFailureRunIdsAwaitingDone.add(s.runId);
1573
- const r = M(e.item, "sessionId") ?? this.state.sessionId, i = s ? N(s) : null, o = i ? this.clientMessageIdsByUserMessageItemId.get(i) : null, a = typeof s?.clientMessageId == "string" ? s.clientMessageId : o ?? (i ? null : this.activeClientMessageId ?? this.latestRecoverableClientMessageId);
1588
+ const r = M(e.item, "sessionId") ?? this.state.sessionId, i = s ? O(s) : null, o = i ? this.clientMessageIdsByUserMessageItemId.get(i) : null, a = typeof s?.clientMessageId == "string" ? s.clientMessageId : o ?? (i ? null : this.activeClientMessageId ?? this.latestRecoverableClientMessageId);
1574
1589
  if (r && a) {
1575
1590
  this.retryAfterInterruptedRun(r, a);
1576
1591
  return;
@@ -1584,8 +1599,8 @@ class zt {
1584
1599
  return;
1585
1600
  const n = Jt(e.item, this.options.backendUrl);
1586
1601
  if (n) {
1587
- const r = Dr(s, n), i = n.callId ? this.pendingToolLoadingByCallId.get(n.callId) : void 0;
1588
- n.callId && i !== void 0 && (n.loading = i, this.pendingToolLoadingByCallId.delete(n.callId)), H(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), Pr(s) && this.clearRunAckResyncRetryTimer();
1602
+ const r = Or(s, n), i = n.callId ? this.pendingToolLoadingByCallId.get(n.callId) : void 0;
1603
+ n.callId && i !== void 0 && (n.loading = i, this.pendingToolLoadingByCallId.delete(n.callId)), H(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), Dr(s) && this.clearRunAckResyncRetryTimer();
1589
1604
  const o = Ve(this.state.messages, n), a = Pt(o), l = vt(
1590
1605
  s,
1591
1606
  this.state.assistantDraft,
@@ -1654,7 +1669,7 @@ class zt {
1654
1669
  const s = typeof e.sessionId == "string" ? e.sessionId : this.state.sessionId, n = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : null, r = typeof e.runId == "string" ? e.runId : null;
1655
1670
  if (!(n && this.state.assistantDraftRespondsToUserMessageId ? n === this.state.assistantDraftRespondsToUserMessageId : !r || !this.state.assistantDraftRunId || r === this.state.assistantDraftRunId))
1656
1671
  return;
1657
- const o = n ? this.clientMessageIdsByUserMessageItemId.get(n) ?? null : null, a = !this.activeClientMessageId || (o ? o === this.activeClientMessageId : this.activeResponseUserMessageId ? !n || n === this.activeResponseUserMessageId : !this.activeResponseRunId || !r || r === this.activeResponseRunId), l = _s(
1672
+ const o = n ? this.clientMessageIdsByUserMessageItemId.get(n) ?? null : null, a = !this.activeClientMessageId || (o ? o === this.activeClientMessageId : this.activeResponseUserMessageId ? !n || n === this.activeResponseUserMessageId : !this.activeResponseRunId || !r || r === this.activeResponseRunId), l = vs(
1658
1673
  this.state.messages.filter(
1659
1674
  (c) => c.dataType !== "assistant_draft" || !je(
1660
1675
  c,
@@ -1668,7 +1683,7 @@ class zt {
1668
1683
  );
1669
1684
  this.setState({
1670
1685
  sessionId: s,
1671
- messages: pr(
1686
+ messages: fr(
1672
1687
  l,
1673
1688
  typeof e.responseId == "string" ? e.responseId : null,
1674
1689
  n,
@@ -1691,9 +1706,9 @@ class zt {
1691
1706
  if (s)
1692
1707
  this.nonTranscriptToolCallIds.add(s);
1693
1708
  else {
1694
- const n = fr(e);
1709
+ const n = Ir(e);
1695
1710
  if (n) {
1696
- const r = hr(
1711
+ const r = mr(
1697
1712
  this.state.messages,
1698
1713
  n
1699
1714
  );
@@ -1754,13 +1769,13 @@ class zt {
1754
1769
  return;
1755
1770
  }
1756
1771
  o && r && i && (this.retryableClientMessageId = i);
1757
- const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l = Nn(a.message);
1772
+ const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l = Wn(a.message);
1758
1773
  l && console.error(l);
1759
1774
  const c = i ?? this.activeClientMessageId, d = typeof e.runId == "string" ? e.runId : null, h = Dt(
1760
1775
  this.state.messages,
1761
1776
  c,
1762
1777
  d
1763
- ), y = Mr(
1778
+ ), y = Er(
1764
1779
  h,
1765
1780
  c,
1766
1781
  d
@@ -1788,7 +1803,7 @@ class zt {
1788
1803
  if (this.options.productVariant !== "personal" || !e || typeof e != "object")
1789
1804
  return;
1790
1805
  const s = e.metadata, n = s && typeof s == "object" ? s.model : void 0;
1791
- this.options.model = js(n) ? n : "gpt-5.6-terra";
1806
+ this.options.model = Ks(n) ? n : "gpt-5.6-sol";
1792
1807
  }
1793
1808
  shouldIgnoreBackgroundSessionEvent(e) {
1794
1809
  if (!this.options.keepRunsActiveOnSessionNavigation || !Et(e))
@@ -1803,7 +1818,7 @@ class zt {
1803
1818
  const s = typeof e.sessionId == "string" ? e.sessionId : this.state.sessionId, n = typeof e.clientMessageId == "string" ? e.clientMessageId : null;
1804
1819
  if (!(e.retryable === !0 || e.code === "transient_model_error") || !s || !n || e.code === "run_recovery_exhausted")
1805
1820
  return !1;
1806
- if (ge())
1821
+ if (fe())
1807
1822
  return this.retryableClientMessageId = n, this.activeClientMessageId = n, this.latestRecoverableClientMessageId = n, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), !0;
1808
1823
  if (e.code === "run_still_active") {
1809
1824
  if (this.retryableClientMessageId = n, this.activeClientMessageId = n, this.latestRecoverableClientMessageId = n, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), this.retryTimersByClientMessageId[n] === void 0) {
@@ -1834,7 +1849,7 @@ class zt {
1834
1849
  }, o), !0;
1835
1850
  }
1836
1851
  retryAfterInterruptedRun(e, s) {
1837
- if (ge()) {
1852
+ if (fe()) {
1838
1853
  this.retryableClientMessageId = s, this.activeClientMessageId = s, this.latestRecoverableClientMessageId = s, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null });
1839
1854
  return;
1840
1855
  }
@@ -1948,7 +1963,7 @@ class zt {
1948
1963
  }), this.markThinkingProgress();
1949
1964
  }
1950
1965
  schedulePendingDeliveryAck(e) {
1951
- this.clearPendingDeliveryTimers(), !ge() && (this.pendingDeliveryAckTimer = window.setTimeout(() => {
1966
+ this.clearPendingDeliveryTimers(), !fe() && (this.pendingDeliveryAckTimer = window.setTimeout(() => {
1952
1967
  this.pendingDeliveryAckTimer = null, this.retryPendingDelivery(e);
1953
1968
  }, St));
1954
1969
  }
@@ -1974,7 +1989,7 @@ class zt {
1974
1989
  ...this.state.isThinking ? {} : { turnPhase: null },
1975
1990
  isRetrying: !1,
1976
1991
  ...this.state.isThinking ? {} : { taskStatus: "failed" },
1977
- lastError: on,
1992
+ lastError: cn,
1978
1993
  lastErrorCode: "message_delivery_failed"
1979
1994
  });
1980
1995
  }
@@ -1989,7 +2004,7 @@ class zt {
1989
2004
  s,
1990
2005
  typeof e.runId == "string" ? e.runId : null
1991
2006
  ), !(!this.state.isThinking || !s) && this.setState({
1992
- messages: Lr(
2007
+ messages: xr(
1993
2008
  this.state.messages,
1994
2009
  s
1995
2010
  )
@@ -2104,7 +2119,7 @@ class zt {
2104
2119
  if (!s || !n || !r)
2105
2120
  return;
2106
2121
  const a = r === "execute_code", l = r === "execute_code_in_browser_tab" && o !== null && typeof o == "object" && o.tabId === "local:current";
2107
- if (!a && !l || !ti(o)) {
2122
+ if (!a && !l || !ri(o)) {
2108
2123
  this.setToolMessageLoading(n, !1), this.send({
2109
2124
  type: "tool.result",
2110
2125
  sessionId: s,
@@ -2153,7 +2168,7 @@ class zt {
2153
2168
  let c = null, d;
2154
2169
  c = await this.executeRuntimeHelper(), d = await kt(
2155
2170
  o,
2156
- vn(e.runtimeContext, this.options.backendUrl)
2171
+ Ln(e.runtimeContext, this.options.backendUrl)
2157
2172
  ).catch((h) => ({
2158
2173
  ok: !1,
2159
2174
  exception: {
@@ -2166,11 +2181,11 @@ class zt {
2166
2181
  toolName: r,
2167
2182
  summary: o.summary,
2168
2183
  rawInput: L(o),
2169
- rawOutput: L(Qn(d, c))
2184
+ rawOutput: L(tr(d, c))
2170
2185
  }), Lt(this.options.clientId, this.activeBrowserToolCalls.values()));
2171
2186
  }
2172
2187
  setToolMessageLoading(e, s) {
2173
- const n = gr(
2188
+ const n = yr(
2174
2189
  this.state.messages,
2175
2190
  e,
2176
2191
  s
@@ -2188,10 +2203,10 @@ class zt {
2188
2203
  };
2189
2204
  }
2190
2205
  installSessionBrowserApis() {
2191
- this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = Mn();
2206
+ this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = En();
2192
2207
  }
2193
2208
  cleanupSessionBrowserApis() {
2194
- this.sessionBrowserApisCleanup && (Pn(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
2209
+ this.sessionBrowserApisCleanup && (Dn(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
2195
2210
  }
2196
2211
  async executeRuntimeHelper() {
2197
2212
  if (!this.runtimeHelperJavascript?.trim())
@@ -2199,15 +2214,15 @@ class zt {
2199
2214
  const e = await kt({
2200
2215
  javascript: this.runtimeHelperJavascript
2201
2216
  });
2202
- return e.ok === !1 ? Zn(e) : null;
2217
+ return e.ok === !1 ? sr(e) : null;
2203
2218
  }
2204
2219
  enableNetworkCapture() {
2205
- this.networkCaptureCleanup || (this.networkCaptureCleanup = yn((e) => {
2206
- ai(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
2220
+ this.networkCaptureCleanup || (this.networkCaptureCleanup = Sn((e) => {
2221
+ ui(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
2207
2222
  }));
2208
2223
  }
2209
2224
  enqueueNetworkEvent(e) {
2210
- this.queuedNetworkEvents.length >= ln || (this.queuedNetworkEvents.push(oi(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
2225
+ this.queuedNetworkEvents.length >= dn || (this.queuedNetworkEvents.push(ci(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
2211
2226
  this.networkBatchTimer = null;
2212
2227
  const s = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
2213
2228
  s.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
@@ -2216,12 +2231,12 @@ class zt {
2216
2231
  page: b(),
2217
2232
  events: s
2218
2233
  });
2219
- }, an)));
2234
+ }, un)));
2220
2235
  }
2221
2236
  scheduleReconnect() {
2222
2237
  if (this.reconnectTimer !== null || this.state.status === "closed")
2223
2238
  return;
2224
- const e = fn(this.reconnectAttempts);
2239
+ const e = In(this.reconnectAttempts);
2225
2240
  this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
2226
2241
  this.reconnectTimer = null, this.connect().catch((s) => {
2227
2242
  w("web-sdk.agent", "Pluno reconnect failed; retrying", {
@@ -2237,8 +2252,8 @@ class zt {
2237
2252
  const e = this.socket;
2238
2253
  !e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
2239
2254
  this.socket === e && (w("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
2240
- }, Qs));
2241
- }, Ys);
2255
+ }, tn));
2256
+ }, en);
2242
2257
  }
2243
2258
  stopHeartbeat() {
2244
2259
  this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
@@ -2276,7 +2291,7 @@ class zt {
2276
2291
  ...e.lastError === null && e.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
2277
2292
  ...e.lastError !== void 0 && e.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
2278
2293
  };
2279
- this.state = o, jr(this.options.clientId, this.state), this.emit("state", this.getState()), Be("state", this.state.status, {
2294
+ this.state = o, Kr(this.options.clientId, this.state), this.emit("state", this.getState()), Be("state", this.state.status, {
2280
2295
  status: this.state.status,
2281
2296
  sessionId: this.state.sessionId,
2282
2297
  messageCount: this.state.messages.length,
@@ -2299,13 +2314,13 @@ class zt {
2299
2314
  }
2300
2315
  }
2301
2316
  const He = /* @__PURE__ */ new WeakMap();
2302
- function yn(t) {
2303
- const e = window.__plunoProductAgentNetworkCapture ?? In();
2317
+ function Sn(t) {
2318
+ const e = window.__plunoProductAgentNetworkCapture ?? wn();
2304
2319
  return e.subscribers.add(t), () => {
2305
2320
  e.subscribers.delete(t), !(e.subscribers.size > 0) && (e.destroy(), window.__plunoProductAgentNetworkCapture === e && delete window.__plunoProductAgentNetworkCapture);
2306
2321
  };
2307
2322
  }
2308
- function In() {
2323
+ function wn() {
2309
2324
  const t = /* @__PURE__ */ new Set(), e = (y) => {
2310
2325
  t.forEach((f) => {
2311
2326
  try {
@@ -2322,11 +2337,11 @@ function In() {
2322
2337
  throw m;
2323
2338
  }
2324
2339
  try {
2325
- const m = f instanceof Request ? f : null, k = si(f, m), T = cs(u?.headers ?? m?.headers);
2326
- if (!J(k, T, u?.body)) {
2340
+ const m = f instanceof Request ? f : null, C = ii(f, m), T = cs(u?.headers ?? m?.headers);
2341
+ if (!J(C, T, u?.body)) {
2327
2342
  const _ = {
2328
2343
  requestId: Fe("fetch"),
2329
- url: W(k, We),
2344
+ url: W(C, We),
2330
2345
  method: (u?.method ?? m?.method ?? "GET").toUpperCase(),
2331
2346
  requestHeaders: T,
2332
2347
  requestBody: Nt(u?.body),
@@ -2335,7 +2350,7 @@ function In() {
2335
2350
  };
2336
2351
  g.then(
2337
2352
  (v) => {
2338
- ni(v, _, p, e).catch(() => {
2353
+ oi(v, _, p, e).catch(() => {
2339
2354
  e({
2340
2355
  ..._,
2341
2356
  responseStatus: v.status,
@@ -2356,7 +2371,7 @@ function In() {
2356
2371
  }
2357
2372
  return g;
2358
2373
  }, a = function(f, u, p, g, m) {
2359
- const k = n.call(this, f, u, p ?? !0, g ?? void 0, m ?? void 0), T = typeof u == "string" ? u : u.toString();
2374
+ const C = n.call(this, f, u, p ?? !0, g ?? void 0, m ?? void 0), T = typeof u == "string" ? u : u.toString();
2360
2375
  return He.set(this, {
2361
2376
  requestId: Fe("xhr"),
2362
2377
  method: String(f ?? "GET").toUpperCase(),
@@ -2365,7 +2380,7 @@ function In() {
2365
2380
  startedAtMs: Date.now(),
2366
2381
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
2367
2382
  excluded: J(T)
2368
- }), k;
2383
+ }), C;
2369
2384
  }, l = function(f, u) {
2370
2385
  const p = r.call(this, f, u), g = He.get(this);
2371
2386
  return g && Object.keys(g.requestHeaders).length < nt && (g.requestHeaders[f] = ot(f, u), g.excluded = g.excluded || J(g.url, g.requestHeaders)), p;
@@ -2377,7 +2392,7 @@ function In() {
2377
2392
  () => {
2378
2393
  queueMicrotask(() => {
2379
2394
  try {
2380
- const p = ci(this.getAllResponseHeaders());
2395
+ const p = pi(this.getAllResponseHeaders());
2381
2396
  e({
2382
2397
  requestId: u.requestId,
2383
2398
  url: u.url,
@@ -2387,7 +2402,7 @@ function In() {
2387
2402
  resourceType: "xhr",
2388
2403
  responseStatus: this.status,
2389
2404
  responseHeaders: p,
2390
- responseBody: ii(this, p),
2405
+ responseBody: li(this, p),
2391
2406
  errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
2392
2407
  startedAt: u.startedAt,
2393
2408
  durationMs: Date.now() - u.startedAtMs
@@ -2483,7 +2498,7 @@ function Rt(t) {
2483
2498
  const e = typeof t == "function" ? t() : t;
2484
2499
  return e && Object.keys(e).length > 0 ? e : void 0;
2485
2500
  }
2486
- function Tn(t) {
2501
+ function Mn(t) {
2487
2502
  return t.type === "run.model_started" || t.type === "conversation.state" || t.type === "session.updated" || t.type === "session.item" || t.type === "chat.assistant_delta" || t.type === "chat.assistant_done" || t.type === "tool.call";
2488
2503
  }
2489
2504
  function Et(t) {
@@ -2504,27 +2519,27 @@ function oe(t) {
2504
2519
  }
2505
2520
  return null;
2506
2521
  }
2507
- const Sn = 5e3, wn = 12e4;
2508
- function Mn() {
2522
+ const An = 5e3, Rn = 12e4;
2523
+ function En() {
2509
2524
  const t = [
2510
- Rn(),
2511
- An()
2525
+ Cn(),
2526
+ kn()
2512
2527
  ].filter((e) => typeof e == "function");
2513
2528
  return () => {
2514
2529
  for (const e of t.reverse())
2515
2530
  e();
2516
2531
  };
2517
2532
  }
2518
- function An() {
2533
+ function kn() {
2519
2534
  return Bt(globalThis, "getPageSnapshot", async () => rt());
2520
2535
  }
2521
- function Rn() {
2536
+ function Cn() {
2522
2537
  return Bt(globalThis, "pageImages", {
2523
- inspectImage: async (e, s) => await En(e, s)
2538
+ inspectImage: async (e, s) => await bn(e, s)
2524
2539
  });
2525
2540
  }
2526
- async function En(t, e = {}) {
2527
- const s = _n(e.name), n = await kn(t);
2541
+ async function bn(t, e = {}) {
2542
+ const s = vn(e.name), n = await _n(t);
2528
2543
  return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
2529
2544
  type: "pluno.pageImages.inspectImage",
2530
2545
  imageAttached: !1,
@@ -2542,15 +2557,15 @@ async function En(t, e = {}) {
2542
2557
  imageAttachmentError: n.error
2543
2558
  };
2544
2559
  }
2545
- async function kn(t) {
2560
+ async function _n(t) {
2546
2561
  return t instanceof Blob ? t.type.startsWith("image/") ? t.size === 0 ? { ok: !1, error: "Page image is empty." } : t.size > 8 * 1024 * 1024 ? { ok: !1, error: jt } : {
2547
2562
  ok: !0,
2548
2563
  mimeType: t.type,
2549
2564
  sizeBytes: t.size,
2550
- dataUrl: await Un(t)
2551
- } : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof t != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : Cn(t);
2565
+ dataUrl: await qn(t)
2566
+ } : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof t != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : Pn(t);
2552
2567
  }
2553
- function Cn(t) {
2568
+ function Pn(t) {
2554
2569
  if (!t.startsWith("data:") || !t.includes(","))
2555
2570
  return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
2556
2571
  const [e, s] = t.slice(5).split(",", 2), n = e.split(";").map((a) => a.trim()).filter(Boolean), r = n[0] ?? "";
@@ -2561,7 +2576,7 @@ function Cn(t) {
2561
2576
  const i = s.replace(/[ \t\r\n\f]+/g, "");
2562
2577
  if (!/^[A-Za-z0-9+/]*={0,2}$/.test(i))
2563
2578
  return { ok: !1, error: "Page image data URL has invalid base64." };
2564
- const o = bn(i);
2579
+ const o = Un(i);
2565
2580
  return o === null ? { ok: !1, error: "Page image data URL has invalid base64." } : o === 0 ? { ok: !1, error: "Page image is empty." } : {
2566
2581
  ok: !0,
2567
2582
  mimeType: r,
@@ -2569,22 +2584,22 @@ function Cn(t) {
2569
2584
  dataUrl: `data:${r};base64,${i}`
2570
2585
  };
2571
2586
  }
2572
- function bn(t) {
2587
+ function Un(t) {
2573
2588
  if (t.length === 0 || t.length % 4 !== 0)
2574
2589
  return null;
2575
2590
  const e = t.length - t.replace(/=+$/, "").length;
2576
2591
  return e > 2 ? null : t.length / 4 * 3 - e;
2577
2592
  }
2578
- function _n(t) {
2593
+ function vn(t) {
2579
2594
  return (typeof t == "string" ? t.trim() : "") || "Page image";
2580
2595
  }
2581
- function Pn(t) {
2596
+ function Dn(t) {
2582
2597
  try {
2583
2598
  t();
2584
2599
  } catch {
2585
2600
  }
2586
2601
  }
2587
- function Un(t) {
2602
+ function qn(t) {
2588
2603
  return new Promise((e, s) => {
2589
2604
  const n = new FileReader();
2590
2605
  n.onload = () => {
@@ -2598,7 +2613,7 @@ function Un(t) {
2598
2613
  }
2599
2614
  async function kt(t, e) {
2600
2615
  const s = Object.getPrototypeOf(async function() {
2601
- }).constructor, n = t.timeoutMs ?? Sn, r = Date.now(), i = [];
2616
+ }).constructor, n = t.timeoutMs ?? An, r = Date.now(), i = [];
2602
2617
  let o;
2603
2618
  const a = {
2604
2619
  log: console.log,
@@ -2616,7 +2631,7 @@ async function kt(t, e) {
2616
2631
  o = window.setTimeout(() => h(c), n);
2617
2632
  })
2618
2633
  ]);
2619
- return d === c ? Dn(n) : {
2634
+ return d === c ? On(n) : {
2620
2635
  ok: !0,
2621
2636
  result: d,
2622
2637
  console: i,
@@ -2645,7 +2660,7 @@ async function kt(t, e) {
2645
2660
  e?.deactivate(), o !== void 0 && window.clearTimeout(o), console.log = a.log, console.info = a.info, console.warn = a.warn, console.error = a.error;
2646
2661
  }
2647
2662
  }
2648
- function vn(t, e) {
2663
+ function Ln(t, e) {
2649
2664
  if (!t || typeof t != "object")
2650
2665
  return;
2651
2666
  const s = t.sandboxFilesToken;
@@ -2655,7 +2670,7 @@ function vn(t, e) {
2655
2670
  const r = () => {
2656
2671
  if (!n)
2657
2672
  throw new Error("sandboxFiles is only available during browser-code execution");
2658
- }, i = async (a, l) => await Fs(`${e.replace(/\/$/, "")}${a}`, l);
2673
+ }, i = async (a, l) => await Gs(`${e.replace(/\/$/, "")}${a}`, l);
2659
2674
  return {
2660
2675
  value: Object.freeze({
2661
2676
  upload: async (a) => {
@@ -2689,7 +2704,7 @@ function vn(t, e) {
2689
2704
  }
2690
2705
  };
2691
2706
  }
2692
- function Dn(t) {
2707
+ function On(t) {
2693
2708
  return {
2694
2709
  ok: !1,
2695
2710
  exception: {
@@ -2703,10 +2718,10 @@ function Dn(t) {
2703
2718
  }
2704
2719
  };
2705
2720
  }
2706
- function qn(t) {
2721
+ function Nn(t) {
2707
2722
  return t.replace(/\/+$/, "");
2708
2723
  }
2709
- function Ln(t) {
2724
+ function xn(t) {
2710
2725
  const e = {
2711
2726
  sidepanel: "extension_sidepanel",
2712
2727
  browser_extension_page_ui: "extension_widget",
@@ -2718,13 +2733,13 @@ function Ln(t) {
2718
2733
  };
2719
2734
  return t && t in e ? e[t] : t ?? "embedded_custom_ui";
2720
2735
  }
2721
- function On(t) {
2736
+ function Bn(t) {
2722
2737
  return t === "pluno" ? "scheduled_continuation" : t ?? "user";
2723
2738
  }
2724
- function Nn(t, e = location.origin) {
2739
+ function Wn(t, e = location.origin) {
2725
2740
  return /origin (?:is not allowed|does not match browser origin)/i.test(t) ? `Pluno widget blocked on ${e}: this domain is not allowed. Add ${e} in Pluno under Integration > Domains.` : null;
2726
2741
  }
2727
- function xn(t) {
2742
+ function Hn(t) {
2728
2743
  const e = new URL("/api/product-agent/embed/ws", t);
2729
2744
  return e.protocol = e.protocol === "https:" ? "wss:" : "ws:", e.toString();
2730
2745
  }
@@ -2737,19 +2752,19 @@ function b() {
2737
2752
  ...t ? { plunoProductAgentUi: t } : {}
2738
2753
  };
2739
2754
  }
2740
- function Bn() {
2755
+ function $n() {
2741
2756
  return {
2742
2757
  pageUrl: location.href,
2743
2758
  pageTitle: document.title,
2744
2759
  htmlContent: rt()
2745
2760
  };
2746
2761
  }
2747
- function Wn(t) {
2748
- return Te.add(t), he || (he = Hn()), () => {
2749
- Te.delete(t), Te.size === 0 && (he?.(), he = null);
2762
+ function jn(t) {
2763
+ return Te.add(t), ge || (ge = Fn()), () => {
2764
+ Te.delete(t), Te.size === 0 && (ge?.(), ge = null);
2750
2765
  };
2751
2766
  }
2752
- function Hn() {
2767
+ function Fn() {
2753
2768
  const t = () => {
2754
2769
  for (const i of Array.from(Te))
2755
2770
  i();
@@ -2764,7 +2779,7 @@ function Hn() {
2764
2779
  window.history.pushState === n && (window.history.pushState = e), window.history.replaceState === r && (window.history.replaceState = s), window.removeEventListener("popstate", t), window.removeEventListener("hashchange", t);
2765
2780
  };
2766
2781
  }
2767
- function ge() {
2782
+ function fe() {
2768
2783
  return Xt()?.surface === "browser_extension_sdk_preview";
2769
2784
  }
2770
2785
  function rt() {
@@ -2779,20 +2794,20 @@ function rt() {
2779
2794
  (p) => Kt(p) && !p.parentElement?.closest(n)
2780
2795
  );
2781
2796
  for (const p of r.slice(0, 3))
2782
- s("Active overlay", $e(ae(p), e));
2783
- const i = $n(), o = i ? $e(ae(i), e) : "";
2784
- s("Main page content", o), s("Additional visible page text", $e(ae(document.body), e));
2797
+ s("Active overlay", $e(le(p), e));
2798
+ const i = zn(), o = i ? $e(le(i), e) : "";
2799
+ s("Main page content", o), s("Additional visible page text", $e(le(document.body), e));
2785
2800
  const a = t.map(([p, g]) => `${p}:
2786
2801
  ${g}`).join(`
2787
2802
 
2788
- `).trim().slice(0, 12e3), l = jn(r, i).trim(), c = `Simplified DOM outline:
2803
+ `).trim().slice(0, 12e3), l = Kn(r, i).trim(), c = `Simplified DOM outline:
2789
2804
  `, d = `
2790
2805
 
2791
2806
  Visible page text:
2792
2807
  `, h = 12e3 - c.length - d.length, y = Math.min(a.length, 7900), f = l.slice(0, h - y), u = a.slice(0, h - f.length);
2793
2808
  return `${c}${f}${d}${u}`;
2794
2809
  }
2795
- function ae(t) {
2810
+ function le(t) {
2796
2811
  return t.innerText ?? t.textContent ?? "";
2797
2812
  }
2798
2813
  function Q(t) {
@@ -2813,10 +2828,10 @@ function Kt(t) {
2813
2828
  const e = window.getComputedStyle(t);
2814
2829
  return e.display !== "none" && e.visibility !== "hidden" && t.getClientRects().length > 0;
2815
2830
  }
2816
- function $n() {
2817
- return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Kt).sort((t, e) => ae(e).length - ae(t).length)[0] ?? null;
2831
+ function zn() {
2832
+ return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Kt).sort((t, e) => le(e).length - le(t).length)[0] ?? null;
2818
2833
  }
2819
- function jn(t, e) {
2834
+ function Kn(t, e) {
2820
2835
  const s = /* @__PURE__ */ new Set([
2821
2836
  "main",
2822
2837
  "nav",
@@ -2896,7 +2911,7 @@ function jn(t, e) {
2896
2911
  "data-test",
2897
2912
  "data-qa",
2898
2913
  "data-cy"
2899
- ], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: d, priorityTargets: h } = Fn(), y = new Set(t);
2914
+ ], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: d, priorityTargets: h } = Gn(), y = new Set(t);
2900
2915
  e && y.add(e);
2901
2916
  let f = 0;
2902
2917
  const u = (T) => {
@@ -2911,18 +2926,18 @@ function jn(t, e) {
2911
2926
  if (f >= 1e3 && !X || _.has(R) || i.has(P) || R.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || F.display === "none" || F.visibility === "hidden")
2912
2927
  return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
2913
2928
  f += 1;
2914
- const te = u(R), O = Vt(R), ce = a.has(te) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(P) || P === "a" && R.hasAttribute("href"), ue = Array.from(R.children).filter((I) => I instanceof HTMLElement), z = /* @__PURE__ */ new Map();
2915
- for (const I of ue) {
2929
+ const te = u(R), N = Vt(R), ue = a.has(te) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(P) || P === "a" && R.hasAttribute("href"), de = Array.from(R.children).filter((I) => I instanceof HTMLElement), z = /* @__PURE__ */ new Map();
2930
+ for (const I of de) {
2916
2931
  const A = p(I);
2917
2932
  z.set(A, (z.get(A) ?? 0) + 1);
2918
2933
  }
2919
2934
  const x = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map();
2920
- for (const I of ue) {
2935
+ for (const I of de) {
2921
2936
  const A = p(I), j = E.get(A) ?? 0;
2922
2937
  E.set(A, j + 1), (z.get(A) ?? 0) > 8 && j >= 6 && !d.has(I) && x.set(A, (x.get(A) ?? 0) + 1);
2923
2938
  }
2924
2939
  const q = /* @__PURE__ */ new Map(), at = /* @__PURE__ */ new Set(), Pe = [], lt = [];
2925
- for (const I of ue) {
2940
+ for (const I of de) {
2926
2941
  const A = p(I), j = z.get(A) ?? 0, dt = q.get(A) ?? 0;
2927
2942
  if (q.set(A, dt + 1), j > 8 && dt >= 6 && !d.has(I)) {
2928
2943
  at.has(A) || (Pe.push([`… ${x.get(A) ?? 0} similar siblings omitted`]), at.add(A));
@@ -2935,15 +2950,15 @@ function jn(t, e) {
2935
2950
  if (R.shadowRoot)
2936
2951
  for (const I of Array.from(R.shadowRoot.children))
2937
2952
  I instanceof HTMLElement && Ue.push(v(I, ee + 1));
2938
- const de = [...lt, ...Ue], ve = O.length > 0 || ce || de.some((I) => I.hasUsefulContent), ct = Q(
2939
- [O, ...de.map((I) => I.textPreview)].filter(Boolean).join(" ")
2940
- ).slice(0, 180), ys = R.hasAttribute("contenteditable") && (O.length > 0 || !R.querySelector("[contenteditable]")), ut = c.some((I) => R.hasAttribute(I)) || !!te || ys, De = (R.getClientRects().length > 0 || F.display === "contents") && (s.has(P) || ut || X) && (ve || X) && (!r.has(P) || ve || ut || X), qe = De ? 1 : 0, se = [];
2953
+ const pe = [...lt, ...Ue], ve = N.length > 0 || ue || pe.some((I) => I.hasUsefulContent), ct = Q(
2954
+ [N, ...pe.map((I) => I.textPreview)].filter(Boolean).join(" ")
2955
+ ).slice(0, 180), ys = R.hasAttribute("contenteditable") && (N.length > 0 || !R.querySelector("[contenteditable]")), ut = c.some((I) => R.hasAttribute(I)) || !!te || ys, De = (R.getClientRects().length > 0 || F.display === "contents") && (s.has(P) || ut || X) && (ve || X) && (!r.has(P) || ve || ut || X), qe = De ? 1 : 0, se = [];
2941
2956
  if (De) {
2942
- const I = de.some((j) => j.containsTextElement), A = n.has(P) && !I ? ct : O;
2957
+ const I = pe.some((j) => j.containsTextElement), A = n.has(P) && !I ? ct : N;
2943
2958
  se.push(Gt(R, l, o, A.slice(0, 180)));
2944
2959
  }
2945
2960
  for (const I of Pe)
2946
- se.push(...fe(I, qe));
2961
+ se.push(...me(I, qe));
2947
2962
  const Le = Ue.flatMap((I) => I.lines);
2948
2963
  if (Le.length > 0) {
2949
2964
  const I = Le.slice(0, 20);
@@ -2951,22 +2966,22 @@ function jn(t, e) {
2951
2966
  const A = P.includes("tooltip") || P.includes("popper") || P.includes("loader");
2952
2967
  if (ee < 2 && !A) {
2953
2968
  const j = De ? "#shadow-root" : `${P} #shadow-root`;
2954
- se.push(...fe([j, ...fe(I, 1)], qe));
2969
+ se.push(...me([j, ...me(I, 1)], qe));
2955
2970
  } else
2956
- se.push(...fe(I, qe));
2971
+ se.push(...me(I, qe));
2957
2972
  }
2958
2973
  return {
2959
2974
  lines: se,
2960
2975
  hasUsefulContent: ve,
2961
2976
  textPreview: ct,
2962
- containsTextElement: n.has(P) || de.some((I) => I.containsTextElement)
2977
+ containsTextElement: n.has(P) || pe.some((I) => I.containsTextElement)
2963
2978
  };
2964
2979
  };
2965
2980
  return [`--- ${S} ---`, ...v(T, 0).lines].join(`
2966
2981
  `);
2967
- }, m = [], k = Q(window.getSelection()?.toString() ?? "");
2968
- k && m.push(`--- selected text ---
2969
- ${JSON.stringify(k)}`), h.length > 0 && m.push(zn(h, s, l, o));
2982
+ }, m = [], C = Q(window.getSelection()?.toString() ?? "");
2983
+ C && m.push(`--- selected text ---
2984
+ ${JSON.stringify(C)}`), h.length > 0 && m.push(Vn(h, s, l, o));
2970
2985
  for (const T of t.slice(0, 3))
2971
2986
  m.push(g(T, "active overlay DOM", /* @__PURE__ */ new Set()));
2972
2987
  if (e && m.push(g(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
@@ -2981,7 +2996,7 @@ function Gt(t, e, s, n) {
2981
2996
  const r = t.tagName.toLowerCase();
2982
2997
  let i = r;
2983
2998
  const o = t.getAttribute("id");
2984
- o && Kn(o) && (i += `#${o}`);
2999
+ o && Xn(o) && (i += `#${o}`);
2985
3000
  for (const a of e) {
2986
3001
  const l = t.getAttribute(a);
2987
3002
  l && l.length <= 160 && (a !== "role" || !s.has(l)) && (i += `[${a}=${JSON.stringify(l)}]`);
@@ -2994,7 +3009,7 @@ function Gt(t, e, s, n) {
2994
3009
  t.hasAttribute(a) && (i += `[${a}]`);
2995
3010
  return `${i}${n ? ` ${JSON.stringify(n)}` : ""}`;
2996
3011
  }
2997
- function Fn() {
3012
+ function Gn() {
2998
3013
  const t = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), s = (a, l) => {
2999
3014
  if (!a)
3000
3015
  return;
@@ -3037,7 +3052,7 @@ function Fn() {
3037
3052
  priorityTargets: Array.from(e, ([a, l]) => ({ element: a, labels: Array.from(l) }))
3038
3053
  };
3039
3054
  }
3040
- function zn(t, e, s, n) {
3055
+ function Vn(t, e, s, n) {
3041
3056
  const r = ["--- active/current elements ---"];
3042
3057
  for (const i of t) {
3043
3058
  const o = [];
@@ -3062,7 +3077,7 @@ function zn(t, e, s, n) {
3062
3077
  function Ct(t) {
3063
3078
  return t instanceof HTMLElement ? t : t?.parentElement instanceof HTMLElement ? t.parentElement : null;
3064
3079
  }
3065
- function fe(t, e) {
3080
+ function me(t, e) {
3066
3081
  if (e === 0)
3067
3082
  return t;
3068
3083
  const s = " ".repeat(e);
@@ -3073,7 +3088,7 @@ function Vt(t) {
3073
3088
  Array.from(t.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
3074
3089
  );
3075
3090
  }
3076
- function Kn(t) {
3091
+ function Xn(t) {
3077
3092
  return t.length <= 64 && /^[A-Za-z_][A-Za-z0-9_:.-]*$/.test(t) && !/[a-f0-9]{12,}/i.test(t) && !/:r[0-9a-z]+:/i.test(t);
3078
3093
  }
3079
3094
  function Xt() {
@@ -3092,23 +3107,23 @@ function Xt() {
3092
3107
  },
3093
3108
  {
3094
3109
  name: "widget_root",
3095
- selector: zs,
3110
+ selector: Vs,
3096
3111
  description: "Finds Pluno's widget root inside the widget host shadow root."
3097
3112
  },
3098
3113
  {
3099
3114
  name: "widget_panel",
3100
- selector: Ks,
3115
+ selector: Xs,
3101
3116
  description: "Finds Pluno's open chat panel inside the widget host shadow root."
3102
3117
  },
3103
3118
  {
3104
3119
  name: "widget_timeline",
3105
- selector: Gs,
3120
+ selector: Js,
3106
3121
  description: "Finds Pluno's chat timeline inside the widget host shadow root."
3107
3122
  }
3108
3123
  ]
3109
3124
  };
3110
3125
  }
3111
- function Gn(t) {
3126
+ function Jn(t) {
3112
3127
  try {
3113
3128
  const e = JSON.parse(t);
3114
3129
  return e && typeof e == "object" ? e : { type: "error", message: "Invalid server event" };
@@ -3116,7 +3131,7 @@ function Gn(t) {
3116
3131
  return { type: "error", message: "Invalid server event" };
3117
3132
  }
3118
3133
  }
3119
- function Vn(t) {
3134
+ function Yn(t) {
3120
3135
  if (typeof t != "string")
3121
3136
  return null;
3122
3137
  try {
@@ -3132,10 +3147,10 @@ function bt(t, e) {
3132
3147
  const s = t[e];
3133
3148
  return Array.isArray(s) ? s.filter((n) => typeof n == "string" && n.trim().length > 0) : [];
3134
3149
  }
3135
- function Xn(t) {
3150
+ function Qn(t) {
3136
3151
  return Array.isArray(t) ? t.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
3137
3152
  }
3138
- function Jn(t) {
3153
+ function Zn(t) {
3139
3154
  if (!t || typeof t != "object")
3140
3155
  return null;
3141
3156
  const e = t, s = e.appearance, n = s && typeof s == "object" ? s : e, r = typeof n.accentColor == "string" ? n.accentColor : null, i = 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;
@@ -3146,13 +3161,13 @@ function Jn(t) {
3146
3161
  ...a !== null ? { scribbleStyle: a } : {}
3147
3162
  };
3148
3163
  }
3149
- function Yn(t) {
3164
+ function er(t) {
3150
3165
  if (!t || typeof t != "object")
3151
3166
  return null;
3152
3167
  const e = t.javascript;
3153
3168
  return typeof e != "string" || !e.trim() ? null : { javascript: e };
3154
3169
  }
3155
- function Qn(t, e) {
3170
+ function tr(t, e) {
3156
3171
  return e ? t && typeof t == "object" ? {
3157
3172
  ...t,
3158
3173
  helperError: e
@@ -3162,13 +3177,13 @@ function Qn(t, e) {
3162
3177
  helperError: e
3163
3178
  } : t;
3164
3179
  }
3165
- function Zn(t) {
3180
+ function sr(t) {
3166
3181
  if (!t || typeof t != "object")
3167
3182
  return t;
3168
3183
  const e = t;
3169
3184
  return typeof e.exception?.message == "string" ? e.exception.message : typeof e.error == "string" ? e.error : t;
3170
3185
  }
3171
- function er() {
3186
+ function nr() {
3172
3187
  const t = "pluno.productAgent.clientId", e = window.localStorage.getItem(t);
3173
3188
  if (e)
3174
3189
  return e;
@@ -3178,7 +3193,7 @@ function er() {
3178
3193
  function B() {
3179
3194
  return crypto.randomUUID();
3180
3195
  }
3181
- function tr(t) {
3196
+ function rr(t) {
3182
3197
  if (!t || typeof t != "object")
3183
3198
  return null;
3184
3199
  const e = t, s = typeof e.id == "string" ? e.id : null;
@@ -3194,7 +3209,7 @@ function _t(t, e) {
3194
3209
  t.map((s) => Jt(s, e)).filter((s) => s !== null)
3195
3210
  ) : [];
3196
3211
  }
3197
- function sr(t) {
3212
+ function ir(t) {
3198
3213
  return Array.isArray(t) ? t.flatMap((e) => {
3199
3214
  if (!e || typeof e != "object")
3200
3215
  return [];
@@ -3222,7 +3237,7 @@ function Jt(t, e) {
3222
3237
  if (!n || typeof n != "object")
3223
3238
  return null;
3224
3239
  const r = n;
3225
- if (r.hiddenFromTranscript === !0 || Cs(r) || r.type === "tab_lifecycle_decision" && r.decision === "keep")
3240
+ if (r.hiddenFromTranscript === !0 || Ps(r) || r.type === "tab_lifecycle_decision" && r.decision === "keep")
3226
3241
  return null;
3227
3242
  if (r.type === "message") {
3228
3243
  const i = r.role === "assistant" ? "assistant" : r.role === "user" ? "user" : "system", o = {
@@ -3230,13 +3245,13 @@ function Jt(t, e) {
3230
3245
  role: i,
3231
3246
  ...r.phase === "commentary" || r.phase === "final_answer" ? { phase: r.phase } : {},
3232
3247
  content: Es(
3233
- ur(r.content),
3248
+ hr(r.content),
3234
3249
  e
3235
3250
  ),
3236
3251
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
3237
3252
  ...D(r) !== null ? { causalSequence: D(r) } : {},
3238
- respondsToUserMessageId: N(r) ?? void 0,
3239
- ...C(r) ? { runId: C(r) } : {},
3253
+ respondsToUserMessageId: O(r) ?? void 0,
3254
+ ...k(r) ? { runId: k(r) } : {},
3240
3255
  attachments: os(r.attachments, e)
3241
3256
  };
3242
3257
  return i === "assistant" && typeof r.id == "string" && Object.defineProperty(o, "assistantDraftItemId", {
@@ -3248,67 +3263,81 @@ function Jt(t, e) {
3248
3263
  }), o;
3249
3264
  }
3250
3265
  if (r.type === "function_call_output") {
3251
- const i = Bs(r.output);
3252
- if (i)
3266
+ const i = Cs(r.output);
3267
+ if (i !== null)
3253
3268
  return {
3254
3269
  id: String(s.id ?? crypto.randomUUID()),
3255
3270
  role: "tool",
3256
3271
  content: "",
3257
3272
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
3258
- respondsToUserMessageId: N(r) ?? void 0,
3259
- ...C(r) ? { runId: C(r) } : {},
3273
+ respondsToUserMessageId: O(r) ?? void 0,
3274
+ ...k(r) ? { runId: k(r) } : {},
3275
+ dataType: "function_call_output",
3276
+ toolName: ks,
3277
+ callId: ae(r) ?? void 0,
3278
+ sharePromptAllowed: i
3279
+ };
3280
+ const o = $s(r.output);
3281
+ if (o)
3282
+ return {
3283
+ id: String(s.id ?? crypto.randomUUID()),
3284
+ role: "tool",
3285
+ content: "",
3286
+ createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
3287
+ respondsToUserMessageId: O(r) ?? void 0,
3288
+ ...k(r) ? { runId: k(r) } : {},
3260
3289
  dataType: "scheduled_check_in",
3261
3290
  toolName: Ht,
3262
- callId: me(r) ?? void 0,
3263
- scheduledCheckInAt: i
3291
+ callId: ae(r) ?? void 0,
3292
+ scheduledCheckInAt: o
3264
3293
  };
3265
- const o = rr(r.output), a = ir(r.output);
3266
- return o ? {
3294
+ const a = ar(r.output), l = lr(r.output);
3295
+ return a ? {
3267
3296
  id: String(s.id ?? crypto.randomUUID()),
3268
3297
  role: "tool",
3269
- content: `Connect ${o.appName} to continue`,
3298
+ content: `Connect ${a.appName} to continue`,
3270
3299
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
3271
3300
  ...D(r) !== null ? { causalSequence: D(r) } : {},
3272
- respondsToUserMessageId: N(r) ?? void 0,
3273
- ...C(r) ? { runId: C(r) } : {},
3301
+ respondsToUserMessageId: O(r) ?? void 0,
3302
+ ...k(r) ? { runId: k(r) } : {},
3274
3303
  dataType: "function_call_output",
3275
3304
  toolName: "authenticate_pipedream_app",
3276
- callId: me(r) ?? void 0,
3277
- integrationAuthRequest: o
3278
- } : a ? {
3305
+ callId: ae(r) ?? void 0,
3306
+ integrationAuthRequest: a
3307
+ } : l ? {
3279
3308
  id: String(s.id ?? crypto.randomUUID()),
3280
3309
  role: "tool",
3281
3310
  content: "Connect WhatsApp to continue",
3282
3311
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
3283
3312
  ...D(r) !== null ? { causalSequence: D(r) } : {},
3284
- respondsToUserMessageId: N(r) ?? void 0,
3285
- ...C(r) ? { runId: C(r) } : {},
3313
+ respondsToUserMessageId: O(r) ?? void 0,
3314
+ ...k(r) ? { runId: k(r) } : {},
3286
3315
  dataType: "function_call_output",
3287
3316
  toolName: "request_personal_channel_connection",
3288
- callId: me(r) ?? void 0,
3289
- personalChannelConnectionRequest: a
3317
+ callId: ae(r) ?? void 0,
3318
+ personalChannelConnectionRequest: l
3290
3319
  } : null;
3291
3320
  }
3292
3321
  return r.type === "function_call" || r.type === "tool_call" || r.type === "web_search_call" || r.type === "mcp_call" || r.type === "tab_lifecycle_decision" ? {
3293
3322
  id: String(s.id ?? crypto.randomUUID()),
3294
3323
  role: "tool",
3295
- content: r.type === "mcp_call" ? nr(r) : ar(r),
3324
+ content: r.type === "mcp_call" ? or(r) : ur(r),
3296
3325
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
3297
3326
  ...D(r) !== null ? { causalSequence: D(r) } : {},
3298
- respondsToUserMessageId: N(r) ?? void 0,
3299
- ...C(r) ? { runId: C(r) } : {},
3327
+ respondsToUserMessageId: O(r) ?? void 0,
3328
+ ...k(r) ? { runId: k(r) } : {},
3300
3329
  dataType: String(r.type),
3301
3330
  toolName: r.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof r.name == "string" ? r.name : void 0,
3302
- callId: me(r) ?? void 0,
3331
+ callId: ae(r) ?? void 0,
3303
3332
  loading: r.localExecutionStatus === "queued" || r.localExecutionStatus === "running" ? !0 : typeof r.localExecutionStatus == "string" ? !1 : void 0
3304
3333
  } : r.type === "run_status" || r.type === "run_error" ? r.type === "run_error" && r.stage === "tool_execution" ? null : {
3305
3334
  id: String(s.id ?? crypto.randomUUID()),
3306
3335
  role: "system",
3307
- content: or(r),
3336
+ content: cr(r),
3308
3337
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
3309
3338
  ...D(r) !== null ? { causalSequence: D(r) } : {},
3310
- respondsToUserMessageId: N(r) ?? void 0,
3311
- ...C(r) ? { runId: C(r) } : {},
3339
+ respondsToUserMessageId: O(r) ?? void 0,
3340
+ ...k(r) ? { runId: k(r) } : {},
3312
3341
  dataType: String(r.type),
3313
3342
  loading: r.type === "run_status" && (r.status === "running" || r.status === "retrying"),
3314
3343
  ...r.type === "run_status" && r.status === "steered" ? { steered: !0 } : {},
@@ -3316,11 +3345,11 @@ function Jt(t, e) {
3316
3345
  ...typeof r.securitySettingsUrl == "string" ? { securitySettingsUrl: r.securitySettingsUrl } : {}
3317
3346
  } : null;
3318
3347
  }
3319
- function nr(t) {
3348
+ function or(t) {
3320
3349
  const s = (typeof t.server_label == "string" ? t.server_label : "").replace(/^pipedream_/, "").split(/[_-]+/).filter(Boolean).map((n) => `${n.charAt(0).toUpperCase()}${n.slice(1)}`).join(" ");
3321
3350
  return s ? `🔌 Using ${s}` : "🔌 Using connected integration";
3322
3351
  }
3323
- function rr(t) {
3352
+ function ar(t) {
3324
3353
  if (typeof t != "string")
3325
3354
  return null;
3326
3355
  try {
@@ -3337,7 +3366,7 @@ function rr(t) {
3337
3366
  return null;
3338
3367
  }
3339
3368
  }
3340
- function ir(t) {
3369
+ function lr(t) {
3341
3370
  if (typeof t != "string")
3342
3371
  return null;
3343
3372
  try {
@@ -3352,10 +3381,10 @@ function ir(t) {
3352
3381
  return null;
3353
3382
  }
3354
3383
  }
3355
- function or(t) {
3384
+ function cr(t) {
3356
3385
  return t.type === "run_status" && t.status === "steered" ? "Steered" : typeof t.message == "string" && t.message.trim().length > 0 ? t.message : "";
3357
3386
  }
3358
- function ar(t) {
3387
+ function ur(t) {
3359
3388
  if (t.type === "web_search_call") {
3360
3389
  const e = t.action;
3361
3390
  if (e && typeof e == "object") {
@@ -3367,9 +3396,9 @@ function ar(t) {
3367
3396
  }
3368
3397
  return "🔎 Searching the web";
3369
3398
  }
3370
- return lr(t);
3399
+ return dr(t);
3371
3400
  }
3372
- function lr(t) {
3401
+ function dr(t) {
3373
3402
  if (typeof t.summary == "string" && t.summary.trim().length > 0)
3374
3403
  return Y(t.summary);
3375
3404
  if (typeof t.arguments == "string")
@@ -3386,7 +3415,7 @@ function Y(t) {
3386
3415
  const e = t.trim() || "Run tool", s = e.codePointAt(0) ?? 0;
3387
3416
  return s >= 126976 && s <= 129791 || s >= 9728 && s <= 10175 || s >= 127462 && s <= 127487 ? e : `🛠️ ${e}`;
3388
3417
  }
3389
- function cr(t) {
3418
+ function pr(t) {
3390
3419
  if (t == null)
3391
3420
  return t;
3392
3421
  if (typeof t != "object")
@@ -3401,14 +3430,14 @@ function cr(t) {
3401
3430
  runId: typeof e.runId == "string" ? e.runId : null
3402
3431
  };
3403
3432
  }
3404
- function me(t) {
3433
+ function ae(t) {
3405
3434
  const e = t.callId ?? t.call_id;
3406
3435
  return typeof e == "string" && e ? e : null;
3407
3436
  }
3408
3437
  function D(t) {
3409
3438
  return typeof t.causalSequence == "number" && Number.isSafeInteger(t.causalSequence) ? t.causalSequence : null;
3410
3439
  }
3411
- function ur(t) {
3440
+ function hr(t) {
3412
3441
  return typeof t == "string" ? t : Array.isArray(t) ? t.map((e) => {
3413
3442
  if (!e || typeof e != "object")
3414
3443
  return "";
@@ -3417,9 +3446,9 @@ function ur(t) {
3417
3446
  }).filter(Boolean).join("") : "";
3418
3447
  }
3419
3448
  function Ve(t, e) {
3420
- const s = Zt(t, e), n = mr(
3421
- dr(
3422
- wr(t, e),
3449
+ const s = Zt(t, e), n = Tr(
3450
+ gr(
3451
+ Rr(t, e),
3423
3452
  s
3424
3453
  ),
3425
3454
  s
@@ -3431,7 +3460,7 @@ function Ve(t, e) {
3431
3460
  const i = [...n];
3432
3461
  return i[r] = s, Ye(i);
3433
3462
  }
3434
- function dr(t, e) {
3463
+ function gr(t, e) {
3435
3464
  const s = e.assistantDraftItemId;
3436
3465
  return s ? t.map(
3437
3466
  (n) => n.dataType === "assistant_draft" && n.id === s ? e : n
@@ -3440,7 +3469,7 @@ function dr(t, e) {
3440
3469
  function je(t, e, s) {
3441
3470
  return e !== null ? t.respondsToUserMessageId === e : s !== null && t.runId === s;
3442
3471
  }
3443
- function pr(t, e, s, n) {
3472
+ function fr(t, e, s, n) {
3444
3473
  if (s === null) return t;
3445
3474
  let r = -1;
3446
3475
  for (let o = t.length - 1; o >= 0; o -= 1) {
@@ -3457,7 +3486,7 @@ function pr(t, e, s, n) {
3457
3486
  respondsToUserMessageId: s
3458
3487
  }, i;
3459
3488
  }
3460
- function hr(t, e) {
3489
+ function mr(t, e) {
3461
3490
  const s = t.findIndex(
3462
3491
  (r) => !r.id.startsWith("transient-activity:") && r.callId === e.callId
3463
3492
  );
@@ -3474,12 +3503,12 @@ function hr(t, e) {
3474
3503
  ...n[s].runId ? {} : { runId: e.runId }
3475
3504
  }, n;
3476
3505
  }
3477
- function gr(t, e, s) {
3506
+ function yr(t, e, s) {
3478
3507
  let n = !1;
3479
3508
  const r = t.map((i) => i.callId !== e || i.loading === s ? i : (n = !0, { ...i, loading: s }));
3480
3509
  return n ? r : t;
3481
3510
  }
3482
- function fr(t) {
3511
+ function Ir(t) {
3483
3512
  if (t.hiddenFromTranscript === !0)
3484
3513
  return null;
3485
3514
  const e = typeof t.callId == "string" ? t.callId : null, s = typeof t.toolName == "string" ? t.toolName : null;
@@ -3499,7 +3528,7 @@ function fr(t) {
3499
3528
  loading: !0
3500
3529
  };
3501
3530
  }
3502
- function mr(t, e) {
3531
+ function Tr(t, e) {
3503
3532
  if (e.id.startsWith("transient-activity:"))
3504
3533
  return t;
3505
3534
  const s = e.toolName === "tab_lifecycle";
@@ -3509,7 +3538,7 @@ function mr(t, e) {
3509
3538
  return r === -1 ? t : t.flatMap((i, o) => n(i) ? o === r ? [e] : [] : i.id === e.id ? [] : [i]);
3510
3539
  }
3511
3540
  function Yt(t, e) {
3512
- return bs(
3541
+ return Us(
3513
3542
  t,
3514
3543
  e.map(
3515
3544
  (s) => Zt(t, s)
@@ -3517,16 +3546,16 @@ function Yt(t, e) {
3517
3546
  Qt
3518
3547
  );
3519
3548
  }
3520
- function yr(t, e) {
3549
+ function Sr(t, e) {
3521
3550
  const s = new Map(t.map((n) => [n.id, n]));
3522
3551
  for (const n of e)
3523
3552
  s.set(n.id, n);
3524
3553
  return Yt(
3525
3554
  t,
3526
3555
  [...s.values()]
3527
- ).sort(Ir);
3556
+ ).sort(wr);
3528
3557
  }
3529
- function Ir(t, e) {
3558
+ function wr(t, e) {
3530
3559
  if ((t.respondsToUserMessageId !== void 0 && t.respondsToUserMessageId === e.respondsToUserMessageId || t.respondsToUserMessageId === void 0 && e.respondsToUserMessageId === void 0 && t.runId !== void 0 && t.runId === e.runId) && t.causalSequence !== void 0 && e.causalSequence !== void 0 && t.causalSequence !== e.causalSequence)
3531
3560
  return t.causalSequence - e.causalSequence;
3532
3561
  const n = Date.parse(t.createdAt) - Date.parse(e.createdAt);
@@ -3559,22 +3588,22 @@ function Zt(t, e) {
3559
3588
  if (!s?.attachments?.length)
3560
3589
  return e;
3561
3590
  const n = e.attachments.map((o) => {
3562
- const a = Tr(s.attachments ?? [], o);
3563
- return a ? Sr(o, a) : o;
3591
+ const a = Mr(s.attachments ?? [], o);
3592
+ return a ? Ar(o, a) : o;
3564
3593
  }), r = { ...e, attachments: n }, i = G(e);
3565
3594
  return i && Object.defineProperty(r, "clientMessageId", {
3566
3595
  value: i,
3567
3596
  enumerable: !1
3568
3597
  }), r;
3569
3598
  }
3570
- function Tr(t, e) {
3599
+ function Mr(t, e) {
3571
3600
  return e.id ? t.find((s) => s.id === e.id) ?? null : null;
3572
3601
  }
3573
- function Sr(t, e) {
3602
+ function Ar(t, e) {
3574
3603
  const { previewUrl: s } = e;
3575
3604
  return s ? { ...t, previewUrl: s } : t;
3576
3605
  }
3577
- function wr(t, e) {
3606
+ function Rr(t, e) {
3578
3607
  if (e.role !== "user")
3579
3608
  return t;
3580
3609
  const s = t.findIndex(
@@ -3625,7 +3654,7 @@ function Pt(t) {
3625
3654
  }
3626
3655
  return !1;
3627
3656
  }
3628
- function Mr(t, e, s) {
3657
+ function Er(t, e, s) {
3629
3658
  const n = new Set(
3630
3659
  t.filter(
3631
3660
  (r) => r.role === "user" && e !== null && G(r) === e
@@ -3645,7 +3674,7 @@ function Mr(t, e, s) {
3645
3674
  return !1;
3646
3675
  });
3647
3676
  }
3648
- function Ar(t) {
3677
+ function kr(t) {
3649
3678
  const e = ts(t);
3650
3679
  if (e === null)
3651
3680
  return t.some(H);
@@ -3677,7 +3706,7 @@ function Z(t) {
3677
3706
  }
3678
3707
  return null;
3679
3708
  }
3680
- function Rr(t) {
3709
+ function Cr(t) {
3681
3710
  const e = Z(t);
3682
3711
  if (e === null)
3683
3712
  return null;
@@ -3699,7 +3728,7 @@ function Ae(t) {
3699
3728
  function Ut(t) {
3700
3729
  return t?.type === "run_status" && t.status === "interrupted" && t.reason === "backend_restart";
3701
3730
  }
3702
- function Er(t, e) {
3731
+ function br(t, e) {
3703
3732
  const s = Z(e);
3704
3733
  if (s === null)
3705
3734
  return !1;
@@ -3724,7 +3753,7 @@ function Xe(t) {
3724
3753
  const r = n.clientMessageId;
3725
3754
  return typeof r == "string" ? r : null;
3726
3755
  }
3727
- function kr(t) {
3756
+ function _r(t) {
3728
3757
  const e = Z(t);
3729
3758
  if (e === null)
3730
3759
  return null;
@@ -3748,13 +3777,13 @@ function kr(t) {
3748
3777
  function Je(t, e) {
3749
3778
  if (typeof e.clientMessageId == "string")
3750
3779
  return e.clientMessageId;
3751
- const s = N(e);
3780
+ const s = O(e);
3752
3781
  if (!s)
3753
3782
  return null;
3754
3783
  const n = t.find((i) => M(i, "id") === s), r = U(n);
3755
3784
  return r?.type === "message" && r.role === "user" && typeof r.clientMessageId == "string" ? r.clientMessageId : null;
3756
3785
  }
3757
- function Cr(t, e) {
3786
+ function Pr(t, e) {
3758
3787
  let s = 0;
3759
3788
  for (const n of t) {
3760
3789
  if (!n || typeof n != "object")
@@ -3768,15 +3797,15 @@ function Cr(t, e) {
3768
3797
  return s;
3769
3798
  }
3770
3799
  function vt(t, e, s, n, r, i) {
3771
- if (!e || !_r(t))
3800
+ if (!e || !vr(t))
3772
3801
  return !1;
3773
3802
  const o = t;
3774
3803
  if (Ae(o) || s !== null && typeof o.id == "string" && o.id !== s)
3775
3804
  return !1;
3776
- const a = N(o);
3777
- return n !== null ? a !== null ? a === n : r !== null && C(o) === r && i === n : r === null || C(o) === r;
3805
+ const a = O(o);
3806
+ return n !== null ? a !== null ? a === n : r !== null && k(o) === r && i === n : r === null || k(o) === r;
3778
3807
  }
3779
- function br(t, e) {
3808
+ function Ur(t, e) {
3780
3809
  for (let s = e - 1; s >= 0; s -= 1) {
3781
3810
  const n = U(t[s]);
3782
3811
  if (n?.type === "message" && n.role === "user")
@@ -3790,7 +3819,7 @@ function ss(t, e) {
3790
3819
  return t[s].id;
3791
3820
  return null;
3792
3821
  }
3793
- function _r(t) {
3822
+ function vr(t) {
3794
3823
  if (!t || typeof t != "object")
3795
3824
  return !1;
3796
3825
  const e = t;
@@ -3799,22 +3828,22 @@ function _r(t) {
3799
3828
  function H(t) {
3800
3829
  return t.role === "assistant" && t.phase !== "commentary";
3801
3830
  }
3802
- function Pr(t) {
3831
+ function Dr(t) {
3803
3832
  if (!t || typeof t != "object")
3804
3833
  return !1;
3805
3834
  const e = t;
3806
3835
  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";
3807
3836
  }
3808
3837
  function Ye(t) {
3809
- return t.filter((e, s) => V(e) ? !Hr(t, s) && !ns(t, s) && !Br(t, s) && !Wr(t, s) : Ur(e) ? e.retryable === !0 && xr(t, s) ? !1 : !Nr(t, s) : !0);
3838
+ return t.filter((e, s) => V(e) ? !Fr(t, s) && !ns(t, s) && !$r(t, s) && !jr(t, s) : qr(e) ? e.retryable === !0 && Hr(t, s) ? !1 : !Wr(t, s) : !0);
3810
3839
  }
3811
- function Ur(t) {
3840
+ function qr(t) {
3812
3841
  return t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.steered !== !0);
3813
3842
  }
3814
3843
  function V(t) {
3815
3844
  return t.role === "system" && t.dataType === "run_status" && t.loading === !0;
3816
3845
  }
3817
- function vr(t, e, s, n) {
3846
+ function Lr(t, e, s, n) {
3818
3847
  const r = t.findIndex(
3819
3848
  (l, c) => V(l) && !ns(t, c)
3820
3849
  ), i = r === -1 ? null : t[r], o = e ?? i?.respondsToUserMessageId ?? null, a = o ? t.find(
@@ -3829,7 +3858,7 @@ function vr(t, e, s, n) {
3829
3858
  function Se(t) {
3830
3859
  return t?.type === "run_status" && t.status === "stopped";
3831
3860
  }
3832
- function Dr(t, e) {
3861
+ function Or(t, e) {
3833
3862
  return H(e) ? "completed" : Se(t) ? "stopped" : !Ae(t) && (t?.type === "run_error" || t?.type === "run_status" && (t.status === "failed" || t.status === "interrupted")) ? "failed" : null;
3834
3863
  }
3835
3864
  function Dt(t, e, s) {
@@ -3844,16 +3873,16 @@ function Dt(t, e, s) {
3844
3873
  }
3845
3874
  function ns(t, e) {
3846
3875
  return t.some(
3847
- (s, n) => n !== e && s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.loading !== !0 && s.steered !== !0) && qr(
3876
+ (s, n) => n !== e && s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.loading !== !0 && s.steered !== !0) && Nr(
3848
3877
  t,
3849
3878
  e,
3850
3879
  n
3851
3880
  )
3852
3881
  );
3853
3882
  }
3854
- function qr(t, e, s) {
3883
+ function Nr(t, e, s) {
3855
3884
  const n = t[e], r = t[s];
3856
- if (le(n, r))
3885
+ if (ce(n, r))
3857
3886
  return !0;
3858
3887
  if (!n.respondsToUserMessageId || r.respondsToUserMessageId || !n.runId || n.runId !== r.runId)
3859
3888
  return !1;
@@ -3862,9 +3891,9 @@ function qr(t, e, s) {
3862
3891
  return t[i].id === n.respondsToUserMessageId;
3863
3892
  return !1;
3864
3893
  }
3865
- function Lr(t, e) {
3894
+ function xr(t, e) {
3866
3895
  const s = [...t].reverse().find(
3867
- (n) => n.respondsToUserMessageId !== void 0 && n.respondsToUserMessageId !== e && qt(n) && !Or(
3896
+ (n) => n.respondsToUserMessageId !== void 0 && n.respondsToUserMessageId !== e && qt(n) && !Br(
3868
3897
  t,
3869
3898
  n.respondsToUserMessageId
3870
3899
  )
@@ -3876,21 +3905,21 @@ function Lr(t, e) {
3876
3905
  function qt(t) {
3877
3906
  return t.role === "tool" || V(t) ? !0 : t.role === "assistant" && t.phase === "commentary";
3878
3907
  }
3879
- function Or(t, e) {
3908
+ function Br(t, e) {
3880
3909
  return t.some(
3881
3910
  (s) => s.respondsToUserMessageId === e && (H(s) || s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.loading !== !0))
3882
3911
  );
3883
3912
  }
3884
- function Nr(t, e) {
3913
+ function Wr(t, e) {
3885
3914
  const s = t[e];
3886
3915
  for (let n = e + 1; n < t.length; n += 1) {
3887
3916
  const r = t[n];
3888
- if (r.role === "assistant" && le(s, r))
3917
+ if (r.role === "assistant" && ce(s, r))
3889
3918
  return !0;
3890
3919
  }
3891
3920
  return !1;
3892
3921
  }
3893
- function xr(t, e) {
3922
+ function Hr(t, e) {
3894
3923
  const s = t[e];
3895
3924
  if (!s.respondsToUserMessageId)
3896
3925
  return !1;
@@ -3903,32 +3932,32 @@ function xr(t, e) {
3903
3932
  }
3904
3933
  return !1;
3905
3934
  }
3906
- function Br(t, e) {
3935
+ function $r(t, e) {
3907
3936
  const s = t[e];
3908
3937
  return t.some(
3909
- (n, r) => r !== e && n.role === "assistant" && le(s, n)
3938
+ (n, r) => r !== e && n.role === "assistant" && ce(s, n)
3910
3939
  );
3911
3940
  }
3912
- function Wr(t, e) {
3941
+ function jr(t, e) {
3913
3942
  const s = t[e];
3914
3943
  return t.some(
3915
- (n, r) => r !== e && n.role === "tool" && le(s, n)
3944
+ (n, r) => r !== e && n.role === "tool" && ce(s, n)
3916
3945
  );
3917
3946
  }
3918
- function Hr(t, e) {
3947
+ function Fr(t, e) {
3919
3948
  const s = t[e];
3920
3949
  for (let n = e + 1; n < t.length; n += 1)
3921
- if (V(t[n]) && le(s, t[n]))
3950
+ if (V(t[n]) && ce(s, t[n]))
3922
3951
  return !0;
3923
3952
  return !1;
3924
3953
  }
3925
- function le(t, e) {
3954
+ function ce(t, e) {
3926
3955
  return !!(t.respondsToUserMessageId && t.respondsToUserMessageId === e.respondsToUserMessageId);
3927
3956
  }
3928
3957
  function M(t, e) {
3929
3958
  return t && typeof t == "object" && typeof t[e] == "string" ? t[e] : null;
3930
3959
  }
3931
- function $r(t, e) {
3960
+ function zr(t, e) {
3932
3961
  try {
3933
3962
  const s = window.localStorage.getItem(`${Ft}${t}`);
3934
3963
  if (!s)
@@ -3936,7 +3965,7 @@ function $r(t, e) {
3936
3965
  const n = JSON.parse(s), r = typeof n.sessionId == "string" ? n.sessionId : null;
3937
3966
  if (e !== void 0 && r !== e)
3938
3967
  return null;
3939
- const i = Array.isArray(n.messages) ? n.messages.map(Zr).filter((o) => !!o) : [];
3968
+ const i = Array.isArray(n.messages) ? n.messages.map(si).filter((o) => !!o) : [];
3940
3969
  return {
3941
3970
  sessionId: r,
3942
3971
  messages: i
@@ -3948,20 +3977,20 @@ function $r(t, e) {
3948
3977
  function rs(t) {
3949
3978
  return t.role === "user" || t.role === "assistant" || t.dataType === "run_status" || t.dataType === "run_error";
3950
3979
  }
3951
- function jr(t, e) {
3980
+ function Kr(t, e) {
3952
3981
  try {
3953
3982
  window.localStorage.setItem(
3954
3983
  `${Ft}${t}`,
3955
3984
  JSON.stringify({
3956
3985
  sessionId: e.sessionId,
3957
- messages: e.messages.filter(rs).slice(-hn).map(ei)
3986
+ messages: e.messages.filter(rs).slice(-mn).map(ni)
3958
3987
  })
3959
3988
  );
3960
3989
  } catch {
3961
3990
  return;
3962
3991
  }
3963
3992
  }
3964
- function Fr(t) {
3993
+ function Gr(t) {
3965
3994
  try {
3966
3995
  const e = window.localStorage.getItem(`${Ge}${t}`);
3967
3996
  if (!e)
@@ -4012,19 +4041,19 @@ function Lt(t, e) {
4012
4041
  }
4013
4042
  is(t, e);
4014
4043
  }
4015
- function zr(t) {
4044
+ function Vr(t) {
4016
4045
  try {
4017
4046
  const e = `${Ce}${t}`, s = window.sessionStorage.getItem(e);
4018
4047
  if (window.sessionStorage.removeItem(e), !s)
4019
4048
  return [];
4020
4049
  const n = JSON.parse(s);
4021
- return Array.isArray(n) ? n.flatMap((r) => Gr(r) ? [{
4050
+ return Array.isArray(n) ? n.flatMap((r) => Jr(r) ? [{
4022
4051
  ...r.event,
4023
4052
  page: b(),
4024
4053
  rawOutput: {
4025
4054
  pageContextRestarted: !0,
4026
4055
  outcome: "unknown",
4027
- message: Kr(location.href),
4056
+ message: Xr(location.href),
4028
4057
  currentUrl: location.href,
4029
4058
  console: [],
4030
4059
  metadata: {
@@ -4041,17 +4070,17 @@ function zr(t) {
4041
4070
  return [];
4042
4071
  }
4043
4072
  }
4044
- function Kr(t) {
4073
+ function Xr(t) {
4045
4074
  return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
4046
4075
  Current URL: ${t}`;
4047
4076
  }
4048
- function Gr(t) {
4077
+ function Jr(t) {
4049
4078
  if (!t || typeof t != "object")
4050
4079
  return !1;
4051
4080
  const e = t, s = e.event;
4052
4081
  return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" && it(s) && s.type === "tool.result";
4053
4082
  }
4054
- function Vr(t, e) {
4083
+ function Yr(t, e) {
4055
4084
  const s = new Set(
4056
4085
  t.flatMap((n) => n.type === "tool.result" ? [n.callId] : [])
4057
4086
  );
@@ -4060,7 +4089,7 @@ function Vr(t, e) {
4060
4089
  ...e.filter((n) => !s.has(n.callId))
4061
4090
  ];
4062
4091
  }
4063
- function Xr(t) {
4092
+ function Qr(t) {
4064
4093
  try {
4065
4094
  window.sessionStorage.removeItem(`${Ce}${t}`);
4066
4095
  } catch {
@@ -4097,9 +4126,9 @@ function as(t, e) {
4097
4126
  } : t;
4098
4127
  }
4099
4128
  function Qe(t) {
4100
- return t.type || Qr(t.name) || "application/octet-stream";
4129
+ return t.type || ti(t.name) || "application/octet-stream";
4101
4130
  }
4102
- function Jr(t) {
4131
+ function Zr(t) {
4103
4132
  ls({
4104
4133
  name: t.name,
4105
4134
  mimeType: Qe(t),
@@ -4107,21 +4136,21 @@ function Jr(t) {
4107
4136
  });
4108
4137
  }
4109
4138
  function ls(t) {
4110
- const e = Yr(t.name), s = t.mimeType.trim().toLowerCase();
4111
- if (!un.has(`${e}:${s}`))
4139
+ const e = ei(t.name), s = t.mimeType.trim().toLowerCase();
4140
+ if (!hn.has(`${e}:${s}`))
4112
4141
  throw new Error("This attachment type is not supported by the embedded model provider");
4113
4142
  if (t.sizeBytes <= 0 || t.sizeBytes >= $t)
4114
4143
  throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
4115
4144
  }
4116
- function Yr(t) {
4145
+ function ei(t) {
4117
4146
  const e = t.trim().toLowerCase(), s = e.lastIndexOf(".");
4118
4147
  return s >= 0 ? e.slice(s) : "";
4119
4148
  }
4120
- function Qr(t) {
4149
+ function ti(t) {
4121
4150
  const e = t.toLowerCase();
4122
4151
  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;
4123
4152
  }
4124
- function Zr(t) {
4153
+ function si(t) {
4125
4154
  if (!t || typeof t != "object")
4126
4155
  return null;
4127
4156
  const e = t;
@@ -4142,7 +4171,7 @@ function Zr(t) {
4142
4171
  loading: typeof e.loading == "boolean" ? e.loading : void 0
4143
4172
  };
4144
4173
  }
4145
- function ei(t) {
4174
+ function ni(t) {
4146
4175
  return t.attachments?.length ? {
4147
4176
  ...t,
4148
4177
  attachments: t.attachments.map(Re)
@@ -4158,17 +4187,17 @@ function Re(t) {
4158
4187
  } = t;
4159
4188
  return i;
4160
4189
  }
4161
- function N(t) {
4190
+ function O(t) {
4162
4191
  const e = t.respondsToUserMessageId;
4163
4192
  return typeof e == "string" && e ? e : null;
4164
4193
  }
4165
- function C(t) {
4194
+ function k(t) {
4166
4195
  const e = t.runId;
4167
4196
  return typeof e == "string" && e ? e : null;
4168
4197
  }
4169
- function ti(t) {
4198
+ function ri(t) {
4170
4199
  const e = t?.timeoutMs;
4171
- return !!t && typeof t == "object" && typeof t.summary == "string" && typeof t.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <= wn);
4200
+ return !!t && typeof t == "object" && typeof t.summary == "string" && typeof t.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <= Rn);
4172
4201
  }
4173
4202
  function cs(t) {
4174
4203
  const e = {};
@@ -4182,22 +4211,22 @@ function cs(t) {
4182
4211
  return e;
4183
4212
  }
4184
4213
  function ot(t, e) {
4185
- return fs(t) ? _e : W(ke(e), dn);
4214
+ return fs(t) ? _e : W(ke(e), gn);
4186
4215
  }
4187
- function si(t, e) {
4216
+ function ii(t, e) {
4188
4217
  return typeof t == "string" ? t : t instanceof URL ? t.toString() : e?.url ?? "";
4189
4218
  }
4190
- async function ni(t, e, s, n) {
4219
+ async function oi(t, e, s, n) {
4191
4220
  const r = cs(t.headers);
4192
4221
  n({
4193
4222
  ...e,
4194
4223
  responseStatus: t.status,
4195
4224
  responseHeaders: r,
4196
- responseBody: await ri(t),
4225
+ responseBody: await ai(t),
4197
4226
  durationMs: Date.now() - s
4198
4227
  });
4199
4228
  }
4200
- async function ri(t) {
4229
+ async function ai(t) {
4201
4230
  if (!us(t.headers))
4202
4231
  return;
4203
4232
  let e = null, s = null;
@@ -4207,7 +4236,7 @@ async function ri(t) {
4207
4236
  const n = new Promise((a) => {
4208
4237
  s = window.setTimeout(() => {
4209
4238
  e?.cancel(), a("timeout");
4210
- }, pn);
4239
+ }, fn);
4211
4240
  }), r = new TextDecoder();
4212
4241
  let i = "", o = 0;
4213
4242
  for (; ; ) {
@@ -4229,7 +4258,7 @@ async function ri(t) {
4229
4258
  s !== null && window.clearTimeout(s);
4230
4259
  }
4231
4260
  }
4232
- function ii(t, e) {
4261
+ function li(t, e) {
4233
4262
  if (us(new Headers(e)))
4234
4263
  try {
4235
4264
  return t.responseType === "" || t.responseType === "text" ? W(t.responseText ?? "") : void 0;
@@ -4241,7 +4270,7 @@ function Nt(t) {
4241
4270
  if (typeof t == "string")
4242
4271
  return W(t);
4243
4272
  }
4244
- function oi(t) {
4273
+ function ci(t) {
4245
4274
  return L({
4246
4275
  ...t,
4247
4276
  requestBody: xt(t.requestBody),
@@ -4267,7 +4296,7 @@ function us(t) {
4267
4296
  return s !== null && Number.isInteger(n) && n >= 0 && n <= st && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
4268
4297
  }
4269
4298
  function J(t, e = {}, s) {
4270
- if (li(s))
4299
+ if (di(s))
4271
4300
  return !0;
4272
4301
  const n = Object.entries(e).find(([r]) => r.toLowerCase() === "content-type")?.[1]?.toLowerCase();
4273
4302
  if (n?.includes("multipart/form-data") || n?.includes("application/octet-stream"))
@@ -4282,7 +4311,7 @@ function J(t, e = {}, s) {
4282
4311
  return !0;
4283
4312
  }
4284
4313
  }
4285
- function ai(t, e) {
4314
+ function ui(t, e) {
4286
4315
  if (J(t))
4287
4316
  return !0;
4288
4317
  try {
@@ -4292,10 +4321,10 @@ function ai(t, e) {
4292
4321
  return !0;
4293
4322
  }
4294
4323
  }
4295
- function li(t) {
4324
+ function di(t) {
4296
4325
  return t instanceof FormData || t instanceof Blob || t instanceof ArrayBuffer || ArrayBuffer.isView(t) || typeof ReadableStream < "u" && t instanceof ReadableStream;
4297
4326
  }
4298
- function ci(t) {
4327
+ function pi(t) {
4299
4328
  const e = {};
4300
4329
  for (const s of t.trim().split(/[\r\n]+/)) {
4301
4330
  const n = s.indexOf(":");
@@ -4326,27 +4355,27 @@ async function ye(t, e) {
4326
4355
  try {
4327
4356
  return await t();
4328
4357
  } catch (r) {
4329
- if (s = r, n >= At - 1 || !di(r))
4358
+ if (s = r, n >= At - 1 || !gi(r))
4330
4359
  throw r;
4331
- await ui(n);
4360
+ await hi(n);
4332
4361
  }
4333
4362
  throw s instanceof Error ? s : new Error(e);
4334
4363
  }
4335
- function ui(t) {
4364
+ function hi(t) {
4336
4365
  return new Promise((e) => {
4337
- window.setTimeout(e, cn[t] ?? 0);
4366
+ window.setTimeout(e, pn[t] ?? 0);
4338
4367
  });
4339
4368
  }
4340
- function di(t) {
4341
- return t instanceof we ? pi(t.status) : t instanceof TypeError;
4369
+ function gi(t) {
4370
+ return t instanceof we ? fi(t.status) : t instanceof TypeError;
4342
4371
  }
4343
- function pi(t) {
4372
+ function fi(t) {
4344
4373
  return t === 408 || t === 409 || t === 429 || t >= 500;
4345
4374
  }
4346
- function hi(t) {
4375
+ function mi(t) {
4347
4376
  return t === 401 || t === 403;
4348
4377
  }
4349
- const _e = "[REDACTED_SECRET]", $ = "[REDACTED_TOKEN]", gi = "[REDACTED_SIGNED_URL]", fi = 20, mi = /^(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, ds = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, ps = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, hs = /\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, yi = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Ii = /\bhttps?:\/\/[^\s"'<>]+/gi, Ti = /[),.;\]]+$/;
4378
+ const _e = "[REDACTED_SECRET]", $ = "[REDACTED_TOKEN]", yi = "[REDACTED_SIGNED_URL]", Ii = 20, Ti = /^(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|token|api_key|apiKey|apikey|key|secret|signature|sig|password|passwd|pwd|code|state|session|jwt|csrf|csrfToken|xsrf|xsrfToken)$/i, ds = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, ps = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, hs = /\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, Si = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, wi = /\bhttps?:\/\/[^\s"'<>]+/gi, Mi = /[),.;\]]+$/;
4350
4379
  function L(t) {
4351
4380
  return Ee(t, 0, /* @__PURE__ */ new WeakSet());
4352
4381
  }
@@ -4355,7 +4384,7 @@ function Ee(t, e, s) {
4355
4384
  return t.startsWith("data:image/") || t.startsWith("data:application/pdf;") ? t : ke(t);
4356
4385
  if (t === null || typeof t != "object")
4357
4386
  return t;
4358
- if (e >= fi)
4387
+ if (e >= Ii)
4359
4388
  return "[REDACTED_MAX_DEPTH]";
4360
4389
  if (s.has(t))
4361
4390
  return "[REDACTED_CIRCULAR]";
@@ -4363,46 +4392,46 @@ function Ee(t, e, s) {
4363
4392
  return t.map((r) => Ee(r, e + 1, s));
4364
4393
  const n = {};
4365
4394
  for (const [r, i] of Object.entries(t))
4366
- r === "pageContent" ? n[r] = i : fs(r) ? n[r] = _e : n[r] = r.toLowerCase() === "url" ? Si(i) : Ee(i, e + 1, s);
4395
+ r === "pageContent" ? n[r] = i : fs(r) ? n[r] = _e : n[r] = r.toLowerCase() === "url" ? Ai(i) : Ee(i, e + 1, s);
4367
4396
  return n;
4368
4397
  }
4369
4398
  function fs(t) {
4370
4399
  const e = t.replace(/[^a-z0-9]/gi, "").toLowerCase();
4371
4400
  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");
4372
4401
  }
4373
- function Si(t) {
4402
+ function Ai(t) {
4374
4403
  return typeof t == "string" ? ms(t) : Ee(t, 0, /* @__PURE__ */ new WeakSet());
4375
4404
  }
4376
4405
  function ms(t) {
4377
4406
  try {
4378
4407
  const e = new URL(t, location.href);
4379
4408
  for (const s of Array.from(e.searchParams.keys()))
4380
- mi.test(s) && e.searchParams.set(s, $);
4409
+ Ti.test(s) && e.searchParams.set(s, $);
4381
4410
  return e.username && (e.username = $), e.password && (e.password = $), e.toString();
4382
4411
  } catch {
4383
- return wi(t);
4412
+ return Ri(t);
4384
4413
  }
4385
4414
  }
4386
4415
  function ke(t) {
4387
- return t.replace(yi, gi).replace(Ii, Mi).replace(ds, `Bearer ${$}`).replace(ps, `Basic ${$}`).replace(hs, $).replace(gs, (e, s) => `${s}: ${_e}`);
4416
+ return t.replace(Si, yi).replace(wi, Ei).replace(ds, `Bearer ${$}`).replace(ps, `Basic ${$}`).replace(hs, $).replace(gs, (e, s) => `${s}: ${_e}`);
4388
4417
  }
4389
- function wi(t) {
4418
+ function Ri(t) {
4390
4419
  return t.replace(ds, `Bearer ${$}`).replace(ps, `Basic ${$}`).replace(hs, $).replace(gs, (e, s) => `${s}: ${_e}`);
4391
4420
  }
4392
- function Mi(t) {
4393
- const e = t.match(Ti)?.[0] ?? "", s = e ? t.slice(0, -e.length) : t;
4421
+ function Ei(t) {
4422
+ const e = t.match(Mi)?.[0] ?? "", s = e ? t.slice(0, -e.length) : t;
4394
4423
  return `${ms(s)}${e}`;
4395
4424
  }
4396
4425
  export {
4397
4426
  ht as PLUNO_PRODUCT_AGENT_SDK_PREVIEW_HOST_SELECTOR,
4398
4427
  Ke as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
4399
- Ks as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
4400
- zs as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
4401
- Gs as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
4402
- Ai as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
4428
+ Xs as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
4429
+ Vs as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
4430
+ Js as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
4431
+ ki as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
4403
4432
  zt as PlunoProductAgent,
4404
- fn as calculateReconnectDelay,
4433
+ In as calculateReconnectDelay,
4405
4434
  zt as default,
4406
- Nn as getProductAgentOriginAccessErrorMessage,
4407
- Jr as validateProductAgentProviderInputFile
4435
+ Wn as getProductAgentOriginAccessErrorMessage,
4436
+ Zr as validateProductAgentProviderInputFile
4408
4437
  };