@pluno/product-agent-web 0.1.257 → 0.1.259

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,50 @@
1
+ function ze(s) {
2
+ if (!s || typeof s != "object") return !1;
3
+ const e = s;
4
+ return Object.keys(s).every((t) => ["boundary", "category", "messageKind"].includes(t)) && ["runtime", "web_transport", "extension_ipc"].includes(e.boundary) && ["error", "object", "null", "array", "string", "undefined", "number", "boolean", "bigint", "symbol", "function"].includes(e.category) && ["object_coercion", "text", "blank", "non_text"].includes(e.messageKind);
5
+ }
1
6
  function Le(s) {
7
+ if (s === null || typeof s == "string" || typeof s == "boolean") return !0;
8
+ if (typeof s == "number") return Number.isFinite(s);
9
+ if (Array.isArray(s)) return s.every(Le);
10
+ if (typeof s != "object") return !1;
11
+ const e = Object.getPrototypeOf(s);
12
+ return e !== Object.prototype && e !== null ? !1 : Object.values(s).every(Le);
13
+ }
14
+ function Vn(s) {
15
+ if (s.details !== void 0 && !Le(s.details))
16
+ throw new TypeError("Product Agent transported error details must be JSON-safe.");
17
+ return {
18
+ code: s.code,
19
+ message: s.message,
20
+ retryable: s.retryable,
21
+ ...s.details === void 0 ? {} : { details: s.details }
22
+ };
23
+ }
24
+ function J(s, e = "runtime_error", t = "runtime") {
25
+ const i = s !== null && typeof s == "object" ? s : null, n = typeof s == "string" ? s : i && "message" in i && typeof i.message == "string" ? i.message : "", r = i && "code" in i && typeof i.code == "string" && i.code.trim() ? i.code : e, a = i && "details" in i ? i.details : null, o = a && typeof a == "object" ? a : {}, c = {
26
+ // Preserve the first boundary's shape after normalization replaces the original message/prototype.
27
+ errorNormalization: ze(o.errorNormalization) ? o.errorNormalization : {
28
+ boundary: t,
29
+ category: s instanceof Error ? "error" : s === null ? "null" : Array.isArray(s) ? "array" : typeof s,
30
+ messageKind: n.trim() === "[object Object]" ? "object_coercion" : n.trim() ? "text" : typeof s == "string" || i && "message" in i && typeof i.message == "string" ? "blank" : "non_text"
31
+ },
32
+ ...o.allocation === "unissued" ? { allocation: "unissued" } : {},
33
+ ...["unissued", "rejected"].includes(String(o.acceptance)) ? { acceptance: String(o.acceptance) } : {},
34
+ ...typeof o.securitySettingsUrl == "string" ? { securitySettingsUrl: o.securitySettingsUrl } : {},
35
+ ...typeof o.transportCode == "string" && /^[a-z0-9_]{1,80}$/.test(o.transportCode) ? { transportCode: o.transportCode } : {},
36
+ ...typeof o.requestId == "string" && /^[a-zA-Z0-9_-]{1,160}$/.test(o.requestId) ? { requestId: o.requestId } : {},
37
+ ...typeof o.durationMs == "number" && Number.isFinite(o.durationMs) && o.durationMs >= 0 ? { durationMs: o.durationMs } : {},
38
+ ...typeof o.successfulRequests == "number" && Number.isSafeInteger(o.successfulRequests) && o.successfulRequests >= 0 ? { successfulRequests: o.successfulRequests } : {}
39
+ };
40
+ return Vn({
41
+ code: r,
42
+ message: n.trim() && n.trim() !== "[object Object]" ? n : "The Product Agent operation failed. Try again.",
43
+ retryable: !!(i && "retryable" in i && i.retryable === !0),
44
+ ...Object.keys(c).length ? { details: c } : {}
45
+ });
46
+ }
47
+ function $e(s) {
2
48
  return {
3
49
  key: s,
4
50
  status: "not_requested",
@@ -23,11 +69,11 @@ function zi(s, e) {
23
69
  updatedAt: t ? s.updatedAt : null
24
70
  };
25
71
  }
26
- const Rs = (s) => s.selectedModel ?? s.historyModel ?? s.defaultModel, Vn = (s, e) => s.scopes[e];
27
- function se(s) {
72
+ const Rs = (s) => s.selectedModel ?? s.historyModel ?? s.defaultModel, Gn = (s, e) => s.scopes[e];
73
+ function ie(s) {
28
74
  return s?.execution_message_ids ?? s?.user_message_ids ?? [];
29
75
  }
30
- function oe(s) {
76
+ function ae(s) {
31
77
  const e = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(?:\.(\d{1,6}))?(?:Z|\+00:00)$/.exec(s);
32
78
  if (!e) throw new Error("Display timestamps must retain the backend UTC precision.");
33
79
  return `${e[1]}.${(e[2] ?? "").padEnd(6, "0")}`;
@@ -35,23 +81,15 @@ function oe(s) {
35
81
  function pt(s) {
36
82
  return "revision" in s.data ? s.data.revision : null;
37
83
  }
38
- function $e(s) {
39
- if (s === null || typeof s == "string" || typeof s == "boolean") return !0;
40
- if (typeof s == "number") return Number.isFinite(s);
41
- if (Array.isArray(s)) return s.every($e);
42
- if (typeof s != "object") return !1;
43
- const e = Object.getPrototypeOf(s);
44
- return e !== Object.prototype && e !== null ? !1 : Object.values(s).every($e);
45
- }
46
- function ne(s) {
47
- return s !== null && typeof s == "object" && !Object.isFrozen(s) && (Object.values(s).forEach(ne), Object.freeze(s)), s;
84
+ function re(s) {
85
+ return s !== null && typeof s == "object" && !Object.isFrozen(s) && (Object.values(s).forEach(re), Object.freeze(s)), s;
48
86
  }
49
- function Y(s) {
50
- if (!$e(s)) throw new Error("Conversation inputs must be JSON-safe values.");
87
+ function Z(s) {
88
+ if (!Le(s)) throw new Error("Conversation inputs must be JSON-safe values.");
51
89
  return JSON.parse(JSON.stringify(s));
52
90
  }
53
91
  function Hi(s = "", e = 0) {
54
- return ne({ authorityId: s, generation: e, pendingRestoration: {}, proactiveQuestions: {}, sessions: {}, submissions: {}, submissionOrder: [], stops: {}, requests: {}, requestSequence: 0, deliveries: {}, operations: {}, effectsEnabled: !1, checkpointEffectId: null, checkpointError: null });
92
+ return re({ authorityId: s, generation: e, pendingRestoration: {}, proactiveQuestions: {}, sessions: {}, submissions: {}, submissionOrder: [], stops: {}, requests: {}, requestSequence: 0, deliveries: {}, operations: {}, effectsEnabled: !1, checkpointEffectId: null, checkpointError: null });
55
93
  }
56
94
  function ss(s) {
57
95
  return {
@@ -63,7 +101,7 @@ function ss(s) {
63
101
  executionByUserMessage: {},
64
102
  followUps: [],
65
103
  followUpsVersion: -1,
66
- queries: { current: Le(`${s}:current`), history: Le(`${s}:history`) }
104
+ queries: { current: $e(`${s}:current`), history: $e(`${s}:history`) }
67
105
  };
68
106
  }
69
107
  function Ki(s) {
@@ -75,19 +113,19 @@ function yt(s) {
75
113
  function is(s, e) {
76
114
  if (e.conversation_id !== s.sessionId) throw new Error("Display item belongs to another conversation.");
77
115
  if (s.removedItems[e.id]) return s;
78
- const t = oe(e.created_at);
79
- oe(e.updated_at);
116
+ const t = ae(e.created_at);
117
+ ae(e.updated_at);
80
118
  const i = pt(e);
81
119
  i !== null && yt(i);
82
120
  const n = s.streams[e.id];
83
121
  if (i !== null && n && (n.state === "stopped" || n.state === "finished") && i > n.revision) return s;
84
122
  const r = s.items[e.id];
85
123
  if (r) {
86
- if (oe(r.created_at) !== t) throw new Error("Display shell timestamp changed.");
124
+ if (ae(r.created_at) !== t) throw new Error("Display shell timestamp changed.");
87
125
  const a = pt(r);
88
126
  if (a !== null && i !== null) {
89
127
  if (i <= a) return s;
90
- } else if (oe(e.updated_at) <= oe(r.updated_at)) return s;
128
+ } else if (ae(e.updated_at) <= ae(r.updated_at)) return s;
91
129
  }
92
130
  return { ...s, items: { ...s.items, [e.id]: { ...e, created_at: r?.created_at ?? e.created_at } } };
93
131
  }
@@ -100,10 +138,14 @@ function ns(s, e) {
100
138
  if (e.conversation_id !== s.sessionId) throw new Error("Execution belongs to another conversation.");
101
139
  if (yt(e.version), s.execution && e.version <= s.execution.version) return s;
102
140
  const t = { ...s.executionByUserMessage };
103
- for (const i of se(e)) t[i] = { version: e.version, phase: e.phase };
141
+ for (const i of ie(e)) t[i] = {
142
+ version: e.version,
143
+ phase: e.phase,
144
+ responseMessageIds: e.response_message_groups?.find((n) => n.includes(i)) ?? [i]
145
+ };
104
146
  return { ...s, execution: e, executionByUserMessage: t };
105
147
  }
106
- function Gn(s) {
148
+ function Jn(s) {
107
149
  const e = /* @__PURE__ */ new Set();
108
150
  for (const t of Object.values(s.items)) {
109
151
  const i = pt(t), n = s.streams[t.id];
@@ -170,12 +212,12 @@ function as(s, e) {
170
212
  queries: { ...o.queries, [r.lane]: { ...c, requestId: null, status: c.data === null ? "not_requested" : "ready" } }
171
213
  } } };
172
214
  }
173
- return ne(i);
215
+ return re(i);
174
216
  }
175
217
  function Ge(s) {
176
218
  return JSON.stringify(s, (e, t) => t && typeof t == "object" && !Array.isArray(t) ? Object.fromEntries(Object.entries(t).sort(([i], [n]) => i.localeCompare(n))) : t);
177
219
  }
178
- function Jn(s, e, t, i) {
220
+ function Qn(s, e, t, i) {
179
221
  let n = s;
180
222
  const r = [];
181
223
  let a = null;
@@ -210,10 +252,10 @@ function Jn(s, e, t, i) {
210
252
  ...d,
211
253
  status: "error",
212
254
  requestId: null,
213
- error: e.type === "effect.failed" ? Y(e.error) : e.output.snapshot.preparation === "failed" || e.output.snapshot.preparation === "disabled" ? { code: "history_preparation_failed", message: "We couldn’t prepare this conversation. Try loading it again.", retryable: !1 } : { code: "projection_not_ready", message: "This conversation isn’t available yet. Try loading it again.", retryable: !0 }
255
+ error: e.type === "effect.failed" ? Z(e.error) : e.output.snapshot.preparation === "failed" || e.output.snapshot.preparation === "disabled" ? { code: "history_preparation_failed", message: "We couldn’t prepare this conversation. Try loading it again.", retryable: !1 } : { code: "projection_not_ready", message: "This conversation isn’t available yet. Try loading it again.", retryable: !0 }
214
256
  } } };
215
257
  else {
216
- const m = Y(e.output.snapshot);
258
+ const m = Z(e.output.snapshot);
217
259
  o.lane === "current" && (c = { ...c, preparation: null });
218
260
  const h = c.queries.history, y = o.lane === "current" && (h.status === "not_requested" || m.next_cursor !== null && !c.items[m.next_cursor]);
219
261
  if (m.conversation_id !== o.sessionId) throw new Error("Snapshot belongs to another conversation.");
@@ -263,7 +305,7 @@ function Jn(s, e, t, i) {
263
305
  case "conversation.context_prepared": {
264
306
  const o = s.submissions[e.userMessageId];
265
307
  if (!o || o.cancelled || o.delivery === "failed") return { state: s, effects: r };
266
- const c = Y({ pageContent: e.pageContent, sessionTabs: e.sessionTabs });
308
+ const c = Z({ pageContent: e.pageContent, sessionTabs: e.sessionTabs });
267
309
  if (o.contextPreparation !== null) {
268
310
  if (Ge(o.contextPreparation) !== Ge(c)) throw new Error("Prepared submission context cannot change.");
269
311
  return { state: s, effects: r };
@@ -275,12 +317,12 @@ function Jn(s, e, t, i) {
275
317
  if (t.clients[e.clientScopeId] !== e.conversationScopeId) throw new Error("Submission selection has changed.");
276
318
  const { type: o, authorityId: c, generation: d, prepareContext: l, ...u } = e, p = s.submissions[e.userMessageId];
277
319
  if (p) {
278
- const { contextPreparation: b, requestedModel: v, sessionId: _, delivery: S, cancelled: A, cancellationReason: C, error: H, executionVersion: B, ...J } = p;
279
- if (Ge(J) !== Ge(u)) throw new Error("User-message identity cannot be reused with different input.");
320
+ const { contextPreparation: b, requestedModel: v, sessionId: _, delivery: S, cancelled: A, cancellationReason: C, error: H, executionVersion: B, ...Q } = p;
321
+ if (Ge(Q) !== Ge(u)) throw new Error("User-message identity cannot be reused with different input.");
280
322
  return { state: s, effects: r };
281
323
  }
282
324
  const f = t.selections[e.conversationScopeId], m = Object.values(s.submissions).find((b) => b.conversationScopeId === e.conversationScopeId && !b.cancelled && b.sessionId !== null), h = i.scopes[e.clientScopeId], y = {
283
- ...Y(u),
325
+ ...Z(u),
284
326
  ...l ? { contextPreparation: null } : {},
285
327
  // Extension staging can await page context after the picker has already changed.
286
328
  requestedModel: h?.submissions[e.userMessageId] ? h.submissions[e.userMessageId].requestedModel ?? null : h ? Rs(h) ?? null : null,
@@ -302,14 +344,14 @@ function Jn(s, e, t, i) {
302
344
  case "conversation.submission_delivery": {
303
345
  const o = s.submissions[e.userMessageId];
304
346
  if (!o || o.cancelled || o.delivery === "accepted" || o.requestId !== e.requestId) return { state: s, effects: r };
305
- n = { ...s, submissions: { ...s.submissions, [e.userMessageId]: { ...o, delivery: e.delivery, error: Y(e.error) } } };
347
+ n = { ...s, submissions: { ...s.submissions, [e.userMessageId]: { ...o, delivery: e.delivery, error: Z(e.error) } } };
306
348
  break;
307
349
  }
308
350
  case "conversation.stop": {
309
351
  if (t.clients[e.clientScopeId] !== e.conversationScopeId) return { state: s, effects: r };
310
- const o = t.selections[e.conversationScopeId].sessionId, c = o ? s.sessions[o]?.execution : null, d = Object.values(s.submissions).filter((h) => (o ? h.sessionId === o : h.conversationScopeId === e.conversationScopeId) && (!e.userMessageIds || e.userMessageIds.includes(h.userMessageId))), l = d.filter((h) => !h.cancelled && (h.delivery !== "failed" || s.deliveries[h.userMessageId]?.phase === "paused") && (h.delivery !== "accepted" || h.executionVersion === null)), u = l.length > 0, p = c && ["queued", "thinking", "steering", "stopping"].includes(c.phase) && (!e.userMessageIds || se(c).some((h) => e.userMessageIds.includes(h)));
352
+ const o = t.selections[e.conversationScopeId].sessionId, c = o ? s.sessions[o]?.execution : null, d = Object.values(s.submissions).filter((h) => (o ? h.sessionId === o : h.conversationScopeId === e.conversationScopeId) && (!e.userMessageIds || e.userMessageIds.includes(h.userMessageId))), l = d.filter((h) => !h.cancelled && (h.delivery !== "failed" || s.deliveries[h.userMessageId]?.phase === "paused") && (h.delivery !== "accepted" || h.executionVersion === null)), u = l.length > 0, p = c && ["queued", "thinking", "steering", "stopping"].includes(c.phase) && (!e.userMessageIds || ie(c).some((h) => e.userMessageIds.includes(h)));
311
353
  if (!u && !p && (c || !e.userMessageIds?.length)) return { state: s, effects: r };
312
- const f = Array.from(new Set(e.userMessageIds ?? [...l.map((h) => h.userMessageId), ...p ? se(c) : []])), m = { ...s.submissions };
354
+ const f = Array.from(new Set(e.userMessageIds ?? [...l.map((h) => h.userMessageId), ...p ? ie(c) : []])), m = { ...s.submissions };
313
355
  for (const h of d)
314
356
  f.includes(h.userMessageId) && h.delivery !== "accepted" && (m[h.userMessageId] = { ...h, cancelled: !0, cancellationReason: e.reason ?? "user_requested" });
315
357
  n = { ...s, submissions: m, stops: { ...s.stops, [e.conversationScopeId]: {
@@ -321,7 +363,7 @@ function Jn(s, e, t, i) {
321
363
  break;
322
364
  }
323
365
  case "conversation.display_received": {
324
- const o = Y(e.event), c = o.type === "conversation.item.updated" ? o.item.conversation_id : o.type === "conversation.execution.updated" ? o.execution.conversation_id : o.type === "conversation.interaction.updated" ? o.interaction.conversation_id : o.conversation_id, d = o.type === "conversation.item.updated" && o.item.type === "user_message" ? s.submissions[o.item.id] : void 0;
366
+ const o = Z(e.event), c = o.type === "conversation.item.updated" ? o.item.conversation_id : o.type === "conversation.execution.updated" ? o.execution.conversation_id : o.type === "conversation.interaction.updated" ? o.interaction.conversation_id : o.conversation_id, d = o.type === "conversation.item.updated" && o.item.type === "user_message" ? s.submissions[o.item.id] : void 0;
325
367
  if (d && (n = rs(s, d, c)), !n.sessions[c] && !t.memberships[c]?.members.length && !d) return { state: s, effects: r };
326
368
  t.memberships[c]?.members.length && (o.type === "conversation.interaction.updated" || o.type === "conversation.execution.updated" || o.type === "conversation.item.updated" && o.item.type === "user_message") && (a = {
327
369
  authorityId: s.authorityId,
@@ -343,7 +385,7 @@ function Jn(s, e, t, i) {
343
385
  const p = d[u.lane];
344
386
  d[u.lane] = { ...p, requestId: null, status: p.data === null ? "not_requested" : "ready" };
345
387
  }
346
- d.history = Le(d.history.key), n = { ...s, requests: c, sessions: { ...s.sessions, [e.sessionId]: { ...o, queries: d } } };
388
+ d.history = $e(d.history.key), n = { ...s, requests: c, sessions: { ...s.sessions, [e.sessionId]: { ...o, queries: d } } };
347
389
  break;
348
390
  }
349
391
  case "conversation.snapshot": {
@@ -357,7 +399,7 @@ function Jn(s, e, t, i) {
357
399
  requestId: e.requestId,
358
400
  lane: e.lane,
359
401
  before: e.lane === "history" ? c.cursor : null,
360
- refreshItemIds: Gn(o),
402
+ refreshItemIds: Jn(o),
361
403
  retryPreparation: c.error?.code === "history_preparation_failed"
362
404
  }, l = Object.values(s.submissions).filter((f) => f.sessionId === e.sessionId && f.delivery === "accepted" && f.executionVersion === null).map((f) => f.userMessageId), u = s.requestSequence + 1, p = `conversation:${s.generation}:${u}`;
363
405
  n = {
@@ -377,7 +419,7 @@ function Jn(s, e, t, i) {
377
419
  const c = o.sessionId ? n.sessions[o.sessionId]?.execution : null;
378
420
  c?.user_message_ids.includes(o.userMessageId) && o.executionVersion !== c.version && (n = { ...n, submissions: { ...n.submissions, [o.userMessageId]: { ...o, executionVersion: c.version } } });
379
421
  }
380
- return a && (n = { ...n, requestSequence: n.requestSequence + 1 }, r.push({ id: `conversation:${n.generation}:${n.requestSequence}`, kind: "conversation.interactions", input: a })), { state: ne(n), effects: r };
422
+ return a && (n = { ...n, requestSequence: n.requestSequence + 1 }, r.push({ id: `conversation:${n.generation}:${n.requestSequence}`, kind: "conversation.interactions", input: a })), { state: re(n), effects: r };
381
423
  }
382
424
  const Ys = (s, e) => ({
383
425
  acceptance: "unissued",
@@ -416,7 +458,7 @@ function As(s, e) {
416
458
  const u = l.command.payload.source;
417
459
  return !Object.values(s.submissions).some((p) => p.conversationScopeId === l.conversationScopeId && p.delivery === "accepted" && p.attachments.some((f) => f.sourceId === u.sourceId));
418
460
  }));
419
- return ne({
461
+ return re({
420
462
  schema: 1,
421
463
  authorityId: s.authorityId,
422
464
  submissions: r,
@@ -436,7 +478,7 @@ function pe(s, e) {
436
478
  }
437
479
  function cs(s, e, t, i = !1) {
438
480
  if (!e.effectsEnabled || !i && s.submissions === e.submissions && s.deliveries === e.deliveries && s.operations === e.operations && s.stops === e.stops && s.sessions === e.sessions) return { state: e, effects: [] };
439
- const n = e.requestSequence + 1, r = `conversation:${e.generation}:${n}`, a = ne({ ...e, requestSequence: n, checkpointEffectId: r });
481
+ const n = e.requestSequence + 1, r = `conversation:${e.generation}:${n}`, a = re({ ...e, requestSequence: n, checkpointEffectId: r });
440
482
  return { state: a, effects: [{ id: r, kind: "conversation.checkpoint", input: {
441
483
  authorityId: a.authorityId,
442
484
  generation: a.generation,
@@ -444,9 +486,9 @@ function cs(s, e, t, i = !1) {
444
486
  } }] };
445
487
  }
446
488
  function ds(s, e = null) {
447
- return { command: Y(s), conversationScopeId: e, phase: "waiting", effectId: null, result: null, error: null };
489
+ return { command: Z(s), conversationScopeId: e, phase: "waiting", effectId: null, result: null, error: null };
448
490
  }
449
- function Qn(s) {
491
+ function Xn(s) {
450
492
  const e = { ...s.context, ...s.contextPreparation };
451
493
  return Object.fromEntries(["page", "pageContent", "agentMode", "metadata", "sessionTabs", "proactiveSuggestionQuestion"].filter((t) => t in e).map((t) => [t, e[t]]));
452
494
  }
@@ -496,7 +538,7 @@ function ls(s) {
496
538
  request_id: c.requestId,
497
539
  type: "chat.user_message",
498
540
  payload: {
499
- ...Qn(c),
541
+ ...Xn(c),
500
542
  sessionId: c.sessionId,
501
543
  clientMessageId: o,
502
544
  content: c.content,
@@ -522,7 +564,7 @@ function ls(s) {
522
564
  };
523
565
  for (const [o, c] of Object.entries(e.stops))
524
566
  for (const d of c.userMessageIds) {
525
- const l = e.submissions[d], u = l?.sessionId ?? Object.values(e.sessions).find((f) => se(f.execution).includes(d))?.sessionId, p = l?.delivery === "accepted" || u && se(e.sessions[u]?.execution).includes(d);
567
+ const l = e.submissions[d], u = l?.sessionId ?? Object.values(e.sessions).find((f) => ie(f.execution).includes(d))?.sessionId, p = l?.delivery === "accepted" || u && ie(e.sessions[u]?.execution).includes(d);
526
568
  u && p && a(`stop:${o}:${c.requestId}:${d}`, u, d, c.reason);
527
569
  }
528
570
  for (const o of Object.values(e.submissions))
@@ -555,9 +597,9 @@ function ls(s) {
555
597
  }
556
598
  } }) : t.push({ id: p, kind: "conversation.command", input: { ...i, command: c.command } });
557
599
  }
558
- return { state: ne(e), effects: t };
600
+ return { state: re(e), effects: t };
559
601
  }
560
- function Xn(s, e, t, i) {
602
+ function Yn(s, e, t, i) {
561
603
  let n = s, r = e;
562
604
  if (e.type === "effect.completed" || e.type === "effect.failed") {
563
605
  e.effectKind === "conversation.checkpoint" && e.effectId === s.checkpointEffectId && (n = { ...n, checkpointEffectId: null, checkpointError: e.type === "effect.failed" ? e.error : null });
@@ -581,7 +623,7 @@ function Xn(s, e, t, i) {
581
623
  error: { code: "message_delivery_failed", message: "Pluno could not send this message. Try it again.", retryable: !0 }
582
624
  } } }));
583
625
  else if (e.effectKind === "conversation.upload") {
584
- const h = Y(e.output), y = f.attachments[p.uploads.length];
626
+ const h = Z(e.output), y = f.attachments[p.uploads.length];
585
627
  if (h.attachment.id !== y.sourceId || h.attachment.size_bytes !== y.sizeBytes || f.sessionId !== null && f.sessionId !== h.sessionId)
586
628
  throw new Error("Upload does not match the captured attachment or conversation.");
587
629
  m = { ...m, allocation: "resolved", uploads: [...p.uploads, h.attachment] };
@@ -627,7 +669,7 @@ function Xn(s, e, t, i) {
627
669
  effectId: null,
628
670
  phase: e.type === "effect.failed" ? e.error.retryable ? "uncertain" : "failed" : "done",
629
671
  error: e.type === "effect.failed" ? e.error : null,
630
- result: e.type === "effect.completed" ? Y(e.output) : null
672
+ result: e.type === "effect.completed" ? Z(e.output) : null
631
673
  } } }, e.type === "effect.completed" && ["runtime.warmup", "attachment.prepare"].includes(p.command.type) && !p.command.payload.sessionId && p.conversationScopeId && !Object.values(t.clients).includes(p.conversationScopeId)) {
632
674
  const f = e.output;
633
675
  f?.sessionId && (n = { ...n, operations: {
@@ -646,10 +688,10 @@ function Xn(s, e, t, i) {
646
688
  }
647
689
  } else if (e.authorityId === s.authorityId && e.generation === s.generation && t.authorityId) {
648
690
  if (e.type === "conversation.enable_effects" && (n = { ...s, effectsEnabled: !0 }), e.type === "conversation.restore_delivery") {
649
- const l = Y(e.checkpoint);
691
+ const l = Z(e.checkpoint);
650
692
  if (l.schema !== 1 || l.authorityId !== s.authorityId || s.submissionOrder.length || Object.keys(s.operations).length)
651
693
  throw new Error("Delivery restoration requires an empty engine with the same authenticated authority.");
652
- const { schema: u, authorityId: p, ...f } = l, m = Y(e.pendingRestoration ?? {}), h = (y) => !t.clients[y.clientScopeId] && m[y.clientScopeId] === y.conversationScopeId;
694
+ const { schema: u, authorityId: p, ...f } = l, m = Z(e.pendingRestoration ?? {}), h = (y) => !t.clients[y.clientScopeId] && m[y.clientScopeId] === y.conversationScopeId;
653
695
  n = {
654
696
  ...s,
655
697
  ...f,
@@ -761,7 +803,7 @@ function Xn(s, e, t, i) {
761
803
  l?.phase === "uncertain" && (n = { ...s, operations: { ...s.operations, [e.requestId]: { ...l, phase: "waiting" } } });
762
804
  }
763
805
  }
764
- const a = Jn(n, r, t, i);
806
+ const a = Qn(n, r, t, i);
765
807
  let o = a.state;
766
808
  e.type === "conversation.submission_stage" && o !== n && !o.deliveries[e.userMessageId] && (o = {
767
809
  ...o,
@@ -790,7 +832,7 @@ function Xn(s, e, t, i) {
790
832
  const c = ls(o), d = cs(s, c.state, t, e.type === "conversation.recover" && s.checkpointError !== null);
791
833
  return { state: d.state, effects: [...d.effects, ...a.effects, ...c.effects] };
792
834
  }
793
- const Yn = [
835
+ const Zn = [
794
836
  "submit",
795
837
  "stop",
796
838
  "staging_ipc",
@@ -849,17 +891,17 @@ const Yn = [
849
891
  "backend_refusal",
850
892
  "unknown"
851
893
  ];
852
- function Zn(s) {
894
+ function er(s) {
853
895
  const e = s, t = e?.code;
854
896
  return e?.backendRefusal === !0 ? "backend_refusal" : typeof t == "string" && t !== "backend_refusal" && Gi.includes(t) ? t : e?.name === "AbortError" ? "aborted" : e?.name === "TypeError" ? "type_error" : "unknown";
855
897
  }
856
- const er = Math.random().toString(36).slice(2);
857
- let tr = 0;
858
- const ei = () => `timing:${er}:${++tr}`, Je = (s) => typeof s == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(s);
859
- function ze(s) {
898
+ const tr = Math.random().toString(36).slice(2);
899
+ let sr = 0;
900
+ const ei = () => `timing:${tr}:${++sr}`, Je = (s) => typeof s == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(s);
901
+ function He(s) {
860
902
  if (!s || typeof s != "object") return !1;
861
903
  const e = s;
862
- return Object.keys(e).every((t) => ["entrySurface", "operation", "layer", "stage", "status", "spanId", "requestId", "clientMessageId", "sessionId", "occurredAt", "durationMs", "failureCategory"].includes(t)) && (e.failureCategory === void 0 || e.status === "failed" && Gi.includes(e.failureCategory)) && (e.entrySurface === void 0 || ["extension_sidepanel", "extension_widget", "main_web_chat", "embedded_widget", "embedded_custom_ui", "automation", "mcp", "whatsapp", "email"].includes(e.entrySurface)) && ["send", "stop"].includes(e.operation) && ["renderer", "sdk", "extension", "http"].includes(e.layer) && Yn.includes(e.stage) && ["started", "completed", "failed", "observed"].includes(e.status) && Je(e.spanId) && Je(e.requestId) && (e.clientMessageId === null || Je(e.clientMessageId)) && (e.sessionId === null || Je(e.sessionId)) && typeof e.occurredAt == "string" && e.occurredAt.length <= 40 && Number.isFinite(Date.parse(e.occurredAt)) && Number.isSafeInteger(e.durationMs) && e.durationMs >= 0;
904
+ return Object.keys(e).every((t) => ["entrySurface", "operation", "layer", "stage", "status", "spanId", "requestId", "clientMessageId", "sessionId", "occurredAt", "durationMs", "failureCategory"].includes(t)) && (e.failureCategory === void 0 || e.status === "failed" && Gi.includes(e.failureCategory)) && (e.entrySurface === void 0 || ["extension_sidepanel", "extension_widget", "main_web_chat", "embedded_widget", "embedded_custom_ui", "automation", "mcp", "whatsapp", "email"].includes(e.entrySurface)) && ["send", "stop"].includes(e.operation) && ["renderer", "sdk", "extension", "http"].includes(e.layer) && Zn.includes(e.stage) && ["started", "completed", "failed", "observed"].includes(e.status) && Je(e.spanId) && Je(e.requestId) && (e.clientMessageId === null || Je(e.clientMessageId)) && (e.sessionId === null || Je(e.sessionId)) && typeof e.occurredAt == "string" && e.occurredAt.length <= 40 && Number.isFinite(Date.parse(e.occurredAt)) && Number.isSafeInteger(e.durationMs) && e.durationMs >= 0;
863
905
  }
864
906
  function G(s, e) {
865
907
  if (!s) return {
@@ -875,9 +917,9 @@ function G(s, e) {
875
917
  spanId: o,
876
918
  occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
877
919
  durationMs: Math.max(0, Math.round(performance.now() - a)),
878
- ...r === "failed" ? { failureCategory: Zn(c) } : {}
920
+ ...r === "failed" ? { failureCategory: er(c) } : {}
879
921
  };
880
- s && ze(d) && Promise.resolve().then(() => s(d)).catch(() => {
922
+ s && He(d) && Promise.resolve().then(() => s(d)).catch(() => {
881
923
  });
882
924
  };
883
925
  return {
@@ -893,7 +935,7 @@ function G(s, e) {
893
935
  }
894
936
  };
895
937
  }
896
- function sr(s) {
938
+ function ir(s) {
897
939
  let e = [], t;
898
940
  const i = () => {
899
941
  clearTimeout(t), t = void 0;
@@ -902,10 +944,10 @@ function sr(s) {
902
944
  });
903
945
  };
904
946
  return (n) => {
905
- ze(n) && (JSON.stringify([...e, n]).length > 2800 && i(), e.push(n), e.length === 8 ? i() : t ??= setTimeout(i, 250));
947
+ He(n) && (JSON.stringify([...e, n]).length > 2800 && i(), e.push(n), e.length === 8 ? i() : t ??= setTimeout(i, 250));
906
948
  };
907
949
  }
908
- function ir(s) {
950
+ function nr(s) {
909
951
  let e = Promise.resolve(), t = null, i = null;
910
952
  const n = () => i ??= s.read().catch((a) => {
911
953
  throw i = null, a;
@@ -970,7 +1012,7 @@ function ir(s) {
970
1012
  }
971
1013
  };
972
1014
  }
973
- function nr(s, e, t, i) {
1015
+ function rr(s, e, t, i) {
974
1016
  if (s !== e)
975
1017
  for (const n of Object.values(e.submissions))
976
1018
  n.delivery !== "accepted" || s.submissions[n.userMessageId]?.delivery === "accepted" || G(t, {
@@ -982,13 +1024,15 @@ function nr(s, e, t, i) {
982
1024
  sessionId: n.sessionId
983
1025
  }).mark("acceptance_applied");
984
1026
  }
985
- const O = (s) => typeof s == "string" && /^[a-zA-Z0-9:_.-]{1,160}$/.test(s) ? s : null;
986
- function rr(s) {
1027
+ const Ts = "0.1.259", Ji = {
1028
+ version: Ts
1029
+ }, O = (s) => typeof s == "string" && /^[a-zA-Z0-9:_.-]{1,160}$/.test(s) ? s : null;
1030
+ function or(s) {
987
1031
  if (!s || typeof s != "object") return !1;
988
1032
  const e = s, t = (n) => Number.isSafeInteger(n) && n >= 0, i = (n) => n && typeof n == "object" && Object.keys(n).every((r) => ["sequence", "at", "type", "changed", "generation", "sessionId", "scopeId", "requestId", "effectId", "clientScopeId", "reason", "effectKind", "eventType", "itemCount", "removedCount", "projectionReady"].includes(r)) && t(n.sequence) && t(n.at) && O(n.type) !== null && typeof n.changed == "boolean" && [n.generation, n.itemCount, n.removedCount].every((r) => r === null || t(r)) && [n.sessionId, n.scopeId, n.requestId, n.effectId, n.clientScopeId, n.reason, n.effectKind, n.eventType].every((r) => r === null || O(r) !== null) && (n.projectionReady === null || typeof n.projectionReady == "boolean");
989
1033
  return Object.keys(e).every((n) => ["ownerId", "revision", "dropped", "lastIntent", "lastSelection", "transitions"].includes(n)) && O(e.ownerId) !== null && t(e.revision) && t(e.dropped) && (e.lastIntent == null || i(e.lastIntent)) && (e.lastSelection === null || i(e.lastSelection)) && Array.isArray(e.transitions) && e.transitions.length <= 16 && e.transitions.every(i);
990
1034
  }
991
- function or(s, e, t) {
1035
+ function ar(s, e, t) {
992
1036
  const i = s;
993
1037
  if (!/^(directory\.|conversation\.|session\.)/.test(i.type ?? "") && !/^(directory\.|conversation\.|session\.)/.test(i.effectKind ?? "") || i.type === "conversation.display_received" && !["conversation.execution.updated", "conversation.item.removed"].includes(i.event?.type ?? "")) return null;
994
1038
  const n = i.output?.snapshot;
@@ -1011,28 +1055,28 @@ function or(s, e, t) {
1011
1055
  projectionReady: typeof n?.projection_ready == "boolean" ? n.projection_ready : null
1012
1056
  };
1013
1057
  }
1014
- function Ts(s) {
1058
+ function Es(s) {
1015
1059
  if (!s || typeof s != "object") return !1;
1016
1060
  const e = s;
1017
1061
  return Object.keys(e).every((t) => ["sessionId", "episodeId", "consecutiveFailures", "transportCode", "requestId", "durationMs"].includes(t)) && typeof e.sessionId == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(e.sessionId) && typeof e.episodeId == "string" && /^[a-zA-Z0-9:_-]{1,500}$/.test(e.episodeId) && (e.transportCode === void 0 || typeof e.transportCode == "string" && /^[a-z0-9_]{1,80}$/.test(e.transportCode)) && (e.requestId === void 0 || typeof e.requestId == "string" && /^[a-zA-Z0-9_-]{1,160}$/.test(e.requestId)) && (e.durationMs === void 0 || typeof e.durationMs == "number" && Number.isFinite(e.durationMs) && e.durationMs >= 0) && Number.isSafeInteger(e.consecutiveFailures) && e.consecutiveFailures >= 1;
1018
1062
  }
1019
- const ti = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"], Es = (s) => typeof s == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(s), ve = (s) => s === null || Es(s), ar = (s) => typeof s == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?(?:Z|\+00:00)$/.test(s) && Number.isFinite(Date.parse(s));
1020
- function ks(s) {
1063
+ const ti = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"], ks = (s) => typeof s == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(s), ve = (s) => s === null || ks(s), cr = (s) => typeof s == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?(?:Z|\+00:00)$/.test(s) && Number.isFinite(Date.parse(s));
1064
+ function qs(s) {
1021
1065
  if (!s || typeof s != "object") return !1;
1022
1066
  const e = s;
1023
- return Object.keys(s).every((t) => ["sessionId", "itemId", "userMessageId", "createdAt", "runId", "retryable"].includes(t)) && ve(e.sessionId) && Es(e.itemId) && ve(e.userMessageId) && (e.retryable === void 0 || typeof e.retryable == "boolean") && ve(e.runId) && (e.createdAt === null || ar(e.createdAt));
1067
+ return Object.keys(s).every((t) => ["sessionId", "itemId", "userMessageId", "createdAt", "runId", "retryable"].includes(t)) && ve(e.sessionId) && ks(e.itemId) && ve(e.userMessageId) && (e.retryable === void 0 || typeof e.retryable == "boolean") && ve(e.runId) && (e.createdAt === null || cr(e.createdAt));
1024
1068
  }
1025
- function cr(s) {
1069
+ function dr(s) {
1026
1070
  if (!s || typeof s != "object") return !1;
1027
1071
  const e = s, t = (i) => Number.isSafeInteger(i) && i >= 0;
1028
- return Object.keys(e).every((i) => ["capturedAt", "selectionKey", "userId", "loading", "draft", "thinking", "connected", "hasError", "phase", "queryStatus", "queryRequestId", "queryUpdatedAt", "renderSource", "selectionFencePending", "guardCreatedAt", "owner"].includes(i)) && t(e.capturedAt) && [e.queryUpdatedAt, e.guardCreatedAt].every((i) => i === null || t(i)) && [e.selectionKey, e.userId, e.phase, e.queryStatus, e.queryRequestId].every((i) => i === null || O(i) !== null) && [e.loading, e.draft, e.thinking, e.connected, e.hasError, e.selectionFencePending].every((i) => typeof i == "boolean") && ["state", "account", "interactions", "local", "sidepanel_layout"].includes(e.renderSource) && (e.owner === void 0 || rr(e.owner));
1072
+ return Object.keys(e).every((i) => ["capturedAt", "selectionKey", "userId", "loading", "draft", "thinking", "connected", "hasError", "phase", "queryStatus", "queryRequestId", "queryUpdatedAt", "renderSource", "selectionFencePending", "guardCreatedAt", "owner", "sdkVersion", "presentationGate", "firstObservedAt", "confirmationMs"].includes(i)) && t(e.capturedAt) && [e.queryUpdatedAt, e.guardCreatedAt].every((i) => i === null || t(i)) && [e.selectionKey, e.userId, e.phase, e.queryStatus, e.queryRequestId].every((i) => i === null || O(i) !== null) && [e.loading, e.draft, e.thinking, e.connected, e.hasError, e.selectionFencePending].every((i) => typeof i == "boolean") && ["state", "account", "interactions", "local", "sidepanel_layout", "observer"].includes(e.renderSource) && (e.owner === void 0 || or(e.owner)) && (e.sdkVersion === void 0 || typeof e.sdkVersion == "string" && e.sdkVersion.length <= 32 && /^\d+\.\d+\.\d+(?:[-+][a-zA-Z0-9.-]+)?$/.test(e.sdkVersion)) && (e.presentationGate === void 0 || ["none", "authentication", "signup"].includes(e.presentationGate)) && [e.firstObservedAt, e.confirmationMs].every((i) => i === void 0 || t(i));
1029
1073
  }
1030
- function qs(s) {
1074
+ function Cs(s) {
1031
1075
  if (!s || typeof s != "object" || Object.keys(s).some((i) => i !== "before" && i !== "current")) return !1;
1032
1076
  const e = (i) => {
1033
1077
  if (!i || typeof i != "object") return !1;
1034
1078
  const n = i;
1035
- return Object.keys(i).every((r) => [...ti, "sessionId", "runtimeItemCount", "welcome", "truncated", "thinkingSequence", "context", "duplicateToolCalls"].includes(r)) && (n.duplicateToolCalls === void 0 || Array.isArray(n.duplicateToolCalls) && n.duplicateToolCalls.length <= 5 && n.duplicateToolCalls.every((r) => r && Object.keys(r).every((a) => ["key", "count", "rows", "truncated"].includes(a)) && ve(r.key) && Number.isSafeInteger(r.count) && r.count >= 2 && typeof r.truncated == "boolean" && Array.isArray(r.rows) && r.rows.length >= 1 && r.rows.length <= 5 && r.rows.length <= r.count && r.rows.every((a) => a && Object.keys(a).every((o) => ["itemId", "groupId"].includes(o)) && ve(a.itemId) && ve(a.groupId)))) && (n.context === void 0 || cr(n.context)) && (n.thinkingSequence === void 0 || Array.isArray(n.thinkingSequence) && n.thinkingSequence.length <= 20 && n.thinkingSequence.every((r) => r === "user" || r === "thinking")) && ve(n.sessionId) && Number.isSafeInteger(n.runtimeItemCount) && n.runtimeItemCount >= 0 && typeof n.welcome == "boolean" && typeof n.truncated == "boolean" && ti.every((r) => Array.isArray(n[r]) && n[r].length <= 20 && n[r].every(Es));
1079
+ return Object.keys(i).every((r) => [...ti, "sessionId", "runtimeItemCount", "welcome", "truncated", "thinkingSequence", "context", "duplicateToolCalls"].includes(r)) && (n.duplicateToolCalls === void 0 || Array.isArray(n.duplicateToolCalls) && n.duplicateToolCalls.length <= 5 && n.duplicateToolCalls.every((r) => r && Object.keys(r).every((a) => ["key", "count", "rows", "truncated"].includes(a)) && ve(r.key) && Number.isSafeInteger(r.count) && r.count >= 2 && typeof r.truncated == "boolean" && Array.isArray(r.rows) && r.rows.length >= 1 && r.rows.length <= 5 && r.rows.length <= r.count && r.rows.every((a) => a && Object.keys(a).every((o) => ["itemId", "groupId"].includes(o)) && ve(a.itemId) && ve(a.groupId)))) && (n.context === void 0 || dr(n.context)) && (n.thinkingSequence === void 0 || Array.isArray(n.thinkingSequence) && n.thinkingSequence.length <= 20 && n.thinkingSequence.every((r) => r === "user" || r === "thinking")) && ve(n.sessionId) && Number.isSafeInteger(n.runtimeItemCount) && n.runtimeItemCount >= 0 && typeof n.welcome == "boolean" && typeof n.truncated == "boolean" && ti.every((r) => Array.isArray(n[r]) && n[r].length <= 20 && n[r].every(ks));
1036
1080
  }, t = s;
1037
1081
  return (t.before === null || e(t.before)) && e(t.current);
1038
1082
  }
@@ -1041,83 +1085,42 @@ function _e(s) {
1041
1085
  const e = s.replace(/\n\s*at\s[\s\S]*$/, "").replace(/-----BEGIN [^-]*PRIVATE KEY-----[\s\S]*?(?:-----END [^-]*PRIVATE KEY-----|$)/g, "[REDACTED]").replace(/\b(?:set-cookie|cookie)\s*[:=]\s*[^\n]+/gi, "cookie=[REDACTED]").replace(/\bdata:[^\s<>"']+/gi, "[DATA]").replace(/\b(?:https?:\/\/|www\.)[^\s<>"']+/gi, "[URL]").replace(/\b(?:Bearer|Basic)\s+[^\s,;"']+/gi, "[REDACTED]").replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?/g, "[REDACTED]").replace(/\b(?:sk|pk|ghp|gho|github_pat|xoxb|xoxp)[-_][A-Za-z0-9_-]{8,}/g, "[REDACTED]").replace(/\b((?:access|refresh|id|auth)[_-]?token|api[_-]?key|client[_-]?secret|password|passwd|pwd|secret|token|jwt|authorization|cookie|set-cookie)\b["']?\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s,;}&]+)/gi, "$1=[REDACTED]").replace(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/gi, "[EMAIL]").replace(/(?:[A-Z]:[\\/]|\\\\|(?:~|\.\.?)?\/|[\w.-]+[\\/])[^\s<>"']+/gi, "[FILE]").replace(new RegExp("(?<![\\w.])(?:[\\w.-]+\\.[A-Z][A-Z0-9]{0,15}|\\.[A-Z][\\w.-]*)\\b", "gi"), "[FILE]").replace(/\s+/g, " ").trim();
1042
1086
  return e.length > si ? `${e.slice(0, si - 1)}…` : e;
1043
1087
  }
1044
- function Ji(s) {
1088
+ function Qi(s) {
1045
1089
  let e = 2166136261;
1046
1090
  for (let t = 0; t < s.length; t += 1)
1047
1091
  e ^= s.charCodeAt(t), e = Math.imul(e, 16777619);
1048
1092
  return `fnv1a-${(e >>> 0).toString(16).padStart(8, "0")}`;
1049
1093
  }
1050
- const Cs = "0.1.257", Qi = {
1051
- version: Cs
1052
- };
1053
- function He(s) {
1054
- if (!s || typeof s != "object") return !1;
1055
- const e = s;
1056
- return Object.keys(s).every((t) => ["boundary", "category", "messageKind"].includes(t)) && ["runtime", "web_transport", "extension_ipc"].includes(e.boundary) && ["error", "object", "null", "array", "string", "undefined", "number", "boolean", "bigint", "symbol", "function"].includes(e.category) && ["object_coercion", "text", "blank", "non_text"].includes(e.messageKind);
1057
- }
1058
- function dr(s) {
1094
+ function lr(s) {
1059
1095
  if (!s || typeof s != "object") return !1;
1060
1096
  const e = s;
1061
- return Object.keys(e).every((t) => ["sessionId", "requestId", "code", "normalization", "builds", "clientMessageId"].includes(t)) && (e.clientMessageId === void 0 || O(e.clientMessageId) !== null) && [e.sessionId, e.requestId, e.code].every((t) => t === null || O(t) !== null) && (e.normalization === void 0 || He(e.normalization)) && !!e.builds && typeof e.builds == "object" && typeof e.builds.sdk == "string" && Object.entries(e.builds).every(([t, i]) => ["sdk", "rendererExtension", "contentExtension", "backgroundExtension"].includes(t) && typeof i == "string" && /^\d{1,5}\.\d{1,5}\.\d{1,5}$/.test(i));
1097
+ return Object.keys(e).every((t) => ["sessionId", "requestId", "code", "normalization", "builds", "clientMessageId"].includes(t)) && (e.clientMessageId === void 0 || O(e.clientMessageId) !== null) && [e.sessionId, e.requestId, e.code].every((t) => t === null || O(t) !== null) && (e.normalization === void 0 || ze(e.normalization)) && !!e.builds && typeof e.builds == "object" && typeof e.builds.sdk == "string" && Object.entries(e.builds).every(([t, i]) => ["sdk", "rendererExtension", "contentExtension", "backgroundExtension"].includes(t) && typeof i == "string" && /^\d{1,5}\.\d{1,5}\.\d{1,5}$/.test(i));
1062
1098
  }
1063
1099
  function Xi(s, e, t, i, n = {}) {
1064
- const r = !i && e === "conversation_error" && t !== void 0 && s.conversationDiagnostics?.errorMessageFingerprint === Ji(_e(t)) ? s.conversationDiagnostics : void 0;
1100
+ const r = !i && e === "conversation_error" && t !== void 0 && s.conversationDiagnostics?.errorMessageFingerprint === Qi(_e(t)) ? s.conversationDiagnostics : void 0;
1065
1101
  return {
1066
1102
  sessionId: O(s.sessionId),
1067
1103
  requestId: O(r?.httpRequest?.requestId ?? r?.errorRequestId ?? r?.queryRequestId),
1068
1104
  ...O(r?.failedClientMessageId) ? { clientMessageId: r.failedClientMessageId } : {},
1069
1105
  code: r ? O(s.lastErrorCode) : null,
1070
- ...He(r?.errorNormalization) ? { normalization: r.errorNormalization } : {},
1071
- builds: { sdk: Qi.version, ...n }
1106
+ ...ze(r?.errorNormalization) ? { normalization: r.errorNormalization } : {},
1107
+ builds: { sdk: Ji.version, ...n }
1072
1108
  };
1073
1109
  }
1074
- function lr(s) {
1075
- if (s.details !== void 0 && !$e(s.details))
1076
- throw new TypeError("Product Agent transported error details must be JSON-safe.");
1077
- return {
1078
- code: s.code,
1079
- message: s.message,
1080
- retryable: s.retryable,
1081
- ...s.details === void 0 ? {} : { details: s.details }
1082
- };
1083
- }
1084
- function he(s, e = "runtime_error", t = "runtime") {
1085
- const i = s !== null && typeof s == "object" ? s : null, n = typeof s == "string" ? s : i && "message" in i && typeof i.message == "string" ? i.message : "", r = i && "code" in i && typeof i.code == "string" && i.code.trim() ? i.code : e, a = i && "details" in i ? i.details : null, o = a && typeof a == "object" ? a : {}, c = {
1086
- // Preserve the first boundary's shape after normalization replaces the original message/prototype.
1087
- errorNormalization: He(o.errorNormalization) ? o.errorNormalization : {
1088
- boundary: t,
1089
- category: s instanceof Error ? "error" : s === null ? "null" : Array.isArray(s) ? "array" : typeof s,
1090
- messageKind: n.trim() === "[object Object]" ? "object_coercion" : n.trim() ? "text" : typeof s == "string" || i && "message" in i && typeof i.message == "string" ? "blank" : "non_text"
1091
- },
1092
- ...o.allocation === "unissued" ? { allocation: "unissued" } : {},
1093
- ...["unissued", "rejected"].includes(String(o.acceptance)) ? { acceptance: String(o.acceptance) } : {},
1094
- ...typeof o.securitySettingsUrl == "string" ? { securitySettingsUrl: o.securitySettingsUrl } : {},
1095
- ...typeof o.transportCode == "string" && /^[a-z0-9_]{1,80}$/.test(o.transportCode) ? { transportCode: o.transportCode } : {},
1096
- ...typeof o.requestId == "string" && /^[a-zA-Z0-9_-]{1,160}$/.test(o.requestId) ? { requestId: o.requestId } : {},
1097
- ...typeof o.durationMs == "number" && Number.isFinite(o.durationMs) && o.durationMs >= 0 ? { durationMs: o.durationMs } : {},
1098
- ...typeof o.successfulRequests == "number" && Number.isSafeInteger(o.successfulRequests) && o.successfulRequests >= 0 ? { successfulRequests: o.successfulRequests } : {}
1099
- };
1100
- return lr({
1101
- code: r,
1102
- message: n.trim() && n.trim() !== "[object Object]" ? n : "The Product Agent operation failed. Try again.",
1103
- retryable: !!(i && "retryable" in i && i.retryable === !0),
1104
- ...Object.keys(c).length ? { details: c } : {}
1105
- });
1106
- }
1107
1110
  function ur(s, e = "runtime") {
1108
- const t = he(s, "runtime_error", e), i = s !== null && typeof s == "object" && "stack" in s && typeof s.stack == "string" ? _e(s.stack.slice(0, 4e3).split(`
1111
+ const t = J(s, "runtime_error", e), i = s !== null && typeof s == "object" && "stack" in s && typeof s.stack == "string" ? _e(s.stack.slice(0, 4e3).split(`
1109
1112
  `).slice(0, 6).join(`
1110
1113
  `).replace(/\n\s*at\s/g, `
1111
1114
  frame `)) : void 0;
1112
1115
  return {
1113
- ...He(t.details?.errorNormalization) ? { normalization: t.details.errorNormalization } : {},
1116
+ ...ze(t.details?.errorNormalization) ? { normalization: t.details.errorNormalization } : {},
1114
1117
  category: s instanceof Error ? "error" : s === null ? "null" : Array.isArray(s) ? "array" : typeof s,
1115
1118
  code: _e(t.code),
1116
1119
  message: _e(t.message),
1117
1120
  ...i ? { stack: i } : {}
1118
1121
  };
1119
1122
  }
1120
- function de(s) {
1123
+ function le(s) {
1121
1124
  if (!s || typeof s != "object") return !1;
1122
1125
  const e = s, t = (i) => Number.isSafeInteger(i) && i >= 0;
1123
1126
  return Object.keys(e).every((i) => [
@@ -1302,7 +1305,7 @@ function K(s, e) {
1302
1305
  throw Object.assign(new Error("Conversation authority was retired."), { code: "authority_retired", retryable: !0 });
1303
1306
  }
1304
1307
  function me(s, e) {
1305
- const t = he(s, "connection_interrupted", "web_transport"), { code: i, message: n } = t, r = s instanceof Error && "detail" in s ? s.detail : s instanceof Error && "details" in s ? s.details : void 0, a = r && typeof r == "object" && "httpRequest" in r ? r.httpRequest : r, o = a && typeof a == "object" ? a : {}, c = o.category ?? o.transportCode, d = o.elapsedMs ?? o.durationMs, l = r && typeof r == "object" && "successfulRequests" in r && typeof r.successfulRequests == "number" ? r.successfulRequests : 0, u = r && typeof r == "object" && "securitySettingsUrl" in r && typeof r.securitySettingsUrl == "string" ? r.securitySettingsUrl : void 0, p = r && typeof r == "object" && "httpRequest" in r && de(r.httpRequest) ? r.httpRequest : void 0;
1308
+ const t = J(s, "connection_interrupted", "web_transport"), { code: i, message: n } = t, r = s instanceof Error && "detail" in s ? s.detail : s instanceof Error && "details" in s ? s.details : void 0, a = r && typeof r == "object" && "httpRequest" in r ? r.httpRequest : r, o = a && typeof a == "object" ? a : {}, c = o.category ?? o.transportCode, d = o.elapsedMs ?? o.durationMs, l = r && typeof r == "object" && "successfulRequests" in r && typeof r.successfulRequests == "number" ? r.successfulRequests : 0, u = r && typeof r == "object" && "securitySettingsUrl" in r && typeof r.securitySettingsUrl == "string" ? r.securitySettingsUrl : void 0, p = r && typeof r == "object" && "httpRequest" in r && le(r.httpRequest) ? r.httpRequest : void 0;
1306
1309
  return Object.assign(new Error(n), {
1307
1310
  code: i,
1308
1311
  // Keep the actionable public URL without copying arbitrary transport internals into durable errors.
@@ -1424,7 +1427,7 @@ function vr(s) {
1424
1427
  "conversations",
1425
1428
  { timing: u }
1426
1429
  );
1427
- if (K(s, o), p.request_id !== o.command.request_id || !$e(p.result)) throw Object.assign(new Error("Conversation response identity mismatch."), { code: "acceptance_identity_mismatch" });
1430
+ if (K(s, o), p.request_id !== o.command.request_id || !Le(p.result)) throw Object.assign(new Error("Conversation response identity mismatch."), { code: "acceptance_identity_mismatch" });
1428
1431
  if (o.command.type.startsWith("chat.")) {
1429
1432
  const f = p.result;
1430
1433
  if (typeof f?.sessionId != "string" || !f.sessionId || f.clientMessageId !== o.command.payload.clientMessageId || o.command.payload.sessionId && f.sessionId !== o.command.payload.sessionId) throw Object.assign(new Error("Conversation acceptance identity mismatch."), { code: "acceptance_identity_mismatch" });
@@ -1685,9 +1688,13 @@ class Ir {
1685
1688
  }
1686
1689
  }
1687
1690
  }
1691
+ function br(s, e) {
1692
+ const t = s?.executionByUserMessage[e]?.responseMessageIds, i = t?.indexOf(e) ?? -1;
1693
+ return t && i >= 0 ? t.slice(0, i + 1) : [e];
1694
+ }
1688
1695
  function Ie(s, e, t) {
1689
1696
  const i = s.submissionOrder.map((I) => s.submissions[I]).filter((I) => I.conversationScopeId === t), n = e.selections[t]?.sessionId ?? i.find((I) => !I.cancelled && I.sessionId !== null)?.sessionId ?? null, r = n ? s.sessions[n] : void 0, a = s.submissionOrder.map((I) => s.submissions[I]).filter((I) => n ? I.sessionId === n || I.sessionId === null && I.conversationScopeId === t : I.conversationScopeId === t), o = Object.values(r?.items ?? {}).sort((I, k) => {
1690
- const P = oe(I.created_at), L = oe(k.created_at);
1697
+ const P = ae(I.created_at), L = ae(k.created_at);
1691
1698
  return P < L ? -1 : P > L ? 1 : I.id < k.id ? -1 : I.id > k.id ? 1 : 0;
1692
1699
  }), c = a.filter((I) => (!I.cancelled || I.conversationScopeId === t && (I.sessionId === null || I.sessionId === n || n === null && I === a[a.length - 1])) && !r?.items[I.userMessageId] && !r?.removedItems[I.userMessageId]), d = {};
1693
1700
  for (const I of o) {
@@ -1720,14 +1727,14 @@ function Ie(s, e, t) {
1720
1727
  }
1721
1728
  const u = r?.execution, p = a.filter((I) => !I.cancelled && I.delivery !== "failed"), f = p.filter((I) => I.delivery !== "accepted" && I.executionVersion === null), m = p.filter((I) => I.delivery === "accepted" && I.executionVersion === null), h = p[p.length - 1], y = f.length > 0, g = h !== void 0 && m.includes(h);
1722
1729
  let b = y ? "submitting" : g ? "awaiting_execution" : u?.phase ?? "idle";
1723
- const v = Object.entries(s.stops).filter(([I]) => I === t || n !== null && e.selections[I]?.sessionId === n).map(([, I]) => I).find((I) => (!a.length || I.userMessageIds.includes(a[a.length - 1].userMessageId) || !y && !g && se(u).some((k) => I.userMessageIds.includes(k))) && (!u || u.version <= I.executionVersion || ["thinking", "steering", "queued", "stopping"].includes(u.phase) || a.some((k) => k.cancelled && k.executionVersion === null && I.userMessageIds.includes(k.userMessageId)))), _ = u && ["thinking", "steering", "queued", "stopping"].includes(u.phase) || a.some((I) => I.delivery === "accepted" && I.executionVersion === null && v?.userMessageIds.includes(I.userMessageId));
1724
- v && _ && !y && (!u || !["thinking", "steering", "queued", "stopping"].includes(u.phase) || se(u).every((I) => v.userMessageIds.includes(I))) && (b = "stopping"), v && !_ && !y && a.some((I) => I.cancelled && I.executionVersion === null && v.userMessageIds.includes(I.userMessageId)) && (b = a.some((I) => v.userMessageIds.includes(I.userMessageId) && ["sending", "uncertain"].includes(I.delivery)) ? "stopping" : "stopped");
1730
+ const v = Object.entries(s.stops).filter(([I]) => I === t || n !== null && e.selections[I]?.sessionId === n).map(([, I]) => I).find((I) => (!a.length || I.userMessageIds.includes(a[a.length - 1].userMessageId) || !y && !g && ie(u).some((k) => I.userMessageIds.includes(k))) && (!u || u.version <= I.executionVersion || ["thinking", "steering", "queued", "stopping"].includes(u.phase) || a.some((k) => k.cancelled && k.executionVersion === null && I.userMessageIds.includes(k.userMessageId)))), _ = u && ["thinking", "steering", "queued", "stopping"].includes(u.phase) || a.some((I) => I.delivery === "accepted" && I.executionVersion === null && v?.userMessageIds.includes(I.userMessageId));
1731
+ v && _ && !y && (!u || !["thinking", "steering", "queued", "stopping"].includes(u.phase) || ie(u).every((I) => v.userMessageIds.includes(I))) && (b = "stopping"), v && !_ && !y && a.some((I) => I.cancelled && I.executionVersion === null && v.userMessageIds.includes(I.userMessageId)) && (b = a.some((I) => v.userMessageIds.includes(I.userMessageId) && ["sending", "uncertain"].includes(I.delivery)) ? "stopping" : "stopped");
1725
1732
  const S = ["thinking", "steering", "queued"].includes(b), A = s.stops[t] ?? v, C = A?.userMessageIds.filter((I) => !["completed", "failed"].includes(r?.executionByUserMessage[I]?.phase ?? "")) ?? [], H = C.some((I) => {
1726
1733
  const k = a.find((L) => L.userMessageId === I);
1727
- return !Object.values(s.operations).some((L) => L.command.type === "run.stop" && L.command.payload.expectedUserMessageId === I && L.phase === "done") && (k?.executionVersion === null && ["sending", "uncertain", "accepted"].includes(k.delivery) || !!(u && se(u).includes(I) && ["thinking", "steering", "queued", "stopping"].includes(u.phase)));
1728
- }), B = u?.user_message_ids ?? [], J = y || g ? h?.userMessageId ?? null : B[B.length - 1] ?? null, R = l.find((I) => I.userMessageId === J), M = S ? [...R?.activityIds ?? []].reverse().find((I) => d[I] === "open") ?? null : null, E = n !== null && !!e.selections[t]?.provisionalId && o.length === 0 && a.length === 0 && // The first persisted idle snapshot already has a positive synchronization version.
1734
+ return !Object.values(s.operations).some((L) => L.command.type === "run.stop" && L.command.payload.expectedUserMessageId === I && L.phase === "done") && (k?.executionVersion === null && ["sending", "uncertain", "accepted"].includes(k.delivery) || !!(u && ie(u).includes(I) && ["thinking", "steering", "queued", "stopping"].includes(u.phase)));
1735
+ }), B = u?.user_message_ids ?? [], Q = y || g ? h?.userMessageId ?? null : B[B.length - 1] ?? null, R = l.find((I) => I.userMessageId === Q), M = S ? [...R?.activityIds ?? []].reverse().find((I) => d[I] === "open") ?? null : null, E = n !== null && !!e.selections[t]?.provisionalId && o.length === 0 && a.length === 0 && // The first persisted idle snapshot already has a positive synchronization version.
1729
1736
  (!r?.execution || r.execution.phase === "idle" && r.execution.user_message_ids.length === 0) && Object.values(s.operations).some((I) => I.conversationScopeId === t && I.phase === "done" && ["runtime.warmup", "attachment.prepare"].includes(I.command.type) && !I.command.payload.sessionId && I.result?.sessionId === n);
1730
- return ne({
1737
+ return re({
1731
1738
  historyRefreshFailure: r?.historyRefreshFailure ?? null,
1732
1739
  selectionKey: t ? JSON.stringify([s.authorityId, s.generation, t]) : void 0,
1733
1740
  isDraftSession: E,
@@ -1743,8 +1750,8 @@ function Ie(s, e, t) {
1743
1750
  streamStates: d,
1744
1751
  preparation: r?.preparation ?? null,
1745
1752
  stop: A ? { ...A, userMessageIds: C, pending: H } : null,
1746
- segments: l.map((I, k) => ({ ...I, collapsed: S ? I.userMessageId !== J : k < l.length - 1 || I.activityIds.length > 0 })),
1747
- activity: { phase: b, activeItemId: M, userMessageId: J, executionKey: JSON.stringify([...se(u)].sort()) },
1753
+ segments: l.map((I, k) => ({ ...I, collapsed: S ? I.userMessageId !== Q : k < l.length - 1 || I.activityIds.length > 0 })),
1754
+ activity: { phase: b, activeItemId: M, userMessageId: Q, executionKey: JSON.stringify([...ie(u)].sort()) },
1748
1755
  // Staging transfers the immutable input to the core. Waiting for backend acceptance leaves
1749
1756
  // the same submitted text in the optimistic transcript and composer during delivery.
1750
1757
  receipts: i.filter((I) => !I.cancelled && e.clients[I.clientScopeId] === t).map((I) => ({ viewId: I.viewId, userMessageId: I.userMessageId, acceptedRendererRevision: I.rendererRevision }))
@@ -1763,24 +1770,24 @@ function Yi(s, e) {
1763
1770
  const a = e ?? [...s.items].reverse().find((o) => o.type === "user_message")?.id ?? [...s.submissions].reverse().find((o) => !o.cancelled && o.delivery === "accepted")?.userMessageId;
1764
1771
  return s.sessionId && a ? { type: "execution", userMessageId: a, sessionId: s.sessionId } : null;
1765
1772
  }
1766
- function br(s, e) {
1767
- return ne({ scopes: Object.fromEntries([...new Set(Object.values(e.clients))].map((t) => [t, Ie(s, e, t)])) });
1768
- }
1769
1773
  function wr(s, e) {
1774
+ return re({ scopes: Object.fromEntries([...new Set(Object.values(e.clients))].map((t) => [t, Ie(s, e, t)])) });
1775
+ }
1776
+ function _r(s, e) {
1770
1777
  if (!e) return !1;
1771
1778
  const t = s.executionByUserMessage[e];
1772
1779
  if (t) return ["completed", "stopped", "failed"].includes(t.phase);
1773
- const i = Object.values(s.items).sort((r, a) => oe(r.created_at).localeCompare(oe(a.created_at)) || r.id.localeCompare(a.id));
1780
+ const i = Object.values(s.items).sort((r, a) => ae(r.created_at).localeCompare(ae(a.created_at)) || r.id.localeCompare(a.id));
1774
1781
  let n = !1;
1775
1782
  for (const r of i)
1776
1783
  if (r.type === "user_message" && (n = r.id === e), !!n && (r.type === "stopped" || r.type === "error" || r.type === "final_response" && s.streams[r.id]?.state === "finished" && s.streams[r.id].revision >= r.data.revision))
1777
1784
  return !0;
1778
1785
  return !1;
1779
1786
  }
1780
- const _r = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
1787
+ const Sr = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
1781
1788
  function Ae(s, e) {
1782
1789
  return e ? s.replace(
1783
- _r,
1790
+ Sr,
1784
1791
  (t, i, n, r) => `${i}${new URL(n, e).toString()}${r}`
1785
1792
  ) : s;
1786
1793
  }
@@ -1821,7 +1828,7 @@ function ii(s, e) {
1821
1828
  ...s.file_url === null ? {} : { fileUrl: new URL(s.file_url, e).toString() }
1822
1829
  };
1823
1830
  }
1824
- function Sr(s, e, t, i) {
1831
+ function Rr(s, e, t, i) {
1825
1832
  const n = t === "open" || t === "awaiting_content", r = {
1826
1833
  id: s.id,
1827
1834
  createdAt: s.created_at,
@@ -1862,7 +1869,7 @@ function Ot(s, e, t, i) {
1862
1869
  const n = /* @__PURE__ */ new Map();
1863
1870
  for (const v of s.segments)
1864
1871
  for (const _ of [...v.activityIds, ...v.outcomeIds]) n.set(_, v.userMessageId);
1865
- const r = s.items.map((v) => Sr(
1872
+ const r = s.items.map((v) => Rr(
1866
1873
  v,
1867
1874
  n.get(v.id) ?? null,
1868
1875
  s.streamStates[v.id],
@@ -1907,12 +1914,12 @@ function Ot(s, e, t, i) {
1907
1914
  isRetrying: s.isRetrying ?? !1,
1908
1915
  historyRefreshFailure: h === e?.error ? s.historyRefreshFailure ?? null : null,
1909
1916
  conversationDiagnostics: {
1910
- ...h ? { errorMessageFingerprint: Ji(_e(h.message)) } : {},
1917
+ ...h ? { errorMessageFingerprint: Qi(_e(h.message)) } : {},
1911
1918
  ...d && h && h === d.error && !p ? { failedClientMessageId: d.userMessageId } : {},
1912
1919
  ...typeof h?.details?.requestId == "string" ? { errorRequestId: h.details.requestId } : {},
1913
- ...He(h?.details?.errorNormalization) ? { errorNormalization: h.details.errorNormalization } : {},
1920
+ ...ze(h?.details?.errorNormalization) ? { errorNormalization: h.details.errorNormalization } : {},
1914
1921
  ...i ? { owner: i } : {},
1915
- ...de(h?.details?.httpRequest) ? { httpRequest: h.details.httpRequest } : {},
1922
+ ...le(h?.details?.httpRequest) ? { httpRequest: h.details.httpRequest } : {},
1916
1923
  queryStatus: e?.status ?? null,
1917
1924
  queryRequestId: e?.requestId ?? null,
1918
1925
  queryUpdatedAt: e?.updatedAt ?? null
@@ -1981,7 +1988,7 @@ function ni(s) {
1981
1988
  return "This request was interrupted before acceptance could be confirmed.";
1982
1989
  }
1983
1990
  }
1984
- function Rr(s) {
1991
+ function Ar(s) {
1985
1992
  return {
1986
1993
  content: s.content,
1987
1994
  ...typeof s.context.proactiveSuggestionQuestion == "string" ? { proactiveSuggestionQuestion: s.context.proactiveSuggestionQuestion } : {},
@@ -1998,7 +2005,7 @@ function Rr(s) {
1998
2005
  }))
1999
2006
  };
2000
2007
  }
2001
- function Ar(s) {
2008
+ function Tr(s) {
2002
2009
  const e = () => {
2003
2010
  const t = s.runtime(), i = t.engine.getState().slices.directory;
2004
2011
  return !t.isDisposed && i.authorityId === s.authority.authorityId && i.generation === s.authority.generation;
@@ -2103,31 +2110,31 @@ function it(s) {
2103
2110
  nextCursor: s.nextCursor
2104
2111
  };
2105
2112
  }
2106
- function Tr(s, e, t) {
2113
+ function Er(s, e, t) {
2107
2114
  if (t === "replace" || s === null) return e;
2108
2115
  const i = { ...s.entitiesById, ...e.entitiesById }, n = [...s.ids];
2109
2116
  for (const r of e.ids)
2110
2117
  s.entitiesById[r] || n.push(r);
2111
2118
  return { entitiesById: i, ids: n, nextCursor: e.nextCursor };
2112
2119
  }
2113
- function Er(s) {
2120
+ function kr(s) {
2114
2121
  return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
2115
2122
  }
2116
- function $d(s) {
2123
+ function Fd(s) {
2117
2124
  return s.visible ? s.minimized ? { state: "minimized" } : { state: s.open ? "visible_open" : "visible_closed" } : { state: "hidden" };
2118
2125
  }
2119
2126
  function nt(s, e) {
2120
2127
  return e === "limit_exceeded" ? { allowed: !1, reason: "credits_exhausted", actions: ["upgrade", "earn_credits"] } : e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required" ? { allowed: !1, reason: "payment_issue", actions: ["upgrade"] } : s ?? { allowed: !0, reason: "allowed", actions: [] };
2121
2128
  }
2122
- function kr(s) {
2129
+ function qr(s) {
2123
2130
  if (!s || typeof s != "object") return !1;
2124
2131
  const e = s.paidCreditFallbackModel;
2125
2132
  return typeof e == "string" && e.length > 0;
2126
2133
  }
2127
- function Fd(s) {
2134
+ function zd(s) {
2128
2135
  return s.submissionAllowed && s.isAuthenticated && s.hasWorkspace && !s.isWebsiteBlocked && s.isCurrentPageResolved && !s.isSubmitting && !s.hasPendingMessage;
2129
2136
  }
2130
- function zd(s) {
2137
+ function Hd(s) {
2131
2138
  const e = s.hasDraftMessage || s.hasPreSubmittedAttachment;
2132
2139
  return s.hasRunningAssistantTurn && !e ? {
2133
2140
  action: "stop",
@@ -2137,23 +2144,23 @@ function zd(s) {
2137
2144
  disabled: !e || !s.canSubmitMessage
2138
2145
  };
2139
2146
  }
2140
- const qr = "Pluno is reconnecting. Try again in a moment.";
2141
- function Cr(s) {
2142
- return (s instanceof Error ? s.message : s) === qr;
2143
- }
2144
- const ie = /* @__PURE__ */ Object.create(null);
2145
- ie.open = "0";
2146
- ie.close = "1";
2147
- ie.ping = "2";
2148
- ie.pong = "3";
2149
- ie.message = "4";
2150
- ie.upgrade = "5";
2151
- ie.noop = "6";
2147
+ const Cr = "Pluno is reconnecting. Try again in a moment.";
2148
+ function Mr(s) {
2149
+ return (s instanceof Error ? s.message : s) === Cr;
2150
+ }
2151
+ const ne = /* @__PURE__ */ Object.create(null);
2152
+ ne.open = "0";
2153
+ ne.close = "1";
2154
+ ne.ping = "2";
2155
+ ne.pong = "3";
2156
+ ne.message = "4";
2157
+ ne.upgrade = "5";
2158
+ ne.noop = "6";
2152
2159
  const rt = /* @__PURE__ */ Object.create(null);
2153
- Object.keys(ie).forEach((s) => {
2154
- rt[ie[s]] = s;
2160
+ Object.keys(ne).forEach((s) => {
2161
+ rt[ne[s]] = s;
2155
2162
  });
2156
- const hs = { type: "error", data: "parser error" }, Zi = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", en = typeof ArrayBuffer == "function", tn = (s) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(s) : s && s.buffer instanceof ArrayBuffer, Ms = ({ type: s, data: e }, t, i) => Zi && e instanceof Blob ? t ? i(e) : oi(e, i) : en && (e instanceof ArrayBuffer || tn(e)) ? t ? i(e) : oi(new Blob([e]), i) : i(ie[s] + (e || "")), oi = (s, e) => {
2163
+ const hs = { type: "error", data: "parser error" }, Zi = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", en = typeof ArrayBuffer == "function", tn = (s) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(s) : s && s.buffer instanceof ArrayBuffer, Ms = ({ type: s, data: e }, t, i) => Zi && e instanceof Blob ? t ? i(e) : oi(e, i) : en && (e instanceof ArrayBuffer || tn(e)) ? t ? i(e) : oi(new Blob([e]), i) : i(ne[s] + (e || "")), oi = (s, e) => {
2157
2164
  const t = new FileReader();
2158
2165
  return t.onload = function() {
2159
2166
  const i = t.result.split(",")[1];
@@ -2164,7 +2171,7 @@ function ai(s) {
2164
2171
  return s instanceof Uint8Array ? s : s instanceof ArrayBuffer ? new Uint8Array(s) : new Uint8Array(s.buffer, s.byteOffset, s.byteLength);
2165
2172
  }
2166
2173
  let Pt;
2167
- function Mr(s, e) {
2174
+ function Or(s, e) {
2168
2175
  if (Zi && s.data instanceof Blob)
2169
2176
  return s.data.arrayBuffer().then(ai).then(e);
2170
2177
  if (en && (s.data instanceof ArrayBuffer || tn(s.data)))
@@ -2176,14 +2183,14 @@ function Mr(s, e) {
2176
2183
  const ci = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Ue = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
2177
2184
  for (let s = 0; s < ci.length; s++)
2178
2185
  Ue[ci.charCodeAt(s)] = s;
2179
- const Or = (s) => {
2186
+ const Pr = (s) => {
2180
2187
  let e = s.length * 0.75, t = s.length, i, n = 0, r, a, o, c;
2181
2188
  s[s.length - 1] === "=" && (e--, s[s.length - 2] === "=" && e--);
2182
2189
  const d = new ArrayBuffer(e), l = new Uint8Array(d);
2183
2190
  for (i = 0; i < t; i += 4)
2184
2191
  r = Ue[s.charCodeAt(i)], a = Ue[s.charCodeAt(i + 1)], o = Ue[s.charCodeAt(i + 2)], c = Ue[s.charCodeAt(i + 3)], l[n++] = r << 2 | a >> 4, l[n++] = (a & 15) << 4 | o >> 2, l[n++] = (o & 3) << 6 | c & 63;
2185
2192
  return d;
2186
- }, Pr = typeof ArrayBuffer == "function", Os = (s, e) => {
2193
+ }, xr = typeof ArrayBuffer == "function", Os = (s, e) => {
2187
2194
  if (typeof s != "string")
2188
2195
  return {
2189
2196
  type: "message",
@@ -2192,20 +2199,20 @@ const Or = (s) => {
2192
2199
  const t = s.charAt(0);
2193
2200
  return t === "b" ? {
2194
2201
  type: "message",
2195
- data: xr(s.substring(1), e)
2202
+ data: Dr(s.substring(1), e)
2196
2203
  } : rt[t] ? s.length > 1 ? {
2197
2204
  type: rt[t],
2198
2205
  data: s.substring(1)
2199
2206
  } : {
2200
2207
  type: rt[t]
2201
2208
  } : hs;
2202
- }, xr = (s, e) => {
2203
- if (Pr) {
2204
- const t = Or(s);
2209
+ }, Dr = (s, e) => {
2210
+ if (xr) {
2211
+ const t = Pr(s);
2205
2212
  return sn(t, e);
2206
2213
  } else
2207
2214
  return { base64: !0, data: s };
2208
- }, sn = (s, e) => e === "blob" ? s instanceof Blob ? s : new Blob([s]) : s instanceof ArrayBuffer ? s : s.buffer, nn = "", Dr = (s, e) => {
2215
+ }, sn = (s, e) => e === "blob" ? s instanceof Blob ? s : new Blob([s]) : s instanceof ArrayBuffer ? s : s.buffer, nn = "", Ur = (s, e) => {
2209
2216
  const t = s.length, i = new Array(t);
2210
2217
  let n = 0;
2211
2218
  s.forEach((r, a) => {
@@ -2213,7 +2220,7 @@ const Or = (s) => {
2213
2220
  i[a] = o, ++n === t && e(i.join(nn));
2214
2221
  });
2215
2222
  });
2216
- }, Ur = (s, e) => {
2223
+ }, Nr = (s, e) => {
2217
2224
  const t = s.split(nn), i = [];
2218
2225
  for (let n = 0; n < t.length; n++) {
2219
2226
  const r = Os(t[n], e);
@@ -2222,10 +2229,10 @@ const Or = (s) => {
2222
2229
  }
2223
2230
  return i;
2224
2231
  };
2225
- function Nr() {
2232
+ function Br() {
2226
2233
  return new TransformStream({
2227
2234
  transform(s, e) {
2228
- Mr(s, (t) => {
2235
+ Or(s, (t) => {
2229
2236
  const i = t.length;
2230
2237
  let n;
2231
2238
  if (i < 126)
@@ -2257,7 +2264,7 @@ function Xe(s, e) {
2257
2264
  t[n] = s[0][i++], i === s[0].length && (s.shift(), i = 0);
2258
2265
  return s.length && i < s[0].length && (s[0] = s[0].slice(i)), t;
2259
2266
  }
2260
- function Br(s, e) {
2267
+ function jr(s, e) {
2261
2268
  xt || (xt = new TextDecoder());
2262
2269
  const t = [];
2263
2270
  let i = 0, n = -1, r = !1;
@@ -2299,9 +2306,9 @@ function Br(s, e) {
2299
2306
  }
2300
2307
  const rn = 4;
2301
2308
  function U(s) {
2302
- if (s) return jr(s);
2309
+ if (s) return Lr(s);
2303
2310
  }
2304
- function jr(s) {
2311
+ function Lr(s) {
2305
2312
  for (var e in U.prototype)
2306
2313
  s[e] = U.prototype[e];
2307
2314
  return s;
@@ -2347,19 +2354,19 @@ U.prototype.listeners = function(s) {
2347
2354
  U.prototype.hasListeners = function(s) {
2348
2355
  return !!this.listeners(s).length;
2349
2356
  };
2350
- const vt = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), Z = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Lr = "arraybuffer";
2357
+ const vt = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), ee = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), $r = "arraybuffer";
2351
2358
  function on(s, ...e) {
2352
2359
  return e.reduce((t, i) => (s.hasOwnProperty(i) && (t[i] = s[i]), t), {});
2353
2360
  }
2354
- const $r = Z.setTimeout, Fr = Z.clearTimeout;
2361
+ const Fr = ee.setTimeout, zr = ee.clearTimeout;
2355
2362
  function It(s, e) {
2356
- e.useNativeTimers ? (s.setTimeoutFn = $r.bind(Z), s.clearTimeoutFn = Fr.bind(Z)) : (s.setTimeoutFn = Z.setTimeout.bind(Z), s.clearTimeoutFn = Z.clearTimeout.bind(Z));
2357
- }
2358
- const zr = 1.33;
2359
- function Hr(s) {
2360
- return typeof s == "string" ? Kr(s) : Math.ceil((s.byteLength || s.size) * zr);
2363
+ e.useNativeTimers ? (s.setTimeoutFn = Fr.bind(ee), s.clearTimeoutFn = zr.bind(ee)) : (s.setTimeoutFn = ee.setTimeout.bind(ee), s.clearTimeoutFn = ee.clearTimeout.bind(ee));
2361
2364
  }
2365
+ const Hr = 1.33;
2362
2366
  function Kr(s) {
2367
+ return typeof s == "string" ? Wr(s) : Math.ceil((s.byteLength || s.size) * Hr);
2368
+ }
2369
+ function Wr(s) {
2363
2370
  let e = 0, t = 0;
2364
2371
  for (let i = 0, n = s.length; i < n; i++)
2365
2372
  e = s.charCodeAt(i), e < 128 ? t += 1 : e < 2048 ? t += 2 : e < 55296 || e >= 57344 ? t += 3 : (i++, t += 4);
@@ -2368,13 +2375,13 @@ function Kr(s) {
2368
2375
  function an() {
2369
2376
  return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
2370
2377
  }
2371
- function Wr(s) {
2378
+ function Vr(s) {
2372
2379
  let e = "";
2373
2380
  for (let t in s)
2374
2381
  s.hasOwnProperty(t) && (e.length && (e += "&"), e += encodeURIComponent(t) + "=" + encodeURIComponent(s[t]));
2375
2382
  return e;
2376
2383
  }
2377
- function Vr(s) {
2384
+ function Gr(s) {
2378
2385
  let e = {}, t = s.split("&");
2379
2386
  for (let i = 0, n = t.length; i < n; i++) {
2380
2387
  let r = t[i].split("=");
@@ -2382,7 +2389,7 @@ function Vr(s) {
2382
2389
  }
2383
2390
  return e;
2384
2391
  }
2385
- class Gr extends Error {
2392
+ class Jr extends Error {
2386
2393
  constructor(e, t, i) {
2387
2394
  super(e), this.description = t, this.context = i, this.type = "TransportError";
2388
2395
  }
@@ -2407,7 +2414,7 @@ class Ps extends U {
2407
2414
  * @protected
2408
2415
  */
2409
2416
  onError(e, t, i) {
2410
- return super.emitReserved("error", new Gr(e, t, i)), this;
2417
+ return super.emitReserved("error", new Jr(e, t, i)), this;
2411
2418
  }
2412
2419
  /**
2413
2420
  * Opens the transport.
@@ -2481,11 +2488,11 @@ class Ps extends U {
2481
2488
  return this.opts.port && (this.opts.secure && Number(this.opts.port) !== 443 || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
2482
2489
  }
2483
2490
  _query(e) {
2484
- const t = Wr(e);
2491
+ const t = Vr(e);
2485
2492
  return t.length ? "?" + t : "";
2486
2493
  }
2487
2494
  }
2488
- class Jr extends Ps {
2495
+ class Qr extends Ps {
2489
2496
  constructor() {
2490
2497
  super(...arguments), this._polling = !1;
2491
2498
  }
@@ -2541,7 +2548,7 @@ class Jr extends Ps {
2541
2548
  return this.onClose({ description: "transport closed by the server" }), !1;
2542
2549
  this.onPacket(i);
2543
2550
  };
2544
- Ur(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
2551
+ Nr(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
2545
2552
  }
2546
2553
  /**
2547
2554
  * For polling, send a close packet.
@@ -2561,7 +2568,7 @@ class Jr extends Ps {
2561
2568
  * @protected
2562
2569
  */
2563
2570
  write(e) {
2564
- this.writable = !1, Dr(e, (t) => {
2571
+ this.writable = !1, Ur(e, (t) => {
2565
2572
  this.doWrite(t, () => {
2566
2573
  this.writable = !0, this.emitReserved("drain");
2567
2574
  });
@@ -2582,10 +2589,10 @@ try {
2582
2589
  cn = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
2583
2590
  } catch {
2584
2591
  }
2585
- const Qr = cn;
2586
- function Xr() {
2592
+ const Xr = cn;
2593
+ function Yr() {
2587
2594
  }
2588
- class Yr extends Jr {
2595
+ class Zr extends Qr {
2589
2596
  /**
2590
2597
  * XHR Polling constructor.
2591
2598
  *
@@ -2698,7 +2705,7 @@ let Te = class ot extends U {
2698
2705
  */
2699
2706
  _cleanup(e) {
2700
2707
  if (!(typeof this._xhr > "u" || this._xhr === null)) {
2701
- if (this._xhr.onreadystatechange = Xr, e)
2708
+ if (this._xhr.onreadystatechange = Yr, e)
2702
2709
  try {
2703
2710
  this._xhr.abort();
2704
2711
  } catch {
@@ -2730,7 +2737,7 @@ if (typeof document < "u") {
2730
2737
  if (typeof attachEvent == "function")
2731
2738
  attachEvent("onunload", di);
2732
2739
  else if (typeof addEventListener == "function") {
2733
- const s = "onpagehide" in Z ? "pagehide" : "unload";
2740
+ const s = "onpagehide" in ee ? "pagehide" : "unload";
2734
2741
  addEventListener(s, di, !1);
2735
2742
  }
2736
2743
  }
@@ -2738,17 +2745,17 @@ function di() {
2738
2745
  for (let s in Te.requests)
2739
2746
  Te.requests.hasOwnProperty(s) && Te.requests[s].abort();
2740
2747
  }
2741
- const Zr = (function() {
2748
+ const eo = (function() {
2742
2749
  const s = dn({
2743
2750
  xdomain: !1
2744
2751
  });
2745
2752
  return s && s.responseType !== null;
2746
2753
  })();
2747
- class eo extends Yr {
2754
+ class to extends Zr {
2748
2755
  constructor(e) {
2749
2756
  super(e);
2750
2757
  const t = e && e.forceBase64;
2751
- this.supportsBinary = Zr && !t;
2758
+ this.supportsBinary = eo && !t;
2752
2759
  }
2753
2760
  request(e = {}) {
2754
2761
  return Object.assign(e, { xd: this.xd }, this.opts), new Te(dn, this.uri(), e);
@@ -2757,18 +2764,18 @@ class eo extends Yr {
2757
2764
  function dn(s) {
2758
2765
  const e = s.xdomain;
2759
2766
  try {
2760
- if (typeof XMLHttpRequest < "u" && (!e || Qr))
2767
+ if (typeof XMLHttpRequest < "u" && (!e || Xr))
2761
2768
  return new XMLHttpRequest();
2762
2769
  } catch {
2763
2770
  }
2764
2771
  if (!e)
2765
2772
  try {
2766
- return new Z[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
2773
+ return new ee[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
2767
2774
  } catch {
2768
2775
  }
2769
2776
  }
2770
2777
  const ln = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
2771
- class to extends Ps {
2778
+ class so extends Ps {
2772
2779
  get name() {
2773
2780
  return "websocket";
2774
2781
  }
@@ -2824,8 +2831,8 @@ class to extends Ps {
2824
2831
  return this.opts.timestampRequests && (t[this.opts.timestampParam] = an()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
2825
2832
  }
2826
2833
  }
2827
- const Dt = Z.WebSocket || Z.MozWebSocket;
2828
- class so extends to {
2834
+ const Dt = ee.WebSocket || ee.MozWebSocket;
2835
+ class io extends so {
2829
2836
  createSocket(e, t, i) {
2830
2837
  return ln ? new Dt(e, t, i) : t ? new Dt(e, t) : new Dt(e);
2831
2838
  }
@@ -2833,7 +2840,7 @@ class so extends to {
2833
2840
  this.ws.send(t);
2834
2841
  }
2835
2842
  }
2836
- class io extends Ps {
2843
+ class no extends Ps {
2837
2844
  get name() {
2838
2845
  return "webtransport";
2839
2846
  }
@@ -2849,7 +2856,7 @@ class io extends Ps {
2849
2856
  this.onError("webtransport error", e);
2850
2857
  }), this._transport.ready.then(() => {
2851
2858
  this._transport.createBidirectionalStream().then((e) => {
2852
- const t = Br(Number.MAX_SAFE_INTEGER, this.socket.binaryType), i = e.readable.pipeThrough(t).getReader(), n = Nr();
2859
+ const t = jr(Number.MAX_SAFE_INTEGER, this.socket.binaryType), i = e.readable.pipeThrough(t).getReader(), n = Br();
2853
2860
  n.readable.pipeTo(e.writable), this._writer = n.writable.getWriter();
2854
2861
  const r = () => {
2855
2862
  i.read().then(({ done: o, value: c }) => {
@@ -2879,11 +2886,11 @@ class io extends Ps {
2879
2886
  (e = this._transport) === null || e === void 0 || e.close();
2880
2887
  }
2881
2888
  }
2882
- const no = {
2883
- websocket: so,
2884
- webtransport: io,
2885
- polling: eo
2886
- }, ro = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, oo = [
2889
+ const ro = {
2890
+ websocket: io,
2891
+ webtransport: no,
2892
+ polling: to
2893
+ }, oo = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, ao = [
2887
2894
  "source",
2888
2895
  "protocol",
2889
2896
  "authority",
@@ -2904,16 +2911,16 @@ function ps(s) {
2904
2911
  throw "URI too long";
2905
2912
  const e = s, t = s.indexOf("["), i = s.indexOf("]");
2906
2913
  t != -1 && i != -1 && (s = s.substring(0, t) + s.substring(t, i).replace(/:/g, ";") + s.substring(i, s.length));
2907
- let n = ro.exec(s || ""), r = {}, a = 14;
2914
+ let n = oo.exec(s || ""), r = {}, a = 14;
2908
2915
  for (; a--; )
2909
- r[oo[a]] = n[a] || "";
2910
- return t != -1 && i != -1 && (r.source = e, r.host = r.host.substring(1, r.host.length - 1).replace(/;/g, ":"), r.authority = r.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), r.ipv6uri = !0), r.pathNames = ao(r, r.path), r.queryKey = co(r, r.query), r;
2916
+ r[ao[a]] = n[a] || "";
2917
+ return t != -1 && i != -1 && (r.source = e, r.host = r.host.substring(1, r.host.length - 1).replace(/;/g, ":"), r.authority = r.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), r.ipv6uri = !0), r.pathNames = co(r, r.path), r.queryKey = lo(r, r.query), r;
2911
2918
  }
2912
- function ao(s, e) {
2919
+ function co(s, e) {
2913
2920
  const t = /\/{2,9}/g, i = e.replace(t, "/").split("/");
2914
2921
  return (e.slice(0, 1) == "/" || e.length === 0) && i.splice(0, 1), e.slice(-1) == "/" && i.splice(i.length - 1, 1), i;
2915
2922
  }
2916
- function co(s, e) {
2923
+ function lo(s, e) {
2917
2924
  const t = {};
2918
2925
  return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(i, n, r) {
2919
2926
  n && (t[n] = r);
@@ -2931,7 +2938,7 @@ class fe extends U {
2931
2938
  * @param {Object} opts - options
2932
2939
  */
2933
2940
  constructor(e, t) {
2934
- if (super(), this.binaryType = Lr, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, e && typeof e == "object" && (t = e, e = null), e) {
2941
+ if (super(), this.binaryType = $r, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, e && typeof e == "object" && (t = e, e = null), e) {
2935
2942
  const i = ps(e);
2936
2943
  t.hostname = i.host, t.secure = i.protocol === "https" || i.protocol === "wss", t.port = i.port, i.query && (t.query = i.query);
2937
2944
  } else t.host && (t.hostname = ps(t.host).host);
@@ -2952,7 +2959,7 @@ class fe extends U {
2952
2959
  },
2953
2960
  transportOptions: {},
2954
2961
  closeOnBeforeunload: !1
2955
- }, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = Vr(this.opts.query)), fs && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
2962
+ }, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = Gr(this.opts.query)), fs && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
2956
2963
  this.transport && (this.transport.removeAllListeners(), this.transport.close());
2957
2964
  }, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
2958
2965
  this._onClose("transport close", {
@@ -3087,7 +3094,7 @@ class fe extends U {
3087
3094
  let t = 1;
3088
3095
  for (let i = 0; i < this.writeBuffer.length; i++) {
3089
3096
  const n = this.writeBuffer[i].data;
3090
- if (n && (t += Hr(n)), i > 0 && t > this._maxPayload)
3097
+ if (n && (t += Kr(n)), i > 0 && t > this._maxPayload)
3091
3098
  return this.writeBuffer.slice(0, i);
3092
3099
  t += 2;
3093
3100
  }
@@ -3194,7 +3201,7 @@ class fe extends U {
3194
3201
  }
3195
3202
  }
3196
3203
  fe.protocol = rn;
3197
- class lo extends fe {
3204
+ class uo extends fe {
3198
3205
  constructor() {
3199
3206
  super(...arguments), this._upgrades = [];
3200
3207
  }
@@ -3266,21 +3273,21 @@ class lo extends fe {
3266
3273
  return t;
3267
3274
  }
3268
3275
  }
3269
- let uo = class extends lo {
3276
+ let ho = class extends uo {
3270
3277
  constructor(e, t = {}) {
3271
3278
  const i = typeof e == "object", n = i ? { ...e } : { ...t };
3272
- (!n.transports || n.transports && typeof n.transports[0] == "string") && (n.transports = (n.transports || ["polling", "websocket", "webtransport"]).map((r) => no[r]).filter((r) => !!r)), super(i ? n : e, n);
3279
+ (!n.transports || n.transports && typeof n.transports[0] == "string") && (n.transports = (n.transports || ["polling", "websocket", "webtransport"]).map((r) => ro[r]).filter((r) => !!r)), super(i ? n : e, n);
3273
3280
  }
3274
3281
  };
3275
- function ho(s, e = "", t) {
3282
+ function po(s, e = "", t) {
3276
3283
  let i = s;
3277
3284
  t = t || typeof location < "u" && location, s == null && (s = t.protocol + "//" + t.host), typeof s == "string" && (s.charAt(0) === "/" && (s.charAt(1) === "/" ? s = t.protocol + s : s = t.host + s), /^(https?|wss?):\/\//.test(s) || (typeof t < "u" ? s = t.protocol + "//" + s : s = "https://" + s), i = ps(s)), i.port || (/^(http|ws)$/.test(i.protocol) ? i.port = "80" : /^(http|ws)s$/.test(i.protocol) && (i.port = "443")), i.path = i.path || "/";
3278
3285
  const r = i.host.indexOf(":") !== -1 ? "[" + i.host + "]" : i.host;
3279
3286
  return i.id = i.protocol + "://" + r + ":" + i.port + e, i.href = i.protocol + "://" + r + (t && t.port === i.port ? "" : ":" + i.port), i;
3280
3287
  }
3281
- const po = typeof ArrayBuffer == "function", fo = (s) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(s) : s.buffer instanceof ArrayBuffer, un = Object.prototype.toString, mo = typeof Blob == "function" || typeof Blob < "u" && un.call(Blob) === "[object BlobConstructor]", go = typeof File == "function" || typeof File < "u" && un.call(File) === "[object FileConstructor]";
3288
+ const fo = typeof ArrayBuffer == "function", mo = (s) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(s) : s.buffer instanceof ArrayBuffer, un = Object.prototype.toString, go = typeof Blob == "function" || typeof Blob < "u" && un.call(Blob) === "[object BlobConstructor]", yo = typeof File == "function" || typeof File < "u" && un.call(File) === "[object FileConstructor]";
3282
3289
  function xs(s) {
3283
- return po && (s instanceof ArrayBuffer || fo(s)) || mo && s instanceof Blob || go && s instanceof File;
3290
+ return fo && (s instanceof ArrayBuffer || mo(s)) || go && s instanceof Blob || yo && s instanceof File;
3284
3291
  }
3285
3292
  function ct(s, e) {
3286
3293
  if (!s || typeof s != "object")
@@ -3300,7 +3307,7 @@ function ct(s, e) {
3300
3307
  return !0;
3301
3308
  return !1;
3302
3309
  }
3303
- function yo(s) {
3310
+ function vo(s) {
3304
3311
  const e = [], t = s.data, i = s;
3305
3312
  return i.data = dt(t, e), i.attachments = e.length, { packet: i, buffers: e };
3306
3313
  }
@@ -3325,7 +3332,7 @@ function dt(s, e, t) {
3325
3332
  }
3326
3333
  return s;
3327
3334
  }
3328
- function vo(s, e) {
3335
+ function Io(s, e) {
3329
3336
  return s.data = ms(s.data, e), delete s.attachments, s;
3330
3337
  }
3331
3338
  function ms(s, e) {
@@ -3343,7 +3350,7 @@ function ms(s, e) {
3343
3350
  Object.prototype.hasOwnProperty.call(s, t) && (s[t] = ms(s[t], e));
3344
3351
  return s;
3345
3352
  }
3346
- const Io = [
3353
+ const bo = [
3347
3354
  "connect",
3348
3355
  // used on the client side
3349
3356
  "connect_error",
@@ -3361,7 +3368,7 @@ var T;
3361
3368
  (function(s) {
3362
3369
  s[s.CONNECT = 0] = "CONNECT", s[s.DISCONNECT = 1] = "DISCONNECT", s[s.EVENT = 2] = "EVENT", s[s.ACK = 3] = "ACK", s[s.CONNECT_ERROR = 4] = "CONNECT_ERROR", s[s.BINARY_EVENT = 5] = "BINARY_EVENT", s[s.BINARY_ACK = 6] = "BINARY_ACK";
3363
3370
  })(T || (T = {}));
3364
- class bo {
3371
+ class wo {
3365
3372
  /**
3366
3373
  * Encoder constructor
3367
3374
  *
@@ -3397,7 +3404,7 @@ class bo {
3397
3404
  * a list of buffers.
3398
3405
  */
3399
3406
  encodeAsBinary(e) {
3400
- const t = yo(e), i = this.encodeAsString(t.packet), n = t.buffers;
3407
+ const t = vo(e), i = this.encodeAsString(t.packet), n = t.buffers;
3401
3408
  return n.unshift(i), n;
3402
3409
  }
3403
3410
  }
@@ -3423,7 +3430,7 @@ class Ds extends U {
3423
3430
  throw new Error("got plaintext data when reconstructing a packet");
3424
3431
  t = this.decodeString(e);
3425
3432
  const i = t.type === T.BINARY_EVENT;
3426
- i || t.type === T.BINARY_ACK ? (t.type = i ? T.EVENT : T.ACK, this.reconstructor = new wo(t)) : super.emitReserved("decoded", t);
3433
+ i || t.type === T.BINARY_ACK ? (t.type = i ? T.EVENT : T.ACK, this.reconstructor = new _o(t)) : super.emitReserved("decoded", t);
3427
3434
  } else if (xs(e) || e.base64)
3428
3435
  if (this.reconstructor)
3429
3436
  t = this.reconstructor.takeBinaryData(e), t && (this.reconstructor = null, super.emitReserved("decoded", t));
@@ -3453,7 +3460,7 @@ class Ds extends U {
3453
3460
  if (a != Number(a) || e.charAt(t) !== "-")
3454
3461
  throw new Error("Illegal attachments");
3455
3462
  const o = Number(a);
3456
- if (!_o(o) || o < 1)
3463
+ if (!So(o) || o < 1)
3457
3464
  throw new Error("Illegal attachments");
3458
3465
  if (o > this.opts.maxAttachments)
3459
3466
  throw new Error("too many attachments");
@@ -3506,7 +3513,7 @@ class Ds extends U {
3506
3513
  return typeof t == "string" || li(t);
3507
3514
  case T.EVENT:
3508
3515
  case T.BINARY_EVENT:
3509
- return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && Io.indexOf(t[0]) === -1);
3516
+ return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && bo.indexOf(t[0]) === -1);
3510
3517
  case T.ACK:
3511
3518
  case T.BINARY_ACK:
3512
3519
  return Array.isArray(t);
@@ -3519,7 +3526,7 @@ class Ds extends U {
3519
3526
  this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
3520
3527
  }
3521
3528
  }
3522
- class wo {
3529
+ class _o {
3523
3530
  constructor(e) {
3524
3531
  this.packet = e, this.buffers = [], this.reconPack = e;
3525
3532
  }
@@ -3533,7 +3540,7 @@ class wo {
3533
3540
  */
3534
3541
  takeBinaryData(e) {
3535
3542
  if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
3536
- const t = vo(this.reconPack, this.buffers);
3543
+ const t = Io(this.reconPack, this.buffers);
3537
3544
  return this.finishedReconstruction(), t;
3538
3545
  }
3539
3546
  return null;
@@ -3545,26 +3552,26 @@ class wo {
3545
3552
  this.reconPack = null, this.buffers = [];
3546
3553
  }
3547
3554
  }
3548
- const _o = Number.isInteger || function(s) {
3555
+ const So = Number.isInteger || function(s) {
3549
3556
  return typeof s == "number" && isFinite(s) && Math.floor(s) === s;
3550
3557
  };
3551
3558
  function li(s) {
3552
3559
  return Object.prototype.toString.call(s) === "[object Object]";
3553
3560
  }
3554
- const So = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3561
+ const Ro = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3555
3562
  __proto__: null,
3556
3563
  Decoder: Ds,
3557
- Encoder: bo,
3564
+ Encoder: wo,
3558
3565
  get PacketType() {
3559
3566
  return T;
3560
3567
  }
3561
3568
  }, Symbol.toStringTag, { value: "Module" }));
3562
- function te(s, e, t) {
3569
+ function se(s, e, t) {
3563
3570
  return s.on(e, t), function() {
3564
3571
  s.off(e, t);
3565
3572
  };
3566
3573
  }
3567
- const Ro = Object.freeze({
3574
+ const Ao = Object.freeze({
3568
3575
  connect: 1,
3569
3576
  connect_error: 1,
3570
3577
  disconnect: 1,
@@ -3607,10 +3614,10 @@ class hn extends U {
3607
3614
  return;
3608
3615
  const e = this.io;
3609
3616
  this.subs = [
3610
- te(e, "open", this.onopen.bind(this)),
3611
- te(e, "packet", this.onpacket.bind(this)),
3612
- te(e, "error", this.onerror.bind(this)),
3613
- te(e, "close", this.onclose.bind(this))
3617
+ se(e, "open", this.onopen.bind(this)),
3618
+ se(e, "packet", this.onpacket.bind(this)),
3619
+ se(e, "error", this.onerror.bind(this)),
3620
+ se(e, "close", this.onclose.bind(this))
3614
3621
  ];
3615
3622
  }
3616
3623
  /**
@@ -3689,7 +3696,7 @@ class hn extends U {
3689
3696
  */
3690
3697
  emit(e, ...t) {
3691
3698
  var i, n, r;
3692
- if (Ro.hasOwnProperty(e))
3699
+ if (Ao.hasOwnProperty(e))
3693
3700
  throw new Error('"' + e.toString() + '" is a reserved event name');
3694
3701
  if (t.unshift(e), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
3695
3702
  return this._addToQueue(t), this;
@@ -4196,7 +4203,7 @@ class gs extends U {
4196
4203
  max: this.reconnectionDelayMax(),
4197
4204
  jitter: this.randomizationFactor()
4198
4205
  }), this.timeout(t.timeout == null ? 2e4 : t.timeout), this._readyState = "closed", this.uri = e;
4199
- const n = t.parser || So;
4206
+ const n = t.parser || Ro;
4200
4207
  this.encoder = new n.Encoder(), this.decoder = new n.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
4201
4208
  }
4202
4209
  reconnection(e) {
@@ -4239,14 +4246,14 @@ class gs extends U {
4239
4246
  open(e) {
4240
4247
  if (~this._readyState.indexOf("open"))
4241
4248
  return this;
4242
- this.engine = new uo(this.uri, this.opts);
4249
+ this.engine = new ho(this.uri, this.opts);
4243
4250
  const t = this.engine, i = this;
4244
4251
  this._readyState = "opening", this.skipReconnect = !1;
4245
- const n = te(t, "open", function() {
4252
+ const n = se(t, "open", function() {
4246
4253
  i.onopen(), e && e();
4247
4254
  }), r = (o) => {
4248
4255
  this.cleanup(), this._readyState = "closed", this.emitReserved("error", o), e ? e(o) : this.maybeReconnectOnOpen();
4249
- }, a = te(t, "error", r);
4256
+ }, a = se(t, "error", r);
4250
4257
  if (this._timeout !== !1) {
4251
4258
  const o = this._timeout, c = this.setTimeoutFn(() => {
4252
4259
  n(), r(new Error("timeout")), t.close();
@@ -4275,12 +4282,12 @@ class gs extends U {
4275
4282
  this.cleanup(), this._readyState = "open", this.emitReserved("open");
4276
4283
  const e = this.engine;
4277
4284
  this.subs.push(
4278
- te(e, "ping", this.onping.bind(this)),
4279
- te(e, "data", this.ondata.bind(this)),
4280
- te(e, "error", this.onerror.bind(this)),
4281
- te(e, "close", this.onclose.bind(this)),
4285
+ se(e, "ping", this.onping.bind(this)),
4286
+ se(e, "data", this.ondata.bind(this)),
4287
+ se(e, "error", this.onerror.bind(this)),
4288
+ se(e, "close", this.onclose.bind(this)),
4282
4289
  // @ts-ignore
4283
- te(this.decoder, "decoded", this.ondecoded.bind(this))
4290
+ se(this.decoder, "decoded", this.ondecoded.bind(this))
4284
4291
  );
4285
4292
  }
4286
4293
  /**
@@ -4429,7 +4436,7 @@ class gs extends U {
4429
4436
  const Me = {};
4430
4437
  function lt(s, e) {
4431
4438
  typeof s == "object" && (e = s, s = void 0), e = e || {};
4432
- const t = ho(s, e.path || "/socket.io"), i = t.source, n = t.id, r = t.path, a = Me[n] && r in Me[n].nsps, o = e.forceNew || e["force new connection"] || e.multiplex === !1 || a;
4439
+ const t = po(s, e.path || "/socket.io"), i = t.source, n = t.id, r = t.path, a = Me[n] && r in Me[n].nsps, o = e.forceNew || e["force new connection"] || e.multiplex === !1 || a;
4433
4440
  let c;
4434
4441
  return o ? c = new gs(i, e) : (Me[n] || (Me[n] = new gs(i, e)), c = Me[n]), t.query && !e.query && (e.query = t.queryKey), c.socket(t.path, e);
4435
4442
  }
@@ -4439,7 +4446,7 @@ Object.assign(lt, {
4439
4446
  io: lt,
4440
4447
  connect: lt
4441
4448
  });
4442
- const Ao = 9e4, To = /* @__PURE__ */ new Set([
4449
+ const To = 9e4, Eo = /* @__PURE__ */ new Set([
4443
4450
  "chat.user_message",
4444
4451
  "chat.retry_last_user_message",
4445
4452
  "run.stop",
@@ -4464,7 +4471,7 @@ function ui(s, e) {
4464
4471
  const t = s.result && typeof s.result == "object" ? s.result : void 0, i = typeof t?.message == "string" && t.message.trim() ? t.message : `${e} (${s.code ?? "request_rejected"})`;
4465
4472
  return new w(i, s.code ?? "request_rejected", !1, s.result, !0);
4466
4473
  }
4467
- class Eo {
4474
+ class ko {
4468
4475
  constructor(e) {
4469
4476
  this.options = e, this.socket = lt(`${e.backendUrl.replace(/\/$/, "")}/product-agent`, {
4470
4477
  path: "/api/product-agent/socket.io",
@@ -4616,7 +4623,7 @@ class Eo {
4616
4623
  readinessPhase: this.ready ? "bootstrap" : this.admitted ? "activation" : "namespace_ready"
4617
4624
  })), e === this.generation && this.recover(i));
4618
4625
  };
4619
- this.admissionTimer = setTimeout(() => t("connect_timeout"), 6e4), this.readinessTimer = setTimeout(() => t("auth_timeout"), Ao);
4626
+ this.admissionTimer = setTimeout(() => t("connect_timeout"), 6e4), this.readinessTimer = setTimeout(() => t("auth_timeout"), To);
4620
4627
  }
4621
4628
  clearReadinessTimers() {
4622
4629
  this.admissionTimer !== null && clearTimeout(this.admissionTimer), this.readinessTimer !== null && clearTimeout(this.readinessTimer), this.admissionTimer = null, this.readinessTimer = null;
@@ -4637,7 +4644,7 @@ class Eo {
4637
4644
  this.bindings.get(e)?.owners.delete(t), this.ready && await this.synchronize();
4638
4645
  }
4639
4646
  async rpc(e, t) {
4640
- if (!To.has(e)) throw new w("Operation requires its HTTP adapter", "unsupported_rpc");
4647
+ if (!Eo.has(e)) throw new w("Operation requires its HTTP adapter", "unsupported_rpc");
4641
4648
  const i = this.generation, n = JSON.stringify(t);
4642
4649
  return e === "run.stop" && this.uploadingResult ? (this.assertReady(i), this.request("runtime.rpc", { type: e, payload: JSON.parse(n) }, i)) : this.enqueue(async () => {
4643
4650
  if (this.assertReady(i), e === "tool.result") {
@@ -4657,13 +4664,18 @@ class Eo {
4657
4664
  this.ready = t, await this.synchronize(!0), e === this.generation && this.ready && (this.options.bootstrapRequired || this.markReady(), this.options.onReady(t));
4658
4665
  } catch (n) {
4659
4666
  if (e === this.generation) {
4660
- const r = n instanceof w ? n : new w(String(n), "activation_error");
4661
- this.activationFailed(new w(
4667
+ const r = J(n, "activation_error", "web_transport"), a = n instanceof w ? n : new w(
4662
4668
  r.message,
4663
4669
  r.code,
4664
- r.outcomeUnknown,
4665
- { ...r.detail && typeof r.detail == "object" ? r.detail : {}, stage: i },
4666
- r.backendRefusal
4670
+ !1,
4671
+ { ...r.details, retryable: r.retryable }
4672
+ );
4673
+ this.activationFailed(new w(
4674
+ a.message,
4675
+ a.code,
4676
+ a.outcomeUnknown,
4677
+ { ...a.detail && typeof a.detail == "object" ? a.detail : {}, stage: i },
4678
+ a.backendRefusal
4667
4679
  ));
4668
4680
  }
4669
4681
  } finally {
@@ -4774,7 +4786,7 @@ class Eo {
4774
4786
  }
4775
4787
  }
4776
4788
  }
4777
- function ko() {
4789
+ function qo() {
4778
4790
  const s = crypto.getRandomValues(new Uint8Array(16));
4779
4791
  s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128;
4780
4792
  const e = Array.from(s, (t) => t.toString(16).padStart(2, "0")).join("");
@@ -4838,8 +4850,8 @@ class pn {
4838
4850
  p.signal.aborted || (f.trigger = R, p.abort());
4839
4851
  }, h = () => m("transport_disposed"), y = () => m(["owner_disposed", "authority_retired", "observation_released", "request_replaced"].includes(a?.reason) ? a.reason : "caller_cancelled");
4840
4852
  this.requests.signal.addEventListener("abort", h, { once: !0 }), a?.addEventListener("abort", y, { once: !0 });
4841
- const g = r === "conversations" && /^\/[^/]+\/snapshot$/.test(e) && n === "POST", b = /^\/conversations(?:\/[^/]+)?$/.test(e) && (n ?? (i === void 0 ? "GET" : "POST")) === "GET", v = setTimeout(() => m("deadline"), b ? 6e4 : g ? 3e4 : 15e3), _ = ko(), S = Date.now();
4842
- let A = null, C = !1, H = null, B = null, J = null;
4853
+ const g = r === "conversations" && /^\/[^/]+\/snapshot$/.test(e) && n === "POST", b = /^\/conversations(?:\/[^/]+)?$/.test(e) && (n ?? (i === void 0 ? "GET" : "POST")) === "GET", v = setTimeout(() => m("deadline"), b ? 6e4 : g ? 3e4 : 15e3), _ = qo(), S = Date.now();
4854
+ let A = null, C = !1, H = null, B = null, Q = null;
4843
4855
  try {
4844
4856
  const R = await Promise.resolve(fetch(l, {
4845
4857
  method: n ?? (i === void 0 ? "GET" : "POST"),
@@ -4850,7 +4862,7 @@ class pn {
4850
4862
  })).catch((M) => {
4851
4863
  throw C = !0, M;
4852
4864
  });
4853
- if (A = Date.now(), H = R.status, B = hi(R.headers.get("x-request-id")), J = hi(R.headers.get("x-cloud-trace-context")), !R.ok) {
4865
+ if (A = Date.now(), H = R.status, B = hi(R.headers.get("x-request-id")), Q = hi(R.headers.get("x-cloud-trace-context")), !R.ok) {
4854
4866
  const M = R.status === 401 ? "unauthorized" : R.status === 426 ? "update_required" : String(R.status), E = (await R.json().catch(() => null))?.detail;
4855
4867
  if (d && R.status === 403 && (r === "conversations" && /^\/[^/]+\/snapshot$/.test(e) || (!r || r === "embed") && /^\/conversations\/[^/]+$/.test(e)) && ["Conversation unavailable", "Integration mismatch", "Embedded origin mismatch"].includes(E))
4856
4868
  throw new w("Conversation unavailable", "conversation_access_denied");
@@ -4884,13 +4896,13 @@ class pn {
4884
4896
  ownerId: O(o?.ownerId),
4885
4897
  authorityGeneration: o?.authorityGeneration ?? null,
4886
4898
  sessionId: O(o?.sessionId),
4887
- release: this.auth.extension_version ? `extension-${this.auth.extension_version}` : `sdk-${Qi.version}`,
4899
+ release: this.auth.extension_version ? `extension-${this.auth.extension_version}` : `sdk-${Ji.version}`,
4888
4900
  upstreamRequestId: B,
4889
- upstreamTraceId: J
4901
+ upstreamTraceId: Q
4890
4902
  };
4891
- de(E) && Promise.resolve().then(() => this.options.onRequestFailure ? this.options.onRequestFailure(E) : console.warn("Product Agent HTTP request failed", E)).catch(() => {
4903
+ le(E) && Promise.resolve().then(() => this.options.onRequestFailure ? this.options.onRequestFailure(E) : console.warn("Product Agent HTTP request failed", E)).catch(() => {
4892
4904
  });
4893
- const I = de(E) ? { httpRequest: E } : void 0;
4905
+ const I = le(E) ? { httpRequest: E } : void 0;
4894
4906
  if (M !== null) {
4895
4907
  const k = M !== "deadline" && M !== "unexpected_abort";
4896
4908
  throw new w(
@@ -4943,11 +4955,11 @@ function fn() {
4943
4955
  function x(s) {
4944
4956
  return JSON.stringify([s.kind, s.origin, s.limit]);
4945
4957
  }
4946
- function qo(s) {
4958
+ function Co(s) {
4947
4959
  const e = s.map((t) => Ne(t) || t.requestId !== null && t.status !== "error" ? { ...t, status: t.status === "error" ? t.data?.length ? "refreshing" : "loading" : t.status, error: null } : t);
4948
4960
  return e.find((t) => t.status === "error") ?? e.find((t) => t.status === "loading_more" || t.status === "loading" || t.status === "refreshing") ?? e.find((t) => t.query.kind === "recent") ?? e[0];
4949
4961
  }
4950
- function Co(s) {
4962
+ function Mo(s) {
4951
4963
  return [...new Set(s.flatMap((e) => e.data ?? []))];
4952
4964
  }
4953
4965
  function Ne(s) {
@@ -4989,7 +5001,7 @@ function pi(s) {
4989
5001
  c() || (i = s.runtime.engine.subscribe(c), n = s.runtime.onDispose(o));
4990
5002
  });
4991
5003
  }
4992
- function Mo(s) {
5004
+ function Oo(s) {
4993
5005
  const e = s.http.auth.client_kind === "extension" ? "extension" : void 0, t = /* @__PURE__ */ new Map();
4994
5006
  return {
4995
5007
  "directory.query": async (i) => {
@@ -5029,7 +5041,7 @@ function Mo(s) {
5029
5041
  }
5030
5042
  };
5031
5043
  }
5032
- class Oo {
5044
+ class Po {
5033
5045
  constructor(e) {
5034
5046
  this.options = e, this.owner = `directory:${e.authority.authorityId}:${e.authority.generation}`, this.boundary = { authority: e.authority, currentAuthority: () => e.runtime.engine.getState().slices.directory }, this.unsubscribe = e.runtime.engine.subscribe(() => this.reconcile());
5035
5047
  }
@@ -5202,7 +5214,7 @@ class Oo {
5202
5214
  this.unsubscribe(), this.reconcile();
5203
5215
  }
5204
5216
  }
5205
- function Po(s) {
5217
+ function xo(s) {
5206
5218
  if (!s || typeof s != "object") return !1;
5207
5219
  const e = s;
5208
5220
  if (e.version !== 1 || typeof e.authorityId != "string" || typeof e.browserSessionId != "string" || !Array.isArray(e.bindings) || !e.mains || typeof e.mains != "object" || Array.isArray(e.mains)) return !1;
@@ -5219,7 +5231,7 @@ function Po(s) {
5219
5231
  return !0;
5220
5232
  }
5221
5233
  const fi = /* @__PURE__ */ new WeakMap();
5222
- class xo {
5234
+ class Do {
5223
5235
  constructor(e) {
5224
5236
  this.options = e;
5225
5237
  }
@@ -5289,7 +5301,7 @@ class xo {
5289
5301
  const t = this.state();
5290
5302
  if (!this.current() || Object.keys(t.clients).length || Object.keys(t.selections).length) return !1;
5291
5303
  const i = await this.options.persistence.read();
5292
- if (!Po(i) || i.authorityId !== this.options.authority.authorityId || i.browserSessionId !== this.options.persistence.sessionId()) return !1;
5304
+ if (!xo(i) || i.authorityId !== this.options.authority.authorityId || i.browserSessionId !== this.options.persistence.sessionId()) return !1;
5293
5305
  const n = new Set(await this.options.persistence.liveClients());
5294
5306
  if (!this.current() || this.state().clients !== t.clients) return !1;
5295
5307
  const r = i.bindings.filter((c) => n.has(c.clientScopeId));
@@ -5311,7 +5323,7 @@ class xo {
5311
5323
  return await Promise.all(a.map((c) => this.options.runtime.engine.dispatch(c))), !0;
5312
5324
  }
5313
5325
  }
5314
- function Do(s, e, t, i = () => crypto.randomUUID()) {
5326
+ function Uo(s, e, t, i = () => crypto.randomUUID()) {
5315
5327
  const n = `pluno.productAgent.directory:${encodeURIComponent(t)}:${encodeURIComponent(e)}`, r = `${n}:tabSession`, a = s.getItem(r) ?? i();
5316
5328
  return s.setItem(r, a), {
5317
5329
  sessionId: () => a,
@@ -5323,9 +5335,9 @@ function Do(s, e, t, i = () => crypto.randomUUID()) {
5323
5335
  };
5324
5336
  }
5325
5337
  const mi = /* @__PURE__ */ new Map(), gi = /* @__PURE__ */ new Map();
5326
- function Uo(s, e, t = () => crypto.randomUUID()) {
5338
+ function No(s, e, t = () => crypto.randomUUID()) {
5327
5339
  try {
5328
- return Do(window.sessionStorage, s, e, t);
5340
+ return Uo(window.sessionStorage, s, e, t);
5329
5341
  } catch (i) {
5330
5342
  if (!(i instanceof DOMException) || i.name !== "SecurityError" && i.name !== "QuotaExceededError") throw i;
5331
5343
  const n = `${e}:${s}`, r = gi.get(n) ?? t();
@@ -5345,7 +5357,7 @@ class D extends EventTarget {
5345
5357
  ...e,
5346
5358
  executorConnection: () => this.connectionId,
5347
5359
  restoreExecutor: (t) => this.restoreExecutor(t)
5348
- }), this.transport = new Eo({
5360
+ }), this.transport = new ko({
5349
5361
  backendUrl: e.backendUrl,
5350
5362
  auth: e.auth,
5351
5363
  displaySchema: e.displaySchema,
@@ -5441,7 +5453,7 @@ class D extends EventTarget {
5441
5453
  const i = this.connectionAttempt, n = (/* @__PURE__ */ new Date()).toISOString(), r = this.diagnostics.findIndex((c) => c.phase === e && c.connectionAttemptId === i?.connectionAttemptId), a = this.diagnostics[r], o = {
5442
5454
  id: a?.id ?? crypto.randomUUID(),
5443
5455
  phase: e,
5444
- sdkVersion: Cs,
5456
+ sdkVersion: Ts,
5445
5457
  stage: t.stage ?? (t.readinessPhase === "bootstrap" ? "bootstrap" : t.readinessPhase === "activation" ? "executor_registration" : "socket_admission"),
5446
5458
  ...t.httpStatus ? { httpStatus: t.httpStatus } : {},
5447
5459
  ...t.failureKind ? { failureKind: t.failureKind } : {},
@@ -5561,19 +5573,24 @@ class D extends EventTarget {
5561
5573
  e.push(t);
5562
5574
  }
5563
5575
  fail(e, t, i = !1) {
5564
- const n = e instanceof w ? e : new w(String(e), "request_failed");
5565
- if (n.code === "disconnected" || n.outcomeUnknown) return;
5566
- const r = n.detail && typeof n.detail == "object" ? n.detail : {};
5567
- this.options.auth.client_kind === "extension" && n.code === "update_required" && r.version_status && this.receive(r.version_status), this.receive({
5568
- ...r,
5576
+ const n = J(e, "request_failed", "web_transport"), r = e instanceof w ? e : new w(
5577
+ n.message,
5578
+ n.code,
5579
+ !1,
5580
+ { ...n.details, retryable: n.retryable }
5581
+ );
5582
+ if (r.code === "disconnected" || r.outcomeUnknown) return;
5583
+ const a = r.detail && typeof r.detail == "object" ? r.detail : {};
5584
+ this.options.auth.client_kind === "extension" && r.code === "update_required" && a.version_status && this.receive(a.version_status), this.receive({
5585
+ ...a,
5569
5586
  type: "error",
5570
- code: n.code,
5571
- message: n.message,
5572
- retryable: r.retryable === !0,
5587
+ code: r.code,
5588
+ message: r.message,
5589
+ retryable: a.retryable === !0,
5573
5590
  ...t?.requestId ? { requestId: t.requestId } : {},
5574
5591
  ...t?.sessionId ? { sessionId: t.sessionId } : {},
5575
5592
  ...t?.clientMessageId ? { clientMessageId: t.clientMessageId } : {},
5576
- outcomeUnknown: n.outcomeUnknown,
5593
+ outcomeUnknown: r.outcomeUnknown,
5577
5594
  ...t && !i ? { requestType: t.type } : {}
5578
5595
  });
5579
5596
  }
@@ -5722,7 +5739,7 @@ function gn(s) {
5722
5739
  const e = s;
5723
5740
  return typeof e.observedAt == "string" && e.observedAt.length <= 40 && Number.isFinite(Date.parse(e.observedAt)) && be(e.sessionId) && be(e.responseItemId) && be(e.respondsToUserMessageId) && typeof e.panelVisible == "boolean" && typeof e.documentVisible == "boolean" && typeof e.loading == "boolean";
5724
5741
  }
5725
- function No(s, e, t) {
5742
+ function Bo(s, e, t) {
5726
5743
  if (!gn(t)) return;
5727
5744
  const i = ys.get(s) ?? /* @__PURE__ */ new Map();
5728
5745
  i.set(e, {
@@ -5735,11 +5752,11 @@ function No(s, e, t) {
5735
5752
  loading: t.loading
5736
5753
  }), i.size > 2 && i.delete(i.keys().next().value), ys.set(s, i);
5737
5754
  }
5738
- function Bo(s, e, t) {
5755
+ function jo(s, e, t) {
5739
5756
  const i = ys.get(s)?.get(e);
5740
5757
  return i?.sessionId === t ? i : null;
5741
5758
  }
5742
- function jo(s, e, t, i, n, r, a, o, c = null, d = !1) {
5759
+ function Lo(s, e, t, i, n, r, a, o, c = null, d = !1) {
5743
5760
  const l = i ? o.find((p) => p.role === "user" && (p.id === i || p.clientMessageId === i)) : void 0, u = l ? [...o].reverse().find((p) => (p.role === "assistant" || p.dataType === "commentary_history" || p.dataType === "tool_summary") && p.respondsToUserMessageId === l.id) : void 0;
5744
5761
  return {
5745
5762
  capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -5749,14 +5766,14 @@ function jo(s, e, t, i, n, r, a, o, c = null, d = !1) {
5749
5766
  clientUserMessageItemId: l && be(l.id) ? l.id : null,
5750
5767
  clientResponseItemId: u && be(u.id) ? u.id : null,
5751
5768
  clientDraftObserved: !!(l && d && c === l.id),
5752
- renderer: Bo(s, e, t)
5769
+ renderer: jo(s, e, t)
5753
5770
  };
5754
5771
  }
5755
- const Lo = 1e4, $o = 3e3;
5772
+ const $o = 1e4, Fo = 3e3;
5756
5773
  function yn() {
5757
- return { authenticated: !1, generation: 0, sequence: 0, displaySequence: 0, backendCount: null, query: Le("activeUsers") };
5774
+ return { authenticated: !1, generation: 0, sequence: 0, displaySequence: 0, backendCount: null, query: $e("activeUsers") };
5758
5775
  }
5759
- function Fo(s, e) {
5776
+ function zo(s, e) {
5760
5777
  if (e.type === "activeUsers.authenticate") {
5761
5778
  if (s.authenticated === e.authenticated) return { state: s, effects: [] };
5762
5779
  const i = { ...yn(), authenticated: e.authenticated, generation: s.generation + 1 };
@@ -5778,7 +5795,7 @@ function Fo(s, e) {
5778
5795
  return s.backendCount === null ? vi(t) : { state: t, effects: [] };
5779
5796
  }
5780
5797
  function yi(s) {
5781
- const e = s.sequence + 1, t = `activeUsers:${s.generation}:${e}`, i = [{ id: `${t}:wait`, kind: "activeUsers.wait", input: { milliseconds: Lo } }];
5798
+ const e = s.sequence + 1, t = `activeUsers:${s.generation}:${e}`, i = [{ id: `${t}:wait`, kind: "activeUsers.wait", input: { milliseconds: $o } }];
5782
5799
  return s.query.status === "loading" || s.query.status === "refreshing" ? { state: { ...s, sequence: e }, effects: i } : (i.push({ id: `${t}:load`, kind: "activeUsers.load", input: { generation: s.generation } }), { state: { ...s, sequence: e, query: { ...s.query, requestId: `${t}:load`, status: s.query.data === null ? "loading" : "refreshing", error: null } }, effects: i });
5783
5800
  }
5784
5801
  function vi(s) {
@@ -5786,11 +5803,11 @@ function vi(s) {
5786
5803
  return { state: { ...s, displaySequence: e }, effects: [{
5787
5804
  id: `activeUsers:${s.generation}:display:${e}`,
5788
5805
  kind: "activeUsers.displayWait",
5789
- input: { milliseconds: $o }
5806
+ input: { milliseconds: Fo }
5790
5807
  }] };
5791
5808
  }
5792
- const zo = () => Object.freeze({ scopes: Object.freeze({}) });
5793
- function Ho(s, e) {
5809
+ const Ho = () => Object.freeze({ scopes: Object.freeze({}) });
5810
+ function Ko(s, e) {
5794
5811
  const t = s.scopes[e.clientScopeId];
5795
5812
  let i;
5796
5813
  if (e.type === "model.scope_close") {
@@ -5903,7 +5920,7 @@ function bi(s, e, t, i) {
5903
5920
  membershipRevision: s.membershipRevision + 1
5904
5921
  };
5905
5922
  }
5906
- function Ko(s, e) {
5923
+ function Wo(s, e) {
5907
5924
  switch (e.type) {
5908
5925
  case "directory.bind":
5909
5926
  case "directory.provisional": {
@@ -5915,7 +5932,7 @@ function Ko(s, e) {
5915
5932
  const n = s.clients[e.clientScopeId];
5916
5933
  if (n === e.conversationScopeId) return s;
5917
5934
  const r = s.selections[n];
5918
- if (e.type === "directory.bind" && e.reason === "tool" && !Wo(s, e.clientScopeId, e.sessionId))
5935
+ if (e.type === "directory.bind" && e.reason === "tool" && !Vo(s, e.clientScopeId, e.sessionId))
5919
5936
  throw new Error("Tool target is already bound to another conversation.");
5920
5937
  return r && r.sessionId !== null && r.sessionId === t.sessionId ? {
5921
5938
  ...s,
@@ -5950,7 +5967,7 @@ function Ko(s, e) {
5950
5967
  return s;
5951
5968
  }
5952
5969
  }
5953
- function Wo(s, e, t) {
5970
+ function Vo(s, e, t) {
5954
5971
  const i = s.clients[e];
5955
5972
  return i === void 0 || s.selections[i].sessionId === t;
5956
5973
  }
@@ -6075,7 +6092,7 @@ function we(s, e) {
6075
6092
  query: d,
6076
6093
  cursor: e.cursor !== void 0 ? e.cursor : e.mode === "append" ? c?.cursor ?? null : null
6077
6094
  } }, t = { ...s, queries: { ...s.queries, [o]: {
6078
- ...zi(c ?? Le(o), { key: o, requestId: e.requestId, mode: e.mode }),
6095
+ ...zi(c ?? $e(o), { key: o, requestId: e.requestId, mode: e.mode }),
6079
6096
  query: d,
6080
6097
  requestSequence: s.requestSequence + 1,
6081
6098
  mode: e.mode,
@@ -6098,11 +6115,11 @@ function we(s, e) {
6098
6115
  }
6099
6116
  t = { ...t, requestSequence: s.requestSequence + 1, requests: { ...t.requests, [n]: a } }, i.push({ id: n, ...a });
6100
6117
  } else
6101
- t = Ko(s, e);
6118
+ t = Wo(s, e);
6102
6119
  }
6103
6120
  return { state: Fe(t), effects: i };
6104
6121
  }
6105
- function Vo(s) {
6122
+ function Go(s) {
6106
6123
  const e = { ...s.entities };
6107
6124
  for (const [a, o] of Object.entries(s.mutations)) {
6108
6125
  if (!e[a]) continue;
@@ -6131,7 +6148,7 @@ function Vo(s) {
6131
6148
  ]))
6132
6149
  });
6133
6150
  }
6134
- class Go {
6151
+ class Jo {
6135
6152
  constructor(e, t, i) {
6136
6153
  this.handlers = e, this.accept = t, this.errorAdapter = i;
6137
6154
  }
@@ -6170,7 +6187,7 @@ class Go {
6170
6187
  );
6171
6188
  }
6172
6189
  }
6173
- class Jo {
6190
+ class Qo {
6174
6191
  state;
6175
6192
  reducer;
6176
6193
  selector;
@@ -6184,7 +6201,7 @@ class Jo {
6184
6201
  scopedDiagnostics = /* @__PURE__ */ new Map();
6185
6202
  diagnostics = { ownerId: `owner-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`, revision: 0, dropped: 0, lastSelection: null, transitions: [] };
6186
6203
  constructor(e) {
6187
- this.state = e.initialState, this.reducer = e.reducer, this.selector = e.selector, this.effectRunner = new Go(
6204
+ this.state = e.initialState, this.reducer = e.reducer, this.selector = e.selector, this.effectRunner = new Jo(
6188
6205
  e.effectHandlers,
6189
6206
  (t) => this.acceptEffectResult(t),
6190
6207
  e.errorAdapter
@@ -6202,7 +6219,7 @@ class Jo {
6202
6219
  return this.state;
6203
6220
  }
6204
6221
  recordDiagnosticTransition(e, t = !1) {
6205
- let i = or(e, this.diagnostics.revision + 1, t);
6222
+ let i = ar(e, this.diagnostics.revision + 1, t);
6206
6223
  if (i?.effectId) {
6207
6224
  if (i.type === "effect.started")
6208
6225
  this.diagnosticEffects.set(i.effectId, i), this.diagnosticEffects.size > 128 && this.diagnosticEffects.delete(this.diagnosticEffects.keys().next().value);
@@ -6318,7 +6335,7 @@ class Jo {
6318
6335
  for (const t of this.listeners) t(e);
6319
6336
  }
6320
6337
  }
6321
- const Qo = Object.freeze({
6338
+ const Xo = Object.freeze({
6322
6339
  modelSelection: "core",
6323
6340
  directory: "core",
6324
6341
  activeUsers: "core",
@@ -6328,24 +6345,24 @@ const Qo = Object.freeze({
6328
6345
  browserExecution: "legacy"
6329
6346
  });
6330
6347
  function wi(s, e) {
6331
- const t = Qo[s], i = e[t];
6348
+ const t = Xo[s], i = e[t];
6332
6349
  if (!i) throw new Error(`No ${t} implementation for ${s}.`);
6333
6350
  return i();
6334
6351
  }
6335
- function Xo(s) {
6352
+ function Yo(s) {
6336
6353
  return s.type === "effect.completed" || s.type === "effect.failed" ? s.effectKind === "directory.query" || s.effectKind === "directory.mutate" : s.type.startsWith("directory.");
6337
6354
  }
6338
- function Yo(s) {
6355
+ function Zo(s) {
6339
6356
  return s.type === "effect.completed" || s.type === "effect.failed" ? s.effectKind.startsWith("conversation.") : s.type.startsWith("conversation.");
6340
6357
  }
6341
- const Zo = {
6358
+ const ea = {
6342
6359
  "directory.query": async () => {
6343
6360
  throw new Error("Directory ports are not installed before S5-C.");
6344
6361
  },
6345
6362
  "directory.mutate": async () => {
6346
6363
  throw new Error("Directory ports are not installed before S5-C.");
6347
6364
  }
6348
- }, ea = {
6365
+ }, ta = {
6349
6366
  "conversation.prepare": async () => {
6350
6367
  throw new Error("Conversation preparation adapter is not installed.");
6351
6368
  },
@@ -6402,14 +6419,14 @@ function _i(s, e, t) {
6402
6419
  }
6403
6420
  return i;
6404
6421
  }
6405
- class ta {
6422
+ class sa {
6406
6423
  engine;
6407
6424
  disposeListeners = /* @__PURE__ */ new Set();
6408
6425
  conversationPorts;
6409
- constructor(e = Zo, t = {}, i) {
6410
- this.conversationPorts = { ...ea, ...t }, this.engine = new Jo({
6426
+ constructor(e = ea, t = {}, i) {
6427
+ this.conversationPorts = { ...ta, ...t }, this.engine = new Qo({
6411
6428
  initialState: Object.freeze({ revision: 0, slices: Object.freeze({
6412
- modelSelection: zo(),
6429
+ modelSelection: Ho(),
6413
6430
  directory: fn(),
6414
6431
  conversation: Hi(),
6415
6432
  activeUsers: yn()
@@ -6417,18 +6434,18 @@ class ta {
6417
6434
  reducer: (n, r) => {
6418
6435
  const a = r.value;
6419
6436
  if (a.type.startsWith("activeUsers.") || (a.type === "effect.completed" || a.type === "effect.failed") && a.effectKind.startsWith("activeUsers.")) {
6420
- const c = Fo(n.slices.activeUsers, a);
6437
+ const c = zo(n.slices.activeUsers, a);
6421
6438
  return { state: c.state === n.slices.activeUsers ? n : Object.freeze({ revision: n.revision + 1, slices: Object.freeze({ ...n.slices, activeUsers: c.state }) }), effects: c.effects };
6422
6439
  }
6423
- if (Xo(a)) {
6440
+ if (Yo(a)) {
6424
6441
  const c = we(n.slices.directory, a), d = ls(as(n.slices.conversation, c.state)), l = cs(n.slices.conversation, d.state, c.state, c.state.clients !== n.slices.directory.clients), u = l.state, p = _i(n.slices.conversation, u, c.state);
6425
6442
  return { state: p === n.slices.directory && u === n.slices.conversation ? n : Object.freeze({
6426
6443
  revision: n.revision + 1,
6427
6444
  slices: Object.freeze({ ...n.slices, directory: p, conversation: u })
6428
6445
  }), effects: [...l.effects, ...c.effects, ...d.effects] };
6429
6446
  }
6430
- if (Yo(a)) {
6431
- const c = Xn(n.slices.conversation, a, n.slices.directory, n.slices.modelSelection);
6447
+ if (Zo(a)) {
6448
+ const c = Yn(n.slices.conversation, a, n.slices.directory, n.slices.modelSelection);
6432
6449
  let d = n.slices.directory;
6433
6450
  for (const [f, m] of Object.entries(c.state.operations)) {
6434
6451
  if (!["runtime.warmup", "attachment.prepare"].includes(m.command.type) || !m.conversationScopeId || m.phase !== "done" || n.slices.conversation.operations[f]?.phase === "done") continue;
@@ -6461,13 +6478,13 @@ class ta {
6461
6478
  slices: Object.freeze({ ...n.slices, directory: d, conversation: p.state })
6462
6479
  }), effects: [...c.effects, ...p.effects, ...u.effects] };
6463
6480
  }
6464
- const o = Ho(n.slices.modelSelection, a);
6481
+ const o = Ko(n.slices.modelSelection, a);
6465
6482
  return { state: o === n.slices.modelSelection ? n : Object.freeze({
6466
6483
  revision: n.revision + 1,
6467
6484
  slices: Object.freeze({ ...n.slices, modelSelection: o })
6468
6485
  }), effects: [] };
6469
6486
  },
6470
- selector: (n) => Object.freeze({ ...n.slices, directory: Vo(n.slices.directory), conversation: br(n.slices.conversation, n.slices.directory) }),
6487
+ selector: (n) => Object.freeze({ ...n.slices, directory: Go(n.slices.directory), conversation: wr(n.slices.conversation, n.slices.directory) }),
6471
6488
  effectHandlers: {
6472
6489
  ...e,
6473
6490
  "conversation.prepare": (n) => this.conversationPorts["conversation.prepare"](n),
@@ -6489,8 +6506,8 @@ class ta {
6489
6506
  })
6490
6507
  },
6491
6508
  errorAdapter: (n) => {
6492
- const r = he(n), a = n !== null && typeof n == "object" ? "details" in n ? n.details : "detail" in n ? n.detail : void 0 : void 0, o = a && typeof a == "object" && "httpRequest" in a ? a.httpRequest : void 0;
6493
- return { ...r, ...de(o) ? { details: { ...r.details, httpRequest: o } } : {} };
6509
+ const r = J(n), a = n !== null && typeof n == "object" ? "details" in n ? n.details : "detail" in n ? n.detail : void 0 : void 0, o = a && typeof a == "object" && "httpRequest" in a ? a.httpRequest : void 0;
6510
+ return { ...r, ...le(o) ? { details: { ...r.details, httpRequest: o } } : {} };
6494
6511
  }
6495
6512
  });
6496
6513
  }
@@ -6521,8 +6538,8 @@ class ta {
6521
6538
  }
6522
6539
  }
6523
6540
  }
6524
- const sa = "pluno-product-agent-attachments", ia = 1, Is = "files", na = 1440 * 60 * 1e3;
6525
- async function ra(s) {
6541
+ const ia = "pluno-product-agent-attachments", na = 1, Is = "files", ra = 1440 * 60 * 1e3;
6542
+ async function oa(s) {
6526
6543
  const e = await bt();
6527
6544
  await In(e, "readwrite", (t) => t.put(s));
6528
6545
  }
@@ -6549,7 +6566,7 @@ async function vn(s, e) {
6549
6566
  });
6550
6567
  });
6551
6568
  }
6552
- async function oa(s = na) {
6569
+ async function aa(s = ra) {
6553
6570
  const e = await bt(), t = Date.now() - s;
6554
6571
  await Us(e, "readwrite", async (i) => {
6555
6572
  const n = i.index("lastUsedAt");
@@ -6558,7 +6575,7 @@ async function oa(s = na) {
6558
6575
  }
6559
6576
  function bt() {
6560
6577
  return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((s, e) => {
6561
- const t = indexedDB.open(sa, ia);
6578
+ const t = indexedDB.open(ia, na);
6562
6579
  t.onupgradeneeded = () => {
6563
6580
  const n = t.result.createObjectStore(Is, { keyPath: "attachmentId" });
6564
6581
  n.createIndex("lastUsedAt", "lastUsedAt", { unique: !1 }), n.createIndex("sessionId", "sessionId", { unique: !1 }), n.createIndex("origin", "origin", { unique: !1 });
@@ -6595,11 +6612,11 @@ function Ns(s) {
6595
6612
  s.onsuccess = () => e(s.result), s.onerror = () => t(s.error ?? new Error("Product Agent attachment storage request failed"));
6596
6613
  });
6597
6614
  }
6598
- function aa(s) {
6615
+ function ca(s) {
6599
6616
  return s !== null && (typeof s == "object" || typeof s == "function");
6600
6617
  }
6601
6618
  function bn(s, e, t) {
6602
- const i = Reflect.get(s, "pluno"), n = aa(i) ? i : {};
6619
+ const i = Reflect.get(s, "pluno"), n = ca(i) ? i : {};
6603
6620
  if (n !== i && !Reflect.set(s, "pluno", n))
6604
6621
  return null;
6605
6622
  const r = Object.getOwnPropertyDescriptor(n, e);
@@ -6614,12 +6631,12 @@ function bn(s, e, t) {
6614
6631
  };
6615
6632
  }
6616
6633
  const Bs = "suggest_share_on_socials";
6617
- function ca(s) {
6634
+ function da(s) {
6618
6635
  for (let e = s.length - 1; e >= 0; e -= 1) {
6619
6636
  const t = s[e];
6620
6637
  if (t.role !== "tool" || t.toolName !== Bs || t.sharePromptAllowed !== void 0)
6621
6638
  continue;
6622
- if (la(s, e, t.callId) !== !0)
6639
+ if (ua(s, e, t.callId) !== !0)
6623
6640
  return null;
6624
6641
  const i = Ri(s, e, "assistant");
6625
6642
  if (!i)
@@ -6633,7 +6650,7 @@ function ca(s) {
6633
6650
  }
6634
6651
  return null;
6635
6652
  }
6636
- function da(s) {
6653
+ function la(s) {
6637
6654
  let e = s;
6638
6655
  if (typeof s == "string")
6639
6656
  try {
@@ -6641,10 +6658,10 @@ function da(s) {
6641
6658
  } catch {
6642
6659
  return null;
6643
6660
  }
6644
- const t = ua(e);
6661
+ const t = ha(e);
6645
6662
  return t ? typeof t.showSharePrompt == "boolean" ? t.showSharePrompt : t.ok === !0 && typeof t.message == "string" && t.message.includes("social-sharing prompt") ? !0 : null : null;
6646
6663
  }
6647
- function la(s, e, t) {
6664
+ function ua(s, e, t) {
6648
6665
  if (!t)
6649
6666
  return null;
6650
6667
  for (let i = e + 1; i < s.length; i += 1) {
@@ -6662,17 +6679,17 @@ function Ri(s, e, t) {
6662
6679
  }
6663
6680
  return null;
6664
6681
  }
6665
- function ua(s) {
6682
+ function ha(s) {
6666
6683
  return s && typeof s == "object" && !Array.isArray(s) ? s : null;
6667
6684
  }
6668
- const ha = "save_runtime_captured_skill";
6669
- function pa(s) {
6670
- return (s.type === "function_call" || s.type === "tool_call") && s.name === ha;
6685
+ const pa = "save_runtime_captured_skill";
6686
+ function fa(s) {
6687
+ return (s.type === "function_call" || s.type === "tool_call") && s.name === pa;
6671
6688
  }
6672
- const Bt = "pluno.productAgent.transportId", fa = "pluno.productAgent.transportIdentity", jt = "pluno.productAgent.transportIdentity.event", ma = 50, ga = globalThis.setTimeout.bind(globalThis);
6689
+ const Bt = "pluno.productAgent.transportId", ma = "pluno.productAgent.transportIdentity", jt = "pluno.productAgent.transportIdentity.event", ga = 50, ya = globalThis.setTimeout.bind(globalThis);
6673
6690
  let Pe = null;
6674
6691
  const ut = /* @__PURE__ */ new Set(), Lt = /* @__PURE__ */ new Map();
6675
- async function ya(s = wn()) {
6692
+ async function va(s = wn()) {
6676
6693
  const e = s.randomUUID(), t = s.storage.getItem(Bt);
6677
6694
  let i = t ?? s.randomUUID(), n = !1, r = !1;
6678
6695
  const a = s.channel.subscribe((c) => {
@@ -6710,8 +6727,8 @@ async function ya(s = wn()) {
6710
6727
  }
6711
6728
  };
6712
6729
  }
6713
- async function va(s = !1) {
6714
- Pe || (Pe = ya({
6730
+ async function Ia(s = !1) {
6731
+ Pe || (Pe = va({
6715
6732
  ...wn(),
6716
6733
  skipStoredIdentityCollisionCheck: s
6717
6734
  }), Pe.then((n) => {
@@ -6720,7 +6737,7 @@ async function va(s = !1) {
6720
6737
  };
6721
6738
  window.addEventListener("pagehide", r);
6722
6739
  }));
6723
- const e = await Pe, t = Ia();
6740
+ const e = await Pe, t = ba();
6724
6741
  ut.add(t);
6725
6742
  let i = !1;
6726
6743
  return {
@@ -6731,7 +6748,7 @@ async function va(s = !1) {
6731
6748
  }
6732
6749
  };
6733
6750
  }
6734
- function Ia() {
6751
+ function ba() {
6735
6752
  let s = 0;
6736
6753
  for (; ut.has(s); )
6737
6754
  s += 1;
@@ -6739,13 +6756,13 @@ function Ia() {
6739
6756
  }
6740
6757
  function wn() {
6741
6758
  return {
6742
- storage: ba(),
6743
- channel: wa(),
6759
+ storage: wa(),
6760
+ channel: _a(),
6744
6761
  randomUUID: () => crypto.randomUUID(),
6745
- settle: () => new Promise((s) => ga(s, ma))
6762
+ settle: () => new Promise((s) => ya(s, ga))
6746
6763
  };
6747
6764
  }
6748
- function ba() {
6765
+ function wa() {
6749
6766
  return {
6750
6767
  getItem: (s) => {
6751
6768
  try {
@@ -6763,9 +6780,9 @@ function ba() {
6763
6780
  }
6764
6781
  };
6765
6782
  }
6766
- function wa() {
6783
+ function _a() {
6767
6784
  if (typeof BroadcastChannel < "u") {
6768
- const s = new BroadcastChannel(fa);
6785
+ const s = new BroadcastChannel(ma);
6769
6786
  return {
6770
6787
  postMessage: (e) => s.postMessage(e),
6771
6788
  subscribe: (e) => {
@@ -6775,9 +6792,9 @@ function wa() {
6775
6792
  close: () => s.close()
6776
6793
  };
6777
6794
  }
6778
- return _a();
6795
+ return Sa();
6779
6796
  }
6780
- function _a() {
6797
+ function Sa() {
6781
6798
  const s = /* @__PURE__ */ new Set(), e = (t) => {
6782
6799
  if (t.key !== jt || !t.newValue)
6783
6800
  return;
@@ -6799,7 +6816,7 @@ function _a() {
6799
6816
  };
6800
6817
  }
6801
6818
  const _n = "schedule_follow_up";
6802
- function Sa(s) {
6819
+ function Ra(s) {
6803
6820
  let e = s;
6804
6821
  if (typeof e == "string")
6805
6822
  try {
@@ -6815,7 +6832,7 @@ function Sa(s) {
6815
6832
  dueAt: t.dueAt
6816
6833
  };
6817
6834
  }
6818
- const Ra = [
6835
+ const Aa = [
6819
6836
  "anthropic/claude-opus-5",
6820
6837
  "anthropic/claude-sonnet-5",
6821
6838
  "deepseek/deepseek-chat-v3.1",
@@ -6826,16 +6843,16 @@ const Ra = [
6826
6843
  "gpt-5.6-luna",
6827
6844
  "gpt-5.6-terra",
6828
6845
  "gpt-5.6-sol"
6829
- ], bs = (s) => typeof s == "string" && Ra.includes(s), $t = /* @__PURE__ */ new Map();
6830
- function Aa(s, e, t) {
6846
+ ], bs = (s) => typeof s == "string" && Aa.includes(s), $t = /* @__PURE__ */ new Map();
6847
+ function Ta(s, e, t) {
6831
6848
  const i = `pluno.productAgent.modelClientScope:${e}`, n = s.getItem(i);
6832
6849
  if (n) return n;
6833
6850
  const r = t();
6834
6851
  return s.setItem(i, r), r;
6835
6852
  }
6836
- function Ta(s, e) {
6853
+ function Ea(s, e) {
6837
6854
  try {
6838
- const t = Aa(window.sessionStorage, s, e);
6855
+ const t = Ta(window.sessionStorage, s, e);
6839
6856
  return $t.set(s, t), t;
6840
6857
  } catch (t) {
6841
6858
  if (!(t instanceof DOMException) || t.name !== "SecurityError" && t.name !== "QuotaExceededError") throw t;
@@ -6843,16 +6860,16 @@ function Ta(s, e) {
6843
6860
  return $t.set(s, i), i;
6844
6861
  }
6845
6862
  }
6846
- function Ea(s) {
6863
+ function ka(s) {
6847
6864
  if (!s || typeof s != "object") return;
6848
6865
  const e = s, t = e.requestedModel ?? e.requested_model, i = e.effectiveModel ?? e.effective_model, n = e.provider;
6849
6866
  if (!(!bs(t) || !bs(i) || n !== "openrouter" && n !== "azure" && n !== "openai"))
6850
6867
  return Object.freeze({ requestedModel: t, effectiveModel: i, provider: n });
6851
6868
  }
6852
- const js = (s, e) => Vn(
6869
+ const js = (s, e) => Gn(
6853
6870
  s.engine.getState().slices.modelSelection,
6854
6871
  e
6855
- ), ka = (s, e) => Rs(js(s, e));
6872
+ ), qa = (s, e) => Rs(js(s, e));
6856
6873
  function Ft(s, e, t, i) {
6857
6874
  return s.engine.dispatch({
6858
6875
  type: "model.submission_capture",
@@ -6861,8 +6878,8 @@ function Ft(s, e, t, i) {
6861
6878
  requestedModel: i
6862
6879
  }), js(s, e).submissions[t].requestedModel;
6863
6880
  }
6864
- function qa(s, e, t, i, n, r) {
6865
- const a = Ea(n);
6881
+ function Ca(s, e, t, i, n, r) {
6882
+ const a = ka(n);
6866
6883
  a && s.engine.accept({
6867
6884
  type: "model.routing_accepted",
6868
6885
  clientScopeId: e,
@@ -6877,7 +6894,7 @@ function zt(s, e, t, i) {
6877
6894
  for (const n of i) {
6878
6895
  if (!n || typeof n != "object") continue;
6879
6896
  const r = n, a = r.clientMessageId ?? r.client_message_id, o = r.updatedAt ?? r.updated_at;
6880
- typeof a == "string" && qa(
6897
+ typeof a == "string" && Ca(
6881
6898
  s,
6882
6899
  e,
6883
6900
  t,
@@ -6887,7 +6904,7 @@ function zt(s, e, t, i) {
6887
6904
  );
6888
6905
  }
6889
6906
  }
6890
- class Ca {
6907
+ class Ma {
6891
6908
  constructor(e, t = null) {
6892
6909
  this.storage = e, t && (this.decisions = new Map(
6893
6910
  t.filter(ws).map((i) => [this.getDecisionKey(i), i])
@@ -6912,7 +6929,7 @@ class Ca {
6912
6929
  if (n && n.version >= t.version) continue;
6913
6930
  if (n && n.payload.kind !== t.payload.kind) throw new Error("Interaction kind changed.");
6914
6931
  const r = n?.payload.kind === "personal_channel" && n.lifecycle === "completed" ? "completed" : t.lifecycle, a = n?.payload.kind === "sharing" && t.payload.kind === "sharing" ? { ...t.payload, variant: n.payload.variant } : t.payload;
6915
- this.sources.set(i, ne(Y({ ...t, lifecycle: r, payload: a }))), t.payload.kind === "integration_auth" && this.invalidateAuth(t.payload.request_id);
6932
+ this.sources.set(i, re(Z({ ...t, lifecycle: r, payload: a }))), t.payload.kind === "integration_auth" && this.invalidateAuth(t.payload.request_id);
6916
6933
  }
6917
6934
  }
6918
6935
  /** @internal */
@@ -6938,7 +6955,7 @@ class Ca {
6938
6955
  userPrompt: o?.type === "user_message" ? o.data.content : "",
6939
6956
  assistantAnswer: ""
6940
6957
  },
6941
- terminal: !a.wait_for_terminal || wr(i, r.user_message_id)
6958
+ terminal: !a.wait_for_terminal || _r(i, r.user_message_id)
6942
6959
  };
6943
6960
  } else a.kind === "integration_auth" ? t.integrations.push({
6944
6961
  revision: r.version,
@@ -7040,13 +7057,13 @@ class Ca {
7040
7057
  return `${Ht(e.scope)}:category:${e.category}`;
7041
7058
  }
7042
7059
  }
7043
- function Kd(s, e) {
7060
+ function Wd(s, e) {
7044
7061
  return {
7045
- load: async () => Ma(s, e),
7062
+ load: async () => Oa(s, e),
7046
7063
  save: async (t) => s.setItem(e, JSON.stringify(t))
7047
7064
  };
7048
7065
  }
7049
- function Ma(s, e) {
7066
+ function Oa(s, e) {
7050
7067
  const t = s.getItem(e);
7051
7068
  if (!t) return [];
7052
7069
  const i = JSON.parse(t);
@@ -7063,7 +7080,7 @@ function ws(s) {
7063
7080
  const e = s;
7064
7081
  return typeof e.promptKey == "string" && typeof e.category == "string" && typeof e.decidedAt == "string" && (e.nextEligibleAt === null || typeof e.nextEligibleAt == "string") && Sn(e.action) && !!(e.scope && typeof e.scope == "object" && typeof e.scope.level == "string" && typeof e.scope.key == "string");
7065
7082
  }
7066
- class Wd {
7083
+ class Vd {
7067
7084
  constructor(e, t, i = 20) {
7068
7085
  this.loadPage = t, this.limit = i, this.recentQuery = new ri(
7069
7086
  `${e}:recent`,
@@ -7073,7 +7090,7 @@ class Wd {
7073
7090
  nextCursor: r.nextCursor
7074
7091
  }))
7075
7092
  ),
7076
- Tr
7093
+ Er
7077
7094
  ), this.pinnedQuery = new ri(
7078
7095
  `${e}:pinned`,
7079
7096
  async () => it({
@@ -7106,7 +7123,7 @@ class Wd {
7106
7123
  }) : null;
7107
7124
  return {
7108
7125
  key: e.key.slice(0, -7),
7109
- status: Oa(e, t),
7126
+ status: Pa(e, t),
7110
7127
  data: o,
7111
7128
  error: e.error ?? t.error,
7112
7129
  requestId: Math.max(e.requestId, t.requestId),
@@ -7215,21 +7232,21 @@ class Wd {
7215
7232
  function Ye(s) {
7216
7233
  return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
7217
7234
  }
7218
- function Oa(s, e) {
7235
+ function Pa(s, e) {
7219
7236
  return s.status === "error" || e.status === "error" ? "error" : s.status === "loading" || e.status === "loading" ? "loading" : s.status === "refreshing" || e.status === "refreshing" ? "refreshing" : s.status === "loading_more" ? "loading_more" : s.status === "ready" || e.status === "ready" ? "ready" : "not_requested";
7220
7237
  }
7221
- const Pa = {
7238
+ const xa = {
7222
7239
  working: "⏳",
7223
7240
  completed: "✅",
7224
7241
  failed: "❗",
7225
7242
  stopped: "⏹️"
7226
- }, xa = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
7227
- function Da(s, e) {
7243
+ }, Da = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
7244
+ function Ua(s, e) {
7228
7245
  if (!e) return ft(s);
7229
- const t = ft(s), i = `${Pa[e]} Pluno`;
7246
+ const t = ft(s), i = `${xa[e]} Pluno`;
7230
7247
  return t ? `${i}: ${t}` : i;
7231
7248
  }
7232
- class Vd {
7249
+ class Gd {
7233
7250
  constructor(e) {
7234
7251
  this.titleDocument = e;
7235
7252
  }
@@ -7263,11 +7280,11 @@ class Vd {
7263
7280
  applyTitle() {
7264
7281
  if (!this.status)
7265
7282
  return;
7266
- const e = Da(this.baseTitle, this.status);
7283
+ const e = Ua(this.baseTitle, this.status);
7267
7284
  this.lastAppliedTitle = e, this.titleDocument.getTitle() !== e && this.titleDocument.setTitle(e);
7268
7285
  }
7269
7286
  }
7270
- function Gd(s) {
7287
+ function Jd(s) {
7271
7288
  return {
7272
7289
  getTitle: () => s.title,
7273
7290
  setTitle: (e) => {
@@ -7284,9 +7301,9 @@ function Gd(s) {
7284
7301
  };
7285
7302
  }
7286
7303
  function ft(s) {
7287
- return s.replace(xa, "");
7304
+ return s.replace(Da, "");
7288
7305
  }
7289
- const Ua = {
7306
+ const Na = {
7290
7307
  "stop-without-rendered-message": "Stop is enabled while no message is rendered or the welcome screen is still visible.",
7291
7308
  "in-progress-stop-unavailable": "An in-progress response has no visible enabled interrupt control.",
7292
7309
  "stop-did-not-interrupt": "The stopped response remained in progress after an interrupt click.",
@@ -7302,8 +7319,8 @@ const Ua = {
7302
7319
  "thinking-groups-without-user-message": "Multiple thinking groups appeared without a user message between them.",
7303
7320
  "thinking-without-progress": "Thinking remained visible without progress for five minutes."
7304
7321
  };
7305
- function Na(s) {
7306
- return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(Ua, s.slice(13));
7322
+ function Ba(s) {
7323
+ return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(Na, s.slice(13));
7307
7324
  }
7308
7325
  function Ai(s) {
7309
7326
  return {
@@ -7316,7 +7333,7 @@ function Ai(s) {
7316
7333
  ...s.fileUrl === void 0 ? {} : { fileUrl: s.fileUrl }
7317
7334
  };
7318
7335
  }
7319
- function Jd(s) {
7336
+ function Qd(s) {
7320
7337
  if (!s || typeof s != "object" || !("type" in s)) return !1;
7321
7338
  const e = s;
7322
7339
  switch (e.type) {
@@ -7332,11 +7349,11 @@ function Jd(s) {
7332
7349
  case "runtime.warmup":
7333
7350
  return e.reason === "panel_open" || e.reason === "extension_install" || e.reason === "composer_input";
7334
7351
  case "runtime.report_operation_timing":
7335
- return ze(e.timing);
7352
+ return He(e.timing);
7336
7353
  case "runtime.report_displayed_error":
7337
- return (e.errorDiagnostic === void 0 || dr(e.errorDiagnostic)) && (e.httpRequest === void 0 || de(e.httpRequest)) && (e.historyRefreshFailure === void 0 || Ts(e.historyRefreshFailure)) && (e.renderedError === void 0 || ks(e.renderedError)) && (e.reason === "conversation_error" || e.reason === "attachment_error" || e.reason === "history_error" || e.reason === "action_error") && typeof e.errorFingerprint == "string" && /^fnv1a-[0-9a-f]{8}$/.test(e.errorFingerprint) && (e.displayedMessage === void 0 || typeof e.displayedMessage == "string" && e.displayedMessage.length <= 500);
7354
+ return (e.errorDiagnostic === void 0 || lr(e.errorDiagnostic)) && (e.httpRequest === void 0 || le(e.httpRequest)) && (e.historyRefreshFailure === void 0 || Es(e.historyRefreshFailure)) && (e.renderedError === void 0 || qs(e.renderedError)) && (e.reason === "conversation_error" || e.reason === "attachment_error" || e.reason === "history_error" || e.reason === "action_error") && typeof e.errorFingerprint == "string" && /^fnv1a-[0-9a-f]{8}$/.test(e.errorFingerprint) && (e.displayedMessage === void 0 || typeof e.displayedMessage == "string" && e.displayedMessage.length <= 500);
7338
7355
  case "runtime.report_invalid_state_transition":
7339
- return (e.uiInvariant === void 0 || qs(e.uiInvariant)) && (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" || Na(e.reason)) && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
7356
+ return (e.uiInvariant === void 0 || Cs(e.uiInvariant)) && (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" || Ba(e.reason)) && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
7340
7357
  case "runtime.widget_lifecycle":
7341
7358
  return (e.action === "opened" || e.action === "closed" || e.action === "minimized") && typeof e.trigger == "string";
7342
7359
  case "session.load":
@@ -7364,7 +7381,7 @@ function Jd(s) {
7364
7381
  return !1;
7365
7382
  }
7366
7383
  }
7367
- class Qd {
7384
+ class Xd {
7368
7385
  constructor(e, t, i) {
7369
7386
  this.adapter = t, this.state = Kt(e), this.model = i;
7370
7387
  }
@@ -7418,7 +7435,7 @@ class Qd {
7418
7435
  for (const o of this.state.messages) {
7419
7436
  if (o.role !== "user" || !o.attachments?.length) continue;
7420
7437
  const c = a.messages.find((d) => d.role === "user" && d.id === o.id);
7421
- a.sessionId !== e.sessionId && !(a.sessionId === null && c) || (o.attachments = Ba(c?.attachments, o.attachments));
7438
+ a.sessionId !== e.sessionId && !(a.sessionId === null && c) || (o.attachments = ja(c?.attachments, o.attachments));
7422
7439
  }
7423
7440
  if (t !== void 0 && (this.model = t), i && JSON.stringify(i) !== JSON.stringify(this.sessionHistoryState)) {
7424
7441
  this.sessionHistoryState = Ti(i);
@@ -7453,7 +7470,7 @@ class Qd {
7453
7470
  this.dispatch({ type: "runtime.widget_lifecycle", action: e, trigger: t });
7454
7471
  }
7455
7472
  reportOperationTiming(e) {
7456
- !this.destroyed && ze(e) && this.adapter.dispatch({ type: "runtime.report_operation_timing", timing: e }).catch(() => {
7473
+ !this.destroyed && He(e) && this.adapter.dispatch({ type: "runtime.report_operation_timing", timing: e }).catch(() => {
7457
7474
  });
7458
7475
  }
7459
7476
  reportResponseVisibility(e) {
@@ -7461,7 +7478,7 @@ class Qd {
7461
7478
  });
7462
7479
  }
7463
7480
  reportInvalidStateTransition(e, t, i) {
7464
- i !== void 0 && !qs(i) || this.adapter.dispatch({
7481
+ i !== void 0 && !Cs(i) || this.adapter.dispatch({
7465
7482
  type: "runtime.report_invalid_state_transition",
7466
7483
  reason: e,
7467
7484
  clientMessageId: t,
@@ -7471,7 +7488,7 @@ class Qd {
7471
7488
  }
7472
7489
  reportDisplayedError(e, t, i, n, r) {
7473
7490
  const a = e === "conversation_error" && !n ? this.getState().conversationDiagnostics?.httpRequest : void 0;
7474
- if (n !== void 0 && !ks(n) || r !== void 0 && !Ts(r)) return;
7491
+ if (n !== void 0 && !qs(n) || r !== void 0 && !Es(r)) return;
7475
7492
  const o = Xi(this.getState(), e, i, !!n, this.adapter.diagnosticBuilds);
7476
7493
  this.adapter.dispatch({
7477
7494
  type: "runtime.report_displayed_error",
@@ -7481,7 +7498,7 @@ class Qd {
7481
7498
  errorFingerprint: t,
7482
7499
  ...n ? { renderedError: n } : {},
7483
7500
  ...r ? { historyRefreshFailure: r } : {},
7484
- ...de(a) ? { httpRequest: a } : {},
7501
+ ...le(a) ? { httpRequest: a } : {},
7485
7502
  ...i ? { displayedMessage: _e(i) } : {}
7486
7503
  }).catch(() => {
7487
7504
  });
@@ -7564,14 +7581,14 @@ class Qd {
7564
7581
  return r === this.stagedProactiveSuggestionClientMessageId && (this.stagedProactiveSuggestionClientMessageId = null), r;
7565
7582
  } catch (d) {
7566
7583
  if (i !== this.submissionGeneration) return null;
7567
- if (Cr(d))
7584
+ if (Mr(d))
7568
7585
  for (const u of t.attachments ?? [])
7569
7586
  u.id && this.attachmentFiles.delete(u.id);
7570
7587
  const l = this.submissionPreviews.get(r);
7571
- throw l && (l.pending = !1, l.error = he(d).message, l.retry = !c && he(d).code === "command_not_received" ? () => this.sendMessageNow(e, t, i) : void 0, this.emit("state", this.getState())), c && await this.adapter.dispatch({
7588
+ throw l && (l.pending = !1, l.error = J(d).message, l.retry = !c && J(d).code === "command_not_received" ? () => this.sendMessageNow(e, t, i) : void 0, this.emit("state", this.getState())), c && await this.adapter.dispatch({
7572
7589
  type: "conversation.fail_staged",
7573
7590
  clientMessageId: r,
7574
- message: he(d).message
7591
+ message: J(d).message
7575
7592
  }), d;
7576
7593
  }
7577
7594
  }
@@ -7592,7 +7609,7 @@ class Qd {
7592
7609
  return i && n ? (i.pending = !0, i.error = void 0, i.retry = void 0, this.pendingTransfers.set(t, (i.message.attachments ?? []).flatMap((a) => a.id ? [a.id] : [])), this.emit("state", this.getState()), await n()) : await this.dispatch({ type: "run.retry", clientMessageId: t }), !0;
7593
7610
  } catch (a) {
7594
7611
  if (!i) throw a;
7595
- return r === this.submissionGeneration && this.submissionPreviews.get(t) === i && (i.error = he(a).message, this.emit("state", this.getState())), !1;
7612
+ return r === this.submissionGeneration && this.submissionPreviews.get(t) === i && (i.error = J(a).message, this.emit("state", this.getState())), !1;
7596
7613
  } finally {
7597
7614
  n && this.pendingTransfers.delete(t), i && r === this.submissionGeneration && this.submissionPreviews.get(t) === i && (i.pending = !1, this.emit("state", this.getState()));
7598
7615
  }
@@ -7630,7 +7647,7 @@ class Qd {
7630
7647
  }, (d) => {
7631
7648
  if (!(o !== this.submissionGeneration || i.every((l) => !this.stopPreviews.has(l)))) {
7632
7649
  for (const l of i) this.stopPreviews.delete(l);
7633
- this.stopError = he(d).message;
7650
+ this.stopError = J(d).message;
7634
7651
  }
7635
7652
  }).finally(() => {
7636
7653
  this.destroyed || o !== this.submissionGeneration || (this.pendingStop === r && (this.pendingStop = null), this.emit("state", this.getState()));
@@ -7749,7 +7766,7 @@ class Qd {
7749
7766
  for (const n of i ?? []) n(t);
7750
7767
  }
7751
7768
  }
7752
- function Ba(s, e) {
7769
+ function ja(s, e) {
7753
7770
  if (!e || !s) return e;
7754
7771
  const t = /* @__PURE__ */ new Map();
7755
7772
  for (const i of s) {
@@ -7789,13 +7806,13 @@ function Ti(s) {
7789
7806
  return {
7790
7807
  ...s,
7791
7808
  data: s.data ? it({
7792
- entities: Er(s.data).map((e) => ({ ...e })),
7809
+ entities: kr(s.data).map((e) => ({ ...e })),
7793
7810
  nextCursor: s.data.nextCursor
7794
7811
  }) : null
7795
7812
  };
7796
7813
  }
7797
- const ja = globalThis.fetch.bind(globalThis), Ei = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', La = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', $a = ".pluno-pa-widget__panel", Fa = ".pluno-pa-widget__timeline", za = "__plunoExtensionWidgetOwner";
7798
- class re extends Error {
7814
+ const La = globalThis.fetch.bind(globalThis), Ei = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', $a = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Fa = ".pluno-pa-widget__panel", za = ".pluno-pa-widget__timeline", Ha = "__plunoExtensionWidgetOwner";
7815
+ class oe extends Error {
7799
7816
  constructor(e, t, i, n) {
7800
7817
  super(e), this.retryable = t, this.status = i, this.retryAfterMs = n, this.name = "ProductAgentTokenProviderError";
7801
7818
  }
@@ -7803,10 +7820,10 @@ class re extends Error {
7803
7820
  status;
7804
7821
  retryAfterMs;
7805
7822
  }
7806
- function Ha(s) {
7823
+ function Ka(s) {
7807
7824
  return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
7808
7825
  }
7809
- let Ka = 0;
7826
+ let Wa = 0;
7810
7827
  function Wt(s) {
7811
7828
  const e = {};
7812
7829
  for (const c of [
@@ -7886,26 +7903,26 @@ function Se(s, e, t) {
7886
7903
  source: "web_sdk",
7887
7904
  category: s,
7888
7905
  name: e,
7889
- sequence: ++Ka,
7906
+ sequence: ++Wa,
7890
7907
  wallTime: (/* @__PURE__ */ new Date()).toISOString(),
7891
7908
  monotonicMs: performance.now(),
7892
7909
  data: t
7893
7910
  };
7894
7911
  window.dispatchEvent(new CustomEvent("product-agent:trace", { detail: n }));
7895
7912
  }
7896
- const Wa = "https://app.pluno.ai", Va = 2e4, Ga = 1e4, Ja = 6e4, Qa = 6e4, Xa = 1e4, Ya = 1e4, Za = 1e3, _s = 3e4, ki = 0.2, Vt = 6e4, Gt = 3, qi = "Still connecting to Pluno. Retrying automatically.", ec = 1e3, tc = 100, Ci = 3, sc = [300, 1e3], Rn = 50 * 1024 * 1024, ic = /* @__PURE__ */ new Set([
7913
+ const Va = "https://app.pluno.ai", Ga = 2e4, Ja = 1e4, Qa = 6e4, Xa = 6e4, Ya = 1e4, Za = 1e4, ec = 1e3, _s = 3e4, ki = 0.2, Vt = 6e4, Gt = 3, qi = "Still connecting to Pluno. Retrying automatically.", tc = 1e3, sc = 100, Ci = 3, ic = [300, 1e3], Rn = 50 * 1024 * 1024, nc = /* @__PURE__ */ new Set([
7897
7914
  ".jpeg:image/jpeg",
7898
7915
  ".jpg:image/jpeg",
7899
7916
  ".pdf:application/pdf",
7900
7917
  ".png:image/png",
7901
7918
  ".webp:image/webp"
7902
- ]), Xd = ".pdf,.png,.jpg,.jpeg,.webp", Ls = 64e3, Jt = 4e3, $s = 30, nc = 2e3, rc = 1e3, An = "Image is too large for model vision input.", oc = "pluno.productAgent.state.", Ss = "pluno.productAgent.pendingEvents.", wt = "pluno.productAgent.activeToolCalls.", ac = 100, ht = /* @__PURE__ */ new Set();
7919
+ ]), Yd = ".pdf,.png,.jpg,.jpeg,.webp", Ls = 64e3, Jt = 4e3, $s = 30, rc = 2e3, oc = 1e3, An = "Image is too large for model vision input.", ac = "pluno.productAgent.state.", Ss = "pluno.productAgent.pendingEvents.", wt = "pluno.productAgent.activeToolCalls.", cc = 100, ht = /* @__PURE__ */ new Set();
7903
7920
  let Ze = null;
7904
- function cc(s, e = Math.random) {
7905
- const t = Math.min(_s, Za * 2 ** s), i = 1 - ki + e() * ki * 2;
7921
+ function dc(s, e = Math.random) {
7922
+ const t = Math.min(_s, ec * 2 ** s), i = 1 - ki + e() * ki * 2;
7906
7923
  return Math.min(_s, Math.round(t * i));
7907
7924
  }
7908
- function dc(s) {
7925
+ function lc(s) {
7909
7926
  const e = s.split(".")[1];
7910
7927
  if (!e)
7911
7928
  return null;
@@ -7917,7 +7934,7 @@ function dc(s) {
7917
7934
  }
7918
7935
  }
7919
7936
  function Qt(s) {
7920
- if (s instanceof re)
7937
+ if (s instanceof oe)
7921
7938
  return s.retryable;
7922
7939
  if (s && typeof s == "object") {
7923
7940
  const e = s instanceof w ? s.code : "", t = /^[45][0-9]{2}$/.test(e) ? Number(e) : s.status;
@@ -7927,16 +7944,14 @@ function Qt(s) {
7927
7944
  return !0;
7928
7945
  }
7929
7946
  function xe(s) {
7930
- if (s instanceof Error)
7931
- return s;
7932
- if (s && typeof s == "object") {
7933
- const e = s, t = e.data && typeof e.data == "object" ? e.data.detail : null;
7934
- if (typeof t == "string")
7935
- return new Error(t);
7936
- if (typeof e.error == "string")
7937
- return new Error(e.error);
7947
+ const e = J(s, "connection_failed", "web_transport");
7948
+ if (s instanceof Error && s.message === e.message) return s;
7949
+ if (s && typeof s == "object" && !("message" in s)) {
7950
+ const t = s, i = t.data && typeof t.data == "object" ? t.data.detail : null, n = typeof i == "string" ? i : t.error;
7951
+ if (typeof n == "string")
7952
+ return Object.assign(new Error(J(n).message), { code: e.code });
7938
7953
  }
7939
- return new Error(String(s));
7954
+ return Object.assign(new Error(e.message), e);
7940
7955
  }
7941
7956
  function Xt(s) {
7942
7957
  return s === "main_web_chat" ? ["pinned", "recent"] : ["all"];
@@ -7967,7 +7982,7 @@ class _t {
7967
7982
  }
7968
7983
  });
7969
7984
  const i = this;
7970
- this.clientRuntime = new ta(Mo({
7985
+ this.clientRuntime = new sa(Oo({
7971
7986
  http: this.directoryHttp,
7972
7987
  get authority() {
7973
7988
  return i.directoryAuthority;
@@ -7979,7 +7994,7 @@ class _t {
7979
7994
  }), void 0, pr(async () => {
7980
7995
  if (!this.token || !this.state.user || this.state.status === "closed") throw new Error("Product Agent is not authenticated");
7981
7996
  return this.options.activeUsersLoader ? (await this.options.activeUsersLoader()).count : fr(this.options.backendUrl);
7982
- })), this.modelClientScopeId = Ta(e.clientId, () => crypto.randomUUID()), this.directoryConversationScopeId = `conversation:${this.modelClientScopeId}`, this.createDirectoryAdapters(), this.clientRuntime.engine.dispatch({
7997
+ })), this.modelClientScopeId = Ea(e.clientId, () => crypto.randomUUID()), this.directoryConversationScopeId = `conversation:${this.modelClientScopeId}`, this.createDirectoryAdapters(), this.clientRuntime.engine.dispatch({
7983
7998
  type: "model.scope_open",
7984
7999
  clientScopeId: this.modelClientScopeId,
7985
8000
  sessionId: null,
@@ -7987,10 +8002,10 @@ class _t {
7987
8002
  defaultModel: e.productVariant === "personal" ? void 0 : "gpt-5.6-terra",
7988
8003
  selectedModel: e.model
7989
8004
  }), this.state = {
7990
- starterPrompts: jc(e.initialStarterPrompts)
7991
- }, this.account = e.initialAccount ? { ...e.initialAccount } : null, this.queuedClientEvents = ud(
7992
- ad(e.clientId),
7993
- cd(e.clientId)
8005
+ starterPrompts: Lc(e.initialStarterPrompts)
8006
+ }, this.account = e.initialAccount ? { ...e.initialAccount } : null, this.queuedClientEvents = hd(
8007
+ cd(e.clientId),
8008
+ dd(e.clientId)
7994
8009
  );
7995
8010
  }
7996
8011
  options;
@@ -8047,7 +8062,7 @@ class _t {
8047
8062
  accountRefresh = null;
8048
8063
  runtimeInteractions = [];
8049
8064
  interactionListeners = /* @__PURE__ */ new Set();
8050
- interactionManager = new Ca(
8065
+ interactionManager = new Ma(
8051
8066
  { load: async () => [], save: async () => {
8052
8067
  } },
8053
8068
  []
@@ -8122,17 +8137,17 @@ class _t {
8122
8137
  t in e && Object.assign(this.platformState, { [t]: e[t] });
8123
8138
  }
8124
8139
  static async init(e) {
8125
- const t = e, i = await va(
8140
+ const t = e, i = await Ia(
8126
8141
  t.skipStoredTransportIdentityCollisionCheck === !0
8127
8142
  ), n = new _t({
8128
8143
  ...e,
8129
- backendUrl: Tc(e.backendUrl ?? Wa),
8130
- clientId: e.clientId ?? Hc(),
8144
+ backendUrl: Ec(e.backendUrl ?? Va),
8145
+ clientId: e.clientId ?? Kc(),
8131
8146
  productVariant: e.productVariant ?? "customer_embedded",
8132
8147
  entrySurface: mr(e.entrySurface)
8133
8148
  }, i);
8134
8149
  try {
8135
- await n.initializeDirectory(), await n.initializeConversation(), oa().catch((r) => {
8150
+ await n.initializeDirectory(), await n.initializeConversation(), aa().catch((r) => {
8136
8151
  $("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
8137
8152
  message: r instanceof Error ? r.message : String(r)
8138
8153
  });
@@ -8143,15 +8158,15 @@ class _t {
8143
8158
  return n;
8144
8159
  }
8145
8160
  createDirectoryAdapters() {
8146
- this.directoryScope = new xo({
8161
+ this.directoryScope = new Do({
8147
8162
  runtime: this.clientRuntime,
8148
8163
  authority: this.directoryAuthority,
8149
8164
  random: Math.random,
8150
- persistence: Uo(
8165
+ persistence: No(
8151
8166
  this.modelClientScopeId,
8152
8167
  this.directoryAuthority.authorityId
8153
8168
  )
8154
- }), this.directoryObservation = new Oo({
8169
+ }), this.directoryObservation = new Po({
8155
8170
  runtime: this.clientRuntime,
8156
8171
  authority: this.directoryAuthority,
8157
8172
  http: this.directoryHttp,
@@ -8174,18 +8189,18 @@ class _t {
8174
8189
  operationTimingReporter = () => {
8175
8190
  };
8176
8191
  reportOperationTiming(e) {
8177
- ze(e) && this.operationTimingReporter(e);
8192
+ He(e) && this.operationTimingReporter(e);
8178
8193
  }
8179
8194
  async initializeConversation() {
8180
8195
  const e = ++this.conversationAdapterGeneration;
8181
8196
  this.conversationObservation?.dispose(), this.conversationUnsubscribe?.();
8182
8197
  const t = this.directoryAuthority, i = () => e === this.conversationAdapterGeneration;
8183
- this.operationTimingReporter = sr((h) => {
8198
+ this.operationTimingReporter = ir((h) => {
8184
8199
  i() && !this.clientRuntime.isDisposed && this.reportHealthSignal("operation_timing", { timings: h.map((y) => ({ ...y, entrySurface: this.options.entrySurface })) });
8185
8200
  });
8186
8201
  const n = `pa.conversation.delivery:${this.modelClientScopeId}:${t.authorityId}`, r = `${n}:cancellations`;
8187
8202
  this.authenticatedUserId && this.options.restorePersistedState === !1 && sessionStorage.removeItem(r);
8188
- const a = this.authenticatedUserId ? Mt(r) : null, o = ir({
8203
+ const a = this.authenticatedUserId ? Mt(r) : null, o = nr({
8189
8204
  authorityId: t.authorityId,
8190
8205
  isCurrent: i,
8191
8206
  read: async () => a ? JSON.parse(a) : null,
@@ -8224,7 +8239,7 @@ class _t {
8224
8239
  document.addEventListener("visibilitychange", A);
8225
8240
  }));
8226
8241
  const v = h.context.page;
8227
- if (ee().url !== v.url) throw Object.assign(new Error("The page changed before preparation completed. Send this message again."), { code: "context_preparation_interrupted", retryable: !1 });
8242
+ if (te().url !== v.url) throw Object.assign(new Error("The page changed before preparation completed. Send this message again."), { code: "context_preparation_interrupted", retryable: !1 });
8228
8243
  b = { pageContent: await g.measure("page_capture", async () => Fs()), sessionTabs: [] };
8229
8244
  }
8230
8245
  if (await g.measure("authentication", () => this.waitForAuthentication()), !i() || t !== this.directoryAuthority || this.clientRuntime.isDisposed) throw new Error("Submission authority was retired.");
@@ -8326,13 +8341,17 @@ class _t {
8326
8341
  for (const g of h)
8327
8342
  (g.dataType === "run_status" || g.dataType === "run_error") && this.clearFirstResponseTimer(g.respondsToUserMessageId ?? null);
8328
8343
  for (const g of h)
8329
- g.content.trim() && (g.role === "assistant" || g.dataType === "commentary_history" || g.dataType === "tool_summary") && this.clearFirstResponseTimer(g.respondsToUserMessageId ?? null, !0, y);
8344
+ if (g.content.trim() && (g.role === "assistant" || g.dataType === "commentary_history" || g.dataType === "tool_summary")) {
8345
+ const b = y ? this.clientRuntime.engine.getState().slices.conversation.sessions[y] : void 0;
8346
+ for (const v of g.respondsToUserMessageId ? br(b, g.respondsToUserMessageId) : [])
8347
+ this.clearFirstResponseTimer(v, !0, y);
8348
+ }
8330
8349
  }
8331
8350
  };
8332
8351
  let u = new Map(this.getState().messages.map((h) => [h.id, h])), p = this.clientRuntime.engine.getState().slices.conversation, f = this.clientRuntime.engine.getState().slices.directory.selections, m = this.clientRuntime.engine.getState().slices.directory.clients[this.modelClientScopeId];
8333
8352
  this.conversationUnsubscribe = this.clientRuntime.engine.subscribe(() => {
8334
8353
  const h = this.clientRuntime.engine.getState().slices, y = p;
8335
- p = h.conversation, nr(y, h.conversation, this.operationTimingReporter, "sdk");
8354
+ p = h.conversation, rr(y, h.conversation, this.operationTimingReporter, "sdk");
8336
8355
  const g = m !== h.directory.clients[this.modelClientScopeId];
8337
8356
  m = h.directory.clients[this.modelClientScopeId], f !== h.directory.selections && (f = h.directory.selections, this.directoryScope.persist());
8338
8357
  for (const v of Object.values(h.conversation.submissions)) {
@@ -8352,8 +8371,8 @@ class _t {
8352
8371
  if (!v.startsWith(`background:${this.modelClientScopeId}:`)) continue;
8353
8372
  const S = Ie(h.conversation, h.directory, _), A = S.sessionId ? h.conversation.sessions[S.sessionId] : void 0;
8354
8373
  if (this.firstResponseTimersByClientMessageId.size && (l(Ot(S, A?.queries.current, this.options.backendUrl).messages, S.sessionId), ["failed", "stopped"].includes(S.activity.phase)))
8355
- for (const H of se(A?.execution)) this.clearFirstResponseTimer(H);
8356
- const C = S.activity.phase === "completed" && se(A?.execution).some((H) => this.firstResponseTimersByClientMessageId.has(H));
8374
+ for (const H of ie(A?.execution)) this.clearFirstResponseTimer(H);
8375
+ const C = S.activity.phase === "completed" && ie(A?.execution).some((H) => this.firstResponseTimersByClientMessageId.has(H));
8357
8376
  (g && S.sessionId === this.getState().sessionId || !C && ["completed", "failed", "stopped"].includes(S.activity.phase)) && this.directoryScope.detach(v);
8358
8377
  }
8359
8378
  const b = this.getState();
@@ -8371,7 +8390,7 @@ class _t {
8371
8390
  type: "directory.authority_replace",
8372
8391
  expectedGeneration: 0
8373
8392
  }), !(this.options.restorePersistedState !== !1 && await this.directoryScope.restore(this.options.expectedPersistedSessionId))) {
8374
- const t = this.options.restorePersistedState === !1 ? null : od(this.options.clientId, this.options.expectedPersistedSessionId)?.sessionId;
8393
+ const t = this.options.restorePersistedState === !1 ? null : ad(this.options.clientId, this.options.expectedPersistedSessionId)?.sessionId;
8375
8394
  t ? await this.directoryScope.bind(
8376
8395
  this.modelClientScopeId,
8377
8396
  this.directoryConversationScopeId,
@@ -8457,7 +8476,7 @@ class _t {
8457
8476
  if (!this.options.tokenProvider)
8458
8477
  return this.token;
8459
8478
  if (this.tokenRequest) return await this.tokenRequest;
8460
- const i = Date.now(), n = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs - Qa > i;
8479
+ const i = Date.now(), n = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs - Xa > i;
8461
8480
  if (!t.forceRefresh && (n || t.preferCached && this.token !== null))
8462
8481
  return this.token;
8463
8482
  t.forceRefresh && this.invalidateProviderToken();
@@ -8467,8 +8486,8 @@ class _t {
8467
8486
  let o = null;
8468
8487
  const c = new Promise((d, l) => {
8469
8488
  o = window.setTimeout(() => {
8470
- r.abort(), l(new re("Pluno token provider timed out", !0));
8471
- }, Ja);
8489
+ r.abort(), l(new oe("Pluno token provider timed out", !0));
8490
+ }, Qa);
8472
8491
  });
8473
8492
  try {
8474
8493
  const d = await Promise.race([
@@ -8476,10 +8495,10 @@ class _t {
8476
8495
  c
8477
8496
  ]);
8478
8497
  if (r.signal.aborted || this.tokenAbortController !== r)
8479
- throw new re("Pluno token request was cancelled", !0);
8498
+ throw new oe("Pluno token request was cancelled", !0);
8480
8499
  if (typeof d != "string" || !d.trim())
8481
- throw new re("Chat setup did not return a session. Contact your app administrator, then try again.", !1);
8482
- return this.token = d, this.tokenExpiresAtMs = dc(d), d;
8500
+ throw new oe("Chat setup did not return a session. Contact your app administrator, then try again.", !1);
8501
+ return this.token = d, this.tokenExpiresAtMs = lc(d), d;
8483
8502
  } finally {
8484
8503
  o !== null && window.clearTimeout(o);
8485
8504
  }
@@ -8513,7 +8532,7 @@ class _t {
8513
8532
  if (this.lastRecoveryStage = "token_provider", this.token = await this.acquireToken("connect", { forceRefresh: e }), this.token && (this.directoryHttp.auth.token = this.token), i !== this.connectionAttemptId || this.state.status === "closed")
8514
8533
  return;
8515
8534
  if (this.lastRecoveryStage = "socket_admission", !this.token && !this.options.webSocketFactory)
8516
- throw new re("Pluno requires a token or tokenProvider", !1);
8535
+ throw new oe("Pluno requires a token or tokenProvider", !1);
8517
8536
  if (!this.options.webSocketFactory && this.rejectedTransportToken !== null && this.rejectedTransportToken === this.token) {
8518
8537
  this.clearEmbeddedRecoveryBudget(), this.setState({ status: "error", lastError: n });
8519
8538
  return;
@@ -8522,7 +8541,7 @@ class _t {
8522
8541
  await this.replaceDefaultTransportCredentials(this.socket);
8523
8542
  return;
8524
8543
  }
8525
- const r = kc(this.options.backendUrl), a = this.options.webSocketFactory?.(r) ?? new D({
8544
+ const r = qc(this.options.backendUrl), a = this.options.webSocketFactory?.(r) ?? new D({
8526
8545
  displaySchema: "canonical",
8527
8546
  backendUrl: this.options.backendUrl,
8528
8547
  entrySurface: this.options.entrySurface,
@@ -8543,7 +8562,7 @@ class _t {
8543
8562
  });
8544
8563
  this.socket = a, this.options.webSocketFactory && (this.socketConnectTimer = window.setTimeout(() => {
8545
8564
  this.socket === a && a.readyState === WebSocket.CONNECTING && ($("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.reportTransportDiagnostic("connect_timeout"), this.replaceTimedOutSocket(a));
8546
- }, Xa)), a.addEventListener("reconnecting", (o) => {
8565
+ }, Ya)), a.addEventListener("reconnecting", (o) => {
8547
8566
  this.socket === a && this.state.status !== "closed" && (this.refreshingDefaultCredentials || this.reportTransportDiagnostic("socket_closed", { disconnectReason: o.detail.reason }), this.setReconnectingState());
8548
8567
  }), a.addEventListener("open", () => {
8549
8568
  this.socket !== a || (this.clearSocketConnectTimer(), this.directoryObservation.reconnect().catch(() => {
@@ -8558,12 +8577,12 @@ class _t {
8558
8577
  pageUrl: location.href
8559
8578
  }) : !0)) || this.options.webSocketFactory && (this.socketAuthTimer = window.setTimeout(() => {
8560
8579
  this.socket === a && ($("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.reportTransportDiagnostic("auth_timeout"), this.replaceTimedOutSocket(a));
8561
- }, Ya));
8580
+ }, Za));
8562
8581
  }), a.addEventListener("message", (o) => {
8563
8582
  if (this.socket !== a)
8564
8583
  return;
8565
8584
  const c = Cn(o.data);
8566
- if (a instanceof D && c.type === "tool.call" && !Bc(c)) {
8585
+ if (a instanceof D && c.type === "tool.call" && !jc(c)) {
8567
8586
  this.setState({ status: "error", lastError: "Invalid tool-call envelope", lastErrorCode: "invalid_tool_call" });
8568
8587
  return;
8569
8588
  }
@@ -8609,7 +8628,7 @@ class _t {
8609
8628
  lastError: qi,
8610
8629
  lastErrorCode: "connection_failed"
8611
8630
  }), this.emit("error", a), this.scheduleReconnect(
8612
- r instanceof re ? r.retryAfterMs : void 0
8631
+ r instanceof oe ? r.retryAfterMs : void 0
8613
8632
  );
8614
8633
  return;
8615
8634
  }
@@ -8630,7 +8649,7 @@ class _t {
8630
8649
  }
8631
8650
  destroy() {
8632
8651
  if (!this.clientRuntime.isDisposed) {
8633
- this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), hd(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
8652
+ this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), pd(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
8634
8653
  for (const e of Object.values(this.listeners))
8635
8654
  e?.clear();
8636
8655
  this.accountListeners.clear(), this.interactionListeners.clear(), this.conversationAdapterGeneration++, this.conversationObservation?.dispose(), this.conversationUnsubscribe?.(), this.directoryObservation.dispose(), this.directoryHttp.dispose(), this.clientRuntime.dispose();
@@ -8665,7 +8684,7 @@ class _t {
8665
8684
  reason: e,
8666
8685
  ...n ? { warmupId: n } : {},
8667
8686
  sessionId: t,
8668
- page: ee(),
8687
+ page: te(),
8669
8688
  entrySurface: this.options.entrySurface,
8670
8689
  model: this.getModel() ?? null
8671
8690
  }
@@ -8682,7 +8701,7 @@ class _t {
8682
8701
  occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
8683
8702
  entrySurface: this.options.entrySurface,
8684
8703
  ...this.state.sessionId ? { sessionId: this.state.sessionId } : {},
8685
- pageOrigin: ee().origin
8704
+ pageOrigin: te().origin
8686
8705
  }
8687
8706
  };
8688
8707
  this.authenticatedSocket === this.socket && this.sendNow(i) || (this.pendingWidgetLifecycleEvents.push(i), this.pendingWidgetLifecycleEvents.length > 20 && this.pendingWidgetLifecycleEvents.splice(0, this.pendingWidgetLifecycleEvents.length - 20));
@@ -8706,7 +8725,7 @@ class _t {
8706
8725
  Ft(this.clientRuntime, this.modelClientScopeId, r, o ?? null);
8707
8726
  const l = this.clientRuntime.engine.getState().slices.conversation.submissions[r];
8708
8727
  if (l && (l.content !== i || JSON.stringify(l.attachments.map((y) => y.sourceId)) !== JSON.stringify(n.map((y) => y.id ?? y.storageKey ?? y.sandboxPath)))) throw new Error("User-message identity cannot be reused with different input.");
8709
- const u = ee(), p = !l && !t.initiatedBy && this.options.capturePageContent !== !1 && this.lastUserMessagePageUrl !== u.url, m = this.clientRuntime.engine.getState().slices.directory.clients[this.modelClientScopeId];
8728
+ const u = te(), p = !l && !t.initiatedBy && this.options.capturePageContent !== !1 && this.lastUserMessagePageUrl !== u.url, m = this.clientRuntime.engine.getState().slices.directory.clients[this.modelClientScopeId];
8710
8729
  if (!m) throw new Error("Conversation selection is not initialized.");
8711
8730
  l || await this.clientRuntime.engine.dispatch({
8712
8731
  ...this.directoryAuthority,
@@ -8739,7 +8758,7 @@ class _t {
8739
8758
  ...t.proactiveSuggestionQuestion ? { proactiveSuggestionQuestion: t.proactiveSuggestionQuestion } : {},
8740
8759
  metadata: { ...Mi(this.options.metadata), ...t.automationOnboarding ? { automationOnboarding: !0 } : {} }
8741
8760
  })),
8742
- invocation: Ec(t.invocation ?? t.initiatedBy),
8761
+ invocation: kc(t.invocation ?? t.initiatedBy),
8743
8762
  entrySurface: this.options.entrySurface,
8744
8763
  submittedAt: t.submittedAt ?? Date.now()
8745
8764
  });
@@ -8761,10 +8780,10 @@ class _t {
8761
8780
  });
8762
8781
  }
8763
8782
  reportResponseVisibility(e) {
8764
- No(this, this.options.entrySurface, e);
8783
+ Bo(this, this.options.entrySurface, e);
8765
8784
  }
8766
8785
  reportInvalidStateTransition(e, t, i) {
8767
- i !== void 0 && !qs(i) || this.reportHealthSignal("invalid_state_transition", {
8786
+ i !== void 0 && !Cs(i) || this.reportHealthSignal("invalid_state_transition", {
8768
8787
  reason: e,
8769
8788
  clientMessageId: t,
8770
8789
  ...i ? { uiInvariant: i } : {}
@@ -8772,7 +8791,7 @@ class _t {
8772
8791
  }
8773
8792
  reportDisplayedError(e, t, i, n, r) {
8774
8793
  const a = e === "conversation_error" && !n ? this.getState().conversationDiagnostics?.httpRequest : void 0;
8775
- if (n !== void 0 && !ks(n) || r !== void 0 && !Ts(r)) return;
8794
+ if (n !== void 0 && !qs(n) || r !== void 0 && !Es(r)) return;
8776
8795
  const o = Xi(this.getState(), e, i, !!n);
8777
8796
  this.reportHealthSignal("user_visible_error", {
8778
8797
  errorDiagnostic: o,
@@ -8781,13 +8800,13 @@ class _t {
8781
8800
  errorFingerprint: t,
8782
8801
  ...n ? { renderedError: n } : {},
8783
8802
  ...r ? { historyRefreshFailure: r } : {},
8784
- ...de(a) ? { httpRequest: a } : {},
8803
+ ...le(a) ? { httpRequest: a } : {},
8785
8804
  ...i ? { displayedMessage: _e(i) } : {}
8786
8805
  });
8787
8806
  }
8788
8807
  getModel() {
8789
8808
  return this.clientRuntime.project("modelSelection", {
8790
- core: () => ka(this.clientRuntime, this.modelClientScopeId)
8809
+ core: () => qa(this.clientRuntime, this.modelClientScopeId)
8791
8810
  });
8792
8811
  }
8793
8812
  setModel(e) {
@@ -8799,7 +8818,7 @@ class _t {
8799
8818
  const t = this.clientRuntime.engine.getState().slices, i = t.directory.clients[this.modelClientScopeId], n = Ie(t.conversation, t.directory, i), r = Yi(n, e);
8800
8819
  if (!r) return !1;
8801
8820
  if (r.type === "preparation") {
8802
- const a = j(), o = Rr(r.submission);
8821
+ const a = j(), o = Ar(r.submission);
8803
8822
  return Ft(this.clientRuntime, this.modelClientScopeId, a, r.submission.requestedModel), this.sendMessage(o.content, { clientMessageId: a, attachments: o.attachments, proactiveSuggestionQuestion: o.proactiveSuggestionQuestion }).catch((c) => this.emit("error", xe(c))), !0;
8804
8823
  }
8805
8824
  return r.type === "delivery" ? (this.clientRuntime.engine.dispatch({ ...this.directoryAuthority, type: "conversation.submit", userMessageId: r.userMessageId, now: Date.now(), manualRetry: !0 }), !0) : (this.clientRuntime.engine.dispatch({ ...this.directoryAuthority, type: "conversation.operation", command: {
@@ -8813,19 +8832,19 @@ class _t {
8813
8832
  } }), !0);
8814
8833
  }
8815
8834
  createLocalAttachment(e) {
8816
- this.options.productVariant === "customer_embedded" && pd(e);
8835
+ this.options.productVariant === "customer_embedded" && fd(e);
8817
8836
  const t = j(), i = {
8818
8837
  id: t,
8819
8838
  name: e.name || "attachment",
8820
8839
  mimeType: Dn(e),
8821
8840
  sizeBytes: e.size
8822
- }, n = Date.now(), r = ra({
8841
+ }, n = Date.now(), r = oa({
8823
8842
  attachmentId: t,
8824
8843
  name: i.name,
8825
8844
  mimeType: i.mimeType,
8826
8845
  sizeBytes: i.sizeBytes,
8827
8846
  blob: e,
8828
- origin: ee().origin,
8847
+ origin: te().origin,
8829
8848
  sessionId: this.state.sessionId ?? void 0,
8830
8849
  createdAt: n,
8831
8850
  lastUsedAt: n
@@ -8848,7 +8867,7 @@ class _t {
8848
8867
  conversationScopeId: o,
8849
8868
  command: { request_id: c, type: "attachment.prepare", payload: {
8850
8869
  source: { sourceId: r.id, name: r.name, mimeType: r.mimeType, sizeBytes: r.sizeBytes },
8851
- context: JSON.parse(JSON.stringify({ page: ee(), metadata: Mi(this.options.metadata) })),
8870
+ context: JSON.parse(JSON.stringify({ page: te(), metadata: Mi(this.options.metadata) })),
8852
8871
  requestedModel: i ?? null,
8853
8872
  entrySurface: this.options.entrySurface,
8854
8873
  sessionId: this.getState().sessionId
@@ -8893,9 +8912,9 @@ class _t {
8893
8912
  });
8894
8913
  };
8895
8914
  let a = !1;
8896
- return Ed(async () => {
8915
+ return kd(async () => {
8897
8916
  let o = await r(!1);
8898
- if (n(), !o.ok && Md(o.status) && this.options.tokenProvider && !a && (a = !0, o = await r(!0), n()), !o.ok) throw new jn("Failed to prepare attachment upload", o.status);
8917
+ if (n(), !o.ok && Od(o.status) && this.options.tokenProvider && !a && (a = !0, o = await r(!0), n()), !o.ok) throw new jn("Failed to prepare attachment upload", o.status);
8899
8918
  return await o.json();
8900
8919
  }, "Failed to prepare attachment upload");
8901
8920
  }
@@ -8936,7 +8955,7 @@ class _t {
8936
8955
  payload: {
8937
8956
  sessionId: t.sessionId,
8938
8957
  warmupId: this.activeComposerWarmupId,
8939
- page: ee()
8958
+ page: te()
8940
8959
  }
8941
8960
  } }), this.activeComposerWarmupId = null, this.lastUserMessagePageUrl = null, this.clientRuntime.engine.dispatch({ type: "model.scope_navigate", clientScopeId: this.modelClientScopeId, sessionId: null }), this.beginDirectoryProvisional();
8942
8961
  }
@@ -8956,7 +8975,7 @@ class _t {
8956
8975
  }
8957
8976
  getSessionHistoryState() {
8958
8977
  return this.clientRuntime.project("directory", { core: () => {
8959
- const e = this.clientRuntime.engine.getProjection().directory, t = e.queries[x(this.getDirectoryQuery())], i = Xt(this.options.entrySurface).map((l) => this.getDirectoryQuery(l)).map((l) => e.queries[x(l)]).filter((l) => l !== void 0), n = Object.values(e.optimisticEntries).reverse(), r = Co(i), a = new Set(n.flatMap((l) => l.sessionId ? [l.sessionId] : [])), o = [...n.map((l) => l.id), ...r.filter((l) => !a.has(l))], c = Object.fromEntries([
8978
+ const e = this.clientRuntime.engine.getProjection().directory, t = e.queries[x(this.getDirectoryQuery())], i = Xt(this.options.entrySurface).map((l) => this.getDirectoryQuery(l)).map((l) => e.queries[x(l)]).filter((l) => l !== void 0), n = Object.values(e.optimisticEntries).reverse(), r = Mo(i), a = new Set(n.flatMap((l) => l.sessionId ? [l.sessionId] : [])), o = [...n.map((l) => l.id), ...r.filter((l) => !a.has(l))], c = Object.fromEntries([
8960
8979
  ...n.map((l) => [l.id, {
8961
8980
  id: l.id,
8962
8981
  title: null,
@@ -8970,7 +8989,7 @@ class _t {
8970
8989
  isPinned: !1
8971
8990
  }]),
8972
8991
  ...r.filter((l) => !a.has(l)).map((l) => [l, this.toSessionHistoryEntry(e.entities[l])])
8973
- ]), d = qo(i);
8992
+ ]), d = Co(i);
8974
8993
  return {
8975
8994
  key: `${this.options.clientId}:recent`,
8976
8995
  status: d?.status ?? "not_requested",
@@ -9072,7 +9091,7 @@ class _t {
9072
9091
  throw new Error("This interaction is no longer available.");
9073
9092
  if (!r.allowedActions.includes(t))
9074
9093
  throw new Error("This action is not available for the interaction.");
9075
- if (Ha(t) && await this.interactionManager.act(
9094
+ if (Ka(t) && await this.interactionManager.act(
9076
9095
  {
9077
9096
  key: r.id,
9078
9097
  category: r.category,
@@ -9107,7 +9126,7 @@ class _t {
9107
9126
  } });
9108
9127
  }
9109
9128
  createConversationInteractionPort() {
9110
- return Ar({
9129
+ return Tr({
9111
9130
  authority: this.directoryAuthority,
9112
9131
  runtime: () => this.clientRuntime,
9113
9132
  manager: this.interactionManager,
@@ -9140,7 +9159,7 @@ class _t {
9140
9159
  this.rebuildRuntimeInteractions();
9141
9160
  }
9142
9161
  rebuildRuntimeInteractions(e = !0) {
9143
- const t = [], i = this.interactionManager.getConversationInputs(this.state.sessionId), n = this.options.productVariant === "personal" && (this.options.entrySurface === "main_web_chat" || this.options.entrySurface === "automation") ? i === void 0 ? ca(this.state.messages) : i.share?.candidate ?? null : null;
9162
+ const t = [], i = this.interactionManager.getConversationInputs(this.state.sessionId), n = this.options.productVariant === "personal" && (this.options.entrySurface === "main_web_chat" || this.options.entrySurface === "automation") ? i === void 0 ? da(this.state.messages) : i.share?.candidate ?? null : null;
9144
9163
  if (n) {
9145
9164
  const a = {
9146
9165
  key: n.id,
@@ -9277,11 +9296,11 @@ class _t {
9277
9296
  !this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId !== e && this.stopConversation("session_switch"), this.retainNavigatedConversation();
9278
9297
  const i = "conversation:" + this.modelClientScopeId + ":" + j();
9279
9298
  this.directoryConversationScopeId = i, this.lastUserMessagePageUrl = null, this.clientRuntime.engine.dispatch({ type: "model.scope_navigate", clientScopeId: this.modelClientScopeId, sessionId: e }), this.directoryScope.bind(this.modelClientScopeId, this.directoryConversationScopeId, e).then(async () => {
9280
- await this.directoryScope.persist(), this.state.sessionId === e && (t.intents[e]?.observe && this.conversationObservation?.refresh(e).catch((n) => this.handleDirectoryTransportError(n)), this.send({ type: "page.upsert", sessionId: e, page: ee(), model: this.getModel() }));
9299
+ await this.directoryScope.persist(), this.state.sessionId === e && (t.intents[e]?.observe && this.conversationObservation?.refresh(e).catch((n) => this.handleDirectoryTransportError(n)), this.send({ type: "page.upsert", sessionId: e, page: te(), model: this.getModel() }));
9281
9300
  });
9282
9301
  }
9283
9302
  send(e) {
9284
- const t = this.sendNow(X(e));
9303
+ const t = this.sendNow(Y(e));
9285
9304
  return t || (this.queuedClientEvents.push(e), ge(this.options.clientId, this.queuedClientEvents), this.setState({ status: "reconnecting" }), this.scheduleReconnect()), t;
9286
9305
  }
9287
9306
  sendNow(e) {
@@ -9290,7 +9309,7 @@ class _t {
9290
9309
  const t = this.socket;
9291
9310
  if ((e.type === "tool.result" || e.type === "run.stop") && t instanceof D) {
9292
9311
  const i = this.queuedClientEvents.find((n) => "sessionId" in n && n.sessionId === e.sessionId && (e.type === "tool.result" && n.type === "tool.result" && n.callId === e.callId || e.type === "run.stop" && n.type === "run.stop" && n.expectedUserMessageId === e.expectedUserMessageId)) ?? e;
9293
- return this.queuedClientEvents.includes(i) || this.queuedClientEvents.push(i), ge(this.options.clientId, this.queuedClientEvents), this.pendingRetainedCommandDeliveries.has(i) || (this.pendingRetainedCommandDeliveries.add(i), t.sendRetainedCommand(X(i)).then((n) => {
9312
+ return this.queuedClientEvents.includes(i) || this.queuedClientEvents.push(i), ge(this.options.clientId, this.queuedClientEvents), this.pendingRetainedCommandDeliveries.has(i) || (this.pendingRetainedCommandDeliveries.add(i), t.sendRetainedCommand(Y(i)).then((n) => {
9294
9313
  this.pendingRetainedCommandDeliveries.delete(i), n && (this.queuedClientEvents = this.queuedClientEvents.filter((r) => r !== i), ge(this.options.clientId, this.queuedClientEvents));
9295
9314
  })), !0;
9296
9315
  }
@@ -9314,7 +9333,7 @@ class _t {
9314
9333
  this.options.backendUrl
9315
9334
  ) });
9316
9335
  }
9317
- if (t.httpRequest && (!de(t.httpRequest) || t.httpRequest.sessionId !== null && t.httpRequest.sessionId !== i.sessionId) || t.historyRefreshFailure && (t.historyRefreshFailure.consecutiveFailures < 3 || t.historyRefreshFailure.sessionId !== i.sessionId) || t.renderedError && t.renderedError.sessionId !== i.sessionId || t.uiInvariant && t.uiInvariant.current.sessionId !== i.sessionId) return;
9336
+ if (t.httpRequest && (!le(t.httpRequest) || t.httpRequest.sessionId !== null && t.httpRequest.sessionId !== i.sessionId) || t.historyRefreshFailure && (t.historyRefreshFailure.consecutiveFailures < 3 || t.historyRefreshFailure.sessionId !== i.sessionId) || t.renderedError && t.renderedError.sessionId !== i.sessionId || t.uiInvariant && t.uiInvariant.current.sessionId !== i.sessionId) return;
9318
9337
  const n = t.historyRefreshFailure?.episodeId ?? (t.renderedError ? `${t.errorFingerprint}:${t.renderedError.itemId}` : void 0) ?? t.errorFingerprint ?? t.clientMessageId ?? (t.previousPhase && t.nextPhase ? `${t.previousPhase}:${t.nextPhase}:${t.reason ?? "unknown"}` : null);
9319
9338
  if (n) {
9320
9339
  const m = `${e}:${n}:${e === "invalid_state_transition" ? t.reason ?? "unknown" : ""}`;
@@ -9328,7 +9347,7 @@ class _t {
9328
9347
  occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
9329
9348
  source: "web_sdk",
9330
9349
  entrySurface: this.options.entrySurface,
9331
- ...e === "first_response_slow" ? { responseDiagnostics: jo(
9350
+ ...e === "first_response_slow" ? { responseDiagnostics: Lo(
9332
9351
  this,
9333
9352
  this.options.entrySurface,
9334
9353
  i.sessionId,
@@ -9435,7 +9454,7 @@ class _t {
9435
9454
  occurrenceCount: (o?.occurrenceCount ?? 0) + 1,
9436
9455
  maxReconnectAttempt: Math.max(o?.maxReconnectAttempt ?? 0, this.reconnectAttempts),
9437
9456
  connectivity: i,
9438
- sdkVersion: Cs,
9457
+ sdkVersion: Ts,
9439
9458
  stage: "socket_admission",
9440
9459
  ...t,
9441
9460
  connectionAttemptId: n
@@ -9523,9 +9542,9 @@ class _t {
9523
9542
  if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
9524
9543
  return;
9525
9544
  this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
9526
- const e = qc();
9545
+ const e = Cc();
9527
9546
  this.sendNow(
9528
- X({
9547
+ Y({
9529
9548
  type: "starter_prompts.page_context",
9530
9549
  pageUrl: e.pageUrl,
9531
9550
  pageTitle: e.pageTitle,
@@ -9534,13 +9553,13 @@ class _t {
9534
9553
  ) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
9535
9554
  }
9536
9555
  startStarterPromptUrlWatcher() {
9537
- this.locationChangeCleanup || (this.locationChangeCleanup = Cc(() => this.handleStarterPromptUrlChange()));
9556
+ this.locationChangeCleanup || (this.locationChangeCleanup = Mc(() => this.handleStarterPromptUrlChange()));
9538
9557
  }
9539
9558
  handleStarterPromptUrlChange() {
9540
9559
  const e = location.href;
9541
9560
  e !== this.lastStarterPromptPageUrl && (this.lastStarterPromptPageUrl = e, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
9542
9561
  this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
9543
- }, ac));
9562
+ }, cc));
9544
9563
  }
9545
9564
  refreshStarterPromptsForCurrentUrl() {
9546
9565
  this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
@@ -9555,7 +9574,7 @@ class _t {
9555
9574
  const e = [...this.queuedClientEvents];
9556
9575
  this.queuedClientEvents = this.queuedClientEvents.filter((t) => (t.type === "tool.result" || t.type === "run.stop") && this.socket instanceof D), ge(this.options.clientId, this.queuedClientEvents);
9557
9576
  for (let t = 0; t < e.length; t++)
9558
- if (!this.sendNow(X(e[t]))) {
9577
+ if (!this.sendNow(Y(e[t]))) {
9559
9578
  this.queuedClientEvents.unshift(...e.slice(t).filter((i) => !this.queuedClientEvents.includes(i)));
9560
9579
  break;
9561
9580
  }
@@ -9633,12 +9652,12 @@ class _t {
9633
9652
  const t = Di(e.user);
9634
9653
  this.applyAuthenticatedDirectoryIdentity(e.user), this.authenticatedSocket = this.socket, this.directoryObservation.reconnect().catch(() => {
9635
9654
  }), this.conversationObservation?.wake(), this.flushPendingWidgetLifecycleEvents(), this.flushQueuedClientEvents(), this.startHeartbeat();
9636
- const i = Lc(e), n = Object.prototype.hasOwnProperty.call(e, "appearance");
9655
+ const i = $c(e), n = Object.prototype.hasOwnProperty.call(e, "appearance");
9637
9656
  $("web-sdk.agent", "Received auth.ok appearance", {
9638
9657
  hasAppearance: n,
9639
9658
  rawAppearance: e.appearance,
9640
9659
  normalizedAppearance: i
9641
- }), this.runtimeHelperJavascript = $c(e.runtimeHelpers)?.javascript ?? null;
9660
+ }), this.runtimeHelperJavascript = Fc(e.runtimeHelpers)?.javascript ?? null;
9642
9661
  const r = xi(e, "starterPrompts"), a = Object.prototype.hasOwnProperty.call(e, "starterPrompts"), o = e.starterPromptsLoading === !0, c = {
9643
9662
  user: t,
9644
9663
  status: "connected",
@@ -9648,10 +9667,10 @@ class _t {
9648
9667
  type: "runtime.auth_ack",
9649
9668
  connectionAttempt: this.connectionAttemptId,
9650
9669
  entrySurface: this.options.entrySurface
9651
- }), a && r.length === 0 && !o && !Oc() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
9670
+ }), a && r.length === 0 && !o && !Pc() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
9652
9671
  type: "page.upsert",
9653
9672
  sessionId: this.state.sessionId,
9654
- page: ee(),
9673
+ page: te(),
9655
9674
  model: js(this.clientRuntime, this.modelClientScopeId).selectedModel
9656
9675
  });
9657
9676
  return;
@@ -9678,7 +9697,7 @@ class _t {
9678
9697
  if (e.type === "tool.call")
9679
9698
  return e.sessionId !== this.state.sessionId && this.clientRuntime.engine.getState().slices.conversation.sessions[String(e.sessionId)] && !this.options.keepRunsActiveOnSessionNavigation ? void 0 : (this.executeToolCall(e), !0);
9680
9699
  if (e.type === "error") {
9681
- if (e.code === "connection_failed") {
9700
+ if (e = { ...e, message: J(e, "connection_failed", "web_transport").message }, e.code === "connection_failed") {
9682
9701
  this.setState({ status: "reconnecting", lastError: String(e.message), lastErrorCode: e.code });
9683
9702
  return;
9684
9703
  }
@@ -9750,7 +9769,7 @@ class _t {
9750
9769
  });
9751
9770
  }
9752
9771
  updateAccountFallbackFromSession(e) {
9753
- const t = e && typeof e == "object" ? e.metadata : null, i = kr(t);
9772
+ const t = e && typeof e == "object" ? e.metadata : null, i = qr(t);
9754
9773
  if (this.usingPaidCreditFallback !== i && (this.usingPaidCreditFallback = i, !!this.account)) {
9755
9774
  this.account = { ...this.account, usingPaidCreditFallback: i };
9756
9775
  for (const n of this.accountListeners) n(this.getAccount());
@@ -9769,15 +9788,15 @@ class _t {
9769
9788
  }
9770
9789
  if (this.activeBrowserToolCalls.has(i)) return;
9771
9790
  const c = n === "execute_code", d = n === "execute_code_in_browser_tab" && a !== null && typeof a == "object" && a.tabId === "local:current";
9772
- if (!c && !d || !vd(a)) {
9791
+ if (!c && !d || !Id(a)) {
9773
9792
  this.send({
9774
9793
  type: "tool.result",
9775
9794
  sessionId: t,
9776
9795
  callId: i,
9777
9796
  toolName: n,
9778
9797
  summary: r,
9779
- rawInput: X(a),
9780
- rawOutput: X({
9798
+ rawInput: Y(a),
9799
+ rawOutput: Y({
9781
9800
  ok: !1,
9782
9801
  toolName: n,
9783
9802
  error: `Unsupported browser tool: ${n}`
@@ -9792,7 +9811,7 @@ class _t {
9792
9811
  callId: i,
9793
9812
  toolName: n,
9794
9813
  summary: r,
9795
- rawInput: X(a),
9814
+ rawInput: Y(a),
9796
9815
  rawOutput: {
9797
9816
  ok: !1,
9798
9817
  toolName: n,
@@ -9808,7 +9827,7 @@ class _t {
9808
9827
  callId: i,
9809
9828
  toolName: n,
9810
9829
  summary: r,
9811
- rawInput: X(a),
9830
+ rawInput: Y(a),
9812
9831
  rawOutput: null
9813
9832
  },
9814
9833
  startedAtMs: Date.now(),
@@ -9818,7 +9837,7 @@ class _t {
9818
9837
  let l = null, u;
9819
9838
  l = await this.executeRuntimeHelper(), u = await Oi(
9820
9839
  a,
9821
- Rc(e.runtimeContext, this.options.backendUrl)
9840
+ Ac(e.runtimeContext, this.options.backendUrl)
9822
9841
  ).catch((p) => ({
9823
9842
  ok: !1,
9824
9843
  exception: {
@@ -9830,8 +9849,8 @@ class _t {
9830
9849
  callId: i,
9831
9850
  toolName: n,
9832
9851
  summary: a.summary,
9833
- rawInput: X(a),
9834
- rawOutput: X(Fc(u, l))
9852
+ rawInput: Y(a),
9853
+ rawOutput: Y(zc(u, l))
9835
9854
  }), Ni(this.options.clientId, this.activeBrowserToolCalls.values()));
9836
9855
  }
9837
9856
  startPageLifecycleRecovery() {
@@ -9845,10 +9864,10 @@ class _t {
9845
9864
  };
9846
9865
  }
9847
9866
  installSessionBrowserApis() {
9848
- this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = fc();
9867
+ this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = mc();
9849
9868
  }
9850
9869
  cleanupSessionBrowserApis() {
9851
- this.sessionBrowserApisCleanup && (_c(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
9870
+ this.sessionBrowserApisCleanup && (Sc(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
9852
9871
  }
9853
9872
  async executeRuntimeHelper() {
9854
9873
  if (!this.runtimeHelperJavascript?.trim())
@@ -9856,24 +9875,24 @@ class _t {
9856
9875
  const e = await Oi({
9857
9876
  javascript: this.runtimeHelperJavascript
9858
9877
  });
9859
- return e.ok === !1 ? zc(e) : null;
9878
+ return e.ok === !1 ? Hc(e) : null;
9860
9879
  }
9861
9880
  enableNetworkCapture() {
9862
- this.networkCaptureCleanup || (this.networkCaptureCleanup = lc((e) => {
9863
- Rd(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
9881
+ this.networkCaptureCleanup || (this.networkCaptureCleanup = uc((e) => {
9882
+ Ad(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
9864
9883
  }));
9865
9884
  }
9866
9885
  enqueueNetworkEvent(e) {
9867
- this.queuedNetworkEvents.length >= tc || (this.queuedNetworkEvents.push(Sd(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
9886
+ this.queuedNetworkEvents.length >= sc || (this.queuedNetworkEvents.push(Rd(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
9868
9887
  this.networkBatchTimer = null;
9869
9888
  const t = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
9870
9889
  t.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
9871
9890
  type: "network.batch",
9872
9891
  sessionId: this.state.sessionId ?? void 0,
9873
- page: ee(),
9892
+ page: te(),
9874
9893
  events: t
9875
9894
  });
9876
- }, ec)));
9895
+ }, tc)));
9877
9896
  }
9878
9897
  startEmbeddedRecoveryBudget() {
9879
9898
  if (this.options.productVariant !== "customer_embedded" || this.embeddedRecoveryTimer !== null || this.authenticationFailure) return;
@@ -9895,7 +9914,7 @@ class _t {
9895
9914
  this.embeddedRecoveryTimer !== null && window.clearTimeout(this.embeddedRecoveryTimer), this.embeddedRecoveryTimer = null;
9896
9915
  }
9897
9916
  connectionFailureDiagnostic(e, t) {
9898
- const i = e instanceof re ? e.status : e instanceof w && e.code === "unauthorized" ? 401 : e instanceof w && /^[45][0-9]{2}$/.test(e.code) ? Number(e.code) : void 0, n = i !== void 0 && Number.isInteger(i) && i >= 400 && i <= 599 ? i : void 0, a = !(e instanceof w && ["unauthorized", "403", "update_required", "executor_replaced"].includes(e.code)) && Qt(e) && n !== 401 && n !== 403;
9917
+ const i = e instanceof oe ? e.status : e instanceof w && e.code === "unauthorized" ? 401 : e instanceof w && /^[45][0-9]{2}$/.test(e.code) ? Number(e.code) : void 0, n = i !== void 0 && Number.isInteger(i) && i >= 400 && i <= 599 ? i : void 0, a = !(e instanceof w && ["unauthorized", "403", "update_required", "executor_replaced"].includes(e.code)) && Qt(e) && n !== 401 && n !== 403;
9899
9918
  return {
9900
9919
  stage: t,
9901
9920
  ...n !== void 0 ? { httpStatus: n } : {},
@@ -9908,7 +9927,7 @@ class _t {
9908
9927
  return;
9909
9928
  const t = Math.min(
9910
9929
  _s,
9911
- Math.max(cc(this.reconnectAttempts), e)
9930
+ Math.max(dc(this.reconnectAttempts), e)
9912
9931
  );
9913
9932
  this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
9914
9933
  this.reconnectTimer = null, (this.refreshingDefaultCredentials && this.socket instanceof D ? this.refreshDefaultTransportCredentials(this.socket) : this.connect()).catch((n) => {
@@ -10001,13 +10020,13 @@ class _t {
10001
10020
  const c = await this.acquireToken("connect", { forceRefresh: !0 });
10002
10021
  if (this.socket !== e || this.state.status === "closed" || this.clientRuntime.isDisposed)
10003
10022
  throw new w("Conversation authority was retired.", "authority_retired", !0);
10004
- if (!c) throw new re("Pluno token provider did not return a token", !1);
10023
+ if (!c) throw new oe("Pluno token provider did not return a token", !1);
10005
10024
  if (t && c === n) throw new w("Credential did not change.", "unauthorized", !1);
10006
10025
  this.directoryHttp.auth.token = c, a = "bootstrap", this.lastRecoveryStage = a, await this.replaceDefaultTransportCredentials(e), this.reportTransportDiagnostic("auth_refresh_validated", r);
10007
10026
  })().catch((c) => {
10008
10027
  if (this.socket !== e || this.state.status === "closed") throw c;
10009
10028
  if (this.reportTransportDiagnostic("auth_refresh_failed", { ...r, ...this.connectionFailureDiagnostic(c, a) }), this.credentialRecoveryFailure = xe(c), c instanceof w && ["unauthorized", "403", "update_required"].includes(c.code) || !Qt(c)) {
10010
- const d = c instanceof w ? c : new w(c instanceof re ? c.message : "Your session could not be refreshed. Try again.", this.options.productVariant === "customer_embedded" ? "connection_failed" : "unauthorized", !1);
10029
+ const d = c instanceof w ? c : new w(c instanceof oe ? c.message : "Your session could not be refreshed. Try again.", this.options.productVariant === "customer_embedded" ? "connection_failed" : "unauthorized", !1);
10011
10030
  throw this.stopAuthentication(d), d;
10012
10031
  }
10013
10032
  throw this.options.productVariant === "customer_embedded" && this.setState({ status: "reconnecting", lastError: qi, lastErrorCode: "connection_failed" }), this.scheduleReconnect(), c;
@@ -10028,8 +10047,8 @@ class _t {
10028
10047
  const e = this.socket;
10029
10048
  !e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
10030
10049
  this.socket === e && ($("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
10031
- }, Ga));
10032
- }, Va));
10050
+ }, Ja));
10051
+ }, Ga));
10033
10052
  }
10034
10053
  stopHeartbeat() {
10035
10054
  this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
@@ -10065,13 +10084,13 @@ class _t {
10065
10084
  }
10066
10085
  }
10067
10086
  const Yt = /* @__PURE__ */ new WeakMap();
10068
- function lc(s) {
10069
- const e = window.__plunoProductAgentNetworkCapture ?? uc();
10087
+ function uc(s) {
10088
+ const e = window.__plunoProductAgentNetworkCapture ?? hc();
10070
10089
  return e.subscribers.add(s), () => {
10071
10090
  e.subscribers.delete(s), !(e.subscribers.size > 0) && (e.destroy(), window.__plunoProductAgentNetworkCapture === e && delete window.__plunoProductAgentNetworkCapture);
10072
10091
  };
10073
10092
  }
10074
- function uc() {
10093
+ function hc() {
10075
10094
  const s = /* @__PURE__ */ new Set(), e = (p) => {
10076
10095
  s.forEach((f) => {
10077
10096
  try {
@@ -10088,11 +10107,11 @@ function uc() {
10088
10107
  throw g;
10089
10108
  }
10090
10109
  try {
10091
- const g = f instanceof Request ? f : null, b = Id(f, g), v = Nn(m?.headers ?? g?.headers);
10110
+ const g = f instanceof Request ? f : null, b = bd(f, g), v = Nn(m?.headers ?? g?.headers);
10092
10111
  if (!Re(b, v, m?.body)) {
10093
10112
  const S = {
10094
10113
  requestId: ts("fetch"),
10095
- url: ae(b, Jt),
10114
+ url: ce(b, Jt),
10096
10115
  method: (m?.method ?? g?.method ?? "GET").toUpperCase(),
10097
10116
  requestHeaders: v,
10098
10117
  requestBody: ji(m?.body),
@@ -10101,7 +10120,7 @@ function uc() {
10101
10120
  };
10102
10121
  y.then(
10103
10122
  (A) => {
10104
- bd(A, S, h, e).catch(() => {
10123
+ wd(A, S, h, e).catch(() => {
10105
10124
  e({
10106
10125
  ...S,
10107
10126
  responseStatus: A.status,
@@ -10112,7 +10131,7 @@ function uc() {
10112
10131
  (A) => {
10113
10132
  e({
10114
10133
  ...S,
10115
- errorText: ae(A instanceof Error ? A.message : String(A)),
10134
+ errorText: ce(A instanceof Error ? A.message : String(A)),
10116
10135
  durationMs: Date.now() - h
10117
10136
  });
10118
10137
  }
@@ -10126,7 +10145,7 @@ function uc() {
10126
10145
  return Yt.set(this, {
10127
10146
  requestId: ts("xhr"),
10128
10147
  method: String(f ?? "GET").toUpperCase(),
10129
- url: ae(v, Jt),
10148
+ url: ce(v, Jt),
10130
10149
  requestHeaders: {},
10131
10150
  startedAtMs: Date.now(),
10132
10151
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -10143,7 +10162,7 @@ function uc() {
10143
10162
  () => {
10144
10163
  queueMicrotask(() => {
10145
10164
  try {
10146
- const h = Td(this.getAllResponseHeaders());
10165
+ const h = Ed(this.getAllResponseHeaders());
10147
10166
  e({
10148
10167
  requestId: m.requestId,
10149
10168
  url: m.url,
@@ -10153,7 +10172,7 @@ function uc() {
10153
10172
  resourceType: "xhr",
10154
10173
  responseStatus: this.status,
10155
10174
  responseHeaders: h,
10156
- responseBody: _d(this, h),
10175
+ responseBody: Sd(this, h),
10157
10176
  errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
10158
10177
  startedAt: m.startedAt,
10159
10178
  durationMs: Date.now() - m.startedAtMs
@@ -10195,7 +10214,7 @@ function uc() {
10195
10214
  const h = performance.timeOrigin + m.startTime;
10196
10215
  e({
10197
10216
  requestId: ts("resource"),
10198
- url: ae(m.name, Jt),
10217
+ url: ce(m.name, Jt),
10199
10218
  method: "GET",
10200
10219
  resourceType: "resource",
10201
10220
  responseStatus: m.responseStatus,
@@ -10249,27 +10268,27 @@ function Mi(s) {
10249
10268
  const e = typeof s == "function" ? s() : s;
10250
10269
  return e && Object.keys(e).length > 0 ? e : void 0;
10251
10270
  }
10252
- const hc = 5e3, pc = 12e4;
10253
- function fc() {
10271
+ const pc = 5e3, fc = 12e4;
10272
+ function mc() {
10254
10273
  const s = [
10255
- gc(),
10256
- mc()
10274
+ yc(),
10275
+ gc()
10257
10276
  ].filter((e) => typeof e == "function");
10258
10277
  return () => {
10259
10278
  for (const e of s.reverse())
10260
10279
  e();
10261
10280
  };
10262
10281
  }
10263
- function mc() {
10282
+ function gc() {
10264
10283
  return bn(globalThis, "getPageSnapshot", async () => Fs());
10265
10284
  }
10266
- function gc() {
10285
+ function yc() {
10267
10286
  return bn(globalThis, "pageImages", {
10268
- inspectImage: async (e, t) => await yc(e, t)
10287
+ inspectImage: async (e, t) => await vc(e, t)
10269
10288
  });
10270
10289
  }
10271
- async function yc(s, e = {}) {
10272
- const t = wc(e.name), i = await vc(s);
10290
+ async function vc(s, e = {}) {
10291
+ const t = _c(e.name), i = await Ic(s);
10273
10292
  return i.ok ? i.sizeBytes > 8 * 1024 * 1024 ? {
10274
10293
  type: "pluno.pageImages.inspectImage",
10275
10294
  imageAttached: !1,
@@ -10287,15 +10306,15 @@ async function yc(s, e = {}) {
10287
10306
  imageAttachmentError: i.error
10288
10307
  };
10289
10308
  }
10290
- async function vc(s) {
10309
+ async function Ic(s) {
10291
10310
  return s instanceof Blob ? s.type.startsWith("image/") ? s.size === 0 ? { ok: !1, error: "Page image is empty." } : s.size > 8 * 1024 * 1024 ? { ok: !1, error: An } : {
10292
10311
  ok: !0,
10293
10312
  mimeType: s.type,
10294
10313
  sizeBytes: s.size,
10295
- dataUrl: await Sc(s)
10296
- } : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof s != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : Ic(s);
10314
+ dataUrl: await Rc(s)
10315
+ } : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof s != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : bc(s);
10297
10316
  }
10298
- function Ic(s) {
10317
+ function bc(s) {
10299
10318
  if (!s.startsWith("data:") || !s.includes(","))
10300
10319
  return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
10301
10320
  const [e, t] = s.slice(5).split(",", 2), i = e.split(";").map((o) => o.trim()).filter(Boolean), n = i[0] ?? "";
@@ -10306,7 +10325,7 @@ function Ic(s) {
10306
10325
  const r = t.replace(/[ \t\r\n\f]+/g, "");
10307
10326
  if (!/^[A-Za-z0-9+/]*={0,2}$/.test(r))
10308
10327
  return { ok: !1, error: "Page image data URL has invalid base64." };
10309
- const a = bc(r);
10328
+ const a = wc(r);
10310
10329
  return a === null ? { ok: !1, error: "Page image data URL has invalid base64." } : a === 0 ? { ok: !1, error: "Page image is empty." } : {
10311
10330
  ok: !0,
10312
10331
  mimeType: n,
@@ -10314,22 +10333,22 @@ function Ic(s) {
10314
10333
  dataUrl: `data:${n};base64,${r}`
10315
10334
  };
10316
10335
  }
10317
- function bc(s) {
10336
+ function wc(s) {
10318
10337
  if (s.length === 0 || s.length % 4 !== 0)
10319
10338
  return null;
10320
10339
  const e = s.length - s.replace(/=+$/, "").length;
10321
10340
  return e > 2 ? null : s.length / 4 * 3 - e;
10322
10341
  }
10323
- function wc(s) {
10342
+ function _c(s) {
10324
10343
  return (typeof s == "string" ? s.trim() : "") || "Page image";
10325
10344
  }
10326
- function _c(s) {
10345
+ function Sc(s) {
10327
10346
  try {
10328
10347
  s();
10329
10348
  } catch {
10330
10349
  }
10331
10350
  }
10332
- function Sc(s) {
10351
+ function Rc(s) {
10333
10352
  return new Promise((e, t) => {
10334
10353
  const i = new FileReader();
10335
10354
  i.onload = () => {
@@ -10343,7 +10362,7 @@ function Sc(s) {
10343
10362
  }
10344
10363
  async function Oi(s, e) {
10345
10364
  const t = Object.getPrototypeOf(async function() {
10346
- }).constructor, i = s.timeoutMs ?? hc, n = Date.now(), r = [];
10365
+ }).constructor, i = s.timeoutMs ?? pc, n = Date.now(), r = [];
10347
10366
  let a;
10348
10367
  const o = {
10349
10368
  log: console.log,
@@ -10361,7 +10380,7 @@ async function Oi(s, e) {
10361
10380
  a = window.setTimeout(() => u(d), i);
10362
10381
  })
10363
10382
  ]);
10364
- return l === d ? Ac(i) : {
10383
+ return l === d ? Tc(i) : {
10365
10384
  ok: !0,
10366
10385
  result: l,
10367
10386
  console: r,
@@ -10390,7 +10409,7 @@ async function Oi(s, e) {
10390
10409
  e?.deactivate(), a !== void 0 && window.clearTimeout(a), console.log = o.log, console.info = o.info, console.warn = o.warn, console.error = o.error;
10391
10410
  }
10392
10411
  }
10393
- function Rc(s, e) {
10412
+ function Ac(s, e) {
10394
10413
  if (!s || typeof s != "object")
10395
10414
  return;
10396
10415
  const t = s.sandboxFilesToken;
@@ -10400,7 +10419,7 @@ function Rc(s, e) {
10400
10419
  const n = () => {
10401
10420
  if (!i)
10402
10421
  throw new Error("sandboxFiles is only available during browser-code execution");
10403
- }, r = async (o, c) => await ja(`${e.replace(/\/$/, "")}${o}`, c);
10422
+ }, r = async (o, c) => await La(`${e.replace(/\/$/, "")}${o}`, c);
10404
10423
  return {
10405
10424
  value: Object.freeze({
10406
10425
  upload: async (o) => {
@@ -10434,7 +10453,7 @@ function Rc(s, e) {
10434
10453
  }
10435
10454
  };
10436
10455
  }
10437
- function Ac(s) {
10456
+ function Tc(s) {
10438
10457
  return {
10439
10458
  ok: !1,
10440
10459
  exception: {
@@ -10448,20 +10467,20 @@ function Ac(s) {
10448
10467
  }
10449
10468
  };
10450
10469
  }
10451
- function Tc(s) {
10470
+ function Ec(s) {
10452
10471
  return s.replace(/\/+$/, "");
10453
10472
  }
10454
- function Ec(s) {
10473
+ function kc(s) {
10455
10474
  return s === "pluno" ? "scheduled_continuation" : s ?? "user";
10456
10475
  }
10457
- function Yd(s, e = location.origin) {
10476
+ function Zd(s, e = location.origin) {
10458
10477
  return /origin (?:is not allowed|does not match browser origin)/i.test(s) ? `Pluno widget blocked on ${e}: this domain is not allowed. Add ${e} in Pluno under Integration > Domains.` : null;
10459
10478
  }
10460
- function kc(s) {
10479
+ function qc(s) {
10461
10480
  const e = new URL("/api/product-agent/embed/ws", s);
10462
10481
  return e.protocol = e.protocol === "https:" ? "wss:" : "ws:", e.toString();
10463
10482
  }
10464
- function ee() {
10483
+ function te() {
10465
10484
  const s = qn();
10466
10485
  return {
10467
10486
  url: location.href,
@@ -10470,19 +10489,19 @@ function ee() {
10470
10489
  ...s ? { plunoProductAgentUi: s } : {}
10471
10490
  };
10472
10491
  }
10473
- function qc() {
10492
+ function Cc() {
10474
10493
  return {
10475
10494
  pageUrl: location.href,
10476
10495
  pageTitle: document.title,
10477
10496
  htmlContent: Fs()
10478
10497
  };
10479
10498
  }
10480
- function Cc(s) {
10481
- return ht.add(s), Ze || (Ze = Mc()), () => {
10499
+ function Mc(s) {
10500
+ return ht.add(s), Ze || (Ze = Oc()), () => {
10482
10501
  ht.delete(s), ht.size === 0 && (Ze?.(), Ze = null);
10483
10502
  };
10484
10503
  }
10485
- function Mc() {
10504
+ function Oc() {
10486
10505
  const s = () => {
10487
10506
  for (const r of Array.from(ht))
10488
10507
  r();
@@ -10497,7 +10516,7 @@ function Mc() {
10497
10516
  window.history.pushState === i && (window.history.pushState = e), window.history.replaceState === n && (window.history.replaceState = t), window.removeEventListener("popstate", s), window.removeEventListener("hashchange", s);
10498
10517
  };
10499
10518
  }
10500
- function Oc() {
10519
+ function Pc() {
10501
10520
  return qn()?.surface === "browser_extension_sdk_preview";
10502
10521
  }
10503
10522
  function Fs() {
@@ -10513,12 +10532,12 @@ function Fs() {
10513
10532
  );
10514
10533
  for (const h of n.slice(0, 3))
10515
10534
  t("Active overlay", Zt(je(h), e));
10516
- const r = Pc(), a = r ? Zt(je(r), e) : "";
10535
+ const r = xc(), a = r ? Zt(je(r), e) : "";
10517
10536
  t("Main page content", a), t("Additional visible page text", Zt(je(document.body), e));
10518
10537
  const o = s.map(([h, y]) => `${h}:
10519
10538
  ${y}`).join(`
10520
10539
 
10521
- `).trim().slice(0, 12e3), c = xc(n, r).trim(), d = `Simplified DOM outline:
10540
+ `).trim().slice(0, 12e3), c = Dc(n, r).trim(), d = `Simplified DOM outline:
10522
10541
  `, l = `
10523
10542
 
10524
10543
  Visible page text:
@@ -10546,10 +10565,10 @@ function Tn(s) {
10546
10565
  const e = window.getComputedStyle(s);
10547
10566
  return e.display !== "none" && e.visibility !== "hidden" && s.getClientRects().length > 0;
10548
10567
  }
10549
- function Pc() {
10568
+ function xc() {
10550
10569
  return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Tn).sort((s, e) => je(e).length - je(s).length)[0] ?? null;
10551
10570
  }
10552
- function xc(s, e) {
10571
+ function Dc(s, e) {
10553
10572
  const t = /* @__PURE__ */ new Set([
10554
10573
  "main",
10555
10574
  "nav",
@@ -10629,7 +10648,7 @@ function xc(s, e) {
10629
10648
  "data-test",
10630
10649
  "data-qa",
10631
10650
  "data-cy"
10632
- ], d = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: l, priorityTargets: u } = Dc(), p = new Set(s);
10651
+ ], d = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: l, priorityTargets: u } = Uc(), p = new Set(s);
10633
10652
  e && p.add(e);
10634
10653
  let f = 0;
10635
10654
  const m = (v) => {
@@ -10640,8 +10659,8 @@ function xc(s, e) {
10640
10659
  return `${v.tagName.toLowerCase()}|${m(v)}|${_}`;
10641
10660
  }, y = (v, _, S) => {
10642
10661
  const A = (C, H) => {
10643
- const B = C.tagName.toLowerCase(), J = window.getComputedStyle(C), R = l.has(C);
10644
- if (f >= 1e3 && !R || S.has(C) || r.has(B) || C.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || J.display === "none" || J.visibility === "hidden")
10662
+ const B = C.tagName.toLowerCase(), Q = window.getComputedStyle(C), R = l.has(C);
10663
+ if (f >= 1e3 && !R || S.has(C) || r.has(B) || C.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || Q.display === "none" || Q.visibility === "hidden")
10645
10664
  return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
10646
10665
  f += 1;
10647
10666
  const M = m(C), E = kn(C), I = o.has(M) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(B) || B === "a" && C.hasAttribute("href"), k = Array.from(C.children).filter((q) => q instanceof HTMLElement), P = /* @__PURE__ */ new Map();
@@ -10651,13 +10670,13 @@ function xc(s, e) {
10651
10670
  }
10652
10671
  const L = /* @__PURE__ */ new Map(), qe = /* @__PURE__ */ new Map();
10653
10672
  for (const q of k) {
10654
- const N = h(q), le = qe.get(N) ?? 0;
10655
- qe.set(N, le + 1), (P.get(N) ?? 0) > 8 && le >= 6 && !l.has(q) && L.set(N, (L.get(N) ?? 0) + 1);
10673
+ const N = h(q), ue = qe.get(N) ?? 0;
10674
+ qe.set(N, ue + 1), (P.get(N) ?? 0) > 8 && ue >= 6 && !l.has(q) && L.set(N, (L.get(N) ?? 0) + 1);
10656
10675
  }
10657
10676
  const We = /* @__PURE__ */ new Map(), Ws = /* @__PURE__ */ new Set(), Rt = [], Vs = [];
10658
10677
  for (const q of k) {
10659
- const N = h(q), le = P.get(N) ?? 0, Qs = We.get(N) ?? 0;
10660
- if (We.set(N, Qs + 1), le > 8 && Qs >= 6 && !l.has(q)) {
10678
+ const N = h(q), ue = P.get(N) ?? 0, Qs = We.get(N) ?? 0;
10679
+ if (We.set(N, Qs + 1), ue > 8 && Qs >= 6 && !l.has(q)) {
10661
10680
  Ws.has(N) || (Rt.push([`… ${L.get(N) ?? 0} similar siblings omitted`]), Ws.add(N));
10662
10681
  continue;
10663
10682
  }
@@ -10670,9 +10689,9 @@ function xc(s, e) {
10670
10689
  q instanceof HTMLElement && At.push(A(q, H + 1));
10671
10690
  const Ve = [...Vs, ...At], Tt = E.length > 0 || I || Ve.some((q) => q.hasUsefulContent), Gs = Ee(
10672
10691
  [E, ...Ve.map((q) => q.textPreview)].filter(Boolean).join(" ")
10673
- ).slice(0, 180), Wn = C.hasAttribute("contenteditable") && (E.length > 0 || !C.querySelector("[contenteditable]")), Js = d.some((q) => C.hasAttribute(q)) || !!M || Wn, Et = (C.getClientRects().length > 0 || J.display === "contents") && (t.has(B) || Js || R) && (Tt || R) && (!n.has(B) || Tt || Js || R), kt = Et ? 1 : 0, Ce = [];
10692
+ ).slice(0, 180), Wn = C.hasAttribute("contenteditable") && (E.length > 0 || !C.querySelector("[contenteditable]")), Js = d.some((q) => C.hasAttribute(q)) || !!M || Wn, Et = (C.getClientRects().length > 0 || Q.display === "contents") && (t.has(B) || Js || R) && (Tt || R) && (!n.has(B) || Tt || Js || R), kt = Et ? 1 : 0, Ce = [];
10674
10693
  if (Et) {
10675
- const q = Ve.some((le) => le.containsTextElement), N = i.has(B) && !q ? Gs : E;
10694
+ const q = Ve.some((ue) => ue.containsTextElement), N = i.has(B) && !q ? Gs : E;
10676
10695
  Ce.push(En(C, c, a, N.slice(0, 180)));
10677
10696
  }
10678
10697
  for (const q of Rt)
@@ -10683,8 +10702,8 @@ function xc(s, e) {
10683
10702
  qt.length > q.length && q.push("… shadow DOM omitted");
10684
10703
  const N = B.includes("tooltip") || B.includes("popper") || B.includes("loader");
10685
10704
  if (H < 2 && !N) {
10686
- const le = Et ? "#shadow-root" : `${B} #shadow-root`;
10687
- Ce.push(...et([le, ...et(q, 1)], kt));
10705
+ const ue = Et ? "#shadow-root" : `${B} #shadow-root`;
10706
+ Ce.push(...et([ue, ...et(q, 1)], kt));
10688
10707
  } else
10689
10708
  Ce.push(...et(q, kt));
10690
10709
  }
@@ -10699,7 +10718,7 @@ function xc(s, e) {
10699
10718
  `);
10700
10719
  }, g = [], b = Ee(window.getSelection()?.toString() ?? "");
10701
10720
  b && g.push(`--- selected text ---
10702
- ${JSON.stringify(b)}`), u.length > 0 && g.push(Uc(u, t, c, a));
10721
+ ${JSON.stringify(b)}`), u.length > 0 && g.push(Nc(u, t, c, a));
10703
10722
  for (const v of s.slice(0, 3))
10704
10723
  g.push(y(v, "active overlay DOM", /* @__PURE__ */ new Set()));
10705
10724
  if (e && g.push(y(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
@@ -10714,7 +10733,7 @@ function En(s, e, t, i) {
10714
10733
  const n = s.tagName.toLowerCase();
10715
10734
  let r = n;
10716
10735
  const a = s.getAttribute("id");
10717
- a && Nc(a) && (r += `#${a}`);
10736
+ a && Bc(a) && (r += `#${a}`);
10718
10737
  for (const o of e) {
10719
10738
  const c = s.getAttribute(o);
10720
10739
  c && c.length <= 160 && (o !== "role" || !t.has(c)) && (r += `[${o}=${JSON.stringify(c)}]`);
@@ -10727,7 +10746,7 @@ function En(s, e, t, i) {
10727
10746
  s.hasAttribute(o) && (r += `[${o}]`);
10728
10747
  return `${r}${i ? ` ${JSON.stringify(i)}` : ""}`;
10729
10748
  }
10730
- function Dc() {
10749
+ function Uc() {
10731
10750
  const s = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), t = (o, c) => {
10732
10751
  if (!o)
10733
10752
  return;
@@ -10770,7 +10789,7 @@ function Dc() {
10770
10789
  priorityTargets: Array.from(e, ([o, c]) => ({ element: o, labels: Array.from(c) }))
10771
10790
  };
10772
10791
  }
10773
- function Uc(s, e, t, i) {
10792
+ function Nc(s, e, t, i) {
10774
10793
  const n = ["--- active/current elements ---"];
10775
10794
  for (const r of s) {
10776
10795
  const a = [];
@@ -10806,12 +10825,12 @@ function kn(s) {
10806
10825
  Array.from(s.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
10807
10826
  );
10808
10827
  }
10809
- function Nc(s) {
10828
+ function Bc(s) {
10810
10829
  return s.length <= 64 && /^[A-Za-z_][A-Za-z0-9_:.-]*$/.test(s) && !/[a-f0-9]{12,}/i.test(s) && !/:r[0-9a-z]+:/i.test(s);
10811
10830
  }
10812
10831
  function qn() {
10813
10832
  const s = Array.from(document.querySelectorAll(Ei)), e = s.find(
10814
- (r) => typeof r[za] == "string"
10833
+ (r) => typeof r[Ha] == "string"
10815
10834
  );
10816
10835
  if (!(e ?? s[0]))
10817
10836
  return;
@@ -10827,23 +10846,23 @@ function qn() {
10827
10846
  },
10828
10847
  {
10829
10848
  name: "widget_root",
10830
- selector: La,
10849
+ selector: $a,
10831
10850
  description: "Finds Pluno's widget root inside the widget host shadow root."
10832
10851
  },
10833
10852
  {
10834
10853
  name: "widget_panel",
10835
- selector: $a,
10854
+ selector: Fa,
10836
10855
  description: "Finds Pluno's open chat panel inside the widget host shadow root."
10837
10856
  },
10838
10857
  {
10839
10858
  name: "widget_timeline",
10840
- selector: Fa,
10859
+ selector: za,
10841
10860
  description: "Finds Pluno's chat timeline inside the widget host shadow root."
10842
10861
  }
10843
10862
  ]
10844
10863
  };
10845
10864
  }
10846
- function Bc(s) {
10865
+ function jc(s) {
10847
10866
  if (s.runtimeContext !== void 0) {
10848
10867
  if (!s.runtimeContext || typeof s.runtimeContext != "object" || Array.isArray(s.runtimeContext)) return !1;
10849
10868
  const e = s.runtimeContext;
@@ -10871,10 +10890,10 @@ function xi(s, e) {
10871
10890
  const t = s[e];
10872
10891
  return Array.isArray(t) ? t.filter((i) => typeof i == "string" && i.trim().length > 0) : [];
10873
10892
  }
10874
- function jc(s) {
10893
+ function Lc(s) {
10875
10894
  return Array.isArray(s) ? s.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
10876
10895
  }
10877
- function Lc(s) {
10896
+ function $c(s) {
10878
10897
  if (!s || typeof s != "object")
10879
10898
  return null;
10880
10899
  const e = s, t = e.appearance, i = t && typeof t == "object" ? t : e, n = typeof i.accentColor == "string" ? i.accentColor : null, r = i.colorScheme === "dark" ? "dark" : i.colorScheme === "light" ? "light" : null, a = typeof i.fontFamily == "string" && i.fontFamily.trim() ? i.fontFamily : null, o = typeof i.scribbleStyle == "boolean" ? i.scribbleStyle : null;
@@ -10885,13 +10904,13 @@ function Lc(s) {
10885
10904
  ...o !== null ? { scribbleStyle: o } : {}
10886
10905
  };
10887
10906
  }
10888
- function $c(s) {
10907
+ function Fc(s) {
10889
10908
  if (!s || typeof s != "object")
10890
10909
  return null;
10891
10910
  const e = s.javascript;
10892
10911
  return typeof e != "string" || !e.trim() ? null : { javascript: e };
10893
10912
  }
10894
- function Fc(s, e) {
10913
+ function zc(s, e) {
10895
10914
  return e ? s && typeof s == "object" ? {
10896
10915
  ...s,
10897
10916
  helperError: e
@@ -10901,13 +10920,13 @@ function Fc(s, e) {
10901
10920
  helperError: e
10902
10921
  } : s;
10903
10922
  }
10904
- function zc(s) {
10923
+ function Hc(s) {
10905
10924
  if (!s || typeof s != "object")
10906
10925
  return s;
10907
10926
  const e = s;
10908
10927
  return typeof e.exception?.message == "string" ? e.exception.message : typeof e.error == "string" ? e.error : s;
10909
10928
  }
10910
- function Hc() {
10929
+ function Kc() {
10911
10930
  const s = "pluno.productAgent.clientId", e = window.localStorage.getItem(s);
10912
10931
  if (e)
10913
10932
  return e;
@@ -10928,8 +10947,8 @@ function Di(s) {
10928
10947
  avatarUrl: typeof e.avatarUrl == "string" ? e.avatarUrl : null
10929
10948
  } : null;
10930
10949
  }
10931
- function Zd(s, e) {
10932
- return Array.isArray(s) ? Xc(
10950
+ function el(s, e) {
10951
+ return Array.isArray(s) ? Yc(
10933
10952
  s.map((t) => Mn(t, e)).filter((t) => t !== null)
10934
10953
  ) : [];
10935
10954
  }
@@ -10940,7 +10959,7 @@ function Mn(s, e) {
10940
10959
  if (!i || typeof i != "object")
10941
10960
  return null;
10942
10961
  const n = i;
10943
- if (n.hiddenFromTranscript === !0 || pa(n) || n.type === "tab_lifecycle_decision" && n.decision === "keep")
10962
+ if (n.hiddenFromTranscript === !0 || fa(n) || n.type === "tab_lifecycle_decision" && n.decision === "keep")
10944
10963
  return null;
10945
10964
  if (n.type === "assistant_draft")
10946
10965
  return {
@@ -10953,8 +10972,8 @@ function Mn(s, e) {
10953
10972
  ),
10954
10973
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
10955
10974
  ...F(n) !== null ? { displaySequence: F(n) } : {},
10956
- ...Q(n) !== null ? { causalSequence: Q(n) } : {},
10957
- respondsToUserMessageId: ue(n) ?? void 0,
10975
+ ...X(n) !== null ? { causalSequence: X(n) } : {},
10976
+ respondsToUserMessageId: he(n) ?? void 0,
10958
10977
  ...z(n) ? { runId: z(n) } : {},
10959
10978
  dataType: "assistant_draft",
10960
10979
  ...n.steered === !0 ? { steered: !0 } : {}
@@ -10970,8 +10989,8 @@ function Mn(s, e) {
10970
10989
  ),
10971
10990
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
10972
10991
  ...F(n) !== null ? { displaySequence: F(n) } : {},
10973
- ...Q(n) !== null ? { causalSequence: Q(n) } : {},
10974
- respondsToUserMessageId: ue(n) ?? void 0,
10992
+ ...X(n) !== null ? { causalSequence: X(n) } : {},
10993
+ respondsToUserMessageId: he(n) ?? void 0,
10975
10994
  ...z(n) ? { runId: z(n) } : {},
10976
10995
  attachments: Pn(n.attachments, e),
10977
10996
  ...n.steered === !0 ? { steered: !0 } : {}
@@ -10988,7 +11007,7 @@ function Mn(s, e) {
10988
11007
  }), a;
10989
11008
  }
10990
11009
  if (n.type === "function_call_output") {
10991
- const r = da(n.output);
11010
+ const r = la(n.output);
10992
11011
  if (r !== null)
10993
11012
  return {
10994
11013
  id: String(t.id ?? crypto.randomUUID()),
@@ -10996,14 +11015,14 @@ function Mn(s, e) {
10996
11015
  content: "",
10997
11016
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
10998
11017
  ...F(n) !== null ? { displaySequence: F(n) } : {},
10999
- respondsToUserMessageId: ue(n) ?? void 0,
11018
+ respondsToUserMessageId: he(n) ?? void 0,
11000
11019
  ...z(n) ? { runId: z(n) } : {},
11001
11020
  dataType: "function_call_output",
11002
11021
  toolName: Bs,
11003
11022
  callId: De(n) ?? void 0,
11004
11023
  sharePromptAllowed: r
11005
11024
  };
11006
- const a = Sa(n.output);
11025
+ const a = Ra(n.output);
11007
11026
  if (a)
11008
11027
  return {
11009
11028
  id: String(t.id ?? crypto.randomUUID()),
@@ -11011,7 +11030,7 @@ function Mn(s, e) {
11011
11030
  content: "",
11012
11031
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
11013
11032
  ...F(n) !== null ? { displaySequence: F(n) } : {},
11014
- respondsToUserMessageId: ue(n) ?? void 0,
11033
+ respondsToUserMessageId: he(n) ?? void 0,
11015
11034
  ...z(n) ? { runId: z(n) } : {},
11016
11035
  dataType: "scheduled_check_in",
11017
11036
  toolName: _n,
@@ -11019,15 +11038,15 @@ function Mn(s, e) {
11019
11038
  scheduledCheckInId: a.id ?? void 0,
11020
11039
  scheduledCheckInAt: a.dueAt
11021
11040
  };
11022
- const o = Wc(n.output), c = Vc(n.output);
11041
+ const o = Vc(n.output), c = Gc(n.output);
11023
11042
  return o ? {
11024
11043
  id: String(t.id ?? crypto.randomUUID()),
11025
11044
  role: "tool",
11026
11045
  content: `Connect ${o.appName} to continue`,
11027
11046
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
11028
11047
  ...F(n) !== null ? { displaySequence: F(n) } : {},
11029
- ...Q(n) !== null ? { causalSequence: Q(n) } : {},
11030
- respondsToUserMessageId: ue(n) ?? void 0,
11048
+ ...X(n) !== null ? { causalSequence: X(n) } : {},
11049
+ respondsToUserMessageId: he(n) ?? void 0,
11031
11050
  ...z(n) ? { runId: z(n) } : {},
11032
11051
  dataType: "function_call_output",
11033
11052
  toolName: "authenticate_pipedream_app",
@@ -11039,8 +11058,8 @@ function Mn(s, e) {
11039
11058
  content: "Connect WhatsApp to continue",
11040
11059
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
11041
11060
  ...F(n) !== null ? { displaySequence: F(n) } : {},
11042
- ...Q(n) !== null ? { causalSequence: Q(n) } : {},
11043
- respondsToUserMessageId: ue(n) ?? void 0,
11061
+ ...X(n) !== null ? { causalSequence: X(n) } : {},
11062
+ respondsToUserMessageId: he(n) ?? void 0,
11044
11063
  ...z(n) ? { runId: z(n) } : {},
11045
11064
  dataType: "function_call_output",
11046
11065
  toolName: "request_personal_channel_connection",
@@ -11051,11 +11070,11 @@ function Mn(s, e) {
11051
11070
  return n.type === "function_call" || n.type === "tool_call" || n.type === "web_search_call" || n.type === "mcp_call" || n.type === "tab_lifecycle_decision" ? {
11052
11071
  id: String(t.id ?? crypto.randomUUID()),
11053
11072
  role: "tool",
11054
- content: n.type === "mcp_call" ? Kc(n) : Jc(n),
11073
+ content: n.type === "mcp_call" ? Wc(n) : Qc(n),
11055
11074
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
11056
11075
  ...F(n) !== null ? { displaySequence: F(n) } : {},
11057
- ...Q(n) !== null ? { causalSequence: Q(n) } : {},
11058
- respondsToUserMessageId: ue(n) ?? void 0,
11076
+ ...X(n) !== null ? { causalSequence: X(n) } : {},
11077
+ respondsToUserMessageId: he(n) ?? void 0,
11059
11078
  ...z(n) ? { runId: z(n) } : {},
11060
11079
  dataType: String(n.type),
11061
11080
  toolName: n.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof n.name == "string" ? n.name : void 0,
@@ -11065,11 +11084,11 @@ function Mn(s, e) {
11065
11084
  } : n.type === "run_status" || n.type === "run_error" ? n.type === "run_error" && n.stage === "tool_execution" ? null : {
11066
11085
  id: String(t.id ?? crypto.randomUUID()),
11067
11086
  role: "system",
11068
- content: Gc(n),
11087
+ content: Jc(n),
11069
11088
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
11070
11089
  ...F(n) !== null ? { displaySequence: F(n) } : {},
11071
- ...Q(n) !== null ? { causalSequence: Q(n) } : {},
11072
- respondsToUserMessageId: ue(n) ?? void 0,
11090
+ ...X(n) !== null ? { causalSequence: X(n) } : {},
11091
+ respondsToUserMessageId: he(n) ?? void 0,
11073
11092
  ...z(n) ? { runId: z(n) } : {},
11074
11093
  dataType: String(n.type),
11075
11094
  loading: n.steered !== !0 && n.type === "run_status" && (n.status === "running" || n.status === "retrying"),
@@ -11078,11 +11097,11 @@ function Mn(s, e) {
11078
11097
  ...typeof n.securitySettingsUrl == "string" ? { securitySettingsUrl: n.securitySettingsUrl } : {}
11079
11098
  } : null;
11080
11099
  }
11081
- function Kc(s) {
11100
+ function Wc(s) {
11082
11101
  const t = (typeof s.server_label == "string" ? s.server_label : "").replace(/^pipedream_/, "").split(/[_-]+/).filter(Boolean).map((i) => `${i.charAt(0).toUpperCase()}${i.slice(1)}`).join(" ");
11083
11102
  return t ? `🔌 Using ${t}` : "🔌 Using connected integration";
11084
11103
  }
11085
- function Wc(s) {
11104
+ function Vc(s) {
11086
11105
  if (typeof s != "string")
11087
11106
  return null;
11088
11107
  try {
@@ -11099,7 +11118,7 @@ function Wc(s) {
11099
11118
  return null;
11100
11119
  }
11101
11120
  }
11102
- function Vc(s) {
11121
+ function Gc(s) {
11103
11122
  if (typeof s != "string")
11104
11123
  return null;
11105
11124
  try {
@@ -11114,10 +11133,10 @@ function Vc(s) {
11114
11133
  return null;
11115
11134
  }
11116
11135
  }
11117
- function Gc(s) {
11136
+ function Jc(s) {
11118
11137
  return s.type === "run_status" && s.status === "steered" ? "Steered" : typeof s.message == "string" && s.message.trim().length > 0 ? s.message : "";
11119
11138
  }
11120
- function Jc(s) {
11139
+ function Qc(s) {
11121
11140
  if (s.type === "web_search_call") {
11122
11141
  const e = s.action;
11123
11142
  if (e && typeof e == "object") {
@@ -11129,9 +11148,9 @@ function Jc(s) {
11129
11148
  }
11130
11149
  return "🔎 Searching the web";
11131
11150
  }
11132
- return Qc(s);
11151
+ return Xc(s);
11133
11152
  }
11134
- function Qc(s) {
11153
+ function Xc(s) {
11135
11154
  if (typeof s.summary == "string" && s.summary.trim().length > 0)
11136
11155
  return Be(s.summary);
11137
11156
  if (typeof s.arguments == "string")
@@ -11152,7 +11171,7 @@ function De(s) {
11152
11171
  const e = s.callId ?? s.call_id;
11153
11172
  return typeof e == "string" && e ? e : null;
11154
11173
  }
11155
- function Q(s) {
11174
+ function X(s) {
11156
11175
  return typeof s.causalSequence == "number" && Number.isSafeInteger(s.causalSequence) ? s.causalSequence : null;
11157
11176
  }
11158
11177
  function F(s) {
@@ -11166,25 +11185,25 @@ function Ui(s) {
11166
11185
  return typeof t.text == "string" ? t.text : typeof t.content == "string" ? t.content : "";
11167
11186
  }).filter(Boolean).join("") : "";
11168
11187
  }
11169
- function Xc(s) {
11170
- return s.filter((e, t) => zs(e) ? !rd(s, t) && !Zc(s, t) && !id(s, t) && !nd(s, t) : Yc(e) ? e.retryable === !0 && sd(s, t) ? !1 : !td(s, t) : !0);
11171
- }
11172
11188
  function Yc(s) {
11189
+ return s.filter((e, t) => zs(e) ? !od(s, t) && !ed(s, t) && !nd(s, t) && !rd(s, t) : Zc(e) ? e.retryable === !0 && id(s, t) ? !1 : !sd(s, t) : !0);
11190
+ }
11191
+ function Zc(s) {
11173
11192
  return s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.steered !== !0);
11174
11193
  }
11175
11194
  function zs(s) {
11176
11195
  return s.role === "system" && s.dataType === "run_status" && s.loading === !0;
11177
11196
  }
11178
- function Zc(s, e) {
11197
+ function ed(s, e) {
11179
11198
  return s.some(
11180
- (t, i) => i !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) && ed(
11199
+ (t, i) => i !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) && td(
11181
11200
  s,
11182
11201
  e,
11183
11202
  i
11184
11203
  )
11185
11204
  );
11186
11205
  }
11187
- function ed(s, e, t) {
11206
+ function td(s, e, t) {
11188
11207
  const i = s[e], n = s[t];
11189
11208
  if (Ke(i, n))
11190
11209
  return !0;
@@ -11195,7 +11214,7 @@ function ed(s, e, t) {
11195
11214
  return s[r].id === i.respondsToUserMessageId;
11196
11215
  return !1;
11197
11216
  }
11198
- function td(s, e) {
11217
+ function sd(s, e) {
11199
11218
  const t = s[e];
11200
11219
  for (let i = e + 1; i < s.length; i += 1) {
11201
11220
  const n = s[i];
@@ -11204,7 +11223,7 @@ function td(s, e) {
11204
11223
  }
11205
11224
  return !1;
11206
11225
  }
11207
- function sd(s, e) {
11226
+ function id(s, e) {
11208
11227
  const t = s[e];
11209
11228
  if (!t.respondsToUserMessageId)
11210
11229
  return !1;
@@ -11217,19 +11236,19 @@ function sd(s, e) {
11217
11236
  }
11218
11237
  return !1;
11219
11238
  }
11220
- function id(s, e) {
11239
+ function nd(s, e) {
11221
11240
  const t = s[e];
11222
11241
  return s.some(
11223
11242
  (i, n) => n !== e && i.role === "assistant" && Ke(t, i)
11224
11243
  );
11225
11244
  }
11226
- function nd(s, e) {
11245
+ function rd(s, e) {
11227
11246
  const t = s[e];
11228
11247
  return s.some(
11229
11248
  (i, n) => n !== e && i.role === "tool" && Ke(t, i)
11230
11249
  );
11231
11250
  }
11232
- function rd(s, e) {
11251
+ function od(s, e) {
11233
11252
  const t = s[e];
11234
11253
  for (let i = e + 1; i < s.length; i += 1)
11235
11254
  if (zs(s[i]) && Ke(t, s[i]))
@@ -11242,15 +11261,15 @@ function Ke(s, e) {
11242
11261
  function es(s, e) {
11243
11262
  return s && typeof s == "object" && typeof s[e] == "string" ? s[e] : null;
11244
11263
  }
11245
- function od(s, e) {
11264
+ function ad(s, e) {
11246
11265
  try {
11247
- const t = window.localStorage.getItem(`${oc}${s}`);
11266
+ const t = window.localStorage.getItem(`${ac}${s}`);
11248
11267
  if (!t)
11249
11268
  return null;
11250
11269
  const i = JSON.parse(t), n = typeof i.sessionId == "string" ? i.sessionId : null;
11251
11270
  if (e !== void 0 && n !== e)
11252
11271
  return null;
11253
- const r = Array.isArray(i.messages) ? i.messages.map(gd).filter((a) => !!a) : [];
11272
+ const r = Array.isArray(i.messages) ? i.messages.map(yd).filter((a) => !!a) : [];
11254
11273
  return {
11255
11274
  sessionId: n,
11256
11275
  messages: r
@@ -11259,7 +11278,7 @@ function od(s, e) {
11259
11278
  return null;
11260
11279
  }
11261
11280
  }
11262
- function ad(s) {
11281
+ function cd(s) {
11263
11282
  try {
11264
11283
  const e = window.localStorage.getItem(`${Ss}${s}`);
11265
11284
  if (!e)
@@ -11310,19 +11329,19 @@ function Ni(s, e) {
11310
11329
  }
11311
11330
  On(s, e);
11312
11331
  }
11313
- function cd(s) {
11332
+ function dd(s) {
11314
11333
  try {
11315
11334
  const e = `${wt}${s}`, t = window.sessionStorage.getItem(e);
11316
11335
  if (window.sessionStorage.removeItem(e), !t)
11317
11336
  return [];
11318
11337
  const i = JSON.parse(t);
11319
- return Array.isArray(i) ? i.flatMap((n) => ld(n) ? [{
11338
+ return Array.isArray(i) ? i.flatMap((n) => ud(n) ? [{
11320
11339
  ...n.event,
11321
- page: ee(),
11340
+ page: te(),
11322
11341
  rawOutput: {
11323
11342
  pageContextRestarted: !0,
11324
11343
  outcome: "unknown",
11325
- message: dd(location.href),
11344
+ message: ld(location.href),
11326
11345
  currentUrl: location.href,
11327
11346
  console: [],
11328
11347
  metadata: {
@@ -11339,17 +11358,17 @@ function cd(s) {
11339
11358
  return [];
11340
11359
  }
11341
11360
  }
11342
- function dd(s) {
11361
+ function ld(s) {
11343
11362
  return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
11344
11363
  Current URL: ${s}`;
11345
11364
  }
11346
- function ld(s) {
11365
+ function ud(s) {
11347
11366
  if (!s || typeof s != "object")
11348
11367
  return !1;
11349
11368
  const e = s, t = e.event;
11350
11369
  return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" && Hs(t) && t.type === "tool.result";
11351
11370
  }
11352
- function ud(s, e) {
11371
+ function hd(s, e) {
11353
11372
  const t = new Set(
11354
11373
  s.flatMap((i) => i.type === "tool.result" ? [i.callId] : [])
11355
11374
  );
@@ -11358,7 +11377,7 @@ function ud(s, e) {
11358
11377
  ...e.filter((i) => !t.has(i.callId))
11359
11378
  ];
11360
11379
  }
11361
- function hd(s) {
11380
+ function pd(s) {
11362
11381
  try {
11363
11382
  window.sessionStorage.removeItem(`${wt}${s}`);
11364
11383
  } catch {
@@ -11395,9 +11414,9 @@ function xn(s, e) {
11395
11414
  } : s;
11396
11415
  }
11397
11416
  function Dn(s) {
11398
- return s.type || md(s.name) || "application/octet-stream";
11417
+ return s.type || gd(s.name) || "application/octet-stream";
11399
11418
  }
11400
- function pd(s) {
11419
+ function fd(s) {
11401
11420
  Un({
11402
11421
  name: s.name,
11403
11422
  mimeType: Dn(s),
@@ -11405,21 +11424,21 @@ function pd(s) {
11405
11424
  });
11406
11425
  }
11407
11426
  function Un(s) {
11408
- const e = fd(s.name), t = s.mimeType.trim().toLowerCase();
11409
- if (!ic.has(`${e}:${t}`))
11427
+ const e = md(s.name), t = s.mimeType.trim().toLowerCase();
11428
+ if (!nc.has(`${e}:${t}`))
11410
11429
  throw new Error("This attachment type is not supported by the embedded model provider");
11411
11430
  if (s.sizeBytes <= 0 || s.sizeBytes >= Rn)
11412
11431
  throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
11413
11432
  }
11414
- function fd(s) {
11433
+ function md(s) {
11415
11434
  const e = s.trim().toLowerCase(), t = e.lastIndexOf(".");
11416
11435
  return t >= 0 ? e.slice(t) : "";
11417
11436
  }
11418
- function md(s) {
11437
+ function gd(s) {
11419
11438
  const e = s.toLowerCase();
11420
11439
  return e.endsWith(".png") ? "image/png" : e.endsWith(".jpg") || e.endsWith(".jpeg") ? "image/jpeg" : e.endsWith(".webp") ? "image/webp" : e.endsWith(".gif") ? "image/gif" : e.endsWith(".pdf") ? "application/pdf" : null;
11421
11440
  }
11422
- function gd(s) {
11441
+ function yd(s) {
11423
11442
  if (!s || typeof s != "object")
11424
11443
  return null;
11425
11444
  const e = s;
@@ -11437,11 +11456,11 @@ function gd(s) {
11437
11456
  scheduledCheckInId: typeof e.scheduledCheckInId == "string" ? e.scheduledCheckInId : void 0,
11438
11457
  scheduledCheckInAt: typeof e.scheduledCheckInAt == "string" ? e.scheduledCheckInAt : void 0,
11439
11458
  securitySettingsUrl: typeof e.securitySettingsUrl == "string" ? e.securitySettingsUrl : void 0,
11440
- attachments: Pn(e.attachments)?.map(yd),
11459
+ attachments: Pn(e.attachments)?.map(vd),
11441
11460
  loading: typeof e.loading == "boolean" ? e.loading : void 0
11442
11461
  };
11443
11462
  }
11444
- function yd(s) {
11463
+ function vd(s) {
11445
11464
  const {
11446
11465
  dataUrl: e,
11447
11466
  objectUrl: t,
@@ -11451,7 +11470,7 @@ function yd(s) {
11451
11470
  } = s;
11452
11471
  return r;
11453
11472
  }
11454
- function ue(s) {
11473
+ function he(s) {
11455
11474
  const e = s.respondsToUserMessageId;
11456
11475
  return typeof e == "string" && e ? e : null;
11457
11476
  }
@@ -11459,9 +11478,9 @@ function z(s) {
11459
11478
  const e = s.runId;
11460
11479
  return typeof e == "string" && e ? e : null;
11461
11480
  }
11462
- function vd(s) {
11481
+ function Id(s) {
11463
11482
  const e = s?.timeoutMs;
11464
- return !!s && typeof s == "object" && typeof s.summary == "string" && typeof s.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <= pc);
11483
+ return !!s && typeof s == "object" && typeof s.summary == "string" && typeof s.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <= fc);
11465
11484
  }
11466
11485
  function Nn(s) {
11467
11486
  const e = {};
@@ -11475,22 +11494,22 @@ function Nn(s) {
11475
11494
  return e;
11476
11495
  }
11477
11496
  function Ks(s, e) {
11478
- return Hn(s) ? St : ae(gt(e), nc);
11497
+ return Hn(s) ? St : ce(gt(e), rc);
11479
11498
  }
11480
- function Id(s, e) {
11499
+ function bd(s, e) {
11481
11500
  return typeof s == "string" ? s : s instanceof URL ? s.toString() : e?.url ?? "";
11482
11501
  }
11483
- async function bd(s, e, t, i) {
11502
+ async function wd(s, e, t, i) {
11484
11503
  const n = Nn(s.headers);
11485
11504
  i({
11486
11505
  ...e,
11487
11506
  responseStatus: s.status,
11488
11507
  responseHeaders: n,
11489
- responseBody: await wd(s),
11508
+ responseBody: await _d(s),
11490
11509
  durationMs: Date.now() - t
11491
11510
  });
11492
11511
  }
11493
- async function wd(s) {
11512
+ async function _d(s) {
11494
11513
  if (!Bn(s.headers))
11495
11514
  return;
11496
11515
  let e = null, t = null;
@@ -11500,7 +11519,7 @@ async function wd(s) {
11500
11519
  const i = new Promise((o) => {
11501
11520
  t = window.setTimeout(() => {
11502
11521
  e?.cancel(), o("timeout");
11503
- }, rc);
11522
+ }, oc);
11504
11523
  }), n = new TextDecoder();
11505
11524
  let r = "", a = 0;
11506
11525
  for (; ; ) {
@@ -11509,10 +11528,10 @@ async function wd(s) {
11509
11528
  return;
11510
11529
  const { done: c, value: d } = o;
11511
11530
  if (c)
11512
- return ae(r + n.decode());
11531
+ return ce(r + n.decode());
11513
11532
  const l = Ls - a;
11514
11533
  if (d.byteLength > l)
11515
- return r += n.decode(d.subarray(0, Math.max(l, 0)), { stream: !0 }), e.cancel(), `${ae(r)}... [truncated]`;
11534
+ return r += n.decode(d.subarray(0, Math.max(l, 0)), { stream: !0 }), e.cancel(), `${ce(r)}... [truncated]`;
11516
11535
  a += d.byteLength, r += n.decode(d, { stream: !0 });
11517
11536
  }
11518
11537
  } catch {
@@ -11522,20 +11541,20 @@ async function wd(s) {
11522
11541
  t !== null && window.clearTimeout(t);
11523
11542
  }
11524
11543
  }
11525
- function _d(s, e) {
11544
+ function Sd(s, e) {
11526
11545
  if (Bn(new Headers(e)))
11527
11546
  try {
11528
- return s.responseType === "" || s.responseType === "text" ? ae(s.responseText ?? "") : void 0;
11547
+ return s.responseType === "" || s.responseType === "text" ? ce(s.responseText ?? "") : void 0;
11529
11548
  } catch {
11530
11549
  return;
11531
11550
  }
11532
11551
  }
11533
11552
  function ji(s) {
11534
11553
  if (typeof s == "string")
11535
- return ae(s);
11554
+ return ce(s);
11536
11555
  }
11537
- function Sd(s) {
11538
- return X({
11556
+ function Rd(s) {
11557
+ return Y({
11539
11558
  ...s,
11540
11559
  requestBody: Li(s.requestBody),
11541
11560
  responseBody: Li(s.responseBody)
@@ -11548,7 +11567,7 @@ function Li(s) {
11548
11567
  if (!e.startsWith("{") && !e.startsWith("["))
11549
11568
  return gt(s);
11550
11569
  try {
11551
- return JSON.stringify(X(JSON.parse(s)));
11570
+ return JSON.stringify(Y(JSON.parse(s)));
11552
11571
  } catch {
11553
11572
  return gt(s);
11554
11573
  }
@@ -11560,7 +11579,7 @@ function Bn(s) {
11560
11579
  return t !== null && Number.isInteger(i) && i >= 0 && i <= Ls && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
11561
11580
  }
11562
11581
  function Re(s, e = {}, t) {
11563
- if (Ad(t))
11582
+ if (Td(t))
11564
11583
  return !0;
11565
11584
  const i = Object.entries(e).find(([n]) => n.toLowerCase() === "content-type")?.[1]?.toLowerCase();
11566
11585
  if (i?.includes("multipart/form-data") || i?.includes("application/octet-stream"))
@@ -11575,7 +11594,7 @@ function Re(s, e = {}, t) {
11575
11594
  return !0;
11576
11595
  }
11577
11596
  }
11578
- function Rd(s, e) {
11597
+ function Ad(s, e) {
11579
11598
  if (Re(s))
11580
11599
  return !0;
11581
11600
  try {
@@ -11585,10 +11604,10 @@ function Rd(s, e) {
11585
11604
  return !0;
11586
11605
  }
11587
11606
  }
11588
- function Ad(s) {
11607
+ function Td(s) {
11589
11608
  return s instanceof FormData || s instanceof Blob || s instanceof ArrayBuffer || ArrayBuffer.isView(s) || typeof ReadableStream < "u" && s instanceof ReadableStream;
11590
11609
  }
11591
- function Td(s) {
11610
+ function Ed(s) {
11592
11611
  const e = {};
11593
11612
  for (const t of s.trim().split(/[\r\n]+/)) {
11594
11613
  const i = t.indexOf(":");
@@ -11601,7 +11620,7 @@ function Td(s) {
11601
11620
  }
11602
11621
  return e;
11603
11622
  }
11604
- function ae(s, e = Ls) {
11623
+ function ce(s, e = Ls) {
11605
11624
  return s.length <= e ? s : `${s.slice(0, e)}... [truncated ${s.length - e} chars]`;
11606
11625
  }
11607
11626
  function ts(s) {
@@ -11614,34 +11633,34 @@ class jn extends Error {
11614
11633
  status;
11615
11634
  code;
11616
11635
  }
11617
- async function Ed(s, e) {
11636
+ async function kd(s, e) {
11618
11637
  let t = null;
11619
11638
  for (let i = 0; i < Ci; i += 1)
11620
11639
  try {
11621
11640
  return await s();
11622
11641
  } catch (n) {
11623
- if (t = n, i >= Ci - 1 || !qd(n))
11642
+ if (t = n, i >= Ci - 1 || !Cd(n))
11624
11643
  throw n;
11625
- await kd(i);
11644
+ await qd(i);
11626
11645
  }
11627
11646
  throw t instanceof Error ? t : new Error(e);
11628
11647
  }
11629
- function kd(s) {
11648
+ function qd(s) {
11630
11649
  return new Promise((e) => {
11631
- window.setTimeout(e, sc[s] ?? 0);
11650
+ window.setTimeout(e, ic[s] ?? 0);
11632
11651
  });
11633
11652
  }
11634
- function qd(s) {
11635
- return s instanceof jn ? Cd(s.status) : s instanceof TypeError;
11636
- }
11637
11653
  function Cd(s) {
11638
- return s === 408 || s === 409 || s === 429 || s >= 500;
11654
+ return s instanceof jn ? Md(s.status) : s instanceof TypeError;
11639
11655
  }
11640
11656
  function Md(s) {
11657
+ return s === 408 || s === 409 || s === 429 || s >= 500;
11658
+ }
11659
+ function Od(s) {
11641
11660
  return s === 401 || s === 403;
11642
11661
  }
11643
- const St = "[REDACTED_SECRET]", ce = "[REDACTED_TOKEN]", Od = "[REDACTED_SIGNED_URL]", Pd = 20, xd = /^(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, Ln = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, $n = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, Fn = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, zn = /\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, Dd = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Ud = /\bhttps?:\/\/[^\s"'<>]+/gi, Nd = /[),.;\]]+$/;
11644
- function X(s) {
11662
+ const St = "[REDACTED_SECRET]", de = "[REDACTED_TOKEN]", Pd = "[REDACTED_SIGNED_URL]", xd = 20, Dd = /^(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, Ln = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, $n = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, Fn = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, zn = /\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, Ud = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Nd = /\bhttps?:\/\/[^\s"'<>]+/gi, Bd = /[),.;\]]+$/;
11663
+ function Y(s) {
11645
11664
  return mt(s, 0, /* @__PURE__ */ new WeakSet());
11646
11665
  }
11647
11666
  function mt(s, e, t) {
@@ -11649,7 +11668,7 @@ function mt(s, e, t) {
11649
11668
  return s.startsWith("data:image/") || s.startsWith("data:application/pdf;") ? s : gt(s);
11650
11669
  if (s === null || typeof s != "object")
11651
11670
  return s;
11652
- if (e >= Pd)
11671
+ if (e >= xd)
11653
11672
  return "[REDACTED_MAX_DEPTH]";
11654
11673
  if (t.has(s))
11655
11674
  return "[REDACTED_CIRCULAR]";
@@ -11657,40 +11676,40 @@ function mt(s, e, t) {
11657
11676
  return s.map((n) => mt(n, e + 1, t));
11658
11677
  const i = {};
11659
11678
  for (const [n, r] of Object.entries(s))
11660
- n === "pageContent" ? i[n] = r : Hn(n) ? i[n] = St : i[n] = n.toLowerCase() === "url" ? Bd(r) : mt(r, e + 1, t);
11679
+ n === "pageContent" ? i[n] = r : Hn(n) ? i[n] = St : i[n] = n.toLowerCase() === "url" ? jd(r) : mt(r, e + 1, t);
11661
11680
  return i;
11662
11681
  }
11663
11682
  function Hn(s) {
11664
11683
  const e = s.replace(/[^a-z0-9]/gi, "").toLowerCase();
11665
11684
  return e.includes("authorization") || e.includes("cookie") || e.includes("password") || e.includes("passwd") || e === "pwd" || e.includes("secret") || e === "token" || e.endsWith("token") || e.includes("apikey") || e.includes("csrf") || e.includes("xsrf") || e === "jwt" || e === "session" || e === "signature" || e.includes("privatekey");
11666
11685
  }
11667
- function Bd(s) {
11686
+ function jd(s) {
11668
11687
  return typeof s == "string" ? Kn(s) : mt(s, 0, /* @__PURE__ */ new WeakSet());
11669
11688
  }
11670
11689
  function Kn(s) {
11671
11690
  try {
11672
11691
  const e = new URL(s, location.href);
11673
11692
  for (const t of Array.from(e.searchParams.keys()))
11674
- xd.test(t) && e.searchParams.set(t, ce);
11675
- return e.username && (e.username = ce), e.password && (e.password = ce), e.toString();
11693
+ Dd.test(t) && e.searchParams.set(t, de);
11694
+ return e.username && (e.username = de), e.password && (e.password = de), e.toString();
11676
11695
  } catch {
11677
- return jd(s);
11696
+ return Ld(s);
11678
11697
  }
11679
11698
  }
11680
11699
  function gt(s) {
11681
- return s.replace(Dd, Od).replace(Ud, Ld).replace(Ln, `Bearer ${ce}`).replace($n, `Basic ${ce}`).replace(Fn, ce).replace(zn, (e, t) => `${t}: ${St}`);
11682
- }
11683
- function jd(s) {
11684
- return s.replace(Ln, `Bearer ${ce}`).replace($n, `Basic ${ce}`).replace(Fn, ce).replace(zn, (e, t) => `${t}: ${St}`);
11700
+ return s.replace(Ud, Pd).replace(Nd, $d).replace(Ln, `Bearer ${de}`).replace($n, `Basic ${de}`).replace(Fn, de).replace(zn, (e, t) => `${t}: ${St}`);
11685
11701
  }
11686
11702
  function Ld(s) {
11687
- const e = s.match(Nd)?.[0] ?? "", t = e ? s.slice(0, -e.length) : s;
11703
+ return s.replace(Ln, `Bearer ${de}`).replace($n, `Basic ${de}`).replace(Fn, de).replace(zn, (e, t) => `${t}: ${St}`);
11704
+ }
11705
+ function $d(s) {
11706
+ const e = s.match(Bd)?.[0] ?? "", t = e ? s.slice(0, -e.length) : s;
11688
11707
  return `${Kn(t)}${e}`;
11689
11708
  }
11690
- const el = Object.freeze({
11709
+ const tl = Object.freeze({
11691
11710
  init: (s) => _t.init(s)
11692
11711
  });
11693
- function tl(s) {
11712
+ function sl(s) {
11694
11713
  return _t.init(s);
11695
11714
  }
11696
11715
  function $i(s) {
@@ -11714,36 +11733,36 @@ function Fi(s) {
11714
11733
  }
11715
11734
  export {
11716
11735
  Ei as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
11717
- $a as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
11718
- La as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
11719
- Fa as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
11720
- qr as PRODUCT_AGENT_AUTH_RECONNECTING_ERROR_MESSAGE,
11721
- Xd as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
11722
- el as PlunoProductAgent,
11723
- Ca as ProductAgentInteractionManager,
11736
+ Fa as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
11737
+ $a as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
11738
+ za as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
11739
+ Cr as PRODUCT_AGENT_AUTH_RECONNECTING_ERROR_MESSAGE,
11740
+ Yd as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
11741
+ tl as PlunoProductAgent,
11742
+ Ma as ProductAgentInteractionManager,
11724
11743
  ri as ProductAgentQueryController,
11725
- Qd as ProductAgentRemoteRuntimeClient,
11744
+ Xd as ProductAgentRemoteRuntimeClient,
11726
11745
  _t as ProductAgentSessionEngine,
11727
- Wd as ProductAgentSessionHistoryManager,
11728
- Vd as ProductAgentTaskPageTitleController,
11729
- re as ProductAgentTokenProviderError,
11730
- cc as calculateReconnectDelay,
11731
- Fd as canSubmitPersonalProductAgentMessage,
11732
- Kd as createLocalStorageInteractionDecisionStorage,
11746
+ Vd as ProductAgentSessionHistoryManager,
11747
+ Gd as ProductAgentTaskPageTitleController,
11748
+ oe as ProductAgentTokenProviderError,
11749
+ dc as calculateReconnectDelay,
11750
+ zd as canSubmitPersonalProductAgentMessage,
11751
+ Wd as createLocalStorageInteractionDecisionStorage,
11733
11752
  st as createProductAgentQueryState,
11734
- tl as createProductAgentRuntime,
11735
- Gd as createProductAgentTaskPageTitleDocument,
11736
- el as default,
11737
- Da as formatProductAgentTaskPageTitle,
11738
- Yd as getProductAgentOriginAccessErrorMessage,
11739
- Cr as isProductAgentAuthReconnectError,
11740
- Jd as isProductAgentRuntimeCommand,
11741
- Tr as mergeProductAgentEntityPages,
11753
+ sl as createProductAgentRuntime,
11754
+ Jd as createProductAgentTaskPageTitleDocument,
11755
+ tl as default,
11756
+ Ua as formatProductAgentTaskPageTitle,
11757
+ Zd as getProductAgentOriginAccessErrorMessage,
11758
+ Mr as isProductAgentAuthReconnectError,
11759
+ Qd as isProductAgentRuntimeCommand,
11760
+ Er as mergeProductAgentEntityPages,
11742
11761
  it as normalizeProductAgentEntityPage,
11743
- Zd as normalizeProductAgentSessionItems,
11744
- Ma as readLocalStorageInteractionDecisions,
11745
- zd as resolveProductAgentComposerAction,
11746
- $d as resolveProductAgentWidgetPresentation,
11747
- Er as selectProductAgentQueryEntities,
11748
- pd as validateProductAgentProviderInputFile
11762
+ el as normalizeProductAgentSessionItems,
11763
+ Oa as readLocalStorageInteractionDecisions,
11764
+ Hd as resolveProductAgentComposerAction,
11765
+ Fd as resolveProductAgentWidgetPresentation,
11766
+ kr as selectProductAgentQueryEntities,
11767
+ fd as validateProductAgentProviderInputFile
11749
11768
  };