@pluno/product-agent-web 0.1.74 → 0.1.75

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.
@@ -49,22 +49,22 @@ async function bt(e, t, s) {
49
49
  function rt(e, t, s) {
50
50
  return new Promise((n, r) => {
51
51
  const i = e.transaction(Z, t), o = i.objectStore(Z);
52
- let c, a = !1;
53
- s(o).then((h) => {
54
- c = h;
55
- }).catch((h) => {
56
- a = !0;
52
+ let l, u = !1;
53
+ s(o).then((a) => {
54
+ l = a;
55
+ }).catch((a) => {
56
+ u = !0;
57
57
  try {
58
58
  i.abort();
59
59
  } catch {
60
60
  }
61
- r(h);
61
+ r(a);
62
62
  }), i.oncomplete = () => {
63
- a || n(c);
63
+ u || n(l);
64
64
  }, i.onerror = () => {
65
- a || (a = !0, r(i.error ?? new Error("Product Agent attachment storage transaction failed")));
65
+ u || (u = !0, r(i.error ?? new Error("Product Agent attachment storage transaction failed")));
66
66
  }, i.onabort = () => {
67
- a || (a = !0, r(i.error ?? new Error("Product Agent attachment storage transaction aborted")));
67
+ u || (u = !0, r(i.error ?? new Error("Product Agent attachment storage transaction aborted")));
68
68
  };
69
69
  });
70
70
  }
@@ -73,25 +73,43 @@ function it(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
- const z = "pluno.productAgent.transportId", Yt = "pluno.productAgent.transportIdentity", G = "pluno.productAgent.transportIdentity.event", Zt = 50, Qt = globalThis.setTimeout.bind(globalThis);
77
- let M = null;
76
+ function Yt(e) {
77
+ return e !== null && (typeof e == "object" || typeof e == "function");
78
+ }
79
+ function Zt(e, t, s) {
80
+ const n = Reflect.get(e, "pluno"), r = Yt(n) ? n : {};
81
+ if (r !== n && !Reflect.set(e, "pluno", r))
82
+ return null;
83
+ const i = Object.getOwnPropertyDescriptor(r, t);
84
+ return !Reflect.set(r, t, s) || Reflect.get(r, t) !== s ? null : () => {
85
+ if (Reflect.get(r, t) === s) {
86
+ if (i) {
87
+ Reflect.defineProperty(r, t, i);
88
+ return;
89
+ }
90
+ Reflect.deleteProperty(r, t);
91
+ }
92
+ };
93
+ }
94
+ const z = "pluno.productAgent.transportId", Qt = "pluno.productAgent.transportIdentity", G = "pluno.productAgent.transportIdentity.event", te = 50, ee = globalThis.setTimeout.bind(globalThis);
95
+ let b = null;
78
96
  const v = /* @__PURE__ */ new Set();
79
- async function te(e = Mt()) {
97
+ async function se(e = Mt()) {
80
98
  const t = e.randomUUID(), s = e.storage.getItem(z);
81
99
  let n = s ?? e.randomUUID(), r = !1, i = !1;
82
- const o = e.channel.subscribe((a) => {
83
- if (!(a.senderId === t || a.transportId !== n)) {
84
- if (a.type === "probe") {
100
+ const o = e.channel.subscribe((u) => {
101
+ if (!(u.senderId === t || u.transportId !== n)) {
102
+ if (u.type === "probe") {
85
103
  e.channel.postMessage({
86
104
  type: "contender",
87
105
  transportId: n,
88
106
  senderId: t,
89
- targetId: a.senderId,
107
+ targetId: u.senderId,
90
108
  established: r
91
- }), !r && t > a.senderId && (i = !0);
109
+ }), !r && t > u.senderId && (i = !0);
92
110
  return;
93
111
  }
94
- a.targetId === t && (a.established || t > a.senderId) && (i = !0);
112
+ u.targetId === t && (u.established || t > u.senderId) && (i = !0);
95
113
  }
96
114
  });
97
115
  if (!s)
@@ -104,22 +122,22 @@ async function te(e = Mt()) {
104
122
  }
105
123
  n = e.randomUUID(), e.storage.setItem(z, n);
106
124
  }
107
- let c = !1;
125
+ let l = !1;
108
126
  return {
109
127
  transportId: n,
110
128
  release: () => {
111
- c || (c = !0, o(), e.channel.close());
129
+ l || (l = !0, o(), e.channel.close());
112
130
  }
113
131
  };
114
132
  }
115
- async function ee() {
116
- M || (M = te(Mt()), M.then((n) => {
133
+ async function ne() {
134
+ b || (b = se(Mt()), b.then((n) => {
117
135
  const r = (i) => {
118
- i.persisted || (n.release(), M = null, v.clear(), window.removeEventListener("pagehide", r));
136
+ i.persisted || (n.release(), b = null, v.clear(), window.removeEventListener("pagehide", r));
119
137
  };
120
138
  window.addEventListener("pagehide", r);
121
139
  }));
122
- const e = await M, t = se();
140
+ const e = await b, t = re();
123
141
  v.add(t);
124
142
  let s = !1;
125
143
  return {
@@ -130,7 +148,7 @@ async function ee() {
130
148
  }
131
149
  };
132
150
  }
133
- function se() {
151
+ function re() {
134
152
  let e = 0;
135
153
  for (; v.has(e); )
136
154
  e += 1;
@@ -139,14 +157,14 @@ function se() {
139
157
  function Mt() {
140
158
  return {
141
159
  storage: window.sessionStorage,
142
- channel: ne(),
160
+ channel: ie(),
143
161
  randomUUID: () => crypto.randomUUID(),
144
- settle: () => new Promise((e) => Qt(e, Zt))
162
+ settle: () => new Promise((e) => ee(e, te))
145
163
  };
146
164
  }
147
- function ne() {
165
+ function ie() {
148
166
  if (typeof BroadcastChannel < "u") {
149
- const e = new BroadcastChannel(Yt);
167
+ const e = new BroadcastChannel(Qt);
150
168
  return {
151
169
  postMessage: (t) => e.postMessage(t),
152
170
  subscribe: (t) => {
@@ -156,9 +174,9 @@ function ne() {
156
174
  close: () => e.close()
157
175
  };
158
176
  }
159
- return re();
177
+ return oe();
160
178
  }
161
- function re() {
179
+ function oe() {
162
180
  const e = /* @__PURE__ */ new Set(), t = (s) => {
163
181
  if (s.key !== G || !s.newValue)
164
182
  return;
@@ -179,17 +197,17 @@ function re() {
179
197
  }
180
198
  };
181
199
  }
182
- const Q = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', ie = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', oe = ".pluno-pa-widget__panel", ae = ".pluno-pa-widget__timeline", ht = `${Q}[data-pluno-sdk-preview-channel]`, ce = "https://app.pluno.ai", le = "gpt-5.6-terra", ue = 2e4, de = 1e4, he = 1e4, pe = 1e4, ge = 1e4, fe = 1e3, pt = 3e4, gt = 0.2, ft = 6e4, me = 15e3, U = 3, ye = 2e3, Te = 15e3, we = 1e3, Ie = 100, Ae = 8e3, Se = 15e3, mt = 3, ke = [300, 1e3], ot = 64e3, X = 4e3, at = 30, Ee = 2e3, Re = 1e3, _e = 200 * 1024 * 1024, Ce = "Image is too large for model vision input.", be = 100, Pt = "pluno.productAgent.state.", tt = "pluno.productAgent.pendingEvents.", F = "pluno.productAgent.activeToolCalls.", Me = 100;
200
+ const Q = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', ae = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', ce = ".pluno-pa-widget__panel", le = ".pluno-pa-widget__timeline", ht = `${Q}[data-pluno-sdk-preview-channel]`, ue = "https://app.pluno.ai", de = "gpt-5.6-terra", he = 2e4, pe = 1e4, fe = 1e4, ge = 1e4, me = 1e4, ye = 1e3, pt = 3e4, ft = 0.2, gt = 6e4, Te = 15e3, U = 3, we = 2e3, Ie = 15e3, Ae = 1e3, Se = 100, ke = 8e3, Ee = 15e3, mt = 3, Re = [300, 1e3], ot = 64e3, X = 4e3, at = 30, _e = 2e3, Ce = 1e3, be = 200 * 1024 * 1024, Me = "Image is too large for model vision input.", Pe = 100, Pt = "pluno.productAgent.state.", tt = "pluno.productAgent.pendingEvents.", F = "pluno.productAgent.activeToolCalls.", Ue = 100;
183
201
  function D(e, t = 0) {
184
- return Math.max(t, ye * 4 ** e);
202
+ return Math.max(t, we * 4 ** e);
185
203
  }
186
204
  const L = /* @__PURE__ */ new Set();
187
205
  let N = null;
188
- function Pe(e, t = Math.random) {
189
- const s = Math.min(pt, fe * 2 ** e), n = 1 - gt + t() * gt * 2;
206
+ function De(e, t = Math.random) {
207
+ const s = Math.min(pt, ye * 2 ** e), n = 1 - ft + t() * ft * 2;
190
208
  return Math.min(pt, Math.round(s * n));
191
209
  }
192
- function Ue(e, t, s) {
210
+ function Ne(e, t, s) {
193
211
  return new Promise((n, r) => {
194
212
  const i = setTimeout(() => r(new Error(s)), t);
195
213
  e.then(
@@ -206,9 +224,9 @@ class Ut {
206
224
  constructor(t, s) {
207
225
  this.options = t, this.transportIdentity = s, this.state = {
208
226
  ...this.state,
209
- starterPrompts: Ve(t.initialStarterPrompts)
227
+ starterPrompts: Ze(t.initialStarterPrompts)
210
228
  };
211
- const n = t.restorePersistedState === !1 ? null : _s(t.clientId, t.expectedPersistedSessionId);
229
+ const n = t.restorePersistedState === !1 ? null : bs(t.clientId, t.expectedPersistedSessionId);
212
230
  n && (this.state = {
213
231
  ...this.state,
214
232
  ...n,
@@ -219,10 +237,10 @@ class Ut {
219
237
  assistantDraftRunId: null,
220
238
  isThinking: !1,
221
239
  lastError: null
222
- }), this.queuedClientEvents = Ds(
223
- bs(t.clientId),
224
- Ps(t.clientId)
225
- ), P(t.clientId, this.queuedClientEvents);
240
+ }), this.queuedClientEvents = Os(
241
+ Ps(t.clientId),
242
+ Ds(t.clientId)
243
+ ), M(t.clientId, this.queuedClientEvents);
226
244
  }
227
245
  options;
228
246
  listeners = {};
@@ -279,15 +297,15 @@ class Ut {
279
297
  lastErrorCode: null
280
298
  };
281
299
  static async init(t) {
282
- const s = await ee(), n = new Ut({
300
+ const s = await ne(), n = new Ut({
283
301
  ...t,
284
- backendUrl: Fe(t.backendUrl ?? ce),
285
- clientId: t.clientId ?? es(),
286
- model: t.model ?? le
302
+ backendUrl: je(t.backendUrl ?? ue),
303
+ clientId: t.clientId ?? ns(),
304
+ model: t.model ?? de
287
305
  }, s);
288
306
  try {
289
307
  Vt().catch((r) => {
290
- f("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
308
+ p("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
291
309
  message: r instanceof Error ? r.message : String(r)
292
310
  });
293
311
  }), t.disableNetworkCapture || n.enableNetworkCapture(), n.startPageLifecycleRecovery(), n.startStarterPromptUrlWatcher(), t.autoConnect !== !1 && await n.connect();
@@ -318,52 +336,61 @@ class Ut {
318
336
  lastError: null
319
337
  });
320
338
  try {
321
- this.token = this.options.token ?? (this.options.tokenProvider ? await Ue(this.options.tokenProvider(), he, "Pluno token provider timed out") : null);
339
+ if (this.token = this.options.token ?? (this.options.tokenProvider ? await Ne(this.options.tokenProvider(), fe, "Pluno token provider timed out") : null), t !== this.connectionAttemptId || this.state.status === "closed")
340
+ return;
341
+ if (!this.token && !this.options.webSocketFactory)
342
+ throw new Error("Pluno requires a token or tokenProvider");
343
+ const s = ze(this.options.backendUrl), n = this.options.webSocketFactory?.(s) ?? new WebSocket(s);
344
+ this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
345
+ this.socket === n && n.readyState === WebSocket.CONNECTING && (p("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.replaceTimedOutSocket(n));
346
+ }, ge), n.addEventListener("open", () => {
347
+ this.socket !== n || (this.clearSocketConnectTimer(), p("web-sdk.agent", "Pluno socket opened", {
348
+ queuedClientEventCount: this.queuedClientEvents.length,
349
+ isThinking: this.state.isThinking
350
+ }), !(this.token ? this.sendNow({
351
+ type: "auth.session",
352
+ token: this.token,
353
+ clientId: this.options.clientId,
354
+ transportId: this.transportIdentity.transportId,
355
+ pageUrl: location.href
356
+ }) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
357
+ this.socket === n && (p("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.replaceTimedOutSocket(n));
358
+ }, me));
359
+ }), n.addEventListener("message", (r) => {
360
+ this.socket === n && this.handleServerEvent(Ye(r.data));
361
+ }), n.addEventListener("close", (r) => {
362
+ this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (p("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
363
+ code: typeof r?.code == "number" ? r.code : null,
364
+ reason: typeof r?.reason == "string" ? r.reason : "",
365
+ wasClean: typeof r?.wasClean == "boolean" ? r.wasClean : null,
366
+ queuedClientEventCount: this.queuedClientEvents.length,
367
+ isThinking: this.state.isThinking
368
+ }), this.setState({ status: "reconnecting", lastError: null }), this.scheduleReconnect()));
369
+ }), n.addEventListener("error", () => {
370
+ this.socket !== n || this.state.status === "closed" || (p("web-sdk.agent", "Pluno socket error; scheduling reconnect", {
371
+ queuedClientEventCount: this.queuedClientEvents.length,
372
+ isThinking: this.state.isThinking
373
+ }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setState({ status: "reconnecting", lastError: null }), this.scheduleReconnect(), n.readyState !== WebSocket.CLOSED && n.readyState !== WebSocket.CLOSING && n.close());
374
+ });
375
+ } catch (s) {
376
+ if (t === this.connectionAttemptId && this.state.status !== "closed") {
377
+ const n = s instanceof Error ? s : new Error(String(s));
378
+ this.setState({
379
+ status: "error",
380
+ lastError: n.message,
381
+ lastErrorCode: "connection_failed"
382
+ }), this.emit("error", n);
383
+ }
384
+ throw s;
322
385
  } finally {
323
386
  this.connectionInProgress = !1;
324
387
  }
325
- if (t !== this.connectionAttemptId || this.state.status === "closed")
326
- return;
327
- if (!this.token && !this.options.webSocketFactory)
328
- throw new Error("Pluno requires a token or tokenProvider");
329
- const s = je(this.options.backendUrl), n = this.options.webSocketFactory?.(s) ?? new WebSocket(s);
330
- this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
331
- this.socket !== n || n.readyState !== WebSocket.CONNECTING || (f("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.replaceTimedOutSocket(n));
332
- }, pe), n.addEventListener("open", () => {
333
- this.socket !== n || (this.clearSocketConnectTimer(), f("web-sdk.agent", "Pluno socket opened", {
334
- queuedClientEventCount: this.queuedClientEvents.length,
335
- isThinking: this.state.isThinking
336
- }), !(this.token ? this.sendNow({
337
- type: "auth.session",
338
- token: this.token,
339
- clientId: this.options.clientId,
340
- transportId: this.transportIdentity.transportId,
341
- pageUrl: location.href
342
- }) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
343
- this.socket === n && (f("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.replaceTimedOutSocket(n));
344
- }, ge));
345
- }), n.addEventListener("message", (r) => {
346
- this.socket === n && this.handleServerEvent(Je(r.data));
347
- }), n.addEventListener("close", (r) => {
348
- this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (f("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
349
- code: typeof r?.code == "number" ? r.code : null,
350
- reason: typeof r?.reason == "string" ? r.reason : "",
351
- wasClean: typeof r?.wasClean == "boolean" ? r.wasClean : null,
352
- queuedClientEventCount: this.queuedClientEvents.length,
353
- isThinking: this.state.isThinking
354
- }), this.setState({ status: "reconnecting", lastError: null }), this.scheduleReconnect()));
355
- }), n.addEventListener("error", () => {
356
- this.socket !== n || this.state.status === "closed" || (f("web-sdk.agent", "Pluno socket error; scheduling reconnect", {
357
- queuedClientEventCount: this.queuedClientEvents.length,
358
- isThinking: this.state.isThinking
359
- }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setState({ status: "reconnecting", lastError: null }), this.scheduleReconnect(), n.readyState !== WebSocket.CLOSED && n.readyState !== WebSocket.CLOSING && n.close());
360
- });
361
388
  }
362
389
  disconnect() {
363
390
  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;
364
391
  }
365
392
  destroy() {
366
- this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionUserFilesApi(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), Ns(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
393
+ this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionUserFilesApi(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), vs(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
367
394
  for (const t of Object.values(this.listeners))
368
395
  t?.clear();
369
396
  }
@@ -371,17 +398,17 @@ class Ut {
371
398
  const n = t.trim(), r = s.attachments ?? [], i = r.map(ut);
372
399
  if (!n && i.length === 0)
373
400
  return null;
374
- const o = A(), c = O();
401
+ const o = I(), l = O();
375
402
  this.retryableClientMessageId = null;
376
- const a = {
377
- id: `local-${c}`,
403
+ const u = {
404
+ id: `local-${l}`,
378
405
  role: "user",
379
406
  content: n,
380
407
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
381
408
  ...r.length > 0 ? { attachments: r } : {}
382
409
  };
383
410
  this.setState({
384
- messages: [...this.state.messages, a],
411
+ messages: [...this.state.messages, u],
385
412
  ...this.state.isThinking ? {} : {
386
413
  assistantDraft: "",
387
414
  assistantDraftRespondsToUserMessageId: null,
@@ -389,18 +416,18 @@ class Ut {
389
416
  },
390
417
  isThinking: !0,
391
418
  lastError: null
392
- }), this.emit("message", a);
393
- const h = {
419
+ }), this.emit("message", u);
420
+ const a = {
394
421
  type: "chat.user_message",
395
422
  sessionId: this.state.sessionId ?? void 0,
396
- clientMessageId: c,
423
+ clientMessageId: l,
397
424
  content: n,
398
425
  attachments: i.length > 0 ? i : void 0,
399
426
  page: o,
400
427
  model: this.options.model,
401
428
  metadata: yt(this.options.metadata)
402
429
  };
403
- return this.activeClientMessageId = c, this.activeUserMessageEvent = h, this.markThinkingProgress(), this.send(h), this.startBackgroundAttachmentUploads(c, i), c;
430
+ return this.activeClientMessageId = l, this.activeUserMessageEvent = a, this.markThinkingProgress(), this.send(a), this.startBackgroundAttachmentUploads(l, i), l;
404
431
  }
405
432
  retryLastMessage() {
406
433
  const t = this.state.sessionId, s = this.retryableClientMessageId;
@@ -421,12 +448,12 @@ class Ut {
421
448
  mimeType: n.mimeType,
422
449
  sizeBytes: n.sizeBytes,
423
450
  blob: t,
424
- origin: A().origin,
451
+ origin: I().origin,
425
452
  sessionId: this.state.sessionId ?? void 0,
426
453
  createdAt: r,
427
454
  lastUsedAt: r
428
455
  }).catch((i) => {
429
- f("web-sdk.attachments", "Failed to store Product Agent attachment", {
456
+ p("web-sdk.attachments", "Failed to store Product Agent attachment", {
430
457
  attachmentId: s,
431
458
  name: n.name,
432
459
  message: i instanceof Error ? i.message : String(i)
@@ -455,7 +482,7 @@ class Ut {
455
482
  waitForSession: !0,
456
483
  notifyCompletion: !0
457
484
  }).catch((i) => {
458
- f("web-sdk.agent", "Attachment background upload failed", {
485
+ p("web-sdk.agent", "Attachment background upload failed", {
459
486
  attachmentId: n.id,
460
487
  name: n.name,
461
488
  message: i instanceof Error ? i.message : String(i)
@@ -470,55 +497,55 @@ class Ut {
470
497
  waitForSession: r,
471
498
  notifyCompletion: i
472
499
  }) {
473
- const o = r ? await this.waitForSessionId() : this.state.sessionId, c = kt(t), a = {
500
+ const o = r ? await this.waitForSessionId() : this.state.sessionId, l = kt(t), u = {
474
501
  sessionId: o ?? void 0,
475
502
  attachmentId: s.id,
476
503
  clientId: this.options.clientId,
477
504
  transportId: this.transportIdentity.transportId,
478
505
  name: t.name || "attachment",
479
- mimeType: c,
506
+ mimeType: l,
480
507
  sizeBytes: t.size,
481
- page: A(),
508
+ page: I(),
482
509
  model: this.options.model,
483
510
  metadata: yt(this.options.metadata)
484
- }, h = this.options.prepareAttachmentUpload ? await Y(
485
- () => this.options.prepareAttachmentUpload(a),
511
+ }, a = this.options.prepareAttachmentUpload ? await Y(
512
+ () => this.options.prepareAttachmentUpload(u),
486
513
  "Failed to prepare attachment upload"
487
- ) : await this.prepareEmbedAttachmentUpload(a);
514
+ ) : await this.prepareEmbedAttachmentUpload(u);
488
515
  await Y(async () => {
489
- const d = await fetch(h.uploadUrl, {
490
- method: h.uploadMethod,
491
- headers: h.uploadHeaders,
516
+ const f = await fetch(a.uploadUrl, {
517
+ method: a.uploadMethod,
518
+ headers: a.uploadHeaders,
492
519
  body: t
493
520
  });
494
- if (!d.ok)
495
- throw new B("Failed to upload attachment", d.status);
496
- return d;
497
- }, "Failed to upload attachment"), this.setState({ sessionId: h.sessionId });
498
- const g = Ht(h.attachment, this.options.backendUrl);
499
- return this.updateAttachmentInState(s.id, g), s.id && Ct(s.id, {
500
- sessionId: h.sessionId,
501
- fileUrl: g.fileUrl,
502
- gcsPath: g.gcsPath,
521
+ if (!f.ok)
522
+ throw new B("Failed to upload attachment", f.status);
523
+ return f;
524
+ }, "Failed to upload attachment"), this.setState({ sessionId: a.sessionId });
525
+ const c = Ht(a.attachment, this.options.backendUrl);
526
+ return this.updateAttachmentInState(s.id, c), s.id && Ct(s.id, {
527
+ sessionId: a.sessionId,
528
+ fileUrl: c.fileUrl,
529
+ gcsPath: c.gcsPath,
503
530
  lastUsedAt: Date.now()
504
- }).catch((d) => {
505
- f("web-sdk.attachments", "Failed to update persisted Product Agent attachment", {
531
+ }).catch((f) => {
532
+ p("web-sdk.attachments", "Failed to update persisted Product Agent attachment", {
506
533
  attachmentId: s.id,
507
- name: g.name,
508
- message: d instanceof Error ? d.message : String(d)
534
+ name: c.name,
535
+ message: f instanceof Error ? f.message : String(f)
509
536
  });
510
- }), i && g.gcsPath && this.send({
537
+ }), i && c.gcsPath && this.send({
511
538
  type: "attachment.upload_completed",
512
- sessionId: h.sessionId,
539
+ sessionId: a.sessionId,
513
540
  clientMessageId: n,
514
- attachment: g
515
- }), g;
541
+ attachment: c
542
+ }), c;
516
543
  }
517
544
  waitForSessionId() {
518
545
  return this.state.sessionId ? Promise.resolve(this.state.sessionId) : new Promise((t, s) => {
519
546
  const n = window.setTimeout(() => {
520
547
  r(), s(new Error("Timed out waiting for Pluno session before persisting attachment"));
521
- }, Se), r = this.on("state", (i) => {
548
+ }, Ee), r = this.on("state", (i) => {
522
549
  i.sessionId && (window.clearTimeout(n), r(), t(i.sessionId));
523
550
  });
524
551
  });
@@ -540,7 +567,7 @@ class Ut {
540
567
  const n = await this.fetchEmbedAttachmentUpload(t);
541
568
  if (n.ok)
542
569
  return await n.json();
543
- if (Ys(n.status) && this.options.tokenProvider && !s) {
570
+ if (Qs(n.status) && this.options.tokenProvider && !s) {
544
571
  s = !0;
545
572
  const r = await this.fetchEmbedAttachmentUpload(t);
546
573
  if (r.ok)
@@ -569,7 +596,7 @@ class Ut {
569
596
  s && this.state.sessionId && this.state.isThinking && this.sendNow({ type: "run.stop", sessionId: this.state.sessionId }), this.cleanupSessionUserFilesApi(), this.queuedClientEvents = this.queuedClientEvents.filter((n) => n.type !== "chat.user_message"), this.clearThinkingWatchdog(), this.retryableClientMessageId = null, this.retryAttemptsByClientMessageId = {}, this.thinkingWatchdogResyncAttemptsByClientMessageId = {}, s && this.send({
570
597
  type: "session.reset",
571
598
  sessionId: this.state.sessionId ?? void 0,
572
- page: A()
599
+ page: I()
573
600
  }), this.setState({
574
601
  sessionId: null,
575
602
  starterPrompts: [...this.state.starterPrompts],
@@ -583,14 +610,14 @@ class Ut {
583
610
  }
584
611
  listSessions(t = {}) {
585
612
  const s = O(), n = new Promise((i, o) => {
586
- const c = window.setTimeout(() => {
613
+ const l = window.setTimeout(() => {
587
614
  this.pendingSessionHistoryRequests.delete(s), o(new Error("Session history did not respond in time"));
588
- }, Ae);
589
- this.pendingSessionHistoryRequests.set(s, { resolve: i, reject: o, timeout: c });
615
+ }, ke);
616
+ this.pendingSessionHistoryRequests.set(s, { resolve: i, reject: o, timeout: l });
590
617
  }), r = {
591
618
  type: "sessions.list",
592
619
  requestId: s,
593
- page: A(),
620
+ page: I(),
594
621
  ...t.cursor ? { cursor: t.cursor } : {},
595
622
  ...t.limit ? { limit: t.limit } : {}
596
623
  };
@@ -612,11 +639,11 @@ class Ut {
612
639
  }), this.send({
613
640
  type: "session.load",
614
641
  sessionId: t,
615
- page: A()
642
+ page: I()
616
643
  });
617
644
  }
618
645
  send(t) {
619
- this.sendNow(I(t)) || (this.queuedClientEvents.push(t), P(this.options.clientId, this.queuedClientEvents), this.setState({ status: "reconnecting" }), this.scheduleReconnect());
646
+ this.sendNow(w(t)) || (this.queuedClientEvents.push(t), M(this.options.clientId, this.queuedClientEvents), this.setState({ status: "reconnecting" }), this.scheduleReconnect());
620
647
  }
621
648
  async getUploadToken() {
622
649
  const t = this.options.token ?? await this.options.tokenProvider?.() ?? this.token ?? null;
@@ -631,7 +658,7 @@ class Ut {
631
658
  try {
632
659
  return s.send(JSON.stringify(t)), !0;
633
660
  } catch (n) {
634
- return f("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
661
+ return p("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
635
662
  message: n instanceof Error ? n.message : String(n),
636
663
  queuedClientEventCount: this.queuedClientEvents.length,
637
664
  isThinking: this.state.isThinking
@@ -642,9 +669,9 @@ class Ut {
642
669
  if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
643
670
  return;
644
671
  this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
645
- const t = $e();
672
+ const t = Ge();
646
673
  this.sendNow(
647
- I({
674
+ w({
648
675
  type: "starter_prompts.page_context",
649
676
  pageUrl: t.pageUrl,
650
677
  pageTitle: t.pageTitle,
@@ -653,13 +680,13 @@ class Ut {
653
680
  ) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
654
681
  }
655
682
  startStarterPromptUrlWatcher() {
656
- this.locationChangeCleanup || (this.locationChangeCleanup = ze(() => this.handleStarterPromptUrlChange()));
683
+ this.locationChangeCleanup || (this.locationChangeCleanup = Xe(() => this.handleStarterPromptUrlChange()));
657
684
  }
658
685
  handleStarterPromptUrlChange() {
659
686
  const t = location.href;
660
687
  t !== this.lastStarterPromptPageUrl && (this.lastStarterPromptPageUrl = t, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
661
688
  this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
662
- }, Me));
689
+ }, Ue));
663
690
  }
664
691
  refreshStarterPromptsForCurrentUrl() {
665
692
  this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
@@ -674,14 +701,14 @@ class Ut {
674
701
  if (this.socket?.readyState !== WebSocket.OPEN || this.queuedClientEvents.length === 0)
675
702
  return;
676
703
  const t = this.queuedClientEvents.splice(0, this.queuedClientEvents.length);
677
- P(this.options.clientId, this.queuedClientEvents);
704
+ M(this.options.clientId, this.queuedClientEvents);
678
705
  for (let s = 0; s < t.length; s += 1) {
679
706
  const n = t[s];
680
- if (!this.sendNow(I(n))) {
681
- this.queuedClientEvents.unshift(n, ...t.slice(s + 1)), P(this.options.clientId, this.queuedClientEvents);
707
+ if (!this.sendNow(w(n))) {
708
+ this.queuedClientEvents.unshift(n, ...t.slice(s + 1)), M(this.options.clientId, this.queuedClientEvents);
682
709
  return;
683
710
  }
684
- P(this.options.clientId, this.queuedClientEvents);
711
+ M(this.options.clientId, this.queuedClientEvents);
685
712
  }
686
713
  }
687
714
  handleServerEvent(t) {
@@ -693,22 +720,22 @@ class Ut {
693
720
  this.clearHeartbeatAckTimer();
694
721
  return;
695
722
  }
696
- if (Oe(t) && this.markThinkingProgress(), t.type === "auth.ok") {
723
+ if (Le(t) && this.markThinkingProgress(), t.type === "auth.ok") {
697
724
  this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.flushQueuedClientEvents(), this.startHeartbeat();
698
- const s = Ye(t), n = Object.prototype.hasOwnProperty.call(t, "appearance");
699
- f("web-sdk.agent", "Received auth.ok appearance", {
725
+ const s = Qe(t), n = Object.prototype.hasOwnProperty.call(t, "appearance");
726
+ p("web-sdk.agent", "Received auth.ok appearance", {
700
727
  hasAppearance: n,
701
728
  rawAppearance: t.appearance,
702
729
  normalizedAppearance: s
703
- }), this.runtimeHelperJavascript = Ze(t.runtimeHelpers)?.javascript ?? null;
704
- const r = It(t, "starterPrompts"), i = Object.prototype.hasOwnProperty.call(t, "starterPrompts"), o = t.starterPromptsLoading === !0, c = {
705
- user: ss(t.user),
730
+ }), this.runtimeHelperJavascript = ts(t.runtimeHelpers)?.javascript ?? null;
731
+ const r = It(t, "starterPrompts"), i = Object.prototype.hasOwnProperty.call(t, "starterPrompts"), o = t.starterPromptsLoading === !0, l = {
732
+ user: rs(t.user),
706
733
  status: "connected"
707
734
  };
708
- (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 && !Xe() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
735
+ (i || this.state.starterPrompts.length === 0) && (l.starterPrompts = r, l.starterPromptsLoading = r.length > 0 ? !1 : o), i && r.length > 0 && (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0), (n || s) && (l.appearance = s), this.setState(l), i && r.length === 0 && !o && !Je() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
709
736
  type: "page.upsert",
710
737
  sessionId: this.state.sessionId,
711
- page: A(),
738
+ page: I(),
712
739
  model: this.options.model
713
740
  });
714
741
  return;
@@ -721,23 +748,23 @@ class Ut {
721
748
  return;
722
749
  }
723
750
  if (t.type === "conversation.state") {
724
- const s = Array.isArray(t.items) ? t.items : [], n = Ts(s);
751
+ const s = Array.isArray(t.items) ? t.items : [], n = Is(s);
725
752
  if (n) {
726
- const c = ws(s, n);
753
+ const l = As(s, n);
727
754
  this.retryAttemptsByClientMessageId[n] = Math.max(
728
755
  this.retryAttemptsByClientMessageId[n] ?? 0,
729
- c
756
+ l
730
757
  );
731
758
  }
732
- const r = ds(
759
+ const r = ps(
733
760
  this.state.messages,
734
- ns(s, this.options.backendUrl)
761
+ is(s, this.options.backendUrl)
735
762
  ), i = At(r);
736
- if (!i && ys(this.state.messages, s))
763
+ if (!i && ws(this.state.messages, s))
737
764
  return;
738
765
  const o = i ? null : et(s);
739
- if (this.latestRecoverableClientMessageId = o, fs(r) && this.clearRetryTimers(), this.setState({
740
- sessionId: S(t.session, "id") ?? this.state.sessionId,
766
+ if (this.latestRecoverableClientMessageId = o, ys(r) && this.clearRetryTimers(), this.setState({
767
+ sessionId: A(t.session, "id") ?? this.state.sessionId,
741
768
  messages: r,
742
769
  ...i ? { assistantDraft: "", assistantDraftRespondsToUserMessageId: null, assistantDraftRunId: null, isThinking: !1 } : o ? {
743
770
  assistantDraft: "",
@@ -747,21 +774,21 @@ class Ut {
747
774
  lastError: null
748
775
  } : {}
749
776
  }), i ? (this.retryableClientMessageId = null, this.clearThinkingWatchdog()) : o && (this.activeClientMessageId = o, this.markThinkingProgress()), n) {
750
- const c = S(t.session, "id") ?? this.state.sessionId;
751
- c && this.retryAfterInterruptedRun(c, n);
777
+ const l = A(t.session, "id") ?? this.state.sessionId;
778
+ l && this.retryAfterInterruptedRun(l, n);
752
779
  }
753
780
  return;
754
781
  }
755
782
  if (t.type === "sessions.page") {
756
783
  const s = typeof t.requestId == "string" ? t.requestId : null, n = s ? this.pendingSessionHistoryRequests.get(s) : null;
757
784
  s && n && (window.clearTimeout(n.timeout), this.pendingSessionHistoryRequests.delete(s), n.resolve({
758
- sessions: rs(t.sessions),
785
+ sessions: os(t.sessions),
759
786
  nextCursor: typeof t.nextCursor == "string" ? t.nextCursor : null
760
787
  }));
761
788
  return;
762
789
  }
763
790
  if (t.type === "session.updated") {
764
- this.clearRunAckResyncRetryTimer(), this.setState({ sessionId: S(t.session, "id") ?? this.state.sessionId });
791
+ this.clearRunAckResyncRetryTimer(), this.setState({ sessionId: A(t.session, "id") ?? this.state.sessionId });
765
792
  return;
766
793
  }
767
794
  if (t.type === "session.item") {
@@ -769,8 +796,8 @@ class Ut {
769
796
  if (s) {
770
797
  s.role === "assistant" && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer());
771
798
  const n = t.item.data;
772
- Is(n) && this.clearRunAckResyncRetryTimer();
773
- const r = us(this.state.messages, s), i = At(r);
799
+ Ss(n) && this.clearRunAckResyncRetryTimer();
800
+ const r = hs(this.state.messages, s), i = At(r);
774
801
  this.setState({
775
802
  messages: r,
776
803
  assistantDraft: s.role === "assistant" ? "" : this.state.assistantDraft,
@@ -818,13 +845,13 @@ class Ut {
818
845
  if (this.retryAfterRetryableError(t))
819
846
  return;
820
847
  o && r && i && (this.retryableClientMessageId = i);
821
- const c = new Error(typeof t.message == "string" ? t.message.replace(/Product Agent/g, "Pluno") : "Pluno error"), a = We(c.message);
822
- a && console.error(a), this.setState({
848
+ const l = new Error(typeof t.message == "string" ? t.message.replace(/Product Agent/g, "Pluno") : "Pluno error"), u = $e(l.message);
849
+ u && console.error(u), this.setState({
823
850
  status: "error",
824
851
  isThinking: !1,
825
- lastError: c.message,
852
+ lastError: l.message,
826
853
  lastErrorCode: typeof t.code == "string" ? t.code : null
827
- }), this.clearThinkingWatchdog(), this.emit("error", c);
854
+ }), this.clearThinkingWatchdog(), this.emit("error", l);
828
855
  }
829
856
  }
830
857
  retryAfterRetryableError(t) {
@@ -833,10 +860,10 @@ class Ut {
833
860
  return !1;
834
861
  if (t.code === "run_still_active") {
835
862
  if (this.retryableClientMessageId = n, this.activeClientMessageId = n, this.latestRecoverableClientMessageId = n, this.setState({ status: "connected", isThinking: !0, lastError: null, lastErrorCode: null }), this.retryTimersByClientMessageId[n] === void 0) {
836
- const c = typeof t.retryAfterMs == "number" ? t.retryAfterMs : 2e3;
863
+ const l = typeof t.retryAfterMs == "number" ? t.retryAfterMs : 2e3;
837
864
  this.retryTimersByClientMessageId[n] = window.setTimeout(() => {
838
865
  delete this.retryTimersByClientMessageId[n], this.resyncThinkingSession(), this.markThinkingProgress();
839
- }, c);
866
+ }, l);
840
867
  }
841
868
  return !0;
842
869
  }
@@ -884,7 +911,7 @@ class Ut {
884
911
  this.pendingSessionHistoryRequests.clear();
885
912
  }
886
913
  markThinkingProgress() {
887
- !this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(ft), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
914
+ !this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(gt), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
888
915
  }
889
916
  scheduleThinkingWatchdog(t) {
890
917
  this.thinkingWatchdogTimer !== null && window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = window.setTimeout(() => {
@@ -901,10 +928,10 @@ class Ut {
901
928
  scheduleRunAckWatchdog(t) {
902
929
  this.runAckWatchdogTimer !== null && window.clearTimeout(this.runAckWatchdogTimer), this.runAckWatchdogTimer = window.setTimeout(() => {
903
930
  this.runAckWatchdogTimer = null, this.recoverMissedRunAck(t);
904
- }, Te);
931
+ }, Ie);
905
932
  }
906
933
  recoverMissedRunAck(t) {
907
- !this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== t || (f("web-sdk.agent", "Pluno run ack missed; resyncing session", {
934
+ !this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== t || (p("web-sdk.agent", "Pluno run ack missed; resyncing session", {
908
935
  sessionId: this.state.sessionId,
909
936
  clientMessageId: t
910
937
  }), this.resyncThinkingSession(), this.scheduleRunAckResyncRetry(t));
@@ -917,7 +944,7 @@ class Ut {
917
944
  status: this.state.status === "reconnecting" ? "reconnecting" : "connected",
918
945
  isThinking: !0,
919
946
  lastError: null
920
- }), f("web-sdk.agent", "Pluno run ack recovery retrying last user message", {
947
+ }), p("web-sdk.agent", "Pluno run ack recovery retrying last user message", {
921
948
  sessionId: this.state.sessionId,
922
949
  clientMessageId: t
923
950
  }), this.state.sessionId ? this.send({
@@ -925,7 +952,7 @@ class Ut {
925
952
  sessionId: this.state.sessionId,
926
953
  clientMessageId: t,
927
954
  automatic: !0
928
- }) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.scheduleThinkingWatchdog(ft)));
955
+ }) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.scheduleThinkingWatchdog(gt)));
929
956
  }, D(s)));
930
957
  }
931
958
  clearRunAckResyncRetryTimer() {
@@ -939,7 +966,7 @@ class Ut {
939
966
  return;
940
967
  const t = this.activeClientMessageId;
941
968
  if (!t) {
942
- f("web-sdk.agent", "Pluno thinking watchdog stopped without a recoverable message id", {
969
+ p("web-sdk.agent", "Pluno thinking watchdog stopped without a recoverable message id", {
943
970
  sessionId: this.state.sessionId
944
971
  }), this.setState({
945
972
  isThinking: !1,
@@ -950,7 +977,7 @@ class Ut {
950
977
  }
951
978
  const s = this.thinkingWatchdogResyncAttemptsByClientMessageId[t] ?? 0, n = this.retryAttemptsByClientMessageId[t] ?? 0;
952
979
  if (n >= U) {
953
- f("web-sdk.agent", "Pluno run recovery retry exhausted", {
980
+ p("web-sdk.agent", "Pluno run recovery retry exhausted", {
954
981
  sessionId: this.state.sessionId,
955
982
  clientMessageId: t
956
983
  }), this.retryableClientMessageId = t, this.setState({
@@ -961,18 +988,18 @@ class Ut {
961
988
  return;
962
989
  }
963
990
  if (s < 1) {
964
- this.thinkingWatchdogResyncAttemptsByClientMessageId[t] = s + 1, f("web-sdk.agent", "Pluno thinking watchdog resyncing session", {
991
+ this.thinkingWatchdogResyncAttemptsByClientMessageId[t] = s + 1, p("web-sdk.agent", "Pluno thinking watchdog resyncing session", {
965
992
  sessionId: this.state.sessionId,
966
993
  clientMessageId: t,
967
994
  resyncAttempts: s + 1
968
- }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(me);
995
+ }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(Te);
969
996
  return;
970
997
  }
971
998
  this.setState({
972
999
  status: this.state.status === "reconnecting" ? "reconnecting" : "connected",
973
1000
  isThinking: !0,
974
1001
  lastError: null
975
- }), f("web-sdk.agent", "Pluno thinking watchdog scheduling retry for last user message", {
1002
+ }), p("web-sdk.agent", "Pluno thinking watchdog scheduling retry for last user message", {
976
1003
  sessionId: this.state.sessionId,
977
1004
  clientMessageId: t,
978
1005
  retryAttempts: n + 1
@@ -989,7 +1016,7 @@ class Ut {
989
1016
  this.state.sessionId ? this.send({
990
1017
  type: "page.upsert",
991
1018
  sessionId: this.state.sessionId,
992
- page: A(),
1019
+ page: I(),
993
1020
  model: this.options.model
994
1021
  }) : (!this.socket || this.socket.readyState !== WebSocket.OPEN) && (this.setState({ status: "reconnecting", lastError: null }), this.scheduleReconnect());
995
1022
  }
@@ -997,15 +1024,15 @@ class Ut {
997
1024
  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;
998
1025
  if (!s || !n || !r)
999
1026
  return;
1000
- if (r !== "execute_code" || !Hs(o)) {
1027
+ if (r !== "execute_code" || !Fs(o)) {
1001
1028
  this.send({
1002
1029
  type: "tool.result",
1003
1030
  sessionId: s,
1004
1031
  callId: n,
1005
1032
  toolName: r,
1006
1033
  summary: i,
1007
- rawInput: I(o),
1008
- rawOutput: I({
1034
+ rawInput: w(o),
1035
+ rawOutput: w({
1009
1036
  ok: !1,
1010
1037
  toolName: r,
1011
1038
  error: `Unsupported browser tool: ${r}`
@@ -1013,7 +1040,7 @@ class Ut {
1013
1040
  });
1014
1041
  return;
1015
1042
  }
1016
- const c = Le(this.state.messages);
1043
+ const l = qe(this.state.messages);
1017
1044
  this.activeBrowserToolCalls.set(n, {
1018
1045
  event: {
1019
1046
  type: "tool.result",
@@ -1021,18 +1048,18 @@ class Ut {
1021
1048
  callId: n,
1022
1049
  toolName: r,
1023
1050
  summary: o.summary,
1024
- rawInput: I(o),
1051
+ rawInput: w(o),
1025
1052
  rawOutput: null
1026
1053
  },
1027
1054
  startedAtMs: Date.now(),
1028
1055
  startedAtUrl: location.href,
1029
1056
  startedAtOrigin: location.origin
1030
- }), this.installSessionUserFilesApi(c);
1031
- let a = null, h;
1032
- a = await this.executeRuntimeHelper(), h = await wt(o).catch((g) => ({
1057
+ }), this.installSessionUserFilesApi(l);
1058
+ let u = null, a;
1059
+ u = await this.executeRuntimeHelper(), a = await wt(o).catch((c) => ({
1033
1060
  ok: !1,
1034
1061
  exception: {
1035
- message: g instanceof Error ? g.message : String(g)
1062
+ message: c instanceof Error ? c.message : String(c)
1036
1063
  }
1037
1064
  })), this.activeBrowserToolCalls.delete(n), this.send({
1038
1065
  type: "tool.result",
@@ -1040,9 +1067,9 @@ class Ut {
1040
1067
  callId: n,
1041
1068
  toolName: r,
1042
1069
  summary: o.summary,
1043
- rawInput: I(o),
1044
- rawOutput: I(Qe(h, a))
1045
- }), Ms(this.options.clientId, this.activeBrowserToolCalls.values());
1070
+ rawInput: w(o),
1071
+ rawOutput: w(es(a, u))
1072
+ }), Us(this.options.clientId, this.activeBrowserToolCalls.values());
1046
1073
  }
1047
1074
  startPageLifecycleRecovery() {
1048
1075
  if (this.pageLifecycleCleanup)
@@ -1055,10 +1082,10 @@ class Ut {
1055
1082
  };
1056
1083
  }
1057
1084
  installSessionUserFilesApi(t) {
1058
- this.cleanupSessionUserFilesApi(), this.sessionUserFilesApiCleanup = Be(t, this.attachmentFiles, this.attachmentBlobCache);
1085
+ this.cleanupSessionUserFilesApi(), this.sessionUserFilesApiCleanup = He(t, this.attachmentFiles, this.attachmentBlobCache);
1059
1086
  }
1060
1087
  cleanupSessionUserFilesApi() {
1061
- this.sessionUserFilesApiCleanup && (qe(this.sessionUserFilesApiCleanup), this.sessionUserFilesApiCleanup = null);
1088
+ this.sessionUserFilesApiCleanup && (xe(this.sessionUserFilesApiCleanup), this.sessionUserFilesApiCleanup = null);
1062
1089
  }
1063
1090
  async executeRuntimeHelper() {
1064
1091
  if (!this.runtimeHelperJavascript?.trim())
@@ -1066,32 +1093,32 @@ class Ut {
1066
1093
  const t = await wt({
1067
1094
  javascript: this.runtimeHelperJavascript
1068
1095
  });
1069
- return t.ok === !1 ? ts(t) : null;
1096
+ return t.ok === !1 ? ss(t) : null;
1070
1097
  }
1071
1098
  enableNetworkCapture() {
1072
- this.networkCaptureCleanup || (this.networkCaptureCleanup = De((t) => {
1073
- zs(t.url, this.options.backendUrl) || this.enqueueNetworkEvent(t);
1099
+ this.networkCaptureCleanup || (this.networkCaptureCleanup = Oe((t) => {
1100
+ Xs(t.url, this.options.backendUrl) || this.enqueueNetworkEvent(t);
1074
1101
  }));
1075
1102
  }
1076
1103
  enqueueNetworkEvent(t) {
1077
- this.queuedNetworkEvents.length >= Ie || (this.queuedNetworkEvents.push($s(t)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
1104
+ this.queuedNetworkEvents.length >= Se || (this.queuedNetworkEvents.push(Gs(t)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
1078
1105
  this.networkBatchTimer = null;
1079
1106
  const s = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
1080
1107
  s.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
1081
1108
  type: "network.batch",
1082
1109
  sessionId: this.state.sessionId ?? void 0,
1083
- page: A(),
1110
+ page: I(),
1084
1111
  events: s
1085
1112
  });
1086
- }, we)));
1113
+ }, Ae)));
1087
1114
  }
1088
1115
  scheduleReconnect() {
1089
1116
  if (this.reconnectTimer !== null || this.state.status === "closed")
1090
1117
  return;
1091
- const t = Pe(this.reconnectAttempts);
1118
+ const t = De(this.reconnectAttempts);
1092
1119
  this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
1093
1120
  this.reconnectTimer = null, this.connect().catch((s) => {
1094
- f("web-sdk.agent", "Pluno reconnect failed; retrying", {
1121
+ p("web-sdk.agent", "Pluno reconnect failed; retrying", {
1095
1122
  message: s instanceof Error ? s.message : String(s),
1096
1123
  queuedClientEventCount: this.queuedClientEvents.length,
1097
1124
  isThinking: this.state.isThinking
@@ -1103,9 +1130,9 @@ class Ut {
1103
1130
  this.stopHeartbeat(), this.heartbeatTimer = window.setInterval(() => {
1104
1131
  const t = this.socket;
1105
1132
  !t || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
1106
- this.socket === t && (f("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(t));
1107
- }, de));
1108
- }, ue);
1133
+ this.socket === t && (p("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(t));
1134
+ }, pe));
1135
+ }, he);
1109
1136
  }
1110
1137
  stopHeartbeat() {
1111
1138
  this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
@@ -1130,61 +1157,61 @@ class Ut {
1130
1157
  ...this.state,
1131
1158
  ...t,
1132
1159
  ...t.lastError === null && t.lastErrorCode === void 0 ? { lastErrorCode: null } : {}
1133
- }, Cs(this.options.clientId, this.state), this.emit("state", this.getState());
1160
+ }, Ms(this.options.clientId, this.state), this.emit("state", this.getState());
1134
1161
  }
1135
1162
  emit(t, s) {
1136
1163
  this.listeners[t]?.forEach((r) => r(s));
1137
1164
  }
1138
1165
  }
1139
1166
  const K = /* @__PURE__ */ new WeakMap();
1140
- function De(e) {
1141
- const t = window.__plunoProductAgentNetworkCapture ?? Ne();
1167
+ function Oe(e) {
1168
+ const t = window.__plunoProductAgentNetworkCapture ?? ve();
1142
1169
  return t.subscribers.add(e), () => {
1143
1170
  t.subscribers.delete(e), !(t.subscribers.size > 0) && (t.destroy(), window.__plunoProductAgentNetworkCapture === t && delete window.__plunoProductAgentNetworkCapture);
1144
1171
  };
1145
1172
  }
1146
- function Ne() {
1147
- const e = /* @__PURE__ */ new Set(), t = (l) => {
1148
- e.forEach((p) => {
1173
+ function ve() {
1174
+ const e = /* @__PURE__ */ new Set(), t = (g) => {
1175
+ e.forEach((h) => {
1149
1176
  try {
1150
- p(l);
1177
+ h(g);
1151
1178
  } catch {
1152
1179
  }
1153
1180
  });
1154
- }, s = window.fetch, n = XMLHttpRequest.prototype.open, r = XMLHttpRequest.prototype.setRequestHeader, i = XMLHttpRequest.prototype.send, o = function(p, u) {
1181
+ }, s = window.fetch, n = XMLHttpRequest.prototype.open, r = XMLHttpRequest.prototype.setRequestHeader, i = XMLHttpRequest.prototype.send, o = function(h, d) {
1155
1182
  const m = Date.now();
1156
- let y;
1183
+ let T;
1157
1184
  try {
1158
- y = s.call(this, p, u);
1159
- } catch (w) {
1160
- throw w;
1185
+ T = s.call(this, h, d);
1186
+ } catch (y) {
1187
+ throw y;
1161
1188
  }
1162
1189
  try {
1163
- const w = p instanceof Request ? p : null, R = xs(p, w), T = xt(u?.headers ?? w?.headers);
1164
- if (!b(R, T, u?.body)) {
1190
+ const y = h instanceof Request ? h : null, P = Ws(h, y), C = xt(d?.headers ?? y?.headers);
1191
+ if (!_(P, C, d?.body)) {
1165
1192
  const $ = {
1166
1193
  requestId: V("fetch"),
1167
- url: k(R, X),
1168
- method: (u?.method ?? w?.method ?? "GET").toUpperCase(),
1169
- requestHeaders: T,
1170
- requestBody: Et(u?.body),
1194
+ url: S(P, X),
1195
+ method: (d?.method ?? y?.method ?? "GET").toUpperCase(),
1196
+ requestHeaders: C,
1197
+ requestBody: Et(d?.body),
1171
1198
  resourceType: "fetch",
1172
1199
  startedAt: new Date(m).toISOString()
1173
1200
  };
1174
- y.then(
1175
- (_) => {
1176
- Fs(_, $, m, t).catch(() => {
1201
+ T.then(
1202
+ (E) => {
1203
+ js(E, $, m, t).catch(() => {
1177
1204
  t({
1178
1205
  ...$,
1179
- responseStatus: _.status,
1206
+ responseStatus: E.status,
1180
1207
  durationMs: Date.now() - m
1181
1208
  });
1182
1209
  });
1183
1210
  },
1184
- (_) => {
1211
+ (E) => {
1185
1212
  t({
1186
1213
  ...$,
1187
- errorText: k(_ instanceof Error ? _.message : String(_)),
1214
+ errorText: S(E instanceof Error ? E.message : String(E)),
1188
1215
  durationMs: Date.now() - m
1189
1216
  });
1190
1217
  }
@@ -1192,43 +1219,43 @@ function Ne() {
1192
1219
  }
1193
1220
  } catch {
1194
1221
  }
1195
- return y;
1196
- }, c = function(p, u, m, y, w) {
1197
- const R = n.call(this, p, u, m ?? !0, y ?? void 0, w ?? void 0), T = typeof u == "string" ? u : u.toString();
1222
+ return T;
1223
+ }, l = function(h, d, m, T, y) {
1224
+ const P = n.call(this, h, d, m ?? !0, T ?? void 0, y ?? void 0), C = typeof d == "string" ? d : d.toString();
1198
1225
  return K.set(this, {
1199
1226
  requestId: V("xhr"),
1200
- method: String(p ?? "GET").toUpperCase(),
1201
- url: k(T, X),
1227
+ method: String(h ?? "GET").toUpperCase(),
1228
+ url: S(C, X),
1202
1229
  requestHeaders: {},
1203
1230
  startedAtMs: Date.now(),
1204
1231
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
1205
- excluded: b(T)
1206
- }), R;
1207
- }, a = function(p, u) {
1208
- const m = r.call(this, p, u), y = K.get(this);
1209
- return y && Object.keys(y.requestHeaders).length < at && (y.requestHeaders[p] = dt(p, u), y.excluded = y.excluded || b(y.url, y.requestHeaders)), m;
1210
- }, h = function(p) {
1232
+ excluded: _(C)
1233
+ }), P;
1234
+ }, u = function(h, d) {
1235
+ const m = r.call(this, h, d), T = K.get(this);
1236
+ return T && Object.keys(T.requestHeaders).length < at && (T.requestHeaders[h] = dt(h, d), T.excluded = T.excluded || _(T.url, T.requestHeaders)), m;
1237
+ }, a = function(h) {
1211
1238
  try {
1212
- const u = K.get(this);
1213
- u && (u.excluded = u.excluded || b(u.url, u.requestHeaders, p), u.requestBody = Et(p), u.excluded || this.addEventListener(
1239
+ const d = K.get(this);
1240
+ d && (d.excluded = d.excluded || _(d.url, d.requestHeaders, h), d.requestBody = Et(h), d.excluded || this.addEventListener(
1214
1241
  "loadend",
1215
1242
  () => {
1216
1243
  queueMicrotask(() => {
1217
1244
  try {
1218
- const m = Xs(this.getAllResponseHeaders());
1245
+ const m = Js(this.getAllResponseHeaders());
1219
1246
  t({
1220
- requestId: u.requestId,
1221
- url: u.url,
1222
- method: u.method,
1223
- requestHeaders: u.requestHeaders,
1224
- requestBody: u.requestBody,
1247
+ requestId: d.requestId,
1248
+ url: d.url,
1249
+ method: d.method,
1250
+ requestHeaders: d.requestHeaders,
1251
+ requestBody: d.requestBody,
1225
1252
  resourceType: "xhr",
1226
1253
  responseStatus: this.status,
1227
1254
  responseHeaders: m,
1228
- responseBody: js(this, m),
1255
+ responseBody: zs(this, m),
1229
1256
  errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
1230
- startedAt: u.startedAt,
1231
- durationMs: Date.now() - u.startedAtMs
1257
+ startedAt: d.startedAt,
1258
+ durationMs: Date.now() - d.startedAtMs
1232
1259
  });
1233
1260
  } catch {
1234
1261
  return;
@@ -1239,74 +1266,74 @@ function Ne() {
1239
1266
  ));
1240
1267
  } catch {
1241
1268
  }
1242
- return i.call(this, p ?? null);
1269
+ return i.call(this, h ?? null);
1243
1270
  };
1244
1271
  try {
1245
1272
  window.fetch = o;
1246
1273
  } catch {
1247
1274
  }
1248
1275
  try {
1249
- XMLHttpRequest.prototype.open = c;
1276
+ XMLHttpRequest.prototype.open = l;
1250
1277
  } catch {
1251
1278
  }
1252
1279
  try {
1253
- XMLHttpRequest.prototype.setRequestHeader = a;
1280
+ XMLHttpRequest.prototype.setRequestHeader = u;
1254
1281
  } catch {
1255
1282
  }
1256
1283
  try {
1257
- XMLHttpRequest.prototype.send = h;
1284
+ XMLHttpRequest.prototype.send = a;
1258
1285
  } catch {
1259
1286
  }
1260
- let g = null;
1287
+ let c = null;
1261
1288
  if (typeof PerformanceObserver < "u") {
1262
- g = new PerformanceObserver((l) => {
1263
- for (const p of l.getEntries()) {
1264
- const u = p;
1265
- if (u.initiatorType === "fetch" || u.initiatorType === "xmlhttprequest" || b(u.name))
1289
+ c = new PerformanceObserver((g) => {
1290
+ for (const h of g.getEntries()) {
1291
+ const d = h;
1292
+ if (d.initiatorType === "fetch" || d.initiatorType === "xmlhttprequest" || _(d.name))
1266
1293
  continue;
1267
- const m = performance.timeOrigin + u.startTime;
1294
+ const m = performance.timeOrigin + d.startTime;
1268
1295
  t({
1269
1296
  requestId: V("resource"),
1270
- url: k(u.name, X),
1297
+ url: S(d.name, X),
1271
1298
  method: "GET",
1272
1299
  resourceType: "resource",
1273
- responseStatus: u.responseStatus,
1300
+ responseStatus: d.responseStatus,
1274
1301
  startedAt: new Date(m).toISOString(),
1275
- durationMs: u.duration
1302
+ durationMs: d.duration
1276
1303
  });
1277
1304
  }
1278
1305
  });
1279
1306
  try {
1280
- g.observe({ type: "resource", buffered: !0 });
1307
+ c.observe({ type: "resource", buffered: !0 });
1281
1308
  } catch {
1282
- g.disconnect(), g = null;
1309
+ c.disconnect(), c = null;
1283
1310
  }
1284
1311
  }
1285
- const d = {
1312
+ const f = {
1286
1313
  subscribers: e,
1287
1314
  destroy: () => {
1288
- g?.disconnect();
1315
+ c?.disconnect();
1289
1316
  try {
1290
1317
  window.fetch === o && (window.fetch = s);
1291
1318
  } catch {
1292
1319
  }
1293
1320
  try {
1294
- XMLHttpRequest.prototype.open === c && (XMLHttpRequest.prototype.open = n);
1321
+ XMLHttpRequest.prototype.open === l && (XMLHttpRequest.prototype.open = n);
1295
1322
  } catch {
1296
1323
  }
1297
1324
  try {
1298
- XMLHttpRequest.prototype.setRequestHeader === a && (XMLHttpRequest.prototype.setRequestHeader = r);
1325
+ XMLHttpRequest.prototype.setRequestHeader === u && (XMLHttpRequest.prototype.setRequestHeader = r);
1299
1326
  } catch {
1300
1327
  }
1301
1328
  try {
1302
- XMLHttpRequest.prototype.send === h && (XMLHttpRequest.prototype.send = i);
1329
+ XMLHttpRequest.prototype.send === a && (XMLHttpRequest.prototype.send = i);
1303
1330
  } catch {
1304
1331
  }
1305
1332
  }
1306
1333
  };
1307
- return window.__plunoProductAgentNetworkCapture = d, d;
1334
+ return window.__plunoProductAgentNetworkCapture = f, f;
1308
1335
  }
1309
- function f(e, t, s) {
1336
+ function p(e, t, s) {
1310
1337
  if (typeof window > "u")
1311
1338
  return;
1312
1339
  const n = window, r = {
@@ -1321,11 +1348,11 @@ function yt(e) {
1321
1348
  const t = typeof e == "function" ? e() : e;
1322
1349
  return t && Object.keys(t).length > 0 ? t : void 0;
1323
1350
  }
1324
- function Oe(e) {
1351
+ function Le(e) {
1325
1352
  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";
1326
1353
  }
1327
- const ve = 5e3;
1328
- function Le(e) {
1354
+ const Be = 5e3;
1355
+ function qe(e) {
1329
1356
  const t = [];
1330
1357
  for (const s of e)
1331
1358
  s.role !== "user" || !s.attachments?.length || s.attachments.forEach((n, r) => {
@@ -1336,112 +1363,99 @@ function Le(e) {
1336
1363
  });
1337
1364
  return t;
1338
1365
  }
1339
- function Be(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
1340
- const n = new Map(e.map((d) => [d.id, d])), r = (d) => ({
1341
- id: d.id,
1342
- name: d.name,
1343
- mimeType: d.mimeType,
1344
- sizeBytes: d.sizeBytes,
1345
- type: d.mimeType,
1346
- size: d.sizeBytes
1347
- }), i = (d) => {
1348
- const l = n.get(d);
1349
- if (!l)
1350
- throw new Error(`Unknown Pluno user file: ${d}`);
1351
- return l;
1352
- }, o = async (d) => {
1353
- const l = i(d), p = t.get(l.id);
1354
- if (p)
1355
- return p;
1356
- const u = s.get(l.id);
1357
- if (u)
1358
- return u;
1359
- const m = await Jt(l.id).then((T) => T?.blob ?? null).catch((T) => (f("web-sdk.attachments", "Failed to load Product Agent attachment from IndexedDB", {
1360
- attachmentId: l.id,
1361
- name: l.name,
1362
- message: T instanceof Error ? T.message : String(T)
1366
+ function He(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
1367
+ const n = new Map(e.map((a) => [a.id, a])), r = (a) => ({
1368
+ id: a.id,
1369
+ name: a.name,
1370
+ mimeType: a.mimeType,
1371
+ sizeBytes: a.sizeBytes,
1372
+ type: a.mimeType,
1373
+ size: a.sizeBytes
1374
+ }), i = (a) => {
1375
+ const c = n.get(a);
1376
+ if (!c)
1377
+ throw new Error(`Unknown Pluno user file: ${a}`);
1378
+ return c;
1379
+ }, o = async (a) => {
1380
+ const c = i(a), f = t.get(c.id);
1381
+ if (f)
1382
+ return f;
1383
+ const g = s.get(c.id);
1384
+ if (g)
1385
+ return g;
1386
+ const h = await Jt(c.id).then((y) => y?.blob ?? null).catch((y) => (p("web-sdk.attachments", "Failed to load Product Agent attachment from IndexedDB", {
1387
+ attachmentId: c.id,
1388
+ name: c.name,
1389
+ message: y instanceof Error ? y.message : String(y)
1363
1390
  }), null));
1364
- if (m)
1365
- return s.set(l.id, m), m;
1366
- if (!l.fileUrl)
1367
- throw new Error(`Pluno user file is missing content: ${d}`);
1368
- const y = await fetch(l.fileUrl, Os(l.fileUrl));
1369
- if (!y.ok)
1370
- throw new Error(`Failed to load Pluno user file: ${d}`);
1371
- const w = await y.blob();
1372
- s.set(l.id, w);
1373
- const R = Date.now();
1391
+ if (h)
1392
+ return s.set(c.id, h), h;
1393
+ if (!c.fileUrl)
1394
+ throw new Error(`Pluno user file is missing content: ${a}`);
1395
+ const d = await fetch(c.fileUrl, Ls(c.fileUrl));
1396
+ if (!d.ok)
1397
+ throw new Error(`Failed to load Pluno user file: ${a}`);
1398
+ const m = await d.blob();
1399
+ s.set(c.id, m);
1400
+ const T = Date.now();
1374
1401
  return _t({
1375
- attachmentId: l.id,
1376
- name: l.name,
1377
- mimeType: l.mimeType,
1378
- sizeBytes: l.sizeBytes,
1379
- blob: w,
1380
- fileUrl: l.fileUrl,
1381
- gcsPath: l.gcsPath,
1382
- createdAt: R,
1383
- lastUsedAt: R
1384
- }).catch((T) => {
1385
- f("web-sdk.attachments", "Failed to cache Product Agent attachment from fileUrl", {
1386
- attachmentId: l.id,
1387
- name: l.name,
1388
- message: T instanceof Error ? T.message : String(T)
1402
+ attachmentId: c.id,
1403
+ name: c.name,
1404
+ mimeType: c.mimeType,
1405
+ sizeBytes: c.sizeBytes,
1406
+ blob: m,
1407
+ fileUrl: c.fileUrl,
1408
+ gcsPath: c.gcsPath,
1409
+ createdAt: T,
1410
+ lastUsedAt: T
1411
+ }).catch((y) => {
1412
+ p("web-sdk.attachments", "Failed to cache Product Agent attachment from fileUrl", {
1413
+ attachmentId: c.id,
1414
+ name: c.name,
1415
+ message: y instanceof Error ? y.message : String(y)
1389
1416
  });
1390
- }), w;
1391
- }, c = async (d) => {
1392
- const l = i(d), p = await o(d), u = l.mimeType.startsWith("image/") ? l.mimeType : p.type || l.mimeType;
1393
- if (!u.startsWith("image/"))
1394
- throw new Error(`Pluno user file is not an image: ${d}`);
1395
- const m = p.type === u ? p : new Blob([p], { type: u });
1396
- return He(u, m.size) > _e ? {
1397
- type: "pluno.userFiles.inspectImage",
1398
- id: l.id,
1399
- name: l.name,
1400
- mimeType: u,
1401
- sizeBytes: l.sizeBytes,
1402
- imageAttached: !1,
1403
- imageAttachmentError: Ce
1404
- } : {
1405
- type: "pluno.userFiles.inspectImage",
1406
- id: l.id,
1407
- name: l.name,
1408
- mimeType: u,
1409
- sizeBytes: l.sizeBytes,
1410
- imageAttached: !0,
1411
- dataUrl: await Tt(m)
1412
- };
1413
- }, a = globalThis, h = a.pluno?.userFiles, g = Object.prototype.hasOwnProperty.call(a.pluno ?? {}, "userFiles");
1414
- return a.pluno = {
1415
- ...a.pluno ?? {},
1416
- userFiles: {
1417
- list: () => e.map(r),
1418
- get: (d) => {
1419
- const l = n.get(d);
1420
- return l ? r(l) : null;
1421
- },
1422
- inspectImage: c,
1423
- getDataUrl: async (d) => (i(d), await Tt(await o(d))),
1424
- getBlob: o,
1425
- getArrayBuffer: async (d) => await (await o(d)).arrayBuffer(),
1426
- getFile: async (d) => {
1427
- const l = i(d);
1428
- return new File([await o(d)], l.name, { type: l.mimeType });
1429
- }
1430
- }
1431
- }, () => {
1432
- const d = a.pluno ?? {};
1433
- if (g) {
1434
- a.pluno = {
1435
- ...d,
1436
- userFiles: h
1417
+ }), m;
1418
+ };
1419
+ return Zt(globalThis, "userFiles", {
1420
+ list: () => e.map(r),
1421
+ get: (a) => {
1422
+ const c = n.get(a);
1423
+ return c ? r(c) : null;
1424
+ },
1425
+ inspectImage: async (a) => {
1426
+ const c = i(a), f = await o(a), g = c.mimeType.startsWith("image/") ? c.mimeType : f.type || c.mimeType;
1427
+ if (!g.startsWith("image/"))
1428
+ throw new Error(`Pluno user file is not an image: ${a}`);
1429
+ const h = f.type === g ? f : new Blob([f], { type: g });
1430
+ return Fe(g, h.size) > be ? {
1431
+ type: "pluno.userFiles.inspectImage",
1432
+ id: c.id,
1433
+ name: c.name,
1434
+ mimeType: g,
1435
+ sizeBytes: c.sizeBytes,
1436
+ imageAttached: !1,
1437
+ imageAttachmentError: Me
1438
+ } : {
1439
+ type: "pluno.userFiles.inspectImage",
1440
+ id: c.id,
1441
+ name: c.name,
1442
+ mimeType: g,
1443
+ sizeBytes: c.sizeBytes,
1444
+ imageAttached: !0,
1445
+ dataUrl: await Tt(h)
1437
1446
  };
1438
- return;
1447
+ },
1448
+ getDataUrl: async (a) => (i(a), await Tt(await o(a))),
1449
+ getBlob: o,
1450
+ getArrayBuffer: async (a) => await (await o(a)).arrayBuffer(),
1451
+ getFile: async (a) => {
1452
+ const c = i(a);
1453
+ return new File([await o(a)], c.name, { type: c.mimeType });
1439
1454
  }
1440
- const { userFiles: l, ...p } = d;
1441
- a.pluno = p;
1442
- };
1455
+ }) ?? (() => {
1456
+ });
1443
1457
  }
1444
- function qe(e) {
1458
+ function xe(e) {
1445
1459
  try {
1446
1460
  e();
1447
1461
  } catch {
@@ -1459,32 +1473,32 @@ function Tt(e) {
1459
1473
  }, n.onerror = () => s(n.error ?? new Error("Failed to read Pluno user file")), n.readAsDataURL(e);
1460
1474
  });
1461
1475
  }
1462
- function He(e, t) {
1476
+ function Fe(e, t) {
1463
1477
  return `data:${e};base64,`.length + Math.ceil(t / 3) * 4;
1464
1478
  }
1465
1479
  async function wt(e) {
1466
1480
  const t = Object.getPrototypeOf(async function() {
1467
- }).constructor, s = e.timeoutMs ?? ve, n = Date.now(), r = [];
1481
+ }).constructor, s = e.timeoutMs ?? Be, n = Date.now(), r = [];
1468
1482
  let i;
1469
1483
  const o = {
1470
1484
  log: console.log,
1471
1485
  info: console.info,
1472
1486
  warn: console.warn,
1473
1487
  error: console.error
1474
- }, c = (a) => (...h) => {
1475
- r.push({ level: a, args: h }), o[a](...h);
1488
+ }, l = (u) => (...a) => {
1489
+ r.push({ level: u, args: a }), o[u](...a);
1476
1490
  };
1477
- console.log = c("log"), console.info = c("info"), console.warn = c("warn"), console.error = c("error");
1491
+ console.log = l("log"), console.info = l("info"), console.warn = l("warn"), console.error = l("error");
1478
1492
  try {
1479
- const a = /* @__PURE__ */ Symbol("execute_code_timeout"), h = await Promise.race([
1493
+ const u = /* @__PURE__ */ Symbol("execute_code_timeout"), a = await Promise.race([
1480
1494
  new t(e.javascript)(),
1481
- new Promise((g) => {
1482
- i = window.setTimeout(() => g(a), s);
1495
+ new Promise((c) => {
1496
+ i = window.setTimeout(() => c(u), s);
1483
1497
  })
1484
1498
  ]);
1485
- return h === a ? xe(s) : {
1499
+ return a === u ? We(s) : {
1486
1500
  ok: !0,
1487
- result: h,
1501
+ result: a,
1488
1502
  console: r,
1489
1503
  metadata: {
1490
1504
  durationMs: Date.now() - n,
@@ -1492,14 +1506,14 @@ async function wt(e) {
1492
1506
  origin: location.origin
1493
1507
  }
1494
1508
  };
1495
- } catch (a) {
1509
+ } catch (u) {
1496
1510
  return {
1497
1511
  ok: !1,
1498
1512
  console: r,
1499
1513
  exception: {
1500
- name: a instanceof Error ? a.name : "Error",
1501
- message: a instanceof Error ? a.message : String(a),
1502
- stack: a instanceof Error ? a.stack : void 0
1514
+ name: u instanceof Error ? u.name : "Error",
1515
+ message: u instanceof Error ? u.message : String(u),
1516
+ stack: u instanceof Error ? u.stack : void 0
1503
1517
  },
1504
1518
  metadata: {
1505
1519
  durationMs: Date.now() - n,
@@ -1511,7 +1525,7 @@ async function wt(e) {
1511
1525
  i !== void 0 && window.clearTimeout(i), console.log = o.log, console.info = o.info, console.warn = o.warn, console.error = o.error;
1512
1526
  }
1513
1527
  }
1514
- function xe(e) {
1528
+ function We(e) {
1515
1529
  return {
1516
1530
  ok: !1,
1517
1531
  exception: {
@@ -1525,17 +1539,17 @@ function xe(e) {
1525
1539
  }
1526
1540
  };
1527
1541
  }
1528
- function Fe(e) {
1542
+ function je(e) {
1529
1543
  return e.replace(/\/+$/, "");
1530
1544
  }
1531
- function We(e, t = location.origin) {
1545
+ function $e(e, t = location.origin) {
1532
1546
  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;
1533
1547
  }
1534
- function je(e) {
1548
+ function ze(e) {
1535
1549
  const t = new URL("/api/product-agent/embed/ws", e);
1536
1550
  return t.protocol = t.protocol === "https:" ? "wss:" : "ws:", t.toString();
1537
1551
  }
1538
- function A() {
1552
+ function I() {
1539
1553
  const e = Dt();
1540
1554
  return {
1541
1555
  url: location.href,
@@ -1544,19 +1558,19 @@ function A() {
1544
1558
  ...e ? { plunoProductAgentUi: e } : {}
1545
1559
  };
1546
1560
  }
1547
- function $e() {
1561
+ function Ge() {
1548
1562
  return {
1549
1563
  pageUrl: location.href,
1550
1564
  pageTitle: document.title,
1551
- htmlContent: Ke()
1565
+ htmlContent: Ve()
1552
1566
  };
1553
1567
  }
1554
- function ze(e) {
1555
- return L.add(e), N || (N = Ge()), () => {
1568
+ function Xe(e) {
1569
+ return L.add(e), N || (N = Ke()), () => {
1556
1570
  L.delete(e), L.size === 0 && (N?.(), N = null);
1557
1571
  };
1558
1572
  }
1559
- function Ge() {
1573
+ function Ke() {
1560
1574
  const e = () => {
1561
1575
  for (const i of Array.from(L))
1562
1576
  i();
@@ -1571,10 +1585,10 @@ function Ge() {
1571
1585
  window.history.pushState === n && (window.history.pushState = t), window.history.replaceState === r && (window.history.replaceState = s), window.removeEventListener("popstate", e), window.removeEventListener("hashchange", e);
1572
1586
  };
1573
1587
  }
1574
- function Xe() {
1588
+ function Je() {
1575
1589
  return Dt()?.surface === "browser_extension_sdk_preview";
1576
1590
  }
1577
- function Ke() {
1591
+ function Ve() {
1578
1592
  const e = document.body?.cloneNode(!0);
1579
1593
  return e instanceof HTMLElement ? (e.querySelectorAll(
1580
1594
  [
@@ -1614,23 +1628,23 @@ function Dt() {
1614
1628
  },
1615
1629
  {
1616
1630
  name: "widget_root",
1617
- selector: ie,
1631
+ selector: ae,
1618
1632
  description: "Finds Pluno's widget root inside the widget host shadow root."
1619
1633
  },
1620
1634
  {
1621
1635
  name: "widget_panel",
1622
- selector: oe,
1636
+ selector: ce,
1623
1637
  description: "Finds Pluno's open chat panel inside the widget host shadow root."
1624
1638
  },
1625
1639
  {
1626
1640
  name: "widget_timeline",
1627
- selector: ae,
1641
+ selector: le,
1628
1642
  description: "Finds Pluno's chat timeline inside the widget host shadow root."
1629
1643
  }
1630
1644
  ]
1631
1645
  };
1632
1646
  }
1633
- function Je(e) {
1647
+ function Ye(e) {
1634
1648
  try {
1635
1649
  const t = JSON.parse(e);
1636
1650
  return t && typeof t == "object" ? t : { type: "error", message: "Invalid server event" };
@@ -1644,27 +1658,27 @@ function It(e, t) {
1644
1658
  const s = e[t];
1645
1659
  return Array.isArray(s) ? s.filter((n) => typeof n == "string" && n.trim().length > 0) : [];
1646
1660
  }
1647
- function Ve(e) {
1661
+ function Ze(e) {
1648
1662
  return Array.isArray(e) ? e.filter((t) => typeof t == "string" && t.trim().length > 0) : [];
1649
1663
  }
1650
- function Ye(e) {
1664
+ function Qe(e) {
1651
1665
  if (!e || typeof e != "object")
1652
1666
  return null;
1653
- const t = e, s = t.appearance, n = s && typeof s == "object" ? s : t, r = typeof n.accentColor == "string" ? n.accentColor : null, i = n.colorScheme === "dark" ? "dark" : n.colorScheme === "light" ? "light" : null, o = typeof n.fontFamily == "string" && n.fontFamily.trim() ? n.fontFamily : null, c = typeof n.scribbleStyle == "boolean" ? n.scribbleStyle : null;
1654
- return !r && !i && !o && c === null ? null : {
1667
+ const t = e, s = t.appearance, n = s && typeof s == "object" ? s : t, r = typeof n.accentColor == "string" ? n.accentColor : null, i = n.colorScheme === "dark" ? "dark" : n.colorScheme === "light" ? "light" : null, o = typeof n.fontFamily == "string" && n.fontFamily.trim() ? n.fontFamily : null, l = typeof n.scribbleStyle == "boolean" ? n.scribbleStyle : null;
1668
+ return !r && !i && !o && l === null ? null : {
1655
1669
  ...r ? { accentColor: r } : {},
1656
1670
  ...i ? { colorScheme: i } : {},
1657
1671
  ...o ? { fontFamily: o } : {},
1658
- ...c !== null ? { scribbleStyle: c } : {}
1672
+ ...l !== null ? { scribbleStyle: l } : {}
1659
1673
  };
1660
1674
  }
1661
- function Ze(e) {
1675
+ function ts(e) {
1662
1676
  if (!e || typeof e != "object")
1663
1677
  return null;
1664
1678
  const t = e.javascript;
1665
1679
  return typeof t != "string" || !t.trim() ? null : { javascript: t };
1666
1680
  }
1667
- function Qe(e, t) {
1681
+ function es(e, t) {
1668
1682
  return t ? e && typeof e == "object" ? {
1669
1683
  ...e,
1670
1684
  helperError: t
@@ -1674,13 +1688,13 @@ function Qe(e, t) {
1674
1688
  helperError: t
1675
1689
  } : e;
1676
1690
  }
1677
- function ts(e) {
1691
+ function ss(e) {
1678
1692
  if (!e || typeof e != "object")
1679
1693
  return e;
1680
1694
  const t = e;
1681
1695
  return typeof t.exception?.message == "string" ? t.exception.message : typeof t.error == "string" ? t.error : e;
1682
1696
  }
1683
- function es() {
1697
+ function ns() {
1684
1698
  const e = "pluno.productAgent.clientId", t = window.localStorage.getItem(e);
1685
1699
  if (t)
1686
1700
  return t;
@@ -1690,7 +1704,7 @@ function es() {
1690
1704
  function O() {
1691
1705
  return crypto.randomUUID();
1692
1706
  }
1693
- function ss(e) {
1707
+ function rs(e) {
1694
1708
  if (!e || typeof e != "object")
1695
1709
  return null;
1696
1710
  const t = e, s = typeof t.id == "string" ? t.id : null;
@@ -1701,23 +1715,23 @@ function ss(e) {
1701
1715
  avatarUrl: typeof t.avatarUrl == "string" ? t.avatarUrl : null
1702
1716
  } : null;
1703
1717
  }
1704
- function ns(e, t) {
1718
+ function is(e, t) {
1705
1719
  return Array.isArray(e) ? st(
1706
1720
  nt(
1707
1721
  e.map((s) => Nt(s, t)).filter((s) => s !== null)
1708
1722
  )
1709
1723
  ) : [];
1710
1724
  }
1711
- function rs(e) {
1725
+ function os(e) {
1712
1726
  return Array.isArray(e) ? e.flatMap((t) => {
1713
1727
  if (!t || typeof t != "object")
1714
1728
  return [];
1715
- const s = t, n = S(s, "id"), r = S(s, "createdAt"), i = S(s, "updatedAt"), o = S(s, "lastActiveAt");
1729
+ const s = t, n = A(s, "id"), r = A(s, "createdAt"), i = A(s, "updatedAt"), o = A(s, "lastActiveAt");
1716
1730
  return !n || !r || !i || !o ? [] : [
1717
1731
  {
1718
1732
  id: n,
1719
- title: S(s, "title"),
1720
- firstUserMessage: S(s, "firstUserMessage"),
1733
+ title: A(s, "title"),
1734
+ firstUserMessage: A(s, "firstUserMessage"),
1721
1735
  currentPage: s.currentPage ?? null,
1722
1736
  createdAt: r,
1723
1737
  updatedAt: i,
@@ -1738,39 +1752,39 @@ function Nt(e, t) {
1738
1752
  return {
1739
1753
  id: String(s.id ?? crypto.randomUUID()),
1740
1754
  role: i,
1741
- content: ls(r.content),
1755
+ content: ds(r.content),
1742
1756
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
1743
1757
  respondsToUserMessageId: J(r) ?? void 0,
1744
- ...C(r) ? { runId: C(r) } : {},
1758
+ ...R(r) ? { runId: R(r) } : {},
1745
1759
  attachments: qt(r.attachments, t)
1746
1760
  };
1747
1761
  }
1748
1762
  return r.type === "function_call" || r.type === "tool_call" || r.type === "web_search_call" ? {
1749
1763
  id: String(s.id ?? crypto.randomUUID()),
1750
1764
  role: "tool",
1751
- content: os(r),
1765
+ content: cs(r),
1752
1766
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
1753
1767
  respondsToUserMessageId: J(r) ?? void 0,
1754
- ...C(r) ? { runId: C(r) } : {},
1768
+ ...R(r) ? { runId: R(r) } : {},
1755
1769
  dataType: String(r.type),
1756
1770
  toolName: typeof r.name == "string" ? r.name : void 0,
1757
- callId: cs(r) ?? void 0,
1771
+ callId: us(r) ?? void 0,
1758
1772
  loading: r.localExecutionStatus === "running"
1759
1773
  } : r.type === "run_status" || r.type === "run_error" ? r.type === "run_error" && r.stage === "tool_execution" ? null : {
1760
1774
  id: String(s.id ?? crypto.randomUUID()),
1761
1775
  role: "system",
1762
- content: is(r),
1776
+ content: as(r),
1763
1777
  createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
1764
1778
  respondsToUserMessageId: J(r) ?? void 0,
1765
- ...C(r) ? { runId: C(r) } : {},
1779
+ ...R(r) ? { runId: R(r) } : {},
1766
1780
  dataType: String(r.type),
1767
1781
  loading: r.type === "run_status" && (r.status === "running" || r.status === "retrying")
1768
1782
  } : null;
1769
1783
  }
1770
- function is(e) {
1784
+ function as(e) {
1771
1785
  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.";
1772
1786
  }
1773
- function os(e) {
1787
+ function cs(e) {
1774
1788
  if (e.type === "web_search_call") {
1775
1789
  const t = e.action;
1776
1790
  if (t && typeof t == "object") {
@@ -1782,9 +1796,9 @@ function os(e) {
1782
1796
  }
1783
1797
  return "Searching the web";
1784
1798
  }
1785
- return as(e);
1799
+ return ls(e);
1786
1800
  }
1787
- function as(e) {
1801
+ function ls(e) {
1788
1802
  if (typeof e.summary == "string" && e.summary.trim().length > 0)
1789
1803
  return e.summary;
1790
1804
  if (typeof e.arguments == "string")
@@ -1797,11 +1811,11 @@ function as(e) {
1797
1811
  }
1798
1812
  return typeof e.name == "string" && e.name.trim().length > 0 ? e.name : "Run tool";
1799
1813
  }
1800
- function cs(e) {
1814
+ function us(e) {
1801
1815
  const t = e.callId ?? e.call_id;
1802
1816
  return typeof t == "string" && t ? t : null;
1803
1817
  }
1804
- function ls(e) {
1818
+ function ds(e) {
1805
1819
  return typeof e == "string" ? e : Array.isArray(e) ? e.map((t) => {
1806
1820
  if (!t || typeof t != "object")
1807
1821
  return "";
@@ -1809,8 +1823,8 @@ function ls(e) {
1809
1823
  return typeof s.text == "string" ? s.text : typeof s.content == "string" ? s.content : "";
1810
1824
  }).filter(Boolean).join("") : "";
1811
1825
  }
1812
- function us(e, t) {
1813
- const s = Ot(e, t), n = gs(e, t), r = n.findIndex((o) => o.id === s.id);
1826
+ function hs(e, t) {
1827
+ const s = Ot(e, t), n = ms(e, t), r = n.findIndex((o) => o.id === s.id);
1814
1828
  if (r === -1)
1815
1829
  return st(
1816
1830
  nt([...n, s])
@@ -1818,7 +1832,7 @@ function us(e, t) {
1818
1832
  const i = [...n];
1819
1833
  return i[r] = s, st(nt(i));
1820
1834
  }
1821
- function ds(e, t) {
1835
+ function ps(e, t) {
1822
1836
  const s = t.map(
1823
1837
  (n) => Ot(e, n)
1824
1838
  );
@@ -1835,19 +1849,19 @@ function Ot(e, t) {
1835
1849
  if (!s?.attachments?.length)
1836
1850
  return t;
1837
1851
  const n = t.attachments.map((r) => {
1838
- const i = hs(s.attachments ?? [], r);
1839
- return i ? ps(r, i) : r;
1852
+ const i = fs(s.attachments ?? [], r);
1853
+ return i ? gs(r, i) : r;
1840
1854
  });
1841
1855
  return { ...t, attachments: n };
1842
1856
  }
1843
- function hs(e, t) {
1857
+ function fs(e, t) {
1844
1858
  return t.id ? e.find((s) => s.id === t.id) ?? null : null;
1845
1859
  }
1846
- function ps(e, t) {
1860
+ function gs(e, t) {
1847
1861
  const { previewUrl: s } = t;
1848
1862
  return s ? { ...e, previewUrl: s } : e;
1849
1863
  }
1850
- function gs(e, t) {
1864
+ function ms(e, t) {
1851
1865
  if (t.role !== "user")
1852
1866
  return e;
1853
1867
  const s = e.findIndex(
@@ -1875,7 +1889,7 @@ function At(e) {
1875
1889
  }
1876
1890
  return !1;
1877
1891
  }
1878
- function fs(e) {
1892
+ function ys(e) {
1879
1893
  const t = vt(e);
1880
1894
  return t === null ? e.some((s) => s.role === "assistant") : e.slice(t + 1).some((s) => s.role === "assistant");
1881
1895
  }
@@ -1885,7 +1899,7 @@ function vt(e) {
1885
1899
  return t;
1886
1900
  return null;
1887
1901
  }
1888
- function ms(e) {
1902
+ function Ts(e) {
1889
1903
  return e.role === "assistant" ? !0 : e.role !== "system" ? !1 : e.dataType === "run_error" ? !0 : e.dataType === "run_status" && e.loading !== !0;
1890
1904
  }
1891
1905
  function ct(e) {
@@ -1902,7 +1916,7 @@ function ct(e) {
1902
1916
  }
1903
1917
  return null;
1904
1918
  }
1905
- function ys(e, t) {
1919
+ function ws(e, t) {
1906
1920
  const s = ct(t);
1907
1921
  if (s === null)
1908
1922
  return !1;
@@ -1910,7 +1924,7 @@ function ys(e, t) {
1910
1924
  if (typeof r != "string" || !r)
1911
1925
  return !1;
1912
1926
  const i = e.findIndex((o) => o.role === "user" && o.id === r);
1913
- return i === -1 ? !1 : e.slice(i + 1).some(ms);
1927
+ return i === -1 ? !1 : e.slice(i + 1).some(Ts);
1914
1928
  }
1915
1929
  function et(e) {
1916
1930
  const t = ct(e);
@@ -1925,7 +1939,7 @@ function et(e) {
1925
1939
  const r = n.clientMessageId;
1926
1940
  return typeof r == "string" ? r : null;
1927
1941
  }
1928
- function Ts(e) {
1942
+ function Is(e) {
1929
1943
  const t = ct(e);
1930
1944
  if (t === null)
1931
1945
  return null;
@@ -1946,7 +1960,7 @@ function Ts(e) {
1946
1960
  }
1947
1961
  return null;
1948
1962
  }
1949
- function ws(e, t) {
1963
+ function As(e, t) {
1950
1964
  let s = 0;
1951
1965
  for (const n of e) {
1952
1966
  if (!n || typeof n != "object")
@@ -1959,16 +1973,16 @@ function ws(e, t) {
1959
1973
  }
1960
1974
  return s;
1961
1975
  }
1962
- function Is(e) {
1976
+ function Ss(e) {
1963
1977
  if (!e || typeof e != "object")
1964
1978
  return !1;
1965
1979
  const t = e;
1966
1980
  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";
1967
1981
  }
1968
1982
  function st(e) {
1969
- return e.filter((t, s) => Lt(t) ? !Rs(e, s) && !ks(e, s) && !Es(e, s) : As(t) ? !Ss(e, s) : !0);
1983
+ return e.filter((t, s) => Lt(t) ? !Cs(e, s) && !Rs(e, s) && !_s(e, s) : ks(t) ? !Es(e, s) : !0);
1970
1984
  }
1971
- function As(e) {
1985
+ function ks(e) {
1972
1986
  return e.role === "system" && (e.dataType === "run_status" || e.dataType === "run_error");
1973
1987
  }
1974
1988
  function Lt(e) {
@@ -1990,7 +2004,7 @@ function nt(e) {
1990
2004
  n.has(i.id) || (r.push(i), i.role === "user" && r.push(...s.get(i.id) ?? []));
1991
2005
  return r;
1992
2006
  }
1993
- function Ss(e, t) {
2007
+ function Es(e, t) {
1994
2008
  const s = e[t];
1995
2009
  for (let n = t + 1; n < e.length; n += 1) {
1996
2010
  const r = e[n];
@@ -2001,21 +2015,21 @@ function Ss(e, t) {
2001
2015
  }
2002
2016
  return !1;
2003
2017
  }
2004
- function ks(e, t) {
2018
+ function Rs(e, t) {
2005
2019
  const s = e[t];
2006
2020
  for (let n = t + 1; n < e.length; n += 1)
2007
2021
  if (e[n].role === "assistant" && W(s, e[n]))
2008
2022
  return !0;
2009
2023
  return !1;
2010
2024
  }
2011
- function Es(e, t) {
2025
+ function _s(e, t) {
2012
2026
  const s = e[t];
2013
2027
  for (let n = t + 1; n < e.length; n += 1)
2014
2028
  if (e[n].role === "tool" && W(s, e[n]))
2015
2029
  return !0;
2016
2030
  return !1;
2017
2031
  }
2018
- function Rs(e, t) {
2032
+ function Cs(e, t) {
2019
2033
  const s = e[t];
2020
2034
  for (let n = t + 1; n < e.length; n += 1)
2021
2035
  if (Lt(e[n]) && W(s, e[n]))
@@ -2025,10 +2039,10 @@ function Rs(e, t) {
2025
2039
  function W(e, t) {
2026
2040
  return !e.runId || !t.runId ? !0 : e.runId === t.runId;
2027
2041
  }
2028
- function S(e, t) {
2042
+ function A(e, t) {
2029
2043
  return e && typeof e == "object" && typeof e[t] == "string" ? e[t] : null;
2030
2044
  }
2031
- function _s(e, t) {
2045
+ function bs(e, t) {
2032
2046
  try {
2033
2047
  const s = window.localStorage.getItem(`${Pt}${e}`);
2034
2048
  if (!s)
@@ -2036,7 +2050,7 @@ function _s(e, t) {
2036
2050
  const n = JSON.parse(s), r = typeof n.sessionId == "string" ? n.sessionId : null;
2037
2051
  if (t !== void 0 && r !== t)
2038
2052
  return null;
2039
- const i = Array.isArray(n.messages) ? n.messages.map(Bs).filter((o) => !!o) : [];
2053
+ const i = Array.isArray(n.messages) ? n.messages.map(Hs).filter((o) => !!o) : [];
2040
2054
  return {
2041
2055
  sessionId: r,
2042
2056
  messages: i
@@ -2045,20 +2059,20 @@ function _s(e, t) {
2045
2059
  return null;
2046
2060
  }
2047
2061
  }
2048
- function Cs(e, t) {
2062
+ function Ms(e, t) {
2049
2063
  try {
2050
2064
  window.localStorage.setItem(
2051
2065
  `${Pt}${e}`,
2052
2066
  JSON.stringify({
2053
2067
  sessionId: t.sessionId,
2054
- messages: t.messages.slice(-be).map(qs)
2068
+ messages: t.messages.slice(-Pe).map(xs)
2055
2069
  })
2056
2070
  );
2057
2071
  } catch {
2058
2072
  return;
2059
2073
  }
2060
2074
  }
2061
- function bs(e) {
2075
+ function Ps(e) {
2062
2076
  try {
2063
2077
  const t = window.localStorage.getItem(`${tt}${e}`);
2064
2078
  if (!t)
@@ -2069,7 +2083,7 @@ function bs(e) {
2069
2083
  return [];
2070
2084
  }
2071
2085
  }
2072
- function P(e, t) {
2086
+ function M(e, t) {
2073
2087
  try {
2074
2088
  const s = t.filter(lt);
2075
2089
  if (s.length === 0) {
@@ -2100,7 +2114,7 @@ function Bt(e, t) {
2100
2114
  } catch {
2101
2115
  }
2102
2116
  }
2103
- function Ms(e, t) {
2117
+ function Us(e, t) {
2104
2118
  try {
2105
2119
  if (window.sessionStorage.getItem(`${F}${e}`) === null)
2106
2120
  return;
@@ -2109,13 +2123,13 @@ function Ms(e, t) {
2109
2123
  }
2110
2124
  Bt(e, t);
2111
2125
  }
2112
- function Ps(e) {
2126
+ function Ds(e) {
2113
2127
  try {
2114
2128
  const t = `${F}${e}`, s = window.sessionStorage.getItem(t);
2115
2129
  if (window.sessionStorage.removeItem(t), !s)
2116
2130
  return [];
2117
2131
  const n = JSON.parse(s);
2118
- return Array.isArray(n) ? n.flatMap((r) => Us(r) ? [{
2132
+ return Array.isArray(n) ? n.flatMap((r) => Ns(r) ? [{
2119
2133
  ...r.event,
2120
2134
  rawOutput: {
2121
2135
  ok: !0,
@@ -2139,13 +2153,13 @@ function Ps(e) {
2139
2153
  return [];
2140
2154
  }
2141
2155
  }
2142
- function Us(e) {
2156
+ function Ns(e) {
2143
2157
  if (!e || typeof e != "object")
2144
2158
  return !1;
2145
2159
  const t = e, s = t.event;
2146
2160
  return typeof t.startedAtMs == "number" && typeof t.startedAtUrl == "string" && t.startedAtOrigin === location.origin && t.unloadOrigin === location.origin && typeof t.unloadUrl == "string" && lt(s) && s.type === "tool.result";
2147
2161
  }
2148
- function Ds(e, t) {
2162
+ function Os(e, t) {
2149
2163
  const s = new Set(
2150
2164
  e.flatMap((n) => n.type === "tool.result" ? [n.callId] : [])
2151
2165
  );
@@ -2154,7 +2168,7 @@ function Ds(e, t) {
2154
2168
  ...t.filter((n) => !s.has(n.callId))
2155
2169
  ];
2156
2170
  }
2157
- function Ns(e) {
2171
+ function vs(e) {
2158
2172
  try {
2159
2173
  window.sessionStorage.removeItem(`${F}${e}`);
2160
2174
  } catch {
@@ -2190,15 +2204,15 @@ function Ht(e, t) {
2190
2204
  fileUrl: new URL(e.fileUrl, t).toString()
2191
2205
  } : e;
2192
2206
  }
2193
- function Os(e) {
2194
- if (vs(e))
2207
+ function Ls(e) {
2208
+ if (Bs(e))
2195
2209
  return {
2196
2210
  headers: {
2197
2211
  "ngrok-skip-browser-warning": "true"
2198
2212
  }
2199
2213
  };
2200
2214
  }
2201
- function vs(e) {
2215
+ function Bs(e) {
2202
2216
  try {
2203
2217
  const t = new URL(e).hostname;
2204
2218
  return t.endsWith(".ngrok-free.dev") || t.endsWith(".ngrok-free.app") || t.endsWith(".ngrok.app") || t.endsWith(".ngrok.io");
@@ -2207,13 +2221,13 @@ function vs(e) {
2207
2221
  }
2208
2222
  }
2209
2223
  function kt(e) {
2210
- return e.type || Ls(e.name) || "application/octet-stream";
2224
+ return e.type || qs(e.name) || "application/octet-stream";
2211
2225
  }
2212
- function Ls(e) {
2226
+ function qs(e) {
2213
2227
  const t = e.toLowerCase();
2214
2228
  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;
2215
2229
  }
2216
- function Bs(e) {
2230
+ function Hs(e) {
2217
2231
  if (!e || typeof e != "object")
2218
2232
  return null;
2219
2233
  const t = e;
@@ -2229,7 +2243,7 @@ function Bs(e) {
2229
2243
  loading: typeof t.loading == "boolean" ? t.loading : void 0
2230
2244
  };
2231
2245
  }
2232
- function qs(e) {
2246
+ function xs(e) {
2233
2247
  return e.attachments?.length ? {
2234
2248
  ...e,
2235
2249
  attachments: e.attachments.map(ut)
@@ -2248,11 +2262,11 @@ function J(e) {
2248
2262
  const t = e.respondsToUserMessageId;
2249
2263
  return typeof t == "string" && t ? t : null;
2250
2264
  }
2251
- function C(e) {
2265
+ function R(e) {
2252
2266
  const t = e.runId;
2253
2267
  return typeof t == "string" && t ? t : null;
2254
2268
  }
2255
- function Hs(e) {
2269
+ function Fs(e) {
2256
2270
  return !!e && typeof e == "object" && typeof e.summary == "string" && typeof e.javascript == "string";
2257
2271
  }
2258
2272
  function xt(e) {
@@ -2267,45 +2281,45 @@ function xt(e) {
2267
2281
  return t;
2268
2282
  }
2269
2283
  function dt(e, t) {
2270
- return Gt(e) ? j : k(H(t), Ee);
2284
+ return Gt(e) ? j : S(H(t), _e);
2271
2285
  }
2272
- function xs(e, t) {
2286
+ function Ws(e, t) {
2273
2287
  return typeof e == "string" ? e : e instanceof URL ? e.toString() : t?.url ?? "";
2274
2288
  }
2275
- async function Fs(e, t, s, n) {
2289
+ async function js(e, t, s, n) {
2276
2290
  const r = xt(e.headers);
2277
2291
  n({
2278
2292
  ...t,
2279
2293
  responseStatus: e.status,
2280
2294
  responseHeaders: r,
2281
- responseBody: await Ws(e),
2295
+ responseBody: await $s(e),
2282
2296
  durationMs: Date.now() - s
2283
2297
  });
2284
2298
  }
2285
- async function Ws(e) {
2299
+ async function $s(e) {
2286
2300
  if (!Ft(e.headers))
2287
2301
  return;
2288
2302
  let t = null, s = null;
2289
2303
  try {
2290
2304
  if (t = e.clone().body?.getReader() ?? null, !t)
2291
2305
  return;
2292
- const n = new Promise((c) => {
2306
+ const n = new Promise((l) => {
2293
2307
  s = window.setTimeout(() => {
2294
- t?.cancel(), c("timeout");
2295
- }, Re);
2308
+ t?.cancel(), l("timeout");
2309
+ }, Ce);
2296
2310
  }), r = new TextDecoder();
2297
2311
  let i = "", o = 0;
2298
2312
  for (; ; ) {
2299
- const c = await Promise.race([t.read(), n]);
2300
- if (c === "timeout")
2313
+ const l = await Promise.race([t.read(), n]);
2314
+ if (l === "timeout")
2301
2315
  return;
2302
- const { done: a, value: h } = c;
2303
- if (a)
2304
- return k(i + r.decode());
2305
- const g = ot - o;
2306
- if (h.byteLength > g)
2307
- return i += r.decode(h.subarray(0, Math.max(g, 0)), { stream: !0 }), t.cancel(), `${k(i)}... [truncated]`;
2308
- o += h.byteLength, i += r.decode(h, { stream: !0 });
2316
+ const { done: u, value: a } = l;
2317
+ if (u)
2318
+ return S(i + r.decode());
2319
+ const c = ot - o;
2320
+ if (a.byteLength > c)
2321
+ return i += r.decode(a.subarray(0, Math.max(c, 0)), { stream: !0 }), t.cancel(), `${S(i)}... [truncated]`;
2322
+ o += a.byteLength, i += r.decode(a, { stream: !0 });
2309
2323
  }
2310
2324
  } catch {
2311
2325
  t?.cancel();
@@ -2314,20 +2328,20 @@ async function Ws(e) {
2314
2328
  s !== null && window.clearTimeout(s);
2315
2329
  }
2316
2330
  }
2317
- function js(e, t) {
2331
+ function zs(e, t) {
2318
2332
  if (Ft(new Headers(t)))
2319
2333
  try {
2320
- return e.responseType === "" || e.responseType === "text" ? k(e.responseText ?? "") : void 0;
2334
+ return e.responseType === "" || e.responseType === "text" ? S(e.responseText ?? "") : void 0;
2321
2335
  } catch {
2322
2336
  return;
2323
2337
  }
2324
2338
  }
2325
2339
  function Et(e) {
2326
2340
  if (typeof e == "string")
2327
- return k(e);
2341
+ return S(e);
2328
2342
  }
2329
- function $s(e) {
2330
- return I({
2343
+ function Gs(e) {
2344
+ return w({
2331
2345
  ...e,
2332
2346
  requestBody: Rt(e.requestBody),
2333
2347
  responseBody: Rt(e.responseBody)
@@ -2340,7 +2354,7 @@ function Rt(e) {
2340
2354
  if (!t.startsWith("{") && !t.startsWith("["))
2341
2355
  return H(e);
2342
2356
  try {
2343
- return JSON.stringify(I(JSON.parse(e)));
2357
+ return JSON.stringify(w(JSON.parse(e)));
2344
2358
  } catch {
2345
2359
  return H(e);
2346
2360
  }
@@ -2351,8 +2365,8 @@ function Ft(e) {
2351
2365
  const t = e.get("content-type")?.toLowerCase() ?? "", s = e.get("content-length"), n = Number(s);
2352
2366
  return s !== null && Number.isInteger(n) && n >= 0 && n <= ot && (t.startsWith("text/") || t.includes("json") || t.includes("javascript"));
2353
2367
  }
2354
- function b(e, t = {}, s) {
2355
- if (Gs(s))
2368
+ function _(e, t = {}, s) {
2369
+ if (Ks(s))
2356
2370
  return !0;
2357
2371
  const n = Object.entries(t).find(([r]) => r.toLowerCase() === "content-type")?.[1]?.toLowerCase();
2358
2372
  if (n?.includes("multipart/form-data") || n?.includes("application/octet-stream"))
@@ -2362,13 +2376,13 @@ function b(e, t = {}, s) {
2362
2376
  if (r.protocol !== "http:" && r.protocol !== "https:")
2363
2377
  return !0;
2364
2378
  const i = r.hostname.toLowerCase(), o = r.pathname.toLowerCase();
2365
- return i === "pluno.ai" || i.endsWith(".pluno.ai") || o === "/api/product-agent" || o.startsWith("/api/product-agent/") || /(^|\/)(auth|oauth|login|logout)(\/|$)/.test(o) || /(^|\/)[^/]*token[^/]*(\/|$)/.test(o) || /(^|\/)(upload|uploads|attachments)(\/|$)/.test(o) || [...r.searchParams.keys()].some((c) => /^(x-amz-signature|x-goog-signature|signature|sig)$/i.test(c));
2379
+ return i === "pluno.ai" || i.endsWith(".pluno.ai") || o === "/api/product-agent" || o.startsWith("/api/product-agent/") || /(^|\/)(auth|oauth|login|logout)(\/|$)/.test(o) || /(^|\/)[^/]*token[^/]*(\/|$)/.test(o) || /(^|\/)(upload|uploads|attachments)(\/|$)/.test(o) || [...r.searchParams.keys()].some((l) => /^(x-amz-signature|x-goog-signature|signature|sig)$/i.test(l));
2366
2380
  } catch {
2367
2381
  return !0;
2368
2382
  }
2369
2383
  }
2370
- function zs(e, t) {
2371
- if (b(e))
2384
+ function Xs(e, t) {
2385
+ if (_(e))
2372
2386
  return !0;
2373
2387
  try {
2374
2388
  const s = new URL(e, location.href), n = new URL(t);
@@ -2377,10 +2391,10 @@ function zs(e, t) {
2377
2391
  return !0;
2378
2392
  }
2379
2393
  }
2380
- function Gs(e) {
2394
+ function Ks(e) {
2381
2395
  return e instanceof FormData || e instanceof Blob || e instanceof ArrayBuffer || ArrayBuffer.isView(e) || typeof ReadableStream < "u" && e instanceof ReadableStream;
2382
2396
  }
2383
- function Xs(e) {
2397
+ function Js(e) {
2384
2398
  const t = {};
2385
2399
  for (const s of e.trim().split(/[\r\n]+/)) {
2386
2400
  const n = s.indexOf(":");
@@ -2393,7 +2407,7 @@ function Xs(e) {
2393
2407
  }
2394
2408
  return t;
2395
2409
  }
2396
- function k(e, t = ot) {
2410
+ function S(e, t = ot) {
2397
2411
  return e.length <= t ? e : `${e.slice(0, t)}... [truncated ${e.length - t} chars]`;
2398
2412
  }
2399
2413
  function V(e) {
@@ -2411,28 +2425,28 @@ async function Y(e, t) {
2411
2425
  try {
2412
2426
  return await e();
2413
2427
  } catch (r) {
2414
- if (s = r, n >= mt - 1 || !Js(r))
2428
+ if (s = r, n >= mt - 1 || !Ys(r))
2415
2429
  throw r;
2416
- await Ks(n);
2430
+ await Vs(n);
2417
2431
  }
2418
2432
  throw s instanceof Error ? s : new Error(t);
2419
2433
  }
2420
- function Ks(e) {
2434
+ function Vs(e) {
2421
2435
  return new Promise((t) => {
2422
- window.setTimeout(t, ke[e] ?? 0);
2436
+ window.setTimeout(t, Re[e] ?? 0);
2423
2437
  });
2424
2438
  }
2425
- function Js(e) {
2426
- return e instanceof B ? Vs(e.status) : e instanceof TypeError;
2439
+ function Ys(e) {
2440
+ return e instanceof B ? Zs(e.status) : e instanceof TypeError;
2427
2441
  }
2428
- function Vs(e) {
2442
+ function Zs(e) {
2429
2443
  return e === 408 || e === 409 || e === 429 || e >= 500;
2430
2444
  }
2431
- function Ys(e) {
2445
+ function Qs(e) {
2432
2446
  return e === 401 || e === 403;
2433
2447
  }
2434
- const j = "[REDACTED_SECRET]", E = "[REDACTED_TOKEN]", Zs = "[REDACTED_SIGNED_URL]", Qs = 20, tn = /^(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, Wt = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, jt = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, $t = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, zt = /\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, en = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, sn = /\bhttps?:\/\/[^\s"'<>]+/gi, nn = /[),.;\]]+$/;
2435
- function I(e) {
2448
+ const j = "[REDACTED_SECRET]", k = "[REDACTED_TOKEN]", tn = "[REDACTED_SIGNED_URL]", en = 20, sn = /^(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, Wt = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, jt = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, $t = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, zt = /\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, nn = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, rn = /\bhttps?:\/\/[^\s"'<>]+/gi, on = /[),.;\]]+$/;
2449
+ function w(e) {
2436
2450
  return q(e, 0, /* @__PURE__ */ new WeakSet());
2437
2451
  }
2438
2452
  function q(e, t, s) {
@@ -2440,7 +2454,7 @@ function q(e, t, s) {
2440
2454
  return e.startsWith("data:image/") || e.startsWith("data:application/pdf;") ? e : H(e);
2441
2455
  if (e === null || typeof e != "object")
2442
2456
  return e;
2443
- if (t >= Qs)
2457
+ if (t >= en)
2444
2458
  return "[REDACTED_MAX_DEPTH]";
2445
2459
  if (s.has(e))
2446
2460
  return "[REDACTED_CIRCULAR]";
@@ -2448,44 +2462,44 @@ function q(e, t, s) {
2448
2462
  return e.map((r) => q(r, t + 1, s));
2449
2463
  const n = {};
2450
2464
  for (const [r, i] of Object.entries(e))
2451
- Gt(r) ? n[r] = j : n[r] = r.toLowerCase() === "url" ? rn(i) : q(i, t + 1, s);
2465
+ Gt(r) ? n[r] = j : n[r] = r.toLowerCase() === "url" ? an(i) : q(i, t + 1, s);
2452
2466
  return n;
2453
2467
  }
2454
2468
  function Gt(e) {
2455
2469
  const t = e.replace(/[^a-z0-9]/gi, "").toLowerCase();
2456
2470
  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");
2457
2471
  }
2458
- function rn(e) {
2472
+ function an(e) {
2459
2473
  return typeof e == "string" ? Xt(e) : q(e, 0, /* @__PURE__ */ new WeakSet());
2460
2474
  }
2461
2475
  function Xt(e) {
2462
2476
  try {
2463
2477
  const t = new URL(e, location.href);
2464
2478
  for (const s of Array.from(t.searchParams.keys()))
2465
- tn.test(s) && t.searchParams.set(s, E);
2466
- return t.username && (t.username = E), t.password && (t.password = E), t.toString();
2479
+ sn.test(s) && t.searchParams.set(s, k);
2480
+ return t.username && (t.username = k), t.password && (t.password = k), t.toString();
2467
2481
  } catch {
2468
- return on(e);
2482
+ return cn(e);
2469
2483
  }
2470
2484
  }
2471
2485
  function H(e) {
2472
- return e.replace(en, Zs).replace(sn, an).replace(Wt, `Bearer ${E}`).replace(jt, `Basic ${E}`).replace($t, E).replace(zt, (t, s) => `${s}: ${j}`);
2486
+ return e.replace(nn, tn).replace(rn, ln).replace(Wt, `Bearer ${k}`).replace(jt, `Basic ${k}`).replace($t, k).replace(zt, (t, s) => `${s}: ${j}`);
2473
2487
  }
2474
- function on(e) {
2475
- return e.replace(Wt, `Bearer ${E}`).replace(jt, `Basic ${E}`).replace($t, E).replace(zt, (t, s) => `${s}: ${j}`);
2488
+ function cn(e) {
2489
+ return e.replace(Wt, `Bearer ${k}`).replace(jt, `Basic ${k}`).replace($t, k).replace(zt, (t, s) => `${s}: ${j}`);
2476
2490
  }
2477
- function an(e) {
2478
- const t = e.match(nn)?.[0] ?? "", s = t ? e.slice(0, -t.length) : e;
2491
+ function ln(e) {
2492
+ const t = e.match(on)?.[0] ?? "", s = t ? e.slice(0, -t.length) : e;
2479
2493
  return `${Xt(s)}${t}`;
2480
2494
  }
2481
2495
  export {
2482
2496
  ht as PLUNO_PRODUCT_AGENT_SDK_PREVIEW_HOST_SELECTOR,
2483
2497
  Q as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
2484
- oe as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
2485
- ie as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
2486
- ae as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
2498
+ ce as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
2499
+ ae as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
2500
+ le as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
2487
2501
  Ut as PlunoProductAgent,
2488
- Pe as calculateReconnectDelay,
2502
+ De as calculateReconnectDelay,
2489
2503
  Ut as default,
2490
- We as getProductAgentOriginAccessErrorMessage
2504
+ $e as getProductAgentOriginAccessErrorMessage
2491
2505
  };