@pluno/product-agent-web 0.1.256 → 0.1.258

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,4 @@
1
- function je(s) {
1
+ function Le(s) {
2
2
  return {
3
3
  key: s,
4
4
  status: "not_requested",
@@ -35,19 +35,19 @@ function oe(s) {
35
35
  function pt(s) {
36
36
  return "revision" in s.data ? s.data.revision : null;
37
37
  }
38
- function Le(s) {
38
+ function $e(s) {
39
39
  if (s === null || typeof s == "string" || typeof s == "boolean") return !0;
40
40
  if (typeof s == "number") return Number.isFinite(s);
41
- if (Array.isArray(s)) return s.every(Le);
41
+ if (Array.isArray(s)) return s.every($e);
42
42
  if (typeof s != "object") return !1;
43
43
  const e = Object.getPrototypeOf(s);
44
- return e !== Object.prototype && e !== null ? !1 : Object.values(s).every(Le);
44
+ return e !== Object.prototype && e !== null ? !1 : Object.values(s).every($e);
45
45
  }
46
46
  function ne(s) {
47
47
  return s !== null && typeof s == "object" && !Object.isFrozen(s) && (Object.values(s).forEach(ne), Object.freeze(s)), s;
48
48
  }
49
49
  function Y(s) {
50
- if (!Le(s)) throw new Error("Conversation inputs must be JSON-safe values.");
50
+ if (!$e(s)) throw new Error("Conversation inputs must be JSON-safe values.");
51
51
  return JSON.parse(JSON.stringify(s));
52
52
  }
53
53
  function Hi(s = "", e = 0) {
@@ -63,7 +63,7 @@ function ss(s) {
63
63
  executionByUserMessage: {},
64
64
  followUps: [],
65
65
  followUpsVersion: -1,
66
- queries: { current: je(`${s}:current`), history: je(`${s}:history`) }
66
+ queries: { current: Le(`${s}:current`), history: Le(`${s}:history`) }
67
67
  };
68
68
  }
69
69
  function Ki(s) {
@@ -172,7 +172,7 @@ function as(s, e) {
172
172
  }
173
173
  return ne(i);
174
174
  }
175
- function Ve(s) {
175
+ function Ge(s) {
176
176
  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
177
  }
178
178
  function Jn(s, e, t, i) {
@@ -265,7 +265,7 @@ function Jn(s, e, t, i) {
265
265
  if (!o || o.cancelled || o.delivery === "failed") return { state: s, effects: r };
266
266
  const c = Y({ pageContent: e.pageContent, sessionTabs: e.sessionTabs });
267
267
  if (o.contextPreparation !== null) {
268
- if (Ve(o.contextPreparation) !== Ve(c)) throw new Error("Prepared submission context cannot change.");
268
+ if (Ge(o.contextPreparation) !== Ge(c)) throw new Error("Prepared submission context cannot change.");
269
269
  return { state: s, effects: r };
270
270
  }
271
271
  n = { ...s, submissions: { ...s.submissions, [e.userMessageId]: { ...o, contextPreparation: c } } };
@@ -276,7 +276,7 @@ function Jn(s, e, t, i) {
276
276
  const { type: o, authorityId: c, generation: d, prepareContext: l, ...u } = e, p = s.submissions[e.userMessageId];
277
277
  if (p) {
278
278
  const { contextPreparation: b, requestedModel: v, sessionId: _, delivery: S, cancelled: A, cancellationReason: C, error: H, executionVersion: B, ...J } = p;
279
- if (Ve(J) !== Ve(u)) throw new Error("User-message identity cannot be reused with different input.");
279
+ if (Ge(J) !== Ge(u)) throw new Error("User-message identity cannot be reused with different input.");
280
280
  return { state: s, effects: r };
281
281
  }
282
282
  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 = {
@@ -343,7 +343,7 @@ function Jn(s, e, t, i) {
343
343
  const p = d[u.lane];
344
344
  d[u.lane] = { ...p, requestId: null, status: p.data === null ? "not_requested" : "ready" };
345
345
  }
346
- d.history = je(d.history.key), n = { ...s, requests: c, sessions: { ...s.sessions, [e.sessionId]: { ...o, queries: d } } };
346
+ d.history = Le(d.history.key), n = { ...s, requests: c, sessions: { ...s.sessions, [e.sessionId]: { ...o, queries: d } } };
347
347
  break;
348
348
  }
349
349
  case "conversation.snapshot": {
@@ -855,11 +855,11 @@ function Zn(s) {
855
855
  }
856
856
  const er = Math.random().toString(36).slice(2);
857
857
  let tr = 0;
858
- const ei = () => `timing:${er}:${++tr}`, Ge = (s) => typeof s == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(s);
859
- function Fe(s) {
858
+ const ei = () => `timing:${er}:${++tr}`, Je = (s) => typeof s == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(s);
859
+ function ze(s) {
860
860
  if (!s || typeof s != "object") return !1;
861
861
  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) && Ge(e.spanId) && Ge(e.requestId) && (e.clientMessageId === null || Ge(e.clientMessageId)) && (e.sessionId === null || Ge(e.sessionId)) && typeof e.occurredAt == "string" && e.occurredAt.length <= 40 && Number.isFinite(Date.parse(e.occurredAt)) && Number.isSafeInteger(e.durationMs) && e.durationMs >= 0;
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;
863
863
  }
864
864
  function G(s, e) {
865
865
  if (!s) return {
@@ -877,7 +877,7 @@ function G(s, e) {
877
877
  durationMs: Math.max(0, Math.round(performance.now() - a)),
878
878
  ...r === "failed" ? { failureCategory: Zn(c) } : {}
879
879
  };
880
- s && Fe(d) && Promise.resolve().then(() => s(d)).catch(() => {
880
+ s && ze(d) && Promise.resolve().then(() => s(d)).catch(() => {
881
881
  });
882
882
  };
883
883
  return {
@@ -902,7 +902,7 @@ function sr(s) {
902
902
  });
903
903
  };
904
904
  return (n) => {
905
- Fe(n) && (JSON.stringify([...e, n]).length > 2800 && i(), e.push(n), e.length === 8 ? i() : t ??= setTimeout(i, 250));
905
+ ze(n) && (JSON.stringify([...e, n]).length > 2800 && i(), e.push(n), e.length === 8 ? i() : t ??= setTimeout(i, 250));
906
906
  };
907
907
  }
908
908
  function ir(s) {
@@ -982,7 +982,9 @@ function nr(s, e, t, i) {
982
982
  sessionId: n.sessionId
983
983
  }).mark("acceptance_applied");
984
984
  }
985
- const O = (s) => typeof s == "string" && /^[a-zA-Z0-9:_.-]{1,160}$/.test(s) ? s : null;
985
+ const Ts = "0.1.258", Ji = {
986
+ version: Ts
987
+ }, O = (s) => typeof s == "string" && /^[a-zA-Z0-9:_.-]{1,160}$/.test(s) ? s : null;
986
988
  function rr(s) {
987
989
  if (!s || typeof s != "object") return !1;
988
990
  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");
@@ -1011,46 +1013,43 @@ function or(s, e, t) {
1011
1013
  projectionReady: typeof n?.projection_ready == "boolean" ? n.projection_ready : null
1012
1014
  };
1013
1015
  }
1014
- function Ts(s) {
1016
+ function Es(s) {
1015
1017
  if (!s || typeof s != "object") return !1;
1016
1018
  const e = s;
1017
1019
  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
1020
  }
1019
- const ti = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"], Es = (s) => typeof s == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(s), et = (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) {
1021
+ 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), 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));
1022
+ function qs(s) {
1021
1023
  if (!s || typeof s != "object") return !1;
1022
1024
  const e = s;
1023
- return Object.keys(s).every((t) => ["sessionId", "itemId", "userMessageId", "createdAt", "runId", "retryable"].includes(t)) && et(e.sessionId) && Es(e.itemId) && et(e.userMessageId) && (e.retryable === void 0 || typeof e.retryable == "boolean") && et(e.runId) && (e.createdAt === null || ar(e.createdAt));
1025
+ 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 || ar(e.createdAt));
1024
1026
  }
1025
1027
  function cr(s) {
1026
1028
  if (!s || typeof s != "object") return !1;
1027
1029
  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));
1030
+ 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 || rr(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
1031
  }
1030
- function qs(s) {
1032
+ function Cs(s) {
1031
1033
  if (!s || typeof s != "object" || Object.keys(s).some((i) => i !== "before" && i !== "current")) return !1;
1032
1034
  const e = (i) => {
1033
1035
  if (!i || typeof i != "object") return !1;
1034
1036
  const n = i;
1035
- return Object.keys(i).every((r) => [...ti, "sessionId", "runtimeItemCount", "welcome", "truncated", "thinkingSequence", "context"].includes(r)) && (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")) && et(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));
1037
+ 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(ks));
1036
1038
  }, t = s;
1037
1039
  return (t.before === null || e(t.before)) && e(t.current);
1038
1040
  }
1039
1041
  const si = 500;
1040
- function we(s) {
1042
+ function _e(s) {
1041
1043
  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
1044
  return e.length > si ? `${e.slice(0, si - 1)}…` : e;
1043
1045
  }
1044
- function Ji(s) {
1046
+ function Qi(s) {
1045
1047
  let e = 2166136261;
1046
1048
  for (let t = 0; t < s.length; t += 1)
1047
1049
  e ^= s.charCodeAt(t), e = Math.imul(e, 16777619);
1048
1050
  return `fnv1a-${(e >>> 0).toString(16).padStart(8, "0")}`;
1049
1051
  }
1050
- const Cs = "0.1.256", Qi = {
1051
- version: Cs
1052
- };
1053
- function ze(s) {
1052
+ function He(s) {
1054
1053
  if (!s || typeof s != "object") return !1;
1055
1054
  const e = s;
1056
1055
  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);
@@ -1058,21 +1057,21 @@ function ze(s) {
1058
1057
  function dr(s) {
1059
1058
  if (!s || typeof s != "object") return !1;
1060
1059
  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 || 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));
1060
+ 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));
1062
1061
  }
1063
1062
  function Xi(s, e, t, i, n = {}) {
1064
- const r = !i && e === "conversation_error" && t !== void 0 && s.conversationDiagnostics?.errorMessageFingerprint === Ji(we(t)) ? s.conversationDiagnostics : void 0;
1063
+ const r = !i && e === "conversation_error" && t !== void 0 && s.conversationDiagnostics?.errorMessageFingerprint === Qi(_e(t)) ? s.conversationDiagnostics : void 0;
1065
1064
  return {
1066
1065
  sessionId: O(s.sessionId),
1067
1066
  requestId: O(r?.httpRequest?.requestId ?? r?.errorRequestId ?? r?.queryRequestId),
1068
1067
  ...O(r?.failedClientMessageId) ? { clientMessageId: r.failedClientMessageId } : {},
1069
1068
  code: r ? O(s.lastErrorCode) : null,
1070
- ...ze(r?.errorNormalization) ? { normalization: r.errorNormalization } : {},
1071
- builds: { sdk: Qi.version, ...n }
1069
+ ...He(r?.errorNormalization) ? { normalization: r.errorNormalization } : {},
1070
+ builds: { sdk: Ji.version, ...n }
1072
1071
  };
1073
1072
  }
1074
1073
  function lr(s) {
1075
- if (s.details !== void 0 && !Le(s.details))
1074
+ if (s.details !== void 0 && !$e(s.details))
1076
1075
  throw new TypeError("Product Agent transported error details must be JSON-safe.");
1077
1076
  return {
1078
1077
  code: s.code,
@@ -1084,7 +1083,7 @@ function lr(s) {
1084
1083
  function he(s, e = "runtime_error", t = "runtime") {
1085
1084
  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
1085
  // Preserve the first boundary's shape after normalization replaces the original message/prototype.
1087
- errorNormalization: ze(o.errorNormalization) ? o.errorNormalization : {
1086
+ errorNormalization: He(o.errorNormalization) ? o.errorNormalization : {
1088
1087
  boundary: t,
1089
1088
  category: s instanceof Error ? "error" : s === null ? "null" : Array.isArray(s) ? "array" : typeof s,
1090
1089
  messageKind: n.trim() === "[object Object]" ? "object_coercion" : n.trim() ? "text" : typeof s == "string" || i && "message" in i && typeof i.message == "string" ? "blank" : "non_text"
@@ -1105,15 +1104,15 @@ function he(s, e = "runtime_error", t = "runtime") {
1105
1104
  });
1106
1105
  }
1107
1106
  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" ? we(s.stack.slice(0, 4e3).split(`
1107
+ 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(`
1109
1108
  `).slice(0, 6).join(`
1110
1109
  `).replace(/\n\s*at\s/g, `
1111
1110
  frame `)) : void 0;
1112
1111
  return {
1113
- ...ze(t.details?.errorNormalization) ? { normalization: t.details.errorNormalization } : {},
1112
+ ...He(t.details?.errorNormalization) ? { normalization: t.details.errorNormalization } : {},
1114
1113
  category: s instanceof Error ? "error" : s === null ? "null" : Array.isArray(s) ? "array" : typeof s,
1115
- code: we(t.code),
1116
- message: we(t.message),
1114
+ code: _e(t.code),
1115
+ message: _e(t.message),
1117
1116
  ...i ? { stack: i } : {}
1118
1117
  };
1119
1118
  }
@@ -1424,7 +1423,7 @@ function vr(s) {
1424
1423
  "conversations",
1425
1424
  { timing: u }
1426
1425
  );
1427
- 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" });
1426
+ 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" });
1428
1427
  if (o.command.type.startsWith("chat.")) {
1429
1428
  const f = p.result;
1430
1429
  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,7 +1684,7 @@ class Ir {
1685
1684
  }
1686
1685
  }
1687
1686
  }
1688
- function ve(s, e, t) {
1687
+ function Ie(s, e, t) {
1689
1688
  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
1689
  const P = oe(I.created_at), L = oe(k.created_at);
1691
1690
  return P < L ? -1 : P > L ? 1 : I.id < k.id ? -1 : I.id > k.id ? 1 : 0;
@@ -1707,8 +1706,8 @@ function ve(s, e, t) {
1707
1706
  }
1708
1707
  for (const I of c) {
1709
1708
  const k = l.findIndex((P) => {
1710
- const L = a.find((Ke) => Ke.userMessageId === P.userMessageId), ke = r?.items[P.userMessageId ?? P.activityIds[0] ?? P.outcomeIds[0]];
1711
- return (L?.submittedAt ?? (ke ? Date.parse(ke.created_at) : 1 / 0)) > I.submittedAt;
1709
+ const L = a.find((We) => We.userMessageId === P.userMessageId), qe = r?.items[P.userMessageId ?? P.activityIds[0] ?? P.outcomeIds[0]];
1710
+ return (L?.submittedAt ?? (qe ? Date.parse(qe.created_at) : 1 / 0)) > I.submittedAt;
1712
1711
  });
1713
1712
  l.splice(k < 0 ? l.length : k, 0, {
1714
1713
  id: I.userMessageId,
@@ -1764,7 +1763,7 @@ function Yi(s, e) {
1764
1763
  return s.sessionId && a ? { type: "execution", userMessageId: a, sessionId: s.sessionId } : null;
1765
1764
  }
1766
1765
  function br(s, e) {
1767
- return ne({ scopes: Object.fromEntries([...new Set(Object.values(e.clients))].map((t) => [t, ve(s, e, t)])) });
1766
+ return ne({ scopes: Object.fromEntries([...new Set(Object.values(e.clients))].map((t) => [t, Ie(s, e, t)])) });
1768
1767
  }
1769
1768
  function wr(s, e) {
1770
1769
  if (!e) return !1;
@@ -1778,7 +1777,7 @@ function wr(s, e) {
1778
1777
  return !1;
1779
1778
  }
1780
1779
  const _r = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
1781
- function Re(s, e) {
1780
+ function Ae(s, e) {
1782
1781
  return e ? s.replace(
1783
1782
  _r,
1784
1783
  (t, i, n, r) => `${i}${new URL(n, e).toString()}${r}`
@@ -1829,21 +1828,21 @@ function Sr(s, e, t, i) {
1829
1828
  };
1830
1829
  switch (s.type) {
1831
1830
  case "user_message":
1832
- return { ...r, role: "user", content: Re(s.data.content, i), attachments: s.data.attachments.map((a) => ii(a, i)) };
1831
+ return { ...r, role: "user", content: Ae(s.data.content, i), attachments: s.data.attachments.map((a) => ii(a, i)) };
1833
1832
  case "final_response":
1834
1833
  return {
1835
1834
  ...r,
1836
1835
  role: "assistant",
1837
1836
  phase: "final_answer",
1838
- content: Re(s.data.content, i),
1837
+ content: Ae(s.data.content, i),
1839
1838
  attachments: s.data.attachments.map((a) => ii(a, i)),
1840
1839
  loading: n,
1841
1840
  streamState: t
1842
1841
  };
1843
1842
  case "commentary":
1844
- return { ...r, role: "tool", phase: "commentary", dataType: "commentary_history", content: Re(s.data.content, i), loading: n };
1843
+ return { ...r, role: "tool", phase: "commentary", dataType: "commentary_history", content: Ae(s.data.content, i), loading: n };
1845
1844
  case "tool_summary":
1846
- return { ...r, role: "tool", dataType: "tool_summary", content: Re(s.data.content, i), loading: n };
1845
+ return { ...r, role: "tool", dataType: "tool_summary", content: Ae(s.data.content, i), loading: n };
1847
1846
  // The supported public renderer recognizes run_error; a bare error system row is silently omitted.
1848
1847
  case "error":
1849
1848
  return {
@@ -1907,10 +1906,10 @@ function Ot(s, e, t, i) {
1907
1906
  isRetrying: s.isRetrying ?? !1,
1908
1907
  historyRefreshFailure: h === e?.error ? s.historyRefreshFailure ?? null : null,
1909
1908
  conversationDiagnostics: {
1910
- ...h ? { errorMessageFingerprint: Ji(we(h.message)) } : {},
1909
+ ...h ? { errorMessageFingerprint: Qi(_e(h.message)) } : {},
1911
1910
  ...d && h && h === d.error && !p ? { failedClientMessageId: d.userMessageId } : {},
1912
1911
  ...typeof h?.details?.requestId == "string" ? { errorRequestId: h.details.requestId } : {},
1913
- ...ze(h?.details?.errorNormalization) ? { errorNormalization: h.details.errorNormalization } : {},
1912
+ ...He(h?.details?.errorNormalization) ? { errorNormalization: h.details.errorNormalization } : {},
1914
1913
  ...i ? { owner: i } : {},
1915
1914
  ...de(h?.details?.httpRequest) ? { httpRequest: h.details.httpRequest } : {},
1916
1915
  queryStatus: e?.status ?? null,
@@ -2173,15 +2172,15 @@ function Mr(s, e) {
2173
2172
  Pt || (Pt = new TextEncoder()), e(Pt.encode(t));
2174
2173
  });
2175
2174
  }
2176
- const ci = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", De = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
2175
+ const ci = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Ue = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
2177
2176
  for (let s = 0; s < ci.length; s++)
2178
- De[ci.charCodeAt(s)] = s;
2177
+ Ue[ci.charCodeAt(s)] = s;
2179
2178
  const Or = (s) => {
2180
2179
  let e = s.length * 0.75, t = s.length, i, n = 0, r, a, o, c;
2181
2180
  s[s.length - 1] === "=" && (e--, s[s.length - 2] === "=" && e--);
2182
2181
  const d = new ArrayBuffer(e), l = new Uint8Array(d);
2183
2182
  for (i = 0; i < t; i += 4)
2184
- r = De[s.charCodeAt(i)], a = De[s.charCodeAt(i + 1)], o = De[s.charCodeAt(i + 2)], c = De[s.charCodeAt(i + 3)], l[n++] = r << 2 | a >> 4, l[n++] = (a & 15) << 4 | o >> 2, l[n++] = (o & 3) << 6 | c & 63;
2183
+ 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
2184
  return d;
2186
2185
  }, Pr = typeof ArrayBuffer == "function", Os = (s, e) => {
2187
2186
  if (typeof s != "string")
@@ -2245,10 +2244,10 @@ function Nr() {
2245
2244
  });
2246
2245
  }
2247
2246
  let xt;
2248
- function Je(s) {
2247
+ function Qe(s) {
2249
2248
  return s.reduce((e, t) => e + t.length, 0);
2250
2249
  }
2251
- function Qe(s, e) {
2250
+ function Xe(s, e) {
2252
2251
  if (s[0].length === e)
2253
2252
  return s.shift();
2254
2253
  const t = new Uint8Array(e);
@@ -2265,28 +2264,28 @@ function Br(s, e) {
2265
2264
  transform(a, o) {
2266
2265
  for (t.push(a); ; ) {
2267
2266
  if (i === 0) {
2268
- if (Je(t) < 1)
2267
+ if (Qe(t) < 1)
2269
2268
  break;
2270
- const c = Qe(t, 1);
2269
+ const c = Xe(t, 1);
2271
2270
  r = (c[0] & 128) === 128, n = c[0] & 127, n < 126 ? i = 3 : n === 126 ? i = 1 : i = 2;
2272
2271
  } else if (i === 1) {
2273
- if (Je(t) < 2)
2272
+ if (Qe(t) < 2)
2274
2273
  break;
2275
- const c = Qe(t, 2);
2274
+ const c = Xe(t, 2);
2276
2275
  n = new DataView(c.buffer, c.byteOffset, c.length).getUint16(0), i = 3;
2277
2276
  } else if (i === 2) {
2278
- if (Je(t) < 8)
2277
+ if (Qe(t) < 8)
2279
2278
  break;
2280
- const c = Qe(t, 8), d = new DataView(c.buffer, c.byteOffset, c.length), l = d.getUint32(0);
2279
+ const c = Xe(t, 8), d = new DataView(c.buffer, c.byteOffset, c.length), l = d.getUint32(0);
2281
2280
  if (l > Math.pow(2, 21) - 1) {
2282
2281
  o.enqueue(hs);
2283
2282
  break;
2284
2283
  }
2285
2284
  n = l * Math.pow(2, 32) + d.getUint32(4), i = 3;
2286
2285
  } else {
2287
- if (Je(t) < n)
2286
+ if (Qe(t) < n)
2288
2287
  break;
2289
- const c = Qe(t, n);
2288
+ const c = Xe(t, n);
2290
2289
  o.enqueue(Os(r ? c : xt.decode(c), e)), i = 0;
2291
2290
  }
2292
2291
  if (n === 0 || n > s) {
@@ -2627,7 +2626,7 @@ class Yr extends Jr {
2627
2626
  }), this.pollXhr = e;
2628
2627
  }
2629
2628
  }
2630
- let Ae = class ot extends U {
2629
+ let Te = class ot extends U {
2631
2630
  /**
2632
2631
  * Request constructor
2633
2632
  *
@@ -2724,8 +2723,8 @@ let Ae = class ot extends U {
2724
2723
  this._cleanup();
2725
2724
  }
2726
2725
  };
2727
- Ae.requestsCount = 0;
2728
- Ae.requests = {};
2726
+ Te.requestsCount = 0;
2727
+ Te.requests = {};
2729
2728
  if (typeof document < "u") {
2730
2729
  if (typeof attachEvent == "function")
2731
2730
  attachEvent("onunload", di);
@@ -2735,8 +2734,8 @@ if (typeof document < "u") {
2735
2734
  }
2736
2735
  }
2737
2736
  function di() {
2738
- for (let s in Ae.requests)
2739
- Ae.requests.hasOwnProperty(s) && Ae.requests[s].abort();
2737
+ for (let s in Te.requests)
2738
+ Te.requests.hasOwnProperty(s) && Te.requests[s].abort();
2740
2739
  }
2741
2740
  const Zr = (function() {
2742
2741
  const s = dn({
@@ -2751,7 +2750,7 @@ class eo extends Yr {
2751
2750
  this.supportsBinary = Zr && !t;
2752
2751
  }
2753
2752
  request(e = {}) {
2754
- return Object.assign(e, { xd: this.xd }, this.opts), new Ae(dn, this.uri(), e);
2753
+ return Object.assign(e, { xd: this.xd }, this.opts), new Te(dn, this.uri(), e);
2755
2754
  }
2756
2755
  }
2757
2756
  function dn(s) {
@@ -4165,10 +4164,10 @@ class hn extends U {
4165
4164
  }
4166
4165
  }
4167
4166
  }
4168
- function Ee(s) {
4167
+ function ke(s) {
4169
4168
  s = s || {}, this.ms = s.min || 100, this.max = s.max || 1e4, this.factor = s.factor || 2, this.jitter = s.jitter > 0 && s.jitter <= 1 ? s.jitter : 0, this.attempts = 0;
4170
4169
  }
4171
- Ee.prototype.duration = function() {
4170
+ ke.prototype.duration = function() {
4172
4171
  var s = this.ms * Math.pow(this.factor, this.attempts++);
4173
4172
  if (this.jitter) {
4174
4173
  var e = Math.random(), t = Math.floor(e * this.jitter * s);
@@ -4176,22 +4175,22 @@ Ee.prototype.duration = function() {
4176
4175
  }
4177
4176
  return Math.min(s, this.max) | 0;
4178
4177
  };
4179
- Ee.prototype.reset = function() {
4178
+ ke.prototype.reset = function() {
4180
4179
  this.attempts = 0;
4181
4180
  };
4182
- Ee.prototype.setMin = function(s) {
4181
+ ke.prototype.setMin = function(s) {
4183
4182
  this.ms = s;
4184
4183
  };
4185
- Ee.prototype.setMax = function(s) {
4184
+ ke.prototype.setMax = function(s) {
4186
4185
  this.max = s;
4187
4186
  };
4188
- Ee.prototype.setJitter = function(s) {
4187
+ ke.prototype.setJitter = function(s) {
4189
4188
  this.jitter = s;
4190
4189
  };
4191
4190
  class gs extends U {
4192
4191
  constructor(e, t) {
4193
4192
  var i;
4194
- super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t, It(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || 1 / 0), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor((i = t.randomizationFactor) !== null && i !== void 0 ? i : 0.5), this.backoff = new Ee({
4193
+ super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t, It(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || 1 / 0), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor((i = t.randomizationFactor) !== null && i !== void 0 ? i : 0.5), this.backoff = new ke({
4195
4194
  min: this.reconnectionDelay(),
4196
4195
  max: this.reconnectionDelayMax(),
4197
4196
  jitter: this.randomizationFactor()
@@ -4426,12 +4425,12 @@ class gs extends U {
4426
4425
  this._reconnecting = !1, this.backoff.reset(), this.emitReserved("reconnect", e);
4427
4426
  }
4428
4427
  }
4429
- const Ce = {};
4428
+ const Me = {};
4430
4429
  function lt(s, e) {
4431
4430
  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 = Ce[n] && r in Ce[n].nsps, o = e.forceNew || e["force new connection"] || e.multiplex === !1 || a;
4431
+ 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;
4433
4432
  let c;
4434
- return o ? c = new gs(i, e) : (Ce[n] || (Ce[n] = new gs(i, e)), c = Ce[n]), t.query && !e.query && (e.query = t.queryKey), c.socket(t.path, e);
4433
+ 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
4434
  }
4436
4435
  Object.assign(lt, {
4437
4436
  Manager: gs,
@@ -4884,7 +4883,7 @@ class pn {
4884
4883
  ownerId: O(o?.ownerId),
4885
4884
  authorityGeneration: o?.authorityGeneration ?? null,
4886
4885
  sessionId: O(o?.sessionId),
4887
- release: this.auth.extension_version ? `extension-${this.auth.extension_version}` : `sdk-${Qi.version}`,
4886
+ release: this.auth.extension_version ? `extension-${this.auth.extension_version}` : `sdk-${Ji.version}`,
4888
4887
  upstreamRequestId: B,
4889
4888
  upstreamTraceId: J
4890
4889
  };
@@ -4911,15 +4910,15 @@ class pn {
4911
4910
  }
4912
4911
  }
4913
4912
  }
4914
- function $e(s) {
4913
+ function Fe(s) {
4915
4914
  if (s !== null && typeof s == "object" && !Object.isFrozen(s)) {
4916
- for (const e of Object.values(s)) $e(e);
4915
+ for (const e of Object.values(s)) Fe(e);
4917
4916
  Object.freeze(s);
4918
4917
  }
4919
4918
  return s;
4920
4919
  }
4921
4920
  function fn() {
4922
- return $e({
4921
+ return Fe({
4923
4922
  authorityId: null,
4924
4923
  generation: 0,
4925
4924
  entities: {},
@@ -4944,13 +4943,13 @@ function x(s) {
4944
4943
  return JSON.stringify([s.kind, s.origin, s.limit]);
4945
4944
  }
4946
4945
  function qo(s) {
4947
- const e = s.map((t) => Ue(t) || t.requestId !== null && t.status !== "error" ? { ...t, status: t.status === "error" ? t.data?.length ? "refreshing" : "loading" : t.status, error: null } : t);
4946
+ 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
4947
  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
4948
  }
4950
4949
  function Co(s) {
4951
4950
  return [...new Set(s.flatMap((e) => e.data ?? []))];
4952
4951
  }
4953
- function Ue(s) {
4952
+ function Ne(s) {
4954
4953
  const e = s.error;
4955
4954
  return s.status === "error" && s.consecutiveFailures < 10 && e !== null && !["unauthorized", "401", "403", "authority_retired"].includes(e.code) && (e.retryable || /^5\d\d$/.test(e.code) || ["runtime_error", "connection_interrupted", "request_timed_out", "408", "429"].includes(e.code));
4956
4955
  }
@@ -4959,7 +4958,7 @@ function W(s) {
4959
4958
  const e = s.currentAuthority();
4960
4959
  return e.authorityId === s.authority.authorityId && e.generation === s.authority.generation;
4961
4960
  }
4962
- function Me(s, e) {
4961
+ function Oe(s, e) {
4963
4962
  if (!W(s) || e.authorityId !== s.authority.authorityId || e.generation !== s.authority.generation)
4964
4963
  throw new Error("Directory authority is no longer current.");
4965
4964
  }
@@ -4994,18 +4993,18 @@ function Mo(s) {
4994
4993
  return {
4995
4994
  "directory.query": async (i) => {
4996
4995
  try {
4997
- Me(s, i);
4996
+ Oe(s, i);
4998
4997
  const n = ye(i.query), r = { origin: n.origin, ...n.kind !== "all" ? { pinned: n.kind === "pinned" } : {}, cursor: i.cursor, limit: n.limit };
4999
4998
  let a;
5000
4999
  if (s.http.auth.client_kind === "embed") {
5001
5000
  const o = await s.http.request("/conversations", { ...r, page_url: n.origin ?? s.pageUrl() });
5002
- Me(s, i), a = { entries: await Promise.all(o.sessions.map(async (d) => ({
5001
+ Oe(s, i), a = { entries: await Promise.all(o.sessions.map(async (d) => ({
5003
5002
  ...await mn(s.http, d.id),
5004
5003
  ...typeof d.isActive == "boolean" ? { is_active: d.isActive } : {}
5005
5004
  }))), next_cursor: o.nextCursor };
5006
5005
  } else
5007
5006
  a = await s.http.request("/conversations", r, void 0, "GET", e);
5008
- return Me(s, i), { ...a, updatedAt: s.now() };
5007
+ return Oe(s, i), { ...a, updatedAt: s.now() };
5009
5008
  } catch (n) {
5010
5009
  throw W({ authority: i, currentAuthority: s.currentAuthority }) && s.onError?.(n), n;
5011
5010
  }
@@ -5014,9 +5013,9 @@ function Mo(s) {
5014
5013
  const r = (t.get(i.sessionId) ?? Promise.resolve()).catch(() => {
5015
5014
  }).then(async () => {
5016
5015
  try {
5017
- Me(s, i);
5016
+ Oe(s, i);
5018
5017
  const o = await s.http.request(`/conversations/${encodeURIComponent(i.sessionId)}`, {}, i.patch, "PATCH", e);
5019
- return Me(s, i), o;
5018
+ return Oe(s, i), o;
5020
5019
  } catch (o) {
5021
5020
  throw W({ authority: i, currentAuthority: s.currentAuthority }) && s.onError?.(o), o;
5022
5021
  }
@@ -5078,7 +5077,7 @@ class Oo {
5078
5077
  if (t) for (const n of Object.values(i)) {
5079
5078
  const r = x(n.query);
5080
5079
  if (n.status !== "error" || n.requestId !== null || this.queryRequests.has(r) || !this.isObserved(n.query)) continue;
5081
- if (!Ue(n)) {
5080
+ if (!Ne(n)) {
5082
5081
  const c = this.queryRetries.get(r);
5083
5082
  c?.timer !== null && c?.timer !== void 0 && clearTimeout(c.timer), this.queryRetries.delete(r);
5084
5083
  continue;
@@ -5142,16 +5141,16 @@ class Oo {
5142
5141
  }
5143
5142
  refreshObservedQuery(e) {
5144
5143
  const t = this.options.runtime.engine.getState().slices.directory.queries[x(ye(e))];
5145
- return t?.status === "error" && !Ue(t) ? Promise.resolve() : e.kind !== "pinned" && t?.status === "error" && t.mode === "append" ? this.enqueueQuery(e, async () => {
5144
+ return t?.status === "error" && !Ne(t) ? Promise.resolve() : e.kind !== "pinned" && t?.status === "error" && t.mode === "append" ? this.enqueueQuery(e, async () => {
5146
5145
  const i = this.options.runtime.engine.getState().slices.directory.queries[x(ye(e))];
5147
- !this.isObserved(e) || i?.status !== "error" || i.mode !== "append" || !Ue(i) || await this.readPage(e, "append", i.cursor);
5146
+ !this.isObserved(e) || i?.status !== "error" || i.mode !== "append" || !Ne(i) || await this.readPage(e, "append", i.cursor);
5148
5147
  }) : this.refreshPages(e, e.kind === "pinned", () => this.isObserved(e));
5149
5148
  }
5150
5149
  refreshPages(e, t, i, n = !1) {
5151
5150
  return e = ye(e), this.enqueueQuery(e, async () => {
5152
5151
  if (!i()) return;
5153
5152
  const r = this.options.runtime.engine.getState().slices.directory.queries[x(e)];
5154
- if (!n && r?.status === "error" && !Ue(r) || (await this.readPage(e, "replace", void 0, n), !t)) return;
5153
+ if (!n && r?.status === "error" && !Ne(r) || (await this.readPage(e, "replace", void 0, n), !t)) return;
5155
5154
  let a = this.options.runtime.engine.getState().slices.directory.queries[x(e)]?.cursor ?? null;
5156
5155
  for (; a !== null && i(); ) {
5157
5156
  const o = a;
@@ -5441,7 +5440,7 @@ class D extends EventTarget {
5441
5440
  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
5441
  id: a?.id ?? crypto.randomUUID(),
5443
5442
  phase: e,
5444
- sdkVersion: Cs,
5443
+ sdkVersion: Ts,
5445
5444
  stage: t.stage ?? (t.readinessPhase === "bootstrap" ? "bootstrap" : t.readinessPhase === "activation" ? "executor_registration" : "socket_admission"),
5446
5445
  ...t.httpStatus ? { httpStatus: t.httpStatus } : {},
5447
5446
  ...t.failureKind ? { failureKind: t.failureKind } : {},
@@ -5716,11 +5715,11 @@ class D extends EventTarget {
5716
5715
  }), r;
5717
5716
  }
5718
5717
  }
5719
- const ys = /* @__PURE__ */ new WeakMap(), Ie = (s) => s === null || typeof s == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(s);
5718
+ const ys = /* @__PURE__ */ new WeakMap(), be = (s) => s === null || typeof s == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(s);
5720
5719
  function gn(s) {
5721
5720
  if (!s || typeof s != "object") return !1;
5722
5721
  const e = s;
5723
- return typeof e.observedAt == "string" && e.observedAt.length <= 40 && Number.isFinite(Date.parse(e.observedAt)) && Ie(e.sessionId) && Ie(e.responseItemId) && Ie(e.respondsToUserMessageId) && typeof e.panelVisible == "boolean" && typeof e.documentVisible == "boolean" && typeof e.loading == "boolean";
5722
+ 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
5723
  }
5725
5724
  function No(s, e, t) {
5726
5725
  if (!gn(t)) return;
@@ -5744,17 +5743,17 @@ function jo(s, e, t, i, n, r, a, o, c = null, d = !1) {
5744
5743
  return {
5745
5744
  capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
5746
5745
  authenticated: n,
5747
- activeClientMessageId: Ie(r) ? r : null,
5748
- pendingClientMessageId: Ie(a) ? a : null,
5749
- clientUserMessageItemId: l && Ie(l.id) ? l.id : null,
5750
- clientResponseItemId: u && Ie(u.id) ? u.id : null,
5746
+ activeClientMessageId: be(r) ? r : null,
5747
+ pendingClientMessageId: be(a) ? a : null,
5748
+ clientUserMessageItemId: l && be(l.id) ? l.id : null,
5749
+ clientResponseItemId: u && be(u.id) ? u.id : null,
5751
5750
  clientDraftObserved: !!(l && d && c === l.id),
5752
5751
  renderer: Bo(s, e, t)
5753
5752
  };
5754
5753
  }
5755
5754
  const Lo = 1e4, $o = 3e3;
5756
5755
  function yn() {
5757
- return { authenticated: !1, generation: 0, sequence: 0, displaySequence: 0, backendCount: null, query: je("activeUsers") };
5756
+ return { authenticated: !1, generation: 0, sequence: 0, displaySequence: 0, backendCount: null, query: Le("activeUsers") };
5758
5757
  }
5759
5758
  function Fo(s, e) {
5760
5759
  if (e.type === "activeUsers.authenticate") {
@@ -5969,7 +5968,7 @@ function Nt(s, e, t) {
5969
5968
  const n = { ...e, conversation: { ...e.conversation } }, r = { ...s, entities: { ...s.entities, [e.conversation_id]: n } };
5970
5969
  return t ? vs(r) : r;
5971
5970
  }
5972
- function be(s, e) {
5971
+ function we(s, e) {
5973
5972
  let t = s;
5974
5973
  const i = [];
5975
5974
  if (e.type === "directory.authority_replace") {
@@ -5981,7 +5980,7 @@ function be(s, e) {
5981
5980
  const r = { ...s.requests };
5982
5981
  if (delete r[e.effectId], t = { ...s, requests: r }, n.kind === "directory.query") {
5983
5982
  const a = x(n.input.query), o = s.queries[a];
5984
- if (o.requestId !== n.input.requestId) return { state: $e(t), effects: i };
5983
+ if (o.requestId !== n.input.requestId) return { state: Fe(t), effects: i };
5985
5984
  if (e.type === "effect.failed")
5986
5985
  t = { ...t, queries: { ...t.queries, [a]: { ...o, status: "error", error: { ...e.error }, requestId: null, consecutiveFailures: o.consecutiveFailures + 1 } } };
5987
5986
  else if (e.effectKind === "directory.query") {
@@ -6075,7 +6074,7 @@ function be(s, e) {
6075
6074
  query: d,
6076
6075
  cursor: e.cursor !== void 0 ? e.cursor : e.mode === "append" ? c?.cursor ?? null : null
6077
6076
  } }, t = { ...s, queries: { ...s.queries, [o]: {
6078
- ...zi(c ?? je(o), { key: o, requestId: e.requestId, mode: e.mode }),
6077
+ ...zi(c ?? Le(o), { key: o, requestId: e.requestId, mode: e.mode }),
6079
6078
  query: d,
6080
6079
  requestSequence: s.requestSequence + 1,
6081
6080
  mode: e.mode,
@@ -6100,7 +6099,7 @@ function be(s, e) {
6100
6099
  } else
6101
6100
  t = Ko(s, e);
6102
6101
  }
6103
- return { state: $e(t), effects: i };
6102
+ return { state: Fe(t), effects: i };
6104
6103
  }
6105
6104
  function Vo(s) {
6106
6105
  const e = { ...s.entities };
@@ -6115,7 +6114,7 @@ function Vo(s) {
6115
6114
  activityRevision: n,
6116
6115
  ...r
6117
6116
  } = s;
6118
- return $e({
6117
+ return Fe({
6119
6118
  ...r,
6120
6119
  entities: e,
6121
6120
  activityBySessionId: { ...t, ...s.activityBySessionId },
@@ -6374,7 +6373,7 @@ function _i(s, e, t) {
6374
6373
  const n = { authorityId: e.authorityId, generation: e.generation };
6375
6374
  for (const [a, o] of Object.entries(t.optimisticEntries)) {
6376
6375
  const c = e.submissions[a];
6377
- c && ((c.cancelled || c.delivery === "failed") && c.delivery !== "accepted" ? i = be(i, { ...n, type: "directory.optimistic_remove", clientMessageId: a }).state : c.delivery === "accepted" && c.sessionId && o.sessionId === null && (i = be(i, { ...n, type: "directory.optimistic_accept", clientMessageId: a, sessionId: c.sessionId }).state));
6376
+ c && ((c.cancelled || c.delivery === "failed") && c.delivery !== "accepted" ? i = we(i, { ...n, type: "directory.optimistic_remove", clientMessageId: a }).state : c.delivery === "accepted" && c.sessionId && o.sessionId === null && (i = we(i, { ...n, type: "directory.optimistic_accept", clientMessageId: a, sessionId: c.sessionId }).state));
6378
6377
  }
6379
6378
  const r = /* @__PURE__ */ new Set();
6380
6379
  for (const a of e.submissionOrder) {
@@ -6382,7 +6381,7 @@ function _i(s, e, t) {
6382
6381
  if (o.cancelled || o.delivery === "failed" || r.has(o.conversationScopeId)) continue;
6383
6382
  r.add(o.conversationScopeId);
6384
6383
  const c = Object.keys(t.optimisticEntries).some((d) => s.submissions[d]?.conversationScopeId === o.conversationScopeId && !i.optimisticEntries[d]);
6385
- o.sessionId !== null || i.optimisticEntries[a] || s.submissions[a] && !c || (i = be(i, { ...n, type: "directory.optimistic_upsert", entry: {
6384
+ o.sessionId !== null || i.optimisticEntries[a] || s.submissions[a] && !c || (i = we(i, { ...n, type: "directory.optimistic_upsert", entry: {
6386
6385
  id: `optimistic-user-message:${a}`,
6387
6386
  clientMessageId: a,
6388
6387
  sessionId: null,
@@ -6395,10 +6394,10 @@ function _i(s, e, t) {
6395
6394
  for (const [a, o] of Object.entries(t.memberships)) {
6396
6395
  const c = t.clients[o.members[0]];
6397
6396
  if (!c) continue;
6398
- const d = ve(e, t, c), l = ve(s, t, c);
6397
+ const d = Ie(e, t, c), l = Ie(s, t, c);
6399
6398
  if (d.activity.phase === l.activity.phase) continue;
6400
6399
  const u = ["submitting", "awaiting_execution", "thinking", "steering", "queued", "stopping"].includes(d.activity.phase);
6401
- i = be(i, { ...n, type: "directory.activity_set", sessionId: a, active: u }).state;
6400
+ i = we(i, { ...n, type: "directory.activity_set", sessionId: a, active: u }).state;
6402
6401
  }
6403
6402
  return i;
6404
6403
  }
@@ -6421,7 +6420,7 @@ class ta {
6421
6420
  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
6421
  }
6423
6422
  if (Xo(a)) {
6424
- const c = be(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);
6423
+ 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
6424
  return { state: p === n.slices.directory && u === n.slices.conversation ? n : Object.freeze({
6426
6425
  revision: n.revision + 1,
6427
6426
  slices: Object.freeze({ ...n.slices, directory: p, conversation: u })
@@ -6433,7 +6432,7 @@ class ta {
6433
6432
  for (const [f, m] of Object.entries(c.state.operations)) {
6434
6433
  if (!["runtime.warmup", "attachment.prepare"].includes(m.command.type) || !m.conversationScopeId || m.phase !== "done" || n.slices.conversation.operations[f]?.phase === "done") continue;
6435
6434
  const h = m.result, y = d.selections[m.conversationScopeId];
6436
- h?.sessionId && y?.provisionalId && y.sessionId === null && Object.values(d.clients).includes(m.conversationScopeId) && (d = be(d, {
6435
+ h?.sessionId && y?.provisionalId && y.sessionId === null && Object.values(d.clients).includes(m.conversationScopeId) && (d = we(d, {
6437
6436
  authorityId: c.state.authorityId,
6438
6437
  generation: c.state.generation,
6439
6438
  type: "directory.accepted",
@@ -6445,7 +6444,7 @@ class ta {
6445
6444
  const l = Object.values(c.state.submissions).find((f) => f.delivery === "accepted" && n.slices.conversation.submissions[f.userMessageId]?.delivery !== "accepted");
6446
6445
  if (l) {
6447
6446
  const f = d.selections[l.conversationScopeId];
6448
- !l.cancelled && f?.provisionalId && (d = be(d, {
6447
+ !l.cancelled && f?.provisionalId && (d = we(d, {
6449
6448
  type: "directory.accepted",
6450
6449
  authorityId: c.state.authorityId,
6451
6450
  generation: c.state.generation,
@@ -6670,7 +6669,7 @@ function pa(s) {
6670
6669
  return (s.type === "function_call" || s.type === "tool_call") && s.name === ha;
6671
6670
  }
6672
6671
  const Bt = "pluno.productAgent.transportId", fa = "pluno.productAgent.transportIdentity", jt = "pluno.productAgent.transportIdentity.event", ma = 50, ga = globalThis.setTimeout.bind(globalThis);
6673
- let Oe = null;
6672
+ let Pe = null;
6674
6673
  const ut = /* @__PURE__ */ new Set(), Lt = /* @__PURE__ */ new Map();
6675
6674
  async function ya(s = wn()) {
6676
6675
  const e = s.randomUUID(), t = s.storage.getItem(Bt);
@@ -6711,16 +6710,16 @@ async function ya(s = wn()) {
6711
6710
  };
6712
6711
  }
6713
6712
  async function va(s = !1) {
6714
- Oe || (Oe = ya({
6713
+ Pe || (Pe = ya({
6715
6714
  ...wn(),
6716
6715
  skipStoredIdentityCollisionCheck: s
6717
- }), Oe.then((n) => {
6716
+ }), Pe.then((n) => {
6718
6717
  const r = (a) => {
6719
- a.persisted || (n.release(), Oe = null, ut.clear(), window.removeEventListener("pagehide", r));
6718
+ a.persisted || (n.release(), Pe = null, ut.clear(), window.removeEventListener("pagehide", r));
6720
6719
  };
6721
6720
  window.addEventListener("pagehide", r);
6722
6721
  }));
6723
- const e = await Oe, t = Ia();
6722
+ const e = await Pe, t = Ia();
6724
6723
  ut.add(t);
6725
6724
  let i = !1;
6726
6725
  return {
@@ -7096,8 +7095,8 @@ class Wd {
7096
7095
  activityReconciliationScheduled = !1;
7097
7096
  getState() {
7098
7097
  const e = this.recentQuery.getState(), t = this.pinnedQuery.getState(), i = [
7099
- ...Xe(t.data),
7100
- ...Xe(e.data)
7098
+ ...Ye(t.data),
7099
+ ...Ye(e.data)
7101
7100
  ], n = new Map(i.map((c) => [c.id, c])), r = Array.from(n.values()).map(
7102
7101
  (c) => this.applyOverrides(c, this.completedRefreshSequence)
7103
7102
  ), a = Array.from(this.optimisticEntities.values()).filter((c) => !n.has(c.id)).reverse(), o = e.data || t.data || a.length > 0 ? it({
@@ -7172,8 +7171,8 @@ class Wd {
7172
7171
  }
7173
7172
  reconcileDurableEntities() {
7174
7173
  const e = [
7175
- ...Xe(this.pinnedQuery.getState().data),
7176
- ...Xe(this.recentQuery.getState().data)
7174
+ ...Ye(this.pinnedQuery.getState().data),
7175
+ ...Ye(this.recentQuery.getState().data)
7177
7176
  ], t = new Set(e.map((i) => i.id));
7178
7177
  for (const i of this.optimisticEntities.keys())
7179
7178
  t.has(i) && this.optimisticEntities.delete(i);
@@ -7212,7 +7211,7 @@ class Wd {
7212
7211
  for (const e of this.listeners) e(this.getState());
7213
7212
  }
7214
7213
  }
7215
- function Xe(s) {
7214
+ function Ye(s) {
7216
7215
  return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
7217
7216
  }
7218
7217
  function Oa(s, e) {
@@ -7332,11 +7331,11 @@ function Jd(s) {
7332
7331
  case "runtime.warmup":
7333
7332
  return e.reason === "panel_open" || e.reason === "extension_install" || e.reason === "composer_input";
7334
7333
  case "runtime.report_operation_timing":
7335
- return Fe(e.timing);
7334
+ return ze(e.timing);
7336
7335
  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);
7336
+ return (e.errorDiagnostic === void 0 || dr(e.errorDiagnostic)) && (e.httpRequest === void 0 || de(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
7337
  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");
7338
+ 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" || Na(e.reason)) && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
7340
7339
  case "runtime.widget_lifecycle":
7341
7340
  return (e.action === "opened" || e.action === "closed" || e.action === "minimized") && typeof e.trigger == "string";
7342
7341
  case "session.load":
@@ -7453,7 +7452,7 @@ class Qd {
7453
7452
  this.dispatch({ type: "runtime.widget_lifecycle", action: e, trigger: t });
7454
7453
  }
7455
7454
  reportOperationTiming(e) {
7456
- !this.destroyed && Fe(e) && this.adapter.dispatch({ type: "runtime.report_operation_timing", timing: e }).catch(() => {
7455
+ !this.destroyed && ze(e) && this.adapter.dispatch({ type: "runtime.report_operation_timing", timing: e }).catch(() => {
7457
7456
  });
7458
7457
  }
7459
7458
  reportResponseVisibility(e) {
@@ -7461,7 +7460,7 @@ class Qd {
7461
7460
  });
7462
7461
  }
7463
7462
  reportInvalidStateTransition(e, t, i) {
7464
- i !== void 0 && !qs(i) || this.adapter.dispatch({
7463
+ i !== void 0 && !Cs(i) || this.adapter.dispatch({
7465
7464
  type: "runtime.report_invalid_state_transition",
7466
7465
  reason: e,
7467
7466
  clientMessageId: t,
@@ -7471,7 +7470,7 @@ class Qd {
7471
7470
  }
7472
7471
  reportDisplayedError(e, t, i, n, r) {
7473
7472
  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;
7473
+ if (n !== void 0 && !qs(n) || r !== void 0 && !Es(r)) return;
7475
7474
  const o = Xi(this.getState(), e, i, !!n, this.adapter.diagnosticBuilds);
7476
7475
  this.adapter.dispatch({
7477
7476
  type: "runtime.report_displayed_error",
@@ -7482,7 +7481,7 @@ class Qd {
7482
7481
  ...n ? { renderedError: n } : {},
7483
7482
  ...r ? { historyRefreshFailure: r } : {},
7484
7483
  ...de(a) ? { httpRequest: a } : {},
7485
- ...i ? { displayedMessage: we(i) } : {}
7484
+ ...i ? { displayedMessage: _e(i) } : {}
7486
7485
  }).catch(() => {
7487
7486
  });
7488
7487
  }
@@ -7874,7 +7873,7 @@ function Wt(s) {
7874
7873
  }
7875
7874
  return { ...e, ...hr(s) };
7876
7875
  }
7877
- function _e(s, e, t) {
7876
+ function Se(s, e, t) {
7878
7877
  if (typeof window > "u")
7879
7878
  return;
7880
7879
  const i = window.__PLUNO_PRODUCT_AGENT_TRACE_ID__;
@@ -7900,7 +7899,7 @@ const Wa = "https://app.pluno.ai", Va = 2e4, Ga = 1e4, Ja = 6e4, Qa = 6e4, Xa =
7900
7899
  ".png:image/png",
7901
7900
  ".webp:image/webp"
7902
7901
  ]), 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();
7903
- let Ye = null;
7902
+ let Ze = null;
7904
7903
  function cc(s, e = Math.random) {
7905
7904
  const t = Math.min(_s, Za * 2 ** s), i = 1 - ki + e() * ki * 2;
7906
7905
  return Math.min(_s, Math.round(t * i));
@@ -7926,7 +7925,7 @@ function Qt(s) {
7926
7925
  }
7927
7926
  return !0;
7928
7927
  }
7929
- function Pe(s) {
7928
+ function xe(s) {
7930
7929
  if (s instanceof Error)
7931
7930
  return s;
7932
7931
  if (s && typeof s == "object") {
@@ -8158,7 +8157,7 @@ class _t {
8158
8157
  isActiveTurn: (t) => this.clientRuntime.engine.getProjection().directory.activityBySessionId[t] === !0,
8159
8158
  nextRequestId: j,
8160
8159
  onError: (t) => {
8161
- this.handleDirectoryTransportError(t), this.emit("error", Pe(t));
8160
+ this.handleDirectoryTransportError(t), this.emit("error", xe(t));
8162
8161
  },
8163
8162
  wakeup: { start: () => {
8164
8163
  }, stop: () => {
@@ -8174,7 +8173,7 @@ class _t {
8174
8173
  operationTimingReporter = () => {
8175
8174
  };
8176
8175
  reportOperationTiming(e) {
8177
- Fe(e) && this.operationTimingReporter(e);
8176
+ ze(e) && this.operationTimingReporter(e);
8178
8177
  }
8179
8178
  async initializeConversation() {
8180
8179
  const e = ++this.conversationAdapterGeneration;
@@ -8263,7 +8262,7 @@ class _t {
8263
8262
  onTiming: (h) => {
8264
8263
  i() && this.reportOperationTiming(h);
8265
8264
  },
8266
- onCommand: (h) => _e("client_event", h.type, Wt({ ...h.payload, type: h.type })),
8265
+ onCommand: (h) => Se("client_event", h.type, Wt({ ...h.payload, type: h.type })),
8267
8266
  onError: (h, y) => {
8268
8267
  if (this.options.productVariant === "customer_embedded" && y.operation === "conversation.snapshot" && h instanceof w && h.code === "conversation_access_denied") {
8269
8268
  y.sessionId === this.getState().sessionId && this.startNewSession({ notifyTransport: !1 });
@@ -8350,7 +8349,7 @@ class _t {
8350
8349
  }
8351
8350
  for (const [v, _] of Object.entries(h.directory.clients)) {
8352
8351
  if (!v.startsWith(`background:${this.modelClientScopeId}:`)) continue;
8353
- const S = ve(h.conversation, h.directory, _), A = S.sessionId ? h.conversation.sessions[S.sessionId] : void 0;
8352
+ const S = Ie(h.conversation, h.directory, _), A = S.sessionId ? h.conversation.sessions[S.sessionId] : void 0;
8354
8353
  if (this.firstResponseTimersByClientMessageId.size && (l(Ot(S, A?.queries.current, this.options.backendUrl).messages, S.sessionId), ["failed", "stopped"].includes(S.activity.phase)))
8355
8354
  for (const H of se(A?.execution)) this.clearFirstResponseTimer(H);
8356
8355
  const C = S.activity.phase === "completed" && se(A?.execution).some((H) => this.firstResponseTimersByClientMessageId.has(H));
@@ -8417,7 +8416,7 @@ class _t {
8417
8416
  return i.add(t), this.listeners[e] = i, () => i.delete(t);
8418
8417
  }
8419
8418
  getState() {
8420
- const e = this.clientRuntime.engine.getState().slices, t = e.directory.clients[this.modelClientScopeId] ?? this.directoryConversationScopeId, i = ve(e.conversation, e.directory, t), n = Ot(
8419
+ const e = this.clientRuntime.engine.getState().slices, t = e.directory.clients[this.modelClientScopeId] ?? this.directoryConversationScopeId, i = Ie(e.conversation, e.directory, t), n = Ot(
8421
8420
  i,
8422
8421
  i.sessionId ? e.conversation.sessions[i.sessionId]?.queries.current : void 0,
8423
8422
  this.options.backendUrl,
@@ -8599,7 +8598,7 @@ class _t {
8599
8598
  this.handleDirectoryTransportError(r);
8600
8599
  return;
8601
8600
  }
8602
- const a = Pe(r);
8601
+ const a = xe(r);
8603
8602
  if (Qt(r)) {
8604
8603
  $("web-sdk.agent", "Pluno connection attempt failed; retrying", {
8605
8604
  message: a.message,
@@ -8645,7 +8644,7 @@ class _t {
8645
8644
  this.authenticatingWarmupHints.delete(o), !(this.clientRuntime.isDisposed || r !== this.submissionIntentRevision || a && a !== this.authenticatedUserId) && this.warmup(e);
8646
8645
  }, (c) => {
8647
8646
  this.authenticatingWarmupHints.delete(o), this.clientRuntime.isDisposed || $("web-sdk.warmup", "Authentication did not admit the warm-up hint", {
8648
- message: Pe(c).message
8647
+ message: xe(c).message
8649
8648
  });
8650
8649
  });
8651
8650
  return;
@@ -8764,7 +8763,7 @@ class _t {
8764
8763
  No(this, this.options.entrySurface, e);
8765
8764
  }
8766
8765
  reportInvalidStateTransition(e, t, i) {
8767
- i !== void 0 && !qs(i) || this.reportHealthSignal("invalid_state_transition", {
8766
+ i !== void 0 && !Cs(i) || this.reportHealthSignal("invalid_state_transition", {
8768
8767
  reason: e,
8769
8768
  clientMessageId: t,
8770
8769
  ...i ? { uiInvariant: i } : {}
@@ -8772,7 +8771,7 @@ class _t {
8772
8771
  }
8773
8772
  reportDisplayedError(e, t, i, n, r) {
8774
8773
  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;
8774
+ if (n !== void 0 && !qs(n) || r !== void 0 && !Es(r)) return;
8776
8775
  const o = Xi(this.getState(), e, i, !!n);
8777
8776
  this.reportHealthSignal("user_visible_error", {
8778
8777
  errorDiagnostic: o,
@@ -8782,7 +8781,7 @@ class _t {
8782
8781
  ...n ? { renderedError: n } : {},
8783
8782
  ...r ? { historyRefreshFailure: r } : {},
8784
8783
  ...de(a) ? { httpRequest: a } : {},
8785
- ...i ? { displayedMessage: we(i) } : {}
8784
+ ...i ? { displayedMessage: _e(i) } : {}
8786
8785
  });
8787
8786
  }
8788
8787
  getModel() {
@@ -8796,11 +8795,11 @@ class _t {
8796
8795
  } });
8797
8796
  }
8798
8797
  retryLastMessage(e) {
8799
- const t = this.clientRuntime.engine.getState().slices, i = t.directory.clients[this.modelClientScopeId], n = ve(t.conversation, t.directory, i), r = Yi(n, e);
8798
+ 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
8799
  if (!r) return !1;
8801
8800
  if (r.type === "preparation") {
8802
8801
  const a = j(), o = Rr(r.submission);
8803
- 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", Pe(c))), !0;
8802
+ 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
8803
  }
8805
8804
  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: {
8806
8805
  request_id: j(),
@@ -9295,7 +9294,7 @@ class _t {
9295
9294
  })), !0;
9296
9295
  }
9297
9296
  try {
9298
- return t.send(JSON.stringify(e)), _e("client_event", e.type, Wt(e)), !0;
9297
+ return t.send(JSON.stringify(e)), Se("client_event", e.type, Wt(e)), !0;
9299
9298
  } catch (i) {
9300
9299
  return $("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
9301
9300
  message: i instanceof Error ? i.message : String(i),
@@ -9309,7 +9308,7 @@ class _t {
9309
9308
  if (e === "first_response_slow" && t.sessionId && t.sessionId !== i.sessionId) {
9310
9309
  const { conversation: m, directory: h } = this.clientRuntime.engine.getState().slices, y = Object.values(h.clients).find((g) => h.selections[g]?.sessionId === t.sessionId);
9311
9310
  y && (i = { ...i, ...Ot(
9312
- ve(m, h, y),
9311
+ Ie(m, h, y),
9313
9312
  m.sessions[t.sessionId]?.queries.current,
9314
9313
  this.options.backendUrl
9315
9314
  ) });
@@ -9344,8 +9343,8 @@ class _t {
9344
9343
  ...t,
9345
9344
  ...t.renderedError?.runId ? { runId: t.renderedError.runId } : {}
9346
9345
  }, { errorDiagnostic: a, responseDiagnostics: o, renderedError: c, uiInvariant: d, timings: l, httpRequest: u, historyRefreshFailure: p, ...f } = r;
9347
- for (const m of l ?? []) _e("client_event", "operation_timing", { ...m });
9348
- if (_e("client_event", "runtime.health", {
9346
+ for (const m of l ?? []) Se("client_event", "operation_timing", { ...m });
9347
+ if (Se("client_event", "runtime.health", {
9349
9348
  ...f,
9350
9349
  signalName: e,
9351
9350
  ...p ? { historyRefreshConsecutiveFailures: p.consecutiveFailures, historyRefreshEpisodeId: p.episodeId } : {}
@@ -9435,12 +9434,12 @@ class _t {
9435
9434
  occurrenceCount: (o?.occurrenceCount ?? 0) + 1,
9436
9435
  maxReconnectAttempt: Math.max(o?.maxReconnectAttempt ?? 0, this.reconnectAttempts),
9437
9436
  connectivity: i,
9438
- sdkVersion: Cs,
9437
+ sdkVersion: Ts,
9439
9438
  stage: "socket_admission",
9440
9439
  ...t,
9441
9440
  connectionAttemptId: n
9442
9441
  };
9443
- this.transportDiagnosticEpisodes.set(r, c), this.transportDiagnosticEpisodes.size > 20 && this.transportDiagnosticEpisodes.delete(this.transportDiagnosticEpisodes.keys().next().value), e.startsWith("auth_") && _e("client_event", "authentication_diagnostic", { ...c }), [1, 3, 10, 30, 100].includes(c.occurrenceCount) && (this.pendingTransportDiagnostics = [
9442
+ this.transportDiagnosticEpisodes.set(r, c), this.transportDiagnosticEpisodes.size > 20 && this.transportDiagnosticEpisodes.delete(this.transportDiagnosticEpisodes.keys().next().value), e.startsWith("auth_") && Se("client_event", "authentication_diagnostic", { ...c }), [1, 3, 10, 30, 100].includes(c.occurrenceCount) && (this.pendingTransportDiagnostics = [
9444
9443
  ...this.pendingTransportDiagnostics.filter((d) => d.id !== c.id),
9445
9444
  c
9446
9445
  ], this.pendingTransportDiagnostics.splice(0, Math.max(0, this.pendingTransportDiagnostics.length - 20)), this.flushClientDiagnostics());
@@ -9620,7 +9619,7 @@ class _t {
9620
9619
  }
9621
9620
  }
9622
9621
  handleServerEvent(e) {
9623
- if (_e("server_event", e.type, Wt(e)), ["conversation.item.updated", "conversation.item.removed", "conversation.item.stream_finished", "conversation.execution.updated", "conversation.interaction.updated", "conversation.follow_ups.updated"].includes(e.type)) {
9622
+ if (Se("server_event", e.type, Wt(e)), ["conversation.item.updated", "conversation.item.removed", "conversation.item.stream_finished", "conversation.execution.updated", "conversation.interaction.updated", "conversation.follow_ups.updated"].includes(e.type)) {
9624
9623
  this.conversationObservation?.receive(e);
9625
9624
  return;
9626
9625
  }
@@ -9757,7 +9756,7 @@ class _t {
9757
9756
  }
9758
9757
  }
9759
9758
  async executeToolCall(e) {
9760
- const t = typeof e.sessionId == "string" ? e.sessionId : null, i = typeof e.callId == "string" ? e.callId : null, n = typeof e.toolName == "string" ? e.toolName : null, r = Ne(
9759
+ const t = typeof e.sessionId == "string" ? e.sessionId : null, i = typeof e.callId == "string" ? e.callId : null, n = typeof e.toolName == "string" ? e.toolName : null, r = Be(
9761
9760
  typeof e.summary == "string" ? e.summary : "Running browser tool"
9762
9761
  ), a = e.rawInput;
9763
9762
  if (!t || !i || !n)
@@ -10006,7 +10005,7 @@ class _t {
10006
10005
  this.directoryHttp.auth.token = c, a = "bootstrap", this.lastRecoveryStage = a, await this.replaceDefaultTransportCredentials(e), this.reportTransportDiagnostic("auth_refresh_validated", r);
10007
10006
  })().catch((c) => {
10008
10007
  if (this.socket !== e || this.state.status === "closed") throw c;
10009
- if (this.reportTransportDiagnostic("auth_refresh_failed", { ...r, ...this.connectionFailureDiagnostic(c, a) }), this.credentialRecoveryFailure = Pe(c), c instanceof w && ["unauthorized", "403", "update_required"].includes(c.code) || !Qt(c)) {
10008
+ 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
10009
  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);
10011
10010
  throw this.stopAuthentication(d), d;
10012
10011
  }
@@ -10089,7 +10088,7 @@ function uc() {
10089
10088
  }
10090
10089
  try {
10091
10090
  const g = f instanceof Request ? f : null, b = Id(f, g), v = Nn(m?.headers ?? g?.headers);
10092
- if (!Se(b, v, m?.body)) {
10091
+ if (!Re(b, v, m?.body)) {
10093
10092
  const S = {
10094
10093
  requestId: ts("fetch"),
10095
10094
  url: ae(b, Jt),
@@ -10130,15 +10129,15 @@ function uc() {
10130
10129
  requestHeaders: {},
10131
10130
  startedAtMs: Date.now(),
10132
10131
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
10133
- excluded: Se(v)
10132
+ excluded: Re(v)
10134
10133
  }), b;
10135
10134
  }, c = function(f, m) {
10136
10135
  const h = n.call(this, f, m), y = Yt.get(this);
10137
- return y && Object.keys(y.requestHeaders).length < $s && (y.requestHeaders[f] = Ks(f, m), y.excluded = y.excluded || Se(y.url, y.requestHeaders)), h;
10136
+ return y && Object.keys(y.requestHeaders).length < $s && (y.requestHeaders[f] = Ks(f, m), y.excluded = y.excluded || Re(y.url, y.requestHeaders)), h;
10138
10137
  }, d = function(f) {
10139
10138
  try {
10140
10139
  const m = Yt.get(this);
10141
- m && (m.excluded = m.excluded || Se(m.url, m.requestHeaders, f), m.requestBody = ji(f), m.excluded || this.addEventListener(
10140
+ m && (m.excluded = m.excluded || Re(m.url, m.requestHeaders, f), m.requestBody = ji(f), m.excluded || this.addEventListener(
10142
10141
  "loadend",
10143
10142
  () => {
10144
10143
  queueMicrotask(() => {
@@ -10190,7 +10189,7 @@ function uc() {
10190
10189
  l = new PerformanceObserver((p) => {
10191
10190
  for (const f of p.getEntries()) {
10192
10191
  const m = f;
10193
- if (m.initiatorType === "fetch" || m.initiatorType === "xmlhttprequest" || Se(m.name))
10192
+ if (m.initiatorType === "fetch" || m.initiatorType === "xmlhttprequest" || Re(m.name))
10194
10193
  continue;
10195
10194
  const h = performance.timeOrigin + m.startTime;
10196
10195
  e({
@@ -10478,8 +10477,8 @@ function qc() {
10478
10477
  };
10479
10478
  }
10480
10479
  function Cc(s) {
10481
- return ht.add(s), Ye || (Ye = Mc()), () => {
10482
- ht.delete(s), ht.size === 0 && (Ye?.(), Ye = null);
10480
+ return ht.add(s), Ze || (Ze = Mc()), () => {
10481
+ ht.delete(s), ht.size === 0 && (Ze?.(), Ze = null);
10483
10482
  };
10484
10483
  }
10485
10484
  function Mc() {
@@ -10504,7 +10503,7 @@ function Fs() {
10504
10503
  if (!document.body)
10505
10504
  return "";
10506
10505
  const s = [], e = [], t = (h, y) => {
10507
- const g = Te(y);
10506
+ const g = Ee(y);
10508
10507
  !g || e.includes(g) || (s.push([h, g]), e.push(g));
10509
10508
  };
10510
10509
  t("Selected text", window.getSelection()?.toString() ?? "");
@@ -10512,9 +10511,9 @@ function Fs() {
10512
10511
  (h) => Tn(h) && !h.parentElement?.closest(i)
10513
10512
  );
10514
10513
  for (const h of n.slice(0, 3))
10515
- t("Active overlay", Zt(Be(h), e));
10516
- const r = Pc(), a = r ? Zt(Be(r), e) : "";
10517
- t("Main page content", a), t("Additional visible page text", Zt(Be(document.body), e));
10514
+ t("Active overlay", Zt(je(h), e));
10515
+ const r = Pc(), a = r ? Zt(je(r), e) : "";
10516
+ t("Main page content", a), t("Additional visible page text", Zt(je(document.body), e));
10518
10517
  const o = s.map(([h, y]) => `${h}:
10519
10518
  ${y}`).join(`
10520
10519
 
@@ -10525,10 +10524,10 @@ Visible page text:
10525
10524
  `, u = 12e3 - d.length - l.length, p = Math.min(o.length, 7900), f = c.slice(0, u - p), m = o.slice(0, u - f.length);
10526
10525
  return `${d}${f}${l}${m}`;
10527
10526
  }
10528
- function Be(s) {
10527
+ function je(s) {
10529
10528
  return s.innerText ?? s.textContent ?? "";
10530
10529
  }
10531
- function Te(s) {
10530
+ function Ee(s) {
10532
10531
  return (s ?? "").replace(/\u00a0/g, " ").replace(/\r\n?/g, `
10533
10532
  `).split(`
10534
10533
  `).map((e) => e.replace(/[ \t]+/g, " ").trim()).join(`
@@ -10537,17 +10536,17 @@ function Te(s) {
10537
10536
  `).trim();
10538
10537
  }
10539
10538
  function Zt(s, e) {
10540
- let t = Te(s);
10539
+ let t = Ee(s);
10541
10540
  for (const i of e)
10542
10541
  t = t.replace(i, "");
10543
- return Te(t);
10542
+ return Ee(t);
10544
10543
  }
10545
10544
  function Tn(s) {
10546
10545
  const e = window.getComputedStyle(s);
10547
10546
  return e.display !== "none" && e.visibility !== "hidden" && s.getClientRects().length > 0;
10548
10547
  }
10549
10548
  function Pc() {
10550
- return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Tn).sort((s, e) => Be(e).length - Be(s).length)[0] ?? null;
10549
+ return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Tn).sort((s, e) => je(e).length - je(s).length)[0] ?? null;
10551
10550
  }
10552
10551
  function xc(s, e) {
10553
10552
  const t = /* @__PURE__ */ new Set([
@@ -10649,15 +10648,15 @@ function xc(s, e) {
10649
10648
  const N = h(q);
10650
10649
  P.set(N, (P.get(N) ?? 0) + 1);
10651
10650
  }
10652
- const L = /* @__PURE__ */ new Map(), ke = /* @__PURE__ */ new Map();
10651
+ const L = /* @__PURE__ */ new Map(), qe = /* @__PURE__ */ new Map();
10653
10652
  for (const q of k) {
10654
- const N = h(q), le = ke.get(N) ?? 0;
10655
- ke.set(N, le + 1), (P.get(N) ?? 0) > 8 && le >= 6 && !l.has(q) && L.set(N, (L.get(N) ?? 0) + 1);
10653
+ const N = h(q), le = qe.get(N) ?? 0;
10654
+ qe.set(N, le + 1), (P.get(N) ?? 0) > 8 && le >= 6 && !l.has(q) && L.set(N, (L.get(N) ?? 0) + 1);
10656
10655
  }
10657
- const Ke = /* @__PURE__ */ new Map(), Ws = /* @__PURE__ */ new Set(), Rt = [], Vs = [];
10656
+ const We = /* @__PURE__ */ new Map(), Ws = /* @__PURE__ */ new Set(), Rt = [], Vs = [];
10658
10657
  for (const q of k) {
10659
- const N = h(q), le = P.get(N) ?? 0, Qs = Ke.get(N) ?? 0;
10660
- if (Ke.set(N, Qs + 1), le > 8 && Qs >= 6 && !l.has(q)) {
10658
+ const N = h(q), le = P.get(N) ?? 0, Qs = We.get(N) ?? 0;
10659
+ if (We.set(N, Qs + 1), le > 8 && Qs >= 6 && !l.has(q)) {
10661
10660
  Ws.has(N) || (Rt.push([`… ${L.get(N) ?? 0} similar siblings omitted`]), Ws.add(N));
10662
10661
  continue;
10663
10662
  }
@@ -10668,15 +10667,15 @@ function xc(s, e) {
10668
10667
  if (C.shadowRoot)
10669
10668
  for (const q of Array.from(C.shadowRoot.children))
10670
10669
  q instanceof HTMLElement && At.push(A(q, H + 1));
10671
- const We = [...Vs, ...At], Tt = E.length > 0 || I || We.some((q) => q.hasUsefulContent), Gs = Te(
10672
- [E, ...We.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, qe = [];
10670
+ const Ve = [...Vs, ...At], Tt = E.length > 0 || I || Ve.some((q) => q.hasUsefulContent), Gs = Ee(
10671
+ [E, ...Ve.map((q) => q.textPreview)].filter(Boolean).join(" ")
10672
+ ).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 = [];
10674
10673
  if (Et) {
10675
- const q = We.some((le) => le.containsTextElement), N = i.has(B) && !q ? Gs : E;
10676
- qe.push(En(C, c, a, N.slice(0, 180)));
10674
+ const q = Ve.some((le) => le.containsTextElement), N = i.has(B) && !q ? Gs : E;
10675
+ Ce.push(En(C, c, a, N.slice(0, 180)));
10677
10676
  }
10678
10677
  for (const q of Rt)
10679
- qe.push(...Ze(q, kt));
10678
+ Ce.push(...et(q, kt));
10680
10679
  const qt = At.flatMap((q) => q.lines);
10681
10680
  if (qt.length > 0) {
10682
10681
  const q = qt.slice(0, 20);
@@ -10684,20 +10683,20 @@ function xc(s, e) {
10684
10683
  const N = B.includes("tooltip") || B.includes("popper") || B.includes("loader");
10685
10684
  if (H < 2 && !N) {
10686
10685
  const le = Et ? "#shadow-root" : `${B} #shadow-root`;
10687
- qe.push(...Ze([le, ...Ze(q, 1)], kt));
10686
+ Ce.push(...et([le, ...et(q, 1)], kt));
10688
10687
  } else
10689
- qe.push(...Ze(q, kt));
10688
+ Ce.push(...et(q, kt));
10690
10689
  }
10691
10690
  return {
10692
- lines: qe,
10691
+ lines: Ce,
10693
10692
  hasUsefulContent: Tt,
10694
10693
  textPreview: Gs,
10695
- containsTextElement: i.has(B) || We.some((q) => q.containsTextElement)
10694
+ containsTextElement: i.has(B) || Ve.some((q) => q.containsTextElement)
10696
10695
  };
10697
10696
  };
10698
10697
  return [`--- ${_} ---`, ...A(v, 0).lines].join(`
10699
10698
  `);
10700
- }, g = [], b = Te(window.getSelection()?.toString() ?? "");
10699
+ }, g = [], b = Ee(window.getSelection()?.toString() ?? "");
10701
10700
  b && g.push(`--- selected text ---
10702
10701
  ${JSON.stringify(b)}`), u.length > 0 && g.push(Uc(u, t, c, a));
10703
10702
  for (const v of s.slice(0, 3))
@@ -10795,14 +10794,14 @@ function Uc(s, e, t, i) {
10795
10794
  function Pi(s) {
10796
10795
  return s instanceof HTMLElement ? s : s?.parentElement instanceof HTMLElement ? s.parentElement : null;
10797
10796
  }
10798
- function Ze(s, e) {
10797
+ function et(s, e) {
10799
10798
  if (e === 0)
10800
10799
  return s;
10801
10800
  const t = " ".repeat(e);
10802
10801
  return s.map((i) => `${t}${i}`);
10803
10802
  }
10804
10803
  function kn(s) {
10805
- return Te(
10804
+ return Ee(
10806
10805
  Array.from(s.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
10807
10806
  );
10808
10807
  }
@@ -10947,7 +10946,7 @@ function Mn(s, e) {
10947
10946
  id: typeof n.id == "string" ? n.id : String(t.id ?? crypto.randomUUID()),
10948
10947
  role: "assistant",
10949
10948
  ...n.phase === "commentary" || n.phase === "final_answer" ? { phase: n.phase } : {},
10950
- content: Re(
10949
+ content: Ae(
10951
10950
  Ui(n.content),
10952
10951
  e
10953
10952
  ),
@@ -10964,7 +10963,7 @@ function Mn(s, e) {
10964
10963
  id: String(t.id ?? crypto.randomUUID()),
10965
10964
  role: r,
10966
10965
  ...n.phase === "commentary" || n.phase === "final_answer" ? { phase: n.phase } : {},
10967
- content: Re(
10966
+ content: Ae(
10968
10967
  Ui(n.content),
10969
10968
  e
10970
10969
  ),
@@ -11000,7 +10999,7 @@ function Mn(s, e) {
11000
10999
  ...z(n) ? { runId: z(n) } : {},
11001
11000
  dataType: "function_call_output",
11002
11001
  toolName: Bs,
11003
- callId: xe(n) ?? void 0,
11002
+ callId: De(n) ?? void 0,
11004
11003
  sharePromptAllowed: r
11005
11004
  };
11006
11005
  const a = Sa(n.output);
@@ -11015,7 +11014,7 @@ function Mn(s, e) {
11015
11014
  ...z(n) ? { runId: z(n) } : {},
11016
11015
  dataType: "scheduled_check_in",
11017
11016
  toolName: _n,
11018
- callId: xe(n) ?? void 0,
11017
+ callId: De(n) ?? void 0,
11019
11018
  scheduledCheckInId: a.id ?? void 0,
11020
11019
  scheduledCheckInAt: a.dueAt
11021
11020
  };
@@ -11031,7 +11030,7 @@ function Mn(s, e) {
11031
11030
  ...z(n) ? { runId: z(n) } : {},
11032
11031
  dataType: "function_call_output",
11033
11032
  toolName: "authenticate_pipedream_app",
11034
- callId: xe(n) ?? void 0,
11033
+ callId: De(n) ?? void 0,
11035
11034
  integrationAuthRequest: o
11036
11035
  } : c ? {
11037
11036
  id: String(t.id ?? crypto.randomUUID()),
@@ -11044,7 +11043,7 @@ function Mn(s, e) {
11044
11043
  ...z(n) ? { runId: z(n) } : {},
11045
11044
  dataType: "function_call_output",
11046
11045
  toolName: "request_personal_channel_connection",
11047
- callId: xe(n) ?? void 0,
11046
+ callId: De(n) ?? void 0,
11048
11047
  personalChannelConnectionRequest: c
11049
11048
  } : null;
11050
11049
  }
@@ -11059,7 +11058,7 @@ function Mn(s, e) {
11059
11058
  ...z(n) ? { runId: z(n) } : {},
11060
11059
  dataType: String(n.type),
11061
11060
  toolName: n.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof n.name == "string" ? n.name : void 0,
11062
- callId: xe(n) ?? void 0,
11061
+ callId: De(n) ?? void 0,
11063
11062
  loading: n.steered === !0 ? !1 : n.localExecutionStatus === "queued" || n.localExecutionStatus === "running" ? !0 : typeof n.localExecutionStatus == "string" ? !1 : void 0,
11064
11063
  ...n.steered === !0 ? { steered: !0 } : {}
11065
11064
  } : n.type === "run_status" || n.type === "run_error" ? n.type === "run_error" && n.stage === "tool_execution" ? null : {
@@ -11133,22 +11132,22 @@ function Jc(s) {
11133
11132
  }
11134
11133
  function Qc(s) {
11135
11134
  if (typeof s.summary == "string" && s.summary.trim().length > 0)
11136
- return Ne(s.summary);
11135
+ return Be(s.summary);
11137
11136
  if (typeof s.arguments == "string")
11138
11137
  try {
11139
11138
  const e = JSON.parse(s.arguments);
11140
11139
  if (typeof e.summary == "string" && e.summary.trim().length > 0)
11141
- return Ne(e.summary);
11140
+ return Be(e.summary);
11142
11141
  } catch {
11143
- return typeof s.name == "string" && s.name.trim().length > 0 ? Ne(s.name) : "🛠️ Run tool";
11142
+ return typeof s.name == "string" && s.name.trim().length > 0 ? Be(s.name) : "🛠️ Run tool";
11144
11143
  }
11145
- return typeof s.name == "string" && s.name.trim().length > 0 ? Ne(s.name) : "🛠️ Run tool";
11144
+ return typeof s.name == "string" && s.name.trim().length > 0 ? Be(s.name) : "🛠️ Run tool";
11146
11145
  }
11147
- function Ne(s) {
11146
+ function Be(s) {
11148
11147
  const e = s.trim() || "Run tool", t = e.codePointAt(0) ?? 0;
11149
11148
  return t >= 126976 && t <= 129791 || t >= 9728 && t <= 10175 || t >= 127462 && t <= 127487 ? e : `🛠️ ${e}`;
11150
11149
  }
11151
- function xe(s) {
11150
+ function De(s) {
11152
11151
  const e = s.callId ?? s.call_id;
11153
11152
  return typeof e == "string" && e ? e : null;
11154
11153
  }
@@ -11186,7 +11185,7 @@ function Zc(s, e) {
11186
11185
  }
11187
11186
  function ed(s, e, t) {
11188
11187
  const i = s[e], n = s[t];
11189
- if (He(i, n))
11188
+ if (Ke(i, n))
11190
11189
  return !0;
11191
11190
  if (!i.respondsToUserMessageId || n.respondsToUserMessageId || !i.runId || i.runId !== n.runId)
11192
11191
  return !1;
@@ -11199,7 +11198,7 @@ function td(s, e) {
11199
11198
  const t = s[e];
11200
11199
  for (let i = e + 1; i < s.length; i += 1) {
11201
11200
  const n = s[i];
11202
- if (n.role === "assistant" && He(t, n))
11201
+ if (n.role === "assistant" && Ke(t, n))
11203
11202
  return !0;
11204
11203
  }
11205
11204
  return !1;
@@ -11220,23 +11219,23 @@ function sd(s, e) {
11220
11219
  function id(s, e) {
11221
11220
  const t = s[e];
11222
11221
  return s.some(
11223
- (i, n) => n !== e && i.role === "assistant" && He(t, i)
11222
+ (i, n) => n !== e && i.role === "assistant" && Ke(t, i)
11224
11223
  );
11225
11224
  }
11226
11225
  function nd(s, e) {
11227
11226
  const t = s[e];
11228
11227
  return s.some(
11229
- (i, n) => n !== e && i.role === "tool" && He(t, i)
11228
+ (i, n) => n !== e && i.role === "tool" && Ke(t, i)
11230
11229
  );
11231
11230
  }
11232
11231
  function rd(s, e) {
11233
11232
  const t = s[e];
11234
11233
  for (let i = e + 1; i < s.length; i += 1)
11235
- if (zs(s[i]) && He(t, s[i]))
11234
+ if (zs(s[i]) && Ke(t, s[i]))
11236
11235
  return !0;
11237
11236
  return !1;
11238
11237
  }
11239
- function He(s, e) {
11238
+ function Ke(s, e) {
11240
11239
  return !!(s.respondsToUserMessageId && s.respondsToUserMessageId === e.respondsToUserMessageId);
11241
11240
  }
11242
11241
  function es(s, e) {
@@ -11559,7 +11558,7 @@ function Bn(s) {
11559
11558
  const e = s.get("content-type")?.toLowerCase() ?? "", t = s.get("content-length"), i = Number(t);
11560
11559
  return t !== null && Number.isInteger(i) && i >= 0 && i <= Ls && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
11561
11560
  }
11562
- function Se(s, e = {}, t) {
11561
+ function Re(s, e = {}, t) {
11563
11562
  if (Ad(t))
11564
11563
  return !0;
11565
11564
  const i = Object.entries(e).find(([n]) => n.toLowerCase() === "content-type")?.[1]?.toLowerCase();
@@ -11576,7 +11575,7 @@ function Se(s, e = {}, t) {
11576
11575
  }
11577
11576
  }
11578
11577
  function Rd(s, e) {
11579
- if (Se(s))
11578
+ if (Re(s))
11580
11579
  return !0;
11581
11580
  try {
11582
11581
  const t = new URL(s, location.href), i = new URL(e);