@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
|
@@ -8,7 +8,7 @@ function m(s) {
|
|
|
8
8
|
updatedAt: null
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
class
|
|
11
|
+
class O {
|
|
12
12
|
constructor(e, t, i = (n, r) => r) {
|
|
13
13
|
this.loader = t, this.merge = i, this.state = m(e);
|
|
14
14
|
}
|
|
@@ -83,7 +83,7 @@ class q {
|
|
|
83
83
|
for (const e of this.listeners) e(this.state);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function v(s) {
|
|
87
87
|
const e = {}, t = [];
|
|
88
88
|
for (const i of s.entities)
|
|
89
89
|
e[i.id] || t.push(i.id), e[i.id] = i;
|
|
@@ -103,10 +103,10 @@ function G(s, e, t) {
|
|
|
103
103
|
function Q(s) {
|
|
104
104
|
return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function Ie(s) {
|
|
107
107
|
return s.visible ? s.minimized ? { state: "minimized" } : { state: s.open ? "visible_open" : "visible_closed" } : { state: "hidden" };
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function _e(s, e) {
|
|
110
110
|
return e === "limit_exceeded" ? { allowed: !1, reason: "credits_exhausted", actions: ["upgrade", "earn_credits"] } : e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required" ? { allowed: !1, reason: "payment_issue", actions: ["upgrade"] } : s ?? { allowed: !0, reason: "allowed", actions: [] };
|
|
111
111
|
}
|
|
112
112
|
function Se(s) {
|
|
@@ -120,7 +120,7 @@ function we(s) {
|
|
|
120
120
|
function Ae(s) {
|
|
121
121
|
return s.submissionAllowed && s.isAuthenticated && s.hasWorkspace && !s.isWebsiteBlocked && s.isCurrentPageResolved && !s.isSubmitting && !s.hasPendingMessage;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function Te(s) {
|
|
124
124
|
const e = s.hasDraftMessage || s.hasPreSubmittedAttachment;
|
|
125
125
|
return s.hasRunningAssistantTurn && !e ? {
|
|
126
126
|
action: "stop",
|
|
@@ -134,20 +134,20 @@ 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 Ee {
|
|
138
138
|
constructor(e, t, i = 20) {
|
|
139
|
-
this.loadPage = t, this.limit = i, this.recentQuery = new
|
|
139
|
+
this.loadPage = t, this.limit = i, this.recentQuery = new O(
|
|
140
140
|
`${e}:recent`,
|
|
141
|
-
async ({ cursor: n }) =>
|
|
141
|
+
async ({ cursor: n }) => v(
|
|
142
142
|
await this.loadPage({ cursor: n, limit: this.limit, pinned: !1 }).then((r) => ({
|
|
143
143
|
entities: r.sessions,
|
|
144
144
|
nextCursor: r.nextCursor
|
|
145
145
|
}))
|
|
146
146
|
),
|
|
147
147
|
G
|
|
148
|
-
), this.pinnedQuery = new
|
|
148
|
+
), this.pinnedQuery = new O(
|
|
149
149
|
`${e}:pinned`,
|
|
150
|
-
async () =>
|
|
150
|
+
async () => v({
|
|
151
151
|
entities: await this.loadAllPinned(),
|
|
152
152
|
nextCursor: null
|
|
153
153
|
})
|
|
@@ -167,11 +167,11 @@ class Me {
|
|
|
167
167
|
activityReconciliationScheduled = !1;
|
|
168
168
|
getState() {
|
|
169
169
|
const e = this.recentQuery.getState(), t = this.pinnedQuery.getState(), i = [
|
|
170
|
-
...
|
|
171
|
-
...
|
|
170
|
+
...f(t.data),
|
|
171
|
+
...f(e.data)
|
|
172
172
|
], n = new Map(i.map((d) => [d.id, d])), r = Array.from(n.values()).map(
|
|
173
173
|
(d) => this.applyOverrides(d, this.completedRefreshSequence)
|
|
174
|
-
), o = Array.from(this.optimisticEntities.values()).filter((d) => !n.has(d.id)).reverse(), a = e.data || t.data || o.length > 0 ?
|
|
174
|
+
), o = Array.from(this.optimisticEntities.values()).filter((d) => !n.has(d.id)).reverse(), a = e.data || t.data || o.length > 0 ? v({
|
|
175
175
|
entities: [...o, ...r],
|
|
176
176
|
nextCursor: e.data?.nextCursor ?? null
|
|
177
177
|
}) : null;
|
|
@@ -243,8 +243,8 @@ class Me {
|
|
|
243
243
|
}
|
|
244
244
|
reconcileDurableEntities() {
|
|
245
245
|
const e = [
|
|
246
|
-
...
|
|
247
|
-
...
|
|
246
|
+
...f(this.pinnedQuery.getState().data),
|
|
247
|
+
...f(this.recentQuery.getState().data)
|
|
248
248
|
], t = new Set(e.map((i) => i.id));
|
|
249
249
|
for (const i of this.optimisticEntities.keys())
|
|
250
250
|
t.has(i) && this.optimisticEntities.delete(i);
|
|
@@ -283,13 +283,13 @@ class Me {
|
|
|
283
283
|
for (const e of this.listeners) e(this.getState());
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function f(s) {
|
|
287
287
|
return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
|
|
288
288
|
}
|
|
289
289
|
function V(s, e) {
|
|
290
290
|
return s.status === "error" || e.status === "error" ? "error" : s.status === "loading" || e.status === "loading" ? "loading" : s.status === "refreshing" || e.status === "refreshing" ? "refreshing" : s.status === "loading_more" ? "loading_more" : s.status === "ready" || e.status === "ready" ? "ready" : "not_requested";
|
|
291
291
|
}
|
|
292
|
-
function
|
|
292
|
+
function q(s) {
|
|
293
293
|
const e = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(?:\.(\d{1,6}))?(?:Z|\+00:00)$/.exec(s);
|
|
294
294
|
if (!e) throw new Error("Display timestamps must retain the backend UTC precision.");
|
|
295
295
|
return `${e[1]}.${(e[2] ?? "").padEnd(6, "0")}`;
|
|
@@ -313,14 +313,14 @@ function W(s, e) {
|
|
|
313
313
|
if (!e) return !1;
|
|
314
314
|
const t = s.executionByUserMessage[e];
|
|
315
315
|
if (t) return ["completed", "stopped", "failed"].includes(t.phase);
|
|
316
|
-
const i = Object.values(s.items).sort((r, o) =>
|
|
316
|
+
const i = Object.values(s.items).sort((r, o) => q(r.created_at).localeCompare(q(o.created_at)) || r.id.localeCompare(o.id));
|
|
317
317
|
let n = !1;
|
|
318
318
|
for (const r of i)
|
|
319
319
|
if (r.type === "user_message" && (n = r.id === e), !!n && (r.type === "stopped" || r.type === "error" || r.type === "final_response" && s.streams[r.id]?.state === "finished" && s.streams[r.id].revision >= r.data.revision))
|
|
320
320
|
return !0;
|
|
321
321
|
return !1;
|
|
322
322
|
}
|
|
323
|
-
class
|
|
323
|
+
class Me {
|
|
324
324
|
constructor(e, t = null) {
|
|
325
325
|
this.storage = e, t && (this.decisions = new Map(
|
|
326
326
|
t.filter(A).map((i) => [this.getDecisionKey(i), i])
|
|
@@ -463,17 +463,17 @@ class Pe {
|
|
|
463
463
|
return null;
|
|
464
464
|
}
|
|
465
465
|
getDecisionKey(e) {
|
|
466
|
-
const t =
|
|
466
|
+
const t = _(e.scope);
|
|
467
467
|
return e.action === "dont_show_again" ? `${t}:category:${e.category}` : `${t}:interaction:${e.promptKey}`;
|
|
468
468
|
}
|
|
469
469
|
getExactKey(e) {
|
|
470
|
-
return `${
|
|
470
|
+
return `${_(e.scope)}:interaction:${e.key}`;
|
|
471
471
|
}
|
|
472
472
|
getCategoryKey(e) {
|
|
473
|
-
return `${
|
|
473
|
+
return `${_(e.scope)}:category:${e.category}`;
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function Pe(s, e) {
|
|
477
477
|
return {
|
|
478
478
|
load: async () => Y(s, e),
|
|
479
479
|
save: async (t) => s.setItem(e, JSON.stringify(t))
|
|
@@ -485,7 +485,7 @@ function Y(s, e) {
|
|
|
485
485
|
const i = JSON.parse(t);
|
|
486
486
|
return Array.isArray(i) ? i.filter(A) : [];
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function _(s) {
|
|
489
489
|
return `${s.level}:${s.key}`;
|
|
490
490
|
}
|
|
491
491
|
function z(s) {
|
|
@@ -503,11 +503,11 @@ const X = {
|
|
|
503
503
|
stopped: "⏹️"
|
|
504
504
|
}, ee = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
|
|
505
505
|
function te(s, e) {
|
|
506
|
-
if (!e) return
|
|
507
|
-
const t =
|
|
506
|
+
if (!e) return I(s);
|
|
507
|
+
const t = I(s), i = `${X[e]} Pluno`;
|
|
508
508
|
return t ? `${i}: ${t}` : i;
|
|
509
509
|
}
|
|
510
|
-
class
|
|
510
|
+
class Oe {
|
|
511
511
|
constructor(e) {
|
|
512
512
|
this.titleDocument = e;
|
|
513
513
|
}
|
|
@@ -529,10 +529,10 @@ class qe {
|
|
|
529
529
|
}
|
|
530
530
|
applyStatus(e) {
|
|
531
531
|
const t = this.titleDocument.getTitle();
|
|
532
|
-
t !== this.lastAppliedTitle && (this.baseTitle =
|
|
532
|
+
t !== this.lastAppliedTitle && (this.baseTitle = I(t)), this.status = e, this.stopObserving || (this.stopObserving = this.titleDocument.observeTitle(() => this.handleTitleChanged())), this.applyTitle();
|
|
533
533
|
}
|
|
534
534
|
applyClear() {
|
|
535
|
-
const e = this.titleDocument.getTitle(), t = this.lastAppliedTitle !== null && e === this.lastAppliedTitle, i = this.lastAppliedTitle === null ?
|
|
535
|
+
const e = this.titleDocument.getTitle(), t = this.lastAppliedTitle !== null && e === this.lastAppliedTitle, i = this.lastAppliedTitle === null ? I(e) : e;
|
|
536
536
|
this.status = null, this.lastAppliedTitle = null, this.stopObserving?.(), this.stopObserving = null, t ? this.titleDocument.setTitle(this.baseTitle) : i !== e && this.titleDocument.setTitle(i);
|
|
537
537
|
}
|
|
538
538
|
handleTitleChanged() {
|
|
@@ -545,7 +545,7 @@ class qe {
|
|
|
545
545
|
this.lastAppliedTitle = e, this.titleDocument.getTitle() !== e && this.titleDocument.setTitle(e);
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
|
-
function
|
|
548
|
+
function qe(s) {
|
|
549
549
|
return {
|
|
550
550
|
getTitle: () => s.title,
|
|
551
551
|
setTitle: (e) => {
|
|
@@ -561,7 +561,7 @@ function Oe(s) {
|
|
|
561
561
|
}
|
|
562
562
|
};
|
|
563
563
|
}
|
|
564
|
-
function
|
|
564
|
+
function I(s) {
|
|
565
565
|
return s.replace(ee, "");
|
|
566
566
|
}
|
|
567
567
|
const p = (s) => typeof s == "string" && /^[a-zA-Z0-9:_.-]{1,160}$/.test(s) ? s : null;
|
|
@@ -575,11 +575,11 @@ function K(s) {
|
|
|
575
575
|
const e = s;
|
|
576
576
|
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
577
|
}
|
|
578
|
-
const R = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"],
|
|
578
|
+
const R = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"], T = (s) => typeof s == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(s), h = (s) => s === null || T(s), ie = (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));
|
|
579
579
|
function $(s) {
|
|
580
580
|
if (!s || typeof s != "object") return !1;
|
|
581
581
|
const e = s;
|
|
582
|
-
return Object.keys(s).every((t) => ["sessionId", "itemId", "userMessageId", "createdAt", "runId", "retryable"].includes(t)) &&
|
|
582
|
+
return Object.keys(s).every((t) => ["sessionId", "itemId", "userMessageId", "createdAt", "runId", "retryable"].includes(t)) && h(e.sessionId) && T(e.itemId) && h(e.userMessageId) && (e.retryable === void 0 || typeof e.retryable == "boolean") && h(e.runId) && (e.createdAt === null || ie(e.createdAt));
|
|
583
583
|
}
|
|
584
584
|
function ne(s) {
|
|
585
585
|
if (!s || typeof s != "object") return !1;
|
|
@@ -591,7 +591,7 @@ function U(s) {
|
|
|
591
591
|
const e = (i) => {
|
|
592
592
|
if (!i || typeof i != "object") return !1;
|
|
593
593
|
const n = i;
|
|
594
|
-
return Object.keys(i).every((r) => [...R, "sessionId", "runtimeItemCount", "welcome", "truncated", "thinkingSequence", "context"].includes(r)) && (n.context === void 0 || ne(n.context)) && (n.thinkingSequence === void 0 || Array.isArray(n.thinkingSequence) && n.thinkingSequence.length <= 20 && n.thinkingSequence.every((r) => r === "user" || r === "thinking")) &&
|
|
594
|
+
return Object.keys(i).every((r) => [...R, "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 || ne(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" && R.every((r) => Array.isArray(n[r]) && n[r].length <= 20 && n[r].every(T));
|
|
595
595
|
}, t = s;
|
|
596
596
|
return (t.before === null || e(t.before)) && e(t.current);
|
|
597
597
|
}
|
|
@@ -606,10 +606,10 @@ function re(s) {
|
|
|
606
606
|
e ^= s.charCodeAt(t), e = Math.imul(e, 16777619);
|
|
607
607
|
return `fnv1a-${(e >>> 0).toString(16).padStart(8, "0")}`;
|
|
608
608
|
}
|
|
609
|
-
const oe = "0.1.
|
|
609
|
+
const oe = "0.1.257", ae = {
|
|
610
610
|
version: oe
|
|
611
611
|
};
|
|
612
|
-
function
|
|
612
|
+
function E(s) {
|
|
613
613
|
if (!s || typeof s != "object") return !1;
|
|
614
614
|
const e = s;
|
|
615
615
|
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,7 +617,7 @@ function M(s) {
|
|
|
617
617
|
function de(s) {
|
|
618
618
|
if (!s || typeof s != "object") return !1;
|
|
619
619
|
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 ||
|
|
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 || E(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
621
|
}
|
|
622
622
|
function ce(s, e, t, i, n = {}) {
|
|
623
623
|
const r = !i && e === "conversation_error" && t !== void 0 && s.conversationDiagnostics?.errorMessageFingerprint === re(L(t)) ? s.conversationDiagnostics : void 0;
|
|
@@ -626,7 +626,7 @@ function ce(s, e, t, i, n = {}) {
|
|
|
626
626
|
requestId: p(r?.httpRequest?.requestId ?? r?.errorRequestId ?? r?.queryRequestId),
|
|
627
627
|
...p(r?.failedClientMessageId) ? { clientMessageId: r.failedClientMessageId } : {},
|
|
628
628
|
code: r ? p(s.lastErrorCode) : null,
|
|
629
|
-
...
|
|
629
|
+
...E(r?.errorNormalization) ? { normalization: r.errorNormalization } : {},
|
|
630
630
|
builds: { sdk: ae.version, ...n }
|
|
631
631
|
};
|
|
632
632
|
}
|
|
@@ -640,10 +640,10 @@ function le(s) {
|
|
|
640
640
|
...s.details === void 0 ? {} : { details: s.details }
|
|
641
641
|
};
|
|
642
642
|
}
|
|
643
|
-
function
|
|
643
|
+
function g(s, e = "runtime_error", t = "runtime") {
|
|
644
644
|
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
645
|
// Preserve the first boundary's shape after normalization replaces the original message/prototype.
|
|
646
|
-
errorNormalization:
|
|
646
|
+
errorNormalization: E(a.errorNormalization) ? a.errorNormalization : {
|
|
647
647
|
boundary: t,
|
|
648
648
|
category: s instanceof Error ? "error" : s === null ? "null" : Array.isArray(s) ? "array" : typeof s,
|
|
649
649
|
messageKind: n.trim() === "[object Object]" ? "object_coercion" : n.trim() ? "text" : typeof s == "string" || i && "message" in i && typeof i.message == "string" ? "blank" : "non_text"
|
|
@@ -752,11 +752,11 @@ function pe(s) {
|
|
|
752
752
|
}
|
|
753
753
|
const he = Math.random().toString(36).slice(2);
|
|
754
754
|
let ge = 0;
|
|
755
|
-
const C = () => `timing:${he}:${++ge}`,
|
|
756
|
-
function
|
|
755
|
+
const C = () => `timing:${he}:${++ge}`, y = (s) => typeof s == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(s);
|
|
756
|
+
function M(s) {
|
|
757
757
|
if (!s || typeof s != "object") return !1;
|
|
758
758
|
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" && B.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) &&
|
|
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" && B.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
760
|
}
|
|
761
761
|
function x(s, e) {
|
|
762
762
|
if (!s) return {
|
|
@@ -774,7 +774,7 @@ function x(s, e) {
|
|
|
774
774
|
durationMs: Math.max(0, Math.round(performance.now() - o)),
|
|
775
775
|
...r === "failed" ? { failureCategory: pe(d) } : {}
|
|
776
776
|
};
|
|
777
|
-
s &&
|
|
777
|
+
s && M(c) && Promise.resolve().then(() => s(c)).catch(() => {
|
|
778
778
|
});
|
|
779
779
|
};
|
|
780
780
|
return {
|
|
@@ -796,7 +796,7 @@ function fe(s) {
|
|
|
796
796
|
const e = s;
|
|
797
797
|
return typeof e.observedAt == "string" && e.observedAt.length <= 40 && Number.isFinite(Date.parse(e.observedAt)) && S(e.sessionId) && S(e.responseItemId) && S(e.respondsToUserMessageId) && typeof e.panelVisible == "boolean" && typeof e.documentVisible == "boolean" && typeof e.loading == "boolean";
|
|
798
798
|
}
|
|
799
|
-
function
|
|
799
|
+
function ye(s, e, t = "stopped", i, n = "Run stopped by user.") {
|
|
800
800
|
const r = new Set(i ?? [
|
|
801
801
|
s.assistantDraftRespondsToUserMessageId,
|
|
802
802
|
s.activeResponseUserMessageId,
|
|
@@ -823,7 +823,7 @@ function me(s, e, t = "stopped", i, n = "Run stopped by user.") {
|
|
|
823
823
|
lastErrorCode: null
|
|
824
824
|
};
|
|
825
825
|
}
|
|
826
|
-
const
|
|
826
|
+
const me = {
|
|
827
827
|
"stop-without-rendered-message": "Stop is enabled while no message is rendered or the welcome screen is still visible.",
|
|
828
828
|
"in-progress-stop-unavailable": "An in-progress response has no visible enabled interrupt control.",
|
|
829
829
|
"stop-did-not-interrupt": "The stopped response remained in progress after an interrupt click.",
|
|
@@ -840,7 +840,7 @@ const ye = {
|
|
|
840
840
|
"thinking-without-progress": "Thinking remained visible without progress for five minutes."
|
|
841
841
|
};
|
|
842
842
|
function ve(s) {
|
|
843
|
-
return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(
|
|
843
|
+
return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(me, s.slice(13));
|
|
844
844
|
}
|
|
845
845
|
function D(s) {
|
|
846
846
|
return {
|
|
@@ -869,7 +869,7 @@ function Re(s) {
|
|
|
869
869
|
case "runtime.warmup":
|
|
870
870
|
return e.reason === "panel_open" || e.reason === "extension_install" || e.reason === "composer_input";
|
|
871
871
|
case "runtime.report_operation_timing":
|
|
872
|
-
return
|
|
872
|
+
return M(e.timing);
|
|
873
873
|
case "runtime.report_displayed_error":
|
|
874
874
|
return (e.errorDiagnostic === void 0 || de(e.errorDiagnostic)) && (e.httpRequest === void 0 || F(e.httpRequest)) && (e.historyRefreshFailure === void 0 || K(e.historyRefreshFailure)) && (e.renderedError === void 0 || $(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
875
|
case "runtime.report_invalid_state_transition":
|
|
@@ -937,7 +937,7 @@ class ke {
|
|
|
937
937
|
this.stopError && (e.lastError = this.stopError, e.lastErrorCode = "stop_failed");
|
|
938
938
|
const t = [...this.stopPreviews.keys()];
|
|
939
939
|
if (!t.length) return e;
|
|
940
|
-
const i =
|
|
940
|
+
const i = ye(e, "", "stopping", t);
|
|
941
941
|
return e.activeResponseUserMessageId && !this.stopPreviews.has(e.activeResponseUserMessageId) ? { ...e, messages: i.messages, segments: i.segments } : i;
|
|
942
942
|
}
|
|
943
943
|
updateProjection(e, t, i, n, r) {
|
|
@@ -990,7 +990,7 @@ class ke {
|
|
|
990
990
|
this.dispatch({ type: "runtime.widget_lifecycle", action: e, trigger: t });
|
|
991
991
|
}
|
|
992
992
|
reportOperationTiming(e) {
|
|
993
|
-
!this.destroyed &&
|
|
993
|
+
!this.destroyed && M(e) && this.adapter.dispatch({ type: "runtime.report_operation_timing", timing: e }).catch(() => {
|
|
994
994
|
});
|
|
995
995
|
}
|
|
996
996
|
reportResponseVisibility(e) {
|
|
@@ -1080,9 +1080,9 @@ class ke {
|
|
|
1080
1080
|
l.push(u);
|
|
1081
1081
|
continue;
|
|
1082
1082
|
}
|
|
1083
|
-
const
|
|
1084
|
-
if (!
|
|
1085
|
-
if (l.push(await o.measure("attachment_transfer", () => this.adapter.uploadAttachment(
|
|
1083
|
+
const P = u.id ? this.attachmentFiles.get(u.id) : void 0;
|
|
1084
|
+
if (!P) throw new Error(`Attachment bytes are unavailable for ${u.name}`);
|
|
1085
|
+
if (l.push(await o.measure("attachment_transfer", () => this.adapter.uploadAttachment(P, u, { clientMessageId: r }))), i !== this.submissionGeneration) return null;
|
|
1086
1086
|
}
|
|
1087
1087
|
a = l;
|
|
1088
1088
|
}
|
|
@@ -1105,10 +1105,10 @@ class ke {
|
|
|
1105
1105
|
for (const u of t.attachments ?? [])
|
|
1106
1106
|
u.id && this.attachmentFiles.delete(u.id);
|
|
1107
1107
|
const l = this.submissionPreviews.get(r);
|
|
1108
|
-
throw l && (l.pending = !1, l.error =
|
|
1108
|
+
throw l && (l.pending = !1, l.error = g(c).message, l.retry = !d && g(c).code === "command_not_received" ? () => this.sendMessageNow(e, t, i) : void 0, this.emit("state", this.getState())), d && await this.adapter.dispatch({
|
|
1109
1109
|
type: "conversation.fail_staged",
|
|
1110
1110
|
clientMessageId: r,
|
|
1111
|
-
message:
|
|
1111
|
+
message: g(c).message
|
|
1112
1112
|
}), c;
|
|
1113
1113
|
}
|
|
1114
1114
|
}
|
|
@@ -1129,7 +1129,7 @@ class ke {
|
|
|
1129
1129
|
return i && n ? (i.pending = !0, i.error = void 0, i.retry = void 0, this.pendingTransfers.set(t, (i.message.attachments ?? []).flatMap((o) => o.id ? [o.id] : [])), this.emit("state", this.getState()), await n()) : await this.dispatch({ type: "run.retry", clientMessageId: t }), !0;
|
|
1130
1130
|
} catch (o) {
|
|
1131
1131
|
if (!i) throw o;
|
|
1132
|
-
return r === this.submissionGeneration && this.submissionPreviews.get(t) === i && (i.error =
|
|
1132
|
+
return r === this.submissionGeneration && this.submissionPreviews.get(t) === i && (i.error = g(o).message, this.emit("state", this.getState())), !1;
|
|
1133
1133
|
} finally {
|
|
1134
1134
|
n && this.pendingTransfers.delete(t), i && r === this.submissionGeneration && this.submissionPreviews.get(t) === i && (i.pending = !1, this.emit("state", this.getState()));
|
|
1135
1135
|
}
|
|
@@ -1167,7 +1167,7 @@ class ke {
|
|
|
1167
1167
|
}, (c) => {
|
|
1168
1168
|
if (!(a !== this.submissionGeneration || i.every((l) => !this.stopPreviews.has(l)))) {
|
|
1169
1169
|
for (const l of i) this.stopPreviews.delete(l);
|
|
1170
|
-
this.stopError =
|
|
1170
|
+
this.stopError = g(c).message;
|
|
1171
1171
|
}
|
|
1172
1172
|
}).finally(() => {
|
|
1173
1173
|
this.destroyed || a !== this.submissionGeneration || (this.pendingStop === r && (this.pendingStop = null), this.emit("state", this.getState()));
|
|
@@ -1325,7 +1325,7 @@ function w(s) {
|
|
|
1325
1325
|
function j(s) {
|
|
1326
1326
|
return {
|
|
1327
1327
|
...s,
|
|
1328
|
-
data: s.data ?
|
|
1328
|
+
data: s.data ? v({
|
|
1329
1329
|
entities: Q(s.data).map((e) => ({ ...e })),
|
|
1330
1330
|
nextCursor: s.data.nextCursor
|
|
1331
1331
|
}) : null
|
|
@@ -1333,25 +1333,25 @@ function j(s) {
|
|
|
1333
1333
|
}
|
|
1334
1334
|
export {
|
|
1335
1335
|
H as PRODUCT_AGENT_AUTH_RECONNECTING_ERROR_MESSAGE,
|
|
1336
|
-
|
|
1337
|
-
|
|
1336
|
+
Me as ProductAgentInteractionManager,
|
|
1337
|
+
O as ProductAgentQueryController,
|
|
1338
1338
|
ke as ProductAgentRemoteRuntimeClient,
|
|
1339
|
-
|
|
1340
|
-
|
|
1339
|
+
Ee as ProductAgentSessionHistoryManager,
|
|
1340
|
+
Oe as ProductAgentTaskPageTitleController,
|
|
1341
1341
|
Ae as canSubmitPersonalProductAgentMessage,
|
|
1342
|
-
|
|
1342
|
+
Pe as createLocalStorageInteractionDecisionStorage,
|
|
1343
1343
|
m as createProductAgentQueryState,
|
|
1344
|
-
|
|
1344
|
+
qe as createProductAgentTaskPageTitleDocument,
|
|
1345
1345
|
te as formatProductAgentTaskPageTitle,
|
|
1346
1346
|
Se as hasProductAgentPaidCreditFallback,
|
|
1347
1347
|
Z as isProductAgentAuthReconnectError,
|
|
1348
1348
|
Re as isProductAgentRuntimeCommand,
|
|
1349
1349
|
G as mergeProductAgentEntityPages,
|
|
1350
|
-
|
|
1350
|
+
v as normalizeProductAgentEntityPage,
|
|
1351
1351
|
Y as readLocalStorageInteractionDecisions,
|
|
1352
|
-
|
|
1352
|
+
_e as reconcileProductAgentSubmissionGate,
|
|
1353
1353
|
we as resolveProductAgentBillingPresentation,
|
|
1354
|
-
|
|
1355
|
-
|
|
1354
|
+
Te as resolveProductAgentComposerAction,
|
|
1355
|
+
Ie as resolveProductAgentWidgetPresentation,
|
|
1356
1356
|
Q as selectProductAgentQueryEntities
|
|
1357
1357
|
};
|