@pluno/product-agent-web 0.1.150 → 0.1.152

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  const Qe = "pluno-product-agent-attachments";
2
- const Ut = "files";
2
+ const Pt = "files";
3
3
  async function ts(e) {
4
4
  const t = await Ft();
5
5
  await ns(t, "readwrite", (s) => s.put(e));
@@ -27,7 +27,7 @@ function Ft() {
27
27
  return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((e, t) => {
28
28
  const s = indexedDB.open(Qe, 1);
29
29
  s.onupgradeneeded = () => {
30
- const r = s.result.createObjectStore(Ut, { keyPath: "attachmentId" });
30
+ const r = s.result.createObjectStore(Pt, { keyPath: "attachmentId" });
31
31
  r.createIndex("lastUsedAt", "lastUsedAt", { unique: !1 }), r.createIndex("sessionId", "sessionId", { unique: !1 }), r.createIndex("origin", "origin", { unique: !1 });
32
32
  }, s.onsuccess = () => e(s.result), s.onerror = () => t(s.error ?? new Error("Failed to open Product Agent attachment storage"));
33
33
  });
@@ -37,7 +37,7 @@ async function ns(e, t, s) {
37
37
  }
38
38
  function Ht(e, t, s) {
39
39
  return new Promise((n, r) => {
40
- const i = e.transaction(Ut, t), o = i.objectStore(Ut);
40
+ const i = e.transaction(Pt, t), o = i.objectStore(Pt);
41
41
  let a, c = !1;
42
42
  s(o).then((l) => {
43
43
  a = l;
@@ -65,7 +65,7 @@ function Wt(e) {
65
65
  function rs(e) {
66
66
  return e !== null && (typeof e == "object" || typeof e == "function");
67
67
  }
68
- function Re(e, t, s) {
68
+ function be(e, t, s) {
69
69
  const n = Reflect.get(e, "pluno"), r = rs(n) ? n : {};
70
70
  if (r !== n && !Reflect.set(e, "pluno", r))
71
71
  return null;
@@ -114,7 +114,7 @@ function as(e, t, s) {
114
114
  for (const u of e) {
115
115
  const d = s(u);
116
116
  let p = o.get(d.id);
117
- if (d.isOptimistic && d.optimisticKey ? p = a.get(d.optimisticKey) : d.isAssistantDraft && d.assistantDraftKey ? p = c.get(d.assistantDraftKey) : d.isActivity && (p = d.activityKeys?.map((b) => l.get(b)).find((b) => b !== void 0) ?? p), p && !I.has(p)) {
117
+ if (d.isOptimistic && d.optimisticKey ? p = a.get(d.optimisticKey) : d.isAssistantDraft && d.assistantDraftKey ? p = c.get(d.assistantDraftKey) : d.isActivity && (p = d.activityKeys?.map((E) => l.get(E)).find((E) => E !== void 0) ?? p), p && !I.has(p)) {
118
118
  g.push(p), I.add(p);
119
119
  continue;
120
120
  }
@@ -133,8 +133,8 @@ function cs(e, t, s, n) {
133
133
  }
134
134
  const St = "pluno.productAgent.transportId", ls = "pluno.productAgent.transportIdentity", At = "pluno.productAgent.transportIdentity.event", us = 50, ds = globalThis.setTimeout.bind(globalThis);
135
135
  let W = null;
136
- const et = /* @__PURE__ */ new Set(), bt = /* @__PURE__ */ new Map();
137
- async function hs(e = ke()) {
136
+ const et = /* @__PURE__ */ new Set(), Et = /* @__PURE__ */ new Map();
137
+ async function hs(e = Me()) {
138
138
  const t = e.randomUUID(), s = e.storage.getItem(St);
139
139
  let n = s ?? e.randomUUID(), r = !1, i = !1;
140
140
  const o = e.channel.subscribe((c) => {
@@ -171,7 +171,7 @@ async function hs(e = ke()) {
171
171
  };
172
172
  }
173
173
  async function ps() {
174
- W || (W = hs(ke()), W.then((n) => {
174
+ W || (W = hs(Me()), W.then((n) => {
175
175
  const r = (i) => {
176
176
  i.persisted || (n.release(), W = null, et.clear(), window.removeEventListener("pagehide", r));
177
177
  };
@@ -194,7 +194,7 @@ function fs() {
194
194
  e += 1;
195
195
  return e;
196
196
  }
197
- function ke() {
197
+ function Me() {
198
198
  return {
199
199
  storage: gs(),
200
200
  channel: ms(),
@@ -206,13 +206,13 @@ function gs() {
206
206
  return {
207
207
  getItem: (e) => {
208
208
  try {
209
- return window.sessionStorage?.getItem(e) ?? bt.get(e) ?? null;
209
+ return window.sessionStorage?.getItem(e) ?? Et.get(e) ?? null;
210
210
  } catch {
211
- return bt.get(e) ?? null;
211
+ return Et.get(e) ?? null;
212
212
  }
213
213
  },
214
214
  setItem: (e, t) => {
215
- bt.set(e, t);
215
+ Et.set(e, t);
216
216
  try {
217
217
  window.sessionStorage?.setItem(e, t);
218
218
  } catch {
@@ -255,7 +255,7 @@ function ys() {
255
255
  }
256
256
  };
257
257
  }
258
- const Me = "schedule_follow_up";
258
+ const ke = "schedule_follow_up";
259
259
  function Is(e) {
260
260
  let t = e;
261
261
  if (typeof t == "string")
@@ -267,10 +267,10 @@ function Is(e) {
267
267
  if (!t || typeof t != "object")
268
268
  return null;
269
269
  const s = t;
270
- return s.ok !== !0 || s.toolName !== Me || typeof s.dueAt != "string" || Number.isNaN(Date.parse(s.dueAt)) ? null : s.dueAt;
270
+ return s.ok !== !0 || s.toolName !== ke || typeof s.dueAt != "string" || Number.isNaN(Date.parse(s.dueAt)) ? null : s.dueAt;
271
271
  }
272
272
  const Ts = globalThis.fetch.bind(globalThis), Dt = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', ws = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Ss = ".pluno-pa-widget__panel", As = ".pluno-pa-widget__timeline", ie = `${Dt}[data-pluno-sdk-preview-channel]`;
273
- let bs = 0;
273
+ let Es = 0;
274
274
  function oe(e) {
275
275
  const t = {};
276
276
  for (const i of ["type", "requestId", "clientMessageId", "sessionId", "runId", "itemId", "reason", "phase"]) {
@@ -284,7 +284,7 @@ function oe(e) {
284
284
  const r = e.attachments;
285
285
  return Array.isArray(r) && (t.attachmentCount = r.length), t;
286
286
  }
287
- function Et(e, t, s) {
287
+ function Rt(e, t, s) {
288
288
  if (typeof window > "u")
289
289
  return;
290
290
  const n = window.__PLUNO_PRODUCT_AGENT_TRACE_ID__;
@@ -296,25 +296,25 @@ function Et(e, t, s) {
296
296
  source: "web_sdk",
297
297
  category: e,
298
298
  name: t,
299
- sequence: ++bs,
299
+ sequence: ++Es,
300
300
  wallTime: (/* @__PURE__ */ new Date()).toISOString(),
301
301
  monotonicMs: performance.now(),
302
302
  data: s
303
303
  };
304
304
  window.dispatchEvent(new CustomEvent("product-agent:trace", { detail: r }));
305
305
  }
306
- const Es = "https://app.pluno.ai", Rs = "gpt-5.6-terra", ks = 2e4, Ms = 1e4, _s = 1e4, Cs = 1e4, Ps = 1e4, Us = 1e3, ae = 3e4, ce = 0.2, le = 6e4, Ds = 15e3, V = 8, Os = 15e3, Ns = 2e3, vs = 1e3, xs = 100, ue = 8e3, de = 3, Ls = [300, 1e3], $t = 64e3, Rt = 4e3, jt = 30, qs = 2e3, Bs = 1e3, _e = "Image is too large for model vision input.", Fs = 100, Ce = "pluno.productAgent.state.", Ot = "pluno.productAgent.pendingEvents.", ot = "pluno.productAgent.activeToolCalls.", Hs = 100;
306
+ const Rs = "https://app.pluno.ai", bs = "gpt-5.6-terra", Ms = 2e4, ks = 1e4, _s = 1e4, Cs = 1e4, Us = 1e4, Ps = 1e3, ae = 3e4, ce = 0.2, le = 6e4, Ds = 15e3, V = 8, vs = "Pluno could not finish this message. Try it again.", Os = "Browser connection was interrupted.", Ns = 15e3, xs = 2e3, Ls = 1e3, qs = 100, ue = 8e3, de = 3, Bs = [300, 1e3], $t = 64e3, bt = 4e3, jt = 30, Fs = 2e3, Hs = 1e3, _e = "Image is too large for model vision input.", Ws = 100, Ce = "pluno.productAgent.state.", vt = "pluno.productAgent.pendingEvents.", ot = "pluno.productAgent.activeToolCalls.", $s = 100;
307
307
  function Y(e, t = 0) {
308
308
  const s = e === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (e - 1));
309
309
  return Math.max(t, s);
310
310
  }
311
311
  const st = /* @__PURE__ */ new Set();
312
312
  let Z = null;
313
- function Ws(e, t = Math.random) {
314
- const s = Math.min(ae, Us * 2 ** e), n = 1 - ce + t() * ce * 2;
313
+ function js(e, t = Math.random) {
314
+ const s = Math.min(ae, Ps * 2 ** e), n = 1 - ce + t() * ce * 2;
315
315
  return Math.min(ae, Math.round(s * n));
316
316
  }
317
- function $s(e, t, s) {
317
+ function zs(e, t, s) {
318
318
  return new Promise((n, r) => {
319
319
  const i = setTimeout(() => r(new Error(s)), t);
320
320
  e.then(
@@ -327,13 +327,13 @@ function $s(e, t, s) {
327
327
  );
328
328
  });
329
329
  }
330
- class Pe {
330
+ class Ue {
331
331
  constructor(t, s) {
332
332
  this.options = t, this.transportIdentity = s, this.state = {
333
333
  ...this.state,
334
- starterPrompts: Rn(t.initialStarterPrompts)
334
+ starterPrompts: kn(t.initialStarterPrompts)
335
335
  };
336
- const n = t.restorePersistedState === !1 ? null : pr(t.clientId, t.expectedPersistedSessionId);
336
+ const n = t.restorePersistedState === !1 ? null : gr(t.clientId, t.expectedPersistedSessionId);
337
337
  n && (this.state = {
338
338
  ...this.state,
339
339
  ...n,
@@ -346,9 +346,9 @@ class Pe {
346
346
  assistantDraftRunId: null,
347
347
  isThinking: !1,
348
348
  lastError: null
349
- }), this.queuedClientEvents = wr(
350
- gr(t.clientId),
351
- yr(t.clientId)
349
+ }), this.queuedClientEvents = Ar(
350
+ yr(t.clientId),
351
+ Tr(t.clientId)
352
352
  ), j(t.clientId, this.queuedClientEvents);
353
353
  }
354
354
  options;
@@ -386,6 +386,7 @@ class Pe {
386
386
  runAckResyncRetryTimer = null;
387
387
  activeClientMessageId = null;
388
388
  activeUserMessageEvent = null;
389
+ browserConnectionInterruptedClientMessageIds = /* @__PURE__ */ new Set();
389
390
  latestRecoverableClientMessageId = null;
390
391
  lastUserMessagePageUrl = null;
391
392
  thinkingWatchdogResyncAttemptsByClientMessageId = {};
@@ -423,12 +424,12 @@ class Pe {
423
424
  lastErrorSecuritySettingsUrl: null
424
425
  };
425
426
  static async init(t) {
426
- const s = await ps(), n = new Pe({
427
+ const s = await ps(), n = new Ue({
427
428
  ...t,
428
- backendUrl: un(t.backendUrl ?? Es),
429
- clientId: t.clientId ?? Pn(),
430
- model: t.model ?? Rs,
431
- entrySurface: dn(t.entrySurface)
429
+ backendUrl: hn(t.backendUrl ?? Rs),
430
+ clientId: t.clientId ?? Dn(),
431
+ model: t.model ?? bs,
432
+ entrySurface: pn(t.entrySurface)
432
433
  }, s);
433
434
  try {
434
435
  ss().catch((r) => {
@@ -462,11 +463,11 @@ class Pe {
462
463
  this.state.status === "reconnecting" ? { status: "reconnecting" } : { status: "connecting", lastError: null }
463
464
  );
464
465
  try {
465
- if (this.token = this.options.token ?? (this.options.tokenProvider ? await $s(this.options.tokenProvider(), _s, "Pluno token provider timed out") : null), t !== this.connectionAttemptId || this.state.status === "closed")
466
+ if (this.token = this.options.token ?? (this.options.tokenProvider ? await zs(this.options.tokenProvider(), _s, "Pluno token provider timed out") : null), t !== this.connectionAttemptId || this.state.status === "closed")
466
467
  return;
467
468
  if (!this.token && !this.options.webSocketFactory)
468
469
  throw new Error("Pluno requires a token or tokenProvider");
469
- const s = fn(this.options.backendUrl), n = this.options.webSocketFactory?.(s) ?? new WebSocket(s);
470
+ const s = mn(this.options.backendUrl), n = this.options.webSocketFactory?.(s) ?? new WebSocket(s);
470
471
  this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
471
472
  this.socket === n && n.readyState === WebSocket.CONNECTING && (S("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.replaceTimedOutSocket(n));
472
473
  }, Cs), n.addEventListener("open", () => {
@@ -481,11 +482,11 @@ class Pe {
481
482
  pageUrl: location.href
482
483
  }) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
483
484
  this.socket === n && (S("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.replaceTimedOutSocket(n));
484
- }, Ps));
485
+ }, Us));
485
486
  }), n.addEventListener("message", (r) => {
486
- this.socket === n && this.handleServerEvent(En(r.data));
487
+ this.socket === n && this.handleServerEvent(Mn(r.data));
487
488
  }), n.addEventListener("close", (r) => {
488
- this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (S("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
489
+ this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (this.rememberBrowserConnectionInterruptionForActiveRun(), S("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
489
490
  code: typeof r?.code == "number" ? r.code : null,
490
491
  reason: typeof r?.reason == "string" ? r.reason : "",
491
492
  wasClean: typeof r?.wasClean == "boolean" ? r.wasClean : null,
@@ -496,7 +497,7 @@ class Pe {
496
497
  this.socket !== n || this.state.status === "closed" || (S("web-sdk.agent", "Pluno socket error; scheduling reconnect", {
497
498
  queuedClientEventCount: this.queuedClientEvents.length,
498
499
  isThinking: this.state.isThinking
499
- }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), n.readyState !== WebSocket.CLOSED && n.readyState !== WebSocket.CLOSING && n.close());
500
+ }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.rememberBrowserConnectionInterruptionForActiveRun(), this.setReconnectingState(), this.scheduleReconnect(), n.readyState !== WebSocket.CLOSED && n.readyState !== WebSocket.CLOSING && n.close());
500
501
  });
501
502
  } catch (s) {
502
503
  if (t === this.connectionAttemptId && this.state.status !== "closed") {
@@ -516,7 +517,7 @@ class Pe {
516
517
  this.connectionAttemptId += 1, this.setState({ status: "closed", isThinking: !1 }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.clearStarterPromptUrlRefreshTimer(), this.clearRetryTimers(), this.clearThinkingWatchdog(), 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.pendingWarmupEvent = null, this.nonTranscriptToolCallIds.clear(), this.socket?.close(), this.socket = null;
517
518
  }
518
519
  destroy() {
519
- this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionUserFilesApi(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), Sr(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
520
+ this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionUserFilesApi(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), Er(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
520
521
  for (const t of Object.values(this.listeners))
521
522
  t?.clear();
522
523
  }
@@ -526,7 +527,7 @@ class Pe {
526
527
  reason: t,
527
528
  entrySurface: this.options.entrySurface,
528
529
  sessionId: this.state.sessionId ?? void 0,
529
- page: k()
530
+ page: M()
530
531
  };
531
532
  this.sendNow(s) || (this.pendingWarmupEvent = s);
532
533
  }
@@ -535,7 +536,7 @@ class Pe {
535
536
  let i = r.map(Xt);
536
537
  if (!n && i.length === 0)
537
538
  return null;
538
- const o = k(), a = s.clientMessageId ?? $(), c = {
539
+ const o = M(), a = s.clientMessageId ?? $(), c = {
539
540
  id: `local-${a}`,
540
541
  role: "user",
541
542
  content: n,
@@ -564,14 +565,14 @@ class Pe {
564
565
  try {
565
566
  const p = [];
566
567
  for (const m of i) {
567
- const b = m.id ? this.attachmentFiles.get(m.id) : void 0;
568
+ const E = m.id ? this.attachmentFiles.get(m.id) : void 0;
568
569
  if (m.sandboxPath) {
569
570
  p.push(m);
570
571
  continue;
571
572
  }
572
- if (!b)
573
+ if (!E)
573
574
  throw new Error(`Attachment bytes are unavailable for ${m.name}`);
574
- p.push(await this.uploadAttachmentForMessage({ file: b, attachment: m }));
575
+ p.push(await this.uploadAttachmentForMessage({ file: E, attachment: m }));
575
576
  }
576
577
  i = p;
577
578
  } catch (p) {
@@ -586,7 +587,7 @@ class Pe {
586
587
  sessionId: this.state.sessionId ?? void 0,
587
588
  clientMessageId: a,
588
589
  initiatedBy: s.initiatedBy,
589
- invocation: hn(s.invocation ?? s.initiatedBy),
590
+ invocation: fn(s.invocation ?? s.initiatedBy),
590
591
  entrySurface: this.options.entrySurface,
591
592
  content: n,
592
593
  pageContent: u && zt() || void 0,
@@ -595,11 +596,11 @@ class Pe {
595
596
  model: this.options.model,
596
597
  metadata: he(this.options.metadata)
597
598
  };
598
- return s.initiatedBy || (this.lastUserMessagePageUrl = o.url), this.activeClientMessageId = a, this.activeUserMessageEvent = d, this.markThinkingProgress(), this.send(d), a;
599
+ return s.initiatedBy || (this.lastUserMessagePageUrl = o.url), this.activeClientMessageId = a, this.activeUserMessageEvent = d, this.browserConnectionInterruptedClientMessageIds.delete(a), this.markThinkingProgress(), this.send(d), a;
599
600
  }
600
601
  retryLastMessage() {
601
602
  const t = this.state.sessionId, s = this.retryableClientMessageId;
602
- return !t || !s ? !1 : (this.retryAttemptsByClientMessageId[s] = 0, this.retryableClientMessageId = null, this.activeClientMessageId = s, this.latestRecoverableClientMessageId = s, this.setState({ status: "connected", isThinking: !0, lastError: null, lastErrorCode: null }), this.markThinkingProgress(), this.send({ type: "chat.retry_last_user_message", sessionId: t, clientMessageId: s, automatic: !1 }), !0);
603
+ return !t || !s ? !1 : (this.retryAttemptsByClientMessageId[s] = 0, this.retryableClientMessageId = null, this.activeClientMessageId = s, this.browserConnectionInterruptedClientMessageIds.delete(s), this.latestRecoverableClientMessageId = s, this.setState({ status: "connected", isThinking: !0, lastError: null, lastErrorCode: null }), this.markThinkingProgress(), this.send({ type: "chat.retry_last_user_message", sessionId: t, clientMessageId: s, automatic: !1 }), !0);
603
604
  }
604
605
  createLocalAttachment(t) {
605
606
  const s = $(), n = {
@@ -616,7 +617,7 @@ class Pe {
616
617
  mimeType: n.mimeType,
617
618
  sizeBytes: n.sizeBytes,
618
619
  blob: t,
619
- origin: k().origin,
620
+ origin: M().origin,
620
621
  sessionId: this.state.sessionId ?? void 0,
621
622
  createdAt: r,
622
623
  lastUsedAt: r
@@ -647,7 +648,7 @@ class Pe {
647
648
  name: t.name || "attachment",
648
649
  mimeType: r,
649
650
  sizeBytes: t.size,
650
- page: k(),
651
+ page: M(),
651
652
  model: this.options.model,
652
653
  metadata: he(this.options.metadata),
653
654
  entrySurface: this.options.entrySurface
@@ -706,7 +707,7 @@ class Pe {
706
707
  const n = await this.fetchEmbedAttachmentUpload(t);
707
708
  if (n.ok)
708
709
  return await n.json();
709
- if (Lr(n.status) && this.options.tokenProvider && !s) {
710
+ if (Br(n.status) && this.options.tokenProvider && !s) {
710
711
  s = !0;
711
712
  const r = await this.fetchEmbedAttachmentUpload(t);
712
713
  if (r.ok)
@@ -735,7 +736,7 @@ class Pe {
735
736
  !this.options.keepRunsActiveOnSessionNavigation && s && this.state.sessionId && this.state.isThinking && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "new_chat" }), this.rememberCurrentRunAsBackground(), this.cleanupSessionUserFilesApi(), this.queuedClientEvents = this.queuedClientEvents.filter((n) => n.type !== "chat.user_message"), this.clearThinkingWatchdog(), this.retryableClientMessageId = null, this.lastUserMessagePageUrl = null, this.retryAttemptsByClientMessageId = {}, this.thinkingWatchdogResyncAttemptsByClientMessageId = {}, this.nonTranscriptToolCallIds.clear(), s && this.send({
736
737
  type: "session.reset",
737
738
  sessionId: this.state.sessionId ?? void 0,
738
- page: k()
739
+ page: M()
739
740
  }), this.setState({
740
741
  sessionId: null,
741
742
  starterPrompts: [...this.state.starterPrompts],
@@ -758,7 +759,7 @@ class Pe {
758
759
  }), r = {
759
760
  type: "sessions.list",
760
761
  requestId: s,
761
- page: k(),
762
+ page: M(),
762
763
  ...t.cursor ? { cursor: t.cursor } : {},
763
764
  ...t.limit ? { limit: t.limit } : {},
764
765
  ...typeof t.pinned == "boolean" ? { pinned: t.pinned } : {}
@@ -797,7 +798,7 @@ class Pe {
797
798
  }), this.send({
798
799
  type: "session.load",
799
800
  sessionId: t,
800
- page: k()
801
+ page: M()
801
802
  });
802
803
  }
803
804
  send(t) {
@@ -814,7 +815,7 @@ class Pe {
814
815
  return !1;
815
816
  const s = this.socket;
816
817
  try {
817
- return s.send(JSON.stringify(t)), Et("client_event", t.type, oe(t)), !0;
818
+ return s.send(JSON.stringify(t)), Rt("client_event", t.type, oe(t)), !0;
818
819
  } catch (n) {
819
820
  return S("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
820
821
  message: n instanceof Error ? n.message : String(n),
@@ -827,7 +828,7 @@ class Pe {
827
828
  if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
828
829
  return;
829
830
  this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
830
- const t = gn();
831
+ const t = yn();
831
832
  this.sendNow(
832
833
  _({
833
834
  type: "starter_prompts.page_context",
@@ -838,13 +839,13 @@ class Pe {
838
839
  ) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
839
840
  }
840
841
  startStarterPromptUrlWatcher() {
841
- this.locationChangeCleanup || (this.locationChangeCleanup = mn(() => this.handleStarterPromptUrlChange()));
842
+ this.locationChangeCleanup || (this.locationChangeCleanup = In(() => this.handleStarterPromptUrlChange()));
842
843
  }
843
844
  handleStarterPromptUrlChange() {
844
845
  const t = location.href;
845
846
  t !== this.lastStarterPromptPageUrl && (this.lastStarterPromptPageUrl = t, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
846
847
  this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
847
- }, Hs));
848
+ }, $s));
848
849
  }
849
850
  refreshStarterPromptsForCurrentUrl() {
850
851
  this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
@@ -873,13 +874,13 @@ class Pe {
873
874
  !this.pendingWarmupEvent || !this.sendNow(this.pendingWarmupEvent) || (this.pendingWarmupEvent = null);
874
875
  }
875
876
  handleServerEvent(t) {
876
- if (Et("server_event", t.type, oe(t)), t.type === "run.ack") {
877
- const s = Mt(t), n = typeof t.clientMessageId == "string" ? t.clientMessageId : null;
877
+ if (Rt("server_event", t.type, oe(t)), t.type === "run.ack") {
878
+ const s = kt(t), n = typeof t.clientMessageId == "string" ? t.clientMessageId : null;
878
879
  s && n && this.backgroundClientMessageIds.delete(n) ? (this.backgroundSessionIds.add(s), this.deferredSessionUpdatedSessionIds.delete(s)) : s && n === this.activeClientMessageId && this.deferredSessionUpdatedSessionIds.delete(s) && this.state.sessionId === null && this.setState({ sessionId: s }), this.handleRunAck(t);
879
880
  return;
880
881
  }
881
882
  if (t.type === "session.updated" && this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId === null && this.backgroundClientMessageIds.size > 0) {
882
- const s = Mt(t);
883
+ const s = kt(t);
883
884
  if (s) {
884
885
  this.deferredSessionUpdatedSessionIds.add(s);
885
886
  return;
@@ -894,23 +895,23 @@ class Pe {
894
895
  this.clearHeartbeatAckTimer();
895
896
  return;
896
897
  }
897
- if (Ks(t) && this.markThinkingProgress(), t.type === "auth.ok") {
898
+ if (Xs(t) && this.markThinkingProgress(), t.type === "auth.ok") {
898
899
  this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.flushQueuedClientEvents(), this.flushPendingWarmupEvent(), this.startHeartbeat();
899
- const s = kn(t), n = Object.prototype.hasOwnProperty.call(t, "appearance");
900
+ const s = _n(t), n = Object.prototype.hasOwnProperty.call(t, "appearance");
900
901
  S("web-sdk.agent", "Received auth.ok appearance", {
901
902
  hasAppearance: n,
902
903
  rawAppearance: t.appearance,
903
904
  normalizedAppearance: s
904
- }), this.runtimeHelperJavascript = Mn(t.runtimeHelpers)?.javascript ?? null;
905
+ }), this.runtimeHelperJavascript = Cn(t.runtimeHelpers)?.javascript ?? null;
905
906
  const r = ge(t, "starterPrompts"), i = Object.prototype.hasOwnProperty.call(t, "starterPrompts"), o = t.starterPromptsLoading === !0, a = {
906
- user: Un(t.user),
907
+ user: vn(t.user),
907
908
  status: "connected",
908
909
  ...this.state.lastErrorCode === "connection_failed" ? { lastError: null, lastErrorCode: null } : {}
909
910
  };
910
- (i || this.state.starterPrompts.length === 0) && (a.starterPrompts = r, a.starterPromptsLoading = r.length > 0 ? !1 : o), i && r.length > 0 && (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0), (n || s) && (a.appearance = s), this.setState(a), i && r.length === 0 && !o && !In() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
911
+ (i || this.state.starterPrompts.length === 0) && (a.starterPrompts = r, a.starterPromptsLoading = r.length > 0 ? !1 : o), i && r.length > 0 && (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0), (n || s) && (a.appearance = s), this.setState(a), i && r.length === 0 && !o && !wn() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
911
912
  type: "page.upsert",
912
913
  sessionId: this.state.sessionId,
913
- page: k(),
914
+ page: M(),
914
915
  model: this.options.model
915
916
  });
916
917
  return;
@@ -923,13 +924,13 @@ class Pe {
923
924
  return;
924
925
  }
925
926
  if (t.type === "conversation.state") {
926
- const s = Array.isArray(t.items) ? t.items : [], n = Bn(
927
+ const s = Array.isArray(t.items) ? t.items : [], n = Hn(
927
928
  t.assistantDraft
928
929
  ), r = n !== void 0;
929
930
  this.rememberUserMessageClientMessageIds(s);
930
- const i = er(s);
931
+ const i = nr(s);
931
932
  if (i) {
932
- const p = sr(s, i);
933
+ const p = rr(s, i);
933
934
  this.retryAttemptsByClientMessageId[i] = Math.max(
934
935
  this.retryAttemptsByClientMessageId[i] ?? 0,
935
936
  p
@@ -938,9 +939,9 @@ class Pe {
938
939
  const o = s.filter((p) => {
939
940
  const m = q(p);
940
941
  return !ye(m) && (!i || !Lt(m));
941
- }), a = Xn(
942
+ }), a = Vn(
942
943
  this.state.messages,
943
- Dn(o, this.options.backendUrl)
944
+ On(o, this.options.backendUrl)
944
945
  ), c = me(a), l = !r && s.some(
945
946
  (p) => Te(
946
947
  q(p),
@@ -949,13 +950,13 @@ class Pe {
949
950
  this.state.assistantDraftRespondsToUserMessageId,
950
951
  this.state.assistantDraftRunId
951
952
  )
952
- ), h = r ? n?.content ?? "" : this.state.assistantDraft, f = !!n?.content, I = c && (!h || l), g = Zn(a), u = I && g;
953
- if (!c && tr(this.state.messages, s))
953
+ ), h = r ? n?.content ?? "" : this.state.assistantDraft, f = !!n?.content, I = c && (!h || l), g = tr(a), u = I && g;
954
+ if (!c && sr(this.state.messages, s))
954
955
  return;
955
- this.lastUserMessagePageUrl = Qn(s);
956
+ this.lastUserMessagePageUrl = er(s);
956
957
  const d = I ? null : qt(s);
957
958
  if (this.latestRecoverableClientMessageId = d, g && this.clearRetryTimers(), this.setState({
958
- sessionId: E(t.session, "id") ?? this.state.sessionId,
959
+ sessionId: R(t.session, "id") ?? this.state.sessionId,
959
960
  messages: a,
960
961
  ...r ? {
961
962
  assistantDraft: n?.content ?? "",
@@ -986,7 +987,7 @@ class Pe {
986
987
  lastError: null
987
988
  } : {}
988
989
  }), I ? (this.retryableClientMessageId = null, this.clearThinkingWatchdog()) : (f || d) && (d && (this.activeClientMessageId = d), this.markThinkingProgress()), i) {
989
- const p = E(t.session, "id") ?? this.state.sessionId;
990
+ const p = R(t.session, "id") ?? this.state.sessionId;
990
991
  p && this.retryAfterInterruptedRun(p, i);
991
992
  }
992
993
  return;
@@ -994,7 +995,7 @@ class Pe {
994
995
  if (t.type === "sessions.page") {
995
996
  const s = typeof t.requestId == "string" ? t.requestId : null, n = s ? this.pendingSessionHistoryRequests.get(s) : null;
996
997
  s && n && (window.clearTimeout(n.timeout), this.pendingSessionHistoryRequests.delete(s), n.resolve({
997
- sessions: On(t.sessions),
998
+ sessions: Nn(t.sessions),
998
999
  nextCursor: typeof t.nextCursor == "string" ? t.nextCursor : null
999
1000
  }));
1000
1001
  return;
@@ -1008,7 +1009,7 @@ class Pe {
1008
1009
  return;
1009
1010
  }
1010
1011
  if (t.type === "session.updated") {
1011
- this.clearRunAckResyncRetryTimer(), this.setState({ sessionId: E(t.session, "id") ?? this.state.sessionId });
1012
+ this.clearRunAckResyncRetryTimer(), this.setState({ sessionId: R(t.session, "id") ?? this.state.sessionId });
1012
1013
  return;
1013
1014
  }
1014
1015
  if (t.type === "session.item") {
@@ -1016,7 +1017,7 @@ class Pe {
1016
1017
  const s = q(t.item);
1017
1018
  if (Lt(s)) {
1018
1019
  typeof s?.runId == "string" && this.retryableFailureRunIdsAwaitingDone.add(s.runId);
1019
- const r = E(t.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);
1020
+ const r = R(t.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);
1020
1021
  if (r && a) {
1021
1022
  this.retryAfterInterruptedRun(r, a);
1022
1023
  return;
@@ -1028,19 +1029,19 @@ class Pe {
1028
1029
  }
1029
1030
  if (ye(s))
1030
1031
  return;
1031
- const n = ve(t.item, this.options.backendUrl);
1032
+ const n = Ne(t.item, this.options.backendUrl);
1032
1033
  if (n) {
1033
1034
  const r = n.callId ? this.pendingToolLoadingByCallId.get(n.callId) : void 0;
1034
- n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)), v(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer());
1035
+ n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)), N(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer());
1035
1036
  const i = t.item.data;
1036
- rr(i) && this.clearRunAckResyncRetryTimer();
1037
- const o = Nt(this.state.messages, n), a = me(o), c = Te(
1037
+ or(i) && this.clearRunAckResyncRetryTimer();
1038
+ const o = Ot(this.state.messages, n), a = me(o), c = Te(
1038
1039
  i,
1039
1040
  this.state.assistantDraft,
1040
1041
  this.state.assistantDraftItemId,
1041
1042
  this.state.assistantDraftRespondsToUserMessageId,
1042
1043
  this.state.assistantDraftRunId
1043
- ), l = a && (!this.state.assistantDraft || c), h = l && v(n);
1044
+ ), l = a && (!this.state.assistantDraft || c), h = l && N(n);
1044
1045
  this.setState({
1045
1046
  messages: o,
1046
1047
  ...c ? {
@@ -1067,7 +1068,7 @@ class Pe {
1067
1068
  this.clearRunAckResyncRetryTimer();
1068
1069
  const s = typeof t.delta == "string" ? t.delta : "", n = typeof t.itemId == "string" ? t.itemId : null, r = n !== null && this.state.assistantDraftItemId !== n, i = `${r ? "" : this.state.assistantDraft}${s}`, o = n ?? this.state.assistantDraftItemId ?? "assistant-draft", a = this.state.messages.find((f) => f.id === o), c = t.phase === "commentary" || t.phase === "final_answer" ? t.phase : r ? null : this.state.assistantDraftPhase, l = typeof t.respondsToUserMessageId == "string" ? t.respondsToUserMessageId : this.state.assistantDraftRespondsToUserMessageId, h = typeof t.runId == "string" ? t.runId : this.state.assistantDraftRunId;
1069
1070
  this.setState({
1070
- messages: Nt(this.state.messages, {
1071
+ messages: Ot(this.state.messages, {
1071
1072
  id: o,
1072
1073
  role: "assistant",
1073
1074
  content: i,
@@ -1095,7 +1096,7 @@ class Pe {
1095
1096
  return;
1096
1097
  const o = [...this.state.messages].reverse().find((l) => l.role === "user")?.id, a = !n || !o || n === o, c = cs(
1097
1098
  this.state.messages.filter(
1098
- (l) => l.dataType !== "assistant_draft" || !Wn(
1099
+ (l) => l.dataType !== "assistant_draft" || !jn(
1099
1100
  l,
1100
1101
  n,
1101
1102
  r
@@ -1107,7 +1108,7 @@ class Pe {
1107
1108
  );
1108
1109
  this.setState({
1109
1110
  sessionId: s,
1110
- messages: $n(
1111
+ messages: zn(
1111
1112
  c,
1112
1113
  typeof t.responseId == "string" ? t.responseId : null,
1113
1114
  n,
@@ -1128,9 +1129,9 @@ class Pe {
1128
1129
  if (s)
1129
1130
  this.nonTranscriptToolCallIds.add(s);
1130
1131
  else {
1131
- const n = Kn(t);
1132
+ const n = Xn(t);
1132
1133
  if (n) {
1133
- const r = jn(
1134
+ const r = Kn(
1134
1135
  this.state.messages,
1135
1136
  n
1136
1137
  );
@@ -1174,7 +1175,7 @@ class Pe {
1174
1175
  return;
1175
1176
  }
1176
1177
  o && r && i && (this.retryableClientMessageId = i);
1177
- const a = new Error(typeof t.message == "string" ? t.message.replace(/Product Agent/g, "Pluno") : "Pluno error"), c = pn(a.message);
1178
+ const a = new Error(typeof t.message == "string" ? t.message.replace(/Product Agent/g, "Pluno") : "Pluno error"), c = gn(a.message);
1178
1179
  c && console.error(c), this.setState({
1179
1180
  status: "error",
1180
1181
  isThinking: !1,
@@ -1186,9 +1187,9 @@ class Pe {
1186
1187
  }
1187
1188
  }
1188
1189
  shouldIgnoreBackgroundSessionEvent(t) {
1189
- if (!this.options.keepRunsActiveOnSessionNavigation || !Gs(t))
1190
+ if (!this.options.keepRunsActiveOnSessionNavigation || !Js(t))
1190
1191
  return !1;
1191
- const s = Mt(t);
1192
+ const s = kt(t);
1192
1193
  return s ? this.deferredSessionUpdatedSessionIds.has(s) ? !0 : this.state.sessionId ? s !== this.state.sessionId : this.backgroundSessionIds.has(s) : !1;
1193
1194
  }
1194
1195
  rememberCurrentRunAsBackground() {
@@ -1233,7 +1234,7 @@ class Pe {
1233
1234
  if (n >= V) {
1234
1235
  this.retryableClientMessageId = s, this.setState({
1235
1236
  isThinking: !1,
1236
- lastError: "Pluno could not finish this message. Try it again.",
1237
+ lastError: this.getRunRecoveryExhaustedErrorMessage(s),
1237
1238
  lastErrorCode: "run_recovery_exhausted"
1238
1239
  }), this.clearThinkingWatchdog();
1239
1240
  return;
@@ -1249,7 +1250,7 @@ class Pe {
1249
1250
  }
1250
1251
  rememberUserMessageClientMessageIds(t) {
1251
1252
  for (const s of t) {
1252
- const n = E(s, "id"), r = q(s);
1253
+ const n = R(s, "id"), r = q(s);
1253
1254
  n && r?.type === "message" && r.role === "user" && typeof r.clientMessageId == "string" && this.clientMessageIdsByUserMessageItemId.set(n, r.clientMessageId);
1254
1255
  }
1255
1256
  }
@@ -1293,7 +1294,7 @@ class Pe {
1293
1294
  }, t);
1294
1295
  }
1295
1296
  clearThinkingWatchdog() {
1296
- this.thinkingWatchdogTimer !== null && (window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = null), this.clearRunAckTimers(), this.activeClientMessageId = null, this.activeUserMessageEvent = null;
1297
+ this.thinkingWatchdogTimer !== null && (window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = null), this.clearRunAckTimers(), this.activeClientMessageId && this.browserConnectionInterruptedClientMessageIds.delete(this.activeClientMessageId), this.activeClientMessageId = null, this.activeUserMessageEvent = null;
1297
1298
  }
1298
1299
  handleRunAck(t) {
1299
1300
  const s = typeof t.clientMessageId == "string" ? t.clientMessageId : null;
@@ -1305,7 +1306,7 @@ class Pe {
1305
1306
  handleRunSteered(t) {
1306
1307
  const s = typeof t.respondsToUserMessageId == "string" ? t.respondsToUserMessageId : null;
1307
1308
  !this.state.isThinking || !s || this.setState({
1308
- messages: or(
1309
+ messages: cr(
1309
1310
  this.state.messages,
1310
1311
  s
1311
1312
  )
@@ -1314,7 +1315,7 @@ class Pe {
1314
1315
  scheduleRunAckWatchdog(t) {
1315
1316
  this.runAckWatchdogTimer !== null && window.clearTimeout(this.runAckWatchdogTimer), this.runAckWatchdogTimer = window.setTimeout(() => {
1316
1317
  this.runAckWatchdogTimer = null, this.recoverMissedRunAck(t);
1317
- }, Os);
1318
+ }, Ns);
1318
1319
  }
1319
1320
  recoverMissedRunAck(t) {
1320
1321
  !this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== t || (S("web-sdk.agent", "Pluno run ack missed; resyncing session", {
@@ -1339,7 +1340,7 @@ class Pe {
1339
1340
  clientMessageId: t,
1340
1341
  automatic: !0
1341
1342
  }) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.scheduleThinkingWatchdog(le)));
1342
- }, Y(s, Ns)));
1343
+ }, Y(s, xs)));
1343
1344
  }
1344
1345
  clearRunAckResyncRetryTimer() {
1345
1346
  this.runAckResyncRetryTimer !== null && (window.clearTimeout(this.runAckResyncRetryTimer), this.runAckResyncRetryTimer = null);
@@ -1356,7 +1357,7 @@ class Pe {
1356
1357
  sessionId: this.state.sessionId
1357
1358
  }), this.setState({
1358
1359
  isThinking: !1,
1359
- lastError: "Pluno could not finish this message. Please send it again.",
1360
+ lastError: this.getRunRecoveryExhaustedErrorMessage(null),
1360
1361
  lastErrorCode: "run_recovery_exhausted"
1361
1362
  }), this.clearThinkingWatchdog();
1362
1363
  return;
@@ -1368,7 +1369,7 @@ class Pe {
1368
1369
  clientMessageId: t
1369
1370
  }), this.retryableClientMessageId = t, this.setState({
1370
1371
  isThinking: !1,
1371
- lastError: "Pluno could not finish this message. Try it again.",
1372
+ lastError: this.getRunRecoveryExhaustedErrorMessage(t),
1372
1373
  lastErrorCode: "run_recovery_exhausted"
1373
1374
  }), this.clearThinkingWatchdog();
1374
1375
  return;
@@ -1402,7 +1403,7 @@ class Pe {
1402
1403
  this.state.sessionId ? this.send({
1403
1404
  type: "page.upsert",
1404
1405
  sessionId: this.state.sessionId,
1405
- page: k(),
1406
+ page: M(),
1406
1407
  model: this.options.model
1407
1408
  }) : (!this.socket || this.socket.readyState !== WebSocket.OPEN) && (this.setReconnectingState(), this.scheduleReconnect());
1408
1409
  }
@@ -1413,7 +1414,7 @@ class Pe {
1413
1414
  if (!s || !n || !r)
1414
1415
  return;
1415
1416
  const a = r === "execute_code", c = r === "execute_code_in_browser_tab" && o !== null && typeof o == "object" && o.tabId === "local:current";
1416
- if (!a && !c || !Rr(o)) {
1417
+ if (!a && !c || !kr(o)) {
1417
1418
  this.setToolMessageLoading(n, !1), this.send({
1418
1419
  type: "tool.result",
1419
1420
  sessionId: s,
@@ -1445,7 +1446,7 @@ class Pe {
1445
1446
  });
1446
1447
  return;
1447
1448
  }
1448
- const l = Vs(this.state.messages);
1449
+ const l = Zs(this.state.messages);
1449
1450
  this.activeBrowserToolCalls.set(n, {
1450
1451
  event: {
1451
1452
  type: "tool.result",
@@ -1463,7 +1464,7 @@ class Pe {
1463
1464
  let h = null, f;
1464
1465
  h = await this.executeRuntimeHelper(), f = await pe(
1465
1466
  o,
1466
- cn(t.runtimeContext, this.options.backendUrl)
1467
+ un(t.runtimeContext, this.options.backendUrl)
1467
1468
  ).catch((I) => ({
1468
1469
  ok: !1,
1469
1470
  exception: {
@@ -1476,11 +1477,11 @@ class Pe {
1476
1477
  toolName: r,
1477
1478
  summary: o.summary,
1478
1479
  rawInput: _(o),
1479
- rawOutput: _(_n(f, h))
1480
- }), mr(this.options.clientId, this.activeBrowserToolCalls.values());
1480
+ rawOutput: _(Un(f, h))
1481
+ }), Ir(this.options.clientId, this.activeBrowserToolCalls.values());
1481
1482
  }
1482
1483
  setToolMessageLoading(t, s) {
1483
- const n = zn(
1484
+ const n = Gn(
1484
1485
  this.state.messages,
1485
1486
  t,
1486
1487
  s
@@ -1498,10 +1499,10 @@ class Pe {
1498
1499
  };
1499
1500
  }
1500
1501
  installSessionUserFilesApi(t) {
1501
- this.cleanupSessionUserFilesApi(), this.sessionUserFilesApiCleanup = Ys(t, this.attachmentFiles, this.attachmentBlobCache);
1502
+ this.cleanupSessionUserFilesApi(), this.sessionUserFilesApiCleanup = Qs(t, this.attachmentFiles, this.attachmentBlobCache);
1502
1503
  }
1503
1504
  cleanupSessionUserFilesApi() {
1504
- this.sessionUserFilesApiCleanup && (on(this.sessionUserFilesApiCleanup), this.sessionUserFilesApiCleanup = null);
1505
+ this.sessionUserFilesApiCleanup && (cn(this.sessionUserFilesApiCleanup), this.sessionUserFilesApiCleanup = null);
1505
1506
  }
1506
1507
  async executeRuntimeHelper() {
1507
1508
  if (!this.runtimeHelperJavascript?.trim())
@@ -1509,29 +1510,29 @@ class Pe {
1509
1510
  const t = await pe({
1510
1511
  javascript: this.runtimeHelperJavascript
1511
1512
  });
1512
- return t.ok === !1 ? Cn(t) : null;
1513
+ return t.ok === !1 ? Pn(t) : null;
1513
1514
  }
1514
1515
  enableNetworkCapture() {
1515
- this.networkCaptureCleanup || (this.networkCaptureCleanup = js((t) => {
1516
- Ur(t.url, this.options.backendUrl) || this.enqueueNetworkEvent(t);
1516
+ this.networkCaptureCleanup || (this.networkCaptureCleanup = Ks((t) => {
1517
+ vr(t.url, this.options.backendUrl) || this.enqueueNetworkEvent(t);
1517
1518
  }));
1518
1519
  }
1519
1520
  enqueueNetworkEvent(t) {
1520
- this.queuedNetworkEvents.length >= xs || (this.queuedNetworkEvents.push(Pr(t)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
1521
+ this.queuedNetworkEvents.length >= qs || (this.queuedNetworkEvents.push(Dr(t)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
1521
1522
  this.networkBatchTimer = null;
1522
1523
  const s = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
1523
1524
  s.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
1524
1525
  type: "network.batch",
1525
1526
  sessionId: this.state.sessionId ?? void 0,
1526
- page: k(),
1527
+ page: M(),
1527
1528
  events: s
1528
1529
  });
1529
- }, vs)));
1530
+ }, Ls)));
1530
1531
  }
1531
1532
  scheduleReconnect() {
1532
1533
  if (this.reconnectTimer !== null || this.state.status === "closed")
1533
1534
  return;
1534
- const t = Ws(this.reconnectAttempts);
1535
+ const t = js(this.reconnectAttempts);
1535
1536
  this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
1536
1537
  this.reconnectTimer = null, this.connect().catch((s) => {
1537
1538
  S("web-sdk.agent", "Pluno reconnect failed; retrying", {
@@ -1547,8 +1548,8 @@ class Pe {
1547
1548
  const t = this.socket;
1548
1549
  !t || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
1549
1550
  this.socket === t && (S("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(t));
1550
- }, Ms));
1551
- }, ks);
1551
+ }, ks));
1552
+ }, Ms);
1552
1553
  }
1553
1554
  stopHeartbeat() {
1554
1555
  this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
@@ -1566,7 +1567,7 @@ class Pe {
1566
1567
  this.clearSocketConnectTimer(), this.clearSocketAuthTimer();
1567
1568
  }
1568
1569
  replaceTimedOutSocket(t) {
1569
- this.socket !== t || this.state.status === "closed" || (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), t.readyState !== WebSocket.CLOSED && t.readyState !== WebSocket.CLOSING && t.close());
1570
+ this.socket !== t || this.state.status === "closed" || (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.rememberBrowserConnectionInterruptionForActiveRun(), this.setReconnectingState(), this.scheduleReconnect(), t.readyState !== WebSocket.CLOSED && t.readyState !== WebSocket.CLOSING && t.close());
1570
1571
  }
1571
1572
  setState(t) {
1572
1573
  this.state = {
@@ -1574,7 +1575,7 @@ class Pe {
1574
1575
  ...t,
1575
1576
  ...t.lastError === null && t.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
1576
1577
  ...t.lastError !== void 0 && t.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
1577
- }, fr(this.options.clientId, this.state), this.emit("state", this.getState()), Et("state", this.state.status, {
1578
+ }, mr(this.options.clientId, this.state), this.emit("state", this.getState()), Rt("state", this.state.status, {
1578
1579
  status: this.state.status,
1579
1580
  sessionId: this.state.sessionId,
1580
1581
  messageCount: this.state.messages.length,
@@ -1587,18 +1588,24 @@ class Pe {
1587
1588
  const t = this.state.lastError !== null && !this.state.isThinking && this.state.lastErrorCode !== "connection_failed";
1588
1589
  this.setState(t ? { status: "reconnecting" } : { status: "reconnecting", lastError: null });
1589
1590
  }
1591
+ rememberBrowserConnectionInterruptionForActiveRun() {
1592
+ this.state.isThinking && this.activeClientMessageId && this.browserConnectionInterruptedClientMessageIds.add(this.activeClientMessageId);
1593
+ }
1594
+ getRunRecoveryExhaustedErrorMessage(t) {
1595
+ return t && this.browserConnectionInterruptedClientMessageIds.has(t) ? Os : vs;
1596
+ }
1590
1597
  emit(t, s) {
1591
1598
  this.listeners[t]?.forEach((r) => r(s));
1592
1599
  }
1593
1600
  }
1594
- const kt = /* @__PURE__ */ new WeakMap();
1595
- function js(e) {
1596
- const t = window.__plunoProductAgentNetworkCapture ?? zs();
1601
+ const Mt = /* @__PURE__ */ new WeakMap();
1602
+ function Ks(e) {
1603
+ const t = window.__plunoProductAgentNetworkCapture ?? Gs();
1597
1604
  return t.subscribers.add(e), () => {
1598
1605
  t.subscribers.delete(e), !(t.subscribers.size > 0) && (t.destroy(), window.__plunoProductAgentNetworkCapture === t && delete window.__plunoProductAgentNetworkCapture);
1599
1606
  };
1600
1607
  }
1601
- function zs() {
1608
+ function Gs() {
1602
1609
  const e = /* @__PURE__ */ new Set(), t = (I) => {
1603
1610
  e.forEach((g) => {
1604
1611
  try {
@@ -1615,20 +1622,20 @@ function zs() {
1615
1622
  throw m;
1616
1623
  }
1617
1624
  try {
1618
- const m = g instanceof Request ? g : null, b = kr(g, m), T = $e(u?.headers ?? m?.headers);
1619
- if (!x(b, T, u?.body)) {
1625
+ const m = g instanceof Request ? g : null, E = _r(g, m), T = $e(u?.headers ?? m?.headers);
1626
+ if (!x(E, T, u?.body)) {
1620
1627
  const F = {
1621
- requestId: Pt("fetch"),
1622
- url: P(b, Rt),
1628
+ requestId: Ut("fetch"),
1629
+ url: U(E, bt),
1623
1630
  method: (u?.method ?? m?.method ?? "GET").toUpperCase(),
1624
1631
  requestHeaders: T,
1625
- requestBody: be(u?.body),
1632
+ requestBody: Ee(u?.body),
1626
1633
  resourceType: "fetch",
1627
1634
  startedAt: new Date(d).toISOString()
1628
1635
  };
1629
1636
  p.then(
1630
1637
  (C) => {
1631
- Mr(C, F, d, t).catch(() => {
1638
+ Cr(C, F, d, t).catch(() => {
1632
1639
  t({
1633
1640
  ...F,
1634
1641
  responseStatus: C.status,
@@ -1639,7 +1646,7 @@ function zs() {
1639
1646
  (C) => {
1640
1647
  t({
1641
1648
  ...F,
1642
- errorText: P(C instanceof Error ? C.message : String(C)),
1649
+ errorText: U(C instanceof Error ? C.message : String(C)),
1643
1650
  durationMs: Date.now() - d
1644
1651
  });
1645
1652
  }
@@ -1649,28 +1656,28 @@ function zs() {
1649
1656
  }
1650
1657
  return p;
1651
1658
  }, a = function(g, u, d, p, m) {
1652
- const b = n.call(this, g, u, d ?? !0, p ?? void 0, m ?? void 0), T = typeof u == "string" ? u : u.toString();
1653
- return kt.set(this, {
1654
- requestId: Pt("xhr"),
1659
+ const E = n.call(this, g, u, d ?? !0, p ?? void 0, m ?? void 0), T = typeof u == "string" ? u : u.toString();
1660
+ return Mt.set(this, {
1661
+ requestId: Ut("xhr"),
1655
1662
  method: String(g ?? "GET").toUpperCase(),
1656
- url: P(T, Rt),
1663
+ url: U(T, bt),
1657
1664
  requestHeaders: {},
1658
1665
  startedAtMs: Date.now(),
1659
1666
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
1660
1667
  excluded: x(T)
1661
- }), b;
1668
+ }), E;
1662
1669
  }, c = function(g, u) {
1663
- const d = r.call(this, g, u), p = kt.get(this);
1670
+ const d = r.call(this, g, u), p = Mt.get(this);
1664
1671
  return p && Object.keys(p.requestHeaders).length < jt && (p.requestHeaders[g] = Jt(g, u), p.excluded = p.excluded || x(p.url, p.requestHeaders)), d;
1665
1672
  }, l = function(g) {
1666
1673
  try {
1667
- const u = kt.get(this);
1668
- u && (u.excluded = u.excluded || x(u.url, u.requestHeaders, g), u.requestBody = be(g), u.excluded || this.addEventListener(
1674
+ const u = Mt.get(this);
1675
+ u && (u.excluded = u.excluded || x(u.url, u.requestHeaders, g), u.requestBody = Ee(g), u.excluded || this.addEventListener(
1669
1676
  "loadend",
1670
1677
  () => {
1671
1678
  queueMicrotask(() => {
1672
1679
  try {
1673
- const d = Or(this.getAllResponseHeaders());
1680
+ const d = Nr(this.getAllResponseHeaders());
1674
1681
  t({
1675
1682
  requestId: u.requestId,
1676
1683
  url: u.url,
@@ -1680,7 +1687,7 @@ function zs() {
1680
1687
  resourceType: "xhr",
1681
1688
  responseStatus: this.status,
1682
1689
  responseHeaders: d,
1683
- responseBody: Cr(this, d),
1690
+ responseBody: Pr(this, d),
1684
1691
  errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
1685
1692
  startedAt: u.startedAt,
1686
1693
  durationMs: Date.now() - u.startedAtMs
@@ -1721,8 +1728,8 @@ function zs() {
1721
1728
  continue;
1722
1729
  const d = performance.timeOrigin + u.startTime;
1723
1730
  t({
1724
- requestId: Pt("resource"),
1725
- url: P(u.name, Rt),
1731
+ requestId: Ut("resource"),
1732
+ url: U(u.name, bt),
1726
1733
  method: "GET",
1727
1734
  resourceType: "resource",
1728
1735
  responseStatus: u.responseStatus,
@@ -1776,13 +1783,13 @@ function he(e) {
1776
1783
  const t = typeof e == "function" ? e() : e;
1777
1784
  return t && Object.keys(t).length > 0 ? t : void 0;
1778
1785
  }
1779
- function Ks(e) {
1786
+ function Xs(e) {
1780
1787
  return e.type === "conversation.state" || e.type === "session.updated" || e.type === "session.item" || e.type === "chat.assistant_delta" || e.type === "chat.assistant_done" || e.type === "tool.call";
1781
1788
  }
1782
- function Gs(e) {
1789
+ function Js(e) {
1783
1790
  return e.type === "run.steered" || e.type === "run.ack" || e.type === "conversation.state" || e.type === "session.updated" || e.type === "session.item" || e.type === "chat.assistant_delta" || e.type === "chat.assistant_done" || e.type === "tool.call" || e.type === "tool.status" || e.type === "error" && typeof e.requestId != "string";
1784
1791
  }
1785
- function Mt(e) {
1792
+ function kt(e) {
1786
1793
  if (typeof e.sessionId == "string")
1787
1794
  return e.sessionId;
1788
1795
  if (e.session && typeof e.session == "object") {
@@ -1797,8 +1804,8 @@ function Mt(e) {
1797
1804
  }
1798
1805
  return null;
1799
1806
  }
1800
- const Xs = 5e3, Js = 12e4;
1801
- function Vs(e) {
1807
+ const Vs = 5e3, Ys = 12e4;
1808
+ function Zs(e) {
1802
1809
  const t = [];
1803
1810
  for (const s of e)
1804
1811
  s.role !== "user" || !s.attachments?.length || s.attachments.forEach((n, r) => {
@@ -1809,26 +1816,26 @@ function Vs(e) {
1809
1816
  });
1810
1817
  return t;
1811
1818
  }
1812
- function Ys(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
1819
+ function Qs(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
1813
1820
  const n = [
1814
- Qs(),
1815
- Zs()
1821
+ en(),
1822
+ tn()
1816
1823
  ].filter((r) => typeof r == "function");
1817
1824
  return () => {
1818
1825
  for (const r of n.reverse())
1819
1826
  r();
1820
1827
  };
1821
1828
  }
1822
- function Zs() {
1823
- return Re(globalThis, "getPageSnapshot", async () => zt());
1829
+ function tn() {
1830
+ return be(globalThis, "getPageSnapshot", async () => zt());
1824
1831
  }
1825
- function Qs() {
1826
- return Re(globalThis, "pageImages", {
1827
- inspectImage: async (t, s) => await tn(t, s)
1832
+ function en() {
1833
+ return be(globalThis, "pageImages", {
1834
+ inspectImage: async (t, s) => await sn(t, s)
1828
1835
  });
1829
1836
  }
1830
- async function tn(e, t = {}) {
1831
- const s = rn(t.name), n = await en(e);
1837
+ async function sn(e, t = {}) {
1838
+ const s = an(t.name), n = await nn(e);
1832
1839
  return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
1833
1840
  type: "pluno.pageImages.inspectImage",
1834
1841
  imageAttached: !1,
@@ -1846,15 +1853,15 @@ async function tn(e, t = {}) {
1846
1853
  imageAttachmentError: n.error
1847
1854
  };
1848
1855
  }
1849
- async function en(e) {
1856
+ async function nn(e) {
1850
1857
  return e instanceof Blob ? e.type.startsWith("image/") ? e.size === 0 ? { ok: !1, error: "Page image is empty." } : e.size > 8 * 1024 * 1024 ? { ok: !1, error: _e } : {
1851
1858
  ok: !0,
1852
1859
  mimeType: e.type,
1853
1860
  sizeBytes: e.size,
1854
- dataUrl: await an(e)
1855
- } : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof e != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : sn(e);
1861
+ dataUrl: await ln(e)
1862
+ } : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof e != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : rn(e);
1856
1863
  }
1857
- function sn(e) {
1864
+ function rn(e) {
1858
1865
  if (!e.startsWith("data:") || !e.includes(","))
1859
1866
  return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
1860
1867
  const [t, s] = e.slice(5).split(",", 2), n = t.split(";").map((a) => a.trim()).filter(Boolean), r = n[0] ?? "";
@@ -1865,7 +1872,7 @@ function sn(e) {
1865
1872
  const i = s.replace(/[ \t\r\n\f]+/g, "");
1866
1873
  if (!/^[A-Za-z0-9+/]*={0,2}$/.test(i))
1867
1874
  return { ok: !1, error: "Page image data URL has invalid base64." };
1868
- const o = nn(i);
1875
+ const o = on(i);
1869
1876
  return o === null ? { ok: !1, error: "Page image data URL has invalid base64." } : o === 0 ? { ok: !1, error: "Page image is empty." } : {
1870
1877
  ok: !0,
1871
1878
  mimeType: r,
@@ -1873,22 +1880,22 @@ function sn(e) {
1873
1880
  dataUrl: `data:${r};base64,${i}`
1874
1881
  };
1875
1882
  }
1876
- function nn(e) {
1883
+ function on(e) {
1877
1884
  if (e.length === 0 || e.length % 4 !== 0)
1878
1885
  return null;
1879
1886
  const t = e.length - e.replace(/=+$/, "").length;
1880
1887
  return t > 2 ? null : e.length / 4 * 3 - t;
1881
1888
  }
1882
- function rn(e) {
1889
+ function an(e) {
1883
1890
  return (typeof e == "string" ? e.trim() : "") || "Page image";
1884
1891
  }
1885
- function on(e) {
1892
+ function cn(e) {
1886
1893
  try {
1887
1894
  e();
1888
1895
  } catch {
1889
1896
  }
1890
1897
  }
1891
- function an(e) {
1898
+ function ln(e) {
1892
1899
  return new Promise((t, s) => {
1893
1900
  const n = new FileReader();
1894
1901
  n.onload = () => {
@@ -1902,7 +1909,7 @@ function an(e) {
1902
1909
  }
1903
1910
  async function pe(e, t) {
1904
1911
  const s = Object.getPrototypeOf(async function() {
1905
- }).constructor, n = e.timeoutMs ?? Xs, r = Date.now(), i = [];
1912
+ }).constructor, n = e.timeoutMs ?? Vs, r = Date.now(), i = [];
1906
1913
  let o;
1907
1914
  const a = {
1908
1915
  log: console.log,
@@ -1920,7 +1927,7 @@ async function pe(e, t) {
1920
1927
  o = window.setTimeout(() => f(l), n);
1921
1928
  })
1922
1929
  ]);
1923
- return h === l ? ln(n) : {
1930
+ return h === l ? dn(n) : {
1924
1931
  ok: !0,
1925
1932
  result: h,
1926
1933
  console: i,
@@ -1949,7 +1956,7 @@ async function pe(e, t) {
1949
1956
  t?.deactivate(), o !== void 0 && window.clearTimeout(o), console.log = a.log, console.info = a.info, console.warn = a.warn, console.error = a.error;
1950
1957
  }
1951
1958
  }
1952
- function cn(e, t) {
1959
+ function un(e, t) {
1953
1960
  if (!e || typeof e != "object")
1954
1961
  return;
1955
1962
  const s = e.sandboxFilesToken;
@@ -1993,7 +2000,7 @@ function cn(e, t) {
1993
2000
  }
1994
2001
  };
1995
2002
  }
1996
- function ln(e) {
2003
+ function dn(e) {
1997
2004
  return {
1998
2005
  ok: !1,
1999
2006
  exception: {
@@ -2007,10 +2014,10 @@ function ln(e) {
2007
2014
  }
2008
2015
  };
2009
2016
  }
2010
- function un(e) {
2017
+ function hn(e) {
2011
2018
  return e.replace(/\/+$/, "");
2012
2019
  }
2013
- function dn(e) {
2020
+ function pn(e) {
2014
2021
  const t = {
2015
2022
  sidepanel: "extension_sidepanel",
2016
2023
  browser_extension_page_ui: "extension_widget",
@@ -2022,18 +2029,18 @@ function dn(e) {
2022
2029
  };
2023
2030
  return e && e in t ? t[e] : e ?? "embedded_custom_ui";
2024
2031
  }
2025
- function hn(e) {
2032
+ function fn(e) {
2026
2033
  return e === "pluno" ? "scheduled_continuation" : e ?? "user";
2027
2034
  }
2028
- function pn(e, t = location.origin) {
2035
+ function gn(e, t = location.origin) {
2029
2036
  return /origin (?:is not allowed|does not match browser origin)/i.test(e) ? `Pluno widget blocked on ${t}: this domain is not allowed. Add ${t} in Pluno under Integration > Domains.` : null;
2030
2037
  }
2031
- function fn(e) {
2038
+ function mn(e) {
2032
2039
  const t = new URL("/api/product-agent/embed/ws", e);
2033
2040
  return t.protocol = t.protocol === "https:" ? "wss:" : "ws:", t.toString();
2034
2041
  }
2035
- function k() {
2036
- const e = Ne();
2042
+ function M() {
2043
+ const e = Oe();
2037
2044
  return {
2038
2045
  url: location.href,
2039
2046
  title: document.title,
@@ -2041,19 +2048,19 @@ function k() {
2041
2048
  ...e ? { plunoProductAgentUi: e } : {}
2042
2049
  };
2043
2050
  }
2044
- function gn() {
2051
+ function yn() {
2045
2052
  return {
2046
2053
  pageUrl: location.href,
2047
2054
  pageTitle: document.title,
2048
2055
  htmlContent: zt()
2049
2056
  };
2050
2057
  }
2051
- function mn(e) {
2052
- return st.add(e), Z || (Z = yn()), () => {
2058
+ function In(e) {
2059
+ return st.add(e), Z || (Z = Tn()), () => {
2053
2060
  st.delete(e), st.size === 0 && (Z?.(), Z = null);
2054
2061
  };
2055
2062
  }
2056
- function yn() {
2063
+ function Tn() {
2057
2064
  const e = () => {
2058
2065
  for (const i of Array.from(st))
2059
2066
  i();
@@ -2068,8 +2075,8 @@ function yn() {
2068
2075
  window.history.pushState === n && (window.history.pushState = t), window.history.replaceState === r && (window.history.replaceState = s), window.removeEventListener("popstate", e), window.removeEventListener("hashchange", e);
2069
2076
  };
2070
2077
  }
2071
- function In() {
2072
- return Ne()?.surface === "browser_extension_sdk_preview";
2078
+ function wn() {
2079
+ return Oe()?.surface === "browser_extension_sdk_preview";
2073
2080
  }
2074
2081
  function zt() {
2075
2082
  if (!document.body)
@@ -2080,16 +2087,16 @@ function zt() {
2080
2087
  };
2081
2088
  s("Selected text", window.getSelection()?.toString() ?? "");
2082
2089
  const n = "[role='dialog'], [role='alertdialog'], dialog[open], [aria-modal='true']", r = Array.from(document.querySelectorAll(n)).filter(
2083
- (d) => Ue(d) && !d.parentElement?.closest(n)
2090
+ (d) => Pe(d) && !d.parentElement?.closest(n)
2084
2091
  );
2085
2092
  for (const d of r.slice(0, 3))
2086
2093
  s("Active overlay", _t(z(d), t));
2087
- const i = Tn(), o = i ? _t(z(i), t) : "";
2094
+ const i = Sn(), o = i ? _t(z(i), t) : "";
2088
2095
  s("Main page content", o), s("Additional visible page text", _t(z(document.body), t));
2089
2096
  const a = e.map(([d, p]) => `${d}:
2090
2097
  ${p}`).join(`
2091
2098
 
2092
- `).trim().slice(0, 12e3), c = wn(r, i).trim(), l = `Simplified DOM outline:
2099
+ `).trim().slice(0, 12e3), c = An(r, i).trim(), l = `Simplified DOM outline:
2093
2100
  `, h = `
2094
2101
 
2095
2102
  Visible page text:
@@ -2113,14 +2120,14 @@ function _t(e, t) {
2113
2120
  s = s.replace(n, "");
2114
2121
  return B(s);
2115
2122
  }
2116
- function Ue(e) {
2123
+ function Pe(e) {
2117
2124
  const t = window.getComputedStyle(e);
2118
2125
  return t.display !== "none" && t.visibility !== "hidden" && e.getClientRects().length > 0;
2119
2126
  }
2120
- function Tn() {
2121
- return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Ue).sort((e, t) => z(t).length - z(e).length)[0] ?? null;
2127
+ function Sn() {
2128
+ return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Pe).sort((e, t) => z(t).length - z(e).length)[0] ?? null;
2122
2129
  }
2123
- function wn(e, t) {
2130
+ function An(e, t) {
2124
2131
  const s = /* @__PURE__ */ new Set([
2125
2132
  "main",
2126
2133
  "nav",
@@ -2200,7 +2207,7 @@ function wn(e, t) {
2200
2207
  "data-test",
2201
2208
  "data-qa",
2202
2209
  "data-cy"
2203
- ], l = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: h, priorityTargets: f } = Sn(), I = new Set(e);
2210
+ ], l = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: h, priorityTargets: f } = En(), I = new Set(e);
2204
2211
  t && I.add(t);
2205
2212
  let g = 0;
2206
2213
  const u = (T) => {
@@ -2211,24 +2218,24 @@ function wn(e, t) {
2211
2218
  return `${T.tagName.toLowerCase()}|${u(T)}|${D}`;
2212
2219
  }, p = (T, D, F) => {
2213
2220
  const C = (A, dt) => {
2214
- const R = A.tagName.toLowerCase(), ht = window.getComputedStyle(A), K = h.has(A);
2215
- if (g >= 1e3 && !K || F.has(A) || i.has(R) || A.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || ht.display === "none" || ht.visibility === "hidden")
2221
+ const b = A.tagName.toLowerCase(), ht = window.getComputedStyle(A), K = h.has(A);
2222
+ if (g >= 1e3 && !K || F.has(A) || i.has(b) || A.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || ht.display === "none" || ht.visibility === "hidden")
2216
2223
  return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
2217
2224
  g += 1;
2218
- const Vt = u(A), G = Oe(A), Ye = a.has(Vt) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(R) || R === "a" && A.hasAttribute("href"), pt = Array.from(A.children).filter((y) => y instanceof HTMLElement), X = /* @__PURE__ */ new Map();
2225
+ const Vt = u(A), G = ve(A), Ye = a.has(Vt) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(b) || b === "a" && A.hasAttribute("href"), pt = Array.from(A.children).filter((y) => y instanceof HTMLElement), X = /* @__PURE__ */ new Map();
2219
2226
  for (const y of pt) {
2220
2227
  const w = d(y);
2221
2228
  X.set(w, (X.get(w) ?? 0) + 1);
2222
2229
  }
2223
2230
  const ft = /* @__PURE__ */ new Map(), Yt = /* @__PURE__ */ new Map();
2224
2231
  for (const y of pt) {
2225
- const w = d(y), O = Yt.get(w) ?? 0;
2226
- Yt.set(w, O + 1), (X.get(w) ?? 0) > 8 && O >= 6 && !h.has(y) && ft.set(w, (ft.get(w) ?? 0) + 1);
2232
+ const w = d(y), v = Yt.get(w) ?? 0;
2233
+ Yt.set(w, v + 1), (X.get(w) ?? 0) > 8 && v >= 6 && !h.has(y) && ft.set(w, (ft.get(w) ?? 0) + 1);
2227
2234
  }
2228
2235
  const Zt = /* @__PURE__ */ new Map(), Qt = /* @__PURE__ */ new Set(), gt = [], te = [];
2229
2236
  for (const y of pt) {
2230
- const w = d(y), O = X.get(w) ?? 0, ne = Zt.get(w) ?? 0;
2231
- if (Zt.set(w, ne + 1), O > 8 && ne >= 6 && !h.has(y)) {
2237
+ const w = d(y), v = X.get(w) ?? 0, ne = Zt.get(w) ?? 0;
2238
+ if (Zt.set(w, ne + 1), v > 8 && ne >= 6 && !h.has(y)) {
2232
2239
  Qt.has(w) || (gt.push([`… ${ft.get(w) ?? 0} similar siblings omitted`]), Qt.add(w));
2233
2240
  continue;
2234
2241
  }
@@ -2241,9 +2248,9 @@ function wn(e, t) {
2241
2248
  y instanceof HTMLElement && mt.push(C(y, dt + 1));
2242
2249
  const J = [...te, ...mt], yt = G.length > 0 || Ye || J.some((y) => y.hasUsefulContent), ee = B(
2243
2250
  [G, ...J.map((y) => y.textPreview)].filter(Boolean).join(" ")
2244
- ).slice(0, 180), Ze = A.hasAttribute("contenteditable") && (G.length > 0 || !A.querySelector("[contenteditable]")), se = l.some((y) => A.hasAttribute(y)) || !!Vt || Ze, It = (A.getClientRects().length > 0 || ht.display === "contents") && (s.has(R) || se || K) && (yt || K) && (!r.has(R) || yt || se || K), Tt = It ? 1 : 0, H = [];
2251
+ ).slice(0, 180), Ze = A.hasAttribute("contenteditable") && (G.length > 0 || !A.querySelector("[contenteditable]")), se = l.some((y) => A.hasAttribute(y)) || !!Vt || Ze, It = (A.getClientRects().length > 0 || ht.display === "contents") && (s.has(b) || se || K) && (yt || K) && (!r.has(b) || yt || se || K), Tt = It ? 1 : 0, H = [];
2245
2252
  if (It) {
2246
- const y = J.some((O) => O.containsTextElement), w = n.has(R) && !y ? ee : G;
2253
+ const y = J.some((v) => v.containsTextElement), w = n.has(b) && !y ? ee : G;
2247
2254
  H.push(De(A, c, o, w.slice(0, 180)));
2248
2255
  }
2249
2256
  for (const y of gt)
@@ -2252,10 +2259,10 @@ function wn(e, t) {
2252
2259
  if (wt.length > 0) {
2253
2260
  const y = wt.slice(0, 20);
2254
2261
  wt.length > y.length && y.push("… shadow DOM omitted");
2255
- const w = R.includes("tooltip") || R.includes("popper") || R.includes("loader");
2262
+ const w = b.includes("tooltip") || b.includes("popper") || b.includes("loader");
2256
2263
  if (dt < 2 && !w) {
2257
- const O = It ? "#shadow-root" : `${R} #shadow-root`;
2258
- H.push(...Q([O, ...Q(y, 1)], Tt));
2264
+ const v = It ? "#shadow-root" : `${b} #shadow-root`;
2265
+ H.push(...Q([v, ...Q(y, 1)], Tt));
2259
2266
  } else
2260
2267
  H.push(...Q(y, Tt));
2261
2268
  }
@@ -2263,14 +2270,14 @@ function wn(e, t) {
2263
2270
  lines: H,
2264
2271
  hasUsefulContent: yt,
2265
2272
  textPreview: ee,
2266
- containsTextElement: n.has(R) || J.some((y) => y.containsTextElement)
2273
+ containsTextElement: n.has(b) || J.some((y) => y.containsTextElement)
2267
2274
  };
2268
2275
  };
2269
2276
  return [`--- ${D} ---`, ...C(T, 0).lines].join(`
2270
2277
  `);
2271
- }, m = [], b = B(window.getSelection()?.toString() ?? "");
2272
- b && m.push(`--- selected text ---
2273
- ${JSON.stringify(b)}`), f.length > 0 && m.push(An(f, s, c, o));
2278
+ }, m = [], E = B(window.getSelection()?.toString() ?? "");
2279
+ E && m.push(`--- selected text ---
2280
+ ${JSON.stringify(E)}`), f.length > 0 && m.push(Rn(f, s, c, o));
2274
2281
  for (const T of e.slice(0, 3))
2275
2282
  m.push(p(T, "active overlay DOM", /* @__PURE__ */ new Set()));
2276
2283
  if (t && m.push(p(t, "main DOM", /* @__PURE__ */ new Set())), document.body) {
@@ -2298,7 +2305,7 @@ function De(e, t, s, n) {
2298
2305
  e.hasAttribute(a) && (i += `[${a}]`);
2299
2306
  return `${i}${n ? ` ${JSON.stringify(n)}` : ""}`;
2300
2307
  }
2301
- function Sn() {
2308
+ function En() {
2302
2309
  const e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Map(), s = (a, c) => {
2303
2310
  if (!a)
2304
2311
  return;
@@ -2341,7 +2348,7 @@ function Sn() {
2341
2348
  priorityTargets: Array.from(t, ([a, c]) => ({ element: a, labels: Array.from(c) }))
2342
2349
  };
2343
2350
  }
2344
- function An(e, t, s, n) {
2351
+ function Rn(e, t, s, n) {
2345
2352
  const r = ["--- active/current elements ---"];
2346
2353
  for (const i of e) {
2347
2354
  const o = [];
@@ -2356,7 +2363,7 @@ function An(e, t, s, n) {
2356
2363
  h,
2357
2364
  s,
2358
2365
  n,
2359
- f === c.length - 1 ? Oe(h).slice(0, 180) : ""
2366
+ f === c.length - 1 ? ve(h).slice(0, 180) : ""
2360
2367
  ));
2361
2368
  o.length > c.length && l.splice(1, 0, "…"), r.push(`${i.labels.join(", ")}: ${l.join(" > ")}`);
2362
2369
  }
@@ -2372,7 +2379,7 @@ function Q(e, t) {
2372
2379
  const s = " ".repeat(t);
2373
2380
  return e.map((n) => `${s}${n}`);
2374
2381
  }
2375
- function Oe(e) {
2382
+ function ve(e) {
2376
2383
  return B(
2377
2384
  Array.from(e.childNodes).filter((t) => t.nodeType === Node.TEXT_NODE).map((t) => t.textContent ?? "").join(" ")
2378
2385
  );
@@ -2380,7 +2387,7 @@ function Oe(e) {
2380
2387
  function bn(e) {
2381
2388
  return e.length <= 64 && /^[A-Za-z_][A-Za-z0-9_:.-]*$/.test(e) && !/[a-f0-9]{12,}/i.test(e) && !/:r[0-9a-z]+:/i.test(e);
2382
2389
  }
2383
- function Ne() {
2390
+ function Oe() {
2384
2391
  const e = document.querySelector(ie);
2385
2392
  if (!(e ?? document.querySelector(Dt)))
2386
2393
  return;
@@ -2412,7 +2419,7 @@ function Ne() {
2412
2419
  ]
2413
2420
  };
2414
2421
  }
2415
- function En(e) {
2422
+ function Mn(e) {
2416
2423
  try {
2417
2424
  const t = JSON.parse(e);
2418
2425
  return t && typeof t == "object" ? t : { type: "error", message: "Invalid server event" };
@@ -2426,10 +2433,10 @@ function ge(e, t) {
2426
2433
  const s = e[t];
2427
2434
  return Array.isArray(s) ? s.filter((n) => typeof n == "string" && n.trim().length > 0) : [];
2428
2435
  }
2429
- function Rn(e) {
2436
+ function kn(e) {
2430
2437
  return Array.isArray(e) ? e.filter((t) => typeof t == "string" && t.trim().length > 0) : [];
2431
2438
  }
2432
- function kn(e) {
2439
+ function _n(e) {
2433
2440
  if (!e || typeof e != "object")
2434
2441
  return null;
2435
2442
  const t = e, s = t.appearance, n = s && typeof s == "object" ? s : t, 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;
@@ -2440,13 +2447,13 @@ function kn(e) {
2440
2447
  ...a !== null ? { scribbleStyle: a } : {}
2441
2448
  };
2442
2449
  }
2443
- function Mn(e) {
2450
+ function Cn(e) {
2444
2451
  if (!e || typeof e != "object")
2445
2452
  return null;
2446
2453
  const t = e.javascript;
2447
2454
  return typeof t != "string" || !t.trim() ? null : { javascript: t };
2448
2455
  }
2449
- function _n(e, t) {
2456
+ function Un(e, t) {
2450
2457
  return t ? e && typeof e == "object" ? {
2451
2458
  ...e,
2452
2459
  helperError: t
@@ -2456,13 +2463,13 @@ function _n(e, t) {
2456
2463
  helperError: t
2457
2464
  } : e;
2458
2465
  }
2459
- function Cn(e) {
2466
+ function Pn(e) {
2460
2467
  if (!e || typeof e != "object")
2461
2468
  return e;
2462
2469
  const t = e;
2463
2470
  return typeof t.exception?.message == "string" ? t.exception.message : typeof t.error == "string" ? t.error : e;
2464
2471
  }
2465
- function Pn() {
2472
+ function Dn() {
2466
2473
  const e = "pluno.productAgent.clientId", t = window.localStorage.getItem(e);
2467
2474
  if (t)
2468
2475
  return t;
@@ -2472,7 +2479,7 @@ function Pn() {
2472
2479
  function $() {
2473
2480
  return crypto.randomUUID();
2474
2481
  }
2475
- function Un(e) {
2482
+ function vn(e) {
2476
2483
  if (!e || typeof e != "object")
2477
2484
  return null;
2478
2485
  const t = e, s = typeof t.id == "string" ? t.id : null;
@@ -2483,22 +2490,22 @@ function Un(e) {
2483
2490
  avatarUrl: typeof t.avatarUrl == "string" ? t.avatarUrl : null
2484
2491
  } : null;
2485
2492
  }
2486
- function Dn(e, t) {
2493
+ function On(e, t) {
2487
2494
  return Array.isArray(e) ? Bt(
2488
- e.map((s) => ve(s, t)).filter((s) => s !== null)
2495
+ e.map((s) => Ne(s, t)).filter((s) => s !== null)
2489
2496
  ) : [];
2490
2497
  }
2491
- function On(e) {
2498
+ function Nn(e) {
2492
2499
  return Array.isArray(e) ? e.flatMap((t) => {
2493
2500
  if (!t || typeof t != "object")
2494
2501
  return [];
2495
- const s = t, n = E(s, "id"), r = E(s, "createdAt"), i = E(s, "updatedAt"), o = E(s, "lastActiveAt");
2502
+ const s = t, n = R(s, "id"), r = R(s, "createdAt"), i = R(s, "updatedAt"), o = R(s, "lastActiveAt");
2496
2503
  return !n || !r || !i || !o ? [] : [
2497
2504
  {
2498
2505
  id: n,
2499
- title: E(s, "title"),
2500
- customTitle: E(s, "customTitle"),
2501
- firstUserMessage: E(s, "firstUserMessage"),
2506
+ title: R(s, "title"),
2507
+ customTitle: R(s, "customTitle"),
2508
+ firstUserMessage: R(s, "firstUserMessage"),
2502
2509
  currentPage: s.currentPage ?? null,
2503
2510
  createdAt: r,
2504
2511
  updatedAt: i,
@@ -2509,7 +2516,7 @@ function On(e) {
2509
2516
  ];
2510
2517
  }) : [];
2511
2518
  }
2512
- function ve(e, t) {
2519
+ function Ne(e, t) {
2513
2520
  if (!e || typeof e != "object")
2514
2521
  return null;
2515
2522
  const s = e, n = s.data;
@@ -2524,12 +2531,12 @@ function ve(e, t) {
2524
2531
  role: i,
2525
2532
  ...r.phase === "commentary" || r.phase === "final_answer" ? { phase: r.phase } : {},
2526
2533
  content: os(
2527
- Fn(r.content),
2534
+ Wn(r.content),
2528
2535
  t
2529
2536
  ),
2530
2537
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
2531
- respondsToUserMessageId: N(r) ?? void 0,
2532
- ...M(r) ? { runId: M(r) } : {},
2538
+ respondsToUserMessageId: O(r) ?? void 0,
2539
+ ...k(r) ? { runId: k(r) } : {},
2533
2540
  attachments: He(r.attachments, t)
2534
2541
  };
2535
2542
  return i === "assistant" && typeof r.id == "string" && Object.defineProperty(o, "assistantDraftItemId", {
@@ -2548,21 +2555,21 @@ function ve(e, t) {
2548
2555
  role: "tool",
2549
2556
  content: "",
2550
2557
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
2551
- respondsToUserMessageId: N(r) ?? void 0,
2552
- ...M(r) ? { runId: M(r) } : {},
2558
+ respondsToUserMessageId: O(r) ?? void 0,
2559
+ ...k(r) ? { runId: k(r) } : {},
2553
2560
  dataType: "scheduled_check_in",
2554
- toolName: Me,
2561
+ toolName: ke,
2555
2562
  callId: Ct(r) ?? void 0,
2556
2563
  scheduledCheckInAt: i
2557
2564
  };
2558
- const o = vn(r.output);
2565
+ const o = Ln(r.output);
2559
2566
  return o ? {
2560
2567
  id: String(s.id ?? crypto.randomUUID()),
2561
2568
  role: "tool",
2562
2569
  content: `Connect ${o.appName} to continue`,
2563
2570
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
2564
- respondsToUserMessageId: N(r) ?? void 0,
2565
- ...M(r) ? { runId: M(r) } : {},
2571
+ respondsToUserMessageId: O(r) ?? void 0,
2572
+ ...k(r) ? { runId: k(r) } : {},
2566
2573
  dataType: "function_call_output",
2567
2574
  toolName: "authenticate_pipedream_app",
2568
2575
  callId: Ct(r) ?? void 0,
@@ -2572,10 +2579,10 @@ function ve(e, t) {
2572
2579
  return r.type === "function_call" || r.type === "tool_call" || r.type === "web_search_call" || r.type === "mcp_call" || r.type === "tab_lifecycle_decision" ? {
2573
2580
  id: String(s.id ?? crypto.randomUUID()),
2574
2581
  role: "tool",
2575
- content: r.type === "mcp_call" ? Nn(r) : Ln(r),
2582
+ content: r.type === "mcp_call" ? xn(r) : Bn(r),
2576
2583
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
2577
- respondsToUserMessageId: N(r) ?? void 0,
2578
- ...M(r) ? { runId: M(r) } : {},
2584
+ respondsToUserMessageId: O(r) ?? void 0,
2585
+ ...k(r) ? { runId: k(r) } : {},
2579
2586
  dataType: String(r.type),
2580
2587
  toolName: r.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof r.name == "string" ? r.name : void 0,
2581
2588
  callId: Ct(r) ?? void 0,
@@ -2583,10 +2590,10 @@ function ve(e, t) {
2583
2590
  } : r.type === "run_status" || r.type === "run_error" ? r.type === "run_error" && r.stage === "tool_execution" ? null : {
2584
2591
  id: String(s.id ?? crypto.randomUUID()),
2585
2592
  role: "system",
2586
- content: xn(r),
2593
+ content: qn(r),
2587
2594
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
2588
- respondsToUserMessageId: N(r) ?? void 0,
2589
- ...M(r) ? { runId: M(r) } : {},
2595
+ respondsToUserMessageId: O(r) ?? void 0,
2596
+ ...k(r) ? { runId: k(r) } : {},
2590
2597
  dataType: String(r.type),
2591
2598
  loading: r.type === "run_status" && (r.status === "running" || r.status === "retrying"),
2592
2599
  ...r.type === "run_status" && r.status === "steered" ? { steered: !0 } : {},
@@ -2594,11 +2601,11 @@ function ve(e, t) {
2594
2601
  ...typeof r.securitySettingsUrl == "string" ? { securitySettingsUrl: r.securitySettingsUrl } : {}
2595
2602
  } : null;
2596
2603
  }
2597
- function Nn(e) {
2604
+ function xn(e) {
2598
2605
  const s = (typeof e.server_label == "string" ? e.server_label : "").replace(/^pipedream_/, "").split(/[_-]+/).filter(Boolean).map((n) => `${n.charAt(0).toUpperCase()}${n.slice(1)}`).join(" ");
2599
2606
  return s ? `🔌 Using ${s}` : "🔌 Using connected integration";
2600
2607
  }
2601
- function vn(e) {
2608
+ function Ln(e) {
2602
2609
  if (typeof e != "string")
2603
2610
  return null;
2604
2611
  try {
@@ -2615,10 +2622,10 @@ function vn(e) {
2615
2622
  return null;
2616
2623
  }
2617
2624
  }
2618
- function xn(e) {
2625
+ function qn(e) {
2619
2626
  return e.type === "run_status" && e.status === "stopped" ? "Run stopped by user" : e.type === "run_status" && e.status === "steered" ? "Steered" : typeof e.message == "string" && e.message.trim().length > 0 ? e.message.replace(/Product Agent/g, "Pluno") : e.type === "run_status" && e.status === "interrupted" ? "Pluno was interrupted before it could finish this message." : "Pluno run status changed.";
2620
2627
  }
2621
- function Ln(e) {
2628
+ function Bn(e) {
2622
2629
  if (e.type === "web_search_call") {
2623
2630
  const t = e.action;
2624
2631
  if (t && typeof t == "object") {
@@ -2630,9 +2637,9 @@ function Ln(e) {
2630
2637
  }
2631
2638
  return "🔎 Searching the web";
2632
2639
  }
2633
- return qn(e);
2640
+ return Fn(e);
2634
2641
  }
2635
- function qn(e) {
2642
+ function Fn(e) {
2636
2643
  if (typeof e.summary == "string" && e.summary.trim().length > 0)
2637
2644
  return L(e.summary);
2638
2645
  if (typeof e.arguments == "string")
@@ -2649,7 +2656,7 @@ function L(e) {
2649
2656
  const t = e.trim() || "Run tool", s = t.codePointAt(0) ?? 0;
2650
2657
  return s >= 126976 && s <= 129791 || s >= 9728 && s <= 10175 || s >= 127462 && s <= 127487 ? t : `🛠️ ${t}`;
2651
2658
  }
2652
- function Bn(e) {
2659
+ function Hn(e) {
2653
2660
  if (e == null)
2654
2661
  return e;
2655
2662
  if (typeof e != "object")
@@ -2668,7 +2675,7 @@ function Ct(e) {
2668
2675
  const t = e.callId ?? e.call_id;
2669
2676
  return typeof t == "string" && t ? t : null;
2670
2677
  }
2671
- function Fn(e) {
2678
+ function Wn(e) {
2672
2679
  return typeof e == "string" ? e : Array.isArray(e) ? e.map((t) => {
2673
2680
  if (!t || typeof t != "object")
2674
2681
  return "";
@@ -2676,10 +2683,10 @@ function Fn(e) {
2676
2683
  return typeof s.text == "string" ? s.text : typeof s.content == "string" ? s.content : "";
2677
2684
  }).filter(Boolean).join("") : "";
2678
2685
  }
2679
- function Nt(e, t) {
2680
- const s = Le(e, t), n = Gn(
2681
- Hn(
2682
- Yn(e, t),
2686
+ function Ot(e, t) {
2687
+ const s = Le(e, t), n = Jn(
2688
+ $n(
2689
+ Qn(e, t),
2683
2690
  s
2684
2691
  ),
2685
2692
  s
@@ -2691,16 +2698,16 @@ function Nt(e, t) {
2691
2698
  const i = [...n];
2692
2699
  return i[r] = s, Bt(i);
2693
2700
  }
2694
- function Hn(e, t) {
2701
+ function $n(e, t) {
2695
2702
  const s = t.assistantDraftItemId;
2696
2703
  return s ? e.map(
2697
2704
  (n) => n.dataType === "assistant_draft" && n.id === s ? t : n
2698
2705
  ) : e;
2699
2706
  }
2700
- function Wn(e, t, s) {
2707
+ function jn(e, t, s) {
2701
2708
  return t !== null ? e.respondsToUserMessageId === t : s !== null && e.runId === s;
2702
2709
  }
2703
- function $n(e, t, s, n) {
2710
+ function zn(e, t, s, n) {
2704
2711
  if (s === null) return e;
2705
2712
  let r = -1;
2706
2713
  for (let o = e.length - 1; o >= 0; o -= 1) {
@@ -2717,12 +2724,12 @@ function $n(e, t, s, n) {
2717
2724
  respondsToUserMessageId: s
2718
2725
  }, i;
2719
2726
  }
2720
- function jn(e, t) {
2727
+ function Kn(e, t) {
2721
2728
  const s = e.findIndex(
2722
2729
  (r) => !r.id.startsWith("transient-activity:") && r.callId === t.callId
2723
2730
  );
2724
2731
  if (s === -1)
2725
- return Nt(e, t);
2732
+ return Ot(e, t);
2726
2733
  const n = [...e];
2727
2734
  return n[s] = {
2728
2735
  ...n[s],
@@ -2734,12 +2741,12 @@ function jn(e, t) {
2734
2741
  ...n[s].runId ? {} : { runId: t.runId }
2735
2742
  }, n;
2736
2743
  }
2737
- function zn(e, t, s) {
2744
+ function Gn(e, t, s) {
2738
2745
  let n = !1;
2739
2746
  const r = e.map((i) => i.callId !== t || i.loading === s ? i : (n = !0, { ...i, loading: s }));
2740
2747
  return n ? r : e;
2741
2748
  }
2742
- function Kn(e) {
2749
+ function Xn(e) {
2743
2750
  if (e.hiddenFromTranscript === !0)
2744
2751
  return null;
2745
2752
  const t = typeof e.callId == "string" ? e.callId : null, s = typeof e.toolName == "string" ? e.toolName : null;
@@ -2758,7 +2765,7 @@ function Kn(e) {
2758
2765
  loading: !0
2759
2766
  };
2760
2767
  }
2761
- function Gn(e, t) {
2768
+ function Jn(e, t) {
2762
2769
  if (t.id.startsWith("transient-activity:"))
2763
2770
  return e;
2764
2771
  const s = t.toolName === "tab_lifecycle";
@@ -2766,7 +2773,7 @@ function Gn(e, t) {
2766
2773
  (n) => !(n.id === `transient-activity:${t.callId}` && n.callId === t.callId || s && n.id.startsWith("transient-activity:") && n.toolName === "browser_tabs" && n.runId && n.runId === t.runId)
2767
2774
  );
2768
2775
  }
2769
- function Xn(e, t) {
2776
+ function Vn(e, t) {
2770
2777
  return as(
2771
2778
  e,
2772
2779
  t.map(
@@ -2776,7 +2783,7 @@ function Xn(e, t) {
2776
2783
  );
2777
2784
  }
2778
2785
  function xe(e) {
2779
- const t = vt(e) ?? void 0, s = e.assistantDraftItemId, n = [
2786
+ const t = Nt(e) ?? void 0, s = e.assistantDraftItemId, n = [
2780
2787
  ...e.callId ? [`call:${e.callId}`] : [],
2781
2788
  ...e.runId && (e.toolName === "browser_tabs" || e.toolName === "tab_lifecycle") ? [`tab-lifecycle:${e.runId}`] : []
2782
2789
  ];
@@ -2802,19 +2809,19 @@ function Le(e, t) {
2802
2809
  if (!s?.attachments?.length)
2803
2810
  return t;
2804
2811
  const n = t.attachments.map((r) => {
2805
- const i = Jn(s.attachments ?? [], r);
2806
- return i ? Vn(r, i) : r;
2812
+ const i = Yn(s.attachments ?? [], r);
2813
+ return i ? Zn(r, i) : r;
2807
2814
  });
2808
2815
  return { ...t, attachments: n };
2809
2816
  }
2810
- function Jn(e, t) {
2817
+ function Yn(e, t) {
2811
2818
  return t.id ? e.find((s) => s.id === t.id) ?? null : null;
2812
2819
  }
2813
- function Vn(e, t) {
2820
+ function Zn(e, t) {
2814
2821
  const { previewUrl: s } = t;
2815
2822
  return s ? { ...e, previewUrl: s } : e;
2816
2823
  }
2817
- function Yn(e, t) {
2824
+ function Qn(e, t) {
2818
2825
  if (t.role !== "user")
2819
2826
  return e;
2820
2827
  const s = e.findIndex(
@@ -2826,13 +2833,13 @@ function Yn(e, t) {
2826
2833
  return n.splice(s, 1), n;
2827
2834
  }
2828
2835
  function qe(e, t) {
2829
- const s = vt(e), n = vt(t);
2836
+ const s = Nt(e), n = Nt(t);
2830
2837
  return s && n ? s === n : e.content === t.content;
2831
2838
  }
2832
2839
  function Kt(e) {
2833
2840
  return e.role === "user" && (e.id.startsWith("local-") || e.id.startsWith("optimistic-user-message:"));
2834
2841
  }
2835
- function vt(e) {
2842
+ function Nt(e) {
2836
2843
  const t = e.clientMessageId;
2837
2844
  if (t)
2838
2845
  return t;
@@ -2852,7 +2859,7 @@ function me(e) {
2852
2859
  return n;
2853
2860
  for (let r = e.length - 1; r > t; r -= 1) {
2854
2861
  const i = e[r];
2855
- if (v(i))
2862
+ if (N(i))
2856
2863
  return !0;
2857
2864
  if (i.role === "system") {
2858
2865
  if (i.dataType === "run_error")
@@ -2863,14 +2870,14 @@ function me(e) {
2863
2870
  }
2864
2871
  return !1;
2865
2872
  }
2866
- function Zn(e) {
2873
+ function tr(e) {
2867
2874
  const t = Be(e);
2868
2875
  if (t === null)
2869
- return e.some(v);
2876
+ return e.some(N);
2870
2877
  const s = e[t].id;
2871
2878
  return e.some((n) => n.respondsToUserMessageId === s) ? e.some(
2872
- (n) => n.respondsToUserMessageId === s && v(n)
2873
- ) : e.slice(t + 1).some(v);
2879
+ (n) => n.respondsToUserMessageId === s && N(n)
2880
+ ) : e.slice(t + 1).some(N);
2874
2881
  }
2875
2882
  function Be(e) {
2876
2883
  for (let t = e.length - 1; t >= 0; t -= 1)
@@ -2879,7 +2886,7 @@ function Be(e) {
2879
2886
  return null;
2880
2887
  }
2881
2888
  function xt(e) {
2882
- return v(e) ? !0 : e.role !== "system" ? !1 : e.dataType === "run_error" ? !0 : e.dataType === "run_status" && e.loading !== !0;
2889
+ return N(e) ? !0 : e.role !== "system" ? !1 : e.dataType === "run_error" ? !0 : e.dataType === "run_status" && e.loading !== !0;
2883
2890
  }
2884
2891
  function at(e) {
2885
2892
  for (let t = e.length - 1; t >= 0; t -= 1) {
@@ -2895,7 +2902,7 @@ function at(e) {
2895
2902
  }
2896
2903
  return null;
2897
2904
  }
2898
- function Qn(e) {
2905
+ function er(e) {
2899
2906
  const t = at(e);
2900
2907
  if (t === null)
2901
2908
  return null;
@@ -2917,7 +2924,7 @@ function Lt(e) {
2917
2924
  function ye(e) {
2918
2925
  return e?.type === "run_status" && e.status === "interrupted" && e.reason === "backend_restart";
2919
2926
  }
2920
- function tr(e, t) {
2927
+ function sr(e, t) {
2921
2928
  const s = at(t);
2922
2929
  if (s === null)
2923
2930
  return !1;
@@ -2942,7 +2949,7 @@ function qt(e) {
2942
2949
  const r = n.clientMessageId;
2943
2950
  return typeof r == "string" ? r : null;
2944
2951
  }
2945
- function er(e) {
2952
+ function nr(e) {
2946
2953
  const t = at(e);
2947
2954
  if (t === null)
2948
2955
  return null;
@@ -2966,13 +2973,13 @@ function er(e) {
2966
2973
  function Ie(e, t) {
2967
2974
  if (typeof t.clientMessageId == "string")
2968
2975
  return t.clientMessageId;
2969
- const s = N(t);
2976
+ const s = O(t);
2970
2977
  if (!s)
2971
2978
  return null;
2972
- const n = e.find((i) => E(i, "id") === s), r = q(n);
2979
+ const n = e.find((i) => R(i, "id") === s), r = q(n);
2973
2980
  return r?.type === "message" && r.role === "user" && typeof r.clientMessageId == "string" ? r.clientMessageId : null;
2974
2981
  }
2975
- function sr(e, t) {
2982
+ function rr(e, t) {
2976
2983
  let s = 0;
2977
2984
  for (const n of e) {
2978
2985
  if (!n || typeof n != "object")
@@ -2986,38 +2993,38 @@ function sr(e, t) {
2986
2993
  return s;
2987
2994
  }
2988
2995
  function Te(e, t, s, n, r) {
2989
- if (!t || !nr(e))
2996
+ if (!t || !ir(e))
2990
2997
  return !1;
2991
2998
  const i = e;
2992
- return !(Lt(i) || s !== null && typeof i.id == "string" && i.id !== s || (n !== null ? N(i) !== n : r !== null && M(i) !== r));
2999
+ return !(Lt(i) || s !== null && typeof i.id == "string" && i.id !== s || (n !== null ? O(i) !== n : r !== null && k(i) !== r));
2993
3000
  }
2994
- function nr(e) {
3001
+ function ir(e) {
2995
3002
  if (!e || typeof e != "object")
2996
3003
  return !1;
2997
3004
  const t = e;
2998
3005
  return t.type === "message" && t.role === "assistant" ? !0 : t.type === "run_error" ? t.stage !== "tool_execution" : t.type === "run_status" && (t.status === "stopped" || t.status === "interrupted" || t.status === "failed");
2999
3006
  }
3000
- function v(e) {
3007
+ function N(e) {
3001
3008
  return e.role === "assistant" && e.phase !== "commentary";
3002
3009
  }
3003
- function rr(e) {
3010
+ function or(e) {
3004
3011
  if (!e || typeof e != "object")
3005
3012
  return !1;
3006
3013
  const t = e;
3007
3014
  return t.type === "message" && t.role === "user" ? !1 : t.type === "message" || t.type === "function_call" || t.type === "function_call_output" || t.type === "run_error" || t.type === "run_status";
3008
3015
  }
3009
3016
  function Bt(e) {
3010
- return e.filter((t, s) => ct(t) ? !hr(e, s) && !ur(e, s) && !dr(e, s) : ir(t) ? t.retryable === !0 && lr(e, s) ? !1 : !cr(e, s) : !0);
3017
+ return e.filter((t, s) => ct(t) ? !fr(e, s) && !hr(e, s) && !pr(e, s) : ar(t) ? t.retryable === !0 && dr(e, s) ? !1 : !ur(e, s) : !0);
3011
3018
  }
3012
- function ir(e) {
3019
+ function ar(e) {
3013
3020
  return e.role === "system" && (e.dataType === "run_error" || e.dataType === "run_status" && e.steered !== !0);
3014
3021
  }
3015
3022
  function ct(e) {
3016
3023
  return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
3017
3024
  }
3018
- function or(e, t) {
3025
+ function cr(e, t) {
3019
3026
  const s = [...e].reverse().find(
3020
- (n) => n.respondsToUserMessageId !== void 0 && n.respondsToUserMessageId !== t && we(n) && !ar(
3027
+ (n) => n.respondsToUserMessageId !== void 0 && n.respondsToUserMessageId !== t && we(n) && !lr(
3021
3028
  e,
3022
3029
  n.respondsToUserMessageId
3023
3030
  )
@@ -3029,12 +3036,12 @@ function or(e, t) {
3029
3036
  function we(e) {
3030
3037
  return e.role === "tool" || ct(e) ? !0 : e.role === "assistant" && e.phase === "commentary";
3031
3038
  }
3032
- function ar(e, t) {
3039
+ function lr(e, t) {
3033
3040
  return e.some(
3034
- (s) => s.respondsToUserMessageId === t && (v(s) || s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.loading !== !0))
3041
+ (s) => s.respondsToUserMessageId === t && (N(s) || s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.loading !== !0))
3035
3042
  );
3036
3043
  }
3037
- function cr(e, t) {
3044
+ function ur(e, t) {
3038
3045
  const s = e[t];
3039
3046
  for (let n = t + 1; n < e.length; n += 1) {
3040
3047
  const r = e[n];
@@ -3043,7 +3050,7 @@ function cr(e, t) {
3043
3050
  }
3044
3051
  return !1;
3045
3052
  }
3046
- function lr(e, t) {
3053
+ function dr(e, t) {
3047
3054
  const s = e[t];
3048
3055
  if (!s.respondsToUserMessageId)
3049
3056
  return !1;
@@ -3056,19 +3063,19 @@ function lr(e, t) {
3056
3063
  }
3057
3064
  return !1;
3058
3065
  }
3059
- function ur(e, t) {
3066
+ function hr(e, t) {
3060
3067
  const s = e[t];
3061
3068
  return e.some(
3062
3069
  (n, r) => r !== t && n.role === "assistant" && lt(s, n)
3063
3070
  );
3064
3071
  }
3065
- function dr(e, t) {
3072
+ function pr(e, t) {
3066
3073
  const s = e[t];
3067
3074
  return e.some(
3068
3075
  (n, r) => r !== t && n.role === "tool" && lt(s, n)
3069
3076
  );
3070
3077
  }
3071
- function hr(e, t) {
3078
+ function fr(e, t) {
3072
3079
  const s = e[t];
3073
3080
  for (let n = t + 1; n < e.length; n += 1)
3074
3081
  if (ct(e[n]) && lt(s, e[n]))
@@ -3078,10 +3085,10 @@ function hr(e, t) {
3078
3085
  function lt(e, t) {
3079
3086
  return !!(e.respondsToUserMessageId && e.respondsToUserMessageId === t.respondsToUserMessageId);
3080
3087
  }
3081
- function E(e, t) {
3088
+ function R(e, t) {
3082
3089
  return e && typeof e == "object" && typeof e[t] == "string" ? e[t] : null;
3083
3090
  }
3084
- function pr(e, t) {
3091
+ function gr(e, t) {
3085
3092
  try {
3086
3093
  const s = window.localStorage.getItem(`${Ce}${e}`);
3087
3094
  if (!s)
@@ -3098,22 +3105,22 @@ function pr(e, t) {
3098
3105
  return null;
3099
3106
  }
3100
3107
  }
3101
- function fr(e, t) {
3108
+ function mr(e, t) {
3102
3109
  try {
3103
3110
  window.localStorage.setItem(
3104
3111
  `${Ce}${e}`,
3105
3112
  JSON.stringify({
3106
3113
  sessionId: t.sessionId,
3107
- messages: t.messages.slice(-Fs).map(Er)
3114
+ messages: t.messages.slice(-Ws).map(Mr)
3108
3115
  })
3109
3116
  );
3110
3117
  } catch {
3111
3118
  return;
3112
3119
  }
3113
3120
  }
3114
- function gr(e) {
3121
+ function yr(e) {
3115
3122
  try {
3116
- const t = window.localStorage.getItem(`${Ot}${e}`);
3123
+ const t = window.localStorage.getItem(`${vt}${e}`);
3117
3124
  if (!t)
3118
3125
  return [];
3119
3126
  const s = JSON.parse(t);
@@ -3126,11 +3133,11 @@ function j(e, t) {
3126
3133
  try {
3127
3134
  const s = t.filter(Gt);
3128
3135
  if (s.length === 0) {
3129
- window.localStorage.removeItem(`${Ot}${e}`);
3136
+ window.localStorage.removeItem(`${vt}${e}`);
3130
3137
  return;
3131
3138
  }
3132
3139
  window.localStorage.setItem(
3133
- `${Ot}${e}`,
3140
+ `${vt}${e}`,
3134
3141
  JSON.stringify(s.slice(-25))
3135
3142
  );
3136
3143
  } catch {
@@ -3153,7 +3160,7 @@ function Fe(e, t) {
3153
3160
  } catch {
3154
3161
  }
3155
3162
  }
3156
- function mr(e, t) {
3163
+ function Ir(e, t) {
3157
3164
  try {
3158
3165
  if (window.sessionStorage.getItem(`${ot}${e}`) === null)
3159
3166
  return;
@@ -3162,19 +3169,19 @@ function mr(e, t) {
3162
3169
  }
3163
3170
  Fe(e, t);
3164
3171
  }
3165
- function yr(e) {
3172
+ function Tr(e) {
3166
3173
  try {
3167
3174
  const t = `${ot}${e}`, s = window.sessionStorage.getItem(t);
3168
3175
  if (window.sessionStorage.removeItem(t), !s)
3169
3176
  return [];
3170
3177
  const n = JSON.parse(s);
3171
- return Array.isArray(n) ? n.flatMap((r) => Tr(r) ? [{
3178
+ return Array.isArray(n) ? n.flatMap((r) => Sr(r) ? [{
3172
3179
  ...r.event,
3173
- page: k(),
3180
+ page: M(),
3174
3181
  rawOutput: {
3175
3182
  pageContextRestarted: !0,
3176
3183
  outcome: "unknown",
3177
- message: Ir(location.href),
3184
+ message: wr(location.href),
3178
3185
  currentUrl: location.href,
3179
3186
  console: [],
3180
3187
  metadata: {
@@ -3191,17 +3198,17 @@ function yr(e) {
3191
3198
  return [];
3192
3199
  }
3193
3200
  }
3194
- function Ir(e) {
3201
+ function wr(e) {
3195
3202
  return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
3196
3203
  Current URL: ${e}`;
3197
3204
  }
3198
- function Tr(e) {
3205
+ function Sr(e) {
3199
3206
  if (!e || typeof e != "object")
3200
3207
  return !1;
3201
3208
  const t = e, s = t.event;
3202
3209
  return typeof t.startedAtMs == "number" && typeof t.startedAtUrl == "string" && t.startedAtOrigin === location.origin && t.unloadOrigin === location.origin && typeof t.unloadUrl == "string" && Gt(s) && s.type === "tool.result";
3203
3210
  }
3204
- function wr(e, t) {
3211
+ function Ar(e, t) {
3205
3212
  const s = new Set(
3206
3213
  e.flatMap((n) => n.type === "tool.result" ? [n.callId] : [])
3207
3214
  );
@@ -3210,7 +3217,7 @@ function wr(e, t) {
3210
3217
  ...t.filter((n) => !s.has(n.callId))
3211
3218
  ];
3212
3219
  }
3213
- function Sr(e) {
3220
+ function Er(e) {
3214
3221
  try {
3215
3222
  window.sessionStorage.removeItem(`${ot}${e}`);
3216
3223
  } catch {
@@ -3247,9 +3254,9 @@ function We(e, t) {
3247
3254
  } : e;
3248
3255
  }
3249
3256
  function Ae(e) {
3250
- return e.type || Ar(e.name) || "application/octet-stream";
3257
+ return e.type || Rr(e.name) || "application/octet-stream";
3251
3258
  }
3252
- function Ar(e) {
3259
+ function Rr(e) {
3253
3260
  const t = e.toLowerCase();
3254
3261
  return t.endsWith(".png") ? "image/png" : t.endsWith(".jpg") || t.endsWith(".jpeg") ? "image/jpeg" : t.endsWith(".webp") ? "image/webp" : t.endsWith(".gif") ? "image/gif" : t.endsWith(".pdf") ? "application/pdf" : null;
3255
3262
  }
@@ -3271,7 +3278,7 @@ function br(e) {
3271
3278
  loading: typeof t.loading == "boolean" ? t.loading : void 0
3272
3279
  };
3273
3280
  }
3274
- function Er(e) {
3281
+ function Mr(e) {
3275
3282
  return e.attachments?.length ? {
3276
3283
  ...e,
3277
3284
  attachments: e.attachments.map(Xt)
@@ -3286,17 +3293,17 @@ function Xt(e) {
3286
3293
  } = e;
3287
3294
  return r;
3288
3295
  }
3289
- function N(e) {
3296
+ function O(e) {
3290
3297
  const t = e.respondsToUserMessageId;
3291
3298
  return typeof t == "string" && t ? t : null;
3292
3299
  }
3293
- function M(e) {
3300
+ function k(e) {
3294
3301
  const t = e.runId;
3295
3302
  return typeof t == "string" && t ? t : null;
3296
3303
  }
3297
- function Rr(e) {
3304
+ function kr(e) {
3298
3305
  const t = e?.timeoutMs;
3299
- return !!e && typeof e == "object" && typeof e.summary == "string" && typeof e.javascript == "string" && (t === void 0 || typeof t == "number" && Number.isInteger(t) && t > 0 && t <= Js);
3306
+ return !!e && typeof e == "object" && typeof e.summary == "string" && typeof e.javascript == "string" && (t === void 0 || typeof t == "number" && Number.isInteger(t) && t > 0 && t <= Ys);
3300
3307
  }
3301
3308
  function $e(e) {
3302
3309
  const t = {};
@@ -3310,22 +3317,22 @@ function $e(e) {
3310
3317
  return t;
3311
3318
  }
3312
3319
  function Jt(e, t) {
3313
- return Je(e) ? ut : P(it(t), qs);
3320
+ return Je(e) ? ut : U(it(t), Fs);
3314
3321
  }
3315
- function kr(e, t) {
3322
+ function _r(e, t) {
3316
3323
  return typeof e == "string" ? e : e instanceof URL ? e.toString() : t?.url ?? "";
3317
3324
  }
3318
- async function Mr(e, t, s, n) {
3325
+ async function Cr(e, t, s, n) {
3319
3326
  const r = $e(e.headers);
3320
3327
  n({
3321
3328
  ...t,
3322
3329
  responseStatus: e.status,
3323
3330
  responseHeaders: r,
3324
- responseBody: await _r(e),
3331
+ responseBody: await Ur(e),
3325
3332
  durationMs: Date.now() - s
3326
3333
  });
3327
3334
  }
3328
- async function _r(e) {
3335
+ async function Ur(e) {
3329
3336
  if (!je(e.headers))
3330
3337
  return;
3331
3338
  let t = null, s = null;
@@ -3335,7 +3342,7 @@ async function _r(e) {
3335
3342
  const n = new Promise((a) => {
3336
3343
  s = window.setTimeout(() => {
3337
3344
  t?.cancel(), a("timeout");
3338
- }, Bs);
3345
+ }, Hs);
3339
3346
  }), r = new TextDecoder();
3340
3347
  let i = "", o = 0;
3341
3348
  for (; ; ) {
@@ -3344,10 +3351,10 @@ async function _r(e) {
3344
3351
  return;
3345
3352
  const { done: c, value: l } = a;
3346
3353
  if (c)
3347
- return P(i + r.decode());
3354
+ return U(i + r.decode());
3348
3355
  const h = $t - o;
3349
3356
  if (l.byteLength > h)
3350
- return i += r.decode(l.subarray(0, Math.max(h, 0)), { stream: !0 }), t.cancel(), `${P(i)}... [truncated]`;
3357
+ return i += r.decode(l.subarray(0, Math.max(h, 0)), { stream: !0 }), t.cancel(), `${U(i)}... [truncated]`;
3351
3358
  o += l.byteLength, i += r.decode(l, { stream: !0 });
3352
3359
  }
3353
3360
  } catch {
@@ -3357,26 +3364,26 @@ async function _r(e) {
3357
3364
  s !== null && window.clearTimeout(s);
3358
3365
  }
3359
3366
  }
3360
- function Cr(e, t) {
3367
+ function Pr(e, t) {
3361
3368
  if (je(new Headers(t)))
3362
3369
  try {
3363
- return e.responseType === "" || e.responseType === "text" ? P(e.responseText ?? "") : void 0;
3370
+ return e.responseType === "" || e.responseType === "text" ? U(e.responseText ?? "") : void 0;
3364
3371
  } catch {
3365
3372
  return;
3366
3373
  }
3367
3374
  }
3368
- function be(e) {
3375
+ function Ee(e) {
3369
3376
  if (typeof e == "string")
3370
- return P(e);
3377
+ return U(e);
3371
3378
  }
3372
- function Pr(e) {
3379
+ function Dr(e) {
3373
3380
  return _({
3374
3381
  ...e,
3375
- requestBody: Ee(e.requestBody),
3376
- responseBody: Ee(e.responseBody)
3382
+ requestBody: Re(e.requestBody),
3383
+ responseBody: Re(e.responseBody)
3377
3384
  });
3378
3385
  }
3379
- function Ee(e) {
3386
+ function Re(e) {
3380
3387
  if (typeof e != "string")
3381
3388
  return e;
3382
3389
  const t = e.trim();
@@ -3395,7 +3402,7 @@ function je(e) {
3395
3402
  return s !== null && Number.isInteger(n) && n >= 0 && n <= $t && (t.startsWith("text/") || t.includes("json") || t.includes("javascript"));
3396
3403
  }
3397
3404
  function x(e, t = {}, s) {
3398
- if (Dr(s))
3405
+ if (Or(s))
3399
3406
  return !0;
3400
3407
  const n = Object.entries(t).find(([r]) => r.toLowerCase() === "content-type")?.[1]?.toLowerCase();
3401
3408
  if (n?.includes("multipart/form-data") || n?.includes("application/octet-stream"))
@@ -3410,7 +3417,7 @@ function x(e, t = {}, s) {
3410
3417
  return !0;
3411
3418
  }
3412
3419
  }
3413
- function Ur(e, t) {
3420
+ function vr(e, t) {
3414
3421
  if (x(e))
3415
3422
  return !0;
3416
3423
  try {
@@ -3420,10 +3427,10 @@ function Ur(e, t) {
3420
3427
  return !0;
3421
3428
  }
3422
3429
  }
3423
- function Dr(e) {
3430
+ function Or(e) {
3424
3431
  return e instanceof FormData || e instanceof Blob || e instanceof ArrayBuffer || ArrayBuffer.isView(e) || typeof ReadableStream < "u" && e instanceof ReadableStream;
3425
3432
  }
3426
- function Or(e) {
3433
+ function Nr(e) {
3427
3434
  const t = {};
3428
3435
  for (const s of e.trim().split(/[\r\n]+/)) {
3429
3436
  const n = s.indexOf(":");
@@ -3436,10 +3443,10 @@ function Or(e) {
3436
3443
  }
3437
3444
  return t;
3438
3445
  }
3439
- function P(e, t = $t) {
3446
+ function U(e, t = $t) {
3440
3447
  return e.length <= t ? e : `${e.slice(0, t)}... [truncated ${e.length - t} chars]`;
3441
3448
  }
3442
- function Pt(e) {
3449
+ function Ut(e) {
3443
3450
  return `${e}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
3444
3451
  }
3445
3452
  class nt extends Error {
@@ -3454,27 +3461,27 @@ async function tt(e, t) {
3454
3461
  try {
3455
3462
  return await e();
3456
3463
  } catch (r) {
3457
- if (s = r, n >= de - 1 || !vr(r))
3464
+ if (s = r, n >= de - 1 || !Lr(r))
3458
3465
  throw r;
3459
- await Nr(n);
3466
+ await xr(n);
3460
3467
  }
3461
3468
  throw s instanceof Error ? s : new Error(t);
3462
3469
  }
3463
- function Nr(e) {
3470
+ function xr(e) {
3464
3471
  return new Promise((t) => {
3465
- window.setTimeout(t, Ls[e] ?? 0);
3472
+ window.setTimeout(t, Bs[e] ?? 0);
3466
3473
  });
3467
3474
  }
3468
- function vr(e) {
3469
- return e instanceof nt ? xr(e.status) : e instanceof TypeError;
3475
+ function Lr(e) {
3476
+ return e instanceof nt ? qr(e.status) : e instanceof TypeError;
3470
3477
  }
3471
- function xr(e) {
3478
+ function qr(e) {
3472
3479
  return e === 408 || e === 409 || e === 429 || e >= 500;
3473
3480
  }
3474
- function Lr(e) {
3481
+ function Br(e) {
3475
3482
  return e === 401 || e === 403;
3476
3483
  }
3477
- const ut = "[REDACTED_SECRET]", U = "[REDACTED_TOKEN]", qr = "[REDACTED_SIGNED_URL]", Br = 20, Fr = /^(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, ze = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Ke = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, Ge = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Xe = /\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, Hr = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Wr = /\bhttps?:\/\/[^\s"'<>]+/gi, $r = /[),.;\]]+$/;
3484
+ const ut = "[REDACTED_SECRET]", P = "[REDACTED_TOKEN]", Fr = "[REDACTED_SIGNED_URL]", Hr = 20, Wr = /^(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, ze = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Ke = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, Ge = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Xe = /\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, $r = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, jr = /\bhttps?:\/\/[^\s"'<>]+/gi, zr = /[),.;\]]+$/;
3478
3485
  function _(e) {
3479
3486
  return rt(e, 0, /* @__PURE__ */ new WeakSet());
3480
3487
  }
@@ -3483,7 +3490,7 @@ function rt(e, t, s) {
3483
3490
  return e.startsWith("data:image/") || e.startsWith("data:application/pdf;") ? e : it(e);
3484
3491
  if (e === null || typeof e != "object")
3485
3492
  return e;
3486
- if (t >= Br)
3493
+ if (t >= Hr)
3487
3494
  return "[REDACTED_MAX_DEPTH]";
3488
3495
  if (s.has(e))
3489
3496
  return "[REDACTED_CIRCULAR]";
@@ -3491,34 +3498,34 @@ function rt(e, t, s) {
3491
3498
  return e.map((r) => rt(r, t + 1, s));
3492
3499
  const n = {};
3493
3500
  for (const [r, i] of Object.entries(e))
3494
- r === "pageContent" ? n[r] = i : Je(r) ? n[r] = ut : n[r] = r.toLowerCase() === "url" ? jr(i) : rt(i, t + 1, s);
3501
+ r === "pageContent" ? n[r] = i : Je(r) ? n[r] = ut : n[r] = r.toLowerCase() === "url" ? Kr(i) : rt(i, t + 1, s);
3495
3502
  return n;
3496
3503
  }
3497
3504
  function Je(e) {
3498
3505
  const t = e.replace(/[^a-z0-9]/gi, "").toLowerCase();
3499
3506
  return t.includes("authorization") || t.includes("cookie") || t.includes("password") || t.includes("passwd") || t === "pwd" || t.includes("secret") || t === "token" || t.endsWith("token") || t.includes("apikey") || t.includes("csrf") || t.includes("xsrf") || t === "jwt" || t === "session" || t === "signature" || t.includes("privatekey");
3500
3507
  }
3501
- function jr(e) {
3508
+ function Kr(e) {
3502
3509
  return typeof e == "string" ? Ve(e) : rt(e, 0, /* @__PURE__ */ new WeakSet());
3503
3510
  }
3504
3511
  function Ve(e) {
3505
3512
  try {
3506
3513
  const t = new URL(e, location.href);
3507
3514
  for (const s of Array.from(t.searchParams.keys()))
3508
- Fr.test(s) && t.searchParams.set(s, U);
3509
- return t.username && (t.username = U), t.password && (t.password = U), t.toString();
3515
+ Wr.test(s) && t.searchParams.set(s, P);
3516
+ return t.username && (t.username = P), t.password && (t.password = P), t.toString();
3510
3517
  } catch {
3511
- return zr(e);
3518
+ return Gr(e);
3512
3519
  }
3513
3520
  }
3514
3521
  function it(e) {
3515
- return e.replace(Hr, qr).replace(Wr, Kr).replace(ze, `Bearer ${U}`).replace(Ke, `Basic ${U}`).replace(Ge, U).replace(Xe, (t, s) => `${s}: ${ut}`);
3522
+ return e.replace($r, Fr).replace(jr, Xr).replace(ze, `Bearer ${P}`).replace(Ke, `Basic ${P}`).replace(Ge, P).replace(Xe, (t, s) => `${s}: ${ut}`);
3516
3523
  }
3517
- function zr(e) {
3518
- return e.replace(ze, `Bearer ${U}`).replace(Ke, `Basic ${U}`).replace(Ge, U).replace(Xe, (t, s) => `${s}: ${ut}`);
3524
+ function Gr(e) {
3525
+ return e.replace(ze, `Bearer ${P}`).replace(Ke, `Basic ${P}`).replace(Ge, P).replace(Xe, (t, s) => `${s}: ${ut}`);
3519
3526
  }
3520
- function Kr(e) {
3521
- const t = e.match($r)?.[0] ?? "", s = t ? e.slice(0, -t.length) : e;
3527
+ function Xr(e) {
3528
+ const t = e.match(zr)?.[0] ?? "", s = t ? e.slice(0, -t.length) : e;
3522
3529
  return `${Ve(s)}${t}`;
3523
3530
  }
3524
3531
  export {
@@ -3527,8 +3534,8 @@ export {
3527
3534
  Ss as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
3528
3535
  ws as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
3529
3536
  As as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
3530
- Pe as PlunoProductAgent,
3531
- Ws as calculateReconnectDelay,
3532
- Pe as default,
3533
- pn as getProductAgentOriginAccessErrorMessage
3537
+ Ue as PlunoProductAgent,
3538
+ js as calculateReconnectDelay,
3539
+ Ue as default,
3540
+ gn as getProductAgentOriginAccessErrorMessage
3534
3541
  };