@pluno/product-agent-web 0.1.102 → 0.1.104

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
- const le = "pluno-product-agent-attachments";
1
+ const ue = "pluno-product-agent-attachments";
2
2
  const st = "files";
3
- async function xt(e) {
3
+ async function Ft(e) {
4
4
  const t = await $();
5
- await Ht(t, "readwrite", (s) => s.put(e));
5
+ await Wt(t, "readwrite", (s) => s.put(e));
6
6
  }
7
- async function ue(e) {
8
- const t = await $(), s = await Ht(
7
+ async function de(e) {
8
+ const t = await $(), s = await Wt(
9
9
  t,
10
10
  "readonly",
11
11
  (r) => r.get(e)
@@ -13,9 +13,9 @@ async function ue(e) {
13
13
  if (!s)
14
14
  return null;
15
15
  const n = Date.now();
16
- return await Ft(e, { lastUsedAt: n }), { ...s, lastUsedAt: n };
16
+ return await Ht(e, { lastUsedAt: n }), { ...s, lastUsedAt: n };
17
17
  }
18
- async function Ft(e, t) {
18
+ async function Ht(e, t) {
19
19
  const s = await $();
20
20
  await dt(s, "readwrite", async (n) => {
21
21
  const r = await ht(
@@ -27,7 +27,7 @@ async function Ft(e, t) {
27
27
  });
28
28
  });
29
29
  }
30
- async function de(e = 864e5) {
30
+ async function he(e = 864e5) {
31
31
  const t = await $(), s = Date.now() - e;
32
32
  await dt(t, "readwrite", async (n) => {
33
33
  const r = n.index("lastUsedAt");
@@ -36,14 +36,14 @@ async function de(e = 864e5) {
36
36
  }
37
37
  function $() {
38
38
  return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((e, t) => {
39
- const s = indexedDB.open(le, 1);
39
+ const s = indexedDB.open(ue, 1);
40
40
  s.onupgradeneeded = () => {
41
41
  const r = s.result.createObjectStore(st, { keyPath: "attachmentId" });
42
42
  r.createIndex("lastUsedAt", "lastUsedAt", { unique: !1 }), r.createIndex("sessionId", "sessionId", { unique: !1 }), r.createIndex("origin", "origin", { unique: !1 });
43
43
  }, s.onsuccess = () => e(s.result), s.onerror = () => t(s.error ?? new Error("Failed to open Product Agent attachment storage"));
44
44
  });
45
45
  }
46
- async function Ht(e, t, s) {
46
+ async function Wt(e, t, s) {
47
47
  return await dt(e, t, async (n) => await ht(s(n)));
48
48
  }
49
49
  function dt(e, t, s) {
@@ -73,11 +73,11 @@ function ht(e) {
73
73
  e.onsuccess = () => t(e.result), e.onerror = () => s(e.error ?? new Error("Product Agent attachment storage request failed"));
74
74
  });
75
75
  }
76
- function he(e) {
76
+ function pe(e) {
77
77
  return e !== null && (typeof e == "object" || typeof e == "function");
78
78
  }
79
- function Wt(e, t, s) {
80
- const n = Reflect.get(e, "pluno"), r = he(n) ? n : {};
79
+ function jt(e, t, s) {
80
+ const n = Reflect.get(e, "pluno"), r = pe(n) ? n : {};
81
81
  if (r !== n && !Reflect.set(e, "pluno", r))
82
82
  return null;
83
83
  const i = Object.getOwnPropertyDescriptor(r, t);
@@ -91,8 +91,8 @@ function Wt(e, t, s) {
91
91
  }
92
92
  };
93
93
  }
94
- const H = "pluno.productAgent.scheduledChatContinuation.", nt = "pluno:scheduled-chat-continuation-changed", jt = 10080 * 6e4, pe = 5e3, fe = 15e3;
95
- function ge(e, {
94
+ const H = "pluno.productAgent.scheduledChatContinuation.", nt = "pluno:scheduled-chat-continuation-changed", $t = 10080 * 6e4, fe = 5e3, ge = 15e3;
95
+ function me(e, {
96
96
  clientId: t,
97
97
  sessionId: s,
98
98
  callId: n
@@ -103,7 +103,7 @@ function ge(e, {
103
103
  clientId: t,
104
104
  sessionId: s,
105
105
  defaultTaskId: `scheduled-${n}`,
106
- expiresAfterDueMs: jt
106
+ expiresAfterDueMs: $t
107
107
  })});
108
108
  const scheduleQuery = (query, delaySeconds) => {
109
109
  if (typeof query !== "string" || query.trim().length === 0) {
@@ -132,15 +132,15 @@ const scheduleQuery = (query, delaySeconds) => {
132
132
  };
133
133
  ${e}`;
134
134
  }
135
- function me(e) {
136
- const t = e.storage === void 0 ? ye() : e.storage;
135
+ function ye(e) {
136
+ const t = e.storage === void 0 ? Te() : e.storage;
137
137
  let s = null, n = !1, r = !1, i = !1, o = t !== null;
138
138
  const c = /* @__PURE__ */ new Map(), u = () => {
139
139
  s !== null && (clearTimeout(s), s = null);
140
140
  }, l = () => {
141
141
  u(), !(i || !o) && (s = setTimeout(() => {
142
142
  s = null, h();
143
- }, pe));
143
+ }, fe));
144
144
  }, a = () => {
145
145
  o = !1, u();
146
146
  }, h = async () => {
@@ -170,7 +170,7 @@ function me(e) {
170
170
  e.onTasksChanged?.(m);
171
171
  for (const g of m)
172
172
  if (!(g.clientId !== e.clientId || g.dueAt > f || c.has(g.id) || !await e.canDeliver(g))) {
173
- c.set(g.id, f + fe);
173
+ c.set(g.id, f + ge);
174
174
  try {
175
175
  await e.deliver(g);
176
176
  } catch {
@@ -216,9 +216,9 @@ function D(e) {
216
216
  if (!e || typeof e != "object")
217
217
  return !1;
218
218
  const t = e;
219
- return typeof t.id == "string" && t.id.length > 0 && typeof t.clientId == "string" && t.clientId.length > 0 && typeof t.sessionId == "string" && t.sessionId.length > 0 && typeof t.prompt == "string" && t.prompt.trim().length > 0 && typeof t.dueAt == "number" && Number.isFinite(t.dueAt) && typeof t.expiresAt == "number" && Number.isFinite(t.expiresAt) && t.expiresAt === t.dueAt + jt;
219
+ return typeof t.id == "string" && t.id.length > 0 && typeof t.clientId == "string" && t.clientId.length > 0 && typeof t.sessionId == "string" && t.sessionId.length > 0 && typeof t.prompt == "string" && t.prompt.trim().length > 0 && typeof t.dueAt == "number" && Number.isFinite(t.dueAt) && typeof t.expiresAt == "number" && Number.isFinite(t.expiresAt) && t.expiresAt === t.dueAt + $t;
220
220
  }
221
- function ye() {
221
+ function Te() {
222
222
  let e;
223
223
  try {
224
224
  e = window.localStorage, e.length;
@@ -262,10 +262,10 @@ function ye() {
262
262
  function J(e) {
263
263
  return `${H}${e}`;
264
264
  }
265
- const Y = "pluno.productAgent.transportId", Te = "pluno.productAgent.transportIdentity", V = "pluno.productAgent.transportIdentity.event", we = 50, Ie = globalThis.setTimeout.bind(globalThis);
266
- let P = null;
265
+ const Y = "pluno.productAgent.transportId", we = "pluno.productAgent.transportIdentity", V = "pluno.productAgent.transportIdentity.event", Ie = 50, Ae = globalThis.setTimeout.bind(globalThis);
266
+ let U = null;
267
267
  const q = /* @__PURE__ */ new Set();
268
- async function Ae(e = $t()) {
268
+ async function Se(e = zt()) {
269
269
  const t = e.randomUUID(), s = e.storage.getItem(Y);
270
270
  let n = s ?? e.randomUUID(), r = !1, i = !1;
271
271
  const o = e.channel.subscribe((u) => {
@@ -301,14 +301,14 @@ async function Ae(e = $t()) {
301
301
  }
302
302
  };
303
303
  }
304
- async function Se() {
305
- P || (P = Ae($t()), P.then((n) => {
304
+ async function ke() {
305
+ U || (U = Se(zt()), U.then((n) => {
306
306
  const r = (i) => {
307
- i.persisted || (n.release(), P = null, q.clear(), window.removeEventListener("pagehide", r));
307
+ i.persisted || (n.release(), U = null, q.clear(), window.removeEventListener("pagehide", r));
308
308
  };
309
309
  window.addEventListener("pagehide", r);
310
310
  }));
311
- const e = await P, t = ke();
311
+ const e = await U, t = Ee();
312
312
  q.add(t);
313
313
  let s = !1;
314
314
  return {
@@ -319,23 +319,23 @@ async function Se() {
319
319
  }
320
320
  };
321
321
  }
322
- function ke() {
322
+ function Ee() {
323
323
  let e = 0;
324
324
  for (; q.has(e); )
325
325
  e += 1;
326
326
  return e;
327
327
  }
328
- function $t() {
328
+ function zt() {
329
329
  return {
330
330
  storage: window.sessionStorage,
331
- channel: Ee(),
331
+ channel: _e(),
332
332
  randomUUID: () => crypto.randomUUID(),
333
- settle: () => new Promise((e) => Ie(e, we))
333
+ settle: () => new Promise((e) => Ae(e, Ie))
334
334
  };
335
335
  }
336
- function Ee() {
336
+ function _e() {
337
337
  if (typeof BroadcastChannel < "u") {
338
- const e = new BroadcastChannel(Te);
338
+ const e = new BroadcastChannel(we);
339
339
  return {
340
340
  postMessage: (t) => e.postMessage(t),
341
341
  subscribe: (t) => {
@@ -368,18 +368,18 @@ function Re() {
368
368
  }
369
369
  };
370
370
  }
371
- const rt = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', Ce = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', _e = ".pluno-pa-widget__panel", be = ".pluno-pa-widget__timeline", St = `${rt}[data-pluno-sdk-preview-channel]`, Me = "https://app.pluno.ai", Pe = "gpt-5.6-terra", Ue = 2e4, De = 1e4, ve = 1e4, Ne = 1e4, Oe = 1e4, Le = 1e3, kt = 3e4, Et = 0.2, Rt = 6e4, Be = 15e3, N = 8, qe = 15e3, xe = 2e3, Fe = 1e3, He = 100, We = 8e3, je = 15e3, Ct = 3, $e = [300, 1e3], pt = 64e3, Z = 4e3, ft = 30, ze = 2e3, Ge = 1e3, Xe = 200 * 1024 * 1024, gt = "Image is too large for model vision input.", Ke = 100, zt = "pluno.productAgent.state.", it = "pluno.productAgent.pendingEvents.", z = "pluno.productAgent.activeToolCalls.", Je = 100;
371
+ const rt = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', Ce = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', be = ".pluno-pa-widget__panel", Me = ".pluno-pa-widget__timeline", St = `${rt}[data-pluno-sdk-preview-channel]`, Ue = "https://app.pluno.ai", Pe = "gpt-5.6-terra", De = 2e4, ve = 1e4, Ne = 1e4, Oe = 1e4, Le = 1e4, Be = 1e3, kt = 3e4, Et = 0.2, _t = 6e4, qe = 15e3, N = 8, xe = 15e3, Fe = 2e3, He = 1e3, We = 100, je = 8e3, $e = 15e3, Rt = 3, ze = [300, 1e3], pt = 64e3, Z = 4e3, ft = 30, Ge = 2e3, Xe = 1e3, Ke = 200 * 1024 * 1024, gt = "Image is too large for model vision input.", Je = 100, Gt = "pluno.productAgent.state.", it = "pluno.productAgent.pendingEvents.", z = "pluno.productAgent.activeToolCalls.", Ye = 100;
372
372
  function O(e, t = 0) {
373
373
  const s = e === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (e - 1));
374
374
  return Math.max(t, s);
375
375
  }
376
376
  const x = /* @__PURE__ */ new Set();
377
377
  let L = null;
378
- function Ye(e, t = Math.random) {
379
- const s = Math.min(kt, Le * 2 ** e), n = 1 - Et + t() * Et * 2;
378
+ function Ve(e, t = Math.random) {
379
+ const s = Math.min(kt, Be * 2 ** e), n = 1 - Et + t() * Et * 2;
380
380
  return Math.min(kt, Math.round(s * n));
381
381
  }
382
- function Ve(e, t, s) {
382
+ function Ze(e, t, s) {
383
383
  return new Promise((n, r) => {
384
384
  const i = setTimeout(() => r(new Error(s)), t);
385
385
  e.then(
@@ -392,13 +392,13 @@ function Ve(e, t, s) {
392
392
  );
393
393
  });
394
394
  }
395
- class Gt {
395
+ class Xt {
396
396
  constructor(t, s) {
397
397
  this.options = t, this.transportIdentity = s, this.state = {
398
398
  ...this.state,
399
- starterPrompts: Es(t.initialStarterPrompts)
399
+ starterPrompts: _s(t.initialStarterPrompts)
400
400
  };
401
- const n = t.restorePersistedState === !1 ? null : sn(t.clientId, t.expectedPersistedSessionId);
401
+ const n = t.restorePersistedState === !1 ? null : rn(t.clientId, t.expectedPersistedSessionId);
402
402
  n && (this.state = {
403
403
  ...this.state,
404
404
  ...n,
@@ -409,10 +409,10 @@ class Gt {
409
409
  assistantDraftRunId: null,
410
410
  isThinking: !1,
411
411
  lastError: null
412
- }), this.queuedClientEvents = un(
413
- rn(t.clientId),
414
- an(t.clientId)
415
- ), U(t.clientId, this.queuedClientEvents), this.scheduledChatContinuationScheduler = me({
412
+ }), this.queuedClientEvents = hn(
413
+ an(t.clientId),
414
+ ln(t.clientId)
415
+ ), P(t.clientId, this.queuedClientEvents), this.scheduledChatContinuationScheduler = ye({
416
416
  clientId: t.clientId,
417
417
  canDeliver: (r) => r.sessionId === this.state.sessionId,
418
418
  deliver: async (r) => {
@@ -481,17 +481,18 @@ class Gt {
481
481
  assistantDraftRunId: null,
482
482
  isThinking: !1,
483
483
  lastError: null,
484
- lastErrorCode: null
484
+ lastErrorCode: null,
485
+ lastErrorSecuritySettingsUrl: null
485
486
  };
486
487
  static async init(t) {
487
- const s = await Se(), n = new Gt({
488
+ const s = await ke(), n = new Xt({
488
489
  ...t,
489
- backendUrl: gs(t.backendUrl ?? Me),
490
- clientId: t.clientId ?? Ms(),
490
+ backendUrl: ms(t.backendUrl ?? Ue),
491
+ clientId: t.clientId ?? Us(),
491
492
  model: t.model ?? Pe
492
493
  }, s);
493
494
  try {
494
- de().catch((r) => {
495
+ he().catch((r) => {
495
496
  y("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
496
497
  message: r instanceof Error ? r.message : String(r)
497
498
  });
@@ -523,14 +524,14 @@ class Gt {
523
524
  lastError: null
524
525
  });
525
526
  try {
526
- if (this.token = this.options.token ?? (this.options.tokenProvider ? await Ve(this.options.tokenProvider(), ve, "Pluno token provider timed out") : null), t !== this.connectionAttemptId || this.state.status === "closed")
527
+ if (this.token = this.options.token ?? (this.options.tokenProvider ? await Ze(this.options.tokenProvider(), Ne, "Pluno token provider timed out") : null), t !== this.connectionAttemptId || this.state.status === "closed")
527
528
  return;
528
529
  if (!this.token && !this.options.webSocketFactory)
529
530
  throw new Error("Pluno requires a token or tokenProvider");
530
- const s = ys(this.options.backendUrl), n = this.options.webSocketFactory?.(s) ?? new WebSocket(s);
531
+ const s = Ts(this.options.backendUrl), n = this.options.webSocketFactory?.(s) ?? new WebSocket(s);
531
532
  this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
532
533
  this.socket === n && n.readyState === WebSocket.CONNECTING && (y("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.replaceTimedOutSocket(n));
533
- }, Ne), n.addEventListener("open", () => {
534
+ }, Oe), n.addEventListener("open", () => {
534
535
  this.socket !== n || (this.clearSocketConnectTimer(), y("web-sdk.agent", "Pluno socket opened", {
535
536
  queuedClientEventCount: this.queuedClientEvents.length,
536
537
  isThinking: this.state.isThinking
@@ -542,9 +543,9 @@ class Gt {
542
543
  pageUrl: location.href
543
544
  }) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
544
545
  this.socket === n && (y("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.replaceTimedOutSocket(n));
545
- }, Oe));
546
+ }, Le));
546
547
  }), n.addEventListener("message", (r) => {
547
- this.socket === n && this.handleServerEvent(ks(r.data));
548
+ this.socket === n && this.handleServerEvent(Es(r.data));
548
549
  }), n.addEventListener("close", (r) => {
549
550
  this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (y("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
550
551
  code: typeof r?.code == "number" ? r.code : null,
@@ -577,7 +578,7 @@ class Gt {
577
578
  this.connectionAttemptId += 1, this.setState({ status: "closed", isThinking: !1 }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.clearStarterPromptUrlRefreshTimer(), this.clearRetryTimers(), this.clearThinkingWatchdog(), this.rejectPendingSessionHistoryRequests("Pluno disconnected."), this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.queuedClientEvents = [], this.socket?.close(), this.socket = null;
578
579
  }
579
580
  destroy() {
580
- this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionUserFilesApi(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), this.scheduledChatContinuationScheduler.destroy(), dn(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
581
+ this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionUserFilesApi(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), this.scheduledChatContinuationScheduler.destroy(), pn(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
581
582
  for (const t of Object.values(this.listeners))
582
583
  t?.clear();
583
584
  }
@@ -613,7 +614,7 @@ class Gt {
613
614
  attachments: i.length > 0 ? i : void 0,
614
615
  page: o,
615
616
  model: this.options.model,
616
- metadata: _t(this.options.metadata)
617
+ metadata: Ct(this.options.metadata)
617
618
  };
618
619
  return this.activeClientMessageId = c, this.activeUserMessageEvent = a, this.markThinkingProgress(), this.send(a), this.startBackgroundAttachmentUploads(c, i), c;
619
620
  }
@@ -625,12 +626,12 @@ class Gt {
625
626
  const s = B(), n = {
626
627
  id: s,
627
628
  name: t.name || "attachment",
628
- mimeType: Lt(t),
629
+ mimeType: Bt(t),
629
630
  sizeBytes: t.size
630
631
  };
631
632
  this.attachmentFiles.set(s, t), this.attachmentBlobCache.set(s, t);
632
633
  const r = Date.now();
633
- return xt({
634
+ return Ft({
634
635
  attachmentId: s,
635
636
  name: n.name,
636
637
  mimeType: n.mimeType,
@@ -685,7 +686,7 @@ class Gt {
685
686
  waitForSession: r,
686
687
  notifyCompletion: i
687
688
  }) {
688
- const o = r ? await this.waitForSessionId() : this.state.sessionId, c = Lt(t), u = {
689
+ const o = r ? await this.waitForSessionId() : this.state.sessionId, c = Bt(t), u = {
689
690
  sessionId: o ?? void 0,
690
691
  attachmentId: s.id,
691
692
  clientId: this.options.clientId,
@@ -695,7 +696,7 @@ class Gt {
695
696
  sizeBytes: t.size,
696
697
  page: S(),
697
698
  model: this.options.model,
698
- metadata: _t(this.options.metadata)
699
+ metadata: Ct(this.options.metadata)
699
700
  }, l = this.options.prepareAttachmentUpload ? await et(
700
701
  () => this.options.prepareAttachmentUpload(u),
701
702
  "Failed to prepare attachment upload"
@@ -710,8 +711,8 @@ class Gt {
710
711
  throw new F("Failed to upload attachment", h.status);
711
712
  return h;
712
713
  }, "Failed to upload attachment"), this.setState({ sessionId: l.sessionId });
713
- const a = te(l.attachment, this.options.backendUrl);
714
- return this.updateAttachmentInState(s.id, a), s.id && Ft(s.id, {
714
+ const a = ee(l.attachment, this.options.backendUrl);
715
+ return this.updateAttachmentInState(s.id, a), s.id && Ht(s.id, {
715
716
  sessionId: l.sessionId,
716
717
  fileUrl: a.fileUrl,
717
718
  gcsPath: a.gcsPath,
@@ -733,7 +734,7 @@ class Gt {
733
734
  return this.state.sessionId ? Promise.resolve(this.state.sessionId) : new Promise((t, s) => {
734
735
  const n = window.setTimeout(() => {
735
736
  r(), s(new Error("Timed out waiting for Pluno session before persisting attachment"));
736
- }, je), r = this.on("state", (i) => {
737
+ }, $e), r = this.on("state", (i) => {
737
738
  i.sessionId && (window.clearTimeout(n), r(), t(i.sessionId));
738
739
  });
739
740
  });
@@ -755,7 +756,7 @@ class Gt {
755
756
  const n = await this.fetchEmbedAttachmentUpload(t);
756
757
  if (n.ok)
757
758
  return await n.json();
758
- if (Mn(n.status) && this.options.tokenProvider && !s) {
759
+ if (Pn(n.status) && this.options.tokenProvider && !s) {
759
760
  s = !0;
760
761
  const r = await this.fetchEmbedAttachmentUpload(t);
761
762
  if (r.ok)
@@ -800,7 +801,7 @@ class Gt {
800
801
  const s = B(), n = new Promise((i, o) => {
801
802
  const c = window.setTimeout(() => {
802
803
  this.pendingSessionHistoryRequests.delete(s), o(new Error("Session history did not respond in time"));
803
- }, We);
804
+ }, je);
804
805
  this.pendingSessionHistoryRequests.set(s, { resolve: i, reject: o, timeout: c });
805
806
  }), r = {
806
807
  type: "sessions.list",
@@ -831,7 +832,7 @@ class Gt {
831
832
  });
832
833
  }
833
834
  send(t) {
834
- this.sendNow(k(t)) || (this.queuedClientEvents.push(t), U(this.options.clientId, this.queuedClientEvents), this.setState({ status: "reconnecting" }), this.scheduleReconnect());
835
+ this.sendNow(k(t)) || (this.queuedClientEvents.push(t), P(this.options.clientId, this.queuedClientEvents), this.setState({ status: "reconnecting" }), this.scheduleReconnect());
835
836
  }
836
837
  async getUploadToken() {
837
838
  const t = this.options.token ?? await this.options.tokenProvider?.() ?? this.token ?? null;
@@ -857,7 +858,7 @@ class Gt {
857
858
  if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
858
859
  return;
859
860
  this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
860
- const t = Ts();
861
+ const t = ws();
861
862
  this.sendNow(
862
863
  k({
863
864
  type: "starter_prompts.page_context",
@@ -868,13 +869,13 @@ class Gt {
868
869
  ) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
869
870
  }
870
871
  startStarterPromptUrlWatcher() {
871
- this.locationChangeCleanup || (this.locationChangeCleanup = ws(() => this.handleStarterPromptUrlChange()));
872
+ this.locationChangeCleanup || (this.locationChangeCleanup = Is(() => this.handleStarterPromptUrlChange()));
872
873
  }
873
874
  handleStarterPromptUrlChange() {
874
875
  const t = location.href;
875
876
  t !== this.lastStarterPromptPageUrl && (this.lastStarterPromptPageUrl = t, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
876
877
  this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
877
- }, Je));
878
+ }, Ye));
878
879
  }
879
880
  refreshStarterPromptsForCurrentUrl() {
880
881
  this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
@@ -889,14 +890,14 @@ class Gt {
889
890
  if (this.socket?.readyState !== WebSocket.OPEN || this.queuedClientEvents.length === 0)
890
891
  return;
891
892
  const t = this.queuedClientEvents.splice(0, this.queuedClientEvents.length);
892
- U(this.options.clientId, this.queuedClientEvents);
893
+ P(this.options.clientId, this.queuedClientEvents);
893
894
  for (let s = 0; s < t.length; s += 1) {
894
895
  const n = t[s];
895
896
  if (!this.sendNow(k(n))) {
896
- this.queuedClientEvents.unshift(n, ...t.slice(s + 1)), U(this.options.clientId, this.queuedClientEvents);
897
+ this.queuedClientEvents.unshift(n, ...t.slice(s + 1)), P(this.options.clientId, this.queuedClientEvents);
897
898
  return;
898
899
  }
899
- U(this.options.clientId, this.queuedClientEvents);
900
+ P(this.options.clientId, this.queuedClientEvents);
900
901
  }
901
902
  }
902
903
  handleServerEvent(t) {
@@ -908,7 +909,7 @@ class Gt {
908
909
  this.clearHeartbeatAckTimer();
909
910
  return;
910
911
  }
911
- if (ts(t) && this.markThinkingProgress(), t.type === "auth.ok") {
912
+ if (es(t) && this.markThinkingProgress(), t.type === "auth.ok") {
912
913
  this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.flushQueuedClientEvents(), this.startHeartbeat();
913
914
  const s = Rs(t), n = Object.prototype.hasOwnProperty.call(t, "appearance");
914
915
  y("web-sdk.agent", "Received auth.ok appearance", {
@@ -920,7 +921,7 @@ class Gt {
920
921
  user: Ps(t.user),
921
922
  status: "connected"
922
923
  };
923
- (i || this.state.starterPrompts.length === 0) && (c.starterPrompts = r, c.starterPromptsLoading = r.length > 0 ? !1 : o), i && r.length > 0 && (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0), (n || s) && (c.appearance = s), this.setState(c), i && r.length === 0 && !o && !As() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
924
+ (i || this.state.starterPrompts.length === 0) && (c.starterPrompts = r, c.starterPromptsLoading = r.length > 0 ? !1 : o), i && r.length > 0 && (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0), (n || s) && (c.appearance = s), this.setState(c), i && r.length === 0 && !o && !Ss() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
924
925
  type: "page.upsert",
925
926
  sessionId: this.state.sessionId,
926
927
  page: S(),
@@ -938,9 +939,9 @@ class Gt {
938
939
  if (t.type === "conversation.state") {
939
940
  const s = Array.isArray(t.items) ? t.items : [];
940
941
  this.rememberUserMessageClientMessageIds(s);
941
- const n = Gs(s);
942
+ const n = Ks(s);
942
943
  if (n) {
943
- const a = Xs(s, n);
944
+ const a = Js(s, n);
944
945
  this.retryAttemptsByClientMessageId[n] = Math.max(
945
946
  this.retryAttemptsByClientMessageId[n] ?? 0,
946
947
  a
@@ -948,22 +949,22 @@ class Gt {
948
949
  }
949
950
  const r = s.filter((a) => {
950
951
  const h = v(a);
951
- return !Dt(h) && (!n || !at(h));
952
- }), i = xs(
952
+ return !vt(h) && (!n || !at(h));
953
+ }), i = Hs(
953
954
  this.state.messages,
954
- Us(r, this.options.backendUrl)
955
- ), o = Ut(i), c = s.some(
956
- (a) => Nt(
955
+ Ds(r, this.options.backendUrl)
956
+ ), o = Dt(i), c = s.some(
957
+ (a) => Ot(
957
958
  v(a),
958
959
  this.state.assistantDraft,
959
960
  this.state.assistantDraftRespondsToUserMessageId,
960
961
  this.state.assistantDraftRunId
961
962
  )
962
963
  ), u = o && (!this.state.assistantDraft || c);
963
- if (!o && zs(this.state.messages, s))
964
+ if (!o && Xs(this.state.messages, s))
964
965
  return;
965
966
  const l = u ? null : ct(s);
966
- if (this.latestRecoverableClientMessageId = l, js(i) && this.clearRetryTimers(), this.setState({
967
+ if (this.latestRecoverableClientMessageId = l, zs(i) && this.clearRetryTimers(), this.setState({
967
968
  sessionId: I(t.session, "id") ?? this.state.sessionId,
968
969
  messages: i,
969
970
  ...u ? {
@@ -986,7 +987,7 @@ class Gt {
986
987
  if (t.type === "sessions.page") {
987
988
  const s = typeof t.requestId == "string" ? t.requestId : null, n = s ? this.pendingSessionHistoryRequests.get(s) : null;
988
989
  s && n && (window.clearTimeout(n.timeout), this.pendingSessionHistoryRequests.delete(s), n.resolve({
989
- sessions: Ds(t.sessions),
990
+ sessions: vs(t.sessions),
990
991
  nextCursor: typeof t.nextCursor == "string" ? t.nextCursor : null
991
992
  }));
992
993
  return;
@@ -1000,7 +1001,7 @@ class Gt {
1000
1001
  const s = v(t.item);
1001
1002
  if (at(s)) {
1002
1003
  typeof s?.runId == "string" && this.retryableFailureRunIdsAwaitingDone.add(s.runId);
1003
- const r = I(t.item, "sessionId") ?? this.state.sessionId, i = s ? M(s) : null, o = i ? this.clientMessageIdsByUserMessageItemId.get(i) : null, c = typeof s?.clientMessageId == "string" ? s.clientMessageId : o ?? (i ? null : this.activeClientMessageId ?? this.latestRecoverableClientMessageId);
1004
+ const r = I(t.item, "sessionId") ?? this.state.sessionId, i = s ? C(s) : null, o = i ? this.clientMessageIdsByUserMessageItemId.get(i) : null, c = typeof s?.clientMessageId == "string" ? s.clientMessageId : o ?? (i ? null : this.activeClientMessageId ?? this.latestRecoverableClientMessageId);
1004
1005
  if (r && c) {
1005
1006
  this.retryAfterInterruptedRun(r, c);
1006
1007
  return;
@@ -1010,14 +1011,14 @@ class Gt {
1010
1011
  return;
1011
1012
  }
1012
1013
  }
1013
- if (Dt(s))
1014
+ if (vt(s))
1014
1015
  return;
1015
- const n = Kt(t.item, this.options.backendUrl);
1016
+ const n = Jt(t.item, this.options.backendUrl);
1016
1017
  if (n) {
1017
1018
  n.role === "assistant" && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer());
1018
1019
  const r = t.item.data;
1019
- Js(r) && this.clearRunAckResyncRetryTimer();
1020
- const i = qs(this.state.messages, n), o = Ut(i), c = Nt(
1020
+ Vs(r) && this.clearRunAckResyncRetryTimer();
1021
+ const i = Fs(this.state.messages, n), o = Dt(i), c = Ot(
1021
1022
  r,
1022
1023
  this.state.assistantDraft,
1023
1024
  this.state.assistantDraftRespondsToUserMessageId,
@@ -1071,12 +1072,13 @@ class Gt {
1071
1072
  return;
1072
1073
  }
1073
1074
  o && r && i && (this.retryableClientMessageId = i);
1074
- const c = new Error(typeof t.message == "string" ? t.message.replace(/Product Agent/g, "Pluno") : "Pluno error"), u = ms(c.message);
1075
+ const c = new Error(typeof t.message == "string" ? t.message.replace(/Product Agent/g, "Pluno") : "Pluno error"), u = ys(c.message);
1075
1076
  u && console.error(u), this.setState({
1076
1077
  status: "error",
1077
1078
  isThinking: !1,
1078
1079
  lastError: c.message,
1079
- lastErrorCode: typeof t.code == "string" ? t.code : null
1080
+ lastErrorCode: typeof t.code == "string" ? t.code : null,
1081
+ lastErrorSecuritySettingsUrl: typeof t.securitySettingsUrl == "string" ? t.securitySettingsUrl : null
1080
1082
  }), this.clearThinkingWatchdog(), this.emit("error", c);
1081
1083
  }
1082
1084
  }
@@ -1145,7 +1147,7 @@ class Gt {
1145
1147
  this.pendingSessionHistoryRequests.clear();
1146
1148
  }
1147
1149
  markThinkingProgress() {
1148
- !this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(Rt), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
1150
+ !this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(_t), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
1149
1151
  }
1150
1152
  scheduleThinkingWatchdog(t) {
1151
1153
  this.thinkingWatchdogTimer !== null && window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = window.setTimeout(() => {
@@ -1165,7 +1167,7 @@ class Gt {
1165
1167
  scheduleRunAckWatchdog(t) {
1166
1168
  this.runAckWatchdogTimer !== null && window.clearTimeout(this.runAckWatchdogTimer), this.runAckWatchdogTimer = window.setTimeout(() => {
1167
1169
  this.runAckWatchdogTimer = null, this.recoverMissedRunAck(t);
1168
- }, qe);
1170
+ }, xe);
1169
1171
  }
1170
1172
  recoverMissedRunAck(t) {
1171
1173
  !this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== t || (y("web-sdk.agent", "Pluno run ack missed; resyncing session", {
@@ -1189,8 +1191,8 @@ class Gt {
1189
1191
  sessionId: this.state.sessionId,
1190
1192
  clientMessageId: t,
1191
1193
  automatic: !0
1192
- }) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.scheduleThinkingWatchdog(Rt)));
1193
- }, O(s, xe)));
1194
+ }) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.scheduleThinkingWatchdog(_t)));
1195
+ }, O(s, Fe)));
1194
1196
  }
1195
1197
  clearRunAckResyncRetryTimer() {
1196
1198
  this.runAckResyncRetryTimer !== null && (window.clearTimeout(this.runAckResyncRetryTimer), this.runAckResyncRetryTimer = null);
@@ -1229,7 +1231,7 @@ class Gt {
1229
1231
  sessionId: this.state.sessionId,
1230
1232
  clientMessageId: t,
1231
1233
  resyncAttempts: s + 1
1232
- }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(Be);
1234
+ }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(qe);
1233
1235
  return;
1234
1236
  }
1235
1237
  this.setState({
@@ -1261,7 +1263,7 @@ class Gt {
1261
1263
  const s = typeof t.sessionId == "string" ? t.sessionId : null, n = typeof t.callId == "string" ? t.callId : null, r = typeof t.toolName == "string" ? t.toolName : null, i = typeof t.summary == "string" ? t.summary : "Running browser tool", o = t.rawInput;
1262
1264
  if (!s || !n || !r)
1263
1265
  return;
1264
- if (r !== "execute_code" || !yn(o)) {
1266
+ if (r !== "execute_code" || !wn(o)) {
1265
1267
  this.send({
1266
1268
  type: "tool.result",
1267
1269
  sessionId: s,
@@ -1277,7 +1279,7 @@ class Gt {
1277
1279
  });
1278
1280
  return;
1279
1281
  }
1280
- const c = ns(this.state.messages);
1282
+ const c = rs(this.state.messages);
1281
1283
  this.activeBrowserToolCalls.set(n, {
1282
1284
  event: {
1283
1285
  type: "tool.result",
@@ -1295,7 +1297,7 @@ class Gt {
1295
1297
  let u = null, l;
1296
1298
  u = await this.executeRuntimeHelper(), l = await bt({
1297
1299
  ...o,
1298
- javascript: ge(o.javascript, {
1300
+ javascript: me(o.javascript, {
1299
1301
  clientId: this.options.clientId,
1300
1302
  sessionId: s,
1301
1303
  callId: n
@@ -1312,24 +1314,24 @@ class Gt {
1312
1314
  toolName: r,
1313
1315
  summary: o.summary,
1314
1316
  rawInput: k(o),
1315
- rawOutput: k(_s(l, u))
1316
- }), on(this.options.clientId, this.activeBrowserToolCalls.values());
1317
+ rawOutput: k(bs(l, u))
1318
+ }), cn(this.options.clientId, this.activeBrowserToolCalls.values());
1317
1319
  }
1318
1320
  startPageLifecycleRecovery() {
1319
1321
  if (this.pageLifecycleCleanup)
1320
1322
  return;
1321
1323
  const t = () => {
1322
- Zt(this.options.clientId, this.activeBrowserToolCalls.values());
1324
+ Qt(this.options.clientId, this.activeBrowserToolCalls.values());
1323
1325
  };
1324
1326
  window.addEventListener("pagehide", t), window.addEventListener("beforeunload", t), this.pageLifecycleCleanup = () => {
1325
1327
  window.removeEventListener("pagehide", t), window.removeEventListener("beforeunload", t);
1326
1328
  };
1327
1329
  }
1328
1330
  installSessionUserFilesApi(t) {
1329
- this.cleanupSessionUserFilesApi(), this.sessionUserFilesApiCleanup = rs(t, this.attachmentFiles, this.attachmentBlobCache);
1331
+ this.cleanupSessionUserFilesApi(), this.sessionUserFilesApiCleanup = is(t, this.attachmentFiles, this.attachmentBlobCache);
1330
1332
  }
1331
1333
  cleanupSessionUserFilesApi() {
1332
- this.sessionUserFilesApiCleanup && (hs(this.sessionUserFilesApiCleanup), this.sessionUserFilesApiCleanup = null);
1334
+ this.sessionUserFilesApiCleanup && (ps(this.sessionUserFilesApiCleanup), this.sessionUserFilesApiCleanup = null);
1333
1335
  }
1334
1336
  async executeRuntimeHelper() {
1335
1337
  if (!this.runtimeHelperJavascript?.trim())
@@ -1337,15 +1339,15 @@ class Gt {
1337
1339
  const t = await bt({
1338
1340
  javascript: this.runtimeHelperJavascript
1339
1341
  });
1340
- return t.ok === !1 ? bs(t) : null;
1342
+ return t.ok === !1 ? Ms(t) : null;
1341
1343
  }
1342
1344
  enableNetworkCapture() {
1343
- this.networkCaptureCleanup || (this.networkCaptureCleanup = Ze((t) => {
1344
- kn(t.url, this.options.backendUrl) || this.enqueueNetworkEvent(t);
1345
+ this.networkCaptureCleanup || (this.networkCaptureCleanup = Qe((t) => {
1346
+ _n(t.url, this.options.backendUrl) || this.enqueueNetworkEvent(t);
1345
1347
  }));
1346
1348
  }
1347
1349
  enqueueNetworkEvent(t) {
1348
- this.queuedNetworkEvents.length >= He || (this.queuedNetworkEvents.push(Sn(t)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
1350
+ this.queuedNetworkEvents.length >= We || (this.queuedNetworkEvents.push(En(t)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
1349
1351
  this.networkBatchTimer = null;
1350
1352
  const s = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
1351
1353
  s.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
@@ -1354,12 +1356,12 @@ class Gt {
1354
1356
  page: S(),
1355
1357
  events: s
1356
1358
  });
1357
- }, Fe)));
1359
+ }, He)));
1358
1360
  }
1359
1361
  scheduleReconnect() {
1360
1362
  if (this.reconnectTimer !== null || this.state.status === "closed")
1361
1363
  return;
1362
- const t = Ye(this.reconnectAttempts);
1364
+ const t = Ve(this.reconnectAttempts);
1363
1365
  this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
1364
1366
  this.reconnectTimer = null, this.connect().catch((s) => {
1365
1367
  y("web-sdk.agent", "Pluno reconnect failed; retrying", {
@@ -1375,8 +1377,8 @@ class Gt {
1375
1377
  const t = this.socket;
1376
1378
  !t || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
1377
1379
  this.socket === t && (y("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(t));
1378
- }, De));
1379
- }, Ue);
1380
+ }, ve));
1381
+ }, De);
1380
1382
  }
1381
1383
  stopHeartbeat() {
1382
1384
  this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
@@ -1400,21 +1402,22 @@ class Gt {
1400
1402
  this.state = {
1401
1403
  ...this.state,
1402
1404
  ...t,
1403
- ...t.lastError === null && t.lastErrorCode === void 0 ? { lastErrorCode: null } : {}
1404
- }, nn(this.options.clientId, this.state), this.emit("state", this.getState());
1405
+ ...t.lastError === null && t.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
1406
+ ...t.lastError !== void 0 && t.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
1407
+ }, on(this.options.clientId, this.state), this.emit("state", this.getState());
1405
1408
  }
1406
1409
  emit(t, s) {
1407
1410
  this.listeners[t]?.forEach((r) => r(s));
1408
1411
  }
1409
1412
  }
1410
1413
  const Q = /* @__PURE__ */ new WeakMap();
1411
- function Ze(e) {
1412
- const t = window.__plunoProductAgentNetworkCapture ?? Qe();
1414
+ function Qe(e) {
1415
+ const t = window.__plunoProductAgentNetworkCapture ?? ts();
1413
1416
  return t.subscribers.add(e), () => {
1414
1417
  t.subscribers.delete(e), !(t.subscribers.size > 0) && (t.destroy(), window.__plunoProductAgentNetworkCapture === t && delete window.__plunoProductAgentNetworkCapture);
1415
1418
  };
1416
1419
  }
1417
- function Qe() {
1420
+ function ts() {
1418
1421
  const e = /* @__PURE__ */ new Set(), t = (T) => {
1419
1422
  e.forEach((p) => {
1420
1423
  try {
@@ -1431,31 +1434,31 @@ function Qe() {
1431
1434
  throw m;
1432
1435
  }
1433
1436
  try {
1434
- const m = p instanceof Request ? p : null, g = Tn(p, m), A = ee(d?.headers ?? m?.headers);
1435
- if (!b(g, A, d?.body)) {
1437
+ const m = p instanceof Request ? p : null, g = In(p, m), A = se(d?.headers ?? m?.headers);
1438
+ if (!M(g, A, d?.body)) {
1436
1439
  const K = {
1437
1440
  requestId: tt("fetch"),
1438
- url: E(g, Z),
1441
+ url: _(g, Z),
1439
1442
  method: (d?.method ?? m?.method ?? "GET").toUpperCase(),
1440
1443
  requestHeaders: A,
1441
- requestBody: Bt(d?.body),
1444
+ requestBody: qt(d?.body),
1442
1445
  resourceType: "fetch",
1443
1446
  startedAt: new Date(f).toISOString()
1444
1447
  };
1445
1448
  w.then(
1446
- (_) => {
1447
- wn(_, K, f, t).catch(() => {
1449
+ (b) => {
1450
+ An(b, K, f, t).catch(() => {
1448
1451
  t({
1449
1452
  ...K,
1450
- responseStatus: _.status,
1453
+ responseStatus: b.status,
1451
1454
  durationMs: Date.now() - f
1452
1455
  });
1453
1456
  });
1454
1457
  },
1455
- (_) => {
1458
+ (b) => {
1456
1459
  t({
1457
1460
  ...K,
1458
- errorText: E(_ instanceof Error ? _.message : String(_)),
1461
+ errorText: _(b instanceof Error ? b.message : String(b)),
1459
1462
  durationMs: Date.now() - f
1460
1463
  });
1461
1464
  }
@@ -1469,24 +1472,24 @@ function Qe() {
1469
1472
  return Q.set(this, {
1470
1473
  requestId: tt("xhr"),
1471
1474
  method: String(p ?? "GET").toUpperCase(),
1472
- url: E(A, Z),
1475
+ url: _(A, Z),
1473
1476
  requestHeaders: {},
1474
1477
  startedAtMs: Date.now(),
1475
1478
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
1476
- excluded: b(A)
1479
+ excluded: M(A)
1477
1480
  }), g;
1478
1481
  }, u = function(p, d) {
1479
1482
  const f = r.call(this, p, d), w = Q.get(this);
1480
- return w && Object.keys(w.requestHeaders).length < ft && (w.requestHeaders[p] = At(p, d), w.excluded = w.excluded || b(w.url, w.requestHeaders)), f;
1483
+ return w && Object.keys(w.requestHeaders).length < ft && (w.requestHeaders[p] = At(p, d), w.excluded = w.excluded || M(w.url, w.requestHeaders)), f;
1481
1484
  }, l = function(p) {
1482
1485
  try {
1483
1486
  const d = Q.get(this);
1484
- d && (d.excluded = d.excluded || b(d.url, d.requestHeaders, p), d.requestBody = Bt(p), d.excluded || this.addEventListener(
1487
+ d && (d.excluded = d.excluded || M(d.url, d.requestHeaders, p), d.requestBody = qt(p), d.excluded || this.addEventListener(
1485
1488
  "loadend",
1486
1489
  () => {
1487
1490
  queueMicrotask(() => {
1488
1491
  try {
1489
- const f = Rn(this.getAllResponseHeaders());
1492
+ const f = Cn(this.getAllResponseHeaders());
1490
1493
  t({
1491
1494
  requestId: d.requestId,
1492
1495
  url: d.url,
@@ -1496,7 +1499,7 @@ function Qe() {
1496
1499
  resourceType: "xhr",
1497
1500
  responseStatus: this.status,
1498
1501
  responseHeaders: f,
1499
- responseBody: An(this, f),
1502
+ responseBody: kn(this, f),
1500
1503
  errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
1501
1504
  startedAt: d.startedAt,
1502
1505
  durationMs: Date.now() - d.startedAtMs
@@ -1533,12 +1536,12 @@ function Qe() {
1533
1536
  a = new PerformanceObserver((T) => {
1534
1537
  for (const p of T.getEntries()) {
1535
1538
  const d = p;
1536
- if (d.initiatorType === "fetch" || d.initiatorType === "xmlhttprequest" || b(d.name))
1539
+ if (d.initiatorType === "fetch" || d.initiatorType === "xmlhttprequest" || M(d.name))
1537
1540
  continue;
1538
1541
  const f = performance.timeOrigin + d.startTime;
1539
1542
  t({
1540
1543
  requestId: tt("resource"),
1541
- url: E(d.name, Z),
1544
+ url: _(d.name, Z),
1542
1545
  method: "GET",
1543
1546
  resourceType: "resource",
1544
1547
  responseStatus: d.responseStatus,
@@ -1588,15 +1591,15 @@ function y(e, t, s) {
1588
1591
  }, i = n.__plunoProductAgentDiagnostics__ ?? [];
1589
1592
  i.push(r), i.length > 120 && i.splice(0, i.length - 120), n.__plunoProductAgentDiagnostics__ = i, n.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent("product-agent:preview-diagnostic", { detail: r }));
1590
1593
  }
1591
- function _t(e) {
1594
+ function Ct(e) {
1592
1595
  const t = typeof e == "function" ? e() : e;
1593
1596
  return t && Object.keys(t).length > 0 ? t : void 0;
1594
1597
  }
1595
- function ts(e) {
1598
+ function es(e) {
1596
1599
  return e.type === "conversation.state" || e.type === "session.updated" || e.type === "session.item" || e.type === "chat.assistant_delta" || e.type === "chat.assistant_done" || e.type === "tool.call";
1597
1600
  }
1598
- const es = 5e3, ss = 12e4;
1599
- function ns(e) {
1601
+ const ss = 5e3, ns = 12e4;
1602
+ function rs(e) {
1600
1603
  const t = [];
1601
1604
  for (const s of e)
1602
1605
  s.role !== "user" || !s.attachments?.length || s.attachments.forEach((n, r) => {
@@ -1607,17 +1610,17 @@ function ns(e) {
1607
1610
  });
1608
1611
  return t;
1609
1612
  }
1610
- function rs(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
1613
+ function is(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
1611
1614
  const n = [
1612
- is(e, t, s),
1613
- os()
1615
+ os(e, t, s),
1616
+ as()
1614
1617
  ].filter((r) => typeof r == "function");
1615
1618
  return () => {
1616
1619
  for (const r of n.reverse())
1617
1620
  r();
1618
1621
  };
1619
1622
  }
1620
- function is(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
1623
+ function os(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
1621
1624
  const n = new Map(e.map((l) => [l.id, l])), r = (l) => ({
1622
1625
  id: l.id,
1623
1626
  name: l.name,
@@ -1637,7 +1640,7 @@ function is(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
1637
1640
  const T = s.get(a.id);
1638
1641
  if (T)
1639
1642
  return T;
1640
- const p = await ue(a.id).then((m) => m?.blob ?? null).catch((m) => (y("web-sdk.attachments", "Failed to load Product Agent attachment from IndexedDB", {
1643
+ const p = await de(a.id).then((m) => m?.blob ?? null).catch((m) => (y("web-sdk.attachments", "Failed to load Product Agent attachment from IndexedDB", {
1641
1644
  attachmentId: a.id,
1642
1645
  name: a.name,
1643
1646
  message: m instanceof Error ? m.message : String(m)
@@ -1646,13 +1649,13 @@ function is(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
1646
1649
  return s.set(a.id, p), p;
1647
1650
  if (!a.fileUrl)
1648
1651
  throw new Error(`Pluno user file is missing content: ${l}`);
1649
- const d = await fetch(a.fileUrl, hn(a.fileUrl));
1652
+ const d = await fetch(a.fileUrl, fn(a.fileUrl));
1650
1653
  if (!d.ok)
1651
1654
  throw new Error(`Failed to load Pluno user file: ${l}`);
1652
1655
  const f = await d.blob();
1653
1656
  s.set(a.id, f);
1654
1657
  const w = Date.now();
1655
- return xt({
1658
+ return Ft({
1656
1659
  attachmentId: a.id,
1657
1660
  name: a.name,
1658
1661
  mimeType: a.mimeType,
@@ -1670,7 +1673,7 @@ function is(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
1670
1673
  });
1671
1674
  }), f;
1672
1675
  };
1673
- return Wt(globalThis, "userFiles", {
1676
+ return jt(globalThis, "userFiles", {
1674
1677
  list: () => e.map(r),
1675
1678
  get: (l) => {
1676
1679
  const a = n.get(l);
@@ -1681,7 +1684,7 @@ function is(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
1681
1684
  if (!T.startsWith("image/"))
1682
1685
  throw new Error(`Pluno user file is not an image: ${l}`);
1683
1686
  const p = h.type === T ? h : new Blob([h], { type: T });
1684
- return ps(T, p.size) > Xe ? {
1687
+ return fs(T, p.size) > Ke ? {
1685
1688
  type: "pluno.userFiles.inspectImage",
1686
1689
  id: a.id,
1687
1690
  name: a.name,
@@ -1708,13 +1711,13 @@ function is(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
1708
1711
  }
1709
1712
  });
1710
1713
  }
1711
- function os() {
1712
- return Wt(globalThis, "pageImages", {
1713
- inspectImage: async (t, s) => await as(t, s)
1714
+ function as() {
1715
+ return jt(globalThis, "pageImages", {
1716
+ inspectImage: async (t, s) => await cs(t, s)
1714
1717
  });
1715
1718
  }
1716
- async function as(e, t = {}) {
1717
- const s = ds(t.name), n = await cs(e);
1719
+ async function cs(e, t = {}) {
1720
+ const s = hs(t.name), n = await ls(e);
1718
1721
  return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
1719
1722
  type: "pluno.pageImages.inspectImage",
1720
1723
  imageAttached: !1,
@@ -1732,15 +1735,15 @@ async function as(e, t = {}) {
1732
1735
  imageAttachmentError: n.error
1733
1736
  };
1734
1737
  }
1735
- async function cs(e) {
1738
+ async function ls(e) {
1736
1739
  return e instanceof Blob ? e.type.startsWith("image/") ? e.size === 0 ? { ok: !1, error: "Page image is empty." } : e.size > 8 * 1024 * 1024 ? { ok: !1, error: gt } : {
1737
1740
  ok: !0,
1738
1741
  mimeType: e.type,
1739
1742
  sizeBytes: e.size,
1740
1743
  dataUrl: await ot(e)
1741
- } : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof e != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : ls(e);
1744
+ } : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof e != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : us(e);
1742
1745
  }
1743
- function ls(e) {
1746
+ function us(e) {
1744
1747
  if (!e.startsWith("data:") || !e.includes(","))
1745
1748
  return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
1746
1749
  const [t, s] = e.slice(5).split(",", 2), n = t.split(";").map((c) => c.trim()).filter(Boolean), r = n[0] ?? "";
@@ -1751,7 +1754,7 @@ function ls(e) {
1751
1754
  const i = s.replace(/[ \t\r\n\f]+/g, "");
1752
1755
  if (!/^[A-Za-z0-9+/]*={0,2}$/.test(i))
1753
1756
  return { ok: !1, error: "Page image data URL has invalid base64." };
1754
- const o = us(i);
1757
+ const o = ds(i);
1755
1758
  return o === null ? { ok: !1, error: "Page image data URL has invalid base64." } : o === 0 ? { ok: !1, error: "Page image is empty." } : {
1756
1759
  ok: !0,
1757
1760
  mimeType: r,
@@ -1759,16 +1762,16 @@ function ls(e) {
1759
1762
  dataUrl: `data:${r};base64,${i}`
1760
1763
  };
1761
1764
  }
1762
- function us(e) {
1765
+ function ds(e) {
1763
1766
  if (e.length === 0 || e.length % 4 !== 0)
1764
1767
  return null;
1765
1768
  const t = e.length - e.replace(/=+$/, "").length;
1766
1769
  return t > 2 ? null : e.length / 4 * 3 - t;
1767
1770
  }
1768
- function ds(e) {
1771
+ function hs(e) {
1769
1772
  return (typeof e == "string" ? e.trim() : "") || "Page image";
1770
1773
  }
1771
- function hs(e) {
1774
+ function ps(e) {
1772
1775
  try {
1773
1776
  e();
1774
1777
  } catch {
@@ -1786,12 +1789,12 @@ function ot(e) {
1786
1789
  }, n.onerror = () => s(n.error ?? new Error("Failed to read Pluno user file")), n.readAsDataURL(e);
1787
1790
  });
1788
1791
  }
1789
- function ps(e, t) {
1792
+ function fs(e, t) {
1790
1793
  return `data:${e};base64,`.length + Math.ceil(t / 3) * 4;
1791
1794
  }
1792
1795
  async function bt(e) {
1793
1796
  const t = Object.getPrototypeOf(async function() {
1794
- }).constructor, s = e.timeoutMs ?? es, n = Date.now(), r = [];
1797
+ }).constructor, s = e.timeoutMs ?? ss, n = Date.now(), r = [];
1795
1798
  let i;
1796
1799
  const o = {
1797
1800
  log: console.log,
@@ -1809,7 +1812,7 @@ async function bt(e) {
1809
1812
  i = window.setTimeout(() => a(u), s);
1810
1813
  })
1811
1814
  ]);
1812
- return l === u ? fs(s) : {
1815
+ return l === u ? gs(s) : {
1813
1816
  ok: !0,
1814
1817
  result: l,
1815
1818
  console: r,
@@ -1838,7 +1841,7 @@ async function bt(e) {
1838
1841
  i !== void 0 && window.clearTimeout(i), console.log = o.log, console.info = o.info, console.warn = o.warn, console.error = o.error;
1839
1842
  }
1840
1843
  }
1841
- function fs(e) {
1844
+ function gs(e) {
1842
1845
  return {
1843
1846
  ok: !1,
1844
1847
  exception: {
@@ -1852,18 +1855,18 @@ function fs(e) {
1852
1855
  }
1853
1856
  };
1854
1857
  }
1855
- function gs(e) {
1858
+ function ms(e) {
1856
1859
  return e.replace(/\/+$/, "");
1857
1860
  }
1858
- function ms(e, t = location.origin) {
1861
+ function ys(e, t = location.origin) {
1859
1862
  return /origin (?:is not allowed|does not match browser origin)/i.test(e) ? `Pluno widget blocked on ${t}: this domain is not allowed. Add ${t} in Pluno under Integration > Domains.` : null;
1860
1863
  }
1861
- function ys(e) {
1864
+ function Ts(e) {
1862
1865
  const t = new URL("/api/product-agent/embed/ws", e);
1863
1866
  return t.protocol = t.protocol === "https:" ? "wss:" : "ws:", t.toString();
1864
1867
  }
1865
1868
  function S() {
1866
- const e = Xt();
1869
+ const e = Kt();
1867
1870
  return {
1868
1871
  url: location.href,
1869
1872
  title: document.title,
@@ -1871,19 +1874,19 @@ function S() {
1871
1874
  ...e ? { plunoProductAgentUi: e } : {}
1872
1875
  };
1873
1876
  }
1874
- function Ts() {
1877
+ function ws() {
1875
1878
  return {
1876
1879
  pageUrl: location.href,
1877
1880
  pageTitle: document.title,
1878
- htmlContent: Ss()
1881
+ htmlContent: ks()
1879
1882
  };
1880
1883
  }
1881
- function ws(e) {
1882
- return x.add(e), L || (L = Is()), () => {
1884
+ function Is(e) {
1885
+ return x.add(e), L || (L = As()), () => {
1883
1886
  x.delete(e), x.size === 0 && (L?.(), L = null);
1884
1887
  };
1885
1888
  }
1886
- function Is() {
1889
+ function As() {
1887
1890
  const e = () => {
1888
1891
  for (const i of Array.from(x))
1889
1892
  i();
@@ -1898,10 +1901,10 @@ function Is() {
1898
1901
  window.history.pushState === n && (window.history.pushState = t), window.history.replaceState === r && (window.history.replaceState = s), window.removeEventListener("popstate", e), window.removeEventListener("hashchange", e);
1899
1902
  };
1900
1903
  }
1901
- function As() {
1902
- return Xt()?.surface === "browser_extension_sdk_preview";
1903
- }
1904
1904
  function Ss() {
1905
+ return Kt()?.surface === "browser_extension_sdk_preview";
1906
+ }
1907
+ function ks() {
1905
1908
  const e = document.body?.cloneNode(!0);
1906
1909
  return e instanceof HTMLElement ? (e.querySelectorAll(
1907
1910
  [
@@ -1925,7 +1928,7 @@ function Ss() {
1925
1928
  s.name === "href" || s.name === "aria-label" || s.name === "role" || t.removeAttribute(s.name);
1926
1929
  }), e.textContent?.replace(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/gi, "[email]").replace(/\b(?:\d[ -]*?){13,19}\b/g, "[number]").replace(/\b(?:sk|pk|tok|key|secret|token)_[A-Za-z0-9_-]{8,}\b/gi, "[secret]").replace(/\s+/g, " ").trim().slice(0, 12e3) ?? "") : "";
1927
1930
  }
1928
- function Xt() {
1931
+ function Kt() {
1929
1932
  const e = document.querySelector(St);
1930
1933
  if (!(e ?? document.querySelector(rt)))
1931
1934
  return;
@@ -1946,18 +1949,18 @@ function Xt() {
1946
1949
  },
1947
1950
  {
1948
1951
  name: "widget_panel",
1949
- selector: _e,
1952
+ selector: be,
1950
1953
  description: "Finds Pluno's open chat panel inside the widget host shadow root."
1951
1954
  },
1952
1955
  {
1953
1956
  name: "widget_timeline",
1954
- selector: be,
1957
+ selector: Me,
1955
1958
  description: "Finds Pluno's chat timeline inside the widget host shadow root."
1956
1959
  }
1957
1960
  ]
1958
1961
  };
1959
1962
  }
1960
- function ks(e) {
1963
+ function Es(e) {
1961
1964
  try {
1962
1965
  const t = JSON.parse(e);
1963
1966
  return t && typeof t == "object" ? t : { type: "error", message: "Invalid server event" };
@@ -1971,7 +1974,7 @@ function Mt(e, t) {
1971
1974
  const s = e[t];
1972
1975
  return Array.isArray(s) ? s.filter((n) => typeof n == "string" && n.trim().length > 0) : [];
1973
1976
  }
1974
- function Es(e) {
1977
+ function _s(e) {
1975
1978
  return Array.isArray(e) ? e.filter((t) => typeof t == "string" && t.trim().length > 0) : [];
1976
1979
  }
1977
1980
  function Rs(e) {
@@ -1991,7 +1994,7 @@ function Cs(e) {
1991
1994
  const t = e.javascript;
1992
1995
  return typeof t != "string" || !t.trim() ? null : { javascript: t };
1993
1996
  }
1994
- function _s(e, t) {
1997
+ function bs(e, t) {
1995
1998
  return t ? e && typeof e == "object" ? {
1996
1999
  ...e,
1997
2000
  helperError: t
@@ -2001,13 +2004,13 @@ function _s(e, t) {
2001
2004
  helperError: t
2002
2005
  } : e;
2003
2006
  }
2004
- function bs(e) {
2007
+ function Ms(e) {
2005
2008
  if (!e || typeof e != "object")
2006
2009
  return e;
2007
2010
  const t = e;
2008
2011
  return typeof t.exception?.message == "string" ? t.exception.message : typeof t.error == "string" ? t.error : e;
2009
2012
  }
2010
- function Ms() {
2013
+ function Us() {
2011
2014
  const e = "pluno.productAgent.clientId", t = window.localStorage.getItem(e);
2012
2015
  if (t)
2013
2016
  return t;
@@ -2028,14 +2031,14 @@ function Ps(e) {
2028
2031
  avatarUrl: typeof t.avatarUrl == "string" ? t.avatarUrl : null
2029
2032
  } : null;
2030
2033
  }
2031
- function Us(e, t) {
2034
+ function Ds(e, t) {
2032
2035
  return Array.isArray(e) ? lt(
2033
2036
  ut(
2034
- e.map((s) => Kt(s, t)).filter((s) => s !== null)
2037
+ e.map((s) => Jt(s, t)).filter((s) => s !== null)
2035
2038
  )
2036
2039
  ) : [];
2037
2040
  }
2038
- function Ds(e) {
2041
+ function vs(e) {
2039
2042
  return Array.isArray(e) ? e.flatMap((t) => {
2040
2043
  if (!t || typeof t != "object")
2041
2044
  return [];
@@ -2054,7 +2057,7 @@ function Ds(e) {
2054
2057
  ];
2055
2058
  }) : [];
2056
2059
  }
2057
- function Kt(e, t) {
2060
+ function Jt(e, t) {
2058
2061
  if (!e || typeof e != "object")
2059
2062
  return null;
2060
2063
  const s = e, n = s.data;
@@ -2064,47 +2067,86 @@ function Kt(e, t) {
2064
2067
  if (r.type === "tab_lifecycle_decision" && r.decision === "keep")
2065
2068
  return null;
2066
2069
  if (r.type === "message") {
2070
+ if (r.hiddenFromTranscript === !0)
2071
+ return null;
2067
2072
  const i = r.role === "assistant" ? "assistant" : r.role === "user" ? "user" : "system", o = {
2068
2073
  id: String(s.id ?? crypto.randomUUID()),
2069
2074
  role: i,
2070
- content: Bs(r.content),
2075
+ content: xs(r.content),
2071
2076
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
2072
- respondsToUserMessageId: M(r) ?? void 0,
2073
- ...C(r) ? { runId: C(r) } : {},
2074
- attachments: Qt(r.attachments, t)
2077
+ respondsToUserMessageId: C(r) ?? void 0,
2078
+ ...E(r) ? { runId: E(r) } : {},
2079
+ attachments: te(r.attachments, t)
2075
2080
  };
2076
2081
  return typeof r.clientMessageId == "string" && Object.defineProperty(o, "clientMessageId", {
2077
2082
  value: r.clientMessageId,
2078
2083
  enumerable: !1
2079
2084
  }), o;
2080
2085
  }
2081
- return r.type === "function_call" || r.type === "tool_call" || r.type === "web_search_call" || r.type === "tab_lifecycle_decision" ? {
2086
+ if (r.type === "function_call_output") {
2087
+ const i = Os(r.output);
2088
+ return i ? {
2089
+ id: String(s.id ?? crypto.randomUUID()),
2090
+ role: "tool",
2091
+ content: `Connect ${i.appName} to continue`,
2092
+ createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
2093
+ respondsToUserMessageId: C(r) ?? void 0,
2094
+ ...E(r) ? { runId: E(r) } : {},
2095
+ dataType: "function_call_output",
2096
+ toolName: "authenticate_pipedream_app",
2097
+ callId: Ut(r) ?? void 0,
2098
+ integrationAuthRequest: i
2099
+ } : null;
2100
+ }
2101
+ return r.type === "function_call" || r.type === "tool_call" || r.type === "web_search_call" || r.type === "mcp_call" || r.type === "tab_lifecycle_decision" ? {
2082
2102
  id: String(s.id ?? crypto.randomUUID()),
2083
2103
  role: "tool",
2084
- content: Ns(r),
2104
+ content: r.type === "mcp_call" ? Ns(r) : Bs(r),
2085
2105
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
2086
- respondsToUserMessageId: M(r) ?? void 0,
2087
- ...C(r) ? { runId: C(r) } : {},
2106
+ respondsToUserMessageId: C(r) ?? void 0,
2107
+ ...E(r) ? { runId: E(r) } : {},
2088
2108
  dataType: String(r.type),
2089
2109
  toolName: r.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof r.name == "string" ? r.name : void 0,
2090
- callId: Ls(r) ?? void 0,
2110
+ callId: Ut(r) ?? void 0,
2091
2111
  loading: r.localExecutionStatus === "running"
2092
2112
  } : r.type === "run_status" || r.type === "run_error" ? r.type === "run_error" && r.stage === "tool_execution" ? null : {
2093
2113
  id: String(s.id ?? crypto.randomUUID()),
2094
2114
  role: "system",
2095
- content: vs(r),
2115
+ content: Ls(r),
2096
2116
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
2097
- respondsToUserMessageId: M(r) ?? void 0,
2098
- ...C(r) ? { runId: C(r) } : {},
2117
+ respondsToUserMessageId: C(r) ?? void 0,
2118
+ ...E(r) ? { runId: E(r) } : {},
2099
2119
  dataType: String(r.type),
2100
2120
  loading: r.type === "run_status" && (r.status === "running" || r.status === "retrying"),
2101
- ...typeof r.retryable == "boolean" ? { retryable: r.retryable } : {}
2121
+ ...typeof r.retryable == "boolean" ? { retryable: r.retryable } : {},
2122
+ ...typeof r.securitySettingsUrl == "string" ? { securitySettingsUrl: r.securitySettingsUrl } : {}
2102
2123
  } : null;
2103
2124
  }
2104
- function vs(e) {
2125
+ function Ns(e) {
2126
+ const s = (typeof e.server_label == "string" ? e.server_label : "").replace(/^pipedream_/, "").split(/[_-]+/).filter(Boolean).map((n) => `${n.charAt(0).toUpperCase()}${n.slice(1)}`).join(" ");
2127
+ return s ? `Using ${s}` : "Using connected integration";
2128
+ }
2129
+ function Os(e) {
2130
+ if (typeof e != "string")
2131
+ return null;
2132
+ try {
2133
+ const t = JSON.parse(e);
2134
+ return t.type !== "pipedream_auth_required" || typeof t.authRequestId != "string" || typeof t.appSlug != "string" || typeof t.appName != "string" || typeof t.expiresAt != "string" ? null : {
2135
+ type: "pipedream_auth_required",
2136
+ authRequestId: t.authRequestId,
2137
+ appSlug: t.appSlug,
2138
+ appName: t.appName,
2139
+ appLogo: typeof t.appLogo == "string" ? t.appLogo : null,
2140
+ expiresAt: t.expiresAt
2141
+ };
2142
+ } catch {
2143
+ return null;
2144
+ }
2145
+ }
2146
+ function Ls(e) {
2105
2147
  return typeof e.message == "string" && e.message.trim().length > 0 ? e.message.replace(/Product Agent/g, "Pluno") : e.type === "run_status" && e.status === "interrupted" ? "Pluno was interrupted before it could finish this message." : e.type === "run_status" && e.status === "stopped" ? "Pluno stopped." : "Pluno run status changed.";
2106
2148
  }
2107
- function Ns(e) {
2149
+ function Bs(e) {
2108
2150
  if (e.type === "web_search_call") {
2109
2151
  const t = e.action;
2110
2152
  if (t && typeof t == "object") {
@@ -2116,9 +2158,9 @@ function Ns(e) {
2116
2158
  }
2117
2159
  return "Searching the web";
2118
2160
  }
2119
- return Os(e);
2161
+ return qs(e);
2120
2162
  }
2121
- function Os(e) {
2163
+ function qs(e) {
2122
2164
  if (typeof e.summary == "string" && e.summary.trim().length > 0)
2123
2165
  return e.summary;
2124
2166
  if (typeof e.arguments == "string")
@@ -2131,11 +2173,11 @@ function Os(e) {
2131
2173
  }
2132
2174
  return typeof e.name == "string" && e.name.trim().length > 0 ? e.name : "Run tool";
2133
2175
  }
2134
- function Ls(e) {
2176
+ function Ut(e) {
2135
2177
  const t = e.callId ?? e.call_id;
2136
2178
  return typeof t == "string" && t ? t : null;
2137
2179
  }
2138
- function Bs(e) {
2180
+ function xs(e) {
2139
2181
  return typeof e == "string" ? e : Array.isArray(e) ? e.map((t) => {
2140
2182
  if (!t || typeof t != "object")
2141
2183
  return "";
@@ -2143,8 +2185,8 @@ function Bs(e) {
2143
2185
  return typeof s.text == "string" ? s.text : typeof s.content == "string" ? s.content : "";
2144
2186
  }).filter(Boolean).join("") : "";
2145
2187
  }
2146
- function qs(e, t) {
2147
- const s = Jt(e, t), n = Ws(e, t), r = n.findIndex((o) => o.id === s.id);
2188
+ function Fs(e, t) {
2189
+ const s = Yt(e, t), n = $s(e, t), r = n.findIndex((o) => o.id === s.id);
2148
2190
  if (r === -1)
2149
2191
  return lt(
2150
2192
  ut([...n, s])
@@ -2152,45 +2194,45 @@ function qs(e, t) {
2152
2194
  const i = [...n];
2153
2195
  return i[r] = s, lt(ut(i));
2154
2196
  }
2155
- function xs(e, t) {
2197
+ function Hs(e, t) {
2156
2198
  const s = t.map(
2157
- (n) => Jt(e, n)
2199
+ (n) => Yt(e, n)
2158
2200
  );
2159
2201
  return t.length > 0 ? s : e.filter(mt);
2160
2202
  }
2161
- function Jt(e, t) {
2203
+ function Yt(e, t) {
2162
2204
  if (t.role !== "user" || !t.attachments?.length)
2163
2205
  return t;
2164
2206
  const s = e.find(
2165
- (r) => r.role === "user" && (r.id === t.id || mt(r) && Yt(r, t))
2207
+ (r) => r.role === "user" && (r.id === t.id || mt(r) && Vt(r, t))
2166
2208
  );
2167
2209
  if (!s?.attachments?.length)
2168
2210
  return t;
2169
2211
  const n = t.attachments.map((r) => {
2170
- const i = Fs(s.attachments ?? [], r);
2171
- return i ? Hs(r, i) : r;
2212
+ const i = Ws(s.attachments ?? [], r);
2213
+ return i ? js(r, i) : r;
2172
2214
  });
2173
2215
  return { ...t, attachments: n };
2174
2216
  }
2175
- function Fs(e, t) {
2217
+ function Ws(e, t) {
2176
2218
  return t.id ? e.find((s) => s.id === t.id) ?? null : null;
2177
2219
  }
2178
- function Hs(e, t) {
2220
+ function js(e, t) {
2179
2221
  const { previewUrl: s } = t;
2180
2222
  return s ? { ...e, previewUrl: s } : e;
2181
2223
  }
2182
- function Ws(e, t) {
2224
+ function $s(e, t) {
2183
2225
  if (t.role !== "user")
2184
2226
  return e;
2185
2227
  const s = e.findIndex(
2186
- (r) => mt(r) && Yt(r, t)
2228
+ (r) => mt(r) && Vt(r, t)
2187
2229
  );
2188
2230
  if (s === -1)
2189
2231
  return e;
2190
2232
  const n = [...e];
2191
2233
  return n.splice(s, 1), n;
2192
2234
  }
2193
- function Yt(e, t) {
2235
+ function Vt(e, t) {
2194
2236
  const s = Pt(e), n = Pt(t);
2195
2237
  return s && n ? s === n : e.content === t.content;
2196
2238
  }
@@ -2206,8 +2248,8 @@ function Pt(e) {
2206
2248
  );
2207
2249
  return n ? e.id.slice(n.length) : null;
2208
2250
  }
2209
- function Ut(e) {
2210
- const t = Vt(e);
2251
+ function Dt(e) {
2252
+ const t = Zt(e);
2211
2253
  if (t === null)
2212
2254
  return !1;
2213
2255
  for (let s = e.length - 1; s > t; s -= 1) {
@@ -2223,17 +2265,17 @@ function Ut(e) {
2223
2265
  }
2224
2266
  return !1;
2225
2267
  }
2226
- function js(e) {
2227
- const t = Vt(e);
2268
+ function zs(e) {
2269
+ const t = Zt(e);
2228
2270
  return t === null ? e.some((s) => s.role === "assistant") : e.slice(t + 1).some((s) => s.role === "assistant");
2229
2271
  }
2230
- function Vt(e) {
2272
+ function Zt(e) {
2231
2273
  for (let t = e.length - 1; t >= 0; t -= 1)
2232
2274
  if (e[t].role === "user")
2233
2275
  return t;
2234
2276
  return null;
2235
2277
  }
2236
- function $s(e) {
2278
+ function Gs(e) {
2237
2279
  return e.role === "assistant" ? !0 : e.role !== "system" ? !1 : e.dataType === "run_error" ? !0 : e.dataType === "run_status" && e.loading !== !0;
2238
2280
  }
2239
2281
  function yt(e) {
@@ -2259,10 +2301,10 @@ function v(e) {
2259
2301
  function at(e) {
2260
2302
  return e?.retryable !== !0 ? !1 : e.type === "run_error" ? !0 : e.type === "run_status" && e.status === "interrupted";
2261
2303
  }
2262
- function Dt(e) {
2304
+ function vt(e) {
2263
2305
  return e?.type === "run_status" && e.status === "interrupted" && e.reason === "backend_restart";
2264
2306
  }
2265
- function zs(e, t) {
2307
+ function Xs(e, t) {
2266
2308
  const s = yt(t);
2267
2309
  if (s === null)
2268
2310
  return !1;
@@ -2270,7 +2312,7 @@ function zs(e, t) {
2270
2312
  if (typeof r != "string" || !r)
2271
2313
  return !1;
2272
2314
  const i = e.findIndex((o) => o.role === "user" && o.id === r);
2273
- return i === -1 ? !1 : e.slice(i + 1).some($s);
2315
+ return i === -1 ? !1 : e.slice(i + 1).some(Gs);
2274
2316
  }
2275
2317
  function ct(e) {
2276
2318
  const t = yt(e);
@@ -2285,7 +2327,7 @@ function ct(e) {
2285
2327
  const r = n.clientMessageId;
2286
2328
  return typeof r == "string" ? r : null;
2287
2329
  }
2288
- function Gs(e) {
2330
+ function Ks(e) {
2289
2331
  const t = yt(e);
2290
2332
  if (t === null)
2291
2333
  return null;
@@ -2300,22 +2342,22 @@ function Gs(e) {
2300
2342
  if (i.type === "message" && i.role === "assistant")
2301
2343
  return null;
2302
2344
  if (i.type === "run_error")
2303
- return i.retryable !== !0 ? null : vt(e, i) ?? ct(e);
2345
+ return i.retryable !== !0 ? null : Nt(e, i) ?? ct(e);
2304
2346
  if (i.type === "run_status")
2305
- return i.status === "interrupted" && i.retryable === !0 ? vt(e, i) ?? ct(e) : null;
2347
+ return i.status === "interrupted" && i.retryable === !0 ? Nt(e, i) ?? ct(e) : null;
2306
2348
  }
2307
2349
  return null;
2308
2350
  }
2309
- function vt(e, t) {
2351
+ function Nt(e, t) {
2310
2352
  if (typeof t.clientMessageId == "string")
2311
2353
  return t.clientMessageId;
2312
- const s = M(t);
2354
+ const s = C(t);
2313
2355
  if (!s)
2314
2356
  return null;
2315
2357
  const n = e.find((i) => I(i, "id") === s), r = v(n);
2316
2358
  return r?.type === "message" && r.role === "user" && typeof r.clientMessageId == "string" ? r.clientMessageId : null;
2317
2359
  }
2318
- function Xs(e, t) {
2360
+ function Js(e, t) {
2319
2361
  let s = 0;
2320
2362
  for (const n of e) {
2321
2363
  if (!n || typeof n != "object")
@@ -2328,28 +2370,28 @@ function Xs(e, t) {
2328
2370
  }
2329
2371
  return s;
2330
2372
  }
2331
- function Nt(e, t, s, n) {
2332
- if (!t || !Ks(e))
2373
+ function Ot(e, t, s, n) {
2374
+ if (!t || !Ys(e))
2333
2375
  return !1;
2334
2376
  const r = e;
2335
- return !(at(r) || s !== null && M(r) !== s || n !== null && C(r) !== n);
2377
+ return !(at(r) || s !== null && C(r) !== s || n !== null && E(r) !== n);
2336
2378
  }
2337
- function Ks(e) {
2379
+ function Ys(e) {
2338
2380
  if (!e || typeof e != "object")
2339
2381
  return !1;
2340
2382
  const t = e;
2341
2383
  return t.type === "message" && t.role === "assistant" ? !0 : t.type === "run_error" ? t.stage !== "tool_execution" : t.type === "run_status" && (t.status === "stopped" || t.status === "interrupted");
2342
2384
  }
2343
- function Js(e) {
2385
+ function Vs(e) {
2344
2386
  if (!e || typeof e != "object")
2345
2387
  return !1;
2346
2388
  const t = e;
2347
2389
  return t.type === "message" && t.role === "user" ? !1 : t.type === "message" || t.type === "function_call" || t.type === "function_call_output" || t.type === "run_error" || t.type === "run_status";
2348
2390
  }
2349
2391
  function lt(e) {
2350
- return e.filter((t, s) => Tt(t) ? !en(e, s) && !Qs(e, s) && !tn(e, s) : Ys(t) ? t.retryable === !0 && Zs(e, s) ? !1 : !Vs(e, s) : !0);
2392
+ return e.filter((t, s) => Tt(t) ? !nn(e, s) && !en(e, s) && !sn(e, s) : Zs(t) ? t.retryable === !0 && tn(e, s) ? !1 : !Qs(e, s) : !0);
2351
2393
  }
2352
- function Ys(e) {
2394
+ function Zs(e) {
2353
2395
  return e.role === "system" && (e.dataType === "run_status" || e.dataType === "run_error");
2354
2396
  }
2355
2397
  function Tt(e) {
@@ -2371,7 +2413,7 @@ function ut(e) {
2371
2413
  n.has(i.id) || (r.push(i), i.role === "user" && r.push(...s.get(i.id) ?? []));
2372
2414
  return r;
2373
2415
  }
2374
- function Vs(e, t) {
2416
+ function Qs(e, t) {
2375
2417
  const s = e[t];
2376
2418
  for (let n = t + 1; n < e.length; n += 1) {
2377
2419
  const r = e[n];
@@ -2382,7 +2424,7 @@ function Vs(e, t) {
2382
2424
  }
2383
2425
  return !1;
2384
2426
  }
2385
- function Zs(e, t) {
2427
+ function tn(e, t) {
2386
2428
  const s = e[t];
2387
2429
  if (!s.respondsToUserMessageId)
2388
2430
  return !1;
@@ -2395,21 +2437,21 @@ function Zs(e, t) {
2395
2437
  }
2396
2438
  return !1;
2397
2439
  }
2398
- function Qs(e, t) {
2440
+ function en(e, t) {
2399
2441
  const s = e[t];
2400
2442
  for (let n = t + 1; n < e.length; n += 1)
2401
2443
  if (e[n].role === "assistant" && G(s, e[n]))
2402
2444
  return !0;
2403
2445
  return !1;
2404
2446
  }
2405
- function tn(e, t) {
2447
+ function sn(e, t) {
2406
2448
  const s = e[t];
2407
2449
  for (let n = t + 1; n < e.length; n += 1)
2408
2450
  if (e[n].role === "tool" && G(s, e[n]))
2409
2451
  return !0;
2410
2452
  return !1;
2411
2453
  }
2412
- function en(e, t) {
2454
+ function nn(e, t) {
2413
2455
  const s = e[t];
2414
2456
  for (let n = t + 1; n < e.length; n += 1)
2415
2457
  if (Tt(e[n]) && G(s, e[n]))
@@ -2422,15 +2464,15 @@ function G(e, t) {
2422
2464
  function I(e, t) {
2423
2465
  return e && typeof e == "object" && typeof e[t] == "string" ? e[t] : null;
2424
2466
  }
2425
- function sn(e, t) {
2467
+ function rn(e, t) {
2426
2468
  try {
2427
- const s = window.localStorage.getItem(`${zt}${e}`);
2469
+ const s = window.localStorage.getItem(`${Gt}${e}`);
2428
2470
  if (!s)
2429
2471
  return null;
2430
2472
  const n = JSON.parse(s), r = typeof n.sessionId == "string" ? n.sessionId : null;
2431
2473
  if (t !== void 0 && r !== t)
2432
2474
  return null;
2433
- const i = Array.isArray(n.messages) ? n.messages.map(gn).filter((o) => !!o) : [];
2475
+ const i = Array.isArray(n.messages) ? n.messages.map(yn).filter((o) => !!o) : [];
2434
2476
  return {
2435
2477
  sessionId: r,
2436
2478
  messages: i
@@ -2439,20 +2481,20 @@ function sn(e, t) {
2439
2481
  return null;
2440
2482
  }
2441
2483
  }
2442
- function nn(e, t) {
2484
+ function on(e, t) {
2443
2485
  try {
2444
2486
  window.localStorage.setItem(
2445
- `${zt}${e}`,
2487
+ `${Gt}${e}`,
2446
2488
  JSON.stringify({
2447
2489
  sessionId: t.sessionId,
2448
- messages: t.messages.slice(-Ke).map(mn)
2490
+ messages: t.messages.slice(-Je).map(Tn)
2449
2491
  })
2450
2492
  );
2451
2493
  } catch {
2452
2494
  return;
2453
2495
  }
2454
2496
  }
2455
- function rn(e) {
2497
+ function an(e) {
2456
2498
  try {
2457
2499
  const t = window.localStorage.getItem(`${it}${e}`);
2458
2500
  if (!t)
@@ -2463,7 +2505,7 @@ function rn(e) {
2463
2505
  return [];
2464
2506
  }
2465
2507
  }
2466
- function U(e, t) {
2508
+ function P(e, t) {
2467
2509
  try {
2468
2510
  const s = t.filter(wt);
2469
2511
  if (s.length === 0) {
@@ -2478,7 +2520,7 @@ function U(e, t) {
2478
2520
  return;
2479
2521
  }
2480
2522
  }
2481
- function Zt(e, t) {
2523
+ function Qt(e, t) {
2482
2524
  try {
2483
2525
  const s = `${z}${e}`, n = location.href, r = location.origin, i = Array.from(t, (o) => ({
2484
2526
  ...o,
@@ -2494,28 +2536,28 @@ function Zt(e, t) {
2494
2536
  } catch {
2495
2537
  }
2496
2538
  }
2497
- function on(e, t) {
2539
+ function cn(e, t) {
2498
2540
  try {
2499
2541
  if (window.sessionStorage.getItem(`${z}${e}`) === null)
2500
2542
  return;
2501
2543
  } catch {
2502
2544
  return;
2503
2545
  }
2504
- Zt(e, t);
2546
+ Qt(e, t);
2505
2547
  }
2506
- function an(e) {
2548
+ function ln(e) {
2507
2549
  try {
2508
2550
  const t = `${z}${e}`, s = window.sessionStorage.getItem(t);
2509
2551
  if (window.sessionStorage.removeItem(t), !s)
2510
2552
  return [];
2511
2553
  const n = JSON.parse(s);
2512
- return Array.isArray(n) ? n.flatMap((r) => ln(r) ? [{
2554
+ return Array.isArray(n) ? n.flatMap((r) => dn(r) ? [{
2513
2555
  ...r.event,
2514
2556
  page: S(),
2515
2557
  rawOutput: {
2516
2558
  pageContextRestarted: !0,
2517
2559
  outcome: "unknown",
2518
- message: cn(location.href),
2560
+ message: un(location.href),
2519
2561
  currentUrl: location.href,
2520
2562
  console: [],
2521
2563
  metadata: {
@@ -2532,17 +2574,17 @@ function an(e) {
2532
2574
  return [];
2533
2575
  }
2534
2576
  }
2535
- function cn(e) {
2577
+ function un(e) {
2536
2578
  return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
2537
2579
  Current URL: ${e}`;
2538
2580
  }
2539
- function ln(e) {
2581
+ function dn(e) {
2540
2582
  if (!e || typeof e != "object")
2541
2583
  return !1;
2542
2584
  const t = e, s = t.event;
2543
2585
  return typeof t.startedAtMs == "number" && typeof t.startedAtUrl == "string" && t.startedAtOrigin === location.origin && t.unloadOrigin === location.origin && typeof t.unloadUrl == "string" && wt(s) && s.type === "tool.result";
2544
2586
  }
2545
- function un(e, t) {
2587
+ function hn(e, t) {
2546
2588
  const s = new Set(
2547
2589
  e.flatMap((n) => n.type === "tool.result" ? [n.callId] : [])
2548
2590
  );
@@ -2551,7 +2593,7 @@ function un(e, t) {
2551
2593
  ...t.filter((n) => !s.has(n.callId))
2552
2594
  ];
2553
2595
  }
2554
- function dn(e) {
2596
+ function pn(e) {
2555
2597
  try {
2556
2598
  window.sessionStorage.removeItem(`${z}${e}`);
2557
2599
  } catch {
@@ -2562,15 +2604,15 @@ function wt(e) {
2562
2604
  if (!e || typeof e != "object")
2563
2605
  return !1;
2564
2606
  const t = e;
2565
- return t.type === "chat.user_message" ? typeof t.content == "string" && Ot(t.page) : t.type === "page.upsert" || t.type === "session.reset" || t.type === "network.batch" ? Ot(t.page) : t.type === "tool.result" ? typeof t.sessionId == "string" && typeof t.callId == "string" && t.toolName === "execute_code" : t.type === "chat.retry_last_user_message" ? typeof t.sessionId == "string" && typeof t.clientMessageId == "string" : t.type === "run.stop" ? typeof t.sessionId == "string" && (t.reason === "user_requested" || t.reason === "new_chat" || t.reason === "session_switch") : !1;
2607
+ return t.type === "chat.user_message" ? typeof t.content == "string" && Lt(t.page) : t.type === "page.upsert" || t.type === "session.reset" || t.type === "network.batch" ? Lt(t.page) : t.type === "tool.result" ? typeof t.sessionId == "string" && typeof t.callId == "string" && t.toolName === "execute_code" : t.type === "chat.retry_last_user_message" ? typeof t.sessionId == "string" && typeof t.clientMessageId == "string" : t.type === "run.stop" ? typeof t.sessionId == "string" && (t.reason === "user_requested" || t.reason === "new_chat" || t.reason === "session_switch") : !1;
2566
2608
  }
2567
- function Ot(e) {
2609
+ function Lt(e) {
2568
2610
  if (!e || typeof e != "object")
2569
2611
  return !1;
2570
2612
  const t = e;
2571
2613
  return typeof t.url == "string" && typeof t.title == "string" && typeof t.origin == "string";
2572
2614
  }
2573
- function Qt(e, t) {
2615
+ function te(e, t) {
2574
2616
  if (!Array.isArray(e))
2575
2617
  return;
2576
2618
  const s = e.filter((r) => {
@@ -2578,24 +2620,24 @@ function Qt(e, t) {
2578
2620
  return !1;
2579
2621
  const i = r;
2580
2622
  return typeof i.name == "string" && typeof i.mimeType == "string" && typeof i.sizeBytes == "number";
2581
- }), n = t ? s.map((r) => te(r, t)) : s;
2623
+ }), n = t ? s.map((r) => ee(r, t)) : s;
2582
2624
  return n.length > 0 ? n : void 0;
2583
2625
  }
2584
- function te(e, t) {
2626
+ function ee(e, t) {
2585
2627
  return e.fileUrl?.startsWith("/") ? {
2586
2628
  ...e,
2587
2629
  fileUrl: new URL(e.fileUrl, t).toString()
2588
2630
  } : e;
2589
2631
  }
2590
- function hn(e) {
2591
- if (pn(e))
2632
+ function fn(e) {
2633
+ if (gn(e))
2592
2634
  return {
2593
2635
  headers: {
2594
2636
  "ngrok-skip-browser-warning": "true"
2595
2637
  }
2596
2638
  };
2597
2639
  }
2598
- function pn(e) {
2640
+ function gn(e) {
2599
2641
  try {
2600
2642
  const t = new URL(e).hostname;
2601
2643
  return t.endsWith(".ngrok-free.dev") || t.endsWith(".ngrok-free.app") || t.endsWith(".ngrok.app") || t.endsWith(".ngrok.io");
@@ -2603,14 +2645,14 @@ function pn(e) {
2603
2645
  return !1;
2604
2646
  }
2605
2647
  }
2606
- function Lt(e) {
2607
- return e.type || fn(e.name) || "application/octet-stream";
2648
+ function Bt(e) {
2649
+ return e.type || mn(e.name) || "application/octet-stream";
2608
2650
  }
2609
- function fn(e) {
2651
+ function mn(e) {
2610
2652
  const t = e.toLowerCase();
2611
2653
  return t.endsWith(".png") ? "image/png" : t.endsWith(".jpg") || t.endsWith(".jpeg") ? "image/jpeg" : t.endsWith(".webp") ? "image/webp" : t.endsWith(".gif") ? "image/gif" : t.endsWith(".pdf") ? "application/pdf" : null;
2612
2654
  }
2613
- function gn(e) {
2655
+ function yn(e) {
2614
2656
  if (!e || typeof e != "object")
2615
2657
  return null;
2616
2658
  const t = e;
@@ -2622,11 +2664,12 @@ function gn(e) {
2622
2664
  respondsToUserMessageId: typeof t.respondsToUserMessageId == "string" ? t.respondsToUserMessageId : void 0,
2623
2665
  ...typeof t.runId == "string" ? { runId: t.runId } : {},
2624
2666
  dataType: typeof t.dataType == "string" ? t.dataType : void 0,
2625
- attachments: Qt(t.attachments)?.map(It),
2667
+ securitySettingsUrl: typeof t.securitySettingsUrl == "string" ? t.securitySettingsUrl : void 0,
2668
+ attachments: te(t.attachments)?.map(It),
2626
2669
  loading: typeof t.loading == "boolean" ? t.loading : void 0
2627
2670
  };
2628
2671
  }
2629
- function mn(e) {
2672
+ function Tn(e) {
2630
2673
  return e.attachments?.length ? {
2631
2674
  ...e,
2632
2675
  attachments: e.attachments.map(It)
@@ -2641,19 +2684,19 @@ function It(e) {
2641
2684
  } = e;
2642
2685
  return r;
2643
2686
  }
2644
- function M(e) {
2687
+ function C(e) {
2645
2688
  const t = e.respondsToUserMessageId;
2646
2689
  return typeof t == "string" && t ? t : null;
2647
2690
  }
2648
- function C(e) {
2691
+ function E(e) {
2649
2692
  const t = e.runId;
2650
2693
  return typeof t == "string" && t ? t : null;
2651
2694
  }
2652
- function yn(e) {
2695
+ function wn(e) {
2653
2696
  const t = e?.timeoutMs;
2654
- return !!e && typeof e == "object" && typeof e.summary == "string" && typeof e.javascript == "string" && (t === void 0 || typeof t == "number" && Number.isInteger(t) && t > 0 && t <= ss);
2697
+ return !!e && typeof e == "object" && typeof e.summary == "string" && typeof e.javascript == "string" && (t === void 0 || typeof t == "number" && Number.isInteger(t) && t > 0 && t <= ns);
2655
2698
  }
2656
- function ee(e) {
2699
+ function se(e) {
2657
2700
  const t = {};
2658
2701
  try {
2659
2702
  new Headers(e).forEach((s, n) => {
@@ -2665,23 +2708,23 @@ function ee(e) {
2665
2708
  return t;
2666
2709
  }
2667
2710
  function At(e, t) {
2668
- return ae(e) ? X : E(j(t), ze);
2711
+ return ce(e) ? X : _(j(t), Ge);
2669
2712
  }
2670
- function Tn(e, t) {
2713
+ function In(e, t) {
2671
2714
  return typeof e == "string" ? e : e instanceof URL ? e.toString() : t?.url ?? "";
2672
2715
  }
2673
- async function wn(e, t, s, n) {
2674
- const r = ee(e.headers);
2716
+ async function An(e, t, s, n) {
2717
+ const r = se(e.headers);
2675
2718
  n({
2676
2719
  ...t,
2677
2720
  responseStatus: e.status,
2678
2721
  responseHeaders: r,
2679
- responseBody: await In(e),
2722
+ responseBody: await Sn(e),
2680
2723
  durationMs: Date.now() - s
2681
2724
  });
2682
2725
  }
2683
- async function In(e) {
2684
- if (!se(e.headers))
2726
+ async function Sn(e) {
2727
+ if (!ne(e.headers))
2685
2728
  return;
2686
2729
  let t = null, s = null;
2687
2730
  try {
@@ -2690,7 +2733,7 @@ async function In(e) {
2690
2733
  const n = new Promise((c) => {
2691
2734
  s = window.setTimeout(() => {
2692
2735
  t?.cancel(), c("timeout");
2693
- }, Ge);
2736
+ }, Xe);
2694
2737
  }), r = new TextDecoder();
2695
2738
  let i = "", o = 0;
2696
2739
  for (; ; ) {
@@ -2699,10 +2742,10 @@ async function In(e) {
2699
2742
  return;
2700
2743
  const { done: u, value: l } = c;
2701
2744
  if (u)
2702
- return E(i + r.decode());
2745
+ return _(i + r.decode());
2703
2746
  const a = pt - o;
2704
2747
  if (l.byteLength > a)
2705
- return i += r.decode(l.subarray(0, Math.max(a, 0)), { stream: !0 }), t.cancel(), `${E(i)}... [truncated]`;
2748
+ return i += r.decode(l.subarray(0, Math.max(a, 0)), { stream: !0 }), t.cancel(), `${_(i)}... [truncated]`;
2706
2749
  o += l.byteLength, i += r.decode(l, { stream: !0 });
2707
2750
  }
2708
2751
  } catch {
@@ -2712,26 +2755,26 @@ async function In(e) {
2712
2755
  s !== null && window.clearTimeout(s);
2713
2756
  }
2714
2757
  }
2715
- function An(e, t) {
2716
- if (se(new Headers(t)))
2758
+ function kn(e, t) {
2759
+ if (ne(new Headers(t)))
2717
2760
  try {
2718
- return e.responseType === "" || e.responseType === "text" ? E(e.responseText ?? "") : void 0;
2761
+ return e.responseType === "" || e.responseType === "text" ? _(e.responseText ?? "") : void 0;
2719
2762
  } catch {
2720
2763
  return;
2721
2764
  }
2722
2765
  }
2723
- function Bt(e) {
2766
+ function qt(e) {
2724
2767
  if (typeof e == "string")
2725
- return E(e);
2768
+ return _(e);
2726
2769
  }
2727
- function Sn(e) {
2770
+ function En(e) {
2728
2771
  return k({
2729
2772
  ...e,
2730
- requestBody: qt(e.requestBody),
2731
- responseBody: qt(e.responseBody)
2773
+ requestBody: xt(e.requestBody),
2774
+ responseBody: xt(e.responseBody)
2732
2775
  });
2733
2776
  }
2734
- function qt(e) {
2777
+ function xt(e) {
2735
2778
  if (typeof e != "string")
2736
2779
  return e;
2737
2780
  const t = e.trim();
@@ -2743,14 +2786,14 @@ function qt(e) {
2743
2786
  return j(e);
2744
2787
  }
2745
2788
  }
2746
- function se(e) {
2789
+ function ne(e) {
2747
2790
  if (!e)
2748
2791
  return !1;
2749
2792
  const t = e.get("content-type")?.toLowerCase() ?? "", s = e.get("content-length"), n = Number(s);
2750
2793
  return s !== null && Number.isInteger(n) && n >= 0 && n <= pt && (t.startsWith("text/") || t.includes("json") || t.includes("javascript"));
2751
2794
  }
2752
- function b(e, t = {}, s) {
2753
- if (En(s))
2795
+ function M(e, t = {}, s) {
2796
+ if (Rn(s))
2754
2797
  return !0;
2755
2798
  const n = Object.entries(t).find(([r]) => r.toLowerCase() === "content-type")?.[1]?.toLowerCase();
2756
2799
  if (n?.includes("multipart/form-data") || n?.includes("application/octet-stream"))
@@ -2765,8 +2808,8 @@ function b(e, t = {}, s) {
2765
2808
  return !0;
2766
2809
  }
2767
2810
  }
2768
- function kn(e, t) {
2769
- if (b(e))
2811
+ function _n(e, t) {
2812
+ if (M(e))
2770
2813
  return !0;
2771
2814
  try {
2772
2815
  const s = new URL(e, location.href), n = new URL(t);
@@ -2775,10 +2818,10 @@ function kn(e, t) {
2775
2818
  return !0;
2776
2819
  }
2777
2820
  }
2778
- function En(e) {
2821
+ function Rn(e) {
2779
2822
  return e instanceof FormData || e instanceof Blob || e instanceof ArrayBuffer || ArrayBuffer.isView(e) || typeof ReadableStream < "u" && e instanceof ReadableStream;
2780
2823
  }
2781
- function Rn(e) {
2824
+ function Cn(e) {
2782
2825
  const t = {};
2783
2826
  for (const s of e.trim().split(/[\r\n]+/)) {
2784
2827
  const n = s.indexOf(":");
@@ -2791,7 +2834,7 @@ function Rn(e) {
2791
2834
  }
2792
2835
  return t;
2793
2836
  }
2794
- function E(e, t = pt) {
2837
+ function _(e, t = pt) {
2795
2838
  return e.length <= t ? e : `${e.slice(0, t)}... [truncated ${e.length - t} chars]`;
2796
2839
  }
2797
2840
  function tt(e) {
@@ -2805,31 +2848,31 @@ class F extends Error {
2805
2848
  }
2806
2849
  async function et(e, t) {
2807
2850
  let s = null;
2808
- for (let n = 0; n < Ct; n += 1)
2851
+ for (let n = 0; n < Rt; n += 1)
2809
2852
  try {
2810
2853
  return await e();
2811
2854
  } catch (r) {
2812
- if (s = r, n >= Ct - 1 || !_n(r))
2855
+ if (s = r, n >= Rt - 1 || !Mn(r))
2813
2856
  throw r;
2814
- await Cn(n);
2857
+ await bn(n);
2815
2858
  }
2816
2859
  throw s instanceof Error ? s : new Error(t);
2817
2860
  }
2818
- function Cn(e) {
2861
+ function bn(e) {
2819
2862
  return new Promise((t) => {
2820
- window.setTimeout(t, $e[e] ?? 0);
2863
+ window.setTimeout(t, ze[e] ?? 0);
2821
2864
  });
2822
2865
  }
2823
- function _n(e) {
2824
- return e instanceof F ? bn(e.status) : e instanceof TypeError;
2866
+ function Mn(e) {
2867
+ return e instanceof F ? Un(e.status) : e instanceof TypeError;
2825
2868
  }
2826
- function bn(e) {
2869
+ function Un(e) {
2827
2870
  return e === 408 || e === 409 || e === 429 || e >= 500;
2828
2871
  }
2829
- function Mn(e) {
2872
+ function Pn(e) {
2830
2873
  return e === 401 || e === 403;
2831
2874
  }
2832
- const X = "[REDACTED_SECRET]", R = "[REDACTED_TOKEN]", Pn = "[REDACTED_SIGNED_URL]", Un = 20, Dn = /^(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, ne = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, re = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, ie = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, oe = /\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, vn = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Nn = /\bhttps?:\/\/[^\s"'<>]+/gi, On = /[),.;\]]+$/;
2875
+ const X = "[REDACTED_SECRET]", R = "[REDACTED_TOKEN]", Dn = "[REDACTED_SIGNED_URL]", vn = 20, Nn = /^(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, re = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, ie = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, oe = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, ae = /\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, On = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Ln = /\bhttps?:\/\/[^\s"'<>]+/gi, Bn = /[),.;\]]+$/;
2833
2876
  function k(e) {
2834
2877
  return W(e, 0, /* @__PURE__ */ new WeakSet());
2835
2878
  }
@@ -2838,7 +2881,7 @@ function W(e, t, s) {
2838
2881
  return e.startsWith("data:image/") || e.startsWith("data:application/pdf;") ? e : j(e);
2839
2882
  if (e === null || typeof e != "object")
2840
2883
  return e;
2841
- if (t >= Un)
2884
+ if (t >= vn)
2842
2885
  return "[REDACTED_MAX_DEPTH]";
2843
2886
  if (s.has(e))
2844
2887
  return "[REDACTED_CIRCULAR]";
@@ -2846,44 +2889,44 @@ function W(e, t, s) {
2846
2889
  return e.map((r) => W(r, t + 1, s));
2847
2890
  const n = {};
2848
2891
  for (const [r, i] of Object.entries(e))
2849
- ae(r) ? n[r] = X : n[r] = r.toLowerCase() === "url" ? Ln(i) : W(i, t + 1, s);
2892
+ ce(r) ? n[r] = X : n[r] = r.toLowerCase() === "url" ? qn(i) : W(i, t + 1, s);
2850
2893
  return n;
2851
2894
  }
2852
- function ae(e) {
2895
+ function ce(e) {
2853
2896
  const t = e.replace(/[^a-z0-9]/gi, "").toLowerCase();
2854
2897
  return t.includes("authorization") || t.includes("cookie") || t.includes("password") || t.includes("passwd") || t === "pwd" || t.includes("secret") || t === "token" || t.endsWith("token") || t.includes("apikey") || t.includes("csrf") || t.includes("xsrf") || t === "jwt" || t === "session" || t === "signature" || t.includes("privatekey");
2855
2898
  }
2856
- function Ln(e) {
2857
- return typeof e == "string" ? ce(e) : W(e, 0, /* @__PURE__ */ new WeakSet());
2899
+ function qn(e) {
2900
+ return typeof e == "string" ? le(e) : W(e, 0, /* @__PURE__ */ new WeakSet());
2858
2901
  }
2859
- function ce(e) {
2902
+ function le(e) {
2860
2903
  try {
2861
2904
  const t = new URL(e, location.href);
2862
2905
  for (const s of Array.from(t.searchParams.keys()))
2863
- Dn.test(s) && t.searchParams.set(s, R);
2906
+ Nn.test(s) && t.searchParams.set(s, R);
2864
2907
  return t.username && (t.username = R), t.password && (t.password = R), t.toString();
2865
2908
  } catch {
2866
- return Bn(e);
2909
+ return xn(e);
2867
2910
  }
2868
2911
  }
2869
2912
  function j(e) {
2870
- return e.replace(vn, Pn).replace(Nn, qn).replace(ne, `Bearer ${R}`).replace(re, `Basic ${R}`).replace(ie, R).replace(oe, (t, s) => `${s}: ${X}`);
2913
+ return e.replace(On, Dn).replace(Ln, Fn).replace(re, `Bearer ${R}`).replace(ie, `Basic ${R}`).replace(oe, R).replace(ae, (t, s) => `${s}: ${X}`);
2871
2914
  }
2872
- function Bn(e) {
2873
- return e.replace(ne, `Bearer ${R}`).replace(re, `Basic ${R}`).replace(ie, R).replace(oe, (t, s) => `${s}: ${X}`);
2915
+ function xn(e) {
2916
+ return e.replace(re, `Bearer ${R}`).replace(ie, `Basic ${R}`).replace(oe, R).replace(ae, (t, s) => `${s}: ${X}`);
2874
2917
  }
2875
- function qn(e) {
2876
- const t = e.match(On)?.[0] ?? "", s = t ? e.slice(0, -t.length) : e;
2877
- return `${ce(s)}${t}`;
2918
+ function Fn(e) {
2919
+ const t = e.match(Bn)?.[0] ?? "", s = t ? e.slice(0, -t.length) : e;
2920
+ return `${le(s)}${t}`;
2878
2921
  }
2879
2922
  export {
2880
2923
  St as PLUNO_PRODUCT_AGENT_SDK_PREVIEW_HOST_SELECTOR,
2881
2924
  rt as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
2882
- _e as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
2925
+ be as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
2883
2926
  Ce as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
2884
- be as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
2885
- Gt as PlunoProductAgent,
2886
- Ye as calculateReconnectDelay,
2887
- Gt as default,
2888
- ms as getProductAgentOriginAccessErrorMessage
2927
+ Me as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
2928
+ Xt as PlunoProductAgent,
2929
+ Ve as calculateReconnectDelay,
2930
+ Xt as default,
2931
+ ys as getProductAgentOriginAccessErrorMessage
2889
2932
  };