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