@pluno/product-agent-web 0.1.178 → 0.1.180

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.
@@ -135,9 +135,9 @@ function Cs(t, e, s, n) {
135
135
  return !i.isActivity || !i.isTransient ? !0 : e !== null && i.respondsToUserMessageId !== void 0 ? i.respondsToUserMessageId !== e : s === null || i.runId !== s;
136
136
  });
137
137
  }
138
- const Oe = "pluno.productAgent.transportId", bs = "pluno.productAgent.transportIdentity", qe = "pluno.productAgent.transportIdentity.event", _s = 50, Ps = globalThis.setTimeout.bind(globalThis);
138
+ const Oe = "pluno.productAgent.transportId", bs = "pluno.productAgent.transportIdentity", Le = "pluno.productAgent.transportIdentity.event", _s = 50, Ps = globalThis.setTimeout.bind(globalThis);
139
139
  let ne = null;
140
- const me = /* @__PURE__ */ new Set(), Le = /* @__PURE__ */ new Map();
140
+ const me = /* @__PURE__ */ new Set(), qe = /* @__PURE__ */ new Map();
141
141
  async function Us(t = Wt()) {
142
142
  const e = t.randomUUID(), s = t.storage.getItem(Oe);
143
143
  let n = s ?? t.randomUUID(), r = !1, i = !1;
@@ -201,7 +201,7 @@ function vs() {
201
201
  function Wt() {
202
202
  return {
203
203
  storage: Os(),
204
- channel: qs(),
204
+ channel: Ls(),
205
205
  randomUUID: () => crypto.randomUUID(),
206
206
  settle: () => new Promise((t) => Ps(t, _s))
207
207
  };
@@ -210,13 +210,13 @@ function Os() {
210
210
  return {
211
211
  getItem: (t) => {
212
212
  try {
213
- return window.sessionStorage?.getItem(t) ?? Le.get(t) ?? null;
213
+ return window.sessionStorage?.getItem(t) ?? qe.get(t) ?? null;
214
214
  } catch {
215
- return Le.get(t) ?? null;
215
+ return qe.get(t) ?? null;
216
216
  }
217
217
  },
218
218
  setItem: (t, e) => {
219
- Le.set(t, e);
219
+ qe.set(t, e);
220
220
  try {
221
221
  window.sessionStorage?.setItem(t, e);
222
222
  } catch {
@@ -224,7 +224,7 @@ function Os() {
224
224
  }
225
225
  };
226
226
  }
227
- function qs() {
227
+ function Ls() {
228
228
  if (typeof BroadcastChannel < "u") {
229
229
  const t = new BroadcastChannel(bs);
230
230
  return {
@@ -236,11 +236,11 @@ function qs() {
236
236
  close: () => t.close()
237
237
  };
238
238
  }
239
- return Ls();
239
+ return qs();
240
240
  }
241
- function Ls() {
241
+ function qs() {
242
242
  const t = /* @__PURE__ */ new Set(), e = (s) => {
243
- if (s.key !== qe || !s.newValue)
243
+ if (s.key !== Le || !s.newValue)
244
244
  return;
245
245
  const n = JSON.parse(s.newValue);
246
246
  for (const r of t)
@@ -249,9 +249,9 @@ function Ls() {
249
249
  return window.addEventListener("storage", e), {
250
250
  postMessage: (s) => {
251
251
  window.localStorage.setItem(
252
- qe,
252
+ Le,
253
253
  JSON.stringify({ ...s, eventId: crypto.randomUUID() })
254
- ), window.localStorage.removeItem(qe);
254
+ ), window.localStorage.removeItem(Le);
255
255
  },
256
256
  subscribe: (s) => (t.add(s), () => t.delete(s)),
257
257
  close: () => {
@@ -273,8 +273,18 @@ function Ns(t) {
273
273
  const s = e;
274
274
  return s.ok !== !0 || s.toolName !== Ht || typeof s.dueAt != "string" || Number.isNaN(Date.parse(s.dueAt)) ? null : s.dueAt;
275
275
  }
276
- const xs = globalThis.fetch.bind(globalThis), Fe = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', Bs = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Ws = ".pluno-pa-widget__panel", Hs = ".pluno-pa-widget__timeline", pt = `${Fe}[data-pluno-sdk-preview-channel]`;
277
- let $s = 0;
276
+ const xs = [
277
+ { value: "gpt-5.6-terra", label: "gpt-5.6-terra" },
278
+ { value: "anthropic/claude-sonnet-5", label: "Claude Sonnet 5" },
279
+ { value: "deepseek/deepseek-v4-flash", label: "DeepSeek V4 Flash" }
280
+ ], Bs = [
281
+ { value: "anthropic/claude-opus-5", label: "Claude Opus 5" },
282
+ { value: "gpt-5.6-sol", label: "gpt-5.6-sol" }
283
+ ], Ws = [
284
+ ...xs,
285
+ ...Bs
286
+ ], Hs = (t) => Ws.some((e) => e.value === t), $s = globalThis.fetch.bind(globalThis), Fe = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', js = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Fs = ".pluno-pa-widget__panel", zs = ".pluno-pa-widget__timeline", pt = `${Fe}[data-pluno-sdk-preview-channel]`;
287
+ let Ks = 0;
278
288
  function gt(t) {
279
289
  const e = {};
280
290
  for (const o of [
@@ -325,7 +335,7 @@ function Ne(t, e, s) {
325
335
  source: "web_sdk",
326
336
  category: t,
327
337
  name: e,
328
- sequence: ++$s,
338
+ sequence: ++Ks,
329
339
  wallTime: (/* @__PURE__ */ new Date()).toISOString(),
330
340
  monotonicMs: performance.now(),
331
341
  data: s
@@ -334,27 +344,27 @@ function Ne(t, e, s) {
334
344
  }
335
345
  class ce extends Error {
336
346
  }
337
- function js(t) {
347
+ function Gs(t) {
338
348
  return t === 408 || t === 425 || t === 429 || t >= 500;
339
349
  }
340
- const Fs = "https://app.pluno.ai", zs = "gpt-5.6-terra", Ks = 2e4, Gs = 1e4, Xs = 1e4, Vs = 1e4, Js = 1e4, Ys = 3e3, Qs = 3e4, Zs = 1e3, ft = 3e4, mt = 0.2, yt = 6e4, It = 15e3, re = 8, Tt = "Browser connection was interrupted.", St = 15e3, en = "Pluno could not send this message. Try it again.", wt = 2e3, tn = 1e3, sn = 100, Mt = 8e3, At = 3, nn = [300, 1e3], $t = 50 * 1024 * 1024, rn = /* @__PURE__ */ new Set([
350
+ const Vs = "https://app.pluno.ai", Xs = 2e4, Js = 1e4, Ys = 1e4, Qs = 1e4, Zs = 1e4, en = 3e3, tn = 3e4, sn = 1e3, ft = 3e4, mt = 0.2, yt = 6e4, It = 15e3, re = 8, Tt = "Browser connection was interrupted.", St = 15e3, nn = "Pluno could not send this message. Try it again.", wt = 2e3, rn = 1e3, on = 100, Mt = 8e3, At = 3, an = [300, 1e3], $t = 50 * 1024 * 1024, ln = /* @__PURE__ */ new Set([
341
351
  ".jpeg:image/jpeg",
342
352
  ".jpg:image/jpeg",
343
353
  ".pdf:application/pdf",
344
354
  ".png:image/png",
345
355
  ".webp:image/webp"
346
- ]), Ii = ".pdf,.png,.jpg,.jpeg,.webp", et = 64e3, xe = 4e3, tt = 30, on = 2e3, an = 1e3, jt = "Image is too large for model vision input.", ln = 100, Ft = "pluno.productAgent.state.", ze = "pluno.productAgent.pendingEvents.", Ee = "pluno.productAgent.activeToolCalls.", un = 100;
356
+ ]), wi = ".pdf,.png,.jpg,.jpeg,.webp", et = 64e3, xe = 4e3, tt = 30, un = 2e3, cn = 1e3, jt = "Image is too large for model vision input.", dn = 100, Ft = "pluno.productAgent.state.", ze = "pluno.productAgent.pendingEvents.", Ee = "pluno.productAgent.activeToolCalls.", hn = 100;
347
357
  function ie(t, e = 0) {
348
358
  const s = t === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (t - 1));
349
359
  return Math.max(e, s);
350
360
  }
351
361
  const ye = /* @__PURE__ */ new Set();
352
362
  let de = null;
353
- function cn(t, e = Math.random) {
354
- const s = Math.min(ft, Zs * 2 ** t), n = 1 - mt + e() * mt * 2;
363
+ function pn(t, e = Math.random) {
364
+ const s = Math.min(ft, sn * 2 ** t), n = 1 - mt + e() * mt * 2;
355
365
  return Math.min(ft, Math.round(s * n));
356
366
  }
357
- function dn(t, e, s) {
367
+ function gn(t, e, s) {
358
368
  return new Promise((n, r) => {
359
369
  const i = setTimeout(() => r(new Error(s)), e);
360
370
  t.then(
@@ -371,9 +381,9 @@ class zt {
371
381
  constructor(e, s) {
372
382
  this.options = e, this.transportIdentity = s, this.state = {
373
383
  ...this.state,
374
- starterPrompts: Fn(e.initialStarterPrompts)
384
+ starterPrompts: Gn(e.initialStarterPrompts)
375
385
  };
376
- const n = e.restorePersistedState === !1 ? null : Nr(e.clientId, e.expectedPersistedSessionId);
386
+ const n = e.restorePersistedState === !1 ? null : Wr(e.clientId, e.expectedPersistedSessionId);
377
387
  n && (this.state = {
378
388
  ...this.state,
379
389
  ...n,
@@ -393,9 +403,9 @@ class zt {
393
403
  taskStatus: null,
394
404
  isRetrying: !1,
395
405
  lastError: null
396
- }), this.queuedClientEvents = jr(
397
- Br(e.clientId),
398
- Wr(e.clientId)
406
+ }), this.queuedClientEvents = Kr(
407
+ $r(e.clientId),
408
+ jr(e.clientId)
399
409
  );
400
410
  const r = [...this.queuedClientEvents].reverse().find(
401
411
  (i) => i.type === "chat.user_message" && typeof i.clientMessageId == "string"
@@ -507,11 +517,10 @@ class zt {
507
517
  static async init(e) {
508
518
  const s = await Ds(), n = new zt({
509
519
  ...e,
510
- backendUrl: _n(e.backendUrl ?? Fs),
511
- clientId: e.clientId ?? Vn(),
512
- model: e.model ?? zs,
520
+ backendUrl: Dn(e.backendUrl ?? Vs),
521
+ clientId: e.clientId ?? Qn(),
513
522
  productVariant: e.productVariant ?? "customer_embedded",
514
- entrySurface: Pn(e.entrySurface)
523
+ entrySurface: vn(e.entrySurface)
515
524
  }, s);
516
525
  try {
517
526
  Ts().catch((r) => {
@@ -545,14 +554,14 @@ class zt {
545
554
  this.state.status === "reconnecting" ? { status: "reconnecting" } : { status: "connecting", lastError: null }
546
555
  );
547
556
  try {
548
- if (this.token = this.options.token ?? (this.options.tokenProvider ? await dn(this.options.tokenProvider(), Xs, "Pluno token provider timed out") : null), e !== this.connectionAttemptId || this.state.status === "closed")
557
+ if (this.token = this.options.token ?? (this.options.tokenProvider ? await gn(this.options.tokenProvider(), Ys, "Pluno token provider timed out") : null), e !== this.connectionAttemptId || this.state.status === "closed")
549
558
  return;
550
559
  if (!this.token && !this.options.webSocketFactory)
551
560
  throw new Error("Pluno requires a token or tokenProvider");
552
- const s = vn(this.options.backendUrl), n = this.options.webSocketFactory?.(s) ?? new WebSocket(s);
561
+ const s = qn(this.options.backendUrl), n = this.options.webSocketFactory?.(s) ?? new WebSocket(s);
553
562
  this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
554
563
  this.socket === n && n.readyState === WebSocket.CONNECTING && (M("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.replaceTimedOutSocket(n));
555
- }, Vs), n.addEventListener("open", () => {
564
+ }, Qs), n.addEventListener("open", () => {
556
565
  this.socket !== n || (this.clearSocketConnectTimer(), M("web-sdk.agent", "Pluno socket opened", {
557
566
  queuedClientEventCount: this.queuedClientEvents.length,
558
567
  isThinking: this.state.isThinking
@@ -564,13 +573,13 @@ class zt {
564
573
  pageUrl: location.href
565
574
  }) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
566
575
  this.socket === n && (M("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.replaceTimedOutSocket(n));
567
- }, Js));
576
+ }, Zs));
568
577
  }), n.addEventListener("message", (r) => {
569
- this.socket === n && this.handleServerEvent($n(r.data));
578
+ this.socket === n && this.handleServerEvent(zn(r.data));
570
579
  }), n.addEventListener("sendfailure", (r) => {
571
580
  if (this.socket !== n)
572
581
  return;
573
- const i = jn(r?.detail?.data);
582
+ const i = Kn(r?.detail?.data);
574
583
  i?.type === "chat.user_message" && i.clientMessageId === this.pendingClientMessageId && !this.queuedClientEvents.some(
575
584
  (o) => o.type === "chat.user_message" && o.clientMessageId === i.clientMessageId
576
585
  ) && (this.queuedClientEvents.push(i), G(this.options.clientId, this.queuedClientEvents), this.setState({ pendingMessageStatus: "reconnecting" })), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), n.readyState !== WebSocket.CLOSED && n.readyState !== WebSocket.CLOSING && n.close();
@@ -606,7 +615,7 @@ class zt {
606
615
  this.connectionAttemptId += 1, this.setState({ status: "closed", pendingMessageStatus: null, isThinking: !1, isRetrying: !1 }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.clearStarterPromptUrlRefreshTimer(), this.clearRetryTimers(), this.clearThinkingWatchdog(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.clearSessionLoadRequest(), this.rejectPendingSessionHistoryRequests("Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionPinRequests, "Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionRenameRequests, "Pluno disconnected."), this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.queuedClientEvents = [], this.pendingWidgetLifecycleEvents = [], this.clearPendingWarmupAckTimer(), this.pendingPassiveWarmupEvent = null, this.pendingComposerWarmup = null, this.activeComposerWarmupId = null, this.activeComposerWarmupScope = null, this.nonTranscriptToolCallIds.clear(), this.socket?.close(), this.socket = null;
607
616
  }
608
617
  destroy() {
609
- this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), Fr(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
618
+ this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), Gr(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
610
619
  for (const e of Object.values(this.listeners))
611
620
  e?.clear();
612
621
  }
@@ -617,7 +626,8 @@ class zt {
617
626
  ...e === "composer_input" ? { warmupId: r?.event.warmupId ?? N() } : {},
618
627
  entrySurface: this.options.entrySurface,
619
628
  sessionId: this.state.sessionId ?? void 0,
620
- page: s
629
+ page: s,
630
+ model: this.options.model
621
631
  };
622
632
  if (e === "composer_input") {
623
633
  if (this.options.productVariant === "customer_embedded") {
@@ -712,7 +722,7 @@ class zt {
712
722
  sessionId: this.state.sessionId ?? void 0,
713
723
  clientMessageId: a,
714
724
  initiatedBy: s.initiatedBy,
715
- invocation: Un(s.invocation ?? s.initiatedBy),
725
+ invocation: On(s.invocation ?? s.initiatedBy),
716
726
  entrySurface: this.options.entrySurface,
717
727
  content: n,
718
728
  pageContent: T && st() || void 0,
@@ -723,6 +733,12 @@ class zt {
723
733
  };
724
734
  return s.initiatedBy || (this.lastUserMessagePageUrl = o.url), this.pendingClientMessageId = a, this.pendingUserMessageEvent = k, this.send(k), this.schedulePendingDeliveryAck(a), a;
725
735
  }
736
+ getModel() {
737
+ return this.options.model;
738
+ }
739
+ setModel(e) {
740
+ this.options.model = e;
741
+ }
726
742
  retryLastMessage() {
727
743
  const e = this.state.sessionId, s = this.retryableClientMessageId;
728
744
  if (!s)
@@ -739,7 +755,7 @@ class zt {
739
755
  return e ? (this.retryAttemptsByClientMessageId[s] = 0, this.recoveryExhaustionRequestedClientMessageIds.delete(s), this.retryableClientMessageId = null, this.activeClientMessageId = s, this.latestRecoverableClientMessageId = s, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), this.markThinkingProgress(), this.send({ type: "chat.retry_last_user_message", sessionId: e, clientMessageId: s, automatic: !1 }), !0) : !1;
740
756
  }
741
757
  createLocalAttachment(e) {
742
- this.options.productVariant === "customer_embedded" && zr(e);
758
+ this.options.productVariant === "customer_embedded" && Vr(e);
743
759
  const s = N(), n = {
744
760
  id: s,
745
761
  name: e.name || "attachment",
@@ -845,7 +861,7 @@ class zt {
845
861
  const n = await this.fetchEmbedAttachmentUpload(e);
846
862
  if (n.ok)
847
863
  return await n.json();
848
- if (li(n.status) && this.options.tokenProvider && !s) {
864
+ if (di(n.status) && this.options.tokenProvider && !s) {
849
865
  s = !0;
850
866
  const r = await this.fetchEmbedAttachmentUpload(e);
851
867
  if (r.ok)
@@ -870,7 +886,7 @@ class zt {
870
886
  if (!this.state.sessionId)
871
887
  return;
872
888
  this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "user_requested" });
873
- const e = Cr(
889
+ const e = Pr(
874
890
  this.state.messages,
875
891
  this.state.assistantDraftRespondsToUserMessageId,
876
892
  this.state.assistantDraftRunId,
@@ -893,7 +909,7 @@ class zt {
893
909
  }), this.stoppedTurns.splice(0, Math.max(0, this.stoppedTurns.length - 20));
894
910
  for (const [s, n] of this.activeBrowserToolCalls)
895
911
  n.event.sessionId === this.state.sessionId && this.activeBrowserToolCalls.delete(s);
896
- qt(this.options.clientId, this.activeBrowserToolCalls.values()), this.setState({
912
+ Lt(this.options.clientId, this.activeBrowserToolCalls.values()), this.setState({
897
913
  messages: vt(
898
914
  this.state.messages,
899
915
  e.clientMessageId,
@@ -910,7 +926,7 @@ class zt {
910
926
  }
911
927
  startNewSession(e = {}) {
912
928
  const s = e.notifyTransport !== !1, n = this.activeComposerWarmupId;
913
- !this.options.keepRunsActiveOnSessionNavigation && s && this.state.sessionId && (this.state.isThinking || this.state.pendingMessageStatus !== null) && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "new_chat" }), this.rememberCurrentRunAsBackground(), this.clearPendingComposerWarmup(), this.cleanupSessionBrowserApis(), this.queuedClientEvents = this.queuedClientEvents.filter((r) => r.type !== "chat.user_message"), this.clearThinkingWatchdog(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.retryableClientMessageId = null, this.lastUserMessagePageUrl = null, this.clearSessionLoadRequest(), this.sessionItemsRequestId = null, this.sessionItemsCursor = null, this.hasLoadedOlderSessionItems = !1, this.loadedOlderSessionItemIds.clear(), this.retryAttemptsByClientMessageId = {}, this.thinkingWatchdogResyncAttemptsByClientMessageId = {}, this.nonTranscriptToolCallIds.clear(), s && this.send({
929
+ !this.options.keepRunsActiveOnSessionNavigation && s && this.state.sessionId && (this.state.isThinking || this.state.pendingMessageStatus !== null) && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "new_chat" }), this.rememberCurrentRunAsBackground(), this.clearPendingComposerWarmup(), this.cleanupSessionBrowserApis(), this.queuedClientEvents = this.queuedClientEvents.filter((r) => r.type !== "chat.user_message"), this.clearThinkingWatchdog(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.retryableClientMessageId = null, this.lastUserMessagePageUrl = null, this.clearSessionLoadRequest(), this.sessionItemsRequestId = null, this.sessionItemsCursor = null, this.hasLoadedOlderSessionItems = !1, this.loadedOlderSessionItemIds.clear(), this.retryAttemptsByClientMessageId = {}, this.thinkingWatchdogResyncAttemptsByClientMessageId = {}, this.nonTranscriptToolCallIds.clear(), this.options.productVariant === "personal" && (this.options.model = void 0), s && this.send({
914
930
  type: "session.reset",
915
931
  sessionId: this.state.sessionId ?? void 0,
916
932
  warmupId: n ?? void 0,
@@ -1093,7 +1109,7 @@ class zt {
1093
1109
  });
1094
1110
  if (!u.ok) {
1095
1111
  const p = await u.text() || `History request failed (${u.status})`;
1096
- throw js(u.status) ? new Error(p) : new ce(p);
1112
+ throw Gs(u.status) ? new Error(p) : new ce(p);
1097
1113
  }
1098
1114
  const d = await u.json();
1099
1115
  if (!d?.session || !Array.isArray(d.items))
@@ -1132,7 +1148,7 @@ class zt {
1132
1148
  });
1133
1149
  }
1134
1150
  send(e) {
1135
- this.sendNow(q(e)) || (e.type === "chat.user_message" && typeof e.clientMessageId == "string" && this.queuedClientEvents.some(
1151
+ this.sendNow(L(e)) || (e.type === "chat.user_message" && typeof e.clientMessageId == "string" && this.queuedClientEvents.some(
1136
1152
  (r) => r.type === "chat.user_message" && r.clientMessageId === e.clientMessageId
1137
1153
  ) || this.queuedClientEvents.push(e), G(this.options.clientId, this.queuedClientEvents), this.setState({
1138
1154
  status: "reconnecting",
@@ -1194,9 +1210,9 @@ class zt {
1194
1210
  if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
1195
1211
  return;
1196
1212
  this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
1197
- const e = On();
1213
+ const e = Nn();
1198
1214
  this.sendNow(
1199
- q({
1215
+ L({
1200
1216
  type: "starter_prompts.page_context",
1201
1217
  pageUrl: e.pageUrl,
1202
1218
  pageTitle: e.pageTitle,
@@ -1205,13 +1221,13 @@ class zt {
1205
1221
  ) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
1206
1222
  }
1207
1223
  startStarterPromptUrlWatcher() {
1208
- this.locationChangeCleanup || (this.locationChangeCleanup = qn(() => this.handleStarterPromptUrlChange()));
1224
+ this.locationChangeCleanup || (this.locationChangeCleanup = xn(() => this.handleStarterPromptUrlChange()));
1209
1225
  }
1210
1226
  handleStarterPromptUrlChange() {
1211
1227
  const e = location.href;
1212
1228
  e !== this.lastStarterPromptPageUrl && (this.activeComposerWarmupScope && !this.activeComposerWarmupScope.endsWith(`:${e}`) && this.clearPendingComposerWarmup(), this.lastStarterPromptPageUrl = e, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
1213
1229
  this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
1214
- }, un));
1230
+ }, hn));
1215
1231
  }
1216
1232
  refreshStarterPromptsForCurrentUrl() {
1217
1233
  this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
@@ -1229,7 +1245,7 @@ class zt {
1229
1245
  G(this.options.clientId, this.queuedClientEvents);
1230
1246
  for (let s = 0; s < e.length; s += 1) {
1231
1247
  const n = e[s];
1232
- if (!this.sendNow(q(n))) {
1248
+ if (!this.sendNow(L(n))) {
1233
1249
  this.queuedClientEvents.unshift(n, ...e.slice(s + 1)), G(this.options.clientId, this.queuedClientEvents);
1234
1250
  return;
1235
1251
  }
@@ -1258,8 +1274,8 @@ class zt {
1258
1274
  return;
1259
1275
  this.clearPendingWarmupAckTimer();
1260
1276
  const s = Math.min(
1261
- Ys * 2 ** e.retryAttempt,
1262
- Qs
1277
+ en * 2 ** e.retryAttempt,
1278
+ tn
1263
1279
  );
1264
1280
  e.retryAttempt += 1, this.pendingWarmupAckTimer = window.setTimeout(() => {
1265
1281
  this.pendingWarmupAckTimer = null, this.flushPendingComposerWarmup();
@@ -1376,16 +1392,16 @@ class zt {
1376
1392
  this.activeResponseRunId = s, this.setState({ turnPhase: "thinking", lastError: null }), this.markThinkingProgress();
1377
1393
  return;
1378
1394
  }
1379
- if (gn(e) && this.markThinkingProgress(), e.type === "auth.ok") {
1395
+ if (yn(e) && this.markThinkingProgress(), e.type === "auth.ok") {
1380
1396
  this.clearSocketAuthTimer(), this.reconnectAttempts = 0;
1381
- const s = Jn(e.user);
1397
+ const s = Zn(e.user);
1382
1398
  this.authenticatedSocket !== this.socket && this.authenticatedUserId && s && s.id !== this.authenticatedUserId && this.resetForAuthenticationScopeChange(), this.authenticatedUserId = s?.id ?? null, this.authenticatedSocket = this.socket, this.flushPendingWidgetLifecycleEvents(), this.flushPendingComposerWarmup(), this.flushQueuedClientEvents(), this.pendingClientMessageId && (this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(this.pendingClientMessageId)), this.flushPendingPassiveWarmup(), this.startHeartbeat();
1383
- const n = zn(e), r = Object.prototype.hasOwnProperty.call(e, "appearance");
1399
+ const n = Vn(e), r = Object.prototype.hasOwnProperty.call(e, "appearance");
1384
1400
  M("web-sdk.agent", "Received auth.ok appearance", {
1385
1401
  hasAppearance: r,
1386
1402
  rawAppearance: e.appearance,
1387
1403
  normalizedAppearance: n
1388
- }), this.runtimeHelperJavascript = Kn(e.runtimeHelpers)?.javascript ?? null;
1404
+ }), this.runtimeHelperJavascript = Xn(e.runtimeHelpers)?.javascript ?? null;
1389
1405
  const i = bt(e, "starterPrompts"), o = Object.prototype.hasOwnProperty.call(e, "starterPrompts"), a = e.starterPromptsLoading === !0, l = {
1390
1406
  user: s,
1391
1407
  status: "connected",
@@ -1410,7 +1426,7 @@ class zt {
1410
1426
  const s = Array.isArray(e.items) ? e.items : [], n = S(e.session, "id") ?? this.state.sessionId, r = typeof e.requestId == "string" ? e.requestId : null;
1411
1427
  if (r && r !== this.sessionLoadRequestId || this.state.isLoadingSession && n !== this.state.sessionId)
1412
1428
  return;
1413
- n === this.state.sessionId && (this.clearSessionLoadRequest(), !this.hasLoadedOlderSessionItems && this.sessionItemsRequestId === null && (this.sessionItemsCursor = typeof e.itemsNextCursor == "string" ? e.itemsNextCursor : null));
1429
+ this.updatePersonalModelFromSession(e.session), n === this.state.sessionId && (this.clearSessionLoadRequest(), !this.hasLoadedOlderSessionItems && this.sessionItemsRequestId === null && (this.sessionItemsCursor = typeof e.itemsNextCursor == "string" ? e.itemsNextCursor : null));
1414
1430
  for (const E of s)
1415
1431
  this.rememberDurablyStoppedTurn(
1416
1432
  n,
@@ -1423,7 +1439,7 @@ class zt {
1423
1439
  runId: a?.runId
1424
1440
  }), u = this.filterStoppedSnapshotItems(s, n), d = e.pendingMessageStatus === "sending" ? "sending" : e.pendingMessageStatus === "queued" ? "reconnecting" : null, p = typeof e.pendingClientMessageId == "string" ? e.pendingClientMessageId : null, I = e.isRetrying === !0, f = e.turnPhase === "sending" || e.turnPhase === "starting" || e.turnPhase === "thinking" ? e.turnPhase : null;
1425
1441
  d && p && (this.pendingClientMessageId = p);
1426
- let c = rr(
1442
+ let c = ar(
1427
1443
  e.assistantDraft
1428
1444
  );
1429
1445
  c && this.findStoppedTurn(n, {
@@ -1432,9 +1448,9 @@ class zt {
1432
1448
  }) && (c = void 0);
1433
1449
  const h = c !== void 0;
1434
1450
  this.rememberUserMessageClientMessageIds(u);
1435
- const g = wr(u);
1451
+ const g = Rr(u);
1436
1452
  if (g) {
1437
- const E = Mr(u, g);
1453
+ const E = Er(u, g);
1438
1454
  this.retryAttemptsByClientMessageId[g] = Math.max(
1439
1455
  this.retryAttemptsByClientMessageId[g] ?? 0,
1440
1456
  E
@@ -1442,11 +1458,11 @@ class zt {
1442
1458
  }
1443
1459
  const T = u.filter((E) => {
1444
1460
  const O = P(E);
1445
- return Ut(O) ? !1 : !O || !g || !we(O) ? !0 : Xe(u, O) !== g;
1446
- }), k = hr(
1461
+ return Ut(O) ? !1 : !O || !g || !we(O) ? !0 : Ve(u, O) !== g;
1462
+ }), k = fr(
1447
1463
  this.state.messages,
1448
1464
  _t(T, this.options.backendUrl)
1449
- ), m = this.hasLoadedOlderSessionItems ? pr(
1465
+ ), m = this.hasLoadedOlderSessionItems ? mr(
1450
1466
  this.state.messages,
1451
1467
  k,
1452
1468
  this.loadedOlderSessionItemIds
@@ -1457,14 +1473,14 @@ class zt {
1457
1473
  D,
1458
1474
  R,
1459
1475
  ee,
1460
- Ar(u, O)
1476
+ kr(u, O)
1461
1477
  )
1462
- ), te = h ? c?.content ?? "" : this.state.assistantDraft, z = !!c?.content && !C, $ = w && (!te || C), K = Ir(m), V = $ && K ? "completed" : l ? "stopped" : $ ? "failed" : null;
1463
- if (!w && Sr(this.state.messages, u))
1478
+ ), te = h ? c?.content ?? "" : this.state.assistantDraft, z = !!c?.content && !C, $ = w && (!te || C), K = wr(m), X = $ && K ? "completed" : l ? "stopped" : $ ? "failed" : null;
1479
+ if (!w && Ar(this.state.messages, u))
1464
1480
  return;
1465
- this.lastUserMessagePageUrl = Tr(u);
1466
- const L = $ || l ? null : Ge(u);
1467
- if (this.latestRecoverableClientMessageId = L, K && this.clearRetryTimers(), this.setState({
1481
+ this.lastUserMessagePageUrl = Mr(u);
1482
+ const q = $ || l ? null : Ge(u);
1483
+ if (this.latestRecoverableClientMessageId = q, K && this.clearRetryTimers(), this.setState({
1468
1484
  sessionId: S(e.session, "id") ?? this.state.sessionId,
1469
1485
  messages: m,
1470
1486
  isLoadingSession: !1,
@@ -1473,7 +1489,7 @@ class zt {
1473
1489
  ...d ? { pendingMessageStatus: d } : {},
1474
1490
  ...f ? { turnPhase: f } : {},
1475
1491
  isRetrying: I,
1476
- ...V && this.state.taskStatus === "working" ? { taskStatus: V } : {},
1492
+ ...X && this.state.taskStatus === "working" ? { taskStatus: X } : {},
1477
1493
  ...C ? {
1478
1494
  assistantDraft: "",
1479
1495
  assistantDraftItemId: null,
@@ -1497,16 +1513,16 @@ class zt {
1497
1513
  lastError: null,
1498
1514
  lastErrorCode: null,
1499
1515
  lastErrorSecuritySettingsUrl: null
1500
- } : L ? {
1516
+ } : q ? {
1501
1517
  isThinking: !0,
1502
1518
  turnPhase: f ?? this.state.turnPhase ?? "starting",
1503
1519
  lastError: null
1504
1520
  } : {}
1505
1521
  }), $)
1506
1522
  this.retryableClientMessageId = null, this.clearThinkingWatchdog();
1507
- else if (!l && (z || L)) {
1508
- if (L) {
1509
- this.activeClientMessageId = L;
1523
+ else if (!l && (z || q)) {
1524
+ if (q) {
1525
+ this.activeClientMessageId = q;
1510
1526
  const E = Z(u), O = E === null ? null : u[E];
1511
1527
  this.activeResponseUserMessageId = S(O, "id");
1512
1528
  }
@@ -1538,7 +1554,7 @@ class zt {
1538
1554
  if (e.type === "sessions.page") {
1539
1555
  const s = typeof e.requestId == "string" ? e.requestId : null, n = s ? this.pendingSessionHistoryRequests.get(s) : null;
1540
1556
  s && n && (window.clearTimeout(n.timeout), this.pendingSessionHistoryRequests.delete(s), n.resolve({
1541
- sessions: Yn(e.sessions),
1557
+ sessions: er(e.sessions),
1542
1558
  nextCursor: typeof e.nextCursor == "string" ? e.nextCursor : null
1543
1559
  }));
1544
1560
  return;
@@ -1557,7 +1573,7 @@ class zt {
1557
1573
  s && typeof e.warmupId == "string" && e.warmupId === this.pendingComposerWarmup?.event.warmupId && (this.pendingComposerWarmup.event = {
1558
1574
  ...this.pendingComposerWarmup.event,
1559
1575
  sessionId: s
1560
- }, this.pendingComposerWarmup.scope = `${s}:${this.pendingComposerWarmup.event.page.url}`), this.setState({ sessionId: s ?? this.state.sessionId });
1576
+ }, this.pendingComposerWarmup.scope = `${s}:${this.pendingComposerWarmup.event.page.url}`), this.setState({ sessionId: s ?? this.state.sessionId }), this.updatePersonalModelFromSession(e.session);
1561
1577
  const n = e.session && typeof e.session == "object" ? e.session.metadata : null;
1562
1578
  typeof e.warmupId == "string" && e.warmupId === this.activeComposerWarmupId && n && typeof n == "object" && n.composerPreload && this.clearPendingComposerWarmup();
1563
1579
  return;
@@ -1581,8 +1597,8 @@ class zt {
1581
1597
  return;
1582
1598
  const n = Jt(e.item, this.options.backendUrl);
1583
1599
  if (n) {
1584
- const r = br(s, n), i = n.callId ? this.pendingToolLoadingByCallId.get(n.callId) : void 0;
1585
- n.callId && i !== void 0 && (n.loading = i, this.pendingToolLoadingByCallId.delete(n.callId)), W(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), Er(s) && this.clearRunAckResyncRetryTimer();
1600
+ const r = Ur(s, n), i = n.callId ? this.pendingToolLoadingByCallId.get(n.callId) : void 0;
1601
+ n.callId && i !== void 0 && (n.loading = i, this.pendingToolLoadingByCallId.delete(n.callId)), W(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), br(s) && this.clearRunAckResyncRetryTimer();
1586
1602
  const o = Ke(this.state.messages, n), a = Pt(o), l = Dt(
1587
1603
  s,
1588
1604
  this.state.assistantDraft,
@@ -1665,7 +1681,7 @@ class zt {
1665
1681
  );
1666
1682
  this.setState({
1667
1683
  sessionId: s,
1668
- messages: ar(
1684
+ messages: cr(
1669
1685
  l,
1670
1686
  typeof e.responseId == "string" ? e.responseId : null,
1671
1687
  n,
@@ -1688,9 +1704,9 @@ class zt {
1688
1704
  if (s)
1689
1705
  this.nonTranscriptToolCallIds.add(s);
1690
1706
  else {
1691
- const n = cr(e);
1707
+ const n = pr(e);
1692
1708
  if (n) {
1693
- const r = lr(
1709
+ const r = dr(
1694
1710
  this.state.messages,
1695
1711
  n
1696
1712
  );
@@ -1758,13 +1774,13 @@ class zt {
1758
1774
  return;
1759
1775
  }
1760
1776
  o && r && i && (this.retryableClientMessageId = i);
1761
- const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l = Dn(a.message);
1777
+ const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l = Ln(a.message);
1762
1778
  l && console.error(l);
1763
1779
  const u = i ?? this.activeClientMessageId, d = typeof e.runId == "string" ? e.runId : null, p = vt(
1764
1780
  this.state.messages,
1765
1781
  u,
1766
1782
  d
1767
- ), I = yr(
1783
+ ), I = Sr(
1768
1784
  p,
1769
1785
  u,
1770
1786
  d
@@ -1788,6 +1804,12 @@ class zt {
1788
1804
  }
1789
1805
  }
1790
1806
  }
1807
+ updatePersonalModelFromSession(e) {
1808
+ if (this.options.productVariant !== "personal" || !e || typeof e != "object")
1809
+ return;
1810
+ const s = e.metadata, n = s && typeof s == "object" ? s.model : void 0;
1811
+ this.options.model = Hs(n) ? n : "gpt-5.6-terra";
1812
+ }
1791
1813
  shouldIgnoreBackgroundSessionEvent(e) {
1792
1814
  if (!this.options.keepRunsActiveOnSessionNavigation || !Et(e))
1793
1815
  return !1;
@@ -1972,7 +1994,7 @@ class zt {
1972
1994
  ...this.state.isThinking ? {} : { turnPhase: null },
1973
1995
  isRetrying: !1,
1974
1996
  ...this.state.isThinking ? {} : { taskStatus: "failed" },
1975
- lastError: en,
1997
+ lastError: nn,
1976
1998
  lastErrorCode: "message_delivery_failed"
1977
1999
  });
1978
2000
  }
@@ -1987,7 +2009,7 @@ class zt {
1987
2009
  s,
1988
2010
  typeof e.runId == "string" ? e.runId : null
1989
2011
  ), !(!this.state.isThinking || !s) && this.setState({
1990
- messages: Pr(
2012
+ messages: vr(
1991
2013
  this.state.messages,
1992
2014
  s
1993
2015
  )
@@ -2102,15 +2124,15 @@ class zt {
2102
2124
  if (!s || !n || !r)
2103
2125
  return;
2104
2126
  const a = r === "execute_code", l = r === "execute_code_in_browser_tab" && o !== null && typeof o == "object" && o.tabId === "local:current";
2105
- if (!a && !l || !Jr(o)) {
2127
+ if (!a && !l || !Zr(o)) {
2106
2128
  this.setToolMessageLoading(n, !1), this.send({
2107
2129
  type: "tool.result",
2108
2130
  sessionId: s,
2109
2131
  callId: n,
2110
2132
  toolName: r,
2111
2133
  summary: i,
2112
- rawInput: q(o),
2113
- rawOutput: q({
2134
+ rawInput: L(o),
2135
+ rawOutput: L({
2114
2136
  ok: !1,
2115
2137
  toolName: r,
2116
2138
  error: `Unsupported browser tool: ${r}`
@@ -2125,7 +2147,7 @@ class zt {
2125
2147
  callId: n,
2126
2148
  toolName: r,
2127
2149
  summary: i,
2128
- rawInput: q(o),
2150
+ rawInput: L(o),
2129
2151
  rawOutput: {
2130
2152
  ok: !1,
2131
2153
  toolName: r,
@@ -2141,7 +2163,7 @@ class zt {
2141
2163
  callId: n,
2142
2164
  toolName: r,
2143
2165
  summary: i,
2144
- rawInput: q(o),
2166
+ rawInput: L(o),
2145
2167
  rawOutput: null
2146
2168
  },
2147
2169
  startedAtMs: Date.now(),
@@ -2151,7 +2173,7 @@ class zt {
2151
2173
  let u = null, d;
2152
2174
  u = await this.executeRuntimeHelper(), d = await kt(
2153
2175
  o,
2154
- Cn(e.runtimeContext, this.options.backendUrl)
2176
+ Pn(e.runtimeContext, this.options.backendUrl)
2155
2177
  ).catch((p) => ({
2156
2178
  ok: !1,
2157
2179
  exception: {
@@ -2163,12 +2185,12 @@ class zt {
2163
2185
  callId: n,
2164
2186
  toolName: r,
2165
2187
  summary: o.summary,
2166
- rawInput: q(o),
2167
- rawOutput: q(Gn(d, u))
2168
- }), qt(this.options.clientId, this.activeBrowserToolCalls.values()));
2188
+ rawInput: L(o),
2189
+ rawOutput: L(Jn(d, u))
2190
+ }), Lt(this.options.clientId, this.activeBrowserToolCalls.values()));
2169
2191
  }
2170
2192
  setToolMessageLoading(e, s) {
2171
- const n = ur(
2193
+ const n = hr(
2172
2194
  this.state.messages,
2173
2195
  e,
2174
2196
  s
@@ -2186,10 +2208,10 @@ class zt {
2186
2208
  };
2187
2209
  }
2188
2210
  installSessionBrowserApis() {
2189
- this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = yn();
2211
+ this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = Sn();
2190
2212
  }
2191
2213
  cleanupSessionBrowserApis() {
2192
- this.sessionBrowserApisCleanup && (En(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
2214
+ this.sessionBrowserApisCleanup && (bn(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
2193
2215
  }
2194
2216
  async executeRuntimeHelper() {
2195
2217
  if (!this.runtimeHelperJavascript?.trim())
@@ -2197,15 +2219,15 @@ class zt {
2197
2219
  const e = await kt({
2198
2220
  javascript: this.runtimeHelperJavascript
2199
2221
  });
2200
- return e.ok === !1 ? Xn(e) : null;
2222
+ return e.ok === !1 ? Yn(e) : null;
2201
2223
  }
2202
2224
  enableNetworkCapture() {
2203
- this.networkCaptureCleanup || (this.networkCaptureCleanup = hn((e) => {
2204
- si(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
2225
+ this.networkCaptureCleanup || (this.networkCaptureCleanup = fn((e) => {
2226
+ ii(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
2205
2227
  }));
2206
2228
  }
2207
2229
  enqueueNetworkEvent(e) {
2208
- this.queuedNetworkEvents.length >= sn || (this.queuedNetworkEvents.push(ti(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
2230
+ this.queuedNetworkEvents.length >= on || (this.queuedNetworkEvents.push(ri(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
2209
2231
  this.networkBatchTimer = null;
2210
2232
  const s = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
2211
2233
  s.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
@@ -2214,12 +2236,12 @@ class zt {
2214
2236
  page: b(),
2215
2237
  events: s
2216
2238
  });
2217
- }, tn)));
2239
+ }, rn)));
2218
2240
  }
2219
2241
  scheduleReconnect() {
2220
2242
  if (this.reconnectTimer !== null || this.state.status === "closed")
2221
2243
  return;
2222
- const e = cn(this.reconnectAttempts);
2244
+ const e = pn(this.reconnectAttempts);
2223
2245
  this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
2224
2246
  this.reconnectTimer = null, this.connect().catch((s) => {
2225
2247
  M("web-sdk.agent", "Pluno reconnect failed; retrying", {
@@ -2235,8 +2257,8 @@ class zt {
2235
2257
  const e = this.socket;
2236
2258
  !e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
2237
2259
  this.socket === e && (M("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
2238
- }, Gs));
2239
- }, Ks);
2260
+ }, Js));
2261
+ }, Xs);
2240
2262
  }
2241
2263
  stopHeartbeat() {
2242
2264
  this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
@@ -2274,7 +2296,7 @@ class zt {
2274
2296
  ...e.lastError === null && e.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
2275
2297
  ...e.lastError !== void 0 && e.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
2276
2298
  };
2277
- this.state = o, xr(this.options.clientId, this.state), this.emit("state", this.getState()), Ne("state", this.state.status, {
2299
+ this.state = o, Hr(this.options.clientId, this.state), this.emit("state", this.getState()), Ne("state", this.state.status, {
2278
2300
  status: this.state.status,
2279
2301
  sessionId: this.state.sessionId,
2280
2302
  messageCount: this.state.messages.length,
@@ -2297,13 +2319,13 @@ class zt {
2297
2319
  }
2298
2320
  }
2299
2321
  const Be = /* @__PURE__ */ new WeakMap();
2300
- function hn(t) {
2301
- const e = window.__plunoProductAgentNetworkCapture ?? pn();
2322
+ function fn(t) {
2323
+ const e = window.__plunoProductAgentNetworkCapture ?? mn();
2302
2324
  return e.subscribers.add(t), () => {
2303
2325
  e.subscribers.delete(t), !(e.subscribers.size > 0) && (e.destroy(), window.__plunoProductAgentNetworkCapture === e && delete window.__plunoProductAgentNetworkCapture);
2304
2326
  };
2305
2327
  }
2306
- function pn() {
2328
+ function mn() {
2307
2329
  const t = /* @__PURE__ */ new Set(), e = (I) => {
2308
2330
  t.forEach((f) => {
2309
2331
  try {
@@ -2320,7 +2342,7 @@ function pn() {
2320
2342
  throw T;
2321
2343
  }
2322
2344
  try {
2323
- const T = f instanceof Request ? f : null, k = Yr(f, T), m = as(c?.headers ?? T?.headers);
2345
+ const T = f instanceof Request ? f : null, k = ei(f, T), m = as(c?.headers ?? T?.headers);
2324
2346
  if (!J(k, m, c?.body)) {
2325
2347
  const U = {
2326
2348
  requestId: $e("fetch"),
@@ -2333,7 +2355,7 @@ function pn() {
2333
2355
  };
2334
2356
  g.then(
2335
2357
  (D) => {
2336
- Qr(D, U, h, e).catch(() => {
2358
+ ti(D, U, h, e).catch(() => {
2337
2359
  e({
2338
2360
  ...U,
2339
2361
  responseStatus: D.status,
@@ -2375,7 +2397,7 @@ function pn() {
2375
2397
  () => {
2376
2398
  queueMicrotask(() => {
2377
2399
  try {
2378
- const h = ri(this.getAllResponseHeaders());
2400
+ const h = ai(this.getAllResponseHeaders());
2379
2401
  e({
2380
2402
  requestId: c.requestId,
2381
2403
  url: c.url,
@@ -2385,7 +2407,7 @@ function pn() {
2385
2407
  resourceType: "xhr",
2386
2408
  responseStatus: this.status,
2387
2409
  responseHeaders: h,
2388
- responseBody: ei(this, h),
2410
+ responseBody: ni(this, h),
2389
2411
  errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
2390
2412
  startedAt: c.startedAt,
2391
2413
  durationMs: Date.now() - c.startedAtMs
@@ -2481,7 +2503,7 @@ function Rt(t) {
2481
2503
  const e = typeof t == "function" ? t() : t;
2482
2504
  return e && Object.keys(e).length > 0 ? e : void 0;
2483
2505
  }
2484
- function gn(t) {
2506
+ function yn(t) {
2485
2507
  return t.type === "run.model_started" || t.type === "conversation.state" || t.type === "session.updated" || t.type === "session.item" || t.type === "chat.assistant_delta" || t.type === "chat.assistant_done" || t.type === "tool.call";
2486
2508
  }
2487
2509
  function Et(t) {
@@ -2502,27 +2524,27 @@ function oe(t) {
2502
2524
  }
2503
2525
  return null;
2504
2526
  }
2505
- const fn = 5e3, mn = 12e4;
2506
- function yn() {
2527
+ const In = 5e3, Tn = 12e4;
2528
+ function Sn() {
2507
2529
  const t = [
2508
- Tn(),
2509
- In()
2530
+ Mn(),
2531
+ wn()
2510
2532
  ].filter((e) => typeof e == "function");
2511
2533
  return () => {
2512
2534
  for (const e of t.reverse())
2513
2535
  e();
2514
2536
  };
2515
2537
  }
2516
- function In() {
2538
+ function wn() {
2517
2539
  return Bt(globalThis, "getPageSnapshot", async () => st());
2518
2540
  }
2519
- function Tn() {
2541
+ function Mn() {
2520
2542
  return Bt(globalThis, "pageImages", {
2521
- inspectImage: async (e, s) => await Sn(e, s)
2543
+ inspectImage: async (e, s) => await An(e, s)
2522
2544
  });
2523
2545
  }
2524
- async function Sn(t, e = {}) {
2525
- const s = Rn(e.name), n = await wn(t);
2546
+ async function An(t, e = {}) {
2547
+ const s = Cn(e.name), n = await Rn(t);
2526
2548
  return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
2527
2549
  type: "pluno.pageImages.inspectImage",
2528
2550
  imageAttached: !1,
@@ -2540,15 +2562,15 @@ async function Sn(t, e = {}) {
2540
2562
  imageAttachmentError: n.error
2541
2563
  };
2542
2564
  }
2543
- async function wn(t) {
2565
+ async function Rn(t) {
2544
2566
  return t instanceof Blob ? t.type.startsWith("image/") ? t.size === 0 ? { ok: !1, error: "Page image is empty." } : t.size > 8 * 1024 * 1024 ? { ok: !1, error: jt } : {
2545
2567
  ok: !0,
2546
2568
  mimeType: t.type,
2547
2569
  sizeBytes: t.size,
2548
- dataUrl: await kn(t)
2549
- } : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof t != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : Mn(t);
2570
+ dataUrl: await _n(t)
2571
+ } : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof t != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : En(t);
2550
2572
  }
2551
- function Mn(t) {
2573
+ function En(t) {
2552
2574
  if (!t.startsWith("data:") || !t.includes(","))
2553
2575
  return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
2554
2576
  const [e, s] = t.slice(5).split(",", 2), n = e.split(";").map((a) => a.trim()).filter(Boolean), r = n[0] ?? "";
@@ -2559,7 +2581,7 @@ function Mn(t) {
2559
2581
  const i = s.replace(/[ \t\r\n\f]+/g, "");
2560
2582
  if (!/^[A-Za-z0-9+/]*={0,2}$/.test(i))
2561
2583
  return { ok: !1, error: "Page image data URL has invalid base64." };
2562
- const o = An(i);
2584
+ const o = kn(i);
2563
2585
  return o === null ? { ok: !1, error: "Page image data URL has invalid base64." } : o === 0 ? { ok: !1, error: "Page image is empty." } : {
2564
2586
  ok: !0,
2565
2587
  mimeType: r,
@@ -2567,22 +2589,22 @@ function Mn(t) {
2567
2589
  dataUrl: `data:${r};base64,${i}`
2568
2590
  };
2569
2591
  }
2570
- function An(t) {
2592
+ function kn(t) {
2571
2593
  if (t.length === 0 || t.length % 4 !== 0)
2572
2594
  return null;
2573
2595
  const e = t.length - t.replace(/=+$/, "").length;
2574
2596
  return e > 2 ? null : t.length / 4 * 3 - e;
2575
2597
  }
2576
- function Rn(t) {
2598
+ function Cn(t) {
2577
2599
  return (typeof t == "string" ? t.trim() : "") || "Page image";
2578
2600
  }
2579
- function En(t) {
2601
+ function bn(t) {
2580
2602
  try {
2581
2603
  t();
2582
2604
  } catch {
2583
2605
  }
2584
2606
  }
2585
- function kn(t) {
2607
+ function _n(t) {
2586
2608
  return new Promise((e, s) => {
2587
2609
  const n = new FileReader();
2588
2610
  n.onload = () => {
@@ -2596,7 +2618,7 @@ function kn(t) {
2596
2618
  }
2597
2619
  async function kt(t, e) {
2598
2620
  const s = Object.getPrototypeOf(async function() {
2599
- }).constructor, n = t.timeoutMs ?? fn, r = Date.now(), i = [];
2621
+ }).constructor, n = t.timeoutMs ?? In, r = Date.now(), i = [];
2600
2622
  let o;
2601
2623
  const a = {
2602
2624
  log: console.log,
@@ -2614,7 +2636,7 @@ async function kt(t, e) {
2614
2636
  o = window.setTimeout(() => p(u), n);
2615
2637
  })
2616
2638
  ]);
2617
- return d === u ? bn(n) : {
2639
+ return d === u ? Un(n) : {
2618
2640
  ok: !0,
2619
2641
  result: d,
2620
2642
  console: i,
@@ -2643,7 +2665,7 @@ async function kt(t, e) {
2643
2665
  e?.deactivate(), o !== void 0 && window.clearTimeout(o), console.log = a.log, console.info = a.info, console.warn = a.warn, console.error = a.error;
2644
2666
  }
2645
2667
  }
2646
- function Cn(t, e) {
2668
+ function Pn(t, e) {
2647
2669
  if (!t || typeof t != "object")
2648
2670
  return;
2649
2671
  const s = t.sandboxFilesToken;
@@ -2653,7 +2675,7 @@ function Cn(t, e) {
2653
2675
  const r = () => {
2654
2676
  if (!n)
2655
2677
  throw new Error("sandboxFiles is only available during browser-code execution");
2656
- }, i = async (a, l) => await xs(`${e.replace(/\/$/, "")}${a}`, l);
2678
+ }, i = async (a, l) => await $s(`${e.replace(/\/$/, "")}${a}`, l);
2657
2679
  return {
2658
2680
  value: Object.freeze({
2659
2681
  upload: async (a) => {
@@ -2687,7 +2709,7 @@ function Cn(t, e) {
2687
2709
  }
2688
2710
  };
2689
2711
  }
2690
- function bn(t) {
2712
+ function Un(t) {
2691
2713
  return {
2692
2714
  ok: !1,
2693
2715
  exception: {
@@ -2701,10 +2723,10 @@ function bn(t) {
2701
2723
  }
2702
2724
  };
2703
2725
  }
2704
- function _n(t) {
2726
+ function Dn(t) {
2705
2727
  return t.replace(/\/+$/, "");
2706
2728
  }
2707
- function Pn(t) {
2729
+ function vn(t) {
2708
2730
  const e = {
2709
2731
  sidepanel: "extension_sidepanel",
2710
2732
  browser_extension_page_ui: "extension_widget",
@@ -2716,18 +2738,18 @@ function Pn(t) {
2716
2738
  };
2717
2739
  return t && t in e ? e[t] : t ?? "embedded_custom_ui";
2718
2740
  }
2719
- function Un(t) {
2741
+ function On(t) {
2720
2742
  return t === "pluno" ? "scheduled_continuation" : t ?? "user";
2721
2743
  }
2722
- function Dn(t, e = location.origin) {
2744
+ function Ln(t, e = location.origin) {
2723
2745
  return /origin (?:is not allowed|does not match browser origin)/i.test(t) ? `Pluno widget blocked on ${e}: this domain is not allowed. Add ${e} in Pluno under Integration > Domains.` : null;
2724
2746
  }
2725
- function vn(t) {
2747
+ function qn(t) {
2726
2748
  const e = new URL("/api/product-agent/embed/ws", t);
2727
2749
  return e.protocol = e.protocol === "https:" ? "wss:" : "ws:", e.toString();
2728
2750
  }
2729
2751
  function b() {
2730
- const t = Vt();
2752
+ const t = Xt();
2731
2753
  return {
2732
2754
  url: location.href,
2733
2755
  title: document.title,
@@ -2735,19 +2757,19 @@ function b() {
2735
2757
  ...t ? { plunoProductAgentUi: t } : {}
2736
2758
  };
2737
2759
  }
2738
- function On() {
2760
+ function Nn() {
2739
2761
  return {
2740
2762
  pageUrl: location.href,
2741
2763
  pageTitle: document.title,
2742
2764
  htmlContent: st()
2743
2765
  };
2744
2766
  }
2745
- function qn(t) {
2746
- return ye.add(t), de || (de = Ln()), () => {
2767
+ function xn(t) {
2768
+ return ye.add(t), de || (de = Bn()), () => {
2747
2769
  ye.delete(t), ye.size === 0 && (de?.(), de = null);
2748
2770
  };
2749
2771
  }
2750
- function Ln() {
2772
+ function Bn() {
2751
2773
  const t = () => {
2752
2774
  for (const i of Array.from(ye))
2753
2775
  i();
@@ -2763,7 +2785,7 @@ function Ln() {
2763
2785
  };
2764
2786
  }
2765
2787
  function he() {
2766
- return Vt()?.surface === "browser_extension_sdk_preview";
2788
+ return Xt()?.surface === "browser_extension_sdk_preview";
2767
2789
  }
2768
2790
  function st() {
2769
2791
  if (!document.body)
@@ -2778,12 +2800,12 @@ function st() {
2778
2800
  );
2779
2801
  for (const h of r.slice(0, 3))
2780
2802
  s("Active overlay", We(ae(h), e));
2781
- const i = Nn(), o = i ? We(ae(i), e) : "";
2803
+ const i = Wn(), o = i ? We(ae(i), e) : "";
2782
2804
  s("Main page content", o), s("Additional visible page text", We(ae(document.body), e));
2783
2805
  const a = t.map(([h, g]) => `${h}:
2784
2806
  ${g}`).join(`
2785
2807
 
2786
- `).trim().slice(0, 12e3), l = xn(r, i).trim(), u = `Simplified DOM outline:
2808
+ `).trim().slice(0, 12e3), l = Hn(r, i).trim(), u = `Simplified DOM outline:
2787
2809
  `, d = `
2788
2810
 
2789
2811
  Visible page text:
@@ -2811,10 +2833,10 @@ function Kt(t) {
2811
2833
  const e = window.getComputedStyle(t);
2812
2834
  return e.display !== "none" && e.visibility !== "hidden" && t.getClientRects().length > 0;
2813
2835
  }
2814
- function Nn() {
2836
+ function Wn() {
2815
2837
  return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Kt).sort((t, e) => ae(e).length - ae(t).length)[0] ?? null;
2816
2838
  }
2817
- function xn(t, e) {
2839
+ function Hn(t, e) {
2818
2840
  const s = /* @__PURE__ */ new Set([
2819
2841
  "main",
2820
2842
  "nav",
@@ -2894,7 +2916,7 @@ function xn(t, e) {
2894
2916
  "data-test",
2895
2917
  "data-qa",
2896
2918
  "data-cy"
2897
- ], u = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: d, priorityTargets: p } = Bn(), I = new Set(t);
2919
+ ], u = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: d, priorityTargets: p } = $n(), I = new Set(t);
2898
2920
  e && I.add(e);
2899
2921
  let f = 0;
2900
2922
  const c = (m) => {
@@ -2909,19 +2931,19 @@ function xn(t, e) {
2909
2931
  if (f >= 1e3 && !z || U.has(R) || i.has(C) || R.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || te.display === "none" || te.visibility === "hidden")
2910
2932
  return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
2911
2933
  f += 1;
2912
- const $ = c(R), K = Xt(R), it = a.has($) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(C) || C === "a" && R.hasAttribute("href"), V = Array.from(R.children).filter((y) => y instanceof HTMLElement), L = /* @__PURE__ */ new Map();
2913
- for (const y of V) {
2934
+ const $ = c(R), K = Vt(R), it = a.has($) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(C) || C === "a" && R.hasAttribute("href"), X = Array.from(R.children).filter((y) => y instanceof HTMLElement), q = /* @__PURE__ */ new Map();
2935
+ for (const y of X) {
2914
2936
  const A = h(y);
2915
- L.set(A, (L.get(A) ?? 0) + 1);
2937
+ q.set(A, (q.get(A) ?? 0) + 1);
2916
2938
  }
2917
2939
  const E = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Map();
2918
- for (const y of V) {
2940
+ for (const y of X) {
2919
2941
  const A = h(y), j = O.get(A) ?? 0;
2920
- O.set(A, j + 1), (L.get(A) ?? 0) > 8 && j >= 6 && !d.has(y) && E.set(A, (E.get(A) ?? 0) + 1);
2942
+ O.set(A, j + 1), (q.get(A) ?? 0) > 8 && j >= 6 && !d.has(y) && E.set(A, (E.get(A) ?? 0) + 1);
2921
2943
  }
2922
2944
  const ot = /* @__PURE__ */ new Map(), at = /* @__PURE__ */ new Set(), be = [], lt = [];
2923
- for (const y of V) {
2924
- const A = h(y), j = L.get(A) ?? 0, dt = ot.get(A) ?? 0;
2945
+ for (const y of X) {
2946
+ const A = h(y), j = q.get(A) ?? 0, dt = ot.get(A) ?? 0;
2925
2947
  if (ot.set(A, dt + 1), j > 8 && dt >= 6 && !d.has(y)) {
2926
2948
  at.has(A) || (be.push([`… ${E.get(A) ?? 0} similar siblings omitted`]), at.add(A));
2927
2949
  continue;
@@ -2964,7 +2986,7 @@ function xn(t, e) {
2964
2986
  `);
2965
2987
  }, T = [], k = Q(window.getSelection()?.toString() ?? "");
2966
2988
  k && T.push(`--- selected text ---
2967
- ${JSON.stringify(k)}`), p.length > 0 && T.push(Wn(p, s, l, o));
2989
+ ${JSON.stringify(k)}`), p.length > 0 && T.push(jn(p, s, l, o));
2968
2990
  for (const m of t.slice(0, 3))
2969
2991
  T.push(g(m, "active overlay DOM", /* @__PURE__ */ new Set()));
2970
2992
  if (e && T.push(g(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
@@ -2979,7 +3001,7 @@ function Gt(t, e, s, n) {
2979
3001
  const r = t.tagName.toLowerCase();
2980
3002
  let i = r;
2981
3003
  const o = t.getAttribute("id");
2982
- o && Hn(o) && (i += `#${o}`);
3004
+ o && Fn(o) && (i += `#${o}`);
2983
3005
  for (const a of e) {
2984
3006
  const l = t.getAttribute(a);
2985
3007
  l && l.length <= 160 && (a !== "role" || !s.has(l)) && (i += `[${a}=${JSON.stringify(l)}]`);
@@ -2992,7 +3014,7 @@ function Gt(t, e, s, n) {
2992
3014
  t.hasAttribute(a) && (i += `[${a}]`);
2993
3015
  return `${i}${n ? ` ${JSON.stringify(n)}` : ""}`;
2994
3016
  }
2995
- function Bn() {
3017
+ function $n() {
2996
3018
  const t = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), s = (a, l) => {
2997
3019
  if (!a)
2998
3020
  return;
@@ -3035,7 +3057,7 @@ function Bn() {
3035
3057
  priorityTargets: Array.from(e, ([a, l]) => ({ element: a, labels: Array.from(l) }))
3036
3058
  };
3037
3059
  }
3038
- function Wn(t, e, s, n) {
3060
+ function jn(t, e, s, n) {
3039
3061
  const r = ["--- active/current elements ---"];
3040
3062
  for (const i of t) {
3041
3063
  const o = [];
@@ -3050,7 +3072,7 @@ function Wn(t, e, s, n) {
3050
3072
  d,
3051
3073
  s,
3052
3074
  n,
3053
- p === l.length - 1 ? Xt(d).slice(0, 180) : ""
3075
+ p === l.length - 1 ? Vt(d).slice(0, 180) : ""
3054
3076
  ));
3055
3077
  o.length > l.length && u.splice(1, 0, "…"), r.push(`${i.labels.join(", ")}: ${u.join(" > ")}`);
3056
3078
  }
@@ -3066,15 +3088,15 @@ function pe(t, e) {
3066
3088
  const s = " ".repeat(e);
3067
3089
  return t.map((n) => `${s}${n}`);
3068
3090
  }
3069
- function Xt(t) {
3091
+ function Vt(t) {
3070
3092
  return Q(
3071
3093
  Array.from(t.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
3072
3094
  );
3073
3095
  }
3074
- function Hn(t) {
3096
+ function Fn(t) {
3075
3097
  return t.length <= 64 && /^[A-Za-z_][A-Za-z0-9_:.-]*$/.test(t) && !/[a-f0-9]{12,}/i.test(t) && !/:r[0-9a-z]+:/i.test(t);
3076
3098
  }
3077
- function Vt() {
3099
+ function Xt() {
3078
3100
  const t = document.querySelector(pt);
3079
3101
  if (!(t ?? document.querySelector(Fe)))
3080
3102
  return;
@@ -3090,23 +3112,23 @@ function Vt() {
3090
3112
  },
3091
3113
  {
3092
3114
  name: "widget_root",
3093
- selector: Bs,
3115
+ selector: js,
3094
3116
  description: "Finds Pluno's widget root inside the widget host shadow root."
3095
3117
  },
3096
3118
  {
3097
3119
  name: "widget_panel",
3098
- selector: Ws,
3120
+ selector: Fs,
3099
3121
  description: "Finds Pluno's open chat panel inside the widget host shadow root."
3100
3122
  },
3101
3123
  {
3102
3124
  name: "widget_timeline",
3103
- selector: Hs,
3125
+ selector: zs,
3104
3126
  description: "Finds Pluno's chat timeline inside the widget host shadow root."
3105
3127
  }
3106
3128
  ]
3107
3129
  };
3108
3130
  }
3109
- function $n(t) {
3131
+ function zn(t) {
3110
3132
  try {
3111
3133
  const e = JSON.parse(t);
3112
3134
  return e && typeof e == "object" ? e : { type: "error", message: "Invalid server event" };
@@ -3114,7 +3136,7 @@ function $n(t) {
3114
3136
  return { type: "error", message: "Invalid server event" };
3115
3137
  }
3116
3138
  }
3117
- function jn(t) {
3139
+ function Kn(t) {
3118
3140
  if (typeof t != "string")
3119
3141
  return null;
3120
3142
  try {
@@ -3130,10 +3152,10 @@ function bt(t, e) {
3130
3152
  const s = t[e];
3131
3153
  return Array.isArray(s) ? s.filter((n) => typeof n == "string" && n.trim().length > 0) : [];
3132
3154
  }
3133
- function Fn(t) {
3155
+ function Gn(t) {
3134
3156
  return Array.isArray(t) ? t.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
3135
3157
  }
3136
- function zn(t) {
3158
+ function Vn(t) {
3137
3159
  if (!t || typeof t != "object")
3138
3160
  return null;
3139
3161
  const e = t, s = e.appearance, n = s && typeof s == "object" ? s : e, r = typeof n.accentColor == "string" ? n.accentColor : null, i = n.colorScheme === "dark" ? "dark" : n.colorScheme === "light" ? "light" : null, o = typeof n.fontFamily == "string" && n.fontFamily.trim() ? n.fontFamily : null, a = typeof n.scribbleStyle == "boolean" ? n.scribbleStyle : null;
@@ -3144,13 +3166,13 @@ function zn(t) {
3144
3166
  ...a !== null ? { scribbleStyle: a } : {}
3145
3167
  };
3146
3168
  }
3147
- function Kn(t) {
3169
+ function Xn(t) {
3148
3170
  if (!t || typeof t != "object")
3149
3171
  return null;
3150
3172
  const e = t.javascript;
3151
3173
  return typeof e != "string" || !e.trim() ? null : { javascript: e };
3152
3174
  }
3153
- function Gn(t, e) {
3175
+ function Jn(t, e) {
3154
3176
  return e ? t && typeof t == "object" ? {
3155
3177
  ...t,
3156
3178
  helperError: e
@@ -3160,13 +3182,13 @@ function Gn(t, e) {
3160
3182
  helperError: e
3161
3183
  } : t;
3162
3184
  }
3163
- function Xn(t) {
3185
+ function Yn(t) {
3164
3186
  if (!t || typeof t != "object")
3165
3187
  return t;
3166
3188
  const e = t;
3167
3189
  return typeof e.exception?.message == "string" ? e.exception.message : typeof e.error == "string" ? e.error : t;
3168
3190
  }
3169
- function Vn() {
3191
+ function Qn() {
3170
3192
  const t = "pluno.productAgent.clientId", e = window.localStorage.getItem(t);
3171
3193
  if (e)
3172
3194
  return e;
@@ -3176,7 +3198,7 @@ function Vn() {
3176
3198
  function N() {
3177
3199
  return crypto.randomUUID();
3178
3200
  }
3179
- function Jn(t) {
3201
+ function Zn(t) {
3180
3202
  if (!t || typeof t != "object")
3181
3203
  return null;
3182
3204
  const e = t, s = typeof e.id == "string" ? e.id : null;
@@ -3188,11 +3210,11 @@ function Jn(t) {
3188
3210
  } : null;
3189
3211
  }
3190
3212
  function _t(t, e) {
3191
- return Array.isArray(t) ? Ve(
3213
+ return Array.isArray(t) ? Xe(
3192
3214
  t.map((s) => Jt(s, e)).filter((s) => s !== null)
3193
3215
  ) : [];
3194
3216
  }
3195
- function Yn(t) {
3217
+ function er(t) {
3196
3218
  return Array.isArray(t) ? t.flatMap((e) => {
3197
3219
  if (!e || typeof e != "object")
3198
3220
  return [];
@@ -3228,7 +3250,7 @@ function Jt(t, e) {
3228
3250
  role: i,
3229
3251
  ...r.phase === "commentary" || r.phase === "final_answer" ? { phase: r.phase } : {},
3230
3252
  content: As(
3231
- ir(r.content),
3253
+ lr(r.content),
3232
3254
  e
3233
3255
  ),
3234
3256
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
@@ -3260,7 +3282,7 @@ function Jt(t, e) {
3260
3282
  callId: ge(r) ?? void 0,
3261
3283
  scheduledCheckInAt: i
3262
3284
  };
3263
- const o = Zn(r.output), a = er(r.output);
3285
+ const o = sr(r.output), a = nr(r.output);
3264
3286
  return o ? {
3265
3287
  id: String(s.id ?? crypto.randomUUID()),
3266
3288
  role: "tool",
@@ -3290,7 +3312,7 @@ function Jt(t, e) {
3290
3312
  return r.type === "function_call" || r.type === "tool_call" || r.type === "web_search_call" || r.type === "mcp_call" || r.type === "tab_lifecycle_decision" ? {
3291
3313
  id: String(s.id ?? crypto.randomUUID()),
3292
3314
  role: "tool",
3293
- content: r.type === "mcp_call" ? Qn(r) : sr(r),
3315
+ content: r.type === "mcp_call" ? tr(r) : ir(r),
3294
3316
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
3295
3317
  ...v(r) !== null ? { causalSequence: v(r) } : {},
3296
3318
  respondsToUserMessageId: x(r) ?? void 0,
@@ -3302,7 +3324,7 @@ function Jt(t, e) {
3302
3324
  } : r.type === "run_status" || r.type === "run_error" ? r.type === "run_error" && r.stage === "tool_execution" ? null : {
3303
3325
  id: String(s.id ?? crypto.randomUUID()),
3304
3326
  role: "system",
3305
- content: tr(r),
3327
+ content: rr(r),
3306
3328
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
3307
3329
  ...v(r) !== null ? { causalSequence: v(r) } : {},
3308
3330
  respondsToUserMessageId: x(r) ?? void 0,
@@ -3314,11 +3336,11 @@ function Jt(t, e) {
3314
3336
  ...typeof r.securitySettingsUrl == "string" ? { securitySettingsUrl: r.securitySettingsUrl } : {}
3315
3337
  } : null;
3316
3338
  }
3317
- function Qn(t) {
3339
+ function tr(t) {
3318
3340
  const s = (typeof t.server_label == "string" ? t.server_label : "").replace(/^pipedream_/, "").split(/[_-]+/).filter(Boolean).map((n) => `${n.charAt(0).toUpperCase()}${n.slice(1)}`).join(" ");
3319
3341
  return s ? `🔌 Using ${s}` : "🔌 Using connected integration";
3320
3342
  }
3321
- function Zn(t) {
3343
+ function sr(t) {
3322
3344
  if (typeof t != "string")
3323
3345
  return null;
3324
3346
  try {
@@ -3335,7 +3357,7 @@ function Zn(t) {
3335
3357
  return null;
3336
3358
  }
3337
3359
  }
3338
- function er(t) {
3360
+ function nr(t) {
3339
3361
  if (typeof t != "string")
3340
3362
  return null;
3341
3363
  try {
@@ -3350,10 +3372,10 @@ function er(t) {
3350
3372
  return null;
3351
3373
  }
3352
3374
  }
3353
- function tr(t) {
3375
+ function rr(t) {
3354
3376
  return t.type === "run_status" && t.status === "steered" ? "Steered" : typeof t.message == "string" && t.message.trim().length > 0 ? t.message : "";
3355
3377
  }
3356
- function sr(t) {
3378
+ function ir(t) {
3357
3379
  if (t.type === "web_search_call") {
3358
3380
  const e = t.action;
3359
3381
  if (e && typeof e == "object") {
@@ -3365,9 +3387,9 @@ function sr(t) {
3365
3387
  }
3366
3388
  return "🔎 Searching the web";
3367
3389
  }
3368
- return nr(t);
3390
+ return or(t);
3369
3391
  }
3370
- function nr(t) {
3392
+ function or(t) {
3371
3393
  if (typeof t.summary == "string" && t.summary.trim().length > 0)
3372
3394
  return Y(t.summary);
3373
3395
  if (typeof t.arguments == "string")
@@ -3384,7 +3406,7 @@ function Y(t) {
3384
3406
  const e = t.trim() || "Run tool", s = e.codePointAt(0) ?? 0;
3385
3407
  return s >= 126976 && s <= 129791 || s >= 9728 && s <= 10175 || s >= 127462 && s <= 127487 ? e : `🛠️ ${e}`;
3386
3408
  }
3387
- function rr(t) {
3409
+ function ar(t) {
3388
3410
  if (t == null)
3389
3411
  return t;
3390
3412
  if (typeof t != "object")
@@ -3406,7 +3428,7 @@ function ge(t) {
3406
3428
  function v(t) {
3407
3429
  return typeof t.causalSequence == "number" && Number.isSafeInteger(t.causalSequence) ? t.causalSequence : null;
3408
3430
  }
3409
- function ir(t) {
3431
+ function lr(t) {
3410
3432
  return typeof t == "string" ? t : Array.isArray(t) ? t.map((e) => {
3411
3433
  if (!e || typeof e != "object")
3412
3434
  return "";
@@ -3415,21 +3437,21 @@ function ir(t) {
3415
3437
  }).filter(Boolean).join("") : "";
3416
3438
  }
3417
3439
  function Ke(t, e) {
3418
- const s = Qt(t, e), n = dr(
3419
- or(
3420
- mr(t, e),
3440
+ const s = Qt(t, e), n = gr(
3441
+ ur(
3442
+ Tr(t, e),
3421
3443
  s
3422
3444
  ),
3423
3445
  s
3424
3446
  ), r = n.findIndex((o) => o.id === s.id);
3425
3447
  if (r === -1)
3426
- return Ve(
3448
+ return Xe(
3427
3449
  [...n, s]
3428
3450
  );
3429
3451
  const i = [...n];
3430
- return i[r] = s, Ve(i);
3452
+ return i[r] = s, Xe(i);
3431
3453
  }
3432
- function or(t, e) {
3454
+ function ur(t, e) {
3433
3455
  const s = e.assistantDraftItemId;
3434
3456
  return s ? t.map(
3435
3457
  (n) => n.dataType === "assistant_draft" && n.id === s ? e : n
@@ -3438,7 +3460,7 @@ function or(t, e) {
3438
3460
  function He(t, e, s) {
3439
3461
  return e !== null ? t.respondsToUserMessageId === e : s !== null && t.runId === s;
3440
3462
  }
3441
- function ar(t, e, s, n) {
3463
+ function cr(t, e, s, n) {
3442
3464
  if (s === null) return t;
3443
3465
  let r = -1;
3444
3466
  for (let o = t.length - 1; o >= 0; o -= 1) {
@@ -3455,7 +3477,7 @@ function ar(t, e, s, n) {
3455
3477
  respondsToUserMessageId: s
3456
3478
  }, i;
3457
3479
  }
3458
- function lr(t, e) {
3480
+ function dr(t, e) {
3459
3481
  const s = t.findIndex(
3460
3482
  (r) => !r.id.startsWith("transient-activity:") && r.callId === e.callId
3461
3483
  );
@@ -3472,12 +3494,12 @@ function lr(t, e) {
3472
3494
  ...n[s].runId ? {} : { runId: e.runId }
3473
3495
  }, n;
3474
3496
  }
3475
- function ur(t, e, s) {
3497
+ function hr(t, e, s) {
3476
3498
  let n = !1;
3477
3499
  const r = t.map((i) => i.callId !== e || i.loading === s ? i : (n = !0, { ...i, loading: s }));
3478
3500
  return n ? r : t;
3479
3501
  }
3480
- function cr(t) {
3502
+ function pr(t) {
3481
3503
  if (t.hiddenFromTranscript === !0)
3482
3504
  return null;
3483
3505
  const e = typeof t.callId == "string" ? t.callId : null, s = typeof t.toolName == "string" ? t.toolName : null;
@@ -3497,7 +3519,7 @@ function cr(t) {
3497
3519
  loading: !0
3498
3520
  };
3499
3521
  }
3500
- function dr(t, e) {
3522
+ function gr(t, e) {
3501
3523
  if (e.id.startsWith("transient-activity:"))
3502
3524
  return t;
3503
3525
  const s = e.toolName === "tab_lifecycle";
@@ -3506,7 +3528,7 @@ function dr(t, e) {
3506
3528
  const n = (i) => i.id === `transient-activity:${e.callId}` && i.callId === e.callId || s && i.id.startsWith("transient-activity:") && i.toolName === "browser_tabs" && !!i.runId && i.runId === e.runId, r = t.findIndex(n);
3507
3529
  return r === -1 ? t : t.flatMap((i, o) => n(i) ? o === r ? [e] : [] : i.id === e.id ? [] : [i]);
3508
3530
  }
3509
- function hr(t, e) {
3531
+ function fr(t, e) {
3510
3532
  return ks(
3511
3533
  t,
3512
3534
  e.map(
@@ -3515,7 +3537,7 @@ function hr(t, e) {
3515
3537
  Yt
3516
3538
  );
3517
3539
  }
3518
- function pr(t, e, s) {
3540
+ function mr(t, e, s) {
3519
3541
  const n = new Map(e.map((i) => [i.id, i]));
3520
3542
  return [
3521
3543
  ...t.filter((i) => s.has(i.id)).map((i) => n.get(i.id) ?? i),
@@ -3523,7 +3545,7 @@ function pr(t, e, s) {
3523
3545
  ];
3524
3546
  }
3525
3547
  function Yt(t) {
3526
- const e = X(t) ?? void 0, s = t.assistantDraftItemId, n = [
3548
+ const e = V(t) ?? void 0, s = t.assistantDraftItemId, n = [
3527
3549
  ...t.callId ? [`call:${t.callId}`] : [],
3528
3550
  ...t.runId && (t.toolName === "browser_tabs" || t.toolName === "tab_lifecycle") ? [`tab-lifecycle:${t.runId}`] : []
3529
3551
  ];
@@ -3549,22 +3571,22 @@ function Qt(t, e) {
3549
3571
  if (!s?.attachments?.length)
3550
3572
  return e;
3551
3573
  const n = e.attachments.map((o) => {
3552
- const a = gr(s.attachments ?? [], o);
3553
- return a ? fr(o, a) : o;
3554
- }), r = { ...e, attachments: n }, i = X(e);
3574
+ const a = yr(s.attachments ?? [], o);
3575
+ return a ? Ir(o, a) : o;
3576
+ }), r = { ...e, attachments: n }, i = V(e);
3555
3577
  return i && Object.defineProperty(r, "clientMessageId", {
3556
3578
  value: i,
3557
3579
  enumerable: !1
3558
3580
  }), r;
3559
3581
  }
3560
- function gr(t, e) {
3582
+ function yr(t, e) {
3561
3583
  return e.id ? t.find((s) => s.id === e.id) ?? null : null;
3562
3584
  }
3563
- function fr(t, e) {
3585
+ function Ir(t, e) {
3564
3586
  const { previewUrl: s } = e;
3565
3587
  return s ? { ...t, previewUrl: s } : t;
3566
3588
  }
3567
- function mr(t, e) {
3589
+ function Tr(t, e) {
3568
3590
  if (e.role !== "user")
3569
3591
  return t;
3570
3592
  const s = t.findIndex(
@@ -3576,13 +3598,13 @@ function mr(t, e) {
3576
3598
  return n.splice(s, 1), n;
3577
3599
  }
3578
3600
  function Zt(t, e) {
3579
- const s = X(t), n = X(e);
3601
+ const s = V(t), n = V(e);
3580
3602
  return s && n ? s === n : t.content === e.content;
3581
3603
  }
3582
3604
  function ke(t) {
3583
3605
  return t.role === "user" && (t.id.startsWith("local-") || t.id.startsWith("optimistic-user-message:"));
3584
3606
  }
3585
- function X(t) {
3607
+ function V(t) {
3586
3608
  const e = t.clientMessageId;
3587
3609
  if (e)
3588
3610
  return e;
@@ -3615,10 +3637,10 @@ function Pt(t) {
3615
3637
  }
3616
3638
  return !1;
3617
3639
  }
3618
- function yr(t, e, s) {
3640
+ function Sr(t, e, s) {
3619
3641
  const n = new Set(
3620
3642
  t.filter(
3621
- (r) => r.role === "user" && e !== null && X(r) === e
3643
+ (r) => r.role === "user" && e !== null && V(r) === e
3622
3644
  ).map((r) => r.id)
3623
3645
  );
3624
3646
  return t.some((r, i) => {
@@ -3635,7 +3657,7 @@ function yr(t, e, s) {
3635
3657
  return !1;
3636
3658
  });
3637
3659
  }
3638
- function Ir(t) {
3660
+ function wr(t) {
3639
3661
  const e = es(t);
3640
3662
  if (e === null)
3641
3663
  return t.some(W);
@@ -3667,7 +3689,7 @@ function Z(t) {
3667
3689
  }
3668
3690
  return null;
3669
3691
  }
3670
- function Tr(t) {
3692
+ function Mr(t) {
3671
3693
  const e = Z(t);
3672
3694
  if (e === null)
3673
3695
  return null;
@@ -3689,7 +3711,7 @@ function we(t) {
3689
3711
  function Ut(t) {
3690
3712
  return t?.type === "run_status" && t.status === "interrupted" && t.reason === "backend_restart";
3691
3713
  }
3692
- function Sr(t, e) {
3714
+ function Ar(t, e) {
3693
3715
  const s = Z(e);
3694
3716
  if (s === null)
3695
3717
  return !1;
@@ -3714,7 +3736,7 @@ function Ge(t) {
3714
3736
  const r = n.clientMessageId;
3715
3737
  return typeof r == "string" ? r : null;
3716
3738
  }
3717
- function wr(t) {
3739
+ function Rr(t) {
3718
3740
  const e = Z(t);
3719
3741
  if (e === null)
3720
3742
  return null;
@@ -3729,13 +3751,13 @@ function wr(t) {
3729
3751
  if (i.type === "message" && i.role === "assistant")
3730
3752
  return null;
3731
3753
  if (i.type === "run_error")
3732
- return i.retryable !== !0 ? null : Xe(t, i) ?? Ge(t);
3754
+ return i.retryable !== !0 ? null : Ve(t, i) ?? Ge(t);
3733
3755
  if (i.type === "run_status")
3734
- return i.status === "interrupted" && i.retryable === !0 ? Xe(t, i) ?? Ge(t) : null;
3756
+ return i.status === "interrupted" && i.retryable === !0 ? Ve(t, i) ?? Ge(t) : null;
3735
3757
  }
3736
3758
  return null;
3737
3759
  }
3738
- function Xe(t, e) {
3760
+ function Ve(t, e) {
3739
3761
  if (typeof e.clientMessageId == "string")
3740
3762
  return e.clientMessageId;
3741
3763
  const s = x(e);
@@ -3744,7 +3766,7 @@ function Xe(t, e) {
3744
3766
  const n = t.find((i) => S(i, "id") === s), r = P(n);
3745
3767
  return r?.type === "message" && r.role === "user" && typeof r.clientMessageId == "string" ? r.clientMessageId : null;
3746
3768
  }
3747
- function Mr(t, e) {
3769
+ function Er(t, e) {
3748
3770
  let s = 0;
3749
3771
  for (const n of t) {
3750
3772
  if (!n || typeof n != "object")
@@ -3758,7 +3780,7 @@ function Mr(t, e) {
3758
3780
  return s;
3759
3781
  }
3760
3782
  function Dt(t, e, s, n, r, i) {
3761
- if (!e || !Rr(t))
3783
+ if (!e || !Cr(t))
3762
3784
  return !1;
3763
3785
  const o = t;
3764
3786
  if (we(o) || s !== null && typeof o.id == "string" && o.id !== s)
@@ -3766,7 +3788,7 @@ function Dt(t, e, s, n, r, i) {
3766
3788
  const a = x(o);
3767
3789
  return n !== null ? a !== null ? a === n : r !== null && _(o) === r && i === n : r === null || _(o) === r;
3768
3790
  }
3769
- function Ar(t, e) {
3791
+ function kr(t, e) {
3770
3792
  for (let s = e - 1; s >= 0; s -= 1) {
3771
3793
  const n = P(t[s]);
3772
3794
  if (n?.type === "message" && n.role === "user")
@@ -3780,7 +3802,7 @@ function ts(t, e) {
3780
3802
  return t[s].id;
3781
3803
  return null;
3782
3804
  }
3783
- function Rr(t) {
3805
+ function Cr(t) {
3784
3806
  if (!t || typeof t != "object")
3785
3807
  return !1;
3786
3808
  const e = t;
@@ -3789,29 +3811,29 @@ function Rr(t) {
3789
3811
  function W(t) {
3790
3812
  return t.role === "assistant" && t.phase !== "commentary";
3791
3813
  }
3792
- function Er(t) {
3814
+ function br(t) {
3793
3815
  if (!t || typeof t != "object")
3794
3816
  return !1;
3795
3817
  const e = t;
3796
3818
  return e.type === "message" && e.role === "user" ? !1 : e.type === "message" || e.type === "function_call" || e.type === "function_call_output" || e.type === "run_error" || e.type === "run_status";
3797
3819
  }
3798
- function Ve(t) {
3799
- return t.filter((e, s) => F(e) ? !Lr(t, s) && !ss(t, s) && !Or(t, s) && !qr(t, s) : kr(e) ? e.retryable === !0 && vr(t, s) ? !1 : !Dr(t, s) : !0);
3820
+ function Xe(t) {
3821
+ return t.filter((e, s) => F(e) ? !Br(t, s) && !ss(t, s) && !Nr(t, s) && !xr(t, s) : _r(e) ? e.retryable === !0 && qr(t, s) ? !1 : !Lr(t, s) : !0);
3800
3822
  }
3801
- function kr(t) {
3823
+ function _r(t) {
3802
3824
  return t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.steered !== !0);
3803
3825
  }
3804
3826
  function F(t) {
3805
3827
  return t.role === "system" && t.dataType === "run_status" && t.loading === !0;
3806
3828
  }
3807
- function Cr(t, e, s, n) {
3829
+ function Pr(t, e, s, n) {
3808
3830
  const r = t.findIndex(
3809
3831
  (l, u) => F(l) && !ss(t, u)
3810
3832
  ), i = r === -1 ? null : t[r], o = e ?? i?.respondsToUserMessageId ?? null, a = o ? t.find(
3811
3833
  (l) => l.role === "user" && l.id === o
3812
3834
  ) : null;
3813
3835
  return {
3814
- clientMessageId: a ? X(a) : o ? null : n,
3836
+ clientMessageId: a ? V(a) : o ? null : n,
3815
3837
  respondsToUserMessageId: o,
3816
3838
  runId: s ?? i?.runId ?? null
3817
3839
  };
@@ -3819,13 +3841,13 @@ function Cr(t, e, s, n) {
3819
3841
  function Ie(t) {
3820
3842
  return t?.type === "run_status" && t.status === "stopped";
3821
3843
  }
3822
- function br(t, e) {
3844
+ function Ur(t, e) {
3823
3845
  return W(e) ? "completed" : Ie(t) ? "stopped" : !we(t) && (t?.type === "run_error" || t?.type === "run_status" && (t.status === "failed" || t.status === "interrupted")) ? "failed" : null;
3824
3846
  }
3825
3847
  function vt(t, e, s) {
3826
3848
  const n = new Set(
3827
3849
  t.filter(
3828
- (r) => r.role === "user" && e !== null && X(r) === e
3850
+ (r) => r.role === "user" && e !== null && V(r) === e
3829
3851
  ).map((r) => r.id)
3830
3852
  );
3831
3853
  return t.filter(
@@ -3834,14 +3856,14 @@ function vt(t, e, s) {
3834
3856
  }
3835
3857
  function ss(t, e) {
3836
3858
  return t.some(
3837
- (s, n) => n !== e && s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.loading !== !0 && s.steered !== !0) && _r(
3859
+ (s, n) => n !== e && s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.loading !== !0 && s.steered !== !0) && Dr(
3838
3860
  t,
3839
3861
  e,
3840
3862
  n
3841
3863
  )
3842
3864
  );
3843
3865
  }
3844
- function _r(t, e, s) {
3866
+ function Dr(t, e, s) {
3845
3867
  const n = t[e], r = t[s];
3846
3868
  if (le(n, r))
3847
3869
  return !0;
@@ -3852,9 +3874,9 @@ function _r(t, e, s) {
3852
3874
  return t[i].id === n.respondsToUserMessageId;
3853
3875
  return !1;
3854
3876
  }
3855
- function Pr(t, e) {
3877
+ function vr(t, e) {
3856
3878
  const s = [...t].reverse().find(
3857
- (n) => n.respondsToUserMessageId !== void 0 && n.respondsToUserMessageId !== e && Ot(n) && !Ur(
3879
+ (n) => n.respondsToUserMessageId !== void 0 && n.respondsToUserMessageId !== e && Ot(n) && !Or(
3858
3880
  t,
3859
3881
  n.respondsToUserMessageId
3860
3882
  )
@@ -3866,12 +3888,12 @@ function Pr(t, e) {
3866
3888
  function Ot(t) {
3867
3889
  return t.role === "tool" || F(t) ? !0 : t.role === "assistant" && t.phase === "commentary";
3868
3890
  }
3869
- function Ur(t, e) {
3891
+ function Or(t, e) {
3870
3892
  return t.some(
3871
3893
  (s) => s.respondsToUserMessageId === e && (W(s) || s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.loading !== !0))
3872
3894
  );
3873
3895
  }
3874
- function Dr(t, e) {
3896
+ function Lr(t, e) {
3875
3897
  const s = t[e];
3876
3898
  for (let n = e + 1; n < t.length; n += 1) {
3877
3899
  const r = t[n];
@@ -3880,7 +3902,7 @@ function Dr(t, e) {
3880
3902
  }
3881
3903
  return !1;
3882
3904
  }
3883
- function vr(t, e) {
3905
+ function qr(t, e) {
3884
3906
  const s = t[e];
3885
3907
  if (!s.respondsToUserMessageId)
3886
3908
  return !1;
@@ -3893,19 +3915,19 @@ function vr(t, e) {
3893
3915
  }
3894
3916
  return !1;
3895
3917
  }
3896
- function Or(t, e) {
3918
+ function Nr(t, e) {
3897
3919
  const s = t[e];
3898
3920
  return t.some(
3899
3921
  (n, r) => r !== e && n.role === "assistant" && le(s, n)
3900
3922
  );
3901
3923
  }
3902
- function qr(t, e) {
3924
+ function xr(t, e) {
3903
3925
  const s = t[e];
3904
3926
  return t.some(
3905
3927
  (n, r) => r !== e && n.role === "tool" && le(s, n)
3906
3928
  );
3907
3929
  }
3908
- function Lr(t, e) {
3930
+ function Br(t, e) {
3909
3931
  const s = t[e];
3910
3932
  for (let n = e + 1; n < t.length; n += 1)
3911
3933
  if (F(t[n]) && le(s, t[n]))
@@ -3918,7 +3940,7 @@ function le(t, e) {
3918
3940
  function S(t, e) {
3919
3941
  return t && typeof t == "object" && typeof t[e] == "string" ? t[e] : null;
3920
3942
  }
3921
- function Nr(t, e) {
3943
+ function Wr(t, e) {
3922
3944
  try {
3923
3945
  const s = window.localStorage.getItem(`${Ft}${t}`);
3924
3946
  if (!s)
@@ -3926,7 +3948,7 @@ function Nr(t, e) {
3926
3948
  const n = JSON.parse(s), r = typeof n.sessionId == "string" ? n.sessionId : null;
3927
3949
  if (e !== void 0 && r !== e)
3928
3950
  return null;
3929
- const i = Array.isArray(n.messages) ? n.messages.map(Xr).filter((o) => !!o) : [];
3951
+ const i = Array.isArray(n.messages) ? n.messages.map(Yr).filter((o) => !!o) : [];
3930
3952
  return {
3931
3953
  sessionId: r,
3932
3954
  messages: i
@@ -3935,20 +3957,20 @@ function Nr(t, e) {
3935
3957
  return null;
3936
3958
  }
3937
3959
  }
3938
- function xr(t, e) {
3960
+ function Hr(t, e) {
3939
3961
  try {
3940
3962
  window.localStorage.setItem(
3941
3963
  `${Ft}${t}`,
3942
3964
  JSON.stringify({
3943
3965
  sessionId: e.sessionId,
3944
- messages: e.messages.slice(-ln).map(Vr)
3966
+ messages: e.messages.slice(-dn).map(Qr)
3945
3967
  })
3946
3968
  );
3947
3969
  } catch {
3948
3970
  return;
3949
3971
  }
3950
3972
  }
3951
- function Br(t) {
3973
+ function $r(t) {
3952
3974
  try {
3953
3975
  const e = window.localStorage.getItem(`${ze}${t}`);
3954
3976
  if (!e)
@@ -3990,7 +4012,7 @@ function ns(t, e) {
3990
4012
  } catch {
3991
4013
  }
3992
4014
  }
3993
- function qt(t, e) {
4015
+ function Lt(t, e) {
3994
4016
  try {
3995
4017
  if (window.sessionStorage.getItem(`${Ee}${t}`) === null)
3996
4018
  return;
@@ -3999,19 +4021,19 @@ function qt(t, e) {
3999
4021
  }
4000
4022
  ns(t, e);
4001
4023
  }
4002
- function Wr(t) {
4024
+ function jr(t) {
4003
4025
  try {
4004
4026
  const e = `${Ee}${t}`, s = window.sessionStorage.getItem(e);
4005
4027
  if (window.sessionStorage.removeItem(e), !s)
4006
4028
  return [];
4007
4029
  const n = JSON.parse(s);
4008
- return Array.isArray(n) ? n.flatMap((r) => $r(r) ? [{
4030
+ return Array.isArray(n) ? n.flatMap((r) => zr(r) ? [{
4009
4031
  ...r.event,
4010
4032
  page: b(),
4011
4033
  rawOutput: {
4012
4034
  pageContextRestarted: !0,
4013
4035
  outcome: "unknown",
4014
- message: Hr(location.href),
4036
+ message: Fr(location.href),
4015
4037
  currentUrl: location.href,
4016
4038
  console: [],
4017
4039
  metadata: {
@@ -4028,17 +4050,17 @@ function Wr(t) {
4028
4050
  return [];
4029
4051
  }
4030
4052
  }
4031
- function Hr(t) {
4053
+ function Fr(t) {
4032
4054
  return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
4033
4055
  Current URL: ${t}`;
4034
4056
  }
4035
- function $r(t) {
4057
+ function zr(t) {
4036
4058
  if (!t || typeof t != "object")
4037
4059
  return !1;
4038
4060
  const e = t, s = e.event;
4039
4061
  return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" && nt(s) && s.type === "tool.result";
4040
4062
  }
4041
- function jr(t, e) {
4063
+ function Kr(t, e) {
4042
4064
  const s = new Set(
4043
4065
  t.flatMap((n) => n.type === "tool.result" ? [n.callId] : [])
4044
4066
  );
@@ -4047,7 +4069,7 @@ function jr(t, e) {
4047
4069
  ...e.filter((n) => !s.has(n.callId))
4048
4070
  ];
4049
4071
  }
4050
- function Fr(t) {
4072
+ function Gr(t) {
4051
4073
  try {
4052
4074
  window.sessionStorage.removeItem(`${Ee}${t}`);
4053
4075
  } catch {
@@ -4058,9 +4080,9 @@ function nt(t) {
4058
4080
  if (!t || typeof t != "object")
4059
4081
  return !1;
4060
4082
  const e = t;
4061
- return e.type === "chat.user_message" ? typeof e.content == "string" && Lt(e.page) : e.type === "page.upsert" || e.type === "session.reset" || e.type === "network.batch" ? Lt(e.page) : e.type === "tool.result" ? typeof e.sessionId == "string" && typeof e.callId == "string" && (e.toolName === "execute_code" || e.toolName === "execute_code_in_browser_tab") : e.type === "chat.retry_last_user_message" ? typeof e.sessionId == "string" && typeof e.clientMessageId == "string" : e.type === "run.stop" ? typeof e.sessionId == "string" && (e.reason === "user_requested" || e.reason === "new_chat" || e.reason === "session_switch") : !1;
4083
+ return e.type === "chat.user_message" ? typeof e.content == "string" && qt(e.page) : e.type === "page.upsert" || e.type === "session.reset" || e.type === "network.batch" ? qt(e.page) : e.type === "tool.result" ? typeof e.sessionId == "string" && typeof e.callId == "string" && (e.toolName === "execute_code" || e.toolName === "execute_code_in_browser_tab") : e.type === "chat.retry_last_user_message" ? typeof e.sessionId == "string" && typeof e.clientMessageId == "string" : e.type === "run.stop" ? typeof e.sessionId == "string" && (e.reason === "user_requested" || e.reason === "new_chat" || e.reason === "session_switch") : !1;
4062
4084
  }
4063
- function Lt(t) {
4085
+ function qt(t) {
4064
4086
  if (!t || typeof t != "object")
4065
4087
  return !1;
4066
4088
  const e = t;
@@ -4084,9 +4106,9 @@ function is(t, e) {
4084
4106
  } : t;
4085
4107
  }
4086
4108
  function Je(t) {
4087
- return t.type || Gr(t.name) || "application/octet-stream";
4109
+ return t.type || Jr(t.name) || "application/octet-stream";
4088
4110
  }
4089
- function zr(t) {
4111
+ function Vr(t) {
4090
4112
  os({
4091
4113
  name: t.name,
4092
4114
  mimeType: Je(t),
@@ -4094,21 +4116,21 @@ function zr(t) {
4094
4116
  });
4095
4117
  }
4096
4118
  function os(t) {
4097
- const e = Kr(t.name), s = t.mimeType.trim().toLowerCase();
4098
- if (!rn.has(`${e}:${s}`))
4119
+ const e = Xr(t.name), s = t.mimeType.trim().toLowerCase();
4120
+ if (!ln.has(`${e}:${s}`))
4099
4121
  throw new Error("This attachment type is not supported by the embedded model provider");
4100
4122
  if (t.sizeBytes <= 0 || t.sizeBytes >= $t)
4101
4123
  throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
4102
4124
  }
4103
- function Kr(t) {
4125
+ function Xr(t) {
4104
4126
  const e = t.trim().toLowerCase(), s = e.lastIndexOf(".");
4105
4127
  return s >= 0 ? e.slice(s) : "";
4106
4128
  }
4107
- function Gr(t) {
4129
+ function Jr(t) {
4108
4130
  const e = t.toLowerCase();
4109
4131
  return e.endsWith(".png") ? "image/png" : e.endsWith(".jpg") || e.endsWith(".jpeg") ? "image/jpeg" : e.endsWith(".webp") ? "image/webp" : e.endsWith(".gif") ? "image/gif" : e.endsWith(".pdf") ? "application/pdf" : null;
4110
4132
  }
4111
- function Xr(t) {
4133
+ function Yr(t) {
4112
4134
  if (!t || typeof t != "object")
4113
4135
  return null;
4114
4136
  const e = t;
@@ -4129,7 +4151,7 @@ function Xr(t) {
4129
4151
  loading: typeof e.loading == "boolean" ? e.loading : void 0
4130
4152
  };
4131
4153
  }
4132
- function Vr(t) {
4154
+ function Qr(t) {
4133
4155
  return t.attachments?.length ? {
4134
4156
  ...t,
4135
4157
  attachments: t.attachments.map(Me)
@@ -4153,9 +4175,9 @@ function _(t) {
4153
4175
  const e = t.runId;
4154
4176
  return typeof e == "string" && e ? e : null;
4155
4177
  }
4156
- function Jr(t) {
4178
+ function Zr(t) {
4157
4179
  const e = t?.timeoutMs;
4158
- return !!t && typeof t == "object" && typeof t.summary == "string" && typeof t.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <= mn);
4180
+ return !!t && typeof t == "object" && typeof t.summary == "string" && typeof t.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <= Tn);
4159
4181
  }
4160
4182
  function as(t) {
4161
4183
  const e = {};
@@ -4169,22 +4191,22 @@ function as(t) {
4169
4191
  return e;
4170
4192
  }
4171
4193
  function rt(t, e) {
4172
- return ps(t) ? Ce : B(Re(e), on);
4194
+ return ps(t) ? Ce : B(Re(e), un);
4173
4195
  }
4174
- function Yr(t, e) {
4196
+ function ei(t, e) {
4175
4197
  return typeof t == "string" ? t : t instanceof URL ? t.toString() : e?.url ?? "";
4176
4198
  }
4177
- async function Qr(t, e, s, n) {
4199
+ async function ti(t, e, s, n) {
4178
4200
  const r = as(t.headers);
4179
4201
  n({
4180
4202
  ...e,
4181
4203
  responseStatus: t.status,
4182
4204
  responseHeaders: r,
4183
- responseBody: await Zr(t),
4205
+ responseBody: await si(t),
4184
4206
  durationMs: Date.now() - s
4185
4207
  });
4186
4208
  }
4187
- async function Zr(t) {
4209
+ async function si(t) {
4188
4210
  if (!ls(t.headers))
4189
4211
  return;
4190
4212
  let e = null, s = null;
@@ -4194,7 +4216,7 @@ async function Zr(t) {
4194
4216
  const n = new Promise((a) => {
4195
4217
  s = window.setTimeout(() => {
4196
4218
  e?.cancel(), a("timeout");
4197
- }, an);
4219
+ }, cn);
4198
4220
  }), r = new TextDecoder();
4199
4221
  let i = "", o = 0;
4200
4222
  for (; ; ) {
@@ -4216,7 +4238,7 @@ async function Zr(t) {
4216
4238
  s !== null && window.clearTimeout(s);
4217
4239
  }
4218
4240
  }
4219
- function ei(t, e) {
4241
+ function ni(t, e) {
4220
4242
  if (ls(new Headers(e)))
4221
4243
  try {
4222
4244
  return t.responseType === "" || t.responseType === "text" ? B(t.responseText ?? "") : void 0;
@@ -4228,8 +4250,8 @@ function Nt(t) {
4228
4250
  if (typeof t == "string")
4229
4251
  return B(t);
4230
4252
  }
4231
- function ti(t) {
4232
- return q({
4253
+ function ri(t) {
4254
+ return L({
4233
4255
  ...t,
4234
4256
  requestBody: xt(t.requestBody),
4235
4257
  responseBody: xt(t.responseBody)
@@ -4242,7 +4264,7 @@ function xt(t) {
4242
4264
  if (!e.startsWith("{") && !e.startsWith("["))
4243
4265
  return Re(t);
4244
4266
  try {
4245
- return JSON.stringify(q(JSON.parse(t)));
4267
+ return JSON.stringify(L(JSON.parse(t)));
4246
4268
  } catch {
4247
4269
  return Re(t);
4248
4270
  }
@@ -4254,7 +4276,7 @@ function ls(t) {
4254
4276
  return s !== null && Number.isInteger(n) && n >= 0 && n <= et && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
4255
4277
  }
4256
4278
  function J(t, e = {}, s) {
4257
- if (ni(s))
4279
+ if (oi(s))
4258
4280
  return !0;
4259
4281
  const n = Object.entries(e).find(([r]) => r.toLowerCase() === "content-type")?.[1]?.toLowerCase();
4260
4282
  if (n?.includes("multipart/form-data") || n?.includes("application/octet-stream"))
@@ -4269,7 +4291,7 @@ function J(t, e = {}, s) {
4269
4291
  return !0;
4270
4292
  }
4271
4293
  }
4272
- function si(t, e) {
4294
+ function ii(t, e) {
4273
4295
  if (J(t))
4274
4296
  return !0;
4275
4297
  try {
@@ -4279,10 +4301,10 @@ function si(t, e) {
4279
4301
  return !0;
4280
4302
  }
4281
4303
  }
4282
- function ni(t) {
4304
+ function oi(t) {
4283
4305
  return t instanceof FormData || t instanceof Blob || t instanceof ArrayBuffer || ArrayBuffer.isView(t) || typeof ReadableStream < "u" && t instanceof ReadableStream;
4284
4306
  }
4285
- function ri(t) {
4307
+ function ai(t) {
4286
4308
  const e = {};
4287
4309
  for (const s of t.trim().split(/[\r\n]+/)) {
4288
4310
  const n = s.indexOf(":");
@@ -4313,28 +4335,28 @@ async function fe(t, e) {
4313
4335
  try {
4314
4336
  return await t();
4315
4337
  } catch (r) {
4316
- if (s = r, n >= At - 1 || !oi(r))
4338
+ if (s = r, n >= At - 1 || !ui(r))
4317
4339
  throw r;
4318
- await ii(n);
4340
+ await li(n);
4319
4341
  }
4320
4342
  throw s instanceof Error ? s : new Error(e);
4321
4343
  }
4322
- function ii(t) {
4344
+ function li(t) {
4323
4345
  return new Promise((e) => {
4324
- window.setTimeout(e, nn[t] ?? 0);
4346
+ window.setTimeout(e, an[t] ?? 0);
4325
4347
  });
4326
4348
  }
4327
- function oi(t) {
4328
- return t instanceof Te ? ai(t.status) : t instanceof TypeError;
4349
+ function ui(t) {
4350
+ return t instanceof Te ? ci(t.status) : t instanceof TypeError;
4329
4351
  }
4330
- function ai(t) {
4352
+ function ci(t) {
4331
4353
  return t === 408 || t === 409 || t === 429 || t >= 500;
4332
4354
  }
4333
- function li(t) {
4355
+ function di(t) {
4334
4356
  return t === 401 || t === 403;
4335
4357
  }
4336
- const Ce = "[REDACTED_SECRET]", H = "[REDACTED_TOKEN]", ui = "[REDACTED_SIGNED_URL]", ci = 20, di = /^(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, us = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, cs = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, ds = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, hs = /\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, hi = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, pi = /\bhttps?:\/\/[^\s"'<>]+/gi, gi = /[),.;\]]+$/;
4337
- function q(t) {
4358
+ const Ce = "[REDACTED_SECRET]", H = "[REDACTED_TOKEN]", hi = "[REDACTED_SIGNED_URL]", pi = 20, gi = /^(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, us = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, cs = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, ds = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, hs = /\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, fi = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, mi = /\bhttps?:\/\/[^\s"'<>]+/gi, yi = /[),.;\]]+$/;
4359
+ function L(t) {
4338
4360
  return Ae(t, 0, /* @__PURE__ */ new WeakSet());
4339
4361
  }
4340
4362
  function Ae(t, e, s) {
@@ -4342,7 +4364,7 @@ function Ae(t, e, s) {
4342
4364
  return t.startsWith("data:image/") || t.startsWith("data:application/pdf;") ? t : Re(t);
4343
4365
  if (t === null || typeof t != "object")
4344
4366
  return t;
4345
- if (e >= ci)
4367
+ if (e >= pi)
4346
4368
  return "[REDACTED_MAX_DEPTH]";
4347
4369
  if (s.has(t))
4348
4370
  return "[REDACTED_CIRCULAR]";
@@ -4350,46 +4372,46 @@ function Ae(t, e, s) {
4350
4372
  return t.map((r) => Ae(r, e + 1, s));
4351
4373
  const n = {};
4352
4374
  for (const [r, i] of Object.entries(t))
4353
- r === "pageContent" ? n[r] = i : ps(r) ? n[r] = Ce : n[r] = r.toLowerCase() === "url" ? fi(i) : Ae(i, e + 1, s);
4375
+ r === "pageContent" ? n[r] = i : ps(r) ? n[r] = Ce : n[r] = r.toLowerCase() === "url" ? Ii(i) : Ae(i, e + 1, s);
4354
4376
  return n;
4355
4377
  }
4356
4378
  function ps(t) {
4357
4379
  const e = t.replace(/[^a-z0-9]/gi, "").toLowerCase();
4358
4380
  return e.includes("authorization") || e.includes("cookie") || e.includes("password") || e.includes("passwd") || e === "pwd" || e.includes("secret") || e === "token" || e.endsWith("token") || e.includes("apikey") || e.includes("csrf") || e.includes("xsrf") || e === "jwt" || e === "session" || e === "signature" || e.includes("privatekey");
4359
4381
  }
4360
- function fi(t) {
4382
+ function Ii(t) {
4361
4383
  return typeof t == "string" ? gs(t) : Ae(t, 0, /* @__PURE__ */ new WeakSet());
4362
4384
  }
4363
4385
  function gs(t) {
4364
4386
  try {
4365
4387
  const e = new URL(t, location.href);
4366
4388
  for (const s of Array.from(e.searchParams.keys()))
4367
- di.test(s) && e.searchParams.set(s, H);
4389
+ gi.test(s) && e.searchParams.set(s, H);
4368
4390
  return e.username && (e.username = H), e.password && (e.password = H), e.toString();
4369
4391
  } catch {
4370
- return mi(t);
4392
+ return Ti(t);
4371
4393
  }
4372
4394
  }
4373
4395
  function Re(t) {
4374
- return t.replace(hi, ui).replace(pi, yi).replace(us, `Bearer ${H}`).replace(cs, `Basic ${H}`).replace(ds, H).replace(hs, (e, s) => `${s}: ${Ce}`);
4396
+ return t.replace(fi, hi).replace(mi, Si).replace(us, `Bearer ${H}`).replace(cs, `Basic ${H}`).replace(ds, H).replace(hs, (e, s) => `${s}: ${Ce}`);
4375
4397
  }
4376
- function mi(t) {
4398
+ function Ti(t) {
4377
4399
  return t.replace(us, `Bearer ${H}`).replace(cs, `Basic ${H}`).replace(ds, H).replace(hs, (e, s) => `${s}: ${Ce}`);
4378
4400
  }
4379
- function yi(t) {
4380
- const e = t.match(gi)?.[0] ?? "", s = e ? t.slice(0, -e.length) : t;
4401
+ function Si(t) {
4402
+ const e = t.match(yi)?.[0] ?? "", s = e ? t.slice(0, -e.length) : t;
4381
4403
  return `${gs(s)}${e}`;
4382
4404
  }
4383
4405
  export {
4384
4406
  pt as PLUNO_PRODUCT_AGENT_SDK_PREVIEW_HOST_SELECTOR,
4385
4407
  Fe as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
4386
- Ws as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
4387
- Bs as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
4388
- Hs as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
4389
- Ii as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
4408
+ Fs as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
4409
+ js as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
4410
+ zs as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
4411
+ wi as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
4390
4412
  zt as PlunoProductAgent,
4391
- cn as calculateReconnectDelay,
4413
+ pn as calculateReconnectDelay,
4392
4414
  zt as default,
4393
- Dn as getProductAgentOriginAccessErrorMessage,
4394
- zr as validateProductAgentProviderInputFile
4415
+ Ln as getProductAgentOriginAccessErrorMessage,
4416
+ Vr as validateProductAgentProviderInputFile
4395
4417
  };