@pluno/product-agent-web 0.1.257 → 0.1.259
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/conversation/contracts.d.ts +3 -1
- package/dist/core/conversation/display.d.ts +1 -0
- package/dist/core/conversation/selectors.d.ts +1 -0
- package/dist/product-agent-runtime.cjs +1 -1
- package/dist/product-agent-runtime.js +54 -55
- package/dist/product-agent-sdk.js +765 -746
- package/dist/product-agent-widget.js +3462 -3413
- package/dist/renderDiagnostics.d.ts +7 -1
- package/package.json +1 -1
|
@@ -93,7 +93,7 @@ function v(s) {
|
|
|
93
93
|
nextCursor: s.nextCursor
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function B(s, e, t) {
|
|
97
97
|
if (t === "replace" || s === null) return e;
|
|
98
98
|
const i = { ...s.entitiesById, ...e.entitiesById }, n = [...s.ids];
|
|
99
99
|
for (const r of e.ids)
|
|
@@ -114,13 +114,13 @@ function Se(s) {
|
|
|
114
114
|
const e = s.paidCreditFallbackModel;
|
|
115
115
|
return typeof e == "string" && e.length > 0;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function Ae(s) {
|
|
118
118
|
return s ? s.submissionGate?.allowed === !1 ? { state: "action_required", reason: s.submissionGate.reason } : s.usingPaidCreditFallback === !0 ? { state: "paid_credit_fallback" } : s.creditLimit !== null && s.creditLimit > 0 && s.creditsRemaining !== null && s.creditsRemaining > 0 && s.creditsRemaining / s.creditLimit <= 0.2 ? { state: "low_credits" } : s.creditsUsed !== null ? { state: "usage" } : { state: "hidden" } : { state: "hidden" };
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function we(s) {
|
|
121
121
|
return s.submissionAllowed && s.isAuthenticated && s.hasWorkspace && !s.isWebsiteBlocked && s.isCurrentPageResolved && !s.isSubmitting && !s.hasPendingMessage;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function Me(s) {
|
|
124
124
|
const e = s.hasDraftMessage || s.hasPreSubmittedAttachment;
|
|
125
125
|
return s.hasRunningAssistantTurn && !e ? {
|
|
126
126
|
action: "stop",
|
|
@@ -134,7 +134,7 @@ const H = "Pluno is reconnecting. Try again in a moment.";
|
|
|
134
134
|
function Z(s) {
|
|
135
135
|
return (s instanceof Error ? s.message : s) === H;
|
|
136
136
|
}
|
|
137
|
-
class
|
|
137
|
+
class Te {
|
|
138
138
|
constructor(e, t, i = 20) {
|
|
139
139
|
this.loadPage = t, this.limit = i, this.recentQuery = new O(
|
|
140
140
|
`${e}:recent`,
|
|
@@ -144,7 +144,7 @@ class Ee {
|
|
|
144
144
|
nextCursor: r.nextCursor
|
|
145
145
|
}))
|
|
146
146
|
),
|
|
147
|
-
|
|
147
|
+
B
|
|
148
148
|
), this.pinnedQuery = new O(
|
|
149
149
|
`${e}:pinned`,
|
|
150
150
|
async () => v({
|
|
@@ -320,10 +320,10 @@ function W(s, e) {
|
|
|
320
320
|
return !0;
|
|
321
321
|
return !1;
|
|
322
322
|
}
|
|
323
|
-
class
|
|
323
|
+
class Ee {
|
|
324
324
|
constructor(e, t = null) {
|
|
325
325
|
this.storage = e, t && (this.decisions = new Map(
|
|
326
|
-
t.filter(
|
|
326
|
+
t.filter(w).map((i) => [this.getDecisionKey(i), i])
|
|
327
327
|
), this.initialized = !0);
|
|
328
328
|
}
|
|
329
329
|
storage;
|
|
@@ -401,7 +401,7 @@ class Me {
|
|
|
401
401
|
if (this.initialized) return;
|
|
402
402
|
const e = await this.storage.load();
|
|
403
403
|
this.decisions = new Map(
|
|
404
|
-
e.filter(
|
|
404
|
+
e.filter(w).map((t) => [this.getDecisionKey(t), t])
|
|
405
405
|
), this.initialized = !0;
|
|
406
406
|
}
|
|
407
407
|
isEligible(e, t = Date.now()) {
|
|
@@ -483,7 +483,7 @@ function Y(s, e) {
|
|
|
483
483
|
const t = s.getItem(e);
|
|
484
484
|
if (!t) return [];
|
|
485
485
|
const i = JSON.parse(t);
|
|
486
|
-
return Array.isArray(i) ? i.filter(
|
|
486
|
+
return Array.isArray(i) ? i.filter(w) : [];
|
|
487
487
|
}
|
|
488
488
|
function _(s) {
|
|
489
489
|
return `${s.level}:${s.key}`;
|
|
@@ -491,7 +491,7 @@ function _(s) {
|
|
|
491
491
|
function z(s) {
|
|
492
492
|
return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
|
|
493
493
|
}
|
|
494
|
-
function
|
|
494
|
+
function w(s) {
|
|
495
495
|
if (!s || typeof s != "object") return !1;
|
|
496
496
|
const e = s;
|
|
497
497
|
return typeof e.promptKey == "string" && typeof e.category == "string" && typeof e.decidedAt == "string" && (e.nextEligibleAt === null || typeof e.nextEligibleAt == "string") && z(e.action) && !!(e.scope && typeof e.scope == "object" && typeof e.scope.level == "string" && typeof e.scope.key == "string");
|
|
@@ -564,52 +564,51 @@ function qe(s) {
|
|
|
564
564
|
function I(s) {
|
|
565
565
|
return s.replace(ee, "");
|
|
566
566
|
}
|
|
567
|
-
const
|
|
568
|
-
|
|
567
|
+
const se = "0.1.259", ie = {
|
|
568
|
+
version: se
|
|
569
|
+
}, p = (s) => typeof s == "string" && /^[a-zA-Z0-9:_.-]{1,160}$/.test(s) ? s : null;
|
|
570
|
+
function ne(s) {
|
|
569
571
|
if (!s || typeof s != "object") return !1;
|
|
570
572
|
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) && p(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 || p(r) !== null) && (n.projectionReady === null || typeof n.projectionReady == "boolean");
|
|
571
573
|
return Object.keys(e).every((n) => ["ownerId", "revision", "dropped", "lastIntent", "lastSelection", "transitions"].includes(n)) && p(e.ownerId) !== null && t(e.revision) && t(e.dropped) && (e.lastIntent == null || i(e.lastIntent)) && (e.lastSelection === null || i(e.lastSelection)) && Array.isArray(e.transitions) && e.transitions.length <= 16 && e.transitions.every(i);
|
|
572
574
|
}
|
|
573
|
-
function
|
|
575
|
+
function $(s) {
|
|
574
576
|
if (!s || typeof s != "object") return !1;
|
|
575
577
|
const e = s;
|
|
576
578
|
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;
|
|
577
579
|
}
|
|
578
|
-
const
|
|
579
|
-
function
|
|
580
|
+
const k = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"], M = (s) => typeof s == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(s), h = (s) => s === null || M(s), re = (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));
|
|
581
|
+
function K(s) {
|
|
580
582
|
if (!s || typeof s != "object") return !1;
|
|
581
583
|
const e = s;
|
|
582
|
-
return Object.keys(s).every((t) => ["sessionId", "itemId", "userMessageId", "createdAt", "runId", "retryable"].includes(t)) && h(e.sessionId) &&
|
|
584
|
+
return Object.keys(s).every((t) => ["sessionId", "itemId", "userMessageId", "createdAt", "runId", "retryable"].includes(t)) && h(e.sessionId) && M(e.itemId) && h(e.userMessageId) && (e.retryable === void 0 || typeof e.retryable == "boolean") && h(e.runId) && (e.createdAt === null || re(e.createdAt));
|
|
583
585
|
}
|
|
584
|
-
function
|
|
586
|
+
function oe(s) {
|
|
585
587
|
if (!s || typeof s != "object") return !1;
|
|
586
588
|
const e = s, t = (i) => Number.isSafeInteger(i) && i >= 0;
|
|
587
|
-
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 || p(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 ||
|
|
589
|
+
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 || p(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 || ne(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));
|
|
588
590
|
}
|
|
589
591
|
function U(s) {
|
|
590
592
|
if (!s || typeof s != "object" || Object.keys(s).some((i) => i !== "before" && i !== "current")) return !1;
|
|
591
593
|
const e = (i) => {
|
|
592
594
|
if (!i || typeof i != "object") return !1;
|
|
593
595
|
const n = i;
|
|
594
|
-
return Object.keys(i).every((r) => [...
|
|
596
|
+
return Object.keys(i).every((r) => [...k, "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((o) => ["key", "count", "rows", "truncated"].includes(o)) && h(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((o) => o && Object.keys(o).every((a) => ["itemId", "groupId"].includes(a)) && h(o.itemId) && h(o.groupId)))) && (n.context === void 0 || oe(n.context)) && (n.thinkingSequence === void 0 || Array.isArray(n.thinkingSequence) && n.thinkingSequence.length <= 20 && n.thinkingSequence.every((r) => r === "user" || r === "thinking")) && h(n.sessionId) && Number.isSafeInteger(n.runtimeItemCount) && n.runtimeItemCount >= 0 && typeof n.welcome == "boolean" && typeof n.truncated == "boolean" && k.every((r) => Array.isArray(n[r]) && n[r].length <= 20 && n[r].every(M));
|
|
595
597
|
}, t = s;
|
|
596
598
|
return (t.before === null || e(t.before)) && e(t.current);
|
|
597
599
|
}
|
|
598
|
-
const
|
|
600
|
+
const R = 500;
|
|
599
601
|
function L(s) {
|
|
600
602
|
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();
|
|
601
|
-
return e.length >
|
|
603
|
+
return e.length > R ? `${e.slice(0, R - 1)}…` : e;
|
|
602
604
|
}
|
|
603
|
-
function
|
|
605
|
+
function ae(s) {
|
|
604
606
|
let e = 2166136261;
|
|
605
607
|
for (let t = 0; t < s.length; t += 1)
|
|
606
608
|
e ^= s.charCodeAt(t), e = Math.imul(e, 16777619);
|
|
607
609
|
return `fnv1a-${(e >>> 0).toString(16).padStart(8, "0")}`;
|
|
608
610
|
}
|
|
609
|
-
|
|
610
|
-
version: oe
|
|
611
|
-
};
|
|
612
|
-
function E(s) {
|
|
611
|
+
function T(s) {
|
|
613
612
|
if (!s || typeof s != "object") return !1;
|
|
614
613
|
const e = s;
|
|
615
614
|
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);
|
|
@@ -617,17 +616,17 @@ function E(s) {
|
|
|
617
616
|
function de(s) {
|
|
618
617
|
if (!s || typeof s != "object") return !1;
|
|
619
618
|
const e = s;
|
|
620
|
-
return Object.keys(e).every((t) => ["sessionId", "requestId", "code", "normalization", "builds", "clientMessageId"].includes(t)) && (e.clientMessageId === void 0 || p(e.clientMessageId) !== null) && [e.sessionId, e.requestId, e.code].every((t) => t === null || p(t) !== null) && (e.normalization === void 0 ||
|
|
619
|
+
return Object.keys(e).every((t) => ["sessionId", "requestId", "code", "normalization", "builds", "clientMessageId"].includes(t)) && (e.clientMessageId === void 0 || p(e.clientMessageId) !== null) && [e.sessionId, e.requestId, e.code].every((t) => t === null || p(t) !== null) && (e.normalization === void 0 || T(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));
|
|
621
620
|
}
|
|
622
621
|
function ce(s, e, t, i, n = {}) {
|
|
623
|
-
const r = !i && e === "conversation_error" && t !== void 0 && s.conversationDiagnostics?.errorMessageFingerprint ===
|
|
622
|
+
const r = !i && e === "conversation_error" && t !== void 0 && s.conversationDiagnostics?.errorMessageFingerprint === ae(L(t)) ? s.conversationDiagnostics : void 0;
|
|
624
623
|
return {
|
|
625
624
|
sessionId: p(s.sessionId),
|
|
626
625
|
requestId: p(r?.httpRequest?.requestId ?? r?.errorRequestId ?? r?.queryRequestId),
|
|
627
626
|
...p(r?.failedClientMessageId) ? { clientMessageId: r.failedClientMessageId } : {},
|
|
628
627
|
code: r ? p(s.lastErrorCode) : null,
|
|
629
|
-
...
|
|
630
|
-
builds: { sdk:
|
|
628
|
+
...T(r?.errorNormalization) ? { normalization: r.errorNormalization } : {},
|
|
629
|
+
builds: { sdk: ie.version, ...n }
|
|
631
630
|
};
|
|
632
631
|
}
|
|
633
632
|
function le(s) {
|
|
@@ -643,7 +642,7 @@ function le(s) {
|
|
|
643
642
|
function g(s, e = "runtime_error", t = "runtime") {
|
|
644
643
|
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, o = i && "details" in i ? i.details : null, a = o && typeof o == "object" ? o : {}, d = {
|
|
645
644
|
// Preserve the first boundary's shape after normalization replaces the original message/prototype.
|
|
646
|
-
errorNormalization:
|
|
645
|
+
errorNormalization: T(a.errorNormalization) ? a.errorNormalization : {
|
|
647
646
|
boundary: t,
|
|
648
647
|
category: s instanceof Error ? "error" : s === null ? "null" : Array.isArray(s) ? "array" : typeof s,
|
|
649
648
|
messageKind: n.trim() === "[object Object]" ? "object_coercion" : n.trim() ? "text" : typeof s == "string" || i && "message" in i && typeof i.message == "string" ? "blank" : "non_text"
|
|
@@ -730,7 +729,7 @@ const ue = [
|
|
|
730
729
|
"acceptance_applied",
|
|
731
730
|
"cancellation_queue",
|
|
732
731
|
"cancellation_write"
|
|
733
|
-
],
|
|
732
|
+
], G = [
|
|
734
733
|
"request_timed_out",
|
|
735
734
|
"delivery_unknown",
|
|
736
735
|
"invalid_ack",
|
|
@@ -748,15 +747,15 @@ const ue = [
|
|
|
748
747
|
];
|
|
749
748
|
function pe(s) {
|
|
750
749
|
const e = s, t = e?.code;
|
|
751
|
-
return e?.backendRefusal === !0 ? "backend_refusal" : typeof t == "string" && t !== "backend_refusal" &&
|
|
750
|
+
return e?.backendRefusal === !0 ? "backend_refusal" : typeof t == "string" && t !== "backend_refusal" && G.includes(t) ? t : e?.name === "AbortError" ? "aborted" : e?.name === "TypeError" ? "type_error" : "unknown";
|
|
752
751
|
}
|
|
753
752
|
const he = Math.random().toString(36).slice(2);
|
|
754
753
|
let ge = 0;
|
|
755
754
|
const C = () => `timing:${he}:${++ge}`, y = (s) => typeof s == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(s);
|
|
756
|
-
function
|
|
755
|
+
function E(s) {
|
|
757
756
|
if (!s || typeof s != "object") return !1;
|
|
758
757
|
const e = s;
|
|
759
|
-
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" &&
|
|
758
|
+
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" && G.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) && ue.includes(e.stage) && ["started", "completed", "failed", "observed"].includes(e.status) && y(e.spanId) && y(e.requestId) && (e.clientMessageId === null || y(e.clientMessageId)) && (e.sessionId === null || y(e.sessionId)) && typeof e.occurredAt == "string" && e.occurredAt.length <= 40 && Number.isFinite(Date.parse(e.occurredAt)) && Number.isSafeInteger(e.durationMs) && e.durationMs >= 0;
|
|
760
759
|
}
|
|
761
760
|
function x(s, e) {
|
|
762
761
|
if (!s) return {
|
|
@@ -774,7 +773,7 @@ function x(s, e) {
|
|
|
774
773
|
durationMs: Math.max(0, Math.round(performance.now() - o)),
|
|
775
774
|
...r === "failed" ? { failureCategory: pe(d) } : {}
|
|
776
775
|
};
|
|
777
|
-
s &&
|
|
776
|
+
s && E(c) && Promise.resolve().then(() => s(c)).catch(() => {
|
|
778
777
|
});
|
|
779
778
|
};
|
|
780
779
|
return {
|
|
@@ -853,7 +852,7 @@ function D(s) {
|
|
|
853
852
|
...s.fileUrl === void 0 ? {} : { fileUrl: s.fileUrl }
|
|
854
853
|
};
|
|
855
854
|
}
|
|
856
|
-
function
|
|
855
|
+
function ke(s) {
|
|
857
856
|
if (!s || typeof s != "object" || !("type" in s)) return !1;
|
|
858
857
|
const e = s;
|
|
859
858
|
switch (e.type) {
|
|
@@ -869,9 +868,9 @@ function Re(s) {
|
|
|
869
868
|
case "runtime.warmup":
|
|
870
869
|
return e.reason === "panel_open" || e.reason === "extension_install" || e.reason === "composer_input";
|
|
871
870
|
case "runtime.report_operation_timing":
|
|
872
|
-
return
|
|
871
|
+
return E(e.timing);
|
|
873
872
|
case "runtime.report_displayed_error":
|
|
874
|
-
return (e.errorDiagnostic === void 0 || de(e.errorDiagnostic)) && (e.httpRequest === void 0 || F(e.httpRequest)) && (e.historyRefreshFailure === void 0 ||
|
|
873
|
+
return (e.errorDiagnostic === void 0 || de(e.errorDiagnostic)) && (e.httpRequest === void 0 || F(e.httpRequest)) && (e.historyRefreshFailure === void 0 || $(e.historyRefreshFailure)) && (e.renderedError === void 0 || K(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);
|
|
875
874
|
case "runtime.report_invalid_state_transition":
|
|
876
875
|
return (e.uiInvariant === void 0 || U(e.uiInvariant)) && (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" || ve(e.reason)) && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
|
|
877
876
|
case "runtime.widget_lifecycle":
|
|
@@ -901,9 +900,9 @@ function Re(s) {
|
|
|
901
900
|
return !1;
|
|
902
901
|
}
|
|
903
902
|
}
|
|
904
|
-
class
|
|
903
|
+
class Re {
|
|
905
904
|
constructor(e, t, i) {
|
|
906
|
-
this.adapter = t, this.state =
|
|
905
|
+
this.adapter = t, this.state = A(e), this.model = i;
|
|
907
906
|
}
|
|
908
907
|
adapter;
|
|
909
908
|
listeners = {};
|
|
@@ -931,7 +930,7 @@ class ke {
|
|
|
931
930
|
return i.add(t), this.listeners[e] = i, () => i.delete(t);
|
|
932
931
|
}
|
|
933
932
|
getState() {
|
|
934
|
-
const e =
|
|
933
|
+
const e = A(this.state);
|
|
935
934
|
for (const [n, r] of this.submissionPreviews)
|
|
936
935
|
e.messages.some((o) => o.id === n) || (e.messages.push({ ...r.message, attachments: r.message.attachments?.map((o) => ({ ...o })) }), e.segments && (e.segments = [...e.segments, { id: n, userMessageId: n, activityIds: [], outcomeIds: [], collapsed: !1 }]), e.isLoadingSession = !1, r.pending && (e.activeResponseUserMessageId = n, e.pendingMessageStatus = "sending", e.turnPhase = "sending", e.activity = { phase: "submitting", activeItemId: null }), r.error && (e.lastError = r.error, e.lastErrorCode = "message_delivery_failed"));
|
|
937
936
|
this.stopError && (e.lastError = this.stopError, e.lastErrorCode = "stop_failed");
|
|
@@ -946,7 +945,7 @@ class ke {
|
|
|
946
945
|
(o.user?.id !== e.user?.id || o.selectionKey !== void 0 && o.selectionKey !== e.selectionKey || o.selectionKey === void 0 && o.sessionId !== null && o.sessionId !== e.sessionId) && (this.cancelPendingSubmissions(), this.submissionPreviews.clear());
|
|
947
946
|
for (const a of e.messages)
|
|
948
947
|
a.role === "user" && this.submissionPreviews.delete(a.id);
|
|
949
|
-
this.state =
|
|
948
|
+
this.state = A(e);
|
|
950
949
|
for (const [a, d] of this.stopPreviews) {
|
|
951
950
|
const c = e.activity?.executionKey;
|
|
952
951
|
(d !== void 0 && d !== "[]" && c !== void 0 && c !== "[]" && (c !== d || ["completed", "failed", "stopped"].includes(e.activity.phase)) || (d === void 0 || d === "[]") && e.messages.some((u) => u.respondsToUserMessageId === a && !u.provisional && u.loading !== !0 && (u.dataType === "run_status" || u.dataType === "run_error" || u.role === "assistant" && u.phase !== "commentary" && (u.streamState === void 0 || ["finished", "stopped", "failed"].includes(u.streamState))))) && this.stopPreviews.delete(a);
|
|
@@ -990,7 +989,7 @@ class ke {
|
|
|
990
989
|
this.dispatch({ type: "runtime.widget_lifecycle", action: e, trigger: t });
|
|
991
990
|
}
|
|
992
991
|
reportOperationTiming(e) {
|
|
993
|
-
!this.destroyed &&
|
|
992
|
+
!this.destroyed && E(e) && this.adapter.dispatch({ type: "runtime.report_operation_timing", timing: e }).catch(() => {
|
|
994
993
|
});
|
|
995
994
|
}
|
|
996
995
|
reportResponseVisibility(e) {
|
|
@@ -1008,7 +1007,7 @@ class ke {
|
|
|
1008
1007
|
}
|
|
1009
1008
|
reportDisplayedError(e, t, i, n, r) {
|
|
1010
1009
|
const o = e === "conversation_error" && !n ? this.getState().conversationDiagnostics?.httpRequest : void 0;
|
|
1011
|
-
if (n !== void 0 &&
|
|
1010
|
+
if (n !== void 0 && !K(n) || r !== void 0 && !$(r)) return;
|
|
1012
1011
|
const a = ce(this.getState(), e, i, !!n, this.adapter.diagnosticBuilds);
|
|
1013
1012
|
this.adapter.dispatch({
|
|
1014
1013
|
type: "runtime.report_displayed_error",
|
|
@@ -1298,7 +1297,7 @@ function be(s, e) {
|
|
|
1298
1297
|
return n ? { ...i, previewUrl: n } : i;
|
|
1299
1298
|
});
|
|
1300
1299
|
}
|
|
1301
|
-
function
|
|
1300
|
+
function A(s) {
|
|
1302
1301
|
return {
|
|
1303
1302
|
...s,
|
|
1304
1303
|
starterPrompts: [...s.starterPrompts],
|
|
@@ -1333,25 +1332,25 @@ function j(s) {
|
|
|
1333
1332
|
}
|
|
1334
1333
|
export {
|
|
1335
1334
|
H as PRODUCT_AGENT_AUTH_RECONNECTING_ERROR_MESSAGE,
|
|
1336
|
-
|
|
1335
|
+
Ee as ProductAgentInteractionManager,
|
|
1337
1336
|
O as ProductAgentQueryController,
|
|
1338
|
-
|
|
1339
|
-
|
|
1337
|
+
Re as ProductAgentRemoteRuntimeClient,
|
|
1338
|
+
Te as ProductAgentSessionHistoryManager,
|
|
1340
1339
|
Oe as ProductAgentTaskPageTitleController,
|
|
1341
|
-
|
|
1340
|
+
we as canSubmitPersonalProductAgentMessage,
|
|
1342
1341
|
Pe as createLocalStorageInteractionDecisionStorage,
|
|
1343
1342
|
m as createProductAgentQueryState,
|
|
1344
1343
|
qe as createProductAgentTaskPageTitleDocument,
|
|
1345
1344
|
te as formatProductAgentTaskPageTitle,
|
|
1346
1345
|
Se as hasProductAgentPaidCreditFallback,
|
|
1347
1346
|
Z as isProductAgentAuthReconnectError,
|
|
1348
|
-
|
|
1349
|
-
|
|
1347
|
+
ke as isProductAgentRuntimeCommand,
|
|
1348
|
+
B as mergeProductAgentEntityPages,
|
|
1350
1349
|
v as normalizeProductAgentEntityPage,
|
|
1351
1350
|
Y as readLocalStorageInteractionDecisions,
|
|
1352
1351
|
_e as reconcileProductAgentSubmissionGate,
|
|
1353
|
-
|
|
1354
|
-
|
|
1352
|
+
Ae as resolveProductAgentBillingPresentation,
|
|
1353
|
+
Me as resolveProductAgentComposerAction,
|
|
1355
1354
|
Ie as resolveProductAgentWidgetPresentation,
|
|
1356
1355
|
Q as selectProductAgentQueryEntities
|
|
1357
1356
|
};
|