@pluno/product-agent-web 0.1.265 → 0.1.267
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/adapters/web/backendTransport.d.ts +1 -2
- package/dist/core/features/contracts.d.ts +1 -0
- package/dist/product-agent-runtime.cjs +1 -1
- package/dist/product-agent-runtime.js +1 -1
- package/dist/product-agent-sdk.js +528 -529
- package/dist/product-agent-widget.js +287 -288
- package/package.json +1 -1
|
@@ -37,7 +37,7 @@ function Fp(t, e, n, i) {
|
|
|
37
37
|
function $p(t) {
|
|
38
38
|
return Lr(t) > 0.5 ? [24, 24, 27] : [250, 250, 249];
|
|
39
39
|
}
|
|
40
|
-
const Hp = "0.1.
|
|
40
|
+
const Hp = "0.1.267", ri = {
|
|
41
41
|
version: Hp
|
|
42
42
|
}, ye = (t) => typeof t == "string" && /^[a-zA-Z0-9:_.-]{1,160}$/.test(t) ? t : null;
|
|
43
43
|
function Ad(t) {
|
|
@@ -84,11 +84,11 @@ function Wp(t) {
|
|
|
84
84
|
e = Math.imul(e ^ t.charCodeAt(i), 16777619) >>> 0, n = Math.imul(n ^ t.charCodeAt(i), 33) >>> 0;
|
|
85
85
|
return `selection:${e.toString(16)}:${n.toString(16)}`;
|
|
86
86
|
}
|
|
87
|
-
const Nr = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"], ft = (t) => typeof t == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(t),
|
|
87
|
+
const Nr = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"], ft = (t) => typeof t == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(t), zn = (t) => t === null || ft(t), Td = (t) => typeof t == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?(?:Z|\+00:00)$/.test(t) && Number.isFinite(Date.parse(t));
|
|
88
88
|
function qd(t) {
|
|
89
89
|
if (!t || typeof t != "object") return !1;
|
|
90
90
|
const e = t;
|
|
91
|
-
return Object.keys(t).every((n) => ["sessionId", "itemId", "userMessageId", "createdAt", "runId", "retryable"].includes(n)) &&
|
|
91
|
+
return Object.keys(t).every((n) => ["sessionId", "itemId", "userMessageId", "createdAt", "runId", "retryable"].includes(n)) && zn(e.sessionId) && ft(e.itemId) && zn(e.userMessageId) && (e.retryable === void 0 || typeof e.retryable == "boolean") && zn(e.runId) && (e.createdAt === null || Td(e.createdAt));
|
|
92
92
|
}
|
|
93
93
|
function Vp(t, e) {
|
|
94
94
|
const n = t.messages.find((s) => s.id === e && s.dataType === "run_error");
|
|
@@ -196,7 +196,7 @@ function Yp(t) {
|
|
|
196
196
|
const e = (i) => {
|
|
197
197
|
if (!i || typeof i != "object") return !1;
|
|
198
198
|
const s = i;
|
|
199
|
-
return Object.keys(i).every((o) => [...Nr, "sessionId", "runtimeItemCount", "welcome", "truncated", "thinkingSequence", "context", "duplicateToolCalls"].includes(o)) && (s.duplicateToolCalls === void 0 || Array.isArray(s.duplicateToolCalls) && s.duplicateToolCalls.length <= 5 && s.duplicateToolCalls.every((o) => o && Object.keys(o).every((a) => ["key", "count", "rows", "truncated"].includes(a)) &&
|
|
199
|
+
return Object.keys(i).every((o) => [...Nr, "sessionId", "runtimeItemCount", "welcome", "truncated", "thinkingSequence", "context", "duplicateToolCalls"].includes(o)) && (s.duplicateToolCalls === void 0 || Array.isArray(s.duplicateToolCalls) && s.duplicateToolCalls.length <= 5 && s.duplicateToolCalls.every((o) => o && Object.keys(o).every((a) => ["key", "count", "rows", "truncated"].includes(a)) && zn(o.key) && Number.isSafeInteger(o.count) && o.count >= 2 && typeof o.truncated == "boolean" && Array.isArray(o.rows) && o.rows.length >= 1 && o.rows.length <= 5 && o.rows.length <= o.count && o.rows.every((a) => a && Object.keys(a).every((r) => ["itemId", "groupId"].includes(r)) && zn(a.itemId) && zn(a.groupId)))) && (s.context === void 0 || Qp(s.context)) && (s.thinkingSequence === void 0 || Array.isArray(s.thinkingSequence) && s.thinkingSequence.length <= 20 && s.thinkingSequence.every((o) => o === "user" || o === "thinking")) && zn(s.sessionId) && Number.isSafeInteger(s.runtimeItemCount) && s.runtimeItemCount >= 0 && typeof s.welcome == "boolean" && typeof s.truncated == "boolean" && Nr.every((o) => Array.isArray(s[o]) && s[o].length <= 20 && s[o].every(ft));
|
|
200
200
|
}, n = t;
|
|
201
201
|
return (n.before === null || e(n.before)) && e(n.current);
|
|
202
202
|
}
|
|
@@ -248,20 +248,20 @@ function Xt(t, e = "runtime_error", n = "runtime") {
|
|
|
248
248
|
});
|
|
249
249
|
}
|
|
250
250
|
const Yc = 500;
|
|
251
|
-
function
|
|
251
|
+
function $n(t) {
|
|
252
252
|
const e = t.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();
|
|
253
253
|
return e.length > Yc ? `${e.slice(0, Yc - 1)}…` : e;
|
|
254
254
|
}
|
|
255
|
-
function
|
|
256
|
-
const n = Xt(t, "runtime_error", e), i = t !== null && typeof t == "object" && "stack" in t && typeof t.stack == "string" ?
|
|
255
|
+
function Ln(t, e = "runtime") {
|
|
256
|
+
const n = Xt(t, "runtime_error", e), i = t !== null && typeof t == "object" && "stack" in t && typeof t.stack == "string" ? $n(t.stack.slice(0, 4e3).split(`
|
|
257
257
|
`).slice(0, 6).join(`
|
|
258
258
|
`).replace(/\n\s*at\s/g, `
|
|
259
259
|
frame `)) : void 0;
|
|
260
260
|
return {
|
|
261
261
|
...eo(n.details?.errorNormalization) ? { normalization: n.details.errorNormalization } : {},
|
|
262
262
|
category: t instanceof Error ? "error" : t === null ? "null" : Array.isArray(t) ? "array" : typeof t,
|
|
263
|
-
code:
|
|
264
|
-
message:
|
|
263
|
+
code: $n(n.code),
|
|
264
|
+
message: $n(n.message),
|
|
265
265
|
...i ? { stack: i } : {}
|
|
266
266
|
};
|
|
267
267
|
}
|
|
@@ -532,7 +532,7 @@ function Dd(t, e, n = null, i = !0) {
|
|
|
532
532
|
}
|
|
533
533
|
return s("allowed", "none");
|
|
534
534
|
}
|
|
535
|
-
function
|
|
535
|
+
function qt(t) {
|
|
536
536
|
return t?.execution_message_ids ?? t?.user_message_ids ?? [];
|
|
537
537
|
}
|
|
538
538
|
function Jt(t) {
|
|
@@ -646,11 +646,11 @@ function fn(t, e, n) {
|
|
|
646
646
|
}
|
|
647
647
|
const l = o?.execution, h = a.filter((E) => !E.cancelled && E.delivery !== "failed"), g = h.filter((E) => E.delivery !== "accepted" && E.executionVersion === null), y = h.filter((E) => E.delivery === "accepted" && E.executionVersion === null), f = h[h.length - 1], b = g.length > 0, w = f !== void 0 && y.includes(f);
|
|
648
648
|
let v = b ? "submitting" : w ? "awaiting_execution" : l?.phase ?? "idle";
|
|
649
|
-
const k = Object.entries(t.stops).filter(([E]) => E === n || s !== null && e.selections[E]?.sessionId === s).map(([, E]) => E).find((E) => (!a.length || E.userMessageIds.includes(a[a.length - 1].userMessageId) || !b && !w &&
|
|
650
|
-
k && m && !b && (!l || !["thinking", "steering", "queued", "stopping"].includes(l.phase) ||
|
|
649
|
+
const k = Object.entries(t.stops).filter(([E]) => E === n || s !== null && e.selections[E]?.sessionId === s).map(([, E]) => E).find((E) => (!a.length || E.userMessageIds.includes(a[a.length - 1].userMessageId) || !b && !w && qt(l).some((N) => E.userMessageIds.includes(N))) && (!l || l.version <= E.executionVersion || ["thinking", "steering", "queued", "stopping"].includes(l.phase) || a.some((N) => N.cancelled && N.executionVersion === null && E.userMessageIds.includes(N.userMessageId)))), m = l && ["thinking", "steering", "queued", "stopping"].includes(l.phase) || a.some((E) => E.delivery === "accepted" && E.executionVersion === null && k?.userMessageIds.includes(E.userMessageId));
|
|
650
|
+
k && m && !b && (!l || !["thinking", "steering", "queued", "stopping"].includes(l.phase) || qt(l).every((E) => k.userMessageIds.includes(E))) && (v = "stopping"), k && !m && !b && a.some((E) => E.cancelled && E.executionVersion === null && k.userMessageIds.includes(E.userMessageId)) && (v = a.some((E) => k.userMessageIds.includes(E.userMessageId) && ["sending", "uncertain"].includes(E.delivery)) ? "stopping" : "stopped");
|
|
651
651
|
const S = ["thinking", "steering", "queued"].includes(v), _ = t.stops[n] ?? k, x = _?.userMessageIds.filter((E) => !["completed", "failed"].includes(o?.executionByUserMessage[E]?.phase ?? "")) ?? [], R = x.some((E) => {
|
|
652
652
|
const N = a.find((ue) => ue.userMessageId === E);
|
|
653
|
-
return !Object.values(t.operations).some((ue) => ue.command.type === "run.stop" && ue.command.payload.expectedUserMessageId === E && ue.phase === "done") && (N?.executionVersion === null && ["sending", "uncertain", "accepted"].includes(N.delivery) || !!(l &&
|
|
653
|
+
return !Object.values(t.operations).some((ue) => ue.command.type === "run.stop" && ue.command.payload.expectedUserMessageId === E && ue.phase === "done") && (N?.executionVersion === null && ["sending", "uncertain", "accepted"].includes(N.delivery) || !!(l && qt(l).includes(E) && ["thinking", "steering", "queued", "stopping"].includes(l.phase)));
|
|
654
654
|
}), q = l?.user_message_ids ?? [], U = b || w ? f?.userMessageId ?? null : q[q.length - 1] ?? null, P = u.find((E) => E.userMessageId === U), z = S ? [...P?.activityIds ?? []].reverse().find((E) => d[E] === "open") ?? null : null, B = s !== null && !!e.selections[n]?.provisionalId && r.length === 0 && a.length === 0 && // The first persisted idle snapshot already has a positive synchronization version.
|
|
655
655
|
(!o?.execution || o.execution.phase === "idle" && o.execution.user_message_ids.length === 0) && Object.values(t.operations).some((E) => E.conversationScopeId === n && E.phase === "done" && ["runtime.warmup", "attachment.prepare"].includes(E.command.type) && !E.command.payload.sessionId && E.result?.sessionId === s);
|
|
656
656
|
return Ke({
|
|
@@ -670,7 +670,7 @@ function fn(t, e, n) {
|
|
|
670
670
|
preparation: o?.preparation ?? null,
|
|
671
671
|
stop: _ ? { ..._, userMessageIds: x, pending: R } : null,
|
|
672
672
|
segments: u.map((E, N) => ({ ...E, collapsed: S ? E.userMessageId !== U : N < u.length - 1 || E.activityIds.length > 0 })),
|
|
673
|
-
activity: { phase: v, activeItemId: z, userMessageId: U, executionKey: JSON.stringify([...
|
|
673
|
+
activity: { phase: v, activeItemId: z, userMessageId: U, executionKey: JSON.stringify([...qt(l)].sort()) },
|
|
674
674
|
// Staging transfers the immutable input to the core. Waiting for backend acceptance leaves
|
|
675
675
|
// the same submitted text in the optimistic transcript and composer during delivery.
|
|
676
676
|
receipts: i.filter((E) => !E.cancelled && e.clients[E.clientScopeId] === n).map((E) => ({ viewId: E.viewId, userMessageId: E.userMessageId, acceptedRendererRevision: E.rendererRevision }))
|
|
@@ -1092,9 +1092,9 @@ function Wr() {
|
|
|
1092
1092
|
};
|
|
1093
1093
|
}
|
|
1094
1094
|
function Vr(t = 0) {
|
|
1095
|
-
return { localScribbleStyle: null, originContextQueries: {}, contextObservers: {}, contextReads: {}, contextRunOrigins: {}, appearanceEpochs: {}, appearanceQueries: {}, polls: {}, queries: {}, pending: {}, queuedPreferences: {}, desiredPreferences: {}, refreshBatch: null, refreshQueuedRequestId: null, refreshAt: null, failures: 0, now: t, timerId: null, timerDeadline: null, timerRevision: 0, refreshRequired: !1, schedulerError: null, deepFlows: {} };
|
|
1095
|
+
return { suggestionReadFailures: 0, localScribbleStyle: null, originContextQueries: {}, contextObservers: {}, contextReads: {}, contextRunOrigins: {}, appearanceEpochs: {}, appearanceQueries: {}, polls: {}, queries: {}, pending: {}, queuedPreferences: {}, desiredPreferences: {}, refreshBatch: null, refreshQueuedRequestId: null, refreshAt: null, failures: 0, now: t, timerId: null, timerDeadline: null, timerRevision: 0, refreshRequired: !1, schedulerError: null, deepFlows: {} };
|
|
1096
1096
|
}
|
|
1097
|
-
function
|
|
1097
|
+
function At(t, e) {
|
|
1098
1098
|
return e.kind === "originContext" ? JSON.stringify([t.authorityId, t.generation, t.communityId, e.kind, e.origin]) : JSON.stringify([
|
|
1099
1099
|
t.authorityId,
|
|
1100
1100
|
t.generation,
|
|
@@ -1155,7 +1155,7 @@ function ji(t, e) {
|
|
|
1155
1155
|
function sl(t) {
|
|
1156
1156
|
return t.kind === "decision" ? zd(t) : t.kind === "proactiveFeedback" ? `prompt:proactive_suggestion:${t.suggestionId}` : "feature" in t ? `${t.kind}:${t.feature}` : t.kind;
|
|
1157
1157
|
}
|
|
1158
|
-
function
|
|
1158
|
+
function Mn(t, e, n) {
|
|
1159
1159
|
return JSON.stringify(["stage7", t.authorityId, t.generation, e, n]);
|
|
1160
1160
|
}
|
|
1161
1161
|
function Gr(t, e, n) {
|
|
@@ -1176,7 +1176,7 @@ function Gr(t, e, n) {
|
|
|
1176
1176
|
"now" in e && o({ now: e.now });
|
|
1177
1177
|
const c = (m, S) => {
|
|
1178
1178
|
const _ = { ...i.features.contextObservers }, x = _[m];
|
|
1179
|
-
if (S === null ? delete _[m] : _[m] =
|
|
1179
|
+
if (S === null ? delete _[m] : _[m] = At(r, { kind: "originContext", clientScopeId: m, origin: S, pageUrl: "" }), o({ contextObservers: _ }), !x || Object.values(_).includes(x)) return;
|
|
1180
1180
|
const R = { ...i.features.queries }, q = { ...i.features.polls }, U = { ...i.features.contextReads }, P = { ...i.features.originContextQueries }, z = { ...i.features.pending }, B = P[x]?.origin, E = { ...i.features.contextRunOrigins };
|
|
1181
1181
|
for (const [N, Y] of Object.entries(E)) Y === B && delete E[N];
|
|
1182
1182
|
delete R[x], delete q[x], delete U[x], delete P[x];
|
|
@@ -1190,7 +1190,7 @@ function Gr(t, e, n) {
|
|
|
1190
1190
|
const d = e.type === "stage7.query" ? e.query : e.type === "stage7.mutate" ? e.mutation : e.type === "effect.completed" || e.type === "effect.failed" ? i.features.pending[e.effectId]?.operation : null;
|
|
1191
1191
|
if (d && Fd(d)) {
|
|
1192
1192
|
ji(r, d);
|
|
1193
|
-
const m = ph(i.features, r, e, (S) =>
|
|
1193
|
+
const m = ph(i.features, r, e, (S) => At(r, S));
|
|
1194
1194
|
return { state: { ...i, features: m.state }, effects: m.effects };
|
|
1195
1195
|
}
|
|
1196
1196
|
if (e.type === "stage7.act" || e.type === "stage7.retry_action" || (e.type === "effect.completed" || e.type === "effect.failed") && e.effectKind === "stage7.platform") {
|
|
@@ -1202,7 +1202,7 @@ function Gr(t, e, n) {
|
|
|
1202
1202
|
const u = (m, S, _) => {
|
|
1203
1203
|
const x = m === "notifications" ? "canRequestNotificationPermission" : "canGroupSessionTabs";
|
|
1204
1204
|
if (!He(r.profile, x) || Di(i, m) !== !0 || i.features.desiredPreferences[m] === !1 || Object.values(i.interactions.devicePending).some((U) => U.feature === m && (S === "check" || U.action !== "check"))) return;
|
|
1205
|
-
const R =
|
|
1205
|
+
const R = Mn(r, "device", _), q = { ...i.interactions.deviceErrors };
|
|
1206
1206
|
delete q[m], a({ deviceErrors: q, devicePending: { ...i.interactions.devicePending, [R]: { feature: m, requestId: _, generation: r.generation, desired: !0, action: S } } }), s.push({ kind: "stage7.device", id: R, input: { authority: r, requestId: _, feature: m, action: S, now: i.features.now } });
|
|
1207
1207
|
}, l = (m, S) => {
|
|
1208
1208
|
const _ = S ? i.interactions.promptActions[S.replace(/:ack$/, "")] : void 0, x = { ...i.interactions.openings };
|
|
@@ -1233,7 +1233,7 @@ function Gr(t, e, n) {
|
|
|
1233
1233
|
S.revision <= _.revision || (Di(i, m) === !0 && (S.permission === "granted" && _.permission !== "granted" || S.snoozedUntil && S.snoozedUntil !== _.snoozedUntil) && l(m, null), a({ deviceFacts: { ...i.interactions.deviceFacts, [m]: S } }));
|
|
1234
1234
|
}, y = (m, S, _ = !1) => {
|
|
1235
1235
|
ji(r, m);
|
|
1236
|
-
const x =
|
|
1236
|
+
const x = At(r, m), R = Mn(r, "query", S);
|
|
1237
1237
|
if (m.kind === "originContext") {
|
|
1238
1238
|
const z = i.features.queries[x], B = i.features.contextReads[x];
|
|
1239
1239
|
if (o({ originContextQueries: { ...i.features.originContextQueries, [x]: m } }), !_ && (z?.status === "ready" || z?.status === "error") && B && (i.features.now - B.settledAt < 3e4 || z.error && !z.error.retryable && z.error.code !== "runtime_error")) return;
|
|
@@ -1256,7 +1256,7 @@ function Gr(t, e, n) {
|
|
|
1256
1256
|
} } }), m.kind === "account" && (i = { ...i, account: { ...i.account, query: ei(i.account.query, { key: x, requestId: Et(S), mode: "replace" }) } }), s.push({ kind: "stage7.query", id: R, input: { authority: r, requestId: S, query: m } });
|
|
1257
1257
|
}, f = (m, S, _ = !1) => {
|
|
1258
1258
|
if (ji(r, m), m.kind === "report" && !i.account.query.data?.user?.isSuperuser) throw new Error("Chat reporting requires superuser access.");
|
|
1259
|
-
const x =
|
|
1259
|
+
const x = Mn(r, "mutate", S), R = JSON.stringify(m), q = i.features.pending[x];
|
|
1260
1260
|
if (q) {
|
|
1261
1261
|
if (q.fingerprint !== R) throw new Error("Request ID was reused with a different payload.");
|
|
1262
1262
|
if (!_ || q.status !== "error") return;
|
|
@@ -1266,7 +1266,7 @@ function Gr(t, e, n) {
|
|
|
1266
1266
|
if (m.kind === "preference" && (o({ desiredPreferences: { ...i.features.desiredPreferences, [m.feature]: m.enabled } }), Object.values(i.features.pending).some((U) => U.status === "pending" && U.operation.kind === "preference" && U.operation.feature === m.feature))) {
|
|
1267
1267
|
const U = i.features.queuedPreferences[m.feature];
|
|
1268
1268
|
if (U && U.requestId !== S) {
|
|
1269
|
-
const P =
|
|
1269
|
+
const P = Mn(r, "mutate", U.requestId), z = { kind: "preference", feature: m.feature, enabled: U.enabled };
|
|
1270
1270
|
o({ pending: { ...i.features.pending, [P]: {
|
|
1271
1271
|
requestId: U.requestId,
|
|
1272
1272
|
effectId: P,
|
|
@@ -1284,7 +1284,7 @@ function Gr(t, e, n) {
|
|
|
1284
1284
|
return;
|
|
1285
1285
|
}
|
|
1286
1286
|
if (m.kind === "generatePrompts") {
|
|
1287
|
-
const U = { kind: "starterPrompts", ...m.page, includeUserSuggestions: m.includeUserSuggestions ?? !1 }, P =
|
|
1287
|
+
const U = { kind: "starterPrompts", ...m.page, includeUserSuggestions: m.includeUserSuggestions ?? !1 }, P = At(r, U), z = i.features.queries[P] ?? Zt(P);
|
|
1288
1288
|
o({ queries: { ...i.features.queries, [P]: ei(z, { key: P, requestId: Et(S), mode: "replace" }) } });
|
|
1289
1289
|
}
|
|
1290
1290
|
o({ pending: { ...i.features.pending, [x]: { requestId: S, effectId: x, fingerprint: R, key: sl(m), generation: r.generation, operation: m, mode: "mutation", status: "pending", error: null, result: null } } }), s.push({ kind: "stage7.mutate", id: x, input: { authority: r, requestId: S, mutation: m } });
|
|
@@ -1333,8 +1333,13 @@ function Gr(t, e, n) {
|
|
|
1333
1333
|
c(e.clientScopeId, e.origin);
|
|
1334
1334
|
break;
|
|
1335
1335
|
case "stage7.query":
|
|
1336
|
+
if (e.query.kind === "userSuggestedTasks") {
|
|
1337
|
+
const m = At(r, e.query);
|
|
1338
|
+
if (!e.force && (i.features.polls[m] || i.features.queries[m]?.status === "error")) break;
|
|
1339
|
+
e.force && o({ suggestionReadFailures: 0 });
|
|
1340
|
+
}
|
|
1336
1341
|
if (e.query.kind === "originContext" && (c(e.query.clientScopeId, e.query.origin), e.force)) {
|
|
1337
|
-
const m =
|
|
1342
|
+
const m = At(r, e.query), S = { ...i.features.contextReads };
|
|
1338
1343
|
delete S[m], o({ contextReads: S });
|
|
1339
1344
|
}
|
|
1340
1345
|
y(e.query, e.requestId, e.force);
|
|
@@ -1343,7 +1348,7 @@ function Gr(t, e, n) {
|
|
|
1343
1348
|
f(e.mutation, e.requestId);
|
|
1344
1349
|
break;
|
|
1345
1350
|
case "stage7.retry": {
|
|
1346
|
-
const m = i.features.pending[
|
|
1351
|
+
const m = i.features.pending[Mn(r, "mutate", e.requestId)];
|
|
1347
1352
|
if (!m || m.mode !== "mutation") throw new Error("Unknown mutation request.");
|
|
1348
1353
|
f(m.operation, e.requestId, !0);
|
|
1349
1354
|
break;
|
|
@@ -1484,7 +1489,7 @@ function Gr(t, e, n) {
|
|
|
1484
1489
|
if (!_) break;
|
|
1485
1490
|
const x = { ...i.interactions.devicePending };
|
|
1486
1491
|
if (delete x[e.effectId], a({ devicePending: x }), e.type === "effect.completed") {
|
|
1487
|
-
if (_.action !== "check" && i.interactions.promptActions[_.requestId] && !i.features.pending[
|
|
1492
|
+
if (_.action !== "check" && i.interactions.promptActions[_.requestId] && !i.features.pending[Mn(r, "mutate", `${_.requestId}:ack`)]) {
|
|
1488
1493
|
const R = i.interactions.promptActions[_.requestId];
|
|
1489
1494
|
l(R.feature, _.requestId), f({
|
|
1490
1495
|
kind: "preferenceAcknowledge",
|
|
@@ -1540,7 +1545,7 @@ function Gr(t, e, n) {
|
|
|
1540
1545
|
}, `${m.requestId}:ack`);
|
|
1541
1546
|
}
|
|
1542
1547
|
if (w(e.effectId, S), m.operation.kind === "generatePrompts") {
|
|
1543
|
-
const _ = { kind: "starterPrompts", ...m.operation.page, includeUserSuggestions: m.operation.includeUserSuggestions ?? !1 }, x =
|
|
1548
|
+
const _ = { kind: "starterPrompts", ...m.operation.page, includeUserSuggestions: m.operation.includeUserSuggestions ?? !1 }, x = At(r, _), R = i.features.queries[x];
|
|
1544
1549
|
R?.requestId === m.requestId && o({ queries: { ...i.features.queries, [x]: S ? gs(R, { key: x, requestId: Et(m.requestId), error: e.error }) : Jo(R, { key: x, requestId: Et(m.requestId), data: e.output.data, cursor: null, updatedAt: e.output.completedAt }) } });
|
|
1545
1550
|
}
|
|
1546
1551
|
if (!S && e.output.data.kind === "originContext") {
|
|
@@ -1583,7 +1588,7 @@ function Gr(t, e, n) {
|
|
|
1583
1588
|
if (_.kind === "originContext" || _.kind === "userContext" || _.kind === "contextRun") {
|
|
1584
1589
|
const x = _.kind === "originContext" ? m.mode === "query" && m.operation.kind === "originContext" && Object.values(i.features.contextObservers).includes(m.key) ? m.operation : null : _.kind === "userContext" ? { kind: "userContext" } : _.value.runId ? { kind: "contextRun", runId: _.value.runId } : null;
|
|
1585
1590
|
if (x && ["queued", "pending", "running", "in_progress", "stopping", "cancel_requested"].includes(_.value.status)) {
|
|
1586
|
-
const R =
|
|
1591
|
+
const R = At(r, x);
|
|
1587
1592
|
o({ polls: { ...i.features.polls, [R]: { query: x, deadline: i.features.now + 5e3 } } });
|
|
1588
1593
|
}
|
|
1589
1594
|
}
|
|
@@ -1598,9 +1603,13 @@ function Gr(t, e, n) {
|
|
|
1598
1603
|
}
|
|
1599
1604
|
}
|
|
1600
1605
|
if (S && m.mode === "query" && ["originContext", "userContext", "contextRun"].includes(m.operation.kind) && e.error.retryable && (i.features.contextReads[m.key]?.failures ?? 0) <= 3) {
|
|
1601
|
-
const _ = m.operation, x =
|
|
1606
|
+
const _ = m.operation, x = At(r, _);
|
|
1602
1607
|
o({ polls: { ...i.features.polls, [x]: { query: _, deadline: i.features.now + 5e3 * (i.features.contextReads[m.key]?.failures ?? 1) } } });
|
|
1603
1608
|
}
|
|
1609
|
+
if (m.mode === "query" && m.operation.kind === "userSuggestedTasks") {
|
|
1610
|
+
const _ = S ? i.features.suggestionReadFailures + 1 : 0, x = { ...i.features.polls };
|
|
1611
|
+
delete x[m.key], S && _ <= 3 && (e.error.retryable || ["connection_interrupted", "request_timed_out", "408", "425", "429", "500", "502", "503", "504"].includes(e.error.code)) && (x[m.key] = { query: m.operation, deadline: i.features.now + 1e3 * 2 ** (_ - 1) }), o({ suggestionReadFailures: _, polls: x });
|
|
1612
|
+
}
|
|
1604
1613
|
if (m.operation.kind === "preference") {
|
|
1605
1614
|
const _ = m.operation.feature, x = i.features.queuedPreferences[_];
|
|
1606
1615
|
if (x) {
|
|
@@ -1627,13 +1636,13 @@ function Gr(t, e, n) {
|
|
|
1627
1636
|
...Object.values(i.interactions.deviceFacts).map((m) => m.snoozedUntil ? Date.parse(m.snoozedUntil) : null)
|
|
1628
1637
|
].filter((m) => m !== null && m > i.features.now), k = v.length ? Math.min(...v) : null;
|
|
1629
1638
|
if (k !== i.features.timerDeadline && !i.features.schedulerError) {
|
|
1630
|
-
const m = i.features.timerRevision + 1, S = k === null ? null :
|
|
1639
|
+
const m = i.features.timerRevision + 1, S = k === null ? null : Mn(r, "wait", `${m}:${k}`);
|
|
1631
1640
|
o({ timerId: S, timerDeadline: k, timerRevision: m }), k !== null && S && s.push({ kind: "stage7.wait", id: S, input: { authority: r, deadline: k } });
|
|
1632
1641
|
}
|
|
1633
1642
|
return { state: i, effects: s };
|
|
1634
1643
|
}
|
|
1635
1644
|
function Jr(t, e) {
|
|
1636
|
-
return t.account.authority ? t.features.queries[
|
|
1645
|
+
return t.account.authority ? t.features.queries[At(t.account.authority, e)] ?? null : null;
|
|
1637
1646
|
}
|
|
1638
1647
|
function we(t) {
|
|
1639
1648
|
if (!t || typeof t != "object" || Array.isArray(t)) throw new Error("Invalid feature response object.");
|
|
@@ -1643,10 +1652,10 @@ function ne(t) {
|
|
|
1643
1652
|
if (typeof t != "string") throw new Error("Invalid feature response string.");
|
|
1644
1653
|
return t;
|
|
1645
1654
|
}
|
|
1646
|
-
function
|
|
1655
|
+
function Tt(t) {
|
|
1647
1656
|
return t == null ? null : ne(t);
|
|
1648
1657
|
}
|
|
1649
|
-
function
|
|
1658
|
+
function Hn(t) {
|
|
1650
1659
|
if (typeof t != "number" || !Number.isSafeInteger(t) || t < 0) throw new Error("Invalid feature revision.");
|
|
1651
1660
|
return t;
|
|
1652
1661
|
}
|
|
@@ -1662,7 +1671,7 @@ function Cs(t) {
|
|
|
1662
1671
|
return t.map(ne);
|
|
1663
1672
|
}
|
|
1664
1673
|
function Fs(t) {
|
|
1665
|
-
const e =
|
|
1674
|
+
const e = Tt(t);
|
|
1666
1675
|
if (e !== null && !Number.isFinite(Date.parse(e))) throw new Error("Invalid feature deadline.");
|
|
1667
1676
|
return e;
|
|
1668
1677
|
}
|
|
@@ -1671,23 +1680,23 @@ function Ci(t) {
|
|
|
1671
1680
|
return {
|
|
1672
1681
|
taskNotificationsEnabled: Yo(e.taskNotificationsEnabled),
|
|
1673
1682
|
tabGroupingEnabled: Yo(e.tabGroupingEnabled),
|
|
1674
|
-
preferencesVersion:
|
|
1683
|
+
preferencesVersion: Hn(e.preferencesVersion),
|
|
1675
1684
|
scribbleStyleEnabled: Yo(e.scribbleStyleEnabled),
|
|
1676
1685
|
blockedOrigins: Cs(e.blockedServiceOrigins),
|
|
1677
|
-
personalInstructions:
|
|
1678
|
-
securityPolicyVersion:
|
|
1686
|
+
personalInstructions: Tt(e.personalInstructions),
|
|
1687
|
+
securityPolicyVersion: Hn(e.securityPolicyVersion)
|
|
1679
1688
|
};
|
|
1680
1689
|
}
|
|
1681
1690
|
function $s(t) {
|
|
1682
1691
|
const e = we(t);
|
|
1683
|
-
return { eligibleSince: Fs(e.eligibleSince), revision:
|
|
1692
|
+
return { eligibleSince: Fs(e.eligibleSince), revision: Hn(e.revision), requestId: Tt(e.requestId), snoozedUntil: Fs(e.snoozedUntil) };
|
|
1684
1693
|
}
|
|
1685
1694
|
function fh(t) {
|
|
1686
1695
|
const e = we(t);
|
|
1687
1696
|
return { notifications: $s(e.notifications), tab_grouping: $s(e.tabGrouping) };
|
|
1688
1697
|
}
|
|
1689
1698
|
function ol(t) {
|
|
1690
|
-
const e = we(t), n = we(e.request), i = ne(n.category), s = ne(n.action), o = { category: i, action: s, promptKey: ne(n.promptKey), expectedRevision:
|
|
1699
|
+
const e = we(t), n = we(e.request), i = ne(n.category), s = ne(n.action), o = { category: i, action: s, promptKey: ne(n.promptKey), expectedRevision: Hn(n.expectedRevision) };
|
|
1691
1700
|
Ca(o);
|
|
1692
1701
|
const a = ne(e.outcome);
|
|
1693
1702
|
if (!["resolved", "snoozed", "suppressed"].includes(a)) throw new Error("Invalid decision outcome.");
|
|
@@ -1697,7 +1706,7 @@ function ol(t) {
|
|
|
1697
1706
|
if (a === "snoozed" && c === null) throw new Error("Missing decision deadline.");
|
|
1698
1707
|
return {
|
|
1699
1708
|
decisionKey: ne(e.decisionKey),
|
|
1700
|
-
revision:
|
|
1709
|
+
revision: Hn(e.revision),
|
|
1701
1710
|
decidedAt: r,
|
|
1702
1711
|
request: { ...o, requestId: ne(n.requestId) },
|
|
1703
1712
|
outcome: a,
|
|
@@ -1720,11 +1729,11 @@ function mh(t) {
|
|
|
1720
1729
|
if (n.template === "semantic_interaction") return { ...i, condition: { template: n.template, event: Xo(n.event) } };
|
|
1721
1730
|
if (n.template === "event_sequence") {
|
|
1722
1731
|
if (!Array.isArray(n.steps)) throw new Error("Invalid proactive sequence.");
|
|
1723
|
-
return { ...i, condition: { template: n.template, steps: n.steps.map(Xo), withinSeconds:
|
|
1732
|
+
return { ...i, condition: { template: n.template, steps: n.steps.map(Xo), withinSeconds: Hn(n.withinSeconds) } };
|
|
1724
1733
|
}
|
|
1725
1734
|
if (n.template === "page_state_after_event") {
|
|
1726
1735
|
const s = we(n.state);
|
|
1727
|
-
return { ...i, condition: { template: n.template, event: Xo(n.event), withinSeconds:
|
|
1736
|
+
return { ...i, condition: { template: n.template, event: Xo(n.event), withinSeconds: Hn(n.withinSeconds), state: {
|
|
1728
1737
|
urlRegex: ne(s.urlRegex),
|
|
1729
1738
|
...s.textRegex == null ? {} : { textRegex: ne(s.textRegex) },
|
|
1730
1739
|
...s.roleRegex == null ? {} : { roleRegex: ne(s.roleRegex) },
|
|
@@ -1735,14 +1744,14 @@ function mh(t) {
|
|
|
1735
1744
|
}
|
|
1736
1745
|
function Ai(t, e) {
|
|
1737
1746
|
const n = we(e);
|
|
1738
|
-
if (t === "contextRun") return { kind: t, value: { status: ne(n.status), runId: ne(n.id), updatedAt:
|
|
1739
|
-
const i = n.latestRun === null || n.latestRun === void 0 ? null : we(n.latestRun), s =
|
|
1747
|
+
if (t === "contextRun") return { kind: t, value: { status: ne(n.status), runId: ne(n.id), updatedAt: Tt(n.completedAt ?? n.createdAt), hasContext: null } };
|
|
1748
|
+
const i = n.latestRun === null || n.latestRun === void 0 ? null : we(n.latestRun), s = Tt(n.activeRefreshRunId);
|
|
1740
1749
|
return { kind: t, value: {
|
|
1741
1750
|
...n.origin === void 0 ? {} : { origin: ne(n.origin) },
|
|
1742
|
-
...i?.createdAt === void 0 ? {} : { latestRun: { id: ne(i.id), status: ne(i.status), createdAt: ne(i.createdAt), completedAt:
|
|
1751
|
+
...i?.createdAt === void 0 ? {} : { latestRun: { id: ne(i.id), status: ne(i.status), createdAt: ne(i.createdAt), completedAt: Tt(i.completedAt), error: Tt(i.error) } },
|
|
1743
1752
|
status: s ? "running" : i ? ne(i.status) : "idle",
|
|
1744
1753
|
runId: s ?? (i ? ne(i.id) : null),
|
|
1745
|
-
updatedAt:
|
|
1754
|
+
updatedAt: Tt(n.latestSnapshotUpdatedAt),
|
|
1746
1755
|
hasContext: ii(n.hasContext)
|
|
1747
1756
|
} };
|
|
1748
1757
|
}
|
|
@@ -1757,7 +1766,7 @@ function fs(t, e) {
|
|
|
1757
1766
|
}
|
|
1758
1767
|
function ms(t) {
|
|
1759
1768
|
const e = we(t);
|
|
1760
|
-
if (!ii(e.success)) throw new Error(
|
|
1769
|
+
if (!ii(e.success)) throw new Error(Tt(e.message) ?? "Failed to submit feedback");
|
|
1761
1770
|
return { kind: "ack", success: !0 };
|
|
1762
1771
|
}
|
|
1763
1772
|
function Zo(t) {
|
|
@@ -1811,16 +1820,16 @@ function yh(t) {
|
|
|
1811
1820
|
}
|
|
1812
1821
|
case "starterPrompts": {
|
|
1813
1822
|
const c = we(await a("/starter-prompts", o ? { page_url: i.pageUrl } : { origin: i.origin, page_url: i.pageUrl, include_user_suggestions: i.includeUserSuggestions }));
|
|
1814
|
-
r = { kind: "starterPrompts", origin: i.origin, prompts: Cs(c.starterPrompts), ...c.runtimeHelpers === void 0 ? {} : { runtimeHelpersJavascript: c.runtimeHelpers === null ? null :
|
|
1823
|
+
r = { kind: "starterPrompts", origin: i.origin, prompts: Cs(c.starterPrompts), ...c.runtimeHelpers === void 0 ? {} : { runtimeHelpersJavascript: c.runtimeHelpers === null ? null : Tt(we(c.runtimeHelpers).javascript) } };
|
|
1815
1824
|
break;
|
|
1816
1825
|
}
|
|
1817
1826
|
case "userSuggestedTasks": {
|
|
1818
|
-
const c = we(await
|
|
1827
|
+
const c = we(await t.http.request("/user-suggested-tasks", {}, void 0, "GET", "runtime", { skipAuthentication: !0 }));
|
|
1819
1828
|
if (!Array.isArray(c.proactiveSuggestions)) throw new Error("Invalid proactive suggestions.");
|
|
1820
1829
|
r = {
|
|
1821
1830
|
kind: "userSuggestedTasks",
|
|
1822
1831
|
prompts: Cs(c.starterPrompts),
|
|
1823
|
-
morningReportOpening:
|
|
1832
|
+
morningReportOpening: Tt(c.morningReportOpening),
|
|
1824
1833
|
signupAt: ne(c.signupAt),
|
|
1825
1834
|
proactiveSuggestions: c.proactiveSuggestions.map(mh)
|
|
1826
1835
|
};
|
|
@@ -1991,7 +2000,7 @@ function $d(t, e, n) {
|
|
|
1991
2000
|
h(new Error("Feature authority retired."));
|
|
1992
2001
|
return;
|
|
1993
2002
|
}
|
|
1994
|
-
if (e.type === "stage7.query" && e.query.kind === "originContext" && y.features.contextObservers[e.query.clientScopeId] !==
|
|
2003
|
+
if (e.type === "stage7.query" && e.query.kind === "originContext" && y.features.contextObservers[e.query.clientScopeId] !== At(i, e.query)) {
|
|
1995
2004
|
h(Object.assign(new Error("Context observation retired."), { code: "observation_released", retryable: !1 }));
|
|
1996
2005
|
return;
|
|
1997
2006
|
}
|
|
@@ -2138,7 +2147,7 @@ function Yr(t, e) {
|
|
|
2138
2147
|
if (e.conversation_id !== t.sessionId) throw new Error("Execution belongs to another conversation.");
|
|
2139
2148
|
if (to(e.version), t.execution && e.version <= t.execution.version) return t;
|
|
2140
2149
|
const n = { ...t.executionByUserMessage };
|
|
2141
|
-
for (const i of
|
|
2150
|
+
for (const i of qt(e)) n[i] = {
|
|
2142
2151
|
version: e.version,
|
|
2143
2152
|
phase: e.phase,
|
|
2144
2153
|
responseMessageIds: e.response_message_groups?.find((s) => s.includes(i)) ?? [i]
|
|
@@ -2359,9 +2368,9 @@ function Ah(t, e, n, i) {
|
|
|
2359
2368
|
}
|
|
2360
2369
|
case "conversation.stop": {
|
|
2361
2370
|
if (n.clients[e.clientScopeId] !== e.conversationScopeId) return { state: t, effects: o };
|
|
2362
|
-
const r = n.selections[e.conversationScopeId].sessionId, c = r ? t.sessions[r]?.execution : null, d = Object.values(t.submissions).filter((f) => (r ? f.sessionId === r : f.conversationScopeId === e.conversationScopeId) && (!e.userMessageIds || e.userMessageIds.includes(f.userMessageId))), u = d.filter((f) => !f.cancelled && (f.delivery !== "failed" || t.deliveries[f.userMessageId]?.phase === "paused" || e.userMessageIds?.includes(f.userMessageId) && t.deliveries[f.userMessageId]?.acceptance === "unissued") && (f.delivery !== "accepted" || f.executionVersion === null)), l = u.length > 0, h = c && ["queued", "thinking", "steering", "stopping"].includes(c.phase) && (!e.userMessageIds ||
|
|
2371
|
+
const r = n.selections[e.conversationScopeId].sessionId, c = r ? t.sessions[r]?.execution : null, d = Object.values(t.submissions).filter((f) => (r ? f.sessionId === r : f.conversationScopeId === e.conversationScopeId) && (!e.userMessageIds || e.userMessageIds.includes(f.userMessageId))), u = d.filter((f) => !f.cancelled && (f.delivery !== "failed" || t.deliveries[f.userMessageId]?.phase === "paused" || e.userMessageIds?.includes(f.userMessageId) && t.deliveries[f.userMessageId]?.acceptance === "unissued") && (f.delivery !== "accepted" || f.executionVersion === null)), l = u.length > 0, h = c && ["queued", "thinking", "steering", "stopping"].includes(c.phase) && (!e.userMessageIds || qt(c).some((f) => e.userMessageIds.includes(f)));
|
|
2363
2372
|
if (!l && !h && (c || !e.userMessageIds?.length)) return { state: t, effects: o };
|
|
2364
|
-
const g = Array.from(new Set(e.userMessageIds ?? [...u.map((f) => f.userMessageId), ...h ?
|
|
2373
|
+
const g = Array.from(new Set(e.userMessageIds ?? [...u.map((f) => f.userMessageId), ...h ? qt(c) : []])), y = { ...t.submissions };
|
|
2365
2374
|
for (const f of d)
|
|
2366
2375
|
g.includes(f.userMessageId) && f.delivery !== "accepted" && (y[f.userMessageId] = { ...f, cancelled: !0, cancellationReason: e.reason ?? "user_requested" });
|
|
2367
2376
|
s = { ...t, submissions: y, stops: { ...t.stops, [e.conversationScopeId]: {
|
|
@@ -2574,7 +2583,7 @@ function ia(t) {
|
|
|
2574
2583
|
};
|
|
2575
2584
|
for (const [r, c] of Object.entries(e.stops))
|
|
2576
2585
|
for (const d of c.userMessageIds) {
|
|
2577
|
-
const u = e.submissions[d], l = u?.sessionId ?? Object.values(e.sessions).find((g) =>
|
|
2586
|
+
const u = e.submissions[d], l = u?.sessionId ?? Object.values(e.sessions).find((g) => qt(g.execution).includes(d))?.sessionId, h = u?.delivery === "accepted" || l && qt(e.sessions[l]?.execution).includes(d);
|
|
2578
2587
|
l && h && a(`stop:${r}:${c.requestId}:${d}`, l, d, c.reason);
|
|
2579
2588
|
}
|
|
2580
2589
|
for (const r of Object.values(e.submissions))
|
|
@@ -3072,7 +3081,7 @@ function Bh(t, e) {
|
|
|
3072
3081
|
${u.textContent?.trim()}`), h = c.closest("[data-canonical-item-key]")?.dataset.canonicalItemKey, g = d ? `${l}:${d.sessionId}:${d.episodeId}` : h ? `${l}:${h}` : l;
|
|
3073
3082
|
if (!i.has(g)) {
|
|
3074
3083
|
if (i.size >= 100) return;
|
|
3075
|
-
i.add(g), e(a, l,
|
|
3084
|
+
i.add(g), e(a, l, $n(u.textContent ?? ""), ...d ? [h, d] : h ? [h] : []);
|
|
3076
3085
|
}
|
|
3077
3086
|
}
|
|
3078
3087
|
}, o = new MutationObserver(s);
|
|
@@ -3124,7 +3133,7 @@ function qa(t) {
|
|
|
3124
3133
|
return `fnv1a-${(e >>> 0).toString(16).padStart(8, "0")}`;
|
|
3125
3134
|
}
|
|
3126
3135
|
function Fh(t, e, n, i, s = {}) {
|
|
3127
|
-
const o = !i && e === "conversation_error" && n !== void 0 && t.conversationDiagnostics?.errorMessageFingerprint === qa(
|
|
3136
|
+
const o = !i && e === "conversation_error" && n !== void 0 && t.conversationDiagnostics?.errorMessageFingerprint === qa($n(n)) ? t.conversationDiagnostics : void 0;
|
|
3128
3137
|
return {
|
|
3129
3138
|
sessionId: ye(t.sessionId),
|
|
3130
3139
|
requestId: ye(o?.httpRequest?.requestId ?? o?.errorRequestId ?? o?.queryRequestId),
|
|
@@ -3134,7 +3143,7 @@ function Fh(t, e, n, i, s = {}) {
|
|
|
3134
3143
|
builds: { sdk: ri.version, ...s }
|
|
3135
3144
|
};
|
|
3136
3145
|
}
|
|
3137
|
-
function
|
|
3146
|
+
function _n(t) {
|
|
3138
3147
|
if (!t || typeof t != "object") return !1;
|
|
3139
3148
|
const e = t, n = (i) => Number.isSafeInteger(i) && i >= 0;
|
|
3140
3149
|
return Object.keys(e).every((i) => [
|
|
@@ -3318,8 +3327,8 @@ function tt(t, e) {
|
|
|
3318
3327
|
if (!Je(t) || e.authorityId !== t.authority.authorityId || e.generation !== t.authority.generation)
|
|
3319
3328
|
throw Object.assign(new Error("Conversation authority was retired."), { code: "authority_retired", retryable: !0 });
|
|
3320
3329
|
}
|
|
3321
|
-
function
|
|
3322
|
-
const n = Xt(t, "connection_interrupted", "web_transport"), { code: i, message: s } = n, o = t instanceof Error && "detail" in t ? t.detail : t instanceof Error && "details" in t ? t.details : void 0, a = o && typeof o == "object" && "httpRequest" in o ? o.httpRequest : o, r = a && typeof a == "object" ? a : {}, c = r.category ?? r.transportCode, d = r.elapsedMs ?? r.durationMs, u = o && typeof o == "object" && "successfulRequests" in o && typeof o.successfulRequests == "number" ? o.successfulRequests : 0, l = o && typeof o == "object" && "securitySettingsUrl" in o && typeof o.securitySettingsUrl == "string" ? o.securitySettingsUrl : void 0, h = o && typeof o == "object" && "httpRequest" in o &&
|
|
3330
|
+
function On(t, e) {
|
|
3331
|
+
const n = Xt(t, "connection_interrupted", "web_transport"), { code: i, message: s } = n, o = t instanceof Error && "detail" in t ? t.detail : t instanceof Error && "details" in t ? t.details : void 0, a = o && typeof o == "object" && "httpRequest" in o ? o.httpRequest : o, r = a && typeof a == "object" ? a : {}, c = r.category ?? r.transportCode, d = r.elapsedMs ?? r.durationMs, u = o && typeof o == "object" && "successfulRequests" in o && typeof o.successfulRequests == "number" ? o.successfulRequests : 0, l = o && typeof o == "object" && "securitySettingsUrl" in o && typeof o.securitySettingsUrl == "string" ? o.securitySettingsUrl : void 0, h = o && typeof o == "object" && "httpRequest" in o && _n(o.httpRequest) ? o.httpRequest : void 0;
|
|
3323
3332
|
return Object.assign(new Error(s), {
|
|
3324
3333
|
code: i,
|
|
3325
3334
|
// Keep the actionable public URL without copying arbitrary transport internals into durable errors.
|
|
@@ -3346,7 +3355,7 @@ function Jh(t) {
|
|
|
3346
3355
|
};
|
|
3347
3356
|
return e = e.then(u, u), e;
|
|
3348
3357
|
}, i = (r, c) => {
|
|
3349
|
-
throw Je(t) && !(r instanceof Error && "code" in r && ["executor_not_ready", "request_timed_out"].includes(String(r.code))) && t.onError?.(r, c),
|
|
3358
|
+
throw Je(t) && !(r instanceof Error && "code" in r && ["executor_not_ready", "request_timed_out"].includes(String(r.code))) && t.onError?.(r, c), On(r, c);
|
|
3350
3359
|
}, s = () => {
|
|
3351
3360
|
const { token: r, protocol: c, ...d } = t.http.auth;
|
|
3352
3361
|
return { ...d, ...t.connectionId() ? { connection_id: t.connectionId() } : {} };
|
|
@@ -3458,14 +3467,14 @@ function Jh(t) {
|
|
|
3458
3467
|
}).catch((d) => {
|
|
3459
3468
|
if (r.previousAcceptance === "unissued" && d instanceof Error && "backendRefusal" in d && d.backendRefusal === !0) {
|
|
3460
3469
|
Je(t) && t.onError?.(d, { operation: r.command.type, requestId: r.command.request_id });
|
|
3461
|
-
const u =
|
|
3470
|
+
const u = On(d);
|
|
3462
3471
|
throw Object.assign(u, { details: { ...u.details, acceptance: "rejected" } });
|
|
3463
3472
|
}
|
|
3464
3473
|
if (!c && r.previousAcceptance === "unissued") {
|
|
3465
|
-
const u =
|
|
3474
|
+
const u = On(d);
|
|
3466
3475
|
throw Object.assign(u, { details: { ...u.details, acceptance: "unissued" } });
|
|
3467
3476
|
}
|
|
3468
|
-
if (d instanceof Error && "code" in d && d.code === "403") throw
|
|
3477
|
+
if (d instanceof Error && "code" in d && d.code === "403") throw On(d);
|
|
3469
3478
|
return i(d, { operation: r.command.type, requestId: r.command.request_id });
|
|
3470
3479
|
});
|
|
3471
3480
|
},
|
|
@@ -3522,7 +3531,7 @@ function Jh(t) {
|
|
|
3522
3531
|
return await t.onUploaded?.(r.source.sourceId, h.sessionId, y), d(), { sessionId: h.sessionId, attachment: y };
|
|
3523
3532
|
}).catch((d) => {
|
|
3524
3533
|
if (!c && r.previousAllocation === "unissued") {
|
|
3525
|
-
const u =
|
|
3534
|
+
const u = On(d);
|
|
3526
3535
|
throw Object.assign(u, { details: { ...u.details, allocation: "unissued" } });
|
|
3527
3536
|
}
|
|
3528
3537
|
return i(d, { operation: "conversation.upload", requestId: r.submission.userMessageId, ...r.submission.sessionId ? { sessionId: r.submission.sessionId } : {} });
|
|
@@ -3553,7 +3562,7 @@ function Jh(t) {
|
|
|
3553
3562
|
} }
|
|
3554
3563
|
).catch((k) => {
|
|
3555
3564
|
if (g.length === 0) throw k;
|
|
3556
|
-
const m =
|
|
3565
|
+
const m = On(k);
|
|
3557
3566
|
throw Object.assign(m, { details: { ...m.details, successfulRequests: g.length } });
|
|
3558
3567
|
});
|
|
3559
3568
|
if (tt(t, r), v.conversation_id !== r.sessionId) throw new Error("Snapshot conversation identity mismatch.");
|
|
@@ -3578,7 +3587,7 @@ function Jh(t) {
|
|
|
3578
3587
|
l(), h();
|
|
3579
3588
|
}
|
|
3580
3589
|
}).catch((c) => {
|
|
3581
|
-
const d =
|
|
3590
|
+
const d = On(c, { requestId: r.requestId, sessionId: r.sessionId });
|
|
3582
3591
|
if (["display_projection_disabled", "409", "connection_interrupted", "request_timed_out", "request_cancelled", "408", "425", "429", "500", "502", "503", "504"].includes(d.code))
|
|
3583
3592
|
throw Object.assign(d, { code: "history_load_failed", message: "We couldn’t refresh this conversation. Try again.", retryable: !0 });
|
|
3584
3593
|
if (Nd(d.code)) throw Object.assign(d, { retryable: !0 });
|
|
@@ -3903,12 +3912,12 @@ function ir(t, e, n, i) {
|
|
|
3903
3912
|
isRetrying: t.isRetrying ?? !1,
|
|
3904
3913
|
historyRefreshFailure: v === e?.error ? t.historyRefreshFailure ?? null : null,
|
|
3905
3914
|
conversationDiagnostics: {
|
|
3906
|
-
...v ? { errorMessageFingerprint: qa(
|
|
3915
|
+
...v ? { errorMessageFingerprint: qa($n(v.message)) } : {},
|
|
3907
3916
|
...u && v && v === u.error && !g ? { failedClientMessageId: u.userMessageId } : {},
|
|
3908
3917
|
...typeof v?.details?.requestId == "string" ? { errorRequestId: v.details.requestId } : {},
|
|
3909
3918
|
...eo(v?.details?.errorNormalization) ? { errorNormalization: v.details.errorNormalization } : {},
|
|
3910
3919
|
...i ? { owner: i } : {},
|
|
3911
|
-
...
|
|
3920
|
+
..._n(v?.details?.httpRequest) ? { httpRequest: v.details.httpRequest } : {},
|
|
3912
3921
|
queryStatus: e?.status ?? null,
|
|
3913
3922
|
queryRequestId: e?.requestId ?? null,
|
|
3914
3923
|
queryUpdatedAt: e?.updatedAt ?? null
|
|
@@ -5412,7 +5421,7 @@ const Yg = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
5412
5421
|
return te;
|
|
5413
5422
|
}
|
|
5414
5423
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
5415
|
-
function
|
|
5424
|
+
function Rt(t, e, n) {
|
|
5416
5425
|
return t.on(e, n), function() {
|
|
5417
5426
|
t.off(e, n);
|
|
5418
5427
|
};
|
|
@@ -5460,10 +5469,10 @@ class au extends Re {
|
|
|
5460
5469
|
return;
|
|
5461
5470
|
const e = this.io;
|
|
5462
5471
|
this.subs = [
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5472
|
+
Rt(e, "open", this.onopen.bind(this)),
|
|
5473
|
+
Rt(e, "packet", this.onpacket.bind(this)),
|
|
5474
|
+
Rt(e, "error", this.onerror.bind(this)),
|
|
5475
|
+
Rt(e, "close", this.onclose.bind(this))
|
|
5467
5476
|
];
|
|
5468
5477
|
}
|
|
5469
5478
|
/**
|
|
@@ -6095,11 +6104,11 @@ class ca extends Re {
|
|
|
6095
6104
|
this.engine = new zg(this.uri, this.opts);
|
|
6096
6105
|
const n = this.engine, i = this;
|
|
6097
6106
|
this._readyState = "opening", this.skipReconnect = !1;
|
|
6098
|
-
const s =
|
|
6107
|
+
const s = Rt(n, "open", function() {
|
|
6099
6108
|
i.onopen(), e && e();
|
|
6100
6109
|
}), o = (r) => {
|
|
6101
6110
|
this.cleanup(), this._readyState = "closed", this.emitReserved("error", r), e ? e(r) : this.maybeReconnectOnOpen();
|
|
6102
|
-
}, a =
|
|
6111
|
+
}, a = Rt(n, "error", o);
|
|
6103
6112
|
if (this._timeout !== !1) {
|
|
6104
6113
|
const r = this._timeout, c = this.setTimeoutFn(() => {
|
|
6105
6114
|
s(), o(new Error("timeout")), n.close();
|
|
@@ -6128,12 +6137,12 @@ class ca extends Re {
|
|
|
6128
6137
|
this.cleanup(), this._readyState = "open", this.emitReserved("open");
|
|
6129
6138
|
const e = this.engine;
|
|
6130
6139
|
this.subs.push(
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6140
|
+
Rt(e, "ping", this.onping.bind(this)),
|
|
6141
|
+
Rt(e, "data", this.ondata.bind(this)),
|
|
6142
|
+
Rt(e, "error", this.onerror.bind(this)),
|
|
6143
|
+
Rt(e, "close", this.onclose.bind(this)),
|
|
6135
6144
|
// @ts-ignore
|
|
6136
|
-
|
|
6145
|
+
Rt(this.decoder, "decoded", this.ondecoded.bind(this))
|
|
6137
6146
|
);
|
|
6138
6147
|
}
|
|
6139
6148
|
/**
|
|
@@ -6748,9 +6757,9 @@ class cu {
|
|
|
6748
6757
|
upstreamRequestId: q,
|
|
6749
6758
|
upstreamTraceId: U
|
|
6750
6759
|
};
|
|
6751
|
-
|
|
6760
|
+
_n(B) && Promise.resolve().then(() => this.options.onRequestFailure ? this.options.onRequestFailure(B) : console.warn("Product Agent HTTP request failed", B)).catch(() => {
|
|
6752
6761
|
});
|
|
6753
|
-
const E =
|
|
6762
|
+
const E = _n(B) ? { httpRequest: B } : void 0;
|
|
6754
6763
|
if (z !== null) {
|
|
6755
6764
|
const N = z !== "deadline" && z !== "unexpected_abort";
|
|
6756
6765
|
throw new L(
|
|
@@ -6823,7 +6832,7 @@ function Ti(t, e) {
|
|
|
6823
6832
|
if (!it(t) || e.authorityId !== t.authority.authorityId || e.generation !== t.authority.generation)
|
|
6824
6833
|
throw new Error("Directory authority is no longer current.");
|
|
6825
6834
|
}
|
|
6826
|
-
function
|
|
6835
|
+
function Nn(t) {
|
|
6827
6836
|
if (t.origin === null) return t;
|
|
6828
6837
|
const e = t.origin.trim();
|
|
6829
6838
|
return { ...t, origin: e.includes("://") ? new URL(e).origin : e.toLowerCase() };
|
|
@@ -6855,7 +6864,7 @@ function rf(t) {
|
|
|
6855
6864
|
"directory.query": async (i) => {
|
|
6856
6865
|
try {
|
|
6857
6866
|
Ti(t, i);
|
|
6858
|
-
const s =
|
|
6867
|
+
const s = Nn(i.query), o = { origin: s.origin, ...s.kind !== "all" ? { pinned: s.kind === "pinned" } : {}, cursor: i.cursor, limit: s.limit };
|
|
6859
6868
|
let a;
|
|
6860
6869
|
if (t.http.auth.client_kind === "embed") {
|
|
6861
6870
|
const r = await t.http.request("/conversations", { ...o, page_url: s.origin ?? t.pageUrl() });
|
|
@@ -6964,12 +6973,12 @@ class af {
|
|
|
6964
6973
|
}
|
|
6965
6974
|
open(e, n = "replace", i) {
|
|
6966
6975
|
if (this.disposed || !it(this.boundary)) return Promise.resolve();
|
|
6967
|
-
e =
|
|
6976
|
+
e = Nn(e);
|
|
6968
6977
|
const s = ke(e);
|
|
6969
6978
|
return n === "replace" && this.options.runtime.engine.getState().slices.directory.queries[s]?.requestId ? (this.refreshAfterRequest.add(s), Promise.resolve()) : (this.requestPage(e, n, i).catch((o) => this.report(o)), Promise.resolve());
|
|
6970
6979
|
}
|
|
6971
6980
|
requestPage(e, n = "replace", i) {
|
|
6972
|
-
return e =
|
|
6981
|
+
return e = Nn(e), this.enqueueQuery(e, () => this.readPage(e, n, i, !0));
|
|
6973
6982
|
}
|
|
6974
6983
|
enqueueQuery(e, n) {
|
|
6975
6984
|
const i = ke(e), s = this.queryRequests.get(i), o = (async () => (await s?.catch(() => {
|
|
@@ -7001,14 +7010,14 @@ class af {
|
|
|
7001
7010
|
return this.refreshPages(e, n, () => !0, !0);
|
|
7002
7011
|
}
|
|
7003
7012
|
refreshObservedQuery(e) {
|
|
7004
|
-
const n = this.options.runtime.engine.getState().slices.directory.queries[ke(
|
|
7013
|
+
const n = this.options.runtime.engine.getState().slices.directory.queries[ke(Nn(e))];
|
|
7005
7014
|
return n?.status === "error" && !Ni(n) ? Promise.resolve() : e.kind !== "pinned" && n?.status === "error" && n.mode === "append" ? this.enqueueQuery(e, async () => {
|
|
7006
|
-
const i = this.options.runtime.engine.getState().slices.directory.queries[ke(
|
|
7015
|
+
const i = this.options.runtime.engine.getState().slices.directory.queries[ke(Nn(e))];
|
|
7007
7016
|
!this.isObserved(e) || i?.status !== "error" || i.mode !== "append" || !Ni(i) || await this.readPage(e, "append", i.cursor);
|
|
7008
7017
|
}) : this.refreshPages(e, e.kind === "pinned", () => this.isObserved(e));
|
|
7009
7018
|
}
|
|
7010
7019
|
refreshPages(e, n, i, s = !1) {
|
|
7011
|
-
return e =
|
|
7020
|
+
return e = Nn(e), this.enqueueQuery(e, async () => {
|
|
7012
7021
|
if (!i()) return;
|
|
7013
7022
|
const o = this.options.runtime.engine.getState().slices.directory.queries[ke(e)];
|
|
7014
7023
|
if (!s && o?.status === "error" && !Ni(o) || (await this.readPage(e, "replace", void 0, s), !n)) return;
|
|
@@ -7037,7 +7046,7 @@ class af {
|
|
|
7037
7046
|
}
|
|
7038
7047
|
observedQueryStates() {
|
|
7039
7048
|
const e = this.options.runtime.engine.getState().slices.directory.queries;
|
|
7040
|
-
return this.options.observedQueries().flatMap((n) => e[ke(
|
|
7049
|
+
return this.options.observedQueries().flatMap((n) => e[ke(Nn(n))] ?? []);
|
|
7041
7050
|
}
|
|
7042
7051
|
isObserved(e) {
|
|
7043
7052
|
return !this.disposed && it(this.boundary) && (this.options.enabled?.() ?? !0) && this.observedQueryStates().some((n) => ke(n.query) === ke(e));
|
|
@@ -7269,7 +7278,6 @@ class Ae extends EventTarget {
|
|
|
7269
7278
|
hydration = null;
|
|
7270
7279
|
hydrations = Promise.resolve();
|
|
7271
7280
|
bootstrapRequests = new AbortController();
|
|
7272
|
-
suggestionTimer = null;
|
|
7273
7281
|
diagnostics = [];
|
|
7274
7282
|
diagnosticTimer = null;
|
|
7275
7283
|
diagnosticFlush = !1;
|
|
@@ -7298,7 +7306,7 @@ class Ae extends EventTarget {
|
|
|
7298
7306
|
}, 12e4));
|
|
7299
7307
|
}
|
|
7300
7308
|
resetBootstrap() {
|
|
7301
|
-
this.bootstrapRequests.abort(), this.bootstrapRequests = new AbortController()
|
|
7309
|
+
this.bootstrapRequests.abort(), this.bootstrapRequests = new AbortController();
|
|
7302
7310
|
for (const [e, n] of this.contextRevisions) this.contextRevisions.set(e, n + 1);
|
|
7303
7311
|
}
|
|
7304
7312
|
queueDiagnostic(e, n = {}) {
|
|
@@ -7378,15 +7386,15 @@ class Ae extends EventTarget {
|
|
|
7378
7386
|
return;
|
|
7379
7387
|
}
|
|
7380
7388
|
if (n.type === "auth.session") {
|
|
7381
|
-
const r = a instanceof L ? a : new L("Chat setup failed", "request_failed");
|
|
7389
|
+
const r = a instanceof L ? a : new L("Chat setup failed", "request_failed"), c = this.isInvalidResponse(r);
|
|
7382
7390
|
this.queueDiagnostic("auth_rejected", {
|
|
7383
7391
|
stage: "bootstrap",
|
|
7384
7392
|
failureKind: "permanent",
|
|
7385
7393
|
httpStatus: /^[45][0-9]{2}$/.test(r.code) ? Number(r.code) : void 0
|
|
7386
7394
|
}), this.fail(new L(
|
|
7387
7395
|
r.message,
|
|
7388
|
-
r.code,
|
|
7389
|
-
r.outcomeUnknown,
|
|
7396
|
+
c ? "invalid_response" : r.code,
|
|
7397
|
+
c ? !1 : r.outcomeUnknown,
|
|
7390
7398
|
{ ...r.detail && typeof r.detail == "object" ? r.detail : {}, stage: "bootstrap" },
|
|
7391
7399
|
r.backendRefusal
|
|
7392
7400
|
), n), this.pause();
|
|
@@ -7449,25 +7457,12 @@ class Ae extends EventTarget {
|
|
|
7449
7457
|
http(e, n = {}, i, s) {
|
|
7450
7458
|
return this.httpTransport.request(e, n, i, s);
|
|
7451
7459
|
}
|
|
7452
|
-
|
|
7453
|
-
|
|
7460
|
+
isInvalidResponse(e) {
|
|
7461
|
+
const n = e instanceof L ? e.detail : void 0;
|
|
7462
|
+
return !!(n && typeof n == "object" && "httpRequest" in n && _n(n.httpRequest) && n.httpRequest.category === "invalid_response");
|
|
7454
7463
|
}
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
this.receive({ type: "starterPrompts.updated", starterPromptsLoading: !0 });
|
|
7458
|
-
try {
|
|
7459
|
-
const o = await this.httpTransport.request("/user-suggested-tasks", {}, void 0, void 0, void 0, { signal: e });
|
|
7460
|
-
!e.aborted && i === this.promptRevision && s === this.options.pageUrl() && this.receive({ ...o, type: "starterPrompts.updated" });
|
|
7461
|
-
} catch (o) {
|
|
7462
|
-
if (e.aborted) return;
|
|
7463
|
-
if (!this.isRetryableRead(o)) {
|
|
7464
|
-
i === this.promptRevision && s === this.options.pageUrl() && this.receive({ type: "starterPrompts.updated", starterPromptsLoading: !1 }), o instanceof L && ["unauthorized", "update_required"].includes(o.code) ? this.fail(o) : console.error("Product Agent optional suggestions could not be loaded", o);
|
|
7465
|
-
return;
|
|
7466
|
-
}
|
|
7467
|
-
this.suggestionTimer = setTimeout(() => {
|
|
7468
|
-
this.suggestionTimer = null, this.loadUserSuggestions(e, n + 1);
|
|
7469
|
-
}, Math.min(3e4, 1e3 * 2 ** Math.min(n, 5)));
|
|
7470
|
-
}
|
|
7464
|
+
isRetryableRead(e) {
|
|
7465
|
+
return this.isInvalidResponse(e) ? !1 : e instanceof TypeError || e instanceof DOMException && e.name === "AbortError" || e instanceof L && ["connection_interrupted", "request_timed_out", "408", "425", "429", "500", "502", "503", "504"].includes(e.code);
|
|
7471
7466
|
}
|
|
7472
7467
|
async dispatch(e, n) {
|
|
7473
7468
|
const { type: i, ...s } = e, o = this.options.auth.client_kind === "embed", a = e.pageUrl ?? e.page?.url ?? this.options.pageUrl(), r = { page_url: a, origin: new URL(a).origin };
|
|
@@ -7485,7 +7480,7 @@ class Ae extends EventTarget {
|
|
|
7485
7480
|
if (h.aborted || !this.isCurrent(n) || (this.credentialBootstrap = null, !this.options.auth.community_id && g.user?.runtimeCommunityId && (this.options.auth.community_id = g.user.runtimeCommunityId), this.receive({ type: "auth.ok", ...g }), h.aborted)) return;
|
|
7486
7481
|
this.options.auth.client_kind === "extension" && this.receive({ type: "executor.registered", userId: g.user.id }), this.bootstrapped = !0;
|
|
7487
7482
|
for (const y of this.beforeBootstrap.splice(0)) this.receive(y);
|
|
7488
|
-
this.synchronizeReferences()
|
|
7483
|
+
this.synchronizeReferences();
|
|
7489
7484
|
return;
|
|
7490
7485
|
}
|
|
7491
7486
|
if (i === "runtime.auth_ack") {
|
|
@@ -7585,11 +7580,11 @@ class Ae extends EventTarget {
|
|
|
7585
7580
|
}), o;
|
|
7586
7581
|
}
|
|
7587
7582
|
}
|
|
7588
|
-
const la = /* @__PURE__ */ new WeakMap(),
|
|
7583
|
+
const la = /* @__PURE__ */ new WeakMap(), Bn = (t) => t === null || typeof t == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(t);
|
|
7589
7584
|
function pf(t) {
|
|
7590
7585
|
if (!t || typeof t != "object") return !1;
|
|
7591
7586
|
const e = t;
|
|
7592
|
-
return typeof e.observedAt == "string" && e.observedAt.length <= 40 && Number.isFinite(Date.parse(e.observedAt)) &&
|
|
7587
|
+
return typeof e.observedAt == "string" && e.observedAt.length <= 40 && Number.isFinite(Date.parse(e.observedAt)) && Bn(e.sessionId) && Bn(e.responseItemId) && Bn(e.respondsToUserMessageId) && typeof e.panelVisible == "boolean" && typeof e.documentVisible == "boolean" && typeof e.loading == "boolean";
|
|
7593
7588
|
}
|
|
7594
7589
|
function hf(t, e, n) {
|
|
7595
7590
|
if (!pf(n)) return;
|
|
@@ -7613,10 +7608,10 @@ function ff(t, e, n, i, s, o, a, r, c = null, d = !1) {
|
|
|
7613
7608
|
return {
|
|
7614
7609
|
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7615
7610
|
authenticated: s,
|
|
7616
|
-
activeClientMessageId:
|
|
7617
|
-
pendingClientMessageId:
|
|
7618
|
-
clientUserMessageItemId: u &&
|
|
7619
|
-
clientResponseItemId: l &&
|
|
7611
|
+
activeClientMessageId: Bn(o) ? o : null,
|
|
7612
|
+
pendingClientMessageId: Bn(a) ? a : null,
|
|
7613
|
+
clientUserMessageItemId: u && Bn(u.id) ? u.id : null,
|
|
7614
|
+
clientResponseItemId: l && Bn(l.id) ? l.id : null,
|
|
7620
7615
|
clientDraftObserved: !!(u && d && c === u.id),
|
|
7621
7616
|
renderer: gf(t, e, n)
|
|
7622
7617
|
};
|
|
@@ -7838,7 +7833,7 @@ function cr(t, e, n) {
|
|
|
7838
7833
|
const s = { ...e, conversation: { ...e.conversation } }, o = { ...t, entities: { ...t.entities, [e.conversation_id]: s } };
|
|
7839
7834
|
return n ? da(o) : o;
|
|
7840
7835
|
}
|
|
7841
|
-
function
|
|
7836
|
+
function jn(t, e, n) {
|
|
7842
7837
|
let i = t;
|
|
7843
7838
|
const s = [];
|
|
7844
7839
|
if (e.type === "directory.authority_replace") {
|
|
@@ -8248,7 +8243,7 @@ function Tl(t, e, n) {
|
|
|
8248
8243
|
const s = { authorityId: e.authorityId, generation: e.generation };
|
|
8249
8244
|
for (const [a, r] of Object.entries(n.optimisticEntries)) {
|
|
8250
8245
|
const c = e.submissions[a];
|
|
8251
|
-
c && ((c.cancelled || c.delivery === "failed") && c.delivery !== "accepted" ? i =
|
|
8246
|
+
c && ((c.cancelled || c.delivery === "failed") && c.delivery !== "accepted" ? i = jn(i, { ...s, type: "directory.optimistic_remove", clientMessageId: a }).state : c.delivery === "accepted" && c.sessionId && r.sessionId === null && (i = jn(i, { ...s, type: "directory.optimistic_accept", clientMessageId: a, sessionId: c.sessionId }).state));
|
|
8252
8247
|
}
|
|
8253
8248
|
const o = /* @__PURE__ */ new Set();
|
|
8254
8249
|
for (const a of e.submissionOrder) {
|
|
@@ -8256,7 +8251,7 @@ function Tl(t, e, n) {
|
|
|
8256
8251
|
if (r.cancelled || r.delivery === "failed" || o.has(r.conversationScopeId)) continue;
|
|
8257
8252
|
o.add(r.conversationScopeId);
|
|
8258
8253
|
const c = Object.keys(n.optimisticEntries).some((d) => t.submissions[d]?.conversationScopeId === r.conversationScopeId && !i.optimisticEntries[d]);
|
|
8259
|
-
r.sessionId !== null || i.optimisticEntries[a] || t.submissions[a] && !c || (i =
|
|
8254
|
+
r.sessionId !== null || i.optimisticEntries[a] || t.submissions[a] && !c || (i = jn(i, { ...s, type: "directory.optimistic_upsert", entry: {
|
|
8260
8255
|
id: `optimistic-user-message:${a}`,
|
|
8261
8256
|
clientMessageId: a,
|
|
8262
8257
|
sessionId: null,
|
|
@@ -8272,7 +8267,7 @@ function Tl(t, e, n) {
|
|
|
8272
8267
|
const d = fn(e, n, c), u = fn(t, n, c);
|
|
8273
8268
|
if (d.activity.phase === u.activity.phase) continue;
|
|
8274
8269
|
const l = ["submitting", "awaiting_execution", "thinking", "steering", "queued", "stopping"].includes(d.activity.phase);
|
|
8275
|
-
i =
|
|
8270
|
+
i = jn(i, { ...s, type: "directory.activity_set", sessionId: a, active: l }).state;
|
|
8276
8271
|
}
|
|
8277
8272
|
return i;
|
|
8278
8273
|
}
|
|
@@ -8305,7 +8300,7 @@ class qf {
|
|
|
8305
8300
|
return { state: d.state === o.slices.activeUsers ? o : Object.freeze({ revision: o.revision + 1, slices: Object.freeze({ ...o.slices, activeUsers: d.state }) }), effects: d.effects };
|
|
8306
8301
|
}
|
|
8307
8302
|
if (Cf(r)) {
|
|
8308
|
-
const d =
|
|
8303
|
+
const d = jn(o.slices.directory, r, o.slices.conversation), u = ia(ea(o.slices.conversation, d.state, r.type === "directory.authority_replace" && r.adoptLocalSubmissions === !0)), l = ta(o.slices.conversation, u.state, d.state, d.state.clients !== o.slices.directory.clients), h = l.state, g = Tl(o.slices.conversation, h, d.state);
|
|
8309
8304
|
return { state: g === o.slices.directory && h === o.slices.conversation ? o : Object.freeze({
|
|
8310
8305
|
revision: o.revision + 1,
|
|
8311
8306
|
slices: Object.freeze({ ...o.slices, directory: g, conversation: h })
|
|
@@ -8317,7 +8312,7 @@ class qf {
|
|
|
8317
8312
|
for (const [v, k] of Object.entries(d.state.operations)) {
|
|
8318
8313
|
if (!["runtime.warmup", "attachment.prepare"].includes(k.command.type) || !k.conversationScopeId || k.phase !== "done" || o.slices.conversation.operations[v]?.phase === "done") continue;
|
|
8319
8314
|
const m = k.result, S = u.selections[k.conversationScopeId];
|
|
8320
|
-
m?.sessionId && S?.provisionalId && S.sessionId === null && Object.values(u.clients).includes(k.conversationScopeId) && (u =
|
|
8315
|
+
m?.sessionId && S?.provisionalId && S.sessionId === null && Object.values(u.clients).includes(k.conversationScopeId) && (u = jn(u, {
|
|
8321
8316
|
authorityId: d.state.authorityId,
|
|
8322
8317
|
generation: d.state.generation,
|
|
8323
8318
|
type: "directory.accepted",
|
|
@@ -8329,7 +8324,7 @@ class qf {
|
|
|
8329
8324
|
const l = Object.values(d.state.submissions).find((v) => v.delivery === "accepted" && o.slices.conversation.submissions[v.userMessageId]?.delivery !== "accepted");
|
|
8330
8325
|
if (l) {
|
|
8331
8326
|
const v = u.selections[l.conversationScopeId];
|
|
8332
|
-
!l.cancelled && v?.provisionalId && (u =
|
|
8327
|
+
!l.cancelled && v?.provisionalId && (u = jn(u, {
|
|
8333
8328
|
type: "directory.accepted",
|
|
8334
8329
|
authorityId: d.state.authorityId,
|
|
8335
8330
|
generation: d.state.generation,
|
|
@@ -8404,7 +8399,7 @@ class qf {
|
|
|
8404
8399
|
},
|
|
8405
8400
|
errorAdapter: (o) => {
|
|
8406
8401
|
const a = Xt(o), r = o !== null && typeof o == "object" ? "details" in o ? o.details : "detail" in o ? o.detail : void 0 : void 0, c = r && typeof r == "object" && "httpRequest" in r ? r.httpRequest : void 0;
|
|
8407
|
-
return { ...a, ...
|
|
8402
|
+
return { ...a, ..._n(c) ? { details: { ...a.details, httpRequest: c } } : {} };
|
|
8408
8403
|
}
|
|
8409
8404
|
});
|
|
8410
8405
|
}
|
|
@@ -9403,7 +9398,7 @@ class $a {
|
|
|
9403
9398
|
b.sessionId === this.getState().sessionId && this.startNewSession({ notifyTransport: !1 });
|
|
9404
9399
|
return;
|
|
9405
9400
|
}
|
|
9406
|
-
Be("web-sdk.conversation", "Conversation operation failed", { ...b, ...
|
|
9401
|
+
Be("web-sdk.conversation", "Conversation operation failed", { ...b, ...Ln(f) }), f instanceof L && f.backendRefusal && b.operation.startsWith("chat.") ? this.applyAccountSubmissionError(f.code) : this.handleDirectoryTransportError(f);
|
|
9407
9402
|
}
|
|
9408
9403
|
})
|
|
9409
9404
|
});
|
|
@@ -9427,7 +9422,7 @@ class $a {
|
|
|
9427
9422
|
if (!i()) return;
|
|
9428
9423
|
w && (b || Object.keys(w.operations).length || Object.keys(w.stops).length) && await this.clientRuntime.engine.dispatch({ ...n, type: "conversation.restore_delivery", checkpoint: w });
|
|
9429
9424
|
}
|
|
9430
|
-
if (this.authenticatedUserId && (this.queuedClientEvents = this.queuedClientEvents.filter((f) => !["chat.user_message", "chat.retry_last_user_message", "run.stop", "runtime.warmup", "session.reset", "attachment.upload_completed"].includes(f.type))),
|
|
9425
|
+
if (this.authenticatedUserId && (this.queuedClientEvents = this.queuedClientEvents.filter((f) => !["chat.user_message", "chat.retry_last_user_message", "run.stop", "runtime.warmup", "session.reset", "attachment.upload_completed"].includes(f.type))), Dn(this.options.clientId, this.queuedClientEvents), !i()) return;
|
|
9431
9426
|
this.conversationObservation = new Qh({
|
|
9432
9427
|
authority: n,
|
|
9433
9428
|
now: () => Date.now(),
|
|
@@ -9489,8 +9484,8 @@ class $a {
|
|
|
9489
9484
|
if (!k.startsWith(`background:${this.modelClientScopeId}:`)) continue;
|
|
9490
9485
|
const S = fn(f.conversation, f.directory, m), _ = S.sessionId ? f.conversation.sessions[S.sessionId] : void 0;
|
|
9491
9486
|
if (this.firstResponseTimersByClientMessageId.size && (u(ir(S, _?.queries.current, this.options.backendUrl).messages, S.sessionId), ["failed", "stopped"].includes(S.activity.phase)))
|
|
9492
|
-
for (const R of
|
|
9493
|
-
const x = S.activity.phase === "completed" &&
|
|
9487
|
+
for (const R of qt(_?.execution)) this.clearFirstResponseTimer(R);
|
|
9488
|
+
const x = S.activity.phase === "completed" && qt(_?.execution).some((R) => this.firstResponseTimersByClientMessageId.has(R));
|
|
9494
9489
|
(w && S.sessionId === this.getState().sessionId || !x && ["completed", "failed", "stopped"].includes(S.activity.phase)) && this.directoryScope.detach(k);
|
|
9495
9490
|
}
|
|
9496
9491
|
const v = this.getState();
|
|
@@ -9559,7 +9554,7 @@ class $a {
|
|
|
9559
9554
|
i.sessionId ? e.conversation.sessions[i.sessionId]?.queries.current : void 0,
|
|
9560
9555
|
this.options.backendUrl,
|
|
9561
9556
|
this.clientRuntime.engine.getDiagnostics({ clientScopeId: this.modelClientScopeId, scopeId: n, sessionId: i.sessionId })
|
|
9562
|
-
), o = { clientScopeId: this.modelClientScopeId, origin: location.origin, pageUrl: location.href }, a = Jr(e, { kind: "starterPrompts", ...o, includeUserSuggestions: !1 }), r = Jr(e, { kind: "appearance", ...o }), c = r?.data?.kind === "appearance" ? r.data.value : null;
|
|
9557
|
+
), o = { clientScopeId: this.modelClientScopeId, origin: location.origin, pageUrl: location.href }, a = Jr(e, this.options.productVariant === "personal" ? { kind: "userSuggestedTasks" } : { kind: "starterPrompts", ...o, includeUserSuggestions: !1 }), r = Jr(e, { kind: "appearance", ...o }), c = r?.data?.kind === "appearance" ? r.data.value : null;
|
|
9563
9558
|
return {
|
|
9564
9559
|
...this.platformState,
|
|
9565
9560
|
...s,
|
|
@@ -9571,7 +9566,7 @@ class $a {
|
|
|
9571
9566
|
lastError: s.lastError ?? this.platformState.lastError,
|
|
9572
9567
|
lastErrorCode: s.lastErrorCode ?? this.platformState.lastErrorCode,
|
|
9573
9568
|
lastErrorSecuritySettingsUrl: !s.lastErrorCode || s.lastErrorCode === this.platformState.lastErrorCode ? this.platformState.lastErrorSecuritySettingsUrl : null,
|
|
9574
|
-
starterPrompts: a?.data
|
|
9569
|
+
starterPrompts: a?.data && (a.data.kind === "starterPrompts" || a.data.kind === "userSuggestedTasks") ? [...a.data.prompts] : yy(this.options.initialStarterPrompts),
|
|
9575
9570
|
starterPromptsLoading: a?.status === "loading" || a?.status === "refreshing",
|
|
9576
9571
|
appearance: c ? { accentColor: c.accent, colorScheme: c.colorScheme, fontFamily: c.fontFamily, scribbleStyle: c.scribbleStyle } : null
|
|
9577
9572
|
};
|
|
@@ -9949,8 +9944,8 @@ class $a {
|
|
|
9949
9944
|
errorFingerprint: n,
|
|
9950
9945
|
...s ? { renderedError: s } : {},
|
|
9951
9946
|
...o ? { historyRefreshFailure: o } : {},
|
|
9952
|
-
...
|
|
9953
|
-
...i ? { displayedMessage:
|
|
9947
|
+
..._n(a) ? { httpRequest: a } : {},
|
|
9948
|
+
...i ? { displayedMessage: $n(i) } : {}
|
|
9954
9949
|
});
|
|
9955
9950
|
}
|
|
9956
9951
|
getModel() {
|
|
@@ -10437,7 +10432,7 @@ class $a {
|
|
|
10437
10432
|
}
|
|
10438
10433
|
send(e) {
|
|
10439
10434
|
const n = this.sendNow(ht(e));
|
|
10440
|
-
return n || (this.queuedClientEvents.push(e),
|
|
10435
|
+
return n || (this.queuedClientEvents.push(e), Dn(this.options.clientId, this.queuedClientEvents), this.setState({ status: "reconnecting" }), this.scheduleReconnect()), n;
|
|
10441
10436
|
}
|
|
10442
10437
|
sendNow(e) {
|
|
10443
10438
|
if (!this.socket || this.socket.readyState !== WebSocket.OPEN)
|
|
@@ -10445,8 +10440,8 @@ class $a {
|
|
|
10445
10440
|
const n = this.socket;
|
|
10446
10441
|
if ((e.type === "tool.result" || e.type === "run.stop") && n instanceof Ae) {
|
|
10447
10442
|
const i = this.queuedClientEvents.find((s) => "sessionId" in s && s.sessionId === e.sessionId && (e.type === "tool.result" && s.type === "tool.result" && s.callId === e.callId || e.type === "run.stop" && s.type === "run.stop" && s.expectedUserMessageId === e.expectedUserMessageId)) ?? e;
|
|
10448
|
-
return this.queuedClientEvents.includes(i) || this.queuedClientEvents.push(i),
|
|
10449
|
-
this.pendingRetainedCommandDeliveries.delete(i), s && (this.queuedClientEvents = this.queuedClientEvents.filter((o) => o !== i),
|
|
10443
|
+
return this.queuedClientEvents.includes(i) || this.queuedClientEvents.push(i), Dn(this.options.clientId, this.queuedClientEvents), this.pendingRetainedCommandDeliveries.has(i) || (this.pendingRetainedCommandDeliveries.add(i), n.sendRetainedCommand(ht(i)).then((s) => {
|
|
10444
|
+
this.pendingRetainedCommandDeliveries.delete(i), s && (this.queuedClientEvents = this.queuedClientEvents.filter((o) => o !== i), Dn(this.options.clientId, this.queuedClientEvents));
|
|
10450
10445
|
})), !0;
|
|
10451
10446
|
}
|
|
10452
10447
|
try {
|
|
@@ -10469,7 +10464,7 @@ class $a {
|
|
|
10469
10464
|
this.options.backendUrl
|
|
10470
10465
|
) });
|
|
10471
10466
|
}
|
|
10472
|
-
if (n.httpRequest && (!
|
|
10467
|
+
if (n.httpRequest && (!_n(n.httpRequest) || n.httpRequest.sessionId !== null && n.httpRequest.sessionId !== i.sessionId) || n.historyRefreshFailure && (n.historyRefreshFailure.consecutiveFailures < 3 || n.historyRefreshFailure.sessionId !== i.sessionId) || n.renderedError && n.renderedError.sessionId !== i.sessionId || n.uiInvariant && n.uiInvariant.current.sessionId !== i.sessionId) return;
|
|
10473
10468
|
const s = n.historyRefreshFailure?.episodeId ?? (n.renderedError ? `${n.errorFingerprint}:${n.renderedError.itemId}` : void 0) ?? n.errorFingerprint ?? n.clientMessageId ?? (n.previousPhase && n.nextPhase ? `${n.previousPhase}:${n.nextPhase}:${n.reason ?? "unknown"}` : null);
|
|
10474
10469
|
if (s) {
|
|
10475
10470
|
const y = `${e}:${s}:${e === "invalid_state_transition" ? n.reason ?? "unknown" : ""}`;
|
|
@@ -10699,7 +10694,7 @@ class $a {
|
|
|
10699
10694
|
const e = { clientScopeId: this.modelClientScopeId, origin: location.origin, pageUrl: location.href };
|
|
10700
10695
|
return Promise.all([
|
|
10701
10696
|
er(this.clientRuntime, { kind: "appearance", ...e }),
|
|
10702
|
-
er(this.clientRuntime, { kind: "starterPrompts", ...e, includeUserSuggestions: !1 }).then(async (n) => {
|
|
10697
|
+
er(this.clientRuntime, this.options.productVariant === "personal" ? { kind: "userSuggestedTasks" } : { kind: "starterPrompts", ...e, includeUserSuggestions: !1 }).then(async (n) => {
|
|
10703
10698
|
n.kind === "starterPrompts" && n.prompts.length === 0 && location.href === e.pageUrl && await this.requestTransientStarterPrompts();
|
|
10704
10699
|
})
|
|
10705
10700
|
]).then(() => {
|
|
@@ -10710,16 +10705,16 @@ class $a {
|
|
|
10710
10705
|
}
|
|
10711
10706
|
flushQueuedClientEvents() {
|
|
10712
10707
|
const e = [...this.queuedClientEvents];
|
|
10713
|
-
this.queuedClientEvents = this.queuedClientEvents.filter((n) => (n.type === "tool.result" || n.type === "run.stop") && this.socket instanceof Ae),
|
|
10708
|
+
this.queuedClientEvents = this.queuedClientEvents.filter((n) => (n.type === "tool.result" || n.type === "run.stop") && this.socket instanceof Ae), Dn(this.options.clientId, this.queuedClientEvents);
|
|
10714
10709
|
for (let n = 0; n < e.length; n++)
|
|
10715
10710
|
if (!this.sendNow(ht(e[n]))) {
|
|
10716
10711
|
this.queuedClientEvents.unshift(...e.slice(n).filter((i) => !this.queuedClientEvents.includes(i)));
|
|
10717
10712
|
break;
|
|
10718
10713
|
}
|
|
10719
|
-
|
|
10714
|
+
Dn(this.options.clientId, this.queuedClientEvents);
|
|
10720
10715
|
}
|
|
10721
10716
|
resetForAuthenticationScopeChange() {
|
|
10722
|
-
this.resetConversationSelection({ notifyTransport: !1 }), this.queuedClientEvents = [],
|
|
10717
|
+
this.resetConversationSelection({ notifyTransport: !1 }), this.queuedClientEvents = [], Dn(this.options.clientId, this.queuedClientEvents);
|
|
10723
10718
|
}
|
|
10724
10719
|
applyAuthenticatedDirectoryIdentity(e) {
|
|
10725
10720
|
const n = Fl(e);
|
|
@@ -10854,6 +10849,10 @@ class $a {
|
|
|
10854
10849
|
});
|
|
10855
10850
|
return;
|
|
10856
10851
|
}
|
|
10852
|
+
if (e.code === "invalid_response" && e.stage === "bootstrap") {
|
|
10853
|
+
this.stopAuthentication(new L(String(e.message), "connection_failed", !1, { stage: "bootstrap" }));
|
|
10854
|
+
return;
|
|
10855
|
+
}
|
|
10857
10856
|
if (!this.options.webSocketFactory && (e.code === "unauthorized" || e.code === "401") && e.reason === "invalid_token" && (this.canRefreshInvalidCredential() || this.credentialRecovery !== null)) {
|
|
10858
10857
|
const n = this.socket;
|
|
10859
10858
|
if (n instanceof Ae) {
|
|
@@ -12348,7 +12347,7 @@ function qy(t) {
|
|
|
12348
12347
|
return [];
|
|
12349
12348
|
}
|
|
12350
12349
|
}
|
|
12351
|
-
function
|
|
12350
|
+
function Dn(t, e) {
|
|
12352
12351
|
try {
|
|
12353
12352
|
const n = e.filter(Ka);
|
|
12354
12353
|
if (n.length === 0) {
|
|
@@ -12822,16 +12821,16 @@ function fb(t) {
|
|
|
12822
12821
|
inner: "#4b4b4b",
|
|
12823
12822
|
shadow: "#000000"
|
|
12824
12823
|
} : {
|
|
12825
|
-
top:
|
|
12826
|
-
middle:
|
|
12827
|
-
bottom:
|
|
12828
|
-
edgeStart:
|
|
12829
|
-
edgeMiddle:
|
|
12830
|
-
edgeEnd:
|
|
12831
|
-
glow:
|
|
12832
|
-
highlight:
|
|
12833
|
-
inner:
|
|
12834
|
-
shadow:
|
|
12824
|
+
top: Nt(e, 0.28, -0.03),
|
|
12825
|
+
middle: Nt(e, 0.08, 0.04),
|
|
12826
|
+
bottom: Nt(e, -0.1, 0.02),
|
|
12827
|
+
edgeStart: Nt(e, 0.08, 0.08),
|
|
12828
|
+
edgeMiddle: Nt(e, -0.08, 0.08),
|
|
12829
|
+
edgeEnd: Nt(e, -0.18, 0.05),
|
|
12830
|
+
glow: Nt(e, 0.32, -0.12),
|
|
12831
|
+
highlight: Nt(e, 0.38, -0.18),
|
|
12832
|
+
inner: Nt(e, 0.24, -0.1),
|
|
12833
|
+
shadow: Nt(e, -0.25, -0.08)
|
|
12835
12834
|
};
|
|
12836
12835
|
}
|
|
12837
12836
|
function zu(t) {
|
|
@@ -12868,7 +12867,7 @@ function mb(t, e, n) {
|
|
|
12868
12867
|
t[2] + (e[2] - t[2]) * i
|
|
12869
12868
|
];
|
|
12870
12869
|
}
|
|
12871
|
-
function
|
|
12870
|
+
function Nt(t, e, n) {
|
|
12872
12871
|
const [i, s, o] = yb($i(t));
|
|
12873
12872
|
return fa(bb(i, ya(s + n), ya(o + e)));
|
|
12874
12873
|
}
|
|
@@ -13551,9 +13550,9 @@ async function lw(t = {}) {
|
|
|
13551
13550
|
ci.clear();
|
|
13552
13551
|
};
|
|
13553
13552
|
let vt = 0, en = 0, sc = 0;
|
|
13554
|
-
const
|
|
13553
|
+
const Pt = /* @__PURE__ */ new Map();
|
|
13555
13554
|
let tn = null, jt = null;
|
|
13556
|
-
const ho = (p) => p === $ ? "widget_composer" : p === m ? "widget_launcher" : p && a.contains(p) ? "widget_control" : p === w.body ? "body" : p === w.documentElement ? "document" : p ? "host_page" : "none",
|
|
13555
|
+
const ho = (p) => p === $ ? "widget_composer" : p === m ? "widget_launcher" : p && a.contains(p) ? "widget_control" : p === w.body ? "body" : p === w.documentElement ? "document" : p ? "host_page" : "none", vn = (p, I, C = {}) => {
|
|
13557
13556
|
const A = xs(w), j = C.skipIfAlreadyFocused === !0 && A === p;
|
|
13558
13557
|
j || (C.preventScroll ? p.focus({ preventScroll: !0 }) : p.focus());
|
|
13559
13558
|
const X = xs(w);
|
|
@@ -13578,7 +13577,7 @@ async function lw(t = {}) {
|
|
|
13578
13577
|
isThinking: M.getState().isThinking
|
|
13579
13578
|
}
|
|
13580
13579
|
), !j && X === p;
|
|
13581
|
-
}, nn = (p) => !$.isConnected || $.disabled || $.readOnly || !r.classList.contains("pluno-pa-widget--open") || e.loginRequired || e.signupRequired || Qn(e.billingStatus) ? !1 :
|
|
13580
|
+
}, nn = (p) => !$.isConnected || $.disabled || $.readOnly || !r.classList.contains("pluno-pa-widget--open") || e.loginRequired || e.signupRequired || Qn(e.billingStatus) ? !1 : vn($, p, {
|
|
13582
13581
|
preventScroll: !0,
|
|
13583
13582
|
skipIfAlreadyFocused: !0
|
|
13584
13583
|
}), li = () => {
|
|
@@ -13645,7 +13644,7 @@ async function lw(t = {}) {
|
|
|
13645
13644
|
...A ? { proactiveSuggestionQuestion: C.text } : {}
|
|
13646
13645
|
})) throw Object.assign(new Error("The task was not submitted."), { code: "interaction_not_started" });
|
|
13647
13646
|
} else if (C.kind === "edit")
|
|
13648
|
-
rt = e.proactiveSuggestion, _e = !0, M.stageProactiveSuggestionQuestion(C.text),
|
|
13647
|
+
rt = e.proactiveSuggestion, _e = !0, M.stageProactiveSuggestionQuestion(C.text), Ot("Yes, but ", !0, !0, !0, "proactive_suggestion");
|
|
13649
13648
|
else throw new Error("The requested platform action is unavailable.");
|
|
13650
13649
|
} },
|
|
13651
13650
|
activeUsersLoader: e.activeUsersLoader,
|
|
@@ -13662,20 +13661,20 @@ async function lw(t = {}) {
|
|
|
13662
13661
|
} catch (p) {
|
|
13663
13662
|
throw go?.release(), o.remove(), p;
|
|
13664
13663
|
}
|
|
13665
|
-
let di = M.getState().sessionId, ui = M.getState().selectionKey, pi = M.getState().user?.id ?? null,
|
|
13664
|
+
let di = M.getState().sessionId, ui = M.getState().selectionKey, pi = M.getState().user?.id ?? null, Mt = Ns.find(
|
|
13666
13665
|
(p) => p.value === e.model
|
|
13667
13666
|
)?.value ?? Vs[0].value, hi = !1;
|
|
13668
13667
|
const ac = e.productVariant === "personal" && e.onModelChange !== void 0;
|
|
13669
13668
|
de.hidden = !ac;
|
|
13670
13669
|
const Wn = () => {
|
|
13671
|
-
const p = Ns.find((C) => C.value ===
|
|
13672
|
-
Me.textContent = p?.label ??
|
|
13670
|
+
const p = Ns.find((C) => C.value === Mt), I = hi;
|
|
13671
|
+
Me.textContent = p?.label ?? Mt, de.dataset.loading = String(I), de.setAttribute("aria-disabled", String(I));
|
|
13673
13672
|
for (const C of ce) {
|
|
13674
|
-
const A = C.dataset.model ===
|
|
13673
|
+
const A = C.dataset.model === Mt;
|
|
13675
13674
|
C.classList.toggle("is-selected", A), C.setAttribute("aria-selected", String(A)), C.disabled = I;
|
|
13676
13675
|
}
|
|
13677
13676
|
}, gp = (p) => {
|
|
13678
|
-
|
|
13677
|
+
Mt = p, M.setModel(p), Wn();
|
|
13679
13678
|
};
|
|
13680
13679
|
Wn(), de.addEventListener("toggle", () => {
|
|
13681
13680
|
de.open && hi && (de.open = !1), de.open || de.querySelector(".pluno-pa-widget__model-more")?.removeAttribute("open");
|
|
@@ -13687,13 +13686,13 @@ async function lw(t = {}) {
|
|
|
13687
13686
|
for (const p of ce)
|
|
13688
13687
|
p.addEventListener("click", () => {
|
|
13689
13688
|
const I = Ns.find((A) => A.value === p.dataset.model);
|
|
13690
|
-
if (!I || I.value ===
|
|
13689
|
+
if (!I || I.value === Mt && M.getModel() === I.value || hi) {
|
|
13691
13690
|
de.open = !1;
|
|
13692
13691
|
return;
|
|
13693
13692
|
}
|
|
13694
|
-
const C =
|
|
13695
|
-
|
|
13696
|
-
|
|
13693
|
+
const C = Mt;
|
|
13694
|
+
Mt = I.value, hi = !0, de.open = !1, de.title = "", Wn(), Promise.resolve(e.onModelChange?.(I.value)).then(() => gp(I.value)).catch(() => {
|
|
13695
|
+
Mt = C, de.title = "Could not change model";
|
|
13697
13696
|
}).finally(() => {
|
|
13698
13697
|
hi = !1, Wn();
|
|
13699
13698
|
});
|
|
@@ -13715,7 +13714,7 @@ async function lw(t = {}) {
|
|
|
13715
13714
|
const fo = new Set(d.openToolGroupKeys);
|
|
13716
13715
|
let It = null, sn = null, Ue = !1, on = !1, Ft = {
|
|
13717
13716
|
enabled: !0
|
|
13718
|
-
}, rn = 0, mo = null,
|
|
13717
|
+
}, rn = 0, mo = null, In = null, Sn = null, Qi = null, gi = !1, ve = null, lc = "local";
|
|
13719
13718
|
const dc = (p) => di !== null && di !== p.sessionId || pi !== null && pi !== (p.user?.id ?? null) || ui !== void 0 && ui !== p.selectionKey, uc = (p) => Jp(F, p, {
|
|
13720
13719
|
renderSource: lc,
|
|
13721
13720
|
guardCreatedAt: ve?.createdAt ?? null,
|
|
@@ -13742,8 +13741,8 @@ async function lw(t = {}) {
|
|
|
13742
13741
|
}, yp = (p = "jump") => {
|
|
13743
13742
|
dt(!0, p), St(), Xn(F, () => Ft.enabled), rn = F.scrollTop;
|
|
13744
13743
|
}, Zi = (p) => {
|
|
13745
|
-
mo = p, p === "up" && F.scrollTop < rn - 1 && (gi = !0, dt(!1, "userScroll")),
|
|
13746
|
-
mo = null,
|
|
13744
|
+
mo = p, p === "up" && F.scrollTop < rn - 1 && (gi = !0, dt(!1, "userScroll")), In !== null && window.clearTimeout(In), In = window.setTimeout(() => {
|
|
13745
|
+
mo = null, In = null;
|
|
13747
13746
|
}, 500);
|
|
13748
13747
|
};
|
|
13749
13748
|
$t = () => {
|
|
@@ -13851,7 +13850,7 @@ async function lw(t = {}) {
|
|
|
13851
13850
|
e.position
|
|
13852
13851
|
)
|
|
13853
13852
|
), dd(r), Ge(), !A && e.layout === "floating" && M.recordWidgetLifecycle("minimized", C), I && es("minimized", C);
|
|
13854
|
-
},
|
|
13853
|
+
}, xn = (p, I = {}) => {
|
|
13855
13854
|
xw(p, {
|
|
13856
13855
|
debugVersion: rw,
|
|
13857
13856
|
launcherPosition: l,
|
|
@@ -13877,7 +13876,7 @@ async function lw(t = {}) {
|
|
|
13877
13876
|
return Gi(), C;
|
|
13878
13877
|
}
|
|
13879
13878
|
const I = fi(p);
|
|
13880
|
-
return hn(r, I), Gi(),
|
|
13879
|
+
return hn(r, I), Gi(), xn("Applied stored closed launcher position", {
|
|
13881
13880
|
visibleLauncherPosition: I
|
|
13882
13881
|
}), I;
|
|
13883
13882
|
}, ts = (p, I) => {
|
|
@@ -13890,7 +13889,7 @@ async function lw(t = {}) {
|
|
|
13890
13889
|
y: p.y - I.y
|
|
13891
13890
|
});
|
|
13892
13891
|
}, Io = () => {
|
|
13893
|
-
const p =
|
|
13892
|
+
const p = Un(g).width;
|
|
13894
13893
|
return x.getBoundingClientRect().width || p;
|
|
13895
13894
|
}, bc = () => {
|
|
13896
13895
|
if (r.classList.contains("pluno-pa-widget--minimized")) {
|
|
@@ -13907,7 +13906,7 @@ async function lw(t = {}) {
|
|
|
13907
13906
|
const p = yi();
|
|
13908
13907
|
if (r.classList.contains("pluno-pa-widget--open") || r.classList.contains("pluno-pa-widget--closing")) {
|
|
13909
13908
|
Cr(r, g);
|
|
13910
|
-
const I =
|
|
13909
|
+
const I = Un(g);
|
|
13911
13910
|
Pr(
|
|
13912
13911
|
q,
|
|
13913
13912
|
Io()
|
|
@@ -13921,11 +13920,11 @@ async function lw(t = {}) {
|
|
|
13921
13920
|
),
|
|
13922
13921
|
I
|
|
13923
13922
|
);
|
|
13924
|
-
ts(C, p),
|
|
13923
|
+
ts(C, p), xn(
|
|
13925
13924
|
"Applied open panel position after viewport resize",
|
|
13926
13925
|
{ openPanelPosition: C }
|
|
13927
13926
|
);
|
|
13928
|
-
} else l &&
|
|
13927
|
+
} else l && xn(
|
|
13929
13928
|
"Applied visible launcher position after viewport resize",
|
|
13930
13929
|
{ visibleLauncherPosition: p }
|
|
13931
13930
|
);
|
|
@@ -13946,16 +13945,16 @@ async function lw(t = {}) {
|
|
|
13946
13945
|
l = Rr(
|
|
13947
13946
|
A,
|
|
13948
13947
|
C
|
|
13949
|
-
), y = null, hn(r, A), Gi(),
|
|
13948
|
+
), y = null, hn(r, A), Gi(), xn("Dragging closed launcher", {
|
|
13950
13949
|
requestedPosition: I
|
|
13951
13950
|
});
|
|
13952
13951
|
},
|
|
13953
13952
|
persist: () => {
|
|
13954
|
-
h = !0, Ge(),
|
|
13953
|
+
h = !0, Ge(), xn("Persisted closed launcher drag position");
|
|
13955
13954
|
}
|
|
13956
13955
|
})) : hn(r, null), Cr(r, g);
|
|
13957
13956
|
const _c = () => {
|
|
13958
|
-
const p =
|
|
13957
|
+
const p = Un(g), I = fi();
|
|
13959
13958
|
return {
|
|
13960
13959
|
position: zi(
|
|
13961
13960
|
y ? zs(y, p) : Tr(
|
|
@@ -13975,16 +13974,16 @@ async function lw(t = {}) {
|
|
|
13975
13974
|
);
|
|
13976
13975
|
const I = zi(
|
|
13977
13976
|
p.position,
|
|
13978
|
-
|
|
13977
|
+
Un(g)
|
|
13979
13978
|
);
|
|
13980
13979
|
y = Rr(
|
|
13981
13980
|
I,
|
|
13982
|
-
|
|
13981
|
+
Un(g)
|
|
13983
13982
|
);
|
|
13984
13983
|
const C = fi();
|
|
13985
13984
|
ts(I, C);
|
|
13986
13985
|
}, _p = (p) => {
|
|
13987
|
-
const I =
|
|
13986
|
+
const I = Un(g), C = zi(
|
|
13988
13987
|
p,
|
|
13989
13988
|
I
|
|
13990
13989
|
), A = Hi(r), j = Us(
|
|
@@ -14015,50 +14014,50 @@ async function lw(t = {}) {
|
|
|
14015
14014
|
setBounds: wp,
|
|
14016
14015
|
persist: Ge
|
|
14017
14016
|
}) : () => {
|
|
14018
|
-
},
|
|
14019
|
-
|
|
14017
|
+
}, kn = document.createElement("div");
|
|
14018
|
+
kn.className = "pluno-pa-widget__account-load-notice", kn.hidden = !0;
|
|
14020
14019
|
const bi = document.createElement("div");
|
|
14021
14020
|
bi.className = "pluno-pa-widget__error";
|
|
14022
|
-
const
|
|
14023
|
-
|
|
14021
|
+
const En = document.createElement("button");
|
|
14022
|
+
En.type = "button", En.className = "pluno-pa-widget__error-retry";
|
|
14024
14023
|
const vc = wn(), Ic = document.createTextNode("Try again");
|
|
14025
|
-
|
|
14026
|
-
let So = !1,
|
|
14024
|
+
En.append(vc, Ic), bi.append("Pluno could not load your account. Try again.", En), Y.after(kn);
|
|
14025
|
+
let So = !1, Cn = !1;
|
|
14027
14026
|
const xo = () => {
|
|
14028
14027
|
const p = M.getState().status === "error" && ["unauthorized", "invalid_token", "update_required"].includes(M.getState().lastErrorCode ?? ""), I = !!e.billingStatus && e.billingStatus?.submissionGate?.reason !== "connection_required";
|
|
14029
|
-
|
|
14028
|
+
kn.hidden = p || M.getState().status !== "connected" || !So || I || e.productVariant !== "personal" || Lt(), kn.hidden ? bi.remove() : bi.parentElement !== kn && kn.append(bi), En.disabled = Cn, En.setAttribute("aria-busy", String(Cn)), vc.hidden = !Cn, Ic.data = Cn ? "Trying" : "Try again";
|
|
14030
14029
|
}, ko = async () => {
|
|
14031
|
-
if (!(
|
|
14032
|
-
|
|
14030
|
+
if (!(Cn || Ue)) {
|
|
14031
|
+
Cn = !0, xo();
|
|
14033
14032
|
try {
|
|
14034
14033
|
await M.refreshAccount(), So = !1;
|
|
14035
14034
|
} catch (p) {
|
|
14036
14035
|
So = !0, nt(
|
|
14037
14036
|
"web-sdk.widget",
|
|
14038
14037
|
"Failed to refresh billing status",
|
|
14039
|
-
|
|
14038
|
+
Ln(p)
|
|
14040
14039
|
);
|
|
14041
14040
|
} finally {
|
|
14042
|
-
|
|
14041
|
+
Cn = !1, Ue || xo();
|
|
14043
14042
|
}
|
|
14044
14043
|
}
|
|
14045
14044
|
};
|
|
14046
|
-
|
|
14045
|
+
En.addEventListener("click", () => {
|
|
14047
14046
|
ko();
|
|
14048
14047
|
});
|
|
14049
14048
|
let wi = null;
|
|
14050
14049
|
const Sc = (p) => {
|
|
14051
|
-
if (
|
|
14050
|
+
if (Lt())
|
|
14052
14051
|
return;
|
|
14053
14052
|
const I = Date.now(), C = window.location.href;
|
|
14054
14053
|
p === "composer_input" && wi?.scope === C && I - wi.requestedAt < qb || (p === "composer_input" && (wi = { scope: C, requestedAt: I }), Promise.resolve(M.warmup(p)).catch((A) => {
|
|
14055
14054
|
nt(
|
|
14056
14055
|
"web-sdk.widget",
|
|
14057
14056
|
"Failed to warm Product Agent sandbox",
|
|
14058
|
-
|
|
14057
|
+
Ln(A)
|
|
14059
14058
|
);
|
|
14060
14059
|
}));
|
|
14061
|
-
},
|
|
14060
|
+
}, Ot = (p = "", I = !0, C = !0, A = !0, j = "external_request") => {
|
|
14062
14061
|
const X = r.classList.contains("pluno-pa-widget--open") || !x.hidden && !r.classList.contains("pluno-pa-widget--closing");
|
|
14063
14062
|
!X && A && Sc("panel_open"), ko(), Ii && (Ii = !1, qo()), r.classList.contains("pluno-pa-widget--open") || (y = null), It !== null && (window.clearTimeout(It), It = null), mi("shown", !1), x.hidden = !1, P.hidden = !1, Pr(
|
|
14064
14063
|
q,
|
|
@@ -14070,16 +14069,16 @@ async function lw(t = {}) {
|
|
|
14070
14069
|
e.position,
|
|
14071
14070
|
g
|
|
14072
14071
|
);
|
|
14073
|
-
if (ts(pe, ee),
|
|
14072
|
+
if (ts(pe, ee), xn("Opening launcher at clamped open panel position", {
|
|
14074
14073
|
openPanelPosition: pe,
|
|
14075
14074
|
visibleLauncherPosition: ee
|
|
14076
14075
|
}), dt(!0, "open"), St(), !X && e.layout === "floating" && M.recordWidgetLifecycle("opened", j), !I) {
|
|
14077
|
-
r.classList.add("pluno-pa-widget--open"), X || vo(), v.hidden = !0, p && ($.value = p, Oi($)), Xn(F, () => Ft.enabled), rn = F.scrollTop, C && (
|
|
14076
|
+
r.classList.add("pluno-pa-widget--open"), X || vo(), v.hidden = !0, p && ($.value = p, Oi($)), Xn(F, () => Ft.enabled), rn = F.scrollTop, C && (vn($, "panel_open_immediate"), $.setSelectionRange($.value.length, $.value.length)), Ge(), es("shown", j), e.onPanelOpenChange?.(!0, j);
|
|
14078
14077
|
return;
|
|
14079
14078
|
}
|
|
14080
14079
|
const kt = Date.now();
|
|
14081
14080
|
window.requestAnimationFrame(() => {
|
|
14082
|
-
r.classList.add("pluno-pa-widget--open"), X || vo(), p && ($.value = p, Oi($)), Xn(F, () => Ft.enabled), rn = F.scrollTop, C && (
|
|
14081
|
+
r.classList.add("pluno-pa-widget--open"), X || vo(), p && ($.value = p, Oi($)), Xn(F, () => Ft.enabled), rn = F.scrollTop, C && (vn($, "panel_open_animation", {
|
|
14083
14082
|
scheduledAt: kt
|
|
14084
14083
|
}), $.setSelectionRange($.value.length, $.value.length)), Ge(), es("shown", j), e.onPanelOpenChange?.(!0, j), It = window.setTimeout(() => {
|
|
14085
14084
|
v.hidden = !0, Xn(F, () => Ft.enabled), rn = F.scrollTop;
|
|
@@ -14087,27 +14086,27 @@ async function lw(t = {}) {
|
|
|
14087
14086
|
});
|
|
14088
14087
|
}, Eo = (p = "external_request") => {
|
|
14089
14088
|
const I = r.classList.contains("pluno-pa-widget--open") || !x.hidden && !r.classList.contains("pluno-pa-widget--closing");
|
|
14090
|
-
It !== null && (window.clearTimeout(It), It = null), v.hidden = !1, l && (yi(!1),
|
|
14089
|
+
It !== null && (window.clearTimeout(It), It = null), v.hidden = !1, l && (yi(!1), xn("Closing launcher at stored position")), r.classList.remove("pluno-pa-widget--open"), r.classList.add("pluno-pa-widget--closing"), at(), Ge(), I && e.layout === "floating" && M.recordWidgetLifecycle("closed", p), e.onPanelOpenChange?.(!1, p), It = window.setTimeout(() => {
|
|
14091
14090
|
x.hidden = !0, P.hidden = !0, y = null, r.classList.remove("pluno-pa-widget--closing");
|
|
14092
14091
|
}, 220);
|
|
14093
14092
|
};
|
|
14094
14093
|
v.addEventListener("submit", (p) => {
|
|
14095
|
-
p.preventDefault(),
|
|
14094
|
+
p.preventDefault(), Ot(m.value, !0, !0, !0, "launcher_input"), m.value = "";
|
|
14096
14095
|
}), k?.addEventListener("click", (p) => {
|
|
14097
14096
|
p.preventDefault(), p.stopPropagation();
|
|
14098
14097
|
}), v.addEventListener("click", (p) => {
|
|
14099
|
-
p.target === m && !k || (
|
|
14098
|
+
p.target === m && !k || (Ot(m.value, !0, !0, !0, "launcher_click"), m.value = "");
|
|
14100
14099
|
});
|
|
14101
14100
|
const xc = () => {
|
|
14102
|
-
|
|
14101
|
+
Ot(m.value, !0, !0, !0, "launcher_focus"), m.value = "";
|
|
14103
14102
|
};
|
|
14104
14103
|
m.addEventListener("focus", xc), m.addEventListener("input", () => {
|
|
14105
14104
|
if (!m.value)
|
|
14106
14105
|
return;
|
|
14107
14106
|
const p = m.value;
|
|
14108
|
-
|
|
14107
|
+
Ot(p, !0, !0, !0, "launcher_input"), m.value = "";
|
|
14109
14108
|
});
|
|
14110
|
-
let _i = null, an = null, ns = null,
|
|
14109
|
+
let _i = null, an = null, ns = null, An = null, Dt = null, ze = null;
|
|
14111
14110
|
const is = (p) => p === m || p === $, kc = (p) => p.composedPath().find(is) ?? null, Sp = (p) => {
|
|
14112
14111
|
let I = p;
|
|
14113
14112
|
for (; I; ) {
|
|
@@ -14147,10 +14146,10 @@ async function lw(t = {}) {
|
|
|
14147
14146
|
}, Ro = (p, I) => {
|
|
14148
14147
|
if (!I)
|
|
14149
14148
|
return;
|
|
14150
|
-
|
|
14149
|
+
Dt !== null && window.clearTimeout(Dt);
|
|
14151
14150
|
const C = Date.now();
|
|
14152
|
-
|
|
14153
|
-
|
|
14151
|
+
Dt = window.setTimeout(() => {
|
|
14152
|
+
Dt = null, Ht === p && I.isConnected && vn(I, "host_modal_recovery", {
|
|
14154
14153
|
preventScroll: !0,
|
|
14155
14154
|
scheduledAt: C
|
|
14156
14155
|
});
|
|
@@ -14160,16 +14159,16 @@ async function lw(t = {}) {
|
|
|
14160
14159
|
p && Ro(p, I);
|
|
14161
14160
|
return;
|
|
14162
14161
|
}
|
|
14163
|
-
Ht = p, p !== null ? (Ro(p, I),
|
|
14162
|
+
Ht = p, p !== null ? (Ro(p, I), An = window.setInterval(() => {
|
|
14164
14163
|
const C = Ht;
|
|
14165
14164
|
if (!C || !xp(C)) {
|
|
14166
14165
|
vi(null);
|
|
14167
14166
|
return;
|
|
14168
14167
|
}
|
|
14169
14168
|
Ro(C, null);
|
|
14170
|
-
}, Kb)) : (
|
|
14169
|
+
}, Kb)) : (An !== null && (window.clearInterval(An), An = null), Dt !== null && (window.clearTimeout(Dt), Dt = null), ns = null);
|
|
14171
14170
|
}, kp = () => {
|
|
14172
|
-
|
|
14171
|
+
An !== null && (window.clearInterval(An), An = null), Dt !== null && (window.clearTimeout(Dt), Dt = null), ze !== null && (window.clearTimeout(ze), ze = null);
|
|
14173
14172
|
}, Ec = (p) => {
|
|
14174
14173
|
const I = kc(p);
|
|
14175
14174
|
if (!I)
|
|
@@ -14229,7 +14228,7 @@ async function lw(t = {}) {
|
|
|
14229
14228
|
Ht === null && C.isConnected && j(Ao());
|
|
14230
14229
|
}, 0);
|
|
14231
14230
|
}), v.addEventListener("keydown", (p) => {
|
|
14232
|
-
!r.classList.contains("pluno-pa-widget--minimized") || p.key !== "Enter" && p.key !== " " || (p.preventDefault(),
|
|
14231
|
+
!r.classList.contains("pluno-pa-widget--minimized") || p.key !== "Enter" && p.key !== " " || (p.preventDefault(), Ot("", !0, !0, !0, "minimized_launcher"));
|
|
14233
14232
|
}), _?.addEventListener("pointerdown", (p) => {
|
|
14234
14233
|
p.stopPropagation();
|
|
14235
14234
|
}), _?.addEventListener("click", (p) => {
|
|
@@ -14237,13 +14236,13 @@ async function lw(t = {}) {
|
|
|
14237
14236
|
}), P.addEventListener("click", () => Eo("close_button")), F.addEventListener("wheel", (p) => {
|
|
14238
14237
|
Zi(p.deltaY < 0 ? "up" : null);
|
|
14239
14238
|
}), F.addEventListener("pointerdown", (p) => {
|
|
14240
|
-
|
|
14239
|
+
Sn = p.target === F ? p.clientY : null;
|
|
14241
14240
|
}), F.addEventListener("pointermove", (p) => {
|
|
14242
|
-
|
|
14241
|
+
Sn !== null && p.clientY < Sn - 1 && Zi("up"), Sn !== null && (Sn = p.clientY);
|
|
14243
14242
|
}), F.addEventListener("pointerup", () => {
|
|
14244
|
-
|
|
14243
|
+
Sn = null;
|
|
14245
14244
|
}), F.addEventListener("pointercancel", () => {
|
|
14246
|
-
|
|
14245
|
+
Sn = null;
|
|
14247
14246
|
}), F.addEventListener("touchstart", (p) => {
|
|
14248
14247
|
Qi = p.touches[0]?.clientY ?? null;
|
|
14249
14248
|
}), F.addEventListener("touchmove", (p) => {
|
|
@@ -14268,22 +14267,22 @@ async function lw(t = {}) {
|
|
|
14268
14267
|
F.style.paddingBottom = `${p > 0 ? p + 24 : 12}px`, Ft.enabled && Xn(F, () => Ft.enabled);
|
|
14269
14268
|
});
|
|
14270
14269
|
Rc?.observe(Ac);
|
|
14271
|
-
const
|
|
14270
|
+
const Lt = () => e.loginRequired || e.signupRequired;
|
|
14272
14271
|
let Ht = null, Ii = !1, os = M.getState().status === "connected";
|
|
14273
14272
|
const Si = () => {
|
|
14274
14273
|
const p = M.getState().status;
|
|
14275
14274
|
return !os && M.getState().lastErrorCode !== "connection_failed" && (p === "idle" || p === "connecting" || p === "reconnecting");
|
|
14276
|
-
}, Tc = () => M.getState().status !== "connected",
|
|
14275
|
+
}, Tc = () => M.getState().status !== "connected", Rn = () => {
|
|
14277
14276
|
if (e.productVariant !== "personal") return Tc();
|
|
14278
14277
|
const p = e.billingStatus?.auth;
|
|
14279
|
-
return !p?.user || !p.workspace ||
|
|
14278
|
+
return !p?.user || !p.workspace || Lt();
|
|
14280
14279
|
}, To = () => {
|
|
14281
14280
|
const p = M.getState().status;
|
|
14282
14281
|
return Si() ? !1 : p !== "connected" && !(os && p === "reconnecting");
|
|
14283
14282
|
}, Vn = () => {
|
|
14284
|
-
const p =
|
|
14283
|
+
const p = Lt(), I = M.getState(), C = !I.isThinking && !I.pendingMessageStatus && !!I.lastError;
|
|
14285
14284
|
m.readOnly = !1, $.readOnly = !1, m.placeholder = p ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : C ? "Needs attention" : Ii ? "New update" : e.launcherLabel, $.placeholder = p ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : Vt.launcherLabel, z.hidden = p;
|
|
14286
|
-
}, rs = () => [...
|
|
14285
|
+
}, rs = () => [...Pt.values()].some((p) => p.revision === en && p.generation === vt), qc = () => {
|
|
14287
14286
|
const p = M.getState(), I = e.billingStatus;
|
|
14288
14287
|
return {
|
|
14289
14288
|
submissionAllowed: I?.submissionGate?.allowed === !0,
|
|
@@ -14296,20 +14295,20 @@ async function lw(t = {}) {
|
|
|
14296
14295
|
// Delivery belongs to an earlier immutable input; only the current composer handoff blocks Send.
|
|
14297
14296
|
hasPendingMessage: !1
|
|
14298
14297
|
};
|
|
14299
|
-
},
|
|
14300
|
-
const p = M.getState(), I = !Si() && [...
|
|
14298
|
+
}, Tn = () => e.productVariant === "personal" ? Si() && !Lt() && !rs() && e.billingStatus?.submissionGate?.allowed === !0 || Xc(qc()) : !To() && !Qn(e.billingStatus) && !rs(), Pc = () => {
|
|
14299
|
+
const p = M.getState(), I = !Si() && [...Pt.values()].some((C) => C.revision === en && C.generation === vt);
|
|
14301
14300
|
return th({
|
|
14302
14301
|
hasRunningAssistantTurn: I || p.isThinking || p.turnPhase !== null || p.pendingMessageStatus !== null,
|
|
14303
14302
|
// Retained text already submitted by this revision must not hide Stop behind a disabled Send.
|
|
14304
14303
|
hasDraftMessage: !I && $.value.trim().length > 0,
|
|
14305
14304
|
hasPreSubmittedAttachment: ct.length > 0,
|
|
14306
|
-
canSubmitMessage:
|
|
14305
|
+
canSubmitMessage: Tn()
|
|
14307
14306
|
});
|
|
14308
14307
|
}, Le = () => {
|
|
14309
14308
|
const p = Pc();
|
|
14310
|
-
ec(Te, p.action === "stop"), Te.disabled = p.disabled, e.productVariant === "personal" && (T && (T.disabled = !
|
|
14311
|
-
I.disabled = !
|
|
14312
|
-
})), be.disabled =
|
|
14309
|
+
ec(Te, p.action === "stop"), Te.disabled = p.disabled, e.productVariant === "personal" && (T && (T.disabled = !Tn()), r.querySelectorAll(".pluno-pa-widget__starter-prompt").forEach((I) => {
|
|
14310
|
+
I.disabled = !Tn();
|
|
14311
|
+
})), be.disabled = Lt() || Rn() || e.productVariant !== "personal" && Qn(e.billingStatus);
|
|
14313
14312
|
};
|
|
14314
14313
|
Vn();
|
|
14315
14314
|
const qo = () => {
|
|
@@ -14321,7 +14320,7 @@ async function lw(t = {}) {
|
|
|
14321
14320
|
};
|
|
14322
14321
|
qo();
|
|
14323
14322
|
const Po = () => {
|
|
14324
|
-
if (!(
|
|
14323
|
+
if (!(Lt() || Ue))
|
|
14325
14324
|
return Vn(), Le(), M.connect().then(
|
|
14326
14325
|
() => {
|
|
14327
14326
|
Ue || (Vn(), Le());
|
|
@@ -14331,7 +14330,7 @@ async function lw(t = {}) {
|
|
|
14331
14330
|
"web-sdk.widget",
|
|
14332
14331
|
"Failed to connect Product Agent widget",
|
|
14333
14332
|
{
|
|
14334
|
-
...
|
|
14333
|
+
...Ln(p)
|
|
14335
14334
|
}
|
|
14336
14335
|
));
|
|
14337
14336
|
}
|
|
@@ -14341,8 +14340,8 @@ async function lw(t = {}) {
|
|
|
14341
14340
|
B.textContent = "", B.hidden = !0, jt = null;
|
|
14342
14341
|
}, 3e3);
|
|
14343
14342
|
}, Mo = (p, I) => {
|
|
14344
|
-
const C =
|
|
14345
|
-
if (!C || I !== void 0 && C.submittedAt !== I || (
|
|
14343
|
+
const C = Pt.get(p);
|
|
14344
|
+
if (!C || I !== void 0 && C.submittedAt !== I || (Pt.delete(p), C.generation !== vt || C.revision !== en)) return;
|
|
14346
14345
|
const A = new Set(C.attachments);
|
|
14347
14346
|
ct = ct.filter((j) => !A.has(j)), $.value = "", $.dispatchEvent(new Event("input", { bubbles: !0 })), li(), Le();
|
|
14348
14347
|
}, Mc = (p) => {
|
|
@@ -14359,24 +14358,24 @@ async function lw(t = {}) {
|
|
|
14359
14358
|
I === vt && (M.getState().receipts === void 0 && Mo(p.clientMessageId), ve?.clientMessageId === p.clientMessageId && (ve.pendingSubmission = !1, A && (ve.clientMessageId = A), fc()), C && (_e = !1, rt = null, e.proactiveSuggestion = null, at()));
|
|
14360
14359
|
}).catch((A) => {
|
|
14361
14360
|
if (I !== vt) return;
|
|
14362
|
-
ve?.clientMessageId === p.clientMessageId && (ve = null),
|
|
14361
|
+
ve?.clientMessageId === p.clientMessageId && (ve = null), Pt.delete(p.clientMessageId), li();
|
|
14363
14362
|
const j = A instanceof Error ? A.message : "Failed to upload attachment";
|
|
14364
14363
|
M.getState().lastError !== j && as(j);
|
|
14365
14364
|
}).finally(() => {
|
|
14366
14365
|
I === vt && Le();
|
|
14367
14366
|
});
|
|
14368
14367
|
}, Oc = () => {
|
|
14369
|
-
if (Ue || !tn || e.productVariant === "personal" && !Xc({ ...qc(), isSubmitting: !1 }) || M.getState().status !== "connected" ||
|
|
14368
|
+
if (Ue || !tn || e.productVariant === "personal" && !Xc({ ...qc(), isSubmitting: !1 }) || M.getState().status !== "connected" || Lt() || Qn(e.billingStatus))
|
|
14370
14369
|
return;
|
|
14371
14370
|
const p = tn;
|
|
14372
14371
|
tn = null, Mc(p);
|
|
14373
14372
|
}, Oo = () => {
|
|
14374
14373
|
const p = $.value, I = p.trim(), C = [...ct];
|
|
14375
|
-
if (tn !== null || rs() || e.productVariant === "personal" && !
|
|
14374
|
+
if (tn !== null || rs() || e.productVariant === "personal" && !Tn() || !I && C.length === 0)
|
|
14376
14375
|
return;
|
|
14377
14376
|
for (const j of C)
|
|
14378
14377
|
j.id && j.previewUrl && ci.set(j.id, j.previewUrl);
|
|
14379
|
-
if ([...
|
|
14378
|
+
if ([...Pt.values()].some((j) => j.revision === en && j.generation === vt)) return;
|
|
14380
14379
|
const A = {
|
|
14381
14380
|
inputValue: p,
|
|
14382
14381
|
value: I,
|
|
@@ -14384,7 +14383,7 @@ async function lw(t = {}) {
|
|
|
14384
14383
|
clientMessageId: crypto.randomUUID(),
|
|
14385
14384
|
submittedAt: Math.max(Date.now(), sc + 1)
|
|
14386
14385
|
};
|
|
14387
|
-
if (sc = A.submittedAt,
|
|
14386
|
+
if (sc = A.submittedAt, Pt.set(A.clientMessageId, { ...A, revision: en, generation: vt }), Le(), ve = {
|
|
14388
14387
|
createdAt: Date.now(),
|
|
14389
14388
|
clientMessageId: A.clientMessageId,
|
|
14390
14389
|
observedConversation: null,
|
|
@@ -14405,7 +14404,7 @@ async function lw(t = {}) {
|
|
|
14405
14404
|
e.onSignupClick?.();
|
|
14406
14405
|
return;
|
|
14407
14406
|
}
|
|
14408
|
-
(e.productVariant === "personal" ? !
|
|
14407
|
+
(e.productVariant === "personal" ? !Tn() : To() || Qn(e.billingStatus)) || (on = !0, dt(!0, "send"), St(), Oo());
|
|
14409
14408
|
});
|
|
14410
14409
|
let xi = 0;
|
|
14411
14410
|
const cn = () => {
|
|
@@ -14413,7 +14412,7 @@ async function lw(t = {}) {
|
|
|
14413
14412
|
}, Ep = () => {
|
|
14414
14413
|
jt !== null && (window.clearTimeout(jt), jt = null), B.textContent = "", B.hidden = !0;
|
|
14415
14414
|
}, Do = async (p) => {
|
|
14416
|
-
if (!e.attachmentsEnabled || p.length === 0 || e.productVariant === "personal" &&
|
|
14415
|
+
if (!e.attachmentsEnabled || p.length === 0 || e.productVariant === "personal" && Rn())
|
|
14417
14416
|
return;
|
|
14418
14417
|
const I = e_(
|
|
14419
14418
|
M,
|
|
@@ -14421,29 +14420,29 @@ async function lw(t = {}) {
|
|
|
14421
14420
|
e.productVariant === "customer_embedded"
|
|
14422
14421
|
);
|
|
14423
14422
|
if (en++, ct = [...ct, ...I], li(), Ep(), Le(), Ce(M.getState()), !r.classList.contains("pluno-pa-widget--open")) {
|
|
14424
|
-
|
|
14423
|
+
Ot("", !0, !0, !0, "attachment_drop");
|
|
14425
14424
|
return;
|
|
14426
14425
|
}
|
|
14427
14426
|
nn("attachment_added");
|
|
14428
14427
|
}, Cp = async (p) => {
|
|
14429
|
-
await Do(p), !(p.length === 0 || Ht !== null) &&
|
|
14428
|
+
await Do(p), !(p.length === 0 || Ht !== null) && vn($, "attachment_picker_completed");
|
|
14430
14429
|
};
|
|
14431
14430
|
be.addEventListener("click", () => {
|
|
14432
|
-
e.loginRequired ||
|
|
14431
|
+
e.loginRequired || Rn() || e.productVariant !== "personal" && Qn(e.billingStatus) || Pe.click();
|
|
14433
14432
|
}), Pe.addEventListener("change", () => {
|
|
14434
14433
|
const p = Array.from(Pe.files ?? []);
|
|
14435
14434
|
Pe.value = "", Cp(p).catch((I) => {
|
|
14436
14435
|
as(
|
|
14437
14436
|
I instanceof Error ? I.message : "Failed to attach file"
|
|
14438
14437
|
), nt("web-sdk.widget", "Attachment failed", {
|
|
14439
|
-
...
|
|
14438
|
+
...Ln(I)
|
|
14440
14439
|
});
|
|
14441
14440
|
});
|
|
14442
14441
|
}), r.addEventListener("dragenter", (p) => {
|
|
14443
|
-
!e.attachmentsEnabled || !ks(p.dataTransfer) || e.loginRequired ||
|
|
14442
|
+
!e.attachmentsEnabled || !ks(p.dataTransfer) || e.loginRequired || Rn() || (p.preventDefault(), p.stopPropagation(), xi += 1, r.classList.add("pluno-pa-widget--drag-over"));
|
|
14444
14443
|
}), r.addEventListener("dragover", (p) => {
|
|
14445
14444
|
const I = p.dataTransfer;
|
|
14446
|
-
!e.attachmentsEnabled || !ks(I) || e.loginRequired ||
|
|
14445
|
+
!e.attachmentsEnabled || !ks(I) || e.loginRequired || Rn() || (p.preventDefault(), p.stopPropagation(), I.dropEffect = "copy");
|
|
14447
14446
|
}), r.addEventListener("dragleave", (p) => {
|
|
14448
14447
|
ks(p.dataTransfer) && (p.stopPropagation(), xi = Math.max(0, xi - 1), xi === 0 && r.classList.remove("pluno-pa-widget--drag-over"));
|
|
14449
14448
|
});
|
|
@@ -14456,21 +14455,21 @@ async function lw(t = {}) {
|
|
|
14456
14455
|
!0
|
|
14457
14456
|
), w.addEventListener("drop", cn, !0), w.addEventListener("dragend", cn, !0), w.defaultView?.addEventListener("blur", cn), r.addEventListener("drop", (p) => {
|
|
14458
14457
|
const I = p.dataTransfer;
|
|
14459
|
-
!e.attachmentsEnabled || !ks(I) || e.loginRequired ||
|
|
14458
|
+
!e.attachmentsEnabled || !ks(I) || e.loginRequired || Rn() || (p.preventDefault(), p.stopPropagation(), cn(), Do(I.files).catch((C) => {
|
|
14460
14459
|
as(
|
|
14461
14460
|
C instanceof Error ? C.message : "Failed to attach file"
|
|
14462
14461
|
), nt("web-sdk.widget", "Attachment failed", {
|
|
14463
|
-
...
|
|
14462
|
+
...Ln(C)
|
|
14464
14463
|
});
|
|
14465
14464
|
}));
|
|
14466
14465
|
}), r.addEventListener("paste", (p) => {
|
|
14467
14466
|
p.stopPropagation();
|
|
14468
14467
|
const I = p.clipboardData, C = Array.from(I?.files ?? []);
|
|
14469
|
-
!e.attachmentsEnabled || C.length === 0 || e.loginRequired ||
|
|
14468
|
+
!e.attachmentsEnabled || C.length === 0 || e.loginRequired || Rn() || (p.preventDefault(), Do(C).catch((A) => {
|
|
14470
14469
|
as(
|
|
14471
14470
|
A instanceof Error ? A.message : "Failed to attach file"
|
|
14472
14471
|
), nt("web-sdk.widget", "Attachment failed", {
|
|
14473
|
-
...
|
|
14472
|
+
...Ln(A)
|
|
14474
14473
|
});
|
|
14475
14474
|
}));
|
|
14476
14475
|
}), Te.addEventListener("click", () => {
|
|
@@ -14482,7 +14481,7 @@ async function lw(t = {}) {
|
|
|
14482
14481
|
if (p.disabled)
|
|
14483
14482
|
return;
|
|
14484
14483
|
if (p.action === "stop") {
|
|
14485
|
-
|
|
14484
|
+
Pt.clear(), tn = null, ve = null, M.stop(), Le();
|
|
14486
14485
|
return;
|
|
14487
14486
|
}
|
|
14488
14487
|
const I = $.value.trim().length > 0 || ct.length > 0;
|
|
@@ -14499,7 +14498,7 @@ async function lw(t = {}) {
|
|
|
14499
14498
|
e.onLoginClick?.();
|
|
14500
14499
|
return;
|
|
14501
14500
|
}
|
|
14502
|
-
(e.productVariant === "personal" ? !
|
|
14501
|
+
(e.productVariant === "personal" ? !Tn() : To()) || (on = !0, dt(!0, "send"), St(), Oo(), Ce(M.getState()), Le());
|
|
14503
14502
|
}
|
|
14504
14503
|
}), r.addEventListener("click", (p) => {
|
|
14505
14504
|
const I = p.target instanceof Element ? p.target : null;
|
|
@@ -14557,7 +14556,7 @@ async function lw(t = {}) {
|
|
|
14557
14556
|
return;
|
|
14558
14557
|
}
|
|
14559
14558
|
p.key !== "Escape" || !$e || ($e = !1, $t(), nn("history_escape"));
|
|
14560
|
-
}), d.composerValue && ($.value = d.composerValue, Oi($)), e.layout === "page" ?
|
|
14559
|
+
}), d.composerValue && ($.value = d.composerValue, Oi($)), e.layout === "page" ? Ot($.value, !1, !0, !1, "external_request") : u === "minimized" ? mi("minimized", !1) : e.initialDisplayState === void 0 && d.isOpen && Ot($.value, !1, !1, !1, "restored_state");
|
|
14561
14560
|
const cs = () => c;
|
|
14562
14561
|
let Lo = M.getState().appearance !== null, ls = M.getInteractions();
|
|
14563
14562
|
const et = (p) => ls.find(
|
|
@@ -14600,16 +14599,16 @@ async function lw(t = {}) {
|
|
|
14600
14599
|
No();
|
|
14601
14600
|
};
|
|
14602
14601
|
No();
|
|
14603
|
-
let
|
|
14602
|
+
let qn = null;
|
|
14604
14603
|
const ds = /* @__PURE__ */ new Map(), zo = /* @__PURE__ */ new Map(), Bo = /* @__PURE__ */ new Map(), Rp = () => $.value.trim().length > 0 || ct.length > 0, zc = (p) => {
|
|
14605
14604
|
if (e.entrySurface === "extension_widget") {
|
|
14606
14605
|
const I = e.billingStatus?.auth, C = I ? !!I.user : !!(p.user && !e.loginRequired), A = I ? !!I.workspace : !e.signupRequired;
|
|
14607
|
-
return C && A &&
|
|
14606
|
+
return C && A && qn !== null && qn > 0;
|
|
14608
14607
|
}
|
|
14609
|
-
return
|
|
14608
|
+
return qn !== null && a_(p, Rp());
|
|
14610
14609
|
}, Bc = () => {
|
|
14611
14610
|
const p = zc(M.getState());
|
|
14612
|
-
W.hidden = !p, p &&
|
|
14611
|
+
W.hidden = !p, p && qn !== null && Qu(W, qn);
|
|
14613
14612
|
}, us = /* @__PURE__ */ new Map(), Tp = async (p, I, C) => {
|
|
14614
14613
|
const A = us.get(p) ?? /* @__PURE__ */ new Set();
|
|
14615
14614
|
if (!A.has(I)) {
|
|
@@ -14623,9 +14622,9 @@ async function lw(t = {}) {
|
|
|
14623
14622
|
};
|
|
14624
14623
|
let Gn = null;
|
|
14625
14624
|
const jo = (p = {}) => {
|
|
14626
|
-
vt++,
|
|
14625
|
+
vt++, Pt.clear(), ic(), tn = null, ve = null, gi = !1, Yi.clear(), on = !0, dt(!0, "newSession"), St(), $e = !1, $t();
|
|
14627
14626
|
const I = Promise.resolve(M.startNewSession(p));
|
|
14628
|
-
return wi = null, fo.clear(), $.value = "", ct = [], li(), Oi($), Ge(), Le(),
|
|
14627
|
+
return wi = null, fo.clear(), $.value = "", ct = [], li(), Oi($), Ge(), Le(), vn($, "new_chat"), Ce(M.getState()), I;
|
|
14629
14628
|
};
|
|
14630
14629
|
T?.addEventListener("click", () => {
|
|
14631
14630
|
ln(et("proactive_suggestion"), "run").catch(() => {
|
|
@@ -14699,7 +14698,7 @@ async function lw(t = {}) {
|
|
|
14699
14698
|
xt.addEventListener("click", () => {
|
|
14700
14699
|
qp();
|
|
14701
14700
|
});
|
|
14702
|
-
let
|
|
14701
|
+
let Pn = !1, ki = null, hs = 0, $o = 0;
|
|
14703
14702
|
const Ce = (p, I = {}) => {
|
|
14704
14703
|
dc(p) && (ve = null), lc = I.renderSource ?? "local", r.dataset.conversationGate = e.loginRequired ? "authentication" : e.signupRequired ? "signup" : "none", xo(), r.classList.toggle("pluno-pa-widget--logged-out", e.loginRequired && e.entrySurface === "extension_widget"), N.classList.remove("pluno-pa-widget__access-notice--login-only"), p = { ...p, messages: p.messages.map((Z) => {
|
|
14705
14704
|
if (!Z.attachments?.some((qe) => qe.id && !qe.fileUrl && ci.has(qe.id))) return Z;
|
|
@@ -14735,18 +14734,18 @@ async function lw(t = {}) {
|
|
|
14735
14734
|
cs,
|
|
14736
14735
|
(ki ?? Z.message).replace(new RegExp("(?<=[.!?])\\s+", "g"), `
|
|
14737
14736
|
`),
|
|
14738
|
-
|
|
14737
|
+
Pn ? "Trying" : "Try again",
|
|
14739
14738
|
void 0,
|
|
14740
14739
|
!1,
|
|
14741
14740
|
void 0
|
|
14742
14741
|
);
|
|
14743
14742
|
const qe = N.querySelector(".pluno-pa-widget__login");
|
|
14744
|
-
qe.disabled =
|
|
14743
|
+
qe.disabled = Pn, qe.setAttribute("aria-busy", String(Pn)), Pn && qe.prepend(wn()), qe.addEventListener("click", () => {
|
|
14745
14744
|
const Ei = ++hs, Up = $o;
|
|
14746
|
-
|
|
14745
|
+
Pn = !0, ki = null, Ce(M.getState()), ut().catch((Jc) => {
|
|
14747
14746
|
Ei !== hs || Up !== $o || (ki = Jc instanceof Error ? Jc.message : "Close and reopen Pluno to try again.");
|
|
14748
14747
|
}).finally(() => {
|
|
14749
|
-
Ei === hs && (
|
|
14748
|
+
Ei === hs && (Pn = !1, Ue || Ce(M.getState()));
|
|
14750
14749
|
});
|
|
14751
14750
|
});
|
|
14752
14751
|
return;
|
|
@@ -14794,7 +14793,7 @@ async function lw(t = {}) {
|
|
|
14794
14793
|
ps,
|
|
14795
14794
|
W,
|
|
14796
14795
|
p,
|
|
14797
|
-
|
|
14796
|
+
qn,
|
|
14798
14797
|
zc(p),
|
|
14799
14798
|
X,
|
|
14800
14799
|
() => Ft.enabled,
|
|
@@ -14805,7 +14804,7 @@ async function lw(t = {}) {
|
|
|
14805
14804
|
Ge,
|
|
14806
14805
|
cs,
|
|
14807
14806
|
(Z, ut) => {
|
|
14808
|
-
if (e.productVariant === "personal" ? !
|
|
14807
|
+
if (e.productVariant === "personal" ? !Tn() : Tc())
|
|
14809
14808
|
return;
|
|
14810
14809
|
on = !0, dt(!0, "send"), St();
|
|
14811
14810
|
const qe = et("morning_report");
|
|
@@ -14856,7 +14855,7 @@ async function lw(t = {}) {
|
|
|
14856
14855
|
Kc
|
|
14857
14856
|
);
|
|
14858
14857
|
const Ho = (p) => {
|
|
14859
|
-
|
|
14858
|
+
qn = e.entrySurface === "extension_widget" || p.user && !e.loginRequired ? p.activeUsersCount ?? null : null, Bc();
|
|
14860
14859
|
};
|
|
14861
14860
|
Ho(M.getState());
|
|
14862
14861
|
const Pp = M.subscribeInteractions((p) => {
|
|
@@ -14864,9 +14863,9 @@ async function lw(t = {}) {
|
|
|
14864
14863
|
}), Mp = M.subscribeAccount((p) => {
|
|
14865
14864
|
if (!p && !os) return;
|
|
14866
14865
|
const I = p?.auth;
|
|
14867
|
-
(I?.status !== "error" || I.errorCode !== "browser_session_unavailable" && I.errorCode !== "backend_auth_pending") && (hs += 1, ki = null,
|
|
14868
|
-
const C =
|
|
14869
|
-
e.billingStatus = p, n(p), Ho(M.getState()), Vn(), Ce(M.getState(), { skipUnchangedTimeline: !0, renderSource: "account" }), po(), Le(), queueMicrotask(Oc), C && !
|
|
14866
|
+
(I?.status !== "error" || I.errorCode !== "browser_session_unavailable" && I.errorCode !== "backend_auth_pending") && (hs += 1, ki = null, Pn = !1);
|
|
14867
|
+
const C = Lt();
|
|
14868
|
+
e.billingStatus = p, n(p), Ho(M.getState()), Vn(), Ce(M.getState(), { skipUnchangedTimeline: !0, renderSource: "account" }), po(), Le(), queueMicrotask(Oc), C && !Lt() && Po();
|
|
14870
14869
|
});
|
|
14871
14870
|
let Ko = !1, Wo = null;
|
|
14872
14871
|
const Wc = (p) => {
|
|
@@ -14874,13 +14873,13 @@ async function lw(t = {}) {
|
|
|
14874
14873
|
};
|
|
14875
14874
|
M.on("state", (p) => {
|
|
14876
14875
|
const I = p.user?.id ?? null;
|
|
14877
|
-
(di !== null && di !== p.sessionId || pi !== null && pi !== I || ui !== void 0 && ui !== p.selectionKey) && (vt++,
|
|
14876
|
+
(di !== null && di !== p.sessionId || pi !== null && pi !== I || ui !== void 0 && ui !== p.selectionKey) && (vt++, Pt.clear(), ve = null), ui = p.selectionKey, di = p.sessionId, pi = I;
|
|
14878
14877
|
for (const pe of p.messages)
|
|
14879
14878
|
pe.role === "user" && Mo(pe.id);
|
|
14880
14879
|
for (const pe of p.receipts ?? []) Mo(pe.userMessageId, pe.acceptedRendererRevision);
|
|
14881
14880
|
if (e.extensionRuntime && ($o += 1, ki = null), Ho(p), ac) {
|
|
14882
14881
|
const pe = M.getModel(), kt = ub(pe) ? pe : Vs[0].value;
|
|
14883
|
-
kt !==
|
|
14882
|
+
kt !== Mt && (Mt = kt, Wn());
|
|
14884
14883
|
}
|
|
14885
14884
|
Wc(p), p.status === "connected" && (os = !0, tn && queueMicrotask(() => {
|
|
14886
14885
|
Oc();
|
|
@@ -14922,7 +14921,7 @@ async function lw(t = {}) {
|
|
|
14922
14921
|
},
|
|
14923
14922
|
openPanel: (p) => {
|
|
14924
14923
|
const I = typeof p == "string" ? p : $.value, C = typeof p == "object" ? p.focusComposer !== !1 : !0, A = typeof p == "object" ? p.trigger ?? "external_request" : "external_request";
|
|
14925
|
-
A === "proactive_suggestion" && e.proactiveSuggestion && (rt = e.proactiveSuggestion, _e = !0, at()),
|
|
14924
|
+
A === "proactive_suggestion" && e.proactiveSuggestion && (rt = e.proactiveSuggestion, _e = !0, at()), Ot(A === "proactive_suggestion" ? "Yes, but " : I, !1, C, !0, A);
|
|
14926
14925
|
},
|
|
14927
14926
|
closePanel: Eo,
|
|
14928
14927
|
updateDisplayState: (p) => {
|
|
@@ -14962,7 +14961,7 @@ async function lw(t = {}) {
|
|
|
14962
14961
|
), w.removeEventListener("drop", cn, !0), w.removeEventListener("dragend", cn, !0), w.defaultView?.removeEventListener(
|
|
14963
14962
|
"blur",
|
|
14964
14963
|
cn
|
|
14965
|
-
), window.removeEventListener("resize", bc), wc(), vp(), Ip(), jt !== null && window.clearTimeout(jt), lt !== null && (window.clearTimeout(lt), lt = null), fp(),
|
|
14964
|
+
), window.removeEventListener("resize", bc), wc(), vp(), Ip(), jt !== null && window.clearTimeout(jt), lt !== null && (window.clearTimeout(lt), lt = null), fp(), In !== null && (window.clearTimeout(In), In = null), sn !== null && (window.clearTimeout(sn), sn = null), Ji?.clear(), rc && M.destroy(), go?.release(), o.remove());
|
|
14966
14965
|
}
|
|
14967
14966
|
};
|
|
14968
14967
|
async function Np(p) {
|
|
@@ -14978,7 +14977,7 @@ async function lw(t = {}) {
|
|
|
14978
14977
|
if (A.select(), A.setSelectionRange(0, p.length), !document.execCommand("copy"))
|
|
14979
14978
|
throw new Error("Could not copy referral link.");
|
|
14980
14979
|
} finally {
|
|
14981
|
-
A.remove(), C?.isConnected &&
|
|
14980
|
+
A.remove(), C?.isConnected && vn(C, "referral_copy_restore", {
|
|
14982
14981
|
preventScroll: !0
|
|
14983
14982
|
});
|
|
14984
14983
|
}
|
|
@@ -15287,7 +15286,7 @@ function mw() {
|
|
|
15287
15286
|
)
|
|
15288
15287
|
};
|
|
15289
15288
|
}
|
|
15290
|
-
function
|
|
15289
|
+
function Un(t = null) {
|
|
15291
15290
|
return t ? ao(t) : mw();
|
|
15292
15291
|
}
|
|
15293
15292
|
function ao(t) {
|
|
@@ -15403,7 +15402,7 @@ function vw(t) {
|
|
|
15403
15402
|
return t.classList.contains("pluno-pa-widget--scribble") ? ow : sw;
|
|
15404
15403
|
}
|
|
15405
15404
|
function Tr(t, e, n, i = null) {
|
|
15406
|
-
const s = Hi(t), o =
|
|
15405
|
+
const s = Hi(t), o = Un(i), a = {
|
|
15407
15406
|
x: n === "bottom-left" ? e.x : e.x + s.width - o.width,
|
|
15408
15407
|
y: e.y + s.height - o.height
|
|
15409
15408
|
};
|
|
@@ -16551,20 +16550,20 @@ function Yw(t) {
|
|
|
16551
16550
|
const i = document.createElement("img");
|
|
16552
16551
|
return i.src = n, i.alt = "", i.setAttribute("aria-hidden", "true"), i.addEventListener(
|
|
16553
16552
|
"error",
|
|
16554
|
-
() => i.replaceWith(
|
|
16553
|
+
() => i.replaceWith(Fn(t))
|
|
16555
16554
|
), i;
|
|
16556
16555
|
}
|
|
16557
16556
|
if (e === "video" && n) {
|
|
16558
16557
|
const i = document.createElement("video");
|
|
16559
16558
|
return i.src = n, i.muted = !0, i.preload = "metadata", i.setAttribute("aria-hidden", "true"), i.addEventListener(
|
|
16560
16559
|
"error",
|
|
16561
|
-
() => i.replaceWith(
|
|
16560
|
+
() => i.replaceWith(Fn(t))
|
|
16562
16561
|
), i.addEventListener(
|
|
16563
16562
|
"stalled",
|
|
16564
|
-
() => i.replaceWith(
|
|
16563
|
+
() => i.replaceWith(Fn(t))
|
|
16565
16564
|
), i;
|
|
16566
16565
|
}
|
|
16567
|
-
return
|
|
16566
|
+
return Fn(t);
|
|
16568
16567
|
}
|
|
16569
16568
|
function Xw(t, e) {
|
|
16570
16569
|
const n = Xa(t), i = Ys(t);
|
|
@@ -16600,18 +16599,18 @@ function Xw(t, e) {
|
|
|
16600
16599
|
return;
|
|
16601
16600
|
}
|
|
16602
16601
|
s.replaceWith(
|
|
16603
|
-
|
|
16602
|
+
Fn(o, "message")
|
|
16604
16603
|
);
|
|
16605
16604
|
};
|
|
16606
16605
|
return s.addEventListener("error", r), s.addEventListener("stalled", r), s;
|
|
16607
16606
|
}
|
|
16608
|
-
return
|
|
16607
|
+
return Fn(t, "message");
|
|
16609
16608
|
}
|
|
16610
16609
|
function Zw(t, e, n, i, s, o) {
|
|
16611
16610
|
let a = n;
|
|
16612
16611
|
const r = n.startsWith("data:") || n.startsWith(`blob:${window.location.origin}/`), c = () => {
|
|
16613
16612
|
t.isConnected && t.replaceWith(
|
|
16614
|
-
|
|
16613
|
+
Fn(e(), "message")
|
|
16615
16614
|
);
|
|
16616
16615
|
}, d = () => {
|
|
16617
16616
|
const g = Ys(e());
|
|
@@ -16656,7 +16655,7 @@ function Zw(t, e, n, i, s, o) {
|
|
|
16656
16655
|
};
|
|
16657
16656
|
l();
|
|
16658
16657
|
}
|
|
16659
|
-
function
|
|
16658
|
+
function Fn(t, e = "composer") {
|
|
16660
16659
|
if (e === "composer") {
|
|
16661
16660
|
const o = document.createElement("span");
|
|
16662
16661
|
return o.className = "pluno-pa-widget__attachment-file", o.textContent = bd(t), o;
|