@pluno/product-agent-web 0.1.229 → 0.1.230

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.
@@ -3325,13 +3325,14 @@ class N extends EventTarget {
3325
3325
  }
3326
3326
  async loadUserSuggestions(e, t = 0) {
3327
3327
  const i = this.promptRevision, n = this.options.pageUrl();
3328
+ this.receive({ type: "starterPrompts.updated", starterPromptsLoading: !0 });
3328
3329
  try {
3329
3330
  const r = await this.httpTransport.request("/user-suggested-tasks", {}, void 0, void 0, void 0, e);
3330
3331
  !e.aborted && i === this.promptRevision && n === this.options.pageUrl() && this.receive({ ...r, type: "starterPrompts.updated" });
3331
3332
  } catch (r) {
3332
3333
  if (e.aborted) return;
3333
3334
  if (!this.isRetryableRead(r)) {
3334
- r instanceof v && ["unauthorized", "update_required"].includes(r.code) ? this.fail(r) : console.error("Product Agent optional suggestions could not be loaded", r);
3335
+ i === this.promptRevision && n === this.options.pageUrl() && this.receive({ type: "starterPrompts.updated", starterPromptsLoading: !1 }), r instanceof v && ["unauthorized", "update_required"].includes(r.code) ? this.fail(r) : console.error("Product Agent optional suggestions could not be loaded", r);
3335
3336
  return;
3336
3337
  }
3337
3338
  this.suggestionTimer = setTimeout(() => {
@@ -4701,7 +4702,7 @@ class Vo {
4701
4702
  return `${xt(e.scope)}:category:${e.category}`;
4702
4703
  }
4703
4704
  }
4704
- function jl(s, e) {
4705
+ function $l(s, e) {
4705
4706
  return {
4706
4707
  load: async () => Go(s, e),
4707
4708
  save: async (t) => s.setItem(e, JSON.stringify(t))
@@ -4829,7 +4830,7 @@ function Qo(s, e, t) {
4829
4830
  function Jo(s) {
4830
4831
  return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
4831
4832
  }
4832
- function Hl(s) {
4833
+ function Wl(s) {
4833
4834
  return s.visible ? s.minimized ? { state: "minimized" } : { state: s.open ? "visible_open" : "visible_closed" } : { state: "hidden" };
4834
4835
  }
4835
4836
  function Xo(s, e) {
@@ -4840,9 +4841,12 @@ function Yo(s) {
4840
4841
  const e = s.paidCreditFallbackModel;
4841
4842
  return typeof e == "string" && e.length > 0;
4842
4843
  }
4843
- function $l(s) {
4844
+ function zl(s) {
4845
+ return s.submissionAllowed && s.isAuthenticated && s.hasWorkspace && !s.isWebsiteBlocked && s.isCurrentPageResolved && !s.isSubmitting && !s.hasPendingMessage;
4846
+ }
4847
+ function Kl(s) {
4844
4848
  const e = s.hasDraftMessage || s.hasPreSubmittedAttachment;
4845
- return s.hasRunningAssistantTurn && !s.hasDraftMessage ? {
4849
+ return s.hasRunningAssistantTurn && !e ? {
4846
4850
  action: "stop",
4847
4851
  disabled: !s.canStopRunningTurn
4848
4852
  } : {
@@ -4850,7 +4854,11 @@ function $l(s) {
4850
4854
  disabled: !e || !s.canSubmitMessage
4851
4855
  };
4852
4856
  }
4853
- class Wl {
4857
+ const Zo = "Pluno is reconnecting. Try again in a moment.";
4858
+ function ea(s) {
4859
+ return (s instanceof Error ? s.message : s) === Zo;
4860
+ }
4861
+ class Vl {
4854
4862
  constructor(e, t, i = 20) {
4855
4863
  this.loadPage = t, this.limit = i, this.recentQuery = new ti(
4856
4864
  `${e}:recent`,
@@ -4893,7 +4901,7 @@ class Wl {
4893
4901
  }) : null;
4894
4902
  return {
4895
4903
  key: e.key.slice(0, -7),
4896
- status: Zo(e, t),
4904
+ status: ta(e, t),
4897
4905
  data: a,
4898
4906
  error: e.error ?? t.error,
4899
4907
  requestId: Math.max(e.requestId, t.requestId),
@@ -5002,21 +5010,21 @@ class Wl {
5002
5010
  function Ge(s) {
5003
5011
  return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
5004
5012
  }
5005
- function Zo(s, e) {
5013
+ function ta(s, e) {
5006
5014
  return s.status === "error" || e.status === "error" ? "error" : s.status === "loading" || e.status === "loading" ? "loading" : s.status === "refreshing" || e.status === "refreshing" ? "refreshing" : s.status === "loading_more" ? "loading_more" : s.status === "ready" || e.status === "ready" ? "ready" : "not_requested";
5007
5015
  }
5008
- const ea = {
5016
+ const sa = {
5009
5017
  working: "⏳",
5010
5018
  completed: "✅",
5011
5019
  failed: "❗",
5012
5020
  stopped: "⏹️"
5013
- }, ta = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
5014
- function sa(s, e) {
5021
+ }, ia = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
5022
+ function na(s, e) {
5015
5023
  if (!e) return pt(s);
5016
- const t = pt(s), i = `${ea[e]} Pluno`;
5024
+ const t = pt(s), i = `${sa[e]} Pluno`;
5017
5025
  return t ? `${i}: ${t}` : i;
5018
5026
  }
5019
- class zl {
5027
+ class Gl {
5020
5028
  constructor(e) {
5021
5029
  this.titleDocument = e;
5022
5030
  }
@@ -5050,11 +5058,11 @@ class zl {
5050
5058
  applyTitle() {
5051
5059
  if (!this.status)
5052
5060
  return;
5053
- const e = sa(this.baseTitle, this.status);
5061
+ const e = na(this.baseTitle, this.status);
5054
5062
  this.lastAppliedTitle = e, this.titleDocument.getTitle() !== e && this.titleDocument.setTitle(e);
5055
5063
  }
5056
5064
  }
5057
- function Kl(s) {
5065
+ function Ql(s) {
5058
5066
  return {
5059
5067
  getTitle: () => s.title,
5060
5068
  setTitle: (e) => {
@@ -5071,9 +5079,9 @@ function Kl(s) {
5071
5079
  };
5072
5080
  }
5073
5081
  function pt(s) {
5074
- return s.replace(ta, "");
5082
+ return s.replace(ia, "");
5075
5083
  }
5076
- const ia = {
5084
+ const ra = {
5077
5085
  "in-progress-stop-unavailable": "An in-progress response has no visible enabled interrupt control.",
5078
5086
  "stop-did-not-interrupt": "The stopped response remained in progress after an interrupt click.",
5079
5087
  "duplicate-message-item": "A canonical message rendered more than once.",
@@ -5088,8 +5096,8 @@ const ia = {
5088
5096
  "thinking-groups-without-user-message": "Multiple thinking groups appeared without a user message between them.",
5089
5097
  "thinking-without-progress": "Thinking remained visible without progress for five minutes."
5090
5098
  };
5091
- function na(s) {
5092
- return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(ia, s.slice(13));
5099
+ function oa(s) {
5100
+ return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(ra, s.slice(13));
5093
5101
  }
5094
5102
  function si(s) {
5095
5103
  return {
@@ -5102,7 +5110,7 @@ function si(s) {
5102
5110
  ...s.fileUrl === void 0 ? {} : { fileUrl: s.fileUrl }
5103
5111
  };
5104
5112
  }
5105
- function Vl(s) {
5113
+ function Jl(s) {
5106
5114
  if (!s || typeof s != "object" || !("type" in s)) return !1;
5107
5115
  const e = s;
5108
5116
  switch (e.type) {
@@ -5119,7 +5127,7 @@ function Vl(s) {
5119
5127
  case "runtime.report_displayed_error":
5120
5128
  return (e.reason === "conversation_error" || e.reason === "attachment_error" || e.reason === "history_error" || e.reason === "action_error") && typeof e.errorFingerprint == "string" && /^fnv1a-[0-9a-f]{8}$/.test(e.errorFingerprint) && (e.displayedMessage === void 0 || typeof e.displayedMessage == "string" && e.displayedMessage.length <= 500);
5121
5129
  case "runtime.report_invalid_state_transition":
5122
- return (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" || na(e.reason)) && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
5130
+ return (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" || oa(e.reason)) && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
5123
5131
  case "runtime.widget_lifecycle":
5124
5132
  return (e.action === "opened" || e.action === "closed" || e.action === "minimized") && typeof e.trigger == "string";
5125
5133
  case "session.load":
@@ -5147,7 +5155,7 @@ function Vl(s) {
5147
5155
  return !1;
5148
5156
  }
5149
5157
  }
5150
- class Gl {
5158
+ class Xl {
5151
5159
  constructor(e, t, i) {
5152
5160
  this.adapter = t, this.state = Bt(e), this.model = i;
5153
5161
  }
@@ -5348,15 +5356,20 @@ class Gl {
5348
5356
  return o === this.stagedProactiveSuggestionClientMessageId && (this.stagedProactiveSuggestionClientMessageId = null), l?.clientMessageId ?? o;
5349
5357
  } catch (l) {
5350
5358
  if (n !== this.submissionGeneration) return null;
5359
+ const d = ea(l);
5360
+ if (d)
5361
+ for (const u of t.attachments ?? [])
5362
+ u.id && this.attachmentFiles.delete(u.id);
5351
5363
  throw this.unacknowledgedSubmissions.delete(o), this.state = {
5352
5364
  ...this.state,
5353
- messages: this.state.messages.filter(
5354
- (d) => d.id !== `local-${o}` && d.id !== `optimistic-user-message:${o}`
5365
+ messages: d ? this.state.messages : this.state.messages.filter(
5366
+ (u) => u.id !== `local-${o}` && u.id !== `optimistic-user-message:${o}`
5355
5367
  ),
5356
5368
  pendingMessageStatus: i.pendingMessageStatus,
5357
5369
  turnPhase: i.turnPhase,
5358
5370
  isThinking: i.isThinking,
5359
- taskStatus: i.taskStatus
5371
+ taskStatus: d ? "failed" : i.taskStatus,
5372
+ ...d ? { lastError: l instanceof Error ? l.message : String(l), lastErrorCode: "auth_reconnecting" } : {}
5360
5373
  }, this.emit("state", this.getState()), c && await this.adapter.dispatch({
5361
5374
  type: "conversation.fail_staged",
5362
5375
  clientMessageId: o,
@@ -5538,7 +5551,7 @@ function ni(s) {
5538
5551
  }) : null
5539
5552
  };
5540
5553
  }
5541
- const ra = globalThis.fetch.bind(globalThis), ri = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', oa = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', aa = ".pluno-pa-widget__panel", ca = ".pluno-pa-widget__timeline", la = "__plunoExtensionWidgetOwner";
5554
+ const aa = globalThis.fetch.bind(globalThis), ri = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', ca = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', la = ".pluno-pa-widget__panel", da = ".pluno-pa-widget__timeline", ua = "__plunoExtensionWidgetOwner";
5542
5555
  class ne extends Error {
5543
5556
  constructor(e, t, i, n) {
5544
5557
  super(e), this.retryable = t, this.status = i, this.retryAfterMs = n, this.name = "ProductAgentTokenProviderError";
@@ -5547,10 +5560,10 @@ class ne extends Error {
5547
5560
  status;
5548
5561
  retryAfterMs;
5549
5562
  }
5550
- function da(s) {
5563
+ function ha(s) {
5551
5564
  return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
5552
5565
  }
5553
- let ua = 0;
5566
+ let pa = 0;
5554
5567
  function Nt(s) {
5555
5568
  const e = {};
5556
5569
  for (const c of [
@@ -5630,7 +5643,7 @@ function Ce(s, e, t) {
5630
5643
  source: "web_sdk",
5631
5644
  category: s,
5632
5645
  name: e,
5633
- sequence: ++ua,
5646
+ sequence: ++pa,
5634
5647
  wallTime: (/* @__PURE__ */ new Date()).toISOString(),
5635
5648
  monotonicMs: performance.now(),
5636
5649
  data: t
@@ -5639,27 +5652,27 @@ function Ce(s, e, t) {
5639
5652
  }
5640
5653
  class Qe extends Error {
5641
5654
  }
5642
- function ha(s) {
5655
+ function fa(s) {
5643
5656
  return s === 408 || s === 425 || s === 429 || s >= 500;
5644
5657
  }
5645
- const pa = "https://app.pluno.ai", fa = 2e4, ga = 1e4, ya = 6e4, ma = 6e4, Ia = 1e4, Sa = 1e4, wa = 3e3, ba = 3e4, va = 1e3, as = 3e4, oi = 0.2, Ta = 6e4, ai = 15e3, Lt = 6e4, Je = 3, _a = 8, Ra = "Browser connection was interrupted.", ci = 15e3, li = "Pluno could not send this message. Try it again.", Aa = "Still connecting to Pluno. Retrying automatically.", di = 2e3, ka = 1e3, Ma = 100, ui = 3, Ea = [300, 1e3], fn = 50 * 1024 * 1024, Ca = /* @__PURE__ */ new Set([
5658
+ const ga = "https://app.pluno.ai", ya = 2e4, ma = 1e4, Ia = 6e4, Sa = 6e4, wa = 1e4, ba = 1e4, va = 3e3, Ta = 3e4, _a = 1e3, as = 3e4, oi = 0.2, Ra = 6e4, ai = 15e3, Lt = 6e4, Je = 3, Aa = 8, ka = "Browser connection was interrupted.", ci = 15e3, li = "Pluno could not send this message. Try it again.", Ma = "Still connecting to Pluno. Retrying automatically.", di = 2e3, Ea = 1e3, Ca = 100, ui = 3, Pa = [300, 1e3], fn = 50 * 1024 * 1024, Da = /* @__PURE__ */ new Set([
5646
5659
  ".jpeg:image/jpeg",
5647
5660
  ".jpg:image/jpeg",
5648
5661
  ".pdf:application/pdf",
5649
5662
  ".png:image/png",
5650
5663
  ".webp:image/webp"
5651
- ]), Ql = ".pdf,.png,.jpg,.jpeg,.webp", As = 64e3, Ft = 4e3, ks = 30, Pa = 2e3, Da = 1e3, gn = "Image is too large for model vision input.", Ua = 100, qa = 20, yn = "pluno.productAgent.state.", cs = "pluno.productAgent.pendingEvents.", mn = "pluno.productAgent.pendingDeliveryRecovery.", bt = "pluno.productAgent.activeToolCalls.", Oa = 100;
5652
- function xa(s, e = 0) {
5664
+ ]), Yl = ".pdf,.png,.jpg,.jpeg,.webp", As = 64e3, Ft = 4e3, ks = 30, Ua = 2e3, qa = 1e3, gn = "Image is too large for model vision input.", Oa = 100, xa = 20, yn = "pluno.productAgent.state.", cs = "pluno.productAgent.pendingEvents.", mn = "pluno.productAgent.pendingDeliveryRecovery.", bt = "pluno.productAgent.activeToolCalls.", Ba = 100;
5665
+ function Na(s, e = 0) {
5653
5666
  const t = s === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (s - 1));
5654
5667
  return Math.max(e, t);
5655
5668
  }
5656
5669
  const ut = /* @__PURE__ */ new Set();
5657
5670
  let Xe = null;
5658
- function Ba(s, e = Math.random) {
5659
- const t = Math.min(as, va * 2 ** s), i = 1 - oi + e() * oi * 2;
5671
+ function La(s, e = Math.random) {
5672
+ const t = Math.min(as, _a * 2 ** s), i = 1 - oi + e() * oi * 2;
5660
5673
  return Math.min(as, Math.round(t * i));
5661
5674
  }
5662
- function Na(s) {
5675
+ function Fa(s) {
5663
5676
  const e = s.split(".")[1];
5664
5677
  if (!e)
5665
5678
  return null;
@@ -5733,9 +5746,9 @@ class vt {
5733
5746
  selectedModel: e.model
5734
5747
  }), this.state = {
5735
5748
  ...this.state,
5736
- starterPrompts: Ic(e.initialStarterPrompts)
5749
+ starterPrompts: wc(e.initialStarterPrompts)
5737
5750
  }, this.account = e.initialAccount ? { ...e.initialAccount } : null;
5738
- const n = e.restorePersistedState === !1 ? null : rl(e.clientId, e.expectedPersistedSessionId);
5751
+ const n = e.restorePersistedState === !1 ? null : al(e.clientId, e.expectedPersistedSessionId);
5739
5752
  n && (this.state = {
5740
5753
  ...this.state,
5741
5754
  ...n,
@@ -5756,9 +5769,9 @@ class vt {
5756
5769
  taskStatus: null,
5757
5770
  isRetrying: !1,
5758
5771
  lastError: null
5759
- }, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents = ul(
5760
- al(e.clientId),
5761
- cl(e.clientId)
5772
+ }, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents = pl(
5773
+ ll(e.clientId),
5774
+ dl(e.clientId)
5762
5775
  );
5763
5776
  const r = [...this.queuedClientEvents].reverse().find(
5764
5777
  (o) => o.type === "chat.user_message" && typeof o.clientMessageId == "string"
@@ -5927,10 +5940,10 @@ class vt {
5927
5940
  t.skipStoredTransportIdentityCollisionCheck === !0
5928
5941
  ), n = new vt({
5929
5942
  ...e,
5930
- backendUrl: ic(e.backendUrl ?? pa),
5931
- clientId: e.clientId ?? Tc(),
5943
+ backendUrl: rc(e.backendUrl ?? ga),
5944
+ clientId: e.clientId ?? Rc(),
5932
5945
  productVariant: e.productVariant ?? "customer_embedded",
5933
- entrySurface: nc(e.entrySurface)
5946
+ entrySurface: oc(e.entrySurface)
5934
5947
  }, i);
5935
5948
  try {
5936
5949
  await n.initializeDirectory(), Io().catch((r) => {
@@ -6121,7 +6134,7 @@ class vt {
6121
6134
  return this.options.token;
6122
6135
  if (!this.options.tokenProvider)
6123
6136
  return this.token;
6124
- const i = Date.now(), n = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs - ma > i;
6137
+ const i = Date.now(), n = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs - Sa > i;
6125
6138
  if (!t.forceRefresh && (n || t.preferCached && this.token !== null))
6126
6139
  return this.token;
6127
6140
  if (this.tokenRequest && !t.forceRefresh)
@@ -6134,7 +6147,7 @@ class vt {
6134
6147
  const c = new Promise((l, d) => {
6135
6148
  a = window.setTimeout(() => {
6136
6149
  r.abort(), d(new ne("Pluno token provider timed out", !0));
6137
- }, ya);
6150
+ }, Ia);
6138
6151
  });
6139
6152
  try {
6140
6153
  const l = await Promise.race([
@@ -6145,7 +6158,7 @@ class vt {
6145
6158
  throw new ne("Pluno token request was cancelled", !0);
6146
6159
  if (!l)
6147
6160
  throw new ne("Pluno token provider did not return a token", !1);
6148
- return this.token = l, this.tokenExpiresAtMs = Na(l), l;
6161
+ return this.token = l, this.tokenExpiresAtMs = Fa(l), l;
6149
6162
  } finally {
6150
6163
  a !== null && window.clearTimeout(a);
6151
6164
  }
@@ -6192,7 +6205,7 @@ class vt {
6192
6205
  await this.replaceDefaultTransportCredentials(this.socket);
6193
6206
  return;
6194
6207
  }
6195
- const i = ac(this.options.backendUrl), n = this.options.webSocketFactory?.(i) ?? new N({
6208
+ const i = lc(this.options.backendUrl), n = this.options.webSocketFactory?.(i) ?? new N({
6196
6209
  backendUrl: this.options.backendUrl,
6197
6210
  entrySurface: this.options.entrySurface,
6198
6211
  auth: {
@@ -6212,7 +6225,7 @@ class vt {
6212
6225
  });
6213
6226
  this.socket = n, this.options.webSocketFactory && (this.socketConnectTimer = window.setTimeout(() => {
6214
6227
  this.socket === n && n.readyState === WebSocket.CONNECTING && (M("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.reportTransportDiagnostic("connect_timeout"), this.replaceTimedOutSocket(n));
6215
- }, Ia)), n.addEventListener("reconnecting", () => {
6228
+ }, wa)), n.addEventListener("reconnecting", () => {
6216
6229
  this.socket === n && this.state.status !== "closed" && (this.refreshingDefaultCredentials || this.reportTransportDiagnostic("socket_closed", { closeCode: 1006, wasClean: !1 }), this.setReconnectingState());
6217
6230
  }), n.addEventListener("open", () => {
6218
6231
  this.socket !== n || (this.clearSocketConnectTimer(), this.directoryObservation.reconnect().catch(() => {
@@ -6227,12 +6240,12 @@ class vt {
6227
6240
  pageUrl: location.href
6228
6241
  }) : !0)) || this.options.webSocketFactory && (this.socketAuthTimer = window.setTimeout(() => {
6229
6242
  this.socket === n && (M("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.reportTransportDiagnostic("auth_timeout"), this.replaceTimedOutSocket(n));
6230
- }, Sa));
6243
+ }, ba));
6231
6244
  }), n.addEventListener("message", (r) => {
6232
6245
  if (this.socket !== n)
6233
6246
  return;
6234
6247
  const o = mi(r.data);
6235
- if (n instanceof N && o.type === "tool.call" && !yc(o)) {
6248
+ if (n instanceof N && o.type === "tool.call" && !Ic(o)) {
6236
6249
  this.handleServerEvent({ type: "error", message: "Invalid tool-call envelope" });
6237
6250
  return;
6238
6251
  }
@@ -6241,7 +6254,7 @@ class vt {
6241
6254
  }), n.addEventListener("sendfailure", (r) => {
6242
6255
  if (this.socket !== n)
6243
6256
  return;
6244
- const o = mc(r?.detail?.data);
6257
+ const o = Sc(r?.detail?.data);
6245
6258
  o?.type === "chat.user_message" && o.clientMessageId === this.pendingClientMessageId && !this.queuedClientEvents.some(
6246
6259
  (a) => a.type === "chat.user_message" && a.clientMessageId === o.clientMessageId
6247
6260
  ) && (this.queuedClientEvents.push(o), $(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();
@@ -6276,7 +6289,7 @@ class vt {
6276
6289
  reconnectAttempt: this.reconnectAttempts
6277
6290
  }), i instanceof ne && this.reportTransportDiagnostic("auth_timeout"), this.setState({
6278
6291
  status: "reconnecting",
6279
- lastError: Aa,
6292
+ lastError: Ma,
6280
6293
  lastErrorCode: "connection_failed"
6281
6294
  }), this.emit("error", n), this.scheduleReconnect(
6282
6295
  i instanceof ne ? i.retryAfterMs : void 0
@@ -6300,7 +6313,7 @@ class vt {
6300
6313
  }
6301
6314
  destroy() {
6302
6315
  if (!this.clientRuntime.isDisposed) {
6303
- this.assistantDeltaReplayGuard.clear(), this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), hl(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [], this.detachedSessionIds.clear(), this.detachedClientMessageIds.clear(), this.deferredDetachedSessionEvents.clear();
6316
+ this.assistantDeltaReplayGuard.clear(), this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), fl(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [], this.detachedSessionIds.clear(), this.detachedClientMessageIds.clear(), this.deferredDetachedSessionEvents.clear();
6304
6317
  for (const e of Object.values(this.listeners))
6305
6318
  e?.clear();
6306
6319
  this.accountListeners.clear(), this.interactionListeners.clear(), this.directoryObservation.dispose(), this.directoryHttp.dispose(), this.clientRuntime.dispose();
@@ -6449,7 +6462,7 @@ class vt {
6449
6462
  sessionId: this.state.sessionId ?? void 0,
6450
6463
  clientMessageId: a,
6451
6464
  initiatedBy: t.initiatedBy,
6452
- invocation: rc(t.invocation ?? t.initiatedBy),
6465
+ invocation: ac(t.invocation ?? t.initiatedBy),
6453
6466
  entrySurface: this.options.entrySurface,
6454
6467
  content: i,
6455
6468
  proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
@@ -6509,7 +6522,7 @@ class vt {
6509
6522
  } });
6510
6523
  }
6511
6524
  createLocalAttachment(e) {
6512
- this.options.productVariant === "customer_embedded" && pl(e);
6525
+ this.options.productVariant === "customer_embedded" && gl(e);
6513
6526
  const t = L(), i = {
6514
6527
  id: t,
6515
6528
  name: e.name || "attachment",
@@ -6615,7 +6628,7 @@ class vt {
6615
6628
  const i = await this.fetchEmbedAttachmentUpload(e, !1);
6616
6629
  if (i.ok)
6617
6630
  return await i.json();
6618
- if (Cl(i.status) && this.options.tokenProvider && !t) {
6631
+ if (Dl(i.status) && this.options.tokenProvider && !t) {
6619
6632
  t = !0;
6620
6633
  const n = await this.fetchEmbedAttachmentUpload(e, !0);
6621
6634
  if (n.ok)
@@ -6862,7 +6875,7 @@ class vt {
6862
6875
  throw new Error("This interaction is no longer available.");
6863
6876
  if (!r.allowedActions.includes(t))
6864
6877
  throw new Error("This action is not available for the interaction.");
6865
- if (da(t) && await this.interactionManager.act(
6878
+ if (ha(t) && await this.interactionManager.act(
6866
6879
  {
6867
6880
  key: r.id,
6868
6881
  category: r.category,
@@ -7045,7 +7058,7 @@ class vt {
7045
7058
  if (Object.values(this.clientRuntime.engine.getProjection().directory.optimisticEntries).some((c) => c.id === e && c.sessionId === null)) return;
7046
7059
  const t = L(), i = this.activeComposerWarmupId, n = this.pendingClientMessageId;
7047
7060
  this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages);
7048
- const r = this.getCachedSessionTimeline(e), o = [...r ?? []].reverse().find((c) => c.dataType === "assistant_draft" && c.steered !== !0), a = Gc(r ?? []);
7061
+ const r = this.getCachedSessionTimeline(e), o = [...r ?? []].reverse().find((c) => c.dataType === "assistant_draft" && c.steered !== !0), a = Jc(r ?? []);
7049
7062
  if (!this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId !== e && this.rememberCurrentRunAsDetached(), this.detachedSessionIds.delete(e), this.deferredDetachedSessionEvents.delete(e), !this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId && (this.state.isThinking || this.state.pendingMessageStatus !== null)) {
7050
7063
  const c = this.getStopClientMessageId();
7051
7064
  c && this.send({ type: "run.stop", sessionId: this.state.sessionId, expectedUserMessageId: c, reason: "session_switch" });
@@ -7185,7 +7198,7 @@ class vt {
7185
7198
  });
7186
7199
  if (!l.ok) {
7187
7200
  const u = await l.text() || `History request failed (${l.status})`;
7188
- throw ha(l.status) ? new Error(u) : new Qe(u);
7201
+ throw fa(l.status) ? new Error(u) : new Qe(u);
7189
7202
  }
7190
7203
  const d = await l.json();
7191
7204
  if (!d?.session || !Array.isArray(d.items))
@@ -7476,7 +7489,7 @@ class vt {
7476
7489
  if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
7477
7490
  return;
7478
7491
  this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
7479
- const e = cc();
7492
+ const e = dc();
7480
7493
  this.sendNow(
7481
7494
  V({
7482
7495
  type: "starter_prompts.page_context",
@@ -7487,13 +7500,13 @@ class vt {
7487
7500
  ) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
7488
7501
  }
7489
7502
  startStarterPromptUrlWatcher() {
7490
- this.locationChangeCleanup || (this.locationChangeCleanup = lc(() => this.handleStarterPromptUrlChange()));
7503
+ this.locationChangeCleanup || (this.locationChangeCleanup = uc(() => this.handleStarterPromptUrlChange()));
7491
7504
  }
7492
7505
  handleStarterPromptUrlChange() {
7493
7506
  const e = location.href;
7494
7507
  e !== this.lastStarterPromptPageUrl && (this.activeComposerWarmupScope && !this.activeComposerWarmupScope.endsWith(`:${e}`) && this.clearPendingComposerWarmup(), this.lastStarterPromptPageUrl = e, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
7495
7508
  this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
7496
- }, Oa));
7509
+ }, Ba));
7497
7510
  }
7498
7511
  refreshStarterPromptsForCurrentUrl() {
7499
7512
  this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
@@ -7537,7 +7550,7 @@ class vt {
7537
7550
  }
7538
7551
  rememberSessionTimeline(e, t) {
7539
7552
  const i = [...t];
7540
- for (this.sessionTimelineCache.delete(e), this.sessionTimelineCache.set(e, i); this.sessionTimelineCache.size > qa; ) {
7553
+ for (this.sessionTimelineCache.delete(e), this.sessionTimelineCache.set(e, i); this.sessionTimelineCache.size > xa; ) {
7541
7554
  const n = this.sessionTimelineCache.keys().next().value;
7542
7555
  if (!n)
7543
7556
  break;
@@ -7567,8 +7580,8 @@ class vt {
7567
7580
  return;
7568
7581
  this.clearPendingWarmupAckTimer();
7569
7582
  const t = Math.min(
7570
- wa * 2 ** e.retryAttempt,
7571
- ba
7583
+ va * 2 ** e.retryAttempt,
7584
+ Ta
7572
7585
  );
7573
7586
  e.retryAttempt += 1, this.pendingWarmupAckTimer = window.setTimeout(() => {
7574
7587
  this.pendingWarmupAckTimer = null, this.flushPendingComposerWarmup();
@@ -7772,19 +7785,19 @@ class vt {
7772
7785
  this.activeResponseRunId = c, this.setState({ turnPhase: "thinking", lastError: null }), this.markThinkingProgress();
7773
7786
  return;
7774
7787
  }
7775
- if (ja(e) && this.markThinkingProgress(), e.type === "auth.ok") {
7788
+ if ($a(e) && this.markThinkingProgress(), e.type === "auth.ok") {
7776
7789
  this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.transportDiagnosticEpisodes.clear();
7777
7790
  const c = wi(e.user);
7778
7791
  this.applyAuthenticatedDirectoryIdentity(e.user), this.authenticatedSocket = this.socket, this.directoryObservation.reconnect().catch(() => {
7779
7792
  }), this.flushPendingWidgetLifecycleEvents(), this.flushPendingComposerWarmup(), this.pendingClientMessageId && this.state.sessionId && this.pendingDeliveryIssued ? (this.requestPendingDeliveryReconciliation(), this.pendingDeliveryRetryTimer = window.setTimeout(() => {
7780
7793
  this.pendingDeliveryRetryTimer = null, this.pendingDeliveryReconciliationRequestId = null, this.flushQueuedClientEvents();
7781
7794
  }, di)) : this.flushQueuedClientEvents(), this.flushPendingPassiveWarmup(), this.startHeartbeat();
7782
- const l = Sc(e), d = Object.prototype.hasOwnProperty.call(e, "appearance");
7795
+ const l = bc(e), d = Object.prototype.hasOwnProperty.call(e, "appearance");
7783
7796
  M("web-sdk.agent", "Received auth.ok appearance", {
7784
7797
  hasAppearance: d,
7785
7798
  rawAppearance: e.appearance,
7786
7799
  normalizedAppearance: l
7787
- }), this.runtimeHelperJavascript = wc(e.runtimeHelpers)?.javascript ?? null;
7800
+ }), this.runtimeHelperJavascript = vc(e.runtimeHelpers)?.javascript ?? null;
7788
7801
  const u = Ii(e, "starterPrompts"), h = Object.prototype.hasOwnProperty.call(e, "starterPrompts"), p = e.starterPromptsLoading === !0, f = {
7789
7802
  user: c,
7790
7803
  status: "connected",
@@ -7804,8 +7817,8 @@ class vt {
7804
7817
  }
7805
7818
  if (e.type === "starterPrompts.updated") {
7806
7819
  this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0, this.setState({
7807
- starterPrompts: Ii(e, "starterPrompts"),
7808
- starterPromptsLoading: !1
7820
+ ...Object.prototype.hasOwnProperty.call(e, "starterPrompts") ? { starterPrompts: Ii(e, "starterPrompts") } : {},
7821
+ starterPromptsLoading: e.starterPromptsLoading === !0
7809
7822
  });
7810
7823
  return;
7811
7824
  }
@@ -7839,7 +7852,7 @@ class vt {
7839
7852
  runId: y?.runId
7840
7853
  }), S = this.filterStoppedSnapshotItems(l, u), P = e.pendingMessageStatus === "sending" ? "sending" : e.pendingMessageStatus === "queued" ? "reconnecting" : null, D = typeof e.pendingClientMessageId == "string" ? e.pendingClientMessageId : null, k = e.isRetrying === !0, R = e.turnPhase === "sending" || e.turnPhase === "starting" || e.turnPhase === "thinking" ? e.turnPhase : null;
7841
7854
  P && D && (this.pendingClientMessageId = D);
7842
- let b = Cc(
7855
+ let b = Dc(
7843
7856
  e.assistantDraft
7844
7857
  );
7845
7858
  b && this.findStoppedTurn(u, {
@@ -7848,9 +7861,9 @@ class vt {
7848
7861
  }) && (b = void 0);
7849
7862
  const B = b !== void 0;
7850
7863
  this.rememberUserMessageClientMessageIds(S);
7851
- const se = $c(S), He = S.filter((H) => {
7864
+ const se = zc(S), He = S.filter((H) => {
7852
7865
  const K = q(H);
7853
- return jc(K) ? !1 : !K || !se || !Le(K) ? !0 : hs(S, K) !== se;
7866
+ return $c(K) ? !1 : !K || !se || !Le(K) ? !0 : hs(S, K) !== se;
7854
7867
  }), be = ls(
7855
7868
  this.state.messages,
7856
7869
  zt(He, this.options.backendUrl)
@@ -7861,14 +7874,14 @@ class vt {
7861
7874
  ve,
7862
7875
  $e,
7863
7876
  We,
7864
- Wc(S, K)
7877
+ Kc(S, K)
7865
7878
  )
7866
7879
  ), Te = B ? b?.content ?? "" : this.state.assistantDraft, _e = !!b?.content && !pe;
7867
7880
  this.promotePendingDeliveryFromSnapshotResponseEvidence(S, u);
7868
- const Z = ue && (!Te || pe), ae = Lc(be), Re = Z && ae ? "completed" : m ? "stopped" : Z ? "failed" : null;
7869
- if (!ue && Hc(this.state.messages, S))
7881
+ const Z = ue && (!Te || pe), ae = jc(be), Re = Z && ae ? "completed" : m ? "stopped" : Z ? "failed" : null;
7882
+ if (!ue && Wc(this.state.messages, S))
7870
7883
  return;
7871
- this.lastUserMessagePageUrl = Fc(S);
7884
+ this.lastUserMessagePageUrl = Hc(S);
7872
7885
  const ce = Z || m ? null : us(S);
7873
7886
  if (this.latestRecoverableClientMessageId = ce, ae && this.clearRetryTimers(), this.setState({
7874
7887
  sessionId: A(e.session, "id") ?? this.state.sessionId,
@@ -7941,7 +7954,7 @@ class vt {
7941
7954
  this.options.backendUrl
7942
7955
  );
7943
7956
  c === this.sessionActivityRequestId && (this.sessionActivityRequestId = null), this.setState({
7944
- messages: qc(this.state.messages, d)
7957
+ messages: xc(this.state.messages, d)
7945
7958
  });
7946
7959
  return;
7947
7960
  }
@@ -7978,8 +7991,8 @@ class vt {
7978
7991
  }
7979
7992
  const l = ft(e.item, this.options.backendUrl);
7980
7993
  if (l) {
7981
- const d = Jc(c, l), u = l.callId ? this.pendingToolLoadingByCallId.get(l.callId) : void 0;
7982
- l.callId && u !== void 0 && (l.loading = u, this.pendingToolLoadingByCallId.delete(l.callId)), X(l) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), Kc(c) && this.clearRunAckResyncRetryTimer();
7994
+ const d = Yc(c, l), u = l.callId ? this.pendingToolLoadingByCallId.get(l.callId) : void 0;
7995
+ l.callId && u !== void 0 && (l.loading = u, this.pendingToolLoadingByCallId.delete(l.callId)), X(l) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), Gc(c) && this.clearRunAckResyncRetryTimer();
7983
7996
  const h = xe(c) ? this.state.messages.filter((y) => !(y.id.startsWith("local-interrupted:") && y.respondsToUserMessageId === l.respondsToUserMessageId)) : this.state.messages, p = Oe(h, l), f = Kt(p), g = Ai(
7984
7997
  c,
7985
7998
  this.state.assistantDraft,
@@ -8164,13 +8177,13 @@ class vt {
8164
8177
  return;
8165
8178
  }
8166
8179
  u && l && d && (this.retryableClientMessageId = d);
8167
- const h = new Error(typeof e.message == "string" ? e.message : "Pluno error"), p = oc(h.message);
8180
+ const h = new Error(typeof e.message == "string" ? e.message : "Pluno error"), p = cc(h.message);
8168
8181
  p && console.error(p);
8169
8182
  const f = d ?? this.activeClientMessageId, g = typeof e.runId == "string" ? e.runId : null, I = Ei(
8170
8183
  this.state.messages,
8171
8184
  f,
8172
8185
  g
8173
- ), w = Nc(
8186
+ ), w = Fc(
8174
8187
  I,
8175
8188
  f,
8176
8189
  g
@@ -8341,7 +8354,7 @@ class vt {
8341
8354
  }
8342
8355
  e.type === "error" && typeof e.requestId != "string" && !ki(e, t) && this.rememberSessionTimeline(
8343
8356
  t,
8344
- Qc(i, e)
8357
+ Xc(i, e)
8345
8358
  );
8346
8359
  }
8347
8360
  }
@@ -8408,7 +8421,7 @@ class vt {
8408
8421
  this.sessionLoadRequestTimer !== null && (window.clearTimeout(this.sessionLoadRequestTimer), this.sessionLoadRequestTimer = null), this.sessionLoadRequestId = null, this.sessionHistoryHydration?.requestId === e && (this.sessionHistoryHydration = null, this.pendingSessionSubscription?.resolve(!1), this.pendingSessionSubscription = null);
8409
8422
  }
8410
8423
  markThinkingProgress() {
8411
- !this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(Ta), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
8424
+ !this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(Ra), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
8412
8425
  }
8413
8426
  scheduleThinkingWatchdog(e) {
8414
8427
  this.thinkingWatchdogTimer !== null && window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = window.setTimeout(() => {
@@ -8522,7 +8535,7 @@ class vt {
8522
8535
  if (this.state.status === "closed" || this.pendingClientMessageId !== e || this.state.pendingMessageStatus === null || !this.pendingUserMessageEvent)
8523
8536
  return;
8524
8537
  const t = this.retryAttemptsByClientMessageId[e] ?? 0;
8525
- if (t >= _a) {
8538
+ if (t >= Aa) {
8526
8539
  this.failPendingDelivery(e);
8527
8540
  return;
8528
8541
  }
@@ -8535,7 +8548,7 @@ class vt {
8535
8548
  return;
8536
8549
  }
8537
8550
  this.retryAttemptsByClientMessageId[e] = i, this.pendingDeliveryIssued = !0, this.queuedDeliveryRetryAttempt = null, this.persistCurrentPendingDeliveryRecovery(), this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(e);
8538
- }, xa(t, di));
8551
+ }, Na(t, di));
8539
8552
  }
8540
8553
  requestPendingDeliveryReconciliation() {
8541
8554
  if (!this.state.sessionId)
@@ -8626,7 +8639,7 @@ class vt {
8626
8639
  ),
8627
8640
  isThinking: !1,
8628
8641
  taskStatus: "failed",
8629
- lastError: Ra,
8642
+ lastError: ka,
8630
8643
  lastErrorCode: "run_recovery_exhausted"
8631
8644
  }), this.clearThinkingWatchdog();
8632
8645
  return;
@@ -8657,7 +8670,7 @@ class vt {
8657
8670
  }
8658
8671
  if (this.activeBrowserToolCalls.has(i)) return;
8659
8672
  const c = n === "execute_code", l = n === "execute_code_in_browser_tab" && o !== null && typeof o == "object" && o.tabId === "local:current";
8660
- if (!c && !l || !Il(o)) {
8673
+ if (!c && !l || !wl(o)) {
8661
8674
  this.setToolMessageLoading(i, !1), this.send({
8662
8675
  type: "tool.result",
8663
8676
  sessionId: t,
@@ -8706,7 +8719,7 @@ class vt {
8706
8719
  let d = null, u;
8707
8720
  d = await this.executeRuntimeHelper(), u = await gi(
8708
8721
  o,
8709
- tc(e.runtimeContext, this.options.backendUrl)
8722
+ ic(e.runtimeContext, this.options.backendUrl)
8710
8723
  ).catch((h) => ({
8711
8724
  ok: !1,
8712
8725
  exception: {
@@ -8719,7 +8732,7 @@ class vt {
8719
8732
  toolName: n,
8720
8733
  summary: o.summary,
8721
8734
  rawInput: V(o),
8722
- rawOutput: V(bc(u, d))
8735
+ rawOutput: V(Tc(u, d))
8723
8736
  }), Ui(this.options.clientId, this.activeBrowserToolCalls.values()));
8724
8737
  }
8725
8738
  setToolMessageLoading(e, t) {
@@ -8741,10 +8754,10 @@ class vt {
8741
8754
  };
8742
8755
  }
8743
8756
  installSessionBrowserApis() {
8744
- this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = za();
8757
+ this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = Va();
8745
8758
  }
8746
8759
  cleanupSessionBrowserApis() {
8747
- this.sessionBrowserApisCleanup && (Za(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
8760
+ this.sessionBrowserApisCleanup && (tc(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
8748
8761
  }
8749
8762
  async executeRuntimeHelper() {
8750
8763
  if (!this.runtimeHelperJavascript?.trim())
@@ -8752,15 +8765,15 @@ class vt {
8752
8765
  const e = await gi({
8753
8766
  javascript: this.runtimeHelperJavascript
8754
8767
  });
8755
- return e.ok === !1 ? vc(e) : null;
8768
+ return e.ok === !1 ? _c(e) : null;
8756
8769
  }
8757
8770
  enableNetworkCapture() {
8758
- this.networkCaptureCleanup || (this.networkCaptureCleanup = La((e) => {
8759
- _l(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
8771
+ this.networkCaptureCleanup || (this.networkCaptureCleanup = ja((e) => {
8772
+ Al(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
8760
8773
  }));
8761
8774
  }
8762
8775
  enqueueNetworkEvent(e) {
8763
- this.queuedNetworkEvents.length >= Ma || (this.queuedNetworkEvents.push(Tl(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
8776
+ this.queuedNetworkEvents.length >= Ca || (this.queuedNetworkEvents.push(Rl(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
8764
8777
  this.networkBatchTimer = null;
8765
8778
  const t = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
8766
8779
  t.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
@@ -8769,14 +8782,14 @@ class vt {
8769
8782
  page: W(),
8770
8783
  events: t
8771
8784
  });
8772
- }, ka)));
8785
+ }, Ea)));
8773
8786
  }
8774
8787
  scheduleReconnect(e = 0) {
8775
8788
  if (this.reconnectTimer !== null || this.state.status === "closed")
8776
8789
  return;
8777
8790
  const t = Math.min(
8778
8791
  as,
8779
- Math.max(Ba(this.reconnectAttempts), e)
8792
+ Math.max(La(this.reconnectAttempts), e)
8780
8793
  );
8781
8794
  this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
8782
8795
  this.reconnectTimer = null, (this.refreshingDefaultCredentials && this.socket instanceof N ? this.refreshDefaultTransportCredentials(this.socket) : this.connect()).catch((n) => {
@@ -8834,8 +8847,8 @@ class vt {
8834
8847
  const e = this.socket;
8835
8848
  !e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
8836
8849
  this.socket === e && (M("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
8837
- }, ga));
8838
- }, fa));
8850
+ }, ma));
8851
+ }, ya));
8839
8852
  }
8840
8853
  stopHeartbeat() {
8841
8854
  this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
@@ -8873,7 +8886,7 @@ class vt {
8873
8886
  ...e.lastError === null && e.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
8874
8887
  ...e.lastError !== void 0 && e.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
8875
8888
  }, a = this.state.sessionId, c = this.state.isThinking || this.state.pendingMessageStatus !== null, l = o.isThinking || o.pendingMessageStatus !== null, d = this.activeClientMessageId ?? this.pendingClientMessageId;
8876
- d && d === this.lastProjectedTurnClientMessageId && l && Ha(this.lastProjectedTurnPhase, o.turnPhase) && this.reportHealthSignal("invalid_state_transition", {
8889
+ d && d === this.lastProjectedTurnClientMessageId && l && Wa(this.lastProjectedTurnPhase, o.turnPhase) && this.reportHealthSignal("invalid_state_transition", {
8877
8890
  clientMessageId: d,
8878
8891
  reason: "active_turn_phase_moved_backward",
8879
8892
  previousPhase: this.lastProjectedTurnPhase,
@@ -8884,7 +8897,7 @@ class vt {
8884
8897
  sessionId: o.sessionId,
8885
8898
  active: l
8886
8899
  }), this.directoryObservation.focus().catch(() => {
8887
- })), this.rebuildRuntimeInteractions(), e.messages !== void 0 && this.refreshRuntimeInteractions(), this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages), ol(this.options.clientId, this.state), this.emit("state", this.getState()), Ce("state", this.state.status, {
8900
+ })), this.rebuildRuntimeInteractions(), e.messages !== void 0 && this.refreshRuntimeInteractions(), this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages), cl(this.options.clientId, this.state), this.emit("state", this.getState()), Ce("state", this.state.status, {
8888
8901
  status: this.state.status,
8889
8902
  sessionId: this.state.sessionId,
8890
8903
  messageCount: this.state.messages.length,
@@ -8935,13 +8948,13 @@ class vt {
8935
8948
  }
8936
8949
  }
8937
8950
  const Ht = /* @__PURE__ */ new WeakMap();
8938
- function La(s) {
8939
- const e = window.__plunoProductAgentNetworkCapture ?? Fa();
8951
+ function ja(s) {
8952
+ const e = window.__plunoProductAgentNetworkCapture ?? Ha();
8940
8953
  return e.subscribers.add(s), () => {
8941
8954
  e.subscribers.delete(s), !(e.subscribers.size > 0) && (e.destroy(), window.__plunoProductAgentNetworkCapture === e && delete window.__plunoProductAgentNetworkCapture);
8942
8955
  };
8943
8956
  }
8944
- function Fa() {
8957
+ function Ha() {
8945
8958
  const s = /* @__PURE__ */ new Set(), e = (h) => {
8946
8959
  s.forEach((p) => {
8947
8960
  try {
@@ -8958,7 +8971,7 @@ function Fa() {
8958
8971
  throw w;
8959
8972
  }
8960
8973
  try {
8961
- const w = p instanceof Request ? p : null, y = Sl(p, w), m = Pn(f?.headers ?? w?.headers);
8974
+ const w = p instanceof Request ? p : null, y = bl(p, w), m = Pn(f?.headers ?? w?.headers);
8962
8975
  if (!fe(y, m, f?.body)) {
8963
8976
  const P = {
8964
8977
  requestId: Vt("fetch"),
@@ -8971,7 +8984,7 @@ function Fa() {
8971
8984
  };
8972
8985
  I.then(
8973
8986
  (D) => {
8974
- wl(D, P, g, e).catch(() => {
8987
+ vl(D, P, g, e).catch(() => {
8975
8988
  e({
8976
8989
  ...P,
8977
8990
  responseStatus: D.status,
@@ -9013,7 +9026,7 @@ function Fa() {
9013
9026
  () => {
9014
9027
  queueMicrotask(() => {
9015
9028
  try {
9016
- const g = Al(this.getAllResponseHeaders());
9029
+ const g = Ml(this.getAllResponseHeaders());
9017
9030
  e({
9018
9031
  requestId: f.requestId,
9019
9032
  url: f.url,
@@ -9023,7 +9036,7 @@ function Fa() {
9023
9036
  resourceType: "xhr",
9024
9037
  responseStatus: this.status,
9025
9038
  responseHeaders: g,
9026
- responseBody: vl(this, g),
9039
+ responseBody: _l(this, g),
9027
9040
  errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
9028
9041
  startedAt: f.startedAt,
9029
9042
  durationMs: Date.now() - f.startedAtMs
@@ -9119,7 +9132,7 @@ function pi(s) {
9119
9132
  const e = typeof s == "function" ? s() : s;
9120
9133
  return e && Object.keys(e).length > 0 ? e : void 0;
9121
9134
  }
9122
- function ja(s) {
9135
+ function $a(s) {
9123
9136
  return s.type === "run.model_started" || s.type === "conversation.state" || s.type === "session.updated" || s.type === "session.item" || s.type === "chat.assistant_delta" || s.type === "chat.assistant_done" || s.type === "tool.call";
9124
9137
  }
9125
9138
  function fi(s) {
@@ -9132,7 +9145,7 @@ function fi(s) {
9132
9145
  const e = q(s.item);
9133
9146
  return e ? e.type === "message" && e.role === "assistant" ? typeof e.content == "string" && e.content.trim().length > 0 : e.type === "tool_call" || e.type === "function_call" : !1;
9134
9147
  }
9135
- function Ha(s, e) {
9148
+ function Wa(s, e) {
9136
9149
  if (!s || !e)
9137
9150
  return !1;
9138
9151
  const t = {
@@ -9160,27 +9173,27 @@ function J(s) {
9160
9173
  }
9161
9174
  return null;
9162
9175
  }
9163
- const $a = 5e3, Wa = 12e4;
9164
- function za() {
9176
+ const za = 5e3, Ka = 12e4;
9177
+ function Va() {
9165
9178
  const s = [
9166
- Va(),
9167
- Ka()
9179
+ Qa(),
9180
+ Ga()
9168
9181
  ].filter((e) => typeof e == "function");
9169
9182
  return () => {
9170
9183
  for (const e of s.reverse())
9171
9184
  e();
9172
9185
  };
9173
9186
  }
9174
- function Ka() {
9187
+ function Ga() {
9175
9188
  return on(globalThis, "getPageSnapshot", async () => Ms());
9176
9189
  }
9177
- function Va() {
9190
+ function Qa() {
9178
9191
  return on(globalThis, "pageImages", {
9179
- inspectImage: async (e, t) => await Ga(e, t)
9192
+ inspectImage: async (e, t) => await Ja(e, t)
9180
9193
  });
9181
9194
  }
9182
- async function Ga(s, e = {}) {
9183
- const t = Ya(e.name), i = await Qa(s);
9195
+ async function Ja(s, e = {}) {
9196
+ const t = ec(e.name), i = await Xa(s);
9184
9197
  return i.ok ? i.sizeBytes > 8 * 1024 * 1024 ? {
9185
9198
  type: "pluno.pageImages.inspectImage",
9186
9199
  imageAttached: !1,
@@ -9198,15 +9211,15 @@ async function Ga(s, e = {}) {
9198
9211
  imageAttachmentError: i.error
9199
9212
  };
9200
9213
  }
9201
- async function Qa(s) {
9214
+ async function Xa(s) {
9202
9215
  return s instanceof Blob ? s.type.startsWith("image/") ? s.size === 0 ? { ok: !1, error: "Page image is empty." } : s.size > 8 * 1024 * 1024 ? { ok: !1, error: gn } : {
9203
9216
  ok: !0,
9204
9217
  mimeType: s.type,
9205
9218
  sizeBytes: s.size,
9206
- dataUrl: await ec(s)
9207
- } : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof s != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : Ja(s);
9219
+ dataUrl: await sc(s)
9220
+ } : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof s != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : Ya(s);
9208
9221
  }
9209
- function Ja(s) {
9222
+ function Ya(s) {
9210
9223
  if (!s.startsWith("data:") || !s.includes(","))
9211
9224
  return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
9212
9225
  const [e, t] = s.slice(5).split(",", 2), i = e.split(";").map((a) => a.trim()).filter(Boolean), n = i[0] ?? "";
@@ -9217,7 +9230,7 @@ function Ja(s) {
9217
9230
  const r = t.replace(/[ \t\r\n\f]+/g, "");
9218
9231
  if (!/^[A-Za-z0-9+/]*={0,2}$/.test(r))
9219
9232
  return { ok: !1, error: "Page image data URL has invalid base64." };
9220
- const o = Xa(r);
9233
+ const o = Za(r);
9221
9234
  return o === null ? { ok: !1, error: "Page image data URL has invalid base64." } : o === 0 ? { ok: !1, error: "Page image is empty." } : {
9222
9235
  ok: !0,
9223
9236
  mimeType: n,
@@ -9225,22 +9238,22 @@ function Ja(s) {
9225
9238
  dataUrl: `data:${n};base64,${r}`
9226
9239
  };
9227
9240
  }
9228
- function Xa(s) {
9241
+ function Za(s) {
9229
9242
  if (s.length === 0 || s.length % 4 !== 0)
9230
9243
  return null;
9231
9244
  const e = s.length - s.replace(/=+$/, "").length;
9232
9245
  return e > 2 ? null : s.length / 4 * 3 - e;
9233
9246
  }
9234
- function Ya(s) {
9247
+ function ec(s) {
9235
9248
  return (typeof s == "string" ? s.trim() : "") || "Page image";
9236
9249
  }
9237
- function Za(s) {
9250
+ function tc(s) {
9238
9251
  try {
9239
9252
  s();
9240
9253
  } catch {
9241
9254
  }
9242
9255
  }
9243
- function ec(s) {
9256
+ function sc(s) {
9244
9257
  return new Promise((e, t) => {
9245
9258
  const i = new FileReader();
9246
9259
  i.onload = () => {
@@ -9254,7 +9267,7 @@ function ec(s) {
9254
9267
  }
9255
9268
  async function gi(s, e) {
9256
9269
  const t = Object.getPrototypeOf(async function() {
9257
- }).constructor, i = s.timeoutMs ?? $a, n = Date.now(), r = [];
9270
+ }).constructor, i = s.timeoutMs ?? za, n = Date.now(), r = [];
9258
9271
  let o;
9259
9272
  const a = {
9260
9273
  log: console.log,
@@ -9272,7 +9285,7 @@ async function gi(s, e) {
9272
9285
  o = window.setTimeout(() => u(l), i);
9273
9286
  })
9274
9287
  ]);
9275
- return d === l ? sc(i) : {
9288
+ return d === l ? nc(i) : {
9276
9289
  ok: !0,
9277
9290
  result: d,
9278
9291
  console: r,
@@ -9301,7 +9314,7 @@ async function gi(s, e) {
9301
9314
  e?.deactivate(), o !== void 0 && window.clearTimeout(o), console.log = a.log, console.info = a.info, console.warn = a.warn, console.error = a.error;
9302
9315
  }
9303
9316
  }
9304
- function tc(s, e) {
9317
+ function ic(s, e) {
9305
9318
  if (!s || typeof s != "object")
9306
9319
  return;
9307
9320
  const t = s.sandboxFilesToken;
@@ -9311,7 +9324,7 @@ function tc(s, e) {
9311
9324
  const n = () => {
9312
9325
  if (!i)
9313
9326
  throw new Error("sandboxFiles is only available during browser-code execution");
9314
- }, r = async (a, c) => await ra(`${e.replace(/\/$/, "")}${a}`, c);
9327
+ }, r = async (a, c) => await aa(`${e.replace(/\/$/, "")}${a}`, c);
9315
9328
  return {
9316
9329
  value: Object.freeze({
9317
9330
  upload: async (a) => {
@@ -9345,7 +9358,7 @@ function tc(s, e) {
9345
9358
  }
9346
9359
  };
9347
9360
  }
9348
- function sc(s) {
9361
+ function nc(s) {
9349
9362
  return {
9350
9363
  ok: !1,
9351
9364
  exception: {
@@ -9359,10 +9372,10 @@ function sc(s) {
9359
9372
  }
9360
9373
  };
9361
9374
  }
9362
- function ic(s) {
9375
+ function rc(s) {
9363
9376
  return s.replace(/\/+$/, "");
9364
9377
  }
9365
- function nc(s) {
9378
+ function oc(s) {
9366
9379
  const e = {
9367
9380
  sidepanel: "extension_sidepanel",
9368
9381
  browser_extension_page_ui: "extension_widget",
@@ -9374,13 +9387,13 @@ function nc(s) {
9374
9387
  };
9375
9388
  return s && s in e ? e[s] : s ?? "embedded_custom_ui";
9376
9389
  }
9377
- function rc(s) {
9390
+ function ac(s) {
9378
9391
  return s === "pluno" ? "scheduled_continuation" : s ?? "user";
9379
9392
  }
9380
- function oc(s, e = location.origin) {
9393
+ function cc(s, e = location.origin) {
9381
9394
  return /origin (?:is not allowed|does not match browser origin)/i.test(s) ? `Pluno widget blocked on ${e}: this domain is not allowed. Add ${e} in Pluno under Integration > Domains.` : null;
9382
9395
  }
9383
- function ac(s) {
9396
+ function lc(s) {
9384
9397
  const e = new URL("/api/product-agent/embed/ws", s);
9385
9398
  return e.protocol = e.protocol === "https:" ? "wss:" : "ws:", e.toString();
9386
9399
  }
@@ -9393,19 +9406,19 @@ function W() {
9393
9406
  ...s ? { plunoProductAgentUi: s } : {}
9394
9407
  };
9395
9408
  }
9396
- function cc() {
9409
+ function dc() {
9397
9410
  return {
9398
9411
  pageUrl: location.href,
9399
9412
  pageTitle: document.title,
9400
9413
  htmlContent: Ms()
9401
9414
  };
9402
9415
  }
9403
- function lc(s) {
9404
- return ut.add(s), Xe || (Xe = dc()), () => {
9416
+ function uc(s) {
9417
+ return ut.add(s), Xe || (Xe = hc()), () => {
9405
9418
  ut.delete(s), ut.size === 0 && (Xe?.(), Xe = null);
9406
9419
  };
9407
9420
  }
9408
- function dc() {
9421
+ function hc() {
9409
9422
  const s = () => {
9410
9423
  for (const r of Array.from(ut))
9411
9424
  r();
@@ -9436,12 +9449,12 @@ function Ms() {
9436
9449
  );
9437
9450
  for (const g of n.slice(0, 3))
9438
9451
  t("Active overlay", Wt(Ne(g), e));
9439
- const r = uc(), o = r ? Wt(Ne(r), e) : "";
9452
+ const r = pc(), o = r ? Wt(Ne(r), e) : "";
9440
9453
  t("Main page content", o), t("Additional visible page text", Wt(Ne(document.body), e));
9441
9454
  const a = s.map(([g, I]) => `${g}:
9442
9455
  ${I}`).join(`
9443
9456
 
9444
- `).trim().slice(0, 12e3), c = hc(n, r).trim(), l = `Simplified DOM outline:
9457
+ `).trim().slice(0, 12e3), c = fc(n, r).trim(), l = `Simplified DOM outline:
9445
9458
  `, d = `
9446
9459
 
9447
9460
  Visible page text:
@@ -9469,10 +9482,10 @@ function In(s) {
9469
9482
  const e = window.getComputedStyle(s);
9470
9483
  return e.display !== "none" && e.visibility !== "hidden" && s.getClientRects().length > 0;
9471
9484
  }
9472
- function uc() {
9485
+ function pc() {
9473
9486
  return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(In).sort((s, e) => Ne(e).length - Ne(s).length)[0] ?? null;
9474
9487
  }
9475
- function hc(s, e) {
9488
+ function fc(s, e) {
9476
9489
  const t = /* @__PURE__ */ new Set([
9477
9490
  "main",
9478
9491
  "nav",
@@ -9552,7 +9565,7 @@ function hc(s, e) {
9552
9565
  "data-test",
9553
9566
  "data-qa",
9554
9567
  "data-cy"
9555
- ], l = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: d, priorityTargets: u } = pc(), h = new Set(s);
9568
+ ], l = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: d, priorityTargets: u } = gc(), h = new Set(s);
9556
9569
  e && h.add(e);
9557
9570
  let p = 0;
9558
9571
  const f = (m) => {
@@ -9622,7 +9635,7 @@ function hc(s, e) {
9622
9635
  `);
9623
9636
  }, w = [], y = me(window.getSelection()?.toString() ?? "");
9624
9637
  y && w.push(`--- selected text ---
9625
- ${JSON.stringify(y)}`), u.length > 0 && w.push(fc(u, t, c, o));
9638
+ ${JSON.stringify(y)}`), u.length > 0 && w.push(yc(u, t, c, o));
9626
9639
  for (const m of s.slice(0, 3))
9627
9640
  w.push(I(m, "active overlay DOM", /* @__PURE__ */ new Set()));
9628
9641
  if (e && w.push(I(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
@@ -9637,7 +9650,7 @@ function Sn(s, e, t, i) {
9637
9650
  const n = s.tagName.toLowerCase();
9638
9651
  let r = n;
9639
9652
  const o = s.getAttribute("id");
9640
- o && gc(o) && (r += `#${o}`);
9653
+ o && mc(o) && (r += `#${o}`);
9641
9654
  for (const a of e) {
9642
9655
  const c = s.getAttribute(a);
9643
9656
  c && c.length <= 160 && (a !== "role" || !t.has(c)) && (r += `[${a}=${JSON.stringify(c)}]`);
@@ -9650,7 +9663,7 @@ function Sn(s, e, t, i) {
9650
9663
  s.hasAttribute(a) && (r += `[${a}]`);
9651
9664
  return `${r}${i ? ` ${JSON.stringify(i)}` : ""}`;
9652
9665
  }
9653
- function pc() {
9666
+ function gc() {
9654
9667
  const s = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), t = (a, c) => {
9655
9668
  if (!a)
9656
9669
  return;
@@ -9693,7 +9706,7 @@ function pc() {
9693
9706
  priorityTargets: Array.from(e, ([a, c]) => ({ element: a, labels: Array.from(c) }))
9694
9707
  };
9695
9708
  }
9696
- function fc(s, e, t, i) {
9709
+ function yc(s, e, t, i) {
9697
9710
  const n = ["--- active/current elements ---"];
9698
9711
  for (const r of s) {
9699
9712
  const o = [];
@@ -9729,12 +9742,12 @@ function wn(s) {
9729
9742
  Array.from(s.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
9730
9743
  );
9731
9744
  }
9732
- function gc(s) {
9745
+ function mc(s) {
9733
9746
  return s.length <= 64 && /^[A-Za-z_][A-Za-z0-9_:.-]*$/.test(s) && !/[a-f0-9]{12,}/i.test(s) && !/:r[0-9a-z]+:/i.test(s);
9734
9747
  }
9735
9748
  function bn() {
9736
9749
  const s = Array.from(document.querySelectorAll(ri)), e = s.find(
9737
- (r) => typeof r[la] == "string"
9750
+ (r) => typeof r[ua] == "string"
9738
9751
  );
9739
9752
  if (!(e ?? s[0]))
9740
9753
  return;
@@ -9750,23 +9763,23 @@ function bn() {
9750
9763
  },
9751
9764
  {
9752
9765
  name: "widget_root",
9753
- selector: oa,
9766
+ selector: ca,
9754
9767
  description: "Finds Pluno's widget root inside the widget host shadow root."
9755
9768
  },
9756
9769
  {
9757
9770
  name: "widget_panel",
9758
- selector: aa,
9771
+ selector: la,
9759
9772
  description: "Finds Pluno's open chat panel inside the widget host shadow root."
9760
9773
  },
9761
9774
  {
9762
9775
  name: "widget_timeline",
9763
- selector: ca,
9776
+ selector: da,
9764
9777
  description: "Finds Pluno's chat timeline inside the widget host shadow root."
9765
9778
  }
9766
9779
  ]
9767
9780
  };
9768
9781
  }
9769
- function yc(s) {
9782
+ function Ic(s) {
9770
9783
  if (s.runtimeContext !== void 0) {
9771
9784
  if (!s.runtimeContext || typeof s.runtimeContext != "object" || Array.isArray(s.runtimeContext)) return !1;
9772
9785
  const e = s.runtimeContext;
@@ -9788,7 +9801,7 @@ function mi(s) {
9788
9801
  return { type: "error", message: "Invalid server event" };
9789
9802
  }
9790
9803
  }
9791
- function mc(s) {
9804
+ function Sc(s) {
9792
9805
  if (typeof s != "string")
9793
9806
  return null;
9794
9807
  try {
@@ -9812,10 +9825,10 @@ function Si(s) {
9812
9825
  return typeof t.taskId != "string" || !t.taskId || typeof t.dueAt != "string" || Number.isNaN(Date.parse(t.dueAt)) ? [] : [{ taskId: t.taskId, dueAt: t.dueAt }];
9813
9826
  }) : [];
9814
9827
  }
9815
- function Ic(s) {
9828
+ function wc(s) {
9816
9829
  return Array.isArray(s) ? s.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
9817
9830
  }
9818
- function Sc(s) {
9831
+ function bc(s) {
9819
9832
  if (!s || typeof s != "object")
9820
9833
  return null;
9821
9834
  const e = s, t = e.appearance, i = t && typeof t == "object" ? t : e, n = typeof i.accentColor == "string" ? i.accentColor : null, r = i.colorScheme === "dark" ? "dark" : i.colorScheme === "light" ? "light" : null, o = typeof i.fontFamily == "string" && i.fontFamily.trim() ? i.fontFamily : null, a = typeof i.scribbleStyle == "boolean" ? i.scribbleStyle : null;
@@ -9826,13 +9839,13 @@ function Sc(s) {
9826
9839
  ...a !== null ? { scribbleStyle: a } : {}
9827
9840
  };
9828
9841
  }
9829
- function wc(s) {
9842
+ function vc(s) {
9830
9843
  if (!s || typeof s != "object")
9831
9844
  return null;
9832
9845
  const e = s.javascript;
9833
9846
  return typeof e != "string" || !e.trim() ? null : { javascript: e };
9834
9847
  }
9835
- function bc(s, e) {
9848
+ function Tc(s, e) {
9836
9849
  return e ? s && typeof s == "object" ? {
9837
9850
  ...s,
9838
9851
  helperError: e
@@ -9842,13 +9855,13 @@ function bc(s, e) {
9842
9855
  helperError: e
9843
9856
  } : s;
9844
9857
  }
9845
- function vc(s) {
9858
+ function _c(s) {
9846
9859
  if (!s || typeof s != "object")
9847
9860
  return s;
9848
9861
  const e = s;
9849
9862
  return typeof e.exception?.message == "string" ? e.exception.message : typeof e.error == "string" ? e.error : s;
9850
9863
  }
9851
- function Tc() {
9864
+ function Rc() {
9852
9865
  const s = "pluno.productAgent.clientId", e = window.localStorage.getItem(s);
9853
9866
  if (e)
9854
9867
  return e;
@@ -9960,7 +9973,7 @@ function ft(s, e) {
9960
9973
  scheduledCheckInId: o.id ?? void 0,
9961
9974
  scheduledCheckInAt: o.dueAt
9962
9975
  };
9963
- const a = Rc(n.output), c = Ac(n.output);
9976
+ const a = kc(n.output), c = Mc(n.output);
9964
9977
  return a ? {
9965
9978
  id: String(t.id ?? crypto.randomUUID()),
9966
9979
  role: "tool",
@@ -9992,7 +10005,7 @@ function ft(s, e) {
9992
10005
  return n.type === "function_call" || n.type === "tool_call" || n.type === "web_search_call" || n.type === "mcp_call" || n.type === "tab_lifecycle_decision" ? {
9993
10006
  id: String(t.id ?? crypto.randomUUID()),
9994
10007
  role: "tool",
9995
- content: n.type === "mcp_call" ? _c(n) : Mc(n),
10008
+ content: n.type === "mcp_call" ? Ac(n) : Cc(n),
9996
10009
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
9997
10010
  ...x(n) !== null ? { displaySequence: x(n) } : {},
9998
10011
  ...F(n) !== null ? { causalSequence: F(n) } : {},
@@ -10006,7 +10019,7 @@ function ft(s, e) {
10006
10019
  } : n.type === "run_status" || n.type === "run_error" ? n.type === "run_error" && n.stage === "tool_execution" ? null : {
10007
10020
  id: String(t.id ?? crypto.randomUUID()),
10008
10021
  role: "system",
10009
- content: kc(n),
10022
+ content: Ec(n),
10010
10023
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
10011
10024
  ...x(n) !== null ? { displaySequence: x(n) } : {},
10012
10025
  ...F(n) !== null ? { causalSequence: F(n) } : {},
@@ -10019,11 +10032,11 @@ function ft(s, e) {
10019
10032
  ...typeof n.securitySettingsUrl == "string" ? { securitySettingsUrl: n.securitySettingsUrl } : {}
10020
10033
  } : null;
10021
10034
  }
10022
- function _c(s) {
10035
+ function Ac(s) {
10023
10036
  const t = (typeof s.server_label == "string" ? s.server_label : "").replace(/^pipedream_/, "").split(/[_-]+/).filter(Boolean).map((i) => `${i.charAt(0).toUpperCase()}${i.slice(1)}`).join(" ");
10024
10037
  return t ? `🔌 Using ${t}` : "🔌 Using connected integration";
10025
10038
  }
10026
- function Rc(s) {
10039
+ function kc(s) {
10027
10040
  if (typeof s != "string")
10028
10041
  return null;
10029
10042
  try {
@@ -10040,7 +10053,7 @@ function Rc(s) {
10040
10053
  return null;
10041
10054
  }
10042
10055
  }
10043
- function Ac(s) {
10056
+ function Mc(s) {
10044
10057
  if (typeof s != "string")
10045
10058
  return null;
10046
10059
  try {
@@ -10055,10 +10068,10 @@ function Ac(s) {
10055
10068
  return null;
10056
10069
  }
10057
10070
  }
10058
- function kc(s) {
10071
+ function Ec(s) {
10059
10072
  return s.type === "run_status" && s.status === "steered" ? "Steered" : typeof s.message == "string" && s.message.trim().length > 0 ? s.message : "";
10060
10073
  }
10061
- function Mc(s) {
10074
+ function Cc(s) {
10062
10075
  if (s.type === "web_search_call") {
10063
10076
  const e = s.action;
10064
10077
  if (e && typeof e == "object") {
@@ -10070,9 +10083,9 @@ function Mc(s) {
10070
10083
  }
10071
10084
  return "🔎 Searching the web";
10072
10085
  }
10073
- return Ec(s);
10086
+ return Pc(s);
10074
10087
  }
10075
- function Ec(s) {
10088
+ function Pc(s) {
10076
10089
  if (typeof s.summary == "string" && s.summary.trim().length > 0)
10077
10090
  return ge(s.summary);
10078
10091
  if (typeof s.arguments == "string")
@@ -10089,7 +10102,7 @@ function ge(s) {
10089
10102
  const e = s.trim() || "Run tool", t = e.codePointAt(0) ?? 0;
10090
10103
  return t >= 126976 && t <= 129791 || t >= 9728 && t <= 10175 || t >= 127462 && t <= 127487 ? e : `🛠️ ${e}`;
10091
10104
  }
10092
- function Cc(s) {
10105
+ function Dc(s) {
10093
10106
  if (s == null)
10094
10107
  return s;
10095
10108
  if (typeof s != "object")
@@ -10126,10 +10139,10 @@ function Oe(s, e) {
10126
10139
  const t = vn(
10127
10140
  s,
10128
10141
  Es(s, e)
10129
- ), i = Uc(
10130
- Dc(
10131
- Bc(
10132
- Pc(s, e),
10142
+ ), i = Oc(
10143
+ qc(
10144
+ Lc(
10145
+ Uc(s, e),
10133
10146
  e
10134
10147
  ),
10135
10148
  t
@@ -10154,7 +10167,7 @@ function Es(s, e, t = !0) {
10154
10167
  const n = s.flatMap((r) => (e.respondsToUserMessageId !== void 0 ? r.respondsToUserMessageId === e.respondsToUserMessageId : e.runId !== void 0 && r.respondsToUserMessageId === void 0 && r.runId === e.runId) && r.displaySequence !== void 0 ? [r.displaySequence] : []);
10155
10168
  return e.displaySequence = (n.length > 0 ? Math.max(...n) : 0) + 1, e;
10156
10169
  }
10157
- function Pc(s, e) {
10170
+ function Uc(s, e) {
10158
10171
  const t = e.proactiveSuggestionClientMessageId;
10159
10172
  if (!t)
10160
10173
  return s;
@@ -10164,7 +10177,7 @@ function Pc(s, e) {
10164
10177
  const r = [...s];
10165
10178
  return r[n] = e, r;
10166
10179
  }
10167
- function Dc(s, e) {
10180
+ function qc(s, e) {
10168
10181
  const t = e.assistantDraftItemId;
10169
10182
  return t ? s.map(
10170
10183
  (i) => i.dataType === "assistant_draft" && i.id === t ? e : i
@@ -10232,7 +10245,7 @@ function Ri(s) {
10232
10245
  loading: !0
10233
10246
  };
10234
10247
  }
10235
- function Uc(s, e) {
10248
+ function Oc(s, e) {
10236
10249
  if (e.id.startsWith("transient-activity:"))
10237
10250
  return s;
10238
10251
  const t = e.toolName === "tab_lifecycle";
@@ -10258,7 +10271,7 @@ function ls(s, e) {
10258
10271
  ds
10259
10272
  );
10260
10273
  }
10261
- function qc(s, e) {
10274
+ function xc(s, e) {
10262
10275
  const t = new Map(s.map((r) => [r.id, r])), i = e.map(
10263
10276
  (r) => Es(s, r, !1)
10264
10277
  );
@@ -10309,22 +10322,22 @@ function vn(s, e) {
10309
10322
  if (!t?.attachments?.length)
10310
10323
  return e;
10311
10324
  const i = e.attachments.map((o) => {
10312
- const a = Oc(t.attachments ?? [], o);
10313
- return a ? xc(o, a) : o;
10325
+ const a = Bc(t.attachments ?? [], o);
10326
+ return a ? Nc(o, a) : o;
10314
10327
  }), n = { ...e, attachments: i }, r = de(e);
10315
10328
  return r && Object.defineProperty(n, "clientMessageId", {
10316
10329
  value: r,
10317
10330
  enumerable: !1
10318
10331
  }), n;
10319
10332
  }
10320
- function Oc(s, e) {
10333
+ function Bc(s, e) {
10321
10334
  return e.id ? s.find((t) => t.id === e.id) ?? null : null;
10322
10335
  }
10323
- function xc(s, e) {
10336
+ function Nc(s, e) {
10324
10337
  const { previewUrl: t } = e;
10325
10338
  return t ? { ...s, previewUrl: t } : s;
10326
10339
  }
10327
- function Bc(s, e) {
10340
+ function Lc(s, e) {
10328
10341
  if (e.role !== "user")
10329
10342
  return s;
10330
10343
  const t = s.findIndex(
@@ -10375,7 +10388,7 @@ function Kt(s) {
10375
10388
  }
10376
10389
  return !1;
10377
10390
  }
10378
- function Nc(s, e, t) {
10391
+ function Fc(s, e, t) {
10379
10392
  const i = new Set(
10380
10393
  s.filter(
10381
10394
  (n) => n.role === "user" && e !== null && de(n) === e
@@ -10395,7 +10408,7 @@ function Nc(s, e, t) {
10395
10408
  return !1;
10396
10409
  });
10397
10410
  }
10398
- function Lc(s) {
10411
+ function jc(s) {
10399
10412
  const e = _n(s);
10400
10413
  if (e === null)
10401
10414
  return s.some(X);
@@ -10427,7 +10440,7 @@ function Ie(s) {
10427
10440
  }
10428
10441
  return null;
10429
10442
  }
10430
- function Fc(s) {
10443
+ function Hc(s) {
10431
10444
  const e = Ie(s);
10432
10445
  if (e === null)
10433
10446
  return null;
@@ -10446,10 +10459,10 @@ function q(s) {
10446
10459
  function Le(s) {
10447
10460
  return s?.retryable !== !0 ? !1 : s.type === "run_error" ? !0 : s.type === "run_status" && s.status === "interrupted";
10448
10461
  }
10449
- function jc(s) {
10462
+ function $c(s) {
10450
10463
  return s?.type === "run_status" && s.status === "interrupted" && s.reason === "backend_restart";
10451
10464
  }
10452
- function Hc(s, e) {
10465
+ function Wc(s, e) {
10453
10466
  const t = Ie(e);
10454
10467
  if (t === null)
10455
10468
  return !1;
@@ -10474,7 +10487,7 @@ function us(s) {
10474
10487
  const n = i.clientMessageId;
10475
10488
  return typeof n == "string" ? n : null;
10476
10489
  }
10477
- function $c(s) {
10490
+ function zc(s) {
10478
10491
  const e = Ie(s);
10479
10492
  if (e === null)
10480
10493
  return null;
@@ -10505,7 +10518,7 @@ function hs(s, e) {
10505
10518
  return n?.type === "message" && n.role === "user" && typeof n.clientMessageId == "string" ? n.clientMessageId : null;
10506
10519
  }
10507
10520
  function Ai(s, e, t, i, n, r) {
10508
- if (!e || !zc(s))
10521
+ if (!e || !Vc(s))
10509
10522
  return !1;
10510
10523
  const o = s;
10511
10524
  if (Le(o) || t !== null && typeof o.id == "string" && o.id !== t)
@@ -10513,7 +10526,7 @@ function Ai(s, e, t, i, n, r) {
10513
10526
  const a = j(o);
10514
10527
  return i !== null ? a !== null ? a === i : n !== null && E(o) === n && r === i : n === null || E(o) === n;
10515
10528
  }
10516
- function Wc(s, e) {
10529
+ function Kc(s, e) {
10517
10530
  for (let t = e - 1; t >= 0; t -= 1) {
10518
10531
  const i = q(s[t]);
10519
10532
  if (i?.type === "message" && i.role === "user")
@@ -10527,7 +10540,7 @@ function Rn(s, e) {
10527
10540
  return s[t].id;
10528
10541
  return null;
10529
10542
  }
10530
- function zc(s) {
10543
+ function Vc(s) {
10531
10544
  if (!s || typeof s != "object")
10532
10545
  return !1;
10533
10546
  const e = s;
@@ -10536,16 +10549,16 @@ function zc(s) {
10536
10549
  function X(s) {
10537
10550
  return s.role === "assistant" && s.phase !== "commentary";
10538
10551
  }
10539
- function Kc(s) {
10552
+ function Gc(s) {
10540
10553
  if (!s || typeof s != "object")
10541
10554
  return !1;
10542
10555
  const e = s;
10543
10556
  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";
10544
10557
  }
10545
10558
  function ps(s) {
10546
- return s.filter((e, t) => oe(e) ? !nl(s, t) && !An(s, t) && !sl(s, t) && !il(s, t) : Vc(e) ? e.retryable === !0 && tl(s, t) ? !1 : !el(s, t) : !0);
10559
+ return s.filter((e, t) => oe(e) ? !ol(s, t) && !An(s, t) && !nl(s, t) && !rl(s, t) : Qc(e) ? e.retryable === !0 && il(s, t) ? !1 : !sl(s, t) : !0);
10547
10560
  }
10548
- function Vc(s) {
10561
+ function Qc(s) {
10549
10562
  return s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.steered !== !0);
10550
10563
  }
10551
10564
  function oe(s) {
@@ -10554,13 +10567,13 @@ function oe(s) {
10554
10567
  function fs(s) {
10555
10568
  return s.steered !== !0 && (s.dataType === "assistant_draft" || s.loading === !0);
10556
10569
  }
10557
- function Gc(s) {
10570
+ function Jc(s) {
10558
10571
  return s.some(fs);
10559
10572
  }
10560
10573
  function ki(s, e) {
10561
10574
  return (s.retryable === !0 || s.code === "transient_model_error") && s.code !== "run_recovery_exhausted" && e !== null && typeof s.clientMessageId == "string";
10562
10575
  }
10563
- function Qc(s, e) {
10576
+ function Xc(s, e) {
10564
10577
  const t = [...s].reverse().find(fs), i = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : t?.respondsToUserMessageId ?? null, n = typeof e.runId == "string" ? e.runId : t?.runId ?? null;
10565
10578
  return s.flatMap((r) => (i ? r.respondsToUserMessageId === i || !r.respondsToUserMessageId && n !== null && r.runId === n : n ? r.runId === n : fs(r)) ? r.dataType === "assistant_draft" || oe(r) ? [] : r.loading === !0 ? [{ ...r, loading: !1 }] : [r] : [r]);
10566
10579
  }
@@ -10579,7 +10592,7 @@ function Mi(s, e, t, i) {
10579
10592
  function xe(s) {
10580
10593
  return s?.type === "run_status" && s.status === "stopped";
10581
10594
  }
10582
- function Jc(s, e) {
10595
+ function Yc(s, e) {
10583
10596
  return X(e) ? "completed" : xe(s) ? "stopped" : !Le(s) && (s?.type === "run_error" || s?.type === "run_status" && (s.status === "failed" || s.status === "interrupted")) ? "failed" : null;
10584
10597
  }
10585
10598
  function Ei(s, e, t) {
@@ -10594,14 +10607,14 @@ function Ei(s, e, t) {
10594
10607
  }
10595
10608
  function An(s, e) {
10596
10609
  return s.some(
10597
- (t, i) => i !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) && Xc(
10610
+ (t, i) => i !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) && Zc(
10598
10611
  s,
10599
10612
  e,
10600
10613
  i
10601
10614
  )
10602
10615
  );
10603
10616
  }
10604
- function Xc(s, e, t) {
10617
+ function Zc(s, e, t) {
10605
10618
  const i = s[e], n = s[t];
10606
10619
  if (je(i, n))
10607
10620
  return !0;
@@ -10614,11 +10627,11 @@ function Xc(s, e, t) {
10614
10627
  }
10615
10628
  function Ci(s, e, t, i) {
10616
10629
  const n = (t && t !== e ? t : null) ?? [...s].reverse().find(
10617
- (c) => c.respondsToUserMessageId !== void 0 && c.respondsToUserMessageId !== e && Pi(c) && !Zc(
10630
+ (c) => c.respondsToUserMessageId !== void 0 && c.respondsToUserMessageId !== e && Pi(c) && !tl(
10618
10631
  s,
10619
10632
  c.respondsToUserMessageId
10620
10633
  )
10621
- )?.respondsToUserMessageId ?? Yc(
10634
+ )?.respondsToUserMessageId ?? el(
10622
10635
  s,
10623
10636
  e
10624
10637
  );
@@ -10647,7 +10660,7 @@ function Ci(s, e, t, i) {
10647
10660
  }
10648
10661
  ];
10649
10662
  }
10650
- function Yc(s, e) {
10663
+ function el(s, e) {
10651
10664
  const t = s.findIndex(
10652
10665
  (i) => i.role === "user" && i.id === e
10653
10666
  );
@@ -10661,12 +10674,12 @@ function Yc(s, e) {
10661
10674
  function Pi(s) {
10662
10675
  return s.role === "tool" || oe(s) ? !0 : s.role === "assistant" && s.phase === "commentary";
10663
10676
  }
10664
- function Zc(s, e) {
10677
+ function tl(s, e) {
10665
10678
  return s.some(
10666
10679
  (t) => t.respondsToUserMessageId === e && (X(t) || t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0))
10667
10680
  );
10668
10681
  }
10669
- function el(s, e) {
10682
+ function sl(s, e) {
10670
10683
  const t = s[e];
10671
10684
  for (let i = e + 1; i < s.length; i += 1) {
10672
10685
  const n = s[i];
@@ -10675,7 +10688,7 @@ function el(s, e) {
10675
10688
  }
10676
10689
  return !1;
10677
10690
  }
10678
- function tl(s, e) {
10691
+ function il(s, e) {
10679
10692
  const t = s[e];
10680
10693
  if (!t.respondsToUserMessageId)
10681
10694
  return !1;
@@ -10688,19 +10701,19 @@ function tl(s, e) {
10688
10701
  }
10689
10702
  return !1;
10690
10703
  }
10691
- function sl(s, e) {
10704
+ function nl(s, e) {
10692
10705
  const t = s[e];
10693
10706
  return s.some(
10694
10707
  (i, n) => n !== e && i.role === "assistant" && je(t, i)
10695
10708
  );
10696
10709
  }
10697
- function il(s, e) {
10710
+ function rl(s, e) {
10698
10711
  const t = s[e];
10699
10712
  return s.some(
10700
10713
  (i, n) => n !== e && i.role === "tool" && je(t, i)
10701
10714
  );
10702
10715
  }
10703
- function nl(s, e) {
10716
+ function ol(s, e) {
10704
10717
  const t = s[e];
10705
10718
  for (let i = e + 1; i < s.length; i += 1)
10706
10719
  if (oe(s[i]) && je(t, s[i]))
@@ -10713,7 +10726,7 @@ function je(s, e) {
10713
10726
  function A(s, e) {
10714
10727
  return s && typeof s == "object" && typeof s[e] == "string" ? s[e] : null;
10715
10728
  }
10716
- function rl(s, e) {
10729
+ function al(s, e) {
10717
10730
  try {
10718
10731
  const t = window.localStorage.getItem(`${yn}${s}`);
10719
10732
  if (!t)
@@ -10721,7 +10734,7 @@ function rl(s, e) {
10721
10734
  const i = JSON.parse(t), n = typeof i.sessionId == "string" ? i.sessionId : null;
10722
10735
  if (e !== void 0 && n !== e)
10723
10736
  return null;
10724
- const r = Array.isArray(i.messages) ? i.messages.map(yl).filter((o) => !!o) : [];
10737
+ const r = Array.isArray(i.messages) ? i.messages.map(Il).filter((o) => !!o) : [];
10725
10738
  return {
10726
10739
  sessionId: n,
10727
10740
  messages: r
@@ -10735,20 +10748,20 @@ function gs(s) {
10735
10748
  // running tool or commentary history from disappearing while authoritative hydration is still in flight.
10736
10749
  s.role === "tool" || s.dataType === "run_status" || s.dataType === "run_error";
10737
10750
  }
10738
- function ol(s, e) {
10751
+ function cl(s, e) {
10739
10752
  try {
10740
10753
  window.localStorage.setItem(
10741
10754
  `${yn}${s}`,
10742
10755
  JSON.stringify({
10743
10756
  sessionId: e.sessionId,
10744
- messages: e.messages.filter(gs).slice(-Ua).map(ml)
10757
+ messages: e.messages.filter(gs).slice(-Oa).map(Sl)
10745
10758
  })
10746
10759
  );
10747
10760
  } catch {
10748
10761
  return;
10749
10762
  }
10750
10763
  }
10751
- function al(s) {
10764
+ function ll(s) {
10752
10765
  try {
10753
10766
  const e = window.localStorage.getItem(`${cs}${s}`);
10754
10767
  if (!e)
@@ -10829,19 +10842,19 @@ function Ui(s, e) {
10829
10842
  }
10830
10843
  kn(s, e);
10831
10844
  }
10832
- function cl(s) {
10845
+ function dl(s) {
10833
10846
  try {
10834
10847
  const e = `${bt}${s}`, t = window.sessionStorage.getItem(e);
10835
10848
  if (window.sessionStorage.removeItem(e), !t)
10836
10849
  return [];
10837
10850
  const i = JSON.parse(t);
10838
- return Array.isArray(i) ? i.flatMap((n) => dl(n) ? [{
10851
+ return Array.isArray(i) ? i.flatMap((n) => hl(n) ? [{
10839
10852
  ...n.event,
10840
10853
  page: W(),
10841
10854
  rawOutput: {
10842
10855
  pageContextRestarted: !0,
10843
10856
  outcome: "unknown",
10844
- message: ll(location.href),
10857
+ message: ul(location.href),
10845
10858
  currentUrl: location.href,
10846
10859
  console: [],
10847
10860
  metadata: {
@@ -10858,17 +10871,17 @@ function cl(s) {
10858
10871
  return [];
10859
10872
  }
10860
10873
  }
10861
- function ll(s) {
10874
+ function ul(s) {
10862
10875
  return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
10863
10876
  Current URL: ${s}`;
10864
10877
  }
10865
- function dl(s) {
10878
+ function hl(s) {
10866
10879
  if (!s || typeof s != "object")
10867
10880
  return !1;
10868
10881
  const e = s, t = e.event;
10869
10882
  return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" && Cs(t) && t.type === "tool.result";
10870
10883
  }
10871
- function ul(s, e) {
10884
+ function pl(s, e) {
10872
10885
  const t = new Set(
10873
10886
  s.flatMap((i) => i.type === "tool.result" ? [i.callId] : [])
10874
10887
  );
@@ -10877,7 +10890,7 @@ function ul(s, e) {
10877
10890
  ...e.filter((i) => !t.has(i.callId))
10878
10891
  ];
10879
10892
  }
10880
- function hl(s) {
10893
+ function fl(s) {
10881
10894
  try {
10882
10895
  window.sessionStorage.removeItem(`${bt}${s}`);
10883
10896
  } catch {
@@ -10914,9 +10927,9 @@ function En(s, e) {
10914
10927
  } : s;
10915
10928
  }
10916
10929
  function ys(s) {
10917
- return s.type || gl(s.name) || "application/octet-stream";
10930
+ return s.type || ml(s.name) || "application/octet-stream";
10918
10931
  }
10919
- function pl(s) {
10932
+ function gl(s) {
10920
10933
  Cn({
10921
10934
  name: s.name,
10922
10935
  mimeType: ys(s),
@@ -10924,21 +10937,21 @@ function pl(s) {
10924
10937
  });
10925
10938
  }
10926
10939
  function Cn(s) {
10927
- const e = fl(s.name), t = s.mimeType.trim().toLowerCase();
10928
- if (!Ca.has(`${e}:${t}`))
10940
+ const e = yl(s.name), t = s.mimeType.trim().toLowerCase();
10941
+ if (!Da.has(`${e}:${t}`))
10929
10942
  throw new Error("This attachment type is not supported by the embedded model provider");
10930
10943
  if (s.sizeBytes <= 0 || s.sizeBytes >= fn)
10931
10944
  throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
10932
10945
  }
10933
- function fl(s) {
10946
+ function yl(s) {
10934
10947
  const e = s.trim().toLowerCase(), t = e.lastIndexOf(".");
10935
10948
  return t >= 0 ? e.slice(t) : "";
10936
10949
  }
10937
- function gl(s) {
10950
+ function ml(s) {
10938
10951
  const e = s.toLowerCase();
10939
10952
  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;
10940
10953
  }
10941
- function yl(s) {
10954
+ function Il(s) {
10942
10955
  if (!s || typeof s != "object")
10943
10956
  return null;
10944
10957
  const e = s;
@@ -10960,7 +10973,7 @@ function yl(s) {
10960
10973
  loading: typeof e.loading == "boolean" ? e.loading : void 0
10961
10974
  };
10962
10975
  }
10963
- function ml(s) {
10976
+ function Sl(s) {
10964
10977
  return s.attachments?.length ? {
10965
10978
  ...s,
10966
10979
  attachments: s.attachments.map(yt)
@@ -10984,9 +10997,9 @@ function E(s) {
10984
10997
  const e = s.runId;
10985
10998
  return typeof e == "string" && e ? e : null;
10986
10999
  }
10987
- function Il(s) {
11000
+ function wl(s) {
10988
11001
  const e = s?.timeoutMs;
10989
- return !!s && typeof s == "object" && typeof s.summary == "string" && typeof s.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <= Wa);
11002
+ return !!s && typeof s == "object" && typeof s.summary == "string" && typeof s.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <= Ka);
10990
11003
  }
10991
11004
  function Pn(s) {
10992
11005
  const e = {};
@@ -11000,22 +11013,22 @@ function Pn(s) {
11000
11013
  return e;
11001
11014
  }
11002
11015
  function Ps(s, e) {
11003
- return Bn(s) ? _t : ee(It(e), Pa);
11016
+ return Bn(s) ? _t : ee(It(e), Ua);
11004
11017
  }
11005
- function Sl(s, e) {
11018
+ function bl(s, e) {
11006
11019
  return typeof s == "string" ? s : s instanceof URL ? s.toString() : e?.url ?? "";
11007
11020
  }
11008
- async function wl(s, e, t, i) {
11021
+ async function vl(s, e, t, i) {
11009
11022
  const n = Pn(s.headers);
11010
11023
  i({
11011
11024
  ...e,
11012
11025
  responseStatus: s.status,
11013
11026
  responseHeaders: n,
11014
- responseBody: await bl(s),
11027
+ responseBody: await Tl(s),
11015
11028
  durationMs: Date.now() - t
11016
11029
  });
11017
11030
  }
11018
- async function bl(s) {
11031
+ async function Tl(s) {
11019
11032
  if (!Dn(s.headers))
11020
11033
  return;
11021
11034
  let e = null, t = null;
@@ -11025,7 +11038,7 @@ async function bl(s) {
11025
11038
  const i = new Promise((a) => {
11026
11039
  t = window.setTimeout(() => {
11027
11040
  e?.cancel(), a("timeout");
11028
- }, Da);
11041
+ }, qa);
11029
11042
  }), n = new TextDecoder();
11030
11043
  let r = "", o = 0;
11031
11044
  for (; ; ) {
@@ -11047,7 +11060,7 @@ async function bl(s) {
11047
11060
  t !== null && window.clearTimeout(t);
11048
11061
  }
11049
11062
  }
11050
- function vl(s, e) {
11063
+ function _l(s, e) {
11051
11064
  if (Dn(new Headers(e)))
11052
11065
  try {
11053
11066
  return s.responseType === "" || s.responseType === "text" ? ee(s.responseText ?? "") : void 0;
@@ -11059,7 +11072,7 @@ function Oi(s) {
11059
11072
  if (typeof s == "string")
11060
11073
  return ee(s);
11061
11074
  }
11062
- function Tl(s) {
11075
+ function Rl(s) {
11063
11076
  return V({
11064
11077
  ...s,
11065
11078
  requestBody: xi(s.requestBody),
@@ -11085,7 +11098,7 @@ function Dn(s) {
11085
11098
  return t !== null && Number.isInteger(i) && i >= 0 && i <= As && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
11086
11099
  }
11087
11100
  function fe(s, e = {}, t) {
11088
- if (Rl(t))
11101
+ if (kl(t))
11089
11102
  return !0;
11090
11103
  const i = Object.entries(e).find(([n]) => n.toLowerCase() === "content-type")?.[1]?.toLowerCase();
11091
11104
  if (i?.includes("multipart/form-data") || i?.includes("application/octet-stream"))
@@ -11100,7 +11113,7 @@ function fe(s, e = {}, t) {
11100
11113
  return !0;
11101
11114
  }
11102
11115
  }
11103
- function _l(s, e) {
11116
+ function Al(s, e) {
11104
11117
  if (fe(s))
11105
11118
  return !0;
11106
11119
  try {
@@ -11110,10 +11123,10 @@ function _l(s, e) {
11110
11123
  return !0;
11111
11124
  }
11112
11125
  }
11113
- function Rl(s) {
11126
+ function kl(s) {
11114
11127
  return s instanceof FormData || s instanceof Blob || s instanceof ArrayBuffer || ArrayBuffer.isView(s) || typeof ReadableStream < "u" && s instanceof ReadableStream;
11115
11128
  }
11116
- function Al(s) {
11129
+ function Ml(s) {
11117
11130
  const e = {};
11118
11131
  for (const t of s.trim().split(/[\r\n]+/)) {
11119
11132
  const i = t.indexOf(":");
@@ -11144,27 +11157,27 @@ async function tt(s, e) {
11144
11157
  try {
11145
11158
  return await s();
11146
11159
  } catch (n) {
11147
- if (t = n, i >= ui - 1 || !Ml(n))
11160
+ if (t = n, i >= ui - 1 || !Cl(n))
11148
11161
  throw n;
11149
- await kl(i);
11162
+ await El(i);
11150
11163
  }
11151
11164
  throw t instanceof Error ? t : new Error(e);
11152
11165
  }
11153
- function kl(s) {
11166
+ function El(s) {
11154
11167
  return new Promise((e) => {
11155
- window.setTimeout(e, Ea[s] ?? 0);
11168
+ window.setTimeout(e, Pa[s] ?? 0);
11156
11169
  });
11157
11170
  }
11158
- function Ml(s) {
11159
- return s instanceof ht ? El(s.status) : s instanceof TypeError;
11171
+ function Cl(s) {
11172
+ return s instanceof ht ? Pl(s.status) : s instanceof TypeError;
11160
11173
  }
11161
- function El(s) {
11174
+ function Pl(s) {
11162
11175
  return s === 408 || s === 409 || s === 429 || s >= 500;
11163
11176
  }
11164
- function Cl(s) {
11177
+ function Dl(s) {
11165
11178
  return s === 401 || s === 403;
11166
11179
  }
11167
- const _t = "[REDACTED_SECRET]", te = "[REDACTED_TOKEN]", Pl = "[REDACTED_SIGNED_URL]", Dl = 20, Ul = /^(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, Un = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, qn = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, On = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, xn = /\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, ql = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Ol = /\bhttps?:\/\/[^\s"'<>]+/gi, xl = /[),.;\]]+$/;
11180
+ const _t = "[REDACTED_SECRET]", te = "[REDACTED_TOKEN]", Ul = "[REDACTED_SIGNED_URL]", ql = 20, Ol = /^(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, Un = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, qn = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, On = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, xn = /\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, xl = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Bl = /\bhttps?:\/\/[^\s"'<>]+/gi, Nl = /[),.;\]]+$/;
11168
11181
  function V(s) {
11169
11182
  return mt(s, 0, /* @__PURE__ */ new WeakSet());
11170
11183
  }
@@ -11173,7 +11186,7 @@ function mt(s, e, t) {
11173
11186
  return s.startsWith("data:image/") || s.startsWith("data:application/pdf;") ? s : It(s);
11174
11187
  if (s === null || typeof s != "object")
11175
11188
  return s;
11176
- if (e >= Dl)
11189
+ if (e >= ql)
11177
11190
  return "[REDACTED_MAX_DEPTH]";
11178
11191
  if (t.has(s))
11179
11192
  return "[REDACTED_CIRCULAR]";
@@ -11181,40 +11194,40 @@ function mt(s, e, t) {
11181
11194
  return s.map((n) => mt(n, e + 1, t));
11182
11195
  const i = {};
11183
11196
  for (const [n, r] of Object.entries(s))
11184
- n === "pageContent" ? i[n] = r : Bn(n) ? i[n] = _t : i[n] = n.toLowerCase() === "url" ? Bl(r) : mt(r, e + 1, t);
11197
+ n === "pageContent" ? i[n] = r : Bn(n) ? i[n] = _t : i[n] = n.toLowerCase() === "url" ? Ll(r) : mt(r, e + 1, t);
11185
11198
  return i;
11186
11199
  }
11187
11200
  function Bn(s) {
11188
11201
  const e = s.replace(/[^a-z0-9]/gi, "").toLowerCase();
11189
11202
  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");
11190
11203
  }
11191
- function Bl(s) {
11204
+ function Ll(s) {
11192
11205
  return typeof s == "string" ? Nn(s) : mt(s, 0, /* @__PURE__ */ new WeakSet());
11193
11206
  }
11194
11207
  function Nn(s) {
11195
11208
  try {
11196
11209
  const e = new URL(s, location.href);
11197
11210
  for (const t of Array.from(e.searchParams.keys()))
11198
- Ul.test(t) && e.searchParams.set(t, te);
11211
+ Ol.test(t) && e.searchParams.set(t, te);
11199
11212
  return e.username && (e.username = te), e.password && (e.password = te), e.toString();
11200
11213
  } catch {
11201
- return Nl(s);
11214
+ return Fl(s);
11202
11215
  }
11203
11216
  }
11204
11217
  function It(s) {
11205
- return s.replace(ql, Pl).replace(Ol, Ll).replace(Un, `Bearer ${te}`).replace(qn, `Basic ${te}`).replace(On, te).replace(xn, (e, t) => `${t}: ${_t}`);
11218
+ return s.replace(xl, Ul).replace(Bl, jl).replace(Un, `Bearer ${te}`).replace(qn, `Basic ${te}`).replace(On, te).replace(xn, (e, t) => `${t}: ${_t}`);
11206
11219
  }
11207
- function Nl(s) {
11220
+ function Fl(s) {
11208
11221
  return s.replace(Un, `Bearer ${te}`).replace(qn, `Basic ${te}`).replace(On, te).replace(xn, (e, t) => `${t}: ${_t}`);
11209
11222
  }
11210
- function Ll(s) {
11211
- const e = s.match(xl)?.[0] ?? "", t = e ? s.slice(0, -e.length) : s;
11223
+ function jl(s) {
11224
+ const e = s.match(Nl)?.[0] ?? "", t = e ? s.slice(0, -e.length) : s;
11212
11225
  return `${Nn(t)}${e}`;
11213
11226
  }
11214
- const Jl = Object.freeze({
11227
+ const Zl = Object.freeze({
11215
11228
  init: (s) => vt.init(s)
11216
11229
  });
11217
- function Xl(s) {
11230
+ function ed(s) {
11218
11231
  return vt.init(s);
11219
11232
  }
11220
11233
  function Bi(s) {
@@ -11227,33 +11240,36 @@ function Bi(s) {
11227
11240
  }
11228
11241
  export {
11229
11242
  ri as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
11230
- aa as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
11231
- oa as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
11232
- ca as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
11233
- Ql as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
11234
- Jl as PlunoProductAgent,
11243
+ la as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
11244
+ ca as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
11245
+ da as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
11246
+ Zo as PRODUCT_AGENT_AUTH_RECONNECTING_ERROR_MESSAGE,
11247
+ Yl as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
11248
+ Zl as PlunoProductAgent,
11235
11249
  Vo as ProductAgentInteractionManager,
11236
11250
  ti as ProductAgentQueryController,
11237
- Gl as ProductAgentRemoteRuntimeClient,
11251
+ Xl as ProductAgentRemoteRuntimeClient,
11238
11252
  vt as ProductAgentSessionEngine,
11239
- Wl as ProductAgentSessionHistoryManager,
11240
- zl as ProductAgentTaskPageTitleController,
11253
+ Vl as ProductAgentSessionHistoryManager,
11254
+ Gl as ProductAgentTaskPageTitleController,
11241
11255
  ne as ProductAgentTokenProviderError,
11242
- Ba as calculateReconnectDelay,
11243
- jl as createLocalStorageInteractionDecisionStorage,
11256
+ La as calculateReconnectDelay,
11257
+ zl as canSubmitPersonalProductAgentMessage,
11258
+ $l as createLocalStorageInteractionDecisionStorage,
11244
11259
  lt as createProductAgentQueryState,
11245
- Xl as createProductAgentRuntime,
11246
- Kl as createProductAgentTaskPageTitleDocument,
11247
- Jl as default,
11248
- sa as formatProductAgentTaskPageTitle,
11249
- oc as getProductAgentOriginAccessErrorMessage,
11250
- Vl as isProductAgentRuntimeCommand,
11260
+ ed as createProductAgentRuntime,
11261
+ Ql as createProductAgentTaskPageTitleDocument,
11262
+ Zl as default,
11263
+ na as formatProductAgentTaskPageTitle,
11264
+ cc as getProductAgentOriginAccessErrorMessage,
11265
+ ea as isProductAgentAuthReconnectError,
11266
+ Jl as isProductAgentRuntimeCommand,
11251
11267
  Qo as mergeProductAgentEntityPages,
11252
11268
  dt as normalizeProductAgentEntityPage,
11253
11269
  zt as normalizeProductAgentSessionItems,
11254
11270
  Go as readLocalStorageInteractionDecisions,
11255
- $l as resolveProductAgentComposerAction,
11256
- Hl as resolveProductAgentWidgetPresentation,
11271
+ Kl as resolveProductAgentComposerAction,
11272
+ Wl as resolveProductAgentWidgetPresentation,
11257
11273
  Jo as selectProductAgentQueryEntities,
11258
- pl as validateProductAgentProviderInputFile
11274
+ gl as validateProductAgentProviderInputFile
11259
11275
  };