@pluno/product-agent-web 0.1.252 → 0.1.253
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/product-agent-runtime.cjs +1 -1
- package/dist/product-agent-runtime.js +1 -1
- package/dist/product-agent-sdk.js +170 -170
- package/dist/product-agent-widget.js +595 -595
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
1
|
+
const ge = (t) => typeof t == "string" && /^[a-zA-Z0-9:_.-]{1,160}$/.test(t) ? t : null;
|
|
2
2
|
function Zl(t) {
|
|
3
3
|
if (!t || typeof t != "object") return !1;
|
|
4
|
-
const e = t, n = (s) => Number.isSafeInteger(s) && s >= 0, i = (s) => s && typeof s == "object" && Object.keys(s).every((o) => ["sequence", "at", "type", "changed", "generation", "sessionId", "scopeId", "requestId", "effectId", "clientScopeId", "reason", "effectKind", "eventType", "itemCount", "removedCount", "projectionReady"].includes(o)) && n(s.sequence) && n(s.at) &&
|
|
5
|
-
return Object.keys(e).every((s) => ["ownerId", "revision", "dropped", "lastIntent", "lastSelection", "transitions"].includes(s)) &&
|
|
4
|
+
const e = t, n = (s) => Number.isSafeInteger(s) && s >= 0, i = (s) => s && typeof s == "object" && Object.keys(s).every((o) => ["sequence", "at", "type", "changed", "generation", "sessionId", "scopeId", "requestId", "effectId", "clientScopeId", "reason", "effectKind", "eventType", "itemCount", "removedCount", "projectionReady"].includes(o)) && n(s.sequence) && n(s.at) && ge(s.type) !== null && typeof s.changed == "boolean" && [s.generation, s.itemCount, s.removedCount].every((o) => o === null || n(o)) && [s.sessionId, s.scopeId, s.requestId, s.effectId, s.clientScopeId, s.reason, s.effectKind, s.eventType].every((o) => o === null || ge(o) !== null) && (s.projectionReady === null || typeof s.projectionReady == "boolean");
|
|
5
|
+
return Object.keys(e).every((s) => ["ownerId", "revision", "dropped", "lastIntent", "lastSelection", "transitions"].includes(s)) && ge(e.ownerId) !== null && n(e.revision) && n(e.dropped) && (e.lastIntent == null || i(e.lastIntent)) && (e.lastSelection === null || i(e.lastSelection)) && Array.isArray(e.transitions) && e.transitions.length <= 16 && e.transitions.every(i);
|
|
6
6
|
}
|
|
7
7
|
function ap(t, e, n) {
|
|
8
8
|
const i = t;
|
|
@@ -11,17 +11,17 @@ function ap(t, e, n) {
|
|
|
11
11
|
return {
|
|
12
12
|
sequence: e,
|
|
13
13
|
at: Date.now(),
|
|
14
|
-
type:
|
|
14
|
+
type: ge(i.type) ?? "unknown",
|
|
15
15
|
changed: n,
|
|
16
16
|
generation: Number.isSafeInteger(i.generation) ? i.generation : null,
|
|
17
|
-
sessionId:
|
|
18
|
-
clientScopeId:
|
|
17
|
+
sessionId: ge(i.sessionId ?? i.event?.conversation_id ?? s?.conversation_id),
|
|
18
|
+
clientScopeId: ge(i.clientScopeId),
|
|
19
19
|
reason: ["user", "tool", "user_requested", "new_chat", "session_switch"].includes(i.reason ?? "") ? i.reason : null,
|
|
20
|
-
effectId:
|
|
21
|
-
scopeId:
|
|
22
|
-
requestId:
|
|
23
|
-
effectKind:
|
|
24
|
-
eventType:
|
|
20
|
+
effectId: ge(i.effectId),
|
|
21
|
+
scopeId: ge(i.conversationScopeId),
|
|
22
|
+
requestId: ge(i.requestId),
|
|
23
|
+
effectKind: ge(i.effectKind),
|
|
24
|
+
eventType: ge(i.event?.type),
|
|
25
25
|
itemCount: Array.isArray(s?.items) ? s.items.length : null,
|
|
26
26
|
removedCount: Array.isArray(s?.removed_items) ? s.removed_items.length : null,
|
|
27
27
|
projectionReady: typeof s?.projection_ready == "boolean" ? s.projection_ready : null
|
|
@@ -92,15 +92,15 @@ function up(t, e, n = {}) {
|
|
|
92
92
|
return { ...s, context: {
|
|
93
93
|
capturedAt: Date.now(),
|
|
94
94
|
selectionKey: cp(e.selectionKey),
|
|
95
|
-
userId:
|
|
95
|
+
userId: ge(e.user?.id),
|
|
96
96
|
loading: e.isLoadingSession === !0,
|
|
97
97
|
draft: e.isDraftSession === !0,
|
|
98
98
|
thinking: e.isThinking === !0,
|
|
99
99
|
connected: e.status === "connected",
|
|
100
100
|
hasError: !!e.lastError,
|
|
101
|
-
phase:
|
|
102
|
-
queryStatus:
|
|
103
|
-
queryRequestId:
|
|
101
|
+
phase: ge(e.activity?.phase ?? e.taskStatus),
|
|
102
|
+
queryStatus: ge(o?.queryStatus),
|
|
103
|
+
queryRequestId: ge(o?.queryRequestId),
|
|
104
104
|
queryUpdatedAt: o?.queryUpdatedAt ?? null,
|
|
105
105
|
renderSource: n.renderSource ?? "local",
|
|
106
106
|
selectionFencePending: n.selectionFencePending ?? !1,
|
|
@@ -111,7 +111,7 @@ function up(t, e, n = {}) {
|
|
|
111
111
|
function pp(t) {
|
|
112
112
|
if (!t || typeof t != "object") return !1;
|
|
113
113
|
const e = t, n = (i) => Number.isSafeInteger(i) && i >= 0;
|
|
114
|
-
return Object.keys(e).every((i) => ["capturedAt", "selectionKey", "userId", "loading", "draft", "thinking", "connected", "hasError", "phase", "queryStatus", "queryRequestId", "queryUpdatedAt", "renderSource", "selectionFencePending", "guardCreatedAt", "owner"].includes(i)) && n(e.capturedAt) && [e.queryUpdatedAt, e.guardCreatedAt].every((i) => i === null || n(i)) && [e.selectionKey, e.userId, e.phase, e.queryStatus, e.queryRequestId].every((i) => i === null ||
|
|
114
|
+
return Object.keys(e).every((i) => ["capturedAt", "selectionKey", "userId", "loading", "draft", "thinking", "connected", "hasError", "phase", "queryStatus", "queryRequestId", "queryUpdatedAt", "renderSource", "selectionFencePending", "guardCreatedAt", "owner"].includes(i)) && n(e.capturedAt) && [e.queryUpdatedAt, e.guardCreatedAt].every((i) => i === null || n(i)) && [e.selectionKey, e.userId, e.phase, e.queryStatus, e.queryRequestId].every((i) => i === null || ge(i) !== null) && [e.loading, e.draft, e.thinking, e.connected, e.hasError, e.selectionFencePending].every((i) => typeof i == "boolean") && ["state", "account", "interactions", "local", "sidepanel_layout"].includes(e.renderSource) && (e.owner === void 0 || Zl(e.owner));
|
|
115
115
|
}
|
|
116
116
|
function hp(t) {
|
|
117
117
|
if (!t || typeof t != "object" || Object.keys(t).some((i) => i !== "before" && i !== "current")) return !1;
|
|
@@ -438,16 +438,16 @@ function ea(t) {
|
|
|
438
438
|
e ^= t.charCodeAt(n), e = Math.imul(e, 16777619);
|
|
439
439
|
return `fnv1a-${(e >>> 0).toString(16).padStart(8, "0")}`;
|
|
440
440
|
}
|
|
441
|
-
const Bs = "0.1.
|
|
441
|
+
const Bs = "0.1.253", od = {
|
|
442
442
|
version: Bs
|
|
443
443
|
};
|
|
444
444
|
function Tp(t, e, n, i, s = {}) {
|
|
445
445
|
const o = !i && e === "conversation_error" && n !== void 0 && t.conversationDiagnostics?.errorMessageFingerprint === ea(Dn(n)) ? t.conversationDiagnostics : void 0;
|
|
446
446
|
return {
|
|
447
|
-
sessionId:
|
|
448
|
-
requestId:
|
|
449
|
-
...
|
|
450
|
-
code: o ?
|
|
447
|
+
sessionId: ge(t.sessionId),
|
|
448
|
+
requestId: ge(o?.httpRequest?.requestId ?? o?.errorRequestId ?? o?.queryRequestId),
|
|
449
|
+
...ge(o?.failedClientMessageId) ? { clientMessageId: o.failedClientMessageId } : {},
|
|
450
|
+
code: o ? ge(t.lastErrorCode) : null,
|
|
451
451
|
...zs(o?.errorNormalization) ? { normalization: o.errorNormalization } : {},
|
|
452
452
|
builds: { sdk: od.version, ...s }
|
|
453
453
|
};
|
|
@@ -474,7 +474,7 @@ function On(t) {
|
|
|
474
474
|
"release",
|
|
475
475
|
"upstreamRequestId",
|
|
476
476
|
"upstreamTraceId"
|
|
477
|
-
].includes(i)) &&
|
|
477
|
+
].includes(i)) && ge(e.requestId) !== null && ["GET", "POST", "PUT", "PATCH", "DELETE"].includes(e.method) && ["/api/product-agent/conversations/:sessionId/snapshot", "/api/product-agent/:namespace/commands", "/api/product-agent/:namespace/:operation"].includes(e.route) && (e.status === null || n(e.status) && e.status >= 100 && e.status <= 599) && (e.abortTrigger === null || ["deadline", "transport_disposed", "owner_disposed", "authority_retired", "observation_released", "request_replaced", "caller_cancelled", "unexpected_abort"].includes(e.abortTrigger)) && ["http_deadline", "http_transport", "conversation_query", "browser", "http_response"].includes(e.owner) && (e.category === void 0 || /^[a-z0-9_]{1,80}$/.test(e.category)) && [e.responseHeadersMs, e.responseBodyMs].every((i) => i == null || n(i)) && n(e.elapsedMs) && n(e.attempt) && e.attempt >= 1 && e.attempt <= 10 && [e.queryRequestId, e.ownerId, e.sessionId].every((i) => i === null || ge(i) !== null) && (e.authorityGeneration === null || n(e.authorityGeneration)) && typeof e.release == "string" && /^[a-zA-Z0-9._-]{1,80}$/.test(e.release) && [e.upstreamRequestId, e.upstreamTraceId].every((i) => i === null || typeof i == "string" && /^[a-zA-Z0-9_:;=./-]{1,160}$/.test(i));
|
|
478
478
|
}
|
|
479
479
|
function Pp(t) {
|
|
480
480
|
const e = {}, n = (i, s) => {
|
|
@@ -837,8 +837,8 @@ function zp(t, e, n, i) {
|
|
|
837
837
|
if (n.clients[e.clientScopeId] !== e.conversationScopeId) throw new Error("Submission selection has changed.");
|
|
838
838
|
const { type: r, authorityId: c, generation: l, prepareContext: p, ...d } = e, h = t.submissions[e.userMessageId];
|
|
839
839
|
if (h) {
|
|
840
|
-
const { contextPreparation: _, requestedModel: v, sessionId: E, delivery: L, cancelled: K, cancellationReason: U, error:
|
|
841
|
-
if (as(
|
|
840
|
+
const { contextPreparation: _, requestedModel: v, sessionId: E, delivery: L, cancelled: K, cancellationReason: U, error: he, executionVersion: G, ...oe } = h;
|
|
841
|
+
if (as(oe) !== as(d)) throw new Error("User-message identity cannot be reused with different input.");
|
|
842
842
|
return { state: t, effects: o };
|
|
843
843
|
}
|
|
844
844
|
const g = n.selections[e.conversationScopeId], m = Object.values(t.submissions).find((_) => _.conversationScopeId === e.conversationScopeId && !_.cancelled && _.sessionId !== null), f = i.scopes[e.clientScopeId], w = {
|
|
@@ -1776,15 +1776,15 @@ class jp {
|
|
|
1776
1776
|
}
|
|
1777
1777
|
}
|
|
1778
1778
|
function Vn(t, e, n) {
|
|
1779
|
-
const i = t.submissionOrder.map((S) => t.submissions[S]).filter((S) => S.conversationScopeId === n), s = e.selections[n]?.sessionId ?? i.find((S) => !S.cancelled && S.sessionId !== null)?.sessionId ?? null, o = s ? t.sessions[s] : void 0, a = t.submissionOrder.map((S) => t.submissions[S]).filter((S) => s ? S.sessionId === s || S.sessionId === null && S.conversationScopeId === n : S.conversationScopeId === n), r = Object.values(o?.items ?? {}).sort((S,
|
|
1780
|
-
const
|
|
1781
|
-
return
|
|
1779
|
+
const i = t.submissionOrder.map((S) => t.submissions[S]).filter((S) => S.conversationScopeId === n), s = e.selections[n]?.sessionId ?? i.find((S) => !S.cancelled && S.sessionId !== null)?.sessionId ?? null, o = s ? t.sessions[s] : void 0, a = t.submissionOrder.map((S) => t.submissions[S]).filter((S) => s ? S.sessionId === s || S.sessionId === null && S.conversationScopeId === n : S.conversationScopeId === n), r = Object.values(o?.items ?? {}).sort((S, F) => {
|
|
1780
|
+
const ee = jt(S.created_at), ce = jt(F.created_at);
|
|
1781
|
+
return ee < ce ? -1 : ee > ce ? 1 : S.id < F.id ? -1 : S.id > F.id ? 1 : 0;
|
|
1782
1782
|
}), c = a.filter((S) => (!S.cancelled || S.conversationScopeId === n && (S.sessionId === null || S.sessionId === s || s === null && S === a[a.length - 1])) && !o?.items[S.userMessageId] && !o?.removedItems[S.userMessageId]), l = {};
|
|
1783
1783
|
for (const S of r) {
|
|
1784
|
-
const
|
|
1785
|
-
if (
|
|
1786
|
-
const
|
|
1787
|
-
l[S.id] =
|
|
1784
|
+
const F = As(S);
|
|
1785
|
+
if (F === null) continue;
|
|
1786
|
+
const ee = o?.streams[S.id];
|
|
1787
|
+
l[S.id] = ee ? ee.state === "open" ? "open" : F < ee.revision ? "awaiting_content" : ee.state : "open";
|
|
1788
1788
|
}
|
|
1789
1789
|
const p = [];
|
|
1790
1790
|
for (const S of r)
|
|
@@ -1792,15 +1792,15 @@ function Vn(t, e, n) {
|
|
|
1792
1792
|
p.push({ id: S.id, userMessageId: S.id, activityIds: [], outcomeIds: [], collapsed: !1 });
|
|
1793
1793
|
else {
|
|
1794
1794
|
p.length || p.push({ id: `leading:${S.id}`, userMessageId: null, activityIds: [], outcomeIds: [], collapsed: !1 });
|
|
1795
|
-
const
|
|
1796
|
-
p[
|
|
1795
|
+
const F = p.length - 1, ee = p[F], ce = S.type === "commentary" || S.type === "tool_summary" ? "activityIds" : "outcomeIds";
|
|
1796
|
+
p[F] = { ...ee, [ce]: [...ee[ce], S.id] };
|
|
1797
1797
|
}
|
|
1798
1798
|
for (const S of c) {
|
|
1799
|
-
const
|
|
1800
|
-
const ce = a.find((Se) => Se.userMessageId ===
|
|
1801
|
-
return (ce?.submittedAt ?? (
|
|
1799
|
+
const F = p.findIndex((ee) => {
|
|
1800
|
+
const ce = a.find((Se) => Se.userMessageId === ee.userMessageId), te = o?.items[ee.userMessageId ?? ee.activityIds[0] ?? ee.outcomeIds[0]];
|
|
1801
|
+
return (ce?.submittedAt ?? (te ? Date.parse(te.created_at) : 1 / 0)) > S.submittedAt;
|
|
1802
1802
|
});
|
|
1803
|
-
p.splice(
|
|
1803
|
+
p.splice(F < 0 ? p.length : F, 0, {
|
|
1804
1804
|
id: S.userMessageId,
|
|
1805
1805
|
userMessageId: S.userMessageId,
|
|
1806
1806
|
activityIds: [],
|
|
@@ -1810,17 +1810,17 @@ function Vn(t, e, n) {
|
|
|
1810
1810
|
}
|
|
1811
1811
|
const d = o?.execution, h = a.filter((S) => !S.cancelled && S.delivery !== "failed"), g = h.filter((S) => S.delivery !== "accepted" && S.executionVersion === null), m = h.filter((S) => S.delivery === "accepted" && S.executionVersion === null), f = h[h.length - 1], w = g.length > 0, b = f !== void 0 && m.includes(f);
|
|
1812
1812
|
let _ = w ? "submitting" : b ? "awaiting_execution" : d?.phase ?? "idle";
|
|
1813
|
-
const v = Object.entries(t.stops).filter(([S]) => S === n || s !== null && e.selections[S]?.sessionId === s).map(([, S]) => S).find((S) => (!a.length || S.userMessageIds.includes(a[a.length - 1].userMessageId) || !w && !b && Kt(d).some((
|
|
1813
|
+
const v = Object.entries(t.stops).filter(([S]) => S === n || s !== null && e.selections[S]?.sessionId === s).map(([, S]) => S).find((S) => (!a.length || S.userMessageIds.includes(a[a.length - 1].userMessageId) || !w && !b && Kt(d).some((F) => S.userMessageIds.includes(F))) && (!d || d.version <= S.executionVersion || ["thinking", "steering", "queued", "stopping"].includes(d.phase) || a.some((F) => F.cancelled && F.executionVersion === null && S.userMessageIds.includes(F.userMessageId)))), E = d && ["thinking", "steering", "queued", "stopping"].includes(d.phase) || a.some((S) => S.delivery === "accepted" && S.executionVersion === null && v?.userMessageIds.includes(S.userMessageId));
|
|
1814
1814
|
v && E && !w && (!d || !["thinking", "steering", "queued", "stopping"].includes(d.phase) || Kt(d).every((S) => v.userMessageIds.includes(S))) && (_ = "stopping"), v && !E && !w && a.some((S) => S.cancelled && S.executionVersion === null && v.userMessageIds.includes(S.userMessageId)) && (_ = a.some((S) => v.userMessageIds.includes(S.userMessageId) && ["sending", "uncertain"].includes(S.delivery)) ? "stopping" : "stopped");
|
|
1815
|
-
const L = ["thinking", "steering", "queued"].includes(_), K = t.stops[n] ?? v, U = K?.userMessageIds.filter((S) => !["completed", "failed"].includes(o?.executionByUserMessage[S]?.phase ?? "")) ?? [],
|
|
1816
|
-
const
|
|
1817
|
-
return !Object.values(t.operations).some((ce) => ce.command.type === "run.stop" && ce.command.payload.expectedUserMessageId === S && ce.phase === "done") && (
|
|
1818
|
-
}), G = d?.user_message_ids ?? [],
|
|
1815
|
+
const L = ["thinking", "steering", "queued"].includes(_), K = t.stops[n] ?? v, U = K?.userMessageIds.filter((S) => !["completed", "failed"].includes(o?.executionByUserMessage[S]?.phase ?? "")) ?? [], he = U.some((S) => {
|
|
1816
|
+
const F = a.find((ce) => ce.userMessageId === S);
|
|
1817
|
+
return !Object.values(t.operations).some((ce) => ce.command.type === "run.stop" && ce.command.payload.expectedUserMessageId === S && ce.phase === "done") && (F?.executionVersion === null && ["sending", "uncertain", "accepted"].includes(F.delivery) || !!(d && Kt(d).includes(S) && ["thinking", "steering", "queued", "stopping"].includes(d.phase)));
|
|
1818
|
+
}), G = d?.user_message_ids ?? [], oe = w || b ? f?.userMessageId ?? null : G[G.length - 1] ?? null, R = p.find((S) => S.userMessageId === oe), V = L ? [...R?.activityIds ?? []].reverse().find((S) => l[S] === "open") ?? null : null, O = s !== null && !!e.selections[n]?.provisionalId && r.length === 0 && a.length === 0 && // The first persisted idle snapshot already has a positive synchronization version.
|
|
1819
1819
|
(!o?.execution || o.execution.phase === "idle" && o.execution.user_message_ids.length === 0) && Object.values(t.operations).some((S) => S.conversationScopeId === n && S.phase === "done" && ["runtime.warmup", "attachment.prepare"].includes(S.command.type) && !S.command.payload.sessionId && S.result?.sessionId === s);
|
|
1820
1820
|
return qt({
|
|
1821
1821
|
historyRefreshFailure: o?.historyRefreshFailure ?? null,
|
|
1822
1822
|
selectionKey: n ? JSON.stringify([t.authorityId, t.generation, n]) : void 0,
|
|
1823
|
-
isDraftSession:
|
|
1823
|
+
isDraftSession: O,
|
|
1824
1824
|
proactiveQuestion: t.proactiveQuestions[n] ?? null,
|
|
1825
1825
|
sessionId: s,
|
|
1826
1826
|
items: r,
|
|
@@ -1832,9 +1832,9 @@ function Vn(t, e, n) {
|
|
|
1832
1832
|
removedItems: o?.removedItems ?? {},
|
|
1833
1833
|
streamStates: l,
|
|
1834
1834
|
preparation: o?.preparation ?? null,
|
|
1835
|
-
stop: K ? { ...K, userMessageIds: U, pending:
|
|
1836
|
-
segments: p.map((S,
|
|
1837
|
-
activity: { phase: _, activeItemId:
|
|
1835
|
+
stop: K ? { ...K, userMessageIds: U, pending: he } : null,
|
|
1836
|
+
segments: p.map((S, F) => ({ ...S, collapsed: L ? S.userMessageId !== oe : F < p.length - 1 || S.activityIds.length > 0 })),
|
|
1837
|
+
activity: { phase: _, activeItemId: V, userMessageId: oe, executionKey: JSON.stringify([...Kt(d)].sort()) },
|
|
1838
1838
|
// Staging transfers the immutable input to the core. Waiting for backend acceptance leaves
|
|
1839
1839
|
// the same submitted text in the optimistic transcript and composer during delivery.
|
|
1840
1840
|
receipts: i.filter((S) => !S.cancelled && e.clients[S.clientScopeId] === n).map((S) => ({ viewId: S.viewId, userMessageId: S.userMessageId, acceptedRendererRevision: S.rendererRevision }))
|
|
@@ -3379,10 +3379,10 @@ const Kh = [
|
|
|
3379
3379
|
"removeListener"
|
|
3380
3380
|
// used by the Node.js EventEmitter
|
|
3381
3381
|
];
|
|
3382
|
-
var
|
|
3382
|
+
var ne;
|
|
3383
3383
|
(function(t) {
|
|
3384
3384
|
t[t.CONNECT = 0] = "CONNECT", t[t.DISCONNECT = 1] = "DISCONNECT", t[t.EVENT = 2] = "EVENT", t[t.ACK = 3] = "ACK", t[t.CONNECT_ERROR = 4] = "CONNECT_ERROR", t[t.BINARY_EVENT = 5] = "BINARY_EVENT", t[t.BINARY_ACK = 6] = "BINARY_ACK";
|
|
3385
|
-
})(
|
|
3385
|
+
})(ne || (ne = {}));
|
|
3386
3386
|
class Hh {
|
|
3387
3387
|
/**
|
|
3388
3388
|
* Encoder constructor
|
|
@@ -3399,8 +3399,8 @@ class Hh {
|
|
|
3399
3399
|
* @param {Object} obj - packet object
|
|
3400
3400
|
*/
|
|
3401
3401
|
encode(e) {
|
|
3402
|
-
return (e.type ===
|
|
3403
|
-
type: e.type ===
|
|
3402
|
+
return (e.type === ne.EVENT || e.type === ne.ACK) && _s(e) ? this.encodeAsBinary({
|
|
3403
|
+
type: e.type === ne.EVENT ? ne.BINARY_EVENT : ne.BINARY_ACK,
|
|
3404
3404
|
nsp: e.nsp,
|
|
3405
3405
|
data: e.data,
|
|
3406
3406
|
id: e.id
|
|
@@ -3411,7 +3411,7 @@ class Hh {
|
|
|
3411
3411
|
*/
|
|
3412
3412
|
encodeAsString(e) {
|
|
3413
3413
|
let n = "" + e.type;
|
|
3414
|
-
return (e.type ===
|
|
3414
|
+
return (e.type === ne.BINARY_EVENT || e.type === ne.BINARY_ACK) && (n += e.attachments + "-"), e.nsp && e.nsp !== "/" && (n += e.nsp + ","), e.id != null && (n += e.id), e.data != null && (n += JSON.stringify(e.data, this.replacer)), n;
|
|
3415
3415
|
}
|
|
3416
3416
|
/**
|
|
3417
3417
|
* Encode packet as 'buffer sequence' by removing blobs, and
|
|
@@ -3444,8 +3444,8 @@ class ra extends Ee {
|
|
|
3444
3444
|
if (this.reconstructor)
|
|
3445
3445
|
throw new Error("got plaintext data when reconstructing a packet");
|
|
3446
3446
|
n = this.decodeString(e);
|
|
3447
|
-
const i = n.type ===
|
|
3448
|
-
i || n.type ===
|
|
3447
|
+
const i = n.type === ne.BINARY_EVENT;
|
|
3448
|
+
i || n.type === ne.BINARY_ACK ? (n.type = i ? ne.EVENT : ne.ACK, this.reconstructor = new Wh(n)) : super.emitReserved("decoded", n);
|
|
3449
3449
|
} else if (oa(e) || e.base64)
|
|
3450
3450
|
if (this.reconstructor)
|
|
3451
3451
|
n = this.reconstructor.takeBinaryData(e), n && (this.reconstructor = null, super.emitReserved("decoded", n));
|
|
@@ -3465,9 +3465,9 @@ class ra extends Ee {
|
|
|
3465
3465
|
const i = {
|
|
3466
3466
|
type: Number(e.charAt(0))
|
|
3467
3467
|
};
|
|
3468
|
-
if (
|
|
3468
|
+
if (ne[i.type] === void 0)
|
|
3469
3469
|
throw new Error("unknown packet type " + i.type);
|
|
3470
|
-
if (i.type ===
|
|
3470
|
+
if (i.type === ne.BINARY_EVENT || i.type === ne.BINARY_ACK) {
|
|
3471
3471
|
const o = n + 1;
|
|
3472
3472
|
for (; e.charAt(++n) !== "-" && n != e.length; )
|
|
3473
3473
|
;
|
|
@@ -3520,17 +3520,17 @@ class ra extends Ee {
|
|
|
3520
3520
|
}
|
|
3521
3521
|
static isPayloadValid(e, n) {
|
|
3522
3522
|
switch (e) {
|
|
3523
|
-
case
|
|
3523
|
+
case ne.CONNECT:
|
|
3524
3524
|
return Uc(n);
|
|
3525
|
-
case
|
|
3525
|
+
case ne.DISCONNECT:
|
|
3526
3526
|
return n === void 0;
|
|
3527
|
-
case
|
|
3527
|
+
case ne.CONNECT_ERROR:
|
|
3528
3528
|
return typeof n == "string" || Uc(n);
|
|
3529
|
-
case
|
|
3530
|
-
case
|
|
3529
|
+
case ne.EVENT:
|
|
3530
|
+
case ne.BINARY_EVENT:
|
|
3531
3531
|
return Array.isArray(n) && (typeof n[0] == "number" || typeof n[0] == "string" && Kh.indexOf(n[0]) === -1);
|
|
3532
|
-
case
|
|
3533
|
-
case
|
|
3532
|
+
case ne.ACK:
|
|
3533
|
+
case ne.BINARY_ACK:
|
|
3534
3534
|
return Array.isArray(n);
|
|
3535
3535
|
}
|
|
3536
3536
|
}
|
|
@@ -3578,7 +3578,7 @@ const Gh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3578
3578
|
Decoder: ra,
|
|
3579
3579
|
Encoder: Hh,
|
|
3580
3580
|
get PacketType() {
|
|
3581
|
-
return
|
|
3581
|
+
return ne;
|
|
3582
3582
|
}
|
|
3583
3583
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3584
3584
|
function It(t, e, n) {
|
|
@@ -3716,7 +3716,7 @@ class Ed extends Ee {
|
|
|
3716
3716
|
if (n.unshift(e), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
|
|
3717
3717
|
return this._addToQueue(n), this;
|
|
3718
3718
|
const a = {
|
|
3719
|
-
type:
|
|
3719
|
+
type: ne.EVENT,
|
|
3720
3720
|
data: n
|
|
3721
3721
|
};
|
|
3722
3722
|
if (a.options = {}, a.options.compress = this.flags.compress !== !1, typeof n[n.length - 1] == "function") {
|
|
@@ -3824,7 +3824,7 @@ class Ed extends Ee {
|
|
|
3824
3824
|
*/
|
|
3825
3825
|
_sendConnectPacket(e) {
|
|
3826
3826
|
this.packet({
|
|
3827
|
-
type:
|
|
3827
|
+
type: ne.CONNECT,
|
|
3828
3828
|
data: this._pid ? Object.assign({ pid: this._pid, offset: this._lastOffset }, e) : e
|
|
3829
3829
|
});
|
|
3830
3830
|
}
|
|
@@ -3870,21 +3870,21 @@ class Ed extends Ee {
|
|
|
3870
3870
|
onpacket(e) {
|
|
3871
3871
|
if (e.nsp === this.nsp)
|
|
3872
3872
|
switch (e.type) {
|
|
3873
|
-
case
|
|
3873
|
+
case ne.CONNECT:
|
|
3874
3874
|
e.data && e.data.sid ? this.onconnect(e.data.sid, e.data.pid) : this.emitReserved("connect_error", new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));
|
|
3875
3875
|
break;
|
|
3876
|
-
case
|
|
3877
|
-
case
|
|
3876
|
+
case ne.EVENT:
|
|
3877
|
+
case ne.BINARY_EVENT:
|
|
3878
3878
|
this.onevent(e);
|
|
3879
3879
|
break;
|
|
3880
|
-
case
|
|
3881
|
-
case
|
|
3880
|
+
case ne.ACK:
|
|
3881
|
+
case ne.BINARY_ACK:
|
|
3882
3882
|
this.onack(e);
|
|
3883
3883
|
break;
|
|
3884
|
-
case
|
|
3884
|
+
case ne.DISCONNECT:
|
|
3885
3885
|
this.ondisconnect();
|
|
3886
3886
|
break;
|
|
3887
|
-
case
|
|
3887
|
+
case ne.CONNECT_ERROR:
|
|
3888
3888
|
this.destroy();
|
|
3889
3889
|
const i = new Error(e.data.message);
|
|
3890
3890
|
i.data = e.data.data, this.emitReserved("connect_error", i);
|
|
@@ -3919,7 +3919,7 @@ class Ed extends Ee {
|
|
|
3919
3919
|
let i = !1;
|
|
3920
3920
|
return function(...s) {
|
|
3921
3921
|
i || (i = !0, n.packet({
|
|
3922
|
-
type:
|
|
3922
|
+
type: ne.ACK,
|
|
3923
3923
|
id: e,
|
|
3924
3924
|
data: s
|
|
3925
3925
|
}));
|
|
@@ -3988,7 +3988,7 @@ class Ed extends Ee {
|
|
|
3988
3988
|
* @return self
|
|
3989
3989
|
*/
|
|
3990
3990
|
disconnect() {
|
|
3991
|
-
return this.connected && this.packet({ type:
|
|
3991
|
+
return this.connected && this.packet({ type: ne.DISCONNECT }), this.destroy(), this.connected && this.onclose("io client disconnect"), this;
|
|
3992
3992
|
}
|
|
3993
3993
|
/**
|
|
3994
3994
|
* Alias for {@link disconnect()}.
|
|
@@ -4473,7 +4473,7 @@ const Yh = 45e3, Xh = /* @__PURE__ */ new Set([
|
|
|
4473
4473
|
"tool.started",
|
|
4474
4474
|
"tool.result"
|
|
4475
4475
|
]);
|
|
4476
|
-
class
|
|
4476
|
+
class T extends Error {
|
|
4477
4477
|
constructor(e, n, i = !1, s, o = !1) {
|
|
4478
4478
|
super(e), this.code = n, this.outcomeUnknown = i, this.detail = s, this.backendRefusal = o, this.code = n === "401" ? "unauthorized" : n;
|
|
4479
4479
|
}
|
|
@@ -4484,7 +4484,7 @@ class R extends Error {
|
|
|
4484
4484
|
}
|
|
4485
4485
|
function zc(t, e) {
|
|
4486
4486
|
const n = t.result && typeof t.result == "object" ? t.result : void 0, i = typeof n?.message == "string" && n.message.trim() ? n.message : `${e} (${t.code ?? "request_rejected"})`;
|
|
4487
|
-
return new
|
|
4487
|
+
return new T(i, t.code ?? "request_rejected", !1, t.result, !0);
|
|
4488
4488
|
}
|
|
4489
4489
|
class Qh {
|
|
4490
4490
|
constructor(e) {
|
|
@@ -4506,7 +4506,7 @@ class Qh {
|
|
|
4506
4506
|
}) : this.invalidate(!1, n), this.restoreBackoff();
|
|
4507
4507
|
}), this.socket.io.on("reconnect", () => this.restoreBackoff()), this.socket.on("connection.ready", (n) => {
|
|
4508
4508
|
if (n.protocol !== 1 || n.role !== this.options.auth.role || n.display_projection_ready !== !1) {
|
|
4509
|
-
this.options.onError(new
|
|
4509
|
+
this.options.onError(new T("Unsupported Product Agent transport negotiation", "protocol_error")), this.disconnect();
|
|
4510
4510
|
return;
|
|
4511
4511
|
}
|
|
4512
4512
|
this.admitted = n, this.activate();
|
|
@@ -4518,7 +4518,7 @@ class Qh {
|
|
|
4518
4518
|
)), this.socket.on("connect_error", (n) => {
|
|
4519
4519
|
const i = n.data?.code;
|
|
4520
4520
|
if (i === "unauthorized" && n.data?.reason === "token_expired" && n.data.retryable === !0) {
|
|
4521
|
-
this.options.onError(new
|
|
4521
|
+
this.options.onError(new T(n.message, i, !1, n.data)), this.disconnect();
|
|
4522
4522
|
return;
|
|
4523
4523
|
}
|
|
4524
4524
|
if (!i || n.data?.retryable === !0) {
|
|
@@ -4530,7 +4530,7 @@ class Qh {
|
|
|
4530
4530
|
}
|
|
4531
4531
|
return;
|
|
4532
4532
|
}
|
|
4533
|
-
(i === "unauthorized" || i === "update_required") && (this.rejectedToken = this.options.auth.token), this.options.onError(new
|
|
4533
|
+
(i === "unauthorized" || i === "update_required") && (this.rejectedToken = this.options.auth.token), this.options.onError(new T(n.message, i ?? "connection_error", !1, n.data)), this.rejectedToken === this.options.auth.token && this.disconnect();
|
|
4534
4534
|
}), this.socket.on("conversation.event", (n) => {
|
|
4535
4535
|
this.ready && n.protocol === 1 && n.session_id && this.bindings.get(n.session_id)?.owners.size && this.options.onEvent("conversation.event", n.event);
|
|
4536
4536
|
}), this.socket.on("conversation.metadata.updated", (n) => {
|
|
@@ -4557,7 +4557,7 @@ class Qh {
|
|
|
4557
4557
|
const s = this.generation, o = await this.options.onToolCall(n);
|
|
4558
4558
|
i({ received: o && !!this.ready && s === this.generation });
|
|
4559
4559
|
}), this.socket.on("executor.replaced", () => {
|
|
4560
|
-
this.retired = !0, this.options.onError(new
|
|
4560
|
+
this.retired = !0, this.options.onError(new T("Browser executor was replaced", "executor_replaced")), this.disconnect();
|
|
4561
4561
|
});
|
|
4562
4562
|
}
|
|
4563
4563
|
options;
|
|
@@ -4591,11 +4591,11 @@ class Qh {
|
|
|
4591
4591
|
return this.ready && this.socket.id ? `pa-sio:${this.socket.id}` : null;
|
|
4592
4592
|
}
|
|
4593
4593
|
async restoreExecutor(e) {
|
|
4594
|
-
if (this.connectionId !== e) throw new
|
|
4594
|
+
if (this.connectionId !== e) throw new T("Browser connection changed.", "executor_not_ready");
|
|
4595
4595
|
if (this.executorRecovery) return this.executorRecovery;
|
|
4596
4596
|
const n = this.request("executor.register", {}, this.generation).then(() => {
|
|
4597
4597
|
}, (i) => {
|
|
4598
|
-
throw i instanceof
|
|
4598
|
+
throw i instanceof T && (i.outcomeUnknown || i.code === "disconnected") ? new T("Reconnecting the browser before continuing.", "executor_not_ready") : i;
|
|
4599
4599
|
});
|
|
4600
4600
|
this.executorRecovery = n;
|
|
4601
4601
|
try {
|
|
@@ -4632,7 +4632,7 @@ class Qh {
|
|
|
4632
4632
|
beginAttempt() {
|
|
4633
4633
|
this.clearReadinessTimers(), this.active = !0, this.attempt = { connectionAttemptId: crypto.randomUUID(), reconnectAttempt: this.attemptCount++, startedAt: Date.now() }, this.socket.auth = { ...this.options.auth, connection_attempt_id: this.attempt.connectionAttemptId }, this.options.onAttempt?.(this.attempt);
|
|
4634
4634
|
const e = this.generation, n = (i) => {
|
|
4635
|
-
e !== this.generation || !this.active || (this.options.onError(new
|
|
4635
|
+
e !== this.generation || !this.active || (this.options.onError(new T("Product Agent readiness timed out", i, !1, {
|
|
4636
4636
|
retryable: !0,
|
|
4637
4637
|
...this.attempt,
|
|
4638
4638
|
readinessPhase: this.ready ? "bootstrap" : this.admitted ? "activation" : "namespace_ready"
|
|
@@ -4646,20 +4646,20 @@ class Qh {
|
|
|
4646
4646
|
async retain(e, n) {
|
|
4647
4647
|
let i = this.bindings.get(e);
|
|
4648
4648
|
if (!i) {
|
|
4649
|
-
if (this.bindings.size >= 64) throw new
|
|
4649
|
+
if (this.bindings.size >= 64) throw new T("Too many conversation subscriptions", "subscription_limit");
|
|
4650
4650
|
i = { id: crypto.randomUUID(), owners: /* @__PURE__ */ new Set(), joinedGeneration: -1 }, this.bindings.set(e, i);
|
|
4651
4651
|
}
|
|
4652
4652
|
if (i.owners.add(n), !this.ready) return;
|
|
4653
4653
|
const s = this.generation;
|
|
4654
4654
|
await this.synchronize().catch((o) => {
|
|
4655
|
-
throw s !== this.generation || (i.owners.delete(n), o instanceof
|
|
4655
|
+
throw s !== this.generation || (i.owners.delete(n), o instanceof T && o.outcomeUnknown && this.ready && (i.joinedGeneration = this.generation), this.synchronize().catch((a) => this.options.onError(a))), o;
|
|
4656
4656
|
});
|
|
4657
4657
|
}
|
|
4658
4658
|
async release(e, n) {
|
|
4659
4659
|
this.bindings.get(e)?.owners.delete(n), this.ready && await this.synchronize();
|
|
4660
4660
|
}
|
|
4661
4661
|
async rpc(e, n) {
|
|
4662
|
-
if (!Xh.has(e)) throw new
|
|
4662
|
+
if (!Xh.has(e)) throw new T("Operation requires its HTTP adapter", "unsupported_rpc");
|
|
4663
4663
|
const i = this.generation, s = JSON.stringify(n);
|
|
4664
4664
|
return e === "run.stop" && this.uploadingResult ? (this.assertReady(i), this.request("runtime.rpc", { type: e, payload: JSON.parse(s) }, i)) : this.enqueue(async () => {
|
|
4665
4665
|
if (this.assertReady(i), e === "tool.result") {
|
|
@@ -4679,8 +4679,8 @@ class Qh {
|
|
|
4679
4679
|
this.ready = n, await this.synchronize(!0), e === this.generation && this.ready && (this.options.bootstrapRequired || this.markReady(), this.options.onReady(n));
|
|
4680
4680
|
} catch (s) {
|
|
4681
4681
|
if (e === this.generation) {
|
|
4682
|
-
const o = s instanceof
|
|
4683
|
-
this.activationFailed(new
|
|
4682
|
+
const o = s instanceof T ? s : new T(String(s), "activation_error");
|
|
4683
|
+
this.activationFailed(new T(
|
|
4684
4684
|
o.message,
|
|
4685
4685
|
o.code,
|
|
4686
4686
|
o.outcomeUnknown,
|
|
@@ -4707,7 +4707,7 @@ class Qh {
|
|
|
4707
4707
|
subscription_id: s.id,
|
|
4708
4708
|
...this.options.displaySchema === "canonical" ? { display_schema: "canonical" } : {}
|
|
4709
4709
|
}, n).then(() => !0).catch((a) => {
|
|
4710
|
-
if (a instanceof
|
|
4710
|
+
if (a instanceof T && !a.outcomeUnknown && a.detail?.retryable !== !0 && this.bindings.get(i) === s && (this.bindings.delete(i), e))
|
|
4711
4711
|
return this.options.onError(a), !1;
|
|
4712
4712
|
throw a;
|
|
4713
4713
|
})) continue;
|
|
@@ -4719,7 +4719,7 @@ class Qh {
|
|
|
4719
4719
|
}
|
|
4720
4720
|
enqueue(e) {
|
|
4721
4721
|
if (this.queuedOperations >= 128) {
|
|
4722
|
-
const i = new
|
|
4722
|
+
const i = new T("Product Agent transport queue is full", "backpressure");
|
|
4723
4723
|
return this.recoverUncertainDelivery(i, this.generation), Promise.reject(i);
|
|
4724
4724
|
}
|
|
4725
4725
|
this.queuedOperations++;
|
|
@@ -4730,7 +4730,7 @@ class Qh {
|
|
|
4730
4730
|
}), n;
|
|
4731
4731
|
}
|
|
4732
4732
|
assertReady(e) {
|
|
4733
|
-
if (!this.ready || !this.socket.connected || e !== this.generation) throw new
|
|
4733
|
+
if (!this.ready || !this.socket.connected || e !== this.generation) throw new T("Transport is not ready", "disconnected");
|
|
4734
4734
|
}
|
|
4735
4735
|
async uploadResult(e, n, i) {
|
|
4736
4736
|
const s = crypto.randomUUID();
|
|
@@ -4755,43 +4755,43 @@ class Qh {
|
|
|
4755
4755
|
body: JSON.stringify({ request_id: s, type: "tool.result", payload: e })
|
|
4756
4756
|
});
|
|
4757
4757
|
if (d.status >= 500)
|
|
4758
|
-
throw new
|
|
4759
|
-
if (!d.ok) throw new
|
|
4758
|
+
throw new T("Result upload outcome is unknown", "delivery_unknown", !0);
|
|
4759
|
+
if (!d.ok) throw new T(`Result upload rejected (${d.status})`, String(d.status), !1, void 0, !0);
|
|
4760
4760
|
const h = await d.json();
|
|
4761
4761
|
if (n !== this.generation || o.signal.aborted)
|
|
4762
|
-
throw new
|
|
4762
|
+
throw new T("Result upload outcome is unknown", "delivery_unknown", !0);
|
|
4763
4763
|
if (h?.request_id !== s || typeof h.ok != "boolean")
|
|
4764
|
-
throw new
|
|
4764
|
+
throw new T("Invalid result acknowledgement identity", "invalid_ack", !0);
|
|
4765
4765
|
if (!h.ok) throw zc(h, "Product Agent result rejected");
|
|
4766
4766
|
return h.result;
|
|
4767
4767
|
} catch (l) {
|
|
4768
|
-
const p = l instanceof
|
|
4768
|
+
const p = l instanceof T ? l : new T("Result upload outcome is unknown", "delivery_unknown", !0);
|
|
4769
4769
|
throw this.recoverUncertainDelivery(p, n), p;
|
|
4770
4770
|
} finally {
|
|
4771
4771
|
clearTimeout(c), this.uploadingResult = !1, this.pending.delete(a);
|
|
4772
4772
|
}
|
|
4773
4773
|
}
|
|
4774
4774
|
request(e, n, i) {
|
|
4775
|
-
if (!this.socket.connected || i !== this.generation) return Promise.reject(new
|
|
4775
|
+
if (!this.socket.connected || i !== this.generation) return Promise.reject(new T("Transport disconnected", "disconnected"));
|
|
4776
4776
|
const s = crypto.randomUUID();
|
|
4777
4777
|
return new Promise((o, a) => {
|
|
4778
4778
|
const r = (c) => {
|
|
4779
4779
|
this.pending.delete(r), a(c);
|
|
4780
4780
|
};
|
|
4781
4781
|
this.pending.add(r), this.socket.timeout(this.options.requestTimeoutMs ?? 15e3).emit(e, { ...n, request_id: s }, (c, l) => {
|
|
4782
|
-
this.pending.delete(r) && (c || i !== this.generation ? a(new
|
|
4782
|
+
this.pending.delete(r) && (c || i !== this.generation ? a(new T("Delivery outcome is unknown; reconcile without repeating execution", "delivery_unknown", !0)) : l?.request_id !== s || typeof l.ok != "boolean" ? a(new T("Invalid acknowledgement identity", "invalid_ack", !0)) : l.ok ? o(l.result) : a(zc(l, "Product Agent request rejected")));
|
|
4783
4783
|
});
|
|
4784
4784
|
}).catch((o) => {
|
|
4785
4785
|
throw this.recoverUncertainDelivery(o, i), o;
|
|
4786
4786
|
});
|
|
4787
4787
|
}
|
|
4788
4788
|
recoverUncertainDelivery(e, n) {
|
|
4789
|
-
e instanceof
|
|
4789
|
+
e instanceof T && (e.outcomeUnknown || e.code === "backpressure" && !e.backendRefusal) && n === this.generation && this.active && this.recover(e.code === "backpressure" ? "local_backpressure" : "local_delivery_uncertain");
|
|
4790
4790
|
}
|
|
4791
4791
|
invalidate(e = !1, n = "local_invalidation") {
|
|
4792
4792
|
if (this.clearReadinessTimers(), !!this.active) {
|
|
4793
4793
|
this.active = !1, this.generation++, this.ready = null, this.admitted = null, this.activating = !1;
|
|
4794
|
-
for (const i of [...this.pending]) i(new
|
|
4794
|
+
for (const i of [...this.pending]) i(new T("Connection lost before acknowledgement", "delivery_unknown", !0));
|
|
4795
4795
|
this.options.onDisconnect(e, n);
|
|
4796
4796
|
}
|
|
4797
4797
|
}
|
|
@@ -4819,7 +4819,7 @@ class Cd {
|
|
|
4819
4819
|
async request(e, n = {}, i, s, o, a = {}) {
|
|
4820
4820
|
if (a.skipAuthentication) return this.requestOnce(e, n, i, s, o, a.signal, a.diagnostic);
|
|
4821
4821
|
const r = this.options.authority?.(), c = (d = !0) => {
|
|
4822
|
-
if (r !== this.options.authority?.()) throw new
|
|
4822
|
+
if (r !== this.options.authority?.()) throw new T("Conversation authority was retired.", "authority_retired", !0);
|
|
4823
4823
|
d && (this.requests.signal.throwIfAborted(), a.signal?.throwIfAborted());
|
|
4824
4824
|
}, l = a.readOnly ?? (s ?? (i === void 0 ? "GET" : "POST")) === "GET";
|
|
4825
4825
|
let p = 0;
|
|
@@ -4834,7 +4834,7 @@ class Cd {
|
|
|
4834
4834
|
try {
|
|
4835
4835
|
let f = i;
|
|
4836
4836
|
if (o === "conversations" && e === "/commands" && this.auth.role !== "session_surface" && this.options.executorConnection) {
|
|
4837
|
-
if (m = this.options.executorConnection(), !m) throw new
|
|
4837
|
+
if (m = this.options.executorConnection(), !m) throw new T("Reconnecting the browser before continuing.", "executor_not_ready");
|
|
4838
4838
|
const _ = i;
|
|
4839
4839
|
f = { ..._, context: { ..._.context, connection_id: m } };
|
|
4840
4840
|
}
|
|
@@ -4842,92 +4842,92 @@ class Cd {
|
|
|
4842
4842
|
return c(), b;
|
|
4843
4843
|
} catch (f) {
|
|
4844
4844
|
if (c(!1), this.requests.signal.aborted || a.signal?.aborted) throw f;
|
|
4845
|
-
if (f instanceof
|
|
4845
|
+
if (f instanceof T && f.code === "executor_not_ready" && m && d === 0 && this.options.restoreExecutor) {
|
|
4846
4846
|
await this.options.restoreExecutor(m), d++, c();
|
|
4847
4847
|
continue;
|
|
4848
4848
|
}
|
|
4849
|
-
if (!(f instanceof
|
|
4849
|
+
if (!(f instanceof T) || !["unauthorized", "403"].includes(f.code) || !this.options.recoverAuthentication || !l || (await this.options.recoverAuthentication(g, f, l && d === 0), c(), !l || d !== 0)) throw f;
|
|
4850
4850
|
d++;
|
|
4851
4851
|
}
|
|
4852
4852
|
}
|
|
4853
4853
|
}
|
|
4854
4854
|
async requestOnce(e, n, i, s, o, a, r, c = 1) {
|
|
4855
4855
|
const l = this.auth.client_kind === "embed", p = new URL(`/api/product-agent/${o ?? (l ? "embed" : "runtime")}${e}`, this.options.backendUrl), d = o === "conversations" ? {} : l ? { client_id: this.auth.client_id, transport_id: this.auth.transport_id } : { community_id: this.auth.community_id, automation_run_id: this.auth.automation_run_id };
|
|
4856
|
-
for (const [
|
|
4857
|
-
|
|
4856
|
+
for (const [R, V] of Object.entries({ ...d, ...n }))
|
|
4857
|
+
V != null && p.searchParams.set(R, String(V));
|
|
4858
4858
|
this.requests.signal.throwIfAborted(), a?.throwIfAborted();
|
|
4859
|
-
const h = new AbortController(), g = { trigger: null }, m = (
|
|
4860
|
-
h.signal.aborted || (g.trigger =
|
|
4859
|
+
const h = new AbortController(), g = { trigger: null }, m = (R) => {
|
|
4860
|
+
h.signal.aborted || (g.trigger = R, h.abort());
|
|
4861
4861
|
}, f = () => m("transport_disposed"), w = () => m(["owner_disposed", "authority_retired", "observation_released", "request_replaced"].includes(a?.reason) ? a.reason : "caller_cancelled");
|
|
4862
4862
|
this.requests.signal.addEventListener("abort", f, { once: !0 }), a?.addEventListener("abort", w, { once: !0 });
|
|
4863
4863
|
const b = o === "conversations" && /^\/[^/]+\/snapshot$/.test(e) && s === "POST", _ = /^\/conversations(?:\/[^/]+)?$/.test(e) && (s ?? (i === void 0 ? "GET" : "POST")) === "GET", v = setTimeout(() => m("deadline"), _ ? 6e4 : b ? 3e4 : 15e3), E = Zh(), L = Date.now();
|
|
4864
|
-
let K = null, U =
|
|
4864
|
+
let K = null, U = !1, he = null, G = null, oe = null;
|
|
4865
4865
|
try {
|
|
4866
|
-
const
|
|
4866
|
+
const R = await Promise.resolve(fetch(p, {
|
|
4867
4867
|
method: s ?? (i === void 0 ? "GET" : "POST"),
|
|
4868
4868
|
cache: "no-store",
|
|
4869
4869
|
signal: h.signal,
|
|
4870
4870
|
headers: { "x-product-agent-auth-request-id": E, authorization: l || o === "conversations" ? `Bearer ${this.auth.token}` : this.auth.token, "content-type": "application/json", ...b ? { "x-request-id": E } : {} },
|
|
4871
4871
|
...i === void 0 ? {} : { body: JSON.stringify(i) }
|
|
4872
|
-
})).catch((
|
|
4873
|
-
throw
|
|
4872
|
+
})).catch((V) => {
|
|
4873
|
+
throw U = !0, V;
|
|
4874
4874
|
});
|
|
4875
|
-
if (K = Date.now(),
|
|
4876
|
-
const
|
|
4877
|
-
if (l &&
|
|
4878
|
-
throw new
|
|
4879
|
-
if (o === "conversations" && e.endsWith("/snapshot") &&
|
|
4880
|
-
throw new
|
|
4881
|
-
if (o === "conversations" && e === "/commands" && (
|
|
4882
|
-
throw new
|
|
4883
|
-
if (
|
|
4884
|
-
throw new
|
|
4885
|
-
...typeof
|
|
4886
|
-
...typeof
|
|
4875
|
+
if (K = Date.now(), he = R.status, G = Bc(R.headers.get("x-request-id")), oe = Bc(R.headers.get("x-cloud-trace-context")), !R.ok) {
|
|
4876
|
+
const V = R.status === 401 ? "unauthorized" : R.status === 426 ? "update_required" : String(R.status), O = (await R.json().catch(() => null))?.detail;
|
|
4877
|
+
if (l && R.status === 403 && (o === "conversations" && /^\/[^/]+\/snapshot$/.test(e) || (!o || o === "embed") && /^\/conversations\/[^/]+$/.test(e)) && ["Conversation unavailable", "Integration mismatch", "Embedded origin mismatch"].includes(O))
|
|
4878
|
+
throw new T("Conversation unavailable", "conversation_access_denied");
|
|
4879
|
+
if (o === "conversations" && e.endsWith("/snapshot") && R.status === 409 && O === "Display projection is not enabled")
|
|
4880
|
+
throw new T("Conversation history is unavailable. Try loading this chat again after the service is ready.", "display_projection_disabled");
|
|
4881
|
+
if (o === "conversations" && e === "/commands" && (R.status === 409 && O?.code === "executor_not_ready" && O.retryable === !0 || R.status === 403 && O === "Register the executor before commands"))
|
|
4882
|
+
throw new T("Reconnecting the browser before continuing.", "executor_not_ready");
|
|
4883
|
+
if (R.status !== 401 && O && typeof O == "object" && (["service_origin_not_allowed", "security_control_enforcement_unavailable"].includes(O.code) || !Ti(void 0, O.code).allowed) && typeof O.message == "string")
|
|
4884
|
+
throw new T(O.message, O.code, !1, {
|
|
4885
|
+
...typeof O.blockedOrigin == "string" ? { blockedOrigin: O.blockedOrigin } : {},
|
|
4886
|
+
...typeof O.securitySettingsUrl == "string" ? { securitySettingsUrl: O.securitySettingsUrl } : {}
|
|
4887
4887
|
}, o === "conversations" && e === "/commands");
|
|
4888
|
-
const
|
|
4889
|
-
throw new R
|
|
4888
|
+
const S = O === "Token expired" ? "token_expired" : O === "Invalid token" ? "invalid_token" : O?.reason, F = R.status === 401 && ["missing_token", "token_expired", "invalid_token", "user_not_found"].includes(S) ? { requestId: E, authTransport: "http", authEndpoint: `${o ?? (l ? "embed" : "runtime")}:${["snapshot", "me", "bootstrap", "commands", "activity", "session-history"].includes(e.split("/").pop()) ? e.split("/").pop() : "other"}`, reason: S, retryable: S === "token_expired" && (O === "Token expired" || O.retryable === !0) } : void 0;
|
|
4889
|
+
throw new T(R.status === 401 ? "Your session expired or is invalid. Reconnect to continue." : R.status === 403 ? "You don't have access to this conversation. Check your access and reconnect." : `Product Agent request failed (${R.status})`, V, !1, F);
|
|
4890
4890
|
}
|
|
4891
|
-
return await
|
|
4892
|
-
} catch (
|
|
4893
|
-
const
|
|
4891
|
+
return await R.json();
|
|
4892
|
+
} catch (R) {
|
|
4893
|
+
const V = g.trigger ?? ((R instanceof Error || R instanceof DOMException) && R.name === "AbortError" ? "unexpected_abort" : null), O = {
|
|
4894
4894
|
requestId: E,
|
|
4895
4895
|
method: s ?? (i === void 0 ? "GET" : "POST"),
|
|
4896
4896
|
route: b ? "/api/product-agent/conversations/:sessionId/snapshot" : e === "/commands" ? "/api/product-agent/:namespace/commands" : "/api/product-agent/:namespace/:operation",
|
|
4897
|
-
status:
|
|
4898
|
-
abortTrigger:
|
|
4899
|
-
category:
|
|
4897
|
+
status: he,
|
|
4898
|
+
abortTrigger: V,
|
|
4899
|
+
category: V === "deadline" ? "request_timed_out" : V === "unexpected_abort" ? "connection_interrupted" : V ? "request_cancelled" : R instanceof T ? R.code : U ? "connection_interrupted" : "invalid_response",
|
|
4900
4900
|
responseHeadersMs: K === null ? null : Math.max(0, K - L),
|
|
4901
4901
|
responseBodyMs: K === null ? null : Math.max(0, Date.now() - K),
|
|
4902
|
-
owner:
|
|
4902
|
+
owner: V === "deadline" ? "http_deadline" : V === "transport_disposed" ? "http_transport" : V && V !== "unexpected_abort" ? "conversation_query" : he === null ? "browser" : "http_response",
|
|
4903
4903
|
elapsedMs: Math.max(0, Date.now() - L),
|
|
4904
4904
|
attempt: c,
|
|
4905
|
-
queryRequestId:
|
|
4906
|
-
ownerId:
|
|
4905
|
+
queryRequestId: ge(r?.queryRequestId),
|
|
4906
|
+
ownerId: ge(r?.ownerId),
|
|
4907
4907
|
authorityGeneration: r?.authorityGeneration ?? null,
|
|
4908
|
-
sessionId:
|
|
4908
|
+
sessionId: ge(r?.sessionId),
|
|
4909
4909
|
release: this.auth.extension_version ? `extension-${this.auth.extension_version}` : `sdk-${od.version}`,
|
|
4910
|
-
upstreamRequestId:
|
|
4911
|
-
upstreamTraceId:
|
|
4910
|
+
upstreamRequestId: G,
|
|
4911
|
+
upstreamTraceId: oe
|
|
4912
4912
|
};
|
|
4913
|
-
On(
|
|
4913
|
+
On(O) && Promise.resolve().then(() => this.options.onRequestFailure ? this.options.onRequestFailure(O) : console.warn("Product Agent HTTP request failed", O)).catch(() => {
|
|
4914
4914
|
});
|
|
4915
|
-
const
|
|
4916
|
-
if (
|
|
4917
|
-
const
|
|
4918
|
-
throw new
|
|
4919
|
-
|
|
4920
|
-
|
|
4915
|
+
const S = On(O) ? { httpRequest: O } : void 0;
|
|
4916
|
+
if (V !== null) {
|
|
4917
|
+
const F = V !== "deadline" && V !== "unexpected_abort";
|
|
4918
|
+
throw new T(
|
|
4919
|
+
F ? "The request was cancelled." : V === "deadline" ? "The request timed out. Please try again." : "The connection was interrupted. Please try again.",
|
|
4920
|
+
F ? "request_cancelled" : V === "deadline" ? "request_timed_out" : "connection_interrupted",
|
|
4921
4921
|
!0,
|
|
4922
|
-
|
|
4922
|
+
S
|
|
4923
4923
|
);
|
|
4924
4924
|
}
|
|
4925
|
-
throw
|
|
4926
|
-
"The conversation response could not be read. Please try again.",
|
|
4925
|
+
throw R instanceof T && S ? new T(R.message, R.code, R.outcomeUnknown, { ...R.detail, ...S }, R.backendRefusal) : S ? new T(
|
|
4926
|
+
U ? "The connection was interrupted. Please try again." : b ? "The conversation response could not be read. Please try again." : "The response could not be read. Please try again.",
|
|
4927
4927
|
"connection_interrupted",
|
|
4928
4928
|
!0,
|
|
4929
|
-
|
|
4930
|
-
) :
|
|
4929
|
+
S
|
|
4930
|
+
) : R;
|
|
4931
4931
|
} finally {
|
|
4932
4932
|
clearTimeout(v), this.requests.signal.removeEventListener("abort", f), a?.removeEventListener("abort", w);
|
|
4933
4933
|
}
|
|
@@ -5403,7 +5403,7 @@ class Ae extends EventTarget {
|
|
|
5403
5403
|
stage: s,
|
|
5404
5404
|
httpStatus: /^[45][0-9]{2}$/.test(n.code) ? Number(n.code) : void 0,
|
|
5405
5405
|
failureKind: n.outcomeUnknown || i.retryable === !0 ? "temporary" : "permanent"
|
|
5406
|
-
}), this.fail(new
|
|
5406
|
+
}), this.fail(new T(n.message, n.code, n.outcomeUnknown, { ...i, stage: s }, n.backendRefusal));
|
|
5407
5407
|
}
|
|
5408
5408
|
}
|
|
5409
5409
|
}), queueMicrotask(() => {
|
|
@@ -5531,17 +5531,17 @@ class Ae extends EventTarget {
|
|
|
5531
5531
|
this.queueDiagnostic("auth_timeout", {
|
|
5532
5532
|
readinessPhase: "bootstrap",
|
|
5533
5533
|
failureKind: "temporary",
|
|
5534
|
-
httpStatus: a instanceof
|
|
5534
|
+
httpStatus: a instanceof T && /^[45][0-9]{2}$/.test(a.code) ? Number(a.code) : void 0
|
|
5535
5535
|
}), this.transport.recover();
|
|
5536
5536
|
return;
|
|
5537
5537
|
}
|
|
5538
5538
|
if (n.type === "auth.session") {
|
|
5539
|
-
const r = a instanceof
|
|
5539
|
+
const r = a instanceof T ? a : new T("Chat setup failed", "request_failed");
|
|
5540
5540
|
this.queueDiagnostic("auth_rejected", {
|
|
5541
5541
|
stage: "bootstrap",
|
|
5542
5542
|
failureKind: "permanent",
|
|
5543
5543
|
httpStatus: /^[45][0-9]{2}$/.test(r.code) ? Number(r.code) : void 0
|
|
5544
|
-
}), this.fail(new
|
|
5544
|
+
}), this.fail(new T(
|
|
5545
5545
|
r.message,
|
|
5546
5546
|
r.code,
|
|
5547
5547
|
r.outcomeUnknown,
|
|
@@ -5558,7 +5558,7 @@ class Ae extends EventTarget {
|
|
|
5558
5558
|
try {
|
|
5559
5559
|
return await this.transport.rpc(e.type, Object.fromEntries(Object.entries(e).filter(([n]) => n !== "type"))), !0;
|
|
5560
5560
|
} catch (n) {
|
|
5561
|
-
return n instanceof
|
|
5561
|
+
return n instanceof T && n.code === "backpressure" && !n.backendRefusal || this.fail(n, e), n instanceof T && n.backendRefusal;
|
|
5562
5562
|
}
|
|
5563
5563
|
}
|
|
5564
5564
|
receive(e) {
|
|
@@ -5577,13 +5577,13 @@ class Ae extends EventTarget {
|
|
|
5577
5577
|
}
|
|
5578
5578
|
buffer(e, n) {
|
|
5579
5579
|
if (e.length >= 128) {
|
|
5580
|
-
this.fail(new
|
|
5580
|
+
this.fail(new T("Product Agent delivery buffer is full", "backpressure")), this.close();
|
|
5581
5581
|
return;
|
|
5582
5582
|
}
|
|
5583
5583
|
e.push(n);
|
|
5584
5584
|
}
|
|
5585
5585
|
fail(e, n, i = !1) {
|
|
5586
|
-
const s = e instanceof
|
|
5586
|
+
const s = e instanceof T ? e : new T(String(e), "request_failed");
|
|
5587
5587
|
if (s.code === "disconnected" || s.outcomeUnknown) return;
|
|
5588
5588
|
const o = s.detail && typeof s.detail == "object" ? s.detail : {};
|
|
5589
5589
|
this.options.auth.client_kind === "extension" && s.code === "update_required" && o.version_status && this.receive(o.version_status), this.receive({
|
|
@@ -5603,7 +5603,7 @@ class Ae extends EventTarget {
|
|
|
5603
5603
|
return this.httpTransport.request(e, n, i, s);
|
|
5604
5604
|
}
|
|
5605
5605
|
isRetryableRead(e) {
|
|
5606
|
-
return e instanceof TypeError || e instanceof DOMException && e.name === "AbortError" || e instanceof
|
|
5606
|
+
return e instanceof TypeError || e instanceof DOMException && e.name === "AbortError" || e instanceof T && ["request_timed_out", "408", "425", "429", "500", "502", "503", "504"].includes(e.code);
|
|
5607
5607
|
}
|
|
5608
5608
|
async loadUserSuggestions(e, n = 0) {
|
|
5609
5609
|
const i = this.promptRevision, s = this.options.pageUrl();
|
|
@@ -5614,7 +5614,7 @@ class Ae extends EventTarget {
|
|
|
5614
5614
|
} catch (o) {
|
|
5615
5615
|
if (e.aborted) return;
|
|
5616
5616
|
if (!this.isRetryableRead(o)) {
|
|
5617
|
-
i === this.promptRevision && s === this.options.pageUrl() && this.receive({ type: "starterPrompts.updated", starterPromptsLoading: !1 }), o instanceof
|
|
5617
|
+
i === this.promptRevision && s === this.options.pageUrl() && this.receive({ type: "starterPrompts.updated", starterPromptsLoading: !1 }), o instanceof T && ["unauthorized", "update_required"].includes(o.code) ? this.fail(o) : console.error("Product Agent optional suggestions could not be loaded", o);
|
|
5618
5618
|
return;
|
|
5619
5619
|
}
|
|
5620
5620
|
this.suggestionTimer = setTimeout(() => {
|
|
@@ -6511,7 +6511,7 @@ class Cg {
|
|
|
6511
6511
|
})
|
|
6512
6512
|
},
|
|
6513
6513
|
errorAdapter: (s) => {
|
|
6514
|
-
const o = Xr(s), a = s !== null && typeof s == "object"
|
|
6514
|
+
const o = Xr(s), a = s !== null && typeof s == "object" ? "details" in s ? s.details : "detail" in s ? s.detail : void 0 : void 0, r = a && typeof a == "object" && "httpRequest" in a ? a.httpRequest : void 0;
|
|
6515
6515
|
return { ...o, ...On(r) ? { details: { ...o.details, httpRequest: r } } : {} };
|
|
6516
6516
|
}
|
|
6517
6517
|
});
|
|
@@ -7382,7 +7382,7 @@ function er(t) {
|
|
|
7382
7382
|
if (t instanceof Ze)
|
|
7383
7383
|
return t.retryable;
|
|
7384
7384
|
if (t && typeof t == "object") {
|
|
7385
|
-
const e = t instanceof
|
|
7385
|
+
const e = t instanceof T ? t.code : "", n = /^[45][0-9]{2}$/.test(e) ? Number(e) : t.status;
|
|
7386
7386
|
if (typeof n == "number")
|
|
7387
7387
|
return n === 408 || n === 425 || n === 429 || n >= 500;
|
|
7388
7388
|
}
|
|
@@ -7415,7 +7415,7 @@ class pa {
|
|
|
7415
7415
|
pendingAuthentication: () => this.credentialRecovery ?? (this.credentialRecoveryFailure ? Promise.reject(this.credentialRecoveryFailure) : null),
|
|
7416
7416
|
recoverAuthentication: (s, o, a) => this.recoverHttpAuthentication(s, o, a),
|
|
7417
7417
|
executorConnection: () => this.socket instanceof Ae ? this.socket.connectionId : null,
|
|
7418
|
-
restoreExecutor: (s) => this.socket instanceof Ae ? this.socket.restoreExecutor(s) : Promise.reject(new
|
|
7418
|
+
restoreExecutor: (s) => this.socket instanceof Ae ? this.socket.restoreExecutor(s) : Promise.reject(new T("Browser is reconnecting.", "executor_not_ready")),
|
|
7419
7419
|
auth: {
|
|
7420
7420
|
protocol: 1,
|
|
7421
7421
|
token: e.token ?? "",
|
|
@@ -7716,7 +7716,7 @@ class pa {
|
|
|
7716
7716
|
},
|
|
7717
7717
|
onCommand: (d) => $n("client_event", d.type, Yo({ ...d.payload, type: d.type })),
|
|
7718
7718
|
onError: (d, h) => {
|
|
7719
|
-
if (this.options.productVariant === "customer_embedded" && h.operation === "conversation.snapshot" && d instanceof
|
|
7719
|
+
if (this.options.productVariant === "customer_embedded" && h.operation === "conversation.snapshot" && d instanceof T && d.code === "conversation_access_denied") {
|
|
7720
7720
|
h.sessionId === this.getState().sessionId && this.startNewSession({ notifyTransport: !1 });
|
|
7721
7721
|
return;
|
|
7722
7722
|
}
|
|
@@ -7822,7 +7822,7 @@ class pa {
|
|
|
7822
7822
|
}
|
|
7823
7823
|
}
|
|
7824
7824
|
handleDirectoryTransportError(e) {
|
|
7825
|
-
if (!(e instanceof
|
|
7825
|
+
if (!(e instanceof T) || this.authenticationFailure || !["unauthorized", "update_required", "service_origin_not_allowed", "security_control_enforcement_unavailable"].includes(e.code) && Ti(void 0, e.code).allowed) return;
|
|
7826
7826
|
const n = e.detail && typeof e.detail == "object" ? e.detail : {};
|
|
7827
7827
|
this.handleServerEvent({
|
|
7828
7828
|
...n,
|
|
@@ -8039,7 +8039,7 @@ class pa {
|
|
|
8039
8039
|
} catch (s) {
|
|
8040
8040
|
if (n !== this.connectionAttemptId || this.state.status === "closed")
|
|
8041
8041
|
return;
|
|
8042
|
-
if (s instanceof
|
|
8042
|
+
if (s instanceof T && (s.code === "unauthorized" || s.code === "update_required")) {
|
|
8043
8043
|
this.handleDirectoryTransportError(s);
|
|
8044
8044
|
return;
|
|
8045
8045
|
}
|
|
@@ -8057,7 +8057,7 @@ class pa {
|
|
|
8057
8057
|
);
|
|
8058
8058
|
return;
|
|
8059
8059
|
}
|
|
8060
|
-
throw this.options.productVariant === "customer_embedded" ? (this.reportTransportDiagnostic("auth_rejected", this.connectionFailureDiagnostic(s, "token_provider")), this.stopAuthentication(new
|
|
8060
|
+
throw this.options.productVariant === "customer_embedded" ? (this.reportTransportDiagnostic("auth_rejected", this.connectionFailureDiagnostic(s, "token_provider")), this.stopAuthentication(new T(o.message, "connection_failed", !1), !0), this.emit("error", o), o) : (this.setState({
|
|
8061
8061
|
status: "error",
|
|
8062
8062
|
lastError: o.message,
|
|
8063
8063
|
lastErrorCode: "connection_failed"
|
|
@@ -8750,7 +8750,7 @@ class pa {
|
|
|
8750
8750
|
}
|
|
8751
8751
|
reportHealthSignal(e, n = {}) {
|
|
8752
8752
|
const i = this.getState();
|
|
8753
|
-
if (n.httpRequest && (!On(n.httpRequest) || 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;
|
|
8753
|
+
if (n.httpRequest && (!On(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;
|
|
8754
8754
|
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);
|
|
8755
8755
|
if (s) {
|
|
8756
8756
|
const m = `${e}:${s}:${e === "invalid_state_transition" ? n.reason ?? "unknown" : ""}`;
|
|
@@ -9129,7 +9129,7 @@ class pa {
|
|
|
9129
9129
|
this.credentialRecovery || this.refreshCredentials(
|
|
9130
9130
|
n,
|
|
9131
9131
|
!0,
|
|
9132
|
-
new
|
|
9132
|
+
new T("", "unauthorized", !1, {
|
|
9133
9133
|
reason: e.reason,
|
|
9134
9134
|
authTransport: e.authTransport,
|
|
9135
9135
|
requestId: e.requestId,
|
|
@@ -9146,7 +9146,7 @@ class pa {
|
|
|
9146
9146
|
return;
|
|
9147
9147
|
}
|
|
9148
9148
|
if (this.options.productVariant === "customer_embedded" && /^4[0-9]{2}$/.test(String(e.code)) && !["401", "408", "425", "429"].includes(String(e.code)) && e.retryable !== !0 && (e.stage === "executor_registration" || e.stage === "socket_admission" || e.stage === "bootstrap")) {
|
|
9149
|
-
this.stopAuthentication(new
|
|
9149
|
+
this.stopAuthentication(new T(
|
|
9150
9150
|
e.code === "403" ? "Chat access is not configured for this page. Contact your app administrator, then try again." : "Chat setup could not be completed. Contact your app administrator, then try again.",
|
|
9151
9151
|
"connection_failed",
|
|
9152
9152
|
!1,
|
|
@@ -9155,7 +9155,7 @@ class pa {
|
|
|
9155
9155
|
return;
|
|
9156
9156
|
}
|
|
9157
9157
|
if (!this.options.webSocketFactory && (e.code === "unauthorized" || e.code === "update_required" || e.code === "executor_replaced")) {
|
|
9158
|
-
this.stopAuthentication(new
|
|
9158
|
+
this.stopAuthentication(new T(String(e.message), String(e.code), !1, { reason: e.reason, authTransport: "socket" }));
|
|
9159
9159
|
return;
|
|
9160
9160
|
}
|
|
9161
9161
|
["unauthorized", "update_required", "executor_replaced", "connection_failed"].includes(String(e.code)) && this.setState({ status: "error", lastError: String(e.message), lastErrorCode: String(e.code) });
|
|
@@ -9313,7 +9313,7 @@ class pa {
|
|
|
9313
9313
|
stage: this.lastRecoveryStage,
|
|
9314
9314
|
recoveryOutcome: "exhausted",
|
|
9315
9315
|
failureKind: "temporary"
|
|
9316
|
-
}), this.stopAuthentication(new
|
|
9316
|
+
}), this.stopAuthentication(new T(
|
|
9317
9317
|
"Chat could not reconnect. Your conversation and draft are saved here. Try again.",
|
|
9318
9318
|
"connection_failed",
|
|
9319
9319
|
!1
|
|
@@ -9324,7 +9324,7 @@ class pa {
|
|
|
9324
9324
|
this.embeddedRecoveryTimer !== null && window.clearTimeout(this.embeddedRecoveryTimer), this.embeddedRecoveryTimer = null;
|
|
9325
9325
|
}
|
|
9326
9326
|
connectionFailureDiagnostic(e, n) {
|
|
9327
|
-
const i = e instanceof Ze ? e.status : e instanceof
|
|
9327
|
+
const i = e instanceof Ze ? e.status : e instanceof T && e.code === "unauthorized" ? 401 : e instanceof T && /^[45][0-9]{2}$/.test(e.code) ? Number(e.code) : void 0, s = i !== void 0 && Number.isInteger(i) && i >= 400 && i <= 599 ? i : void 0, a = !(e instanceof T && ["unauthorized", "403", "update_required", "executor_replaced"].includes(e.code)) && er(e) && s !== 401 && s !== 403;
|
|
9328
9328
|
return {
|
|
9329
9329
|
stage: n,
|
|
9330
9330
|
...s !== void 0 ? { httpStatus: s } : {},
|
|
@@ -9393,7 +9393,7 @@ class pa {
|
|
|
9393
9393
|
...this.authenticationDiagnostic(e),
|
|
9394
9394
|
failureKind: "permanent",
|
|
9395
9395
|
recoveryOutcome: "refused"
|
|
9396
|
-
}), e.code === "unauthorized" && (e = new
|
|
9396
|
+
}), e.code === "unauthorized" && (e = new T("Your chat session could not be refreshed. Reload the page to reconnect.", e.code, !1, e.detail)), this.authenticationFailure = e, this.credentialRecovery = null, this.clearEmbeddedRecoveryBudget(), this.rejectedTransportToken = ["unauthorized", "update_required"].includes(e.code) ? this.token : null, this.refreshingDefaultCredentials = !1, this.reconnectTimer !== null && window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null, this.clearSocketPhaseTimers(), this.stopHeartbeat();
|
|
9397
9397
|
const i = this.socket;
|
|
9398
9398
|
this.socket = null, this.setState({ status: "error", lastError: e.message, lastErrorCode: e.code }), i?.close(), this.directoryObservation?.reconcile(), this.conversationObservation?.wake();
|
|
9399
9399
|
}
|
|
@@ -9417,7 +9417,7 @@ class pa {
|
|
|
9417
9417
|
refreshCredentials(e, n = !1, i) {
|
|
9418
9418
|
if (this.credentialRecovery) return this.credentialRecovery;
|
|
9419
9419
|
this.credentialRecoveryFailure = null;
|
|
9420
|
-
const s = this.token, o = this.authenticationDiagnostic(i ?? new
|
|
9420
|
+
const s = this.token, o = this.authenticationDiagnostic(i ?? new T(
|
|
9421
9421
|
"",
|
|
9422
9422
|
"unauthorized",
|
|
9423
9423
|
!1,
|
|
@@ -9429,14 +9429,14 @@ class pa {
|
|
|
9429
9429
|
const r = (async () => {
|
|
9430
9430
|
const c = await this.acquireToken("connect", { forceRefresh: !0 });
|
|
9431
9431
|
if (this.socket !== e || this.state.status === "closed" || this.clientRuntime.isDisposed)
|
|
9432
|
-
throw new
|
|
9432
|
+
throw new T("Conversation authority was retired.", "authority_retired", !0);
|
|
9433
9433
|
if (!c) throw new Ze("Pluno token provider did not return a token", !1);
|
|
9434
|
-
if (n && c === s) throw new
|
|
9434
|
+
if (n && c === s) throw new T("Credential did not change.", "unauthorized", !1);
|
|
9435
9435
|
this.directoryHttp.auth.token = c, a = "bootstrap", this.lastRecoveryStage = a, await this.replaceDefaultTransportCredentials(e), this.reportTransportDiagnostic("auth_refresh_validated", o);
|
|
9436
9436
|
})().catch((c) => {
|
|
9437
9437
|
if (this.socket !== e || this.state.status === "closed") throw c;
|
|
9438
|
-
if (this.reportTransportDiagnostic("auth_refresh_failed", { ...o, ...this.connectionFailureDiagnostic(c, a) }), this.credentialRecoveryFailure = Si(c), c instanceof
|
|
9439
|
-
const l = c instanceof
|
|
9438
|
+
if (this.reportTransportDiagnostic("auth_refresh_failed", { ...o, ...this.connectionFailureDiagnostic(c, a) }), this.credentialRecoveryFailure = Si(c), c instanceof T && ["unauthorized", "403", "update_required"].includes(c.code) || !er(c)) {
|
|
9439
|
+
const l = c instanceof T ? c : new T(c instanceof Ze ? c.message : "Your session could not be refreshed. Try again.", this.options.productVariant === "customer_embedded" ? "connection_failed" : "unauthorized", !1);
|
|
9440
9440
|
throw this.stopAuthentication(l), l;
|
|
9441
9441
|
}
|
|
9442
9442
|
throw this.options.productVariant === "customer_embedded" && this.setState({ status: "reconnecting", lastError: sl, lastErrorCode: "connection_failed" }), this.scheduleReconnect(), c;
|
|
@@ -10068,59 +10068,59 @@ function pm(t, e) {
|
|
|
10068
10068
|
const E = v.getAttribute("data-testid") || v.getAttribute("data-test") || v.getAttribute("data-qa") || v.getAttribute("data-cy") || "";
|
|
10069
10069
|
return `${v.tagName.toLowerCase()}|${m(v)}|${E}`;
|
|
10070
10070
|
}, w = (v, E, L) => {
|
|
10071
|
-
const K = (U,
|
|
10072
|
-
const G = U.tagName.toLowerCase(),
|
|
10073
|
-
if (g >= 1e3 && !
|
|
10071
|
+
const K = (U, he) => {
|
|
10072
|
+
const G = U.tagName.toLowerCase(), oe = window.getComputedStyle(U), R = p.has(U);
|
|
10073
|
+
if (g >= 1e3 && !R || L.has(U) || o.has(G) || U.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || oe.display === "none" || oe.visibility === "hidden")
|
|
10074
10074
|
return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
|
|
10075
10075
|
g += 1;
|
|
10076
|
-
const
|
|
10077
|
-
for (const W of
|
|
10076
|
+
const V = m(U), O = Fd(U), S = r.has(V) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(G) || G === "a" && U.hasAttribute("href"), F = Array.from(U.children).filter((W) => W instanceof HTMLElement), ee = /* @__PURE__ */ new Map();
|
|
10077
|
+
for (const W of F) {
|
|
10078
10078
|
const q = f(W);
|
|
10079
|
-
|
|
10079
|
+
ee.set(q, (ee.get(q) ?? 0) + 1);
|
|
10080
10080
|
}
|
|
10081
|
-
const ce = /* @__PURE__ */ new Map(),
|
|
10082
|
-
for (const W of
|
|
10083
|
-
const q = f(W), le =
|
|
10084
|
-
|
|
10081
|
+
const ce = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ new Map();
|
|
10082
|
+
for (const W of F) {
|
|
10083
|
+
const q = f(W), le = te.get(q) ?? 0;
|
|
10084
|
+
te.set(q, le + 1), (ee.get(q) ?? 0) > 8 && le >= 6 && !p.has(W) && ce.set(q, (ce.get(q) ?? 0) + 1);
|
|
10085
10085
|
}
|
|
10086
|
-
const Se = /* @__PURE__ */ new Map(),
|
|
10087
|
-
for (const W of
|
|
10088
|
-
const q = f(W), le =
|
|
10086
|
+
const Se = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Set(), fe = [], Oe = [];
|
|
10087
|
+
for (const W of F) {
|
|
10088
|
+
const q = f(W), le = ee.get(q) ?? 0, me = Se.get(q) ?? 0;
|
|
10089
10089
|
if (Se.set(q, me + 1), le > 8 && me >= 6 && !p.has(W)) {
|
|
10090
|
-
|
|
10090
|
+
P.has(q) || (fe.push([`… ${ce.get(q) ?? 0} similar siblings omitted`]), P.add(q));
|
|
10091
10091
|
continue;
|
|
10092
10092
|
}
|
|
10093
|
-
const ke = K(W,
|
|
10093
|
+
const ke = K(W, he);
|
|
10094
10094
|
Oe.push(ke), fe.push(ke.lines);
|
|
10095
10095
|
}
|
|
10096
10096
|
const et = [];
|
|
10097
10097
|
if (U.shadowRoot)
|
|
10098
10098
|
for (const W of Array.from(U.shadowRoot.children))
|
|
10099
|
-
W instanceof HTMLElement && et.push(K(W,
|
|
10100
|
-
const Ce = [...Oe, ...et], $e =
|
|
10101
|
-
[
|
|
10102
|
-
).slice(0, 180), tt = U.hasAttribute("contenteditable") && (
|
|
10103
|
-
if (
|
|
10104
|
-
const W = Ce.some((le) => le.containsTextElement), q = i.has(G) && !W ?
|
|
10105
|
-
|
|
10099
|
+
W instanceof HTMLElement && et.push(K(W, he + 1));
|
|
10100
|
+
const Ce = [...Oe, ...et], $e = O.length > 0 || S || Ce.some((W) => W.hasUsefulContent), J = Yn(
|
|
10101
|
+
[O, ...Ce.map((W) => W.textPreview)].filter(Boolean).join(" ")
|
|
10102
|
+
).slice(0, 180), tt = U.hasAttribute("contenteditable") && (O.length > 0 || !U.querySelector("[contenteditable]")), z = l.some((W) => U.hasAttribute(W)) || !!V || tt, Y = (U.getClientRects().length > 0 || oe.display === "contents") && (n.has(G) || z || R) && ($e || R) && (!s.has(G) || $e || z || R), H = Y ? 1 : 0, ie = [];
|
|
10103
|
+
if (Y) {
|
|
10104
|
+
const W = Ce.some((le) => le.containsTextElement), q = i.has(G) && !W ? J : O;
|
|
10105
|
+
ie.push($d(U, c, a, q.slice(0, 180)));
|
|
10106
10106
|
}
|
|
10107
10107
|
for (const W of fe)
|
|
10108
|
-
|
|
10108
|
+
ie.push(...us(W, H));
|
|
10109
10109
|
const ve = et.flatMap((W) => W.lines);
|
|
10110
10110
|
if (ve.length > 0) {
|
|
10111
10111
|
const W = ve.slice(0, 20);
|
|
10112
10112
|
ve.length > W.length && W.push("… shadow DOM omitted");
|
|
10113
10113
|
const q = G.includes("tooltip") || G.includes("popper") || G.includes("loader");
|
|
10114
|
-
if (
|
|
10115
|
-
const le =
|
|
10116
|
-
|
|
10114
|
+
if (he < 2 && !q) {
|
|
10115
|
+
const le = Y ? "#shadow-root" : `${G} #shadow-root`;
|
|
10116
|
+
ie.push(...us([le, ...us(W, 1)], H));
|
|
10117
10117
|
} else
|
|
10118
|
-
|
|
10118
|
+
ie.push(...us(W, H));
|
|
10119
10119
|
}
|
|
10120
10120
|
return {
|
|
10121
|
-
lines:
|
|
10121
|
+
lines: ie,
|
|
10122
10122
|
hasUsefulContent: $e,
|
|
10123
|
-
textPreview:
|
|
10123
|
+
textPreview: J,
|
|
10124
10124
|
containsTextElement: i.has(G) || Ce.some((W) => W.containsTextElement)
|
|
10125
10125
|
};
|
|
10126
10126
|
};
|
|
@@ -11277,64 +11277,64 @@ function Ty(t, e, n, i) {
|
|
|
11277
11277
|
const b = e.ownerDocument.defaultView;
|
|
11278
11278
|
let _, v = /* @__PURE__ */ new Map(), E = d.sessionId;
|
|
11279
11279
|
const L = /* @__PURE__ */ new Set(), K = /* @__PURE__ */ new Map();
|
|
11280
|
-
let U = null,
|
|
11280
|
+
let U = null, he = null, G = null, oe = 0, R = null, V = null, O = null;
|
|
11281
11281
|
const S = () => JSON.stringify([
|
|
11282
11282
|
d.sessionId,
|
|
11283
11283
|
d.assistantDraftRespondsToUserMessageId,
|
|
11284
11284
|
Array.from(e.querySelectorAll('[data-message-role="user"]')).slice(-1)[0]?.dataset.messageKey,
|
|
11285
11285
|
Array.from(e.querySelectorAll('[data-message-role="user"]')).slice(-1)[0]?.dataset.entryKey
|
|
11286
|
-
]),
|
|
11287
|
-
const
|
|
11288
|
-
return z.getClientRects().length > 0 &&
|
|
11286
|
+
]), F = (z) => {
|
|
11287
|
+
const Y = b.getComputedStyle(z);
|
|
11288
|
+
return z.getClientRects().length > 0 && Y.visibility !== "hidden" && Y.opacity !== "0" && Y.pointerEvents !== "none" && !z.matches(":disabled") && z.getAttribute("aria-disabled") !== "true" && !z.closest("[inert]");
|
|
11289
11289
|
};
|
|
11290
|
-
function
|
|
11291
|
-
|
|
11290
|
+
function ee() {
|
|
11291
|
+
he !== null && b.clearTimeout(he), he = null, G = null;
|
|
11292
11292
|
}
|
|
11293
11293
|
function ce(z = !1) {
|
|
11294
|
-
|
|
11294
|
+
ee(), V = null, O !== null && b.clearTimeout(O), O = null, _ = void 0, v.clear(), K.clear(), U !== null && b.clearTimeout(U), U = null, z && L.clear();
|
|
11295
11295
|
}
|
|
11296
|
-
function
|
|
11297
|
-
const z = e.querySelector(".pluno-pa-widget__panel") ?? e,
|
|
11298
|
-
if (d.isLoadingSession || e.ownerDocument.hidden || !z.getClientRects().length ||
|
|
11296
|
+
function te() {
|
|
11297
|
+
const z = e.querySelector(".pluno-pa-widget__panel") ?? e, Y = b.getComputedStyle(z);
|
|
11298
|
+
if (d.isLoadingSession || e.ownerDocument.hidden || !z.getClientRects().length || Y.visibility === "hidden" || Y.display === "none" || Y.opacity === "0") {
|
|
11299
11299
|
ce();
|
|
11300
11300
|
return;
|
|
11301
11301
|
}
|
|
11302
|
-
const H = (
|
|
11303
|
-
for (const
|
|
11304
|
-
const
|
|
11305
|
-
!
|
|
11302
|
+
const H = (M, Q) => Array.from(e.querySelectorAll(M)).flatMap((de) => de.getAttribute(Q) ? [de.getAttribute(Q)] : []), ie = ".pluno-pa-widget__tool-group--active, .tool-group--active, .pluno-pa-widget__thinking-marker, .thinking-marker, [data-thinking-status]", ve = [];
|
|
11303
|
+
for (const M of Array.from(e.querySelectorAll(`${ie}, [data-message-role="user"]`))) {
|
|
11304
|
+
const Q = b.getComputedStyle(M);
|
|
11305
|
+
!M.getClientRects().length || Q.visibility === "hidden" || Q.opacity === "0" || M.parentElement?.closest(ie) || ve.push(M.dataset.messageRole === "user" ? "user" : "thinking");
|
|
11306
11306
|
}
|
|
11307
11307
|
let W = 0;
|
|
11308
11308
|
if (ve.includes("thinking")) {
|
|
11309
|
-
const
|
|
11310
|
-
de !==
|
|
11309
|
+
const M = Array.from(e.querySelectorAll('[data-message-role="user"]')), Q = M[M.length - 1], de = Q?.dataset.messageKey ?? Q?.dataset.entryKey ?? null;
|
|
11310
|
+
de !== R && L.delete("thinking-without-progress"), R = de;
|
|
11311
11311
|
let C = 2166136261;
|
|
11312
11312
|
for (const N of Array.from(e.querySelectorAll(
|
|
11313
11313
|
"[data-message-key], [data-entry-key][data-message-role], [data-tool-call-key], [data-event-type]"
|
|
11314
11314
|
))) {
|
|
11315
11315
|
if (!N.getClientRects().length) continue;
|
|
11316
11316
|
const ye = N.hasAttribute("data-loading-text") || !!N.querySelector("[data-loading-text]"), Le = `${N.dataset.messageKey ?? N.dataset.entryKey ?? N.dataset.toolCallKey ?? ""}:${ye}:${N.textContent ?? ""}`;
|
|
11317
|
-
for (let
|
|
11318
|
-
C = Math.imul(C ^ Le.charCodeAt(
|
|
11317
|
+
for (let X = 0; X < Le.length; X += 1)
|
|
11318
|
+
C = Math.imul(C ^ Le.charCodeAt(X), 16777619) >>> 0;
|
|
11319
11319
|
}
|
|
11320
11320
|
const k = b.performance.now();
|
|
11321
|
-
C !== G && (G = C,
|
|
11321
|
+
C !== G && (G = C, oe = k), W = k - oe, he !== null && b.clearTimeout(he), he = W < 3e5 ? b.setTimeout(te, 3e5 - W) : null;
|
|
11322
11322
|
} else
|
|
11323
|
-
|
|
11324
|
-
const q = Array.from(e.querySelectorAll(".pluno-pa-widget__thinking-marker, .thinking-marker, [data-thinking-status]")).some((
|
|
11325
|
-
(!le ||
|
|
11323
|
+
ee(), L.delete("thinking-without-progress");
|
|
11324
|
+
const q = Array.from(e.querySelectorAll(".pluno-pa-widget__thinking-marker, .thinking-marker, [data-thinking-status]")).some((M) => M.getClientRects().length > 0 && b.getComputedStyle(M).visibility !== "hidden" && b.getComputedStyle(M).opacity !== "0"), le = d.isThinking || d.turnPhase != null || d.pendingMessageStatus != null || q;
|
|
11325
|
+
(!le || V && V.responseKey !== S()) && (V = null);
|
|
11326
11326
|
const me = {
|
|
11327
11327
|
executionKey: d.activity?.executionKey,
|
|
11328
11328
|
inProgress: le,
|
|
11329
|
-
hasComposerText: Array.from(e.querySelectorAll(".pluno-pa-widget__input, .composer textarea")).some((
|
|
11329
|
+
hasComposerText: Array.from(e.querySelectorAll(".pluno-pa-widget__input, .composer textarea")).some((M) => !!M.value.trim()),
|
|
11330
11330
|
hasComposerAttachment: !!e.querySelector(".pluno-pa-widget__attachments .pluno-pa-widget__attachment, .composer-attachments .composer-attachment"),
|
|
11331
11331
|
enabledStopControlCount: Array.from(e.querySelectorAll(
|
|
11332
11332
|
'button[aria-label="Stop"], button[aria-label="Stop generating"]'
|
|
11333
|
-
)).filter(
|
|
11334
|
-
stopPendingMs:
|
|
11333
|
+
)).filter(F).length,
|
|
11334
|
+
stopPendingMs: V ? b.performance.now() - V.at : 0,
|
|
11335
11335
|
thinkingSequence: ve,
|
|
11336
11336
|
thinkingIdleMs: W,
|
|
11337
|
-
messageKeys: Array.from(e.querySelectorAll("[data-message-key], [data-entry-key][data-message-role]")).flatMap((
|
|
11337
|
+
messageKeys: Array.from(e.querySelectorAll("[data-message-key], [data-entry-key][data-message-role]")).flatMap((M) => M.dataset.messageKey ?? M.dataset.entryKey ?? []),
|
|
11338
11338
|
canonicalItemKeys: H("[data-canonical-item-key]", "data-canonical-item-key"),
|
|
11339
11339
|
toolCallKeys: H("[data-tool-call-key]", "data-tool-call-key"),
|
|
11340
11340
|
attachmentKeys: H("[data-attachment-key]", "data-attachment-key"),
|
|
@@ -11344,31 +11344,31 @@ function Ty(t, e, n, i) {
|
|
|
11344
11344
|
visibleSessionIds: H("[data-session-id]", "data-session-id"),
|
|
11345
11345
|
welcome: !!e.querySelector(".pluno-pa-widget__empty-state--starter:not(.pluno-pa-widget__empty-state--morning-report), .empty-state--starter"),
|
|
11346
11346
|
runtimeItemCount: d.messages.filter(
|
|
11347
|
-
(
|
|
11347
|
+
(M) => (M.role === "user" || M.role === "assistant") && M.phase !== "commentary" && !M.scheduledCheckInAt && !M.id.startsWith("local-") && !M.id.startsWith("optimistic-user-message:")
|
|
11348
11348
|
).length
|
|
11349
11349
|
}, ke = _ ? {
|
|
11350
11350
|
..._,
|
|
11351
|
-
terminalResponseKeys: _.terminalResponseKeys.filter((
|
|
11352
|
-
const
|
|
11353
|
-
return !de || me.canonicalItemKeys.includes(
|
|
11351
|
+
terminalResponseKeys: _.terminalResponseKeys.filter((M) => {
|
|
11352
|
+
const Q = v.get(M), de = Q ? d.removedItems?.[Q] : void 0;
|
|
11353
|
+
return !de || me.canonicalItemKeys.includes(Q) || !me.canonicalItemKeys.includes(de);
|
|
11354
11354
|
})
|
|
11355
|
-
} : void 0, Fe = gf(me, ke), ht = new Set(Fe.map((
|
|
11356
|
-
for (const
|
|
11355
|
+
} : void 0, Fe = gf(me, ke), ht = new Set(Fe.map((M) => M.code));
|
|
11356
|
+
for (const M of K.keys()) ht.has(M) || K.delete(M);
|
|
11357
11357
|
const je = b.performance.now();
|
|
11358
|
-
for (const { code:
|
|
11359
|
-
if (L.has(
|
|
11360
|
-
const
|
|
11361
|
-
je -
|
|
11358
|
+
for (const { code: M } of Fe) {
|
|
11359
|
+
if (L.has(M)) continue;
|
|
11360
|
+
const Q = K.get(M) ?? je;
|
|
11361
|
+
je - Q >= 250 ? (L.add(M), K.delete(M), i.reportInvalidStateTransition?.(`ui_invariant:${M}`, void 0, dp(me, _))) : K.set(M, Q);
|
|
11362
11362
|
}
|
|
11363
|
-
Fe.length === 0 && (_ = me, v = new Map(Array.from(e.querySelectorAll("[data-terminal-response-key][data-canonical-item-key]")).map((
|
|
11364
|
-
U = null,
|
|
11363
|
+
Fe.length === 0 && (_ = me, v = new Map(Array.from(e.querySelectorAll("[data-terminal-response-key][data-canonical-item-key]")).map((M) => [M.dataset.terminalResponseKey, M.dataset.canonicalItemKey]))), U !== null && b.clearTimeout(U), U = K.size ? b.setTimeout(() => {
|
|
11364
|
+
U = null, te();
|
|
11365
11365
|
}, Math.max(1, 250 - (je - Math.min(...K.values())))) : null;
|
|
11366
11366
|
}
|
|
11367
|
-
function Se(z,
|
|
11368
|
-
const H = z !== "runtime",
|
|
11369
|
-
for (let
|
|
11370
|
-
const
|
|
11371
|
-
|
|
11367
|
+
function Se(z, Y = null) {
|
|
11368
|
+
const H = z !== "runtime", ie = H ? e.querySelectorAll("[data-message-key], [data-entry-key][data-message-role]") : null, ve = ie?.length ?? d.messages.length, W = [];
|
|
11369
|
+
for (let M = Math.max(0, ve - Il); M < ve; M += 1) {
|
|
11370
|
+
const Q = ie ? ie[M].dataset.messageKey ?? ie[M].dataset.entryKey : d.messages[M].id;
|
|
11371
|
+
Q && W.push(Q.slice(0, ar));
|
|
11372
11372
|
}
|
|
11373
11373
|
const q = {
|
|
11374
11374
|
session_id: d.sessionId?.slice(0, ar) ?? null,
|
|
@@ -11382,36 +11382,36 @@ function Ty(t, e, n, i) {
|
|
|
11382
11382
|
error: !!d.lastError,
|
|
11383
11383
|
connected: d.status === "connected",
|
|
11384
11384
|
visible: e.getClientRects().length > 0,
|
|
11385
|
-
output_length: H ? Array.from(
|
|
11385
|
+
output_length: H ? Array.from(ie ?? []).reduce((M, Q) => M + (Q.textContent?.length ?? 0), 0) : d.messages.reduce((M, Q) => M + Q.content.length, d.assistantDraft.length),
|
|
11386
11386
|
active_count: H ? e.querySelectorAll(".pluno-pa-widget__tool-group--active, .tool-group--active").length : Number(d.isThinking),
|
|
11387
11387
|
terminal_count: H ? e.querySelectorAll("[data-terminal-response-key]").length : 0
|
|
11388
11388
|
};
|
|
11389
11389
|
if (z === "paint" && i.reportResponseVisibility) {
|
|
11390
|
-
const
|
|
11391
|
-
const
|
|
11392
|
-
return
|
|
11393
|
-
}, de =
|
|
11390
|
+
const M = e.querySelector(".pluno-pa-widget__panel") ?? e, Q = (B) => {
|
|
11391
|
+
const Z = b.getComputedStyle(B);
|
|
11392
|
+
return B.getClientRects().length > 0 && Z.visibility !== "hidden" && Z.display !== "none" && Z.opacity !== "0";
|
|
11393
|
+
}, de = Q(M) && Q(e), C = !e.ownerDocument.hidden, k = new Set(Array.from(e.querySelectorAll("[data-canonical-item-key]")).filter(Q).map((B) => B.dataset.canonicalItemKey)), N = de && C && !d.isLoadingSession ? [...d.messages].reverse().find((B) => (B.role === "assistant" || B.dataType === "commentary_history" || B.dataType === "tool_summary") && k.has(B.id)) : void 0, ye = de && C && !d.isLoadingSession && !!d.assistantDraft.trim() && Array.from(e.querySelectorAll("[data-message-key], [data-entry-key]")).some((B) => Q(B) && (B.dataset.messageKey === `assistant:${d.assistantDraftItemId}` || B.dataset.entryKey === d.assistantDraftItemId)), Le = {
|
|
11394
11394
|
sessionId: d.sessionId,
|
|
11395
11395
|
responseItemId: ye ? d.assistantDraftItemId : N?.id ?? null,
|
|
11396
11396
|
respondsToUserMessageId: ye ? d.assistantDraftRespondsToUserMessageId : N?.respondsToUserMessageId ?? null,
|
|
11397
11397
|
panelVisible: de,
|
|
11398
11398
|
documentVisible: C,
|
|
11399
11399
|
loading: d.isLoadingSession
|
|
11400
|
-
},
|
|
11401
|
-
|
|
11400
|
+
}, X = JSON.stringify(Le);
|
|
11401
|
+
X !== w && (w = X, i.reportResponseVisibility({ ...Le, observedAt: (/* @__PURE__ */ new Date()).toISOString() }));
|
|
11402
11402
|
}
|
|
11403
|
-
const le = [...d.messages].reverse().find((
|
|
11403
|
+
const le = [...d.messages].reverse().find((M) => M.role === "user" && (!d.activeResponseUserMessageId || M.id === d.activeResponseUserMessageId)), me = d.activity?.phase === "submitting" || d.turnPhase === "sending" || d.pendingMessageStatus === "sending", ke = d.activity?.phase === "stopping";
|
|
11404
11404
|
if (le && i.reportOperationTiming) {
|
|
11405
|
-
const
|
|
11406
|
-
(me || ke) && !s.has(
|
|
11407
|
-
operation:
|
|
11405
|
+
const M = ke || d.activity?.phase === "stopped" ? "stop" : "send", Q = `${M}:${le.id}`;
|
|
11406
|
+
(me || ke) && !s.has(Q) && (s.set(Q, { timer: Rt((k) => i.reportOperationTiming?.(k), {
|
|
11407
|
+
operation: M,
|
|
11408
11408
|
layer: "renderer",
|
|
11409
11409
|
entrySurface: n,
|
|
11410
11410
|
requestId: crypto.randomUUID(),
|
|
11411
11411
|
clientMessageId: le.id,
|
|
11412
11412
|
sessionId: d.sessionId
|
|
11413
11413
|
}), seen: /* @__PURE__ */ new Set() }), s.size > 20 && s.delete(s.keys().next().value));
|
|
11414
|
-
const de = s.get(
|
|
11414
|
+
const de = s.get(Q), C = (k) => {
|
|
11415
11415
|
!de || de.seen.has(k) || (de.seen.add(k), de.timer.mark(k));
|
|
11416
11416
|
};
|
|
11417
11417
|
if (z === "runtime" && C(ke ? "runtime_stopping" : d.activity?.phase === "stopped" ? "runtime_stopped" : me ? "runtime_reading" : "runtime_progress"), z === "paint" && !e.ownerDocument.hidden && q.visible && !q.loading && Array.from(e.querySelectorAll('[data-message-role="user"]')).some((N) => (N.dataset.canonicalItemKey === le.id || N.dataset.entryKey === le.id || N.dataset.messageKey === `user:${le.id}`) && N.getClientRects().length > 0)) {
|
|
@@ -11428,20 +11428,20 @@ function Ty(t, e, n, i) {
|
|
|
11428
11428
|
occurred_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11429
11429
|
monotonic_ms: Math.round(b.performance.now()),
|
|
11430
11430
|
kind: z,
|
|
11431
|
-
action:
|
|
11431
|
+
action: Y,
|
|
11432
11432
|
...q
|
|
11433
11433
|
}, je = new TextEncoder().encode(JSON.stringify(ht)).length;
|
|
11434
11434
|
for (o.push(ht), a.push(je), r += je; o.length > Ay || r > Ry; )
|
|
11435
11435
|
o.shift(), r -= a.shift(), c += 1;
|
|
11436
11436
|
}
|
|
11437
|
-
function
|
|
11437
|
+
function P() {
|
|
11438
11438
|
g === null && (g = b.requestAnimationFrame(() => {
|
|
11439
|
-
g = null, Se("paint"),
|
|
11439
|
+
g = null, Se("paint"), te();
|
|
11440
11440
|
}));
|
|
11441
11441
|
}
|
|
11442
11442
|
const fe = i.on("state", (z) => {
|
|
11443
|
-
z.user?.id !== h || z.sessionId !== E ? (ce(!0), E = z.sessionId) : z.isLoadingSession && ce(), z.user?.id !== h && (s.clear(), o.length = 0, a.length = 0, r = 0, c = 0, l = 0, p = crypto.randomUUID(), m = "", f = "", w = "", h = z.user?.id), d = z, e.dataset.executionKey = d.activity?.executionKey ?? "", Se("runtime"),
|
|
11444
|
-
}), Oe = new MutationObserver(
|
|
11443
|
+
z.user?.id !== h || z.sessionId !== E ? (ce(!0), E = z.sessionId) : z.isLoadingSession && ce(), z.user?.id !== h && (s.clear(), o.length = 0, a.length = 0, r = 0, c = 0, l = 0, p = crypto.randomUUID(), m = "", f = "", w = "", h = z.user?.id), d = z, e.dataset.executionKey = d.activity?.executionKey ?? "", Se("runtime"), P();
|
|
11444
|
+
}), Oe = new MutationObserver(P);
|
|
11445
11445
|
Oe.observe(e, {
|
|
11446
11446
|
subtree: !0,
|
|
11447
11447
|
childList: !0,
|
|
@@ -11450,14 +11450,14 @@ function Ty(t, e, n, i) {
|
|
|
11450
11450
|
attributeFilter: ["disabled", "aria-disabled", "aria-label", "inert", "class", "style", "hidden", "data-loading-text", "data-message-key", "data-entry-key", "data-terminal-response-key", "data-active-response-key", "data-canonical-item-key", "data-tool-call-key", "data-attachment-key", "data-session-id", "data-response-group-key"]
|
|
11451
11451
|
});
|
|
11452
11452
|
const et = (z) => {
|
|
11453
|
-
const
|
|
11454
|
-
Se("click",
|
|
11453
|
+
const Y = z.target?.closest?.("button"), H = Y?.getAttribute("aria-label") ?? Y?.getAttribute("title"), ie = H === "New chat" ? "new_chat" : H === "Send" || H === "Send message" ? "send" : H === "Stop" || H === "Stop generating" ? "stop" : H === "Retry" || H === "Retry message" ? "retry" : null;
|
|
11454
|
+
Se("click", ie), ie === "stop" && Y && F(Y) && (V = { at: b.performance.now(), responseKey: S() }, O !== null && b.clearTimeout(O), O = b.setTimeout(te, 1e3)), ie === "new_chat" && ce(!0);
|
|
11455
11455
|
}, Ce = () => Se("submit"), $e = () => Se("focus");
|
|
11456
|
-
e.addEventListener("click", et, !0), e.addEventListener("submit", Ce, !0), e.addEventListener("focusin", $e, !0), e.addEventListener("input",
|
|
11457
|
-
const
|
|
11458
|
-
Se("paint"),
|
|
11456
|
+
e.addEventListener("click", et, !0), e.addEventListener("submit", Ce, !0), e.addEventListener("focusin", $e, !0), e.addEventListener("input", P, !0);
|
|
11457
|
+
const J = () => {
|
|
11458
|
+
Se("paint"), P();
|
|
11459
11459
|
};
|
|
11460
|
-
e.ownerDocument.addEventListener("visibilitychange",
|
|
11460
|
+
e.ownerDocument.addEventListener("visibilitychange", J);
|
|
11461
11461
|
const tt = {
|
|
11462
11462
|
snapshot: () => ({
|
|
11463
11463
|
schema_version: 1,
|
|
@@ -11468,10 +11468,10 @@ function Ty(t, e, n, i) {
|
|
|
11468
11468
|
records: o.map((z) => ({ ...z, item_keys: [...z.item_keys] }))
|
|
11469
11469
|
}),
|
|
11470
11470
|
dispose: () => {
|
|
11471
|
-
fe(), Oe.disconnect(), ce(!0), g !== null && b.cancelAnimationFrame(g), e.removeEventListener("click", et, !0), e.removeEventListener("submit", Ce, !0), e.removeEventListener("focusin", $e, !0), e.removeEventListener("input",
|
|
11471
|
+
fe(), Oe.disconnect(), ce(!0), g !== null && b.cancelAnimationFrame(g), e.removeEventListener("click", et, !0), e.removeEventListener("submit", Ce, !0), e.removeEventListener("focusin", $e, !0), e.removeEventListener("input", P, !0), e.ownerDocument.removeEventListener("visibilitychange", J), t.__plunoUiFlightRecorder === tt && delete t.__plunoUiFlightRecorder;
|
|
11472
11472
|
}
|
|
11473
11473
|
};
|
|
11474
|
-
return t.__plunoUiFlightRecorder = tt, Se("runtime"),
|
|
11474
|
+
return t.__plunoUiFlightRecorder = tt, Se("runtime"), P(), tt;
|
|
11475
11475
|
}
|
|
11476
11476
|
const Py = 6e4, My = [100, 500, 1500, 4e3];
|
|
11477
11477
|
let qy = 0;
|
|
@@ -11661,27 +11661,27 @@ async function lw(t = {}) {
|
|
|
11661
11661
|
".pluno-pa-widget__status--launcher"
|
|
11662
11662
|
), K = r.querySelector(
|
|
11663
11663
|
".pluno-pa-widget__launcher-minimize"
|
|
11664
|
-
), U = r.querySelector(".pluno-pa-widget__panel"),
|
|
11664
|
+
), U = r.querySelector(".pluno-pa-widget__panel"), he = r.querySelector(
|
|
11665
11665
|
".pluno-pa-widget__panel-drag-handle"
|
|
11666
11666
|
), G = r.querySelector(
|
|
11667
11667
|
".pluno-pa-widget__scribble-spirals--panel"
|
|
11668
|
-
),
|
|
11668
|
+
), oe = Array.from(
|
|
11669
11669
|
r.querySelectorAll(".pluno-pa-widget__resize-handle")
|
|
11670
|
-
),
|
|
11670
|
+
), R = r.querySelector(
|
|
11671
11671
|
".pluno-pa-widget__close"
|
|
11672
|
-
),
|
|
11672
|
+
), V = r.querySelector(
|
|
11673
11673
|
".pluno-pa-widget__composer"
|
|
11674
|
-
),
|
|
11674
|
+
), O = r.querySelector(
|
|
11675
11675
|
".pluno-pa-widget__attachment-error"
|
|
11676
11676
|
), S = r.querySelector(
|
|
11677
11677
|
".pluno-pa-widget__billing-status"
|
|
11678
|
-
),
|
|
11678
|
+
), F = r.querySelector(".pluno-pa-widget__access-notice"), ee = r.querySelector(".pluno-pa-widget__connection-notice"), ce = r.querySelector(
|
|
11679
11679
|
".pluno-pa-widget__attachments"
|
|
11680
|
-
),
|
|
11680
|
+
), te = r.querySelector(
|
|
11681
11681
|
".pluno-pa-widget__attachment-input"
|
|
11682
11682
|
), Se = r.querySelector(
|
|
11683
11683
|
".pluno-pa-widget__attach"
|
|
11684
|
-
),
|
|
11684
|
+
), P = r.querySelector(
|
|
11685
11685
|
".pluno-pa-widget__input"
|
|
11686
11686
|
), fe = r.querySelector(
|
|
11687
11687
|
".pluno-pa-widget__model-picker"
|
|
@@ -11693,17 +11693,17 @@ async function lw(t = {}) {
|
|
|
11693
11693
|
".pluno-pa-widget__send"
|
|
11694
11694
|
), $e = r.querySelector(
|
|
11695
11695
|
".pluno-pa-widget__top-actions"
|
|
11696
|
-
),
|
|
11696
|
+
), J = r.querySelector(
|
|
11697
11697
|
".pluno-pa-widget__history"
|
|
11698
11698
|
), tt = r.querySelector(
|
|
11699
11699
|
".pluno-pa-widget__history-panel"
|
|
11700
11700
|
), z = r.querySelector(
|
|
11701
11701
|
".pluno-pa-widget__history-list"
|
|
11702
|
-
),
|
|
11702
|
+
), Y = r.querySelector(
|
|
11703
11703
|
".pluno-pa-widget__history-close"
|
|
11704
11704
|
), H = r.querySelector(
|
|
11705
11705
|
".pluno-pa-widget__history-status"
|
|
11706
|
-
),
|
|
11706
|
+
), ie = r.querySelector(".pluno-pa-widget__history-retry"), ve = r.querySelector(
|
|
11707
11707
|
".pluno-pa-widget__timeline-jump"
|
|
11708
11708
|
), W = r.querySelector(
|
|
11709
11709
|
".pluno-pa-widget__active-users-counter"
|
|
@@ -11721,9 +11721,9 @@ async function lw(t = {}) {
|
|
|
11721
11721
|
".pluno-pa-widget__notify-suggestion-later"
|
|
11722
11722
|
), je = r.querySelector(
|
|
11723
11723
|
".pluno-pa-widget__notify-suggestion-never"
|
|
11724
|
-
),
|
|
11724
|
+
), M = r.querySelector(
|
|
11725
11725
|
".pluno-pa-widget__tab-groups-suggestion"
|
|
11726
|
-
),
|
|
11726
|
+
), Q = M?.querySelector(
|
|
11727
11727
|
".pluno-pa-widget__notify-suggestion-label"
|
|
11728
11728
|
), de = r.querySelector(
|
|
11729
11729
|
".pluno-pa-widget__tab-groups-suggestion-enable"
|
|
@@ -11737,11 +11737,11 @@ async function lw(t = {}) {
|
|
|
11737
11737
|
".pluno-pa-widget__proactive-suggestion-run"
|
|
11738
11738
|
), Le = r.querySelector(
|
|
11739
11739
|
".pluno-pa-widget__proactive-suggestion-edit"
|
|
11740
|
-
),
|
|
11740
|
+
), X = r.querySelector(
|
|
11741
11741
|
".pluno-pa-widget__proactive-suggestion-dismiss"
|
|
11742
|
-
),
|
|
11742
|
+
), B = r.querySelector(
|
|
11743
11743
|
".pluno-pa-widget__proactive-suggestion-close"
|
|
11744
|
-
),
|
|
11744
|
+
), Z = r.querySelector(
|
|
11745
11745
|
".pluno-pa-widget__proactive-suggestion-never-show"
|
|
11746
11746
|
), ae = r.querySelector(
|
|
11747
11747
|
".pluno-pa-widget__proactive-suggestion-actions"
|
|
@@ -11754,11 +11754,11 @@ async function lw(t = {}) {
|
|
|
11754
11754
|
), zi = r.querySelector(
|
|
11755
11755
|
".pluno-pa-widget__proactive-suggestion-feedback-status"
|
|
11756
11756
|
);
|
|
11757
|
-
if (!_ || !E || !U || !
|
|
11757
|
+
if (!_ || !E || !U || !R || !V || !O || !S || !ce || !te || !Se || !P || !fe || !Oe || !Ce || !$e || !J || !tt || !z || !Y || !H || !ie || !ve || !W || !q || !le)
|
|
11758
11758
|
throw new Error("Failed to mount Pluno widget");
|
|
11759
11759
|
if (e.movableLauncher && !v)
|
|
11760
11760
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
11761
|
-
if (e.movableLauncher && !
|
|
11761
|
+
if (e.movableLauncher && !he)
|
|
11762
11762
|
throw new Error("Failed to mount Pluno widget panel drag handle");
|
|
11763
11763
|
let Xs = !1, Vt = null, gn = !1, Nn = null, He = "idle";
|
|
11764
11764
|
const Bi = () => {
|
|
@@ -11778,10 +11778,10 @@ async function lw(t = {}) {
|
|
|
11778
11778
|
return;
|
|
11779
11779
|
const u = e.proactiveSuggestion ?? Vt, y = u !== null && !A.getState().isThinking, I = U.querySelector(
|
|
11780
11780
|
".pluno-pa-widget__proactive-suggestion-slot"
|
|
11781
|
-
), x = !U.hidden && !r.classList.contains("pluno-pa-widget--closing"),
|
|
11782
|
-
|
|
11781
|
+
), x = !U.hidden && !r.classList.contains("pluno-pa-widget--closing"), D = y && x && I !== null;
|
|
11782
|
+
D ? k.parentElement !== I && I.appendChild(k) : k.parentElement !== r && r.insertBefore(k, R), k.hidden = !y, r.classList.toggle("pluno-pa-widget--proactive-suggestion", y), r.classList.toggle(
|
|
11783
11783
|
"pluno-pa-widget--proactive-suggestion-in-panel",
|
|
11784
|
-
|
|
11784
|
+
D
|
|
11785
11785
|
), N.textContent = u?.question ?? "", ae.hidden = e.proactiveSuggestion === null || gn, hn.hidden = Vt === null;
|
|
11786
11786
|
const re = He === "success";
|
|
11787
11787
|
we.hidden = re, Qn.hidden = re, Qn.disabled = He === "submitting" || we.value.trim().length === 0, Qn.textContent = He === "submitting" ? "Sending…" : "Send feedback", zi.textContent = He === "success" ? "Thanks — this helps improve your suggestions." : He === "error" ? "Couldn’t send feedback. Please try again." : "Tell Pluno what made this suggestion miss the mark.", zi.classList.toggle(
|
|
@@ -11807,7 +11807,7 @@ async function lw(t = {}) {
|
|
|
11807
11807
|
}
|
|
11808
11808
|
);
|
|
11809
11809
|
};
|
|
11810
|
-
Se.hidden = !e.attachmentsEnabled,
|
|
11810
|
+
Se.hidden = !e.attachmentsEnabled, te.disabled = !e.attachmentsEnabled, te.accept = e.productVariant === "personal" ? "" : Df, $l(E), $l(P);
|
|
11811
11811
|
let nt = [];
|
|
11812
11812
|
const Zn = /* @__PURE__ */ new Map(), Ea = () => {
|
|
11813
11813
|
for (const u of Zn.values()) URL.revokeObjectURL?.(u);
|
|
@@ -11816,9 +11816,9 @@ async function lw(t = {}) {
|
|
|
11816
11816
|
let ft = 0, Gt = 0, Ca = 0;
|
|
11817
11817
|
const St = /* @__PURE__ */ new Map();
|
|
11818
11818
|
let Jt = null, Dt = null;
|
|
11819
|
-
const eo = (u) => u ===
|
|
11820
|
-
const x = ps(b),
|
|
11821
|
-
|
|
11819
|
+
const eo = (u) => u === P ? "widget_composer" : u === E ? "widget_launcher" : u && a.contains(u) ? "widget_control" : u === b.body ? "body" : u === b.documentElement ? "document" : u ? "host_page" : "none", fn = (u, y, I = {}) => {
|
|
11820
|
+
const x = ps(b), D = I.skipIfAlreadyFocused === !0 && x === u;
|
|
11821
|
+
D || (I.preventScroll ? u.focus({ preventScroll: !0 }) : u.focus());
|
|
11822
11822
|
const re = ps(b);
|
|
11823
11823
|
return Xe(
|
|
11824
11824
|
"web-sdk.widget.focus",
|
|
@@ -11831,7 +11831,7 @@ async function lw(t = {}) {
|
|
|
11831
11831
|
previousFocus: eo(x),
|
|
11832
11832
|
requestedFocus: eo(u),
|
|
11833
11833
|
resultingFocus: eo(re),
|
|
11834
|
-
focusSkipped:
|
|
11834
|
+
focusSkipped: D,
|
|
11835
11835
|
focusSucceeded: re === u,
|
|
11836
11836
|
hostConnected: o.isConnected,
|
|
11837
11837
|
panelOpen: r.classList.contains("pluno-pa-widget--open"),
|
|
@@ -11840,8 +11840,8 @@ async function lw(t = {}) {
|
|
|
11840
11840
|
hasSession: !!A.getState().sessionId,
|
|
11841
11841
|
isThinking: A.getState().isThinking
|
|
11842
11842
|
}
|
|
11843
|
-
), !
|
|
11844
|
-
}, Yt = (u) => !
|
|
11843
|
+
), !D && re === u;
|
|
11844
|
+
}, Yt = (u) => !P.isConnected || P.disabled || P.readOnly || !r.classList.contains("pluno-pa-widget--open") || e.loginRequired || e.signupRequired || Fn(e.billingStatus) ? !1 : fn(P, u, {
|
|
11845
11845
|
preventScroll: !0,
|
|
11846
11846
|
skipIfAlreadyFocused: !0
|
|
11847
11847
|
}), ei = () => {
|
|
@@ -11992,7 +11992,7 @@ async function lw(t = {}) {
|
|
|
11992
11992
|
};
|
|
11993
11993
|
Lt = () => {
|
|
11994
11994
|
const u = fp(We.data), y = We.status === "loading" || We.status === "refreshing" || We.status === "loading_more";
|
|
11995
|
-
if (
|
|
11995
|
+
if (J.hidden = e.layout === "page" || e.loginRequired || e.signupRequired, (e.loginRequired || e.signupRequired) && (Ke = !1), tt.hidden = !Ke, J.setAttribute("aria-expanded", String(Ke)), !Ke) {
|
|
11996
11996
|
oo = "";
|
|
11997
11997
|
return;
|
|
11998
11998
|
}
|
|
@@ -12011,27 +12011,27 @@ async function lw(t = {}) {
|
|
|
12011
12011
|
x.className = "pluno-pa-widget__history-loading", x.textContent = "Loading...", z.appendChild(x);
|
|
12012
12012
|
}
|
|
12013
12013
|
for (const x of u) {
|
|
12014
|
-
const
|
|
12015
|
-
|
|
12014
|
+
const D = document.createElement("button");
|
|
12015
|
+
D.type = "button", D.className = "pluno-pa-widget__history-item";
|
|
12016
12016
|
const re = x.id === A.getState().sessionId;
|
|
12017
|
-
|
|
12017
|
+
D.disabled = re, re && D.setAttribute("aria-current", "page");
|
|
12018
12018
|
const Re = document.createElement("span");
|
|
12019
|
-
Re.className = "pluno-pa-widget__history-item-title", Re.textContent = Ll(x),
|
|
12019
|
+
Re.className = "pluno-pa-widget__history-item-title", Re.textContent = Ll(x), D.setAttribute("aria-label", Ll(x));
|
|
12020
12020
|
const Ie = document.createElement("time");
|
|
12021
12021
|
Ie.className = "pluno-pa-widget__history-time", Ie.dateTime = x.lastActiveAt, Ie.textContent = Nl(
|
|
12022
12022
|
x.lastActiveAt,
|
|
12023
12023
|
Date.now()
|
|
12024
12024
|
);
|
|
12025
12025
|
const _t = document.createElement("small");
|
|
12026
|
-
_t.className = "pluno-pa-widget__history-path", _t.textContent = Rw(x),
|
|
12026
|
+
_t.className = "pluno-pa-widget__history-path", _t.textContent = Rw(x), D.append(Re, Ie, _t), D.addEventListener("click", () => {
|
|
12027
12027
|
Ke = !1, Lt(), be = null, oi = !1, ji.clear(), st(!0, "newSession"), yt(), A.loadSession(x.id), di = null, _e(A.getState()), Yt("history_session_selected");
|
|
12028
|
-
}), z.appendChild(
|
|
12028
|
+
}), z.appendChild(D);
|
|
12029
12029
|
}
|
|
12030
12030
|
if (y && u.length > 0) {
|
|
12031
12031
|
const x = document.createElement("p");
|
|
12032
12032
|
x.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", x.textContent = "Loading...", z.appendChild(x);
|
|
12033
12033
|
}
|
|
12034
|
-
H.textContent = (We.status === "error" ? Wy : null) ?? (!y && u.length === 0 ? "No recent chats for this page yet." : ""), H.hidden = H.textContent.length === 0, H.classList.toggle("pluno-pa-widget__history-error", We.status === "error"),
|
|
12034
|
+
H.textContent = (We.status === "error" ? Wy : null) ?? (!y && u.length === 0 ? "No recent chats for this page yet." : ""), H.hidden = H.textContent.length === 0, H.classList.toggle("pluno-pa-widget__history-error", We.status === "error"), ie.hidden = We.status !== "error", ie.disabled = y;
|
|
12035
12035
|
}
|
|
12036
12036
|
};
|
|
12037
12037
|
const ro = (u = !1) => {
|
|
@@ -12041,9 +12041,9 @@ async function lw(t = {}) {
|
|
|
12041
12041
|
Xs = !1;
|
|
12042
12042
|
});
|
|
12043
12043
|
};
|
|
12044
|
-
|
|
12045
|
-
|
|
12046
|
-
|
|
12044
|
+
ie.addEventListener("click", () => {
|
|
12045
|
+
ie.disabled = !0, Promise.resolve(ro(!0)).finally(() => {
|
|
12046
|
+
ie.disabled = !1;
|
|
12047
12047
|
});
|
|
12048
12048
|
});
|
|
12049
12049
|
const ao = () => {
|
|
@@ -12074,7 +12074,7 @@ async function lw(t = {}) {
|
|
|
12074
12074
|
}, Ve = () => {
|
|
12075
12075
|
Fb(e, {
|
|
12076
12076
|
isOpen: r.classList.contains("pluno-pa-widget--open"),
|
|
12077
|
-
composerValue:
|
|
12077
|
+
composerValue: P.value,
|
|
12078
12078
|
openToolGroupKeys: [...no],
|
|
12079
12079
|
launcherPosition: h ? d : null,
|
|
12080
12080
|
panelSize: g
|
|
@@ -12087,7 +12087,7 @@ async function lw(t = {}) {
|
|
|
12087
12087
|
r.classList.remove("pluno-pa-widget--minimized"), _.removeAttribute("tabindex"), _.removeAttribute("role"), _.removeAttribute("aria-label"), !r.classList.contains("pluno-pa-widget--open") && !r.classList.contains("pluno-pa-widget--closing") && ci(!1), y && Vi("shown", I);
|
|
12088
12088
|
return;
|
|
12089
12089
|
}
|
|
12090
|
-
mt !== null && (window.clearTimeout(mt), mt = null), r.classList.remove("pluno-pa-widget--open"), r.classList.remove("pluno-pa-widget--closing"), r.classList.add("pluno-pa-widget--minimized"), _.hidden = !1, _.setAttribute("role", "button"), _.setAttribute("aria-label", "Open Pluno"), U.hidden = !0,
|
|
12090
|
+
mt !== null && (window.clearTimeout(mt), mt = null), r.classList.remove("pluno-pa-widget--open"), r.classList.remove("pluno-pa-widget--closing"), r.classList.add("pluno-pa-widget--minimized"), _.hidden = !1, _.setAttribute("role", "button"), _.setAttribute("aria-label", "Open Pluno"), U.hidden = !0, R.hidden = !0, _.tabIndex = 0, P.value = "", gt(), an(
|
|
12091
12091
|
r,
|
|
12092
12092
|
dr(
|
|
12093
12093
|
r,
|
|
@@ -12111,7 +12111,7 @@ async function lw(t = {}) {
|
|
|
12111
12111
|
panelRect: hr(U),
|
|
12112
12112
|
viewport: Je(),
|
|
12113
12113
|
panelHidden: U.hidden,
|
|
12114
|
-
closeHidden:
|
|
12114
|
+
closeHidden: R.hidden,
|
|
12115
12115
|
...y
|
|
12116
12116
|
});
|
|
12117
12117
|
}, ci = (u = !0) => {
|
|
@@ -12231,7 +12231,7 @@ async function lw(t = {}) {
|
|
|
12231
12231
|
const y = Tn(g), I = Ri(
|
|
12232
12232
|
u,
|
|
12233
12233
|
y
|
|
12234
|
-
), x = Di(r),
|
|
12234
|
+
), x = Di(r), D = Es(
|
|
12235
12235
|
r,
|
|
12236
12236
|
Sw(
|
|
12237
12237
|
I,
|
|
@@ -12242,19 +12242,19 @@ async function lw(t = {}) {
|
|
|
12242
12242
|
x
|
|
12243
12243
|
);
|
|
12244
12244
|
d = ur(
|
|
12245
|
-
|
|
12245
|
+
D,
|
|
12246
12246
|
x
|
|
12247
|
-
), h = !0, m = null, an(r,
|
|
12248
|
-
}, $u = e.movableLauncher &&
|
|
12247
|
+
), h = !0, m = null, an(r, D), Gi(I, D);
|
|
12248
|
+
}, $u = e.movableLauncher && he ? fw({
|
|
12249
12249
|
root: r,
|
|
12250
|
-
handle:
|
|
12250
|
+
handle: he,
|
|
12251
12251
|
getPosition: () => ja().position,
|
|
12252
12252
|
setPosition: Bu,
|
|
12253
12253
|
persist: Ve
|
|
12254
12254
|
}) : () => {
|
|
12255
|
-
}, Fu =
|
|
12255
|
+
}, Fu = oe.length > 0 ? mw({
|
|
12256
12256
|
root: r,
|
|
12257
|
-
handles:
|
|
12257
|
+
handles: oe,
|
|
12258
12258
|
getBounds: ja,
|
|
12259
12259
|
setBounds: zu,
|
|
12260
12260
|
persist: Ve
|
|
@@ -12266,7 +12266,7 @@ async function lw(t = {}) {
|
|
|
12266
12266
|
const _n = document.createElement("button");
|
|
12267
12267
|
_n.type = "button", _n.className = "pluno-pa-widget__error-retry";
|
|
12268
12268
|
const Ka = pn(), Ha = document.createTextNode("Try again");
|
|
12269
|
-
_n.append(Ka, Ha), li.append("Pluno could not load your account. Try again.", _n),
|
|
12269
|
+
_n.append(Ka, Ha), li.append("Pluno could not load your account. Try again.", _n), ee.after(bn);
|
|
12270
12270
|
let lo = !1, vn = !1;
|
|
12271
12271
|
const uo = () => {
|
|
12272
12272
|
bn.hidden = !lo || !!e.billingStatus || e.productVariant !== "personal" || Nt(), bn.hidden ? li.remove() : li.parentElement !== bn && bn.append(li), _n.disabled = vn, _n.setAttribute("aria-busy", String(vn)), Ka.hidden = !vn, Ha.data = vn ? "Trying" : "Try again";
|
|
@@ -12301,9 +12301,9 @@ async function lw(t = {}) {
|
|
|
12301
12301
|
An(x)
|
|
12302
12302
|
);
|
|
12303
12303
|
}));
|
|
12304
|
-
}, wt = (u = "", y = !0, I = !0, x = !0,
|
|
12304
|
+
}, wt = (u = "", y = !0, I = !0, x = !0, D = "external_request") => {
|
|
12305
12305
|
const re = r.classList.contains("pluno-pa-widget--open") || !U.hidden && !r.classList.contains("pluno-pa-widget--closing");
|
|
12306
|
-
!re && x && Wa("panel_open"), po(), hi && (hi = !1, vo()), r.classList.contains("pluno-pa-widget--open") || (m = null), mt !== null && (window.clearTimeout(mt), mt = null), ai("shown", !1), U.hidden = !1,
|
|
12306
|
+
!re && x && Wa("panel_open"), po(), hi && (hi = !1, vo()), r.classList.contains("pluno-pa-widget--open") || (m = null), mt !== null && (window.clearTimeout(mt), mt = null), ai("shown", !1), U.hidden = !1, R.hidden = !1, gr(
|
|
12307
12307
|
G,
|
|
12308
12308
|
co()
|
|
12309
12309
|
), r.classList.remove("pluno-pa-widget--closing"), gt();
|
|
@@ -12316,22 +12316,22 @@ async function lw(t = {}) {
|
|
|
12316
12316
|
if (Gi(Ie, Re), wn("Opening launcher at clamped open panel position", {
|
|
12317
12317
|
openPanelPosition: Ie,
|
|
12318
12318
|
visibleLauncherPosition: Re
|
|
12319
|
-
}), st(!0, "open"), yt(), !re && e.layout === "floating" && A.recordWidgetLifecycle("opened",
|
|
12320
|
-
r.classList.add("pluno-pa-widget--open"), re || ao(), _.hidden = !0, u && (
|
|
12319
|
+
}), st(!0, "open"), yt(), !re && e.layout === "floating" && A.recordWidgetLifecycle("opened", D), !y) {
|
|
12320
|
+
r.classList.add("pluno-pa-widget--open"), re || ao(), _.hidden = !0, u && (P.value = u, ki(P)), Kn(q, () => Ot.enabled), Zt = q.scrollTop, I && (fn(P, "panel_open_immediate"), P.setSelectionRange(P.value.length, P.value.length)), Ve(), Vi("shown", D), e.onPanelOpenChange?.(!0, D);
|
|
12321
12321
|
return;
|
|
12322
12322
|
}
|
|
12323
12323
|
const _t = Date.now();
|
|
12324
12324
|
window.requestAnimationFrame(() => {
|
|
12325
|
-
r.classList.add("pluno-pa-widget--open"), re || ao(), u && (
|
|
12325
|
+
r.classList.add("pluno-pa-widget--open"), re || ao(), u && (P.value = u, ki(P)), Kn(q, () => Ot.enabled), Zt = q.scrollTop, I && (fn(P, "panel_open_animation", {
|
|
12326
12326
|
scheduledAt: _t
|
|
12327
|
-
}),
|
|
12327
|
+
}), P.setSelectionRange(P.value.length, P.value.length)), Ve(), Vi("shown", D), e.onPanelOpenChange?.(!0, D), mt = window.setTimeout(() => {
|
|
12328
12328
|
_.hidden = !0, Kn(q, () => Ot.enabled), Zt = q.scrollTop;
|
|
12329
12329
|
}, 220);
|
|
12330
12330
|
});
|
|
12331
12331
|
}, ho = (u = "external_request") => {
|
|
12332
12332
|
const y = r.classList.contains("pluno-pa-widget--open") || !U.hidden && !r.classList.contains("pluno-pa-widget--closing");
|
|
12333
12333
|
mt !== null && (window.clearTimeout(mt), mt = null), _.hidden = !1, d && (ci(!1), wn("Closing launcher at stored position")), r.classList.remove("pluno-pa-widget--open"), r.classList.add("pluno-pa-widget--closing"), gt(), Ve(), y && e.layout === "floating" && A.recordWidgetLifecycle("closed", u), e.onPanelOpenChange?.(!1, u), mt = window.setTimeout(() => {
|
|
12334
|
-
U.hidden = !0,
|
|
12334
|
+
U.hidden = !0, R.hidden = !0, m = null, r.classList.remove("pluno-pa-widget--closing");
|
|
12335
12335
|
}, 220);
|
|
12336
12336
|
};
|
|
12337
12337
|
_.addEventListener("submit", (u) => {
|
|
@@ -12351,7 +12351,7 @@ async function lw(t = {}) {
|
|
|
12351
12351
|
wt(u, !0, !0, !0, "launcher_input"), E.value = "";
|
|
12352
12352
|
});
|
|
12353
12353
|
let ui = null, en = null, Ji = null, In = null, kt = null, Ne = null;
|
|
12354
|
-
const Yi = (u) => u === E || u ===
|
|
12354
|
+
const Yi = (u) => u === E || u === P, Ga = (u) => u.composedPath().find(Yi) ?? null, ju = (u) => {
|
|
12355
12355
|
let y = u;
|
|
12356
12356
|
for (; y; ) {
|
|
12357
12357
|
if (y.assignedSlot)
|
|
@@ -12372,8 +12372,8 @@ async function lw(t = {}) {
|
|
|
12372
12372
|
y = x;
|
|
12373
12373
|
continue;
|
|
12374
12374
|
}
|
|
12375
|
-
const
|
|
12376
|
-
y =
|
|
12375
|
+
const D = y.getRootNode();
|
|
12376
|
+
y = D instanceof ShadowRoot ? D.host : null;
|
|
12377
12377
|
}
|
|
12378
12378
|
return null;
|
|
12379
12379
|
}, fo = () => ps(b), Ku = (u) => {
|
|
@@ -12423,12 +12423,12 @@ async function lw(t = {}) {
|
|
|
12423
12423
|
x && (pi(x, y), u.stopImmediatePropagation()), Ne = window.setTimeout(() => {
|
|
12424
12424
|
if (Ne = null, en !== I)
|
|
12425
12425
|
return;
|
|
12426
|
-
const
|
|
12427
|
-
if (
|
|
12426
|
+
const D = fo();
|
|
12427
|
+
if (D === y) {
|
|
12428
12428
|
en = null;
|
|
12429
12429
|
return;
|
|
12430
12430
|
}
|
|
12431
|
-
const re = go(
|
|
12431
|
+
const re = go(D);
|
|
12432
12432
|
re && pi(re, y);
|
|
12433
12433
|
}, 0);
|
|
12434
12434
|
}, Xi = (u) => {
|
|
@@ -12459,7 +12459,7 @@ async function lw(t = {}) {
|
|
|
12459
12459
|
return;
|
|
12460
12460
|
const I = u.target, x = en !== null && Date.now() - en <= kl;
|
|
12461
12461
|
en = null, Ne !== null && (window.clearTimeout(Ne), Ne = null);
|
|
12462
|
-
const
|
|
12462
|
+
const D = (re) => {
|
|
12463
12463
|
const Re = go(re);
|
|
12464
12464
|
if (!Re)
|
|
12465
12465
|
return !1;
|
|
@@ -12468,8 +12468,8 @@ async function lw(t = {}) {
|
|
|
12468
12468
|
const Ie = Date.now();
|
|
12469
12469
|
return Ji !== null && Ie - Ji <= Ky ? (pi(Re, I), !0) : (Ji = Ie, !0);
|
|
12470
12470
|
};
|
|
12471
|
-
|
|
12472
|
-
Ut === null && I.isConnected &&
|
|
12471
|
+
D(u.relatedTarget) || window.setTimeout(() => {
|
|
12472
|
+
Ut === null && I.isConnected && D(fo());
|
|
12473
12473
|
}, 0);
|
|
12474
12474
|
}), _.addEventListener("keydown", (u) => {
|
|
12475
12475
|
!r.classList.contains("pluno-pa-widget--minimized") || u.key !== "Enter" && u.key !== " " || (u.preventDefault(), wt("", !0, !0, !0, "minimized_launcher"));
|
|
@@ -12477,7 +12477,7 @@ async function lw(t = {}) {
|
|
|
12477
12477
|
u.stopPropagation();
|
|
12478
12478
|
}), K?.addEventListener("click", (u) => {
|
|
12479
12479
|
u.preventDefault(), u.stopPropagation(), ai("minimized", !0, "minimize_button");
|
|
12480
|
-
}),
|
|
12480
|
+
}), R.addEventListener("click", () => ho("close_button")), q.addEventListener("wheel", (u) => {
|
|
12481
12481
|
Wi(u.deltaY < 0 ? "up" : null);
|
|
12482
12482
|
}), q.addEventListener("pointerdown", (u) => {
|
|
12483
12483
|
yn = u.target === q ? u.clientY : null;
|
|
@@ -12525,7 +12525,7 @@ async function lw(t = {}) {
|
|
|
12525
12525
|
return Qi() ? !1 : u !== "connected" && !(yo && u === "reconnecting");
|
|
12526
12526
|
}, zn = () => {
|
|
12527
12527
|
const u = Nt(), y = A.getState(), I = !y.isThinking && !y.pendingMessageStatus && !!y.lastError;
|
|
12528
|
-
E.readOnly = !1,
|
|
12528
|
+
E.readOnly = !1, P.readOnly = !1, E.placeholder = u ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : I ? "Needs attention" : hi ? "New update" : e.launcherLabel, P.placeholder = u ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : $t.launcherLabel, V.hidden = u;
|
|
12529
12529
|
}, _o = () => [...St.values()].some((u) => u.revision === Gt && u.generation === ft), Za = () => {
|
|
12530
12530
|
const u = A.getState(), y = e.billingStatus;
|
|
12531
12531
|
return {
|
|
@@ -12544,7 +12544,7 @@ async function lw(t = {}) {
|
|
|
12544
12544
|
return yp({
|
|
12545
12545
|
hasRunningAssistantTurn: y || u.isThinking || u.turnPhase !== null || u.pendingMessageStatus !== null,
|
|
12546
12546
|
// Retained text already submitted by this revision must not hide Stop behind a disabled Send.
|
|
12547
|
-
hasDraftMessage: !y &&
|
|
12547
|
+
hasDraftMessage: !y && P.value.trim().length > 0,
|
|
12548
12548
|
hasPreSubmittedAttachment: nt.length > 0,
|
|
12549
12549
|
canSubmitMessage: tn()
|
|
12550
12550
|
});
|
|
@@ -12556,8 +12556,8 @@ async function lw(t = {}) {
|
|
|
12556
12556
|
};
|
|
12557
12557
|
zn();
|
|
12558
12558
|
const vo = () => {
|
|
12559
|
-
const u = A.getState(), y = u.isThinking, I = u.turnPhase !== null, x = u.turnPhase === "sending",
|
|
12560
|
-
|
|
12559
|
+
const u = A.getState(), y = u.isThinking, I = u.turnPhase !== null, x = u.turnPhase === "sending", D = L?.lastElementChild;
|
|
12560
|
+
D && (D.textContent = "Working..."), r.classList.toggle("pluno-pa-widget--thinking", y), r.classList.toggle("pluno-pa-widget--sending", x), r.classList.toggle(
|
|
12561
12561
|
"pluno-pa-widget--unread",
|
|
12562
12562
|
!I && (hi || !!u.lastError)
|
|
12563
12563
|
), zn();
|
|
@@ -12580,14 +12580,14 @@ async function lw(t = {}) {
|
|
|
12580
12580
|
}
|
|
12581
12581
|
);
|
|
12582
12582
|
}, Zi = (u) => {
|
|
12583
|
-
Dt !== null && window.clearTimeout(Dt),
|
|
12584
|
-
|
|
12583
|
+
Dt !== null && window.clearTimeout(Dt), O.textContent = u, O.hidden = !1, Dt = window.setTimeout(() => {
|
|
12584
|
+
O.textContent = "", O.hidden = !0, Dt = null;
|
|
12585
12585
|
}, 3e3);
|
|
12586
12586
|
}, So = (u, y) => {
|
|
12587
12587
|
const I = St.get(u);
|
|
12588
12588
|
if (!I || y !== void 0 && I.submittedAt !== y || (St.delete(u), I.generation !== ft || I.revision !== Gt)) return;
|
|
12589
12589
|
const x = new Set(I.attachments);
|
|
12590
|
-
nt = nt.filter((
|
|
12590
|
+
nt = nt.filter((D) => !x.has(D)), P.value = "", P.dispatchEvent(new Event("input", { bubbles: !0 })), ei(), Me();
|
|
12591
12591
|
}, tc = (u) => {
|
|
12592
12592
|
const y = ft, I = gn ? Nn : null;
|
|
12593
12593
|
Ew(
|
|
@@ -12603,8 +12603,8 @@ async function lw(t = {}) {
|
|
|
12603
12603
|
}).catch((x) => {
|
|
12604
12604
|
if (y !== ft) return;
|
|
12605
12605
|
be?.clientMessageId === u.clientMessageId && (be = null), St.delete(u.clientMessageId), ei();
|
|
12606
|
-
const
|
|
12607
|
-
A.getState().lastError !==
|
|
12606
|
+
const D = x instanceof Error ? x.message : "Failed to upload attachment";
|
|
12607
|
+
A.getState().lastError !== D && Zi(D);
|
|
12608
12608
|
}).finally(() => {
|
|
12609
12609
|
y === ft && Me();
|
|
12610
12610
|
});
|
|
@@ -12614,12 +12614,12 @@ async function lw(t = {}) {
|
|
|
12614
12614
|
const u = Jt;
|
|
12615
12615
|
Jt = null, tc(u);
|
|
12616
12616
|
}, xo = () => {
|
|
12617
|
-
const u =
|
|
12617
|
+
const u = P.value, y = u.trim(), I = [...nt];
|
|
12618
12618
|
if (Jt !== null || _o() || e.productVariant === "personal" && !tn() || !y && I.length === 0)
|
|
12619
12619
|
return;
|
|
12620
|
-
for (const
|
|
12621
|
-
|
|
12622
|
-
if ([...St.values()].some((
|
|
12620
|
+
for (const D of I)
|
|
12621
|
+
D.id && D.previewUrl && Zn.set(D.id, D.previewUrl);
|
|
12622
|
+
if ([...St.values()].some((D) => D.revision === Gt && D.generation === ft)) return;
|
|
12623
12623
|
const x = {
|
|
12624
12624
|
inputValue: u,
|
|
12625
12625
|
value: y,
|
|
@@ -12639,7 +12639,7 @@ async function lw(t = {}) {
|
|
|
12639
12639
|
}
|
|
12640
12640
|
tc(x);
|
|
12641
12641
|
};
|
|
12642
|
-
|
|
12642
|
+
V.addEventListener("submit", (u) => {
|
|
12643
12643
|
if (u.preventDefault(), e.loginRequired) {
|
|
12644
12644
|
e.onLoginClick?.();
|
|
12645
12645
|
return;
|
|
@@ -12654,7 +12654,7 @@ async function lw(t = {}) {
|
|
|
12654
12654
|
const nn = () => {
|
|
12655
12655
|
gi = 0, r.classList.remove("pluno-pa-widget--drag-over");
|
|
12656
12656
|
}, Wu = () => {
|
|
12657
|
-
Dt !== null && (window.clearTimeout(Dt), Dt = null),
|
|
12657
|
+
Dt !== null && (window.clearTimeout(Dt), Dt = null), O.textContent = "", O.hidden = !0;
|
|
12658
12658
|
}, ko = async (u) => {
|
|
12659
12659
|
if (!e.attachmentsEnabled || u.length === 0 || e.productVariant === "personal" && Sn())
|
|
12660
12660
|
return;
|
|
@@ -12669,13 +12669,13 @@ async function lw(t = {}) {
|
|
|
12669
12669
|
}
|
|
12670
12670
|
Yt("attachment_added");
|
|
12671
12671
|
}, Vu = async (u) => {
|
|
12672
|
-
await ko(u), !(u.length === 0 || Ut !== null) && fn(
|
|
12672
|
+
await ko(u), !(u.length === 0 || Ut !== null) && fn(P, "attachment_picker_completed");
|
|
12673
12673
|
};
|
|
12674
12674
|
Se.addEventListener("click", () => {
|
|
12675
|
-
e.loginRequired || Sn() || e.productVariant !== "personal" && Fn(e.billingStatus) ||
|
|
12676
|
-
}),
|
|
12677
|
-
const u = Array.from(
|
|
12678
|
-
|
|
12675
|
+
e.loginRequired || Sn() || e.productVariant !== "personal" && Fn(e.billingStatus) || te.click();
|
|
12676
|
+
}), te.addEventListener("change", () => {
|
|
12677
|
+
const u = Array.from(te.files ?? []);
|
|
12678
|
+
te.value = "", Vu(u).catch((y) => {
|
|
12679
12679
|
Zi(
|
|
12680
12680
|
y instanceof Error ? y.message : "Failed to attach file"
|
|
12681
12681
|
), Xe("web-sdk.widget", "Attachment failed", {
|
|
@@ -12728,15 +12728,15 @@ async function lw(t = {}) {
|
|
|
12728
12728
|
St.clear(), Jt = null, be = null, A.stop(), Me();
|
|
12729
12729
|
return;
|
|
12730
12730
|
}
|
|
12731
|
-
const y =
|
|
12731
|
+
const y = P.value.trim().length > 0 || nt.length > 0;
|
|
12732
12732
|
Qt = !0, st(!0, "send"), yt(), xo(), _e(A.getState()), Me(), y && Yt("send_button_submit");
|
|
12733
|
-
}),
|
|
12733
|
+
}), J.addEventListener("click", () => {
|
|
12734
12734
|
Ke = !Ke, Lt(), Ke && (We.data === null || We.status === "error") && We.status !== "loading" && ro(), Ke || Yt("history_closed");
|
|
12735
|
-
}),
|
|
12735
|
+
}), Y.addEventListener("click", () => {
|
|
12736
12736
|
Ke = !1, Lt(), Yt("history_closed");
|
|
12737
|
-
}), z.addEventListener("scroll", Uu),
|
|
12738
|
-
Gt++,
|
|
12739
|
-
}),
|
|
12737
|
+
}), z.addEventListener("scroll", Uu), P.addEventListener("input", () => {
|
|
12738
|
+
Gt++, P.value.trim() && Wa("composer_input"), ki(P), Ve(), Me(), uc();
|
|
12739
|
+
}), P.addEventListener("keydown", (u) => {
|
|
12740
12740
|
if (!(u.key !== "Enter" || u.shiftKey || u.isComposing || u.keyCode === 229)) {
|
|
12741
12741
|
if (u.preventDefault(), e.loginRequired) {
|
|
12742
12742
|
e.onLoginClick?.();
|
|
@@ -12746,9 +12746,9 @@ async function lw(t = {}) {
|
|
|
12746
12746
|
}
|
|
12747
12747
|
}), r.addEventListener("click", (u) => {
|
|
12748
12748
|
const y = u.target instanceof Element ? u.target : null;
|
|
12749
|
-
y?.closest("a[href]") && Ve(), Ke && vy(y, tt,
|
|
12750
|
-
const x = window.getSelection(),
|
|
12751
|
-
by(u.target, u.detail,
|
|
12749
|
+
y?.closest("a[href]") && Ve(), Ke && vy(y, tt, J) && (Ke = !1, Lt());
|
|
12750
|
+
const x = window.getSelection(), D = !!(x && !x.isCollapsed && x.anchorNode && r.contains(x.anchorNode));
|
|
12751
|
+
by(u.target, u.detail, D) && Yt("passive_surface_click");
|
|
12752
12752
|
});
|
|
12753
12753
|
let sc = !1;
|
|
12754
12754
|
const oc = (u) => {
|
|
@@ -12757,16 +12757,16 @@ async function lw(t = {}) {
|
|
|
12757
12757
|
if (!sc || U.hidden || r.classList.contains("pluno-pa-widget--closing"))
|
|
12758
12758
|
return;
|
|
12759
12759
|
const y = a.activeElement ?? b.activeElement, I = Sy(u, y);
|
|
12760
|
-
if (!I ||
|
|
12760
|
+
if (!I || P.disabled || P.readOnly)
|
|
12761
12761
|
return;
|
|
12762
12762
|
u.preventDefault();
|
|
12763
12763
|
const x = xy(
|
|
12764
|
-
|
|
12765
|
-
|
|
12766
|
-
|
|
12764
|
+
P.value,
|
|
12765
|
+
P.selectionStart,
|
|
12766
|
+
P.selectionEnd,
|
|
12767
12767
|
I
|
|
12768
12768
|
);
|
|
12769
|
-
|
|
12769
|
+
P.value = x.value, P.dispatchEvent(new Event("input", { bubbles: !0 })), Iy(P), P.setSelectionRange(x.caret, x.caret);
|
|
12770
12770
|
};
|
|
12771
12771
|
b.addEventListener(
|
|
12772
12772
|
"pointerdown",
|
|
@@ -12800,7 +12800,7 @@ async function lw(t = {}) {
|
|
|
12800
12800
|
return;
|
|
12801
12801
|
}
|
|
12802
12802
|
u.key !== "Escape" || !Ke || (Ke = !1, Lt(), Yt("history_escape"));
|
|
12803
|
-
}), l.composerValue && (
|
|
12803
|
+
}), l.composerValue && (P.value = l.composerValue, ki(P)), e.layout === "page" ? wt(P.value, !1, !0, !1, "external_request") : p === "minimized" ? ai("minimized", !1) : e.initialDisplayState === void 0 && l.isOpen && wt(P.value, !1, !1, !1, "restored_state");
|
|
12804
12804
|
const fi = () => c;
|
|
12805
12805
|
let Eo = A.getState().appearance !== null, es = null, mi = null, Et = A.getInteractions();
|
|
12806
12806
|
const ue = (u) => Et.find(
|
|
@@ -12809,7 +12809,7 @@ async function lw(t = {}) {
|
|
|
12809
12809
|
const u = ue("task_notifications");
|
|
12810
12810
|
u && (ke && (ke.textContent = u.presentation.body), Fe && (Fe.textContent = u.presentation.actionLabels.enable ?? "Notify me"), ht && (ht.textContent = u.presentation.actionLabels.later ?? "Later"), je && (je.textContent = u.presentation.actionLabels.never ?? "Never"));
|
|
12811
12811
|
const y = ue("tab_group_permission");
|
|
12812
|
-
y && (
|
|
12812
|
+
y && (Q && (Q.textContent = y.presentation.body), de && (de.textContent = y.presentation.actionLabels.enable ?? "Enable grouping"), C && (C.textContent = y.presentation.actionLabels.later ?? "Not now"));
|
|
12813
12813
|
};
|
|
12814
12814
|
cc();
|
|
12815
12815
|
const Ue = (u, y, I) => u ? A.actOnInteraction(
|
|
@@ -12836,19 +12836,19 @@ async function lw(t = {}) {
|
|
|
12836
12836
|
});
|
|
12837
12837
|
});
|
|
12838
12838
|
const lc = async () => {
|
|
12839
|
-
|
|
12839
|
+
M && (M.hidden = ue("tab_group_permission") === void 0);
|
|
12840
12840
|
};
|
|
12841
12841
|
de?.addEventListener("click", () => {
|
|
12842
12842
|
const u = ue("tab_group_permission");
|
|
12843
|
-
|
|
12843
|
+
M && (M.hidden = !0), Ue(u, "enable").catch(() => {
|
|
12844
12844
|
});
|
|
12845
12845
|
}), C?.addEventListener("click", () => {
|
|
12846
12846
|
const u = ue("tab_group_permission");
|
|
12847
|
-
|
|
12847
|
+
M && (M.hidden = !0), Ue(u, "later").catch(() => {
|
|
12848
12848
|
});
|
|
12849
12849
|
}), lc();
|
|
12850
12850
|
let xn = null;
|
|
12851
|
-
const ts = /* @__PURE__ */ new Map(), Ro = /* @__PURE__ */ new Map(), To = /* @__PURE__ */ new Map(), Gu = () =>
|
|
12851
|
+
const ts = /* @__PURE__ */ new Map(), Ro = /* @__PURE__ */ new Map(), To = /* @__PURE__ */ new Map(), Gu = () => P.value.trim().length > 0 || nt.length > 0, dc = (u) => {
|
|
12852
12852
|
if (e.entrySurface === "extension_widget") {
|
|
12853
12853
|
const y = e.billingStatus?.auth, I = y ? !!y.user : !!(u.user && !e.loginRequired), x = y ? !!y.workspace : !e.signupRequired;
|
|
12854
12854
|
return I && x && xn !== null && xn > 0;
|
|
@@ -12886,7 +12886,7 @@ async function lw(t = {}) {
|
|
|
12886
12886
|
}, yi = (u = {}) => {
|
|
12887
12887
|
ft++, St.clear(), Ea(), Jt = null, be = null, oi = !1, ji.clear(), Qt = !0, st(!0, "newSession"), yt(), Ke = !1, Lt();
|
|
12888
12888
|
const y = Promise.resolve(A.startNewSession(u));
|
|
12889
|
-
return di = null, no.clear(), is.clear(),
|
|
12889
|
+
return di = null, no.clear(), is.clear(), P.value = "", nt = [], ei(), ki(P), Ve(), Me(), fn(P, "new_chat"), _e(A.getState()), y;
|
|
12890
12890
|
}, pc = (u) => {
|
|
12891
12891
|
window.requestAnimationFrame(() => {
|
|
12892
12892
|
Pe || U.hidden || b.visibilityState === "hidden" || Array.from(q.querySelectorAll("[data-message-key]")).some(
|
|
@@ -12917,7 +12917,7 @@ async function lw(t = {}) {
|
|
|
12917
12917
|
}
|
|
12918
12918
|
gt();
|
|
12919
12919
|
};
|
|
12920
|
-
|
|
12920
|
+
X?.addEventListener("click", gc), B?.addEventListener("click", gc), Le?.addEventListener("click", async () => {
|
|
12921
12921
|
const u = e.proactiveSuggestion;
|
|
12922
12922
|
if (!u)
|
|
12923
12923
|
return;
|
|
@@ -12927,9 +12927,9 @@ async function lw(t = {}) {
|
|
|
12927
12927
|
const I = ue("proactive_suggestion");
|
|
12928
12928
|
I && Ue(I, "edit").catch(() => {
|
|
12929
12929
|
}), wt("Yes, but ", !0, !0, !0, "proactive_suggestion"), pc(y), window.requestAnimationFrame(() => {
|
|
12930
|
-
|
|
12930
|
+
P.dispatchEvent(new Event("input", { bubbles: !0 })), P.setSelectionRange(P.value.length, P.value.length);
|
|
12931
12931
|
});
|
|
12932
|
-
}),
|
|
12932
|
+
}), Z?.addEventListener("click", () => {
|
|
12933
12933
|
const u = e.proactiveSuggestion;
|
|
12934
12934
|
if (!u)
|
|
12935
12935
|
return;
|
|
@@ -12965,7 +12965,7 @@ async function lw(t = {}) {
|
|
|
12965
12965
|
"New chat",
|
|
12966
12966
|
Fw(),
|
|
12967
12967
|
!1
|
|
12968
|
-
), Bn.addEventListener("click", () => yi()), $e.insertBefore(Bn,
|
|
12968
|
+
), Bn.addEventListener("click", () => yi()), $e.insertBefore(Bn, J));
|
|
12969
12969
|
}, zt = document.createElement("div");
|
|
12970
12970
|
zt.className = "pluno-pa-widget__error";
|
|
12971
12971
|
const Po = document.createTextNode("");
|
|
@@ -12997,17 +12997,17 @@ async function lw(t = {}) {
|
|
|
12997
12997
|
});
|
|
12998
12998
|
let kn = !1, wi = null, os = 0, Mo = 0;
|
|
12999
12999
|
const _e = (u, y = {}) => {
|
|
13000
|
-
qa(u) && (be = null), Ma = y.renderSource ?? "local", uo(), r.classList.toggle("pluno-pa-widget--logged-out", e.loginRequired && e.entrySurface === "extension_widget"),
|
|
13001
|
-
if (
|
|
13002
|
-
const Ct =
|
|
13000
|
+
qa(u) && (be = null), Ma = y.renderSource ?? "local", uo(), r.classList.toggle("pluno-pa-widget--logged-out", e.loginRequired && e.entrySurface === "extension_widget"), F.classList.remove("pluno-pa-widget__access-notice--login-only"), u = { ...u, messages: u.messages.map(($) => {
|
|
13001
|
+
if (!$.attachments?.some((Ge) => Ge.id && !Ge.fileUrl && Zn.has(Ge.id))) return $;
|
|
13002
|
+
const Ct = $.attachments.map((Ge) => {
|
|
13003
13003
|
const bi = Ge.id ? Zn.get(Ge.id) : void 0;
|
|
13004
13004
|
return bi && !Ge.fileUrl ? { ...Ge, previewUrl: bi } : Ge;
|
|
13005
13005
|
});
|
|
13006
|
-
return Object.create(Object.getPrototypeOf(
|
|
13007
|
-
...Object.getOwnPropertyDescriptors(
|
|
13006
|
+
return Object.create(Object.getPrototypeOf($), {
|
|
13007
|
+
...Object.getOwnPropertyDescriptors($),
|
|
13008
13008
|
attachments: { value: Ct, enumerable: !0, configurable: !0 }
|
|
13009
13009
|
});
|
|
13010
|
-
}) }, Un(), Xt !== null && (window.clearTimeout(Xt), Xt = null), Lt(), gt(), Zs(),
|
|
13010
|
+
}) }, Un(), Xt !== null && (window.clearTimeout(Xt), Xt = null), Lt(), gt(), Zs(), F.hidden = !e.loginRequired && !e.signupRequired, F.hidden && F.replaceChildren();
|
|
13011
13011
|
const I = JSON.stringify([
|
|
13012
13012
|
!!(e.loginRequired || e.signupRequired),
|
|
13013
13013
|
u.lastError,
|
|
@@ -13016,27 +13016,27 @@ async function lw(t = {}) {
|
|
|
13016
13016
|
on
|
|
13017
13017
|
]);
|
|
13018
13018
|
if (yc !== I) {
|
|
13019
|
-
yc = I,
|
|
13020
|
-
const
|
|
13021
|
-
Po.data !==
|
|
13019
|
+
yc = I, ee.hidden = !!(e.loginRequired || e.signupRequired) || !u.lastError || Pi(u.lastErrorCode) !== "bottom_notice";
|
|
13020
|
+
const $ = ee.hidden ? "" : u.lastError ?? "";
|
|
13021
|
+
Po.data !== $ && (Po.data = $), ee.hidden ? zt.remove() : zt.parentElement !== ee && ee.appendChild(zt), u.lastErrorSecuritySettingsUrl ? (sn.href = u.lastErrorSecuritySettingsUrl, sn.parentElement !== zt && zt.insertBefore(sn, bt.parentElement ? bt : null)) : sn.remove(), u.lastErrorCode === "connection_failed" || u.lastErrorCode === "auth_reconnecting" ? (bt.disabled = on, bt.setAttribute("aria-busy", String(on)), fc.hidden = !on, mc.data = on ? "Trying" : "Try again", bt.parentElement !== zt && zt.appendChild(bt)) : bt.remove();
|
|
13022
13022
|
}
|
|
13023
13023
|
if (e.loginRequired) {
|
|
13024
13024
|
Ki = "", ts.clear(), Ro.clear(), To.clear(), q.replaceChildren();
|
|
13025
|
-
const
|
|
13026
|
-
if (
|
|
13025
|
+
const $ = e.billingStatus?.auth, Ct = e.extensionRuntime?.retryAuth;
|
|
13026
|
+
if ($?.status === "error" && ($.errorCode === "browser_session_unavailable" || $.errorCode === "backend_auth_pending") && Ct) {
|
|
13027
13027
|
mr(
|
|
13028
|
-
|
|
13028
|
+
F,
|
|
13029
13029
|
Ce,
|
|
13030
13030
|
ss,
|
|
13031
13031
|
fi,
|
|
13032
|
-
(wi ??
|
|
13032
|
+
(wi ?? $.message).replace(new RegExp("(?<=[.!?])\\s+", "g"), `
|
|
13033
13033
|
`),
|
|
13034
13034
|
kn ? "Trying" : "Try again",
|
|
13035
13035
|
void 0,
|
|
13036
13036
|
!1,
|
|
13037
13037
|
void 0
|
|
13038
13038
|
);
|
|
13039
|
-
const Ge =
|
|
13039
|
+
const Ge = F.querySelector(".pluno-pa-widget__login");
|
|
13040
13040
|
Ge.disabled = kn, Ge.setAttribute("aria-busy", String(kn)), kn && Ge.prepend(pn()), Ge.addEventListener("click", () => {
|
|
13041
13041
|
const bi = ++os, rp = Mo;
|
|
13042
13042
|
kn = !0, wi = null, _e(A.getState()), Ct().catch((Ic) => {
|
|
@@ -13047,8 +13047,8 @@ async function lw(t = {}) {
|
|
|
13047
13047
|
});
|
|
13048
13048
|
return;
|
|
13049
13049
|
}
|
|
13050
|
-
|
|
13051
|
-
|
|
13050
|
+
F.classList.add("pluno-pa-widget__access-notice--login-only"), mr(
|
|
13051
|
+
F,
|
|
13052
13052
|
Ce,
|
|
13053
13053
|
ss,
|
|
13054
13054
|
fi,
|
|
@@ -13062,7 +13062,7 @@ async function lw(t = {}) {
|
|
|
13062
13062
|
}
|
|
13063
13063
|
if (e.signupRequired) {
|
|
13064
13064
|
Ki = "", ts.clear(), Ro.clear(), To.clear(), q.replaceChildren(), mr(
|
|
13065
|
-
|
|
13065
|
+
F,
|
|
13066
13066
|
Ce,
|
|
13067
13067
|
ss,
|
|
13068
13068
|
fi,
|
|
@@ -13080,10 +13080,10 @@ async function lw(t = {}) {
|
|
|
13080
13080
|
u.status,
|
|
13081
13081
|
u.user,
|
|
13082
13082
|
Qi()
|
|
13083
|
-
]),
|
|
13083
|
+
]), D = x !== Ki;
|
|
13084
13084
|
Ki = x;
|
|
13085
13085
|
const re = Qt || Ot.enabled;
|
|
13086
|
-
Qt = !1, (
|
|
13086
|
+
Qt = !1, (D || y.skipUnchangedTimeline !== !0) && lb(
|
|
13087
13087
|
q,
|
|
13088
13088
|
le,
|
|
13089
13089
|
Ce,
|
|
@@ -13100,36 +13100,36 @@ async function lw(t = {}) {
|
|
|
13100
13100
|
To,
|
|
13101
13101
|
Ve,
|
|
13102
13102
|
fi,
|
|
13103
|
-
(
|
|
13104
|
-
(e.productVariant === "personal" ? !tn() : wo()) || (Qt = !0, st(!0, "send"), yt(), A.sendMessage(
|
|
13103
|
+
($) => {
|
|
13104
|
+
(e.productVariant === "personal" ? !tn() : wo()) || (Qt = !0, st(!0, "send"), yt(), A.sendMessage($));
|
|
13105
13105
|
},
|
|
13106
|
-
(
|
|
13106
|
+
($) => (Qt = !0, st(!0, "send"), yt(), A.retryLastMessage($)),
|
|
13107
13107
|
e.morningReport,
|
|
13108
13108
|
() => {
|
|
13109
|
-
const
|
|
13110
|
-
|
|
13109
|
+
const $ = ue("morning_report");
|
|
13110
|
+
$ && Ue($, "later").catch(() => {
|
|
13111
13111
|
}), ho("morning_report_snooze"), _e(A.getState());
|
|
13112
13112
|
},
|
|
13113
13113
|
() => u.sessionId ? A.loadSession(u.sessionId) : void 0,
|
|
13114
13114
|
() => yi(),
|
|
13115
13115
|
ns.get(u.selectionKey ?? u.sessionId ?? "draft"),
|
|
13116
|
-
(
|
|
13117
|
-
Ju(u.selectionKey ?? u.sessionId ?? "draft",
|
|
13116
|
+
($, Ct) => {
|
|
13117
|
+
Ju(u.selectionKey ?? u.sessionId ?? "draft", $, Ct);
|
|
13118
13118
|
},
|
|
13119
13119
|
e.attachmentPreviewUrlResolver,
|
|
13120
13120
|
ac("integration_connection") ? {
|
|
13121
|
-
requests: Et.flatMap((
|
|
13121
|
+
requests: Et.flatMap(($) => $.kind === "integration_connection" ? [$.payload.request] : []),
|
|
13122
13122
|
states: is,
|
|
13123
13123
|
initialStatus: "pending",
|
|
13124
|
-
onConnect: (
|
|
13124
|
+
onConnect: ($) => Yu($),
|
|
13125
13125
|
presentations: new Map(Et.flatMap(
|
|
13126
|
-
(
|
|
13126
|
+
($) => $.kind === "integration_connection" ? [[$.payload.request.authRequestId, $.presentation]] : []
|
|
13127
13127
|
))
|
|
13128
13128
|
} : void 0,
|
|
13129
13129
|
ue("personal_channel_connection") ? {
|
|
13130
13130
|
request: ue("personal_channel_connection").payload.request,
|
|
13131
|
-
onConnect: (
|
|
13132
|
-
Xu(
|
|
13131
|
+
onConnect: ($) => {
|
|
13132
|
+
Xu($);
|
|
13133
13133
|
},
|
|
13134
13134
|
presentation: ac("personal_channel_connection")?.presentation
|
|
13135
13135
|
} : void 0,
|
|
@@ -13143,22 +13143,22 @@ async function lw(t = {}) {
|
|
|
13143
13143
|
socialPostRewardsUrl: e.socialPostRewardsUrl,
|
|
13144
13144
|
onSeen: () => {
|
|
13145
13145
|
},
|
|
13146
|
-
onReferralCopy: (
|
|
13147
|
-
sp(
|
|
13146
|
+
onReferralCopy: ($) => {
|
|
13147
|
+
sp($);
|
|
13148
13148
|
},
|
|
13149
|
-
onSocialShare: (
|
|
13149
|
+
onSocialShare: ($) => {
|
|
13150
13150
|
const Ct = ue("social_share");
|
|
13151
13151
|
Ue(Ct, "dismiss").catch(() => {
|
|
13152
13152
|
});
|
|
13153
13153
|
},
|
|
13154
13154
|
onDismiss: () => {
|
|
13155
|
-
const
|
|
13156
|
-
Ue(
|
|
13155
|
+
const $ = ue("social_share");
|
|
13156
|
+
Ue($, "dismiss").catch(() => {
|
|
13157
13157
|
}), mi = null, _e(A.getState());
|
|
13158
13158
|
},
|
|
13159
13159
|
onDisable: () => {
|
|
13160
|
-
const
|
|
13161
|
-
Ue(
|
|
13160
|
+
const $ = ue("social_share");
|
|
13161
|
+
Ue($, "dont_show_again").catch(() => {
|
|
13162
13162
|
}), mi = null, _e(A.getState());
|
|
13163
13163
|
}
|
|
13164
13164
|
} : void 0
|
|
@@ -13167,13 +13167,13 @@ async function lw(t = {}) {
|
|
|
13167
13167
|
".pluno-pa-widget__empty-state--starter:not(.pluno-pa-widget__empty-state--morning-report)"
|
|
13168
13168
|
);
|
|
13169
13169
|
be && !be.observedWelcome && !Re && Ol(u) && (be.observedConversation = Da(u)), Ua(), Me(), gt();
|
|
13170
|
-
const Ie = Array.isArray(u.activeScheduledFollowUps) ? u.activeScheduledFollowUps : null, _t = (Ie !== null ? Ie.map((
|
|
13170
|
+
const Ie = Array.isArray(u.activeScheduledFollowUps) ? u.activeScheduledFollowUps : null, _t = (Ie !== null ? Ie.map(($) => $.dueAt) : u.messages.map(($) => $.scheduledCheckInAt)).filter(($) => !!$).filter(($) => Jn($) !== null).sort(($, Ct) => Date.parse($) - Date.parse(Ct))[0] ?? null, vc = _t ? Qg(_t) : null;
|
|
13171
13171
|
vc !== null && (Xt = window.setTimeout(
|
|
13172
13172
|
() => {
|
|
13173
13173
|
Xt = null, Pe || _e(A.getState());
|
|
13174
13174
|
},
|
|
13175
13175
|
Math.min(vc, 2147483647)
|
|
13176
|
-
)), re ? (Zt = q.scrollTop, yt()) :
|
|
13176
|
+
)), re ? (Zt = q.scrollTop, yt()) : D && Ol(u) && Lu();
|
|
13177
13177
|
}, wc = () => {
|
|
13178
13178
|
b.getSelection()?.isCollapsed !== !1 && mb(ts) && _e(A.getState());
|
|
13179
13179
|
};
|
|
@@ -13216,8 +13216,8 @@ async function lw(t = {}) {
|
|
|
13216
13216
|
bc(u), u.status === "connected" && (yo = !0, Jt && queueMicrotask(() => {
|
|
13217
13217
|
nc();
|
|
13218
13218
|
})), lc();
|
|
13219
|
-
const I = Co && !u.isThinking, x = Oa !== location.origin || La !== u.sessionId || Na !== (u.user?.id ?? null),
|
|
13220
|
-
Oa = location.origin, La = u.sessionId, Na = u.user?.id ?? null, so = u.status, Co = u.isThinking, Re && it !== null && (window.clearTimeout(it), it = null), r.classList.contains("pluno-pa-widget--open") && u.status === "connected" && (x ||
|
|
13219
|
+
const I = Co && !u.isThinking, x = Oa !== location.origin || La !== u.sessionId || Na !== (u.user?.id ?? null), D = Co !== u.isThinking, re = so !== "connected" && u.status === "connected", Re = so === "connected" && u.status !== "connected";
|
|
13220
|
+
Oa = location.origin, La = u.sessionId, Na = u.user?.id ?? null, so = u.status, Co = u.isThinking, Re && it !== null && (window.clearTimeout(it), it = null), r.classList.contains("pluno-pa-widget--open") && u.status === "connected" && (x || D || re) && ao(), me && (me.hidden = ue("task_notifications") === void 0), M && (M.hidden = ue("tab_group_permission") === void 0), I && !r.classList.contains("pluno-pa-widget--open") && (hi = !0), vo(), u.appearance ? (Eo = !0, Xe(
|
|
13221
13221
|
"web-sdk.widget",
|
|
13222
13222
|
"Agent state supplied appearance",
|
|
13223
13223
|
{
|
|
@@ -13235,9 +13235,9 @@ async function lw(t = {}) {
|
|
|
13235
13235
|
});
|
|
13236
13236
|
const _c = A.getState();
|
|
13237
13237
|
bc(_c), _e(_c), Me(), Io();
|
|
13238
|
-
const tp = Ap(r, (u, y, I, x,
|
|
13238
|
+
const tp = Ap(r, (u, y, I, x, D) => {
|
|
13239
13239
|
const re = lp(A.getState(), x);
|
|
13240
|
-
A.reportDisplayedError?.(u, y, I, re ?? void 0,
|
|
13240
|
+
A.reportDisplayedError?.(u, y, I, re ?? void 0, D);
|
|
13241
13241
|
}), np = Ty(
|
|
13242
13242
|
o,
|
|
13243
13243
|
r,
|
|
@@ -13252,7 +13252,7 @@ async function lw(t = {}) {
|
|
|
13252
13252
|
u.scribbleStyle !== void 0 && (e.scribbleStyle = u.scribbleStyle), Lo(u, "widgetHandle.updateAppearance");
|
|
13253
13253
|
},
|
|
13254
13254
|
openPanel: (u) => {
|
|
13255
|
-
const y = typeof u == "string" ? u :
|
|
13255
|
+
const y = typeof u == "string" ? u : P.value, I = typeof u == "object" ? u.focusComposer !== !1 : !0, x = typeof u == "object" ? u.trigger ?? "external_request" : "external_request";
|
|
13256
13256
|
wt(y, !1, I, !0, x);
|
|
13257
13257
|
},
|
|
13258
13258
|
closePanel: ho,
|
|
@@ -13337,21 +13337,21 @@ async function lw(t = {}) {
|
|
|
13337
13337
|
}
|
|
13338
13338
|
}
|
|
13339
13339
|
function Lo(u, y) {
|
|
13340
|
-
const I = u.accentColor ?? e.accentColor, x = u.colorScheme ?? e.colorScheme,
|
|
13340
|
+
const I = u.accentColor ?? e.accentColor, x = u.colorScheme ?? e.colorScheme, D = u.fontFamily ?? e.fontFamily, re = u.scribbleStyle ?? e.scribbleStyle, Re = JSON.stringify([I, x, D, re]);
|
|
13341
13341
|
Re !== f && (f = Re, c = Rl(
|
|
13342
13342
|
I,
|
|
13343
13343
|
re
|
|
13344
13344
|
), Tl(r, c, {
|
|
13345
13345
|
accentColor: I,
|
|
13346
13346
|
colorScheme: x,
|
|
13347
|
-
fontFamily:
|
|
13347
|
+
fontFamily: D,
|
|
13348
13348
|
scribbleStyle: re
|
|
13349
13349
|
}), Xe("web-sdk.widget", "Updated widget appearance", {
|
|
13350
13350
|
source: y,
|
|
13351
13351
|
inputAppearance: u,
|
|
13352
13352
|
appliedAccentColor: I,
|
|
13353
13353
|
appliedColorScheme: x,
|
|
13354
|
-
appliedFontFamily:
|
|
13354
|
+
appliedFontFamily: D,
|
|
13355
13355
|
appliedScribbleStyle: re,
|
|
13356
13356
|
cssAccent: r.style.getPropertyValue("--pluno-pa-accent")
|
|
13357
13357
|
}));
|
|
@@ -14483,7 +14483,7 @@ function Bw(t, e) {
|
|
|
14483
14483
|
), s;
|
|
14484
14484
|
}
|
|
14485
14485
|
function wu() {
|
|
14486
|
-
return
|
|
14486
|
+
return se("svg", {
|
|
14487
14487
|
xmlns: pu,
|
|
14488
14488
|
viewBox: "0 0 1254 1254"
|
|
14489
14489
|
});
|
|
@@ -14534,7 +14534,7 @@ function Bl(t, e, n, i, s, o, a, r) {
|
|
|
14534
14534
|
});
|
|
14535
14535
|
}
|
|
14536
14536
|
function j(t, e, n = {}) {
|
|
14537
|
-
const i =
|
|
14537
|
+
const i = se(e, n);
|
|
14538
14538
|
return t.appendChild(i), i;
|
|
14539
14539
|
}
|
|
14540
14540
|
function De(t, e, n, i) {
|
|
@@ -14549,13 +14549,13 @@ function Js(t, e, n, i) {
|
|
|
14549
14549
|
return s.type = "button", s.className = t, s.setAttribute("aria-label", e), s.title = e, s.hidden = i, s.appendChild(n), s;
|
|
14550
14550
|
}
|
|
14551
14551
|
function $w() {
|
|
14552
|
-
const t =
|
|
14552
|
+
const t = se("svg", {
|
|
14553
14553
|
class: "pluno-pa-widget__scribble-defs",
|
|
14554
14554
|
"aria-hidden": "true",
|
|
14555
14555
|
focusable: "false",
|
|
14556
14556
|
width: "0",
|
|
14557
14557
|
height: "0"
|
|
14558
|
-
}), e =
|
|
14558
|
+
}), e = se("defs");
|
|
14559
14559
|
return e.appendChild(fr("pluno-pa-scribble-wobble", "2", "12")), e.appendChild(
|
|
14560
14560
|
fr("pluno-pa-scribble-wobble-2", "5", "15")
|
|
14561
14561
|
), e.appendChild(
|
|
@@ -14563,7 +14563,7 @@ function $w() {
|
|
|
14563
14563
|
), t.appendChild(e), t;
|
|
14564
14564
|
}
|
|
14565
14565
|
function bu(t, e) {
|
|
14566
|
-
const n =
|
|
14566
|
+
const n = se("svg", {
|
|
14567
14567
|
class: `pluno-pa-widget__scribble-spirals ${t}`,
|
|
14568
14568
|
preserveAspectRatio: "xMidYMid meet",
|
|
14569
14569
|
"aria-hidden": "true",
|
|
@@ -14594,11 +14594,11 @@ function _u(t, e) {
|
|
|
14594
14594
|
`0 0 ${n} ${nw}`
|
|
14595
14595
|
), t.replaceChildren();
|
|
14596
14596
|
for (let i = 0; i < e; i += 1) {
|
|
14597
|
-
const s = Cl[i % Cl.length], o =
|
|
14597
|
+
const s = Cl[i % Cl.length], o = se("g", {
|
|
14598
14598
|
transform: `translate(${Hr + i * Kr} 0)`
|
|
14599
14599
|
});
|
|
14600
14600
|
o.appendChild(
|
|
14601
|
-
|
|
14601
|
+
se("ellipse", {
|
|
14602
14602
|
cx: s.ellipseCx,
|
|
14603
14603
|
cy: s.ellipseCy,
|
|
14604
14604
|
rx: s.ellipseRx,
|
|
@@ -14609,7 +14609,7 @@ function _u(t, e) {
|
|
|
14609
14609
|
opacity: "0.8"
|
|
14610
14610
|
})
|
|
14611
14611
|
), o.appendChild(
|
|
14612
|
-
|
|
14612
|
+
se("path", {
|
|
14613
14613
|
d: s.path,
|
|
14614
14614
|
fill: "none",
|
|
14615
14615
|
stroke: "#2c2a1e",
|
|
@@ -14620,7 +14620,7 @@ function _u(t, e) {
|
|
|
14620
14620
|
}
|
|
14621
14621
|
}
|
|
14622
14622
|
function fr(t, e, n) {
|
|
14623
|
-
const i =
|
|
14623
|
+
const i = se("filter", {
|
|
14624
14624
|
id: t,
|
|
14625
14625
|
x: "-8%",
|
|
14626
14626
|
y: "-8%",
|
|
@@ -14628,7 +14628,7 @@ function fr(t, e, n) {
|
|
|
14628
14628
|
height: "116%"
|
|
14629
14629
|
});
|
|
14630
14630
|
return i.appendChild(
|
|
14631
|
-
|
|
14631
|
+
se("feTurbulence", {
|
|
14632
14632
|
type: "fractalNoise",
|
|
14633
14633
|
baseFrequency: "0.012 0.028",
|
|
14634
14634
|
numOctaves: "3",
|
|
@@ -14636,7 +14636,7 @@ function fr(t, e, n) {
|
|
|
14636
14636
|
result: "stroke-noise"
|
|
14637
14637
|
})
|
|
14638
14638
|
), i.appendChild(
|
|
14639
|
-
|
|
14639
|
+
se("feDisplacementMap", {
|
|
14640
14640
|
in: "SourceGraphic",
|
|
14641
14641
|
in2: "stroke-noise",
|
|
14642
14642
|
scale: "3.5",
|
|
@@ -14645,7 +14645,7 @@ function fr(t, e, n) {
|
|
|
14645
14645
|
result: "warped"
|
|
14646
14646
|
})
|
|
14647
14647
|
), i.appendChild(
|
|
14648
|
-
|
|
14648
|
+
se("feTurbulence", {
|
|
14649
14649
|
type: "fractalNoise",
|
|
14650
14650
|
baseFrequency: "0.7",
|
|
14651
14651
|
numOctaves: "1",
|
|
@@ -14653,7 +14653,7 @@ function fr(t, e, n) {
|
|
|
14653
14653
|
result: "ink-noise"
|
|
14654
14654
|
})
|
|
14655
14655
|
), i.appendChild(
|
|
14656
|
-
|
|
14656
|
+
se("feDisplacementMap", {
|
|
14657
14657
|
in: "warped",
|
|
14658
14658
|
in2: "ink-noise",
|
|
14659
14659
|
scale: "0.9",
|
|
@@ -14671,7 +14671,7 @@ function Gr(t) {
|
|
|
14671
14671
|
"currentColor",
|
|
14672
14672
|
"2.25"
|
|
14673
14673
|
);
|
|
14674
|
-
return e.appendChild(
|
|
14674
|
+
return e.appendChild(se("path", { d: "m6 9 6 6 6-6" })), e;
|
|
14675
14675
|
}
|
|
14676
14676
|
function Fw() {
|
|
14677
14677
|
const t = pt(
|
|
@@ -14683,11 +14683,11 @@ function Fw() {
|
|
|
14683
14683
|
"2.25"
|
|
14684
14684
|
);
|
|
14685
14685
|
return t.appendChild(
|
|
14686
|
-
|
|
14686
|
+
se("path", {
|
|
14687
14687
|
d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"
|
|
14688
14688
|
})
|
|
14689
14689
|
), t.appendChild(
|
|
14690
|
-
|
|
14690
|
+
se("path", {
|
|
14691
14691
|
d: "M18.4 2.6a2.1 2.1 0 0 1 3 3L12 15l-4 1 1-4Z"
|
|
14692
14692
|
})
|
|
14693
14693
|
), t;
|
|
@@ -14702,10 +14702,10 @@ function jw() {
|
|
|
14702
14702
|
"2.25"
|
|
14703
14703
|
);
|
|
14704
14704
|
return t.appendChild(
|
|
14705
|
-
|
|
14705
|
+
se("path", {
|
|
14706
14706
|
d: "M17 3a2.85 2.85 0 0 1 4 4L7.5 20.5 2 22l1.5-5.5Z"
|
|
14707
14707
|
})
|
|
14708
|
-
), t.appendChild(
|
|
14708
|
+
), t.appendChild(se("path", { d: "m15 5 4 4" })), t;
|
|
14709
14709
|
}
|
|
14710
14710
|
function Kw() {
|
|
14711
14711
|
const t = pt(
|
|
@@ -14716,7 +14716,7 @@ function Kw() {
|
|
|
14716
14716
|
"currentColor",
|
|
14717
14717
|
"2.25"
|
|
14718
14718
|
);
|
|
14719
|
-
return t.appendChild(
|
|
14719
|
+
return t.appendChild(se("path", { d: "M3 12a9 9 0 1 0 3-6.7" })), t.appendChild(se("path", { d: "M3 4v5h5" })), t.appendChild(se("path", { d: "M12 7v5l3 2" })), t;
|
|
14720
14720
|
}
|
|
14721
14721
|
function Hw(t) {
|
|
14722
14722
|
const e = pt(
|
|
@@ -14732,7 +14732,7 @@ function Hw(t) {
|
|
|
14732
14732
|
...Jg,
|
|
14733
14733
|
...Yg(t)
|
|
14734
14734
|
])
|
|
14735
|
-
e.appendChild(
|
|
14735
|
+
e.appendChild(se("path", { d: n }));
|
|
14736
14736
|
return e;
|
|
14737
14737
|
}
|
|
14738
14738
|
function _a() {
|
|
@@ -14744,7 +14744,7 @@ function _a() {
|
|
|
14744
14744
|
"currentColor",
|
|
14745
14745
|
"2.4"
|
|
14746
14746
|
);
|
|
14747
|
-
return t.appendChild(
|
|
14747
|
+
return t.appendChild(se("path", { d: "M18 6 6 18" })), t.appendChild(se("path", { d: "m6 6 12 12" })), t;
|
|
14748
14748
|
}
|
|
14749
14749
|
function vu() {
|
|
14750
14750
|
const t = pt(
|
|
@@ -14756,8 +14756,8 @@ function vu() {
|
|
|
14756
14756
|
"2.75"
|
|
14757
14757
|
);
|
|
14758
14758
|
return t.appendChild(
|
|
14759
|
-
|
|
14760
|
-
), t.appendChild(
|
|
14759
|
+
se("line", { x1: "12", y1: "19", x2: "12", y2: "5" })
|
|
14760
|
+
), t.appendChild(se("polyline", { points: "5 12 12 5 19 12" })), t;
|
|
14761
14761
|
}
|
|
14762
14762
|
function Ww() {
|
|
14763
14763
|
const t = pt(
|
|
@@ -14772,7 +14772,7 @@ function Ww() {
|
|
|
14772
14772
|
"class",
|
|
14773
14773
|
"pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--standard"
|
|
14774
14774
|
), t.appendChild(
|
|
14775
|
-
|
|
14775
|
+
se("path", {
|
|
14776
14776
|
d: "m21.4 11.6-8.5 8.5a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5"
|
|
14777
14777
|
})
|
|
14778
14778
|
), t;
|
|
@@ -14783,7 +14783,7 @@ function Vw() {
|
|
|
14783
14783
|
"class",
|
|
14784
14784
|
"pluno-pa-widget__paperclip-icon pluno-pa-widget__paperclip-icon--scribble"
|
|
14785
14785
|
), t.appendChild(
|
|
14786
|
-
|
|
14786
|
+
se("path", {
|
|
14787
14787
|
d: "M7.1 15.6 15.2 7.7c1.9-1.8 4.9.8 2.7 3.2l-8.8 8.3c-3.2 3-8-1.1-4.6-4.8l10.1-9.1",
|
|
14788
14788
|
stroke: "currentColor",
|
|
14789
14789
|
"stroke-width": "2",
|
|
@@ -14795,7 +14795,7 @@ function Vw() {
|
|
|
14795
14795
|
function Gw() {
|
|
14796
14796
|
const t = pt("0 0 24 24", 18, 18, "currentColor");
|
|
14797
14797
|
return t.appendChild(
|
|
14798
|
-
|
|
14798
|
+
se("rect", {
|
|
14799
14799
|
x: "6",
|
|
14800
14800
|
y: "6",
|
|
14801
14801
|
width: "12",
|
|
@@ -14813,7 +14813,7 @@ function Jw() {
|
|
|
14813
14813
|
"currentColor",
|
|
14814
14814
|
"2.4"
|
|
14815
14815
|
);
|
|
14816
|
-
return t.appendChild(
|
|
14816
|
+
return t.appendChild(se("path", { d: "M18 6 6 18" })), t.appendChild(se("path", { d: "m6 6 12 12" })), t;
|
|
14817
14817
|
}
|
|
14818
14818
|
function Yw() {
|
|
14819
14819
|
const t = pt(
|
|
@@ -14825,7 +14825,7 @@ function Yw() {
|
|
|
14825
14825
|
"2.25"
|
|
14826
14826
|
);
|
|
14827
14827
|
return t.appendChild(
|
|
14828
|
-
|
|
14828
|
+
se("rect", {
|
|
14829
14829
|
width: "14",
|
|
14830
14830
|
height: "14",
|
|
14831
14831
|
x: "8",
|
|
@@ -14834,7 +14834,7 @@ function Yw() {
|
|
|
14834
14834
|
ry: "2"
|
|
14835
14835
|
})
|
|
14836
14836
|
), t.appendChild(
|
|
14837
|
-
|
|
14837
|
+
se("path", {
|
|
14838
14838
|
d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
|
|
14839
14839
|
})
|
|
14840
14840
|
), t;
|
|
@@ -14847,9 +14847,9 @@ function pt(t, e, n, i, s, o) {
|
|
|
14847
14847
|
fill: i,
|
|
14848
14848
|
"aria-hidden": "true"
|
|
14849
14849
|
};
|
|
14850
|
-
return s && (a.stroke = s, a["stroke-linecap"] = "round", a["stroke-linejoin"] = "round"), o && (a["stroke-width"] = o),
|
|
14850
|
+
return s && (a.stroke = s, a["stroke-linecap"] = "round", a["stroke-linejoin"] = "round"), o && (a["stroke-width"] = o), se("svg", a);
|
|
14851
14851
|
}
|
|
14852
|
-
function
|
|
14852
|
+
function se(t, e = {}) {
|
|
14853
14853
|
const n = document.createElementNS(pu, t);
|
|
14854
14854
|
for (const [i, s] of Object.entries(e))
|
|
14855
14855
|
n.setAttribute(i, s);
|
|
@@ -15133,8 +15133,8 @@ function jl(t, e) {
|
|
|
15133
15133
|
const i = n[1], s = e ? "Finding example tasks..." : " ";
|
|
15134
15134
|
i.textContent !== s && (i.textContent = s), i.classList.toggle("pluno-pa-widget__starter-placeholder--loading", e), i.parentElement.setAttribute("aria-hidden", String(!e));
|
|
15135
15135
|
}
|
|
15136
|
-
function lb(t, e, n, i, s, o, a, r, c, l, p, d, h, g, m, f, w, b, _, v, E, L, K, U,
|
|
15137
|
-
const
|
|
15136
|
+
function lb(t, e, n, i, s, o, a, r, c, l, p, d, h, g, m, f, w, b, _, v, E, L, K, U, he, G, oe, R) {
|
|
15137
|
+
const V = (C) => {
|
|
15138
15138
|
const k = G.states.get(C.authRequestId) ?? { status: G.initialStatus }, N = `integration-retry:${C.authRequestId}`, ye = `integration-connect:${C.authRequestId}`, Le = K?.has(N) ? "retry" : K?.has(ye) ? "connect" : null;
|
|
15139
15139
|
return db(
|
|
15140
15140
|
C,
|
|
@@ -15143,11 +15143,11 @@ function lb(t, e, n, i, s, o, a, r, c, l, p, d, h, g, m, f, w, b, _, v, E, L, K,
|
|
|
15143
15143
|
G.presentations.get(C.authRequestId),
|
|
15144
15144
|
Le
|
|
15145
15145
|
);
|
|
15146
|
-
},
|
|
15147
|
-
if (
|
|
15148
|
-
for (const C of
|
|
15146
|
+
}, O = bp(o), S = _b(o), F = Array.isArray(o.activeScheduledFollowUps) ? o.activeScheduledFollowUps : null, ee = /* @__PURE__ */ new Map();
|
|
15147
|
+
if (F !== null)
|
|
15148
|
+
for (const C of F) {
|
|
15149
15149
|
const k = Jn(C.dueAt);
|
|
15150
|
-
k &&
|
|
15150
|
+
k && ee.set(C.taskId, { dueAt: C.dueAt, label: k });
|
|
15151
15151
|
}
|
|
15152
15152
|
else
|
|
15153
15153
|
for (const C of S) {
|
|
@@ -15155,62 +15155,62 @@ function lb(t, e, n, i, s, o, a, r, c, l, p, d, h, g, m, f, w, b, _, v, E, L, K,
|
|
|
15155
15155
|
if (!k || !C.scheduledCheckInAt)
|
|
15156
15156
|
continue;
|
|
15157
15157
|
const N = C.scheduledCheckInId ?? C.id;
|
|
15158
|
-
|
|
15158
|
+
ee.set(N, {
|
|
15159
15159
|
dueAt: C.scheduledCheckInAt,
|
|
15160
15160
|
label: k
|
|
15161
15161
|
});
|
|
15162
15162
|
}
|
|
15163
|
-
const ce = [...
|
|
15163
|
+
const ce = [...ee.values()].sort((C, k) => Date.parse(C.dueAt) - Date.parse(k.dueAt)), te = vb(
|
|
15164
15164
|
S.filter(
|
|
15165
15165
|
(C) => !Cu(C) && !C.scheduledCheckInAt
|
|
15166
15166
|
),
|
|
15167
15167
|
o.segments
|
|
15168
15168
|
), Se = new Map((o.segments ?? []).flatMap((C) => C.activityIds.map((k) => [k, C])));
|
|
15169
15169
|
t.dataset.selectedSessionId = o.sessionId ?? "", t.dataset.loadingSession = String(o.isLoadingSession);
|
|
15170
|
-
const
|
|
15171
|
-
if (
|
|
15172
|
-
const C =
|
|
15173
|
-
(N) => N.role === "user" && N.id ===
|
|
15174
|
-
), k =
|
|
15175
|
-
(N) => N.role !== "user" && N.respondsToUserMessageId ===
|
|
15170
|
+
const P = o.activeResponseUserMessageId;
|
|
15171
|
+
if (O.showProgress && o.turnPhase && !o.assistantDraft && P) {
|
|
15172
|
+
const C = te.findIndex(
|
|
15173
|
+
(N) => N.role === "user" && N.id === P
|
|
15174
|
+
), k = te.some(
|
|
15175
|
+
(N) => N.role !== "user" && N.respondsToUserMessageId === P
|
|
15176
15176
|
);
|
|
15177
|
-
C !== -1 && !k &&
|
|
15178
|
-
id: `turn-status:${
|
|
15177
|
+
C !== -1 && !k && te.splice(C + 1, 0, {
|
|
15178
|
+
id: `turn-status:${P}`,
|
|
15179
15179
|
role: "system",
|
|
15180
15180
|
content: "",
|
|
15181
|
-
createdAt:
|
|
15182
|
-
respondsToUserMessageId:
|
|
15181
|
+
createdAt: te[C].createdAt,
|
|
15182
|
+
respondsToUserMessageId: P,
|
|
15183
15183
|
dataType: "run_status",
|
|
15184
15184
|
loading: !0
|
|
15185
15185
|
});
|
|
15186
15186
|
}
|
|
15187
|
-
const fe = t.scrollTop, Oe = [], et = /* @__PURE__ */ new Set(), Ce = /* @__PURE__ */ new Set(), $e = /* @__PURE__ */ new Set(),
|
|
15187
|
+
const fe = t.scrollTop, Oe = [], et = /* @__PURE__ */ new Set(), Ce = /* @__PURE__ */ new Set(), $e = /* @__PURE__ */ new Set(), J = (C) => {
|
|
15188
15188
|
C === e && Oe.push(t.querySelector('slot[name="conversation-notices"]') ?? fu("conversation-notices")), C.dataset.sessionId = o.sessionId ?? "", Oe.push(C);
|
|
15189
15189
|
};
|
|
15190
15190
|
Sa(n, o.isThinking), n.disabled = !1, s.hidden = !r, r && a !== null && yu(s, a);
|
|
15191
|
-
const tt = !!(G?.requests.length ||
|
|
15191
|
+
const tt = !!(G?.requests.length || oe || R?.candidate), z = tt || te.length > 0 || ce.length > 0 || !!o.assistantDraft || o.pendingMessageStatus !== null || o.isThinking;
|
|
15192
15192
|
if (i(z || !!o.historyPreparation), o.historyPreparation && z) {
|
|
15193
15193
|
const C = document.createElement("div");
|
|
15194
|
-
C.className = "pluno-pa-widget__transcript-loading", C.setAttribute("role", "status"), C.append(pn(), document.createTextNode("Preparing this conversation…")),
|
|
15194
|
+
C.className = "pluno-pa-widget__transcript-loading", C.setAttribute("role", "status"), C.append(pn(), document.createTextNode("Preparing this conversation…")), J(C);
|
|
15195
15195
|
}
|
|
15196
15196
|
if (o.isLoadingSession && !z) {
|
|
15197
15197
|
const C = document.createElement("div");
|
|
15198
15198
|
C.className = "pluno-pa-widget__transcript-loading", C.setAttribute("role", "status");
|
|
15199
15199
|
const k = document.createElement("span");
|
|
15200
|
-
k.textContent = o.historyPreparation ? "Preparing this conversation…" : "Loading chat...", C.append(pn(), k), d.clear(), h.clear(), g.clear(),
|
|
15200
|
+
k.textContent = o.historyPreparation ? "Preparing this conversation…" : "Loading chat...", C.append(pn(), k), d.clear(), h.clear(), g.clear(), J(C), J(e), Tt(t, Oe);
|
|
15201
15201
|
return;
|
|
15202
15202
|
}
|
|
15203
15203
|
if (!z && o.sessionId && !o.isDraftSession) {
|
|
15204
15204
|
if (!o.lastError) {
|
|
15205
15205
|
const C = document.createElement("div");
|
|
15206
|
-
C.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--conversation", C.textContent = wp,
|
|
15206
|
+
C.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--conversation", C.textContent = wp, J(C);
|
|
15207
15207
|
}
|
|
15208
15208
|
if (!o.lastError || Pi(o.lastErrorCode) === "bottom_notice") {
|
|
15209
|
-
|
|
15209
|
+
J(e), Tt(t, Oe);
|
|
15210
15210
|
return;
|
|
15211
15211
|
}
|
|
15212
15212
|
}
|
|
15213
|
-
if (
|
|
15213
|
+
if (te.length === 0 && !tt && ce.length === 0 && !o.assistantDraft && (!o.lastError || Pi(o.lastErrorCode) === "bottom_notice") && !o.pendingMessageStatus && !o.isThinking) {
|
|
15214
15214
|
const C = JSON.stringify([
|
|
15215
15215
|
o.sessionId,
|
|
15216
15216
|
o.user?.id,
|
|
@@ -15219,7 +15219,7 @@ function lb(t, e, n, i, s, o, a, r, c, l, p, d, h, g, m, f, w, b, _, v, E, L, K,
|
|
|
15219
15219
|
f()
|
|
15220
15220
|
]), k = d.get("welcome");
|
|
15221
15221
|
if (k?.renderSignature === C) {
|
|
15222
|
-
jl(k.node, o.starterPromptsLoading),
|
|
15222
|
+
jl(k.node, o.starterPromptsLoading), J(k.node), J(e), Tt(t, Oe);
|
|
15223
15223
|
return;
|
|
15224
15224
|
}
|
|
15225
15225
|
const N = document.createElement("div");
|
|
@@ -15231,121 +15231,121 @@ function lb(t, e, n, i, s, o, a, r, c, l, p, d, h, g, m, f, w, b, _, v, E, L, K,
|
|
|
15231
15231
|
f()
|
|
15232
15232
|
);
|
|
15233
15233
|
if (ye.appendChild(Le), N.appendChild(ye), _) {
|
|
15234
|
-
const
|
|
15235
|
-
|
|
15234
|
+
const Z = document.createElement("h2");
|
|
15235
|
+
Z.className = "pluno-pa-widget__empty pluno-pa-widget__morning-report-title", Z.textContent = _.opening, N.appendChild(Z);
|
|
15236
15236
|
} else
|
|
15237
15237
|
N.appendChild(mu());
|
|
15238
|
-
const
|
|
15239
|
-
if (
|
|
15240
|
-
for (const
|
|
15238
|
+
const X = _?.prompts ?? o.starterPrompts, B = document.createElement("div");
|
|
15239
|
+
if (B.className = X.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", X.length === 0 && !o.starterPromptsLoading && B.setAttribute("aria-hidden", "true"), X.length > 0)
|
|
15240
|
+
for (const Z of X) {
|
|
15241
15241
|
const ae = document.createElement("button");
|
|
15242
|
-
ae.type = "button", ae.className = "pluno-pa-widget__starter-prompt", ae.textContent =
|
|
15243
|
-
w(
|
|
15244
|
-
}),
|
|
15242
|
+
ae.type = "button", ae.className = "pluno-pa-widget__starter-prompt", ae.textContent = Z, ae.addEventListener("click", () => {
|
|
15243
|
+
w(Z);
|
|
15244
|
+
}), B.appendChild(ae);
|
|
15245
15245
|
}
|
|
15246
15246
|
else
|
|
15247
|
-
for (let
|
|
15247
|
+
for (let Z = 0; Z < jy; Z += 1) {
|
|
15248
15248
|
const ae = document.createElement("div");
|
|
15249
|
-
ae.className = "pluno-pa-widget__starter-placeholder",
|
|
15249
|
+
ae.className = "pluno-pa-widget__starter-placeholder", Z === 1 && ae.setAttribute("role", "status"), ae.textContent = " ", B.appendChild(ae);
|
|
15250
15250
|
}
|
|
15251
|
-
if (N.appendChild(
|
|
15252
|
-
const
|
|
15253
|
-
|
|
15251
|
+
if (N.appendChild(B), jl(N, o.starterPromptsLoading), _) {
|
|
15252
|
+
const Z = document.createElement("button");
|
|
15253
|
+
Z.type = "button", Z.className = "pluno-pa-widget__morning-report-snooze", Z.textContent = "Snooze morning report", Z.addEventListener("click", v), N.appendChild(Z);
|
|
15254
15254
|
}
|
|
15255
|
-
d.clear(), h.clear(), g.clear(),
|
|
15255
|
+
d.clear(), h.clear(), g.clear(), J(N), d.set("welcome", { node: N, renderSignature: C }), J(e), Tt(t, Oe);
|
|
15256
15256
|
return;
|
|
15257
15257
|
}
|
|
15258
|
-
let
|
|
15259
|
-
const W =
|
|
15258
|
+
let Y = null, H = null, ie = [], ve = [];
|
|
15259
|
+
const W = te.some(Yr), q = te.some(
|
|
15260
15260
|
(C) => C.role === "tool" && C.id === o.activity?.activeItemId
|
|
15261
15261
|
), le = o.turnPhase ? Ey(o.turnPhase) : "Thinking...";
|
|
15262
15262
|
let me = !1;
|
|
15263
15263
|
const ke = () => {
|
|
15264
|
-
if (
|
|
15264
|
+
if (ie.length === 0)
|
|
15265
15265
|
return me = !1, !1;
|
|
15266
|
-
const C =
|
|
15266
|
+
const C = O.showProgress && ie.some(
|
|
15267
15267
|
(N) => N.id === o.activity?.activeItemId
|
|
15268
15268
|
), k = Ab(
|
|
15269
|
-
|
|
15269
|
+
ie,
|
|
15270
15270
|
C,
|
|
15271
15271
|
p,
|
|
15272
15272
|
h,
|
|
15273
15273
|
Ce,
|
|
15274
15274
|
m,
|
|
15275
15275
|
f(),
|
|
15276
|
-
Se.get(
|
|
15276
|
+
Se.get(ie[0].id)?.collapsed ?? !0
|
|
15277
15277
|
);
|
|
15278
|
-
return
|
|
15278
|
+
return J(k), Y = null, H = k, ie = [], me = C, !0;
|
|
15279
15279
|
}, Fe = /* @__PURE__ */ new Set();
|
|
15280
15280
|
let ht = !1;
|
|
15281
15281
|
const je = () => {
|
|
15282
15282
|
for (const C of ve)
|
|
15283
|
-
|
|
15283
|
+
J(C), Y = null, H = C;
|
|
15284
15284
|
ve = [];
|
|
15285
15285
|
};
|
|
15286
|
-
for (let C = 0; C <
|
|
15287
|
-
const k =
|
|
15286
|
+
for (let C = 0; C < te.length; C += 1) {
|
|
15287
|
+
const k = te[C];
|
|
15288
15288
|
if (k.role === "tool" && k.integrationAuthRequest && G) {
|
|
15289
15289
|
Fe.add(k.integrationAuthRequest.authRequestId);
|
|
15290
|
-
const
|
|
15291
|
-
ve.push(
|
|
15290
|
+
const B = V(k.integrationAuthRequest);
|
|
15291
|
+
ve.push(B);
|
|
15292
15292
|
continue;
|
|
15293
15293
|
}
|
|
15294
|
-
if (k.role === "tool" && k.personalChannelConnectionRequest &&
|
|
15294
|
+
if (k.role === "tool" && k.personalChannelConnectionRequest && oe) {
|
|
15295
15295
|
ht = !0, ve.push(
|
|
15296
15296
|
Kl(
|
|
15297
15297
|
k.personalChannelConnectionRequest,
|
|
15298
|
-
|
|
15299
|
-
|
|
15298
|
+
oe.onConnect,
|
|
15299
|
+
oe.presentation
|
|
15300
15300
|
)
|
|
15301
15301
|
);
|
|
15302
15302
|
continue;
|
|
15303
15303
|
}
|
|
15304
15304
|
if (k.role === "tool") {
|
|
15305
|
-
|
|
15305
|
+
ie.length > 0 && Se.get(ie[0].id)?.id !== Se.get(k.id)?.id && ke(), ie.push(k);
|
|
15306
15306
|
continue;
|
|
15307
15307
|
}
|
|
15308
15308
|
if (k.role === "system" && k.dataType === "run_status" && k.steered === !0) {
|
|
15309
15309
|
if (!ke()) {
|
|
15310
|
-
const
|
|
15311
|
-
|
|
15310
|
+
const Z = Pb(f());
|
|
15311
|
+
J(Z), Y = null, H = Z;
|
|
15312
15312
|
}
|
|
15313
15313
|
continue;
|
|
15314
15314
|
}
|
|
15315
15315
|
if (Yr(k)) {
|
|
15316
|
-
if (!
|
|
15316
|
+
if (!O.showProgress)
|
|
15317
15317
|
continue;
|
|
15318
|
-
const
|
|
15319
|
-
if (
|
|
15318
|
+
const B = ke(), Z = Eu(k);
|
|
15319
|
+
if (B) {
|
|
15320
15320
|
if (!me) {
|
|
15321
15321
|
const ae = Vl(
|
|
15322
15322
|
g,
|
|
15323
15323
|
$e,
|
|
15324
|
-
|
|
15324
|
+
Z,
|
|
15325
15325
|
le
|
|
15326
15326
|
);
|
|
15327
|
-
|
|
15327
|
+
J(ae), Y = null, H = ae;
|
|
15328
15328
|
}
|
|
15329
15329
|
} else {
|
|
15330
15330
|
const ae = Wl(
|
|
15331
15331
|
g,
|
|
15332
15332
|
$e,
|
|
15333
|
-
|
|
15333
|
+
Z,
|
|
15334
15334
|
f(),
|
|
15335
15335
|
le
|
|
15336
15336
|
);
|
|
15337
|
-
|
|
15337
|
+
J(ae), Y = null, H = ae;
|
|
15338
15338
|
}
|
|
15339
15339
|
continue;
|
|
15340
15340
|
}
|
|
15341
15341
|
if (k.role === "system") {
|
|
15342
15342
|
if (k.dataType === "run_error" || k.dataType === "run_status") {
|
|
15343
|
-
const
|
|
15343
|
+
const B = ke(), Z = te.some(
|
|
15344
15344
|
(we) => we.role === "tool" && Ns(we, k)
|
|
15345
15345
|
);
|
|
15346
|
-
if (
|
|
15346
|
+
if (!B && !Z) {
|
|
15347
15347
|
const we = Oi(f());
|
|
15348
|
-
we.classList.add("pluno-pa-widget__terminal-marker"),
|
|
15348
|
+
we.classList.add("pluno-pa-widget__terminal-marker"), J(we);
|
|
15349
15349
|
}
|
|
15350
15350
|
const ae = document.createElement("div"), hn = k.dataType === "run_error";
|
|
15351
15351
|
if (ae.className = hn ? "pluno-pa-widget__error" : "pluno-pa-widget__status pluno-pa-widget__run-status", ae.dataset.messageKey = Ia(k), ae.dataset.canonicalItemKey = k.id, ae.dataset.messageRole = "system", k.provisional || (ae.dataset.terminalResponseKey = k.id), k.runId && (ae.dataset.runId = k.runId), ae.textContent = Us(
|
|
@@ -15354,35 +15354,35 @@ function lb(t, e, n, i, s, o, a, r, c, l, p, d, h, g, m, f, w, b, _, v, E, L, K,
|
|
|
15354
15354
|
const we = document.createElement("a");
|
|
15355
15355
|
we.className = "pluno-pa-widget__error-retry", we.href = k.securitySettingsUrl, we.target = "_blank", we.rel = "noreferrer", we.textContent = "Security settings", ae.appendChild(we);
|
|
15356
15356
|
}
|
|
15357
|
-
|
|
15357
|
+
J(ae), Y = hn ? ae : null, H = hn ? null : ae, je();
|
|
15358
15358
|
}
|
|
15359
15359
|
continue;
|
|
15360
15360
|
}
|
|
15361
15361
|
k.role === "user" && je();
|
|
15362
|
-
const N = ke(), ye = Us(k.content), Le = k.role === "assistant" &&
|
|
15363
|
-
(
|
|
15362
|
+
const N = ke(), ye = Us(k.content), Le = k.role === "assistant" && te.some(
|
|
15363
|
+
(B) => B.role === "tool" && Ns(B, k)
|
|
15364
15364
|
);
|
|
15365
15365
|
if (k.role === "assistant" && !N && !Le) {
|
|
15366
|
-
const
|
|
15367
|
-
|
|
15366
|
+
const B = Oi(f());
|
|
15367
|
+
J(B), Y = null, H = B;
|
|
15368
15368
|
}
|
|
15369
|
-
const
|
|
15369
|
+
const X = ub(
|
|
15370
15370
|
k,
|
|
15371
15371
|
ye,
|
|
15372
15372
|
d,
|
|
15373
15373
|
et,
|
|
15374
|
-
|
|
15374
|
+
he
|
|
15375
15375
|
);
|
|
15376
|
-
if (
|
|
15377
|
-
const
|
|
15378
|
-
|
|
15376
|
+
if (X.querySelector("[data-submission-retry]")?.remove(), k.role === "user" && k.retryable) {
|
|
15377
|
+
const B = document.createElement("button");
|
|
15378
|
+
B.type = "button", B.className = "pluno-pa-widget__error-retry", B.dataset.submissionRetry = k.id, B.textContent = "Retry this message", B.addEventListener("click", () => b(k.id)), X.appendChild(B);
|
|
15379
15379
|
}
|
|
15380
|
-
|
|
15380
|
+
J(X), Y = X, H = null, k.role === "assistant" && je();
|
|
15381
15381
|
}
|
|
15382
|
-
const
|
|
15383
|
-
if (
|
|
15382
|
+
const M = ke(), Q = te[te.length - 1]?.role === "assistant";
|
|
15383
|
+
if (O.showProgress && o.turnPhase && !o.assistantDraft && !q && !Q && !W) {
|
|
15384
15384
|
const C = o.activeResponseUserMessageId ? `response:${o.activeResponseUserMessageId}` : `session:${o.sessionId ?? "pending"}`;
|
|
15385
|
-
if (
|
|
15385
|
+
if (M) {
|
|
15386
15386
|
if (!me) {
|
|
15387
15387
|
const k = Vl(
|
|
15388
15388
|
g,
|
|
@@ -15390,7 +15390,7 @@ function lb(t, e, n, i, s, o, a, r, c, l, p, d, h, g, m, f, w, b, _, v, E, L, K,
|
|
|
15390
15390
|
C,
|
|
15391
15391
|
le
|
|
15392
15392
|
);
|
|
15393
|
-
|
|
15393
|
+
J(k), Y = null, H = k;
|
|
15394
15394
|
}
|
|
15395
15395
|
} else {
|
|
15396
15396
|
const k = Wl(
|
|
@@ -15400,54 +15400,54 @@ function lb(t, e, n, i, s, o, a, r, c, l, p, d, h, g, m, f, w, b, _, v, E, L, K,
|
|
|
15400
15400
|
f(),
|
|
15401
15401
|
le
|
|
15402
15402
|
);
|
|
15403
|
-
|
|
15403
|
+
J(k), Y = null, H = k;
|
|
15404
15404
|
}
|
|
15405
15405
|
}
|
|
15406
15406
|
if (o.lastError && Pi(o.lastErrorCode) === "conversation") {
|
|
15407
|
-
const N =
|
|
15407
|
+
const N = te.slice(te.map((X) => X.role).lastIndexOf("user") + 1).some((X) => X.role === "assistant" || X.role === "tool") ? document.createElement("article") : Oi(f());
|
|
15408
15408
|
N.classList.add("pluno-pa-widget__terminal-marker");
|
|
15409
15409
|
const ye = document.createElement("div");
|
|
15410
15410
|
ye.className = "pluno-pa-widget__error", o.historyRefreshFailure && (ye.dataset.historyRefreshFailure = JSON.stringify(o.historyRefreshFailure));
|
|
15411
15411
|
const Le = document.createElement("span");
|
|
15412
15412
|
if (Le.textContent = o.lastError, ye.appendChild(Le), o.lastErrorSecuritySettingsUrl) {
|
|
15413
|
-
const
|
|
15414
|
-
|
|
15413
|
+
const X = document.createElement("a");
|
|
15414
|
+
X.className = "pluno-pa-widget__error-retry", X.href = o.lastErrorSecuritySettingsUrl, X.target = "_blank", X.rel = "noreferrer", X.textContent = "Security settings", ye.appendChild(X);
|
|
15415
15415
|
}
|
|
15416
|
-
for (const
|
|
15417
|
-
const
|
|
15418
|
-
|
|
15419
|
-
const
|
|
15420
|
-
|
|
15416
|
+
for (const X of O.actions) {
|
|
15417
|
+
const B = document.createElement("button");
|
|
15418
|
+
B.type = "button", B.className = "pluno-pa-widget__error-retry";
|
|
15419
|
+
const Z = K?.has(X) === !0 || X === "retry_history" && o.conversationDiagnostics?.queryRequestId != null || X === "retry_message" && o.isRetrying;
|
|
15420
|
+
B.disabled = Z, B.setAttribute("aria-busy", String(Z)), B.textContent = X === "new_chat" ? Z ? "Starting new chat" : "Start new chat" : Z ? "Trying" : "Try again", Z && B.prepend(pn()), B.addEventListener("click", () => U(X, X === "retry_history" ? E : X === "retry_message" ? b : L)), ye.appendChild(B);
|
|
15421
15421
|
}
|
|
15422
|
-
N.appendChild(ye),
|
|
15422
|
+
N.appendChild(ye), J(N), Y = null, H = N;
|
|
15423
15423
|
}
|
|
15424
15424
|
for (const C of G?.requests ?? []) {
|
|
15425
15425
|
if (Fe.has(C.authRequestId)) continue;
|
|
15426
|
-
const k =
|
|
15427
|
-
|
|
15426
|
+
const k = V(C);
|
|
15427
|
+
J(k), Y = null, H = k;
|
|
15428
15428
|
}
|
|
15429
|
-
if (
|
|
15429
|
+
if (oe && !ht) {
|
|
15430
15430
|
const C = Kl(
|
|
15431
|
-
|
|
15432
|
-
|
|
15433
|
-
|
|
15431
|
+
oe.request,
|
|
15432
|
+
oe.onConnect,
|
|
15433
|
+
oe.presentation
|
|
15434
15434
|
);
|
|
15435
|
-
|
|
15435
|
+
J(C), Y = null, H = C;
|
|
15436
15436
|
}
|
|
15437
|
-
const de =
|
|
15438
|
-
if (
|
|
15437
|
+
const de = R ? R.actionCandidate ?? R.candidate ?? (o.isThinking ? null : Dd(S)) : null;
|
|
15438
|
+
if (R && de && !R.dismissedCandidateIds.has(de.id)) {
|
|
15439
15439
|
const C = kb(de, {
|
|
15440
|
-
isActing:
|
|
15441
|
-
error:
|
|
15442
|
-
characterIconOptions:
|
|
15443
|
-
socialPostRewardsUrl:
|
|
15444
|
-
presentation:
|
|
15445
|
-
onReferralCopy:
|
|
15446
|
-
onSocialShare:
|
|
15447
|
-
onDismiss:
|
|
15448
|
-
onDisable:
|
|
15440
|
+
isActing: R.actionCandidate?.id === de.id,
|
|
15441
|
+
error: R.error,
|
|
15442
|
+
characterIconOptions: R.characterIconOptions,
|
|
15443
|
+
socialPostRewardsUrl: R.socialPostRewardsUrl,
|
|
15444
|
+
presentation: R.presentation,
|
|
15445
|
+
onReferralCopy: R.onReferralCopy,
|
|
15446
|
+
onSocialShare: R.onSocialShare,
|
|
15447
|
+
onDismiss: R.onDismiss,
|
|
15448
|
+
onDisable: R.onDisable
|
|
15449
15449
|
});
|
|
15450
|
-
|
|
15450
|
+
J(C), R.onSeen(de), Y = null, H = C;
|
|
15451
15451
|
}
|
|
15452
15452
|
je();
|
|
15453
15453
|
for (const C of ce) {
|
|
@@ -15455,13 +15455,13 @@ function lb(t, e, n, i, s, o, a, r, c, l, p, d, h, g, m, f, w, b, _, v, E, L, K,
|
|
|
15455
15455
|
k.className = "pluno-pa-widget__next-check-in", k.append(
|
|
15456
15456
|
Hw(C.dueAt),
|
|
15457
15457
|
document.createTextNode(C.label)
|
|
15458
|
-
),
|
|
15458
|
+
), J(k), Y = null, H = k;
|
|
15459
15459
|
}
|
|
15460
|
-
|
|
15460
|
+
Y?.classList.add(
|
|
15461
15461
|
"pluno-pa-widget__message--bottom-reserve"
|
|
15462
15462
|
), H?.classList.add(
|
|
15463
15463
|
"pluno-pa-widget__bottom-reserve-compact"
|
|
15464
|
-
),
|
|
15464
|
+
), J(e), yb(
|
|
15465
15465
|
d,
|
|
15466
15466
|
et
|
|
15467
15467
|
), wb(
|
|
@@ -15838,26 +15838,26 @@ function Ab(t, e, n, i, s, o, a, r = !0) {
|
|
|
15838
15838
|
a
|
|
15839
15839
|
), K = JSON.stringify(a), U = document.createElement("div");
|
|
15840
15840
|
U.className = "pluno-pa-widget__tool-active-content";
|
|
15841
|
-
const
|
|
15842
|
-
|
|
15843
|
-
const
|
|
15844
|
-
|
|
15845
|
-
const
|
|
15846
|
-
G.open ? (n.delete(
|
|
15847
|
-
}), G.appendChild(
|
|
15848
|
-
const
|
|
15849
|
-
|
|
15850
|
-
E.dataset.responseGroupKey, E.classList.toggle("pluno-pa-widget__tool-group--open", G.open),
|
|
15841
|
+
const he = Ys(), G = document.createElement("details"), oe = document.createElement("summary");
|
|
15842
|
+
oe.className = "pluno-pa-widget__tool-summary";
|
|
15843
|
+
const R = document.createElement("div");
|
|
15844
|
+
R.className = "pluno-pa-widget__tool-summary-title", oe.appendChild(R), oe.addEventListener("click", () => {
|
|
15845
|
+
const O = E.dataset.responseGroupKey ?? l;
|
|
15846
|
+
G.open ? (n.delete(O), n.add(`closed:${O}`)) : (n.add(O), n.delete(`closed:${O}`)), o(), R.textContent = G.open ? E.dataset.collapsedActivityTitle ?? "Activities" : "Activities";
|
|
15847
|
+
}), G.appendChild(oe);
|
|
15848
|
+
const V = document.createElement("div");
|
|
15849
|
+
V.className = "pluno-pa-widget__tool-lines", G.addEventListener("toggle", () => {
|
|
15850
|
+
E.dataset.responseGroupKey, E.classList.toggle("pluno-pa-widget__tool-group--open", G.open), R.textContent = G.open ? "Activities" : E.dataset.collapsedActivityTitle ?? "Activities";
|
|
15851
15851
|
}), p = {
|
|
15852
15852
|
node: E,
|
|
15853
15853
|
character: L,
|
|
15854
15854
|
characterSignature: K,
|
|
15855
15855
|
activeContent: U,
|
|
15856
|
-
thinkingStatus:
|
|
15856
|
+
thinkingStatus: he,
|
|
15857
15857
|
details: G,
|
|
15858
|
-
summary:
|
|
15859
|
-
summaryTitle:
|
|
15860
|
-
lines:
|
|
15858
|
+
summary: oe,
|
|
15859
|
+
summaryTitle: R,
|
|
15860
|
+
lines: V,
|
|
15861
15861
|
lineNodes: /* @__PURE__ */ new Map()
|
|
15862
15862
|
}, i.set(l, p);
|
|
15863
15863
|
}
|